nexus-agents 8.133.5 → 9.0.0

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 (154) hide show
  1. package/README.md +3 -3
  2. package/dist/{ast-rule-runner-5SVWE4V5.js → ast-rule-runner-YZJHACHU.js} +3 -3
  3. package/dist/{child-mcp-config-VQNTHRCM.js → child-mcp-config-KHQQELAI.js} +2 -2
  4. package/dist/{chunk-XI4CX52X.js → chunk-2WXJBBKO.js} +2 -2
  5. package/dist/{chunk-J466LJ35.js → chunk-3KUZPBWS.js} +304 -396
  6. package/dist/chunk-3KUZPBWS.js.map +1 -0
  7. package/dist/{chunk-5BRDJZ4X.js → chunk-62HV44OV.js} +52 -40
  8. package/dist/chunk-62HV44OV.js.map +1 -0
  9. package/dist/{chunk-45NAN3NB.js → chunk-6YQNRGZB.js} +6 -7
  10. package/dist/chunk-6YQNRGZB.js.map +1 -0
  11. package/dist/{chunk-CIAIGHES.js → chunk-7S4LRXKC.js} +5 -5
  12. package/dist/{chunk-2PSDEOKO.js → chunk-ADVSVEJN.js} +3 -3
  13. package/dist/{chunk-R2IQBO5W.js → chunk-BLJL23PR.js} +2 -2
  14. package/dist/{chunk-FF3QDRWF.js → chunk-DEFRD3HA.js} +5 -23
  15. package/dist/chunk-DEFRD3HA.js.map +1 -0
  16. package/dist/{chunk-6VISK4JT.js → chunk-FJWNB6MX.js} +8 -8
  17. package/dist/{chunk-6VR2KXYZ.js → chunk-GDFNFLVY.js} +4 -4
  18. package/dist/{chunk-T2LWKEIV.js → chunk-GL5BG6KN.js} +2 -2
  19. package/dist/{chunk-KJI4SNSK.js → chunk-HML33XXW.js} +4 -4
  20. package/dist/chunk-HML33XXW.js.map +1 -0
  21. package/dist/{chunk-WWHTLQWO.js → chunk-HZEIV7X4.js} +1154 -1228
  22. package/dist/chunk-HZEIV7X4.js.map +1 -0
  23. package/dist/{chunk-GXXOMV43.js → chunk-IF3AYOG7.js} +2 -2
  24. package/dist/{chunk-SQ76KQRG.js → chunk-IFH4SUWP.js} +3 -3
  25. package/dist/{chunk-LSZKWDCP.js → chunk-J47IMTBW.js} +8 -8
  26. package/dist/{chunk-BG4MHTXJ.js → chunk-KNUQGHKM.js} +2 -2
  27. package/dist/{chunk-CPG2YZ44.js → chunk-MAWUWFGW.js} +12 -24
  28. package/dist/{chunk-CPG2YZ44.js.map → chunk-MAWUWFGW.js.map} +1 -1
  29. package/dist/{chunk-TMMPWFO2.js → chunk-MC36BXHL.js} +5 -5
  30. package/dist/{chunk-LAXFJRDX.js → chunk-N5EJMCYM.js} +2 -2
  31. package/dist/{chunk-TLXQ6CGF.js → chunk-NJDGEC2E.js} +2 -2
  32. package/dist/{chunk-VYT2YEK2.js → chunk-O5GIBXTN.js} +2 -2
  33. package/dist/{chunk-BPEUNLUO.js → chunk-OK3XZX72.js} +16 -16
  34. package/dist/chunk-OK3XZX72.js.map +1 -0
  35. package/dist/{chunk-R77KXHK4.js → chunk-OUS7OK67.js} +2 -2
  36. package/dist/{chunk-VLNILPYJ.js → chunk-PZ2CF5TU.js} +4 -4
  37. package/dist/{chunk-XZ3Z7VO5.js → chunk-PZ4V5PEM.js} +3 -3
  38. package/dist/{chunk-JA6Q3OO2.js → chunk-Q6K4URO4.js} +2 -2
  39. package/dist/{chunk-BGHKG77F.js → chunk-QQKCEEIZ.js} +5 -5
  40. package/dist/{chunk-UBFCQKFZ.js → chunk-RC2Q4UQE.js} +5 -5
  41. package/dist/{chunk-LE4FXYYZ.js → chunk-RYUW6T7M.js} +2 -2
  42. package/dist/{chunk-IIMSXW5L.js → chunk-SAHVCQFW.js} +2 -2
  43. package/dist/{chunk-DKO2UVFI.js → chunk-T6AF7LN3.js} +4 -4
  44. package/dist/chunk-T6AF7LN3.js.map +1 -0
  45. package/dist/{chunk-AHI43IQB.js → chunk-TDTCWDZR.js} +2 -2
  46. package/dist/{chunk-AHI43IQB.js.map → chunk-TDTCWDZR.js.map} +1 -1
  47. package/dist/{chunk-CYOV4UZ3.js → chunk-V2XMYJUS.js} +2 -2
  48. package/dist/{chunk-A6CTHKSJ.js → chunk-VPT5T2JN.js} +2 -2
  49. package/dist/{chunk-OXCREJDI.js → chunk-Z56THMPG.js} +3 -3
  50. package/dist/{cli-circuit-breaker-JE4HNST7.js → cli-circuit-breaker-AUYQTMVX.js} +3 -3
  51. package/dist/{cli-readiness-GPWH5AC2.js → cli-readiness-CX7MZE7Y.js} +7 -7
  52. package/dist/cli.d.ts +3 -1
  53. package/dist/cli.js +63 -56
  54. package/dist/cli.js.map +1 -1
  55. package/dist/{composite-router-BZFN3Z4F.js → composite-router-IE5QVX2J.js} +2 -2
  56. package/dist/{consensus-vote-NVDH66XO.js → consensus-vote-GIVVS7ZD.js} +17 -17
  57. package/dist/{consensus-vote-types-331PZ3Vk.d.ts → consensus-vote-types-D2RbRYve.d.ts} +24 -95
  58. package/dist/{context-retriever-7N4CDXYP.js → context-retriever-OCI25GLA.js} +8 -8
  59. package/dist/{doctor-deep-GIJ3IVZD.js → doctor-deep-L3ITO5TU.js} +3 -3
  60. package/dist/{doctor-gateway-report-ZPQ5ZG4X.js → doctor-gateway-report-AVIS6QSE.js} +7 -7
  61. package/dist/{doctor-live-UXGMT4ZA.js → doctor-live-3ST56HBO.js} +11 -11
  62. package/dist/{expert-bridge-XTTYNDBS.js → expert-bridge-4QAURLMN.js} +4 -4
  63. package/dist/{expert-config-JSQTCTSE.js → expert-config-3LQMRQ24.js} +2 -2
  64. package/dist/{factory-VUK2KP76.js → factory-7XCDUXY7.js} +5 -5
  65. package/dist/{factory-UGMGVQTP.js → factory-KYPD5ONA.js} +10 -10
  66. package/dist/{improvement-review-GBYOUVNK.js → improvement-review-4FUKBWXL.js} +6 -6
  67. package/dist/index.d.ts +77 -235
  68. package/dist/index.js +60 -65
  69. package/dist/index.js.map +1 -1
  70. package/dist/{init-opencode-QD2XTPRZ.js → init-opencode-PSKYIV5I.js} +6 -6
  71. package/dist/{issue-triage-CAJ232ZV.js → issue-triage-HMQ3V5MC.js} +6 -6
  72. package/dist/{model-config-helpers-7HLTRIXX.js → model-config-helpers-3Y6VAZDJ.js} +2 -2
  73. package/dist/{openai-compat-adapter-BIMDUZUY.js → openai-compat-adapter-LY65VHEJ.js} +6 -6
  74. package/dist/{outcome-store-adapter-FEIYXOV5.js → outcome-store-adapter-OL5JSBOD.js} +2 -2
  75. package/dist/{pr-reviewer-helpers-IAUYVEZF.js → pr-reviewer-helpers-S7M2XNFQ.js} +4 -4
  76. package/dist/{registry-command-E3QDLFIT.js → registry-command-NDWT3AO3.js} +2 -2
  77. package/dist/{repo-security-plan-NNALBUDS.js → repo-security-plan-LDVNJEIY.js} +3 -3
  78. package/dist/{research-helpers-synthesize-5RFBOOFU.js → research-helpers-synthesize-JC3LK62G.js} +4 -4
  79. package/dist/{routing-memory-77IYSA2Q.js → routing-memory-3SRLLWW4.js} +2 -2
  80. package/dist/{session-memory-X2Y5BJGJ.js → session-memory-TUQNQK2C.js} +3 -3
  81. package/dist/{setup-config-7P6IBTPP.js → setup-config-3P3VJ4S5.js} +3 -3
  82. package/dist/{setup-custom-api-IZJDTTGF.js → setup-custom-api-U2STU4Z2.js} +3 -3
  83. package/dist/setup-data-dir-376ODJHS.js +36 -0
  84. package/dist/{tool-memory-H6MKQFJX.js → tool-memory-S4HCE6NT.js} +5 -5
  85. package/dist/{unified-registry-ITHFGNVT.js → unified-registry-2BU4BMWW.js} +11 -11
  86. package/dist/{weather-report-RXFQNN3D.js → weather-report-KBF6NSFM.js} +2 -2
  87. package/package.json +2 -2
  88. package/dist/chunk-45NAN3NB.js.map +0 -1
  89. package/dist/chunk-5BRDJZ4X.js.map +0 -1
  90. package/dist/chunk-BPEUNLUO.js.map +0 -1
  91. package/dist/chunk-DKO2UVFI.js.map +0 -1
  92. package/dist/chunk-FF3QDRWF.js.map +0 -1
  93. package/dist/chunk-J466LJ35.js.map +0 -1
  94. package/dist/chunk-KJI4SNSK.js.map +0 -1
  95. package/dist/chunk-WWHTLQWO.js.map +0 -1
  96. package/dist/setup-data-dir-Z4ZQTRTH.js +0 -36
  97. /package/dist/{ast-rule-runner-5SVWE4V5.js.map → ast-rule-runner-YZJHACHU.js.map} +0 -0
  98. /package/dist/{child-mcp-config-VQNTHRCM.js.map → child-mcp-config-KHQQELAI.js.map} +0 -0
  99. /package/dist/{chunk-XI4CX52X.js.map → chunk-2WXJBBKO.js.map} +0 -0
  100. /package/dist/{chunk-CIAIGHES.js.map → chunk-7S4LRXKC.js.map} +0 -0
  101. /package/dist/{chunk-2PSDEOKO.js.map → chunk-ADVSVEJN.js.map} +0 -0
  102. /package/dist/{chunk-R2IQBO5W.js.map → chunk-BLJL23PR.js.map} +0 -0
  103. /package/dist/{chunk-6VISK4JT.js.map → chunk-FJWNB6MX.js.map} +0 -0
  104. /package/dist/{chunk-6VR2KXYZ.js.map → chunk-GDFNFLVY.js.map} +0 -0
  105. /package/dist/{chunk-T2LWKEIV.js.map → chunk-GL5BG6KN.js.map} +0 -0
  106. /package/dist/{chunk-GXXOMV43.js.map → chunk-IF3AYOG7.js.map} +0 -0
  107. /package/dist/{chunk-SQ76KQRG.js.map → chunk-IFH4SUWP.js.map} +0 -0
  108. /package/dist/{chunk-LSZKWDCP.js.map → chunk-J47IMTBW.js.map} +0 -0
  109. /package/dist/{chunk-BG4MHTXJ.js.map → chunk-KNUQGHKM.js.map} +0 -0
  110. /package/dist/{chunk-TMMPWFO2.js.map → chunk-MC36BXHL.js.map} +0 -0
  111. /package/dist/{chunk-LAXFJRDX.js.map → chunk-N5EJMCYM.js.map} +0 -0
  112. /package/dist/{chunk-TLXQ6CGF.js.map → chunk-NJDGEC2E.js.map} +0 -0
  113. /package/dist/{chunk-VYT2YEK2.js.map → chunk-O5GIBXTN.js.map} +0 -0
  114. /package/dist/{chunk-R77KXHK4.js.map → chunk-OUS7OK67.js.map} +0 -0
  115. /package/dist/{chunk-VLNILPYJ.js.map → chunk-PZ2CF5TU.js.map} +0 -0
  116. /package/dist/{chunk-XZ3Z7VO5.js.map → chunk-PZ4V5PEM.js.map} +0 -0
  117. /package/dist/{chunk-JA6Q3OO2.js.map → chunk-Q6K4URO4.js.map} +0 -0
  118. /package/dist/{chunk-BGHKG77F.js.map → chunk-QQKCEEIZ.js.map} +0 -0
  119. /package/dist/{chunk-UBFCQKFZ.js.map → chunk-RC2Q4UQE.js.map} +0 -0
  120. /package/dist/{chunk-LE4FXYYZ.js.map → chunk-RYUW6T7M.js.map} +0 -0
  121. /package/dist/{chunk-IIMSXW5L.js.map → chunk-SAHVCQFW.js.map} +0 -0
  122. /package/dist/{chunk-CYOV4UZ3.js.map → chunk-V2XMYJUS.js.map} +0 -0
  123. /package/dist/{chunk-A6CTHKSJ.js.map → chunk-VPT5T2JN.js.map} +0 -0
  124. /package/dist/{chunk-OXCREJDI.js.map → chunk-Z56THMPG.js.map} +0 -0
  125. /package/dist/{cli-circuit-breaker-JE4HNST7.js.map → cli-circuit-breaker-AUYQTMVX.js.map} +0 -0
  126. /package/dist/{cli-readiness-GPWH5AC2.js.map → cli-readiness-CX7MZE7Y.js.map} +0 -0
  127. /package/dist/{composite-router-BZFN3Z4F.js.map → composite-router-IE5QVX2J.js.map} +0 -0
  128. /package/dist/{consensus-vote-NVDH66XO.js.map → consensus-vote-GIVVS7ZD.js.map} +0 -0
  129. /package/dist/{context-retriever-7N4CDXYP.js.map → context-retriever-OCI25GLA.js.map} +0 -0
  130. /package/dist/{doctor-deep-GIJ3IVZD.js.map → doctor-deep-L3ITO5TU.js.map} +0 -0
  131. /package/dist/{doctor-gateway-report-ZPQ5ZG4X.js.map → doctor-gateway-report-AVIS6QSE.js.map} +0 -0
  132. /package/dist/{doctor-live-UXGMT4ZA.js.map → doctor-live-3ST56HBO.js.map} +0 -0
  133. /package/dist/{expert-bridge-XTTYNDBS.js.map → expert-bridge-4QAURLMN.js.map} +0 -0
  134. /package/dist/{expert-config-JSQTCTSE.js.map → expert-config-3LQMRQ24.js.map} +0 -0
  135. /package/dist/{factory-UGMGVQTP.js.map → factory-7XCDUXY7.js.map} +0 -0
  136. /package/dist/{factory-VUK2KP76.js.map → factory-KYPD5ONA.js.map} +0 -0
  137. /package/dist/{improvement-review-GBYOUVNK.js.map → improvement-review-4FUKBWXL.js.map} +0 -0
  138. /package/dist/{init-opencode-QD2XTPRZ.js.map → init-opencode-PSKYIV5I.js.map} +0 -0
  139. /package/dist/{issue-triage-CAJ232ZV.js.map → issue-triage-HMQ3V5MC.js.map} +0 -0
  140. /package/dist/{model-config-helpers-7HLTRIXX.js.map → model-config-helpers-3Y6VAZDJ.js.map} +0 -0
  141. /package/dist/{openai-compat-adapter-BIMDUZUY.js.map → openai-compat-adapter-LY65VHEJ.js.map} +0 -0
  142. /package/dist/{outcome-store-adapter-FEIYXOV5.js.map → outcome-store-adapter-OL5JSBOD.js.map} +0 -0
  143. /package/dist/{pr-reviewer-helpers-IAUYVEZF.js.map → pr-reviewer-helpers-S7M2XNFQ.js.map} +0 -0
  144. /package/dist/{registry-command-E3QDLFIT.js.map → registry-command-NDWT3AO3.js.map} +0 -0
  145. /package/dist/{repo-security-plan-NNALBUDS.js.map → repo-security-plan-LDVNJEIY.js.map} +0 -0
  146. /package/dist/{research-helpers-synthesize-5RFBOOFU.js.map → research-helpers-synthesize-JC3LK62G.js.map} +0 -0
  147. /package/dist/{routing-memory-77IYSA2Q.js.map → routing-memory-3SRLLWW4.js.map} +0 -0
  148. /package/dist/{session-memory-X2Y5BJGJ.js.map → session-memory-TUQNQK2C.js.map} +0 -0
  149. /package/dist/{setup-config-7P6IBTPP.js.map → setup-config-3P3VJ4S5.js.map} +0 -0
  150. /package/dist/{setup-custom-api-IZJDTTGF.js.map → setup-custom-api-U2STU4Z2.js.map} +0 -0
  151. /package/dist/{setup-data-dir-Z4ZQTRTH.js.map → setup-data-dir-376ODJHS.js.map} +0 -0
  152. /package/dist/{tool-memory-H6MKQFJX.js.map → tool-memory-S4HCE6NT.js.map} +0 -0
  153. /package/dist/{unified-registry-ITHFGNVT.js.map → unified-registry-2BU4BMWW.js.map} +0 -0
  154. /package/dist/{weather-report-RXFQNN3D.js.map → weather-report-KBF6NSFM.js.map} +0 -0
