UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

36 lines (35 loc) 1.56 kB
import { t as isCommandEnabled } from "./commands-registry-list-MVYs4B-p.js"; import { n as maybeResolveTextAlias } from "./commands-registry-normalize-BwQxckuw.js"; import { t as hasControlCommand } from "./command-detection-iKcBJ8it.js"; import { n as shouldHandleTextCommands } from "./commands-text-routing-B25gG5ny.js"; import { n as resolveCommandContextText } from "./context-text-BegMwqu-.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 isLocalCommandCandidate(text, cfg) { return hasControlCommand(text, cfg); } function shouldBypassAcpDispatchForCommand(ctx, cfg) { const candidate = resolveCommandContextText(ctx); if (!candidate) return false; const normalized = candidate.trim(); const allowTextCommands = shouldHandleTextCommands({ cfg, surface: ctx.Surface ?? ctx.Provider ?? "", commandSource: ctx.CommandSource }); if (!normalized.startsWith("/") && maybeResolveTextAlias(candidate, cfg) != null) return allowTextCommands; if (isResetCommandCandidate(normalized)) return true; if (isAcpCommandCandidate(normalized)) return true; if (isLocalCommandCandidate(normalized, cfg)) return allowTextCommands; if (!normalized.startsWith("!")) return false; if (!ctx.CommandAuthorized) return false; if (!isCommandEnabled(cfg, "bash")) return false; return allowTextCommands; } //#endregion export { shouldBypassAcpDispatchForCommand };