Repository navigation
feat(tui): sweep running titles toward text and add KIMI_CODE_TUI_ANIMATION_FPS - #4870
Conversation
🦋 Changeset detectedLatest commit: 6e0c085 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6e0c085cba
ℹ️ 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".
| setAnimationFrameRate(fps: number): void { | ||
| this.animationFrames.setFrameRate(fps); | ||
| } |
There was a problem hiding this comment.
Add the frame-rate setter to the shared TUI interface
When a host follows the documented package pattern and stores either renderer as the exported TUI type, TypeScript rejects tui.setAnimationFrameRate(...) because this new method exists only on TuiBase; the new test even had to change its helper from TUI to TuiMainScreen to call it. Declare the setter on TUI so this host-facing extension works through the library's shared public renderer interface.
AGENTS.md reference: packages/pi-tui/AGENTS.md:L7-L15
Useful? React with 👍 / 👎.
| setAnimationFrameRate(fps: number): void { | ||
| this.animationFrames.setFrameRate(fps); | ||
| } |
There was a problem hiding this comment.
Add the frame-rate setter to the shared TUI interface
When a host follows the package's documented pattern and stores either renderer as the exported TUI type, TypeScript rejects tui.setAnimationFrameRate(...) because this new method exists only on TuiBase; the new test even had to change its helper from TUI to TuiMainScreen to call it. Declare the setter on TUI so this host-facing extension works through the library's shared public renderer interface.
AGENTS.md reference: packages/pi-tui/AGENTS.md:L7-L15
Useful? React with 👍 / 👎.
| return chalk.hex(mixColors(dim, band, eased * this.level))(character); | ||
| }).join(''); | ||
| const peak = currentTheme.color('text'); | ||
| const rest = currentTheme.isLight() ? lightRest(currentTheme.terminalBackground(), peak) : dim; |
There was a problem hiding this comment.
Invalidate live-thinking colors when the background changes
When an OSC 11 report changes the terminal background while a light-theme Thinking title is live between sweeps, the requested render returns ThinkingComponent's cached lines, so the newly background-derived rest color is not painted until a later animation frame dirties the cache. This affects explicit light themes and auto mode when the resolved theme remains light; invalidate the live-thinking cache on background updates or include the background in its cache key.
AGENTS.md reference: apps/kimi-code/AGENTS.md:L63-L63
Useful? React with 👍 / 👎.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
* 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>
Requirement or Bug
本 PR 将已合并的 #4843 cherry-pick 到
release/2026-11-12。全屏模式下,折叠分组的摘要标题和 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 的要求建议先看
running-title.ts,它负责颜色和光带位置。再看packages/pi-tui/src/animation-frame.ts里帧率改变后的调度,以及src/tui/config.ts里的环境变量解析。其余是接线、常量、文档和测试。Screenshots / Recordings
以下画面来自原 PR #4843 的真实 TUI 抓帧,本 PR cherry-pick 同一实现。左边是原 PR 的 main 基线,右边是改动后。
Behavior Changes and Affected Users
textDim提亮到texttextDim,光带变浅textKIMI_CODE_TUI_ANIMATION_FPSapps/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。验证
当前 release 分支验证:
pnpm --filter @moonshot-ai/kimi-code exec vitest run test/cli/run-shell.test.ts test/tui/components/messages/thinking.test.ts test/tui/components/messages/transcript-container.test.ts test/tui/config.test.ts test/tui/kimi-tui-startup.test.ts:5 个文件、402 个用例通过。pnpm --filter @moonshot-ai/pi-tui test:1150 个用例通过,1 个跳过。@moonshot-ai/kimi-code与@moonshot-ai/pi-tui的typecheck均通过。原 PR #4843 还完成了全量 TUI/run-shell 测试,以及在 tmux 中通过本地 mock 模型运行真实 TUI 的暗色、亮色和帧率验证;视觉证据见上。
Checklist
/approve).gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.