nexus-agents 2.71.0 → 2.72.1

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 (125) hide show
  1. package/dist/{adaptive-memory-MKSYEBST.js → adaptive-memory-UPE76IP6.js} +5 -5
  2. package/dist/{chunk-DWLATKBK.js → child-mcp-config-5HRJGLCR.js} +6 -4
  3. package/dist/child-mcp-config-5HRJGLCR.js.map +1 -0
  4. package/dist/{chunk-ZPPX2K57.js → chunk-2KB63QGE.js} +2 -2
  5. package/dist/{chunk-L2LQ3TSV.js → chunk-2MD5MWCK.js} +2 -2
  6. package/dist/{chunk-ANC3HU6F.js → chunk-345KMHWH.js} +6 -6
  7. package/dist/chunk-345KMHWH.js.map +1 -0
  8. package/dist/{chunk-NER7H3RJ.js → chunk-3FIDMWFC.js} +2 -2
  9. package/dist/{chunk-POQQ7A5E.js → chunk-53K3KEKT.js} +51 -707
  10. package/dist/chunk-53K3KEKT.js.map +1 -0
  11. package/dist/chunk-5MHIWRKB.js +691 -0
  12. package/dist/chunk-5MHIWRKB.js.map +1 -0
  13. package/dist/{chunk-VGZJIR22.js → chunk-5WQ3SRSE.js} +2 -2
  14. package/dist/{chunk-TOYPY5XA.js → chunk-A35XORXU.js} +73 -10
  15. package/dist/chunk-A35XORXU.js.map +1 -0
  16. package/dist/chunk-BVETPIOQ.js +556 -0
  17. package/dist/chunk-BVETPIOQ.js.map +1 -0
  18. package/dist/{chunk-7LHQBMBM.js → chunk-C3JGKBL2.js} +25 -12
  19. package/dist/{chunk-7LHQBMBM.js.map → chunk-C3JGKBL2.js.map} +1 -1
  20. package/dist/{chunk-OF7CYMMA.js → chunk-DA5UDQYW.js} +2 -2
  21. package/dist/{chunk-XATH462F.js → chunk-ES6GFP35.js} +186 -34
  22. package/dist/chunk-ES6GFP35.js.map +1 -0
  23. package/dist/chunk-GOT7OAL5.js +59 -0
  24. package/dist/chunk-GOT7OAL5.js.map +1 -0
  25. package/dist/{chunk-LJT65EA7.js → chunk-I7ORMAO7.js} +2 -2
  26. package/dist/{chunk-AGVLFRN7.js → chunk-J4VR2WNI.js} +2998 -7188
  27. package/dist/chunk-J4VR2WNI.js.map +1 -0
  28. package/dist/{chunk-LMRKHQG5.js → chunk-L6N2S3UB.js} +2 -2
  29. package/dist/{chunk-7OBFO4GF.js → chunk-O4KUCF5S.js} +125 -40
  30. package/dist/chunk-O4KUCF5S.js.map +1 -0
  31. package/dist/chunk-P5OFZWDW.js +303 -0
  32. package/dist/chunk-P5OFZWDW.js.map +1 -0
  33. package/dist/{chunk-MJHOSM5U.js → chunk-QECRZ3YA.js} +2 -2
  34. package/dist/{chunk-WYSHXPKK.js → chunk-QL4HCYRD.js} +4 -44
  35. package/dist/chunk-QL4HCYRD.js.map +1 -0
  36. package/dist/{chunk-E66KFRSJ.js → chunk-TF3GROMO.js} +2 -2
  37. package/dist/{chunk-U3HZQTUF.js → chunk-TQFRPFMG.js} +2 -2
  38. package/dist/{chunk-KJCSRP34.js → chunk-V7ATY4BG.js} +3 -3
  39. package/dist/{chunk-32RIOULO.js → chunk-VPC3YNFR.js} +2 -2
  40. package/dist/{chunk-3BKVYSY6.js → chunk-VTVKC4FS.js} +4 -4
  41. package/dist/{chunk-U6BK5DQU.js → chunk-YOREAPF6.js} +315 -31
  42. package/dist/chunk-YOREAPF6.js.map +1 -0
  43. package/dist/cli-circuit-breaker-GFF2RLBZ.js +14 -0
  44. package/dist/cli.d.ts +3 -1
  45. package/dist/cli.js +1038 -1581
  46. package/dist/cli.js.map +1 -1
  47. package/dist/{composite-router-AYVJPIOS.js → composite-router-33F3F74I.js} +4 -4
  48. package/dist/{consensus-vote-EXWACBMR.js → consensus-vote-5V4KVHBE.js} +12 -11
  49. package/dist/doctor-deep-AHDTNURD.js +13 -0
  50. package/dist/expert-bridge-DMDHHDEU.js +11 -0
  51. package/dist/factory-FVD7PZ6S.js +15 -0
  52. package/dist/{factory-KMBWFIX2.js → factory-VQS3HJ7V.js} +6 -6
  53. package/dist/index.d.ts +997 -3517
  54. package/dist/index.js +74 -807
  55. package/dist/index.js.map +1 -1
  56. package/dist/init-opencode-EIOIPVWL.js +158 -0
  57. package/dist/init-opencode-EIOIPVWL.js.map +1 -0
  58. package/dist/issue-triage-HJUJWGAD.js +16 -0
  59. package/dist/{learning-persistence-FILWP3IR.js → learning-persistence-N6ILD2HX.js} +3 -3
  60. package/dist/{mobimem-77W5ED4Z.js → mobimem-BOJFXQ7B.js} +4 -4
  61. package/dist/{nexus-data-dir-M6DYKIHJ.js → nexus-data-dir-77UO7N6J.js} +2 -2
  62. package/dist/{registry-command-BBLIXULQ.js → registry-command-NCWUJKAF.js} +4 -4
  63. package/dist/{repo-security-plan-7SNM7JQN.js → repo-security-plan-3J45VAD6.js} +5 -5
  64. package/dist/research-helpers-synthesize-UGQHZZJN.js +12 -0
  65. package/dist/{routing-memory-DCIZEEVC.js → routing-memory-NO7QEH7T.js} +4 -4
  66. package/dist/{session-memory-5TSAASQW.js → session-memory-DOXLEWEU.js} +5 -5
  67. package/dist/{setup-command-5VGIQETA.js → setup-command-BWUFMZ7U.js} +10 -10
  68. package/dist/setup-config-E3JZYSLR.js +11 -0
  69. package/dist/{setup-custom-api-IQX3GD2D.js → setup-custom-api-DHJ5DRH2.js} +6 -6
  70. package/dist/{weather-report-NETGWTJX.js → weather-report-FNN4OX3N.js} +4 -4
  71. package/package.json +1 -1
  72. package/dist/chunk-7OBFO4GF.js.map +0 -1
  73. package/dist/chunk-AGVLFRN7.js.map +0 -1
  74. package/dist/chunk-ANC3HU6F.js.map +0 -1
  75. package/dist/chunk-DWLATKBK.js.map +0 -1
  76. package/dist/chunk-FDNWRZNJ.js +0 -22
  77. package/dist/chunk-FDNWRZNJ.js.map +0 -1
  78. package/dist/chunk-POQQ7A5E.js.map +0 -1
  79. package/dist/chunk-TOYPY5XA.js.map +0 -1
  80. package/dist/chunk-U6BK5DQU.js.map +0 -1
  81. package/dist/chunk-WYSHXPKK.js.map +0 -1
  82. package/dist/chunk-XATH462F.js.map +0 -1
  83. package/dist/cli-circuit-breaker-2CJ6NV52.js +0 -14
  84. package/dist/doctor-deep-BJFDBGPO.js +0 -13
  85. package/dist/expert-bridge-75WNNWI4.js +0 -11
  86. package/dist/factory-H5BYL4V5.js +0 -15
  87. package/dist/issue-triage-4SEP4WID.js +0 -16
  88. package/dist/mcp-config-OCWIXE2Y.js +0 -13
  89. package/dist/research-helpers-synthesize-7CI2FJE5.js +0 -12
  90. package/dist/setup-config-EA5RDIO2.js +0 -11
  91. package/dist/weather-report-NETGWTJX.js.map +0 -1
  92. /package/dist/{adaptive-memory-MKSYEBST.js.map → adaptive-memory-UPE76IP6.js.map} +0 -0
  93. /package/dist/{chunk-ZPPX2K57.js.map → chunk-2KB63QGE.js.map} +0 -0
  94. /package/dist/{chunk-L2LQ3TSV.js.map → chunk-2MD5MWCK.js.map} +0 -0
  95. /package/dist/{chunk-NER7H3RJ.js.map → chunk-3FIDMWFC.js.map} +0 -0
  96. /package/dist/{chunk-VGZJIR22.js.map → chunk-5WQ3SRSE.js.map} +0 -0
  97. /package/dist/{chunk-OF7CYMMA.js.map → chunk-DA5UDQYW.js.map} +0 -0
  98. /package/dist/{chunk-LJT65EA7.js.map → chunk-I7ORMAO7.js.map} +0 -0
  99. /package/dist/{chunk-LMRKHQG5.js.map → chunk-L6N2S3UB.js.map} +0 -0
  100. /package/dist/{chunk-MJHOSM5U.js.map → chunk-QECRZ3YA.js.map} +0 -0
  101. /package/dist/{chunk-E66KFRSJ.js.map → chunk-TF3GROMO.js.map} +0 -0
  102. /package/dist/{chunk-U3HZQTUF.js.map → chunk-TQFRPFMG.js.map} +0 -0
  103. /package/dist/{chunk-KJCSRP34.js.map → chunk-V7ATY4BG.js.map} +0 -0
  104. /package/dist/{chunk-32RIOULO.js.map → chunk-VPC3YNFR.js.map} +0 -0
  105. /package/dist/{chunk-3BKVYSY6.js.map → chunk-VTVKC4FS.js.map} +0 -0
  106. /package/dist/{cli-circuit-breaker-2CJ6NV52.js.map → cli-circuit-breaker-GFF2RLBZ.js.map} +0 -0
  107. /package/dist/{composite-router-AYVJPIOS.js.map → composite-router-33F3F74I.js.map} +0 -0
  108. /package/dist/{consensus-vote-EXWACBMR.js.map → consensus-vote-5V4KVHBE.js.map} +0 -0
  109. /package/dist/{doctor-deep-BJFDBGPO.js.map → doctor-deep-AHDTNURD.js.map} +0 -0
  110. /package/dist/{expert-bridge-75WNNWI4.js.map → expert-bridge-DMDHHDEU.js.map} +0 -0
  111. /package/dist/{factory-H5BYL4V5.js.map → factory-FVD7PZ6S.js.map} +0 -0
  112. /package/dist/{factory-KMBWFIX2.js.map → factory-VQS3HJ7V.js.map} +0 -0
  113. /package/dist/{issue-triage-4SEP4WID.js.map → issue-triage-HJUJWGAD.js.map} +0 -0
  114. /package/dist/{learning-persistence-FILWP3IR.js.map → learning-persistence-N6ILD2HX.js.map} +0 -0
  115. /package/dist/{mcp-config-OCWIXE2Y.js.map → mobimem-BOJFXQ7B.js.map} +0 -0
  116. /package/dist/{mobimem-77W5ED4Z.js.map → nexus-data-dir-77UO7N6J.js.map} +0 -0
  117. /package/dist/{registry-command-BBLIXULQ.js.map → registry-command-NCWUJKAF.js.map} +0 -0
  118. /package/dist/{nexus-data-dir-M6DYKIHJ.js.map → repo-security-plan-3J45VAD6.js.map} +0 -0
  119. /package/dist/{repo-security-plan-7SNM7JQN.js.map → research-helpers-synthesize-UGQHZZJN.js.map} +0 -0
  120. /package/dist/{research-helpers-synthesize-7CI2FJE5.js.map → routing-memory-NO7QEH7T.js.map} +0 -0
  121. /package/dist/{routing-memory-DCIZEEVC.js.map → session-memory-DOXLEWEU.js.map} +0 -0
  122. /package/dist/{session-memory-5TSAASQW.js.map → setup-command-BWUFMZ7U.js.map} +0 -0
  123. /package/dist/{setup-command-5VGIQETA.js.map → setup-config-E3JZYSLR.js.map} +0 -0
  124. /package/dist/{setup-custom-api-IQX3GD2D.js.map → setup-custom-api-DHJ5DRH2.js.map} +0 -0
  125. /package/dist/{setup-config-EA5RDIO2.js.map → weather-report-FNN4OX3N.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getErrorMessage
3
- } from "./chunk-7OBFO4GF.js";
3
+ } from "./chunk-O4KUCF5S.js";
4
4
 
