nexus-agents 9.3.0 → 9.4.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 (144) hide show
  1. package/dist/{ast-rule-runner-YFDXXHJU.js → ast-rule-runner-5U6TE6YJ.js} +3 -3
  2. package/dist/{child-mcp-config-44M5EAYD.js → child-mcp-config-IR7LRMIK.js} +2 -2
  3. package/dist/{chunk-6JLDPMMU.js → chunk-2AN5NGCQ.js} +4 -4
  4. package/dist/{chunk-4HUCHMSX.js → chunk-2AW2VHMK.js} +2 -2
  5. package/dist/{chunk-AQ5KQTXW.js → chunk-6H4NUU7G.js} +5 -5
  6. package/dist/{chunk-BH6J6WCC.js → chunk-6WPXQTQY.js} +2 -2
  7. package/dist/{chunk-FDHT3TG7.js → chunk-6Z3MAHAC.js} +2 -2
  8. package/dist/{chunk-WJDNQVQF.js → chunk-72IBCL2X.js} +3 -3
  9. package/dist/{chunk-4IJII2WG.js → chunk-7XJZTSHW.js} +108 -61
  10. package/dist/chunk-7XJZTSHW.js.map +1 -0
  11. package/dist/{chunk-R67NA3Q5.js → chunk-AFAM6GK3.js} +7 -7
  12. package/dist/{chunk-OQNKPJPJ.js → chunk-AYBOQE2Y.js} +2 -2
  13. package/dist/{chunk-LHOB5YF3.js → chunk-B5YROFD2.js} +41 -41
  14. package/dist/{chunk-B3LT4L5R.js → chunk-C5WECFBR.js} +5 -5
  15. package/dist/{chunk-ZGSQFG4D.js → chunk-DEQRRCHK.js} +2 -2
  16. package/dist/{chunk-CUWTKYFP.js → chunk-DG2UY5QU.js} +2 -2
  17. package/dist/{chunk-BO46P4XJ.js → chunk-DYTB2XW2.js} +5 -5
  18. package/dist/{chunk-FWZVZME3.js → chunk-EPCR2GOE.js} +2 -2
  19. package/dist/{chunk-QCNZMRJ7.js → chunk-FKMBZ53Y.js} +2 -2
  20. package/dist/{chunk-EUKJXKXD.js → chunk-FTUBCD52.js} +3 -3
  21. package/dist/{chunk-5O4NXKPR.js → chunk-FWSAYHGV.js} +4 -4
  22. package/dist/{chunk-65XXRWUH.js → chunk-H4ACPMJS.js} +4 -4
  23. package/dist/{chunk-HM37AAFX.js → chunk-HESQ746B.js} +2 -2
  24. package/dist/{chunk-L54COYAN.js → chunk-HK4LBUYY.js} +2 -2
  25. package/dist/{chunk-P2LYE2KA.js → chunk-IU7CN5UQ.js} +4 -4
  26. package/dist/{chunk-KQJ2GAER.js → chunk-JNRDNE26.js} +2 -2
  27. package/dist/{chunk-Q4L5XROB.js → chunk-L34WFGDZ.js} +3 -3
  28. package/dist/{chunk-QLUGDQUK.js → chunk-OCKU3I4A.js} +13 -13
  29. package/dist/{chunk-Y3OBX752.js → chunk-ONYCBTOH.js} +10 -9
  30. package/dist/chunk-ONYCBTOH.js.map +1 -0
  31. package/dist/{chunk-RQ3C6QEH.js → chunk-P7327767.js} +2 -2
  32. package/dist/{chunk-RKSJ26NV.js → chunk-PFGLZZ7E.js} +122 -76
  33. package/dist/chunk-PFGLZZ7E.js.map +1 -0
  34. package/dist/{chunk-GYMILOWC.js → chunk-Q5F4OBOK.js} +2 -2
  35. package/dist/{chunk-4CTDO2Z2.js → chunk-Q7RFJSR5.js} +3 -3
  36. package/dist/{chunk-IZS66Q5F.js → chunk-RI4IXOZT.js} +2 -2
  37. package/dist/{chunk-NM7YEKQM.js → chunk-TFQMVUWQ.js} +5 -5
  38. package/dist/{chunk-A34ANV7R.js → chunk-TMHCN5EY.js} +5 -5
  39. package/dist/{chunk-5T33FILA.js → chunk-VQGHQVD2.js} +3 -3
  40. package/dist/{chunk-TCKP5S3P.js → chunk-XJ65J3O5.js} +5 -5
  41. package/dist/{cli-circuit-breaker-6V7RJMMF.js → cli-circuit-breaker-AZHN2TMH.js} +3 -3
  42. package/dist/{cli-readiness-XNJQCKIH.js → cli-readiness-H4JTTKKU.js} +7 -7
  43. package/dist/cli.d.ts +1 -1
  44. package/dist/cli.js +44 -44
  45. package/dist/{composite-router-43L52IUP.js → composite-router-WCTNVMSX.js} +2 -2
  46. package/dist/{consensus-vote-6HBLVWTW.js → consensus-vote-5PNCR3FT.js} +17 -17
  47. package/dist/{consensus-vote-types-q8io4acj.d.ts → consensus-vote-types-G7Lnj3B3.d.ts} +26 -32
  48. package/dist/{context-retriever-WPSI4STY.js → context-retriever-YM2PPNSY.js} +8 -8
  49. package/dist/{doctor-deep-6D6FG3SZ.js → doctor-deep-6P23G7PN.js} +3 -3
  50. package/dist/{doctor-gateway-report-2JOSIARQ.js → doctor-gateway-report-4TXHTWUM.js} +7 -7
  51. package/dist/{doctor-live-BVXUT36N.js → doctor-live-MYXZCBSP.js} +11 -11
  52. package/dist/{expert-bridge-E6HHFKGF.js → expert-bridge-CXHYMQRL.js} +4 -4
  53. package/dist/{factory-ZPOHG4M7.js → factory-3Z46455N.js} +10 -10
  54. package/dist/{factory-WCUQHBSG.js → factory-KH2MJQ5U.js} +5 -5
  55. package/dist/{improvement-review-33VU5DAX.js → improvement-review-SRQQBAGG.js} +6 -6
  56. package/dist/index.d.ts +11 -5
  57. package/dist/index.js +32 -32
  58. package/dist/{init-opencode-NQW7NG5Z.js → init-opencode-WXRTDPFP.js} +6 -6
  59. package/dist/{issue-triage-RFV3YR66.js → issue-triage-KF47ZHU7.js} +6 -6
  60. package/dist/{model-config-helpers-KTLFA734.js → model-config-helpers-ZH2QAFVR.js} +2 -2
  61. package/dist/{openai-compat-adapter-7CITWSBH.js → openai-compat-adapter-PQ3JKWPZ.js} +6 -6
  62. package/dist/{outcome-store-adapter-WCY3FBQM.js → outcome-store-adapter-NTYEZXLH.js} +2 -2
  63. package/dist/{pr-reviewer-helpers-KJFNRS6R.js → pr-reviewer-helpers-AQNGDRQT.js} +4 -4
  64. package/dist/{registry-command-OZLB3KYN.js → registry-command-6EHIJ3PJ.js} +2 -2
  65. package/dist/{repo-security-plan-MOHGBKLA.js → repo-security-plan-AP3QEWJ5.js} +3 -3
  66. package/dist/{research-helpers-synthesize-CKC67RSM.js → research-helpers-synthesize-XE3RMFQT.js} +4 -4
  67. package/dist/{routing-memory-FOMKUKKF.js → routing-memory-PBZIE5NX.js} +2 -2
  68. package/dist/{session-memory-KRK2HQUF.js → session-memory-6NUK6ZAG.js} +3 -3
  69. package/dist/{setup-config-A7MFKDN7.js → setup-config-KEPU4NTT.js} +3 -3
  70. package/dist/{setup-custom-api-YJ4DICAK.js → setup-custom-api-XY455LVS.js} +3 -3
  71. package/dist/setup-data-dir-B6URVYUD.js +36 -0
  72. package/dist/{tool-memory-ZUQSBR3O.js → tool-memory-MO2KOJJ7.js} +5 -5
  73. package/dist/{unified-registry-JG3QCJ5O.js → unified-registry-JE22THXP.js} +11 -11
  74. package/dist/{weather-report-2MBDI7G2.js → weather-report-TQ6KM2F2.js} +2 -2
  75. package/node_modules/@modelcontextprotocol/sdk/README.md +8 -2
  76. package/node_modules/@modelcontextprotocol/sdk/package.json +1 -1
  77. package/package.json +1 -1
  78. package/dist/chunk-4IJII2WG.js.map +0 -1
  79. package/dist/chunk-RKSJ26NV.js.map +0 -1
  80. package/dist/chunk-Y3OBX752.js.map +0 -1
  81. package/dist/setup-data-dir-VNGT3GM4.js +0 -36
  82. /package/dist/{ast-rule-runner-YFDXXHJU.js.map → ast-rule-runner-5U6TE6YJ.js.map} +0 -0
  83. /package/dist/{child-mcp-config-44M5EAYD.js.map → child-mcp-config-IR7LRMIK.js.map} +0 -0
  84. /package/dist/{chunk-6JLDPMMU.js.map → chunk-2AN5NGCQ.js.map} +0 -0
  85. /package/dist/{chunk-4HUCHMSX.js.map → chunk-2AW2VHMK.js.map} +0 -0
  86. /package/dist/{chunk-AQ5KQTXW.js.map → chunk-6H4NUU7G.js.map} +0 -0
  87. /package/dist/{chunk-BH6J6WCC.js.map → chunk-6WPXQTQY.js.map} +0 -0
  88. /package/dist/{chunk-FDHT3TG7.js.map → chunk-6Z3MAHAC.js.map} +0 -0
  89. /package/dist/{chunk-WJDNQVQF.js.map → chunk-72IBCL2X.js.map} +0 -0
  90. /package/dist/{chunk-R67NA3Q5.js.map → chunk-AFAM6GK3.js.map} +0 -0
  91. /package/dist/{chunk-OQNKPJPJ.js.map → chunk-AYBOQE2Y.js.map} +0 -0
  92. /package/dist/{chunk-LHOB5YF3.js.map → chunk-B5YROFD2.js.map} +0 -0
  93. /package/dist/{chunk-B3LT4L5R.js.map → chunk-C5WECFBR.js.map} +0 -0
  94. /package/dist/{chunk-ZGSQFG4D.js.map → chunk-DEQRRCHK.js.map} +0 -0
  95. /package/dist/{chunk-CUWTKYFP.js.map → chunk-DG2UY5QU.js.map} +0 -0
  96. /package/dist/{chunk-BO46P4XJ.js.map → chunk-DYTB2XW2.js.map} +0 -0
  97. /package/dist/{chunk-FWZVZME3.js.map → chunk-EPCR2GOE.js.map} +0 -0
  98. /package/dist/{chunk-QCNZMRJ7.js.map → chunk-FKMBZ53Y.js.map} +0 -0
  99. /package/dist/{chunk-EUKJXKXD.js.map → chunk-FTUBCD52.js.map} +0 -0
  100. /package/dist/{chunk-5O4NXKPR.js.map → chunk-FWSAYHGV.js.map} +0 -0
  101. /package/dist/{chunk-65XXRWUH.js.map → chunk-H4ACPMJS.js.map} +0 -0
  102. /package/dist/{chunk-HM37AAFX.js.map → chunk-HESQ746B.js.map} +0 -0
  103. /package/dist/{chunk-L54COYAN.js.map → chunk-HK4LBUYY.js.map} +0 -0
  104. /package/dist/{chunk-P2LYE2KA.js.map → chunk-IU7CN5UQ.js.map} +0 -0
  105. /package/dist/{chunk-KQJ2GAER.js.map → chunk-JNRDNE26.js.map} +0 -0
  106. /package/dist/{chunk-Q4L5XROB.js.map → chunk-L34WFGDZ.js.map} +0 -0
  107. /package/dist/{chunk-QLUGDQUK.js.map → chunk-OCKU3I4A.js.map} +0 -0
  108. /package/dist/{chunk-RQ3C6QEH.js.map → chunk-P7327767.js.map} +0 -0
  109. /package/dist/{chunk-GYMILOWC.js.map → chunk-Q5F4OBOK.js.map} +0 -0
  110. /package/dist/{chunk-4CTDO2Z2.js.map → chunk-Q7RFJSR5.js.map} +0 -0
  111. /package/dist/{chunk-IZS66Q5F.js.map → chunk-RI4IXOZT.js.map} +0 -0
  112. /package/dist/{chunk-NM7YEKQM.js.map → chunk-TFQMVUWQ.js.map} +0 -0
  113. /package/dist/{chunk-A34ANV7R.js.map → chunk-TMHCN5EY.js.map} +0 -0
  114. /package/dist/{chunk-5T33FILA.js.map → chunk-VQGHQVD2.js.map} +0 -0
  115. /package/dist/{chunk-TCKP5S3P.js.map → chunk-XJ65J3O5.js.map} +0 -0
  116. /package/dist/{cli-circuit-breaker-6V7RJMMF.js.map → cli-circuit-breaker-AZHN2TMH.js.map} +0 -0
  117. /package/dist/{cli-readiness-XNJQCKIH.js.map → cli-readiness-H4JTTKKU.js.map} +0 -0
  118. /package/dist/{composite-router-43L52IUP.js.map → composite-router-WCTNVMSX.js.map} +0 -0
  119. /package/dist/{consensus-vote-6HBLVWTW.js.map → consensus-vote-5PNCR3FT.js.map} +0 -0
  120. /package/dist/{context-retriever-WPSI4STY.js.map → context-retriever-YM2PPNSY.js.map} +0 -0
  121. /package/dist/{doctor-deep-6D6FG3SZ.js.map → doctor-deep-6P23G7PN.js.map} +0 -0
  122. /package/dist/{doctor-gateway-report-2JOSIARQ.js.map → doctor-gateway-report-4TXHTWUM.js.map} +0 -0
  123. /package/dist/{doctor-live-BVXUT36N.js.map → doctor-live-MYXZCBSP.js.map} +0 -0
  124. /package/dist/{expert-bridge-E6HHFKGF.js.map → expert-bridge-CXHYMQRL.js.map} +0 -0
  125. /package/dist/{factory-WCUQHBSG.js.map → factory-3Z46455N.js.map} +0 -0
  126. /package/dist/{factory-ZPOHG4M7.js.map → factory-KH2MJQ5U.js.map} +0 -0
  127. /package/dist/{improvement-review-33VU5DAX.js.map → improvement-review-SRQQBAGG.js.map} +0 -0
  128. /package/dist/{init-opencode-NQW7NG5Z.js.map → init-opencode-WXRTDPFP.js.map} +0 -0
  129. /package/dist/{issue-triage-RFV3YR66.js.map → issue-triage-KF47ZHU7.js.map} +0 -0
  130. /package/dist/{model-config-helpers-KTLFA734.js.map → model-config-helpers-ZH2QAFVR.js.map} +0 -0
  131. /package/dist/{openai-compat-adapter-7CITWSBH.js.map → openai-compat-adapter-PQ3JKWPZ.js.map} +0 -0
  132. /package/dist/{outcome-store-adapter-WCY3FBQM.js.map → outcome-store-adapter-NTYEZXLH.js.map} +0 -0
  133. /package/dist/{pr-reviewer-helpers-KJFNRS6R.js.map → pr-reviewer-helpers-AQNGDRQT.js.map} +0 -0
  134. /package/dist/{registry-command-OZLB3KYN.js.map → registry-command-6EHIJ3PJ.js.map} +0 -0
  135. /package/dist/{repo-security-plan-MOHGBKLA.js.map → repo-security-plan-AP3QEWJ5.js.map} +0 -0
  136. /package/dist/{research-helpers-synthesize-CKC67RSM.js.map → research-helpers-synthesize-XE3RMFQT.js.map} +0 -0
  137. /package/dist/{routing-memory-FOMKUKKF.js.map → routing-memory-PBZIE5NX.js.map} +0 -0
  138. /package/dist/{session-memory-KRK2HQUF.js.map → session-memory-6NUK6ZAG.js.map} +0 -0
  139. /package/dist/{setup-config-A7MFKDN7.js.map → setup-config-KEPU4NTT.js.map} +0 -0
  140. /package/dist/{setup-custom-api-YJ4DICAK.js.map → setup-custom-api-XY455LVS.js.map} +0 -0
  141. /package/dist/{setup-data-dir-VNGT3GM4.js.map → setup-data-dir-B6URVYUD.js.map} +0 -0
  142. /package/dist/{tool-memory-ZUQSBR3O.js.map → tool-memory-MO2KOJJ7.js.map} +0 -0
  143. /package/dist/{unified-registry-JG3QCJ5O.js.map → unified-registry-JE22THXP.js.map} +0 -0
  144. /package/dist/{weather-report-2MBDI7G2.js.map → weather-report-TQ6KM2F2.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getErrorMessage
3
- } from "./chunk-4IJII2WG.js";
3
+ } from "./chunk-7XJZTSHW.js";
4
4
 
