nexus-agents 9.1.1 → 9.3.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 (145) hide show
  1. package/dist/{ast-rule-runner-GW3RRDDN.js → ast-rule-runner-YFDXXHJU.js} +3 -3
  2. package/dist/{child-mcp-config-AX5LNK2U.js → child-mcp-config-44M5EAYD.js} +5 -5
  3. package/dist/child-mcp-config-44M5EAYD.js.map +1 -0
  4. package/dist/{chunk-RDZ42Z3Q.js → chunk-4CTDO2Z2.js} +3 -3
  5. package/dist/{chunk-SAK2PAQD.js → chunk-4HUCHMSX.js} +2 -2
  6. package/dist/{chunk-TVUPVQXD.js → chunk-4IJII2WG.js} +57 -17
  7. package/dist/chunk-4IJII2WG.js.map +1 -0
  8. package/dist/{chunk-7TBDUW7E.js → chunk-5O4NXKPR.js} +4 -4
  9. package/dist/{chunk-ZZ63WG24.js → chunk-5T33FILA.js} +3 -3
  10. package/dist/{chunk-3NYZ5HZA.js → chunk-65XXRWUH.js} +4 -4
  11. package/dist/{chunk-KSZAEQAZ.js → chunk-6JLDPMMU.js} +4 -4
  12. package/dist/{chunk-Z5CLWX4M.js → chunk-A34ANV7R.js} +5 -5
  13. package/dist/{chunk-Y2W44LHI.js → chunk-AQ5KQTXW.js} +5 -5
  14. package/dist/{chunk-HK5DNXNV.js → chunk-B3LT4L5R.js} +5 -5
  15. package/dist/{chunk-QXBOILNV.js → chunk-BH6J6WCC.js} +2 -2
  16. package/dist/{chunk-TQJRQ3MR.js → chunk-BO46P4XJ.js} +5 -5
  17. package/dist/{chunk-YK6MGGPV.js → chunk-CUWTKYFP.js} +2 -2
  18. package/dist/{chunk-2OHARKQS.js → chunk-EUKJXKXD.js} +3 -3
  19. package/dist/{chunk-YCDDSJ6L.js → chunk-FDHT3TG7.js} +2 -2
  20. package/dist/{chunk-2JUGZWTJ.js → chunk-FWZVZME3.js} +2 -2
  21. package/dist/{chunk-CYWZ7W2C.js → chunk-GYMILOWC.js} +2 -2
  22. package/dist/{chunk-POI3L46U.js → chunk-HM37AAFX.js} +2 -2
  23. package/dist/{chunk-XA5JF2QZ.js → chunk-IZS66Q5F.js} +2 -2
  24. package/dist/{chunk-Z6LCG3ZM.js → chunk-KQJ2GAER.js} +2 -2
  25. package/dist/{chunk-KSIHEDDG.js → chunk-L54COYAN.js} +2 -2
  26. package/dist/{chunk-XSNFBUX3.js → chunk-LHOB5YF3.js} +250 -92
  27. package/dist/chunk-LHOB5YF3.js.map +1 -0
  28. package/dist/{chunk-3A24GW2T.js → chunk-NM7YEKQM.js} +6 -5
  29. package/dist/{chunk-3A24GW2T.js.map → chunk-NM7YEKQM.js.map} +1 -1
  30. package/dist/{chunk-TMCE755U.js → chunk-OQNKPJPJ.js} +3 -3
  31. package/dist/chunk-OQNKPJPJ.js.map +1 -0
  32. package/dist/{chunk-A2UFTOL3.js → chunk-P2LYE2KA.js} +4 -4
  33. package/dist/{chunk-7TLUEWRK.js → chunk-Q4L5XROB.js} +3 -3
  34. package/dist/{chunk-XMXU7EA7.js → chunk-QCNZMRJ7.js} +2 -2
  35. package/dist/{chunk-6PKIUOWP.js → chunk-QLUGDQUK.js} +13 -13
  36. package/dist/{chunk-FJ35WCE4.js → chunk-R67NA3Q5.js} +7 -7
  37. package/dist/{chunk-JU4YPMVT.js → chunk-RKSJ26NV.js} +485 -337
  38. package/dist/chunk-RKSJ26NV.js.map +1 -0
  39. package/dist/{chunk-N2BSUYFL.js → chunk-RQ3C6QEH.js} +2 -2
  40. package/dist/{chunk-NACIKSZF.js → chunk-TCKP5S3P.js} +5 -5
  41. package/dist/{chunk-IIOXL76E.js → chunk-WJDNQVQF.js} +3 -3
  42. package/dist/{chunk-MW454P5G.js → chunk-Y3OBX752.js} +8 -8
  43. package/dist/{chunk-PQWFZWDL.js → chunk-ZGSQFG4D.js} +2 -2
  44. package/dist/{cli-circuit-breaker-QDMRHG5K.js → cli-circuit-breaker-6V7RJMMF.js} +3 -3
  45. package/dist/{cli-readiness-7YQ7S2AY.js → cli-readiness-XNJQCKIH.js} +7 -7
  46. package/dist/cli.d.ts +1 -1
  47. package/dist/cli.js +44 -44
  48. package/dist/{composite-router-KWVZJE5J.js → composite-router-43L52IUP.js} +2 -2
  49. package/dist/{consensus-vote-YDKECHPF.js → consensus-vote-6HBLVWTW.js} +17 -17
  50. package/dist/{consensus-vote-types-DA_y5jja.d.ts → consensus-vote-types-q8io4acj.d.ts} +5 -0
  51. package/dist/{context-retriever-XOT3JESN.js → context-retriever-WPSI4STY.js} +8 -8
  52. package/dist/{doctor-deep-L5MCQ4RP.js → doctor-deep-6D6FG3SZ.js} +3 -3
  53. package/dist/{doctor-gateway-report-4B6KE7B5.js → doctor-gateway-report-2JOSIARQ.js} +7 -7
  54. package/dist/{doctor-live-77X66SFV.js → doctor-live-BVXUT36N.js} +11 -11
  55. package/dist/{expert-bridge-S4LEWNOQ.js → expert-bridge-E6HHFKGF.js} +4 -4
  56. package/dist/{factory-U35CCT3I.js → factory-WCUQHBSG.js} +5 -5
  57. package/dist/{factory-WHP7VBCY.js → factory-ZPOHG4M7.js} +10 -10
  58. package/dist/{improvement-review-CYK3E2J6.js → improvement-review-33VU5DAX.js} +6 -6
  59. package/dist/index.d.ts +32 -21
  60. package/dist/index.js +32 -32
  61. package/dist/index.js.map +1 -1
  62. package/dist/{init-opencode-OTTNZHKO.js → init-opencode-NQW7NG5Z.js} +6 -6
  63. package/dist/{issue-triage-WRNKM4W7.js → issue-triage-RFV3YR66.js} +6 -6
  64. package/dist/{model-config-helpers-URTK3TDT.js → model-config-helpers-KTLFA734.js} +2 -2
  65. package/dist/{openai-compat-adapter-CCYSADQL.js → openai-compat-adapter-7CITWSBH.js} +6 -6
  66. package/dist/{outcome-store-adapter-GAT6LFFD.js → outcome-store-adapter-WCY3FBQM.js} +2 -2
  67. package/dist/{pr-reviewer-helpers-ECI3O755.js → pr-reviewer-helpers-KJFNRS6R.js} +4 -4
  68. package/dist/{registry-command-ZNS2WFJ5.js → registry-command-OZLB3KYN.js} +2 -2
  69. package/dist/{repo-security-plan-FE7BKQH5.js → repo-security-plan-MOHGBKLA.js} +3 -3
  70. package/dist/{research-helpers-synthesize-ECSX4ZO2.js → research-helpers-synthesize-CKC67RSM.js} +4 -4
  71. package/dist/{routing-memory-5CW56QBY.js → routing-memory-FOMKUKKF.js} +2 -2
  72. package/dist/{session-memory-VQB3KEOW.js → session-memory-KRK2HQUF.js} +3 -3
  73. package/dist/{setup-config-3WWCV7RF.js → setup-config-A7MFKDN7.js} +3 -3
  74. package/dist/{setup-custom-api-6QJS7YUQ.js → setup-custom-api-YJ4DICAK.js} +3 -3
  75. package/dist/setup-data-dir-VNGT3GM4.js +36 -0
  76. package/dist/{tool-memory-J7HO5C7H.js → tool-memory-ZUQSBR3O.js} +5 -5
  77. package/dist/{unified-registry-JIWD7D4S.js → unified-registry-JG3QCJ5O.js} +11 -11
  78. package/dist/{weather-report-GSZVNNE2.js → weather-report-2MBDI7G2.js} +2 -2
  79. package/package.json +3 -2
  80. package/dist/child-mcp-config-AX5LNK2U.js.map +0 -1
  81. package/dist/chunk-JU4YPMVT.js.map +0 -1
  82. package/dist/chunk-TMCE755U.js.map +0 -1
  83. package/dist/chunk-TVUPVQXD.js.map +0 -1
  84. package/dist/chunk-XSNFBUX3.js.map +0 -1
  85. package/dist/setup-data-dir-4J6XKGDH.js +0 -36
  86. /package/dist/{ast-rule-runner-GW3RRDDN.js.map → ast-rule-runner-YFDXXHJU.js.map} +0 -0
  87. /package/dist/{chunk-RDZ42Z3Q.js.map → chunk-4CTDO2Z2.js.map} +0 -0
  88. /package/dist/{chunk-SAK2PAQD.js.map → chunk-4HUCHMSX.js.map} +0 -0
  89. /package/dist/{chunk-7TBDUW7E.js.map → chunk-5O4NXKPR.js.map} +0 -0
  90. /package/dist/{chunk-ZZ63WG24.js.map → chunk-5T33FILA.js.map} +0 -0
  91. /package/dist/{chunk-3NYZ5HZA.js.map → chunk-65XXRWUH.js.map} +0 -0
  92. /package/dist/{chunk-KSZAEQAZ.js.map → chunk-6JLDPMMU.js.map} +0 -0
  93. /package/dist/{chunk-Z5CLWX4M.js.map → chunk-A34ANV7R.js.map} +0 -0
  94. /package/dist/{chunk-Y2W44LHI.js.map → chunk-AQ5KQTXW.js.map} +0 -0
  95. /package/dist/{chunk-HK5DNXNV.js.map → chunk-B3LT4L5R.js.map} +0 -0
  96. /package/dist/{chunk-QXBOILNV.js.map → chunk-BH6J6WCC.js.map} +0 -0
  97. /package/dist/{chunk-TQJRQ3MR.js.map → chunk-BO46P4XJ.js.map} +0 -0
  98. /package/dist/{chunk-YK6MGGPV.js.map → chunk-CUWTKYFP.js.map} +0 -0
  99. /package/dist/{chunk-2OHARKQS.js.map → chunk-EUKJXKXD.js.map} +0 -0
  100. /package/dist/{chunk-YCDDSJ6L.js.map → chunk-FDHT3TG7.js.map} +0 -0
  101. /package/dist/{chunk-2JUGZWTJ.js.map → chunk-FWZVZME3.js.map} +0 -0
  102. /package/dist/{chunk-CYWZ7W2C.js.map → chunk-GYMILOWC.js.map} +0 -0
  103. /package/dist/{chunk-POI3L46U.js.map → chunk-HM37AAFX.js.map} +0 -0
  104. /package/dist/{chunk-XA5JF2QZ.js.map → chunk-IZS66Q5F.js.map} +0 -0
  105. /package/dist/{chunk-Z6LCG3ZM.js.map → chunk-KQJ2GAER.js.map} +0 -0
  106. /package/dist/{chunk-KSIHEDDG.js.map → chunk-L54COYAN.js.map} +0 -0
  107. /package/dist/{chunk-A2UFTOL3.js.map → chunk-P2LYE2KA.js.map} +0 -0
  108. /package/dist/{chunk-7TLUEWRK.js.map → chunk-Q4L5XROB.js.map} +0 -0
  109. /package/dist/{chunk-XMXU7EA7.js.map → chunk-QCNZMRJ7.js.map} +0 -0
  110. /package/dist/{chunk-6PKIUOWP.js.map → chunk-QLUGDQUK.js.map} +0 -0
  111. /package/dist/{chunk-FJ35WCE4.js.map → chunk-R67NA3Q5.js.map} +0 -0
  112. /package/dist/{chunk-N2BSUYFL.js.map → chunk-RQ3C6QEH.js.map} +0 -0
  113. /package/dist/{chunk-NACIKSZF.js.map → chunk-TCKP5S3P.js.map} +0 -0
  114. /package/dist/{chunk-IIOXL76E.js.map → chunk-WJDNQVQF.js.map} +0 -0
  115. /package/dist/{chunk-MW454P5G.js.map → chunk-Y3OBX752.js.map} +0 -0
  116. /package/dist/{chunk-PQWFZWDL.js.map → chunk-ZGSQFG4D.js.map} +0 -0
  117. /package/dist/{cli-circuit-breaker-QDMRHG5K.js.map → cli-circuit-breaker-6V7RJMMF.js.map} +0 -0
  118. /package/dist/{cli-readiness-7YQ7S2AY.js.map → cli-readiness-XNJQCKIH.js.map} +0 -0
  119. /package/dist/{composite-router-KWVZJE5J.js.map → composite-router-43L52IUP.js.map} +0 -0
  120. /package/dist/{consensus-vote-YDKECHPF.js.map → consensus-vote-6HBLVWTW.js.map} +0 -0
  121. /package/dist/{context-retriever-XOT3JESN.js.map → context-retriever-WPSI4STY.js.map} +0 -0
  122. /package/dist/{doctor-deep-L5MCQ4RP.js.map → doctor-deep-6D6FG3SZ.js.map} +0 -0
  123. /package/dist/{doctor-gateway-report-4B6KE7B5.js.map → doctor-gateway-report-2JOSIARQ.js.map} +0 -0
  124. /package/dist/{doctor-live-77X66SFV.js.map → doctor-live-BVXUT36N.js.map} +0 -0
  125. /package/dist/{expert-bridge-S4LEWNOQ.js.map → expert-bridge-E6HHFKGF.js.map} +0 -0
  126. /package/dist/{factory-U35CCT3I.js.map → factory-WCUQHBSG.js.map} +0 -0
  127. /package/dist/{factory-WHP7VBCY.js.map → factory-ZPOHG4M7.js.map} +0 -0
  128. /package/dist/{improvement-review-CYK3E2J6.js.map → improvement-review-33VU5DAX.js.map} +0 -0
  129. /package/dist/{init-opencode-OTTNZHKO.js.map → init-opencode-NQW7NG5Z.js.map} +0 -0
  130. /package/dist/{issue-triage-WRNKM4W7.js.map → issue-triage-RFV3YR66.js.map} +0 -0
  131. /package/dist/{model-config-helpers-URTK3TDT.js.map → model-config-helpers-KTLFA734.js.map} +0 -0
  132. /package/dist/{openai-compat-adapter-CCYSADQL.js.map → openai-compat-adapter-7CITWSBH.js.map} +0 -0
  133. /package/dist/{outcome-store-adapter-GAT6LFFD.js.map → outcome-store-adapter-WCY3FBQM.js.map} +0 -0
  134. /package/dist/{pr-reviewer-helpers-ECI3O755.js.map → pr-reviewer-helpers-KJFNRS6R.js.map} +0 -0
  135. /package/dist/{registry-command-ZNS2WFJ5.js.map → registry-command-OZLB3KYN.js.map} +0 -0
  136. /package/dist/{repo-security-plan-FE7BKQH5.js.map → repo-security-plan-MOHGBKLA.js.map} +0 -0
  137. /package/dist/{research-helpers-synthesize-ECSX4ZO2.js.map → research-helpers-synthesize-CKC67RSM.js.map} +0 -0
  138. /package/dist/{routing-memory-5CW56QBY.js.map → routing-memory-FOMKUKKF.js.map} +0 -0
  139. /package/dist/{session-memory-VQB3KEOW.js.map → session-memory-KRK2HQUF.js.map} +0 -0
  140. /package/dist/{setup-config-3WWCV7RF.js.map → setup-config-A7MFKDN7.js.map} +0 -0
  141. /package/dist/{setup-custom-api-6QJS7YUQ.js.map → setup-custom-api-YJ4DICAK.js.map} +0 -0
  142. /package/dist/{setup-data-dir-4J6XKGDH.js.map → setup-data-dir-VNGT3GM4.js.map} +0 -0
  143. /package/dist/{tool-memory-J7HO5C7H.js.map → tool-memory-ZUQSBR3O.js.map} +0 -0
  144. /package/dist/{unified-registry-JIWD7D4S.js.map → unified-registry-JG3QCJ5O.js.map} +0 -0
  145. /package/dist/{weather-report-GSZVNNE2.js.map → weather-report-2MBDI7G2.js.map} +0 -0