5
5
  // src/cli/setup-config.ts
6
6
  import { copyFileSync, existsSync, writeFileSync } from "fs";
@@ -74,4 +74,4 @@ function ensureBackup(outputPath) {
74
74
  export {
75
75
  runConfigInitSync
76
76
  };
77
- //# sourceMappingURL=chunk-OF7CYMMA.js.map
77
+ //# sourceMappingURL=chunk-DA5UDQYW.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  CliCircuitBreaker,
3
3
  DEFAULT_CIRCUIT_BREAKER_CONFIG
4
- } from "./chunk-U3HZQTUF.js";
4
+ } from "./chunk-TQFRPFMG.js";
5
5
  import {
6
6
  CLI_SUBPROCESS_TIMEOUTS,
7
7
  CLI_TIMEOUTS,
@@ -26,7 +26,7 @@ import {
26
26
  getTimeProvider,
27
27
  isRateLimitText,
28
28
  ok
29
- } from "./chunk-7OBFO4GF.js";
29
+ } from "./chunk-O4KUCF5S.js";
30
30
 
31
31
  // src/cli-adapters/subprocess-adapter.ts
32
32
  import { spawn } from "child_process";
@@ -617,6 +617,96 @@ function sanitizeOutput(text) {
617
617
  return result;
618
618
  }
