@ycodium-ai/agent-kimi 0.2.3158 → 0.2.3180

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 +69 -4
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -27224,6 +27224,20 @@ function createAcpSessionRegistry(threads, stopBooked2) {
27224
27224
  return { requireThread, stopSession, stopAll };
27225
27225
  }
27226
27226
 
27227
+ // ../../packages/ycodium-acp-executor/src/sessionProcess.ts
27228
+ var fileName = (path) => path.slice(path.lastIndexOf("/") + 1);
27229
+ var withoutExe = (name) => name.replace(/\.exe$/, "");
27230
+ function acpNativeSessionProcessMatcher(program, args) {
27231
+ return (argv, platform) => {
27232
+ const normalize = (value) => platform === "win32" ? withoutExe(value.replaceAll("\\", "/").toLowerCase()) : value;
27233
+ const expected = normalize(program);
27234
+ const actual = normalize(argv[0] ?? "");
27235
+ const sameProgram = expected.includes("/") ? actual === expected : fileName(actual) === fileName(expected);
27236
+ const rest = argv.slice(1);
27237
+ return sameProgram && rest.length === args.length && rest.every((arg, i) => arg === args[i]);
27238
+ };
27239
+ }
27240
+
27227
27241
  // ../../packages/ycodium-acp-executor/src/prompt-dispatch.ts
27228
27242
  var dispatchAcpPrompt = (executor, input2) => {
27229
27243
  const { promise: dispatched, resolve: resolve3 } = Promise.withResolvers();
@@ -28139,6 +28153,44 @@ async function probeKimi(input2) {
28139
28153
  }
28140
28154
  }
28141
28155
 
28156
+ // src/openCommands.ts
28157
+ var basename = (path) => path.split(/[\\/]/).at(-1)?.toLowerCase() ?? "";
28158
+ var gitBashPath = (path) => path.replace(/^([A-Za-z]):[\\/]?/, (_match, drive) => `/${drive.toLowerCase()}/`).replaceAll("\\", "/").replace(/\/+$/, "");
28159
+ function kimiCommandMatcher(input2) {
28160
+ return (argv, platform) => {
28161
+ if (platform !== "win32" || input2.cwd.includes("'")) return false;
28162
+ return argv.length === 3 && basename(argv[0] ?? "") === "bash.exe" && argv[1] === "-c" && argv[2] === `cd '${gitBashPath(input2.cwd)}' && ${input2.command}`;
28163
+ };
28164
+ }
28165
+ var commandOf = (call) => {
28166
+ if (call.kind !== "execute") return void 0;
28167
+ const rawInput = call.rawInput;
28168
+ if (typeof rawInput !== "object" || rawInput === null) return void 0;
28169
+ const input2 = rawInput;
28170
+ if (input2["run_in_background"] === true) return void 0;
28171
+ const command = input2["command"];
28172
+ return typeof command === "string" && command.trim() !== "" ? command : void 0;
28173
+ };
28174
+ function kimiOpenCommands(session) {
28175
+ const commands = session.openToolCalls.flatMap((call) => {
28176
+ const command = commandOf(call);
28177
+ if (command === void 0) return [];
28178
+ return [
28179
+ {
28180
+ toolCallId: call.toolCallId,
28181
+ startedAtMs: call.startedAtMs,
28182
+ matches: kimiCommandMatcher({ command, cwd: session.cwd })
28183
+ }
28184
+ ];
28185
+ });
28186
+ if (commands.length === 0) return void 0;
28187
+ return {
28188
+ rootPid: session.rootPid,
28189
+ sessionProcess: acpNativeSessionProcessMatcher(session.program, session.args),
28190
+ commands
28191
+ };
28192
+ }
28193
+
28142
28194
  // src/runtimeModeApproval.ts
28143
28195
  function acpRuntimeModeAutoApproves(runtimeMode, toolKind) {
28144
28196
  switch (runtimeMode) {
@@ -28332,10 +28384,13 @@ var createKimiInstance = (config2, host) => {
28332
28384
  throwIfStartAborted(signal);
28333
28385
  }
28334
28386
  const env = buildSpawnEnv(recipe, recipe.homePath);
28335
- const handle = await host.process.spawn({
28387
+ const spawned = {
28336
28388
  program: recipe.binaryPath,
28337
28389
  args: tokenizeLaunchArgs(recipe.launchArgs),
28338
- cwd,
28390
+ cwd
28391
+ };
28392
+ const handle = await host.process.spawn({
28393
+ ...spawned,
28339
28394
  owner: { bindingId: host.bindingId },
28340
28395
  ...Object.keys(env).length > 0 ? { env } : {}
28341
28396
  });
@@ -28421,7 +28476,8 @@ var createKimiInstance = (config2, host) => {
28421
28476
  turns: [],
28422
28477
  executor,
28423
28478
  handle,
28424
- forwarding
28479
+ forwarding,
28480
+ spawned
28425
28481
  });
28426
28482
  host.log.info("session started", {
28427
28483
  threadId: input2.threadId,
@@ -28467,6 +28523,15 @@ var createKimiInstance = (config2, host) => {
28467
28523
  await booked.executor.cancel(turnId);
28468
28524
  await yieldTick();
28469
28525
  },
28526
+ openCommandProcesses: async (threadId) => {
28527
+ const booked = threads.get(threadId);
28528
+ if (booked === void 0) return void 0;
28529
+ return kimiOpenCommands({
28530
+ rootPid: booked.handle.pid,
28531
+ ...booked.spawned,
28532
+ openToolCalls: booked.executor.openToolCalls()
28533
+ });
28534
+ },
28470
28535
  respondToRequest: async (threadId, requestId, decision, reason) => {
28471
28536
  const booked = requireThread(threadId);
28472
28537
  await booked.executor.respondToRequest(
@@ -28544,7 +28609,7 @@ var executors = [
28544
28609
  ];
28545
28610
  var index_default = definePlugin({
28546
28611
  id: "agent-kimi",
28547
- apiVersion: 15,
28612
+ apiVersion: 16,
28548
28613
  executors,
28549
28614
  activate(ctx) {
28550
28615
  ctx.log.info("Kimi Code executor ready");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/agent-kimi",
3
- "version": "0.2.3158",
3
+ "version": "0.2.3180",
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.3158",
24
+ "@ycodium-ai/plugin-api": "0.2.3180",
25
25
  "ycodium-executor-testing": "0.0.0",
26
- "ycodium-acp-executor": "0.2.3158"
26
+ "ycodium-acp-executor": "0.2.3180"
27
27
  },
28
28
  "ycodium": {
29
29
  "plugin": "./dist/index.js",