Skip to main content
The client owns reconnection after a connection that opened then dropped (800 ms → 15 s backoff). It negotiates the OpenClaw connect protocol (minProtocol: 3, maxProtocol: 4) and signs the connect frame with Ed25519 device auth in the browser (via crypto.subtle), or through an injected signConnect hook for Node callers. The device-auth module is internal and not re-exported.

Public API

Classes

GatewayClient typed RPC namespaces (instance fields, not separate exports):

Functions

Types & interfaces

Errors

Constants

Exec approvals policy

The Gateway keeps each agent’s exec approval posture, and the standing grants under it, in a store of its own, which it exposes over the wire only through exec.approvals.get and exec.approvals.set. Three modules cover it: execApprovals.ts writes the posture, execAllowlist.ts reads what a stored row means, and execRevoke.ts removes grants. All three are on the barrel because the server and the browser SPA are separate build targets and both need them.
clawboo treats exec.approvals.get as a WRITE rather than a read. On clawboo’s reading of OpenClaw, that call re-serialises the document and saves it back, so issuing it against a stored document that cannot be parsed would replace every agent’s policy with a fail-closed default. Anything that only needs to READ the grants should read OpenClaw’s stored row directly instead; see Data and state.
The runtime constants above are the barrel’s only ones. The connect protocol range (minProtocol: 3, maxProtocol: 4), the retry constants, and the close codes stay private to client.ts / helpers.ts.

Used by

  • apps/web/src/stores/connection.ts, holds the live GatewayClient instance (ConnectionStatus superset adds an 'error' state).
  • apps/web/src/features/connection/{GatewayBootstrap,GatewayConnectScreen,useGatewayEvents}.tsx?, connect/reconnect lifecycle and event subscription; GatewayResponseError.code drives the NOT_PAIRED pairing branch.
  • apps/web/server/lib/agentSource/registry.ts, the server-side OpenClawAgentSource connection injects WebSocketLikeCtor + signConnect for Node device auth.
  • apps/web/server/lib/capabilitySource/openclaw.ts, uses encodeConfigPatchParams for the config.patch envelope.
  • apps/web/server/lib/agentSource/openclawExecAllowlistRead.ts, uses classifyExecAllowlistEntry + execAllowlistEntryKey to read a Boo’s standing grants out of OpenClaw’s own state database rather than through the Gateway.
  • apps/web/server/api/execAllowlist.ts and apps/web/server/lib/agentSource/execApprovalPolicy.ts, the routes behind the Permissions tab: revokeExecAllowlistEntries and upsertExecApprovalPolicy.
  • packages/events/src/{index,bridge,types}.ts, consumes the EventFrame / AgentStatus / ConnectionStatus types in the Bridge → Policy → Handler pipeline.
  • packages/adapters/openclaw/src/{adapter,mapFrame,types}.ts, maps EventFrame / AgentsListResult / SessionPatchResult into the normalized RuntimeEvent stream.

Source

Barrel: packages/gateway-client/src/index.ts. Modules: types.ts (frame + domain + connect types), errors.ts (GatewayResponseError), client.ts (the GatewayClient class), helpers.ts (frame/session/url/error/retry helpers, plus the two connect constants), execApprovals.ts (the Gateway-held exec policy, read-modify-write under compare-and-swap), execAllowlist.ts (what one stored grant means, plus the three pattern prefixes), execRevoke.ts (removing grants, and proving it). device-auth.ts is internal and not re-exported.

See also

Last modified on September 15, 2026