diff --git a/src/gateway/server-methods/channels.ts b/src/gateway/server-methods/channels.ts index 66cfae7fc511..b5dc61cc6fce 100644 --- a/src/gateway/server-methods/channels.ts +++ b/src/gateway/server-methods/channels.ts @@ -1,3 +1,4 @@ +// Gateway RPC handlers for channel lifecycle, status, and account operations. import { normalizeOptionalString } from "@openclaw/normalization-core/string-coerce"; import { ErrorCodes, @@ -245,6 +246,7 @@ function resolveChannelGatewayAccountId(params: { ); } +/** Log out one channel account through its owning channel plugin. */ export async function logoutChannelAccount(params: { channelId: ChannelId; accountId?: string | null; @@ -279,6 +281,7 @@ export async function logoutChannelAccount(params: { }; } +/** Start one channel account through its owning channel plugin. */ export async function startChannelAccount(params: { channelId: ChannelId; accountId?: string | null; @@ -305,6 +308,7 @@ export async function startChannelAccount(params: { }; } +/** Stop one channel account through its owning channel plugin. */ export async function stopChannelAccount(params: { channelId: ChannelId; accountId?: string | null; @@ -328,6 +332,7 @@ export async function stopChannelAccount(params: { }; } +/** Gateway request handlers for channel list, status, start, stop, and logout. */ export const channelsHandlers: GatewayRequestHandlers = { "channels.status": async ({ params, respond, context }) => { if (!validateChannelsStatusParams(params)) { diff --git a/src/gateway/server-methods/chat-reply-media.ts b/src/gateway/server-methods/chat-reply-media.ts index 60189c0caf17..f1e17248c713 100644 --- a/src/gateway/server-methods/chat-reply-media.ts +++ b/src/gateway/server-methods/chat-reply-media.ts @@ -1,3 +1,4 @@ +// Webchat reply media path normalizer for display-safe outbound payloads. import { isPassThroughRemoteMediaSource } from "@openclaw/media-core/media-source-url"; import { isAudioFileName } from "@openclaw/media-core/mime"; import { resolveAgentWorkspaceDir } from "../../agents/agent-scope.js"; @@ -24,6 +25,7 @@ function shouldPreserveDisplayMediaUrl(payload: ReplyPayload, mediaUrl: string): return payload.trustedLocalMedia === true; } +/** Normalize reply media paths for webchat display without leaking sensitive media. */ export async function normalizeWebchatReplyMediaPathsForDisplay(params: { cfg: OpenClawConfig; sessionKey: string; diff --git a/src/gateway/server-methods/cron.ts b/src/gateway/server-methods/cron.ts index efe0a05cd917..dad8b6833002 100644 --- a/src/gateway/server-methods/cron.ts +++ b/src/gateway/server-methods/cron.ts @@ -1,3 +1,4 @@ +// Gateway RPC handlers for cron job CRUD, run logs, wake, and delivery previews. import { ErrorCodes, errorShape, @@ -239,6 +240,7 @@ function isCronInvalidRequestError(err: unknown): boolean { ); } +/** Gateway request handlers for cron jobs and cron run-log access. */ export const cronHandlers: GatewayRequestHandlers = { wake: ({ params, respond, context }) => { if (!validateWakeParams(params)) { diff --git a/src/gateway/server-methods/devices.ts b/src/gateway/server-methods/devices.ts index 383129b84115..174b3ddf7d91 100644 --- a/src/gateway/server-methods/devices.ts +++ b/src/gateway/server-methods/devices.ts @@ -1,3 +1,4 @@ +// Gateway RPC handlers for device pairing and device-token lifecycle operations. import { ErrorCodes, errorShape, @@ -177,6 +178,7 @@ function pairedDeviceHasNonOperatorRole(device: { return hasNonOperatorDeviceRole(device) || hasNonOperatorDeviceTokenRole(device.tokens); } +/** Gateway request handlers for device pair approval, removal, token rotation, and revocation. */ export const deviceHandlers: GatewayRequestHandlers = { "device.pair.list": async ({ params, respond, client }) => { if (!validateDevicePairListParams(params)) { diff --git a/src/gateway/server-methods/native-hook-relay.ts b/src/gateway/server-methods/native-hook-relay.ts index 2abbf6a048f1..bad8705db7a9 100644 --- a/src/gateway/server-methods/native-hook-relay.ts +++ b/src/gateway/server-methods/native-hook-relay.ts @@ -1,3 +1,4 @@ +// Gateway RPC handler for native hook relay invocation. import { ErrorCodes, errorShape } from "../../../packages/gateway-protocol/src/index.js"; import { invokeNativeHookRelay, @@ -5,6 +6,7 @@ import { } from "../../agents/harness/native-hook-relay.js"; import type { GatewayRequestHandlers } from "./types.js"; +/** Gateway request handlers for invoking registered native hook relays. */ export const nativeHookRelayHandlers: GatewayRequestHandlers = { "nativeHook.invoke": async ({ params, respond }) => { try { diff --git a/src/gateway/server-methods/nodes.handlers.invoke-result.ts b/src/gateway/server-methods/nodes.handlers.invoke-result.ts index f92553502b52..146a57f98358 100644 --- a/src/gateway/server-methods/nodes.handlers.invoke-result.ts +++ b/src/gateway/server-methods/nodes.handlers.invoke-result.ts @@ -1,3 +1,4 @@ +// Gateway RPC handler for asynchronous node invocation results. import { ErrorCodes, errorShape, @@ -26,6 +27,7 @@ function normalizeNodeInvokeResultParams(params: unknown): unknown { return normalized; } +/** Handle a node's response to an earlier gateway `node.invoke` request. */ export const handleNodeInvokeResult: GatewayRequestHandler = async ({ params, respond, diff --git a/src/gateway/server-methods/plugin-approval.ts b/src/gateway/server-methods/plugin-approval.ts index 0a9fd8743959..929dfae5b647 100644 --- a/src/gateway/server-methods/plugin-approval.ts +++ b/src/gateway/server-methods/plugin-approval.ts @@ -1,3 +1,4 @@ +// Gateway RPC handlers for plugin approval requests and decisions. import { randomUUID } from "node:crypto"; import { normalizeOptionalString } from "@openclaw/normalization-core/string-coerce"; import { @@ -26,6 +27,7 @@ import { } from "./approval-shared.js"; import type { GatewayRequestHandlers } from "./types.js"; +/** Create plugin approval handlers backed by the shared approval manager. */ export function createPluginApprovalHandlers( manager: ExecApprovalManager, opts?: { forwarder?: ExecApprovalForwarder }, diff --git a/src/gateway/server-methods/restart.ts b/src/gateway/server-methods/restart.ts index 5e13bbb1ee44..07fb09a67e25 100644 --- a/src/gateway/server-methods/restart.ts +++ b/src/gateway/server-methods/restart.ts @@ -1,3 +1,4 @@ +// Gateway RPC handlers for safe gateway restart requests and preflight state. import { createSafeGatewayRestartPreflight, requestSafeGatewayRestart, @@ -16,6 +17,7 @@ function normalizeSkipDeferral(value: unknown): boolean { return value === true; } +/** Gateway request handlers for safe restart coordination. */ export const restartHandlers: GatewayRequestHandlers = { "gateway.restart.request": async ({ respond, params }) => { const result = requestSafeGatewayRestart({ diff --git a/src/gateway/server-methods/skills.ts b/src/gateway/server-methods/skills.ts index 1868d561c4cb..058cb99ad4ed 100644 --- a/src/gateway/server-methods/skills.ts +++ b/src/gateway/server-methods/skills.ts @@ -1,3 +1,4 @@ +// Gateway RPC handlers for skill discovery, install/update, and proposal workflows. import { normalizeOptionalString } from "@openclaw/normalization-core/string-coerce"; import { ErrorCodes, @@ -141,6 +142,7 @@ async function runSkillsProposalWorkspaceHandler(params: { } } +/** Gateway request handlers for skill status, catalogs, installs, updates, and workshop proposals. */ export const skillsHandlers: GatewayRequestHandlers = { ...skillsUploadHandlers, "skills.status": ({ params, respond, context }) => { diff --git a/src/gateway/server-methods/talk.ts b/src/gateway/server-methods/talk.ts index 6b5eabbe8a7f..f5cd0ba339ff 100644 --- a/src/gateway/server-methods/talk.ts +++ b/src/gateway/server-methods/talk.ts @@ -1,3 +1,4 @@ +// Gateway RPC handlers for Talk voice, transcription, and speech synthesis surfaces. import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, @@ -512,6 +513,7 @@ function stripUnresolvedSecretApiKeyFromRecord( return rest; } +/** Gateway request handlers for Talk config, catalog, mode, sessions, and speech. */ export const talkHandlers: GatewayRequestHandlers = { ...talkSessionHandlers, ...talkClientHandlers, diff --git a/src/gateway/server-methods/tools-catalog.ts b/src/gateway/server-methods/tools-catalog.ts index 2462ea39697a..5e9c82c0e57f 100644 --- a/src/gateway/server-methods/tools-catalog.ts +++ b/src/gateway/server-methods/tools-catalog.ts @@ -1,3 +1,4 @@ +// Gateway RPC handler for the tool catalog shown by clients and Control UI. import { normalizeOptionalString } from "@openclaw/normalization-core/string-coerce"; import { ErrorCodes, @@ -189,6 +190,7 @@ function buildPluginGroups(params: { .toSorted((a, b) => a.label.localeCompare(b.label)); } +/** Build the merged core/plugin tool catalog for one agent. */ export function buildToolsCatalogResult(params: { cfg: OpenClawConfig; agentId?: string; @@ -216,6 +218,7 @@ export function buildToolsCatalogResult(params: { }; } +/** Gateway request handlers for tool catalog queries. */ export const toolsCatalogHandlers: GatewayRequestHandlers = { "tools.catalog": ({ params, respond, context }) => { if (!validateToolsCatalogParams(params)) { diff --git a/src/gateway/server-methods/tts.ts b/src/gateway/server-methods/tts.ts index c52ee2bec7ab..7a0f601e99ce 100644 --- a/src/gateway/server-methods/tts.ts +++ b/src/gateway/server-methods/tts.ts @@ -1,3 +1,4 @@ +// Gateway RPC handlers for text-to-speech status, preferences, and conversion. import { normalizeOptionalString } from "@openclaw/normalization-core/string-coerce"; import { ErrorCodes, errorShape } from "../../../packages/gateway-protocol/src/index.js"; import { @@ -25,6 +26,7 @@ import { import { formatForLog } from "../ws-log.js"; import type { GatewayRequestHandlers } from "./types.js"; +/** Gateway request handlers for TTS status, preference mutation, and synthesis. */ export const ttsHandlers: GatewayRequestHandlers = { "tts.status": async ({ respond, context }) => { try { diff --git a/src/gateway/server-methods/voicewake-routing.ts b/src/gateway/server-methods/voicewake-routing.ts index e7f8eef9a027..41338c7cb7a5 100644 --- a/src/gateway/server-methods/voicewake-routing.ts +++ b/src/gateway/server-methods/voicewake-routing.ts @@ -1,3 +1,4 @@ +// Gateway RPC handlers for voice wake routing configuration. import { ErrorCodes, errorShape } from "../../../packages/gateway-protocol/src/index.js"; import { loadVoiceWakeRoutingConfig, @@ -7,6 +8,7 @@ import { } from "../../infra/voicewake-routing.js"; import type { GatewayRequestHandlers } from "./types.js"; +/** Gateway request handlers for reading and updating voice wake routing. */ export const voicewakeRoutingHandlers: GatewayRequestHandlers = { "voicewake.routing.get": async ({ respond }) => { try { diff --git a/src/gateway/server-methods/voicewake.ts b/src/gateway/server-methods/voicewake.ts index 13f45fb2b731..1dd4bb0265ab 100644 --- a/src/gateway/server-methods/voicewake.ts +++ b/src/gateway/server-methods/voicewake.ts @@ -1,9 +1,11 @@ +// Gateway RPC handlers for voice wake phrase configuration. import { ErrorCodes, errorShape } from "../../../packages/gateway-protocol/src/index.js"; import { loadVoiceWakeConfig, setVoiceWakeTriggers } from "../../infra/voicewake.js"; import { normalizeVoiceWakeTriggers } from "../server-utils.js"; import { formatForLog } from "../ws-log.js"; import type { GatewayRequestHandlers } from "./types.js"; +/** Gateway request handlers for reading and updating voice wake triggers. */ export const voicewakeHandlers: GatewayRequestHandlers = { "voicewake.get": async ({ respond }) => { try {