openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
3 lines • 1.31 kB
JavaScript
import{o as getPluginRuntimeGatewayRequestScope}from"./gateway-request-scope-7deHmsb_.mjs";import{r as logVerbose}from"./globals-l9I53ZKA.mjs";import{l as readChannelContextGatewayContextResolver}from"./admission-evidence-DZ21Kx6F.mjs";import{n as commandReply}from"./command-gates-BMLoLImo.mjs";
//!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.`)};export{handleSystemAgentCommand as t};