UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

30 lines (29 loc) 1.23 kB
import { t as isCommandEnabled } from "./commands-registry-list-BO6EYEpy.js"; import { t as hasControlCommand } from "./command-detection-DoshyUmB.js"; import { n as shouldHandleTextCommands } from "./commands-text-routing-sBs1BOcS.js"; import { n as resolveCommandContextText } from "./context-text-D3m6Fy9M.js"; //#region src/auto-reply/reply/dispatch-acp-command-bypass.ts function isResetCommandCandidate(text) { return /^\/(?:new|reset)(?:\s|$)/i.test(text); } function isAcpCommandCandidate(text) { return /^\/acp(?:\s|$)/i.test(text); } function shouldBypassAcpDispatchForCommand(ctx, cfg) { const candidate = resolveCommandContextText(ctx); if (!candidate) return false; const allowTextCommands = shouldHandleTextCommands({ cfg, surface: ctx.Surface ?? ctx.Provider ?? "", commandSource: ctx.CommandSource }); if (isResetCommandCandidate(candidate)) return true; if (isAcpCommandCandidate(candidate)) return true; if (hasControlCommand(candidate, cfg)) return allowTextCommands; if (!candidate.startsWith("!")) return false; if (!ctx.CommandAuthorized) return false; if (!isCommandEnabled(cfg, "bash")) return false; return allowTextCommands; } //#endregion export { shouldBypassAcpDispatchForCommand };