kimi-plugin-cc 2.4.5 → 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 (109) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +14 -0
  4. package/README.md +42 -26
  5. package/dist/dsh/companion.js +174 -0
  6. package/dist/dsh/index.js +156 -0
  7. package/dist/hooks/install-paths.js +2 -2
  8. package/dist/version.js +1 -1
  9. package/docs/models.md +5 -1
  10. package/docs/registry-releases.md +20 -17
  11. package/docs/safety.md +22 -9
  12. package/docs/upstream-2.4.1-certification.md +6 -0
  13. package/package.json +40 -6
  14. package/plugins/kimi-codex/.codex-plugin/plugin.json +1 -1
  15. package/plugins/kimi-codex/dist/dsh/companion.js +174 -0
  16. package/plugins/kimi-codex/dist/dsh/index.js +156 -0
  17. package/plugins/kimi-codex/dist/hooks/install-paths.js +2 -2
  18. package/plugins/kimi-codex/dist/version.js +1 -1
  19. package/plugins/kimi-dsh/LICENSE +201 -0
  20. package/plugins/kimi-dsh/README.md +80 -0
  21. package/plugins/kimi-dsh/cordis.patch.yml +45 -0
  22. package/plugins/kimi-dsh/dist/background-spawn.js +216 -0
  23. package/plugins/kimi-dsh/dist/cli-cancellation.js +43 -0
  24. package/plugins/kimi-dsh/dist/cli-client.js +876 -0
  25. package/plugins/kimi-dsh/dist/commands/ask.js +336 -0
  26. package/plugins/kimi-dsh/dist/commands/cancel.js +216 -0
  27. package/plugins/kimi-dsh/dist/commands/cli-helpers.js +201 -0
  28. package/plugins/kimi-dsh/dist/commands/models.js +140 -0
  29. package/plugins/kimi-dsh/dist/commands/not-implemented.js +4 -0
  30. package/plugins/kimi-dsh/dist/commands/pursue.js +307 -0
  31. package/plugins/kimi-dsh/dist/commands/recover-swarm.js +135 -0
  32. package/plugins/kimi-dsh/dist/commands/registry.js +74 -0
  33. package/plugins/kimi-dsh/dist/commands/repair-sessions.js +160 -0
  34. package/plugins/kimi-dsh/dist/commands/replay.js +124 -0
  35. package/plugins/kimi-dsh/dist/commands/rescue.js +347 -0
  36. package/plugins/kimi-dsh/dist/commands/result.js +66 -0
  37. package/plugins/kimi-dsh/dist/commands/review-gate.js +390 -0
  38. package/plugins/kimi-dsh/dist/commands/review.js +220 -0
  39. package/plugins/kimi-dsh/dist/commands/setup.js +1047 -0
  40. package/plugins/kimi-dsh/dist/commands/status.js +27 -0
  41. package/plugins/kimi-dsh/dist/commands/swarm.js +754 -0
  42. package/plugins/kimi-dsh/dist/commands/worker.js +25 -0
  43. package/plugins/kimi-dsh/dist/companion.js +97 -0
  44. package/plugins/kimi-dsh/dist/config.js +22 -0
  45. package/plugins/kimi-dsh/dist/dsh/companion.js +174 -0
  46. package/plugins/kimi-dsh/dist/dsh/index.js +156 -0
  47. package/plugins/kimi-dsh/dist/errors.js +40 -0
  48. package/plugins/kimi-dsh/dist/git.js +224 -0
  49. package/plugins/kimi-dsh/dist/help.js +43 -0
  50. package/plugins/kimi-dsh/dist/hook-escape.js +71 -0
  51. package/plugins/kimi-dsh/dist/hooks/approval-hook.js +101 -0
  52. package/plugins/kimi-dsh/dist/hooks/approval-policy.js +211 -0
  53. package/plugins/kimi-dsh/dist/hooks/config-safety.js +653 -0
  54. package/plugins/kimi-dsh/dist/hooks/install-paths.js +428 -0
  55. package/plugins/kimi-dsh/dist/hooks/install.js +210 -0
  56. package/plugins/kimi-dsh/dist/hooks/managed-block.js +619 -0
  57. package/plugins/kimi-dsh/dist/hooks/review-gate-stop.js +19 -0
  58. package/plugins/kimi-dsh/dist/job-id.js +12 -0
  59. package/plugins/kimi-dsh/dist/job-store.js +659 -0
  60. package/plugins/kimi-dsh/dist/jobs.js +217 -0
  61. package/plugins/kimi-dsh/dist/kimi-command.js +70 -0
  62. package/plugins/kimi-dsh/dist/kimi-engine.js +632 -0
  63. package/plugins/kimi-dsh/dist/kimi-errors.js +260 -0
  64. package/plugins/kimi-dsh/dist/kimi-home.js +9 -0
  65. package/plugins/kimi-dsh/dist/kimi-timeouts.js +52 -0
  66. package/plugins/kimi-dsh/dist/kimi-version-probe.js +216 -0
  67. package/plugins/kimi-dsh/dist/logging.js +22 -0
  68. package/plugins/kimi-dsh/dist/mcp/binding.js +58 -0
  69. package/plugins/kimi-dsh/dist/mcp/job-control.js +345 -0
  70. package/plugins/kimi-dsh/dist/mcp/launcher.js +257 -0
  71. package/plugins/kimi-dsh/dist/mcp/operations.js +301 -0
  72. package/plugins/kimi-dsh/dist/mcp/protocol.js +275 -0
  73. package/plugins/kimi-dsh/dist/mcp/server.js +8 -0
  74. package/plugins/kimi-dsh/dist/mcp/stdio.js +78 -0
  75. package/plugins/kimi-dsh/dist/mcp/supervised-child.js +15 -0
  76. package/plugins/kimi-dsh/dist/mcp/tool-result.js +7 -0
  77. package/plugins/kimi-dsh/dist/mcp/workspace.js +34 -0
  78. package/plugins/kimi-dsh/dist/model-command.js +32 -0
  79. package/plugins/kimi-dsh/dist/native-v2-preflight.js +417 -0
  80. package/plugins/kimi-dsh/dist/package.json +1 -0
  81. package/plugins/kimi-dsh/dist/parsing.js +620 -0
  82. package/plugins/kimi-dsh/dist/paths.js +27 -0
  83. package/plugins/kimi-dsh/dist/plugin-data.js +98 -0
  84. package/plugins/kimi-dsh/dist/process-tree.js +479 -0
  85. package/plugins/kimi-dsh/dist/prompt-size.js +18 -0
  86. package/plugins/kimi-dsh/dist/render.js +177 -0
  87. package/plugins/kimi-dsh/dist/rescue-approval.js +865 -0
  88. package/plugins/kimi-dsh/dist/schemas/review-gate-output.js +43 -0
  89. package/plugins/kimi-dsh/dist/session-recovery.js +200 -0
  90. package/plugins/kimi-dsh/dist/session-title.js +293 -0
  91. package/plugins/kimi-dsh/dist/stream-json.js +346 -0
  92. package/plugins/kimi-dsh/dist/swarm-activation.js +834 -0
  93. package/plugins/kimi-dsh/dist/swarm-recovery.js +134 -0
  94. package/plugins/kimi-dsh/dist/types.js +1 -0
  95. package/plugins/kimi-dsh/dist/vendor/shell-quote/LICENSE +24 -0
  96. package/plugins/kimi-dsh/dist/vendor/shell-quote/index.js +1 -0
  97. package/plugins/kimi-dsh/dist/vendor/shell-quote/parse.js +229 -0
  98. package/plugins/kimi-dsh/dist/vendor/smol-toml/LICENSE +24 -0
  99. package/plugins/kimi-dsh/dist/vendor/smol-toml/date.js +156 -0
  100. package/plugins/kimi-dsh/dist/vendor/smol-toml/error.js +67 -0
  101. package/plugins/kimi-dsh/dist/vendor/smol-toml/extract.js +293 -0
  102. package/plugins/kimi-dsh/dist/vendor/smol-toml/parse.js +164 -0
  103. package/plugins/kimi-dsh/dist/vendor/smol-toml/primitive.js +151 -0
  104. package/plugins/kimi-dsh/dist/vendor/smol-toml/struct.js +156 -0
  105. package/plugins/kimi-dsh/dist/vendor/smol-toml/util.js +57 -0
  106. package/plugins/kimi-dsh/dist/version.js +7 -0
  107. package/plugins/kimi-dsh/package.json +48 -0
  108. package/plugins/kimi-dsh/scripts/companion.sh +37 -0
  109. package/plugins/kimi-dsh/scripts/review-gate-hook.sh +32 -0