5
5
  // src/cli/setup-config.ts
6
6
  import { copyFileSync, existsSync, mkdirSync, writeFileSync } from "node:fs";
@@ -77,4 +77,4 @@ function ensureBackup(outputPath) {
77
77
  export {
78
78
  runConfigInitSync
79
79
  };
80
- //# sourceMappingURL=chunk-RQ3C6QEH.js.map
80
+ //# sourceMappingURL=chunk-P7327767.js.map
@@ -21,24 +21,24 @@ import {
21
21
  toolSuccess,
22
22
  withProgressHeartbeat,
23
23
  wrapToolWithTimeout
24
- } from "./chunk-P2LYE2KA.js";
24
+ } from "./chunk-IU7CN5UQ.js";
25
25
  import {
26
26
  getToolMemory
27
- } from "./chunk-6JLDPMMU.js";
27
+ } from "./chunk-2AN5NGCQ.js";
28
28
  import {
29
29
  allOf
30
30
  } from "./chunk-EZNIYU5T.js";
31
31
  import {
32
32
  VERSION
33
- } from "./chunk-Q4L5XROB.js";
33
+ } from "./chunk-L34WFGDZ.js";
34
34
  import {
35
35
  isGatewayModelAdapter
36
- } from "./chunk-B3LT4L5R.js";
36
+ } from "./chunk-C5WECFBR.js";
37
37
  import {
38
38
  ModelBoundAdapter,
39
39
  createEvent,
40
40
  getGlobalRegistry
41
- } from "./chunk-NM7YEKQM.js";
41
+ } from "./chunk-TFQMVUWQ.js";
42
42
  import {
43
43
  UNVERIFIABLE_STDERR_RE,
44
44
  classifyUnverifiable,
@@ -46,29 +46,31 @@ import {
46
46
  getAvailableClis,
47
47
  isAbsentSeat,
48
48
  markUnverifiable
49
- } from "./chunk-Y3OBX752.js";
49
+ } from "./chunk-ONYCBTOH.js";
50
50
  import {
51
51
  ensureGatewayDiscovered
52
- } from "./chunk-5T33FILA.js";
52
+ } from "./chunk-VQGHQVD2.js";
53
53
  import {
54
54
  CLI_TO_MODELSDEV_VENDOR,
55
55
  delay,
56
56
  getAbortObservation,
57
57
  sleep,
58
58
  withTimeout
59
- } from "./chunk-A34ANV7R.js";
59
+ } from "./chunk-TMHCN5EY.js";
60
60
  import {
61
61
  getDefaultCliCircuitBreakerRegistry
62
- } from "./chunk-OQNKPJPJ.js";
62
+ } from "./chunk-AYBOQE2Y.js";
63
63
  import {
64
64
  sanitizeErrorDetails,
65
65
  sanitizeOutput,
66
66
  sanitizeStringLeaves
67
- } from "./chunk-4HUCHMSX.js";
67
+ } from "./chunk-2AW2VHMK.js";
68
68
  import {
69
69
  AgentError,
70
70
  DecisionCostStore,
71
71
  DecisionCostSummarySchema,
72
+ MAX_VOTER_CONDITIONS,
73
+ MAX_VOTER_CONDITION_CHARS,
72
74
  OutcomeStore,
73
75
  TaskOutcomeSchema,
74
76
  UNDECLARED_OPTIONS_EXCERPT_CHARS,
@@ -121,7 +123,7 @@ import {
121
123
  servedCostDetail,
122
124
  stepBus,
123
125
  voteRecordWriteFailedMessage
124
- } from "./chunk-4IJII2WG.js";
126
+ } from "./chunk-7XJZTSHW.js";
125
127
  import {
126
128
  ensureLearningDir,
127
129
  getOutcomesFile
@@ -815,6 +817,69 @@ var SIMULATED_VOTE_REASONING = {
815
817
  // src/cli/voter-response.ts
816
818
  import { z } from "zod";
817
819
 
820
+ // src/cli/voter-response-text.ts
821
+ function extractTextFromResponse(content) {
822
+ return sanitizeOutput(rawTextFromResponse(content));
823
+ }
824
+ function rawTextFromResponse(content) {
825
+ if (typeof content === "string") {
826
+ return content;
827
+ }
828
+ if (Array.isArray(content)) {
829
+ return content.map((block) => {
830
+ if (typeof block === "object" && block !== null && "type" in block) {
831
+ const typed = block;
832
+ if (typed.type === "text" && typeof typed.text === "string") {
833
+ return typed.text;
834
+ }
835
+ }
836
+ return "";
837
+ }).join("");
838
+ }
839
+ return String(content);
840
+ }
841
+ function isStructuredOutputUnsupported(errorMessage) {
842
+ return /support tool use/i.test(errorMessage);
843
+ }
844
+ var REASONING_MAX_CHARS = 4e3;
845
+ var CLAIM_MAX_CHARS = 2e3;
846
+ var TRUNCATION_MARKER = " \u2026[truncated]";
847
+ function clampWithMarker(s, max) {
848
+ if (s.length <= max) return s;
849
+ return s.slice(0, Math.max(0, max - TRUNCATION_MARKER.length)) + TRUNCATION_MARKER;
850
+ }
851
+ function clampOversizeVoteStrings(parsed) {
852
+ if (typeof parsed !== "object" || parsed === null) return parsed;
853
+ const obj = { ...parsed };
854
+ if (typeof obj["reasoning"] === "string") {
855
+ obj["reasoning"] = clampWithMarker(obj["reasoning"], REASONING_MAX_CHARS);
856
+ }
857
+ if (Array.isArray(obj["conditions"]) && obj["conditions"].every((c) => typeof c === "string")) {
858
+ const conditions = obj["conditions"].map(
859
+ (c) => clampWithMarker(c, MAX_VOTER_CONDITION_CHARS)
860
+ );
861
+ if (conditions.length > MAX_VOTER_CONDITIONS) {
862
+ const dropped = conditions.length - MAX_VOTER_CONDITIONS + 1;
863
+ conditions.splice(
864
+ MAX_VOTER_CONDITIONS - 1,
865
+ dropped,
866
+ `${TRUNCATION_MARKER} ${String(dropped)} conditions dropped`
867
+ );
868
+ }
869
+ obj["conditions"] = conditions;
870
+ }
871
+ if (Array.isArray(obj["findings"])) {
872
+ obj["findings"] = obj["findings"].map((finding) => {
873
+ if (typeof finding === "object" && finding !== null && typeof finding["claim"] === "string") {
874
+ const f = finding;
875
+ return { ...f, claim: clampWithMarker(f["claim"], CLAIM_MAX_CHARS) };
876
+ }
877
+ return finding;
878
+ });
879
+ }
880
+ return obj;
881
+ }
882
+
818
883
  // src/consensus/option-tally.ts
819
884
  var SUPERMAJORITY_SHARE = 2 / 3;
820
885
  var MAJORITY_SHARE = 0.5;
@@ -889,7 +954,7 @@ var VoteResponseSchema = z.object({
889
954
  decision: z.enum(["approve", "reject", "abstain"]).describe("Your vote decision"),
890
955
  reasoning: z.string().min(10).max(4e3).describe("Explanation for your vote (10-4000 chars)"),
891
956
  confidence: z.number().min(0).max(1).describe("Confidence level 0-1"),
892
- conditions: z.array(z.string()).optional().describe("Optional conditions for approval"),
957
+ conditions: z.array(z.string().max(MAX_VOTER_CONDITION_CHARS)).max(MAX_VOTER_CONDITIONS).optional().describe("Optional conditions for approval"),
893
958
  /** Structured rejection categories for reject→refine→re-vote loops (Issue #1213). */
894
959
  rejectionCategories: z.array(
895
960
  z.enum([
@@ -934,7 +999,8 @@ var VOTE_JSON_SCHEMA = {
934
999
  },
935
1000
  conditions: {
936
1001
  type: "array",
937
- items: { type: "string" },
1002
+ items: { type: "string", maxLength: MAX_VOTER_CONDITION_CHARS },
1003
+ maxItems: MAX_VOTER_CONDITIONS,
938
1004
  description: "Optional conditions for approval"
939
1005
  },
940
1006
  // #4472: without this, `additionalProperties: false` makes it impossible
@@ -1161,30 +1227,6 @@ function objectFromFenceBody(text, match, body) {
1161
1227
  const bodyStart = match.index + match[0].length - "```".length - body.length;
1162
1228
  return extractFirstJsonObject(text.slice(bodyStart));
1163
1229
  }
1164
- var REASONING_MAX_CHARS = 4e3;
1165
- var CLAIM_MAX_CHARS = 2e3;
1166
- var TRUNCATION_MARKER = " \u2026[truncated]";
1167
- function clampWithMarker(s, max) {
1168
- if (s.length <= max) return s;
1169
- return s.slice(0, Math.max(0, max - TRUNCATION_MARKER.length)) + TRUNCATION_MARKER;
1170
- }
1171
- function clampOversizeVoteStrings(parsed) {
1172
- if (typeof parsed !== "object" || parsed === null) return parsed;
1173
- const obj = { ...parsed };
1174
- if (typeof obj["reasoning"] === "string") {
1175
- obj["reasoning"] = clampWithMarker(obj["reasoning"], REASONING_MAX_CHARS);
1176
- }
1177
- if (Array.isArray(obj["findings"])) {
1178
- obj["findings"] = obj["findings"].map((finding) => {
1179
- if (typeof finding === "object" && finding !== null && typeof finding["claim"] === "string") {
1180
- const f = finding;
1181
- return { ...f, claim: clampWithMarker(f["claim"], CLAIM_MAX_CHARS) };
1182
- }
1183
- return finding;
1184
- });
1185
- }
1186
- return obj;
1187
- }
1188
1230
  function buildParsedVote(data, options) {
1189
1231
  const selectedOption = options === void 0 ? void 0 : matchDeclaredOption(data.selectedOption, options);
1190
1232
  return {
@@ -1216,31 +1258,6 @@ function parseVoteResponse(output, _role, options) {
1216
1258
  }
1217
1259
  }
1218
1260
 
1219
- // src/cli/voter-response-text.ts
1220
- function extractTextFromResponse(content) {
1221
- return sanitizeOutput(rawTextFromResponse(content));
1222
- }
1223
- function rawTextFromResponse(content) {
1224
- if (typeof content === "string") {
1225
- return content;
1226
- }
1227
- if (Array.isArray(content)) {
1228
- return content.map((block) => {
1229
- if (typeof block === "object" && block !== null && "type" in block) {
1230
- const typed = block;
1231
- if (typed.type === "text" && typeof typed.text === "string") {
1232
- return typed.text;
1233
- }
1234
- }
1235
- return "";
1236
- }).join("");
1237
- }
1238
- return String(content);
1239
- }
1240
- function isStructuredOutputUnsupported(errorMessage) {
1241
- return /support tool use/i.test(errorMessage);
1242
- }
1243
-
1244
1261
  // src/cli/voter-attempt-log.ts
1245
1262
  function isRateLimitError(message) {
1246
1263
  return isRateLimitLikeError(new Error(message));
@@ -6641,7 +6658,7 @@ function logPartialProposal(bounded, log) {
6641
6658
  }
6642
6659
  async function runContrarianCheck(proposal, options, log, opts) {
6643
6660
  try {
6644
- const { executeExpert } = await import("./expert-bridge-E6HHFKGF.js");
6661
+ const { executeExpert } = await import("./expert-bridge-CXHYMQRL.js");
6645
6662
  const bounded = boundArtifactForReview(proposal, CONTRARIAN_PROPOSAL_BUDGET, "proposal");
6646
6663
  logPartialProposal(bounded, log);
6647
6664
  const result = await executeExpert(
@@ -7614,11 +7631,20 @@ async function attachPartialsOnCancel(jobId, toolName, body) {
7614
7631
  }
7615
7632
 
7616
7633
  // src/orchestration/outcomes/outcome-store-persistence.ts
7617
- import { appendFileSync as appendFileSync2, readFileSync as readFileSync6, writeFileSync as writeFileSync3, existsSync as existsSync5 } from "node:fs";
7634
+ import {
7635
+ appendFileSync as appendFileSync2,
7636
+ readFileSync as readFileSync6,
7637
+ writeFileSync as writeFileSync3,
7638
+ existsSync as existsSync5,
7639
+ renameSync,
7640
+ rmSync
7641
+ } from "node:fs";
7618
7642
  var PersistedOutcomeSchema = TaskOutcomeSchema.loose();
7619
7643
  var PersistentOutcomeStore = class extends OutcomeStore {
7620
7644
  filePath;
7621
7645
  logger;
7646
+ /** Raw unreadable segments, including their original line terminators. */
7647
+ unreadableLines = [];
7622
7648
  constructor(config, logger12) {
7623
7649
  super(config);
7624
7650
  this.filePath = config?.filePath ?? getOutcomesFile();
@@ -7674,7 +7700,7 @@ var PersistentOutcomeStore = class extends OutcomeStore {
7674
7700
  }
7675
7701
  try {
7676
7702
  const content = readFileSync6(this.filePath, "utf-8");
7677
- const lines = content.split("\n").filter((line) => line.trim().length > 0);
7703
+ const lines = content.split(/(?<=\n)/).filter((line) => line.trim().length > 0);
7678
7704
  let loaded = 0;
7679
7705
  let skipped = 0;
7680
7706
  for (const line of lines) {
@@ -7685,16 +7711,23 @@ var PersistentOutcomeStore = class extends OutcomeStore {
7685
7711
  super.append(result.data);
7686
7712
  loaded++;
7687
7713
  } else {
7714
+ this.unreadableLines.push(line);
7688
7715
  skipped++;
7689
7716
  }
7690
- } catch (parseErr) {
7691
- this.logger.debug("Skipping malformed outcome line during hydration", {
7692
- error: getErrorMessage(parseErr),
7693
- linePreview: line.slice(0, 80)
7694
- });
7717
+ } catch {
7718
+ this.unreadableLines.push(line);
7695
7719
  skipped++;
7696
7720
  }
7697
7721
  }
7722
+ if (skipped > 0) {
7723
+ this.logger.warn(
7724
+ "Skipped unreadable outcome lines during hydration; preserving them on rewrite",
7725
+ {
7726
+ skipped,
7727
+ path: this.filePath
7728
+ }
7729
+ );
7730
+ }
7698
7731
  this.logger.info("Hydrated outcomes from disk", {
7699
7732
  loaded,
7700
7733
  skipped,
@@ -7702,25 +7735,38 @@ var PersistentOutcomeStore = class extends OutcomeStore {
7702
7735
  path: this.filePath
7703
7736
  });
7704
7737
  } catch (error) {
7705
- const msg = getErrorMessage(error);
7706
7738
  this.logger.warn("Failed to hydrate outcomes from disk", {
7707
- error: msg,
7739
+ error: getErrorMessage(error),
7708
7740
  path: this.filePath
7709
7741
  });
7710
7742
  }
7711
7743
  }
7712
- /** Rewrite the JSONL file from in-memory state after reclassification. */
7744
+ /**
7745
+ * Atomically rewrite readable records, then append unreadable segments verbatim.
7746
+ * Their relative order is preserved; their positions among readable records may
7747
+ * change after reclassification, purge or FIFO eviction (#7146).
7748
+ */
7713
7749
  rewriteFile() {
7750
+ const tmpPath = `${this.filePath}.tmp.${String(process.pid)}`;
7714
7751
  try {
7715
7752
  const entries = this.query();
7716
- const content = entries.map((e) => JSON.stringify(e)).join("\n") + "\n";
7717
- writeFileSync3(this.filePath, content, "utf-8");
7753
+ const content = entries.map((e) => JSON.stringify(e) + "\n").join("") + this.unreadableLines.join("");
7754
+ writeFileSync3(tmpPath, content, "utf-8");
7755
+ renameSync(tmpPath, this.filePath);
7718
7756
  } catch (error) {
7719
7757
  const msg = getErrorMessage(error);
7720
7758
  this.logger.warn("Failed to rewrite outcomes file after reclassification", {
7721
7759
  error: msg,
7722
7760
  path: this.filePath
7723
7761
  });
7762
+ try {
7763
+ rmSync(tmpPath, { force: true });
7764
+ } catch (cleanupError) {
7765
+ this.logger.debug("Failed to clean up temporary outcomes file", {
7766
+ error: getErrorMessage(cleanupError),
7767
+ path: tmpPath
7768
+ });
7769
+ }
7724
7770
  }
7725
7771
  }
7726
7772
  persistLine(outcome) {
@@ -9824,4 +9870,4 @@ export {
9824
9870
  CONSENSUS_VOTE_TOOL_SCHEMA,
9825
9871
  registerConsensusVoteTool
9826
9872
  };
9827
- //# sourceMappingURL=chunk-RKSJ26NV.js.map
9873
+ //# sourceMappingURL=chunk-PFGLZZ7E.js.map