nexus-agents 2.131.0 → 2.132.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 +1 -1
- package/dist/{child-mcp-config-M7WR4XBB.js → child-mcp-config-R67B2KM6.js} +4 -4
- package/dist/{chunk-5GQMP7QN.js → chunk-27DRQWON.js} +7 -123
- package/dist/chunk-27DRQWON.js.map +1 -0
- package/dist/{chunk-VTTPYENR.js → chunk-2CLFX73Y.js} +2 -2
- package/dist/{chunk-RPT5WZAT.js → chunk-2JZ55G3X.js} +616 -336
- package/dist/chunk-2JZ55G3X.js.map +1 -0
- package/dist/{chunk-ACARS7NG.js → chunk-4CLBJ2NA.js} +3 -3
- package/dist/{chunk-ULIAUMQD.js → chunk-4DLHM6LI.js} +6 -2
- package/dist/{chunk-ULIAUMQD.js.map → chunk-4DLHM6LI.js.map} +1 -1
- package/dist/{chunk-2Z4V5THE.js → chunk-7BONPRR2.js} +2 -2
- package/dist/{chunk-AVRE45DO.js → chunk-CI5KGCX5.js} +3 -3
- package/dist/{chunk-E4LAXVQE.js → chunk-E4IYX7LD.js} +2 -2
- package/dist/{chunk-A4MPCXZ7.js → chunk-ECDJM6UB.js} +2 -2
- package/dist/{chunk-7IMI64LW.js → chunk-EFDXX5MC.js} +3 -3
- package/dist/{chunk-ZM3S6PTN.js → chunk-FKTLAPXJ.js} +3 -3
- package/dist/{chunk-3XLDANPJ.js → chunk-FRHC77VK.js} +8 -8
- package/dist/{chunk-3N7TSFKQ.js → chunk-GET2MTLW.js} +2 -2
- package/dist/{chunk-PM4MZHQK.js → chunk-GYDO2WOR.js} +13 -5
- package/dist/{chunk-PM4MZHQK.js.map → chunk-GYDO2WOR.js.map} +1 -1
- package/dist/{chunk-ZQ5K3PG4.js → chunk-I2SW34K6.js} +403 -84
- package/dist/chunk-I2SW34K6.js.map +1 -0
- package/dist/{chunk-EYD6O5TQ.js → chunk-J435FU54.js} +6 -4
- package/dist/{chunk-EYD6O5TQ.js.map → chunk-J435FU54.js.map} +1 -1
- package/dist/{chunk-OGOE3NW5.js → chunk-K5WBFAR4.js} +4 -4
- package/dist/{chunk-5CADWTFO.js → chunk-MHIJSCPR.js} +446 -162
- package/dist/chunk-MHIJSCPR.js.map +1 -0
- package/dist/{chunk-FDY6YOFG.js → chunk-NZGNOXXW.js} +3 -2
- package/dist/{chunk-FDY6YOFG.js.map → chunk-NZGNOXXW.js.map} +1 -1
- package/dist/{chunk-CMRQR57K.js → chunk-PM63X3QG.js} +3 -3
- package/dist/{chunk-VY5WEC2D.js → chunk-QJIHSQZX.js} +791 -28
- package/dist/chunk-QJIHSQZX.js.map +1 -0
- package/dist/{chunk-FFJEERPZ.js → chunk-QLRH6KOT.js} +2 -2
- package/dist/{chunk-3UXCVSLJ.js → chunk-QMCHVYZB.js} +2 -2
- package/dist/{chunk-YXFQ3L56.js → chunk-RAWF4JOT.js} +8 -8
- package/dist/{chunk-TGDWL7FG.js → chunk-RLYXX3FQ.js} +2 -2
- package/dist/{chunk-KY2QMH3C.js → chunk-RR7Q2HFH.js} +6 -6
- package/dist/{chunk-ZGLIHPGJ.js → chunk-RUSP5PJR.js} +9 -1
- package/dist/chunk-RUSP5PJR.js.map +1 -0
- package/dist/{chunk-YEK3ZHO6.js → chunk-S4U3Z6ZS.js} +9 -6
- package/dist/{chunk-YEK3ZHO6.js.map → chunk-S4U3Z6ZS.js.map} +1 -1
- package/dist/chunk-TGGR6ST5.js +126 -0
- package/dist/chunk-TGGR6ST5.js.map +1 -0
- package/dist/{chunk-IZO437XR.js → chunk-VZCQRLXT.js} +7 -7
- package/dist/{chunk-4A6MSCNJ.js → chunk-WHZD2W6Q.js} +2 -2
- package/dist/{chunk-TA5HYM3H.js → chunk-XIFOAZ5B.js} +4 -4
- package/dist/{chunk-PR4QN5HX.js → chunk-ZPWHCABL.js} +6 -2
- package/dist/{chunk-YHBVFTRG.js → chunk-ZQEQVCIU.js} +2 -2
- package/dist/{chunk-ADIJIYFA.js → chunk-ZTRBMKXK.js} +5 -2
- package/dist/{chunk-ADIJIYFA.js.map → chunk-ZTRBMKXK.js.map} +1 -1
- package/dist/cli-circuit-breaker-J6UFONNE.js +13 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +258 -150
- package/dist/cli.js.map +1 -1
- package/dist/{codebase-search-ZFJUVMVR.js → codebase-search-PWMWLU7O.js} +2 -2
- package/dist/{composite-router-V36PBE7B.js → composite-router-HQUSCJO4.js} +4 -4
- package/dist/consensus-vote-E2WJFEIJ.js +37 -0
- package/dist/{consensus-vote-types-DdruG9-X.d.ts → consensus-vote-types-CYBHW8vY.d.ts} +99 -2
- package/dist/{context-retriever-KCSSXI6X.js → context-retriever-5OVRAWNZ.js} +10 -10
- package/dist/{dist-QZLOLGIK.js → dist-A5STUO26.js} +792 -622
- package/dist/dist-A5STUO26.js.map +1 -0
- package/dist/{dist-OFXI4GYH.js → dist-C4457XNQ.js} +2 -2
- package/dist/doctor-deep-HJ3NQ365.js +12 -0
- package/dist/expert-bridge-MINXBC73.js +17 -0
- package/dist/{expert-config-OIIUMJFB.js → expert-config-53EBA7DT.js} +2 -2
- package/dist/factory-KC7BYHAP.js +21 -0
- package/dist/factory-ZG2FZYVA.js +14 -0
- package/dist/{improvement-review-AMVJW3SI.js → improvement-review-TDC4QH5P.js} +6 -6
- package/dist/index.d.ts +731 -339
- package/dist/index.js +31 -30
- package/dist/index.js.map +1 -1
- package/dist/{init-opencode-3UPZL2UQ.js → init-opencode-L3NT524E.js} +8 -7
- package/dist/{init-opencode-3UPZL2UQ.js.map → init-opencode-L3NT524E.js.map} +1 -1
- package/dist/issue-triage-CZPFNGB7.js +16 -0
- package/dist/{learning-persistence-C737Q6EP.js → learning-persistence-QFCQ5POD.js} +7 -3
- package/dist/{outcome-store-adapter-D3UDQFNQ.js → outcome-store-adapter-K4L3RUJE.js} +2 -2
- package/dist/{pr-reviewer-helpers-2WBM5GL7.js → pr-reviewer-helpers-PLKDVWYF.js} +6 -6
- package/dist/{registry-command-AXNA2H35.js → registry-command-HPKNLYUL.js} +4 -4
- package/dist/{repo-analyze-JZEMBE6R.js → repo-analyze-UJOWFGNM.js} +2 -2
- package/dist/{repo-security-plan-P2KJ4FDT.js → repo-security-plan-HSYGGVEJ.js} +5 -5
- package/dist/research-helpers-synthesize-IQHDU27S.js +14 -0
- package/dist/{routing-memory-7RNR6A45.js → routing-memory-OGUOL7UF.js} +4 -4
- package/dist/{session-memory-2J2UBZJA.js → session-memory-HQWAXH3C.js} +5 -5
- package/dist/{setup-command-UF7EQKAL.js → setup-command-CNYIKBY7.js} +13 -13
- package/dist/setup-config-HYX3BRSE.js +10 -0
- package/dist/{setup-custom-api-AZMHKIHE.js → setup-custom-api-W7EDVKWR.js} +5 -5
- package/dist/{tool-memory-MIZVB4ZT.js → tool-memory-Z2B7CAH7.js} +7 -7
- package/dist/unified-registry-UFNSWKZA.js +24 -0
- package/dist/{weather-report-WZKEEAC7.js → weather-report-GX7OIUL2.js} +4 -4
- package/package.json +12 -12
- package/dist/chunk-5CADWTFO.js.map +0 -1
- package/dist/chunk-5GQMP7QN.js.map +0 -1
- package/dist/chunk-RPT5WZAT.js.map +0 -1
- package/dist/chunk-VY5WEC2D.js.map +0 -1
- package/dist/chunk-ZGLIHPGJ.js.map +0 -1
- package/dist/chunk-ZQ5K3PG4.js.map +0 -1
- package/dist/cli-circuit-breaker-XRXLO2V6.js +0 -13
- package/dist/consensus-vote-3REPKLK4.js +0 -36
- package/dist/dist-QZLOLGIK.js.map +0 -1
- package/dist/doctor-deep-WID6FQ2F.js +0 -12
- package/dist/expert-bridge-F4UMZFWS.js +0 -17
- package/dist/factory-B3SPS47O.js +0 -21
- package/dist/factory-YVHULPTE.js +0 -14
- package/dist/issue-triage-U3VC5TKV.js +0 -16
- package/dist/research-helpers-synthesize-UHWT62F2.js +0 -14
- package/dist/setup-config-Y3S2L4RD.js +0 -10
- package/dist/unified-registry-V4AZ6UYA.js +0 -24
- /package/dist/{child-mcp-config-M7WR4XBB.js.map → child-mcp-config-R67B2KM6.js.map} +0 -0
- /package/dist/{chunk-VTTPYENR.js.map → chunk-2CLFX73Y.js.map} +0 -0
- /package/dist/{chunk-ACARS7NG.js.map → chunk-4CLBJ2NA.js.map} +0 -0
- /package/dist/{chunk-2Z4V5THE.js.map → chunk-7BONPRR2.js.map} +0 -0
- /package/dist/{chunk-AVRE45DO.js.map → chunk-CI5KGCX5.js.map} +0 -0
- /package/dist/{chunk-E4LAXVQE.js.map → chunk-E4IYX7LD.js.map} +0 -0
- /package/dist/{chunk-A4MPCXZ7.js.map → chunk-ECDJM6UB.js.map} +0 -0
- /package/dist/{chunk-7IMI64LW.js.map → chunk-EFDXX5MC.js.map} +0 -0
- /package/dist/{chunk-ZM3S6PTN.js.map → chunk-FKTLAPXJ.js.map} +0 -0
- /package/dist/{chunk-3XLDANPJ.js.map → chunk-FRHC77VK.js.map} +0 -0
- /package/dist/{chunk-3N7TSFKQ.js.map → chunk-GET2MTLW.js.map} +0 -0
- /package/dist/{chunk-OGOE3NW5.js.map → chunk-K5WBFAR4.js.map} +0 -0
- /package/dist/{chunk-CMRQR57K.js.map → chunk-PM63X3QG.js.map} +0 -0
- /package/dist/{chunk-FFJEERPZ.js.map → chunk-QLRH6KOT.js.map} +0 -0
- /package/dist/{chunk-3UXCVSLJ.js.map → chunk-QMCHVYZB.js.map} +0 -0
- /package/dist/{chunk-YXFQ3L56.js.map → chunk-RAWF4JOT.js.map} +0 -0
- /package/dist/{chunk-TGDWL7FG.js.map → chunk-RLYXX3FQ.js.map} +0 -0
- /package/dist/{chunk-KY2QMH3C.js.map → chunk-RR7Q2HFH.js.map} +0 -0
- /package/dist/{chunk-IZO437XR.js.map → chunk-VZCQRLXT.js.map} +0 -0
- /package/dist/{chunk-4A6MSCNJ.js.map → chunk-WHZD2W6Q.js.map} +0 -0
- /package/dist/{chunk-TA5HYM3H.js.map → chunk-XIFOAZ5B.js.map} +0 -0
- /package/dist/{chunk-PR4QN5HX.js.map → chunk-ZPWHCABL.js.map} +0 -0
- /package/dist/{chunk-YHBVFTRG.js.map → chunk-ZQEQVCIU.js.map} +0 -0
- /package/dist/{cli-circuit-breaker-XRXLO2V6.js.map → cli-circuit-breaker-J6UFONNE.js.map} +0 -0
- /package/dist/{codebase-search-ZFJUVMVR.js.map → codebase-search-PWMWLU7O.js.map} +0 -0
- /package/dist/{composite-router-V36PBE7B.js.map → composite-router-HQUSCJO4.js.map} +0 -0
- /package/dist/{consensus-vote-3REPKLK4.js.map → consensus-vote-E2WJFEIJ.js.map} +0 -0
- /package/dist/{context-retriever-KCSSXI6X.js.map → context-retriever-5OVRAWNZ.js.map} +0 -0
- /package/dist/{dist-OFXI4GYH.js.map → dist-C4457XNQ.js.map} +0 -0
- /package/dist/{doctor-deep-WID6FQ2F.js.map → doctor-deep-HJ3NQ365.js.map} +0 -0
- /package/dist/{expert-bridge-F4UMZFWS.js.map → expert-bridge-MINXBC73.js.map} +0 -0
- /package/dist/{expert-config-OIIUMJFB.js.map → expert-config-53EBA7DT.js.map} +0 -0
- /package/dist/{factory-B3SPS47O.js.map → factory-KC7BYHAP.js.map} +0 -0
- /package/dist/{factory-YVHULPTE.js.map → factory-ZG2FZYVA.js.map} +0 -0
- /package/dist/{improvement-review-AMVJW3SI.js.map → improvement-review-TDC4QH5P.js.map} +0 -0
- /package/dist/{issue-triage-U3VC5TKV.js.map → issue-triage-CZPFNGB7.js.map} +0 -0
- /package/dist/{learning-persistence-C737Q6EP.js.map → learning-persistence-QFCQ5POD.js.map} +0 -0
- /package/dist/{outcome-store-adapter-D3UDQFNQ.js.map → outcome-store-adapter-K4L3RUJE.js.map} +0 -0
- /package/dist/{pr-reviewer-helpers-2WBM5GL7.js.map → pr-reviewer-helpers-PLKDVWYF.js.map} +0 -0
- /package/dist/{registry-command-AXNA2H35.js.map → registry-command-HPKNLYUL.js.map} +0 -0
- /package/dist/{repo-analyze-JZEMBE6R.js.map → repo-analyze-UJOWFGNM.js.map} +0 -0
- /package/dist/{repo-security-plan-P2KJ4FDT.js.map → repo-security-plan-HSYGGVEJ.js.map} +0 -0
- /package/dist/{research-helpers-synthesize-UHWT62F2.js.map → research-helpers-synthesize-IQHDU27S.js.map} +0 -0
- /package/dist/{routing-memory-7RNR6A45.js.map → routing-memory-OGUOL7UF.js.map} +0 -0
- /package/dist/{session-memory-2J2UBZJA.js.map → session-memory-HQWAXH3C.js.map} +0 -0
- /package/dist/{setup-command-UF7EQKAL.js.map → setup-command-CNYIKBY7.js.map} +0 -0
- /package/dist/{setup-config-Y3S2L4RD.js.map → setup-config-HYX3BRSE.js.map} +0 -0
- /package/dist/{setup-custom-api-AZMHKIHE.js.map → setup-custom-api-W7EDVKWR.js.map} +0 -0
- /package/dist/{tool-memory-MIZVB4ZT.js.map → tool-memory-Z2B7CAH7.js.map} +0 -0
- /package/dist/{unified-registry-V4AZ6UYA.js.map → unified-registry-UFNSWKZA.js.map} +0 -0
- /package/dist/{weather-report-WZKEEAC7.js.map → weather-report-GX7OIUL2.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
generateSecurityPlan
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GET2MTLW.js";
|
|
4
4
|
import {
|
|
5
5
|
CodebaseIndex,
|
|
6
6
|
extractSymbolIndex,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from "./chunk-WAYGXUSM.js";
|
|
14
14
|
import {
|
|
15
15
|
executeExpert
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-RAWF4JOT.js";
|
|
17
17
|
import {
|
|
18
18
|
JobStatusSchema,
|
|
19
19
|
collectRealVotes,
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
isRateLimitError,
|
|
25
25
|
listJobs,
|
|
26
26
|
readJobResult,
|
|
27
|
+
recordDecisionCost,
|
|
27
28
|
registerIdempotentJob,
|
|
28
29
|
resolveIdempotency,
|
|
29
30
|
runAsJob,
|
|
@@ -31,24 +32,24 @@ import {
|
|
|
31
32
|
toJobSummary,
|
|
32
33
|
warnIfSimulatedOutsideTests,
|
|
33
34
|
writeJobCancelled
|
|
34
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-I2SW34K6.js";
|
|
35
36
|
import {
|
|
36
37
|
normalizeTopicToCanonical,
|
|
37
38
|
synthesizeResearch
|
|
38
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-EFDXX5MC.js";
|
|
39
40
|
import {
|
|
40
41
|
IssueTriage,
|
|
41
42
|
createAuditTrail,
|
|
42
43
|
createGraphAuditBridge,
|
|
43
44
|
emitPipelinePolicyEvent
|
|
44
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-J435FU54.js";
|
|
45
46
|
import {
|
|
46
47
|
resolveEnvMode,
|
|
47
48
|
sanitizeInput
|
|
48
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-QMCHVYZB.js";
|
|
49
50
|
import {
|
|
50
51
|
withPrerequisite
|
|
51
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-MHIJSCPR.js";
|
|
52
53
|
import {
|
|
53
54
|
NOOP_NOTIFIER,
|
|
54
55
|
RateLimiter,
|
|
@@ -70,7 +71,7 @@ import {
|
|
|
70
71
|
withAccessPolicy,
|
|
71
72
|
withProgressHeartbeat,
|
|
72
73
|
wrapToolWithTimeout
|
|
73
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-4CLBJ2NA.js";
|
|
74
75
|
import {
|
|
75
76
|
analyzeGitHubRepo
|
|
76
77
|
} from "./chunk-HFOQKCD2.js";
|
|
@@ -101,29 +102,29 @@ import {
|
|
|
101
102
|
parseRegistry,
|
|
102
103
|
sourceExistsInRegistry,
|
|
103
104
|
summarizeContextForPrompt
|
|
104
|
-
} from "./chunk-
|
|
105
|
+
} from "./chunk-S4U3Z6ZS.js";
|
|
105
106
|
import {
|
|
106
107
|
getTokenEnvVars,
|
|
107
108
|
resolveToken
|
|
108
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-ZQEQVCIU.js";
|
|
109
110
|
import {
|
|
110
111
|
loadPapersRegistry,
|
|
111
112
|
loadTechniquesRegistry
|
|
112
|
-
} from "./chunk-
|
|
113
|
+
} from "./chunk-2CLFX73Y.js";
|
|
113
114
|
import {
|
|
114
115
|
DEFAULT_RELEVANCE_CONFIG,
|
|
115
116
|
MemoryImportance,
|
|
116
117
|
calculateTextJaccardSimilarity,
|
|
117
118
|
getToolMemory
|
|
118
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-GYDO2WOR.js";
|
|
119
120
|
import {
|
|
120
121
|
createSessionMemory
|
|
121
|
-
} from "./chunk-
|
|
122
|
+
} from "./chunk-NZGNOXXW.js";
|
|
122
123
|
import {
|
|
123
124
|
DEFAULT_TASK_TTL_MS,
|
|
124
125
|
DEFAULT_TOOL_RATE_LIMITS,
|
|
125
126
|
clampTaskTtl
|
|
126
|
-
} from "./chunk-
|
|
127
|
+
} from "./chunk-FRHC77VK.js";
|
|
127
128
|
import {
|
|
128
129
|
resolveInsideRoot
|
|
129
130
|
} from "./chunk-NUBSJGQZ.js";
|
|
@@ -145,7 +146,7 @@ import {
|
|
|
145
146
|
createEvent,
|
|
146
147
|
getGlobalEventBus,
|
|
147
148
|
getGlobalRegistry
|
|
148
|
-
} from "./chunk-
|
|
149
|
+
} from "./chunk-XIFOAZ5B.js";
|
|
149
150
|
import {
|
|
150
151
|
CliDetectionCache,
|
|
151
152
|
asRecord,
|
|
@@ -153,19 +154,19 @@ import {
|
|
|
153
154
|
getAvailableClis,
|
|
154
155
|
sleep,
|
|
155
156
|
withTimeout
|
|
156
|
-
} from "./chunk-
|
|
157
|
+
} from "./chunk-VZCQRLXT.js";
|
|
157
158
|
import {
|
|
158
159
|
DEFAULTS
|
|
159
|
-
} from "./chunk-
|
|
160
|
+
} from "./chunk-WHZD2W6Q.js";
|
|
160
161
|
import {
|
|
161
162
|
getAvailabilityCache,
|
|
162
163
|
getCliForModelId,
|
|
163
164
|
resolveFallback
|
|
164
|
-
} from "./chunk-
|
|
165
|
+
} from "./chunk-7BONPRR2.js";
|
|
165
166
|
import {
|
|
166
167
|
generateHyphenId,
|
|
167
168
|
generateUUID
|
|
168
|
-
} from "./chunk-
|
|
169
|
+
} from "./chunk-E4IYX7LD.js";
|
|
169
170
|
import {
|
|
170
171
|
AGENT_ROUTER_TIMEOUTS,
|
|
171
172
|
API_TIMEOUTS,
|
|
@@ -217,6 +218,7 @@ import {
|
|
|
217
218
|
detectCapabilityGaps,
|
|
218
219
|
detectTaskCategory,
|
|
219
220
|
detectTrend,
|
|
221
|
+
entrypointToolFor,
|
|
220
222
|
err,
|
|
221
223
|
extractJsonArray,
|
|
222
224
|
extractJsonObject,
|
|
@@ -239,6 +241,7 @@ import {
|
|
|
239
241
|
getOutcomeSummaryText,
|
|
240
242
|
getPipelineEventBus,
|
|
241
243
|
getRandomProvider,
|
|
244
|
+
getStrategyManifest,
|
|
242
245
|
getTimeProvider,
|
|
243
246
|
getTokenEstimator,
|
|
244
247
|
isErr,
|
|
@@ -246,21 +249,23 @@ import {
|
|
|
246
249
|
lookupInTreeCapability,
|
|
247
250
|
modelSupportsAll,
|
|
248
251
|
ok,
|
|
252
|
+
rankStrategiesByManifest,
|
|
249
253
|
recordRoutingGaps,
|
|
250
254
|
researchContextFromText,
|
|
251
255
|
resolveModelIdentity,
|
|
252
256
|
resolveModelIdentitySync,
|
|
253
257
|
routingArmDisplaySlot,
|
|
258
|
+
selectStrategyByManifest,
|
|
254
259
|
toExpertTaskAnalysisResult,
|
|
255
260
|
withStep
|
|
256
|
-
} from "./chunk-
|
|
261
|
+
} from "./chunk-QJIHSQZX.js";
|
|
257
262
|
import {
|
|
258
263
|
ensureLearningDir,
|
|
259
264
|
getMetaOutcomesFile,
|
|
260
265
|
isPersistenceEnabled,
|
|
261
266
|
nexusDataPath,
|
|
262
267
|
nexusDataPathEnsure
|
|
263
|
-
} from "./chunk-
|
|
268
|
+
} from "./chunk-RUSP5PJR.js";
|
|
264
269
|
|
|
265
270
|
// src/agents/state-machine-types.ts
|
|
266
271
|
var VALID_TRANSITIONS = /* @__PURE__ */ new Map([
|
|
@@ -2098,6 +2103,7 @@ var AgentMemoryError = class extends Error {
|
|
|
2098
2103
|
this.context = context;
|
|
2099
2104
|
this.name = "AgentMemoryError";
|
|
2100
2105
|
}
|
|
2106
|
+
context;
|
|
2101
2107
|
};
|
|
2102
2108
|
function createInitialMemoryState(agentId, role) {
|
|
2103
2109
|
return {
|
|
@@ -6116,6 +6122,7 @@ var BaseProtocol = class {
|
|
|
6116
6122
|
this.options = options;
|
|
6117
6123
|
this.logger = options.logger ?? createLogger({ component: "CollaborationProtocol" });
|
|
6118
6124
|
}
|
|
6125
|
+
options;
|
|
6119
6126
|
logger;
|
|
6120
6127
|
session = null;
|
|
6121
6128
|
cancelled = false;
|
|
@@ -14364,6 +14371,8 @@ var ExternalPackError = class extends Error {
|
|
|
14364
14371
|
this.source = source;
|
|
14365
14372
|
this.name = "ExternalPackError";
|
|
14366
14373
|
}
|
|
14374
|
+
packName;
|
|
14375
|
+
source;
|
|
14367
14376
|
};
|
|
14368
14377
|
var ExternalSkillParameterSchema = z19.object({
|
|
14369
14378
|
name: z19.string().min(1),
|
|
@@ -16119,6 +16128,8 @@ var PolicyError = class _PolicyError extends Error {
|
|
|
16119
16128
|
this.name = "PolicyError";
|
|
16120
16129
|
Object.setPrototypeOf(this, _PolicyError.prototype);
|
|
16121
16130
|
}
|
|
16131
|
+
code;
|
|
16132
|
+
context;
|
|
16122
16133
|
};
|
|
16123
16134
|
var DEFAULT_POLICY_PARAMETERS = {
|
|
16124
16135
|
version: "1.0.0",
|
|
@@ -17494,6 +17505,8 @@ var StepExecutionError = class _StepExecutionError extends Error {
|
|
|
17494
17505
|
this.name = "StepExecutionError";
|
|
17495
17506
|
Object.setPrototypeOf(this, _StepExecutionError.prototype);
|
|
17496
17507
|
}
|
|
17508
|
+
code;
|
|
17509
|
+
context;
|
|
17497
17510
|
};
|
|
17498
17511
|
async function executeStep(context, state, agentIds, agentMap, originalTask) {
|
|
17499
17512
|
const { policyEngine, stateManager } = context;
|
|
@@ -17554,6 +17567,8 @@ var PuppeteerError = class _PuppeteerError extends Error {
|
|
|
17554
17567
|
this.name = "PuppeteerError";
|
|
17555
17568
|
Object.setPrototypeOf(this, _PuppeteerError.prototype);
|
|
17556
17569
|
}
|
|
17570
|
+
code;
|
|
17571
|
+
context;
|
|
17557
17572
|
/**
|
|
17558
17573
|
* Create from a StepExecutionError.
|
|
17559
17574
|
*/
|
|
@@ -20658,6 +20673,7 @@ var BudgetCircuitBreaker = class {
|
|
|
20658
20673
|
this.lastStateChange = getTimeProvider().now();
|
|
20659
20674
|
this.logger = logger57 ?? createLogger({ component: "budget-circuit-breaker" });
|
|
20660
20675
|
}
|
|
20676
|
+
maxTokens;
|
|
20661
20677
|
state = "closed";
|
|
20662
20678
|
lastStateChange;
|
|
20663
20679
|
violationCount = 0;
|
|
@@ -23618,10 +23634,10 @@ function calculateZStatistic(params) {
|
|
|
23618
23634
|
function calculateDifferenceCI(p1, p2, total1, total2, confidence) {
|
|
23619
23635
|
const difference = p1 - p2;
|
|
23620
23636
|
const seDiff = Math.sqrt(p1 * (1 - p1) / (total1 || 1) + p2 * (1 - p2) / (total2 || 1));
|
|
23621
|
-
const
|
|
23637
|
+
const z115 = getZScore(confidence);
|
|
23622
23638
|
return {
|
|
23623
|
-
lower: difference -
|
|
23624
|
-
upper: difference +
|
|
23639
|
+
lower: difference - z115 * seDiff,
|
|
23640
|
+
upper: difference + z115 * seDiff,
|
|
23625
23641
|
estimate: difference,
|
|
23626
23642
|
confidence,
|
|
23627
23643
|
n: total1 + total2,
|
|
@@ -23644,11 +23660,11 @@ function proportionConfidenceInterval(successes, total, options = {}) {
|
|
|
23644
23660
|
standardError: 0
|
|
23645
23661
|
};
|
|
23646
23662
|
}
|
|
23647
|
-
const
|
|
23648
|
-
const z210 =
|
|
23663
|
+
const z115 = getZScore(opts.confidence);
|
|
23664
|
+
const z210 = z115 * z115;
|
|
23649
23665
|
const denominator = 1 + z210 / n;
|
|
23650
23666
|
const center = (p + z210 / (2 * n)) / denominator;
|
|
23651
|
-
const margin =
|
|
23667
|
+
const margin = z115 / denominator * Math.sqrt(p * (1 - p) / n + z210 / (4 * n * n));
|
|
23652
23668
|
const lower = Math.max(0, center - margin);
|
|
23653
23669
|
const upper = Math.min(1, center + margin);
|
|
23654
23670
|
const standardError = Math.sqrt(p * (1 - p) / n);
|
|
@@ -23678,8 +23694,8 @@ function meanConfidenceInterval(values, options = {}) {
|
|
|
23678
23694
|
const variance = values.reduce((sum, v) => sum + (v - mean) ** 2, 0) / (n - 1 || 1);
|
|
23679
23695
|
const stdDev = Math.sqrt(variance);
|
|
23680
23696
|
const standardError = stdDev / Math.sqrt(n);
|
|
23681
|
-
const
|
|
23682
|
-
const margin =
|
|
23697
|
+
const z115 = getZScore(opts.confidence);
|
|
23698
|
+
const margin = z115 * standardError;
|
|
23683
23699
|
return {
|
|
23684
23700
|
lower: mean - margin,
|
|
23685
23701
|
upper: mean + margin,
|
|
@@ -26281,7 +26297,7 @@ function execIdFields(executionId) {
|
|
|
26281
26297
|
async function populateUnifiedContextOnState(state, options) {
|
|
26282
26298
|
const taskCandidate = state["task"];
|
|
26283
26299
|
if (typeof taskCandidate !== "string" || taskCandidate === "") return;
|
|
26284
|
-
const { getContextForTask: getContextForTask2, inferTaskCategory: inferTaskCategory2 } = await import("./context-retriever-
|
|
26300
|
+
const { getContextForTask: getContextForTask2, inferTaskCategory: inferTaskCategory2 } = await import("./context-retriever-5OVRAWNZ.js");
|
|
26285
26301
|
const category = inferTaskCategory2(taskCandidate);
|
|
26286
26302
|
const executionId = options?.executionId;
|
|
26287
26303
|
const execFields = execIdFields(executionId);
|
|
@@ -27718,6 +27734,7 @@ var TraceWriter = class {
|
|
|
27718
27734
|
}
|
|
27719
27735
|
});
|
|
27720
27736
|
}
|
|
27737
|
+
options;
|
|
27721
27738
|
buffer = [];
|
|
27722
27739
|
unsubscribe;
|
|
27723
27740
|
runDir;
|
|
@@ -29843,6 +29860,7 @@ var CycleError = class extends Error {
|
|
|
29843
29860
|
super(message);
|
|
29844
29861
|
this.cycleRoles = cycleRoles;
|
|
29845
29862
|
}
|
|
29863
|
+
cycleRoles;
|
|
29846
29864
|
name = "CycleError";
|
|
29847
29865
|
};
|
|
29848
29866
|
var MissingDependencyError = class extends Error {
|
|
@@ -29851,6 +29869,8 @@ var MissingDependencyError = class extends Error {
|
|
|
29851
29869
|
this.sourceRole = sourceRole;
|
|
29852
29870
|
this.missingRole = missingRole;
|
|
29853
29871
|
}
|
|
29872
|
+
sourceRole;
|
|
29873
|
+
missingRole;
|
|
29854
29874
|
name = "MissingDependencyError";
|
|
29855
29875
|
};
|
|
29856
29876
|
function topologicalWaveAssign(entries) {
|
|
@@ -33681,7 +33701,10 @@ async function injectMemoryContextForOrchestrate(input, logger57) {
|
|
|
33681
33701
|
mutable.context = { ...mutable.context ?? {}, priorMemorySummary: summary };
|
|
33682
33702
|
}
|
|
33683
33703
|
} catch (error) {
|
|
33684
|
-
logger57.
|
|
33704
|
+
logger57.warn("orchestrate: context retrieval failed; continuing with empty context", {
|
|
33705
|
+
category: inferTaskCategory(input.task),
|
|
33706
|
+
error: getErrorMessage(error)
|
|
33707
|
+
});
|
|
33685
33708
|
}
|
|
33686
33709
|
}
|
|
33687
33710
|
function createOrchestrateHandler(deps) {
|
|
@@ -35766,17 +35789,19 @@ function sanitizeExpertSummary(summary) {
|
|
|
35766
35789
|
}
|
|
35767
35790
|
async function maybeFetchContextPrefix(task, logger57) {
|
|
35768
35791
|
if (process.env["NEXUS_CONTEXT_RETRIEVER_INJECT"] !== "1") return void 0;
|
|
35792
|
+
const category = inferTaskCategory(task);
|
|
35769
35793
|
try {
|
|
35770
35794
|
const ctx = await getContextForTask({
|
|
35771
35795
|
task,
|
|
35772
|
-
category
|
|
35796
|
+
category,
|
|
35773
35797
|
...logger57 !== void 0 ? { logger: logger57 } : {}
|
|
35774
35798
|
});
|
|
35775
35799
|
const summary = summarizeContextForPrompt(ctx);
|
|
35776
35800
|
return summary === "" ? void 0 : summary;
|
|
35777
35801
|
} catch (error) {
|
|
35778
|
-
logger57?.
|
|
35779
|
-
|
|
35802
|
+
logger57?.warn("execute_expert: context retrieval failed; continuing without prefix", {
|
|
35803
|
+
category,
|
|
35804
|
+
error: getErrorMessage(error)
|
|
35780
35805
|
});
|
|
35781
35806
|
return void 0;
|
|
35782
35807
|
}
|
|
@@ -39996,9 +40021,58 @@ var AuditCategorySchema = z85.enum([
|
|
|
39996
40021
|
// Settings changes
|
|
39997
40022
|
"security",
|
|
39998
40023
|
// Security events, violations
|
|
39999
|
-
"system"
|
|
40024
|
+
"system",
|
|
40000
40025
|
// System events, startup, shutdown
|
|
40026
|
+
"governance"
|
|
40027
|
+
// Authority-tier transitions, ratification (Epic D, #3842)
|
|
40001
40028
|
]);
|
|
40029
|
+
var TierTransitionKindSchema = z85.enum(["promotion", "demotion"]);
|
|
40030
|
+
var TierTransitionTierSchema = z85.enum(["observe", "suggest", "advisory", "enforce"]);
|
|
40031
|
+
var TierTransitionPayloadSchema = z85.object({
|
|
40032
|
+
/** Whether the loop moved up (`promotion`) or down (`demotion`) the ladder. */
|
|
40033
|
+
kind: TierTransitionKindSchema,
|
|
40034
|
+
/** The loop/strategy whose tier changed (manifest `id` or loop identifier). */
|
|
40035
|
+
subject: z85.string().min(1),
|
|
40036
|
+
/** Tier before the transition. */
|
|
40037
|
+
fromTier: TierTransitionTierSchema,
|
|
40038
|
+
/** Tier after the transition. */
|
|
40039
|
+
toTier: TierTransitionTierSchema,
|
|
40040
|
+
/** Ref to the promotion-evidence record this transition was earned against. */
|
|
40041
|
+
evidenceRef: z85.string().min(1),
|
|
40042
|
+
/**
|
|
40043
|
+
* Ref to the recorded `consensus_vote` that ratified a PROMOTION. Required
|
|
40044
|
+
* by the ratification gate for `kind: 'promotion'`; legitimately absent for
|
|
40045
|
+
* `kind: 'demotion'` (automatic, ADR-0017 §"Demotion is automatic").
|
|
40046
|
+
*/
|
|
40047
|
+
ratificationVoteRef: z85.string().min(1).optional()
|
|
40048
|
+
}).strict();
|
|
40049
|
+
var TIER_TRANSITION_METADATA_KEY = "tierTransition";
|
|
40050
|
+
var RatificationVoteSchema = z85.object({
|
|
40051
|
+
/** The ref a tier-transition's `ratificationVoteRef` must equal to resolve. */
|
|
40052
|
+
id: z85.string().min(1),
|
|
40053
|
+
/** The loop/strategy the vote ratified (cross-checked against the transition subject). */
|
|
40054
|
+
subject: z85.string().min(1),
|
|
40055
|
+
/**
|
|
40056
|
+
* The recorded decision. Only `approved` ratifies a promotion; `rejected`
|
|
40057
|
+
* fails the gate (`promotion-ratification-not-approved`).
|
|
40058
|
+
*/
|
|
40059
|
+
decision: z85.enum(["approved", "rejected"]),
|
|
40060
|
+
/**
|
|
40061
|
+
* The voting strategy. A promotion is governance-of-the-governor and must be
|
|
40062
|
+
* ratified by a `higher_order` consensus_vote (ADR-0017).
|
|
40063
|
+
*/
|
|
40064
|
+
strategy: z85.enum(["higher_order", "simple_majority", "supermajority", "unanimous"]),
|
|
40065
|
+
/** ISO-8601 timestamp the vote was recorded. */
|
|
40066
|
+
votedAt: z85.string().min(1),
|
|
40067
|
+
/** Optional approval fraction / quorum detail, for the human record. */
|
|
40068
|
+
approvalPercentage: z85.number().min(0).max(100).optional(),
|
|
40069
|
+
/** Optional link to the vote artifact / issue thread for the human record. */
|
|
40070
|
+
voteUri: z85.string().min(1).optional()
|
|
40071
|
+
}).strict();
|
|
40072
|
+
var RatificationVoteLedgerSchema = z85.object({
|
|
40073
|
+
version: z85.number().int().positive(),
|
|
40074
|
+
votes: z85.array(RatificationVoteSchema)
|
|
40075
|
+
}).strict();
|
|
40002
40076
|
var AuditSeveritySchema = z85.enum([
|
|
40003
40077
|
"info",
|
|
40004
40078
|
// Normal operations
|
|
@@ -40071,9 +40145,19 @@ var AuditEventSchema = z85.object({
|
|
|
40071
40145
|
// Integrity (for tamper-evidence)
|
|
40072
40146
|
previousHash: z85.string().optional(),
|
|
40073
40147
|
// Hash of previous event (chain)
|
|
40074
|
-
hash: z85.string().optional()
|
|
40148
|
+
hash: z85.string().optional(),
|
|
40075
40149
|
// Hash of this event
|
|
40150
|
+
/**
|
|
40151
|
+
* Hash-projection version (#3921). ABSENT/`1` = the legacy projection
|
|
40152
|
+
* ({id,timestamp,category,action,outcome,actor,previousHash}); `2` =
|
|
40153
|
+
* the legacy projection PLUS the canonicalized `metadata.tierTransition`
|
|
40154
|
+
* payload, so a tier-transition's integrity-critical payload is hash-covered.
|
|
40155
|
+
* Versioned so pre-existing v1 chains keep verifying under their own
|
|
40156
|
+
* projection (see {@link AUDIT_HASH_VERSION_TIER_TRANSITION}).
|
|
40157
|
+
*/
|
|
40158
|
+
hashVersion: z85.number().int().positive().optional()
|
|
40076
40159
|
});
|
|
40160
|
+
var AUDIT_HASH_VERSION_TIER_TRANSITION = 2;
|
|
40077
40161
|
var AuditEventInputSchema = z85.object({
|
|
40078
40162
|
category: AuditCategorySchema,
|
|
40079
40163
|
severity: AuditSeveritySchema.optional().default("info"),
|
|
@@ -40440,13 +40524,33 @@ var FileAuditStorage = class _FileAuditStorage {
|
|
|
40440
40524
|
|
|
40441
40525
|
// src/audit/audit-logger.ts
|
|
40442
40526
|
import * as crypto from "crypto";
|
|
40527
|
+
|
|
40528
|
+
// src/audit/tier-transition-hash.ts
|
|
40529
|
+
function isTierTransitionEvent(event) {
|
|
40530
|
+
return event.category === "governance" && event.action.startsWith("tier.");
|
|
40531
|
+
}
|
|
40532
|
+
function canonicalTierTransition(raw) {
|
|
40533
|
+
const parsed = TierTransitionPayloadSchema.safeParse(raw);
|
|
40534
|
+
if (!parsed.success) return JSON.stringify({ tierTransitionInvalid: raw });
|
|
40535
|
+
const p = parsed.data;
|
|
40536
|
+
return JSON.stringify({
|
|
40537
|
+
kind: p.kind,
|
|
40538
|
+
subject: p.subject,
|
|
40539
|
+
fromTier: p.fromTier,
|
|
40540
|
+
toTier: p.toTier,
|
|
40541
|
+
evidenceRef: p.evidenceRef,
|
|
40542
|
+
ratificationVoteRef: p.ratificationVoteRef ?? null
|
|
40543
|
+
});
|
|
40544
|
+
}
|
|
40545
|
+
|
|
40546
|
+
// src/audit/audit-logger.ts
|
|
40443
40547
|
function generateEventId() {
|
|
40444
40548
|
const timestamp = getTimeProvider().now().toString(36);
|
|
40445
40549
|
const random = crypto.randomBytes(6).toString("hex");
|
|
40446
40550
|
return `aud_${timestamp}_${random}`;
|
|
40447
40551
|
}
|
|
40448
40552
|
function computeEventHash(event) {
|
|
40449
|
-
const
|
|
40553
|
+
const projection = {
|
|
40450
40554
|
id: event.id,
|
|
40451
40555
|
timestamp: event.timestamp,
|
|
40452
40556
|
category: event.category,
|
|
@@ -40454,8 +40558,13 @@ function computeEventHash(event) {
|
|
|
40454
40558
|
outcome: event.outcome,
|
|
40455
40559
|
actor: event.actor,
|
|
40456
40560
|
previousHash: event.previousHash
|
|
40457
|
-
}
|
|
40458
|
-
|
|
40561
|
+
};
|
|
40562
|
+
if (isTierTransitionEvent(event)) {
|
|
40563
|
+
projection["hashVersion"] = AUDIT_HASH_VERSION_TIER_TRANSITION;
|
|
40564
|
+
const raw = event.metadata?.[TIER_TRANSITION_METADATA_KEY];
|
|
40565
|
+
projection["tierTransition"] = canonicalTierTransition(raw);
|
|
40566
|
+
}
|
|
40567
|
+
return crypto.createHash("sha256").update(JSON.stringify(projection)).digest("hex");
|
|
40459
40568
|
}
|
|
40460
40569
|
function verifyEvent(event, index, priorHash) {
|
|
40461
40570
|
if (event.hash === void 0) {
|
|
@@ -40521,7 +40630,9 @@ var AuditLogger = class {
|
|
|
40521
40630
|
closed = false;
|
|
40522
40631
|
inFlightFlush = null;
|
|
40523
40632
|
droppedEventCount = 0;
|
|
40524
|
-
|
|
40633
|
+
persistFailureCount = 0;
|
|
40634
|
+
onPersistFailure;
|
|
40635
|
+
constructor(config, storage, logger57, onPersistFailure) {
|
|
40525
40636
|
const validated = AuditLogConfigSchema.safeParse(config);
|
|
40526
40637
|
if (!validated.success) {
|
|
40527
40638
|
const issues = validated.error.issues.map((i) => i.path.join(".") + ": " + i.message).join("; ");
|
|
@@ -40534,16 +40645,53 @@ var AuditLogger = class {
|
|
|
40534
40645
|
this.flushIntervalMs = validated.data.flushIntervalMs;
|
|
40535
40646
|
this.maxQueueDepth = validated.data.maxQueueDepth;
|
|
40536
40647
|
this.storage = storage ?? new FileAuditStorage(validated.data, this.logger);
|
|
40648
|
+
this.onPersistFailure = onPersistFailure;
|
|
40537
40649
|
this.startFlushTimer();
|
|
40538
40650
|
this.logger.info("AuditLogger initialized", { logDir: config.logDir });
|
|
40539
40651
|
}
|
|
40540
40652
|
startFlushTimer() {
|
|
40541
40653
|
this.flushTimer = setInterval(() => {
|
|
40542
|
-
this.flush().catch((
|
|
40543
|
-
this.logger.error("Audit flush failed", err2 instanceof Error ? err2 : void 0);
|
|
40654
|
+
this.flush().catch(() => {
|
|
40544
40655
|
});
|
|
40545
40656
|
}, this.flushIntervalMs);
|
|
40546
40657
|
}
|
|
40658
|
+
/**
|
|
40659
|
+
* Fail-loud handler for an audit-persist failure (#3916). A dropped/failed
|
|
40660
|
+
* audit write undermines the tamper-evident hash chain (ADR-0017 /
|
|
40661
|
+
* docs/security/audit-hash-chain-threat-model.md), so unlike the best-effort
|
|
40662
|
+
* cost path this is NOT swallowed: it logs prominently at error level,
|
|
40663
|
+
* increments a process-lifetime counter (exposed via
|
|
40664
|
+
* {@link getPersistFailureCount}), and invokes the optional `onPersistFailure`
|
|
40665
|
+
* hook so a governance consumer can escalate (e.g. raise/alert). Callers on the
|
|
40666
|
+
* awaited flush()/close() path additionally receive the thrown error directly.
|
|
40667
|
+
*/
|
|
40668
|
+
recordPersistFailure(err2) {
|
|
40669
|
+
this.persistFailureCount += 1;
|
|
40670
|
+
const error = err2 instanceof Error ? err2 : new AuditError(String(err2));
|
|
40671
|
+
this.logger.error("AUDIT PERSIST FAILURE \u2014 audit event NOT durably written", error, {
|
|
40672
|
+
totalPersistFailures: this.persistFailureCount,
|
|
40673
|
+
hashChainEnabled: this.enableHashChain
|
|
40674
|
+
});
|
|
40675
|
+
if (this.onPersistFailure !== void 0) {
|
|
40676
|
+
try {
|
|
40677
|
+
this.onPersistFailure(error);
|
|
40678
|
+
} catch (hookErr) {
|
|
40679
|
+
this.logger.error(
|
|
40680
|
+
"AUDIT PERSIST FAILURE \u2014 onPersistFailure hook threw (original audit error preserved)",
|
|
40681
|
+
hookErr instanceof Error ? hookErr : new AuditError(String(hookErr))
|
|
40682
|
+
);
|
|
40683
|
+
}
|
|
40684
|
+
}
|
|
40685
|
+
}
|
|
40686
|
+
/**
|
|
40687
|
+
* Process-lifetime count of audit flushes that FAILED to persist (#3916). A
|
|
40688
|
+
* non-zero value means at least one audit event was not durably written — the
|
|
40689
|
+
* hash chain may have a gap. Surfaced so the failure is observable rather than
|
|
40690
|
+
* silent.
|
|
40691
|
+
*/
|
|
40692
|
+
getPersistFailureCount() {
|
|
40693
|
+
return this.persistFailureCount;
|
|
40694
|
+
}
|
|
40547
40695
|
shouldLog(input) {
|
|
40548
40696
|
const severityLevels = { info: 0, warning: 1, critical: 2 };
|
|
40549
40697
|
const inputLevel = severityLevels[input.severity];
|
|
@@ -40577,6 +40725,7 @@ var AuditLogger = class {
|
|
|
40577
40725
|
violationType: input.violationType,
|
|
40578
40726
|
previousHash: this.enableHashChain ? this.lastHash ?? void 0 : void 0
|
|
40579
40727
|
};
|
|
40728
|
+
if (isTierTransitionEvent(event)) event.hashVersion = AUDIT_HASH_VERSION_TIER_TRANSITION;
|
|
40580
40729
|
if (this.enableHashChain) {
|
|
40581
40730
|
event.hash = computeEventHash(event);
|
|
40582
40731
|
this.lastHash = event.hash;
|
|
@@ -40667,6 +40816,42 @@ var AuditLogger = class {
|
|
|
40667
40816
|
metadata: { currentRate: opts.currentRate, limitRate: opts.limitRate }
|
|
40668
40817
|
});
|
|
40669
40818
|
}
|
|
40819
|
+
/**
|
|
40820
|
+
* Log an authority-tier transition (Epic D / ADR-0017, #3842). A promotion or
|
|
40821
|
+
* demotion of a loop's authority tier is recorded as a hash-chained
|
|
40822
|
+
* `governance`-category event whose `metadata.tierTransition` carries the
|
|
40823
|
+
* structured {@link TierTransitionPayload} ({subject, fromTier, toTier,
|
|
40824
|
+
* evidenceRef, ratificationVoteRef?}).
|
|
40825
|
+
*
|
|
40826
|
+
* The emitter does NOT itself enforce the ratification invariant (a promotion
|
|
40827
|
+
* with no `ratificationVoteRef` is still chained — tampering with the log to
|
|
40828
|
+
* remove the field must not erase the event). The invariant is enforced by the
|
|
40829
|
+
* ratification gate (`scripts/check-authority-tier-drift.ts`), which reads the
|
|
40830
|
+
* chained events back and FAILS a `promotion` lacking a vote ref. A promotion
|
|
40831
|
+
* is emitted at `warning` severity (it grants authority) so it surfaces above
|
|
40832
|
+
* the default info floor; a demotion is `info` (it is the safe direction).
|
|
40833
|
+
*/
|
|
40834
|
+
logTierTransition(opts) {
|
|
40835
|
+
const payload = TierTransitionPayloadSchema.parse({
|
|
40836
|
+
kind: opts.kind,
|
|
40837
|
+
subject: opts.subject,
|
|
40838
|
+
fromTier: opts.fromTier,
|
|
40839
|
+
toTier: opts.toTier,
|
|
40840
|
+
evidenceRef: opts.evidenceRef,
|
|
40841
|
+
...opts.ratificationVoteRef !== void 0 ? { ratificationVoteRef: opts.ratificationVoteRef } : {}
|
|
40842
|
+
});
|
|
40843
|
+
this.log({
|
|
40844
|
+
category: "governance",
|
|
40845
|
+
severity: opts.kind === "promotion" ? "warning" : "info",
|
|
40846
|
+
outcome: "success",
|
|
40847
|
+
action: `tier.${opts.kind}`,
|
|
40848
|
+
description: `Authority-tier ${opts.kind}: '${opts.subject}' ${opts.fromTier} \u2192 ${opts.toTier}`,
|
|
40849
|
+
actor: opts.actor ?? SYSTEM_ACTOR,
|
|
40850
|
+
resource: { type: "loop", id: opts.subject, name: opts.subject },
|
|
40851
|
+
requestId: opts.requestId,
|
|
40852
|
+
metadata: { ...opts.metadata, [TIER_TRANSITION_METADATA_KEY]: payload }
|
|
40853
|
+
});
|
|
40854
|
+
}
|
|
40670
40855
|
/** Log system startup event */
|
|
40671
40856
|
logSystemStartup(metadata) {
|
|
40672
40857
|
this.log({
|
|
@@ -40710,7 +40895,10 @@ var AuditLogger = class {
|
|
|
40710
40895
|
*/
|
|
40711
40896
|
async flush() {
|
|
40712
40897
|
if (this.inFlightFlush !== null) return this.inFlightFlush;
|
|
40713
|
-
const drain = this.drainAndFlushOnce().
|
|
40898
|
+
const drain = this.drainAndFlushOnce().catch((err2) => {
|
|
40899
|
+
this.recordPersistFailure(err2);
|
|
40900
|
+
throw err2;
|
|
40901
|
+
}).finally(() => {
|
|
40714
40902
|
this.inFlightFlush = null;
|
|
40715
40903
|
});
|
|
40716
40904
|
this.inFlightFlush = drain;
|
|
@@ -40728,8 +40916,8 @@ var AuditLogger = class {
|
|
|
40728
40916
|
this.logger.info("AuditLogger closed");
|
|
40729
40917
|
}
|
|
40730
40918
|
};
|
|
40731
|
-
function createAuditLogger(config, storage, logger57) {
|
|
40732
|
-
return new AuditLogger(config, storage, logger57);
|
|
40919
|
+
function createAuditLogger(config, storage, logger57, onPersistFailure) {
|
|
40920
|
+
return new AuditLogger(config, storage, logger57, onPersistFailure);
|
|
40733
40921
|
}
|
|
40734
40922
|
|
|
40735
40923
|
// src/pipeline/research-trigger.ts
|
|
@@ -41199,7 +41387,7 @@ async function tryIssueTriage(task) {
|
|
|
41199
41387
|
try {
|
|
41200
41388
|
const issueMatch = task.match(/github\.com\/([^/]+\/[^/]+)\/issues\/(\d+)/);
|
|
41201
41389
|
if (issueMatch === null) return null;
|
|
41202
|
-
const { createIssueTriage } = await import("./issue-triage-
|
|
41390
|
+
const { createIssueTriage } = await import("./issue-triage-CZPFNGB7.js");
|
|
41203
41391
|
const triage = createIssueTriage();
|
|
41204
41392
|
const owner = issueMatch[1] ?? "";
|
|
41205
41393
|
const num = issueMatch[2] ?? "";
|
|
@@ -41227,7 +41415,7 @@ var VALID_TEMPLATES = /* @__PURE__ */ new Set([
|
|
|
41227
41415
|
]);
|
|
41228
41416
|
async function classifyWithLLM(task) {
|
|
41229
41417
|
try {
|
|
41230
|
-
const { executeExpert: executeExpert2 } = await import("./expert-bridge-
|
|
41418
|
+
const { executeExpert: executeExpert2 } = await import("./expert-bridge-MINXBC73.js");
|
|
41231
41419
|
const prompt = [
|
|
41232
41420
|
"Classify this task into exactly one pipeline template.",
|
|
41233
41421
|
"Templates: dev (implementation/bug fix/refactor), research (investigate/evaluate/compare),",
|
|
@@ -42993,8 +43181,8 @@ var memoryInitPromise = null;
|
|
|
42993
43181
|
async function initPipelineMemory() {
|
|
42994
43182
|
if (cachedMemory !== null) return cachedMemory;
|
|
42995
43183
|
try {
|
|
42996
|
-
const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-
|
|
42997
|
-
const { getLearningDir } = await import("./learning-persistence-
|
|
43184
|
+
const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-HQWAXH3C.js");
|
|
43185
|
+
const { getLearningDir } = await import("./learning-persistence-QFCQ5POD.js");
|
|
42998
43186
|
const mem = createSessionMemory2(getLearningDir());
|
|
42999
43187
|
mem.startSession(`pipeline-${String(getTimeProvider().now())}`);
|
|
43000
43188
|
cachedMemory = {
|
|
@@ -43055,7 +43243,7 @@ function recordRoutingExperience(category, success, durationMs, tokensUsed = 0,
|
|
|
43055
43243
|
callRecord(routingMemoryCache);
|
|
43056
43244
|
return;
|
|
43057
43245
|
}
|
|
43058
|
-
routingMemoryInitPromise ??= import("./routing-memory-
|
|
43246
|
+
routingMemoryInitPromise ??= import("./routing-memory-OGUOL7UF.js").then(({ createRoutingMemory }) => {
|
|
43059
43247
|
routingMemoryCache ??= createRoutingMemory();
|
|
43060
43248
|
return routingMemoryCache;
|
|
43061
43249
|
}).catch((error) => {
|
|
@@ -43089,7 +43277,7 @@ ${text}` : "";
|
|
|
43089
43277
|
}
|
|
43090
43278
|
async function getWeatherContext() {
|
|
43091
43279
|
try {
|
|
43092
|
-
const { generateWeatherReport: generateWeatherReport2 } = await import("./weather-report-
|
|
43280
|
+
const { generateWeatherReport: generateWeatherReport2 } = await import("./weather-report-GX7OIUL2.js");
|
|
43093
43281
|
const report = generateWeatherReport2({ includeAdaptive: true });
|
|
43094
43282
|
const mappings = "recommendedMappings" in report ? report.recommendedMappings : [];
|
|
43095
43283
|
if (!Array.isArray(mappings) || mappings.length === 0) return "";
|
|
@@ -43107,8 +43295,8 @@ ${lines}
|
|
|
43107
43295
|
}
|
|
43108
43296
|
async function getMemoryContext(task) {
|
|
43109
43297
|
try {
|
|
43110
|
-
const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-
|
|
43111
|
-
const { getLearningDir } = await import("./learning-persistence-
|
|
43298
|
+
const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-HQWAXH3C.js");
|
|
43299
|
+
const { getLearningDir } = await import("./learning-persistence-QFCQ5POD.js");
|
|
43112
43300
|
const memory = createSessionMemory2(getLearningDir(), { maxLearningsInContext: 10 });
|
|
43113
43301
|
const learnings = memory.searchLearnings(task.slice(0, 200));
|
|
43114
43302
|
if (learnings.length === 0) return "";
|
|
@@ -43219,7 +43407,7 @@ ${contextBlock}`;
|
|
|
43219
43407
|
const strategy = config.votingStrategy ?? "higher_order";
|
|
43220
43408
|
await postProgress(config, "Vote", `Running consensus with ${strategy} strategy...`);
|
|
43221
43409
|
try {
|
|
43222
|
-
const { executeVoting } = await import("./consensus-vote-
|
|
43410
|
+
const { executeVoting } = await import("./consensus-vote-E2WJFEIJ.js");
|
|
43223
43411
|
const votingResult = await executeVoting(
|
|
43224
43412
|
{
|
|
43225
43413
|
proposal: buildVoteProposal(plan, research),
|
|
@@ -43641,7 +43829,7 @@ function createScaffoldStageWrapper() {
|
|
|
43641
43829
|
}
|
|
43642
43830
|
async function searchCodebaseForTask(task) {
|
|
43643
43831
|
try {
|
|
43644
|
-
const { CodebaseIndex: CodebaseIndex2 } = await import("./codebase-search-
|
|
43832
|
+
const { CodebaseIndex: CodebaseIndex2 } = await import("./codebase-search-PWMWLU7O.js");
|
|
43645
43833
|
const index = new CodebaseIndex2(process.cwd());
|
|
43646
43834
|
const terms = task.toLowerCase().split(/\s+/).filter((w) => w.length > 4).slice(0, 3);
|
|
43647
43835
|
if (terms.length === 0) return null;
|
|
@@ -43656,7 +43844,7 @@ async function searchCodebaseForTask(task) {
|
|
|
43656
43844
|
}
|
|
43657
43845
|
async function queryResearchRegistry(task) {
|
|
43658
43846
|
try {
|
|
43659
|
-
const { synthesizeResearch: synthesizeResearch2 } = await import("./research-helpers-synthesize-
|
|
43847
|
+
const { synthesizeResearch: synthesizeResearch2 } = await import("./research-helpers-synthesize-IQHDU27S.js");
|
|
43660
43848
|
const topic = task.split(/[.!?\n]/).filter((s) => s.trim().length > 10)[0]?.trim();
|
|
43661
43849
|
if (topic === void 0) return null;
|
|
43662
43850
|
const result = await synthesizeResearch2(topic.slice(0, 50));
|
|
@@ -43708,7 +43896,7 @@ function createAnalyzeStageWrapper() {
|
|
|
43708
43896
|
true
|
|
43709
43897
|
);
|
|
43710
43898
|
}
|
|
43711
|
-
const { analyzeGitHubRepo: analyzeGitHubRepo2 } = await import("./repo-analyze-
|
|
43899
|
+
const { analyzeGitHubRepo: analyzeGitHubRepo2 } = await import("./repo-analyze-UJOWFGNM.js");
|
|
43712
43900
|
const analysis = await analyzeGitHubRepo2({ repo: slug, depth: "deep" });
|
|
43713
43901
|
const summary = `Language: ${String(analysis.language)}, Framework: ${String(analysis.framework)}, CI: ${String(analysis.ciProvider)}, Security: ${analysis.securityTooling.join(", ") || "none"}`;
|
|
43714
43902
|
return output(PIPELINE_STATE_KEYS.RESEARCH, summary, getTimeProvider().now() - start, true);
|
|
@@ -43727,7 +43915,7 @@ function createScanStageWrapper() {
|
|
|
43727
43915
|
try {
|
|
43728
43916
|
const slug = ctx.task.match(/([a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+)/)?.[1];
|
|
43729
43917
|
if (slug !== void 0) {
|
|
43730
|
-
const { generateSecurityPlan: generateSecurityPlan2 } = await import("./repo-security-plan-
|
|
43918
|
+
const { generateSecurityPlan: generateSecurityPlan2 } = await import("./repo-security-plan-HSYGGVEJ.js");
|
|
43731
43919
|
const plan = await generateSecurityPlan2({ repo: slug, maxScanners: 10 });
|
|
43732
43920
|
const recs = plan.recommendations.slice(0, 5).map((r) => `${r.priority}: ${r.displayName} (${r.category})`).join("; ");
|
|
43733
43921
|
return output(PIPELINE_STATE_KEYS.FINDINGS, recs, getTimeProvider().now() - start, true);
|
|
@@ -43997,12 +44185,25 @@ async function executePrReviewBody(input, logger57) {
|
|
|
43997
44185
|
const reviews = voteResults.map(toPrReviewVote);
|
|
43998
44186
|
const counts = summarizeReviews(reviews);
|
|
43999
44187
|
const aggregate = aggregatePrDecisions(reviews);
|
|
44188
|
+
let costSummary;
|
|
44189
|
+
try {
|
|
44190
|
+
costSummary = recordDecisionCost({
|
|
44191
|
+
decisionId: `pr-${randomUUID13().slice(0, 8)}`,
|
|
44192
|
+
gate: "pr_review",
|
|
44193
|
+
votes: voteResults
|
|
44194
|
+
});
|
|
44195
|
+
} catch (costError) {
|
|
44196
|
+
logger57.warn("Per-decision cost rollup failed (non-fatal)", {
|
|
44197
|
+
error: getErrorMessage(costError)
|
|
44198
|
+
});
|
|
44199
|
+
}
|
|
44000
44200
|
const response = {
|
|
44001
44201
|
summary: aggregate.decision,
|
|
44002
44202
|
verified: aggregate.verified,
|
|
44003
44203
|
...counts,
|
|
44004
44204
|
reviews,
|
|
44005
|
-
totalDurationMs: Date.now() - start
|
|
44205
|
+
totalDurationMs: Date.now() - start,
|
|
44206
|
+
...costSummary !== void 0 ? { costSummary } : {}
|
|
44006
44207
|
};
|
|
44007
44208
|
return toolSuccess(JSON.stringify(response, null, 2));
|
|
44008
44209
|
}
|
|
@@ -45291,103 +45492,50 @@ import { randomUUID as randomUUID17 } from "crypto";
|
|
|
45291
45492
|
|
|
45292
45493
|
// src/orchestration/meta-orchestrator.ts
|
|
45293
45494
|
import { randomUUID as randomUUID14 } from "crypto";
|
|
45294
|
-
|
|
45295
|
-
|
|
45296
|
-
|
|
45297
|
-
|
|
45298
|
-
|
|
45299
|
-
};
|
|
45300
|
-
}
|
|
45301
|
-
function strategyFromPattern(pattern, complexity) {
|
|
45302
|
-
switch (pattern) {
|
|
45303
|
-
case "consensus":
|
|
45304
|
-
return "consensus";
|
|
45305
|
-
case "graph":
|
|
45306
|
-
return "graph-workflow";
|
|
45307
|
-
case "wave":
|
|
45308
|
-
case "aflow":
|
|
45309
|
-
case "puppeteer":
|
|
45310
|
-
return "orchestrate";
|
|
45311
|
-
case "sequential":
|
|
45312
|
-
return complexity === "simple" ? "single-shot" : "dev-pipeline";
|
|
45313
|
-
default: {
|
|
45314
|
-
const _exhaustive = pattern;
|
|
45315
|
-
return _exhaustive;
|
|
45316
|
-
}
|
|
45317
|
-
}
|
|
45318
|
-
}
|
|
45319
|
-
function strategyFromPipelineType(pipelineType) {
|
|
45320
|
-
switch (pipelineType) {
|
|
45321
|
-
case "greenfield":
|
|
45322
|
-
return "spec";
|
|
45323
|
-
case "research":
|
|
45324
|
-
return "research";
|
|
45325
|
-
case "audit":
|
|
45326
|
-
return "pipeline";
|
|
45327
|
-
case "dev":
|
|
45328
|
-
return "dev-pipeline";
|
|
45329
|
-
case "general":
|
|
45330
|
-
return "pipeline";
|
|
45331
|
-
default: {
|
|
45332
|
-
const _exhaustive = pipelineType;
|
|
45333
|
-
return _exhaustive;
|
|
45334
|
-
}
|
|
45335
|
-
}
|
|
45495
|
+
|
|
45496
|
+
// src/orchestration/meta-orchestrator-routing.ts
|
|
45497
|
+
function reasoningFor(selection, routing) {
|
|
45498
|
+
const { manifest, rule } = selection;
|
|
45499
|
+
const cause = rule.pipelineTypes !== void 0 && rule.patterns === void 0 ? `pipeline template "${rule.pipelineTypes.join("/")}"` : rule.pipelineTypes !== void 0 ? `pipeline template "${rule.pipelineTypes.join("/")}" under pattern "${routing.pattern}"` : `pattern "${routing.pattern}"`;
|
|
45500
|
+
return `${cause} \u2192 ${manifest.strategy} (manifest ${manifest.id}; ${routing.reasoning})`;
|
|
45336
45501
|
}
|
|
45337
45502
|
function decideStrategy(routing, classification) {
|
|
45338
45503
|
const { pattern, analysis } = routing;
|
|
45339
45504
|
const { pipelineType } = classification;
|
|
45340
|
-
|
|
45341
|
-
|
|
45342
|
-
|
|
45343
|
-
|
|
45344
|
-
|
|
45345
|
-
|
|
45346
|
-
|
|
45347
|
-
if (pipelineType === "greenfield") {
|
|
45348
|
-
return {
|
|
45349
|
-
strategy: "spec",
|
|
45350
|
-
reasoning: "Greenfield work detected \u2014 routing to a spec-driven build",
|
|
45351
|
-
confidence: classification.confidence
|
|
45352
|
-
};
|
|
45353
|
-
}
|
|
45354
|
-
if (pipelineType === "research") {
|
|
45355
|
-
return {
|
|
45356
|
-
strategy: "research",
|
|
45357
|
-
reasoning: "Research-heavy work detected \u2014 routing to the research pipeline",
|
|
45358
|
-
confidence: classification.confidence
|
|
45359
|
-
};
|
|
45360
|
-
}
|
|
45361
|
-
const patternStrategy = strategyFromPattern(pattern, analysis.complexity);
|
|
45362
|
-
if (pipelineType === "audit" && (patternStrategy === "dev-pipeline" || patternStrategy === "single-shot")) {
|
|
45505
|
+
const selection = selectStrategyByManifest({
|
|
45506
|
+
pattern,
|
|
45507
|
+
pipelineType,
|
|
45508
|
+
complexity: analysis.complexity
|
|
45509
|
+
});
|
|
45510
|
+
if (selection === void 0) {
|
|
45511
|
+
const fallback = "orchestrate";
|
|
45363
45512
|
return {
|
|
45364
|
-
strategy:
|
|
45365
|
-
reasoning:
|
|
45366
|
-
confidence:
|
|
45513
|
+
strategy: fallback,
|
|
45514
|
+
reasoning: `No manifest rule matched pattern "${pattern}" \u2014 structural fallback to ${fallback}`,
|
|
45515
|
+
confidence: routing.confidence,
|
|
45516
|
+
manifestId: fallback,
|
|
45517
|
+
manifestSchemaVersion: 0
|
|
45367
45518
|
};
|
|
45368
45519
|
}
|
|
45520
|
+
const fromTemplate = selection.rule.pipelineTypes !== void 0;
|
|
45369
45521
|
return {
|
|
45370
|
-
strategy:
|
|
45371
|
-
reasoning:
|
|
45372
|
-
confidence: routing.confidence
|
|
45522
|
+
strategy: selection.strategy,
|
|
45523
|
+
reasoning: reasoningFor(selection, routing),
|
|
45524
|
+
confidence: fromTemplate ? classification.confidence : routing.confidence,
|
|
45525
|
+
manifestId: selection.manifest.id,
|
|
45526
|
+
manifestSchemaVersion: selection.manifest.schemaVersion
|
|
45373
45527
|
};
|
|
45374
45528
|
}
|
|
45375
45529
|
function buildAlternatives(chosen, routing, classification) {
|
|
45376
|
-
const
|
|
45377
|
-
|
|
45378
|
-
|
|
45379
|
-
|
|
45380
|
-
|
|
45381
|
-
|
|
45382
|
-
const alternatives = [];
|
|
45383
|
-
for (const c of candidates) {
|
|
45384
|
-
if (!seen.has(c)) {
|
|
45385
|
-
seen.add(c);
|
|
45386
|
-
alternatives.push(c);
|
|
45387
|
-
}
|
|
45388
|
-
}
|
|
45389
|
-
return alternatives;
|
|
45530
|
+
const ranked = rankStrategiesByManifest({
|
|
45531
|
+
pattern: routing.pattern,
|
|
45532
|
+
pipelineType: classification.pipelineType,
|
|
45533
|
+
complexity: routing.analysis.complexity
|
|
45534
|
+
});
|
|
45535
|
+
return ranked.filter((s) => s !== chosen);
|
|
45390
45536
|
}
|
|
45537
|
+
|
|
45538
|
+
// src/orchestration/meta-orchestrator-decision.ts
|
|
45391
45539
|
function subSignals(routing, classification) {
|
|
45392
45540
|
return {
|
|
45393
45541
|
pattern: routing.pattern,
|
|
@@ -45397,12 +45545,15 @@ function subSignals(routing, classification) {
|
|
|
45397
45545
|
};
|
|
45398
45546
|
}
|
|
45399
45547
|
function buildForcedDecision(forced, routing, classification) {
|
|
45548
|
+
const manifest = getStrategyManifest(forced);
|
|
45400
45549
|
return {
|
|
45401
45550
|
strategy: forced,
|
|
45402
|
-
reasoning: `Strategy forced by caller: ${forced}`,
|
|
45551
|
+
reasoning: `Strategy forced by caller: ${forced} (entrypoint ${entrypointToolFor(forced)})`,
|
|
45403
45552
|
confidence: 1,
|
|
45404
45553
|
alternatives: buildAlternatives(forced, routing, classification),
|
|
45405
45554
|
needsShaping: false,
|
|
45555
|
+
manifestId: manifest?.id ?? forced,
|
|
45556
|
+
manifestSchemaVersion: manifest?.schemaVersion ?? 0,
|
|
45406
45557
|
...subSignals(routing, classification)
|
|
45407
45558
|
};
|
|
45408
45559
|
}
|
|
@@ -45415,6 +45566,8 @@ function buildSelectedDecision(routing, classification) {
|
|
|
45415
45566
|
confidence: core.confidence,
|
|
45416
45567
|
alternatives: buildAlternatives(core.strategy, routing, classification),
|
|
45417
45568
|
needsShaping,
|
|
45569
|
+
manifestId: core.manifestId,
|
|
45570
|
+
manifestSchemaVersion: core.manifestSchemaVersion,
|
|
45418
45571
|
...needsShaping && routing.suggestedQuestions !== void 0 ? { shapingQuestions: routing.suggestedQuestions } : {},
|
|
45419
45572
|
...subSignals(routing, classification)
|
|
45420
45573
|
};
|
|
@@ -45430,7 +45583,88 @@ function toRecord(decision, goal, forced, timestamp) {
|
|
|
45430
45583
|
pipelineType: decision.pipelineType,
|
|
45431
45584
|
alternatives: decision.alternatives,
|
|
45432
45585
|
needsShaping: decision.needsShaping,
|
|
45433
|
-
forced
|
|
45586
|
+
forced,
|
|
45587
|
+
manifestId: decision.manifestId,
|
|
45588
|
+
manifestSchemaVersion: decision.manifestSchemaVersion
|
|
45589
|
+
};
|
|
45590
|
+
}
|
|
45591
|
+
|
|
45592
|
+
// src/orchestration/authority-tier-guard.ts
|
|
45593
|
+
var ACTION_CLASSES = ["observe", "suggest", "advisory", "enforce"];
|
|
45594
|
+
var RANK = Object.freeze(
|
|
45595
|
+
Object.fromEntries(ACTION_CLASSES.map((c, i) => [c, i]))
|
|
45596
|
+
);
|
|
45597
|
+
function authorityRank(level) {
|
|
45598
|
+
return RANK[level];
|
|
45599
|
+
}
|
|
45600
|
+
function permitsAction(declaredTier, actionClass) {
|
|
45601
|
+
const ceiling = declaredTier === void 0 ? 0 : authorityRank(declaredTier);
|
|
45602
|
+
return authorityRank(actionClass) <= ceiling;
|
|
45603
|
+
}
|
|
45604
|
+
function dispatchActionClass(_mode) {
|
|
45605
|
+
return "suggest";
|
|
45606
|
+
}
|
|
45607
|
+
var AuthorityRefusalError = class extends Error {
|
|
45608
|
+
code;
|
|
45609
|
+
strategy;
|
|
45610
|
+
/** The tier the strategy's manifest declared (undefined ⇒ none declared). */
|
|
45611
|
+
declaredTier;
|
|
45612
|
+
/** The authority class of the action that was refused. */
|
|
45613
|
+
attemptedAction;
|
|
45614
|
+
constructor(args) {
|
|
45615
|
+
super(args.message);
|
|
45616
|
+
this.name = "AuthorityRefusalError";
|
|
45617
|
+
this.code = args.code;
|
|
45618
|
+
this.strategy = args.strategy;
|
|
45619
|
+
this.declaredTier = args.declaredTier;
|
|
45620
|
+
this.attemptedAction = args.attemptedAction;
|
|
45621
|
+
}
|
|
45622
|
+
};
|
|
45623
|
+
function evaluateAuthority(strategy, actionClass) {
|
|
45624
|
+
const manifest = getStrategyManifest(strategy);
|
|
45625
|
+
const declaredTier = manifest?.authorityTier;
|
|
45626
|
+
if (declaredTier === void 0) {
|
|
45627
|
+
if (authorityRank(actionClass) === 0) {
|
|
45628
|
+
return { permitted: true, declaredTier: "observe" };
|
|
45629
|
+
}
|
|
45630
|
+
return {
|
|
45631
|
+
permitted: false,
|
|
45632
|
+
refusal: new AuthorityRefusalError({
|
|
45633
|
+
code: "tier_undeclared",
|
|
45634
|
+
strategy,
|
|
45635
|
+
declaredTier: void 0,
|
|
45636
|
+
attemptedAction: actionClass,
|
|
45637
|
+
message: `Strategy '${strategy}' has no declared authorityTier but attempted an '${actionClass}'-class action. Fail-closed refusal (ADR-0017): declare a tier in governance/strategy-manifests.yaml.`
|
|
45638
|
+
})
|
|
45639
|
+
};
|
|
45640
|
+
}
|
|
45641
|
+
if (permitsAction(declaredTier, actionClass)) {
|
|
45642
|
+
return { permitted: true, declaredTier };
|
|
45643
|
+
}
|
|
45644
|
+
return {
|
|
45645
|
+
permitted: false,
|
|
45646
|
+
refusal: new AuthorityRefusalError({
|
|
45647
|
+
code: "above_declared_tier",
|
|
45648
|
+
strategy,
|
|
45649
|
+
declaredTier,
|
|
45650
|
+
attemptedAction: actionClass,
|
|
45651
|
+
message: `Strategy '${strategy}' is declared authorityTier='${declaredTier}' but attempted an '${actionClass}'-class action, which is above its tier. Refused fail-closed (ADR-0017): promotion requires an evidence record + ratification, not a default flip.`
|
|
45652
|
+
})
|
|
45653
|
+
};
|
|
45654
|
+
}
|
|
45655
|
+
function guardAuthority(strategy, actionClass) {
|
|
45656
|
+
const decision = evaluateAuthority(strategy, actionClass);
|
|
45657
|
+
if (!decision.permitted) {
|
|
45658
|
+
throw decision.refusal;
|
|
45659
|
+
}
|
|
45660
|
+
}
|
|
45661
|
+
|
|
45662
|
+
// src/orchestration/meta-orchestrator.ts
|
|
45663
|
+
function createAuditLogSink(logger57) {
|
|
45664
|
+
return {
|
|
45665
|
+
record(record) {
|
|
45666
|
+
logger57.info("MetaOrchestrator selection decision", { ...record });
|
|
45667
|
+
}
|
|
45434
45668
|
};
|
|
45435
45669
|
}
|
|
45436
45670
|
function recordShadow(shadowSelector, shadowSink, decision, timestamp, logger57) {
|
|
@@ -45449,6 +45683,19 @@ function recordShadow(shadowSelector, shadowSink, decision, timestamp, logger57)
|
|
|
45449
45683
|
logger57.warn("Shadow selection failed (non-fatal)", { error: getErrorMessage(err2) });
|
|
45450
45684
|
}
|
|
45451
45685
|
}
|
|
45686
|
+
function logSelection(logger57, decision, forced) {
|
|
45687
|
+
logger57.info("MetaOrchestrator strategy selected", {
|
|
45688
|
+
decisionId: decision.decisionId,
|
|
45689
|
+
strategy: decision.strategy,
|
|
45690
|
+
confidence: decision.confidence,
|
|
45691
|
+
pattern: decision.pattern,
|
|
45692
|
+
pipelineType: decision.pipelineType,
|
|
45693
|
+
needsShaping: decision.needsShaping,
|
|
45694
|
+
forced,
|
|
45695
|
+
manifestId: decision.manifestId,
|
|
45696
|
+
manifestSchemaVersion: decision.manifestSchemaVersion
|
|
45697
|
+
});
|
|
45698
|
+
}
|
|
45452
45699
|
function createMetaOrchestrator(options) {
|
|
45453
45700
|
const logger57 = options?.logger ?? createLogger({ component: "MetaOrchestrator" });
|
|
45454
45701
|
const router = options?.router ?? createWorkflowRouter({ logger: logger57 });
|
|
@@ -45464,6 +45711,9 @@ function createMetaOrchestrator(options) {
|
|
|
45464
45711
|
const forced = input.forceStrategy !== void 0;
|
|
45465
45712
|
const base = input.forceStrategy !== void 0 ? buildForcedDecision(input.forceStrategy, routing, classification) : buildSelectedDecision(routing, classification);
|
|
45466
45713
|
const decision = { ...base, decisionId: randomUUID14() };
|
|
45714
|
+
if (input.requiredAuthority !== void 0) {
|
|
45715
|
+
guardAuthority(decision.strategy, input.requiredAuthority);
|
|
45716
|
+
}
|
|
45467
45717
|
const timestamp = new Date(getTimeProvider().now()).toISOString();
|
|
45468
45718
|
sink.record(toRecord(decision, input.goal, forced, timestamp));
|
|
45469
45719
|
if (shadowSelector !== void 0 && shadowSink !== void 0) {
|
|
@@ -45475,15 +45725,7 @@ function createMetaOrchestrator(options) {
|
|
|
45475
45725
|
decisionId: decision.decisionId
|
|
45476
45726
|
});
|
|
45477
45727
|
}
|
|
45478
|
-
logger57
|
|
45479
|
-
decisionId: decision.decisionId,
|
|
45480
|
-
strategy: decision.strategy,
|
|
45481
|
-
confidence: decision.confidence,
|
|
45482
|
-
pattern: decision.pattern,
|
|
45483
|
-
pipelineType: decision.pipelineType,
|
|
45484
|
-
needsShaping: decision.needsShaping,
|
|
45485
|
-
forced
|
|
45486
|
-
});
|
|
45728
|
+
logSelection(logger57, decision, forced);
|
|
45487
45729
|
return decision;
|
|
45488
45730
|
}
|
|
45489
45731
|
};
|
|
@@ -45775,10 +46017,11 @@ var GitHubTaskTracker = class {
|
|
|
45775
46017
|
constructor(config) {
|
|
45776
46018
|
this.config = config;
|
|
45777
46019
|
}
|
|
46020
|
+
config;
|
|
45778
46021
|
cachedProvider = null;
|
|
45779
46022
|
async getProvider() {
|
|
45780
46023
|
if (this.cachedProvider !== null) return this.cachedProvider;
|
|
45781
|
-
const { createScmProvider } = await import("./factory-
|
|
46024
|
+
const { createScmProvider } = await import("./factory-ZG2FZYVA.js");
|
|
45782
46025
|
const result = await createScmProvider({ repo: this.config.repo ?? "" });
|
|
45783
46026
|
if (!result.ok) throw new Error(`SCM provider error: ${result.error.message}`);
|
|
45784
46027
|
this.cachedProvider = result.value;
|
|
@@ -45807,6 +46050,7 @@ var GitLabTaskTracker = class {
|
|
|
45807
46050
|
constructor(config) {
|
|
45808
46051
|
this.config = config;
|
|
45809
46052
|
}
|
|
46053
|
+
config;
|
|
45810
46054
|
async createTask(title, body) {
|
|
45811
46055
|
const repo = this.config.repo;
|
|
45812
46056
|
if (repo === void 0) throw new Error("GitLab backend requires repo config");
|
|
@@ -46315,16 +46559,6 @@ function registerPipelineTool(server, deps) {
|
|
|
46315
46559
|
}
|
|
46316
46560
|
|
|
46317
46561
|
// src/mcp/tools/run-tool.ts
|
|
46318
|
-
var STRATEGY_ENTRYPOINT_TOOL = {
|
|
46319
|
-
"single-shot": "delegate_to_model",
|
|
46320
|
-
"dev-pipeline": "run_dev_pipeline",
|
|
46321
|
-
pipeline: "run_pipeline",
|
|
46322
|
-
"graph-workflow": "run_graph_workflow",
|
|
46323
|
-
orchestrate: "orchestrate",
|
|
46324
|
-
consensus: "consensus_vote",
|
|
46325
|
-
spec: "execute_spec",
|
|
46326
|
-
research: "run_pipeline"
|
|
46327
|
-
};
|
|
46328
46562
|
var RunInputSchema = z104.object({
|
|
46329
46563
|
goal: z104.string().min(1).describe("Natural-language goal. nexus-agents selects how to execute it."),
|
|
46330
46564
|
forceStrategy: z104.enum([
|
|
@@ -46358,7 +46592,7 @@ var RunInputSchema = z104.object({
|
|
|
46358
46592
|
)
|
|
46359
46593
|
});
|
|
46360
46594
|
var NOTE = "Routing decision only (read-only). Invoke the recommendedTool to execute, or wait for inline execution (run execute: true) in a later release. The other pipeline tools remain available as advanced force-strategy paths.";
|
|
46361
|
-
function toMetaInput(input) {
|
|
46595
|
+
function toMetaInput(input, mode) {
|
|
46362
46596
|
const signals = {};
|
|
46363
46597
|
if (input.requiresConsensus !== void 0) signals.requiresConsensus = input.requiresConsensus;
|
|
46364
46598
|
if (input.dependencyStructure !== void 0)
|
|
@@ -46366,20 +46600,21 @@ function toMetaInput(input) {
|
|
|
46366
46600
|
if (input.isNovel !== void 0) signals.isNovel = input.isNovel;
|
|
46367
46601
|
return {
|
|
46368
46602
|
goal: input.goal,
|
|
46603
|
+
requiredAuthority: dispatchActionClass(mode),
|
|
46369
46604
|
...Object.keys(signals).length > 0 ? { signals } : {},
|
|
46370
46605
|
...input.forceStrategy !== void 0 ? { forceStrategy: input.forceStrategy } : {}
|
|
46371
46606
|
};
|
|
46372
46607
|
}
|
|
46373
|
-
function selectDecision(input, logger57) {
|
|
46608
|
+
function selectDecision(input, mode, logger57) {
|
|
46374
46609
|
const meta = createMetaOrchestrator({
|
|
46375
46610
|
...logger57 !== void 0 ? { logger: logger57 } : {},
|
|
46376
46611
|
shadowSelector: getShadowSelector(),
|
|
46377
46612
|
shadowSink: getShadowSink()
|
|
46378
46613
|
});
|
|
46379
|
-
return meta.select(toMetaInput(input));
|
|
46614
|
+
return meta.select(toMetaInput(input, mode));
|
|
46380
46615
|
}
|
|
46381
46616
|
function routeGoal(input, logger57) {
|
|
46382
|
-
const decision = selectDecision(input, logger57);
|
|
46617
|
+
const decision = selectDecision(input, "route", logger57);
|
|
46383
46618
|
return {
|
|
46384
46619
|
strategy: decision.strategy,
|
|
46385
46620
|
reasoning: decision.reasoning,
|
|
@@ -46387,7 +46622,7 @@ function routeGoal(input, logger57) {
|
|
|
46387
46622
|
alternatives: decision.alternatives,
|
|
46388
46623
|
needsShaping: decision.needsShaping,
|
|
46389
46624
|
...decision.shapingQuestions !== void 0 ? { shapingQuestions: decision.shapingQuestions } : {},
|
|
46390
|
-
recommendedTool:
|
|
46625
|
+
recommendedTool: entrypointToolFor(decision.strategy),
|
|
46391
46626
|
decisionId: decision.decisionId,
|
|
46392
46627
|
note: NOTE
|
|
46393
46628
|
};
|
|
@@ -46419,7 +46654,7 @@ function buildShadowTrainObserver(logger57) {
|
|
|
46419
46654
|
};
|
|
46420
46655
|
}
|
|
46421
46656
|
async function executeGoal(input, opts = {}) {
|
|
46422
|
-
const decision = selectDecision(input, opts.logger);
|
|
46657
|
+
const decision = selectDecision(input, "execute", opts.logger);
|
|
46423
46658
|
const onOutcome = opts.onOutcome ?? buildShadowTrainObserver(opts.logger);
|
|
46424
46659
|
const dispatcher = createMetaDispatcher({
|
|
46425
46660
|
executors: opts.executors ?? buildDefaultExecutors(opts.trustTier),
|
|
@@ -46427,7 +46662,7 @@ async function executeGoal(input, opts = {}) {
|
|
|
46427
46662
|
...opts.outcomeSink !== void 0 ? { outcomeSink: opts.outcomeSink } : {},
|
|
46428
46663
|
...onOutcome !== void 0 ? { onOutcome } : {}
|
|
46429
46664
|
});
|
|
46430
|
-
const dispatch = await dispatcher.dispatch(decision, toMetaInput(input));
|
|
46665
|
+
const dispatch = await dispatcher.dispatch(decision, toMetaInput(input, "execute"));
|
|
46431
46666
|
return {
|
|
46432
46667
|
strategy: dispatch.strategy,
|
|
46433
46668
|
decisionId: dispatch.decisionId,
|
|
@@ -46451,8 +46686,9 @@ async function executeRunBody(input, logger57, trustTier) {
|
|
|
46451
46686
|
return toolSuccess(JSON.stringify(exec2, null, 2));
|
|
46452
46687
|
} catch (err2) {
|
|
46453
46688
|
const noExecutor = err2 instanceof MetaDispatchError && err2.code === "no_executor";
|
|
46689
|
+
const refused = err2 instanceof AuthorityRefusalError;
|
|
46454
46690
|
return toolStructuredError({
|
|
46455
|
-
errorCategory: noExecutor ? "business" : "internal",
|
|
46691
|
+
errorCategory: noExecutor || refused ? "business" : "internal",
|
|
46456
46692
|
message: err2 instanceof Error ? err2.message : String(err2)
|
|
46457
46693
|
});
|
|
46458
46694
|
}
|
|
@@ -46550,7 +46786,7 @@ async function probeSource(source, includeModelIds) {
|
|
|
46550
46786
|
}
|
|
46551
46787
|
}
|
|
46552
46788
|
async function defaultSources(includeOpenRouter) {
|
|
46553
|
-
const { createAllAdapters: createAllAdapters2 } = await import("./factory-
|
|
46789
|
+
const { createAllAdapters: createAllAdapters2 } = await import("./factory-KC7BYHAP.js");
|
|
46554
46790
|
const adapters = createAllAdapters2();
|
|
46555
46791
|
return buildDefaultModelSources(adapters, { includeOpenRouter });
|
|
46556
46792
|
}
|
|
@@ -46606,8 +46842,52 @@ function registerListAvailableModelsTool(server, deps) {
|
|
|
46606
46842
|
logger57.info("Registered list_available_models tool");
|
|
46607
46843
|
}
|
|
46608
46844
|
|
|
46609
|
-
// src/mcp/tools/
|
|
46845
|
+
// src/mcp/tools/pr-review-eval-types.ts
|
|
46610
46846
|
import { z as z106 } from "zod";
|
|
46847
|
+
var PR_REVIEW_EVAL_ROLES = [
|
|
46848
|
+
"architect",
|
|
46849
|
+
"security",
|
|
46850
|
+
"devex",
|
|
46851
|
+
"catfish",
|
|
46852
|
+
"scope_steward"
|
|
46853
|
+
];
|
|
46854
|
+
var PrReviewEvalRoleSchema = z106.enum(PR_REVIEW_EVAL_ROLES);
|
|
46855
|
+
var PrReviewCaseClassSchema = z106.enum(["buggy", "clean", "borderline"]);
|
|
46856
|
+
var VoterEvalVerdictSchema = z106.object({
|
|
46857
|
+
/** Stable record id (e.g. `${runId}:${caseNumber}:${role}`). */
|
|
46858
|
+
id: z106.string().min(1).max(160),
|
|
46859
|
+
/** The pr_review run / batch this verdict belongs to. */
|
|
46860
|
+
runId: z106.string().min(1).max(64),
|
|
46861
|
+
/** Dataset case identifier (the dataset's `number` field). */
|
|
46862
|
+
caseNumber: z106.string().min(1).max(80),
|
|
46863
|
+
/** Rubric class of the case (ground-truth label). */
|
|
46864
|
+
caseClass: PrReviewCaseClassSchema,
|
|
46865
|
+
/** The voter role being scored. */
|
|
46866
|
+
role: PrReviewEvalRoleSchema,
|
|
46867
|
+
/** Verified findings that matched a known bug. */
|
|
46868
|
+
truePositives: z106.number().int().nonnegative(),
|
|
46869
|
+
/** Verified findings on clean code that matched no known bug. */
|
|
46870
|
+
falsePositives: z106.number().int().nonnegative(),
|
|
46871
|
+
/** Known bugs this voter failed to flag. */
|
|
46872
|
+
falseNegatives: z106.number().int().nonnegative(),
|
|
46873
|
+
/** Rubric version the ground truth was adjudicated under. */
|
|
46874
|
+
rubricVersion: z106.string().min(1).max(32),
|
|
46875
|
+
/** ISO-8601 timestamp the verdict was recorded. */
|
|
46876
|
+
timestamp: z106.string().min(1).max(40)
|
|
46877
|
+
});
|
|
46878
|
+
var VoterEvalVerdictQuerySchema = z106.object({
|
|
46879
|
+
role: PrReviewEvalRoleSchema.optional(),
|
|
46880
|
+
runId: z106.string().min(1).max(64).optional(),
|
|
46881
|
+
caseClass: PrReviewCaseClassSchema.optional(),
|
|
46882
|
+
rubricVersion: z106.string().min(1).max(32).optional(),
|
|
46883
|
+
/** ISO-8601 lower bound (inclusive) on `timestamp`. */
|
|
46884
|
+
since: z106.string().optional(),
|
|
46885
|
+
/** Most-recent-N cap. */
|
|
46886
|
+
limit: z106.number().int().positive().optional()
|
|
46887
|
+
});
|
|
46888
|
+
|
|
46889
|
+
// src/mcp/tools/supply-chain-tradeoff-panel.ts
|
|
46890
|
+
import { z as z107 } from "zod";
|
|
46611
46891
|
import { randomUUID as randomUUID18 } from "crypto";
|
|
46612
46892
|
var DEFAULT_AXES = [
|
|
46613
46893
|
"build_time_determinism",
|
|
@@ -46629,16 +46909,16 @@ var FULL_PANEL = [
|
|
|
46629
46909
|
"scope_steward"
|
|
46630
46910
|
];
|
|
46631
46911
|
var QUICK_PANEL = ["architect", "security", "scope_steward"];
|
|
46632
|
-
var SupplyChainTradeoffPanelInputSchema =
|
|
46633
|
-
proposal:
|
|
46634
|
-
axes:
|
|
46912
|
+
var SupplyChainTradeoffPanelInputSchema = z107.object({
|
|
46913
|
+
proposal: z107.string().min(1).max(MAX_PROPOSAL_LENGTH).describe('The proposal under tradeoff review (e.g. "Should aegis-boot adopt cargo-nextest?")'),
|
|
46914
|
+
axes: z107.array(z107.string().min(1).max(MAX_AXIS_NAME_LENGTH)).min(1).max(MAX_AXES).optional().describe(
|
|
46635
46915
|
`Tradeoff axes to evaluate. Default: ${DEFAULT_AXES.join(", ")}. Custom axes accepted; max ${String(MAX_AXES)}.`
|
|
46636
46916
|
),
|
|
46637
|
-
context:
|
|
46917
|
+
context: z107.string().max(MAX_CONTEXT_LENGTH).optional().describe(
|
|
46638
46918
|
"Optional context: relevant repo state, dependency tree, vendor publishing patterns, etc."
|
|
46639
46919
|
),
|
|
46640
|
-
quickMode:
|
|
46641
|
-
simulate:
|
|
46920
|
+
quickMode: z107.boolean().optional().default(false).describe("Use 3 voters (architect, security, scope_steward) instead of 7"),
|
|
46921
|
+
simulate: z107.boolean().optional().default(false).describe("Use simulated voters (testing only)"),
|
|
46642
46922
|
/**
|
|
46643
46923
|
* Dispatch mode (#3731). `sync` (default) runs the panel inline and returns
|
|
46644
46924
|
* the result — but a live fan-out (up to 7 voters) can exceed the MCP request
|
|
@@ -46646,7 +46926,7 @@ var SupplyChainTradeoffPanelInputSchema = z106.object({
|
|
|
46646
46926
|
* immediately and runs the panel in the background; poll
|
|
46647
46927
|
* `get_job_result({ jobId })` for the result.
|
|
46648
46928
|
*/
|
|
46649
|
-
dispatch:
|
|
46929
|
+
dispatch: z107.enum(["sync", "async"]).default("sync").describe(
|
|
46650
46930
|
"Dispatch mode (#3731). 'sync' (default): run inline. 'async': return a jobId immediately + run the panel in background (poll get_job_result)."
|
|
46651
46931
|
)
|
|
46652
46932
|
});
|
|
@@ -47113,40 +47393,40 @@ var RiskLevel = /* @__PURE__ */ ((RiskLevel2) => {
|
|
|
47113
47393
|
})(RiskLevel || {});
|
|
47114
47394
|
|
|
47115
47395
|
// src/mcp/safety/stpa-schemas.ts
|
|
47116
|
-
import { z as
|
|
47117
|
-
var HazardCategorySchema =
|
|
47118
|
-
var HazardSeveritySchema =
|
|
47119
|
-
var ConstraintPrioritySchema =
|
|
47120
|
-
var RiskLevelSchema =
|
|
47121
|
-
var TriggerPatternSchema =
|
|
47122
|
-
parameter:
|
|
47123
|
-
matchType:
|
|
47124
|
-
pattern:
|
|
47125
|
-
reason:
|
|
47396
|
+
import { z as z108 } from "zod";
|
|
47397
|
+
var HazardCategorySchema = z108.enum(HazardCategory);
|
|
47398
|
+
var HazardSeveritySchema = z108.enum(HazardSeverity);
|
|
47399
|
+
var ConstraintPrioritySchema = z108.enum(ConstraintPriority);
|
|
47400
|
+
var RiskLevelSchema = z108.enum(RiskLevel);
|
|
47401
|
+
var TriggerPatternSchema = z108.object({
|
|
47402
|
+
parameter: z108.string().min(1),
|
|
47403
|
+
matchType: z108.enum(["contains", "regex", "equals", "startsWith", "endsWith"]),
|
|
47404
|
+
pattern: z108.string(),
|
|
47405
|
+
reason: z108.string()
|
|
47126
47406
|
});
|
|
47127
|
-
var HazardSchema =
|
|
47128
|
-
id:
|
|
47129
|
-
description:
|
|
47407
|
+
var HazardSchema = z108.object({
|
|
47408
|
+
id: z108.string().min(1),
|
|
47409
|
+
description: z108.string(),
|
|
47130
47410
|
category: HazardCategorySchema,
|
|
47131
47411
|
severity: HazardSeveritySchema,
|
|
47132
|
-
likelihood:
|
|
47133
|
-
triggerConditions:
|
|
47134
|
-
consequences:
|
|
47412
|
+
likelihood: z108.enum(["almost_certain", "likely", "possible", "unlikely", "rare"]),
|
|
47413
|
+
triggerConditions: z108.array(z108.string()),
|
|
47414
|
+
consequences: z108.array(z108.string())
|
|
47135
47415
|
});
|
|
47136
|
-
var UnsafeControlActionSchema =
|
|
47137
|
-
id:
|
|
47138
|
-
toolName:
|
|
47139
|
-
type:
|
|
47140
|
-
description:
|
|
47141
|
-
unsafeContext:
|
|
47142
|
-
relatedHazards:
|
|
47143
|
-
triggerPatterns:
|
|
47416
|
+
var UnsafeControlActionSchema = z108.object({
|
|
47417
|
+
id: z108.string().min(1),
|
|
47418
|
+
toolName: z108.string().min(1),
|
|
47419
|
+
type: z108.enum(["not_provided", "provided_causes_hazard", "wrong_timing", "wrong_duration"]),
|
|
47420
|
+
description: z108.string(),
|
|
47421
|
+
unsafeContext: z108.string(),
|
|
47422
|
+
relatedHazards: z108.array(z108.string()),
|
|
47423
|
+
triggerPatterns: z108.array(TriggerPatternSchema).optional()
|
|
47144
47424
|
});
|
|
47145
|
-
var SafetyConstraintSchema =
|
|
47146
|
-
id:
|
|
47147
|
-
description:
|
|
47148
|
-
mitigates:
|
|
47149
|
-
enforcement:
|
|
47425
|
+
var SafetyConstraintSchema = z108.object({
|
|
47426
|
+
id: z108.string().min(1),
|
|
47427
|
+
description: z108.string(),
|
|
47428
|
+
mitigates: z108.array(z108.string()),
|
|
47429
|
+
enforcement: z108.enum([
|
|
47150
47430
|
"prevent",
|
|
47151
47431
|
"require_confirmation",
|
|
47152
47432
|
"alert",
|
|
@@ -47154,54 +47434,54 @@ var SafetyConstraintSchema = z107.object({
|
|
|
47154
47434
|
"rate_limit",
|
|
47155
47435
|
"require_privilege"
|
|
47156
47436
|
]),
|
|
47157
|
-
validationFunction:
|
|
47437
|
+
validationFunction: z108.string().optional(),
|
|
47158
47438
|
priority: ConstraintPrioritySchema
|
|
47159
47439
|
});
|
|
47160
|
-
var PropertySchemaSchema =
|
|
47161
|
-
type:
|
|
47162
|
-
description:
|
|
47163
|
-
enum:
|
|
47164
|
-
pattern:
|
|
47165
|
-
minimum:
|
|
47166
|
-
maximum:
|
|
47440
|
+
var PropertySchemaSchema = z108.object({
|
|
47441
|
+
type: z108.string(),
|
|
47442
|
+
description: z108.string().optional(),
|
|
47443
|
+
enum: z108.array(z108.unknown()).optional(),
|
|
47444
|
+
pattern: z108.string().optional(),
|
|
47445
|
+
minimum: z108.number().optional(),
|
|
47446
|
+
maximum: z108.number().optional()
|
|
47167
47447
|
});
|
|
47168
|
-
var ToolInputSchemaSchema =
|
|
47169
|
-
type:
|
|
47170
|
-
properties:
|
|
47171
|
-
required:
|
|
47172
|
-
additionalProperties:
|
|
47448
|
+
var ToolInputSchemaSchema = z108.object({
|
|
47449
|
+
type: z108.string(),
|
|
47450
|
+
properties: z108.record(z108.string(), PropertySchemaSchema).optional(),
|
|
47451
|
+
required: z108.array(z108.string()).optional(),
|
|
47452
|
+
additionalProperties: z108.boolean().optional()
|
|
47173
47453
|
});
|
|
47174
|
-
var ToolDefinitionSchema =
|
|
47175
|
-
name:
|
|
47176
|
-
description:
|
|
47454
|
+
var ToolDefinitionSchema = z108.object({
|
|
47455
|
+
name: z108.string().min(1),
|
|
47456
|
+
description: z108.string(),
|
|
47177
47457
|
inputSchema: ToolInputSchemaSchema
|
|
47178
47458
|
});
|
|
47179
|
-
var AnalysisConfigurationSchema =
|
|
47180
|
-
includeLowSeverity:
|
|
47181
|
-
generateAllConstraints:
|
|
47182
|
-
checkInteractions:
|
|
47183
|
-
maxHazardsPerTool:
|
|
47184
|
-
categories:
|
|
47459
|
+
var AnalysisConfigurationSchema = z108.object({
|
|
47460
|
+
includeLowSeverity: z108.boolean().default(true),
|
|
47461
|
+
generateAllConstraints: z108.boolean().default(true),
|
|
47462
|
+
checkInteractions: z108.boolean().default(true),
|
|
47463
|
+
maxHazardsPerTool: z108.number().int().min(1).max(100).default(50),
|
|
47464
|
+
categories: z108.array(HazardCategorySchema).default([])
|
|
47185
47465
|
});
|
|
47186
|
-
var ConstraintViolationSchema =
|
|
47187
|
-
constraintId:
|
|
47188
|
-
constraintDescription:
|
|
47466
|
+
var ConstraintViolationSchema = z108.object({
|
|
47467
|
+
constraintId: z108.string().min(1),
|
|
47468
|
+
constraintDescription: z108.string(),
|
|
47189
47469
|
severity: HazardSeveritySchema,
|
|
47190
|
-
details:
|
|
47191
|
-
remediation:
|
|
47470
|
+
details: z108.string(),
|
|
47471
|
+
remediation: z108.string()
|
|
47192
47472
|
});
|
|
47193
|
-
var ValidationWarningSchema =
|
|
47194
|
-
code:
|
|
47195
|
-
message:
|
|
47196
|
-
affected:
|
|
47473
|
+
var ValidationWarningSchema = z108.object({
|
|
47474
|
+
code: z108.string().min(1),
|
|
47475
|
+
message: z108.string(),
|
|
47476
|
+
affected: z108.string()
|
|
47197
47477
|
});
|
|
47198
|
-
var ValidationResultSchema =
|
|
47199
|
-
valid:
|
|
47200
|
-
toolName:
|
|
47201
|
-
violations:
|
|
47202
|
-
passed:
|
|
47203
|
-
warnings:
|
|
47204
|
-
validatedAt:
|
|
47478
|
+
var ValidationResultSchema = z108.object({
|
|
47479
|
+
valid: z108.boolean(),
|
|
47480
|
+
toolName: z108.string().min(1),
|
|
47481
|
+
violations: z108.array(ConstraintViolationSchema),
|
|
47482
|
+
passed: z108.array(z108.string()),
|
|
47483
|
+
warnings: z108.array(ValidationWarningSchema),
|
|
47484
|
+
validatedAt: z108.date()
|
|
47205
47485
|
});
|
|
47206
47486
|
|
|
47207
47487
|
// src/mcp/safety/stpa-types.ts
|
|
@@ -48286,43 +48566,43 @@ var GeminiResponseParser = class {
|
|
|
48286
48566
|
};
|
|
48287
48567
|
|
|
48288
48568
|
// src/cli-adapters/router-types.ts
|
|
48289
|
-
import { z as
|
|
48290
|
-
var RouterConfigSchema =
|
|
48291
|
-
minCapacityThreshold:
|
|
48292
|
-
preferCostEfficient:
|
|
48293
|
-
maxDecisionTimeMs:
|
|
48569
|
+
import { z as z109 } from "zod";
|
|
48570
|
+
var RouterConfigSchema = z109.object({
|
|
48571
|
+
minCapacityThreshold: z109.number().min(0).max(1).default(0.1),
|
|
48572
|
+
preferCostEfficient: z109.boolean().default(false),
|
|
48573
|
+
maxDecisionTimeMs: z109.number().min(1).max(1e3).default(100)
|
|
48294
48574
|
});
|
|
48295
48575
|
|
|
48296
48576
|
// src/cli-adapters/agreement-cascade-types.ts
|
|
48297
|
-
import { z as
|
|
48298
|
-
var AgreementCascadeConfigSchema =
|
|
48299
|
-
agreementThreshold:
|
|
48300
|
-
maxStages:
|
|
48301
|
-
modelTimeoutMs:
|
|
48577
|
+
import { z as z110 } from "zod";
|
|
48578
|
+
var AgreementCascadeConfigSchema = z110.object({
|
|
48579
|
+
agreementThreshold: z110.number().min(0.5).max(1).default(0.7),
|
|
48580
|
+
maxStages: z110.number().int().min(1).max(5).default(3),
|
|
48581
|
+
modelTimeoutMs: z110.number().int().min(1e3).max(3e5).default(6e4)
|
|
48302
48582
|
});
|
|
48303
48583
|
|
|
48304
48584
|
// src/cli-adapters/agreement-cascade-router.ts
|
|
48305
48585
|
var logger48 = createLogger({ component: "agreement-cascade-router" });
|
|
48306
48586
|
|
|
48307
48587
|
// src/cli-adapters/task-classifier.ts
|
|
48308
|
-
import { z as
|
|
48309
|
-
var ClassificationPatternsSchema =
|
|
48310
|
-
code:
|
|
48311
|
-
research:
|
|
48312
|
-
documentation:
|
|
48313
|
-
analysis:
|
|
48588
|
+
import { z as z111 } from "zod";
|
|
48589
|
+
var ClassificationPatternsSchema = z111.object({
|
|
48590
|
+
code: z111.array(z111.string()).readonly(),
|
|
48591
|
+
research: z111.array(z111.string()).readonly(),
|
|
48592
|
+
documentation: z111.array(z111.string()).readonly(),
|
|
48593
|
+
analysis: z111.array(z111.string()).readonly()
|
|
48314
48594
|
});
|
|
48315
48595
|
|
|
48316
48596
|
// src/cli-adapters/response-cache-types.ts
|
|
48317
|
-
import { z as
|
|
48318
|
-
var ResponseCacheConfigSchema =
|
|
48319
|
-
defaultTTL:
|
|
48597
|
+
import { z as z112 } from "zod";
|
|
48598
|
+
var ResponseCacheConfigSchema = z112.object({
|
|
48599
|
+
defaultTTL: z112.number().min(1e3).max(36e5).default(3e5),
|
|
48320
48600
|
// 5 minutes
|
|
48321
|
-
maxEntries:
|
|
48322
|
-
maxMemoryMB:
|
|
48323
|
-
cleanupInterval:
|
|
48601
|
+
maxEntries: z112.number().min(10).max(1e5).default(1e3),
|
|
48602
|
+
maxMemoryMB: z112.number().min(1).max(1e3).default(50),
|
|
48603
|
+
cleanupInterval: z112.number().min(1e3).max(6e5).default(6e4),
|
|
48324
48604
|
// 1 minute
|
|
48325
|
-
enableLogging:
|
|
48605
|
+
enableLogging: z112.boolean().default(false)
|
|
48326
48606
|
});
|
|
48327
48607
|
|
|
48328
48608
|
// src/cli-adapters/response-cache-utils.ts
|
|
@@ -48330,12 +48610,12 @@ import { createHash as createHash4 } from "crypto";
|
|
|
48330
48610
|
var logger49 = createLogger({ component: "ResponseCacheUtils" });
|
|
48331
48611
|
|
|
48332
48612
|
// src/cli-adapters/unified-routing-types.ts
|
|
48333
|
-
import { z as
|
|
48334
|
-
var UnifiedRoutingDecisionSchema =
|
|
48335
|
-
selectedCli:
|
|
48336
|
-
confidence:
|
|
48337
|
-
reason:
|
|
48338
|
-
strategy:
|
|
48613
|
+
import { z as z113 } from "zod";
|
|
48614
|
+
var UnifiedRoutingDecisionSchema = z113.object({
|
|
48615
|
+
selectedCli: z113.string(),
|
|
48616
|
+
confidence: z113.number().min(0).max(1),
|
|
48617
|
+
reason: z113.string(),
|
|
48618
|
+
strategy: z113.enum([
|
|
48339
48619
|
"composite",
|
|
48340
48620
|
"quality",
|
|
48341
48621
|
"budget",
|
|
@@ -48347,57 +48627,57 @@ var UnifiedRoutingDecisionSchema = z112.object({
|
|
|
48347
48627
|
"linucb",
|
|
48348
48628
|
"direct"
|
|
48349
48629
|
]),
|
|
48350
|
-
decisionTimeMs:
|
|
48351
|
-
alternatives:
|
|
48352
|
-
stagesExecuted:
|
|
48353
|
-
withinBudget:
|
|
48354
|
-
estimatedComplexity:
|
|
48355
|
-
estimatedTokens:
|
|
48356
|
-
topsisScore:
|
|
48357
|
-
ucbScore:
|
|
48358
|
-
resolvedAtStage:
|
|
48359
|
-
consensusReached:
|
|
48360
|
-
agreementScore:
|
|
48361
|
-
metadata:
|
|
48630
|
+
decisionTimeMs: z113.number().nonnegative(),
|
|
48631
|
+
alternatives: z113.array(z113.string()).readonly(),
|
|
48632
|
+
stagesExecuted: z113.array(z113.string()).readonly(),
|
|
48633
|
+
withinBudget: z113.boolean().optional(),
|
|
48634
|
+
estimatedComplexity: z113.enum(["simple", "moderate", "complex", "expert"]).optional(),
|
|
48635
|
+
estimatedTokens: z113.number().int().positive().optional(),
|
|
48636
|
+
topsisScore: z113.number().optional(),
|
|
48637
|
+
ucbScore: z113.number().optional(),
|
|
48638
|
+
resolvedAtStage: z113.number().int().nonnegative().optional(),
|
|
48639
|
+
consensusReached: z113.boolean().optional(),
|
|
48640
|
+
agreementScore: z113.number().min(0).max(1).optional(),
|
|
48641
|
+
metadata: z113.record(z113.string(), z113.unknown()).optional()
|
|
48362
48642
|
});
|
|
48363
48643
|
|
|
48364
48644
|
// src/learning/outcome-feedback-types.ts
|
|
48365
|
-
import { z as
|
|
48366
|
-
var QualitySignalsSchema =
|
|
48367
|
-
testsPass:
|
|
48368
|
-
lintErrors:
|
|
48369
|
-
userApproved:
|
|
48370
|
-
retryCount:
|
|
48371
|
-
completionRatio:
|
|
48372
|
-
validStructure:
|
|
48373
|
-
coherenceScore:
|
|
48645
|
+
import { z as z114 } from "zod";
|
|
48646
|
+
var QualitySignalsSchema = z114.object({
|
|
48647
|
+
testsPass: z114.boolean().optional(),
|
|
48648
|
+
lintErrors: z114.number().int().min(0).optional(),
|
|
48649
|
+
userApproved: z114.boolean().optional(),
|
|
48650
|
+
retryCount: z114.number().int().min(0).default(0),
|
|
48651
|
+
completionRatio: z114.number().min(0).max(1).default(1),
|
|
48652
|
+
validStructure: z114.boolean().optional(),
|
|
48653
|
+
coherenceScore: z114.number().min(0).max(1).optional()
|
|
48374
48654
|
});
|
|
48375
|
-
var RoutingDecisionSchema =
|
|
48376
|
-
id:
|
|
48377
|
-
timestamp:
|
|
48378
|
-
query:
|
|
48379
|
-
routerType:
|
|
48380
|
-
selectedModel:
|
|
48381
|
-
selectedTier:
|
|
48382
|
-
armIndex:
|
|
48383
|
-
banditContext:
|
|
48384
|
-
queryFeatures:
|
|
48385
|
-
ucbScore:
|
|
48386
|
-
confidence:
|
|
48387
|
-
traceId:
|
|
48388
|
-
domain:
|
|
48655
|
+
var RoutingDecisionSchema = z114.object({
|
|
48656
|
+
id: z114.uuid(),
|
|
48657
|
+
timestamp: z114.iso.datetime(),
|
|
48658
|
+
query: z114.string(),
|
|
48659
|
+
routerType: z114.enum(["linucb", "preference", "quality", "cascade", "topsis"]),
|
|
48660
|
+
selectedModel: z114.string(),
|
|
48661
|
+
selectedTier: z114.enum(["strong", "weak"]).optional(),
|
|
48662
|
+
armIndex: z114.number().int().min(0).optional(),
|
|
48663
|
+
banditContext: z114.record(z114.string(), z114.unknown()).optional(),
|
|
48664
|
+
queryFeatures: z114.record(z114.string(), z114.unknown()).optional(),
|
|
48665
|
+
ucbScore: z114.number().optional(),
|
|
48666
|
+
confidence: z114.number().min(0).max(1).optional(),
|
|
48667
|
+
traceId: z114.string(),
|
|
48668
|
+
domain: z114.string().optional()
|
|
48389
48669
|
});
|
|
48390
|
-
var TaskOutcomeSchema =
|
|
48391
|
-
routingDecisionId:
|
|
48392
|
-
timestamp:
|
|
48393
|
-
outcomeClass:
|
|
48394
|
-
success:
|
|
48395
|
-
qualityScore:
|
|
48396
|
-
durationMs:
|
|
48397
|
-
tokenUsage:
|
|
48398
|
-
errorMessage:
|
|
48670
|
+
var TaskOutcomeSchema = z114.object({
|
|
48671
|
+
routingDecisionId: z114.uuid(),
|
|
48672
|
+
timestamp: z114.iso.datetime(),
|
|
48673
|
+
outcomeClass: z114.enum(["success", "partial", "failure", "timeout", "error"]),
|
|
48674
|
+
success: z114.boolean(),
|
|
48675
|
+
qualityScore: z114.number().min(0).max(1),
|
|
48676
|
+
durationMs: z114.number().min(0),
|
|
48677
|
+
tokenUsage: z114.number().int().min(0),
|
|
48678
|
+
errorMessage: z114.string().optional(),
|
|
48399
48679
|
qualitySignals: QualitySignalsSchema,
|
|
48400
|
-
traceId:
|
|
48680
|
+
traceId: z114.string()
|
|
48401
48681
|
});
|
|
48402
48682
|
var DEFAULT_FEEDBACK_COLLECTOR_CONFIG = {
|
|
48403
48683
|
maxPendingDecisions: 1e3,
|
|
@@ -48412,17 +48692,17 @@ var DEFAULT_FEEDBACK_COLLECTOR_CONFIG = {
|
|
|
48412
48692
|
targetTokenUsage: 2e3,
|
|
48413
48693
|
maxHistorySize: 1e4
|
|
48414
48694
|
};
|
|
48415
|
-
var FeedbackCollectorConfigSchema =
|
|
48416
|
-
maxPendingDecisions:
|
|
48417
|
-
pendingTimeoutMs:
|
|
48418
|
-
enableAutoReward:
|
|
48419
|
-
qualityWeight:
|
|
48420
|
-
speedWeight:
|
|
48421
|
-
efficiencyWeight:
|
|
48422
|
-
retryPenalty:
|
|
48423
|
-
targetDurationMs:
|
|
48424
|
-
targetTokenUsage:
|
|
48425
|
-
maxHistorySize:
|
|
48695
|
+
var FeedbackCollectorConfigSchema = z114.object({
|
|
48696
|
+
maxPendingDecisions: z114.number().int().positive().default(1e3),
|
|
48697
|
+
pendingTimeoutMs: z114.number().positive().default(3e5),
|
|
48698
|
+
enableAutoReward: z114.boolean().default(true),
|
|
48699
|
+
qualityWeight: z114.number().min(0).max(1).default(0.5),
|
|
48700
|
+
speedWeight: z114.number().min(0).max(1).default(0.2),
|
|
48701
|
+
efficiencyWeight: z114.number().min(0).max(1).default(0.2),
|
|
48702
|
+
retryPenalty: z114.number().min(0).max(1).default(0.1),
|
|
48703
|
+
targetDurationMs: z114.number().positive().default(5e3),
|
|
48704
|
+
targetTokenUsage: z114.number().positive().default(2e3),
|
|
48705
|
+
maxHistorySize: z114.number().int().positive().default(1e4)
|
|
48426
48706
|
});
|
|
48427
48707
|
|
|
48428
48708
|
// src/learning/outcome-feedback-helpers.ts
|
|
@@ -50569,4 +50849,4 @@ export {
|
|
|
50569
50849
|
shutdownFeedbackSubscriber,
|
|
50570
50850
|
createEventBusBridge
|
|
50571
50851
|
};
|
|
50572
|
-
//# sourceMappingURL=chunk-
|
|
50852
|
+
//# sourceMappingURL=chunk-2JZ55G3X.js.map
|