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 throughexec.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.
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 liveGatewayClientinstance (ConnectionStatussuperset adds an'error'state).apps/web/src/features/connection/{GatewayBootstrap,GatewayConnectScreen,useGatewayEvents}.tsx?, connect/reconnect lifecycle and event subscription;GatewayResponseError.codedrives theNOT_PAIREDpairing branch.apps/web/server/lib/agentSource/registry.ts, the server-sideOpenClawAgentSourceconnection injectsWebSocketLikeCtor+signConnectfor Node device auth.apps/web/server/lib/capabilitySource/openclaw.ts, usesencodeConfigPatchParamsfor theconfig.patchenvelope.apps/web/server/lib/agentSource/openclawExecAllowlistRead.ts, usesclassifyExecAllowlistEntry+execAllowlistEntryKeyto read a Boo’s standing grants out of OpenClaw’s own state database rather than through the Gateway.apps/web/server/api/execAllowlist.tsandapps/web/server/lib/agentSource/execApprovalPolicy.ts, the routes behind the Permissions tab:revokeExecAllowlistEntriesandupsertExecApprovalPolicy.packages/events/src/{index,bridge,types}.ts, consumes theEventFrame/AgentStatus/ConnectionStatustypes in the Bridge → Policy → Handler pipeline.packages/adapters/openclaw/src/{adapter,mapFrame,types}.ts, mapsEventFrame/AgentsListResult/SessionPatchResultinto the normalizedRuntimeEventstream.
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
- Gateway & events pipeline, how frames flow Bridge → Policy → Handler.
- @clawboo/events, the consumer that turns
EventFrames into store mutations. - @clawboo/adapter-openclaw, the RuntimeAdapter wrapping this client.
- @clawboo/gateway-proxy, the same-origin WS proxy + the
signConnectParamsserver wires tosignConnect. - OpenClaw runtime, device pairing and channels.