Skip to content

feat(status): allow dismissing live status bubbles - #42

Merged
LRainner merged 1 commit into
masterfrom
codex/dismiss-live-status
Aug 5, 2026
Merged

feat(status): allow dismissing live status bubbles#42
LRainner merged 1 commit into
masterfrom
codex/dismiss-live-status

Conversation

@LRainner

@LRainner LRainner commented Aug 5, 2026

Copy link
Copy Markdown
Owner

概要

为实时状态气泡增加可发现、可访问的手动关闭能力,并明确关闭只作用于当前任务,而不会停用 Agent 状态联动。

主要改动

  • 在气泡右上角增加悬停显示的关闭按钮,使用 CSS 线段绘制居中的叉号
  • 关闭按钮悬浮在气泡边缘,不占用内容布局,状态圆标继续保持在原来的最右侧
  • 点击关闭后,仅隐藏对应 Agent 会话的当前任务气泡
  • 同一任务后续的工具、完成、中断等 Hook 继续被正常接收和处理,但不会重新显示已关闭的气泡
  • 下一次 UserPromptSubmit 或新的非 compact SessionStart 会解除隐藏并展示新任务
  • 多会话场景下只关闭选中的气泡;折叠状态下仅顶层卡片可交互
  • 统一为手动关闭和自动到期增加 180ms 淡出、轻微下移和缩放动画
  • 动画结束后再移除 DOM 和隐藏状态窗口,并提供超时兜底,避免 WebView 动画事件异常导致卡片残留
  • 为关闭按钮补充 Agent 相关的 aria-label 和 title

行为语义

点击关闭按钮后,LiveStatusController 会保留会话状态、事件去重和终止事件账本,只在可见状态列表中过滤当前会话。这样高频 Hook 和轮询重复事件不会让气泡立即复活,同时新任务仍可自然恢复展示。

验证

  • npm test:73 项测试通过
  • npm run build:TypeScript 检查和 Vite 生产构建通过
  • git diff --check:通过

Summary by CodeRabbit

  • 新功能

    • 状态卡片新增隐藏按钮,可单独隐藏指定会话。
    • 新的用户提示或会话开始事件可让已隐藏会话重新显示。
    • 隐藏操作仅影响对应会话,不会改变其他会话的状态。
  • 改进

    • 优化状态卡片移除动画与交互体验。
    • 增加隐藏按钮的悬停、聚焦样式及无障碍标签。
  • 测试

    • 新增会话隐藏、恢复及独立性相关场景测试。

@monkeyscan

monkeyscan Bot commented Aug 5, 2026

Copy link
Copy Markdown

PR Title: feat(status): allow dismissing live status bubbles

Commit: f295318

本次 PR 实现了“允许用户手动隐藏 live bubble”功能,涉及 4 个文件的改动:

  1. src/live-status.ts:新增 dismissedSessions Set 用于记录被用户隐藏的任务会话;dismiss() 方法将指定 sessionKey 加入该集合并触发重新渲染;getStatuses() 过滤掉已隐藏的会话;在收到新的 UserPromptSubmit 或非 compact 的 SessionStart 事件时自动清除隐藏状态,使任务重新显示。clear() 方法也同步清理 dismissedSessions。

  2. src/status.tsrender() 中将被移除的卡片通过 animateCardRemoval() 执行退场动画(添加 is-leaving 类、监听 animationend、240ms fallback 定时器确保清理),而非直接移除。卡片模板新增 <button class="status-dismiss"> 关闭按钮。stack 上新增 click 事件委托:点击 dismiss 按钮调用 controller.dismiss(sessionKey),点击卡片其他区域触发 toggleStack()#status-toggle 改为 pointer-events: none,让点击穿透到卡片层。

  3. src/styles.css:为 dismiss 按钮添加绝对定位样式(悬浮在卡片右上角、hover/focus 时显示);调整 .status-card#status-togglepointer-events,使 collapsed 状态下仅顶层卡片可交互,expanded 状态下所有卡片可交互;新增 status-card-out 退场动画。

  4. src/live-status.test.ts:补充 3 组测试,验证隐藏后任务保持隐藏、新 UserPromptSubmit 时恢复显示、仅影响指定 session。

整体设计合理:动画与状态分离(UI 层负责动画,Controller 负责状态),退场有 fallback 兜底,键盘可访问性通过 focus-visible 支持。未发现功能性缺陷或安全风险。

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

LiveStatusController 新增会话隐藏、恢复和清理逻辑。状态卡片新增隐藏按钮、无障碍标签和退出动画。测试覆盖隐藏后的事件处理、恢复条件和会话隔离。

Changes

会话状态隐藏

