@ycodium-ai/agent-kimi 0.2.5751 → 0.2.5854
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/dist/index.js +46 -17
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ var __export = (target, all) => {
|
|
|
8
8
|
import { definePlugin } from "@ycodium-ai/plugin-api";
|
|
9
9
|
|
|
10
10
|
// ../../packages/plugin-api/src/version.ts
|
|
11
|
-
var PLUGIN_API_VERSION =
|
|
11
|
+
var PLUGIN_API_VERSION = 183;
|
|
12
12
|
|
|
13
13
|
// src/index.ts
|
|
14
14
|
import * as NodeOS6 from "node:os";
|
|
@@ -70,7 +70,9 @@ var KIMI_CARD = {
|
|
|
70
70
|
runtimeModeSwitch: "in-session",
|
|
71
71
|
nativeModeSwitch: true,
|
|
72
72
|
// 内置 `Agent` 工具调用经 `task.*` 报(见 `subagents.ts`);后台子 agent 的结束 ACP 不报。
|
|
73
|
-
reportsSpawnedAgents: true
|
|
73
|
+
reportsSpawnedAgents: true,
|
|
74
|
+
// Kimi CLI 2.x 在 initialize 里宣告 sessionCapabilities.additionalDirectories,透传给 ACP session。
|
|
75
|
+
acceptsAdditionalDirectories: true
|
|
74
76
|
},
|
|
75
77
|
credentialSources: [],
|
|
76
78
|
diagnostics: [],
|
|
@@ -101,7 +103,7 @@ import {
|
|
|
101
103
|
} from "@ycodium-ai/plugin-api/executor";
|
|
102
104
|
|
|
103
105
|
// ../../packages/ycodium-acp-executor/src/executor.ts
|
|
104
|
-
import * as
|
|
106
|
+
import * as NodeCrypto3 from "node:crypto";
|
|
105
107
|
|
|
106
108
|
// ../../packages/ycodium-acp-executor/src/approvals.ts
|
|
107
109
|
function createApprovalGate(input2) {
|
|
@@ -1215,9 +1217,9 @@ function parseSessionUpdateEvent(params) {
|
|
|
1215
1217
|
break;
|
|
1216
1218
|
}
|
|
1217
1219
|
case "compaction_update": {
|
|
1218
|
-
const compactionId = readAcpText(upd, "compactionId");
|
|
1220
|
+
const compactionId = readAcpText(upd, "compactionId") ?? readAcpText(upd, "id");
|
|
1219
1221
|
const status = readAcpText(upd, "status");
|
|
1220
|
-
if (
|
|
1222
|
+
if (status === void 0) break;
|
|
1221
1223
|
const rawSummary = upd["summary"];
|
|
1222
1224
|
events.push({
|
|
1223
1225
|
_tag: "CompactionUpdated",
|
|
@@ -1229,10 +1231,10 @@ function parseSessionUpdateEvent(params) {
|
|
|
1229
1231
|
break;
|
|
1230
1232
|
}
|
|
1231
1233
|
case "compaction_summary_chunk": {
|
|
1232
|
-
const compactionId = readAcpText(upd, "compactionId");
|
|
1234
|
+
const compactionId = readAcpText(upd, "compactionId") ?? readAcpText(upd, "id");
|
|
1233
1235
|
const content = isRecord2(upd["content"]) ? upd["content"] : void 0;
|
|
1234
1236
|
const text2 = content?.["type"] === "text" ? content["text"] : void 0;
|
|
1235
|
-
if (
|
|
1237
|
+
if (typeof text2 !== "string" || text2.length === 0) break;
|
|
1236
1238
|
events.push({ _tag: "CompactionSummaryChunk", compactionId, text: text2 });
|
|
1237
1239
|
break;
|
|
1238
1240
|
}
|
|
@@ -1512,6 +1514,9 @@ function createChildSessionRegistry(limit = CHILD_LIMIT) {
|
|
|
1512
1514
|
};
|
|
1513
1515
|
}
|
|
1514
1516
|
|
|
1517
|
+
// ../../packages/ycodium-acp-executor/src/executor/lifecycle.ts
|
|
1518
|
+
import * as NodeCrypto from "node:crypto";
|
|
1519
|
+
|
|
1515
1520
|
// ../../node_modules/.pnpm/@agentclientprotocol+sdk@1.4.0_zod@4.6.5/node_modules/@agentclientprotocol/sdk/dist/schema/index.js
|
|
1516
1521
|
var AGENT_METHODS = {
|
|
1517
1522
|
initialize: "initialize",
|
|
@@ -25606,7 +25611,7 @@ function createExecutorLifecycle({
|
|
|
25606
25611
|
);
|
|
25607
25612
|
}
|
|
25608
25613
|
const record3 = {
|
|
25609
|
-
snapshotId: randomId(),
|
|
25614
|
+
snapshotId: randomId()?.trim() || NodeCrypto.randomUUID(),
|
|
25610
25615
|
trigger: "manual",
|
|
25611
25616
|
startedAtMs: nowMs(),
|
|
25612
25617
|
summary: void 0,
|
|
@@ -27665,6 +27670,9 @@ function createExecutorSettlement({
|
|
|
27665
27670
|
return { rememberSettledPromptKey, abortPendingSettlement, settleFromNotification };
|
|
27666
27671
|
}
|
|
27667
27672
|
|
|
27673
|
+
// ../../packages/ycodium-acp-executor/src/executor/updates.ts
|
|
27674
|
+
import * as NodeCrypto2 from "node:crypto";
|
|
27675
|
+
|
|
27668
27676
|
// ../../packages/ycodium-acp-executor/src/executor/subagent-sessions.ts
|
|
27669
27677
|
function parseState(raw) {
|
|
27670
27678
|
if (!isRecord2(raw)) return { status: void 0, error: void 0 };
|
|
@@ -27789,6 +27797,7 @@ function createSubagentSessionTracker(registry2) {
|
|
|
27789
27797
|
// ../../packages/ycodium-acp-executor/src/executor/updates.ts
|
|
27790
27798
|
var COMPACTION_SUMMARY_MAX_CHARS = 8e3;
|
|
27791
27799
|
var SHOWN_TOOL_CALL_LIMIT = 256;
|
|
27800
|
+
var ANONYMOUS_COMPACTION_KEY = "__acp_default_compaction__";
|
|
27792
27801
|
function createExecutorUpdates({
|
|
27793
27802
|
emit,
|
|
27794
27803
|
stamp,
|
|
@@ -27806,7 +27815,14 @@ function createExecutorUpdates({
|
|
|
27806
27815
|
const shownToolCallIds = /* @__PURE__ */ new Set();
|
|
27807
27816
|
const markChildSession = shared.childSessions.mark;
|
|
27808
27817
|
const subagentSessions = options.subagentSessions === true ? createSubagentSessionTracker(shared.childSessions) : void 0;
|
|
27818
|
+
const resolveCompactionSnapshotId = (candidate) => {
|
|
27819
|
+
const trimmed2 = candidate?.trim();
|
|
27820
|
+
if (trimmed2) return trimmed2;
|
|
27821
|
+
const generated = randomId()?.trim();
|
|
27822
|
+
return generated || NodeCrypto2.randomUUID();
|
|
27823
|
+
};
|
|
27809
27824
|
const emitCompactionState = (record3, state) => {
|
|
27825
|
+
record3.snapshotId = resolveCompactionSnapshotId(record3.snapshotId);
|
|
27810
27826
|
const summary = record3.summary?.trim() ?? "";
|
|
27811
27827
|
const truncated = summary.length > COMPACTION_SUMMARY_MAX_CHARS;
|
|
27812
27828
|
emit({
|
|
@@ -27830,14 +27846,18 @@ function createExecutorUpdates({
|
|
|
27830
27846
|
});
|
|
27831
27847
|
};
|
|
27832
27848
|
const applyCompactionUpdate = (event2) => {
|
|
27833
|
-
|
|
27849
|
+
const mapKey = event2.compactionId ?? ANONYMOUS_COMPACTION_KEY;
|
|
27850
|
+
let record3 = compactions.get(mapKey);
|
|
27834
27851
|
if (record3 === void 0) {
|
|
27835
27852
|
if (shared.manualCompaction !== void 0 && !shared.manualCompaction.adopted) {
|
|
27836
27853
|
shared.manualCompaction.adopted = true;
|
|
27854
|
+
shared.manualCompaction.snapshotId = resolveCompactionSnapshotId(
|
|
27855
|
+
shared.manualCompaction.snapshotId
|
|
27856
|
+
);
|
|
27837
27857
|
record3 = shared.manualCompaction;
|
|
27838
27858
|
} else {
|
|
27839
27859
|
record3 = {
|
|
27840
|
-
snapshotId:
|
|
27860
|
+
snapshotId: resolveCompactionSnapshotId(),
|
|
27841
27861
|
trigger: "automatic",
|
|
27842
27862
|
startedAtMs: nowMs(),
|
|
27843
27863
|
summary: void 0,
|
|
@@ -27846,7 +27866,7 @@ function createExecutorUpdates({
|
|
|
27846
27866
|
adopted: false
|
|
27847
27867
|
};
|
|
27848
27868
|
}
|
|
27849
|
-
compactions.set(
|
|
27869
|
+
compactions.set(mapKey, record3);
|
|
27850
27870
|
}
|
|
27851
27871
|
if (event2.summary !== void 0) record3.summary = event2.summary ?? void 0;
|
|
27852
27872
|
switch (event2.status) {
|
|
@@ -27859,13 +27879,13 @@ function createExecutorUpdates({
|
|
|
27859
27879
|
case "completed":
|
|
27860
27880
|
record3.announced = true;
|
|
27861
27881
|
record3.finished = true;
|
|
27862
|
-
compactions.delete(
|
|
27882
|
+
compactions.delete(mapKey);
|
|
27863
27883
|
emitCompactionState(record3, "compacted");
|
|
27864
27884
|
return;
|
|
27865
27885
|
case "failed":
|
|
27866
27886
|
case "cancelled":
|
|
27867
27887
|
record3.finished = true;
|
|
27868
|
-
compactions.delete(
|
|
27888
|
+
compactions.delete(mapKey);
|
|
27869
27889
|
emit({
|
|
27870
27890
|
type: "runtime.warning",
|
|
27871
27891
|
...stamp(),
|
|
@@ -27973,9 +27993,11 @@ function createExecutorUpdates({
|
|
|
27973
27993
|
nowMs
|
|
27974
27994
|
});
|
|
27975
27995
|
const hasToolHooks = toolSubagents !== void 0 || hooks.onToolCallUpdated !== void 0;
|
|
27996
|
+
const toolName = typeof nextToolCall.data["name"] === "string" ? nextToolCall.data["name"] : void 0;
|
|
27976
27997
|
const call = !hasToolHooks ? void 0 : {
|
|
27977
27998
|
toolCallId: nextToolCall.toolCallId,
|
|
27978
27999
|
status: nextToolCall.status,
|
|
28000
|
+
...toolName === void 0 ? {} : { name: toolName },
|
|
27979
28001
|
title: nextToolCall.title,
|
|
27980
28002
|
kind: nextToolCall.kind,
|
|
27981
28003
|
rawInput: nextToolCall.data["rawInput"],
|
|
@@ -28031,7 +28053,7 @@ function createExecutorUpdates({
|
|
|
28031
28053
|
continue;
|
|
28032
28054
|
}
|
|
28033
28055
|
if (event2._tag === "CompactionSummaryChunk") {
|
|
28034
|
-
const record3 = compactions.get(event2.compactionId);
|
|
28056
|
+
const record3 = compactions.get(event2.compactionId ?? ANONYMOUS_COMPACTION_KEY) ?? shared.manualCompaction;
|
|
28035
28057
|
if (record3 !== void 0 && !record3.finished) {
|
|
28036
28058
|
record3.summary = (record3.summary ?? "") + event2.text;
|
|
28037
28059
|
}
|
|
@@ -28233,7 +28255,7 @@ function defaultNowIso() {
|
|
|
28233
28255
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
28234
28256
|
}
|
|
28235
28257
|
function defaultRandomId() {
|
|
28236
|
-
return
|
|
28258
|
+
return NodeCrypto3.randomUUID();
|
|
28237
28259
|
}
|
|
28238
28260
|
function createAcpExecutor(options) {
|
|
28239
28261
|
const hooks = { ...defaultVendorHooks, ...options.hooks };
|
|
@@ -30640,7 +30662,8 @@ var createKimiInstance = (config2, host, profileDataDir2) => {
|
|
|
30640
30662
|
...acpLaunchMcpFields({
|
|
30641
30663
|
mcpServers: input2.mcpServers,
|
|
30642
30664
|
resumeSessionId: resume?.sessionId
|
|
30643
|
-
})
|
|
30665
|
+
}),
|
|
30666
|
+
...input2.additionalDirectories === void 0 || input2.additionalDirectories.length === 0 ? {} : { additionalDirectories: input2.additionalDirectories }
|
|
30644
30667
|
});
|
|
30645
30668
|
return openRequestedAcpThread({
|
|
30646
30669
|
registerSession,
|
|
@@ -30704,7 +30727,13 @@ var profileDataDir;
|
|
|
30704
30727
|
var executors = [
|
|
30705
30728
|
{
|
|
30706
30729
|
card: KIMI_CARD,
|
|
30707
|
-
|
|
30730
|
+
// 厂商脚本装,宿主卸不了;支持 `kimi login` 设备码登录与 `kimi upgrade --yes` 升级。
|
|
30731
|
+
lifecycle: [
|
|
30732
|
+
{ kind: "install", reversible: false },
|
|
30733
|
+
{ kind: "detect", reversible: true },
|
|
30734
|
+
{ kind: "sign-in", reversible: false },
|
|
30735
|
+
{ kind: "update", reversible: false }
|
|
30736
|
+
],
|
|
30708
30737
|
createInstance: async (config2, host) => {
|
|
30709
30738
|
host.log.info("createInstance");
|
|
30710
30739
|
return createKimiInstance(config2, host, profileDataDir);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ycodium-ai/agent-kimi",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5854",
|
|
4
4
|
"description": "Kimi Code executor: runs `kimi acp` over Agent Client Protocol stdio.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ycodium",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"@types/node": "24.12.4",
|
|
22
22
|
"esbuild": "0.28.1",
|
|
23
23
|
"vite-plus": "0.2.2",
|
|
24
|
-
"ycodium-acp-executor": "0.2.
|
|
25
|
-
"@ycodium-ai/plugin-api": "0.2.
|
|
26
|
-
"ycodium-
|
|
27
|
-
"ycodium-
|
|
24
|
+
"ycodium-acp-executor": "0.2.5854",
|
|
25
|
+
"@ycodium-ai/plugin-api": "0.2.5854",
|
|
26
|
+
"ycodium-instance-config": "0.0.0",
|
|
27
|
+
"ycodium-executor-testing": "0.0.0"
|
|
28
28
|
},
|
|
29
29
|
"ycodium": {
|
|
30
30
|
"plugin": "./dist/index.js",
|