fix: detect Kimi Code CLI under ~/.kimi-code#274
Open
zephyr110 wants to merge 3 commits into
Open
Conversation
Prefer the official kimi-code home over legacy ~/.kimi so Settings hooks detection, install/uninstall, and session discovery work with current Kimi Code CLI installs.
Allow index-based discovery without requiring sessions/ dirs, and load recent messages from agents/main/wire.jsonl for kimi-code sessions.
Parse content-part array prompts on UserPromptSubmit, and read the kimi-code wire protocol (turn.prompt / content.part) while keeping legacy kimi-cli TurnBegin transcripts working.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
~/.kimi-code(old path was~/.kimi). Settings → Hooks correctly detects current installs again; legacy~/.kimistill works.config.toml.session_index.jsonl+ transcript), and keep the old kimi-cli path as fallback.promptonUserPromptSubmit, and read kimi-codewire.jsonl(turn.prompt/content.part) so the notch shows dialogue (legacy TurnBegin format still works).kimi-code(and similar names) as the same source askimi.Note: After changing hooks config, restart the kimi session for hooks to take effect (official behavior; a long-lived session will not pick up new hooks).
Refs: Kimi Code CLI hooks, migration guide.
中文说明
~/.kimi-code(旧版是~/.kimi)。Settings → Hooks 能正确识别新安装;旧路径仍兼容。config.toml。prompt,以及新版wire.jsonl,岛上能显示用户/助手消息。kimi-code等名称统一当作kimi。注意: 修改 hooks 配置后需要重开 kimi 会话才会生效(官方行为;长驻旧会话不会自动加载新 hooks)。
参考:Kimi Code CLI hooks、迁移指南。
Test Plan
ConfigInstallerTests(kimi home / install / uninstall) — 0 failuresKimiHookPayloadTests— content-part array prompt → chat text; plain string still worksKimiTranscriptTests— kimi-code wire + legacy TurnBegin~/.kimi-codepresent and~/.kimiabsent: detection / preferred home →~/.kimi-code~/.kimistill detects / installs / discovers as before