619
619
 
620
+ // src/cli-adapters/cli-error-envelope.ts
621
+ function isClaudeErrorEnvelope(v) {
622
+ if (typeof v !== "object" || v === null) return false;
623
+ const obj = v;
624
+ return obj.type === "result" && obj.is_error === true;
625
+ }
626
+ function unwrapCodexEnvelope(parsed) {
627
+ if (typeof parsed !== "object" || parsed === null) return null;
628
+ const obj = parsed;
629
+ if (typeof obj.error === "string" && obj.error !== "") return obj.error;
630
+ if (obj.is_error === true && typeof obj.message === "string" && obj.message !== "") {
631
+ return obj.message;
632
+ }
633
+ return null;
634
+ }
635
+ var LOGIN_HINTS = {
636
+ claude: "claude /login",
637
+ codex: "codex login",
638
+ gemini: "gemini",
639
+ opencode: "opencode auth login"
640
+ };
641
+ var NOT_AUTH_PATTERNS = [
642
+ /not logged in/i,
643
+ /please run \/?login/i,
644
+ /authentication (?:required|expired|failed)/i,
645
+ /invalid (?:api ?key|credentials)/i,
646
+ /unauthorized/i,
647
+ // #2455 ask 1: catch "API key expired" / "API key revoked" / "API key
648
+ // missing" — the bare /invalid api key/ pattern misses these. Architects
649
+ // explicitly ruled OUT `permission denied` (that's authz, not authn —
650
+ // routing to /login is the wrong fix).
651
+ /api[- ]?key (?:expired|revoked|missing)/i,
652
+ // Token expiry/revocation as a standalone signal, not co-occurring with
653
+ // "unauthorized" — some upstreams emit "Token expired. Please re-auth."
654
+ // without the unauthorized keyword.
655
+ /token (?:expired|revoked)/i
656
+ ];
657
+ function classifyMessage(message) {
658
+ for (const re of NOT_AUTH_PATTERNS) {
659
+ if (re.test(message)) return { code: "NOT_AUTHENTICATED", auth: true };
660
+ }
661
+ return { code: "EXECUTION_ERROR", auth: false };
662
+ }
663
+ function parseCliErrorEnvelope(stdout, cliName) {
664
+ const trimmed = stdout.trim();
665
+ if (trimmed === "" || !trimmed.startsWith("{") && !trimmed.startsWith("[")) return null;
666
+ let parsed;
667
+ try {
668
+ parsed = JSON.parse(trimmed);
669
+ } catch {
670
+ return tryLastLine(trimmed, cliName);
671
+ }
672
+ let message;
673
+ if (isClaudeErrorEnvelope(parsed) && typeof parsed.result === "string") {
674
+ message = parsed.result;
675
+ } else {
676
+ const codex = unwrapCodexEnvelope(parsed);
677
+ if (codex !== null) message = codex;
678
+ }
679
+ if (message === void 0 || message === "") return null;
680
+ return buildParsedError(message, cliName);
681
+ }
682
+ function tryLastLine(stdout, cliName) {
683
+ const lines = stdout.split("\n").filter((l) => l.trim() !== "");
684
+ if (lines.length < 2) return null;
685
+ const last = lines.at(-1);
686
+ if (last === void 0) return null;
687
+ if (!last.startsWith("{")) return null;
688
+ try {
689
+ const parsed = JSON.parse(last);
690
+ if (isClaudeErrorEnvelope(parsed) && typeof parsed.result === "string") {
691
+ return buildParsedError(parsed.result, cliName);
692
+ }
693
+ } catch {
694
+ }
695
+ return null;
696
+ }
697
+ function buildParsedError(message, cliName) {
698
+ const firstLine = (message.split("\n")[0] ?? message).trim().slice(0, 240);
699
+ const { code, auth } = classifyMessage(firstLine);
700
+ if (auth) {
701
+ return {
702
+ message: firstLine,
703
+ code,
704
+ hint: `Run \`${LOGIN_HINTS[cliName]}\` to authenticate, then retry.`
705
+ };
706
+ }
707
+ return { message: firstLine, code };
708
+ }
709
+
620
710
  // src/cli-adapters/subprocess-adapter.ts
