fix(web): clarify session summary setting copy (#1760)

* fix(web): clarify session summary settings

* fix(web): clarify summary emission copy
This commit is contained in:
Ananovo
2026-09-09 09:23:43 +08:00
committed by GitHub
parent 17ee052d9a
commit 52a76a0bc4
4 changed files with 45 additions and 16 deletions
+6 -6
View File
@@ -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',
+6 -6
View File
@@ -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': '显示',
+4 -1
View File
@@ -56,7 +56,10 @@ export default function SettingsGeneralPage() {
<SettingsChoiceGroup hideLabel label={t('settings.language.label')} value={locale} options={locales} onChange={setLocale} />
</SettingsSection>
{isOwner ? (
<SettingsSection title={t('settings.general.agents.title')} description={t('settings.general.agents.description')}>
<SettingsSection
title={t('settings.general.sessionSummary.title')}
description={t('settings.general.sessionSummary.description')}
>
{hubSettingsQuery.data ? (
<>
<SettingsSwitch
+29 -3
View File
@@ -1,5 +1,5 @@
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { fireEvent, render, screen } from '@testing-library/react'
import { fireEvent, render, screen, waitFor } from '@testing-library/react'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { I18nProvider } from '@/lib/i18n-context'
import SettingsHubPage from './index'
@@ -245,12 +245,38 @@ describe('responsive settings pages', () => {
renderPage(<SettingsGeneralPage />)
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(<SettingsGeneralPage />)
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(<SettingsDisplayPage />)
expect(screen.getByRole('radio', { name: 'OLED Black' })).toBeInTheDocument()