Skip to content

feat: 添加猫爪HUD显示开关 - #2424

Open
for-the-zero wants to merge 6 commits into
Project-N-E-K-O:mainfrom
for-the-zero:feature/add-agent-taskhud-switch
Open

feat: 添加猫爪HUD显示开关#2424
for-the-zero wants to merge 6 commits into
Project-N-E-K-O:mainfrom
for-the-zero:feature/add-agent-taskhud-switch

Conversation

@for-the-zero

@for-the-zero for-the-zero commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

改动概述 / Summary

#2414 中提到给猫爪任务悬浮窗加一个开关,因为我想要一直挂着mcp而多一个悬浮窗有时候会比较碍事,因此在猫爪工具栏中加了一个开关,便于随时开关
这个开关为开启的时候保留原有逻辑显示hud,关闭的时候强制关闭hud

回归报告 / Regression Report

不拆分理由 / Why Not Split

测试 / Testing

npm run build没问题
npm test全passed
手动验证相关场景没问题

截图对比

  • 改动前
image
  • 改动后
image

Summary by CodeRabbit

  • 新功能
    • 在高级设置中新增“任务 HUD”显示开关,可控制任务面板的显示与隐藏。
    • 开关状态会自动保存,下次打开应用时保持上次选择。
    • 关闭任务 HUD 后,将停止相关任务状态轮询,减少不必要的界面更新。
  • 本地化
    • 为英语、西班牙语、日语、韩语、葡萄牙语、俄语及简体/繁体中文新增任务 HUD 设置文案。

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7b7360b9-dd85-41f7-b880-354f1016711e

📥 Commits

Reviewing files that changed from the base of the PR and between c9f8d43 and 04371ee.

📒 Files selected for processing (3)
  • static/app/app-agent.js
  • static/avatar/avatar-ui-popup.js
  • static/common-ui-hud.js
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • Project-N-E-K-O/N.E.K.O.-PC (manual)

Walkthrough

变更概览

新增任务 HUD 设置开关及多语言文案,持久化可见性偏好,并在关闭时停止任务轮询、隐藏 HUD。

Changes

任务 HUD 开关流程

