Skip to content

feat: show NotifyUser progress in desktop and web and turn it on by default - #4159

Open
RealKai42 wants to merge 7 commits into
mainfrom
feat/notify-user-progress-surfaces
Open

RealKai42 wants to merge 7 commits into
mainfrom
feat/notify-user-progress-surfaces

Conversation

@RealKai42

@RealKai42 RealKai42 commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

Requirement or Bug

让 web / Desktop 用户也能看到 agent 的进展更新(NotifyUser)。第一版只做最小形态:对话里的进展行。界面部分在 MoonshotAI/kimi-code-app#835。

Bug Reproduction Steps

N/A

Root Cause

N/A

Code Changes

  • NotifyUser 新增可选 title 参数(一行标题);空标题、多行标题、非字符串标题会被拒绝,message 单独传入时保持原有行为。工具描述、系统提示词、提醒文案同步指导模型写标题,遥测新增 title_chars。
  • kap-server 声明 update_panel 能力,web / Desktop 会话因此获得该工具(此前只有 TUI 声明)。
  • notify_user 默认值改为 true,保留三种关闭方式:[experimental] notify_user = false、KIMI_CODE_EXPERIMENTAL_NOTIFY_USER=0、/experiments。
  • TUI:Updates 面板和对话卡片显示标题。
  • 文档(中英)与 changeset 同步。
  • 相比原实现,本 PR 按「第一版尽量简单」移除了 SessionActivity.latest_update、subagent.update durable 事件和 task.updates,因此不新增任何 durable 记录类型:wire / state manifest、transcript、klient、vis、node-sdk 源码均无变化。

Behavior Changes and Affected Users

Behavior Before After Who relies on the old behavior Escape hatch
NotifyUser 可用性 默认关闭,需手动开启 默认开启 TUI、web、Desktop 的新会话 [experimental] notify_user = false / KIMI_CODE_EXPERIMENTAL_NOTIFY_USER=0 / /experiments
NotifyUser 参数 仅 message 新增可选 title,含单行校验 新会话中的模型(含第三方 provider) 无(message 单独传入保持可用)
kap-server 能力声明 未声明 update_panel,web / Desktop 会话没有该工具 声明后新会话可用 web / Desktop 用户 同上
提示词与工具描述 只要求写 message 要求 title + message 两段结构 所有使用 NotifyUser 的模型 无
TUI 展示 面板只显示 message 面板和对话卡片增加标题 TUI 用户 无
ACP / Zed、VS Code 扩展 不声明 update_panel 无变化 — —
会话列表、状态行、子 agent 卡片 无进展展示 无变化(原实现中的 latest_update、subagent.update、task.updates 已按简化方向移除) — —

受影响模块与测试覆盖:

  • agent-core-v2:notify-user.test.ts 覆盖 title schema、空标题/多行标题/非字符串标题校验、message 单独传入的兼容行为、默认开启与关闭、宿主能力、遥测。
  • node-sdk:sdk-rpc-client-v2.test.ts、session-prompt-events.test.ts 中的 NotifyUser 调用带 title。
  • TUI:notify-panel.test.ts、tool-call.test.ts、controllers/notify.test.ts 覆盖标题展示。
  • 冒烟(假模型):默认开 / env=0 / 配置 false 三种配置下工具与提示词的有无;会话 JSON 与 v1 / v2 列表均无 latest_update;transcript 无 task.updates;wire log 无 subagent.update;服务重启后恢复正常。
  • 真实 Chrome + Vite + kap-server:3 条进展行的展示与展开、工作指示器无进展文案、子 agent 进展不进主对话、刷新后仍正常显示。

