Skip to content

feat(tui): sweep running titles toward text and add KIMI_CODE_TUI_ANIMATION_FPS - #4843

Merged
Grapedge merged 3 commits into
mainfrom
group-anim
Nov 12, 2026
Merged

Grapedge merged 3 commits into
mainfrom
group-anim

Conversation

@Grapedge

@Grapedge Grapedge commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Requirement or Bug

全屏模式下,折叠分组的摘要标题和 Thinking 标题在运行时有一道扫光。暗色主题下光带朝背景色走,把字压暗,看着不舒服。这个 PR 让光带在两种主题下都朝正文色走,并新增一个环境变量来调整动画帧率。

Bug Reproduction Steps

N/A

Root Cause

N/A

Code Changes

扫光改成从运行中底色扫到正文色 text。暗色主题的底色是 textDim;亮色主题是背景色往 text 走 60%,不到 4.5:1 时继续往 text 走,白底上是 #767676,对比度 4.54:1。分组结束后标题照旧淡回 textDim。节奏改成以分组开始为锚,600ms 后第一次扫,之后每 4s 扫一次,每次 1.6s。光带按标题实际画出的宽度走,展开的多行标题也会扫到每一行。

KIMI_CODE_TUI_ANIMATION_FPS 设置共享动画时钟的帧率,取 1 到 60,不设时仍是 120ms 一帧。pi-tui 为此新增了 TuiBase.setAnimationFrameRate,只收 1 到 60 的整数。

决策 选择 没选 理由
光带方向 朝 text 走 朝背景色走 暗色下朝背景色走会把字压暗
亮色底色 背景色往 text 走 60%,不到 4.5:1 时继续加深 textDim;走 50% textDim 离 text 太近,扫光几乎看不出来;50% 在白底只有 3.32:1,不到亮色文字 4.5:1 的要求
帧率 新环境变量,默认不变 调高默认帧率 低配机器的 CPU 开销
帧率接口 整数 FPS,1 到 60 毫秒间隔 限制直接写在接口上,过小、过大的间隔传不进来

建议先看 running-title.ts,它负责颜色和光带位置。再看 packages/pi-tui/src/animation-frame.ts 里帧率改变后的调度,以及 src/tui/config.ts 里的环境变量解析。其余是接线、常量、文档和测试。

Screenshots / Recordings

画面来自真实运行的 TUI 抓帧,左边是 main,右边是本 PR。

静态对比,光带扫到标题中间时的一帧

动图对比,8 秒内的两轮扫光

Behavior Changes and Affected Users

Behavior Before After Who relies on the old behavior Escape hatch
运行中标题的扫光(暗色) 光带朝背景色走,把字压暗 从 textDim 提亮到 text 没有正式版用户,扫光还没进正式版(2.5.3 没有),只在 canary 出现过 无
运行中标题的扫光(亮色) 静止为 textDim,光带变浅 静止为 #767676,光带加深到 text 同上 无
扫光节奏 连续循环 600ms 后开始,每 4s 扫一次 同上 无
动画帧率 固定 120ms 一帧 不设变量时不变,设了是 1000/fps 毫秒一帧 无 不设这个变量
非法的 KIMI_CODE_TUI_ANIMATION_FPS 不读这个变量 忽略,并在启动提示里说明 无 删掉这个变量

apps/kimi-code/src/cli/run-shell.ts 在契约文件清单里。它只在交互式 TUI 启动时多读一个环境变量,print 模式走 runPrompt,不受影响。CLI 参数、无头输出和已有的环境变量都没有变。

测试覆盖:

  • 扫光在 transcript-container.test.ts 和 thinking.test.ts。
  • 环境变量在 config.test.ts、run-shell.test.ts 和 kimi-tui-startup.test.ts。
  • 帧率在 packages/pi-tui/test/tui-render.test.ts。
验证
  • pi-tui 测试 1150 个通过,1 个跳过。apps/kimi-code 的 test/tui 和 run-shell 测试共 173 个文件、3706 个用例通过,tsc 没有报错。
  • 在 tmux 里用本地 mock 模型跑真实 TUI,逐字取色。暗色底色 #888888,峰值 #E0E0E0。亮色底色 #767676,峰值 #1A1A1A,结束后是 #454545。KIMI_CODE_TUI_ANIMATION_FPS=60 时光带每帧约移动半列;设为 abc 时启动提示里会出现说明。

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.

