diff --git a/components/ChatWindow-transcript-group-row.tsx b/components/ChatWindow-transcript-group-row.tsx index d99bcc464..8d78ef59e 100644 --- a/components/ChatWindow-transcript-group-row.tsx +++ b/components/ChatWindow-transcript-group-row.tsx @@ -35,7 +35,9 @@ function withAssistantBlocks( function ProcessDetailsGroup({ messageCount, toolCallCount, children }: { messageCount: number; toolCallCount: number; children: () => ReactNode }) { const { t, tn } = useI18n(); const [expanded, setExpanded] = useState(false); - const parts = [t("chatWindow.processDetails"), tn("chatWindow.messageCount", messageCount)]; + // A finished turn folds to one summary row ("Completed N steps · M tool + // calls"); the final reply stays expanded above it. Live turns stay flat. + const parts = [tn("chatWindow.completedSteps", messageCount)]; if (toolCallCount > 0) parts.push(tn("chatWindow.toolCallCount", toolCallCount)); return ( diff --git a/components/ChatWindow.activity.test.mjs b/components/ChatWindow.activity.test.mjs index fba533f93..1eabff18a 100644 --- a/components/ChatWindow.activity.test.mjs +++ b/components/ChatWindow.activity.test.mjs @@ -35,3 +35,30 @@ test("folded activity keeps tool calls from separate messages as separate entrie assert.deepEqual(calls[1].options.sourceBlockIndices, [0, 1, 2]); assert.equal(new Set(calls.map(({ idx, options }) => `${options.keyPrefix}-${idx}`)).size, calls.length); }); + +test("a finished turn folds its activity into one Completed N steps row", async () => { + const React = (await import("react")).default; + const { renderToStaticMarkup } = await import("react-dom/server"); + const { renderTranscriptGroupRow } = await import("./ChatWindow-transcript-group-row.tsx"); + const { planTranscriptRows } = await import("../lib/chat-transcript-plan.ts"); + const messages = [ + { role: "user", content: "go" }, + assistant([call("a")]), + assistant([{ type: "text", text: "done" }]), + ]; + const rows = planTranscriptRows(messages, {}); + const group = rows.find((row) => row.kind === "group"); + assert.ok(group, "a turn with tool activity must plan as a group row"); + const rendered = renderTranscriptGroupRow(group, { + messages, + renderMessage: (idx) => React.createElement("div", { key: `msg-${idx}` }, `msg-${idx}`), + flat: false, + messageRefs: { current: [] }, + visibleRefIndexByMessage: new Map(), + }); + const html = renderToStaticMarkup(React.createElement(React.Fragment, null, ...rendered)); + // The final reply stays visible; the activity folds to one summary row. + assert.match(html, /msg-2/, "the final reply must stay expanded"); + assert.match(html, /Completed \d+ steps?|chatWindow\.completedSteps/, `the folded row must read as completed steps, got: ${html.slice(0, 300)}`); + assert.match(html, /tool calls?|chatWindow\.toolCallCount/, "the folded row must count tool calls"); +}); diff --git a/lib/i18n/locales/en.json b/lib/i18n/locales/en.json index b7bda9c71..85d654ac8 100644 --- a/lib/i18n/locales/en.json +++ b/lib/i18n/locales/en.json @@ -597,6 +597,8 @@ "chatWindow.retry": "Try again", "chatWindow.loadingSession": "Loading session...", "chatWindow.messageCount.one": "{count} message", + "chatWindow.completedSteps.one": "Completed {count} step", + "chatWindow.completedSteps.other": "Completed {count} steps", "chatWindow.messageCount.other": "{count} messages", "chatWindow.processDetails": "Process details", "chatWindow.runningCommand": "Running command...", diff --git a/lib/i18n/locales/ja.json b/lib/i18n/locales/ja.json index f62f7bcb9..5b47c6cce 100644 --- a/lib/i18n/locales/ja.json +++ b/lib/i18n/locales/ja.json @@ -581,6 +581,8 @@ "chatWindow.retry": "再試行", "chatWindow.loadingSession": "セッションを読み込み中...", "chatWindow.messageCount.one": "{count} 件のメッセージ", + "chatWindow.completedSteps.one": "{count} ステップ完了", + "chatWindow.completedSteps.other": "{count} ステップ完了", "chatWindow.messageCount.other": "{count} 件のメッセージ", "chatWindow.processDetails": "プロセス詳細", "chatWindow.runningCommand": "コマンドを実行中...", diff --git a/lib/i18n/locales/zh-CN.json b/lib/i18n/locales/zh-CN.json index ac9dc1fbe..fd1de6f0e 100644 --- a/lib/i18n/locales/zh-CN.json +++ b/lib/i18n/locales/zh-CN.json @@ -581,6 +581,8 @@ "chatWindow.retry": "重试", "chatWindow.loadingSession": "正在加载会话...", "chatWindow.messageCount.one": "{count} 条消息", + "chatWindow.completedSteps.one": "已完成 {count} 步", + "chatWindow.completedSteps.other": "已完成 {count} 步", "chatWindow.messageCount.other": "{count} 条消息", "chatWindow.processDetails": "过程详情", "chatWindow.runningCommand": "正在运行命令...", diff --git a/lib/i18n/locales/zh-TW.json b/lib/i18n/locales/zh-TW.json index 530707dd6..c7bf50425 100644 --- a/lib/i18n/locales/zh-TW.json +++ b/lib/i18n/locales/zh-TW.json @@ -597,6 +597,8 @@ "chatWindow.retry": "再試一次", "chatWindow.loadingSession": "正在載入對話...", "chatWindow.messageCount.one": "{count} 則訊息", + "chatWindow.completedSteps.one": "已完成 {count} 步", + "chatWindow.completedSteps.other": "已完成 {count} 步", "chatWindow.messageCount.other": "{count} 則訊息", "chatWindow.processDetails": "行程詳細資訊", "chatWindow.runningCommand": "正在執行指令...",