Skip to content
providerkit
GitHub

AgentProjector

Defined in: react/src/agents.ts:188

event(event, meta?): ChatEvent[];

Defined in: react/src/agents.ts:205

The display events for one agent event, in order. meta is where the event sits in the host’s log; only the last event gets the number, and the ones before it are safe to apply twice.

What it sends depends on what came before: a text row is created by its first chunk and closed with all of its text, and a request or a specialist that the run leaves behind is closed only by the projector that drew it. So feed one projector every event of the run in order, from the first event of its first segment through each approval segment after it.

To resume a client after its cursor, run a fresh projector over the whole log and send only what an entry above the cursor returned. A client with no cursor gets the log from the start up to its last entry, then a snapshot read after that, then whatever the log adds. Sent first, the snapshot would be followed by older events, and a run waiting for a decision would look like it was running again.

Parameter Type
event AgentEvent
meta? EventMeta

ChatEvent[]


gap(meta?): ChatEvent[];

Defined in: react/src/agents.ts:208

Call for host RunEvent records agent.gap or agent.resync, then read the journal. Text remains checkpoint-only for this projector after a gap. Never invent an attempt.

Parameter Type
meta? Pick<ChatEnvelope, "seq" | "segment">

ChatEvent[]


inputs(snapshot): readonly DisplayInput[];

Defined in: react/src/agents.ts:214

Accepted/consumed receipts only. The host adds still-queued inbox entries to snapshots.

Parameter Type
snapshot TreeNode

readonly DisplayInput[]


run(snapshot): RunInfo;

Defined in: react/src/agents.ts:212

The run as the saved run has it.

Parameter Type
snapshot TreeNode

RunInfo


snapshot(snapshot): DisplayMessage;

Defined in: react/src/agents.ts:210

The message as the saved run has it, with the same row ids the live events use.

Parameter Type
snapshot TreeNode

DisplayMessage