From 52a76a0bc4953f572dbee2bc3808a001a0ca7324 Mon Sep 17 00:00:00 2001 From: Ananovo Date: Wed, 9 Sep 2026 09:23:43 +0800 Subject: [PATCH] fix(web): clarify session summary setting copy (#1760) * fix(web): clarify session summary settings * fix(web): clarify summary emission copy --- web/src/lib/locales/en.ts | 12 +++++----- web/src/lib/locales/zh-CN.ts | 12 +++++----- web/src/routes/settings/general.tsx | 5 +++- web/src/routes/settings/index.test.tsx | 32 +++++++++++++++++++++++--- 4 files changed, 45 insertions(+), 16 deletions(-) diff --git a/web/src/lib/locales/en.ts b/web/src/lib/locales/en.ts index 7d717af6..a9d98a1d 100644 --- a/web/src/lib/locales/en.ts +++ b/web/src/lib/locales/en.ts @@ -799,12 +799,12 @@ export default { 'settings.usage.bucketDetails': '{requests} requests · {input} in · {output} out', 'settings.usage.sessions': '{count} sessions with usage', 'settings.general.description': 'Language, companion pairing, and general application preferences.', - 'settings.general.agents.title': 'Agents', - 'settings.general.agents.description': 'Hub-wide defaults for how agents behave in new and resumed sessions.', - 'settings.general.sessionSummaryContract': 'Ask agents to emit session status summary', - 'settings.general.sessionSummaryContract.desc': 'When on, Claude, Codex, OpenCode, and remote Grok sessions are asked to end each turn with an AGENT_NOTIFY_SUMMARY line for denser ready notifications. Off by default. Local Grok and Cursor are not covered yet. Applies to new/resumed sessions.', - 'settings.general.sessionSummaryInChat': 'Show session status summary in chat', - 'settings.general.sessionSummaryInChat.desc': 'When on, assistant messages show a compact status row instead of raw AGENT_NOTIFY_SUMMARY JSON. Off by default (hidden from chat and copy). Stored messages, notifications, and capture are unchanged.', + 'settings.general.sessionSummary.title': 'Session status summaries', + 'settings.general.sessionSummary.description': 'Choose whether supported agents emit a machine-readable status summary and whether it appears in chat.', + 'settings.general.sessionSummaryContract': 'Emit status summaries', + 'settings.general.sessionSummaryContract.desc': 'Off by default. When enabled, supported agents are asked to add a trailing AGENT_NOTIFY_SUMMARY line after each turn for notifications and background work records. Applies to new/resumed sessions. (Supported: Claude, Codex, OpenCode, remote Grok; not yet supported: local Grok, Cursor)', + 'settings.general.sessionSummaryInChat': 'Show status summaries in chat', + 'settings.general.sessionSummaryInChat.desc': 'Only affects display in chat and copied content; it does not affect summary generation, notifications, or background work records. When on, a status row is shown; when off, it is hidden. Stored messages remain unchanged.', 'settings.language.title': 'Language', 'settings.language.label': 'Language', 'settings.display.title': 'Display', diff --git a/web/src/lib/locales/zh-CN.ts b/web/src/lib/locales/zh-CN.ts index d2a9544e..c86004d2 100644 --- a/web/src/lib/locales/zh-CN.ts +++ b/web/src/lib/locales/zh-CN.ts @@ -798,12 +798,12 @@ export default { 'settings.usage.bucketDetails': '{requests} 次请求 · 输入 {input} · 输出 {output}', 'settings.usage.sessions': '{count} 个会话有用量记录', 'settings.general.description': '语言、伴侣应用配对和通用应用偏好。', - 'settings.general.agents.title': '智能体', - 'settings.general.agents.description': '适用于新建与恢复会话的中心级智能体默认行为。', - 'settings.general.sessionSummaryContract': '要求智能体输出会话状态摘要', - 'settings.general.sessionSummaryContract.desc': '开启后,Claude、Codex、OpenCode 以及远程 Grok 会话会在每轮结束时追加 AGENT_NOTIFY_SUMMARY 行,便于更清晰的就绪通知。默认关闭。本地 Grok 与 Cursor 暂不覆盖。对新开/恢复的会话生效。', - 'settings.general.sessionSummaryInChat': '在聊天中显示会话状态摘要', - 'settings.general.sessionSummaryInChat.desc': '开启后,助手消息以紧凑状态行显示,而不是原始 AGENT_NOTIFY_SUMMARY JSON。默认关闭(聊天与复制中隐藏)。已存储消息、通知与采集路径不受影响。', + 'settings.general.sessionSummary.title': '会话状态摘要', + 'settings.general.sessionSummary.description': '选择是否让受支持的智能体输出机器可读的状态摘要,以及是否在聊天中显示。', + 'settings.general.sessionSummaryContract': '输出状态摘要', + 'settings.general.sessionSummaryContract.desc': '默认关闭。开启后会要求受支持的智能体在每轮结束时追加 AGENT_NOTIFY_SUMMARY 行,供通知和后台工作记录使用,对新开/恢复的会话生效。(已支持:Claude、Codex、OpenCode、远程 Grok;暂不支持:本地 Grok、Cursor)', + 'settings.general.sessionSummaryInChat': '在聊天中显示状态摘要', + 'settings.general.sessionSummaryInChat.desc': '只影响聊天和复制内容中的显示,不影响摘要生成、通知或后台工作记录。开启后显示状态行,关闭后隐藏;已存储消息保持不变。', 'settings.language.title': '语言', 'settings.language.label': '语言', 'settings.display.title': '显示', diff --git a/web/src/routes/settings/general.tsx b/web/src/routes/settings/general.tsx index ac281e39..17f6cbe2 100644 --- a/web/src/routes/settings/general.tsx +++ b/web/src/routes/settings/general.tsx @@ -56,7 +56,10 @@ export default function SettingsGeneralPage() { {isOwner ? ( - + {hubSettingsQuery.data ? ( <> { renderPage() expect(screen.getByText('Companion')).toBeInTheDocument() expect(screen.getByText('Companion pairing')).toBeInTheDocument() - expect(await screen.findByRole('checkbox', { name: 'Ask agents to emit session status summary' })).toBeInTheDocument() - expect(screen.getByRole('checkbox', { name: 'Show session status summary in chat' })).toBeInTheDocument() + expect(await screen.findByRole('checkbox', { name: 'Emit status summaries' })).toBeInTheDocument() + expect(screen.getByRole('checkbox', { name: 'Show status summaries in chat' })).toBeInTheDocument() fireEvent.click(screen.getByRole('radio', { name: '简体中文' })) expect(localStorage.getItem('hapi-lang')).toBe('zh-CN') }) + it('explains and keeps summary generation separate from chat display', async () => { + updateHubSettings.mockImplementation(async (patch: { sessionSummaryContract?: boolean; sessionSummaryInChat?: boolean }) => ({ + sessionSummaryContract: patch.sessionSummaryContract ?? false, + sessionSummaryInChat: patch.sessionSummaryInChat ?? false, + })) + + renderPage() + + expect(await screen.findByRole('heading', { name: 'Session status summaries' })).toBeInTheDocument() + expect(screen.getByText('Choose whether supported agents emit a machine-readable status summary and whether it appears in chat.')).toBeInTheDocument() + expect(await screen.findByRole('checkbox', { name: 'Emit status summaries' })).toBeInTheDocument() + expect(screen.getByText('Off by default. When enabled, supported agents are asked to add a trailing AGENT_NOTIFY_SUMMARY line after each turn for notifications and background work records. Applies to new/resumed sessions. (Supported: Claude, Codex, OpenCode, remote Grok; not yet supported: local Grok, Cursor)')).toBeInTheDocument() + expect(screen.queryByRole('heading', { name: 'Chat display', level: 3 })).not.toBeInTheDocument() + expect(screen.getByText('Only affects display in chat and copied content; it does not affect summary generation, notifications, or background work records. When on, a status row is shown; when off, it is hidden. Stored messages remain unchanged.')).toBeInTheDocument() + + fireEvent.click(screen.getByRole('checkbox', { name: 'Emit status summaries' })) + await waitFor(() => { + expect(updateHubSettings).toHaveBeenCalledWith({ sessionSummaryContract: true }) + }) + + fireEvent.click(screen.getByRole('checkbox', { name: 'Show status summaries in chat' })) + await waitFor(() => { + expect(updateHubSettings).toHaveBeenCalledWith({ sessionSummaryInChat: true }) + }) + }) + it('renders compact display controls without dropdown popovers', () => { renderPage() expect(screen.getByRole('radio', { name: 'OLED Black' })).toBeInTheDocument()