onEvents(Subscribe to the agent’s event stream (attach mode withlistener,opts?): () =>void
"events"
subscribed). Events arrive in seq order; pass { from } to receive only
events with seq >= from. Returns an unsubscribe function.
Parameters
Returns
() =>
void
The Event Stream
Eachthis.events.emit on the agent arrives as one AgentEvent. The first connection replays the events the agent retains. Without resume, every reconnect replays them again. A listener then receives earlier events more than once.
A listener receives only the events that arrive after it is added. The client keeps no copy of past events.
AgentEvent
One item of the agent’s event stream, as delivered toonEvents listeners.
Properties
at
Wall-clock stamp at emit time; informational (ordering is byreadonlyat:Date
seq).
payload
The event’s payload, exactly as the agent emitted it.readonlypayload:unknown
seq
Monotonic position in the event stream; also the resume cursor.readonlyseq:number
type
The event kind the agent chose when emitting (e.g.readonlytype:string
"progress").