mirror of
https://github.com/openclaw/openclaw.git
synced 2026-02-19 18:39:20 -05: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,
|
||||
};
|
||||
}
|
||||
|
||||
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 { type InlineDirectives, parseInlineDirectives } from "./directive-handling.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 { CURRENT_MESSAGE_MARKER, stripMentions, stripStructuralPrefixes } from "./mentions.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 (parsedDirectives.execSecurity !== "deny") {
|
||||
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,
|
||||
};
|
||||
parsedDirectives = clearExecInlineDirectives(parsedDirectives);
|
||||
}
|
||||
}
|
||||
const hasInlineDirective =
|
||||
|
||||
Reference in New Issue
Block a user