@ycodium-ai/agent-kimi 0.2.4486 → 0.2.5004

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/README.md CHANGED
@@ -11,7 +11,7 @@ customModels } }`; launch arguments (`acp`) and the account-directory variable (
11
11
  context usage is read from the CLI's own session log.
12
12
  - Models come from the read-only `kimi provider list --json` (`src/kimiModels.ts`); the version
13
13
  from `kimi --version`. No probe session is created.
14
- - Sign-in is `kimi login` (device-code flow), upgrade is `kimi upgrade`.
14
+ - Sign-in is `kimi login` (device-code flow), upgrade is `kimi upgrade --yes`.
15
15
  - Runtime modes map to native permissions: auto and auto-accept-edits → yolo, full-access → auto, approval-required → default.
16
16
  The auto-accept-edits mapping is an approximation and may allow more than edits. Kimi has no
17
17
  edits-only automatic native mode: default asks for approvals and plan does not execute tools.
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 = 119;
11
+ var PLUGIN_API_VERSION = 142;
12
12
 
13
13
  // src/index.ts
14
14
  import * as NodeOS6 from "node:os";
@@ -44,13 +44,15 @@ var KIMI_CARD = {
44
44
  deviceCodeSignInArgs: ["login"],
45
45
  npmPackage: "@moonshot-ai/kimi-code",
46
46
  homebrewFormula: "",
47
- // 是 `upgrade` 不是 `update`(`update` 只是它的别名)。
48
- selfUpdateArgs: ["upgrade"],
47
+ // 是 `upgrade` 不是 `update`(`update` 只是它的别名)。不带 `--yes` 时,输出不是终端
48
+ // 就只打印手动升级提示、照样退出 0,什么也不装。
49
+ selfUpdateArgs: ["upgrade", "--yes"],
49
50
  docsUrl: "https://github.com/MoonshotAI/kimi-code",
50
51
  setupNote: "",
51
52
  defaultModel: "",
52
53
  customModelIdExample: "",
53
54
  modelSlugAliases: null,
55
+ mcpToolCallCeilingSeconds: 300,
54
56
  mcpTransports: ["stdio", "http", "sse"],
55
57
  pluginManaged: true,
56
58
  verifiedSkills: false,
@@ -89,6 +91,7 @@ var KIMI_CARD = {
89
91
  type: "string",
90
92
  "x-ycodium-form": {
91
93
  titleKey: "form.homePath.title",
94
+ machineLocal: true,
92
95
  descriptionKey: "form.homePath.description",
93
96
  placeholderKey: "form.homePath.placeholder"
94
97
  }
@@ -1088,7 +1091,15 @@ function parsePermissionRequest(params, known) {
1088
1091
  { fallbackStatus: "pending" }
1089
1092
  );
1090
1093
  const kind = toolCall?.kind ?? "unknown";
1091
- const detail = toolCall?.command ?? toolCall?.title ?? toolCall?.detail;
1094
+ const content = toolCall?.data["content"];
1095
+ const firstText = Array.isArray(content) ? content.flatMap((entry) => {
1096
+ if (!isRecord2(entry) || entry["type"] !== "content" || !isRecord2(entry["content"]))
1097
+ return [];
1098
+ const block = entry["content"];
1099
+ return block["type"] === "text" && typeof block["text"] === "string" && block["text"].trim() ? [block["text"]] : [];
1100
+ })[0] : void 0;
1101
+ const originalTitle = (request.title ?? known?.rawTitle)?.trim() || void 0;
1102
+ const detail = toolCall?.command ?? firstText ?? originalTitle;
1092
1103
  return {
1093
1104
  kind,
1094
1105
  ...detail ? { detail } : {},
@@ -1329,6 +1340,7 @@ function makeAcpRequestOpenedEvent(input2) {
1329
1340
  ...input2.detail ? { detail: input2.detail } : {},
1330
1341
  ...toolName ? { toolName } : {},
1331
1342
  args: input2.args,
1343
+ ...input2.statement !== void 0 ? { statement: input2.statement } : {},
1332
1344
  ...input2.options ? { options: input2.options } : {},
1333
1345
  ...input2.fileChanges ? { fileChanges: input2.fileChanges } : {},
1334
1346
  declineReasonRelay: "queued"
@@ -26602,6 +26614,38 @@ function createPromptResults({
26602
26614
  return { add, receive, reject, stop, complete, hasInterrupted, forget, wait, finishUnreceived };
26603
26615
  }
26604
26616
 
26617
+ // ../../packages/ycodium-acp-executor/src/permission-statement.ts
26618
+ function defaultPermissionStatement(request) {
26619
+ const rawInput = request.toolCall?.data["rawInput"];
26620
+ const input2 = isRecord2(rawInput) ? rawInput : {};
26621
+ const coveredArgs = [];
26622
+ const text = (name) => {
26623
+ const value = input2[name];
26624
+ if (typeof value !== "string" || value.trim().length === 0) return void 0;
26625
+ coveredArgs.push(name);
26626
+ return value;
26627
+ };
26628
+ const description = text("description");
26629
+ const justification = text("justification") ?? text("reason");
26630
+ const command = request.kind === "execute" ? text("command") ?? text("cmd") ?? request.toolCall?.command : void 0;
26631
+ let outsideSandbox = false;
26632
+ for (const name of ["sandbox_permissions", "sandboxPermissions", "dangerouslyDisableSandbox"]) {
26633
+ const value = input2[name];
26634
+ const outside = name === "dangerouslyDisableSandbox" ? value === true || value === "true" : typeof value === "string" && /full[-_]access|danger|escalat/i.test(value);
26635
+ if (!outside) continue;
26636
+ outsideSandbox = true;
26637
+ coveredArgs.push(name);
26638
+ }
26639
+ if ("timeoutMs" in input2) coveredArgs.push("timeoutMs");
26640
+ return {
26641
+ ...description !== void 0 ? { description } : {},
26642
+ ...justification !== void 0 ? { justification } : {},
26643
+ ...command !== void 0 ? { command } : {},
26644
+ ...outsideSandbox ? { outsideSandbox: true } : {},
26645
+ ...coveredArgs.length > 0 ? { coveredArgs } : {}
26646
+ };
26647
+ }
26648
+
26605
26649
  // ../../packages/ycodium-acp-executor/src/executor/requests.ts
26606
26650
  function createExecutorRequests({
26607
26651
  emit,
@@ -26735,6 +26779,13 @@ function createExecutorRequests({
26735
26779
  return { outcome: { outcome: "selected", optionId } };
26736
26780
  }
26737
26781
  }
26782
+ const permissionContext = {
26783
+ request: params,
26784
+ permissionRequest,
26785
+ previousToolCall: tracked?.state
26786
+ };
26787
+ const statement = hooks.permissionStatement?.(permissionContext) ?? defaultPermissionStatement(permissionRequest);
26788
+ const fileChanges = hooks.permissionFileChanges?.(permissionContext) ?? fileChangesFromAcpPermission(permissionRequest);
26738
26789
  const requestId = randomId();
26739
26790
  const outcome = await new Promise((resolve4) => {
26740
26791
  const pending = {
@@ -26754,10 +26805,11 @@ function createExecutorRequests({
26754
26805
  turnId: shared.activeTurnId,
26755
26806
  requestId,
26756
26807
  permissionRequest,
26757
- detail: permissionRequest.detail,
26808
+ detail: statement.command ?? permissionRequest.detail,
26758
26809
  args: permissionRequest.toolCall?.data["rawInput"] ?? params.toolCall.rawInput,
26810
+ statement,
26759
26811
  options: acpApprovalOptions(params),
26760
- fileChanges: fileChangesFromAcpPermission(permissionRequest),
26812
+ fileChanges,
26761
26813
  source: "acp.jsonrpc",
26762
26814
  method: "session/request_permission",
26763
26815
  rawPayload: params
@@ -29500,8 +29552,8 @@ function acpRuntimeModeAutoApproves(runtimeMode, toolKind, toolName, nativeMode
29500
29552
  return false;
29501
29553
  }
29502
29554
  }
29503
- function acpSessionModeToApply(requestedNativeModeId, startedModeId) {
29504
- return requestedNativeModeId !== void 0 && requestedNativeModeId !== startedModeId ? requestedNativeModeId : void 0;
29555
+ function acpSessionModeToApply(requestedNativeModeId, startedModeId, isResuming) {
29556
+ return requestedNativeModeId !== void 0 && (isResuming || requestedNativeModeId !== startedModeId) ? requestedNativeModeId : void 0;
29505
29557
  }
29506
29558
 
29507
29559
  // src/subagents.ts
@@ -29632,6 +29684,31 @@ var kimiToolSubagents = {
29632
29684
  endNote: ({ background }) => background ? { description: BACKGROUND_ENDED_DESCRIPTION, timelineBypass: true } : { description: FOREGROUND_ENDED_DESCRIPTION }
29633
29685
  };
29634
29686
 
29687
+ // src/approvalStatement.ts
29688
+ var kimiPermissionStatement = ({
29689
+ request,
29690
+ permissionRequest,
29691
+ previousToolCall
29692
+ }) => {
29693
+ const statement = defaultPermissionStatement(permissionRequest);
29694
+ if (permissionRequest.kind !== "execute" || request.toolCall.rawInput !== void 0 || statement.command !== void 0)
29695
+ return statement;
29696
+ const texts = [permissionRequest.toolCall?.contentText, previousToolCall?.contentText];
29697
+ for (const text of texts) {
29698
+ if (!text) continue;
29699
+ let input2;
29700
+ try {
29701
+ input2 = JSON.parse(text);
29702
+ } catch {
29703
+ continue;
29704
+ }
29705
+ if (typeof input2 !== "object" || input2 === null || Array.isArray(input2)) continue;
29706
+ const command = input2["command"];
29707
+ if (typeof command === "string" && command.trim()) return { ...statement, command };
29708
+ }
29709
+ return statement;
29710
+ };
29711
+
29635
29712
  // src/kimiInstance.ts
29636
29713
  var RESUME_SCHEMA_VERSION = 1;
29637
29714
  var CLIENT_INFO = { name: "ycodium-agent-kimi", version: "0.1.0" };
@@ -29682,6 +29759,7 @@ function kimiHooks(recipe) {
29682
29759
  const homePath = resolveHomePath(recipe);
29683
29760
  return {
29684
29761
  permissionUserInput: kimiPermissionUserInput,
29762
+ permissionStatement: kimiPermissionStatement,
29685
29763
  toolSubagents: kimiToolSubagents,
29686
29764
  readContextWindow: ({ sessionId }) => readKimiContextWindow({ homePath, acpSessionId: sessionId })
29687
29765
  };
@@ -29792,6 +29870,11 @@ var createKimiInstance = (config2, host) => {
29792
29870
  throwIfStartAborted(signal);
29793
29871
  }
29794
29872
  const env = buildSpawnEnv(recipe, recipe.homePath);
29873
+ const toolTimeouts = (input2.mcpServers ?? []).flatMap(
29874
+ (server) => server.toolTimeoutSeconds === void 0 ? [] : [server.toolTimeoutSeconds]
29875
+ );
29876
+ if (toolTimeouts.length > 0)
29877
+ env.KIMI_MCP_TOOL_TIMEOUT_MS = String(Math.max(...toolTimeouts) * 1e3);
29795
29878
  const spawned = {
29796
29879
  program: recipe.binaryPath,
29797
29880
  args: tokenizeLaunchArgs(recipe.launchArgs),
@@ -29856,7 +29939,8 @@ var createKimiInstance = (config2, host) => {
29856
29939
  const started = await raceStartAbort(executor.start(), signal);
29857
29940
  const modeToApply = acpSessionModeToApply(
29858
29941
  input2.nativeModeId,
29859
- acpCurrentModeId(started.sessionSetupResult)
29942
+ acpCurrentModeId(started.sessionSetupResult),
29943
+ resume !== void 0
29860
29944
  );
29861
29945
  if (modeToApply !== void 0) {
29862
29946
  await raceStartAbort(executor.setNativeMode(modeToApply), signal);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/agent-kimi",
3
- "version": "0.2.4486",
3
+ "version": "0.2.5004",
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.4486",
24
+ "@ycodium-ai/plugin-api": "0.2.5004",
25
25
  "ycodium-executor-testing": "0.0.0",
26
- "ycodium-acp-executor": "0.2.0"
26
+ "ycodium-acp-executor": "0.2.5004"
27
27
  },
28
28
  "ycodium": {
29
29
  "plugin": "./dist/index.js",