nexus-agents 2.131.1 → 2.132.1
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-WREL6AH5.js → child-mcp-config-R67B2KM6.js} +4 -4
- package/dist/{chunk-K3CES6CG.js → chunk-27DRQWON.js} +7 -123
- package/dist/chunk-27DRQWON.js.map +1 -0
- package/dist/{chunk-HM77WNJG.js → chunk-2CLFX73Y.js} +2 -2
- package/dist/{chunk-4SNH5EMQ.js → chunk-4CLBJ2NA.js} +3 -3
- package/dist/{chunk-DRYU676G.js → chunk-4DLHM6LI.js} +6 -2
- package/dist/{chunk-DRYU676G.js.map → chunk-4DLHM6LI.js.map} +1 -1
- package/dist/{chunk-JPBPQN4U.js → chunk-7BONPRR2.js} +2 -2
- package/dist/{chunk-O563YLBH.js → chunk-CI5KGCX5.js} +3 -3
- package/dist/{chunk-PARI43LB.js → chunk-E4IYX7LD.js} +2 -2
- package/dist/{chunk-JSYFPXID.js → chunk-ECDJM6UB.js} +2 -2
- package/dist/{chunk-ZLQCJRYK.js → chunk-EEQVXGZ2.js} +607 -332
- package/dist/chunk-EEQVXGZ2.js.map +1 -0
- package/dist/{chunk-WUJCVZIQ.js → chunk-EFDXX5MC.js} +3 -3
- package/dist/{chunk-3P252QNW.js → chunk-FKTLAPXJ.js} +3 -3
- package/dist/{chunk-TRTCKEHS.js → chunk-GET2MTLW.js} +2 -2
- package/dist/{chunk-NINNWQ42.js → chunk-GYDO2WOR.js} +13 -5
- package/dist/{chunk-NINNWQ42.js.map → chunk-GYDO2WOR.js.map} +1 -1
- package/dist/{chunk-DEL26PXS.js → chunk-I2SW34K6.js} +403 -84
- package/dist/chunk-I2SW34K6.js.map +1 -0
- package/dist/{chunk-3TTMRJUQ.js → chunk-J435FU54.js} +6 -4
- package/dist/{chunk-3TTMRJUQ.js.map → chunk-J435FU54.js.map} +1 -1
- package/dist/{chunk-IPPWZNTH.js → chunk-K5WBFAR4.js} +4 -4
- package/dist/{chunk-KMNAZ5RC.js → chunk-MHIJSCPR.js} +446 -162
- package/dist/chunk-MHIJSCPR.js.map +1 -0
- package/dist/{chunk-STIX3VTX.js → chunk-NXTFB3HA.js} +6 -6
- package/dist/{chunk-PGGSGUO4.js → chunk-NZGNOXXW.js} +3 -2
- package/dist/{chunk-PGGSGUO4.js.map → chunk-NZGNOXXW.js.map} +1 -1
- package/dist/{chunk-PID22PMZ.js → chunk-P6FBH2UG.js} +8 -8
- package/dist/{chunk-UZWZ72X7.js → chunk-PM63X3QG.js} +3 -3
- package/dist/{chunk-4KBG4ICZ.js → chunk-QJIHSQZX.js} +790 -27
- package/dist/chunk-QJIHSQZX.js.map +1 -0
- package/dist/{chunk-HS3K2B7Q.js → chunk-QLRH6KOT.js} +2 -2
- package/dist/{chunk-DI6SRBCT.js → chunk-QMCHVYZB.js} +2 -2
- package/dist/{chunk-GVBEF6LQ.js → chunk-RAWF4JOT.js} +8 -8
- package/dist/{chunk-RF7QCPNA.js → chunk-RLYXX3FQ.js} +2 -2
- package/dist/{chunk-ZGLIHPGJ.js → chunk-RUSP5PJR.js} +9 -1
- package/dist/chunk-RUSP5PJR.js.map +1 -0
- package/dist/{chunk-FCPANF6R.js → chunk-S4U3Z6ZS.js} +9 -6
- package/dist/{chunk-FCPANF6R.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-2QFUW2SP.js → chunk-VZCQRLXT.js} +7 -7
- package/dist/{chunk-JTECUWWI.js → chunk-WHZD2W6Q.js} +2 -2
- package/dist/{chunk-BDERGLIX.js → chunk-XIFOAZ5B.js} +4 -4
- package/dist/{chunk-PR4QN5HX.js → chunk-ZPWHCABL.js} +6 -2
- package/dist/{chunk-4DJNJGIB.js → chunk-ZQEQVCIU.js} +2 -2
- package/dist/{chunk-VZ3TTUWP.js → chunk-ZTRBMKXK.js} +5 -2
- package/dist/{chunk-VZ3TTUWP.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-Y6UCDBDE.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-GRMH7WSS.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-N2KSQSNW.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-6K6QNJWF.js → init-opencode-L3NT524E.js} +8 -7
- package/dist/{init-opencode-6K6QNJWF.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-GC6DEIBT.js → pr-reviewer-helpers-PLKDVWYF.js} +6 -6
- package/dist/{registry-command-7RRDCDAU.js → registry-command-HPKNLYUL.js} +4 -4
- package/dist/{repo-analyze-JZEMBE6R.js → repo-analyze-UJOWFGNM.js} +2 -2
- package/dist/{repo-security-plan-5V43DEGA.js → repo-security-plan-HSYGGVEJ.js} +5 -5
- package/dist/research-helpers-synthesize-IQHDU27S.js +14 -0
- package/dist/{routing-memory-BQ6MUC5Y.js → routing-memory-OGUOL7UF.js} +4 -4
- package/dist/{session-memory-MJHN5FXI.js → session-memory-HQWAXH3C.js} +5 -5
- package/dist/{setup-command-YAQE2KRH.js → setup-command-MFKD5IJT.js} +13 -13
- package/dist/setup-config-HYX3BRSE.js +10 -0
- package/dist/{setup-custom-api-3JEENEKA.js → setup-custom-api-W7EDVKWR.js} +5 -5
- package/dist/{tool-memory-NKBBVA7O.js → tool-memory-Z2B7CAH7.js} +7 -7
- package/dist/unified-registry-UFNSWKZA.js +24 -0
- package/dist/{weather-report-7WC3RKE7.js → weather-report-GX7OIUL2.js} +4 -4
- package/package.json +12 -12
- package/dist/chunk-4KBG4ICZ.js.map +0 -1
- package/dist/chunk-DEL26PXS.js.map +0 -1
- package/dist/chunk-K3CES6CG.js.map +0 -1
- package/dist/chunk-KMNAZ5RC.js.map +0 -1
- package/dist/chunk-ZGLIHPGJ.js.map +0 -1
- package/dist/chunk-ZLQCJRYK.js.map +0 -1
- package/dist/cli-circuit-breaker-WLYICYAZ.js +0 -13
- package/dist/consensus-vote-PEWNN4WK.js +0 -36
- package/dist/dist-QZLOLGIK.js.map +0 -1
- package/dist/doctor-deep-HXKGXUI4.js +0 -12
- package/dist/expert-bridge-BW55FRAH.js +0 -17
- package/dist/factory-4EV6EDZF.js +0 -21
- package/dist/factory-YKXAMYW6.js +0 -14
- package/dist/issue-triage-PYHGDQHK.js +0 -16
- package/dist/research-helpers-synthesize-EDT6REQJ.js +0 -14
- package/dist/setup-config-OFC6SD7H.js +0 -10
- package/dist/unified-registry-XXAVF4AQ.js +0 -24
- /package/dist/{child-mcp-config-WREL6AH5.js.map → child-mcp-config-R67B2KM6.js.map} +0 -0
- /package/dist/{chunk-HM77WNJG.js.map → chunk-2CLFX73Y.js.map} +0 -0
- /package/dist/{chunk-4SNH5EMQ.js.map → chunk-4CLBJ2NA.js.map} +0 -0
- /package/dist/{chunk-JPBPQN4U.js.map → chunk-7BONPRR2.js.map} +0 -0
- /package/dist/{chunk-O563YLBH.js.map → chunk-CI5KGCX5.js.map} +0 -0
- /package/dist/{chunk-PARI43LB.js.map → chunk-E4IYX7LD.js.map} +0 -0
- /package/dist/{chunk-JSYFPXID.js.map → chunk-ECDJM6UB.js.map} +0 -0
- /package/dist/{chunk-WUJCVZIQ.js.map → chunk-EFDXX5MC.js.map} +0 -0
- /package/dist/{chunk-3P252QNW.js.map → chunk-FKTLAPXJ.js.map} +0 -0
- /package/dist/{chunk-TRTCKEHS.js.map → chunk-GET2MTLW.js.map} +0 -0
- /package/dist/{chunk-IPPWZNTH.js.map → chunk-K5WBFAR4.js.map} +0 -0
- /package/dist/{chunk-STIX3VTX.js.map → chunk-NXTFB3HA.js.map} +0 -0
- /package/dist/{chunk-PID22PMZ.js.map → chunk-P6FBH2UG.js.map} +0 -0
- /package/dist/{chunk-UZWZ72X7.js.map → chunk-PM63X3QG.js.map} +0 -0
- /package/dist/{chunk-HS3K2B7Q.js.map → chunk-QLRH6KOT.js.map} +0 -0
- /package/dist/{chunk-DI6SRBCT.js.map → chunk-QMCHVYZB.js.map} +0 -0
- /package/dist/{chunk-GVBEF6LQ.js.map → chunk-RAWF4JOT.js.map} +0 -0
- /package/dist/{chunk-RF7QCPNA.js.map → chunk-RLYXX3FQ.js.map} +0 -0
- /package/dist/{chunk-2QFUW2SP.js.map → chunk-VZCQRLXT.js.map} +0 -0
- /package/dist/{chunk-JTECUWWI.js.map → chunk-WHZD2W6Q.js.map} +0 -0
- /package/dist/{chunk-BDERGLIX.js.map → chunk-XIFOAZ5B.js.map} +0 -0
- /package/dist/{chunk-PR4QN5HX.js.map → chunk-ZPWHCABL.js.map} +0 -0
- /package/dist/{chunk-4DJNJGIB.js.map → chunk-ZQEQVCIU.js.map} +0 -0
- /package/dist/{cli-circuit-breaker-WLYICYAZ.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-Y6UCDBDE.js.map → composite-router-HQUSCJO4.js.map} +0 -0
- /package/dist/{consensus-vote-PEWNN4WK.js.map → consensus-vote-E2WJFEIJ.js.map} +0 -0
- /package/dist/{context-retriever-GRMH7WSS.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-HXKGXUI4.js.map → doctor-deep-HJ3NQ365.js.map} +0 -0
- /package/dist/{expert-bridge-BW55FRAH.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-4EV6EDZF.js.map → factory-KC7BYHAP.js.map} +0 -0
- /package/dist/{factory-YKXAMYW6.js.map → factory-ZG2FZYVA.js.map} +0 -0
- /package/dist/{improvement-review-N2KSQSNW.js.map → improvement-review-TDC4QH5P.js.map} +0 -0
- /package/dist/{issue-triage-PYHGDQHK.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-GC6DEIBT.js.map → pr-reviewer-helpers-PLKDVWYF.js.map} +0 -0
- /package/dist/{registry-command-7RRDCDAU.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-5V43DEGA.js.map → repo-security-plan-HSYGGVEJ.js.map} +0 -0
- /package/dist/{research-helpers-synthesize-EDT6REQJ.js.map → research-helpers-synthesize-IQHDU27S.js.map} +0 -0
- /package/dist/{routing-memory-BQ6MUC5Y.js.map → routing-memory-OGUOL7UF.js.map} +0 -0
- /package/dist/{session-memory-MJHN5FXI.js.map → session-memory-HQWAXH3C.js.map} +0 -0
- /package/dist/{setup-command-YAQE2KRH.js.map → setup-command-MFKD5IJT.js.map} +0 -0
- /package/dist/{setup-config-OFC6SD7H.js.map → setup-config-HYX3BRSE.js.map} +0 -0
- /package/dist/{setup-custom-api-3JEENEKA.js.map → setup-custom-api-W7EDVKWR.js.map} +0 -0
- /package/dist/{tool-memory-NKBBVA7O.js.map → tool-memory-Z2B7CAH7.js.map} +0 -0
- /package/dist/{unified-registry-XXAVF4AQ.js.map → unified-registry-UFNSWKZA.js.map} +0 -0
- /package/dist/{weather-report-7WC3RKE7.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-P6FBH2UG.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) {
|
|
@@ -40001,9 +40021,58 @@ var AuditCategorySchema = z85.enum([
|
|
|
40001
40021
|
// Settings changes
|
|
40002
40022
|
"security",
|
|
40003
40023
|
// Security events, violations
|
|
40004
|
-
"system"
|
|
40024
|
+
"system",
|
|
40005
40025
|
// System events, startup, shutdown
|
|
40026
|
+
"governance"
|
|
40027
|
+
// Authority-tier transitions, ratification (Epic D, #3842)
|
|
40006
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();
|
|
40007
40076
|
var AuditSeveritySchema = z85.enum([
|
|
40008
40077
|
"info",
|
|
40009
40078
|
// Normal operations
|
|
@@ -40076,9 +40145,19 @@ var AuditEventSchema = z85.object({
|
|
|
40076
40145
|
// Integrity (for tamper-evidence)
|
|
40077
40146
|
previousHash: z85.string().optional(),
|
|
40078
40147
|
// Hash of previous event (chain)
|
|
40079
|
-
hash: z85.string().optional()
|
|
40148
|
+
hash: z85.string().optional(),
|
|
40080
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()
|
|
40081
40159
|
});
|
|
40160
|
+
var AUDIT_HASH_VERSION_TIER_TRANSITION = 2;
|
|
40082
40161
|
var AuditEventInputSchema = z85.object({
|
|
40083
40162
|
category: AuditCategorySchema,
|
|
40084
40163
|
severity: AuditSeveritySchema.optional().default("info"),
|
|
@@ -40445,13 +40524,33 @@ var FileAuditStorage = class _FileAuditStorage {
|
|
|
40445
40524
|
|
|
40446
40525
|
// src/audit/audit-logger.ts
|
|
40447
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
|
|
40448
40547
|
function generateEventId() {
|
|
40449
40548
|
const timestamp = getTimeProvider().now().toString(36);
|
|
40450
40549
|
const random = crypto.randomBytes(6).toString("hex");
|
|
40451
40550
|
return `aud_${timestamp}_${random}`;
|
|
40452
40551
|
}
|
|
40453
40552
|
function computeEventHash(event) {
|
|
40454
|
-
const
|
|
40553
|
+
const projection = {
|
|
40455
40554
|
id: event.id,
|
|
40456
40555
|
timestamp: event.timestamp,
|
|
40457
40556
|
category: event.category,
|
|
@@ -40459,8 +40558,13 @@ function computeEventHash(event) {
|
|
|
40459
40558
|
outcome: event.outcome,
|
|
40460
40559
|
actor: event.actor,
|
|
40461
40560
|
previousHash: event.previousHash
|
|
40462
|
-
}
|
|
40463
|
-
|
|
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");
|
|
40464
40568
|
}
|
|
40465
40569
|
function verifyEvent(event, index, priorHash) {
|
|
40466
40570
|
if (event.hash === void 0) {
|
|
@@ -40526,7 +40630,9 @@ var AuditLogger = class {
|
|
|
40526
40630
|
closed = false;
|
|
40527
40631
|
inFlightFlush = null;
|
|
40528
40632
|
droppedEventCount = 0;
|
|
40529
|
-
|
|
40633
|
+
persistFailureCount = 0;
|
|
40634
|
+
onPersistFailure;
|
|
40635
|
+
constructor(config, storage, logger57, onPersistFailure) {
|
|
40530
40636
|
const validated = AuditLogConfigSchema.safeParse(config);
|
|
40531
40637
|
if (!validated.success) {
|
|
40532
40638
|
const issues = validated.error.issues.map((i) => i.path.join(".") + ": " + i.message).join("; ");
|
|
@@ -40539,16 +40645,53 @@ var AuditLogger = class {
|
|
|
40539
40645
|
this.flushIntervalMs = validated.data.flushIntervalMs;
|
|
40540
40646
|
this.maxQueueDepth = validated.data.maxQueueDepth;
|
|
40541
40647
|
this.storage = storage ?? new FileAuditStorage(validated.data, this.logger);
|
|
40648
|
+
this.onPersistFailure = onPersistFailure;
|
|
40542
40649
|
this.startFlushTimer();
|
|
40543
40650
|
this.logger.info("AuditLogger initialized", { logDir: config.logDir });
|
|
40544
40651
|
}
|
|
40545
40652
|
startFlushTimer() {
|
|
40546
40653
|
this.flushTimer = setInterval(() => {
|
|
40547
|
-
this.flush().catch((
|
|
40548
|
-
this.logger.error("Audit flush failed", err2 instanceof Error ? err2 : void 0);
|
|
40654
|
+
this.flush().catch(() => {
|
|
40549
40655
|
});
|
|
40550
40656
|
}, this.flushIntervalMs);
|
|
40551
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
|
+
}
|
|
40552
40695
|
shouldLog(input) {
|
|
40553
40696
|
const severityLevels = { info: 0, warning: 1, critical: 2 };
|
|
40554
40697
|
const inputLevel = severityLevels[input.severity];
|
|
@@ -40582,6 +40725,7 @@ var AuditLogger = class {
|
|
|
40582
40725
|
violationType: input.violationType,
|
|
40583
40726
|
previousHash: this.enableHashChain ? this.lastHash ?? void 0 : void 0
|
|
40584
40727
|
};
|
|
40728
|
+
if (isTierTransitionEvent(event)) event.hashVersion = AUDIT_HASH_VERSION_TIER_TRANSITION;
|
|
40585
40729
|
if (this.enableHashChain) {
|
|
40586
40730
|
event.hash = computeEventHash(event);
|
|
40587
40731
|
this.lastHash = event.hash;
|
|
@@ -40672,6 +40816,42 @@ var AuditLogger = class {
|
|
|
40672
40816
|
metadata: { currentRate: opts.currentRate, limitRate: opts.limitRate }
|
|
40673
40817
|
});
|
|
40674
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
|
+
}
|
|
40675
40855
|
/** Log system startup event */
|
|
40676
40856
|
logSystemStartup(metadata) {
|
|
40677
40857
|
this.log({
|
|
@@ -40715,7 +40895,10 @@ var AuditLogger = class {
|
|
|
40715
40895
|
*/
|
|
40716
40896
|
async flush() {
|
|
40717
40897
|
if (this.inFlightFlush !== null) return this.inFlightFlush;
|
|
40718
|
-
const drain = this.drainAndFlushOnce().
|
|
40898
|
+
const drain = this.drainAndFlushOnce().catch((err2) => {
|
|
40899
|
+
this.recordPersistFailure(err2);
|
|
40900
|
+
throw err2;
|
|
40901
|
+
}).finally(() => {
|
|
40719
40902
|
this.inFlightFlush = null;
|
|
40720
40903
|
});
|
|
40721
40904
|
this.inFlightFlush = drain;
|
|
@@ -40733,8 +40916,8 @@ var AuditLogger = class {
|
|
|
40733
40916
|
this.logger.info("AuditLogger closed");
|
|
40734
40917
|
}
|
|
40735
40918
|
};
|
|
40736
|
-
function createAuditLogger(config, storage, logger57) {
|
|
40737
|
-
return new AuditLogger(config, storage, logger57);
|
|
40919
|
+
function createAuditLogger(config, storage, logger57, onPersistFailure) {
|
|
40920
|
+
return new AuditLogger(config, storage, logger57, onPersistFailure);
|
|
40738
40921
|
}
|
|
40739
40922
|
|
|
40740
40923
|
// src/pipeline/research-trigger.ts
|
|
@@ -41204,7 +41387,7 @@ async function tryIssueTriage(task) {
|
|
|
41204
41387
|
try {
|
|
41205
41388
|
const issueMatch = task.match(/github\.com\/([^/]+\/[^/]+)\/issues\/(\d+)/);
|
|
41206
41389
|
if (issueMatch === null) return null;
|
|
41207
|
-
const { createIssueTriage } = await import("./issue-triage-
|
|
41390
|
+
const { createIssueTriage } = await import("./issue-triage-CZPFNGB7.js");
|
|
41208
41391
|
const triage = createIssueTriage();
|
|
41209
41392
|
const owner = issueMatch[1] ?? "";
|
|
41210
41393
|
const num = issueMatch[2] ?? "";
|
|
@@ -41232,7 +41415,7 @@ var VALID_TEMPLATES = /* @__PURE__ */ new Set([
|
|
|
41232
41415
|
]);
|
|
41233
41416
|
async function classifyWithLLM(task) {
|
|
41234
41417
|
try {
|
|
41235
|
-
const { executeExpert: executeExpert2 } = await import("./expert-bridge-
|
|
41418
|
+
const { executeExpert: executeExpert2 } = await import("./expert-bridge-MINXBC73.js");
|
|
41236
41419
|
const prompt = [
|
|
41237
41420
|
"Classify this task into exactly one pipeline template.",
|
|
41238
41421
|
"Templates: dev (implementation/bug fix/refactor), research (investigate/evaluate/compare),",
|
|
@@ -42998,8 +43181,8 @@ var memoryInitPromise = null;
|
|
|
42998
43181
|
async function initPipelineMemory() {
|
|
42999
43182
|
if (cachedMemory !== null) return cachedMemory;
|
|
43000
43183
|
try {
|
|
43001
|
-
const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-
|
|
43002
|
-
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");
|
|
43003
43186
|
const mem = createSessionMemory2(getLearningDir());
|
|
43004
43187
|
mem.startSession(`pipeline-${String(getTimeProvider().now())}`);
|
|
43005
43188
|
cachedMemory = {
|
|
@@ -43060,7 +43243,7 @@ function recordRoutingExperience(category, success, durationMs, tokensUsed = 0,
|
|
|
43060
43243
|
callRecord(routingMemoryCache);
|
|
43061
43244
|
return;
|
|
43062
43245
|
}
|
|
43063
|
-
routingMemoryInitPromise ??= import("./routing-memory-
|
|
43246
|
+
routingMemoryInitPromise ??= import("./routing-memory-OGUOL7UF.js").then(({ createRoutingMemory }) => {
|
|
43064
43247
|
routingMemoryCache ??= createRoutingMemory();
|
|
43065
43248
|
return routingMemoryCache;
|
|
43066
43249
|
}).catch((error) => {
|
|
@@ -43094,7 +43277,7 @@ ${text}` : "";
|
|
|
43094
43277
|
}
|
|
43095
43278
|
async function getWeatherContext() {
|
|
43096
43279
|
try {
|
|
43097
|
-
const { generateWeatherReport: generateWeatherReport2 } = await import("./weather-report-
|
|
43280
|
+
const { generateWeatherReport: generateWeatherReport2 } = await import("./weather-report-GX7OIUL2.js");
|
|
43098
43281
|
const report = generateWeatherReport2({ includeAdaptive: true });
|
|
43099
43282
|
const mappings = "recommendedMappings" in report ? report.recommendedMappings : [];
|
|
43100
43283
|
if (!Array.isArray(mappings) || mappings.length === 0) return "";
|
|
@@ -43112,8 +43295,8 @@ ${lines}
|
|
|
43112
43295
|
}
|
|
43113
43296
|
async function getMemoryContext(task) {
|
|
43114
43297
|
try {
|
|
43115
|
-
const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-
|
|
43116
|
-
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");
|
|
43117
43300
|
const memory = createSessionMemory2(getLearningDir(), { maxLearningsInContext: 10 });
|
|
43118
43301
|
const learnings = memory.searchLearnings(task.slice(0, 200));
|
|
43119
43302
|
if (learnings.length === 0) return "";
|
|
@@ -43224,7 +43407,7 @@ ${contextBlock}`;
|
|
|
43224
43407
|
const strategy = config.votingStrategy ?? "higher_order";
|
|
43225
43408
|
await postProgress(config, "Vote", `Running consensus with ${strategy} strategy...`);
|
|
43226
43409
|
try {
|
|
43227
|
-
const { executeVoting } = await import("./consensus-vote-
|
|
43410
|
+
const { executeVoting } = await import("./consensus-vote-E2WJFEIJ.js");
|
|
43228
43411
|
const votingResult = await executeVoting(
|
|
43229
43412
|
{
|
|
43230
43413
|
proposal: buildVoteProposal(plan, research),
|
|
@@ -43646,7 +43829,7 @@ function createScaffoldStageWrapper() {
|
|
|
43646
43829
|
}
|
|
43647
43830
|
async function searchCodebaseForTask(task) {
|
|
43648
43831
|
try {
|
|
43649
|
-
const { CodebaseIndex: CodebaseIndex2 } = await import("./codebase-search-
|
|
43832
|
+
const { CodebaseIndex: CodebaseIndex2 } = await import("./codebase-search-PWMWLU7O.js");
|
|
43650
43833
|
const index = new CodebaseIndex2(process.cwd());
|
|
43651
43834
|
const terms = task.toLowerCase().split(/\s+/).filter((w) => w.length > 4).slice(0, 3);
|
|
43652
43835
|
if (terms.length === 0) return null;
|
|
@@ -43661,7 +43844,7 @@ async function searchCodebaseForTask(task) {
|
|
|
43661
43844
|
}
|
|
43662
43845
|
async function queryResearchRegistry(task) {
|
|
43663
43846
|
try {
|
|
43664
|
-
const { synthesizeResearch: synthesizeResearch2 } = await import("./research-helpers-synthesize-
|
|
43847
|
+
const { synthesizeResearch: synthesizeResearch2 } = await import("./research-helpers-synthesize-IQHDU27S.js");
|
|
43665
43848
|
const topic = task.split(/[.!?\n]/).filter((s) => s.trim().length > 10)[0]?.trim();
|
|
43666
43849
|
if (topic === void 0) return null;
|
|
43667
43850
|
const result = await synthesizeResearch2(topic.slice(0, 50));
|
|
@@ -43713,7 +43896,7 @@ function createAnalyzeStageWrapper() {
|
|
|
43713
43896
|
true
|
|
43714
43897
|
);
|
|
43715
43898
|
}
|
|
43716
|
-
const { analyzeGitHubRepo: analyzeGitHubRepo2 } = await import("./repo-analyze-
|
|
43899
|
+
const { analyzeGitHubRepo: analyzeGitHubRepo2 } = await import("./repo-analyze-UJOWFGNM.js");
|
|
43717
43900
|
const analysis = await analyzeGitHubRepo2({ repo: slug, depth: "deep" });
|
|
43718
43901
|
const summary = `Language: ${String(analysis.language)}, Framework: ${String(analysis.framework)}, CI: ${String(analysis.ciProvider)}, Security: ${analysis.securityTooling.join(", ") || "none"}`;
|
|
43719
43902
|
return output(PIPELINE_STATE_KEYS.RESEARCH, summary, getTimeProvider().now() - start, true);
|
|
@@ -43732,7 +43915,7 @@ function createScanStageWrapper() {
|
|
|
43732
43915
|
try {
|
|
43733
43916
|
const slug = ctx.task.match(/([a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+)/)?.[1];
|
|
43734
43917
|
if (slug !== void 0) {
|
|
43735
|
-
const { generateSecurityPlan: generateSecurityPlan2 } = await import("./repo-security-plan-
|
|
43918
|
+
const { generateSecurityPlan: generateSecurityPlan2 } = await import("./repo-security-plan-HSYGGVEJ.js");
|
|
43736
43919
|
const plan = await generateSecurityPlan2({ repo: slug, maxScanners: 10 });
|
|
43737
43920
|
const recs = plan.recommendations.slice(0, 5).map((r) => `${r.priority}: ${r.displayName} (${r.category})`).join("; ");
|
|
43738
43921
|
return output(PIPELINE_STATE_KEYS.FINDINGS, recs, getTimeProvider().now() - start, true);
|
|
@@ -44002,12 +44185,25 @@ async function executePrReviewBody(input, logger57) {
|
|
|
44002
44185
|
const reviews = voteResults.map(toPrReviewVote);
|
|
44003
44186
|
const counts = summarizeReviews(reviews);
|
|
44004
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
|
+
}
|
|
44005
44200
|
const response = {
|
|
44006
44201
|
summary: aggregate.decision,
|
|
44007
44202
|
verified: aggregate.verified,
|
|
44008
44203
|
...counts,
|
|
44009
44204
|
reviews,
|
|
44010
|
-
totalDurationMs: Date.now() - start
|
|
44205
|
+
totalDurationMs: Date.now() - start,
|
|
44206
|
+
...costSummary !== void 0 ? { costSummary } : {}
|
|
44011
44207
|
};
|
|
44012
44208
|
return toolSuccess(JSON.stringify(response, null, 2));
|
|
44013
44209
|
}
|
|
@@ -45296,103 +45492,50 @@ import { randomUUID as randomUUID17 } from "crypto";
|
|
|
45296
45492
|
|
|
45297
45493
|
// src/orchestration/meta-orchestrator.ts
|
|
45298
45494
|
import { randomUUID as randomUUID14 } from "crypto";
|
|
45299
|
-
|
|
45300
|
-
|
|
45301
|
-
|
|
45302
|
-
|
|
45303
|
-
|
|
45304
|
-
};
|
|
45305
|
-
}
|
|
45306
|
-
function strategyFromPattern(pattern, complexity) {
|
|
45307
|
-
switch (pattern) {
|
|
45308
|
-
case "consensus":
|
|
45309
|
-
return "consensus";
|
|
45310
|
-
case "graph":
|
|
45311
|
-
return "graph-workflow";
|
|
45312
|
-
case "wave":
|
|
45313
|
-
case "aflow":
|
|
45314
|
-
case "puppeteer":
|
|
45315
|
-
return "orchestrate";
|
|
45316
|
-
case "sequential":
|
|
45317
|
-
return complexity === "simple" ? "single-shot" : "dev-pipeline";
|
|
45318
|
-
default: {
|
|
45319
|
-
const _exhaustive = pattern;
|
|
45320
|
-
return _exhaustive;
|
|
45321
|
-
}
|
|
45322
|
-
}
|
|
45323
|
-
}
|
|
45324
|
-
function strategyFromPipelineType(pipelineType) {
|
|
45325
|
-
switch (pipelineType) {
|
|
45326
|
-
case "greenfield":
|
|
45327
|
-
return "spec";
|
|
45328
|
-
case "research":
|
|
45329
|
-
return "research";
|
|
45330
|
-
case "audit":
|
|
45331
|
-
return "pipeline";
|
|
45332
|
-
case "dev":
|
|
45333
|
-
return "dev-pipeline";
|
|
45334
|
-
case "general":
|
|
45335
|
-
return "pipeline";
|
|
45336
|
-
default: {
|
|
45337
|
-
const _exhaustive = pipelineType;
|
|
45338
|
-
return _exhaustive;
|
|
45339
|
-
}
|
|
45340
|
-
}
|
|
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})`;
|
|
45341
45501
|
}
|
|
45342
45502
|
function decideStrategy(routing, classification) {
|
|
45343
45503
|
const { pattern, analysis } = routing;
|
|
45344
45504
|
const { pipelineType } = classification;
|
|
45345
|
-
|
|
45346
|
-
|
|
45347
|
-
|
|
45348
|
-
|
|
45349
|
-
|
|
45350
|
-
|
|
45351
|
-
|
|
45352
|
-
if (pipelineType === "greenfield") {
|
|
45353
|
-
return {
|
|
45354
|
-
strategy: "spec",
|
|
45355
|
-
reasoning: "Greenfield work detected \u2014 routing to a spec-driven build",
|
|
45356
|
-
confidence: classification.confidence
|
|
45357
|
-
};
|
|
45358
|
-
}
|
|
45359
|
-
if (pipelineType === "research") {
|
|
45360
|
-
return {
|
|
45361
|
-
strategy: "research",
|
|
45362
|
-
reasoning: "Research-heavy work detected \u2014 routing to the research pipeline",
|
|
45363
|
-
confidence: classification.confidence
|
|
45364
|
-
};
|
|
45365
|
-
}
|
|
45366
|
-
const patternStrategy = strategyFromPattern(pattern, analysis.complexity);
|
|
45367
|
-
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";
|
|
45368
45512
|
return {
|
|
45369
|
-
strategy:
|
|
45370
|
-
reasoning:
|
|
45371
|
-
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
|
|
45372
45518
|
};
|
|
45373
45519
|
}
|
|
45520
|
+
const fromTemplate = selection.rule.pipelineTypes !== void 0;
|
|
45374
45521
|
return {
|
|
45375
|
-
strategy:
|
|
45376
|
-
reasoning:
|
|
45377
|
-
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
|
|
45378
45527
|
};
|
|
45379
45528
|
}
|
|
45380
45529
|
function buildAlternatives(chosen, routing, classification) {
|
|
45381
|
-
const
|
|
45382
|
-
|
|
45383
|
-
|
|
45384
|
-
|
|
45385
|
-
|
|
45386
|
-
|
|
45387
|
-
const alternatives = [];
|
|
45388
|
-
for (const c of candidates) {
|
|
45389
|
-
if (!seen.has(c)) {
|
|
45390
|
-
seen.add(c);
|
|
45391
|
-
alternatives.push(c);
|
|
45392
|
-
}
|
|
45393
|
-
}
|
|
45394
|
-
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);
|
|
45395
45536
|
}
|
|
45537
|
+
|
|
45538
|
+
// src/orchestration/meta-orchestrator-decision.ts
|
|
45396
45539
|
function subSignals(routing, classification) {
|
|
45397
45540
|
return {
|
|
45398
45541
|
pattern: routing.pattern,
|
|
@@ -45402,12 +45545,15 @@ function subSignals(routing, classification) {
|
|
|
45402
45545
|
};
|
|
45403
45546
|
}
|
|
45404
45547
|
function buildForcedDecision(forced, routing, classification) {
|
|
45548
|
+
const manifest = getStrategyManifest(forced);
|
|
45405
45549
|
return {
|
|
45406
45550
|
strategy: forced,
|
|
45407
|
-
reasoning: `Strategy forced by caller: ${forced}`,
|
|
45551
|
+
reasoning: `Strategy forced by caller: ${forced} (entrypoint ${entrypointToolFor(forced)})`,
|
|
45408
45552
|
confidence: 1,
|
|
45409
45553
|
alternatives: buildAlternatives(forced, routing, classification),
|
|
45410
45554
|
needsShaping: false,
|
|
45555
|
+
manifestId: manifest?.id ?? forced,
|
|
45556
|
+
manifestSchemaVersion: manifest?.schemaVersion ?? 0,
|
|
45411
45557
|
...subSignals(routing, classification)
|
|
45412
45558
|
};
|
|
45413
45559
|
}
|
|
@@ -45420,6 +45566,8 @@ function buildSelectedDecision(routing, classification) {
|
|
|
45420
45566
|
confidence: core.confidence,
|
|
45421
45567
|
alternatives: buildAlternatives(core.strategy, routing, classification),
|
|
45422
45568
|
needsShaping,
|
|
45569
|
+
manifestId: core.manifestId,
|
|
45570
|
+
manifestSchemaVersion: core.manifestSchemaVersion,
|
|
45423
45571
|
...needsShaping && routing.suggestedQuestions !== void 0 ? { shapingQuestions: routing.suggestedQuestions } : {},
|
|
45424
45572
|
...subSignals(routing, classification)
|
|
45425
45573
|
};
|
|
@@ -45435,7 +45583,88 @@ function toRecord(decision, goal, forced, timestamp) {
|
|
|
45435
45583
|
pipelineType: decision.pipelineType,
|
|
45436
45584
|
alternatives: decision.alternatives,
|
|
45437
45585
|
needsShaping: decision.needsShaping,
|
|
45438
|
-
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
|
+
}
|
|
45439
45668
|
};
|
|
45440
45669
|
}
|
|
45441
45670
|
function recordShadow(shadowSelector, shadowSink, decision, timestamp, logger57) {
|
|
@@ -45454,6 +45683,19 @@ function recordShadow(shadowSelector, shadowSink, decision, timestamp, logger57)
|
|
|
45454
45683
|
logger57.warn("Shadow selection failed (non-fatal)", { error: getErrorMessage(err2) });
|
|
45455
45684
|
}
|
|
45456
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
|
+
}
|
|
45457
45699
|
function createMetaOrchestrator(options) {
|
|
45458
45700
|
const logger57 = options?.logger ?? createLogger({ component: "MetaOrchestrator" });
|
|
45459
45701
|
const router = options?.router ?? createWorkflowRouter({ logger: logger57 });
|
|
@@ -45469,6 +45711,9 @@ function createMetaOrchestrator(options) {
|
|
|
45469
45711
|
const forced = input.forceStrategy !== void 0;
|
|
45470
45712
|
const base = input.forceStrategy !== void 0 ? buildForcedDecision(input.forceStrategy, routing, classification) : buildSelectedDecision(routing, classification);
|
|
45471
45713
|
const decision = { ...base, decisionId: randomUUID14() };
|
|
45714
|
+
if (input.requiredAuthority !== void 0) {
|
|
45715
|
+
guardAuthority(decision.strategy, input.requiredAuthority);
|
|
45716
|
+
}
|
|
45472
45717
|
const timestamp = new Date(getTimeProvider().now()).toISOString();
|
|
45473
45718
|
sink.record(toRecord(decision, input.goal, forced, timestamp));
|
|
45474
45719
|
if (shadowSelector !== void 0 && shadowSink !== void 0) {
|
|
@@ -45480,15 +45725,7 @@ function createMetaOrchestrator(options) {
|
|
|
45480
45725
|
decisionId: decision.decisionId
|
|
45481
45726
|
});
|
|
45482
45727
|
}
|
|
45483
|
-
logger57
|
|
45484
|
-
decisionId: decision.decisionId,
|
|
45485
|
-
strategy: decision.strategy,
|
|
45486
|
-
confidence: decision.confidence,
|
|
45487
|
-
pattern: decision.pattern,
|
|
45488
|
-
pipelineType: decision.pipelineType,
|
|
45489
|
-
needsShaping: decision.needsShaping,
|
|
45490
|
-
forced
|
|
45491
|
-
});
|
|
45728
|
+
logSelection(logger57, decision, forced);
|
|
45492
45729
|
return decision;
|
|
45493
45730
|
}
|
|
45494
45731
|
};
|
|
@@ -45780,10 +46017,11 @@ var GitHubTaskTracker = class {
|
|
|
45780
46017
|
constructor(config) {
|
|
45781
46018
|
this.config = config;
|
|
45782
46019
|
}
|
|
46020
|
+
config;
|
|
45783
46021
|
cachedProvider = null;
|
|
45784
46022
|
async getProvider() {
|
|
45785
46023
|
if (this.cachedProvider !== null) return this.cachedProvider;
|
|
45786
|
-
const { createScmProvider } = await import("./factory-
|
|
46024
|
+
const { createScmProvider } = await import("./factory-ZG2FZYVA.js");
|
|
45787
46025
|
const result = await createScmProvider({ repo: this.config.repo ?? "" });
|
|
45788
46026
|
if (!result.ok) throw new Error(`SCM provider error: ${result.error.message}`);
|
|
45789
46027
|
this.cachedProvider = result.value;
|
|
@@ -45812,6 +46050,7 @@ var GitLabTaskTracker = class {
|
|
|
45812
46050
|
constructor(config) {
|
|
45813
46051
|
this.config = config;
|
|
45814
46052
|
}
|
|
46053
|
+
config;
|
|
45815
46054
|
async createTask(title, body) {
|
|
45816
46055
|
const repo = this.config.repo;
|
|
45817
46056
|
if (repo === void 0) throw new Error("GitLab backend requires repo config");
|
|
@@ -46320,16 +46559,6 @@ function registerPipelineTool(server, deps) {
|
|
|
46320
46559
|
}
|
|
46321
46560
|
|
|
46322
46561
|
// src/mcp/tools/run-tool.ts
|
|
46323
|
-
var STRATEGY_ENTRYPOINT_TOOL = {
|
|
46324
|
-
"single-shot": "delegate_to_model",
|
|
46325
|
-
"dev-pipeline": "run_dev_pipeline",
|
|
46326
|
-
pipeline: "run_pipeline",
|
|
46327
|
-
"graph-workflow": "run_graph_workflow",
|
|
46328
|
-
orchestrate: "orchestrate",
|
|
46329
|
-
consensus: "consensus_vote",
|
|
46330
|
-
spec: "execute_spec",
|
|
46331
|
-
research: "run_pipeline"
|
|
46332
|
-
};
|
|
46333
46562
|
var RunInputSchema = z104.object({
|
|
46334
46563
|
goal: z104.string().min(1).describe("Natural-language goal. nexus-agents selects how to execute it."),
|
|
46335
46564
|
forceStrategy: z104.enum([
|
|
@@ -46363,7 +46592,7 @@ var RunInputSchema = z104.object({
|
|
|
46363
46592
|
)
|
|
46364
46593
|
});
|
|
46365
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.";
|
|
46366
|
-
function toMetaInput(input) {
|
|
46595
|
+
function toMetaInput(input, mode) {
|
|
46367
46596
|
const signals = {};
|
|
46368
46597
|
if (input.requiresConsensus !== void 0) signals.requiresConsensus = input.requiresConsensus;
|
|
46369
46598
|
if (input.dependencyStructure !== void 0)
|
|
@@ -46371,20 +46600,21 @@ function toMetaInput(input) {
|
|
|
46371
46600
|
if (input.isNovel !== void 0) signals.isNovel = input.isNovel;
|
|
46372
46601
|
return {
|
|
46373
46602
|
goal: input.goal,
|
|
46603
|
+
requiredAuthority: dispatchActionClass(mode),
|
|
46374
46604
|
...Object.keys(signals).length > 0 ? { signals } : {},
|
|
46375
46605
|
...input.forceStrategy !== void 0 ? { forceStrategy: input.forceStrategy } : {}
|
|
46376
46606
|
};
|
|
46377
46607
|
}
|
|
46378
|
-
function selectDecision(input, logger57) {
|
|
46608
|
+
function selectDecision(input, mode, logger57) {
|
|
46379
46609
|
const meta = createMetaOrchestrator({
|
|
46380
46610
|
...logger57 !== void 0 ? { logger: logger57 } : {},
|
|
46381
46611
|
shadowSelector: getShadowSelector(),
|
|
46382
46612
|
shadowSink: getShadowSink()
|
|
46383
46613
|
});
|
|
46384
|
-
return meta.select(toMetaInput(input));
|
|
46614
|
+
return meta.select(toMetaInput(input, mode));
|
|
46385
46615
|
}
|
|
46386
46616
|
function routeGoal(input, logger57) {
|
|
46387
|
-
const decision = selectDecision(input, logger57);
|
|
46617
|
+
const decision = selectDecision(input, "route", logger57);
|
|
46388
46618
|
return {
|
|
46389
46619
|
strategy: decision.strategy,
|
|
46390
46620
|
reasoning: decision.reasoning,
|
|
@@ -46392,7 +46622,7 @@ function routeGoal(input, logger57) {
|
|
|
46392
46622
|
alternatives: decision.alternatives,
|
|
46393
46623
|
needsShaping: decision.needsShaping,
|
|
46394
46624
|
...decision.shapingQuestions !== void 0 ? { shapingQuestions: decision.shapingQuestions } : {},
|
|
46395
|
-
recommendedTool:
|
|
46625
|
+
recommendedTool: entrypointToolFor(decision.strategy),
|
|
46396
46626
|
decisionId: decision.decisionId,
|
|
46397
46627
|
note: NOTE
|
|
46398
46628
|
};
|
|
@@ -46424,7 +46654,7 @@ function buildShadowTrainObserver(logger57) {
|
|
|
46424
46654
|
};
|
|
46425
46655
|
}
|
|
46426
46656
|
async function executeGoal(input, opts = {}) {
|
|
46427
|
-
const decision = selectDecision(input, opts.logger);
|
|
46657
|
+
const decision = selectDecision(input, "execute", opts.logger);
|
|
46428
46658
|
const onOutcome = opts.onOutcome ?? buildShadowTrainObserver(opts.logger);
|
|
46429
46659
|
const dispatcher = createMetaDispatcher({
|
|
46430
46660
|
executors: opts.executors ?? buildDefaultExecutors(opts.trustTier),
|
|
@@ -46432,7 +46662,7 @@ async function executeGoal(input, opts = {}) {
|
|
|
46432
46662
|
...opts.outcomeSink !== void 0 ? { outcomeSink: opts.outcomeSink } : {},
|
|
46433
46663
|
...onOutcome !== void 0 ? { onOutcome } : {}
|
|
46434
46664
|
});
|
|
46435
|
-
const dispatch = await dispatcher.dispatch(decision, toMetaInput(input));
|
|
46665
|
+
const dispatch = await dispatcher.dispatch(decision, toMetaInput(input, "execute"));
|
|
46436
46666
|
return {
|
|
46437
46667
|
strategy: dispatch.strategy,
|
|
46438
46668
|
decisionId: dispatch.decisionId,
|
|
@@ -46456,8 +46686,9 @@ async function executeRunBody(input, logger57, trustTier) {
|
|
|
46456
46686
|
return toolSuccess(JSON.stringify(exec2, null, 2));
|
|
46457
46687
|
} catch (err2) {
|
|
46458
46688
|
const noExecutor = err2 instanceof MetaDispatchError && err2.code === "no_executor";
|
|
46689
|
+
const refused = err2 instanceof AuthorityRefusalError;
|
|
46459
46690
|
return toolStructuredError({
|
|
46460
|
-
errorCategory: noExecutor ? "business" : "internal",
|
|
46691
|
+
errorCategory: noExecutor || refused ? "business" : "internal",
|
|
46461
46692
|
message: err2 instanceof Error ? err2.message : String(err2)
|
|
46462
46693
|
});
|
|
46463
46694
|
}
|
|
@@ -46555,7 +46786,7 @@ async function probeSource(source, includeModelIds) {
|
|
|
46555
46786
|
}
|
|
46556
46787
|
}
|
|
46557
46788
|
async function defaultSources(includeOpenRouter) {
|
|
46558
|
-
const { createAllAdapters: createAllAdapters2 } = await import("./factory-
|
|
46789
|
+
const { createAllAdapters: createAllAdapters2 } = await import("./factory-KC7BYHAP.js");
|
|
46559
46790
|
const adapters = createAllAdapters2();
|
|
46560
46791
|
return buildDefaultModelSources(adapters, { includeOpenRouter });
|
|
46561
46792
|
}
|
|
@@ -46611,8 +46842,52 @@ function registerListAvailableModelsTool(server, deps) {
|
|
|
46611
46842
|
logger57.info("Registered list_available_models tool");
|
|
46612
46843
|
}
|
|
46613
46844
|
|
|
46614
|
-
// src/mcp/tools/
|
|
46845
|
+
// src/mcp/tools/pr-review-eval-types.ts
|
|
46615
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";
|
|
46616
46891
|
import { randomUUID as randomUUID18 } from "crypto";
|
|
46617
46892
|
var DEFAULT_AXES = [
|
|
46618
46893
|
"build_time_determinism",
|
|
@@ -46634,16 +46909,16 @@ var FULL_PANEL = [
|
|
|
46634
46909
|
"scope_steward"
|
|
46635
46910
|
];
|
|
46636
46911
|
var QUICK_PANEL = ["architect", "security", "scope_steward"];
|
|
46637
|
-
var SupplyChainTradeoffPanelInputSchema =
|
|
46638
|
-
proposal:
|
|
46639
|
-
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(
|
|
46640
46915
|
`Tradeoff axes to evaluate. Default: ${DEFAULT_AXES.join(", ")}. Custom axes accepted; max ${String(MAX_AXES)}.`
|
|
46641
46916
|
),
|
|
46642
|
-
context:
|
|
46917
|
+
context: z107.string().max(MAX_CONTEXT_LENGTH).optional().describe(
|
|
46643
46918
|
"Optional context: relevant repo state, dependency tree, vendor publishing patterns, etc."
|
|
46644
46919
|
),
|
|
46645
|
-
quickMode:
|
|
46646
|
-
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)"),
|
|
46647
46922
|
/**
|
|
46648
46923
|
* Dispatch mode (#3731). `sync` (default) runs the panel inline and returns
|
|
46649
46924
|
* the result — but a live fan-out (up to 7 voters) can exceed the MCP request
|
|
@@ -46651,7 +46926,7 @@ var SupplyChainTradeoffPanelInputSchema = z106.object({
|
|
|
46651
46926
|
* immediately and runs the panel in the background; poll
|
|
46652
46927
|
* `get_job_result({ jobId })` for the result.
|
|
46653
46928
|
*/
|
|
46654
|
-
dispatch:
|
|
46929
|
+
dispatch: z107.enum(["sync", "async"]).default("sync").describe(
|
|
46655
46930
|
"Dispatch mode (#3731). 'sync' (default): run inline. 'async': return a jobId immediately + run the panel in background (poll get_job_result)."
|
|
46656
46931
|
)
|
|
46657
46932
|
});
|
|
@@ -47118,40 +47393,40 @@ var RiskLevel = /* @__PURE__ */ ((RiskLevel2) => {
|
|
|
47118
47393
|
})(RiskLevel || {});
|
|
47119
47394
|
|
|
47120
47395
|
// src/mcp/safety/stpa-schemas.ts
|
|
47121
|
-
import { z as
|
|
47122
|
-
var HazardCategorySchema =
|
|
47123
|
-
var HazardSeveritySchema =
|
|
47124
|
-
var ConstraintPrioritySchema =
|
|
47125
|
-
var RiskLevelSchema =
|
|
47126
|
-
var TriggerPatternSchema =
|
|
47127
|
-
parameter:
|
|
47128
|
-
matchType:
|
|
47129
|
-
pattern:
|
|
47130
|
-
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()
|
|
47131
47406
|
});
|
|
47132
|
-
var HazardSchema =
|
|
47133
|
-
id:
|
|
47134
|
-
description:
|
|
47407
|
+
var HazardSchema = z108.object({
|
|
47408
|
+
id: z108.string().min(1),
|
|
47409
|
+
description: z108.string(),
|
|
47135
47410
|
category: HazardCategorySchema,
|
|
47136
47411
|
severity: HazardSeveritySchema,
|
|
47137
|
-
likelihood:
|
|
47138
|
-
triggerConditions:
|
|
47139
|
-
consequences:
|
|
47412
|
+
likelihood: z108.enum(["almost_certain", "likely", "possible", "unlikely", "rare"]),
|
|
47413
|
+
triggerConditions: z108.array(z108.string()),
|
|
47414
|
+
consequences: z108.array(z108.string())
|
|
47140
47415
|
});
|
|
47141
|
-
var UnsafeControlActionSchema =
|
|
47142
|
-
id:
|
|
47143
|
-
toolName:
|
|
47144
|
-
type:
|
|
47145
|
-
description:
|
|
47146
|
-
unsafeContext:
|
|
47147
|
-
relatedHazards:
|
|
47148
|
-
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()
|
|
47149
47424
|
});
|
|
47150
|
-
var SafetyConstraintSchema =
|
|
47151
|
-
id:
|
|
47152
|
-
description:
|
|
47153
|
-
mitigates:
|
|
47154
|
-
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([
|
|
47155
47430
|
"prevent",
|
|
47156
47431
|
"require_confirmation",
|
|
47157
47432
|
"alert",
|
|
@@ -47159,54 +47434,54 @@ var SafetyConstraintSchema = z107.object({
|
|
|
47159
47434
|
"rate_limit",
|
|
47160
47435
|
"require_privilege"
|
|
47161
47436
|
]),
|
|
47162
|
-
validationFunction:
|
|
47437
|
+
validationFunction: z108.string().optional(),
|
|
47163
47438
|
priority: ConstraintPrioritySchema
|
|
47164
47439
|
});
|
|
47165
|
-
var PropertySchemaSchema =
|
|
47166
|
-
type:
|
|
47167
|
-
description:
|
|
47168
|
-
enum:
|
|
47169
|
-
pattern:
|
|
47170
|
-
minimum:
|
|
47171
|
-
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()
|
|
47172
47447
|
});
|
|
47173
|
-
var ToolInputSchemaSchema =
|
|
47174
|
-
type:
|
|
47175
|
-
properties:
|
|
47176
|
-
required:
|
|
47177
|
-
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()
|
|
47178
47453
|
});
|
|
47179
|
-
var ToolDefinitionSchema =
|
|
47180
|
-
name:
|
|
47181
|
-
description:
|
|
47454
|
+
var ToolDefinitionSchema = z108.object({
|
|
47455
|
+
name: z108.string().min(1),
|
|
47456
|
+
description: z108.string(),
|
|
47182
47457
|
inputSchema: ToolInputSchemaSchema
|
|
47183
47458
|
});
|
|
47184
|
-
var AnalysisConfigurationSchema =
|
|
47185
|
-
includeLowSeverity:
|
|
47186
|
-
generateAllConstraints:
|
|
47187
|
-
checkInteractions:
|
|
47188
|
-
maxHazardsPerTool:
|
|
47189
|
-
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([])
|
|
47190
47465
|
});
|
|
47191
|
-
var ConstraintViolationSchema =
|
|
47192
|
-
constraintId:
|
|
47193
|
-
constraintDescription:
|
|
47466
|
+
var ConstraintViolationSchema = z108.object({
|
|
47467
|
+
constraintId: z108.string().min(1),
|
|
47468
|
+
constraintDescription: z108.string(),
|
|
47194
47469
|
severity: HazardSeveritySchema,
|
|
47195
|
-
details:
|
|
47196
|
-
remediation:
|
|
47470
|
+
details: z108.string(),
|
|
47471
|
+
remediation: z108.string()
|
|
47197
47472
|
});
|
|
47198
|
-
var ValidationWarningSchema =
|
|
47199
|
-
code:
|
|
47200
|
-
message:
|
|
47201
|
-
affected:
|
|
47473
|
+
var ValidationWarningSchema = z108.object({
|
|
47474
|
+
code: z108.string().min(1),
|
|
47475
|
+
message: z108.string(),
|
|
47476
|
+
affected: z108.string()
|
|
47202
47477
|
});
|
|
47203
|
-
var ValidationResultSchema =
|
|
47204
|
-
valid:
|
|
47205
|
-
toolName:
|
|
47206
|
-
violations:
|
|
47207
|
-
passed:
|
|
47208
|
-
warnings:
|
|
47209
|
-
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()
|
|
47210
47485
|
});
|
|
47211
47486
|
|
|
47212
47487
|
// src/mcp/safety/stpa-types.ts
|
|
@@ -48291,43 +48566,43 @@ var GeminiResponseParser = class {
|
|
|
48291
48566
|
};
|
|
48292
48567
|
|
|
48293
48568
|
// src/cli-adapters/router-types.ts
|
|
48294
|
-
import { z as
|
|
48295
|
-
var RouterConfigSchema =
|
|
48296
|
-
minCapacityThreshold:
|
|
48297
|
-
preferCostEfficient:
|
|
48298
|
-
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)
|
|
48299
48574
|
});
|
|
48300
48575
|
|
|
48301
48576
|
// src/cli-adapters/agreement-cascade-types.ts
|
|
48302
|
-
import { z as
|
|
48303
|
-
var AgreementCascadeConfigSchema =
|
|
48304
|
-
agreementThreshold:
|
|
48305
|
-
maxStages:
|
|
48306
|
-
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)
|
|
48307
48582
|
});
|
|
48308
48583
|
|
|
48309
48584
|
// src/cli-adapters/agreement-cascade-router.ts
|
|
48310
48585
|
var logger48 = createLogger({ component: "agreement-cascade-router" });
|
|
48311
48586
|
|
|
48312
48587
|
// src/cli-adapters/task-classifier.ts
|
|
48313
|
-
import { z as
|
|
48314
|
-
var ClassificationPatternsSchema =
|
|
48315
|
-
code:
|
|
48316
|
-
research:
|
|
48317
|
-
documentation:
|
|
48318
|
-
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()
|
|
48319
48594
|
});
|
|
48320
48595
|
|
|
48321
48596
|
// src/cli-adapters/response-cache-types.ts
|
|
48322
|
-
import { z as
|
|
48323
|
-
var ResponseCacheConfigSchema =
|
|
48324
|
-
defaultTTL:
|
|
48597
|
+
import { z as z112 } from "zod";
|
|
48598
|
+
var ResponseCacheConfigSchema = z112.object({
|
|
48599
|
+
defaultTTL: z112.number().min(1e3).max(36e5).default(3e5),
|
|
48325
48600
|
// 5 minutes
|
|
48326
|
-
maxEntries:
|
|
48327
|
-
maxMemoryMB:
|
|
48328
|
-
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),
|
|
48329
48604
|
// 1 minute
|
|
48330
|
-
enableLogging:
|
|
48605
|
+
enableLogging: z112.boolean().default(false)
|
|
48331
48606
|
});
|
|
48332
48607
|
|
|
48333
48608
|
// src/cli-adapters/response-cache-utils.ts
|
|
@@ -48335,12 +48610,12 @@ import { createHash as createHash4 } from "crypto";
|
|
|
48335
48610
|
var logger49 = createLogger({ component: "ResponseCacheUtils" });
|
|
48336
48611
|
|
|
48337
48612
|
// src/cli-adapters/unified-routing-types.ts
|
|
48338
|
-
import { z as
|
|
48339
|
-
var UnifiedRoutingDecisionSchema =
|
|
48340
|
-
selectedCli:
|
|
48341
|
-
confidence:
|
|
48342
|
-
reason:
|
|
48343
|
-
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([
|
|
48344
48619
|
"composite",
|
|
48345
48620
|
"quality",
|
|
48346
48621
|
"budget",
|
|
@@ -48352,57 +48627,57 @@ var UnifiedRoutingDecisionSchema = z112.object({
|
|
|
48352
48627
|
"linucb",
|
|
48353
48628
|
"direct"
|
|
48354
48629
|
]),
|
|
48355
|
-
decisionTimeMs:
|
|
48356
|
-
alternatives:
|
|
48357
|
-
stagesExecuted:
|
|
48358
|
-
withinBudget:
|
|
48359
|
-
estimatedComplexity:
|
|
48360
|
-
estimatedTokens:
|
|
48361
|
-
topsisScore:
|
|
48362
|
-
ucbScore:
|
|
48363
|
-
resolvedAtStage:
|
|
48364
|
-
consensusReached:
|
|
48365
|
-
agreementScore:
|
|
48366
|
-
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()
|
|
48367
48642
|
});
|
|
48368
48643
|
|
|
48369
48644
|
// src/learning/outcome-feedback-types.ts
|
|
48370
|
-
import { z as
|
|
48371
|
-
var QualitySignalsSchema =
|
|
48372
|
-
testsPass:
|
|
48373
|
-
lintErrors:
|
|
48374
|
-
userApproved:
|
|
48375
|
-
retryCount:
|
|
48376
|
-
completionRatio:
|
|
48377
|
-
validStructure:
|
|
48378
|
-
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()
|
|
48379
48654
|
});
|
|
48380
|
-
var RoutingDecisionSchema =
|
|
48381
|
-
id:
|
|
48382
|
-
timestamp:
|
|
48383
|
-
query:
|
|
48384
|
-
routerType:
|
|
48385
|
-
selectedModel:
|
|
48386
|
-
selectedTier:
|
|
48387
|
-
armIndex:
|
|
48388
|
-
banditContext:
|
|
48389
|
-
queryFeatures:
|
|
48390
|
-
ucbScore:
|
|
48391
|
-
confidence:
|
|
48392
|
-
traceId:
|
|
48393
|
-
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()
|
|
48394
48669
|
});
|
|
48395
|
-
var TaskOutcomeSchema =
|
|
48396
|
-
routingDecisionId:
|
|
48397
|
-
timestamp:
|
|
48398
|
-
outcomeClass:
|
|
48399
|
-
success:
|
|
48400
|
-
qualityScore:
|
|
48401
|
-
durationMs:
|
|
48402
|
-
tokenUsage:
|
|
48403
|
-
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(),
|
|
48404
48679
|
qualitySignals: QualitySignalsSchema,
|
|
48405
|
-
traceId:
|
|
48680
|
+
traceId: z114.string()
|
|
48406
48681
|
});
|
|
48407
48682
|
var DEFAULT_FEEDBACK_COLLECTOR_CONFIG = {
|
|
48408
48683
|
maxPendingDecisions: 1e3,
|
|
@@ -48417,17 +48692,17 @@ var DEFAULT_FEEDBACK_COLLECTOR_CONFIG = {
|
|
|
48417
48692
|
targetTokenUsage: 2e3,
|
|
48418
48693
|
maxHistorySize: 1e4
|
|
48419
48694
|
};
|
|
48420
|
-
var FeedbackCollectorConfigSchema =
|
|
48421
|
-
maxPendingDecisions:
|
|
48422
|
-
pendingTimeoutMs:
|
|
48423
|
-
enableAutoReward:
|
|
48424
|
-
qualityWeight:
|
|
48425
|
-
speedWeight:
|
|
48426
|
-
efficiencyWeight:
|
|
48427
|
-
retryPenalty:
|
|
48428
|
-
targetDurationMs:
|
|
48429
|
-
targetTokenUsage:
|
|
48430
|
-
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)
|
|
48431
48706
|
});
|
|
48432
48707
|
|
|
48433
48708
|
// src/learning/outcome-feedback-helpers.ts
|
|
@@ -50574,4 +50849,4 @@ export {
|
|
|
50574
50849
|
shutdownFeedbackSubscriber,
|
|
50575
50850
|
createEventBusBridge
|
|
50576
50851
|
};
|
|
50577
|
-
//# sourceMappingURL=chunk-
|
|
50852
|
+
//# sourceMappingURL=chunk-EEQVXGZ2.js.map
|