Layer / File(s) Summary
控制器会话隐藏状态
src/live-status.ts, src/live-status.test.ts
LiveStatusControllersessionKey 记录 dismissed 会话。getStatuses() 过滤这些会话。UserPromptSubmit 和非 compactSessionStart 会恢复会话。clear() 同步清理记录。测试覆盖隐藏、恢复和会话隔离。
状态卡片交互与退出处理
src/status.ts
状态卡片新增隐藏按钮、动态 aria-labeltitle。点击隐藏按钮后调用 controller.dismiss。失效卡片先执行退出动画,再异步移除。
状态卡片样式与动画
src/styles.css
样式调整卡片指针事件。样式新增隐藏按钮的悬停和聚焦状态。样式新增卡片离场动画。

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant 状态卡片
  participant LiveStatusController
  participant AgentEvent
  状态卡片->>LiveStatusController: dismiss(sessionKey)
  LiveStatusController-->>状态卡片: emitChange()
  LiveStatusController->>LiveStatusController: getStatuses() 过滤 dismissed 会话
  AgentEvent->>LiveStatusController: UserPromptSubmit 或非 compact SessionStart
  LiveStatusController->>LiveStatusController: 移除 dismissed 标记
  LiveStatusController-->>状态卡片: 返回可显示状态
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了本次变更的主要内容,即为实时状态气泡增加手动 dismiss 功能。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/live-status.test.ts (1)

96-116: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

补充 SessionStart 的恢复条件测试。

当前测试只验证 UserPromptSubmit 会恢复已隐藏会话。请增加非 compact SessionStart 恢复状态的测试,并增加 compact SessionStart 保持隐藏的测试。这样可保护 LiveStatusController 中的两个条件分支。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/live-status.test.ts` around lines 96 - 116, 在现有 live-status 恢复测试附近补充
LiveStatusController 的 SessionStart 场景:验证非 compact 的 SessionStart 会恢复已 dismiss
的会话,并验证 compact 的 SessionStart 仍保持隐藏;保留现有 UserPromptSubmit 流程,覆盖这两个条件分支。
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/styles.css`:
- Around line 87-99: Update the background declaration in the
.status-dismiss::before/.status-dismiss::after rule to use the lowercase
currentcolor keyword, preserving the existing styling and pseudo-element
behavior.

---

Nitpick comments:
In `@src/live-status.test.ts`:
- Around line 96-116: 在现有 live-status 恢复测试附近补充 LiveStatusController 的
SessionStart 场景:验证非 compact 的 SessionStart 会恢复已 dismiss 的会话,并验证 compact 的
SessionStart 仍保持隐藏;保留现有 UserPromptSubmit 流程,覆盖这两个条件分支。
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 43d7c3b8-857b-4484-bbbf-5a53c2eedf78

📥 Commits

Reviewing files that changed from the base of the PR and between 34b3647 and f295318.

📒 Files selected for processing (4)
  • src/live-status.test.ts
  • src/live-status.ts
  • src/status.ts
  • src/styles.css

Comment thread src/styles.css
Comment on lines +87 to +99
.status-dismiss::before,
.status-dismiss::after {
content: "";
position: absolute;
top: 50%;
left: 50%;
width: 9px;
height: 1.5px;
border-radius: 999px;
background: currentColor;
}
.status-dismiss::before { transform: translate(-50%, -50%) rotate(45deg); }
.status-dismiss::after { transform: translate(-50%, -50%) rotate(-45deg); }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

修正 Stylelint 的值关键字大小写错误。

Line 96 的 currentColor 违反 value-keyword-case。将它改为 currentcolor,以使 Stylelint 检查通过。

建议修改
-  background: currentColor;
+  background: currentcolor;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
.status-dismiss::before,
.status-dismiss::after {
content: "";
position: absolute;
top: 50%;
left: 50%;
width: 9px;
height: 1.5px;
border-radius: 999px;
background: currentColor;
}
.status-dismiss::before { transform: translate(-50%, -50%) rotate(45deg); }
.status-dismiss::after { transform: translate(-50%, -50%) rotate(-45deg); }
.status-dismiss::before,
.status-dismiss::after {
content: "";
position: absolute;
top: 50%;
left: 50%;
width: 9px;
height: 1.5px;
border-radius: 999px;
background: currentcolor;
}
.status-dismiss::before { transform: translate(-50%, -50%) rotate(45deg); }
.status-dismiss::after { transform: translate(-50%, -50%) rotate(-45deg); }
🧰 Tools
🪛 Stylelint (17.14.0)

[error] 96-96: Expected "currentColor" to be "currentcolor" (value-keyword-case)

(value-keyword-case)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/styles.css` around lines 87 - 99, Update the background declaration in
the .status-dismiss::before/.status-dismiss::after rule to use the lowercase
currentcolor keyword, preserving the existing styling and pseudo-element
behavior.

Source: Linters/SAST tools

@LRainner
LRainner merged commit 5c91d5e into master Aug 5, 2026
8 checks passed
@LRainner
LRainner deleted the codex/dismiss-live-status branch August 5, 2026 15:35
LRainner added a commit that referenced this pull request Aug 7, 2026
🤖 I have created a release *beep* *boop*
---


## [1.8.0](v1.7.0...v1.8.0)
(2026-08-07)


### Features

* **i18n:** add English and Chinese localization
([#44](#44))
([1594d3e](1594d3e))
* **status:** allow dismissing live bubbles
([#42](#42))
([5c91d5e](5c91d5e))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **新功能**
  * 支持英文和中文本地化。
  * 支持关闭实时气泡显示。

* **文档**
  * 更新 1.8.0 版本变更记录,并补充上述功能说明。

* **版本更新**
  * 产品版本已升级至 1.8.0。

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant