openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
3 lines • 1.37 kB
JavaScript
import{Fn as object,Jn as string}from"./schemas-DuCQi-Qb.mjs";import{r as captureOpenClawStateWorkerContext}from"./openclaw-state-worker-context-Dx8YjqO2.mjs";import{i as runOpenClawStateWorkerOperation}from"./openclaw-state-worker-store-7se2aIrr.mjs";import{i as ErrorCodes}from"./missing-scope-error-CkgBgh6d.mjs";import{p as errorShape}from"./error-codes-CQNGhXT-.mjs";import{r as debugProxyCliCommandSchema}from"./cli-contract-Cbiv9yGW.mjs";import{n as localStateOwnerChangedError,t as captureLocalStateMutationGuard}from"./local-state-owner-DweIAMz2.mjs";
//!src/gateway/server-methods/debug-proxy.ts
const requestSchema=object({expectedOwnerId:string().min(1),command:debugProxyCliCommandSchema}).strict();const debugProxyHandlers={"debugProxy.capture":async e=>{const t=requestSchema.safeParse(e.params);if(!t.success){e.respond(false,void 0,errorShape(ErrorCodes.INVALID_REQUEST,t.error.message));return}let n;try{n=captureLocalStateMutationGuard(t.data.expectedOwnerId,e)}catch(t){e.respond(false,void 0,localStateOwnerChangedError(t));return}try{const r=await runOpenClawStateWorkerOperation(captureOpenClawStateWorkerContext(),e=>e.execute({type:t.data.command.type,input:t.data.command.input}),{assertCurrent:n,signal:e.signal});e.respond(true,r??null)}catch(t){e.respond(false,void 0,errorShape(ErrorCodes.UNAVAILABLE,String(t)))}}};export{debugProxyHandlers};