chore: oxfmt
This commit is contained in:
@@ -15,7 +15,10 @@ import type { MsgContext } from "../templating.js";
|
|||||||
import { logVerbose } from "../../globals.js";
|
import { logVerbose } from "../../globals.js";
|
||||||
import { stripMentions, stripStructuralPrefixes } from "./mentions.js";
|
import { stripMentions, stripStructuralPrefixes } from "./mentions.js";
|
||||||
import { clearSessionQueues } from "./queue.js";
|
import { clearSessionQueues } from "./queue.js";
|
||||||
import { resolveInternalSessionKey, resolveMainSessionAlias } from "../../agents/tools/sessions-helpers.js";
|
import {
|
||||||
|
resolveInternalSessionKey,
|
||||||
|
resolveMainSessionAlias,
|
||||||
|
} from "../../agents/tools/sessions-helpers.js";
|
||||||
|
|
||||||
const ABORT_TRIGGERS = new Set(["stop", "esc", "abort", "wait", "exit", "interrupt"]);
|
const ABORT_TRIGGERS = new Set(["stop", "esc", "abort", "wait", "exit", "interrupt"]);
|
||||||
const ABORT_MEMORY = new Map<string, boolean>();
|
const ABORT_MEMORY = new Map<string, boolean>();
|
||||||
|
|||||||
@@ -6,7 +6,12 @@ import { scheduleGatewaySigusr1Restart, triggerClawdbotRestart } from "../../inf
|
|||||||
import { parseAgentSessionKey } from "../../routing/session-key.js";
|
import { parseAgentSessionKey } from "../../routing/session-key.js";
|
||||||
import { parseActivationCommand } from "../group-activation.js";
|
import { parseActivationCommand } from "../group-activation.js";
|
||||||
import { parseSendPolicyCommand } from "../send-policy.js";
|
import { parseSendPolicyCommand } from "../send-policy.js";
|
||||||
import { formatAbortReplyText, isAbortTrigger, setAbortMemory, stopSubagentsForRequester } from "./abort.js";
|
import {
|
||||||
|
formatAbortReplyText,
|
||||||
|
isAbortTrigger,
|
||||||
|
setAbortMemory,
|
||||||
|
stopSubagentsForRequester,
|
||||||
|
} from "./abort.js";
|
||||||
import { clearSessionQueues } from "./queue.js";
|
import { clearSessionQueues } from "./queue.js";
|
||||||
import type { CommandHandler } from "./commands-types.js";
|
import type { CommandHandler } from "./commands-types.js";
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ export function resolveMentionGating(params: MentionGateParams): MentionGateResu
|
|||||||
const implicit = params.implicitMention === true;
|
const implicit = params.implicitMention === true;
|
||||||
const bypass = params.shouldBypassMention === true;
|
const bypass = params.shouldBypassMention === true;
|
||||||
const effectiveWasMentioned = params.wasMentioned || implicit || bypass;
|
const effectiveWasMentioned = params.wasMentioned || implicit || bypass;
|
||||||
const shouldSkip =
|
const shouldSkip = params.requireMention && params.canDetectMention && !effectiveWasMentioned;
|
||||||
params.requireMention && params.canDetectMention && !effectiveWasMentioned;
|
|
||||||
return { effectiveWasMentioned, shouldSkip };
|
return { effectiveWasMentioned, shouldSkip };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -167,9 +167,9 @@ export async function preflightDiscordMessage(
|
|||||||
matchesMentionPatterns(baseText, mentionRegexes));
|
matchesMentionPatterns(baseText, mentionRegexes));
|
||||||
const implicitMention = Boolean(
|
const implicitMention = Boolean(
|
||||||
!isDirectMessage &&
|
!isDirectMessage &&
|
||||||
botId &&
|
botId &&
|
||||||
message.referencedMessage?.author?.id &&
|
message.referencedMessage?.author?.id &&
|
||||||
message.referencedMessage.author.id === botId,
|
message.referencedMessage.author.id === botId,
|
||||||
);
|
);
|
||||||
if (shouldLogVerbose()) {
|
if (shouldLogVerbose()) {
|
||||||
logVerbose(
|
logVerbose(
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
import { randomUUID } from "node:crypto";
|
import { randomUUID } from "node:crypto";
|
||||||
import fs from "node:fs";
|
import fs from "node:fs";
|
||||||
|
|
||||||
import {
|
import { abortEmbeddedPiRun, waitForEmbeddedPiRunEnd } from "../../agents/pi-embedded.js";
|
||||||
abortEmbeddedPiRun,
|
|
||||||
waitForEmbeddedPiRunEnd,
|
|
||||||
} from "../../agents/pi-embedded.js";
|
|
||||||
import { stopSubagentsForRequester } from "../../auto-reply/reply/abort.js";
|
import { stopSubagentsForRequester } from "../../auto-reply/reply/abort.js";
|
||||||
import { clearSessionQueues } from "../../auto-reply/reply/queue.js";
|
import { clearSessionQueues } from "../../auto-reply/reply/queue.js";
|
||||||
import { loadConfig } from "../../config/config.js";
|
import { loadConfig } from "../../config/config.js";
|
||||||
|
|||||||
@@ -175,9 +175,9 @@ export async function prepareSlackMessage(params: {
|
|||||||
matchesMentionPatterns(message.text ?? "", mentionRegexes)));
|
matchesMentionPatterns(message.text ?? "", mentionRegexes)));
|
||||||
const implicitMention = Boolean(
|
const implicitMention = Boolean(
|
||||||
!isDirectMessage &&
|
!isDirectMessage &&
|
||||||
ctx.botUserId &&
|
ctx.botUserId &&
|
||||||
message.thread_ts &&
|
message.thread_ts &&
|
||||||
message.parent_user_id === ctx.botUserId,
|
message.parent_user_id === ctx.botUserId,
|
||||||
);
|
);
|
||||||
|
|
||||||
const sender = message.user ? await ctx.resolveUserName(message.user) : null;
|
const sender = message.user ? await ctx.resolveUserName(message.user) : null;
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ describe("applyGroupGating", () => {
|
|||||||
it("treats reply-to-bot as implicit mention", () => {
|
it("treats reply-to-bot as implicit mention", () => {
|
||||||
const groupHistories = new Map();
|
const groupHistories = new Map();
|
||||||
const result = applyGroupGating({
|
const result = applyGroupGating({
|
||||||
cfg: baseConfig as unknown as ReturnType<typeof import("../../../config/config.js").loadConfig>,
|
cfg: baseConfig as unknown as ReturnType<
|
||||||
|
typeof import("../../../config/config.js").loadConfig
|
||||||
|
>,
|
||||||
msg: {
|
msg: {
|
||||||
id: "m1",
|
id: "m1",
|
||||||
from: "123@g.us",
|
from: "123@g.us",
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ export function applyGroupGating(params: {
|
|||||||
: null;
|
: null;
|
||||||
const implicitMention = Boolean(
|
const implicitMention = Boolean(
|
||||||
(selfJid && replySenderJid && selfJid === replySenderJid) ||
|
(selfJid && replySenderJid && selfJid === replySenderJid) ||
|
||||||
(selfE164 && replySenderE164 && selfE164 === replySenderE164),
|
(selfE164 && replySenderE164 && selfE164 === replySenderE164),
|
||||||
);
|
);
|
||||||
const mentionGate = resolveMentionGating({
|
const mentionGate = resolveMentionGating({
|
||||||
requireMention,
|
requireMention,
|
||||||
|
|||||||
Reference in New Issue
Block a user