Add merge-back context handoff support

- Map fork and merge-back turns into stored handoffs and transfer resolutions
- Add shell snapshot projection support plus coverage tests
- Update replay fixtures and web contracts for the new turn flow
This commit is contained in:
Julius Marminge authored and maria-rcks committed 2026-08-03 11:44:57 -04:00
1 parent 74f73e39ea
commit 7cfdb4e79e
36 files changed
+2921 -301

No files matched your search

@@ -613,6 +613,12 @@ The frontend should not reconstruct display order by merging `messages`, `plans`
`turnItems` are projection records, not the canonical source of truth. The canonical graph remains normalized in runs, attempts, nodes, requests, messages, plans, and checkpoints. Provider-native item refs live directly on nodes and turn items where correlation is needed.
Forked threads also expose a derived `visibleTurnItems` projection. `turnItems` remains the canonical
items emitted on that app thread. `visibleTurnItems` is the user-visible ordered read model: it may
reference inherited source items through the fork source point, include synthetic lifecycle markers
such as "forked from conversation", and then continue with local target-thread items. This keeps
storage normalized while giving thread detail views and tests one backend-owned surface to assert.
Known common tools should have structured item variants so the frontend can render stable custom components without parsing provider text:
```ts