nexus-agents 8.22.3 → 8.23.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-M4DC2HYF.js → chunk-3EMSXOSB.js} +2 -2
- package/dist/{chunk-7LFNF4PD.js → chunk-F6HVGT3O.js} +2 -2
- package/dist/{chunk-TB2USTOO.js → chunk-JVUO6DKS.js} +3 -3
- package/dist/{chunk-Z7ORWDXO.js → chunk-SDSJVC5J.js} +2 -2
- package/dist/{chunk-MGG466HO.js → chunk-UGE27CC2.js} +3 -3
- package/dist/{chunk-NDWIQFXW.js → chunk-ZBONAFV2.js} +890 -859
- package/dist/{chunk-NDWIQFXW.js.map → chunk-ZBONAFV2.js.map} +1 -1
- package/dist/cli.js +49 -28
- package/dist/cli.js.map +1 -1
- package/dist/{consensus-vote-NM44VYAZ.js → consensus-vote-5KEYBMET.js} +4 -4
- package/dist/{improvement-review-BTH44AEV.js → improvement-review-NSE7H3KE.js} +4 -4
- package/dist/index.d.ts +5 -0
- package/dist/index.js +6 -6
- package/dist/{setup-data-dir-2LQSQCYM.js → setup-data-dir-LX54Q5MJ.js} +3 -3
- package/package.json +1 -1
- /package/dist/{chunk-M4DC2HYF.js.map → chunk-3EMSXOSB.js.map} +0 -0
- /package/dist/{chunk-7LFNF4PD.js.map → chunk-F6HVGT3O.js.map} +0 -0
- /package/dist/{chunk-TB2USTOO.js.map → chunk-JVUO6DKS.js.map} +0 -0
- /package/dist/{chunk-Z7ORWDXO.js.map → chunk-SDSJVC5J.js.map} +0 -0
- /package/dist/{chunk-MGG466HO.js.map → chunk-UGE27CC2.js.map} +0 -0
- /package/dist/{consensus-vote-NM44VYAZ.js.map → consensus-vote-5KEYBMET.js.map} +0 -0
- /package/dist/{improvement-review-BTH44AEV.js.map → improvement-review-NSE7H3KE.js.map} +0 -0
- /package/dist/{setup-data-dir-2LQSQCYM.js.map → setup-data-dir-LX54Q5MJ.js.map} +0 -0
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
import {
|
|
22
22
|
DEFAULT_TASK_TTL_MS,
|
|
23
23
|
clampTaskTtl
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-UGE27CC2.js";
|
|
25
25
|
import {
|
|
26
26
|
executeExpert
|
|
27
27
|
} from "./chunk-CN3VAMQD.js";
|
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
simulationDeniedResult,
|
|
49
49
|
toJobSummary,
|
|
50
50
|
writeJobCancelled
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-JVUO6DKS.js";
|
|
52
52
|
import {
|
|
53
53
|
allOf
|
|
54
54
|
} from "./chunk-OQB3XC5O.js";
|
|
@@ -67,7 +67,7 @@ import {
|
|
|
67
67
|
} from "./chunk-OYTRYITB.js";
|
|
68
68
|
import {
|
|
69
69
|
withPrerequisite
|
|
70
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-F6HVGT3O.js";
|
|
71
71
|
import {
|
|
72
72
|
NOOP_NOTIFIER,
|
|
73
73
|
RateLimiter,
|
|
@@ -92,7 +92,7 @@ import {
|
|
|
92
92
|
withAuditTrail,
|
|
93
93
|
withProgressHeartbeat,
|
|
94
94
|
wrapToolWithTimeout
|
|
95
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-3EMSXOSB.js";
|
|
96
96
|
import {
|
|
97
97
|
createAuditTrail,
|
|
98
98
|
createGraphAuditBridge,
|
|
@@ -27094,10 +27094,10 @@ function calculateZStatistic(params) {
|
|
|
27094
27094
|
function calculateDifferenceCI(p1, p2, total1, total2, confidence) {
|
|
27095
27095
|
const difference = p1 - p2;
|
|
27096
27096
|
const seDiff = Math.sqrt(p1 * (1 - p1) / (total1 || 1) + p2 * (1 - p2) / (total2 || 1));
|
|
27097
|
-
const
|
|
27097
|
+
const z129 = getZScore(confidence);
|
|
27098
27098
|
return {
|
|
27099
|
-
lower: difference -
|
|
27100
|
-
upper: difference +
|
|
27099
|
+
lower: difference - z129 * seDiff,
|
|
27100
|
+
upper: difference + z129 * seDiff,
|
|
27101
27101
|
estimate: difference,
|
|
27102
27102
|
confidence,
|
|
27103
27103
|
n: total1 + total2,
|
|
@@ -27120,11 +27120,11 @@ function proportionConfidenceInterval(successes, total, options = {}) {
|
|
|
27120
27120
|
standardError: 0
|
|
27121
27121
|
};
|
|
27122
27122
|
}
|
|
27123
|
-
const
|
|
27124
|
-
const z210 =
|
|
27123
|
+
const z129 = getZScore(opts.confidence);
|
|
27124
|
+
const z210 = z129 * z129;
|
|
27125
27125
|
const denominator = 1 + z210 / n;
|
|
27126
27126
|
const center = (p + z210 / (2 * n)) / denominator;
|
|
27127
|
-
const margin =
|
|
27127
|
+
const margin = z129 / denominator * Math.sqrt(p * (1 - p) / n + z210 / (4 * n * n));
|
|
27128
27128
|
const lower = Math.max(0, center - margin);
|
|
27129
27129
|
const upper = Math.min(1, center + margin);
|
|
27130
27130
|
const standardError = Math.sqrt(p * (1 - p) / n);
|
|
@@ -27154,8 +27154,8 @@ function meanConfidenceInterval(values, options = {}) {
|
|
|
27154
27154
|
const variance = values.reduce((sum, v) => sum + (v - mean) ** 2, 0) / (n - 1 || 1);
|
|
27155
27155
|
const stdDev = Math.sqrt(variance);
|
|
27156
27156
|
const standardError = stdDev / Math.sqrt(n);
|
|
27157
|
-
const
|
|
27158
|
-
const margin =
|
|
27157
|
+
const z129 = getZScore(opts.confidence);
|
|
27158
|
+
const margin = z129 * standardError;
|
|
27159
27159
|
return {
|
|
27160
27160
|
lower: mean - margin,
|
|
27161
27161
|
upper: mean + margin,
|
|
@@ -39815,37 +39815,61 @@ function registerExecuteExpertTool(server, deps) {
|
|
|
39815
39815
|
}
|
|
39816
39816
|
|
|
39817
39817
|
// src/mcp/tools/research-query.ts
|
|
39818
|
-
import { z as
|
|
39818
|
+
import { z as z72 } from "zod";
|
|
39819
39819
|
import { join as join7 } from "node:path";
|
|
39820
39820
|
|
|
39821
39821
|
// src/research/negative-results.ts
|
|
39822
39822
|
import { readFileSync as readFileSync6 } from "node:fs";
|
|
39823
39823
|
import { join as join6 } from "node:path";
|
|
39824
39824
|
import yaml3 from "yaml";
|
|
39825
|
+
import { z as z71 } from "zod";
|
|
39825
39826
|
var logger33 = createLogger({ component: "negative-results" });
|
|
39827
|
+
var NegativeResultSchema = z71.object({
|
|
39828
|
+
name: z71.string(),
|
|
39829
|
+
paper: z71.string(),
|
|
39830
|
+
rejection_date: z71.string(),
|
|
39831
|
+
failure_mode: z71.string(),
|
|
39832
|
+
lessons_learned: z71.array(z71.string()),
|
|
39833
|
+
reopen_conditions: z71.array(z71.string())
|
|
39834
|
+
});
|
|
39835
|
+
var NegativeResultsRegistrySchema = z71.object({
|
|
39836
|
+
negative_results: z71.record(z71.string(), NegativeResultSchema)
|
|
39837
|
+
});
|
|
39826
39838
|
var NEGATIVE_RESULTS_FILE = "negative-results.yaml";
|
|
39827
39839
|
function negativeResultsPath() {
|
|
39828
39840
|
return join6(resolveRegistryRoot(), REGISTRY_PATH, NEGATIVE_RESULTS_FILE);
|
|
39829
39841
|
}
|
|
39830
39842
|
var cachedResults;
|
|
39843
|
+
function unavailableResult(registryPath, error) {
|
|
39844
|
+
logger33.debug("Could not load negative-results registry", {
|
|
39845
|
+
path: registryPath,
|
|
39846
|
+
error: getErrorMessage(error)
|
|
39847
|
+
});
|
|
39848
|
+
return {
|
|
39849
|
+
status: "unavailable",
|
|
39850
|
+
reason: "The negative-results registry could not be read or parsed"
|
|
39851
|
+
};
|
|
39852
|
+
}
|
|
39831
39853
|
function loadNegativeResults() {
|
|
39832
|
-
if (cachedResults !== void 0) return cachedResults;
|
|
39854
|
+
if (cachedResults !== void 0) return { status: "loaded", registry: cachedResults };
|
|
39833
39855
|
const registryPath = negativeResultsPath();
|
|
39834
39856
|
try {
|
|
39835
39857
|
const content = readFileSync6(registryPath, "utf-8");
|
|
39836
|
-
|
|
39837
|
-
return
|
|
39858
|
+
const parsed = NegativeResultsRegistrySchema.safeParse(yaml3.parse(content));
|
|
39859
|
+
if (!parsed.success) return unavailableResult(registryPath, parsed.error);
|
|
39860
|
+
cachedResults = parsed.data;
|
|
39861
|
+
return { status: "loaded", registry: cachedResults };
|
|
39838
39862
|
} catch (error) {
|
|
39839
|
-
|
|
39840
|
-
path: registryPath,
|
|
39841
|
-
error: getErrorMessage(error)
|
|
39842
|
-
});
|
|
39843
|
-
return { negative_results: {} };
|
|
39863
|
+
return unavailableResult(registryPath, error);
|
|
39844
39864
|
}
|
|
39845
39865
|
}
|
|
39846
39866
|
function checkRejected(techniqueId) {
|
|
39847
|
-
const
|
|
39848
|
-
|
|
39867
|
+
const loaded = loadNegativeResults();
|
|
39868
|
+
if (loaded.status === "unavailable") {
|
|
39869
|
+
return { kind: "unavailable", reason: loaded.reason };
|
|
39870
|
+
}
|
|
39871
|
+
const entry = loaded.registry.negative_results[techniqueId];
|
|
39872
|
+
return entry === void 0 ? { kind: "not-rejected" } : { kind: "rejected", entry };
|
|
39849
39873
|
}
|
|
39850
39874
|
function formatRejectionWarning(id, result) {
|
|
39851
39875
|
return [
|
|
@@ -39863,20 +39887,35 @@ function formatRejectionWarning(id, result) {
|
|
|
39863
39887
|
}
|
|
39864
39888
|
|
|
39865
39889
|
// src/mcp/tools/research-query.ts
|
|
39866
|
-
var ResearchQueryInputSchema =
|
|
39867
|
-
action:
|
|
39890
|
+
var ResearchQueryInputSchema = z72.object({
|
|
39891
|
+
action: z72.enum(["status", "overlap", "stats", "search"]).describe(
|
|
39868
39892
|
"Query action: status (technique status), overlap (find related techniques), stats (registry statistics), search (text search)"
|
|
39869
39893
|
),
|
|
39870
|
-
techniqueId:
|
|
39871
|
-
query:
|
|
39872
|
-
status:
|
|
39873
|
-
threshold:
|
|
39874
|
-
});
|
|
39875
|
-
|
|
39876
|
-
|
|
39877
|
-
|
|
39878
|
-
|
|
39879
|
-
|
|
39894
|
+
techniqueId: z72.string().optional().describe("Technique ID for status/overlap queries"),
|
|
39895
|
+
query: z72.string().optional().describe("Search query string for search action"),
|
|
39896
|
+
status: z72.enum(["implemented", "planned", "not-started", "rejected", "all"]).optional().default("all").describe("Filter by technique status (for status action)"),
|
|
39897
|
+
threshold: z72.number().min(0).max(1).optional().default(0.3).describe("Overlap threshold (0-1) for overlap action")
|
|
39898
|
+
});
|
|
39899
|
+
var ResearchQueryOutputSchema = {
|
|
39900
|
+
action: z72.string(),
|
|
39901
|
+
success: z72.boolean(),
|
|
39902
|
+
data: z72.unknown(),
|
|
39903
|
+
rejectionNotice: z72.string().optional(),
|
|
39904
|
+
negativeResults: z72.object({
|
|
39905
|
+
status: z72.literal("unavailable"),
|
|
39906
|
+
reason: z72.string()
|
|
39907
|
+
}).optional()
|
|
39908
|
+
};
|
|
39909
|
+
function rejectionMetadataFor(techniqueId) {
|
|
39910
|
+
if (techniqueId === void 0 || techniqueId === "") return {};
|
|
39911
|
+
const result = checkRejected(techniqueId);
|
|
39912
|
+
if (result.kind === "rejected") {
|
|
39913
|
+
return { rejectionNotice: formatRejectionWarning(techniqueId, result.entry) };
|
|
39914
|
+
}
|
|
39915
|
+
if (result.kind === "unavailable") {
|
|
39916
|
+
return { negativeResults: { status: "unavailable", reason: result.reason } };
|
|
39917
|
+
}
|
|
39918
|
+
return {};
|
|
39880
39919
|
}
|
|
39881
39920
|
async function handleStatus(input) {
|
|
39882
39921
|
const result = await getResearchStatus({
|
|
@@ -39884,12 +39923,12 @@ async function handleStatus(input) {
|
|
|
39884
39923
|
status: input.status,
|
|
39885
39924
|
format: "json"
|
|
39886
39925
|
});
|
|
39887
|
-
const rejection =
|
|
39926
|
+
const rejection = rejectionMetadataFor(input.techniqueId);
|
|
39888
39927
|
return {
|
|
39889
39928
|
action: "status",
|
|
39890
39929
|
success: result.success,
|
|
39891
39930
|
data: result,
|
|
39892
|
-
...rejection
|
|
39931
|
+
...rejection
|
|
39893
39932
|
};
|
|
39894
39933
|
}
|
|
39895
39934
|
async function handleOverlap(input) {
|
|
@@ -39905,12 +39944,12 @@ async function handleOverlap(input) {
|
|
|
39905
39944
|
threshold: input.threshold,
|
|
39906
39945
|
format: "json"
|
|
39907
39946
|
});
|
|
39908
|
-
const rejection =
|
|
39947
|
+
const rejection = rejectionMetadataFor(input.techniqueId);
|
|
39909
39948
|
return {
|
|
39910
39949
|
action: "overlap",
|
|
39911
39950
|
success: result.success,
|
|
39912
39951
|
data: result,
|
|
39913
|
-
...rejection
|
|
39952
|
+
...rejection
|
|
39914
39953
|
};
|
|
39915
39954
|
}
|
|
39916
39955
|
function handleStats() {
|
|
@@ -39990,6 +40029,11 @@ function createResearchQueryHandler(deps) {
|
|
|
39990
40029
|
const logger57 = deps.logger ?? createLogger({ tool: "research_query" });
|
|
39991
40030
|
return withToolError("Research query failed", logger57, async () => {
|
|
39992
40031
|
const result = await executeQuery(validationResult.data);
|
|
40032
|
+
if (result.negativeResults?.status === "unavailable") {
|
|
40033
|
+
logger57.warn("Negative-results registry unavailable", {
|
|
40034
|
+
reason: result.negativeResults.reason
|
|
40035
|
+
});
|
|
40036
|
+
}
|
|
39993
40037
|
return toolSuccessStructured(result);
|
|
39994
40038
|
});
|
|
39995
40039
|
};
|
|
@@ -39997,11 +40041,11 @@ function createResearchQueryHandler(deps) {
|
|
|
39997
40041
|
function registerResearchQueryTool(server, deps) {
|
|
39998
40042
|
const logger57 = deps.logger ?? createLogger({ tool: "research_query" });
|
|
39999
40043
|
const toolSchema = {
|
|
40000
|
-
action:
|
|
40001
|
-
techniqueId:
|
|
40002
|
-
query:
|
|
40003
|
-
status:
|
|
40004
|
-
threshold:
|
|
40044
|
+
action: z72.enum(["status", "overlap", "stats", "search"]).describe("Query action: status, overlap, stats, or search"),
|
|
40045
|
+
techniqueId: z72.string().optional().describe("Technique ID for status/overlap queries"),
|
|
40046
|
+
query: z72.string().optional().describe("Search query string for search action"),
|
|
40047
|
+
status: z72.enum(["implemented", "planned", "not-started", "rejected", "all"]).optional().describe("Filter by technique status"),
|
|
40048
|
+
threshold: z72.number().min(0).max(1).optional().describe("Overlap threshold (0-1) for overlap action")
|
|
40005
40049
|
};
|
|
40006
40050
|
const description = "Query the research registry for technique status, overlaps, statistics, or text search. Provides read-only access to the research tracking system.";
|
|
40007
40051
|
const secureHandler = createSecureHandler(createResearchQueryHandler(deps), {
|
|
@@ -40014,25 +40058,12 @@ function registerResearchQueryTool(server, deps) {
|
|
|
40014
40058
|
timeoutMs,
|
|
40015
40059
|
logger: logger57
|
|
40016
40060
|
});
|
|
40017
|
-
const outputSchema = {
|
|
40018
|
-
action: z71.string(),
|
|
40019
|
-
success: z71.boolean(),
|
|
40020
|
-
data: z71.unknown(),
|
|
40021
|
-
// Set by handleStatus/handleOverlap when the technique carries a recorded
|
|
40022
|
-
// rejection (#4555). Undeclared until #5141, which made every such call fail
|
|
40023
|
-
// -32602 on an SDK-validating client — the SDK applies
|
|
40024
|
-
// `additionalProperties: false` to any declared outputSchema.
|
|
40025
|
-
//
|
|
40026
|
-
// This hid because it is DATA-dependent, not action-dependent: the
|
|
40027
|
-
// round-trip check calls `action: 'stats'`, which never sets it.
|
|
40028
|
-
rejectionNotice: z71.string().optional()
|
|
40029
|
-
};
|
|
40030
40061
|
server.registerTool(
|
|
40031
40062
|
"research_query",
|
|
40032
40063
|
{
|
|
40033
40064
|
description,
|
|
40034
40065
|
inputSchema: toolSchema,
|
|
40035
|
-
outputSchema,
|
|
40066
|
+
outputSchema: ResearchQueryOutputSchema,
|
|
40036
40067
|
annotations: getToolAnnotations("research_query")
|
|
40037
40068
|
},
|
|
40038
40069
|
toSdkCallback(wrappedHandler)
|
|
@@ -40041,12 +40072,12 @@ function registerResearchQueryTool(server, deps) {
|
|
|
40041
40072
|
}
|
|
40042
40073
|
|
|
40043
40074
|
// src/mcp/tools/research-add.ts
|
|
40044
|
-
import { z as
|
|
40045
|
-
var ResearchAddInputSchema =
|
|
40046
|
-
arxivId:
|
|
40047
|
-
topic:
|
|
40048
|
-
priority:
|
|
40049
|
-
dryRun:
|
|
40075
|
+
import { z as z73 } from "zod";
|
|
40076
|
+
var ResearchAddInputSchema = z73.object({
|
|
40077
|
+
arxivId: z73.string().regex(/^\d{4}\.\d{4,5}$/, "Invalid arXiv ID format (expected XXXX.XXXXX)").describe('arXiv paper ID (e.g., "2401.12345")'),
|
|
40078
|
+
topic: z73.string().optional().describe("Research topic to categorize the paper under"),
|
|
40079
|
+
priority: z73.enum(["P1", "P2", "P3", "P4"]).optional().describe("Priority level for the paper"),
|
|
40080
|
+
dryRun: z73.boolean().optional().default(false).describe("Preview what would be added without persisting")
|
|
40050
40081
|
});
|
|
40051
40082
|
async function executeResearchAdd(input, logger57) {
|
|
40052
40083
|
const exists = await paperExists(input.arxivId);
|
|
@@ -40114,10 +40145,10 @@ function createResearchAddHandler(deps) {
|
|
|
40114
40145
|
function registerResearchAddTool(server, deps) {
|
|
40115
40146
|
const logger57 = deps.logger ?? createLogger({ tool: "research_add" });
|
|
40116
40147
|
const toolSchema = {
|
|
40117
|
-
arxivId:
|
|
40118
|
-
topic:
|
|
40119
|
-
priority:
|
|
40120
|
-
dryRun:
|
|
40148
|
+
arxivId: z73.string().regex(/^\d{4}\.\d{4,5}$/).describe('arXiv paper ID (e.g., "2401.12345")'),
|
|
40149
|
+
topic: z73.string().optional().describe("Research topic to categorize the paper under"),
|
|
40150
|
+
priority: z73.enum(["P1", "P2", "P3", "P4"]).optional().describe("Priority level"),
|
|
40151
|
+
dryRun: z73.boolean().optional().default(false).describe("Preview without persisting")
|
|
40121
40152
|
};
|
|
40122
40153
|
const description = "PAPER-only: add an arXiv preprint to the research registry by arXiv ID. Fetches metadata from arxiv.org and persists to the registry. For non-paper sources (GitHub repos, tools, blogs) use `research_add_source` instead. Use dryRun=true to preview without saving.";
|
|
40123
40154
|
const secureHandler = createSecureHandler(createResearchAddHandler(deps), {
|
|
@@ -40131,11 +40162,11 @@ function registerResearchAddTool(server, deps) {
|
|
|
40131
40162
|
logger: logger57
|
|
40132
40163
|
});
|
|
40133
40164
|
const outputSchema = {
|
|
40134
|
-
success:
|
|
40135
|
-
paperId:
|
|
40136
|
-
title:
|
|
40137
|
-
message:
|
|
40138
|
-
dryRun:
|
|
40165
|
+
success: z73.boolean(),
|
|
40166
|
+
paperId: z73.string().optional(),
|
|
40167
|
+
title: z73.string().optional(),
|
|
40168
|
+
message: z73.string(),
|
|
40169
|
+
dryRun: z73.boolean().optional()
|
|
40139
40170
|
};
|
|
40140
40171
|
server.registerTool(
|
|
40141
40172
|
"research_add",
|
|
@@ -40151,33 +40182,33 @@ function registerResearchAddTool(server, deps) {
|
|
|
40151
40182
|
}
|
|
40152
40183
|
|
|
40153
40184
|
// src/mcp/tools/research-add-source.ts
|
|
40154
|
-
import { z as
|
|
40155
|
-
var SourceTypeEnum =
|
|
40185
|
+
import { z as z74 } from "zod";
|
|
40186
|
+
var SourceTypeEnum = z74.enum([
|
|
40156
40187
|
"product_docs",
|
|
40157
40188
|
"specification",
|
|
40158
40189
|
"research_blog",
|
|
40159
40190
|
"code_analysis",
|
|
40160
40191
|
"open_source_repo"
|
|
40161
40192
|
]);
|
|
40162
|
-
var VerdictEnum =
|
|
40163
|
-
var ResearchAddSourceInputSchema =
|
|
40164
|
-
url:
|
|
40165
|
-
name:
|
|
40193
|
+
var VerdictEnum = z74.enum(["adopted", "partially_adopted", "rejected", "monitoring", "planned"]);
|
|
40194
|
+
var ResearchAddSourceInputSchema = z74.object({
|
|
40195
|
+
url: z74.string().min(1).max(500).describe("Source URL (GitHub repo, docs page, blog post)"),
|
|
40196
|
+
name: z74.string().min(1).max(200).describe("Display name for the source"),
|
|
40166
40197
|
type: SourceTypeEnum.describe("Source type classification"),
|
|
40167
|
-
vendor:
|
|
40168
|
-
topics:
|
|
40169
|
-
tags:
|
|
40170
|
-
quality_signals:
|
|
40171
|
-
stars_at_review:
|
|
40172
|
-
language:
|
|
40173
|
-
has_tests:
|
|
40174
|
-
has_docs:
|
|
40175
|
-
has_paper:
|
|
40198
|
+
vendor: z74.string().max(100).optional().describe("Vendor or organization"),
|
|
40199
|
+
topics: z74.array(z74.string().max(50)).max(5).optional().describe("Research topics (max 5)"),
|
|
40200
|
+
tags: z74.array(z74.string().max(50)).max(10).optional().describe("Searchable tags (max 10)"),
|
|
40201
|
+
quality_signals: z74.object({
|
|
40202
|
+
stars_at_review: z74.number().nonnegative().optional(),
|
|
40203
|
+
language: z74.string().max(50).optional(),
|
|
40204
|
+
has_tests: z74.boolean().optional(),
|
|
40205
|
+
has_docs: z74.boolean().optional(),
|
|
40206
|
+
has_paper: z74.boolean().optional()
|
|
40176
40207
|
}).optional().describe("Quality signals used to compute quality_score; provide explicitly \u2014 no GitHub metadata is fetched"),
|
|
40177
|
-
techniques_extracted:
|
|
40208
|
+
techniques_extracted: z74.array(z74.string().max(100)).max(5).optional().describe("Techniques identified in this source (max 5)"),
|
|
40178
40209
|
verdict: VerdictEnum.optional().describe("Adoption verdict"),
|
|
40179
|
-
verdict_notes:
|
|
40180
|
-
dryRun:
|
|
40210
|
+
verdict_notes: z74.string().max(500).optional().describe("Notes explaining the verdict"),
|
|
40211
|
+
dryRun: z74.boolean().optional().default(false).describe("Preview without persisting")
|
|
40181
40212
|
});
|
|
40182
40213
|
function generateSourceId(url) {
|
|
40183
40214
|
const match = /github\.com\/([^/]+)\/([^/]+)/.exec(url);
|
|
@@ -40317,23 +40348,23 @@ function createResearchAddSourceHandler(deps) {
|
|
|
40317
40348
|
function registerResearchAddSourceTool(server, deps) {
|
|
40318
40349
|
const logger57 = deps.logger ?? createLogger({ tool: "research_add_source" });
|
|
40319
40350
|
const toolSchema = {
|
|
40320
|
-
url:
|
|
40321
|
-
name:
|
|
40351
|
+
url: z74.string().min(1).describe("Source URL"),
|
|
40352
|
+
name: z74.string().min(1).describe("Display name"),
|
|
40322
40353
|
type: SourceTypeEnum.describe("Source type"),
|
|
40323
|
-
vendor:
|
|
40324
|
-
topics:
|
|
40325
|
-
tags:
|
|
40326
|
-
quality_signals:
|
|
40327
|
-
stars_at_review:
|
|
40328
|
-
language:
|
|
40329
|
-
has_tests:
|
|
40330
|
-
has_docs:
|
|
40331
|
-
has_paper:
|
|
40354
|
+
vendor: z74.string().optional().describe("Vendor"),
|
|
40355
|
+
topics: z74.array(z74.string()).max(5).optional().describe("Topics"),
|
|
40356
|
+
tags: z74.array(z74.string()).max(10).optional().describe("Tags"),
|
|
40357
|
+
quality_signals: z74.object({
|
|
40358
|
+
stars_at_review: z74.number().optional(),
|
|
40359
|
+
language: z74.string().optional(),
|
|
40360
|
+
has_tests: z74.boolean().optional(),
|
|
40361
|
+
has_docs: z74.boolean().optional(),
|
|
40362
|
+
has_paper: z74.boolean().optional()
|
|
40332
40363
|
}).optional().describe("Quality signals"),
|
|
40333
|
-
techniques_extracted:
|
|
40364
|
+
techniques_extracted: z74.array(z74.string()).max(5).optional().describe("Techniques"),
|
|
40334
40365
|
verdict: VerdictEnum.optional().describe("Adoption verdict"),
|
|
40335
|
-
verdict_notes:
|
|
40336
|
-
dryRun:
|
|
40366
|
+
verdict_notes: z74.string().max(500).optional().describe("Verdict notes"),
|
|
40367
|
+
dryRun: z74.boolean().optional().default(false).describe("Preview only")
|
|
40337
40368
|
};
|
|
40338
40369
|
const description = "NON-PAPER source: add a GitHub repo / tool / blog URL to the research registry. Auto-computes quality_score from provided quality_signals. For arXiv papers use `research_add` instead. Use dryRun=true to preview without saving.";
|
|
40339
40370
|
const secureHandler = createSecureHandler(createResearchAddSourceHandler(deps), {
|
|
@@ -40359,22 +40390,22 @@ function registerResearchAddSourceTool(server, deps) {
|
|
|
40359
40390
|
);
|
|
40360
40391
|
}
|
|
40361
40392
|
var RESEARCH_ADD_SOURCE_OUTPUT_SCHEMA = {
|
|
40362
|
-
success:
|
|
40363
|
-
sourceId:
|
|
40364
|
-
name:
|
|
40365
|
-
quality_score:
|
|
40366
|
-
evidence_tier:
|
|
40367
|
-
message:
|
|
40368
|
-
dryRun:
|
|
40393
|
+
success: z74.boolean(),
|
|
40394
|
+
sourceId: z74.string().optional(),
|
|
40395
|
+
name: z74.string().optional(),
|
|
40396
|
+
quality_score: z74.number().optional(),
|
|
40397
|
+
evidence_tier: z74.string().optional(),
|
|
40398
|
+
message: z74.string().optional(),
|
|
40399
|
+
dryRun: z74.boolean().optional()
|
|
40369
40400
|
};
|
|
40370
40401
|
|
|
40371
40402
|
// src/mcp/tools/research-discover.ts
|
|
40372
|
-
import { z as
|
|
40403
|
+
import { z as z75 } from "zod";
|
|
40373
40404
|
var MAX_RESULTS_PER_SOURCE = 20;
|
|
40374
40405
|
var DEFAULT_RELEVANCE_THRESHOLD = 0.3;
|
|
40375
|
-
var ResearchDiscoverInputSchema =
|
|
40376
|
-
topic:
|
|
40377
|
-
source:
|
|
40406
|
+
var ResearchDiscoverInputSchema = z75.object({
|
|
40407
|
+
topic: z75.string().min(1).max(200).describe('Research topic to search for (e.g., "multi-agent orchestration")'),
|
|
40408
|
+
source: z75.enum([
|
|
40378
40409
|
"arxiv",
|
|
40379
40410
|
"github",
|
|
40380
40411
|
"google_ai",
|
|
@@ -40388,9 +40419,9 @@ var ResearchDiscoverInputSchema = z74.object({
|
|
|
40388
40419
|
]).optional().default("all").describe(
|
|
40389
40420
|
"Source to search: arxiv, github, google_ai, meta_fair, microsoft, deepmind, semantic_scholar, papers_with_code, openalex, or all"
|
|
40390
40421
|
),
|
|
40391
|
-
maxResults:
|
|
40392
|
-
sinceDate:
|
|
40393
|
-
relevanceThreshold:
|
|
40422
|
+
maxResults: z75.number().min(1).max(MAX_RESULTS_PER_SOURCE).optional().default(10).describe("Maximum results to return"),
|
|
40423
|
+
sinceDate: z75.string().optional().describe("Only return results after this date (YYYY-MM-DD format)"),
|
|
40424
|
+
relevanceThreshold: z75.number().min(0).max(1).optional().default(DEFAULT_RELEVANCE_THRESHOLD).describe(
|
|
40394
40425
|
"Minimum relevance score (0-1) to include in results. Higher values filter more aggressively."
|
|
40395
40426
|
)
|
|
40396
40427
|
});
|
|
@@ -40664,8 +40695,8 @@ function createResearchDiscoverHandler(deps) {
|
|
|
40664
40695
|
function registerResearchDiscoverTool(server, deps) {
|
|
40665
40696
|
const logger57 = deps.logger ?? createLogger({ tool: "research_discover" });
|
|
40666
40697
|
const toolSchema = {
|
|
40667
|
-
topic:
|
|
40668
|
-
source:
|
|
40698
|
+
topic: z75.string().min(1).max(200).describe("Research topic to search for"),
|
|
40699
|
+
source: z75.enum([
|
|
40669
40700
|
"arxiv",
|
|
40670
40701
|
"github",
|
|
40671
40702
|
"google_ai",
|
|
@@ -40677,9 +40708,9 @@ function registerResearchDiscoverTool(server, deps) {
|
|
|
40677
40708
|
"openalex",
|
|
40678
40709
|
"all"
|
|
40679
40710
|
]).optional().describe("Source to search"),
|
|
40680
|
-
maxResults:
|
|
40681
|
-
sinceDate:
|
|
40682
|
-
relevanceThreshold:
|
|
40711
|
+
maxResults: z75.number().min(1).max(MAX_RESULTS_PER_SOURCE).optional().describe("Max results"),
|
|
40712
|
+
sinceDate: z75.string().optional().describe("Only results after this date (YYYY-MM-DD)"),
|
|
40713
|
+
relevanceThreshold: z75.number().min(0).max(1).optional().describe("Minimum relevance score (0-1) to include results. Higher = stricter filtering.")
|
|
40683
40714
|
};
|
|
40684
40715
|
const description = "Discover new research papers and repositories from external sources. Searches arXiv, GitHub, and other sources. Filters out items already in the registry.";
|
|
40685
40716
|
const secureHandler = createSecureHandler(createResearchDiscoverHandler(deps), {
|
|
@@ -40705,23 +40736,23 @@ function registerResearchDiscoverTool(server, deps) {
|
|
|
40705
40736
|
logger57.info("Registered research_discover tool with secure handler and timeout protection");
|
|
40706
40737
|
}
|
|
40707
40738
|
var RESEARCH_DISCOVER_OUTPUT_SCHEMA = {
|
|
40708
|
-
topic:
|
|
40709
|
-
sourcesQueried:
|
|
40710
|
-
failedSources:
|
|
40711
|
-
items:
|
|
40712
|
-
totalFound:
|
|
40713
|
-
alreadyInRegistry:
|
|
40714
|
-
newItems:
|
|
40715
|
-
filteredByRelevance:
|
|
40739
|
+
topic: z75.string().optional(),
|
|
40740
|
+
sourcesQueried: z75.array(z75.string()).optional(),
|
|
40741
|
+
failedSources: z75.array(z75.string()).optional(),
|
|
40742
|
+
items: z75.array(z75.unknown()).optional(),
|
|
40743
|
+
totalFound: z75.number().optional(),
|
|
40744
|
+
alreadyInRegistry: z75.number().optional(),
|
|
40745
|
+
newItems: z75.number().optional(),
|
|
40746
|
+
filteredByRelevance: z75.number().optional()
|
|
40716
40747
|
};
|
|
40717
40748
|
|
|
40718
40749
|
// src/mcp/tools/research-analyze.ts
|
|
40719
|
-
import { z as
|
|
40720
|
-
var ResearchAnalyzeInputSchema =
|
|
40721
|
-
focus:
|
|
40750
|
+
import { z as z76 } from "zod";
|
|
40751
|
+
var ResearchAnalyzeInputSchema = z76.object({
|
|
40752
|
+
focus: z76.enum(["gaps", "trends", "priorities", "stale", "coverage"]).describe(
|
|
40722
40753
|
"Analysis focus: gaps (missing coverage), trends (topic distribution), priorities (P1/P2 backlog), stale (outdated entries), coverage (implementation status)"
|
|
40723
40754
|
),
|
|
40724
|
-
topic:
|
|
40755
|
+
topic: z76.string().optional().describe("Optional topic filter to narrow analysis")
|
|
40725
40756
|
});
|
|
40726
40757
|
function failureResponse(focus) {
|
|
40727
40758
|
return {
|
|
@@ -40966,8 +40997,8 @@ function createResearchAnalyzeHandler(deps) {
|
|
|
40966
40997
|
function registerResearchAnalyzeTool(server, deps) {
|
|
40967
40998
|
const logger57 = deps.logger ?? createLogger({ tool: "research_analyze" });
|
|
40968
40999
|
const toolSchema = {
|
|
40969
|
-
focus:
|
|
40970
|
-
topic:
|
|
41000
|
+
focus: z76.enum(["gaps", "trends", "priorities", "stale", "coverage"]).describe("Analysis focus area"),
|
|
41001
|
+
topic: z76.string().optional().describe("Optional topic filter")
|
|
40971
41002
|
};
|
|
40972
41003
|
const description = "Analyze the research registry for gaps, trends, priorities, stale entries, or coverage. Returns structured analysis with recommendations.";
|
|
40973
41004
|
const secureHandler = createSecureHandler(createResearchAnalyzeHandler(deps), {
|
|
@@ -40981,10 +41012,10 @@ function registerResearchAnalyzeTool(server, deps) {
|
|
|
40981
41012
|
logger: logger57
|
|
40982
41013
|
});
|
|
40983
41014
|
const outputSchema = {
|
|
40984
|
-
focus:
|
|
40985
|
-
success:
|
|
40986
|
-
analysis:
|
|
40987
|
-
recommendations:
|
|
41015
|
+
focus: z76.string().optional(),
|
|
41016
|
+
success: z76.boolean().optional(),
|
|
41017
|
+
analysis: z76.unknown().optional(),
|
|
41018
|
+
recommendations: z76.array(z76.string()).optional()
|
|
40988
41019
|
};
|
|
40989
41020
|
server.registerTool(
|
|
40990
41021
|
"research_analyze",
|
|
@@ -41000,14 +41031,14 @@ function registerResearchAnalyzeTool(server, deps) {
|
|
|
41000
41031
|
}
|
|
41001
41032
|
|
|
41002
41033
|
// src/mcp/tools/research-catalog-review.ts
|
|
41003
|
-
import { z as
|
|
41004
|
-
var ResearchCatalogReviewInputSchema =
|
|
41005
|
-
action:
|
|
41034
|
+
import { z as z77 } from "zod";
|
|
41035
|
+
var ResearchCatalogReviewInputSchema = z77.object({
|
|
41036
|
+
action: z77.enum(["list", "approve", "dismiss", "flush"]).describe(
|
|
41006
41037
|
"Action: list (show pending), approve (add to registry), dismiss (remove), flush (clear all)"
|
|
41007
41038
|
),
|
|
41008
|
-
identifier:
|
|
41009
|
-
topic:
|
|
41010
|
-
createIssue:
|
|
41039
|
+
identifier: z77.string().optional().describe("Reference identifier for approve/dismiss actions (arXiv ID or GitHub URL)"),
|
|
41040
|
+
topic: z77.string().optional().describe("Topic to assign when approving an arXiv paper"),
|
|
41041
|
+
createIssue: z77.boolean().optional().default(false).describe("When approving, also create a GitHub issue for the paper")
|
|
41011
41042
|
});
|
|
41012
41043
|
function handleList() {
|
|
41013
41044
|
const catalog = getAutoCatalog();
|
|
@@ -41139,10 +41170,10 @@ function createCatalogReviewHandler(deps) {
|
|
|
41139
41170
|
function registerResearchCatalogReviewTool(server, deps) {
|
|
41140
41171
|
const logger57 = deps.logger ?? createLogger({ tool: "research_catalog_review" });
|
|
41141
41172
|
const toolSchema = {
|
|
41142
|
-
action:
|
|
41143
|
-
identifier:
|
|
41144
|
-
topic:
|
|
41145
|
-
createIssue:
|
|
41173
|
+
action: z77.enum(["list", "approve", "dismiss", "flush"]).describe("Action to perform on cataloged references"),
|
|
41174
|
+
identifier: z77.string().optional().describe("Reference identifier for approve/dismiss"),
|
|
41175
|
+
topic: z77.string().optional().describe("Topic for approved papers"),
|
|
41176
|
+
createIssue: z77.boolean().optional().describe("Create GitHub issue when approving")
|
|
41146
41177
|
};
|
|
41147
41178
|
const description = "Review auto-cataloged research references found during tool execution. List pending references, approve them for registry addition (optionally filing a GitHub issue), dismiss, or clear all.";
|
|
41148
41179
|
const secureHandler = createSecureHandler(createCatalogReviewHandler(deps), {
|
|
@@ -41156,10 +41187,10 @@ function registerResearchCatalogReviewTool(server, deps) {
|
|
|
41156
41187
|
logger: logger57
|
|
41157
41188
|
});
|
|
41158
41189
|
const outputSchema = {
|
|
41159
|
-
action:
|
|
41160
|
-
success:
|
|
41161
|
-
message:
|
|
41162
|
-
data:
|
|
41190
|
+
action: z77.string().optional(),
|
|
41191
|
+
success: z77.boolean().optional(),
|
|
41192
|
+
message: z77.string().optional(),
|
|
41193
|
+
data: z77.unknown().optional()
|
|
41163
41194
|
};
|
|
41164
41195
|
server.registerTool(
|
|
41165
41196
|
"research_catalog_review",
|
|
@@ -41175,9 +41206,9 @@ function registerResearchCatalogReviewTool(server, deps) {
|
|
|
41175
41206
|
}
|
|
41176
41207
|
|
|
41177
41208
|
// src/mcp/tools/research-synthesize.ts
|
|
41178
|
-
import { z as
|
|
41179
|
-
var ResearchSynthesizeInputSchema =
|
|
41180
|
-
topic:
|
|
41209
|
+
import { z as z78 } from "zod";
|
|
41210
|
+
var ResearchSynthesizeInputSchema = z78.object({
|
|
41211
|
+
topic: z78.string().optional().describe("Optional topic to filter synthesis to a single cluster")
|
|
41181
41212
|
});
|
|
41182
41213
|
function createResearchSynthesizeHandler(deps) {
|
|
41183
41214
|
return async (args, _ctx) => {
|
|
@@ -41204,7 +41235,7 @@ function createResearchSynthesizeHandler(deps) {
|
|
|
41204
41235
|
function registerResearchSynthesizeTool(server, deps) {
|
|
41205
41236
|
const logger57 = deps.logger ?? createLogger({ tool: "research_synthesize" });
|
|
41206
41237
|
const toolSchema = {
|
|
41207
|
-
topic:
|
|
41238
|
+
topic: z78.string().optional().describe("Optional topic filter for single-cluster synthesis")
|
|
41208
41239
|
};
|
|
41209
41240
|
const description = "Synthesize the research registry by grouping papers into topic clusters. Returns structured summaries with common themes, key insights, techniques, implementation opportunities, and cross-cutting themes across clusters.";
|
|
41210
41241
|
const secureHandler = createSecureHandler(createResearchSynthesizeHandler(deps), {
|
|
@@ -41218,12 +41249,12 @@ function registerResearchSynthesizeTool(server, deps) {
|
|
|
41218
41249
|
logger: logger57
|
|
41219
41250
|
});
|
|
41220
41251
|
const outputSchema = {
|
|
41221
|
-
clusters:
|
|
41222
|
-
totalPapers:
|
|
41223
|
-
topicCount:
|
|
41224
|
-
crossCuttingThemes:
|
|
41225
|
-
alignmentSummary:
|
|
41226
|
-
featureGates:
|
|
41252
|
+
clusters: z78.array(z78.unknown()).optional(),
|
|
41253
|
+
totalPapers: z78.number().optional(),
|
|
41254
|
+
topicCount: z78.number().optional(),
|
|
41255
|
+
crossCuttingThemes: z78.array(z78.unknown()).optional(),
|
|
41256
|
+
alignmentSummary: z78.unknown().optional(),
|
|
41257
|
+
featureGates: z78.array(z78.unknown()).optional()
|
|
41227
41258
|
};
|
|
41228
41259
|
server.registerTool(
|
|
41229
41260
|
"research_synthesize",
|
|
@@ -41239,10 +41270,10 @@ function registerResearchSynthesizeTool(server, deps) {
|
|
|
41239
41270
|
}
|
|
41240
41271
|
|
|
41241
41272
|
// src/mcp/tools/issue-triage-tool.ts
|
|
41242
|
-
import { z as
|
|
41243
|
-
var IssueTriageInputSchema =
|
|
41244
|
-
issueUrl:
|
|
41245
|
-
dryRun:
|
|
41273
|
+
import { z as z79 } from "zod";
|
|
41274
|
+
var IssueTriageInputSchema = z79.object({
|
|
41275
|
+
issueUrl: z79.string().min(1).refine((v) => /^https?:\/\//i.test(v), "Only HTTP/HTTPS URLs are allowed").describe("GitHub issue URL (e.g., https://github.com/owner/repo/issues/123)"),
|
|
41276
|
+
dryRun: z79.boolean().optional().default(true).describe("Read-only mode (default: true). When false, may apply labels.")
|
|
41246
41277
|
});
|
|
41247
41278
|
function buildTriageResponse(value) {
|
|
41248
41279
|
return {
|
|
@@ -41297,8 +41328,8 @@ function createIssueTriageHandler(_deps) {
|
|
|
41297
41328
|
function registerIssueTriageTool(server, deps) {
|
|
41298
41329
|
const logger57 = deps.logger ?? createLogger({ tool: "issue_triage" });
|
|
41299
41330
|
const toolSchema = {
|
|
41300
|
-
issueUrl:
|
|
41301
|
-
dryRun:
|
|
41331
|
+
issueUrl: z79.string().min(1).describe("GitHub issue URL (e.g., https://github.com/owner/repo/issues/123)"),
|
|
41332
|
+
dryRun: z79.boolean().optional().default(true).describe("Read-only mode (default: true)")
|
|
41302
41333
|
};
|
|
41303
41334
|
const description = "Triage a GitHub issue using the full security pipeline. Classifies the issue, assesses author trust and reputation, proposes labels and actions, and validates all outputs through policy gate and corroboration checks. Read-only by default. Requires GITHUB_TOKEN or GH_TOKEN environment variable, or gh CLI auth.";
|
|
41304
41335
|
const secureHandler = createSecureHandler(createIssueTriageHandler(deps), {
|
|
@@ -41377,13 +41408,13 @@ function recordTriageOutcome(success, durationMs, errorMsg) {
|
|
|
41377
41408
|
}
|
|
41378
41409
|
|
|
41379
41410
|
// src/mcp/tools/run-graph-workflow.ts
|
|
41380
|
-
import { z as
|
|
41411
|
+
import { z as z80 } from "zod";
|
|
41381
41412
|
import { randomUUID as randomUUID11 } from "node:crypto";
|
|
41382
|
-
var RunGraphWorkflowInputSchema =
|
|
41383
|
-
workflow:
|
|
41384
|
-
inputs:
|
|
41385
|
-
enableCheckpointing:
|
|
41386
|
-
enableAuditTrail:
|
|
41413
|
+
var RunGraphWorkflowInputSchema = z80.object({
|
|
41414
|
+
workflow: z80.string().min(1).max(100).describe("Name of the predefined graph workflow to execute"),
|
|
41415
|
+
inputs: z80.record(z80.string(), z80.unknown()).optional().default({}).describe("Input values for the workflow"),
|
|
41416
|
+
enableCheckpointing: z80.boolean().optional().default(true).describe("Enable checkpoint saving between steps"),
|
|
41417
|
+
enableAuditTrail: z80.boolean().optional().default(false).describe("Enable audit trail event logging"),
|
|
41387
41418
|
/**
|
|
41388
41419
|
* Dispatch mode (#3732). `sync` (default) runs the graph workflow inline and
|
|
41389
41420
|
* returns the result — but a workflow of up to ~100 expert nodes can exceed
|
|
@@ -41391,7 +41422,7 @@ var RunGraphWorkflowInputSchema = z79.object({
|
|
|
41391
41422
|
* envelope immediately and runs in the background; poll
|
|
41392
41423
|
* `get_job_result({ jobId })` for the result. Ignored for the `list` sentinel.
|
|
41393
41424
|
*/
|
|
41394
|
-
dispatch:
|
|
41425
|
+
dispatch: z80.enum(["sync", "async"]).optional().default("sync").describe(
|
|
41395
41426
|
"Dispatch mode (#3732). 'sync' (default): run inline. 'async': return a jobId immediately + run in background (poll get_job_result)."
|
|
41396
41427
|
)
|
|
41397
41428
|
});
|
|
@@ -41480,13 +41511,13 @@ async function handleRunGraphWorkflow(input, logger57, auditLogger) {
|
|
|
41480
41511
|
}
|
|
41481
41512
|
var GRAPH_WORKFLOW_DESCRIPTION = "Run a DAG-shaped workflow with per-node checkpoints, event streaming, and an audit trail. Checkpoints drive the executor in-process recovery (crash-resume + selective node retry) and inspection \u2014 the MCP call is fire-and-forget with NO caller resume input, and the checkpoint store is in-memory (not durable across process restarts). For straight linear templates, use `run_workflow` instead. Supports dispatch: 'async' \u2014 returns a jobId immediately; poll get_job_result.";
|
|
41482
41513
|
var GRAPH_WORKFLOW_SCHEMA = {
|
|
41483
|
-
workflow:
|
|
41514
|
+
workflow: z80.string().min(1).max(100).describe(
|
|
41484
41515
|
'Workflow name: echo, pipeline, code-review, security-scan. Use "list" for available workflows.'
|
|
41485
41516
|
),
|
|
41486
|
-
inputs:
|
|
41487
|
-
enableCheckpointing:
|
|
41488
|
-
enableAuditTrail:
|
|
41489
|
-
dispatch:
|
|
41517
|
+
inputs: z80.record(z80.string(), z80.unknown()).optional().describe("Input values for the workflow"),
|
|
41518
|
+
enableCheckpointing: z80.boolean().optional().describe("Enable checkpoint saving"),
|
|
41519
|
+
enableAuditTrail: z80.boolean().optional().describe("Enable audit trail logging"),
|
|
41520
|
+
dispatch: z80.enum(["sync", "async"]).optional().describe(
|
|
41490
41521
|
"Dispatch mode (#3732). 'sync' (default): run inline. 'async': return a jobId immediately + run in background (poll get_job_result)."
|
|
41491
41522
|
)
|
|
41492
41523
|
};
|
|
@@ -42120,11 +42151,11 @@ function suggestImprovement(criterion) {
|
|
|
42120
42151
|
}
|
|
42121
42152
|
|
|
42122
42153
|
// src/mcp/tools/execute-spec-tool.ts
|
|
42123
|
-
import { z as
|
|
42154
|
+
import { z as z81 } from "zod";
|
|
42124
42155
|
import { randomUUID as randomUUID12 } from "node:crypto";
|
|
42125
|
-
var ExecuteSpecInputSchema =
|
|
42126
|
-
spec:
|
|
42127
|
-
dryRun:
|
|
42156
|
+
var ExecuteSpecInputSchema = z81.object({
|
|
42157
|
+
spec: z81.string().min(1).max(5e4).describe("Markdown specification to execute"),
|
|
42158
|
+
dryRun: z81.boolean().optional().default(false).describe("Parse and decompose only"),
|
|
42128
42159
|
/**
|
|
42129
42160
|
* Dispatch mode (#3732). `sync` (default) runs the full DAG pipeline inline
|
|
42130
42161
|
* and returns the result — but a real parse→decompose→compile→execute→
|
|
@@ -42133,7 +42164,7 @@ var ExecuteSpecInputSchema = z80.object({
|
|
|
42133
42164
|
* background; poll `get_job_result({ jobId })` for the result. Ignored when
|
|
42134
42165
|
* `dryRun` is true (parse+decompose completes fast, so dry runs stay sync).
|
|
42135
42166
|
*/
|
|
42136
|
-
dispatch:
|
|
42167
|
+
dispatch: z81.enum(["sync", "async"]).default("sync").describe(
|
|
42137
42168
|
"Dispatch mode (#3732). 'sync' (default): run inline. 'async': return a jobId immediately + run in background (poll get_job_result). Ignored for dryRun."
|
|
42138
42169
|
)
|
|
42139
42170
|
});
|
|
@@ -42235,11 +42266,11 @@ function registerExecuteSpecTool(server, deps) {
|
|
|
42235
42266
|
const timeoutMs = getToolTimeout("execute_spec", deps.security);
|
|
42236
42267
|
const wrapped = wrapToolWithTimeout("execute_spec", secureHandler, { timeoutMs, logger: logger57 });
|
|
42237
42268
|
const toolSchema = {
|
|
42238
|
-
spec:
|
|
42269
|
+
spec: z81.string().min(1).max(5e4).describe(
|
|
42239
42270
|
'Markdown specification to execute. Must contain "## Requirements" and "## Acceptance Criteria" sections.'
|
|
42240
42271
|
),
|
|
42241
|
-
dryRun:
|
|
42242
|
-
dispatch:
|
|
42272
|
+
dryRun: z81.boolean().optional().describe("Parse and decompose only (no execution)"),
|
|
42273
|
+
dispatch: z81.enum(["sync", "async"]).optional().describe(
|
|
42243
42274
|
"Dispatch mode (#3732). 'sync' (default): run inline. 'async': return a jobId immediately + run in background (poll get_job_result). Ignored for dryRun."
|
|
42244
42275
|
)
|
|
42245
42276
|
};
|
|
@@ -42309,11 +42340,11 @@ function recordSpecOutcome(success, durationMs, stage) {
|
|
|
42309
42340
|
}
|
|
42310
42341
|
|
|
42311
42342
|
// src/mcp/tools/memory-query.ts
|
|
42312
|
-
import { z as
|
|
42313
|
-
var MemoryQueryInputSchema =
|
|
42314
|
-
query:
|
|
42315
|
-
limit:
|
|
42316
|
-
source:
|
|
42343
|
+
import { z as z82 } from "zod";
|
|
42344
|
+
var MemoryQueryInputSchema = z82.object({
|
|
42345
|
+
query: z82.string().min(1).max(500).describe("Search query to match against memory contents"),
|
|
42346
|
+
limit: z82.number().int().min(1).max(50).optional().default(10).describe("Maximum results to return (default: 10, max: 50)"),
|
|
42347
|
+
source: z82.enum(["session", "belief", "agentic", "typed", "adaptive", "all"]).optional().default("all").describe("Filter by memory source (default: all)")
|
|
42317
42348
|
});
|
|
42318
42349
|
function describeBackendCoverage(memory, source) {
|
|
42319
42350
|
const optional = [
|
|
@@ -42420,9 +42451,9 @@ async function memoryQueryHandler(args, ctx) {
|
|
|
42420
42451
|
function registerMemoryQueryTool(server, deps) {
|
|
42421
42452
|
const logger57 = deps.logger ?? createLogger({ tool: "memory_query" });
|
|
42422
42453
|
const toolSchema = {
|
|
42423
|
-
query:
|
|
42424
|
-
limit:
|
|
42425
|
-
source:
|
|
42454
|
+
query: z82.string().min(1).max(500).describe("Search query to match against memory contents"),
|
|
42455
|
+
limit: z82.number().int().min(1).max(50).optional().describe("Maximum results to return (default: 10, max: 50)"),
|
|
42456
|
+
source: z82.enum(["session", "belief", "agentic", "typed", "adaptive", "all"]).optional().describe("Filter by memory source (default: all)")
|
|
42426
42457
|
};
|
|
42427
42458
|
const description = "Query across all memory backends (session, belief, agentic, adaptive, typed) with unified results. Returns memories matching the query with source attribution and relevance scores.";
|
|
42428
42459
|
const secureHandler = createSecureHandler(memoryQueryHandler, {
|
|
@@ -42433,19 +42464,19 @@ function registerMemoryQueryTool(server, deps) {
|
|
|
42433
42464
|
const timeoutMs = getToolTimeout("memory_query", deps.security);
|
|
42434
42465
|
const wrappedHandler = wrapToolWithTimeout("memory_query", secureHandler, { timeoutMs, logger: logger57 });
|
|
42435
42466
|
const outputSchema = {
|
|
42436
|
-
query:
|
|
42437
|
-
expandedQuery:
|
|
42438
|
-
results:
|
|
42439
|
-
count:
|
|
42440
|
-
source:
|
|
42467
|
+
query: z82.string(),
|
|
42468
|
+
expandedQuery: z82.string().optional(),
|
|
42469
|
+
results: z82.array(z82.unknown()),
|
|
42470
|
+
count: z82.number(),
|
|
42471
|
+
source: z82.string(),
|
|
42441
42472
|
// #4999: the SDK validates structured content against this schema with
|
|
42442
42473
|
// `additionalProperties: false`, so a field added to the response and not
|
|
42443
42474
|
// declared here makes EVERY call fail with -32602 rather than merely going
|
|
42444
42475
|
// unreported. The integration test caught that; the unit tests could not,
|
|
42445
42476
|
// because they call the handler directly and never cross the protocol.
|
|
42446
|
-
searched:
|
|
42447
|
-
unavailable:
|
|
42448
|
-
errored:
|
|
42477
|
+
searched: z82.array(z82.string()),
|
|
42478
|
+
unavailable: z82.array(z82.string()),
|
|
42479
|
+
errored: z82.array(z82.string())
|
|
42449
42480
|
};
|
|
42450
42481
|
server.registerTool(
|
|
42451
42482
|
"memory_query",
|
|
@@ -42461,9 +42492,9 @@ function registerMemoryQueryTool(server, deps) {
|
|
|
42461
42492
|
}
|
|
42462
42493
|
|
|
42463
42494
|
// src/mcp/tools/memory-stats.ts
|
|
42464
|
-
import { z as
|
|
42465
|
-
var MemoryStatsInputSchema =
|
|
42466
|
-
includeDecay:
|
|
42495
|
+
import { z as z83 } from "zod";
|
|
42496
|
+
var MemoryStatsInputSchema = z83.object({
|
|
42497
|
+
includeDecay: z83.boolean().optional().default(true).describe("Include decay statistics (default: true)")
|
|
42467
42498
|
});
|
|
42468
42499
|
function collectSessionStats(toolMemory) {
|
|
42469
42500
|
const counts = toolMemory.getSessionCounts();
|
|
@@ -42585,7 +42616,7 @@ async function memoryStatsHandler(args, ctx) {
|
|
|
42585
42616
|
function registerMemoryStatsTool(server, deps) {
|
|
42586
42617
|
const logger57 = deps.logger ?? createLogger({ tool: "memory_stats" });
|
|
42587
42618
|
const toolSchema = {
|
|
42588
|
-
includeDecay:
|
|
42619
|
+
includeDecay: z83.boolean().optional().describe("Include decay statistics (default: true)")
|
|
42589
42620
|
};
|
|
42590
42621
|
const description = "Get memory system statistics dashboard. Shows backend availability, entry counts, and decay stats across all 7 memory backends.";
|
|
42591
42622
|
const secureHandler = createSecureHandler(memoryStatsHandler, {
|
|
@@ -42596,14 +42627,14 @@ function registerMemoryStatsTool(server, deps) {
|
|
|
42596
42627
|
const timeoutMs = getToolTimeout("memory_stats", deps.security);
|
|
42597
42628
|
const wrappedHandler = wrapToolWithTimeout("memory_stats", secureHandler, { timeoutMs, logger: logger57 });
|
|
42598
42629
|
const outputSchema = {
|
|
42599
|
-
backends:
|
|
42600
|
-
session:
|
|
42601
|
-
belief:
|
|
42602
|
-
typed:
|
|
42603
|
-
mobimem:
|
|
42604
|
-
decay:
|
|
42605
|
-
registry:
|
|
42606
|
-
collectedAt:
|
|
42630
|
+
backends: z83.unknown(),
|
|
42631
|
+
session: z83.unknown().optional(),
|
|
42632
|
+
belief: z83.unknown().optional(),
|
|
42633
|
+
typed: z83.unknown().optional(),
|
|
42634
|
+
mobimem: z83.unknown().optional(),
|
|
42635
|
+
decay: z83.unknown().optional(),
|
|
42636
|
+
registry: z83.array(z83.unknown()).optional(),
|
|
42637
|
+
collectedAt: z83.string().optional()
|
|
42607
42638
|
};
|
|
42608
42639
|
server.registerTool(
|
|
42609
42640
|
"memory_stats",
|
|
@@ -42619,15 +42650,15 @@ function registerMemoryStatsTool(server, deps) {
|
|
|
42619
42650
|
}
|
|
42620
42651
|
|
|
42621
42652
|
// src/mcp/tools/memory-write.ts
|
|
42622
|
-
import { z as
|
|
42623
|
-
var MemoryWriteInputSchema =
|
|
42624
|
-
key:
|
|
42625
|
-
content:
|
|
42626
|
-
backend:
|
|
42653
|
+
import { z as z84 } from "zod";
|
|
42654
|
+
var MemoryWriteInputSchema = z84.object({
|
|
42655
|
+
key: z84.string().min(1).max(200).describe("Memory identifier or subject"),
|
|
42656
|
+
content: z84.string().min(1).max(5e3).describe("Memory content to store"),
|
|
42657
|
+
backend: z84.enum(["session", "belief", "agentic", "adaptive", "typed"]).describe(
|
|
42627
42658
|
"Target memory backend: session (learnings), belief (triples), agentic (knowledge), adaptive (priority-scored), typed (MIRIX-style semantic)"
|
|
42628
42659
|
),
|
|
42629
|
-
confidence:
|
|
42630
|
-
metadata:
|
|
42660
|
+
confidence: z84.enum(["high", "medium", "low"]).optional().default("medium").describe("Confidence level (default: medium)"),
|
|
42661
|
+
metadata: z84.record(z84.string().max(100), z84.string().max(500)).optional().describe("Optional key-value metadata tags")
|
|
42631
42662
|
});
|
|
42632
42663
|
function writeToSession(key, content, confidence) {
|
|
42633
42664
|
const toolMemory = getToolMemory();
|
|
@@ -42777,13 +42808,13 @@ async function memoryWriteHandler(args, ctx) {
|
|
|
42777
42808
|
function registerMemoryWriteTool(server, deps) {
|
|
42778
42809
|
const logger57 = deps.logger ?? createLogger({ tool: "memory_write" });
|
|
42779
42810
|
const toolSchema = {
|
|
42780
|
-
key:
|
|
42781
|
-
content:
|
|
42782
|
-
backend:
|
|
42811
|
+
key: z84.string().min(1).max(200).describe("Memory identifier or subject"),
|
|
42812
|
+
content: z84.string().min(1).max(5e3).describe("Memory content to store"),
|
|
42813
|
+
backend: z84.enum(["session", "belief", "agentic", "adaptive", "typed"]).describe(
|
|
42783
42814
|
"Target memory backend: session (learnings), belief (triples), agentic (knowledge), adaptive (priority-scored), typed (MIRIX-style semantic)"
|
|
42784
42815
|
),
|
|
42785
|
-
confidence:
|
|
42786
|
-
metadata:
|
|
42816
|
+
confidence: z84.enum(["high", "medium", "low"]).optional().describe("Confidence level (default: medium)"),
|
|
42817
|
+
metadata: z84.record(z84.string().max(100), z84.string().max(500)).optional().describe("Optional key-value metadata tags")
|
|
42787
42818
|
};
|
|
42788
42819
|
const description = "Write a memory entry to a specific backend. Supports session (learnings), belief assertions (subject + object; predicate fixed as `has_knowledge`), agentic (knowledge with attributes), adaptive (priority-scored), and typed (MIRIX-style semantic) backends.";
|
|
42789
42820
|
const secureHandler = createSecureHandler(memoryWriteHandler, {
|
|
@@ -42795,11 +42826,11 @@ function registerMemoryWriteTool(server, deps) {
|
|
|
42795
42826
|
const timeoutMs = getToolTimeout("memory_write", deps.security);
|
|
42796
42827
|
const wrappedHandler = wrapToolWithTimeout("memory_write", guardedHandler, { timeoutMs, logger: logger57 });
|
|
42797
42828
|
const outputSchema = {
|
|
42798
|
-
success:
|
|
42799
|
-
backend:
|
|
42800
|
-
key:
|
|
42801
|
-
deduplicated:
|
|
42802
|
-
error:
|
|
42829
|
+
success: z84.boolean(),
|
|
42830
|
+
backend: z84.string(),
|
|
42831
|
+
key: z84.string(),
|
|
42832
|
+
deduplicated: z84.boolean().optional(),
|
|
42833
|
+
error: z84.string().optional()
|
|
42803
42834
|
};
|
|
42804
42835
|
server.registerTool(
|
|
42805
42836
|
"memory_write",
|
|
@@ -42815,7 +42846,7 @@ function registerMemoryWriteTool(server, deps) {
|
|
|
42815
42846
|
}
|
|
42816
42847
|
|
|
42817
42848
|
// src/mcp/tools/weather-report-tool.ts
|
|
42818
|
-
import { z as
|
|
42849
|
+
import { z as z85 } from "zod";
|
|
42819
42850
|
function serializeReport(report) {
|
|
42820
42851
|
return {
|
|
42821
42852
|
...report,
|
|
@@ -42866,8 +42897,8 @@ function weatherReportHandler(args, ctx) {
|
|
|
42866
42897
|
function registerWeatherReportTool(server, deps) {
|
|
42867
42898
|
const logger57 = deps.logger ?? createLogger({ tool: "weather_report" });
|
|
42868
42899
|
const toolSchema = {
|
|
42869
|
-
cli:
|
|
42870
|
-
category:
|
|
42900
|
+
cli: z85.enum(["claude", "gemini", "codex", "opencode"]).optional().describe("Filter by CLI"),
|
|
42901
|
+
category: z85.enum([
|
|
42871
42902
|
"architecture",
|
|
42872
42903
|
"code_generation",
|
|
42873
42904
|
"code_review",
|
|
@@ -42879,7 +42910,7 @@ function registerWeatherReportTool(server, deps) {
|
|
|
42879
42910
|
"devops",
|
|
42880
42911
|
"exploration"
|
|
42881
42912
|
]).optional().describe("Filter by task category"),
|
|
42882
|
-
includeAdaptive:
|
|
42913
|
+
includeAdaptive: z85.boolean().optional().describe("Include adaptive routing bonuses (default: true)")
|
|
42883
42914
|
};
|
|
42884
42915
|
const description = "Get multi-CLI performance weather report. Shows per-CLI success rates, per-category breakdowns, and adaptive routing bonus recommendations based on observed task outcomes.";
|
|
42885
42916
|
const secureHandler = createSecureHandler(weatherReportHandler, {
|
|
@@ -42901,18 +42932,18 @@ function registerWeatherReportTool(server, deps) {
|
|
|
42901
42932
|
}
|
|
42902
42933
|
|
|
42903
42934
|
// src/mcp/tools/registry-import-types.ts
|
|
42904
|
-
import { z as
|
|
42905
|
-
var RegistryImportInputSchema =
|
|
42935
|
+
import { z as z86 } from "zod";
|
|
42936
|
+
var RegistryImportInputSchema = z86.object({
|
|
42906
42937
|
/** Model provider. */
|
|
42907
|
-
provider:
|
|
42938
|
+
provider: z86.enum(["anthropic", "google", "openai"]).describe("Model provider (anthropic, google, openai)"),
|
|
42908
42939
|
/** Model identifier from the provider (e.g., "claude-4-opus-20260201"). */
|
|
42909
|
-
modelId:
|
|
42940
|
+
modelId: z86.string().min(1).describe("Provider model identifier"),
|
|
42910
42941
|
/** No-op flag echoed back in the response; the tool never persists regardless. */
|
|
42911
|
-
dryRun:
|
|
42942
|
+
dryRun: z86.boolean().optional().default(true).describe("No-op flag echoed back in the response; the tool never persists regardless")
|
|
42912
42943
|
});
|
|
42913
42944
|
|
|
42914
42945
|
// src/mcp/tools/registry-import-tool.ts
|
|
42915
|
-
import { z as
|
|
42946
|
+
import { z as z87 } from "zod";
|
|
42916
42947
|
|
|
42917
42948
|
// src/mcp/tools/registry-import.ts
|
|
42918
42949
|
var PROVIDER_CLI_MAP = {
|
|
@@ -43022,9 +43053,9 @@ function registryImportHandler(args, ctx) {
|
|
|
43022
43053
|
function registerRegistryImportTool(server, deps) {
|
|
43023
43054
|
const logger57 = deps.logger ?? createLogger({ tool: "registry_import" });
|
|
43024
43055
|
const toolSchema = {
|
|
43025
|
-
provider:
|
|
43026
|
-
modelId:
|
|
43027
|
-
dryRun:
|
|
43056
|
+
provider: z87.enum(["anthropic", "google", "openai"]).describe("Model provider (anthropic, google, openai)"),
|
|
43057
|
+
modelId: z87.string().min(1).describe("Provider model identifier"),
|
|
43058
|
+
dryRun: z87.boolean().optional().describe("No-op flag echoed back in the response; the tool never persists regardless")
|
|
43028
43059
|
};
|
|
43029
43060
|
const description = "Draft a registry ENTRY for a NEW model so routing can consider it later. Generates a ModelCapability YAML with conservative quality scores (5/10) for human review. Always returns a draft entry for human review (never persists). For picking among ALREADY-registered models, use `delegate_to_model`.";
|
|
43030
43061
|
const secureHandler = createSecureHandler(registryImportHandler, {
|
|
@@ -43047,10 +43078,10 @@ function registerRegistryImportTool(server, deps) {
|
|
|
43047
43078
|
}
|
|
43048
43079
|
|
|
43049
43080
|
// src/mcp/tools/repo-analyze-types.ts
|
|
43050
|
-
import { z as
|
|
43051
|
-
var RepoAnalyzeInputSchema =
|
|
43081
|
+
import { z as z88 } from "zod";
|
|
43082
|
+
var RepoAnalyzeInputSchema = z88.object({
|
|
43052
43083
|
/** GitHub repository in "owner/name" format or full URL. */
|
|
43053
|
-
repo:
|
|
43084
|
+
repo: z88.string().min(1).refine(
|
|
43054
43085
|
(v) => !v.includes("://") || /^https?:\/\//i.test(v),
|
|
43055
43086
|
"Only HTTP/HTTPS URLs are allowed"
|
|
43056
43087
|
).describe('GitHub repository in "owner/name" format (e.g., "cloudfoundry/korifi") or full URL'),
|
|
@@ -43059,11 +43090,11 @@ var RepoAnalyzeInputSchema = z87.object({
|
|
|
43059
43090
|
* analysis. Both values resolve to identical behavior; retained for input-shape
|
|
43060
43091
|
* stability until a distinct shallow path is implemented.
|
|
43061
43092
|
*/
|
|
43062
|
-
depth:
|
|
43093
|
+
depth: z88.enum(["shallow", "deep"]).optional().default("shallow").describe("Currently a no-op \u2014 the handler always runs the full analysis (both values identical)")
|
|
43063
43094
|
});
|
|
43064
43095
|
|
|
43065
43096
|
// src/mcp/tools/repo-analyze-tool.ts
|
|
43066
|
-
import { z as
|
|
43097
|
+
import { z as z89 } from "zod";
|
|
43067
43098
|
async function repoAnalyzeHandler(args, ctx) {
|
|
43068
43099
|
const parsed = RepoAnalyzeInputSchema.safeParse(args);
|
|
43069
43100
|
if (!parsed.success) {
|
|
@@ -43082,8 +43113,8 @@ async function repoAnalyzeHandler(args, ctx) {
|
|
|
43082
43113
|
function registerRepoAnalyzeTool(server, deps) {
|
|
43083
43114
|
const logger57 = deps.logger ?? createLogger({ tool: "repo_analyze" });
|
|
43084
43115
|
const toolSchema = {
|
|
43085
|
-
repo:
|
|
43086
|
-
depth:
|
|
43116
|
+
repo: z89.string().min(1).describe('GitHub repository in "owner/name" format or full URL'),
|
|
43117
|
+
depth: z89.enum(["shallow", "deep"]).optional().describe("Currently a no-op \u2014 the handler always runs the full analysis (both values identical)")
|
|
43087
43118
|
};
|
|
43088
43119
|
const description = "Analyze a GitHub repository structure. Returns language, framework, package manager, CI provider, security tooling, Dockerfile/Helm/Makefile detection, and gap identification. Replaces multi-step manual inspection with a single structured query.";
|
|
43089
43120
|
const secureHandler = createSecureHandler(repoAnalyzeHandler, {
|
|
@@ -43105,18 +43136,18 @@ function registerRepoAnalyzeTool(server, deps) {
|
|
|
43105
43136
|
}
|
|
43106
43137
|
|
|
43107
43138
|
// src/mcp/tools/repo-security-plan-types.ts
|
|
43108
|
-
import { z as
|
|
43109
|
-
var RepoSecurityPlanInputSchema =
|
|
43139
|
+
import { z as z90 } from "zod";
|
|
43140
|
+
var RepoSecurityPlanInputSchema = z90.object({
|
|
43110
43141
|
/** GitHub repository in "owner/name" format or full URL. */
|
|
43111
|
-
repo:
|
|
43142
|
+
repo: z90.string().min(1).describe('GitHub repository in "owner/name" format or full URL'),
|
|
43112
43143
|
/** Filter to specific scanner categories. */
|
|
43113
|
-
categories:
|
|
43144
|
+
categories: z90.array(z90.string()).optional().describe('Filter to specific categories (e.g., ["sast", "sca", "secrets"])'),
|
|
43114
43145
|
/** Maximum number of scanners to recommend. */
|
|
43115
|
-
maxScanners:
|
|
43146
|
+
maxScanners: z90.number().min(1).max(20).optional().default(10).describe("Maximum scanners to recommend (default: 10)")
|
|
43116
43147
|
});
|
|
43117
43148
|
|
|
43118
43149
|
// src/mcp/tools/repo-security-plan-tool.ts
|
|
43119
|
-
import { z as
|
|
43150
|
+
import { z as z91 } from "zod";
|
|
43120
43151
|
async function handler(args, ctx) {
|
|
43121
43152
|
const parsed = RepoSecurityPlanInputSchema.safeParse(args);
|
|
43122
43153
|
if (!parsed.success) {
|
|
@@ -43135,9 +43166,9 @@ async function handler(args, ctx) {
|
|
|
43135
43166
|
function registerRepoSecurityPlanTool(server, deps) {
|
|
43136
43167
|
const logger57 = deps.logger ?? createLogger({ tool: "repo_security_plan" });
|
|
43137
43168
|
const toolSchema = {
|
|
43138
|
-
repo:
|
|
43139
|
-
categories:
|
|
43140
|
-
maxScanners:
|
|
43169
|
+
repo: z91.string().min(1).describe('GitHub repository in "owner/name" format or full URL'),
|
|
43170
|
+
categories: z91.array(z91.string().max(50)).max(10).optional().describe('Filter to specific categories (e.g., ["sast", "sca", "secrets"])'),
|
|
43171
|
+
maxScanners: z91.number().min(1).max(20).optional().describe("Maximum scanners to recommend (default: 10)")
|
|
43141
43172
|
};
|
|
43142
43173
|
const description = "Generate a security scanning pipeline recommendation for a GitHub repository. Analyzes repo structure, detects languages/frameworks, and recommends specific vulnerability scanners with CI config snippets. Powered by the vulnerability scanner registry with provenance-tracked metrics.";
|
|
43143
43174
|
const secureHandler = createSecureHandler(handler, {
|
|
@@ -43160,13 +43191,13 @@ function registerRepoSecurityPlanTool(server, deps) {
|
|
|
43160
43191
|
|
|
43161
43192
|
// src/mcp/tools/search-codebase-tool.ts
|
|
43162
43193
|
import { resolve as resolve7, sep as sep3 } from "node:path";
|
|
43163
|
-
import { z as
|
|
43164
|
-
var SearchCodebaseInputSchema =
|
|
43165
|
-
query:
|
|
43166
|
-
directory:
|
|
43167
|
-
limit:
|
|
43168
|
-
mode:
|
|
43169
|
-
maxDepth:
|
|
43194
|
+
import { z as z92 } from "zod";
|
|
43195
|
+
var SearchCodebaseInputSchema = z92.object({
|
|
43196
|
+
query: z92.string().min(1).max(200).describe("Search query (symbol name, keyword, or pattern)"),
|
|
43197
|
+
directory: z92.string().min(1).max(500).optional().describe("Directory to search (default: current working directory)"),
|
|
43198
|
+
limit: z92.number().min(1).max(50).optional().describe("Max results (default: 20)"),
|
|
43199
|
+
mode: z92.enum(["search", "summary", "list"]).optional().describe("search: find symbols. summary: file overview. list: list indexed files."),
|
|
43200
|
+
maxDepth: z92.number().int().min(1).max(MAX_INDEX_MAX_DEPTH).optional().describe(
|
|
43170
43201
|
`Max directory depth to index below "directory" (default: ${String(DEFAULT_INDEX_MAX_DEPTH)}, clamped to ${String(MAX_INDEX_MAX_DEPTH)}). Raise this if results seem incomplete for a deeply nested tree.`
|
|
43171
43202
|
)
|
|
43172
43203
|
});
|
|
@@ -43288,11 +43319,11 @@ async function searchCodebaseHandler(args, ctx) {
|
|
|
43288
43319
|
function registerSearchCodebaseTool(server, deps) {
|
|
43289
43320
|
const logger57 = deps.logger ?? createLogger({ tool: "search_codebase" });
|
|
43290
43321
|
const toolSchema = {
|
|
43291
|
-
query:
|
|
43292
|
-
directory:
|
|
43293
|
-
limit:
|
|
43294
|
-
mode:
|
|
43295
|
-
maxDepth:
|
|
43322
|
+
query: z92.string().min(1).max(200).describe("Search query or file path"),
|
|
43323
|
+
directory: z92.string().max(500).optional().describe("Directory to index"),
|
|
43324
|
+
limit: z92.number().min(1).max(50).optional().describe("Max results"),
|
|
43325
|
+
mode: z92.enum(["search", "summary", "list"]).optional().describe("search/summary/list"),
|
|
43326
|
+
maxDepth: z92.number().int().min(1).max(MAX_INDEX_MAX_DEPTH).optional().describe(
|
|
43296
43327
|
`Max directory depth to index (default: ${String(DEFAULT_INDEX_MAX_DEPTH)}, clamped to ${String(MAX_INDEX_MAX_DEPTH)})`
|
|
43297
43328
|
)
|
|
43298
43329
|
};
|
|
@@ -43314,7 +43345,7 @@ function registerSearchCodebaseTool(server, deps) {
|
|
|
43314
43345
|
|
|
43315
43346
|
// src/mcp/tools/extract-symbols-tool.ts
|
|
43316
43347
|
import { extname as extname3, resolve as resolve8, sep as sep4 } from "node:path";
|
|
43317
|
-
import { z as
|
|
43348
|
+
import { z as z93 } from "zod";
|
|
43318
43349
|
|
|
43319
43350
|
// src/core/task-analysis/tool-refusal-gap.ts
|
|
43320
43351
|
function toolRefusalGapName(tool, capability) {
|
|
@@ -43340,13 +43371,13 @@ function recordToolRefusal(refusal, context, ledger = getGapLedger()) {
|
|
|
43340
43371
|
// src/mcp/tools/extract-symbols-tool.ts
|
|
43341
43372
|
var DEFAULT_EXTRACT_MAX_CHARS = 2e4;
|
|
43342
43373
|
var DEFAULT_EXTRACT_MAX_SYMBOLS = 200;
|
|
43343
|
-
var ExtractSymbolsInputSchema =
|
|
43344
|
-
filePath:
|
|
43345
|
-
mode:
|
|
43346
|
-
maxChars:
|
|
43374
|
+
var ExtractSymbolsInputSchema = z93.object({
|
|
43375
|
+
filePath: z93.string().min(1).max(500).describe("Path to TypeScript/JavaScript file to extract symbols from"),
|
|
43376
|
+
mode: z93.enum(["index", "full"]).optional().describe("index: names+lines only (minimal tokens). full: includes source text."),
|
|
43377
|
+
maxChars: z93.number().int().positive().max(1e6).optional().describe(
|
|
43347
43378
|
`full mode only: cap on total emitted symbol source chars (default ${String(DEFAULT_EXTRACT_MAX_CHARS)}). Excess is truncated and reported, never silently dropped.`
|
|
43348
43379
|
),
|
|
43349
|
-
maxSymbols:
|
|
43380
|
+
maxSymbols: z93.number().int().positive().max(1e4).optional().describe(
|
|
43350
43381
|
`full mode only: cap on number of symbols emitted (default ${String(DEFAULT_EXTRACT_MAX_SYMBOLS)}).`
|
|
43351
43382
|
)
|
|
43352
43383
|
});
|
|
@@ -43490,12 +43521,12 @@ function emptyIndexMessage(reason, filePath) {
|
|
|
43490
43521
|
function registerExtractSymbolsTool(server, deps) {
|
|
43491
43522
|
const logger57 = deps.logger ?? createLogger({ tool: "extract_symbols" });
|
|
43492
43523
|
const toolSchema = {
|
|
43493
|
-
filePath:
|
|
43494
|
-
mode:
|
|
43495
|
-
maxChars:
|
|
43524
|
+
filePath: z93.string().min(1).max(500).describe("Path to TypeScript/JavaScript file"),
|
|
43525
|
+
mode: z93.enum(["index", "full"]).optional().describe("index (default): names+lines. full: includes source text"),
|
|
43526
|
+
maxChars: z93.number().int().positive().max(1e6).optional().describe(
|
|
43496
43527
|
`full mode only: cap on total emitted symbol source chars (default ${String(DEFAULT_EXTRACT_MAX_CHARS)})`
|
|
43497
43528
|
),
|
|
43498
|
-
maxSymbols:
|
|
43529
|
+
maxSymbols: z93.number().int().positive().max(1e4).optional().describe(
|
|
43499
43530
|
`full mode only: cap on number of symbols emitted (default ${String(DEFAULT_EXTRACT_MAX_SYMBOLS)})`
|
|
43500
43531
|
)
|
|
43501
43532
|
};
|
|
@@ -43521,23 +43552,23 @@ function registerExtractSymbolsTool(server, deps) {
|
|
|
43521
43552
|
// src/mcp/tools/search-usages-tool.ts
|
|
43522
43553
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
43523
43554
|
import { relative, resolve as resolve9, sep as sep5 } from "node:path";
|
|
43524
|
-
import { z as
|
|
43555
|
+
import { z as z94 } from "zod";
|
|
43525
43556
|
var DEFAULT_USAGES_LIMIT = 50;
|
|
43526
43557
|
var MAX_USAGES_LIMIT = 500;
|
|
43527
43558
|
var DEFAULT_USAGES_MAX_DEPTH = 24;
|
|
43528
43559
|
var MAX_USAGES_MAX_DEPTH = 64;
|
|
43529
43560
|
var MAX_FILES_SCANNED = 5e3;
|
|
43530
|
-
var SearchUsagesInputSchema =
|
|
43531
|
-
symbol:
|
|
43532
|
-
path:
|
|
43533
|
-
dir:
|
|
43534
|
-
lang:
|
|
43561
|
+
var SearchUsagesInputSchema = z94.object({
|
|
43562
|
+
symbol: z94.string().min(1).max(200).regex(IDENTIFIER_RE, "symbol must be a single JS identifier (letters, digits, _ or $)").describe("Identifier to find usages/call-sites of (a single JS identifier)"),
|
|
43563
|
+
path: z94.string().min(1).max(500).optional().describe("Restrict to a single source file (takes precedence over dir)"),
|
|
43564
|
+
dir: z94.string().min(1).max(500).optional().describe("Directory to search recursively (default: current working directory)"),
|
|
43565
|
+
lang: z94.enum(LANG_VALUES).optional().describe(
|
|
43535
43566
|
"Language override (default: inferred from each file extension, fallback typescript)"
|
|
43536
43567
|
),
|
|
43537
|
-
limit:
|
|
43568
|
+
limit: z94.number().int().min(1).max(MAX_USAGES_LIMIT).optional().describe(
|
|
43538
43569
|
`Max usage matches emitted (default ${String(DEFAULT_USAGES_LIMIT)}). Excess is reported.`
|
|
43539
43570
|
),
|
|
43540
|
-
maxDepth:
|
|
43571
|
+
maxDepth: z94.number().int().min(1).max(MAX_USAGES_MAX_DEPTH).optional().describe(`Directory walk depth for dir scope (default ${String(DEFAULT_USAGES_MAX_DEPTH)}).`)
|
|
43541
43572
|
});
|
|
43542
43573
|
function resolveWithinCwd(target) {
|
|
43543
43574
|
const resolved = resolve9(target);
|
|
@@ -43622,12 +43653,12 @@ async function searchUsagesHandler(args, ctx) {
|
|
|
43622
43653
|
function registerSearchUsagesTool(server, deps) {
|
|
43623
43654
|
const logger57 = deps.logger ?? createLogger({ tool: "search_usages" });
|
|
43624
43655
|
const toolSchema = {
|
|
43625
|
-
symbol:
|
|
43626
|
-
path:
|
|
43627
|
-
dir:
|
|
43628
|
-
lang:
|
|
43629
|
-
limit:
|
|
43630
|
-
maxDepth:
|
|
43656
|
+
symbol: z94.string().min(1).max(200).regex(IDENTIFIER_RE, "symbol must be a single JS identifier").describe("Identifier to find usages/call-sites of"),
|
|
43657
|
+
path: z94.string().min(1).max(500).optional().describe("Restrict to a single source file"),
|
|
43658
|
+
dir: z94.string().min(1).max(500).optional().describe("Directory to search (default: cwd)"),
|
|
43659
|
+
lang: z94.enum(LANG_VALUES).optional().describe("Language override (default: infer from ext)"),
|
|
43660
|
+
limit: z94.number().int().min(1).max(MAX_USAGES_LIMIT).optional().describe(`Max matches (default ${String(DEFAULT_USAGES_LIMIT)})`),
|
|
43661
|
+
maxDepth: z94.number().int().min(1).max(MAX_USAGES_MAX_DEPTH).optional().describe(`Directory walk depth (default ${String(DEFAULT_USAGES_MAX_DEPTH)})`)
|
|
43631
43662
|
};
|
|
43632
43663
|
const description = `Structural USAGE / call-site search for a symbol via ast-grep (tree-sitter). Answers "where is X used or called" \u2014 finds calls (foo()), member calls (obj.foo()), new expressions (new Foo()), imports, and bare references, with file:line:column + snippet. This is the gap \`search_codebase\` CANNOT fill: that indexes declared symbol NAMES only, not usages. Excludes the declaration itself (use \`search_codebase\` for declarations). Syntactic, not type-aware (a same-named member on an unrelated object may match). Read-only. Results capped at ${String(DEFAULT_USAGES_LIMIT)} by default (override via limit up to ${String(MAX_USAGES_LIMIT)}); overflow is reported, never silent.`;
|
|
43633
43664
|
const secureHandler = createSecureHandler(searchUsagesHandler, {
|
|
@@ -43648,11 +43679,11 @@ function registerSearchUsagesTool(server, deps) {
|
|
|
43648
43679
|
// src/mcp/tools/query-trace-tool.ts
|
|
43649
43680
|
import { readFile as readFile4, stat as stat3 } from "node:fs/promises";
|
|
43650
43681
|
import { join as join8, resolve as resolve10, sep as sep6 } from "node:path";
|
|
43651
|
-
import { z as
|
|
43652
|
-
var QueryTraceInputSchema =
|
|
43653
|
-
runId:
|
|
43654
|
-
eventType:
|
|
43655
|
-
limit:
|
|
43682
|
+
import { z as z95 } from "zod";
|
|
43683
|
+
var QueryTraceInputSchema = z95.object({
|
|
43684
|
+
runId: z95.string().min(1).max(128).regex(/^[a-zA-Z0-9_-]+$/, "runId must be alphanumeric, hyphens, or underscores").describe("Run ID to query traces for"),
|
|
43685
|
+
eventType: z95.string().max(100).regex(/^[a-zA-Z0-9._-]+$/, "eventType must be alphanumeric with dots, hyphens, or underscores").optional().describe("Filter by event type"),
|
|
43686
|
+
limit: z95.number().min(1).max(500).optional().describe("Max events to return (default: 100)")
|
|
43656
43687
|
});
|
|
43657
43688
|
var MAX_TRACE_FILE_BYTES = 100 * 1024 * 1024;
|
|
43658
43689
|
var traceLogger = createLogger({ component: "query-trace" });
|
|
@@ -43757,9 +43788,9 @@ function queryTraceHandler(args, ctx) {
|
|
|
43757
43788
|
function registerQueryTraceTool(server, deps) {
|
|
43758
43789
|
const logger57 = deps.logger ?? createLogger({ tool: "query_trace" });
|
|
43759
43790
|
const toolSchema = {
|
|
43760
|
-
runId:
|
|
43761
|
-
eventType:
|
|
43762
|
-
limit:
|
|
43791
|
+
runId: z95.string().min(1).max(128).regex(/^[a-zA-Z0-9_-]+$/, "runId must be alphanumeric, hyphens, or underscores").describe("Run ID to query traces for"),
|
|
43792
|
+
eventType: z95.string().max(100).regex(/^[a-zA-Z0-9._-]+$/).optional().describe("Filter by event type (e.g., model.called)"),
|
|
43793
|
+
limit: z95.number().min(1).max(500).optional().describe("Max events to return (default: 100)")
|
|
43763
43794
|
};
|
|
43764
43795
|
const description = "Query execution traces by run ID. Returns agent and model attribution for pipeline runs including decision paths, error taxonomy, and timing data.";
|
|
43765
43796
|
const secureHandler = createSecureHandler(queryTraceHandler, {
|
|
@@ -43778,7 +43809,7 @@ function registerQueryTraceTool(server, deps) {
|
|
|
43778
43809
|
}
|
|
43779
43810
|
|
|
43780
43811
|
// src/mcp/tools/get-job-result-tool.ts
|
|
43781
|
-
import { z as
|
|
43812
|
+
import { z as z96 } from "zod";
|
|
43782
43813
|
|
|
43783
43814
|
// src/mcp/jobs/task-state-source.ts
|
|
43784
43815
|
var logger34 = createLogger({ component: "task-state-source" });
|
|
@@ -43888,8 +43919,8 @@ function resolveJobList(customDir) {
|
|
|
43888
43919
|
}
|
|
43889
43920
|
|
|
43890
43921
|
// src/mcp/tools/get-job-result-tool.ts
|
|
43891
|
-
var GetJobResultInputSchema =
|
|
43892
|
-
jobId:
|
|
43922
|
+
var GetJobResultInputSchema = z96.object({
|
|
43923
|
+
jobId: z96.string().min(1).max(128).describe('Job ID returned by orchestrate({ mode: "async" })')
|
|
43893
43924
|
});
|
|
43894
43925
|
function getJobResultHandler(args) {
|
|
43895
43926
|
const parsed = GetJobResultInputSchema.safeParse(args);
|
|
@@ -43928,7 +43959,7 @@ function getJobResultHandler(args) {
|
|
|
43928
43959
|
function registerGetJobResultTool(server, deps) {
|
|
43929
43960
|
const logger57 = deps.logger ?? createLogger({ tool: "get_job_result" });
|
|
43930
43961
|
const toolSchema = {
|
|
43931
|
-
jobId:
|
|
43962
|
+
jobId: z96.string().min(1).max(128).describe('Job ID returned by orchestrate({ mode: "async" })')
|
|
43932
43963
|
};
|
|
43933
43964
|
const description = `Read the result of an async-mode tool invocation by jobId. Returns the structured record (status, result | error, timestamps, producerVersion) plus producerVersionMeasured \u2014 false when the producer was a dev build or the record predates the field, so its version must not be compared to this server's _meta build stamp \u2014 and producerVersionSource (sidecar | task_state; a task_state record never carries a version). Poll until status !== "pending". Stage-1 of epic #2631 \u2014 Stage 2 will fold this into query_task_state once StructuredTaskState gains the result field.`;
|
|
43934
43965
|
const secureHandler = createSecureHandler(getJobResultHandler, {
|
|
@@ -43950,14 +43981,14 @@ function registerGetJobResultTool(server, deps) {
|
|
|
43950
43981
|
}
|
|
43951
43982
|
|
|
43952
43983
|
// src/mcp/tools/list-jobs-tool.ts
|
|
43953
|
-
import { z as
|
|
43984
|
+
import { z as z97 } from "zod";
|
|
43954
43985
|
var MAX_LIST_JOBS_RESULTS = 200;
|
|
43955
|
-
var ListJobsInputSchema =
|
|
43986
|
+
var ListJobsInputSchema = z97.object({
|
|
43956
43987
|
/**
|
|
43957
43988
|
* Filter to jobs from a specific tool (exact match — e.g. `'orchestrate'`).
|
|
43958
43989
|
* Omit to list every tool's jobs.
|
|
43959
43990
|
*/
|
|
43960
|
-
toolName:
|
|
43991
|
+
toolName: z97.string().min(1).max(128).optional().describe("Filter to one tool (exact match)."),
|
|
43961
43992
|
/**
|
|
43962
43993
|
* Filter to jobs in a specific lifecycle state.
|
|
43963
43994
|
* Omit to list every state.
|
|
@@ -43970,7 +44001,7 @@ var ListJobsInputSchema = z96.object({
|
|
|
43970
44001
|
* Newest jobs are returned first, so a smaller limit shows the most
|
|
43971
44002
|
* recent activity.
|
|
43972
44003
|
*/
|
|
43973
|
-
limit:
|
|
44004
|
+
limit: z97.number().int().min(1).max(MAX_LIST_JOBS_RESULTS).optional().describe(`Max summaries to return (1-${String(MAX_LIST_JOBS_RESULTS)}, newest first).`)
|
|
43974
44005
|
});
|
|
43975
44006
|
function listJobsHandler(args) {
|
|
43976
44007
|
const parsed = ListJobsInputSchema.safeParse(args);
|
|
@@ -44001,11 +44032,11 @@ function listJobsHandler(args) {
|
|
|
44001
44032
|
function registerListJobsTool(server, deps) {
|
|
44002
44033
|
const logger57 = deps.logger ?? createLogger({ tool: "list_jobs" });
|
|
44003
44034
|
const toolSchema = {
|
|
44004
|
-
toolName:
|
|
44035
|
+
toolName: z97.string().min(1).max(128).optional().describe("Filter to one tool (exact match)."),
|
|
44005
44036
|
status: JobStatusSchema.optional().describe(
|
|
44006
44037
|
"Filter to pending | complete | failed | cancelled. Omit for all."
|
|
44007
44038
|
),
|
|
44008
|
-
limit:
|
|
44039
|
+
limit: z97.number().int().min(1).max(MAX_LIST_JOBS_RESULTS).optional().describe(`Max summaries to return (1-${String(MAX_LIST_JOBS_RESULTS)}, newest first).`)
|
|
44009
44040
|
};
|
|
44010
44041
|
const description = "List async-mode jobs (cross-session discovery). Returns summaries \u2014 jobId, toolName, status, timestamps \u2014 newest first. Filter by toolName / status / limit. Result payloads excluded; fetch via get_job_result(jobId). Stage 5 of epic #2631.";
|
|
44011
44042
|
const secureHandler = createSecureHandler(listJobsHandler, {
|
|
@@ -44027,10 +44058,10 @@ function registerListJobsTool(server, deps) {
|
|
|
44027
44058
|
}
|
|
44028
44059
|
|
|
44029
44060
|
// src/mcp/tools/cancel-job-tool.ts
|
|
44030
|
-
import { z as
|
|
44031
|
-
var CancelJobInputSchema =
|
|
44032
|
-
jobId:
|
|
44033
|
-
reason:
|
|
44061
|
+
import { z as z98 } from "zod";
|
|
44062
|
+
var CancelJobInputSchema = z98.object({
|
|
44063
|
+
jobId: z98.string().min(1).max(128).describe("Job ID returned by orchestrate / run_workflow / consensus_vote in async mode"),
|
|
44064
|
+
reason: z98.string().max(1e3).optional().describe('Optional human-readable note (e.g. "user clicked cancel").')
|
|
44034
44065
|
});
|
|
44035
44066
|
function cancelJobHandler(args) {
|
|
44036
44067
|
const parsed = CancelJobInputSchema.safeParse(args);
|
|
@@ -44087,8 +44118,8 @@ function cancelPendingJob(jobId, toolName, reason) {
|
|
|
44087
44118
|
function registerCancelJobTool(server, deps) {
|
|
44088
44119
|
const logger57 = deps.logger ?? createLogger({ tool: "cancel_job" });
|
|
44089
44120
|
const toolSchema = {
|
|
44090
|
-
jobId:
|
|
44091
|
-
reason:
|
|
44121
|
+
jobId: z98.string().min(1).max(128).describe("Job ID returned by orchestrate / run_workflow / consensus_vote in async mode"),
|
|
44122
|
+
reason: z98.string().max(1e3).optional().describe('Optional human-readable note (e.g. "user clicked cancel").')
|
|
44092
44123
|
};
|
|
44093
44124
|
const description = "Mark an async-mode job as cancelled (#3042 Stage 1b / epic #2631). Same-process dispatcher unwinds via AbortSignal (#3035/#3038); cross-process workers observe via get_job_result. Idempotent \u2014 cancel-after-complete is a no-op (preserves the terminal record); second cancel returns already_cancelled.";
|
|
44094
44125
|
const secureHandler = createSecureHandler(cancelJobHandler, {
|
|
@@ -44110,7 +44141,7 @@ function registerCancelJobTool(server, deps) {
|
|
|
44110
44141
|
}
|
|
44111
44142
|
|
|
44112
44143
|
// src/audit/audit-types.ts
|
|
44113
|
-
import { z as
|
|
44144
|
+
import { z as z99 } from "zod";
|
|
44114
44145
|
var AuditError = class extends Error {
|
|
44115
44146
|
code = "AUDIT_ERROR";
|
|
44116
44147
|
context;
|
|
@@ -44122,7 +44153,7 @@ var AuditError = class extends Error {
|
|
|
44122
44153
|
this.context = options?.context;
|
|
44123
44154
|
}
|
|
44124
44155
|
};
|
|
44125
|
-
var AuditCategorySchema =
|
|
44156
|
+
var AuditCategorySchema = z99.enum([
|
|
44126
44157
|
"authentication",
|
|
44127
44158
|
// Login, logout, token refresh
|
|
44128
44159
|
"authorization",
|
|
@@ -44142,28 +44173,28 @@ var AuditCategorySchema = z98.enum([
|
|
|
44142
44173
|
"governance"
|
|
44143
44174
|
// Authority-tier transitions, ratification (Epic D, #3842)
|
|
44144
44175
|
]);
|
|
44145
|
-
var TierTransitionKindSchema =
|
|
44146
|
-
var TierTransitionTierSchema =
|
|
44147
|
-
var TierTransitionPayloadSchema =
|
|
44176
|
+
var TierTransitionKindSchema = z99.enum(["promotion", "demotion"]);
|
|
44177
|
+
var TierTransitionTierSchema = z99.enum(["observe", "suggest", "advisory", "enforce"]);
|
|
44178
|
+
var TierTransitionPayloadSchema = z99.object({
|
|
44148
44179
|
/** Whether the loop moved up (`promotion`) or down (`demotion`) the ladder. */
|
|
44149
44180
|
kind: TierTransitionKindSchema,
|
|
44150
44181
|
/** The loop/strategy whose tier changed (manifest `id` or loop identifier). */
|
|
44151
|
-
subject:
|
|
44182
|
+
subject: z99.string().min(1),
|
|
44152
44183
|
/** Tier before the transition. */
|
|
44153
44184
|
fromTier: TierTransitionTierSchema,
|
|
44154
44185
|
/** Tier after the transition. */
|
|
44155
44186
|
toTier: TierTransitionTierSchema,
|
|
44156
44187
|
/** Ref to the promotion-evidence record this transition was earned against. */
|
|
44157
|
-
evidenceRef:
|
|
44188
|
+
evidenceRef: z99.string().min(1),
|
|
44158
44189
|
/**
|
|
44159
44190
|
* Ref to the recorded `consensus_vote` that ratified a PROMOTION. Required
|
|
44160
44191
|
* by the ratification gate for `kind: 'promotion'`; legitimately absent for
|
|
44161
44192
|
* `kind: 'demotion'` (automatic, ADR-0017 §"Demotion is automatic").
|
|
44162
44193
|
*/
|
|
44163
|
-
ratificationVoteRef:
|
|
44194
|
+
ratificationVoteRef: z99.string().min(1).optional()
|
|
44164
44195
|
}).strict();
|
|
44165
44196
|
var TIER_TRANSITION_METADATA_KEY = "tierTransition";
|
|
44166
|
-
var AuditSeveritySchema =
|
|
44197
|
+
var AuditSeveritySchema = z99.enum([
|
|
44167
44198
|
"info",
|
|
44168
44199
|
// Normal operations
|
|
44169
44200
|
"warning",
|
|
@@ -44171,7 +44202,7 @@ var AuditSeveritySchema = z98.enum([
|
|
|
44171
44202
|
"critical"
|
|
44172
44203
|
// Security violations, failures
|
|
44173
44204
|
]);
|
|
44174
|
-
var AuditOutcomeSchema =
|
|
44205
|
+
var AuditOutcomeSchema = z99.enum([
|
|
44175
44206
|
"success",
|
|
44176
44207
|
// Operation completed successfully
|
|
44177
44208
|
"failure",
|
|
@@ -44181,56 +44212,56 @@ var AuditOutcomeSchema = z98.enum([
|
|
|
44181
44212
|
"error"
|
|
44182
44213
|
// Unexpected error occurred
|
|
44183
44214
|
]);
|
|
44184
|
-
var AuditActorSchema =
|
|
44185
|
-
type:
|
|
44186
|
-
id:
|
|
44187
|
-
name:
|
|
44188
|
-
ip:
|
|
44189
|
-
userAgent:
|
|
44190
|
-
});
|
|
44191
|
-
var AuditResourceSchema =
|
|
44192
|
-
type:
|
|
44215
|
+
var AuditActorSchema = z99.object({
|
|
44216
|
+
type: z99.enum(["user", "agent", "system", "external"]),
|
|
44217
|
+
id: z99.string().min(1),
|
|
44218
|
+
name: z99.string().optional(),
|
|
44219
|
+
ip: z99.string().optional(),
|
|
44220
|
+
userAgent: z99.string().optional()
|
|
44221
|
+
});
|
|
44222
|
+
var AuditResourceSchema = z99.object({
|
|
44223
|
+
type: z99.string().min(1),
|
|
44193
44224
|
// e.g., 'file', 'tool', 'config', 'agent'
|
|
44194
|
-
id:
|
|
44195
|
-
name:
|
|
44196
|
-
path:
|
|
44225
|
+
id: z99.string().min(1),
|
|
44226
|
+
name: z99.string().optional(),
|
|
44227
|
+
path: z99.string().optional()
|
|
44197
44228
|
});
|
|
44198
|
-
var AuditEventSchema =
|
|
44229
|
+
var AuditEventSchema = z99.object({
|
|
44199
44230
|
// Identity
|
|
44200
|
-
id:
|
|
44231
|
+
id: z99.string().min(1),
|
|
44201
44232
|
// Unique event ID
|
|
44202
|
-
version:
|
|
44233
|
+
version: z99.literal("1.0"),
|
|
44203
44234
|
// Schema version for migrations
|
|
44204
44235
|
// Timing
|
|
44205
|
-
timestamp:
|
|
44236
|
+
timestamp: z99.string(),
|
|
44206
44237
|
// ISO 8601 format
|
|
44207
|
-
timestampMs:
|
|
44238
|
+
timestampMs: z99.number(),
|
|
44208
44239
|
// Unix epoch milliseconds
|
|
44209
44240
|
// Classification
|
|
44210
44241
|
category: AuditCategorySchema,
|
|
44211
44242
|
severity: AuditSeveritySchema,
|
|
44212
44243
|
outcome: AuditOutcomeSchema,
|
|
44213
44244
|
// Event details
|
|
44214
|
-
action:
|
|
44245
|
+
action: z99.string().min(1),
|
|
44215
44246
|
// e.g., 'tool.invoke', 'policy.evaluate'
|
|
44216
|
-
description:
|
|
44247
|
+
description: z99.string().optional(),
|
|
44217
44248
|
// Actors and resources
|
|
44218
44249
|
actor: AuditActorSchema,
|
|
44219
44250
|
resource: AuditResourceSchema.optional(),
|
|
44220
44251
|
// Correlation
|
|
44221
|
-
requestId:
|
|
44252
|
+
requestId: z99.string().optional(),
|
|
44222
44253
|
// Request correlation ID
|
|
44223
|
-
traceId:
|
|
44254
|
+
traceId: z99.string().optional(),
|
|
44224
44255
|
// Distributed trace ID
|
|
44225
|
-
sessionId:
|
|
44256
|
+
sessionId: z99.string().optional(),
|
|
44226
44257
|
// Session correlation ID
|
|
44227
44258
|
// Context
|
|
44228
|
-
toolName:
|
|
44229
|
-
durationMs:
|
|
44230
|
-
metadata:
|
|
44259
|
+
toolName: z99.string().optional(),
|
|
44260
|
+
durationMs: z99.number().optional(),
|
|
44261
|
+
metadata: z99.record(z99.string(), z99.unknown()).optional(),
|
|
44231
44262
|
// Policy and security
|
|
44232
|
-
policyName:
|
|
44233
|
-
policyDecision:
|
|
44263
|
+
policyName: z99.string().optional(),
|
|
44264
|
+
policyDecision: z99.string().optional(),
|
|
44234
44265
|
/**
|
|
44235
44266
|
* Which occurrence of this `{tool, rule}` near-miss the record represents
|
|
44236
44267
|
* (#5228 review). Present only on a sampled `would_deny`.
|
|
@@ -44247,12 +44278,12 @@ var AuditEventSchema = z98.object({
|
|
|
44247
44278
|
* Absent means "not sampled" — every occurrence was recorded — which is
|
|
44248
44279
|
* distinct from `1`.
|
|
44249
44280
|
*/
|
|
44250
|
-
policyOccurrence:
|
|
44251
|
-
violationType:
|
|
44281
|
+
policyOccurrence: z99.number().int().min(1).optional(),
|
|
44282
|
+
violationType: z99.string().optional(),
|
|
44252
44283
|
// Integrity (for tamper-evidence)
|
|
44253
|
-
previousHash:
|
|
44284
|
+
previousHash: z99.string().optional(),
|
|
44254
44285
|
// Hash of previous event (chain)
|
|
44255
|
-
hash:
|
|
44286
|
+
hash: z99.string().optional(),
|
|
44256
44287
|
// Hash of this event
|
|
44257
44288
|
/**
|
|
44258
44289
|
* Hash-projection version (#3921). ABSENT/`1` = the legacy projection
|
|
@@ -44262,62 +44293,62 @@ var AuditEventSchema = z98.object({
|
|
|
44262
44293
|
* Versioned so pre-existing v1 chains keep verifying under their own
|
|
44263
44294
|
* projection (see {@link AUDIT_HASH_VERSION_TIER_TRANSITION}).
|
|
44264
44295
|
*/
|
|
44265
|
-
hashVersion:
|
|
44296
|
+
hashVersion: z99.number().int().positive().optional()
|
|
44266
44297
|
});
|
|
44267
44298
|
var AUDIT_HASH_VERSION_TIER_TRANSITION = 2;
|
|
44268
|
-
var AuditEventInputSchema =
|
|
44299
|
+
var AuditEventInputSchema = z99.object({
|
|
44269
44300
|
category: AuditCategorySchema,
|
|
44270
44301
|
severity: AuditSeveritySchema.optional().default("info"),
|
|
44271
44302
|
outcome: AuditOutcomeSchema,
|
|
44272
|
-
action:
|
|
44273
|
-
description:
|
|
44303
|
+
action: z99.string().min(1),
|
|
44304
|
+
description: z99.string().optional(),
|
|
44274
44305
|
actor: AuditActorSchema,
|
|
44275
44306
|
resource: AuditResourceSchema.optional(),
|
|
44276
|
-
requestId:
|
|
44277
|
-
traceId:
|
|
44278
|
-
sessionId:
|
|
44279
|
-
toolName:
|
|
44280
|
-
durationMs:
|
|
44281
|
-
metadata:
|
|
44282
|
-
policyName:
|
|
44283
|
-
policyDecision:
|
|
44307
|
+
requestId: z99.string().optional(),
|
|
44308
|
+
traceId: z99.string().optional(),
|
|
44309
|
+
sessionId: z99.string().optional(),
|
|
44310
|
+
toolName: z99.string().optional(),
|
|
44311
|
+
durationMs: z99.number().optional(),
|
|
44312
|
+
metadata: z99.record(z99.string(), z99.unknown()).optional(),
|
|
44313
|
+
policyName: z99.string().optional(),
|
|
44314
|
+
policyDecision: z99.string().optional(),
|
|
44284
44315
|
/** @see AuditEventSchema.policyOccurrence (#5228 review). */
|
|
44285
|
-
policyOccurrence:
|
|
44286
|
-
violationType:
|
|
44316
|
+
policyOccurrence: z99.number().int().min(1).optional(),
|
|
44317
|
+
violationType: z99.string().optional()
|
|
44287
44318
|
});
|
|
44288
|
-
var AuditLogConfigSchema =
|
|
44319
|
+
var AuditLogConfigSchema = z99.object({
|
|
44289
44320
|
// Storage
|
|
44290
|
-
logDir:
|
|
44291
|
-
filePrefix:
|
|
44292
|
-
maxFileSizeBytes:
|
|
44321
|
+
logDir: z99.string().min(1),
|
|
44322
|
+
filePrefix: z99.string().optional().default("audit"),
|
|
44323
|
+
maxFileSizeBytes: z99.number().positive().optional().default(10 * 1024 * 1024),
|
|
44293
44324
|
// 10MB
|
|
44294
|
-
maxFiles:
|
|
44325
|
+
maxFiles: z99.number().positive().optional().default(10),
|
|
44295
44326
|
// Features
|
|
44296
|
-
enableHashChain:
|
|
44297
|
-
enableCompression:
|
|
44298
|
-
flushIntervalMs:
|
|
44327
|
+
enableHashChain: z99.boolean().optional().default(true),
|
|
44328
|
+
enableCompression: z99.boolean().optional().default(false),
|
|
44329
|
+
flushIntervalMs: z99.number().positive().optional().default(1e3),
|
|
44299
44330
|
/**
|
|
44300
44331
|
* Maximum in-memory event queue depth before drop-oldest backpressure
|
|
44301
44332
|
* engages. Bounds memory under load when storage.write is slow or the flush
|
|
44302
44333
|
* timer is overlapping; see #2979.
|
|
44303
44334
|
*/
|
|
44304
|
-
maxQueueDepth:
|
|
44335
|
+
maxQueueDepth: z99.number().positive().optional().default(1e4),
|
|
44305
44336
|
// Filtering
|
|
44306
44337
|
minSeverity: AuditSeveritySchema.optional().default("info"),
|
|
44307
|
-
categories:
|
|
44308
|
-
});
|
|
44309
|
-
var AuditQueryCriteriaSchema =
|
|
44310
|
-
startTime:
|
|
44311
|
-
endTime:
|
|
44312
|
-
categories:
|
|
44313
|
-
severities:
|
|
44314
|
-
outcomes:
|
|
44315
|
-
actorId:
|
|
44316
|
-
resourceId:
|
|
44317
|
-
requestId:
|
|
44318
|
-
traceId:
|
|
44319
|
-
limit:
|
|
44320
|
-
offset:
|
|
44338
|
+
categories: z99.array(AuditCategorySchema).optional()
|
|
44339
|
+
});
|
|
44340
|
+
var AuditQueryCriteriaSchema = z99.object({
|
|
44341
|
+
startTime: z99.date().optional(),
|
|
44342
|
+
endTime: z99.date().optional(),
|
|
44343
|
+
categories: z99.array(AuditCategorySchema).optional(),
|
|
44344
|
+
severities: z99.array(AuditSeveritySchema).optional(),
|
|
44345
|
+
outcomes: z99.array(AuditOutcomeSchema).optional(),
|
|
44346
|
+
actorId: z99.string().optional(),
|
|
44347
|
+
resourceId: z99.string().optional(),
|
|
44348
|
+
requestId: z99.string().optional(),
|
|
44349
|
+
traceId: z99.string().optional(),
|
|
44350
|
+
limit: z99.number().positive().optional().default(100),
|
|
44351
|
+
offset: z99.number().nonnegative().optional().default(0)
|
|
44321
44352
|
});
|
|
44322
44353
|
|
|
44323
44354
|
// src/audit/audit-storage-queries.ts
|
|
@@ -45721,7 +45752,7 @@ function ensureRunnableTemplate(template, stages) {
|
|
|
45721
45752
|
// src/pipeline/pipeline-checkpoint.ts
|
|
45722
45753
|
import * as fs7 from "node:fs";
|
|
45723
45754
|
import * as path5 from "node:path";
|
|
45724
|
-
import { z as
|
|
45755
|
+
import { z as z100 } from "zod";
|
|
45725
45756
|
var logger39 = createLogger({ component: "pipeline-checkpoint" });
|
|
45726
45757
|
var SESSION_ID_REGEX = /^[a-zA-Z0-9_-]{1,128}$/;
|
|
45727
45758
|
function validateSessionId(sessionId) {
|
|
@@ -45769,7 +45800,7 @@ function loadCheckpointState(sessionId, customDir) {
|
|
|
45769
45800
|
return null;
|
|
45770
45801
|
}
|
|
45771
45802
|
}
|
|
45772
|
-
var PipelineStageSchema =
|
|
45803
|
+
var PipelineStageSchema = z100.enum([
|
|
45773
45804
|
"research",
|
|
45774
45805
|
"plan",
|
|
45775
45806
|
"vote",
|
|
@@ -45777,27 +45808,27 @@ var PipelineStageSchema = z99.enum([
|
|
|
45777
45808
|
"implement",
|
|
45778
45809
|
"security"
|
|
45779
45810
|
]);
|
|
45780
|
-
var PipelineStageDataSchema =
|
|
45781
|
-
|
|
45782
|
-
|
|
45783
|
-
|
|
45784
|
-
type:
|
|
45785
|
-
approved:
|
|
45786
|
-
conditional:
|
|
45787
|
-
conditions:
|
|
45788
|
-
caveats:
|
|
45789
|
-
iterations:
|
|
45811
|
+
var PipelineStageDataSchema = z100.discriminatedUnion("type", [
|
|
45812
|
+
z100.object({ type: z100.literal("research"), text: z100.string() }),
|
|
45813
|
+
z100.object({ type: z100.literal("plan"), text: z100.string(), iterations: z100.number() }),
|
|
45814
|
+
z100.object({
|
|
45815
|
+
type: z100.literal("vote"),
|
|
45816
|
+
approved: z100.boolean(),
|
|
45817
|
+
conditional: z100.boolean(),
|
|
45818
|
+
conditions: z100.array(z100.string()).optional(),
|
|
45819
|
+
caveats: z100.array(z100.string()).optional(),
|
|
45820
|
+
iterations: z100.number()
|
|
45790
45821
|
}),
|
|
45791
45822
|
// PipelineTask shape is loose at the persistence layer — capture as
|
|
45792
45823
|
// `z.unknown()` and trust the downstream consumer's narrower validation.
|
|
45793
|
-
|
|
45794
|
-
|
|
45795
|
-
|
|
45824
|
+
z100.object({ type: z100.literal("decompose"), tasks: z100.array(z100.unknown()) }),
|
|
45825
|
+
z100.object({ type: z100.literal("implement"), tasks: z100.array(z100.unknown()) }),
|
|
45826
|
+
z100.object({ type: z100.literal("security"), passed: z100.boolean() })
|
|
45796
45827
|
]);
|
|
45797
|
-
var PipelineCheckpointEntrySchema =
|
|
45798
|
-
sessionId:
|
|
45828
|
+
var PipelineCheckpointEntrySchema = z100.object({
|
|
45829
|
+
sessionId: z100.string(),
|
|
45799
45830
|
stage: PipelineStageSchema,
|
|
45800
|
-
timestamp:
|
|
45831
|
+
timestamp: z100.string(),
|
|
45801
45832
|
data: PipelineStageDataSchema
|
|
45802
45833
|
});
|
|
45803
45834
|
function rebuildState(lines) {
|
|
@@ -45987,7 +46018,7 @@ function buildVotingInput(plan, config) {
|
|
|
45987
46018
|
}
|
|
45988
46019
|
async function executeSingleVote(plan, config, log) {
|
|
45989
46020
|
try {
|
|
45990
|
-
const { executeVoting } = await import("./consensus-vote-
|
|
46021
|
+
const { executeVoting } = await import("./consensus-vote-5KEYBMET.js");
|
|
45991
46022
|
const input = buildVotingInput(plan, config);
|
|
45992
46023
|
const result = await executeVoting(input, log);
|
|
45993
46024
|
return parseVotingResult(result);
|
|
@@ -46685,49 +46716,49 @@ Verdict: PASS/NEEDS_WORK/REJECT`;
|
|
|
46685
46716
|
}
|
|
46686
46717
|
|
|
46687
46718
|
// src/security/sarif-parser.ts
|
|
46688
|
-
import { z as
|
|
46689
|
-
var SarifLocationSchema =
|
|
46690
|
-
physicalLocation:
|
|
46691
|
-
artifactLocation:
|
|
46692
|
-
region:
|
|
46693
|
-
startLine:
|
|
46694
|
-
endLine:
|
|
46695
|
-
snippet:
|
|
46719
|
+
import { z as z101 } from "zod";
|
|
46720
|
+
var SarifLocationSchema = z101.object({
|
|
46721
|
+
physicalLocation: z101.object({
|
|
46722
|
+
artifactLocation: z101.object({ uri: z101.string().optional().catch(void 0) }).optional(),
|
|
46723
|
+
region: z101.object({
|
|
46724
|
+
startLine: z101.number().optional().catch(void 0),
|
|
46725
|
+
endLine: z101.number().int().min(1).optional().catch(void 0),
|
|
46726
|
+
snippet: z101.object({ text: z101.string().optional().catch(void 0) }).optional().catch(void 0)
|
|
46696
46727
|
}).optional()
|
|
46697
46728
|
}).optional()
|
|
46698
46729
|
});
|
|
46699
|
-
var SarifResultSchema =
|
|
46700
|
-
ruleId:
|
|
46701
|
-
level:
|
|
46702
|
-
message:
|
|
46703
|
-
locations:
|
|
46704
|
-
});
|
|
46705
|
-
var SarifRuleSchema =
|
|
46706
|
-
id:
|
|
46707
|
-
shortDescription:
|
|
46708
|
-
defaultConfiguration:
|
|
46709
|
-
properties:
|
|
46710
|
-
precision:
|
|
46711
|
-
tags:
|
|
46730
|
+
var SarifResultSchema = z101.object({
|
|
46731
|
+
ruleId: z101.string().nullish(),
|
|
46732
|
+
level: z101.string().nullish(),
|
|
46733
|
+
message: z101.object({ text: z101.string().optional() }).nullish(),
|
|
46734
|
+
locations: z101.array(SarifLocationSchema).nullish()
|
|
46735
|
+
});
|
|
46736
|
+
var SarifRuleSchema = z101.object({
|
|
46737
|
+
id: z101.string(),
|
|
46738
|
+
shortDescription: z101.object({ text: z101.string().optional().catch(void 0) }).optional(),
|
|
46739
|
+
defaultConfiguration: z101.object({ level: z101.string().optional().catch(void 0) }).optional(),
|
|
46740
|
+
properties: z101.object({
|
|
46741
|
+
precision: z101.string().optional().catch(void 0),
|
|
46742
|
+
tags: z101.array(z101.string()).optional().catch(void 0),
|
|
46712
46743
|
// Accept the number form and normalize; `resolveSeverityFromScore`
|
|
46713
46744
|
// parses it either way.
|
|
46714
|
-
"security-severity":
|
|
46745
|
+
"security-severity": z101.union([z101.string(), z101.number()]).optional().catch(void 0)
|
|
46715
46746
|
}).optional().catch(void 0),
|
|
46716
|
-
helpUri:
|
|
46717
|
-
help:
|
|
46718
|
-
});
|
|
46719
|
-
var SarifRunSchema =
|
|
46720
|
-
tool:
|
|
46721
|
-
driver:
|
|
46722
|
-
name:
|
|
46723
|
-
rules:
|
|
46747
|
+
helpUri: z101.string().optional().catch(void 0),
|
|
46748
|
+
help: z101.object({ markdown: z101.string().optional().catch(void 0) }).optional()
|
|
46749
|
+
});
|
|
46750
|
+
var SarifRunSchema = z101.object({
|
|
46751
|
+
tool: z101.object({
|
|
46752
|
+
driver: z101.object({
|
|
46753
|
+
name: z101.string().optional(),
|
|
46754
|
+
rules: z101.array(z101.unknown()).optional()
|
|
46724
46755
|
}).optional()
|
|
46725
46756
|
}).optional(),
|
|
46726
|
-
results:
|
|
46757
|
+
results: z101.array(z101.unknown()).nullish()
|
|
46727
46758
|
});
|
|
46728
|
-
var SarifLogSchema =
|
|
46729
|
-
version:
|
|
46730
|
-
runs:
|
|
46759
|
+
var SarifLogSchema = z101.object({
|
|
46760
|
+
version: z101.string().optional(),
|
|
46761
|
+
runs: z101.array(z101.unknown()).optional()
|
|
46731
46762
|
});
|
|
46732
46763
|
var UNMAPPED_LEVEL_SEVERITY = "high";
|
|
46733
46764
|
var MAX_MESSAGE_LENGTH = 2e3;
|
|
@@ -46995,18 +47026,18 @@ async function executeSecurityScan(input) {
|
|
|
46995
47026
|
}
|
|
46996
47027
|
|
|
46997
47028
|
// src/security/osv-lookup.ts
|
|
46998
|
-
import { z as
|
|
47029
|
+
import { z as z102 } from "zod";
|
|
46999
47030
|
var logger43 = createLogger({ component: "osv-lookup" });
|
|
47000
47031
|
var OSV_API_URL = "https://api.osv.dev/v1/query";
|
|
47001
47032
|
var DEFAULT_TIMEOUT_MS4 = NETWORK_FETCH_TIMEOUT_MS;
|
|
47002
|
-
var OsvVulnerabilitySchema =
|
|
47003
|
-
id:
|
|
47004
|
-
summary:
|
|
47005
|
-
severity:
|
|
47006
|
-
aliases:
|
|
47007
|
-
affectedVersions:
|
|
47008
|
-
fixedVersion:
|
|
47009
|
-
url:
|
|
47033
|
+
var OsvVulnerabilitySchema = z102.object({
|
|
47034
|
+
id: z102.string(),
|
|
47035
|
+
summary: z102.string().optional(),
|
|
47036
|
+
severity: z102.enum(["CRITICAL", "HIGH", "MODERATE", "LOW", "UNKNOWN"]).optional(),
|
|
47037
|
+
aliases: z102.array(z102.string()).default([]),
|
|
47038
|
+
affectedVersions: z102.string().optional(),
|
|
47039
|
+
fixedVersion: z102.string().optional(),
|
|
47040
|
+
url: z102.string().optional()
|
|
47010
47041
|
});
|
|
47011
47042
|
var DEFAULT_OSV_CONFIG = {
|
|
47012
47043
|
timeoutMs: DEFAULT_TIMEOUT_MS4
|
|
@@ -47759,7 +47790,7 @@ ${contextBlock}`;
|
|
|
47759
47790
|
const strategy = config.votingStrategy ?? "higher_order";
|
|
47760
47791
|
await postProgress(config, "Vote", `Running consensus with ${strategy} strategy...`);
|
|
47761
47792
|
try {
|
|
47762
|
-
const { executeVoting } = await import("./consensus-vote-
|
|
47793
|
+
const { executeVoting } = await import("./consensus-vote-5KEYBMET.js");
|
|
47763
47794
|
const votingResult = await executeVoting(
|
|
47764
47795
|
{
|
|
47765
47796
|
proposal: buildVoteProposal(plan, research),
|
|
@@ -48444,7 +48475,7 @@ ${FINDINGS_FORMAT_INSTRUCTIONS}
|
|
|
48444
48475
|
}
|
|
48445
48476
|
|
|
48446
48477
|
// src/mcp/tools/pr-review-tool.ts
|
|
48447
|
-
import { z as
|
|
48478
|
+
import { z as z104 } from "zod";
|
|
48448
48479
|
import { randomUUID as randomUUID13 } from "node:crypto";
|
|
48449
48480
|
|
|
48450
48481
|
// src/audit/reviewed-diff-hash.ts
|
|
@@ -48480,17 +48511,17 @@ import { dirname as dirname3, isAbsolute, join as join12, resolve as resolve13 }
|
|
|
48480
48511
|
|
|
48481
48512
|
// src/audit/pr-review-record.ts
|
|
48482
48513
|
import * as crypto3 from "node:crypto";
|
|
48483
|
-
import { z as
|
|
48484
|
-
var PrReviewVerdictSchema =
|
|
48485
|
-
var PrReviewVoteCountsSchema =
|
|
48486
|
-
approve:
|
|
48487
|
-
request_changes:
|
|
48488
|
-
abstain:
|
|
48489
|
-
error:
|
|
48490
|
-
total:
|
|
48514
|
+
import { z as z103 } from "zod";
|
|
48515
|
+
var PrReviewVerdictSchema = z103.enum(["approve", "request_changes", "abstain"]);
|
|
48516
|
+
var PrReviewVoteCountsSchema = z103.object({
|
|
48517
|
+
approve: z103.number().int().nonnegative(),
|
|
48518
|
+
request_changes: z103.number().int().nonnegative(),
|
|
48519
|
+
abstain: z103.number().int().nonnegative(),
|
|
48520
|
+
error: z103.number().int().nonnegative(),
|
|
48521
|
+
total: z103.number().int().nonnegative()
|
|
48491
48522
|
}).strict();
|
|
48492
|
-
var PrReviewDiffSourceSchema =
|
|
48493
|
-
var PrReviewDiffProvenanceSchema =
|
|
48523
|
+
var PrReviewDiffSourceSchema = z103.enum(["canonical-git", "caller-supplied"]);
|
|
48524
|
+
var PrReviewDiffProvenanceSchema = z103.object({
|
|
48494
48525
|
/** How the reviewed diff was obtained. */
|
|
48495
48526
|
source: PrReviewDiffSourceSchema,
|
|
48496
48527
|
/**
|
|
@@ -48502,9 +48533,9 @@ var PrReviewDiffProvenanceSchema = z102.object({
|
|
|
48502
48533
|
* per-file attribution is unavailable. `false` means "a diff, but the packer
|
|
48503
48534
|
* saw it as one undifferentiated blob".
|
|
48504
48535
|
*/
|
|
48505
|
-
fileBoundaries:
|
|
48536
|
+
fileBoundaries: z103.boolean()
|
|
48506
48537
|
}).strict();
|
|
48507
|
-
var PrReviewRecordSchema =
|
|
48538
|
+
var PrReviewRecordSchema = z103.object({
|
|
48508
48539
|
/**
|
|
48509
48540
|
* Schema version. '1.1' was the Option-C binding (#3831): the record binds to
|
|
48510
48541
|
* `{prNumber, baseSha, reviewedDiffHash}` instead of the rejected `headSha`.
|
|
@@ -48516,22 +48547,22 @@ var PrReviewRecordSchema = z102.object({
|
|
|
48516
48547
|
* records at the time of this bump), so there is no data to migrate and no
|
|
48517
48548
|
* reason to keep a tolerant version union.
|
|
48518
48549
|
*/
|
|
48519
|
-
version:
|
|
48550
|
+
version: z103.literal("1.2"),
|
|
48520
48551
|
/**
|
|
48521
48552
|
* Monotonic sequence number (integer ≥ 0). Assigned as (max existing
|
|
48522
48553
|
* sequence)+1 at write time. Sorted, the set of sequences must cover
|
|
48523
48554
|
* 0..maxSeq with no gap (omission detection); DUPLICATE sequences are a
|
|
48524
48555
|
* benign concurrent-fork signal, not tampering.
|
|
48525
48556
|
*/
|
|
48526
|
-
sequence:
|
|
48557
|
+
sequence: z103.number().int().nonnegative(),
|
|
48527
48558
|
/** The PR number the review covers. */
|
|
48528
|
-
prNumber:
|
|
48559
|
+
prNumber: z103.number().int().positive(),
|
|
48529
48560
|
/**
|
|
48530
48561
|
* The 40-hex BASE commit SHA the reviewed diff was computed against (the
|
|
48531
48562
|
* `<base>..<head>` range base). Part of the Option-C binding so the gate knows
|
|
48532
48563
|
* which range to recompute {@link reviewedDiffHash} over.
|
|
48533
48564
|
*/
|
|
48534
|
-
baseSha:
|
|
48565
|
+
baseSha: z103.string().regex(/^[0-9a-f]{40}$/, "baseSha must be a 40-char lowercase hex commit sha"),
|
|
48535
48566
|
/**
|
|
48536
48567
|
* DIFF-BINDING (Option-C, #3831): sha256 of the canonical reviewed diff bytes
|
|
48537
48568
|
* (see `audit/reviewed-diff-hash.ts` — pinned `git diff` invocation + 50k
|
|
@@ -48540,9 +48571,9 @@ var PrReviewRecordSchema = z102.object({
|
|
|
48540
48571
|
* byte-identical to what the voters saw. Covered by the self-hash below, so it
|
|
48541
48572
|
* cannot be edited to claim a different reviewed diff.
|
|
48542
48573
|
*/
|
|
48543
|
-
reviewedDiffHash:
|
|
48574
|
+
reviewedDiffHash: z103.string().length(64),
|
|
48544
48575
|
/** ISO-8601 timestamp the review was recorded. */
|
|
48545
|
-
recordedAt:
|
|
48576
|
+
recordedAt: z103.string().min(1),
|
|
48546
48577
|
/** The resolved aggregate verdict. */
|
|
48547
48578
|
verdict: PrReviewVerdictSchema,
|
|
48548
48579
|
/**
|
|
@@ -48550,13 +48581,13 @@ var PrReviewRecordSchema = z102.object({
|
|
|
48550
48581
|
* `request_changes` with `verified: true` is a strict blocker; covered by the
|
|
48551
48582
|
* hash so it cannot be flipped without detection.
|
|
48552
48583
|
*/
|
|
48553
|
-
verified:
|
|
48584
|
+
verified: z103.boolean(),
|
|
48554
48585
|
/** Per-decision voter tally from the pr_review aggregate. */
|
|
48555
48586
|
voteCounts: PrReviewVoteCountsSchema,
|
|
48556
48587
|
/** Truncated human-readable review summary for the reviewer record. */
|
|
48557
|
-
summary:
|
|
48588
|
+
summary: z103.string(),
|
|
48558
48589
|
/** Optional correlation/decision id linking to the cost rollup / trace. */
|
|
48559
|
-
correlationId:
|
|
48590
|
+
correlationId: z103.string().min(1).optional(),
|
|
48560
48591
|
/**
|
|
48561
48592
|
* What this record was DERIVED FROM (#4459). OPTIONAL by necessity: the
|
|
48562
48593
|
* schema is `.strict()`, so a required field would reject every record
|
|
@@ -48569,9 +48600,9 @@ var PrReviewRecordSchema = z102.object({
|
|
|
48569
48600
|
* Retained for audit texture but NOT covered by `hash` and NOT verified —
|
|
48570
48601
|
* the record-set model is position-independent (mirrors #3927).
|
|
48571
48602
|
*/
|
|
48572
|
-
previousHash:
|
|
48603
|
+
previousHash: z103.string().length(64).optional(),
|
|
48573
48604
|
/** SHA-256 over every field above EXCEPT `previousHash` (and except `hash`). */
|
|
48574
|
-
hash:
|
|
48605
|
+
hash: z103.string().length(64)
|
|
48575
48606
|
}).strict();
|
|
48576
48607
|
function computePrReviewRecordHash(payload) {
|
|
48577
48608
|
const canonical = JSON.stringify({
|
|
@@ -49026,19 +49057,19 @@ var MAX_DIFF_INPUT_LENGTH = 2e6;
|
|
|
49026
49057
|
var MAX_REPO_CONTEXT_LENGTH = 2e3;
|
|
49027
49058
|
var MAX_DESCRIPTION_LENGTH = 1e4;
|
|
49028
49059
|
var PR_REVIEW_ASYNC_HINT = "A pr_review run fans out to 5 live LLM voters and can exceed the synchronous MCP request timeout. Retry with `dispatch: 'async'` to get a jobId immediately, then poll get_job_result({ jobId }) for the result.";
|
|
49029
|
-
var PrReviewInputSchema =
|
|
49030
|
-
prTitle:
|
|
49031
|
-
prDescription:
|
|
49032
|
-
prDiff:
|
|
49060
|
+
var PrReviewInputSchema = z104.object({
|
|
49061
|
+
prTitle: z104.string().min(1).max(500).describe("PR title"),
|
|
49062
|
+
prDescription: z104.string().max(MAX_DESCRIPTION_LENGTH).optional().describe("PR body / description"),
|
|
49063
|
+
prDiff: z104.string().min(1).max(MAX_DIFF_INPUT_LENGTH).refine(looksLikeUnifiedDiff, {
|
|
49033
49064
|
message: "prDiff must be a unified diff (expected a `diff --git`, `---`/`+++`, or `@@ \u2026 @@` line). Prose descriptions of a change are rejected: a review of a summary is not a review of the code, and would be recorded as though it were (#4451)."
|
|
49034
49065
|
}).describe(
|
|
49035
49066
|
`Unified diff text (max ${String(MAX_DIFF_INPUT_LENGTH)} chars). REQUIRED SHAPE (#4451): must contain a \`diff --git\` header, an \`@@ \u2026 @@\` hunk header backed by +/- lines, or a \`---\`/\`+++\` header pair \u2014 a prose summary of the change is REJECTED, because reviewing a summary is not reviewing the code and would be recorded as though it were. (Stated here because Zod refinements do not survive JSON-schema generation, so this constraint is otherwise invisible to clients.) No need to truncate before calling: diffs over ${String(MAX_DIFF_LENGTH)} chars are security-prioritized and PARTIALLY reviewed (lowest-priority whole files dropped; coverage reported on the response, and a partial review can block but never verified-approve).`
|
|
49036
49067
|
),
|
|
49037
|
-
repoContext:
|
|
49068
|
+
repoContext: z104.string().max(MAX_REPO_CONTEXT_LENGTH).optional().describe(
|
|
49038
49069
|
`Optional one-paragraph repo context (architecture, conventions; max ${String(MAX_REPO_CONTEXT_LENGTH)} chars; trim before calling)`
|
|
49039
49070
|
),
|
|
49040
|
-
baseRef:
|
|
49041
|
-
headRef:
|
|
49071
|
+
baseRef: z104.string().max(200).optional().describe("Base branch ref (e.g. main)"),
|
|
49072
|
+
headRef: z104.string().max(200).optional().describe("Head branch ref"),
|
|
49042
49073
|
/**
|
|
49043
49074
|
* Option-C audit binding (#4031). When BOTH `prNumber` and `baseSha` are
|
|
49044
49075
|
* supplied AND the review is live (not simulated), pr_review persists an
|
|
@@ -49050,14 +49081,14 @@ var PrReviewInputSchema = z103.object({
|
|
|
49050
49081
|
* canonical `git diff <baseSha>..<headSha>` the gate recomputes (the hash
|
|
49051
49082
|
* truncates at that byte cap) — pass the canonical diff, not a reordered one.
|
|
49052
49083
|
*/
|
|
49053
|
-
prNumber:
|
|
49054
|
-
baseSha:
|
|
49084
|
+
prNumber: z104.number().int().positive().optional().describe("PR number \u2014 with baseSha, enables Option-C audit-record persistence (#4031)"),
|
|
49085
|
+
baseSha: z104.string().regex(/^[0-9a-f]{40}$/, "baseSha must be a 40-char lowercase hex commit sha").optional().describe(
|
|
49055
49086
|
"40-hex base commit sha the reviewed diff was computed from (Option-C binding, #4031)"
|
|
49056
49087
|
),
|
|
49057
|
-
repoPath:
|
|
49088
|
+
repoPath: z104.string().max(1024).optional().describe(
|
|
49058
49089
|
"Repo root path for persisting the governance pr-review record (overrides cwd auto-detection). Must contain a .git ancestor \u2014 relative paths are resolved against cwd; ignored (falls back to cwd auto-detection) if it is not a real repo root. Env NEXUS_PR_REVIEW_RECORDS_PATH still takes precedence and is unrestricted."
|
|
49059
49090
|
),
|
|
49060
|
-
simulate:
|
|
49091
|
+
simulate: z104.boolean().default(false).describe("Use simulated voters (testing only; never ship live with this true)"),
|
|
49061
49092
|
/**
|
|
49062
49093
|
* Error policy (#4132). `standard` (default) keeps the pre-#4132 aggregation:
|
|
49063
49094
|
* an errored voter is simply excluded from the panel. `absolute_quorum` gates
|
|
@@ -49069,7 +49100,7 @@ var PrReviewInputSchema = z103.object({
|
|
|
49069
49100
|
* verified approve. A genuine `request_changes` blocker still wins (Tiers 1-2
|
|
49070
49101
|
* run first).
|
|
49071
49102
|
*/
|
|
49072
|
-
errorPolicy:
|
|
49103
|
+
errorPolicy: z104.enum(["standard", "absolute_quorum"]).default("standard").describe(
|
|
49073
49104
|
"Error policy (#4132). 'standard' (default): errored voters excluded. 'absolute_quorum': any errored voter \u2014 esp. the contrarian \u2014 degrades a would-be approve to a recoverable abstain (verified:false); never manufactures a verified approve from an induced error."
|
|
49074
49105
|
),
|
|
49075
49106
|
/**
|
|
@@ -49079,7 +49110,7 @@ var PrReviewInputSchema = z103.object({
|
|
|
49079
49110
|
* runs the panel in the background; poll `get_job_result({ jobId })` for the
|
|
49080
49111
|
* result.
|
|
49081
49112
|
*/
|
|
49082
|
-
dispatch:
|
|
49113
|
+
dispatch: z104.enum(["sync", "async"]).default("sync").describe(
|
|
49083
49114
|
"Dispatch mode (#3731). 'sync' (default): run inline. 'async': return a jobId immediately + run the panel in background (poll get_job_result)."
|
|
49084
49115
|
)
|
|
49085
49116
|
});
|
|
@@ -49278,27 +49309,27 @@ function registerPrReviewTool(server, deps) {
|
|
|
49278
49309
|
}
|
|
49279
49310
|
|
|
49280
49311
|
// src/mcp/tools/survey-oss-landscape.ts
|
|
49281
|
-
import { z as
|
|
49282
|
-
var SurveyOssLandscapeInputSchema =
|
|
49283
|
-
query:
|
|
49284
|
-
maxResults:
|
|
49285
|
-
minStars:
|
|
49286
|
-
language:
|
|
49287
|
-
});
|
|
49288
|
-
var GitHubRepoSchema =
|
|
49289
|
-
full_name:
|
|
49290
|
-
html_url:
|
|
49291
|
-
description:
|
|
49292
|
-
stargazers_count:
|
|
49293
|
-
pushed_at:
|
|
49294
|
-
language:
|
|
49295
|
-
license:
|
|
49296
|
-
spdx_id:
|
|
49312
|
+
import { z as z105 } from "zod";
|
|
49313
|
+
var SurveyOssLandscapeInputSchema = z105.object({
|
|
49314
|
+
query: z105.string().min(1).max(200).describe('Free-text search query, e.g. "cargo nextest replacement" or "OSS SBOM tools"'),
|
|
49315
|
+
maxResults: z105.number().int().min(1).max(50).optional().default(10).describe("Maximum candidates to return (1-50; default 10)"),
|
|
49316
|
+
minStars: z105.number().int().min(0).optional().default(0).describe("Minimum star count to include (default 0; useful for filtering noise)"),
|
|
49317
|
+
language: z105.string().max(50).optional().describe('GitHub language filter, e.g. "rust" or "typescript"')
|
|
49318
|
+
});
|
|
49319
|
+
var GitHubRepoSchema = z105.object({
|
|
49320
|
+
full_name: z105.string().optional(),
|
|
49321
|
+
html_url: z105.string().optional(),
|
|
49322
|
+
description: z105.string().nullable().optional(),
|
|
49323
|
+
stargazers_count: z105.number().optional(),
|
|
49324
|
+
pushed_at: z105.string().nullable().optional(),
|
|
49325
|
+
language: z105.string().nullable().optional(),
|
|
49326
|
+
license: z105.object({
|
|
49327
|
+
spdx_id: z105.string().nullable().optional()
|
|
49297
49328
|
}).nullable().optional()
|
|
49298
49329
|
});
|
|
49299
|
-
var GitHubSearchResponseSchema =
|
|
49300
|
-
total_count:
|
|
49301
|
-
items:
|
|
49330
|
+
var GitHubSearchResponseSchema = z105.object({
|
|
49331
|
+
total_count: z105.number().optional(),
|
|
49332
|
+
items: z105.array(GitHubRepoSchema).optional()
|
|
49302
49333
|
});
|
|
49303
49334
|
var GITHUB_SEARCH_BASE = "https://api.github.com/search/repositories";
|
|
49304
49335
|
function buildGithubQuery(input) {
|
|
@@ -49425,11 +49456,11 @@ function createSurveyHandler(deps) {
|
|
|
49425
49456
|
};
|
|
49426
49457
|
}
|
|
49427
49458
|
var SURVEY_OUTPUT_SCHEMA = {
|
|
49428
|
-
query:
|
|
49429
|
-
totalFound:
|
|
49430
|
-
candidates:
|
|
49431
|
-
sourcesQueried:
|
|
49432
|
-
sourcesFailed:
|
|
49459
|
+
query: z105.string(),
|
|
49460
|
+
totalFound: z105.number(),
|
|
49461
|
+
candidates: z105.array(z105.unknown()),
|
|
49462
|
+
sourcesQueried: z105.array(z105.string()),
|
|
49463
|
+
sourcesFailed: z105.array(z105.string())
|
|
49433
49464
|
};
|
|
49434
49465
|
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?".';
|
|
49435
49466
|
function registerSurveyOssLandscapeTool(server, deps) {
|
|
@@ -49458,7 +49489,7 @@ function registerSurveyOssLandscapeTool(server, deps) {
|
|
|
49458
49489
|
}
|
|
49459
49490
|
|
|
49460
49491
|
// src/mcp/tools/vendor-publishing-audit.ts
|
|
49461
|
-
import { z as
|
|
49492
|
+
import { z as z106 } from "zod";
|
|
49462
49493
|
|
|
49463
49494
|
// src/mcp/tools/vendor-publishing-seed.ts
|
|
49464
49495
|
var VENDOR_PUBLISHING_SEED = {
|
|
@@ -49531,8 +49562,8 @@ function listKnownVendors() {
|
|
|
49531
49562
|
}
|
|
49532
49563
|
|
|
49533
49564
|
// src/mcp/tools/vendor-publishing-audit.ts
|
|
49534
|
-
var VendorPublishingAuditInputSchema =
|
|
49535
|
-
vendor:
|
|
49565
|
+
var VendorPublishingAuditInputSchema = z106.object({
|
|
49566
|
+
vendor: z106.string().min(1).max(50).toLowerCase().describe('Vendor identifier, lowercase. e.g. "ubuntu", "debian", "fedora"')
|
|
49536
49567
|
});
|
|
49537
49568
|
function lookupVendor(vendor) {
|
|
49538
49569
|
if (isKnownVendor(vendor)) {
|
|
@@ -49564,20 +49595,20 @@ function createVendorPublishingAuditHandler(deps) {
|
|
|
49564
49595
|
};
|
|
49565
49596
|
}
|
|
49566
49597
|
var VENDOR_PUBLISHING_OUTPUT_SCHEMA = {
|
|
49567
|
-
vendor:
|
|
49568
|
-
known:
|
|
49598
|
+
vendor: z106.string(),
|
|
49599
|
+
known: z106.boolean(),
|
|
49569
49600
|
// Fields below populate when known=true; permissive optional for known=false.
|
|
49570
|
-
sha256SumsUrlPattern:
|
|
49571
|
-
sha256SumsSignatureUrlPattern:
|
|
49572
|
-
signaturePattern:
|
|
49573
|
-
gpgKeys:
|
|
49574
|
-
releaseCadence:
|
|
49575
|
-
keyRotationNotes:
|
|
49576
|
-
vendorDocUrl:
|
|
49577
|
-
citedAt:
|
|
49601
|
+
sha256SumsUrlPattern: z106.string().optional(),
|
|
49602
|
+
sha256SumsSignatureUrlPattern: z106.string().optional(),
|
|
49603
|
+
signaturePattern: z106.string().optional(),
|
|
49604
|
+
gpgKeys: z106.array(z106.unknown()).optional(),
|
|
49605
|
+
releaseCadence: z106.string().optional(),
|
|
49606
|
+
keyRotationNotes: z106.string().optional(),
|
|
49607
|
+
vendorDocUrl: z106.string().optional(),
|
|
49608
|
+
citedAt: z106.string().optional(),
|
|
49578
49609
|
// Fields below populate when known=false.
|
|
49579
|
-
message:
|
|
49580
|
-
knownVendors:
|
|
49610
|
+
message: z106.string().optional(),
|
|
49611
|
+
knownVendors: z106.array(z106.string()).optional()
|
|
49581
49612
|
};
|
|
49582
49613
|
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.";
|
|
49583
49614
|
function registerVendorPublishingAuditTool(server, deps) {
|
|
@@ -49606,17 +49637,17 @@ function registerVendorPublishingAuditTool(server, deps) {
|
|
|
49606
49637
|
}
|
|
49607
49638
|
|
|
49608
49639
|
// src/mcp/tools/compare-data-feeds.ts
|
|
49609
|
-
import { z as
|
|
49640
|
+
import { z as z107 } from "zod";
|
|
49610
49641
|
import * as path7 from "node:path";
|
|
49611
49642
|
import * as fs8 from "node:fs";
|
|
49612
49643
|
import * as yaml4 from "yaml";
|
|
49613
|
-
var CompareDataFeedsInputSchema =
|
|
49614
|
-
feedAPath:
|
|
49615
|
-
feedBPath:
|
|
49616
|
-
keyPath:
|
|
49644
|
+
var CompareDataFeedsInputSchema = z107.object({
|
|
49645
|
+
feedAPath: z107.string().min(1).max(1e3).describe("Filesystem path to feed A (YAML or JSON, auto-detected by extension)"),
|
|
49646
|
+
feedBPath: z107.string().min(1).max(1e3).describe("Filesystem path to feed B"),
|
|
49647
|
+
keyPath: z107.string().min(1).max(200).describe(
|
|
49617
49648
|
'Dotted path to the entry key, e.g. "id" or "name". Each entry must have this field.'
|
|
49618
49649
|
),
|
|
49619
|
-
compareFields:
|
|
49650
|
+
compareFields: z107.array(z107.string().min(1).max(200)).max(20).optional().describe(
|
|
49620
49651
|
'Optional dotted field paths to compare across matched entries (e.g. ["license", "sha256"])'
|
|
49621
49652
|
)
|
|
49622
49653
|
});
|
|
@@ -49800,24 +49831,24 @@ function createCompareDataFeedsHandler(deps) {
|
|
|
49800
49831
|
};
|
|
49801
49832
|
}
|
|
49802
49833
|
var COMPARE_OUTPUT_SCHEMA = {
|
|
49803
|
-
feedAPath:
|
|
49804
|
-
feedBPath:
|
|
49805
|
-
keyPath:
|
|
49806
|
-
counts:
|
|
49807
|
-
entriesInA:
|
|
49808
|
-
entriesInB:
|
|
49809
|
-
onlyInA:
|
|
49810
|
-
onlyInB:
|
|
49811
|
-
inBoth:
|
|
49812
|
-
fieldDifferences:
|
|
49834
|
+
feedAPath: z107.string(),
|
|
49835
|
+
feedBPath: z107.string(),
|
|
49836
|
+
keyPath: z107.string(),
|
|
49837
|
+
counts: z107.object({
|
|
49838
|
+
entriesInA: z107.number(),
|
|
49839
|
+
entriesInB: z107.number(),
|
|
49840
|
+
onlyInA: z107.number(),
|
|
49841
|
+
onlyInB: z107.number(),
|
|
49842
|
+
inBoth: z107.number(),
|
|
49843
|
+
fieldDifferences: z107.number()
|
|
49813
49844
|
}),
|
|
49814
|
-
coverage:
|
|
49815
|
-
onlyInA:
|
|
49816
|
-
onlyInB:
|
|
49817
|
-
inBoth:
|
|
49845
|
+
coverage: z107.object({
|
|
49846
|
+
onlyInA: z107.array(z107.string()),
|
|
49847
|
+
onlyInB: z107.array(z107.string()),
|
|
49848
|
+
inBoth: z107.array(z107.string())
|
|
49818
49849
|
}),
|
|
49819
|
-
fieldDifferences:
|
|
49820
|
-
summary:
|
|
49850
|
+
fieldDifferences: z107.array(z107.unknown()),
|
|
49851
|
+
summary: z107.string()
|
|
49821
49852
|
};
|
|
49822
49853
|
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.";
|
|
49823
49854
|
function registerCompareDataFeedsTool(server, deps) {
|
|
@@ -49846,9 +49877,9 @@ function registerCompareDataFeedsTool(server, deps) {
|
|
|
49846
49877
|
}
|
|
49847
49878
|
|
|
49848
49879
|
// src/mcp/tools/query-task-state-tool.ts
|
|
49849
|
-
import { z as
|
|
49850
|
-
var QueryTaskStateInputSchema =
|
|
49851
|
-
taskId:
|
|
49880
|
+
import { z as z108 } from "zod";
|
|
49881
|
+
var QueryTaskStateInputSchema = z108.object({
|
|
49882
|
+
taskId: z108.string().min(1).max(128).describe("Task ID whose structured state log should be read")
|
|
49852
49883
|
});
|
|
49853
49884
|
function queryTaskStateHandler(args, ctx) {
|
|
49854
49885
|
const parsed = QueryTaskStateInputSchema.safeParse(args);
|
|
@@ -49883,7 +49914,7 @@ function queryTaskStateHandler(args, ctx) {
|
|
|
49883
49914
|
function registerQueryTaskStateTool(server, deps) {
|
|
49884
49915
|
const logger57 = deps.logger ?? createLogger({ tool: "query_task_state" });
|
|
49885
49916
|
const toolSchema = {
|
|
49886
|
-
taskId:
|
|
49917
|
+
taskId: z108.string().min(1).max(128).describe("Task ID whose structured state log should be read")
|
|
49887
49918
|
};
|
|
49888
49919
|
const description = "Read the structured state log for a task ID and return the current snapshot. Includes Magentic-One Task Ledger (facts/guesses/openQuestions) and Progress Ledger (per-step reflections with suggestedAction) when orchestrators have written them. Structured state is only written when NEXUS_TASK_STATE_ENABLED=1 was set during the orchestrate invocation.";
|
|
49889
49920
|
const secureHandler = createSecureHandler(queryTaskStateHandler, {
|
|
@@ -49905,28 +49936,28 @@ function registerQueryTaskStateTool(server, deps) {
|
|
|
49905
49936
|
}
|
|
49906
49937
|
|
|
49907
49938
|
// src/mcp/tools/ci-health-check-tool.ts
|
|
49908
|
-
import { z as
|
|
49939
|
+
import { z as z111 } from "zod";
|
|
49909
49940
|
|
|
49910
49941
|
// src/mcp/tools/ci-health-log.ts
|
|
49911
49942
|
import { appendFileSync as appendFileSync5, existsSync as existsSync12, readFileSync as readFileSync11, statSync as statSync2, writeFileSync as writeFileSync3 } from "node:fs";
|
|
49912
|
-
import { z as
|
|
49943
|
+
import { z as z110 } from "zod";
|
|
49913
49944
|
|
|
49914
49945
|
// src/mcp/tools/ci-health-types.ts
|
|
49915
|
-
import { z as
|
|
49916
|
-
var CiHealthStatusSchema =
|
|
49946
|
+
import { z as z109 } from "zod";
|
|
49947
|
+
var CiHealthStatusSchema = z109.enum(["healthy", "degraded", "outage", "unknown"]);
|
|
49917
49948
|
|
|
49918
49949
|
// src/mcp/tools/ci-health-log.ts
|
|
49919
49950
|
var logger46 = createLogger({ component: "ci-health-log" });
|
|
49920
|
-
var CiHealthEventSchema =
|
|
49921
|
-
v:
|
|
49922
|
-
ts:
|
|
49951
|
+
var CiHealthEventSchema = z110.object({
|
|
49952
|
+
v: z110.literal(1),
|
|
49953
|
+
ts: z110.iso.datetime(),
|
|
49923
49954
|
status: CiHealthStatusSchema,
|
|
49924
|
-
repo:
|
|
49925
|
-
signals:
|
|
49926
|
-
|
|
49927
|
-
source:
|
|
49955
|
+
repo: z110.string().optional(),
|
|
49956
|
+
signals: z110.array(
|
|
49957
|
+
z110.object({
|
|
49958
|
+
source: z110.enum(["github-status", "repo-activity-window"]),
|
|
49928
49959
|
status: CiHealthStatusSchema,
|
|
49929
|
-
evidence:
|
|
49960
|
+
evidence: z110.string()
|
|
49930
49961
|
})
|
|
49931
49962
|
)
|
|
49932
49963
|
});
|
|
@@ -50006,17 +50037,17 @@ function eventFromCheck(params) {
|
|
|
50006
50037
|
}
|
|
50007
50038
|
|
|
50008
50039
|
// src/mcp/tools/ci-health-check-tool.ts
|
|
50009
|
-
var CiHealthCheckInputSchema =
|
|
50040
|
+
var CiHealthCheckInputSchema = z111.object({
|
|
50010
50041
|
/**
|
|
50011
50042
|
* Repo to check for the recent-runs activity signal (in `owner/repo` form).
|
|
50012
50043
|
* Optional — when omitted, only the status-page signal is consulted.
|
|
50013
50044
|
*/
|
|
50014
|
-
repo:
|
|
50045
|
+
repo: z111.string().regex(/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/, "Must be owner/repo form").optional().describe("GitHub repo (owner/repo) to check for recent CI activity. Optional."),
|
|
50015
50046
|
/**
|
|
50016
50047
|
* How far back to look for recent-runs activity (minutes). Default 30 —
|
|
50017
50048
|
* matches the typical wedge-detection window from the #3070 / #3076 outages.
|
|
50018
50049
|
*/
|
|
50019
|
-
activityWindowMinutes:
|
|
50050
|
+
activityWindowMinutes: z111.number().int().min(5).max(180).default(30).describe("Recent-runs lookback window in minutes (5-180; default 30).")
|
|
50020
50051
|
});
|
|
50021
50052
|
var STATUS_PAGE_URL = "https://www.githubstatus.com/api/v2/components.json";
|
|
50022
50053
|
function mapStatusPageStatus(raw) {
|
|
@@ -50149,8 +50180,8 @@ var DESCRIPTION = "Check CI infrastructure health before triggering / polling ru
|
|
|
50149
50180
|
function registerCiHealthCheckTool(server, deps) {
|
|
50150
50181
|
const logger57 = deps.logger ?? createLogger({ tool: "ci_health_check" });
|
|
50151
50182
|
const toolSchema = {
|
|
50152
|
-
repo:
|
|
50153
|
-
activityWindowMinutes:
|
|
50183
|
+
repo: z111.string().regex(/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/, "Must be owner/repo form").optional().describe("GitHub repo (owner/repo) to check for recent CI activity. Optional."),
|
|
50184
|
+
activityWindowMinutes: z111.number().int().min(5).max(180).optional().describe("Recent-runs lookback window in minutes (5-180; default 30).")
|
|
50154
50185
|
};
|
|
50155
50186
|
const secureHandler = createSecureHandler((args) => ciHealthCheckHandler(args, logger57), {
|
|
50156
50187
|
toolName: "ci_health_check",
|
|
@@ -50176,18 +50207,18 @@ function registerCiHealthCheckTool(server, deps) {
|
|
|
50176
50207
|
|
|
50177
50208
|
// src/mcp/tools/quality-gate-tool.ts
|
|
50178
50209
|
import { statSync as statSync3 } from "node:fs";
|
|
50179
|
-
import { z as
|
|
50180
|
-
var QualityCheckSchema =
|
|
50210
|
+
import { z as z112 } from "zod";
|
|
50211
|
+
var QualityCheckSchema = z112.enum(["typecheck", "lint", "tests", "build", "security"]);
|
|
50181
50212
|
var DEFAULT_CHECKS = ["typecheck", "lint", "tests"];
|
|
50182
|
-
var RunQualityGateInputSchema =
|
|
50213
|
+
var RunQualityGateInputSchema = z112.object({
|
|
50183
50214
|
/** Project directory to run checks against. Must resolve inside the repo/cwd root. */
|
|
50184
|
-
projectDir:
|
|
50215
|
+
projectDir: z112.string().optional().describe(
|
|
50185
50216
|
"Project directory to run checks against (default: cwd). Must stay inside the repo root."
|
|
50186
50217
|
),
|
|
50187
50218
|
/** Which allowlisted checks to run. */
|
|
50188
|
-
checks:
|
|
50219
|
+
checks: z112.array(QualityCheckSchema).nonempty().default([...DEFAULT_CHECKS]).describe("Allowlisted checks to run (default: ['typecheck','lint','tests'])."),
|
|
50189
50220
|
/** 1-based iteration counter, forwarded to the engine for feedback context. */
|
|
50190
|
-
iteration:
|
|
50221
|
+
iteration: z112.number().int().min(1).default(1).describe("1-based iteration number (default 1).")
|
|
50191
50222
|
});
|
|
50192
50223
|
function validateProjectDir(raw) {
|
|
50193
50224
|
const candidate = raw ?? process.cwd();
|
|
@@ -50262,11 +50293,11 @@ var DESCRIPTION2 = "Run the QA quality gate (#1684 engine) against a project dir
|
|
|
50262
50293
|
function registerRunQualityGateTool(server, deps) {
|
|
50263
50294
|
const logger57 = deps.logger ?? createLogger({ tool: "run_quality_gate" });
|
|
50264
50295
|
const toolSchema = {
|
|
50265
|
-
projectDir:
|
|
50296
|
+
projectDir: z112.string().optional().describe(
|
|
50266
50297
|
"Project directory to run checks against (default: cwd). Must stay inside the repo root."
|
|
50267
50298
|
),
|
|
50268
|
-
checks:
|
|
50269
|
-
iteration:
|
|
50299
|
+
checks: z112.array(QualityCheckSchema).nonempty().optional().describe("Allowlisted checks to run (default: ['typecheck','lint','tests'])."),
|
|
50300
|
+
iteration: z112.number().int().min(1).optional().describe("1-based iteration number (default 1).")
|
|
50270
50301
|
};
|
|
50271
50302
|
const secureHandler = createSecureHandler(
|
|
50272
50303
|
(args) => runQualityGateHandler(args, logger57),
|
|
@@ -50296,9 +50327,9 @@ function registerRunQualityGateTool(server, deps) {
|
|
|
50296
50327
|
// src/mcp/tools/verify-audit-chain-tool.ts
|
|
50297
50328
|
import * as fs9 from "node:fs/promises";
|
|
50298
50329
|
import * as path8 from "node:path";
|
|
50299
|
-
import { z as
|
|
50300
|
-
var VerifyAuditChainInputSchema =
|
|
50301
|
-
logDir:
|
|
50330
|
+
import { z as z113 } from "zod";
|
|
50331
|
+
var VerifyAuditChainInputSchema = z113.object({
|
|
50332
|
+
logDir: z113.string().min(1).max(512).describe(
|
|
50302
50333
|
"Filesystem path to the FileAuditStorage log directory. Tool reads all `audit-*.jsonl` files in lexicographic order and verifies the combined chain."
|
|
50303
50334
|
)
|
|
50304
50335
|
});
|
|
@@ -50388,7 +50419,7 @@ async function handler2(args, ctx) {
|
|
|
50388
50419
|
function registerVerifyAuditChainTool(server, deps) {
|
|
50389
50420
|
const logger57 = deps.logger ?? createLogger({ tool: "verify_audit_chain" });
|
|
50390
50421
|
const toolSchema = {
|
|
50391
|
-
logDir:
|
|
50422
|
+
logDir: z113.string().min(1).max(512).describe(
|
|
50392
50423
|
"Filesystem path to the FileAuditStorage log directory. Tool reads all `audit-*.jsonl` files and verifies the combined hash chain."
|
|
50393
50424
|
)
|
|
50394
50425
|
};
|
|
@@ -50412,7 +50443,7 @@ function registerVerifyAuditChainTool(server, deps) {
|
|
|
50412
50443
|
}
|
|
50413
50444
|
|
|
50414
50445
|
// src/mcp/tools/suggest-research-tasks-tool.ts
|
|
50415
|
-
import { z as
|
|
50446
|
+
import { z as z114 } from "zod";
|
|
50416
50447
|
var SUGGEST_RESEARCH_TASKS_NOTE = "Suggestions derived from external research (untrusted); review before acting \u2014 nothing was executed or filed.";
|
|
50417
50448
|
var RESEARCH_BUDGET_MS = 2e4;
|
|
50418
50449
|
var RESEARCH_TIMED_OUT = /* @__PURE__ */ Symbol("research-budget-exceeded");
|
|
@@ -50429,11 +50460,11 @@ async function withResearchBudget(p, ms) {
|
|
|
50429
50460
|
if (timer !== void 0) clearTimeout(timer);
|
|
50430
50461
|
}
|
|
50431
50462
|
}
|
|
50432
|
-
var SuggestResearchTasksInputSchema =
|
|
50433
|
-
topic:
|
|
50434
|
-
qualityThreshold:
|
|
50435
|
-
maxTriggers:
|
|
50436
|
-
existingTaskIds:
|
|
50463
|
+
var SuggestResearchTasksInputSchema = z114.object({
|
|
50464
|
+
topic: z114.string().optional().describe("Topic filter passed to research_discover. Optional."),
|
|
50465
|
+
qualityThreshold: z114.number().min(0).max(10).optional().describe("Minimum quality score (0-10) a discovery must meet to be suggested. Optional."),
|
|
50466
|
+
maxTriggers: z114.number().int().min(1).optional().describe("Max number of candidate tasks to return (>=1). Optional."),
|
|
50467
|
+
existingTaskIds: z114.array(z114.string()).optional().describe("Known task IDs to skip (dedup). Optional.")
|
|
50437
50468
|
});
|
|
50438
50469
|
function toTriggerConfig(input) {
|
|
50439
50470
|
return {
|
|
@@ -50490,10 +50521,10 @@ var DESCRIPTION3 = "SUGGEST-ONLY: surface candidate pipeline tasks for human/orc
|
|
|
50490
50521
|
function registerSuggestResearchTasksTool(server, deps) {
|
|
50491
50522
|
const logger57 = deps.logger ?? createLogger({ tool: "suggest_research_tasks" });
|
|
50492
50523
|
const toolSchema = {
|
|
50493
|
-
topic:
|
|
50494
|
-
qualityThreshold:
|
|
50495
|
-
maxTriggers:
|
|
50496
|
-
existingTaskIds:
|
|
50524
|
+
topic: z114.string().optional().describe("Topic filter passed to research_discover. Optional."),
|
|
50525
|
+
qualityThreshold: z114.number().min(0).max(10).optional().describe("Minimum quality score (0-10) a discovery must meet to be suggested. Optional."),
|
|
50526
|
+
maxTriggers: z114.number().int().min(1).optional().describe("Max number of candidate tasks to return (>=1). Optional."),
|
|
50527
|
+
existingTaskIds: z114.array(z114.string()).optional().describe("Known task IDs to skip (dedup). Optional.")
|
|
50497
50528
|
};
|
|
50498
50529
|
const secureHandler = createSecureHandler(
|
|
50499
50530
|
(args) => suggestResearchTasksHandler(args, logger57),
|
|
@@ -50521,7 +50552,7 @@ function registerSuggestResearchTasksTool(server, deps) {
|
|
|
50521
50552
|
}
|
|
50522
50553
|
|
|
50523
50554
|
// src/mcp/tools/run-tool.ts
|
|
50524
|
-
import { z as
|
|
50555
|
+
import { z as z118 } from "zod";
|
|
50525
50556
|
import { randomUUID as randomUUID17 } from "node:crypto";
|
|
50526
50557
|
|
|
50527
50558
|
// src/orchestration/meta-dispatcher.ts
|
|
@@ -50947,7 +50978,7 @@ function createMetaOrchestrator(options) {
|
|
|
50947
50978
|
|
|
50948
50979
|
// src/orchestration/meta-shadow-selector.ts
|
|
50949
50980
|
import { appendFileSync as appendFileSync6, existsSync as existsSync13, readFileSync as readFileSync12 } from "node:fs";
|
|
50950
|
-
import { z as
|
|
50981
|
+
import { z as z115 } from "zod";
|
|
50951
50982
|
var SHADOW_STRATEGY_ARMS = [
|
|
50952
50983
|
"single-shot",
|
|
50953
50984
|
"dev-pipeline",
|
|
@@ -51034,19 +51065,19 @@ function createHydratableSelector() {
|
|
|
51034
51065
|
var META_OUTCOME_SCHEMA_VERSION = 1;
|
|
51035
51066
|
var HYDRATE_LOOKBACK_DAYS = 30;
|
|
51036
51067
|
var HYDRATE_LOOKBACK_MS = HYDRATE_LOOKBACK_DAYS * 24 * 60 * 60 * 1e3;
|
|
51037
|
-
var PersistedContextSchema =
|
|
51038
|
-
taskComplexity:
|
|
51039
|
-
contextLengthNormalized:
|
|
51040
|
-
isCodeTask:
|
|
51041
|
-
isReasoningTask:
|
|
51042
|
-
budgetUtilization:
|
|
51043
|
-
timePressure:
|
|
51044
|
-
});
|
|
51045
|
-
var PersistedMetaOutcomeSchema =
|
|
51046
|
-
schema:
|
|
51047
|
-
timestamp:
|
|
51048
|
-
strategy:
|
|
51049
|
-
success:
|
|
51068
|
+
var PersistedContextSchema = z115.object({
|
|
51069
|
+
taskComplexity: z115.number(),
|
|
51070
|
+
contextLengthNormalized: z115.number(),
|
|
51071
|
+
isCodeTask: z115.number(),
|
|
51072
|
+
isReasoningTask: z115.number(),
|
|
51073
|
+
budgetUtilization: z115.number(),
|
|
51074
|
+
timePressure: z115.number()
|
|
51075
|
+
});
|
|
51076
|
+
var PersistedMetaOutcomeSchema = z115.object({
|
|
51077
|
+
schema: z115.literal(META_OUTCOME_SCHEMA_VERSION),
|
|
51078
|
+
timestamp: z115.string(),
|
|
51079
|
+
strategy: z115.enum(SHADOW_STRATEGY_ARMS),
|
|
51080
|
+
success: z115.boolean(),
|
|
51050
51081
|
context: PersistedContextSchema
|
|
51051
51082
|
});
|
|
51052
51083
|
var persistLogger = createLogger({ component: "MetaShadowSelector" });
|
|
@@ -51439,7 +51470,7 @@ function evaluateMetaStrategyReadiness(result, config = DEFAULT_META_STRATEGY_RE
|
|
|
51439
51470
|
}
|
|
51440
51471
|
|
|
51441
51472
|
// src/mcp/tools/dev-pipeline-tool.ts
|
|
51442
|
-
import { z as
|
|
51473
|
+
import { z as z116 } from "zod";
|
|
51443
51474
|
import * as fs11 from "node:fs";
|
|
51444
51475
|
import * as path10 from "node:path";
|
|
51445
51476
|
import { randomUUID as randomUUID15 } from "node:crypto";
|
|
@@ -51592,36 +51623,36 @@ var DEV_PIPELINE_DRY_RUN_NOTE = "This was a dry run (plan+vote), which always ru
|
|
|
51592
51623
|
function dispatchNoteFor(dryRun) {
|
|
51593
51624
|
return dryRun ? DEV_PIPELINE_DRY_RUN_NOTE : DEV_PIPELINE_ASYNC_HINT;
|
|
51594
51625
|
}
|
|
51595
|
-
var DevPipelineInputSchema =
|
|
51626
|
+
var DevPipelineInputSchema = z116.object({
|
|
51596
51627
|
/** Direct task instructions. */
|
|
51597
|
-
task:
|
|
51628
|
+
task: z116.string().max(1e4).optional().describe("Direct task instructions (what to build)"),
|
|
51598
51629
|
/** Path to a plan file (.md, .yaml, .txt) to use as input. */
|
|
51599
|
-
planFile:
|
|
51630
|
+
planFile: z116.string().max(500).optional().describe("Path to a plan/spec file to use as input"),
|
|
51600
51631
|
/** Whether to run in dry-run mode (plan+vote only, no implementation). */
|
|
51601
|
-
dryRun:
|
|
51632
|
+
dryRun: z116.boolean().default(false).describe("If true, stop after plan+vote (no implementation)"),
|
|
51602
51633
|
/** Maximum vote iterations before proceeding (default: 3). */
|
|
51603
|
-
maxVoteIterations:
|
|
51634
|
+
maxVoteIterations: z116.number().int().min(1).max(5).default(3).describe("Max plan\u2192vote iterations"),
|
|
51604
51635
|
/** Maximum QA iterations per task (default: 3). */
|
|
51605
|
-
maxQaIterations:
|
|
51636
|
+
maxQaIterations: z116.number().int().min(1).max(5).default(3).describe("Max QA review iterations per task"),
|
|
51606
51637
|
/** Working directory for the pipeline (default: cwd). Used for security scan and context. */
|
|
51607
|
-
workingDir:
|
|
51638
|
+
workingDir: z116.string().max(500).optional().describe("Working directory (default: cwd)"),
|
|
51608
51639
|
/** GitHub issue number to track progress on. Updates posted as comments. */
|
|
51609
|
-
issueNumber:
|
|
51640
|
+
issueNumber: z116.number().int().positive().optional().describe("GitHub issue to post progress to"),
|
|
51610
51641
|
/** GitHub repo (owner/name) for issue tracking. */
|
|
51611
|
-
repo:
|
|
51642
|
+
repo: z116.string().max(200).optional().describe("GitHub repo for issue tracking (e.g., owner/repo)"),
|
|
51612
51643
|
/** Task tracking backend: github, gitlab, or json (default: json). */
|
|
51613
|
-
trackerBackend:
|
|
51644
|
+
trackerBackend: z116.enum(["github", "gitlab", "json"]).default("json").describe("Task tracking backend for issue creation"),
|
|
51614
51645
|
/** Labels to apply to created issues. */
|
|
51615
|
-
labels:
|
|
51646
|
+
labels: z116.array(z116.string()).optional().describe("Labels for created issues"),
|
|
51616
51647
|
/** Session ID for checkpoint/resume. Enables crash recovery. */
|
|
51617
|
-
sessionId:
|
|
51648
|
+
sessionId: z116.string().max(128).regex(/^[a-zA-Z0-9_-]+$/).optional().describe("Session ID for checkpoint/resume (crash recovery)"),
|
|
51618
51649
|
/**
|
|
51619
51650
|
* TESTS ONLY — when true, voters return random decisions. Must not be used as
|
|
51620
51651
|
* a fallback when adapters are unavailable; configure an adapter instead. (#2319)
|
|
51621
51652
|
*/
|
|
51622
|
-
simulateVotes:
|
|
51653
|
+
simulateVotes: z116.boolean().default(false).describe("TESTS ONLY \u2014 random output, must not be used for real decisions (#2319)"),
|
|
51623
51654
|
/** Voting strategy for consensus stages. */
|
|
51624
|
-
votingStrategy:
|
|
51655
|
+
votingStrategy: z116.enum([
|
|
51625
51656
|
"simple_majority",
|
|
51626
51657
|
"supermajority",
|
|
51627
51658
|
"unanimous",
|
|
@@ -51630,11 +51661,11 @@ var DevPipelineInputSchema = z115.object({
|
|
|
51630
51661
|
"opinion_wise"
|
|
51631
51662
|
]).optional().describe("Voting strategy for plan approval (default: higher_order)"),
|
|
51632
51663
|
/** Use 3 agents instead of 6 for faster voting. */
|
|
51633
|
-
quickMode:
|
|
51664
|
+
quickMode: z116.boolean().default(false).describe("Use 3 agents instead of 6 for faster consensus voting"),
|
|
51634
51665
|
/** Maximum execution time per stage in milliseconds (min 30s, max 600s). */
|
|
51635
|
-
timeoutMs:
|
|
51666
|
+
timeoutMs: z116.number().int().min(3e4).max(6e5).optional().describe("Max time per stage in ms (30000-600000). Default: varies by stage complexity"),
|
|
51636
51667
|
/** Pipeline execution mode. */
|
|
51637
|
-
mode:
|
|
51668
|
+
mode: z116.enum(["autonomous", "harness"]).default("autonomous").describe(
|
|
51638
51669
|
"'autonomous': full pipeline. 'harness': stops after decompose, returns tasks for caller to implement."
|
|
51639
51670
|
),
|
|
51640
51671
|
/**
|
|
@@ -51645,15 +51676,15 @@ var DevPipelineInputSchema = z115.object({
|
|
|
51645
51676
|
* `get_job_result({ jobId })` for the result. Ignored when `dryRun` is
|
|
51646
51677
|
* true (plan+vote completes fast, so dry runs always stay sync).
|
|
51647
51678
|
*/
|
|
51648
|
-
dispatch:
|
|
51679
|
+
dispatch: z116.enum(["sync", "async"]).default("sync").describe(
|
|
51649
51680
|
"Dispatch mode (#3726). 'sync' (default): run inline. 'async': return a jobId immediately + run in background (poll get_job_result). Ignored for dryRun."
|
|
51650
51681
|
),
|
|
51651
51682
|
/** Local pre-ship quality gate (typecheck/lint/tests) mode (#3356). */
|
|
51652
|
-
qualityGate:
|
|
51683
|
+
qualityGate: z116.enum(["off", "advisory", "blocking"]).default("off").describe(
|
|
51653
51684
|
"Pre-ship local quality gate. 'off' (default): skip. 'advisory': run + record feedback, never fail. 'blocking': a red gate fails the pipeline."
|
|
51654
51685
|
),
|
|
51655
51686
|
/** Opt-in per-run token budget — a safety cap for unattended runs (#3395). */
|
|
51656
|
-
maxBudgetTokens:
|
|
51687
|
+
maxBudgetTokens: z116.number().int().positive().optional().describe(
|
|
51657
51688
|
"Per-run token ceiling (#3395). When set, expert calls stop (returning failures) once cumulative usage crosses it \u2014 a hard-stop safety cap for unattended/multi-day runs. Omit to disable (default)."
|
|
51658
51689
|
)
|
|
51659
51690
|
});
|
|
@@ -51855,20 +51886,20 @@ function registerDevPipelineTool(server, deps) {
|
|
|
51855
51886
|
}
|
|
51856
51887
|
|
|
51857
51888
|
// src/mcp/tools/pipeline-tool.ts
|
|
51858
|
-
import { z as
|
|
51889
|
+
import { z as z117 } from "zod";
|
|
51859
51890
|
import * as fs12 from "node:fs";
|
|
51860
51891
|
import * as path11 from "node:path";
|
|
51861
51892
|
import { randomUUID as randomUUID16 } from "node:crypto";
|
|
51862
51893
|
var PIPELINE_ASYNC_HINT = "A full run_pipeline run can exceed the synchronous MCP request timeout. Retry with `dispatch: 'async'` to get a jobId immediately, then poll get_job_result({ jobId }) for the result.";
|
|
51863
|
-
var PipelineInputSchema =
|
|
51894
|
+
var PipelineInputSchema = z117.object({
|
|
51864
51895
|
/** The task to execute. */
|
|
51865
|
-
task:
|
|
51896
|
+
task: z117.string().min(5).max(1e4).describe("Task description \u2014 pipeline template auto-selected based on content"),
|
|
51866
51897
|
/** Path to a spec file (.md, .yaml) to use as task input. */
|
|
51867
|
-
specFile:
|
|
51898
|
+
specFile: z117.string().max(500).optional().describe("Path to a spec file \u2014 content prepended to task for greenfield projects"),
|
|
51868
51899
|
/** Override template — see `listTemplateIds()` for the canonical list (#2728). Auto-detected if omitted. */
|
|
51869
|
-
template:
|
|
51900
|
+
template: z117.string().max(50).optional().describe(`Pipeline template override. Available: ${listTemplateIds().join(", ")}`),
|
|
51870
51901
|
/** Voting strategy for consensus stages. */
|
|
51871
|
-
votingStrategy:
|
|
51902
|
+
votingStrategy: z117.enum([
|
|
51872
51903
|
"simple_majority",
|
|
51873
51904
|
"supermajority",
|
|
51874
51905
|
"unanimous",
|
|
@@ -51879,11 +51910,11 @@ var PipelineInputSchema = z116.object({
|
|
|
51879
51910
|
"Voting strategy for plan approval. simple_majority (default), supermajority (67%), unanimous, higher_order (Bayesian), proof_of_learning, opinion_wise"
|
|
51880
51911
|
),
|
|
51881
51912
|
/** Use 3 agents instead of 6 for faster voting. */
|
|
51882
|
-
quickMode:
|
|
51913
|
+
quickMode: z117.boolean().default(false).describe("Use 3 agents instead of 6 for faster consensus voting"),
|
|
51883
51914
|
/** Maximum execution time per stage in milliseconds (min 30s, max 600s). */
|
|
51884
|
-
timeoutMs:
|
|
51915
|
+
timeoutMs: z117.number().int().min(3e4).max(6e5).optional().describe("Max time per stage in ms (30000-600000). Default: varies by stage complexity"),
|
|
51885
51916
|
/** Stop after planning/voting (no implementation). */
|
|
51886
|
-
dryRun:
|
|
51917
|
+
dryRun: z117.boolean().default(false).describe("Stop after vote stage (no implementation)"),
|
|
51887
51918
|
/**
|
|
51888
51919
|
* Dispatch mode (#3730). `sync` (default) runs the pipeline inline and
|
|
51889
51920
|
* returns the result — but a real multi-stage adaptive run can exceed the
|
|
@@ -51892,11 +51923,11 @@ var PipelineInputSchema = z116.object({
|
|
|
51892
51923
|
* `get_job_result({ jobId })` for the result. Ignored when `dryRun` is true
|
|
51893
51924
|
* (plan+vote completes fast, so dry runs always stay sync).
|
|
51894
51925
|
*/
|
|
51895
|
-
dispatch:
|
|
51926
|
+
dispatch: z117.enum(["sync", "async"]).default("sync").describe(
|
|
51896
51927
|
"Dispatch mode (#3730). 'sync' (default): run inline. 'async': return a jobId immediately + run in background (poll get_job_result). Ignored for dryRun."
|
|
51897
51928
|
),
|
|
51898
51929
|
/** TESTS ONLY — random output, must not be used for real decisions. (#2319) */
|
|
51899
|
-
simulateVotes:
|
|
51930
|
+
simulateVotes: z117.boolean().default(false).describe("TESTS ONLY \u2014 random output, must not be used for real decisions (#2319)")
|
|
51900
51931
|
});
|
|
51901
51932
|
function buildOutput3(result, simulated) {
|
|
51902
51933
|
return {
|
|
@@ -52061,9 +52092,9 @@ function registerPipelineTool(server, deps) {
|
|
|
52061
52092
|
}
|
|
52062
52093
|
|
|
52063
52094
|
// src/mcp/tools/run-tool.ts
|
|
52064
|
-
var RunInputSchema =
|
|
52065
|
-
goal:
|
|
52066
|
-
forceStrategy:
|
|
52095
|
+
var RunInputSchema = z118.object({
|
|
52096
|
+
goal: z118.string().min(1).describe("Natural-language goal. nexus-agents selects how to execute it."),
|
|
52097
|
+
forceStrategy: z118.enum([
|
|
52067
52098
|
"single-shot",
|
|
52068
52099
|
"dev-pipeline",
|
|
52069
52100
|
"pipeline",
|
|
@@ -52075,10 +52106,10 @@ var RunInputSchema = z117.object({
|
|
|
52075
52106
|
]).optional().describe(
|
|
52076
52107
|
"Power-user override: force a specific strategy instead of letting the router choose."
|
|
52077
52108
|
),
|
|
52078
|
-
requiresConsensus:
|
|
52079
|
-
dependencyStructure:
|
|
52080
|
-
isNovel:
|
|
52081
|
-
execute:
|
|
52109
|
+
requiresConsensus: z118.boolean().optional().describe("Hint: the task needs a multi-perspective consensus decision."),
|
|
52110
|
+
dependencyStructure: z118.enum(["linear", "dag", "independent", "unknown"]).optional().describe("Hint: the dependency structure of the work."),
|
|
52111
|
+
isNovel: z118.boolean().optional().describe("Hint: this kind of task has not been seen before."),
|
|
52112
|
+
execute: z118.boolean().optional().describe(
|
|
52082
52113
|
"When true, actually run the selected strategy (if an executor is wired) and return its result; otherwise return the routing decision only (default false, read-only)."
|
|
52083
52114
|
),
|
|
52084
52115
|
/**
|
|
@@ -52093,7 +52124,7 @@ var RunInputSchema = z117.object({
|
|
|
52093
52124
|
* other, the call is REFUSED rather than executed: silently ignoring a
|
|
52094
52125
|
* do-not-act flag is the one outcome a governance substrate cannot allow.
|
|
52095
52126
|
*/
|
|
52096
|
-
dryRun:
|
|
52127
|
+
dryRun: z118.boolean().optional().describe(
|
|
52097
52128
|
"Plan and vote only, no implementation (#4806). Requires the dev-pipeline strategy \u2014 refused (never silently executed) when the router selects another."
|
|
52098
52129
|
),
|
|
52099
52130
|
/**
|
|
@@ -52104,7 +52135,7 @@ var RunInputSchema = z117.object({
|
|
|
52104
52135
|
* envelope immediately and runs in the background; poll
|
|
52105
52136
|
* `get_job_result({ jobId })`. Ignored for read-only routing (execute:false).
|
|
52106
52137
|
*/
|
|
52107
|
-
dispatch:
|
|
52138
|
+
dispatch: z118.enum(["sync", "async"]).optional().describe(
|
|
52108
52139
|
"Dispatch mode (#3732). 'sync' (default): run inline. 'async' (only with execute:true): return a jobId immediately + run in background (poll get_job_result)."
|
|
52109
52140
|
)
|
|
52110
52141
|
});
|
|
@@ -52329,12 +52360,12 @@ function registerRunTool(server, deps) {
|
|
|
52329
52360
|
}
|
|
52330
52361
|
|
|
52331
52362
|
// src/mcp/tools/list-available-models-tool.ts
|
|
52332
|
-
import { z as
|
|
52363
|
+
import { z as z119 } from "zod";
|
|
52333
52364
|
var DESCRIPTION5 = "Probe every model-discovery transport (OpenRouter API + opencode/claude/codex/gemini CLIs) and report a per-transport health summary: probe ok/failed, model count, and a sample of ids. Use it to validate the CLIs and APIs are wired and reachable. Read-only; does not change routing.";
|
|
52334
52365
|
var PROBE_TIMEOUT_MS = 12e3;
|
|
52335
|
-
var ListAvailableModelsInputSchema =
|
|
52336
|
-
includeModelIds:
|
|
52337
|
-
includeOpenRouter:
|
|
52366
|
+
var ListAvailableModelsInputSchema = z119.object({
|
|
52367
|
+
includeModelIds: z119.boolean().optional().describe("Include the full model-id list per transport (default false \u2192 sample of 5 only)."),
|
|
52368
|
+
includeOpenRouter: z119.boolean().optional().describe("Probe the OpenRouter live catalog (default true).")
|
|
52338
52369
|
});
|
|
52339
52370
|
async function probeSource(source, includeModelIds) {
|
|
52340
52371
|
let timer;
|
|
@@ -52401,8 +52432,8 @@ async function listAvailableModelsHandler(args, deps, logger57) {
|
|
|
52401
52432
|
function registerListAvailableModelsTool(server, deps) {
|
|
52402
52433
|
const logger57 = deps.logger ?? createLogger({ tool: "list_available_models" });
|
|
52403
52434
|
const toolSchema = {
|
|
52404
|
-
includeModelIds:
|
|
52405
|
-
includeOpenRouter:
|
|
52435
|
+
includeModelIds: z119.boolean().optional().describe("Include the full model-id list per transport (default false \u2192 sample of 5 only)."),
|
|
52436
|
+
includeOpenRouter: z119.boolean().optional().describe("Probe the OpenRouter live catalog (default true).")
|
|
52406
52437
|
};
|
|
52407
52438
|
const secureHandler = createSecureHandler(
|
|
52408
52439
|
(args) => listAvailableModelsHandler(args, deps, logger57),
|
|
@@ -52426,7 +52457,7 @@ function registerListAvailableModelsTool(server, deps) {
|
|
|
52426
52457
|
}
|
|
52427
52458
|
|
|
52428
52459
|
// src/mcp/tools/pr-review-eval-types.ts
|
|
52429
|
-
import { z as
|
|
52460
|
+
import { z as z120 } from "zod";
|
|
52430
52461
|
var PR_REVIEW_EVAL_ROLES = [
|
|
52431
52462
|
"architect",
|
|
52432
52463
|
"security",
|
|
@@ -52434,43 +52465,43 @@ var PR_REVIEW_EVAL_ROLES = [
|
|
|
52434
52465
|
"catfish",
|
|
52435
52466
|
"scope_steward"
|
|
52436
52467
|
];
|
|
52437
|
-
var PrReviewEvalRoleSchema =
|
|
52438
|
-
var PrReviewCaseClassSchema =
|
|
52439
|
-
var VoterEvalVerdictSchema =
|
|
52468
|
+
var PrReviewEvalRoleSchema = z120.enum(PR_REVIEW_EVAL_ROLES);
|
|
52469
|
+
var PrReviewCaseClassSchema = z120.enum(["buggy", "clean", "borderline"]);
|
|
52470
|
+
var VoterEvalVerdictSchema = z120.object({
|
|
52440
52471
|
/** Stable record id (e.g. `${runId}:${caseNumber}:${role}`). */
|
|
52441
|
-
id:
|
|
52472
|
+
id: z120.string().min(1).max(160),
|
|
52442
52473
|
/** The pr_review run / batch this verdict belongs to. */
|
|
52443
|
-
runId:
|
|
52474
|
+
runId: z120.string().min(1).max(64),
|
|
52444
52475
|
/** Dataset case identifier (the dataset's `number` field). */
|
|
52445
|
-
caseNumber:
|
|
52476
|
+
caseNumber: z120.string().min(1).max(80),
|
|
52446
52477
|
/** Rubric class of the case (ground-truth label). */
|
|
52447
52478
|
caseClass: PrReviewCaseClassSchema,
|
|
52448
52479
|
/** The voter role being scored. */
|
|
52449
52480
|
role: PrReviewEvalRoleSchema,
|
|
52450
52481
|
/** Verified findings that matched a known bug. */
|
|
52451
|
-
truePositives:
|
|
52482
|
+
truePositives: z120.number().int().nonnegative(),
|
|
52452
52483
|
/** Verified findings on clean code that matched no known bug. */
|
|
52453
|
-
falsePositives:
|
|
52484
|
+
falsePositives: z120.number().int().nonnegative(),
|
|
52454
52485
|
/** Known bugs this voter failed to flag. */
|
|
52455
|
-
falseNegatives:
|
|
52486
|
+
falseNegatives: z120.number().int().nonnegative(),
|
|
52456
52487
|
/** Rubric version the ground truth was adjudicated under. */
|
|
52457
|
-
rubricVersion:
|
|
52488
|
+
rubricVersion: z120.string().min(1).max(32),
|
|
52458
52489
|
/** ISO-8601 timestamp the verdict was recorded. */
|
|
52459
|
-
timestamp:
|
|
52490
|
+
timestamp: z120.string().min(1).max(40)
|
|
52460
52491
|
});
|
|
52461
|
-
var VoterEvalVerdictQuerySchema =
|
|
52492
|
+
var VoterEvalVerdictQuerySchema = z120.object({
|
|
52462
52493
|
role: PrReviewEvalRoleSchema.optional(),
|
|
52463
|
-
runId:
|
|
52494
|
+
runId: z120.string().min(1).max(64).optional(),
|
|
52464
52495
|
caseClass: PrReviewCaseClassSchema.optional(),
|
|
52465
|
-
rubricVersion:
|
|
52496
|
+
rubricVersion: z120.string().min(1).max(32).optional(),
|
|
52466
52497
|
/** ISO-8601 lower bound (inclusive) on `timestamp`. */
|
|
52467
|
-
since:
|
|
52498
|
+
since: z120.string().optional(),
|
|
52468
52499
|
/** Most-recent-N cap. */
|
|
52469
|
-
limit:
|
|
52500
|
+
limit: z120.number().int().positive().optional()
|
|
52470
52501
|
});
|
|
52471
52502
|
|
|
52472
52503
|
// src/mcp/tools/supply-chain-tradeoff-panel.ts
|
|
52473
|
-
import { z as
|
|
52504
|
+
import { z as z121 } from "zod";
|
|
52474
52505
|
import { randomUUID as randomUUID18 } from "node:crypto";
|
|
52475
52506
|
var DEFAULT_AXES = [
|
|
52476
52507
|
"build_time_determinism",
|
|
@@ -52492,16 +52523,16 @@ var FULL_PANEL = [
|
|
|
52492
52523
|
"scope_steward"
|
|
52493
52524
|
];
|
|
52494
52525
|
var QUICK_PANEL = ["architect", "security", "scope_steward"];
|
|
52495
|
-
var SupplyChainTradeoffPanelInputSchema =
|
|
52496
|
-
proposal:
|
|
52497
|
-
axes:
|
|
52526
|
+
var SupplyChainTradeoffPanelInputSchema = z121.object({
|
|
52527
|
+
proposal: z121.string().min(1).max(MAX_PROPOSAL_LENGTH).describe('The proposal under tradeoff review (e.g. "Should aegis-boot adopt cargo-nextest?")'),
|
|
52528
|
+
axes: z121.array(z121.string().min(1).max(MAX_AXIS_NAME_LENGTH)).min(1).max(MAX_AXES).optional().describe(
|
|
52498
52529
|
`Tradeoff axes to evaluate. Default: ${DEFAULT_AXES.join(", ")}. Custom axes accepted; max ${String(MAX_AXES)}.`
|
|
52499
52530
|
),
|
|
52500
|
-
context:
|
|
52531
|
+
context: z121.string().max(MAX_CONTEXT_LENGTH).optional().describe(
|
|
52501
52532
|
"Optional context: relevant repo state, dependency tree, vendor publishing patterns, etc."
|
|
52502
52533
|
),
|
|
52503
|
-
quickMode:
|
|
52504
|
-
simulate:
|
|
52534
|
+
quickMode: z121.boolean().optional().default(false).describe("Use 3 voters (architect, security, scope_steward) instead of 7"),
|
|
52535
|
+
simulate: z121.boolean().optional().default(false).describe("Use simulated voters (testing only)"),
|
|
52505
52536
|
/**
|
|
52506
52537
|
* Dispatch mode (#3731). `sync` (default) runs the panel inline and returns
|
|
52507
52538
|
* the result — but a live fan-out (up to 7 voters) can exceed the MCP request
|
|
@@ -52509,7 +52540,7 @@ var SupplyChainTradeoffPanelInputSchema = z120.object({
|
|
|
52509
52540
|
* immediately and runs the panel in the background; poll
|
|
52510
52541
|
* `get_job_result({ jobId })` for the result.
|
|
52511
52542
|
*/
|
|
52512
|
-
dispatch:
|
|
52543
|
+
dispatch: z121.enum(["sync", "async"]).default("sync").describe(
|
|
52513
52544
|
"Dispatch mode (#3731). 'sync' (default): run inline. 'async': return a jobId immediately + run the panel in background (poll get_job_result)."
|
|
52514
52545
|
)
|
|
52515
52546
|
});
|
|
@@ -52987,40 +53018,40 @@ var RiskLevel = /* @__PURE__ */ ((RiskLevel2) => {
|
|
|
52987
53018
|
})(RiskLevel || {});
|
|
52988
53019
|
|
|
52989
53020
|
// src/mcp/safety/stpa-schemas.ts
|
|
52990
|
-
import { z as
|
|
52991
|
-
var HazardCategorySchema =
|
|
52992
|
-
var HazardSeveritySchema =
|
|
52993
|
-
var ConstraintPrioritySchema =
|
|
52994
|
-
var RiskLevelSchema =
|
|
52995
|
-
var TriggerPatternSchema =
|
|
52996
|
-
parameter:
|
|
52997
|
-
matchType:
|
|
52998
|
-
pattern:
|
|
52999
|
-
reason:
|
|
53000
|
-
});
|
|
53001
|
-
var HazardSchema =
|
|
53002
|
-
id:
|
|
53003
|
-
description:
|
|
53021
|
+
import { z as z122 } from "zod";
|
|
53022
|
+
var HazardCategorySchema = z122.enum(HazardCategory);
|
|
53023
|
+
var HazardSeveritySchema = z122.enum(HazardSeverity);
|
|
53024
|
+
var ConstraintPrioritySchema = z122.enum(ConstraintPriority);
|
|
53025
|
+
var RiskLevelSchema = z122.enum(RiskLevel);
|
|
53026
|
+
var TriggerPatternSchema = z122.object({
|
|
53027
|
+
parameter: z122.string().min(1),
|
|
53028
|
+
matchType: z122.enum(["contains", "regex", "equals", "startsWith", "endsWith"]),
|
|
53029
|
+
pattern: z122.string(),
|
|
53030
|
+
reason: z122.string()
|
|
53031
|
+
});
|
|
53032
|
+
var HazardSchema = z122.object({
|
|
53033
|
+
id: z122.string().min(1),
|
|
53034
|
+
description: z122.string(),
|
|
53004
53035
|
category: HazardCategorySchema,
|
|
53005
53036
|
severity: HazardSeveritySchema,
|
|
53006
|
-
likelihood:
|
|
53007
|
-
triggerConditions:
|
|
53008
|
-
consequences:
|
|
53009
|
-
});
|
|
53010
|
-
var UnsafeControlActionSchema =
|
|
53011
|
-
id:
|
|
53012
|
-
toolName:
|
|
53013
|
-
type:
|
|
53014
|
-
description:
|
|
53015
|
-
unsafeContext:
|
|
53016
|
-
relatedHazards:
|
|
53017
|
-
triggerPatterns:
|
|
53018
|
-
});
|
|
53019
|
-
var SafetyConstraintSchema =
|
|
53020
|
-
id:
|
|
53021
|
-
description:
|
|
53022
|
-
mitigates:
|
|
53023
|
-
enforcement:
|
|
53037
|
+
likelihood: z122.enum(["almost_certain", "likely", "possible", "unlikely", "rare"]),
|
|
53038
|
+
triggerConditions: z122.array(z122.string()),
|
|
53039
|
+
consequences: z122.array(z122.string())
|
|
53040
|
+
});
|
|
53041
|
+
var UnsafeControlActionSchema = z122.object({
|
|
53042
|
+
id: z122.string().min(1),
|
|
53043
|
+
toolName: z122.string().min(1),
|
|
53044
|
+
type: z122.enum(["not_provided", "provided_causes_hazard", "wrong_timing", "wrong_duration"]),
|
|
53045
|
+
description: z122.string(),
|
|
53046
|
+
unsafeContext: z122.string(),
|
|
53047
|
+
relatedHazards: z122.array(z122.string()),
|
|
53048
|
+
triggerPatterns: z122.array(TriggerPatternSchema).optional()
|
|
53049
|
+
});
|
|
53050
|
+
var SafetyConstraintSchema = z122.object({
|
|
53051
|
+
id: z122.string().min(1),
|
|
53052
|
+
description: z122.string(),
|
|
53053
|
+
mitigates: z122.array(z122.string()),
|
|
53054
|
+
enforcement: z122.enum([
|
|
53024
53055
|
"prevent",
|
|
53025
53056
|
"require_confirmation",
|
|
53026
53057
|
"alert",
|
|
@@ -53028,52 +53059,52 @@ var SafetyConstraintSchema = z121.object({
|
|
|
53028
53059
|
"rate_limit",
|
|
53029
53060
|
"require_privilege"
|
|
53030
53061
|
]),
|
|
53031
|
-
validationFunction:
|
|
53062
|
+
validationFunction: z122.string().optional(),
|
|
53032
53063
|
priority: ConstraintPrioritySchema
|
|
53033
53064
|
});
|
|
53034
|
-
var PropertySchemaSchema =
|
|
53035
|
-
type:
|
|
53036
|
-
description:
|
|
53037
|
-
enum:
|
|
53038
|
-
pattern:
|
|
53039
|
-
minimum:
|
|
53040
|
-
maximum:
|
|
53041
|
-
});
|
|
53042
|
-
var ToolInputSchemaSchema =
|
|
53043
|
-
type:
|
|
53044
|
-
properties:
|
|
53045
|
-
required:
|
|
53046
|
-
additionalProperties:
|
|
53047
|
-
});
|
|
53048
|
-
var ToolDefinitionSchema =
|
|
53049
|
-
name:
|
|
53050
|
-
description:
|
|
53065
|
+
var PropertySchemaSchema = z122.object({
|
|
53066
|
+
type: z122.string(),
|
|
53067
|
+
description: z122.string().optional(),
|
|
53068
|
+
enum: z122.array(z122.unknown()).optional(),
|
|
53069
|
+
pattern: z122.string().optional(),
|
|
53070
|
+
minimum: z122.number().optional(),
|
|
53071
|
+
maximum: z122.number().optional()
|
|
53072
|
+
});
|
|
53073
|
+
var ToolInputSchemaSchema = z122.object({
|
|
53074
|
+
type: z122.string(),
|
|
53075
|
+
properties: z122.record(z122.string(), PropertySchemaSchema).optional(),
|
|
53076
|
+
required: z122.array(z122.string()).optional(),
|
|
53077
|
+
additionalProperties: z122.boolean().optional()
|
|
53078
|
+
});
|
|
53079
|
+
var ToolDefinitionSchema = z122.object({
|
|
53080
|
+
name: z122.string().min(1),
|
|
53081
|
+
description: z122.string(),
|
|
53051
53082
|
inputSchema: ToolInputSchemaSchema
|
|
53052
53083
|
});
|
|
53053
|
-
var AnalysisConfigurationSchema =
|
|
53054
|
-
includeLowSeverity:
|
|
53055
|
-
generateAllConstraints:
|
|
53056
|
-
checkInteractions:
|
|
53057
|
-
maxHazardsPerTool:
|
|
53058
|
-
categories:
|
|
53084
|
+
var AnalysisConfigurationSchema = z122.object({
|
|
53085
|
+
includeLowSeverity: z122.boolean().default(true),
|
|
53086
|
+
generateAllConstraints: z122.boolean().default(true),
|
|
53087
|
+
checkInteractions: z122.boolean().default(true),
|
|
53088
|
+
maxHazardsPerTool: z122.number().int().min(1).max(100).default(50),
|
|
53089
|
+
categories: z122.array(HazardCategorySchema).default([])
|
|
53059
53090
|
});
|
|
53060
|
-
var ConstraintViolationSchema =
|
|
53061
|
-
constraintId:
|
|
53062
|
-
constraintDescription:
|
|
53091
|
+
var ConstraintViolationSchema = z122.object({
|
|
53092
|
+
constraintId: z122.string().min(1),
|
|
53093
|
+
constraintDescription: z122.string(),
|
|
53063
53094
|
severity: HazardSeveritySchema,
|
|
53064
|
-
details:
|
|
53065
|
-
remediation:
|
|
53066
|
-
});
|
|
53067
|
-
var ValidationWarningSchema =
|
|
53068
|
-
code:
|
|
53069
|
-
message:
|
|
53070
|
-
affected:
|
|
53071
|
-
});
|
|
53072
|
-
var ValidationResultSchema =
|
|
53073
|
-
valid:
|
|
53074
|
-
toolName:
|
|
53075
|
-
violations:
|
|
53076
|
-
passed:
|
|
53095
|
+
details: z122.string(),
|
|
53096
|
+
remediation: z122.string()
|
|
53097
|
+
});
|
|
53098
|
+
var ValidationWarningSchema = z122.object({
|
|
53099
|
+
code: z122.string().min(1),
|
|
53100
|
+
message: z122.string(),
|
|
53101
|
+
affected: z122.string()
|
|
53102
|
+
});
|
|
53103
|
+
var ValidationResultSchema = z122.object({
|
|
53104
|
+
valid: z122.boolean(),
|
|
53105
|
+
toolName: z122.string().min(1),
|
|
53106
|
+
violations: z122.array(ConstraintViolationSchema),
|
|
53107
|
+
passed: z122.array(z122.string()),
|
|
53077
53108
|
// Optional rather than required, deliberately. `ValidationResult` declares
|
|
53078
53109
|
// both fields required because every result this package produces has them;
|
|
53079
53110
|
// the schema is the lenient inbound edge for a result that arrived from
|
|
@@ -53084,10 +53115,10 @@ var ValidationResultSchema = z121.object({
|
|
|
53084
53115
|
// "nothing was evaluated". The strict/lenient split is safe because nothing
|
|
53085
53116
|
// bridges the two with `z.infer`: a parsed result will not typecheck as a
|
|
53086
53117
|
// `ValidationResult` without handling the absent fields.
|
|
53087
|
-
evaluated:
|
|
53088
|
-
notApplicable:
|
|
53089
|
-
warnings:
|
|
53090
|
-
validatedAt:
|
|
53118
|
+
evaluated: z122.array(z122.string()).optional(),
|
|
53119
|
+
notApplicable: z122.array(z122.string()).optional(),
|
|
53120
|
+
warnings: z122.array(ValidationWarningSchema),
|
|
53121
|
+
validatedAt: z122.date()
|
|
53091
53122
|
});
|
|
53092
53123
|
|
|
53093
53124
|
// src/mcp/safety/stpa-types.ts
|
|
@@ -54172,54 +54203,54 @@ var GeminiResponseParser = class {
|
|
|
54172
54203
|
};
|
|
54173
54204
|
|
|
54174
54205
|
// src/cli-adapters/router-types.ts
|
|
54175
|
-
import { z as
|
|
54176
|
-
var RouterConfigSchema =
|
|
54177
|
-
preferCostEfficient:
|
|
54178
|
-
maxDecisionTimeMs:
|
|
54206
|
+
import { z as z123 } from "zod";
|
|
54207
|
+
var RouterConfigSchema = z123.object({
|
|
54208
|
+
preferCostEfficient: z123.boolean().default(false),
|
|
54209
|
+
maxDecisionTimeMs: z123.number().min(1).max(1e3).default(100)
|
|
54179
54210
|
});
|
|
54180
54211
|
|
|
54181
54212
|
// src/cli-adapters/agreement-cascade-types.ts
|
|
54182
|
-
import { z as
|
|
54183
|
-
var AgreementCascadeConfigSchema =
|
|
54184
|
-
agreementThreshold:
|
|
54185
|
-
maxStages:
|
|
54186
|
-
modelTimeoutMs:
|
|
54213
|
+
import { z as z124 } from "zod";
|
|
54214
|
+
var AgreementCascadeConfigSchema = z124.object({
|
|
54215
|
+
agreementThreshold: z124.number().min(0.5).max(1).default(0.7),
|
|
54216
|
+
maxStages: z124.number().int().min(1).max(5).default(3),
|
|
54217
|
+
modelTimeoutMs: z124.number().int().min(1e3).max(3e5).default(6e4)
|
|
54187
54218
|
});
|
|
54188
54219
|
|
|
54189
54220
|
// src/cli-adapters/agreement-cascade-router.ts
|
|
54190
54221
|
var logger49 = createLogger({ component: "agreement-cascade-router" });
|
|
54191
54222
|
|
|
54192
54223
|
// src/cli-adapters/task-classifier.ts
|
|
54193
|
-
import { z as
|
|
54194
|
-
var ClassificationPatternsSchema =
|
|
54195
|
-
code:
|
|
54196
|
-
research:
|
|
54197
|
-
documentation:
|
|
54198
|
-
analysis:
|
|
54224
|
+
import { z as z125 } from "zod";
|
|
54225
|
+
var ClassificationPatternsSchema = z125.object({
|
|
54226
|
+
code: z125.array(z125.string()).readonly(),
|
|
54227
|
+
research: z125.array(z125.string()).readonly(),
|
|
54228
|
+
documentation: z125.array(z125.string()).readonly(),
|
|
54229
|
+
analysis: z125.array(z125.string()).readonly()
|
|
54199
54230
|
});
|
|
54200
54231
|
|
|
54201
54232
|
// src/cli-adapters/response-cache-types.ts
|
|
54202
|
-
import { z as
|
|
54203
|
-
var ResponseCacheConfigSchema =
|
|
54204
|
-
defaultTTL:
|
|
54233
|
+
import { z as z126 } from "zod";
|
|
54234
|
+
var ResponseCacheConfigSchema = z126.object({
|
|
54235
|
+
defaultTTL: z126.number().min(1e3).max(36e5).default(3e5),
|
|
54205
54236
|
// 5 minutes
|
|
54206
|
-
maxEntries:
|
|
54207
|
-
maxMemoryMB:
|
|
54208
|
-
cleanupInterval:
|
|
54237
|
+
maxEntries: z126.number().min(10).max(1e5).default(1e3),
|
|
54238
|
+
maxMemoryMB: z126.number().min(1).max(1e3).default(50),
|
|
54239
|
+
cleanupInterval: z126.number().min(1e3).max(6e5).default(6e4),
|
|
54209
54240
|
// 1 minute
|
|
54210
|
-
enableLogging:
|
|
54241
|
+
enableLogging: z126.boolean().default(false)
|
|
54211
54242
|
});
|
|
54212
54243
|
|
|
54213
54244
|
// src/cli-adapters/response-cache-utils.ts
|
|
54214
54245
|
var logger50 = createLogger({ component: "ResponseCacheUtils" });
|
|
54215
54246
|
|
|
54216
54247
|
// src/cli-adapters/unified-routing-types.ts
|
|
54217
|
-
import { z as
|
|
54218
|
-
var UnifiedRoutingDecisionSchema =
|
|
54219
|
-
selectedCli:
|
|
54220
|
-
confidence:
|
|
54221
|
-
reason:
|
|
54222
|
-
strategy:
|
|
54248
|
+
import { z as z127 } from "zod";
|
|
54249
|
+
var UnifiedRoutingDecisionSchema = z127.object({
|
|
54250
|
+
selectedCli: z127.string(),
|
|
54251
|
+
confidence: z127.number().min(0).max(1),
|
|
54252
|
+
reason: z127.string(),
|
|
54253
|
+
strategy: z127.enum([
|
|
54223
54254
|
"composite",
|
|
54224
54255
|
"quality",
|
|
54225
54256
|
"budget",
|
|
@@ -54231,57 +54262,57 @@ var UnifiedRoutingDecisionSchema = z126.object({
|
|
|
54231
54262
|
"linucb",
|
|
54232
54263
|
"direct"
|
|
54233
54264
|
]),
|
|
54234
|
-
decisionTimeMs:
|
|
54235
|
-
alternatives:
|
|
54236
|
-
stagesExecuted:
|
|
54237
|
-
withinBudget:
|
|
54238
|
-
estimatedComplexity:
|
|
54239
|
-
estimatedTokens:
|
|
54240
|
-
topsisScore:
|
|
54241
|
-
ucbScore:
|
|
54242
|
-
resolvedAtStage:
|
|
54243
|
-
consensusReached:
|
|
54244
|
-
agreementScore:
|
|
54245
|
-
metadata:
|
|
54265
|
+
decisionTimeMs: z127.number().nonnegative(),
|
|
54266
|
+
alternatives: z127.array(z127.string()).readonly(),
|
|
54267
|
+
stagesExecuted: z127.array(z127.string()).readonly(),
|
|
54268
|
+
withinBudget: z127.boolean().optional(),
|
|
54269
|
+
estimatedComplexity: z127.enum(["simple", "moderate", "complex", "expert"]).optional(),
|
|
54270
|
+
estimatedTokens: z127.number().int().positive().optional(),
|
|
54271
|
+
topsisScore: z127.number().optional(),
|
|
54272
|
+
ucbScore: z127.number().optional(),
|
|
54273
|
+
resolvedAtStage: z127.number().int().nonnegative().optional(),
|
|
54274
|
+
consensusReached: z127.boolean().optional(),
|
|
54275
|
+
agreementScore: z127.number().min(0).max(1).optional(),
|
|
54276
|
+
metadata: z127.record(z127.string(), z127.unknown()).optional()
|
|
54246
54277
|
});
|
|
54247
54278
|
|
|
54248
54279
|
// src/learning/outcome-feedback-types.ts
|
|
54249
|
-
import { z as
|
|
54250
|
-
var QualitySignalsSchema =
|
|
54251
|
-
testsPass:
|
|
54252
|
-
lintErrors:
|
|
54253
|
-
userApproved:
|
|
54254
|
-
retryCount:
|
|
54255
|
-
completionRatio:
|
|
54256
|
-
validStructure:
|
|
54257
|
-
coherenceScore:
|
|
54258
|
-
});
|
|
54259
|
-
var RoutingDecisionSchema =
|
|
54260
|
-
id:
|
|
54261
|
-
timestamp:
|
|
54262
|
-
query:
|
|
54263
|
-
routerType:
|
|
54264
|
-
selectedModel:
|
|
54265
|
-
selectedTier:
|
|
54266
|
-
armIndex:
|
|
54267
|
-
banditContext:
|
|
54268
|
-
queryFeatures:
|
|
54269
|
-
ucbScore:
|
|
54270
|
-
confidence:
|
|
54271
|
-
traceId:
|
|
54272
|
-
domain:
|
|
54273
|
-
});
|
|
54274
|
-
var TaskOutcomeSchema =
|
|
54275
|
-
routingDecisionId:
|
|
54276
|
-
timestamp:
|
|
54277
|
-
outcomeClass:
|
|
54278
|
-
success:
|
|
54279
|
-
qualityScore:
|
|
54280
|
-
durationMs:
|
|
54281
|
-
tokenUsage:
|
|
54282
|
-
errorMessage:
|
|
54280
|
+
import { z as z128 } from "zod";
|
|
54281
|
+
var QualitySignalsSchema = z128.object({
|
|
54282
|
+
testsPass: z128.boolean().optional(),
|
|
54283
|
+
lintErrors: z128.number().int().min(0).optional(),
|
|
54284
|
+
userApproved: z128.boolean().optional(),
|
|
54285
|
+
retryCount: z128.number().int().min(0).default(0),
|
|
54286
|
+
completionRatio: z128.number().min(0).max(1).default(1),
|
|
54287
|
+
validStructure: z128.boolean().optional(),
|
|
54288
|
+
coherenceScore: z128.number().min(0).max(1).optional()
|
|
54289
|
+
});
|
|
54290
|
+
var RoutingDecisionSchema = z128.object({
|
|
54291
|
+
id: z128.uuid(),
|
|
54292
|
+
timestamp: z128.iso.datetime(),
|
|
54293
|
+
query: z128.string(),
|
|
54294
|
+
routerType: z128.enum(["linucb", "preference", "quality", "cascade", "topsis"]),
|
|
54295
|
+
selectedModel: z128.string(),
|
|
54296
|
+
selectedTier: z128.enum(["strong", "weak"]).optional(),
|
|
54297
|
+
armIndex: z128.number().int().min(0).optional(),
|
|
54298
|
+
banditContext: z128.record(z128.string(), z128.unknown()).optional(),
|
|
54299
|
+
queryFeatures: z128.record(z128.string(), z128.unknown()).optional(),
|
|
54300
|
+
ucbScore: z128.number().optional(),
|
|
54301
|
+
confidence: z128.number().min(0).max(1).optional(),
|
|
54302
|
+
traceId: z128.string(),
|
|
54303
|
+
domain: z128.string().optional()
|
|
54304
|
+
});
|
|
54305
|
+
var TaskOutcomeSchema = z128.object({
|
|
54306
|
+
routingDecisionId: z128.uuid(),
|
|
54307
|
+
timestamp: z128.iso.datetime(),
|
|
54308
|
+
outcomeClass: z128.enum(["success", "partial", "failure", "timeout", "error"]),
|
|
54309
|
+
success: z128.boolean(),
|
|
54310
|
+
qualityScore: z128.number().min(0).max(1),
|
|
54311
|
+
durationMs: z128.number().min(0),
|
|
54312
|
+
tokenUsage: z128.number().int().min(0),
|
|
54313
|
+
errorMessage: z128.string().optional(),
|
|
54283
54314
|
qualitySignals: QualitySignalsSchema,
|
|
54284
|
-
traceId:
|
|
54315
|
+
traceId: z128.string()
|
|
54285
54316
|
});
|
|
54286
54317
|
var DEFAULT_FEEDBACK_COLLECTOR_CONFIG = {
|
|
54287
54318
|
maxPendingDecisions: 1e3,
|
|
@@ -54296,17 +54327,17 @@ var DEFAULT_FEEDBACK_COLLECTOR_CONFIG = {
|
|
|
54296
54327
|
targetTokenUsage: 2e3,
|
|
54297
54328
|
maxHistorySize: 1e4
|
|
54298
54329
|
};
|
|
54299
|
-
var FeedbackCollectorConfigSchema =
|
|
54300
|
-
maxPendingDecisions:
|
|
54301
|
-
pendingTimeoutMs:
|
|
54302
|
-
enableAutoReward:
|
|
54303
|
-
qualityWeight:
|
|
54304
|
-
speedWeight:
|
|
54305
|
-
efficiencyWeight:
|
|
54306
|
-
retryPenalty:
|
|
54307
|
-
targetDurationMs:
|
|
54308
|
-
targetTokenUsage:
|
|
54309
|
-
maxHistorySize:
|
|
54330
|
+
var FeedbackCollectorConfigSchema = z128.object({
|
|
54331
|
+
maxPendingDecisions: z128.number().int().positive().default(1e3),
|
|
54332
|
+
pendingTimeoutMs: z128.number().positive().default(3e5),
|
|
54333
|
+
enableAutoReward: z128.boolean().default(true),
|
|
54334
|
+
qualityWeight: z128.number().min(0).max(1).default(0.5),
|
|
54335
|
+
speedWeight: z128.number().min(0).max(1).default(0.2),
|
|
54336
|
+
efficiencyWeight: z128.number().min(0).max(1).default(0.2),
|
|
54337
|
+
retryPenalty: z128.number().min(0).max(1).default(0.1),
|
|
54338
|
+
targetDurationMs: z128.number().positive().default(5e3),
|
|
54339
|
+
targetTokenUsage: z128.number().positive().default(2e3),
|
|
54340
|
+
maxHistorySize: z128.number().int().positive().default(1e4)
|
|
54310
54341
|
});
|
|
54311
54342
|
|
|
54312
54343
|
// src/learning/outcome-feedback-helpers.ts
|
|
@@ -56444,4 +56475,4 @@ export {
|
|
|
56444
56475
|
shutdownFeedbackSubscriber,
|
|
56445
56476
|
createEventBusBridge
|
|
56446
56477
|
};
|
|
56447
|
-
//# sourceMappingURL=chunk-
|
|
56478
|
+
//# sourceMappingURL=chunk-ZBONAFV2.js.map
|