@ycodium-ai/agent-kimi 0.2.5763 → 0.2.5877

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.
Files changed (2) hide show
  1. package/dist/index.js +49 -17
  2. package/package.json +3 -3
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 = 181;
11
+ var PLUGIN_API_VERSION = 184;
12
12
 
13
13
  // src/index.ts
14
14
  import * as NodeOS6 from "node:os";
@@ -58,6 +58,9 @@ var KIMI_CARD = {
58
58
  verifiedSkills: false,
59
59
  everydayHarness: false,
60
60
  capabilities: {
61
+ // kimi 2.7.2 实测:全量下首轮直接发现并调用 get_database_space(approval-required 下 1 次审批,vs compact 2 次);
62
+ // 故保留全量直列。
63
+ hostMcpToolListing: "full",
61
64
  // 握手失败后的重连行为与带游标换进程续接都没实测:先不自动换代。
62
65
  recoversMcpByRelaunch: false,
63
66
  // 型号与档位都经 `session/set_config_option` 在会话里切,执行器发送前写进去,不重开会话
@@ -70,7 +73,9 @@ var KIMI_CARD = {
70
73
  runtimeModeSwitch: "in-session",
71
74
  nativeModeSwitch: true,
72
75
  // 内置 `Agent` 工具调用经 `task.*` 报(见 `subagents.ts`);后台子 agent 的结束 ACP 不报。
73
- reportsSpawnedAgents: true
76
+ reportsSpawnedAgents: true,
77
+ // Kimi CLI 2.x 在 initialize 里宣告 sessionCapabilities.additionalDirectories,透传给 ACP session。
78
+ acceptsAdditionalDirectories: true
74
79
  },
75
80
  credentialSources: [],
76
81
  diagnostics: [],
@@ -101,7 +106,7 @@ import {
101
106
  } from "@ycodium-ai/plugin-api/executor";
102
107
 
103
108
  // ../../packages/ycodium-acp-executor/src/executor.ts
104
- import * as NodeCrypto from "node:crypto";
109
+ import * as NodeCrypto3 from "node:crypto";
105
110
 
106
111
  // ../../packages/ycodium-acp-executor/src/approvals.ts
107
112
  function createApprovalGate(input2) {
@@ -1215,9 +1220,9 @@ function parseSessionUpdateEvent(params) {
1215
1220
  break;
1216
1221
  }
1217
1222
  case "compaction_update": {
1218
- const compactionId = readAcpText(upd, "compactionId");
1223
+ const compactionId = readAcpText(upd, "compactionId") ?? readAcpText(upd, "id");
1219
1224
  const status = readAcpText(upd, "status");
1220
- if (compactionId === void 0 || status === void 0) break;
1225
+ if (status === void 0) break;
1221
1226
  const rawSummary = upd["summary"];
1222
1227
  events.push({
1223
1228
  _tag: "CompactionUpdated",
@@ -1229,10 +1234,10 @@ function parseSessionUpdateEvent(params) {
1229
1234
  break;
1230
1235
  }
1231
1236
  case "compaction_summary_chunk": {
1232
- const compactionId = readAcpText(upd, "compactionId");
1237
+ const compactionId = readAcpText(upd, "compactionId") ?? readAcpText(upd, "id");
1233
1238
  const content = isRecord2(upd["content"]) ? upd["content"] : void 0;
1234
1239
  const text2 = content?.["type"] === "text" ? content["text"] : void 0;
1235
- if (compactionId === void 0 || typeof text2 !== "string" || text2.length === 0) break;
1240
+ if (typeof text2 !== "string" || text2.length === 0) break;
1236
1241
  events.push({ _tag: "CompactionSummaryChunk", compactionId, text: text2 });
1237
1242
  break;
1238
1243
  }
@@ -1512,6 +1517,9 @@ function createChildSessionRegistry(limit = CHILD_LIMIT) {
1512
1517
  };
1513
1518
  }
1514
1519
 
1520
+ // ../../packages/ycodium-acp-executor/src/executor/lifecycle.ts
1521
+ import * as NodeCrypto from "node:crypto";
1522
+
1515
1523
  // ../../node_modules/.pnpm/@agentclientprotocol+sdk@1.4.0_zod@4.6.5/node_modules/@agentclientprotocol/sdk/dist/schema/index.js
1516
1524
  var AGENT_METHODS = {
1517
1525
  initialize: "initialize",
@@ -25606,7 +25614,7 @@ function createExecutorLifecycle({
25606
25614
  );
25607
25615
  }
25608
25616
  const record3 = {
25609
- snapshotId: randomId(),
25617
+ snapshotId: randomId()?.trim() || NodeCrypto.randomUUID(),
25610
25618
  trigger: "manual",
25611
25619
  startedAtMs: nowMs(),
25612
25620
  summary: void 0,
@@ -27665,6 +27673,9 @@ function createExecutorSettlement({
27665
27673
  return { rememberSettledPromptKey, abortPendingSettlement, settleFromNotification };
27666
27674
  }
27667
27675
 
27676
+ // ../../packages/ycodium-acp-executor/src/executor/updates.ts
27677
+ import * as NodeCrypto2 from "node:crypto";
27678
+
27668
27679
  // ../../packages/ycodium-acp-executor/src/executor/subagent-sessions.ts
27669
27680
  function parseState(raw) {
27670
27681
  if (!isRecord2(raw)) return { status: void 0, error: void 0 };
@@ -27789,6 +27800,7 @@ function createSubagentSessionTracker(registry2) {
27789
27800
  // ../../packages/ycodium-acp-executor/src/executor/updates.ts
27790
27801
  var COMPACTION_SUMMARY_MAX_CHARS = 8e3;
27791
27802
  var SHOWN_TOOL_CALL_LIMIT = 256;
27803
+ var ANONYMOUS_COMPACTION_KEY = "__acp_default_compaction__";
27792
27804
  function createExecutorUpdates({
27793
27805
  emit,
27794
27806
  stamp,
@@ -27806,7 +27818,14 @@ function createExecutorUpdates({
27806
27818
  const shownToolCallIds = /* @__PURE__ */ new Set();
27807
27819
  const markChildSession = shared.childSessions.mark;
27808
27820
  const subagentSessions = options.subagentSessions === true ? createSubagentSessionTracker(shared.childSessions) : void 0;
27821
+ const resolveCompactionSnapshotId = (candidate) => {
27822
+ const trimmed2 = candidate?.trim();
27823
+ if (trimmed2) return trimmed2;
27824
+ const generated = randomId()?.trim();
27825
+ return generated || NodeCrypto2.randomUUID();
27826
+ };
27809
27827
  const emitCompactionState = (record3, state) => {
27828
+ record3.snapshotId = resolveCompactionSnapshotId(record3.snapshotId);
27810
27829
  const summary = record3.summary?.trim() ?? "";
27811
27830
  const truncated = summary.length > COMPACTION_SUMMARY_MAX_CHARS;
27812
27831
  emit({
@@ -27830,14 +27849,18 @@ function createExecutorUpdates({
27830
27849
  });
27831
27850
  };
27832
27851
  const applyCompactionUpdate = (event2) => {
27833
- let record3 = compactions.get(event2.compactionId);
27852
+ const mapKey = event2.compactionId ?? ANONYMOUS_COMPACTION_KEY;
27853
+ let record3 = compactions.get(mapKey);
27834
27854
  if (record3 === void 0) {
27835
27855
  if (shared.manualCompaction !== void 0 && !shared.manualCompaction.adopted) {
27836
27856
  shared.manualCompaction.adopted = true;
27857
+ shared.manualCompaction.snapshotId = resolveCompactionSnapshotId(
27858
+ shared.manualCompaction.snapshotId
27859
+ );
27837
27860
  record3 = shared.manualCompaction;
27838
27861
  } else {
27839
27862
  record3 = {
27840
- snapshotId: randomId(),
27863
+ snapshotId: resolveCompactionSnapshotId(),
27841
27864
  trigger: "automatic",
27842
27865
  startedAtMs: nowMs(),
27843
27866
  summary: void 0,
@@ -27846,7 +27869,7 @@ function createExecutorUpdates({
27846
27869
  adopted: false
27847
27870
  };
27848
27871
  }
27849
- compactions.set(event2.compactionId, record3);
27872
+ compactions.set(mapKey, record3);
27850
27873
  }
27851
27874
  if (event2.summary !== void 0) record3.summary = event2.summary ?? void 0;
27852
27875
  switch (event2.status) {
@@ -27859,13 +27882,13 @@ function createExecutorUpdates({
27859
27882
  case "completed":
27860
27883
  record3.announced = true;
27861
27884
  record3.finished = true;
27862
- compactions.delete(event2.compactionId);
27885
+ compactions.delete(mapKey);
27863
27886
  emitCompactionState(record3, "compacted");
27864
27887
  return;
27865
27888
  case "failed":
27866
27889
  case "cancelled":
27867
27890
  record3.finished = true;
27868
- compactions.delete(event2.compactionId);
27891
+ compactions.delete(mapKey);
27869
27892
  emit({
27870
27893
  type: "runtime.warning",
27871
27894
  ...stamp(),
@@ -27973,9 +27996,11 @@ function createExecutorUpdates({
27973
27996
  nowMs
27974
27997
  });
27975
27998
  const hasToolHooks = toolSubagents !== void 0 || hooks.onToolCallUpdated !== void 0;
27999
+ const toolName = typeof nextToolCall.data["name"] === "string" ? nextToolCall.data["name"] : void 0;
27976
28000
  const call = !hasToolHooks ? void 0 : {
27977
28001
  toolCallId: nextToolCall.toolCallId,
27978
28002
  status: nextToolCall.status,
28003
+ ...toolName === void 0 ? {} : { name: toolName },
27979
28004
  title: nextToolCall.title,
27980
28005
  kind: nextToolCall.kind,
27981
28006
  rawInput: nextToolCall.data["rawInput"],
@@ -28031,7 +28056,7 @@ function createExecutorUpdates({
28031
28056
  continue;
28032
28057
  }
28033
28058
  if (event2._tag === "CompactionSummaryChunk") {
28034
- const record3 = compactions.get(event2.compactionId);
28059
+ const record3 = compactions.get(event2.compactionId ?? ANONYMOUS_COMPACTION_KEY) ?? shared.manualCompaction;
28035
28060
  if (record3 !== void 0 && !record3.finished) {
28036
28061
  record3.summary = (record3.summary ?? "") + event2.text;
28037
28062
  }
@@ -28233,7 +28258,7 @@ function defaultNowIso() {
28233
28258
  return (/* @__PURE__ */ new Date()).toISOString();
28234
28259
  }
28235
28260
  function defaultRandomId() {
28236
- return NodeCrypto.randomUUID();
28261
+ return NodeCrypto3.randomUUID();
28237
28262
  }
28238
28263
  function createAcpExecutor(options) {
28239
28264
  const hooks = { ...defaultVendorHooks, ...options.hooks };
@@ -30640,7 +30665,8 @@ var createKimiInstance = (config2, host, profileDataDir2) => {
30640
30665
  ...acpLaunchMcpFields({
30641
30666
  mcpServers: input2.mcpServers,
30642
30667
  resumeSessionId: resume?.sessionId
30643
- })
30668
+ }),
30669
+ ...input2.additionalDirectories === void 0 || input2.additionalDirectories.length === 0 ? {} : { additionalDirectories: input2.additionalDirectories }
30644
30670
  });
30645
30671
  return openRequestedAcpThread({
30646
30672
  registerSession,
@@ -30704,7 +30730,13 @@ var profileDataDir;
30704
30730
  var executors = [
30705
30731
  {
30706
30732
  card: KIMI_CARD,
30707
- lifecycle: [{ kind: "detect", reversible: true }],
30733
+ // 厂商脚本装,宿主卸不了;支持 `kimi login` 设备码登录与 `kimi upgrade --yes` 升级。
30734
+ lifecycle: [
30735
+ { kind: "install", reversible: false },
30736
+ { kind: "detect", reversible: true },
30737
+ { kind: "sign-in", reversible: false },
30738
+ { kind: "update", reversible: false }
30739
+ ],
30708
30740
  createInstance: async (config2, host) => {
30709
30741
  host.log.info("createInstance");
30710
30742
  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.5763",
3
+ "version": "0.2.5877",
4
4
  "description": "Kimi Code executor: runs `kimi acp` over Agent Client Protocol stdio.",
5
5
  "keywords": [
6
6
  "ycodium",
@@ -21,9 +21,9 @@
21
21
  "@types/node": "24.12.4",
22
22
  "esbuild": "0.28.1",
23
23
  "vite-plus": "0.2.2",
24
- "@ycodium-ai/plugin-api": "0.2.5763",
25
- "ycodium-acp-executor": "0.2.0",
24
+ "@ycodium-ai/plugin-api": "0.2.5877",
26
25
  "ycodium-executor-testing": "0.0.0",
26
+ "ycodium-acp-executor": "0.2.5877",
27
27
  "ycodium-instance-config": "0.0.0"
28
28
  },
29
29
  "ycodium": {