621
711
  var PLAINTEXT_FALLBACK_MIN_LENGTH = 30;
622
712
  function tryPlaintextFallback(stdout) {
@@ -801,7 +891,8 @@ var SubprocessCliAdapter = class extends BaseCliAdapter {
801
891
  stdoutBytes: 0,
802
892
  stderrBytes: 0,
803
893
  stdoutTruncated: false,
804
- stderrTruncated: false
894
+ stderrTruncated: false,
895
+ firstByteTime: null
805
896
  };
806
897
  const resolveOnce = (result) => {
807
898
  if (!state.resolved) {
@@ -809,17 +900,7 @@ var SubprocessCliAdapter = class extends BaseCliAdapter {
809
900
  resolve(result);
810
901
  }
811
902
  };
812
- if (child.stdout !== null) {
813
- child.stdout.on("data", (data) => {
814
- appendBuffered(state, "stdout", data);
815
- onProgress?.();
816
- });
817
- }
818
- if (child.stderr !== null) {
819
- child.stderr.on("data", (data) => {
820
- appendBuffered(state, "stderr", data);
821
- });
822
- }
903
+ this.attachStdoutHandlers(child, state, onProgress);
823
904
  child.on("error", (error) => {
824
905
  resolveOnce(this.handleSubprocessError(error));
825
906
  });
@@ -829,10 +910,57 @@ var SubprocessCliAdapter = class extends BaseCliAdapter {
829
910
  }, timeoutMs);
830
911
  child.on("close", (code) => {
831
912
  clearTimeout(timeoutId);
913
+ this.logTimingBreakdown(state, startTime, code);
832
914
  resolveOnce(this.classifyCloseResult(code, state, startTime));
833
915
  });
834
916
  return state;
835
917
  }
