nexus-agents 9.1.0 → 9.2.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/dist/{ast-rule-runner-IROJO2LR.js → ast-rule-runner-DFEUIC2E.js} +3 -3
- package/dist/{child-mcp-config-SOEVU3N4.js → child-mcp-config-ALJL5I7K.js} +5 -5
- package/dist/child-mcp-config-ALJL5I7K.js.map +1 -0
- package/dist/{chunk-PF2TM7CW.js → chunk-3JRQWWBD.js} +2 -2
- package/dist/{chunk-FVYQWWPB.js → chunk-42TS2JOS.js} +5 -5
- package/dist/{chunk-MPAAWIDI.js → chunk-4ROIBRK5.js} +2 -2
- package/dist/{chunk-RJDZOOPA.js → chunk-5IMXQQQX.js} +4 -4
- package/dist/{chunk-D26ZNDI3.js → chunk-625YPLMG.js} +2 -2
- package/dist/{chunk-AJ37AWCG.js → chunk-A5D7666X.js} +2 -2
- package/dist/{chunk-NRB6TOUO.js → chunk-AWF35M67.js} +4 -4
- package/dist/{chunk-T5IBXFFY.js → chunk-DJ7QTY5J.js} +5 -5
- package/dist/{chunk-GTYGMOMW.js → chunk-DYVYV7NZ.js} +5 -5
- package/dist/{chunk-LLDIASHH.js → chunk-ETW6QNVI.js} +3 -3
- package/dist/{chunk-LM7NMCEE.js → chunk-GAJRBRED.js} +2 -2
- package/dist/{chunk-BQPQIOEB.js → chunk-GNGIZJAC.js} +3 -3
- package/dist/{chunk-KSY5LNO5.js → chunk-GNGKWFC3.js} +2 -2
- package/dist/{chunk-IHSX3WQN.js → chunk-GTWTVDLP.js} +13 -13
- package/dist/{chunk-7ZZHQ6H3.js → chunk-JZSKEIQF.js} +2 -2
- package/dist/{chunk-XEDWWMZ3.js → chunk-KJ46Q24G.js} +2 -2
- package/dist/{chunk-MGVYGV7P.js → chunk-KLDUWDNU.js} +17 -13
- package/dist/chunk-KLDUWDNU.js.map +1 -0
- package/dist/{chunk-SB3NEYNN.js → chunk-KWQ5IR2A.js} +2 -2
- package/dist/{chunk-WNVJQ5SC.js → chunk-M43A5MDJ.js} +4 -4
- package/dist/{chunk-JHLMYOPG.js → chunk-MXYKMQ53.js} +41 -41
- package/dist/{chunk-7JYW5F77.js → chunk-PDT6QYKY.js} +5 -5
- package/dist/{chunk-C5P5D45H.js → chunk-PSZQ657B.js} +3 -3
- package/dist/{chunk-NHNXANOF.js → chunk-SU47CN4Q.js} +45 -14
- package/dist/{chunk-NHNXANOF.js.map → chunk-SU47CN4Q.js.map} +1 -1
- package/dist/{chunk-HX2L3RU2.js → chunk-TGOZLRO7.js} +2 -2
- package/dist/{chunk-V362YGAV.js → chunk-TJ4VWR32.js} +6 -5
- package/dist/{chunk-4E72H7XZ.js → chunk-UNIRQWHT.js} +2 -2
- package/dist/{chunk-VL5XUWRA.js → chunk-VOJCSOVL.js} +2 -2
- package/dist/{chunk-V5CYHQ7H.js → chunk-VS3C3L63.js} +501 -337
- package/dist/chunk-VS3C3L63.js.map +1 -0
- package/dist/{chunk-AI4DWDDD.js → chunk-WDSRUC3H.js} +3 -3
- package/dist/{chunk-HABRCWMK.js → chunk-WDYK7OAI.js} +3 -3
- package/dist/{chunk-PYDOAA3J.js → chunk-XBWG4BJU.js} +2 -2
- package/dist/{chunk-DQ4PJVOC.js → chunk-XPQ2RDMV.js} +5 -5
- package/dist/{chunk-WQCYMWMF.js → chunk-ZC6QDPMA.js} +4 -4
- package/dist/{chunk-DIM3YNH4.js → chunk-ZNXWR6V6.js} +7 -7
- package/dist/{chunk-FBJ6D2GF.js → chunk-ZVSJPKEZ.js} +2 -2
- package/dist/{cli-circuit-breaker-CL333R6G.js → cli-circuit-breaker-OTFWY5A5.js} +3 -3
- package/dist/{cli-readiness-G3YIRQE7.js → cli-readiness-WFUMPJCU.js} +7 -7
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +44 -44
- package/dist/{composite-router-WRLV4FGT.js → composite-router-LE4SNM2X.js} +2 -2
- package/dist/{consensus-vote-4NUYMBIC.js → consensus-vote-2BEOCYGU.js} +17 -17
- package/dist/{consensus-vote-types-B001FCSw.d.ts → consensus-vote-types-q8io4acj.d.ts} +8 -4
- package/dist/{context-retriever-SNYHJYBW.js → context-retriever-NKP73OSE.js} +8 -8
- package/dist/{doctor-deep-Y7V22EON.js → doctor-deep-FQPLASUY.js} +3 -3
- package/dist/{doctor-gateway-report-AGFLKDJD.js → doctor-gateway-report-3I7KQVU3.js} +7 -7
- package/dist/{doctor-live-GVW7URQE.js → doctor-live-ZAMCNQGM.js} +11 -11
- package/dist/{expert-bridge-JEZYYPHE.js → expert-bridge-3WL6X37T.js} +4 -4
- package/dist/{factory-XANTK76M.js → factory-IAH3XPHY.js} +5 -5
- package/dist/{factory-YPM27Q4H.js → factory-X7XECZ3D.js} +10 -10
- package/dist/{improvement-review-J2DWPLWX.js → improvement-review-4VHBKOME.js} +6 -6
- package/dist/index.d.ts +7 -6
- package/dist/index.js +32 -32
- package/dist/{init-opencode-H2EKCKD2.js → init-opencode-YLKVZJJA.js} +6 -6
- package/dist/{issue-triage-2ONLBRFO.js → issue-triage-UUD53JH3.js} +6 -6
- package/dist/{model-config-helpers-L5QFCKPC.js → model-config-helpers-KRTQLJF4.js} +2 -2
- package/dist/{openai-compat-adapter-B2D7SS3W.js → openai-compat-adapter-YTSKOE4F.js} +6 -6
- package/dist/{outcome-store-adapter-VZ3GSHAC.js → outcome-store-adapter-PSVE6YAJ.js} +2 -2
- package/dist/{pr-reviewer-helpers-TBYZRGYD.js → pr-reviewer-helpers-VP4P23TI.js} +4 -4
- package/dist/{registry-command-5PJYDUEV.js → registry-command-S4GXEMQR.js} +2 -2
- package/dist/{repo-security-plan-Q4DPMXMI.js → repo-security-plan-66VLAFUR.js} +3 -3
- package/dist/{research-helpers-synthesize-JCZ4J4FU.js → research-helpers-synthesize-RFOFNS5W.js} +4 -4
- package/dist/{routing-memory-JQEYHJNM.js → routing-memory-KKBKCISC.js} +2 -2
- package/dist/{session-memory-ZIU2KLYZ.js → session-memory-6FGTXRCN.js} +3 -3
- package/dist/{setup-config-SFPGFQTG.js → setup-config-4NLQBTZH.js} +3 -3
- package/dist/{setup-custom-api-QXF5XLKP.js → setup-custom-api-FLGYMLGG.js} +3 -3
- package/dist/setup-data-dir-VBMDTRCF.js +36 -0
- package/dist/{tool-memory-WTOTIEHV.js → tool-memory-5DOAHII2.js} +5 -5
- package/dist/{unified-registry-2FWLKUKQ.js → unified-registry-I2BUGW6I.js} +11 -11
- package/dist/{weather-report-HVBREECQ.js → weather-report-CTT5O7MR.js} +2 -2
- package/package.json +3 -2
- package/dist/child-mcp-config-SOEVU3N4.js.map +0 -1
- package/dist/chunk-MGVYGV7P.js.map +0 -1
- package/dist/chunk-V5CYHQ7H.js.map +0 -1
- package/dist/setup-data-dir-CSNTWHYS.js +0 -36
- /package/dist/{ast-rule-runner-IROJO2LR.js.map → ast-rule-runner-DFEUIC2E.js.map} +0 -0
- /package/dist/{chunk-PF2TM7CW.js.map → chunk-3JRQWWBD.js.map} +0 -0
- /package/dist/{chunk-FVYQWWPB.js.map → chunk-42TS2JOS.js.map} +0 -0
- /package/dist/{chunk-MPAAWIDI.js.map → chunk-4ROIBRK5.js.map} +0 -0
- /package/dist/{chunk-RJDZOOPA.js.map → chunk-5IMXQQQX.js.map} +0 -0
- /package/dist/{chunk-D26ZNDI3.js.map → chunk-625YPLMG.js.map} +0 -0
- /package/dist/{chunk-AJ37AWCG.js.map → chunk-A5D7666X.js.map} +0 -0
- /package/dist/{chunk-NRB6TOUO.js.map → chunk-AWF35M67.js.map} +0 -0
- /package/dist/{chunk-T5IBXFFY.js.map → chunk-DJ7QTY5J.js.map} +0 -0
- /package/dist/{chunk-GTYGMOMW.js.map → chunk-DYVYV7NZ.js.map} +0 -0
- /package/dist/{chunk-LLDIASHH.js.map → chunk-ETW6QNVI.js.map} +0 -0
- /package/dist/{chunk-LM7NMCEE.js.map → chunk-GAJRBRED.js.map} +0 -0
- /package/dist/{chunk-BQPQIOEB.js.map → chunk-GNGIZJAC.js.map} +0 -0
- /package/dist/{chunk-KSY5LNO5.js.map → chunk-GNGKWFC3.js.map} +0 -0
- /package/dist/{chunk-IHSX3WQN.js.map → chunk-GTWTVDLP.js.map} +0 -0
- /package/dist/{chunk-7ZZHQ6H3.js.map → chunk-JZSKEIQF.js.map} +0 -0
- /package/dist/{chunk-XEDWWMZ3.js.map → chunk-KJ46Q24G.js.map} +0 -0
- /package/dist/{chunk-SB3NEYNN.js.map → chunk-KWQ5IR2A.js.map} +0 -0
- /package/dist/{chunk-WNVJQ5SC.js.map → chunk-M43A5MDJ.js.map} +0 -0
- /package/dist/{chunk-JHLMYOPG.js.map → chunk-MXYKMQ53.js.map} +0 -0
- /package/dist/{chunk-7JYW5F77.js.map → chunk-PDT6QYKY.js.map} +0 -0
- /package/dist/{chunk-C5P5D45H.js.map → chunk-PSZQ657B.js.map} +0 -0
- /package/dist/{chunk-HX2L3RU2.js.map → chunk-TGOZLRO7.js.map} +0 -0
- /package/dist/{chunk-V362YGAV.js.map → chunk-TJ4VWR32.js.map} +0 -0
- /package/dist/{chunk-4E72H7XZ.js.map → chunk-UNIRQWHT.js.map} +0 -0
- /package/dist/{chunk-VL5XUWRA.js.map → chunk-VOJCSOVL.js.map} +0 -0
- /package/dist/{chunk-AI4DWDDD.js.map → chunk-WDSRUC3H.js.map} +0 -0
- /package/dist/{chunk-HABRCWMK.js.map → chunk-WDYK7OAI.js.map} +0 -0
- /package/dist/{chunk-PYDOAA3J.js.map → chunk-XBWG4BJU.js.map} +0 -0
- /package/dist/{chunk-DQ4PJVOC.js.map → chunk-XPQ2RDMV.js.map} +0 -0
- /package/dist/{chunk-WQCYMWMF.js.map → chunk-ZC6QDPMA.js.map} +0 -0
- /package/dist/{chunk-DIM3YNH4.js.map → chunk-ZNXWR6V6.js.map} +0 -0
- /package/dist/{chunk-FBJ6D2GF.js.map → chunk-ZVSJPKEZ.js.map} +0 -0
- /package/dist/{cli-circuit-breaker-CL333R6G.js.map → cli-circuit-breaker-OTFWY5A5.js.map} +0 -0
- /package/dist/{cli-readiness-G3YIRQE7.js.map → cli-readiness-WFUMPJCU.js.map} +0 -0
- /package/dist/{composite-router-WRLV4FGT.js.map → composite-router-LE4SNM2X.js.map} +0 -0
- /package/dist/{consensus-vote-4NUYMBIC.js.map → consensus-vote-2BEOCYGU.js.map} +0 -0
- /package/dist/{context-retriever-SNYHJYBW.js.map → context-retriever-NKP73OSE.js.map} +0 -0
- /package/dist/{doctor-deep-Y7V22EON.js.map → doctor-deep-FQPLASUY.js.map} +0 -0
- /package/dist/{doctor-gateway-report-AGFLKDJD.js.map → doctor-gateway-report-3I7KQVU3.js.map} +0 -0
- /package/dist/{doctor-live-GVW7URQE.js.map → doctor-live-ZAMCNQGM.js.map} +0 -0
- /package/dist/{expert-bridge-JEZYYPHE.js.map → expert-bridge-3WL6X37T.js.map} +0 -0
- /package/dist/{factory-XANTK76M.js.map → factory-IAH3XPHY.js.map} +0 -0
- /package/dist/{factory-YPM27Q4H.js.map → factory-X7XECZ3D.js.map} +0 -0
- /package/dist/{improvement-review-J2DWPLWX.js.map → improvement-review-4VHBKOME.js.map} +0 -0
- /package/dist/{init-opencode-H2EKCKD2.js.map → init-opencode-YLKVZJJA.js.map} +0 -0
- /package/dist/{issue-triage-2ONLBRFO.js.map → issue-triage-UUD53JH3.js.map} +0 -0
- /package/dist/{model-config-helpers-L5QFCKPC.js.map → model-config-helpers-KRTQLJF4.js.map} +0 -0
- /package/dist/{openai-compat-adapter-B2D7SS3W.js.map → openai-compat-adapter-YTSKOE4F.js.map} +0 -0
- /package/dist/{outcome-store-adapter-VZ3GSHAC.js.map → outcome-store-adapter-PSVE6YAJ.js.map} +0 -0
- /package/dist/{pr-reviewer-helpers-TBYZRGYD.js.map → pr-reviewer-helpers-VP4P23TI.js.map} +0 -0
- /package/dist/{registry-command-5PJYDUEV.js.map → registry-command-S4GXEMQR.js.map} +0 -0
- /package/dist/{repo-security-plan-Q4DPMXMI.js.map → repo-security-plan-66VLAFUR.js.map} +0 -0
- /package/dist/{research-helpers-synthesize-JCZ4J4FU.js.map → research-helpers-synthesize-RFOFNS5W.js.map} +0 -0
- /package/dist/{routing-memory-JQEYHJNM.js.map → routing-memory-KKBKCISC.js.map} +0 -0
- /package/dist/{session-memory-ZIU2KLYZ.js.map → session-memory-6FGTXRCN.js.map} +0 -0
- /package/dist/{setup-config-SFPGFQTG.js.map → setup-config-4NLQBTZH.js.map} +0 -0
- /package/dist/{setup-custom-api-QXF5XLKP.js.map → setup-custom-api-FLGYMLGG.js.map} +0 -0
- /package/dist/{setup-data-dir-CSNTWHYS.js.map → setup-data-dir-VBMDTRCF.js.map} +0 -0
- /package/dist/{tool-memory-WTOTIEHV.js.map → tool-memory-5DOAHII2.js.map} +0 -0
- /package/dist/{unified-registry-2FWLKUKQ.js.map → unified-registry-I2BUGW6I.js.map} +0 -0
- /package/dist/{weather-report-HVBREECQ.js.map → weather-report-CTT5O7MR.js.map} +0 -0
|
@@ -21,24 +21,24 @@ import {
|
|
|
21
21
|
toolSuccess,
|
|
22
22
|
withProgressHeartbeat,
|
|
23
23
|
wrapToolWithTimeout
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-5IMXQQQX.js";
|
|
25
25
|
import {
|
|
26
26
|
getToolMemory
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-M43A5MDJ.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-GNGIZJAC.js";
|
|
34
34
|
import {
|
|
35
35
|
isGatewayModelAdapter
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-DJ7QTY5J.js";
|
|
37
37
|
import {
|
|
38
38
|
ModelBoundAdapter,
|
|
39
39
|
createEvent,
|
|
40
40
|
getGlobalRegistry
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-PDT6QYKY.js";
|
|
42
42
|
import {
|
|
43
43
|
UNVERIFIABLE_STDERR_RE,
|
|
44
44
|
classifyUnverifiable,
|
|
@@ -46,24 +46,25 @@ import {
|
|
|
46
46
|
getAvailableClis,
|
|
47
47
|
isAbsentSeat,
|
|
48
48
|
markUnverifiable
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-KLDUWDNU.js";
|
|
50
50
|
import {
|
|
51
51
|
ensureGatewayDiscovered
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-ETW6QNVI.js";
|
|
53
53
|
import {
|
|
54
|
+
CLI_TO_MODELSDEV_VENDOR,
|
|
54
55
|
delay,
|
|
55
56
|
getAbortObservation,
|
|
56
57
|
sleep,
|
|
57
58
|
withTimeout
|
|
58
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-TJ4VWR32.js";
|
|
59
60
|
import {
|
|
60
61
|
getDefaultCliCircuitBreakerRegistry
|
|
61
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-4ROIBRK5.js";
|
|
62
63
|
import {
|
|
63
64
|
sanitizeErrorDetails,
|
|
64
65
|
sanitizeOutput,
|
|
65
66
|
sanitizeStringLeaves
|
|
66
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-A5D7666X.js";
|
|
67
68
|
import {
|
|
68
69
|
AgentError,
|
|
69
70
|
DecisionCostStore,
|
|
@@ -120,7 +121,7 @@ import {
|
|
|
120
121
|
servedCostDetail,
|
|
121
122
|
stepBus,
|
|
122
123
|
voteRecordWriteFailedMessage
|
|
123
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-SU47CN4Q.js";
|
|
124
125
|
import {
|
|
125
126
|
ensureLearningDir,
|
|
126
127
|
getOutcomesFile
|
|
@@ -144,7 +145,7 @@ import {
|
|
|
144
145
|
// src/mcp/tools/consensus-vote.ts
|
|
145
146
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
146
147
|
import { basename as basename2 } from "node:path";
|
|
147
|
-
import { z as
|
|
148
|
+
import { z as z16 } from "zod";
|
|
148
149
|
|
|
149
150
|
// src/cli/voter-roles.ts
|
|
150
151
|
var VOTER_ROLES = {
|
|
@@ -1792,6 +1793,123 @@ function warnIfSingleFamily(roleCount, assignedModels, logger12) {
|
|
|
1792
1793
|
}
|
|
1793
1794
|
}
|
|
1794
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
|
+
|
|
1795
1913
|
// src/cli/voter-agents-deadline.ts
|
|
1796
1914
|
function computeOverallConsensusDeadlineMs(timeoutMs, maxRetries, roleCount, interDelayMs) {
|
|
1797
1915
|
const perVoteBudget = timeoutMs * (maxRetries + 1);
|
|
@@ -1913,7 +2031,24 @@ function voteBeforeDeadline(input, role, adapter, remaining) {
|
|
|
1913
2031
|
}
|
|
1914
2032
|
}
|
|
1915
2033
|
);
|
|
1916
|
-
return result.then(
|
|
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
|
+
});
|
|
1917
2052
|
}
|
|
1918
2053
|
async function launchRoleVote(role, index, input, voteOnAdapter, deadlineAtMs) {
|
|
1919
2054
|
const staggerWaitMs = Math.min(input.interDelay, Math.max(0, deadlineAtMs - Date.now()));
|
|
@@ -1945,8 +2080,7 @@ async function launchRoleVote(role, index, input, voteOnAdapter, deadlineAtMs) {
|
|
|
1945
2080
|
const fallback = crossCliFallback(adapter, assignedKey, primary.error ?? "");
|
|
1946
2081
|
return stamp(preserveVoterAttemptTelemetry(recovered, { ...recovered, fallback }));
|
|
1947
2082
|
}
|
|
1948
|
-
function createTimedVoteLauncher(input, deadlineAtMs) {
|
|
1949
|
-
const serialize = createKeyedSerializer();
|
|
2083
|
+
function createTimedVoteLauncher(input, deadlineAtMs, serialize) {
|
|
1950
2084
|
const voteOnAdapter = (role, adapter, fallback) => {
|
|
1951
2085
|
const cli = adapterCliKey(adapter);
|
|
1952
2086
|
const enqueuedAt = Date.now();
|
|
@@ -1980,10 +2114,23 @@ function createTimedVoteLauncher(input, deadlineAtMs) {
|
|
|
1980
2114
|
};
|
|
1981
2115
|
return voteOnAdapter;
|
|
1982
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
|
+
}
|
|
1983
2129
|
async function launchVotesWithOverallDeadline(input) {
|
|
1984
2130
|
const { roles, logger: logger12, overallDeadlineMs } = input;
|
|
1985
2131
|
const deadlineAtMs = input.deadlineAtMs ?? Date.now() + overallDeadlineMs;
|
|
1986
|
-
const
|
|
2132
|
+
const serialize = createKeyedSerializer();
|
|
2133
|
+
const voteOnAdapter = createTimedVoteLauncher(input, deadlineAtMs, serialize);
|
|
1987
2134
|
const wrapped = roles.map(
|
|
1988
2135
|
(role, index) => launchRoleVote(role, index, input, voteOnAdapter, deadlineAtMs).then((result) => {
|
|
1989
2136
|
input.onVoteCollected?.(result);
|
|
@@ -2332,7 +2479,7 @@ async function assignPanelSeats(fallbackAdapter, options, logger12) {
|
|
|
2332
2479
|
async function collectPanelPasses(input, deadline, nonRetryableRoles, backoffMs) {
|
|
2333
2480
|
const { overallDeadlineMs, deadlineAtMs } = deadline;
|
|
2334
2481
|
const first = await launchStaggeredVotes(input, overallDeadlineMs, deadlineAtMs);
|
|
2335
|
-
|
|
2482
|
+
const final = await retryErroredRoles(
|
|
2336
2483
|
first,
|
|
2337
2484
|
(roles) => launchStaggeredVotes(
|
|
2338
2485
|
{ ...input, roles, voteOptions: { ...input.voteOptions, attemptKind: "role_retry" } },
|
|
@@ -2343,6 +2490,7 @@ async function collectPanelPasses(input, deadline, nonRetryableRoles, backoffMs)
|
|
|
2343
2490
|
backoffMs,
|
|
2344
2491
|
{ signal: input.signal, deadlineAtMs, nonRetryableRoles }
|
|
2345
2492
|
);
|
|
2493
|
+
return reaskUnresolvedOptions(final, input, deadlineAtMs);
|
|
2346
2494
|
}
|
|
2347
2495
|
async function collectRealVotes(options) {
|
|
2348
2496
|
const logger12 = options.logger ?? defaultLogger;
|
|
@@ -2441,9 +2589,9 @@ ${content}
|
|
|
2441
2589
|
// src/cli/voter-project.ts
|
|
2442
2590
|
import { readFileSync, statSync } from "node:fs";
|
|
2443
2591
|
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
2444
|
-
import { z as
|
|
2592
|
+
import { z as z3 } from "zod";
|
|
2445
2593
|
var VOTER_PROJECT_PATTERN = /^[A-Za-z0-9._/@-]{1,200}$/;
|
|
2446
|
-
var VoterProjectInputSchema =
|
|
2594
|
+
var VoterProjectInputSchema = z3.string().regex(VOTER_PROJECT_PATTERN).optional().describe(
|
|
2447
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."
|
|
2448
2596
|
);
|
|
2449
2597
|
var MAX_ANCESTOR_DEPTH = 64;
|
|
@@ -2608,40 +2756,40 @@ function describeVeto(verdict) {
|
|
|
2608
2756
|
}
|
|
2609
2757
|
|
|
2610
2758
|
// src/consensus/types-voting-protocol.ts
|
|
2611
|
-
import { z as
|
|
2759
|
+
import { z as z4 } from "zod";
|
|
2612
2760
|
var VOTING_ROUND_DEFAULT_TIMEOUT_MS = OPERATION_CLASSES["multi-llm-panel"].guardMs;
|
|
2613
|
-
var VotingRoundPhaseSchema =
|
|
2614
|
-
var VotingRoundStatusSchema =
|
|
2761
|
+
var VotingRoundPhaseSchema = z4.enum(["analysis", "deliberation", "consensus"]);
|
|
2762
|
+
var VotingRoundStatusSchema = z4.enum([
|
|
2615
2763
|
"pending",
|
|
2616
2764
|
"in_progress",
|
|
2617
2765
|
"awaiting_votes",
|
|
2618
2766
|
"completed",
|
|
2619
2767
|
"aborted"
|
|
2620
2768
|
]);
|
|
2621
|
-
var AgentFindingSchema =
|
|
2622
|
-
agentId:
|
|
2623
|
-
category:
|
|
2624
|
-
severity:
|
|
2625
|
-
description:
|
|
2626
|
-
location:
|
|
2627
|
-
suggestion:
|
|
2628
|
-
confidence:
|
|
2629
|
-
timestamp:
|
|
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()
|
|
2630
2778
|
});
|
|
2631
|
-
var FindingVoteSchema =
|
|
2632
|
-
agentId:
|
|
2633
|
-
findingId:
|
|
2634
|
-
agree:
|
|
2635
|
-
reasoning:
|
|
2636
|
-
amendedSeverity:
|
|
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()
|
|
2637
2785
|
});
|
|
2638
|
-
var VotingProtocolConfigSchema =
|
|
2639
|
-
committeeSize:
|
|
2640
|
-
maxRounds:
|
|
2641
|
-
roundTimeoutMs:
|
|
2642
|
-
agreementThreshold:
|
|
2643
|
-
enableAntiSycophancy:
|
|
2644
|
-
sycophancyThreshold:
|
|
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)
|
|
2645
2793
|
});
|
|
2646
2794
|
var DEFAULT_VOTING_PROTOCOL_CONFIG = {
|
|
2647
2795
|
committeeSize: 3,
|
|
@@ -2654,30 +2802,30 @@ var DEFAULT_VOTING_PROTOCOL_CONFIG = {
|
|
|
2654
2802
|
};
|
|
2655
2803
|
|
|
2656
2804
|
// src/consensus/types-weighted-voting.ts
|
|
2657
|
-
import { z as
|
|
2658
|
-
var TaskOutcomeStatusSchema =
|
|
2659
|
-
var WeightedAgentRecordSchema =
|
|
2660
|
-
agentId:
|
|
2661
|
-
totalTasks:
|
|
2662
|
-
successfulTasks:
|
|
2663
|
-
failedTasks:
|
|
2664
|
-
partialTasks:
|
|
2665
|
-
successRate:
|
|
2666
|
-
weight:
|
|
2667
|
-
trustScore:
|
|
2668
|
-
byzantineFlags:
|
|
2669
|
-
lastActive:
|
|
2670
|
-
createdAt:
|
|
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()
|
|
2671
2819
|
});
|
|
2672
|
-
var WeightedVotingConfigSchema =
|
|
2673
|
-
minWeight:
|
|
2674
|
-
maxByzantineFraction:
|
|
2675
|
-
weightDecayFactor:
|
|
2676
|
-
weightRecoveryFactor:
|
|
2677
|
-
minTrustScore:
|
|
2678
|
-
byzantineFlagThreshold:
|
|
2679
|
-
initialWeight:
|
|
2680
|
-
quorumThreshold:
|
|
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)
|
|
2681
2829
|
});
|
|
2682
2830
|
var DEFAULT_WEIGHTED_VOTING_CONFIG = {
|
|
2683
2831
|
minWeight: 0.1,
|
|
@@ -2692,7 +2840,7 @@ var DEFAULT_WEIGHTED_VOTING_CONFIG = {
|
|
|
2692
2840
|
};
|
|
2693
2841
|
|
|
2694
2842
|
// src/consensus/higher-order-types.ts
|
|
2695
|
-
import { z as
|
|
2843
|
+
import { z as z6 } from "zod";
|
|
2696
2844
|
function createAgentPairKey(agentA, agentB) {
|
|
2697
2845
|
return agentA < agentB ? `${agentA}:${agentB}` : `${agentB}:${agentA}`;
|
|
2698
2846
|
}
|
|
@@ -2703,43 +2851,43 @@ function parseAgentPairKey(key) {
|
|
|
2703
2851
|
}
|
|
2704
2852
|
return [parts[0], parts[1]];
|
|
2705
2853
|
}
|
|
2706
|
-
var CorrelationCoefficientSchema =
|
|
2707
|
-
var IndependentSubsetSchema =
|
|
2708
|
-
id:
|
|
2709
|
-
agentIds:
|
|
2710
|
-
independenceScore:
|
|
2711
|
-
pairCoverage:
|
|
2712
|
-
observed:
|
|
2713
|
-
total:
|
|
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()
|
|
2714
2862
|
}),
|
|
2715
|
-
observationCount:
|
|
2863
|
+
observationCount: z6.number().int().nonnegative()
|
|
2716
2864
|
});
|
|
2717
|
-
var VotingObservationSchema =
|
|
2718
|
-
proposalId:
|
|
2719
|
-
agentId:
|
|
2720
|
-
decision:
|
|
2721
|
-
confidence:
|
|
2722
|
-
alignedWithOutcome:
|
|
2723
|
-
timestamp:
|
|
2724
|
-
modelKey:
|
|
2725
|
-
observedModel:
|
|
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()
|
|
2726
2874
|
});
|
|
2727
|
-
var PairwiseVotingHistorySchema =
|
|
2728
|
-
pairKey:
|
|
2729
|
-
jointObservations:
|
|
2730
|
-
agreements:
|
|
2731
|
-
disagreements:
|
|
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(),
|
|
2732
2880
|
correlation: CorrelationCoefficientSchema,
|
|
2733
|
-
lastUpdated:
|
|
2881
|
+
lastUpdated: z6.date()
|
|
2734
2882
|
});
|
|
2735
|
-
var HigherOrderVotingConfigSchema =
|
|
2736
|
-
minObservationsForCorrelation:
|
|
2737
|
-
correlationThreshold:
|
|
2738
|
-
independenceThreshold:
|
|
2739
|
-
fallbackToSimpleVoting:
|
|
2740
|
-
maxObservationsPerAgent:
|
|
2741
|
-
maxProposals:
|
|
2742
|
-
maxTrackedPairs:
|
|
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)
|
|
2743
2891
|
});
|
|
2744
2892
|
var DEFAULT_HIGHER_ORDER_CONFIG = {
|
|
2745
2893
|
minObservationsForCorrelation: 10,
|
|
@@ -2750,25 +2898,25 @@ var DEFAULT_HIGHER_ORDER_CONFIG = {
|
|
|
2750
2898
|
maxProposals: 5e3,
|
|
2751
2899
|
maxTrackedPairs: 100
|
|
2752
2900
|
};
|
|
2753
|
-
var HigherOrderVotingResultSchema =
|
|
2754
|
-
decision:
|
|
2755
|
-
posteriorApproval:
|
|
2756
|
-
posteriorRejection:
|
|
2757
|
-
effectiveVoteCount:
|
|
2758
|
-
usedCorrelationData:
|
|
2759
|
-
method:
|
|
2760
|
-
improvementOverBaseline:
|
|
2761
|
-
independentSubsets:
|
|
2762
|
-
downweightedAgents:
|
|
2763
|
-
reasoning:
|
|
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()
|
|
2764
2912
|
});
|
|
2765
|
-
var CorrelationTrackerStatsSchema =
|
|
2766
|
-
totalAgents:
|
|
2767
|
-
trackedPairs:
|
|
2768
|
-
totalObservations:
|
|
2769
|
-
averageCorrelation:
|
|
2770
|
-
independentSubsetCount:
|
|
2771
|
-
pairsWithSufficientData:
|
|
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()
|
|
2772
2920
|
});
|
|
2773
2921
|
|
|
2774
2922
|
// src/consensus/higher-order-helpers.ts
|
|
@@ -5676,24 +5824,24 @@ function createCorrelationTracker(config) {
|
|
|
5676
5824
|
import * as fs from "node:fs";
|
|
5677
5825
|
|
|
5678
5826
|
// src/consensus/correlation-persistence-records.ts
|
|
5679
|
-
import { z as
|
|
5680
|
-
var PersistedVoteSchema =
|
|
5681
|
-
agentId:
|
|
5682
|
-
decision:
|
|
5683
|
-
confidence:
|
|
5684
|
-
modelKey:
|
|
5685
|
-
observedModel:
|
|
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()
|
|
5686
5834
|
});
|
|
5687
|
-
var PersistedProposalSchema =
|
|
5688
|
-
proposalId:
|
|
5689
|
-
votes:
|
|
5690
|
-
outcome:
|
|
5691
|
-
timestamp:
|
|
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()
|
|
5692
5840
|
});
|
|
5693
|
-
var PersistedCorrelationDataSchema =
|
|
5694
|
-
version:
|
|
5695
|
-
proposals:
|
|
5696
|
-
savedAt:
|
|
5841
|
+
var PersistedCorrelationDataSchema = z7.object({
|
|
5842
|
+
version: z7.number().int().positive(),
|
|
5843
|
+
proposals: z7.array(PersistedProposalSchema),
|
|
5844
|
+
savedAt: z7.iso.datetime()
|
|
5697
5845
|
});
|
|
5698
5846
|
function createPersistedProposal(proposalId, votes, outcome, context) {
|
|
5699
5847
|
const persistedVotes = [];
|
|
@@ -5935,10 +6083,10 @@ function createPersistentCorrelationTracker(config) {
|
|
|
5935
6083
|
}
|
|
5936
6084
|
|
|
5937
6085
|
// src/mcp/tools/consensus-vote-types.ts
|
|
5938
|
-
import { z as
|
|
6086
|
+
import { z as z9 } from "zod";
|
|
5939
6087
|
|
|
5940
6088
|
// src/mcp/tools/async-dispatch-input.ts
|
|
5941
|
-
import { z as
|
|
6089
|
+
import { z as z8 } from "zod";
|
|
5942
6090
|
var DISPATCH_MODES = ["sync", "async"];
|
|
5943
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 }).";
|
|
5944
6092
|
var WRONG_KEY_MODE_MESSAGE = '`mode` is not the async switch on this tool; send `dispatch: "async"` (or "sync") instead (#4968).';
|
|
@@ -5946,12 +6094,12 @@ function describeDispatch(note) {
|
|
|
5946
6094
|
return note === void 0 ? DISPATCH_DESCRIPTION : `${DISPATCH_DESCRIPTION} ${note}`;
|
|
5947
6095
|
}
|
|
5948
6096
|
function dispatchField(note) {
|
|
5949
|
-
return
|
|
6097
|
+
return z8.enum(DISPATCH_MODES).optional().describe(describeDispatch(note));
|
|
5950
6098
|
}
|
|
5951
6099
|
function dispatchFieldDefaultSync(note) {
|
|
5952
|
-
return
|
|
6100
|
+
return z8.enum(DISPATCH_MODES).default("sync").describe(describeDispatch(note));
|
|
5953
6101
|
}
|
|
5954
|
-
var REJECTED_MODE_KEY =
|
|
6102
|
+
var REJECTED_MODE_KEY = z8.never({ error: WRONG_KEY_MODE_MESSAGE }).optional().describe(
|
|
5955
6103
|
"Not an input of this tool. The async switch is `dispatch`; `mode: 'async'` is rejected (#4968)."
|
|
5956
6104
|
);
|
|
5957
6105
|
function asyncDispatchInput(note) {
|
|
@@ -6031,6 +6179,21 @@ function singleFamilyPanelWarning(votes) {
|
|
|
6031
6179
|
if (distinctFamilies !== 1 || unclassifiedSeats > 0 || distinctModels < 2) return void 0;
|
|
6032
6180
|
return `All ${String(answered.length)} answering seats ran ${vendorFamilyOf(model)} models (${String(distinctModels)} distinct); independence is weaker than assigned.`;
|
|
6033
6181
|
}
|
|
6182
|
+
function assignedFallbackFamily(v, fallback) {
|
|
6183
|
+
const model = resolvedModel({ ...v, model: fallback.fromModel ?? v.pinnedModel });
|
|
6184
|
+
return vendorFamilyOf(model ?? CLI_TO_MODELSDEV_VENDOR[fallback.fromCli] ?? "");
|
|
6185
|
+
}
|
|
6186
|
+
function crossFamilyFallbackWarning(votes) {
|
|
6187
|
+
const changes = [];
|
|
6188
|
+
for (const v of answeringSeats(votes)) {
|
|
6189
|
+
if (v.fallback === void 0) continue;
|
|
6190
|
+
const assigned = assignedFallbackFamily(v, v.fallback);
|
|
6191
|
+
const served = vendorFamilyOf(resolvedModel(v) ?? "");
|
|
6192
|
+
if (assigned === "unknown" || served === "unknown" || assigned === served) continue;
|
|
6193
|
+
changes.push(`${v.role}: assigned ${assigned}, served ${served}`);
|
|
6194
|
+
}
|
|
6195
|
+
return changes.length === 0 ? void 0 : `Cross-family fallback: ${changes.join("; ")}.`;
|
|
6196
|
+
}
|
|
6034
6197
|
|
|
6035
6198
|
// src/mcp/tools/consensus-vote-option-detection.ts
|
|
6036
6199
|
var UNDECLARED_OPTION_PATTERNS = Object.freeze([
|
|
@@ -6079,7 +6242,7 @@ function checkUndeclaredOptions(proposal, declaredOptions, allEngagedApproved) {
|
|
|
6079
6242
|
|
|
6080
6243
|
// src/mcp/tools/consensus-vote-types.ts
|
|
6081
6244
|
var MAX_PROPOSAL_LENGTH = 4e3;
|
|
6082
|
-
var VotingStrategySchema =
|
|
6245
|
+
var VotingStrategySchema = z9.enum(
|
|
6083
6246
|
["simple_majority", "supermajority", "unanimous", "higher_order", "opinion_wise"],
|
|
6084
6247
|
{
|
|
6085
6248
|
error: (issue) => issue.input === "proof_of_learning" ? RETIRED_CONSENSUS_STRATEGY_MESSAGE : void 0
|
|
@@ -6092,21 +6255,21 @@ var HIGHER_ORDER_ESCALATION_POSTERIOR_FLOOR = 0.65;
|
|
|
6092
6255
|
function shouldEscalateLowPosterior(strategy, outcome, quickMode, posteriorApproval) {
|
|
6093
6256
|
return quickMode && outcome === "approved" && isHigherOrderStrategy(strategy) && posteriorApproval !== void 0 && posteriorApproval < HIGHER_ORDER_ESCALATION_POSTERIOR_FLOOR;
|
|
6094
6257
|
}
|
|
6095
|
-
var ErrorPolicySchema =
|
|
6258
|
+
var ErrorPolicySchema = z9.enum([
|
|
6096
6259
|
"reduce_denominator",
|
|
6097
6260
|
"count_as_abstain",
|
|
6098
6261
|
"fail_closed",
|
|
6099
6262
|
"absolute_quorum"
|
|
6100
6263
|
]);
|
|
6101
|
-
var VoteThresholdSchema =
|
|
6102
|
-
var ConsensusVoteInputSchema =
|
|
6103
|
-
proposal:
|
|
6264
|
+
var VoteThresholdSchema = z9.enum(["majority", "supermajority", "unanimous"]);
|
|
6265
|
+
var ConsensusVoteInputSchema = z9.object({
|
|
6266
|
+
proposal: z9.string().min(1).max(MAX_PROPOSAL_LENGTH).describe(
|
|
6104
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.'
|
|
6105
6268
|
),
|
|
6106
|
-
artifactPath:
|
|
6269
|
+
artifactPath: z9.string().min(1).max(4096).optional().describe(
|
|
6107
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."
|
|
6108
6271
|
),
|
|
6109
|
-
options:
|
|
6272
|
+
options: z9.array(z9.string().min(1).max(200)).min(2).max(10).optional().describe(
|
|
6110
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."
|
|
6111
6274
|
),
|
|
6112
6275
|
project: VoterProjectInputSchema,
|
|
@@ -6119,8 +6282,8 @@ var ConsensusVoteInputSchema = z8.object({
|
|
|
6119
6282
|
errorPolicy: ErrorPolicySchema.optional().describe(
|
|
6120
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."
|
|
6121
6284
|
),
|
|
6122
|
-
quickMode:
|
|
6123
|
-
simulateVotes:
|
|
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(
|
|
6124
6287
|
"TESTS ONLY \u2014 when true, voters return random decisions. Output must not be used for real decisions. (#2319)"
|
|
6125
6288
|
),
|
|
6126
6289
|
/**
|
|
@@ -6162,7 +6325,7 @@ var ConsensusVoteInputSchema = z8.object({
|
|
|
6162
6325
|
* same key with different inputs fails closed with
|
|
6163
6326
|
* `idempotency_key_collision`. Sync mode ignores this.
|
|
6164
6327
|
*/
|
|
6165
|
-
idempotencyKey:
|
|
6328
|
+
idempotencyKey: z9.string().min(1).max(256).optional().describe(
|
|
6166
6329
|
"Replay-safe key for async-mode dispatch (#3042 Stage 1c). Same (key, inputs) returns existing jobId."
|
|
6167
6330
|
),
|
|
6168
6331
|
/**
|
|
@@ -6174,7 +6337,7 @@ var ConsensusVoteInputSchema = z8.object({
|
|
|
6174
6337
|
* record and require `ratifies === transition.subject` (with decision=approved,
|
|
6175
6338
|
* strategy=higher_order). Omit on an ordinary vote.
|
|
6176
6339
|
*/
|
|
6177
|
-
ratifies:
|
|
6340
|
+
ratifies: z9.string().min(1).max(256).optional().describe(
|
|
6178
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."
|
|
6179
6342
|
),
|
|
6180
6343
|
/**
|
|
@@ -6191,14 +6354,14 @@ var ConsensusVoteInputSchema = z8.object({
|
|
|
6191
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."
|
|
6192
6355
|
)
|
|
6193
6356
|
});
|
|
6194
|
-
var VoteDecisionStatusSchema =
|
|
6357
|
+
var VoteDecisionStatusSchema = z9.enum([
|
|
6195
6358
|
"approved",
|
|
6196
6359
|
"rejected",
|
|
6197
6360
|
"pending",
|
|
6198
6361
|
"timeout",
|
|
6199
6362
|
"no_quorum"
|
|
6200
6363
|
]);
|
|
6201
|
-
var ContrarianCheckStatusSchema =
|
|
6364
|
+
var ContrarianCheckStatusSchema = z9.enum(["ok", "errored", "skipped"]);
|
|
6202
6365
|
function toRecordDecision(status) {
|
|
6203
6366
|
switch (status) {
|
|
6204
6367
|
case "approved":
|
|
@@ -6367,6 +6530,7 @@ function applyOptionalResponseFields(response, input, result, errorCount, costSu
|
|
|
6367
6530
|
);
|
|
6368
6531
|
appendPanelWarning(response, singleModelPanelWarning(result.votes));
|
|
6369
6532
|
appendPanelWarning(response, singleFamilyPanelWarning(result.votes));
|
|
6533
|
+
appendPanelWarning(response, crossFamilyFallbackWarning(result.votes));
|
|
6370
6534
|
const engaged = result.votes.length - errorCount;
|
|
6371
6535
|
const undeclared = checkUndeclaredOptions(
|
|
6372
6536
|
input.proposal,
|
|
@@ -6477,7 +6641,7 @@ function logPartialProposal(bounded, log) {
|
|
|
6477
6641
|
}
|
|
6478
6642
|
async function runContrarianCheck(proposal, options, log, opts) {
|
|
6479
6643
|
try {
|
|
6480
|
-
const { executeExpert } = await import("./expert-bridge-
|
|
6644
|
+
const { executeExpert } = await import("./expert-bridge-3WL6X37T.js");
|
|
6481
6645
|
const bounded = boundArtifactForReview(proposal, CONTRARIAN_PROPOSAL_BUDGET, "proposal");
|
|
6482
6646
|
logPartialProposal(bounded, log);
|
|
6483
6647
|
const result = await executeExpert(
|
|
@@ -6661,20 +6825,20 @@ async function withFileLock(lockPath, body, options = {}) {
|
|
|
6661
6825
|
}
|
|
6662
6826
|
|
|
6663
6827
|
// src/mcp/jobs/job-cancelled-partial-schema.ts
|
|
6664
|
-
import { z as
|
|
6665
|
-
var CancelledPartialSchema =
|
|
6666
|
-
partialVotes:
|
|
6667
|
-
seatsCast:
|
|
6668
|
-
panelSize:
|
|
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()
|
|
6669
6833
|
});
|
|
6670
6834
|
|
|
6671
6835
|
// src/mcp/jobs/job-result-store.ts
|
|
6672
6836
|
import { existsSync as existsSync4, readdirSync, unlinkSync as unlinkSync2, writeFileSync as writeFileSync2, chmodSync, mkdirSync as mkdirSync2 } from "node:fs";
|
|
6673
6837
|
import { dirname as dirname2 } from "node:path";
|
|
6674
|
-
import { z as
|
|
6838
|
+
import { z as z14 } from "zod";
|
|
6675
6839
|
|
|
6676
6840
|
// src/mcp/jobs/job-id.ts
|
|
6677
|
-
import { z as
|
|
6841
|
+
import { z as z11 } from "zod";
|
|
6678
6842
|
var JOB_ID_MAX_LENGTH = 128;
|
|
6679
6843
|
var JOB_ID_PATTERN = /^[A-Za-z0-9_-]{1,128}$/;
|
|
6680
6844
|
function isValidJobId(jobId) {
|
|
@@ -6686,26 +6850,26 @@ function assertValidJobId(jobId) {
|
|
|
6686
6850
|
}
|
|
6687
6851
|
}
|
|
6688
6852
|
function jobIdSchema(description) {
|
|
6689
|
-
return
|
|
6853
|
+
return z11.string().min(1).max(JOB_ID_MAX_LENGTH).regex(JOB_ID_PATTERN, 'jobId must contain only letters, digits, "_" and "-"').describe(description);
|
|
6690
6854
|
}
|
|
6691
6855
|
|
|
6692
6856
|
// src/mcp/jobs/job-idempotency.ts
|
|
6693
6857
|
import { createHash as createHash2, randomUUID as randomUUID2 } from "node:crypto";
|
|
6694
6858
|
import { existsSync as existsSync2, readFileSync as readFileSync4, writeFileSync } from "node:fs";
|
|
6695
|
-
import { z as
|
|
6859
|
+
import { z as z12 } from "zod";
|
|
6696
6860
|
var logger6 = createLogger({ component: "job-idempotency" });
|
|
6697
|
-
var IdempotencyIndexEntrySchema =
|
|
6698
|
-
v:
|
|
6861
|
+
var IdempotencyIndexEntrySchema = z12.object({
|
|
6862
|
+
v: z12.literal(1),
|
|
6699
6863
|
/** MCP tool name (e.g. `orchestrate`, `run_workflow`, `consensus_vote`). */
|
|
6700
|
-
tool:
|
|
6864
|
+
tool: z12.string().min(1),
|
|
6701
6865
|
/** Caller-supplied idempotency key. */
|
|
6702
|
-
key:
|
|
6866
|
+
key: z12.string().min(1),
|
|
6703
6867
|
/** sha256 of the canonical input JSON. */
|
|
6704
|
-
inputsHash:
|
|
6868
|
+
inputsHash: z12.string().length(64),
|
|
6705
6869
|
/** Existing jobId for this (tool, key, inputs) tuple. */
|
|
6706
|
-
jobId:
|
|
6870
|
+
jobId: z12.string().min(1),
|
|
6707
6871
|
/** ISO timestamp of first dispatch. */
|
|
6708
|
-
createdAt:
|
|
6872
|
+
createdAt: z12.iso.datetime()
|
|
6709
6873
|
});
|
|
6710
6874
|
function sha256Hex(input) {
|
|
6711
6875
|
return createHash2("sha256").update(input).digest("hex");
|
|
@@ -6932,14 +7096,14 @@ function syncAlternateCandidates(jobId, primaryPath, record, logger12, persistFn
|
|
|
6932
7096
|
}
|
|
6933
7097
|
|
|
6934
7098
|
// src/mcp/jobs/job-failure-detail.ts
|
|
6935
|
-
import { z as
|
|
6936
|
-
var JobFailureDetailSchema =
|
|
7099
|
+
import { z as z13 } from "zod";
|
|
7100
|
+
var JobFailureDetailSchema = z13.object({
|
|
6937
7101
|
/** Identifier of the failing adapter (e.g. 'claude', 'codex', 'api:anthropic'). */
|
|
6938
|
-
adapter:
|
|
7102
|
+
adapter: z13.string().min(1),
|
|
6939
7103
|
/** Transport mechanism where the failure occurred (e.g. 'subprocess', 'mcp', 'stdio'). */
|
|
6940
|
-
transport:
|
|
7104
|
+
transport: z13.string().min(1),
|
|
6941
7105
|
/** Normalized failure category (e.g. 'rate_limited', 'timeout', 'capacity_exhausted'). */
|
|
6942
|
-
category:
|
|
7106
|
+
category: z13.string().min(1)
|
|
6943
7107
|
});
|
|
6944
7108
|
function isRecord(value) {
|
|
6945
7109
|
return typeof value === "object" && value !== null;
|
|
@@ -7011,28 +7175,28 @@ function validateAndSanitizeFailureDetail(detail) {
|
|
|
7011
7175
|
|
|
7012
7176
|
// src/mcp/jobs/job-result-store.ts
|
|
7013
7177
|
var logger7 = createLogger({ component: "job-result-store" });
|
|
7014
|
-
var JobStatusSchema =
|
|
7015
|
-
var JobResultSchema =
|
|
7178
|
+
var JobStatusSchema = z14.enum(["pending", "complete", "failed", "cancelled"]);
|
|
7179
|
+
var JobResultSchema = z14.object({
|
|
7016
7180
|
/** Format version. Currently `1` — bump if the shape changes. */
|
|
7017
|
-
v:
|
|
7018
|
-
jobId:
|
|
7181
|
+
v: z14.literal(1),
|
|
7182
|
+
jobId: z14.string().min(1),
|
|
7019
7183
|
/** Tool that was invoked (e.g. `orchestrate`). */
|
|
7020
|
-
toolName:
|
|
7184
|
+
toolName: z14.string().min(1),
|
|
7021
7185
|
status: JobStatusSchema,
|
|
7022
|
-
createdAt:
|
|
7186
|
+
createdAt: z14.iso.datetime(),
|
|
7023
7187
|
/** Set when the job leaves `pending` — either via `complete` or `failed` or `cancelled`. */
|
|
7024
|
-
completedAt:
|
|
7188
|
+
completedAt: z14.iso.datetime().optional(),
|
|
7025
7189
|
/**
|
|
7026
7190
|
* Structured payload the synchronous mode would have returned. Present
|
|
7027
7191
|
* only when `status === 'complete'`. Shape is tool-specific — readers
|
|
7028
7192
|
* cast to the tool's known output type after status check.
|
|
7029
7193
|
*/
|
|
7030
|
-
result:
|
|
7194
|
+
result: z14.unknown().optional(),
|
|
7031
7195
|
/**
|
|
7032
7196
|
* Failure message when `status === 'failed'`. Cannot be paired with
|
|
7033
7197
|
* `result` — the discriminator is `status`.
|
|
7034
7198
|
*/
|
|
7035
|
-
error:
|
|
7199
|
+
error: z14.string().optional(),
|
|
7036
7200
|
/**
|
|
7037
7201
|
* Structured failure detail when `status === 'failed'` (#4375).
|
|
7038
7202
|
* Holds normalized adapter, transport, and category information without
|
|
@@ -7047,7 +7211,7 @@ var JobResultSchema = z13.object({
|
|
|
7047
7211
|
* the sweep rewrote it rather than deleting it. Absent on every record the
|
|
7048
7212
|
* job's own process wrote — `error` alone carries those failures.
|
|
7049
7213
|
*/
|
|
7050
|
-
errorKind:
|
|
7214
|
+
errorKind: z14.literal("abandoned").optional(),
|
|
7051
7215
|
/**
|
|
7052
7216
|
* Whether the tool's `run` callback accepts `runAsJob`'s `AbortSignal`
|
|
7053
7217
|
* (#4972).
|
|
@@ -7063,7 +7227,7 @@ var JobResultSchema = z13.object({
|
|
|
7063
7227
|
* "cancellation can reach this tool", not "the work stopped". Absent means
|
|
7064
7228
|
* the writer did not report it, which is not the same as `false`.
|
|
7065
7229
|
*/
|
|
7066
|
-
signalAccepted:
|
|
7230
|
+
signalAccepted: z14.boolean().optional(),
|
|
7067
7231
|
/**
|
|
7068
7232
|
* `VERSION` of the nexus-agents process that WROTE this record (#5008) —
|
|
7069
7233
|
* i.e. the build that ran the job, not the build that reads it back.
|
|
@@ -7084,7 +7248,7 @@ var JobResultSchema = z13.object({
|
|
|
7084
7248
|
* `'dev'` — readers MUST run it through {@link isMeasuredBuildVersion}
|
|
7085
7249
|
* before treating two stamps as comparable.
|
|
7086
7250
|
*/
|
|
7087
|
-
producerVersion:
|
|
7251
|
+
producerVersion: z14.string().optional(),
|
|
7088
7252
|
/**
|
|
7089
7253
|
* When the job body last heartbeat — `runAsJob`'s `progress()` callback,
|
|
7090
7254
|
* `heartbeatJob`, or a pipeline-bus event the body emitted (#6162). Present
|
|
@@ -7096,7 +7260,7 @@ var JobResultSchema = z13.object({
|
|
|
7096
7260
|
* `run-as-job.ts` fails a body that stops heartbeating as wedged, measuring
|
|
7097
7261
|
* silence from this stamp (or from job start when there is none).
|
|
7098
7262
|
*/
|
|
7099
|
-
lastProgressAt:
|
|
7263
|
+
lastProgressAt: z14.iso.datetime().optional(),
|
|
7100
7264
|
/**
|
|
7101
7265
|
* What a cancelled vote had collected when `cancel_job` fired (#6735).
|
|
7102
7266
|
* Present only on a `cancelled` record, and only when the body settled after
|
|
@@ -8055,8 +8219,8 @@ import * as path from "node:path";
|
|
|
8055
8219
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
8056
8220
|
|
|
8057
8221
|
// src/context/structured-task-state-types.ts
|
|
8058
|
-
import { z as
|
|
8059
|
-
var TaskStageSchema =
|
|
8222
|
+
import { z as z15 } from "zod";
|
|
8223
|
+
var TaskStageSchema = z15.enum([
|
|
8060
8224
|
"planning",
|
|
8061
8225
|
"executing",
|
|
8062
8226
|
"verifying",
|
|
@@ -8068,59 +8232,59 @@ var TaskStageSchema = z14.enum([
|
|
|
8068
8232
|
// failed run in StructuredTaskState instead of the Stage-1 sidecar.
|
|
8069
8233
|
"failed"
|
|
8070
8234
|
]);
|
|
8071
|
-
var TaskDecisionSchema =
|
|
8072
|
-
ts:
|
|
8073
|
-
decision:
|
|
8074
|
-
rationale:
|
|
8235
|
+
var TaskDecisionSchema = z15.object({
|
|
8236
|
+
ts: z15.iso.datetime(),
|
|
8237
|
+
decision: z15.string().min(1),
|
|
8238
|
+
rationale: z15.string().min(1)
|
|
8075
8239
|
});
|
|
8076
|
-
var TaskBlockerSchema =
|
|
8077
|
-
ts:
|
|
8078
|
-
blocker:
|
|
8079
|
-
resolved:
|
|
8240
|
+
var TaskBlockerSchema = z15.object({
|
|
8241
|
+
ts: z15.iso.datetime(),
|
|
8242
|
+
blocker: z15.string().min(1),
|
|
8243
|
+
resolved: z15.iso.datetime().optional()
|
|
8080
8244
|
});
|
|
8081
|
-
var TaskPositionSchema =
|
|
8082
|
-
currentStep:
|
|
8083
|
-
nextStep:
|
|
8245
|
+
var TaskPositionSchema = z15.object({
|
|
8246
|
+
currentStep: z15.string().min(1),
|
|
8247
|
+
nextStep: z15.string().optional()
|
|
8084
8248
|
});
|
|
8085
|
-
var TaskLedgerSchema =
|
|
8249
|
+
var TaskLedgerSchema = z15.object({
|
|
8086
8250
|
/** Verifiable observations: what we have observed/measured/confirmed. */
|
|
8087
|
-
facts:
|
|
8251
|
+
facts: z15.array(z15.string()),
|
|
8088
8252
|
/** Working assumptions: useful guesses we proceed under, marked separately. */
|
|
8089
|
-
guesses:
|
|
8253
|
+
guesses: z15.array(z15.string()),
|
|
8090
8254
|
/** Things we still need to figure out before the plan is sound. */
|
|
8091
|
-
openQuestions:
|
|
8092
|
-
updatedAt:
|
|
8255
|
+
openQuestions: z15.array(z15.string()),
|
|
8256
|
+
updatedAt: z15.iso.datetime()
|
|
8093
8257
|
});
|
|
8094
|
-
var ReflectActionSchema =
|
|
8095
|
-
var ProgressLedgerEntrySchema =
|
|
8096
|
-
ts:
|
|
8258
|
+
var ReflectActionSchema = z15.enum(["continue", "revise_plan", "escalate_to_human", "abort"]);
|
|
8259
|
+
var ProgressLedgerEntrySchema = z15.object({
|
|
8260
|
+
ts: z15.iso.datetime(),
|
|
8097
8261
|
/** What just happened (the step we are reflecting on). */
|
|
8098
|
-
step:
|
|
8262
|
+
step: z15.string().min(1),
|
|
8099
8263
|
/** Is the outer Task Ledger plan still right after this step? */
|
|
8100
|
-
planStillValid:
|
|
8264
|
+
planStillValid: z15.boolean(),
|
|
8101
8265
|
/** Are we making progress, or have we stalled? */
|
|
8102
|
-
stuck:
|
|
8266
|
+
stuck: z15.boolean(),
|
|
8103
8267
|
/** What the orchestrator should do next based on this reflection. */
|
|
8104
8268
|
suggestedAction: ReflectActionSchema,
|
|
8105
8269
|
/** Why this action was chosen — required so future readers can audit the call. */
|
|
8106
|
-
rationale:
|
|
8270
|
+
rationale: z15.string().min(1)
|
|
8107
8271
|
});
|
|
8108
|
-
var TaskCancellationSchema =
|
|
8109
|
-
requestedAt:
|
|
8272
|
+
var TaskCancellationSchema = z15.object({
|
|
8273
|
+
requestedAt: z15.iso.datetime(),
|
|
8110
8274
|
/** Optional human-readable note carried back to the caller. */
|
|
8111
|
-
reason:
|
|
8275
|
+
reason: z15.string().max(1e3).optional()
|
|
8112
8276
|
});
|
|
8113
8277
|
var TASK_RESULT_MAX_BYTES = 1048576;
|
|
8114
|
-
var StructuredTaskStateSchema =
|
|
8115
|
-
taskId:
|
|
8278
|
+
var StructuredTaskStateSchema = z15.object({
|
|
8279
|
+
taskId: z15.string().min(1),
|
|
8116
8280
|
/**
|
|
8117
8281
|
* Marks state created by the shared async-job dispatcher (#5622).
|
|
8118
8282
|
* Optional for backward compatibility; absence does not prove async dispatch.
|
|
8119
8283
|
*/
|
|
8120
|
-
dispatch:
|
|
8284
|
+
dispatch: z15.literal("async").optional(),
|
|
8121
8285
|
stage: TaskStageSchema,
|
|
8122
|
-
decisions:
|
|
8123
|
-
blockers:
|
|
8286
|
+
decisions: z15.array(TaskDecisionSchema),
|
|
8287
|
+
blockers: z15.array(TaskBlockerSchema),
|
|
8124
8288
|
position: TaskPositionSchema,
|
|
8125
8289
|
/**
|
|
8126
8290
|
* Magentic-One Task Ledger (#2278). Mutable single-object outer-loop state:
|
|
@@ -8133,7 +8297,7 @@ var StructuredTaskStateSchema = z14.object({
|
|
|
8133
8297
|
* Most recent entry's `suggestedAction` is what `reflect()` returns. Optional
|
|
8134
8298
|
* for the same backward-compat reason as `taskLedger`.
|
|
8135
8299
|
*/
|
|
8136
|
-
progressLedger:
|
|
8300
|
+
progressLedger: z15.array(ProgressLedgerEntrySchema).optional(),
|
|
8137
8301
|
/**
|
|
8138
8302
|
* Monotonic version counter (#3043 / epic #2631 Stage 2). Increments by
|
|
8139
8303
|
* 1 on every write; polling clients use this to detect "I missed a
|
|
@@ -8143,7 +8307,7 @@ var StructuredTaskStateSchema = z14.object({
|
|
|
8143
8307
|
* state logs (pre-Stage-2) don't carry it; the reducer treats their
|
|
8144
8308
|
* baseline as v0 and starts counting from there.
|
|
8145
8309
|
*/
|
|
8146
|
-
version:
|
|
8310
|
+
version: z15.number().int().nonnegative().optional(),
|
|
8147
8311
|
/**
|
|
8148
8312
|
* Tool result payload (#3043 / epic #2631 Stage 2). Set atomically
|
|
8149
8313
|
* via the `result` log event when `stage === 'complete'`. Carries the
|
|
@@ -8159,7 +8323,7 @@ var StructuredTaskStateSchema = z14.object({
|
|
|
8159
8323
|
* field, then the sidecar files become legacy that the next cleanup
|
|
8160
8324
|
* sweep can remove.
|
|
8161
8325
|
*/
|
|
8162
|
-
result:
|
|
8326
|
+
result: z15.unknown().optional(),
|
|
8163
8327
|
/**
|
|
8164
8328
|
* Cancellation marker (#3043 / epic #2631 Stage 2). Set by `cancel_job`
|
|
8165
8329
|
* — the running tool checks for this at safe-point boundaries (between
|
|
@@ -8176,70 +8340,70 @@ var StructuredTaskStateSchema = z14.object({
|
|
|
8176
8340
|
* transition has been recorded. Optional for backward-compat with
|
|
8177
8341
|
* pre-#3090 logs (the reducer backfills it from the init entry).
|
|
8178
8342
|
*/
|
|
8179
|
-
createdAt:
|
|
8180
|
-
updatedAt:
|
|
8343
|
+
createdAt: z15.iso.datetime().optional(),
|
|
8344
|
+
updatedAt: z15.iso.datetime()
|
|
8181
8345
|
});
|
|
8182
|
-
var StructuredTaskLogEntrySchema =
|
|
8183
|
-
|
|
8184
|
-
event:
|
|
8185
|
-
ts:
|
|
8346
|
+
var StructuredTaskLogEntrySchema = z15.discriminatedUnion("event", [
|
|
8347
|
+
z15.object({
|
|
8348
|
+
event: z15.literal("init"),
|
|
8349
|
+
ts: z15.iso.datetime(),
|
|
8186
8350
|
state: StructuredTaskStateSchema
|
|
8187
8351
|
}),
|
|
8188
|
-
|
|
8189
|
-
event:
|
|
8190
|
-
ts:
|
|
8352
|
+
z15.object({
|
|
8353
|
+
event: z15.literal("decision"),
|
|
8354
|
+
ts: z15.iso.datetime(),
|
|
8191
8355
|
decision: TaskDecisionSchema
|
|
8192
8356
|
}),
|
|
8193
|
-
|
|
8194
|
-
event:
|
|
8195
|
-
ts:
|
|
8357
|
+
z15.object({
|
|
8358
|
+
event: z15.literal("blocker"),
|
|
8359
|
+
ts: z15.iso.datetime(),
|
|
8196
8360
|
blocker: TaskBlockerSchema
|
|
8197
8361
|
}),
|
|
8198
|
-
|
|
8199
|
-
event:
|
|
8200
|
-
ts:
|
|
8362
|
+
z15.object({
|
|
8363
|
+
event: z15.literal("blocker_resolved"),
|
|
8364
|
+
ts: z15.iso.datetime(),
|
|
8201
8365
|
/** Index of the blocker in the state's blockers[] array. */
|
|
8202
|
-
blockerIndex:
|
|
8203
|
-
resolvedAt:
|
|
8366
|
+
blockerIndex: z15.number().int().nonnegative(),
|
|
8367
|
+
resolvedAt: z15.iso.datetime()
|
|
8204
8368
|
}),
|
|
8205
|
-
|
|
8206
|
-
event:
|
|
8207
|
-
ts:
|
|
8369
|
+
z15.object({
|
|
8370
|
+
event: z15.literal("stage"),
|
|
8371
|
+
ts: z15.iso.datetime(),
|
|
8208
8372
|
stage: TaskStageSchema
|
|
8209
8373
|
}),
|
|
8210
|
-
|
|
8211
|
-
event:
|
|
8212
|
-
ts:
|
|
8374
|
+
z15.object({
|
|
8375
|
+
event: z15.literal("position"),
|
|
8376
|
+
ts: z15.iso.datetime(),
|
|
8213
8377
|
position: TaskPositionSchema
|
|
8214
8378
|
}),
|
|
8215
8379
|
// Magentic-One Task Ledger replacement event — the outer loop revises the
|
|
8216
8380
|
// entire ledger atomically when replanning. Always replaces, never partial.
|
|
8217
|
-
|
|
8218
|
-
event:
|
|
8219
|
-
ts:
|
|
8381
|
+
z15.object({
|
|
8382
|
+
event: z15.literal("task_ledger"),
|
|
8383
|
+
ts: z15.iso.datetime(),
|
|
8220
8384
|
ledger: TaskLedgerSchema
|
|
8221
8385
|
}),
|
|
8222
8386
|
// Magentic-One Progress Ledger append event — one self-reflection per step.
|
|
8223
|
-
|
|
8224
|
-
event:
|
|
8225
|
-
ts:
|
|
8387
|
+
z15.object({
|
|
8388
|
+
event: z15.literal("progress_ledger"),
|
|
8389
|
+
ts: z15.iso.datetime(),
|
|
8226
8390
|
entry: ProgressLedgerEntrySchema
|
|
8227
8391
|
}),
|
|
8228
8392
|
// #3043 / epic #2631 Stage 2 — tool result payload set when stage flips
|
|
8229
8393
|
// to 'complete'. Written by appendResult; replayed into state.result.
|
|
8230
8394
|
// The payload itself is `unknown` because each tool's result shape is
|
|
8231
8395
|
// its own; readers cast after a status check.
|
|
8232
|
-
|
|
8233
|
-
event:
|
|
8234
|
-
ts:
|
|
8235
|
-
result:
|
|
8396
|
+
z15.object({
|
|
8397
|
+
event: z15.literal("result"),
|
|
8398
|
+
ts: z15.iso.datetime(),
|
|
8399
|
+
result: z15.unknown()
|
|
8236
8400
|
}),
|
|
8237
8401
|
// #3043 / epic #2631 Stage 2 — cancellation marker. Append-only: the
|
|
8238
8402
|
// reducer ignores a second cancellation event so a malicious or buggy
|
|
8239
8403
|
// double-cancel can't rewrite the requestedAt timestamp.
|
|
8240
|
-
|
|
8241
|
-
event:
|
|
8242
|
-
ts:
|
|
8404
|
+
z15.object({
|
|
8405
|
+
event: z15.literal("cancellation"),
|
|
8406
|
+
ts: z15.iso.datetime(),
|
|
8243
8407
|
cancellation: TaskCancellationSchema
|
|
8244
8408
|
})
|
|
8245
8409
|
]);
|
|
@@ -9283,7 +9447,7 @@ async function runSyncConsensusVote(deps, notifier, args) {
|
|
|
9283
9447
|
approvalPercentage: result.value.approvalPercentage,
|
|
9284
9448
|
voteCount: result.value.votes.length
|
|
9285
9449
|
});
|
|
9286
|
-
return structuredToolSuccess(
|
|
9450
|
+
return structuredToolSuccess(z16.object(CONSENSUS_VOTE_OUTPUT_SCHEMA), { ...result.value });
|
|
9287
9451
|
}
|
|
9288
9452
|
async function prepareVoteArtifact(input) {
|
|
9289
9453
|
if (input.artifactPath === void 0) return { ok: true, value: input };
|
|
@@ -9353,18 +9517,18 @@ function createConsensusVoteHandler(deps) {
|
|
|
9353
9517
|
};
|
|
9354
9518
|
}
|
|
9355
9519
|
var ASYNC_ENVELOPES = {
|
|
9356
|
-
pending: (jobId) => structuredToolSuccess(
|
|
9520
|
+
pending: (jobId) => structuredToolSuccess(z16.object(CONSENSUS_VOTE_OUTPUT_SCHEMA), {
|
|
9357
9521
|
status: "pending",
|
|
9358
9522
|
jobId,
|
|
9359
9523
|
pollTool: "get_job_result",
|
|
9360
9524
|
note: 'Poll via get_job_result({ jobId }) until status !== "pending".'
|
|
9361
9525
|
}),
|
|
9362
|
-
busy: (retryAfterMs, toolName) => structuredToolSuccess(
|
|
9526
|
+
busy: (retryAfterMs, toolName) => structuredToolSuccess(z16.object(CONSENSUS_VOTE_OUTPUT_SCHEMA), {
|
|
9363
9527
|
status: "busy",
|
|
9364
9528
|
retryAfterMs,
|
|
9365
9529
|
note: `Async-mode concurrency cap reached for ${toolName}. Retry later or use dispatch: "sync".`
|
|
9366
9530
|
}),
|
|
9367
|
-
replay: (jobId) => structuredToolSuccess(
|
|
9531
|
+
replay: (jobId) => structuredToolSuccess(z16.object(CONSENSUS_VOTE_OUTPUT_SCHEMA), {
|
|
9368
9532
|
status: "replay",
|
|
9369
9533
|
jobId,
|
|
9370
9534
|
pollTool: "get_job_result",
|
|
@@ -9374,56 +9538,56 @@ var ASYNC_ENVELOPES = {
|
|
|
9374
9538
|
};
|
|
9375
9539
|
var CONSENSUS_VOTE_OUTPUT_SCHEMA = {
|
|
9376
9540
|
/** Async-dispatch envelope discriminator — absent on a completed vote. */
|
|
9377
|
-
status:
|
|
9378
|
-
jobId:
|
|
9379
|
-
pollTool:
|
|
9380
|
-
note:
|
|
9381
|
-
retryAfterMs:
|
|
9382
|
-
proposal:
|
|
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(),
|
|
9383
9547
|
strategy: VotingStrategySchema.optional(),
|
|
9384
9548
|
// Reuses the canonical VoteDecisionStatusSchema (single source) — a hand-listed
|
|
9385
9549
|
// subset here (was ['approved','rejected','no_quorum']) omitted the reachable
|
|
9386
9550
|
// 'timeout'/'pending' outcomes and made strict clients reject those votes (#4032).
|
|
9387
9551
|
decision: VoteDecisionStatusSchema.optional(),
|
|
9388
|
-
approvalPercentage:
|
|
9389
|
-
voteCounts:
|
|
9390
|
-
approve:
|
|
9391
|
-
reject:
|
|
9392
|
-
abstain:
|
|
9393
|
-
error:
|
|
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(),
|
|
9394
9558
|
/** #6094: seats that could not read the artifact; always present. */
|
|
9395
|
-
unverifiable:
|
|
9559
|
+
unverifiable: z16.number()
|
|
9396
9560
|
}).optional(),
|
|
9397
9561
|
// #6111: the quick-mode contrarian check is not a seat, so `voteCounts.error`
|
|
9398
9562
|
// cannot count it. Present on every completed vote (`skipped` when it did not
|
|
9399
9563
|
// run); optional here only because the async envelope shares this schema.
|
|
9400
9564
|
contrarianCheck: ContrarianCheckStatusSchema.optional(),
|
|
9401
|
-
votes:
|
|
9402
|
-
|
|
9403
|
-
role:
|
|
9404
|
-
decision:
|
|
9405
|
-
confidence:
|
|
9406
|
-
reasoning:
|
|
9407
|
-
simulated:
|
|
9408
|
-
error:
|
|
9409
|
-
retried:
|
|
9410
|
-
retriedFrom:
|
|
9411
|
-
source:
|
|
9412
|
-
error:
|
|
9413
|
-
errorTruncated:
|
|
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()
|
|
9414
9578
|
}).optional(),
|
|
9415
9579
|
/** #6094: present only when the seat could not read the artifact. */
|
|
9416
|
-
unverifiable:
|
|
9580
|
+
unverifiable: z16.literal(true).optional(),
|
|
9417
9581
|
/** #6115: present only when the seat answered elsewhere than assigned. */
|
|
9418
|
-
fallback:
|
|
9419
|
-
fromCli:
|
|
9420
|
-
fromModel:
|
|
9421
|
-
reason:
|
|
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"])
|
|
9422
9586
|
}).optional(),
|
|
9423
|
-
modelUsed:
|
|
9424
|
-
assignedModel:
|
|
9425
|
-
rejectionCategories:
|
|
9426
|
-
|
|
9587
|
+
modelUsed: z16.string().max(100).optional(),
|
|
9588
|
+
assignedModel: z16.string().max(100).optional(),
|
|
9589
|
+
rejectionCategories: z16.array(
|
|
9590
|
+
z16.enum([
|
|
9427
9591
|
"YAGNI",
|
|
9428
9592
|
"DRY_VIOLATION",
|
|
9429
9593
|
"OVER_ENGINEERING",
|
|
@@ -9436,64 +9600,64 @@ var CONSENSUS_VOTE_OUTPUT_SCHEMA = {
|
|
|
9436
9600
|
})
|
|
9437
9601
|
).optional(),
|
|
9438
9602
|
threshold: VoteThresholdSchema.optional(),
|
|
9439
|
-
durationMs:
|
|
9440
|
-
simulateVotes:
|
|
9603
|
+
durationMs: z16.number().optional(),
|
|
9604
|
+
simulateVotes: z16.boolean().optional(),
|
|
9441
9605
|
// #6110: the project the panel judged and how the name was decided. Always
|
|
9442
9606
|
// on the response; optional here like every field, because the async
|
|
9443
9607
|
// `pending` envelope shares this schema.
|
|
9444
|
-
project:
|
|
9445
|
-
name:
|
|
9446
|
-
source:
|
|
9608
|
+
project: z16.object({
|
|
9609
|
+
name: z16.string().max(200),
|
|
9610
|
+
source: z16.enum(["input", "derived", "default"])
|
|
9447
9611
|
}).optional(),
|
|
9448
9612
|
// #6258: the working directory the panel's seats were pointed at. Absent
|
|
9449
9613
|
// when no live seat ran (simulated panel) and on the async envelope.
|
|
9450
|
-
workspace:
|
|
9451
|
-
higherOrderMetadata:
|
|
9452
|
-
posteriorApproval:
|
|
9453
|
-
posteriorRejection:
|
|
9454
|
-
effectiveVoteCount:
|
|
9455
|
-
method:
|
|
9456
|
-
appliedToDecision:
|
|
9457
|
-
usedCorrelationData:
|
|
9458
|
-
improvementOverBaseline:
|
|
9459
|
-
downweightedAgents:
|
|
9460
|
-
reasoning:
|
|
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)
|
|
9461
9625
|
}).optional(),
|
|
9462
9626
|
// #3124: explains a `rejected` decision that coexists with a high
|
|
9463
9627
|
// approvalPercentage (an error-policy short-circuit, e.g. fail_closed).
|
|
9464
|
-
policyReason:
|
|
9628
|
+
policyReason: z16.string().max(200).optional(),
|
|
9465
9629
|
// #3991: whether the authentic vote record was persisted at vote time. Post-
|
|
9466
9630
|
// #3991 it routes through nexusDataPath under governance/, so true is the
|
|
9467
9631
|
// normal case; false means all-simulated (skipped by design) or write-failed
|
|
9468
9632
|
// (data dir unwritable) — voteRecordNote carries the actionable reason. Makes
|
|
9469
9633
|
// a previously WARN-only skip visible to MCP callers.
|
|
9470
|
-
voteRecordPersisted:
|
|
9471
|
-
voteRecordNote:
|
|
9634
|
+
voteRecordPersisted: z16.boolean().optional(),
|
|
9635
|
+
voteRecordNote: z16.string().max(500).optional(),
|
|
9472
9636
|
// #5130: the persisted record's id, so the caller-commits script can name it.
|
|
9473
|
-
voteRecordId:
|
|
9637
|
+
voteRecordId: z16.string().max(200).optional(),
|
|
9474
9638
|
// #3587: set when the panel DEGRADED (some voters errored), so the decision
|
|
9475
9639
|
// rests on fewer voters than requested. Part of the response since #3587 but
|
|
9476
9640
|
// omitted from this schema until #4032 — its absence made a strict MCP client
|
|
9477
9641
|
// reject any degraded-panel vote (`-32602 additional properties`).
|
|
9478
|
-
panelWarning:
|
|
9642
|
+
panelWarning: z16.string().optional(),
|
|
9479
9643
|
// #6115: distinct answering models and seats that answered elsewhere than
|
|
9480
9644
|
// assigned. Always on the response (explicit zeros); optional here only
|
|
9481
9645
|
// because the async `pending` envelope shares this schema.
|
|
9482
|
-
panelDiversity:
|
|
9483
|
-
distinctModels:
|
|
9646
|
+
panelDiversity: z16.object({
|
|
9647
|
+
distinctModels: z16.number().int().nonnegative(),
|
|
9484
9648
|
// #6606: distinct vendor families among the answering seats, and the
|
|
9485
9649
|
// answering seats whose model names no recognised vendor.
|
|
9486
|
-
distinctFamilies:
|
|
9487
|
-
unclassifiedSeats:
|
|
9650
|
+
distinctFamilies: z16.number().int().nonnegative(),
|
|
9651
|
+
unclassifiedSeats: z16.number().int().nonnegative(),
|
|
9488
9652
|
// #6660: answering seats whose model never resolved. Always set by
|
|
9489
9653
|
// panelDiversityOf; optional so the published schema widens additively.
|
|
9490
|
-
unresolvedSeats:
|
|
9491
|
-
fallbacks:
|
|
9654
|
+
unresolvedSeats: z16.number().int().nonnegative().optional(),
|
|
9655
|
+
fallbacks: z16.number().int().nonnegative()
|
|
9492
9656
|
}).optional(),
|
|
9493
9657
|
// Assigned roster includes errored and abstaining seats. Absent when no
|
|
9494
9658
|
// assignment resolved, including a zero-seat roster.
|
|
9495
|
-
assignedDistinctModels:
|
|
9496
|
-
assignedDistinctFamilies:
|
|
9659
|
+
assignedDistinctModels: z16.number().int().nonnegative().optional(),
|
|
9660
|
+
assignedDistinctFamilies: z16.number().int().nonnegative().optional(),
|
|
9497
9661
|
// #3855: per-decision cost rollup. Same omission as panelWarning (#4032) — it
|
|
9498
9662
|
// is present on the response whenever cost recording succeeds (common in `api`
|
|
9499
9663
|
// billing mode). Shared schema lives with the type (single source of truth).
|
|
@@ -9501,18 +9665,18 @@ var CONSENSUS_VOTE_OUTPUT_SCHEMA = {
|
|
|
9501
9665
|
// #4472: declared-option outcome. Present whenever the proposal declared
|
|
9502
9666
|
// `options`. `unattributedApprovals` is part of the contract, not telemetry:
|
|
9503
9667
|
// without it a caller cannot tell a real split from unreadable responses.
|
|
9504
|
-
optionOutcome:
|
|
9505
|
-
tally:
|
|
9506
|
-
leadingOption:
|
|
9507
|
-
leadingShare:
|
|
9508
|
-
approverCount:
|
|
9509
|
-
selectedCount:
|
|
9510
|
-
unattributedApprovals:
|
|
9511
|
-
thresholdMet:
|
|
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(),
|
|
9512
9676
|
// #4529: present only on a veto. Declared here because a strict MCP
|
|
9513
9677
|
// client rejects any property the advertised schema omits — the same
|
|
9514
9678
|
// drift that made degraded-panel votes unusable before #4032.
|
|
9515
|
-
vetoReason:
|
|
9679
|
+
vetoReason: z16.string().max(400).optional()
|
|
9516
9680
|
}).optional()
|
|
9517
9681
|
};
|
|
9518
9682
|
var CONSENSUS_VOTE_TOOL_SCHEMA = ConsensusVoteInputSchema.shape;
|
|
@@ -9659,4 +9823,4 @@ export {
|
|
|
9659
9823
|
CONSENSUS_VOTE_TOOL_SCHEMA,
|
|
9660
9824
|
registerConsensusVoteTool
|
|
9661
9825
|
};
|
|
9662
|
-
//# sourceMappingURL=chunk-
|
|
9826
|
+
//# sourceMappingURL=chunk-VS3C3L63.js.map
|