@ycodium-ai/agent-kimi 0.2.5253 → 0.2.5271

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 +153 -153
  2. package/package.json +4 -4
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 = 156;
11
+ var PLUGIN_API_VERSION = 157;
12
12
 
13
13
  // src/index.ts
14
14
  import * as NodeOS7 from "node:os";
@@ -200,158 +200,6 @@ function approvalOutcomeForDecision(decision, optionId) {
200
200
  return decision !== "cancel" && optionId !== void 0 ? { outcome: "selected", optionId } : { outcome: "cancelled" };
201
201
  }
202
202
 
203
- // ../../packages/ycodium-executor-common/src/stderrTail.ts
204
- var REDACTION_MARKERS = ["[redacted]", "[pairing-url]"];
205
- function lastStderrTail(text, maxChars) {
206
- if (text.length <= maxChars) return text;
207
- let start = text.length - maxChars;
208
- if (text[start - 1] !== "\n") {
209
- const lineEnd = text.indexOf("\n", start);
210
- if (lineEnd !== -1 && lineEnd < text.length - 1) return text.slice(lineEnd + 1);
211
- const code = text.charCodeAt(start);
212
- if (code >= 56320 && code <= 57343) start += 1;
213
- for (const marker of REDACTION_MARKERS) {
214
- const at = text.lastIndexOf(marker, start);
215
- if (at !== -1 && at < start && start < at + marker.length) start = at + marker.length;
216
- }
217
- }
218
- return text.slice(start);
219
- }
220
-
221
- // ../../packages/ycodium-acp-executor/src/errors.ts
222
- var AcpExecutorError = class extends Error {
223
- code;
224
- constructor(code, message) {
225
- super(message);
226
- this.name = "AcpExecutorError";
227
- this.code = code;
228
- }
229
- };
230
- var AcpExecutorDisposedError = class extends AcpExecutorError {
231
- constructor(message = "ACP executor has been disposed") {
232
- super("disposed", message);
233
- this.name = "AcpExecutorDisposedError";
234
- }
235
- };
236
- var AcpExecutorTurnEndedError = class extends AcpExecutorError {
237
- constructor(message = "The target turn has ended. The message was not sent.") {
238
- super("provider-rejected", message);
239
- this.name = "AcpExecutorTurnEndedError";
240
- }
241
- };
242
- var AcpExecutorOptionRejectedError = class extends AcpExecutorError {
243
- constructor(option, value, cause) {
244
- const detail = acpErrorDetail(cause);
245
- super(
246
- "provider-rejected",
247
- `The agent rejected the ${option}${value === void 0 ? "" : ` "${value}"`}${detail === void 0 ? "" : ` (${detail})`}. This turn was not sent.`
248
- );
249
- this.name = "AcpExecutorOptionRejectedError";
250
- }
251
- };
252
- var AcpExecutorOptionTimeoutError = class extends AcpExecutorError {
253
- constructor(option, value) {
254
- super(
255
- "provider-rejected",
256
- `The agent did not answer the ${option} "${value}" change in time. This turn was not sent.`
257
- );
258
- this.name = "AcpExecutorOptionTimeoutError";
259
- }
260
- };
261
- var AcpOptionWriteStoppedError = class extends Error {
262
- constructor() {
263
- super("option write stopped");
264
- this.name = "AcpOptionWriteStoppedError";
265
- }
266
- };
267
- function acpErrorDetail(cause) {
268
- if (typeof cause !== "object" || cause === null) return void 0;
269
- const message = cause.message;
270
- const data = cause.data;
271
- const parts = [message, data].filter(
272
- (part) => typeof part === "string" && part.trim().length > 0
273
- );
274
- return parts.length === 0 ? void 0 : parts.join(": ");
275
- }
276
- var AcpExecutorNotStartedError = class extends AcpExecutorError {
277
- constructor(message = "ACP session has not been started") {
278
- super("not-started", message);
279
- this.name = "AcpExecutorNotStartedError";
280
- }
281
- };
282
- var AcpExecutorCancelTimeoutError = class extends AcpExecutorError {
283
- constructor(message = "Timed out waiting for session/prompt to finish after cancellation") {
284
- super("cancel-timeout", message);
285
- this.name = "AcpExecutorCancelTimeoutError";
286
- }
287
- };
288
- var AcpExecutorRequestError = class extends AcpExecutorError {
289
- method;
290
- constructor(method, message) {
291
- super("request-failed", message);
292
- this.name = "AcpExecutorRequestError";
293
- this.method = method;
294
- }
295
- };
296
- var AcpConnectionClosedError = class extends Error {
297
- reason;
298
- constructor(message = "ACP connection closed", options) {
299
- super(message, options?.cause === void 0 ? void 0 : { cause: options.cause });
300
- this.name = "AcpConnectionClosedError";
301
- this.reason = options?.reason ?? "closed";
302
- }
303
- };
304
- async function withStartupStderr(error62, stderrTail) {
305
- if (!(error62 instanceof AcpConnectionClosedError) || stderrTail === void 0) return error62;
306
- const tail = await stderrTail();
307
- if (tail.length === 0) return error62;
308
- return new AcpConnectionClosedError(`${error62.message}
309
- Agent stderr (last lines):
310
- ${tail}`, {
311
- cause: error62,
312
- reason: error62.reason
313
- });
314
- }
315
- var AGENT_EXIT_STDERR_MAX_CHARS = 800;
316
- var AGENT_EXIT_SETTLE_MS = 500;
317
- var AcpAgentExitedError = class extends AcpConnectionClosedError {
318
- exitCode;
319
- constructor(message, exitCode, cause) {
320
- super(message, { cause, reason: "input-ended" });
321
- this.name = "AcpAgentExitedError";
322
- this.exitCode = exitCode;
323
- }
324
- };
325
- var settledExitCode = async (exited) => {
326
- if (exited === void 0) return void 0;
327
- let timer;
328
- try {
329
- return await Promise.race([
330
- exited.catch(() => void 0),
331
- new Promise((resolve4) => {
332
- timer = setTimeout(() => resolve4(void 0), AGENT_EXIT_SETTLE_MS);
333
- })
334
- ]);
335
- } finally {
336
- clearTimeout(timer);
337
- }
338
- };
339
- async function describeAgentExit(input2) {
340
- const [exitCode, tail] = await Promise.all([
341
- settledExitCode(input2.exited),
342
- input2.stderrTail === void 0 ? "" : Promise.resolve().then(input2.stderrTail).catch(() => "")
343
- ]);
344
- const head = exitCode === void 0 ? "The agent closed its connection." : exitCode === null ? "The agent process exited without an exit code." : `The agent process exited with code ${exitCode}.`;
345
- const excerpt = lastStderrTail(tail.trim(), AGENT_EXIT_STDERR_MAX_CHARS);
346
- return new AcpAgentExitedError(
347
- excerpt.length === 0 ? head : `${head}
348
- Agent stderr (last lines):
349
- ${excerpt}`,
350
- exitCode,
351
- input2.cause
352
- );
353
- }
354
-
355
203
  // ../../packages/ycodium-acp-executor/src/event-stream.ts