合并顺序:本 PR → app #835(submodule 指向本 PR 合并后的 main 提交)→ 发布前从 code-app main 同步 dist-web(否则 kimi web 只显示通用工具卡片)。

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue (external PRs: issue must have a maintainer's /approve).
  • I have added tests that prove my feature works.
  • The behavior-change table above is complete, and every removed behavior or flipped default is named in the changeset and either has an escape hatch or was explicitly approved by a maintainer in this PR.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

Give NotifyUser a one-line title, report the latest update on the
session status, and forward subagent updates to the parent so GUI
clients can show them on subagent cards.
Copilot AI balanced review requested due to automatic review settings October 10, 2026 05:36
@changeset-bot

changeset-bot Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ed8f468

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-10T13:52:24.992120Z ed8f468 Manual request
🔒 Security Review ✅ Completed 2026-10-10T05:41:16.843445Z 9a0e423 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@pkg-pr-new

pkg-pr-new Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@ed8f468
npx https://pkg.pr.new/@moonshot-ai/kimi-code@ed8f468

commit: ed8f468

Copilot AI 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.

🟡 Changes recommended

打包 Web 资源未同步,且一行标题约束与 changeset 的兼容性说明仍不完整。

3 open findings
What changed in this PR

该 PR 扩展实验性 NotifyUser,让进展标题、会话最新状态及子 Agent 更新可供 TUI、desktop 和 Web 使用。

Changes:

  • 为 NotifyUser 增加必填标题,并更新 TUI 展示。
  • 新增 latest_update、subagent.update 和 transcript 任务更新。
  • 补充协议、双语文档、changeset 与端到端测试。
File Description
.changeset/​notify-user-titles-gui.md 添加用户可见变更记录。
apps/​kimi-code/​src/​tui/​components/​chrome/​notify-panel.ts 展示及折叠预览更新标题。
apps/​kimi-code/​src/​tui/​components/​messages/​tool-call.ts 使用标题作为工具卡片摘要。
apps/​kimi-code/​src/​tui/​controllers/​notify.ts 将标题传递到更新面板。
apps/​kimi-code/​test/​tui/​components/​messages/​tool-call.test.ts 测试标题卡片。
apps/​kimi-code/​test/​tui/​components/​panels/​notify-panel.test.ts 测试面板标题渲染。
apps/​kimi-code/​test/​tui/​controllers/​notify.test.ts 测试标题采集及回退。
docs/​en/​reference/​server-api.md 记录新增会话及事件字段。
docs/​en/​reference/​tools.md 更新英文工具说明。
docs/​zh/​reference/​server-api.md 同步中文服务端 API 文档。
docs/​zh/​reference/​tools.md 同步中文工具说明。
packages/​agent-core-v2/​docs/​state-manifest.d.ts 更新活动状态清单。
packages/​agent-core-v2/​docs/​wire-manifest.d.ts 登记 durable 更新事件。
packages/​agent-core-v2/​src/​app/​agentProfileCatalog/​profile-shared.ts 更新模型使用指导。
packages/​agent-core-v2/​src/​app/​telemetry/​events.ts 增加标题长度指标。
packages/​agent-core-v2/​src/​events.ts 扩展 Agent 事件联合类型。
packages/​agent-core-v2/​src/​features/​notify/​flag.ts 更新实验开关描述。
packages/​agent-core-v2/​src/​features/​notify/​notifyUserNudge.ts 更新进展提醒文案。
packages/​agent-core-v2/​src/​features/​notify/​subagentUpdate.ts 定义子 Agent 更新事件。
packages/​agent-core-v2/​src/​features/​notify/​tools/​notify-user/​notify-user.md 更新工具提示词。
packages/​agent-core-v2/​src/​features/​notify/​tools/​notify-user/​notify-user.ts 新增标题输入契约。
packages/​agent-core-v2/​src/​features/​notify/​tools/​notify-user/​notifyUserTool.ts 校验标题并转发子 Agent 更新。
packages/​agent-core-v2/​src/​index.ts 导出新事件。
packages/​agent-core-v2/​src/​session/​sessionActivity/​sessionActivity.ts 扩展活动状态类型。
packages/​agent-core-v2/​src/​session/​sessionActivity/​sessionActivityService.ts 跟踪及清除最新进展。
packages/​agent-core-v2/​test/​features/​notify/​tools/​notify-user.test.ts 覆盖标题与父 Agent 转发。
packages/​agent-core-v2/​test/​index.test.ts 验证新 wire 记录类型。
packages/​agent-core-v2/​test/​session/​sessionActivity/​sessionActivityService.test.ts 覆盖最新进展生命周期。
packages/​kap-server/​src/​protocol/​events-zod.ts 增加事件 wire schema。
packages/​kap-server/​src/​protocol/​session.ts 定义 latest_update wire 结构。
packages/​kap-server/​src/​routes/​sessions.ts 在 v1 会话中投影最新进展。
packages/​kap-server/​src/​routes/​v2/​sessions.ts 在 v2 活动状态中投影进展。
packages/​kap-server/​src/​services/​transcript/​coreEventMap.ts 投影子 Agent 进展到任务。
packages/​kap-server/​src/​start.ts 声明更新面板能力。
packages/​kap-server/​src/​transport/​ws/​v1/​events.ts 扩展工作状态事件类型。
packages/​kap-server/​src/​transport/​ws/​v1/​sessionEventBroadcaster.ts 广播进展并接入 transcript。
packages/​kap-server/​test/​services/​transcript.test.ts 测试实时任务进展。
packages/​kap-server/​test/​sessionEventBroadcaster.test.ts 测试进展广播和清除。
packages/​kap-server/​test/​sessions.test.ts 测试能力声明及 REST 输出。
packages/​klient/​src/​contract/​session/​activity.ts 扩展客户端活动契约。
packages/​node-sdk/​test/​sdk-rpc-client-v2.test.ts 更新 NotifyUser 调用参数。
packages/​node-sdk/​test/​session-event-types.test.ts 验证新公开事件类型。
packages/​node-sdk/​test/​session-prompt-events.test.ts 更新提示事件测试数据。
packages/​transcript/​src/​contract/​schema.ts 扩展任务 schema。
packages/​transcript/​src/​history/​foldFacts.ts 从历史记录恢复进展。
packages/​transcript/​src/​model/​task.ts 定义任务更新及数量上限。
packages/​transcript/​src/​ops/​apply.ts 比较任务更新内容。
packages/​transcript/​test/​layers.test.ts 测试历史折叠和上限。
packages/​transcript/​test/​store.test.ts 测试更新 upsert 幂等性。

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +19 to +24
title: z
.string()
.min(1)
.describe(
"A one-line headline the user can take in at a glance: the conclusion or current phase, in the user's language, under ~60 characters, plain text.",
),
skillDirs: opts.skillDirs,
displayName: opts.hostIdentity.displayName,
replyStyleGuide: opts.hostIdentity.replyStyleGuide,
uiCapabilities: [NOTIFY_USER_UI_CAPABILITY],
Comment thread .changeset/notify-user-titles-gui.md Outdated
"@moonshot-ai/kimi-code": patch
---

Give experimental NotifyUser updates a one-line title that the TUI Updates panel shows above the message, and offer NotifyUser in `kimi web` sessions; enable with `KIMI_CODE_EXPERIMENTAL_NOTIFY_USER=1` or `[experimental] notify_user = true`.

@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: 9a0e423688

ℹ️ 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".

skillDirs: opts.skillDirs,
displayName: opts.hostIdentity.displayName,
replyStyleGuide: opts.hostIdentity.replyStyleGuide,
uiCapabilities: [NOTIFY_USER_UI_CAPABILITY],

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 Ship the matching web bundle with this capability

When an opt-in user starts the bundled kimi web, this line tells the engine that the host supports progress updates, but the commit contains no apps/kimi-code/dist-web changes and explicitly defers the matching code-app UI sync. The released web client therefore receives a tool that reports updates as displayed without shipping the new progress rows, status line, session subtitles, or subagent-card UI documented by this change; sync and commit the built web bundle before advertising the capability.

AGENTS.md reference: AGENTS.md:L17-L18

Useful? React with 👍 / 👎.

Comment thread .changeset/notify-user-titles-gui.md Outdated
"@moonshot-ai/kimi-code": patch
---

Give experimental NotifyUser updates a one-line title that the TUI Updates panel shows above the message, and offer NotifyUser in `kimi web` sessions; enable with `KIMI_CODE_EXPERIMENTAL_NOTIFY_USER=1` or `[experimental] notify_user = true`.

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 Name the loss of message-only calls in the changeset

For enabled sessions or hosts that still produce the previously valid { message } input, the new schema requires title and rejects that call, but this changeset only says updates gain a title and does not disclose that message-only calls stop working. Disabling the experimental feature removes NotifyUser altogether rather than preserving the old behavior, so the release note should name this loss and the change needs either a backward-compatible fallback or explicit maintainer sign-off.

AGENTS.md reference: AGENTS.md:L102-L104

Useful? React with 👍 / 👎.

Comment thread packages/kap-server/src/services/transcript/coreEventMap.ts Outdated
Comment thread packages/agent-core-v2/src/features/notify/tools/notify-user/notifyUserTool.ts Outdated
Flip the notify_user flag default to true; the flag stays as the opt-out
(`[experimental] notify_user = false` or KIMI_CODE_EXPERIMENTAL_NOTIFY_USER=0).
Register the new subagent.update wire record in the vis renderers and
record-type union so the manifest coverage test passes.
@RealKai42 RealKai42 changed the title feat: show NotifyUser progress in desktop and web feat: show NotifyUser progress in desktop and web and turn it on by default Oct 10, 2026

@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: 541559c8ef

ℹ️ 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 packages/kap-server/src/start.ts
Comment thread packages/kap-server/src/start.ts
Comment on lines +15 to +16
.string()
.min(1)

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 Reject line breaks in progress titles

If the model emits a title containing an internal newline, this schema accepts it because it only requires one character, and the runtime check only rejects an all-whitespace title. The TUI's collapsed panel later returns that title verbatim from stubPreviewText() and embeds it into a single rendered row, so a supposedly one-line title can split the row and corrupt the panel framing; enforce the documented single-line constraint in the schema.

Useful? React with 👍 / 👎.

@RealKai42

Copy link
Copy Markdown
Collaborator Author

@codex

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: ed8f4681ba

ℹ️ 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".

This branch has not been deployed

No deployments
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.

2 participants