feat(kimi): migrate to kimi-code v0.6.0 CLI#6
Merged
Conversation
…-cli contract)
The local `kimi` binary is now kimi-code v0.6.0 (~/.kimi-code), not the python kimi-cli. Its
one-shot `-p` mode rejects --yolo/--auto/--plan and dropped --print/--input-format/--no-thinking/
--max-steps-per-turn, and the session id is now `session_<uuid>` emitted structurally.
Runtime (packages/polycli-runtime/src/kimi.js, full rewrite):
- buildKimiInvocation: `-p <prompt> --output-format stream-json` (+ -m, + -r <id> / -C). No --yolo
(rejected with -p), no --print/--input-format (removed upstream).
- session id read STRUCTURALLY from the `{role:"meta",type:"session.resume_hint",session_id}` event
(keeps the `session_` prefix; never scans prose for a bare UUID -> no fabrication).
- deleted the dead resume machinery (resolveKimiResumeSession/readKimiLastSession/validateKimiResume
Target/kimi.json/md5-sessions-dir) — resume is delegated to the CLI; resumeLast -> -C, resume -> -r.
Also drops the resume-mismatch warning (a python-kimi quirk guard).
- auth probe drops --max-steps-per-turn (now config.toml-level) and normalizes ETIMEDOUT so a probe
timeout stays inconclusive. default-model + config path -> ~/.kimi-code/config.toml.
Host + review:
- sessions.mjs kimi purge derivation -> ~/.kimi-code/sessions/wd_<base>_<sha256(realCwd)[:12]>/<id>/
(verified on disk); storeRoot kimi -> .kimi-code/sessions.
- kimi /review is now prompt-only (like minimax): -p mode has no flag-based read-only lever, so
REVIEW_HARD_CONSTRAINTS.kimi() returns {} and REVIEW_FLAG_EXPECTATIONS.kimi drops the stale
--no-thinking/--max-steps tokens. A drift CHECK now guards the load-bearing -p/--output-format
invocation flags (resolves the review-drift "kimi uncovered" finding).
- prompt-runtime ask path for kimi is unconstrained (no -p-compatible constraint flags exist).
Tests: kimi.test.js rewritten for the new contract; integration/prompt-runtime/sessions/review-flags
/consistency/exports tests updated. npm test 451/451; companion bundles byte-identical.
Doc-debt (follow-up): the kimi-cli-runtime / kimi-prompting skill prose + provider-paths.md +
polycli-v1-public-surface.md still describe the legacy python kimi-cli flags; advisory only, not
the code contract. Tracked in memory project_deep_review_2026_06_02.
…ssion parse Addresses the pre-merge Codex review gate for PR #6. - resume flag (real bug): buildKimiInvocation emitted `-r <id>` for resume-by-id, but kimi-code v0.6.0 has NO `-r` flag — `kimi --help` shows resume-by-id is `-S, --session [id]` (continue-last `-C` is correct). `-r` would be rejected at runtime, and the path IS reachable (`polycli rescue --provider kimi --resume <id>` threads through to it, per integration test). Switch to `--session <id>`; update unit + integration assertions and the comment. - session-id parse (hardening): parseKimiStreamText adopted session_id from ANY `role:"meta"` event; the documented source is specifically the `{role:"meta", type:"session.resume_hint", session_id:"session_<uuid>"}` event. Require `type === "session.resume_hint"` so an unrelated meta event carrying a session_id is not promoted. Add a regression test. - fragile review test (latent failure exposed by committing the migration): two `review --base HEAD~1 --scope branch` integration tests asserted `doesNotMatch(argv.join(" "), /--no-thinking|--max-steps.../)`. The reviewed diff is embedded in the single `-p <prompt>` element and legitimately mentions those removed flags as deleted-code text, so the substring check false-positives on this very migration's diff. Check the flags as discrete argv tokens (argv.includes) instead — same intent, no false positive. Codex false-positives (verified, NOT changed): #1 `-p`+`--plan/--auto/--yolo` combination is latent-only — no caller injects those (review extraArgTokens empty; prompt-runtime kimi-ask is plain `-p`); #4 the `~/.kimi/` literal is an intentional migration-history comment, code uses `~/.kimi-code/`. npm test 452/452 (was 451; +1 session-parse regression). 5 bundles byte-identical.
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.
Branch 2 of 3. Adapts the kimi provider to kimi-code v0.6.0 (the local
kimiis no longer the python kimi-cli).Why
kimi-code's one-shot
-pmode rejects--yolo/--auto/--planand dropped--print/--input-format/--no-thinking/--max-steps-per-turn; the session store moved to~/.kimi-code/and the session id is nowsession_<uuid>emitted as a structuredsession.resume_hintevent. The previous adapter was built for the python CLI and would error against kimi-code.Runtime (
kimi.js, full rewrite)-p <prompt> --output-format stream-json(+-m, +-r <id>/-C). No--yolo/--print/--input-format.session_prefix; never scans prose → no fabrication).resolveKimiResumeSession/kimi.json/md5 sessions dir/validateKimiResumeTarget); resume delegated to the CLI (-C/-r <id>). Dropped the python-era resume-mismatch warning.--max-steps-per-turn(now config-level) + normalizes ETIMEDOUT (probe timeout stays inconclusive). Config/default-model path →~/.kimi-code/config.toml.Host + review
sessions.mjskimi purge derivation →~/.kimi-code/sessions/wd_<base>_<sha256(realCwd)[:12]>/<id>/(verified on disk)./reviewis now prompt-only (like minimax):-pmode has no read-only flag, soREVIEW_HARD_CONSTRAINTS.kimi()returns{}. A drift CHECK now guards the load-bearing-p/--output-formatflags — this also resolves the deep-review "kimi uncovered in drift checks" finding.-p-compatible constraint flags).Validation
npm test451/451; companion bundles byte-identical.Doc-debt (follow-up)
The kimi-cli-runtime / kimi-prompting skill prose +
provider-paths.md+polycli-v1-public-surface.mdstill describe the legacy python flags. Advisory only (not the code contract); flagged for a doc sweep.