Copilot AI balanced review requested due to automatic review settings November 11, 2026 13:50
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T15:19:47.833373Z 0404d2b New commits
ℹ️ 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.

@changeset-bot

changeset-bot Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0404d2b

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

This PR includes changesets to release 2 packages
Name Type
@moonshot-ai/pi-tui Patch
@moonshot-ai/kimi-code Patch

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

@pkg-pr-new

pkg-pr-new Bot commented Nov 11, 2026 •

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

commit: 0404d2b

@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: 09ad1d1247

ℹ️ 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 packages/pi-tui/src/tui.ts Resolved
Comment thread docs/en/configuration/env-vars.md Resolved
Comment thread packages/pi-tui/src/animation-frame.ts Resolved

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

Unresolved issues can make custom light-theme titles fall below required contrast and cause prolonged animation stalls when frame intervals change rapidly.

2 open issues
What changed in this PR

本 PR 调整 TUI 运行中标题的扫光效果,使暗色和亮色主题都朝正文色变化,并允许用户配置共享动画时钟的帧率。

Changes:

  • 调整分组和 Thinking 标题的颜色、扫光节奏及宽度计算,支持多行标题。
  • 新增 KIMI_CODE_TUI_ANIMATION_FPS,支持 1–60 的整数,未设置时保留每帧 120ms。
  • 补充动画调度、配置和启动接线测试,以及双语文档和 changeset。
File Description
packages/​pi-tui/​UPSTREAM.md 说明可变帧间隔的调度契约。
packages/​pi-tui/​test/​tui-render.test.ts 测试帧间隔切换和非法值。
packages/​pi-tui/​src/​tui.ts 暴露帧间隔设置方法。
packages/​pi-tui/​src/​animation-frame.ts 支持运行时调整动画调度间隔。
docs/​zh/​configuration/​env-vars.md 添加环境变量中文说明。
docs/​en/​configuration/​env-vars.md 添加环境变量英文说明。
apps/​kimi-code/​test/​tui/​kimi-tui-startup.test.ts 验证启动帧间隔配置生效。
apps/​kimi-code/​test/​tui/​config.test.ts 覆盖帧率解析及无效输入。
apps/​kimi-code/​test/​tui/​components/​messages/​transcript-container.test.ts 覆盖标题颜色、节奏、多行扫光和淡出。
apps/​kimi-code/​test/​tui/​components/​messages/​thinking.test.ts 验证 Thinking 标题的扫光和亮色底色。
apps/​kimi-code/​test/​cli/​run-shell.test.ts 验证帧间隔传递和启动警告。
apps/​kimi-code/​src/​tui/​types.ts 添加帧间隔选项。
apps/​kimi-code/​src/​tui/​tui-state.ts 将配置应用到渲染器。
apps/​kimi-code/​src/​tui/​kimi-tui.ts 传递启动帧间隔配置。
apps/​kimi-code/​src/​tui/​constant/​rendering.ts 定义扫光参数和帧率上限。
apps/​kimi-code/​src/​tui/​config.ts 解析帧率环境变量并生成警告。
apps/​kimi-code/​src/​tui/​components/​messages/​transcript-group.ts 按分组工作状态初始化扫光。
apps/​kimi-code/​src/​tui/​components/​messages/​thinking.ts 初始化运行态 Thinking 扫光。
apps/​kimi-code/​src/​tui/​components/​messages/​running-title.ts 实现新颜色、周期和显示宽度计算。
apps/​kimi-code/​src/​cli/​run-shell.ts 读取帧率配置并合并启动提示。
.changeset/​tui-animation-fps.md 记录 CLI 帧率配置功能。
.changeset/​pi-tui-animation-frame-interval.md 记录 pi-tui 帧间隔接口。

Review effort: Balanced

Comment thread packages/pi-tui/src/animation-frame.ts Resolved

@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: 3bafe08dd0

