Skip to content

feat(tui): add mouse support for dialogs, wizards, and inline controls - #5470

Open
Grapedge wants to merge 2 commits into
feat/fullscreen-mouse-viewersfrom
feat/fullscreen-mouse-dialogs
Open

Grapedge wants to merge 2 commits into
feat/fullscreen-mouse-viewersfrom
feat/fullscreen-mouse-dialogs

Conversation

@Grapedge

@Grapedge Grapedge commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Screenshots / Recordings

在真实 PTY(120×36,macOS)全屏模式下,/experiments 支持悬停移动与点击切换、/plugins 支持点击切换 Custom 标签页并在输入框内点击定位光标、/provider 支持悬停切换、/feedback 支持输入框点击定位光标与附件选择器交互。

实机终端文本快照(全屏模式 `/experiments`、`/plugins`、`/provider`、`/feedback`)
   NotifyUser tool  disabled
 ❯ WaitFor tool  disabled
   id wait_for · default · KIMI_CODE_EXPERIMENTAL_WAIT_FOR · modified
 ...
 [ Apply changes and reload ]  1 change
 Installed   Official   Curated   Custom

Install from a GitHub URL (or zip URL / local path):

╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│  > abXcdef                                                                                                       │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
 Choose what to include with your feedback
 ↑↓ navigate · Enter select · Esc cancel

   Current session logs
   Upload the files listed below with your feedback
 ❯ Session logs + project code

Requirement or Bug

完成高频核心面板(PR 1)与全屏接管查看器(PR 2)后,剩余的管理面板(/plugins 及 MCP 子面板、/experiments、/provider、缓存失效提示、/goal 队列管理与编辑弹窗)、表单输入弹窗(/feedback 输入框、API Key 输入框、自定义源导入弹窗)、引导向导(会话导入、数据迁移),以及 3 处既有组件的局部缺口(审批面板内嵌反馈输入框、信任确认弹窗多页滚轮、/feedback 附件列表分页)仍未补齐鼠标支持。本 PR 作为 3 层堆叠 PR 的第 3 层,关闭上述全部缺口,同时保留常规模式与独立子命令(kimi import-sessions)完全可用。

Bug Reproduction Steps

N/A

Root Cause

N/A

Code Changes

本 PR 全部复用 PR 1 引入的渲染期命中原语(ListMouseTracker、SpanHitMap、renderInlineSegments、layoutTabStrip、EmbeddedRect/forwardEmbeddedMouse、StableWindow),将 14 个组件的鼠标交互与边界防误触收口到统一模式,未引入任何新的背景 hover 效果,也未改动 ApprovalPanel 既有的背景 hover 逻辑。

flowchart LR
    P1["PR 1 共享原语<br/>ListMouseTracker · SpanHitMap · EmbeddedRect · StableWindow · layoutTabStrip"] --> A["管理面板与目标队列<br/>Plugins / PluginMcp / Experiments / Provider / CacheHint / GoalQueue"]
    P1 --> B["表单输入与向导<br/>FeedbackInput / ApiKeyInput / CustomRegistryImport / ImportSessions / Migration"]
    P1 --> C["既有组件局部缺口<br/>ApprovalPanel inline feedback · TrustPrompt wheel · PreviewChoicePicker paging"]
Loading

所有内嵌 Input / Editor / MultilineGoalInput 均在 render() 绘制同一行时记录精确 EmbeddedRect(包括 ApprovalPanel 剥离 "> " 的 contentOffsetX: 2 与 FeedbackInputDialog 窄宽剥离边框的 contentOffsetY: 1),消除硬编码行号漂移;多阶段向导和异步刷新列表在切阶段或数据更新时重置 resetSettling(),避免双击穿透下一阶段或误触刚加载出的首行。

关键决策

决策 选择 没选 理由
GoalQueueEditDialog 多行输入框 为既有 MultilineGoalInput 补 StableWindow + 滚轮与点击光标定位 替换成 pi-tui Editor 保持无 TUI 实例依赖的构造签名及 > First line / 4000 字符校验等全部既有契约
GoalQueueManager 点击语义 普通态悬停切 ❯、单击选中、双击编辑;排序态禁悬停,单击退出排序 单击即进入排序态 该面板键盘无 Enter 动作,双击编辑与底栏提示点击更不易误操作
/feedback 附件分页与文件链接 滚轮先滚 ScrollView,未移动时回退 onPreviewScroll;仅对 ← previous page/→ next page 注册点击 整块预览区拦截点击 保证文件行的 OSC 8 终端超链接保持原生可点
表单边框盒提取 抽出 renderPaddedDialogBox 供 ApiKeyInputDialog 与 CustomRegistryImportDialog 共用 两文件各留一份画框代码 消除重复实现并通过 jscpd 零新增克隆检查

