kimi-plugin-cc 2.4.4 → 2.5.1

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 (119) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +21 -0
  4. package/README.md +50 -34
  5. package/dist/commands/swarm.js +1 -1
  6. package/dist/dsh/companion.js +174 -0
  7. package/dist/dsh/index.js +156 -0
  8. package/dist/hooks/config-safety.js +3 -2
  9. package/dist/hooks/install-paths.js +2 -2
  10. package/dist/kimi-engine.js +1 -0
  11. package/dist/swarm-activation.js +1 -1
  12. package/dist/version.js +1 -1
  13. package/docs/migration.md +4 -4
  14. package/docs/models.md +5 -1
  15. package/docs/registry-releases.md +20 -17
  16. package/docs/safety.md +28 -15
  17. package/docs/swarm-recovery.md +1 -1
  18. package/docs/upstream-2.4.1-certification.md +54 -0
  19. package/package.json +41 -6
  20. package/plugins/kimi-codex/.codex-plugin/plugin.json +1 -1
  21. package/plugins/kimi-codex/dist/commands/swarm.js +1 -1
  22. package/plugins/kimi-codex/dist/dsh/companion.js +174 -0
  23. package/plugins/kimi-codex/dist/dsh/index.js +156 -0
  24. package/plugins/kimi-codex/dist/hooks/config-safety.js +3 -2
  25. package/plugins/kimi-codex/dist/hooks/install-paths.js +2 -2
  26. package/plugins/kimi-codex/dist/kimi-engine.js +1 -0
  27. package/plugins/kimi-codex/dist/swarm-activation.js +1 -1
  28. package/plugins/kimi-codex/dist/version.js +1 -1
  29. package/plugins/kimi-dsh/LICENSE +201 -0
  30. package/plugins/kimi-dsh/README.md +80 -0
  31. package/plugins/kimi-dsh/cordis.patch.yml +45 -0
  32. package/plugins/kimi-dsh/dist/background-spawn.js +216 -0
  33. package/plugins/kimi-dsh/dist/cli-cancellation.js +43 -0
  34. package/plugins/kimi-dsh/dist/cli-client.js +876 -0
  35. package/plugins/kimi-dsh/dist/commands/ask.js +336 -0
  36. package/plugins/kimi-dsh/dist/commands/cancel.js +216 -0
  37. package/plugins/kimi-dsh/dist/commands/cli-helpers.js +201 -0
  38. package/plugins/kimi-dsh/dist/commands/models.js +140 -0
  39. package/plugins/kimi-dsh/dist/commands/not-implemented.js +4 -0
  40. package/plugins/kimi-dsh/dist/commands/pursue.js +307 -0
  41. package/plugins/kimi-dsh/dist/commands/recover-swarm.js +135 -0
  42. package/plugins/kimi-dsh/dist/commands/registry.js +74 -0
  43. package/plugins/kimi-dsh/dist/commands/repair-sessions.js +160 -0
  44. package/plugins/kimi-dsh/dist/commands/replay.js +124 -0
  45. package/plugins/kimi-dsh/dist/commands/rescue.js +347 -0
  46. package/plugins/kimi-dsh/dist/commands/result.js +66 -0
  47. package/plugins/kimi-dsh/dist/commands/review-gate.js +390 -0
  48. package/plugins/kimi-dsh/dist/commands/review.js +220 -0
  49. package/plugins/kimi-dsh/dist/commands/setup.js +1047 -0
  50. package/plugins/kimi-dsh/dist/commands/status.js +27 -0
  51. package/plugins/kimi-dsh/dist/commands/swarm.js +754 -0
  52. package/plugins/kimi-dsh/dist/commands/worker.js +25 -0
  53. package/plugins/kimi-dsh/dist/companion.js +97 -0
  54. package/plugins/kimi-dsh/dist/config.js +22 -0
  55. package/plugins/kimi-dsh/dist/dsh/companion.js +174 -0
  56. package/plugins/kimi-dsh/dist/dsh/index.js +156 -0
  57. package/plugins/kimi-dsh/dist/errors.js +40 -0
  58. package/plugins/kimi-dsh/dist/git.js +224 -0
  59. package/plugins/kimi-dsh/dist/help.js +43 -0
  60. package/plugins/kimi-dsh/dist/hook-escape.js +71 -0
  61. package/plugins/kimi-dsh/dist/hooks/approval-hook.js +101 -0
  62. package/plugins/kimi-dsh/dist/hooks/approval-policy.js +211 -0
  63. package/plugins/kimi-dsh/dist/hooks/config-safety.js +653 -0
  64. package/plugins/kimi-dsh/dist/hooks/install-paths.js +428 -0
  65. package/plugins/kimi-dsh/dist/hooks/install.js +210 -0
  66. package/plugins/kimi-dsh/dist/hooks/managed-block.js +619 -0
  67. package/plugins/kimi-dsh/dist/hooks/review-gate-stop.js +19 -0
  68. package/plugins/kimi-dsh/dist/job-id.js +12 -0
  69. package/plugins/kimi-dsh/dist/job-store.js +659 -0
  70. package/plugins/kimi-dsh/dist/jobs.js +217 -0
  71. package/plugins/kimi-dsh/dist/kimi-command.js +70 -0
  72. package/plugins/kimi-dsh/dist/kimi-engine.js +632 -0
  73. package/plugins/kimi-dsh/dist/kimi-errors.js +260 -0
  74. package/plugins/kimi-dsh/dist/kimi-home.js +9 -0
  75. package/plugins/kimi-dsh/dist/kimi-timeouts.js +52 -0
  76. package/plugins/kimi-dsh/dist/kimi-version-probe.js +216 -0
  77. package/plugins/kimi-dsh/dist/logging.js +22 -0
  78. package/plugins/kimi-dsh/dist/mcp/binding.js +58 -0
  79. package/plugins/kimi-dsh/dist/mcp/job-control.js +345 -0
  80. package/plugins/kimi-dsh/dist/mcp/launcher.js +257 -0
  81. package/plugins/kimi-dsh/dist/mcp/operations.js +301 -0
  82. package/plugins/kimi-dsh/dist/mcp/protocol.js +275 -0
  83. package/plugins/kimi-dsh/dist/mcp/server.js +8 -0
  84. package/plugins/kimi-dsh/dist/mcp/stdio.js +78 -0
  85. package/plugins/kimi-dsh/dist/mcp/supervised-child.js +15 -0
  86. package/plugins/kimi-dsh/dist/mcp/tool-result.js +7 -0
  87. package/plugins/kimi-dsh/dist/mcp/workspace.js +34 -0
  88. package/plugins/kimi-dsh/dist/model-command.js +32 -0
  89. package/plugins/kimi-dsh/dist/native-v2-preflight.js +417 -0
  90. package/plugins/kimi-dsh/dist/package.json +1 -0
  91. package/plugins/kimi-dsh/dist/parsing.js +620 -0
  92. package/plugins/kimi-dsh/dist/paths.js +27 -0
  93. package/plugins/kimi-dsh/dist/plugin-data.js +98 -0
  94. package/plugins/kimi-dsh/dist/process-tree.js +479 -0
  95. package/plugins/kimi-dsh/dist/prompt-size.js +18 -0
  96. package/plugins/kimi-dsh/dist/render.js +177 -0
  97. package/plugins/kimi-dsh/dist/rescue-approval.js +865 -0
  98. package/plugins/kimi-dsh/dist/schemas/review-gate-output.js +43 -0
  99. package/plugins/kimi-dsh/dist/session-recovery.js +200 -0
  100. package/plugins/kimi-dsh/dist/session-title.js +293 -0
  101. package/plugins/kimi-dsh/dist/stream-json.js +346 -0
  102. package/plugins/kimi-dsh/dist/swarm-activation.js +834 -0
  103. package/plugins/kimi-dsh/dist/swarm-recovery.js +134 -0
  104. package/plugins/kimi-dsh/dist/types.js +1 -0
  105. package/plugins/kimi-dsh/dist/vendor/shell-quote/LICENSE +24 -0
  106. package/plugins/kimi-dsh/dist/vendor/shell-quote/index.js +1 -0
  107. package/plugins/kimi-dsh/dist/vendor/shell-quote/parse.js +229 -0
  108. package/plugins/kimi-dsh/dist/vendor/smol-toml/LICENSE +24 -0
  109. package/plugins/kimi-dsh/dist/vendor/smol-toml/date.js +156 -0
  110. package/plugins/kimi-dsh/dist/vendor/smol-toml/error.js +67 -0
  111. package/plugins/kimi-dsh/dist/vendor/smol-toml/extract.js +293 -0
  112. package/plugins/kimi-dsh/dist/vendor/smol-toml/parse.js +164 -0
  113. package/plugins/kimi-dsh/dist/vendor/smol-toml/primitive.js +151 -0
  114. package/plugins/kimi-dsh/dist/vendor/smol-toml/struct.js +156 -0
  115. package/plugins/kimi-dsh/dist/vendor/smol-toml/util.js +57 -0
  116. package/plugins/kimi-dsh/dist/version.js +7 -0
  117. package/plugins/kimi-dsh/package.json +48 -0
  118. package/plugins/kimi-dsh/scripts/companion.sh +37 -0
  119. package/plugins/kimi-dsh/scripts/review-gate-hook.sh +32 -0
