nexus-agents 2.81.3 → 2.82.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{child-mcp-config-LLLRMOTQ.js → child-mcp-config-BMSYR7VV.js} +2 -2
- package/dist/{chunk-ERWTZSAR.js → chunk-2R5UUBGA.js} +2 -2
- package/dist/{chunk-BMNWUPJO.js → chunk-2SQXJQTA.js} +3 -3
- package/dist/{chunk-755EZIUF.js → chunk-4XNVJS5A.js} +924 -376
- package/dist/{chunk-755EZIUF.js.map → chunk-4XNVJS5A.js.map} +1 -1
- package/dist/{chunk-LJIB6TNE.js → chunk-7VNVDFD5.js} +3 -13
- package/dist/{chunk-LJIB6TNE.js.map → chunk-7VNVDFD5.js.map} +1 -1
- package/dist/{chunk-PUSFT342.js → chunk-BL5IBHEY.js} +3 -3
- package/dist/{chunk-Q27M6KHP.js → chunk-C7P2HLJX.js} +4 -4
- package/dist/{chunk-P4W7PV6L.js → chunk-FTT2IYYX.js} +123 -96
- package/dist/chunk-FTT2IYYX.js.map +1 -0
- package/dist/{chunk-UZCDHAY3.js → chunk-G2DZBEMU.js} +2 -2
- package/dist/{chunk-WZGCVCRQ.js → chunk-GNG7URCR.js} +2 -2
- package/dist/{chunk-RLQZOEMX.js → chunk-HJUHDPXJ.js} +3 -3
- package/dist/{chunk-SVKH6ASN.js → chunk-HMXQKDUV.js} +36 -24
- package/dist/chunk-HMXQKDUV.js.map +1 -0
- package/dist/{chunk-PV3OEDLO.js → chunk-HVZ52LOL.js} +2 -2
- package/dist/{chunk-EKLY4LBJ.js → chunk-JM3R267Z.js} +28 -15
- package/dist/chunk-JM3R267Z.js.map +1 -0
- package/dist/{chunk-M66MYHBT.js → chunk-NTLJ3INA.js} +2 -2
- package/dist/{chunk-T7RGD5JW.js → chunk-OYDJ3C4N.js} +3 -3
- package/dist/{chunk-UTL2SFIN.js → chunk-PZESEBD3.js} +2 -2
- package/dist/{chunk-LIEFKEAO.js → chunk-QHL4KGNB.js} +2 -2
- package/dist/{chunk-WLAQXITV.js → chunk-S36LIUV2.js} +12 -23
- package/dist/chunk-S36LIUV2.js.map +1 -0
- package/dist/{chunk-YLYT7GSG.js → chunk-SBZVRH4S.js} +2 -2
- package/dist/{chunk-V2KWEIV5.js → chunk-SHWGK7X6.js} +9 -60
- package/dist/chunk-SHWGK7X6.js.map +1 -0
- package/dist/{chunk-6YQCLEHL.js → chunk-SXL744NF.js} +2 -2
- package/dist/{chunk-4OPS2AUD.js → chunk-TXIUCEFT.js} +4 -4
- package/dist/chunk-TXIUCEFT.js.map +1 -0
- package/dist/{chunk-PZEE6T5Y.js → chunk-U7JXQSEM.js} +3 -3
- package/dist/{chunk-SZ7VPIRA.js → chunk-W2AIGD35.js} +2 -2
- package/dist/{chunk-73K7575Z.js → chunk-WUUEKFKG.js} +2 -2
- package/dist/{chunk-PKBKWWPK.js → chunk-X3JR3GMT.js} +3 -3
- package/dist/{chunk-S77SLJ2J.js → chunk-XGUDCUMB.js} +2 -2
- package/dist/{cli-circuit-breaker-O5RV47BO.js → cli-circuit-breaker-BIJUQRQI.js} +4 -4
- package/dist/cli.js +148 -70
- package/dist/cli.js.map +1 -1
- package/dist/{composite-router-SKHVZ4UF.js → composite-router-FB7P22L5.js} +2 -2
- package/dist/{consensus-vote-VBXLXVFF.js → consensus-vote-KKAIFULI.js} +11 -11
- package/dist/{context-retriever-KLJ5X4TL.js → context-retriever-4JCGMWH7.js} +5 -5
- package/dist/{doctor-deep-IH4FG5YZ.js → doctor-deep-7YK4BZIJ.js} +3 -3
- package/dist/expert-bridge-DJM5GAWZ.js +11 -0
- package/dist/{factory-FTE7TDCT.js → factory-DOWBGVAL.js} +5 -5
- package/dist/{factory-CQUDIMIG.js → factory-PK4EZL7K.js} +4 -4
- package/dist/index.d.ts +13 -1
- package/dist/index.js +24 -24
- package/dist/index.js.map +1 -1
- package/dist/{init-opencode-MXZJKG32.js → init-opencode-QP5CAMWN.js} +5 -5
- package/dist/{issue-triage-H5VLNGWU.js → issue-triage-T3SKNBH5.js} +4 -4
- package/dist/{registry-command-ALVYOGQY.js → registry-command-TH7U6UMC.js} +2 -2
- package/dist/{repo-security-plan-VJCWWPWO.js → repo-security-plan-V257RYTW.js} +3 -3
- package/dist/{research-helpers-synthesize-XUTBDVI7.js → research-helpers-synthesize-Y3O76PY4.js} +3 -3
- package/dist/{routing-memory-QKQ3OGWW.js → routing-memory-AAH7NIHD.js} +2 -2
- package/dist/{session-memory-N76TNRSK.js → session-memory-MY6YS2VX.js} +3 -3
- package/dist/{setup-command-3VQHU7BZ.js → setup-command-B6EC3OJA.js} +10 -10
- package/dist/{setup-config-Y7KZSFX3.js → setup-config-HVO6ZSLW.js} +3 -3
- package/dist/{setup-custom-api-QEKHNYQJ.js → setup-custom-api-UOIKUQL4.js} +4 -4
- package/dist/{tool-memory-MFDLIJOB.js → tool-memory-T7ZYIUJ2.js} +4 -4
- package/dist/{weather-report-IXPYIYE4.js → weather-report-O3Z3BBAX.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-4OPS2AUD.js.map +0 -1
- package/dist/chunk-EKLY4LBJ.js.map +0 -1
- package/dist/chunk-P4W7PV6L.js.map +0 -1
- package/dist/chunk-SVKH6ASN.js.map +0 -1
- package/dist/chunk-V2KWEIV5.js.map +0 -1
- package/dist/chunk-WLAQXITV.js.map +0 -1
- package/dist/expert-bridge-EKPDZKMD.js +0 -11
- /package/dist/{child-mcp-config-LLLRMOTQ.js.map → child-mcp-config-BMSYR7VV.js.map} +0 -0
- /package/dist/{chunk-ERWTZSAR.js.map → chunk-2R5UUBGA.js.map} +0 -0
- /package/dist/{chunk-BMNWUPJO.js.map → chunk-2SQXJQTA.js.map} +0 -0
- /package/dist/{chunk-PUSFT342.js.map → chunk-BL5IBHEY.js.map} +0 -0
- /package/dist/{chunk-Q27M6KHP.js.map → chunk-C7P2HLJX.js.map} +0 -0
- /package/dist/{chunk-UZCDHAY3.js.map → chunk-G2DZBEMU.js.map} +0 -0
- /package/dist/{chunk-WZGCVCRQ.js.map → chunk-GNG7URCR.js.map} +0 -0
- /package/dist/{chunk-RLQZOEMX.js.map → chunk-HJUHDPXJ.js.map} +0 -0
- /package/dist/{chunk-PV3OEDLO.js.map → chunk-HVZ52LOL.js.map} +0 -0
- /package/dist/{chunk-M66MYHBT.js.map → chunk-NTLJ3INA.js.map} +0 -0
- /package/dist/{chunk-T7RGD5JW.js.map → chunk-OYDJ3C4N.js.map} +0 -0
- /package/dist/{chunk-UTL2SFIN.js.map → chunk-PZESEBD3.js.map} +0 -0
- /package/dist/{chunk-LIEFKEAO.js.map → chunk-QHL4KGNB.js.map} +0 -0
- /package/dist/{chunk-YLYT7GSG.js.map → chunk-SBZVRH4S.js.map} +0 -0
- /package/dist/{chunk-6YQCLEHL.js.map → chunk-SXL744NF.js.map} +0 -0
- /package/dist/{chunk-PZEE6T5Y.js.map → chunk-U7JXQSEM.js.map} +0 -0
- /package/dist/{chunk-SZ7VPIRA.js.map → chunk-W2AIGD35.js.map} +0 -0
- /package/dist/{chunk-73K7575Z.js.map → chunk-WUUEKFKG.js.map} +0 -0
- /package/dist/{chunk-PKBKWWPK.js.map → chunk-X3JR3GMT.js.map} +0 -0
- /package/dist/{chunk-S77SLJ2J.js.map → chunk-XGUDCUMB.js.map} +0 -0
- /package/dist/{cli-circuit-breaker-O5RV47BO.js.map → cli-circuit-breaker-BIJUQRQI.js.map} +0 -0
- /package/dist/{composite-router-SKHVZ4UF.js.map → composite-router-FB7P22L5.js.map} +0 -0
- /package/dist/{consensus-vote-VBXLXVFF.js.map → consensus-vote-KKAIFULI.js.map} +0 -0
- /package/dist/{context-retriever-KLJ5X4TL.js.map → context-retriever-4JCGMWH7.js.map} +0 -0
- /package/dist/{doctor-deep-IH4FG5YZ.js.map → doctor-deep-7YK4BZIJ.js.map} +0 -0
- /package/dist/{expert-bridge-EKPDZKMD.js.map → expert-bridge-DJM5GAWZ.js.map} +0 -0
- /package/dist/{factory-CQUDIMIG.js.map → factory-DOWBGVAL.js.map} +0 -0
- /package/dist/{factory-FTE7TDCT.js.map → factory-PK4EZL7K.js.map} +0 -0
- /package/dist/{init-opencode-MXZJKG32.js.map → init-opencode-QP5CAMWN.js.map} +0 -0
- /package/dist/{issue-triage-H5VLNGWU.js.map → issue-triage-T3SKNBH5.js.map} +0 -0
- /package/dist/{registry-command-ALVYOGQY.js.map → registry-command-TH7U6UMC.js.map} +0 -0
- /package/dist/{repo-security-plan-VJCWWPWO.js.map → repo-security-plan-V257RYTW.js.map} +0 -0
- /package/dist/{research-helpers-synthesize-XUTBDVI7.js.map → research-helpers-synthesize-Y3O76PY4.js.map} +0 -0
- /package/dist/{routing-memory-QKQ3OGWW.js.map → routing-memory-AAH7NIHD.js.map} +0 -0
- /package/dist/{session-memory-N76TNRSK.js.map → session-memory-MY6YS2VX.js.map} +0 -0
- /package/dist/{setup-command-3VQHU7BZ.js.map → setup-command-B6EC3OJA.js.map} +0 -0
- /package/dist/{setup-config-Y7KZSFX3.js.map → setup-config-HVO6ZSLW.js.map} +0 -0
- /package/dist/{setup-custom-api-QEKHNYQJ.js.map → setup-custom-api-UOIKUQL4.js.map} +0 -0
- /package/dist/{tool-memory-MFDLIJOB.js.map → tool-memory-T7ZYIUJ2.js.map} +0 -0
- /package/dist/{weather-report-IXPYIYE4.js.map → weather-report-O3Z3BBAX.js.map} +0 -0
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
getTokenEnvVars,
|
|
9
9
|
resolveToken
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-G2DZBEMU.js";
|
|
11
11
|
import {
|
|
12
12
|
executeExpert
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-HMXQKDUV.js";
|
|
14
14
|
import {
|
|
15
15
|
EventTopics,
|
|
16
16
|
NOOP_NOTIFIER,
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
withAccessPolicy,
|
|
37
37
|
withProgressHeartbeat,
|
|
38
38
|
wrapToolWithTimeout
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-FTT2IYYX.js";
|
|
40
40
|
import {
|
|
41
41
|
REGISTRY_PATH,
|
|
42
42
|
getProjectRoot,
|
|
@@ -45,14 +45,14 @@ import {
|
|
|
45
45
|
normalizeTopicToCanonical,
|
|
46
46
|
savePapersRegistry,
|
|
47
47
|
synthesizeResearch
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-2R5UUBGA.js";
|
|
49
49
|
import {
|
|
50
50
|
IssueTriage,
|
|
51
51
|
sanitizeInput
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-HJUHDPXJ.js";
|
|
53
53
|
import {
|
|
54
54
|
generateSecurityPlan
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-W2AIGD35.js";
|
|
56
56
|
import {
|
|
57
57
|
analyzeGitHubRepo
|
|
58
58
|
} from "./chunk-7J7PNOJQ.js";
|
|
@@ -64,7 +64,7 @@ import {
|
|
|
64
64
|
getContextForTask,
|
|
65
65
|
inferTaskCategory,
|
|
66
66
|
summarizeContextForPrompt
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-TXIUCEFT.js";
|
|
68
68
|
import {
|
|
69
69
|
DEFAULT_RELEVANCE_CONFIG,
|
|
70
70
|
MemoryImportance,
|
|
@@ -72,19 +72,19 @@ import {
|
|
|
72
72
|
generateHyphenId,
|
|
73
73
|
generateUUID,
|
|
74
74
|
getToolMemory
|
|
75
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-U7JXQSEM.js";
|
|
76
76
|
import {
|
|
77
77
|
DEFAULT_TASK_TTL_MS,
|
|
78
78
|
DEFAULT_TOOL_RATE_LIMITS,
|
|
79
79
|
clampTaskTtl
|
|
80
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-S36LIUV2.js";
|
|
81
81
|
import {
|
|
82
82
|
getAvailabilityCache,
|
|
83
83
|
resolveFallback
|
|
84
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-GNG7URCR.js";
|
|
85
85
|
import {
|
|
86
86
|
DEFAULTS
|
|
87
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-SHWGK7X6.js";
|
|
88
88
|
import {
|
|
89
89
|
resolveInsideRoot
|
|
90
90
|
} from "./chunk-NUBSJGQZ.js";
|
|
@@ -100,7 +100,7 @@ import {
|
|
|
100
100
|
getAvailableClis,
|
|
101
101
|
sleep,
|
|
102
102
|
withTimeout
|
|
103
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-2SQXJQTA.js";
|
|
104
104
|
import {
|
|
105
105
|
BUILT_IN_EXPERTS,
|
|
106
106
|
BuiltInExpertTypeSchema,
|
|
@@ -112,7 +112,7 @@ import {
|
|
|
112
112
|
} from "./chunk-PQHVC4BD.js";
|
|
113
113
|
import {
|
|
114
114
|
createSessionMemory
|
|
115
|
-
} from "./chunk-
|
|
115
|
+
} from "./chunk-HVZ52LOL.js";
|
|
116
116
|
import {
|
|
117
117
|
AGENT_ROUTER_TIMEOUTS,
|
|
118
118
|
API_TIMEOUTS,
|
|
@@ -182,7 +182,7 @@ import {
|
|
|
182
182
|
resolveModelIdentitySync,
|
|
183
183
|
toExpertTaskAnalysisResult,
|
|
184
184
|
withStep
|
|
185
|
-
} from "./chunk-
|
|
185
|
+
} from "./chunk-7VNVDFD5.js";
|
|
186
186
|
import {
|
|
187
187
|
getNexusDataDir,
|
|
188
188
|
nexusDataPath
|
|
@@ -17713,7 +17713,7 @@ var ExperienceBuffer = class _ExperienceBuffer {
|
|
|
17713
17713
|
}
|
|
17714
17714
|
const totalReward = this.computeTotalReward(steps);
|
|
17715
17715
|
const episode = {
|
|
17716
|
-
id:
|
|
17716
|
+
id: getRandomProvider().uuid(),
|
|
17717
17717
|
sessionId,
|
|
17718
17718
|
steps: [...steps],
|
|
17719
17719
|
totalReward,
|
|
@@ -19198,14 +19198,8 @@ async function runAllSteps(steps, context, stepExecutor, opts, state) {
|
|
|
19198
19198
|
async function executeStepInQueue(step, context, stepExecutor, opts, state) {
|
|
19199
19199
|
try {
|
|
19200
19200
|
const result = await state.queue.add((signal) => {
|
|
19201
|
-
const combined =
|
|
19202
|
-
|
|
19203
|
-
combined.abort();
|
|
19204
|
-
});
|
|
19205
|
-
state.abortController.signal.addEventListener("abort", () => {
|
|
19206
|
-
combined.abort();
|
|
19207
|
-
});
|
|
19208
|
-
return executeStepWithTimeout(step, context, stepExecutor, combined.signal);
|
|
19201
|
+
const combined = AbortSignal.any([signal, state.abortController.signal]);
|
|
19202
|
+
return executeStepWithTimeout(step, context, stepExecutor, combined);
|
|
19209
19203
|
});
|
|
19210
19204
|
state.results.push(result);
|
|
19211
19205
|
if (opts.failFast && result.status === "failed" && state.firstError === null) {
|
|
@@ -23494,10 +23488,10 @@ function calculateZStatistic(params) {
|
|
|
23494
23488
|
function calculateDifferenceCI(p1, p2, total1, total2, confidence) {
|
|
23495
23489
|
const difference = p1 - p2;
|
|
23496
23490
|
const seDiff = Math.sqrt(p1 * (1 - p1) / (total1 || 1) + p2 * (1 - p2) / (total2 || 1));
|
|
23497
|
-
const
|
|
23491
|
+
const z108 = getZScore(confidence);
|
|
23498
23492
|
return {
|
|
23499
|
-
lower: difference -
|
|
23500
|
-
upper: difference +
|
|
23493
|
+
lower: difference - z108 * seDiff,
|
|
23494
|
+
upper: difference + z108 * seDiff,
|
|
23501
23495
|
estimate: difference,
|
|
23502
23496
|
confidence,
|
|
23503
23497
|
n: total1 + total2,
|
|
@@ -23520,11 +23514,11 @@ function proportionConfidenceInterval(successes, total, options = {}) {
|
|
|
23520
23514
|
standardError: 0
|
|
23521
23515
|
};
|
|
23522
23516
|
}
|
|
23523
|
-
const
|
|
23524
|
-
const z210 =
|
|
23517
|
+
const z108 = getZScore(opts.confidence);
|
|
23518
|
+
const z210 = z108 * z108;
|
|
23525
23519
|
const denominator = 1 + z210 / n;
|
|
23526
23520
|
const center = (p + z210 / (2 * n)) / denominator;
|
|
23527
|
-
const margin =
|
|
23521
|
+
const margin = z108 / denominator * Math.sqrt(p * (1 - p) / n + z210 / (4 * n * n));
|
|
23528
23522
|
const lower = Math.max(0, center - margin);
|
|
23529
23523
|
const upper = Math.min(1, center + margin);
|
|
23530
23524
|
const standardError = Math.sqrt(p * (1 - p) / n);
|
|
@@ -23554,8 +23548,8 @@ function meanConfidenceInterval(values, options = {}) {
|
|
|
23554
23548
|
const variance = values.reduce((sum, v) => sum + (v - mean) ** 2, 0) / (n - 1 || 1);
|
|
23555
23549
|
const stdDev = Math.sqrt(variance);
|
|
23556
23550
|
const standardError = stdDev / Math.sqrt(n);
|
|
23557
|
-
const
|
|
23558
|
-
const margin =
|
|
23551
|
+
const z108 = getZScore(opts.confidence);
|
|
23552
|
+
const margin = z108 * standardError;
|
|
23559
23553
|
return {
|
|
23560
23554
|
lower: mean - margin,
|
|
23561
23555
|
upper: mean + margin,
|
|
@@ -26699,7 +26693,7 @@ async function populateUnifiedContextOnState(state) {
|
|
|
26699
26693
|
try {
|
|
26700
26694
|
const taskCandidate = state["task"];
|
|
26701
26695
|
if (typeof taskCandidate !== "string" || taskCandidate === "") return;
|
|
26702
|
-
const { getContextForTask: getContextForTask2, inferTaskCategory: inferTaskCategory2 } = await import("./context-retriever-
|
|
26696
|
+
const { getContextForTask: getContextForTask2, inferTaskCategory: inferTaskCategory2 } = await import("./context-retriever-4JCGMWH7.js");
|
|
26703
26697
|
const ctx = await getContextForTask2({
|
|
26704
26698
|
task: taskCandidate,
|
|
26705
26699
|
category: inferTaskCategory2(taskCandidate),
|
|
@@ -33428,9 +33422,22 @@ async function deriveOrchestratePolicy(taskText, deps, logger52) {
|
|
|
33428
33422
|
}
|
|
33429
33423
|
return policy;
|
|
33430
33424
|
} catch (error) {
|
|
33431
|
-
logger52.warn("access-policy: derivation failed
|
|
33432
|
-
|
|
33425
|
+
logger52.warn("access-policy: derivation failed", {
|
|
33426
|
+
mode,
|
|
33427
|
+
error: getErrorMessage(error),
|
|
33428
|
+
failClosed: mode === "enforce" || mode === "confirm_risky"
|
|
33433
33429
|
});
|
|
33430
|
+
if (mode === "enforce" || mode === "confirm_risky") {
|
|
33431
|
+
return {
|
|
33432
|
+
allowedTools: [],
|
|
33433
|
+
allowedPathPatterns: [],
|
|
33434
|
+
allowedOperations: [],
|
|
33435
|
+
objectiveHash: "derivation-failed",
|
|
33436
|
+
derivedAt: getTimeProvider().nowIso(),
|
|
33437
|
+
source: "bypass",
|
|
33438
|
+
mode
|
|
33439
|
+
};
|
|
33440
|
+
}
|
|
33434
33441
|
return {
|
|
33435
33442
|
allowedTools: "*",
|
|
33436
33443
|
allowedPathPatterns: [],
|
|
@@ -33438,7 +33445,7 @@ async function deriveOrchestratePolicy(taskText, deps, logger52) {
|
|
|
33438
33445
|
objectiveHash: "derivation-failed",
|
|
33439
33446
|
derivedAt: getTimeProvider().nowIso(),
|
|
33440
33447
|
source: "bypass",
|
|
33441
|
-
mode
|
|
33448
|
+
mode
|
|
33442
33449
|
};
|
|
33443
33450
|
}
|
|
33444
33451
|
}
|
|
@@ -34183,6 +34190,8 @@ function instrumentV2Pipeline(input, logger52) {
|
|
|
34183
34190
|
const tc = delegateInputToTaskContract(input);
|
|
34184
34191
|
void executeDelegatePipeline(tc).then((m) => {
|
|
34185
34192
|
logger52.info("V2 delegate pipeline", { ...m });
|
|
34193
|
+
}).catch((error) => {
|
|
34194
|
+
logger52.warn("V2 delegate instrumentation failed", { error: getErrorMessage(error) });
|
|
34186
34195
|
});
|
|
34187
34196
|
}
|
|
34188
34197
|
function notifyAndRecord(opts) {
|
|
@@ -35633,9 +35642,22 @@ async function deriveExpertAccessPolicy(task, logger52) {
|
|
|
35633
35642
|
}
|
|
35634
35643
|
return policy;
|
|
35635
35644
|
} catch (error) {
|
|
35636
|
-
logger52?.warn("access-policy: derivation failed
|
|
35637
|
-
|
|
35645
|
+
logger52?.warn("access-policy: derivation failed (expert)", {
|
|
35646
|
+
mode,
|
|
35647
|
+
error: getErrorMessage(error),
|
|
35648
|
+
failClosed: mode === "enforce" || mode === "confirm_risky"
|
|
35638
35649
|
});
|
|
35650
|
+
if (mode === "enforce" || mode === "confirm_risky") {
|
|
35651
|
+
return {
|
|
35652
|
+
allowedTools: [],
|
|
35653
|
+
allowedPathPatterns: [],
|
|
35654
|
+
allowedOperations: [],
|
|
35655
|
+
objectiveHash: "derivation-failed",
|
|
35656
|
+
derivedAt: getTimeProvider().nowIso(),
|
|
35657
|
+
source: "bypass",
|
|
35658
|
+
mode
|
|
35659
|
+
};
|
|
35660
|
+
}
|
|
35639
35661
|
return {
|
|
35640
35662
|
allowedTools: "*",
|
|
35641
35663
|
allowedPathPatterns: [],
|
|
@@ -35643,7 +35665,7 @@ async function deriveExpertAccessPolicy(task, logger52) {
|
|
|
35643
35665
|
objectiveHash: "derivation-failed",
|
|
35644
35666
|
derivedAt: getTimeProvider().nowIso(),
|
|
35645
35667
|
source: "bypass",
|
|
35646
|
-
mode
|
|
35668
|
+
mode
|
|
35647
35669
|
};
|
|
35648
35670
|
}
|
|
35649
35671
|
}
|
|
@@ -40477,7 +40499,7 @@ function registerRepoSecurityPlanTool(server, deps) {
|
|
|
40477
40499
|
}
|
|
40478
40500
|
|
|
40479
40501
|
// src/mcp/tools/search-codebase-tool.ts
|
|
40480
|
-
import { resolve as resolve9 } from "path";
|
|
40502
|
+
import { resolve as resolve9, sep as sep3 } from "path";
|
|
40481
40503
|
import { z as z82 } from "zod";
|
|
40482
40504
|
var SearchCodebaseInputSchema = z82.object({
|
|
40483
40505
|
query: z82.string().min(1).max(200).describe("Search query (symbol name, keyword, or pattern)"),
|
|
@@ -40485,22 +40507,49 @@ var SearchCodebaseInputSchema = z82.object({
|
|
|
40485
40507
|
limit: z82.number().min(1).max(50).optional().describe("Max results (default: 20)"),
|
|
40486
40508
|
mode: z82.enum(["search", "summary", "list"]).optional().describe("search: find symbols. summary: file overview. list: list indexed files.")
|
|
40487
40509
|
});
|
|
40488
|
-
var
|
|
40489
|
-
var
|
|
40490
|
-
|
|
40491
|
-
|
|
40492
|
-
|
|
40510
|
+
var MAX_CACHED_DIRS = 3;
|
|
40511
|
+
var INDEX_TTL_MS = 15 * 60 * 1e3;
|
|
40512
|
+
var indexCache = /* @__PURE__ */ new Map();
|
|
40513
|
+
var inflightIndex = /* @__PURE__ */ new Map();
|
|
40514
|
+
function getFromCache(dir) {
|
|
40515
|
+
const entry = indexCache.get(dir);
|
|
40516
|
+
if (entry === void 0) return void 0;
|
|
40517
|
+
if (entry.expiresAt <= getTimeProvider().now()) {
|
|
40518
|
+
indexCache.delete(dir);
|
|
40519
|
+
return void 0;
|
|
40520
|
+
}
|
|
40521
|
+
indexCache.delete(dir);
|
|
40522
|
+
indexCache.set(dir, entry);
|
|
40523
|
+
return entry.index;
|
|
40524
|
+
}
|
|
40525
|
+
function putInCache(dir, index) {
|
|
40526
|
+
indexCache.set(dir, { index, expiresAt: getTimeProvider().now() + INDEX_TTL_MS });
|
|
40527
|
+
while (indexCache.size > MAX_CACHED_DIRS) {
|
|
40528
|
+
const lruKey = indexCache.keys().next().value;
|
|
40529
|
+
if (lruKey === void 0) break;
|
|
40530
|
+
indexCache.delete(lruKey);
|
|
40493
40531
|
}
|
|
40494
|
-
|
|
40495
|
-
|
|
40496
|
-
|
|
40497
|
-
|
|
40498
|
-
|
|
40532
|
+
}
|
|
40533
|
+
async function getIndex(dir) {
|
|
40534
|
+
const cached = getFromCache(dir);
|
|
40535
|
+
if (cached !== void 0) return cached;
|
|
40536
|
+
const inflight = inflightIndex.get(dir);
|
|
40537
|
+
if (inflight !== void 0) return inflight;
|
|
40538
|
+
const promise = (async () => {
|
|
40539
|
+
const index = new CodebaseIndex(dir);
|
|
40540
|
+
await index.index(4);
|
|
40541
|
+
putInCache(dir, index);
|
|
40542
|
+
return index;
|
|
40543
|
+
})().finally(() => {
|
|
40544
|
+
inflightIndex.delete(dir);
|
|
40545
|
+
});
|
|
40546
|
+
inflightIndex.set(dir, promise);
|
|
40547
|
+
return promise;
|
|
40499
40548
|
}
|
|
40500
40549
|
function resolveSearchDir(directory) {
|
|
40501
40550
|
const dir = resolve9(directory ?? process.cwd());
|
|
40502
40551
|
const cwdRoot = resolve9(".");
|
|
40503
|
-
if (!dir.startsWith(cwdRoot)) {
|
|
40552
|
+
if (dir !== cwdRoot && !dir.startsWith(cwdRoot + sep3)) {
|
|
40504
40553
|
return { error: `Path traversal denied: directory must be within ${cwdRoot}` };
|
|
40505
40554
|
}
|
|
40506
40555
|
return { dir };
|
|
@@ -40586,7 +40635,7 @@ function registerSearchCodebaseTool(server, deps) {
|
|
|
40586
40635
|
}
|
|
40587
40636
|
|
|
40588
40637
|
// src/mcp/tools/extract-symbols-tool.ts
|
|
40589
|
-
import { resolve as resolve10 } from "path";
|
|
40638
|
+
import { resolve as resolve10, sep as sep4 } from "path";
|
|
40590
40639
|
import { z as z83 } from "zod";
|
|
40591
40640
|
var ExtractSymbolsInputSchema = z83.object({
|
|
40592
40641
|
filePath: z83.string().min(1).max(500).describe("Path to TypeScript/JavaScript file to extract symbols from"),
|
|
@@ -40624,7 +40673,7 @@ async function extractSymbolsHandler(args, ctx) {
|
|
|
40624
40673
|
const { filePath, mode } = parsed.data;
|
|
40625
40674
|
const resolvedPath = resolve10(filePath);
|
|
40626
40675
|
const cwdRoot = resolve10(".");
|
|
40627
|
-
if (!resolvedPath.startsWith(cwdRoot)) {
|
|
40676
|
+
if (resolvedPath !== cwdRoot && !resolvedPath.startsWith(cwdRoot + sep4)) {
|
|
40628
40677
|
return toolStructuredError({
|
|
40629
40678
|
errorCategory: "permission",
|
|
40630
40679
|
message: `Path traversal denied: path must be within ${cwdRoot}`
|
|
@@ -40675,7 +40724,7 @@ function registerExtractSymbolsTool(server, deps) {
|
|
|
40675
40724
|
|
|
40676
40725
|
// src/mcp/tools/query-trace-tool.ts
|
|
40677
40726
|
import { readFile as readFile5, stat as stat3 } from "fs/promises";
|
|
40678
|
-
import { join as join8, resolve as resolve11, sep as
|
|
40727
|
+
import { join as join8, resolve as resolve11, sep as sep5 } from "path";
|
|
40679
40728
|
import { z as z84 } from "zod";
|
|
40680
40729
|
var QueryTraceInputSchema = z84.object({
|
|
40681
40730
|
runId: z84.string().min(1).max(128).regex(/^[a-zA-Z0-9_-]+$/, "runId must be alphanumeric, hyphens, or underscores").describe("Run ID to query traces for"),
|
|
@@ -40726,7 +40775,7 @@ async function queryTraceFromDisk(input, runsDir) {
|
|
|
40726
40775
|
const tracePath = join8(dir, input.runId, "trace.jsonl");
|
|
40727
40776
|
const resolvedDir = resolve11(dir);
|
|
40728
40777
|
const resolvedTrace = resolve11(tracePath);
|
|
40729
|
-
if (!resolvedTrace.startsWith(resolvedDir +
|
|
40778
|
+
if (!resolvedTrace.startsWith(resolvedDir + sep5) && resolvedTrace !== resolvedDir) {
|
|
40730
40779
|
return { runId: input.runId, ...EMPTY_RESPONSE };
|
|
40731
40780
|
}
|
|
40732
40781
|
try {
|
|
@@ -40940,6 +40989,12 @@ var AuditLogConfigSchema = z85.object({
|
|
|
40940
40989
|
enableHashChain: z85.boolean().optional().default(true),
|
|
40941
40990
|
enableCompression: z85.boolean().optional().default(false),
|
|
40942
40991
|
flushIntervalMs: z85.number().positive().optional().default(1e3),
|
|
40992
|
+
/**
|
|
40993
|
+
* Maximum in-memory event queue depth before drop-oldest backpressure
|
|
40994
|
+
* engages. Bounds memory under load when storage.write is slow or the flush
|
|
40995
|
+
* timer is overlapping; see #2979.
|
|
40996
|
+
*/
|
|
40997
|
+
maxQueueDepth: z85.number().positive().optional().default(1e4),
|
|
40943
40998
|
// Filtering
|
|
40944
40999
|
minSeverity: AuditSeveritySchema.optional().default("info"),
|
|
40945
41000
|
categories: z85.array(AuditCategorySchema).optional()
|
|
@@ -41270,10 +41325,10 @@ var FileAuditStorage = class _FileAuditStorage {
|
|
|
41270
41325
|
};
|
|
41271
41326
|
|
|
41272
41327
|
// src/audit/audit-logger.ts
|
|
41273
|
-
import * as
|
|
41328
|
+
import * as crypto from "crypto";
|
|
41274
41329
|
function generateEventId() {
|
|
41275
41330
|
const timestamp = getTimeProvider().now().toString(36);
|
|
41276
|
-
const random =
|
|
41331
|
+
const random = crypto.randomBytes(6).toString("hex");
|
|
41277
41332
|
return `aud_${timestamp}_${random}`;
|
|
41278
41333
|
}
|
|
41279
41334
|
function computeEventHash(event) {
|
|
@@ -41286,7 +41341,7 @@ function computeEventHash(event) {
|
|
|
41286
41341
|
actor: event.actor,
|
|
41287
41342
|
previousHash: event.previousHash
|
|
41288
41343
|
});
|
|
41289
|
-
return
|
|
41344
|
+
return crypto.createHash("sha256").update(data).digest("hex");
|
|
41290
41345
|
}
|
|
41291
41346
|
function verifyEvent(event, index, priorHash) {
|
|
41292
41347
|
if (event.hash === void 0) {
|
|
@@ -41337,17 +41392,21 @@ var SYSTEM_ACTOR = {
|
|
|
41337
41392
|
id: "nexus-agents",
|
|
41338
41393
|
name: "Nexus Agents System"
|
|
41339
41394
|
};
|
|
41395
|
+
var DROP_WARN_INTERVAL = 1e3;
|
|
41340
41396
|
var AuditLogger = class {
|
|
41341
41397
|
storage;
|
|
41342
41398
|
logger;
|
|
41343
41399
|
enableHashChain;
|
|
41344
41400
|
minSeverity;
|
|
41345
41401
|
categories;
|
|
41402
|
+
maxQueueDepth;
|
|
41346
41403
|
lastHash = null;
|
|
41347
41404
|
eventQueue = [];
|
|
41348
41405
|
flushTimer = null;
|
|
41349
41406
|
flushIntervalMs;
|
|
41350
41407
|
closed = false;
|
|
41408
|
+
inFlightFlush = null;
|
|
41409
|
+
droppedEventCount = 0;
|
|
41351
41410
|
constructor(config, storage, logger52) {
|
|
41352
41411
|
const validated = AuditLogConfigSchema.safeParse(config);
|
|
41353
41412
|
if (!validated.success) {
|
|
@@ -41359,13 +41418,14 @@ var AuditLogger = class {
|
|
|
41359
41418
|
this.minSeverity = validated.data.minSeverity;
|
|
41360
41419
|
this.categories = validated.data.categories;
|
|
41361
41420
|
this.flushIntervalMs = validated.data.flushIntervalMs;
|
|
41421
|
+
this.maxQueueDepth = validated.data.maxQueueDepth;
|
|
41362
41422
|
this.storage = storage ?? new FileAuditStorage(validated.data, this.logger);
|
|
41363
41423
|
this.startFlushTimer();
|
|
41364
41424
|
this.logger.info("AuditLogger initialized", { logDir: config.logDir });
|
|
41365
41425
|
}
|
|
41366
41426
|
startFlushTimer() {
|
|
41367
41427
|
this.flushTimer = setInterval(() => {
|
|
41368
|
-
this.
|
|
41428
|
+
this.flush().catch((err2) => {
|
|
41369
41429
|
this.logger.error("Audit flush failed", err2 instanceof Error ? err2 : void 0);
|
|
41370
41430
|
});
|
|
41371
41431
|
}, this.flushIntervalMs);
|
|
@@ -41417,6 +41477,19 @@ var AuditLogger = class {
|
|
|
41417
41477
|
if (!this.shouldLog(input)) return;
|
|
41418
41478
|
const event = this.createEvent(input);
|
|
41419
41479
|
this.eventQueue.push(event);
|
|
41480
|
+
if (this.eventQueue.length > this.maxQueueDepth) {
|
|
41481
|
+
const dropCount = this.eventQueue.length - this.maxQueueDepth;
|
|
41482
|
+
this.eventQueue.splice(0, dropCount);
|
|
41483
|
+
const priorDropped = this.droppedEventCount;
|
|
41484
|
+
this.droppedEventCount += dropCount;
|
|
41485
|
+
const crossedThreshold = Math.floor(this.droppedEventCount / DROP_WARN_INTERVAL) > Math.floor(priorDropped / DROP_WARN_INTERVAL);
|
|
41486
|
+
if (priorDropped === 0 || crossedThreshold) {
|
|
41487
|
+
this.logger.warn("Audit event queue full; dropping oldest events", {
|
|
41488
|
+
maxQueueDepth: this.maxQueueDepth,
|
|
41489
|
+
totalDropped: this.droppedEventCount
|
|
41490
|
+
});
|
|
41491
|
+
}
|
|
41492
|
+
}
|
|
41420
41493
|
this.logger.debug("Audit event queued", {
|
|
41421
41494
|
id: event.id,
|
|
41422
41495
|
category: event.category,
|
|
@@ -41504,16 +41577,30 @@ var AuditLogger = class {
|
|
|
41504
41577
|
metadata
|
|
41505
41578
|
});
|
|
41506
41579
|
}
|
|
41507
|
-
async
|
|
41508
|
-
if (this.eventQueue.length
|
|
41509
|
-
|
|
41510
|
-
|
|
41511
|
-
|
|
41580
|
+
async drainAndFlushOnce() {
|
|
41581
|
+
if (this.eventQueue.length > 0) {
|
|
41582
|
+
const events = this.eventQueue.splice(0, this.eventQueue.length);
|
|
41583
|
+
for (const event of events) {
|
|
41584
|
+
await this.storage.write(event);
|
|
41585
|
+
}
|
|
41512
41586
|
}
|
|
41587
|
+
await this.storage.flush();
|
|
41513
41588
|
}
|
|
41589
|
+
/**
|
|
41590
|
+
* Drain the in-memory queue to storage AND flush the storage's own buffer
|
|
41591
|
+
* to disk. Concurrent calls are coalesced into a single in-flight promise
|
|
41592
|
+
* so an overlapping flush-timer tick cannot spawn parallel drains (see
|
|
41593
|
+
* #2979). A caller arriving while a flush is already running awaits the
|
|
41594
|
+
* existing promise; their newly-queued events, if any, are picked up by
|
|
41595
|
+
* the next flush.
|
|
41596
|
+
*/
|
|
41514
41597
|
async flush() {
|
|
41515
|
-
|
|
41516
|
-
|
|
41598
|
+
if (this.inFlightFlush !== null) return this.inFlightFlush;
|
|
41599
|
+
const drain = this.drainAndFlushOnce().finally(() => {
|
|
41600
|
+
this.inFlightFlush = null;
|
|
41601
|
+
});
|
|
41602
|
+
this.inFlightFlush = drain;
|
|
41603
|
+
return drain;
|
|
41517
41604
|
}
|
|
41518
41605
|
async close() {
|
|
41519
41606
|
if (this.closed) return;
|
|
@@ -41916,7 +42003,7 @@ async function tryIssueTriage(task) {
|
|
|
41916
42003
|
try {
|
|
41917
42004
|
const issueMatch = task.match(/github\.com\/([^/]+\/[^/]+)\/issues\/(\d+)/);
|
|
41918
42005
|
if (issueMatch === null) return null;
|
|
41919
|
-
const { createIssueTriage } = await import("./issue-triage-
|
|
42006
|
+
const { createIssueTriage } = await import("./issue-triage-T3SKNBH5.js");
|
|
41920
42007
|
const triage = createIssueTriage();
|
|
41921
42008
|
const owner = issueMatch[1] ?? "";
|
|
41922
42009
|
const num = issueMatch[2] ?? "";
|
|
@@ -41944,7 +42031,7 @@ var VALID_TEMPLATES = /* @__PURE__ */ new Set([
|
|
|
41944
42031
|
]);
|
|
41945
42032
|
async function classifyWithLLM(task) {
|
|
41946
42033
|
try {
|
|
41947
|
-
const { executeExpert: executeExpert2 } = await import("./expert-bridge-
|
|
42034
|
+
const { executeExpert: executeExpert2 } = await import("./expert-bridge-DJM5GAWZ.js");
|
|
41948
42035
|
const prompt = [
|
|
41949
42036
|
"Classify this task into exactly one pipeline template.",
|
|
41950
42037
|
"Templates: dev (implementation/bug fix/refactor), research (investigate/evaluate/compare),",
|
|
@@ -42704,14 +42791,15 @@ function recordOutcome(args) {
|
|
|
42704
42791
|
return;
|
|
42705
42792
|
}
|
|
42706
42793
|
try {
|
|
42794
|
+
const nowMs = getTimeProvider().now();
|
|
42707
42795
|
getOutcomeStore().append({
|
|
42708
|
-
id: `pipeline-${args.taskId}-${String(
|
|
42796
|
+
id: `pipeline-${args.taskId}-${String(nowMs)}`,
|
|
42709
42797
|
cli: args.cli,
|
|
42710
42798
|
category: args.category,
|
|
42711
42799
|
model: "pipeline",
|
|
42712
42800
|
success: args.success,
|
|
42713
42801
|
durationMs: args.durationMs,
|
|
42714
|
-
timestamp:
|
|
42802
|
+
timestamp: new Date(nowMs).toISOString(),
|
|
42715
42803
|
source: "delegate",
|
|
42716
42804
|
routingStage: args.routingStage,
|
|
42717
42805
|
retryCount: args.retryCount
|
|
@@ -42725,10 +42813,10 @@ var memoryInitPromise = null;
|
|
|
42725
42813
|
async function initPipelineMemory() {
|
|
42726
42814
|
if (cachedMemory !== null) return cachedMemory;
|
|
42727
42815
|
try {
|
|
42728
|
-
const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-
|
|
42816
|
+
const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-MY6YS2VX.js");
|
|
42729
42817
|
const { getLearningDir } = await import("./learning-persistence-NX2KHL5T.js");
|
|
42730
42818
|
const mem = createSessionMemory2(getLearningDir());
|
|
42731
|
-
mem.startSession(`pipeline-${String(
|
|
42819
|
+
mem.startSession(`pipeline-${String(getTimeProvider().now())}`);
|
|
42732
42820
|
cachedMemory = {
|
|
42733
42821
|
recordLearning: (l) => {
|
|
42734
42822
|
try {
|
|
@@ -42772,6 +42860,7 @@ function flushPipelineMemory() {
|
|
|
42772
42860
|
void getPipelineMemoryAsync().then((m) => m?.flush());
|
|
42773
42861
|
}
|
|
42774
42862
|
var routingMemoryCache = null;
|
|
42863
|
+
var routingMemoryInitPromise = null;
|
|
42775
42864
|
function recordRoutingExperience(category, success, durationMs) {
|
|
42776
42865
|
const metrics = { durationMs, tokensUsed: 0 };
|
|
42777
42866
|
const callRecord = (rm) => {
|
|
@@ -42781,12 +42870,17 @@ function recordRoutingExperience(category, success, durationMs) {
|
|
|
42781
42870
|
callRecord(routingMemoryCache);
|
|
42782
42871
|
return;
|
|
42783
42872
|
}
|
|
42784
|
-
|
|
42785
|
-
routingMemoryCache
|
|
42786
|
-
|
|
42873
|
+
routingMemoryInitPromise ??= import("./routing-memory-AAH7NIHD.js").then(({ createRoutingMemory }) => {
|
|
42874
|
+
routingMemoryCache ??= createRoutingMemory();
|
|
42875
|
+
return routingMemoryCache;
|
|
42787
42876
|
}).catch((error) => {
|
|
42877
|
+
routingMemoryInitPromise = null;
|
|
42788
42878
|
const msg = error instanceof Error ? error.message : String(error);
|
|
42789
42879
|
logger38.debug("Routing memory init failed; continuing without it", { error: msg });
|
|
42880
|
+
return null;
|
|
42881
|
+
});
|
|
42882
|
+
void routingMemoryInitPromise.then((rm) => {
|
|
42883
|
+
if (rm !== null) callRecord(rm);
|
|
42790
42884
|
});
|
|
42791
42885
|
}
|
|
42792
42886
|
async function postProgress(config, stage, message) {
|
|
@@ -42810,7 +42904,7 @@ ${text}` : "";
|
|
|
42810
42904
|
}
|
|
42811
42905
|
async function getWeatherContext() {
|
|
42812
42906
|
try {
|
|
42813
|
-
const { generateWeatherReport: generateWeatherReport2 } = await import("./weather-report-
|
|
42907
|
+
const { generateWeatherReport: generateWeatherReport2 } = await import("./weather-report-O3Z3BBAX.js");
|
|
42814
42908
|
const report = generateWeatherReport2({ includeAdaptive: true });
|
|
42815
42909
|
const mappings = "recommendedMappings" in report ? report.recommendedMappings : [];
|
|
42816
42910
|
if (!Array.isArray(mappings) || mappings.length === 0) return "";
|
|
@@ -42828,7 +42922,7 @@ ${lines}
|
|
|
42828
42922
|
}
|
|
42829
42923
|
async function getMemoryContext(task) {
|
|
42830
42924
|
try {
|
|
42831
|
-
const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-
|
|
42925
|
+
const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-MY6YS2VX.js");
|
|
42832
42926
|
const { getLearningDir } = await import("./learning-persistence-NX2KHL5T.js");
|
|
42833
42927
|
const memory = createSessionMemory2(getLearningDir(), { maxLearningsInContext: 10 });
|
|
42834
42928
|
const learnings = memory.searchLearnings(task.slice(0, 200));
|
|
@@ -42934,7 +43028,7 @@ ${contextBlock}`;
|
|
|
42934
43028
|
const strategy = config.votingStrategy ?? "higher_order";
|
|
42935
43029
|
await postProgress(config, "Vote", `Running consensus with ${strategy} strategy...`);
|
|
42936
43030
|
try {
|
|
42937
|
-
const { executeVoting } = await import("./consensus-vote-
|
|
43031
|
+
const { executeVoting } = await import("./consensus-vote-KKAIFULI.js");
|
|
42938
43032
|
const votingResult = await executeVoting(
|
|
42939
43033
|
{
|
|
42940
43034
|
proposal: plan.slice(0, 4e3),
|
|
@@ -43131,6 +43225,7 @@ function extractIssues(text) {
|
|
|
43131
43225
|
// src/pipeline/pipeline-checkpoint.ts
|
|
43132
43226
|
import * as fs10 from "fs";
|
|
43133
43227
|
import * as path9 from "path";
|
|
43228
|
+
import { z as z90 } from "zod";
|
|
43134
43229
|
var logger39 = createLogger({ component: "pipeline-checkpoint" });
|
|
43135
43230
|
var SESSION_ID_REGEX = /^[a-zA-Z0-9_-]{1,128}$/;
|
|
43136
43231
|
function validateSessionId(sessionId) {
|
|
@@ -43178,14 +43273,65 @@ function loadCheckpointState(sessionId, customDir) {
|
|
|
43178
43273
|
return null;
|
|
43179
43274
|
}
|
|
43180
43275
|
}
|
|
43276
|
+
var PipelineStageSchema = z90.enum([
|
|
43277
|
+
"research",
|
|
43278
|
+
"plan",
|
|
43279
|
+
"vote",
|
|
43280
|
+
"decompose",
|
|
43281
|
+
"implement",
|
|
43282
|
+
"security"
|
|
43283
|
+
]);
|
|
43284
|
+
var PipelineStageDataSchema = z90.discriminatedUnion("type", [
|
|
43285
|
+
z90.object({ type: z90.literal("research"), text: z90.string() }),
|
|
43286
|
+
z90.object({ type: z90.literal("plan"), text: z90.string(), iterations: z90.number() }),
|
|
43287
|
+
z90.object({
|
|
43288
|
+
type: z90.literal("vote"),
|
|
43289
|
+
approved: z90.boolean(),
|
|
43290
|
+
conditional: z90.boolean(),
|
|
43291
|
+
conditions: z90.array(z90.string()).optional(),
|
|
43292
|
+
caveats: z90.array(z90.string()).optional(),
|
|
43293
|
+
iterations: z90.number()
|
|
43294
|
+
}),
|
|
43295
|
+
// PipelineTask shape is loose at the persistence layer — capture as
|
|
43296
|
+
// `z.unknown()` and trust the downstream consumer's narrower validation.
|
|
43297
|
+
z90.object({ type: z90.literal("decompose"), tasks: z90.array(z90.unknown()) }),
|
|
43298
|
+
z90.object({ type: z90.literal("implement"), tasks: z90.array(z90.unknown()) }),
|
|
43299
|
+
z90.object({ type: z90.literal("security"), passed: z90.boolean() })
|
|
43300
|
+
]);
|
|
43301
|
+
var PipelineCheckpointEntrySchema = z90.object({
|
|
43302
|
+
sessionId: z90.string(),
|
|
43303
|
+
stage: PipelineStageSchema,
|
|
43304
|
+
timestamp: z90.string(),
|
|
43305
|
+
data: PipelineStageDataSchema
|
|
43306
|
+
});
|
|
43181
43307
|
function rebuildState(lines) {
|
|
43182
43308
|
const state = {};
|
|
43309
|
+
let skippedCount = 0;
|
|
43310
|
+
let firstSkipReason;
|
|
43183
43311
|
for (const line of lines) {
|
|
43312
|
+
let parsed;
|
|
43184
43313
|
try {
|
|
43185
|
-
|
|
43186
|
-
|
|
43187
|
-
|
|
43314
|
+
parsed = JSON.parse(line);
|
|
43315
|
+
} catch (error) {
|
|
43316
|
+
skippedCount++;
|
|
43317
|
+
firstSkipReason ??= `JSON.parse failed: ${error instanceof Error ? error.message : String(error)}`;
|
|
43318
|
+
continue;
|
|
43188
43319
|
}
|
|
43320
|
+
const result = PipelineCheckpointEntrySchema.safeParse(parsed);
|
|
43321
|
+
if (!result.success) {
|
|
43322
|
+
skippedCount++;
|
|
43323
|
+
firstSkipReason ??= `schema validation failed: ${result.error.message}`;
|
|
43324
|
+
continue;
|
|
43325
|
+
}
|
|
43326
|
+
applyEntry(state, result.data);
|
|
43327
|
+
}
|
|
43328
|
+
if (skippedCount > 0) {
|
|
43329
|
+
logger39.warn("Skipped malformed checkpoint lines during state rebuild", {
|
|
43330
|
+
skippedCount,
|
|
43331
|
+
totalLines: lines.length,
|
|
43332
|
+
firstSkipReason,
|
|
43333
|
+
recovered: state.lastCompletedStage
|
|
43334
|
+
});
|
|
43189
43335
|
}
|
|
43190
43336
|
return state;
|
|
43191
43337
|
}
|
|
@@ -43356,7 +43502,9 @@ function reinforcePlanBeliefs(bm, task, iterations) {
|
|
|
43356
43502
|
function applyPipelineHindsight(bm, task, sessionId, result) {
|
|
43357
43503
|
if (bm === void 0) return;
|
|
43358
43504
|
const record = {
|
|
43359
|
-
|
|
43505
|
+
// #2961: hindsightId is the persisted belief-store key — must go
|
|
43506
|
+
// through the time provider so replay/snapshot tests reproduce.
|
|
43507
|
+
hindsightId: `pipeline-${sessionId ?? "ephemeral"}-${getTimeProvider().now().toString(36)}`,
|
|
43360
43508
|
taskId: sessionId ?? task.slice(0, 40),
|
|
43361
43509
|
priorBeliefs: [],
|
|
43362
43510
|
expectedOutcome: "Pipeline completes with all gates passed",
|
|
@@ -43828,7 +43976,7 @@ async function extractSymbolsForTask(task) {
|
|
|
43828
43976
|
}
|
|
43829
43977
|
async function queryResearchRegistry(task) {
|
|
43830
43978
|
try {
|
|
43831
|
-
const { synthesizeResearch: synthesizeResearch2 } = await import("./research-helpers-synthesize-
|
|
43979
|
+
const { synthesizeResearch: synthesizeResearch2 } = await import("./research-helpers-synthesize-Y3O76PY4.js");
|
|
43832
43980
|
const topic = task.split(/[.!?\n]/).filter((s) => s.trim().length > 10)[0]?.trim();
|
|
43833
43981
|
if (topic === void 0) return null;
|
|
43834
43982
|
const result = await synthesizeResearch2(topic.slice(0, 50));
|
|
@@ -43913,7 +44061,7 @@ function createScanStageWrapper() {
|
|
|
43913
44061
|
try {
|
|
43914
44062
|
const slug = ctx.task.match(/([a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+)/)?.[1];
|
|
43915
44063
|
if (slug !== void 0) {
|
|
43916
|
-
const { generateSecurityPlan: generateSecurityPlan2 } = await import("./repo-security-plan-
|
|
44064
|
+
const { generateSecurityPlan: generateSecurityPlan2 } = await import("./repo-security-plan-V257RYTW.js");
|
|
43917
44065
|
const plan = await generateSecurityPlan2({ repo: slug, maxScanners: 10 });
|
|
43918
44066
|
const recs = plan.recommendations.slice(0, 5).map((r) => `${r.priority}: ${r.displayName} (${r.category})`).join("; ");
|
|
43919
44067
|
ctx.sharedMemory.write("scan", "decision", { recommendations: recs });
|
|
@@ -43954,7 +44102,7 @@ function createAuditStageRegistry() {
|
|
|
43954
44102
|
}
|
|
43955
44103
|
|
|
43956
44104
|
// src/mcp/tools/pr-review-tool.ts
|
|
43957
|
-
import { z as
|
|
44105
|
+
import { z as z91 } from "zod";
|
|
43958
44106
|
|
|
43959
44107
|
// src/mcp/tools/pr-review-findings.ts
|
|
43960
44108
|
import { parse as parseYaml3 } from "yaml";
|
|
@@ -44046,14 +44194,14 @@ var PR_REVIEW_ROLES = [
|
|
|
44046
44194
|
];
|
|
44047
44195
|
var MAX_DIFF_LENGTH = 5e4;
|
|
44048
44196
|
var MAX_DESCRIPTION_LENGTH = 1e4;
|
|
44049
|
-
var PrReviewInputSchema =
|
|
44050
|
-
prTitle:
|
|
44051
|
-
prDescription:
|
|
44052
|
-
prDiff:
|
|
44053
|
-
repoContext:
|
|
44054
|
-
baseRef:
|
|
44055
|
-
headRef:
|
|
44056
|
-
simulate:
|
|
44197
|
+
var PrReviewInputSchema = z91.object({
|
|
44198
|
+
prTitle: z91.string().min(1).max(500).describe("PR title"),
|
|
44199
|
+
prDescription: z91.string().max(MAX_DESCRIPTION_LENGTH).optional().describe("PR body / description"),
|
|
44200
|
+
prDiff: z91.string().min(1).max(MAX_DIFF_LENGTH).describe(`Unified diff text (max ${String(MAX_DIFF_LENGTH)} chars; truncate before calling)`),
|
|
44201
|
+
repoContext: z91.string().max(2e3).optional().describe("Optional one-paragraph repo context (architecture, conventions)"),
|
|
44202
|
+
baseRef: z91.string().max(200).optional().describe("Base branch ref (e.g. main)"),
|
|
44203
|
+
headRef: z91.string().max(200).optional().describe("Head branch ref"),
|
|
44204
|
+
simulate: z91.boolean().default(false).describe("Use simulated voters (testing only; never ship live with this true)")
|
|
44057
44205
|
});
|
|
44058
44206
|
function mapVoteDecisionToPrDecision(voteDecision) {
|
|
44059
44207
|
if (voteDecision === "reject") return "request_changes";
|
|
@@ -44219,27 +44367,27 @@ function registerPrReviewTool(server, deps) {
|
|
|
44219
44367
|
}
|
|
44220
44368
|
|
|
44221
44369
|
// src/mcp/tools/survey-oss-landscape.ts
|
|
44222
|
-
import { z as
|
|
44223
|
-
var SurveyOssLandscapeInputSchema =
|
|
44224
|
-
query:
|
|
44225
|
-
maxResults:
|
|
44226
|
-
minStars:
|
|
44227
|
-
language:
|
|
44370
|
+
import { z as z92 } from "zod";
|
|
44371
|
+
var SurveyOssLandscapeInputSchema = z92.object({
|
|
44372
|
+
query: z92.string().min(1).max(200).describe('Free-text search query, e.g. "cargo nextest replacement" or "OSS SBOM tools"'),
|
|
44373
|
+
maxResults: z92.number().int().min(1).max(50).optional().default(10).describe("Maximum candidates to return (1-50; default 10)"),
|
|
44374
|
+
minStars: z92.number().int().min(0).optional().default(0).describe("Minimum star count to include (default 0; useful for filtering noise)"),
|
|
44375
|
+
language: z92.string().max(50).optional().describe('GitHub language filter, e.g. "rust" or "typescript"')
|
|
44228
44376
|
});
|
|
44229
|
-
var GitHubRepoSchema2 =
|
|
44230
|
-
full_name:
|
|
44231
|
-
html_url:
|
|
44232
|
-
description:
|
|
44233
|
-
stargazers_count:
|
|
44234
|
-
pushed_at:
|
|
44235
|
-
language:
|
|
44236
|
-
license:
|
|
44237
|
-
spdx_id:
|
|
44377
|
+
var GitHubRepoSchema2 = z92.object({
|
|
44378
|
+
full_name: z92.string().optional(),
|
|
44379
|
+
html_url: z92.string().optional(),
|
|
44380
|
+
description: z92.string().nullable().optional(),
|
|
44381
|
+
stargazers_count: z92.number().optional(),
|
|
44382
|
+
pushed_at: z92.string().nullable().optional(),
|
|
44383
|
+
language: z92.string().nullable().optional(),
|
|
44384
|
+
license: z92.object({
|
|
44385
|
+
spdx_id: z92.string().nullable().optional()
|
|
44238
44386
|
}).nullable().optional()
|
|
44239
44387
|
});
|
|
44240
|
-
var GitHubSearchResponseSchema2 =
|
|
44241
|
-
total_count:
|
|
44242
|
-
items:
|
|
44388
|
+
var GitHubSearchResponseSchema2 = z92.object({
|
|
44389
|
+
total_count: z92.number().optional(),
|
|
44390
|
+
items: z92.array(GitHubRepoSchema2).optional()
|
|
44243
44391
|
});
|
|
44244
44392
|
var GITHUB_SEARCH_BASE = "https://api.github.com/search/repositories";
|
|
44245
44393
|
function buildGithubQuery(input) {
|
|
@@ -44366,11 +44514,11 @@ function createSurveyHandler(deps) {
|
|
|
44366
44514
|
};
|
|
44367
44515
|
}
|
|
44368
44516
|
var SURVEY_OUTPUT_SCHEMA = {
|
|
44369
|
-
query:
|
|
44370
|
-
totalFound:
|
|
44371
|
-
candidates:
|
|
44372
|
-
sourcesQueried:
|
|
44373
|
-
sourcesFailed:
|
|
44517
|
+
query: z92.string(),
|
|
44518
|
+
totalFound: z92.number(),
|
|
44519
|
+
candidates: z92.array(z92.unknown()),
|
|
44520
|
+
sourcesQueried: z92.array(z92.string()),
|
|
44521
|
+
sourcesFailed: z92.array(z92.string())
|
|
44374
44522
|
};
|
|
44375
44523
|
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?".';
|
|
44376
44524
|
function registerSurveyOssLandscapeTool(server, deps) {
|
|
@@ -44399,7 +44547,7 @@ function registerSurveyOssLandscapeTool(server, deps) {
|
|
|
44399
44547
|
}
|
|
44400
44548
|
|
|
44401
44549
|
// src/mcp/tools/vendor-publishing-audit.ts
|
|
44402
|
-
import { z as
|
|
44550
|
+
import { z as z93 } from "zod";
|
|
44403
44551
|
|
|
44404
44552
|
// src/mcp/tools/vendor-publishing-seed.ts
|
|
44405
44553
|
var VENDOR_PUBLISHING_SEED = {
|
|
@@ -44472,8 +44620,8 @@ function listKnownVendors() {
|
|
|
44472
44620
|
}
|
|
44473
44621
|
|
|
44474
44622
|
// src/mcp/tools/vendor-publishing-audit.ts
|
|
44475
|
-
var VendorPublishingAuditInputSchema =
|
|
44476
|
-
vendor:
|
|
44623
|
+
var VendorPublishingAuditInputSchema = z93.object({
|
|
44624
|
+
vendor: z93.string().min(1).max(50).toLowerCase().describe('Vendor identifier, lowercase. e.g. "ubuntu", "debian", "fedora"')
|
|
44477
44625
|
});
|
|
44478
44626
|
function lookupVendor(vendor) {
|
|
44479
44627
|
if (isKnownVendor(vendor)) {
|
|
@@ -44505,20 +44653,20 @@ function createVendorPublishingAuditHandler(deps) {
|
|
|
44505
44653
|
};
|
|
44506
44654
|
}
|
|
44507
44655
|
var VENDOR_PUBLISHING_OUTPUT_SCHEMA = {
|
|
44508
|
-
vendor:
|
|
44509
|
-
known:
|
|
44656
|
+
vendor: z93.string(),
|
|
44657
|
+
known: z93.boolean(),
|
|
44510
44658
|
// Fields below populate when known=true; permissive optional for known=false.
|
|
44511
|
-
sha256SumsUrlPattern:
|
|
44512
|
-
sha256SumsSignatureUrlPattern:
|
|
44513
|
-
signaturePattern:
|
|
44514
|
-
gpgKeys:
|
|
44515
|
-
releaseCadence:
|
|
44516
|
-
keyRotationNotes:
|
|
44517
|
-
vendorDocUrl:
|
|
44518
|
-
citedAt:
|
|
44659
|
+
sha256SumsUrlPattern: z93.string().optional(),
|
|
44660
|
+
sha256SumsSignatureUrlPattern: z93.string().optional(),
|
|
44661
|
+
signaturePattern: z93.string().optional(),
|
|
44662
|
+
gpgKeys: z93.array(z93.unknown()).optional(),
|
|
44663
|
+
releaseCadence: z93.string().optional(),
|
|
44664
|
+
keyRotationNotes: z93.string().optional(),
|
|
44665
|
+
vendorDocUrl: z93.string().optional(),
|
|
44666
|
+
citedAt: z93.string().optional(),
|
|
44519
44667
|
// Fields below populate when known=false.
|
|
44520
|
-
message:
|
|
44521
|
-
knownVendors:
|
|
44668
|
+
message: z93.string().optional(),
|
|
44669
|
+
knownVendors: z93.array(z93.string()).optional()
|
|
44522
44670
|
};
|
|
44523
44671
|
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.";
|
|
44524
44672
|
function registerVendorPublishingAuditTool(server, deps) {
|
|
@@ -44547,17 +44695,17 @@ function registerVendorPublishingAuditTool(server, deps) {
|
|
|
44547
44695
|
}
|
|
44548
44696
|
|
|
44549
44697
|
// src/mcp/tools/compare-data-feeds.ts
|
|
44550
|
-
import { z as
|
|
44698
|
+
import { z as z94 } from "zod";
|
|
44551
44699
|
import * as path10 from "path";
|
|
44552
44700
|
import * as fs11 from "fs";
|
|
44553
44701
|
import * as yaml3 from "yaml";
|
|
44554
|
-
var CompareDataFeedsInputSchema =
|
|
44555
|
-
feedAPath:
|
|
44556
|
-
feedBPath:
|
|
44557
|
-
keyPath:
|
|
44702
|
+
var CompareDataFeedsInputSchema = z94.object({
|
|
44703
|
+
feedAPath: z94.string().min(1).max(1e3).describe("Filesystem path to feed A (YAML or JSON, auto-detected by extension)"),
|
|
44704
|
+
feedBPath: z94.string().min(1).max(1e3).describe("Filesystem path to feed B"),
|
|
44705
|
+
keyPath: z94.string().min(1).max(200).describe(
|
|
44558
44706
|
'Dotted path to the entry key, e.g. "id" or "name". Each entry must have this field.'
|
|
44559
44707
|
),
|
|
44560
|
-
compareFields:
|
|
44708
|
+
compareFields: z94.array(z94.string().min(1).max(200)).max(20).optional().describe(
|
|
44561
44709
|
'Optional dotted field paths to compare across matched entries (e.g. ["license", "sha256"])'
|
|
44562
44710
|
)
|
|
44563
44711
|
});
|
|
@@ -44681,7 +44829,7 @@ function buildSummary(feedAPath, feedBPath, diff, fieldDiffs, fields) {
|
|
|
44681
44829
|
function loadFeed(feedPath) {
|
|
44682
44830
|
const resolved = path10.resolve(feedPath);
|
|
44683
44831
|
const cwdRoot = path10.resolve(".");
|
|
44684
|
-
if (!resolved.startsWith(cwdRoot)) {
|
|
44832
|
+
if (resolved !== cwdRoot && !resolved.startsWith(cwdRoot + path10.sep)) {
|
|
44685
44833
|
throw new Error(`Path traversal denied: ${feedPath} must be within ${cwdRoot}`);
|
|
44686
44834
|
}
|
|
44687
44835
|
if (!fs11.existsSync(resolved)) {
|
|
@@ -44741,24 +44889,24 @@ function createCompareDataFeedsHandler(deps) {
|
|
|
44741
44889
|
};
|
|
44742
44890
|
}
|
|
44743
44891
|
var COMPARE_OUTPUT_SCHEMA = {
|
|
44744
|
-
feedAPath:
|
|
44745
|
-
feedBPath:
|
|
44746
|
-
keyPath:
|
|
44747
|
-
counts:
|
|
44748
|
-
entriesInA:
|
|
44749
|
-
entriesInB:
|
|
44750
|
-
onlyInA:
|
|
44751
|
-
onlyInB:
|
|
44752
|
-
inBoth:
|
|
44753
|
-
fieldDifferences:
|
|
44892
|
+
feedAPath: z94.string(),
|
|
44893
|
+
feedBPath: z94.string(),
|
|
44894
|
+
keyPath: z94.string(),
|
|
44895
|
+
counts: z94.object({
|
|
44896
|
+
entriesInA: z94.number(),
|
|
44897
|
+
entriesInB: z94.number(),
|
|
44898
|
+
onlyInA: z94.number(),
|
|
44899
|
+
onlyInB: z94.number(),
|
|
44900
|
+
inBoth: z94.number(),
|
|
44901
|
+
fieldDifferences: z94.number()
|
|
44754
44902
|
}),
|
|
44755
|
-
coverage:
|
|
44756
|
-
onlyInA:
|
|
44757
|
-
onlyInB:
|
|
44758
|
-
inBoth:
|
|
44903
|
+
coverage: z94.object({
|
|
44904
|
+
onlyInA: z94.array(z94.string()),
|
|
44905
|
+
onlyInB: z94.array(z94.string()),
|
|
44906
|
+
inBoth: z94.array(z94.string())
|
|
44759
44907
|
}),
|
|
44760
|
-
fieldDifferences:
|
|
44761
|
-
summary:
|
|
44908
|
+
fieldDifferences: z94.array(z94.unknown()),
|
|
44909
|
+
summary: z94.string()
|
|
44762
44910
|
};
|
|
44763
44911
|
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.";
|
|
44764
44912
|
function registerCompareDataFeedsTool(server, deps) {
|
|
@@ -44789,7 +44937,7 @@ function registerCompareDataFeedsTool(server, deps) {
|
|
|
44789
44937
|
// src/mcp/tools/improvement-review.ts
|
|
44790
44938
|
import { execFile as execFile3 } from "child_process";
|
|
44791
44939
|
import { promisify as promisify3 } from "util";
|
|
44792
|
-
import { z as
|
|
44940
|
+
import { z as z95 } from "zod";
|
|
44793
44941
|
|
|
44794
44942
|
// src/governance/fitness-score.ts
|
|
44795
44943
|
import { existsSync as existsSync11, readFileSync as readFileSync9, readdirSync as readdirSync2, statSync as statSync2 } from "fs";
|
|
@@ -45366,13 +45514,13 @@ function calculateFitnessScore(version) {
|
|
|
45366
45514
|
|
|
45367
45515
|
// src/mcp/tools/improvement-review.ts
|
|
45368
45516
|
var execFileAsync3 = promisify3(execFile3);
|
|
45369
|
-
var ImprovementReviewInputSchema =
|
|
45370
|
-
lookbackDays:
|
|
45371
|
-
fileIssues:
|
|
45517
|
+
var ImprovementReviewInputSchema = z95.object({
|
|
45518
|
+
lookbackDays: z95.number().int().min(1).max(90).optional().default(7).describe("Lookback window for outcome data, in days. Default 7."),
|
|
45519
|
+
fileIssues: z95.boolean().optional().default(false).describe(
|
|
45372
45520
|
"When true, file candidate issues via `gh issue create` for crossed thresholds (rate-limited to 5 per run, deduped against open issues). When false (default), return signals only."
|
|
45373
45521
|
),
|
|
45374
|
-
minSampleSize:
|
|
45375
|
-
fitnessFloor:
|
|
45522
|
+
minSampleSize: z95.number().int().min(1).max(1e3).optional().default(5).describe("Minimum sample size before a CLI/category signal can fire."),
|
|
45523
|
+
fitnessFloor: z95.number().int().min(0).max(100).optional().default(90).describe("Fitness score below this threshold triggers a tech-debt signal.")
|
|
45376
45524
|
});
|
|
45377
45525
|
var MAX_ISSUES_PER_RUN = 5;
|
|
45378
45526
|
var HOUR_MS = 60 * 60 * 1e3;
|
|
@@ -45640,12 +45788,12 @@ async function reviewHandler(args, ctx) {
|
|
|
45640
45788
|
}
|
|
45641
45789
|
var description = "Periodic threshold-gated observability-driven improvement loop. Reads OutcomeStore + fitness audit, surfaces patterns crossing documented thresholds as candidate findings. When fileIssues=true, files candidate GitHub issues via `gh issue create` (rate-limited to 5 per run, deduped against open issues). Never auto-merges. Replaces the deleted self-development engine (#2402).";
|
|
45642
45790
|
var TOOL_INPUT_SCHEMA = {
|
|
45643
|
-
lookbackDays:
|
|
45644
|
-
fileIssues:
|
|
45791
|
+
lookbackDays: z95.number().int().min(1).max(90).optional().describe("Lookback window for outcome data, in days. Default 7."),
|
|
45792
|
+
fileIssues: z95.boolean().optional().describe(
|
|
45645
45793
|
"When true, file candidate issues for crossed thresholds (default false \u2014 return signals only)"
|
|
45646
45794
|
),
|
|
45647
|
-
minSampleSize:
|
|
45648
|
-
fitnessFloor:
|
|
45795
|
+
minSampleSize: z95.number().int().min(1).max(1e3).optional().describe("Minimum sample size before a CLI/category signal fires (default 5)."),
|
|
45796
|
+
fitnessFloor: z95.number().int().min(0).max(100).optional().describe("Fitness score below this threshold triggers a tech-debt signal (default 90).")
|
|
45649
45797
|
};
|
|
45650
45798
|
function registerImprovementReviewTool(server, deps) {
|
|
45651
45799
|
const logger52 = deps.logger ?? createLogger({ tool: "improvement_review" });
|
|
@@ -45673,9 +45821,9 @@ function registerImprovementReviewTool(server, deps) {
|
|
|
45673
45821
|
}
|
|
45674
45822
|
|
|
45675
45823
|
// src/mcp/tools/query-task-state-tool.ts
|
|
45676
|
-
import { z as
|
|
45677
|
-
var QueryTaskStateInputSchema =
|
|
45678
|
-
taskId:
|
|
45824
|
+
import { z as z96 } from "zod";
|
|
45825
|
+
var QueryTaskStateInputSchema = z96.object({
|
|
45826
|
+
taskId: z96.string().min(1).max(128).describe("Task ID whose structured state log should be read")
|
|
45679
45827
|
});
|
|
45680
45828
|
function queryTaskStateHandler(args, ctx) {
|
|
45681
45829
|
const parsed = QueryTaskStateInputSchema.safeParse(args);
|
|
@@ -45710,7 +45858,7 @@ function queryTaskStateHandler(args, ctx) {
|
|
|
45710
45858
|
function registerQueryTaskStateTool(server, deps) {
|
|
45711
45859
|
const logger52 = deps.logger ?? createLogger({ tool: "query_task_state" });
|
|
45712
45860
|
const toolSchema = {
|
|
45713
|
-
taskId:
|
|
45861
|
+
taskId: z96.string().min(1).max(128).describe("Task ID whose structured state log should be read")
|
|
45714
45862
|
};
|
|
45715
45863
|
const description2 = "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.";
|
|
45716
45864
|
const secureHandler = createSecureHandler(queryTaskStateHandler, {
|
|
@@ -45734,9 +45882,9 @@ function registerQueryTaskStateTool(server, deps) {
|
|
|
45734
45882
|
// src/mcp/tools/verify-audit-chain-tool.ts
|
|
45735
45883
|
import * as fs12 from "fs/promises";
|
|
45736
45884
|
import * as path11 from "path";
|
|
45737
|
-
import { z as
|
|
45738
|
-
var VerifyAuditChainInputSchema =
|
|
45739
|
-
logDir:
|
|
45885
|
+
import { z as z97 } from "zod";
|
|
45886
|
+
var VerifyAuditChainInputSchema = z97.object({
|
|
45887
|
+
logDir: z97.string().min(1).max(512).describe(
|
|
45740
45888
|
"Filesystem path to the FileAuditStorage log directory. Tool reads all `audit-*.jsonl` files in lexicographic order and verifies the combined chain."
|
|
45741
45889
|
)
|
|
45742
45890
|
});
|
|
@@ -45813,7 +45961,7 @@ async function handler2(args, ctx) {
|
|
|
45813
45961
|
function registerVerifyAuditChainTool(server, deps) {
|
|
45814
45962
|
const logger52 = deps.logger ?? createLogger({ tool: "verify_audit_chain" });
|
|
45815
45963
|
const toolSchema = {
|
|
45816
|
-
logDir:
|
|
45964
|
+
logDir: z97.string().min(1).max(512).describe(
|
|
45817
45965
|
"Filesystem path to the FileAuditStorage log directory. Tool reads all `audit-*.jsonl` files and verifies the combined hash chain."
|
|
45818
45966
|
)
|
|
45819
45967
|
};
|
|
@@ -45837,18 +45985,18 @@ function registerVerifyAuditChainTool(server, deps) {
|
|
|
45837
45985
|
}
|
|
45838
45986
|
|
|
45839
45987
|
// src/mcp/tools/pipeline-tool.ts
|
|
45840
|
-
import { z as
|
|
45988
|
+
import { z as z98 } from "zod";
|
|
45841
45989
|
import * as fs13 from "fs";
|
|
45842
45990
|
import * as path12 from "path";
|
|
45843
|
-
var PipelineInputSchema =
|
|
45991
|
+
var PipelineInputSchema = z98.object({
|
|
45844
45992
|
/** The task to execute. */
|
|
45845
|
-
task:
|
|
45993
|
+
task: z98.string().min(5).max(1e4).describe("Task description \u2014 pipeline template auto-selected based on content"),
|
|
45846
45994
|
/** Path to a spec file (.md, .yaml) to use as task input. */
|
|
45847
|
-
specFile:
|
|
45995
|
+
specFile: z98.string().max(500).optional().describe("Path to a spec file \u2014 content prepended to task for greenfield projects"),
|
|
45848
45996
|
/** Override template — see `listTemplateIds()` for the canonical list (#2728). Auto-detected if omitted. */
|
|
45849
|
-
template:
|
|
45997
|
+
template: z98.string().max(50).optional().describe(`Pipeline template override. Available: ${listTemplateIds().join(", ")}`),
|
|
45850
45998
|
/** Voting strategy for consensus stages. */
|
|
45851
|
-
votingStrategy:
|
|
45999
|
+
votingStrategy: z98.enum([
|
|
45852
46000
|
"simple_majority",
|
|
45853
46001
|
"supermajority",
|
|
45854
46002
|
"unanimous",
|
|
@@ -45859,13 +46007,13 @@ var PipelineInputSchema = z97.object({
|
|
|
45859
46007
|
"Voting strategy for plan approval. simple_majority (default), supermajority (67%), unanimous, higher_order (Bayesian), proof_of_learning, opinion_wise"
|
|
45860
46008
|
),
|
|
45861
46009
|
/** Use 3 agents instead of 6 for faster voting. */
|
|
45862
|
-
quickMode:
|
|
46010
|
+
quickMode: z98.boolean().default(false).describe("Use 3 agents instead of 6 for faster consensus voting"),
|
|
45863
46011
|
/** Maximum execution time per stage in milliseconds (min 30s, max 600s). */
|
|
45864
|
-
timeoutMs:
|
|
46012
|
+
timeoutMs: z98.number().int().min(3e4).max(6e5).optional().describe("Max time per stage in ms (30000-600000). Default: varies by stage complexity"),
|
|
45865
46013
|
/** Stop after planning/voting (no implementation). */
|
|
45866
|
-
dryRun:
|
|
46014
|
+
dryRun: z98.boolean().default(false).describe("Stop after vote stage (no implementation)"),
|
|
45867
46015
|
/** TESTS ONLY — random output, must not be used for real decisions. (#2319) */
|
|
45868
|
-
simulateVotes:
|
|
46016
|
+
simulateVotes: z98.boolean().default(false).describe("TESTS ONLY \u2014 random output, must not be used for real decisions (#2319)")
|
|
45869
46017
|
});
|
|
45870
46018
|
function buildOutput2(result) {
|
|
45871
46019
|
return {
|
|
@@ -45884,7 +46032,7 @@ async function resolveTask(task, specFile) {
|
|
|
45884
46032
|
if (specFile === void 0) return task;
|
|
45885
46033
|
const resolved = path12.resolve(specFile);
|
|
45886
46034
|
const cwdRoot = path12.resolve(".");
|
|
45887
|
-
if (!resolved.startsWith(cwdRoot)) {
|
|
46035
|
+
if (resolved !== cwdRoot && !resolved.startsWith(cwdRoot + path12.sep)) {
|
|
45888
46036
|
throw new Error(`Path traversal denied: specFile must be within ${cwdRoot}`);
|
|
45889
46037
|
}
|
|
45890
46038
|
try {
|
|
@@ -45967,7 +46115,7 @@ function registerPipelineTool(server, deps) {
|
|
|
45967
46115
|
}
|
|
45968
46116
|
|
|
45969
46117
|
// src/mcp/tools/supply-chain-tradeoff-panel.ts
|
|
45970
|
-
import { z as
|
|
46118
|
+
import { z as z99 } from "zod";
|
|
45971
46119
|
var DEFAULT_AXES = [
|
|
45972
46120
|
"build_time_determinism",
|
|
45973
46121
|
"supply_chain_risk",
|
|
@@ -45977,17 +46125,270 @@ var MAX_AXES = 6;
|
|
|
45977
46125
|
var MAX_AXIS_NAME_LENGTH = 64;
|
|
45978
46126
|
var MAX_PROPOSAL_LENGTH = 4e3;
|
|
45979
46127
|
var MAX_CONTEXT_LENGTH = 4e3;
|
|
45980
|
-
var
|
|
45981
|
-
|
|
45982
|
-
|
|
46128
|
+
var FULL_PANEL = [
|
|
46129
|
+
"architect",
|
|
46130
|
+
"security",
|
|
46131
|
+
"devex",
|
|
46132
|
+
"ai_ml",
|
|
46133
|
+
"pm",
|
|
46134
|
+
"catfish",
|
|
46135
|
+
"scope_steward"
|
|
46136
|
+
];
|
|
46137
|
+
var QUICK_PANEL = ["architect", "security", "scope_steward"];
|
|
46138
|
+
var SupplyChainTradeoffPanelInputSchema = z99.object({
|
|
46139
|
+
proposal: z99.string().min(1).max(MAX_PROPOSAL_LENGTH).describe('The proposal under tradeoff review (e.g. "Should aegis-boot adopt cargo-nextest?")'),
|
|
46140
|
+
axes: z99.array(z99.string().min(1).max(MAX_AXIS_NAME_LENGTH)).min(1).max(MAX_AXES).optional().describe(
|
|
45983
46141
|
`Tradeoff axes to evaluate. Default: ${DEFAULT_AXES.join(", ")}. Custom axes accepted; max ${String(MAX_AXES)}.`
|
|
45984
46142
|
),
|
|
45985
|
-
context:
|
|
46143
|
+
context: z99.string().max(MAX_CONTEXT_LENGTH).optional().describe(
|
|
45986
46144
|
"Optional context: relevant repo state, dependency tree, vendor publishing patterns, etc."
|
|
45987
46145
|
),
|
|
45988
|
-
quickMode:
|
|
45989
|
-
simulate:
|
|
46146
|
+
quickMode: z99.boolean().optional().default(false).describe("Use 3 voters (architect, security, scope_steward) instead of 7"),
|
|
46147
|
+
simulate: z99.boolean().optional().default(false).describe("Use simulated voters (testing only)")
|
|
45990
46148
|
});
|
|
46149
|
+
function buildTradeoffProposal(input) {
|
|
46150
|
+
const axes = input.axes ?? DEFAULT_AXES;
|
|
46151
|
+
const parts = [];
|
|
46152
|
+
parts.push(`# Supply-Chain Tradeoff Review
|
|
46153
|
+
|
|
46154
|
+
`);
|
|
46155
|
+
parts.push(`**Proposal:** ${input.proposal}
|
|
46156
|
+
`);
|
|
46157
|
+
if (input.context !== void 0 && input.context !== "") {
|
|
46158
|
+
parts.push(`
|
|
46159
|
+
**Context:**
|
|
46160
|
+
${input.context}
|
|
46161
|
+
`);
|
|
46162
|
+
}
|
|
46163
|
+
parts.push(`
|
|
46164
|
+
## Axes
|
|
46165
|
+
|
|
46166
|
+
Evaluate the proposal along EACH of these axes independently:
|
|
46167
|
+
`);
|
|
46168
|
+
for (const axis of axes) parts.push(`- \`${axis}\`
|
|
46169
|
+
`);
|
|
46170
|
+
parts.push(`
|
|
46171
|
+
## Your task
|
|
46172
|
+
|
|
46173
|
+
`);
|
|
46174
|
+
parts.push(
|
|
46175
|
+
`For each axis, decide approve / reject / abstain with a one-line reason. It is normal \u2014 and expected \u2014 for the verdict to differ across axes (a proposal can be a win on update cadence and a loss on supply-chain risk).
|
|
46176
|
+
|
|
46177
|
+
`
|
|
46178
|
+
);
|
|
46179
|
+
parts.push(`After your reasoning, emit a JSON block with this exact shape:
|
|
46180
|
+
|
|
46181
|
+
`);
|
|
46182
|
+
parts.push("```json\n");
|
|
46183
|
+
parts.push('{\n "axes": {\n');
|
|
46184
|
+
axes.forEach((axis, idx) => {
|
|
46185
|
+
const comma = idx < axes.length - 1 ? "," : "";
|
|
46186
|
+
parts.push(` "${axis}": {"decision": "approve|reject|abstain", "reason": "..."}${comma}
|
|
46187
|
+
`);
|
|
46188
|
+
});
|
|
46189
|
+
parts.push(" }\n}\n");
|
|
46190
|
+
parts.push("```\n\n");
|
|
46191
|
+
parts.push(
|
|
46192
|
+
`Your overall vote (approve/reject/abstain) should reflect: approve if MOST axes are approve; reject if any axis is a strong reject; abstain otherwise.
|
|
46193
|
+
`
|
|
46194
|
+
);
|
|
46195
|
+
return parts.join("");
|
|
46196
|
+
}
|
|
46197
|
+
function extractJsonBlock(reasoning) {
|
|
46198
|
+
const fenced = /```json\s*\n([\s\S]*?)\n```/.exec(reasoning);
|
|
46199
|
+
if (fenced !== null) return fenced[1];
|
|
46200
|
+
const start = reasoning.indexOf("{");
|
|
46201
|
+
if (start === -1) return void 0;
|
|
46202
|
+
let depth = 0;
|
|
46203
|
+
for (let i = start; i < reasoning.length; i++) {
|
|
46204
|
+
if (reasoning[i] === "{") depth++;
|
|
46205
|
+
else if (reasoning[i] === "}") {
|
|
46206
|
+
depth--;
|
|
46207
|
+
if (depth === 0) {
|
|
46208
|
+
const candidate = reasoning.slice(start, i + 1);
|
|
46209
|
+
if (candidate.includes("axes") || candidate.includes("axis")) return candidate;
|
|
46210
|
+
}
|
|
46211
|
+
}
|
|
46212
|
+
}
|
|
46213
|
+
return void 0;
|
|
46214
|
+
}
|
|
46215
|
+
function isValidAxisDecision(d) {
|
|
46216
|
+
return d === "approve" || d === "reject" || d === "abstain";
|
|
46217
|
+
}
|
|
46218
|
+
function safeJsonParse2(raw) {
|
|
46219
|
+
try {
|
|
46220
|
+
return JSON.parse(raw);
|
|
46221
|
+
} catch {
|
|
46222
|
+
return void 0;
|
|
46223
|
+
}
|
|
46224
|
+
}
|
|
46225
|
+
function resolveAxesContainer(parsed) {
|
|
46226
|
+
if (typeof parsed !== "object" || parsed === null) return void 0;
|
|
46227
|
+
const root = parsed;
|
|
46228
|
+
const axesObj = root.axes ?? parsed;
|
|
46229
|
+
if (typeof axesObj !== "object") return void 0;
|
|
46230
|
+
return axesObj;
|
|
46231
|
+
}
|
|
46232
|
+
function parseSingleAxisEntry(entry) {
|
|
46233
|
+
if (typeof entry !== "object" || entry === null) return void 0;
|
|
46234
|
+
const e = entry;
|
|
46235
|
+
if (!isValidAxisDecision(e.decision)) return void 0;
|
|
46236
|
+
return { decision: e.decision, reason: typeof e.reason === "string" ? e.reason : "" };
|
|
46237
|
+
}
|
|
46238
|
+
function parseAxisVerdicts(reasoning, axes) {
|
|
46239
|
+
const block = extractJsonBlock(reasoning);
|
|
46240
|
+
if (block === void 0) return {};
|
|
46241
|
+
const parsed = safeJsonParse2(block);
|
|
46242
|
+
const container = resolveAxesContainer(parsed);
|
|
46243
|
+
if (container === void 0) return {};
|
|
46244
|
+
const out = {};
|
|
46245
|
+
for (const axis of axes) {
|
|
46246
|
+
const entry = parseSingleAxisEntry(container[axis]);
|
|
46247
|
+
if (entry !== void 0) out[axis] = entry;
|
|
46248
|
+
}
|
|
46249
|
+
return out;
|
|
46250
|
+
}
|
|
46251
|
+
function aggregateAxis(axis, votes) {
|
|
46252
|
+
const valid = votes.filter((v) => v.source !== "error" && axis in v.axisVotes);
|
|
46253
|
+
let approveCount = 0;
|
|
46254
|
+
let rejectCount = 0;
|
|
46255
|
+
let abstainCount = 0;
|
|
46256
|
+
const supporters = [];
|
|
46257
|
+
const reasons = [];
|
|
46258
|
+
for (const v of valid) {
|
|
46259
|
+
const entry = v.axisVotes[axis];
|
|
46260
|
+
if (entry === void 0) continue;
|
|
46261
|
+
if (entry.decision === "approve") {
|
|
46262
|
+
approveCount++;
|
|
46263
|
+
supporters.push(v.role);
|
|
46264
|
+
} else if (entry.decision === "reject") {
|
|
46265
|
+
rejectCount++;
|
|
46266
|
+
} else {
|
|
46267
|
+
abstainCount++;
|
|
46268
|
+
}
|
|
46269
|
+
if (entry.reason !== "") reasons.push(`${v.role}: ${entry.reason}`);
|
|
46270
|
+
}
|
|
46271
|
+
const decision = decideAxis(approveCount, rejectCount, abstainCount);
|
|
46272
|
+
const total = approveCount + rejectCount + abstainCount;
|
|
46273
|
+
const confidence = total === 0 ? 0 : Math.max(approveCount, rejectCount) / total;
|
|
46274
|
+
return {
|
|
46275
|
+
axis,
|
|
46276
|
+
decision,
|
|
46277
|
+
confidence,
|
|
46278
|
+
approveCount,
|
|
46279
|
+
rejectCount,
|
|
46280
|
+
abstainCount,
|
|
46281
|
+
summary: reasons.slice(0, 3).join(" | "),
|
|
46282
|
+
supportingVoters: supporters
|
|
46283
|
+
};
|
|
46284
|
+
}
|
|
46285
|
+
function decideAxis(approve, reject, abstain) {
|
|
46286
|
+
const total = approve + reject + abstain;
|
|
46287
|
+
if (total === 0) return "unknown";
|
|
46288
|
+
if (approve > reject && approve > abstain) return "approve";
|
|
46289
|
+
if (reject > approve && reject > abstain) return "reject";
|
|
46290
|
+
if (approve === reject && approve > 0) return "mixed";
|
|
46291
|
+
return "mixed";
|
|
46292
|
+
}
|
|
46293
|
+
function aggregatePanel(verdicts) {
|
|
46294
|
+
if (verdicts.length === 0) return "mixed";
|
|
46295
|
+
const allApprove = verdicts.every((v) => v.decision === "approve");
|
|
46296
|
+
if (allApprove) return "approve";
|
|
46297
|
+
const anyReject = verdicts.some((v) => v.decision === "reject");
|
|
46298
|
+
if (anyReject) return "reject";
|
|
46299
|
+
return "mixed";
|
|
46300
|
+
}
|
|
46301
|
+
function buildRecommendation(decision, verdicts) {
|
|
46302
|
+
if (decision === "approve") {
|
|
46303
|
+
return `Approve: all ${String(verdicts.length)} axes approve.`;
|
|
46304
|
+
}
|
|
46305
|
+
if (decision === "reject") {
|
|
46306
|
+
const blockers = verdicts.filter((v) => v.decision === "reject").map((v) => v.axis).join(", ");
|
|
46307
|
+
return `Reject: blocking concerns on ${blockers}.`;
|
|
46308
|
+
}
|
|
46309
|
+
const wins = verdicts.filter((v) => v.decision === "approve").map((v) => v.axis);
|
|
46310
|
+
const losses = verdicts.filter((v) => v.decision === "reject" || v.decision === "mixed" || v.decision === "unknown").map((v) => v.axis);
|
|
46311
|
+
return `Mixed: wins on ${wins.join(", ") || "(none)"}; concerns on ${losses.join(", ") || "(none)"}. Apply judgment.`;
|
|
46312
|
+
}
|
|
46313
|
+
function toPanelVote(result, axes) {
|
|
46314
|
+
const axisVotes = parseAxisVerdicts(result.vote.reasoning, axes);
|
|
46315
|
+
return {
|
|
46316
|
+
role: result.role,
|
|
46317
|
+
overallDecision: result.vote.decision,
|
|
46318
|
+
axisVotes,
|
|
46319
|
+
reasoning: result.vote.reasoning,
|
|
46320
|
+
source: result.source,
|
|
46321
|
+
cli: result.cli,
|
|
46322
|
+
...result.error !== void 0 && { errorMessage: result.error }
|
|
46323
|
+
};
|
|
46324
|
+
}
|
|
46325
|
+
async function tradeoffPanelHandler(args, ctx) {
|
|
46326
|
+
const parsed = SupplyChainTradeoffPanelInputSchema.safeParse(args);
|
|
46327
|
+
if (!parsed.success) {
|
|
46328
|
+
return toolStructuredError({
|
|
46329
|
+
errorCategory: "validation",
|
|
46330
|
+
message: `Validation error: ${formatZodError(parsed.error)}`
|
|
46331
|
+
});
|
|
46332
|
+
}
|
|
46333
|
+
const input = parsed.data;
|
|
46334
|
+
const axes = input.axes ?? DEFAULT_AXES;
|
|
46335
|
+
const roles = input.quickMode ? QUICK_PANEL : FULL_PANEL;
|
|
46336
|
+
const start = Date.now();
|
|
46337
|
+
try {
|
|
46338
|
+
const proposal = buildTradeoffProposal(input);
|
|
46339
|
+
const voteResults = await collectRealVotes({
|
|
46340
|
+
roles,
|
|
46341
|
+
proposal,
|
|
46342
|
+
simulate: input.simulate,
|
|
46343
|
+
logger: ctx.logger
|
|
46344
|
+
});
|
|
46345
|
+
const votes = voteResults.map((r) => toPanelVote(r, axes));
|
|
46346
|
+
const axisVerdicts = axes.map((a) => aggregateAxis(a, votes));
|
|
46347
|
+
const decision = aggregatePanel(axisVerdicts);
|
|
46348
|
+
const recommendation = buildRecommendation(decision, axisVerdicts);
|
|
46349
|
+
const voterErrors = votes.filter((v) => v.source === "error").length;
|
|
46350
|
+
const response = {
|
|
46351
|
+
proposal: input.proposal,
|
|
46352
|
+
axes,
|
|
46353
|
+
decision,
|
|
46354
|
+
axisVerdicts,
|
|
46355
|
+
recommendation,
|
|
46356
|
+
votes,
|
|
46357
|
+
voterErrors,
|
|
46358
|
+
durationMs: Date.now() - start
|
|
46359
|
+
};
|
|
46360
|
+
return toolSuccess(JSON.stringify(response, null, 2));
|
|
46361
|
+
} catch (error) {
|
|
46362
|
+
return toolStructuredError({
|
|
46363
|
+
errorCategory: "internal",
|
|
46364
|
+
message: `Tradeoff panel failed: ${getErrorMessage(error)}`
|
|
46365
|
+
});
|
|
46366
|
+
}
|
|
46367
|
+
}
|
|
46368
|
+
function registerSupplyChainTradeoffPanelTool(server, deps) {
|
|
46369
|
+
const logger52 = deps.logger ?? createLogger({ tool: "supply_chain_tradeoff_panel" });
|
|
46370
|
+
const description2 = "Run a structured per-axis tradeoff vote on an engineering proposal (#2294). Default axes: build_time_determinism / supply_chain_risk / update_cadence. Voters answer EACH axis independently; aggregator surfaces per-axis verdicts so legitimate tradeoffs are not masked by a single approve/reject.";
|
|
46371
|
+
const secureHandler = createSecureHandler(tradeoffPanelHandler, {
|
|
46372
|
+
toolName: "supply_chain_tradeoff_panel",
|
|
46373
|
+
rateLimiter: deps.rateLimiter,
|
|
46374
|
+
logger: logger52
|
|
46375
|
+
});
|
|
46376
|
+
const timeoutMs = getToolTimeout("supply_chain_tradeoff_panel", deps.security);
|
|
46377
|
+
const wrappedHandler = wrapToolWithTimeout("supply_chain_tradeoff_panel", secureHandler, {
|
|
46378
|
+
timeoutMs,
|
|
46379
|
+
logger: logger52
|
|
46380
|
+
});
|
|
46381
|
+
server.registerTool(
|
|
46382
|
+
"supply_chain_tradeoff_panel",
|
|
46383
|
+
{
|
|
46384
|
+
description: description2,
|
|
46385
|
+
inputSchema: SupplyChainTradeoffPanelInputSchema.shape,
|
|
46386
|
+
annotations: getToolAnnotations("supply_chain_tradeoff_panel")
|
|
46387
|
+
},
|
|
46388
|
+
toSdkCallback(wrappedHandler)
|
|
46389
|
+
);
|
|
46390
|
+
logger52.info("Registered supply_chain_tradeoff_panel tool");
|
|
46391
|
+
}
|
|
45991
46392
|
|
|
45992
46393
|
// src/mcp/tools/tool-annotations.ts
|
|
45993
46394
|
var TOOL_ANNOTATIONS = {
|
|
@@ -46343,6 +46744,152 @@ var TOOL_ANNOTATIONS = {
|
|
|
46343
46744
|
},
|
|
46344
46745
|
{ category: "implicit", description: "Consumes rate limit quota" }
|
|
46345
46746
|
]
|
|
46747
|
+
},
|
|
46748
|
+
research_add_source: {
|
|
46749
|
+
annotations: {
|
|
46750
|
+
title: "Research Add Source",
|
|
46751
|
+
readOnlyHint: false,
|
|
46752
|
+
destructiveHint: false,
|
|
46753
|
+
idempotentHint: false,
|
|
46754
|
+
openWorldHint: true
|
|
46755
|
+
},
|
|
46756
|
+
sideEffects: [
|
|
46757
|
+
{ category: "explicit", description: "Adds a non-paper source to the research registry" },
|
|
46758
|
+
{ category: "coupling", description: "New entries affect research_discover/research_query" }
|
|
46759
|
+
]
|
|
46760
|
+
},
|
|
46761
|
+
research_synthesize: {
|
|
46762
|
+
annotations: {
|
|
46763
|
+
title: "Research Synthesize",
|
|
46764
|
+
readOnlyHint: true,
|
|
46765
|
+
destructiveHint: false,
|
|
46766
|
+
idempotentHint: true,
|
|
46767
|
+
openWorldHint: false
|
|
46768
|
+
},
|
|
46769
|
+
sideEffects: [{ category: "implicit", description: "Reads research catalog + alignment map" }]
|
|
46770
|
+
},
|
|
46771
|
+
query_task_state: {
|
|
46772
|
+
annotations: {
|
|
46773
|
+
title: "Query Task State",
|
|
46774
|
+
readOnlyHint: true,
|
|
46775
|
+
destructiveHint: false,
|
|
46776
|
+
idempotentHint: true,
|
|
46777
|
+
openWorldHint: false
|
|
46778
|
+
},
|
|
46779
|
+
sideEffects: [
|
|
46780
|
+
{ category: "implicit", description: "Reads the structured task-state log (#2278)" }
|
|
46781
|
+
]
|
|
46782
|
+
},
|
|
46783
|
+
verify_audit_chain: {
|
|
46784
|
+
annotations: {
|
|
46785
|
+
title: "Verify Audit Chain",
|
|
46786
|
+
readOnlyHint: true,
|
|
46787
|
+
destructiveHint: false,
|
|
46788
|
+
idempotentHint: true,
|
|
46789
|
+
openWorldHint: false
|
|
46790
|
+
},
|
|
46791
|
+
sideEffects: [
|
|
46792
|
+
{
|
|
46793
|
+
category: "implicit",
|
|
46794
|
+
description: "Reads the immutable audit log and verifies the hash chain"
|
|
46795
|
+
}
|
|
46796
|
+
]
|
|
46797
|
+
},
|
|
46798
|
+
extract_symbols: {
|
|
46799
|
+
annotations: {
|
|
46800
|
+
title: "Extract Symbols",
|
|
46801
|
+
readOnlyHint: true,
|
|
46802
|
+
destructiveHint: false,
|
|
46803
|
+
idempotentHint: true,
|
|
46804
|
+
openWorldHint: false
|
|
46805
|
+
},
|
|
46806
|
+
sideEffects: [{ category: "implicit", description: "Reads source files and walks their ASTs" }]
|
|
46807
|
+
},
|
|
46808
|
+
search_codebase: {
|
|
46809
|
+
annotations: {
|
|
46810
|
+
title: "Search Codebase",
|
|
46811
|
+
readOnlyHint: true,
|
|
46812
|
+
destructiveHint: false,
|
|
46813
|
+
idempotentHint: true,
|
|
46814
|
+
openWorldHint: false
|
|
46815
|
+
},
|
|
46816
|
+
sideEffects: [
|
|
46817
|
+
{
|
|
46818
|
+
category: "implicit",
|
|
46819
|
+
description: "Reads source files and builds an in-memory symbol index"
|
|
46820
|
+
}
|
|
46821
|
+
]
|
|
46822
|
+
},
|
|
46823
|
+
run_dev_pipeline: {
|
|
46824
|
+
annotations: {
|
|
46825
|
+
title: "Run Dev Pipeline",
|
|
46826
|
+
readOnlyHint: false,
|
|
46827
|
+
destructiveHint: false,
|
|
46828
|
+
idempotentHint: false,
|
|
46829
|
+
openWorldHint: true
|
|
46830
|
+
},
|
|
46831
|
+
sideEffects: [
|
|
46832
|
+
{
|
|
46833
|
+
category: "explicit",
|
|
46834
|
+
description: "Executes the V2 dev pipeline (delegates to CLI adapters)"
|
|
46835
|
+
},
|
|
46836
|
+
{
|
|
46837
|
+
category: "implicit",
|
|
46838
|
+
description: "Consumes API tokens; persists outcomes and checkpoints"
|
|
46839
|
+
},
|
|
46840
|
+
{
|
|
46841
|
+
category: "coupling",
|
|
46842
|
+
description: "Writes routing/learning state consumed by future runs"
|
|
46843
|
+
}
|
|
46844
|
+
]
|
|
46845
|
+
},
|
|
46846
|
+
run_pipeline: {
|
|
46847
|
+
annotations: {
|
|
46848
|
+
title: "Run Pipeline",
|
|
46849
|
+
readOnlyHint: false,
|
|
46850
|
+
destructiveHint: false,
|
|
46851
|
+
idempotentHint: false,
|
|
46852
|
+
openWorldHint: true
|
|
46853
|
+
},
|
|
46854
|
+
sideEffects: [
|
|
46855
|
+
{ category: "explicit", description: "Executes a generic V2 pipeline TaskContract" },
|
|
46856
|
+
{ category: "implicit", description: "Consumes API tokens; emits pipeline events" },
|
|
46857
|
+
{ category: "coupling", description: "Writes policy/audit state consumed by other tools" }
|
|
46858
|
+
]
|
|
46859
|
+
},
|
|
46860
|
+
pr_review: {
|
|
46861
|
+
annotations: {
|
|
46862
|
+
title: "PR Review",
|
|
46863
|
+
readOnlyHint: false,
|
|
46864
|
+
destructiveHint: false,
|
|
46865
|
+
idempotentHint: false,
|
|
46866
|
+
openWorldHint: true
|
|
46867
|
+
},
|
|
46868
|
+
sideEffects: [
|
|
46869
|
+
{
|
|
46870
|
+
category: "explicit",
|
|
46871
|
+
description: "Runs multi-voter PR review with verification gate (#2233)"
|
|
46872
|
+
},
|
|
46873
|
+
{ category: "implicit", description: "Consumes API tokens across voter CLIs" },
|
|
46874
|
+
{ category: "coupling", description: "Records voter outcomes for weather report" }
|
|
46875
|
+
]
|
|
46876
|
+
},
|
|
46877
|
+
supply_chain_tradeoff_panel: {
|
|
46878
|
+
annotations: {
|
|
46879
|
+
title: "Supply-chain Tradeoff Panel",
|
|
46880
|
+
readOnlyHint: false,
|
|
46881
|
+
destructiveHint: false,
|
|
46882
|
+
idempotentHint: false,
|
|
46883
|
+
openWorldHint: true
|
|
46884
|
+
},
|
|
46885
|
+
sideEffects: [
|
|
46886
|
+
{
|
|
46887
|
+
category: "explicit",
|
|
46888
|
+
description: "Runs per-axis tradeoff vote (build_time_determinism / supply_chain_risk / update_cadence) (#2294)"
|
|
46889
|
+
},
|
|
46890
|
+
{ category: "implicit", description: "Consumes API tokens across voter CLIs" },
|
|
46891
|
+
{ category: "coupling", description: "Records voter outcomes for weather report" }
|
|
46892
|
+
]
|
|
46346
46893
|
}
|
|
46347
46894
|
};
|
|
46348
46895
|
function getMcpAnnotations(toolName) {
|
|
@@ -46593,40 +47140,40 @@ var RiskLevel = /* @__PURE__ */ ((RiskLevel2) => {
|
|
|
46593
47140
|
})(RiskLevel || {});
|
|
46594
47141
|
|
|
46595
47142
|
// src/mcp/safety/stpa-schemas.ts
|
|
46596
|
-
import { z as
|
|
46597
|
-
var HazardCategorySchema =
|
|
46598
|
-
var HazardSeveritySchema =
|
|
46599
|
-
var ConstraintPrioritySchema =
|
|
46600
|
-
var RiskLevelSchema =
|
|
46601
|
-
var TriggerPatternSchema =
|
|
46602
|
-
parameter:
|
|
46603
|
-
matchType:
|
|
46604
|
-
pattern:
|
|
46605
|
-
reason:
|
|
47143
|
+
import { z as z100 } from "zod";
|
|
47144
|
+
var HazardCategorySchema = z100.enum(HazardCategory);
|
|
47145
|
+
var HazardSeveritySchema = z100.enum(HazardSeverity);
|
|
47146
|
+
var ConstraintPrioritySchema = z100.enum(ConstraintPriority);
|
|
47147
|
+
var RiskLevelSchema = z100.enum(RiskLevel);
|
|
47148
|
+
var TriggerPatternSchema = z100.object({
|
|
47149
|
+
parameter: z100.string().min(1),
|
|
47150
|
+
matchType: z100.enum(["contains", "regex", "equals", "startsWith", "endsWith"]),
|
|
47151
|
+
pattern: z100.string(),
|
|
47152
|
+
reason: z100.string()
|
|
46606
47153
|
});
|
|
46607
|
-
var HazardSchema =
|
|
46608
|
-
id:
|
|
46609
|
-
description:
|
|
47154
|
+
var HazardSchema = z100.object({
|
|
47155
|
+
id: z100.string().min(1),
|
|
47156
|
+
description: z100.string(),
|
|
46610
47157
|
category: HazardCategorySchema,
|
|
46611
47158
|
severity: HazardSeveritySchema,
|
|
46612
|
-
likelihood:
|
|
46613
|
-
triggerConditions:
|
|
46614
|
-
consequences:
|
|
47159
|
+
likelihood: z100.enum(["almost_certain", "likely", "possible", "unlikely", "rare"]),
|
|
47160
|
+
triggerConditions: z100.array(z100.string()),
|
|
47161
|
+
consequences: z100.array(z100.string())
|
|
46615
47162
|
});
|
|
46616
|
-
var UnsafeControlActionSchema =
|
|
46617
|
-
id:
|
|
46618
|
-
toolName:
|
|
46619
|
-
type:
|
|
46620
|
-
description:
|
|
46621
|
-
unsafeContext:
|
|
46622
|
-
relatedHazards:
|
|
46623
|
-
triggerPatterns:
|
|
47163
|
+
var UnsafeControlActionSchema = z100.object({
|
|
47164
|
+
id: z100.string().min(1),
|
|
47165
|
+
toolName: z100.string().min(1),
|
|
47166
|
+
type: z100.enum(["not_provided", "provided_causes_hazard", "wrong_timing", "wrong_duration"]),
|
|
47167
|
+
description: z100.string(),
|
|
47168
|
+
unsafeContext: z100.string(),
|
|
47169
|
+
relatedHazards: z100.array(z100.string()),
|
|
47170
|
+
triggerPatterns: z100.array(TriggerPatternSchema).optional()
|
|
46624
47171
|
});
|
|
46625
|
-
var SafetyConstraintSchema =
|
|
46626
|
-
id:
|
|
46627
|
-
description:
|
|
46628
|
-
mitigates:
|
|
46629
|
-
enforcement:
|
|
47172
|
+
var SafetyConstraintSchema = z100.object({
|
|
47173
|
+
id: z100.string().min(1),
|
|
47174
|
+
description: z100.string(),
|
|
47175
|
+
mitigates: z100.array(z100.string()),
|
|
47176
|
+
enforcement: z100.enum([
|
|
46630
47177
|
"prevent",
|
|
46631
47178
|
"require_confirmation",
|
|
46632
47179
|
"alert",
|
|
@@ -46634,54 +47181,54 @@ var SafetyConstraintSchema = z99.object({
|
|
|
46634
47181
|
"rate_limit",
|
|
46635
47182
|
"require_privilege"
|
|
46636
47183
|
]),
|
|
46637
|
-
validationFunction:
|
|
47184
|
+
validationFunction: z100.string().optional(),
|
|
46638
47185
|
priority: ConstraintPrioritySchema
|
|
46639
47186
|
});
|
|
46640
|
-
var PropertySchemaSchema =
|
|
46641
|
-
type:
|
|
46642
|
-
description:
|
|
46643
|
-
enum:
|
|
46644
|
-
pattern:
|
|
46645
|
-
minimum:
|
|
46646
|
-
maximum:
|
|
47187
|
+
var PropertySchemaSchema = z100.object({
|
|
47188
|
+
type: z100.string(),
|
|
47189
|
+
description: z100.string().optional(),
|
|
47190
|
+
enum: z100.array(z100.unknown()).optional(),
|
|
47191
|
+
pattern: z100.string().optional(),
|
|
47192
|
+
minimum: z100.number().optional(),
|
|
47193
|
+
maximum: z100.number().optional()
|
|
46647
47194
|
});
|
|
46648
|
-
var ToolInputSchemaSchema =
|
|
46649
|
-
type:
|
|
46650
|
-
properties:
|
|
46651
|
-
required:
|
|
46652
|
-
additionalProperties:
|
|
47195
|
+
var ToolInputSchemaSchema = z100.object({
|
|
47196
|
+
type: z100.string(),
|
|
47197
|
+
properties: z100.record(z100.string(), PropertySchemaSchema).optional(),
|
|
47198
|
+
required: z100.array(z100.string()).optional(),
|
|
47199
|
+
additionalProperties: z100.boolean().optional()
|
|
46653
47200
|
});
|
|
46654
|
-
var ToolDefinitionSchema =
|
|
46655
|
-
name:
|
|
46656
|
-
description:
|
|
47201
|
+
var ToolDefinitionSchema = z100.object({
|
|
47202
|
+
name: z100.string().min(1),
|
|
47203
|
+
description: z100.string(),
|
|
46657
47204
|
inputSchema: ToolInputSchemaSchema
|
|
46658
47205
|
});
|
|
46659
|
-
var AnalysisConfigurationSchema =
|
|
46660
|
-
includeLowSeverity:
|
|
46661
|
-
generateAllConstraints:
|
|
46662
|
-
checkInteractions:
|
|
46663
|
-
maxHazardsPerTool:
|
|
46664
|
-
categories:
|
|
47206
|
+
var AnalysisConfigurationSchema = z100.object({
|
|
47207
|
+
includeLowSeverity: z100.boolean().default(true),
|
|
47208
|
+
generateAllConstraints: z100.boolean().default(true),
|
|
47209
|
+
checkInteractions: z100.boolean().default(true),
|
|
47210
|
+
maxHazardsPerTool: z100.number().int().min(1).max(100).default(50),
|
|
47211
|
+
categories: z100.array(HazardCategorySchema).default([])
|
|
46665
47212
|
});
|
|
46666
|
-
var ConstraintViolationSchema =
|
|
46667
|
-
constraintId:
|
|
46668
|
-
constraintDescription:
|
|
47213
|
+
var ConstraintViolationSchema = z100.object({
|
|
47214
|
+
constraintId: z100.string().min(1),
|
|
47215
|
+
constraintDescription: z100.string(),
|
|
46669
47216
|
severity: HazardSeveritySchema,
|
|
46670
|
-
details:
|
|
46671
|
-
remediation:
|
|
47217
|
+
details: z100.string(),
|
|
47218
|
+
remediation: z100.string()
|
|
46672
47219
|
});
|
|
46673
|
-
var ValidationWarningSchema =
|
|
46674
|
-
code:
|
|
46675
|
-
message:
|
|
46676
|
-
affected:
|
|
47220
|
+
var ValidationWarningSchema = z100.object({
|
|
47221
|
+
code: z100.string().min(1),
|
|
47222
|
+
message: z100.string(),
|
|
47223
|
+
affected: z100.string()
|
|
46677
47224
|
});
|
|
46678
|
-
var ValidationResultSchema =
|
|
46679
|
-
valid:
|
|
46680
|
-
toolName:
|
|
46681
|
-
violations:
|
|
46682
|
-
passed:
|
|
46683
|
-
warnings:
|
|
46684
|
-
validatedAt:
|
|
47225
|
+
var ValidationResultSchema = z100.object({
|
|
47226
|
+
valid: z100.boolean(),
|
|
47227
|
+
toolName: z100.string().min(1),
|
|
47228
|
+
violations: z100.array(ConstraintViolationSchema),
|
|
47229
|
+
passed: z100.array(z100.string()),
|
|
47230
|
+
warnings: z100.array(ValidationWarningSchema),
|
|
47231
|
+
validatedAt: z100.date()
|
|
46685
47232
|
});
|
|
46686
47233
|
|
|
46687
47234
|
// src/mcp/safety/stpa-types.ts
|
|
@@ -47766,53 +48313,53 @@ var GeminiResponseParser = class {
|
|
|
47766
48313
|
};
|
|
47767
48314
|
|
|
47768
48315
|
// src/cli-adapters/router-types.ts
|
|
47769
|
-
import { z as
|
|
47770
|
-
var RouterConfigSchema =
|
|
47771
|
-
minCapacityThreshold:
|
|
47772
|
-
preferCostEfficient:
|
|
47773
|
-
maxDecisionTimeMs:
|
|
48316
|
+
import { z as z101 } from "zod";
|
|
48317
|
+
var RouterConfigSchema = z101.object({
|
|
48318
|
+
minCapacityThreshold: z101.number().min(0).max(1).default(0.1),
|
|
48319
|
+
preferCostEfficient: z101.boolean().default(false),
|
|
48320
|
+
maxDecisionTimeMs: z101.number().min(1).max(1e3).default(100)
|
|
47774
48321
|
});
|
|
47775
48322
|
|
|
47776
48323
|
// src/cli-adapters/agreement-cascade-types.ts
|
|
47777
|
-
import { z as
|
|
47778
|
-
var AgreementCascadeConfigSchema =
|
|
47779
|
-
agreementThreshold:
|
|
47780
|
-
maxStages:
|
|
47781
|
-
modelTimeoutMs:
|
|
48324
|
+
import { z as z102 } from "zod";
|
|
48325
|
+
var AgreementCascadeConfigSchema = z102.object({
|
|
48326
|
+
agreementThreshold: z102.number().min(0.5).max(1).default(0.7),
|
|
48327
|
+
maxStages: z102.number().int().min(1).max(5).default(3),
|
|
48328
|
+
modelTimeoutMs: z102.number().int().min(1e3).max(3e5).default(6e4)
|
|
47782
48329
|
});
|
|
47783
48330
|
|
|
47784
48331
|
// src/cli-adapters/agreement-cascade-router.ts
|
|
47785
48332
|
var logger43 = createLogger({ component: "agreement-cascade-router" });
|
|
47786
48333
|
|
|
47787
48334
|
// src/cli-adapters/daao-types.ts
|
|
47788
|
-
import { z as
|
|
47789
|
-
var EncodedFeaturesSchema =
|
|
48335
|
+
import { z as z103 } from "zod";
|
|
48336
|
+
var EncodedFeaturesSchema = z103.object({
|
|
47790
48337
|
/** Lexical complexity score (vocabulary diversity, rare words) */
|
|
47791
|
-
lexicalComplexity:
|
|
48338
|
+
lexicalComplexity: z103.number().min(0).max(1),
|
|
47792
48339
|
/** Syntactic complexity score (sentence structure, nesting) */
|
|
47793
|
-
syntacticComplexity:
|
|
48340
|
+
syntacticComplexity: z103.number().min(0).max(1),
|
|
47794
48341
|
/** Semantic density score (concept density, abstraction level) */
|
|
47795
|
-
semanticDensity:
|
|
48342
|
+
semanticDensity: z103.number().min(0).max(1),
|
|
47796
48343
|
/** Technical specificity (domain-specific terminology) */
|
|
47797
|
-
technicalSpecificity:
|
|
48344
|
+
technicalSpecificity: z103.number().min(0).max(1),
|
|
47798
48345
|
/** Task scope (breadth of requirements) */
|
|
47799
|
-
taskScope:
|
|
48346
|
+
taskScope: z103.number().min(0).max(1),
|
|
47800
48347
|
/** Constraint complexity (constraints, edge cases, requirements) */
|
|
47801
|
-
constraintComplexity:
|
|
48348
|
+
constraintComplexity: z103.number().min(0).max(1),
|
|
47802
48349
|
/** Ambiguity level (inverse - higher means more clear/specific) */
|
|
47803
|
-
clarity:
|
|
48350
|
+
clarity: z103.number().min(0).max(1),
|
|
47804
48351
|
/** Output complexity expectation */
|
|
47805
|
-
outputComplexity:
|
|
48352
|
+
outputComplexity: z103.number().min(0).max(1)
|
|
47806
48353
|
});
|
|
47807
|
-
var FeatureWeightsSchema =
|
|
47808
|
-
lexicalComplexity:
|
|
47809
|
-
syntacticComplexity:
|
|
47810
|
-
semanticDensity:
|
|
47811
|
-
technicalSpecificity:
|
|
47812
|
-
taskScope:
|
|
47813
|
-
constraintComplexity:
|
|
47814
|
-
clarity:
|
|
47815
|
-
outputComplexity:
|
|
48354
|
+
var FeatureWeightsSchema = z103.object({
|
|
48355
|
+
lexicalComplexity: z103.number().min(0).max(1),
|
|
48356
|
+
syntacticComplexity: z103.number().min(0).max(1),
|
|
48357
|
+
semanticDensity: z103.number().min(0).max(1),
|
|
48358
|
+
technicalSpecificity: z103.number().min(0).max(1),
|
|
48359
|
+
taskScope: z103.number().min(0).max(1),
|
|
48360
|
+
constraintComplexity: z103.number().min(0).max(1),
|
|
48361
|
+
clarity: z103.number().min(0).max(1),
|
|
48362
|
+
outputComplexity: z103.number().min(0).max(1)
|
|
47816
48363
|
});
|
|
47817
48364
|
var DEFAULT_FEATURE_WEIGHTS = {
|
|
47818
48365
|
lexicalComplexity: 0.1,
|
|
@@ -47834,50 +48381,50 @@ var DEFAULT_DAAO_TIER_TO_CLIS = {
|
|
|
47834
48381
|
balanced: ["codex", "opencode", "gemini", "claude"],
|
|
47835
48382
|
powerful: ["claude", "codex", "opencode", "gemini"]
|
|
47836
48383
|
};
|
|
47837
|
-
var DAAOConfigSchema =
|
|
48384
|
+
var DAAOConfigSchema = z103.object({
|
|
47838
48385
|
/** Difficulty thresholds for level classification */
|
|
47839
|
-
thresholds:
|
|
47840
|
-
easyUpperBound:
|
|
47841
|
-
hardLowerBound:
|
|
48386
|
+
thresholds: z103.object({
|
|
48387
|
+
easyUpperBound: z103.number().min(0).max(1),
|
|
48388
|
+
hardLowerBound: z103.number().min(0).max(1)
|
|
47842
48389
|
}).default(DEFAULT_DAAO_THRESHOLDS),
|
|
47843
48390
|
/** Feature weights for difficulty aggregation */
|
|
47844
48391
|
weights: FeatureWeightsSchema.default(DEFAULT_FEATURE_WEIGHTS),
|
|
47845
48392
|
/** Mapping from model tier to CLI preference order */
|
|
47846
|
-
tierToClis:
|
|
47847
|
-
|
|
47848
|
-
|
|
48393
|
+
tierToClis: z103.record(
|
|
48394
|
+
z103.enum(["fast", "balanced", "powerful"]),
|
|
48395
|
+
z103.array(z103.enum(["claude", "gemini", "codex", "opencode"]))
|
|
47849
48396
|
).default(DEFAULT_DAAO_TIER_TO_CLIS),
|
|
47850
48397
|
/** Enable adaptive calibration from outcomes */
|
|
47851
|
-
enableCalibration:
|
|
48398
|
+
enableCalibration: z103.boolean().default(true),
|
|
47852
48399
|
/** Maximum outcomes to store for calibration */
|
|
47853
|
-
maxCalibrationOutcomes:
|
|
48400
|
+
maxCalibrationOutcomes: z103.number().int().positive().default(1e3),
|
|
47854
48401
|
/** Minimum outcomes before applying calibration adjustments */
|
|
47855
|
-
minCalibrationOutcomes:
|
|
48402
|
+
minCalibrationOutcomes: z103.number().int().positive().default(50),
|
|
47856
48403
|
/** Reconstruction error threshold for typical patterns */
|
|
47857
|
-
typicalPatternThreshold:
|
|
48404
|
+
typicalPatternThreshold: z103.number().min(0).max(1).default(0.3),
|
|
47858
48405
|
/** Verbose logging */
|
|
47859
|
-
verbose:
|
|
48406
|
+
verbose: z103.boolean().default(false)
|
|
47860
48407
|
});
|
|
47861
48408
|
|
|
47862
48409
|
// src/cli-adapters/task-classifier.ts
|
|
47863
|
-
import { z as
|
|
47864
|
-
var ClassificationPatternsSchema =
|
|
47865
|
-
code:
|
|
47866
|
-
research:
|
|
47867
|
-
documentation:
|
|
47868
|
-
analysis:
|
|
48410
|
+
import { z as z104 } from "zod";
|
|
48411
|
+
var ClassificationPatternsSchema = z104.object({
|
|
48412
|
+
code: z104.array(z104.string()).readonly(),
|
|
48413
|
+
research: z104.array(z104.string()).readonly(),
|
|
48414
|
+
documentation: z104.array(z104.string()).readonly(),
|
|
48415
|
+
analysis: z104.array(z104.string()).readonly()
|
|
47869
48416
|
});
|
|
47870
48417
|
|
|
47871
48418
|
// src/cli-adapters/response-cache-types.ts
|
|
47872
|
-
import { z as
|
|
47873
|
-
var ResponseCacheConfigSchema =
|
|
47874
|
-
defaultTTL:
|
|
48419
|
+
import { z as z105 } from "zod";
|
|
48420
|
+
var ResponseCacheConfigSchema = z105.object({
|
|
48421
|
+
defaultTTL: z105.number().min(1e3).max(36e5).default(3e5),
|
|
47875
48422
|
// 5 minutes
|
|
47876
|
-
maxEntries:
|
|
47877
|
-
maxMemoryMB:
|
|
47878
|
-
cleanupInterval:
|
|
48423
|
+
maxEntries: z105.number().min(10).max(1e5).default(1e3),
|
|
48424
|
+
maxMemoryMB: z105.number().min(1).max(1e3).default(50),
|
|
48425
|
+
cleanupInterval: z105.number().min(1e3).max(6e5).default(6e4),
|
|
47879
48426
|
// 1 minute
|
|
47880
|
-
enableLogging:
|
|
48427
|
+
enableLogging: z105.boolean().default(false)
|
|
47881
48428
|
});
|
|
47882
48429
|
|
|
47883
48430
|
// src/cli-adapters/response-cache-utils.ts
|
|
@@ -47885,12 +48432,12 @@ import { createHash as createHash4 } from "crypto";
|
|
|
47885
48432
|
var logger44 = createLogger({ component: "ResponseCacheUtils" });
|
|
47886
48433
|
|
|
47887
48434
|
// src/cli-adapters/unified-routing-types.ts
|
|
47888
|
-
import { z as
|
|
47889
|
-
var UnifiedRoutingDecisionSchema =
|
|
47890
|
-
selectedCli:
|
|
47891
|
-
confidence:
|
|
47892
|
-
reason:
|
|
47893
|
-
strategy:
|
|
48435
|
+
import { z as z106 } from "zod";
|
|
48436
|
+
var UnifiedRoutingDecisionSchema = z106.object({
|
|
48437
|
+
selectedCli: z106.string(),
|
|
48438
|
+
confidence: z106.number().min(0).max(1),
|
|
48439
|
+
reason: z106.string(),
|
|
48440
|
+
strategy: z106.enum([
|
|
47894
48441
|
"composite",
|
|
47895
48442
|
"quality",
|
|
47896
48443
|
"budget",
|
|
@@ -47902,57 +48449,57 @@ var UnifiedRoutingDecisionSchema = z105.object({
|
|
|
47902
48449
|
"linucb",
|
|
47903
48450
|
"direct"
|
|
47904
48451
|
]),
|
|
47905
|
-
decisionTimeMs:
|
|
47906
|
-
alternatives:
|
|
47907
|
-
stagesExecuted:
|
|
47908
|
-
withinBudget:
|
|
47909
|
-
estimatedComplexity:
|
|
47910
|
-
estimatedTokens:
|
|
47911
|
-
topsisScore:
|
|
47912
|
-
ucbScore:
|
|
47913
|
-
resolvedAtStage:
|
|
47914
|
-
consensusReached:
|
|
47915
|
-
agreementScore:
|
|
47916
|
-
metadata:
|
|
48452
|
+
decisionTimeMs: z106.number().nonnegative(),
|
|
48453
|
+
alternatives: z106.array(z106.string()).readonly(),
|
|
48454
|
+
stagesExecuted: z106.array(z106.string()).readonly(),
|
|
48455
|
+
withinBudget: z106.boolean().optional(),
|
|
48456
|
+
estimatedComplexity: z106.enum(["simple", "moderate", "complex", "expert"]).optional(),
|
|
48457
|
+
estimatedTokens: z106.number().int().positive().optional(),
|
|
48458
|
+
topsisScore: z106.number().optional(),
|
|
48459
|
+
ucbScore: z106.number().optional(),
|
|
48460
|
+
resolvedAtStage: z106.number().int().nonnegative().optional(),
|
|
48461
|
+
consensusReached: z106.boolean().optional(),
|
|
48462
|
+
agreementScore: z106.number().min(0).max(1).optional(),
|
|
48463
|
+
metadata: z106.record(z106.string(), z106.unknown()).optional()
|
|
47917
48464
|
});
|
|
47918
48465
|
|
|
47919
48466
|
// src/learning/outcome-feedback-types.ts
|
|
47920
|
-
import { z as
|
|
47921
|
-
var QualitySignalsSchema =
|
|
47922
|
-
testsPass:
|
|
47923
|
-
lintErrors:
|
|
47924
|
-
userApproved:
|
|
47925
|
-
retryCount:
|
|
47926
|
-
completionRatio:
|
|
47927
|
-
validStructure:
|
|
47928
|
-
coherenceScore:
|
|
48467
|
+
import { z as z107 } from "zod";
|
|
48468
|
+
var QualitySignalsSchema = z107.object({
|
|
48469
|
+
testsPass: z107.boolean().optional(),
|
|
48470
|
+
lintErrors: z107.number().int().min(0).optional(),
|
|
48471
|
+
userApproved: z107.boolean().optional(),
|
|
48472
|
+
retryCount: z107.number().int().min(0).default(0),
|
|
48473
|
+
completionRatio: z107.number().min(0).max(1).default(1),
|
|
48474
|
+
validStructure: z107.boolean().optional(),
|
|
48475
|
+
coherenceScore: z107.number().min(0).max(1).optional()
|
|
47929
48476
|
});
|
|
47930
|
-
var RoutingDecisionSchema =
|
|
47931
|
-
id:
|
|
47932
|
-
timestamp:
|
|
47933
|
-
query:
|
|
47934
|
-
routerType:
|
|
47935
|
-
selectedModel:
|
|
47936
|
-
selectedTier:
|
|
47937
|
-
armIndex:
|
|
47938
|
-
banditContext:
|
|
47939
|
-
queryFeatures:
|
|
47940
|
-
ucbScore:
|
|
47941
|
-
confidence:
|
|
47942
|
-
traceId:
|
|
47943
|
-
domain:
|
|
48477
|
+
var RoutingDecisionSchema = z107.object({
|
|
48478
|
+
id: z107.uuid(),
|
|
48479
|
+
timestamp: z107.iso.datetime(),
|
|
48480
|
+
query: z107.string(),
|
|
48481
|
+
routerType: z107.enum(["linucb", "preference", "quality", "cascade", "topsis"]),
|
|
48482
|
+
selectedModel: z107.string(),
|
|
48483
|
+
selectedTier: z107.enum(["strong", "weak"]).optional(),
|
|
48484
|
+
armIndex: z107.number().int().min(0).optional(),
|
|
48485
|
+
banditContext: z107.record(z107.string(), z107.unknown()).optional(),
|
|
48486
|
+
queryFeatures: z107.record(z107.string(), z107.unknown()).optional(),
|
|
48487
|
+
ucbScore: z107.number().optional(),
|
|
48488
|
+
confidence: z107.number().min(0).max(1).optional(),
|
|
48489
|
+
traceId: z107.string(),
|
|
48490
|
+
domain: z107.string().optional()
|
|
47944
48491
|
});
|
|
47945
|
-
var TaskOutcomeSchema =
|
|
47946
|
-
routingDecisionId:
|
|
47947
|
-
timestamp:
|
|
47948
|
-
outcomeClass:
|
|
47949
|
-
success:
|
|
47950
|
-
qualityScore:
|
|
47951
|
-
durationMs:
|
|
47952
|
-
tokenUsage:
|
|
47953
|
-
errorMessage:
|
|
48492
|
+
var TaskOutcomeSchema = z107.object({
|
|
48493
|
+
routingDecisionId: z107.uuid(),
|
|
48494
|
+
timestamp: z107.iso.datetime(),
|
|
48495
|
+
outcomeClass: z107.enum(["success", "partial", "failure", "timeout", "error"]),
|
|
48496
|
+
success: z107.boolean(),
|
|
48497
|
+
qualityScore: z107.number().min(0).max(1),
|
|
48498
|
+
durationMs: z107.number().min(0),
|
|
48499
|
+
tokenUsage: z107.number().int().min(0),
|
|
48500
|
+
errorMessage: z107.string().optional(),
|
|
47954
48501
|
qualitySignals: QualitySignalsSchema,
|
|
47955
|
-
traceId:
|
|
48502
|
+
traceId: z107.string()
|
|
47956
48503
|
});
|
|
47957
48504
|
var DEFAULT_FEEDBACK_COLLECTOR_CONFIG = {
|
|
47958
48505
|
maxPendingDecisions: 1e3,
|
|
@@ -47967,17 +48514,17 @@ var DEFAULT_FEEDBACK_COLLECTOR_CONFIG = {
|
|
|
47967
48514
|
targetTokenUsage: 2e3,
|
|
47968
48515
|
maxHistorySize: 1e4
|
|
47969
48516
|
};
|
|
47970
|
-
var FeedbackCollectorConfigSchema =
|
|
47971
|
-
maxPendingDecisions:
|
|
47972
|
-
pendingTimeoutMs:
|
|
47973
|
-
enableAutoReward:
|
|
47974
|
-
qualityWeight:
|
|
47975
|
-
speedWeight:
|
|
47976
|
-
efficiencyWeight:
|
|
47977
|
-
retryPenalty:
|
|
47978
|
-
targetDurationMs:
|
|
47979
|
-
targetTokenUsage:
|
|
47980
|
-
maxHistorySize:
|
|
48517
|
+
var FeedbackCollectorConfigSchema = z107.object({
|
|
48518
|
+
maxPendingDecisions: z107.number().int().positive().default(1e3),
|
|
48519
|
+
pendingTimeoutMs: z107.number().positive().default(3e5),
|
|
48520
|
+
enableAutoReward: z107.boolean().default(true),
|
|
48521
|
+
qualityWeight: z107.number().min(0).max(1).default(0.5),
|
|
48522
|
+
speedWeight: z107.number().min(0).max(1).default(0.2),
|
|
48523
|
+
efficiencyWeight: z107.number().min(0).max(1).default(0.2),
|
|
48524
|
+
retryPenalty: z107.number().min(0).max(1).default(0.1),
|
|
48525
|
+
targetDurationMs: z107.number().positive().default(5e3),
|
|
48526
|
+
targetTokenUsage: z107.number().positive().default(2e3),
|
|
48527
|
+
maxHistorySize: z107.number().int().positive().default(1e4)
|
|
47981
48528
|
});
|
|
47982
48529
|
|
|
47983
48530
|
// src/learning/outcome-feedback-helpers.ts
|
|
@@ -49041,7 +49588,7 @@ function getPolicy(id) {
|
|
|
49041
49588
|
// src/security/sandbox/sandbox-executor.ts
|
|
49042
49589
|
import { execFile as execFile4 } from "child_process";
|
|
49043
49590
|
import { promisify as promisify4 } from "util";
|
|
49044
|
-
import { resolve as resolve17, normalize as normalize2, sep as
|
|
49591
|
+
import { resolve as resolve17, normalize as normalize2, sep as sep10 } from "path";
|
|
49045
49592
|
var execFileAsync4 = promisify4(execFile4);
|
|
49046
49593
|
var logger46 = createLogger({ component: "sandbox-executor" });
|
|
49047
49594
|
function parseExecError(error) {
|
|
@@ -49124,7 +49671,7 @@ var PolicySandboxExecutor = class {
|
|
|
49124
49671
|
const normalizedCwd = normalize2(resolve17(cwd));
|
|
49125
49672
|
const isAllowed = policy.pathRules.some((rule) => {
|
|
49126
49673
|
const normalizedRule = normalize2(resolve17(rule.path));
|
|
49127
|
-
const isUnderRule = normalizedCwd === normalizedRule || normalizedCwd.startsWith(normalizedRule +
|
|
49674
|
+
const isUnderRule = normalizedCwd === normalizedRule || normalizedCwd.startsWith(normalizedRule + sep10);
|
|
49128
49675
|
return isUnderRule && rule.access !== "none";
|
|
49129
49676
|
});
|
|
49130
49677
|
if (!isAllowed) {
|
|
@@ -49524,7 +50071,7 @@ var GitHubTaskTracker = class {
|
|
|
49524
50071
|
cachedProvider = null;
|
|
49525
50072
|
async getProvider() {
|
|
49526
50073
|
if (this.cachedProvider !== null) return this.cachedProvider;
|
|
49527
|
-
const { createScmProvider } = await import("./factory-
|
|
50074
|
+
const { createScmProvider } = await import("./factory-DOWBGVAL.js");
|
|
49528
50075
|
const result = await createScmProvider({ repo: this.config.repo ?? "" });
|
|
49529
50076
|
if (!result.ok) throw new Error(`SCM provider error: ${result.error.message}`);
|
|
49530
50077
|
this.cachedProvider = result.value;
|
|
@@ -50195,6 +50742,7 @@ export {
|
|
|
50195
50742
|
aggregatePrDecisions,
|
|
50196
50743
|
buildPrReviewProposal,
|
|
50197
50744
|
registerPrReviewTool,
|
|
50745
|
+
registerSupplyChainTradeoffPanelTool,
|
|
50198
50746
|
createAnnotationsProxy,
|
|
50199
50747
|
createToolObservabilityProxy,
|
|
50200
50748
|
registerTools,
|
|
@@ -50229,4 +50777,4 @@ export {
|
|
|
50229
50777
|
detectBackend,
|
|
50230
50778
|
createTaskTracker
|
|
50231
50779
|
};
|
|
50232
|
-
//# sourceMappingURL=chunk-
|
|
50780
|
+
//# sourceMappingURL=chunk-4XNVJS5A.js.map
|