session: the request header becomes logged state — request/header events + fold/diff/apply
Every conversation request's non-content half (system prompt, tool schemas, call config — the EpochHeader) is now recorded in the session log: a 'request/header' full snapshot (reason 'initial' | 'resume' | 'fallback') anchors the fold at conversation birth and process boundaries, and 'request/header-delta' events (system line-trim, name-keyed tools delta, whole config) encode mid-run changes. The pure trio — foldRequestHeader / diffHeader / applyHeaderDelta — reconstructs the header any request was built under from the log alone; the writer contract round-trip-verifies every delta with a 'fallback' snapshot when the encoding cannot express a change (pure tool reordering), so a well-formed log always folds cleanly. Canonical absence: empty system and empty tools normalize to absent fields, matching request builds. Persistence and cordis catalogs regenerated; SessionEventMap paste and EpochHeader added to the core-data-structures session page.
This commit is contained in:
@@ -211,7 +211,7 @@ type SessionEvent<T extends SessionEventType = SessionEventType> = {
|
||||
}[T]
|
||||
```
|
||||
|
||||
The thirteen event variants (`turn/start`, `turn/end`, `step/start`, `step/end`, `user/message`, `prompt/blocked`, `context/message`, `assistant/chunk`, `assistant/message`, `tool/call`, `tool/result`, `steering/message`, `todo/write`), the `deriveMessages()` projection rules, the `TurnTrigger`/`TurnEndReason` reasons, and the turn-enclosure invariant are on **[session.md](session.md)**. How the log is made durable — the `SessionPersistence` seam, JSONL/SQLite backends, the `session/flush` checkpoint, crash recovery, and `SessionHeader` — is on **[persistence.md](persistence.md)**.
|
||||
The fifteen event variants (`turn/start`, `turn/end`, `step/start`, `step/end`, `user/message`, `prompt/blocked`, `context/message`, `assistant/chunk`, `assistant/message`, `tool/call`, `tool/result`, `steering/message`, `todo/write`, `request/header`, `request/header-delta`), the `deriveMessages()` projection rules, the `TurnTrigger`/`TurnEndReason` reasons, and the turn-enclosure invariant are on **[session.md](session.md)**. How the log is made durable — the `SessionPersistence` seam, JSONL/SQLite backends, the `session/flush` checkpoint, crash recovery, and `SessionHeader` — is on **[persistence.md](persistence.md)**.
|
||||
|
||||
## The agent handle
|
||||
|
||||
|
||||
Reference in New Issue
Block a user