kimi-plugin-cc 2.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/.agents/plugins/marketplace.json +20 -0
  2. package/.claude-plugin/marketplace.json +16 -0
  3. package/.claude-plugin/plugin.json +32 -0
  4. package/CHANGELOG.md +1096 -0
  5. package/LICENSE +201 -0
  6. package/README.md +772 -0
  7. package/agents/kimi-ask.md +82 -0
  8. package/agents/kimi-challenge.md +82 -0
  9. package/agents/kimi-pursue.md +91 -0
  10. package/agents/kimi-rescue.md +85 -0
  11. package/agents/kimi-review.md +82 -0
  12. package/agents/kimi-swarm-write.md +92 -0
  13. package/agents/kimi-swarm.md +83 -0
  14. package/commands/README.md +16 -0
  15. package/commands/ask.md +32 -0
  16. package/commands/cancel.md +17 -0
  17. package/commands/challenge.md +29 -0
  18. package/commands/pursue.md +37 -0
  19. package/commands/replay.md +13 -0
  20. package/commands/rescue.md +32 -0
  21. package/commands/result.md +13 -0
  22. package/commands/review.md +29 -0
  23. package/commands/setup.md +23 -0
  24. package/commands/status.md +13 -0
  25. package/commands/swarm.md +38 -0
  26. package/dist/background-spawn.js +224 -0
  27. package/dist/cli-cancellation.js +43 -0
  28. package/dist/cli-client.js +845 -0
  29. package/dist/commands/ask.js +327 -0
  30. package/dist/commands/cancel.js +178 -0
  31. package/dist/commands/cli-helpers.js +112 -0
  32. package/dist/commands/models.js +140 -0
  33. package/dist/commands/not-implemented.js +4 -0
  34. package/dist/commands/pursue.js +311 -0
  35. package/dist/commands/registry.js +87 -0
  36. package/dist/commands/repair-sessions.js +159 -0
  37. package/dist/commands/replay.js +123 -0
  38. package/dist/commands/rescue.js +333 -0
  39. package/dist/commands/result.js +58 -0
  40. package/dist/commands/review-gate.js +393 -0
  41. package/dist/commands/review.js +218 -0
  42. package/dist/commands/setup.js +1132 -0
  43. package/dist/commands/status.js +27 -0
  44. package/dist/commands/swarm.js +576 -0
  45. package/dist/commands/worker.js +31 -0
  46. package/dist/companion.js +114 -0
  47. package/dist/config.js +22 -0
  48. package/dist/errors.js +40 -0
  49. package/dist/git.js +215 -0
  50. package/dist/hooks/approval-hook.js +112 -0
  51. package/dist/hooks/approval-policy.js +254 -0
  52. package/dist/hooks/config-safety.js +637 -0
  53. package/dist/hooks/install-paths.js +504 -0
  54. package/dist/hooks/install.js +281 -0
  55. package/dist/hooks/managed-block.js +745 -0
  56. package/dist/hooks/review-gate-stop.js +19 -0
  57. package/dist/job-store.js +559 -0
  58. package/dist/jobs.js +202 -0
  59. package/dist/kimi-command.js +72 -0
  60. package/dist/kimi-engine.js +624 -0
  61. package/dist/kimi-errors.js +220 -0
  62. package/dist/kimi-home.js +9 -0
  63. package/dist/kimi-timeouts.js +68 -0
  64. package/dist/kimi-version-probe.js +1410 -0
  65. package/dist/logging.js +22 -0
  66. package/dist/native-v2-preflight.js +417 -0
  67. package/dist/package.json +1 -0
  68. package/dist/parsing.js +553 -0
  69. package/dist/paths.js +27 -0
  70. package/dist/plugin-data.js +98 -0
  71. package/dist/process-tree.js +448 -0
  72. package/dist/render.js +159 -0
  73. package/dist/rescue-approval.js +951 -0
  74. package/dist/schemas/review-gate-output.js +43 -0
  75. package/dist/session-title.js +293 -0
  76. package/dist/stream-json.js +498 -0
  77. package/dist/types.js +1 -0
  78. package/dist/vendor/shell-quote/LICENSE +24 -0
  79. package/dist/vendor/shell-quote/index.js +1 -0
  80. package/dist/vendor/shell-quote/parse.js +229 -0
  81. package/dist/vendor/smol-toml/LICENSE +24 -0
  82. package/dist/vendor/smol-toml/date.js +127 -0
  83. package/dist/vendor/smol-toml/error.js +63 -0
  84. package/dist/vendor/smol-toml/extract.js +100 -0
  85. package/dist/vendor/smol-toml/parse.js +148 -0
  86. package/dist/vendor/smol-toml/primitive.js +179 -0
  87. package/dist/vendor/smol-toml/struct.js +184 -0
  88. package/dist/vendor/smol-toml/util.js +113 -0
  89. package/dist/version.js +7 -0
  90. package/docs/migration.md +215 -0
  91. package/docs/models.md +82 -0
  92. package/docs/registry-releases.md +70 -0
  93. package/docs/safety.md +318 -0
  94. package/docs/session-visibility.md +32 -0
  95. package/hooks/README.md +9 -0
  96. package/hooks/hooks.json +16 -0
  97. package/package.json +67 -0
  98. package/plugins/kimi-codex/.codex-plugin/plugin.json +39 -0
  99. package/plugins/kimi-codex/dist/background-spawn.js +224 -0
  100. package/plugins/kimi-codex/dist/cli-cancellation.js +43 -0
  101. package/plugins/kimi-codex/dist/cli-client.js +845 -0
  102. package/plugins/kimi-codex/dist/commands/ask.js +327 -0
  103. package/plugins/kimi-codex/dist/commands/cancel.js +178 -0
  104. package/plugins/kimi-codex/dist/commands/cli-helpers.js +112 -0
  105. package/plugins/kimi-codex/dist/commands/models.js +140 -0
  106. package/plugins/kimi-codex/dist/commands/not-implemented.js +4 -0
  107. package/plugins/kimi-codex/dist/commands/pursue.js +311 -0
  108. package/plugins/kimi-codex/dist/commands/registry.js +87 -0
  109. package/plugins/kimi-codex/dist/commands/repair-sessions.js +159 -0
  110. package/plugins/kimi-codex/dist/commands/replay.js +123 -0
  111. package/plugins/kimi-codex/dist/commands/rescue.js +333 -0
  112. package/plugins/kimi-codex/dist/commands/result.js +58 -0
  113. package/plugins/kimi-codex/dist/commands/review-gate.js +393 -0
  114. package/plugins/kimi-codex/dist/commands/review.js +218 -0
  115. package/plugins/kimi-codex/dist/commands/setup.js +1132 -0
  116. package/plugins/kimi-codex/dist/commands/status.js +27 -0
  117. package/plugins/kimi-codex/dist/commands/swarm.js +576 -0
  118. package/plugins/kimi-codex/dist/commands/worker.js +31 -0
  119. package/plugins/kimi-codex/dist/companion.js +114 -0
  120. package/plugins/kimi-codex/dist/config.js +22 -0
  121. package/plugins/kimi-codex/dist/errors.js +40 -0
  122. package/plugins/kimi-codex/dist/git.js +215 -0
  123. package/plugins/kimi-codex/dist/hooks/approval-hook.js +112 -0
  124. package/plugins/kimi-codex/dist/hooks/approval-policy.js +254 -0
  125. package/plugins/kimi-codex/dist/hooks/config-safety.js +637 -0
  126. package/plugins/kimi-codex/dist/hooks/install-paths.js +504 -0
  127. package/plugins/kimi-codex/dist/hooks/install.js +281 -0
  128. package/plugins/kimi-codex/dist/hooks/managed-block.js +745 -0
  129. package/plugins/kimi-codex/dist/hooks/review-gate-stop.js +19 -0
  130. package/plugins/kimi-codex/dist/job-store.js +559 -0
  131. package/plugins/kimi-codex/dist/jobs.js +202 -0
  132. package/plugins/kimi-codex/dist/kimi-command.js +72 -0
  133. package/plugins/kimi-codex/dist/kimi-engine.js +624 -0
  134. package/plugins/kimi-codex/dist/kimi-errors.js +220 -0
  135. package/plugins/kimi-codex/dist/kimi-home.js +9 -0
  136. package/plugins/kimi-codex/dist/kimi-timeouts.js +68 -0
  137. package/plugins/kimi-codex/dist/kimi-version-probe.js +1410 -0
  138. package/plugins/kimi-codex/dist/logging.js +22 -0
  139. package/plugins/kimi-codex/dist/native-v2-preflight.js +417 -0
  140. package/plugins/kimi-codex/dist/package.json +1 -0
  141. package/plugins/kimi-codex/dist/parsing.js +553 -0
  142. package/plugins/kimi-codex/dist/paths.js +27 -0
  143. package/plugins/kimi-codex/dist/plugin-data.js +98 -0
  144. package/plugins/kimi-codex/dist/process-tree.js +448 -0
  145. package/plugins/kimi-codex/dist/render.js +159 -0
  146. package/plugins/kimi-codex/dist/rescue-approval.js +951 -0
  147. package/plugins/kimi-codex/dist/schemas/review-gate-output.js +43 -0
  148. package/plugins/kimi-codex/dist/session-title.js +293 -0
  149. package/plugins/kimi-codex/dist/stream-json.js +498 -0
  150. package/plugins/kimi-codex/dist/types.js +1 -0
  151. package/plugins/kimi-codex/dist/vendor/shell-quote/LICENSE +24 -0
  152. package/plugins/kimi-codex/dist/vendor/shell-quote/index.js +1 -0
  153. package/plugins/kimi-codex/dist/vendor/shell-quote/parse.js +229 -0
  154. package/plugins/kimi-codex/dist/vendor/smol-toml/LICENSE +24 -0
  155. package/plugins/kimi-codex/dist/vendor/smol-toml/date.js +127 -0
  156. package/plugins/kimi-codex/dist/vendor/smol-toml/error.js +63 -0
  157. package/plugins/kimi-codex/dist/vendor/smol-toml/extract.js +100 -0
  158. package/plugins/kimi-codex/dist/vendor/smol-toml/parse.js +148 -0
  159. package/plugins/kimi-codex/dist/vendor/smol-toml/primitive.js +179 -0
  160. package/plugins/kimi-codex/dist/vendor/smol-toml/struct.js +184 -0
  161. package/plugins/kimi-codex/dist/vendor/smol-toml/util.js +113 -0
  162. package/plugins/kimi-codex/dist/version.js +7 -0
  163. package/plugins/kimi-codex/scripts/companion.sh +37 -0
  164. package/plugins/kimi-codex/scripts/review-gate-hook.sh +32 -0
  165. package/plugins/kimi-codex/skills/kimi-ask/SKILL.md +31 -0
  166. package/plugins/kimi-codex/skills/kimi-ask/agents/openai.yaml +6 -0
  167. package/plugins/kimi-codex/skills/kimi-cancel/SKILL.md +25 -0
  168. package/plugins/kimi-codex/skills/kimi-cancel/agents/openai.yaml +6 -0
  169. package/plugins/kimi-codex/skills/kimi-challenge/SKILL.md +31 -0
  170. package/plugins/kimi-codex/skills/kimi-challenge/agents/openai.yaml +6 -0
  171. package/plugins/kimi-codex/skills/kimi-pursue/SKILL.md +30 -0
  172. package/plugins/kimi-codex/skills/kimi-pursue/agents/openai.yaml +6 -0
  173. package/plugins/kimi-codex/skills/kimi-replay/SKILL.md +25 -0
  174. package/plugins/kimi-codex/skills/kimi-replay/agents/openai.yaml +6 -0
  175. package/plugins/kimi-codex/skills/kimi-rescue/SKILL.md +30 -0
  176. package/plugins/kimi-codex/skills/kimi-rescue/agents/openai.yaml +6 -0
  177. package/plugins/kimi-codex/skills/kimi-result/SKILL.md +25 -0
  178. package/plugins/kimi-codex/skills/kimi-result/agents/openai.yaml +6 -0
  179. package/plugins/kimi-codex/skills/kimi-review/SKILL.md +31 -0
  180. package/plugins/kimi-codex/skills/kimi-review/agents/openai.yaml +6 -0
  181. package/plugins/kimi-codex/skills/kimi-setup/SKILL.md +32 -0
  182. package/plugins/kimi-codex/skills/kimi-setup/agents/openai.yaml +6 -0
  183. package/plugins/kimi-codex/skills/kimi-status/SKILL.md +25 -0
  184. package/plugins/kimi-codex/skills/kimi-status/agents/openai.yaml +6 -0
  185. package/plugins/kimi-codex/skills/kimi-swarm/SKILL.md +31 -0
  186. package/plugins/kimi-codex/skills/kimi-swarm/agents/openai.yaml +6 -0
  187. package/plugins/kimi-codex/skills/kimi-swarm-write/SKILL.md +32 -0
  188. package/plugins/kimi-codex/skills/kimi-swarm-write/agents/openai.yaml +6 -0
  189. package/scripts/companion.sh +37 -0
  190. package/scripts/review-gate-hook.sh +32 -0