918
+ /** Attach stdout/stderr data handlers + capture first-byte time (#2472). */
919
+ attachStdoutHandlers(child, state, onProgress) {
920
+ if (child.stdout !== null) {
921
+ child.stdout.on("data", (data) => {
922
+ if (state.firstByteTime === null && data.length > 0) {
923
+ state.firstByteTime = getTimeProvider().now();
924
+ }
925
+ appendBuffered(state, "stdout", data);
926
+ onProgress?.();
927
+ });
928
+ }
929
+ if (child.stderr !== null) {
930
+ child.stderr.on("data", (data) => {
931
+ appendBuffered(state, "stderr", data);
932
+ });
933
+ }
934
+ }
935
+ /**
936
+ * Log spawn-latency vs streaming breakdown at info level (#2472). Emits
937
+ * one structured event per subprocess invocation, queryable via the
938
+ * existing trace JSONL infrastructure. The breakdown lets operators
939
+ * identify whether a slow run was caused by:
940
+ * - High spawn-latency: model gateway took its time before producing
941
+ * the first token (cold-start, queueing, network jitter).
942
+ * - High streaming-time: response body was large or generation slow.
943
+ * - Total approaches the timeout cap with no first-byte: hung process.
944
+ *
945
+ * Structured fields chosen so existing query_trace tooling can group by
946
+ * cli + provider + model and surface tail-latency outliers.
947
+ */
948
+ logTimingBreakdown(state, startTime, code) {
949
+ const now = getTimeProvider().now();
950
+ const totalMs = now - startTime;
951
+ const spawnLatencyMs = state.firstByteTime === null ? null : state.firstByteTime - startTime;
952
+ const streamingMs = state.firstByteTime === null ? null : now - state.firstByteTime;
953
+ this.logger.info("Subprocess timing", {
954
+ cli: this.name,
955
+ totalMs,
956
+ spawnLatencyMs,
957
+ streamingMs,
958
+ sawFirstByte: state.firstByteTime !== null,
959
+ exitCode: code,
960
+ stdoutBytes: state.stdoutBytes,
961
+ stderrBytes: state.stderrBytes
962
+ });
963
+ }
836
964
  /** Classify a subprocess close event into a Result. */
