Repository navigation
feat(tui): fold tool calls and thinking into transcript groups in fullscreen - #4618
Conversation
🦋 Changeset detectedLatest commit: 31067c9 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 |
Codex Review SummaryThis 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. |
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: af5ccc7c81
ℹ️ 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".
There was a problem hiding this comment.
🟡 Changes recommended
Truncated tool calls can be reported as completed edits, and skill activations can corrupt transcript trimming, alongside unresolved accessibility and follow-mode regressions.
7 open issues
Truncated result-less tool calls are incorrectly reported as successful · New Model-loaded skills are miscounted as turn boundaries · New Older groups and members cannot be expanded using the keyboard · New Clicking while following the transcript permanently disables follow-end · New Mixed text color fails the required 4.5:1 contrast ratio · New Standalone skill activations disappear without a matching tool call · New Dense transcript content lacks the promised collapse and item limit · New
1 file not reviewed
pnpm-lock.yaml: Generated file
What changed in this PR
This PR groups consecutive tool calls and completed thinking in the fullscreen TUI, and updates the running thinking display.
Changes:
- Add expandable transcript groups, display settings, and read-only Bash classification.
- Introduce shared animation-frame scheduling for TUI animations.
- Update tests, configuration documentation, and changesets.
This pull request requires changes.
| File | Summary |
|---|---|
pnpm-lock.yaml |
Records the Bash parser dependency. |
packages/pi-tui/UPSTREAM.md |
Documents the animation-frame extension. |
packages/pi-tui/test/tui-render.test.ts |
Tests animation-frame scheduling. |
packages/pi-tui/src/tui.ts |
Integrates animation frames with the TUI lifecycle. |
packages/pi-tui/src/index.ts |
Exports the animation-frame API. |
packages/pi-tui/src/animation-frame.ts |
Implements the shared scheduler. [P2] Pausing during a callback still drains remaining callbacks. |
docs/zh/configuration/config-files.md |
Documents grouping settings in Chinese. |
docs/en/configuration/config-files.md |
Documents grouping settings in English. |
apps/kimi-code/test/utils/readonly-bash.test.ts |
Tests read-only command classification. |
apps/kimi-code/test/tui/terminal-theme.test.ts |
Tests grouping colors. |
apps/kimi-code/test/tui/signal-handlers.test.ts |
Updates configuration fixtures. |
apps/kimi-code/test/tui/message-replay.test.ts |
Adapts replay and expansion-state tests. |
apps/kimi-code/test/tui/kimi-tui-startup.test.ts |
Updates startup configuration fixtures. |
apps/kimi-code/test/tui/fullscreen-layout.test.ts |
Tests scroll anchoring and settings layout. |
apps/kimi-code/test/tui/create-tui-state.test.ts |
Updates transcript-container state assertions. |
apps/kimi-code/test/tui/config.test.ts |
Tests grouping configuration parsing and persistence. |
apps/kimi-code/test/tui/components/messages/tool-call.test.ts |
Adapts tool-call timing tests. |
apps/kimi-code/test/tui/components/messages/thinking.test.ts |
Tests thinking titles and animation. |
apps/kimi-code/test/tui/components/messages/agent-group.test.ts |
Adapts tool-result timing tests. |
apps/kimi-code/test/tui/components/dialogs/mermaid-preference-selector.test.ts |
Tests grouping settings selectors. |
apps/kimi-code/test/tui/components/chrome/welcome.test.ts |
Updates configuration fixtures. |
apps/kimi-code/test/tui/components/chrome/moon-loader.test.ts |
Tests shared-frame loading animation. |
apps/kimi-code/test/tui/components/chrome/footer.test.ts |
Tests grouping hints. |
apps/kimi-code/test/tui/components/chrome/footer-status-line.test.ts |
Updates configuration fixtures. |
apps/kimi-code/test/tui/commands/update-preferences.test.ts |
Updates configuration fixtures. |
apps/kimi-code/test/tui/commands/transcript-preferences.test.ts |
Tests grouping preferences and telemetry. |
apps/kimi-code/test/tui/commands/reload.test.ts |
Adapts configuration reload tests. |
apps/kimi-code/test/tui/activity-pane.test.ts |
Updates configuration fixtures. |
apps/kimi-code/test/cli/update/preflight.test.ts |
Updates configuration fixtures. |
apps/kimi-code/src/utils/readonly-bash.ts |
Classifies read-only Bash commands. [P2] git remote -v remove origin, attached sed -e scripts, and bare numeric redirect destinations can be misclassified as read-only. |
apps/kimi-code/src/tui/utils/transcript-turns.ts |
Identifies turn boundaries. [P1] Model-loaded skill cards can create incorrect boundaries and leave trimmed turns out of sync. |
apps/kimi-code/src/tui/utils/transcript-projection.ts |
Projects transcript members into groups. [P1] Dense segments lack the promised expandable … N more and visible-item limit. |
apps/kimi-code/src/tui/utils/transcript-items.ts |
Extracts member labels, statuses, and statistics. [P1] Truncated, unexecuted calls can be reported as successful edits. [P2] Standalone model-triggered skill activations can be hidden without a matching tool call. |
apps/kimi-code/src/tui/utils/component-capabilities.ts |
Adds row-detail capability detection. |
apps/kimi-code/src/tui/types.ts |
Adds grouping configuration and timing types. |
apps/kimi-code/src/tui/tui-state.ts |
Integrates the transcript container and view. |
apps/kimi-code/src/tui/theme/theme.ts |
Provides grouping colors. [P2] The light-theme mixed foreground falls below the required text contrast ratio. |
apps/kimi-code/src/tui/theme/gradient-text.ts |
Reuses color-mixing utilities. |
apps/kimi-code/src/tui/theme/color-mix.ts |
Adds color parsing and mixing. |
apps/kimi-code/src/tui/controllers/subagent-event-handler.ts |
Removes components through the container. |
apps/kimi-code/src/tui/controllers/streaming-ui.ts |
Integrates grouping state and timing. |
apps/kimi-code/src/tui/controllers/session-replay.ts |
Adapts replay to container state. |
apps/kimi-code/src/tui/controllers/session-event-handler.ts |
Adapts container expansion and replacement. |
apps/kimi-code/src/tui/constant/tips.ts |
Adds grouping hints. |
apps/kimi-code/src/tui/constant/rendering.ts |
Adds grouping animation and timing constants. |
apps/kimi-code/src/tui/config.ts |
Defines and persists grouping configuration. |
apps/kimi-code/src/tui/components/messages/transcript-view.ts |
Adds scroll anchoring. [P1] Group interactions disable follow-end even when the viewport was already following. |
apps/kimi-code/src/tui/components/messages/transcript-group.ts |
Renders groups and handles interactions. [P1] Older groups and member details have no keyboard expansion path. |
apps/kimi-code/src/tui/components/messages/transcript-container.ts |
Manages projections and expansion state. [P2] Ctrl+O changes manually expanded content outside its three-turn window. [P2] A running group can lose its active tail and animation when later content appears. |
apps/kimi-code/src/tui/components/messages/tool-renderers/types.ts |
Adds card-only content wrapping. |
apps/kimi-code/src/tui/components/messages/tool-renderers/summary.ts |
Avoids duplicated row-detail summaries. |
apps/kimi-code/src/tui/components/messages/tool-renderers/chip.ts |
Shares tool statistics text. |
apps/kimi-code/src/tui/components/messages/tool-call.ts |
Supports grouping details and timing. |
apps/kimi-code/src/tui/components/messages/thinking.ts |
Updates thinking titles and row details. |
apps/kimi-code/src/tui/components/messages/skill-activation.ts |
Identifies model-triggered skill activations. |
apps/kimi-code/src/tui/components/messages/running-title.ts |
Implements title shimmer and timing. |
apps/kimi-code/src/tui/components/messages/read-group.ts |
Exposes members and projection versions. |
apps/kimi-code/src/tui/components/messages/assistant-message.ts |
Tracks projection-related changes. |
apps/kimi-code/src/tui/components/messages/agent-swarm-progress.ts |
Tracks projection-related state. |
apps/kimi-code/src/tui/components/messages/agent-group.ts |
Tracks group projection versions. |
apps/kimi-code/src/tui/components/dialogs/settings-selector.ts |
Adds grouping settings. |
apps/kimi-code/src/tui/components/chrome/moon-loader.ts |
Uses shared animation frames. |
apps/kimi-code/src/tui/components/chrome/footer.ts |
Shows grouping-related hints. |
apps/kimi-code/src/tui/commands/undo.ts |
Removes undone content through the container. |
apps/kimi-code/src/tui/commands/reload.ts |
Reloads grouping configuration. |
apps/kimi-code/src/tui/commands/config.ts |
Applies and saves grouping settings. |
apps/kimi-code/package.json |
Adds the Bash parser development dependency. |
.changeset/tidy-transcript-groups.md |
Records fullscreen grouping changes. |
.changeset/pi-tui-animation-frames.md |
Records the animation-frame API. |
.changeset/live-thinking-title.md |
Records the thinking-title change. |
.changeset/hide-ctrl-o-hint-while-grouping.md |
Records footer hint changes. |
.changeset/ctrl-o-skill-card-turns.md |
Records the Ctrl+O turn-boundary change. |
Review effort: Balanced
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bf4c7db451
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ad3df8295d
ℹ️ 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".
…lscreen In fullscreen mode, consecutive tool calls and finished thinking now fold into one summary line that expands in place on click. Running tools join the group right away, and an open group shows what it is doing on a tail line. Subagent cards and communication tools stay outside groups. Long runs between replies collapse older items behind a "… N more" row. Configure it under [transcript.group] in tui.toml (tools = "auto" | "explore" | "off", thinking = true | false) or with the Tool grouping and Group thinking entries in /settings, which appear only in fullscreen. Turning both off restores the previous fullscreen layout, including the 30-step merge. Regular mode is unchanged. A foreground Bash call running for 10 seconds also replaces the activity line tip with a Ctrl+B hint while grouping is on.
…king [transcript.group] now reads group_thinking = true | false, matching the group_thinking telemetry field and the Group thinking setting.
Each grouped item now carries its verb, subject, and finished status (running, failed, interrupted, or done with a stat) instead of a joined tail string, so a group can lay out rows from data. Cards mark the parts a group row repeats (search samples, the Edit diff header, the Bash command) and render a row detail without them.
Every group title now uses the same dot marker. An expanded group lists one row per item without line counts: a bold verb, its subject, and a diff, search count, running timer, or failed/interrupted note. Clicking a row opens its detail in place, inside the group, without the parts the row already says. A finished one-item group is titled by the item itself, and Show less only appears once an expanded group is taller than the transcript viewport. The collapsed tail now starts at column one.
When tool calls are grouped, the extra Activated skill card for a model-triggered skill no longer appears after the group or splits it. User /skill activations and ungrouped transcripts are unchanged.
Live thinking now shows a `● Thinking` title with the same moving highlight as running transcript groups and an elapsed-seconds timer after two seconds, instead of the braille spinner and `thinking…`. The preview under it no longer ends with a blank row.
A thought opened while it was streaming now stays between the tools that ran before and after it. The group around it splits in two until the thought is collapsed again.
Ctrl+O no longer treats skill cards loaded by the model as the start of a turn, so after several skill loads it still expands the latest turns, in both fullscreen and regular mode.
With transcript grouping on, a long run of tool calls no longer hides its older groups and cards behind a clickable "… N more" row. Every group and card in the turn stays in the transcript, so a click can open any of them.
With grouping on, the footer no longer shows "ctrl+o expand" or "ctrl+o collapse"; ctrl+o itself still expands and collapses. Regular mode and fullscreen with grouping off keep the hint.
The TUI now offers requestAnimationFrame and cancelAnimationFrame. A request runs once, every callback of a frame gets the same timestamp on the performance.now() clock, and frames land on a fixed 120 ms grid served by one unref'd timer that exists only while a request is pending. A throwing callback does not stop the others; the first error is rethrown in a microtask. stop() pauses frames and start() resumes on the next frame without replaying missed ones. TuiBase takes an optional clock so tests can drive frames by hand.
The activity spinner, transcript group titles, and the live Thinking line now advance only on the TUI's 120 ms animation frames and request a render only when what they draw changes. Renders between frames, such as typing, no longer move the highlight, and the highlight requests no renders while it waits off the title. The braille spinner now turns at 120 ms per frame, like the moon.
With transcript grouping on, a thought the user clicked open while it streamed stays outside its group once it finishes, but it lost its title and fell back to the old bulleted first line. It now keeps a "Thought for Ns" title, drawn exactly like the title of a one-item group, above its full text. A click on any line of such a thought now always folds it back into its group. Before, a thought of three lines or fewer had nothing hidden once it finished, so the click was ignored. Regular mode, fullscreen with grouping off, and fullscreen with thinking left out of grouping keep the old finished form and the old click handling.
While the highlight waits off a running title it requests no renders, but the title width it compared against only ever grew. After a group title got shorter, such as a long command title turning into "Ran 2 commands", or after a wrapped command title closed, the highlight requested a render on every frame although nothing on screen changed. Each title render now starts a new measurement, so the gap check uses the columns of the title shown now.
Closing an opened thought folds it back into one group with the groups around it, and the merged group stays expanded when one of them was. The expanded flag was written to the anchor the code guessed for the merged group. When a silent tool call such as select_tools came right before the thought, the merged group started at that call instead, so the group the user had just expanded showed up collapsed. The container now projects the transcript again after the close and marks the group that actually holds the closed item.
The title highlight eased toward on or off by a fixed share of the gap on every animation frame, so a longer frame made it fade faster: on 120 ms frames it faded out in about 840 ms instead of the second it took on the 50 ms frames it was tuned on. It now closes half of the remaining gap every 150 ms of elapsed time, which keeps the 50 ms speed (within 0.005 of that curve) on any frame length.
The spinner test waited a hard-coded 119, 1 and 120 ms, which only lines up with 120 ms animation frames. It now derives when each spinner frame shows from the spinner frame duration and the animation frame interval, so changing the frame interval alone leaves the test passing.
The animation frame timer is unref'd so a frame that keeps requesting the next one never holds the process open, but no test covered it. The new test runs a child process whose frame callback requests another frame forever and checks that the child runs frames, then exits on its own.
The transcript group changeset carried a second sentence about the footer hint. A changeset states one change, so the group entry goes back to its own sentence and the hint gets a patch entry that names what users lose and how to bring the hint back.
Clicking a group title, its tail or one of its rows pinned the scroll position so the clicked line stayed put. While the transcript was following its end, that pin also turned following off, so later tool output and the final reply landed below the screen behind "Jump to bottom". While the transcript follows its end, a click now toggles the group without pinning, as Show less and clicks on ungrouped cards already do. A transcript that is scrolled up still keeps the clicked line in place.
… created with The default animation clock looked up the global setTimeout and performance.now on every frame. When an earlier test left a frame chain running on real timers and its next frame fired after a later test had called vi.useFakeTimers(), the chain moved onto the fake timers and kept going, so vi.runAllTimersAsync() in that test aborted after 10000 timers. The race depends on timing, which made the TUI message flow tests fail only now and then on CI. Production code never swaps the timers. Each scheduler now binds the timers and performance.now it finds when it is created. A scheduler created on real timers stays on them, and one created after vi.useFakeTimers() still runs on the fake timers, so existing component tests keep working unchanged.
…lded Bash calls A foreground Bash command that runs for 10 seconds advertises "Press Ctrl+B to run in background". With transcript folding on, the activity line showed it for every running command, so a command drawn as its own card showed the hint twice, and opening a folded group exposed the card's own copy next to the activity line's. The activity line now shows the hint only for a running Bash call that is folded into a group. Such a call is one the folding settings cover and the user has not opened as a card. The transcript container decides this from the call alone, without projecting the transcript, because the activity line refreshes on every replayed step. Projecting there would set the ctrl+o expansion of each replayed group before the replay knows the last three turns, and would cost a full projection per step. The card keeps its hint for the standalone card form, so group row details no longer draw it. The activity line also refreshes when a call moves between a card and a group: a settings change, opening or closing a card, ctrl+o, and the start of a command whose argument preview was folded. With only read-only tools folding, every preview folds, and the started command may turn out not to be read-only.
The --verify test probes ran bun test from the repository root, so apps/kimi-code/bunfig.toml never loaded its preload and the app's imports map was not the active one; the KIMI_LANG default fell back to the host locale and the MoonshotAI#4618 case failed on an English string. Resolve the probe file against the repository root, pick the nearest ancestor package.json as the working directory, and pass the path relative to it, matching how scripts/run-tests.mjs spawns each package suite.
…hotAI#4755 evidence MoonshotAI#4618 is configured through [transcript].tool_call_density and [transcript].thinking, not a [transcript.group] table. The MoonshotAI#4618 probe limitation and the four-file hang noted on MoonshotAI#4755 were fixed in 580b5b5 and 4d88e05. MoonshotAI#4730 was recorded as no longer reconstructing step ids, which the step.begin case still does; the real gap was the live context-memory fold dropping the recorded content-part timing, now fixed in 008fb38. Verdicts are unchanged.
…t type MoonshotAI#4618 added mixColors and colorDistance plus the Theme terminalBackground fallback without the tests that pin their values, so a later change to either helper would go unnoticed; add the upstream assertions for the mixes, the distance and both palette families. Instant went back to a branded number, matching the upstream type so a raw number cannot stand in for a monotonic instant; the affected fixtures wrap their literals in instant() without changing what they assert.


