HepWriter class

Streams AgentEvents as HEP v1 JSONL frames — one emit per line.

AgentListener-shaped on purpose: agent.subscribe(hep.handleEvent) wires it directly. Owns stdout exclusively in events mode (see the host's CliIO decorator): every emit must land on its own line.

Constructors

HepWriter({required void emit(String line), required String fahVersion, HepToolArgs toolArgs = HepToolArgs.summary, RedactionPipeline? redactionPipeline})
Creates a writer emitting to emit (hosts pass a stdout line sink). redactionPipeline masks the stuck events' captured-output detail — HEP frames land in supervisor/CI logs, the same surface the session record's redaction targets (gh-1054 review round 2). Optional: without it details pass through (test hosts).

Properties

currentTurnId → int
The turn id frames currently belong to (the last allocated one when between turns) — the host uses it to correlate compaction brackets.
no setter
fahVersion → String
The fah version reported in the header frame.
final
hashCode → int
The hash code for this object.
no setterinherited
redactionPipeline → RedactionPipeline?
Masks secret-bearing event detail before it reaches the frames.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
toolArgs → HepToolArgs
Tool-argument verbosity for tool_start frames.
final

Methods

compactionEnd(int tokensFreed) → void
Emits compaction_end with the tokens freed. The turn stays open: its agent_start/terminal frames follow under the same id.
compactionStart() → void
Emits compaction_start, allocating the id of the turn the compaction precedes (the following agent_start reuses it).
handleEvent(AgentEvent event, CancelToken cancelToken) → Future<void>
Handles one agent event (AgentListener shape). The turn-lifecycle arms live here; the streaming arms (message/tool deltas) are split into _handleStreamEvent — one switch each keeps the CRAP gate.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited
writeHeader({required String sessionId}) → void
Emits the hep_header frame (once; further calls are no-ops).

Operators

operator ==(Object other) → bool
The equality operator.
inherited