MoonshotAI / MoonshotAI/kimi-code

kimi-code在wsl中的图片粘贴问题

Open
#2,425 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
7.5k
Forks
1.2k
Avg merge
11h 53m
Merged PRs (30d)
350

Description

What version of Kimi Code is running?

Kimi Code v0.31.0

Which open platform/subscription were you using?

/login

Which model were you using?

K2.7 Coding Highspeed

What platform is your computer?

wsl

What issue are you seeing?

无法在cli 粘贴图片

What steps can reproduce the bug?

我遇到一个 Kimi Code CLI 在 WSL 环境下无法粘贴图片的问题,同环境下 Claude Code CLI 却可以正常粘贴。以下是详细信息和排查过程,供参考。

环境信息

• Kimi Code CLI 版本:v0.31.0
• 操作系统:Windows 11 + WSL
• 终端:Windows Terminal
• 当前模型:kimi-code/kimi-for-coding-highspeed
• 模型能力:已确认支持 image_in

问题现象

在 Kimi Code CLI 的 TUI 输入框中按 Ctrl-V 粘贴图片时,完全没有任何反应,既不报错也没有任何提示。

同环境下:
• 文本粘贴正常;
• Claude Code CLI 可以正常粘贴图片;
• Kimi 网页端也可以正常粘贴图片。

排查过程

  1. 确认剪贴板中有图片数据
    在 WSL 中通过 PowerShell 读取 Windows 剪贴板,确认存在 DeviceIndependentBitmap、image/png 等 13 种图片格式,且 System.Windows.Forms.Clipboard::GetImage() 能成功读取到图片。

  2. 确认 Kimi CLI 日志无报错
    查看 ~/.kimi-code/logs/kimi-code.log,在尝试粘贴图片时没有产生任何相关错误或警告。

  3. 分析 Kimi CLI 二进制
    对 ~/.kimi-code/bin/kimi 进行字符串分析,发现粘贴事件依赖终端的 bracketed paste 模式:

      case '[200~': key.name = 'paste-start'; break;                                                                                                                                                                                    
      case '[201~': key.name = 'paste-end'; break;                                                                                                                                                                                      
    

    但在二进制中未找到任何 Windows 剪贴板回读实现(如 powershell.exe、Get-Clipboard、clip.exe 等字符串)。

初步判断

Kimi Code CLI v0.31.0 在 WSL + Windows Terminal 环境下,图片粘贴仅依赖终端的 bracketed paste 文本通道,而图片是二进制数据,无法通过该通道正确传输。因此 Ctrl-V 粘贴图片时没有任何反应。

同环境下 Claude Code CLI 之所以正常,是因为它直接读取系统剪贴板,而不是依赖终端的 bracketed paste 模式。

当前 workaround

将图片保存为文件后,让 Kimi 直接读取文件路径。

建议

希望 Kimi Code CLI 在 WSL 环境下能像 Claude Code 一样,直接调用 Windows 剪贴板 API 读取图片二进制数据,而不是仅依赖终端的 bracketed paste 模式。

What is the expected behavior?

No response

Additional information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the source handling the terminal paste markers '[200~' and '[201~', then inspect how image input is handled in the WSL and Windows Terminal path. Reproduce the issue with Kimi Code v0.31.0 and verify that Ctrl-V inserts a clipboard image without breaking text paste.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.