nexus-agents 2.168.0 → 2.170.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-FAWSJFMQ.js → child-mcp-config-3RYBPZNE.js} +2 -2
- package/dist/{chunk-HZNOSJOO.js → chunk-57RYP435.js} +3 -3
- package/dist/{chunk-IAGLVGHN.js → chunk-5N5XURKV.js} +2 -2
- package/dist/{chunk-3KID7AIF.js → chunk-6TN2Z2AQ.js} +3 -3
- package/dist/{chunk-GNCUZDQI.js → chunk-75AUSQL4.js} +7 -7
- package/dist/{chunk-P7RBQUAG.js → chunk-BGV3IF3G.js} +8 -8
- package/dist/{chunk-F5JDQXHJ.js → chunk-C6IAXFNC.js} +2 -2
- package/dist/{chunk-2Z4QECP7.js → chunk-DCXCVEZP.js} +2 -2
- package/dist/{chunk-G7NDNFIE.js → chunk-DDQXPARJ.js} +3 -3
- package/dist/{chunk-UN7PYUJB.js → chunk-DEE2UTYV.js} +2 -2
- package/dist/{chunk-OKAHIWG4.js → chunk-GVTXP6F6.js} +25 -4
- package/dist/chunk-GVTXP6F6.js.map +1 -0
- package/dist/{chunk-6ERIC5NJ.js → chunk-HTM32H2E.js} +2 -2
- package/dist/{chunk-VQE3OSUW.js → chunk-JLG5AUZB.js} +2 -2
- package/dist/{chunk-MSBYVBPX.js → chunk-JOYOOEPJ.js} +2 -2
- package/dist/{chunk-N56C2MWI.js → chunk-JYDXHV4L.js} +2 -2
- package/dist/{chunk-CPS2HN4T.js → chunk-LDZEYJP3.js} +2 -2
- package/dist/{chunk-ELWMGKVP.js → chunk-LOKT6EW7.js} +8 -8
- package/dist/{chunk-LNPKBBPG.js → chunk-LYWNKEGM.js} +4 -4
- package/dist/{chunk-2ANAH2UU.js → chunk-MG4JBADQ.js} +4 -4
- package/dist/{chunk-TORS5V2C.js → chunk-NXSY4G4Y.js} +2 -2
- package/dist/{chunk-EQLJYWLP.js → chunk-OFVUBY6Z.js} +3 -3
- package/dist/{chunk-OLCDGMEO.js → chunk-OIT75IRK.js} +4 -4
- package/dist/{chunk-RJHLNI37.js → chunk-OYBAKU7N.js} +2 -2
- package/dist/{chunk-I3LGUSZ3.js → chunk-P4PLZZCR.js} +5 -5
- package/dist/{chunk-MX3XD2ML.js → chunk-PIODB4SW.js} +2 -2
- package/dist/{chunk-52T2MJDS.js → chunk-QMOJJ6A2.js} +732 -598
- package/dist/chunk-QMOJJ6A2.js.map +1 -0
- package/dist/{chunk-ETFCT2CH.js → chunk-RJDJMOX6.js} +4 -4
- package/dist/{chunk-5LPPJIZ4.js → chunk-RZJQZ5P3.js} +2 -2
- package/dist/{chunk-7IUVW67T.js → chunk-SCHD7NZD.js} +7 -7
- package/dist/{chunk-HJA3Z56H.js → chunk-URRNWRI4.js} +234 -20
- package/dist/chunk-URRNWRI4.js.map +1 -0
- package/dist/{chunk-UGJRDFMN.js → chunk-UXXNNT5D.js} +2 -2
- package/dist/{chunk-TZK7VQAW.js → chunk-WKW5SEP7.js} +5 -5
- package/dist/{chunk-AO4X3BMP.js → chunk-YF35FKKD.js} +2 -1
- package/dist/chunk-YF35FKKD.js.map +1 -0
- package/dist/{chunk-RQNBJ7AS.js → chunk-Z4AWOPXA.js} +2 -2
- package/dist/{chunk-CJLMB7MO.js → chunk-ZW7544DX.js} +3 -3
- package/dist/{cli-circuit-breaker-JDGZ25MD.js → cli-circuit-breaker-4GJA2IXC.js} +4 -4
- package/dist/cli.js +43 -41
- package/dist/cli.js.map +1 -1
- package/dist/codebase-search-LUF5YJLQ.js +14 -0
- package/dist/{composite-router-EZPPVCMD.js → composite-router-UBZO4YR7.js} +2 -2
- package/dist/{consensus-vote-YKKJHLOD.js → consensus-vote-USZFJO2K.js} +15 -15
- package/dist/{context-retriever-EGMARBAC.js → context-retriever-C5C7RFQE.js} +8 -8
- package/dist/{doctor-deep-QTBDR3VV.js → doctor-deep-2N3F7EV6.js} +3 -3
- package/dist/{expert-bridge-FZYJ3XAL.js → expert-bridge-B3EFTAID.js} +4 -4
- package/dist/{factory-SABHBAHC.js → factory-LKQKU3SD.js} +8 -8
- package/dist/{factory-NDMPXPYE.js → factory-SURRFPSV.js} +5 -5
- package/dist/{improvement-review-WYFGNEVP.js → improvement-review-75OCZ5K7.js} +5 -5
- package/dist/index.d.ts +40 -1
- package/dist/index.js +35 -31
- package/dist/index.js.map +1 -1
- package/dist/{init-opencode-CMGJ3TXZ.js → init-opencode-LDI5E5LW.js} +5 -5
- package/dist/{issue-triage-NHRZGMKC.js → issue-triage-WWQEY7PL.js} +6 -6
- package/dist/{pr-reviewer-helpers-HJRFRUZX.js → pr-reviewer-helpers-HDP24LGZ.js} +4 -4
- package/dist/{registry-command-JCOZA7TM.js → registry-command-PZY7HWKO.js} +2 -2
- package/dist/{repo-security-plan-OMY33VHA.js → repo-security-plan-IYKDY5PW.js} +3 -3
- package/dist/{research-helpers-synthesize-DFINP3KN.js → research-helpers-synthesize-XSOFXRFK.js} +4 -4
- package/dist/{routing-memory-KK4GPB64.js → routing-memory-JTNH2BXS.js} +2 -2
- package/dist/{session-memory-QTHGU2XM.js → session-memory-RJZ447UX.js} +3 -3
- package/dist/{setup-command-CURZCHSQ.js → setup-command-35MCRS33.js} +13 -13
- package/dist/{setup-config-FX6SJXGQ.js → setup-config-JV23ZYPO.js} +3 -3
- package/dist/{setup-custom-api-MYN4EVT2.js → setup-custom-api-LMA445OB.js} +3 -3
- package/dist/{tool-memory-3W5NXR4P.js → tool-memory-K6EYH3FQ.js} +5 -5
- package/dist/{unified-registry-PKPNJ3G7.js → unified-registry-MJA6IBDD.js} +9 -9
- package/dist/{weather-report-46ZY3X2Z.js → weather-report-ID4ZNUAF.js} +2 -2
- package/package.json +2 -1
- package/dist/chunk-52T2MJDS.js.map +0 -1
- package/dist/chunk-AO4X3BMP.js.map +0 -1
- package/dist/chunk-HJA3Z56H.js.map +0 -1
- package/dist/chunk-OKAHIWG4.js.map +0 -1
- package/dist/codebase-search-DKLEA4PR.js +0 -12
- /package/dist/{child-mcp-config-FAWSJFMQ.js.map → child-mcp-config-3RYBPZNE.js.map} +0 -0
- /package/dist/{chunk-HZNOSJOO.js.map → chunk-57RYP435.js.map} +0 -0
- /package/dist/{chunk-IAGLVGHN.js.map → chunk-5N5XURKV.js.map} +0 -0
- /package/dist/{chunk-3KID7AIF.js.map → chunk-6TN2Z2AQ.js.map} +0 -0
- /package/dist/{chunk-GNCUZDQI.js.map → chunk-75AUSQL4.js.map} +0 -0
- /package/dist/{chunk-P7RBQUAG.js.map → chunk-BGV3IF3G.js.map} +0 -0
- /package/dist/{chunk-F5JDQXHJ.js.map → chunk-C6IAXFNC.js.map} +0 -0
- /package/dist/{chunk-2Z4QECP7.js.map → chunk-DCXCVEZP.js.map} +0 -0
- /package/dist/{chunk-G7NDNFIE.js.map → chunk-DDQXPARJ.js.map} +0 -0
- /package/dist/{chunk-UN7PYUJB.js.map → chunk-DEE2UTYV.js.map} +0 -0
- /package/dist/{chunk-6ERIC5NJ.js.map → chunk-HTM32H2E.js.map} +0 -0
- /package/dist/{chunk-VQE3OSUW.js.map → chunk-JLG5AUZB.js.map} +0 -0
- /package/dist/{chunk-MSBYVBPX.js.map → chunk-JOYOOEPJ.js.map} +0 -0
- /package/dist/{chunk-N56C2MWI.js.map → chunk-JYDXHV4L.js.map} +0 -0
- /package/dist/{chunk-CPS2HN4T.js.map → chunk-LDZEYJP3.js.map} +0 -0
- /package/dist/{chunk-ELWMGKVP.js.map → chunk-LOKT6EW7.js.map} +0 -0
- /package/dist/{chunk-LNPKBBPG.js.map → chunk-LYWNKEGM.js.map} +0 -0
- /package/dist/{chunk-2ANAH2UU.js.map → chunk-MG4JBADQ.js.map} +0 -0
- /package/dist/{chunk-TORS5V2C.js.map → chunk-NXSY4G4Y.js.map} +0 -0
- /package/dist/{chunk-EQLJYWLP.js.map → chunk-OFVUBY6Z.js.map} +0 -0
- /package/dist/{chunk-OLCDGMEO.js.map → chunk-OIT75IRK.js.map} +0 -0
- /package/dist/{chunk-RJHLNI37.js.map → chunk-OYBAKU7N.js.map} +0 -0
- /package/dist/{chunk-I3LGUSZ3.js.map → chunk-P4PLZZCR.js.map} +0 -0
- /package/dist/{chunk-MX3XD2ML.js.map → chunk-PIODB4SW.js.map} +0 -0
- /package/dist/{chunk-ETFCT2CH.js.map → chunk-RJDJMOX6.js.map} +0 -0
- /package/dist/{chunk-5LPPJIZ4.js.map → chunk-RZJQZ5P3.js.map} +0 -0
- /package/dist/{chunk-7IUVW67T.js.map → chunk-SCHD7NZD.js.map} +0 -0
- /package/dist/{chunk-UGJRDFMN.js.map → chunk-UXXNNT5D.js.map} +0 -0
- /package/dist/{chunk-TZK7VQAW.js.map → chunk-WKW5SEP7.js.map} +0 -0
- /package/dist/{chunk-RQNBJ7AS.js.map → chunk-Z4AWOPXA.js.map} +0 -0
- /package/dist/{chunk-CJLMB7MO.js.map → chunk-ZW7544DX.js.map} +0 -0
- /package/dist/{cli-circuit-breaker-JDGZ25MD.js.map → cli-circuit-breaker-4GJA2IXC.js.map} +0 -0
- /package/dist/{codebase-search-DKLEA4PR.js.map → codebase-search-LUF5YJLQ.js.map} +0 -0
- /package/dist/{composite-router-EZPPVCMD.js.map → composite-router-UBZO4YR7.js.map} +0 -0
- /package/dist/{consensus-vote-YKKJHLOD.js.map → consensus-vote-USZFJO2K.js.map} +0 -0
- /package/dist/{context-retriever-EGMARBAC.js.map → context-retriever-C5C7RFQE.js.map} +0 -0
- /package/dist/{doctor-deep-QTBDR3VV.js.map → doctor-deep-2N3F7EV6.js.map} +0 -0
- /package/dist/{expert-bridge-FZYJ3XAL.js.map → expert-bridge-B3EFTAID.js.map} +0 -0
- /package/dist/{factory-NDMPXPYE.js.map → factory-LKQKU3SD.js.map} +0 -0
- /package/dist/{factory-SABHBAHC.js.map → factory-SURRFPSV.js.map} +0 -0
- /package/dist/{improvement-review-WYFGNEVP.js.map → improvement-review-75OCZ5K7.js.map} +0 -0
- /package/dist/{init-opencode-CMGJ3TXZ.js.map → init-opencode-LDI5E5LW.js.map} +0 -0
- /package/dist/{issue-triage-NHRZGMKC.js.map → issue-triage-WWQEY7PL.js.map} +0 -0
- /package/dist/{pr-reviewer-helpers-HJRFRUZX.js.map → pr-reviewer-helpers-HDP24LGZ.js.map} +0 -0
- /package/dist/{registry-command-JCOZA7TM.js.map → registry-command-PZY7HWKO.js.map} +0 -0
- /package/dist/{repo-security-plan-OMY33VHA.js.map → repo-security-plan-IYKDY5PW.js.map} +0 -0
- /package/dist/{research-helpers-synthesize-DFINP3KN.js.map → research-helpers-synthesize-XSOFXRFK.js.map} +0 -0
- /package/dist/{routing-memory-KK4GPB64.js.map → routing-memory-JTNH2BXS.js.map} +0 -0
- /package/dist/{session-memory-QTHGU2XM.js.map → session-memory-RJZ447UX.js.map} +0 -0
- /package/dist/{setup-command-CURZCHSQ.js.map → setup-command-35MCRS33.js.map} +0 -0
- /package/dist/{setup-config-FX6SJXGQ.js.map → setup-config-JV23ZYPO.js.map} +0 -0
- /package/dist/{setup-custom-api-MYN4EVT2.js.map → setup-custom-api-LMA445OB.js.map} +0 -0
- /package/dist/{tool-memory-3W5NXR4P.js.map → tool-memory-K6EYH3FQ.js.map} +0 -0
- /package/dist/{unified-registry-PKPNJ3G7.js.map → unified-registry-MJA6IBDD.js.map} +0 -0
- /package/dist/{weather-report-46ZY3X2Z.js.map → weather-report-ID4ZNUAF.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
generateSecurityPlan
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JYDXHV4L.js";
|
|
4
4
|
import {
|
|
5
5
|
analyzeGitHubRepo
|
|
6
6
|
} from "./chunk-HFOQKCD2.js";
|
|
@@ -9,8 +9,9 @@ import {
|
|
|
9
9
|
DEFAULT_INDEX_MAX_DEPTH,
|
|
10
10
|
MAX_INDEX_MAX_DEPTH,
|
|
11
11
|
extractSymbolIndex,
|
|
12
|
-
extractSymbols
|
|
13
|
-
|
|
12
|
+
extractSymbols,
|
|
13
|
+
findSourceFiles
|
|
14
|
+
} from "./chunk-YF35FKKD.js";
|
|
14
15
|
import {
|
|
15
16
|
FINDING_SEVERITY_LEVELS,
|
|
16
17
|
SARIF_LEVEL_MAP,
|
|
@@ -20,10 +21,10 @@ import {
|
|
|
20
21
|
DEFAULT_TASK_TTL_MS,
|
|
21
22
|
DEFAULT_TOOL_RATE_LIMITS,
|
|
22
23
|
clampTaskTtl
|
|
23
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-BGV3IF3G.js";
|
|
24
25
|
import {
|
|
25
26
|
executeExpert
|
|
26
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-75AUSQL4.js";
|
|
27
28
|
import {
|
|
28
29
|
JobStatusSchema,
|
|
29
30
|
abortJob,
|
|
@@ -44,21 +45,21 @@ import {
|
|
|
44
45
|
simulationDeniedResult,
|
|
45
46
|
toJobSummary,
|
|
46
47
|
writeJobCancelled
|
|
47
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-LOKT6EW7.js";
|
|
48
49
|
import {
|
|
49
50
|
normalizeTopicToCanonical,
|
|
50
51
|
synthesizeResearch
|
|
51
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-6TN2Z2AQ.js";
|
|
52
53
|
import {
|
|
53
54
|
IssueTriage
|
|
54
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-WKW5SEP7.js";
|
|
55
56
|
import {
|
|
56
57
|
resolveEnvMode,
|
|
57
58
|
sanitizeInput
|
|
58
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-DEE2UTYV.js";
|
|
59
60
|
import {
|
|
60
61
|
withPrerequisite
|
|
61
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-ZW7544DX.js";
|
|
62
63
|
import {
|
|
63
64
|
NOOP_NOTIFIER,
|
|
64
65
|
RateLimiter,
|
|
@@ -81,13 +82,15 @@ import {
|
|
|
81
82
|
withAuditTrail,
|
|
82
83
|
withProgressHeartbeat,
|
|
83
84
|
wrapToolWithTimeout
|
|
84
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-DDQXPARJ.js";
|
|
85
86
|
import {
|
|
86
87
|
createAuditTrail,
|
|
87
88
|
createGraphAuditBridge,
|
|
88
89
|
emitPipelinePolicyEvent
|
|
89
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-OYBAKU7N.js";
|
|
90
91
|
import {
|
|
92
|
+
IDENTIFIER_RE,
|
|
93
|
+
LANG_VALUES,
|
|
91
94
|
addResearchPaper,
|
|
92
95
|
addSourceToRegistry,
|
|
93
96
|
computeSourceQualityScore,
|
|
@@ -103,26 +106,28 @@ import {
|
|
|
103
106
|
discoverSemanticScholar,
|
|
104
107
|
fetchSource,
|
|
105
108
|
findOverlaps,
|
|
109
|
+
findUsagesInSource,
|
|
106
110
|
formatResearchIssueBody,
|
|
107
111
|
generateStatsJson,
|
|
108
112
|
getContextForTask,
|
|
109
113
|
getContextPromptPrefix,
|
|
110
114
|
getResearchInsightsForTask,
|
|
111
115
|
getResearchStatus,
|
|
116
|
+
inferLang,
|
|
112
117
|
inferTaskCategory,
|
|
113
118
|
paperExists,
|
|
114
119
|
parseRegistry,
|
|
115
120
|
sourceExistsInRegistry,
|
|
116
121
|
summarizeContextForPrompt
|
|
117
|
-
} from "./chunk-
|
|
122
|
+
} from "./chunk-URRNWRI4.js";
|
|
118
123
|
import {
|
|
119
124
|
getTokenEnvVars,
|
|
120
125
|
resolveToken
|
|
121
|
-
} from "./chunk-
|
|
126
|
+
} from "./chunk-5N5XURKV.js";
|
|
122
127
|
import {
|
|
123
128
|
loadPapersRegistry,
|
|
124
129
|
loadTechniquesRegistry
|
|
125
|
-
} from "./chunk-
|
|
130
|
+
} from "./chunk-RZJQZ5P3.js";
|
|
126
131
|
import {
|
|
127
132
|
resolveInsideRoot
|
|
128
133
|
} from "./chunk-NUBSJGQZ.js";
|
|
@@ -131,14 +136,14 @@ import {
|
|
|
131
136
|
MemoryImportance,
|
|
132
137
|
calculateTextJaccardSimilarity,
|
|
133
138
|
getToolMemory
|
|
134
|
-
} from "./chunk-
|
|
139
|
+
} from "./chunk-MG4JBADQ.js";
|
|
135
140
|
import {
|
|
136
141
|
STOPWORDS,
|
|
137
142
|
truncateWithInfo
|
|
138
143
|
} from "./chunk-6T3EPABN.js";
|
|
139
144
|
import {
|
|
140
145
|
createSessionMemory
|
|
141
|
-
} from "./chunk-
|
|
146
|
+
} from "./chunk-PIODB4SW.js";
|
|
142
147
|
import {
|
|
143
148
|
BUILT_IN_EXPERTS,
|
|
144
149
|
BuiltInExpertTypeSchema,
|
|
@@ -153,7 +158,7 @@ import {
|
|
|
153
158
|
createEvent,
|
|
154
159
|
getGlobalEventBus,
|
|
155
160
|
getGlobalRegistry
|
|
156
|
-
} from "./chunk-
|
|
161
|
+
} from "./chunk-RJDJMOX6.js";
|
|
157
162
|
import {
|
|
158
163
|
CliDetectionCache,
|
|
159
164
|
asRecord,
|
|
@@ -161,19 +166,19 @@ import {
|
|
|
161
166
|
getAvailableClis,
|
|
162
167
|
sleep,
|
|
163
168
|
withTimeout
|
|
164
|
-
} from "./chunk-
|
|
169
|
+
} from "./chunk-SCHD7NZD.js";
|
|
165
170
|
import {
|
|
166
171
|
DEFAULTS
|
|
167
|
-
} from "./chunk-
|
|
172
|
+
} from "./chunk-JLG5AUZB.js";
|
|
168
173
|
import {
|
|
169
174
|
getAvailabilityCache,
|
|
170
175
|
getCliForModelId,
|
|
171
176
|
resolveFallback
|
|
172
|
-
} from "./chunk-
|
|
177
|
+
} from "./chunk-UXXNNT5D.js";
|
|
173
178
|
import {
|
|
174
179
|
generateHyphenId,
|
|
175
180
|
generateUUID
|
|
176
|
-
} from "./chunk-
|
|
181
|
+
} from "./chunk-DCXCVEZP.js";
|
|
177
182
|
import {
|
|
178
183
|
AGENT_ROUTER_TIMEOUTS,
|
|
179
184
|
API_TIMEOUTS,
|
|
@@ -265,7 +270,7 @@ import {
|
|
|
265
270
|
selectStrategyByManifest,
|
|
266
271
|
toExpertTaskAnalysisResult,
|
|
267
272
|
withStep
|
|
268
|
-
} from "./chunk-
|
|
273
|
+
} from "./chunk-GVTXP6F6.js";
|
|
269
274
|
import {
|
|
270
275
|
ensureLearningDir,
|
|
271
276
|
getMetaOutcomesFile,
|
|
@@ -2565,13 +2570,13 @@ function makeCancelError(taskId) {
|
|
|
2565
2570
|
}
|
|
2566
2571
|
function executeWithTimeout(params) {
|
|
2567
2572
|
const { task, maxDurationMs, executeTask, transformError, signal } = params;
|
|
2568
|
-
return new Promise((
|
|
2573
|
+
return new Promise((resolve20) => {
|
|
2569
2574
|
let settled = false;
|
|
2570
2575
|
const settle = (result) => {
|
|
2571
2576
|
if (settled) return;
|
|
2572
2577
|
settled = true;
|
|
2573
2578
|
clearTimeout(timeoutId);
|
|
2574
|
-
|
|
2579
|
+
resolve20(result);
|
|
2575
2580
|
};
|
|
2576
2581
|
const timeoutId = setTimeout(() => {
|
|
2577
2582
|
settle(
|
|
@@ -7981,13 +7986,13 @@ var WaveScheduler = class {
|
|
|
7981
7986
|
}
|
|
7982
7987
|
async withTimeout(promise, timeoutMs, taskId) {
|
|
7983
7988
|
if (timeoutMs <= 0) return promise;
|
|
7984
|
-
return new Promise((
|
|
7989
|
+
return new Promise((resolve20, reject) => {
|
|
7985
7990
|
const timer = setTimeout(() => {
|
|
7986
7991
|
reject(new Error(`Task ${taskId} timed out after ${String(timeoutMs)}ms`));
|
|
7987
7992
|
}, timeoutMs);
|
|
7988
7993
|
promise.then((result) => {
|
|
7989
7994
|
clearTimeout(timer);
|
|
7990
|
-
|
|
7995
|
+
resolve20(result);
|
|
7991
7996
|
}).catch((error) => {
|
|
7992
7997
|
clearTimeout(timer);
|
|
7993
7998
|
reject(error instanceof Error ? error : new Error(String(error)));
|
|
@@ -7999,8 +8004,8 @@ function chunkByDirectory(files, basePath) {
|
|
|
7999
8004
|
const normalizedBase = basePath.endsWith("/") ? basePath : `${basePath}/`;
|
|
8000
8005
|
const groups = /* @__PURE__ */ new Map();
|
|
8001
8006
|
for (const file of files) {
|
|
8002
|
-
const
|
|
8003
|
-
const stripped =
|
|
8007
|
+
const relative2 = file.startsWith(normalizedBase) ? file.slice(normalizedBase.length) : file;
|
|
8008
|
+
const stripped = relative2.startsWith("/") ? relative2.slice(1) : relative2;
|
|
8004
8009
|
const topDir = stripped.split("/")[0] ?? "root";
|
|
8005
8010
|
const existing = groups.get(topDir);
|
|
8006
8011
|
if (existing !== void 0) {
|
|
@@ -14921,8 +14926,8 @@ var Semaphore = class {
|
|
|
14921
14926
|
this.available -= 1;
|
|
14922
14927
|
return Promise.resolve();
|
|
14923
14928
|
}
|
|
14924
|
-
return new Promise((
|
|
14925
|
-
this.waiters.push(
|
|
14929
|
+
return new Promise((resolve20) => {
|
|
14930
|
+
this.waiters.push(resolve20);
|
|
14926
14931
|
});
|
|
14927
14932
|
}
|
|
14928
14933
|
release() {
|
|
@@ -18355,9 +18360,9 @@ var ExpertPool = class {
|
|
|
18355
18360
|
if (this.active < this.capacity) {
|
|
18356
18361
|
return this.issuePermit();
|
|
18357
18362
|
}
|
|
18358
|
-
return new Promise((
|
|
18363
|
+
return new Promise((resolve20, reject) => {
|
|
18359
18364
|
const timer = setTimeout(() => {
|
|
18360
|
-
const idx = this.queue.findIndex((e) => e.resolve ===
|
|
18365
|
+
const idx = this.queue.findIndex((e) => e.resolve === resolve20);
|
|
18361
18366
|
if (idx !== -1) {
|
|
18362
18367
|
this.queue.splice(idx, 1);
|
|
18363
18368
|
}
|
|
@@ -18367,7 +18372,7 @@ var ExpertPool = class {
|
|
|
18367
18372
|
)
|
|
18368
18373
|
);
|
|
18369
18374
|
}, this.acquireTimeoutMs);
|
|
18370
|
-
this.queue.push({ resolve:
|
|
18375
|
+
this.queue.push({ resolve: resolve20, reject, timer });
|
|
18371
18376
|
});
|
|
18372
18377
|
}
|
|
18373
18378
|
/** Release a permit back to the pool. */
|
|
@@ -18951,8 +18956,8 @@ var TaskQueue = class {
|
|
|
18951
18956
|
if (this.cancelled) {
|
|
18952
18957
|
return Promise.reject(new Error("Queue has been cancelled"));
|
|
18953
18958
|
}
|
|
18954
|
-
return new Promise((
|
|
18955
|
-
this.queue.push({ task, resolve:
|
|
18959
|
+
return new Promise((resolve20, reject) => {
|
|
18960
|
+
this.queue.push({ task, resolve: resolve20, reject });
|
|
18956
18961
|
this.processNext();
|
|
18957
18962
|
});
|
|
18958
18963
|
}
|
|
@@ -19228,16 +19233,16 @@ async function executeStepWithTimeout(step, context, stepExecutor, signal) {
|
|
|
19228
19233
|
return executeWithTimeout2(step, stepContext, stepExecutor, stepTimeout, startTime);
|
|
19229
19234
|
}
|
|
19230
19235
|
function executeWithTimeout2(step, context, executor, timeout, startTime) {
|
|
19231
|
-
return new Promise((
|
|
19236
|
+
return new Promise((resolve20) => {
|
|
19232
19237
|
const timeoutId = setTimeout(() => {
|
|
19233
|
-
|
|
19238
|
+
resolve20(createTimeoutResult(step.id, getTimeProvider().now() - startTime, timeout));
|
|
19234
19239
|
}, timeout);
|
|
19235
19240
|
executor(step, context).then((result) => {
|
|
19236
19241
|
clearTimeout(timeoutId);
|
|
19237
|
-
|
|
19242
|
+
resolve20(result);
|
|
19238
19243
|
}).catch((error) => {
|
|
19239
19244
|
clearTimeout(timeoutId);
|
|
19240
|
-
|
|
19245
|
+
resolve20(createErrorResult(step.id, getTimeProvider().now() - startTime, error));
|
|
19241
19246
|
});
|
|
19242
19247
|
});
|
|
19243
19248
|
}
|
|
@@ -23644,10 +23649,10 @@ function calculateZStatistic(params) {
|
|
|
23644
23649
|
function calculateDifferenceCI(p1, p2, total1, total2, confidence) {
|
|
23645
23650
|
const difference = p1 - p2;
|
|
23646
23651
|
const seDiff = Math.sqrt(p1 * (1 - p1) / (total1 || 1) + p2 * (1 - p2) / (total2 || 1));
|
|
23647
|
-
const
|
|
23652
|
+
const z117 = getZScore(confidence);
|
|
23648
23653
|
return {
|
|
23649
|
-
lower: difference -
|
|
23650
|
-
upper: difference +
|
|
23654
|
+
lower: difference - z117 * seDiff,
|
|
23655
|
+
upper: difference + z117 * seDiff,
|
|
23651
23656
|
estimate: difference,
|
|
23652
23657
|
confidence,
|
|
23653
23658
|
n: total1 + total2,
|
|
@@ -23670,11 +23675,11 @@ function proportionConfidenceInterval(successes, total, options = {}) {
|
|
|
23670
23675
|
standardError: 0
|
|
23671
23676
|
};
|
|
23672
23677
|
}
|
|
23673
|
-
const
|
|
23674
|
-
const z210 =
|
|
23678
|
+
const z117 = getZScore(opts.confidence);
|
|
23679
|
+
const z210 = z117 * z117;
|
|
23675
23680
|
const denominator = 1 + z210 / n;
|
|
23676
23681
|
const center = (p + z210 / (2 * n)) / denominator;
|
|
23677
|
-
const margin =
|
|
23682
|
+
const margin = z117 / denominator * Math.sqrt(p * (1 - p) / n + z210 / (4 * n * n));
|
|
23678
23683
|
const lower = Math.max(0, center - margin);
|
|
23679
23684
|
const upper = Math.min(1, center + margin);
|
|
23680
23685
|
const standardError = Math.sqrt(p * (1 - p) / n);
|
|
@@ -23704,8 +23709,8 @@ function meanConfidenceInterval(values, options = {}) {
|
|
|
23704
23709
|
const variance = values.reduce((sum, v) => sum + (v - mean) ** 2, 0) / (n - 1 || 1);
|
|
23705
23710
|
const stdDev = Math.sqrt(variance);
|
|
23706
23711
|
const standardError = stdDev / Math.sqrt(n);
|
|
23707
|
-
const
|
|
23708
|
-
const margin =
|
|
23712
|
+
const z117 = getZScore(opts.confidence);
|
|
23713
|
+
const margin = z117 * standardError;
|
|
23709
23714
|
return {
|
|
23710
23715
|
lower: mean - margin,
|
|
23711
23716
|
upper: mean + margin,
|
|
@@ -26300,7 +26305,7 @@ function execIdFields(executionId) {
|
|
|
26300
26305
|
async function populateUnifiedContextOnState(state, options) {
|
|
26301
26306
|
const taskCandidate = state["task"];
|
|
26302
26307
|
if (typeof taskCandidate !== "string" || taskCandidate === "") return;
|
|
26303
|
-
const { getContextForTask: getContextForTask2, inferTaskCategory: inferTaskCategory2 } = await import("./context-retriever-
|
|
26308
|
+
const { getContextForTask: getContextForTask2, inferTaskCategory: inferTaskCategory2 } = await import("./context-retriever-C5C7RFQE.js");
|
|
26304
26309
|
const category = inferTaskCategory2(taskCandidate);
|
|
26305
26310
|
const executionId = options?.executionId;
|
|
26306
26311
|
const execFields = execIdFields(executionId);
|
|
@@ -26797,13 +26802,13 @@ function dedupe(ids) {
|
|
|
26797
26802
|
return [...new Set(ids)];
|
|
26798
26803
|
}
|
|
26799
26804
|
async function withTimeout2(promise, ms) {
|
|
26800
|
-
return new Promise((
|
|
26805
|
+
return new Promise((resolve20, reject) => {
|
|
26801
26806
|
const timer = setTimeout(() => {
|
|
26802
26807
|
reject(new Error(`Node timed out after ${String(ms)}ms`));
|
|
26803
26808
|
}, ms);
|
|
26804
26809
|
promise.then((result) => {
|
|
26805
26810
|
clearTimeout(timer);
|
|
26806
|
-
|
|
26811
|
+
resolve20(result);
|
|
26807
26812
|
}).catch((error) => {
|
|
26808
26813
|
clearTimeout(timer);
|
|
26809
26814
|
reject(error instanceof Error ? error : new Error(String(error)));
|
|
@@ -29243,11 +29248,11 @@ function createMockOrchestrator() {
|
|
|
29243
29248
|
async function raceAgainstDeadline(promise, deadlineMs, onTimeout) {
|
|
29244
29249
|
const startedAt = Date.now();
|
|
29245
29250
|
let timer;
|
|
29246
|
-
const timeoutP = new Promise((
|
|
29251
|
+
const timeoutP = new Promise((resolve20, reject) => {
|
|
29247
29252
|
timer = setTimeout(
|
|
29248
29253
|
() => {
|
|
29249
29254
|
try {
|
|
29250
|
-
|
|
29255
|
+
resolve20(onTimeout(Date.now() - startedAt));
|
|
29251
29256
|
} catch (err2) {
|
|
29252
29257
|
reject(err2 instanceof Error ? err2 : new Error(String(err2)));
|
|
29253
29258
|
}
|
|
@@ -30450,11 +30455,11 @@ function createWorkerTask(entry, taskIndex, waveNumber, opts) {
|
|
|
30450
30455
|
const staggerSlot = taskIndex % opts.maxConcurrency;
|
|
30451
30456
|
const staggerMs = staggerSlot * opts.staggerDelayMs;
|
|
30452
30457
|
if (staggerMs > 0) {
|
|
30453
|
-
await new Promise((
|
|
30458
|
+
await new Promise((resolve20) => setTimeout(resolve20, staggerMs));
|
|
30454
30459
|
}
|
|
30455
30460
|
const spacingDelay = opts.failureTracker.getSpacingDelay(entry.role);
|
|
30456
30461
|
if (spacingDelay > 0) {
|
|
30457
|
-
await new Promise((
|
|
30462
|
+
await new Promise((resolve20) => setTimeout(resolve20, spacingDelay));
|
|
30458
30463
|
}
|
|
30459
30464
|
const timeoutMs = opts.options.workerTimeoutMs ?? getExpertTaskTimeout(entry.subTask);
|
|
30460
30465
|
const result = await executeSafe({
|
|
@@ -30506,7 +30511,7 @@ async function maybeDelayForRateLimit(results, waveIdx, totalWaves) {
|
|
|
30506
30511
|
);
|
|
30507
30512
|
if (hasRateLimit) {
|
|
30508
30513
|
logger26.warn("Rate-limit detected \u2014 delaying next wave", { delayMs: RATE_LIMIT_WAVE_DELAY_MS });
|
|
30509
|
-
await new Promise((
|
|
30514
|
+
await new Promise((resolve20) => setTimeout(resolve20, RATE_LIMIT_WAVE_DELAY_MS));
|
|
30510
30515
|
}
|
|
30511
30516
|
}
|
|
30512
30517
|
function emitWaveStarted(ctx, workerCount, roles) {
|
|
@@ -30604,7 +30609,7 @@ async function maybeRetryAfterTriage(opts) {
|
|
|
30604
30609
|
}
|
|
30605
30610
|
const useAltCli = triage.action === "retry_different_cli" && altExecuteWorker !== void 0;
|
|
30606
30611
|
if (triage.action === "retry_different_cli") {
|
|
30607
|
-
await new Promise((
|
|
30612
|
+
await new Promise((resolve20) => setTimeout(resolve20, RATE_LIMIT_SPACING_MS));
|
|
30608
30613
|
}
|
|
30609
30614
|
const retryTimeout = triage.action === "extend_timeout" ? Math.min(timeoutMs * TIMEOUT_EXTENSION_FACTOR, MAX_WORKER_TIMEOUT_MS) : timeoutMs;
|
|
30610
30615
|
const retryExecutor = useAltCli ? altExecuteWorker : executeWorker;
|
|
@@ -39848,14 +39853,141 @@ function registerExtractSymbolsTool(server, deps) {
|
|
|
39848
39853
|
logger58.info("Registered extract_symbols tool");
|
|
39849
39854
|
}
|
|
39850
39855
|
|
|
39851
|
-
// src/mcp/tools/
|
|
39852
|
-
import { readFile as readFile3
|
|
39853
|
-
import {
|
|
39856
|
+
// src/mcp/tools/search-usages-tool.ts
|
|
39857
|
+
import { readFile as readFile3 } from "fs/promises";
|
|
39858
|
+
import { relative, resolve as resolve9, sep as sep5 } from "path";
|
|
39854
39859
|
import { z as z81 } from "zod";
|
|
39855
|
-
var
|
|
39856
|
-
|
|
39857
|
-
|
|
39858
|
-
|
|
39860
|
+
var DEFAULT_USAGES_LIMIT = 50;
|
|
39861
|
+
var MAX_USAGES_LIMIT = 500;
|
|
39862
|
+
var DEFAULT_USAGES_MAX_DEPTH = 24;
|
|
39863
|
+
var MAX_USAGES_MAX_DEPTH = 64;
|
|
39864
|
+
var MAX_FILES_SCANNED = 5e3;
|
|
39865
|
+
var SearchUsagesInputSchema = z81.object({
|
|
39866
|
+
symbol: z81.string().min(1).max(200).regex(IDENTIFIER_RE, "symbol must be a single JS identifier (letters, digits, _ or $)").describe("Identifier to find usages/call-sites of (a single JS identifier)"),
|
|
39867
|
+
path: z81.string().min(1).max(500).optional().describe("Restrict to a single source file (takes precedence over dir)"),
|
|
39868
|
+
dir: z81.string().min(1).max(500).optional().describe("Directory to search recursively (default: current working directory)"),
|
|
39869
|
+
lang: z81.enum(LANG_VALUES).optional().describe(
|
|
39870
|
+
"Language override (default: inferred from each file extension, fallback typescript)"
|
|
39871
|
+
),
|
|
39872
|
+
limit: z81.number().int().min(1).max(MAX_USAGES_LIMIT).optional().describe(
|
|
39873
|
+
`Max usage matches emitted (default ${String(DEFAULT_USAGES_LIMIT)}). Excess is reported.`
|
|
39874
|
+
),
|
|
39875
|
+
maxDepth: z81.number().int().min(1).max(MAX_USAGES_MAX_DEPTH).optional().describe(`Directory walk depth for dir scope (default ${String(DEFAULT_USAGES_MAX_DEPTH)}).`)
|
|
39876
|
+
});
|
|
39877
|
+
function resolveWithinCwd(target) {
|
|
39878
|
+
const resolved = resolve9(target);
|
|
39879
|
+
const cwdRoot = resolve9(".");
|
|
39880
|
+
if (resolved !== cwdRoot && !resolved.startsWith(cwdRoot + sep5)) {
|
|
39881
|
+
return { error: `Path traversal denied: scope must be within ${cwdRoot}` };
|
|
39882
|
+
}
|
|
39883
|
+
return { resolved };
|
|
39884
|
+
}
|
|
39885
|
+
async function resolveFileScope(input) {
|
|
39886
|
+
if (input.path !== void 0) {
|
|
39887
|
+
const guard2 = resolveWithinCwd(input.path);
|
|
39888
|
+
if ("error" in guard2) return guard2;
|
|
39889
|
+
return { files: [guard2.resolved], root: resolve9(".") };
|
|
39890
|
+
}
|
|
39891
|
+
const guard = resolveWithinCwd(input.dir ?? process.cwd());
|
|
39892
|
+
if ("error" in guard) return guard;
|
|
39893
|
+
const walk = await findSourceFiles(guard.resolved, input.maxDepth ?? DEFAULT_USAGES_MAX_DEPTH);
|
|
39894
|
+
return { files: walk.files.slice(0, MAX_FILES_SCANNED), root: guard.resolved };
|
|
39895
|
+
}
|
|
39896
|
+
async function collectUsages(input, scope, limit, ctx) {
|
|
39897
|
+
const results = [];
|
|
39898
|
+
let total = 0;
|
|
39899
|
+
for (const file of scope.files) {
|
|
39900
|
+
let src;
|
|
39901
|
+
try {
|
|
39902
|
+
src = await readFile3(file, "utf8");
|
|
39903
|
+
} catch {
|
|
39904
|
+
ctx.logger.warn(`search_usages: skipped unreadable file ${file}`);
|
|
39905
|
+
continue;
|
|
39906
|
+
}
|
|
39907
|
+
const lang = input.lang ?? inferLang(file);
|
|
39908
|
+
const rel = relative(scope.root, file) || file;
|
|
39909
|
+
for (const match of findUsagesInSource(input.symbol, src, lang)) {
|
|
39910
|
+
total += 1;
|
|
39911
|
+
if (results.length < limit) results.push({ file: rel, ...match });
|
|
39912
|
+
}
|
|
39913
|
+
}
|
|
39914
|
+
return { results, total };
|
|
39915
|
+
}
|
|
39916
|
+
function buildOutput2(input, scope, limit, collected) {
|
|
39917
|
+
const payload = {
|
|
39918
|
+
symbol: input.symbol,
|
|
39919
|
+
scope: input.path !== void 0 ? { path: input.path } : { dir: input.dir ?? "." },
|
|
39920
|
+
lang: input.lang ?? "inferred",
|
|
39921
|
+
filesScanned: scope.files.length,
|
|
39922
|
+
totalMatches: collected.total,
|
|
39923
|
+
results: collected.results
|
|
39924
|
+
};
|
|
39925
|
+
if (collected.total > collected.results.length) {
|
|
39926
|
+
payload["truncated"] = true;
|
|
39927
|
+
payload["omittedMatches"] = collected.total - collected.results.length;
|
|
39928
|
+
payload["limit"] = limit;
|
|
39929
|
+
}
|
|
39930
|
+
return JSON.stringify(payload, null, 2);
|
|
39931
|
+
}
|
|
39932
|
+
async function searchUsagesHandler(args, ctx) {
|
|
39933
|
+
const parsed = SearchUsagesInputSchema.safeParse(args);
|
|
39934
|
+
if (!parsed.success) {
|
|
39935
|
+
return toolStructuredError({
|
|
39936
|
+
errorCategory: "validation",
|
|
39937
|
+
message: `Validation error: ${formatZodError(parsed.error)}`
|
|
39938
|
+
});
|
|
39939
|
+
}
|
|
39940
|
+
const scope = await resolveFileScope(parsed.data);
|
|
39941
|
+
if ("error" in scope) {
|
|
39942
|
+
return toolStructuredError({ errorCategory: "permission", message: scope.error });
|
|
39943
|
+
}
|
|
39944
|
+
try {
|
|
39945
|
+
const limit = parsed.data.limit ?? DEFAULT_USAGES_LIMIT;
|
|
39946
|
+
const collected = await collectUsages(parsed.data, scope, limit, ctx);
|
|
39947
|
+
return toolSuccess(buildOutput2(parsed.data, scope, limit, collected));
|
|
39948
|
+
} catch (caught) {
|
|
39949
|
+
const e = caught instanceof Error ? caught : new Error(String(caught));
|
|
39950
|
+
ctx.logger.error("Usage search failed", e);
|
|
39951
|
+
return toolStructuredError({
|
|
39952
|
+
errorCategory: "internal",
|
|
39953
|
+
message: `Usage search failed: ${e.message}`
|
|
39954
|
+
});
|
|
39955
|
+
}
|
|
39956
|
+
}
|
|
39957
|
+
function registerSearchUsagesTool(server, deps) {
|
|
39958
|
+
const logger58 = deps.logger ?? createLogger({ tool: "search_usages" });
|
|
39959
|
+
const toolSchema = {
|
|
39960
|
+
symbol: z81.string().min(1).max(200).regex(IDENTIFIER_RE, "symbol must be a single JS identifier").describe("Identifier to find usages/call-sites of"),
|
|
39961
|
+
path: z81.string().min(1).max(500).optional().describe("Restrict to a single source file"),
|
|
39962
|
+
dir: z81.string().min(1).max(500).optional().describe("Directory to search (default: cwd)"),
|
|
39963
|
+
lang: z81.enum(LANG_VALUES).optional().describe("Language override (default: infer from ext)"),
|
|
39964
|
+
limit: z81.number().int().min(1).max(MAX_USAGES_LIMIT).optional().describe(`Max matches (default ${String(DEFAULT_USAGES_LIMIT)})`),
|
|
39965
|
+
maxDepth: z81.number().int().min(1).max(MAX_USAGES_MAX_DEPTH).optional().describe(`Directory walk depth (default ${String(DEFAULT_USAGES_MAX_DEPTH)})`)
|
|
39966
|
+
};
|
|
39967
|
+
const description = `Structural USAGE / call-site search for a symbol via ast-grep (tree-sitter). Answers "where is X used or called" \u2014 finds calls (foo()), member calls (obj.foo()), new expressions (new Foo()), imports, and bare references, with file:line:column + snippet. This is the gap \`search_codebase\` CANNOT fill: that indexes declared symbol NAMES only, not usages. Excludes the declaration itself (use \`search_codebase\` for declarations). Syntactic, not type-aware (a same-named member on an unrelated object may match). Read-only. Results capped at ${String(DEFAULT_USAGES_LIMIT)} by default (override via limit up to ${String(MAX_USAGES_LIMIT)}); overflow is reported, never silent.`;
|
|
39968
|
+
const secureHandler = createSecureHandler(searchUsagesHandler, {
|
|
39969
|
+
toolName: "search_usages",
|
|
39970
|
+
rateLimiter: deps.rateLimiter,
|
|
39971
|
+
logger: logger58
|
|
39972
|
+
});
|
|
39973
|
+
const timeoutMs = getToolTimeout("search_usages", deps.security);
|
|
39974
|
+
const wrapped = wrapToolWithTimeout("search_usages", secureHandler, { timeoutMs, logger: logger58 });
|
|
39975
|
+
server.registerTool(
|
|
39976
|
+
"search_usages",
|
|
39977
|
+
{ description, inputSchema: toolSchema, annotations: getToolAnnotations("search_usages") },
|
|
39978
|
+
toSdkCallback(wrapped)
|
|
39979
|
+
);
|
|
39980
|
+
logger58.info("Registered search_usages tool");
|
|
39981
|
+
}
|
|
39982
|
+
|
|
39983
|
+
// src/mcp/tools/query-trace-tool.ts
|
|
39984
|
+
import { readFile as readFile4, stat as stat3 } from "fs/promises";
|
|
39985
|
+
import { join as join6, resolve as resolve10, sep as sep6 } from "path";
|
|
39986
|
+
import { z as z82 } from "zod";
|
|
39987
|
+
var QueryTraceInputSchema = z82.object({
|
|
39988
|
+
runId: z82.string().min(1).max(128).regex(/^[a-zA-Z0-9_-]+$/, "runId must be alphanumeric, hyphens, or underscores").describe("Run ID to query traces for"),
|
|
39989
|
+
eventType: z82.string().max(100).regex(/^[a-zA-Z0-9._-]+$/, "eventType must be alphanumeric with dots, hyphens, or underscores").optional().describe("Filter by event type"),
|
|
39990
|
+
limit: z82.number().min(1).max(500).optional().describe("Max events to return (default: 100)")
|
|
39859
39991
|
});
|
|
39860
39992
|
var MAX_TRACE_FILE_BYTES = 100 * 1024 * 1024;
|
|
39861
39993
|
var traceLogger = createLogger({ component: "query-trace" });
|
|
@@ -39899,9 +40031,9 @@ var EMPTY_RESPONSE = {
|
|
|
39899
40031
|
async function queryTraceFromDisk(input, runsDir) {
|
|
39900
40032
|
const dir = runsDir ?? getDefaultRunsDir();
|
|
39901
40033
|
const tracePath = join6(dir, input.runId, "trace.jsonl");
|
|
39902
|
-
const resolvedDir =
|
|
39903
|
-
const resolvedTrace =
|
|
39904
|
-
if (!resolvedTrace.startsWith(resolvedDir +
|
|
40034
|
+
const resolvedDir = resolve10(dir);
|
|
40035
|
+
const resolvedTrace = resolve10(tracePath);
|
|
40036
|
+
if (!resolvedTrace.startsWith(resolvedDir + sep6) && resolvedTrace !== resolvedDir) {
|
|
39905
40037
|
return { runId: input.runId, ...EMPTY_RESPONSE };
|
|
39906
40038
|
}
|
|
39907
40039
|
try {
|
|
@@ -39909,7 +40041,7 @@ async function queryTraceFromDisk(input, runsDir) {
|
|
|
39909
40041
|
if (fileStat.size > MAX_TRACE_FILE_BYTES) {
|
|
39910
40042
|
return { runId: input.runId, ...EMPTY_RESPONSE, truncated: true };
|
|
39911
40043
|
}
|
|
39912
|
-
const content = await
|
|
40044
|
+
const content = await readFile4(tracePath, "utf-8");
|
|
39913
40045
|
let parsed = parseJsonlLines(content);
|
|
39914
40046
|
const limit = input.limit ?? 100;
|
|
39915
40047
|
if (input.eventType !== void 0) {
|
|
@@ -39960,9 +40092,9 @@ function queryTraceHandler(args, ctx) {
|
|
|
39960
40092
|
function registerQueryTraceTool(server, deps) {
|
|
39961
40093
|
const logger58 = deps.logger ?? createLogger({ tool: "query_trace" });
|
|
39962
40094
|
const toolSchema = {
|
|
39963
|
-
runId:
|
|
39964
|
-
eventType:
|
|
39965
|
-
limit:
|
|
40095
|
+
runId: z82.string().min(1).max(128).regex(/^[a-zA-Z0-9_-]+$/, "runId must be alphanumeric, hyphens, or underscores").describe("Run ID to query traces for"),
|
|
40096
|
+
eventType: z82.string().max(100).regex(/^[a-zA-Z0-9._-]+$/).optional().describe("Filter by event type (e.g., model.called)"),
|
|
40097
|
+
limit: z82.number().min(1).max(500).optional().describe("Max events to return (default: 100)")
|
|
39966
40098
|
};
|
|
39967
40099
|
const description = "Query execution traces by run ID. Returns agent and model attribution for pipeline runs including decision paths, error taxonomy, and timing data.";
|
|
39968
40100
|
const secureHandler = createSecureHandler(queryTraceHandler, {
|
|
@@ -39981,7 +40113,7 @@ function registerQueryTraceTool(server, deps) {
|
|
|
39981
40113
|
}
|
|
39982
40114
|
|
|
39983
40115
|
// src/mcp/tools/get-job-result-tool.ts
|
|
39984
|
-
import { z as
|
|
40116
|
+
import { z as z83 } from "zod";
|
|
39985
40117
|
|
|
39986
40118
|
// src/mcp/jobs/task-state-source.ts
|
|
39987
40119
|
var logger33 = createLogger({ component: "task-state-source" });
|
|
@@ -40090,8 +40222,8 @@ function resolveJobList(customDir) {
|
|
|
40090
40222
|
}
|
|
40091
40223
|
|
|
40092
40224
|
// src/mcp/tools/get-job-result-tool.ts
|
|
40093
|
-
var GetJobResultInputSchema =
|
|
40094
|
-
jobId:
|
|
40225
|
+
var GetJobResultInputSchema = z83.object({
|
|
40226
|
+
jobId: z83.string().min(1).max(128).describe('Job ID returned by orchestrate({ mode: "async" })')
|
|
40095
40227
|
});
|
|
40096
40228
|
function getJobResultHandler(args) {
|
|
40097
40229
|
const parsed = GetJobResultInputSchema.safeParse(args);
|
|
@@ -40122,7 +40254,7 @@ function getJobResultHandler(args) {
|
|
|
40122
40254
|
function registerGetJobResultTool(server, deps) {
|
|
40123
40255
|
const logger58 = deps.logger ?? createLogger({ tool: "get_job_result" });
|
|
40124
40256
|
const toolSchema = {
|
|
40125
|
-
jobId:
|
|
40257
|
+
jobId: z83.string().min(1).max(128).describe('Job ID returned by orchestrate({ mode: "async" })')
|
|
40126
40258
|
};
|
|
40127
40259
|
const description = 'Read the result of an async-mode tool invocation by jobId. Returns the structured record (status, result | error, timestamps). Poll until status !== "pending". Stage-1 of epic #2631 \u2014 Stage 2 will fold this into query_task_state once StructuredTaskState gains the result field.';
|
|
40128
40260
|
const secureHandler = createSecureHandler(getJobResultHandler, {
|
|
@@ -40144,14 +40276,14 @@ function registerGetJobResultTool(server, deps) {
|
|
|
40144
40276
|
}
|
|
40145
40277
|
|
|
40146
40278
|
// src/mcp/tools/list-jobs-tool.ts
|
|
40147
|
-
import { z as
|
|
40279
|
+
import { z as z84 } from "zod";
|
|
40148
40280
|
var MAX_LIST_JOBS_RESULTS = 200;
|
|
40149
|
-
var ListJobsInputSchema =
|
|
40281
|
+
var ListJobsInputSchema = z84.object({
|
|
40150
40282
|
/**
|
|
40151
40283
|
* Filter to jobs from a specific tool (exact match — e.g. `'orchestrate'`).
|
|
40152
40284
|
* Omit to list every tool's jobs.
|
|
40153
40285
|
*/
|
|
40154
|
-
toolName:
|
|
40286
|
+
toolName: z84.string().min(1).max(128).optional().describe("Filter to one tool (exact match)."),
|
|
40155
40287
|
/**
|
|
40156
40288
|
* Filter to jobs in a specific lifecycle state.
|
|
40157
40289
|
* Omit to list every state.
|
|
@@ -40164,7 +40296,7 @@ var ListJobsInputSchema = z83.object({
|
|
|
40164
40296
|
* Newest jobs are returned first, so a smaller limit shows the most
|
|
40165
40297
|
* recent activity.
|
|
40166
40298
|
*/
|
|
40167
|
-
limit:
|
|
40299
|
+
limit: z84.number().int().min(1).max(MAX_LIST_JOBS_RESULTS).optional().describe(`Max summaries to return (1-${String(MAX_LIST_JOBS_RESULTS)}, newest first).`)
|
|
40168
40300
|
});
|
|
40169
40301
|
function listJobsHandler(args) {
|
|
40170
40302
|
const parsed = ListJobsInputSchema.safeParse(args);
|
|
@@ -40195,11 +40327,11 @@ function listJobsHandler(args) {
|
|
|
40195
40327
|
function registerListJobsTool(server, deps) {
|
|
40196
40328
|
const logger58 = deps.logger ?? createLogger({ tool: "list_jobs" });
|
|
40197
40329
|
const toolSchema = {
|
|
40198
|
-
toolName:
|
|
40330
|
+
toolName: z84.string().min(1).max(128).optional().describe("Filter to one tool (exact match)."),
|
|
40199
40331
|
status: JobStatusSchema.optional().describe(
|
|
40200
40332
|
"Filter to pending | complete | failed | cancelled. Omit for all."
|
|
40201
40333
|
),
|
|
40202
|
-
limit:
|
|
40334
|
+
limit: z84.number().int().min(1).max(MAX_LIST_JOBS_RESULTS).optional().describe(`Max summaries to return (1-${String(MAX_LIST_JOBS_RESULTS)}, newest first).`)
|
|
40203
40335
|
};
|
|
40204
40336
|
const description = "List async-mode jobs (cross-session discovery). Returns summaries \u2014 jobId, toolName, status, timestamps \u2014 newest first. Filter by toolName / status / limit. Result payloads excluded; fetch via get_job_result(jobId). Stage 5 of epic #2631.";
|
|
40205
40337
|
const secureHandler = createSecureHandler(listJobsHandler, {
|
|
@@ -40221,10 +40353,10 @@ function registerListJobsTool(server, deps) {
|
|
|
40221
40353
|
}
|
|
40222
40354
|
|
|
40223
40355
|
// src/mcp/tools/cancel-job-tool.ts
|
|
40224
|
-
import { z as
|
|
40225
|
-
var CancelJobInputSchema =
|
|
40226
|
-
jobId:
|
|
40227
|
-
reason:
|
|
40356
|
+
import { z as z85 } from "zod";
|
|
40357
|
+
var CancelJobInputSchema = z85.object({
|
|
40358
|
+
jobId: z85.string().min(1).max(128).describe("Job ID returned by orchestrate / run_workflow / consensus_vote in async mode"),
|
|
40359
|
+
reason: z85.string().max(1e3).optional().describe('Optional human-readable note (e.g. "user clicked cancel").')
|
|
40228
40360
|
});
|
|
40229
40361
|
function cancelJobHandler(args) {
|
|
40230
40362
|
const parsed = CancelJobInputSchema.safeParse(args);
|
|
@@ -40281,8 +40413,8 @@ function cancelPendingJob(jobId, toolName, reason) {
|
|
|
40281
40413
|
function registerCancelJobTool(server, deps) {
|
|
40282
40414
|
const logger58 = deps.logger ?? createLogger({ tool: "cancel_job" });
|
|
40283
40415
|
const toolSchema = {
|
|
40284
|
-
jobId:
|
|
40285
|
-
reason:
|
|
40416
|
+
jobId: z85.string().min(1).max(128).describe("Job ID returned by orchestrate / run_workflow / consensus_vote in async mode"),
|
|
40417
|
+
reason: z85.string().max(1e3).optional().describe('Optional human-readable note (e.g. "user clicked cancel").')
|
|
40286
40418
|
};
|
|
40287
40419
|
const description = "Mark an async-mode job as cancelled (#3042 Stage 1b / epic #2631). Same-process dispatcher unwinds via AbortSignal (#3035/#3038); cross-process workers observe via get_job_result. Idempotent \u2014 cancel-after-complete is a no-op (preserves the terminal record); second cancel returns already_cancelled.";
|
|
40288
40420
|
const secureHandler = createSecureHandler(cancelJobHandler, {
|
|
@@ -40304,7 +40436,7 @@ function registerCancelJobTool(server, deps) {
|
|
|
40304
40436
|
}
|
|
40305
40437
|
|
|
40306
40438
|
// src/audit/audit-types.ts
|
|
40307
|
-
import { z as
|
|
40439
|
+
import { z as z86 } from "zod";
|
|
40308
40440
|
var AuditError = class extends Error {
|
|
40309
40441
|
code = "AUDIT_ERROR";
|
|
40310
40442
|
context;
|
|
@@ -40316,7 +40448,7 @@ var AuditError = class extends Error {
|
|
|
40316
40448
|
this.context = options?.context;
|
|
40317
40449
|
}
|
|
40318
40450
|
};
|
|
40319
|
-
var AuditCategorySchema =
|
|
40451
|
+
var AuditCategorySchema = z86.enum([
|
|
40320
40452
|
"authentication",
|
|
40321
40453
|
// Login, logout, token refresh
|
|
40322
40454
|
"authorization",
|
|
@@ -40336,28 +40468,28 @@ var AuditCategorySchema = z85.enum([
|
|
|
40336
40468
|
"governance"
|
|
40337
40469
|
// Authority-tier transitions, ratification (Epic D, #3842)
|
|
40338
40470
|
]);
|
|
40339
|
-
var TierTransitionKindSchema =
|
|
40340
|
-
var TierTransitionTierSchema =
|
|
40341
|
-
var TierTransitionPayloadSchema =
|
|
40471
|
+
var TierTransitionKindSchema = z86.enum(["promotion", "demotion"]);
|
|
40472
|
+
var TierTransitionTierSchema = z86.enum(["observe", "suggest", "advisory", "enforce"]);
|
|
40473
|
+
var TierTransitionPayloadSchema = z86.object({
|
|
40342
40474
|
/** Whether the loop moved up (`promotion`) or down (`demotion`) the ladder. */
|
|
40343
40475
|
kind: TierTransitionKindSchema,
|
|
40344
40476
|
/** The loop/strategy whose tier changed (manifest `id` or loop identifier). */
|
|
40345
|
-
subject:
|
|
40477
|
+
subject: z86.string().min(1),
|
|
40346
40478
|
/** Tier before the transition. */
|
|
40347
40479
|
fromTier: TierTransitionTierSchema,
|
|
40348
40480
|
/** Tier after the transition. */
|
|
40349
40481
|
toTier: TierTransitionTierSchema,
|
|
40350
40482
|
/** Ref to the promotion-evidence record this transition was earned against. */
|
|
40351
|
-
evidenceRef:
|
|
40483
|
+
evidenceRef: z86.string().min(1),
|
|
40352
40484
|
/**
|
|
40353
40485
|
* Ref to the recorded `consensus_vote` that ratified a PROMOTION. Required
|
|
40354
40486
|
* by the ratification gate for `kind: 'promotion'`; legitimately absent for
|
|
40355
40487
|
* `kind: 'demotion'` (automatic, ADR-0017 §"Demotion is automatic").
|
|
40356
40488
|
*/
|
|
40357
|
-
ratificationVoteRef:
|
|
40489
|
+
ratificationVoteRef: z86.string().min(1).optional()
|
|
40358
40490
|
}).strict();
|
|
40359
40491
|
var TIER_TRANSITION_METADATA_KEY = "tierTransition";
|
|
40360
|
-
var AuditSeveritySchema =
|
|
40492
|
+
var AuditSeveritySchema = z86.enum([
|
|
40361
40493
|
"info",
|
|
40362
40494
|
// Normal operations
|
|
40363
40495
|
"warning",
|
|
@@ -40365,7 +40497,7 @@ var AuditSeveritySchema = z85.enum([
|
|
|
40365
40497
|
"critical"
|
|
40366
40498
|
// Security violations, failures
|
|
40367
40499
|
]);
|
|
40368
|
-
var AuditOutcomeSchema =
|
|
40500
|
+
var AuditOutcomeSchema = z86.enum([
|
|
40369
40501
|
"success",
|
|
40370
40502
|
// Operation completed successfully
|
|
40371
40503
|
"failure",
|
|
@@ -40375,61 +40507,61 @@ var AuditOutcomeSchema = z85.enum([
|
|
|
40375
40507
|
"error"
|
|
40376
40508
|
// Unexpected error occurred
|
|
40377
40509
|
]);
|
|
40378
|
-
var AuditActorSchema =
|
|
40379
|
-
type:
|
|
40380
|
-
id:
|
|
40381
|
-
name:
|
|
40382
|
-
ip:
|
|
40383
|
-
userAgent:
|
|
40510
|
+
var AuditActorSchema = z86.object({
|
|
40511
|
+
type: z86.enum(["user", "agent", "system", "external"]),
|
|
40512
|
+
id: z86.string().min(1),
|
|
40513
|
+
name: z86.string().optional(),
|
|
40514
|
+
ip: z86.string().optional(),
|
|
40515
|
+
userAgent: z86.string().optional()
|
|
40384
40516
|
});
|
|
40385
|
-
var AuditResourceSchema =
|
|
40386
|
-
type:
|
|
40517
|
+
var AuditResourceSchema = z86.object({
|
|
40518
|
+
type: z86.string().min(1),
|
|
40387
40519
|
// e.g., 'file', 'tool', 'config', 'agent'
|
|
40388
|
-
id:
|
|
40389
|
-
name:
|
|
40390
|
-
path:
|
|
40520
|
+
id: z86.string().min(1),
|
|
40521
|
+
name: z86.string().optional(),
|
|
40522
|
+
path: z86.string().optional()
|
|
40391
40523
|
});
|
|
40392
|
-
var AuditEventSchema =
|
|
40524
|
+
var AuditEventSchema = z86.object({
|
|
40393
40525
|
// Identity
|
|
40394
|
-
id:
|
|
40526
|
+
id: z86.string().min(1),
|
|
40395
40527
|
// Unique event ID
|
|
40396
|
-
version:
|
|
40528
|
+
version: z86.literal("1.0"),
|
|
40397
40529
|
// Schema version for migrations
|
|
40398
40530
|
// Timing
|
|
40399
|
-
timestamp:
|
|
40531
|
+
timestamp: z86.string(),
|
|
40400
40532
|
// ISO 8601 format
|
|
40401
|
-
timestampMs:
|
|
40533
|
+
timestampMs: z86.number(),
|
|
40402
40534
|
// Unix epoch milliseconds
|
|
40403
40535
|
// Classification
|
|
40404
40536
|
category: AuditCategorySchema,
|
|
40405
40537
|
severity: AuditSeveritySchema,
|
|
40406
40538
|
outcome: AuditOutcomeSchema,
|
|
40407
40539
|
// Event details
|
|
40408
|
-
action:
|
|
40540
|
+
action: z86.string().min(1),
|
|
40409
40541
|
// e.g., 'tool.invoke', 'policy.evaluate'
|
|
40410
|
-
description:
|
|
40542
|
+
description: z86.string().optional(),
|
|
40411
40543
|
// Actors and resources
|
|
40412
40544
|
actor: AuditActorSchema,
|
|
40413
40545
|
resource: AuditResourceSchema.optional(),
|
|
40414
40546
|
// Correlation
|
|
40415
|
-
requestId:
|
|
40547
|
+
requestId: z86.string().optional(),
|
|
40416
40548
|
// Request correlation ID
|
|
40417
|
-
traceId:
|
|
40549
|
+
traceId: z86.string().optional(),
|
|
40418
40550
|
// Distributed trace ID
|
|
40419
|
-
sessionId:
|
|
40551
|
+
sessionId: z86.string().optional(),
|
|
40420
40552
|
// Session correlation ID
|
|
40421
40553
|
// Context
|
|
40422
|
-
toolName:
|
|
40423
|
-
durationMs:
|
|
40424
|
-
metadata:
|
|
40554
|
+
toolName: z86.string().optional(),
|
|
40555
|
+
durationMs: z86.number().optional(),
|
|
40556
|
+
metadata: z86.record(z86.string(), z86.unknown()).optional(),
|
|
40425
40557
|
// Policy and security
|
|
40426
|
-
policyName:
|
|
40427
|
-
policyDecision:
|
|
40428
|
-
violationType:
|
|
40558
|
+
policyName: z86.string().optional(),
|
|
40559
|
+
policyDecision: z86.string().optional(),
|
|
40560
|
+
violationType: z86.string().optional(),
|
|
40429
40561
|
// Integrity (for tamper-evidence)
|
|
40430
|
-
previousHash:
|
|
40562
|
+
previousHash: z86.string().optional(),
|
|
40431
40563
|
// Hash of previous event (chain)
|
|
40432
|
-
hash:
|
|
40564
|
+
hash: z86.string().optional(),
|
|
40433
40565
|
// Hash of this event
|
|
40434
40566
|
/**
|
|
40435
40567
|
* Hash-projection version (#3921). ABSENT/`1` = the legacy projection
|
|
@@ -40439,60 +40571,60 @@ var AuditEventSchema = z85.object({
|
|
|
40439
40571
|
* Versioned so pre-existing v1 chains keep verifying under their own
|
|
40440
40572
|
* projection (see {@link AUDIT_HASH_VERSION_TIER_TRANSITION}).
|
|
40441
40573
|
*/
|
|
40442
|
-
hashVersion:
|
|
40574
|
+
hashVersion: z86.number().int().positive().optional()
|
|
40443
40575
|
});
|
|
40444
40576
|
var AUDIT_HASH_VERSION_TIER_TRANSITION = 2;
|
|
40445
|
-
var AuditEventInputSchema =
|
|
40577
|
+
var AuditEventInputSchema = z86.object({
|
|
40446
40578
|
category: AuditCategorySchema,
|
|
40447
40579
|
severity: AuditSeveritySchema.optional().default("info"),
|
|
40448
40580
|
outcome: AuditOutcomeSchema,
|
|
40449
|
-
action:
|
|
40450
|
-
description:
|
|
40581
|
+
action: z86.string().min(1),
|
|
40582
|
+
description: z86.string().optional(),
|
|
40451
40583
|
actor: AuditActorSchema,
|
|
40452
40584
|
resource: AuditResourceSchema.optional(),
|
|
40453
|
-
requestId:
|
|
40454
|
-
traceId:
|
|
40455
|
-
sessionId:
|
|
40456
|
-
toolName:
|
|
40457
|
-
durationMs:
|
|
40458
|
-
metadata:
|
|
40459
|
-
policyName:
|
|
40460
|
-
policyDecision:
|
|
40461
|
-
violationType:
|
|
40585
|
+
requestId: z86.string().optional(),
|
|
40586
|
+
traceId: z86.string().optional(),
|
|
40587
|
+
sessionId: z86.string().optional(),
|
|
40588
|
+
toolName: z86.string().optional(),
|
|
40589
|
+
durationMs: z86.number().optional(),
|
|
40590
|
+
metadata: z86.record(z86.string(), z86.unknown()).optional(),
|
|
40591
|
+
policyName: z86.string().optional(),
|
|
40592
|
+
policyDecision: z86.string().optional(),
|
|
40593
|
+
violationType: z86.string().optional()
|
|
40462
40594
|
});
|
|
40463
|
-
var AuditLogConfigSchema =
|
|
40595
|
+
var AuditLogConfigSchema = z86.object({
|
|
40464
40596
|
// Storage
|
|
40465
|
-
logDir:
|
|
40466
|
-
filePrefix:
|
|
40467
|
-
maxFileSizeBytes:
|
|
40597
|
+
logDir: z86.string().min(1),
|
|
40598
|
+
filePrefix: z86.string().optional().default("audit"),
|
|
40599
|
+
maxFileSizeBytes: z86.number().positive().optional().default(10 * 1024 * 1024),
|
|
40468
40600
|
// 10MB
|
|
40469
|
-
maxFiles:
|
|
40601
|
+
maxFiles: z86.number().positive().optional().default(10),
|
|
40470
40602
|
// Features
|
|
40471
|
-
enableHashChain:
|
|
40472
|
-
enableCompression:
|
|
40473
|
-
flushIntervalMs:
|
|
40603
|
+
enableHashChain: z86.boolean().optional().default(true),
|
|
40604
|
+
enableCompression: z86.boolean().optional().default(false),
|
|
40605
|
+
flushIntervalMs: z86.number().positive().optional().default(1e3),
|
|
40474
40606
|
/**
|
|
40475
40607
|
* Maximum in-memory event queue depth before drop-oldest backpressure
|
|
40476
40608
|
* engages. Bounds memory under load when storage.write is slow or the flush
|
|
40477
40609
|
* timer is overlapping; see #2979.
|
|
40478
40610
|
*/
|
|
40479
|
-
maxQueueDepth:
|
|
40611
|
+
maxQueueDepth: z86.number().positive().optional().default(1e4),
|
|
40480
40612
|
// Filtering
|
|
40481
40613
|
minSeverity: AuditSeveritySchema.optional().default("info"),
|
|
40482
|
-
categories:
|
|
40614
|
+
categories: z86.array(AuditCategorySchema).optional()
|
|
40483
40615
|
});
|
|
40484
|
-
var AuditQueryCriteriaSchema =
|
|
40485
|
-
startTime:
|
|
40486
|
-
endTime:
|
|
40487
|
-
categories:
|
|
40488
|
-
severities:
|
|
40489
|
-
outcomes:
|
|
40490
|
-
actorId:
|
|
40491
|
-
resourceId:
|
|
40492
|
-
requestId:
|
|
40493
|
-
traceId:
|
|
40494
|
-
limit:
|
|
40495
|
-
offset:
|
|
40616
|
+
var AuditQueryCriteriaSchema = z86.object({
|
|
40617
|
+
startTime: z86.date().optional(),
|
|
40618
|
+
endTime: z86.date().optional(),
|
|
40619
|
+
categories: z86.array(AuditCategorySchema).optional(),
|
|
40620
|
+
severities: z86.array(AuditSeveritySchema).optional(),
|
|
40621
|
+
outcomes: z86.array(AuditOutcomeSchema).optional(),
|
|
40622
|
+
actorId: z86.string().optional(),
|
|
40623
|
+
resourceId: z86.string().optional(),
|
|
40624
|
+
requestId: z86.string().optional(),
|
|
40625
|
+
traceId: z86.string().optional(),
|
|
40626
|
+
limit: z86.number().positive().optional().default(100),
|
|
40627
|
+
offset: z86.number().nonnegative().optional().default(0)
|
|
40496
40628
|
});
|
|
40497
40629
|
|
|
40498
40630
|
// src/audit/audit-storage-queries.ts
|
|
@@ -40753,27 +40885,27 @@ var FileAuditStorage = class _FileAuditStorage {
|
|
|
40753
40885
|
const data = this.writeBuffer.join("");
|
|
40754
40886
|
this.writeBuffer = [];
|
|
40755
40887
|
const stream = this.writeStream;
|
|
40756
|
-
return new Promise((
|
|
40888
|
+
return new Promise((resolve20, reject) => {
|
|
40757
40889
|
stream.write(data, (err2) => {
|
|
40758
40890
|
if (err2 !== void 0 && err2 !== null) {
|
|
40759
40891
|
reject(new AuditError("Failed to flush audit log", { cause: err2 }));
|
|
40760
40892
|
} else {
|
|
40761
|
-
|
|
40893
|
+
resolve20();
|
|
40762
40894
|
}
|
|
40763
40895
|
});
|
|
40764
40896
|
});
|
|
40765
40897
|
}
|
|
40766
40898
|
async close() {
|
|
40767
40899
|
await this.flush();
|
|
40768
|
-
return new Promise((
|
|
40900
|
+
return new Promise((resolve20) => {
|
|
40769
40901
|
if (this.writeStream === null) {
|
|
40770
|
-
|
|
40902
|
+
resolve20();
|
|
40771
40903
|
return;
|
|
40772
40904
|
}
|
|
40773
40905
|
this.writeStream.end(() => {
|
|
40774
40906
|
this.writeStream = null;
|
|
40775
40907
|
this.logger.info("Audit storage closed");
|
|
40776
|
-
|
|
40908
|
+
resolve20();
|
|
40777
40909
|
});
|
|
40778
40910
|
});
|
|
40779
40911
|
}
|
|
@@ -41674,7 +41806,7 @@ async function tryIssueTriage(task) {
|
|
|
41674
41806
|
try {
|
|
41675
41807
|
const issueMatch = task.match(/github\.com\/([^/]+\/[^/]+)\/issues\/(\d+)/);
|
|
41676
41808
|
if (issueMatch === null) return null;
|
|
41677
|
-
const { createIssueTriage } = await import("./issue-triage-
|
|
41809
|
+
const { createIssueTriage } = await import("./issue-triage-WWQEY7PL.js");
|
|
41678
41810
|
const triage = createIssueTriage();
|
|
41679
41811
|
const owner = issueMatch[1] ?? "";
|
|
41680
41812
|
const num = issueMatch[2] ?? "";
|
|
@@ -41702,7 +41834,7 @@ var VALID_TEMPLATES = /* @__PURE__ */ new Set([
|
|
|
41702
41834
|
]);
|
|
41703
41835
|
async function classifyWithLLM(task) {
|
|
41704
41836
|
try {
|
|
41705
|
-
const { executeExpert: executeExpert2 } = await import("./expert-bridge-
|
|
41837
|
+
const { executeExpert: executeExpert2 } = await import("./expert-bridge-B3EFTAID.js");
|
|
41706
41838
|
const prompt = [
|
|
41707
41839
|
"Classify this task into exactly one pipeline template.",
|
|
41708
41840
|
"Templates: dev (implementation/bug fix/refactor), research (investigate/evaluate/compare),",
|
|
@@ -41810,7 +41942,7 @@ function ensureRunnableTemplate(template, stages) {
|
|
|
41810
41942
|
// src/pipeline/pipeline-checkpoint.ts
|
|
41811
41943
|
import * as fs7 from "fs";
|
|
41812
41944
|
import * as path5 from "path";
|
|
41813
|
-
import { z as
|
|
41945
|
+
import { z as z87 } from "zod";
|
|
41814
41946
|
var logger38 = createLogger({ component: "pipeline-checkpoint" });
|
|
41815
41947
|
var SESSION_ID_REGEX = /^[a-zA-Z0-9_-]{1,128}$/;
|
|
41816
41948
|
function validateSessionId(sessionId) {
|
|
@@ -41858,7 +41990,7 @@ function loadCheckpointState(sessionId, customDir) {
|
|
|
41858
41990
|
return null;
|
|
41859
41991
|
}
|
|
41860
41992
|
}
|
|
41861
|
-
var PipelineStageSchema =
|
|
41993
|
+
var PipelineStageSchema = z87.enum([
|
|
41862
41994
|
"research",
|
|
41863
41995
|
"plan",
|
|
41864
41996
|
"vote",
|
|
@@ -41866,27 +41998,27 @@ var PipelineStageSchema = z86.enum([
|
|
|
41866
41998
|
"implement",
|
|
41867
41999
|
"security"
|
|
41868
42000
|
]);
|
|
41869
|
-
var PipelineStageDataSchema =
|
|
41870
|
-
|
|
41871
|
-
|
|
41872
|
-
|
|
41873
|
-
type:
|
|
41874
|
-
approved:
|
|
41875
|
-
conditional:
|
|
41876
|
-
conditions:
|
|
41877
|
-
caveats:
|
|
41878
|
-
iterations:
|
|
42001
|
+
var PipelineStageDataSchema = z87.discriminatedUnion("type", [
|
|
42002
|
+
z87.object({ type: z87.literal("research"), text: z87.string() }),
|
|
42003
|
+
z87.object({ type: z87.literal("plan"), text: z87.string(), iterations: z87.number() }),
|
|
42004
|
+
z87.object({
|
|
42005
|
+
type: z87.literal("vote"),
|
|
42006
|
+
approved: z87.boolean(),
|
|
42007
|
+
conditional: z87.boolean(),
|
|
42008
|
+
conditions: z87.array(z87.string()).optional(),
|
|
42009
|
+
caveats: z87.array(z87.string()).optional(),
|
|
42010
|
+
iterations: z87.number()
|
|
41879
42011
|
}),
|
|
41880
42012
|
// PipelineTask shape is loose at the persistence layer — capture as
|
|
41881
42013
|
// `z.unknown()` and trust the downstream consumer's narrower validation.
|
|
41882
|
-
|
|
41883
|
-
|
|
41884
|
-
|
|
42014
|
+
z87.object({ type: z87.literal("decompose"), tasks: z87.array(z87.unknown()) }),
|
|
42015
|
+
z87.object({ type: z87.literal("implement"), tasks: z87.array(z87.unknown()) }),
|
|
42016
|
+
z87.object({ type: z87.literal("security"), passed: z87.boolean() })
|
|
41885
42017
|
]);
|
|
41886
|
-
var PipelineCheckpointEntrySchema =
|
|
41887
|
-
sessionId:
|
|
42018
|
+
var PipelineCheckpointEntrySchema = z87.object({
|
|
42019
|
+
sessionId: z87.string(),
|
|
41888
42020
|
stage: PipelineStageSchema,
|
|
41889
|
-
timestamp:
|
|
42021
|
+
timestamp: z87.string(),
|
|
41890
42022
|
data: PipelineStageDataSchema
|
|
41891
42023
|
});
|
|
41892
42024
|
function rebuildState(lines) {
|
|
@@ -42706,8 +42838,8 @@ async function executeSecurityScan(input) {
|
|
|
42706
42838
|
}
|
|
42707
42839
|
|
|
42708
42840
|
// src/security/finding-lifecycle.ts
|
|
42709
|
-
import { z as
|
|
42710
|
-
var FindingLifecycleStageSchema =
|
|
42841
|
+
import { z as z88 } from "zod";
|
|
42842
|
+
var FindingLifecycleStageSchema = z88.enum([
|
|
42711
42843
|
"detected",
|
|
42712
42844
|
"triaged",
|
|
42713
42845
|
"fix_generated",
|
|
@@ -42793,14 +42925,14 @@ function summarizeLifecycle(entries) {
|
|
|
42793
42925
|
}
|
|
42794
42926
|
|
|
42795
42927
|
// src/security/finding-triage.ts
|
|
42796
|
-
import { z as
|
|
42928
|
+
import { z as z89 } from "zod";
|
|
42797
42929
|
import { readFileSync as readFileSync6 } from "fs";
|
|
42798
42930
|
var logger42 = createLogger({ component: "security-finding-triage" });
|
|
42799
|
-
var TriageVerdictSchema =
|
|
42800
|
-
confirmed:
|
|
42801
|
-
confidence:
|
|
42802
|
-
reasoning:
|
|
42803
|
-
suggestedSeverity:
|
|
42931
|
+
var TriageVerdictSchema = z89.object({
|
|
42932
|
+
confirmed: z89.boolean(),
|
|
42933
|
+
confidence: z89.number().min(0).max(1),
|
|
42934
|
+
reasoning: z89.string().max(1e3),
|
|
42935
|
+
suggestedSeverity: z89.enum(FINDING_SEVERITY_LEVELS)
|
|
42804
42936
|
});
|
|
42805
42937
|
var DEFAULT_CONFIG3 = {
|
|
42806
42938
|
maxFindings: 10,
|
|
@@ -42910,18 +43042,18 @@ async function triageFindings(findings, delegateFn, config = DEFAULT_CONFIG3) {
|
|
|
42910
43042
|
}
|
|
42911
43043
|
|
|
42912
43044
|
// src/security/osv-lookup.ts
|
|
42913
|
-
import { z as
|
|
43045
|
+
import { z as z90 } from "zod";
|
|
42914
43046
|
var logger43 = createLogger({ component: "osv-lookup" });
|
|
42915
43047
|
var OSV_API_URL = "https://api.osv.dev/v1/query";
|
|
42916
43048
|
var DEFAULT_TIMEOUT_MS4 = NETWORK_FETCH_TIMEOUT_MS;
|
|
42917
|
-
var OsvVulnerabilitySchema =
|
|
42918
|
-
id:
|
|
42919
|
-
summary:
|
|
42920
|
-
severity:
|
|
42921
|
-
aliases:
|
|
42922
|
-
affectedVersions:
|
|
42923
|
-
fixedVersion:
|
|
42924
|
-
url:
|
|
43049
|
+
var OsvVulnerabilitySchema = z90.object({
|
|
43050
|
+
id: z90.string(),
|
|
43051
|
+
summary: z90.string().optional(),
|
|
43052
|
+
severity: z90.enum(["CRITICAL", "HIGH", "MODERATE", "LOW", "UNKNOWN"]).optional(),
|
|
43053
|
+
aliases: z90.array(z90.string()).default([]),
|
|
43054
|
+
affectedVersions: z90.string().optional(),
|
|
43055
|
+
fixedVersion: z90.string().optional(),
|
|
43056
|
+
url: z90.string().optional()
|
|
42925
43057
|
});
|
|
42926
43058
|
var DEFAULT_OSV_CONFIG = {
|
|
42927
43059
|
timeoutMs: DEFAULT_TIMEOUT_MS4
|
|
@@ -43343,7 +43475,7 @@ var memoryInitPromise = null;
|
|
|
43343
43475
|
async function initPipelineMemory() {
|
|
43344
43476
|
if (cachedMemory !== null) return cachedMemory;
|
|
43345
43477
|
try {
|
|
43346
|
-
const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-
|
|
43478
|
+
const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-RJZ447UX.js");
|
|
43347
43479
|
const { getLearningDir } = await import("./learning-persistence-6D5GGT7D.js");
|
|
43348
43480
|
const mem = createSessionMemory2(getLearningDir());
|
|
43349
43481
|
mem.startSession(`pipeline-${String(getTimeProvider().now())}`);
|
|
@@ -43405,7 +43537,7 @@ function recordRoutingExperience(category, success, durationMs, tokensUsed = 0,
|
|
|
43405
43537
|
callRecord(routingMemoryCache);
|
|
43406
43538
|
return;
|
|
43407
43539
|
}
|
|
43408
|
-
routingMemoryInitPromise ??= import("./routing-memory-
|
|
43540
|
+
routingMemoryInitPromise ??= import("./routing-memory-JTNH2BXS.js").then(({ createRoutingMemory }) => {
|
|
43409
43541
|
routingMemoryCache ??= createRoutingMemory();
|
|
43410
43542
|
return routingMemoryCache;
|
|
43411
43543
|
}).catch((error) => {
|
|
@@ -43439,7 +43571,7 @@ ${text}` : "";
|
|
|
43439
43571
|
}
|
|
43440
43572
|
async function getWeatherContext() {
|
|
43441
43573
|
try {
|
|
43442
|
-
const { generateWeatherReport: generateWeatherReport2 } = await import("./weather-report-
|
|
43574
|
+
const { generateWeatherReport: generateWeatherReport2 } = await import("./weather-report-ID4ZNUAF.js");
|
|
43443
43575
|
const report = generateWeatherReport2({ includeAdaptive: true });
|
|
43444
43576
|
const mappings = "recommendedMappings" in report ? report.recommendedMappings : [];
|
|
43445
43577
|
if (!Array.isArray(mappings) || mappings.length === 0) return "";
|
|
@@ -43457,7 +43589,7 @@ ${lines}
|
|
|
43457
43589
|
}
|
|
43458
43590
|
async function getMemoryContext(task) {
|
|
43459
43591
|
try {
|
|
43460
|
-
const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-
|
|
43592
|
+
const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-RJZ447UX.js");
|
|
43461
43593
|
const { getLearningDir } = await import("./learning-persistence-6D5GGT7D.js");
|
|
43462
43594
|
const memory = createSessionMemory2(getLearningDir(), { maxLearningsInContext: 10 });
|
|
43463
43595
|
const learnings = memory.searchLearnings(task.slice(0, 200));
|
|
@@ -43572,7 +43704,7 @@ ${contextBlock}`;
|
|
|
43572
43704
|
const strategy = config.votingStrategy ?? "higher_order";
|
|
43573
43705
|
await postProgress(config, "Vote", `Running consensus with ${strategy} strategy...`);
|
|
43574
43706
|
try {
|
|
43575
|
-
const { executeVoting } = await import("./consensus-vote-
|
|
43707
|
+
const { executeVoting } = await import("./consensus-vote-USZFJO2K.js");
|
|
43576
43708
|
const votingResult = await executeVoting(
|
|
43577
43709
|
{
|
|
43578
43710
|
proposal: buildVoteProposal(plan, research),
|
|
@@ -43998,7 +44130,7 @@ function createScaffoldStageWrapper() {
|
|
|
43998
44130
|
}
|
|
43999
44131
|
async function searchCodebaseForTask(task) {
|
|
44000
44132
|
try {
|
|
44001
|
-
const { CodebaseIndex: CodebaseIndex2 } = await import("./codebase-search-
|
|
44133
|
+
const { CodebaseIndex: CodebaseIndex2 } = await import("./codebase-search-LUF5YJLQ.js");
|
|
44002
44134
|
const index = new CodebaseIndex2(process.cwd());
|
|
44003
44135
|
const terms = task.toLowerCase().split(/\s+/).filter((w) => w.length > 4).slice(0, 3);
|
|
44004
44136
|
if (terms.length === 0) return null;
|
|
@@ -44013,7 +44145,7 @@ async function searchCodebaseForTask(task) {
|
|
|
44013
44145
|
}
|
|
44014
44146
|
async function queryResearchRegistry(task) {
|
|
44015
44147
|
try {
|
|
44016
|
-
const { synthesizeResearch: synthesizeResearch2 } = await import("./research-helpers-synthesize-
|
|
44148
|
+
const { synthesizeResearch: synthesizeResearch2 } = await import("./research-helpers-synthesize-XSOFXRFK.js");
|
|
44017
44149
|
const topic = task.split(/[.!?\n]/).filter((s) => s.trim().length > 10)[0]?.trim();
|
|
44018
44150
|
if (topic === void 0) return null;
|
|
44019
44151
|
const result = await synthesizeResearch2(topic.slice(0, 50));
|
|
@@ -44084,7 +44216,7 @@ function createScanStageWrapper() {
|
|
|
44084
44216
|
try {
|
|
44085
44217
|
const slug = ctx.task.match(/([a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+)/)?.[1];
|
|
44086
44218
|
if (slug !== void 0) {
|
|
44087
|
-
const { generateSecurityPlan: generateSecurityPlan2 } = await import("./repo-security-plan-
|
|
44219
|
+
const { generateSecurityPlan: generateSecurityPlan2 } = await import("./repo-security-plan-IYKDY5PW.js");
|
|
44088
44220
|
const plan = await generateSecurityPlan2({ repo: slug, maxScanners: 10 });
|
|
44089
44221
|
const recs = plan.recommendations.slice(0, 5).map((r) => `${r.priority}: ${r.displayName} (${r.category})`).join("; ");
|
|
44090
44222
|
return output(PIPELINE_STATE_KEYS.FINDINGS, recs, getTimeProvider().now() - start, true);
|
|
@@ -44124,7 +44256,7 @@ function createAuditStageRegistry() {
|
|
|
44124
44256
|
}
|
|
44125
44257
|
|
|
44126
44258
|
// src/mcp/tools/pr-review-tool.ts
|
|
44127
|
-
import { z as
|
|
44259
|
+
import { z as z92 } from "zod";
|
|
44128
44260
|
import { randomUUID as randomUUID13 } from "crypto";
|
|
44129
44261
|
|
|
44130
44262
|
// src/mcp/tools/pr-review-findings.ts
|
|
@@ -44236,20 +44368,20 @@ function reviewedDiffWasTruncated(diff) {
|
|
|
44236
44368
|
|
|
44237
44369
|
// src/audit/pr-review-record-store.ts
|
|
44238
44370
|
import { appendFileSync as appendFileSync4, existsSync as existsSync9, mkdirSync as mkdirSync6, readFileSync as readFileSync7 } from "fs";
|
|
44239
|
-
import { dirname as dirname4, isAbsolute, join as join9, resolve as
|
|
44371
|
+
import { dirname as dirname4, isAbsolute, join as join9, resolve as resolve13 } from "path";
|
|
44240
44372
|
|
|
44241
44373
|
// src/audit/pr-review-record.ts
|
|
44242
44374
|
import * as crypto3 from "crypto";
|
|
44243
|
-
import { z as
|
|
44244
|
-
var PrReviewVerdictSchema =
|
|
44245
|
-
var PrReviewVoteCountsSchema =
|
|
44246
|
-
approve:
|
|
44247
|
-
request_changes:
|
|
44248
|
-
abstain:
|
|
44249
|
-
error:
|
|
44250
|
-
total:
|
|
44375
|
+
import { z as z91 } from "zod";
|
|
44376
|
+
var PrReviewVerdictSchema = z91.enum(["approve", "request_changes", "abstain"]);
|
|
44377
|
+
var PrReviewVoteCountsSchema = z91.object({
|
|
44378
|
+
approve: z91.number().int().nonnegative(),
|
|
44379
|
+
request_changes: z91.number().int().nonnegative(),
|
|
44380
|
+
abstain: z91.number().int().nonnegative(),
|
|
44381
|
+
error: z91.number().int().nonnegative(),
|
|
44382
|
+
total: z91.number().int().nonnegative()
|
|
44251
44383
|
}).strict();
|
|
44252
|
-
var PrReviewRecordSchema =
|
|
44384
|
+
var PrReviewRecordSchema = z91.object({
|
|
44253
44385
|
/**
|
|
44254
44386
|
* Schema version. '1.1' is the Option-C binding (#3831): the record binds to
|
|
44255
44387
|
* `{prNumber, baseSha, reviewedDiffHash}` instead of the rejected `headSha`.
|
|
@@ -44257,22 +44389,22 @@ var PrReviewRecordSchema = z90.object({
|
|
|
44257
44389
|
* empty on every install (no producer ever wrote a '1.0' record), so there is
|
|
44258
44390
|
* no '1.0' data to migrate.
|
|
44259
44391
|
*/
|
|
44260
|
-
version:
|
|
44392
|
+
version: z91.literal("1.1"),
|
|
44261
44393
|
/**
|
|
44262
44394
|
* Monotonic sequence number (integer ≥ 0). Assigned as (max existing
|
|
44263
44395
|
* sequence)+1 at write time. Sorted, the set of sequences must cover
|
|
44264
44396
|
* 0..maxSeq with no gap (omission detection); DUPLICATE sequences are a
|
|
44265
44397
|
* benign concurrent-fork signal, not tampering.
|
|
44266
44398
|
*/
|
|
44267
|
-
sequence:
|
|
44399
|
+
sequence: z91.number().int().nonnegative(),
|
|
44268
44400
|
/** The PR number the review covers. */
|
|
44269
|
-
prNumber:
|
|
44401
|
+
prNumber: z91.number().int().positive(),
|
|
44270
44402
|
/**
|
|
44271
44403
|
* The 40-hex BASE commit SHA the reviewed diff was computed against (the
|
|
44272
44404
|
* `<base>..<head>` range base). Part of the Option-C binding so the gate knows
|
|
44273
44405
|
* which range to recompute {@link reviewedDiffHash} over.
|
|
44274
44406
|
*/
|
|
44275
|
-
baseSha:
|
|
44407
|
+
baseSha: z91.string().regex(/^[0-9a-f]{40}$/, "baseSha must be a 40-char lowercase hex commit sha"),
|
|
44276
44408
|
/**
|
|
44277
44409
|
* DIFF-BINDING (Option-C, #3831): sha256 of the canonical reviewed diff bytes
|
|
44278
44410
|
* (see `audit/reviewed-diff-hash.ts` — pinned `git diff` invocation + 50k
|
|
@@ -44281,9 +44413,9 @@ var PrReviewRecordSchema = z90.object({
|
|
|
44281
44413
|
* byte-identical to what the voters saw. Covered by the self-hash below, so it
|
|
44282
44414
|
* cannot be edited to claim a different reviewed diff.
|
|
44283
44415
|
*/
|
|
44284
|
-
reviewedDiffHash:
|
|
44416
|
+
reviewedDiffHash: z91.string().length(64),
|
|
44285
44417
|
/** ISO-8601 timestamp the review was recorded. */
|
|
44286
|
-
recordedAt:
|
|
44418
|
+
recordedAt: z91.string().min(1),
|
|
44287
44419
|
/** The resolved aggregate verdict. */
|
|
44288
44420
|
verdict: PrReviewVerdictSchema,
|
|
44289
44421
|
/**
|
|
@@ -44291,21 +44423,21 @@ var PrReviewRecordSchema = z90.object({
|
|
|
44291
44423
|
* `request_changes` with `verified: true` is a strict blocker; covered by the
|
|
44292
44424
|
* hash so it cannot be flipped without detection.
|
|
44293
44425
|
*/
|
|
44294
|
-
verified:
|
|
44426
|
+
verified: z91.boolean(),
|
|
44295
44427
|
/** Per-decision voter tally from the pr_review aggregate. */
|
|
44296
44428
|
voteCounts: PrReviewVoteCountsSchema,
|
|
44297
44429
|
/** Truncated human-readable review summary for the reviewer record. */
|
|
44298
|
-
summary:
|
|
44430
|
+
summary: z91.string(),
|
|
44299
44431
|
/** Optional correlation/decision id linking to the cost rollup / trace. */
|
|
44300
|
-
correlationId:
|
|
44432
|
+
correlationId: z91.string().min(1).optional(),
|
|
44301
44433
|
/**
|
|
44302
44434
|
* ADVISORY hash of the tip record at write time (absent for the first).
|
|
44303
44435
|
* Retained for audit texture but NOT covered by `hash` and NOT verified —
|
|
44304
44436
|
* the record-set model is position-independent (mirrors #3927).
|
|
44305
44437
|
*/
|
|
44306
|
-
previousHash:
|
|
44438
|
+
previousHash: z91.string().length(64).optional(),
|
|
44307
44439
|
/** SHA-256 over every field above EXCEPT `previousHash` (and except `hash`). */
|
|
44308
|
-
hash:
|
|
44440
|
+
hash: z91.string().length(64)
|
|
44309
44441
|
}).strict();
|
|
44310
44442
|
function computePrReviewRecordHash(payload) {
|
|
44311
44443
|
const canonical = JSON.stringify({
|
|
@@ -44363,7 +44495,7 @@ function buildPrReviewRecord(input) {
|
|
|
44363
44495
|
function resolvePrReviewRecordsPath() {
|
|
44364
44496
|
const envPath = process.env[PR_REVIEW_RECORDS_PATH_ENV];
|
|
44365
44497
|
if (envPath !== void 0 && envPath.trim() !== "") {
|
|
44366
|
-
return isAbsolute(envPath) ? envPath :
|
|
44498
|
+
return isAbsolute(envPath) ? envPath : resolve13(envPath);
|
|
44367
44499
|
}
|
|
44368
44500
|
const root = findRepoRoot(process.cwd());
|
|
44369
44501
|
if (root === null) return void 0;
|
|
@@ -44654,17 +44786,17 @@ var MAX_DIFF_INPUT_LENGTH = 2e6;
|
|
|
44654
44786
|
var MAX_REPO_CONTEXT_LENGTH = 2e3;
|
|
44655
44787
|
var MAX_DESCRIPTION_LENGTH = 1e4;
|
|
44656
44788
|
var PR_REVIEW_ASYNC_HINT = "A pr_review run fans out to 5 live LLM voters and can exceed the synchronous MCP request timeout. Retry with `dispatch: 'async'` to get a jobId immediately, then poll get_job_result({ jobId }) for the result.";
|
|
44657
|
-
var PrReviewInputSchema =
|
|
44658
|
-
prTitle:
|
|
44659
|
-
prDescription:
|
|
44660
|
-
prDiff:
|
|
44789
|
+
var PrReviewInputSchema = z92.object({
|
|
44790
|
+
prTitle: z92.string().min(1).max(500).describe("PR title"),
|
|
44791
|
+
prDescription: z92.string().max(MAX_DESCRIPTION_LENGTH).optional().describe("PR body / description"),
|
|
44792
|
+
prDiff: z92.string().min(1).max(MAX_DIFF_INPUT_LENGTH).describe(
|
|
44661
44793
|
`Unified diff text (max ${String(MAX_DIFF_INPUT_LENGTH)} chars). No need to truncate before calling: diffs over ${String(MAX_DIFF_LENGTH)} chars are security-prioritized and PARTIALLY reviewed (lowest-priority whole files dropped; coverage reported on the response, and a partial review can block but never verified-approve).`
|
|
44662
44794
|
),
|
|
44663
|
-
repoContext:
|
|
44795
|
+
repoContext: z92.string().max(MAX_REPO_CONTEXT_LENGTH).optional().describe(
|
|
44664
44796
|
`Optional one-paragraph repo context (architecture, conventions; max ${String(MAX_REPO_CONTEXT_LENGTH)} chars; trim before calling)`
|
|
44665
44797
|
),
|
|
44666
|
-
baseRef:
|
|
44667
|
-
headRef:
|
|
44798
|
+
baseRef: z92.string().max(200).optional().describe("Base branch ref (e.g. main)"),
|
|
44799
|
+
headRef: z92.string().max(200).optional().describe("Head branch ref"),
|
|
44668
44800
|
/**
|
|
44669
44801
|
* Option-C audit binding (#4031). When BOTH `prNumber` and `baseSha` are
|
|
44670
44802
|
* supplied AND the review is live (not simulated), pr_review persists an
|
|
@@ -44676,11 +44808,11 @@ var PrReviewInputSchema = z91.object({
|
|
|
44676
44808
|
* canonical `git diff <baseSha>..<headSha>` the gate recomputes (the hash
|
|
44677
44809
|
* truncates at that byte cap) — pass the canonical diff, not a reordered one.
|
|
44678
44810
|
*/
|
|
44679
|
-
prNumber:
|
|
44680
|
-
baseSha:
|
|
44811
|
+
prNumber: z92.number().int().positive().optional().describe("PR number \u2014 with baseSha, enables Option-C audit-record persistence (#4031)"),
|
|
44812
|
+
baseSha: z92.string().regex(/^[0-9a-f]{40}$/, "baseSha must be a 40-char lowercase hex commit sha").optional().describe(
|
|
44681
44813
|
"40-hex base commit sha the reviewed diff was computed from (Option-C binding, #4031)"
|
|
44682
44814
|
),
|
|
44683
|
-
simulate:
|
|
44815
|
+
simulate: z92.boolean().default(false).describe("Use simulated voters (testing only; never ship live with this true)"),
|
|
44684
44816
|
/**
|
|
44685
44817
|
* Error policy (#4132). `standard` (default) keeps the pre-#4132 aggregation:
|
|
44686
44818
|
* an errored voter is simply excluded from the panel. `absolute_quorum` gates
|
|
@@ -44692,7 +44824,7 @@ var PrReviewInputSchema = z91.object({
|
|
|
44692
44824
|
* verified approve. A genuine `request_changes` blocker still wins (Tiers 1-2
|
|
44693
44825
|
* run first).
|
|
44694
44826
|
*/
|
|
44695
|
-
errorPolicy:
|
|
44827
|
+
errorPolicy: z92.enum(["standard", "absolute_quorum"]).default("standard").describe(
|
|
44696
44828
|
"Error policy (#4132). 'standard' (default): errored voters excluded. 'absolute_quorum': any errored voter \u2014 esp. the contrarian \u2014 degrades a would-be approve to a recoverable abstain (verified:false); never manufactures a verified approve from an induced error."
|
|
44697
44829
|
),
|
|
44698
44830
|
/**
|
|
@@ -44702,7 +44834,7 @@ var PrReviewInputSchema = z91.object({
|
|
|
44702
44834
|
* runs the panel in the background; poll `get_job_result({ jobId })` for the
|
|
44703
44835
|
* result.
|
|
44704
44836
|
*/
|
|
44705
|
-
dispatch:
|
|
44837
|
+
dispatch: z92.enum(["sync", "async"]).default("sync").describe(
|
|
44706
44838
|
"Dispatch mode (#3731). 'sync' (default): run inline. 'async': return a jobId immediately + run the panel in background (poll get_job_result)."
|
|
44707
44839
|
)
|
|
44708
44840
|
});
|
|
@@ -44960,27 +45092,27 @@ function registerPrReviewTool(server, deps) {
|
|
|
44960
45092
|
}
|
|
44961
45093
|
|
|
44962
45094
|
// src/mcp/tools/survey-oss-landscape.ts
|
|
44963
|
-
import { z as
|
|
44964
|
-
var SurveyOssLandscapeInputSchema =
|
|
44965
|
-
query:
|
|
44966
|
-
maxResults:
|
|
44967
|
-
minStars:
|
|
44968
|
-
language:
|
|
45095
|
+
import { z as z93 } from "zod";
|
|
45096
|
+
var SurveyOssLandscapeInputSchema = z93.object({
|
|
45097
|
+
query: z93.string().min(1).max(200).describe('Free-text search query, e.g. "cargo nextest replacement" or "OSS SBOM tools"'),
|
|
45098
|
+
maxResults: z93.number().int().min(1).max(50).optional().default(10).describe("Maximum candidates to return (1-50; default 10)"),
|
|
45099
|
+
minStars: z93.number().int().min(0).optional().default(0).describe("Minimum star count to include (default 0; useful for filtering noise)"),
|
|
45100
|
+
language: z93.string().max(50).optional().describe('GitHub language filter, e.g. "rust" or "typescript"')
|
|
44969
45101
|
});
|
|
44970
|
-
var GitHubRepoSchema =
|
|
44971
|
-
full_name:
|
|
44972
|
-
html_url:
|
|
44973
|
-
description:
|
|
44974
|
-
stargazers_count:
|
|
44975
|
-
pushed_at:
|
|
44976
|
-
language:
|
|
44977
|
-
license:
|
|
44978
|
-
spdx_id:
|
|
45102
|
+
var GitHubRepoSchema = z93.object({
|
|
45103
|
+
full_name: z93.string().optional(),
|
|
45104
|
+
html_url: z93.string().optional(),
|
|
45105
|
+
description: z93.string().nullable().optional(),
|
|
45106
|
+
stargazers_count: z93.number().optional(),
|
|
45107
|
+
pushed_at: z93.string().nullable().optional(),
|
|
45108
|
+
language: z93.string().nullable().optional(),
|
|
45109
|
+
license: z93.object({
|
|
45110
|
+
spdx_id: z93.string().nullable().optional()
|
|
44979
45111
|
}).nullable().optional()
|
|
44980
45112
|
});
|
|
44981
|
-
var GitHubSearchResponseSchema =
|
|
44982
|
-
total_count:
|
|
44983
|
-
items:
|
|
45113
|
+
var GitHubSearchResponseSchema = z93.object({
|
|
45114
|
+
total_count: z93.number().optional(),
|
|
45115
|
+
items: z93.array(GitHubRepoSchema).optional()
|
|
44984
45116
|
});
|
|
44985
45117
|
var GITHUB_SEARCH_BASE = "https://api.github.com/search/repositories";
|
|
44986
45118
|
function buildGithubQuery(input) {
|
|
@@ -45107,11 +45239,11 @@ function createSurveyHandler(deps) {
|
|
|
45107
45239
|
};
|
|
45108
45240
|
}
|
|
45109
45241
|
var SURVEY_OUTPUT_SCHEMA = {
|
|
45110
|
-
query:
|
|
45111
|
-
totalFound:
|
|
45112
|
-
candidates:
|
|
45113
|
-
sourcesQueried:
|
|
45114
|
-
sourcesFailed:
|
|
45242
|
+
query: z93.string(),
|
|
45243
|
+
totalFound: z93.number(),
|
|
45244
|
+
candidates: z93.array(z93.unknown()),
|
|
45245
|
+
sourcesQueried: z93.array(z93.string()),
|
|
45246
|
+
sourcesFailed: z93.array(z93.string())
|
|
45115
45247
|
};
|
|
45116
45248
|
var SURVEY_DESCRIPTION = 'Transient OSS project search. Returns a ranked list of GitHub repositories with license, last-commit, star-count, and one-line description. Does NOT persist to the research registry \u2014 use `research_add_source` for that. Best for one-off engineering decisions like "what tools exist in this space?".';
|
|
45117
45249
|
function registerSurveyOssLandscapeTool(server, deps) {
|
|
@@ -45140,7 +45272,7 @@ function registerSurveyOssLandscapeTool(server, deps) {
|
|
|
45140
45272
|
}
|
|
45141
45273
|
|
|
45142
45274
|
// src/mcp/tools/vendor-publishing-audit.ts
|
|
45143
|
-
import { z as
|
|
45275
|
+
import { z as z94 } from "zod";
|
|
45144
45276
|
|
|
45145
45277
|
// src/mcp/tools/vendor-publishing-seed.ts
|
|
45146
45278
|
var VENDOR_PUBLISHING_SEED = {
|
|
@@ -45213,8 +45345,8 @@ function listKnownVendors() {
|
|
|
45213
45345
|
}
|
|
45214
45346
|
|
|
45215
45347
|
// src/mcp/tools/vendor-publishing-audit.ts
|
|
45216
|
-
var VendorPublishingAuditInputSchema =
|
|
45217
|
-
vendor:
|
|
45348
|
+
var VendorPublishingAuditInputSchema = z94.object({
|
|
45349
|
+
vendor: z94.string().min(1).max(50).toLowerCase().describe('Vendor identifier, lowercase. e.g. "ubuntu", "debian", "fedora"')
|
|
45218
45350
|
});
|
|
45219
45351
|
function lookupVendor(vendor) {
|
|
45220
45352
|
if (isKnownVendor(vendor)) {
|
|
@@ -45246,20 +45378,20 @@ function createVendorPublishingAuditHandler(deps) {
|
|
|
45246
45378
|
};
|
|
45247
45379
|
}
|
|
45248
45380
|
var VENDOR_PUBLISHING_OUTPUT_SCHEMA = {
|
|
45249
|
-
vendor:
|
|
45250
|
-
known:
|
|
45381
|
+
vendor: z94.string(),
|
|
45382
|
+
known: z94.boolean(),
|
|
45251
45383
|
// Fields below populate when known=true; permissive optional for known=false.
|
|
45252
|
-
sha256SumsUrlPattern:
|
|
45253
|
-
sha256SumsSignatureUrlPattern:
|
|
45254
|
-
signaturePattern:
|
|
45255
|
-
gpgKeys:
|
|
45256
|
-
releaseCadence:
|
|
45257
|
-
keyRotationNotes:
|
|
45258
|
-
vendorDocUrl:
|
|
45259
|
-
citedAt:
|
|
45384
|
+
sha256SumsUrlPattern: z94.string().optional(),
|
|
45385
|
+
sha256SumsSignatureUrlPattern: z94.string().optional(),
|
|
45386
|
+
signaturePattern: z94.string().optional(),
|
|
45387
|
+
gpgKeys: z94.array(z94.unknown()).optional(),
|
|
45388
|
+
releaseCadence: z94.string().optional(),
|
|
45389
|
+
keyRotationNotes: z94.string().optional(),
|
|
45390
|
+
vendorDocUrl: z94.string().optional(),
|
|
45391
|
+
citedAt: z94.string().optional(),
|
|
45260
45392
|
// Fields below populate when known=false.
|
|
45261
|
-
message:
|
|
45262
|
-
knownVendors:
|
|
45393
|
+
message: z94.string().optional(),
|
|
45394
|
+
knownVendors: z94.array(z94.string()).optional()
|
|
45263
45395
|
};
|
|
45264
45396
|
var VENDOR_PUBLISHING_DESCRIPTION = "Look up a vendor's published-artifact signing infrastructure: GPG key fingerprints, SHA256SUMS URL pattern, signature shape (clearsigned / detached / detached-on-iso), release cadence, key rotation notes, and the vendor doc citation. Static lookup against a curated seed dataset; the vendor doc URL is the authoritative source. Returns `{known: false, knownVendors: [...]}` for vendors without a seed entry. v1 covers ubuntu, debian, fedora.";
|
|
45265
45397
|
function registerVendorPublishingAuditTool(server, deps) {
|
|
@@ -45288,17 +45420,17 @@ function registerVendorPublishingAuditTool(server, deps) {
|
|
|
45288
45420
|
}
|
|
45289
45421
|
|
|
45290
45422
|
// src/mcp/tools/compare-data-feeds.ts
|
|
45291
|
-
import { z as
|
|
45423
|
+
import { z as z95 } from "zod";
|
|
45292
45424
|
import * as path7 from "path";
|
|
45293
45425
|
import * as fs8 from "fs";
|
|
45294
45426
|
import * as yaml2 from "yaml";
|
|
45295
|
-
var CompareDataFeedsInputSchema =
|
|
45296
|
-
feedAPath:
|
|
45297
|
-
feedBPath:
|
|
45298
|
-
keyPath:
|
|
45427
|
+
var CompareDataFeedsInputSchema = z95.object({
|
|
45428
|
+
feedAPath: z95.string().min(1).max(1e3).describe("Filesystem path to feed A (YAML or JSON, auto-detected by extension)"),
|
|
45429
|
+
feedBPath: z95.string().min(1).max(1e3).describe("Filesystem path to feed B"),
|
|
45430
|
+
keyPath: z95.string().min(1).max(200).describe(
|
|
45299
45431
|
'Dotted path to the entry key, e.g. "id" or "name". Each entry must have this field.'
|
|
45300
45432
|
),
|
|
45301
|
-
compareFields:
|
|
45433
|
+
compareFields: z95.array(z95.string().min(1).max(200)).max(20).optional().describe(
|
|
45302
45434
|
'Optional dotted field paths to compare across matched entries (e.g. ["license", "sha256"])'
|
|
45303
45435
|
)
|
|
45304
45436
|
});
|
|
@@ -45482,24 +45614,24 @@ function createCompareDataFeedsHandler(deps) {
|
|
|
45482
45614
|
};
|
|
45483
45615
|
}
|
|
45484
45616
|
var COMPARE_OUTPUT_SCHEMA = {
|
|
45485
|
-
feedAPath:
|
|
45486
|
-
feedBPath:
|
|
45487
|
-
keyPath:
|
|
45488
|
-
counts:
|
|
45489
|
-
entriesInA:
|
|
45490
|
-
entriesInB:
|
|
45491
|
-
onlyInA:
|
|
45492
|
-
onlyInB:
|
|
45493
|
-
inBoth:
|
|
45494
|
-
fieldDifferences:
|
|
45617
|
+
feedAPath: z95.string(),
|
|
45618
|
+
feedBPath: z95.string(),
|
|
45619
|
+
keyPath: z95.string(),
|
|
45620
|
+
counts: z95.object({
|
|
45621
|
+
entriesInA: z95.number(),
|
|
45622
|
+
entriesInB: z95.number(),
|
|
45623
|
+
onlyInA: z95.number(),
|
|
45624
|
+
onlyInB: z95.number(),
|
|
45625
|
+
inBoth: z95.number(),
|
|
45626
|
+
fieldDifferences: z95.number()
|
|
45495
45627
|
}),
|
|
45496
|
-
coverage:
|
|
45497
|
-
onlyInA:
|
|
45498
|
-
onlyInB:
|
|
45499
|
-
inBoth:
|
|
45628
|
+
coverage: z95.object({
|
|
45629
|
+
onlyInA: z95.array(z95.string()),
|
|
45630
|
+
onlyInB: z95.array(z95.string()),
|
|
45631
|
+
inBoth: z95.array(z95.string())
|
|
45500
45632
|
}),
|
|
45501
|
-
fieldDifferences:
|
|
45502
|
-
summary:
|
|
45633
|
+
fieldDifferences: z95.array(z95.unknown()),
|
|
45634
|
+
summary: z95.string()
|
|
45503
45635
|
};
|
|
45504
45636
|
var COMPARE_DESCRIPTION = "Diff two upstream data feeds (YAML or JSON files) along coverage and per-field axes. Returns which entries exist in A, B, both, plus optional field-level diffs across matched entries. v1 takes file paths only (no URL fetch \u2014 that needs an SSRF design pass). Both feeds must be a top-level array OR a top-level object with exactly one array field.";
|
|
45505
45637
|
function registerCompareDataFeedsTool(server, deps) {
|
|
@@ -45528,9 +45660,9 @@ function registerCompareDataFeedsTool(server, deps) {
|
|
|
45528
45660
|
}
|
|
45529
45661
|
|
|
45530
45662
|
// src/mcp/tools/query-task-state-tool.ts
|
|
45531
|
-
import { z as
|
|
45532
|
-
var QueryTaskStateInputSchema =
|
|
45533
|
-
taskId:
|
|
45663
|
+
import { z as z96 } from "zod";
|
|
45664
|
+
var QueryTaskStateInputSchema = z96.object({
|
|
45665
|
+
taskId: z96.string().min(1).max(128).describe("Task ID whose structured state log should be read")
|
|
45534
45666
|
});
|
|
45535
45667
|
function queryTaskStateHandler(args, ctx) {
|
|
45536
45668
|
const parsed = QueryTaskStateInputSchema.safeParse(args);
|
|
@@ -45565,7 +45697,7 @@ function queryTaskStateHandler(args, ctx) {
|
|
|
45565
45697
|
function registerQueryTaskStateTool(server, deps) {
|
|
45566
45698
|
const logger58 = deps.logger ?? createLogger({ tool: "query_task_state" });
|
|
45567
45699
|
const toolSchema = {
|
|
45568
|
-
taskId:
|
|
45700
|
+
taskId: z96.string().min(1).max(128).describe("Task ID whose structured state log should be read")
|
|
45569
45701
|
};
|
|
45570
45702
|
const description = "Read the structured state log for a task ID and return the current snapshot. Includes Magentic-One Task Ledger (facts/guesses/openQuestions) and Progress Ledger (per-step reflections with suggestedAction) when orchestrators have written them. Structured state is only written when NEXUS_TASK_STATE_ENABLED=1 was set during the orchestrate invocation.";
|
|
45571
45703
|
const secureHandler = createSecureHandler(queryTaskStateHandler, {
|
|
@@ -45587,28 +45719,28 @@ function registerQueryTaskStateTool(server, deps) {
|
|
|
45587
45719
|
}
|
|
45588
45720
|
|
|
45589
45721
|
// src/mcp/tools/ci-health-check-tool.ts
|
|
45590
|
-
import { z as
|
|
45722
|
+
import { z as z99 } from "zod";
|
|
45591
45723
|
|
|
45592
45724
|
// src/mcp/tools/ci-health-log.ts
|
|
45593
45725
|
import { appendFileSync as appendFileSync5, existsSync as existsSync11, readFileSync as readFileSync9, statSync as statSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
45594
|
-
import { z as
|
|
45726
|
+
import { z as z98 } from "zod";
|
|
45595
45727
|
|
|
45596
45728
|
// src/mcp/tools/ci-health-types.ts
|
|
45597
|
-
import { z as
|
|
45598
|
-
var CiHealthStatusSchema =
|
|
45729
|
+
import { z as z97 } from "zod";
|
|
45730
|
+
var CiHealthStatusSchema = z97.enum(["healthy", "degraded", "outage", "unknown"]);
|
|
45599
45731
|
|
|
45600
45732
|
// src/mcp/tools/ci-health-log.ts
|
|
45601
45733
|
var logger46 = createLogger({ component: "ci-health-log" });
|
|
45602
|
-
var CiHealthEventSchema =
|
|
45603
|
-
v:
|
|
45604
|
-
ts:
|
|
45734
|
+
var CiHealthEventSchema = z98.object({
|
|
45735
|
+
v: z98.literal(1),
|
|
45736
|
+
ts: z98.iso.datetime(),
|
|
45605
45737
|
status: CiHealthStatusSchema,
|
|
45606
|
-
repo:
|
|
45607
|
-
signals:
|
|
45608
|
-
|
|
45609
|
-
source:
|
|
45738
|
+
repo: z98.string().optional(),
|
|
45739
|
+
signals: z98.array(
|
|
45740
|
+
z98.object({
|
|
45741
|
+
source: z98.enum(["github-status", "repo-activity-window"]),
|
|
45610
45742
|
status: CiHealthStatusSchema,
|
|
45611
|
-
evidence:
|
|
45743
|
+
evidence: z98.string()
|
|
45612
45744
|
})
|
|
45613
45745
|
)
|
|
45614
45746
|
});
|
|
@@ -45688,17 +45820,17 @@ function eventFromCheck(params) {
|
|
|
45688
45820
|
}
|
|
45689
45821
|
|
|
45690
45822
|
// src/mcp/tools/ci-health-check-tool.ts
|
|
45691
|
-
var CiHealthCheckInputSchema =
|
|
45823
|
+
var CiHealthCheckInputSchema = z99.object({
|
|
45692
45824
|
/**
|
|
45693
45825
|
* Repo to check for the recent-runs activity signal (in `owner/repo` form).
|
|
45694
45826
|
* Optional — when omitted, only the status-page signal is consulted.
|
|
45695
45827
|
*/
|
|
45696
|
-
repo:
|
|
45828
|
+
repo: z99.string().regex(/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/, "Must be owner/repo form").optional().describe("GitHub repo (owner/repo) to check for recent CI activity. Optional."),
|
|
45697
45829
|
/**
|
|
45698
45830
|
* How far back to look for recent-runs activity (minutes). Default 30 —
|
|
45699
45831
|
* matches the typical wedge-detection window from the #3070 / #3076 outages.
|
|
45700
45832
|
*/
|
|
45701
|
-
activityWindowMinutes:
|
|
45833
|
+
activityWindowMinutes: z99.number().int().min(5).max(180).default(30).describe("Recent-runs lookback window in minutes (5-180; default 30).")
|
|
45702
45834
|
});
|
|
45703
45835
|
var STATUS_PAGE_URL = "https://www.githubstatus.com/api/v2/components.json";
|
|
45704
45836
|
function mapStatusPageStatus(raw) {
|
|
@@ -45831,8 +45963,8 @@ var DESCRIPTION = "Check CI infrastructure health before triggering / polling ru
|
|
|
45831
45963
|
function registerCiHealthCheckTool(server, deps) {
|
|
45832
45964
|
const logger58 = deps.logger ?? createLogger({ tool: "ci_health_check" });
|
|
45833
45965
|
const toolSchema = {
|
|
45834
|
-
repo:
|
|
45835
|
-
activityWindowMinutes:
|
|
45966
|
+
repo: z99.string().regex(/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/, "Must be owner/repo form").optional().describe("GitHub repo (owner/repo) to check for recent CI activity. Optional."),
|
|
45967
|
+
activityWindowMinutes: z99.number().int().min(5).max(180).optional().describe("Recent-runs lookback window in minutes (5-180; default 30).")
|
|
45836
45968
|
};
|
|
45837
45969
|
const secureHandler = createSecureHandler((args) => ciHealthCheckHandler(args, logger58), {
|
|
45838
45970
|
toolName: "ci_health_check",
|
|
@@ -45858,18 +45990,18 @@ function registerCiHealthCheckTool(server, deps) {
|
|
|
45858
45990
|
|
|
45859
45991
|
// src/mcp/tools/quality-gate-tool.ts
|
|
45860
45992
|
import { statSync as statSync3 } from "fs";
|
|
45861
|
-
import { z as
|
|
45862
|
-
var QualityCheckSchema =
|
|
45993
|
+
import { z as z100 } from "zod";
|
|
45994
|
+
var QualityCheckSchema = z100.enum(["typecheck", "lint", "tests", "build", "security"]);
|
|
45863
45995
|
var DEFAULT_CHECKS = ["typecheck", "lint", "tests"];
|
|
45864
|
-
var RunQualityGateInputSchema =
|
|
45996
|
+
var RunQualityGateInputSchema = z100.object({
|
|
45865
45997
|
/** Project directory to run checks against. Must resolve inside the repo/cwd root. */
|
|
45866
|
-
projectDir:
|
|
45998
|
+
projectDir: z100.string().optional().describe(
|
|
45867
45999
|
"Project directory to run checks against (default: cwd). Must stay inside the repo root."
|
|
45868
46000
|
),
|
|
45869
46001
|
/** Which allowlisted checks to run. */
|
|
45870
|
-
checks:
|
|
46002
|
+
checks: z100.array(QualityCheckSchema).nonempty().default([...DEFAULT_CHECKS]).describe("Allowlisted checks to run (default: ['typecheck','lint','tests'])."),
|
|
45871
46003
|
/** 1-based iteration counter, forwarded to the engine for feedback context. */
|
|
45872
|
-
iteration:
|
|
46004
|
+
iteration: z100.number().int().min(1).default(1).describe("1-based iteration number (default 1).")
|
|
45873
46005
|
});
|
|
45874
46006
|
function validateProjectDir(raw) {
|
|
45875
46007
|
const candidate = raw ?? process.cwd();
|
|
@@ -45944,11 +46076,11 @@ var DESCRIPTION2 = "Run the QA quality gate (#1684 engine) against a project dir
|
|
|
45944
46076
|
function registerRunQualityGateTool(server, deps) {
|
|
45945
46077
|
const logger58 = deps.logger ?? createLogger({ tool: "run_quality_gate" });
|
|
45946
46078
|
const toolSchema = {
|
|
45947
|
-
projectDir:
|
|
46079
|
+
projectDir: z100.string().optional().describe(
|
|
45948
46080
|
"Project directory to run checks against (default: cwd). Must stay inside the repo root."
|
|
45949
46081
|
),
|
|
45950
|
-
checks:
|
|
45951
|
-
iteration:
|
|
46082
|
+
checks: z100.array(QualityCheckSchema).nonempty().optional().describe("Allowlisted checks to run (default: ['typecheck','lint','tests'])."),
|
|
46083
|
+
iteration: z100.number().int().min(1).optional().describe("1-based iteration number (default 1).")
|
|
45952
46084
|
};
|
|
45953
46085
|
const secureHandler = createSecureHandler(
|
|
45954
46086
|
(args) => runQualityGateHandler(args, logger58),
|
|
@@ -45978,9 +46110,9 @@ function registerRunQualityGateTool(server, deps) {
|
|
|
45978
46110
|
// src/mcp/tools/verify-audit-chain-tool.ts
|
|
45979
46111
|
import * as fs9 from "fs/promises";
|
|
45980
46112
|
import * as path8 from "path";
|
|
45981
|
-
import { z as
|
|
45982
|
-
var VerifyAuditChainInputSchema =
|
|
45983
|
-
logDir:
|
|
46113
|
+
import { z as z101 } from "zod";
|
|
46114
|
+
var VerifyAuditChainInputSchema = z101.object({
|
|
46115
|
+
logDir: z101.string().min(1).max(512).describe(
|
|
45984
46116
|
"Filesystem path to the FileAuditStorage log directory. Tool reads all `audit-*.jsonl` files in lexicographic order and verifies the combined chain."
|
|
45985
46117
|
)
|
|
45986
46118
|
});
|
|
@@ -46057,7 +46189,7 @@ async function handler2(args, ctx) {
|
|
|
46057
46189
|
function registerVerifyAuditChainTool(server, deps) {
|
|
46058
46190
|
const logger58 = deps.logger ?? createLogger({ tool: "verify_audit_chain" });
|
|
46059
46191
|
const toolSchema = {
|
|
46060
|
-
logDir:
|
|
46192
|
+
logDir: z101.string().min(1).max(512).describe(
|
|
46061
46193
|
"Filesystem path to the FileAuditStorage log directory. Tool reads all `audit-*.jsonl` files and verifies the combined hash chain."
|
|
46062
46194
|
)
|
|
46063
46195
|
};
|
|
@@ -46081,15 +46213,15 @@ function registerVerifyAuditChainTool(server, deps) {
|
|
|
46081
46213
|
}
|
|
46082
46214
|
|
|
46083
46215
|
// src/mcp/tools/suggest-research-tasks-tool.ts
|
|
46084
|
-
import { z as
|
|
46216
|
+
import { z as z102 } from "zod";
|
|
46085
46217
|
var SUGGEST_RESEARCH_TASKS_NOTE = "Suggestions derived from external research (untrusted); review before acting \u2014 nothing was executed or filed.";
|
|
46086
46218
|
var RESEARCH_BUDGET_MS = 2e4;
|
|
46087
46219
|
var RESEARCH_TIMED_OUT = /* @__PURE__ */ Symbol("research-budget-exceeded");
|
|
46088
46220
|
async function withResearchBudget(p, ms) {
|
|
46089
46221
|
let timer;
|
|
46090
|
-
const budget = new Promise((
|
|
46222
|
+
const budget = new Promise((resolve20) => {
|
|
46091
46223
|
timer = setTimeout(() => {
|
|
46092
|
-
|
|
46224
|
+
resolve20(RESEARCH_TIMED_OUT);
|
|
46093
46225
|
}, ms);
|
|
46094
46226
|
});
|
|
46095
46227
|
try {
|
|
@@ -46098,11 +46230,11 @@ async function withResearchBudget(p, ms) {
|
|
|
46098
46230
|
if (timer !== void 0) clearTimeout(timer);
|
|
46099
46231
|
}
|
|
46100
46232
|
}
|
|
46101
|
-
var SuggestResearchTasksInputSchema =
|
|
46102
|
-
topic:
|
|
46103
|
-
qualityThreshold:
|
|
46104
|
-
maxTriggers:
|
|
46105
|
-
existingTaskIds:
|
|
46233
|
+
var SuggestResearchTasksInputSchema = z102.object({
|
|
46234
|
+
topic: z102.string().optional().describe("Topic filter passed to research_discover. Optional."),
|
|
46235
|
+
qualityThreshold: z102.number().min(0).max(10).optional().describe("Minimum quality score (0-10) a discovery must meet to be suggested. Optional."),
|
|
46236
|
+
maxTriggers: z102.number().int().min(1).optional().describe("Max number of candidate tasks to return (>=1). Optional."),
|
|
46237
|
+
existingTaskIds: z102.array(z102.string()).optional().describe("Known task IDs to skip (dedup). Optional.")
|
|
46106
46238
|
});
|
|
46107
46239
|
function toTriggerConfig(input) {
|
|
46108
46240
|
return {
|
|
@@ -46159,10 +46291,10 @@ var DESCRIPTION3 = "SUGGEST-ONLY: surface candidate pipeline tasks for human/orc
|
|
|
46159
46291
|
function registerSuggestResearchTasksTool(server, deps) {
|
|
46160
46292
|
const logger58 = deps.logger ?? createLogger({ tool: "suggest_research_tasks" });
|
|
46161
46293
|
const toolSchema = {
|
|
46162
|
-
topic:
|
|
46163
|
-
qualityThreshold:
|
|
46164
|
-
maxTriggers:
|
|
46165
|
-
existingTaskIds:
|
|
46294
|
+
topic: z102.string().optional().describe("Topic filter passed to research_discover. Optional."),
|
|
46295
|
+
qualityThreshold: z102.number().min(0).max(10).optional().describe("Minimum quality score (0-10) a discovery must meet to be suggested. Optional."),
|
|
46296
|
+
maxTriggers: z102.number().int().min(1).optional().describe("Max number of candidate tasks to return (>=1). Optional."),
|
|
46297
|
+
existingTaskIds: z102.array(z102.string()).optional().describe("Known task IDs to skip (dedup). Optional.")
|
|
46166
46298
|
};
|
|
46167
46299
|
const secureHandler = createSecureHandler(
|
|
46168
46300
|
(args) => suggestResearchTasksHandler(args, logger58),
|
|
@@ -46190,7 +46322,7 @@ function registerSuggestResearchTasksTool(server, deps) {
|
|
|
46190
46322
|
}
|
|
46191
46323
|
|
|
46192
46324
|
// src/mcp/tools/run-tool.ts
|
|
46193
|
-
import { z as
|
|
46325
|
+
import { z as z106 } from "zod";
|
|
46194
46326
|
import { randomUUID as randomUUID17 } from "crypto";
|
|
46195
46327
|
|
|
46196
46328
|
// src/orchestration/meta-orchestrator.ts
|
|
@@ -46436,7 +46568,7 @@ function createMetaOrchestrator(options) {
|
|
|
46436
46568
|
|
|
46437
46569
|
// src/orchestration/meta-shadow-selector.ts
|
|
46438
46570
|
import { appendFileSync as appendFileSync6, existsSync as existsSync12, readFileSync as readFileSync10 } from "fs";
|
|
46439
|
-
import { z as
|
|
46571
|
+
import { z as z103 } from "zod";
|
|
46440
46572
|
var SHADOW_STRATEGY_ARMS = [
|
|
46441
46573
|
"single-shot",
|
|
46442
46574
|
"dev-pipeline",
|
|
@@ -46517,19 +46649,19 @@ function createHydratableSelector() {
|
|
|
46517
46649
|
var META_OUTCOME_SCHEMA_VERSION = 1;
|
|
46518
46650
|
var HYDRATE_LOOKBACK_DAYS = 30;
|
|
46519
46651
|
var HYDRATE_LOOKBACK_MS = HYDRATE_LOOKBACK_DAYS * 24 * 60 * 60 * 1e3;
|
|
46520
|
-
var PersistedContextSchema =
|
|
46521
|
-
taskComplexity:
|
|
46522
|
-
contextLengthNormalized:
|
|
46523
|
-
isCodeTask:
|
|
46524
|
-
isReasoningTask:
|
|
46525
|
-
budgetUtilization:
|
|
46526
|
-
timePressure:
|
|
46652
|
+
var PersistedContextSchema = z103.object({
|
|
46653
|
+
taskComplexity: z103.number(),
|
|
46654
|
+
contextLengthNormalized: z103.number(),
|
|
46655
|
+
isCodeTask: z103.number(),
|
|
46656
|
+
isReasoningTask: z103.number(),
|
|
46657
|
+
budgetUtilization: z103.number(),
|
|
46658
|
+
timePressure: z103.number()
|
|
46527
46659
|
});
|
|
46528
|
-
var PersistedMetaOutcomeSchema =
|
|
46529
|
-
schema:
|
|
46530
|
-
timestamp:
|
|
46531
|
-
strategy:
|
|
46532
|
-
success:
|
|
46660
|
+
var PersistedMetaOutcomeSchema = z103.object({
|
|
46661
|
+
schema: z103.literal(META_OUTCOME_SCHEMA_VERSION),
|
|
46662
|
+
timestamp: z103.string(),
|
|
46663
|
+
strategy: z103.enum(SHADOW_STRATEGY_ARMS),
|
|
46664
|
+
success: z103.boolean(),
|
|
46533
46665
|
context: PersistedContextSchema
|
|
46534
46666
|
});
|
|
46535
46667
|
var persistLogger = createLogger({ component: "MetaShadowSelector" });
|
|
@@ -47020,7 +47152,7 @@ function createMetaDispatcher(options) {
|
|
|
47020
47152
|
}
|
|
47021
47153
|
|
|
47022
47154
|
// src/mcp/tools/dev-pipeline-tool.ts
|
|
47023
|
-
import { z as
|
|
47155
|
+
import { z as z104 } from "zod";
|
|
47024
47156
|
import * as fs11 from "fs";
|
|
47025
47157
|
import * as path10 from "path";
|
|
47026
47158
|
import { randomUUID as randomUUID15 } from "crypto";
|
|
@@ -47044,7 +47176,7 @@ var GitHubTaskTracker = class {
|
|
|
47044
47176
|
cachedProvider = null;
|
|
47045
47177
|
async getProvider() {
|
|
47046
47178
|
if (this.cachedProvider !== null) return this.cachedProvider;
|
|
47047
|
-
const { createScmProvider } = await import("./factory-
|
|
47179
|
+
const { createScmProvider } = await import("./factory-SURRFPSV.js");
|
|
47048
47180
|
const result = await createScmProvider({ repo: this.config.repo ?? "" });
|
|
47049
47181
|
if (!result.ok) throw new Error(`SCM provider error: ${result.error.message}`);
|
|
47050
47182
|
this.cachedProvider = result.value;
|
|
@@ -47169,36 +47301,36 @@ function createTaskTracker(config) {
|
|
|
47169
47301
|
|
|
47170
47302
|
// src/mcp/tools/dev-pipeline-tool.ts
|
|
47171
47303
|
var DEV_PIPELINE_ASYNC_HINT = "A full run_dev_pipeline run can exceed the 900s synchronous MCP timeout. Retry with `dispatch: 'async'` to get a jobId immediately, then poll get_job_result({ jobId }) for the result.";
|
|
47172
|
-
var DevPipelineInputSchema =
|
|
47304
|
+
var DevPipelineInputSchema = z104.object({
|
|
47173
47305
|
/** Direct task instructions. */
|
|
47174
|
-
task:
|
|
47306
|
+
task: z104.string().max(1e4).optional().describe("Direct task instructions (what to build)"),
|
|
47175
47307
|
/** Path to a plan file (.md, .yaml, .txt) to use as input. */
|
|
47176
|
-
planFile:
|
|
47308
|
+
planFile: z104.string().max(500).optional().describe("Path to a plan/spec file to use as input"),
|
|
47177
47309
|
/** Whether to run in dry-run mode (plan+vote only, no implementation). */
|
|
47178
|
-
dryRun:
|
|
47310
|
+
dryRun: z104.boolean().default(false).describe("If true, stop after plan+vote (no implementation)"),
|
|
47179
47311
|
/** Maximum vote iterations before proceeding (default: 3). */
|
|
47180
|
-
maxVoteIterations:
|
|
47312
|
+
maxVoteIterations: z104.number().int().min(1).max(5).default(3).describe("Max plan\u2192vote iterations"),
|
|
47181
47313
|
/** Maximum QA iterations per task (default: 3). */
|
|
47182
|
-
maxQaIterations:
|
|
47314
|
+
maxQaIterations: z104.number().int().min(1).max(5).default(3).describe("Max QA review iterations per task"),
|
|
47183
47315
|
/** Working directory for the pipeline (default: cwd). Used for security scan and context. */
|
|
47184
|
-
workingDir:
|
|
47316
|
+
workingDir: z104.string().max(500).optional().describe("Working directory (default: cwd)"),
|
|
47185
47317
|
/** GitHub issue number to track progress on. Updates posted as comments. */
|
|
47186
|
-
issueNumber:
|
|
47318
|
+
issueNumber: z104.number().int().positive().optional().describe("GitHub issue to post progress to"),
|
|
47187
47319
|
/** GitHub repo (owner/name) for issue tracking. */
|
|
47188
|
-
repo:
|
|
47320
|
+
repo: z104.string().max(200).optional().describe("GitHub repo for issue tracking (e.g., owner/repo)"),
|
|
47189
47321
|
/** Task tracking backend: github, gitlab, or json (default: json). */
|
|
47190
|
-
trackerBackend:
|
|
47322
|
+
trackerBackend: z104.enum(["github", "gitlab", "json"]).default("json").describe("Task tracking backend for issue creation"),
|
|
47191
47323
|
/** Labels to apply to created issues. */
|
|
47192
|
-
labels:
|
|
47324
|
+
labels: z104.array(z104.string()).optional().describe("Labels for created issues"),
|
|
47193
47325
|
/** Session ID for checkpoint/resume. Enables crash recovery. */
|
|
47194
|
-
sessionId:
|
|
47326
|
+
sessionId: z104.string().max(128).regex(/^[a-zA-Z0-9_-]+$/).optional().describe("Session ID for checkpoint/resume (crash recovery)"),
|
|
47195
47327
|
/**
|
|
47196
47328
|
* TESTS ONLY — when true, voters return random decisions. Must not be used as
|
|
47197
47329
|
* a fallback when adapters are unavailable; configure an adapter instead. (#2319)
|
|
47198
47330
|
*/
|
|
47199
|
-
simulateVotes:
|
|
47331
|
+
simulateVotes: z104.boolean().default(false).describe("TESTS ONLY \u2014 random output, must not be used for real decisions (#2319)"),
|
|
47200
47332
|
/** Voting strategy for consensus stages. */
|
|
47201
|
-
votingStrategy:
|
|
47333
|
+
votingStrategy: z104.enum([
|
|
47202
47334
|
"simple_majority",
|
|
47203
47335
|
"supermajority",
|
|
47204
47336
|
"unanimous",
|
|
@@ -47207,11 +47339,11 @@ var DevPipelineInputSchema = z103.object({
|
|
|
47207
47339
|
"opinion_wise"
|
|
47208
47340
|
]).optional().describe("Voting strategy for plan approval (default: higher_order)"),
|
|
47209
47341
|
/** Use 3 agents instead of 6 for faster voting. */
|
|
47210
|
-
quickMode:
|
|
47342
|
+
quickMode: z104.boolean().default(false).describe("Use 3 agents instead of 6 for faster consensus voting"),
|
|
47211
47343
|
/** Maximum execution time per stage in milliseconds (min 30s, max 600s). */
|
|
47212
|
-
timeoutMs:
|
|
47344
|
+
timeoutMs: z104.number().int().min(3e4).max(6e5).optional().describe("Max time per stage in ms (30000-600000). Default: varies by stage complexity"),
|
|
47213
47345
|
/** Pipeline execution mode. */
|
|
47214
|
-
mode:
|
|
47346
|
+
mode: z104.enum(["autonomous", "harness"]).default("autonomous").describe(
|
|
47215
47347
|
"'autonomous': full pipeline. 'harness': stops after decompose, returns tasks for caller to implement."
|
|
47216
47348
|
),
|
|
47217
47349
|
/**
|
|
@@ -47222,15 +47354,15 @@ var DevPipelineInputSchema = z103.object({
|
|
|
47222
47354
|
* `get_job_result({ jobId })` for the result. Ignored when `dryRun` is
|
|
47223
47355
|
* true (plan+vote completes fast, so dry runs always stay sync).
|
|
47224
47356
|
*/
|
|
47225
|
-
dispatch:
|
|
47357
|
+
dispatch: z104.enum(["sync", "async"]).default("sync").describe(
|
|
47226
47358
|
"Dispatch mode (#3726). 'sync' (default): run inline. 'async': return a jobId immediately + run in background (poll get_job_result). Ignored for dryRun."
|
|
47227
47359
|
),
|
|
47228
47360
|
/** Local pre-ship quality gate (typecheck/lint/tests) mode (#3356). */
|
|
47229
|
-
qualityGate:
|
|
47361
|
+
qualityGate: z104.enum(["off", "advisory", "blocking"]).default("off").describe(
|
|
47230
47362
|
"Pre-ship local quality gate. 'off' (default): skip. 'advisory': run + record feedback, never fail. 'blocking': a red gate fails the pipeline."
|
|
47231
47363
|
),
|
|
47232
47364
|
/** Opt-in per-run token budget — a safety cap for unattended runs (#3395). */
|
|
47233
|
-
maxBudgetTokens:
|
|
47365
|
+
maxBudgetTokens: z104.number().int().positive().optional().describe(
|
|
47234
47366
|
"Per-run token ceiling (#3395). When set, expert calls stop (returning failures) once cumulative usage crosses it \u2014 a hard-stop safety cap for unattended/multi-day runs. Omit to disable (default)."
|
|
47235
47367
|
)
|
|
47236
47368
|
});
|
|
@@ -47401,20 +47533,20 @@ function registerDevPipelineTool(server, deps) {
|
|
|
47401
47533
|
}
|
|
47402
47534
|
|
|
47403
47535
|
// src/mcp/tools/pipeline-tool.ts
|
|
47404
|
-
import { z as
|
|
47536
|
+
import { z as z105 } from "zod";
|
|
47405
47537
|
import * as fs12 from "fs";
|
|
47406
47538
|
import * as path11 from "path";
|
|
47407
47539
|
import { randomUUID as randomUUID16 } from "crypto";
|
|
47408
47540
|
var PIPELINE_ASYNC_HINT = "A full run_pipeline run can exceed the synchronous MCP request timeout. Retry with `dispatch: 'async'` to get a jobId immediately, then poll get_job_result({ jobId }) for the result.";
|
|
47409
|
-
var PipelineInputSchema =
|
|
47541
|
+
var PipelineInputSchema = z105.object({
|
|
47410
47542
|
/** The task to execute. */
|
|
47411
|
-
task:
|
|
47543
|
+
task: z105.string().min(5).max(1e4).describe("Task description \u2014 pipeline template auto-selected based on content"),
|
|
47412
47544
|
/** Path to a spec file (.md, .yaml) to use as task input. */
|
|
47413
|
-
specFile:
|
|
47545
|
+
specFile: z105.string().max(500).optional().describe("Path to a spec file \u2014 content prepended to task for greenfield projects"),
|
|
47414
47546
|
/** Override template — see `listTemplateIds()` for the canonical list (#2728). Auto-detected if omitted. */
|
|
47415
|
-
template:
|
|
47547
|
+
template: z105.string().max(50).optional().describe(`Pipeline template override. Available: ${listTemplateIds().join(", ")}`),
|
|
47416
47548
|
/** Voting strategy for consensus stages. */
|
|
47417
|
-
votingStrategy:
|
|
47549
|
+
votingStrategy: z105.enum([
|
|
47418
47550
|
"simple_majority",
|
|
47419
47551
|
"supermajority",
|
|
47420
47552
|
"unanimous",
|
|
@@ -47425,11 +47557,11 @@ var PipelineInputSchema = z104.object({
|
|
|
47425
47557
|
"Voting strategy for plan approval. simple_majority (default), supermajority (67%), unanimous, higher_order (Bayesian), proof_of_learning, opinion_wise"
|
|
47426
47558
|
),
|
|
47427
47559
|
/** Use 3 agents instead of 6 for faster voting. */
|
|
47428
|
-
quickMode:
|
|
47560
|
+
quickMode: z105.boolean().default(false).describe("Use 3 agents instead of 6 for faster consensus voting"),
|
|
47429
47561
|
/** Maximum execution time per stage in milliseconds (min 30s, max 600s). */
|
|
47430
|
-
timeoutMs:
|
|
47562
|
+
timeoutMs: z105.number().int().min(3e4).max(6e5).optional().describe("Max time per stage in ms (30000-600000). Default: varies by stage complexity"),
|
|
47431
47563
|
/** Stop after planning/voting (no implementation). */
|
|
47432
|
-
dryRun:
|
|
47564
|
+
dryRun: z105.boolean().default(false).describe("Stop after vote stage (no implementation)"),
|
|
47433
47565
|
/**
|
|
47434
47566
|
* Dispatch mode (#3730). `sync` (default) runs the pipeline inline and
|
|
47435
47567
|
* returns the result — but a real multi-stage adaptive run can exceed the
|
|
@@ -47438,13 +47570,13 @@ var PipelineInputSchema = z104.object({
|
|
|
47438
47570
|
* `get_job_result({ jobId })` for the result. Ignored when `dryRun` is true
|
|
47439
47571
|
* (plan+vote completes fast, so dry runs always stay sync).
|
|
47440
47572
|
*/
|
|
47441
|
-
dispatch:
|
|
47573
|
+
dispatch: z105.enum(["sync", "async"]).default("sync").describe(
|
|
47442
47574
|
"Dispatch mode (#3730). 'sync' (default): run inline. 'async': return a jobId immediately + run in background (poll get_job_result). Ignored for dryRun."
|
|
47443
47575
|
),
|
|
47444
47576
|
/** TESTS ONLY — random output, must not be used for real decisions. (#2319) */
|
|
47445
|
-
simulateVotes:
|
|
47577
|
+
simulateVotes: z105.boolean().default(false).describe("TESTS ONLY \u2014 random output, must not be used for real decisions (#2319)")
|
|
47446
47578
|
});
|
|
47447
|
-
function
|
|
47579
|
+
function buildOutput3(result, simulated) {
|
|
47448
47580
|
return {
|
|
47449
47581
|
success: result.success,
|
|
47450
47582
|
templateId: result.templateId,
|
|
@@ -47529,7 +47661,7 @@ async function executePipelineBody(task, stages, templateId, dryRun, simulated)
|
|
|
47529
47661
|
templateId,
|
|
47530
47662
|
dryRun
|
|
47531
47663
|
});
|
|
47532
|
-
return toolSuccessStructured(
|
|
47664
|
+
return toolSuccessStructured(buildOutput3(result, simulated));
|
|
47533
47665
|
}
|
|
47534
47666
|
async function runPipelineHandler(args, logger58) {
|
|
47535
47667
|
const parsed = PipelineInputSchema.safeParse(args);
|
|
@@ -47594,9 +47726,9 @@ function registerPipelineTool(server, deps) {
|
|
|
47594
47726
|
}
|
|
47595
47727
|
|
|
47596
47728
|
// src/mcp/tools/run-tool.ts
|
|
47597
|
-
var RunInputSchema =
|
|
47598
|
-
goal:
|
|
47599
|
-
forceStrategy:
|
|
47729
|
+
var RunInputSchema = z106.object({
|
|
47730
|
+
goal: z106.string().min(1).describe("Natural-language goal. nexus-agents selects how to execute it."),
|
|
47731
|
+
forceStrategy: z106.enum([
|
|
47600
47732
|
"single-shot",
|
|
47601
47733
|
"dev-pipeline",
|
|
47602
47734
|
"pipeline",
|
|
@@ -47608,10 +47740,10 @@ var RunInputSchema = z105.object({
|
|
|
47608
47740
|
]).optional().describe(
|
|
47609
47741
|
"Power-user override: force a specific strategy instead of letting the router choose."
|
|
47610
47742
|
),
|
|
47611
|
-
requiresConsensus:
|
|
47612
|
-
dependencyStructure:
|
|
47613
|
-
isNovel:
|
|
47614
|
-
execute:
|
|
47743
|
+
requiresConsensus: z106.boolean().optional().describe("Hint: the task needs a multi-perspective consensus decision."),
|
|
47744
|
+
dependencyStructure: z106.enum(["linear", "dag", "independent", "unknown"]).optional().describe("Hint: the dependency structure of the work."),
|
|
47745
|
+
isNovel: z106.boolean().optional().describe("Hint: this kind of task has not been seen before."),
|
|
47746
|
+
execute: z106.boolean().optional().describe(
|
|
47615
47747
|
"When true, actually run the selected strategy (if an executor is wired) and return its result; otherwise return the routing decision only (default false, read-only)."
|
|
47616
47748
|
),
|
|
47617
47749
|
/**
|
|
@@ -47622,7 +47754,7 @@ var RunInputSchema = z105.object({
|
|
|
47622
47754
|
* envelope immediately and runs in the background; poll
|
|
47623
47755
|
* `get_job_result({ jobId })`. Ignored for read-only routing (execute:false).
|
|
47624
47756
|
*/
|
|
47625
|
-
dispatch:
|
|
47757
|
+
dispatch: z106.enum(["sync", "async"]).optional().describe(
|
|
47626
47758
|
"Dispatch mode (#3732). 'sync' (default): run inline. 'async' (only with execute:true): return a jobId immediately + run in background (poll get_job_result)."
|
|
47627
47759
|
)
|
|
47628
47760
|
});
|
|
@@ -47814,12 +47946,12 @@ function registerRunTool(server, deps) {
|
|
|
47814
47946
|
}
|
|
47815
47947
|
|
|
47816
47948
|
// src/mcp/tools/list-available-models-tool.ts
|
|
47817
|
-
import { z as
|
|
47949
|
+
import { z as z107 } from "zod";
|
|
47818
47950
|
var DESCRIPTION5 = "Probe every model-discovery transport (OpenRouter API + opencode/claude/codex/gemini CLIs) and report a per-transport health summary: probe ok/failed, model count, and a sample of ids. Use it to validate the CLIs and APIs are wired and reachable. Read-only; does not change routing.";
|
|
47819
47951
|
var PROBE_TIMEOUT_MS = 12e3;
|
|
47820
|
-
var ListAvailableModelsInputSchema =
|
|
47821
|
-
includeModelIds:
|
|
47822
|
-
includeOpenRouter:
|
|
47952
|
+
var ListAvailableModelsInputSchema = z107.object({
|
|
47953
|
+
includeModelIds: z107.boolean().optional().describe("Include the full model-id list per transport (default false \u2192 sample of 5 only)."),
|
|
47954
|
+
includeOpenRouter: z107.boolean().optional().describe("Probe the OpenRouter live catalog (default true).")
|
|
47823
47955
|
});
|
|
47824
47956
|
async function probeSource(source, includeModelIds) {
|
|
47825
47957
|
let timer;
|
|
@@ -47851,7 +47983,7 @@ async function probeSource(source, includeModelIds) {
|
|
|
47851
47983
|
}
|
|
47852
47984
|
}
|
|
47853
47985
|
async function defaultSources(includeOpenRouter) {
|
|
47854
|
-
const { createAllAdapters: createAllAdapters2 } = await import("./factory-
|
|
47986
|
+
const { createAllAdapters: createAllAdapters2 } = await import("./factory-LKQKU3SD.js");
|
|
47855
47987
|
const adapters = createAllAdapters2();
|
|
47856
47988
|
return buildDefaultModelSources(adapters, { includeOpenRouter });
|
|
47857
47989
|
}
|
|
@@ -47883,8 +48015,8 @@ async function listAvailableModelsHandler(args, deps, logger58) {
|
|
|
47883
48015
|
function registerListAvailableModelsTool(server, deps) {
|
|
47884
48016
|
const logger58 = deps.logger ?? createLogger({ tool: "list_available_models" });
|
|
47885
48017
|
const toolSchema = {
|
|
47886
|
-
includeModelIds:
|
|
47887
|
-
includeOpenRouter:
|
|
48018
|
+
includeModelIds: z107.boolean().optional().describe("Include the full model-id list per transport (default false \u2192 sample of 5 only)."),
|
|
48019
|
+
includeOpenRouter: z107.boolean().optional().describe("Probe the OpenRouter live catalog (default true).")
|
|
47888
48020
|
};
|
|
47889
48021
|
const secureHandler = createSecureHandler(
|
|
47890
48022
|
(args) => listAvailableModelsHandler(args, deps, logger58),
|
|
@@ -47908,7 +48040,7 @@ function registerListAvailableModelsTool(server, deps) {
|
|
|
47908
48040
|
}
|
|
47909
48041
|
|
|
47910
48042
|
// src/mcp/tools/pr-review-eval-types.ts
|
|
47911
|
-
import { z as
|
|
48043
|
+
import { z as z108 } from "zod";
|
|
47912
48044
|
var PR_REVIEW_EVAL_ROLES = [
|
|
47913
48045
|
"architect",
|
|
47914
48046
|
"security",
|
|
@@ -47916,43 +48048,43 @@ var PR_REVIEW_EVAL_ROLES = [
|
|
|
47916
48048
|
"catfish",
|
|
47917
48049
|
"scope_steward"
|
|
47918
48050
|
];
|
|
47919
|
-
var PrReviewEvalRoleSchema =
|
|
47920
|
-
var PrReviewCaseClassSchema =
|
|
47921
|
-
var VoterEvalVerdictSchema =
|
|
48051
|
+
var PrReviewEvalRoleSchema = z108.enum(PR_REVIEW_EVAL_ROLES);
|
|
48052
|
+
var PrReviewCaseClassSchema = z108.enum(["buggy", "clean", "borderline"]);
|
|
48053
|
+
var VoterEvalVerdictSchema = z108.object({
|
|
47922
48054
|
/** Stable record id (e.g. `${runId}:${caseNumber}:${role}`). */
|
|
47923
|
-
id:
|
|
48055
|
+
id: z108.string().min(1).max(160),
|
|
47924
48056
|
/** The pr_review run / batch this verdict belongs to. */
|
|
47925
|
-
runId:
|
|
48057
|
+
runId: z108.string().min(1).max(64),
|
|
47926
48058
|
/** Dataset case identifier (the dataset's `number` field). */
|
|
47927
|
-
caseNumber:
|
|
48059
|
+
caseNumber: z108.string().min(1).max(80),
|
|
47928
48060
|
/** Rubric class of the case (ground-truth label). */
|
|
47929
48061
|
caseClass: PrReviewCaseClassSchema,
|
|
47930
48062
|
/** The voter role being scored. */
|
|
47931
48063
|
role: PrReviewEvalRoleSchema,
|
|
47932
48064
|
/** Verified findings that matched a known bug. */
|
|
47933
|
-
truePositives:
|
|
48065
|
+
truePositives: z108.number().int().nonnegative(),
|
|
47934
48066
|
/** Verified findings on clean code that matched no known bug. */
|
|
47935
|
-
falsePositives:
|
|
48067
|
+
falsePositives: z108.number().int().nonnegative(),
|
|
47936
48068
|
/** Known bugs this voter failed to flag. */
|
|
47937
|
-
falseNegatives:
|
|
48069
|
+
falseNegatives: z108.number().int().nonnegative(),
|
|
47938
48070
|
/** Rubric version the ground truth was adjudicated under. */
|
|
47939
|
-
rubricVersion:
|
|
48071
|
+
rubricVersion: z108.string().min(1).max(32),
|
|
47940
48072
|
/** ISO-8601 timestamp the verdict was recorded. */
|
|
47941
|
-
timestamp:
|
|
48073
|
+
timestamp: z108.string().min(1).max(40)
|
|
47942
48074
|
});
|
|
47943
|
-
var VoterEvalVerdictQuerySchema =
|
|
48075
|
+
var VoterEvalVerdictQuerySchema = z108.object({
|
|
47944
48076
|
role: PrReviewEvalRoleSchema.optional(),
|
|
47945
|
-
runId:
|
|
48077
|
+
runId: z108.string().min(1).max(64).optional(),
|
|
47946
48078
|
caseClass: PrReviewCaseClassSchema.optional(),
|
|
47947
|
-
rubricVersion:
|
|
48079
|
+
rubricVersion: z108.string().min(1).max(32).optional(),
|
|
47948
48080
|
/** ISO-8601 lower bound (inclusive) on `timestamp`. */
|
|
47949
|
-
since:
|
|
48081
|
+
since: z108.string().optional(),
|
|
47950
48082
|
/** Most-recent-N cap. */
|
|
47951
|
-
limit:
|
|
48083
|
+
limit: z108.number().int().positive().optional()
|
|
47952
48084
|
});
|
|
47953
48085
|
|
|
47954
48086
|
// src/mcp/tools/supply-chain-tradeoff-panel.ts
|
|
47955
|
-
import { z as
|
|
48087
|
+
import { z as z109 } from "zod";
|
|
47956
48088
|
import { randomUUID as randomUUID18 } from "crypto";
|
|
47957
48089
|
var DEFAULT_AXES = [
|
|
47958
48090
|
"build_time_determinism",
|
|
@@ -47974,16 +48106,16 @@ var FULL_PANEL = [
|
|
|
47974
48106
|
"scope_steward"
|
|
47975
48107
|
];
|
|
47976
48108
|
var QUICK_PANEL = ["architect", "security", "scope_steward"];
|
|
47977
|
-
var SupplyChainTradeoffPanelInputSchema =
|
|
47978
|
-
proposal:
|
|
47979
|
-
axes:
|
|
48109
|
+
var SupplyChainTradeoffPanelInputSchema = z109.object({
|
|
48110
|
+
proposal: z109.string().min(1).max(MAX_PROPOSAL_LENGTH).describe('The proposal under tradeoff review (e.g. "Should aegis-boot adopt cargo-nextest?")'),
|
|
48111
|
+
axes: z109.array(z109.string().min(1).max(MAX_AXIS_NAME_LENGTH)).min(1).max(MAX_AXES).optional().describe(
|
|
47980
48112
|
`Tradeoff axes to evaluate. Default: ${DEFAULT_AXES.join(", ")}. Custom axes accepted; max ${String(MAX_AXES)}.`
|
|
47981
48113
|
),
|
|
47982
|
-
context:
|
|
48114
|
+
context: z109.string().max(MAX_CONTEXT_LENGTH).optional().describe(
|
|
47983
48115
|
"Optional context: relevant repo state, dependency tree, vendor publishing patterns, etc."
|
|
47984
48116
|
),
|
|
47985
|
-
quickMode:
|
|
47986
|
-
simulate:
|
|
48117
|
+
quickMode: z109.boolean().optional().default(false).describe("Use 3 voters (architect, security, scope_steward) instead of 7"),
|
|
48118
|
+
simulate: z109.boolean().optional().default(false).describe("Use simulated voters (testing only)"),
|
|
47987
48119
|
/**
|
|
47988
48120
|
* Dispatch mode (#3731). `sync` (default) runs the panel inline and returns
|
|
47989
48121
|
* the result — but a live fan-out (up to 7 voters) can exceed the MCP request
|
|
@@ -47991,7 +48123,7 @@ var SupplyChainTradeoffPanelInputSchema = z108.object({
|
|
|
47991
48123
|
* immediately and runs the panel in the background; poll
|
|
47992
48124
|
* `get_job_result({ jobId })` for the result.
|
|
47993
48125
|
*/
|
|
47994
|
-
dispatch:
|
|
48126
|
+
dispatch: z109.enum(["sync", "async"]).default("sync").describe(
|
|
47995
48127
|
"Dispatch mode (#3731). 'sync' (default): run inline. 'async': return a jobId immediately + run the panel in background (poll get_job_result)."
|
|
47996
48128
|
)
|
|
47997
48129
|
});
|
|
@@ -48462,40 +48594,40 @@ var RiskLevel = /* @__PURE__ */ ((RiskLevel2) => {
|
|
|
48462
48594
|
})(RiskLevel || {});
|
|
48463
48595
|
|
|
48464
48596
|
// src/mcp/safety/stpa-schemas.ts
|
|
48465
|
-
import { z as
|
|
48466
|
-
var HazardCategorySchema =
|
|
48467
|
-
var HazardSeveritySchema =
|
|
48468
|
-
var ConstraintPrioritySchema =
|
|
48469
|
-
var RiskLevelSchema =
|
|
48470
|
-
var TriggerPatternSchema =
|
|
48471
|
-
parameter:
|
|
48472
|
-
matchType:
|
|
48473
|
-
pattern:
|
|
48474
|
-
reason:
|
|
48597
|
+
import { z as z110 } from "zod";
|
|
48598
|
+
var HazardCategorySchema = z110.enum(HazardCategory);
|
|
48599
|
+
var HazardSeveritySchema = z110.enum(HazardSeverity);
|
|
48600
|
+
var ConstraintPrioritySchema = z110.enum(ConstraintPriority);
|
|
48601
|
+
var RiskLevelSchema = z110.enum(RiskLevel);
|
|
48602
|
+
var TriggerPatternSchema = z110.object({
|
|
48603
|
+
parameter: z110.string().min(1),
|
|
48604
|
+
matchType: z110.enum(["contains", "regex", "equals", "startsWith", "endsWith"]),
|
|
48605
|
+
pattern: z110.string(),
|
|
48606
|
+
reason: z110.string()
|
|
48475
48607
|
});
|
|
48476
|
-
var HazardSchema =
|
|
48477
|
-
id:
|
|
48478
|
-
description:
|
|
48608
|
+
var HazardSchema = z110.object({
|
|
48609
|
+
id: z110.string().min(1),
|
|
48610
|
+
description: z110.string(),
|
|
48479
48611
|
category: HazardCategorySchema,
|
|
48480
48612
|
severity: HazardSeveritySchema,
|
|
48481
|
-
likelihood:
|
|
48482
|
-
triggerConditions:
|
|
48483
|
-
consequences:
|
|
48613
|
+
likelihood: z110.enum(["almost_certain", "likely", "possible", "unlikely", "rare"]),
|
|
48614
|
+
triggerConditions: z110.array(z110.string()),
|
|
48615
|
+
consequences: z110.array(z110.string())
|
|
48484
48616
|
});
|
|
48485
|
-
var UnsafeControlActionSchema =
|
|
48486
|
-
id:
|
|
48487
|
-
toolName:
|
|
48488
|
-
type:
|
|
48489
|
-
description:
|
|
48490
|
-
unsafeContext:
|
|
48491
|
-
relatedHazards:
|
|
48492
|
-
triggerPatterns:
|
|
48617
|
+
var UnsafeControlActionSchema = z110.object({
|
|
48618
|
+
id: z110.string().min(1),
|
|
48619
|
+
toolName: z110.string().min(1),
|
|
48620
|
+
type: z110.enum(["not_provided", "provided_causes_hazard", "wrong_timing", "wrong_duration"]),
|
|
48621
|
+
description: z110.string(),
|
|
48622
|
+
unsafeContext: z110.string(),
|
|
48623
|
+
relatedHazards: z110.array(z110.string()),
|
|
48624
|
+
triggerPatterns: z110.array(TriggerPatternSchema).optional()
|
|
48493
48625
|
});
|
|
48494
|
-
var SafetyConstraintSchema =
|
|
48495
|
-
id:
|
|
48496
|
-
description:
|
|
48497
|
-
mitigates:
|
|
48498
|
-
enforcement:
|
|
48626
|
+
var SafetyConstraintSchema = z110.object({
|
|
48627
|
+
id: z110.string().min(1),
|
|
48628
|
+
description: z110.string(),
|
|
48629
|
+
mitigates: z110.array(z110.string()),
|
|
48630
|
+
enforcement: z110.enum([
|
|
48499
48631
|
"prevent",
|
|
48500
48632
|
"require_confirmation",
|
|
48501
48633
|
"alert",
|
|
@@ -48503,54 +48635,54 @@ var SafetyConstraintSchema = z109.object({
|
|
|
48503
48635
|
"rate_limit",
|
|
48504
48636
|
"require_privilege"
|
|
48505
48637
|
]),
|
|
48506
|
-
validationFunction:
|
|
48638
|
+
validationFunction: z110.string().optional(),
|
|
48507
48639
|
priority: ConstraintPrioritySchema
|
|
48508
48640
|
});
|
|
48509
|
-
var PropertySchemaSchema =
|
|
48510
|
-
type:
|
|
48511
|
-
description:
|
|
48512
|
-
enum:
|
|
48513
|
-
pattern:
|
|
48514
|
-
minimum:
|
|
48515
|
-
maximum:
|
|
48641
|
+
var PropertySchemaSchema = z110.object({
|
|
48642
|
+
type: z110.string(),
|
|
48643
|
+
description: z110.string().optional(),
|
|
48644
|
+
enum: z110.array(z110.unknown()).optional(),
|
|
48645
|
+
pattern: z110.string().optional(),
|
|
48646
|
+
minimum: z110.number().optional(),
|
|
48647
|
+
maximum: z110.number().optional()
|
|
48516
48648
|
});
|
|
48517
|
-
var ToolInputSchemaSchema =
|
|
48518
|
-
type:
|
|
48519
|
-
properties:
|
|
48520
|
-
required:
|
|
48521
|
-
additionalProperties:
|
|
48649
|
+
var ToolInputSchemaSchema = z110.object({
|
|
48650
|
+
type: z110.string(),
|
|
48651
|
+
properties: z110.record(z110.string(), PropertySchemaSchema).optional(),
|
|
48652
|
+
required: z110.array(z110.string()).optional(),
|
|
48653
|
+
additionalProperties: z110.boolean().optional()
|
|
48522
48654
|
});
|
|
48523
|
-
var ToolDefinitionSchema =
|
|
48524
|
-
name:
|
|
48525
|
-
description:
|
|
48655
|
+
var ToolDefinitionSchema = z110.object({
|
|
48656
|
+
name: z110.string().min(1),
|
|
48657
|
+
description: z110.string(),
|
|
48526
48658
|
inputSchema: ToolInputSchemaSchema
|
|
48527
48659
|
});
|
|
48528
|
-
var AnalysisConfigurationSchema =
|
|
48529
|
-
includeLowSeverity:
|
|
48530
|
-
generateAllConstraints:
|
|
48531
|
-
checkInteractions:
|
|
48532
|
-
maxHazardsPerTool:
|
|
48533
|
-
categories:
|
|
48660
|
+
var AnalysisConfigurationSchema = z110.object({
|
|
48661
|
+
includeLowSeverity: z110.boolean().default(true),
|
|
48662
|
+
generateAllConstraints: z110.boolean().default(true),
|
|
48663
|
+
checkInteractions: z110.boolean().default(true),
|
|
48664
|
+
maxHazardsPerTool: z110.number().int().min(1).max(100).default(50),
|
|
48665
|
+
categories: z110.array(HazardCategorySchema).default([])
|
|
48534
48666
|
});
|
|
48535
|
-
var ConstraintViolationSchema =
|
|
48536
|
-
constraintId:
|
|
48537
|
-
constraintDescription:
|
|
48667
|
+
var ConstraintViolationSchema = z110.object({
|
|
48668
|
+
constraintId: z110.string().min(1),
|
|
48669
|
+
constraintDescription: z110.string(),
|
|
48538
48670
|
severity: HazardSeveritySchema,
|
|
48539
|
-
details:
|
|
48540
|
-
remediation:
|
|
48671
|
+
details: z110.string(),
|
|
48672
|
+
remediation: z110.string()
|
|
48541
48673
|
});
|
|
48542
|
-
var ValidationWarningSchema =
|
|
48543
|
-
code:
|
|
48544
|
-
message:
|
|
48545
|
-
affected:
|
|
48674
|
+
var ValidationWarningSchema = z110.object({
|
|
48675
|
+
code: z110.string().min(1),
|
|
48676
|
+
message: z110.string(),
|
|
48677
|
+
affected: z110.string()
|
|
48546
48678
|
});
|
|
48547
|
-
var ValidationResultSchema =
|
|
48548
|
-
valid:
|
|
48549
|
-
toolName:
|
|
48550
|
-
violations:
|
|
48551
|
-
passed:
|
|
48552
|
-
warnings:
|
|
48553
|
-
validatedAt:
|
|
48679
|
+
var ValidationResultSchema = z110.object({
|
|
48680
|
+
valid: z110.boolean(),
|
|
48681
|
+
toolName: z110.string().min(1),
|
|
48682
|
+
violations: z110.array(ConstraintViolationSchema),
|
|
48683
|
+
passed: z110.array(z110.string()),
|
|
48684
|
+
warnings: z110.array(ValidationWarningSchema),
|
|
48685
|
+
validatedAt: z110.date()
|
|
48554
48686
|
});
|
|
48555
48687
|
|
|
48556
48688
|
// src/mcp/safety/stpa-types.ts
|
|
@@ -49635,43 +49767,43 @@ var GeminiResponseParser = class {
|
|
|
49635
49767
|
};
|
|
49636
49768
|
|
|
49637
49769
|
// src/cli-adapters/router-types.ts
|
|
49638
|
-
import { z as
|
|
49639
|
-
var RouterConfigSchema =
|
|
49640
|
-
minCapacityThreshold:
|
|
49641
|
-
preferCostEfficient:
|
|
49642
|
-
maxDecisionTimeMs:
|
|
49770
|
+
import { z as z111 } from "zod";
|
|
49771
|
+
var RouterConfigSchema = z111.object({
|
|
49772
|
+
minCapacityThreshold: z111.number().min(0).max(1).default(0.1),
|
|
49773
|
+
preferCostEfficient: z111.boolean().default(false),
|
|
49774
|
+
maxDecisionTimeMs: z111.number().min(1).max(1e3).default(100)
|
|
49643
49775
|
});
|
|
49644
49776
|
|
|
49645
49777
|
// src/cli-adapters/agreement-cascade-types.ts
|
|
49646
|
-
import { z as
|
|
49647
|
-
var AgreementCascadeConfigSchema =
|
|
49648
|
-
agreementThreshold:
|
|
49649
|
-
maxStages:
|
|
49650
|
-
modelTimeoutMs:
|
|
49778
|
+
import { z as z112 } from "zod";
|
|
49779
|
+
var AgreementCascadeConfigSchema = z112.object({
|
|
49780
|
+
agreementThreshold: z112.number().min(0.5).max(1).default(0.7),
|
|
49781
|
+
maxStages: z112.number().int().min(1).max(5).default(3),
|
|
49782
|
+
modelTimeoutMs: z112.number().int().min(1e3).max(3e5).default(6e4)
|
|
49651
49783
|
});
|
|
49652
49784
|
|
|
49653
49785
|
// src/cli-adapters/agreement-cascade-router.ts
|
|
49654
49786
|
var logger49 = createLogger({ component: "agreement-cascade-router" });
|
|
49655
49787
|
|
|
49656
49788
|
// src/cli-adapters/task-classifier.ts
|
|
49657
|
-
import { z as
|
|
49658
|
-
var ClassificationPatternsSchema =
|
|
49659
|
-
code:
|
|
49660
|
-
research:
|
|
49661
|
-
documentation:
|
|
49662
|
-
analysis:
|
|
49789
|
+
import { z as z113 } from "zod";
|
|
49790
|
+
var ClassificationPatternsSchema = z113.object({
|
|
49791
|
+
code: z113.array(z113.string()).readonly(),
|
|
49792
|
+
research: z113.array(z113.string()).readonly(),
|
|
49793
|
+
documentation: z113.array(z113.string()).readonly(),
|
|
49794
|
+
analysis: z113.array(z113.string()).readonly()
|
|
49663
49795
|
});
|
|
49664
49796
|
|
|
49665
49797
|
// src/cli-adapters/response-cache-types.ts
|
|
49666
|
-
import { z as
|
|
49667
|
-
var ResponseCacheConfigSchema =
|
|
49668
|
-
defaultTTL:
|
|
49798
|
+
import { z as z114 } from "zod";
|
|
49799
|
+
var ResponseCacheConfigSchema = z114.object({
|
|
49800
|
+
defaultTTL: z114.number().min(1e3).max(36e5).default(3e5),
|
|
49669
49801
|
// 5 minutes
|
|
49670
|
-
maxEntries:
|
|
49671
|
-
maxMemoryMB:
|
|
49672
|
-
cleanupInterval:
|
|
49802
|
+
maxEntries: z114.number().min(10).max(1e5).default(1e3),
|
|
49803
|
+
maxMemoryMB: z114.number().min(1).max(1e3).default(50),
|
|
49804
|
+
cleanupInterval: z114.number().min(1e3).max(6e5).default(6e4),
|
|
49673
49805
|
// 1 minute
|
|
49674
|
-
enableLogging:
|
|
49806
|
+
enableLogging: z114.boolean().default(false)
|
|
49675
49807
|
});
|
|
49676
49808
|
|
|
49677
49809
|
// src/cli-adapters/response-cache-utils.ts
|
|
@@ -49679,12 +49811,12 @@ import { createHash as createHash6 } from "crypto";
|
|
|
49679
49811
|
var logger50 = createLogger({ component: "ResponseCacheUtils" });
|
|
49680
49812
|
|
|
49681
49813
|
// src/cli-adapters/unified-routing-types.ts
|
|
49682
|
-
import { z as
|
|
49683
|
-
var UnifiedRoutingDecisionSchema =
|
|
49684
|
-
selectedCli:
|
|
49685
|
-
confidence:
|
|
49686
|
-
reason:
|
|
49687
|
-
strategy:
|
|
49814
|
+
import { z as z115 } from "zod";
|
|
49815
|
+
var UnifiedRoutingDecisionSchema = z115.object({
|
|
49816
|
+
selectedCli: z115.string(),
|
|
49817
|
+
confidence: z115.number().min(0).max(1),
|
|
49818
|
+
reason: z115.string(),
|
|
49819
|
+
strategy: z115.enum([
|
|
49688
49820
|
"composite",
|
|
49689
49821
|
"quality",
|
|
49690
49822
|
"budget",
|
|
@@ -49696,57 +49828,57 @@ var UnifiedRoutingDecisionSchema = z114.object({
|
|
|
49696
49828
|
"linucb",
|
|
49697
49829
|
"direct"
|
|
49698
49830
|
]),
|
|
49699
|
-
decisionTimeMs:
|
|
49700
|
-
alternatives:
|
|
49701
|
-
stagesExecuted:
|
|
49702
|
-
withinBudget:
|
|
49703
|
-
estimatedComplexity:
|
|
49704
|
-
estimatedTokens:
|
|
49705
|
-
topsisScore:
|
|
49706
|
-
ucbScore:
|
|
49707
|
-
resolvedAtStage:
|
|
49708
|
-
consensusReached:
|
|
49709
|
-
agreementScore:
|
|
49710
|
-
metadata:
|
|
49831
|
+
decisionTimeMs: z115.number().nonnegative(),
|
|
49832
|
+
alternatives: z115.array(z115.string()).readonly(),
|
|
49833
|
+
stagesExecuted: z115.array(z115.string()).readonly(),
|
|
49834
|
+
withinBudget: z115.boolean().optional(),
|
|
49835
|
+
estimatedComplexity: z115.enum(["simple", "moderate", "complex", "expert"]).optional(),
|
|
49836
|
+
estimatedTokens: z115.number().int().positive().optional(),
|
|
49837
|
+
topsisScore: z115.number().optional(),
|
|
49838
|
+
ucbScore: z115.number().optional(),
|
|
49839
|
+
resolvedAtStage: z115.number().int().nonnegative().optional(),
|
|
49840
|
+
consensusReached: z115.boolean().optional(),
|
|
49841
|
+
agreementScore: z115.number().min(0).max(1).optional(),
|
|
49842
|
+
metadata: z115.record(z115.string(), z115.unknown()).optional()
|
|
49711
49843
|
});
|
|
49712
49844
|
|
|
49713
49845
|
// src/learning/outcome-feedback-types.ts
|
|
49714
|
-
import { z as
|
|
49715
|
-
var QualitySignalsSchema =
|
|
49716
|
-
testsPass:
|
|
49717
|
-
lintErrors:
|
|
49718
|
-
userApproved:
|
|
49719
|
-
retryCount:
|
|
49720
|
-
completionRatio:
|
|
49721
|
-
validStructure:
|
|
49722
|
-
coherenceScore:
|
|
49846
|
+
import { z as z116 } from "zod";
|
|
49847
|
+
var QualitySignalsSchema = z116.object({
|
|
49848
|
+
testsPass: z116.boolean().optional(),
|
|
49849
|
+
lintErrors: z116.number().int().min(0).optional(),
|
|
49850
|
+
userApproved: z116.boolean().optional(),
|
|
49851
|
+
retryCount: z116.number().int().min(0).default(0),
|
|
49852
|
+
completionRatio: z116.number().min(0).max(1).default(1),
|
|
49853
|
+
validStructure: z116.boolean().optional(),
|
|
49854
|
+
coherenceScore: z116.number().min(0).max(1).optional()
|
|
49723
49855
|
});
|
|
49724
|
-
var RoutingDecisionSchema =
|
|
49725
|
-
id:
|
|
49726
|
-
timestamp:
|
|
49727
|
-
query:
|
|
49728
|
-
routerType:
|
|
49729
|
-
selectedModel:
|
|
49730
|
-
selectedTier:
|
|
49731
|
-
armIndex:
|
|
49732
|
-
banditContext:
|
|
49733
|
-
queryFeatures:
|
|
49734
|
-
ucbScore:
|
|
49735
|
-
confidence:
|
|
49736
|
-
traceId:
|
|
49737
|
-
domain:
|
|
49856
|
+
var RoutingDecisionSchema = z116.object({
|
|
49857
|
+
id: z116.uuid(),
|
|
49858
|
+
timestamp: z116.iso.datetime(),
|
|
49859
|
+
query: z116.string(),
|
|
49860
|
+
routerType: z116.enum(["linucb", "preference", "quality", "cascade", "topsis"]),
|
|
49861
|
+
selectedModel: z116.string(),
|
|
49862
|
+
selectedTier: z116.enum(["strong", "weak"]).optional(),
|
|
49863
|
+
armIndex: z116.number().int().min(0).optional(),
|
|
49864
|
+
banditContext: z116.record(z116.string(), z116.unknown()).optional(),
|
|
49865
|
+
queryFeatures: z116.record(z116.string(), z116.unknown()).optional(),
|
|
49866
|
+
ucbScore: z116.number().optional(),
|
|
49867
|
+
confidence: z116.number().min(0).max(1).optional(),
|
|
49868
|
+
traceId: z116.string(),
|
|
49869
|
+
domain: z116.string().optional()
|
|
49738
49870
|
});
|
|
49739
|
-
var TaskOutcomeSchema =
|
|
49740
|
-
routingDecisionId:
|
|
49741
|
-
timestamp:
|
|
49742
|
-
outcomeClass:
|
|
49743
|
-
success:
|
|
49744
|
-
qualityScore:
|
|
49745
|
-
durationMs:
|
|
49746
|
-
tokenUsage:
|
|
49747
|
-
errorMessage:
|
|
49871
|
+
var TaskOutcomeSchema = z116.object({
|
|
49872
|
+
routingDecisionId: z116.uuid(),
|
|
49873
|
+
timestamp: z116.iso.datetime(),
|
|
49874
|
+
outcomeClass: z116.enum(["success", "partial", "failure", "timeout", "error"]),
|
|
49875
|
+
success: z116.boolean(),
|
|
49876
|
+
qualityScore: z116.number().min(0).max(1),
|
|
49877
|
+
durationMs: z116.number().min(0),
|
|
49878
|
+
tokenUsage: z116.number().int().min(0),
|
|
49879
|
+
errorMessage: z116.string().optional(),
|
|
49748
49880
|
qualitySignals: QualitySignalsSchema,
|
|
49749
|
-
traceId:
|
|
49881
|
+
traceId: z116.string()
|
|
49750
49882
|
});
|
|
49751
49883
|
var DEFAULT_FEEDBACK_COLLECTOR_CONFIG = {
|
|
49752
49884
|
maxPendingDecisions: 1e3,
|
|
@@ -49761,17 +49893,17 @@ var DEFAULT_FEEDBACK_COLLECTOR_CONFIG = {
|
|
|
49761
49893
|
targetTokenUsage: 2e3,
|
|
49762
49894
|
maxHistorySize: 1e4
|
|
49763
49895
|
};
|
|
49764
|
-
var FeedbackCollectorConfigSchema =
|
|
49765
|
-
maxPendingDecisions:
|
|
49766
|
-
pendingTimeoutMs:
|
|
49767
|
-
enableAutoReward:
|
|
49768
|
-
qualityWeight:
|
|
49769
|
-
speedWeight:
|
|
49770
|
-
efficiencyWeight:
|
|
49771
|
-
retryPenalty:
|
|
49772
|
-
targetDurationMs:
|
|
49773
|
-
targetTokenUsage:
|
|
49774
|
-
maxHistorySize:
|
|
49896
|
+
var FeedbackCollectorConfigSchema = z116.object({
|
|
49897
|
+
maxPendingDecisions: z116.number().int().positive().default(1e3),
|
|
49898
|
+
pendingTimeoutMs: z116.number().positive().default(3e5),
|
|
49899
|
+
enableAutoReward: z116.boolean().default(true),
|
|
49900
|
+
qualityWeight: z116.number().min(0).max(1).default(0.5),
|
|
49901
|
+
speedWeight: z116.number().min(0).max(1).default(0.2),
|
|
49902
|
+
efficiencyWeight: z116.number().min(0).max(1).default(0.2),
|
|
49903
|
+
retryPenalty: z116.number().min(0).max(1).default(0.1),
|
|
49904
|
+
targetDurationMs: z116.number().positive().default(5e3),
|
|
49905
|
+
targetTokenUsage: z116.number().positive().default(2e3),
|
|
49906
|
+
maxHistorySize: z116.number().int().positive().default(1e4)
|
|
49775
49907
|
});
|
|
49776
49908
|
|
|
49777
49909
|
// src/learning/outcome-feedback-helpers.ts
|
|
@@ -50836,7 +50968,7 @@ function getPolicy(id) {
|
|
|
50836
50968
|
// src/security/sandbox/sandbox-executor.ts
|
|
50837
50969
|
import { execFile } from "child_process";
|
|
50838
50970
|
import { promisify } from "util";
|
|
50839
|
-
import { resolve as
|
|
50971
|
+
import { resolve as resolve19, normalize as normalize2, sep as sep12 } from "path";
|
|
50840
50972
|
var execFileAsync = promisify(execFile);
|
|
50841
50973
|
var logger52 = createLogger({ component: "sandbox-executor" });
|
|
50842
50974
|
function parseExecError(error) {
|
|
@@ -50916,10 +51048,10 @@ var PolicySandboxExecutor = class {
|
|
|
50916
51048
|
*/
|
|
50917
51049
|
validateCwd(cwd, policy) {
|
|
50918
51050
|
if (cwd === void 0) return null;
|
|
50919
|
-
const normalizedCwd = normalize2(
|
|
51051
|
+
const normalizedCwd = normalize2(resolve19(cwd));
|
|
50920
51052
|
const isAllowed = policy.pathRules.some((rule) => {
|
|
50921
|
-
const normalizedRule = normalize2(
|
|
50922
|
-
const isUnderRule = normalizedCwd === normalizedRule || normalizedCwd.startsWith(normalizedRule +
|
|
51053
|
+
const normalizedRule = normalize2(resolve19(rule.path));
|
|
51054
|
+
const isUnderRule = normalizedCwd === normalizedRule || normalizedCwd.startsWith(normalizedRule + sep12);
|
|
50923
51055
|
return isUnderRule && rule.access !== "none";
|
|
50924
51056
|
});
|
|
50925
51057
|
if (!isAllowed) {
|
|
@@ -51823,6 +51955,8 @@ export {
|
|
|
51823
51955
|
registerSearchCodebaseTool,
|
|
51824
51956
|
ExtractSymbolsInputSchema,
|
|
51825
51957
|
registerExtractSymbolsTool,
|
|
51958
|
+
SearchUsagesInputSchema,
|
|
51959
|
+
registerSearchUsagesTool,
|
|
51826
51960
|
QueryTraceInputSchema,
|
|
51827
51961
|
registerQueryTraceTool,
|
|
51828
51962
|
registerQueryTaskStateTool,
|
|
@@ -51920,4 +52054,4 @@ export {
|
|
|
51920
52054
|
shutdownFeedbackSubscriber,
|
|
51921
52055
|
createEventBusBridge
|
|
51922
52056
|
};
|
|
51923
|
-
//# sourceMappingURL=chunk-
|
|
52057
|
+
//# sourceMappingURL=chunk-QMOJJ6A2.js.map
|