837
965
  classifyCloseResult(code, state, startTime) {
838
966
  state.stdout = sanitizeOutput(state.stdout);
@@ -863,25 +991,7 @@ var SubprocessCliAdapter = class extends BaseCliAdapter {
863
991
  }
864
992
  const text = this.parser.extractResponse(stdout);
865
993
  if (text === null) {
866
- if (isRateLimitText(stdout)) {
867
- const snippet2 = stdout.slice(0, 500).trim();
868
- return err(this.createError("RATE_LIMITED", snippet2));
869
- }
870
- const plaintext = tryPlaintextFallback(stdout);
871
- if (plaintext !== null) {
872
- subprocessLogger.debug("Using plaintext fallback for unparseable output");
873
- return ok(
874
- this.normalizeResponse(plaintext, void 0, {
875
- durationMs: getTimeProvider().now() - startTime,
876
- raw: stdout
877
- })
878
- );
879
- }
880
- const snippet = stdout.slice(0, 500).trim();
881
- const stderrHint = stderr !== "" ? ` [stderr: ${stderr.slice(0, 300).trim()}]` : "";
882
- return err(
883
- this.createError("PARSE_ERROR", `Failed to parse response: ${snippet}${stderrHint}`)
884
- );
994
+ return this.handleUnparseableOutput(stdout, stderr, startTime);
885
995
  }
886
996
  const usage = this.parser.extractUsage(stdout);
887
997
  const sessionId = this.parser.extractSessionId(stdout);
@@ -893,6 +1003,48 @@ var SubprocessCliAdapter = class extends BaseCliAdapter {
893
1003
  })
894
1004
  );
895
1005
  }
1006
+ /**
1007
+ * Handles the parse-failure branch: when the CLI's structured response
1008
+ * parser returned null. Order of recovery attempts (most-specific first):
1009
+ * 1. Rate-limit text in raw stdout (#1320)
1010
+ * 2. Structured CLI error envelope (#2440)
1011
+ * 3. Plaintext fallback for natural-language output (#1401)
1012
+ * 4. Generic PARSE_ERROR with truncated snippet
1013
+ */
1014
+ handleUnparseableOutput(stdout, stderr, startTime) {
1015
+ if (isRateLimitText(stdout)) {
1016
+ const snippet2 = stdout.slice(0, 500).trim();
1017
+ return err(this.createError("RATE_LIMITED", snippet2));
1018
+ }
1019
+ const envelope = parseCliErrorEnvelope(stdout, this.name);
1020
+ if (envelope !== null) {
1021
+ const msg = envelope.hint !== void 0 ? `${envelope.message}
1022
+ \u2192 ${envelope.hint}` : envelope.message;
1023
+ subprocessLogger.debug("CLI error envelope unwrapped", {
1024
+ cli: this.name,
1025
+ code: envelope.code,
1026
+ rawSanitized: sanitizeOutput(stdout)
1027
+ });
1028
+ return err(this.createError(envelope.code, msg));
1029
+ }
1030
+ const plaintext = tryPlaintextFallback(stdout);
1031
+ if (plaintext !== null) {
1032
+ subprocessLogger.debug("Using plaintext fallback for unparseable output", {
1033
+ rawSanitized: sanitizeOutput(stdout)
1034
+ });
1035
+ return ok(
1036
+ this.normalizeResponse(plaintext, void 0, {
1037
+ durationMs: getTimeProvider().now() - startTime,
1038
+ raw: stdout
1039
+ })
1040
+ );
1041
+ }
1042
+ const snippet = stdout.slice(0, 500).trim();
1043
+ const stderrHint = stderr !== "" ? ` [stderr: ${stderr.slice(0, 300).trim()}]` : "";
1044
+ return err(
1045
+ this.createError("PARSE_ERROR", `Failed to parse response: ${snippet}${stderrHint}`)
1046
+ );
1047
+ }
896
1048
  /**
897
1049
  * Handles subprocess execution errors.
898
1050
  */
@@ -2700,4 +2852,4 @@ export {
2700
2852
  isCliAvailable,
2701
2853
  getAvailableClis
2702
2854
  };
2703
- //# sourceMappingURL=chunk-XATH462F.js.map
2855
+ //# sourceMappingURL=chunk-ES6GFP35.js.map