Streaming lifecycle
Cancel, retry, edit, regenerate — AgentsKit owns semantics; Chat shells expose them.
Streaming lifecycle
AgentsKit owns the lifecycle. AgentsKit Chat renderers expose the same ChatReturn operations without reimplementing abort or stream reducers.
Operations
| Operation | AgentsKit method | Default shell |
|---|---|---|
| Cancel | stop() | Stop button · Escape in Ink |
| Retry | retry() | Retry · /retry in Ink |
| Edit | edit(messageId, content) | Edit last message · /edit … in Ink |
| Regenerate | regenerate(messageId?) | Regenerate · /regenerate in Ink |
Visual map
Loading diagram...
Cancellation aborts the upstream source. AgentsKit prevents late chunks from mutating canonical state after abort.
Lineage and reconnect
A v1 server.turn.snapshot may include lineage:
code
{
"lineage": {
"operation": "regenerate",
"parentTurnId": "turn-previous",
"sourceMessageId": "message-assistant"
}
}createSnapshotEvent(...)projects canonical messages + submit/retry/edit/regenerate lineage.createTurnSnapshotCursor(sessionId)applies snapshots from a transport.- First valid snapshot initializes reconnect; later snapshots need a greater sequence.
- Duplicate, stale, malformed, and foreign-session events are no-ops.
Snapshots are complete projections. The cursor chooses the current projection — it never merges messages or interprets adapter chunks.
In the docs assistant
The floating Ask the docs shell shows Retry / Regenerate / Edit after a completed turn — same operations as production shells.