UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

41 lines (40 loc) • 1.57 kB
import { Fn as object, Jn as string } from "./schemas-Cy6abvsu.mjs"; import { r as captureOpenClawStateWorkerContext } from "./openclaw-state-worker-context-DAKL_dnZ.mjs"; import { i as runOpenClawStateWorkerOperation } from "./openclaw-state-worker-store-2LoAv_8B.mjs"; import { t as ErrorCodes } from "./gateway-error-details-B69XiHdh.mjs"; import { p as errorShape } from "./error-codes-BzF7aRQ0.mjs"; import { r as debugProxyCliCommandSchema } from "./cli-contract-CBgrmW4R.mjs"; import { n as localStateOwnerChangedError, t as captureLocalStateMutationGuard } from "./local-state-owner-CnxUSfeW.mjs"; //#region 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))); } } }; //#endregion export { debugProxyHandlers };