@@ -21,24 +21,24 @@ import {
21
21
  toolSuccess,
22
22
  withProgressHeartbeat,
23
23
  wrapToolWithTimeout
24
- } from "./chunk-A2UFTOL3.js";
24
+ } from "./chunk-P2LYE2KA.js";
25
25
  import {
26
26
  getToolMemory
27
- } from "./chunk-KSZAEQAZ.js";
27
+ } from "./chunk-6JLDPMMU.js";
28
28
  import {
29
29
  allOf
30
30
  } from "./chunk-EZNIYU5T.js";
31
31
  import {
32
32
  VERSION
33
- } from "./chunk-7TLUEWRK.js";
33
+ } from "./chunk-Q4L5XROB.js";
34
34
  import {
35
35
  isGatewayModelAdapter
36
- } from "./chunk-HK5DNXNV.js";
36
+ } from "./chunk-B3LT4L5R.js";
37
37
  import {
38
38
  ModelBoundAdapter,
39
39
  createEvent,
40
40
  getGlobalRegistry
41
- } from "./chunk-3A24GW2T.js";
41
+ } from "./chunk-NM7YEKQM.js";
42
42
  import {
43
43
  UNVERIFIABLE_STDERR_RE,
44
44
  classifyUnverifiable,
@@ -46,25 +46,25 @@ import {
46
46
  getAvailableClis,
47
47
  isAbsentSeat,
48
48
  markUnverifiable
49
- } from "./chunk-MW454P5G.js";
49
+ } from "./chunk-Y3OBX752.js";
50
50
  import {
51
51
  ensureGatewayDiscovered
52
- } from "./chunk-ZZ63WG24.js";
52
+ } from "./chunk-5T33FILA.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-Z5CLWX4M.js";
59
+ } from "./chunk-A34ANV7R.js";
60
60
  import {
61
61
  getDefaultCliCircuitBreakerRegistry
62
- } from "./chunk-TMCE755U.js";
62
+ } from "./chunk-OQNKPJPJ.js";
63
63
  import {
64
64
  sanitizeErrorDetails,
65
65
  sanitizeOutput,
66
66
  sanitizeStringLeaves
67
- } from "./chunk-SAK2PAQD.js";
67
+ } from "./chunk-4HUCHMSX.js";
68
68
  import {
69
69
  AgentError,
70
70
  DecisionCostStore,
@@ -121,7 +121,7 @@ import {
121
121
  servedCostDetail,
122
122
  stepBus,
123
123
  voteRecordWriteFailedMessage
124
- } from "./chunk-TVUPVQXD.js";
124
+ } from "./chunk-4IJII2WG.js";
125
125
  import {
126
126
  ensureLearningDir,
127
127
  getOutcomesFile
@@ -145,7 +145,7 @@ import {
145
145
  // src/mcp/tools/consensus-vote.ts
146
146
  import { randomUUID as randomUUID4 } from "node:crypto";
147
147
  import { basename as basename2 } from "node:path";
148
- import { z as z15 } from "zod";
148
+ import { z as z16 } from "zod";
149
149
 
150
150
  // src/cli/voter-roles.ts
151
151
  var VOTER_ROLES = {
@@ -1793,6 +1793,123 @@ function warnIfSingleFamily(roleCount, assignedModels, logger12) {
1793
1793
  }
1794
1794
  }
1795
1795
 
1796
+ // src/cli/voter-option-reask.ts
1797
+ import { z as z2 } from "zod";
1798
+ var SelectionSchema = z2.object({
1799
+ selectedOption: z2.string(),
1800
+ decision: z2.literal("approve").optional()
1801
+ });
1802
+ var SELECTION_JSON_SCHEMA = {
1803
+ type: "object",
1804
+ additionalProperties: false,
1805
+ required: ["selectedOption"],
1806
+ properties: { selectedOption: { type: "string" } }
1807
+ };
1808
+ function reaskRequest(seat, input) {
1809
+ const context = buildVotePrompt(
1810
+ input.proposal,
1811
+ input.options,
1812
+ input.workspace,
1813
+ input.workspaceSha
1814
+ );
1815
+ return {
1816
+ messages: [
1817
+ { role: "system", content: getVoterPrompts(input.project)[seat.role] },
1818
+ {
1819
+ role: "user",
1820
+ content: `${context}
1821
+
1822
+ OPTION SELECTION RE-ASK (once only):
1823
+ Your original vote: ${JSON.stringify(seat.vote)}
1824
+ Your approval is final. Keep that decision and its reasoning unchanged. Only fill the missing option selection.
1825
+ Declared options: ${JSON.stringify(input.options)}
1826
+ Return only JSON: {"selectedOption": "one exact declared option"}.`
1827
+ }
1828
+ ],
1829
+ maxTokens: 512,
1830
+ temperature: 0.3,
1831
+ timeoutMs: input.timeoutMs,
1832
+ accessMode: VOTER_ACCESS_MODE,
1833
+ signal: seatSignal(input.timeoutMs, input.signal),
1834
+ ...input.workspace !== void 0 && input.workspace.trim() !== "" ? { workDir: input.workspace } : {},
1835
+ responseFormat: { type: "json_schema", schema: SELECTION_JSON_SCHEMA }
1836
+ };
1837
+ }
1838
+ async function askSelection(seat, input, state) {
1839
+ state.collector.started();
1840
+ let eventId;
1841
+ const call = input.adapter.complete(reaskRequest(seat, input)).then((result) => {
1842
+ if (result.ok) {
1843
+ eventId = state.collector.settled(
1844
+ seat.role,
1845
+ input.adapter,
1846
+ result.value,
1847
+ "option_reask",
1848
+ input.withinRoleRetry
1849
+ );
1850
+ state.usage = foldCompletionUsage(void 0, readVoteUsage(result.value));
1851
+ }
1852
+ return result;
1853
+ });
1854
+ const completed = await withTimeout(
1855
+ unlessCancelled(trackVoterCompletion(call, input.signal), input.signal),
1856
+ input.timeoutMs,
1857
+ "Option selection re-ask timed out"
1858
+ );
1859
+ if (!completed.ok) throw new Error(completed.error);
1860
+ if (!completed.value.ok) throw completed.value.error;
1861
+ try {
1862
+ const text = extractTextFromResponse(completed.value.value.content);
1863
+ const parsed = SelectionSchema.parse(JSON.parse(extractJsonFromResponse(text)));
1864
+ state.collector.classified(eventId, "parsed");
1865
+ return matchDeclaredOption(parsed.selectedOption, input.options ?? []);
1866
+ } catch (error) {
1867
+ state.collector.classified(eventId, "parse_failed");
1868
+ throw error;
1869
+ }
1870
+ }
1871
+ function needsOptionReask(seat, input) {
1872
+ const declared = input.options;
1873
+ return declared !== void 0 && declared.length > 0 && seat.source === "llm" && seat.vote.decision === "approve" && seat.optionReask === void 0 && matchDeclaredOption(seat.selectedOption, declared) === void 0 && !isCancelled(input.signal);
1874
+ }
1875
+ async function reaskUnresolvedOption(seat, input) {
1876
+ if (!needsOptionReask(seat, input)) return seat;
1877
+ const start = getTimeProvider().now();
1878
+ const state = { collector: new VoterAttemptCollector() };
1879
+ let selection;
1880
+ try {
1881
+ selection = await askSelection(seat, input, state);
1882
+ } catch (error) {
1883
+ input.logger.warn("Option selection re-ask unresolved", {
1884
+ role: seat.role,
1885
+ error: getErrorMessage(error)
1886
+ });
1887
+ }
1888
+ const resolved = selection !== void 0;
1889
+ input.logger.info("Option selection re-ask completed", { role: seat.role, resolved });
1890
+ const result = {
1891
+ ...seat,
1892
+ ...resolved ? { selectedOption: selection, vote: { ...seat.vote, selectedOption: selection } } : {},
1893
+ optionReask: { resolved },
1894
+ processingTimeMs: seat.processingTimeMs + getTimeProvider().now() - start,
1895
+ attemptUsage: mergeAttemptUsage(seat.attemptUsage, state.usage)
1896
+ };
1897
+ return withVoterAttemptTelemetry(result, () => {
1898
+ const prior = seat.attemptTelemetry;
1899
+ const next = state.collector.snapshot();
1900
+ return {
1901
+ events: [
1902
+ ...prior?.events ?? [],
1903
+ ...next.events.map((event) => ({
1904
+ ...event,
1905
+ outcome: event.outcome === "final" ? "parsed" : event.outcome
1906
+ }))
1907
+ ],
1908
+ observableAttempts: (prior?.observableAttempts ?? 0) + next.observableAttempts
1909
+ };
1910
+ });
1911
+ }
1912
+
1796
1913
  // src/cli/voter-agents-deadline.ts
1797
1914
  function computeOverallConsensusDeadlineMs(timeoutMs, maxRetries, roleCount, interDelayMs) {
1798
1915
  const perVoteBudget = timeoutMs * (maxRetries + 1);
@@ -1914,7 +2031,24 @@ function voteBeforeDeadline(input, role, adapter, remaining) {
1914
2031
  }
1915
2032
  }
1916
2033
  );
1917
- return result.then((vote) => withVoterAttemptTelemetry(vote, () => collector.snapshot()));
2034
+ return result.then(
2035
+ (vote) => withVoterAttemptTelemetry(vote, () => vote.attemptTelemetry ?? collector.snapshot())
2036
+ );
2037
+ }
2038
+ function finishOptionSelection(vote, input, context) {
2039
+ const settings = input.voteOptions;
2040
+ return reaskUnresolvedOption(vote, {
2041
+ adapter: context.adapter,
2042
+ proposal: input.proposal,
2043
+ logger: input.logger,
2044
+ timeoutMs: Math.min(settings.timeoutMs, Math.max(1, context.deadlineAtMs - Date.now())),
2045
+ options: settings.declaredOptions,
2046
+ project: settings.project,
2047
+ workspace: settings.workspace,
2048
+ workspaceSha: settings.workspaceSha,
2049
+ signal: input.signal,
2050
+ withinRoleRetry: vote.retried === true || settings.withinRoleRetry === true || settings.attemptKind === "role_retry"
2051
+ });
1918
2052
  }