Requirement or Bug
fullscreen 模式下,一轮里连续的读文件、搜索、命令和思考会各占一张卡片,长任务把对话挤出屏幕,用户很难看清模型到底做了什么。这个 PR 把连续的工具调用和已结束的思考折成一行摘要,点击就地展开成每项一行的清单,运行中的内容用尾巴显示正在做什么。开启分组后不再合并或截断旧条目,当前这一轮的每一步都能点开看全。同时,运行中的思考改成带扫光和计时的
Thinking标题(regular 和 fullscreen 都会变),所有转圈图标和扫光改为共用 pi-tui 新增的动画时钟,每秒最多刷新约 8 次。没有关联 issue。
Bug Reproduction Steps
N/A
Root Cause
N/A
Code Changes
核心思路。 fullscreen 的 transcript 容器把连续的工具和思考成员投影成「分组」。收起时一行摘要,运行中的工具立即进组,组下方用尾巴显示正在做的那一项。展开后标题下空一行,每个成员一行(
├/└在第 1 列,没有状态圆点),点开某一行,详情仍在组内、显示在这一行下面,并去掉与这一行重复的内容。regular 模式、tools = "off"和不进组的工具(子代理、沟通类)仍是原来的单卡片。分组开启时不做 30 步合并,也不截断旧条目。两个开关(tools、group_thinking)都关掉时,fullscreen 回到原来的布局,包括 30 步合并。●└ $ ls -la … · 3s,2 秒后才显示计时;点它也能展开词 + 主体 + 状态后缀,行开头的词加粗,其余 dim● Thought for Ns加全文,点任意一行收回分组requestAnimationFrame,所有动画共用一个 120 毫秒一拍的时钟[transcript.group]tools = "auto" | "explore" | "off"、group_thinking = true | false,也可在 /settings 里设置flowchart TD A[transcript-items: 读每个成员, 产出 label 和 status] --> B[transcript-projection: 把连续成员投影成分组] B --> C[transcript-container: 持有展开状态, 处理点击和 ctrl+o] C --> D[transcript-group: 按成员数, 是否运行, 是否展开画标题 尾巴 行 详情] D --> F[ToolCall 和 Thinking: renderRowDetail 输出去掉重复的详情] G[tui config 和 /settings] --> C H[pi-tui requestAnimationFrame: 所有动画共用的 120 毫秒时钟] --> D H --> I[月亮和点阵图标, 进行中的思考行]transcript-items是唯一知道「一个工具调用在 transcript 里怎么说」的地方:它给每个成员算出label(词和主体)和status(运行中、失败、中断、完成加统计)。标题、尾巴和行都读这两个字段,所以统计和失败规则只写在一处,不会在几个渲染点之间漂移。动画不再各自开定时器。组件在回调里按经过的时间算出这一拍的画面,画面变了才调用
requestRender(),要继续动就再请求下一拍。同一拍里的多次requestRender()合并成一次刷新,所以月亮图标和分组扫光同时在动时,每秒仍只刷新约 8 次。关键决策。
label和status,分组渲染只读它们CardOnly包装「只属于卡片」的部分toggleRow)status联合,失败的行没有统计· failed,不写统计;失败和中断的修改不计入标题总和,各行加起来等于标题· interrupted· N interrupted的口径一致thinking改名group_thinking,不留兼容tools不是"off")隐藏模型触发的卡片Load skill x行说的是同一件事;代价是看不到技能参数预览,平时很少有人看Show less用标题的textDim;尾巴和计时用主题的暗淡样式,和 Bash 卡片里的命令、shell 的计时一致textDim往背景色混出一个更淡的颜色… N more收起更早的条目,或给分组加条数上限● Thought for Ns标题,和单独成组时的标题逐字节相同requestAnimationFrame/cancelAnimationFrame:一次性请求,固定 120 毫秒一拍setInterval;按组件登记各自的间隔performance.now()同一个单调时钟Date.now()requestRender()阅读指南。 按下面的顺序看:
apps/kimi-code/src/tui/utils/transcript-items.ts:成员的label、status和统计规则从这里来。apps/kimi-code/src/tui/utils/transcript-projection.ts:连续成员如何成组,什么不进组。apps/kimi-code/src/tui/components/messages/transcript-container.ts:展开状态、toggleGroup/toggleRow、ctrl+o 的新语义。apps/kimi-code/src/tui/components/messages/transcript-group.ts:标题、尾巴、行、详情的版面和点击区域。apps/kimi-code/src/tui/components/messages/tool-call.ts、thinking.ts、running-title.ts:行详情去重,以及运行中思考的Thinking标题。apps/kimi-code/src/tui/config.ts、commands/config.ts、dialogs/settings-selector.ts:配置、持久化和 /settings。packages/pi-tui/src/animation-frame.ts:共用的动画时钟和它的调度规则;再看moon-loader.ts、transcript-group.ts、thinking.ts里的onFrame怎么用它。可以略读:
theme/下的颜色混合、chip.ts/summary.ts/types.ts的接线、kimi-tui.ts的参数透传、各测试文件里的辅助函数。Screenshots / Recordings
分组在 main 上不存在,下面只放改动后。思考标题放前后对比。
收起的分组。 每个分组一行摘要,只有一项且已结束的分组(如
$ ls)直接显示这一项本身。展开。 标题下空一行,每项一行,行开头的词加粗;点开了 Search、Bash、Edit 三行,详情在行下面,没有重复的
$ 命令、+N -M 路径和样例文件行。运行中。 依次是:单条命令运行中、跑完、第二条命令运行中且收起、点尾巴展开、这一轮结束。
失败的行。 开头的词标红,后面写
· failed,不写统计,也不计入标题上的+1。点开过的思考保留标题。 思考进行中被点开的那一段,结束后留在分组外,标题原地变成
● Thought for 5s,全文留在下面;点它的标题,它收回分组。思考中的标题(regular 和 fullscreen 都会变)。 改动前是 braille 圆点加
thinking…;改动后是● Thinking,圆点和文字带扫光,2 秒后加· Ns,预览不再以空行结尾。fullscreen 下从思考中到并入分组的五帧:计时出现前、第一段计时中、第一段结束(
Thought for 6s)、第二段思考中、并入分组(Thought for 11s, read 1 file)。Behavior Changes and Affected Users
下表相对 main,一行一个。fullscreen 是
tui.toml里tui_mode = "fullscreen"的用户;regular 是默认模式。tools = "auto"、group_thinking = truetui_mode = "fullscreen"的 TUI 用户(默认配置状态也会变)[transcript.group]里tools = "off"加group_thinking = false,或 /settings 里 Tool call folding 选 Show every tool call separately 加 Thinking folding 选 Don't fold thinking,恢复原布局└ $ … · Ns(2 秒后才有计时),点尾巴展开+N -M 路径、Bash 的$ 命令);较早轮次的行也能点开ctrl+o expand/ctrl+o collapse● Thought for Ns,下面是全文;点任意一行收回分组group_thinking = false└ Show less,点它收起并底部锚定▶ Activated skill: x卡片,并把后面的调用切成新分组tools不是"off")不显示这张卡片,组里的Load skill x行代替;它也不再切断分组。看不到技能参数预览tools = "off"恢复;regular 模式和用户/skill:foo触发的激活不变thinking…● Thinking,圆点和文字带扫光,2 秒后加· Ns;下方斜体预览保持,但不再以空行结尾Thought for Ns卡片group_thinking = true时并入分组;regular 和group_thinking = false不变group_thinking = falsetui.toml新增[transcript.group]tools和group_thinking;默认值时写成注释,非默认值时写出实节;tools写错值时警告并回落到默认tui.toml的用户(不写该节即用默认,即分组开启)click a group summary to reveal every tool callPress Ctrl+B to run in backgroundtranscript_group_toggle、transcript_expand_all、transcript_display_settings(group_tools、group_thinking、source)tools = "off"的单卡片、running 2 commands的摘要写法、进行中的思考显示在组外、标题运行中的扫光apps/kimi-code/src/tui/,未动src/cli/、契约文件或 kap-server受影响模块。 所有改动在
apps/kimi-code,另有docs/下中英两份tui.toml配置说明。新增的@moonshot-ai/tree-sitter-bash是开发依赖,构建时打进产物,用于判断tools = "explore"下哪些命令是只读的。每行对应的测试
Show less、ctrl+o、点开的思考保留标题、失败和中断test/tui/components/messages/transcript-container.test.ts、test/tui/utils/transcript-projection.test.ts、test/tui/kimi-tui-message-flow.test.ts、test/tui/components/messages/tool-call.test.tstest/tui/components/messages/transcript-container.test.ts、test/tui/kimi-tui-message-flow.test.ts、test/tui/message-replay.test.tstest/tui/components/messages/thinking.test.ts、test/tui/kimi-tui-message-flow.test.tstest/tui/config.test.ts、test/tui/commands/transcript-preferences.test.ts、test/tui/components/dialogs/mermaid-preference-selector.test.tstest/tui/components/chrome/footer.test.ts、test/tui/kimi-tui-message-flow.test.tspackages/pi-tui/test/tui-render.test.tstest/tui/components/chrome/moon-loader.test.ts、test/tui/components/messages/transcript-container.test.ts、test/tui/components/messages/thinking.test.tsexplore的只读命令判断test/utils/readonly-bash.test.tstest/tui/fullscreen-layout.test.ts、test/tui/components/messages/transcript-container.test.ts验证。 TUI 测试全绿,打包后的清单里没有私有包。在真实程序里恢复同一批真实会话的副本,逐页对比 regular 模式和关闭分组时的整个对话,和 main 没有差异(只差底栏轮播的提示)。
性能。 低速模式(macOS 后台优先级
taskpolicy -c background,模拟较慢的机器),fullscreen 默认配置:统一时钟之前,本分支工具运行时每秒刷新 26.9 次,处理器占用 9.7%。ctrl+o 展开大量输出后的打字延迟来自 main 上就有的重复计算,堆叠在本 PR 上的修复 #4665 把它降到 5.1 ms。在真实的 kimi 程序里手动验证过 fullscreen 下的分组展开和收起、点开一行、失败的行、运行中的尾巴和思考标题。regular 模式的思考标题用接生产组件的演示脚本验证。开 PR 前的复核发现已在本 PR 中修掉。
未单独验证的部分
test/tui/terminal-theme.test.ts。tools = "explore"的只读命令判断带解析预算(500 ms、20,000 节点),预算耗尽时的降级行为只由test/utils/readonly-bash.test.ts覆盖。Checklist
/approve).gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.