[Feature] Publish replayable Harness thinking events in Durable Sessions
Harness already emits thinking block start, delta, and end events. Applications consuming a Durable Session need to display the same thinking text during a turn and retrieve missed events after a disconnect.
Publish these presentation events to the committed Session event stream by default. Allow applications to disable publication with withThinkingEvents(false). Keep history() as the aggregated chat message view.
Acceptance criterion: while the model is still generating, subscribe to a Session, receive a thinking delta, and look it up through session.events(...). The query should return exactly one matching event with the same eventId, sequence, and payload, including the messageId and blockId. This lets clients deduplicate subscription and query results by eventId.
The acceptance case is useful because it checks persistence while generation is still running, not just final output. I traced the current adapter at aa394d2ee: BackendThreadJournal collects durable events for commitNative(...) and publishes live-only presentation events afterward; AgentScopeMessageEvents already tracks message/attempt/revision identity. I would keep thinking events on that existing commit path, with the subscriber receiving the committed event identity rather than a separately generated live copy.
Two boundaries seem worth adding to the acceptance test:
- Pause the model after a thinking delta, read it through
session.events(...)before allowing model completion, then reconnect from its cursor. Assert the same eventId/sequence/payload and one persisted event, including messageId/blockId. A live callback followed by a later end-of-turn write would not satisfy that case. - Cover a worker failure/recovery and a provider retry after partial output. Rebuilding the adapter should not append the already-committed prefix again; a new attempt/revision should remain distinguishable from replay of the same attempt. Block IDs alone may be reused by another model call, so message/attempt identity needs to remain part of the mapping.
For withThinkingEvents(false), could the contract explicitly say it disables publication to both the subscription and the queryable presentation stream, while history() remains the aggregated chat view? That is separate from any native capture needed for execution recovery. I would test that no empty start/end events leak when disabled, and that ordinary text/tool events are unchanged.
If you are taking the implementation, I can help with a separate acceptance-test slice once the event shape and option ownership are settled. I have not run a prototype or started a competing implementation.