diff --git a/.agents/notes/implemented/feature/2026-08-03-web-turn-run-time.i18n.yaml b/.agents/notes/implemented/feature/2026-08-03-web-turn-run-time.i18n.yaml new file mode 100644 index 0000000000..ea99a814e6 --- /dev/null +++ b/.agents/notes/implemented/feature/2026-08-03-web-turn-run-time.i18n.yaml @@ -0,0 +1,6 @@ +# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each +# side as of the last confirmed-consistent state. Both languages carry equal authority; +# after editing either side, bring the other along and re-record with: +# pnpm run verify-translation-pairing --write .agents/notes/implemented/feature/2026-08-03-web-turn-run-time.md +2026-08-03-web-turn-run-time.md: b6e79b34f45ebe46d9ce752b6333cdfce6fc4dd6 +2026-08-03-web-turn-run-time.zh.md: 73d9be4d2119278f8a78c6858bae353a4ef5d62f diff --git a/.agents/notes/implemented/feature/2026-08-03-web-turn-run-time.md b/.agents/notes/implemented/feature/2026-08-03-web-turn-run-time.md new file mode 100644 index 0000000000..b6e79b34f4 --- /dev/null +++ b/.agents/notes/implemented/feature/2026-08-03-web-turn-run-time.md @@ -0,0 +1,27 @@ +# Agent Note: Web turn run time and hover-revealed time chrome + +Status: implemented + +English | [中文](2026-08-03-web-turn-run-time.zh.md) + +## Problem + +The Web chat shows when a message arrived but not how long the agent worked on it. Long turns give no live progress signal beyond the static activity label, and after the turn settles the wall time is not recoverable from the UI. Meanwhile the always-visible clock row adds visual noise to every message. + +## Decision + +Turn wall time uses the existing logged `turn/start` and `turn/end` timestamps, with no new session events. The client Session folds each in-window pair into `turnTimings`; the actions-owning assistant footer renders `endTime - startTime` as a localized `Ran for {duration}` label after the turn ends. The running `TurnStatus` clock uses the latest timing without an end, so reload preserves elapsed time, steering does not reset it, and a retry starts from its own logged boundary. Both readings use the same localized formatter and whole-second floor. The clock appears only after 15 seconds and is hidden from the live region so screen readers announce the activity status without replaying every tick. + +Time chrome (clock and run time) is hover-revealed: message containers opt in with a `data-time-hover-root` attribute, and `MessageIconActions.module.css` fades the time label in on container `:hover`/`:focus-within`. The rule is scoped to `@media (hover: hover)`, so touch devices keep the always-visible label; opacity (not display) keeps the layout stable. Copy/branch icons stay always visible. + +## Alternatives considered + +**Deriving timing from message nodes.** The nearest user or steering timestamp is available in the rendered transcript, but it mismeasures retry turns and lets mid-turn steering reset the live clock. Existing turn boundary events provide the authoritative timestamps without changing the log format. + +**Anchoring the live clock to component mount.** Simpler, but a mid-turn reload would restart the clock at zero and disagree with the eventual footer label. Mount time remains only the fallback when `turn/start` is outside the loaded window. + +**Hiding the whole actions row until hover.** Copy and branch are affordances worth discovering, and row-level show/hide risks layout shift. Only the passive time text is hover-gated. + +## Consequences + +Turn duration is visible live and after settlement without new session events, and both readings share exact log boundaries and formatting. The settled duration includes activity after the last assistant text up to `turn/end`; the label is absent when `turn/start` is outside the loaded window. Time chrome no longer competes with message content at rest, and the ticking clock remains visual rather than repeatedly announced. diff --git a/.agents/notes/implemented/feature/2026-08-03-web-turn-run-time.zh.md b/.agents/notes/implemented/feature/2026-08-03-web-turn-run-time.zh.md new file mode 100644 index 0000000000..73d9be4d21 --- /dev/null +++ b/.agents/notes/implemented/feature/2026-08-03-web-turn-run-time.zh.md @@ -0,0 +1,27 @@ +# Agent Note: Web 轮次运行时长与悬停显示的时间附属元素 + +Status: implemented + +[English](2026-08-03-web-turn-run-time.md) | 中文 + +## 问题 + +Web 聊天界面会显示消息的到达时间,却不显示 agent(智能体)处理这条消息花了多久。长轮次除静态活动标签外没有任何实时进度信号,轮次结束后也无法从 UI 中还原实际耗时。与此同时,始终可见的时钟行给每条消息都增加了视觉噪音。 + +## 决策 + +轮次实际耗时(wall time)采用日志中已有的 `turn/start` 和 `turn/end` 时间戳,不新增任何会话事件。客户端 Session 将加载窗口内的每对边界归并到 `turnTimings` 中;轮次结束后,承载操作图标的 assistant 页脚把 `endTime - startTime` 渲染为本地化的 `Ran for {duration}` 标签。运行中的 `TurnStatus` 时钟采用最新一条没有结束时间的计时记录,因此重新加载会保留已用时长,steering(中途引导)不会重置计时,重试也从自身的日志边界开始。两处读数共用同一个本地化格式化器,并向下取整到整秒。该时钟在 15 秒后才出现,并从实时区域中隐藏,因此屏幕阅读器会播报活动状态而不会重复播报每次时钟跳动。 + +时钟与运行时长这类时间附属元素(time chrome)在悬停时才显示:消息容器通过 `data-time-hover-root` 属性显式启用该行为,`MessageIconActions.module.css` 在容器处于 `:hover`/`:focus-within` 时以淡入方式显示时间标签。该规则限定在 `@media (hover: hover)` 之内,触屏设备因此保持标签始终可见;显隐通过 opacity(而非 display)实现,布局保持稳定。复制与分支图标始终可见。 + +## 考虑过的替代方案 + +**从消息节点推导计时。** 渲染后的 transcript(文本记录)中可以取得最近的用户或 steering 时间戳,但这会错误计算重试轮次,并让轮次中途的 steering 重置实时时钟。已有的轮次边界事件无需改变日志格式即可提供权威时间戳。 + +**将实时时钟锚定到组件挂载时刻。** 更简单,但轮次进行中重新加载会让时钟从零重新计时,并与最终的页脚标签不一致。仅当 `turn/start` 位于已加载窗口之外时,才回退到挂载时刻。 + +**将整个操作行隐藏至悬停时才显示。** 复制与分支是值得让用户发现的操作入口,而整行级别的显隐切换有布局偏移的风险。只有被动的时间文本由悬停控制显隐。 + +## 后果 + +轮次时长在运行中和结束后都可见,且不需要新的会话事件;两处读数共用精确的日志边界和格式化方式。结束后的时长包括最后一条 assistant 文本之后、直至 `turn/end` 的活动;若 `turn/start` 位于已加载窗口之外,则不显示标签。未交互时,时间附属元素不再与消息内容争夺注意力,持续跳动的时钟也只保留视觉呈现,不会被重复播报。 diff --git a/apps/web/tests/snapshots/code-mode-round/ui.expected.md b/apps/web/tests/snapshots/code-mode-round/ui.expected.md index c6799a2247..42758237bb 100644 --- a/apps/web/tests/snapshots/code-mode-round/ui.expected.md +++ b/apps/web/tests/snapshots/code-mode-round/ui.expected.md @@ -36,7 +36,7 @@ - img - button "Branch into a new conversation": - img -- text: {{clock}} +- text: {{clock}}Ran for {{duration}} - textbox "Message the agent" - button "Commands": - img diff --git a/apps/web/tests/snapshots/cordis-tool-round/ui.expected.md b/apps/web/tests/snapshots/cordis-tool-round/ui.expected.md index fc6d312821..85ef8932b2 100644 --- a/apps/web/tests/snapshots/cordis-tool-round/ui.expected.md +++ b/apps/web/tests/snapshots/cordis-tool-round/ui.expected.md @@ -51,7 +51,7 @@ - img - button "Branch into a new conversation": - img -- text: {{clock}} +- text: {{clock}}Ran for {{duration}} - textbox "Message the agent" - button "Commands": - img diff --git a/apps/web/tests/snapshots/fresh-round-trip/ui.expected.md b/apps/web/tests/snapshots/fresh-round-trip/ui.expected.md index 17df480cd9..159e77d5bc 100644 --- a/apps/web/tests/snapshots/fresh-round-trip/ui.expected.md +++ b/apps/web/tests/snapshots/fresh-round-trip/ui.expected.md @@ -31,7 +31,7 @@ - img - button "Branch into a new conversation": - img -- text: {{clock}} +- text: {{clock}}Ran for {{duration}} - textbox "Message the agent" - button "Commands": - img diff --git a/apps/web/tests/snapshots/lifecycle-chrome/reloaded.expected.md b/apps/web/tests/snapshots/lifecycle-chrome/reloaded.expected.md index 5e0b4f73bb..f6f965337e 100644 --- a/apps/web/tests/snapshots/lifecycle-chrome/reloaded.expected.md +++ b/apps/web/tests/snapshots/lifecycle-chrome/reloaded.expected.md @@ -23,7 +23,7 @@ - img - button "Branch into a new conversation": - img -- text: {{clock}} +- text: {{clock}}Ran for {{duration}} - textbox "Message the agent" - button "Commands": - img diff --git a/apps/web/tests/snapshots/live-interactions/cancel.expected.md b/apps/web/tests/snapshots/live-interactions/cancel.expected.md index d18e061a1a..cd06310db0 100644 --- a/apps/web/tests/snapshots/live-interactions/cancel.expected.md +++ b/apps/web/tests/snapshots/live-interactions/cancel.expected.md @@ -20,7 +20,7 @@ - img - button "Branch into a new conversation": - img -- text: {{clock}} +- text: {{clock}}Ran for {{duration}} - textbox "Message the agent" - button "Commands": - img diff --git a/apps/web/tests/snapshots/live-interactions/retry.expected.md b/apps/web/tests/snapshots/live-interactions/retry.expected.md index d5df08c05e..5f834e15f0 100644 --- a/apps/web/tests/snapshots/live-interactions/retry.expected.md +++ b/apps/web/tests/snapshots/live-interactions/retry.expected.md @@ -25,7 +25,7 @@ - img - button "Branch into a new conversation": - img -- text: {{clock}} +- text: {{clock}}Ran for {{duration}} - textbox "Message the agent" - button "Commands": - img diff --git a/apps/web/tests/snapshots/markdown-images/ui.expected.md b/apps/web/tests/snapshots/markdown-images/ui.expected.md index 58b72e0d65..0f261e5474 100644 --- a/apps/web/tests/snapshots/markdown-images/ui.expected.md +++ b/apps/web/tests/snapshots/markdown-images/ui.expected.md @@ -19,7 +19,7 @@ - img - button "Branch into a new conversation": - img -- text: {{clock}} +- text: {{clock}}Ran for {{duration}} - textbox "Message the agent" - button "Commands": - img diff --git a/apps/web/tests/snapshots/message-actions/ui.expected.md b/apps/web/tests/snapshots/message-actions/ui.expected.md index 3d085b0931..0554b95404 100644 --- a/apps/web/tests/snapshots/message-actions/ui.expected.md +++ b/apps/web/tests/snapshots/message-actions/ui.expected.md @@ -20,7 +20,7 @@ - img - button "Branch into a new conversation" [disabled]: - img -- text: Available only on the last message of a completed turn 7/25 {{clock}} +- text: Available only on the last message of a completed turn 7/25 {{clock}}Ran for {{duration}} - button "Read a.txt": - img - img @@ -46,7 +46,7 @@ - img - button "Branch into a new conversation": - img -- text: 7/25 {{clock}} +- text: 7/25 {{clock}}Ran for {{duration}} - textbox "Message the agent" - button "Commands": - img diff --git a/apps/web/tests/snapshots/plan-review/approved.expected.md b/apps/web/tests/snapshots/plan-review/approved.expected.md index 108ca47986..2120c32408 100644 --- a/apps/web/tests/snapshots/plan-review/approved.expected.md +++ b/apps/web/tests/snapshots/plan-review/approved.expected.md @@ -36,7 +36,7 @@ - img - button "Branch into a new conversation": - img -- text: {{clock}} +- text: {{clock}}Ran for {{duration}} - textbox "Message the agent" - button "Commands": - img diff --git a/apps/web/tests/snapshots/question-composer/answered.expected.md b/apps/web/tests/snapshots/question-composer/answered.expected.md index 7fdddfa8a8..a54b7dcd75 100644 --- a/apps/web/tests/snapshots/question-composer/answered.expected.md +++ b/apps/web/tests/snapshots/question-composer/answered.expected.md @@ -31,7 +31,7 @@ - img - button "Branch into a new conversation": - img -- text: {{clock}} +- text: {{clock}}Ran for {{duration}} - textbox "Message the agent" - button "Commands": - img diff --git a/apps/web/tests/snapshots/queue-actions/preserved.expected.md b/apps/web/tests/snapshots/queue-actions/preserved.expected.md index 74de289ee9..2ce0077a2e 100644 --- a/apps/web/tests/snapshots/queue-actions/preserved.expected.md +++ b/apps/web/tests/snapshots/queue-actions/preserved.expected.md @@ -20,7 +20,7 @@ - img - button "Branch into a new conversation": - img -- text: {{clock}} Edited queue item {{clock}} +- text: {{clock}}Ran for {{duration}} Edited queue item {{clock}} - button "Copy": - img - button "Branch into a new conversation" [disabled]: diff --git a/apps/web/tests/snapshots/seeded-history/command-row.expected.md b/apps/web/tests/snapshots/seeded-history/command-row.expected.md index b4eddfc24e..d638821c45 100644 --- a/apps/web/tests/snapshots/seeded-history/command-row.expected.md +++ b/apps/web/tests/snapshots/seeded-history/command-row.expected.md @@ -33,7 +33,7 @@ - img - button "Branch into a new conversation": - img -- text: 7/25 {{clock}} +- text: 7/25 {{clock}}Ran for {{duration}} - button "Context compacted View compaction summary": - img - text: Context compacted View compaction summary diff --git a/apps/web/tests/snapshots/seeded-history/ui.expected.md b/apps/web/tests/snapshots/seeded-history/ui.expected.md index 4643c60f3b..9e78cca0f8 100644 --- a/apps/web/tests/snapshots/seeded-history/ui.expected.md +++ b/apps/web/tests/snapshots/seeded-history/ui.expected.md @@ -33,7 +33,7 @@ - img - button "Branch into a new conversation": - img -- text: 7/25 {{clock}} +- text: 7/25 {{clock}}Ran for {{duration}} - button "Context compacted View compaction summary": - img - text: Context compacted View compaction summary diff --git a/apps/web/tests/snapshots/steering/settled.expected.md b/apps/web/tests/snapshots/steering/settled.expected.md index 4d8d35a085..00f1b33206 100644 --- a/apps/web/tests/snapshots/steering/settled.expected.md +++ b/apps/web/tests/snapshots/steering/settled.expected.md @@ -37,7 +37,7 @@ - img - button "Branch into a new conversation": - img -- text: {{clock}} +- text: {{clock}}Ran for {{duration}} - textbox "Message the agent" - button "Commands": - img diff --git a/apps/web/tests/snapshots/subagent-conversation/ui.expected.md b/apps/web/tests/snapshots/subagent-conversation/ui.expected.md index 9497cc36d3..561277b8ee 100644 --- a/apps/web/tests/snapshots/subagent-conversation/ui.expected.md +++ b/apps/web/tests/snapshots/subagent-conversation/ui.expected.md @@ -28,7 +28,7 @@ - img - button "Branch into a new conversation": - img -- text: {{clock}} Now give the same explanation to a human reader. {{clock}} +- text: {{clock}}Ran for {{duration}} Now give the same explanation to a human reader. {{clock}} - button "Copy": - img - button "Branch into a new conversation" [disabled]: @@ -43,7 +43,7 @@ - img - button "Branch into a new conversation": - img -- text: {{clock}} +- text: {{clock}}Ran for {{duration}} - textbox "Message the agent" - button "Commands": - img diff --git a/apps/web/tests/snapshots/web-search-round/ui.expected.md b/apps/web/tests/snapshots/web-search-round/ui.expected.md index 97ca405141..45098769f7 100644 --- a/apps/web/tests/snapshots/web-search-round/ui.expected.md +++ b/apps/web/tests/snapshots/web-search-round/ui.expected.md @@ -23,7 +23,7 @@ - img - button "Branch into a new conversation": - img -- text: {{clock}} +- text: {{clock}}Ran for {{duration}} - textbox "Message the agent" - button "Commands": - img diff --git a/packages/client/runtime/src/client/sessions/conversation.ts b/packages/client/runtime/src/client/sessions/conversation.ts index 46cc5b0391..c4e195bc88 100644 --- a/packages/client/runtime/src/client/sessions/conversation.ts +++ b/packages/client/runtime/src/client/sessions/conversation.ts @@ -331,6 +331,8 @@ export interface ConversationSnapshot { sessionId: SessionId /** Human transcript plus retry notices and interrupted-turn terminal nodes in event order. */ nodes: readonly ConversationNode[] + /** Exact in-window `turn/start` time and optional matching `turn/end` time. */ + turnTimings: ReadonlyMap /** In-window completed turn number -> its `turn/end` event seq. */ turnEnds: ReadonlyMap partial: PartialAssistant | null diff --git a/packages/client/runtime/src/client/sessions/session.ts b/packages/client/runtime/src/client/sessions/session.ts index c4cc1d2b5b..65e10a9026 100644 --- a/packages/client/runtime/src/client/sessions/session.ts +++ b/packages/client/runtime/src/client/sessions/session.ts @@ -113,6 +113,11 @@ export class Session implements SessionFace { private pendingCache: { rev: number; value: PendingInteraction[] } | null = null private derivedRev = 0 private nodesCache: { projected: readonly ConversationNode[]; derivedRev: number; value: readonly ConversationNode[] } | null = null + /** Exact turn timing retained from the raw window so presentation never + * infers elapsed time from transcript content. */ + private turnTimings = new Map() + private turnTimingsRev = 0 + private turnTimingsCache: { rev: number; value: ConversationSnapshot['turnTimings'] } | null = null /** Completed turn boundaries retained from the raw window so presentation * actions never infer a safe fork point from transcript content alone. */ private turnEnds = new Map() @@ -799,6 +804,8 @@ export class Session implements SessionFace { } switch (event.type) { case 'turn/start': { + this.turnTimings.set(event.data.turn, { startTime: event.time }) + this.turnTimingsRev++ if (event.data.trigger.kind === 'retry') this.settleScheduledRetry('started') return } @@ -830,6 +837,11 @@ export class Session implements SessionFace { return } case 'turn/end': { + const timing = this.turnTimings.get(event.data.turn) + if (timing !== undefined) { + this.turnTimings.set(event.data.turn, { ...timing, endTime: event.time }) + this.turnTimingsRev++ + } this.turnEnds.set(event.data.turn, event.seq) this.turnEndsRev++ if (event.data.reason.kind === 'aborted' || event.data.reason.kind === 'disposed') { @@ -922,6 +934,8 @@ export class Session implements SessionFace { this.callsRev++ this.derivedNodes = [] this.derivedRev++ + this.turnTimings = new Map() + this.turnTimingsRev++ this.turnEnds = new Map() this.turnEndsRev++ this.codeDispatches = new Map() @@ -955,6 +969,9 @@ export class Session implements SessionFace { if (this.callsCache === null || this.callsCache.rev !== this.callsRev) { this.callsCache = { rev: this.callsRev, value: [...this.openCalls.values()] } } + if (this.turnTimingsCache === null || this.turnTimingsCache.rev !== this.turnTimingsRev) { + this.turnTimingsCache = { rev: this.turnTimingsRev, value: new Map(this.turnTimings) } + } if (this.turnEndsCache === null || this.turnEndsCache.rev !== this.turnEndsRev) { this.turnEndsCache = { rev: this.turnEndsRev, value: new Map(this.turnEnds) } } @@ -971,6 +988,7 @@ export class Session implements SessionFace { return { sessionId: this.sessionId, nodes, + turnTimings: this.turnTimingsCache.value, turnEnds: this.turnEndsCache.value, partial, runningCalls: this.callsCache.value, diff --git a/packages/client/runtime/tests/session.spec.ts b/packages/client/runtime/tests/session.spec.ts index 26743e23ab..e1c9bbeae7 100644 --- a/packages/client/runtime/tests/session.spec.ts +++ b/packages/client/runtime/tests/session.spec.ts @@ -46,6 +46,11 @@ describe('open', () => { expect(snapshot.openState).toBe('open') expect(snapshot.hasMore).toBe(true) expect(snapshot.nodes.map(n => n.kind)).toEqual(['user', 'assistant']) + expect(snapshot.turnTimings.get(3)).toEqual({ + startTime: 1_700_000_000_010, + endTime: 1_700_000_000_015, + }) + expect(snapshot.turnEnds.get(3)).toBe(15) }) it('is idempotent: concurrent opens share one history call, reopening when open is a no-op', async () => { @@ -253,11 +258,22 @@ describe('live event path', () => { expect(snapshot.nodes.some(node => node.kind === 'turn-error')).toBe(false) expect(snapshot.nodes.at(-2)).toMatchObject({ kind: 'model-retry', retryState: 'started' }) expect(snapshot.nodes.at(-1)).toMatchObject({ kind: 'assistant', blocks: [{ kind: 'text', text: '完整回复' }] }) + const retryStart = retryTurn.find(event => + event.type === 'turn/start' && event.data.trigger.kind === 'retry') + if (retryStart?.type !== 'turn/start') throw new Error('test fixture must include a retry turn/start') + const retryEnd = retryTurn.find(event => + event.type === 'turn/end' && event.data.turn === retryStart.data.turn) + if (retryEnd?.type !== 'turn/end') throw new Error('test fixture must complete the retry turn') + expect(snapshot.turnTimings.get(retryStart.data.turn)).toEqual({ + startTime: retryStart.time, + endTime: retryEnd.time, + }) const replay = makeSession() replay.api.onHistory = () => histResponse([...plainTurn(0, 0, 'a', 'b'), ...retryTurn]) await replay.session.open() expect(replay.session.getSnapshot().nodes).toEqual(snapshot.nodes) + expect(replay.session.getSnapshot().turnTimings).toEqual(snapshot.turnTimings) expect(replay.session.getSnapshot().partial).toBeNull() }) @@ -1254,6 +1270,7 @@ describe('reference stability (the memo contract)', () => { expect(after).not.toBe(before) expect(after.runningCalls).toBe(before.runningCalls) expect(after.pending).toBe(before.pending) + expect(after.turnTimings).toBe(before.turnTimings) expect(after.turnEnds).toBe(before.turnEnds) // And a mutation on the tracked domain swaps that array. feed(ev.toolResult(11, 1, 'c1', 'ECHO')) diff --git a/packages/client/test-runtime/src/fixtures.ts b/packages/client/test-runtime/src/fixtures.ts index d033669215..9cf025192c 100644 --- a/packages/client/test-runtime/src/fixtures.ts +++ b/packages/client/test-runtime/src/fixtures.ts @@ -46,6 +46,7 @@ export function conversationSnapshot(sessionId: SessionId): ConversationSnapshot return { sessionId, nodes: [], + turnTimings: new Map(), turnEnds: new Map(), partial: null, runningCalls: [], diff --git a/packages/client/ui-conversation/src/client/chat/AssistantMarkdown.tsx b/packages/client/ui-conversation/src/client/chat/AssistantMarkdown.tsx index 3f87e40e8b..de882e8bb2 100644 --- a/packages/client/ui-conversation/src/client/chat/AssistantMarkdown.tsx +++ b/packages/client/ui-conversation/src/client/chat/AssistantMarkdown.tsx @@ -27,6 +27,9 @@ export interface AssistantMarkdownProps { /** Unix epoch ms for the IconActions clock; omitted while streaming or when * the parent withholds chrome (mid-turn content assistants). */ time?: number | undefined + /** Turn wall time in ms for the IconActions run-time label; omitted when the + * turn's triggering input is outside the loaded window. */ + runMs?: number | undefined /** Event sequence used as the fork boundary; omitted while streaming. */ seq?: number | undefined /** Fork the session through this finalized message's completed turn when eligible. */ @@ -79,7 +82,7 @@ function ThinkRow({ text, running, t }: { text: string; running: boolean; t: Ass } export const AssistantMarkdown = memo(function AssistantMarkdown({ - blocks, streaming, interrupted, time, seq, onFork, forkUnavailable, t, + blocks, streaming, interrupted, time, runMs, seq, onFork, forkUnavailable, t, }: AssistantMarkdownProps) { // Stable per locale revision (t identity changes on switch): a fresh object // per render would rebuild MarkdownText's component table every chunk. @@ -95,7 +98,7 @@ export const AssistantMarkdown = memo(function AssistantMarkdown({ // Footer only under settled content text; Think-only / streaming omit it. const showActions = !streaming && time !== undefined && hasContentText(blocks) return ( -
+
{blocks.map((block, i) => { switch (block.kind) { @@ -121,6 +124,7 @@ export const AssistantMarkdown = memo(function AssistantMarkdown({ { onFork(seq) }} branchUnavailable={forkUnavailable} diff --git a/packages/client/ui-conversation/src/client/chat/ChatView.module.css b/packages/client/ui-conversation/src/client/chat/ChatView.module.css index 87f965b9a4..0830a33e0c 100644 --- a/packages/client/ui-conversation/src/client/chat/ChatView.module.css +++ b/packages/client/ui-conversation/src/client/chat/ChatView.module.css @@ -99,6 +99,15 @@ animation: dsh-turn-status-shimmer 1.8s linear infinite; } +.turnStatusClock { + margin-left: 8px; + font: var(--dsw-font-xs-13); + font-weight: 400; + font-variant-numeric: tabular-nums; + color: var(--dsw-alias-label-caption); + -webkit-text-fill-color: var(--dsw-alias-label-caption); +} + @keyframes dsh-turn-status-shimmer { to { background-position: 0 0; diff --git a/packages/client/ui-conversation/src/client/chat/ChatView.tsx b/packages/client/ui-conversation/src/client/chat/ChatView.tsx index c50a9443d4..3320eb0f69 100644 --- a/packages/client/ui-conversation/src/client/chat/ChatView.tsx +++ b/packages/client/ui-conversation/src/client/chat/ChatView.tsx @@ -30,11 +30,12 @@ import type { import type { SnapshotSelectorHook } from '@deepseek-ai/dsh-client-ui-slots' import { IconChevronDownOutline14 } from '@deepseek-ai/dsh-client-ui-primitives' import type { ChatViewSlotProps } from '../contract/slots.ts' -import { assistantActionsSeqs, deriveChatFlow, messageBranchSeqs, type ChatFlowItem } from './chat-flow.ts' +import { assistantActionsSeqs, deriveChatFlow, messageBranchSeqs, runningTurnStartTime, type ChatFlowItem } from './chat-flow.ts' import { AssistantMarkdown } from './AssistantMarkdown.tsx' import { GenericCommandCard } from './GenericCommandCard.tsx' import { GenericToolCard } from './GenericToolCard.tsx' import { MessageItem, PendingSteeringBubble } from './MessageItem.tsx' +import { formatRunDuration } from './message-chrome.ts' import css from './ChatView.module.css' const FOLLOW_THRESHOLD = 24 @@ -282,10 +283,37 @@ const CommandRow = memo(function CommandRow({ renderSlot, node, t }: { }) /** Turn-level model activity label retained across first-token, tool, and streaming phases. */ -function TurnStatus() { +function TurnStatus({ startTime, t }: { + /** The running turn's logged `turn/start` time; null falls back to mount + * time when that boundary is outside the window. */ + startTime: number | null + /** The owning view's locale seat. */ + t: ChatViewSlotProps['t'] +}) { + const [mountedAt] = useState(() => Date.now()) + // Anchored to turn/start so a mid-turn reload keeps the real + // elapsed time and the final footer's Ran-for label matches this clock. + const anchor = startTime ?? mountedAt + const [elapsedMs, setElapsedMs] = useState(() => Math.max(0, Date.now() - anchor)) + useEffect(() => { + const tick = (): void => { + setElapsedMs(Math.max(0, Date.now() - anchor)) + } + tick() + const id = setInterval(tick, 1000) + return () => { clearInterval(id) } + }, [anchor]) + // Short turns keep the plain label; the clock only appears once the turn + // has clearly been running for a while. + const showClock = elapsedMs >= 15_000 return (
Deep diving... + {showClock && ( + + {formatRunDuration(elapsedMs, t)} + + )}
) } @@ -309,6 +337,7 @@ export function ChatView({ useSession, useSessions, useStore, renderSlot, sessionId, openFile, loadOlder, inspectCall, chatScroll, forkAt, t, }: ChatViewSlotProps) { const nodes = useSession(s => s.nodes) + const turnTimings = useSession(s => s.turnTimings) const turnEnds = useSession(s => s.turnEnds) const inbox = useSession(s => s.queue) // Workspace root off the session list row: path summaries display relative to it. @@ -332,6 +361,7 @@ export function ChatView({ // text (before tools) omits `time` so AssistantMarkdown stays chrome-free. const actionSeqs = useMemo(() => assistantActionsSeqs(nodes), [nodes]) const branchSeqs = useMemo(() => messageBranchSeqs(nodes, turnEnds), [nodes, turnEnds]) + const runningTurnStart = useMemo(() => runningTurnStartTime(turnTimings), [turnTimings]) const listRef = useRef(null) const columnRef = useRef(null) @@ -568,12 +598,16 @@ export function ChatView({ } const node: ConversationNode = item.node if (node.kind === 'assistant') { + const timing = actionSeqs.has(node.seq) ? turnTimings.get(node.turn) : undefined return ( } + {running && } {pendingSteering.map(item => ( ))} diff --git a/packages/client/ui-conversation/src/client/chat/MessageIconActions.module.css b/packages/client/ui-conversation/src/client/chat/MessageIconActions.module.css index 8a43b42f83..0e80c5ee44 100644 --- a/packages/client/ui-conversation/src/client/chat/MessageIconActions.module.css +++ b/packages/client/ui-conversation/src/client/chat/MessageIconActions.module.css @@ -1,5 +1,6 @@ /* Shared message IconActions row (user + assistant). Parent modules own - layout offsets via the composed className. Always visible when mounted. */ + layout offsets via the composed className. Icons stay visible when mounted; + the time label is hover-revealed inside a data-time-hover-root scope. */ .actions { display: flex; @@ -25,6 +26,26 @@ white-space: nowrap; } +/* Separator between the clock and the run-time label (time · Ran for 15s). */ +.runTimeDot { + margin: 0 10px; +} + +/* Message containers opt in with data-time-hover-root: the time label fades + in on message hover (or keyboard focus within). Opacity keeps the layout + stable, and devices without hover keep the label always visible. */ +@media (hover: hover) { + [data-time-hover-root] :is(.timeStart, .timeEnd) { + opacity: 0; + transition: opacity 80ms ease; + } + + [data-time-hover-root]:hover :is(.timeStart, .timeEnd), + [data-time-hover-root]:focus-within :is(.timeStart, .timeEnd) { + opacity: 1; + } +} + .action { display: inline-flex; align-items: center; diff --git a/packages/client/ui-conversation/src/client/chat/MessageIconActions.tsx b/packages/client/ui-conversation/src/client/chat/MessageIconActions.tsx index 6d77d4db68..a2c1459875 100644 --- a/packages/client/ui-conversation/src/client/chat/MessageIconActions.tsx +++ b/packages/client/ui-conversation/src/client/chat/MessageIconActions.tsx @@ -6,7 +6,7 @@ import { IconBranchOutline16, IconCopyOutline16, Tooltip, } from '@deepseek-ai/dsh-client-ui-primitives' import type { ChatViewSlotProps } from '../contract/slots.ts' -import { formatMessageClock, writeClipboard } from './message-chrome.ts' +import { formatMessageClock, formatRunDuration, writeClipboard } from './message-chrome.ts' import { useCalendarDay } from './use-calendar-day.ts' import css from './MessageIconActions.module.css' @@ -15,6 +15,8 @@ export interface MessageIconActionsProps { text: string /** Unix epoch ms for the clock label; omitted for transient messages. */ time?: number | undefined + /** Turn wall time in ms, appended to the clock as `· Ran for 15s`; omitted when the turn's start is unknown. */ + runMs?: number | undefined /** Clock before icons (user) or after (assistant). */ clock: 'start' | 'end' /** Fork the session at this message; omission hides the branch action. */ @@ -35,7 +37,7 @@ export interface MessageIconActionsProps { * @returns The actions row element. */ export function MessageIconActions({ - text, time, clock, onBranch, branchUnavailable = false, showBranch = true, className, t, + text, time, runMs, clock, onBranch, branchUnavailable = false, showBranch = true, className, t, }: MessageIconActionsProps) { const day = useCalendarDay() const reasonId = useId() @@ -45,6 +47,12 @@ export function MessageIconActions({ const clockEl = time === undefined ? null : ( {formatMessageClock(time, t, day)} + {runMs !== undefined && ( + <> + · + {t('message.ranFor', { duration: formatRunDuration(runMs, t) })} + + )} ) return ( diff --git a/packages/client/ui-conversation/src/client/chat/MessageItem.tsx b/packages/client/ui-conversation/src/client/chat/MessageItem.tsx index df04ac19c2..a0bed9a38e 100644 --- a/packages/client/ui-conversation/src/client/chat/MessageItem.tsx +++ b/packages/client/ui-conversation/src/client/chat/MessageItem.tsx @@ -183,7 +183,7 @@ function UserStyleBubble({ const { text, rest } = contentText(content) const truncated = (total: number): string => t('json.truncated', { total }) return ( -
+
{projectUserText(text)} {rest.map((block, i) => )} diff --git a/packages/client/ui-conversation/src/client/chat/chat-flow.ts b/packages/client/ui-conversation/src/client/chat/chat-flow.ts index 9de9876d89..2fc2a82a69 100644 --- a/packages/client/ui-conversation/src/client/chat/chat-flow.ts +++ b/packages/client/ui-conversation/src/client/chat/chat-flow.ts @@ -9,7 +9,7 @@ * flow share their gates. */ import type { - AssistantBlock, ConversationNode, ToolResultNode, + AssistantBlock, ConversationNode, ConversationSnapshot, ToolResultNode, } from '@deepseek-ai/dsh-client-runtime/client' /** One renderable flow item; key is the React key and the parent's identity unit. */ @@ -47,6 +47,21 @@ export function assistantActionsSeqs(nodes: readonly ConversationNode[]): Readon return new Set(lastByTurn.values()) } +/** + * Exact start time of the latest in-window turn without a matching end time. + * @param turnTimings - In-window turn timings in event order. + * @returns Unix epoch ms, or null when the running turn started outside the window. + */ +export function runningTurnStartTime( + turnTimings: ConversationSnapshot['turnTimings'], +): number | null { + let latest: number | null = null + for (const timing of turnTimings.values()) { + if (timing.endTime === undefined) latest = timing.startTime + } + return latest +} + /** * Seq set of message rows that may fork: the last transcript node of a * completed turn, when that node owns message chrome. A later tool, reasoning, diff --git a/packages/client/ui-conversation/src/client/chat/message-chrome.ts b/packages/client/ui-conversation/src/client/chat/message-chrome.ts index 67b625e71d..a125355a27 100644 --- a/packages/client/ui-conversation/src/client/chat/message-chrome.ts +++ b/packages/client/ui-conversation/src/client/chat/message-chrome.ts @@ -6,6 +6,9 @@ import type { Translate } from '@deepseek-ai/dsh-client-ui-slots' /** The date-template share of the conversation dictionary the clock consumes. */ export type ClockTranslate = Translate<'clock.md' | 'clock.ymd'> +/** The elapsed-duration share of the conversation dictionary. */ +export type RunDurationTranslate = Translate<'duration.seconds' | 'duration.minutes'> + /** * Best-effort clipboard write; rejections stay swallowed (no success chrome). * @param text - Plain text to place on the clipboard. @@ -71,6 +74,21 @@ export function msUntilNextLocalMidnight(ms: number): number { return Math.max(next.getTime() - ms, 1) } +/** + * Localized elapsed-time label shared by running and settled turn chrome. + * @param ms - Elapsed duration in milliseconds (negatives clamp to zero). + * @param t - Translate seat supplying the duration templates. + * @returns Display string in whole seconds. + */ +export function formatRunDuration(ms: number, t: RunDurationTranslate): string { + const total = Math.max(0, Math.floor(ms / 1000)) + const minutes = Math.floor(total / 60) + const seconds = total % 60 + return minutes > 0 + ? t('duration.minutes', { minutes, seconds: String(seconds).padStart(2, '0') }) + : t('duration.seconds', { seconds }) +} + /** * Compact local timestamp for message IconActions. Same calendar day → * `HH:mm`; earlier this year → the `clock.md` date template + clock; other diff --git a/packages/client/ui-conversation/src/client/locales.ts b/packages/client/ui-conversation/src/client/locales.ts index 7bc01b4d95..7a38aaa0f8 100644 --- a/packages/client/ui-conversation/src/client/locales.ts +++ b/packages/client/ui-conversation/src/client/locales.ts @@ -68,6 +68,9 @@ export const zh = { 'message.retry.delay': '重试延迟:', 'message.retry.failure': '失败原因:', 'message.turnError': '本轮运行失败', + 'message.ranFor': '用时 {duration}', + 'duration.seconds': '{seconds}秒', + 'duration.minutes': '{minutes}分{seconds}秒', 'command.running': '执行中…', 'command.failed': '命令失败', 'command.done': '已完成', @@ -176,6 +179,9 @@ export const en = { 'message.retry.delay': 'Retry delay: ', 'message.retry.failure': 'Failure reason: ', 'message.turnError': 'This turn failed', + 'message.ranFor': 'Ran for {duration}', + 'duration.seconds': '{seconds}s', + 'duration.minutes': '{minutes}m {seconds}s', 'command.running': 'Running…', 'command.failed': 'Command failed', 'command.done': 'Completed', diff --git a/packages/client/ui-conversation/tests/chat-code-subcalls.spec.tsx b/packages/client/ui-conversation/tests/chat-code-subcalls.spec.tsx index 6708cdb759..f07104ba7b 100644 --- a/packages/client/ui-conversation/tests/chat-code-subcalls.spec.tsx +++ b/packages/client/ui-conversation/tests/chat-code-subcalls.spec.tsx @@ -67,7 +67,7 @@ function snapshotWith( runningCalls: RunningToolCall[] = [], ): ConversationSnapshot { return { - sessionId: SID, nodes, turnEnds: new Map(), partial: null, runningCalls, codeDispatches, + sessionId: SID, nodes, turnTimings: new Map(), turnEnds: new Map(), partial: null, runningCalls, codeDispatches, pending: [], queue: [], running: runningCalls.length > 0, composerPhase: 'active', removed: false, openState: 'open', openError: null, hasMore: false, loadingOlder: false, promptError: null, blank: false, subagent: null, lastAgentError: null, diff --git a/packages/client/ui-conversation/tests/chat-stats-bash-sample.spec.tsx b/packages/client/ui-conversation/tests/chat-stats-bash-sample.spec.tsx index 95da35f267..8368c7cca1 100644 --- a/packages/client/ui-conversation/tests/chat-stats-bash-sample.spec.tsx +++ b/packages/client/ui-conversation/tests/chat-stats-bash-sample.spec.tsx @@ -32,7 +32,7 @@ const assistant = (seq: number, turn: number, usage?: unknown): AssistantMessage function snapshotBase(): ConversationSnapshot { return { - sessionId: SID, nodes: [], turnEnds: new Map(), partial: null, runningCalls: [], codeDispatches: new Map(), + sessionId: SID, nodes: [], turnTimings: new Map(), turnEnds: new Map(), partial: null, runningCalls: [], codeDispatches: new Map(), pending: [], queue: [], running: false, composerPhase: 'active', removed: false, openState: 'open', openError: null, hasMore: false, loadingOlder: false, promptError: null, blank: false, subagent: null, lastAgentError: null, } diff --git a/packages/client/ui-conversation/tests/chat-view.spec.tsx b/packages/client/ui-conversation/tests/chat-view.spec.tsx index 796d8b38d2..3a0ca4f7b0 100644 --- a/packages/client/ui-conversation/tests/chat-view.spec.tsx +++ b/packages/client/ui-conversation/tests/chat-view.spec.tsx @@ -20,7 +20,8 @@ import { zh as commonZh } from '@deepseek-ai/dsh-client-locale/src/locales/zh.ts import { createChatStore } from '../src/client/stores.ts' import { ChatView } from '../src/client/chat/ChatView.tsx' import { zh } from '../src/client/locales.ts' -import { assistantActionsSeqs, deriveChatFlow, flowKeys, messageBranchSeqs } from '../src/client/chat/chat-flow.ts' +import { assistantActionsSeqs, deriveChatFlow, flowKeys, messageBranchSeqs, runningTurnStartTime } from '../src/client/chat/chat-flow.ts' +import { formatRunDuration } from '../src/client/chat/message-chrome.ts' afterEach(() => { cleanup() @@ -36,7 +37,7 @@ const SID = 's1' as SessionId function snapshotBase(): ConversationSnapshot { return { - sessionId: SID, nodes: [], turnEnds: new Map(), partial: null, runningCalls: [], codeDispatches: new Map(), + sessionId: SID, nodes: [], turnTimings: new Map(), turnEnds: new Map(), partial: null, runningCalls: [], codeDispatches: new Map(), pending: [], queue: [], running: false, composerPhase: 'active', removed: false, openState: 'open', openError: null, hasMore: false, loadingOlder: false, promptError: null, blank: false, subagent: null, lastAgentError: null, } @@ -241,6 +242,25 @@ describe('chat-flow derivation', () => { expect([...seqs].sort((a, b) => a - b)).toEqual([5, 7]) }) + it('runningTurnStartTime selects the latest turn/start without a turn/end', () => { + expect(runningTurnStartTime(new Map([ + [1, { startTime: 1_000, endTime: 5_000 }], + [2, { startTime: 6_000 }], + ]))).toBe(6_000) + expect(runningTurnStartTime(new Map([ + [1, { startTime: 1_000, endTime: 5_000 }], + [2, { startTime: 6_000, endTime: 9_000 }], + ]))).toBeNull() + }) + + it('formatRunDuration localizes units and floors partial seconds', () => { + const t = makeTranslate(zh, commonZh) + expect(formatRunDuration(0, t)).toBe('0秒') + expect(formatRunDuration(-500, t)).toBe('0秒') + expect(formatRunDuration(15_999, t)).toBe('15秒') + expect(formatRunDuration(125_000, t)).toBe('2分05秒') + }) + it('messageBranchSeqs keeps only message rows at completed transcript tails', () => { const interruptedThink: AssistantMessageNode = { kind: 'assistant', seq: 4.1, time: 4_100, turn: 1, step: 2, @@ -504,6 +524,42 @@ describe('ChatView', () => { expect(branchButtons.map(button => button.getAttribute('aria-disabled'))).toEqual(['true', null, 'true', null]) }) + it('the actions-owning assistant footer shows the turn run time', () => { + const h = makeHarness({ + nodes: [ + user(1, 'hi'), // time 1_000 + assistant(2, 'mid-turn text'), + assistant(16, 'final answer'), + toolResult(18, 'trailing'), + ], + turnTimings: new Map([[1, { startTime: 1_000, endTime: 20_000 }]]), + turnEnds: new Map([[1, 20]]), + }) + const view = render() + // The exact turn/end includes trailing tool activity after the final text. + expect(view.getAllByText(/用时 19秒/)).toHaveLength(1) + }) + + it('user and assistant message containers scope the hover-revealed time chrome', () => { + const h = makeHarness({ + nodes: [user(1, 'hi'), assistant(2, 'answer')], + turnTimings: new Map([[1, { startTime: 1_000, endTime: 2_000 }]]), + turnEnds: new Map([[1, 2]]), + }) + const view = render() + // One scope per message row; the CSS reveal keys off this attribute. + expect(view.container.querySelectorAll('[data-time-hover-root]')).toHaveLength(2) + }) + + it('the run-time label is withheld when the turn start is outside the window', () => { + const h = makeHarness({ + nodes: [assistant(16, 'tail without trigger')], + turnEnds: new Map([[1, 16]]), + }) + const view = render() + expect(view.queryByText(/用时/)).toBeNull() + }) + it('enables fork only on the finalized assistant at the completed transcript tail', () => { const h = makeHarness({ nodes: [user(1, 'question'), assistant(2, 'answer')], @@ -664,6 +720,26 @@ describe('ChatView', () => { expect(view.getByRole('status').textContent).toBe('Deep diving...') }) + it('the running clock uses turn/start, ignores steering, and stays out of the live region', () => { + const startTime = Date.now() - 125_000 + const trigger: UserMessageNode = { ...user(1, 'go'), time: startTime + 1 } + const h = makeHarness({ + nodes: [trigger], turnTimings: new Map([[1, { startTime }]]), running: true, + }) + const view = render() + // Freshly mounted (as after a reload) yet already past the 15s gate. + const status = view.getByRole('status') + expect(status.textContent).toMatch(/^Deep diving\.\.\.2分0\d秒$/) + expect(status.querySelector('[aria-hidden="true"]')).not.toBeNull() + act(() => { + h.set({ nodes: [trigger, { + kind: 'steering', messageId: 'st' as never, seq: 2, time: Date.now(), turn: 1, + content: [{ type: 'text', text: 'also' }], source: null, + }] }) + }) + expect(status.textContent).toMatch(/^Deep diving\.\.\.2分0\d秒$/) + }) + it('dispatches each tool row through the keyed slot with the tool name as entryKey', () => { const h = makeHarness({ nodes: [toolResult(3, 'a')] }) const calls: { key: string; entryKey?: string }[] = [] diff --git a/packages/client/ui-conversation/tests/diff-card.spec.tsx b/packages/client/ui-conversation/tests/diff-card.spec.tsx index f7de4e45f9..0d0fd46407 100644 --- a/packages/client/ui-conversation/tests/diff-card.spec.tsx +++ b/packages/client/ui-conversation/tests/diff-card.spec.tsx @@ -335,7 +335,7 @@ describe('DetailsPanel diff Output section', () => { function snapshot(over: Partial = {}): ConversationSnapshot { return { - sessionId: SID, nodes: [], turnEnds: new Map(), partial: null, runningCalls: [], codeDispatches: new Map(), + sessionId: SID, nodes: [], turnTimings: new Map(), turnEnds: new Map(), partial: null, runningCalls: [], codeDispatches: new Map(), pending: [], queue: [], running: false, composerPhase: 'active', removed: false, openState: 'open', openError: null, hasMore: false, loadingOlder: false, promptError: null, blank: false, subagent: null, lastAgentError: null, ...over, diff --git a/packages/client/ui-conversation/tests/gate-branch-tails.spec.tsx b/packages/client/ui-conversation/tests/gate-branch-tails.spec.tsx index 8350b318e9..85854c6e97 100644 --- a/packages/client/ui-conversation/tests/gate-branch-tails.spec.tsx +++ b/packages/client/ui-conversation/tests/gate-branch-tails.spec.tsx @@ -24,7 +24,7 @@ const SID = 's1' as SessionId function snapshotBase(): ConversationSnapshot { return { - sessionId: SID, nodes: [], turnEnds: new Map(), partial: null, runningCalls: [], codeDispatches: new Map(), + sessionId: SID, nodes: [], turnTimings: new Map(), turnEnds: new Map(), partial: null, runningCalls: [], codeDispatches: new Map(), pending: [], queue: [], running: false, composerPhase: 'active', removed: false, openState: 'open', openError: null, hasMore: false, loadingOlder: false, promptError: null, blank: false, subagent: null, lastAgentError: null, } diff --git a/packages/client/ui-conversation/tests/input-bar.spec.tsx b/packages/client/ui-conversation/tests/input-bar.spec.tsx index 09d3ddd08a..df86fdefdb 100644 --- a/packages/client/ui-conversation/tests/input-bar.spec.tsx +++ b/packages/client/ui-conversation/tests/input-bar.spec.tsx @@ -35,7 +35,7 @@ const SID = 's1' as SessionId function snapshotOf(overrides: Partial = {}): ConversationSnapshot { return { - sessionId: SID, nodes: [], turnEnds: new Map(), partial: null, runningCalls: [], codeDispatches: new Map(), + sessionId: SID, nodes: [], turnTimings: new Map(), turnEnds: new Map(), partial: null, runningCalls: [], codeDispatches: new Map(), pending: [], queue: [], running: false, composerPhase: 'active', removed: false, openState: 'open', openError: null, hasMore: false, loadingOlder: false, promptError: null, blank: false, subagent: null, lastAgentError: null, diff --git a/packages/client/ui-conversation/tests/input-matrix.spec.tsx b/packages/client/ui-conversation/tests/input-matrix.spec.tsx index 13c519e10d..be385d41d5 100644 --- a/packages/client/ui-conversation/tests/input-matrix.spec.tsx +++ b/packages/client/ui-conversation/tests/input-matrix.spec.tsx @@ -26,7 +26,7 @@ const SID = 's1' as SessionId /** Standard-props InputBar mount over a real shell (the composer-bar entry shape). */ function mountBar(shell: SessionInputShell, over?: { running?: boolean; disabled?: boolean }) { const session = createSnapshotStore({ - sessionId: SID, nodes: [], turnEnds: new Map(), partial: null, runningCalls: [], codeDispatches: new Map(), + sessionId: SID, nodes: [], turnTimings: new Map(), turnEnds: new Map(), partial: null, runningCalls: [], codeDispatches: new Map(), pending: [], queue: [], running: over?.running ?? false, composerPhase: 'active', removed: over?.disabled ?? false, openState: 'open', openError: null, hasMore: false, loadingOlder: false, promptError: null, blank: false, subagent: null, lastAgentError: null, diff --git a/packages/client/ui-conversation/tests/input-scenarios.spec.tsx b/packages/client/ui-conversation/tests/input-scenarios.spec.tsx index 180318a846..58acf3a863 100644 --- a/packages/client/ui-conversation/tests/input-scenarios.spec.tsx +++ b/packages/client/ui-conversation/tests/input-scenarios.spec.tsx @@ -112,7 +112,7 @@ async function scopedBench(register?: (slash: SlashService) => void) { actx.on('slash/input-consume-token', req => shell.consumeToken(req.guard) ? true : undefined) const wiring = shell const sessionStore = createSnapshotStore({ - sessionId, nodes: [], turnEnds: new Map(), partial: null, runningCalls: [], codeDispatches: new Map(), + sessionId, nodes: [], turnTimings: new Map(), turnEnds: new Map(), partial: null, runningCalls: [], codeDispatches: new Map(), pending: [], queue: [], running: false, composerPhase: 'active', removed: false, openState: 'open', openError: null, hasMore: false, loadingOlder: false, promptError: null, blank: false, subagent: null, lastAgentError: null, diff --git a/packages/client/ui-conversation/tests/queue-dock.spec.tsx b/packages/client/ui-conversation/tests/queue-dock.spec.tsx index 52387ae397..9a37922668 100644 --- a/packages/client/ui-conversation/tests/queue-dock.spec.tsx +++ b/packages/client/ui-conversation/tests/queue-dock.spec.tsx @@ -32,7 +32,7 @@ function row(id: string, text: string | null, preview = text ?? '[image]'): Queu function snapshotWith(queue: QueuedMessage[]): ConversationSnapshot { return { - sessionId: SID, nodes: [], turnEnds: new Map(), partial: null, runningCalls: [], codeDispatches: new Map(), + sessionId: SID, nodes: [], turnTimings: new Map(), turnEnds: new Map(), partial: null, runningCalls: [], codeDispatches: new Map(), pending: [], queue, running: true, composerPhase: 'active', removed: false, openState: 'open', openError: null, hasMore: false, loadingOlder: false, promptError: null, blank: false, subagent: null, lastAgentError: null, } diff --git a/packages/client/ui-conversation/tests/read-card.spec.tsx b/packages/client/ui-conversation/tests/read-card.spec.tsx index bf9898cff9..f8ecb8b73c 100644 --- a/packages/client/ui-conversation/tests/read-card.spec.tsx +++ b/packages/client/ui-conversation/tests/read-card.spec.tsx @@ -283,7 +283,7 @@ describe('DetailsPanel Output section (read)', () => { function snapshot(over: Partial = {}): ConversationSnapshot { return { - sessionId: SID, nodes: [], turnEnds: new Map(), partial: null, runningCalls: [], codeDispatches: new Map(), + sessionId: SID, nodes: [], turnTimings: new Map(), turnEnds: new Map(), partial: null, runningCalls: [], codeDispatches: new Map(), pending: [], queue: [], running: false, composerPhase: 'active', removed: false, openState: 'open', openError: null, hasMore: false, loadingOlder: false, promptError: null, blank: false, subagent: null, lastAgentError: null, ...over, diff --git a/packages/client/ui-conversation/tests/search-card.spec.tsx b/packages/client/ui-conversation/tests/search-card.spec.tsx index c50c308edf..cd572cc350 100644 --- a/packages/client/ui-conversation/tests/search-card.spec.tsx +++ b/packages/client/ui-conversation/tests/search-card.spec.tsx @@ -397,7 +397,7 @@ describe('DetailsPanel Output section (search)', () => { function snapshot(over: Partial = {}): ConversationSnapshot { return { - sessionId: SID, nodes: [], turnEnds: new Map(), partial: null, runningCalls: [], codeDispatches: new Map(), + sessionId: SID, nodes: [], turnTimings: new Map(), turnEnds: new Map(), partial: null, runningCalls: [], codeDispatches: new Map(), pending: [], queue: [], running: false, composerPhase: 'active', removed: false, openState: 'open', openError: null, hasMore: false, loadingOlder: false, promptError: null, blank: false, subagent: null, lastAgentError: null, ...over, diff --git a/packages/client/ui-conversation/tests/skeleton.spec.tsx b/packages/client/ui-conversation/tests/skeleton.spec.tsx index 5fc6f106b5..312ec88642 100644 --- a/packages/client/ui-conversation/tests/skeleton.spec.tsx +++ b/packages/client/ui-conversation/tests/skeleton.spec.tsx @@ -68,7 +68,7 @@ const workspaceState = (items: readonly WorkspaceView[]): WorkspaceListState => function conversationSnapshot(overrides: Partial = {}): ConversationSnapshot { return { - sessionId: SID, nodes: [], turnEnds: new Map(), partial: null, runningCalls: [], codeDispatches: new Map(), + sessionId: SID, nodes: [], turnTimings: new Map(), turnEnds: new Map(), partial: null, runningCalls: [], codeDispatches: new Map(), pending: [], queue: [], running: false, composerPhase: 'active', removed: false, openState: 'open', openError: null, hasMore: false, loadingOlder: false, promptError: null, blank: false, subagent: null, lastAgentError: null, diff --git a/packages/client/ui-conversation/tests/terminal-card.spec.tsx b/packages/client/ui-conversation/tests/terminal-card.spec.tsx index 6250fd0764..d4be802a34 100644 --- a/packages/client/ui-conversation/tests/terminal-card.spec.tsx +++ b/packages/client/ui-conversation/tests/terminal-card.spec.tsx @@ -477,7 +477,7 @@ describe('DetailsPanel Output section', () => { function snapshot(over: Partial = {}): ConversationSnapshot { return { - sessionId: SID, nodes: [], turnEnds: new Map(), partial: null, runningCalls: [], codeDispatches: new Map(), + sessionId: SID, nodes: [], turnTimings: new Map(), turnEnds: new Map(), partial: null, runningCalls: [], codeDispatches: new Map(), pending: [], queue: [], running: false, composerPhase: 'active', removed: false, openState: 'open', openError: null, hasMore: false, loadingOlder: false, promptError: null, blank: false, subagent: null, lastAgentError: null, ...over, diff --git a/packages/client/ui-conversation/tests/web-card.spec.tsx b/packages/client/ui-conversation/tests/web-card.spec.tsx index bf4228f346..8940f5dd24 100644 --- a/packages/client/ui-conversation/tests/web-card.spec.tsx +++ b/packages/client/ui-conversation/tests/web-card.spec.tsx @@ -231,7 +231,7 @@ describe('DetailsPanel web Output section', () => { function snapshot(over: Partial = {}): ConversationSnapshot { return { - sessionId: SID, nodes: [], turnEnds: new Map(), partial: null, runningCalls: [], codeDispatches: new Map(), + sessionId: SID, nodes: [], turnTimings: new Map(), turnEnds: new Map(), partial: null, runningCalls: [], codeDispatches: new Map(), pending: [], queue: [], running: false, composerPhase: 'active', removed: false, openState: 'open', openError: null, hasMore: false, loadingOlder: false, promptError: null, blank: false, subagent: null, lastAgentError: null, ...over,