From 1cb65f0c53019bac24279acaaac9562aaa9f30d5 Mon Sep 17 00:00:00 2001 From: shizhigu Date: Wed, 22 Jul 2026 11:55:25 -0500 Subject: [PATCH] fix(tui): enable terminal progress in VS Code --- .changeset/vscode-terminal-progress.md | 5 +++++ apps/kimi-code/src/tui/utils/terminal-notification.ts | 4 +++- apps/kimi-code/test/tui/terminal-notification.test.ts | 4 ++++ docs/en/guides/interaction.md | 8 ++++++++ docs/zh/guides/interaction.md | 8 ++++++++ 5 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 .changeset/vscode-terminal-progress.md diff --git a/.changeset/vscode-terminal-progress.md b/.changeset/vscode-terminal-progress.md new file mode 100644 index 0000000000..16d3adfc97 --- /dev/null +++ b/.changeset/vscode-terminal-progress.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code": patch +--- + +Enable terminal progress reporting in VS Code integrated terminals. diff --git a/apps/kimi-code/src/tui/utils/terminal-notification.ts b/apps/kimi-code/src/tui/utils/terminal-notification.ts index c71f41df9f..de1ee8771a 100644 --- a/apps/kimi-code/src/tui/utils/terminal-notification.ts +++ b/apps/kimi-code/src/tui/utils/terminal-notification.ts @@ -123,7 +123,9 @@ export function supportsTerminalProgress(env: NodeJS.ProcessEnv = process.env): if ((env['WT_SESSION'] ?? '').length > 0) return true; if (env['ConEmuANSI'] === 'ON') return true; const termProgram = env['TERM_PROGRAM'] ?? ''; - if (termProgram === 'ghostty' || termProgram === 'WezTerm') return true; + if (termProgram === 'ghostty' || termProgram === 'WezTerm' || termProgram === 'vscode') { + return true; + } const term = env['TERM'] ?? ''; if (term === 'xterm-ghostty') return true; return false; diff --git a/apps/kimi-code/test/tui/terminal-notification.test.ts b/apps/kimi-code/test/tui/terminal-notification.test.ts index cef7b80868..d3cdce6a53 100644 --- a/apps/kimi-code/test/tui/terminal-notification.test.ts +++ b/apps/kimi-code/test/tui/terminal-notification.test.ts @@ -222,6 +222,10 @@ describe('supportsTerminalProgress', () => { expect(supportsTerminalProgress({ ConEmuANSI: 'ON' })).toBe(true); }); + it('detects the VS Code integrated terminal via TERM_PROGRAM', () => { + expect(supportsTerminalProgress({ TERM_PROGRAM: 'vscode' })).toBe(true); + }); + it('detects Ghostty / WezTerm via TERM_PROGRAM and TERM', () => { expect(supportsTerminalProgress({ TERM_PROGRAM: 'ghostty' })).toBe(true); expect(supportsTerminalProgress({ TERM: 'xterm-ghostty' })).toBe(true); diff --git a/docs/en/guides/interaction.md b/docs/en/guides/interaction.md index ff59fe8b23..a7228ad55b 100644 --- a/docs/en/guides/interaction.md +++ b/docs/en/guides/interaction.md @@ -83,6 +83,14 @@ The input box remains usable while the agent is thinking or calling tools, and s - **`Esc` / `Ctrl-C`**: interrupt the current turn - **`Ctrl-O`**: globally toggle the collapsed/expanded state of tool output and compaction summaries +VS Code 1.97 or later can show Kimi Code CLI's working-state indicator in integrated terminal tabs. Include `${progress}` in [`terminal.integrated.tabs.title` or `terminal.integrated.tabs.description`](https://code.visualstudio.com/docs/terminal/appearance#_tab-text), for example: + +```json +{ + "terminal.integrated.tabs.title": "${process}${separator}${progress}" +} +``` + ## External editor Press `Ctrl-G` to send the current input content to an external editor. When you save and close, the text is written back into the input box; if you close without saving, the original content is preserved. This is handy when you need to enter large blocks of text or content with complex formatting. diff --git a/docs/zh/guides/interaction.md b/docs/zh/guides/interaction.md index 628525e9de..ba2a84a215 100644 --- a/docs/zh/guides/interaction.md +++ b/docs/zh/guides/interaction.md @@ -83,6 +83,14 @@ Agent 思考或调用工具时,输入框仍然可用,支持以下额外操 - **`Esc` / `Ctrl-C`**:中断当前轮次 - **`Ctrl-O`**:全局切换工具输出和压缩摘要的折叠状态 +VS Code 1.97 及更高版本可以在集成终端的标签页中显示 Kimi Code CLI 的工作状态指示器。请在 [`terminal.integrated.tabs.title` 或 `terminal.integrated.tabs.description`](https://code.visualstudio.com/docs/terminal/appearance#_tab-text) 中包含 `${progress}`,例如: + +```json +{ + "terminal.integrated.tabs.title": "${process}${separator}${progress}" +} +``` + ## 外部编辑器 按 `Ctrl-G` 把当前输入内容发给外部编辑器,保存后回填到输入框,不保存则保持原样。适合需要输入大段文本或带格式内容的场景。