feat(sidechat): main-conversation Blocks, turn usage tail, reconnect banner

Rendering-layer upgrade for the Side Chat transcript (data already rides
the raw events; the mapping just stopped discarding it):

- Tool rows with a derivable structure now render the host's
  ui-primitives atoms instead of a generic double <pre>: bash calls map
  onto TerminalBlock (command from call args, output + exit pill
  recovered from the result's trailing exit marker), edit/write map onto
  DiffBlock (call-time literal replacement, refined by the result meta's
  contextual hunks), read maps onto ReadBlock (line-window meta, same
  semantic narrowing the host applies). Every narrowing declines to the
  generic row on malformed input.
- turn/end now emits a turnSummary row: token usage aggregated from
  assistant/message.usage (output summed across steps, input from the
  last request) plus the envelope-time wall duration, printed with the
  main conversation's formatTokens/formatDurationMs cadence.
- The client entry injects 'connection' (DSH 0.1.2-alpha.2+) and the
  thread view shows the host's ConnectionIndicator while the Remote
  transport is down; the reconnect control calls reconnect() and a
  disconnected -> connected transition pulls the transcript immediately
  instead of waiting for the next poll tick.

19 new locale keys propagated across zh/en and all 19 third-language
dictionaries; unit coverage in sidechat-transcript.spec and a new
sidechat-view render spec (jsdom). Real-host mount smoke: 14/14.
This commit is contained in:
Menghuan1918 committed 2026-08-31 23:28:20 +08:00
1 parent d70db8fb02
commit 561ad66071
27 files changed
+1175 -17

No files matched your search

+38
View File
@@ -357,6 +357,25 @@ export const zh = {
sideChatClose: '关闭线程',
sideChatCloseTitle: '释放线程的 agent(历史保留)',
sideChatError: '侧边对话出错:{message}',
sideChatTurnUsage: '输入 {input} tok · 输出 {output} tok',
sideChatBlockCollapse: '收起',
sideChatBlockCollapseAria: '收起',
sideChatBlockExpand: '展开 {hidden} 行',
sideChatBlockExpandAria: '展开其余 {hidden} 行',
sideChatBlockSignal: '信号终止:{signal}',
sideChatBlockExitCode: '退出码 {code}',
sideChatBlockRunning: '运行中',
sideChatBlockFailed: '失败',
sideChatBlockDone: '完成',
sideChatBlockNoOutput: '(无输出)',
sideChatBlockFiles: '{count} 个文件',
sideChatBlockWindow: '共 {total} 行 · 显示 {shown} 行',
sideChatConnDisconnected: '连接已断开',
sideChatConnReconnect: '重新连接',
sideChatConnConnecting: '正在重连…',
sideChatConnRecovered: '连接已恢复',
sideChatConnReconnectAction: '立即重连',
sideChatConnRestartAction: '重新发起连接',
jobs: '后台任务',
jobsCount: '{count} 个后台任务',
jobsCountRunning: '{count} 个后台任务 · {running} 运行中',
@@ -747,6 +766,25 @@ export const en: Record<keyof typeof zh, string> = {
sideChatClose: 'Close thread',
sideChatCloseTitle: 'Release the thread\'s agent (history is kept)',
sideChatError: 'Side Chat error: {message}',
sideChatTurnUsage: 'Input {input} tok · Output {output} tok',
sideChatBlockCollapse: 'Collapse',
sideChatBlockCollapseAria: 'Collapse',
sideChatBlockExpand: 'Expand {hidden} lines',
sideChatBlockExpandAria: 'Expand {hidden} more lines',
sideChatBlockSignal: 'Killed by signal: {signal}',
sideChatBlockExitCode: 'Exit code {code}',
sideChatBlockRunning: 'Running',
sideChatBlockFailed: 'Failed',
sideChatBlockDone: 'Done',
sideChatBlockNoOutput: '(no output)',
sideChatBlockFiles: '{count} files',
sideChatBlockWindow: '{shown} of {total} lines',
sideChatConnDisconnected: 'Connection lost',
sideChatConnReconnect: 'Reconnect',
sideChatConnConnecting: 'Reconnecting…',
sideChatConnRecovered: 'Connection restored',
sideChatConnReconnectAction: 'Reconnect now',
sideChatConnRestartAction: 'Restart connection',
jobs: 'Background jobs',
jobsCount: '{count} background jobs',
jobsCountRunning: '{count} background jobs · {running} running',