Skip to content

HookIngest

Defined in: src/hooks-ingest.ts:193

Bounded in-memory ring buffer + structured logging for ingested hook events. The single owner of the Phase-0 observable surface. record never throws — a malformed forward must never crash the request loop.

new HookIngest(onSignal?): HookIngest

Defined in: src/hooks-ingest.ts:206

(sessionId, ev) => void

HookIngest

allSubagentsSnapshot(): Record<string, SubagentEntry[]>

Defined in: src/hooks-ingest.ts:334

Every tracked session’s roster array, keyed by sessionId — for a global bootstrap. As with subagentSnapshot, the entry objects are internal references but JSON-safe since SubagentEntry fields are all primitives.

Record<string, SubagentEntry[]>


prune(activeIds): void

Defined in: src/hooks-ingest.ts:341

Drop ring-buffer + roster entries for sessions no longer active (called from the poller’s prune).

Set<string>

void


record(sessionId, ev): void

Defined in: src/hooks-ingest.ts:252

Push an event, log it, and (only on a matched session) forward to signals.

string

HookEvent

void


setSink(onSignal): void

Defined in: src/hooks-ingest.ts:217

Set (or clear) the Phase-1 signal sink AFTER construction. index.ts constructs the HookIngest before the poller (the poller’s prune callback needs it), then wires the sink once the poller exists — resolving the circular construction order without a forward-declared let. The ctor onSignal arg still works (Task 2 tests use it); this just lets the wiring happen post-construction when config.hooksSignals is on.

(sessionId, ev) => void

void


setSubagentSink(cb): void

Defined in: src/hooks-ingest.ts:226

Set (or clear) the Phase-3 sub-agent roster sink AFTER construction — mirror of setSink. A later task wires this so a roster change pushes the updated array (e.g. to the UI). Left unwired here ⇒ the roster is tracked but not pushed.

(sessionId, roster) => void

void


snapshot(sessionId): HookEvent[]

Defined in: src/hooks-ingest.ts:313

A copy of the session’s ring buffer (or []), safe to hand to a JSON response.

string

HookEvent[]


subagentSnapshot(sessionId): SubagentEntry[]

Defined in: src/hooks-ingest.ts:324

The session’s sub-agent roster as an array (insertion order; [] if none). The array is fresh, but the entries are the internal SubagentEntry references; safe to hand to a JSON response because every field is a primitive (no nested objects to alias), mirroring snapshot().

string

SubagentEntry[]