mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 11:31:26 +00:00
refactor(auto-reply): reuse exec directive clearer
This commit is contained in:
@@ -45,3 +45,23 @@ export function clearInlineDirectives(cleaned: string): InlineDirectives {
|
|||||||
hasQueueOptions: false,
|
hasQueueOptions: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function clearExecInlineDirectives(directives: InlineDirectives): InlineDirectives {
|
||||||
|
return {
|
||||||
|
...directives,
|
||||||
|
hasExecDirective: false,
|
||||||
|
execHost: undefined,
|
||||||
|
execSecurity: undefined,
|
||||||
|
execAsk: undefined,
|
||||||
|
execNode: undefined,
|
||||||
|
rawExecHost: undefined,
|
||||||
|
rawExecSecurity: undefined,
|
||||||
|
rawExecAsk: undefined,
|
||||||
|
rawExecNode: undefined,
|
||||||
|
hasExecOptions: false,
|
||||||
|
invalidExecHost: false,
|
||||||
|
invalidExecSecurity: false,
|
||||||
|
invalidExecAsk: false,
|
||||||
|
invalidExecNode: false,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import { resolveBlockStreamingChunking } from "./block-streaming.js";
|
|||||||
import { buildCommandContext } from "./commands.js";
|
import { buildCommandContext } from "./commands.js";
|
||||||
import { type InlineDirectives, parseInlineDirectives } from "./directive-handling.js";
|
import { type InlineDirectives, parseInlineDirectives } from "./directive-handling.js";
|
||||||
import { applyInlineDirectiveOverrides } from "./get-reply-directives-apply.js";
|
import { applyInlineDirectiveOverrides } from "./get-reply-directives-apply.js";
|
||||||
import { clearInlineDirectives } from "./get-reply-directives-utils.js";
|
import { clearExecInlineDirectives, clearInlineDirectives } from "./get-reply-directives-utils.js";
|
||||||
import { defaultGroupActivation, resolveGroupRequireMention } from "./groups.js";
|
import { defaultGroupActivation, resolveGroupRequireMention } from "./groups.js";
|
||||||
import { CURRENT_MESSAGE_MARKER, stripMentions, stripStructuralPrefixes } from "./mentions.js";
|
import { CURRENT_MESSAGE_MARKER, stripMentions, stripStructuralPrefixes } from "./mentions.js";
|
||||||
import { createModelSelectionState, resolveContextTokens } from "./model-selection.js";
|
import { createModelSelectionState, resolveContextTokens } from "./model-selection.js";
|
||||||
@@ -215,23 +215,7 @@ export async function resolveReplyDirectives(params: {
|
|||||||
}
|
}
|
||||||
if (isGroup && ctx.WasMentioned !== true && parsedDirectives.hasExecDirective) {
|
if (isGroup && ctx.WasMentioned !== true && parsedDirectives.hasExecDirective) {
|
||||||
if (parsedDirectives.execSecurity !== "deny") {
|
if (parsedDirectives.execSecurity !== "deny") {
|
||||||
parsedDirectives = {
|
parsedDirectives = clearExecInlineDirectives(parsedDirectives);
|
||||||
...parsedDirectives,
|
|
||||||
hasExecDirective: false,
|
|
||||||
execHost: undefined,
|
|
||||||
execSecurity: undefined,
|
|
||||||
execAsk: undefined,
|
|
||||||
execNode: undefined,
|
|
||||||
rawExecHost: undefined,
|
|
||||||
rawExecSecurity: undefined,
|
|
||||||
rawExecAsk: undefined,
|
|
||||||
rawExecNode: undefined,
|
|
||||||
hasExecOptions: false,
|
|
||||||
invalidExecHost: false,
|
|
||||||
invalidExecSecurity: false,
|
|
||||||
invalidExecAsk: false,
|
|
||||||
invalidExecNode: false,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const hasInlineDirective =
|
const hasInlineDirective =
|
||||||
|
|||||||
Reference in New Issue
Block a user