@ycodium-ai/agent-kimi 0.2.4688 → 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.
Files changed (2) hide show
  1. package/dist/index.js +79 -4
  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 = 128;
11
+ var PLUGIN_API_VERSION = 142;
12
12
 
13
13
  // src/index.ts
14
14
  import * as NodeOS6 from "node:os";
@@ -1091,7 +1091,15 @@ function parsePermissionRequest(params, known) {
1091
1091
  { fallbackStatus: "pending" }
1092
1092
  );
1093
1093
  const kind = toolCall?.kind ?? "unknown";
1094
- 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;
1095
1103
  return {
1096
1104
  kind,
1097
1105
  ...detail ? { detail } : {},
@@ -1332,6 +1340,7 @@ function makeAcpRequestOpenedEvent(input2) {
1332
1340
  ...input2.detail ? { detail: input2.detail } : {},
1333
1341
  ...toolName ? { toolName } : {},
1334
1342
  args: input2.args,
1343
+ ...input2.statement !== void 0 ? { statement: input2.statement } : {},
1335
1344
  ...input2.options ? { options: input2.options } : {},
1336
1345
  ...input2.fileChanges ? { fileChanges: input2.fileChanges } : {},
1337
1346
  declineReasonRelay: "queued"
@@ -26605,6 +26614,38 @@ function createPromptResults({
26605
26614
  return { add, receive, reject, stop, complete, hasInterrupted, forget, wait, finishUnreceived };
26606
26615
  }
26607
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
+
26608
26649
  // ../../packages/ycodium-acp-executor/src/executor/requests.ts
26609
26650
  function createExecutorRequests({
26610
26651
  emit,
@@ -26738,6 +26779,13 @@ function createExecutorRequests({
26738
26779
  return { outcome: { outcome: "selected", optionId } };
26739
26780
  }
26740
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);
26741
26789
  const requestId = randomId();
26742
26790
  const outcome = await new Promise((resolve4) => {
26743
26791
  const pending = {
@@ -26757,10 +26805,11 @@ function createExecutorRequests({
26757
26805
  turnId: shared.activeTurnId,
26758
26806
  requestId,
26759
26807
  permissionRequest,
26760
- detail: permissionRequest.detail,
26808
+ detail: statement.command ?? permissionRequest.detail,
26761
26809
  args: permissionRequest.toolCall?.data["rawInput"] ?? params.toolCall.rawInput,
26810
+ statement,
26762
26811
  options: acpApprovalOptions(params),
26763
- fileChanges: fileChangesFromAcpPermission(permissionRequest),
26812
+ fileChanges,
26764
26813
  source: "acp.jsonrpc",
26765
26814
  method: "session/request_permission",
26766
26815
  rawPayload: params
@@ -29635,6 +29684,31 @@ var kimiToolSubagents = {
29635
29684
  endNote: ({ background }) => background ? { description: BACKGROUND_ENDED_DESCRIPTION, timelineBypass: true } : { description: FOREGROUND_ENDED_DESCRIPTION }
29636
29685
  };
29637
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
+
29638
29712
  // src/kimiInstance.ts
29639
29713
  var RESUME_SCHEMA_VERSION = 1;
29640
29714
  var CLIENT_INFO = { name: "ycodium-agent-kimi", version: "0.1.0" };
@@ -29685,6 +29759,7 @@ function kimiHooks(recipe) {
29685
29759
  const homePath = resolveHomePath(recipe);
29686
29760
  return {
29687
29761
  permissionUserInput: kimiPermissionUserInput,
29762
+ permissionStatement: kimiPermissionStatement,
29688
29763
  toolSubagents: kimiToolSubagents,
29689
29764
  readContextWindow: ({ sessionId }) => readKimiContextWindow({ homePath, acpSessionId: sessionId })
29690
29765
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/agent-kimi",
3
- "version": "0.2.4688",
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.5004",
24
25
  "ycodium-executor-testing": "0.0.0",
25
- "@ycodium-ai/plugin-api": "0.2.4688",
26
- "ycodium-acp-executor": "0.2.4688"
26
+ "ycodium-acp-executor": "0.2.5004"
27
27
  },
28
28
  "ycodium": {
29
29
  "plugin": "./dist/index.js",