mirror of
https://github.com/wu736139669/hapi.git
synced 2026-12-04 06:57:55 +00:00
feat(cli): Cursor emits AGENT_NOTIFY_SUMMARY when status-summary toggle is on (#2354)
* feat(cli): Cursor emits AGENT_NOTIFY_SUMMARY via rules overlay When Emit status summaries is on, install a transient workspace .cursor/rules overlay for Cursor ACP sessions and clean it up on teardown, closing the flavor hole left after #1376. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): harden Cursor notify-rule overlay ownership and exclude Address review on the emit overlay: clear ownership state under lock, refresh crash-recovery snapshots after user replacement, fall back to an alternate rule filename when the primary path is tracked, and lease .git/info/exclude so git add -A cannot stage the transient rule. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): path-scope notify overlay ownership and reap excludes Refresh restore snapshots on live user replacements, key ownership by selected rule path, and prune dead PID-stamped .git/info/exclude leases left by crashed Cursor sessions. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): harden Cursor notify overlay against symlink and path traps Refuse rule writes through symlinks, canonicalize workspace paths for ownership, escape literal Git exclude patterns, and qualify settings copy as Cursor ACP. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): preserve unreadable rules and file modes in notify overlay Skip install when an existing rule cannot be backed up, restore original permission bits on cleanup, and stop retrying ownership-lock callback failures as lock contention. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): keep notify overlay restore snapshot on unreadable cleanup When teardown cannot read the generated rule, leave the file alone but retain the private ownership snapshot so a later session can restore the user's original content; write state.json as 0600. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): restore notify overlay snapshot even if install never wrote Last-owner cleanup now restores from the shared snapshot whenever the on-disk rule is still HAPI-owned, including handles that registered then failed before writing the generated rule. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): write notify overlay ownership state atomically Replace in-place state.json writes with temp+rename so a partial failure cannot destroy the only backup of a user rule, and harden the failed- install recovery test to actually chmod the exclude file. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): fail closed on abandoned notify overlay locks Publish pid+token via link(2) like the MCP overlay so a crashed holder leaves an identifiable lock, and surface an actionable rm path instead of silently spinning for five seconds. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): retry notify overlay lock when holder already released After link EEXIST, a missing lock means the contender freed it before our owner read - retry acquire instead of misreporting the path as abandoned. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): treat notify lock ENOENT during owner read as retry Distinguish missing vs invalid lock contents so a holder that releases between existsSync and readFile is not misclassified as abandoned. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): recreate notify overlay stateDir under the ownership lock Last-owner cleanup no longer rmdirs stateDir, and install mkdir+write runs inside the lock so a waiting installer cannot hit ENOENT on state.json. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -929,7 +929,7 @@ export default {
|
||||
'settings.general.sessionSummary.title': 'Session status summaries',
|
||||
'settings.general.sessionSummary.description': 'Choose whether supported agents emit status summaries and whether they appear 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.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, Cursor ACP; not yet supported: local Grok)',
|
||||
'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',
|
||||
|
||||
@@ -866,7 +866,7 @@ export default {
|
||||
'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.sessionSummaryContract.desc': 'По умолчанию выключено. При включении поддерживаемых агентов просят добавлять после каждого хода завершающую строку AGENT_NOTIFY_SUMMARY для уведомлений и записей о фоновой работе. Применяется к новым/возобновлённым сессиям. (Поддерживаются: Claude, Codex, OpenCode, удалённый Grok, Cursor ACP; пока не поддерживаются: локальный Grok)',
|
||||
'settings.general.sessionSummaryInChat': 'Показывать сводки статуса в чате',
|
||||
'settings.general.sessionSummaryInChat.desc': 'Влияет только на отображение в чате и скопированном содержимом; не влияет на формирование сводок, уведомления или записи о фоновой работе. При включении показывается строка статуса, при выключении она скрыта. Сохранённые сообщения не изменяются.',
|
||||
'settings.language.title': 'Язык',
|
||||
|
||||
@@ -927,7 +927,7 @@ export default {
|
||||
'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.sessionSummaryContract.desc': '默认关闭。开启后会要求受支持的智能体在每轮结束时追加 AGENT_NOTIFY_SUMMARY 行,供通知和后台工作记录使用,对新开/恢复的会话生效。(已支持:Claude、Codex、OpenCode、远程 Grok、Cursor ACP;暂不支持:本地 Grok)',
|
||||
'settings.general.sessionSummaryInChat': '在聊天中显示状态摘要',
|
||||
'settings.general.sessionSummaryInChat.desc': '只影响聊天和复制内容中的显示,不影响摘要生成、通知或后台工作记录。开启后显示状态行,关闭后隐藏;已存储消息保持不变。',
|
||||
'settings.language.title': '语言',
|
||||
|
||||
@@ -289,7 +289,7 @@ describe('responsive settings pages', () => {
|
||||
expect(await screen.findByRole('heading', { name: 'Session status summaries' })).toBeInTheDocument()
|
||||
expect(screen.getByText('Choose whether supported agents emit status summaries and whether they appear 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.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, Cursor ACP; not yet supported: local Grok)')).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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user