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
|
@@ -10,7 +10,8 @@ import { assertExecutionPlanMatchesSpawn, assertNoUnsafeExperimentalSelector, }
|
|
|
10
10
|
import { resolveKimiHome } from "./kimi-home.js";
|
|
11
11
|
import { assertNativeV2Preflight } from "./native-v2-preflight.js";
|
|
12
12
|
import { collectDescendantIdentities, collectProcessGroupsIdentities, probeProcessIdentity, revalidateProcessIdentities, waitForProcessTreeExit, } from "./process-tree.js";
|
|
13
|
-
|
|
13
|
+
// Exact 2.6.0 is an integration candidate, not a production-certified version.
|
|
14
|
+
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"];
|
|
14
15
|
const READY_TIMEOUT_MS = 10_000;
|
|
15
16
|
const REST_TIMEOUT_MS = 5_000;
|
|
16
17
|
// Exact 2.4.0 can take longer than 5s to drain session/workspace lifecycle work.
|
|
@@ -337,7 +338,7 @@ async function resolveProfileModel(web, options, failureCode) {
|
|
|
337
338
|
}
|
|
338
339
|
async function createSession(web, options, expectedVersion, failureCode) {
|
|
339
340
|
const request = { metadata: { cwd: options.cwd } };
|
|
340
|
-
if (["2.5.0", "2.5.1", "2.5.2"].includes(expectedVersion)) {
|
|
341
|
+
if (["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0"].includes(expectedVersion)) {
|
|
341
342
|
request.environment_id = "local";
|
|
342
343
|
request.environment_cwd = options.cwd;
|
|
343
344
|
}
|
|
@@ -348,7 +349,7 @@ async function createSession(web, options, expectedVersion, failureCode) {
|
|
|
348
349
|
return { sessionId: data.id, workspaceId: data.workspace_id };
|
|
349
350
|
}
|
|
350
351
|
async function verifyLocalEnvironment(web, identity, expectedCwd, expectedVersion, signal, failureCode) {
|
|
351
|
-
if (!["2.5.0", "2.5.1", "2.5.2"].includes(expectedVersion))
|
|
352
|
+
if (!["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0"].includes(expectedVersion))
|
|
352
353
|
return;
|
|
353
354
|
const data = await restData(web, "GET", `/api/v1/sessions/${encodeURIComponent(identity.sessionId)}/environment`, undefined, signal, failureCode);
|
|
354
355
|
if (!isRecord(data)) {
|
|
@@ -368,10 +369,10 @@ async function postSwarmProfile(web, identity, active, model, signal, failureCod
|
|
|
368
369
|
await restData(web, "POST", `/api/v1/sessions/${encodeURIComponent(identity.sessionId)}/profile`, { agent_config: agentConfig }, signal, failureCode);
|
|
369
370
|
}
|
|
370
371
|
async function verifySwarmStatus(web, identity, active, model, expectedVersion, signal, failureCode) {
|
|
371
|
-
const data = ["2.5.0", "2.5.1", "2.5.2"].includes(expectedVersion)
|
|
372
|
-
? await readWebSocketAgentState(web, identity.sessionId, signal, failureCode)
|
|
372
|
+
const data = ["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0"].includes(expectedVersion)
|
|
373
|
+
? await readWebSocketAgentState(web, identity.sessionId, expectedVersion, signal, failureCode)
|
|
373
374
|
: await restData(web, "GET", `/api/v1/sessions/${encodeURIComponent(identity.sessionId)}/status`, undefined, signal, failureCode);
|
|
374
|
-
const source = ["2.5.0", "2.5.1", "2.5.2"].includes(expectedVersion) ? "agent state" : "/status";
|
|
375
|
+
const source = ["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0"].includes(expectedVersion) ? "agent state" : "/status";
|
|
375
376
|
if (!isRecord(data)) {
|
|
376
377
|
throw failure(failureCode, "swarm-activation.status", `Kimi web ${source} returned an invalid payload.`);
|
|
377
378
|
}
|
|
@@ -381,10 +382,10 @@ async function verifySwarmStatus(web, identity, active, model, expectedVersion,
|
|
|
381
382
|
if (data.plan_mode !== false) {
|
|
382
383
|
throw failure(failureCode, "swarm-activation.status", `Kimi web ${source} did not confirm plan mode is off.`);
|
|
383
384
|
}
|
|
384
|
-
if (["2.5.0", "2.5.1", "2.5.2"].includes(expectedVersion) && data.tower_mode !== false) {
|
|
385
|
+
if (["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0"].includes(expectedVersion) && data.tower_mode !== false) {
|
|
385
386
|
throw failure(failureCode, "swarm-activation.status", "Kimi web agent state did not confirm tower mode is off.");
|
|
386
387
|
}
|
|
387
|
-
const permission = ["2.5.0", "2.5.1", "2.5.2"].includes(expectedVersion) ? data.permission_mode : data.permission;
|
|
388
|
+
const permission = ["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0"].includes(expectedVersion) ? data.permission_mode : data.permission;
|
|
388
389
|
if (permission !== "auto") {
|
|
389
390
|
throw failure(failureCode, "swarm-activation.status", `Kimi web ${source} did not confirm auto permission mode.`);
|
|
390
391
|
}
|
|
@@ -392,7 +393,7 @@ async function verifySwarmStatus(web, identity, active, model, expectedVersion,
|
|
|
392
393
|
throw failure(failureCode, "swarm-activation.status", `Kimi web ${source} did not confirm the selected model alias.`);
|
|
393
394
|
}
|
|
394
395
|
}
|
|
395
|
-
async function readWebSocketAgentState(web, sessionId, signal, failureCode) {
|
|
396
|
+
async function readWebSocketAgentState(web, sessionId, expectedVersion, signal, failureCode) {
|
|
396
397
|
throwIfAborted(signal, failureCode, "swarm-activation.status");
|
|
397
398
|
await refreshOwnedDescendants(web);
|
|
398
399
|
throwIfAborted(signal, failureCode, "swarm-activation.status");
|
|
@@ -400,6 +401,7 @@ async function readWebSocketAgentState(web, sessionId, signal, failureCode) {
|
|
|
400
401
|
return await new Promise((resolve, reject) => {
|
|
401
402
|
let socket;
|
|
402
403
|
const bearerProtocol = `kimi-code.bearer.${web.token}`;
|
|
404
|
+
const legacyControl = expectedVersion !== "2.6.0";
|
|
403
405
|
const helloId = `swarm-activation-hello-${randomUUID()}`;
|
|
404
406
|
const subscribeId = `swarm-activation-subscribe-${randomUUID()}`;
|
|
405
407
|
try {
|
|
@@ -418,6 +420,7 @@ async function readWebSocketAgentState(web, sessionId, signal, failureCode) {
|
|
|
418
420
|
let subscribeSent = false;
|
|
419
421
|
let subscriptionAcknowledged = false;
|
|
420
422
|
let closeRequested = false;
|
|
423
|
+
let closeTimer;
|
|
421
424
|
let latestState;
|
|
422
425
|
let frames = 0;
|
|
423
426
|
let receivedChars = 0;
|
|
@@ -426,6 +429,8 @@ async function readWebSocketAgentState(web, sessionId, signal, failureCode) {
|
|
|
426
429
|
}, REST_TIMEOUT_MS);
|
|
427
430
|
const cleanup = () => {
|
|
428
431
|
clearTimeout(timer);
|
|
432
|
+
if (closeTimer !== undefined)
|
|
433
|
+
clearTimeout(closeTimer);
|
|
429
434
|
signal?.removeEventListener("abort", onAbort);
|
|
430
435
|
socket.removeEventListener("open", onOpen);
|
|
431
436
|
socket.removeEventListener("message", onMessage);
|
|
@@ -460,30 +465,46 @@ async function readWebSocketAgentState(web, sessionId, signal, failureCode) {
|
|
|
460
465
|
return false;
|
|
461
466
|
}
|
|
462
467
|
};
|
|
468
|
+
const handshakeComplete = () => !legacyControl || (serverHello && clientHelloAcknowledged);
|
|
469
|
+
const closeForValidation = () => {
|
|
470
|
+
closeRequested = true;
|
|
471
|
+
try {
|
|
472
|
+
socket.close();
|
|
473
|
+
}
|
|
474
|
+
catch {
|
|
475
|
+
rejectState("Could not close the Kimi web agent-state channel for final validation.");
|
|
476
|
+
}
|
|
477
|
+
};
|
|
463
478
|
const completeIfReady = () => {
|
|
464
|
-
if (
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
closeRequested = true;
|
|
470
|
-
try {
|
|
471
|
-
socket.close();
|
|
472
|
-
}
|
|
473
|
-
catch {
|
|
474
|
-
rejectState("Could not close the Kimi web agent-state channel for final validation.");
|
|
475
|
-
}
|
|
479
|
+
if (!handshakeComplete() || !subscriptionAcknowledged || latestState === undefined || closeRequested)
|
|
480
|
+
return;
|
|
481
|
+
if (legacyControl) {
|
|
482
|
+
closeForValidation();
|
|
483
|
+
return;
|
|
476
484
|
}
|
|
485
|
+
closeTimer ??= setTimeout(() => {
|
|
486
|
+
closeTimer = undefined;
|
|
487
|
+
closeForValidation();
|
|
488
|
+
}, 0);
|
|
477
489
|
};
|
|
478
490
|
const onOpen = () => {
|
|
479
491
|
if (socket.protocol !== bearerProtocol) {
|
|
480
492
|
rejectState("Kimi web did not authenticate the agent-state channel with the expected subprotocol.");
|
|
481
493
|
return;
|
|
482
494
|
}
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
495
|
+
if (legacyControl) {
|
|
496
|
+
send({
|
|
497
|
+
type: "client_hello",
|
|
498
|
+
id: helloId,
|
|
499
|
+
payload: { client_id: "kimi-plugin-cc-swarm-activation" },
|
|
500
|
+
});
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
subscribeSent = send({
|
|
504
|
+
type: "subscribe",
|
|
505
|
+
request_id: subscribeId,
|
|
506
|
+
session_id: sessionId,
|
|
507
|
+
agent_ids: ["main"],
|
|
487
508
|
});
|
|
488
509
|
};
|
|
489
510
|
const onMessage = (event) => {
|
|
@@ -511,7 +532,7 @@ async function readWebSocketAgentState(web, sessionId, signal, failureCode) {
|
|
|
511
532
|
rejectState("Kimi web agent-state channel returned an invalid frame.");
|
|
512
533
|
return;
|
|
513
534
|
}
|
|
514
|
-
if (frame.type === "server_hello") {
|
|
535
|
+
if (legacyControl && frame.type === "server_hello") {
|
|
515
536
|
if (serverHello || !isRecord(frame.payload) ||
|
|
516
537
|
frame.payload.protocol_version !== 2 ||
|
|
517
538
|
typeof frame.payload.ws_connection_id !== "string" ||
|
|
@@ -524,11 +545,11 @@ async function readWebSocketAgentState(web, sessionId, signal, failureCode) {
|
|
|
524
545
|
serverHello = true;
|
|
525
546
|
return;
|
|
526
547
|
}
|
|
527
|
-
if (!serverHello) {
|
|
548
|
+
if (legacyControl && !serverHello) {
|
|
528
549
|
rejectState("Kimi web agent-state channel sent data before its protocol hello.");
|
|
529
550
|
return;
|
|
530
551
|
}
|
|
531
|
-
if (frame.type === "ack") {
|
|
552
|
+
if (legacyControl && frame.type === "ack") {
|
|
532
553
|
if (typeof frame.id !== "string" || typeof frame.code !== "number" || !isRecord(frame.payload)) {
|
|
533
554
|
rejectState("Kimi web agent-state channel returned an invalid acknowledgement.");
|
|
534
555
|
return;
|
|
@@ -563,8 +584,26 @@ async function readWebSocketAgentState(web, sessionId, signal, failureCode) {
|
|
|
563
584
|
rejectState("Kimi web agent-state channel returned an unexpected acknowledgement.");
|
|
564
585
|
return;
|
|
565
586
|
}
|
|
587
|
+
if (!legacyControl && frame.type === "response") {
|
|
588
|
+
if (typeof frame.request_id !== "string" || !Number.isInteger(frame.code)) {
|
|
589
|
+
rejectState("Kimi web agent-state channel returned an invalid subscription response.");
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
if (frame.request_id !== subscribeId) {
|
|
593
|
+
rejectState("Kimi web agent-state channel returned an unexpected subscription response.");
|
|
594
|
+
return;
|
|
595
|
+
}
|
|
596
|
+
if (subscriptionAcknowledged || !subscribeSent || frame.code !== 0) {
|
|
597
|
+
rejectState("Kimi web agent-state channel did not accept the exact main-session subscription.");
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
subscriptionAcknowledged = true;
|
|
601
|
+
completeIfReady();
|
|
602
|
+
return;
|
|
603
|
+
}
|
|
566
604
|
if (frame.type === "agent") {
|
|
567
|
-
if (!subscribeSent || !
|
|
605
|
+
if (!subscribeSent || (!legacyControl && !subscriptionAcknowledged) ||
|
|
606
|
+
!isAgentStateFrame(frame, sessionId)) {
|
|
568
607
|
rejectState("Kimi web agent-state channel returned invalid or misbound main-agent state.");
|
|
569
608
|
return;
|
|
570
609
|
}
|
|
@@ -573,9 +612,12 @@ async function readWebSocketAgentState(web, sessionId, signal, failureCode) {
|
|
|
573
612
|
return;
|
|
574
613
|
}
|
|
575
614
|
if (frame.type === "ping") {
|
|
576
|
-
if (isRecord(frame.payload) && typeof frame.payload.nonce === "string") {
|
|
615
|
+
if (legacyControl && isRecord(frame.payload) && typeof frame.payload.nonce === "string") {
|
|
577
616
|
send({ type: "pong", payload: { nonce: frame.payload.nonce } });
|
|
578
617
|
}
|
|
618
|
+
else if (!legacyControl) {
|
|
619
|
+
send({ type: "pong" });
|
|
620
|
+
}
|
|
579
621
|
}
|
|
580
622
|
};
|
|
581
623
|
const onAbort = () => {
|
|
@@ -586,8 +628,7 @@ async function readWebSocketAgentState(web, sessionId, signal, failureCode) {
|
|
|
586
628
|
};
|
|
587
629
|
const onClose = () => {
|
|
588
630
|
if (closeRequested &&
|
|
589
|
-
|
|
590
|
-
clientHelloAcknowledged &&
|
|
631
|
+
handshakeComplete() &&
|
|
591
632
|
subscriptionAcknowledged &&
|
|
592
633
|
latestState !== undefined) {
|
|
593
634
|
settle(latestState);
|
|
@@ -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 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",
|