kimi-plugin-cc 2.2.2 → 2.4.0
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.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +5 -3
- package/.mcp.json +13 -0
- package/CHANGELOG.md +18 -0
- package/README.md +57 -5
- package/agents/kimi-challenge.md +3 -3
- package/agents/kimi-pursue.md +1 -1
- package/agents/kimi-rescue.md +2 -2
- package/agents/kimi-review.md +3 -3
- package/commands/README.md +2 -2
- package/commands/challenge.md +1 -1
- package/commands/pursue.md +1 -1
- package/commands/review.md +1 -1
- package/dist/background-spawn.js +9 -17
- package/dist/cli-client.js +24 -63
- package/dist/commands/ask.js +28 -31
- package/dist/commands/cancel.js +50 -23
- package/dist/commands/cli-helpers.js +7 -16
- package/dist/commands/pursue.js +24 -33
- package/dist/commands/registry.js +6 -19
- package/dist/commands/rescue.js +23 -22
- package/dist/commands/review-gate.js +18 -28
- package/dist/commands/review.js +41 -45
- package/dist/commands/setup.js +85 -171
- package/dist/commands/swarm.js +107 -91
- package/dist/commands/worker.js +0 -6
- package/dist/companion.js +13 -40
- package/dist/git.js +14 -7
- package/dist/help.js +2 -0
- package/dist/hooks/approval-hook.js +9 -20
- package/dist/hooks/approval-policy.js +36 -69
- package/dist/hooks/config-safety.js +6 -4
- package/dist/hooks/install-paths.js +62 -138
- package/dist/hooks/install.js +37 -108
- package/dist/hooks/managed-block.js +88 -214
- package/dist/job-id.js +12 -0
- package/dist/job-store.js +65 -28
- package/dist/jobs.js +9 -1
- package/dist/kimi-command.js +1 -3
- package/dist/kimi-engine.js +1 -1
- package/dist/kimi-timeouts.js +9 -21
- package/dist/kimi-version-probe.js +16 -1210
- package/dist/mcp/binding.js +58 -0
- package/dist/mcp/job-control.js +345 -0
- package/dist/mcp/launcher.js +257 -0
- package/dist/mcp/operations.js +301 -0
- package/dist/mcp/protocol.js +275 -0
- package/dist/mcp/server.js +8 -0
- package/dist/mcp/stdio.js +78 -0
- package/dist/mcp/supervised-child.js +15 -0
- package/dist/mcp/tool-result.js +7 -0
- package/dist/mcp/workspace.js +34 -0
- package/dist/model-command.js +32 -0
- package/dist/native-v2-preflight.js +1 -1
- package/dist/parsing.js +4 -18
- package/dist/rescue-approval.js +78 -164
- package/dist/session-recovery.js +7 -10
- package/dist/stream-json.js +6 -174
- package/dist/version.js +1 -1
- package/docs/migration.md +2 -6
- package/docs/registry-releases.md +23 -7
- package/docs/safety.md +30 -14
- package/package.json +7 -3
- package/plugins/kimi-codex/.codex-plugin/plugin.json +8 -5
- package/plugins/kimi-codex/.mcp.json +28 -0
- package/plugins/kimi-codex/dist/background-spawn.js +9 -17
- package/plugins/kimi-codex/dist/cli-client.js +24 -63
- package/plugins/kimi-codex/dist/commands/ask.js +28 -31
- package/plugins/kimi-codex/dist/commands/cancel.js +50 -23
- package/plugins/kimi-codex/dist/commands/cli-helpers.js +7 -16
- package/plugins/kimi-codex/dist/commands/pursue.js +24 -33
- package/plugins/kimi-codex/dist/commands/registry.js +6 -19
- package/plugins/kimi-codex/dist/commands/rescue.js +23 -22
- package/plugins/kimi-codex/dist/commands/review-gate.js +18 -28
- package/plugins/kimi-codex/dist/commands/review.js +41 -45
- package/plugins/kimi-codex/dist/commands/setup.js +85 -171
- package/plugins/kimi-codex/dist/commands/swarm.js +107 -91
- package/plugins/kimi-codex/dist/commands/worker.js +0 -6
- package/plugins/kimi-codex/dist/companion.js +13 -40
- package/plugins/kimi-codex/dist/git.js +14 -7
- package/plugins/kimi-codex/dist/help.js +2 -0
- package/plugins/kimi-codex/dist/hooks/approval-hook.js +9 -20
- package/plugins/kimi-codex/dist/hooks/approval-policy.js +36 -69
- package/plugins/kimi-codex/dist/hooks/config-safety.js +6 -4
- package/plugins/kimi-codex/dist/hooks/install-paths.js +62 -138
- package/plugins/kimi-codex/dist/hooks/install.js +37 -108
- package/plugins/kimi-codex/dist/hooks/managed-block.js +88 -214
- package/plugins/kimi-codex/dist/job-id.js +12 -0
- package/plugins/kimi-codex/dist/job-store.js +65 -28
- package/plugins/kimi-codex/dist/jobs.js +9 -1
- package/plugins/kimi-codex/dist/kimi-command.js +1 -3
- package/plugins/kimi-codex/dist/kimi-engine.js +1 -1
- package/plugins/kimi-codex/dist/kimi-timeouts.js +9 -21
- package/plugins/kimi-codex/dist/kimi-version-probe.js +16 -1210
- package/plugins/kimi-codex/dist/mcp/binding.js +58 -0
- package/plugins/kimi-codex/dist/mcp/job-control.js +345 -0
- package/plugins/kimi-codex/dist/mcp/launcher.js +257 -0
- package/plugins/kimi-codex/dist/mcp/operations.js +301 -0
- package/plugins/kimi-codex/dist/mcp/protocol.js +275 -0
- package/plugins/kimi-codex/dist/mcp/server.js +8 -0
- package/plugins/kimi-codex/dist/mcp/stdio.js +78 -0
- package/plugins/kimi-codex/dist/mcp/supervised-child.js +15 -0
- package/plugins/kimi-codex/dist/mcp/tool-result.js +7 -0
- package/plugins/kimi-codex/dist/mcp/workspace.js +34 -0
- package/plugins/kimi-codex/dist/model-command.js +32 -0
- package/plugins/kimi-codex/dist/native-v2-preflight.js +1 -1
- package/plugins/kimi-codex/dist/parsing.js +4 -18
- package/plugins/kimi-codex/dist/rescue-approval.js +78 -164
- package/plugins/kimi-codex/dist/session-recovery.js +7 -10
- package/plugins/kimi-codex/dist/stream-json.js +6 -174
- package/plugins/kimi-codex/dist/version.js +1 -1
- package/plugins/kimi-codex/skills/kimi-ask/SKILL.md +2 -2
- package/plugins/kimi-codex/skills/kimi-cancel/SKILL.md +1 -1
- package/plugins/kimi-codex/skills/kimi-challenge/SKILL.md +1 -1
- package/plugins/kimi-codex/skills/kimi-pursue/SKILL.md +1 -1
- package/plugins/kimi-codex/skills/kimi-replay/SKILL.md +1 -1
- package/plugins/kimi-codex/skills/kimi-rescue/SKILL.md +1 -1
- package/plugins/kimi-codex/skills/kimi-result/SKILL.md +1 -1
- package/plugins/kimi-codex/skills/kimi-review/SKILL.md +3 -3
- package/plugins/kimi-codex/skills/kimi-setup/SKILL.md +1 -1
- package/plugins/kimi-codex/skills/kimi-status/SKILL.md +1 -1
- package/plugins/kimi-codex/skills/kimi-swarm/SKILL.md +1 -1
- package/plugins/kimi-codex/skills/kimi-swarm-write/SKILL.md +1 -1
|
@@ -30,6 +30,9 @@ export function normalizeJobError(error) {
|
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
export async function markJobFailed(store, paths, job, error, summary = "Job failed.", options) {
|
|
33
|
+
const current = store.getJob(job.job_id) ?? job;
|
|
34
|
+
if (current.status !== "running")
|
|
35
|
+
return current;
|
|
33
36
|
if (options?.partialOutput) {
|
|
34
37
|
const label = job.command_type[0].toUpperCase() + job.command_type.slice(1);
|
|
35
38
|
summary = `${label} timed out after ${formatBudgetDuration(options.partialOutput.budgetMs)}; partial output captured (${options.partialOutput.text.trim().length} chars).`;
|
|
@@ -55,6 +58,9 @@ export async function markJobFailed(store, paths, job, error, summary = "Job fai
|
|
|
55
58
|
}) ?? artifactJob);
|
|
56
59
|
}
|
|
57
60
|
export async function markJobCancelled(store, paths, job, summary, error, options) {
|
|
61
|
+
const current = store.getJob(job.job_id) ?? job;
|
|
62
|
+
if (current.status !== "running")
|
|
63
|
+
return current;
|
|
58
64
|
const normalized = error ? normalizeJobError(error) : null;
|
|
59
65
|
const phase = options?.phase;
|
|
60
66
|
const artifactJob = {
|
|
@@ -77,6 +83,8 @@ export async function markJobCancelled(store, paths, job, summary, error, option
|
|
|
77
83
|
}
|
|
78
84
|
export async function sweepStaleJobs(store, paths) {
|
|
79
85
|
for (const job of store.listRunningJobsWithProcessHints()) {
|
|
86
|
+
if (store.getMcpTask(job.job_id))
|
|
87
|
+
continue;
|
|
80
88
|
if (!isStaleEnoughToSweep(job)) {
|
|
81
89
|
continue;
|
|
82
90
|
}
|
|
@@ -109,7 +117,7 @@ export async function sweepStaleJobs(store, paths) {
|
|
|
109
117
|
await markJobFailed(store, paths, job, new RuntimeError("FOREGROUND_PROCESS_DISAPPEARED", describeMissingForegroundProcess(job, companionMissing, kimiMissing), "jobs.sweep"), "Foreground Kimi job disappeared before reporting a terminal state.", job.command_type === "ask" || job.command_type === "rescue" ? { phase: "failed" } : undefined);
|
|
110
118
|
}
|
|
111
119
|
}
|
|
112
|
-
const STALE_SWEEP_GRACE_MS = 15_000;
|
|
120
|
+
export const STALE_SWEEP_GRACE_MS = 15_000;
|
|
113
121
|
function isStaleEnoughToSweep(job) {
|
|
114
122
|
const updatedAt = Date.parse(job.updated_at);
|
|
115
123
|
return Number.isFinite(updatedAt) && Date.now() - updatedAt >= STALE_SWEEP_GRACE_MS;
|
|
@@ -10,9 +10,7 @@ export function resolveKimiCliCommand(env) {
|
|
|
10
10
|
parsed = JSON.parse(raw);
|
|
11
11
|
}
|
|
12
12
|
catch {
|
|
13
|
-
// Plain-text
|
|
14
|
-
// an existing `KIMI_PLUGIN_CC_KIMI_PREFIX_ARGS="--import tsx ..."`
|
|
15
|
-
// export don't have to migrate to JSON for v1.0.
|
|
13
|
+
// Plain-text values are space-split for launcher-style overrides.
|
|
16
14
|
const plainArgs = raw.split(" ").filter(Boolean);
|
|
17
15
|
assertPrefixArgsSafe(plainArgs, raw);
|
|
18
16
|
return { command, prefixArgs: plainArgs };
|
|
@@ -40,6 +40,7 @@ export const NATIVE_V2_CERTIFIED_VERSIONS = Object.freeze([
|
|
|
40
40
|
"2.1.1",
|
|
41
41
|
"2.2.0",
|
|
42
42
|
"2.3.0",
|
|
43
|
+
"2.3.1",
|
|
43
44
|
]);
|
|
44
45
|
/** Per-operation native-v2 certification. One green operation never certifies another. */
|
|
45
46
|
export const NATIVE_V2_CERTIFIED = new Map([
|
|
@@ -578,7 +579,6 @@ async function resolveExactExecutable(command, cwd, env) {
|
|
|
578
579
|
return await realpath(candidate);
|
|
579
580
|
}
|
|
580
581
|
catch {
|
|
581
|
-
// Keep searching; failure is reported once with the original command.
|
|
582
582
|
}
|
|
583
583
|
}
|
|
584
584
|
throw new RuntimeError("KIMI_EXECUTION_PLAN_UNRESOLVED", `Refusing to spawn kimi because executable ${JSON.stringify(command)} could not be resolved to an exact runnable path. Run Claude Code \`/kimi:setup\` or Codex \`$kimi-setup\` to verify the active binary, or correct KIMI_PLUGIN_CC_KIMI_BIN and retry.`, "kimi-engine.plan", { details: { command, cwd } });
|
|
@@ -1,21 +1,8 @@
|
|
|
1
|
-
// Per-command response
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
// subprocess transport collapses spawn + prompt into a single
|
|
7
|
-
// `runCliPromptWithBudget` call (see `runtime/cli-client.ts`), and
|
|
8
|
-
// startup failures surface as CLI_SPAWN_FAILED / CLI_PROCESS_ERROR —
|
|
9
|
-
// not as separate timeouts. So only the per-command response budgets
|
|
10
|
-
// remain.
|
|
11
|
-
// Budgets accommodate thinking-capable workflows; per-run effort is only a request.
|
|
12
|
-
// kimi-code spends real wallclock on extended reasoning before emitting
|
|
13
|
-
// the first assistant record; pre-alpha.4 budgets (300s/600s) were sized
|
|
14
|
-
// against the non-thinking path and timed out in production smoke
|
|
15
|
-
// testing under default flags. Defaults are now 1800/1800/2700 seconds
|
|
16
|
-
// for ask/review/rescue to allow repo-wide work; review-gate stays at
|
|
17
|
-
// 8s because it fires inside Claude Code's Stop hook and is forced to
|
|
18
|
-
// thinking-off in its own caller.
|
|
1
|
+
// Per-command response budgets leave room for thinking-capable workflows;
|
|
2
|
+
// per-run effort is only a request. Ask/review default to 30 minutes and rescue
|
|
3
|
+
// to 45 minutes for repo-wide work. Review-gate stays at 8 seconds because it
|
|
4
|
+
// runs inside Claude Code's Stop hook and requests thinking off by default;
|
|
5
|
+
// KIMI_PLUGIN_CC_REVIEW_GATE_THINKING can override that request.
|
|
19
6
|
/** Ask budget. Conversational; thinking-on free-form reasoning. */
|
|
20
7
|
export const KIMI_ASK_PROMPT_TIMEOUT_MS = 1_800_000; // 30 minutes
|
|
21
8
|
/** Review/challenge budget. Thinking-on single-turn analysis over the workspace. */
|
|
@@ -25,8 +12,8 @@ export const KIMI_RESCUE_PROMPT_TIMEOUT_MS = 2_700_000; // 45 minutes
|
|
|
25
12
|
/**
|
|
26
13
|
* Pursue (autonomous goal mode) DEFAULT wall-clock ceiling when the user
|
|
27
14
|
* passes no `--budget`. This is the ONLY hard bound on an autonomous goal —
|
|
28
|
-
* headless goal create sets no token/turn budget
|
|
29
|
-
* SetGoalBudget
|
|
15
|
+
* headless goal create sets no token/turn budget, and the managed hook denies
|
|
16
|
+
* SetGoalBudget. The same duration as
|
|
30
17
|
* the single-turn rescue default, but a safety ceiling rather than a patience
|
|
31
18
|
* knob. Deliberately finite. Overridable per-job via `--budget` (parsed to ms in
|
|
32
19
|
* parsePursueArgs). See runtime/commands/pursue.ts and docs/safety.md.
|
|
@@ -53,7 +40,8 @@ export const KIMI_SWARM_DEFAULT_BUDGET_MS = 1_800_000; // 30 minutes
|
|
|
53
40
|
* KIMI_PLUGIN_CC_REVIEW_GATE_THINKING can inherit or request another effort.
|
|
54
41
|
* BYO/non-trait-driven providers and always-thinking models can ignore it.
|
|
55
42
|
* The 8s timeout remains fail-open; a request never guarantees completion.
|
|
56
|
-
* Hook-
|
|
43
|
+
* Hook-escape findings annotate the result and never block or change job outcome.
|
|
44
|
+
* See docs/safety.md.
|
|
57
45
|
*/
|
|
58
46
|
export const KIMI_REVIEW_GATE_TIMEOUT_MS = 8_000;
|
|
59
47
|
export function isTimeoutCode(code) {
|