kimi-plugin-cc 2.6.3 → 2.7.2
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 +11 -2
- package/README.md +8 -8
- package/agents/kimi-swarm-write.md +4 -4
- package/agents/kimi-swarm.md +5 -5
- package/commands/swarm.md +3 -3
- package/dist/cli-client.js +4 -3
- package/dist/commands/setup.js +2 -2
- package/dist/commands/swarm.js +4 -4
- package/dist/hooks/approval-policy.js +1 -1
- package/dist/hooks/config-safety.js +4 -3
- package/dist/kimi-engine.js +2 -1
- package/dist/kimi-timeouts.js +1 -1
- package/dist/mcp/operations.js +1 -1
- package/dist/swarm-activation.js +72 -16
- package/dist/swarm-policy.js +1 -1
- package/dist/version.js +1 -1
- package/docs/migration.md +4 -4
- package/docs/registry-releases.md +3 -1
- package/docs/safety.md +16 -16
- package/docs/swarm-recovery.md +3 -3
- package/docs/upstream-2.6.3-certification.md +15 -3
- package/docs/upstream-2.7.2-certification.md +99 -0
- package/package.json +2 -1
- package/plugins/kimi-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/kimi-codex/dist/cli-client.js +4 -3
- package/plugins/kimi-codex/dist/commands/setup.js +2 -2
- package/plugins/kimi-codex/dist/commands/swarm.js +4 -4
- package/plugins/kimi-codex/dist/hooks/approval-policy.js +1 -1
- package/plugins/kimi-codex/dist/hooks/config-safety.js +4 -3
- package/plugins/kimi-codex/dist/kimi-engine.js +2 -1
- package/plugins/kimi-codex/dist/kimi-timeouts.js +1 -1
- package/plugins/kimi-codex/dist/mcp/operations.js +1 -1
- package/plugins/kimi-codex/dist/swarm-activation.js +72 -16
- package/plugins/kimi-codex/dist/swarm-policy.js +1 -1
- package/plugins/kimi-codex/dist/version.js +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
- package/plugins/kimi-dsh/dist/cli-client.js +4 -3
- package/plugins/kimi-dsh/dist/commands/setup.js +2 -2
- package/plugins/kimi-dsh/dist/commands/swarm.js +4 -4
- package/plugins/kimi-dsh/dist/hooks/approval-policy.js +1 -1
- package/plugins/kimi-dsh/dist/hooks/config-safety.js +4 -3
- package/plugins/kimi-dsh/dist/kimi-engine.js +2 -1
- package/plugins/kimi-dsh/dist/kimi-timeouts.js +1 -1
- package/plugins/kimi-dsh/dist/mcp/operations.js +1 -1
- package/plugins/kimi-dsh/dist/swarm-activation.js +72 -16
- package/plugins/kimi-dsh/dist/swarm-policy.js +1 -1
- package/plugins/kimi-dsh/dist/version.js +1 -1
- package/plugins/kimi-dsh/package.json +1 -1
|
@@ -12,8 +12,10 @@ import { assertNativeV2Preflight } from "./native-v2-preflight.js";
|
|
|
12
12
|
import { usesBoundedSwarmPolicy } from "./swarm-policy.js";
|
|
13
13
|
import { installBoundedSwarmToolPolicy } from "./swarm-tool-policy.js";
|
|
14
14
|
import { collectDescendantIdentities, collectProcessGroupsIdentities, probeProcessIdentity, revalidateProcessIdentities, waitForProcessTreeExit, } from "./process-tree.js";
|
|
15
|
-
// These exact
|
|
16
|
-
const PREACTIVATION_VERSIONS = ["2.3.2", "2.3.3", "2.4.0", "2.4.1", "2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0", "2.6.2", "2.6.3"];
|
|
15
|
+
// These exact activation entries support candidate integration; production scope is per operation.
|
|
16
|
+
const PREACTIVATION_VERSIONS = ["2.3.2", "2.3.3", "2.4.0", "2.4.1", "2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0", "2.6.2", "2.6.3", "2.7.2"];
|
|
17
|
+
const JSON_READY_VERSION = "2.7.2";
|
|
18
|
+
const KIMI_AGENT_PROTOCOL_VERSION = "1.0.0";
|
|
17
19
|
const READY_TIMEOUT_MS = 10_000;
|
|
18
20
|
const REST_TIMEOUT_MS = 5_000;
|
|
19
21
|
// Exact 2.4.0 can take longer than 5s to drain session/workspace lifecycle work.
|
|
@@ -42,7 +44,7 @@ export async function preactivateSwarmSession(options) {
|
|
|
42
44
|
try {
|
|
43
45
|
const prepared = await prepareWebSpawn(options, failureCode);
|
|
44
46
|
throwIfAborted(options.signal, failureCode, "swarm-activation.pre-spawn");
|
|
45
|
-
web = await startWebChild(options, prepared.env, failureCode);
|
|
47
|
+
web = await startWebChild(options, prepared.env, prepared.expectedVersion, failureCode);
|
|
46
48
|
await verifyMeta(web, prepared.expectedVersion, options.signal, failureCode);
|
|
47
49
|
const model = await resolveProfileModel(web, options, failureCode);
|
|
48
50
|
identity = await createSession(web, options, prepared.expectedVersion, failureCode);
|
|
@@ -94,7 +96,7 @@ export async function deactivateSwarmSession(options) {
|
|
|
94
96
|
// the print spawn owns resume plan-taint refusal.
|
|
95
97
|
const prepared = await prepareWebSpawn(options, failureCode);
|
|
96
98
|
throwIfAborted(options.signal, failureCode, "swarm-deactivation.pre-spawn");
|
|
97
|
-
web = await startWebChild(options, prepared.env, failureCode);
|
|
99
|
+
web = await startWebChild(options, prepared.env, prepared.expectedVersion, failureCode);
|
|
98
100
|
await verifyMeta(web, prepared.expectedVersion, options.signal, failureCode);
|
|
99
101
|
await verifyLocalEnvironment(web, options, options.cwd, prepared.expectedVersion, options.signal, failureCode);
|
|
100
102
|
await postSwarmProfile(web, options, false, undefined, options.signal, failureCode);
|
|
@@ -146,11 +148,11 @@ async function prepareWebSpawn(options, failureCode) {
|
|
|
146
148
|
kimiHome,
|
|
147
149
|
};
|
|
148
150
|
}
|
|
149
|
-
async function startWebChild(options, env, failureCode) {
|
|
151
|
+
async function startWebChild(options, env, expectedVersion, failureCode) {
|
|
150
152
|
const args = [
|
|
151
153
|
...(options.prefixArgs ?? []),
|
|
152
154
|
"web",
|
|
153
|
-
"--no-open",
|
|
155
|
+
expectedVersion === JSON_READY_VERSION ? "--json" : "--no-open",
|
|
154
156
|
"--host",
|
|
155
157
|
"127.0.0.1",
|
|
156
158
|
"--port",
|
|
@@ -214,7 +216,7 @@ async function startWebChild(options, env, failureCode) {
|
|
|
214
216
|
};
|
|
215
217
|
startDescendantTracking(owned);
|
|
216
218
|
try {
|
|
217
|
-
const ready = await waitForReadyLine(owned, options.signal, failureCode);
|
|
219
|
+
const ready = await waitForReadyLine(owned, expectedVersion, options.signal, failureCode);
|
|
218
220
|
await refreshOwnedDescendants(owned);
|
|
219
221
|
if (owned.recoveryFailed)
|
|
220
222
|
throw failure(failureCode, "swarm-activation.recovery", "Cannot persist web ownership; refusing session mutation.");
|
|
@@ -228,7 +230,7 @@ async function startWebChild(options, env, failureCode) {
|
|
|
228
230
|
throw primary;
|
|
229
231
|
}
|
|
230
232
|
}
|
|
231
|
-
async function waitForReadyLine(owned, signal, failureCode) {
|
|
233
|
+
async function waitForReadyLine(owned, expectedVersion, signal, failureCode) {
|
|
232
234
|
throwIfAborted(signal, failureCode, "swarm-activation.ready");
|
|
233
235
|
return await new Promise((resolve, reject) => {
|
|
234
236
|
let buffered = "";
|
|
@@ -272,6 +274,17 @@ async function waitForReadyLine(owned, signal, failureCode) {
|
|
|
272
274
|
const newline = buffered.indexOf("\n");
|
|
273
275
|
const line = buffered.slice(0, newline).replace(/\r$/, "");
|
|
274
276
|
buffered = buffered.slice(newline + 1);
|
|
277
|
+
if (expectedVersion === JSON_READY_VERSION) {
|
|
278
|
+
if (line.trim().length === 0)
|
|
279
|
+
continue;
|
|
280
|
+
try {
|
|
281
|
+
settle(parseJsonReadyLine(line));
|
|
282
|
+
}
|
|
283
|
+
catch {
|
|
284
|
+
settle(failure(failureCode, "swarm-activation.ready", "The Kimi web JSON ready line did not confirm the authenticated KAP loopback contract."));
|
|
285
|
+
}
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
275
288
|
if (!line.startsWith("Kimi server: "))
|
|
276
289
|
continue;
|
|
277
290
|
try {
|
|
@@ -311,12 +324,55 @@ function parseReadyLine(line) {
|
|
|
311
324
|
token: parsed.hash.slice("#token=".length),
|
|
312
325
|
};
|
|
313
326
|
}
|
|
327
|
+
function parseJsonReadyLine(line) {
|
|
328
|
+
const data = JSON.parse(line);
|
|
329
|
+
if (!isRecord(data) ||
|
|
330
|
+
typeof data.origin !== "string" ||
|
|
331
|
+
typeof data.ws_url !== "string" ||
|
|
332
|
+
typeof data.token !== "string" ||
|
|
333
|
+
data.token.trim().length === 0 ||
|
|
334
|
+
data.kimi_agent_protocol_version !== KIMI_AGENT_PROTOCOL_VERSION) {
|
|
335
|
+
throw new Error("invalid JSON ready payload");
|
|
336
|
+
}
|
|
337
|
+
const origin = new URL(data.origin);
|
|
338
|
+
if (origin.protocol !== "http:" ||
|
|
339
|
+
origin.hostname !== "127.0.0.1" ||
|
|
340
|
+
origin.port.length === 0 ||
|
|
341
|
+
origin.pathname !== "/" ||
|
|
342
|
+
origin.search.length > 0 ||
|
|
343
|
+
origin.hash.length > 0 ||
|
|
344
|
+
origin.username.length > 0 ||
|
|
345
|
+
origin.password.length > 0 ||
|
|
346
|
+
(data.origin !== origin.origin && data.origin !== `${origin.origin}/`)) {
|
|
347
|
+
throw new Error("invalid JSON ready origin");
|
|
348
|
+
}
|
|
349
|
+
const websocket = new URL(data.ws_url);
|
|
350
|
+
if (websocket.protocol !== "ws:" ||
|
|
351
|
+
websocket.host !== origin.host ||
|
|
352
|
+
websocket.pathname !== "/api/v1/ws" ||
|
|
353
|
+
websocket.search.length > 0 ||
|
|
354
|
+
websocket.hash.length > 0 ||
|
|
355
|
+
websocket.username.length > 0 ||
|
|
356
|
+
websocket.password.length > 0 ||
|
|
357
|
+
data.ws_url !== websocket.href) {
|
|
358
|
+
throw new Error("invalid JSON ready WebSocket URL");
|
|
359
|
+
}
|
|
360
|
+
return { origin: origin.origin, token: data.token };
|
|
361
|
+
}
|
|
314
362
|
async function verifyMeta(web, expectedVersion, signal, failureCode) {
|
|
315
363
|
const data = await restData(web, "GET", "/api/v1/meta", undefined, signal, failureCode);
|
|
316
364
|
if (!isRecord(data)) {
|
|
317
365
|
throw failure(failureCode, "swarm-activation.meta", "Kimi web /meta returned an invalid payload.");
|
|
318
366
|
}
|
|
319
|
-
if (
|
|
367
|
+
if (expectedVersion === JSON_READY_VERSION) {
|
|
368
|
+
if (data.kimi_agent_protocol_version !== KIMI_AGENT_PROTOCOL_VERSION ||
|
|
369
|
+
!isRecord(data.capabilities) ||
|
|
370
|
+
data.capabilities.websocket !== true ||
|
|
371
|
+
"backend" in data) {
|
|
372
|
+
throw failure(failureCode, "swarm-activation.meta", "Kimi web /meta did not confirm the KAP 1.0.0 WebSocket contract without a legacy backend.");
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
else if (data.backend !== "v2") {
|
|
320
376
|
throw failure(failureCode, "swarm-activation.meta", "Kimi web /meta did not confirm the v2 backend.");
|
|
321
377
|
}
|
|
322
378
|
if (data.dangerous_bypass_auth !== false) {
|
|
@@ -343,7 +399,7 @@ async function resolveProfileModel(web, options, failureCode) {
|
|
|
343
399
|
}
|
|
344
400
|
async function createSession(web, options, expectedVersion, failureCode) {
|
|
345
401
|
const request = { metadata: { cwd: options.cwd } };
|
|
346
|
-
if (["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0", "2.6.2", "2.6.3"].includes(expectedVersion)) {
|
|
402
|
+
if (["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0", "2.6.2", "2.6.3", "2.7.2"].includes(expectedVersion)) {
|
|
347
403
|
request.environment_id = "local";
|
|
348
404
|
request.environment_cwd = options.cwd;
|
|
349
405
|
}
|
|
@@ -354,7 +410,7 @@ async function createSession(web, options, expectedVersion, failureCode) {
|
|
|
354
410
|
return { sessionId: data.id, workspaceId: data.workspace_id };
|
|
355
411
|
}
|
|
356
412
|
async function verifyLocalEnvironment(web, identity, expectedCwd, expectedVersion, signal, failureCode) {
|
|
357
|
-
if (!["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0", "2.6.2", "2.6.3"].includes(expectedVersion))
|
|
413
|
+
if (!["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0", "2.6.2", "2.6.3", "2.7.2"].includes(expectedVersion))
|
|
358
414
|
return;
|
|
359
415
|
const data = await restData(web, "GET", `/api/v1/sessions/${encodeURIComponent(identity.sessionId)}/environment`, undefined, signal, failureCode);
|
|
360
416
|
if (!isRecord(data)) {
|
|
@@ -374,10 +430,10 @@ async function postSwarmProfile(web, identity, active, model, signal, failureCod
|
|
|
374
430
|
await restData(web, "POST", `/api/v1/sessions/${encodeURIComponent(identity.sessionId)}/profile`, { agent_config: agentConfig }, signal, failureCode);
|
|
375
431
|
}
|
|
376
432
|
async function verifySwarmStatus(web, identity, active, model, expectedVersion, signal, failureCode) {
|
|
377
|
-
const data = ["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0", "2.6.2", "2.6.3"].includes(expectedVersion)
|
|
433
|
+
const data = ["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0", "2.6.2", "2.6.3", "2.7.2"].includes(expectedVersion)
|
|
378
434
|
? await readWebSocketAgentState(web, identity.sessionId, expectedVersion, signal, failureCode)
|
|
379
435
|
: await restData(web, "GET", `/api/v1/sessions/${encodeURIComponent(identity.sessionId)}/status`, undefined, signal, failureCode);
|
|
380
|
-
const source = ["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0", "2.6.2", "2.6.3"].includes(expectedVersion) ? "agent state" : "/status";
|
|
436
|
+
const source = ["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0", "2.6.2", "2.6.3", "2.7.2"].includes(expectedVersion) ? "agent state" : "/status";
|
|
381
437
|
if (!isRecord(data)) {
|
|
382
438
|
throw failure(failureCode, "swarm-activation.status", `Kimi web ${source} returned an invalid payload.`);
|
|
383
439
|
}
|
|
@@ -387,10 +443,10 @@ async function verifySwarmStatus(web, identity, active, model, expectedVersion,
|
|
|
387
443
|
if (data.plan_mode !== false) {
|
|
388
444
|
throw failure(failureCode, "swarm-activation.status", `Kimi web ${source} did not confirm plan mode is off.`);
|
|
389
445
|
}
|
|
390
|
-
if (["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0", "2.6.2", "2.6.3"].includes(expectedVersion) && data.tower_mode !== false) {
|
|
446
|
+
if (["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0", "2.6.2", "2.6.3", "2.7.2"].includes(expectedVersion) && data.tower_mode !== false) {
|
|
391
447
|
throw failure(failureCode, "swarm-activation.status", "Kimi web agent state did not confirm tower mode is off.");
|
|
392
448
|
}
|
|
393
|
-
const permission = ["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0", "2.6.2", "2.6.3"].includes(expectedVersion) ? data.permission_mode : data.permission;
|
|
449
|
+
const permission = ["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0", "2.6.2", "2.6.3", "2.7.2"].includes(expectedVersion) ? data.permission_mode : data.permission;
|
|
394
450
|
if (permission !== "auto") {
|
|
395
451
|
throw failure(failureCode, "swarm-activation.status", `Kimi web ${source} did not confirm auto permission mode.`);
|
|
396
452
|
}
|
|
@@ -406,7 +462,7 @@ async function readWebSocketAgentState(web, sessionId, expectedVersion, signal,
|
|
|
406
462
|
return await new Promise((resolve, reject) => {
|
|
407
463
|
let socket;
|
|
408
464
|
const bearerProtocol = `kimi-code.bearer.${web.token}`;
|
|
409
|
-
const legacyControl = !["2.6.0", "2.6.2", "2.6.3"].includes(expectedVersion);
|
|
465
|
+
const legacyControl = !["2.6.0", "2.6.2", "2.6.3", "2.7.2"].includes(expectedVersion);
|
|
410
466
|
const helloId = `swarm-activation-hello-${randomUUID()}`;
|
|
411
467
|
const subscribeId = `swarm-activation-subscribe-${randomUUID()}`;
|
|
412
468
|
try {
|
|
@@ -7,7 +7,7 @@ export const BOUNDED_SWARM_POLICY = "bounded-waves/1";
|
|
|
7
7
|
export const SWARM_CHILD_TIMEOUT_MS = 2_147_483_647;
|
|
8
8
|
export function usesBoundedSwarmPolicy(plan) {
|
|
9
9
|
return plan.intendedEngine === "native-v2" &&
|
|
10
|
-
(plan.kimiVersion === "2.6.2" || plan.kimiVersion === "2.6.3") &&
|
|
10
|
+
(plan.kimiVersion === "2.6.2" || plan.kimiVersion === "2.6.3" || plan.kimiVersion === "2.7.2") &&
|
|
11
11
|
(plan.operationKind === "swarm" || plan.operationKind === "swarm-write");
|
|
12
12
|
}
|
|
13
13
|
function plainObject(value) {
|
|
@@ -29,7 +29,7 @@ Pass through: `[--budget <30m|1h>] [--cap <N>] [--max-concurrency <N>] [-m <mode
|
|
|
29
29
|
- For subscription auth, guide native Kimi `/login`; for API keys or other providers, guide native `/provider` and have the user enter secrets there. Only an explicit saved-default request calls for native `/model`. Re-list after setup; use `setup --check` for hook readiness. Swarm `-m` selects the coordinator; `[secondary_model]` can select different child models.
|
|
30
30
|
- Require many independent review targets plus explicit fan-out intent.
|
|
31
31
|
- Pass finite budget and concurrency bounds; default to foreground unless the user explicitly asks to detach.
|
|
32
|
-
- On exact Kimi Code 2.6.2/2.6.3, concurrency 1 runs one direct worker; larger values use bounded sequential waves. Older certified versions retain their normal-launch limit and recovery limitation.
|
|
32
|
+
- On exact Kimi Code 2.6.2/2.6.3/2.7.2, concurrency 1 runs one direct worker; larger values use bounded sequential waves. Older certified versions retain their normal-launch limit and recovery limitation.
|
|
33
33
|
- The bound counts simultaneous Kimi child-agent turns, not OS subprocesses. Fresh-only waves need at least two entries; group odd target counts into disjoint worker assignments.
|
|
34
34
|
- If the companion reports SWARM_HOOK_NOT_INSTALLED, tell the user to run Claude Code /kimi:setup or Codex $kimi-setup, then retry.
|
|
35
35
|
- Return the consolidated companion report verbatim.
|
|
@@ -29,7 +29,7 @@ Pass through: `[--budget <30m|1h>] [--cap <N>] [--max-concurrency <N>] [-m <mode
|
|
|
29
29
|
- For subscription auth, guide native Kimi `/login`; for API keys or other providers, guide native `/provider` and have the user enter secrets there. Only an explicit saved-default request calls for native `/model`. Re-list after setup; use `setup --check` for hook readiness. Swarm `-m` selects the coordinator; `[secondary_model]` can select different child models.
|
|
30
30
|
- Require both many disjoint write targets and explicit parallel fan-out intent.
|
|
31
31
|
- Keep `--max-concurrency` conservative, normally 1, unless the user explicitly asks to widen it.
|
|
32
|
-
- On exact Kimi Code 2.6.2/2.6.3, the default concurrency 1 runs a single worker in the throwaway worktree. Explicit concurrency 2 or higher uses bounded waves; every mode returns a patch for review.
|
|
32
|
+
- On exact Kimi Code 2.6.2/2.6.3/2.7.2, the default concurrency 1 runs a single worker in the throwaway worktree. Explicit concurrency 2 or higher uses bounded waves; every mode returns a patch for review.
|
|
33
33
|
- Parallel Kimi workers cannot background shell commands; native foreground Bash has a 60-second default and 300-second maximum timeout. Choose concurrency 1 for longer tests. Owned process cleanup must finish before patch capture; failed verification retains the worktree instead.
|
|
34
34
|
- The runtime rejects `--background`, but detaching your own shell call is expected: a fan-out routinely outlives a foreground timeout, and the run is patch-only and worktree-confined. Keep `--budget` and `--max-concurrency` finite. To stop a run, use `companion.sh cancel` with NO id — it targets the latest running job for the repo, and no UUID crosses you or the user (a detached run prints nothing at launch; the id first arrives with the final report). Prefer that over an interrupt: an interrupt gives the companion only ~1.35s before SIGKILL, less than its teardown plus `git diff --binary` patch capture, so interrupting can lose the patch.
|
|
35
35
|
- If the companion reports SWARM_HOOK_NOT_INSTALLED, tell the user to run Claude Code /kimi:setup or Codex $kimi-setup, then retry.
|
|
@@ -966,7 +966,7 @@ function buildArgs(opts) {
|
|
|
966
966
|
? opts.env.KIMI_PLUGIN_CC_SMOKE_V2_CANDIDATE
|
|
967
967
|
: undefined;
|
|
968
968
|
if (opts.resumeSessionId === undefined &&
|
|
969
|
-
["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0", "2.6.2", "2.6.3"].includes(opts.executionPlan.kimiVersion ?? smokeCandidate ?? "")) {
|
|
969
|
+
["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0", "2.6.2", "2.6.3", "2.7.2"].includes(opts.executionPlan.kimiVersion ?? smokeCandidate ?? "")) {
|
|
970
970
|
args.push("--environment", "local");
|
|
971
971
|
}
|
|
972
972
|
if (opts.resumeSessionId !== undefined) {
|
|
@@ -1012,8 +1012,9 @@ export function buildKimiCliEnvironment(opts) {
|
|
|
1012
1012
|
if (opts.executionPlan.intendedEngine === "legacy-v1") {
|
|
1013
1013
|
env[KIMI_LEGACY_ENV] = KIMI_LEGACY_FORCED_VALUE;
|
|
1014
1014
|
}
|
|
1015
|
-
//
|
|
1016
|
-
//
|
|
1015
|
+
// Suppress passive update checks on the `-p` path. Manually staged native
|
|
1016
|
+
// swaps remain an upstream exception, so the exact probe and first-line
|
|
1017
|
+
// version marker must still prove the spawned artifact's identity.
|
|
1017
1018
|
env.KIMI_CODE_NO_AUTO_UPDATE = "1";
|
|
1018
1019
|
// Plugin-owned web lifecycles must not inherit ambient idle-session reclamation.
|
|
1019
1020
|
env.KIMI_CODE_SESSION_IDLE_RECLAIM_MS = "0";
|
|
@@ -977,12 +977,12 @@ async function collectKimiVersionWarnings(env, warnings) {
|
|
|
977
977
|
warnings.push(formatVersionOutOfRangeWarning(probe, KIMI_PLUGIN_CC_VERSION, NATIVE_V2_ANY_OPERATION_VERSIONS));
|
|
978
978
|
return;
|
|
979
979
|
}
|
|
980
|
-
if (probe.version === "2.6.2" || probe.version === "2.6.3") {
|
|
980
|
+
if (probe.version === "2.6.2" || probe.version === "2.6.3" || probe.version === "2.7.2") {
|
|
981
981
|
warnings.push(`NOTE: kimi-code ${probe.version} is certified for all operations. Swarm uses bounded waves with concurrency 2 or more, and one direct worker at concurrency 1. The finite job budget stops the whole run.`);
|
|
982
982
|
return;
|
|
983
983
|
}
|
|
984
984
|
if (NATIVE_V2_NON_SWARM_VERSIONS.includes(probe.version)) {
|
|
985
|
-
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 on this exact release. Select exact kimi-code 2.6.2
|
|
985
|
+
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 on this exact release. Select exact kimi-code 2.6.2, 2.6.3 or 2.7.2 for this plugin's certified bounded waves and single-worker path.`);
|
|
986
986
|
}
|
|
987
987
|
}
|
|
988
988
|
/**
|
|
@@ -24,7 +24,7 @@ import { buildKimiSessionTitle, syncKimiSessionTitle } from "../session-title.js
|
|
|
24
24
|
import { usesBoundedSwarmPolicy } from "../swarm-policy.js";
|
|
25
25
|
// /kimi:swarm — parallel fan-out, read-only by default and runtime-foreground-only.
|
|
26
26
|
// A finite wall-clock budget bounds the whole run. --cap is a SOFT total-count
|
|
27
|
-
// prompt hint. Exact native-v2 2.6.2/2.6.3 bounds admitted waves and prevents native
|
|
27
|
+
// prompt hint. Exact native-v2 2.6.2/2.6.3/2.7.2 bounds admitted waves and prevents native
|
|
28
28
|
// child timeouts from returning a continuing coordinator before children stop.
|
|
29
29
|
// Concurrency 1 uses a direct worker without native fan-out. Older versions keep
|
|
30
30
|
// their normal-launch setting and inherited recovery limitation. Read/write
|
|
@@ -34,14 +34,14 @@ import { usesBoundedSwarmPolicy } from "../swarm-policy.js";
|
|
|
34
34
|
// 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,
|
|
35
35
|
// and certified 2.5.3 activate a same-job session through a bounded loopback
|
|
36
36
|
// web lifecycle, then resume it through the normal print path. 2.6.2/2.6.3 parallel
|
|
37
|
-
// waves and candidate-only 2.6.0 use that lifecycle too. The per-operation certification
|
|
37
|
+
// waves, 2.7.2 JSON-authenticated waves, and candidate-only 2.6.0 use that lifecycle too. The per-operation certification
|
|
38
38
|
// table controls whether each exact version is reachable in production.
|
|
39
39
|
const SWARM_SUMMARY_MAX = 120;
|
|
40
40
|
const SWARM_AGENT_PROFILE = "<swarm>";
|
|
41
41
|
const SWARM_WRITE_AGENT_PROFILE = "<swarm-write>";
|
|
42
42
|
/**
|
|
43
43
|
* Default concurrency setting when the user passes no `--max-concurrency`.
|
|
44
|
-
* Exact native-v2 2.6.2/2.6.3 also enforces this as the admitted wave size. The plugin exports
|
|
44
|
+
* Exact native-v2 2.6.2/2.6.3/2.7.2 also enforces this as the admitted wave size. The plugin exports
|
|
45
45
|
* KIMI_CODE_AGENT_SWARM_MAX_CONCURRENCY; older read-only swarms ignore it and
|
|
46
46
|
* retain only the wall-clock hard bound. Rate-limit recovery can exceed it on
|
|
47
47
|
* older reviewed sources; their setting is not an unconditional peak guarantee.
|
|
@@ -57,7 +57,7 @@ export function resolveSwarmMaxConcurrency(requested) {
|
|
|
57
57
|
return requested ?? SWARM_DEFAULT_MAX_CONCURRENCY;
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
60
|
-
* Default concurrency for WRITE mode — 1 vs read's 4. Exact native-v2 2.6.2/2.6.3
|
|
60
|
+
* Default concurrency for WRITE mode — 1 vs read's 4. Exact native-v2 2.6.2/2.6.3/2.7.2
|
|
61
61
|
* runs one direct worker; older versions serialize normal child launches but
|
|
62
62
|
* retain the rate-limit recovery overrun. Disjoint-target partitioning remains
|
|
63
63
|
* prompt-only when parallel workers are explicitly requested.
|
|
@@ -146,7 +146,7 @@ export function decideHookOutcomePure(input, ctx) {
|
|
|
146
146
|
// AgentSwarm are allowed and the singular Agent stays denied. This adds
|
|
147
147
|
// no direct tool-write permission within the repository/Git trust
|
|
148
148
|
// boundary: read-only Git context commands still trust repository Git
|
|
149
|
-
// configuration and can execute configured helpers. Exact 2.6.2/2.6.3 waves
|
|
149
|
+
// configuration and can execute configured helpers. Exact 2.6.2/2.6.3/2.7.2 waves
|
|
150
150
|
// pass the admission guard above; fresh children cannot activate swarm
|
|
151
151
|
// mode. Older paths retain their inherited scheduler limitations.
|
|
152
152
|
if (READ_ONLY_TOOLS.has(toolName) || toolName === AGENT_SWARM_TOOL) {
|
|
@@ -597,8 +597,8 @@ function validateVersionSensitiveEvents(events, version) {
|
|
|
597
597
|
// 2.3.0 (b5e28fd6), 2.3.1 (684bae9e), 2.3.2 (b8dd3a13), 2.3.3 (ec495f0c),
|
|
598
598
|
// 2.4.0 (f26e4d91), 2.4.1 (2c73f3f5), 2.5.0 (41c34143), 2.5.1 (1b02030d),
|
|
599
599
|
// 2.5.2 (1c142a00), 2.5.3 (5af9942e), 2.6.0 (740d6c0b), 2.6.2
|
|
600
|
-
// (6a8493df),
|
|
601
|
-
//
|
|
600
|
+
// (6a8493df), 2.6.3 (b0de2fbd), and 2.7.2 (56145f84): the additive events
|
|
601
|
+
// and HookDefSchema are unchanged. Schema acceptance does not certify operations.
|
|
602
602
|
// Require the full version string AND matching components; no inferred 2.x compatibility.
|
|
603
603
|
if (version.major === 2 && ((version.minor === 0 && ((version.version === "2.0.0" && version.patch === 0) ||
|
|
604
604
|
(version.version === "2.0.1" && version.patch === 1) ||
|
|
@@ -618,7 +618,8 @@ function validateVersionSensitiveEvents(events, version) {
|
|
|
618
618
|
(version.version === "2.5.3" && version.patch === 3))) ||
|
|
619
619
|
(version.minor === 6 && ((version.version === "2.6.0" && version.patch === 0) ||
|
|
620
620
|
(version.version === "2.6.2" && version.patch === 2) ||
|
|
621
|
-
(version.version === "2.6.3" && version.patch === 3)))
|
|
621
|
+
(version.version === "2.6.3" && version.patch === 3))) ||
|
|
622
|
+
(version.minor === 7 && version.version === "2.7.2" && version.patch === 2))) {
|
|
622
623
|
return { valid: true };
|
|
623
624
|
}
|
|
624
625
|
if (version.major !== 0) {
|
|
@@ -51,6 +51,7 @@ export const NATIVE_V2_CERTIFIED_VERSIONS = Object.freeze([
|
|
|
51
51
|
"2.5.3",
|
|
52
52
|
"2.6.2",
|
|
53
53
|
"2.6.3",
|
|
54
|
+
"2.7.2",
|
|
54
55
|
]);
|
|
55
56
|
/**
|
|
56
57
|
* Exact releases certified only for review, challenge, ask, rescue, review_gate
|
|
@@ -570,7 +571,7 @@ function nativeV2NotCertified(operationKind, version) {
|
|
|
570
571
|
if (normalized !== undefined &&
|
|
571
572
|
NATIVE_V2_NON_SWARM_VERSIONS.includes(normalized) &&
|
|
572
573
|
(operationKind === "swarm" || operationKind === "swarm-write")) {
|
|
573
|
-
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 native rate-limit recovery can exceed AgentSwarm's configured maximum, so this exact release refuses swarm before model spawn. Select exact kimi-code 2.6.2
|
|
574
|
+
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 native rate-limit recovery can exceed AgentSwarm's configured maximum, so this exact release refuses swarm before model spawn. Select exact kimi-code 2.6.2, 2.6.3 or 2.7.2 for this plugin's certified bounded waves and single-worker path, or use a non-swarm operation on ${normalized}.`, "kimi-engine.capability", {
|
|
574
575
|
details: {
|
|
575
576
|
refusal_kind: "v2-swarm-not-certified",
|
|
576
577
|
certification_scope: "non-swarm",
|
|
@@ -23,7 +23,7 @@ export const KIMI_PURSUE_DEFAULT_BUDGET_MS = 2_700_000; // 45 minutes
|
|
|
23
23
|
* Swarm (read-only parallel fan-out) DEFAULT wall-clock ceiling when the user
|
|
24
24
|
* passes no `--budget`. Read-only swarm opens no write surface, so the only new
|
|
25
25
|
* risk is cost/runaway from repeated model work. This AbortController bounds
|
|
26
|
-
* the whole job; `--cap` remains a soft lifetime-count hint. Exact 2.6.2/2.6.3 also
|
|
26
|
+
* the whole job; `--cap` remains a soft lifetime-count hint. Exact 2.6.2/2.6.3/2.7.2 also
|
|
27
27
|
* bounds wave cardinality and prevents child timeouts from overlapping waves;
|
|
28
28
|
* a requested concurrency of one runs a direct worker. Sized like the single-turn
|
|
29
29
|
* review budget — a swarm fans review work out in parallel within one process,
|
|
@@ -65,7 +65,7 @@ const CAP_PROPERTY = {
|
|
|
65
65
|
const MAX_CONCURRENCY_PROPERTY = {
|
|
66
66
|
type: "integer",
|
|
67
67
|
minimum: 1,
|
|
68
|
-
description: "Concurrent worker limit on exact Kimi Code 2.6.2/2.6.3: one runs directly; larger values bound each native swarm wave. Older certified versions limit normal launches only and recovery can exceed it. Distinct from the soft total cap.",
|
|
68
|
+
description: "Concurrent worker limit on exact Kimi Code 2.6.2/2.6.3/2.7.2: one runs directly; larger values bound each native swarm wave. Older certified versions limit normal launches only and recovery can exceed it. 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 = []) {
|
|
@@ -12,8 +12,10 @@ import { assertNativeV2Preflight } from "./native-v2-preflight.js";
|
|
|
12
12
|
import { usesBoundedSwarmPolicy } from "./swarm-policy.js";
|
|
13
13
|
import { installBoundedSwarmToolPolicy } from "./swarm-tool-policy.js";
|
|
14
14
|
import { collectDescendantIdentities, collectProcessGroupsIdentities, probeProcessIdentity, revalidateProcessIdentities, waitForProcessTreeExit, } from "./process-tree.js";
|
|
15
|
-
// These exact
|
|
16
|
-
const PREACTIVATION_VERSIONS = ["2.3.2", "2.3.3", "2.4.0", "2.4.1", "2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0", "2.6.2", "2.6.3"];
|
|
15
|
+
// These exact activation entries support candidate integration; production scope is per operation.
|
|
16
|
+
const PREACTIVATION_VERSIONS = ["2.3.2", "2.3.3", "2.4.0", "2.4.1", "2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0", "2.6.2", "2.6.3", "2.7.2"];
|
|
17
|
+
const JSON_READY_VERSION = "2.7.2";
|
|
18
|
+
const KIMI_AGENT_PROTOCOL_VERSION = "1.0.0";
|
|
17
19
|
const READY_TIMEOUT_MS = 10_000;
|
|
18
20
|
const REST_TIMEOUT_MS = 5_000;
|
|
19
21
|
// Exact 2.4.0 can take longer than 5s to drain session/workspace lifecycle work.
|
|
@@ -42,7 +44,7 @@ export async function preactivateSwarmSession(options) {
|
|
|
42
44
|
try {
|
|
43
45
|
const prepared = await prepareWebSpawn(options, failureCode);
|
|
44
46
|
throwIfAborted(options.signal, failureCode, "swarm-activation.pre-spawn");
|
|
45
|
-
web = await startWebChild(options, prepared.env, failureCode);
|
|
47
|
+
web = await startWebChild(options, prepared.env, prepared.expectedVersion, failureCode);
|
|
46
48
|
await verifyMeta(web, prepared.expectedVersion, options.signal, failureCode);
|
|
47
49
|
const model = await resolveProfileModel(web, options, failureCode);
|
|
48
50
|
identity = await createSession(web, options, prepared.expectedVersion, failureCode);
|
|
@@ -94,7 +96,7 @@ export async function deactivateSwarmSession(options) {
|
|
|
94
96
|
// the print spawn owns resume plan-taint refusal.
|
|
95
97
|
const prepared = await prepareWebSpawn(options, failureCode);
|
|
96
98
|
throwIfAborted(options.signal, failureCode, "swarm-deactivation.pre-spawn");
|
|
97
|
-
web = await startWebChild(options, prepared.env, failureCode);
|
|
99
|
+
web = await startWebChild(options, prepared.env, prepared.expectedVersion, failureCode);
|
|
98
100
|
await verifyMeta(web, prepared.expectedVersion, options.signal, failureCode);
|
|
99
101
|
await verifyLocalEnvironment(web, options, options.cwd, prepared.expectedVersion, options.signal, failureCode);
|
|
100
102
|
await postSwarmProfile(web, options, false, undefined, options.signal, failureCode);
|
|
@@ -146,11 +148,11 @@ async function prepareWebSpawn(options, failureCode) {
|
|
|
146
148
|
kimiHome,
|
|
147
149
|
};
|
|
148
150
|
}
|
|
149
|
-
async function startWebChild(options, env, failureCode) {
|
|
151
|
+
async function startWebChild(options, env, expectedVersion, failureCode) {
|
|
150
152
|
const args = [
|
|
151
153
|
...(options.prefixArgs ?? []),
|
|
152
154
|
"web",
|
|
153
|
-
"--no-open",
|
|
155
|
+
expectedVersion === JSON_READY_VERSION ? "--json" : "--no-open",
|
|
154
156
|
"--host",
|
|
155
157
|
"127.0.0.1",
|
|
156
158
|
"--port",
|
|
@@ -214,7 +216,7 @@ async function startWebChild(options, env, failureCode) {
|
|
|
214
216
|
};
|
|
215
217
|
startDescendantTracking(owned);
|
|
216
218
|
try {
|
|
217
|
-
const ready = await waitForReadyLine(owned, options.signal, failureCode);
|
|
219
|
+
const ready = await waitForReadyLine(owned, expectedVersion, options.signal, failureCode);
|
|
218
220
|
await refreshOwnedDescendants(owned);
|
|
219
221
|
if (owned.recoveryFailed)
|
|
220
222
|
throw failure(failureCode, "swarm-activation.recovery", "Cannot persist web ownership; refusing session mutation.");
|
|
@@ -228,7 +230,7 @@ async function startWebChild(options, env, failureCode) {
|
|
|
228
230
|
throw primary;
|
|
229
231
|
}
|
|
230
232
|
}
|
|
231
|
-
async function waitForReadyLine(owned, signal, failureCode) {
|
|
233
|
+
async function waitForReadyLine(owned, expectedVersion, signal, failureCode) {
|
|
232
234
|
throwIfAborted(signal, failureCode, "swarm-activation.ready");
|
|
233
235
|
return await new Promise((resolve, reject) => {
|
|
234
236
|
let buffered = "";
|
|
@@ -272,6 +274,17 @@ async function waitForReadyLine(owned, signal, failureCode) {
|
|
|
272
274
|
const newline = buffered.indexOf("\n");
|
|
273
275
|
const line = buffered.slice(0, newline).replace(/\r$/, "");
|
|
274
276
|
buffered = buffered.slice(newline + 1);
|
|
277
|
+
if (expectedVersion === JSON_READY_VERSION) {
|
|
278
|
+
if (line.trim().length === 0)
|
|
279
|
+
continue;
|
|
280
|
+
try {
|
|
281
|
+
settle(parseJsonReadyLine(line));
|
|
282
|
+
}
|
|
283
|
+
catch {
|
|
284
|
+
settle(failure(failureCode, "swarm-activation.ready", "The Kimi web JSON ready line did not confirm the authenticated KAP loopback contract."));
|
|
285
|
+
}
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
275
288
|
if (!line.startsWith("Kimi server: "))
|
|
276
289
|
continue;
|
|
277
290
|
try {
|
|
@@ -311,12 +324,55 @@ function parseReadyLine(line) {
|
|
|
311
324
|
token: parsed.hash.slice("#token=".length),
|
|
312
325
|
};
|
|
313
326
|
}
|
|
327
|
+
function parseJsonReadyLine(line) {
|
|
328
|
+
const data = JSON.parse(line);
|
|
329
|
+
if (!isRecord(data) ||
|
|
330
|
+
typeof data.origin !== "string" ||
|
|
331
|
+
typeof data.ws_url !== "string" ||
|
|
332
|
+
typeof data.token !== "string" ||
|
|
333
|
+
data.token.trim().length === 0 ||
|
|
334
|
+
data.kimi_agent_protocol_version !== KIMI_AGENT_PROTOCOL_VERSION) {
|
|
335
|
+
throw new Error("invalid JSON ready payload");
|
|
336
|
+
}
|
|
337
|
+
const origin = new URL(data.origin);
|
|
338
|
+
if (origin.protocol !== "http:" ||
|
|
339
|
+
origin.hostname !== "127.0.0.1" ||
|
|
340
|
+
origin.port.length === 0 ||
|
|
341
|
+
origin.pathname !== "/" ||
|
|
342
|
+
origin.search.length > 0 ||
|
|
343
|
+
origin.hash.length > 0 ||
|
|
344
|
+
origin.username.length > 0 ||
|
|
345
|
+
origin.password.length > 0 ||
|
|
346
|
+
(data.origin !== origin.origin && data.origin !== `${origin.origin}/`)) {
|
|
347
|
+
throw new Error("invalid JSON ready origin");
|
|
348
|
+
}
|
|
349
|
+
const websocket = new URL(data.ws_url);
|
|
350
|
+
if (websocket.protocol !== "ws:" ||
|
|
351
|
+
websocket.host !== origin.host ||
|
|
352
|
+
websocket.pathname !== "/api/v1/ws" ||
|
|
353
|
+
websocket.search.length > 0 ||
|
|
354
|
+
websocket.hash.length > 0 ||
|
|
355
|
+
websocket.username.length > 0 ||
|
|
356
|
+
websocket.password.length > 0 ||
|
|
357
|
+
data.ws_url !== websocket.href) {
|
|
358
|
+
throw new Error("invalid JSON ready WebSocket URL");
|
|
359
|
+
}
|
|
360
|
+
return { origin: origin.origin, token: data.token };
|
|
361
|
+
}
|
|
314
362
|
async function verifyMeta(web, expectedVersion, signal, failureCode) {
|
|
315
363
|
const data = await restData(web, "GET", "/api/v1/meta", undefined, signal, failureCode);
|
|
316
364
|
if (!isRecord(data)) {
|
|
317
365
|
throw failure(failureCode, "swarm-activation.meta", "Kimi web /meta returned an invalid payload.");
|
|
318
366
|
}
|
|
319
|
-
if (
|
|
367
|
+
if (expectedVersion === JSON_READY_VERSION) {
|
|
368
|
+
if (data.kimi_agent_protocol_version !== KIMI_AGENT_PROTOCOL_VERSION ||
|
|
369
|
+
!isRecord(data.capabilities) ||
|
|
370
|
+
data.capabilities.websocket !== true ||
|
|
371
|
+
"backend" in data) {
|
|
372
|
+
throw failure(failureCode, "swarm-activation.meta", "Kimi web /meta did not confirm the KAP 1.0.0 WebSocket contract without a legacy backend.");
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
else if (data.backend !== "v2") {
|
|
320
376
|
throw failure(failureCode, "swarm-activation.meta", "Kimi web /meta did not confirm the v2 backend.");
|
|
321
377
|
}
|
|
322
378
|
if (data.dangerous_bypass_auth !== false) {
|
|
@@ -343,7 +399,7 @@ async function resolveProfileModel(web, options, failureCode) {
|
|
|
343
399
|
}
|
|
344
400
|
async function createSession(web, options, expectedVersion, failureCode) {
|
|
345
401
|
const request = { metadata: { cwd: options.cwd } };
|
|
346
|
-
if (["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0", "2.6.2", "2.6.3"].includes(expectedVersion)) {
|
|
402
|
+
if (["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0", "2.6.2", "2.6.3", "2.7.2"].includes(expectedVersion)) {
|
|
347
403
|
request.environment_id = "local";
|
|
348
404
|
request.environment_cwd = options.cwd;
|
|
349
405
|
}
|
|
@@ -354,7 +410,7 @@ async function createSession(web, options, expectedVersion, failureCode) {
|
|
|
354
410
|
return { sessionId: data.id, workspaceId: data.workspace_id };
|
|
355
411
|
}
|
|
356
412
|
async function verifyLocalEnvironment(web, identity, expectedCwd, expectedVersion, signal, failureCode) {
|
|
357
|
-
if (!["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0", "2.6.2", "2.6.3"].includes(expectedVersion))
|
|
413
|
+
if (!["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0", "2.6.2", "2.6.3", "2.7.2"].includes(expectedVersion))
|
|
358
414
|
return;
|
|
359
415
|
const data = await restData(web, "GET", `/api/v1/sessions/${encodeURIComponent(identity.sessionId)}/environment`, undefined, signal, failureCode);
|
|
360
416
|
if (!isRecord(data)) {
|
|
@@ -374,10 +430,10 @@ async function postSwarmProfile(web, identity, active, model, signal, failureCod
|
|
|
374
430
|
await restData(web, "POST", `/api/v1/sessions/${encodeURIComponent(identity.sessionId)}/profile`, { agent_config: agentConfig }, signal, failureCode);
|
|
375
431
|
}
|
|
376
432
|
async function verifySwarmStatus(web, identity, active, model, expectedVersion, signal, failureCode) {
|
|
377
|
-
const data = ["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0", "2.6.2", "2.6.3"].includes(expectedVersion)
|
|
433
|
+
const data = ["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0", "2.6.2", "2.6.3", "2.7.2"].includes(expectedVersion)
|
|
378
434
|
? await readWebSocketAgentState(web, identity.sessionId, expectedVersion, signal, failureCode)
|
|
379
435
|
: await restData(web, "GET", `/api/v1/sessions/${encodeURIComponent(identity.sessionId)}/status`, undefined, signal, failureCode);
|
|
380
|
-
const source = ["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0", "2.6.2", "2.6.3"].includes(expectedVersion) ? "agent state" : "/status";
|
|
436
|
+
const source = ["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0", "2.6.2", "2.6.3", "2.7.2"].includes(expectedVersion) ? "agent state" : "/status";
|
|
381
437
|
if (!isRecord(data)) {
|
|
382
438
|
throw failure(failureCode, "swarm-activation.status", `Kimi web ${source} returned an invalid payload.`);
|
|
383
439
|
}
|
|
@@ -387,10 +443,10 @@ async function verifySwarmStatus(web, identity, active, model, expectedVersion,
|
|
|
387
443
|
if (data.plan_mode !== false) {
|
|
388
444
|
throw failure(failureCode, "swarm-activation.status", `Kimi web ${source} did not confirm plan mode is off.`);
|
|
389
445
|
}
|
|
390
|
-
if (["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0", "2.6.2", "2.6.3"].includes(expectedVersion) && data.tower_mode !== false) {
|
|
446
|
+
if (["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0", "2.6.2", "2.6.3", "2.7.2"].includes(expectedVersion) && data.tower_mode !== false) {
|
|
391
447
|
throw failure(failureCode, "swarm-activation.status", "Kimi web agent state did not confirm tower mode is off.");
|
|
392
448
|
}
|
|
393
|
-
const permission = ["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0", "2.6.2", "2.6.3"].includes(expectedVersion) ? data.permission_mode : data.permission;
|
|
449
|
+
const permission = ["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0", "2.6.2", "2.6.3", "2.7.2"].includes(expectedVersion) ? data.permission_mode : data.permission;
|
|
394
450
|
if (permission !== "auto") {
|
|
395
451
|
throw failure(failureCode, "swarm-activation.status", `Kimi web ${source} did not confirm auto permission mode.`);
|
|
396
452
|
}
|
|
@@ -406,7 +462,7 @@ async function readWebSocketAgentState(web, sessionId, expectedVersion, signal,
|
|
|
406
462
|
return await new Promise((resolve, reject) => {
|
|
407
463
|
let socket;
|
|
408
464
|
const bearerProtocol = `kimi-code.bearer.${web.token}`;
|
|
409
|
-
const legacyControl = !["2.6.0", "2.6.2", "2.6.3"].includes(expectedVersion);
|
|
465
|
+
const legacyControl = !["2.6.0", "2.6.2", "2.6.3", "2.7.2"].includes(expectedVersion);
|
|
410
466
|
const helloId = `swarm-activation-hello-${randomUUID()}`;
|
|
411
467
|
const subscribeId = `swarm-activation-subscribe-${randomUUID()}`;
|
|
412
468
|
try {
|
|
@@ -7,7 +7,7 @@ export const BOUNDED_SWARM_POLICY = "bounded-waves/1";
|
|
|
7
7
|
export const SWARM_CHILD_TIMEOUT_MS = 2_147_483_647;
|
|
8
8
|
export function usesBoundedSwarmPolicy(plan) {
|
|
9
9
|
return plan.intendedEngine === "native-v2" &&
|
|
10
|
-
(plan.kimiVersion === "2.6.2" || plan.kimiVersion === "2.6.3") &&
|
|
10
|
+
(plan.kimiVersion === "2.6.2" || plan.kimiVersion === "2.6.3" || plan.kimiVersion === "2.7.2") &&
|
|
11
11
|
(plan.operationKind === "swarm" || plan.operationKind === "swarm-write");
|
|
12
12
|
}
|
|
13
13
|
function plainObject(value) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kimi-plugin-cc",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.2",
|
|
4
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
5
|
"type": "module",
|
|
6
6
|
"main": "dist/dsh/index.js",
|