nexus-agents 2.98.0 → 2.100.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/{chunk-DE3J2HYT.js → chunk-B364VMMP.js} +471 -193
- package/dist/chunk-B364VMMP.js.map +1 -0
- package/dist/{chunk-6ZXNMJEX.js → chunk-BFN7RO3R.js} +4 -4
- package/dist/{chunk-6ZXNMJEX.js.map → chunk-BFN7RO3R.js.map} +1 -1
- package/dist/{chunk-PK4TTHXW.js → chunk-FU2AMASK.js} +3 -3
- package/dist/{chunk-6IHEDRKI.js → chunk-H4LBBFCO.js} +2 -2
- package/dist/{chunk-G4A7SSML.js → chunk-JFFI54DW.js} +11 -1
- package/dist/{chunk-G4A7SSML.js.map → chunk-JFFI54DW.js.map} +1 -1
- package/dist/{chunk-EM7NUGMG.js → chunk-P453545L.js} +21 -2
- package/dist/chunk-P453545L.js.map +1 -0
- package/dist/{chunk-RCKLAJ2H.js → chunk-TYELRYRO.js} +10 -5
- package/dist/chunk-TYELRYRO.js.map +1 -0
- package/dist/{chunk-MKFLI5DK.js → chunk-YREYQSYA.js} +2 -2
- package/dist/chunk-YREYQSYA.js.map +1 -0
- package/dist/cli.js +17 -10
- package/dist/cli.js.map +1 -1
- package/dist/{consensus-vote-Z3BWJLRE.js → consensus-vote-PGOS5AA6.js} +4 -4
- package/dist/{expert-bridge-EOVHUCJ4.js → expert-bridge-L25WFHQF.js} +2 -2
- package/dist/{factory-NJRJAZKK.js → factory-PVN7DDNZ.js} +2 -2
- package/dist/{improvement-review-Q4LBTVQP.js → improvement-review-IWV2BMR7.js} +3 -3
- package/dist/index.d.ts +27 -0
- package/dist/index.js +8 -8
- package/dist/{setup-command-JVJ2PNL6.js → setup-command-RRBGCIBW.js} +4 -4
- package/package.json +1 -1
- package/dist/chunk-DE3J2HYT.js.map +0 -1
- package/dist/chunk-EM7NUGMG.js.map +0 -1
- package/dist/chunk-MKFLI5DK.js.map +0 -1
- package/dist/chunk-RCKLAJ2H.js.map +0 -1
- /package/dist/{chunk-PK4TTHXW.js.map → chunk-FU2AMASK.js.map} +0 -0
- /package/dist/{chunk-6IHEDRKI.js.map → chunk-H4LBBFCO.js.map} +0 -0
- /package/dist/{consensus-vote-Z3BWJLRE.js.map → consensus-vote-PGOS5AA6.js.map} +0 -0
- /package/dist/{expert-bridge-EOVHUCJ4.js.map → expert-bridge-L25WFHQF.js.map} +0 -0
- /package/dist/{factory-NJRJAZKK.js.map → factory-PVN7DDNZ.js.map} +0 -0
- /package/dist/{improvement-review-Q4LBTVQP.js.map → improvement-review-IWV2BMR7.js.map} +0 -0
- /package/dist/{setup-command-JVJ2PNL6.js.map → setup-command-RRBGCIBW.js.map} +0 -0
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./chunk-UWQ3BALH.js";
|
|
10
10
|
import {
|
|
11
11
|
executeExpert
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-H4LBBFCO.js";
|
|
13
13
|
import {
|
|
14
14
|
EventTopics,
|
|
15
15
|
JobStatusSchema,
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
writeJobComplete,
|
|
31
31
|
writeJobFailed,
|
|
32
32
|
writeJobPending
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-TYELRYRO.js";
|
|
34
34
|
import {
|
|
35
35
|
REGISTRY_PATH,
|
|
36
36
|
getProjectRoot,
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
} from "./chunk-VD4TXDMR.js";
|
|
52
52
|
import {
|
|
53
53
|
withPrerequisite
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-YREYQSYA.js";
|
|
55
55
|
import {
|
|
56
56
|
NOOP_NOTIFIER,
|
|
57
57
|
RateLimiter,
|
|
@@ -70,7 +70,7 @@ import {
|
|
|
70
70
|
withAccessPolicy,
|
|
71
71
|
withProgressHeartbeat,
|
|
72
72
|
wrapToolWithTimeout
|
|
73
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-JFFI54DW.js";
|
|
74
74
|
import {
|
|
75
75
|
generateSecurityPlan
|
|
76
76
|
} from "./chunk-BKUKBOGV.js";
|
|
@@ -92,7 +92,7 @@ import {
|
|
|
92
92
|
DEFAULT_TASK_TTL_MS,
|
|
93
93
|
DEFAULT_TOOL_RATE_LIMITS,
|
|
94
94
|
clampTaskTtl
|
|
95
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-BFN7RO3R.js";
|
|
96
96
|
import {
|
|
97
97
|
getAvailabilityCache,
|
|
98
98
|
getCliForModelId,
|
|
@@ -116,7 +116,7 @@ import {
|
|
|
116
116
|
getAvailableClis,
|
|
117
117
|
sleep,
|
|
118
118
|
withTimeout
|
|
119
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-P453545L.js";
|
|
120
120
|
import {
|
|
121
121
|
generateHyphenId,
|
|
122
122
|
generateUUID
|
|
@@ -23559,10 +23559,10 @@ function calculateZStatistic(params) {
|
|
|
23559
23559
|
function calculateDifferenceCI(p1, p2, total1, total2, confidence) {
|
|
23560
23560
|
const difference = p1 - p2;
|
|
23561
23561
|
const seDiff = Math.sqrt(p1 * (1 - p1) / (total1 || 1) + p2 * (1 - p2) / (total2 || 1));
|
|
23562
|
-
const
|
|
23562
|
+
const z112 = getZScore(confidence);
|
|
23563
23563
|
return {
|
|
23564
|
-
lower: difference -
|
|
23565
|
-
upper: difference +
|
|
23564
|
+
lower: difference - z112 * seDiff,
|
|
23565
|
+
upper: difference + z112 * seDiff,
|
|
23566
23566
|
estimate: difference,
|
|
23567
23567
|
confidence,
|
|
23568
23568
|
n: total1 + total2,
|
|
@@ -23585,11 +23585,11 @@ function proportionConfidenceInterval(successes, total, options = {}) {
|
|
|
23585
23585
|
standardError: 0
|
|
23586
23586
|
};
|
|
23587
23587
|
}
|
|
23588
|
-
const
|
|
23589
|
-
const z210 =
|
|
23588
|
+
const z112 = getZScore(opts.confidence);
|
|
23589
|
+
const z210 = z112 * z112;
|
|
23590
23590
|
const denominator = 1 + z210 / n;
|
|
23591
23591
|
const center = (p + z210 / (2 * n)) / denominator;
|
|
23592
|
-
const margin =
|
|
23592
|
+
const margin = z112 / denominator * Math.sqrt(p * (1 - p) / n + z210 / (4 * n * n));
|
|
23593
23593
|
const lower = Math.max(0, center - margin);
|
|
23594
23594
|
const upper = Math.min(1, center + margin);
|
|
23595
23595
|
const standardError = Math.sqrt(p * (1 - p) / n);
|
|
@@ -23619,8 +23619,8 @@ function meanConfidenceInterval(values, options = {}) {
|
|
|
23619
23619
|
const variance = values.reduce((sum, v) => sum + (v - mean) ** 2, 0) / (n - 1 || 1);
|
|
23620
23620
|
const stdDev = Math.sqrt(variance);
|
|
23621
23621
|
const standardError = stdDev / Math.sqrt(n);
|
|
23622
|
-
const
|
|
23623
|
-
const margin =
|
|
23622
|
+
const z112 = getZScore(opts.confidence);
|
|
23623
|
+
const margin = z112 * standardError;
|
|
23624
23624
|
return {
|
|
23625
23625
|
lower: mean - margin,
|
|
23626
23626
|
upper: mean + margin,
|
|
@@ -42436,7 +42436,7 @@ var VALID_TEMPLATES = /* @__PURE__ */ new Set([
|
|
|
42436
42436
|
]);
|
|
42437
42437
|
async function classifyWithLLM(task) {
|
|
42438
42438
|
try {
|
|
42439
|
-
const { executeExpert: executeExpert2 } = await import("./expert-bridge-
|
|
42439
|
+
const { executeExpert: executeExpert2 } = await import("./expert-bridge-L25WFHQF.js");
|
|
42440
42440
|
const prompt = [
|
|
42441
42441
|
"Classify this task into exactly one pipeline template.",
|
|
42442
42442
|
"Templates: dev (implementation/bug fix/refactor), research (investigate/evaluate/compare),",
|
|
@@ -43181,6 +43181,77 @@ function buildScanSummary(total, confirmed, falsePositives, osvCount) {
|
|
|
43181
43181
|
return parts.join(", ");
|
|
43182
43182
|
}
|
|
43183
43183
|
|
|
43184
|
+
// src/security/quality-gate.ts
|
|
43185
|
+
async function runCommandCheck(name, command, args) {
|
|
43186
|
+
const start = Date.now();
|
|
43187
|
+
try {
|
|
43188
|
+
const { execFile: execFile3 } = await import("child_process");
|
|
43189
|
+
const { promisify: promisify3 } = await import("util");
|
|
43190
|
+
const exec2 = promisify3(execFile3);
|
|
43191
|
+
await exec2(command, [...args], { timeout: 12e4 });
|
|
43192
|
+
return {
|
|
43193
|
+
name,
|
|
43194
|
+
verdict: "pass",
|
|
43195
|
+
details: `${name} completed successfully`,
|
|
43196
|
+
durationMs: Date.now() - start
|
|
43197
|
+
};
|
|
43198
|
+
} catch (error) {
|
|
43199
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
43200
|
+
return {
|
|
43201
|
+
name,
|
|
43202
|
+
verdict: "fail",
|
|
43203
|
+
details: msg.slice(0, 500),
|
|
43204
|
+
durationMs: Date.now() - start
|
|
43205
|
+
};
|
|
43206
|
+
}
|
|
43207
|
+
}
|
|
43208
|
+
function checkTypeCheck(projectDir) {
|
|
43209
|
+
return () => runCommandCheck("type_check", "npx", ["tsc", "--noEmit", "--project", projectDir]);
|
|
43210
|
+
}
|
|
43211
|
+
function checkLint(projectDir) {
|
|
43212
|
+
return () => runCommandCheck("lint", "npx", ["eslint", "--max-warnings", "0", projectDir]);
|
|
43213
|
+
}
|
|
43214
|
+
function checkTests(projectDir) {
|
|
43215
|
+
return () => runCommandCheck("tests", "npx", ["vitest", "run", "--dir", projectDir]);
|
|
43216
|
+
}
|
|
43217
|
+
function checkBuild() {
|
|
43218
|
+
return () => runCommandCheck("build", "pnpm", ["build"]);
|
|
43219
|
+
}
|
|
43220
|
+
function aggregateResults2(checks) {
|
|
43221
|
+
let pass = 0;
|
|
43222
|
+
let fail = 0;
|
|
43223
|
+
let skip = 0;
|
|
43224
|
+
for (const c of checks) {
|
|
43225
|
+
if (c.verdict === "pass") pass++;
|
|
43226
|
+
else if (c.verdict === "fail") fail++;
|
|
43227
|
+
else skip++;
|
|
43228
|
+
}
|
|
43229
|
+
return { verdict: fail > 0 ? "fail" : "pass", summary: { pass, fail, skip } };
|
|
43230
|
+
}
|
|
43231
|
+
function generateFeedback2(checks) {
|
|
43232
|
+
const failures = checks.filter((c) => c.verdict === "fail");
|
|
43233
|
+
if (failures.length === 0) return "All checks passed.";
|
|
43234
|
+
const lines = failures.map((f) => `- ${f.name}: ${f.details}`);
|
|
43235
|
+
return `${String(failures.length)} check(s) failed:
|
|
43236
|
+
${lines.join("\n")}`;
|
|
43237
|
+
}
|
|
43238
|
+
async function runQualityGate(stage, checks, iteration = 1) {
|
|
43239
|
+
const results = [];
|
|
43240
|
+
for (const check of checks) {
|
|
43241
|
+
const result = await check();
|
|
43242
|
+
results.push(result);
|
|
43243
|
+
}
|
|
43244
|
+
const { verdict, summary } = aggregateResults2(results);
|
|
43245
|
+
return {
|
|
43246
|
+
stage,
|
|
43247
|
+
verdict,
|
|
43248
|
+
checks: results,
|
|
43249
|
+
summary,
|
|
43250
|
+
feedback: generateFeedback2(results),
|
|
43251
|
+
iteration
|
|
43252
|
+
};
|
|
43253
|
+
}
|
|
43254
|
+
|
|
43184
43255
|
// src/pipeline/agent-executor.ts
|
|
43185
43256
|
var logger38 = createLogger({ component: "agent-executor" });
|
|
43186
43257
|
function emitStageEvent2(stage, status, details) {
|
|
@@ -43433,7 +43504,7 @@ ${contextBlock}`;
|
|
|
43433
43504
|
const strategy = config.votingStrategy ?? "higher_order";
|
|
43434
43505
|
await postProgress(config, "Vote", `Running consensus with ${strategy} strategy...`);
|
|
43435
43506
|
try {
|
|
43436
|
-
const { executeVoting } = await import("./consensus-vote-
|
|
43507
|
+
const { executeVoting } = await import("./consensus-vote-PGOS5AA6.js");
|
|
43437
43508
|
const votingResult = await executeVoting(
|
|
43438
43509
|
{
|
|
43439
43510
|
proposal: plan.slice(0, 4e3),
|
|
@@ -43566,6 +43637,33 @@ Verdict: PASS/NEEDS_WORK/REJECT`
|
|
|
43566
43637
|
await postProgress(config, `QA [${task.id}]`, review.verdict);
|
|
43567
43638
|
return review;
|
|
43568
43639
|
},
|
|
43640
|
+
qualityGate: async () => {
|
|
43641
|
+
emitStageEvent2("quality-gate", "started");
|
|
43642
|
+
const start = getTimeProvider().now();
|
|
43643
|
+
const target = config.scanTarget ?? process.cwd();
|
|
43644
|
+
await postProgress(config, "QualityGate", `Typecheck/lint/tests on ${target}...`);
|
|
43645
|
+
const result = await runQualityGate("qa", [
|
|
43646
|
+
checkTypeCheck(target),
|
|
43647
|
+
checkLint(target),
|
|
43648
|
+
checkTests(target)
|
|
43649
|
+
]);
|
|
43650
|
+
const passed = result.verdict !== "fail";
|
|
43651
|
+
const ms = getTimeProvider().now() - start;
|
|
43652
|
+
emitStageEvent2("quality-gate", passed ? "completed" : "failed", { durationMs: ms });
|
|
43653
|
+
recordOutcome({
|
|
43654
|
+
taskId: "quality-gate",
|
|
43655
|
+
category: "code_review",
|
|
43656
|
+
cli: void 0,
|
|
43657
|
+
success: passed,
|
|
43658
|
+
durationMs: ms
|
|
43659
|
+
});
|
|
43660
|
+
await postProgress(
|
|
43661
|
+
config,
|
|
43662
|
+
"QualityGate",
|
|
43663
|
+
passed ? "Passed" : `Gate failed: ${result.feedback}`
|
|
43664
|
+
);
|
|
43665
|
+
return { passed, feedback: result.feedback };
|
|
43666
|
+
},
|
|
43569
43667
|
securityScan: async () => {
|
|
43570
43668
|
emitStageEvent2("security", "started");
|
|
43571
43669
|
const start = getTimeProvider().now();
|
|
@@ -43864,7 +43962,13 @@ async function runDevPipelineInner(task, stages, options, sid, prior) {
|
|
|
43864
43962
|
logger41.info("Harness mode \u2014 returning tasks for external implementation");
|
|
43865
43963
|
return buildHarnessResult(planResult, tasks);
|
|
43866
43964
|
}
|
|
43867
|
-
const result = await runImplSecurityPhase(
|
|
43965
|
+
const result = await runImplSecurityPhase(
|
|
43966
|
+
planResult,
|
|
43967
|
+
tasks,
|
|
43968
|
+
stages,
|
|
43969
|
+
sid,
|
|
43970
|
+
options?.qualityGate ?? "off"
|
|
43971
|
+
);
|
|
43868
43972
|
applyPipelineHindsight(bm, task, sid, result);
|
|
43869
43973
|
return result;
|
|
43870
43974
|
}
|
|
@@ -43980,10 +44084,21 @@ function buildHarnessResult(planResult, tasks) {
|
|
|
43980
44084
|
securityPassed: false
|
|
43981
44085
|
};
|
|
43982
44086
|
}
|
|
43983
|
-
async function runImplSecurityPhase(planResult, tasks, stages, sid) {
|
|
44087
|
+
async function runImplSecurityPhase(planResult, tasks, stages, sid, qualityGateMode) {
|
|
43984
44088
|
const implResult = await implementQaLoop(tasks, stages);
|
|
43985
44089
|
if (sid !== void 0)
|
|
43986
44090
|
saveStageCheckpoint(sid, "implement", { type: "implement", tasks: implResult.completedTasks });
|
|
44091
|
+
const qaGate = await runQualityGateStage(stages, qualityGateMode);
|
|
44092
|
+
if (qualityGateMode === "blocking" && !qaGate.passed) {
|
|
44093
|
+
return {
|
|
44094
|
+
completed: false,
|
|
44095
|
+
plan: planResult.plan,
|
|
44096
|
+
tasks: implResult.completedTasks.length > 0 ? implResult.completedTasks : tasks,
|
|
44097
|
+
voteIterations: planResult.iterations,
|
|
44098
|
+
qaIterations: implResult.totalIterations,
|
|
44099
|
+
securityPassed: false
|
|
44100
|
+
};
|
|
44101
|
+
}
|
|
43987
44102
|
const security = await withStep(
|
|
43988
44103
|
{ name: "security-scan", kind: "pipeline.stage" },
|
|
43989
44104
|
async (ctx) => {
|
|
@@ -44005,6 +44120,26 @@ async function runImplSecurityPhase(planResult, tasks, stages, sid) {
|
|
|
44005
44120
|
securityPassed: security.passed
|
|
44006
44121
|
};
|
|
44007
44122
|
}
|
|
44123
|
+
async function runQualityGateStage(stages, mode) {
|
|
44124
|
+
if (mode === "off" || stages.qualityGate === void 0) {
|
|
44125
|
+
return { passed: true, feedback: "Quality gate skipped" };
|
|
44126
|
+
}
|
|
44127
|
+
const runGate = stages.qualityGate.bind(stages);
|
|
44128
|
+
return withStep(
|
|
44129
|
+
{ name: "quality-gate", kind: "pipeline.stage", attrs: { mode } },
|
|
44130
|
+
async (ctx) => {
|
|
44131
|
+
const r = await runGate();
|
|
44132
|
+
const advisory = mode === "advisory" && !r.passed;
|
|
44133
|
+
ctx.setSummary(r.passed ? "passed" : advisory ? "FAILED (advisory)" : "FAILED");
|
|
44134
|
+
if (advisory) {
|
|
44135
|
+
logger41.warn("Quality gate failed (advisory \u2014 not blocking)", {
|
|
44136
|
+
feedback: r.feedback.slice(0, 200)
|
|
44137
|
+
});
|
|
44138
|
+
}
|
|
44139
|
+
return r;
|
|
44140
|
+
}
|
|
44141
|
+
);
|
|
44142
|
+
}
|
|
44008
44143
|
async function runOrResume(prior, stage, run) {
|
|
44009
44144
|
if (prior?.research !== void 0 && stage === "research") {
|
|
44010
44145
|
logger41.info("Resuming from checkpoint", { stage });
|
|
@@ -45905,12 +46040,131 @@ function registerCiHealthCheckTool(server, deps) {
|
|
|
45905
46040
|
logger55.info("Registered ci_health_check tool");
|
|
45906
46041
|
}
|
|
45907
46042
|
|
|
46043
|
+
// src/mcp/tools/quality-gate-tool.ts
|
|
46044
|
+
import { statSync as statSync3 } from "fs";
|
|
46045
|
+
import { z as z101 } from "zod";
|
|
46046
|
+
var QualityCheckSchema = z101.enum(["typecheck", "lint", "tests", "build", "security"]);
|
|
46047
|
+
var DEFAULT_CHECKS = ["typecheck", "lint", "tests"];
|
|
46048
|
+
var RunQualityGateInputSchema = z101.object({
|
|
46049
|
+
/** Project directory to run checks against. Must resolve inside the repo/cwd root. */
|
|
46050
|
+
projectDir: z101.string().optional().describe(
|
|
46051
|
+
"Project directory to run checks against (default: cwd). Must stay inside the repo root."
|
|
46052
|
+
),
|
|
46053
|
+
/** Which allowlisted checks to run. */
|
|
46054
|
+
checks: z101.array(QualityCheckSchema).nonempty().default([...DEFAULT_CHECKS]).describe("Allowlisted checks to run (default: ['typecheck','lint','tests'])."),
|
|
46055
|
+
/** 1-based iteration counter, forwarded to the engine for feedback context. */
|
|
46056
|
+
iteration: z101.number().int().min(1).default(1).describe("1-based iteration number (default 1).")
|
|
46057
|
+
});
|
|
46058
|
+
function validateProjectDir(raw) {
|
|
46059
|
+
const candidate = raw ?? process.cwd();
|
|
46060
|
+
const safe = resolveInsideRoot(candidate);
|
|
46061
|
+
if (safe === null) {
|
|
46062
|
+
return {
|
|
46063
|
+
error: toolStructuredError({
|
|
46064
|
+
errorCategory: "permission",
|
|
46065
|
+
message: `Invalid projectDir: "${candidate}" resolves outside the repository root (path traversal rejected).`
|
|
46066
|
+
})
|
|
46067
|
+
};
|
|
46068
|
+
}
|
|
46069
|
+
let stat5;
|
|
46070
|
+
try {
|
|
46071
|
+
stat5 = statSync3(safe);
|
|
46072
|
+
} catch {
|
|
46073
|
+
return {
|
|
46074
|
+
error: toolStructuredError({
|
|
46075
|
+
errorCategory: "validation",
|
|
46076
|
+
message: `Invalid projectDir: "${candidate}" does not exist.`
|
|
46077
|
+
})
|
|
46078
|
+
};
|
|
46079
|
+
}
|
|
46080
|
+
if (!stat5.isDirectory()) {
|
|
46081
|
+
return {
|
|
46082
|
+
error: toolStructuredError({
|
|
46083
|
+
errorCategory: "validation",
|
|
46084
|
+
message: `Invalid projectDir: "${candidate}" is not a directory.`
|
|
46085
|
+
})
|
|
46086
|
+
};
|
|
46087
|
+
}
|
|
46088
|
+
return { dir: safe };
|
|
46089
|
+
}
|
|
46090
|
+
function buildCheck(name, projectDir) {
|
|
46091
|
+
switch (name) {
|
|
46092
|
+
case "typecheck":
|
|
46093
|
+
return checkTypeCheck(projectDir);
|
|
46094
|
+
case "lint":
|
|
46095
|
+
return checkLint(projectDir);
|
|
46096
|
+
case "tests":
|
|
46097
|
+
return checkTests(projectDir);
|
|
46098
|
+
case "build":
|
|
46099
|
+
return checkBuild();
|
|
46100
|
+
case "security":
|
|
46101
|
+
return checkSecurityScan(projectDir);
|
|
46102
|
+
}
|
|
46103
|
+
}
|
|
46104
|
+
async function runQualityGateHandler(args, logger55) {
|
|
46105
|
+
const parsed = RunQualityGateInputSchema.safeParse(args);
|
|
46106
|
+
if (!parsed.success) {
|
|
46107
|
+
return toolStructuredError({
|
|
46108
|
+
errorCategory: "validation",
|
|
46109
|
+
message: `Validation error: ${formatZodError(parsed.error)}`
|
|
46110
|
+
});
|
|
46111
|
+
}
|
|
46112
|
+
const { projectDir, checks, iteration } = parsed.data;
|
|
46113
|
+
const validated = validateProjectDir(projectDir);
|
|
46114
|
+
if ("error" in validated) return validated.error;
|
|
46115
|
+
const checkFns = checks.map((name) => buildCheck(name, validated.dir));
|
|
46116
|
+
logger55.info("Running quality gate", { checks, iteration });
|
|
46117
|
+
try {
|
|
46118
|
+
const result = await runQualityGate("qa", checkFns, iteration);
|
|
46119
|
+
return toolSuccess(JSON.stringify(result, null, 2));
|
|
46120
|
+
} catch (err2) {
|
|
46121
|
+
return toolStructuredError({
|
|
46122
|
+
errorCategory: "internal",
|
|
46123
|
+
message: `Quality gate execution failed: ${err2 instanceof Error ? err2.message : String(err2)}`
|
|
46124
|
+
});
|
|
46125
|
+
}
|
|
46126
|
+
}
|
|
46127
|
+
var DESCRIPTION2 = "Run the QA quality gate (#1684 engine) against a project directory. Allowlisted checks: typecheck | lint | tests | build | security (default ['typecheck','lint','tests']). Returns the structured { stage, verdict, checks[], summary, feedback } verdict. projectDir must stay inside the repository root; per-check output is capped at 500 chars.";
|
|
46128
|
+
function registerRunQualityGateTool(server, deps) {
|
|
46129
|
+
const logger55 = deps.logger ?? createLogger({ tool: "run_quality_gate" });
|
|
46130
|
+
const toolSchema = {
|
|
46131
|
+
projectDir: z101.string().optional().describe(
|
|
46132
|
+
"Project directory to run checks against (default: cwd). Must stay inside the repo root."
|
|
46133
|
+
),
|
|
46134
|
+
checks: z101.array(QualityCheckSchema).nonempty().optional().describe("Allowlisted checks to run (default: ['typecheck','lint','tests'])."),
|
|
46135
|
+
iteration: z101.number().int().min(1).optional().describe("1-based iteration number (default 1).")
|
|
46136
|
+
};
|
|
46137
|
+
const secureHandler = createSecureHandler(
|
|
46138
|
+
(args) => runQualityGateHandler(args, logger55),
|
|
46139
|
+
{
|
|
46140
|
+
toolName: "run_quality_gate",
|
|
46141
|
+
rateLimiter: deps.rateLimiter,
|
|
46142
|
+
logger: logger55
|
|
46143
|
+
}
|
|
46144
|
+
);
|
|
46145
|
+
const timeoutMs = getToolTimeout("run_quality_gate", deps.security);
|
|
46146
|
+
const wrappedHandler = wrapToolWithTimeout("run_quality_gate", secureHandler, {
|
|
46147
|
+
timeoutMs,
|
|
46148
|
+
logger: logger55
|
|
46149
|
+
});
|
|
46150
|
+
server.registerTool(
|
|
46151
|
+
"run_quality_gate",
|
|
46152
|
+
{
|
|
46153
|
+
description: DESCRIPTION2,
|
|
46154
|
+
inputSchema: toolSchema,
|
|
46155
|
+
annotations: getToolAnnotations("run_quality_gate")
|
|
46156
|
+
},
|
|
46157
|
+
toSdkCallback(wrappedHandler)
|
|
46158
|
+
);
|
|
46159
|
+
logger55.info("Registered run_quality_gate tool");
|
|
46160
|
+
}
|
|
46161
|
+
|
|
45908
46162
|
// src/mcp/tools/verify-audit-chain-tool.ts
|
|
45909
46163
|
import * as fs12 from "fs/promises";
|
|
45910
46164
|
import * as path11 from "path";
|
|
45911
|
-
import { z as
|
|
45912
|
-
var VerifyAuditChainInputSchema =
|
|
45913
|
-
logDir:
|
|
46165
|
+
import { z as z102 } from "zod";
|
|
46166
|
+
var VerifyAuditChainInputSchema = z102.object({
|
|
46167
|
+
logDir: z102.string().min(1).max(512).describe(
|
|
45914
46168
|
"Filesystem path to the FileAuditStorage log directory. Tool reads all `audit-*.jsonl` files in lexicographic order and verifies the combined chain."
|
|
45915
46169
|
)
|
|
45916
46170
|
});
|
|
@@ -45987,7 +46241,7 @@ async function handler2(args, ctx) {
|
|
|
45987
46241
|
function registerVerifyAuditChainTool(server, deps) {
|
|
45988
46242
|
const logger55 = deps.logger ?? createLogger({ tool: "verify_audit_chain" });
|
|
45989
46243
|
const toolSchema = {
|
|
45990
|
-
logDir:
|
|
46244
|
+
logDir: z102.string().min(1).max(512).describe(
|
|
45991
46245
|
"Filesystem path to the FileAuditStorage log directory. Tool reads all `audit-*.jsonl` files and verifies the combined hash chain."
|
|
45992
46246
|
)
|
|
45993
46247
|
};
|
|
@@ -46011,18 +46265,18 @@ function registerVerifyAuditChainTool(server, deps) {
|
|
|
46011
46265
|
}
|
|
46012
46266
|
|
|
46013
46267
|
// src/mcp/tools/pipeline-tool.ts
|
|
46014
|
-
import { z as
|
|
46268
|
+
import { z as z103 } from "zod";
|
|
46015
46269
|
import * as fs13 from "fs";
|
|
46016
46270
|
import * as path12 from "path";
|
|
46017
|
-
var PipelineInputSchema =
|
|
46271
|
+
var PipelineInputSchema = z103.object({
|
|
46018
46272
|
/** The task to execute. */
|
|
46019
|
-
task:
|
|
46273
|
+
task: z103.string().min(5).max(1e4).describe("Task description \u2014 pipeline template auto-selected based on content"),
|
|
46020
46274
|
/** Path to a spec file (.md, .yaml) to use as task input. */
|
|
46021
|
-
specFile:
|
|
46275
|
+
specFile: z103.string().max(500).optional().describe("Path to a spec file \u2014 content prepended to task for greenfield projects"),
|
|
46022
46276
|
/** Override template — see `listTemplateIds()` for the canonical list (#2728). Auto-detected if omitted. */
|
|
46023
|
-
template:
|
|
46277
|
+
template: z103.string().max(50).optional().describe(`Pipeline template override. Available: ${listTemplateIds().join(", ")}`),
|
|
46024
46278
|
/** Voting strategy for consensus stages. */
|
|
46025
|
-
votingStrategy:
|
|
46279
|
+
votingStrategy: z103.enum([
|
|
46026
46280
|
"simple_majority",
|
|
46027
46281
|
"supermajority",
|
|
46028
46282
|
"unanimous",
|
|
@@ -46033,13 +46287,13 @@ var PipelineInputSchema = z102.object({
|
|
|
46033
46287
|
"Voting strategy for plan approval. simple_majority (default), supermajority (67%), unanimous, higher_order (Bayesian), proof_of_learning, opinion_wise"
|
|
46034
46288
|
),
|
|
46035
46289
|
/** Use 3 agents instead of 6 for faster voting. */
|
|
46036
|
-
quickMode:
|
|
46290
|
+
quickMode: z103.boolean().default(false).describe("Use 3 agents instead of 6 for faster consensus voting"),
|
|
46037
46291
|
/** Maximum execution time per stage in milliseconds (min 30s, max 600s). */
|
|
46038
|
-
timeoutMs:
|
|
46292
|
+
timeoutMs: z103.number().int().min(3e4).max(6e5).optional().describe("Max time per stage in ms (30000-600000). Default: varies by stage complexity"),
|
|
46039
46293
|
/** Stop after planning/voting (no implementation). */
|
|
46040
|
-
dryRun:
|
|
46294
|
+
dryRun: z103.boolean().default(false).describe("Stop after vote stage (no implementation)"),
|
|
46041
46295
|
/** TESTS ONLY — random output, must not be used for real decisions. (#2319) */
|
|
46042
|
-
simulateVotes:
|
|
46296
|
+
simulateVotes: z103.boolean().default(false).describe("TESTS ONLY \u2014 random output, must not be used for real decisions (#2319)")
|
|
46043
46297
|
});
|
|
46044
46298
|
function buildOutput2(result) {
|
|
46045
46299
|
return {
|
|
@@ -46141,7 +46395,7 @@ function registerPipelineTool(server, deps) {
|
|
|
46141
46395
|
}
|
|
46142
46396
|
|
|
46143
46397
|
// src/mcp/tools/supply-chain-tradeoff-panel.ts
|
|
46144
|
-
import { z as
|
|
46398
|
+
import { z as z104 } from "zod";
|
|
46145
46399
|
var DEFAULT_AXES = [
|
|
46146
46400
|
"build_time_determinism",
|
|
46147
46401
|
"supply_chain_risk",
|
|
@@ -46161,16 +46415,16 @@ var FULL_PANEL = [
|
|
|
46161
46415
|
"scope_steward"
|
|
46162
46416
|
];
|
|
46163
46417
|
var QUICK_PANEL = ["architect", "security", "scope_steward"];
|
|
46164
|
-
var SupplyChainTradeoffPanelInputSchema =
|
|
46165
|
-
proposal:
|
|
46166
|
-
axes:
|
|
46418
|
+
var SupplyChainTradeoffPanelInputSchema = z104.object({
|
|
46419
|
+
proposal: z104.string().min(1).max(MAX_PROPOSAL_LENGTH).describe('The proposal under tradeoff review (e.g. "Should aegis-boot adopt cargo-nextest?")'),
|
|
46420
|
+
axes: z104.array(z104.string().min(1).max(MAX_AXIS_NAME_LENGTH)).min(1).max(MAX_AXES).optional().describe(
|
|
46167
46421
|
`Tradeoff axes to evaluate. Default: ${DEFAULT_AXES.join(", ")}. Custom axes accepted; max ${String(MAX_AXES)}.`
|
|
46168
46422
|
),
|
|
46169
|
-
context:
|
|
46423
|
+
context: z104.string().max(MAX_CONTEXT_LENGTH).optional().describe(
|
|
46170
46424
|
"Optional context: relevant repo state, dependency tree, vendor publishing patterns, etc."
|
|
46171
46425
|
),
|
|
46172
|
-
quickMode:
|
|
46173
|
-
simulate:
|
|
46426
|
+
quickMode: z104.boolean().optional().default(false).describe("Use 3 voters (architect, security, scope_steward) instead of 7"),
|
|
46427
|
+
simulate: z104.boolean().optional().default(false).describe("Use simulated voters (testing only)")
|
|
46174
46428
|
});
|
|
46175
46429
|
function buildTradeoffProposal(input) {
|
|
46176
46430
|
const axes = input.axes ?? DEFAULT_AXES;
|
|
@@ -46676,6 +46930,28 @@ var TOOL_ANNOTATIONS = {
|
|
|
46676
46930
|
{ category: "implicit", description: "Consumes rate limit quota" }
|
|
46677
46931
|
]
|
|
46678
46932
|
},
|
|
46933
|
+
run_quality_gate: {
|
|
46934
|
+
annotations: {
|
|
46935
|
+
title: "Run Quality Gate",
|
|
46936
|
+
// Spawns build/test toolchains which can write artifacts — not read-only.
|
|
46937
|
+
readOnlyHint: false,
|
|
46938
|
+
destructiveHint: false,
|
|
46939
|
+
// Same checks against the same code yield the same verdict.
|
|
46940
|
+
idempotentHint: true,
|
|
46941
|
+
// build/test/security invoke local toolchains and may reach the network.
|
|
46942
|
+
openWorldHint: true
|
|
46943
|
+
},
|
|
46944
|
+
sideEffects: [
|
|
46945
|
+
{
|
|
46946
|
+
category: "implicit",
|
|
46947
|
+
description: "Spawns local toolchain processes (tsc/eslint/vitest/build) in the target project dir"
|
|
46948
|
+
},
|
|
46949
|
+
{
|
|
46950
|
+
category: "implicit",
|
|
46951
|
+
description: "build/test checks may write build artifacts and coverage output to disk"
|
|
46952
|
+
}
|
|
46953
|
+
]
|
|
46954
|
+
},
|
|
46679
46955
|
issue_triage: {
|
|
46680
46956
|
annotations: {
|
|
46681
46957
|
title: "Issue Triage",
|
|
@@ -47100,7 +47376,8 @@ var REGISTERED_TOOL_NAMES = [
|
|
|
47100
47376
|
"run_pipeline",
|
|
47101
47377
|
"pr_review",
|
|
47102
47378
|
"supply_chain_tradeoff_panel",
|
|
47103
|
-
"improvement_review"
|
|
47379
|
+
"improvement_review",
|
|
47380
|
+
"run_quality_gate"
|
|
47104
47381
|
];
|
|
47105
47382
|
function registerTools(server, options) {
|
|
47106
47383
|
const logger55 = options?.logger ?? createMcpLogger({ component: "tools" });
|
|
@@ -47235,40 +47512,40 @@ var RiskLevel = /* @__PURE__ */ ((RiskLevel2) => {
|
|
|
47235
47512
|
})(RiskLevel || {});
|
|
47236
47513
|
|
|
47237
47514
|
// src/mcp/safety/stpa-schemas.ts
|
|
47238
|
-
import { z as
|
|
47239
|
-
var HazardCategorySchema =
|
|
47240
|
-
var HazardSeveritySchema =
|
|
47241
|
-
var ConstraintPrioritySchema =
|
|
47242
|
-
var RiskLevelSchema =
|
|
47243
|
-
var TriggerPatternSchema =
|
|
47244
|
-
parameter:
|
|
47245
|
-
matchType:
|
|
47246
|
-
pattern:
|
|
47247
|
-
reason:
|
|
47515
|
+
import { z as z105 } from "zod";
|
|
47516
|
+
var HazardCategorySchema = z105.enum(HazardCategory);
|
|
47517
|
+
var HazardSeveritySchema = z105.enum(HazardSeverity);
|
|
47518
|
+
var ConstraintPrioritySchema = z105.enum(ConstraintPriority);
|
|
47519
|
+
var RiskLevelSchema = z105.enum(RiskLevel);
|
|
47520
|
+
var TriggerPatternSchema = z105.object({
|
|
47521
|
+
parameter: z105.string().min(1),
|
|
47522
|
+
matchType: z105.enum(["contains", "regex", "equals", "startsWith", "endsWith"]),
|
|
47523
|
+
pattern: z105.string(),
|
|
47524
|
+
reason: z105.string()
|
|
47248
47525
|
});
|
|
47249
|
-
var HazardSchema =
|
|
47250
|
-
id:
|
|
47251
|
-
description:
|
|
47526
|
+
var HazardSchema = z105.object({
|
|
47527
|
+
id: z105.string().min(1),
|
|
47528
|
+
description: z105.string(),
|
|
47252
47529
|
category: HazardCategorySchema,
|
|
47253
47530
|
severity: HazardSeveritySchema,
|
|
47254
|
-
likelihood:
|
|
47255
|
-
triggerConditions:
|
|
47256
|
-
consequences:
|
|
47531
|
+
likelihood: z105.enum(["almost_certain", "likely", "possible", "unlikely", "rare"]),
|
|
47532
|
+
triggerConditions: z105.array(z105.string()),
|
|
47533
|
+
consequences: z105.array(z105.string())
|
|
47257
47534
|
});
|
|
47258
|
-
var UnsafeControlActionSchema =
|
|
47259
|
-
id:
|
|
47260
|
-
toolName:
|
|
47261
|
-
type:
|
|
47262
|
-
description:
|
|
47263
|
-
unsafeContext:
|
|
47264
|
-
relatedHazards:
|
|
47265
|
-
triggerPatterns:
|
|
47535
|
+
var UnsafeControlActionSchema = z105.object({
|
|
47536
|
+
id: z105.string().min(1),
|
|
47537
|
+
toolName: z105.string().min(1),
|
|
47538
|
+
type: z105.enum(["not_provided", "provided_causes_hazard", "wrong_timing", "wrong_duration"]),
|
|
47539
|
+
description: z105.string(),
|
|
47540
|
+
unsafeContext: z105.string(),
|
|
47541
|
+
relatedHazards: z105.array(z105.string()),
|
|
47542
|
+
triggerPatterns: z105.array(TriggerPatternSchema).optional()
|
|
47266
47543
|
});
|
|
47267
|
-
var SafetyConstraintSchema =
|
|
47268
|
-
id:
|
|
47269
|
-
description:
|
|
47270
|
-
mitigates:
|
|
47271
|
-
enforcement:
|
|
47544
|
+
var SafetyConstraintSchema = z105.object({
|
|
47545
|
+
id: z105.string().min(1),
|
|
47546
|
+
description: z105.string(),
|
|
47547
|
+
mitigates: z105.array(z105.string()),
|
|
47548
|
+
enforcement: z105.enum([
|
|
47272
47549
|
"prevent",
|
|
47273
47550
|
"require_confirmation",
|
|
47274
47551
|
"alert",
|
|
@@ -47276,54 +47553,54 @@ var SafetyConstraintSchema = z104.object({
|
|
|
47276
47553
|
"rate_limit",
|
|
47277
47554
|
"require_privilege"
|
|
47278
47555
|
]),
|
|
47279
|
-
validationFunction:
|
|
47556
|
+
validationFunction: z105.string().optional(),
|
|
47280
47557
|
priority: ConstraintPrioritySchema
|
|
47281
47558
|
});
|
|
47282
|
-
var PropertySchemaSchema =
|
|
47283
|
-
type:
|
|
47284
|
-
description:
|
|
47285
|
-
enum:
|
|
47286
|
-
pattern:
|
|
47287
|
-
minimum:
|
|
47288
|
-
maximum:
|
|
47559
|
+
var PropertySchemaSchema = z105.object({
|
|
47560
|
+
type: z105.string(),
|
|
47561
|
+
description: z105.string().optional(),
|
|
47562
|
+
enum: z105.array(z105.unknown()).optional(),
|
|
47563
|
+
pattern: z105.string().optional(),
|
|
47564
|
+
minimum: z105.number().optional(),
|
|
47565
|
+
maximum: z105.number().optional()
|
|
47289
47566
|
});
|
|
47290
|
-
var ToolInputSchemaSchema =
|
|
47291
|
-
type:
|
|
47292
|
-
properties:
|
|
47293
|
-
required:
|
|
47294
|
-
additionalProperties:
|
|
47567
|
+
var ToolInputSchemaSchema = z105.object({
|
|
47568
|
+
type: z105.string(),
|
|
47569
|
+
properties: z105.record(z105.string(), PropertySchemaSchema).optional(),
|
|
47570
|
+
required: z105.array(z105.string()).optional(),
|
|
47571
|
+
additionalProperties: z105.boolean().optional()
|
|
47295
47572
|
});
|
|
47296
|
-
var ToolDefinitionSchema =
|
|
47297
|
-
name:
|
|
47298
|
-
description:
|
|
47573
|
+
var ToolDefinitionSchema = z105.object({
|
|
47574
|
+
name: z105.string().min(1),
|
|
47575
|
+
description: z105.string(),
|
|
47299
47576
|
inputSchema: ToolInputSchemaSchema
|
|
47300
47577
|
});
|
|
47301
|
-
var AnalysisConfigurationSchema =
|
|
47302
|
-
includeLowSeverity:
|
|
47303
|
-
generateAllConstraints:
|
|
47304
|
-
checkInteractions:
|
|
47305
|
-
maxHazardsPerTool:
|
|
47306
|
-
categories:
|
|
47578
|
+
var AnalysisConfigurationSchema = z105.object({
|
|
47579
|
+
includeLowSeverity: z105.boolean().default(true),
|
|
47580
|
+
generateAllConstraints: z105.boolean().default(true),
|
|
47581
|
+
checkInteractions: z105.boolean().default(true),
|
|
47582
|
+
maxHazardsPerTool: z105.number().int().min(1).max(100).default(50),
|
|
47583
|
+
categories: z105.array(HazardCategorySchema).default([])
|
|
47307
47584
|
});
|
|
47308
|
-
var ConstraintViolationSchema =
|
|
47309
|
-
constraintId:
|
|
47310
|
-
constraintDescription:
|
|
47585
|
+
var ConstraintViolationSchema = z105.object({
|
|
47586
|
+
constraintId: z105.string().min(1),
|
|
47587
|
+
constraintDescription: z105.string(),
|
|
47311
47588
|
severity: HazardSeveritySchema,
|
|
47312
|
-
details:
|
|
47313
|
-
remediation:
|
|
47589
|
+
details: z105.string(),
|
|
47590
|
+
remediation: z105.string()
|
|
47314
47591
|
});
|
|
47315
|
-
var ValidationWarningSchema =
|
|
47316
|
-
code:
|
|
47317
|
-
message:
|
|
47318
|
-
affected:
|
|
47592
|
+
var ValidationWarningSchema = z105.object({
|
|
47593
|
+
code: z105.string().min(1),
|
|
47594
|
+
message: z105.string(),
|
|
47595
|
+
affected: z105.string()
|
|
47319
47596
|
});
|
|
47320
|
-
var ValidationResultSchema =
|
|
47321
|
-
valid:
|
|
47322
|
-
toolName:
|
|
47323
|
-
violations:
|
|
47324
|
-
passed:
|
|
47325
|
-
warnings:
|
|
47326
|
-
validatedAt:
|
|
47597
|
+
var ValidationResultSchema = z105.object({
|
|
47598
|
+
valid: z105.boolean(),
|
|
47599
|
+
toolName: z105.string().min(1),
|
|
47600
|
+
violations: z105.array(ConstraintViolationSchema),
|
|
47601
|
+
passed: z105.array(z105.string()),
|
|
47602
|
+
warnings: z105.array(ValidationWarningSchema),
|
|
47603
|
+
validatedAt: z105.date()
|
|
47327
47604
|
});
|
|
47328
47605
|
|
|
47329
47606
|
// src/mcp/safety/stpa-types.ts
|
|
@@ -48408,43 +48685,43 @@ var GeminiResponseParser = class {
|
|
|
48408
48685
|
};
|
|
48409
48686
|
|
|
48410
48687
|
// src/cli-adapters/router-types.ts
|
|
48411
|
-
import { z as
|
|
48412
|
-
var RouterConfigSchema =
|
|
48413
|
-
minCapacityThreshold:
|
|
48414
|
-
preferCostEfficient:
|
|
48415
|
-
maxDecisionTimeMs:
|
|
48688
|
+
import { z as z106 } from "zod";
|
|
48689
|
+
var RouterConfigSchema = z106.object({
|
|
48690
|
+
minCapacityThreshold: z106.number().min(0).max(1).default(0.1),
|
|
48691
|
+
preferCostEfficient: z106.boolean().default(false),
|
|
48692
|
+
maxDecisionTimeMs: z106.number().min(1).max(1e3).default(100)
|
|
48416
48693
|
});
|
|
48417
48694
|
|
|
48418
48695
|
// src/cli-adapters/agreement-cascade-types.ts
|
|
48419
|
-
import { z as
|
|
48420
|
-
var AgreementCascadeConfigSchema =
|
|
48421
|
-
agreementThreshold:
|
|
48422
|
-
maxStages:
|
|
48423
|
-
modelTimeoutMs:
|
|
48696
|
+
import { z as z107 } from "zod";
|
|
48697
|
+
var AgreementCascadeConfigSchema = z107.object({
|
|
48698
|
+
agreementThreshold: z107.number().min(0.5).max(1).default(0.7),
|
|
48699
|
+
maxStages: z107.number().int().min(1).max(5).default(3),
|
|
48700
|
+
modelTimeoutMs: z107.number().int().min(1e3).max(3e5).default(6e4)
|
|
48424
48701
|
});
|
|
48425
48702
|
|
|
48426
48703
|
// src/cli-adapters/agreement-cascade-router.ts
|
|
48427
48704
|
var logger45 = createLogger({ component: "agreement-cascade-router" });
|
|
48428
48705
|
|
|
48429
48706
|
// src/cli-adapters/task-classifier.ts
|
|
48430
|
-
import { z as
|
|
48431
|
-
var ClassificationPatternsSchema =
|
|
48432
|
-
code:
|
|
48433
|
-
research:
|
|
48434
|
-
documentation:
|
|
48435
|
-
analysis:
|
|
48707
|
+
import { z as z108 } from "zod";
|
|
48708
|
+
var ClassificationPatternsSchema = z108.object({
|
|
48709
|
+
code: z108.array(z108.string()).readonly(),
|
|
48710
|
+
research: z108.array(z108.string()).readonly(),
|
|
48711
|
+
documentation: z108.array(z108.string()).readonly(),
|
|
48712
|
+
analysis: z108.array(z108.string()).readonly()
|
|
48436
48713
|
});
|
|
48437
48714
|
|
|
48438
48715
|
// src/cli-adapters/response-cache-types.ts
|
|
48439
|
-
import { z as
|
|
48440
|
-
var ResponseCacheConfigSchema =
|
|
48441
|
-
defaultTTL:
|
|
48716
|
+
import { z as z109 } from "zod";
|
|
48717
|
+
var ResponseCacheConfigSchema = z109.object({
|
|
48718
|
+
defaultTTL: z109.number().min(1e3).max(36e5).default(3e5),
|
|
48442
48719
|
// 5 minutes
|
|
48443
|
-
maxEntries:
|
|
48444
|
-
maxMemoryMB:
|
|
48445
|
-
cleanupInterval:
|
|
48720
|
+
maxEntries: z109.number().min(10).max(1e5).default(1e3),
|
|
48721
|
+
maxMemoryMB: z109.number().min(1).max(1e3).default(50),
|
|
48722
|
+
cleanupInterval: z109.number().min(1e3).max(6e5).default(6e4),
|
|
48446
48723
|
// 1 minute
|
|
48447
|
-
enableLogging:
|
|
48724
|
+
enableLogging: z109.boolean().default(false)
|
|
48448
48725
|
});
|
|
48449
48726
|
|
|
48450
48727
|
// src/cli-adapters/response-cache-utils.ts
|
|
@@ -48452,12 +48729,12 @@ import { createHash as createHash4 } from "crypto";
|
|
|
48452
48729
|
var logger46 = createLogger({ component: "ResponseCacheUtils" });
|
|
48453
48730
|
|
|
48454
48731
|
// src/cli-adapters/unified-routing-types.ts
|
|
48455
|
-
import { z as
|
|
48456
|
-
var UnifiedRoutingDecisionSchema =
|
|
48457
|
-
selectedCli:
|
|
48458
|
-
confidence:
|
|
48459
|
-
reason:
|
|
48460
|
-
strategy:
|
|
48732
|
+
import { z as z110 } from "zod";
|
|
48733
|
+
var UnifiedRoutingDecisionSchema = z110.object({
|
|
48734
|
+
selectedCli: z110.string(),
|
|
48735
|
+
confidence: z110.number().min(0).max(1),
|
|
48736
|
+
reason: z110.string(),
|
|
48737
|
+
strategy: z110.enum([
|
|
48461
48738
|
"composite",
|
|
48462
48739
|
"quality",
|
|
48463
48740
|
"budget",
|
|
@@ -48469,57 +48746,57 @@ var UnifiedRoutingDecisionSchema = z109.object({
|
|
|
48469
48746
|
"linucb",
|
|
48470
48747
|
"direct"
|
|
48471
48748
|
]),
|
|
48472
|
-
decisionTimeMs:
|
|
48473
|
-
alternatives:
|
|
48474
|
-
stagesExecuted:
|
|
48475
|
-
withinBudget:
|
|
48476
|
-
estimatedComplexity:
|
|
48477
|
-
estimatedTokens:
|
|
48478
|
-
topsisScore:
|
|
48479
|
-
ucbScore:
|
|
48480
|
-
resolvedAtStage:
|
|
48481
|
-
consensusReached:
|
|
48482
|
-
agreementScore:
|
|
48483
|
-
metadata:
|
|
48749
|
+
decisionTimeMs: z110.number().nonnegative(),
|
|
48750
|
+
alternatives: z110.array(z110.string()).readonly(),
|
|
48751
|
+
stagesExecuted: z110.array(z110.string()).readonly(),
|
|
48752
|
+
withinBudget: z110.boolean().optional(),
|
|
48753
|
+
estimatedComplexity: z110.enum(["simple", "moderate", "complex", "expert"]).optional(),
|
|
48754
|
+
estimatedTokens: z110.number().int().positive().optional(),
|
|
48755
|
+
topsisScore: z110.number().optional(),
|
|
48756
|
+
ucbScore: z110.number().optional(),
|
|
48757
|
+
resolvedAtStage: z110.number().int().nonnegative().optional(),
|
|
48758
|
+
consensusReached: z110.boolean().optional(),
|
|
48759
|
+
agreementScore: z110.number().min(0).max(1).optional(),
|
|
48760
|
+
metadata: z110.record(z110.string(), z110.unknown()).optional()
|
|
48484
48761
|
});
|
|
48485
48762
|
|
|
48486
48763
|
// src/learning/outcome-feedback-types.ts
|
|
48487
|
-
import { z as
|
|
48488
|
-
var QualitySignalsSchema =
|
|
48489
|
-
testsPass:
|
|
48490
|
-
lintErrors:
|
|
48491
|
-
userApproved:
|
|
48492
|
-
retryCount:
|
|
48493
|
-
completionRatio:
|
|
48494
|
-
validStructure:
|
|
48495
|
-
coherenceScore:
|
|
48764
|
+
import { z as z111 } from "zod";
|
|
48765
|
+
var QualitySignalsSchema = z111.object({
|
|
48766
|
+
testsPass: z111.boolean().optional(),
|
|
48767
|
+
lintErrors: z111.number().int().min(0).optional(),
|
|
48768
|
+
userApproved: z111.boolean().optional(),
|
|
48769
|
+
retryCount: z111.number().int().min(0).default(0),
|
|
48770
|
+
completionRatio: z111.number().min(0).max(1).default(1),
|
|
48771
|
+
validStructure: z111.boolean().optional(),
|
|
48772
|
+
coherenceScore: z111.number().min(0).max(1).optional()
|
|
48496
48773
|
});
|
|
48497
|
-
var RoutingDecisionSchema =
|
|
48498
|
-
id:
|
|
48499
|
-
timestamp:
|
|
48500
|
-
query:
|
|
48501
|
-
routerType:
|
|
48502
|
-
selectedModel:
|
|
48503
|
-
selectedTier:
|
|
48504
|
-
armIndex:
|
|
48505
|
-
banditContext:
|
|
48506
|
-
queryFeatures:
|
|
48507
|
-
ucbScore:
|
|
48508
|
-
confidence:
|
|
48509
|
-
traceId:
|
|
48510
|
-
domain:
|
|
48774
|
+
var RoutingDecisionSchema = z111.object({
|
|
48775
|
+
id: z111.uuid(),
|
|
48776
|
+
timestamp: z111.iso.datetime(),
|
|
48777
|
+
query: z111.string(),
|
|
48778
|
+
routerType: z111.enum(["linucb", "preference", "quality", "cascade", "topsis"]),
|
|
48779
|
+
selectedModel: z111.string(),
|
|
48780
|
+
selectedTier: z111.enum(["strong", "weak"]).optional(),
|
|
48781
|
+
armIndex: z111.number().int().min(0).optional(),
|
|
48782
|
+
banditContext: z111.record(z111.string(), z111.unknown()).optional(),
|
|
48783
|
+
queryFeatures: z111.record(z111.string(), z111.unknown()).optional(),
|
|
48784
|
+
ucbScore: z111.number().optional(),
|
|
48785
|
+
confidence: z111.number().min(0).max(1).optional(),
|
|
48786
|
+
traceId: z111.string(),
|
|
48787
|
+
domain: z111.string().optional()
|
|
48511
48788
|
});
|
|
48512
|
-
var TaskOutcomeSchema =
|
|
48513
|
-
routingDecisionId:
|
|
48514
|
-
timestamp:
|
|
48515
|
-
outcomeClass:
|
|
48516
|
-
success:
|
|
48517
|
-
qualityScore:
|
|
48518
|
-
durationMs:
|
|
48519
|
-
tokenUsage:
|
|
48520
|
-
errorMessage:
|
|
48789
|
+
var TaskOutcomeSchema = z111.object({
|
|
48790
|
+
routingDecisionId: z111.uuid(),
|
|
48791
|
+
timestamp: z111.iso.datetime(),
|
|
48792
|
+
outcomeClass: z111.enum(["success", "partial", "failure", "timeout", "error"]),
|
|
48793
|
+
success: z111.boolean(),
|
|
48794
|
+
qualityScore: z111.number().min(0).max(1),
|
|
48795
|
+
durationMs: z111.number().min(0),
|
|
48796
|
+
tokenUsage: z111.number().int().min(0),
|
|
48797
|
+
errorMessage: z111.string().optional(),
|
|
48521
48798
|
qualitySignals: QualitySignalsSchema,
|
|
48522
|
-
traceId:
|
|
48799
|
+
traceId: z111.string()
|
|
48523
48800
|
});
|
|
48524
48801
|
var DEFAULT_FEEDBACK_COLLECTOR_CONFIG = {
|
|
48525
48802
|
maxPendingDecisions: 1e3,
|
|
@@ -48534,17 +48811,17 @@ var DEFAULT_FEEDBACK_COLLECTOR_CONFIG = {
|
|
|
48534
48811
|
targetTokenUsage: 2e3,
|
|
48535
48812
|
maxHistorySize: 1e4
|
|
48536
48813
|
};
|
|
48537
|
-
var FeedbackCollectorConfigSchema =
|
|
48538
|
-
maxPendingDecisions:
|
|
48539
|
-
pendingTimeoutMs:
|
|
48540
|
-
enableAutoReward:
|
|
48541
|
-
qualityWeight:
|
|
48542
|
-
speedWeight:
|
|
48543
|
-
efficiencyWeight:
|
|
48544
|
-
retryPenalty:
|
|
48545
|
-
targetDurationMs:
|
|
48546
|
-
targetTokenUsage:
|
|
48547
|
-
maxHistorySize:
|
|
48814
|
+
var FeedbackCollectorConfigSchema = z111.object({
|
|
48815
|
+
maxPendingDecisions: z111.number().int().positive().default(1e3),
|
|
48816
|
+
pendingTimeoutMs: z111.number().positive().default(3e5),
|
|
48817
|
+
enableAutoReward: z111.boolean().default(true),
|
|
48818
|
+
qualityWeight: z111.number().min(0).max(1).default(0.5),
|
|
48819
|
+
speedWeight: z111.number().min(0).max(1).default(0.2),
|
|
48820
|
+
efficiencyWeight: z111.number().min(0).max(1).default(0.2),
|
|
48821
|
+
retryPenalty: z111.number().min(0).max(1).default(0.1),
|
|
48822
|
+
targetDurationMs: z111.number().positive().default(5e3),
|
|
48823
|
+
targetTokenUsage: z111.number().positive().default(2e3),
|
|
48824
|
+
maxHistorySize: z111.number().int().positive().default(1e4)
|
|
48548
48825
|
});
|
|
48549
48826
|
|
|
48550
48827
|
// src/learning/outcome-feedback-helpers.ts
|
|
@@ -50781,6 +51058,7 @@ export {
|
|
|
50781
51058
|
registerListJobsTool,
|
|
50782
51059
|
registerCancelJobTool,
|
|
50783
51060
|
registerCiHealthCheckTool,
|
|
51061
|
+
registerRunQualityGateTool,
|
|
50784
51062
|
AuditError,
|
|
50785
51063
|
AuditCategorySchema,
|
|
50786
51064
|
AuditSeveritySchema,
|
|
@@ -50864,4 +51142,4 @@ export {
|
|
|
50864
51142
|
detectBackend,
|
|
50865
51143
|
createTaskTracker
|
|
50866
51144
|
};
|
|
50867
|
-
//# sourceMappingURL=chunk-
|
|
51145
|
+
//# sourceMappingURL=chunk-B364VMMP.js.map
|