@@ -0,0 +1,156 @@
1
+ /*!
2
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
11
+ * this list of conditions and the following disclaimer in the
12
+ * documentation and/or other materials provided with the distribution.
13
+ * 3. Neither the name of the copyright holder nor the names of its contributors
14
+ * may be used to endorse or promote products derived from this software without
15
+ * specific prior written permission.
16
+ *
17
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+ */
28
+ import { parseString } from './primitive.js';
29
+ import { extractValue } from './extract.js';
30
+ import { skipVoid } from './util.js';
31
+ import { TomlError } from './error.js';
32
+ /** @internal */
33
+ export function parseKey(ctx, end = 0x3d /* = */) {
34
+ // States:
35
+ // 0: before first char
36
+ // 1: parsing bare key
37
+ // 2: after key component
38
+ let startPtr;
39
+ let state = 0;
40
+ let parsed = [];
41
+ let sliceStart;
42
+ let c = ctx.s.charCodeAt(startPtr = ctx.p);
43
+ do {
44
+ // End of key
45
+ if (c === end) {
46
+ if (!state)
47
+ TomlError.x('unexpected end of key', ctx);
48
+ if (state === 1)
49
+ parsed.push(ctx.s.slice(sliceStart, ctx.p));
50
+ return ctx.p++, parsed;
51
+ }
52
+ // Dotted key separator
53
+ else if (c === 0x2e /* . */) {
54
+ if (!state)
55
+ TomlError.x('illegal empty bare key', ctx);
56
+ if (state === 1)
57
+ parsed.push(ctx.s.slice(sliceStart, ctx.p));
58
+ state = 0;
59
+ }
60
+ // Quoted key
61
+ else if (!state && (c === 0x22 /* " */ || c === 0x27 /* ' */)) {
62
+ if (c === ctx.s.charCodeAt(ctx.p + 1) && c === ctx.s.charCodeAt(ctx.p + 2))
63
+ TomlError.x('illegal quoted key: multiline strings are not allowed', ctx);
64
+ parsed.push(parseString(ctx));
65
+ state = 2;
66
+ ctx.p--;
67
+ }
68
+ // Whitespace; no-op in state 0 and 2, end of bare key in state 1
69
+ else if (c === 0x20 || c === 0x9 /* \t */) {
70
+ if (state === 1) {
71
+ parsed.push(ctx.s.slice(sliceStart, ctx.p));
72
+ state = 2;
73
+ }
74
+ }
75
+ // If state is post-key, no character is allowed; otherwise ensure it's a bare-key component
76
+ else if (state === 2 || (c < 0x30 && c !== 0x2d /* - */) || (c > 0x39 && c < 0x41) || (c > 0x5a && c < 0x61 && c !== 0x5f /* _ */) || c > 0x7a) {
77
+ TomlError.x('illegal character in key', ctx);
78
+ }
79
+ // Illegal character
80
+ else if (!state) {
81
+ state = 1;
82
+ sliceStart = ctx.p;
83
+ }
84
+ } while (c = ctx.s.charCodeAt(++ctx.p));
85
+ TomlError.x('incomplete key-value: cannot find end of key', ctx, startPtr);
86
+ }
87
+ /** @internal */
88
+ export function parseInlineTable(ctx) {
89
+ let startPtr = ctx.p++;
90
+ let res = Object.create(null);
91
+ let seen = new Set();
92
+ let c;
93
+ while (ctx.p < ctx.s.length) {
94
+ skipVoid(ctx);
95
+ if ((c = ctx.s.charCodeAt(ctx.p)) === 0x7d /* } */) {
96
+ ctx.p++;
97
+ return res;
98
+ }
99
+ let k;
100
+ let t = res;
101
+ let hasOwn = false;
102
+ let errPtr = ctx.p;
103
+ let key = parseKey(ctx);
104
+ for (let i = 0; i < key.length; i++) {
105
+ if (i)
106
+ t = hasOwn ? t[k] : (t[k] = Object.create(null));
107
+ k = key[i];
108
+ if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== 'object' || seen.has(t[k]))) {
109
+ TomlError.x('trying to redefine an already defined value', ctx, errPtr);
110
+ }
111
+ let unsafe = k === '__proto__';
112
+ if (ctx.uk && (unsafe || k === 'constructor')) {
113
+ t = ctx.uk !== 1 && TomlError.x('document contains an unsafe property', ctx, errPtr);
114
+ break;
115
+ }
116
+ if (!hasOwn && unsafe) {
117
+ Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
118
+ }
119
+ }
120
+ if (hasOwn) {
121
+ TomlError.x('trying to redefine an already defined value', ctx, errPtr);
122
+ }
123
+ skipVoid(ctx, true, true);
124
+ let value = extractValue(ctx, 0x7d /* } */);
125
+ if (t && typeof (t[k] = value) === 'object')
126
+ seen.add(value);
127
+ skipVoid(ctx);
128
+ if ((c = ctx.s.charCodeAt(ctx.p++)) === 0x7d /* } */) {
129
+ return res;
130
+ }
131
+ if (c !== 0x2c /* , */)
132
+ TomlError.x('expected comma or end of structure', ctx, ctx.p - 1);
133
+ }
134
+ TomlError.x('unfinished table', ctx, startPtr);
135
+ }
136
+ /** @internal */
137
+ export function parseArray(ctx) {
138
+ let startPtr = ctx.p++;
139
+ let res = [];
140
+ let c;
141
+ while (ctx.p < ctx.s.length) {
142
+ skipVoid(ctx);
143
+ if ((c = ctx.s.charCodeAt(ctx.p)) === 0x5d /* ] */) {
144
+ ctx.p++;
145
+ return res;
146
+ }
147
+ res.push(extractValue(ctx, 0x5d /* ] */));
148
+ skipVoid(ctx);
149
+ if ((c = ctx.s.charCodeAt(ctx.p++)) === 0x5d /* ] */) {
150
+ return res;
151
+ }
152
+ if (c !== 0x2c /* , */)
153
+ TomlError.x('expected comma or end of structure', ctx, ctx.p - 1);
154
+ }
155
+ TomlError.x('unfinished array', ctx, startPtr);
156
+ }
@@ -0,0 +1,57 @@
1
+ /*!
2
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
11
+ * this list of conditions and the following disclaimer in the
12
+ * documentation and/or other materials provided with the distribution.
13
+ * 3. Neither the name of the copyright holder nor the names of its contributors
14
+ * may be used to endorse or promote products derived from this software without
15
+ * specific prior written permission.
16
+ *
17
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+ */
28
+ import { TomlError } from './error.js';
29
+ /** @internal */
30
+ export function skipComment(ctx) {
31
+ for (; ctx.p < ctx.s.length; ctx.p++) {
32
+ let c = ctx.s.charCodeAt(ctx.p);
33
+ if (c === 0xa /* \n */)
34
+ break;
35
+ if (c === 0xd /* \r */ && ctx.s.charCodeAt(ctx.p + 1) === 0xa /* \n */) {
36
+ ctx.p++;
37
+ break;
38
+ }
39
+ if ((c < 0x20 && c !== 0x9 /* \t */) || c === 0x7f) {
40
+ TomlError.x('control characters are not allowed in comments', ctx);
41
+ }
42
+ }
43
+ }
44
+ /** @internal */
45
+ export function skipVoid(ctx, banNewLines, banComments) {
46
+ let c;
47
+ while (ctx.p < ctx.s.length) {
48
+ while (ctx.p < ctx.s.length && ((c = ctx.s.charCodeAt(ctx.p)) === 0x20 ||
49
+ c === 0x9 /* \t */ ||
50
+ (!banNewLines &&
51
+ (c === 0xa /* \n */ || (c === 0xd /* \r */ && ctx.s.charCodeAt(ctx.p + 1) === 0xa /* \n */)))))
52
+ ctx.p++;
53
+ if (banComments || c !== 0x23 /* # */)
54
+ break;
55
+ skipComment(ctx);
56
+ }
57
+ }
@@ -0,0 +1,7 @@
1
+ // Single source of truth for the plugin version that the runtime reports
2
+ // in setup output and managed-block markers. Keep this in sync with
3
+ // package.json, .claude-plugin/plugin.json, .claude-plugin/marketplace.json,
4
+ // and AGENTS.md on every release. A future improvement would read this from
5
+ // package.json at build time, but that adds a build-step dependency we
6
+ // don't want yet.
7
+ export const KIMI_PLUGIN_CC_VERSION = "2.5.1";
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "kimi-plugin-cc",
3
+ "version": "2.5.1",
4
+ "description": "Kimi Code subagents for DeepSeek Harness: all seven ask, review, challenge, rescue, pursue, swarm, and swarm-write operations through the kimi-plugin-cc companion runtime.",
5
+ "type": "module",
6
+ "main": "dist/dsh/index.js",
7
+ "exports": {
8
+ ".": "./dist/dsh/index.js",
9
+ "./cordis.patch.yml": "./cordis.patch.yml",
10
+ "./package.json": "./package.json"
11
+ },
12
+ "files": [
13
+ "cordis.patch.yml",
14
+ "dist/",
15
+ "scripts/",
16
+ "README.md",
17
+ "LICENSE"
18
+ ],
19
+ "engines": {
20
+ "node": ">=24.9.0",
21
+ "dsh": ">=0.2.1-rc.5 <0.3.0"
22
+ },
23
+ "dsh": {
24
+ "bundle": {
25
+ "patch": "./cordis.patch.yml"
26
+ }
27
+ },
28
+ "peerDependencies": {
29
+ "@deepseek-ai/cordis": "~4.0.5",
30
+ "@deepseek-ai/dsh-commands": ">=0.2.1-rc.5 <0.3.0",
31
+ "@deepseek-ai/dsh-llm": ">=0.2.1-rc.5 <0.3.0",
32
+ "@deepseek-ai/dsh-session": ">=0.2.1-rc.5 <0.3.0",
33
+ "@deepseek-ai/dsh-subagent": ">=0.2.1-rc.5 <0.3.0",
34
+ "@deepseek-ai/dsh-subprocess": ">=0.2.1-rc.5 <0.3.0",
35
+ "@deepseek-ai/dsh-working-directory": ">=0.2.1-rc.5 <0.3.0"
36
+ },
37
+ "dependencies": {
38
+ "@deepseek-ai/dsh-brand": ">=0.2.1-rc.5 <0.3.0",
39
+ "@deepseek-ai/dsh-tool-subagent": ">=0.2.1-rc.5 <0.3.0",
40
+ "@deepseek-ai/schemastery": "~3.18.5"
41
+ },
42
+ "license": "Apache-2.0",
43
+ "repository": {
44
+ "type": "git",
45
+ "url": "git+https://github.com/linxule/kimi-plugin-cc.git",
46
+ "directory": "plugins/kimi-dsh"
47
+ }
48
+ }
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # Entry point for slash commands. Launches the compiled Node runtime from the plugin root so
5
+ # that runtime dependencies resolve against the plugin's node_modules, while preserving the
6
+ # user's working directory via KIMI_PLUGIN_CC_WORKSPACE_CWD.
7
+ #
8
+ # Required env: CLAUDE_PLUGIN_ROOT (set by Claude Code when the plugin is installed).
9
+ # Codex plugin hosts may provide PLUGIN_ROOT/PLUGIN_DATA instead; accept those as aliases.
10
+ # When running from the repo checkout, both root env vars may be unset — default to the
11
+ # script's parent directory so `bun run` style local invocation still works.
12
+
13
+ : "${CLAUDE_PLUGIN_ROOT:=${PLUGIN_ROOT:-$(cd "$(dirname "$0")/.." && pwd)}}"
14
+ export CLAUDE_PLUGIN_ROOT
15
+ export PLUGIN_ROOT="${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}"
16
+ # Data-root selection lives in the runtime so commands, workers, and Stop agree.
17
+ # Preserve shared variables verbatim: conflicting values must not be hidden.
18
+ export KIMI_PLUGIN_CC_SHELL_LAUNCH=1
19
+ export KIMI_PLUGIN_CC_WORKSPACE_CWD="${KIMI_PLUGIN_CC_WORKSPACE_CWD:-$PWD}"
20
+
21
+ NODE_BIN="${KIMI_PLUGIN_CC_NODE_BIN:-$(command -v node 2>/dev/null || true)}"
22
+ if [ -z "${NODE_BIN}" ]; then
23
+ echo "kimi-plugin-cc: unable to locate 'node'. Install Node >= 22.5 or set KIMI_PLUGIN_CC_NODE_BIN to an absolute path." >&2
24
+ exit 127
25
+ fi
26
+
27
+ NODE_VERSION_OUT="$("${NODE_BIN}" --version 2>/dev/null || true)"
28
+ NODE_MAJOR="$(printf '%s\n' "${NODE_VERSION_OUT}" | sed -En 's/^v([0-9]+)\..*/\1/p')"
29
+ NODE_MINOR="$(printf '%s\n' "${NODE_VERSION_OUT}" | sed -En 's/^v[0-9]+\.([0-9]+)\..*/\1/p')"
30
+ if [ -z "${NODE_MAJOR}" ] || [ -z "${NODE_MINOR}" ] || [ "${NODE_MAJOR}" -lt 22 ] || \
31
+ { [ "${NODE_MAJOR}" -eq 22 ] && [ "${NODE_MINOR}" -lt 5 ]; }; then
32
+ echo "kimi-plugin-cc requires Node >= 22.5.0 (node:sqlite is a built-in, introduced in 22.5). Found: ${NODE_VERSION_OUT:-unknown}. Upgrade Node or set KIMI_PLUGIN_CC_NODE_BIN to a qualifying binary." >&2
33
+ exit 127
34
+ fi
35
+
36
+ cd "${CLAUDE_PLUGIN_ROOT}"
37
+ exec "${NODE_BIN}" dist/companion.js "$@"
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # Entry point for the Claude Code/Codex Stop hook. Same cwd/env dance as companion.sh —
5
+ # launches the compiled Node runtime from the plugin root while preserving the user's
6
+ # workspace cwd, and honors KIMI_PLUGIN_CC_NODE_BIN so sanitized-PATH environments still work.
7
+
8
+ : "${CLAUDE_PLUGIN_ROOT:=${PLUGIN_ROOT:-$(cd "$(dirname "$0")/.." && pwd)}}"
9
+ export CLAUDE_PLUGIN_ROOT
10
+ export PLUGIN_ROOT="${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}"
11
+ # Data-root selection lives in the runtime so commands, workers, and Stop agree.
12
+ # Preserve shared variables verbatim: conflicting values must not be hidden.
13
+ export KIMI_PLUGIN_CC_SHELL_LAUNCH=1
14
+ export KIMI_PLUGIN_CC_WORKSPACE_CWD="${KIMI_PLUGIN_CC_WORKSPACE_CWD:-$PWD}"
15
+
16
+ NODE_BIN="${KIMI_PLUGIN_CC_NODE_BIN:-$(command -v node 2>/dev/null || true)}"
17
+ if [ -z "${NODE_BIN}" ]; then
18
+ echo "kimi-plugin-cc: unable to locate 'node'. Install Node >= 22.5 or set KIMI_PLUGIN_CC_NODE_BIN to an absolute path." >&2
19
+ exit 127
20
+ fi
21
+
22
+ NODE_VERSION_OUT="$("${NODE_BIN}" --version 2>/dev/null || true)"
23
+ NODE_MAJOR="$(printf '%s\n' "${NODE_VERSION_OUT}" | sed -En 's/^v([0-9]+)\..*/\1/p')"
24
+ NODE_MINOR="$(printf '%s\n' "${NODE_VERSION_OUT}" | sed -En 's/^v[0-9]+\.([0-9]+)\..*/\1/p')"
25
+ if [ -z "${NODE_MAJOR}" ] || [ -z "${NODE_MINOR}" ] || [ "${NODE_MAJOR}" -lt 22 ] || \
26
+ { [ "${NODE_MAJOR}" -eq 22 ] && [ "${NODE_MINOR}" -lt 5 ]; }; then
27
+ echo "kimi-plugin-cc requires Node >= 22.5.0 (node:sqlite is a built-in, introduced in 22.5). Found: ${NODE_VERSION_OUT:-unknown}. Upgrade Node or set KIMI_PLUGIN_CC_NODE_BIN to a qualifying binary." >&2
28
+ exit 127
29
+ fi
30
+
31
+ cd "${CLAUDE_PLUGIN_ROOT}"
32
+ exec "${NODE_BIN}" dist/hooks/review-gate-stop.js