import type { ModelCatalogEntry } from "../../agents/model-catalog.types.js"; import type { CliDeps } from "../../cli/deps.types.js"; import type { HealthSummary } from "../../commands/health.types.js"; import type { OpenClawConfig } from "../../config/types.openclaw.js"; import type { CronServiceContract } from "../../cron/service-contract.js"; import type { PluginApprovalRequestPayload } from "../../infra/plugin-approvals.js"; import type { createSubsystemLogger } from "../../logging/subsystem.js"; import type { WizardSession } from "../../wizard/session.js"; import type { ChatAbortControllerEntry } from "../chat-abort.js"; import type { ExecApprovalManager } from "../exec-approval-manager.js"; import type { NodeRegistry } from "../node-registry.js"; import type { ConnectParams, ErrorShape, RequestFrame } from "../protocol/index.js"; import type { GatewayBroadcastFn, GatewayBroadcastToConnIdsFn } from "../server-broadcast-types.js"; import type { ChannelRuntimeSnapshot } from "../server-channel-runtime.types.js"; import type { DedupeEntry } from "../server-shared.js"; import type { GatewayEventLoopHealth } from "../server/event-loop-health.js"; type SubsystemLogger = ReturnType; export type GatewayClient = { connect: ConnectParams; connId?: string; clientIp?: string; canvasHostUrl?: string; canvasCapability?: string; canvasCapabilityExpiresAtMs?: number; isDeviceTokenAuth?: boolean; internal?: { allowModelOverride?: boolean; pluginRuntimeOwnerId?: string; }; }; export type RespondFn = (ok: boolean, payload?: unknown, error?: ErrorShape, meta?: Record) => void; export type GatewayRequestContext = { deps: CliDeps; cron: CronServiceContract; cronStorePath: string; getRuntimeConfig: () => OpenClawConfig; execApprovalManager?: ExecApprovalManager; pluginApprovalManager?: ExecApprovalManager; loadGatewayModelCatalog: (params?: { readOnly?: boolean; }) => Promise; getHealthCache: () => HealthSummary | null; refreshHealthSnapshot: (opts?: { probe?: boolean; includeSensitive?: boolean; }) => Promise; logHealth: { error: (message: string) => void; }; logGateway: SubsystemLogger; incrementPresenceVersion: () => number; getHealthVersion: () => number; broadcast: GatewayBroadcastFn; broadcastToConnIds: GatewayBroadcastToConnIdsFn; nodeSendToSession: (sessionKey: string, event: string, payload: unknown) => void; nodeSendToAllSubscribed: (event: string, payload: unknown) => void; nodeSubscribe: (nodeId: string, sessionKey: string) => void; nodeUnsubscribe: (nodeId: string, sessionKey: string) => void; nodeUnsubscribeAll: (nodeId: string) => void; hasConnectedMobileNode: () => boolean; hasExecApprovalClients?: (excludeConnId?: string) => boolean; disconnectClientsForDevice?: (deviceId: string, opts?: { role?: string; }) => void; disconnectClientsUsingSharedGatewayAuth?: () => void; enforceSharedGatewayAuthGenerationForConfigWrite?: (nextConfig: OpenClawConfig) => void; nodeRegistry: NodeRegistry; agentRunSeq: Map; chatAbortControllers: Map; chatAbortedRuns: Map; chatRunBuffers: Map; chatDeltaSentAt: Map; chatDeltaLastBroadcastLen: Map; addChatRun: (sessionId: string, entry: { sessionKey: string; clientRunId: string; }) => void; removeChatRun: (sessionId: string, clientRunId: string, sessionKey?: string) => { sessionKey: string; clientRunId: string; } | undefined; subscribeSessionEvents: (connId: string) => void; unsubscribeSessionEvents: (connId: string) => void; subscribeSessionMessageEvents: (connId: string, sessionKey: string) => void; unsubscribeSessionMessageEvents: (connId: string, sessionKey: string) => void; unsubscribeAllSessionEvents: (connId: string) => void; getSessionEventSubscriberConnIds: () => ReadonlySet; registerToolEventRecipient: (runId: string, connId: string) => void; dedupe: Map; wizardSessions: Map; findRunningWizard: () => string | null; purgeWizardSession: (id: string) => void; getRuntimeSnapshot: () => ChannelRuntimeSnapshot; getEventLoopHealth?: () => GatewayEventLoopHealth | undefined; startChannel: (channel: import("../../channels/plugins/types.public.js").ChannelId, accountId?: string) => Promise; stopChannel: (channel: import("../../channels/plugins/types.public.js").ChannelId, accountId?: string) => Promise; markChannelLoggedOut: (channelId: import("../../channels/plugins/types.public.js").ChannelId, cleared: boolean, accountId?: string) => void; wizardRunner: (opts: import("../../commands/onboard-types.js").OnboardOptions, runtime: import("../../runtime.js").RuntimeEnv, prompter: import("../../wizard/prompts.js").WizardPrompter) => Promise; broadcastVoiceWakeChanged: (triggers: string[]) => void; broadcastVoiceWakeRoutingChanged: (config: import("../../infra/voicewake-routing.js").VoiceWakeRoutingConfig) => void; unavailableGatewayMethods?: ReadonlySet; }; export type GatewayRequestOptions = { req: RequestFrame; client: GatewayClient | null; isWebchatConnect: (params: ConnectParams | null | undefined) => boolean; respond: RespondFn; context: GatewayRequestContext; }; export type GatewayRequestHandlerOptions = { req: RequestFrame; params: Record; client: GatewayClient | null; isWebchatConnect: (params: ConnectParams | null | undefined) => boolean; respond: RespondFn; context: GatewayRequestContext; }; export type GatewayRequestHandler = (opts: GatewayRequestHandlerOptions) => Promise | void; export type GatewayRequestHandlers = Record; export {};