@@ -5,6 +5,7 @@ import {
5
5
  ERROR_FLOOR_FRACTION,
6
6
  NOOP_NOTIFIER,
7
7
  ProposalSchema,
8
+ RETIRED_CONSENSUS_STRATEGY_MESSAGE,
8
9
  SUPERMAJORITY_THRESHOLD,
9
10
  VOTING_THRESHOLDS,
10
11
  VoteSchema,
@@ -18,27 +19,26 @@ import {
18
19
  toSdkCallbackWithTimeoutCheck,
19
20
  toolStructuredError,
20
21
  toolSuccess,
21
- toolSuccessStructured,
22
22
  withProgressHeartbeat,
23
23
  wrapToolWithTimeout
24
- } from "./chunk-CPG2YZ44.js";
24
+ } from "./chunk-MAWUWFGW.js";
25
25
  import {
26
26
  getToolMemory
27
- } from "./chunk-KJI4SNSK.js";
27
+ } from "./chunk-HML33XXW.js";
28
28
  import {
29
29
  allOf
30
30
  } from "./chunk-EZNIYU5T.js";
31
31
  import {
32
32
  VERSION
33
- } from "./chunk-DKO2UVFI.js";
33
+ } from "./chunk-T6AF7LN3.js";
34
34
  import {
35
35
  isGatewayModelAdapter
36
- } from "./chunk-BGHKG77F.js";
36
+ } from "./chunk-QQKCEEIZ.js";
37
37
  import {
38
38
  ModelBoundAdapter,
39
39
  createEvent,
40
40
  getGlobalRegistry
41
- } from "./chunk-UBFCQKFZ.js";
41
+ } from "./chunk-RC2Q4UQE.js";
42
42
  import {
43
43
  UNVERIFIABLE_STDERR_RE,
44
44
  classifyUnverifiable,
@@ -46,24 +46,24 @@ import {
46
46
  getAvailableClis,
47
47
  isAbsentSeat,
48
48
  markUnverifiable
49
- } from "./chunk-LSZKWDCP.js";
49
+ } from "./chunk-J47IMTBW.js";
50
50
  import {
51
51
  ensureGatewayDiscovered
52
- } from "./chunk-OXCREJDI.js";
52
+ } from "./chunk-Z56THMPG.js";
53
53
  import {
54
54
  delay,
55
55
  getAbortObservation,
56
56
  sleep,
57
57
  withTimeout
58
- } from "./chunk-TMMPWFO2.js";
58
+ } from "./chunk-MC36BXHL.js";
59
59
  import {
60
60
  getDefaultCliCircuitBreakerRegistry
61
- } from "./chunk-IIMSXW5L.js";
61
+ } from "./chunk-SAHVCQFW.js";
62
62
  import {
63
63
  sanitizeErrorDetails,
64
64
  sanitizeOutput,
65
65
  sanitizeStringLeaves
66
- } from "./chunk-R77KXHK4.js";
66
+ } from "./chunk-OUS7OK67.js";
67
67
  import {
68
68
  AgentError,
69
69
  DecisionCostStore,
@@ -112,12 +112,13 @@ import {
112
112
  readVoteRecords,
113
113
  recordUsageEvent,
114
114
  registerPersistentOutcomeStoreFactory,
115
+ resolveInsideRoot,
115
116
  resolveModelIdentitySync,
116
117
  resolveVoteRecordsPath,
117
118
  servedCostDetail,
118
119
  stepBus,
119
120
  voteRecordWriteFailedMessage
120
- } from "./chunk-5BRDJZ4X.js";
121
+ } from "./chunk-62HV44OV.js";
121
122
  import {
122
123
  ensureLearningDir,
123
124
  getOutcomesFile
@@ -140,72 +141,9 @@ import {
140
141
 
141
142
  // src/mcp/tools/consensus-vote.ts
142
143
  import { randomUUID as randomUUID4 } from "node:crypto";
144
+ import { basename as basename2 } from "node:path";
143
145
  import { z as z15 } from "zod";
144
146
 
145
- // src/mcp/tools/async-dispatch-input.ts
146
- import { z } from "zod";
147
- var DISPATCH_MODES = ["sync", "async"];
148
- var MODE_ALIAS_REMOVAL_ISSUE = "#6225";
149
- var DISPATCH_DESCRIPTION = "Async dispatch (#4968). 'sync' (default): run inline and return the result. 'async': return { status: 'pending', jobId } immediately and run in the background; poll get_job_result({ jobId }).";
150
- var WRONG_KEY_MODE_MESSAGE = '`mode` is not the async switch on this tool; send `dispatch: "async"` (or "sync") instead (#4968).';
151
- function dispatchModeConflictMessage(dispatch, mode) {
152
- return `\`dispatch: "${dispatch}"\` and \`mode: "${mode}"\` disagree; send only \`dispatch\` (\`mode\` is a deprecated alias, removed in ${MODE_ALIAS_REMOVAL_ISSUE}).`;
153
- }
154
- function describeDispatch(note) {
155
- return note === void 0 ? DISPATCH_DESCRIPTION : `${DISPATCH_DESCRIPTION} ${note}`;
156
- }
157
- function dispatchField(note) {
158
- return z.enum(DISPATCH_MODES).optional().describe(describeDispatch(note));
159
- }
160
- function dispatchFieldDefaultSync(note) {
161
- return z.enum(DISPATCH_MODES).default("sync").describe(describeDispatch(note));
162
- }
163
- var REJECTED_MODE_KEY = z.never({ error: WRONG_KEY_MODE_MESSAGE }).optional().describe(
164
- "Not an input of this tool. The async switch is `dispatch`; `mode: 'async'` is rejected (#4968)."
165
- );
166
- function asyncDispatchInput(note) {
167
- return { dispatch: dispatchField(note), mode: REJECTED_MODE_KEY };
168
- }
169
- function asyncDispatchInputDefaultSync(note) {
170
- return { dispatch: dispatchFieldDefaultSync(note), mode: REJECTED_MODE_KEY };
171
- }
172
- function modeEnumErrorNamingDispatch(issue) {
173
- return isDispatchMode(issue.input) ? WRONG_KEY_MODE_MESSAGE : void 0;
174
- }
175
- function isDispatchMode(value) {
176
- return value === "sync" || value === "async";
177
- }
178
- var DEPRECATED_MODE_ALIAS_INPUT = {
179
- dispatch: dispatchField(),
180
- mode: z.enum(DISPATCH_MODES).optional().describe(
181
- `DEPRECATED alias of \`dispatch\` (removed in the next major, ${MODE_ALIAS_REMOVAL_ISSUE}). Send \`dispatch\` instead; a call that sends only \`mode\` still works and returns a deprecation warning.`
182
- )
183
- };
184
- function refineDispatchModeAgreement(value, ctx) {
185
- if (value.dispatch === void 0 || value.mode === void 0) return;
186
- if (value.dispatch === value.mode) return;
187
- ctx.addIssue({
188
- code: "custom",
189
- path: ["dispatch"],
190
- message: dispatchModeConflictMessage(value.dispatch, value.mode)
191
- });
192
- }
193
- function resolveDispatch(input) {
194
- return input.dispatch ?? input.mode;
195
- }
196
- function deprecatedModeWarning(input) {
197
- if (input.mode === void 0 || input.dispatch !== void 0) return void 0;
198
- return `\`mode: "${input.mode}"\` is deprecated; send \`dispatch: "${input.mode}"\`. \`mode\` is removed in the next major (${MODE_ALIAS_REMOVAL_ISSUE}).`;
199
- }
200
- var WARNINGS_META_KEY = "nexus-agents/warnings";
201
- function withWarnings(result, warnings) {
202
- const present = warnings.filter((w) => w !== void 0);
203
- if (present.length === 0) return result;
204
- const existing = result._meta?.[WARNINGS_META_KEY];
205
- const prior = Array.isArray(existing) ? existing.filter((w) => typeof w === "string") : [];
206
- return { ...result, _meta: { ...result._meta, [WARNINGS_META_KEY]: [...prior, ...present] } };
207
- }
208
-
209
147
  // src/cli/voter-roles.ts
210
148
  var VOTER_ROLES = {
211
149
  architect: "Software Architect - evaluates technical design, scalability, and maintainability",
@@ -823,7 +761,7 @@ var SIMULATED_VOTE_REASONING = {
823
761
  };
824
762
 
825
763
  // src/cli/voter-response.ts
826
- import { z as z2 } from "zod";
764
+ import { z } from "zod";
827
765
 
828
766
  // src/consensus/option-tally.ts
829
767
  var SUPERMAJORITY_SHARE = 2 / 3;
@@ -883,26 +821,26 @@ var SyntheticVoteError = class extends Error {
883
821
  }
884
822
  rawOutput;
885
823
  };
886
- var RawFindingSchema = z2.object({
887
- summary: z2.string().min(1).max(500).describe("One-line summary of the issue"),
888
- location: z2.string().min(1).max(200).describe("path/file.ext:line"),
889
- severity: z2.enum(["critical", "high", "medium", "low", "info"]).default("medium"),
890
- gate: z2.object({
891
- reread_cited_line: z2.enum(["passed", "failed", "skipped"]).default("skipped"),
892
- traced_call_path: z2.enum(["passed", "failed", "skipped"]).default("skipped"),
893
- named_assertion: z2.string().default("").describe("Concrete failing assertion \u2014 substantive, not a rubber-stamp word"),
894
- ruled_out_language_non_issue: z2.enum(["passed", "failed", "skipped"]).default("skipped")
824
+ var RawFindingSchema = z.object({
825
+ summary: z.string().min(1).max(500).describe("One-line summary of the issue"),
826
+ location: z.string().min(1).max(200).describe("path/file.ext:line"),
827
+ severity: z.enum(["critical", "high", "medium", "low", "info"]).default("medium"),
828
+ gate: z.object({
829
+ reread_cited_line: z.enum(["passed", "failed", "skipped"]).default("skipped"),
830
+ traced_call_path: z.enum(["passed", "failed", "skipped"]).default("skipped"),
831
+ named_assertion: z.string().default("").describe("Concrete failing assertion \u2014 substantive, not a rubber-stamp word"),
832
+ ruled_out_language_non_issue: z.enum(["passed", "failed", "skipped"]).default("skipped")
895
833
  }),
896
- claim: z2.string().min(1).max(2e3).describe("What is wrong and why it justifies blocking")
834
+ claim: z.string().min(1).max(2e3).describe("What is wrong and why it justifies blocking")
897
835
  });
898
- var VoteResponseSchema = z2.object({
899
- decision: z2.enum(["approve", "reject", "abstain"]).describe("Your vote decision"),
900
- reasoning: z2.string().min(10).max(4e3).describe("Explanation for your vote (10-4000 chars)"),
901
- confidence: z2.number().min(0).max(1).describe("Confidence level 0-1"),
902
- conditions: z2.array(z2.string()).optional().describe("Optional conditions for approval"),
836
+ var VoteResponseSchema = z.object({
837
+ decision: z.enum(["approve", "reject", "abstain"]).describe("Your vote decision"),
838
+ reasoning: z.string().min(10).max(4e3).describe("Explanation for your vote (10-4000 chars)"),
839
+ confidence: z.number().min(0).max(1).describe("Confidence level 0-1"),
840
+ conditions: z.array(z.string()).optional().describe("Optional conditions for approval"),
903
841
  /** Structured rejection categories for reject→refine→re-vote loops (Issue #1213). */
904
- rejectionCategories: z2.array(
905
- z2.enum([
842
+ rejectionCategories: z.array(
843
+ z.enum([
906
844
  "YAGNI",
907
845
  "DRY_VIOLATION",
908
846
  "OVER_ENGINEERING",
@@ -914,11 +852,11 @@ var VoteResponseSchema = z2.object({
914
852
  ).optional().describe("Rejection reason categories when decision is reject"),
915
853
  /** Top-level structured findings for PR-review mode (#2245 v4 follow-up).
916
854
  * Replaces the YAML-in-reasoning encoding that proved lossy. */
917
- findings: z2.array(RawFindingSchema).optional().describe("Structured findings (PR review only)"),
855
+ findings: z.array(RawFindingSchema).optional().describe("Structured findings (PR review only)"),
918
856
  /** Chosen option when the proposal declared `options` (#4472). Validated
919
857
  * against the declared list by the caller; an unmatched value is dropped
920
858
  * rather than recorded, so a parse miss surfaces as absent. */
921
- selectedOption: z2.string().optional().describe("Which declared option you choose")
859
+ selectedOption: z.string().optional().describe("Which declared option you choose")
922
860
  });
923
861
  var VOTE_JSON_SCHEMA = {
924
862
  type: "object",
@@ -2400,12 +2338,60 @@ async function collectRealVotes(options) {
2400
2338
  return results;
2401
2339
  }
2402
2340
 
2341
+ // src/cli/vote-artifact.ts
2342
+ import { createHash } from "node:crypto";
2343
+ import { constants } from "node:fs";
2344
+ import { open } from "node:fs/promises";
2345
+ import { basename } from "node:path";
2346
+ var MAX_VOTE_ARTIFACT_BYTES = 256 * 1024;
2347
+ function oversizedArtifact(bytes) {
2348
+ return new Error(
2349
+ `Vote artifact is ${String(bytes)} bytes; cap is ${String(MAX_VOTE_ARTIFACT_BYTES)} bytes`
2350
+ );
2351
+ }
2352
+ async function readBoundedArtifact(artifactPath) {
2353
+ const file = await open(artifactPath, constants.O_RDONLY | constants.O_NONBLOCK);
2354
+ try {
2355
+ const stat = await file.stat();
2356
+ if (!stat.isFile()) throw new Error("Vote artifact must be a regular file");
2357
+ if (stat.size > MAX_VOTE_ARTIFACT_BYTES) throw oversizedArtifact(stat.size);
2358
+ const buffer = Buffer.alloc(MAX_VOTE_ARTIFACT_BYTES + 1);
2359
+ let size = 0;
2360
+ while (size < buffer.length) {
2361
+ const { bytesRead } = await file.read(buffer, size, buffer.length - size, null);
2362
+ if (bytesRead === 0) break;
2363
+ size += bytesRead;
2364
+ }
2365
+ if (size > MAX_VOTE_ARTIFACT_BYTES) {
2366
+ throw oversizedArtifact(Math.max(size, (await file.stat()).size));
2367
+ }
2368
+ return buffer.subarray(0, size);
2369
+ } finally {
2370
+ await file.close();
2371
+ }
2372
+ }
2373
+ async function inlineVoteArtifact(proposal, artifactPath, displayName) {
2374
+ if (artifactPath === void 0) return proposal;
2375
+ const bytes = await readBoundedArtifact(artifactPath);
2376
+ if (bytes.length === 0) throw new Error("Vote artifact is empty; an artifact must have content");
2377
+ if (bytes.includes(0)) throw new Error("Vote artifact is binary (contains a NUL byte)");
2378
+ const content = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(bytes);
2379
+ const digest = createHash("sha256").update(bytes).digest("hex");
2380
+ const header = `Artifact: ${displayName ?? basename(artifactPath)} sha256:${digest} ${String(bytes.length)} bytes`;
2381
+ return `${proposal}
2382
+
2383
+ ${header}
2384
+ ===== BEGIN ARTIFACT =====
2385
+ ${content}
2386
+ ===== END ARTIFACT =====`;
2387
+ }
2388
+
2403
2389
  // src/cli/voter-project.ts
2404
2390
  import { readFileSync, statSync } from "node:fs";
2405
2391
  import { dirname, isAbsolute, join, resolve } from "node:path";
2406
- import { z as z3 } from "zod";
2392
+ import { z as z2 } from "zod";
2407
2393
  var VOTER_PROJECT_PATTERN = /^[A-Za-z0-9._/@-]{1,200}$/;
2408
- var VoterProjectInputSchema = z3.string().regex(VOTER_PROJECT_PATTERN).optional().describe(
2394
+ var VoterProjectInputSchema = z2.string().regex(VOTER_PROJECT_PATTERN).optional().describe(
2409
2395
  "The project the panel is judging (#6110), e.g. `acme/widgets` \u2014 it replaces `nexus-agents` in every voter's system prompt, so a consuming repository is not judged against this one's mission and governance files. When omitted the name is DERIVED from the server's working directory (the `origin` remote as `owner/repo`, else the nearest `package.json` name) and falls back to `nexus-agents`; the response discloses which on `project.source`. Letters, digits and `._/@-` only, at most 200 characters."
2410
2396
  );
2411
2397
  var MAX_ANCESTOR_DEPTH = 64;
@@ -2538,10 +2524,9 @@ var STRATEGY_TO_OPTION_THRESHOLD = {
2538
2524
  unanimous: "unanimous",
2539
2525
  supermajority: "supermajority",
2540
2526
  simple_majority: "majority",
2541
- // higher_order and proof_of_learning aggregate differently; they are gated at
2527
+ // Higher-order strategies aggregate differently; they are gated at
2542
2528
  // the majority bar so a declared-option split still cannot pass unnoticed.
2543
2529
  higher_order: "majority",
2544
- proof_of_learning: "majority",
2545
2530
  opinion_wise: "majority"
2546
2531
  };
2547
2532
  function optionThresholdFor(strategy, legacyThreshold) {
@@ -2571,40 +2556,40 @@ function describeVeto(verdict) {
2571
2556
  }
2572
2557
 
2573
2558
  // src/consensus/types-voting-protocol.ts
2574
- import { z as z4 } from "zod";
2559
+ import { z as z3 } from "zod";
2575
2560
  var VOTING_ROUND_DEFAULT_TIMEOUT_MS = OPERATION_CLASSES["multi-llm-panel"].guardMs;
2576
- var VotingRoundPhaseSchema = z4.enum(["analysis", "deliberation", "consensus"]);
2577
- var VotingRoundStatusSchema = z4.enum([
2561
+ var VotingRoundPhaseSchema = z3.enum(["analysis", "deliberation", "consensus"]);
2562
+ var VotingRoundStatusSchema = z3.enum([
2578
2563
  "pending",
2579
2564
  "in_progress",
2580
2565
  "awaiting_votes",
2581
2566
  "completed",
2582
2567
  "aborted"
2583
2568
  ]);
2584
- var AgentFindingSchema = z4.object({
2585
- agentId: z4.string(),
2586
- category: z4.enum(["bug", "security", "performance", "style", "design", "documentation", "other"]),
2587
- severity: z4.enum(["critical", "major", "minor", "suggestion"]),
2588
- description: z4.string().min(1),
2589
- location: z4.string().optional().describe("File path and line range if applicable"),
2590
- suggestion: z4.string().optional().describe("Recommended fix"),
2591
- confidence: z4.number().min(0).max(1),
2592
- timestamp: z4.iso.datetime().optional()
2569
+ var AgentFindingSchema = z3.object({
2570
+ agentId: z3.string(),
2571
+ category: z3.enum(["bug", "security", "performance", "style", "design", "documentation", "other"]),
2572
+ severity: z3.enum(["critical", "major", "minor", "suggestion"]),
2573
+ description: z3.string().min(1),
2574
+ location: z3.string().optional().describe("File path and line range if applicable"),
2575
+ suggestion: z3.string().optional().describe("Recommended fix"),
2576
+ confidence: z3.number().min(0).max(1),
2577
+ timestamp: z3.iso.datetime().optional()
2593
2578
  });
2594
- var FindingVoteSchema = z4.object({
2595
- agentId: z4.string(),
2596
- findingId: z4.string(),
2597
- agree: z4.boolean(),
2598
- reasoning: z4.string().optional(),
2599
- amendedSeverity: z4.enum(["critical", "major", "minor", "suggestion"]).optional()
2579
+ var FindingVoteSchema = z3.object({
2580
+ agentId: z3.string(),
2581
+ findingId: z3.string(),
2582
+ agree: z3.boolean(),
2583
+ reasoning: z3.string().optional(),
2584
+ amendedSeverity: z3.enum(["critical", "major", "minor", "suggestion"]).optional()
2600
2585
  });
2601
- var VotingProtocolConfigSchema = z4.object({
2602
- committeeSize: z4.number().int().min(2).max(7).default(3),
2603
- maxRounds: z4.number().int().min(1).max(5).default(3),
2604
- roundTimeoutMs: z4.number().int().positive().default(VOTING_ROUND_DEFAULT_TIMEOUT_MS),
2605
- agreementThreshold: z4.number().min(0.5).max(1).default(SUPERMAJORITY_THRESHOLD),
2606
- enableAntiSycophancy: z4.boolean().default(true),
2607
- sycophancyThreshold: z4.number().min(0).max(1).default(0.8)
2586
+ var VotingProtocolConfigSchema = z3.object({
2587
+ committeeSize: z3.number().int().min(2).max(7).default(3),
2588
+ maxRounds: z3.number().int().min(1).max(5).default(3),
2589
+ roundTimeoutMs: z3.number().int().positive().default(VOTING_ROUND_DEFAULT_TIMEOUT_MS),
2590
+ agreementThreshold: z3.number().min(0.5).max(1).default(SUPERMAJORITY_THRESHOLD),
2591
+ enableAntiSycophancy: z3.boolean().default(true),
2592
+ sycophancyThreshold: z3.number().min(0).max(1).default(0.8)
2608
2593
  });
2609
2594
  var DEFAULT_VOTING_PROTOCOL_CONFIG = {
2610
2595
  committeeSize: 3,
@@ -2617,30 +2602,30 @@ var DEFAULT_VOTING_PROTOCOL_CONFIG = {
2617
2602
  };
2618
2603
 
2619
2604
  // src/consensus/types-weighted-voting.ts
2620
- import { z as z5 } from "zod";
2621
- var TaskOutcomeStatusSchema = z5.enum(["success", "failure", "partial", "unknown"]);
2622
- var WeightedAgentRecordSchema = z5.object({
2623
- agentId: z5.string().min(1),
2624
- totalTasks: z5.number().int().nonnegative(),
2625
- successfulTasks: z5.number().int().nonnegative(),
2626
- failedTasks: z5.number().int().nonnegative(),
2627
- partialTasks: z5.number().int().nonnegative(),
2628
- successRate: z5.number().min(0).max(1),
2629
- weight: z5.number().min(0).max(1),
2630
- trustScore: z5.number().min(0).max(1),
2631
- byzantineFlags: z5.number().int().nonnegative(),
2632
- lastActive: z5.date(),
2633
- createdAt: z5.date()
2605
+ import { z as z4 } from "zod";
2606
+ var TaskOutcomeStatusSchema = z4.enum(["success", "failure", "partial", "unknown"]);
2607
+ var WeightedAgentRecordSchema = z4.object({
2608
+ agentId: z4.string().min(1),
2609
+ totalTasks: z4.number().int().nonnegative(),
2610
+ successfulTasks: z4.number().int().nonnegative(),
2611
+ failedTasks: z4.number().int().nonnegative(),
2612
+ partialTasks: z4.number().int().nonnegative(),
2613
+ successRate: z4.number().min(0).max(1),
2614
+ weight: z4.number().min(0).max(1),
2615
+ trustScore: z4.number().min(0).max(1),
2616
+ byzantineFlags: z4.number().int().nonnegative(),
2617
+ lastActive: z4.date(),
2618
+ createdAt: z4.date()
2634
2619
  });
2635
- var WeightedVotingConfigSchema = z5.object({
2636
- minWeight: z5.number().min(0).max(1).default(0.1),
2637
- maxByzantineFraction: z5.number().min(0).max(0.5).default(0.33),
2638
- weightDecayFactor: z5.number().min(0.5).max(1).default(0.9),
2639
- weightRecoveryFactor: z5.number().min(1).max(2).default(1.05),
2640
- minTrustScore: z5.number().min(0).max(1).default(0.3),
2641
- byzantineFlagThreshold: z5.number().int().positive().default(3),
2642
- initialWeight: z5.number().min(0).max(1).default(0.5),
2643
- quorumThreshold: z5.number().min(0.5).max(1).default(SUPERMAJORITY_THRESHOLD)
2620
+ var WeightedVotingConfigSchema = z4.object({
2621
+ minWeight: z4.number().min(0).max(1).default(0.1),
2622
+ maxByzantineFraction: z4.number().min(0).max(0.5).default(0.33),
2623
+ weightDecayFactor: z4.number().min(0.5).max(1).default(0.9),
2624
+ weightRecoveryFactor: z4.number().min(1).max(2).default(1.05),
2625
+ minTrustScore: z4.number().min(0).max(1).default(0.3),
2626
+ byzantineFlagThreshold: z4.number().int().positive().default(3),
2627
+ initialWeight: z4.number().min(0).max(1).default(0.5),
2628
+ quorumThreshold: z4.number().min(0.5).max(1).default(SUPERMAJORITY_THRESHOLD)
2644
2629
  });
2645
2630
  var DEFAULT_WEIGHTED_VOTING_CONFIG = {
2646
2631
  minWeight: 0.1,
@@ -2655,7 +2640,7 @@ var DEFAULT_WEIGHTED_VOTING_CONFIG = {
2655
2640
  };
2656
2641
 
2657
2642
  // src/consensus/higher-order-types.ts
2658
- import { z as z6 } from "zod";
2643
+ import { z as z5 } from "zod";
2659
2644
  function createAgentPairKey(agentA, agentB) {
2660
2645
  return agentA < agentB ? `${agentA}:${agentB}` : `${agentB}:${agentA}`;
2661
2646
  }
@@ -2666,84 +2651,72 @@ function parseAgentPairKey(key) {
2666
2651
  }
2667
2652
  return [parts[0], parts[1]];
2668
2653
  }
2669
- var CorrelationCoefficientSchema = z6.number().min(-1).max(1);
2670
- var IndependentSubsetSchema = z6.object({
2671
- id: z6.string(),
2672
- agentIds: z6.array(z6.string()),
2673
- independenceScore: z6.number().min(0).max(1),
2674
- pairCoverage: z6.object({
2675
- observed: z6.number().int().nonnegative(),
2676
- total: z6.number().int().nonnegative()
2654
+ var CorrelationCoefficientSchema = z5.number().min(-1).max(1);
2655
+ var IndependentSubsetSchema = z5.object({
2656
+ id: z5.string(),
2657
+ agentIds: z5.array(z5.string()),
2658
+ independenceScore: z5.number().min(0).max(1),
2659
+ pairCoverage: z5.object({
2660
+ observed: z5.number().int().nonnegative(),
2661
+ total: z5.number().int().nonnegative()
2677
2662
  }),
2678
- observationCount: z6.number().int().nonnegative()
2663
+ observationCount: z5.number().int().nonnegative()
2679
2664
  });
2680
- var VotingObservationSchema = z6.object({
2681
- proposalId: z6.string(),
2682
- agentId: z6.string(),
2683
- decision: z6.enum(["approve", "reject", "abstain"]),
2684
- confidence: z6.number().min(0).max(1),
2685
- alignedWithOutcome: z6.boolean(),
2686
- timestamp: z6.date(),
2687
- modelKey: z6.string().optional(),
2688
- observedModel: z6.string().optional()
2665
+ var VotingObservationSchema = z5.object({
2666
+ proposalId: z5.string(),
2667
+ agentId: z5.string(),
2668
+ decision: z5.enum(["approve", "reject", "abstain"]),
2669
+ confidence: z5.number().min(0).max(1),
2670
+ alignedWithOutcome: z5.boolean(),
2671
+ timestamp: z5.date(),
2672
+ modelKey: z5.string().optional(),
2673
+ observedModel: z5.string().optional()
2689
2674
  });
2690
- var PairwiseVotingHistorySchema = z6.object({
2691
- pairKey: z6.string(),
2692
- jointObservations: z6.number().int().nonnegative(),
2693
- agreements: z6.number().int().nonnegative(),
2694
- disagreements: z6.number().int().nonnegative(),
2675
+ var PairwiseVotingHistorySchema = z5.object({
2676
+ pairKey: z5.string(),
2677
+ jointObservations: z5.number().int().nonnegative(),
2678
+ agreements: z5.number().int().nonnegative(),
2679
+ disagreements: z5.number().int().nonnegative(),
2695
2680
  correlation: CorrelationCoefficientSchema,
2696
- lastUpdated: z6.date()
2681
+ lastUpdated: z5.date()
2697
2682
  });
2698
- var HigherOrderVotingConfigSchema = z6.object({
2699
- minObservationsForCorrelation: z6.number().int().positive().default(10),
2700
- correlationThreshold: z6.number().min(0).max(1).default(0.3),
2701
- /**
2702
- * @deprecated Ignored since 8.x: correlation evidence is lifetime and partitioned by the role's pinned model (#5555); nothing reads this value. Removed in the next major (#5564).
2703
- */
2704
- correlationMaxAgeMs: z6.number().int().positive().default(864e5),
2705
- // 24 hours
2706
- independenceThreshold: z6.number().min(0).max(1).default(0.2),
2707
- fallbackToSimpleVoting: z6.boolean().default(true),
2708
- /**
2709
- * @deprecated Ignored since 8.x: correlation evidence is lifetime and partitioned by the role's pinned model (#5555); nothing reads this value. Removed in the next major (#5564).
2710
- */
2711
- observationDecayFactor: z6.number().min(0).max(1).default(0.95),
2712
- maxObservationsPerAgent: z6.number().int().positive().default(1e3),
2713
- maxProposals: z6.number().int().positive().default(5e3),
2714
- maxTrackedPairs: z6.number().int().positive().default(100)
2683
+ var HigherOrderVotingConfigSchema = z5.object({
2684
+ minObservationsForCorrelation: z5.number().int().positive().default(10),
2685
+ correlationThreshold: z5.number().min(0).max(1).default(0.3),
2686
+ independenceThreshold: z5.number().min(0).max(1).default(0.2),
2687
+ fallbackToSimpleVoting: z5.boolean().default(true),
2688
+ maxObservationsPerAgent: z5.number().int().positive().default(1e3),
2689
+ maxProposals: z5.number().int().positive().default(5e3),
2690
+ maxTrackedPairs: z5.number().int().positive().default(100)
2715
2691
  });
2716
2692
  var DEFAULT_HIGHER_ORDER_CONFIG = {
2717
2693
  minObservationsForCorrelation: 10,
2718
2694
  correlationThreshold: 0.3,
2719
- correlationMaxAgeMs: 864e5,
2720
- // 24 hours
2721
2695
  independenceThreshold: 0.2,
2722
2696
  fallbackToSimpleVoting: true,
2723
- observationDecayFactor: 0.95,
2724
2697
  maxObservationsPerAgent: 1e3,
2725
2698
  maxProposals: 5e3,
2726
2699
  maxTrackedPairs: 100
2727
2700
  };
2728
- var HigherOrderVotingResultSchema = z6.object({
2729
- decision: z6.enum(["approve", "reject", "no_consensus"]),
2730
- posteriorApproval: z6.number().min(0).max(1),
2731
- posteriorRejection: z6.number().min(0).max(1),
2732
- effectiveVoteCount: z6.number().nonnegative(),
2733
- usedCorrelationData: z6.boolean(),
2734
- method: z6.enum(["ow", "isp", "simple"]),
2735
- improvementOverBaseline: z6.number(),
2736
- independentSubsets: z6.array(IndependentSubsetSchema).optional(),
2737
- downweightedAgents: z6.array(z6.string()),
2738
- reasoning: z6.string()
2701
+ var HigherOrderVotingResultSchema = z5.object({
2702
+ decision: z5.enum(["approve", "reject", "no_consensus"]),
2703
+ posteriorApproval: z5.number().min(0).max(1),
2704
+ posteriorRejection: z5.number().min(0).max(1),
2705
+ effectiveVoteCount: z5.number().nonnegative(),
2706
+ usedCorrelationData: z5.boolean(),
2707
+ method: z5.enum(["ow", "isp", "simple"]),
2708
+ improvementOverBaseline: z5.number(),
2709
+ independentSubsets: z5.array(IndependentSubsetSchema).optional(),
2710
+ downweightedAgents: z5.array(z5.string()),
2711
+ reasoning: z5.string()
2739
2712
  });
2740
- var CorrelationTrackerStatsSchema = z6.object({
2741
- totalAgents: z6.number().int().nonnegative(),
2742
- trackedPairs: z6.number().int().nonnegative(),
2743
- totalObservations: z6.number().int().nonnegative(),
2744
- averageCorrelation: z6.number(),
2745
- independentSubsetCount: z6.number().int().nonnegative(),
2746
- pairsWithSufficientData: z6.number().int().nonnegative()
2713
+ var CorrelationTrackerStatsSchema = z5.object({
2714
+ totalAgents: z5.number().int().nonnegative(),
2715
+ trackedPairs: z5.number().int().nonnegative(),
2716
+ totalObservations: z5.number().int().nonnegative(),
2717
+ averageCorrelation: z5.number(),
2718
+ independentSubsetCount: z5.number().int().nonnegative(),
2719
+ pairsWithSufficientData: z5.number().int().nonnegative()
2747
2720
  });
2748
2721
 
2749
2722
  // src/consensus/higher-order-helpers.ts
@@ -3216,14 +3189,6 @@ function resolveVoteDecision(input, result, errorCount) {
3216
3189
  }
3217
3190
 
3218
3191
  // src/consensus/strategies.ts
3219
- function deriveWeightBasis(votes, weights) {
3220
- let withRecord = 0;
3221
- for (const agentId of votes.keys()) {
3222
- if (weights.has(agentId)) withRecord++;
3223
- }
3224
- if (withRecord === 0) return "unweighted";
3225
- return withRecord === votes.size ? "performance" : "partial";
3226
- }
3227
3192
  var BaseVotingStrategy = class {
3228
3193
  /**
3229
3194
  * Count votes by decision type.
@@ -3247,31 +3212,6 @@ var BaseVotingStrategy = class {
3247
3212
  }
3248
3213
  return { approve, reject, abstain, total: votes.size };
3249
3214
  }
3250
- /**
3251
- * Calculate weighted vote counts using agent performance weights.
3252
- */
3253
- countWeightedVotes(votes, weights) {
3254
- let approve = 0;
3255
- let reject = 0;
3256
- let abstain = 0;
3257
- let totalWeight = 0;
3258
- for (const [agentId, vote] of votes.entries()) {
3259
- const weight = weights.get(agentId) ?? 1;
3260
- totalWeight += weight;
3261
- switch (vote.decision) {
3262
- case "approve":
3263
- approve += weight;
3264
- break;
3265
- case "reject":
3266
- reject += weight;
3267
- break;
3268
- case "abstain":
3269
- abstain += weight;
3270
- break;
3271
- }
3272
- }
3273
- return { approve, reject, abstain, totalWeight };
3274
- }
3275
3215
  };
3276
3216
  var SimpleMajorityStrategy = class extends BaseVotingStrategy {
3277
3217
  algorithm = "simple_majority";
@@ -3367,61 +3307,7 @@ var UnanimousStrategy = class extends BaseVotingStrategy {
3367
3307
  };
3368
3308
  }
3369
3309
  };
3370
- var ProofOfLearningStrategy = class extends BaseVotingStrategy {
3371
- algorithm = "proof_of_learning";
3372
- calculateOutcome(votes, weights) {
3373
- const counts = this.countVotes(votes);
3374
- const effectiveWeights = weights ?? /* @__PURE__ */ new Map();
3375
- const weightedCounts = this.countWeightedVotes(votes, effectiveWeights);
3376
- const threshold = VOTING_THRESHOLDS.proof_of_learning;
3377
- const votingWeight = weightedCounts.approve + weightedCounts.reject;
3378
- if (votingWeight === 0) {
3379
- return {
3380
- approved: false,
3381
- approvalPercentage: 0,
3382
- voteCounts: counts,
3383
- weightedCounts,
3384
- reason: "No weighted votes cast (excluding abstentions)"
3385
- };
3386
- }
3387
- const { approved, approvalPercentage } = evaluateThreshold(
3388
- weightedCounts.approve,
3389
- votingWeight,
3390
- threshold,
3391
- false
3392
- );
3393
- const weightBasis = deriveWeightBasis(votes, effectiveWeights);
3394
- const verdict = approved ? "Approved" : "Rejected";
3395
- return {
3396
- approved,
3397
- approvalPercentage,
3398
- voteCounts: counts,
3399
- weightedCounts,
3400
- weightBasis,
3401
- reason: `${verdict} with ${approvalPercentage.toFixed(1)}% ${describeBasis(weightBasis)}`
3402
- };
3403
- }
3404
- };
3405
- function describeBasis(basis) {
3406
- switch (basis) {
3407
- case "performance":
3408
- return "weighted approval (weights from voter performance history)";
3409
- case "partial":
3410
- return "partly weighted approval (some voters have no performance history; those count as 1.0)";
3411
- case "unweighted":
3412
- return "approval (UNWEIGHTED \u2014 no voter performance history recorded)";
3413
- default: {
3414
- const unreachable = basis;
3415
- throw new Error(`Unhandled weight basis: ${String(unreachable)}`);
3416
- }
3417
- }
3418
- }
3419
- function calculateVoteWeight(performance) {
3420
- if (performance === void 0 || performance.totalVotes === 0) {
3421
- return 1;
3422
- }
3423
- return 0.5 + performance.successRate * 0.5;
3424
- }
3310
+ var RETIRED_ALGORITHM = "proof_of_learning";
3425
3311
  var VotingStrategyFactory = class {
3426
3312
  strategies;
3427
3313
  constructor() {
@@ -3429,7 +3315,6 @@ var VotingStrategyFactory = class {
3429
3315
  ["simple_majority", new SimpleMajorityStrategy()],
3430
3316
  ["supermajority", new SupermajorityStrategy()],
3431
3317
  ["unanimous", new UnanimousStrategy()],
3432
- ["proof_of_learning", new ProofOfLearningStrategy()],
3433
3318
  ["opinion_wise", new HigherOrderVotingStrategy()],
3434
3319
  ["higher_order", new HigherOrderVotingStrategy()]
3435
3320
  ]);
@@ -3438,6 +3323,9 @@ var VotingStrategyFactory = class {
3438
3323
  * Get a voting strategy by algorithm type.
3439
3324
  */
3440
3325
  getStrategy(algorithm) {
3326
+ if (algorithm === RETIRED_ALGORITHM) {
3327
+ throw new Error(RETIRED_CONSENSUS_STRATEGY_MESSAGE);
3328
+ }
3441
3329
  const strategy = this.strategies.get(algorithm);
3442
3330
  if (strategy === void 0) {
3443
3331
  throw new Error(`Unknown voting algorithm: ${algorithm}`);
@@ -3567,7 +3455,6 @@ var DEFAULT_PROPOSAL_CACHE_CONFIG = {
3567
3455
  var ConsensusEngine = class {
3568
3456
  proposals = /* @__PURE__ */ new Map();
3569
3457
  closedProposals = /* @__PURE__ */ new Map();
3570
- agentPerformance = /* @__PURE__ */ new Map();
3571
3458
  proposalContentCache = /* @__PURE__ */ new Map();
3572
3459
  strategyFactory;
3573
3460
  config;
@@ -3682,32 +3569,6 @@ var ConsensusEngine = class {
3682
3569
  algorithmUsage: { ...this.metrics.algorithmUsage }
3683
3570
  };
3684
3571
  }
3685
- updateAgentPerformance(agentId, wasCorrect) {
3686
- const existing = this.agentPerformance.get(agentId);
3687
- const now = getTimeProvider().nowIso();
3688
- if (existing === void 0) {
3689
- this.agentPerformance.set(agentId, {
3690
- agentId,
3691
- totalVotes: 1,
3692
- correctVotes: wasCorrect ? 1 : 0,
3693
- successRate: wasCorrect ? 1 : 0,
3694
- lastUpdated: now
3695
- });
3696
- } else {
3697
- const totalVotes = existing.totalVotes + 1;
3698
- const correctVotes = existing.correctVotes + (wasCorrect ? 1 : 0);
3699
- this.agentPerformance.set(agentId, {
3700
- agentId,
3701
- totalVotes,
3702
- correctVotes,
3703
- successRate: correctVotes / totalVotes,
3704
- lastUpdated: now
3705
- });
3706
- }
3707
- }
3708
- getAgentPerformance(agentId) {
3709
- return this.agentPerformance.get(agentId);
3710
- }
3711
3572
  getActiveProposalCount() {
3712
3573
  return this.proposals.size;
3713
3574
  }
@@ -3717,7 +3578,6 @@ var ConsensusEngine = class {
3717
3578
  proposal: { ...data, id: proposalId, createdAt: now.toISOString() },
3718
3579
  status: "voting",
3719
3580
  votes: /* @__PURE__ */ new Map(),
3720
- voteWeights: /* @__PURE__ */ new Map(),
3721
3581
  startedAt: now
3722
3582
  };
3723
3583
  }
@@ -3767,12 +3627,6 @@ var ConsensusEngine = class {
3767
3627
  ...vote,
3768
3628
  timestamp: getTimeProvider().nowIso()
3769
3629
  });
3770
- if (state.proposal.algorithm === "proof_of_learning") {
3771
- const performance = this.agentPerformance.get(agentId);
3772
- if (performance !== void 0) {
3773
- state.voteWeights.set(agentId, calculateVoteWeight(performance));
3774
- }
3775
- }
3776
3630
  this.logger.debug("Vote recorded", {
3777
3631
  proposalId: state.proposal.id,
3778
3632
  agentId,
@@ -3837,7 +3691,7 @@ var ConsensusEngine = class {
3837
3691
  }
3838
3692
  calculateOutcome(state) {
3839
3693
  const strategy = this.strategyFactory.getStrategy(state.proposal.algorithm);
3840
- const outcome = strategy.calculateOutcome(state.votes, state.voteWeights);
3694
+ const outcome = strategy.calculateOutcome(state.votes);
3841
3695
  return outcome;
3842
3696
  }
3843
3697
  /**
@@ -3847,7 +3701,7 @@ var ConsensusEngine = class {
3847
3701
  * `totalExpected = requiredVoters.length` and compared against
3848
3702
  * `VOTING_THRESHOLDS[algorithm]` directly. Every voting strategy
3849
3703
  * (`SimpleMajorityStrategy`, `SupermajorityStrategy`, `UnanimousStrategy`,
3850
- * `ProofOfLearningStrategy`) uses `approve + reject` as its denominator —
3704
+ * `HigherOrderVotingStrategy`) uses `approve + reject` as its denominator —
3851
3705
  * abstains are explicitly excluded. The two diverged whenever abstains
3852
3706
  * were present, producing wrong-winner cascades (e.g. 5-voter supermajority
3853
3707
  * with [approve, abstain, abstain, abstain, pending] cascade-rejected even
@@ -3872,8 +3726,8 @@ var ConsensusEngine = class {
3872
3726
  bestCase.set(voter, HYPOTHETICAL_APPROVE);
3873
3727
  worstCase.set(voter, HYPOTHETICAL_REJECT);
3874
3728
  }
3875
- const bestOutcome = strategy.calculateOutcome(bestCase, state.voteWeights);
3876
- const worstOutcome = strategy.calculateOutcome(worstCase, state.voteWeights);
3729
+ const bestOutcome = strategy.calculateOutcome(bestCase);
3730
+ const worstOutcome = strategy.calculateOutcome(worstCase);
3877
3731
  if (bestOutcome.approved !== worstOutcome.approved) return false;
3878
3732
  this.logger.info("Agreement cascade: outcome determined", {
3879
3733
  proposalId: state.proposal.id,
@@ -3954,7 +3808,6 @@ var ConsensusEngine = class {
3954
3808
  simple_majority: 0,
3955
3809
  supermajority: 0,
3956
3810
  unanimous: 0,
3957
- proof_of_learning: 0,
3958
3811
  opinion_wise: 0,
3959
3812
  higher_order: 0
3960
3813
  }
@@ -4030,6 +3883,7 @@ function createConsensusEngine(config, logger12) {
4030
3883
 
4031
3884
  // src/consensus/quorum-validator.ts
4032
3885
  var TIE_TOLERANCE = 1e-9;
3886
+ var RETIRED_ALGORITHM2 = "proof_of_learning";
4033
3887
  var QuorumValidator = class {
4034
3888
  logger;
4035
3889
  constructor(logger12) {
@@ -4037,6 +3891,9 @@ var QuorumValidator = class {
4037
3891
  }
4038
3892
  validateQuorum(input) {
4039
3893
  const { votes, config } = input;
3894
+ if (config.algorithm === RETIRED_ALGORITHM2) {
3895
+ return { status: "invalid", error: RETIRED_CONSENSUS_STRATEGY_MESSAGE };
3896
+ }
4040
3897
  if (votes.size === 0) {
4041
3898
  return { status: "invalid", error: "No votes provided" };
4042
3899
  }
@@ -4051,6 +3908,9 @@ var QuorumValidator = class {
4051
3908
  }
4052
3909
  getQuorumBreakdown(input) {
4053
3910
  const { votes, agentWeights, config, requiredParticipants } = input;
3911
+ if (config.algorithm === RETIRED_ALGORITHM2) {
3912
+ throw new Error(RETIRED_CONSENSUS_STRATEGY_MESSAGE);
3913
+ }
4054
3914
  const voteCounts = this.countVotes(votes);
4055
3915
  const { totalWeight, weightedCounts } = this.calculateWeights(votes, agentWeights, config);
4056
3916
  const anyWeightSupplied = [...votes.keys()].some((id) => agentWeights?.has(id) === true);
@@ -5764,24 +5624,24 @@ function createCorrelationTracker(config) {
5764
5624
  import * as fs from "node:fs";
5765
5625
 
5766
5626
  // src/consensus/correlation-persistence-records.ts
5767
- import { z as z7 } from "zod";
5768
- var PersistedVoteSchema = z7.object({
5769
- agentId: z7.string(),
5770
- decision: z7.enum(["approve", "reject", "abstain"]),
5771
- confidence: z7.number().min(0).max(1),
5772
- modelKey: z7.string().optional(),
5773
- observedModel: z7.string().optional()
5627
+ import { z as z6 } from "zod";
5628
+ var PersistedVoteSchema = z6.object({
5629
+ agentId: z6.string(),
5630
+ decision: z6.enum(["approve", "reject", "abstain"]),
5631
+ confidence: z6.number().min(0).max(1),
5632
+ modelKey: z6.string().optional(),
5633
+ observedModel: z6.string().optional()
5774
5634
  });
5775
- var PersistedProposalSchema = z7.object({
5776
- proposalId: z7.string(),
5777
- votes: z7.array(PersistedVoteSchema),
5778
- outcome: z7.enum(["approved", "rejected"]),
5779
- timestamp: z7.iso.datetime()
5635
+ var PersistedProposalSchema = z6.object({
5636
+ proposalId: z6.string(),
5637
+ votes: z6.array(PersistedVoteSchema),
5638
+ outcome: z6.enum(["approved", "rejected"]),
5639
+ timestamp: z6.iso.datetime()
5780
5640
  });
5781
- var PersistedCorrelationDataSchema = z7.object({
5782
- version: z7.number().int().positive(),
5783
- proposals: z7.array(PersistedProposalSchema),
5784
- savedAt: z7.iso.datetime()
5641
+ var PersistedCorrelationDataSchema = z6.object({
5642
+ version: z6.number().int().positive(),
5643
+ proposals: z6.array(PersistedProposalSchema),
5644
+ savedAt: z6.iso.datetime()
5785
5645
  });
5786
5646
  function createPersistedProposal(proposalId, votes, outcome, context) {
5787
5647
  const persistedVotes = [];
@@ -6025,6 +5885,36 @@ function createPersistentCorrelationTracker(config) {
6025
5885
  // src/mcp/tools/consensus-vote-types.ts
6026
5886
  import { z as z8 } from "zod";
6027
5887
 
5888
+ // src/mcp/tools/async-dispatch-input.ts
5889
+ import { z as z7 } from "zod";
5890
+ var DISPATCH_MODES = ["sync", "async"];
5891
+ var DISPATCH_DESCRIPTION = "Async dispatch (#4968). 'sync' (default): run inline and return the result. 'async': return { status: 'pending', jobId } immediately and run in the background; poll get_job_result({ jobId }).";
5892
+ var WRONG_KEY_MODE_MESSAGE = '`mode` is not the async switch on this tool; send `dispatch: "async"` (or "sync") instead (#4968).';
5893
+ function describeDispatch(note) {
5894
+ return note === void 0 ? DISPATCH_DESCRIPTION : `${DISPATCH_DESCRIPTION} ${note}`;
5895
+ }
5896
+ function dispatchField(note) {
5897
+ return z7.enum(DISPATCH_MODES).optional().describe(describeDispatch(note));
5898
+ }
5899
+ function dispatchFieldDefaultSync(note) {
5900
+ return z7.enum(DISPATCH_MODES).default("sync").describe(describeDispatch(note));
5901
+ }
5902
+ var REJECTED_MODE_KEY = z7.never({ error: WRONG_KEY_MODE_MESSAGE }).optional().describe(
5903
+ "Not an input of this tool. The async switch is `dispatch`; `mode: 'async'` is rejected (#4968)."
5904
+ );
5905
+ function asyncDispatchInput(note) {
5906
+ return { dispatch: dispatchField(note), mode: REJECTED_MODE_KEY };
5907
+ }
5908
+ function asyncDispatchInputDefaultSync(note) {
5909
+ return { dispatch: dispatchFieldDefaultSync(note), mode: REJECTED_MODE_KEY };
5910
+ }
5911
+ function modeEnumErrorNamingDispatch(issue) {
5912
+ return isDispatchMode(issue.input) ? WRONG_KEY_MODE_MESSAGE : void 0;
5913
+ }
5914
+ function isDispatchMode(value) {
5915
+ return value === "sync" || value === "async";
5916
+ }
5917
+
6028
5918
  // src/cli/vote-diversity.ts
6029
5919
  function answeringSeats(votes) {
6030
5920
  return votes.filter((v) => v.source === "llm");
@@ -6128,14 +6018,12 @@ function checkUndeclaredOptions(proposal, declaredOptions, allEngagedApproved) {
6128
6018
 
6129
6019
  // src/mcp/tools/consensus-vote-types.ts
6130
6020
  var MAX_PROPOSAL_LENGTH = 4e3;
6131
- var VotingStrategySchema = z8.enum([
6132
- "simple_majority",
6133
- "supermajority",
6134
- "unanimous",
6135
- "proof_of_learning",
6136
- "higher_order",
6137
- "opinion_wise"
6138
- ]);
6021
+ var VotingStrategySchema = z8.enum(
6022
+ ["simple_majority", "supermajority", "unanimous", "higher_order", "opinion_wise"],
6023
+ {
6024
+ error: (issue) => issue.input === "proof_of_learning" ? RETIRED_CONSENSUS_STRATEGY_MESSAGE : void 0
6025
+ }
6026
+ );
6139
6027
  function isHigherOrderStrategy(strategy) {
6140
6028
  return strategy === "higher_order" || strategy === "opinion_wise";
6141
6029
  }
@@ -6154,6 +6042,9 @@ var ConsensusVoteInputSchema = z8.object({
6154
6042
  proposal: z8.string().min(1).max(MAX_PROPOSAL_LENGTH).describe(
6155
6043
  'Proposal text to vote on. If the proposal asks voters to choose among named alternatives, declare them in `options` (#4472) \u2014 otherwise the tally records approve/reject/abstain only, so every voter who engages returns `approve` and a 6-1 split on WHICH option persists as 7-0, 100% (#4452). This is ENFORCED AS A WARNING, not a refusal: a heuristic over the proposal text flags an apparent multi-option proposal with no `options` and says so on `panelWarning` (#5360). The wording says "declare", not "MUST", because the warning is what the code actually holds \u2014 it is tightened back only in the same change that promotes the warning to a refusal.'
6156
6044
  ),
6045
+ artifactPath: z8.string().min(1).max(4096).optional().describe(
6046
+ "UTF-8 artifact file within the repository root (server cwd). Its content is inlined into every seat's proposal with a SHA-256 digest; maximum 256 KiB. Missing, empty, binary (NUL byte), oversized, and escaping paths are rejected. Seats read the inlined text, not the tree."
6047
+ ),
6157
6048
  options: z8.array(z8.string().min(1).max(200)).min(2).max(10).optional().describe(
6158
6049
  "Named alternatives for a multi-option proposal (#4472). When present, the threshold must ALSO be cleared by the leading option, in addition to the ordinary approve/reject bar: `unanimous` requires every approver to have chosen the SAME option, and `supermajority`/`majority` measure the leading option's share of approvers. An approving voter whose selection is absent or matches no declared option stays in the denominator and credits no option, so a degraded response can only lower the leading share, never raise it. Omit for an ordinary yes/no vote \u2014 behaviour is then unchanged."
6159
6050
  ),
@@ -6162,7 +6053,7 @@ var ConsensusVoteInputSchema = z8.object({
6162
6053
  "Voting threshold (legacy): majority, supermajority, unanimous. Use strategy instead."
6163
6054
  ),
6164
6055
  strategy: VotingStrategySchema.optional().describe(
6165
- "Voting strategy: simple_majority (default), supermajority, unanimous, proof_of_learning, or higher_order (a plain majority tally whose correlation analysis only triggers contrarian escalation). NOTE (#4452): thresholds are evaluated over approve/reject/abstain, not over which option a voter chose. On a multi-option proposal even `unanimous` clears trivially \u2014 see the `proposal` field description."
6056
+ "Voting strategy: simple_majority (default), supermajority, unanimous, higher_order (a plain majority tally whose correlation analysis only triggers contrarian escalation), or opinion_wise (alias of higher_order). NOTE (#4452): thresholds are evaluated over approve/reject/abstain, not over which option a voter chose. On a multi-option proposal even `unanimous` clears trivially \u2014 see the `proposal` field description."
6166
6057
  ),
6167
6058
  errorPolicy: ErrorPolicySchema.optional().describe(
6168
6059
  "How to treat voters that errored or timed out (#2630). Default: fail_closed for unanimous only; reduce_denominator for all other strategies incl. higher_order/opinion_wise (#3138 \u2014 a single infra timeout should not void an otherwise-unanimous vote). Opt-in absolute_quorum (#4132): an errored voter \u2014 especially the contrarian (catfish) \u2014 degrades the verdict to no_quorum (recoverable re-run) instead of being dropped from the denominator; never manufactures approved/rejected from an induced error. Regardless of policy, errors > 50% always fails."
@@ -6200,13 +6091,10 @@ var ConsensusVoteInputSchema = z8.object({
6200
6091
  * (`panelSize` 7). The quick-panel votes that triggered the escalation
6201
6092
  * are not included.
6202
6093
  *
6203
- * The key is `dispatch` (#4968); `mode` is the deprecated alias this tool
6204
- * used to spell it with, resolved as `dispatch ?? mode` by the handler and
6205
- * rejected when the two disagree (the `superRefine` below). Both optional
6206
- * (no `.default()`) so the inferred type doesn't force a value onto every
6207
- * existing call site / test fixture.
6094
+ * Use `dispatch`; the former `mode` alias is rejected (#6225). Omitted
6095
+ * dispatch runs synchronously.
6208
6096
  */
6209
- ...DEPRECATED_MODE_ALIAS_INPUT,
6097
+ ...asyncDispatchInput(),
6210
6098
  /**
6211
6099
  * Idempotency key for async-mode replay-safety (#3042 Stage 1c / epic
6212
6100
  * #2631). When set: identical (key, inputs) returns the existing job;
@@ -6241,8 +6129,7 @@ var ConsensusVoteInputSchema = z8.object({
6241
6129
  ratifiesPr: VoteRecordPrBindingSchema.optional().describe(
6242
6130
  "Governor-path PR ratification binding (#5130): pr is the PR number and headSha the full 40-hex head sha the panel reviewed. Bound into the authentic vote record so the committed ledger and the governor gate can verify which PR, at which head, this panel ratified. Omit for ordinary votes."
6243
6131
  )
6244
- // #4968: `dispatch` and the deprecated `mode` alias must agree when both are sent.
6245
- }).superRefine(refineDispatchModeAgreement);
6132
+ });
6246
6133
  var VoteDecisionStatusSchema = z8.enum([
6247
6134
  "approved",
6248
6135
  "rejected",
@@ -6513,7 +6400,7 @@ function logPartialProposal(bounded, log) {
6513
6400
  }
6514
6401
  async function runContrarianCheck(proposal, options, log, opts) {
6515
6402
  try {
6516
- const { executeExpert } = await import("./expert-bridge-XTTYNDBS.js");
6403
+ const { executeExpert } = await import("./expert-bridge-4QAURLMN.js");
6517
6404
  const bounded = boundArtifactForReview(proposal, CONTRARIAN_PROPOSAL_BUDGET, "proposal");
6518
6405
  logPartialProposal(bounded, log);
6519
6406
  const result = await executeExpert(
@@ -6726,7 +6613,7 @@ function jobIdSchema(description) {
6726
6613
  }
6727
6614
 
6728
6615
  // src/mcp/jobs/job-idempotency.ts
6729
- import { createHash, randomUUID as randomUUID2 } from "node:crypto";
6616
+ import { createHash as createHash2, randomUUID as randomUUID2 } from "node:crypto";
6730
6617
  import { existsSync as existsSync2, readFileSync as readFileSync4, writeFileSync } from "node:fs";
6731
6618
  import { z as z11 } from "zod";
6732
6619
  var logger6 = createLogger({ component: "job-idempotency" });
@@ -6744,7 +6631,7 @@ var IdempotencyIndexEntrySchema = z11.object({
6744
6631
  createdAt: z11.iso.datetime()
6745
6632
  });
6746
6633
  function sha256Hex(input) {
6747
- return createHash("sha256").update(input).digest("hex");
6634
+ return createHash2("sha256").update(input).digest("hex");
6748
6635
  }
6749
6636
  function canonicalJsonStringify(value) {
6750
6637
  if (value === null || typeof value !== "object") return JSON.stringify(value);
@@ -7668,6 +7555,7 @@ var VOTE_RECORD_STRATEGIES = /* @__PURE__ */ new Set([
7668
7555
  "unanimous",
7669
7556
  "higher_order",
7670
7557
  "opinion_wise",
7558
+ // Persisted history may still carry the strategy retired for new votes in 9.0 (#5234).
7671
7559
  "proof_of_learning"
7672
7560
  ]);
7673
7561
  function toRecordStrategy(strategy) {
@@ -9318,7 +9206,33 @@ async function runSyncConsensusVote(deps, notifier, args) {
9318
9206
  approvalPercentage: result.value.approvalPercentage,
9319
9207
  voteCount: result.value.votes.length
9320
9208
  });
9321
- return toolSuccessStructured({ ...result.value });
9209
+ return structuredToolSuccess(z15.object(CONSENSUS_VOTE_OUTPUT_SCHEMA), { ...result.value });
9210
+ }
9211
+ async function prepareVoteArtifact(input) {
9212
+ if (input.artifactPath === void 0) return { ok: true, value: input };
9213
+ const resolved = resolveInsideRoot(input.artifactPath);
9214
+ if (resolved === null) {
9215
+ return {
9216
+ ok: false,
9217
+ error: toolStructuredError({
9218
+ errorCategory: "permission",
9219
+ message: "Path traversal denied: artifactPath must be within the repository root."
9220
+ })
9221
+ };
9222
+ }
9223
+ try {
9224
+ const proposal = await inlineVoteArtifact(
9225
+ input.proposal,
9226
+ resolved,
9227
+ basename2(input.artifactPath)
9228
+ );
9229
+ return { ok: true, value: { ...input, proposal } };
9230
+ } catch (error) {
9231
+ return {
9232
+ ok: false,
9233
+ error: toolStructuredError({ errorCategory: "validation", message: getErrorMessage(error) })
9234
+ };
9235
+ }
9322
9236
  }
9323
9237
  function createConsensusVoteHandler(deps) {
9324
9238
  const notifier = deps.notifier ?? NOOP_NOTIFIER;
@@ -9334,31 +9248,31 @@ function createConsensusVoteHandler(deps) {
9334
9248
  const simCheck = checkSimulationAllowed("consensus_vote", ctx.logger);
9335
9249
  if (!simCheck.allowed) return simulationDeniedResult(simCheck.reason);
9336
9250
  }
9337
- const strategy = validationResult.data.strategy ?? "simple_majority";
9338
- const dispatch = resolveDispatch(validationResult.data);
9339
- const modeWarning = deprecatedModeWarning(validationResult.data);
9251
+ const prepared = await prepareVoteArtifact(validationResult.data);
9252
+ if (!prepared.ok) return prepared.error;
9253
+ const input = prepared.value;
9254
+ const strategy = input.strategy ?? "simple_majority";
9255
+ const dispatch = input.dispatch;
9340
9256
  ctx.logger.debug("Starting consensus vote", {
9341
9257
  strategy,
9342
- quickMode: validationResult.data.quickMode,
9258
+ quickMode: input.quickMode,
9343
9259
  ...dispatch !== void 0 ? { dispatch } : {}
9344
9260
  });
9345
9261
  notifier.info("consensus_vote", {
9346
9262
  event: "vote_start",
9347
- proposalLength: validationResult.data.proposal.length,
9263
+ proposalLength: input.proposal.length,
9348
9264
  strategy
9349
9265
  });
9350
9266
  if (dispatch === "async") {
9351
- const asyncResult = dispatchAsyncConsensusVote(deps, validationResult.data);
9267
+ const asyncResult = dispatchAsyncConsensusVote(deps, input);
9352
9268
  notifier.info("consensus_vote", {
9353
9269
  event: "vote_dispatched_async",
9354
- proposalLength: validationResult.data.proposal.length,
9270
+ proposalLength: input.proposal.length,
9355
9271
  strategy
9356
9272
  });
9357
- return withWarnings(asyncResult, [modeWarning]);
9273
+ return asyncResult;
9358
9274
  }
9359
- return withWarnings(await runSyncConsensusVote(deps, notifier, validationResult.data), [
9360
- modeWarning
9361
- ]);
9275
+ return runSyncConsensusVote(deps, notifier, input);
9362
9276
  };
9363
9277
  }
9364
9278
  var ASYNC_ENVELOPES = {
@@ -9520,7 +9434,7 @@ var CONSENSUS_VOTE_OUTPUT_SCHEMA = {
9520
9434
  }).optional()
9521
9435
  };
9522
9436
  var CONSENSUS_VOTE_TOOL_SCHEMA = ConsensusVoteInputSchema.shape;
9523
- var CONSENSUS_VOTE_DESCRIPTION = "Execute multi-model consensus voting on a proposal. Uses 7 roles by default (architect, security, devex, ai_ml, pm, catfish, scope_steward) or 3 with quickMode (architect, security, scope_steward), voting with configurable strategies. higher_order does NOT decide the verdict by correlation-aware aggregation (#4701): approve/reject is a simple tally of the panel, so correlated voters each carry full independent weight. The Bayesian correlation analysis is computed and feeds contrarian escalation only. Choose it for the escalation behaviour, not for a weighted verdict. Supports async dispatch (dispatch: 'async'; `mode` is a deprecated alias) \u2014 returns a jobId to poll via get_job_result. Pass ratifies=<subject> to bind an authority-ladder ratification vote into its authentic record, and ratifiesPr={pr, headSha} to bind a governor-path PR ratification to the head the panel saw (#5130); the result carries voteRecordId for the caller-commits append. If your proposal asks voters to choose among named alternatives, you MUST pass them in `options` (#4472) \u2014 the threshold is then measured over WHICH option won, and the record carries the per-option tally plus selection coverage. WITHOUT `options` the tally is approve/reject/abstain only, so every voter who engages returns `approve` and a 6-1 split on which option persists as 7-0, 100% (#4452).";
9437
+ var CONSENSUS_VOTE_DESCRIPTION = "Execute multi-model consensus voting on a proposal. Uses 7 roles by default (architect, security, devex, ai_ml, pm, catfish, scope_steward) or 3 with quickMode (architect, security, scope_steward), voting with configurable strategies. higher_order does NOT decide the verdict by correlation-aware aggregation (#4701): approve/reject is a simple tally of the panel, so correlated voters each carry full independent weight. The Bayesian correlation analysis is computed and feeds contrarian escalation only. Choose it for the escalation behaviour, not for a weighted verdict. Supports async dispatch (dispatch: 'async') \u2014 returns a jobId to poll via get_job_result. Pass ratifies=<subject> to bind an authority-ladder ratification vote into its authentic record, and ratifiesPr={pr, headSha} to bind a governor-path PR ratification to the head the panel saw (#5130); the result carries voteRecordId for the caller-commits append. If your proposal asks voters to choose among named alternatives, you MUST pass them in `options` (#4472) \u2014 the threshold is then measured over WHICH option won, and the record carries the per-option tally plus selection coverage. WITHOUT `options` the tally is approve/reject/abstain only, so every voter who engages returns `approve` and a 6-1 split on which option persists as 7-0, 100% (#4452).";
9524
9438
  function registerConsensusVoteTool(server, deps) {
9525
9439
  const logger12 = deps.logger ?? createLogger({ tool: "consensus_vote" });
9526
9440
  const notifier = deps.notifier ?? createMcpNotifier(server);
@@ -9555,11 +9469,6 @@ export {
9555
9469
  asyncDispatchInput,
9556
9470
  asyncDispatchInputDefaultSync,
9557
9471
  modeEnumErrorNamingDispatch,
9558
- DEPRECATED_MODE_ALIAS_INPUT,
9559
- refineDispatchModeAgreement,
9560
- resolveDispatch,
9561
- deprecatedModeWarning,
9562
- withWarnings,
9563
9472
  jobIdSchema,
9564
9473
  resolveIdempotency,
9565
9474
  registerIdempotentJob,
@@ -9598,6 +9507,7 @@ export {
9598
9507
  resolveAdapter,
9599
9508
  assignPanelSeats,
9600
9509
  collectRealVotes,
9510
+ inlineVoteArtifact,
9601
9511
  VoterProjectInputSchema,
9602
9512
  resolveAndLogVoterProject,
9603
9513
  VotingRoundPhaseSchema,
@@ -9626,8 +9536,6 @@ export {
9626
9536
  SimpleMajorityStrategy,
9627
9537
  SupermajorityStrategy,
9628
9538
  UnanimousStrategy,
9629
- ProofOfLearningStrategy,
9630
- calculateVoteWeight,
9631
9539
  VotingStrategyFactory,
9632
9540
  createStrategyFactory,
9633
9541
  buildPendingResult,
@@ -9669,4 +9577,4 @@ export {
9669
9577
  CONSENSUS_VOTE_TOOL_SCHEMA,
9670
9578
  registerConsensusVoteTool
9671
9579
  };
9672
- //# sourceMappingURL=chunk-J466LJ35.js.map
9580
+ //# sourceMappingURL=chunk-3KUZPBWS.js.map