Skip to main content
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; wires createEventHandler + createPatchQueue + processEvent to the live Gateway stream and the Zustand stores.
  • apps/web/src/stores/fleet.ts; imports the AgentStatusPatch type for its patchAgent action.
  • 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

Last modified on August 6, 2026