356
204
  var UnboundedEventStream = class {
357
205
  subscribers = /* @__PURE__ */ new Set();
@@ -506,6 +354,158 @@ function findAcpEffortConfig(configOptions) {
506
354
  };
507
355
  }
508
356
 
357
+ // ../../packages/ycodium-executor-common/src/stderrTail.ts
358
+ var REDACTION_MARKERS = ["[redacted]", "[pairing-url]"];
359
+ function lastStderrTail(text, maxChars) {
360
+ if (text.length <= maxChars) return text;
361
+ let start = text.length - maxChars;
362
+ if (text[start - 1] !== "\n") {
363
+ const lineEnd = text.indexOf("\n", start);
364
+ if (lineEnd !== -1 && lineEnd < text.length - 1) return text.slice(lineEnd + 1);
365
+ const code = text.charCodeAt(start);
366
+ if (code >= 56320 && code <= 57343) start += 1;
367
+ for (const marker of REDACTION_MARKERS) {
368
+ const at = text.lastIndexOf(marker, start);
369
+ if (at !== -1 && at < start && start < at + marker.length) start = at + marker.length;
370
+ }
371
+ }
372
+ return text.slice(start);
373
+ }
374
+
375
+ // ../../packages/ycodium-acp-executor/src/errors.ts
376
+ var AcpExecutorError = class extends Error {
377
+ code;
378
+ constructor(code, message) {
379
+ super(message);
380
+ this.name = "AcpExecutorError";
381
+ this.code = code;
382
+ }
383
+ };
384
+ var AcpExecutorDisposedError = class extends AcpExecutorError {
385
+ constructor(message = "ACP executor has been disposed") {
386
+ super("disposed", message);
387
+ this.name = "AcpExecutorDisposedError";
388
+ }
389
+ };
390
+ var AcpExecutorTurnEndedError = class extends AcpExecutorError {
391
+ constructor(message = "The target turn has ended. The message was not sent.") {
392
+ super("provider-rejected", message);
393
+ this.name = "AcpExecutorTurnEndedError";
394
+ }
395
+ };
396
+ var AcpExecutorOptionRejectedError = class extends AcpExecutorError {
397
+ constructor(option, value, cause) {
398
+ const detail = acpErrorDetail(cause);
399
+ super(
400
+ "provider-rejected",
401
+ `The agent rejected the ${option}${value === void 0 ? "" : ` "${value}"`}${detail === void 0 ? "" : ` (${detail})`}. This turn was not sent.`
402
+ );
403
+ this.name = "AcpExecutorOptionRejectedError";
404
+ }
405
+ };
406
+ var AcpExecutorOptionTimeoutError = class extends AcpExecutorError {
407
+ constructor(option, value) {
408
+ super(
409
+ "provider-rejected",
410
+ `The agent did not answer the ${option} "${value}" change in time. This turn was not sent.`
411
+ );
412
+ this.name = "AcpExecutorOptionTimeoutError";
413
+ }
414
+ };
415
+ var AcpOptionWriteStoppedError = class extends Error {
416
+ constructor() {
417
+ super("option write stopped");
418
+ this.name = "AcpOptionWriteStoppedError";
419
+ }
420
+ };
421
+ function acpErrorDetail(cause) {
422
+ if (typeof cause !== "object" || cause === null) return void 0;
423
+ const message = cause.message;
424
+ const data = cause.data;
425
+ const parts = [message, data].filter(
426
+ (part) => typeof part === "string" && part.trim().length > 0
427
+ );
428
+ return parts.length === 0 ? void 0 : parts.join(": ");
429
+ }
430
+ var AcpExecutorNotStartedError = class extends AcpExecutorError {
431
+ constructor(message = "ACP session has not been started") {
432
+ super("not-started", message);
433
+ this.name = "AcpExecutorNotStartedError";
434
+ }
435
+ };
436
+ var AcpExecutorCancelTimeoutError = class extends AcpExecutorError {
437
+ constructor(message = "Timed out waiting for session/prompt to finish after cancellation") {
438
+ super("cancel-timeout", message);
439
+ this.name = "AcpExecutorCancelTimeoutError";
440
+ }
441
+ };
442
+ var AcpExecutorRequestError = class extends AcpExecutorError {
443
+ method;
444
+ constructor(method, message) {
445
+ super("request-failed", message);
446
+ this.name = "AcpExecutorRequestError";
447
+ this.method = method;
448
+ }
449
+ };
450
+ var AcpConnectionClosedError = class extends Error {
451
+ reason;
452
+ constructor(message = "ACP connection closed", options) {
453
+ super(message, options?.cause === void 0 ? void 0 : { cause: options.cause });
454
+ this.name = "AcpConnectionClosedError";
455
+ this.reason = options?.reason ?? "closed";
456
+ }
457
+ };
458
+ async function withStartupStderr(error62, stderrTail) {
459
+ if (!(error62 instanceof AcpConnectionClosedError) || stderrTail === void 0) return error62;
460
+ const tail = await stderrTail();
461
+ if (tail.length === 0) return error62;
462
+ return new AcpConnectionClosedError(`${error62.message}
463
+ Agent stderr (last lines):
464
+ ${tail}`, {
465
+ cause: error62,
466
+ reason: error62.reason
467
+ });
468
+ }
469
+ var AGENT_EXIT_STDERR_MAX_CHARS = 800;
470
+ var AGENT_EXIT_SETTLE_MS = 500;
471
+ var AcpAgentExitedError = class extends AcpConnectionClosedError {
472
+ exitCode;
473
+ constructor(message, exitCode, cause) {
474
+ super(message, { cause, reason: "input-ended" });
475
+ this.name = "AcpAgentExitedError";
476
+ this.exitCode = exitCode;
477
+ }
478
+ };
479
+ var settledExitCode = async (exited) => {
480
+ if (exited === void 0) return void 0;
481
+ let timer;
482
+ try {
483
+ return await Promise.race([
484
+ exited.catch(() => void 0),
485
+ new Promise((resolve4) => {
486
+ timer = setTimeout(() => resolve4(void 0), AGENT_EXIT_SETTLE_MS);
487
+ })
488
+ ]);
489
+ } finally {
490
+ clearTimeout(timer);
491
+ }
492
+ };
493
+ async function describeAgentExit(input2) {
494
+ const [exitCode, tail] = await Promise.all([
495
+ settledExitCode(input2.exited),
496
+ input2.stderrTail === void 0 ? "" : Promise.resolve().then(input2.stderrTail).catch(() => "")
497
+ ]);
498
+ const head = exitCode === void 0 ? "The agent closed its connection." : exitCode === null ? "The agent process exited without an exit code." : `The agent process exited with code ${exitCode}.`;
499
+ const excerpt = lastStderrTail(tail.trim(), AGENT_EXIT_STDERR_MAX_CHARS);
500
+ return new AcpAgentExitedError(
501
+ excerpt.length === 0 ? head : `${head}
502
+ Agent stderr (last lines):
503
+ ${excerpt}`,
504
+ exitCode,
505
+ input2.cause
506
+ );
507
+ }
508
+
509
509
  // ../../packages/ycodium-acp-executor/src/util.ts
510
510
  function isRecord2(value) {
511
511
  return typeof value === "object" && value !== null && !Array.isArray(value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/agent-kimi",
3
- "version": "0.2.5253",
3
+ "version": "0.2.5271",
4
4
  "description": "Kimi Code executor: runs `kimi acp` over Agent Client Protocol stdio.",
5
5
  "keywords": [
6
6
  "ycodium",
@@ -21,11 +21,11 @@
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.5253",
24
+ "@ycodium-ai/plugin-api": "0.2.0",
25
25
  "ycodium-credential-account": "0.0.0",
26
- "ycodium-acp-executor": "0.2.5253",
27
26
  "ycodium-executor-testing": "0.0.0",
28
- "ycodium-instance-config": "0.0.0"
27
+ "ycodium-instance-config": "0.0.0",
28
+ "ycodium-acp-executor": "0.2.5271"
29
29
  },
30
30
  "ycodium": {
31
31
  "plugin": "./dist/index.js",