kimi-plugin-cc 2.5.6 → 2.5.8
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 +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +17 -0
- package/README.md +8 -8
- package/agents/kimi-swarm-write.md +3 -3
- package/agents/kimi-swarm.md +3 -3
- package/commands/swarm.md +2 -2
- package/dist/cli-client.js +3 -3
- package/dist/commands/recover-swarm.js +2 -1
- package/dist/commands/setup.js +7 -7
- package/dist/commands/swarm.js +40 -33
- package/dist/hooks/config-safety.js +7 -4
- package/dist/kimi-engine.js +46 -12
- package/dist/mcp/operations.js +1 -1
- package/dist/session-recovery.js +3 -1
- package/dist/stream-json.js +2 -2
- package/dist/swarm-activation.js +73 -32
- package/dist/version.js +1 -1
- package/docs/migration.md +6 -6
- package/docs/registry-releases.md +3 -1
- package/docs/safety.md +19 -16
- package/docs/swarm-recovery.md +4 -2
- package/docs/upstream-2.5.3-certification.md +73 -0
- package/docs/upstream-2.6.0-certification.md +52 -0
- package/package.json +3 -1
- package/plugins/kimi-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/kimi-codex/dist/cli-client.js +3 -3
- package/plugins/kimi-codex/dist/commands/recover-swarm.js +2 -1
- package/plugins/kimi-codex/dist/commands/setup.js +7 -7
- package/plugins/kimi-codex/dist/commands/swarm.js +40 -33
- package/plugins/kimi-codex/dist/hooks/config-safety.js +7 -4
- package/plugins/kimi-codex/dist/kimi-engine.js +46 -12
- package/plugins/kimi-codex/dist/mcp/operations.js +1 -1
- package/plugins/kimi-codex/dist/session-recovery.js +3 -1
- package/plugins/kimi-codex/dist/stream-json.js +2 -2
- package/plugins/kimi-codex/dist/swarm-activation.js +73 -32
- package/plugins/kimi-codex/dist/version.js +1 -1
- package/plugins/kimi-dsh/dist/cli-client.js +3 -3
- package/plugins/kimi-dsh/dist/commands/recover-swarm.js +2 -1
- package/plugins/kimi-dsh/dist/commands/setup.js +7 -7
- package/plugins/kimi-dsh/dist/commands/swarm.js +40 -33
- package/plugins/kimi-dsh/dist/hooks/config-safety.js +7 -4
- package/plugins/kimi-dsh/dist/kimi-engine.js +46 -12
- package/plugins/kimi-dsh/dist/mcp/operations.js +1 -1
- package/plugins/kimi-dsh/dist/session-recovery.js +3 -1
- package/plugins/kimi-dsh/dist/stream-json.js +2 -2
- package/plugins/kimi-dsh/dist/swarm-activation.js +73 -32
- package/plugins/kimi-dsh/dist/version.js +1 -1
- package/plugins/kimi-dsh/package.json +1 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Exact CLI 2.6.0 non-swarm certification — 2026-11-13
|
|
2
|
+
|
|
3
|
+
## Scope and decision
|
|
4
|
+
|
|
5
|
+
**Plugin 2.5.8 certifies exact CLI 2.6.0 for review, challenge, ask, rescue, review_gate and pursue only.** Read-only swarm and write swarm are not certified on 2.6.0 and refuse before model spawn. Exact 2.6.1 and prerelease/build-suffixed versions are not covered. Full eight-operation certification still ends at exact 2.5.3, with its inherited rate-limit limitation disclosed.
|
|
6
|
+
|
|
7
|
+
This is a deliberately narrowed production certification, not a waiver of the upstream scheduler defect and not a claim that the candidate swarm protocol integration is production-certified. Choose 2.6.0 explicitly for non-swarm use; automatic full-swarm pin behavior does not move to this release.
|
|
8
|
+
|
|
9
|
+
Exact source: `@moonshot-ai/kimi-code@2.6.0`, commit `740d6c0bdd777cd8ed0d91eb3d62766910401173`. The isolated npm binary reports 2.6.0; `dist/main.mjs` SHA-256 is `cb912b23358e7b3160e95dc29a82bf5ddd3847cd6f287b34c00c80d80284b620`.
|
|
10
|
+
|
|
11
|
+
## Enforced boundary
|
|
12
|
+
|
|
13
|
+
- `NATIVE_V2_NON_SWARM_VERSIONS` contains exact 2.6.0. `NATIVE_V2_ANY_OPERATION_VERSIONS` is the scoped union used by setup and engine selection; the per-operation map admits 2.6.0 only for the six operations above.
|
|
14
|
+
- `NATIVE_V2_CERTIFIED_VERSIONS` remains the all-operation export through 2.5.3. Existing consumers that intersect that export and select a full-swarm pin do not silently select non-swarm-only 2.6.0.
|
|
15
|
+
- Both swarm operations omit 2.6.0. Fresh planning returns `KIMI_CAPABILITY_NOT_CERTIFIED` with `refusal_kind: "v2-swarm-not-certified"` and `certification_scope: "non-swarm"`; the persisted-plan spawn boundary rejects the same operation/version pairs.
|
|
16
|
+
- A version certified for another operation selects native-v2 and then receives the scoped refusal. Excluded swarm operations never fall back to legacy-v1. Candidate-only operation admission still selects native-v2 for the candidate smoke without extending production certification.
|
|
17
|
+
- Setup reports the six-operation scope and the reason for swarm refusal. The same execution-plan gate covers Claude Code, Codex, DSH and MCP.
|
|
18
|
+
- Write-swarm may create and remove a temporary worktree during execution planning before returning the refusal; no model session is created. Its contract is refusal before model spawn, not an absence of temporary planning side effects. Tests assert the user tree, worktree directories and Git worktree administrative list are unchanged after cleanup.
|
|
19
|
+
|
|
20
|
+
## Candidate and source evidence
|
|
21
|
+
|
|
22
|
+
- Exact 2.6.0 source scan: **19 tests / 225 assertions**, exit 0 (`non-swarm-source-scan.log`). Exact 2.5.3 regression: **19 tests / 153 assertions**, exit 0 (`non-swarm-source-regression.log`). Both were rerun for this scoped certification with fresh retained logs. `non-swarm-source-provenance.json` binds each log to its exact version, source commit and log SHA-256.
|
|
23
|
+
- The full-scope candidate matrix passed **24 tests / 201 assertions / no skips in 343.76 seconds**. It exercised candidate swarm behavior but does not grant production swarm certification. It predates the canonical execution-cwd and recovery changes; later targeted and compiled controls cover those changes.
|
|
24
|
+
- All seven exact-binary controls passed, including ordinary Write denial, armed-plan bypass, removed EnterPlanMode rejection, environment refusals, swarm OFF/ON, and out-of-root child denials. Armed plan mode wrote a 1,294-byte plan file without a plan-Write hook, proving that the no-plan closures remain load-bearing.
|
|
25
|
+
- Live-root, mixed/multi-batch and nested-swarm controls passed. Strengthened cancellation and deterministic budget teardown used real disjoint Bash producers, verified owner identities, zero descendants and stable retained patches/files for nine seconds. Those are candidate integration controls, not production 2.6.0 swarm claims.
|
|
26
|
+
- The candidate protocol uses authenticated direct `subscribe` / `response` state proof. Canonical execution roots and recovery deactivation fixes are included. The narrowed production scope does not certify that activation or recovery path on 2.6.0.
|
|
27
|
+
|
|
28
|
+
## Production-table evidence
|
|
29
|
+
|
|
30
|
+
The retained production run is `daily-monitor/smoke/2026-11-13-2.6.0-production.log`, launched without `KIMI_PLUGIN_CC_SMOKE_V2_CANDIDATE` and using the exact binary and hash above:
|
|
31
|
+
|
|
32
|
+
- **23 passed / 3 intentional exclusions / 0 failures / 170 assertions in 241.67 seconds**, terminal exit 0.
|
|
33
|
+
- Review, challenge, ask and review_gate each produced a same-call managed Write denial. Real rescue landed only its confined write and persisted certified native-v2 operation/version/session/artifact evidence. The separate absolute `Bash.cwd` attempt was denied on the same call.
|
|
34
|
+
- Default-plan, unsafe-experimental and plan-tainted resume refusals passed. The multi-turn goal control recorded **3,002 durable started turns, 3,001 turns with same-call managed denials and 3,004 denial results**, with no target file. Both pursue terminal-status controls passed.
|
|
35
|
+
- Both real swarm command paths returned `v2-swarm-not-certified` before creating a model session. Write-swarm left no retained worktree and no user-tree change. The follow-up exact-binary refusal control additionally asserts the Git worktree administrative list is unchanged; its result is `non-swarm-refusal-controls.log`.
|
|
36
|
+
- The only skipped tests are read-only swarm confinement, write-swarm patch capture and write-swarm out-of-root confinement. They are explicitly outside this certification scope and are not represented as passing evidence. No other skip is accepted.
|
|
37
|
+
- The matrix's runtime/test diff is `non-swarm-production-runtime.diff`, SHA-256 `4531239acccb8b01c58b40a663958191a7da750a42ba5f475f01aaf1218f96a0`. Subsequent runtime deltas are the version string, restoration of candidate-only native-v2 selection, and the full-operation versus any-operation export split that preserves existing pin behavior. Production 2.6.0 scope is unchanged; current compiled controls verify it. Other deltas are documentation and test-only coverage, including the Git-admin assertion.
|
|
38
|
+
|
|
39
|
+
The retained focused suite (`non-swarm-focused.log`) passed **186 tests with 17 expected opt-in skips and 4,336 assertions**, exit 0. Compiler and build checks passed before the production run. `tests/runtime/cli-error-compiled.test.ts` additionally executes scoped acceptance/refusal, full-operation export compatibility and candidate selection under Node against root, Codex and DSH emitted JavaScript.
|
|
40
|
+
|
|
41
|
+
## Remaining limitation and follow-up
|
|
42
|
+
|
|
43
|
+
Upstream `AgentRunBatch` can exceed `maxConcurrency` during rate-limit recovery: two active attempts at cap 1 and five at cap 4. The defect is inherited from 2.5.3. Existing full-operation rows retain that disclosed limitation; this release does not claim it is fixed.
|
|
44
|
+
|
|
45
|
+
[Upstream issue #4926](https://github.com/MoonshotAI/kimi-code/issues/4926) tracks the correction. Local commit `52e21c7bf25d102efb0b8b7af28f575519b38d3b` passes 56 focused upstream swarm tests, typecheck, lint and package build, including cap-1/cap-4 and settle-and-continue controls. It is not an upstream release and is not certification evidence. Restoring swarm on a later exact release requires the released correction, fresh cap controls, candidate and production matrices, and independent review.
|
|
46
|
+
|
|
47
|
+
## Final release validation and publication
|
|
48
|
+
|
|
49
|
+
- Definitive isolated full gate (`non-swarm-release-final-check.log`): **1,472 passed / 36 expected skips / 0 failures / 19,530 assertions in 402.26 seconds**, terminal exit 0. Frozen dependency installation and the generated-surface/drift gates passed. `non-swarm-release-validation-root.txt` identifies the unsynced worktree and its exact staged diff SHA-256 `d1a1ffea3f4c23820b6f5bd4b13d60f5a62fbc2c917eca17a9f13605270b2fc6`, including this certification record. An earlier run failed only the host-scoping setup test's five-second timeout (`non-swarm-release-check.log`); the unchanged test passed in isolation in 3.62 seconds (`non-swarm-orphan-test-isolated.log`). Its I/O allowance alone was raised to 30 seconds with every assertion preserved before the passing rerun. Subsequent evidence-wording updates changed no runtime or test bytes.
|
|
50
|
+
- Final package validation (`non-swarm-release-final-package.log`): **333 files**, all three compiled distributions, isolated setup/check/version refusal, patched DSH host/profile with seven providers/tools and Web boot, terminal exit 0. `non-swarm-release-final-consumer.log` passed isolated npm consumer security with exit 0.
|
|
51
|
+
- Codex's final review returned **APPROVE with no blocker or major findings**, after verifying persisted-plan refusals, candidate selection, 2.6.1 refusal and intersection-based full-swarm pins staying at 2.5.3. Its publication-metadata note is handled by recording the actual DSH publication timestamp at publication, as in the preceding release.
|
|
52
|
+
- Claude's final review returned **APPROVE — no blockers, no majors**. Its remaining schema-scope contradiction, environment/plan lists, translated remedy text and new-swarm-certification wording were corrected, and the schema comment's compiled mirrors were regenerated. Initial findings also drove the candidate fix, complete staged snapshot, export compatibility split, evidence corrections and Git-admin assertion. Subsequent CI/publication receipts are recorded below before completion. Publication does not update installed hosts or operator CLI pins.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kimi-plugin-cc",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.8",
|
|
4
4
|
"description": "Kimi for Claude Code, Codex, and DeepSeek Harness: code questions, independent reviews, bounded fixes, autonomous goals, parallel tasks, and MCP tools through the local Kimi Code CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/dsh/index.js",
|
|
@@ -137,6 +137,8 @@
|
|
|
137
137
|
"docs/upstream-2.5.0-certification.md",
|
|
138
138
|
"docs/upstream-2.5.1-certification.md",
|
|
139
139
|
"docs/upstream-2.5.2-certification.md",
|
|
140
|
+
"docs/upstream-2.5.3-certification.md",
|
|
141
|
+
"docs/upstream-2.6.0-certification.md",
|
|
140
142
|
"README.md",
|
|
141
143
|
"LICENSE",
|
|
142
144
|
"CHANGELOG.md",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kimi",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.8",
|
|
4
4
|
"description": "Kimi for Codex: code questions, independent reviews, bounded fixes, autonomous goals, parallel tasks, and MCP job controls through the local Kimi Code CLI.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "linxule"
|
|
@@ -115,8 +115,8 @@ export async function runCliPrompt(opts) {
|
|
|
115
115
|
const records = [];
|
|
116
116
|
const malformed = [];
|
|
117
117
|
// Rolling stderr tail — keep only the trailing STDERR_TAIL_BYTES so a
|
|
118
|
-
// long-running kimi process emitting megabytes of stderr (tool.
|
|
119
|
-
// thinking deltas) doesn't grow our RSS unboundedly.
|
|
118
|
+
// long-running kimi process emitting megabytes of stderr (tool.updated
|
|
119
|
+
// output/status, thinking deltas) doesn't grow our RSS unboundedly.
|
|
120
120
|
let stderrTail = "";
|
|
121
121
|
let announcedSessionId;
|
|
122
122
|
let announcedGoalSummary;
|
|
@@ -786,7 +786,7 @@ function buildArgs(opts) {
|
|
|
786
786
|
? opts.env.KIMI_PLUGIN_CC_SMOKE_V2_CANDIDATE
|
|
787
787
|
: undefined;
|
|
788
788
|
if (opts.resumeSessionId === undefined &&
|
|
789
|
-
["2.5.0", "2.5.1", "2.5.2"].includes(opts.executionPlan.kimiVersion ?? smokeCandidate ?? "")) {
|
|
789
|
+
["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0"].includes(opts.executionPlan.kimiVersion ?? smokeCandidate ?? "")) {
|
|
790
790
|
args.push("--environment", "local");
|
|
791
791
|
}
|
|
792
792
|
if (opts.resumeSessionId !== undefined) {
|
|
@@ -103,7 +103,8 @@ export async function runRecoverSwarm(argv, context) {
|
|
|
103
103
|
if (current.command !== plan.command || current.kimiVersion !== plan.kimiVersion || JSON.stringify(current.prefixArgs) !== JSON.stringify(plan.prefixArgs))
|
|
104
104
|
throw recoveryError("The exact recorded CLI is not selected. Restore that certified binary before session cleanup.");
|
|
105
105
|
signal.throwIfAborted();
|
|
106
|
-
await
|
|
106
|
+
const recoveryExecutionCwd = await realpath(record.cwd);
|
|
107
|
+
await deactivateSwarmSession({ cwd: recoveryExecutionCwd, env: context.env, command: current.command,
|
|
107
108
|
prefixArgs: current.prefixArgs, executionPlan: current, commandLabel: expectedRoot ? "swarm-write" : "swarm",
|
|
108
109
|
trustedWorkspaceRoot: expectedRoot ?? undefined, ...record.session, signal,
|
|
109
110
|
onRecoveryEvent: (event) => recordRecoveryEvent(store, record, event) });
|
|
@@ -28,7 +28,7 @@ import { normalizeTopLevelInlineHooks, validateKimiHookSetForEnvironment, withKi
|
|
|
28
28
|
import { buildHookShellCommand, hostIdFromHookCommand, resolveHookScriptPath, resolveHostId, resolveNodeBinary, } from "../hooks/install-paths.js";
|
|
29
29
|
import { decodeManagedCommandLine, effectiveHost, evaluateInstalled, findUnmanagedApprovalHookBlocks, markerCommentLines, MARKERS, ORPHAN_MARKER_REMEDY, parseManagedBlock, } from "../hooks/managed-block.js";
|
|
30
30
|
import { formatVersionOutOfRangeWarning, probeKimiVersion, } from "../kimi-version-probe.js";
|
|
31
|
-
import { isNativeV2CertifiedVersion,
|
|
31
|
+
import { isNativeV2CertifiedVersion, NATIVE_V2_ANY_OPERATION_VERSIONS, NATIVE_V2_NON_SWARM_VERSIONS, } from "../kimi-engine.js";
|
|
32
32
|
import { resolveKimiHome } from "../kimi-home.js";
|
|
33
33
|
import { ensurePluginPaths, resolvePluginPaths } from "../paths.js";
|
|
34
34
|
import { KIMI_PLUGIN_CC_VERSION } from "../version.js";
|
|
@@ -973,13 +973,13 @@ async function collectKimiVersionWarnings(env, warnings) {
|
|
|
973
973
|
// clearer message. Avoid double-noise.
|
|
974
974
|
return;
|
|
975
975
|
}
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
// KIMI_TESTED_MINORS — that table never gains 0.42). Without this, setup on a
|
|
979
|
-
// v2-certified binary would wrongly warn "not certified, commands will refuse".
|
|
980
|
-
if (probe.inTestedRange || isNativeV2CertifiedVersion(probe.version))
|
|
976
|
+
if (!probe.inTestedRange && !isNativeV2CertifiedVersion(probe.version)) {
|
|
977
|
+
warnings.push(formatVersionOutOfRangeWarning(probe, KIMI_PLUGIN_CC_VERSION, NATIVE_V2_ANY_OPERATION_VERSIONS));
|
|
981
978
|
return;
|
|
982
|
-
|
|
979
|
+
}
|
|
980
|
+
if (NATIVE_V2_NON_SWARM_VERSIONS.includes(probe.version)) {
|
|
981
|
+
warnings.push(`NOTE: kimi-code ${probe.version} is certified for review, challenge, ask, rescue, review gate, and pursue only. Read-only swarm and write swarm refuse before model spawn because upstream rate-limit recovery can exceed maxConcurrency.`);
|
|
982
|
+
}
|
|
983
983
|
}
|
|
984
984
|
/**
|
|
985
985
|
* Non-blocking notice for kimi-code's own enabled plugins from
|
|
@@ -2,7 +2,7 @@ import { resolveKimiHome } from "../kimi-home.js";
|
|
|
2
2
|
import { probeProcessIdentity } from "../process-tree.js";
|
|
3
3
|
import { recordRecoveryEvent, finishRecoveryRecord } from "../swarm-recovery.js";
|
|
4
4
|
import { allocateJobId } from "../job-id.js";
|
|
5
|
-
import { mkdir, writeFile } from "node:fs/promises";
|
|
5
|
+
import { mkdir, realpath, writeFile } from "node:fs/promises";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { createCliCancellationHandlers } from "../cli-cancellation.js";
|
|
8
8
|
import { ResponseTimeoutError, runCliPromptWithBudget } from "../cli-client.js";
|
|
@@ -23,44 +23,47 @@ import { assertCliResultSuccess, reassembleProseFromRecords, warnIfSessionIdMiss
|
|
|
23
23
|
import { buildKimiSessionTitle, syncKimiSessionTitle } from "../session-title.js";
|
|
24
24
|
// /kimi:swarm — parallel fan-out, read-only by default and runtime-foreground-only.
|
|
25
25
|
// A finite wall-clock budget bounds the whole run. --cap is a SOFT total-count
|
|
26
|
-
// prompt hint; --max-concurrency
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
//
|
|
26
|
+
// prompt hint; --max-concurrency caps normal launches on kimi-code 0.18.0+.
|
|
27
|
+
// Reviewed 2.5.3/2.6.0 schedulers can exceed that cap during rate-limit recovery.
|
|
28
|
+
// The plugin always exports the setting; older read-only swarms retain only the
|
|
29
|
+
// wall-clock hard bound. Read/write modes reuse review/rescue lineage, and the
|
|
30
|
+
// mandatory PreToolUse hook enforces read-only policy or trusted-worktree write
|
|
31
|
+
// confinement on the coordinator and every subagent. Write mode requires
|
|
32
|
+
// kimi-code 0.18.0+. Exact 2.3.2, 2.3.3, 2.4.0, 2.4.1, 2.5.0, 2.5.1, 2.5.2,
|
|
33
|
+
// and certified 2.5.3 activate a same-job session through a bounded loopback
|
|
34
|
+
// web lifecycle, then resume it through the normal print path. Candidate-only
|
|
35
|
+
// 2.6.0 activation uses that lifecycle too; production 2.6.0 is non-swarm
|
|
36
|
+
// certified and refuses both modes before model spawn. The certification table
|
|
37
|
+
// controls whether each exact version is reachable.
|
|
33
38
|
const SWARM_SUMMARY_MAX = 120;
|
|
34
39
|
const SWARM_AGENT_PROFILE = "<swarm>";
|
|
35
40
|
const SWARM_WRITE_AGENT_PROFILE = "<swarm-write>";
|
|
36
41
|
/**
|
|
37
|
-
* Default concurrency setting when the user passes no
|
|
38
|
-
* The plugin always exports
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
+
* Default normal-launch concurrency setting when the user passes no
|
|
43
|
+
* `--max-concurrency`. The plugin always exports
|
|
44
|
+
* KIMI_CODE_AGENT_SWARM_MAX_CONCURRENCY; older read-only swarms ignore it and
|
|
45
|
+
* retain only the wall-clock hard bound. Rate-limit recovery can exceed it on
|
|
46
|
+
* reviewed 2.5.3/2.6.0 sources; this is not an unconditional peak guarantee.
|
|
42
47
|
*/
|
|
43
48
|
export const SWARM_DEFAULT_MAX_CONCURRENCY = 4;
|
|
44
49
|
/**
|
|
45
|
-
* Resolve the
|
|
46
|
-
* wins; otherwise
|
|
47
|
-
* never unset. Pure + exported for unit testing (the parser leaves
|
|
48
|
-
* undefined; swarm.ts owns the default, mirroring `budgetMs`).
|
|
50
|
+
* Resolve the requested normal-launch concurrency: an explicit
|
|
51
|
+
* `--max-concurrency` wins; otherwise use SWARM_DEFAULT_MAX_CONCURRENCY so the
|
|
52
|
+
* setting is never unset. Pure + exported for unit testing (the parser leaves
|
|
53
|
+
* the value undefined; swarm.ts owns the default, mirroring `budgetMs`).
|
|
49
54
|
*/
|
|
50
55
|
export function resolveSwarmMaxConcurrency(requested) {
|
|
51
56
|
return requested ?? SWARM_DEFAULT_MAX_CONCURRENCY;
|
|
52
57
|
}
|
|
53
58
|
/**
|
|
54
|
-
* Default
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* override with an explicit `--max-concurrency N`. Effective only on kimi-code
|
|
60
|
-
* 0.18.0+ (the write-mode version gate), so the ceiling is always enforced.
|
|
59
|
+
* Default normal-launch concurrency for WRITE mode — 1 (serialized) vs read's 4.
|
|
60
|
+
* Disjoint-target partitioning is prompt-only, so normal writes serialize by
|
|
61
|
+
* default. Rate-limit recovery can still exceed the requested cap on reviewed
|
|
62
|
+
* 2.5.3/2.6.0 sources; this is not an unconditional serialization guarantee.
|
|
63
|
+
* Override with an explicit `--max-concurrency N`.
|
|
61
64
|
*/
|
|
62
65
|
export const SWARM_WRITE_DEFAULT_MAX_CONCURRENCY = 1;
|
|
63
|
-
/** Resolve the write-mode concurrency
|
|
66
|
+
/** Resolve the write-mode normal-launch concurrency: explicit wins, else default 1. */
|
|
64
67
|
export function resolveSwarmWriteMaxConcurrency(requested) {
|
|
65
68
|
return requested ?? SWARM_WRITE_DEFAULT_MAX_CONCURRENCY;
|
|
66
69
|
}
|
|
@@ -74,9 +77,10 @@ export function resolveSwarmWriteMaxConcurrency(requested) {
|
|
|
74
77
|
* Read-only is NOT enforced by this prose — the PreToolUse hook (swarm label) at
|
|
75
78
|
* policy index 0 denies every write/edit/shell for the coordinator AND every
|
|
76
79
|
* subagent, so slimming this text does not move the safety boundary. The optional
|
|
77
|
-
* `cap` is a SOFT subagent-count hint (the hook cannot enforce a count). The
|
|
78
|
-
* concurrency
|
|
80
|
+
* `cap` is a SOFT subagent-count hint (the hook cannot enforce a count). The
|
|
81
|
+
* normal-launch concurrency setting is separate: --max-concurrency →
|
|
79
82
|
* KIMI_CODE_AGENT_SWARM_MAX_CONCURRENCY (see executeSwarmJob / cli-client buildKimiCliEnvironment).
|
|
83
|
+
* Reviewed 2.5.3/2.6.0 sources can exceed it during rate-limit recovery.
|
|
80
84
|
* The --budget wall-clock ceiling is the always-on hard bound on the whole run.
|
|
81
85
|
*/
|
|
82
86
|
export function buildSwarmPrompt(objective, cap) {
|
|
@@ -209,7 +213,7 @@ async function runReadSwarm(parsed, objective, context) {
|
|
|
209
213
|
await markJobFailed(store, paths, job, classified, "Swarm failed.", { phase: "failed" });
|
|
210
214
|
throw classified;
|
|
211
215
|
}
|
|
212
|
-
const completed = await executeSwarmJob(job.job_id, prompt, objective, job.budget_ms, resolveSwarmMaxConcurrency(parsed.maxConcurrency), context);
|
|
216
|
+
const completed = await executeSwarmJob(job.job_id, prompt, objective, job.budget_ms, resolveSwarmMaxConcurrency(parsed.maxConcurrency), context, undefined, await realpath(context.cwd));
|
|
213
217
|
if (!completed.final_output_path) {
|
|
214
218
|
throw new RuntimeError("SWARM_RESULT_MISSING", "Swarm finished without a rendered result.", "swarm.result");
|
|
215
219
|
}
|
|
@@ -319,7 +323,7 @@ async function runWriteSwarm(parsed, objective, context) {
|
|
|
319
323
|
onPatchCaptureFailure: () => {
|
|
320
324
|
preserveWorktree = true;
|
|
321
325
|
},
|
|
322
|
-
});
|
|
326
|
+
}, await realpath(worktreePath));
|
|
323
327
|
if (preserveWorktree && completed.error) {
|
|
324
328
|
throw new RuntimeError(completed.error.code, completed.error.message, completed.error.stage, {
|
|
325
329
|
details: completed.error.details,
|
|
@@ -389,8 +393,11 @@ async function executeSwarmJob(jobId, prompt, objective, budgetMs, maxConcurrenc
|
|
|
389
393
|
* (`spawnCwd`), the hook label is "swarm-write", and `workspaceRoot` (the same
|
|
390
394
|
* worktree) is exported as the trusted allowlist root + used to capture the
|
|
391
395
|
* patch. Undefined ⇒ read-only swarm (label "swarm", spawn cwd = job.cwd).
|
|
396
|
+
* Real command paths supply the canonical execution cwd for activation/resume,
|
|
397
|
+
* trusted-root checks, read-mode preflight, and the print spawn. Virtual test
|
|
398
|
+
* doubles may omit the canonical path and retain their original spawn spelling.
|
|
392
399
|
*/
|
|
393
|
-
writeMode) {
|
|
400
|
+
writeMode, executionCwd) {
|
|
394
401
|
const paths = resolvePluginPaths(context.env);
|
|
395
402
|
await ensurePluginPaths(paths);
|
|
396
403
|
const store = new JobStore(paths);
|
|
@@ -465,7 +472,7 @@ writeMode) {
|
|
|
465
472
|
store.saveSwarmRecovery(job.job_id, recovery);
|
|
466
473
|
}
|
|
467
474
|
activationOptions = {
|
|
468
|
-
cwd: writeMode?.spawnCwd ?? job.cwd,
|
|
475
|
+
cwd: executionCwd ?? writeMode?.spawnCwd ?? job.cwd,
|
|
469
476
|
env: context.env,
|
|
470
477
|
command: executionPlan.command,
|
|
471
478
|
prefixArgs: executionPlan.prefixArgs,
|
|
@@ -474,7 +481,7 @@ writeMode) {
|
|
|
474
481
|
model: job.model ?? undefined,
|
|
475
482
|
thinkingEffort: job.thinking_effort ?? undefined,
|
|
476
483
|
swarmMaxConcurrency: maxConcurrency,
|
|
477
|
-
trustedWorkspaceRoot: writeMode?.workspaceRoot,
|
|
484
|
+
trustedWorkspaceRoot: executionCwd ?? writeMode?.workspaceRoot,
|
|
478
485
|
expectedVersion: executionPlan.kimiVersion ?? undefined,
|
|
479
486
|
onRecoveryEvent: recovery ? (event) => recordRecoveryEvent(store, recovery, event) : undefined,
|
|
480
487
|
};
|
|
@@ -554,7 +561,7 @@ writeMode) {
|
|
|
554
561
|
prompt,
|
|
555
562
|
commandLabel,
|
|
556
563
|
swarmMaxConcurrency: maxConcurrency,
|
|
557
|
-
trustedWorkspaceRoot: writeMode?.workspaceRoot,
|
|
564
|
+
trustedWorkspaceRoot: executionCwd ?? writeMode?.workspaceRoot,
|
|
558
565
|
model: job.model ?? undefined,
|
|
559
566
|
thinkingEffort: job.thinking_effort ?? undefined,
|
|
560
567
|
resumeSessionId: preactivated?.sessionId,
|
|
@@ -595,9 +595,10 @@ 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
|
-
// 2.4.0 (f26e4d91), 2.4.1 (2c73f3f5), 2.5.0 (41c34143), 2.5.1 (1b02030d),
|
|
599
|
-
// 2.5.2 (1c142a00):
|
|
600
|
-
// the additive events and HookDefSchema are unchanged.
|
|
598
|
+
// 2.4.0 (f26e4d91), 2.4.1 (2c73f3f5), 2.5.0 (41c34143), 2.5.1 (1b02030d),
|
|
599
|
+
// 2.5.2 (1c142a00), 2.5.3 (5af9942e), and 2.6.0 (740d6c0b):
|
|
600
|
+
// the additive events and HookDefSchema are unchanged. Exact 2.6.0 schema acceptance
|
|
601
|
+
// covers the narrowed non-swarm production certification, not swarm operations.
|
|
601
602
|
// Require the full version string AND matching components; no inferred 2.x compatibility.
|
|
602
603
|
if (version.major === 2 && ((version.minor === 0 && ((version.version === "2.0.0" && version.patch === 0) ||
|
|
603
604
|
(version.version === "2.0.1" && version.patch === 1) ||
|
|
@@ -613,7 +614,9 @@ function validateVersionSensitiveEvents(events, version) {
|
|
|
613
614
|
(version.version === "2.4.1" && version.patch === 1))) ||
|
|
614
615
|
(version.minor === 5 && ((version.version === "2.5.0" && version.patch === 0) ||
|
|
615
616
|
(version.version === "2.5.1" && version.patch === 1) ||
|
|
616
|
-
(version.version === "2.5.2" && version.patch === 2)
|
|
617
|
+
(version.version === "2.5.2" && version.patch === 2) ||
|
|
618
|
+
(version.version === "2.5.3" && version.patch === 3))) ||
|
|
619
|
+
(version.minor === 6 && ((version.version === "2.6.0" && version.patch === 0))))) {
|
|
617
620
|
return { valid: true };
|
|
618
621
|
}
|
|
619
622
|
if (version.major !== 0) {
|
|
@@ -48,15 +48,31 @@ export const NATIVE_V2_CERTIFIED_VERSIONS = Object.freeze([
|
|
|
48
48
|
"2.5.0",
|
|
49
49
|
"2.5.1",
|
|
50
50
|
"2.5.2",
|
|
51
|
+
"2.5.3",
|
|
52
|
+
]);
|
|
53
|
+
/**
|
|
54
|
+
* Exact releases certified only for review, challenge, ask, rescue, review_gate
|
|
55
|
+
* and pursue. Their upstream rate-limit recovery can exceed AgentSwarm's
|
|
56
|
+
* configured maximum, so both swarm operations refuse before model spawn.
|
|
57
|
+
*/
|
|
58
|
+
export const NATIVE_V2_NON_SWARM_VERSIONS = Object.freeze(["2.6.0"]);
|
|
59
|
+
/**
|
|
60
|
+
* Any-operation union used by setup and engine selection. The older
|
|
61
|
+
* NATIVE_V2_CERTIFIED_VERSIONS export stays all-operation-only for consumers
|
|
62
|
+
* that choose a full-swarm pin automatically.
|
|
63
|
+
*/
|
|
64
|
+
export const NATIVE_V2_ANY_OPERATION_VERSIONS = Object.freeze([
|
|
65
|
+
...NATIVE_V2_CERTIFIED_VERSIONS,
|
|
66
|
+
...NATIVE_V2_NON_SWARM_VERSIONS,
|
|
51
67
|
]);
|
|
52
68
|
/** Per-operation native-v2 certification. One green operation never certifies another. */
|
|
53
69
|
export const NATIVE_V2_CERTIFIED = new Map([
|
|
54
|
-
["review",
|
|
55
|
-
["challenge",
|
|
56
|
-
["ask",
|
|
57
|
-
["rescue",
|
|
58
|
-
["review_gate",
|
|
59
|
-
["pursue",
|
|
70
|
+
["review", NATIVE_V2_ANY_OPERATION_VERSIONS],
|
|
71
|
+
["challenge", NATIVE_V2_ANY_OPERATION_VERSIONS],
|
|
72
|
+
["ask", NATIVE_V2_ANY_OPERATION_VERSIONS],
|
|
73
|
+
["rescue", NATIVE_V2_ANY_OPERATION_VERSIONS],
|
|
74
|
+
["review_gate", NATIVE_V2_ANY_OPERATION_VERSIONS],
|
|
75
|
+
["pursue", NATIVE_V2_ANY_OPERATION_VERSIONS],
|
|
60
76
|
["swarm", NATIVE_V2_CERTIFIED_VERSIONS],
|
|
61
77
|
["swarm-write", NATIVE_V2_CERTIFIED_VERSIONS],
|
|
62
78
|
]);
|
|
@@ -76,16 +92,17 @@ export function isNativeV2CertifiedVersion(version) {
|
|
|
76
92
|
const normalized = parseVersionLine(version)?.raw;
|
|
77
93
|
if (normalized === undefined)
|
|
78
94
|
return false;
|
|
79
|
-
return
|
|
95
|
+
return NATIVE_V2_ANY_OPERATION_VERSIONS.includes(normalized);
|
|
80
96
|
}
|
|
81
97
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* ≥0.42 binary is refused by the legacy range rather than silently run on v2.
|
|
98
|
+
* Select native v2 for an exactly certified version or a test-only operation
|
|
99
|
+
* admission, then enforce scope in assertCertifiedCapability. A narrowed
|
|
100
|
+
* release must not fall back to legacy-v1 for an excluded operation.
|
|
86
101
|
*/
|
|
87
102
|
export function selectIntendedEngine(operationKind, probe) {
|
|
88
|
-
return isNativeV2Certified(operationKind, probe.version)
|
|
103
|
+
return isNativeV2CertifiedVersion(probe.version) || isNativeV2Certified(operationKind, probe.version)
|
|
104
|
+
? "native-v2"
|
|
105
|
+
: "legacy-v1";
|
|
89
106
|
}
|
|
90
107
|
const UNSAFE_EXPERIMENTAL_VALUES = new Set(["1", "true", "yes", "on"]);
|
|
91
108
|
/**
|
|
@@ -546,6 +563,23 @@ function assertExecutionPlanShape(plan) {
|
|
|
546
563
|
}
|
|
547
564
|
function nativeV2NotCertified(operationKind, version) {
|
|
548
565
|
const certified = NATIVE_V2_CERTIFIED.get(operationKind) ?? [];
|
|
566
|
+
const normalized = version === null ? undefined : parseVersionLine(version)?.raw;
|
|
567
|
+
if (normalized !== undefined &&
|
|
568
|
+
NATIVE_V2_NON_SWARM_VERSIONS.includes(normalized) &&
|
|
569
|
+
(operationKind === "swarm" || operationKind === "swarm-write")) {
|
|
570
|
+
return new RuntimeError("KIMI_CAPABILITY_NOT_CERTIFIED", `Refusing ${operationKind}: kimi-code ${normalized} is certified only for non-swarm operations (review, challenge, ask, rescue, review_gate, pursue). Its upstream rate-limit recovery can exceed AgentSwarm's configured maximum, so this plugin refuses AgentSwarm before model spawn. Use a non-swarm operation on ${normalized}, or select a version explicitly certified for ${operationKind}.`, "kimi-engine.capability", {
|
|
571
|
+
details: {
|
|
572
|
+
refusal_kind: "v2-swarm-not-certified",
|
|
573
|
+
certification_scope: "non-swarm",
|
|
574
|
+
retryable_after_setup: false,
|
|
575
|
+
operation_kind: operationKind,
|
|
576
|
+
intended_engine: "native-v2",
|
|
577
|
+
kimi_version: normalized,
|
|
578
|
+
certified_versions: [...certified],
|
|
579
|
+
certified_operations: ["review", "challenge", "ask", "rescue", "review_gate", "pursue"],
|
|
580
|
+
},
|
|
581
|
+
});
|
|
582
|
+
}
|
|
549
583
|
const observed = version === null ? "an unprobed version" : `kimi-code ${version}`;
|
|
550
584
|
return new RuntimeError("KIMI_CAPABILITY_NOT_CERTIFIED", `Refusing ${operationKind} on native v2: ${observed} is not in this operation's exactly certified set [${certified.join(", ")}]. Update kimi-plugin-cc to a release that certifies this kimi-code version, or point KIMI_PLUGIN_CC_KIMI_BIN at a certified binary. KIMI_PLUGIN_CC_SKIP_VERSION_PROBE is a test/smoke seam, not a production repair path.`, "kimi-engine.capability", {
|
|
551
585
|
details: {
|
|
@@ -65,7 +65,7 @@ const CAP_PROPERTY = {
|
|
|
65
65
|
const MAX_CONCURRENCY_PROPERTY = {
|
|
66
66
|
type: "integer",
|
|
67
67
|
minimum: 1,
|
|
68
|
-
description: "
|
|
68
|
+
description: "Requested normal-launch subagent concurrency on supported Kimi Code versions. Rate-limit recovery can exceed it on reviewed 2.5.3/2.6.0 sources. Distinct from the soft total cap.",
|
|
69
69
|
};
|
|
70
70
|
const START_RESULT_GUIDANCE = "Task-capable clients receive an MCP task. Other clients receive a job ID immediately after launch; use kimi_job_status and kimi_job_result until terminal, and kimi_job_cancel to stop. Do not present a launch handle as the finished answer.";
|
|
71
71
|
function schema(properties, required = []) {
|
|
@@ -22,7 +22,9 @@ const SESSION_ID = /^session_[0-9a-f-]{36}$/;
|
|
|
22
22
|
*
|
|
23
23
|
* A candidate is bound to THIS job by content, not only by time: the first
|
|
24
24
|
* user message in the session's main journal must carry a text item whose
|
|
25
|
-
* sha256 equals the
|
|
25
|
+
* sha256 equals the caller-supplied digest of the exact `-p` argument. Native
|
|
26
|
+
* goal print stores the unwrapped objective, so the smoke recovery control
|
|
27
|
+
* supplies that digest. Production pursue does not perform store recovery. Time and
|
|
26
28
|
* cwd alone would admit a concurrent TUI session, another host's finished job
|
|
27
29
|
* (host-local stores cannot see each other's session ids), or a `state.json`
|
|
28
30
|
* planted by repository code running under rescue. The digest is not unique
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
// stream, not on a separate channel.
|
|
24
24
|
// - thinking.delta events are silently discarded by the CLI's
|
|
25
25
|
// PromptJsonWriter (`writeThinkingDelta(): void {}`).
|
|
26
|
-
// - tool.
|
|
27
|
-
// stream-json.
|
|
26
|
+
// - tool.updated output/status events are written to stderr only, never
|
|
27
|
+
// entering stream-json.
|
|
28
28
|
// - assistant messages are only emitted when content OR tool_calls are
|
|
29
29
|
// non-empty; we still defend against the empty case for resilience.
|
|
30
30
|
export const MAX_STREAM_JSON_LINE_BYTES = 1_048_576;
|