openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
33 lines (32 loc) • 1.49 kB
JavaScript
import { o as getPluginRuntimeGatewayRequestScope } from "./gateway-request-scope-BvvDhs5D.mjs";
import { l as readChannelContextGatewayContextResolver } from "./admission-evidence-q4_t-NFq.mjs";
import { r as logVerbose } from "./globals-CgepmiqE.mjs";
import { n as commandReply } from "./command-gates-BZ-IYgiD.mjs";
//#region src/auto-reply/reply/commands-system-agent.ts
const handleSystemAgentCommand = async (e, t) => {
if (!t) return null;
const n = (readChannelContextGatewayContextResolver(e.rootCtx ?? e.ctx) ?? getPluginRuntimeGatewayRequestScope()?.resolveGatewayContext)?.()?.hostLifecycle;
const { extractSystemAgentRescueMessage: r, runSystemAgentRescueMessage: i } = await import("./system-agent/rescue-message.js");
if (r(e.command.commandBodyNormalized) === null) return null;
if (!e.command.isAuthorizedSender) {
logVerbose(`Ignoring /openclaw from unauthorized sender: ${e.command.senderId || "<unknown>"}`);
return { shouldContinue: false };
}
return commandReply(await i({
cfg: e.cfg,
command: e.command,
commandBody: e.command.commandBodyNormalized,
agentId: e.agentId,
isGroup: e.isGroup,
assertCurrent: () => e.commandInvocationSignal?.throwIfAborted(),
deps: {
setupSurface: "gateway",
gatewayHostLifecycle: n && { request: (t, r) => n.request(t, () => {
e.commandInvocationSignal?.throwIfAborted();
r();
}) }
}
}) ?? "OpenClaw did not find a rescue request.");
};
//#endregion
export { handleSystemAgentCommand as t };