Layer / File(s) Summary
设置项与本地化文案
static/avatar/avatar-ui-popup.js, static/locales/*.json
设置面板新增任务 HUD 开关,从 localStorage 初始化并保存状态,同时补充八种语言的 showTaskHud 文案。
开关变化与轮询控制
static/app/app-agent.js
checkAndToggleTaskHUD 接收复选框事件,同步可见性偏好;关闭时停止任务轮询并提前返回。
HUD 显示偏好约束
static/common-ui-hud.js
读取任务 HUD 可见性偏好;偏好关闭时隐藏 HUD 并跳过显示逻辑。

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

Possibly related PRs

Suggested labels: enhancement

Poem

小小开关亮起来喵
HUD 猫爪挥一挥喵
记住偏好不迷路喵
轮询听令停下来喵
多语文案也闪闪发光喵

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed 标题准确概括了本次新增猫爪HUD显示开关的主要变更,简洁且相关喵
Description check ✅ Passed 描述包含改动概述和测试信息,模板主结构齐全,未触发的必填附加章节可视为不适用喵
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.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot added the enhancement New feature or request label Jul 21, 2026
@greptile-apps

greptile-apps Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

这个 PR 在猫爪工具栏的"高级设置"子面板中新增了任务 HUD 显示开关,使用 localStorage 持久化偏好,并在 showAgentTaskHUDcheckAndToggleTaskHUD 中加入了偏好读取逻辑。

  • 偏好门控showAgentTaskHUD 新增 !isAgentTaskHudVisiblePreferenceEnabled() 检查,确保 WebSocket 自动显示路径(_doUpdateAgentTaskHUDshowAgentTaskHUD)也会被偏好拦截,而不只是手动触发路径。
  • 关闭即隐藏checkAndToggleTaskHUD 检测到开关关闭时调用 stopAgentTaskPolling(),后者内部调用 hideAgentTaskHUD(),HUD 即刻隐藏。
  • i18n:在 en/es/ja/ko/pt/ru/zh-CN/zh-TW 八个语言包中补充了 showTaskHud 文案。

Confidence Score: 5/5

可以合并喵~三条关键链路(开关关闭即隐藏、WebSocket 自动显示拦截、默认值向后兼容)均已正确实现,没有发现功能缺陷。

偏好门控已被加入 showAgentTaskHUD,确保 WebSocket 自动显示路径也受开关约束;stopAgentTaskPolling 内部调用 hideAgentTaskHUD,保证关闭时立即生效;localStorage 读取默认 true,现有用户升级后 HUD 不会意外消失。整体改动范围小、逻辑清晰、各边界条件都已覆盖喵。

Files Needing Attention: No files require special attention

Important Files Changed

Filename Overview
static/app/app-agent.js checkAndToggleTaskHUD 新增 event 参数及 localStorage 偏好读写;默认值为 true(向后兼容),关闭时调用 stopAgentTaskPolling 触发 hideAgentTaskHUD;逻辑正确。
static/avatar/avatar-ui-popup.js 新增 createTaskHudSettingsSidePanel 及"高级设置"菜单项;复选框从 localStorage 初始化,change handler 正确写入并调用 checkAndToggleTaskHUD;side panel 注册到 attachSidePanelHover 白名单。
static/common-ui-hud.js showAgentTaskHUD 新增 !isAgentTaskHudVisiblePreferenceEnabled() 门控,封堵了 WebSocket 自动显示路径;isAgentTaskHudVisiblePreferenceEnabled 默认返回 true,向后兼容。
static/locales/en.json 新增 showTaskHud 英文文案,与其他语言包格式一致。

Reviews (6): Last reviewed commit: "Merge branch 'main' of github.com:Projec..." | Re-trigger Greptile

Comment thread static/app/app-agent.js Outdated
Comment thread static/common-ui-hud.js Outdated
Comment thread static/js/agent_ui_v2.js Outdated

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a55fe7cf57

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread static/app/app-agent.js Outdated
Comment thread static/app/app-agent.js

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@static/common-ui-hud.js`:
- Around line 516-523: Update static/common-ui-hud.js lines 516-523 in
_createAgentPopupContent to find the task HUD checkbox via popup.querySelector
and default saved visibility to true unless localStorage explicitly contains
'false'; apply the same !== 'false' default in static/app/app-agent.js lines
1631-1642 for taskhudOn, and remove the unused taskhud binding from the el()
destructuring in static/js/agent_ui_v2.js line 485.
🪄 Autofix (Beta)

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: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a17d53e8-c1a5-4a26-8921-80fa14131242

📥 Commits

Reviewing files that changed from the base of the PR and between e8c1612 and a55fe7c.

📒 Files selected for processing (11)
  • static/app/app-agent.js
  • static/common-ui-hud.js
  • static/js/agent_ui_v2.js
  • static/locales/en.json
  • static/locales/es.json
  • static/locales/ja.json
  • static/locales/ko.json
  • static/locales/pt.json
  • static/locales/ru.json
  • static/locales/zh-CN.json
  • static/locales/zh-TW.json
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • Project-N-E-K-O/N.E.K.O.-PC (manual)

Comment thread static/common-ui-hud.js Outdated
for-the-zero and others added 2 commits July 21, 2026 19:09
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@wehos

wehos commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

你好,涉及到ui改动的部分,还请在pr描述中贴一张截图,谢谢~

@MingTianSang

Copy link
Copy Markdown
Contributor

已为你添加UI改动对比截图

另外,在测试中发现一个小问题

刷新后“显示猫爪任务HUD“开关的状态会丢失

  • 具体表现为刷新后“显示猫爪任务HUD“开关选中状态丢失,猫爪任务窗口正常显示但开关会变为关闭状态

刷新前:
image
刷新后:
image

@for-the-zero

Copy link
Copy Markdown
Contributor Author

刷新后“显示猫爪任务HUD“开关的状态会丢失

改了改了

@wehos

wehos commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

感觉……不是很美观啊()

@for-the-zero

Copy link
Copy Markdown
Contributor Author

( ° △ °|||) 啊这……

@wehos

wehos commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

@MingTianSang 想个别方案🤔?

@MingTianSang

Copy link
Copy Markdown
Contributor

@MingTianSang想要个别方案🤔?

放到高级设置里?毕竟这个应该属于设置而不是猫爪功能?
image

Comment thread static/common-ui-hud.js
@MingTianSang

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 04371ee91d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

…e/add-agent-taskhud-switch

# Conflicts:
#	static/avatar/avatar-ui-popup.js
@wehos

wehos commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

寄了说是 高级选项没了 @MingTianSang

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f90a61360d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread static/common-ui-hud.js
Comment on lines +854 to 856
if (isAgentHudSuppressedByGoodbye() || !isAgentTaskHudVisiblePreferenceEnabled()) {
this.hideAgentTaskHUD();
return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Allow the tutorial to override the HUD preference

When neko-agent-taskhud-visible is false and the user runs or replays the Day 6 tutorial, its show-task-hud operation calls showAgentTaskHUD(), which now immediately hides the HUD and returns. The tutorial's fallback only runs when that method is absent, and it subsequently waits for #agent-task-hud to become visible, so both task-HUD tutorial scenes lose their target. Provide a force-show path for the tutorial or temporarily override and restore the preference.

Useful? React with 👍 / 👎.

Comment thread static/app/app-agent.js
Comment on lines +1637 to +1639
if (taskhudCheckbox) {
taskhudOn = taskhudCheckbox.checked;
try { localStorage.setItem('neko-agent-taskhud-visible', taskhudOn ? 'true' : 'false'); } catch (_) {}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Read storage unless the HUD checkbox triggered the check

When the preference is changed in another same-origin app window, that window updates localStorage but the existing checkbox in this document remains stale. A later no-argument call to checkAndToggleTaskHUD()—for example from an agent-status synchronization—or a child-capability change then replaces the freshly read stored value with the stale checkbox state and writes it back, silently undoing the user's choice. Only use and persist checkbox.checked when changedCheckbox is the event source; otherwise retain the stored value (or synchronize the checkbox on storage events).

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants