nexus-agents 8.134.0 → 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.
- package/README.md +3 -3
- package/dist/{ast-rule-runner-5SVWE4V5.js → ast-rule-runner-YZJHACHU.js} +3 -3
- package/dist/{child-mcp-config-VQNTHRCM.js → child-mcp-config-KHQQELAI.js} +2 -2
- package/dist/{chunk-XI4CX52X.js → chunk-2WXJBBKO.js} +2 -2
- package/dist/{chunk-GN3OLNPH.js → chunk-3KUZPBWS.js} +214 -387
- package/dist/chunk-3KUZPBWS.js.map +1 -0
- package/dist/{chunk-5BRDJZ4X.js → chunk-62HV44OV.js} +52 -40
- package/dist/chunk-62HV44OV.js.map +1 -0
- package/dist/{chunk-45NAN3NB.js → chunk-6YQNRGZB.js} +6 -7
- package/dist/chunk-6YQNRGZB.js.map +1 -0
- package/dist/{chunk-CIAIGHES.js → chunk-7S4LRXKC.js} +5 -5
- package/dist/{chunk-2PSDEOKO.js → chunk-ADVSVEJN.js} +3 -3
- package/dist/{chunk-R2IQBO5W.js → chunk-BLJL23PR.js} +2 -2
- package/dist/{chunk-FF3QDRWF.js → chunk-DEFRD3HA.js} +5 -23
- package/dist/chunk-DEFRD3HA.js.map +1 -0
- package/dist/{chunk-6VISK4JT.js → chunk-FJWNB6MX.js} +8 -8
- package/dist/{chunk-6VR2KXYZ.js → chunk-GDFNFLVY.js} +4 -4
- package/dist/{chunk-T2LWKEIV.js → chunk-GL5BG6KN.js} +2 -2
- package/dist/{chunk-KJI4SNSK.js → chunk-HML33XXW.js} +4 -4
- package/dist/chunk-HML33XXW.js.map +1 -0
- package/dist/{chunk-LVQLLB2I.js → chunk-HZEIV7X4.js} +1154 -1228
- package/dist/chunk-HZEIV7X4.js.map +1 -0
- package/dist/{chunk-GXXOMV43.js → chunk-IF3AYOG7.js} +2 -2
- package/dist/{chunk-OF6F5ZGV.js → chunk-IFH4SUWP.js} +3 -3
- package/dist/{chunk-LSZKWDCP.js → chunk-J47IMTBW.js} +8 -8
- package/dist/{chunk-BG4MHTXJ.js → chunk-KNUQGHKM.js} +2 -2
- package/dist/{chunk-SBDWDV62.js → chunk-MAWUWFGW.js} +12 -24
- package/dist/{chunk-SBDWDV62.js.map → chunk-MAWUWFGW.js.map} +1 -1
- package/dist/{chunk-TMMPWFO2.js → chunk-MC36BXHL.js} +5 -5
- package/dist/{chunk-LAXFJRDX.js → chunk-N5EJMCYM.js} +2 -2
- package/dist/{chunk-TLXQ6CGF.js → chunk-NJDGEC2E.js} +2 -2
- package/dist/{chunk-VYT2YEK2.js → chunk-O5GIBXTN.js} +2 -2
- package/dist/{chunk-T7MEIXWY.js → chunk-OK3XZX72.js} +16 -16
- package/dist/chunk-OK3XZX72.js.map +1 -0
- package/dist/{chunk-R77KXHK4.js → chunk-OUS7OK67.js} +2 -2
- package/dist/{chunk-VLNILPYJ.js → chunk-PZ2CF5TU.js} +4 -4
- package/dist/{chunk-XZ3Z7VO5.js → chunk-PZ4V5PEM.js} +3 -3
- package/dist/{chunk-JA6Q3OO2.js → chunk-Q6K4URO4.js} +2 -2
- package/dist/{chunk-BGHKG77F.js → chunk-QQKCEEIZ.js} +5 -5
- package/dist/{chunk-UBFCQKFZ.js → chunk-RC2Q4UQE.js} +5 -5
- package/dist/{chunk-LE4FXYYZ.js → chunk-RYUW6T7M.js} +2 -2
- package/dist/{chunk-IIMSXW5L.js → chunk-SAHVCQFW.js} +2 -2
- package/dist/{chunk-LO53UJFH.js → chunk-T6AF7LN3.js} +4 -4
- package/dist/chunk-T6AF7LN3.js.map +1 -0
- package/dist/{chunk-AHI43IQB.js → chunk-TDTCWDZR.js} +2 -2
- package/dist/{chunk-AHI43IQB.js.map → chunk-TDTCWDZR.js.map} +1 -1
- package/dist/{chunk-CYOV4UZ3.js → chunk-V2XMYJUS.js} +2 -2
- package/dist/{chunk-A6CTHKSJ.js → chunk-VPT5T2JN.js} +2 -2
- package/dist/{chunk-OXCREJDI.js → chunk-Z56THMPG.js} +3 -3
- package/dist/{cli-circuit-breaker-JE4HNST7.js → cli-circuit-breaker-AUYQTMVX.js} +3 -3
- package/dist/{cli-readiness-GPWH5AC2.js → cli-readiness-CX7MZE7Y.js} +7 -7
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +50 -56
- package/dist/cli.js.map +1 -1
- package/dist/{composite-router-BZFN3Z4F.js → composite-router-IE5QVX2J.js} +2 -2
- package/dist/{consensus-vote-35OIKULP.js → consensus-vote-GIVVS7ZD.js} +17 -17
- package/dist/{consensus-vote-types-Coff77gH.d.ts → consensus-vote-types-D2RbRYve.d.ts} +23 -95
- package/dist/{context-retriever-7N4CDXYP.js → context-retriever-OCI25GLA.js} +8 -8
- package/dist/{doctor-deep-GIJ3IVZD.js → doctor-deep-L3ITO5TU.js} +3 -3
- package/dist/{doctor-gateway-report-ZPQ5ZG4X.js → doctor-gateway-report-AVIS6QSE.js} +7 -7
- package/dist/{doctor-live-UXGMT4ZA.js → doctor-live-3ST56HBO.js} +11 -11
- package/dist/{expert-bridge-XTTYNDBS.js → expert-bridge-4QAURLMN.js} +4 -4
- package/dist/{expert-config-JSQTCTSE.js → expert-config-3LQMRQ24.js} +2 -2
- package/dist/{factory-VUK2KP76.js → factory-7XCDUXY7.js} +5 -5
- package/dist/{factory-UGMGVQTP.js → factory-KYPD5ONA.js} +10 -10
- package/dist/{improvement-review-WMCUNTA5.js → improvement-review-4FUKBWXL.js} +6 -6
- package/dist/index.d.ts +77 -235
- package/dist/index.js +60 -65
- package/dist/index.js.map +1 -1
- package/dist/{init-opencode-QD2XTPRZ.js → init-opencode-PSKYIV5I.js} +6 -6
- package/dist/{issue-triage-CAJ232ZV.js → issue-triage-HMQ3V5MC.js} +6 -6
- package/dist/{model-config-helpers-7HLTRIXX.js → model-config-helpers-3Y6VAZDJ.js} +2 -2
- package/dist/{openai-compat-adapter-BIMDUZUY.js → openai-compat-adapter-LY65VHEJ.js} +6 -6
- package/dist/{outcome-store-adapter-FEIYXOV5.js → outcome-store-adapter-OL5JSBOD.js} +2 -2
- package/dist/{pr-reviewer-helpers-IAUYVEZF.js → pr-reviewer-helpers-S7M2XNFQ.js} +4 -4
- package/dist/{registry-command-E3QDLFIT.js → registry-command-NDWT3AO3.js} +2 -2
- package/dist/{repo-security-plan-NNALBUDS.js → repo-security-plan-LDVNJEIY.js} +3 -3
- package/dist/{research-helpers-synthesize-5RFBOOFU.js → research-helpers-synthesize-JC3LK62G.js} +4 -4
- package/dist/{routing-memory-77IYSA2Q.js → routing-memory-3SRLLWW4.js} +2 -2
- package/dist/{session-memory-X2Y5BJGJ.js → session-memory-TUQNQK2C.js} +3 -3
- package/dist/{setup-config-7P6IBTPP.js → setup-config-3P3VJ4S5.js} +3 -3
- package/dist/{setup-custom-api-IZJDTTGF.js → setup-custom-api-U2STU4Z2.js} +3 -3
- package/dist/setup-data-dir-376ODJHS.js +36 -0
- package/dist/{tool-memory-H6MKQFJX.js → tool-memory-S4HCE6NT.js} +5 -5
- package/dist/{unified-registry-ITHFGNVT.js → unified-registry-2BU4BMWW.js} +11 -11
- package/dist/{weather-report-RXFQNN3D.js → weather-report-KBF6NSFM.js} +2 -2
- package/package.json +2 -2
- package/dist/chunk-45NAN3NB.js.map +0 -1
- package/dist/chunk-5BRDJZ4X.js.map +0 -1
- package/dist/chunk-FF3QDRWF.js.map +0 -1
- package/dist/chunk-GN3OLNPH.js.map +0 -1
- package/dist/chunk-KJI4SNSK.js.map +0 -1
- package/dist/chunk-LO53UJFH.js.map +0 -1
- package/dist/chunk-LVQLLB2I.js.map +0 -1
- package/dist/chunk-T7MEIXWY.js.map +0 -1
- package/dist/setup-data-dir-RQRZTOOH.js +0 -36
- /package/dist/{ast-rule-runner-5SVWE4V5.js.map → ast-rule-runner-YZJHACHU.js.map} +0 -0
- /package/dist/{child-mcp-config-VQNTHRCM.js.map → child-mcp-config-KHQQELAI.js.map} +0 -0
- /package/dist/{chunk-XI4CX52X.js.map → chunk-2WXJBBKO.js.map} +0 -0
- /package/dist/{chunk-CIAIGHES.js.map → chunk-7S4LRXKC.js.map} +0 -0
- /package/dist/{chunk-2PSDEOKO.js.map → chunk-ADVSVEJN.js.map} +0 -0
- /package/dist/{chunk-R2IQBO5W.js.map → chunk-BLJL23PR.js.map} +0 -0
- /package/dist/{chunk-6VISK4JT.js.map → chunk-FJWNB6MX.js.map} +0 -0
- /package/dist/{chunk-6VR2KXYZ.js.map → chunk-GDFNFLVY.js.map} +0 -0
- /package/dist/{chunk-T2LWKEIV.js.map → chunk-GL5BG6KN.js.map} +0 -0
- /package/dist/{chunk-GXXOMV43.js.map → chunk-IF3AYOG7.js.map} +0 -0
- /package/dist/{chunk-OF6F5ZGV.js.map → chunk-IFH4SUWP.js.map} +0 -0
- /package/dist/{chunk-LSZKWDCP.js.map → chunk-J47IMTBW.js.map} +0 -0
- /package/dist/{chunk-BG4MHTXJ.js.map → chunk-KNUQGHKM.js.map} +0 -0
- /package/dist/{chunk-TMMPWFO2.js.map → chunk-MC36BXHL.js.map} +0 -0
- /package/dist/{chunk-LAXFJRDX.js.map → chunk-N5EJMCYM.js.map} +0 -0
- /package/dist/{chunk-TLXQ6CGF.js.map → chunk-NJDGEC2E.js.map} +0 -0
- /package/dist/{chunk-VYT2YEK2.js.map → chunk-O5GIBXTN.js.map} +0 -0
- /package/dist/{chunk-R77KXHK4.js.map → chunk-OUS7OK67.js.map} +0 -0
- /package/dist/{chunk-VLNILPYJ.js.map → chunk-PZ2CF5TU.js.map} +0 -0
- /package/dist/{chunk-XZ3Z7VO5.js.map → chunk-PZ4V5PEM.js.map} +0 -0
- /package/dist/{chunk-JA6Q3OO2.js.map → chunk-Q6K4URO4.js.map} +0 -0
- /package/dist/{chunk-BGHKG77F.js.map → chunk-QQKCEEIZ.js.map} +0 -0
- /package/dist/{chunk-UBFCQKFZ.js.map → chunk-RC2Q4UQE.js.map} +0 -0
- /package/dist/{chunk-LE4FXYYZ.js.map → chunk-RYUW6T7M.js.map} +0 -0
- /package/dist/{chunk-IIMSXW5L.js.map → chunk-SAHVCQFW.js.map} +0 -0
- /package/dist/{chunk-CYOV4UZ3.js.map → chunk-V2XMYJUS.js.map} +0 -0
- /package/dist/{chunk-A6CTHKSJ.js.map → chunk-VPT5T2JN.js.map} +0 -0
- /package/dist/{chunk-OXCREJDI.js.map → chunk-Z56THMPG.js.map} +0 -0
- /package/dist/{cli-circuit-breaker-JE4HNST7.js.map → cli-circuit-breaker-AUYQTMVX.js.map} +0 -0
- /package/dist/{cli-readiness-GPWH5AC2.js.map → cli-readiness-CX7MZE7Y.js.map} +0 -0
- /package/dist/{composite-router-BZFN3Z4F.js.map → composite-router-IE5QVX2J.js.map} +0 -0
- /package/dist/{consensus-vote-35OIKULP.js.map → consensus-vote-GIVVS7ZD.js.map} +0 -0
- /package/dist/{context-retriever-7N4CDXYP.js.map → context-retriever-OCI25GLA.js.map} +0 -0
- /package/dist/{doctor-deep-GIJ3IVZD.js.map → doctor-deep-L3ITO5TU.js.map} +0 -0
- /package/dist/{doctor-gateway-report-ZPQ5ZG4X.js.map → doctor-gateway-report-AVIS6QSE.js.map} +0 -0
- /package/dist/{doctor-live-UXGMT4ZA.js.map → doctor-live-3ST56HBO.js.map} +0 -0
- /package/dist/{expert-bridge-XTTYNDBS.js.map → expert-bridge-4QAURLMN.js.map} +0 -0
- /package/dist/{expert-config-JSQTCTSE.js.map → expert-config-3LQMRQ24.js.map} +0 -0
- /package/dist/{factory-UGMGVQTP.js.map → factory-7XCDUXY7.js.map} +0 -0
- /package/dist/{factory-VUK2KP76.js.map → factory-KYPD5ONA.js.map} +0 -0
- /package/dist/{improvement-review-WMCUNTA5.js.map → improvement-review-4FUKBWXL.js.map} +0 -0
- /package/dist/{init-opencode-QD2XTPRZ.js.map → init-opencode-PSKYIV5I.js.map} +0 -0
- /package/dist/{issue-triage-CAJ232ZV.js.map → issue-triage-HMQ3V5MC.js.map} +0 -0
- /package/dist/{model-config-helpers-7HLTRIXX.js.map → model-config-helpers-3Y6VAZDJ.js.map} +0 -0
- /package/dist/{openai-compat-adapter-BIMDUZUY.js.map → openai-compat-adapter-LY65VHEJ.js.map} +0 -0
- /package/dist/{outcome-store-adapter-FEIYXOV5.js.map → outcome-store-adapter-OL5JSBOD.js.map} +0 -0
- /package/dist/{pr-reviewer-helpers-IAUYVEZF.js.map → pr-reviewer-helpers-S7M2XNFQ.js.map} +0 -0
- /package/dist/{registry-command-E3QDLFIT.js.map → registry-command-NDWT3AO3.js.map} +0 -0
- /package/dist/{repo-security-plan-NNALBUDS.js.map → repo-security-plan-LDVNJEIY.js.map} +0 -0
- /package/dist/{research-helpers-synthesize-5RFBOOFU.js.map → research-helpers-synthesize-JC3LK62G.js.map} +0 -0
- /package/dist/{routing-memory-77IYSA2Q.js.map → routing-memory-3SRLLWW4.js.map} +0 -0
- /package/dist/{session-memory-X2Y5BJGJ.js.map → session-memory-TUQNQK2C.js.map} +0 -0
- /package/dist/{setup-config-7P6IBTPP.js.map → setup-config-3P3VJ4S5.js.map} +0 -0
- /package/dist/{setup-custom-api-IZJDTTGF.js.map → setup-custom-api-U2STU4Z2.js.map} +0 -0
- /package/dist/{setup-data-dir-RQRZTOOH.js.map → setup-data-dir-376ODJHS.js.map} +0 -0
- /package/dist/{tool-memory-H6MKQFJX.js.map → tool-memory-S4HCE6NT.js.map} +0 -0
- /package/dist/{unified-registry-ITHFGNVT.js.map → unified-registry-2BU4BMWW.js.map} +0 -0
- /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-
|
|
24
|
+
} from "./chunk-MAWUWFGW.js";
|
|
25
25
|
import {
|
|
26
26
|
getToolMemory
|
|
27
|
-
} from "./chunk-
|
|
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-
|
|
33
|
+
} from "./chunk-T6AF7LN3.js";
|
|
34
34
|
import {
|
|
35
35
|
isGatewayModelAdapter
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-QQKCEEIZ.js";
|
|
37
37
|
import {
|
|
38
38
|
ModelBoundAdapter,
|
|
39
39
|
createEvent,
|
|
40
40
|
getGlobalRegistry
|
|
41
|
-
} from "./chunk-
|
|
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-
|
|
49
|
+
} from "./chunk-J47IMTBW.js";
|
|
50
50
|
import {
|
|
51
51
|
ensureGatewayDiscovered
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-Z56THMPG.js";
|
|
53
53
|
import {
|
|
54
54
|
delay,
|
|
55
55
|
getAbortObservation,
|
|
56
56
|
sleep,
|
|
57
57
|
withTimeout
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-MC36BXHL.js";
|
|
59
59
|
import {
|
|
60
60
|
getDefaultCliCircuitBreakerRegistry
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-SAHVCQFW.js";
|
|
62
62
|
import {
|
|
63
63
|
sanitizeErrorDetails,
|
|
64
64
|
sanitizeOutput,
|
|
65
65
|
sanitizeStringLeaves
|
|
66
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-OUS7OK67.js";
|
|
67
67
|
import {
|
|
68
68
|
AgentError,
|
|
69
69
|
DecisionCostStore,
|
|
@@ -118,7 +118,7 @@ import {
|
|
|
118
118
|
servedCostDetail,
|
|
119
119
|
stepBus,
|
|
120
120
|
voteRecordWriteFailedMessage
|
|
121
|
-
} from "./chunk-
|
|
121
|
+
} from "./chunk-62HV44OV.js";
|
|
122
122
|
import {
|
|
123
123
|
ensureLearningDir,
|
|
124
124
|
getOutcomesFile
|
|
@@ -144,70 +144,6 @@ import { randomUUID as randomUUID4 } from "node:crypto";
|
|
|
144
144
|
import { basename as basename2 } from "node:path";
|
|
145
145
|
import { z as z15 } from "zod";
|
|
146
146
|
|
|
147
|
-
// src/mcp/tools/async-dispatch-input.ts
|
|
148
|
-
import { z } from "zod";
|
|
149
|
-
var DISPATCH_MODES = ["sync", "async"];
|
|
150
|
-
var MODE_ALIAS_REMOVAL_ISSUE = "#6225";
|
|
151
|
-
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 }).";
|
|
152
|
-
var WRONG_KEY_MODE_MESSAGE = '`mode` is not the async switch on this tool; send `dispatch: "async"` (or "sync") instead (#4968).';
|
|
153
|
-
function dispatchModeConflictMessage(dispatch, mode) {
|
|
154
|
-
return `\`dispatch: "${dispatch}"\` and \`mode: "${mode}"\` disagree; send only \`dispatch\` (\`mode\` is a deprecated alias, removed in ${MODE_ALIAS_REMOVAL_ISSUE}).`;
|
|
155
|
-
}
|
|
156
|
-
function describeDispatch(note) {
|
|
157
|
-
return note === void 0 ? DISPATCH_DESCRIPTION : `${DISPATCH_DESCRIPTION} ${note}`;
|
|
158
|
-
}
|
|
159
|
-
function dispatchField(note) {
|
|
160
|
-
return z.enum(DISPATCH_MODES).optional().describe(describeDispatch(note));
|
|
161
|
-
}
|
|
162
|
-
function dispatchFieldDefaultSync(note) {
|
|
163
|
-
return z.enum(DISPATCH_MODES).default("sync").describe(describeDispatch(note));
|
|
164
|
-
}
|
|
165
|
-
var REJECTED_MODE_KEY = z.never({ error: WRONG_KEY_MODE_MESSAGE }).optional().describe(
|
|
166
|
-
"Not an input of this tool. The async switch is `dispatch`; `mode: 'async'` is rejected (#4968)."
|
|
167
|
-
);
|
|
168
|
-
function asyncDispatchInput(note) {
|
|
169
|
-
return { dispatch: dispatchField(note), mode: REJECTED_MODE_KEY };
|
|
170
|
-
}
|
|
171
|
-
function asyncDispatchInputDefaultSync(note) {
|
|
172
|
-
return { dispatch: dispatchFieldDefaultSync(note), mode: REJECTED_MODE_KEY };
|
|
173
|
-
}
|
|
174
|
-
function modeEnumErrorNamingDispatch(issue) {
|
|
175
|
-
return isDispatchMode(issue.input) ? WRONG_KEY_MODE_MESSAGE : void 0;
|
|
176
|
-
}
|
|
177
|
-
function isDispatchMode(value) {
|
|
178
|
-
return value === "sync" || value === "async";
|
|
179
|
-
}
|
|
180
|
-
var DEPRECATED_MODE_ALIAS_INPUT = {
|
|
181
|
-
dispatch: dispatchField(),
|
|
182
|
-
mode: z.enum(DISPATCH_MODES).optional().describe(
|
|
183
|
-
`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.`
|
|
184
|
-
)
|
|
185
|
-
};
|
|
186
|
-
function refineDispatchModeAgreement(value, ctx) {
|
|
187
|
-
if (value.dispatch === void 0 || value.mode === void 0) return;
|
|
188
|
-
if (value.dispatch === value.mode) return;
|
|
189
|
-
ctx.addIssue({
|
|
190
|
-
code: "custom",
|
|
191
|
-
path: ["dispatch"],
|
|
192
|
-
message: dispatchModeConflictMessage(value.dispatch, value.mode)
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
function resolveDispatch(input) {
|
|
196
|
-
return input.dispatch ?? input.mode;
|
|
197
|
-
}
|
|
198
|
-
function deprecatedModeWarning(input) {
|
|
199
|
-
if (input.mode === void 0 || input.dispatch !== void 0) return void 0;
|
|
200
|
-
return `\`mode: "${input.mode}"\` is deprecated; send \`dispatch: "${input.mode}"\`. \`mode\` is removed in the next major (${MODE_ALIAS_REMOVAL_ISSUE}).`;
|
|
201
|
-
}
|
|
202
|
-
var WARNINGS_META_KEY = "nexus-agents/warnings";
|
|
203
|
-
function withWarnings(result, warnings) {
|
|
204
|
-
const present = warnings.filter((w) => w !== void 0);
|
|
205
|
-
if (present.length === 0) return result;
|
|
206
|
-
const existing = result._meta?.[WARNINGS_META_KEY];
|
|
207
|
-
const prior = Array.isArray(existing) ? existing.filter((w) => typeof w === "string") : [];
|
|
208
|
-
return { ...result, _meta: { ...result._meta, [WARNINGS_META_KEY]: [...prior, ...present] } };
|
|
209
|
-
}
|
|
210
|
-
|
|
211
147
|
// src/cli/voter-roles.ts
|
|
212
148
|
var VOTER_ROLES = {
|
|
213
149
|
architect: "Software Architect - evaluates technical design, scalability, and maintainability",
|
|
@@ -825,7 +761,7 @@ var SIMULATED_VOTE_REASONING = {
|
|
|
825
761
|
};
|
|
826
762
|
|
|
827
763
|
// src/cli/voter-response.ts
|
|
828
|
-
import { z
|
|
764
|
+
import { z } from "zod";
|
|
829
765
|
|
|
830
766
|
// src/consensus/option-tally.ts
|
|
831
767
|
var SUPERMAJORITY_SHARE = 2 / 3;
|
|
@@ -885,26 +821,26 @@ var SyntheticVoteError = class extends Error {
|
|
|
885
821
|
}
|
|
886
822
|
rawOutput;
|
|
887
823
|
};
|
|
888
|
-
var RawFindingSchema =
|
|
889
|
-
summary:
|
|
890
|
-
location:
|
|
891
|
-
severity:
|
|
892
|
-
gate:
|
|
893
|
-
reread_cited_line:
|
|
894
|
-
traced_call_path:
|
|
895
|
-
named_assertion:
|
|
896
|
-
ruled_out_language_non_issue:
|
|
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")
|
|
897
833
|
}),
|
|
898
|
-
claim:
|
|
834
|
+
claim: z.string().min(1).max(2e3).describe("What is wrong and why it justifies blocking")
|
|
899
835
|
});
|
|
900
|
-
var VoteResponseSchema =
|
|
901
|
-
decision:
|
|
902
|
-
reasoning:
|
|
903
|
-
confidence:
|
|
904
|
-
conditions:
|
|
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"),
|
|
905
841
|
/** Structured rejection categories for reject→refine→re-vote loops (Issue #1213). */
|
|
906
|
-
rejectionCategories:
|
|
907
|
-
|
|
842
|
+
rejectionCategories: z.array(
|
|
843
|
+
z.enum([
|
|
908
844
|
"YAGNI",
|
|
909
845
|
"DRY_VIOLATION",
|
|
910
846
|
"OVER_ENGINEERING",
|
|
@@ -916,11 +852,11 @@ var VoteResponseSchema = z2.object({
|
|
|
916
852
|
).optional().describe("Rejection reason categories when decision is reject"),
|
|
917
853
|
/** Top-level structured findings for PR-review mode (#2245 v4 follow-up).
|
|
918
854
|
* Replaces the YAML-in-reasoning encoding that proved lossy. */
|
|
919
|
-
findings:
|
|
855
|
+
findings: z.array(RawFindingSchema).optional().describe("Structured findings (PR review only)"),
|
|
920
856
|
/** Chosen option when the proposal declared `options` (#4472). Validated
|
|
921
857
|
* against the declared list by the caller; an unmatched value is dropped
|
|
922
858
|
* rather than recorded, so a parse miss surfaces as absent. */
|
|
923
|
-
selectedOption:
|
|
859
|
+
selectedOption: z.string().optional().describe("Which declared option you choose")
|
|
924
860
|
});
|
|
925
861
|
var VOTE_JSON_SCHEMA = {
|
|
926
862
|
type: "object",
|
|
@@ -2453,9 +2389,9 @@ ${content}
|
|
|
2453
2389
|
// src/cli/voter-project.ts
|
|
2454
2390
|
import { readFileSync, statSync } from "node:fs";
|
|
2455
2391
|
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
2456
|
-
import { z as
|
|
2392
|
+
import { z as z2 } from "zod";
|
|
2457
2393
|
var VOTER_PROJECT_PATTERN = /^[A-Za-z0-9._/@-]{1,200}$/;
|
|
2458
|
-
var VoterProjectInputSchema =
|
|
2394
|
+
var VoterProjectInputSchema = z2.string().regex(VOTER_PROJECT_PATTERN).optional().describe(
|
|
2459
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."
|
|
2460
2396
|
);
|
|
2461
2397
|
var MAX_ANCESTOR_DEPTH = 64;
|
|
@@ -2588,10 +2524,9 @@ var STRATEGY_TO_OPTION_THRESHOLD = {
|
|
|
2588
2524
|
unanimous: "unanimous",
|
|
2589
2525
|
supermajority: "supermajority",
|
|
2590
2526
|
simple_majority: "majority",
|
|
2591
|
-
//
|
|
2527
|
+
// Higher-order strategies aggregate differently; they are gated at
|
|
2592
2528
|
// the majority bar so a declared-option split still cannot pass unnoticed.
|
|
2593
2529
|
higher_order: "majority",
|
|
2594
|
-
proof_of_learning: "majority",
|
|
2595
2530
|
opinion_wise: "majority"
|
|
2596
2531
|
};
|
|
2597
2532
|
function optionThresholdFor(strategy, legacyThreshold) {
|
|
@@ -2621,40 +2556,40 @@ function describeVeto(verdict) {
|
|
|
2621
2556
|
}
|
|
2622
2557
|
|
|
2623
2558
|
// src/consensus/types-voting-protocol.ts
|
|
2624
|
-
import { z as
|
|
2559
|
+
import { z as z3 } from "zod";
|
|
2625
2560
|
var VOTING_ROUND_DEFAULT_TIMEOUT_MS = OPERATION_CLASSES["multi-llm-panel"].guardMs;
|
|
2626
|
-
var VotingRoundPhaseSchema =
|
|
2627
|
-
var VotingRoundStatusSchema =
|
|
2561
|
+
var VotingRoundPhaseSchema = z3.enum(["analysis", "deliberation", "consensus"]);
|
|
2562
|
+
var VotingRoundStatusSchema = z3.enum([
|
|
2628
2563
|
"pending",
|
|
2629
2564
|
"in_progress",
|
|
2630
2565
|
"awaiting_votes",
|
|
2631
2566
|
"completed",
|
|
2632
2567
|
"aborted"
|
|
2633
2568
|
]);
|
|
2634
|
-
var AgentFindingSchema =
|
|
2635
|
-
agentId:
|
|
2636
|
-
category:
|
|
2637
|
-
severity:
|
|
2638
|
-
description:
|
|
2639
|
-
location:
|
|
2640
|
-
suggestion:
|
|
2641
|
-
confidence:
|
|
2642
|
-
timestamp:
|
|
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()
|
|
2643
2578
|
});
|
|
2644
|
-
var FindingVoteSchema =
|
|
2645
|
-
agentId:
|
|
2646
|
-
findingId:
|
|
2647
|
-
agree:
|
|
2648
|
-
reasoning:
|
|
2649
|
-
amendedSeverity:
|
|
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()
|
|
2650
2585
|
});
|
|
2651
|
-
var VotingProtocolConfigSchema =
|
|
2652
|
-
committeeSize:
|
|
2653
|
-
maxRounds:
|
|
2654
|
-
roundTimeoutMs:
|
|
2655
|
-
agreementThreshold:
|
|
2656
|
-
enableAntiSycophancy:
|
|
2657
|
-
sycophancyThreshold:
|
|
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)
|
|
2658
2593
|
});
|
|
2659
2594
|
var DEFAULT_VOTING_PROTOCOL_CONFIG = {
|
|
2660
2595
|
committeeSize: 3,
|
|
@@ -2667,30 +2602,30 @@ var DEFAULT_VOTING_PROTOCOL_CONFIG = {
|
|
|
2667
2602
|
};
|
|
2668
2603
|
|
|
2669
2604
|
// src/consensus/types-weighted-voting.ts
|
|
2670
|
-
import { z as
|
|
2671
|
-
var TaskOutcomeStatusSchema =
|
|
2672
|
-
var WeightedAgentRecordSchema =
|
|
2673
|
-
agentId:
|
|
2674
|
-
totalTasks:
|
|
2675
|
-
successfulTasks:
|
|
2676
|
-
failedTasks:
|
|
2677
|
-
partialTasks:
|
|
2678
|
-
successRate:
|
|
2679
|
-
weight:
|
|
2680
|
-
trustScore:
|
|
2681
|
-
byzantineFlags:
|
|
2682
|
-
lastActive:
|
|
2683
|
-
createdAt:
|
|
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()
|
|
2684
2619
|
});
|
|
2685
|
-
var WeightedVotingConfigSchema =
|
|
2686
|
-
minWeight:
|
|
2687
|
-
maxByzantineFraction:
|
|
2688
|
-
weightDecayFactor:
|
|
2689
|
-
weightRecoveryFactor:
|
|
2690
|
-
minTrustScore:
|
|
2691
|
-
byzantineFlagThreshold:
|
|
2692
|
-
initialWeight:
|
|
2693
|
-
quorumThreshold:
|
|
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)
|
|
2694
2629
|
});
|
|
2695
2630
|
var DEFAULT_WEIGHTED_VOTING_CONFIG = {
|
|
2696
2631
|
minWeight: 0.1,
|
|
@@ -2705,7 +2640,7 @@ var DEFAULT_WEIGHTED_VOTING_CONFIG = {
|
|
|
2705
2640
|
};
|
|
2706
2641
|
|
|
2707
2642
|
// src/consensus/higher-order-types.ts
|
|
2708
|
-
import { z as
|
|
2643
|
+
import { z as z5 } from "zod";
|
|
2709
2644
|
function createAgentPairKey(agentA, agentB) {
|
|
2710
2645
|
return agentA < agentB ? `${agentA}:${agentB}` : `${agentB}:${agentA}`;
|
|
2711
2646
|
}
|
|
@@ -2716,84 +2651,72 @@ function parseAgentPairKey(key) {
|
|
|
2716
2651
|
}
|
|
2717
2652
|
return [parts[0], parts[1]];
|
|
2718
2653
|
}
|
|
2719
|
-
var CorrelationCoefficientSchema =
|
|
2720
|
-
var IndependentSubsetSchema =
|
|
2721
|
-
id:
|
|
2722
|
-
agentIds:
|
|
2723
|
-
independenceScore:
|
|
2724
|
-
pairCoverage:
|
|
2725
|
-
observed:
|
|
2726
|
-
total:
|
|
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()
|
|
2727
2662
|
}),
|
|
2728
|
-
observationCount:
|
|
2663
|
+
observationCount: z5.number().int().nonnegative()
|
|
2729
2664
|
});
|
|
2730
|
-
var VotingObservationSchema =
|
|
2731
|
-
proposalId:
|
|
2732
|
-
agentId:
|
|
2733
|
-
decision:
|
|
2734
|
-
confidence:
|
|
2735
|
-
alignedWithOutcome:
|
|
2736
|
-
timestamp:
|
|
2737
|
-
modelKey:
|
|
2738
|
-
observedModel:
|
|
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()
|
|
2739
2674
|
});
|
|
2740
|
-
var PairwiseVotingHistorySchema =
|
|
2741
|
-
pairKey:
|
|
2742
|
-
jointObservations:
|
|
2743
|
-
agreements:
|
|
2744
|
-
disagreements:
|
|
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(),
|
|
2745
2680
|
correlation: CorrelationCoefficientSchema,
|
|
2746
|
-
lastUpdated:
|
|
2681
|
+
lastUpdated: z5.date()
|
|
2747
2682
|
});
|
|
2748
|
-
var HigherOrderVotingConfigSchema =
|
|
2749
|
-
minObservationsForCorrelation:
|
|
2750
|
-
correlationThreshold:
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
independenceThreshold: z6.number().min(0).max(1).default(0.2),
|
|
2757
|
-
fallbackToSimpleVoting: z6.boolean().default(true),
|
|
2758
|
-
/**
|
|
2759
|
-
* @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).
|
|
2760
|
-
*/
|
|
2761
|
-
observationDecayFactor: z6.number().min(0).max(1).default(0.95),
|
|
2762
|
-
maxObservationsPerAgent: z6.number().int().positive().default(1e3),
|
|
2763
|
-
maxProposals: z6.number().int().positive().default(5e3),
|
|
2764
|
-
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)
|
|
2765
2691
|
});
|
|
2766
2692
|
var DEFAULT_HIGHER_ORDER_CONFIG = {
|
|
2767
2693
|
minObservationsForCorrelation: 10,
|
|
2768
2694
|
correlationThreshold: 0.3,
|
|
2769
|
-
correlationMaxAgeMs: 864e5,
|
|
2770
|
-
// 24 hours
|
|
2771
2695
|
independenceThreshold: 0.2,
|
|
2772
2696
|
fallbackToSimpleVoting: true,
|
|
2773
|
-
observationDecayFactor: 0.95,
|
|
2774
2697
|
maxObservationsPerAgent: 1e3,
|
|
2775
2698
|
maxProposals: 5e3,
|
|
2776
2699
|
maxTrackedPairs: 100
|
|
2777
2700
|
};
|
|
2778
|
-
var HigherOrderVotingResultSchema =
|
|
2779
|
-
decision:
|
|
2780
|
-
posteriorApproval:
|
|
2781
|
-
posteriorRejection:
|
|
2782
|
-
effectiveVoteCount:
|
|
2783
|
-
usedCorrelationData:
|
|
2784
|
-
method:
|
|
2785
|
-
improvementOverBaseline:
|
|
2786
|
-
independentSubsets:
|
|
2787
|
-
downweightedAgents:
|
|
2788
|
-
reasoning:
|
|
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()
|
|
2789
2712
|
});
|
|
2790
|
-
var CorrelationTrackerStatsSchema =
|
|
2791
|
-
totalAgents:
|
|
2792
|
-
trackedPairs:
|
|
2793
|
-
totalObservations:
|
|
2794
|
-
averageCorrelation:
|
|
2795
|
-
independentSubsetCount:
|
|
2796
|
-
pairsWithSufficientData:
|
|
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()
|
|
2797
2720
|
});
|
|
2798
2721
|
|
|
2799
2722
|
// src/consensus/higher-order-helpers.ts
|
|
@@ -3266,14 +3189,6 @@ function resolveVoteDecision(input, result, errorCount) {
|
|
|
3266
3189
|
}
|
|
3267
3190
|
|
|
3268
3191
|
// src/consensus/strategies.ts
|
|
3269
|
-
function deriveWeightBasis(votes, weights) {
|
|
3270
|
-
let withRecord = 0;
|
|
3271
|
-
for (const agentId of votes.keys()) {
|
|
3272
|
-
if (weights.has(agentId)) withRecord++;
|
|
3273
|
-
}
|
|
3274
|
-
if (withRecord === 0) return "unweighted";
|
|
3275
|
-
return withRecord === votes.size ? "performance" : "partial";
|
|
3276
|
-
}
|
|
3277
3192
|
var BaseVotingStrategy = class {
|
|
3278
3193
|
/**
|
|
3279
3194
|
* Count votes by decision type.
|
|
@@ -3297,31 +3212,6 @@ var BaseVotingStrategy = class {
|
|
|
3297
3212
|
}
|
|
3298
3213
|
return { approve, reject, abstain, total: votes.size };
|
|
3299
3214
|
}
|
|
3300
|
-
/**
|
|
3301
|
-
* Calculate weighted vote counts using agent performance weights.
|
|
3302
|
-
*/
|
|
3303
|
-
countWeightedVotes(votes, weights) {
|
|
3304
|
-
let approve = 0;
|
|
3305
|
-
let reject = 0;
|
|
3306
|
-
let abstain = 0;
|
|
3307
|
-
let totalWeight = 0;
|
|
3308
|
-
for (const [agentId, vote] of votes.entries()) {
|
|
3309
|
-
const weight = weights.get(agentId) ?? 1;
|
|
3310
|
-
totalWeight += weight;
|
|
3311
|
-
switch (vote.decision) {
|
|
3312
|
-
case "approve":
|
|
3313
|
-
approve += weight;
|
|
3314
|
-
break;
|
|
3315
|
-
case "reject":
|
|
3316
|
-
reject += weight;
|
|
3317
|
-
break;
|
|
3318
|
-
case "abstain":
|
|
3319
|
-
abstain += weight;
|
|
3320
|
-
break;
|
|
3321
|
-
}
|
|
3322
|
-
}
|
|
3323
|
-
return { approve, reject, abstain, totalWeight };
|
|
3324
|
-
}
|
|
3325
3215
|
};
|
|
3326
3216
|
var SimpleMajorityStrategy = class extends BaseVotingStrategy {
|
|
3327
3217
|
algorithm = "simple_majority";
|
|
@@ -3417,61 +3307,7 @@ var UnanimousStrategy = class extends BaseVotingStrategy {
|
|
|
3417
3307
|
};
|
|
3418
3308
|
}
|
|
3419
3309
|
};
|
|
3420
|
-
var
|
|
3421
|
-
algorithm = "proof_of_learning";
|
|
3422
|
-
calculateOutcome(votes, weights) {
|
|
3423
|
-
const counts = this.countVotes(votes);
|
|
3424
|
-
const effectiveWeights = weights ?? /* @__PURE__ */ new Map();
|
|
3425
|
-
const weightedCounts = this.countWeightedVotes(votes, effectiveWeights);
|
|
3426
|
-
const threshold = VOTING_THRESHOLDS.proof_of_learning;
|
|
3427
|
-
const votingWeight = weightedCounts.approve + weightedCounts.reject;
|
|
3428
|
-
if (votingWeight === 0) {
|
|
3429
|
-
return {
|
|
3430
|
-
approved: false,
|
|
3431
|
-
approvalPercentage: 0,
|
|
3432
|
-
voteCounts: counts,
|
|
3433
|
-
weightedCounts,
|
|
3434
|
-
reason: "No weighted votes cast (excluding abstentions)"
|
|
3435
|
-
};
|
|
3436
|
-
}
|
|
3437
|
-
const { approved, approvalPercentage } = evaluateThreshold(
|
|
3438
|
-
weightedCounts.approve,
|
|
3439
|
-
votingWeight,
|
|
3440
|
-
threshold,
|
|
3441
|
-
false
|
|
3442
|
-
);
|
|
3443
|
-
const weightBasis = deriveWeightBasis(votes, effectiveWeights);
|
|
3444
|
-
const verdict = approved ? "Approved" : "Rejected";
|
|
3445
|
-
return {
|
|
3446
|
-
approved,
|
|
3447
|
-
approvalPercentage,
|
|
3448
|
-
voteCounts: counts,
|
|
3449
|
-
weightedCounts,
|
|
3450
|
-
weightBasis,
|
|
3451
|
-
reason: `${verdict} with ${approvalPercentage.toFixed(1)}% ${describeBasis(weightBasis)}`
|
|
3452
|
-
};
|
|
3453
|
-
}
|
|
3454
|
-
};
|
|
3455
|
-
function describeBasis(basis) {
|
|
3456
|
-
switch (basis) {
|
|
3457
|
-
case "performance":
|
|
3458
|
-
return "weighted approval (weights from voter performance history)";
|
|
3459
|
-
case "partial":
|
|
3460
|
-
return "partly weighted approval (some voters have no performance history; those count as 1.0)";
|
|
3461
|
-
case "unweighted":
|
|
3462
|
-
return "approval (UNWEIGHTED \u2014 no voter performance history recorded)";
|
|
3463
|
-
default: {
|
|
3464
|
-
const unreachable = basis;
|
|
3465
|
-
throw new Error(`Unhandled weight basis: ${String(unreachable)}`);
|
|
3466
|
-
}
|
|
3467
|
-
}
|
|
3468
|
-
}
|
|
3469
|
-
function calculateVoteWeight(performance) {
|
|
3470
|
-
if (performance === void 0 || performance.totalVotes === 0) {
|
|
3471
|
-
return 1;
|
|
3472
|
-
}
|
|
3473
|
-
return 0.5 + performance.successRate * 0.5;
|
|
3474
|
-
}
|
|
3310
|
+
var RETIRED_ALGORITHM = "proof_of_learning";
|
|
3475
3311
|
var VotingStrategyFactory = class {
|
|
3476
3312
|
strategies;
|
|
3477
3313
|
constructor() {
|
|
@@ -3479,7 +3315,6 @@ var VotingStrategyFactory = class {
|
|
|
3479
3315
|
["simple_majority", new SimpleMajorityStrategy()],
|
|
3480
3316
|
["supermajority", new SupermajorityStrategy()],
|
|
3481
3317
|
["unanimous", new UnanimousStrategy()],
|
|
3482
|
-
["proof_of_learning", new ProofOfLearningStrategy()],
|
|
3483
3318
|
["opinion_wise", new HigherOrderVotingStrategy()],
|
|
3484
3319
|
["higher_order", new HigherOrderVotingStrategy()]
|
|
3485
3320
|
]);
|
|
@@ -3488,6 +3323,9 @@ var VotingStrategyFactory = class {
|
|
|
3488
3323
|
* Get a voting strategy by algorithm type.
|
|
3489
3324
|
*/
|
|
3490
3325
|
getStrategy(algorithm) {
|
|
3326
|
+
if (algorithm === RETIRED_ALGORITHM) {
|
|
3327
|
+
throw new Error(RETIRED_CONSENSUS_STRATEGY_MESSAGE);
|
|
3328
|
+
}
|
|
3491
3329
|
const strategy = this.strategies.get(algorithm);
|
|
3492
3330
|
if (strategy === void 0) {
|
|
3493
3331
|
throw new Error(`Unknown voting algorithm: ${algorithm}`);
|
|
@@ -3617,7 +3455,6 @@ var DEFAULT_PROPOSAL_CACHE_CONFIG = {
|
|
|
3617
3455
|
var ConsensusEngine = class {
|
|
3618
3456
|
proposals = /* @__PURE__ */ new Map();
|
|
3619
3457
|
closedProposals = /* @__PURE__ */ new Map();
|
|
3620
|
-
agentPerformance = /* @__PURE__ */ new Map();
|
|
3621
3458
|
proposalContentCache = /* @__PURE__ */ new Map();
|
|
3622
3459
|
strategyFactory;
|
|
3623
3460
|
config;
|
|
@@ -3732,32 +3569,6 @@ var ConsensusEngine = class {
|
|
|
3732
3569
|
algorithmUsage: { ...this.metrics.algorithmUsage }
|
|
3733
3570
|
};
|
|
3734
3571
|
}
|
|
3735
|
-
updateAgentPerformance(agentId, wasCorrect) {
|
|
3736
|
-
const existing = this.agentPerformance.get(agentId);
|
|
3737
|
-
const now = getTimeProvider().nowIso();
|
|
3738
|
-
if (existing === void 0) {
|
|
3739
|
-
this.agentPerformance.set(agentId, {
|
|
3740
|
-
agentId,
|
|
3741
|
-
totalVotes: 1,
|
|
3742
|
-
correctVotes: wasCorrect ? 1 : 0,
|
|
3743
|
-
successRate: wasCorrect ? 1 : 0,
|
|
3744
|
-
lastUpdated: now
|
|
3745
|
-
});
|
|
3746
|
-
} else {
|
|
3747
|
-
const totalVotes = existing.totalVotes + 1;
|
|
3748
|
-
const correctVotes = existing.correctVotes + (wasCorrect ? 1 : 0);
|
|
3749
|
-
this.agentPerformance.set(agentId, {
|
|
3750
|
-
agentId,
|
|
3751
|
-
totalVotes,
|
|
3752
|
-
correctVotes,
|
|
3753
|
-
successRate: correctVotes / totalVotes,
|
|
3754
|
-
lastUpdated: now
|
|
3755
|
-
});
|
|
3756
|
-
}
|
|
3757
|
-
}
|
|
3758
|
-
getAgentPerformance(agentId) {
|
|
3759
|
-
return this.agentPerformance.get(agentId);
|
|
3760
|
-
}
|
|
3761
3572
|
getActiveProposalCount() {
|
|
3762
3573
|
return this.proposals.size;
|
|
3763
3574
|
}
|
|
@@ -3767,7 +3578,6 @@ var ConsensusEngine = class {
|
|
|
3767
3578
|
proposal: { ...data, id: proposalId, createdAt: now.toISOString() },
|
|
3768
3579
|
status: "voting",
|
|
3769
3580
|
votes: /* @__PURE__ */ new Map(),
|
|
3770
|
-
voteWeights: /* @__PURE__ */ new Map(),
|
|
3771
3581
|
startedAt: now
|
|
3772
3582
|
};
|
|
3773
3583
|
}
|
|
@@ -3817,12 +3627,6 @@ var ConsensusEngine = class {
|
|
|
3817
3627
|
...vote,
|
|
3818
3628
|
timestamp: getTimeProvider().nowIso()
|
|
3819
3629
|
});
|
|
3820
|
-
if (state.proposal.algorithm === "proof_of_learning") {
|
|
3821
|
-
const performance = this.agentPerformance.get(agentId);
|
|
3822
|
-
if (performance !== void 0) {
|
|
3823
|
-
state.voteWeights.set(agentId, calculateVoteWeight(performance));
|
|
3824
|
-
}
|
|
3825
|
-
}
|
|
3826
3630
|
this.logger.debug("Vote recorded", {
|
|
3827
3631
|
proposalId: state.proposal.id,
|
|
3828
3632
|
agentId,
|
|
@@ -3887,7 +3691,7 @@ var ConsensusEngine = class {
|
|
|
3887
3691
|
}
|
|
3888
3692
|
calculateOutcome(state) {
|
|
3889
3693
|
const strategy = this.strategyFactory.getStrategy(state.proposal.algorithm);
|
|
3890
|
-
const outcome = strategy.calculateOutcome(state.votes
|
|
3694
|
+
const outcome = strategy.calculateOutcome(state.votes);
|
|
3891
3695
|
return outcome;
|
|
3892
3696
|
}
|
|
3893
3697
|
/**
|
|
@@ -3897,7 +3701,7 @@ var ConsensusEngine = class {
|
|
|
3897
3701
|
* `totalExpected = requiredVoters.length` and compared against
|
|
3898
3702
|
* `VOTING_THRESHOLDS[algorithm]` directly. Every voting strategy
|
|
3899
3703
|
* (`SimpleMajorityStrategy`, `SupermajorityStrategy`, `UnanimousStrategy`,
|
|
3900
|
-
* `
|
|
3704
|
+
* `HigherOrderVotingStrategy`) uses `approve + reject` as its denominator —
|
|
3901
3705
|
* abstains are explicitly excluded. The two diverged whenever abstains
|
|
3902
3706
|
* were present, producing wrong-winner cascades (e.g. 5-voter supermajority
|
|
3903
3707
|
* with [approve, abstain, abstain, abstain, pending] cascade-rejected even
|
|
@@ -3922,8 +3726,8 @@ var ConsensusEngine = class {
|
|
|
3922
3726
|
bestCase.set(voter, HYPOTHETICAL_APPROVE);
|
|
3923
3727
|
worstCase.set(voter, HYPOTHETICAL_REJECT);
|
|
3924
3728
|
}
|
|
3925
|
-
const bestOutcome = strategy.calculateOutcome(bestCase
|
|
3926
|
-
const worstOutcome = strategy.calculateOutcome(worstCase
|
|
3729
|
+
const bestOutcome = strategy.calculateOutcome(bestCase);
|
|
3730
|
+
const worstOutcome = strategy.calculateOutcome(worstCase);
|
|
3927
3731
|
if (bestOutcome.approved !== worstOutcome.approved) return false;
|
|
3928
3732
|
this.logger.info("Agreement cascade: outcome determined", {
|
|
3929
3733
|
proposalId: state.proposal.id,
|
|
@@ -4004,7 +3808,6 @@ var ConsensusEngine = class {
|
|
|
4004
3808
|
simple_majority: 0,
|
|
4005
3809
|
supermajority: 0,
|
|
4006
3810
|
unanimous: 0,
|
|
4007
|
-
proof_of_learning: 0,
|
|
4008
3811
|
opinion_wise: 0,
|
|
4009
3812
|
higher_order: 0
|
|
4010
3813
|
}
|
|
@@ -4080,6 +3883,7 @@ function createConsensusEngine(config, logger12) {
|
|
|
4080
3883
|
|
|
4081
3884
|
// src/consensus/quorum-validator.ts
|
|
4082
3885
|
var TIE_TOLERANCE = 1e-9;
|
|
3886
|
+
var RETIRED_ALGORITHM2 = "proof_of_learning";
|
|
4083
3887
|
var QuorumValidator = class {
|
|
4084
3888
|
logger;
|
|
4085
3889
|
constructor(logger12) {
|
|
@@ -4087,6 +3891,9 @@ var QuorumValidator = class {
|
|
|
4087
3891
|
}
|
|
4088
3892
|
validateQuorum(input) {
|
|
4089
3893
|
const { votes, config } = input;
|
|
3894
|
+
if (config.algorithm === RETIRED_ALGORITHM2) {
|
|
3895
|
+
return { status: "invalid", error: RETIRED_CONSENSUS_STRATEGY_MESSAGE };
|
|
3896
|
+
}
|
|
4090
3897
|
if (votes.size === 0) {
|
|
4091
3898
|
return { status: "invalid", error: "No votes provided" };
|
|
4092
3899
|
}
|
|
@@ -4101,6 +3908,9 @@ var QuorumValidator = class {
|
|
|
4101
3908
|
}
|
|
4102
3909
|
getQuorumBreakdown(input) {
|
|
4103
3910
|
const { votes, agentWeights, config, requiredParticipants } = input;
|
|
3911
|
+
if (config.algorithm === RETIRED_ALGORITHM2) {
|
|
3912
|
+
throw new Error(RETIRED_CONSENSUS_STRATEGY_MESSAGE);
|
|
3913
|
+
}
|
|
4104
3914
|
const voteCounts = this.countVotes(votes);
|
|
4105
3915
|
const { totalWeight, weightedCounts } = this.calculateWeights(votes, agentWeights, config);
|
|
4106
3916
|
const anyWeightSupplied = [...votes.keys()].some((id) => agentWeights?.has(id) === true);
|
|
@@ -5814,24 +5624,24 @@ function createCorrelationTracker(config) {
|
|
|
5814
5624
|
import * as fs from "node:fs";
|
|
5815
5625
|
|
|
5816
5626
|
// src/consensus/correlation-persistence-records.ts
|
|
5817
|
-
import { z as
|
|
5818
|
-
var PersistedVoteSchema =
|
|
5819
|
-
agentId:
|
|
5820
|
-
decision:
|
|
5821
|
-
confidence:
|
|
5822
|
-
modelKey:
|
|
5823
|
-
observedModel:
|
|
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()
|
|
5824
5634
|
});
|
|
5825
|
-
var PersistedProposalSchema =
|
|
5826
|
-
proposalId:
|
|
5827
|
-
votes:
|
|
5828
|
-
outcome:
|
|
5829
|
-
timestamp:
|
|
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()
|
|
5830
5640
|
});
|
|
5831
|
-
var PersistedCorrelationDataSchema =
|
|
5832
|
-
version:
|
|
5833
|
-
proposals:
|
|
5834
|
-
savedAt:
|
|
5641
|
+
var PersistedCorrelationDataSchema = z6.object({
|
|
5642
|
+
version: z6.number().int().positive(),
|
|
5643
|
+
proposals: z6.array(PersistedProposalSchema),
|
|
5644
|
+
savedAt: z6.iso.datetime()
|
|
5835
5645
|
});
|
|
5836
5646
|
function createPersistedProposal(proposalId, votes, outcome, context) {
|
|
5837
5647
|
const persistedVotes = [];
|
|
@@ -6075,6 +5885,36 @@ function createPersistentCorrelationTracker(config) {
|
|
|
6075
5885
|
// src/mcp/tools/consensus-vote-types.ts
|
|
6076
5886
|
import { z as z8 } from "zod";
|
|
6077
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
|
+
|
|
6078
5918
|
// src/cli/vote-diversity.ts
|
|
6079
5919
|
function answeringSeats(votes) {
|
|
6080
5920
|
return votes.filter((v) => v.source === "llm");
|
|
@@ -6178,14 +6018,12 @@ function checkUndeclaredOptions(proposal, declaredOptions, allEngagedApproved) {
|
|
|
6178
6018
|
|
|
6179
6019
|
// src/mcp/tools/consensus-vote-types.ts
|
|
6180
6020
|
var MAX_PROPOSAL_LENGTH = 4e3;
|
|
6181
|
-
var VotingStrategySchema = z8.enum(
|
|
6182
|
-
"simple_majority",
|
|
6183
|
-
|
|
6184
|
-
|
|
6185
|
-
|
|
6186
|
-
|
|
6187
|
-
"opinion_wise"
|
|
6188
|
-
]);
|
|
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
|
+
);
|
|
6189
6027
|
function isHigherOrderStrategy(strategy) {
|
|
6190
6028
|
return strategy === "higher_order" || strategy === "opinion_wise";
|
|
6191
6029
|
}
|
|
@@ -6215,7 +6053,7 @@ var ConsensusVoteInputSchema = z8.object({
|
|
|
6215
6053
|
"Voting threshold (legacy): majority, supermajority, unanimous. Use strategy instead."
|
|
6216
6054
|
),
|
|
6217
6055
|
strategy: VotingStrategySchema.optional().describe(
|
|
6218
|
-
"Voting strategy: simple_majority (default), supermajority, unanimous,
|
|
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."
|
|
6219
6057
|
),
|
|
6220
6058
|
errorPolicy: ErrorPolicySchema.optional().describe(
|
|
6221
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."
|
|
@@ -6253,13 +6091,10 @@ var ConsensusVoteInputSchema = z8.object({
|
|
|
6253
6091
|
* (`panelSize` 7). The quick-panel votes that triggered the escalation
|
|
6254
6092
|
* are not included.
|
|
6255
6093
|
*
|
|
6256
|
-
*
|
|
6257
|
-
*
|
|
6258
|
-
* rejected when the two disagree (the `superRefine` below). Both optional
|
|
6259
|
-
* (no `.default()`) so the inferred type doesn't force a value onto every
|
|
6260
|
-
* existing call site / test fixture.
|
|
6094
|
+
* Use `dispatch`; the former `mode` alias is rejected (#6225). Omitted
|
|
6095
|
+
* dispatch runs synchronously.
|
|
6261
6096
|
*/
|
|
6262
|
-
...
|
|
6097
|
+
...asyncDispatchInput(),
|
|
6263
6098
|
/**
|
|
6264
6099
|
* Idempotency key for async-mode replay-safety (#3042 Stage 1c / epic
|
|
6265
6100
|
* #2631). When set: identical (key, inputs) returns the existing job;
|
|
@@ -6294,8 +6129,7 @@ var ConsensusVoteInputSchema = z8.object({
|
|
|
6294
6129
|
ratifiesPr: VoteRecordPrBindingSchema.optional().describe(
|
|
6295
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."
|
|
6296
6131
|
)
|
|
6297
|
-
|
|
6298
|
-
}).superRefine(refineDispatchModeAgreement);
|
|
6132
|
+
});
|
|
6299
6133
|
var VoteDecisionStatusSchema = z8.enum([
|
|
6300
6134
|
"approved",
|
|
6301
6135
|
"rejected",
|
|
@@ -6566,7 +6400,7 @@ function logPartialProposal(bounded, log) {
|
|
|
6566
6400
|
}
|
|
6567
6401
|
async function runContrarianCheck(proposal, options, log, opts) {
|
|
6568
6402
|
try {
|
|
6569
|
-
const { executeExpert } = await import("./expert-bridge-
|
|
6403
|
+
const { executeExpert } = await import("./expert-bridge-4QAURLMN.js");
|
|
6570
6404
|
const bounded = boundArtifactForReview(proposal, CONTRARIAN_PROPOSAL_BUDGET, "proposal");
|
|
6571
6405
|
logPartialProposal(bounded, log);
|
|
6572
6406
|
const result = await executeExpert(
|
|
@@ -7721,6 +7555,7 @@ var VOTE_RECORD_STRATEGIES = /* @__PURE__ */ new Set([
|
|
|
7721
7555
|
"unanimous",
|
|
7722
7556
|
"higher_order",
|
|
7723
7557
|
"opinion_wise",
|
|
7558
|
+
// Persisted history may still carry the strategy retired for new votes in 9.0 (#5234).
|
|
7724
7559
|
"proof_of_learning"
|
|
7725
7560
|
]);
|
|
7726
7561
|
function toRecordStrategy(strategy) {
|
|
@@ -9371,7 +9206,7 @@ async function runSyncConsensusVote(deps, notifier, args) {
|
|
|
9371
9206
|
approvalPercentage: result.value.approvalPercentage,
|
|
9372
9207
|
voteCount: result.value.votes.length
|
|
9373
9208
|
});
|
|
9374
|
-
return
|
|
9209
|
+
return structuredToolSuccess(z15.object(CONSENSUS_VOTE_OUTPUT_SCHEMA), { ...result.value });
|
|
9375
9210
|
}
|
|
9376
9211
|
async function prepareVoteArtifact(input) {
|
|
9377
9212
|
if (input.artifactPath === void 0) return { ok: true, value: input };
|
|
@@ -9417,8 +9252,7 @@ function createConsensusVoteHandler(deps) {
|
|
|
9417
9252
|
if (!prepared.ok) return prepared.error;
|
|
9418
9253
|
const input = prepared.value;
|
|
9419
9254
|
const strategy = input.strategy ?? "simple_majority";
|
|
9420
|
-
const dispatch =
|
|
9421
|
-
const modeWarning = deprecatedModeWarning(input);
|
|
9255
|
+
const dispatch = input.dispatch;
|
|
9422
9256
|
ctx.logger.debug("Starting consensus vote", {
|
|
9423
9257
|
strategy,
|
|
9424
9258
|
quickMode: input.quickMode,
|
|
@@ -9436,9 +9270,9 @@ function createConsensusVoteHandler(deps) {
|
|
|
9436
9270
|
proposalLength: input.proposal.length,
|
|
9437
9271
|
strategy
|
|
9438
9272
|
});
|
|
9439
|
-
return
|
|
9273
|
+
return asyncResult;
|
|
9440
9274
|
}
|
|
9441
|
-
return
|
|
9275
|
+
return runSyncConsensusVote(deps, notifier, input);
|
|
9442
9276
|
};
|
|
9443
9277
|
}
|
|
9444
9278
|
var ASYNC_ENVELOPES = {
|
|
@@ -9600,7 +9434,7 @@ var CONSENSUS_VOTE_OUTPUT_SCHEMA = {
|
|
|
9600
9434
|
}).optional()
|
|
9601
9435
|
};
|
|
9602
9436
|
var CONSENSUS_VOTE_TOOL_SCHEMA = ConsensusVoteInputSchema.shape;
|
|
9603
|
-
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'
|
|
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).";
|
|
9604
9438
|
function registerConsensusVoteTool(server, deps) {
|
|
9605
9439
|
const logger12 = deps.logger ?? createLogger({ tool: "consensus_vote" });
|
|
9606
9440
|
const notifier = deps.notifier ?? createMcpNotifier(server);
|
|
@@ -9635,11 +9469,6 @@ export {
|
|
|
9635
9469
|
asyncDispatchInput,
|
|
9636
9470
|
asyncDispatchInputDefaultSync,
|
|
9637
9471
|
modeEnumErrorNamingDispatch,
|
|
9638
|
-
DEPRECATED_MODE_ALIAS_INPUT,
|
|
9639
|
-
refineDispatchModeAgreement,
|
|
9640
|
-
resolveDispatch,
|
|
9641
|
-
deprecatedModeWarning,
|
|
9642
|
-
withWarnings,
|
|
9643
9472
|
jobIdSchema,
|
|
9644
9473
|
resolveIdempotency,
|
|
9645
9474
|
registerIdempotentJob,
|
|
@@ -9707,8 +9536,6 @@ export {
|
|
|
9707
9536
|
SimpleMajorityStrategy,
|
|
9708
9537
|
SupermajorityStrategy,
|
|
9709
9538
|
UnanimousStrategy,
|
|
9710
|
-
ProofOfLearningStrategy,
|
|
9711
|
-
calculateVoteWeight,
|
|
9712
9539
|
VotingStrategyFactory,
|
|
9713
9540
|
createStrategyFactory,
|
|
9714
9541
|
buildPendingResult,
|
|
@@ -9750,4 +9577,4 @@ export {
|
|
|
9750
9577
|
CONSENSUS_VOTE_TOOL_SCHEMA,
|
|
9751
9578
|
registerConsensusVoteTool
|
|
9752
9579
|
};
|
|
9753
|
-
//# sourceMappingURL=chunk-
|
|
9580
|
+
//# sourceMappingURL=chunk-3KUZPBWS.js.map
|