UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

37 lines (36 loc) • 1.48 kB
import { Wr as validateCommandsListParams } from "./src-BX8OAe1J.mjs"; import { t as ErrorCodes } from "./gateway-error-details-B69XiHdh.mjs"; import { p as errorShape } from "./error-codes-BzF7aRQ0.mjs"; import { r as defineValidatedGatewayMethod } from "./validation-DwNk6A-B.mjs"; import { t as resolveAgentIdOrRespondError } from "./agent-id-shared-YyMfd879.mjs"; import { t as buildCommandsListResult } from "./commands-list-result-CEFAciBb.mjs"; import { t as withSessionDiscoveryAccess } from "./session-discovery-access-Fc6mSyTK.mjs"; //#region src/gateway/server-methods/commands.ts const commandsHandlers = { "commands.list": defineValidatedGatewayMethod("commands.list", validateCommandsListParams, async ({ params: e, respond: t, context: n, client: r, signal: i, hasCurrentClientAuthority: a }) => { const o = resolveAgentIdOrRespondError({ rawAgentId: e.agentId, respond: t, cfg: n.getRuntimeConfig() }); if (!o) return; await withSessionDiscoveryAccess({ client: r, context: n, respond: t, signal: i, hasCurrentClientAuthority: a, sessionKey: e.sessionKey, agentId: o.agentId, changedError: errorShape(ErrorCodes.UNAVAILABLE, "Session changed while preparing its commands. Retry the request.") }, (t) => buildCommandsListResult({ cfg: o.cfg, agentId: o.agentId, provider: e.provider, scope: e.scope, includeArgs: e.includeArgs, sessionKey: e.sessionKey, sessionEntry: t })); }) }; //#endregion export { commandsHandlers };