AgentProjector
Defined in: react/src/agents.ts:188
Methods
Section titled “Methods”event()
Section titled “event()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
event |
AgentEvent |
meta? |
EventMeta |
Returns
Section titled “Returns”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
meta? |
Pick<ChatEnvelope, "seq" | "segment"> |
Returns
Section titled “Returns”inputs()
Section titled “inputs()”inputs(snapshot): readonly DisplayInput[];Defined in: react/src/agents.ts:214
Accepted/consumed receipts only. The host adds still-queued inbox entries to snapshots.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
snapshot |
TreeNode |
Returns
Section titled “Returns”readonly DisplayInput[]
run(snapshot): RunInfo;Defined in: react/src/agents.ts:212
The run as the saved run has it.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
snapshot |
TreeNode |
Returns
Section titled “Returns”snapshot()
Section titled “snapshot()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
snapshot |
TreeNode |