@ycodium-ai/agent-grok 0.2.5265 → 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 +152 -152
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -413,158 +413,6 @@ function approvalOutcomeForDecision(decision, optionId) {
413
413
  return decision !== "cancel" && optionId !== void 0 ? { outcome: "selected", optionId } : { outcome: "cancelled" };
414
414
  }
415
415
 
416
- // ../../packages/ycodium-executor-common/src/stderrTail.ts
417
- var REDACTION_MARKERS = ["[redacted]", "[pairing-url]"];
418
- function lastStderrTail(text4, maxChars) {
419
- if (text4.length <= maxChars) return text4;
420
- let start = text4.length - maxChars;
421
- if (text4[start - 1] !== "\n") {
422
- const lineEnd = text4.indexOf("\n", start);
423
- if (lineEnd !== -1 && lineEnd < text4.length - 1) return text4.slice(lineEnd + 1);
424
- const code = text4.charCodeAt(start);
425
- if (code >= 56320 && code <= 57343) start += 1;
426
- for (const marker of REDACTION_MARKERS) {
427
- const at = text4.lastIndexOf(marker, start);
428
- if (at !== -1 && at < start && start < at + marker.length) start = at + marker.length;
429
- }
430
- }
431
- return text4.slice(start);
432
- }
433
-
434
- // ../../packages/ycodium-acp-executor/src/errors.ts
435
- var AcpExecutorError = class extends Error {
436
- code;
437
- constructor(code, message) {
438
- super(message);
439
- this.name = "AcpExecutorError";
440
- this.code = code;
441
- }
442
- };
443
- var AcpExecutorDisposedError = class extends AcpExecutorError {
444
- constructor(message = "ACP executor has been disposed") {
445
- super("disposed", message);
446
- this.name = "AcpExecutorDisposedError";
447
- }
448
- };
449
- var AcpExecutorTurnEndedError = class extends AcpExecutorError {
450
- constructor(message = "The target turn has ended. The message was not sent.") {
451
- super("provider-rejected", message);
452
- this.name = "AcpExecutorTurnEndedError";
453
- }
454
- };
455
- var AcpExecutorOptionRejectedError = class extends AcpExecutorError {
456
- constructor(option, value, cause) {
457
- const detail = acpErrorDetail(cause);
458
- super(
459
- "provider-rejected",
460
- `The agent rejected the ${option}${value === void 0 ? "" : ` "${value}"`}${detail === void 0 ? "" : ` (${detail})`}. This turn was not sent.`
461
- );
462
- this.name = "AcpExecutorOptionRejectedError";
463
- }
464
- };
465
- var AcpExecutorOptionTimeoutError = class extends AcpExecutorError {
466
- constructor(option, value) {
467
- super(
468
- "provider-rejected",
469
- `The agent did not answer the ${option} "${value}" change in time. This turn was not sent.`
470
- );
471
- this.name = "AcpExecutorOptionTimeoutError";
472
- }
473
- };
474
- var AcpOptionWriteStoppedError = class extends Error {
475
- constructor() {
476
- super("option write stopped");
477
- this.name = "AcpOptionWriteStoppedError";
478
- }
479
- };
480
- function acpErrorDetail(cause) {
481
- if (typeof cause !== "object" || cause === null) return void 0;
482
- const message = cause.message;
483
- const data = cause.data;
484
- const parts = [message, data].filter(
485
- (part) => typeof part === "string" && part.trim().length > 0
486
- );
487
- return parts.length === 0 ? void 0 : parts.join(": ");
488
- }
489
- var AcpExecutorNotStartedError = class extends AcpExecutorError {
490
- constructor(message = "ACP session has not been started") {
491
- super("not-started", message);
492
- this.name = "AcpExecutorNotStartedError";
493
- }
494
- };
495
- var AcpExecutorCancelTimeoutError = class extends AcpExecutorError {
496
- constructor(message = "Timed out waiting for session/prompt to finish after cancellation") {
497
- super("cancel-timeout", message);
498
- this.name = "AcpExecutorCancelTimeoutError";
499
- }
500
- };
501
- var AcpExecutorRequestError = class extends AcpExecutorError {
502
- method;
503
- constructor(method, message) {
504
- super("request-failed", message);
505
- this.name = "AcpExecutorRequestError";
506
- this.method = method;
507
- }
508
- };
509
- var AcpConnectionClosedError = class extends Error {
510
- reason;
511
- constructor(message = "ACP connection closed", options) {
512
- super(message, options?.cause === void 0 ? void 0 : { cause: options.cause });
513
- this.name = "AcpConnectionClosedError";
514
- this.reason = options?.reason ?? "closed";
515
- }
516
- };
517
- async function withStartupStderr(error62, stderrTail) {
518
- if (!(error62 instanceof AcpConnectionClosedError) || stderrTail === void 0) return error62;
519
- const tail = await stderrTail();
520
- if (tail.length === 0) return error62;
521
- return new AcpConnectionClosedError(`${error62.message}
522
- Agent stderr (last lines):
523
- ${tail}`, {
524
- cause: error62,
525
- reason: error62.reason
526
- });
527
- }
528
- var AGENT_EXIT_STDERR_MAX_CHARS = 800;
529
- var AGENT_EXIT_SETTLE_MS = 500;
530
- var AcpAgentExitedError = class extends AcpConnectionClosedError {
531
- exitCode;
532
- constructor(message, exitCode, cause) {
533
- super(message, { cause, reason: "input-ended" });
534
- this.name = "AcpAgentExitedError";
535
- this.exitCode = exitCode;
536
- }
537
- };
538
- var settledExitCode = async (exited) => {
539
- if (exited === void 0) return void 0;
540
- let timer;
541
- try {
542
- return await Promise.race([
543
- exited.catch(() => void 0),
544
- new Promise((resolve3) => {
545
- timer = setTimeout(() => resolve3(void 0), AGENT_EXIT_SETTLE_MS);
546
- })
547
- ]);
548
- } finally {
549
- clearTimeout(timer);
550
- }
551
- };
552
- async function describeAgentExit(input2) {
553
- const [exitCode, tail] = await Promise.all([
554
- settledExitCode(input2.exited),
555
- input2.stderrTail === void 0 ? "" : Promise.resolve().then(input2.stderrTail).catch(() => "")
556
- ]);
557
- 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}.`;
558
- const excerpt = lastStderrTail(tail.trim(), AGENT_EXIT_STDERR_MAX_CHARS);
559
- return new AcpAgentExitedError(
560
- excerpt.length === 0 ? head : `${head}
561
- Agent stderr (last lines):
562
- ${excerpt}`,
563
- exitCode,
564
- input2.cause
565
- );
566
- }
567
-
568
416
  // ../../packages/ycodium-acp-executor/src/event-stream.ts
569
417
  var UnboundedEventStream = class {
570
418
  subscribers = /* @__PURE__ */ new Set();
@@ -719,6 +567,158 @@ function findAcpEffortConfig(configOptions) {
719
567
  };
720
568
  }
721
569
 
570
+ // ../../packages/ycodium-executor-common/src/stderrTail.ts
571
+ var REDACTION_MARKERS = ["[redacted]", "[pairing-url]"];
572
+ function lastStderrTail(text4, maxChars) {
573
+ if (text4.length <= maxChars) return text4;
574
+ let start = text4.length - maxChars;
575
+ if (text4[start - 1] !== "\n") {
576
+ const lineEnd = text4.indexOf("\n", start);
577
+ if (lineEnd !== -1 && lineEnd < text4.length - 1) return text4.slice(lineEnd + 1);
578
+ const code = text4.charCodeAt(start);
579
+ if (code >= 56320 && code <= 57343) start += 1;
580
+ for (const marker of REDACTION_MARKERS) {
581
+ const at = text4.lastIndexOf(marker, start);
582
+ if (at !== -1 && at < start && start < at + marker.length) start = at + marker.length;
583
+ }
584
+ }
585
+ return text4.slice(start);
586
+ }
587
+
588
+ // ../../packages/ycodium-acp-executor/src/errors.ts
589
+ var AcpExecutorError = class extends Error {
590
+ code;
591
+ constructor(code, message) {
592
+ super(message);
593
+ this.name = "AcpExecutorError";
594
+ this.code = code;
595
+ }
596
+ };
597
+ var AcpExecutorDisposedError = class extends AcpExecutorError {
598
+ constructor(message = "ACP executor has been disposed") {
599
+ super("disposed", message);
600
+ this.name = "AcpExecutorDisposedError";
601
+ }
602
+ };
603
+ var AcpExecutorTurnEndedError = class extends AcpExecutorError {
604
+ constructor(message = "The target turn has ended. The message was not sent.") {
605
+ super("provider-rejected", message);
606
+ this.name = "AcpExecutorTurnEndedError";
607
+ }
608
+ };
609
+ var AcpExecutorOptionRejectedError = class extends AcpExecutorError {
610
+ constructor(option, value, cause) {
611
+ const detail = acpErrorDetail(cause);
612
+ super(
613
+ "provider-rejected",
614
+ `The agent rejected the ${option}${value === void 0 ? "" : ` "${value}"`}${detail === void 0 ? "" : ` (${detail})`}. This turn was not sent.`
615
+ );
616
+ this.name = "AcpExecutorOptionRejectedError";
617
+ }
618
+ };
619
+ var AcpExecutorOptionTimeoutError = class extends AcpExecutorError {
620
+ constructor(option, value) {
621
+ super(
622
+ "provider-rejected",
623
+ `The agent did not answer the ${option} "${value}" change in time. This turn was not sent.`
624
+ );
625
+ this.name = "AcpExecutorOptionTimeoutError";
626
+ }
627
+ };
628
+ var AcpOptionWriteStoppedError = class extends Error {
629
+ constructor() {
630
+ super("option write stopped");
631
+ this.name = "AcpOptionWriteStoppedError";
632
+ }
633
+ };
634
+ function acpErrorDetail(cause) {
635
+ if (typeof cause !== "object" || cause === null) return void 0;
636
+ const message = cause.message;
637
+ const data = cause.data;
638
+ const parts = [message, data].filter(
639
+ (part) => typeof part === "string" && part.trim().length > 0
640
+ );
641
+ return parts.length === 0 ? void 0 : parts.join(": ");
642
+ }
643
+ var AcpExecutorNotStartedError = class extends AcpExecutorError {
644
+ constructor(message = "ACP session has not been started") {
645
+ super("not-started", message);
646
+ this.name = "AcpExecutorNotStartedError";
647
+ }
648
+ };
649
+ var AcpExecutorCancelTimeoutError = class extends AcpExecutorError {
650
+ constructor(message = "Timed out waiting for session/prompt to finish after cancellation") {
651
+ super("cancel-timeout", message);
652
+ this.name = "AcpExecutorCancelTimeoutError";
653
+ }
654
+ };
655
+ var AcpExecutorRequestError = class extends AcpExecutorError {
656
+ method;
657
+ constructor(method, message) {
658
+ super("request-failed", message);
659
+ this.name = "AcpExecutorRequestError";
660
+ this.method = method;
661
+ }
662
+ };
663
+ var AcpConnectionClosedError = class extends Error {
664
+ reason;
665
+ constructor(message = "ACP connection closed", options) {
666
+ super(message, options?.cause === void 0 ? void 0 : { cause: options.cause });
667
+ this.name = "AcpConnectionClosedError";
668
+ this.reason = options?.reason ?? "closed";
669
+ }
670
+ };
671
+ async function withStartupStderr(error62, stderrTail) {
672
+ if (!(error62 instanceof AcpConnectionClosedError) || stderrTail === void 0) return error62;
673
+ const tail = await stderrTail();
674
+ if (tail.length === 0) return error62;
675
+ return new AcpConnectionClosedError(`${error62.message}
676
+ Agent stderr (last lines):
677
+ ${tail}`, {
678
+ cause: error62,
679
+ reason: error62.reason
680
+ });
681
+ }
682
+ var AGENT_EXIT_STDERR_MAX_CHARS = 800;
683
+ var AGENT_EXIT_SETTLE_MS = 500;
684
+ var AcpAgentExitedError = class extends AcpConnectionClosedError {
685
+ exitCode;
686
+ constructor(message, exitCode, cause) {
687
+ super(message, { cause, reason: "input-ended" });
688
+ this.name = "AcpAgentExitedError";
689
+ this.exitCode = exitCode;
690
+ }
691
+ };
692
+ var settledExitCode = async (exited) => {
693
+ if (exited === void 0) return void 0;
694
+ let timer;
695
+ try {
696
+ return await Promise.race([
697
+ exited.catch(() => void 0),
698
+ new Promise((resolve3) => {
699
+ timer = setTimeout(() => resolve3(void 0), AGENT_EXIT_SETTLE_MS);
700
+ })
701
+ ]);
702
+ } finally {
703
+ clearTimeout(timer);
704
+ }
705
+ };
706
+ async function describeAgentExit(input2) {
707
+ const [exitCode, tail] = await Promise.all([
708
+ settledExitCode(input2.exited),
709
+ input2.stderrTail === void 0 ? "" : Promise.resolve().then(input2.stderrTail).catch(() => "")
710
+ ]);
711
+ 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}.`;
712
+ const excerpt = lastStderrTail(tail.trim(), AGENT_EXIT_STDERR_MAX_CHARS);
713
+ return new AcpAgentExitedError(
714
+ excerpt.length === 0 ? head : `${head}
715
+ Agent stderr (last lines):
716
+ ${excerpt}`,
717
+ exitCode,
718
+ input2.cause
719
+ );
720
+ }
721
+
722
722
  // ../../packages/ycodium-acp-executor/src/util.ts
723
723
  function isRecord3(value) {
724
724
  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-grok",
3
- "version": "0.2.5265",
3
+ "version": "0.2.5271",
4
4
  "description": "Grok executor: grok CLI 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.5265",
25
- "ycodium-acp-executor": "0.2.0",
26
- "ycodium-credential-account": "0.0.0",
24
+ "@ycodium-ai/plugin-api": "0.2.0",
27
25
  "ycodium-executor-testing": "0.0.0",
28
- "ycodium-instance-config": "0.0.0"
26
+ "ycodium-credential-account": "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",