1919
2053
  async function launchRoleVote(role, index, input, voteOnAdapter, deadlineAtMs) {
1920
2054
  const staggerWaitMs = Math.min(input.interDelay, Math.max(0, deadlineAtMs - Date.now()));
@@ -1946,8 +2080,7 @@ async function launchRoleVote(role, index, input, voteOnAdapter, deadlineAtMs) {
1946
2080
  const fallback = crossCliFallback(adapter, assignedKey, primary.error ?? "");
1947
2081
  return stamp(preserveVoterAttemptTelemetry(recovered, { ...recovered, fallback }));
1948
2082
  }
1949
- function createTimedVoteLauncher(input, deadlineAtMs) {
1950
- const serialize = createKeyedSerializer();
2083
+ function createTimedVoteLauncher(input, deadlineAtMs, serialize) {
1951
2084
  const voteOnAdapter = (role, adapter, fallback) => {
1952
2085
  const cli = adapterCliKey(adapter);
1953
2086
  const enqueuedAt = Date.now();
@@ -1981,10 +2114,23 @@ function createTimedVoteLauncher(input, deadlineAtMs) {
1981
2114
  };
1982
2115
  return voteOnAdapter;
1983
2116
  }
2117
+ async function reaskUnresolvedOptions(votes, input, deadlineAtMs) {
2118
+ const serialize = createKeyedSerializer();
2119
+ return Promise.all(
2120
+ votes.map((vote) => {
2121
+ const adapter = vote.timing?.attempts.at(-1)?.fallback === true ? input.fallbackAdapter : input.roleAdapters.get(vote.role) ?? input.fallbackAdapter;
2122
+ return serialize(
2123
+ adapterCliKey(adapter),
2124
+ () => finishOptionSelection(vote, input, { adapter, deadlineAtMs })
2125
+ );
2126
+ })
2127
+ );
2128
+ }
1984
2129
  async function launchVotesWithOverallDeadline(input) {
1985
2130
  const { roles, logger: logger12, overallDeadlineMs } = input;
1986
2131
  const deadlineAtMs = input.deadlineAtMs ?? Date.now() + overallDeadlineMs;
1987
- const voteOnAdapter = createTimedVoteLauncher(input, deadlineAtMs);
2132
+ const serialize = createKeyedSerializer();
2133
+ const voteOnAdapter = createTimedVoteLauncher(input, deadlineAtMs, serialize);
1988
2134
  const wrapped = roles.map(
1989
2135
  (role, index) => launchRoleVote(role, index, input, voteOnAdapter, deadlineAtMs).then((result) => {
1990
2136
  input.onVoteCollected?.(result);
@@ -2333,7 +2479,7 @@ async function assignPanelSeats(fallbackAdapter, options, logger12) {
2333
2479
  async function collectPanelPasses(input, deadline, nonRetryableRoles, backoffMs) {
2334
2480
  const { overallDeadlineMs, deadlineAtMs } = deadline;
2335
2481
  const first = await launchStaggeredVotes(input, overallDeadlineMs, deadlineAtMs);
2336
- return retryErroredRoles(
2482
+ const final = await retryErroredRoles(
2337
2483
  first,
2338
2484
  (roles) => launchStaggeredVotes(
2339
2485
  { ...input, roles, voteOptions: { ...input.voteOptions, attemptKind: "role_retry" } },
@@ -2344,6 +2490,7 @@ async function collectPanelPasses(input, deadline, nonRetryableRoles, backoffMs)
2344
2490
  backoffMs,
2345
2491
  { signal: input.signal, deadlineAtMs, nonRetryableRoles }
2346
2492
  );
2493
+ return reaskUnresolvedOptions(final, input, deadlineAtMs);
2347
2494
  }
2348
2495
  async function collectRealVotes(options) {
2349
2496
  const logger12 = options.logger ?? defaultLogger;
@@ -2442,9 +2589,9 @@ ${content}
2442
2589
  // src/cli/voter-project.ts
2443
2590
  import { readFileSync, statSync } from "node:fs";
2444
2591
  import { dirname, isAbsolute, join, resolve } from "node:path";
2445
- import { z as z2 } from "zod";
2592
+ import { z as z3 } from "zod";
2446
2593
  var VOTER_PROJECT_PATTERN = /^[A-Za-z0-9._/@-]{1,200}$/;
2447
- var VoterProjectInputSchema = z2.string().regex(VOTER_PROJECT_PATTERN).optional().describe(
2594
+ var VoterProjectInputSchema = z3.string().regex(VOTER_PROJECT_PATTERN).optional().describe(
2448
2595
  "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."
2449
2596
  );
2450
2597
  var MAX_ANCESTOR_DEPTH = 64;
@@ -2609,40 +2756,40 @@ function describeVeto(verdict) {
2609
2756
  }
2610
2757
 
2611
2758
  // src/consensus/types-voting-protocol.ts
2612
- import { z as z3 } from "zod";
2759
+ import { z as z4 } from "zod";
2613
2760
  var VOTING_ROUND_DEFAULT_TIMEOUT_MS = OPERATION_CLASSES["multi-llm-panel"].guardMs;
2614
- var VotingRoundPhaseSchema = z3.enum(["analysis", "deliberation", "consensus"]);
2615
- var VotingRoundStatusSchema = z3.enum([
2761
+ var VotingRoundPhaseSchema = z4.enum(["analysis", "deliberation", "consensus"]);
2762
+ var VotingRoundStatusSchema = z4.enum([
2616
2763
  "pending",
2617
2764
  "in_progress",
2618
2765
  "awaiting_votes",
2619
2766
  "completed",
2620
2767
  "aborted"
2621
2768
  ]);
2622
- var AgentFindingSchema = z3.object({
2623
- agentId: z3.string(),
2624
- category: z3.enum(["bug", "security", "performance", "style", "design", "documentation", "other"]),
2625
- severity: z3.enum(["critical", "major", "minor", "suggestion"]),
2626
- description: z3.string().min(1),
2627
- location: z3.string().optional().describe("File path and line range if applicable"),
2628
- suggestion: z3.string().optional().describe("Recommended fix"),
2629
- confidence: z3.number().min(0).max(1),
2630
- timestamp: z3.iso.datetime().optional()
2769
+ var AgentFindingSchema = z4.object({
2770
+ agentId: z4.string(),
2771
+ category: z4.enum(["bug", "security", "performance", "style", "design", "documentation", "other"]),
2772
+ severity: z4.enum(["critical", "major", "minor", "suggestion"]),
2773
+ description: z4.string().min(1),
2774
+ location: z4.string().optional().describe("File path and line range if applicable"),
2775
+ suggestion: z4.string().optional().describe("Recommended fix"),
2776
+ confidence: z4.number().min(0).max(1),
2777
+ timestamp: z4.iso.datetime().optional()
2631
2778
  });
2632
- var FindingVoteSchema = z3.object({
2633
- agentId: z3.string(),
2634
- findingId: z3.string(),
2635
- agree: z3.boolean(),
2636
- reasoning: z3.string().optional(),
2637
- amendedSeverity: z3.enum(["critical", "major", "minor", "suggestion"]).optional()
2779
+ var FindingVoteSchema = z4.object({
2780
+ agentId: z4.string(),
2781
+ findingId: z4.string(),
2782
+ agree: z4.boolean(),
2783
+ reasoning: z4.string().optional(),
2784
+ amendedSeverity: z4.enum(["critical", "major", "minor", "suggestion"]).optional()
2638
2785
  });
2639
- var VotingProtocolConfigSchema = z3.object({
2640
- committeeSize: z3.number().int().min(2).max(7).default(3),
2641
- maxRounds: z3.number().int().min(1).max(5).default(3),
2642
- roundTimeoutMs: z3.number().int().positive().default(VOTING_ROUND_DEFAULT_TIMEOUT_MS),
2643
- agreementThreshold: z3.number().min(0.5).max(1).default(SUPERMAJORITY_THRESHOLD),
2644
- enableAntiSycophancy: z3.boolean().default(true),
2645
- sycophancyThreshold: z3.number().min(0).max(1).default(0.8)
2786
+ var VotingProtocolConfigSchema = z4.object({
2787
+ committeeSize: z4.number().int().min(2).max(7).default(3),
2788
+ maxRounds: z4.number().int().min(1).max(5).default(3),
2789
+ roundTimeoutMs: z4.number().int().positive().default(VOTING_ROUND_DEFAULT_TIMEOUT_MS),
2790
+ agreementThreshold: z4.number().min(0.5).max(1).default(SUPERMAJORITY_THRESHOLD),
2791
+ enableAntiSycophancy: z4.boolean().default(true),
2792
+ sycophancyThreshold: z4.number().min(0).max(1).default(0.8)
2646
2793
  });
2647
2794
  var DEFAULT_VOTING_PROTOCOL_CONFIG = {
2648
2795
  committeeSize: 3,
@@ -2655,30 +2802,30 @@ var DEFAULT_VOTING_PROTOCOL_CONFIG = {
2655
2802
  };
2656
2803
 
2657
2804
  // src/consensus/types-weighted-voting.ts
2658
- import { z as z4 } from "zod";
2659
- var TaskOutcomeStatusSchema = z4.enum(["success", "failure", "partial", "unknown"]);
2660
- var WeightedAgentRecordSchema = z4.object({
2661
- agentId: z4.string().min(1),
2662
- totalTasks: z4.number().int().nonnegative(),
2663
- successfulTasks: z4.number().int().nonnegative(),
2664
- failedTasks: z4.number().int().nonnegative(),
2665
- partialTasks: z4.number().int().nonnegative(),
2666
- successRate: z4.number().min(0).max(1),
2667
- weight: z4.number().min(0).max(1),
2668
- trustScore: z4.number().min(0).max(1),
2669
- byzantineFlags: z4.number().int().nonnegative(),
2670
- lastActive: z4.date(),
2671
- createdAt: z4.date()
2805
+ import { z as z5 } from "zod";
2806
+ var TaskOutcomeStatusSchema = z5.enum(["success", "failure", "partial", "unknown"]);
2807
+ var WeightedAgentRecordSchema = z5.object({
2808
+ agentId: z5.string().min(1),
2809
+ totalTasks: z5.number().int().nonnegative(),
2810
+ successfulTasks: z5.number().int().nonnegative(),
2811
+ failedTasks: z5.number().int().nonnegative(),
2812
+ partialTasks: z5.number().int().nonnegative(),
2813
+ successRate: z5.number().min(0).max(1),
2814
+ weight: z5.number().min(0).max(1),
2815
+ trustScore: z5.number().min(0).max(1),
2816
+ byzantineFlags: z5.number().int().nonnegative(),
2817
+ lastActive: z5.date(),
2818
+ createdAt: z5.date()
2672
2819
  });
2673
- var WeightedVotingConfigSchema = z4.object({
2674
- minWeight: z4.number().min(0).max(1).default(0.1),
2675
- maxByzantineFraction: z4.number().min(0).max(0.5).default(0.33),
2676
- weightDecayFactor: z4.number().min(0.5).max(1).default(0.9),
2677
- weightRecoveryFactor: z4.number().min(1).max(2).default(1.05),
2678
- minTrustScore: z4.number().min(0).max(1).default(0.3),
2679
- byzantineFlagThreshold: z4.number().int().positive().default(3),
2680
- initialWeight: z4.number().min(0).max(1).default(0.5),
2681
- quorumThreshold: z4.number().min(0.5).max(1).default(SUPERMAJORITY_THRESHOLD)
2820
+ var WeightedVotingConfigSchema = z5.object({
2821
+ minWeight: z5.number().min(0).max(1).default(0.1),
2822
+ maxByzantineFraction: z5.number().min(0).max(0.5).default(0.33),
2823
+ weightDecayFactor: z5.number().min(0.5).max(1).default(0.9),
2824
+ weightRecoveryFactor: z5.number().min(1).max(2).default(1.05),
2825
+ minTrustScore: z5.number().min(0).max(1).default(0.3),
2826
+ byzantineFlagThreshold: z5.number().int().positive().default(3),
2827
+ initialWeight: z5.number().min(0).max(1).default(0.5),
2828
+ quorumThreshold: z5.number().min(0.5).max(1).default(SUPERMAJORITY_THRESHOLD)
2682
2829
  });
2683
2830
  var DEFAULT_WEIGHTED_VOTING_CONFIG = {
2684
2831
  minWeight: 0.1,
@@ -2693,7 +2840,7 @@ var DEFAULT_WEIGHTED_VOTING_CONFIG = {
2693
2840
  };
2694
2841
 
2695
2842
  // src/consensus/higher-order-types.ts
2696
- import { z as z5 } from "zod";
2843
+ import { z as z6 } from "zod";
2697
2844
  function createAgentPairKey(agentA, agentB) {
2698
2845
  return agentA < agentB ? `${agentA}:${agentB}` : `${agentB}:${agentA}`;
2699
2846
  }
@@ -2704,43 +2851,43 @@ function parseAgentPairKey(key) {
2704
2851
  }
2705
2852
  return [parts[0], parts[1]];
2706
2853
  }
2707
- var CorrelationCoefficientSchema = z5.number().min(-1).max(1);
2708
- var IndependentSubsetSchema = z5.object({
2709
- id: z5.string(),
2710
- agentIds: z5.array(z5.string()),
2711
- independenceScore: z5.number().min(0).max(1),
2712
- pairCoverage: z5.object({
2713
- observed: z5.number().int().nonnegative(),
2714
- total: z5.number().int().nonnegative()
2854
+ var CorrelationCoefficientSchema = z6.number().min(-1).max(1);
2855
+ var IndependentSubsetSchema = z6.object({
2856
+ id: z6.string(),
2857
+ agentIds: z6.array(z6.string()),
2858
+ independenceScore: z6.number().min(0).max(1),
2859
+ pairCoverage: z6.object({
2860
+ observed: z6.number().int().nonnegative(),
2861
+ total: z6.number().int().nonnegative()
2715
2862
  }),
2716
- observationCount: z5.number().int().nonnegative()
2863
+ observationCount: z6.number().int().nonnegative()
2717
2864
  });
2718
- var VotingObservationSchema = z5.object({
2719
- proposalId: z5.string(),
2720
- agentId: z5.string(),
2721
- decision: z5.enum(["approve", "reject", "abstain"]),
2722
- confidence: z5.number().min(0).max(1),
2723
- alignedWithOutcome: z5.boolean(),
2724
- timestamp: z5.date(),
2725
- modelKey: z5.string().optional(),
2726
- observedModel: z5.string().optional()
2865
+ var VotingObservationSchema = z6.object({
2866
+ proposalId: z6.string(),
2867
+ agentId: z6.string(),
2868
+ decision: z6.enum(["approve", "reject", "abstain"]),
2869
+ confidence: z6.number().min(0).max(1),
2870
+ alignedWithOutcome: z6.boolean(),
2871
+ timestamp: z6.date(),
2872
+ modelKey: z6.string().optional(),
2873
+ observedModel: z6.string().optional()
2727
2874
  });
2728
- var PairwiseVotingHistorySchema = z5.object({
2729
- pairKey: z5.string(),
2730
- jointObservations: z5.number().int().nonnegative(),
2731
- agreements: z5.number().int().nonnegative(),
2732
- disagreements: z5.number().int().nonnegative(),
2875
+ var PairwiseVotingHistorySchema = z6.object({
2876
+ pairKey: z6.string(),
2877
+ jointObservations: z6.number().int().nonnegative(),
2878
+ agreements: z6.number().int().nonnegative(),
2879
+ disagreements: z6.number().int().nonnegative(),
2733
2880
  correlation: CorrelationCoefficientSchema,
2734
- lastUpdated: z5.date()
2881
+ lastUpdated: z6.date()
2735
2882
  });
2736
- var HigherOrderVotingConfigSchema = z5.object({
2737
- minObservationsForCorrelation: z5.number().int().positive().default(10),
2738
- correlationThreshold: z5.number().min(0).max(1).default(0.3),
2739
- independenceThreshold: z5.number().min(0).max(1).default(0.2),
2740
- fallbackToSimpleVoting: z5.boolean().default(true),
2741
- maxObservationsPerAgent: z5.number().int().positive().default(1e3),
2742
- maxProposals: z5.number().int().positive().default(5e3),
2743
- maxTrackedPairs: z5.number().int().positive().default(100)
2883
+ var HigherOrderVotingConfigSchema = z6.object({
2884
+ minObservationsForCorrelation: z6.number().int().positive().default(10),
2885
+ correlationThreshold: z6.number().min(0).max(1).default(0.3),
2886
+ independenceThreshold: z6.number().min(0).max(1).default(0.2),
2887
+ fallbackToSimpleVoting: z6.boolean().default(true),
2888
+ maxObservationsPerAgent: z6.number().int().positive().default(1e3),
2889
+ maxProposals: z6.number().int().positive().default(5e3),
2890
+ maxTrackedPairs: z6.number().int().positive().default(100)
2744
2891
  });
2745
2892
  var DEFAULT_HIGHER_ORDER_CONFIG = {
2746
2893
  minObservationsForCorrelation: 10,
@@ -2751,25 +2898,25 @@ var DEFAULT_HIGHER_ORDER_CONFIG = {
2751
2898
  maxProposals: 5e3,
2752
2899
  maxTrackedPairs: 100
2753
2900
  };
2754
- var HigherOrderVotingResultSchema = z5.object({
2755
- decision: z5.enum(["approve", "reject", "no_consensus"]),
2756
- posteriorApproval: z5.number().min(0).max(1),
2757
- posteriorRejection: z5.number().min(0).max(1),
2758
- effectiveVoteCount: z5.number().nonnegative(),
2759
- usedCorrelationData: z5.boolean(),
2760
- method: z5.enum(["ow", "isp", "simple"]),
2761
- improvementOverBaseline: z5.number(),
2762
- independentSubsets: z5.array(IndependentSubsetSchema).optional(),
2763
- downweightedAgents: z5.array(z5.string()),
2764
- reasoning: z5.string()
2901
+ var HigherOrderVotingResultSchema = z6.object({
2902
+ decision: z6.enum(["approve", "reject", "no_consensus"]),
2903
+ posteriorApproval: z6.number().min(0).max(1),
2904
+ posteriorRejection: z6.number().min(0).max(1),
2905
+ effectiveVoteCount: z6.number().nonnegative(),
2906
+ usedCorrelationData: z6.boolean(),
2907
+ method: z6.enum(["ow", "isp", "simple"]),
2908
+ improvementOverBaseline: z6.number(),
2909
+ independentSubsets: z6.array(IndependentSubsetSchema).optional(),
2910
+ downweightedAgents: z6.array(z6.string()),
2911
+ reasoning: z6.string()
2765
2912
  });
2766
- var CorrelationTrackerStatsSchema = z5.object({
2767
- totalAgents: z5.number().int().nonnegative(),
2768
- trackedPairs: z5.number().int().nonnegative(),
2769
- totalObservations: z5.number().int().nonnegative(),
2770
- averageCorrelation: z5.number(),
2771
- independentSubsetCount: z5.number().int().nonnegative(),
2772
- pairsWithSufficientData: z5.number().int().nonnegative()
2913
+ var CorrelationTrackerStatsSchema = z6.object({
2914
+ totalAgents: z6.number().int().nonnegative(),
2915
+ trackedPairs: z6.number().int().nonnegative(),
2916
+ totalObservations: z6.number().int().nonnegative(),
2917
+ averageCorrelation: z6.number(),
2918
+ independentSubsetCount: z6.number().int().nonnegative(),
2919
+ pairsWithSufficientData: z6.number().int().nonnegative()
2773
2920
  });
2774
2921
 
2775
2922
  // src/consensus/higher-order-helpers.ts
@@ -5677,24 +5824,24 @@ function createCorrelationTracker(config) {
5677
5824
  import * as fs from "node:fs";
5678
5825
 
5679
5826
  // src/consensus/correlation-persistence-records.ts
5680
- import { z as z6 } from "zod";
5681
- var PersistedVoteSchema = z6.object({
5682
- agentId: z6.string(),
5683
- decision: z6.enum(["approve", "reject", "abstain"]),
5684
- confidence: z6.number().min(0).max(1),
5685
- modelKey: z6.string().optional(),
5686
- observedModel: z6.string().optional()
5827
+ import { z as z7 } from "zod";
5828
+ var PersistedVoteSchema = z7.object({
5829
+ agentId: z7.string(),
5830
+ decision: z7.enum(["approve", "reject", "abstain"]),
5831
+ confidence: z7.number().min(0).max(1),
5832
+ modelKey: z7.string().optional(),
5833
+ observedModel: z7.string().optional()
5687
5834
  });
5688
- var PersistedProposalSchema = z6.object({
5689
- proposalId: z6.string(),
5690
- votes: z6.array(PersistedVoteSchema),
5691
- outcome: z6.enum(["approved", "rejected"]),
5692
- timestamp: z6.iso.datetime()
5835
+ var PersistedProposalSchema = z7.object({
5836
+ proposalId: z7.string(),
5837
+ votes: z7.array(PersistedVoteSchema),
5838
+ outcome: z7.enum(["approved", "rejected"]),
5839
+ timestamp: z7.iso.datetime()
5693
5840
  });
5694
- var PersistedCorrelationDataSchema = z6.object({
5695
- version: z6.number().int().positive(),
5696
- proposals: z6.array(PersistedProposalSchema),
5697
- savedAt: z6.iso.datetime()
5841
+ var PersistedCorrelationDataSchema = z7.object({
5842
+ version: z7.number().int().positive(),
5843
+ proposals: z7.array(PersistedProposalSchema),
5844
+ savedAt: z7.iso.datetime()
5698
5845
  });
5699
5846
  function createPersistedProposal(proposalId, votes, outcome, context) {
5700
5847
  const persistedVotes = [];
@@ -5936,10 +6083,10 @@ function createPersistentCorrelationTracker(config) {
5936
6083
  }
5937
6084
 
5938
6085
  // src/mcp/tools/consensus-vote-types.ts
5939
- import { z as z8 } from "zod";
6086
+ import { z as z9 } from "zod";
5940
6087
 
5941
6088
  // src/mcp/tools/async-dispatch-input.ts
5942
- import { z as z7 } from "zod";
6089
+ import { z as z8 } from "zod";
5943
6090
  var DISPATCH_MODES = ["sync", "async"];
5944
6091
  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 }).";
5945
6092
  var WRONG_KEY_MODE_MESSAGE = '`mode` is not the async switch on this tool; send `dispatch: "async"` (or "sync") instead (#4968).';
@@ -5947,12 +6094,12 @@ function describeDispatch(note) {
5947
6094
  return note === void 0 ? DISPATCH_DESCRIPTION : `${DISPATCH_DESCRIPTION} ${note}`;
5948
6095
  }
5949
6096
  function dispatchField(note) {
5950
- return z7.enum(DISPATCH_MODES).optional().describe(describeDispatch(note));
6097
+ return z8.enum(DISPATCH_MODES).optional().describe(describeDispatch(note));
5951
6098
  }
5952
6099
  function dispatchFieldDefaultSync(note) {
5953
- return z7.enum(DISPATCH_MODES).default("sync").describe(describeDispatch(note));
6100
+ return z8.enum(DISPATCH_MODES).default("sync").describe(describeDispatch(note));
5954
6101
  }
5955
- var REJECTED_MODE_KEY = z7.never({ error: WRONG_KEY_MODE_MESSAGE }).optional().describe(
6102
+ var REJECTED_MODE_KEY = z8.never({ error: WRONG_KEY_MODE_MESSAGE }).optional().describe(
5956
6103
  "Not an input of this tool. The async switch is `dispatch`; `mode: 'async'` is rejected (#4968)."
5957
6104
  );
5958
6105
  function asyncDispatchInput(note) {
@@ -6095,7 +6242,7 @@ function checkUndeclaredOptions(proposal, declaredOptions, allEngagedApproved) {
6095
6242
 
6096
6243
  // src/mcp/tools/consensus-vote-types.ts
6097
6244
  var MAX_PROPOSAL_LENGTH = 4e3;
6098
- var VotingStrategySchema = z8.enum(
6245
+ var VotingStrategySchema = z9.enum(
6099
6246
  ["simple_majority", "supermajority", "unanimous", "higher_order", "opinion_wise"],
6100
6247
  {
6101
6248
  error: (issue) => issue.input === "proof_of_learning" ? RETIRED_CONSENSUS_STRATEGY_MESSAGE : void 0
@@ -6108,21 +6255,21 @@ var HIGHER_ORDER_ESCALATION_POSTERIOR_FLOOR = 0.65;
6108
6255
  function shouldEscalateLowPosterior(strategy, outcome, quickMode, posteriorApproval) {
6109
6256
  return quickMode && outcome === "approved" && isHigherOrderStrategy(strategy) && posteriorApproval !== void 0 && posteriorApproval < HIGHER_ORDER_ESCALATION_POSTERIOR_FLOOR;
6110
6257
  }
6111
- var ErrorPolicySchema = z8.enum([
6258
+ var ErrorPolicySchema = z9.enum([
6112
6259
  "reduce_denominator",
6113
6260
  "count_as_abstain",
6114
6261
  "fail_closed",
6115
6262
  "absolute_quorum"
6116
6263
  ]);
6117
- var VoteThresholdSchema = z8.enum(["majority", "supermajority", "unanimous"]);
6118
- var ConsensusVoteInputSchema = z8.object({
6119
- proposal: z8.string().min(1).max(MAX_PROPOSAL_LENGTH).describe(
6264
+ var VoteThresholdSchema = z9.enum(["majority", "supermajority", "unanimous"]);
6265
+ var ConsensusVoteInputSchema = z9.object({
6266
+ proposal: z9.string().min(1).max(MAX_PROPOSAL_LENGTH).describe(
6120
6267
  '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.'
6121
6268
  ),
6122
- artifactPath: z8.string().min(1).max(4096).optional().describe(
6269
+ artifactPath: z9.string().min(1).max(4096).optional().describe(
6123
6270
  "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."
6124
6271
  ),
6125
- options: z8.array(z8.string().min(1).max(200)).min(2).max(10).optional().describe(
6272
+ options: z9.array(z9.string().min(1).max(200)).min(2).max(10).optional().describe(
6126
6273
  "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."
6127
6274
  ),
6128
6275
  project: VoterProjectInputSchema,
@@ -6135,8 +6282,8 @@ var ConsensusVoteInputSchema = z8.object({
6135
6282
  errorPolicy: ErrorPolicySchema.optional().describe(
6136
6283
  "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."
6137
6284
  ),
6138
- quickMode: z8.boolean().optional().default(false).describe("Use 3 agents instead of the full 7-role panel for faster execution"),
6139
- simulateVotes: z8.boolean().optional().default(false).describe(
6285
+ quickMode: z9.boolean().optional().default(false).describe("Use 3 agents instead of the full 7-role panel for faster execution"),
6286
+ simulateVotes: z9.boolean().optional().default(false).describe(
6140
6287
  "TESTS ONLY \u2014 when true, voters return random decisions. Output must not be used for real decisions. (#2319)"
6141
6288
  ),
6142
6289
  /**
@@ -6178,7 +6325,7 @@ var ConsensusVoteInputSchema = z8.object({
6178
6325
  * same key with different inputs fails closed with
6179
6326
  * `idempotency_key_collision`. Sync mode ignores this.
6180
6327
  */
6181
- idempotencyKey: z8.string().min(1).max(256).optional().describe(
6328
+ idempotencyKey: z9.string().min(1).max(256).optional().describe(
6182
6329
  "Replay-safe key for async-mode dispatch (#3042 Stage 1c). Same (key, inputs) returns existing jobId."
6183
6330
  ),
6184
6331
  /**
@@ -6190,7 +6337,7 @@ var ConsensusVoteInputSchema = z8.object({
6190
6337
  * record and require `ratifies === transition.subject` (with decision=approved,
6191
6338
  * strategy=higher_order). Omit on an ordinary vote.
6192
6339
  */
6193
- ratifies: z8.string().min(1).max(256).optional().describe(
6340
+ ratifies: z9.string().min(1).max(256).optional().describe(
6194
6341
  "Authority-tier ratification subject (#4004) \u2014 the loop/strategy id this vote ratifies for an authority-ladder promotion. Bound into the authentic vote record so the promotion gate can verify it. Omit for ordinary votes."
6195
6342
  ),
6196
6343
  /**
@@ -6207,14 +6354,14 @@ var ConsensusVoteInputSchema = z8.object({
6207
6354
  "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."
6208
6355
  )
6209
6356
  });
6210
- var VoteDecisionStatusSchema = z8.enum([
6357
+ var VoteDecisionStatusSchema = z9.enum([
6211
6358
  "approved",
6212
6359
  "rejected",
6213
6360
  "pending",
6214
6361
  "timeout",
6215
6362
  "no_quorum"
6216
6363
  ]);
6217
- var ContrarianCheckStatusSchema = z8.enum(["ok", "errored", "skipped"]);
6364
+ var ContrarianCheckStatusSchema = z9.enum(["ok", "errored", "skipped"]);
6218
6365
  function toRecordDecision(status) {
6219
6366
  switch (status) {
6220
6367
  case "approved":
@@ -6494,7 +6641,7 @@ function logPartialProposal(bounded, log) {
6494
6641
  }
6495
6642
  async function runContrarianCheck(proposal, options, log, opts) {
6496
6643
  try {
6497
- const { executeExpert } = await import("./expert-bridge-S4LEWNOQ.js");
6644
+ const { executeExpert } = await import("./expert-bridge-E6HHFKGF.js");
6498
6645
  const bounded = boundArtifactForReview(proposal, CONTRARIAN_PROPOSAL_BUDGET, "proposal");
6499
6646
  logPartialProposal(bounded, log);
6500
6647
  const result = await executeExpert(
@@ -6678,20 +6825,20 @@ async function withFileLock(lockPath, body, options = {}) {
6678
6825
  }
6679
6826
 
6680
6827
  // src/mcp/jobs/job-cancelled-partial-schema.ts
6681
- import { z as z9 } from "zod";
6682
- var CancelledPartialSchema = z9.strictObject({
6683
- partialVotes: z9.array(z9.unknown()),
6684
- seatsCast: z9.number().int().nonnegative(),
6685
- panelSize: z9.number().int().nonnegative()
6828
+ import { z as z10 } from "zod";
6829
+ var CancelledPartialSchema = z10.strictObject({
6830
+ partialVotes: z10.array(z10.unknown()),
6831
+ seatsCast: z10.number().int().nonnegative(),
6832
+ panelSize: z10.number().int().nonnegative()
6686
6833
  });
6687
6834
 
6688
6835
  // src/mcp/jobs/job-result-store.ts
6689
6836
  import { existsSync as existsSync4, readdirSync, unlinkSync as unlinkSync2, writeFileSync as writeFileSync2, chmodSync, mkdirSync as mkdirSync2 } from "node:fs";
6690
6837
  import { dirname as dirname2 } from "node:path";
6691
- import { z as z13 } from "zod";
6838
+ import { z as z14 } from "zod";
6692
6839
 
6693
6840
  // src/mcp/jobs/job-id.ts
6694
- import { z as z10 } from "zod";
6841
+ import { z as z11 } from "zod";
6695
6842
  var JOB_ID_MAX_LENGTH = 128;
6696
6843
  var JOB_ID_PATTERN = /^[A-Za-z0-9_-]{1,128}$/;
6697
6844
  function isValidJobId(jobId) {
@@ -6703,26 +6850,26 @@ function assertValidJobId(jobId) {
6703
6850
  }
6704
6851
  }
6705
6852
  function jobIdSchema(description) {
6706
- return z10.string().min(1).max(JOB_ID_MAX_LENGTH).regex(JOB_ID_PATTERN, 'jobId must contain only letters, digits, "_" and "-"').describe(description);
6853
+ return z11.string().min(1).max(JOB_ID_MAX_LENGTH).regex(JOB_ID_PATTERN, 'jobId must contain only letters, digits, "_" and "-"').describe(description);
6707
6854
  }
6708
6855
 
6709
6856
  // src/mcp/jobs/job-idempotency.ts
6710
6857
  import { createHash as createHash2, randomUUID as randomUUID2 } from "node:crypto";
6711
6858
  import { existsSync as existsSync2, readFileSync as readFileSync4, writeFileSync } from "node:fs";
6712
- import { z as z11 } from "zod";
6859
+ import { z as z12 } from "zod";
6713
6860
  var logger6 = createLogger({ component: "job-idempotency" });
6714
- var IdempotencyIndexEntrySchema = z11.object({
6715
- v: z11.literal(1),
6861
+ var IdempotencyIndexEntrySchema = z12.object({
6862
+ v: z12.literal(1),
6716
6863
  /** MCP tool name (e.g. `orchestrate`, `run_workflow`, `consensus_vote`). */
6717
- tool: z11.string().min(1),
6864
+ tool: z12.string().min(1),
6718
6865
  /** Caller-supplied idempotency key. */
6719
- key: z11.string().min(1),
6866
+ key: z12.string().min(1),
6720
6867
  /** sha256 of the canonical input JSON. */
6721
- inputsHash: z11.string().length(64),
6868
+ inputsHash: z12.string().length(64),
6722
6869
  /** Existing jobId for this (tool, key, inputs) tuple. */
6723
- jobId: z11.string().min(1),
6870
+ jobId: z12.string().min(1),
6724
6871
  /** ISO timestamp of first dispatch. */
6725
- createdAt: z11.iso.datetime()
6872
+ createdAt: z12.iso.datetime()
6726
6873
  });
6727
6874
  function sha256Hex(input) {
6728
6875
  return createHash2("sha256").update(input).digest("hex");
@@ -6949,14 +7096,14 @@ function syncAlternateCandidates(jobId, primaryPath, record, logger12, persistFn
6949
7096
  }
6950
7097
 
6951
7098
  // src/mcp/jobs/job-failure-detail.ts
6952
- import { z as z12 } from "zod";
6953
- var JobFailureDetailSchema = z12.object({
7099
+ import { z as z13 } from "zod";
7100
+ var JobFailureDetailSchema = z13.object({
6954
7101
  /** Identifier of the failing adapter (e.g. 'claude', 'codex', 'api:anthropic'). */
6955
- adapter: z12.string().min(1),
7102
+ adapter: z13.string().min(1),
6956
7103
  /** Transport mechanism where the failure occurred (e.g. 'subprocess', 'mcp', 'stdio'). */
6957
- transport: z12.string().min(1),
7104
+ transport: z13.string().min(1),
6958
7105
  /** Normalized failure category (e.g. 'rate_limited', 'timeout', 'capacity_exhausted'). */
6959
- category: z12.string().min(1)
7106
+ category: z13.string().min(1)
6960
7107
  });
6961
7108
  function isRecord(value) {
6962
7109
  return typeof value === "object" && value !== null;
@@ -7028,28 +7175,28 @@ function validateAndSanitizeFailureDetail(detail) {
7028
7175
 
7029
7176
  // src/mcp/jobs/job-result-store.ts
7030
7177
  var logger7 = createLogger({ component: "job-result-store" });
7031
- var JobStatusSchema = z13.enum(["pending", "complete", "failed", "cancelled"]);
7032
- var JobResultSchema = z13.object({
7178
+ var JobStatusSchema = z14.enum(["pending", "complete", "failed", "cancelled"]);
7179
+ var JobResultSchema = z14.object({
7033
7180
  /** Format version. Currently `1` — bump if the shape changes. */
7034
- v: z13.literal(1),
7035
- jobId: z13.string().min(1),
7181
+ v: z14.literal(1),
7182
+ jobId: z14.string().min(1),
7036
7183
  /** Tool that was invoked (e.g. `orchestrate`). */
7037
- toolName: z13.string().min(1),
7184
+ toolName: z14.string().min(1),
7038
7185
  status: JobStatusSchema,
7039
- createdAt: z13.iso.datetime(),
7186
+ createdAt: z14.iso.datetime(),
7040
7187
  /** Set when the job leaves `pending` — either via `complete` or `failed` or `cancelled`. */
7041
- completedAt: z13.iso.datetime().optional(),
7188
+ completedAt: z14.iso.datetime().optional(),
7042
7189
  /**
7043
7190
  * Structured payload the synchronous mode would have returned. Present
7044
7191
  * only when `status === 'complete'`. Shape is tool-specific — readers
7045
7192
  * cast to the tool's known output type after status check.
7046
7193
  */
7047
- result: z13.unknown().optional(),
7194
+ result: z14.unknown().optional(),
7048
7195
  /**
7049
7196
  * Failure message when `status === 'failed'`. Cannot be paired with
7050
7197
  * `result` — the discriminator is `status`.
7051
7198
  */
7052
- error: z13.string().optional(),
7199
+ error: z14.string().optional(),
7053
7200
  /**
7054
7201
  * Structured failure detail when `status === 'failed'` (#4375).
7055
7202
  * Holds normalized adapter, transport, and category information without
@@ -7064,7 +7211,7 @@ var JobResultSchema = z13.object({
7064
7211
  * the sweep rewrote it rather than deleting it. Absent on every record the
7065
7212
  * job's own process wrote — `error` alone carries those failures.
7066
7213
  */
7067
- errorKind: z13.literal("abandoned").optional(),
7214
+ errorKind: z14.literal("abandoned").optional(),
7068
7215
  /**
7069
7216
  * Whether the tool's `run` callback accepts `runAsJob`'s `AbortSignal`
7070
7217
  * (#4972).
@@ -7080,7 +7227,7 @@ var JobResultSchema = z13.object({
7080
7227
  * "cancellation can reach this tool", not "the work stopped". Absent means
7081
7228
  * the writer did not report it, which is not the same as `false`.
7082
7229
  */
7083
- signalAccepted: z13.boolean().optional(),
7230
+ signalAccepted: z14.boolean().optional(),
7084
7231
  /**
7085
7232
  * `VERSION` of the nexus-agents process that WROTE this record (#5008) —
7086
7233
  * i.e. the build that ran the job, not the build that reads it back.
@@ -7101,7 +7248,7 @@ var JobResultSchema = z13.object({
7101
7248
  * `'dev'` — readers MUST run it through {@link isMeasuredBuildVersion}
7102
7249
  * before treating two stamps as comparable.
7103
7250
  */
7104
- producerVersion: z13.string().optional(),
7251
+ producerVersion: z14.string().optional(),
7105
7252
  /**
7106
7253
  * When the job body last heartbeat — `runAsJob`'s `progress()` callback,
7107
7254
  * `heartbeatJob`, or a pipeline-bus event the body emitted (#6162). Present
@@ -7113,7 +7260,7 @@ var JobResultSchema = z13.object({
7113
7260
  * `run-as-job.ts` fails a body that stops heartbeating as wedged, measuring
7114
7261
  * silence from this stamp (or from job start when there is none).
7115
7262
  */
7116
- lastProgressAt: z13.iso.datetime().optional(),
7263
+ lastProgressAt: z14.iso.datetime().optional(),
7117
7264
  /**
7118
7265
  * What a cancelled vote had collected when `cancel_job` fired (#6735).
7119
7266
  * Present only on a `cancelled` record, and only when the body settled after
@@ -8072,8 +8219,8 @@ import * as path from "node:path";
8072
8219
  import { AsyncLocalStorage } from "node:async_hooks";
8073
8220
 
8074
8221
  // src/context/structured-task-state-types.ts
8075
- import { z as z14 } from "zod";
8076
- var TaskStageSchema = z14.enum([
8222
+ import { z as z15 } from "zod";
8223
+ var TaskStageSchema = z15.enum([
8077
8224
  "planning",
8078
8225
  "executing",
8079
8226
  "verifying",
@@ -8085,59 +8232,59 @@ var TaskStageSchema = z14.enum([
8085
8232
  // failed run in StructuredTaskState instead of the Stage-1 sidecar.
8086
8233
  "failed"
8087
8234
  ]);
8088
- var TaskDecisionSchema = z14.object({
8089
- ts: z14.iso.datetime(),
8090
- decision: z14.string().min(1),
8091
- rationale: z14.string().min(1)
8235
+ var TaskDecisionSchema = z15.object({
8236
+ ts: z15.iso.datetime(),
8237
+ decision: z15.string().min(1),
8238
+ rationale: z15.string().min(1)
8092
8239
  });
8093
- var TaskBlockerSchema = z14.object({
8094
- ts: z14.iso.datetime(),
8095
- blocker: z14.string().min(1),
8096
- resolved: z14.iso.datetime().optional()
8240
+ var TaskBlockerSchema = z15.object({
8241
+ ts: z15.iso.datetime(),
8242
+ blocker: z15.string().min(1),
8243
+ resolved: z15.iso.datetime().optional()
8097
8244
  });
8098
- var TaskPositionSchema = z14.object({
8099
- currentStep: z14.string().min(1),
8100
- nextStep: z14.string().optional()
8245
+ var TaskPositionSchema = z15.object({
8246
+ currentStep: z15.string().min(1),
8247
+ nextStep: z15.string().optional()
8101
8248
  });
8102
- var TaskLedgerSchema = z14.object({
8249
+ var TaskLedgerSchema = z15.object({
8103
8250
  /** Verifiable observations: what we have observed/measured/confirmed. */
8104
- facts: z14.array(z14.string()),
8251
+ facts: z15.array(z15.string()),
8105
8252
  /** Working assumptions: useful guesses we proceed under, marked separately. */
8106
- guesses: z14.array(z14.string()),
8253
+ guesses: z15.array(z15.string()),
8107
8254
  /** Things we still need to figure out before the plan is sound. */
8108
- openQuestions: z14.array(z14.string()),
8109
- updatedAt: z14.iso.datetime()
8255
+ openQuestions: z15.array(z15.string()),
8256
+ updatedAt: z15.iso.datetime()
8110
8257
  });
8111
- var ReflectActionSchema = z14.enum(["continue", "revise_plan", "escalate_to_human", "abort"]);
8112
- var ProgressLedgerEntrySchema = z14.object({
8113
- ts: z14.iso.datetime(),
8258
+ var ReflectActionSchema = z15.enum(["continue", "revise_plan", "escalate_to_human", "abort"]);
8259
+ var ProgressLedgerEntrySchema = z15.object({
8260
+ ts: z15.iso.datetime(),
8114
8261
  /** What just happened (the step we are reflecting on). */
8115
- step: z14.string().min(1),
8262
+ step: z15.string().min(1),
8116
8263
  /** Is the outer Task Ledger plan still right after this step? */
8117
- planStillValid: z14.boolean(),
8264
+ planStillValid: z15.boolean(),
8118
8265
  /** Are we making progress, or have we stalled? */
8119
- stuck: z14.boolean(),
8266
+ stuck: z15.boolean(),
8120
8267
  /** What the orchestrator should do next based on this reflection. */
8121
8268
  suggestedAction: ReflectActionSchema,
8122
8269
  /** Why this action was chosen — required so future readers can audit the call. */
8123
- rationale: z14.string().min(1)
8270
+ rationale: z15.string().min(1)
8124
8271
  });
8125
- var TaskCancellationSchema = z14.object({
8126
- requestedAt: z14.iso.datetime(),
8272
+ var TaskCancellationSchema = z15.object({
8273
+ requestedAt: z15.iso.datetime(),
8127
8274
  /** Optional human-readable note carried back to the caller. */
8128
- reason: z14.string().max(1e3).optional()
8275
+ reason: z15.string().max(1e3).optional()
8129
8276
  });
8130
8277
  var TASK_RESULT_MAX_BYTES = 1048576;
8131
- var StructuredTaskStateSchema = z14.object({
8132
- taskId: z14.string().min(1),
8278
+ var StructuredTaskStateSchema = z15.object({
8279
+ taskId: z15.string().min(1),
8133
8280
  /**
8134
8281
  * Marks state created by the shared async-job dispatcher (#5622).
8135
8282
  * Optional for backward compatibility; absence does not prove async dispatch.
8136
8283
  */
8137
- dispatch: z14.literal("async").optional(),
8284
+ dispatch: z15.literal("async").optional(),
8138
8285
  stage: TaskStageSchema,
8139
- decisions: z14.array(TaskDecisionSchema),
8140
- blockers: z14.array(TaskBlockerSchema),
8286
+ decisions: z15.array(TaskDecisionSchema),
8287
+ blockers: z15.array(TaskBlockerSchema),
8141
8288
  position: TaskPositionSchema,
8142
8289
  /**
8143
8290
  * Magentic-One Task Ledger (#2278). Mutable single-object outer-loop state:
@@ -8150,7 +8297,7 @@ var StructuredTaskStateSchema = z14.object({
8150
8297
  * Most recent entry's `suggestedAction` is what `reflect()` returns. Optional
8151
8298
  * for the same backward-compat reason as `taskLedger`.
8152
8299
  */
8153
- progressLedger: z14.array(ProgressLedgerEntrySchema).optional(),
8300
+ progressLedger: z15.array(ProgressLedgerEntrySchema).optional(),
8154
8301
  /**
8155
8302
  * Monotonic version counter (#3043 / epic #2631 Stage 2). Increments by
8156
8303
  * 1 on every write; polling clients use this to detect "I missed a
@@ -8160,7 +8307,7 @@ var StructuredTaskStateSchema = z14.object({
8160
8307
  * state logs (pre-Stage-2) don't carry it; the reducer treats their
8161
8308
  * baseline as v0 and starts counting from there.
8162
8309
  */
8163
- version: z14.number().int().nonnegative().optional(),
8310
+ version: z15.number().int().nonnegative().optional(),
8164
8311
  /**
8165
8312
  * Tool result payload (#3043 / epic #2631 Stage 2). Set atomically
8166
8313
  * via the `result` log event when `stage === 'complete'`. Carries the
@@ -8176,7 +8323,7 @@ var StructuredTaskStateSchema = z14.object({
8176
8323
  * field, then the sidecar files become legacy that the next cleanup
8177
8324
  * sweep can remove.
8178
8325
  */
8179
- result: z14.unknown().optional(),
8326
+ result: z15.unknown().optional(),
8180
8327
  /**
8181
8328
  * Cancellation marker (#3043 / epic #2631 Stage 2). Set by `cancel_job`
8182
8329
  * — the running tool checks for this at safe-point boundaries (between
@@ -8193,70 +8340,70 @@ var StructuredTaskStateSchema = z14.object({
8193
8340
  * transition has been recorded. Optional for backward-compat with
8194
8341
  * pre-#3090 logs (the reducer backfills it from the init entry).
8195
8342
  */
8196
- createdAt: z14.iso.datetime().optional(),
8197
- updatedAt: z14.iso.datetime()
8343
+ createdAt: z15.iso.datetime().optional(),
8344
+ updatedAt: z15.iso.datetime()
8198
8345
  });
8199
- var StructuredTaskLogEntrySchema = z14.discriminatedUnion("event", [
8200
- z14.object({
8201
- event: z14.literal("init"),
8202
- ts: z14.iso.datetime(),
8346
+ var StructuredTaskLogEntrySchema = z15.discriminatedUnion("event", [
8347
+ z15.object({
8348
+ event: z15.literal("init"),
8349
+ ts: z15.iso.datetime(),
8203
8350
  state: StructuredTaskStateSchema
8204
8351
  }),
8205
- z14.object({
8206
- event: z14.literal("decision"),
8207
- ts: z14.iso.datetime(),
8352
+ z15.object({
8353
+ event: z15.literal("decision"),
8354
+ ts: z15.iso.datetime(),
8208
8355
  decision: TaskDecisionSchema
8209
8356
  }),
8210
- z14.object({
8211
- event: z14.literal("blocker"),
8212
- ts: z14.iso.datetime(),
8357
+ z15.object({
8358
+ event: z15.literal("blocker"),
8359
+ ts: z15.iso.datetime(),
8213
8360
  blocker: TaskBlockerSchema
8214
8361
  }),
8215
- z14.object({
8216
- event: z14.literal("blocker_resolved"),
8217
- ts: z14.iso.datetime(),
8362
+ z15.object({
8363
+ event: z15.literal("blocker_resolved"),
8364
+ ts: z15.iso.datetime(),
8218
8365
  /** Index of the blocker in the state's blockers[] array. */
8219
- blockerIndex: z14.number().int().nonnegative(),
8220
- resolvedAt: z14.iso.datetime()
8366
+ blockerIndex: z15.number().int().nonnegative(),
8367
+ resolvedAt: z15.iso.datetime()
8221
8368
  }),
8222
- z14.object({
8223
- event: z14.literal("stage"),
8224
- ts: z14.iso.datetime(),
8369
+ z15.object({
8370
+ event: z15.literal("stage"),
8371
+ ts: z15.iso.datetime(),
8225
8372
  stage: TaskStageSchema
8226
8373
  }),
8227
- z14.object({
8228
- event: z14.literal("position"),
8229
- ts: z14.iso.datetime(),
8374
+ z15.object({
8375
+ event: z15.literal("position"),
8376
+ ts: z15.iso.datetime(),
8230
8377
  position: TaskPositionSchema
8231
8378
  }),
8232
8379
  // Magentic-One Task Ledger replacement event — the outer loop revises the
8233
8380
  // entire ledger atomically when replanning. Always replaces, never partial.
8234
- z14.object({
8235
- event: z14.literal("task_ledger"),
8236
- ts: z14.iso.datetime(),
8381
+ z15.object({
8382
+ event: z15.literal("task_ledger"),
8383
+ ts: z15.iso.datetime(),
8237
8384
  ledger: TaskLedgerSchema
8238
8385
  }),
8239
8386
  // Magentic-One Progress Ledger append event — one self-reflection per step.
8240
- z14.object({
8241
- event: z14.literal("progress_ledger"),
8242
- ts: z14.iso.datetime(),
8387
+ z15.object({
8388
+ event: z15.literal("progress_ledger"),
8389
+ ts: z15.iso.datetime(),
8243
8390
  entry: ProgressLedgerEntrySchema
8244
8391
  }),
8245
8392
  // #3043 / epic #2631 Stage 2 — tool result payload set when stage flips
8246
8393
  // to 'complete'. Written by appendResult; replayed into state.result.
8247
8394
  // The payload itself is `unknown` because each tool's result shape is
8248
8395
  // its own; readers cast after a status check.
8249
- z14.object({
8250
- event: z14.literal("result"),
8251
- ts: z14.iso.datetime(),
8252
- result: z14.unknown()
8396
+ z15.object({
8397
+ event: z15.literal("result"),
8398
+ ts: z15.iso.datetime(),
8399
+ result: z15.unknown()
8253
8400
  }),
8254
8401
  // #3043 / epic #2631 Stage 2 — cancellation marker. Append-only: the
8255
8402
  // reducer ignores a second cancellation event so a malicious or buggy
8256
8403
  // double-cancel can't rewrite the requestedAt timestamp.
8257
- z14.object({
8258
- event: z14.literal("cancellation"),
8259
- ts: z14.iso.datetime(),
8404
+ z15.object({
8405
+ event: z15.literal("cancellation"),
8406
+ ts: z15.iso.datetime(),
8260
8407
  cancellation: TaskCancellationSchema
8261
8408
  })
8262
8409
  ]);
@@ -9300,7 +9447,7 @@ async function runSyncConsensusVote(deps, notifier, args) {
9300
9447
  approvalPercentage: result.value.approvalPercentage,
9301
9448
  voteCount: result.value.votes.length
9302
9449
  });
9303
- return structuredToolSuccess(z15.object(CONSENSUS_VOTE_OUTPUT_SCHEMA), { ...result.value });
9450
+ return structuredToolSuccess(z16.object(CONSENSUS_VOTE_OUTPUT_SCHEMA), { ...result.value });
9304
9451
  }
9305
9452
  async function prepareVoteArtifact(input) {
9306
9453
  if (input.artifactPath === void 0) return { ok: true, value: input };
@@ -9370,18 +9517,18 @@ function createConsensusVoteHandler(deps) {
9370
9517
  };
9371
9518
  }
9372
9519
  var ASYNC_ENVELOPES = {
9373
- pending: (jobId) => structuredToolSuccess(z15.object(CONSENSUS_VOTE_OUTPUT_SCHEMA), {
9520
+ pending: (jobId) => structuredToolSuccess(z16.object(CONSENSUS_VOTE_OUTPUT_SCHEMA), {
9374
9521
  status: "pending",
9375
9522
  jobId,
9376
9523
  pollTool: "get_job_result",
9377
9524
  note: 'Poll via get_job_result({ jobId }) until status !== "pending".'
9378
9525
  }),
9379
- busy: (retryAfterMs, toolName) => structuredToolSuccess(z15.object(CONSENSUS_VOTE_OUTPUT_SCHEMA), {
9526
+ busy: (retryAfterMs, toolName) => structuredToolSuccess(z16.object(CONSENSUS_VOTE_OUTPUT_SCHEMA), {
9380
9527
  status: "busy",
9381
9528
  retryAfterMs,
9382
9529
  note: `Async-mode concurrency cap reached for ${toolName}. Retry later or use dispatch: "sync".`
9383
9530
  }),
9384
- replay: (jobId) => structuredToolSuccess(z15.object(CONSENSUS_VOTE_OUTPUT_SCHEMA), {
9531
+ replay: (jobId) => structuredToolSuccess(z16.object(CONSENSUS_VOTE_OUTPUT_SCHEMA), {
9385
9532
  status: "replay",
9386
9533
  jobId,
9387
9534
  pollTool: "get_job_result",
@@ -9391,56 +9538,56 @@ var ASYNC_ENVELOPES = {
9391
9538
  };
9392
9539
  var CONSENSUS_VOTE_OUTPUT_SCHEMA = {
9393
9540
  /** Async-dispatch envelope discriminator — absent on a completed vote. */
9394
- status: z15.enum(["pending", "busy", "replay"]).optional(),
9395
- jobId: z15.string().max(200).optional(),
9396
- pollTool: z15.literal("get_job_result").optional(),
9397
- note: z15.string().max(500).optional(),
9398
- retryAfterMs: z15.number().optional(),
9399
- proposal: z15.string().optional(),
9541
+ status: z16.enum(["pending", "busy", "replay"]).optional(),
9542
+ jobId: z16.string().max(200).optional(),
9543
+ pollTool: z16.literal("get_job_result").optional(),
9544
+ note: z16.string().max(500).optional(),
9545
+ retryAfterMs: z16.number().optional(),
9546
+ proposal: z16.string().optional(),
9400
9547
  strategy: VotingStrategySchema.optional(),
9401
9548
  // Reuses the canonical VoteDecisionStatusSchema (single source) — a hand-listed
9402
9549
  // subset here (was ['approved','rejected','no_quorum']) omitted the reachable
9403
9550
  // 'timeout'/'pending' outcomes and made strict clients reject those votes (#4032).
9404
9551
  decision: VoteDecisionStatusSchema.optional(),
9405
- approvalPercentage: z15.number().optional(),
9406
- voteCounts: z15.object({
9407
- approve: z15.number(),
9408
- reject: z15.number(),
9409
- abstain: z15.number(),
9410
- error: z15.number(),
9552
+ approvalPercentage: z16.number().optional(),
9553
+ voteCounts: z16.object({
9554
+ approve: z16.number(),
9555
+ reject: z16.number(),
9556
+ abstain: z16.number(),
9557
+ error: z16.number(),
9411
9558
  /** #6094: seats that could not read the artifact; always present. */
9412
- unverifiable: z15.number()
9559
+ unverifiable: z16.number()
9413
9560
  }).optional(),
9414
9561
  // #6111: the quick-mode contrarian check is not a seat, so `voteCounts.error`
9415
9562
  // cannot count it. Present on every completed vote (`skipped` when it did not
9416
9563
  // run); optional here only because the async envelope shares this schema.
9417
9564
  contrarianCheck: ContrarianCheckStatusSchema.optional(),
9418
- votes: z15.array(
9419
- z15.object({
9420
- role: z15.string().max(100),
9421
- decision: z15.enum(["approve", "reject", "abstain"]),
9422
- confidence: z15.number(),
9423
- reasoning: z15.string().max(4e3),
9424
- simulated: z15.boolean(),
9425
- error: z15.boolean(),
9426
- retried: z15.boolean().optional(),
9427
- retriedFrom: z15.object({
9428
- source: z15.enum(["error", "unverifiable"]),
9429
- error: z15.string().optional(),
9430
- errorTruncated: z15.literal(true).optional()
9565
+ votes: z16.array(
9566
+ z16.object({
9567
+ role: z16.string().max(100),
9568
+ decision: z16.enum(["approve", "reject", "abstain"]),
9569
+ confidence: z16.number(),
9570
+ reasoning: z16.string().max(4e3),
9571
+ simulated: z16.boolean(),
9572
+ error: z16.boolean(),
9573
+ retried: z16.boolean().optional(),
9574
+ retriedFrom: z16.object({
9575
+ source: z16.enum(["error", "unverifiable"]),
9576
+ error: z16.string().optional(),
9577
+ errorTruncated: z16.literal(true).optional()
9431
9578
  }).optional(),
9432
9579
  /** #6094: present only when the seat could not read the artifact. */
9433
- unverifiable: z15.literal(true).optional(),
9580
+ unverifiable: z16.literal(true).optional(),
9434
9581
  /** #6115: present only when the seat answered elsewhere than assigned. */
9435
- fallback: z15.object({
9436
- fromCli: z15.string().max(100),
9437
- fromModel: z15.string().max(100).optional(),
9438
- reason: z15.enum(["rate-limit", "capacity", "auth", "timeout", "sandbox", "unknown"])
9582
+ fallback: z16.object({
9583
+ fromCli: z16.string().max(100),
9584
+ fromModel: z16.string().max(100).optional(),
9585
+ reason: z16.enum(["rate-limit", "capacity", "auth", "timeout", "sandbox", "unknown"])
9439
9586
  }).optional(),
9440
- modelUsed: z15.string().max(100).optional(),
9441
- assignedModel: z15.string().max(100).optional(),
9442
- rejectionCategories: z15.array(
9443
- z15.enum([
9587
+ modelUsed: z16.string().max(100).optional(),
9588
+ assignedModel: z16.string().max(100).optional(),
9589
+ rejectionCategories: z16.array(
9590
+ z16.enum([
9444
9591
  "YAGNI",
9445
9592
  "DRY_VIOLATION",
9446
9593
  "OVER_ENGINEERING",
@@ -9453,64 +9600,64 @@ var CONSENSUS_VOTE_OUTPUT_SCHEMA = {
9453
9600
  })
9454
9601
  ).optional(),
9455
9602
  threshold: VoteThresholdSchema.optional(),
9456
- durationMs: z15.number().optional(),
9457
- simulateVotes: z15.boolean().optional(),
9603
+ durationMs: z16.number().optional(),
9604
+ simulateVotes: z16.boolean().optional(),
9458
9605
  // #6110: the project the panel judged and how the name was decided. Always
9459
9606
  // on the response; optional here like every field, because the async
9460
9607
  // `pending` envelope shares this schema.
9461
- project: z15.object({
9462
- name: z15.string().max(200),
9463
- source: z15.enum(["input", "derived", "default"])
9608
+ project: z16.object({
9609
+ name: z16.string().max(200),
9610
+ source: z16.enum(["input", "derived", "default"])
9464
9611
  }).optional(),
9465
9612
  // #6258: the working directory the panel's seats were pointed at. Absent
9466
9613
  // when no live seat ran (simulated panel) and on the async envelope.
9467
- workspace: z15.string().max(4096).optional(),
9468
- higherOrderMetadata: z15.object({
9469
- posteriorApproval: z15.number(),
9470
- posteriorRejection: z15.number(),
9471
- effectiveVoteCount: z15.number(),
9472
- method: z15.enum(["ow", "isp", "simple"]),
9473
- appliedToDecision: z15.boolean(),
9474
- usedCorrelationData: z15.boolean(),
9475
- improvementOverBaseline: z15.number(),
9476
- downweightedAgents: z15.array(z15.string().max(100)).max(10),
9477
- reasoning: z15.string().max(2e3)
9614
+ workspace: z16.string().max(4096).optional(),
9615
+ higherOrderMetadata: z16.object({
9616
+ posteriorApproval: z16.number(),
9617
+ posteriorRejection: z16.number(),
9618
+ effectiveVoteCount: z16.number(),
9619
+ method: z16.enum(["ow", "isp", "simple"]),
9620
+ appliedToDecision: z16.boolean(),
9621
+ usedCorrelationData: z16.boolean(),
9622
+ improvementOverBaseline: z16.number(),
9623
+ downweightedAgents: z16.array(z16.string().max(100)).max(10),
9624
+ reasoning: z16.string().max(2e3)
9478
9625
  }).optional(),
9479
9626
  // #3124: explains a `rejected` decision that coexists with a high
9480
9627
  // approvalPercentage (an error-policy short-circuit, e.g. fail_closed).
9481
- policyReason: z15.string().max(200).optional(),
9628
+ policyReason: z16.string().max(200).optional(),
9482
9629
  // #3991: whether the authentic vote record was persisted at vote time. Post-
9483
9630
  // #3991 it routes through nexusDataPath under governance/, so true is the
9484
9631
  // normal case; false means all-simulated (skipped by design) or write-failed
9485
9632
  // (data dir unwritable) — voteRecordNote carries the actionable reason. Makes
9486
9633
  // a previously WARN-only skip visible to MCP callers.
9487
- voteRecordPersisted: z15.boolean().optional(),
9488
- voteRecordNote: z15.string().max(500).optional(),
9634
+ voteRecordPersisted: z16.boolean().optional(),
9635
+ voteRecordNote: z16.string().max(500).optional(),
9489
9636
  // #5130: the persisted record's id, so the caller-commits script can name it.
9490
- voteRecordId: z15.string().max(200).optional(),
9637
+ voteRecordId: z16.string().max(200).optional(),
9491
9638
  // #3587: set when the panel DEGRADED (some voters errored), so the decision
9492
9639
  // rests on fewer voters than requested. Part of the response since #3587 but
9493
9640
  // omitted from this schema until #4032 — its absence made a strict MCP client
9494
9641
  // reject any degraded-panel vote (`-32602 additional properties`).
9495
- panelWarning: z15.string().optional(),
9642
+ panelWarning: z16.string().optional(),
9496
9643
  // #6115: distinct answering models and seats that answered elsewhere than
9497
9644
  // assigned. Always on the response (explicit zeros); optional here only
9498
9645
  // because the async `pending` envelope shares this schema.
9499
- panelDiversity: z15.object({
9500
- distinctModels: z15.number().int().nonnegative(),
9646
+ panelDiversity: z16.object({
9647
+ distinctModels: z16.number().int().nonnegative(),
9501
9648
  // #6606: distinct vendor families among the answering seats, and the
9502
9649
  // answering seats whose model names no recognised vendor.
9503
- distinctFamilies: z15.number().int().nonnegative(),
9504
- unclassifiedSeats: z15.number().int().nonnegative(),
9650
+ distinctFamilies: z16.number().int().nonnegative(),
9651
+ unclassifiedSeats: z16.number().int().nonnegative(),
9505
9652
  // #6660: answering seats whose model never resolved. Always set by
9506
9653
  // panelDiversityOf; optional so the published schema widens additively.
9507
- unresolvedSeats: z15.number().int().nonnegative().optional(),
9508
- fallbacks: z15.number().int().nonnegative()
9654
+ unresolvedSeats: z16.number().int().nonnegative().optional(),
9655
+ fallbacks: z16.number().int().nonnegative()
9509
9656
  }).optional(),
9510
9657
  // Assigned roster includes errored and abstaining seats. Absent when no
9511
9658
  // assignment resolved, including a zero-seat roster.
9512
- assignedDistinctModels: z15.number().int().nonnegative().optional(),
9513
- assignedDistinctFamilies: z15.number().int().nonnegative().optional(),
9659
+ assignedDistinctModels: z16.number().int().nonnegative().optional(),
9660
+ assignedDistinctFamilies: z16.number().int().nonnegative().optional(),
9514
9661
  // #3855: per-decision cost rollup. Same omission as panelWarning (#4032) — it
9515
9662
  // is present on the response whenever cost recording succeeds (common in `api`
9516
9663
  // billing mode). Shared schema lives with the type (single source of truth).
@@ -9518,18 +9665,18 @@ var CONSENSUS_VOTE_OUTPUT_SCHEMA = {
9518
9665
  // #4472: declared-option outcome. Present whenever the proposal declared
9519
9666
  // `options`. `unattributedApprovals` is part of the contract, not telemetry:
9520
9667
  // without it a caller cannot tell a real split from unreadable responses.
9521
- optionOutcome: z15.object({
9522
- tally: z15.array(z15.object({ option: z15.string(), count: z15.number().int().nonnegative() })),
9523
- leadingOption: z15.string().optional(),
9524
- leadingShare: z15.number().min(0).max(1),
9525
- approverCount: z15.number().int().nonnegative(),
9526
- selectedCount: z15.number().int().nonnegative(),
9527
- unattributedApprovals: z15.number().int().nonnegative(),
9528
- thresholdMet: z15.boolean(),
9668
+ optionOutcome: z16.object({
9669
+ tally: z16.array(z16.object({ option: z16.string(), count: z16.number().int().nonnegative() })),
9670
+ leadingOption: z16.string().optional(),
9671
+ leadingShare: z16.number().min(0).max(1),
9672
+ approverCount: z16.number().int().nonnegative(),
9673
+ selectedCount: z16.number().int().nonnegative(),
9674
+ unattributedApprovals: z16.number().int().nonnegative(),
9675
+ thresholdMet: z16.boolean(),
9529
9676
  // #4529: present only on a veto. Declared here because a strict MCP
9530
9677
  // client rejects any property the advertised schema omits — the same
9531
9678
  // drift that made degraded-panel votes unusable before #4032.
9532
- vetoReason: z15.string().max(400).optional()
9679
+ vetoReason: z16.string().max(400).optional()
9533
9680
  }).optional()
9534
9681
  };
9535
9682
  var CONSENSUS_VOTE_TOOL_SCHEMA = ConsensusVoteInputSchema.shape;
@@ -9630,6 +9777,7 @@ export {
9630
9777
  createOWVoting,
9631
9778
  HigherOrderVotingStrategy,
9632
9779
  createHigherOrderVotingStrategy,
9780
+ evaluateThreshold,
9633
9781
  determineFinalStatus,
9634
9782
  mapOutcomeToDecision,
9635
9783
  SimpleMajorityStrategy,
@@ -9676,4 +9824,4 @@ export {
9676
9824
  CONSENSUS_VOTE_TOOL_SCHEMA,
9677
9825
  registerConsensusVoteTool
9678
9826
  };
9679
- //# sourceMappingURL=chunk-JU4YPMVT.js.map
9827
+ //# sourceMappingURL=chunk-RKSJ26NV.js.map