Current trunk branch
Dispose trunk only — consumer owns ctx and other resources
Prefill a tool result turn into trunk
JSON-stringified tool result
Tool call ID
Prefill a user turn into trunk
User message content
Optional tools JSON string
Promote a winner to trunk — retainOnly + reassign
Safe even if winner is the only branch (resets topology, no-op on KV).
Session - Trunk lifecycle + conversation delta helpers
Owns the current "trunk" branch and provides promote() to crown a winner, plus delta helpers that centralize the sep + formatChat + tokenize + prefill pattern for injecting new turns into an ongoing conversation.
Session does NOT own the SessionContext or BranchStore — the consumer creates those and passes them in. dispose() prunes trunk only.
Example