@@ -5,7 +5,7 @@
5
5
  },
6
6
  "metadata": {
7
7
  "description": "Kimi for Claude Code: code questions, reviews, fixes, parallel tasks, and MCP tasks through the local Kimi Code CLI.",
8
- "version": "2.4.4"
8
+ "version": "2.5.1"
9
9
  },
10
10
  "plugins": [
11
11
  {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kimi",
3
3
  "description": "Kimi for Claude Code: code questions, independent reviews, bounded fixes, autonomous goals, parallel tasks, and MCP tasks through the local Kimi Code CLI, with PreToolUse safety hooks.",
4
- "version": "2.4.4",
4
+ "version": "2.5.1",
5
5
  "homepage": "https://github.com/linxule/kimi-plugin-cc",
6
6
  "repository": "https://github.com/linxule/kimi-plugin-cc",
7
7
  "license": "Apache-2.0",
package/CHANGELOG.md CHANGED
@@ -2,6 +2,27 @@
2
2
 
3
3
  > **Post-1.0 release history (v1.0.1 -> present) lives in [ROADMAP-TO-GA.md § Post-GA audit log](./ROADMAP-TO-GA.md#post-ga-audit-log)** and the "Version" / "Upstream compat" lines of [AGENTS.md](./AGENTS.md). Docs-only kimi-code compat checkups that don't bump the plugin version (e.g. the 0.14.2 / 0.14.3 patches) are recorded there, not here. Notable releases are summarized below; the GA entry and full pre-GA detail follow.
4
4
 
5
+ ## 2.5.1 — 2026-11-01
6
+
7
+ - Consolidate DSH distribution into the existing `kimi-plugin-cc` npm package and its established OIDC publication path. DSH users install the same root artifact with `dsh plugin --profile <name> add kimi-plugin-cc`; no second npm package or Trusted Publishing binding is required.
8
+ - Declare the root DSH bundle entry, runtime dependencies, and peer compatibility directly in `package.json`, and validate root-tarball installation, seven-tool composition, and Web boot in an isolated DSH profile.
9
+ - Pin safe transitive `zod` and `undici` versions, remove the unnecessary full DSH CLI development dependency, install pnpm explicitly in CI, and exclude dependency directories from installed-script fixtures.
10
+
11
+ ## 2.5.0 — 2026-11-01
12
+
13
+ - Add DeepSeek Harness as a third host with native `kimi_ask`, `kimi_review`, `kimi_challenge`, `kimi_rescue`, `kimi_pursue`, `kimi_swarm`, and `kimi_swarm_write` providers. Reuse the existing companion and `kimi -p` transport, managed hooks, exact-version certification, SQLite jobs, budgets, artifacts, and process lifecycle; no ACP transport.
14
+ - Add DSH-owned setup, model inventory, host-scoped uninstall, and job controls, plus profile-level model, thinking, budget, review-base, data-root, environment, output, and teardown settings. Preserve read-only denials, real-workspace rescue/pursue writes, and patch-only swarm-write.
15
+ - Package `dsh-kimi-plugin-cc` as an independently installable npm bundle with its own pack/install/composition/Web-boot gate. Publish root and DSH tarballs together through the existing OIDC workflow, with Node 24 CI and verified composition on DSH 0.2.1-rc.5 and 0.2.2-alpha.2.
16
+ - Verify live DSH delegation: `kimi_ask` returns `4`, a managed-hook write denial creates no file, rescue writes only `DSH_OK`, and a two-target swarm-write returns a valid patch without applying it or touching the real workspace.
17
+ - Update installation, safety, model, registry, contributor, and multilingual README guidance. Reduce `AGENTS.md` from 32,704 to 21,291 bytes by keeping detailed mechanics in owning references, and enforce a 24 KB ceiling.
18
+
19
+ ## 2.4.5 — 2026-10-31
20
+
21
+ - Certify exact kimi-code 2.4.1 for all eight native-v2 operations after exact-source review, plan and swarm controls, and candidate/production smoke. See [evidence](docs/upstream-2.4.1-certification.md).
22
+ - Add only the reviewed 2.4.1 activation and hook-schema entries. Preserve no-plan enforcement, workspace confinement, concurrency, bounded cleanup, durable recovery, and the legacy-v1 0.41.x boundary.
23
+ - Strengthen certification smoke to require same-call managed denials and real multi-turn journal evidence, and expand negative version coverage across every operation. Include the current certification record in the npm package.
24
+ - Review Read output/token limiting and goal/plan prompt changes without changing the tool execution, session provenance, or swarm activation contracts. Update the manual smoke default and current compatibility documentation; installed hosts remain unchanged.
25
+
5
26
  ## 2.4.4 — 2026-10-29
6
27
 
7
28
  - Certify exact kimi-code 2.4.0 for all eight native-v2 operations after exact-source review, revised plan and swarm controls, and candidate/production smoke. See [evidence](docs/upstream-2.4.0-certification.md).
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # Kimi for Claude Code and Codex
1
+ # Kimi for Claude Code, Codex, and DeepSeek Harness
2
2
 
3
3
  [![Latest release](https://img.shields.io/github/v/release/linxule/kimi-plugin-cc)](https://github.com/linxule/kimi-plugin-cc/releases/latest) [![CI](https://github.com/linxule/kimi-plugin-cc/actions/workflows/ci.yml/badge.svg)](https://github.com/linxule/kimi-plugin-cc/actions/workflows/ci.yml) [![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](./LICENSE)
4
4
 
5
- Use Kimi to explain code, review changes, challenge a design, or work toward a goal — an independent second opinion from a different model family, inside the Claude Code or Codex session you're already in.
5
+ Use Kimi to explain code, review changes, challenge a design, or work toward a goal — an independent second opinion from a different model family, inside the Claude Code, Codex, or DeepSeek Harness session you're already in.
6
6
 
7
7
  [![Kimi Ambassador — academia](./assets/kimi-ambassador-academia.webp)](https://www.kimi.ai/lp/kimi-ambassador)
8
8
 
@@ -27,20 +27,20 @@ Choose a language below. Each guide opens on this page.
27
27
 
28
28
  ## Use Kimi in your coding tasks
29
29
 
30
- Ask Kimi to explain code, review changes, challenge a design, or make a focused fix. You can use this plugin in Claude Code or Codex.
30
+ Ask Kimi to explain code, review changes, challenge a design, or make a focused fix. You can use this plugin in Claude Code, Codex, or DeepSeek Harness (DSH).
31
31
 
32
- The plugin runs the Kimi Code CLI on your computer. It uses your Kimi subscription or a provider you configure in Kimi. Calls count against that subscription or API account. Your Claude Code or Codex login stays unchanged. The selected provider receives the prompts and code needed for your task.
32
+ The plugin runs the Kimi Code CLI on your computer. It uses your Kimi subscription or a provider you configure in Kimi. Calls count against that subscription or API account. Your host application's login stays unchanged. The selected provider receives the prompts and code needed for your task.
33
33
 
34
- Start with a question or a review. Their tool rules allow reading files and deny file writes and shell commands. Other modes can change files. Read the [safety limits](./docs/safety.md) before asking Kimi to make changes.
34
+ Start with a question or a review. Their tool rules allow reading files and deny file writes and shell commands. Other modes can change files. DSH provides the same seven operations with the same write boundaries. Read the [safety limits](./docs/safety.md) before asking Kimi to make changes.
35
35
 
36
36
  ## Before you install
37
37
 
38
38
  You need:
39
39
 
40
40
  - macOS or Linux
41
- - Claude Code or Codex with plugin support
42
- - Node.js 22.5 or newer
43
- - Kimi Code CLI 2.4.0 (certified; 2.3.3, 2.3.2, 2.3.1 and 2.3.0 are also certified)
41
+ - Claude Code, Codex, or DSH with plugin support
42
+ - Node.js 22.5 or newer (24.9 or newer for DSH)
43
+ - Kimi Code CLI 2.4.1 (certified; 2.4.0, 2.3.3, 2.3.2, 2.3.1 and 2.3.0 are also certified)
44
44
 
45
45
  Windows is not currently supported. Contributors can help with the [no-model Windows diagnostics checks](./docs/windows-validation.md). Check your versions in a terminal:
46
46
 
@@ -95,20 +95,36 @@ The hook checks Kimi's tool calls against the plugin's rules. The `Probe:` line
95
95
  Use $kimi-ask to explain how this project's main entry point works.
96
96
  ```
97
97
 
98
- If you use both Claude Code and Codex, run setup in each. Each app has its own hook in the shared Kimi configuration.
98
+ If you use multiple hosts, run setup in each. Each app has its own hook in the shared Kimi configuration.
99
+
100
+ ## Install in DeepSeek Harness
101
+
102
+ The DSH bundle provides the same seven operations as the other hosts: `kimi_ask`, `kimi_review`, `kimi_challenge`, `kimi_rescue`, `kimi_pursue`, `kimi_swarm`, and `kimi_swarm_write`. They use the same companion runtime, safety hooks, jobs, budgets, and artifacts. Rescue and pursue edit the selected workspace; swarm-write returns a patch without applying or committing it.
103
+
104
+ From this repository checkout, run:
105
+
106
+ ```sh
107
+ dsh plugin --profile web add ./plugins/kimi-dsh
108
+ ```
109
+
110
+ For the published npm bundle, run `dsh plugin --profile web add kimi-plugin-cc` instead.
111
+
112
+ Restart DSH when requested, then run `/kimi-setup` and `/kimi-setup --check`. Ask DSH to use one of the seven tools with a self-contained task. Job controls are `/kimi-status`, `/kimi-result`, and `/kimi-cancel`. `/kimi-setup --models` lists configured models, and `/kimi-setup --uninstall` removes only the DSH hook.
113
+
114
+ DSH requires Node.js 24.9 or newer and DSH `>=0.2.1-rc.5 <0.3.0`. See the [DSH bundle guide](./plugins/kimi-dsh/README.md) for profile-level model, thinking, budget, review-base, and other configuration.
99
115
 
100
116
  ## npm distribution (optional)
101
117
 
102
118
  The existing marketplace commands above remain the default for Claude Code and
103
119
  Codex. Published releases are also available as
104
120
  [`kimi-plugin-cc` on npm](https://www.npmjs.com/package/kimi-plugin-cc), including
105
- both compiled plugin distributions. No Bun, TypeScript, or install scripts are
121
+ all three compiled plugin distributions. No Bun, TypeScript, or install scripts are
106
122
  needed to use the package. Kimi Code CLI and Node are still prerequisites.
107
123
 
108
- For an explicitly versioned local Claude Code plugin, this example pins the 2.4.4 package:
124
+ For an explicitly versioned local Claude Code plugin, this example pins the 2.5.1 package:
109
125
 
110
126
  ```sh
111
- npm install --prefix ~/.local/share/kimi-plugin-cc kimi-plugin-cc@2.4.4
127
+ npm install --prefix ~/.local/share/kimi-plugin-cc kimi-plugin-cc@2.5.1
112
128
  claude --plugin-dir ~/.local/share/kimi-plugin-cc/node_modules/kimi-plugin-cc
113
129
  ```
114
130
 
@@ -228,7 +244,7 @@ All refusal codes and their remedies are listed in the [refusal-code catalog](./
228
244
 
229
245
  The tool rules for ask, review, challenge, and read-only swarm deny file writes and shell commands. Rescue and pursue can write files in your workspace. Swarm with `--write` works in a temporary Git worktree. It starts from your latest commit, so it does not include uncommitted changes. It returns a patch without applying it to your project.
230
246
 
231
- For swarm on CLI 2.3.2, 2.3.3 and 2.4.0, the plugin briefly starts an authenticated loopback `kimi web` process to activate a session and another to deactivate swarm mode afterward; one ordinary `kimi -p -r` process still performs the task. Activation counts against the time limit, the access token stays in memory and out of logs, and cleanup failure prevents success. Older certified versions use `kimi -p` directly.
247
+ For swarm on CLI 2.3.2, 2.3.3, 2.4.0 and 2.4.1, the plugin briefly starts an authenticated loopback `kimi web` process to activate a session and another to deactivate swarm mode afterward; one ordinary `kimi -p -r` process still performs the task. Activation counts against the time limit, the access token stays in memory and out of logs, and cleanup failure prevents success. Older certified versions use `kimi -p` directly.
232
248
 
233
249
  The plugin does not commit changes. Review changes before you keep or apply them.
234
250
 
@@ -251,20 +267,20 @@ Contributors need Bun to run `bun run check`. The detailed engineering documents
251
267
 
252
268
  ## 用 Kimi 辅助编程
253
269
 
254
- 你可以让 Kimi 解释代码、审查修改、指出设计中的问题,或完成一项范围明确的修复。本插件支持 Claude Code 和 Codex。
270
+ 你可以让 Kimi 解释代码、审查修改、指出设计中的问题,或完成一项范围明确的修复。本插件支持 Claude Code、Codex 和 DeepSeek Harness(DSH)。
255
271
 
256
- 插件在你的电脑上调用 Kimi Code CLI,使用你的 Kimi 订阅或在 Kimi 中配置的服务商。调用会消耗相应的订阅额度或产生 API 费用。Claude Code 和 Codex 的登录状态不变。任务所需的提示词和代码会发送给所选服务商。
272
+ 插件在你的电脑上调用 Kimi Code CLI,使用你的 Kimi 订阅或在 Kimi 中配置的服务商。调用会消耗相应的订阅额度或产生 API 费用。宿主应用的登录状态不变。任务所需的提示词和代码会发送给所选服务商。
257
273
 
258
- 建议先尝试提问或代码审查。这两类任务允许读取文件,禁止写入文件和执行 shell 命令。其他模式可以修改文件。让 Kimi 动手修改前,请先了解[安全限制](./docs/safety.md)。
274
+ 建议先尝试提问或代码审查。这两类任务允许读取文件,禁止写入文件和执行 shell 命令。其他模式可以修改文件;DSH 同样提供七类操作,并遵循相同的写入边界。让 Kimi 动手修改前,请先了解[安全限制](./docs/safety.md)。DSH 的安装方法见[英文说明](#install-in-deepseek-harness)。
259
275
 
260
276
  ## 安装前准备
261
277
 
262
278
  你需要:
263
279
 
264
280
  - macOS 或 Linux
265
- - 支持插件的 Claude Code 或 Codex
266
- - Node.js 22.5 或更高版本
267
- - Kimi Code CLI 2.4.0(已认证;2.3.3、2.3.2、2.3.1 和 2.3.0 也已认证)
281
+ - 支持插件的 Claude Code、Codex 或 DSH
282
+ - Node.js 22.5 或更高版本(DSH 需要 24.9 或更高版本)
283
+ - Kimi Code CLI 2.4.1(已认证;2.4.0、2.3.3、2.3.2、2.3.1 和 2.3.0 也已认证)
268
284
 
269
285
  目前不支持 Windows。在终端检查版本:
270
286
 
@@ -427,7 +443,7 @@ codex plugin add kimi@kimi-marketplace
427
443
 
428
444
  Ask、review、challenge 和只读 swarm 的工具规则禁止写入文件和执行 shell 命令。Rescue 和 pursue 可以修改工作区内的文件。带 `--write` 的 swarm 在临时 Git 工作树中操作。它从最新提交开始,不包含尚未提交的修改。任务结束后返回补丁,不会自动应用到项目。
429
445
 
430
- 在 CLI 2.3.2、2.3.3 和 2.4.0 上运行 swarm 时,插件会短暂启动需要认证的本地回环 `kimi web` 进程来激活会话,并在结束后再次启动以停用 swarm 模式;任务本身仍由一个普通的 `kimi -p -r` 进程执行。激活计入任务时限,访问令牌只保存在内存且不会写入日志;无法确认清理完成时,任务不会报告成功。较早的已认证版本仍直接通过 `kimi -p` 运行。
446
+ 在 CLI 2.3.2、2.3.3、2.4.0 和 2.4.1 上运行 swarm 时,插件会短暂启动需要认证的本地回环 `kimi web` 进程来激活会话,并在结束后再次启动以停用 swarm 模式;任务本身仍由一个普通的 `kimi -p -r` 进程执行。激活计入任务时限,访问令牌只保存在内存且不会写入日志;无法确认清理完成时,任务不会报告成功。较早的已认证版本仍直接通过 `kimi -p` 运行。
431
447
 
432
448
  插件不会提交修改。保留或应用修改前,请先审查。
433
449
 
@@ -450,20 +466,20 @@ Ask、review、challenge 和只读 swarm 的工具规则禁止写入文件和执
450
466
 
451
467
  ## Utiliser Kimi pour vos tâches de développement
452
468
 
453
- Demandez à Kimi d'expliquer du code, de faire une revue de code, de remettre en question une approche ou de corriger un problème précis. Ce plugin fonctionne dans Claude Code et Codex.
469
+ Demandez à Kimi d'expliquer du code, de faire une revue de code, de remettre en question une approche ou de corriger un problème précis. Ce plugin fonctionne dans Claude Code, Codex et DeepSeek Harness (DSH).
454
470
 
455
- Le plugin exécute Kimi Code CLI sur votre ordinateur. Il utilise votre abonnement Kimi ou un fournisseur configuré dans Kimi. Les appels consomment votre quota d'abonnement ou sont facturés sur votre compte API. Votre connexion à Claude Code ou à Codex ne change pas. Le fournisseur choisi reçoit les prompts et le code nécessaires à la tâche.
471
+ Le plugin exécute Kimi Code CLI sur votre ordinateur. Il utilise votre abonnement Kimi ou un fournisseur configuré dans Kimi. Les appels consomment votre quota d'abonnement ou sont facturés sur votre compte API. La connexion à l'application hôte ne change pas. Le fournisseur choisi reçoit les prompts et le code nécessaires à la tâche.
456
472
 
457
- Commencez par une question ou une revue de code. Ces modes autorisent la lecture des fichiers, mais interdisent leur modification et l'exécution de commandes shell. D'autres modes peuvent modifier des fichiers. Consultez les [limites de sécurité](./docs/safety.md) avant de demander des modifications à Kimi.
473
+ Commencez par une question ou une revue de code. Ces modes autorisent la lecture des fichiers, mais interdisent leur modification et l'exécution de commandes shell. D'autres modes peuvent modifier des fichiers ; DSH propose les sept mêmes opérations avec les mêmes limites d'écriture. Consultez les [limites de sécurité](./docs/safety.md) avant de demander des modifications à Kimi. Voir le [guide DSH en anglais](#install-in-deepseek-harness) pour l'installation.
458
474
 
459
475
  ## Préparer l'installation
460
476
 
461
477
  Il vous faut :
462
478
 
463
479
  - macOS ou Linux
464
- - une version de Claude Code ou de Codex prenant en charge les plugins
465
- - Node.js 22.5 ou une version ultérieure
466
- - Kimi Code CLI 2.4.0 (certifiée ; les versions 2.3.3, 2.3.2, 2.3.1 et 2.3.0 sont également certifiées)
480
+ - une version de Claude Code, Codex ou DSH prenant en charge les plugins
481
+ - Node.js 22.5 ou une version ultérieure (24.9 ou ultérieure pour DSH)
482
+ - Kimi Code CLI 2.4.1 (certifiée ; les versions 2.4.0, 2.3.3, 2.3.2, 2.3.1 et 2.3.0 sont également certifiées)
467
483
 
468
484
  Windows n'est pas pris en charge actuellement. Vérifiez les versions dans un terminal :
469
485
 
@@ -626,7 +642,7 @@ Tous les codes de refus et leurs remèdes sont répertoriés dans le [catalogue
626
642
 
627
643
  Les règles des modes ask, review, challenge et swarm en lecture seule interdisent les écritures et les commandes shell. Rescue et pursue peuvent modifier les fichiers de votre espace de travail. Swarm avec `--write` travaille dans un worktree Git temporaire. Il part du dernier commit et n'inclut donc pas les modifications non commitées. Il renvoie un patch sans l'appliquer à votre projet.
628
644
 
629
- Avec le CLI 2.3.2, 2.3.3 et 2.4.0, les tâches swarm lancent brièvement un processus `kimi web` authentifié sur l'interface de boucle locale pour activer la session, puis un second pour désactiver le mode swarm ; un seul processus `kimi -p -r` ordinaire exécute toujours la tâche. L'activation est comptée dans la limite de temps, le jeton reste en mémoire et hors des journaux, et l'échec du nettoyage empêche de déclarer la réussite. Les versions certifiées antérieures utilisent directement `kimi -p`.
645
+ Avec le CLI 2.3.2, 2.3.3, 2.4.0 et 2.4.1, les tâches swarm lancent brièvement un processus `kimi web` authentifié sur l'interface de boucle locale pour activer la session, puis un second pour désactiver le mode swarm ; un seul processus `kimi -p -r` ordinaire exécute toujours la tâche. L'activation est comptée dans la limite de temps, le jeton reste en mémoire et hors des journaux, et l'échec du nettoyage empêche de déclarer la réussite. Les versions certifiées antérieures utilisent directement `kimi -p`.
630
646
 
631
647
  Le plugin ne crée aucun commit. Examinez les modifications avant de les conserver ou de les appliquer.
632
648
 
@@ -649,20 +665,20 @@ Les contributeurs ont besoin de Bun pour exécuter `bun run check`. La documenta
649
665
 
650
666
  ## Kimi を開発に使う
651
667
 
652
- コードの説明、変更のレビュー、設計の問題点の指摘、範囲を絞った修正を Kimi に依頼できます。このプラグインは Claude Code と Codex で使えます。
668
+ コードの説明、変更のレビュー、設計の問題点の指摘、範囲を絞った修正を Kimi に依頼できます。このプラグインは Claude Code、Codex、DeepSeek Harness(DSH)で使えます。
653
669
 
654
- プラグインは、お使いのコンピューターで Kimi Code CLI を実行します。Kimi のサブスクリプション、または Kimi に設定したプロバイダーを利用します。呼び出しは、そのサブスクリプションの利用枠を消費するか、API アカウントに課金されます。Claude Code や Codex のログイン状態は変わりません。タスクに必要なプロンプトとコードは、選択したプロバイダーに送信されます。
670
+ プラグインは、お使いのコンピューターで Kimi Code CLI を実行します。Kimi のサブスクリプション、または Kimi に設定したプロバイダーを利用します。呼び出しは、そのサブスクリプションの利用枠を消費するか、API アカウントに課金されます。ホストアプリのログイン状態は変わりません。タスクに必要なプロンプトとコードは、選択したプロバイダーに送信されます。
655
671
 
656
- まずは質問かコードレビューを試してください。これらのモードではファイルの読み取りを許可し、書き込みとシェルコマンドの実行を禁止しています。ほかのモードではファイルを変更できます。変更を依頼する前に、[安全上の制限](./docs/safety.md)を確認してください。
672
+ まずは質問かコードレビューを試してください。これらのモードではファイルの読み取りを許可し、書き込みとシェルコマンドの実行を禁止しています。ほかのモードではファイルを変更できます。DSH でも同じ 7 種類の操作を同じ書き込み範囲で提供します。変更を依頼する前に、[安全上の制限](./docs/safety.md)を確認してください。DSH のインストール方法は[英語の案内](#install-in-deepseek-harness)を参照してください。
657
673
 
658
674
  ## インストール前の準備
659
675
 
660
676
  次の環境が必要です。
661
677
 
662
678
  - macOS または Linux
663
- - プラグインに対応した Claude Code または Codex
664
- - Node.js 22.5 以降
665
- - Kimi Code CLI 2.4.0(認証済み。2.3.3、2.3.2、2.3.1 と 2.3.0 も認証済み)
679
+ - プラグインに対応した Claude Code、Codex、または DSH
680
+ - Node.js 22.5 以降(DSH では 24.9 以降)
681
+ - Kimi Code CLI 2.4.1(認証済み。2.4.0、2.3.3、2.3.2、2.3.1 と 2.3.0 も認証済み)
666
682
 
667
683
  現在、Windows には対応していません。ターミナルでバージョンを確認します。
668
684
 
@@ -825,7 +841,7 @@ codex plugin add kimi@kimi-marketplace
825
841
 
826
842
  Ask、review、challenge、読み取り専用 swarm のツールルールでは、ファイルへの書き込みとシェルコマンドを禁止しています。Rescue と pursue はワークスペース内のファイルを変更できます。`--write` を指定した swarm は、一時的な Git ワークツリーで作業します。最新のコミットから開始するため、未コミットの変更は含まれません。パッチを返すだけで、プロジェクトには自動適用しません。
827
843
 
828
- CLI 2.3.2 / 2.3.3 / 2.4.0 の swarm では、セッションを有効化するため、そして終了後に swarm モードを無効化するため、認証付きのローカルループバック `kimi web` プロセスをそれぞれ短時間だけ起動します。タスク自体は従来どおり 1 つの `kimi -p -r` プロセスが実行します。有効化も制限時間に含まれ、トークンはメモリー内にのみ保持されてログには出ません。後処理を確認できない場合、タスクは成功と報告されません。以前の認証済みバージョンでは、引き続き `kimi -p` を直接使います。
844
+ CLI 2.3.2 / 2.3.3 / 2.4.0 / 2.4.1 の swarm では、セッションを有効化するため、そして終了後に swarm モードを無効化するため、認証付きのローカルループバック `kimi web` プロセスをそれぞれ短時間だけ起動します。タスク自体は従来どおり 1 つの `kimi -p -r` プロセスが実行します。有効化も制限時間に含まれ、トークンはメモリー内にのみ保持されてログには出ません。後処理を確認できない場合、タスクは成功と報告されません。以前の認証済みバージョンでは、引き続き `kimi -p` を直接使います。
829
845
 
830
846
  プラグインは変更をコミットしません。変更を残す、または適用する前に内容を確認してください。
831
847
 
@@ -28,7 +28,7 @@ import { buildKimiSessionTitle, syncKimiSessionTitle } from "../session-title.js
28
28
  // only the wall-clock hard bound. Read/write modes reuse review/rescue lineage,
29
29
  // and the mandatory PreToolUse hook enforces read-only policy or trusted-worktree
30
30
  // write confinement on the coordinator and every subagent. Write mode requires
31
- // kimi-code 0.18.0+. Exact 2.3.2, 2.3.3 and 2.4.0 additionally activate a same-job
31
+ // kimi-code 0.18.0+. Exact 2.3.2, 2.3.3, 2.4.0 and 2.4.1 additionally activate a same-job
32
32
  // session through a bounded loopback web lifecycle, then resume it through the normal print path.
33
33
  const SWARM_SUMMARY_MAX = 120;
34
34
  const SWARM_AGENT_PROFILE = "<swarm>";
@@ -0,0 +1,174 @@
1
+ import { randomUUID } from "node:crypto";
2
+ import { brandString } from "@deepseek-ai/dsh-brand";
3
+ import { assertUsableCwd, settleRunResult, subprocessRunHandle, } from "@deepseek-ai/dsh-subagent";
4
+ export const DSH_COMPANION_OPERATIONS = [
5
+ "ask",
6
+ "review",
7
+ "challenge",
8
+ "rescue",
9
+ "pursue",
10
+ "swarm",
11
+ "swarm-write",
12
+ ];
13
+ export function companionTextTask(prompt) {
14
+ if (prompt.length === 0 || prompt.some((block) => block.type !== "text")) {
15
+ throw new Error("kimi-plugin-cc: a delegation must contain only text blocks");
16
+ }
17
+ const text = prompt.map((block) => block.type === "text" ? block.text : "").join("\n\n");
18
+ if (text.trim().length === 0) {
19
+ throw new Error("kimi-plugin-cc: a delegation must not be empty");
20
+ }
21
+ return text;
22
+ }
23
+ export function companionArgv(operation, prompt, companionPath, nodeBin = process.execPath, options = {}) {
24
+ const command = operation === "ask" || operation === "review"
25
+ ? [operation]
26
+ : operation === "swarm-write"
27
+ ? ["task", "swarm", "--write"]
28
+ : ["task", operation];
29
+ return [
30
+ nodeBin,
31
+ companionPath,
32
+ ...command,
33
+ ...(operation === "ask" || operation === "rescue" ? ["--fresh"] : []),
34
+ ...(options.model === undefined ? [] : ["-m", options.model]),
35
+ ...(options.thinkingEffort === undefined ? [] : ["--thinking", options.thinkingEffort]),
36
+ ...(options.budget === undefined ? [] : ["--budget", options.budget]),
37
+ ...((operation === "review" || operation === "challenge") && options.reviewBase !== undefined
38
+ ? ["--base", options.reviewBase]
39
+ : []),
40
+ "--",
41
+ prompt,
42
+ ];
43
+ }
44
+ export function companionEnvironment(dataRoot, cwd, env, nodeBin = process.execPath) {
45
+ return {
46
+ ...env,
47
+ KIMI_PLUGIN_CC_DATA: dataRoot,
48
+ KIMI_PLUGIN_CC_HOST_ID: "dsh",
49
+ KIMI_PLUGIN_CC_NODE_BIN: nodeBin,
50
+ KIMI_PLUGIN_CC_WORKSPACE_CWD: cwd,
51
+ CLAUDE_PLUGIN_DATA: undefined,
52
+ PLUGIN_DATA: undefined,
53
+ CLAUDE_PLUGIN_ROOT: undefined,
54
+ PLUGIN_ROOT: undefined,
55
+ KIMI_PLUGIN_CC_SHELL_LAUNCH: undefined,
56
+ KIMI_PLUGIN_CC_MCP_WORKSPACE: undefined,
57
+ KIMI_PLUGIN_CC_WORKSPACE_ROOT: undefined,
58
+ KIMI_PLUGIN_CC_HOOK_SCRIPT: undefined,
59
+ KIMI_PLUGIN_CC_SKIP_HOOK_CHECK: undefined,
60
+ KIMI_PLUGIN_CC_SKIP_VERSION_PROBE: undefined,
61
+ KIMI_CODE_TRUST_WORKSPACE: undefined,
62
+ };
63
+ }
64
+ export async function startCompanionRun(request, operation, spec) {
65
+ const prompt = companionTextTask(request.prompt);
66
+ if (request.signal.aborted) {
67
+ throw new Error("kimi-plugin-cc: delegation was aborted before companion startup");
68
+ }
69
+ const cwd = assertUsableCwd("kimi-plugin-cc", "child cwd", request.cwd ?? process.cwd());
70
+ const termination = new AbortController();
71
+ let cancelled = false;
72
+ const requestCancel = () => {
73
+ cancelled = true;
74
+ if (!termination.signal.aborted) {
75
+ termination.abort(new Error("kimi-plugin-cc: delegation cancelled"));
76
+ }
77
+ };
78
+ const onAbort = () => requestCancel();
79
+ request.signal.addEventListener("abort", onAbort, { once: true });
80
+ let child;
81
+ try {
82
+ child = spec.spawn({
83
+ argv: companionArgv(operation, prompt, spec.companionPath, process.execPath, spec),
84
+ cwd,
85
+ stdio: {
86
+ stdin: "ignore",
87
+ stdout: { maxBytes: spec.maxOutputBytes },
88
+ stderr: "inherit",
89
+ },
90
+ graceMs: spec.disposeGraceMs,
91
+ signal: termination.signal,
92
+ env: companionEnvironment(spec.dataRoot, cwd, spec.env),
93
+ });
94
+ }
95
+ catch (error) {
96
+ request.signal.removeEventListener("abort", onAbort);
97
+ throw error;
98
+ }
99
+ let diagnostic;
100
+ const result = settleRunResult({
101
+ attempt: async () => {
102
+ let outcome;
103
+ try {
104
+ outcome = await child.done;
105
+ }
106
+ catch (error) {
107
+ diagnostic = `Kimi ${operation} companion failed before producing a terminal exit`;
108
+ throw error;
109
+ }
110
+ const collected = child.collected.stdout?.readFrom(0);
111
+ const text = collected?.text.trimEnd() ?? "";
112
+ if (!cancelled && outcome.exitCode === 0 && collected && !collected.lossy && text.trim().length > 0) {
113
+ return { output: [{ type: "text", text }], stopReason: "completed" };
114
+ }
115
+ const facts = [
116
+ `exit code: ${outcome.exitCode ?? "none"}`,
117
+ `signal: ${outcome.signal ?? "none"}`,
118
+ ...(collected?.lossy ? ["stdout truncated"] : []),
119
+ ...(text.trim().length === 0 ? ["stdout empty"] : []),
120
+ ];
121
+ diagnostic = `Kimi ${operation} companion failed (${facts.join("; ")})`;
122
+ return { output: [], diagnostic, stopReason: cancelled ? "aborted" : "error" };
123
+ },
124
+ collectOutput: () => [],
125
+ collectDiagnostic: () => diagnostic,
126
+ cancelled: () => cancelled,
127
+ signal: request.signal,
128
+ onAbort,
129
+ });
130
+ return subprocessRunHandle({
131
+ id: brandString(randomUUID()),
132
+ result,
133
+ signal: request.signal,
134
+ onAbort,
135
+ requestCancel,
136
+ teardown: async () => {
137
+ child.terminate();
138
+ await child.waitForExit();
139
+ await child.done.catch(() => { });
140
+ },
141
+ });
142
+ }
143
+ export async function runCompanionCommand(argv, cwd, spec, signal) {
144
+ const child = spec.spawn({
145
+ argv: [process.execPath, spec.companionPath, ...argv],
146
+ cwd,
147
+ stdio: {
148
+ stdin: "ignore",
149
+ stdout: { maxBytes: spec.maxOutputBytes },
150
+ stderr: { maxBytes: spec.maxOutputBytes },
151
+ },
152
+ graceMs: spec.disposeGraceMs,
153
+ signal,
154
+ env: companionEnvironment(spec.dataRoot, cwd, spec.env),
155
+ });
156
+ try {
157
+ const outcome = await child.done;
158
+ await child.waitForExit();
159
+ const stdout = child.collected.stdout?.readFrom(0);
160
+ const stderr = child.collected.stderr?.readFrom(0);
161
+ return {
162
+ exitCode: outcome.exitCode,
163
+ signal: outcome.signal,
164
+ stdout: stdout?.text ?? "",
165
+ stderr: stderr?.text ?? "",
166
+ truncated: Boolean(stdout?.lossy || stderr?.lossy),
167
+ };
168
+ }
169
+ catch (error) {
170
+ child.terminate();
171
+ await child.waitForExit().catch(() => false);
172
+ throw error;
173
+ }
174
+ }
@@ -0,0 +1,156 @@
1
+ import { homedir } from "node:os";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import { CommandDefinitionId } from "@deepseek-ai/dsh-commands/brand";
5
+ import z from "@deepseek-ai/schemastery";
6
+ import { NO_START_CAPABILITIES, } from "@deepseek-ai/dsh-subagent";
7
+ import { DSH_COMPANION_OPERATIONS, runCompanionCommand, startCompanionRun, } from "./companion.js";
8
+ import { parseDurationMs } from "../parsing.js";
9
+ export const name = "kimi-plugin-cc";
10
+ export const inject = ["subagents", "subprocess"];
11
+ const DEFAULT_DISPOSE_GRACE_MS = 6_000;
12
+ const DEFAULT_MAX_OUTPUT_BYTES = 16 * 1024 * 1024;
13
+ const MAX_TIMER_DELAY_MS = 2_147_483_647;
14
+ const COMPANION_PATH = fileURLToPath(new URL("../../dist/companion.js", import.meta.url));
15
+ export const Config = z.object({
16
+ dataRoot: z.string().min(1),
17
+ env: z.dict(z.string()).default({}),
18
+ disposeGraceMs: z.number().default(DEFAULT_DISPOSE_GRACE_MS),
19
+ maxOutputBytes: z.number().default(DEFAULT_MAX_OUTPUT_BYTES),
20
+ model: z.string().min(1),
21
+ thinkingEffort: z.string().min(1),
22
+ budget: z.string().min(1),
23
+ reviewBase: z.string().min(1),
24
+ });
25
+ export function defaultDshDataRoot(env = process.env) {
26
+ const explicit = env.KIMI_PLUGIN_CC_DATA;
27
+ if (explicit !== undefined) {
28
+ if (!path.isAbsolute(explicit)) {
29
+ throw new Error("kimi-plugin-cc: KIMI_PLUGIN_CC_DATA must be absolute");
30
+ }
31
+ return path.normalize(explicit);
32
+ }
33
+ const dshHome = env.DSH_HOME ?? path.join(env.HOME || homedir(), ".dsh");
34
+ if (!path.isAbsolute(dshHome)) {
35
+ throw new Error("kimi-plugin-cc: DSH_HOME must be absolute");
36
+ }
37
+ return path.join(dshHome, "plugin-data", "kimi-plugin-cc");
38
+ }
39
+ function resolveConfig(config) {
40
+ const resolved = {
41
+ dataRoot: config.dataRoot ?? defaultDshDataRoot(),
42
+ env: config.env ?? {},
43
+ disposeGraceMs: config.disposeGraceMs ?? DEFAULT_DISPOSE_GRACE_MS,
44
+ maxOutputBytes: config.maxOutputBytes ?? DEFAULT_MAX_OUTPUT_BYTES,
45
+ model: config.model,
46
+ thinkingEffort: config.thinkingEffort,
47
+ budget: config.budget,
48
+ reviewBase: config.reviewBase,
49
+ };
50
+ if (!path.isAbsolute(resolved.dataRoot)) {
51
+ throw new Error("kimi-plugin-cc: dataRoot must be absolute");
52
+ }
53
+ if (!Number.isFinite(resolved.disposeGraceMs) || resolved.disposeGraceMs <= 0 || resolved.disposeGraceMs > MAX_TIMER_DELAY_MS) {
54
+ throw new Error(`kimi-plugin-cc: disposeGraceMs must be positive, finite, and no greater than ${MAX_TIMER_DELAY_MS}`);
55
+ }
56
+ if (!Number.isSafeInteger(resolved.maxOutputBytes) || resolved.maxOutputBytes <= 0) {
57
+ throw new Error("kimi-plugin-cc: maxOutputBytes must be a positive safe integer");
58
+ }
59
+ for (const [field, value] of [["model", resolved.model], ["thinkingEffort", resolved.thinkingEffort], ["reviewBase", resolved.reviewBase]]) {
60
+ if (value?.startsWith("-"))
61
+ throw new Error(`kimi-plugin-cc: ${field} must not start with '-'`);
62
+ }
63
+ if (resolved.budget !== undefined)
64
+ parseDurationMs(resolved.budget, "--budget", "dsh.config", "safety");
65
+ return resolved;
66
+ }
67
+ class KimiCompanionProvider {
68
+ name;
69
+ operation;
70
+ spec;
71
+ capabilities = NO_START_CAPABILITIES;
72
+ inheritsParentContext = false;
73
+ constructor(name, operation, spec) {
74
+ this.name = name;
75
+ this.operation = operation;
76
+ this.spec = spec;
77
+ }
78
+ start(request) {
79
+ return startCompanionRun(request, this.operation, this.spec);
80
+ }
81
+ }
82
+ function commandArguments(rawInput) {
83
+ const trimmed = rawInput.trim();
84
+ return trimmed.length === 0 ? [] : trimmed.split(/\s+/);
85
+ }
86
+ function commandText(result) {
87
+ return [result.stdout.trimEnd(), result.stderr.trimEnd()]
88
+ .filter((text) => text.length > 0)
89
+ .join("\n");
90
+ }
91
+ export function apply(ctx, config) {
92
+ const resolved = resolveConfig(config);
93
+ const spec = {
94
+ companionPath: COMPANION_PATH,
95
+ dataRoot: resolved.dataRoot,
96
+ env: resolved.env,
97
+ disposeGraceMs: resolved.disposeGraceMs,
98
+ maxOutputBytes: resolved.maxOutputBytes,
99
+ model: resolved.model,
100
+ thinkingEffort: resolved.thinkingEffort,
101
+ budget: resolved.budget,
102
+ reviewBase: resolved.reviewBase,
103
+ spawn: (spawnSpec) => ctx.subprocess.spawn(spawnSpec),
104
+ };
105
+ for (const operation of DSH_COMPANION_OPERATIONS) {
106
+ ctx.subagents.registerProvider(new KimiCompanionProvider(`kimi-${operation}`, operation, spec));
107
+ }
108
+ ctx.inject(["commands"], (commandCtx) => {
109
+ const execute = async (invocation, argv) => {
110
+ const directories = commandCtx.get("workingDirectory");
111
+ if (directories === undefined) {
112
+ return { kind: "error", text: "Kimi commands require the DSH working-directory service." };
113
+ }
114
+ const cwd = await directories.ensure(invocation.agent, invocation.signal);
115
+ const result = await runCompanionCommand(argv, cwd, spec, invocation.signal);
116
+ const text = commandText(result);
117
+ if (result.truncated) {
118
+ return { kind: "error", text: `${text}\nKimi command output exceeded the configured byte limit.`.trim() };
119
+ }
120
+ if (result.exitCode !== 0) {
121
+ return {
122
+ kind: "error",
123
+ text: `${text}\nKimi command failed (exit code: ${result.exitCode ?? "none"}; signal: ${result.signal ?? "none"}).`.trim(),
124
+ };
125
+ }
126
+ return { kind: "success", text: text.length > 0 ? text : "Kimi command completed." };
127
+ };
128
+ commandCtx.commands.register({
129
+ definitionId: CommandDefinitionId("kimi-plugin-cc/dsh/setup"),
130
+ name: "kimi-setup",
131
+ description: "Install, check, or remove the DSH-owned Kimi PreToolUse hook; list configured models",
132
+ input: { hint: "[--check|--uninstall|--models [--json]]" },
133
+ recordInput: false,
134
+ handler: (invocation) => {
135
+ const args = commandArguments(invocation.rawInput);
136
+ const valid = args.length === 0
137
+ || (args.length === 1 && ["--check", "--uninstall", "--models"].includes(args[0]))
138
+ || (args.length === 2 && args[0] === "--models" && args[1] === "--json");
139
+ if (!valid) {
140
+ return { kind: "error", text: "Usage: /kimi-setup [--check|--uninstall|--models [--json]]" };
141
+ }
142
+ return execute(invocation, ["setup", ...args]);
143
+ },
144
+ });
145
+ for (const command of ["status", "result", "cancel"]) {
146
+ commandCtx.commands.register({
147
+ definitionId: CommandDefinitionId(`kimi-plugin-cc/dsh/${command}`),
148
+ name: `kimi-${command}`,
149
+ description: `${command === "cancel" ? "Cancel" : command === "status" ? "Inspect" : "Return"} a companion Kimi job`,
150
+ input: { hint: "[job-id]" },
151
+ recordInput: false,
152
+ handler: (invocation) => execute(invocation, [command, ...commandArguments(invocation.rawInput)]),
153
+ });
154
+ }
155
+ });
156
+ }
@@ -595,7 +595,7 @@ function validateVersionSensitiveEvents(events, version) {
595
595
  // Exact schemas reviewed at 2.0.0 (1b89e4b0), 2.0.1 (caf7d4e2),
596
596
  // 2.0.2 (9d07f634), 2.1.0 (52437299), 2.1.1 (f67e6398), 2.2.0 (472192c3),
597
597
  // 2.3.0 (b5e28fd6), 2.3.1 (684bae9e), 2.3.2 (b8dd3a13), 2.3.3 (ec495f0c),
598
- // and 2.4.0 (f26e4d91): the additive events and HookDefSchema are unchanged.
598
+ // 2.4.0 (f26e4d91), and 2.4.1 (2c73f3f5): the additive events and HookDefSchema are unchanged.
599
599
  // Require the full version string AND matching components; no inferred 2.x compatibility.
600
600
  if (version.major === 2 && ((version.minor === 0 && ((version.version === "2.0.0" && version.patch === 0) ||
601
601
  (version.version === "2.0.1" && version.patch === 1) ||
@@ -607,7 +607,8 @@ function validateVersionSensitiveEvents(events, version) {
607
607
  (version.version === "2.3.1" && version.patch === 1) ||
608
608
  (version.version === "2.3.2" && version.patch === 2) ||
609
609
  (version.version === "2.3.3" && version.patch === 3))) ||
610
- (version.minor === 4 && ((version.version === "2.4.0" && version.patch === 0))))) {
610
+ (version.minor === 4 && ((version.version === "2.4.0" && version.patch === 0) ||
611
+ (version.version === "2.4.1" && version.patch === 1))))) {
611
612
  return { valid: true };
612
613
  }
613
614
  if (version.major !== 0) {
@@ -410,7 +410,7 @@ export function hostIdFromHookCommand(command) {
410
410
  }
411
411
  /**
412
412
  * True only for a canonical two-single-quoted-token command whose script is
413
- * `approval-hook.js` under a kimi-plugin-cc/kimi-marketplace install tree.
413
+ * `approval-hook.js` under a kimi-plugin-cc/dsh-kimi-plugin-cc/kimi-marketplace install tree.
414
414
  * This strict ownership test protects hand-rolled and non-canonical user hooks
415
415
  * from orphan pruning.
416
416
  */
@@ -424,5 +424,5 @@ export function isOurApprovalHookCommand(decodedCommand) {
424
424
  const normalized = parsed.hookScript.replace(/\\/g, "/");
425
425
  // Require a real path segment, not an arbitrary substring, so a user hook in
426
426
  // a similarly named wrapper directory is never misclassified and pruned.
427
- return normalized.includes("/kimi-plugin-cc/") || normalized.includes("/kimi-marketplace/");
427
+ return normalized.includes("/kimi-plugin-cc/") || normalized.includes("/dsh-kimi-plugin-cc/") || normalized.includes("/kimi-marketplace/");
428
428
  }
@@ -44,6 +44,7 @@ export const NATIVE_V2_CERTIFIED_VERSIONS = Object.freeze([
44
44
  "2.3.2",
45
45
  "2.3.3",
46
46
  "2.4.0",
47
+ "2.4.1",
47
48
  ]);
48
49
  /** Per-operation native-v2 certification. One green operation never certifies another. */
49
50
  export const NATIVE_V2_CERTIFIED = new Map([