nexus-agents 2.168.0 → 2.169.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-FJRGAMUU.js} +2 -2
- package/dist/{chunk-IAGLVGHN.js → chunk-3JH3FMEJ.js} +2 -2
- package/dist/{chunk-OLCDGMEO.js → chunk-3ON2P4WL.js} +4 -4
- package/dist/{chunk-GNCUZDQI.js → chunk-4G5W5EPU.js} +7 -7
- package/dist/{chunk-CPS2HN4T.js → chunk-5O4JRXNQ.js} +2 -2
- package/dist/{chunk-3KID7AIF.js → chunk-7S43YASS.js} +3 -3
- package/dist/{chunk-RJHLNI37.js → chunk-BWG54OJS.js} +2 -2
- package/dist/{chunk-6ERIC5NJ.js → chunk-CD2NZFAI.js} +2 -2
- package/dist/{chunk-LNPKBBPG.js → chunk-CHF63T3L.js} +4 -4
- package/dist/{chunk-RQNBJ7AS.js → chunk-DSMSYENI.js} +2 -2
- package/dist/{chunk-CJLMB7MO.js → chunk-EQRN5FRZ.js} +3 -3
- package/dist/{chunk-ELWMGKVP.js → chunk-F6HJJG3E.js} +8 -8
- package/dist/{chunk-5LPPJIZ4.js → chunk-HAVBBSYN.js} +2 -2
- package/dist/{chunk-N56C2MWI.js → chunk-HNNSCTOI.js} +2 -2
- package/dist/{chunk-G7NDNFIE.js → chunk-IQC2K3KY.js} +3 -3
- package/dist/{chunk-VQE3OSUW.js → chunk-JCJHQSAY.js} +2 -2
- package/dist/{chunk-MSBYVBPX.js → chunk-MCT7JJF6.js} +2 -2
- package/dist/{chunk-52T2MJDS.js → chunk-N7FIUFQL.js} +811 -598
- package/dist/chunk-N7FIUFQL.js.map +1 -0
- package/dist/{chunk-7IUVW67T.js → chunk-NT3KCLT6.js} +7 -7
- package/dist/{chunk-2Z4QECP7.js → chunk-OOFPDA3B.js} +2 -2
- package/dist/{chunk-ETFCT2CH.js → chunk-P7MYTCE6.js} +4 -4
- package/dist/{chunk-HZNOSJOO.js → chunk-PZF67XDY.js} +3 -3
- package/dist/{chunk-2ANAH2UU.js → chunk-Q3UMNYV2.js} +4 -4
- package/dist/{chunk-OKAHIWG4.js → chunk-QXSR5KPG.js} +25 -4
- package/dist/chunk-QXSR5KPG.js.map +1 -0
- package/dist/{chunk-TZK7VQAW.js → chunk-R46SBPLH.js} +5 -5
- package/dist/{chunk-F5JDQXHJ.js → chunk-RO23OT47.js} +2 -2
- package/dist/{chunk-P7RBQUAG.js → chunk-ROCNXZBC.js} +8 -8
- package/dist/{chunk-UN7PYUJB.js → chunk-SX4E2W3Z.js} +2 -2
- package/dist/{chunk-UGJRDFMN.js → chunk-T3VD32JY.js} +2 -2
- package/dist/{chunk-TORS5V2C.js → chunk-TB26XNJH.js} +2 -2
- package/dist/{chunk-MX3XD2ML.js → chunk-W76DOL27.js} +2 -2
- package/dist/{chunk-I3LGUSZ3.js → chunk-WB33EPTV.js} +5 -5
- package/dist/{chunk-HJA3Z56H.js → chunk-XGNB7LQB.js} +5 -5
- package/dist/{chunk-AO4X3BMP.js → chunk-YF35FKKD.js} +2 -1
- package/dist/chunk-YF35FKKD.js.map +1 -0
- package/dist/{chunk-EQLJYWLP.js → chunk-ZXFIBDT3.js} +3 -3
- package/dist/{cli-circuit-breaker-JDGZ25MD.js → cli-circuit-breaker-FJQXDC5M.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-UQTCPADM.js} +2 -2
- package/dist/{consensus-vote-YKKJHLOD.js → consensus-vote-FEDF24T5.js} +15 -15
- package/dist/{context-retriever-EGMARBAC.js → context-retriever-TIJGFLGO.js} +8 -8
- package/dist/{doctor-deep-QTBDR3VV.js → doctor-deep-EULAHWTK.js} +3 -3
- package/dist/{expert-bridge-FZYJ3XAL.js → expert-bridge-7HQ54XYU.js} +4 -4
- package/dist/{factory-SABHBAHC.js → factory-QZZQVDGQ.js} +8 -8
- package/dist/{factory-NDMPXPYE.js → factory-RW2ROEDS.js} +5 -5
- package/dist/{improvement-review-WYFGNEVP.js → improvement-review-DGQPADKS.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-MK2NUEWH.js} +5 -5
- package/dist/{issue-triage-NHRZGMKC.js → issue-triage-RVDZEM53.js} +6 -6
- package/dist/{pr-reviewer-helpers-HJRFRUZX.js → pr-reviewer-helpers-TKXJBDT6.js} +4 -4
- package/dist/{registry-command-JCOZA7TM.js → registry-command-VXXKVZ3H.js} +2 -2
- package/dist/{repo-security-plan-OMY33VHA.js → repo-security-plan-YCTKRAGA.js} +3 -3
- package/dist/{research-helpers-synthesize-DFINP3KN.js → research-helpers-synthesize-4L6SXYQU.js} +4 -4
- package/dist/{routing-memory-KK4GPB64.js → routing-memory-INY5DC2P.js} +2 -2
- package/dist/{session-memory-QTHGU2XM.js → session-memory-TQMLN67N.js} +3 -3
- package/dist/{setup-command-CURZCHSQ.js → setup-command-FT5LBTSR.js} +13 -13
- package/dist/{setup-config-FX6SJXGQ.js → setup-config-U3WLC5OO.js} +3 -3
- package/dist/{setup-custom-api-MYN4EVT2.js → setup-custom-api-2E4MZ5MF.js} +3 -3
- package/dist/{tool-memory-3W5NXR4P.js → tool-memory-IV5BVIV4.js} +5 -5
- package/dist/{unified-registry-PKPNJ3G7.js → unified-registry-6LFTI4MG.js} +9 -9
- package/dist/{weather-report-46ZY3X2Z.js → weather-report-7NZ6D4C7.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-OKAHIWG4.js.map +0 -1
- package/dist/codebase-search-DKLEA4PR.js +0 -12
- /package/dist/{child-mcp-config-FAWSJFMQ.js.map → child-mcp-config-FJRGAMUU.js.map} +0 -0
- /package/dist/{chunk-IAGLVGHN.js.map → chunk-3JH3FMEJ.js.map} +0 -0
- /package/dist/{chunk-OLCDGMEO.js.map → chunk-3ON2P4WL.js.map} +0 -0
- /package/dist/{chunk-GNCUZDQI.js.map → chunk-4G5W5EPU.js.map} +0 -0
- /package/dist/{chunk-CPS2HN4T.js.map → chunk-5O4JRXNQ.js.map} +0 -0
- /package/dist/{chunk-3KID7AIF.js.map → chunk-7S43YASS.js.map} +0 -0
- /package/dist/{chunk-RJHLNI37.js.map → chunk-BWG54OJS.js.map} +0 -0
- /package/dist/{chunk-6ERIC5NJ.js.map → chunk-CD2NZFAI.js.map} +0 -0
- /package/dist/{chunk-LNPKBBPG.js.map → chunk-CHF63T3L.js.map} +0 -0
- /package/dist/{chunk-RQNBJ7AS.js.map → chunk-DSMSYENI.js.map} +0 -0
- /package/dist/{chunk-CJLMB7MO.js.map → chunk-EQRN5FRZ.js.map} +0 -0
- /package/dist/{chunk-ELWMGKVP.js.map → chunk-F6HJJG3E.js.map} +0 -0
- /package/dist/{chunk-5LPPJIZ4.js.map → chunk-HAVBBSYN.js.map} +0 -0
- /package/dist/{chunk-N56C2MWI.js.map → chunk-HNNSCTOI.js.map} +0 -0
- /package/dist/{chunk-G7NDNFIE.js.map → chunk-IQC2K3KY.js.map} +0 -0
- /package/dist/{chunk-VQE3OSUW.js.map → chunk-JCJHQSAY.js.map} +0 -0
- /package/dist/{chunk-MSBYVBPX.js.map → chunk-MCT7JJF6.js.map} +0 -0
- /package/dist/{chunk-7IUVW67T.js.map → chunk-NT3KCLT6.js.map} +0 -0
- /package/dist/{chunk-2Z4QECP7.js.map → chunk-OOFPDA3B.js.map} +0 -0
- /package/dist/{chunk-ETFCT2CH.js.map → chunk-P7MYTCE6.js.map} +0 -0
- /package/dist/{chunk-HZNOSJOO.js.map → chunk-PZF67XDY.js.map} +0 -0
- /package/dist/{chunk-2ANAH2UU.js.map → chunk-Q3UMNYV2.js.map} +0 -0
- /package/dist/{chunk-TZK7VQAW.js.map → chunk-R46SBPLH.js.map} +0 -0
- /package/dist/{chunk-F5JDQXHJ.js.map → chunk-RO23OT47.js.map} +0 -0
- /package/dist/{chunk-P7RBQUAG.js.map → chunk-ROCNXZBC.js.map} +0 -0
- /package/dist/{chunk-UN7PYUJB.js.map → chunk-SX4E2W3Z.js.map} +0 -0
- /package/dist/{chunk-UGJRDFMN.js.map → chunk-T3VD32JY.js.map} +0 -0
- /package/dist/{chunk-TORS5V2C.js.map → chunk-TB26XNJH.js.map} +0 -0
- /package/dist/{chunk-MX3XD2ML.js.map → chunk-W76DOL27.js.map} +0 -0
- /package/dist/{chunk-I3LGUSZ3.js.map → chunk-WB33EPTV.js.map} +0 -0
- /package/dist/{chunk-HJA3Z56H.js.map → chunk-XGNB7LQB.js.map} +0 -0
- /package/dist/{chunk-EQLJYWLP.js.map → chunk-ZXFIBDT3.js.map} +0 -0
- /package/dist/{cli-circuit-breaker-JDGZ25MD.js.map → cli-circuit-breaker-FJQXDC5M.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-UQTCPADM.js.map} +0 -0
- /package/dist/{consensus-vote-YKKJHLOD.js.map → consensus-vote-FEDF24T5.js.map} +0 -0
- /package/dist/{context-retriever-EGMARBAC.js.map → context-retriever-TIJGFLGO.js.map} +0 -0
- /package/dist/{doctor-deep-QTBDR3VV.js.map → doctor-deep-EULAHWTK.js.map} +0 -0
- /package/dist/{expert-bridge-FZYJ3XAL.js.map → expert-bridge-7HQ54XYU.js.map} +0 -0
- /package/dist/{factory-NDMPXPYE.js.map → factory-QZZQVDGQ.js.map} +0 -0
- /package/dist/{factory-SABHBAHC.js.map → factory-RW2ROEDS.js.map} +0 -0
- /package/dist/{improvement-review-WYFGNEVP.js.map → improvement-review-DGQPADKS.js.map} +0 -0
- /package/dist/{init-opencode-CMGJ3TXZ.js.map → init-opencode-MK2NUEWH.js.map} +0 -0
- /package/dist/{issue-triage-NHRZGMKC.js.map → issue-triage-RVDZEM53.js.map} +0 -0
- /package/dist/{pr-reviewer-helpers-HJRFRUZX.js.map → pr-reviewer-helpers-TKXJBDT6.js.map} +0 -0
- /package/dist/{registry-command-JCOZA7TM.js.map → registry-command-VXXKVZ3H.js.map} +0 -0
- /package/dist/{repo-security-plan-OMY33VHA.js.map → repo-security-plan-YCTKRAGA.js.map} +0 -0
- /package/dist/{research-helpers-synthesize-DFINP3KN.js.map → research-helpers-synthesize-4L6SXYQU.js.map} +0 -0
- /package/dist/{routing-memory-KK4GPB64.js.map → routing-memory-INY5DC2P.js.map} +0 -0
- /package/dist/{session-memory-QTHGU2XM.js.map → session-memory-TQMLN67N.js.map} +0 -0
- /package/dist/{setup-command-CURZCHSQ.js.map → setup-command-FT5LBTSR.js.map} +0 -0
- /package/dist/{setup-config-FX6SJXGQ.js.map → setup-config-U3WLC5OO.js.map} +0 -0
- /package/dist/{setup-custom-api-MYN4EVT2.js.map → setup-custom-api-2E4MZ5MF.js.map} +0 -0
- /package/dist/{tool-memory-3W5NXR4P.js.map → tool-memory-IV5BVIV4.js.map} +0 -0
- /package/dist/{unified-registry-PKPNJ3G7.js.map → unified-registry-6LFTI4MG.js.map} +0 -0
- /package/dist/{weather-report-46ZY3X2Z.js.map → weather-report-7NZ6D4C7.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
generateSecurityPlan
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-HNNSCTOI.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-ROCNXZBC.js";
|
|
24
25
|
import {
|
|
25
26
|
executeExpert
|
|
26
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-4G5W5EPU.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-F6HJJG3E.js";
|
|
48
49
|
import {
|
|
49
50
|
normalizeTopicToCanonical,
|
|
50
51
|
synthesizeResearch
|
|
51
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-7S43YASS.js";
|
|
52
53
|
import {
|
|
53
54
|
IssueTriage
|
|
54
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-R46SBPLH.js";
|
|
55
56
|
import {
|
|
56
57
|
resolveEnvMode,
|
|
57
58
|
sanitizeInput
|
|
58
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-SX4E2W3Z.js";
|
|
59
60
|
import {
|
|
60
61
|
withPrerequisite
|
|
61
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-EQRN5FRZ.js";
|
|
62
63
|
import {
|
|
63
64
|
NOOP_NOTIFIER,
|
|
64
65
|
RateLimiter,
|
|
@@ -81,12 +82,12 @@ import {
|
|
|
81
82
|
withAuditTrail,
|
|
82
83
|
withProgressHeartbeat,
|
|
83
84
|
wrapToolWithTimeout
|
|
84
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-IQC2K3KY.js";
|
|
85
86
|
import {
|
|
86
87
|
createAuditTrail,
|
|
87
88
|
createGraphAuditBridge,
|
|
88
89
|
emitPipelinePolicyEvent
|
|
89
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-BWG54OJS.js";
|
|
90
91
|
import {
|
|
91
92
|
addResearchPaper,
|
|
92
93
|
addSourceToRegistry,
|
|
@@ -114,15 +115,15 @@ import {
|
|
|
114
115
|
parseRegistry,
|
|
115
116
|
sourceExistsInRegistry,
|
|
116
117
|
summarizeContextForPrompt
|
|
117
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-XGNB7LQB.js";
|
|
118
119
|
import {
|
|
119
120
|
getTokenEnvVars,
|
|
120
121
|
resolveToken
|
|
121
|
-
} from "./chunk-
|
|
122
|
+
} from "./chunk-3JH3FMEJ.js";
|
|
122
123
|
import {
|
|
123
124
|
loadPapersRegistry,
|
|
124
125
|
loadTechniquesRegistry
|
|
125
|
-
} from "./chunk-
|
|
126
|
+
} from "./chunk-HAVBBSYN.js";
|
|
126
127
|
import {
|
|
127
128
|
resolveInsideRoot
|
|
128
129
|
} from "./chunk-NUBSJGQZ.js";
|
|
@@ -131,14 +132,14 @@ import {
|
|
|
131
132
|
MemoryImportance,
|
|
132
133
|
calculateTextJaccardSimilarity,
|
|
133
134
|
getToolMemory
|
|
134
|
-
} from "./chunk-
|
|
135
|
+
} from "./chunk-Q3UMNYV2.js";
|
|
135
136
|
import {
|
|
136
137
|
STOPWORDS,
|
|
137
138
|
truncateWithInfo
|
|
138
139
|
} from "./chunk-6T3EPABN.js";
|
|
139
140
|
import {
|
|
140
141
|
createSessionMemory
|
|
141
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-W76DOL27.js";
|
|
142
143
|
import {
|
|
143
144
|
BUILT_IN_EXPERTS,
|
|
144
145
|
BuiltInExpertTypeSchema,
|
|
@@ -153,7 +154,7 @@ import {
|
|
|
153
154
|
createEvent,
|
|
154
155
|
getGlobalEventBus,
|
|
155
156
|
getGlobalRegistry
|
|
156
|
-
} from "./chunk-
|
|
157
|
+
} from "./chunk-P7MYTCE6.js";
|
|
157
158
|
import {
|
|
158
159
|
CliDetectionCache,
|
|
159
160
|
asRecord,
|
|
@@ -161,19 +162,19 @@ import {
|
|
|
161
162
|
getAvailableClis,
|
|
162
163
|
sleep,
|
|
163
164
|
withTimeout
|
|
164
|
-
} from "./chunk-
|
|
165
|
+
} from "./chunk-NT3KCLT6.js";
|
|
165
166
|
import {
|
|
166
167
|
DEFAULTS
|
|
167
|
-
} from "./chunk-
|
|
168
|
+
} from "./chunk-JCJHQSAY.js";
|
|
168
169
|
import {
|
|
169
170
|
getAvailabilityCache,
|
|
170
171
|
getCliForModelId,
|
|
171
172
|
resolveFallback
|
|
172
|
-
} from "./chunk-
|
|
173
|
+
} from "./chunk-T3VD32JY.js";
|
|
173
174
|
import {
|
|
174
175
|
generateHyphenId,
|
|
175
176
|
generateUUID
|
|
176
|
-
} from "./chunk-
|
|
177
|
+
} from "./chunk-OOFPDA3B.js";
|
|
177
178
|
import {
|
|
178
179
|
AGENT_ROUTER_TIMEOUTS,
|
|
179
180
|
API_TIMEOUTS,
|
|
@@ -265,7 +266,7 @@ import {
|
|
|
265
266
|
selectStrategyByManifest,
|
|
266
267
|
toExpertTaskAnalysisResult,
|
|
267
268
|
withStep
|
|
268
|
-
} from "./chunk-
|
|
269
|
+
} from "./chunk-QXSR5KPG.js";
|
|
269
270
|
import {
|
|
270
271
|
ensureLearningDir,
|
|
271
272
|
getMetaOutcomesFile,
|
|
@@ -2565,13 +2566,13 @@ function makeCancelError(taskId) {
|
|
|
2565
2566
|
}
|
|
2566
2567
|
function executeWithTimeout(params) {
|
|
2567
2568
|
const { task, maxDurationMs, executeTask, transformError, signal } = params;
|
|
2568
|
-
return new Promise((
|
|
2569
|
+
return new Promise((resolve20) => {
|
|
2569
2570
|
let settled = false;
|
|
2570
2571
|
const settle = (result) => {
|
|
2571
2572
|
if (settled) return;
|
|
2572
2573
|
settled = true;
|
|
2573
2574
|
clearTimeout(timeoutId);
|
|
2574
|
-
|
|
2575
|
+
resolve20(result);
|
|
2575
2576
|
};
|
|
2576
2577
|
const timeoutId = setTimeout(() => {
|
|
2577
2578
|
settle(
|
|
@@ -7981,13 +7982,13 @@ var WaveScheduler = class {
|
|
|
7981
7982
|
}
|
|
7982
7983
|
async withTimeout(promise, timeoutMs, taskId) {
|
|
7983
7984
|
if (timeoutMs <= 0) return promise;
|
|
7984
|
-
return new Promise((
|
|
7985
|
+
return new Promise((resolve20, reject) => {
|
|
7985
7986
|
const timer = setTimeout(() => {
|
|
7986
7987
|
reject(new Error(`Task ${taskId} timed out after ${String(timeoutMs)}ms`));
|
|
7987
7988
|
}, timeoutMs);
|
|
7988
7989
|
promise.then((result) => {
|
|
7989
7990
|
clearTimeout(timer);
|
|
7990
|
-
|
|
7991
|
+
resolve20(result);
|
|
7991
7992
|
}).catch((error) => {
|
|
7992
7993
|
clearTimeout(timer);
|
|
7993
7994
|
reject(error instanceof Error ? error : new Error(String(error)));
|
|
@@ -7999,8 +8000,8 @@ function chunkByDirectory(files, basePath) {
|
|
|
7999
8000
|
const normalizedBase = basePath.endsWith("/") ? basePath : `${basePath}/`;
|
|
8000
8001
|
const groups = /* @__PURE__ */ new Map();
|
|
8001
8002
|
for (const file of files) {
|
|
8002
|
-
const
|
|
8003
|
-
const stripped =
|
|
8003
|
+
const relative2 = file.startsWith(normalizedBase) ? file.slice(normalizedBase.length) : file;
|
|
8004
|
+
const stripped = relative2.startsWith("/") ? relative2.slice(1) : relative2;
|
|
8004
8005
|
const topDir = stripped.split("/")[0] ?? "root";
|
|
8005
8006
|
const existing = groups.get(topDir);
|
|
8006
8007
|
if (existing !== void 0) {
|
|
@@ -14921,8 +14922,8 @@ var Semaphore = class {
|
|
|
14921
14922
|
this.available -= 1;
|
|
14922
14923
|
return Promise.resolve();
|
|
14923
14924
|
}
|
|
14924
|
-
return new Promise((
|
|
14925
|
-
this.waiters.push(
|
|
14925
|
+
return new Promise((resolve20) => {
|
|
14926
|
+
this.waiters.push(resolve20);
|
|
14926
14927
|
});
|
|
14927
14928
|
}
|
|
14928
14929
|
release() {
|
|
@@ -18355,9 +18356,9 @@ var ExpertPool = class {
|
|
|
18355
18356
|
if (this.active < this.capacity) {
|
|
18356
18357
|
return this.issuePermit();
|
|
18357
18358
|
}
|
|
18358
|
-
return new Promise((
|
|
18359
|
+
return new Promise((resolve20, reject) => {
|
|
18359
18360
|
const timer = setTimeout(() => {
|
|
18360
|
-
const idx = this.queue.findIndex((e) => e.resolve ===
|
|
18361
|
+
const idx = this.queue.findIndex((e) => e.resolve === resolve20);
|
|
18361
18362
|
if (idx !== -1) {
|
|
18362
18363
|
this.queue.splice(idx, 1);
|
|
18363
18364
|
}
|
|
@@ -18367,7 +18368,7 @@ var ExpertPool = class {
|
|
|
18367
18368
|
)
|
|
18368
18369
|
);
|
|
18369
18370
|
}, this.acquireTimeoutMs);
|
|
18370
|
-
this.queue.push({ resolve:
|
|
18371
|
+
this.queue.push({ resolve: resolve20, reject, timer });
|
|
18371
18372
|
});
|
|
18372
18373
|
}
|
|
18373
18374
|
/** Release a permit back to the pool. */
|
|
@@ -18951,8 +18952,8 @@ var TaskQueue = class {
|
|
|
18951
18952
|
if (this.cancelled) {
|
|
18952
18953
|
return Promise.reject(new Error("Queue has been cancelled"));
|
|
18953
18954
|
}
|
|
18954
|
-
return new Promise((
|
|
18955
|
-
this.queue.push({ task, resolve:
|
|
18955
|
+
return new Promise((resolve20, reject) => {
|
|
18956
|
+
this.queue.push({ task, resolve: resolve20, reject });
|
|
18956
18957
|
this.processNext();
|
|
18957
18958
|
});
|
|
18958
18959
|
}
|
|
@@ -19228,16 +19229,16 @@ async function executeStepWithTimeout(step, context, stepExecutor, signal) {
|
|
|
19228
19229
|
return executeWithTimeout2(step, stepContext, stepExecutor, stepTimeout, startTime);
|
|
19229
19230
|
}
|
|
19230
19231
|
function executeWithTimeout2(step, context, executor, timeout, startTime) {
|
|
19231
|
-
return new Promise((
|
|
19232
|
+
return new Promise((resolve20) => {
|
|
19232
19233
|
const timeoutId = setTimeout(() => {
|
|
19233
|
-
|
|
19234
|
+
resolve20(createTimeoutResult(step.id, getTimeProvider().now() - startTime, timeout));
|
|
19234
19235
|
}, timeout);
|
|
19235
19236
|
executor(step, context).then((result) => {
|
|
19236
19237
|
clearTimeout(timeoutId);
|
|
19237
|
-
|
|
19238
|
+
resolve20(result);
|
|
19238
19239
|
}).catch((error) => {
|
|
19239
19240
|
clearTimeout(timeoutId);
|
|
19240
|
-
|
|
19241
|
+
resolve20(createErrorResult(step.id, getTimeProvider().now() - startTime, error));
|
|
19241
19242
|
});
|
|
19242
19243
|
});
|
|
19243
19244
|
}
|
|
@@ -23644,10 +23645,10 @@ function calculateZStatistic(params) {
|
|
|
23644
23645
|
function calculateDifferenceCI(p1, p2, total1, total2, confidence) {
|
|
23645
23646
|
const difference = p1 - p2;
|
|
23646
23647
|
const seDiff = Math.sqrt(p1 * (1 - p1) / (total1 || 1) + p2 * (1 - p2) / (total2 || 1));
|
|
23647
|
-
const
|
|
23648
|
+
const z117 = getZScore(confidence);
|
|
23648
23649
|
return {
|
|
23649
|
-
lower: difference -
|
|
23650
|
-
upper: difference +
|
|
23650
|
+
lower: difference - z117 * seDiff,
|
|
23651
|
+
upper: difference + z117 * seDiff,
|
|
23651
23652
|
estimate: difference,
|
|
23652
23653
|
confidence,
|
|
23653
23654
|
n: total1 + total2,
|
|
@@ -23670,11 +23671,11 @@ function proportionConfidenceInterval(successes, total, options = {}) {
|
|
|
23670
23671
|
standardError: 0
|
|
23671
23672
|
};
|
|
23672
23673
|
}
|
|
23673
|
-
const
|
|
23674
|
-
const z210 =
|
|
23674
|
+
const z117 = getZScore(opts.confidence);
|
|
23675
|
+
const z210 = z117 * z117;
|
|
23675
23676
|
const denominator = 1 + z210 / n;
|
|
23676
23677
|
const center = (p + z210 / (2 * n)) / denominator;
|
|
23677
|
-
const margin =
|
|
23678
|
+
const margin = z117 / denominator * Math.sqrt(p * (1 - p) / n + z210 / (4 * n * n));
|
|
23678
23679
|
const lower = Math.max(0, center - margin);
|
|
23679
23680
|
const upper = Math.min(1, center + margin);
|
|
23680
23681
|
const standardError = Math.sqrt(p * (1 - p) / n);
|
|
@@ -23704,8 +23705,8 @@ function meanConfidenceInterval(values, options = {}) {
|
|
|
23704
23705
|
const variance = values.reduce((sum, v) => sum + (v - mean) ** 2, 0) / (n - 1 || 1);
|
|
23705
23706
|
const stdDev = Math.sqrt(variance);
|
|
23706
23707
|
const standardError = stdDev / Math.sqrt(n);
|
|
23707
|
-
const
|
|
23708
|
-
const margin =
|
|
23708
|
+
const z117 = getZScore(opts.confidence);
|
|
23709
|
+
const margin = z117 * standardError;
|
|
23709
23710
|
return {
|
|
23710
23711
|
lower: mean - margin,
|
|
23711
23712
|
upper: mean + margin,
|
|
@@ -26300,7 +26301,7 @@ function execIdFields(executionId) {
|
|
|
26300
26301
|
async function populateUnifiedContextOnState(state, options) {
|
|
26301
26302
|
const taskCandidate = state["task"];
|
|
26302
26303
|
if (typeof taskCandidate !== "string" || taskCandidate === "") return;
|
|
26303
|
-
const { getContextForTask: getContextForTask2, inferTaskCategory: inferTaskCategory2 } = await import("./context-retriever-
|
|
26304
|
+
const { getContextForTask: getContextForTask2, inferTaskCategory: inferTaskCategory2 } = await import("./context-retriever-TIJGFLGO.js");
|
|
26304
26305
|
const category = inferTaskCategory2(taskCandidate);
|
|
26305
26306
|
const executionId = options?.executionId;
|
|
26306
26307
|
const execFields = execIdFields(executionId);
|
|
@@ -26797,13 +26798,13 @@ function dedupe(ids) {
|
|
|
26797
26798
|
return [...new Set(ids)];
|
|
26798
26799
|
}
|
|
26799
26800
|
async function withTimeout2(promise, ms) {
|
|
26800
|
-
return new Promise((
|
|
26801
|
+
return new Promise((resolve20, reject) => {
|
|
26801
26802
|
const timer = setTimeout(() => {
|
|
26802
26803
|
reject(new Error(`Node timed out after ${String(ms)}ms`));
|
|
26803
26804
|
}, ms);
|
|
26804
26805
|
promise.then((result) => {
|
|
26805
26806
|
clearTimeout(timer);
|
|
26806
|
-
|
|
26807
|
+
resolve20(result);
|
|
26807
26808
|
}).catch((error) => {
|
|
26808
26809
|
clearTimeout(timer);
|
|
26809
26810
|
reject(error instanceof Error ? error : new Error(String(error)));
|
|
@@ -29243,11 +29244,11 @@ function createMockOrchestrator() {
|
|
|
29243
29244
|
async function raceAgainstDeadline(promise, deadlineMs, onTimeout) {
|
|
29244
29245
|
const startedAt = Date.now();
|
|
29245
29246
|
let timer;
|
|
29246
|
-
const timeoutP = new Promise((
|
|
29247
|
+
const timeoutP = new Promise((resolve20, reject) => {
|
|
29247
29248
|
timer = setTimeout(
|
|
29248
29249
|
() => {
|
|
29249
29250
|
try {
|
|
29250
|
-
|
|
29251
|
+
resolve20(onTimeout(Date.now() - startedAt));
|
|
29251
29252
|
} catch (err2) {
|
|
29252
29253
|
reject(err2 instanceof Error ? err2 : new Error(String(err2)));
|
|
29253
29254
|
}
|
|
@@ -30450,11 +30451,11 @@ function createWorkerTask(entry, taskIndex, waveNumber, opts) {
|
|
|
30450
30451
|
const staggerSlot = taskIndex % opts.maxConcurrency;
|
|
30451
30452
|
const staggerMs = staggerSlot * opts.staggerDelayMs;
|
|
30452
30453
|
if (staggerMs > 0) {
|
|
30453
|
-
await new Promise((
|
|
30454
|
+
await new Promise((resolve20) => setTimeout(resolve20, staggerMs));
|
|
30454
30455
|
}
|
|
30455
30456
|
const spacingDelay = opts.failureTracker.getSpacingDelay(entry.role);
|
|
30456
30457
|
if (spacingDelay > 0) {
|
|
30457
|
-
await new Promise((
|
|
30458
|
+
await new Promise((resolve20) => setTimeout(resolve20, spacingDelay));
|
|
30458
30459
|
}
|
|
30459
30460
|
const timeoutMs = opts.options.workerTimeoutMs ?? getExpertTaskTimeout(entry.subTask);
|
|
30460
30461
|
const result = await executeSafe({
|
|
@@ -30506,7 +30507,7 @@ async function maybeDelayForRateLimit(results, waveIdx, totalWaves) {
|
|
|
30506
30507
|
);
|
|
30507
30508
|
if (hasRateLimit) {
|
|
30508
30509
|
logger26.warn("Rate-limit detected \u2014 delaying next wave", { delayMs: RATE_LIMIT_WAVE_DELAY_MS });
|
|
30509
|
-
await new Promise((
|
|
30510
|
+
await new Promise((resolve20) => setTimeout(resolve20, RATE_LIMIT_WAVE_DELAY_MS));
|
|
30510
30511
|
}
|
|
30511
30512
|
}
|
|
30512
30513
|
function emitWaveStarted(ctx, workerCount, roles) {
|
|
@@ -30604,7 +30605,7 @@ async function maybeRetryAfterTriage(opts) {
|
|
|
30604
30605
|
}
|
|
30605
30606
|
const useAltCli = triage.action === "retry_different_cli" && altExecuteWorker !== void 0;
|
|
30606
30607
|
if (triage.action === "retry_different_cli") {
|
|
30607
|
-
await new Promise((
|
|
30608
|
+
await new Promise((resolve20) => setTimeout(resolve20, RATE_LIMIT_SPACING_MS));
|
|
30608
30609
|
}
|
|
30609
30610
|
const retryTimeout = triage.action === "extend_timeout" ? Math.min(timeoutMs * TIMEOUT_EXTENSION_FACTOR, MAX_WORKER_TIMEOUT_MS) : timeoutMs;
|
|
30610
30611
|
const retryExecutor = useAltCli ? altExecuteWorker : executeWorker;
|
|
@@ -39848,14 +39849,224 @@ function registerExtractSymbolsTool(server, deps) {
|
|
|
39848
39849
|
logger58.info("Registered extract_symbols tool");
|
|
39849
39850
|
}
|
|
39850
39851
|
|
|
39851
|
-
// src/mcp/tools/
|
|
39852
|
-
import { readFile as readFile3
|
|
39853
|
-
import {
|
|
39852
|
+
// src/mcp/tools/search-usages-tool.ts
|
|
39853
|
+
import { readFile as readFile3 } from "fs/promises";
|
|
39854
|
+
import { extname as extname3, relative, resolve as resolve9, sep as sep5 } from "path";
|
|
39854
39855
|
import { z as z81 } from "zod";
|
|
39855
|
-
|
|
39856
|
-
|
|
39857
|
-
|
|
39858
|
-
|
|
39856
|
+
import { Lang, parse as parse2 } from "@ast-grep/napi";
|
|
39857
|
+
var DEFAULT_USAGES_LIMIT = 50;
|
|
39858
|
+
var MAX_USAGES_LIMIT = 500;
|
|
39859
|
+
var DEFAULT_USAGES_MAX_DEPTH = 24;
|
|
39860
|
+
var MAX_USAGES_MAX_DEPTH = 64;
|
|
39861
|
+
var MAX_FILES_SCANNED = 5e3;
|
|
39862
|
+
var MAX_SNIPPET_CHARS = 200;
|
|
39863
|
+
var IDENTIFIER_RE = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
39864
|
+
var LANG_VALUES = ["typescript", "tsx", "javascript"];
|
|
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
|
+
var DECLARATION_PARENT_KINDS = /* @__PURE__ */ new Set([
|
|
39878
|
+
"function_declaration",
|
|
39879
|
+
"generator_function_declaration",
|
|
39880
|
+
"class_declaration",
|
|
39881
|
+
"interface_declaration",
|
|
39882
|
+
"type_alias_declaration",
|
|
39883
|
+
"enum_declaration",
|
|
39884
|
+
"function_signature",
|
|
39885
|
+
"method_definition",
|
|
39886
|
+
"abstract_method_signature"
|
|
39887
|
+
]);
|
|
39888
|
+
var IMPORT_PARENT_KINDS = /* @__PURE__ */ new Set([
|
|
39889
|
+
"import_specifier",
|
|
39890
|
+
"namespace_import",
|
|
39891
|
+
"import_clause"
|
|
39892
|
+
]);
|
|
39893
|
+
function langToNapi(lang) {
|
|
39894
|
+
if (lang === "tsx") return Lang.Tsx;
|
|
39895
|
+
if (lang === "javascript") return Lang.JavaScript;
|
|
39896
|
+
return Lang.TypeScript;
|
|
39897
|
+
}
|
|
39898
|
+
function escapeRegex2(value) {
|
|
39899
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
39900
|
+
}
|
|
39901
|
+
function isDeclaredName(declarator, node) {
|
|
39902
|
+
const name = declarator.field("name");
|
|
39903
|
+
return name !== null && name.id() === node.id();
|
|
39904
|
+
}
|
|
39905
|
+
function classifyIdentifier(node) {
|
|
39906
|
+
const parent = node.parent();
|
|
39907
|
+
if (parent === null) return "reference";
|
|
39908
|
+
const pk = String(parent.kind());
|
|
39909
|
+
if (DECLARATION_PARENT_KINDS.has(pk)) return null;
|
|
39910
|
+
if (pk === "variable_declarator") return isDeclaredName(parent, node) ? null : "reference";
|
|
39911
|
+
if (IMPORT_PARENT_KINDS.has(pk)) return "import";
|
|
39912
|
+
if (pk === "call_expression") return "call";
|
|
39913
|
+
if (pk === "new_expression") return "new";
|
|
39914
|
+
return "reference";
|
|
39915
|
+
}
|
|
39916
|
+
function classifyProperty(node) {
|
|
39917
|
+
const member = node.parent();
|
|
39918
|
+
const grandparent = member === null ? null : member.parent();
|
|
39919
|
+
if (grandparent !== null && String(grandparent.kind()) === "call_expression")
|
|
39920
|
+
return "method-call";
|
|
39921
|
+
return "reference";
|
|
39922
|
+
}
|
|
39923
|
+
function toMatch(node, kind, lines) {
|
|
39924
|
+
const { start } = node.range();
|
|
39925
|
+
const rawLine = lines[start.line] ?? node.text();
|
|
39926
|
+
return {
|
|
39927
|
+
line: start.line + 1,
|
|
39928
|
+
column: start.column + 1,
|
|
39929
|
+
kind,
|
|
39930
|
+
snippet: rawLine.trim().slice(0, MAX_SNIPPET_CHARS)
|
|
39931
|
+
};
|
|
39932
|
+
}
|
|
39933
|
+
function findUsagesInSource(symbol, src, lang) {
|
|
39934
|
+
if (!IDENTIFIER_RE.test(symbol)) return [];
|
|
39935
|
+
const root = parse2(langToNapi(lang), src).root();
|
|
39936
|
+
const lines = src.split("\n");
|
|
39937
|
+
const out = [];
|
|
39938
|
+
for (const node of root.findAll(symbol)) {
|
|
39939
|
+
const kind = classifyIdentifier(node);
|
|
39940
|
+
if (kind !== null) out.push(toMatch(node, kind, lines));
|
|
39941
|
+
}
|
|
39942
|
+
const propRule = {
|
|
39943
|
+
rule: { kind: "property_identifier", regex: `^${escapeRegex2(symbol)}$` }
|
|
39944
|
+
};
|
|
39945
|
+
for (const node of root.findAll(propRule)) {
|
|
39946
|
+
out.push(toMatch(node, classifyProperty(node), lines));
|
|
39947
|
+
}
|
|
39948
|
+
return out.sort((a, b) => a.line - b.line || a.column - b.column);
|
|
39949
|
+
}
|
|
39950
|
+
function inferLang(file) {
|
|
39951
|
+
const ext = extname3(file).toLowerCase();
|
|
39952
|
+
if (ext === ".tsx" || ext === ".jsx") return "tsx";
|
|
39953
|
+
if (ext === ".js" || ext === ".mjs" || ext === ".cjs") return "javascript";
|
|
39954
|
+
return "typescript";
|
|
39955
|
+
}
|
|
39956
|
+
function resolveWithinCwd(target) {
|
|
39957
|
+
const resolved = resolve9(target);
|
|
39958
|
+
const cwdRoot = resolve9(".");
|
|
39959
|
+
if (resolved !== cwdRoot && !resolved.startsWith(cwdRoot + sep5)) {
|
|
39960
|
+
return { error: `Path traversal denied: scope must be within ${cwdRoot}` };
|
|
39961
|
+
}
|
|
39962
|
+
return { resolved };
|
|
39963
|
+
}
|
|
39964
|
+
async function resolveFileScope(input) {
|
|
39965
|
+
if (input.path !== void 0) {
|
|
39966
|
+
const guard2 = resolveWithinCwd(input.path);
|
|
39967
|
+
if ("error" in guard2) return guard2;
|
|
39968
|
+
return { files: [guard2.resolved], root: resolve9(".") };
|
|
39969
|
+
}
|
|
39970
|
+
const guard = resolveWithinCwd(input.dir ?? process.cwd());
|
|
39971
|
+
if ("error" in guard) return guard;
|
|
39972
|
+
const walk = await findSourceFiles(guard.resolved, input.maxDepth ?? DEFAULT_USAGES_MAX_DEPTH);
|
|
39973
|
+
return { files: walk.files.slice(0, MAX_FILES_SCANNED), root: guard.resolved };
|
|
39974
|
+
}
|
|
39975
|
+
async function collectUsages(input, scope, limit, ctx) {
|
|
39976
|
+
const results = [];
|
|
39977
|
+
let total = 0;
|
|
39978
|
+
for (const file of scope.files) {
|
|
39979
|
+
let src;
|
|
39980
|
+
try {
|
|
39981
|
+
src = await readFile3(file, "utf8");
|
|
39982
|
+
} catch {
|
|
39983
|
+
ctx.logger.warn(`search_usages: skipped unreadable file ${file}`);
|
|
39984
|
+
continue;
|
|
39985
|
+
}
|
|
39986
|
+
const lang = input.lang ?? inferLang(file);
|
|
39987
|
+
const rel = relative(scope.root, file) || file;
|
|
39988
|
+
for (const match of findUsagesInSource(input.symbol, src, lang)) {
|
|
39989
|
+
total += 1;
|
|
39990
|
+
if (results.length < limit) results.push({ file: rel, ...match });
|
|
39991
|
+
}
|
|
39992
|
+
}
|
|
39993
|
+
return { results, total };
|
|
39994
|
+
}
|
|
39995
|
+
function buildOutput2(input, scope, limit, collected) {
|
|
39996
|
+
const payload = {
|
|
39997
|
+
symbol: input.symbol,
|
|
39998
|
+
scope: input.path !== void 0 ? { path: input.path } : { dir: input.dir ?? "." },
|
|
39999
|
+
lang: input.lang ?? "inferred",
|
|
40000
|
+
filesScanned: scope.files.length,
|
|
40001
|
+
totalMatches: collected.total,
|
|
40002
|
+
results: collected.results
|
|
40003
|
+
};
|
|
40004
|
+
if (collected.total > collected.results.length) {
|
|
40005
|
+
payload["truncated"] = true;
|
|
40006
|
+
payload["omittedMatches"] = collected.total - collected.results.length;
|
|
40007
|
+
payload["limit"] = limit;
|
|
40008
|
+
}
|
|
40009
|
+
return JSON.stringify(payload, null, 2);
|
|
40010
|
+
}
|
|
40011
|
+
async function searchUsagesHandler(args, ctx) {
|
|
40012
|
+
const parsed = SearchUsagesInputSchema.safeParse(args);
|
|
40013
|
+
if (!parsed.success) {
|
|
40014
|
+
return toolStructuredError({
|
|
40015
|
+
errorCategory: "validation",
|
|
40016
|
+
message: `Validation error: ${formatZodError(parsed.error)}`
|
|
40017
|
+
});
|
|
40018
|
+
}
|
|
40019
|
+
const scope = await resolveFileScope(parsed.data);
|
|
40020
|
+
if ("error" in scope) {
|
|
40021
|
+
return toolStructuredError({ errorCategory: "permission", message: scope.error });
|
|
40022
|
+
}
|
|
40023
|
+
try {
|
|
40024
|
+
const limit = parsed.data.limit ?? DEFAULT_USAGES_LIMIT;
|
|
40025
|
+
const collected = await collectUsages(parsed.data, scope, limit, ctx);
|
|
40026
|
+
return toolSuccess(buildOutput2(parsed.data, scope, limit, collected));
|
|
40027
|
+
} catch (caught) {
|
|
40028
|
+
const e = caught instanceof Error ? caught : new Error(String(caught));
|
|
40029
|
+
ctx.logger.error("Usage search failed", e);
|
|
40030
|
+
return toolStructuredError({
|
|
40031
|
+
errorCategory: "internal",
|
|
40032
|
+
message: `Usage search failed: ${e.message}`
|
|
40033
|
+
});
|
|
40034
|
+
}
|
|
40035
|
+
}
|
|
40036
|
+
function registerSearchUsagesTool(server, deps) {
|
|
40037
|
+
const logger58 = deps.logger ?? createLogger({ tool: "search_usages" });
|
|
40038
|
+
const toolSchema = {
|
|
40039
|
+
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"),
|
|
40040
|
+
path: z81.string().min(1).max(500).optional().describe("Restrict to a single source file"),
|
|
40041
|
+
dir: z81.string().min(1).max(500).optional().describe("Directory to search (default: cwd)"),
|
|
40042
|
+
lang: z81.enum(LANG_VALUES).optional().describe("Language override (default: infer from ext)"),
|
|
40043
|
+
limit: z81.number().int().min(1).max(MAX_USAGES_LIMIT).optional().describe(`Max matches (default ${String(DEFAULT_USAGES_LIMIT)})`),
|
|
40044
|
+
maxDepth: z81.number().int().min(1).max(MAX_USAGES_MAX_DEPTH).optional().describe(`Directory walk depth (default ${String(DEFAULT_USAGES_MAX_DEPTH)})`)
|
|
40045
|
+
};
|
|
40046
|
+
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.`;
|
|
40047
|
+
const secureHandler = createSecureHandler(searchUsagesHandler, {
|
|
40048
|
+
toolName: "search_usages",
|
|
40049
|
+
rateLimiter: deps.rateLimiter,
|
|
40050
|
+
logger: logger58
|
|
40051
|
+
});
|
|
40052
|
+
const timeoutMs = getToolTimeout("search_usages", deps.security);
|
|
40053
|
+
const wrapped = wrapToolWithTimeout("search_usages", secureHandler, { timeoutMs, logger: logger58 });
|
|
40054
|
+
server.registerTool(
|
|
40055
|
+
"search_usages",
|
|
40056
|
+
{ description, inputSchema: toolSchema, annotations: getToolAnnotations("search_usages") },
|
|
40057
|
+
toSdkCallback(wrapped)
|
|
40058
|
+
);
|
|
40059
|
+
logger58.info("Registered search_usages tool");
|
|
40060
|
+
}
|
|
40061
|
+
|
|
40062
|
+
// src/mcp/tools/query-trace-tool.ts
|
|
40063
|
+
import { readFile as readFile4, stat as stat3 } from "fs/promises";
|
|
40064
|
+
import { join as join6, resolve as resolve10, sep as sep6 } from "path";
|
|
40065
|
+
import { z as z82 } from "zod";
|
|
40066
|
+
var QueryTraceInputSchema = z82.object({
|
|
40067
|
+
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"),
|
|
40068
|
+
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"),
|
|
40069
|
+
limit: z82.number().min(1).max(500).optional().describe("Max events to return (default: 100)")
|
|
39859
40070
|
});
|
|
39860
40071
|
var MAX_TRACE_FILE_BYTES = 100 * 1024 * 1024;
|
|
39861
40072
|
var traceLogger = createLogger({ component: "query-trace" });
|
|
@@ -39899,9 +40110,9 @@ var EMPTY_RESPONSE = {
|
|
|
39899
40110
|
async function queryTraceFromDisk(input, runsDir) {
|
|
39900
40111
|
const dir = runsDir ?? getDefaultRunsDir();
|
|
39901
40112
|
const tracePath = join6(dir, input.runId, "trace.jsonl");
|
|
39902
|
-
const resolvedDir =
|
|
39903
|
-
const resolvedTrace =
|
|
39904
|
-
if (!resolvedTrace.startsWith(resolvedDir +
|
|
40113
|
+
const resolvedDir = resolve10(dir);
|
|
40114
|
+
const resolvedTrace = resolve10(tracePath);
|
|
40115
|
+
if (!resolvedTrace.startsWith(resolvedDir + sep6) && resolvedTrace !== resolvedDir) {
|
|
39905
40116
|
return { runId: input.runId, ...EMPTY_RESPONSE };
|
|
39906
40117
|
}
|
|
39907
40118
|
try {
|
|
@@ -39909,7 +40120,7 @@ async function queryTraceFromDisk(input, runsDir) {
|
|
|
39909
40120
|
if (fileStat.size > MAX_TRACE_FILE_BYTES) {
|
|
39910
40121
|
return { runId: input.runId, ...EMPTY_RESPONSE, truncated: true };
|
|
39911
40122
|
}
|
|
39912
|
-
const content = await
|
|
40123
|
+
const content = await readFile4(tracePath, "utf-8");
|
|
39913
40124
|
let parsed = parseJsonlLines(content);
|
|
39914
40125
|
const limit = input.limit ?? 100;
|
|
39915
40126
|
if (input.eventType !== void 0) {
|
|
@@ -39960,9 +40171,9 @@ function queryTraceHandler(args, ctx) {
|
|
|
39960
40171
|
function registerQueryTraceTool(server, deps) {
|
|
39961
40172
|
const logger58 = deps.logger ?? createLogger({ tool: "query_trace" });
|
|
39962
40173
|
const toolSchema = {
|
|
39963
|
-
runId:
|
|
39964
|
-
eventType:
|
|
39965
|
-
limit:
|
|
40174
|
+
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"),
|
|
40175
|
+
eventType: z82.string().max(100).regex(/^[a-zA-Z0-9._-]+$/).optional().describe("Filter by event type (e.g., model.called)"),
|
|
40176
|
+
limit: z82.number().min(1).max(500).optional().describe("Max events to return (default: 100)")
|
|
39966
40177
|
};
|
|
39967
40178
|
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
40179
|
const secureHandler = createSecureHandler(queryTraceHandler, {
|
|
@@ -39981,7 +40192,7 @@ function registerQueryTraceTool(server, deps) {
|
|
|
39981
40192
|
}
|
|
39982
40193
|
|
|
39983
40194
|
// src/mcp/tools/get-job-result-tool.ts
|
|
39984
|
-
import { z as
|
|
40195
|
+
import { z as z83 } from "zod";
|
|
39985
40196
|
|
|
39986
40197
|
// src/mcp/jobs/task-state-source.ts
|
|
39987
40198
|
var logger33 = createLogger({ component: "task-state-source" });
|
|
@@ -40090,8 +40301,8 @@ function resolveJobList(customDir) {
|
|
|
40090
40301
|
}
|
|
40091
40302
|
|
|
40092
40303
|
// src/mcp/tools/get-job-result-tool.ts
|
|
40093
|
-
var GetJobResultInputSchema =
|
|
40094
|
-
jobId:
|
|
40304
|
+
var GetJobResultInputSchema = z83.object({
|
|
40305
|
+
jobId: z83.string().min(1).max(128).describe('Job ID returned by orchestrate({ mode: "async" })')
|
|
40095
40306
|
});
|
|
40096
40307
|
function getJobResultHandler(args) {
|
|
40097
40308
|
const parsed = GetJobResultInputSchema.safeParse(args);
|
|
@@ -40122,7 +40333,7 @@ function getJobResultHandler(args) {
|
|
|
40122
40333
|
function registerGetJobResultTool(server, deps) {
|
|
40123
40334
|
const logger58 = deps.logger ?? createLogger({ tool: "get_job_result" });
|
|
40124
40335
|
const toolSchema = {
|
|
40125
|
-
jobId:
|
|
40336
|
+
jobId: z83.string().min(1).max(128).describe('Job ID returned by orchestrate({ mode: "async" })')
|
|
40126
40337
|
};
|
|
40127
40338
|
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
40339
|
const secureHandler = createSecureHandler(getJobResultHandler, {
|
|
@@ -40144,14 +40355,14 @@ function registerGetJobResultTool(server, deps) {
|
|
|
40144
40355
|
}
|
|
40145
40356
|
|
|
40146
40357
|
// src/mcp/tools/list-jobs-tool.ts
|
|
40147
|
-
import { z as
|
|
40358
|
+
import { z as z84 } from "zod";
|
|
40148
40359
|
var MAX_LIST_JOBS_RESULTS = 200;
|
|
40149
|
-
var ListJobsInputSchema =
|
|
40360
|
+
var ListJobsInputSchema = z84.object({
|
|
40150
40361
|
/**
|
|
40151
40362
|
* Filter to jobs from a specific tool (exact match — e.g. `'orchestrate'`).
|
|
40152
40363
|
* Omit to list every tool's jobs.
|
|
40153
40364
|
*/
|
|
40154
|
-
toolName:
|
|
40365
|
+
toolName: z84.string().min(1).max(128).optional().describe("Filter to one tool (exact match)."),
|
|
40155
40366
|
/**
|
|
40156
40367
|
* Filter to jobs in a specific lifecycle state.
|
|
40157
40368
|
* Omit to list every state.
|
|
@@ -40164,7 +40375,7 @@ var ListJobsInputSchema = z83.object({
|
|
|
40164
40375
|
* Newest jobs are returned first, so a smaller limit shows the most
|
|
40165
40376
|
* recent activity.
|
|
40166
40377
|
*/
|
|
40167
|
-
limit:
|
|
40378
|
+
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
40379
|
});
|
|
40169
40380
|
function listJobsHandler(args) {
|
|
40170
40381
|
const parsed = ListJobsInputSchema.safeParse(args);
|
|
@@ -40195,11 +40406,11 @@ function listJobsHandler(args) {
|
|
|
40195
40406
|
function registerListJobsTool(server, deps) {
|
|
40196
40407
|
const logger58 = deps.logger ?? createLogger({ tool: "list_jobs" });
|
|
40197
40408
|
const toolSchema = {
|
|
40198
|
-
toolName:
|
|
40409
|
+
toolName: z84.string().min(1).max(128).optional().describe("Filter to one tool (exact match)."),
|
|
40199
40410
|
status: JobStatusSchema.optional().describe(
|
|
40200
40411
|
"Filter to pending | complete | failed | cancelled. Omit for all."
|
|
40201
40412
|
),
|
|
40202
|
-
limit:
|
|
40413
|
+
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
40414
|
};
|
|
40204
40415
|
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
40416
|
const secureHandler = createSecureHandler(listJobsHandler, {
|
|
@@ -40221,10 +40432,10 @@ function registerListJobsTool(server, deps) {
|
|
|
40221
40432
|
}
|
|
40222
40433
|
|
|
40223
40434
|
// src/mcp/tools/cancel-job-tool.ts
|
|
40224
|
-
import { z as
|
|
40225
|
-
var CancelJobInputSchema =
|
|
40226
|
-
jobId:
|
|
40227
|
-
reason:
|
|
40435
|
+
import { z as z85 } from "zod";
|
|
40436
|
+
var CancelJobInputSchema = z85.object({
|
|
40437
|
+
jobId: z85.string().min(1).max(128).describe("Job ID returned by orchestrate / run_workflow / consensus_vote in async mode"),
|
|
40438
|
+
reason: z85.string().max(1e3).optional().describe('Optional human-readable note (e.g. "user clicked cancel").')
|
|
40228
40439
|
});
|
|
40229
40440
|
function cancelJobHandler(args) {
|
|
40230
40441
|
const parsed = CancelJobInputSchema.safeParse(args);
|
|
@@ -40281,8 +40492,8 @@ function cancelPendingJob(jobId, toolName, reason) {
|
|
|
40281
40492
|
function registerCancelJobTool(server, deps) {
|
|
40282
40493
|
const logger58 = deps.logger ?? createLogger({ tool: "cancel_job" });
|
|
40283
40494
|
const toolSchema = {
|
|
40284
|
-
jobId:
|
|
40285
|
-
reason:
|
|
40495
|
+
jobId: z85.string().min(1).max(128).describe("Job ID returned by orchestrate / run_workflow / consensus_vote in async mode"),
|
|
40496
|
+
reason: z85.string().max(1e3).optional().describe('Optional human-readable note (e.g. "user clicked cancel").')
|
|
40286
40497
|
};
|
|
40287
40498
|
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
40499
|
const secureHandler = createSecureHandler(cancelJobHandler, {
|
|
@@ -40304,7 +40515,7 @@ function registerCancelJobTool(server, deps) {
|
|
|
40304
40515
|
}
|
|
40305
40516
|
|
|
40306
40517
|
// src/audit/audit-types.ts
|
|
40307
|
-
import { z as
|
|
40518
|
+
import { z as z86 } from "zod";
|
|
40308
40519
|
var AuditError = class extends Error {
|
|
40309
40520
|
code = "AUDIT_ERROR";
|
|
40310
40521
|
context;
|
|
@@ -40316,7 +40527,7 @@ var AuditError = class extends Error {
|
|
|
40316
40527
|
this.context = options?.context;
|
|
40317
40528
|
}
|
|
40318
40529
|
};
|
|
40319
|
-
var AuditCategorySchema =
|
|
40530
|
+
var AuditCategorySchema = z86.enum([
|
|
40320
40531
|
"authentication",
|
|
40321
40532
|
// Login, logout, token refresh
|
|
40322
40533
|
"authorization",
|
|
@@ -40336,28 +40547,28 @@ var AuditCategorySchema = z85.enum([
|
|
|
40336
40547
|
"governance"
|
|
40337
40548
|
// Authority-tier transitions, ratification (Epic D, #3842)
|
|
40338
40549
|
]);
|
|
40339
|
-
var TierTransitionKindSchema =
|
|
40340
|
-
var TierTransitionTierSchema =
|
|
40341
|
-
var TierTransitionPayloadSchema =
|
|
40550
|
+
var TierTransitionKindSchema = z86.enum(["promotion", "demotion"]);
|
|
40551
|
+
var TierTransitionTierSchema = z86.enum(["observe", "suggest", "advisory", "enforce"]);
|
|
40552
|
+
var TierTransitionPayloadSchema = z86.object({
|
|
40342
40553
|
/** Whether the loop moved up (`promotion`) or down (`demotion`) the ladder. */
|
|
40343
40554
|
kind: TierTransitionKindSchema,
|
|
40344
40555
|
/** The loop/strategy whose tier changed (manifest `id` or loop identifier). */
|
|
40345
|
-
subject:
|
|
40556
|
+
subject: z86.string().min(1),
|
|
40346
40557
|
/** Tier before the transition. */
|
|
40347
40558
|
fromTier: TierTransitionTierSchema,
|
|
40348
40559
|
/** Tier after the transition. */
|
|
40349
40560
|
toTier: TierTransitionTierSchema,
|
|
40350
40561
|
/** Ref to the promotion-evidence record this transition was earned against. */
|
|
40351
|
-
evidenceRef:
|
|
40562
|
+
evidenceRef: z86.string().min(1),
|
|
40352
40563
|
/**
|
|
40353
40564
|
* Ref to the recorded `consensus_vote` that ratified a PROMOTION. Required
|
|
40354
40565
|
* by the ratification gate for `kind: 'promotion'`; legitimately absent for
|
|
40355
40566
|
* `kind: 'demotion'` (automatic, ADR-0017 §"Demotion is automatic").
|
|
40356
40567
|
*/
|
|
40357
|
-
ratificationVoteRef:
|
|
40568
|
+
ratificationVoteRef: z86.string().min(1).optional()
|
|
40358
40569
|
}).strict();
|
|
40359
40570
|
var TIER_TRANSITION_METADATA_KEY = "tierTransition";
|
|
40360
|
-
var AuditSeveritySchema =
|
|
40571
|
+
var AuditSeveritySchema = z86.enum([
|
|
40361
40572
|
"info",
|
|
40362
40573
|
// Normal operations
|
|
40363
40574
|
"warning",
|
|
@@ -40365,7 +40576,7 @@ var AuditSeveritySchema = z85.enum([
|
|
|
40365
40576
|
"critical"
|
|
40366
40577
|
// Security violations, failures
|
|
40367
40578
|
]);
|
|
40368
|
-
var AuditOutcomeSchema =
|
|
40579
|
+
var AuditOutcomeSchema = z86.enum([
|
|
40369
40580
|
"success",
|
|
40370
40581
|
// Operation completed successfully
|
|
40371
40582
|
"failure",
|
|
@@ -40375,61 +40586,61 @@ var AuditOutcomeSchema = z85.enum([
|
|
|
40375
40586
|
"error"
|
|
40376
40587
|
// Unexpected error occurred
|
|
40377
40588
|
]);
|
|
40378
|
-
var AuditActorSchema =
|
|
40379
|
-
type:
|
|
40380
|
-
id:
|
|
40381
|
-
name:
|
|
40382
|
-
ip:
|
|
40383
|
-
userAgent:
|
|
40589
|
+
var AuditActorSchema = z86.object({
|
|
40590
|
+
type: z86.enum(["user", "agent", "system", "external"]),
|
|
40591
|
+
id: z86.string().min(1),
|
|
40592
|
+
name: z86.string().optional(),
|
|
40593
|
+
ip: z86.string().optional(),
|
|
40594
|
+
userAgent: z86.string().optional()
|
|
40384
40595
|
});
|
|
40385
|
-
var AuditResourceSchema =
|
|
40386
|
-
type:
|
|
40596
|
+
var AuditResourceSchema = z86.object({
|
|
40597
|
+
type: z86.string().min(1),
|
|
40387
40598
|
// e.g., 'file', 'tool', 'config', 'agent'
|
|
40388
|
-
id:
|
|
40389
|
-
name:
|
|
40390
|
-
path:
|
|
40599
|
+
id: z86.string().min(1),
|
|
40600
|
+
name: z86.string().optional(),
|
|
40601
|
+
path: z86.string().optional()
|
|
40391
40602
|
});
|
|
40392
|
-
var AuditEventSchema =
|
|
40603
|
+
var AuditEventSchema = z86.object({
|
|
40393
40604
|
// Identity
|
|
40394
|
-
id:
|
|
40605
|
+
id: z86.string().min(1),
|
|
40395
40606
|
// Unique event ID
|
|
40396
|
-
version:
|
|
40607
|
+
version: z86.literal("1.0"),
|
|
40397
40608
|
// Schema version for migrations
|
|
40398
40609
|
// Timing
|
|
40399
|
-
timestamp:
|
|
40610
|
+
timestamp: z86.string(),
|
|
40400
40611
|
// ISO 8601 format
|
|
40401
|
-
timestampMs:
|
|
40612
|
+
timestampMs: z86.number(),
|
|
40402
40613
|
// Unix epoch milliseconds
|
|
40403
40614
|
// Classification
|
|
40404
40615
|
category: AuditCategorySchema,
|
|
40405
40616
|
severity: AuditSeveritySchema,
|
|
40406
40617
|
outcome: AuditOutcomeSchema,
|
|
40407
40618
|
// Event details
|
|
40408
|
-
action:
|
|
40619
|
+
action: z86.string().min(1),
|
|
40409
40620
|
// e.g., 'tool.invoke', 'policy.evaluate'
|
|
40410
|
-
description:
|
|
40621
|
+
description: z86.string().optional(),
|
|
40411
40622
|
// Actors and resources
|
|
40412
40623
|
actor: AuditActorSchema,
|
|
40413
40624
|
resource: AuditResourceSchema.optional(),
|
|
40414
40625
|
// Correlation
|
|
40415
|
-
requestId:
|
|
40626
|
+
requestId: z86.string().optional(),
|
|
40416
40627
|
// Request correlation ID
|
|
40417
|
-
traceId:
|
|
40628
|
+
traceId: z86.string().optional(),
|
|
40418
40629
|
// Distributed trace ID
|
|
40419
|
-
sessionId:
|
|
40630
|
+
sessionId: z86.string().optional(),
|
|
40420
40631
|
// Session correlation ID
|
|
40421
40632
|
// Context
|
|
40422
|
-
toolName:
|
|
40423
|
-
durationMs:
|
|
40424
|
-
metadata:
|
|
40633
|
+
toolName: z86.string().optional(),
|
|
40634
|
+
durationMs: z86.number().optional(),
|
|
40635
|
+
metadata: z86.record(z86.string(), z86.unknown()).optional(),
|
|
40425
40636
|
// Policy and security
|
|
40426
|
-
policyName:
|
|
40427
|
-
policyDecision:
|
|
40428
|
-
violationType:
|
|
40637
|
+
policyName: z86.string().optional(),
|
|
40638
|
+
policyDecision: z86.string().optional(),
|
|
40639
|
+
violationType: z86.string().optional(),
|
|
40429
40640
|
// Integrity (for tamper-evidence)
|
|
40430
|
-
previousHash:
|
|
40641
|
+
previousHash: z86.string().optional(),
|
|
40431
40642
|
// Hash of previous event (chain)
|
|
40432
|
-
hash:
|
|
40643
|
+
hash: z86.string().optional(),
|
|
40433
40644
|
// Hash of this event
|
|
40434
40645
|
/**
|
|
40435
40646
|
* Hash-projection version (#3921). ABSENT/`1` = the legacy projection
|
|
@@ -40439,60 +40650,60 @@ var AuditEventSchema = z85.object({
|
|
|
40439
40650
|
* Versioned so pre-existing v1 chains keep verifying under their own
|
|
40440
40651
|
* projection (see {@link AUDIT_HASH_VERSION_TIER_TRANSITION}).
|
|
40441
40652
|
*/
|
|
40442
|
-
hashVersion:
|
|
40653
|
+
hashVersion: z86.number().int().positive().optional()
|
|
40443
40654
|
});
|
|
40444
40655
|
var AUDIT_HASH_VERSION_TIER_TRANSITION = 2;
|
|
40445
|
-
var AuditEventInputSchema =
|
|
40656
|
+
var AuditEventInputSchema = z86.object({
|
|
40446
40657
|
category: AuditCategorySchema,
|
|
40447
40658
|
severity: AuditSeveritySchema.optional().default("info"),
|
|
40448
40659
|
outcome: AuditOutcomeSchema,
|
|
40449
|
-
action:
|
|
40450
|
-
description:
|
|
40660
|
+
action: z86.string().min(1),
|
|
40661
|
+
description: z86.string().optional(),
|
|
40451
40662
|
actor: AuditActorSchema,
|
|
40452
40663
|
resource: AuditResourceSchema.optional(),
|
|
40453
|
-
requestId:
|
|
40454
|
-
traceId:
|
|
40455
|
-
sessionId:
|
|
40456
|
-
toolName:
|
|
40457
|
-
durationMs:
|
|
40458
|
-
metadata:
|
|
40459
|
-
policyName:
|
|
40460
|
-
policyDecision:
|
|
40461
|
-
violationType:
|
|
40664
|
+
requestId: z86.string().optional(),
|
|
40665
|
+
traceId: z86.string().optional(),
|
|
40666
|
+
sessionId: z86.string().optional(),
|
|
40667
|
+
toolName: z86.string().optional(),
|
|
40668
|
+
durationMs: z86.number().optional(),
|
|
40669
|
+
metadata: z86.record(z86.string(), z86.unknown()).optional(),
|
|
40670
|
+
policyName: z86.string().optional(),
|
|
40671
|
+
policyDecision: z86.string().optional(),
|
|
40672
|
+
violationType: z86.string().optional()
|
|
40462
40673
|
});
|
|
40463
|
-
var AuditLogConfigSchema =
|
|
40674
|
+
var AuditLogConfigSchema = z86.object({
|
|
40464
40675
|
// Storage
|
|
40465
|
-
logDir:
|
|
40466
|
-
filePrefix:
|
|
40467
|
-
maxFileSizeBytes:
|
|
40676
|
+
logDir: z86.string().min(1),
|
|
40677
|
+
filePrefix: z86.string().optional().default("audit"),
|
|
40678
|
+
maxFileSizeBytes: z86.number().positive().optional().default(10 * 1024 * 1024),
|
|
40468
40679
|
// 10MB
|
|
40469
|
-
maxFiles:
|
|
40680
|
+
maxFiles: z86.number().positive().optional().default(10),
|
|
40470
40681
|
// Features
|
|
40471
|
-
enableHashChain:
|
|
40472
|
-
enableCompression:
|
|
40473
|
-
flushIntervalMs:
|
|
40682
|
+
enableHashChain: z86.boolean().optional().default(true),
|
|
40683
|
+
enableCompression: z86.boolean().optional().default(false),
|
|
40684
|
+
flushIntervalMs: z86.number().positive().optional().default(1e3),
|
|
40474
40685
|
/**
|
|
40475
40686
|
* Maximum in-memory event queue depth before drop-oldest backpressure
|
|
40476
40687
|
* engages. Bounds memory under load when storage.write is slow or the flush
|
|
40477
40688
|
* timer is overlapping; see #2979.
|
|
40478
40689
|
*/
|
|
40479
|
-
maxQueueDepth:
|
|
40690
|
+
maxQueueDepth: z86.number().positive().optional().default(1e4),
|
|
40480
40691
|
// Filtering
|
|
40481
40692
|
minSeverity: AuditSeveritySchema.optional().default("info"),
|
|
40482
|
-
categories:
|
|
40693
|
+
categories: z86.array(AuditCategorySchema).optional()
|
|
40483
40694
|
});
|
|
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:
|
|
40695
|
+
var AuditQueryCriteriaSchema = z86.object({
|
|
40696
|
+
startTime: z86.date().optional(),
|
|
40697
|
+
endTime: z86.date().optional(),
|
|
40698
|
+
categories: z86.array(AuditCategorySchema).optional(),
|
|
40699
|
+
severities: z86.array(AuditSeveritySchema).optional(),
|
|
40700
|
+
outcomes: z86.array(AuditOutcomeSchema).optional(),
|
|
40701
|
+
actorId: z86.string().optional(),
|
|
40702
|
+
resourceId: z86.string().optional(),
|
|
40703
|
+
requestId: z86.string().optional(),
|
|
40704
|
+
traceId: z86.string().optional(),
|
|
40705
|
+
limit: z86.number().positive().optional().default(100),
|
|
40706
|
+
offset: z86.number().nonnegative().optional().default(0)
|
|
40496
40707
|
});
|
|
40497
40708
|
|
|
40498
40709
|
// src/audit/audit-storage-queries.ts
|
|
@@ -40753,27 +40964,27 @@ var FileAuditStorage = class _FileAuditStorage {
|
|
|
40753
40964
|
const data = this.writeBuffer.join("");
|
|
40754
40965
|
this.writeBuffer = [];
|
|
40755
40966
|
const stream = this.writeStream;
|
|
40756
|
-
return new Promise((
|
|
40967
|
+
return new Promise((resolve20, reject) => {
|
|
40757
40968
|
stream.write(data, (err2) => {
|
|
40758
40969
|
if (err2 !== void 0 && err2 !== null) {
|
|
40759
40970
|
reject(new AuditError("Failed to flush audit log", { cause: err2 }));
|
|
40760
40971
|
} else {
|
|
40761
|
-
|
|
40972
|
+
resolve20();
|
|
40762
40973
|
}
|
|
40763
40974
|
});
|
|
40764
40975
|
});
|
|
40765
40976
|
}
|
|
40766
40977
|
async close() {
|
|
40767
40978
|
await this.flush();
|
|
40768
|
-
return new Promise((
|
|
40979
|
+
return new Promise((resolve20) => {
|
|
40769
40980
|
if (this.writeStream === null) {
|
|
40770
|
-
|
|
40981
|
+
resolve20();
|
|
40771
40982
|
return;
|
|
40772
40983
|
}
|
|
40773
40984
|
this.writeStream.end(() => {
|
|
40774
40985
|
this.writeStream = null;
|
|
40775
40986
|
this.logger.info("Audit storage closed");
|
|
40776
|
-
|
|
40987
|
+
resolve20();
|
|
40777
40988
|
});
|
|
40778
40989
|
});
|
|
40779
40990
|
}
|
|
@@ -41674,7 +41885,7 @@ async function tryIssueTriage(task) {
|
|
|
41674
41885
|
try {
|
|
41675
41886
|
const issueMatch = task.match(/github\.com\/([^/]+\/[^/]+)\/issues\/(\d+)/);
|
|
41676
41887
|
if (issueMatch === null) return null;
|
|
41677
|
-
const { createIssueTriage } = await import("./issue-triage-
|
|
41888
|
+
const { createIssueTriage } = await import("./issue-triage-RVDZEM53.js");
|
|
41678
41889
|
const triage = createIssueTriage();
|
|
41679
41890
|
const owner = issueMatch[1] ?? "";
|
|
41680
41891
|
const num = issueMatch[2] ?? "";
|
|
@@ -41702,7 +41913,7 @@ var VALID_TEMPLATES = /* @__PURE__ */ new Set([
|
|
|
41702
41913
|
]);
|
|
41703
41914
|
async function classifyWithLLM(task) {
|
|
41704
41915
|
try {
|
|
41705
|
-
const { executeExpert: executeExpert2 } = await import("./expert-bridge-
|
|
41916
|
+
const { executeExpert: executeExpert2 } = await import("./expert-bridge-7HQ54XYU.js");
|
|
41706
41917
|
const prompt = [
|
|
41707
41918
|
"Classify this task into exactly one pipeline template.",
|
|
41708
41919
|
"Templates: dev (implementation/bug fix/refactor), research (investigate/evaluate/compare),",
|
|
@@ -41810,7 +42021,7 @@ function ensureRunnableTemplate(template, stages) {
|
|
|
41810
42021
|
// src/pipeline/pipeline-checkpoint.ts
|
|
41811
42022
|
import * as fs7 from "fs";
|
|
41812
42023
|
import * as path5 from "path";
|
|
41813
|
-
import { z as
|
|
42024
|
+
import { z as z87 } from "zod";
|
|
41814
42025
|
var logger38 = createLogger({ component: "pipeline-checkpoint" });
|
|
41815
42026
|
var SESSION_ID_REGEX = /^[a-zA-Z0-9_-]{1,128}$/;
|
|
41816
42027
|
function validateSessionId(sessionId) {
|
|
@@ -41858,7 +42069,7 @@ function loadCheckpointState(sessionId, customDir) {
|
|
|
41858
42069
|
return null;
|
|
41859
42070
|
}
|
|
41860
42071
|
}
|
|
41861
|
-
var PipelineStageSchema =
|
|
42072
|
+
var PipelineStageSchema = z87.enum([
|
|
41862
42073
|
"research",
|
|
41863
42074
|
"plan",
|
|
41864
42075
|
"vote",
|
|
@@ -41866,27 +42077,27 @@ var PipelineStageSchema = z86.enum([
|
|
|
41866
42077
|
"implement",
|
|
41867
42078
|
"security"
|
|
41868
42079
|
]);
|
|
41869
|
-
var PipelineStageDataSchema =
|
|
41870
|
-
|
|
41871
|
-
|
|
41872
|
-
|
|
41873
|
-
type:
|
|
41874
|
-
approved:
|
|
41875
|
-
conditional:
|
|
41876
|
-
conditions:
|
|
41877
|
-
caveats:
|
|
41878
|
-
iterations:
|
|
42080
|
+
var PipelineStageDataSchema = z87.discriminatedUnion("type", [
|
|
42081
|
+
z87.object({ type: z87.literal("research"), text: z87.string() }),
|
|
42082
|
+
z87.object({ type: z87.literal("plan"), text: z87.string(), iterations: z87.number() }),
|
|
42083
|
+
z87.object({
|
|
42084
|
+
type: z87.literal("vote"),
|
|
42085
|
+
approved: z87.boolean(),
|
|
42086
|
+
conditional: z87.boolean(),
|
|
42087
|
+
conditions: z87.array(z87.string()).optional(),
|
|
42088
|
+
caveats: z87.array(z87.string()).optional(),
|
|
42089
|
+
iterations: z87.number()
|
|
41879
42090
|
}),
|
|
41880
42091
|
// PipelineTask shape is loose at the persistence layer — capture as
|
|
41881
42092
|
// `z.unknown()` and trust the downstream consumer's narrower validation.
|
|
41882
|
-
|
|
41883
|
-
|
|
41884
|
-
|
|
42093
|
+
z87.object({ type: z87.literal("decompose"), tasks: z87.array(z87.unknown()) }),
|
|
42094
|
+
z87.object({ type: z87.literal("implement"), tasks: z87.array(z87.unknown()) }),
|
|
42095
|
+
z87.object({ type: z87.literal("security"), passed: z87.boolean() })
|
|
41885
42096
|
]);
|
|
41886
|
-
var PipelineCheckpointEntrySchema =
|
|
41887
|
-
sessionId:
|
|
42097
|
+
var PipelineCheckpointEntrySchema = z87.object({
|
|
42098
|
+
sessionId: z87.string(),
|
|
41888
42099
|
stage: PipelineStageSchema,
|
|
41889
|
-
timestamp:
|
|
42100
|
+
timestamp: z87.string(),
|
|
41890
42101
|
data: PipelineStageDataSchema
|
|
41891
42102
|
});
|
|
41892
42103
|
function rebuildState(lines) {
|
|
@@ -42706,8 +42917,8 @@ async function executeSecurityScan(input) {
|
|
|
42706
42917
|
}
|
|
42707
42918
|
|
|
42708
42919
|
// src/security/finding-lifecycle.ts
|
|
42709
|
-
import { z as
|
|
42710
|
-
var FindingLifecycleStageSchema =
|
|
42920
|
+
import { z as z88 } from "zod";
|
|
42921
|
+
var FindingLifecycleStageSchema = z88.enum([
|
|
42711
42922
|
"detected",
|
|
42712
42923
|
"triaged",
|
|
42713
42924
|
"fix_generated",
|
|
@@ -42793,14 +43004,14 @@ function summarizeLifecycle(entries) {
|
|
|
42793
43004
|
}
|
|
42794
43005
|
|
|
42795
43006
|
// src/security/finding-triage.ts
|
|
42796
|
-
import { z as
|
|
43007
|
+
import { z as z89 } from "zod";
|
|
42797
43008
|
import { readFileSync as readFileSync6 } from "fs";
|
|
42798
43009
|
var logger42 = createLogger({ component: "security-finding-triage" });
|
|
42799
|
-
var TriageVerdictSchema =
|
|
42800
|
-
confirmed:
|
|
42801
|
-
confidence:
|
|
42802
|
-
reasoning:
|
|
42803
|
-
suggestedSeverity:
|
|
43010
|
+
var TriageVerdictSchema = z89.object({
|
|
43011
|
+
confirmed: z89.boolean(),
|
|
43012
|
+
confidence: z89.number().min(0).max(1),
|
|
43013
|
+
reasoning: z89.string().max(1e3),
|
|
43014
|
+
suggestedSeverity: z89.enum(FINDING_SEVERITY_LEVELS)
|
|
42804
43015
|
});
|
|
42805
43016
|
var DEFAULT_CONFIG3 = {
|
|
42806
43017
|
maxFindings: 10,
|
|
@@ -42910,18 +43121,18 @@ async function triageFindings(findings, delegateFn, config = DEFAULT_CONFIG3) {
|
|
|
42910
43121
|
}
|
|
42911
43122
|
|
|
42912
43123
|
// src/security/osv-lookup.ts
|
|
42913
|
-
import { z as
|
|
43124
|
+
import { z as z90 } from "zod";
|
|
42914
43125
|
var logger43 = createLogger({ component: "osv-lookup" });
|
|
42915
43126
|
var OSV_API_URL = "https://api.osv.dev/v1/query";
|
|
42916
43127
|
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:
|
|
43128
|
+
var OsvVulnerabilitySchema = z90.object({
|
|
43129
|
+
id: z90.string(),
|
|
43130
|
+
summary: z90.string().optional(),
|
|
43131
|
+
severity: z90.enum(["CRITICAL", "HIGH", "MODERATE", "LOW", "UNKNOWN"]).optional(),
|
|
43132
|
+
aliases: z90.array(z90.string()).default([]),
|
|
43133
|
+
affectedVersions: z90.string().optional(),
|
|
43134
|
+
fixedVersion: z90.string().optional(),
|
|
43135
|
+
url: z90.string().optional()
|
|
42925
43136
|
});
|
|
42926
43137
|
var DEFAULT_OSV_CONFIG = {
|
|
42927
43138
|
timeoutMs: DEFAULT_TIMEOUT_MS4
|
|
@@ -43343,7 +43554,7 @@ var memoryInitPromise = null;
|
|
|
43343
43554
|
async function initPipelineMemory() {
|
|
43344
43555
|
if (cachedMemory !== null) return cachedMemory;
|
|
43345
43556
|
try {
|
|
43346
|
-
const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-
|
|
43557
|
+
const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-TQMLN67N.js");
|
|
43347
43558
|
const { getLearningDir } = await import("./learning-persistence-6D5GGT7D.js");
|
|
43348
43559
|
const mem = createSessionMemory2(getLearningDir());
|
|
43349
43560
|
mem.startSession(`pipeline-${String(getTimeProvider().now())}`);
|
|
@@ -43405,7 +43616,7 @@ function recordRoutingExperience(category, success, durationMs, tokensUsed = 0,
|
|
|
43405
43616
|
callRecord(routingMemoryCache);
|
|
43406
43617
|
return;
|
|
43407
43618
|
}
|
|
43408
|
-
routingMemoryInitPromise ??= import("./routing-memory-
|
|
43619
|
+
routingMemoryInitPromise ??= import("./routing-memory-INY5DC2P.js").then(({ createRoutingMemory }) => {
|
|
43409
43620
|
routingMemoryCache ??= createRoutingMemory();
|
|
43410
43621
|
return routingMemoryCache;
|
|
43411
43622
|
}).catch((error) => {
|
|
@@ -43439,7 +43650,7 @@ ${text}` : "";
|
|
|
43439
43650
|
}
|
|
43440
43651
|
async function getWeatherContext() {
|
|
43441
43652
|
try {
|
|
43442
|
-
const { generateWeatherReport: generateWeatherReport2 } = await import("./weather-report-
|
|
43653
|
+
const { generateWeatherReport: generateWeatherReport2 } = await import("./weather-report-7NZ6D4C7.js");
|
|
43443
43654
|
const report = generateWeatherReport2({ includeAdaptive: true });
|
|
43444
43655
|
const mappings = "recommendedMappings" in report ? report.recommendedMappings : [];
|
|
43445
43656
|
if (!Array.isArray(mappings) || mappings.length === 0) return "";
|
|
@@ -43457,7 +43668,7 @@ ${lines}
|
|
|
43457
43668
|
}
|
|
43458
43669
|
async function getMemoryContext(task) {
|
|
43459
43670
|
try {
|
|
43460
|
-
const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-
|
|
43671
|
+
const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-TQMLN67N.js");
|
|
43461
43672
|
const { getLearningDir } = await import("./learning-persistence-6D5GGT7D.js");
|
|
43462
43673
|
const memory = createSessionMemory2(getLearningDir(), { maxLearningsInContext: 10 });
|
|
43463
43674
|
const learnings = memory.searchLearnings(task.slice(0, 200));
|
|
@@ -43572,7 +43783,7 @@ ${contextBlock}`;
|
|
|
43572
43783
|
const strategy = config.votingStrategy ?? "higher_order";
|
|
43573
43784
|
await postProgress(config, "Vote", `Running consensus with ${strategy} strategy...`);
|
|
43574
43785
|
try {
|
|
43575
|
-
const { executeVoting } = await import("./consensus-vote-
|
|
43786
|
+
const { executeVoting } = await import("./consensus-vote-FEDF24T5.js");
|
|
43576
43787
|
const votingResult = await executeVoting(
|
|
43577
43788
|
{
|
|
43578
43789
|
proposal: buildVoteProposal(plan, research),
|
|
@@ -43998,7 +44209,7 @@ function createScaffoldStageWrapper() {
|
|
|
43998
44209
|
}
|
|
43999
44210
|
async function searchCodebaseForTask(task) {
|
|
44000
44211
|
try {
|
|
44001
|
-
const { CodebaseIndex: CodebaseIndex2 } = await import("./codebase-search-
|
|
44212
|
+
const { CodebaseIndex: CodebaseIndex2 } = await import("./codebase-search-LUF5YJLQ.js");
|
|
44002
44213
|
const index = new CodebaseIndex2(process.cwd());
|
|
44003
44214
|
const terms = task.toLowerCase().split(/\s+/).filter((w) => w.length > 4).slice(0, 3);
|
|
44004
44215
|
if (terms.length === 0) return null;
|
|
@@ -44013,7 +44224,7 @@ async function searchCodebaseForTask(task) {
|
|
|
44013
44224
|
}
|
|
44014
44225
|
async function queryResearchRegistry(task) {
|
|
44015
44226
|
try {
|
|
44016
|
-
const { synthesizeResearch: synthesizeResearch2 } = await import("./research-helpers-synthesize-
|
|
44227
|
+
const { synthesizeResearch: synthesizeResearch2 } = await import("./research-helpers-synthesize-4L6SXYQU.js");
|
|
44017
44228
|
const topic = task.split(/[.!?\n]/).filter((s) => s.trim().length > 10)[0]?.trim();
|
|
44018
44229
|
if (topic === void 0) return null;
|
|
44019
44230
|
const result = await synthesizeResearch2(topic.slice(0, 50));
|
|
@@ -44084,7 +44295,7 @@ function createScanStageWrapper() {
|
|
|
44084
44295
|
try {
|
|
44085
44296
|
const slug = ctx.task.match(/([a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+)/)?.[1];
|
|
44086
44297
|
if (slug !== void 0) {
|
|
44087
|
-
const { generateSecurityPlan: generateSecurityPlan2 } = await import("./repo-security-plan-
|
|
44298
|
+
const { generateSecurityPlan: generateSecurityPlan2 } = await import("./repo-security-plan-YCTKRAGA.js");
|
|
44088
44299
|
const plan = await generateSecurityPlan2({ repo: slug, maxScanners: 10 });
|
|
44089
44300
|
const recs = plan.recommendations.slice(0, 5).map((r) => `${r.priority}: ${r.displayName} (${r.category})`).join("; ");
|
|
44090
44301
|
return output(PIPELINE_STATE_KEYS.FINDINGS, recs, getTimeProvider().now() - start, true);
|
|
@@ -44124,7 +44335,7 @@ function createAuditStageRegistry() {
|
|
|
44124
44335
|
}
|
|
44125
44336
|
|
|
44126
44337
|
// src/mcp/tools/pr-review-tool.ts
|
|
44127
|
-
import { z as
|
|
44338
|
+
import { z as z92 } from "zod";
|
|
44128
44339
|
import { randomUUID as randomUUID13 } from "crypto";
|
|
44129
44340
|
|
|
44130
44341
|
// src/mcp/tools/pr-review-findings.ts
|
|
@@ -44236,20 +44447,20 @@ function reviewedDiffWasTruncated(diff) {
|
|
|
44236
44447
|
|
|
44237
44448
|
// src/audit/pr-review-record-store.ts
|
|
44238
44449
|
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
|
|
44450
|
+
import { dirname as dirname4, isAbsolute, join as join9, resolve as resolve13 } from "path";
|
|
44240
44451
|
|
|
44241
44452
|
// src/audit/pr-review-record.ts
|
|
44242
44453
|
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:
|
|
44454
|
+
import { z as z91 } from "zod";
|
|
44455
|
+
var PrReviewVerdictSchema = z91.enum(["approve", "request_changes", "abstain"]);
|
|
44456
|
+
var PrReviewVoteCountsSchema = z91.object({
|
|
44457
|
+
approve: z91.number().int().nonnegative(),
|
|
44458
|
+
request_changes: z91.number().int().nonnegative(),
|
|
44459
|
+
abstain: z91.number().int().nonnegative(),
|
|
44460
|
+
error: z91.number().int().nonnegative(),
|
|
44461
|
+
total: z91.number().int().nonnegative()
|
|
44251
44462
|
}).strict();
|
|
44252
|
-
var PrReviewRecordSchema =
|
|
44463
|
+
var PrReviewRecordSchema = z91.object({
|
|
44253
44464
|
/**
|
|
44254
44465
|
* Schema version. '1.1' is the Option-C binding (#3831): the record binds to
|
|
44255
44466
|
* `{prNumber, baseSha, reviewedDiffHash}` instead of the rejected `headSha`.
|
|
@@ -44257,22 +44468,22 @@ var PrReviewRecordSchema = z90.object({
|
|
|
44257
44468
|
* empty on every install (no producer ever wrote a '1.0' record), so there is
|
|
44258
44469
|
* no '1.0' data to migrate.
|
|
44259
44470
|
*/
|
|
44260
|
-
version:
|
|
44471
|
+
version: z91.literal("1.1"),
|
|
44261
44472
|
/**
|
|
44262
44473
|
* Monotonic sequence number (integer ≥ 0). Assigned as (max existing
|
|
44263
44474
|
* sequence)+1 at write time. Sorted, the set of sequences must cover
|
|
44264
44475
|
* 0..maxSeq with no gap (omission detection); DUPLICATE sequences are a
|
|
44265
44476
|
* benign concurrent-fork signal, not tampering.
|
|
44266
44477
|
*/
|
|
44267
|
-
sequence:
|
|
44478
|
+
sequence: z91.number().int().nonnegative(),
|
|
44268
44479
|
/** The PR number the review covers. */
|
|
44269
|
-
prNumber:
|
|
44480
|
+
prNumber: z91.number().int().positive(),
|
|
44270
44481
|
/**
|
|
44271
44482
|
* The 40-hex BASE commit SHA the reviewed diff was computed against (the
|
|
44272
44483
|
* `<base>..<head>` range base). Part of the Option-C binding so the gate knows
|
|
44273
44484
|
* which range to recompute {@link reviewedDiffHash} over.
|
|
44274
44485
|
*/
|
|
44275
|
-
baseSha:
|
|
44486
|
+
baseSha: z91.string().regex(/^[0-9a-f]{40}$/, "baseSha must be a 40-char lowercase hex commit sha"),
|
|
44276
44487
|
/**
|
|
44277
44488
|
* DIFF-BINDING (Option-C, #3831): sha256 of the canonical reviewed diff bytes
|
|
44278
44489
|
* (see `audit/reviewed-diff-hash.ts` — pinned `git diff` invocation + 50k
|
|
@@ -44281,9 +44492,9 @@ var PrReviewRecordSchema = z90.object({
|
|
|
44281
44492
|
* byte-identical to what the voters saw. Covered by the self-hash below, so it
|
|
44282
44493
|
* cannot be edited to claim a different reviewed diff.
|
|
44283
44494
|
*/
|
|
44284
|
-
reviewedDiffHash:
|
|
44495
|
+
reviewedDiffHash: z91.string().length(64),
|
|
44285
44496
|
/** ISO-8601 timestamp the review was recorded. */
|
|
44286
|
-
recordedAt:
|
|
44497
|
+
recordedAt: z91.string().min(1),
|
|
44287
44498
|
/** The resolved aggregate verdict. */
|
|
44288
44499
|
verdict: PrReviewVerdictSchema,
|
|
44289
44500
|
/**
|
|
@@ -44291,21 +44502,21 @@ var PrReviewRecordSchema = z90.object({
|
|
|
44291
44502
|
* `request_changes` with `verified: true` is a strict blocker; covered by the
|
|
44292
44503
|
* hash so it cannot be flipped without detection.
|
|
44293
44504
|
*/
|
|
44294
|
-
verified:
|
|
44505
|
+
verified: z91.boolean(),
|
|
44295
44506
|
/** Per-decision voter tally from the pr_review aggregate. */
|
|
44296
44507
|
voteCounts: PrReviewVoteCountsSchema,
|
|
44297
44508
|
/** Truncated human-readable review summary for the reviewer record. */
|
|
44298
|
-
summary:
|
|
44509
|
+
summary: z91.string(),
|
|
44299
44510
|
/** Optional correlation/decision id linking to the cost rollup / trace. */
|
|
44300
|
-
correlationId:
|
|
44511
|
+
correlationId: z91.string().min(1).optional(),
|
|
44301
44512
|
/**
|
|
44302
44513
|
* ADVISORY hash of the tip record at write time (absent for the first).
|
|
44303
44514
|
* Retained for audit texture but NOT covered by `hash` and NOT verified —
|
|
44304
44515
|
* the record-set model is position-independent (mirrors #3927).
|
|
44305
44516
|
*/
|
|
44306
|
-
previousHash:
|
|
44517
|
+
previousHash: z91.string().length(64).optional(),
|
|
44307
44518
|
/** SHA-256 over every field above EXCEPT `previousHash` (and except `hash`). */
|
|
44308
|
-
hash:
|
|
44519
|
+
hash: z91.string().length(64)
|
|
44309
44520
|
}).strict();
|
|
44310
44521
|
function computePrReviewRecordHash(payload) {
|
|
44311
44522
|
const canonical = JSON.stringify({
|
|
@@ -44363,7 +44574,7 @@ function buildPrReviewRecord(input) {
|
|
|
44363
44574
|
function resolvePrReviewRecordsPath() {
|
|
44364
44575
|
const envPath = process.env[PR_REVIEW_RECORDS_PATH_ENV];
|
|
44365
44576
|
if (envPath !== void 0 && envPath.trim() !== "") {
|
|
44366
|
-
return isAbsolute(envPath) ? envPath :
|
|
44577
|
+
return isAbsolute(envPath) ? envPath : resolve13(envPath);
|
|
44367
44578
|
}
|
|
44368
44579
|
const root = findRepoRoot(process.cwd());
|
|
44369
44580
|
if (root === null) return void 0;
|
|
@@ -44654,17 +44865,17 @@ var MAX_DIFF_INPUT_LENGTH = 2e6;
|
|
|
44654
44865
|
var MAX_REPO_CONTEXT_LENGTH = 2e3;
|
|
44655
44866
|
var MAX_DESCRIPTION_LENGTH = 1e4;
|
|
44656
44867
|
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:
|
|
44868
|
+
var PrReviewInputSchema = z92.object({
|
|
44869
|
+
prTitle: z92.string().min(1).max(500).describe("PR title"),
|
|
44870
|
+
prDescription: z92.string().max(MAX_DESCRIPTION_LENGTH).optional().describe("PR body / description"),
|
|
44871
|
+
prDiff: z92.string().min(1).max(MAX_DIFF_INPUT_LENGTH).describe(
|
|
44661
44872
|
`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
44873
|
),
|
|
44663
|
-
repoContext:
|
|
44874
|
+
repoContext: z92.string().max(MAX_REPO_CONTEXT_LENGTH).optional().describe(
|
|
44664
44875
|
`Optional one-paragraph repo context (architecture, conventions; max ${String(MAX_REPO_CONTEXT_LENGTH)} chars; trim before calling)`
|
|
44665
44876
|
),
|
|
44666
|
-
baseRef:
|
|
44667
|
-
headRef:
|
|
44877
|
+
baseRef: z92.string().max(200).optional().describe("Base branch ref (e.g. main)"),
|
|
44878
|
+
headRef: z92.string().max(200).optional().describe("Head branch ref"),
|
|
44668
44879
|
/**
|
|
44669
44880
|
* Option-C audit binding (#4031). When BOTH `prNumber` and `baseSha` are
|
|
44670
44881
|
* supplied AND the review is live (not simulated), pr_review persists an
|
|
@@ -44676,11 +44887,11 @@ var PrReviewInputSchema = z91.object({
|
|
|
44676
44887
|
* canonical `git diff <baseSha>..<headSha>` the gate recomputes (the hash
|
|
44677
44888
|
* truncates at that byte cap) — pass the canonical diff, not a reordered one.
|
|
44678
44889
|
*/
|
|
44679
|
-
prNumber:
|
|
44680
|
-
baseSha:
|
|
44890
|
+
prNumber: z92.number().int().positive().optional().describe("PR number \u2014 with baseSha, enables Option-C audit-record persistence (#4031)"),
|
|
44891
|
+
baseSha: z92.string().regex(/^[0-9a-f]{40}$/, "baseSha must be a 40-char lowercase hex commit sha").optional().describe(
|
|
44681
44892
|
"40-hex base commit sha the reviewed diff was computed from (Option-C binding, #4031)"
|
|
44682
44893
|
),
|
|
44683
|
-
simulate:
|
|
44894
|
+
simulate: z92.boolean().default(false).describe("Use simulated voters (testing only; never ship live with this true)"),
|
|
44684
44895
|
/**
|
|
44685
44896
|
* Error policy (#4132). `standard` (default) keeps the pre-#4132 aggregation:
|
|
44686
44897
|
* an errored voter is simply excluded from the panel. `absolute_quorum` gates
|
|
@@ -44692,7 +44903,7 @@ var PrReviewInputSchema = z91.object({
|
|
|
44692
44903
|
* verified approve. A genuine `request_changes` blocker still wins (Tiers 1-2
|
|
44693
44904
|
* run first).
|
|
44694
44905
|
*/
|
|
44695
|
-
errorPolicy:
|
|
44906
|
+
errorPolicy: z92.enum(["standard", "absolute_quorum"]).default("standard").describe(
|
|
44696
44907
|
"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
44908
|
),
|
|
44698
44909
|
/**
|
|
@@ -44702,7 +44913,7 @@ var PrReviewInputSchema = z91.object({
|
|
|
44702
44913
|
* runs the panel in the background; poll `get_job_result({ jobId })` for the
|
|
44703
44914
|
* result.
|
|
44704
44915
|
*/
|
|
44705
|
-
dispatch:
|
|
44916
|
+
dispatch: z92.enum(["sync", "async"]).default("sync").describe(
|
|
44706
44917
|
"Dispatch mode (#3731). 'sync' (default): run inline. 'async': return a jobId immediately + run the panel in background (poll get_job_result)."
|
|
44707
44918
|
)
|
|
44708
44919
|
});
|
|
@@ -44960,27 +45171,27 @@ function registerPrReviewTool(server, deps) {
|
|
|
44960
45171
|
}
|
|
44961
45172
|
|
|
44962
45173
|
// src/mcp/tools/survey-oss-landscape.ts
|
|
44963
|
-
import { z as
|
|
44964
|
-
var SurveyOssLandscapeInputSchema =
|
|
44965
|
-
query:
|
|
44966
|
-
maxResults:
|
|
44967
|
-
minStars:
|
|
44968
|
-
language:
|
|
45174
|
+
import { z as z93 } from "zod";
|
|
45175
|
+
var SurveyOssLandscapeInputSchema = z93.object({
|
|
45176
|
+
query: z93.string().min(1).max(200).describe('Free-text search query, e.g. "cargo nextest replacement" or "OSS SBOM tools"'),
|
|
45177
|
+
maxResults: z93.number().int().min(1).max(50).optional().default(10).describe("Maximum candidates to return (1-50; default 10)"),
|
|
45178
|
+
minStars: z93.number().int().min(0).optional().default(0).describe("Minimum star count to include (default 0; useful for filtering noise)"),
|
|
45179
|
+
language: z93.string().max(50).optional().describe('GitHub language filter, e.g. "rust" or "typescript"')
|
|
44969
45180
|
});
|
|
44970
|
-
var GitHubRepoSchema =
|
|
44971
|
-
full_name:
|
|
44972
|
-
html_url:
|
|
44973
|
-
description:
|
|
44974
|
-
stargazers_count:
|
|
44975
|
-
pushed_at:
|
|
44976
|
-
language:
|
|
44977
|
-
license:
|
|
44978
|
-
spdx_id:
|
|
45181
|
+
var GitHubRepoSchema = z93.object({
|
|
45182
|
+
full_name: z93.string().optional(),
|
|
45183
|
+
html_url: z93.string().optional(),
|
|
45184
|
+
description: z93.string().nullable().optional(),
|
|
45185
|
+
stargazers_count: z93.number().optional(),
|
|
45186
|
+
pushed_at: z93.string().nullable().optional(),
|
|
45187
|
+
language: z93.string().nullable().optional(),
|
|
45188
|
+
license: z93.object({
|
|
45189
|
+
spdx_id: z93.string().nullable().optional()
|
|
44979
45190
|
}).nullable().optional()
|
|
44980
45191
|
});
|
|
44981
|
-
var GitHubSearchResponseSchema =
|
|
44982
|
-
total_count:
|
|
44983
|
-
items:
|
|
45192
|
+
var GitHubSearchResponseSchema = z93.object({
|
|
45193
|
+
total_count: z93.number().optional(),
|
|
45194
|
+
items: z93.array(GitHubRepoSchema).optional()
|
|
44984
45195
|
});
|
|
44985
45196
|
var GITHUB_SEARCH_BASE = "https://api.github.com/search/repositories";
|
|
44986
45197
|
function buildGithubQuery(input) {
|
|
@@ -45107,11 +45318,11 @@ function createSurveyHandler(deps) {
|
|
|
45107
45318
|
};
|
|
45108
45319
|
}
|
|
45109
45320
|
var SURVEY_OUTPUT_SCHEMA = {
|
|
45110
|
-
query:
|
|
45111
|
-
totalFound:
|
|
45112
|
-
candidates:
|
|
45113
|
-
sourcesQueried:
|
|
45114
|
-
sourcesFailed:
|
|
45321
|
+
query: z93.string(),
|
|
45322
|
+
totalFound: z93.number(),
|
|
45323
|
+
candidates: z93.array(z93.unknown()),
|
|
45324
|
+
sourcesQueried: z93.array(z93.string()),
|
|
45325
|
+
sourcesFailed: z93.array(z93.string())
|
|
45115
45326
|
};
|
|
45116
45327
|
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
45328
|
function registerSurveyOssLandscapeTool(server, deps) {
|
|
@@ -45140,7 +45351,7 @@ function registerSurveyOssLandscapeTool(server, deps) {
|
|
|
45140
45351
|
}
|
|
45141
45352
|
|
|
45142
45353
|
// src/mcp/tools/vendor-publishing-audit.ts
|
|
45143
|
-
import { z as
|
|
45354
|
+
import { z as z94 } from "zod";
|
|
45144
45355
|
|
|
45145
45356
|
// src/mcp/tools/vendor-publishing-seed.ts
|
|
45146
45357
|
var VENDOR_PUBLISHING_SEED = {
|
|
@@ -45213,8 +45424,8 @@ function listKnownVendors() {
|
|
|
45213
45424
|
}
|
|
45214
45425
|
|
|
45215
45426
|
// src/mcp/tools/vendor-publishing-audit.ts
|
|
45216
|
-
var VendorPublishingAuditInputSchema =
|
|
45217
|
-
vendor:
|
|
45427
|
+
var VendorPublishingAuditInputSchema = z94.object({
|
|
45428
|
+
vendor: z94.string().min(1).max(50).toLowerCase().describe('Vendor identifier, lowercase. e.g. "ubuntu", "debian", "fedora"')
|
|
45218
45429
|
});
|
|
45219
45430
|
function lookupVendor(vendor) {
|
|
45220
45431
|
if (isKnownVendor(vendor)) {
|
|
@@ -45246,20 +45457,20 @@ function createVendorPublishingAuditHandler(deps) {
|
|
|
45246
45457
|
};
|
|
45247
45458
|
}
|
|
45248
45459
|
var VENDOR_PUBLISHING_OUTPUT_SCHEMA = {
|
|
45249
|
-
vendor:
|
|
45250
|
-
known:
|
|
45460
|
+
vendor: z94.string(),
|
|
45461
|
+
known: z94.boolean(),
|
|
45251
45462
|
// 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:
|
|
45463
|
+
sha256SumsUrlPattern: z94.string().optional(),
|
|
45464
|
+
sha256SumsSignatureUrlPattern: z94.string().optional(),
|
|
45465
|
+
signaturePattern: z94.string().optional(),
|
|
45466
|
+
gpgKeys: z94.array(z94.unknown()).optional(),
|
|
45467
|
+
releaseCadence: z94.string().optional(),
|
|
45468
|
+
keyRotationNotes: z94.string().optional(),
|
|
45469
|
+
vendorDocUrl: z94.string().optional(),
|
|
45470
|
+
citedAt: z94.string().optional(),
|
|
45260
45471
|
// Fields below populate when known=false.
|
|
45261
|
-
message:
|
|
45262
|
-
knownVendors:
|
|
45472
|
+
message: z94.string().optional(),
|
|
45473
|
+
knownVendors: z94.array(z94.string()).optional()
|
|
45263
45474
|
};
|
|
45264
45475
|
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
45476
|
function registerVendorPublishingAuditTool(server, deps) {
|
|
@@ -45288,17 +45499,17 @@ function registerVendorPublishingAuditTool(server, deps) {
|
|
|
45288
45499
|
}
|
|
45289
45500
|
|
|
45290
45501
|
// src/mcp/tools/compare-data-feeds.ts
|
|
45291
|
-
import { z as
|
|
45502
|
+
import { z as z95 } from "zod";
|
|
45292
45503
|
import * as path7 from "path";
|
|
45293
45504
|
import * as fs8 from "fs";
|
|
45294
45505
|
import * as yaml2 from "yaml";
|
|
45295
|
-
var CompareDataFeedsInputSchema =
|
|
45296
|
-
feedAPath:
|
|
45297
|
-
feedBPath:
|
|
45298
|
-
keyPath:
|
|
45506
|
+
var CompareDataFeedsInputSchema = z95.object({
|
|
45507
|
+
feedAPath: z95.string().min(1).max(1e3).describe("Filesystem path to feed A (YAML or JSON, auto-detected by extension)"),
|
|
45508
|
+
feedBPath: z95.string().min(1).max(1e3).describe("Filesystem path to feed B"),
|
|
45509
|
+
keyPath: z95.string().min(1).max(200).describe(
|
|
45299
45510
|
'Dotted path to the entry key, e.g. "id" or "name". Each entry must have this field.'
|
|
45300
45511
|
),
|
|
45301
|
-
compareFields:
|
|
45512
|
+
compareFields: z95.array(z95.string().min(1).max(200)).max(20).optional().describe(
|
|
45302
45513
|
'Optional dotted field paths to compare across matched entries (e.g. ["license", "sha256"])'
|
|
45303
45514
|
)
|
|
45304
45515
|
});
|
|
@@ -45482,24 +45693,24 @@ function createCompareDataFeedsHandler(deps) {
|
|
|
45482
45693
|
};
|
|
45483
45694
|
}
|
|
45484
45695
|
var COMPARE_OUTPUT_SCHEMA = {
|
|
45485
|
-
feedAPath:
|
|
45486
|
-
feedBPath:
|
|
45487
|
-
keyPath:
|
|
45488
|
-
counts:
|
|
45489
|
-
entriesInA:
|
|
45490
|
-
entriesInB:
|
|
45491
|
-
onlyInA:
|
|
45492
|
-
onlyInB:
|
|
45493
|
-
inBoth:
|
|
45494
|
-
fieldDifferences:
|
|
45696
|
+
feedAPath: z95.string(),
|
|
45697
|
+
feedBPath: z95.string(),
|
|
45698
|
+
keyPath: z95.string(),
|
|
45699
|
+
counts: z95.object({
|
|
45700
|
+
entriesInA: z95.number(),
|
|
45701
|
+
entriesInB: z95.number(),
|
|
45702
|
+
onlyInA: z95.number(),
|
|
45703
|
+
onlyInB: z95.number(),
|
|
45704
|
+
inBoth: z95.number(),
|
|
45705
|
+
fieldDifferences: z95.number()
|
|
45495
45706
|
}),
|
|
45496
|
-
coverage:
|
|
45497
|
-
onlyInA:
|
|
45498
|
-
onlyInB:
|
|
45499
|
-
inBoth:
|
|
45707
|
+
coverage: z95.object({
|
|
45708
|
+
onlyInA: z95.array(z95.string()),
|
|
45709
|
+
onlyInB: z95.array(z95.string()),
|
|
45710
|
+
inBoth: z95.array(z95.string())
|
|
45500
45711
|
}),
|
|
45501
|
-
fieldDifferences:
|
|
45502
|
-
summary:
|
|
45712
|
+
fieldDifferences: z95.array(z95.unknown()),
|
|
45713
|
+
summary: z95.string()
|
|
45503
45714
|
};
|
|
45504
45715
|
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
45716
|
function registerCompareDataFeedsTool(server, deps) {
|
|
@@ -45528,9 +45739,9 @@ function registerCompareDataFeedsTool(server, deps) {
|
|
|
45528
45739
|
}
|
|
45529
45740
|
|
|
45530
45741
|
// src/mcp/tools/query-task-state-tool.ts
|
|
45531
|
-
import { z as
|
|
45532
|
-
var QueryTaskStateInputSchema =
|
|
45533
|
-
taskId:
|
|
45742
|
+
import { z as z96 } from "zod";
|
|
45743
|
+
var QueryTaskStateInputSchema = z96.object({
|
|
45744
|
+
taskId: z96.string().min(1).max(128).describe("Task ID whose structured state log should be read")
|
|
45534
45745
|
});
|
|
45535
45746
|
function queryTaskStateHandler(args, ctx) {
|
|
45536
45747
|
const parsed = QueryTaskStateInputSchema.safeParse(args);
|
|
@@ -45565,7 +45776,7 @@ function queryTaskStateHandler(args, ctx) {
|
|
|
45565
45776
|
function registerQueryTaskStateTool(server, deps) {
|
|
45566
45777
|
const logger58 = deps.logger ?? createLogger({ tool: "query_task_state" });
|
|
45567
45778
|
const toolSchema = {
|
|
45568
|
-
taskId:
|
|
45779
|
+
taskId: z96.string().min(1).max(128).describe("Task ID whose structured state log should be read")
|
|
45569
45780
|
};
|
|
45570
45781
|
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
45782
|
const secureHandler = createSecureHandler(queryTaskStateHandler, {
|
|
@@ -45587,28 +45798,28 @@ function registerQueryTaskStateTool(server, deps) {
|
|
|
45587
45798
|
}
|
|
45588
45799
|
|
|
45589
45800
|
// src/mcp/tools/ci-health-check-tool.ts
|
|
45590
|
-
import { z as
|
|
45801
|
+
import { z as z99 } from "zod";
|
|
45591
45802
|
|
|
45592
45803
|
// src/mcp/tools/ci-health-log.ts
|
|
45593
45804
|
import { appendFileSync as appendFileSync5, existsSync as existsSync11, readFileSync as readFileSync9, statSync as statSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
45594
|
-
import { z as
|
|
45805
|
+
import { z as z98 } from "zod";
|
|
45595
45806
|
|
|
45596
45807
|
// src/mcp/tools/ci-health-types.ts
|
|
45597
|
-
import { z as
|
|
45598
|
-
var CiHealthStatusSchema =
|
|
45808
|
+
import { z as z97 } from "zod";
|
|
45809
|
+
var CiHealthStatusSchema = z97.enum(["healthy", "degraded", "outage", "unknown"]);
|
|
45599
45810
|
|
|
45600
45811
|
// src/mcp/tools/ci-health-log.ts
|
|
45601
45812
|
var logger46 = createLogger({ component: "ci-health-log" });
|
|
45602
|
-
var CiHealthEventSchema =
|
|
45603
|
-
v:
|
|
45604
|
-
ts:
|
|
45813
|
+
var CiHealthEventSchema = z98.object({
|
|
45814
|
+
v: z98.literal(1),
|
|
45815
|
+
ts: z98.iso.datetime(),
|
|
45605
45816
|
status: CiHealthStatusSchema,
|
|
45606
|
-
repo:
|
|
45607
|
-
signals:
|
|
45608
|
-
|
|
45609
|
-
source:
|
|
45817
|
+
repo: z98.string().optional(),
|
|
45818
|
+
signals: z98.array(
|
|
45819
|
+
z98.object({
|
|
45820
|
+
source: z98.enum(["github-status", "repo-activity-window"]),
|
|
45610
45821
|
status: CiHealthStatusSchema,
|
|
45611
|
-
evidence:
|
|
45822
|
+
evidence: z98.string()
|
|
45612
45823
|
})
|
|
45613
45824
|
)
|
|
45614
45825
|
});
|
|
@@ -45688,17 +45899,17 @@ function eventFromCheck(params) {
|
|
|
45688
45899
|
}
|
|
45689
45900
|
|
|
45690
45901
|
// src/mcp/tools/ci-health-check-tool.ts
|
|
45691
|
-
var CiHealthCheckInputSchema =
|
|
45902
|
+
var CiHealthCheckInputSchema = z99.object({
|
|
45692
45903
|
/**
|
|
45693
45904
|
* Repo to check for the recent-runs activity signal (in `owner/repo` form).
|
|
45694
45905
|
* Optional — when omitted, only the status-page signal is consulted.
|
|
45695
45906
|
*/
|
|
45696
|
-
repo:
|
|
45907
|
+
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
45908
|
/**
|
|
45698
45909
|
* How far back to look for recent-runs activity (minutes). Default 30 —
|
|
45699
45910
|
* matches the typical wedge-detection window from the #3070 / #3076 outages.
|
|
45700
45911
|
*/
|
|
45701
|
-
activityWindowMinutes:
|
|
45912
|
+
activityWindowMinutes: z99.number().int().min(5).max(180).default(30).describe("Recent-runs lookback window in minutes (5-180; default 30).")
|
|
45702
45913
|
});
|
|
45703
45914
|
var STATUS_PAGE_URL = "https://www.githubstatus.com/api/v2/components.json";
|
|
45704
45915
|
function mapStatusPageStatus(raw) {
|
|
@@ -45831,8 +46042,8 @@ var DESCRIPTION = "Check CI infrastructure health before triggering / polling ru
|
|
|
45831
46042
|
function registerCiHealthCheckTool(server, deps) {
|
|
45832
46043
|
const logger58 = deps.logger ?? createLogger({ tool: "ci_health_check" });
|
|
45833
46044
|
const toolSchema = {
|
|
45834
|
-
repo:
|
|
45835
|
-
activityWindowMinutes:
|
|
46045
|
+
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."),
|
|
46046
|
+
activityWindowMinutes: z99.number().int().min(5).max(180).optional().describe("Recent-runs lookback window in minutes (5-180; default 30).")
|
|
45836
46047
|
};
|
|
45837
46048
|
const secureHandler = createSecureHandler((args) => ciHealthCheckHandler(args, logger58), {
|
|
45838
46049
|
toolName: "ci_health_check",
|
|
@@ -45858,18 +46069,18 @@ function registerCiHealthCheckTool(server, deps) {
|
|
|
45858
46069
|
|
|
45859
46070
|
// src/mcp/tools/quality-gate-tool.ts
|
|
45860
46071
|
import { statSync as statSync3 } from "fs";
|
|
45861
|
-
import { z as
|
|
45862
|
-
var QualityCheckSchema =
|
|
46072
|
+
import { z as z100 } from "zod";
|
|
46073
|
+
var QualityCheckSchema = z100.enum(["typecheck", "lint", "tests", "build", "security"]);
|
|
45863
46074
|
var DEFAULT_CHECKS = ["typecheck", "lint", "tests"];
|
|
45864
|
-
var RunQualityGateInputSchema =
|
|
46075
|
+
var RunQualityGateInputSchema = z100.object({
|
|
45865
46076
|
/** Project directory to run checks against. Must resolve inside the repo/cwd root. */
|
|
45866
|
-
projectDir:
|
|
46077
|
+
projectDir: z100.string().optional().describe(
|
|
45867
46078
|
"Project directory to run checks against (default: cwd). Must stay inside the repo root."
|
|
45868
46079
|
),
|
|
45869
46080
|
/** Which allowlisted checks to run. */
|
|
45870
|
-
checks:
|
|
46081
|
+
checks: z100.array(QualityCheckSchema).nonempty().default([...DEFAULT_CHECKS]).describe("Allowlisted checks to run (default: ['typecheck','lint','tests'])."),
|
|
45871
46082
|
/** 1-based iteration counter, forwarded to the engine for feedback context. */
|
|
45872
|
-
iteration:
|
|
46083
|
+
iteration: z100.number().int().min(1).default(1).describe("1-based iteration number (default 1).")
|
|
45873
46084
|
});
|
|
45874
46085
|
function validateProjectDir(raw) {
|
|
45875
46086
|
const candidate = raw ?? process.cwd();
|
|
@@ -45944,11 +46155,11 @@ var DESCRIPTION2 = "Run the QA quality gate (#1684 engine) against a project dir
|
|
|
45944
46155
|
function registerRunQualityGateTool(server, deps) {
|
|
45945
46156
|
const logger58 = deps.logger ?? createLogger({ tool: "run_quality_gate" });
|
|
45946
46157
|
const toolSchema = {
|
|
45947
|
-
projectDir:
|
|
46158
|
+
projectDir: z100.string().optional().describe(
|
|
45948
46159
|
"Project directory to run checks against (default: cwd). Must stay inside the repo root."
|
|
45949
46160
|
),
|
|
45950
|
-
checks:
|
|
45951
|
-
iteration:
|
|
46161
|
+
checks: z100.array(QualityCheckSchema).nonempty().optional().describe("Allowlisted checks to run (default: ['typecheck','lint','tests'])."),
|
|
46162
|
+
iteration: z100.number().int().min(1).optional().describe("1-based iteration number (default 1).")
|
|
45952
46163
|
};
|
|
45953
46164
|
const secureHandler = createSecureHandler(
|
|
45954
46165
|
(args) => runQualityGateHandler(args, logger58),
|
|
@@ -45978,9 +46189,9 @@ function registerRunQualityGateTool(server, deps) {
|
|
|
45978
46189
|
// src/mcp/tools/verify-audit-chain-tool.ts
|
|
45979
46190
|
import * as fs9 from "fs/promises";
|
|
45980
46191
|
import * as path8 from "path";
|
|
45981
|
-
import { z as
|
|
45982
|
-
var VerifyAuditChainInputSchema =
|
|
45983
|
-
logDir:
|
|
46192
|
+
import { z as z101 } from "zod";
|
|
46193
|
+
var VerifyAuditChainInputSchema = z101.object({
|
|
46194
|
+
logDir: z101.string().min(1).max(512).describe(
|
|
45984
46195
|
"Filesystem path to the FileAuditStorage log directory. Tool reads all `audit-*.jsonl` files in lexicographic order and verifies the combined chain."
|
|
45985
46196
|
)
|
|
45986
46197
|
});
|
|
@@ -46057,7 +46268,7 @@ async function handler2(args, ctx) {
|
|
|
46057
46268
|
function registerVerifyAuditChainTool(server, deps) {
|
|
46058
46269
|
const logger58 = deps.logger ?? createLogger({ tool: "verify_audit_chain" });
|
|
46059
46270
|
const toolSchema = {
|
|
46060
|
-
logDir:
|
|
46271
|
+
logDir: z101.string().min(1).max(512).describe(
|
|
46061
46272
|
"Filesystem path to the FileAuditStorage log directory. Tool reads all `audit-*.jsonl` files and verifies the combined hash chain."
|
|
46062
46273
|
)
|
|
46063
46274
|
};
|
|
@@ -46081,15 +46292,15 @@ function registerVerifyAuditChainTool(server, deps) {
|
|
|
46081
46292
|
}
|
|
46082
46293
|
|
|
46083
46294
|
// src/mcp/tools/suggest-research-tasks-tool.ts
|
|
46084
|
-
import { z as
|
|
46295
|
+
import { z as z102 } from "zod";
|
|
46085
46296
|
var SUGGEST_RESEARCH_TASKS_NOTE = "Suggestions derived from external research (untrusted); review before acting \u2014 nothing was executed or filed.";
|
|
46086
46297
|
var RESEARCH_BUDGET_MS = 2e4;
|
|
46087
46298
|
var RESEARCH_TIMED_OUT = /* @__PURE__ */ Symbol("research-budget-exceeded");
|
|
46088
46299
|
async function withResearchBudget(p, ms) {
|
|
46089
46300
|
let timer;
|
|
46090
|
-
const budget = new Promise((
|
|
46301
|
+
const budget = new Promise((resolve20) => {
|
|
46091
46302
|
timer = setTimeout(() => {
|
|
46092
|
-
|
|
46303
|
+
resolve20(RESEARCH_TIMED_OUT);
|
|
46093
46304
|
}, ms);
|
|
46094
46305
|
});
|
|
46095
46306
|
try {
|
|
@@ -46098,11 +46309,11 @@ async function withResearchBudget(p, ms) {
|
|
|
46098
46309
|
if (timer !== void 0) clearTimeout(timer);
|
|
46099
46310
|
}
|
|
46100
46311
|
}
|
|
46101
|
-
var SuggestResearchTasksInputSchema =
|
|
46102
|
-
topic:
|
|
46103
|
-
qualityThreshold:
|
|
46104
|
-
maxTriggers:
|
|
46105
|
-
existingTaskIds:
|
|
46312
|
+
var SuggestResearchTasksInputSchema = z102.object({
|
|
46313
|
+
topic: z102.string().optional().describe("Topic filter passed to research_discover. Optional."),
|
|
46314
|
+
qualityThreshold: z102.number().min(0).max(10).optional().describe("Minimum quality score (0-10) a discovery must meet to be suggested. Optional."),
|
|
46315
|
+
maxTriggers: z102.number().int().min(1).optional().describe("Max number of candidate tasks to return (>=1). Optional."),
|
|
46316
|
+
existingTaskIds: z102.array(z102.string()).optional().describe("Known task IDs to skip (dedup). Optional.")
|
|
46106
46317
|
});
|
|
46107
46318
|
function toTriggerConfig(input) {
|
|
46108
46319
|
return {
|
|
@@ -46159,10 +46370,10 @@ var DESCRIPTION3 = "SUGGEST-ONLY: surface candidate pipeline tasks for human/orc
|
|
|
46159
46370
|
function registerSuggestResearchTasksTool(server, deps) {
|
|
46160
46371
|
const logger58 = deps.logger ?? createLogger({ tool: "suggest_research_tasks" });
|
|
46161
46372
|
const toolSchema = {
|
|
46162
|
-
topic:
|
|
46163
|
-
qualityThreshold:
|
|
46164
|
-
maxTriggers:
|
|
46165
|
-
existingTaskIds:
|
|
46373
|
+
topic: z102.string().optional().describe("Topic filter passed to research_discover. Optional."),
|
|
46374
|
+
qualityThreshold: z102.number().min(0).max(10).optional().describe("Minimum quality score (0-10) a discovery must meet to be suggested. Optional."),
|
|
46375
|
+
maxTriggers: z102.number().int().min(1).optional().describe("Max number of candidate tasks to return (>=1). Optional."),
|
|
46376
|
+
existingTaskIds: z102.array(z102.string()).optional().describe("Known task IDs to skip (dedup). Optional.")
|
|
46166
46377
|
};
|
|
46167
46378
|
const secureHandler = createSecureHandler(
|
|
46168
46379
|
(args) => suggestResearchTasksHandler(args, logger58),
|
|
@@ -46190,7 +46401,7 @@ function registerSuggestResearchTasksTool(server, deps) {
|
|
|
46190
46401
|
}
|
|
46191
46402
|
|
|
46192
46403
|
// src/mcp/tools/run-tool.ts
|
|
46193
|
-
import { z as
|
|
46404
|
+
import { z as z106 } from "zod";
|
|
46194
46405
|
import { randomUUID as randomUUID17 } from "crypto";
|
|
46195
46406
|
|
|
46196
46407
|
// src/orchestration/meta-orchestrator.ts
|
|
@@ -46436,7 +46647,7 @@ function createMetaOrchestrator(options) {
|
|
|
46436
46647
|
|
|
46437
46648
|
// src/orchestration/meta-shadow-selector.ts
|
|
46438
46649
|
import { appendFileSync as appendFileSync6, existsSync as existsSync12, readFileSync as readFileSync10 } from "fs";
|
|
46439
|
-
import { z as
|
|
46650
|
+
import { z as z103 } from "zod";
|
|
46440
46651
|
var SHADOW_STRATEGY_ARMS = [
|
|
46441
46652
|
"single-shot",
|
|
46442
46653
|
"dev-pipeline",
|
|
@@ -46517,19 +46728,19 @@ function createHydratableSelector() {
|
|
|
46517
46728
|
var META_OUTCOME_SCHEMA_VERSION = 1;
|
|
46518
46729
|
var HYDRATE_LOOKBACK_DAYS = 30;
|
|
46519
46730
|
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:
|
|
46731
|
+
var PersistedContextSchema = z103.object({
|
|
46732
|
+
taskComplexity: z103.number(),
|
|
46733
|
+
contextLengthNormalized: z103.number(),
|
|
46734
|
+
isCodeTask: z103.number(),
|
|
46735
|
+
isReasoningTask: z103.number(),
|
|
46736
|
+
budgetUtilization: z103.number(),
|
|
46737
|
+
timePressure: z103.number()
|
|
46527
46738
|
});
|
|
46528
|
-
var PersistedMetaOutcomeSchema =
|
|
46529
|
-
schema:
|
|
46530
|
-
timestamp:
|
|
46531
|
-
strategy:
|
|
46532
|
-
success:
|
|
46739
|
+
var PersistedMetaOutcomeSchema = z103.object({
|
|
46740
|
+
schema: z103.literal(META_OUTCOME_SCHEMA_VERSION),
|
|
46741
|
+
timestamp: z103.string(),
|
|
46742
|
+
strategy: z103.enum(SHADOW_STRATEGY_ARMS),
|
|
46743
|
+
success: z103.boolean(),
|
|
46533
46744
|
context: PersistedContextSchema
|
|
46534
46745
|
});
|
|
46535
46746
|
var persistLogger = createLogger({ component: "MetaShadowSelector" });
|
|
@@ -47020,7 +47231,7 @@ function createMetaDispatcher(options) {
|
|
|
47020
47231
|
}
|
|
47021
47232
|
|
|
47022
47233
|
// src/mcp/tools/dev-pipeline-tool.ts
|
|
47023
|
-
import { z as
|
|
47234
|
+
import { z as z104 } from "zod";
|
|
47024
47235
|
import * as fs11 from "fs";
|
|
47025
47236
|
import * as path10 from "path";
|
|
47026
47237
|
import { randomUUID as randomUUID15 } from "crypto";
|
|
@@ -47044,7 +47255,7 @@ var GitHubTaskTracker = class {
|
|
|
47044
47255
|
cachedProvider = null;
|
|
47045
47256
|
async getProvider() {
|
|
47046
47257
|
if (this.cachedProvider !== null) return this.cachedProvider;
|
|
47047
|
-
const { createScmProvider } = await import("./factory-
|
|
47258
|
+
const { createScmProvider } = await import("./factory-RW2ROEDS.js");
|
|
47048
47259
|
const result = await createScmProvider({ repo: this.config.repo ?? "" });
|
|
47049
47260
|
if (!result.ok) throw new Error(`SCM provider error: ${result.error.message}`);
|
|
47050
47261
|
this.cachedProvider = result.value;
|
|
@@ -47169,36 +47380,36 @@ function createTaskTracker(config) {
|
|
|
47169
47380
|
|
|
47170
47381
|
// src/mcp/tools/dev-pipeline-tool.ts
|
|
47171
47382
|
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 =
|
|
47383
|
+
var DevPipelineInputSchema = z104.object({
|
|
47173
47384
|
/** Direct task instructions. */
|
|
47174
|
-
task:
|
|
47385
|
+
task: z104.string().max(1e4).optional().describe("Direct task instructions (what to build)"),
|
|
47175
47386
|
/** Path to a plan file (.md, .yaml, .txt) to use as input. */
|
|
47176
|
-
planFile:
|
|
47387
|
+
planFile: z104.string().max(500).optional().describe("Path to a plan/spec file to use as input"),
|
|
47177
47388
|
/** Whether to run in dry-run mode (plan+vote only, no implementation). */
|
|
47178
|
-
dryRun:
|
|
47389
|
+
dryRun: z104.boolean().default(false).describe("If true, stop after plan+vote (no implementation)"),
|
|
47179
47390
|
/** Maximum vote iterations before proceeding (default: 3). */
|
|
47180
|
-
maxVoteIterations:
|
|
47391
|
+
maxVoteIterations: z104.number().int().min(1).max(5).default(3).describe("Max plan\u2192vote iterations"),
|
|
47181
47392
|
/** Maximum QA iterations per task (default: 3). */
|
|
47182
|
-
maxQaIterations:
|
|
47393
|
+
maxQaIterations: z104.number().int().min(1).max(5).default(3).describe("Max QA review iterations per task"),
|
|
47183
47394
|
/** Working directory for the pipeline (default: cwd). Used for security scan and context. */
|
|
47184
|
-
workingDir:
|
|
47395
|
+
workingDir: z104.string().max(500).optional().describe("Working directory (default: cwd)"),
|
|
47185
47396
|
/** GitHub issue number to track progress on. Updates posted as comments. */
|
|
47186
|
-
issueNumber:
|
|
47397
|
+
issueNumber: z104.number().int().positive().optional().describe("GitHub issue to post progress to"),
|
|
47187
47398
|
/** GitHub repo (owner/name) for issue tracking. */
|
|
47188
|
-
repo:
|
|
47399
|
+
repo: z104.string().max(200).optional().describe("GitHub repo for issue tracking (e.g., owner/repo)"),
|
|
47189
47400
|
/** Task tracking backend: github, gitlab, or json (default: json). */
|
|
47190
|
-
trackerBackend:
|
|
47401
|
+
trackerBackend: z104.enum(["github", "gitlab", "json"]).default("json").describe("Task tracking backend for issue creation"),
|
|
47191
47402
|
/** Labels to apply to created issues. */
|
|
47192
|
-
labels:
|
|
47403
|
+
labels: z104.array(z104.string()).optional().describe("Labels for created issues"),
|
|
47193
47404
|
/** Session ID for checkpoint/resume. Enables crash recovery. */
|
|
47194
|
-
sessionId:
|
|
47405
|
+
sessionId: z104.string().max(128).regex(/^[a-zA-Z0-9_-]+$/).optional().describe("Session ID for checkpoint/resume (crash recovery)"),
|
|
47195
47406
|
/**
|
|
47196
47407
|
* TESTS ONLY — when true, voters return random decisions. Must not be used as
|
|
47197
47408
|
* a fallback when adapters are unavailable; configure an adapter instead. (#2319)
|
|
47198
47409
|
*/
|
|
47199
|
-
simulateVotes:
|
|
47410
|
+
simulateVotes: z104.boolean().default(false).describe("TESTS ONLY \u2014 random output, must not be used for real decisions (#2319)"),
|
|
47200
47411
|
/** Voting strategy for consensus stages. */
|
|
47201
|
-
votingStrategy:
|
|
47412
|
+
votingStrategy: z104.enum([
|
|
47202
47413
|
"simple_majority",
|
|
47203
47414
|
"supermajority",
|
|
47204
47415
|
"unanimous",
|
|
@@ -47207,11 +47418,11 @@ var DevPipelineInputSchema = z103.object({
|
|
|
47207
47418
|
"opinion_wise"
|
|
47208
47419
|
]).optional().describe("Voting strategy for plan approval (default: higher_order)"),
|
|
47209
47420
|
/** Use 3 agents instead of 6 for faster voting. */
|
|
47210
|
-
quickMode:
|
|
47421
|
+
quickMode: z104.boolean().default(false).describe("Use 3 agents instead of 6 for faster consensus voting"),
|
|
47211
47422
|
/** Maximum execution time per stage in milliseconds (min 30s, max 600s). */
|
|
47212
|
-
timeoutMs:
|
|
47423
|
+
timeoutMs: z104.number().int().min(3e4).max(6e5).optional().describe("Max time per stage in ms (30000-600000). Default: varies by stage complexity"),
|
|
47213
47424
|
/** Pipeline execution mode. */
|
|
47214
|
-
mode:
|
|
47425
|
+
mode: z104.enum(["autonomous", "harness"]).default("autonomous").describe(
|
|
47215
47426
|
"'autonomous': full pipeline. 'harness': stops after decompose, returns tasks for caller to implement."
|
|
47216
47427
|
),
|
|
47217
47428
|
/**
|
|
@@ -47222,15 +47433,15 @@ var DevPipelineInputSchema = z103.object({
|
|
|
47222
47433
|
* `get_job_result({ jobId })` for the result. Ignored when `dryRun` is
|
|
47223
47434
|
* true (plan+vote completes fast, so dry runs always stay sync).
|
|
47224
47435
|
*/
|
|
47225
|
-
dispatch:
|
|
47436
|
+
dispatch: z104.enum(["sync", "async"]).default("sync").describe(
|
|
47226
47437
|
"Dispatch mode (#3726). 'sync' (default): run inline. 'async': return a jobId immediately + run in background (poll get_job_result). Ignored for dryRun."
|
|
47227
47438
|
),
|
|
47228
47439
|
/** Local pre-ship quality gate (typecheck/lint/tests) mode (#3356). */
|
|
47229
|
-
qualityGate:
|
|
47440
|
+
qualityGate: z104.enum(["off", "advisory", "blocking"]).default("off").describe(
|
|
47230
47441
|
"Pre-ship local quality gate. 'off' (default): skip. 'advisory': run + record feedback, never fail. 'blocking': a red gate fails the pipeline."
|
|
47231
47442
|
),
|
|
47232
47443
|
/** Opt-in per-run token budget — a safety cap for unattended runs (#3395). */
|
|
47233
|
-
maxBudgetTokens:
|
|
47444
|
+
maxBudgetTokens: z104.number().int().positive().optional().describe(
|
|
47234
47445
|
"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
47446
|
)
|
|
47236
47447
|
});
|
|
@@ -47401,20 +47612,20 @@ function registerDevPipelineTool(server, deps) {
|
|
|
47401
47612
|
}
|
|
47402
47613
|
|
|
47403
47614
|
// src/mcp/tools/pipeline-tool.ts
|
|
47404
|
-
import { z as
|
|
47615
|
+
import { z as z105 } from "zod";
|
|
47405
47616
|
import * as fs12 from "fs";
|
|
47406
47617
|
import * as path11 from "path";
|
|
47407
47618
|
import { randomUUID as randomUUID16 } from "crypto";
|
|
47408
47619
|
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 =
|
|
47620
|
+
var PipelineInputSchema = z105.object({
|
|
47410
47621
|
/** The task to execute. */
|
|
47411
|
-
task:
|
|
47622
|
+
task: z105.string().min(5).max(1e4).describe("Task description \u2014 pipeline template auto-selected based on content"),
|
|
47412
47623
|
/** Path to a spec file (.md, .yaml) to use as task input. */
|
|
47413
|
-
specFile:
|
|
47624
|
+
specFile: z105.string().max(500).optional().describe("Path to a spec file \u2014 content prepended to task for greenfield projects"),
|
|
47414
47625
|
/** Override template — see `listTemplateIds()` for the canonical list (#2728). Auto-detected if omitted. */
|
|
47415
|
-
template:
|
|
47626
|
+
template: z105.string().max(50).optional().describe(`Pipeline template override. Available: ${listTemplateIds().join(", ")}`),
|
|
47416
47627
|
/** Voting strategy for consensus stages. */
|
|
47417
|
-
votingStrategy:
|
|
47628
|
+
votingStrategy: z105.enum([
|
|
47418
47629
|
"simple_majority",
|
|
47419
47630
|
"supermajority",
|
|
47420
47631
|
"unanimous",
|
|
@@ -47425,11 +47636,11 @@ var PipelineInputSchema = z104.object({
|
|
|
47425
47636
|
"Voting strategy for plan approval. simple_majority (default), supermajority (67%), unanimous, higher_order (Bayesian), proof_of_learning, opinion_wise"
|
|
47426
47637
|
),
|
|
47427
47638
|
/** Use 3 agents instead of 6 for faster voting. */
|
|
47428
|
-
quickMode:
|
|
47639
|
+
quickMode: z105.boolean().default(false).describe("Use 3 agents instead of 6 for faster consensus voting"),
|
|
47429
47640
|
/** Maximum execution time per stage in milliseconds (min 30s, max 600s). */
|
|
47430
|
-
timeoutMs:
|
|
47641
|
+
timeoutMs: z105.number().int().min(3e4).max(6e5).optional().describe("Max time per stage in ms (30000-600000). Default: varies by stage complexity"),
|
|
47431
47642
|
/** Stop after planning/voting (no implementation). */
|
|
47432
|
-
dryRun:
|
|
47643
|
+
dryRun: z105.boolean().default(false).describe("Stop after vote stage (no implementation)"),
|
|
47433
47644
|
/**
|
|
47434
47645
|
* Dispatch mode (#3730). `sync` (default) runs the pipeline inline and
|
|
47435
47646
|
* returns the result — but a real multi-stage adaptive run can exceed the
|
|
@@ -47438,13 +47649,13 @@ var PipelineInputSchema = z104.object({
|
|
|
47438
47649
|
* `get_job_result({ jobId })` for the result. Ignored when `dryRun` is true
|
|
47439
47650
|
* (plan+vote completes fast, so dry runs always stay sync).
|
|
47440
47651
|
*/
|
|
47441
|
-
dispatch:
|
|
47652
|
+
dispatch: z105.enum(["sync", "async"]).default("sync").describe(
|
|
47442
47653
|
"Dispatch mode (#3730). 'sync' (default): run inline. 'async': return a jobId immediately + run in background (poll get_job_result). Ignored for dryRun."
|
|
47443
47654
|
),
|
|
47444
47655
|
/** TESTS ONLY — random output, must not be used for real decisions. (#2319) */
|
|
47445
|
-
simulateVotes:
|
|
47656
|
+
simulateVotes: z105.boolean().default(false).describe("TESTS ONLY \u2014 random output, must not be used for real decisions (#2319)")
|
|
47446
47657
|
});
|
|
47447
|
-
function
|
|
47658
|
+
function buildOutput3(result, simulated) {
|
|
47448
47659
|
return {
|
|
47449
47660
|
success: result.success,
|
|
47450
47661
|
templateId: result.templateId,
|
|
@@ -47529,7 +47740,7 @@ async function executePipelineBody(task, stages, templateId, dryRun, simulated)
|
|
|
47529
47740
|
templateId,
|
|
47530
47741
|
dryRun
|
|
47531
47742
|
});
|
|
47532
|
-
return toolSuccessStructured(
|
|
47743
|
+
return toolSuccessStructured(buildOutput3(result, simulated));
|
|
47533
47744
|
}
|
|
47534
47745
|
async function runPipelineHandler(args, logger58) {
|
|
47535
47746
|
const parsed = PipelineInputSchema.safeParse(args);
|
|
@@ -47594,9 +47805,9 @@ function registerPipelineTool(server, deps) {
|
|
|
47594
47805
|
}
|
|
47595
47806
|
|
|
47596
47807
|
// src/mcp/tools/run-tool.ts
|
|
47597
|
-
var RunInputSchema =
|
|
47598
|
-
goal:
|
|
47599
|
-
forceStrategy:
|
|
47808
|
+
var RunInputSchema = z106.object({
|
|
47809
|
+
goal: z106.string().min(1).describe("Natural-language goal. nexus-agents selects how to execute it."),
|
|
47810
|
+
forceStrategy: z106.enum([
|
|
47600
47811
|
"single-shot",
|
|
47601
47812
|
"dev-pipeline",
|
|
47602
47813
|
"pipeline",
|
|
@@ -47608,10 +47819,10 @@ var RunInputSchema = z105.object({
|
|
|
47608
47819
|
]).optional().describe(
|
|
47609
47820
|
"Power-user override: force a specific strategy instead of letting the router choose."
|
|
47610
47821
|
),
|
|
47611
|
-
requiresConsensus:
|
|
47612
|
-
dependencyStructure:
|
|
47613
|
-
isNovel:
|
|
47614
|
-
execute:
|
|
47822
|
+
requiresConsensus: z106.boolean().optional().describe("Hint: the task needs a multi-perspective consensus decision."),
|
|
47823
|
+
dependencyStructure: z106.enum(["linear", "dag", "independent", "unknown"]).optional().describe("Hint: the dependency structure of the work."),
|
|
47824
|
+
isNovel: z106.boolean().optional().describe("Hint: this kind of task has not been seen before."),
|
|
47825
|
+
execute: z106.boolean().optional().describe(
|
|
47615
47826
|
"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
47827
|
),
|
|
47617
47828
|
/**
|
|
@@ -47622,7 +47833,7 @@ var RunInputSchema = z105.object({
|
|
|
47622
47833
|
* envelope immediately and runs in the background; poll
|
|
47623
47834
|
* `get_job_result({ jobId })`. Ignored for read-only routing (execute:false).
|
|
47624
47835
|
*/
|
|
47625
|
-
dispatch:
|
|
47836
|
+
dispatch: z106.enum(["sync", "async"]).optional().describe(
|
|
47626
47837
|
"Dispatch mode (#3732). 'sync' (default): run inline. 'async' (only with execute:true): return a jobId immediately + run in background (poll get_job_result)."
|
|
47627
47838
|
)
|
|
47628
47839
|
});
|
|
@@ -47814,12 +48025,12 @@ function registerRunTool(server, deps) {
|
|
|
47814
48025
|
}
|
|
47815
48026
|
|
|
47816
48027
|
// src/mcp/tools/list-available-models-tool.ts
|
|
47817
|
-
import { z as
|
|
48028
|
+
import { z as z107 } from "zod";
|
|
47818
48029
|
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
48030
|
var PROBE_TIMEOUT_MS = 12e3;
|
|
47820
|
-
var ListAvailableModelsInputSchema =
|
|
47821
|
-
includeModelIds:
|
|
47822
|
-
includeOpenRouter:
|
|
48031
|
+
var ListAvailableModelsInputSchema = z107.object({
|
|
48032
|
+
includeModelIds: z107.boolean().optional().describe("Include the full model-id list per transport (default false \u2192 sample of 5 only)."),
|
|
48033
|
+
includeOpenRouter: z107.boolean().optional().describe("Probe the OpenRouter live catalog (default true).")
|
|
47823
48034
|
});
|
|
47824
48035
|
async function probeSource(source, includeModelIds) {
|
|
47825
48036
|
let timer;
|
|
@@ -47851,7 +48062,7 @@ async function probeSource(source, includeModelIds) {
|
|
|
47851
48062
|
}
|
|
47852
48063
|
}
|
|
47853
48064
|
async function defaultSources(includeOpenRouter) {
|
|
47854
|
-
const { createAllAdapters: createAllAdapters2 } = await import("./factory-
|
|
48065
|
+
const { createAllAdapters: createAllAdapters2 } = await import("./factory-QZZQVDGQ.js");
|
|
47855
48066
|
const adapters = createAllAdapters2();
|
|
47856
48067
|
return buildDefaultModelSources(adapters, { includeOpenRouter });
|
|
47857
48068
|
}
|
|
@@ -47883,8 +48094,8 @@ async function listAvailableModelsHandler(args, deps, logger58) {
|
|
|
47883
48094
|
function registerListAvailableModelsTool(server, deps) {
|
|
47884
48095
|
const logger58 = deps.logger ?? createLogger({ tool: "list_available_models" });
|
|
47885
48096
|
const toolSchema = {
|
|
47886
|
-
includeModelIds:
|
|
47887
|
-
includeOpenRouter:
|
|
48097
|
+
includeModelIds: z107.boolean().optional().describe("Include the full model-id list per transport (default false \u2192 sample of 5 only)."),
|
|
48098
|
+
includeOpenRouter: z107.boolean().optional().describe("Probe the OpenRouter live catalog (default true).")
|
|
47888
48099
|
};
|
|
47889
48100
|
const secureHandler = createSecureHandler(
|
|
47890
48101
|
(args) => listAvailableModelsHandler(args, deps, logger58),
|
|
@@ -47908,7 +48119,7 @@ function registerListAvailableModelsTool(server, deps) {
|
|
|
47908
48119
|
}
|
|
47909
48120
|
|
|
47910
48121
|
// src/mcp/tools/pr-review-eval-types.ts
|
|
47911
|
-
import { z as
|
|
48122
|
+
import { z as z108 } from "zod";
|
|
47912
48123
|
var PR_REVIEW_EVAL_ROLES = [
|
|
47913
48124
|
"architect",
|
|
47914
48125
|
"security",
|
|
@@ -47916,43 +48127,43 @@ var PR_REVIEW_EVAL_ROLES = [
|
|
|
47916
48127
|
"catfish",
|
|
47917
48128
|
"scope_steward"
|
|
47918
48129
|
];
|
|
47919
|
-
var PrReviewEvalRoleSchema =
|
|
47920
|
-
var PrReviewCaseClassSchema =
|
|
47921
|
-
var VoterEvalVerdictSchema =
|
|
48130
|
+
var PrReviewEvalRoleSchema = z108.enum(PR_REVIEW_EVAL_ROLES);
|
|
48131
|
+
var PrReviewCaseClassSchema = z108.enum(["buggy", "clean", "borderline"]);
|
|
48132
|
+
var VoterEvalVerdictSchema = z108.object({
|
|
47922
48133
|
/** Stable record id (e.g. `${runId}:${caseNumber}:${role}`). */
|
|
47923
|
-
id:
|
|
48134
|
+
id: z108.string().min(1).max(160),
|
|
47924
48135
|
/** The pr_review run / batch this verdict belongs to. */
|
|
47925
|
-
runId:
|
|
48136
|
+
runId: z108.string().min(1).max(64),
|
|
47926
48137
|
/** Dataset case identifier (the dataset's `number` field). */
|
|
47927
|
-
caseNumber:
|
|
48138
|
+
caseNumber: z108.string().min(1).max(80),
|
|
47928
48139
|
/** Rubric class of the case (ground-truth label). */
|
|
47929
48140
|
caseClass: PrReviewCaseClassSchema,
|
|
47930
48141
|
/** The voter role being scored. */
|
|
47931
48142
|
role: PrReviewEvalRoleSchema,
|
|
47932
48143
|
/** Verified findings that matched a known bug. */
|
|
47933
|
-
truePositives:
|
|
48144
|
+
truePositives: z108.number().int().nonnegative(),
|
|
47934
48145
|
/** Verified findings on clean code that matched no known bug. */
|
|
47935
|
-
falsePositives:
|
|
48146
|
+
falsePositives: z108.number().int().nonnegative(),
|
|
47936
48147
|
/** Known bugs this voter failed to flag. */
|
|
47937
|
-
falseNegatives:
|
|
48148
|
+
falseNegatives: z108.number().int().nonnegative(),
|
|
47938
48149
|
/** Rubric version the ground truth was adjudicated under. */
|
|
47939
|
-
rubricVersion:
|
|
48150
|
+
rubricVersion: z108.string().min(1).max(32),
|
|
47940
48151
|
/** ISO-8601 timestamp the verdict was recorded. */
|
|
47941
|
-
timestamp:
|
|
48152
|
+
timestamp: z108.string().min(1).max(40)
|
|
47942
48153
|
});
|
|
47943
|
-
var VoterEvalVerdictQuerySchema =
|
|
48154
|
+
var VoterEvalVerdictQuerySchema = z108.object({
|
|
47944
48155
|
role: PrReviewEvalRoleSchema.optional(),
|
|
47945
|
-
runId:
|
|
48156
|
+
runId: z108.string().min(1).max(64).optional(),
|
|
47946
48157
|
caseClass: PrReviewCaseClassSchema.optional(),
|
|
47947
|
-
rubricVersion:
|
|
48158
|
+
rubricVersion: z108.string().min(1).max(32).optional(),
|
|
47948
48159
|
/** ISO-8601 lower bound (inclusive) on `timestamp`. */
|
|
47949
|
-
since:
|
|
48160
|
+
since: z108.string().optional(),
|
|
47950
48161
|
/** Most-recent-N cap. */
|
|
47951
|
-
limit:
|
|
48162
|
+
limit: z108.number().int().positive().optional()
|
|
47952
48163
|
});
|
|
47953
48164
|
|
|
47954
48165
|
// src/mcp/tools/supply-chain-tradeoff-panel.ts
|
|
47955
|
-
import { z as
|
|
48166
|
+
import { z as z109 } from "zod";
|
|
47956
48167
|
import { randomUUID as randomUUID18 } from "crypto";
|
|
47957
48168
|
var DEFAULT_AXES = [
|
|
47958
48169
|
"build_time_determinism",
|
|
@@ -47974,16 +48185,16 @@ var FULL_PANEL = [
|
|
|
47974
48185
|
"scope_steward"
|
|
47975
48186
|
];
|
|
47976
48187
|
var QUICK_PANEL = ["architect", "security", "scope_steward"];
|
|
47977
|
-
var SupplyChainTradeoffPanelInputSchema =
|
|
47978
|
-
proposal:
|
|
47979
|
-
axes:
|
|
48188
|
+
var SupplyChainTradeoffPanelInputSchema = z109.object({
|
|
48189
|
+
proposal: z109.string().min(1).max(MAX_PROPOSAL_LENGTH).describe('The proposal under tradeoff review (e.g. "Should aegis-boot adopt cargo-nextest?")'),
|
|
48190
|
+
axes: z109.array(z109.string().min(1).max(MAX_AXIS_NAME_LENGTH)).min(1).max(MAX_AXES).optional().describe(
|
|
47980
48191
|
`Tradeoff axes to evaluate. Default: ${DEFAULT_AXES.join(", ")}. Custom axes accepted; max ${String(MAX_AXES)}.`
|
|
47981
48192
|
),
|
|
47982
|
-
context:
|
|
48193
|
+
context: z109.string().max(MAX_CONTEXT_LENGTH).optional().describe(
|
|
47983
48194
|
"Optional context: relevant repo state, dependency tree, vendor publishing patterns, etc."
|
|
47984
48195
|
),
|
|
47985
|
-
quickMode:
|
|
47986
|
-
simulate:
|
|
48196
|
+
quickMode: z109.boolean().optional().default(false).describe("Use 3 voters (architect, security, scope_steward) instead of 7"),
|
|
48197
|
+
simulate: z109.boolean().optional().default(false).describe("Use simulated voters (testing only)"),
|
|
47987
48198
|
/**
|
|
47988
48199
|
* Dispatch mode (#3731). `sync` (default) runs the panel inline and returns
|
|
47989
48200
|
* the result — but a live fan-out (up to 7 voters) can exceed the MCP request
|
|
@@ -47991,7 +48202,7 @@ var SupplyChainTradeoffPanelInputSchema = z108.object({
|
|
|
47991
48202
|
* immediately and runs the panel in the background; poll
|
|
47992
48203
|
* `get_job_result({ jobId })` for the result.
|
|
47993
48204
|
*/
|
|
47994
|
-
dispatch:
|
|
48205
|
+
dispatch: z109.enum(["sync", "async"]).default("sync").describe(
|
|
47995
48206
|
"Dispatch mode (#3731). 'sync' (default): run inline. 'async': return a jobId immediately + run the panel in background (poll get_job_result)."
|
|
47996
48207
|
)
|
|
47997
48208
|
});
|
|
@@ -48462,40 +48673,40 @@ var RiskLevel = /* @__PURE__ */ ((RiskLevel2) => {
|
|
|
48462
48673
|
})(RiskLevel || {});
|
|
48463
48674
|
|
|
48464
48675
|
// 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:
|
|
48676
|
+
import { z as z110 } from "zod";
|
|
48677
|
+
var HazardCategorySchema = z110.enum(HazardCategory);
|
|
48678
|
+
var HazardSeveritySchema = z110.enum(HazardSeverity);
|
|
48679
|
+
var ConstraintPrioritySchema = z110.enum(ConstraintPriority);
|
|
48680
|
+
var RiskLevelSchema = z110.enum(RiskLevel);
|
|
48681
|
+
var TriggerPatternSchema = z110.object({
|
|
48682
|
+
parameter: z110.string().min(1),
|
|
48683
|
+
matchType: z110.enum(["contains", "regex", "equals", "startsWith", "endsWith"]),
|
|
48684
|
+
pattern: z110.string(),
|
|
48685
|
+
reason: z110.string()
|
|
48475
48686
|
});
|
|
48476
|
-
var HazardSchema =
|
|
48477
|
-
id:
|
|
48478
|
-
description:
|
|
48687
|
+
var HazardSchema = z110.object({
|
|
48688
|
+
id: z110.string().min(1),
|
|
48689
|
+
description: z110.string(),
|
|
48479
48690
|
category: HazardCategorySchema,
|
|
48480
48691
|
severity: HazardSeveritySchema,
|
|
48481
|
-
likelihood:
|
|
48482
|
-
triggerConditions:
|
|
48483
|
-
consequences:
|
|
48692
|
+
likelihood: z110.enum(["almost_certain", "likely", "possible", "unlikely", "rare"]),
|
|
48693
|
+
triggerConditions: z110.array(z110.string()),
|
|
48694
|
+
consequences: z110.array(z110.string())
|
|
48484
48695
|
});
|
|
48485
|
-
var UnsafeControlActionSchema =
|
|
48486
|
-
id:
|
|
48487
|
-
toolName:
|
|
48488
|
-
type:
|
|
48489
|
-
description:
|
|
48490
|
-
unsafeContext:
|
|
48491
|
-
relatedHazards:
|
|
48492
|
-
triggerPatterns:
|
|
48696
|
+
var UnsafeControlActionSchema = z110.object({
|
|
48697
|
+
id: z110.string().min(1),
|
|
48698
|
+
toolName: z110.string().min(1),
|
|
48699
|
+
type: z110.enum(["not_provided", "provided_causes_hazard", "wrong_timing", "wrong_duration"]),
|
|
48700
|
+
description: z110.string(),
|
|
48701
|
+
unsafeContext: z110.string(),
|
|
48702
|
+
relatedHazards: z110.array(z110.string()),
|
|
48703
|
+
triggerPatterns: z110.array(TriggerPatternSchema).optional()
|
|
48493
48704
|
});
|
|
48494
|
-
var SafetyConstraintSchema =
|
|
48495
|
-
id:
|
|
48496
|
-
description:
|
|
48497
|
-
mitigates:
|
|
48498
|
-
enforcement:
|
|
48705
|
+
var SafetyConstraintSchema = z110.object({
|
|
48706
|
+
id: z110.string().min(1),
|
|
48707
|
+
description: z110.string(),
|
|
48708
|
+
mitigates: z110.array(z110.string()),
|
|
48709
|
+
enforcement: z110.enum([
|
|
48499
48710
|
"prevent",
|
|
48500
48711
|
"require_confirmation",
|
|
48501
48712
|
"alert",
|
|
@@ -48503,54 +48714,54 @@ var SafetyConstraintSchema = z109.object({
|
|
|
48503
48714
|
"rate_limit",
|
|
48504
48715
|
"require_privilege"
|
|
48505
48716
|
]),
|
|
48506
|
-
validationFunction:
|
|
48717
|
+
validationFunction: z110.string().optional(),
|
|
48507
48718
|
priority: ConstraintPrioritySchema
|
|
48508
48719
|
});
|
|
48509
|
-
var PropertySchemaSchema =
|
|
48510
|
-
type:
|
|
48511
|
-
description:
|
|
48512
|
-
enum:
|
|
48513
|
-
pattern:
|
|
48514
|
-
minimum:
|
|
48515
|
-
maximum:
|
|
48720
|
+
var PropertySchemaSchema = z110.object({
|
|
48721
|
+
type: z110.string(),
|
|
48722
|
+
description: z110.string().optional(),
|
|
48723
|
+
enum: z110.array(z110.unknown()).optional(),
|
|
48724
|
+
pattern: z110.string().optional(),
|
|
48725
|
+
minimum: z110.number().optional(),
|
|
48726
|
+
maximum: z110.number().optional()
|
|
48516
48727
|
});
|
|
48517
|
-
var ToolInputSchemaSchema =
|
|
48518
|
-
type:
|
|
48519
|
-
properties:
|
|
48520
|
-
required:
|
|
48521
|
-
additionalProperties:
|
|
48728
|
+
var ToolInputSchemaSchema = z110.object({
|
|
48729
|
+
type: z110.string(),
|
|
48730
|
+
properties: z110.record(z110.string(), PropertySchemaSchema).optional(),
|
|
48731
|
+
required: z110.array(z110.string()).optional(),
|
|
48732
|
+
additionalProperties: z110.boolean().optional()
|
|
48522
48733
|
});
|
|
48523
|
-
var ToolDefinitionSchema =
|
|
48524
|
-
name:
|
|
48525
|
-
description:
|
|
48734
|
+
var ToolDefinitionSchema = z110.object({
|
|
48735
|
+
name: z110.string().min(1),
|
|
48736
|
+
description: z110.string(),
|
|
48526
48737
|
inputSchema: ToolInputSchemaSchema
|
|
48527
48738
|
});
|
|
48528
|
-
var AnalysisConfigurationSchema =
|
|
48529
|
-
includeLowSeverity:
|
|
48530
|
-
generateAllConstraints:
|
|
48531
|
-
checkInteractions:
|
|
48532
|
-
maxHazardsPerTool:
|
|
48533
|
-
categories:
|
|
48739
|
+
var AnalysisConfigurationSchema = z110.object({
|
|
48740
|
+
includeLowSeverity: z110.boolean().default(true),
|
|
48741
|
+
generateAllConstraints: z110.boolean().default(true),
|
|
48742
|
+
checkInteractions: z110.boolean().default(true),
|
|
48743
|
+
maxHazardsPerTool: z110.number().int().min(1).max(100).default(50),
|
|
48744
|
+
categories: z110.array(HazardCategorySchema).default([])
|
|
48534
48745
|
});
|
|
48535
|
-
var ConstraintViolationSchema =
|
|
48536
|
-
constraintId:
|
|
48537
|
-
constraintDescription:
|
|
48746
|
+
var ConstraintViolationSchema = z110.object({
|
|
48747
|
+
constraintId: z110.string().min(1),
|
|
48748
|
+
constraintDescription: z110.string(),
|
|
48538
48749
|
severity: HazardSeveritySchema,
|
|
48539
|
-
details:
|
|
48540
|
-
remediation:
|
|
48750
|
+
details: z110.string(),
|
|
48751
|
+
remediation: z110.string()
|
|
48541
48752
|
});
|
|
48542
|
-
var ValidationWarningSchema =
|
|
48543
|
-
code:
|
|
48544
|
-
message:
|
|
48545
|
-
affected:
|
|
48753
|
+
var ValidationWarningSchema = z110.object({
|
|
48754
|
+
code: z110.string().min(1),
|
|
48755
|
+
message: z110.string(),
|
|
48756
|
+
affected: z110.string()
|
|
48546
48757
|
});
|
|
48547
|
-
var ValidationResultSchema =
|
|
48548
|
-
valid:
|
|
48549
|
-
toolName:
|
|
48550
|
-
violations:
|
|
48551
|
-
passed:
|
|
48552
|
-
warnings:
|
|
48553
|
-
validatedAt:
|
|
48758
|
+
var ValidationResultSchema = z110.object({
|
|
48759
|
+
valid: z110.boolean(),
|
|
48760
|
+
toolName: z110.string().min(1),
|
|
48761
|
+
violations: z110.array(ConstraintViolationSchema),
|
|
48762
|
+
passed: z110.array(z110.string()),
|
|
48763
|
+
warnings: z110.array(ValidationWarningSchema),
|
|
48764
|
+
validatedAt: z110.date()
|
|
48554
48765
|
});
|
|
48555
48766
|
|
|
48556
48767
|
// src/mcp/safety/stpa-types.ts
|
|
@@ -49635,43 +49846,43 @@ var GeminiResponseParser = class {
|
|
|
49635
49846
|
};
|
|
49636
49847
|
|
|
49637
49848
|
// src/cli-adapters/router-types.ts
|
|
49638
|
-
import { z as
|
|
49639
|
-
var RouterConfigSchema =
|
|
49640
|
-
minCapacityThreshold:
|
|
49641
|
-
preferCostEfficient:
|
|
49642
|
-
maxDecisionTimeMs:
|
|
49849
|
+
import { z as z111 } from "zod";
|
|
49850
|
+
var RouterConfigSchema = z111.object({
|
|
49851
|
+
minCapacityThreshold: z111.number().min(0).max(1).default(0.1),
|
|
49852
|
+
preferCostEfficient: z111.boolean().default(false),
|
|
49853
|
+
maxDecisionTimeMs: z111.number().min(1).max(1e3).default(100)
|
|
49643
49854
|
});
|
|
49644
49855
|
|
|
49645
49856
|
// src/cli-adapters/agreement-cascade-types.ts
|
|
49646
|
-
import { z as
|
|
49647
|
-
var AgreementCascadeConfigSchema =
|
|
49648
|
-
agreementThreshold:
|
|
49649
|
-
maxStages:
|
|
49650
|
-
modelTimeoutMs:
|
|
49857
|
+
import { z as z112 } from "zod";
|
|
49858
|
+
var AgreementCascadeConfigSchema = z112.object({
|
|
49859
|
+
agreementThreshold: z112.number().min(0.5).max(1).default(0.7),
|
|
49860
|
+
maxStages: z112.number().int().min(1).max(5).default(3),
|
|
49861
|
+
modelTimeoutMs: z112.number().int().min(1e3).max(3e5).default(6e4)
|
|
49651
49862
|
});
|
|
49652
49863
|
|
|
49653
49864
|
// src/cli-adapters/agreement-cascade-router.ts
|
|
49654
49865
|
var logger49 = createLogger({ component: "agreement-cascade-router" });
|
|
49655
49866
|
|
|
49656
49867
|
// src/cli-adapters/task-classifier.ts
|
|
49657
|
-
import { z as
|
|
49658
|
-
var ClassificationPatternsSchema =
|
|
49659
|
-
code:
|
|
49660
|
-
research:
|
|
49661
|
-
documentation:
|
|
49662
|
-
analysis:
|
|
49868
|
+
import { z as z113 } from "zod";
|
|
49869
|
+
var ClassificationPatternsSchema = z113.object({
|
|
49870
|
+
code: z113.array(z113.string()).readonly(),
|
|
49871
|
+
research: z113.array(z113.string()).readonly(),
|
|
49872
|
+
documentation: z113.array(z113.string()).readonly(),
|
|
49873
|
+
analysis: z113.array(z113.string()).readonly()
|
|
49663
49874
|
});
|
|
49664
49875
|
|
|
49665
49876
|
// src/cli-adapters/response-cache-types.ts
|
|
49666
|
-
import { z as
|
|
49667
|
-
var ResponseCacheConfigSchema =
|
|
49668
|
-
defaultTTL:
|
|
49877
|
+
import { z as z114 } from "zod";
|
|
49878
|
+
var ResponseCacheConfigSchema = z114.object({
|
|
49879
|
+
defaultTTL: z114.number().min(1e3).max(36e5).default(3e5),
|
|
49669
49880
|
// 5 minutes
|
|
49670
|
-
maxEntries:
|
|
49671
|
-
maxMemoryMB:
|
|
49672
|
-
cleanupInterval:
|
|
49881
|
+
maxEntries: z114.number().min(10).max(1e5).default(1e3),
|
|
49882
|
+
maxMemoryMB: z114.number().min(1).max(1e3).default(50),
|
|
49883
|
+
cleanupInterval: z114.number().min(1e3).max(6e5).default(6e4),
|
|
49673
49884
|
// 1 minute
|
|
49674
|
-
enableLogging:
|
|
49885
|
+
enableLogging: z114.boolean().default(false)
|
|
49675
49886
|
});
|
|
49676
49887
|
|
|
49677
49888
|
// src/cli-adapters/response-cache-utils.ts
|
|
@@ -49679,12 +49890,12 @@ import { createHash as createHash6 } from "crypto";
|
|
|
49679
49890
|
var logger50 = createLogger({ component: "ResponseCacheUtils" });
|
|
49680
49891
|
|
|
49681
49892
|
// src/cli-adapters/unified-routing-types.ts
|
|
49682
|
-
import { z as
|
|
49683
|
-
var UnifiedRoutingDecisionSchema =
|
|
49684
|
-
selectedCli:
|
|
49685
|
-
confidence:
|
|
49686
|
-
reason:
|
|
49687
|
-
strategy:
|
|
49893
|
+
import { z as z115 } from "zod";
|
|
49894
|
+
var UnifiedRoutingDecisionSchema = z115.object({
|
|
49895
|
+
selectedCli: z115.string(),
|
|
49896
|
+
confidence: z115.number().min(0).max(1),
|
|
49897
|
+
reason: z115.string(),
|
|
49898
|
+
strategy: z115.enum([
|
|
49688
49899
|
"composite",
|
|
49689
49900
|
"quality",
|
|
49690
49901
|
"budget",
|
|
@@ -49696,57 +49907,57 @@ var UnifiedRoutingDecisionSchema = z114.object({
|
|
|
49696
49907
|
"linucb",
|
|
49697
49908
|
"direct"
|
|
49698
49909
|
]),
|
|
49699
|
-
decisionTimeMs:
|
|
49700
|
-
alternatives:
|
|
49701
|
-
stagesExecuted:
|
|
49702
|
-
withinBudget:
|
|
49703
|
-
estimatedComplexity:
|
|
49704
|
-
estimatedTokens:
|
|
49705
|
-
topsisScore:
|
|
49706
|
-
ucbScore:
|
|
49707
|
-
resolvedAtStage:
|
|
49708
|
-
consensusReached:
|
|
49709
|
-
agreementScore:
|
|
49710
|
-
metadata:
|
|
49910
|
+
decisionTimeMs: z115.number().nonnegative(),
|
|
49911
|
+
alternatives: z115.array(z115.string()).readonly(),
|
|
49912
|
+
stagesExecuted: z115.array(z115.string()).readonly(),
|
|
49913
|
+
withinBudget: z115.boolean().optional(),
|
|
49914
|
+
estimatedComplexity: z115.enum(["simple", "moderate", "complex", "expert"]).optional(),
|
|
49915
|
+
estimatedTokens: z115.number().int().positive().optional(),
|
|
49916
|
+
topsisScore: z115.number().optional(),
|
|
49917
|
+
ucbScore: z115.number().optional(),
|
|
49918
|
+
resolvedAtStage: z115.number().int().nonnegative().optional(),
|
|
49919
|
+
consensusReached: z115.boolean().optional(),
|
|
49920
|
+
agreementScore: z115.number().min(0).max(1).optional(),
|
|
49921
|
+
metadata: z115.record(z115.string(), z115.unknown()).optional()
|
|
49711
49922
|
});
|
|
49712
49923
|
|
|
49713
49924
|
// 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:
|
|
49925
|
+
import { z as z116 } from "zod";
|
|
49926
|
+
var QualitySignalsSchema = z116.object({
|
|
49927
|
+
testsPass: z116.boolean().optional(),
|
|
49928
|
+
lintErrors: z116.number().int().min(0).optional(),
|
|
49929
|
+
userApproved: z116.boolean().optional(),
|
|
49930
|
+
retryCount: z116.number().int().min(0).default(0),
|
|
49931
|
+
completionRatio: z116.number().min(0).max(1).default(1),
|
|
49932
|
+
validStructure: z116.boolean().optional(),
|
|
49933
|
+
coherenceScore: z116.number().min(0).max(1).optional()
|
|
49723
49934
|
});
|
|
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:
|
|
49935
|
+
var RoutingDecisionSchema = z116.object({
|
|
49936
|
+
id: z116.uuid(),
|
|
49937
|
+
timestamp: z116.iso.datetime(),
|
|
49938
|
+
query: z116.string(),
|
|
49939
|
+
routerType: z116.enum(["linucb", "preference", "quality", "cascade", "topsis"]),
|
|
49940
|
+
selectedModel: z116.string(),
|
|
49941
|
+
selectedTier: z116.enum(["strong", "weak"]).optional(),
|
|
49942
|
+
armIndex: z116.number().int().min(0).optional(),
|
|
49943
|
+
banditContext: z116.record(z116.string(), z116.unknown()).optional(),
|
|
49944
|
+
queryFeatures: z116.record(z116.string(), z116.unknown()).optional(),
|
|
49945
|
+
ucbScore: z116.number().optional(),
|
|
49946
|
+
confidence: z116.number().min(0).max(1).optional(),
|
|
49947
|
+
traceId: z116.string(),
|
|
49948
|
+
domain: z116.string().optional()
|
|
49738
49949
|
});
|
|
49739
|
-
var TaskOutcomeSchema =
|
|
49740
|
-
routingDecisionId:
|
|
49741
|
-
timestamp:
|
|
49742
|
-
outcomeClass:
|
|
49743
|
-
success:
|
|
49744
|
-
qualityScore:
|
|
49745
|
-
durationMs:
|
|
49746
|
-
tokenUsage:
|
|
49747
|
-
errorMessage:
|
|
49950
|
+
var TaskOutcomeSchema = z116.object({
|
|
49951
|
+
routingDecisionId: z116.uuid(),
|
|
49952
|
+
timestamp: z116.iso.datetime(),
|
|
49953
|
+
outcomeClass: z116.enum(["success", "partial", "failure", "timeout", "error"]),
|
|
49954
|
+
success: z116.boolean(),
|
|
49955
|
+
qualityScore: z116.number().min(0).max(1),
|
|
49956
|
+
durationMs: z116.number().min(0),
|
|
49957
|
+
tokenUsage: z116.number().int().min(0),
|
|
49958
|
+
errorMessage: z116.string().optional(),
|
|
49748
49959
|
qualitySignals: QualitySignalsSchema,
|
|
49749
|
-
traceId:
|
|
49960
|
+
traceId: z116.string()
|
|
49750
49961
|
});
|
|
49751
49962
|
var DEFAULT_FEEDBACK_COLLECTOR_CONFIG = {
|
|
49752
49963
|
maxPendingDecisions: 1e3,
|
|
@@ -49761,17 +49972,17 @@ var DEFAULT_FEEDBACK_COLLECTOR_CONFIG = {
|
|
|
49761
49972
|
targetTokenUsage: 2e3,
|
|
49762
49973
|
maxHistorySize: 1e4
|
|
49763
49974
|
};
|
|
49764
|
-
var FeedbackCollectorConfigSchema =
|
|
49765
|
-
maxPendingDecisions:
|
|
49766
|
-
pendingTimeoutMs:
|
|
49767
|
-
enableAutoReward:
|
|
49768
|
-
qualityWeight:
|
|
49769
|
-
speedWeight:
|
|
49770
|
-
efficiencyWeight:
|
|
49771
|
-
retryPenalty:
|
|
49772
|
-
targetDurationMs:
|
|
49773
|
-
targetTokenUsage:
|
|
49774
|
-
maxHistorySize:
|
|
49975
|
+
var FeedbackCollectorConfigSchema = z116.object({
|
|
49976
|
+
maxPendingDecisions: z116.number().int().positive().default(1e3),
|
|
49977
|
+
pendingTimeoutMs: z116.number().positive().default(3e5),
|
|
49978
|
+
enableAutoReward: z116.boolean().default(true),
|
|
49979
|
+
qualityWeight: z116.number().min(0).max(1).default(0.5),
|
|
49980
|
+
speedWeight: z116.number().min(0).max(1).default(0.2),
|
|
49981
|
+
efficiencyWeight: z116.number().min(0).max(1).default(0.2),
|
|
49982
|
+
retryPenalty: z116.number().min(0).max(1).default(0.1),
|
|
49983
|
+
targetDurationMs: z116.number().positive().default(5e3),
|
|
49984
|
+
targetTokenUsage: z116.number().positive().default(2e3),
|
|
49985
|
+
maxHistorySize: z116.number().int().positive().default(1e4)
|
|
49775
49986
|
});
|
|
49776
49987
|
|
|
49777
49988
|
// src/learning/outcome-feedback-helpers.ts
|
|
@@ -50836,7 +51047,7 @@ function getPolicy(id) {
|
|
|
50836
51047
|
// src/security/sandbox/sandbox-executor.ts
|
|
50837
51048
|
import { execFile } from "child_process";
|
|
50838
51049
|
import { promisify } from "util";
|
|
50839
|
-
import { resolve as
|
|
51050
|
+
import { resolve as resolve19, normalize as normalize2, sep as sep12 } from "path";
|
|
50840
51051
|
var execFileAsync = promisify(execFile);
|
|
50841
51052
|
var logger52 = createLogger({ component: "sandbox-executor" });
|
|
50842
51053
|
function parseExecError(error) {
|
|
@@ -50916,10 +51127,10 @@ var PolicySandboxExecutor = class {
|
|
|
50916
51127
|
*/
|
|
50917
51128
|
validateCwd(cwd, policy) {
|
|
50918
51129
|
if (cwd === void 0) return null;
|
|
50919
|
-
const normalizedCwd = normalize2(
|
|
51130
|
+
const normalizedCwd = normalize2(resolve19(cwd));
|
|
50920
51131
|
const isAllowed = policy.pathRules.some((rule) => {
|
|
50921
|
-
const normalizedRule = normalize2(
|
|
50922
|
-
const isUnderRule = normalizedCwd === normalizedRule || normalizedCwd.startsWith(normalizedRule +
|
|
51132
|
+
const normalizedRule = normalize2(resolve19(rule.path));
|
|
51133
|
+
const isUnderRule = normalizedCwd === normalizedRule || normalizedCwd.startsWith(normalizedRule + sep12);
|
|
50923
51134
|
return isUnderRule && rule.access !== "none";
|
|
50924
51135
|
});
|
|
50925
51136
|
if (!isAllowed) {
|
|
@@ -51823,6 +52034,8 @@ export {
|
|
|
51823
52034
|
registerSearchCodebaseTool,
|
|
51824
52035
|
ExtractSymbolsInputSchema,
|
|
51825
52036
|
registerExtractSymbolsTool,
|
|
52037
|
+
SearchUsagesInputSchema,
|
|
52038
|
+
registerSearchUsagesTool,
|
|
51826
52039
|
QueryTraceInputSchema,
|
|
51827
52040
|
registerQueryTraceTool,
|
|
51828
52041
|
registerQueryTaskStateTool,
|
|
@@ -51920,4 +52133,4 @@ export {
|
|
|
51920
52133
|
shutdownFeedbackSubscriber,
|
|
51921
52134
|
createEventBusBridge
|
|
51922
52135
|
};
|
|
51923
|
-
//# sourceMappingURL=chunk-
|
|
52136
|
+
//# sourceMappingURL=chunk-N7FIUFQL.js.map
|