AgentTelemetry class final

The agent → sink adapter. Wire it through AgentCoreServices.telemetry — buildAgentStack attaches the listener and wraps the stream function so a host opts in with one constructor field. The event map mirrors the CLI's fa.log forensics line-for-line (issue #1322 AC: the same fidelity for an in-process host), extended with firstToken and the provider HTTP status.

Constructors

AgentTelemetry(AgentTelemetrySink sink)
Creates an adapter writing to sink.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sink → AgentTelemetrySink
The host's sink. A throwing record is swallowed (diagnostics never break the run — the CLI's own log writer has the same contract).
final

Methods

agentErrorMessage(AgentEndEvent event) → String?
The terminal PROVIDER error of a finished run, or null. Only a StopReason.error message counts: the abort terminal also carries an errorMessage (Operation aborted), and a user stop / watchdog fire is a phase outcome, not a failure — it must not produce a run error record (the CLI logs those runs as a plain run end).
attach(Agent agent) → void Function()
Subscribes to agent's lifecycle events. Returns the unsubscribe function (the same contract as Agent.subscribe).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited
wrapStreamFunction(StreamFunction inner) → StreamFunction
Wraps inner so the provider leg records requestStart (the exact moment a hung call starts), firstToken (the first provider event — the 512-s zero-byte hang from the issue is visible as requestStart with no firstToken and a growing age), and the structured HTTP status of a failed request on the follow-up error record.

Operators

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