ℹ️ 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 packages/pi-tui/src/animation-frame.ts Resolved
Comment thread .changeset/tui-animation-fps.md Resolved
Comment thread packages/pi-tui/src/animation-frame.ts Resolved
@Grapedge
Grapedge merged commit 1ec24a5 into main Nov 12, 2026
28 of 29 checks passed
@Grapedge
Grapedge deleted the group-anim branch November 12, 2026 03:03
Grapedge added a commit that referenced this pull request Nov 12, 2026
Grapedge added a commit that referenced this pull request Nov 12, 2026
* fix(agent-core-v2): truncate oversized skill content (#4834)

* fix(kap-server): bind the main agent when a session is created (#4839)

* fix(kap-server): bind the main agent when a session is created

* fix(kap-server): reject a profile on prompt submissions

* fix(kap-server): reject a profile change through the session profile

* fix(kap-server): wait for model configuration before binding a new session

* fix(agent-core-v2): deduplicate restored task notifications (#4836)

* fix(agent-core-v2): deduplicate restored task notifications

* chore: add notification replay fix changeset

* fix(agent-core-v2): preserve task notifications after prompt-only crashes

* fix(agent-core-v2): complete prompts before ending turns

* test: align lifecycle snapshots with prompt completion order

* fix(agent-core-v2): settle all prompts during turn finalization

* fix(kap-server): drop reserved metadata keys from session profile updates (#4842)

* fix(kap-server): drop reserved metadata keys from session profile updates

* fix(kap-server): keep stored reserved metadata keys on profile updates

* docs: split and rewrite the server API reference (#4841)

* docs: split and rewrite the server API reference

* docs: redirect old server API anchors to the split pages

* docs: describe profile metadata as a replacement

* docs: mark question responses as answered-only

* fix(kap-server): avoid heartbeat timeout after scheduling stalls (#4823)

* fix(kap-server): avoid heartbeat timeout reaping after stalls or clock jumps

* fix(kap-server): grace heartbeat window for short scheduling stalls

* fix(kap-server): treat only clearly late heartbeats as scheduling stalls

* fix(kap-server): time heartbeats on a monotonic clock and drain queued input before reaping

---------

Co-authored-by: Kimi Code (Grok Bot) <[email protected]>

* fix(kap-server): undo a turn only once when requests race (#4846)

* docs: describe heartbeat stall handling (#4849)

* docs: describe heartbeat stall handling

* docs: explain the monotonic clock in the heartbeat notes

* fix(agent-core-v2): acquire session lock before loop restoration (#4848)

* fix(agent-core-v2): acquire session lock before loop restoration

* chore: add session lock lifecycle changeset

* fix(agent-core-v2): hold session lock through loop restoration

- add an operation-scoped lease to the session run gate
- hold it across loop initialization, reset, and pending drains
- cover idle timeout and release ordering

* fix(agent-core-v2): keep the output of stopped tool calls (#4854)

* fix(kap-server): drop the partial reply of a retried step (#4855)

* fix(agent-core-v2): dedupe historical tool schemas (#4862)

* fix(agent-core-v2): dedupe historical tool schemas

* chore: add duplicate tool schema changeset

* fix(agent-core-v2): preserve first tool schema declaration

* fix(agent-core-v2): remind on changed tool schemas

* fix(agent-core-v2): block stale tool schema calls

* fix(agent-core-v2): normalize registry schemas in pending checks

* fix(agent-core-v2): import registry tool metadata type

* fix(agent-core-v2): preserve abort handling during validation

* fix(agent-core-v2): refine validation hook preparation

* fix(agent-core-v2): make validation hooks synchronous

* fix(agent-core-v2): preserve tool result notes on fork (#4867)

* fix(agent-core-v2): preserve tool result notes on fork

* chore: add fork tool result note changeset

* fix(agent-core-v2): scope tool result note restoration to forks

* fix(agent-core-v2): normalize inherited tool result notes

* fix(agent-core-v2): isolate fork note restoration

* feat(tui): sweep running titles toward text and add KIMI_CODE_TUI_ANIMATION_FPS (#4843) (#4870)

* chore: sync web dist from code-app (#4871)

code-app: 8ab17294e031323186d357d121c5360b8353900e

Co-authored-by: kimi-agent-bot <[email protected]>

* ci: release packages (#4835)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* chore: sync web dist from code-app

code-app: 5835391dac3a2b9e0c65ffbd418f0d6042a7adb2

---------

Co-authored-by: Haozhe <[email protected]>
Co-authored-by: qer <[email protected]>
Co-authored-by: Kimi Code (Grok Bot) <[email protected]>
Co-authored-by: grapedge <[email protected]>
Co-authored-by: kimi-agent-bot <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@XRX193 XRX193 mentioned this pull request Nov 12, 2026
5 tasks done
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.

3 participants