@@ -0,0 +1,215 @@
1
+ # Compatibility and upgrades
2
+
3
+ For plugin 2.0.3, use Kimi Code CLI 2.0.1. The plugin also certifies exact native-v2 versions `0.42.0`, `0.43.0`, `0.43.1`, and `2.0.0` for all eight operations. It does not automatically accept later patches or minor releases.
4
+
5
+ Explicitly pinned legacy-v1 binaries remain supported within `KIMI_TESTED_MINORS`, through 0.41.x, subject to each operation's minimum version. The [runtime table](../runtime/kimi-engine.ts) is the authority.
6
+
7
+ Use the [README installation and update steps](../README.md) for Claude Code or Codex. Model and provider choices are covered in the [model setup guide](./models.md). Do not change your host application's authentication to configure Kimi.
8
+
9
+ ## Plugin versions and upgrades
10
+
11
+ Plugin versions advance independently using ordinary SemVer. Plugin 2.0.3 certifies
12
+ exact Kimi Code CLI 2.0.1; the runtime table records that mapping. Each compatible
13
+ maintenance or certification update takes the next unused plugin patch. Published
14
+ versions and tags are never reused. Every upstream patch requires its own certification.
15
+ The native-v2 no-plan profile, plugin/marketplace IDs and existing job store are preserved.
16
+
17
+ After updating the plugin, run Claude Code `/kimi:setup` or Codex `$kimi-setup`
18
+ from that host's active install to re-pin its version-stamped hook path, then
19
+ run setup with `--check`. This fixes path drift, not policy omissions in an older installed plugin. Older coexisting hooks still veto pursue goal-status tools; update each host only when authorized. Keep `default_plan_mode` absent or false. Upgrades
20
+ from pre-1.10 releases must also follow the historical native-v2 migration section below.
21
+
22
+ ## Historical migration instructions
23
+
24
+ <details>
25
+ <summary>Earlier migrations from the Python CLI and legacy engine</summary>
26
+
27
+ These sections record earlier upgrades. Old tags, paths, and installation commands are historical examples, not the current installation procedure. Follow the current guidance above for the current release.
28
+
29
+ ## Migrating from v0.4 to v1.0
30
+
31
+ v1.0 of kimi-plugin-cc targets the **kimi-code** Node.js binary (Moonshot's successor to Kimi CLI). The v0.4.x line targeted the Python **Kimi CLI** over its Wire JSON-RPC transport. kimi-code dropped the Wire transport from its first release, so v1.0 is a hard cut rather than a backwards-compatible upgrade.
32
+
33
+ If you're already running v0.4.x with the Python Kimi CLI, you have a choice:
34
+
35
+ - **Stay on v0.4** if you depend on `kimi --wire`. The [`v0.4.0`](https://github.com/linxule/kimi-plugin-cc/releases/tag/v0.4.0) tag is the stable reference point; a `v0.4-maintenance` branch is cut from that tag for ongoing fixes (once published, pin to it via `linxule/kimi-plugin-cc@v0.4-maintenance`).
36
+ - **Upgrade to v1.0** if you've installed (or are willing to install) kimi-code. v1.0 gets the new safety story (PreToolUse hook), kimi-code's vis-server integration for free, and a leaner subprocess transport.
37
+
38
+ ## What changes between v0.4 and v1.0
39
+
40
+ | | v0.4 | v1.0 |
41
+ |---|---|---|
42
+ | Backing CLI | Python [Kimi CLI](https://github.com/MoonshotAI/kimi-cli) | [kimi-code](https://kimi.com/code/docs) (Node.js) |
43
+ | Transport | `kimi --wire` (JSON-RPC over stdio) | `kimi -p --output-format stream-json` (subprocess + NDJSON) |
44
+ | Per-command safety | YAML agent profiles (`exclude_tools`) shipped in the plugin | PreToolUse hook installed in `~/.kimi-code/config.toml` |
45
+ | Session id | Client-assigned UUID, passed via `--session` | Server-minted, captured from kimi's stream-json `session.resume_hint` record (stderr announce fallback) |
46
+ | Web UI integration | `kimi web` + PATCH `/api/sessions/{id}` for pre-run human-readable titles | Shared Desktop/Web session store, repaired prompt previews and replaceable fallback titles for native-v2 sessions |
47
+ | Replay log format | Wire JSON-RPC events (`{direction, message}`) | cli-client NDJSON (`{event, record}`) |
48
+ | Marketplace name | `kimi-marketplace` (plugin: `kimi`) — unchanged | same `kimi-marketplace` / `kimi` (v1 upgrades in place) |
49
+ | Rescue allowlist | In-band approval policy on the Wire client | Out-of-band via the PreToolUse hook (same allowlist code) |
50
+
51
+ The marketplace + plugin IDs are unchanged from v0.4, so an existing install can update in place — but only after kimi-code is installed locally. Without kimi-code the new transport has nothing to spawn, so the order matters: install kimi-code first, then update the plugin.
52
+
53
+ ## Upgrade procedure
54
+
55
+ ### 1. Install kimi-code
56
+
57
+ Follow Moonshot's install steps at [kimi.com/code/docs](https://kimi.com/code/docs). Verify it works on its own:
58
+
59
+ ```
60
+ kimi --version
61
+ kimi -p "Reply READY"
62
+ ```
63
+
64
+ ### 2. Audit your kimi-plugin-cc env block
65
+
66
+ If you set any of these env vars for v0.4, review them before continuing — v1.0 reads the same vars but with different effective semantics:
67
+
68
+ | Env var | Notes |
69
+ |---|---|
70
+ | `KIMI_PLUGIN_CC_KIMI_BIN` | Path to the kimi binary. Was the Python `kimi` in v0.4; should now point at the kimi-code binary (typically `~/.kimi-code/bin/kimi`). Unset to use the kimi-code on `PATH`. |
71
+ | `KIMI_PLUGIN_CC_KIMI_PREFIX_ARGS` | JSON array of args prepended to every kimi spawn. Was a Wire-mode flag carrier in v0.4; in v1 it's still honored but the v0.4 contents (`--wire`, `--session`, `--agent-file`) are gone. Unset unless you have a specific override reason. |
72
+ | `KIMI_PLUGIN_CC_NODE_BIN` | Absolute path to the Node binary used to run the companion AND the hook script. v1 setup hard-requires absolute. |
73
+ | `KIMI_PLUGIN_CC_HOOK_SCRIPT` | Override for the hook script path written into `~/.kimi-code/config.toml`. Tests / advanced users only. |
74
+ | `KIMI_CODE_HOME` | Override for the kimi-code config directory (default `~/.kimi-code`). New in v1.0 — recognized by setup, install verifier, and the hook itself. |
75
+ | `KIMI_PLUGIN_CC_SKIP_HOOK_CHECK` | Bypasses every hook-verification refusal gate (and the review-gate skip), restoring un-enforced `permission: auto` execution. Only set for tests or deliberate diagnostics. |
76
+ | `CLAUDE_PLUGIN_DATA` | Plugin data root. Unchanged from v0.4. |
77
+
78
+ ### 3. Update the plugin in place
79
+
80
+ From an existing v0.4 install:
81
+
82
+ ```
83
+ /plugin marketplace update linxule
84
+ # then in the /plugin UI: select kimi → "Update now"
85
+ ```
86
+
87
+ Or fresh install on a machine that doesn't have v0.4:
88
+
89
+ ```
90
+ /plugin marketplace add linxule/kimi-plugin-cc
91
+ /plugin install kimi@kimi-marketplace
92
+ ```
93
+
94
+ (v0.4 ALPHA NOTE: v1.0.0-alpha.1 was briefly tagged with renamed IDs `kimi-v1` / `kimi-marketplace-v1`. The rename was rolled back in v1.0.0-alpha.2. If you happened to install alpha.1 by those names, uninstall first: `/plugin uninstall kimi-v1`, `/plugin marketplace remove kimi-marketplace-v1`, then follow the procedure above.)
95
+
96
+ ### 4. Run setup
97
+
98
+ ```
99
+ /kimi:setup
100
+ ```
101
+
102
+ This writes the PreToolUse hook to `~/.kimi-code/config.toml` and runs a two-layer probe (direct + via `/bin/sh -c`) to verify the hook fires and denies as expected. If setup fails, look at the `Probe:` line in the output. Common failure codes (the runtime emits these as `SETUP_*` errors):
103
+
104
+ - **Bad `KIMI_PLUGIN_CC_NODE_BIN` override** — v1 setup requires the override to be an absolute path; relative paths (`node`) are rejected with `SETUP_NODE_BIN_NOT_ABSOLUTE`.
105
+ - **Orphan markers in `~/.kimi-code/config.toml`** from a manual edit or aborted earlier setup. Run `/kimi:setup --uninstall` to clean up, then `/kimi:setup` again. Code: `SETUP_ORPHAN_MARKERS`.
106
+ - **Duplicate managed blocks** from two setup runs racing. Same fix: `/kimi:setup --uninstall` + `/kimi:setup`. Code: `SETUP_DUPLICATE_BLOCKS`.
107
+ - **Hook script path contains characters TOML can't represent** (quotes, control chars). Reinstall to a path without these, or set `KIMI_PLUGIN_CC_HOOK_SCRIPT` to a safe path. Code: `SETUP_HOOK_PATH_UNSAFE`.
108
+ - **Probe timed out** (5s budget). Usually means kimi-code or the Node binary is wedged on cold start. Re-run; if persistent, file an issue with `/kimi:setup --check` output.
109
+ - **Hook script not found** — `dist/hooks/approval-hook.js` is missing. Reinstall the plugin or run `bun run build` if you're on a local clone. Code: `SETUP_HOOK_SCRIPT_MISSING`.
110
+
111
+ ### 5. Verify
112
+
113
+ ```
114
+ /kimi:setup --check
115
+ ```
116
+
117
+ Reports the install state without writing. Run `/kimi:review` against a small diff to confirm the round-trip works end-to-end.
118
+
119
+ ### Local-clone install upgrade
120
+
121
+ If you're running the plugin via `claude --plugin-dir ~/kimi-plugin-cc` rather than the marketplace:
122
+
123
+ ```bash
124
+ cd ~/kimi-plugin-cc
125
+ git fetch --tags origin
126
+ git checkout v1.0.0-alpha.2
127
+ # Verify dist/ is in sync; if you previously deleted it locally, rebuild:
128
+ ls dist/hooks/approval-hook.js >/dev/null || bun run build
129
+ # Restart Claude Code so the new agents/ and dist/ register
130
+ ```
131
+
132
+ Then run `/kimi:setup` in your Claude Code session. The local clone uses the same managed-block installer; no marketplace operations needed.
133
+
134
+ ### Using both Claude Code and Codex (v1.7.0+)
135
+
136
+ Claude Code and Codex install the plugin to **different, version-stamped paths**
137
+ but share one `~/.kimi-code/config.toml`. As of **v1.7.0** each host manages its
138
+ **own** host-scoped PreToolUse block (`# === BEGIN kimi-plugin-cc-managed:claude-code …`
139
+ vs `:codex`), so:
140
+
141
+ - Run **`/kimi:setup` in Claude Code AND `$kimi-setup` in Codex** — once each.
142
+ They no longer clobber each other; both blocks coexist and each host verifies
143
+ its own. (Before v1.7.0 a single shared block was overwritten every time you
144
+ switched hosts, which is why setup seemed to "need redoing.")
145
+ - **One-time cleanup on upgrade to v1.7.0:** update the plugin in *both* hosts,
146
+ then run setup in each. The first setup adopts your old un-suffixed block and
147
+ prunes orphaned hook entries left by earlier installs.
148
+ - `/kimi:setup --uninstall` removes only the current host's block. Use
149
+ `/kimi:setup --uninstall --all` to remove *every* host's block from the shared
150
+ config (a deliberate full nuke — it clears blocks for **all** hosts, not just
151
+ this one).
152
+
153
+ > **⚠️ Upgrade both hosts before re-running setup.** During the window where one
154
+ > host is on v1.7.0+ and the other is still on ≤1.6.5, running setup on the OLD
155
+ > host writes an un-suffixed block that can overwrite the block the new host just
156
+ > migrated, re-creating the clobber (or leaving a duplicate the new host rejects
157
+ > with `SETUP_DUPLICATE_BLOCKS`). Update **both** Claude Code and Codex to v1.7.0+
158
+ > first, then run setup in each. If the config ever looks tangled, the clean-slate
159
+ > escape hatch is `/kimi:setup --uninstall --all` followed by setup in each host.
160
+
161
+ ## Data and session continuity
162
+
163
+ - **SQLite job rows** from v0.4 remain in `${CLAUDE_PLUGIN_DATA}/kimi-plugin-cc/state.db`. They're still visible to `/kimi:status` and `/kimi:result`, but `/kimi:replay` will report `REPLAY_LOG_UNREADABLE` on the v0.4 wire logs — v1.0's replay parser doesn't understand the Wire JSON-RPC shape. Archive or delete the database if you don't need v0.4 history.
164
+ - **Kimi CLI sessions** under `~/.kimi/sessions/` are independent of kimi-code's `~/.kimi-code/sessions/`. v1.0's `--resume` will not see v0.4 sessions.
165
+ - **Plugin config** (`${CLAUDE_PLUGIN_DATA}/kimi-plugin-cc/config.json` — only `reviewGateEnabled` lives here) carries over unchanged.
166
+
167
+ ## Rollback
168
+
169
+ If something is wrong, the v0.4 install is one step away:
170
+
171
+ ```
172
+ /kimi:setup --uninstall # removes the v1.0 PreToolUse hook
173
+ /plugin uninstall kimi
174
+ /plugin marketplace remove kimi-marketplace
175
+ # If the v0.4-maintenance branch is published:
176
+ /plugin marketplace add linxule/kimi-plugin-cc@v0.4-maintenance
177
+ # Otherwise, pin to the v0.4.0 tag:
178
+ /plugin marketplace add linxule/kimi-plugin-cc@v0.4.0
179
+ /plugin install kimi@kimi-marketplace
180
+ ```
181
+
182
+ Claude Code's marketplace tooling uses `@ref` to pin a GitHub shorthand to a branch or tag. Your Python Kimi CLI install is untouched — v1.0 only edits `~/.kimi-code/config.toml`, never `~/.kimi/*`.
183
+
184
+ ## What's gone
185
+
186
+ - The `--wire`, `--session`, and `--agent-file` invocation shape. v1.0 uses `kimi -p` only.
187
+ - The YAML agent profiles in `runtime/agents/`. The plugin doesn't ship Kimi-side profiles in v1.0; per-command safety is enforced exclusively by the PreToolUse hook.
188
+ - The Wire-protocol replay path. The runtime no longer parses JSON-RPC turn events.
189
+ - The v0.4 pre-run `Kimi Task: ...` title assignment path through Kimi CLI / `kimi web`. v1 uses `kimi -p`, whose session id is minted only after the run, so the plugin cannot name the session before spawn. Instead, after Kimi announces the session id and the run settles, the runtime syncs a fallback title such as `Kimi Ask: ...`, repairs missing native-v2 prompt previews, and notifies the Desktop/Web index. Native-v2 fallback titles remain eligible for native generation; manual and already-generated titles are preserved. Internal `review_gate` Stop-hook sessions are intentionally excluded. See [session visibility and native titles](session-visibility.md) for generation limits and repair of older plugin sessions.
190
+
191
+ ## What's new
192
+
193
+ - A two-layer setup probe that catches `node`-not-on-PATH failure modes before they become silent fail-opens.
194
+ - Workspace-bound rescue safety enforced by a hook that the plugin sets `KIMI_PLUGIN_CC_CMD=rescue` for. The hook only enforces the allowlist when that env var is set — kimi-code invocations from outside the plugin (e.g., direct user `kimi -p` calls) keep kimi-code's default permission posture, unrestricted by the plugin. The allowlist's job is to scope plugin-driven rescue, not to police all uses of kimi-code on the system.
195
+ - `/kimi:setup --check` and `/kimi:setup --uninstall` for state inspection and cleanup.
196
+ - Stream-json logs are easier to grep than Wire JSON-RPC dumps when you need to debug a job after the fact.
197
+
198
+ If you hit problems, file an issue with the output of `/kimi:setup --check` and the contents of the managed block in `~/.kimi-code/config.toml` (the block is between the BEGIN and END markers — don't paste the rest of your kimi-code config).
199
+
200
+ ## Upgrading to 1.10 (native agent-core-v2, kimi-code 0.42.0)
201
+
202
+ This release changes behaviour that earlier 1.x users may depend on. Strictly by semver it is a major; it ships as 1.10.0 because the plugin is upgraded in place through the marketplace and its 1.x line has always advanced compat by minor releases.
203
+
204
+ - **Certification is now per EXACT kimi-code version, not per minor.** Native v2 is certified at `0.42.0` only (v1.10.0; v1.10.3 adds `0.43.0` and `0.43.1`). When kimi-code publishes a newer version, every model-spawning command refuses with `KIMI_CAPABILITY_NOT_CERTIFIED` until a plugin release certifies it — before 1.10, a patch release inside a tested minor kept working. kimi-code self-upgrades in the background, so expect this on the next upstream patch; pin `KIMI_PLUGIN_CC_KIMI_BIN` to a certified binary if you need continuity, and watch for the next plugin release.
205
+ - **Sessions created before 1.10 cannot be resumed on 0.42.0.** `ask --resume`, `ask -r`, `rescue --resume` and rescue's implicit latest-session reuse refuse (`KIMI_SESSION_LINEAGE_UNKNOWN` / `KIMI_SESSION_ENGINE_MISMATCH`) — the v1 engine no longer exists in the binary, so nothing could replay those sessions. Nothing is deleted; `/kimi:status`, `/kimi:result` and `/kimi:replay` still work on the old jobs. Start fresh sessions.
206
+ - **`default_plan_mode = true` (any spelling) in `~/.kimi-code/config.toml` now blocks every command** (`CLI_V2_PLAN_MODE_CONFIGURED`). On the old forced-v1 path that setting was harmless; on native v2 it would arm the one code path that bypasses the safety hook. Set it to `false` or remove it. `/kimi:setup` cannot fix this one.
207
+ - **`KIMI_PLUGIN_CC_KIMI_PREFIX_ARGS` may no longer contain kimi flags** (`-r`, `-c`/`-C`, `-S`, `-p`, `-m`, `--plan`, `--yolo`, `--agent`, `--add-dir`, …) — `INVALID_ENV`. The prefix is a launcher shim only (e.g. `["--import","tsx",…]`).
208
+ - **`[experimental] tower` / `subagent_fork` and `KIMI_CODE_EXPERIMENTAL_FLAG` refuse before spawn** (`CLI_V2_EXPERIMENTAL_UNSAFE` / `CLI_V2_HOOK_ORDER_UNSAFE`). Unset them for plugin-managed runs.
209
+ - **Still on kimi-code ≤ 0.41.x?** Nothing changes for you: those versions route to the legacy-v1 engine exactly as before. But the plugin certifies them only for an explicitly pinned binary — kimi-code's auto-update will move you to 0.42.x, at which point the notes above apply.
210
+
211
+ No action for the job store (one additive nullable column, migrated automatically) or the hook policy (unchanged allowlists). As with every release, run `/kimi:setup` (or `$kimi-setup`) after updating so the hook is re-pinned to the new install path — a `kimi login` also strips the managed-block markers, and setup restores them.
212
+
213
+ None of these refusals is repaired by `/kimi:setup`; all of them carry `retryable_after_setup: false` explicitly from 1.10.1 (an absent field must still be treated as `false`). They are catalogued with remedies in [docs/safety.md § Refusal codes](./safety.md#refusal-codes-of-the-native-v2-contract-v1100).
214
+
215
+ </details>
package/docs/models.md ADDED
@@ -0,0 +1,82 @@
1
+ # Models and provider setup
2
+
3
+ The plugin uses your configured Kimi model by default. You can ask for a different
4
+ configured model for one task without changing that default.
5
+
6
+ ## See configured models
7
+
8
+ In Claude Code, run `/kimi:setup --models`. In Codex, ask `$kimi-setup` to list
9
+ models. The underlying command is:
10
+
11
+ ```sh
12
+ "<plugin-root>/scripts/companion.sh" setup --models
13
+ "<plugin-root>/scripts/companion.sh" setup --models --json
14
+ ```
15
+
16
+ This lists local model aliases, provider IDs/types, the saved default, and any
17
+ `KIMI_MODEL_NAME` default overlay inherited by the companion. It also reports
18
+ whether secondary-model settings exist. It does not contact providers, read the
19
+ OAuth store, write configuration, or test authentication. Configured entries
20
+ are not a guarantee of working credentials, model access, or tool support.
21
+ Provider catalogs refreshed by Kimi may add models not yet present locally.
22
+
23
+ ## Choose a model for a task
24
+
25
+ Say “review this with my configured fast model” or pass its exact alias:
26
+
27
+ ```text
28
+ /kimi:review -m 'my-provider/my-model' review this diff
29
+ /kimi:ask -m 'my-provider/my-model' explain the cache
30
+ ```
31
+
32
+ The Claude agents and Codex skills list models when you request a model in
33
+ natural language. They select a unique configured match, ask when there are
34
+ several, and guide setup when there is none. They do not guess model IDs or
35
+ silently substitute the default after an error. An explicit `-m` remains a
36
+ pass-through alias, so upstream can resolve it or report an error.
37
+
38
+ Omitting `-m` uses the default for a **fresh** session. A resumed session keeps
39
+ its previous model unless you supply `-m`. The optional review gate also uses
40
+ the default unless `KIMI_PLUGIN_CC_REVIEW_GATE_MODEL` explicitly selects an alias.
41
+ Swarm `-m` selects the coordinator; upstream `[secondary_model]` settings can
42
+ select different models for its children.
43
+
44
+ ## Add a provider or change the saved default
45
+
46
+ Open native `kimi` using the same `KIMI_CODE_HOME` as the plugin:
47
+
48
+ 1. For a Kimi subscription, use `/login`.
49
+ 2. For an API key or another provider, use `/provider` and follow its native
50
+ prompts. Enter credentials there, never in the host conversation. Provider
51
+ setup may offer a default-model picker; select a new saved default only if
52
+ you want that persistent change.
53
+ 3. To explicitly change your saved default later, use native `/model`.
54
+ 4. Return to the plugin, list models again, then run `setup --check` to verify
55
+ hook readiness. If it requests re-pinning, run the host's setup command.
56
+
57
+ Kimi supports its managed account, Anthropic, OpenAI-compatible services,
58
+ OpenAI Responses, Google GenAI, and Vertex AI protocols. Available models and
59
+ authentication requirements depend on the provider. See the upstream
60
+ [provider setup guide](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/providers).
61
+ The plugin does not switch Claude Code or Codex's own authentication.
62
+
63
+ For a one-off connection test, explicitly request a small task with the chosen
64
+ alias. That makes a provider call under your account and the usual plugin
65
+ safety gates. Listing alone is offline. An authentication or unsupported-model
66
+ error is surfaced without retrying a different model.
67
+
68
+ ## Implementation boundary
69
+
70
+ `setup --models [--json]` is mutually exclusive with hook setup flags. It parses
71
+ the complete TOML in memory and emits an explicit field allowlist; it never
72
+ serializes providers, keys, headers, environment maps, endpoints, OAuth
73
+ references, or raw parse errors. Do not substitute `kimi provider list --json`:
74
+ upstream 2.0.0 includes credential-bearing provider objects in that output.
75
+ Names in the inventory are untrusted configuration data and must be passed as
76
+ one correctly shell-quoted argument, never evaluated as shell instructions.
77
+
78
+ The model list is a routing aid, not a second implementation of Kimi's config
79
+ validator. Every task still uses the existing exact-version, hook, workspace,
80
+ and no-plan checks. Source review is against kimi-code 2.0.0 (`1b89e4b0`),
81
+ including `kosongConfig/configSection.ts`, `envOverlay.ts`, and
82
+ `cli/v2/run-v2-print.ts`.
@@ -0,0 +1,70 @@
1
+ # Registry releases
2
+
3
+ The npm package `kimi-plugin-cc` ships the Claude plugin at its root and the
4
+ self-contained Codex plugin under `plugins/kimi-codex`. GitHub marketplaces
5
+ remain available. The package has no install scripts and no separate CLI.
6
+
7
+ ## Validation
8
+
9
+ Use the repository's normal version bump and generated-surface procedure in
10
+ AGENTS.md. Keep plugin and npm versions identical. Certification for new Kimi
11
+ Code versions still requires the source audit and real-binary controls; adding
12
+ a registry channel does not certify another CLI version.
13
+
14
+ ```sh
15
+ bun install --frozen-lockfile
16
+ bun run build
17
+ bun run generate:surfaces
18
+ # Review and stage generated distributions before the drift gate.
19
+ bun run check
20
+ bun run check:package .tmp/npm
21
+ ```
22
+
23
+ The package check inspects the actual tarball, verifies runtime copies and
24
+ vendored licenses, and installs/checks the safety hook in isolated homes for
25
+ both hosts. It also exercises unsupported-version refusal using a fake CLI.
26
+ It does not invoke a model or read the maintainer's Kimi configuration.
27
+
28
+ ## First publication
29
+
30
+ The package must first exist on npm before its package settings can be configured.
31
+ After the release commit passes CI, create its immutable version tag and GitHub
32
+ release using the normal AGENTS.md procedure. The workflow builds and uploads a
33
+ validated tarball; publishing stays disabled until the repository variable
34
+ `NPM_TRUSTED_PUBLISHING` is `true`. Download the `npm-package` workflow artifact,
35
+ authenticate to npm interactively, then publish that validated artifact:
36
+
37
+ ```sh
38
+ npm login
39
+ npm publish kimi-plugin-cc-X.Y.Z.tgz --access public
40
+ ```
41
+
42
+ Do not publish a placeholder or reuse a version. Inspect registry metadata and
43
+ install the published version into a temporary directory before announcing it.
44
+
45
+ Configure npm Trusted Publishing for this package:
46
+
47
+ - GitHub owner: `linxule`
48
+ - Repository: `kimi-plugin-cc`
49
+ - Workflow: `publish.yml`
50
+ - Environment: `npm`
51
+ - Allow direct publishing for this release workflow
52
+
53
+ After configuring trust, set the GitHub Actions repository variable
54
+ `NPM_TRUSTED_PUBLISHING=true` to enable future publications.
55
+
56
+ No npm token is stored in GitHub. The npm CLI is used only for registry
57
+ operations; Bun remains the development toolchain.
58
+
59
+ ## Subsequent releases
60
+
61
+ Push the reviewed release commit, wait for CI, tag it, and publish its GitHub
62
+ release. `.github/workflows/publish.yml` runs on `release.published`; it checks
63
+ the tag against `package.json`, runs the full gate and package smoke, then
64
+ publishes the validated tarball through OIDC with provenance. The publish job
65
+ has no source checkout or build scripts. A manual dispatch with an existing
66
+ release tag is available for a first OIDC release or recovery after a verified
67
+ publication failure. Check npm before retrying; released versions are immutable.
68
+
69
+ A locally bootstrapped first version is already published: do not dispatch it
70
+ again. The next release is the first OIDC publication.