Skip to content

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

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

later0day wants to merge 8 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
later0day and others added 7 commits September 7, 2026 03:19
… shell-not-found banner, WS close reason UTF-8 truncation)
conversation.chat.turnTail moved from chain-kind (select/priority
takeover) to list-kind (id/order, unconditional mount), and
ui-deliverables' own entry no longer renders a produced-files row at
all — so the old takeover framing throws "requires options.id" and no
longer needs same-id shadowing. Register under a distinct id instead;
move the render-or-not decision (suspended, editor tab disabled, no
match) into the component itself.
Reconciles fork/main's private assistant/chunk mirror fix (86b8d73,
sidechat-live.ts / SidechatLiveStep / createAssistantStreamMirror,
revision-allocated-per-frame) with local main's newer, self-documented
fix for the same DSH 0.1.5 change (ba01147, assistant-live.ts /
AssistantLiveChunk keyed by attemptId + dense per-attempt index).
Local main's design wins throughout: it postdates and explicitly
corrects the per-frame-revision identity bug fork's draft still has.

Also drops fork's stale remote.session.openWorkspacePath interception
(intentionally removed on main: 0.1.5's chat opens files through
ctx.sidebarRight.openResource instead) and fork's stale
persistence.inspect() calls (replaced by main's open/read/close handle
protocol, since 0.1.5 removed the detached inspect() call).

Keeps one independent test from fork's sidechat-core.spec.ts coverage
(malformed assistant content should not throw) that doesn't depend on
either branch's live-chunk architecture.

Verified: typecheck, full test suite (127 files / 1347 tests), lint,
and build all pass on the merged tree.
… for DSH 0.1.7-rc.1, editor format reclaim, read-only previews, meta artwork)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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