阅读指南

  1. apps/kimi-code/src/tui/components/dialogs/{plugins-selector,experiments-selector,provider-manager,cache-hint-dialog,goal-queue-manager}.ts:管理面板与目标队列(含 MultilineGoalInput 鼠标定位与滚轮)。
  2. apps/kimi-code/src/tui/components/dialogs/{feedback-input-dialog,api-key-input-dialog,custom-registry-import}.ts:表单输入弹窗的宽/窄双路径坐标转发与双字段切换。
  3. apps/kimi-code/src/session-import/screen.ts、apps/kimi-code/src/migration/migration-screen.ts:向导切阶段防误触与完成页点击关闭。
  4. apps/kimi-code/src/tui/components/dialogs/{approval-panel,trust-prompt,choice-picker}.ts、apps/kimi-code/src/tui/commands/prompts.ts:3 处局部缺口补齐。

可略读部分:changeset 与 13 个测试文件的新增用例。

Behavior Changes and Affected Users

Behavior Before After Who relies on the old behavior Escape hatch
管理面板与目标队列(/plugins、/experiments、/provider、缓存提示、/goal 队列与编辑) 不支持鼠标悬停切选中、点击操作、选项卡切换或滚轮翻页 补齐鼠标操作;PluginsPanel 安装中锁定点击、异步加载与切页重置防误触;ProviderManager 删除确认 [y/N] 可点击 TUI 全屏模式交互用户 全部原有键盘快捷键保持不变
表单输入弹窗(/feedback、ApiKeyInputDialog、CustomRegistryImportDialog) 不支持鼠标点击定位光标、点击切换字段或滚轮滚动 支持宽/窄宽度点击定位光标、点击标签或输入框切换 URL/Token 字段,以及 /feedback 多行滚轮 TUI 全屏模式交互用户 键盘编辑与 Tab 切换保持不变
会话导入与迁移向导(ImportSessionsScreen、MigrationScreen) 不支持鼠标选择选项或点击关闭完成页 支持悬停移动、点击选择与完成/失败页点击关闭,且每次阶段切换刷新防误触计时;kimi import-sessions 常规模式不受影响 TUI 交互用户与独立运行 kimi import-sessions 的 CLI 用户 全部键盘流程保持不变
ApprovalPanel 内嵌反馈输入 处于 feedbackMode 时点击输入框文本无法定位光标 聚焦态左键按压输入框内精确移动光标,点击其他选项仍退出 feedbackMode 并保留草稿,原有背景 hover 不变 TUI 交互用户 键盘左右移动光标保持不变
TrustPrompt 多页披露 仅支持键盘翻页 新增滚轮翻页,并在边界与小终端禁用态下安全消费滚轮 TUI 交互用户 键盘翻页保持不变
/feedback 附件预览(PreviewChoicePicker) 5 条/页未溢出 OverflowScrollView 导致滚轮与分页提示不可用鼠标操作 滚轮未触发 ScrollView 移动时回退触发附件翻页,← previous page / → next page 支持点击,OSC 8 文件链接仍透传原生打开 TUI 全屏模式交互用户 键盘翻页保持不变

验证结论

  • 平台与核对方式:在 macOS 真实 PTY(120×36)验证全屏与常规模式下的 /experiments、/plugins、/provider、/feedback 交互与光标定位;全部 14 个改动模块均有对应单测覆盖宽/窄宽度、阶段切换防误触、OSC 8 链接透传与常规模式兼容性;Linux 由 CI 跑测验证。
  • 未验证项:Windows 终端未在本地实机运行。
自动化检查与测试结果
  • pnpm exec vitest run --reporter=agent apps/kimi-code/test/tui/ apps/kimi-code/test/migration/ apps/kimi-code/test/session-import/:182 files, 4010 passed(修复评审后 5 个核心单测 101/101 passed)
  • pnpm exec tsc -p apps/kimi-code/tsconfig.json --noEmit:0 errors
  • pnpm lint:0 warnings, 0 errors
  • pnpm run check:duplication:0 new clones

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
Grapedge added this pull request to stack #5471 November 25, 2026 21:46
@changeset-bot

changeset-bot Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: edb21ff

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 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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 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-25T22:11:37.549077Z edb21ff 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.

@pkg-pr-new

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

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

commit: edb21ff

@Grapedge
Grapedge force-pushed the feat/fullscreen-mouse-dialogs branch from 4002281 to 162fe56 Compare November 25, 2026 22:01
@Grapedge
Grapedge force-pushed the feat/fullscreen-mouse-dialogs branch from 162fe56 to edb21ff Compare November 25, 2026 22:08

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.

1 participant