Skip to content

fix: replace deleted assistant/chunk with live agent/assistant-stream… - #557

Open
later0day wants to merge 5 commits into
omdsh-dev:mainfrom
later0day:main
Open

fix: replace deleted assistant/chunk with live agent/assistant-stream…#557
later0day wants to merge 5 commits into
omdsh-dev:mainfrom
later0day:main

Conversation

@later0day

Copy link
Copy Markdown

… mirror

The durable assistant/chunk event was deleted in DSH 0.1.3-alpha.1. Replacements:

  • durable: settled assistant/message and each assistant/attempt embed the step's timed stream (expandAssistantStream extracts first token time)
  • live: host event agent/assistant-stream with {agent, frame} payload

Changes:

  • New src/sidechat-live.ts: createAssistantStreamMirror() buffers one in-flight prefix per session from agent/assistant-stream frames. Guard: reject by attemptId mismatch or revision <= seen revision. revision is allocated PER FRAME by the host agent-loop, not per attempt — only attemptId carries identity.
  • sidechat-core.ts: buildOpenTurnSnapshot now reads settled assistant/message content blocks (text → text, reasoning → reasoning), skipping superseded assistant/attempt.
  • sidechat-transcript.ts: appendLiveRows() renders the live prefix as an unsettled tail row, dropped once the step's assistant/message is in the log.
  • SideChatView.tsx: ThreadCache carries live prefix; fetchThread computes liveChanged and bumps revision on change.
  • sidechat-routes.ts: sidechat.events reads live AFTER the log, so the settled step and its live prefix never appear together.
  • context-types.ts: typed on('agent/assistant-stream') overload + SidebarAssistantStreamFrame union.
  • Tests: 7 new unit tests for the mirror; existing tests updated.

Verified: RPC-level (live prefix grows monotonically and equals settled text prefix) and UI-level (DOM shows mid-stream half-sentence then settled full text).

… mirror

The durable assistant/chunk event was deleted in DSH 0.1.3-alpha.1.
Replacements:
- durable: settled assistant/message and each assistant/attempt embed the
  step's timed stream (expandAssistantStream extracts first token time)
- live: host event agent/assistant-stream with {agent, frame} payload

Changes:
- New src/sidechat-live.ts: createAssistantStreamMirror() buffers one
  in-flight prefix per session from agent/assistant-stream frames.
  Guard: reject by attemptId mismatch or revision <= seen revision.
  revision is allocated PER FRAME by the host agent-loop, not per
  attempt — only attemptId carries identity.
- sidechat-core.ts: buildOpenTurnSnapshot now reads settled
  assistant/message content blocks (text → text, reasoning → reasoning),
  skipping superseded assistant/attempt.
- sidechat-transcript.ts: appendLiveRows() renders the live prefix as
  an unsettled tail row, dropped once the step's assistant/message is
  in the log.
- SideChatView.tsx: ThreadCache carries live prefix; fetchThread computes
  liveChanged and bumps revision on change.
- sidechat-routes.ts: sidechat.events reads live AFTER the log, so the
  settled step and its live prefix never appear together.
- context-types.ts: typed on('agent/assistant-stream') overload +
  SidebarAssistantStreamFrame union.
- Tests: 7 new unit tests for the mirror; existing tests updated.

Verified: RPC-level (live prefix grows monotonically and equals settled
text prefix) and UI-level (DOM shows mid-stream half-sentence then
settled full text).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@later0day later0day closed this Sep 5, 2026
@later0day later0day reopened this Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant