Skip to content

feat(tui): allow expanding streaming thinking - #4322

Merged
Grapedge merged 2 commits into
mainfrom
expand-thinking
Oct 22, 2026
Merged

Grapedge merged 2 commits into
mainfrom
expand-thinking

Conversation

@Grapedge

@Grapedge Grapedge commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Requirement or Bug

让 TUI 用户在 thinking 流式输出期间展开完整文本,并在后续 delta 和 finalize 后保持展开状态。

Bug Reproduction Steps

N/A

Root Cause

N/A

Code Changes

ThinkingComponent.render
- live 始终只显示末尾两行
+ live 未展开时只显示末尾两行
+ live 展开时显示全部已接收文本

previewHidesLines
- 只在 finalized 计算隐藏内容
+ live 按尾部预览计算,finalized 保持净省行规则
  • 复用现有 expanded、Ctrl+O 和点击路径,不新增配置或 thinking 专属收尾逻辑。
  • render() 与 hasHiddenContent() 共用截断判断,避免点击状态与实际渲染不一致。
  • 添加 changeset。

Behavior Changes and Affected Users

Behavior Before After Who relies on the old behavior Escape hatch
流式 thinking 的 Ctrl+O 只显示末尾两行,expanded 要到 finalize 后才生效 立即显示全部已接收文本,后续 delta 继续显示 在 thinking 流式期间阅读完整推理文本的 TUI 用户 再按 Ctrl+O 收起
Fullscreen 中点击流式 thinking 点击无效 点击可展开或收起,三行文本隐藏一行时也可点击 使用鼠标阅读流式 thinking 的 Fullscreen TUI 用户 再次点击或按 Ctrl+O
delta 与 finalize 的展开状态 live 期间无法观察展开效果 展开状态跨 delta 和 finalize 保留,不自动折叠 已主动展开 thinking 的 TUI 用户 手动收起
默认未展开的 live thinking 显示末尾两行 不变 依赖紧凑默认视图的 TUI 用户 无需迁移
finalized thinking 折叠时显示头部两行和 hint,展开时显示全文 不变 回顾已完成 thinking 的 TUI 用户 无需迁移

测试覆盖:

  • 全局 Ctrl+O 已开启时,live 与 finalize 后都显示完整文本。
  • 三行 live 文本可点击展开,连续展开、收起、再展开均有效;新增 delta 和 finalize 不重置状态。
  • 默认 tail、finalized 折叠和 footer 行为由原测试继续覆盖。
  • 全部 TUI 测试通过 168 个文件、3020 个用例;类型检查通过;lint 为 0 个错误。
  • 直接渲染检查确认 250 行 live 文本和追加后的 251 行 finalized 文本全部可见。

未修改 print 模式、SDK、ACP、kap-server、会话数据格式或外部事件契约。

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.

@Grapedge

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 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-21T17:09:40.736380Z a26a46d Manual request
ℹ️ 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.

@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: 6c13e592c4

ℹ️ 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 docs/en/guides/getting-started.md Resolved
Comment thread docs/en/guides/interaction.md Resolved
@changeset-bot

changeset-bot Bot commented Oct 21, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6c13e59

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

@pkg-pr-new

pkg-pr-new Bot commented Oct 21, 2026

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

commit: a26a46d

@Grapedge

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: a26a46d804

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

@Grapedge
Grapedge merged commit 44cdf8f into main Oct 22, 2026
17 checks passed
@Grapedge
Grapedge deleted the expand-thinking branch October 22, 2026 07:35
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