The pipeline is the architectural invariant “all Gateway events go Bridge → Policy → Handler.” Bridge parsers and Policy deciders are pure and unit-testable; only the Handler holds state (a debounced summary-refresh timer + a closed-runs TTL guard) and reaches out to injected dispatchers.
Public API
Functions
Types & interfaces
The package exposes no classes or runtime constants from its barrel; the Bridge and Policy layers are plain functions, and the Handler / patch-queue are factory functions returning closures.
Used by
apps/web/src/features/connection/useGatewayEvents.ts; wirescreateEventHandler+createPatchQueue+processEventto the live Gateway stream and the Zustand stores.apps/web/src/stores/fleet.ts; imports theAgentStatusPatchtype for itspatchAgentaction.packages/adapters/openclaw/src/mapFrame.ts; reuses the pure Bridge parsers (isReasoningStream,parseAgentPayload,parseChatPayload) to map Gateway frames into the runtime-event stream.
Source
Barrel:packages/events/src/index.ts. Layers: bridge.ts (parsers), policy/{index,work,agent,trust}.ts (deciders), handler.ts (dispatch), patch-queue.ts (RAF batching), types.ts (the shared union types).
See also
- Gateway & events pipeline, the conceptual model.
- Event pipeline internals, Bridge → Policy → Handler in depth.
- @clawboo/gateway-client, source of the
EventFrametype this package consumes. - @clawboo/protocol, the message parsers re-exported here.