nexus-agents 8.55.1 → 8.55.2
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-ERX5ADAS.js → chunk-AFYXPM6L.js} +2 -2
- package/dist/{chunk-YZIZY2V5.js → chunk-C2KVHTFR.js} +2 -2
- package/dist/{chunk-MHKTXCD2.js → chunk-EJLJNXCZ.js} +2 -2
- package/dist/{chunk-KNQJUKFP.js → chunk-LFP2FZRT.js} +3 -3
- package/dist/{chunk-BMAJT4TH.js → chunk-QCVS3XB3.js} +3 -3
- package/dist/{chunk-CXI5IKJY.js → chunk-Z4XCDYPE.js} +958 -952
- package/dist/chunk-Z4XCDYPE.js.map +1 -0
- package/dist/cli.js +7 -7
- package/dist/{consensus-vote-BATXHKJC.js → consensus-vote-3M4BDMOJ.js} +4 -4
- package/dist/{improvement-review-R3PXNMQX.js → improvement-review-LZENZYBP.js} +4 -4
- package/dist/index.d.ts +2 -1
- package/dist/index.js +6 -6
- package/dist/{setup-data-dir-PAZGMEK7.js → setup-data-dir-5BYTOEYZ.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-CXI5IKJY.js.map +0 -1
- /package/dist/{chunk-ERX5ADAS.js.map → chunk-AFYXPM6L.js.map} +0 -0
- /package/dist/{chunk-YZIZY2V5.js.map → chunk-C2KVHTFR.js.map} +0 -0
- /package/dist/{chunk-MHKTXCD2.js.map → chunk-EJLJNXCZ.js.map} +0 -0
- /package/dist/{chunk-KNQJUKFP.js.map → chunk-LFP2FZRT.js.map} +0 -0
- /package/dist/{chunk-BMAJT4TH.js.map → chunk-QCVS3XB3.js.map} +0 -0
- /package/dist/{consensus-vote-BATXHKJC.js.map → consensus-vote-3M4BDMOJ.js.map} +0 -0
- /package/dist/{improvement-review-R3PXNMQX.js.map → improvement-review-LZENZYBP.js.map} +0 -0
- /package/dist/{setup-data-dir-PAZGMEK7.js.map → setup-data-dir-5BYTOEYZ.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-QCVS3XB3.js";
|
|
25
25
|
import {
|
|
26
26
|
executeExpert
|
|
27
27
|
} from "./chunk-TYIJXEOF.js";
|
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
toJobSummary,
|
|
63
63
|
updateStage,
|
|
64
64
|
writeJobCancelled
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-LFP2FZRT.js";
|
|
66
66
|
import {
|
|
67
67
|
allOf,
|
|
68
68
|
anyOf
|
|
@@ -82,7 +82,7 @@ import {
|
|
|
82
82
|
} from "./chunk-WZIGNHRW.js";
|
|
83
83
|
import {
|
|
84
84
|
withPrerequisite
|
|
85
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-EJLJNXCZ.js";
|
|
86
86
|
import {
|
|
87
87
|
NOOP_NOTIFIER,
|
|
88
88
|
RateLimiter,
|
|
@@ -107,7 +107,7 @@ import {
|
|
|
107
107
|
withAuditTrail,
|
|
108
108
|
withProgressHeartbeat,
|
|
109
109
|
wrapToolWithTimeout
|
|
110
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-C2KVHTFR.js";
|
|
111
111
|
import {
|
|
112
112
|
createAuditTrail,
|
|
113
113
|
createGraphAuditBridge,
|
|
@@ -27320,10 +27320,10 @@ function calculateDifferenceCI(p1, p2, total1, total2, confidence) {
|
|
|
27320
27320
|
const difference = p1 - p2;
|
|
27321
27321
|
const measured = total1 > 0 && total2 > 0;
|
|
27322
27322
|
const seDiff = Math.sqrt(p1 * (1 - p1) / (total1 || 1) + p2 * (1 - p2) / (total2 || 1));
|
|
27323
|
-
const
|
|
27323
|
+
const z129 = getZScore(confidence);
|
|
27324
27324
|
return {
|
|
27325
|
-
lower: difference -
|
|
27326
|
-
upper: difference +
|
|
27325
|
+
lower: difference - z129 * seDiff,
|
|
27326
|
+
upper: difference + z129 * seDiff,
|
|
27327
27327
|
estimate: difference,
|
|
27328
27328
|
confidence,
|
|
27329
27329
|
n: total1 + total2,
|
|
@@ -27351,11 +27351,11 @@ function proportionConfidenceInterval(successes, total, options = {}) {
|
|
|
27351
27351
|
measured: false
|
|
27352
27352
|
};
|
|
27353
27353
|
}
|
|
27354
|
-
const
|
|
27355
|
-
const z210 =
|
|
27354
|
+
const z129 = getZScore(opts.confidence);
|
|
27355
|
+
const z210 = z129 * z129;
|
|
27356
27356
|
const denominator = 1 + z210 / n;
|
|
27357
27357
|
const center = (p + z210 / (2 * n)) / denominator;
|
|
27358
|
-
const margin =
|
|
27358
|
+
const margin = z129 / denominator * Math.sqrt(p * (1 - p) / n + z210 / (4 * n * n));
|
|
27359
27359
|
const lower = Math.max(0, center - margin);
|
|
27360
27360
|
const upper = Math.min(1, center + margin);
|
|
27361
27361
|
const standardError = Math.sqrt(p * (1 - p) / n);
|
|
@@ -27393,8 +27393,8 @@ function meanConfidenceInterval(values, options = {}) {
|
|
|
27393
27393
|
const variance = values.reduce((sum, v) => sum + (v - mean) ** 2, 0) / (n - 1 || 1);
|
|
27394
27394
|
const stdDev = Math.sqrt(variance);
|
|
27395
27395
|
const standardError = stdDev / Math.sqrt(n);
|
|
27396
|
-
const
|
|
27397
|
-
const margin =
|
|
27396
|
+
const z129 = getZScore(opts.confidence);
|
|
27397
|
+
const margin = z129 * standardError;
|
|
27398
27398
|
return {
|
|
27399
27399
|
lower: mean - margin,
|
|
27400
27400
|
upper: mean + margin,
|
|
@@ -39095,7 +39095,7 @@ function registerListWorkflowsTool(server, deps) {
|
|
|
39095
39095
|
}
|
|
39096
39096
|
|
|
39097
39097
|
// src/mcp/tools/execute-expert.ts
|
|
39098
|
-
import { z as
|
|
39098
|
+
import { z as z70 } from "zod";
|
|
39099
39099
|
|
|
39100
39100
|
// src/mcp/tools/execute-expert-recording.ts
|
|
39101
39101
|
var ROLE_TO_CATEGORY = {
|
|
@@ -39289,14 +39289,113 @@ function observeExpertContext(observation, logger57, threshold = resolveContextW
|
|
|
39289
39289
|
}
|
|
39290
39290
|
}
|
|
39291
39291
|
|
|
39292
|
-
// src/mcp/tools/execute-expert.ts
|
|
39293
|
-
|
|
39294
|
-
var
|
|
39292
|
+
// src/mcp/tools/execute-expert-task-handler.ts
|
|
39293
|
+
import { z as z69 } from "zod";
|
|
39294
|
+
var EXECUTE_EXPERT_TOOL_SCHEMA = {
|
|
39295
39295
|
expertId: z69.string().min(1).describe("Expert ID from create_expert tool"),
|
|
39296
39296
|
task: z69.string().min(1).max(5e4).describe("Task description for the expert to execute"),
|
|
39297
39297
|
context: z69.record(z69.string(), z69.unknown()).optional().describe("Additional context metadata for the task"),
|
|
39298
|
-
timeoutMs: z69.number().int().min(
|
|
39299
|
-
|
|
39298
|
+
timeoutMs: z69.number().int().min(EXPERT_TIMEOUTS.executeFloorMs).max(EXPERT_TIMEOUTS.maxMs).optional().describe("Optional timeout in ms (120s-900s). Overrides auto-detected timeout.")
|
|
39299
|
+
};
|
|
39300
|
+
function createTaskHandler(deps, logger57, executor) {
|
|
39301
|
+
const notifier = deps.notifier ?? NOOP_NOTIFIER;
|
|
39302
|
+
return {
|
|
39303
|
+
createTask: (args, extra) => {
|
|
39304
|
+
const parsed = executor.inputSchema.safeParse(args);
|
|
39305
|
+
if (!parsed.success) {
|
|
39306
|
+
return Promise.reject(new Error(`Validation error: ${formatZodError(parsed.error)}`));
|
|
39307
|
+
}
|
|
39308
|
+
const validatedArgs = parsed.data;
|
|
39309
|
+
const { taskStore } = extra;
|
|
39310
|
+
const ttl = clampTaskTtl(DEFAULT_TASK_TTL_MS);
|
|
39311
|
+
return taskStore.createTask({ ttl, pollInterval: 5e3 }).then((task) => {
|
|
39312
|
+
logger57.info("Task created for execute_expert", {
|
|
39313
|
+
taskId: task.taskId,
|
|
39314
|
+
expertId: validatedArgs.expertId
|
|
39315
|
+
});
|
|
39316
|
+
void runBackgroundExpertTask({
|
|
39317
|
+
deps,
|
|
39318
|
+
args: validatedArgs,
|
|
39319
|
+
taskId: task.taskId,
|
|
39320
|
+
taskStore,
|
|
39321
|
+
notifier,
|
|
39322
|
+
execute: executor.execute
|
|
39323
|
+
});
|
|
39324
|
+
return { task };
|
|
39325
|
+
});
|
|
39326
|
+
},
|
|
39327
|
+
getTask: (_args, extra) => {
|
|
39328
|
+
return extra.taskStore.getTask(extra.taskId);
|
|
39329
|
+
},
|
|
39330
|
+
getTaskResult: (_args, extra) => {
|
|
39331
|
+
return extra.taskStore.getTaskResult(extra.taskId);
|
|
39332
|
+
}
|
|
39333
|
+
};
|
|
39334
|
+
}
|
|
39335
|
+
function notifyExpertComplete(notifier, taskId, response) {
|
|
39336
|
+
notifier.info("execute_expert", {
|
|
39337
|
+
event: "expert_complete",
|
|
39338
|
+
taskId,
|
|
39339
|
+
role: response.role,
|
|
39340
|
+
confidence: response.status === "success" ? 1 : 0,
|
|
39341
|
+
tokenUsage: response.tokensUsed,
|
|
39342
|
+
...response.tokensMeasured !== void 0 ? { tokensMeasured: response.tokensMeasured } : {}
|
|
39343
|
+
});
|
|
39344
|
+
}
|
|
39345
|
+
async function runBackgroundExpertTask(opts) {
|
|
39346
|
+
const { deps, args, taskId, taskStore, notifier, execute } = opts;
|
|
39347
|
+
const logger57 = deps.logger ?? createLogger({ tool: "execute_expert" });
|
|
39348
|
+
try {
|
|
39349
|
+
notifier.info("execute_expert", {
|
|
39350
|
+
event: "expert_start",
|
|
39351
|
+
taskId,
|
|
39352
|
+
expertId: args.expertId
|
|
39353
|
+
});
|
|
39354
|
+
const result = await withProgressHeartbeat(
|
|
39355
|
+
"execute_expert",
|
|
39356
|
+
notifier,
|
|
39357
|
+
() => execute(deps, args)
|
|
39358
|
+
);
|
|
39359
|
+
if (!result.ok) {
|
|
39360
|
+
await taskStore.storeTaskResult(taskId, "failed", {
|
|
39361
|
+
...toolStructuredError({
|
|
39362
|
+
errorCategory: "internal",
|
|
39363
|
+
message: `Failed to execute expert: ${result.error}`
|
|
39364
|
+
})
|
|
39365
|
+
});
|
|
39366
|
+
return;
|
|
39367
|
+
}
|
|
39368
|
+
notifyExpertComplete(notifier, taskId, result.value);
|
|
39369
|
+
await taskStore.storeTaskResult(taskId, "completed", {
|
|
39370
|
+
...toolSuccess(JSON.stringify(result.value, null, 2))
|
|
39371
|
+
});
|
|
39372
|
+
} catch (error) {
|
|
39373
|
+
const message = getErrorMessage(error);
|
|
39374
|
+
logger57.warn("Background expert task failed", { taskId, error: message });
|
|
39375
|
+
try {
|
|
39376
|
+
await taskStore.storeTaskResult(taskId, "failed", {
|
|
39377
|
+
...toolStructuredError({
|
|
39378
|
+
errorCategory: "internal",
|
|
39379
|
+
message: `Expert execution error: ${message}`
|
|
39380
|
+
})
|
|
39381
|
+
});
|
|
39382
|
+
} catch (storeError) {
|
|
39383
|
+
logger57.warn("Failed to store task failure result", {
|
|
39384
|
+
taskId,
|
|
39385
|
+
error: getErrorMessage(storeError)
|
|
39386
|
+
});
|
|
39387
|
+
}
|
|
39388
|
+
}
|
|
39389
|
+
}
|
|
39390
|
+
|
|
39391
|
+
// src/mcp/tools/execute-expert.ts
|
|
39392
|
+
var EXPERT_TIMEOUT_FLOOR_MS = EXPERT_TIMEOUTS.executeFloorMs;
|
|
39393
|
+
var ExecuteExpertInputSchema = z70.object({
|
|
39394
|
+
expertId: z70.string().min(1).describe("Expert ID from create_expert tool"),
|
|
39395
|
+
task: z70.string().min(1).max(5e4).describe("Task description for the expert to execute"),
|
|
39396
|
+
context: z70.record(z70.string(), z70.unknown()).optional().describe("Additional context metadata for the task"),
|
|
39397
|
+
timeoutMs: z70.number().int().min(EXPERT_TIMEOUT_FLOOR_MS).max(EXPERT_TIMEOUTS.maxMs).optional().describe("Optional timeout in ms (120s-900s). Overrides auto-detected timeout."),
|
|
39398
|
+
previousExpertSummary: z70.string().max(2e3).optional().describe(
|
|
39300
39399
|
"Summary from a previous expert in the chain. Injected into prompt for context continuity."
|
|
39301
39400
|
)
|
|
39302
39401
|
});
|
|
@@ -39660,102 +39759,6 @@ async function handleExecuteExpert(deps, args) {
|
|
|
39660
39759
|
return { ok: false, error: getErrorMessage(depthError) };
|
|
39661
39760
|
}
|
|
39662
39761
|
}
|
|
39663
|
-
var EXECUTE_EXPERT_TOOL_SCHEMA = {
|
|
39664
|
-
expertId: z69.string().min(1).describe("Expert ID from create_expert tool"),
|
|
39665
|
-
task: z69.string().min(1).max(5e4).describe("Task description for the expert to execute"),
|
|
39666
|
-
context: z69.record(z69.string(), z69.unknown()).optional().describe("Additional context metadata for the task"),
|
|
39667
|
-
timeoutMs: z69.number().int().min(EXPERT_TIMEOUT_FLOOR_MS).max(EXPERT_TIMEOUTS.maxMs).optional().describe("Optional timeout in ms (120s-900s). Overrides auto-detected timeout.")
|
|
39668
|
-
};
|
|
39669
|
-
function createTaskHandler(deps, logger57) {
|
|
39670
|
-
const notifier = deps.notifier ?? NOOP_NOTIFIER;
|
|
39671
|
-
return {
|
|
39672
|
-
createTask: (args, extra) => {
|
|
39673
|
-
const parsed = ExecuteExpertInputSchema.safeParse(args);
|
|
39674
|
-
if (!parsed.success) {
|
|
39675
|
-
return Promise.reject(new Error(`Validation error: ${formatZodError(parsed.error)}`));
|
|
39676
|
-
}
|
|
39677
|
-
const validatedArgs = parsed.data;
|
|
39678
|
-
const { taskStore } = extra;
|
|
39679
|
-
const ttl = clampTaskTtl(DEFAULT_TASK_TTL_MS);
|
|
39680
|
-
const taskPromise = taskStore.createTask({ ttl, pollInterval: 5e3 }).then((task) => {
|
|
39681
|
-
logger57.info("Task created for execute_expert", {
|
|
39682
|
-
taskId: task.taskId,
|
|
39683
|
-
expertId: validatedArgs.expertId
|
|
39684
|
-
});
|
|
39685
|
-
void runBackgroundExpertTask({
|
|
39686
|
-
deps,
|
|
39687
|
-
args: validatedArgs,
|
|
39688
|
-
taskId: task.taskId,
|
|
39689
|
-
taskStore,
|
|
39690
|
-
notifier
|
|
39691
|
-
});
|
|
39692
|
-
return { task };
|
|
39693
|
-
});
|
|
39694
|
-
return taskPromise;
|
|
39695
|
-
},
|
|
39696
|
-
getTask: (_args, extra) => {
|
|
39697
|
-
return extra.taskStore.getTask(extra.taskId);
|
|
39698
|
-
},
|
|
39699
|
-
getTaskResult: (_args, extra) => {
|
|
39700
|
-
return extra.taskStore.getTaskResult(extra.taskId);
|
|
39701
|
-
}
|
|
39702
|
-
};
|
|
39703
|
-
}
|
|
39704
|
-
function notifyExpertComplete(notifier, taskId, response) {
|
|
39705
|
-
notifier.info("execute_expert", {
|
|
39706
|
-
event: "expert_complete",
|
|
39707
|
-
taskId,
|
|
39708
|
-
role: response.role,
|
|
39709
|
-
confidence: response.status === "success" ? 1 : 0,
|
|
39710
|
-
tokenUsage: response.tokensUsed,
|
|
39711
|
-
...response.tokensMeasured !== void 0 ? { tokensMeasured: response.tokensMeasured } : {}
|
|
39712
|
-
});
|
|
39713
|
-
}
|
|
39714
|
-
async function runBackgroundExpertTask(opts) {
|
|
39715
|
-
const { deps, args, taskId, taskStore, notifier } = opts;
|
|
39716
|
-
const logger57 = deps.logger ?? createLogger({ tool: "execute_expert" });
|
|
39717
|
-
try {
|
|
39718
|
-
notifier.info("execute_expert", {
|
|
39719
|
-
event: "expert_start",
|
|
39720
|
-
taskId,
|
|
39721
|
-
expertId: args.expertId
|
|
39722
|
-
});
|
|
39723
|
-
const result = await withProgressHeartbeat(
|
|
39724
|
-
"execute_expert",
|
|
39725
|
-
notifier,
|
|
39726
|
-
() => handleExecuteExpert(deps, args)
|
|
39727
|
-
);
|
|
39728
|
-
if (!result.ok) {
|
|
39729
|
-
await taskStore.storeTaskResult(taskId, "failed", {
|
|
39730
|
-
...toolStructuredError({
|
|
39731
|
-
errorCategory: "internal",
|
|
39732
|
-
message: `Failed to execute expert: ${result.error}`
|
|
39733
|
-
})
|
|
39734
|
-
});
|
|
39735
|
-
return;
|
|
39736
|
-
}
|
|
39737
|
-
notifyExpertComplete(notifier, taskId, result.value);
|
|
39738
|
-
await taskStore.storeTaskResult(taskId, "completed", {
|
|
39739
|
-
...toolSuccess(JSON.stringify(result.value, null, 2))
|
|
39740
|
-
});
|
|
39741
|
-
} catch (error) {
|
|
39742
|
-
const message = getErrorMessage(error);
|
|
39743
|
-
logger57.warn("Background expert task failed", { taskId, error: message });
|
|
39744
|
-
try {
|
|
39745
|
-
await taskStore.storeTaskResult(taskId, "failed", {
|
|
39746
|
-
...toolStructuredError({
|
|
39747
|
-
errorCategory: "internal",
|
|
39748
|
-
message: `Expert execution error: ${message}`
|
|
39749
|
-
})
|
|
39750
|
-
});
|
|
39751
|
-
} catch (storeError) {
|
|
39752
|
-
logger57.warn("Failed to store task failure result", {
|
|
39753
|
-
taskId,
|
|
39754
|
-
error: getErrorMessage(storeError)
|
|
39755
|
-
});
|
|
39756
|
-
}
|
|
39757
|
-
}
|
|
39758
|
-
}
|
|
39759
39762
|
function registerExecuteExpertTool(server, deps) {
|
|
39760
39763
|
const logger57 = deps.logger ?? createLogger({ tool: "execute_expert" });
|
|
39761
39764
|
const notifier = deps.notifier ?? createMcpNotifier(server);
|
|
@@ -39769,31 +39772,34 @@ function registerExecuteExpertTool(server, deps) {
|
|
|
39769
39772
|
execution: { taskSupport: "optional" },
|
|
39770
39773
|
annotations: getToolAnnotations("execute_expert")
|
|
39771
39774
|
},
|
|
39772
|
-
createTaskHandler(depsWithNotifier, logger57
|
|
39775
|
+
createTaskHandler(depsWithNotifier, logger57, {
|
|
39776
|
+
inputSchema: ExecuteExpertInputSchema,
|
|
39777
|
+
execute: handleExecuteExpert
|
|
39778
|
+
})
|
|
39773
39779
|
);
|
|
39774
39780
|
logger57.info("Registered execute_expert tool with MCP Tasks support (taskSupport: optional)");
|
|
39775
39781
|
}
|
|
39776
39782
|
|
|
39777
39783
|
// src/mcp/tools/research-query.ts
|
|
39778
|
-
import { z as
|
|
39784
|
+
import { z as z72 } from "zod";
|
|
39779
39785
|
import { join as join6 } from "node:path";
|
|
39780
39786
|
|
|
39781
39787
|
// src/research/negative-results.ts
|
|
39782
39788
|
import { readFileSync as readFileSync5 } from "node:fs";
|
|
39783
39789
|
import { join as join5 } from "node:path";
|
|
39784
39790
|
import yaml3 from "yaml";
|
|
39785
|
-
import { z as
|
|
39791
|
+
import { z as z71 } from "zod";
|
|
39786
39792
|
var logger33 = createLogger({ component: "negative-results" });
|
|
39787
|
-
var NegativeResultSchema =
|
|
39788
|
-
name:
|
|
39789
|
-
paper:
|
|
39790
|
-
rejection_date:
|
|
39791
|
-
failure_mode:
|
|
39792
|
-
lessons_learned:
|
|
39793
|
-
reopen_conditions:
|
|
39793
|
+
var NegativeResultSchema = z71.object({
|
|
39794
|
+
name: z71.string(),
|
|
39795
|
+
paper: z71.string(),
|
|
39796
|
+
rejection_date: z71.string(),
|
|
39797
|
+
failure_mode: z71.string(),
|
|
39798
|
+
lessons_learned: z71.array(z71.string()),
|
|
39799
|
+
reopen_conditions: z71.array(z71.string())
|
|
39794
39800
|
});
|
|
39795
|
-
var NegativeResultsRegistrySchema =
|
|
39796
|
-
negative_results:
|
|
39801
|
+
var NegativeResultsRegistrySchema = z71.object({
|
|
39802
|
+
negative_results: z71.record(z71.string(), NegativeResultSchema)
|
|
39797
39803
|
});
|
|
39798
39804
|
var NEGATIVE_RESULTS_FILE = "negative-results.yaml";
|
|
39799
39805
|
function negativeResultsPath() {
|
|
@@ -39847,23 +39853,23 @@ function formatRejectionWarning(id, result) {
|
|
|
39847
39853
|
}
|
|
39848
39854
|
|
|
39849
39855
|
// src/mcp/tools/research-query.ts
|
|
39850
|
-
var ResearchQueryInputSchema =
|
|
39851
|
-
action:
|
|
39856
|
+
var ResearchQueryInputSchema = z72.object({
|
|
39857
|
+
action: z72.enum(["status", "overlap", "stats", "search"]).describe(
|
|
39852
39858
|
"Query action: status (technique status), overlap (find related techniques), stats (registry statistics), search (text search)"
|
|
39853
39859
|
),
|
|
39854
|
-
techniqueId:
|
|
39855
|
-
query:
|
|
39856
|
-
status:
|
|
39857
|
-
threshold:
|
|
39860
|
+
techniqueId: z72.string().optional().describe("Technique ID for status/overlap queries"),
|
|
39861
|
+
query: z72.string().optional().describe("Search query string for search action"),
|
|
39862
|
+
status: z72.enum(["implemented", "planned", "not-started", "rejected", "all"]).optional().default("all").describe("Filter by technique status (for status action)"),
|
|
39863
|
+
threshold: z72.number().min(0).max(1).optional().default(0.3).describe("Overlap threshold (0-1) for overlap action")
|
|
39858
39864
|
});
|
|
39859
39865
|
var ResearchQueryOutputSchema = {
|
|
39860
|
-
action:
|
|
39861
|
-
success:
|
|
39862
|
-
data:
|
|
39863
|
-
rejectionNotice:
|
|
39864
|
-
negativeResults:
|
|
39865
|
-
status:
|
|
39866
|
-
reason:
|
|
39866
|
+
action: z72.string(),
|
|
39867
|
+
success: z72.boolean(),
|
|
39868
|
+
data: z72.unknown(),
|
|
39869
|
+
rejectionNotice: z72.string().optional(),
|
|
39870
|
+
negativeResults: z72.object({
|
|
39871
|
+
status: z72.literal("unavailable"),
|
|
39872
|
+
reason: z72.string()
|
|
39867
39873
|
}).optional()
|
|
39868
39874
|
};
|
|
39869
39875
|
function rejectionMetadataFor(techniqueId) {
|
|
@@ -40001,11 +40007,11 @@ function createResearchQueryHandler(deps) {
|
|
|
40001
40007
|
function registerResearchQueryTool(server, deps) {
|
|
40002
40008
|
const logger57 = deps.logger ?? createLogger({ tool: "research_query" });
|
|
40003
40009
|
const toolSchema = {
|
|
40004
|
-
action:
|
|
40005
|
-
techniqueId:
|
|
40006
|
-
query:
|
|
40007
|
-
status:
|
|
40008
|
-
threshold:
|
|
40010
|
+
action: z72.enum(["status", "overlap", "stats", "search"]).describe("Query action: status, overlap, stats, or search"),
|
|
40011
|
+
techniqueId: z72.string().optional().describe("Technique ID for status/overlap queries"),
|
|
40012
|
+
query: z72.string().optional().describe("Search query string for search action"),
|
|
40013
|
+
status: z72.enum(["implemented", "planned", "not-started", "rejected", "all"]).optional().describe("Filter by technique status"),
|
|
40014
|
+
threshold: z72.number().min(0).max(1).optional().describe("Overlap threshold (0-1) for overlap action")
|
|
40009
40015
|
};
|
|
40010
40016
|
const description = "Query the research registry for technique status, overlaps, statistics, or text search. Provides read-only access to the research tracking system.";
|
|
40011
40017
|
const secureHandler = createSecureHandler(createResearchQueryHandler(deps), {
|
|
@@ -40032,12 +40038,12 @@ function registerResearchQueryTool(server, deps) {
|
|
|
40032
40038
|
}
|
|
40033
40039
|
|
|
40034
40040
|
// src/mcp/tools/research-add.ts
|
|
40035
|
-
import { z as
|
|
40036
|
-
var ResearchAddInputSchema =
|
|
40037
|
-
arxivId:
|
|
40038
|
-
topic:
|
|
40039
|
-
priority:
|
|
40040
|
-
dryRun:
|
|
40041
|
+
import { z as z73 } from "zod";
|
|
40042
|
+
var ResearchAddInputSchema = z73.object({
|
|
40043
|
+
arxivId: z73.string().regex(/^\d{4}\.\d{4,5}$/, "Invalid arXiv ID format (expected XXXX.XXXXX)").describe('arXiv paper ID (e.g., "2401.12345")'),
|
|
40044
|
+
topic: z73.string().optional().describe("Research topic to categorize the paper under"),
|
|
40045
|
+
priority: z73.enum(["P1", "P2", "P3", "P4"]).optional().describe("Priority level for the paper"),
|
|
40046
|
+
dryRun: z73.boolean().optional().default(false).describe("Preview what would be added without persisting")
|
|
40041
40047
|
});
|
|
40042
40048
|
async function executeResearchAdd(input, logger57) {
|
|
40043
40049
|
const exists = await paperExists(input.arxivId);
|
|
@@ -40105,10 +40111,10 @@ function createResearchAddHandler(deps) {
|
|
|
40105
40111
|
function registerResearchAddTool(server, deps) {
|
|
40106
40112
|
const logger57 = deps.logger ?? createLogger({ tool: "research_add" });
|
|
40107
40113
|
const toolSchema = {
|
|
40108
|
-
arxivId:
|
|
40109
|
-
topic:
|
|
40110
|
-
priority:
|
|
40111
|
-
dryRun:
|
|
40114
|
+
arxivId: z73.string().regex(/^\d{4}\.\d{4,5}$/).describe('arXiv paper ID (e.g., "2401.12345")'),
|
|
40115
|
+
topic: z73.string().optional().describe("Research topic to categorize the paper under"),
|
|
40116
|
+
priority: z73.enum(["P1", "P2", "P3", "P4"]).optional().describe("Priority level"),
|
|
40117
|
+
dryRun: z73.boolean().optional().default(false).describe("Preview without persisting")
|
|
40112
40118
|
};
|
|
40113
40119
|
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.";
|
|
40114
40120
|
const secureHandler = createSecureHandler(createResearchAddHandler(deps), {
|
|
@@ -40122,11 +40128,11 @@ function registerResearchAddTool(server, deps) {
|
|
|
40122
40128
|
logger: logger57
|
|
40123
40129
|
});
|
|
40124
40130
|
const outputSchema = {
|
|
40125
|
-
success:
|
|
40126
|
-
paperId:
|
|
40127
|
-
title:
|
|
40128
|
-
message:
|
|
40129
|
-
dryRun:
|
|
40131
|
+
success: z73.boolean(),
|
|
40132
|
+
paperId: z73.string().optional(),
|
|
40133
|
+
title: z73.string().optional(),
|
|
40134
|
+
message: z73.string(),
|
|
40135
|
+
dryRun: z73.boolean().optional()
|
|
40130
40136
|
};
|
|
40131
40137
|
server.registerTool(
|
|
40132
40138
|
"research_add",
|
|
@@ -40142,33 +40148,33 @@ function registerResearchAddTool(server, deps) {
|
|
|
40142
40148
|
}
|
|
40143
40149
|
|
|
40144
40150
|
// src/mcp/tools/research-add-source.ts
|
|
40145
|
-
import { z as
|
|
40146
|
-
var SourceTypeEnum =
|
|
40151
|
+
import { z as z74 } from "zod";
|
|
40152
|
+
var SourceTypeEnum = z74.enum([
|
|
40147
40153
|
"product_docs",
|
|
40148
40154
|
"specification",
|
|
40149
40155
|
"research_blog",
|
|
40150
40156
|
"code_analysis",
|
|
40151
40157
|
"open_source_repo"
|
|
40152
40158
|
]);
|
|
40153
|
-
var VerdictEnum =
|
|
40154
|
-
var ResearchAddSourceInputSchema =
|
|
40155
|
-
url:
|
|
40156
|
-
name:
|
|
40159
|
+
var VerdictEnum = z74.enum(["adopted", "partially_adopted", "rejected", "monitoring", "planned"]);
|
|
40160
|
+
var ResearchAddSourceInputSchema = z74.object({
|
|
40161
|
+
url: z74.string().min(1).max(500).describe("Source URL (GitHub repo, docs page, blog post)"),
|
|
40162
|
+
name: z74.string().min(1).max(200).describe("Display name for the source"),
|
|
40157
40163
|
type: SourceTypeEnum.describe("Source type classification"),
|
|
40158
|
-
vendor:
|
|
40159
|
-
topics:
|
|
40160
|
-
tags:
|
|
40161
|
-
quality_signals:
|
|
40162
|
-
stars_at_review:
|
|
40163
|
-
language:
|
|
40164
|
-
has_tests:
|
|
40165
|
-
has_docs:
|
|
40166
|
-
has_paper:
|
|
40164
|
+
vendor: z74.string().max(100).optional().describe("Vendor or organization"),
|
|
40165
|
+
topics: z74.array(z74.string().max(50)).max(5).optional().describe("Research topics (max 5)"),
|
|
40166
|
+
tags: z74.array(z74.string().max(50)).max(10).optional().describe("Searchable tags (max 10)"),
|
|
40167
|
+
quality_signals: z74.object({
|
|
40168
|
+
stars_at_review: z74.number().nonnegative().optional(),
|
|
40169
|
+
language: z74.string().max(50).optional(),
|
|
40170
|
+
has_tests: z74.boolean().optional(),
|
|
40171
|
+
has_docs: z74.boolean().optional(),
|
|
40172
|
+
has_paper: z74.boolean().optional()
|
|
40167
40173
|
}).optional().describe("Quality signals used to compute quality_score; provide explicitly \u2014 no GitHub metadata is fetched"),
|
|
40168
|
-
techniques_extracted:
|
|
40174
|
+
techniques_extracted: z74.array(z74.string().max(100)).max(5).optional().describe("Techniques identified in this source (max 5)"),
|
|
40169
40175
|
verdict: VerdictEnum.optional().describe("Adoption verdict"),
|
|
40170
|
-
verdict_notes:
|
|
40171
|
-
dryRun:
|
|
40176
|
+
verdict_notes: z74.string().max(500).optional().describe("Notes explaining the verdict"),
|
|
40177
|
+
dryRun: z74.boolean().optional().default(false).describe("Preview without persisting")
|
|
40172
40178
|
});
|
|
40173
40179
|
function generateSourceId(url) {
|
|
40174
40180
|
const match = /github\.com\/([^/]+)\/([^/]+)/.exec(url);
|
|
@@ -40308,23 +40314,23 @@ function createResearchAddSourceHandler(deps) {
|
|
|
40308
40314
|
function registerResearchAddSourceTool(server, deps) {
|
|
40309
40315
|
const logger57 = deps.logger ?? createLogger({ tool: "research_add_source" });
|
|
40310
40316
|
const toolSchema = {
|
|
40311
|
-
url:
|
|
40312
|
-
name:
|
|
40317
|
+
url: z74.string().min(1).describe("Source URL"),
|
|
40318
|
+
name: z74.string().min(1).describe("Display name"),
|
|
40313
40319
|
type: SourceTypeEnum.describe("Source type"),
|
|
40314
|
-
vendor:
|
|
40315
|
-
topics:
|
|
40316
|
-
tags:
|
|
40317
|
-
quality_signals:
|
|
40318
|
-
stars_at_review:
|
|
40319
|
-
language:
|
|
40320
|
-
has_tests:
|
|
40321
|
-
has_docs:
|
|
40322
|
-
has_paper:
|
|
40320
|
+
vendor: z74.string().optional().describe("Vendor"),
|
|
40321
|
+
topics: z74.array(z74.string()).max(5).optional().describe("Topics"),
|
|
40322
|
+
tags: z74.array(z74.string()).max(10).optional().describe("Tags"),
|
|
40323
|
+
quality_signals: z74.object({
|
|
40324
|
+
stars_at_review: z74.number().optional(),
|
|
40325
|
+
language: z74.string().optional(),
|
|
40326
|
+
has_tests: z74.boolean().optional(),
|
|
40327
|
+
has_docs: z74.boolean().optional(),
|
|
40328
|
+
has_paper: z74.boolean().optional()
|
|
40323
40329
|
}).optional().describe("Quality signals"),
|
|
40324
|
-
techniques_extracted:
|
|
40330
|
+
techniques_extracted: z74.array(z74.string()).max(5).optional().describe("Techniques"),
|
|
40325
40331
|
verdict: VerdictEnum.optional().describe("Adoption verdict"),
|
|
40326
|
-
verdict_notes:
|
|
40327
|
-
dryRun:
|
|
40332
|
+
verdict_notes: z74.string().max(500).optional().describe("Verdict notes"),
|
|
40333
|
+
dryRun: z74.boolean().optional().default(false).describe("Preview only")
|
|
40328
40334
|
};
|
|
40329
40335
|
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.";
|
|
40330
40336
|
const secureHandler = createSecureHandler(createResearchAddSourceHandler(deps), {
|
|
@@ -40350,22 +40356,22 @@ function registerResearchAddSourceTool(server, deps) {
|
|
|
40350
40356
|
);
|
|
40351
40357
|
}
|
|
40352
40358
|
var RESEARCH_ADD_SOURCE_OUTPUT_SCHEMA = {
|
|
40353
|
-
success:
|
|
40354
|
-
sourceId:
|
|
40355
|
-
name:
|
|
40356
|
-
quality_score:
|
|
40357
|
-
evidence_tier:
|
|
40358
|
-
message:
|
|
40359
|
-
dryRun:
|
|
40359
|
+
success: z74.boolean(),
|
|
40360
|
+
sourceId: z74.string().optional(),
|
|
40361
|
+
name: z74.string().optional(),
|
|
40362
|
+
quality_score: z74.number().optional(),
|
|
40363
|
+
evidence_tier: z74.string().optional(),
|
|
40364
|
+
message: z74.string().optional(),
|
|
40365
|
+
dryRun: z74.boolean().optional()
|
|
40360
40366
|
};
|
|
40361
40367
|
|
|
40362
40368
|
// src/mcp/tools/research-discover.ts
|
|
40363
|
-
import { z as
|
|
40369
|
+
import { z as z75 } from "zod";
|
|
40364
40370
|
var MAX_RESULTS_PER_SOURCE = 20;
|
|
40365
40371
|
var DEFAULT_RELEVANCE_THRESHOLD = 0.3;
|
|
40366
|
-
var ResearchDiscoverInputSchema =
|
|
40367
|
-
topic:
|
|
40368
|
-
source:
|
|
40372
|
+
var ResearchDiscoverInputSchema = z75.object({
|
|
40373
|
+
topic: z75.string().min(1).max(200).describe('Research topic to search for (e.g., "multi-agent orchestration")'),
|
|
40374
|
+
source: z75.enum([
|
|
40369
40375
|
"arxiv",
|
|
40370
40376
|
"github",
|
|
40371
40377
|
"google_ai",
|
|
@@ -40379,9 +40385,9 @@ var ResearchDiscoverInputSchema = z74.object({
|
|
|
40379
40385
|
]).optional().default("all").describe(
|
|
40380
40386
|
"Source to search: arxiv, github, google_ai, meta_fair, microsoft, deepmind, semantic_scholar, papers_with_code, openalex, or all"
|
|
40381
40387
|
),
|
|
40382
|
-
maxResults:
|
|
40383
|
-
sinceDate:
|
|
40384
|
-
relevanceThreshold:
|
|
40388
|
+
maxResults: z75.number().min(1).max(MAX_RESULTS_PER_SOURCE).optional().default(10).describe("Maximum results to return"),
|
|
40389
|
+
sinceDate: z75.string().optional().describe("Only return results after this date (YYYY-MM-DD format)"),
|
|
40390
|
+
relevanceThreshold: z75.number().min(0).max(1).optional().default(DEFAULT_RELEVANCE_THRESHOLD).describe(
|
|
40385
40391
|
"Minimum relevance score (0-1) to include in results. Higher values filter more aggressively."
|
|
40386
40392
|
)
|
|
40387
40393
|
});
|
|
@@ -40656,8 +40662,8 @@ function createResearchDiscoverHandler(deps) {
|
|
|
40656
40662
|
function registerResearchDiscoverTool(server, deps) {
|
|
40657
40663
|
const logger57 = deps.logger ?? createLogger({ tool: "research_discover" });
|
|
40658
40664
|
const toolSchema = {
|
|
40659
|
-
topic:
|
|
40660
|
-
source:
|
|
40665
|
+
topic: z75.string().min(1).max(200).describe("Research topic to search for"),
|
|
40666
|
+
source: z75.enum([
|
|
40661
40667
|
"arxiv",
|
|
40662
40668
|
"github",
|
|
40663
40669
|
"google_ai",
|
|
@@ -40669,9 +40675,9 @@ function registerResearchDiscoverTool(server, deps) {
|
|
|
40669
40675
|
"openalex",
|
|
40670
40676
|
"all"
|
|
40671
40677
|
]).optional().describe("Source to search"),
|
|
40672
|
-
maxResults:
|
|
40673
|
-
sinceDate:
|
|
40674
|
-
relevanceThreshold:
|
|
40678
|
+
maxResults: z75.number().min(1).max(MAX_RESULTS_PER_SOURCE).optional().describe("Max results"),
|
|
40679
|
+
sinceDate: z75.string().optional().describe("Only results after this date (YYYY-MM-DD)"),
|
|
40680
|
+
relevanceThreshold: z75.number().min(0).max(1).optional().describe("Minimum relevance score (0-1) to include results. Higher = stricter filtering.")
|
|
40675
40681
|
};
|
|
40676
40682
|
const description = "Discover new research papers and repositories from external sources. Searches arXiv, GitHub, and other sources. Filters out items already in the registry.";
|
|
40677
40683
|
const secureHandler = createSecureHandler(createResearchDiscoverHandler(deps), {
|
|
@@ -40697,24 +40703,24 @@ function registerResearchDiscoverTool(server, deps) {
|
|
|
40697
40703
|
logger57.info("Registered research_discover tool with secure handler and timeout protection");
|
|
40698
40704
|
}
|
|
40699
40705
|
var RESEARCH_DISCOVER_OUTPUT_SCHEMA = {
|
|
40700
|
-
topic:
|
|
40701
|
-
sourcesQueried:
|
|
40702
|
-
failedSources:
|
|
40703
|
-
items:
|
|
40704
|
-
totalFound:
|
|
40705
|
-
alreadyInRegistry:
|
|
40706
|
-
registryConsulted:
|
|
40707
|
-
newItems:
|
|
40708
|
-
filteredByRelevance:
|
|
40706
|
+
topic: z75.string().optional(),
|
|
40707
|
+
sourcesQueried: z75.array(z75.string()).optional(),
|
|
40708
|
+
failedSources: z75.array(z75.string()).optional(),
|
|
40709
|
+
items: z75.array(z75.unknown()).optional(),
|
|
40710
|
+
totalFound: z75.number().optional(),
|
|
40711
|
+
alreadyInRegistry: z75.number().optional(),
|
|
40712
|
+
registryConsulted: z75.boolean().optional(),
|
|
40713
|
+
newItems: z75.number().optional(),
|
|
40714
|
+
filteredByRelevance: z75.number().optional()
|
|
40709
40715
|
};
|
|
40710
40716
|
|
|
40711
40717
|
// src/mcp/tools/research-analyze.ts
|
|
40712
|
-
import { z as
|
|
40713
|
-
var ResearchAnalyzeInputSchema =
|
|
40714
|
-
focus:
|
|
40718
|
+
import { z as z76 } from "zod";
|
|
40719
|
+
var ResearchAnalyzeInputSchema = z76.object({
|
|
40720
|
+
focus: z76.enum(["gaps", "trends", "priorities", "stale", "coverage"]).describe(
|
|
40715
40721
|
"Analysis focus: gaps (missing coverage), trends (topic distribution), priorities (P1/P2 backlog), stale (outdated entries), coverage (implementation status)"
|
|
40716
40722
|
),
|
|
40717
|
-
topic:
|
|
40723
|
+
topic: z76.string().optional().describe("Optional topic filter to narrow analysis")
|
|
40718
40724
|
});
|
|
40719
40725
|
function failureResponse(focus, registry = "techniques") {
|
|
40720
40726
|
return {
|
|
@@ -40960,8 +40966,8 @@ function createResearchAnalyzeHandler(deps) {
|
|
|
40960
40966
|
function registerResearchAnalyzeTool(server, deps) {
|
|
40961
40967
|
const logger57 = deps.logger ?? createLogger({ tool: "research_analyze" });
|
|
40962
40968
|
const toolSchema = {
|
|
40963
|
-
focus:
|
|
40964
|
-
topic:
|
|
40969
|
+
focus: z76.enum(["gaps", "trends", "priorities", "stale", "coverage"]).describe("Analysis focus area"),
|
|
40970
|
+
topic: z76.string().optional().describe("Optional topic filter")
|
|
40965
40971
|
};
|
|
40966
40972
|
const description = "Analyze the research registry for gaps, trends, priorities, stale entries, or coverage. Returns structured analysis with recommendations.";
|
|
40967
40973
|
const secureHandler = createSecureHandler(createResearchAnalyzeHandler(deps), {
|
|
@@ -40975,10 +40981,10 @@ function registerResearchAnalyzeTool(server, deps) {
|
|
|
40975
40981
|
logger: logger57
|
|
40976
40982
|
});
|
|
40977
40983
|
const outputSchema = {
|
|
40978
|
-
focus:
|
|
40979
|
-
success:
|
|
40980
|
-
analysis:
|
|
40981
|
-
recommendations:
|
|
40984
|
+
focus: z76.string().optional(),
|
|
40985
|
+
success: z76.boolean().optional(),
|
|
40986
|
+
analysis: z76.unknown().optional(),
|
|
40987
|
+
recommendations: z76.array(z76.string()).optional()
|
|
40982
40988
|
};
|
|
40983
40989
|
server.registerTool(
|
|
40984
40990
|
"research_analyze",
|
|
@@ -40994,14 +41000,14 @@ function registerResearchAnalyzeTool(server, deps) {
|
|
|
40994
41000
|
}
|
|
40995
41001
|
|
|
40996
41002
|
// src/mcp/tools/research-catalog-review.ts
|
|
40997
|
-
import { z as
|
|
40998
|
-
var ResearchCatalogReviewInputSchema =
|
|
40999
|
-
action:
|
|
41003
|
+
import { z as z77 } from "zod";
|
|
41004
|
+
var ResearchCatalogReviewInputSchema = z77.object({
|
|
41005
|
+
action: z77.enum(["list", "approve", "dismiss", "flush"]).describe(
|
|
41000
41006
|
"Action: list (show pending), approve (add to registry), dismiss (remove), flush (clear all)"
|
|
41001
41007
|
),
|
|
41002
|
-
identifier:
|
|
41003
|
-
topic:
|
|
41004
|
-
createIssue:
|
|
41008
|
+
identifier: z77.string().optional().describe("Reference identifier for approve/dismiss actions (arXiv ID or GitHub URL)"),
|
|
41009
|
+
topic: z77.string().optional().describe("Topic to assign when approving an arXiv paper"),
|
|
41010
|
+
createIssue: z77.boolean().optional().default(false).describe("When approving, also create a GitHub issue for the paper")
|
|
41005
41011
|
});
|
|
41006
41012
|
function handleList() {
|
|
41007
41013
|
const catalog = getAutoCatalog();
|
|
@@ -41133,10 +41139,10 @@ function createCatalogReviewHandler(deps) {
|
|
|
41133
41139
|
function registerResearchCatalogReviewTool(server, deps) {
|
|
41134
41140
|
const logger57 = deps.logger ?? createLogger({ tool: "research_catalog_review" });
|
|
41135
41141
|
const toolSchema = {
|
|
41136
|
-
action:
|
|
41137
|
-
identifier:
|
|
41138
|
-
topic:
|
|
41139
|
-
createIssue:
|
|
41142
|
+
action: z77.enum(["list", "approve", "dismiss", "flush"]).describe("Action to perform on cataloged references"),
|
|
41143
|
+
identifier: z77.string().optional().describe("Reference identifier for approve/dismiss"),
|
|
41144
|
+
topic: z77.string().optional().describe("Topic for approved papers"),
|
|
41145
|
+
createIssue: z77.boolean().optional().describe("Create GitHub issue when approving")
|
|
41140
41146
|
};
|
|
41141
41147
|
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.";
|
|
41142
41148
|
const secureHandler = createSecureHandler(createCatalogReviewHandler(deps), {
|
|
@@ -41150,10 +41156,10 @@ function registerResearchCatalogReviewTool(server, deps) {
|
|
|
41150
41156
|
logger: logger57
|
|
41151
41157
|
});
|
|
41152
41158
|
const outputSchema = {
|
|
41153
|
-
action:
|
|
41154
|
-
success:
|
|
41155
|
-
message:
|
|
41156
|
-
data:
|
|
41159
|
+
action: z77.string().optional(),
|
|
41160
|
+
success: z77.boolean().optional(),
|
|
41161
|
+
message: z77.string().optional(),
|
|
41162
|
+
data: z77.unknown().optional()
|
|
41157
41163
|
};
|
|
41158
41164
|
server.registerTool(
|
|
41159
41165
|
"research_catalog_review",
|
|
@@ -41169,9 +41175,9 @@ function registerResearchCatalogReviewTool(server, deps) {
|
|
|
41169
41175
|
}
|
|
41170
41176
|
|
|
41171
41177
|
// src/mcp/tools/research-synthesize.ts
|
|
41172
|
-
import { z as
|
|
41173
|
-
var ResearchSynthesizeInputSchema =
|
|
41174
|
-
topic:
|
|
41178
|
+
import { z as z78 } from "zod";
|
|
41179
|
+
var ResearchSynthesizeInputSchema = z78.object({
|
|
41180
|
+
topic: z78.string().optional().describe("Optional topic to filter synthesis to a single cluster")
|
|
41175
41181
|
});
|
|
41176
41182
|
function createResearchSynthesizeHandler(deps) {
|
|
41177
41183
|
return async (args, _ctx) => {
|
|
@@ -41198,7 +41204,7 @@ function createResearchSynthesizeHandler(deps) {
|
|
|
41198
41204
|
function registerResearchSynthesizeTool(server, deps) {
|
|
41199
41205
|
const logger57 = deps.logger ?? createLogger({ tool: "research_synthesize" });
|
|
41200
41206
|
const toolSchema = {
|
|
41201
|
-
topic:
|
|
41207
|
+
topic: z78.string().optional().describe("Optional topic filter for single-cluster synthesis")
|
|
41202
41208
|
};
|
|
41203
41209
|
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.";
|
|
41204
41210
|
const secureHandler = createSecureHandler(createResearchSynthesizeHandler(deps), {
|
|
@@ -41212,12 +41218,12 @@ function registerResearchSynthesizeTool(server, deps) {
|
|
|
41212
41218
|
logger: logger57
|
|
41213
41219
|
});
|
|
41214
41220
|
const outputSchema = {
|
|
41215
|
-
clusters:
|
|
41216
|
-
totalPapers:
|
|
41217
|
-
topicCount:
|
|
41218
|
-
crossCuttingThemes:
|
|
41219
|
-
alignmentSummary:
|
|
41220
|
-
featureGates:
|
|
41221
|
+
clusters: z78.array(z78.unknown()).optional(),
|
|
41222
|
+
totalPapers: z78.number().optional(),
|
|
41223
|
+
topicCount: z78.number().optional(),
|
|
41224
|
+
crossCuttingThemes: z78.array(z78.unknown()).optional(),
|
|
41225
|
+
alignmentSummary: z78.unknown().optional(),
|
|
41226
|
+
featureGates: z78.array(z78.unknown()).optional()
|
|
41221
41227
|
};
|
|
41222
41228
|
server.registerTool(
|
|
41223
41229
|
"research_synthesize",
|
|
@@ -41233,10 +41239,10 @@ function registerResearchSynthesizeTool(server, deps) {
|
|
|
41233
41239
|
}
|
|
41234
41240
|
|
|
41235
41241
|
// src/mcp/tools/issue-triage-tool.ts
|
|
41236
|
-
import { z as
|
|
41237
|
-
var IssueTriageInputSchema =
|
|
41238
|
-
issueUrl:
|
|
41239
|
-
dryRun:
|
|
41242
|
+
import { z as z79 } from "zod";
|
|
41243
|
+
var IssueTriageInputSchema = z79.object({
|
|
41244
|
+
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)"),
|
|
41245
|
+
dryRun: z79.boolean().optional().default(true).describe("Read-only mode (default: true). When false, may apply labels.")
|
|
41240
41246
|
});
|
|
41241
41247
|
function buildTriageResponse(value) {
|
|
41242
41248
|
return {
|
|
@@ -41291,8 +41297,8 @@ function createIssueTriageHandler(_deps) {
|
|
|
41291
41297
|
function registerIssueTriageTool(server, deps) {
|
|
41292
41298
|
const logger57 = deps.logger ?? createLogger({ tool: "issue_triage" });
|
|
41293
41299
|
const toolSchema = {
|
|
41294
|
-
issueUrl:
|
|
41295
|
-
dryRun:
|
|
41300
|
+
issueUrl: z79.string().min(1).describe("GitHub issue URL (e.g., https://github.com/owner/repo/issues/123)"),
|
|
41301
|
+
dryRun: z79.boolean().optional().default(true).describe("Read-only mode (default: true)")
|
|
41296
41302
|
};
|
|
41297
41303
|
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.";
|
|
41298
41304
|
const secureHandler = createSecureHandler(createIssueTriageHandler(deps), {
|
|
@@ -41371,7 +41377,7 @@ function recordTriageOutcome(success, durationMs, errorMsg) {
|
|
|
41371
41377
|
}
|
|
41372
41378
|
|
|
41373
41379
|
// src/mcp/tools/run-graph-workflow.ts
|
|
41374
|
-
import { z as
|
|
41380
|
+
import { z as z80 } from "zod";
|
|
41375
41381
|
import { randomUUID as randomUUID11 } from "node:crypto";
|
|
41376
41382
|
|
|
41377
41383
|
// src/mcp/tools/run-graph-workflow-events.ts
|
|
@@ -41423,11 +41429,11 @@ function formatDetail(event) {
|
|
|
41423
41429
|
}
|
|
41424
41430
|
|
|
41425
41431
|
// src/mcp/tools/run-graph-workflow.ts
|
|
41426
|
-
var RunGraphWorkflowInputSchema =
|
|
41427
|
-
workflow:
|
|
41428
|
-
inputs:
|
|
41429
|
-
enableCheckpointing:
|
|
41430
|
-
enableAuditTrail:
|
|
41432
|
+
var RunGraphWorkflowInputSchema = z80.object({
|
|
41433
|
+
workflow: z80.string().min(1).max(100).describe("Name of the predefined graph workflow to execute"),
|
|
41434
|
+
inputs: z80.record(z80.string(), z80.unknown()).optional().default({}).describe("Input values for the workflow"),
|
|
41435
|
+
enableCheckpointing: z80.boolean().optional().default(true).describe("Enable checkpoint saving between steps"),
|
|
41436
|
+
enableAuditTrail: z80.boolean().optional().default(false).describe("Enable audit trail event logging"),
|
|
41431
41437
|
/**
|
|
41432
41438
|
* Dispatch mode (#3732). `sync` (default) runs the graph workflow inline and
|
|
41433
41439
|
* returns the result — but a workflow of up to ~100 expert nodes can exceed
|
|
@@ -41435,7 +41441,7 @@ var RunGraphWorkflowInputSchema = z79.object({
|
|
|
41435
41441
|
* envelope immediately and runs in the background; poll
|
|
41436
41442
|
* `get_job_result({ jobId })` for the result. Ignored for the `list` sentinel.
|
|
41437
41443
|
*/
|
|
41438
|
-
dispatch:
|
|
41444
|
+
dispatch: z80.enum(["sync", "async"]).optional().default("sync").describe(
|
|
41439
41445
|
"Dispatch mode (#3732). 'sync' (default): run inline. 'async': return a jobId immediately + run in background (poll get_job_result)."
|
|
41440
41446
|
)
|
|
41441
41447
|
});
|
|
@@ -41524,13 +41530,13 @@ async function handleRunGraphWorkflow(input, logger57, auditLogger) {
|
|
|
41524
41530
|
}
|
|
41525
41531
|
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.";
|
|
41526
41532
|
var GRAPH_WORKFLOW_SCHEMA = {
|
|
41527
|
-
workflow:
|
|
41533
|
+
workflow: z80.string().min(1).max(100).describe(
|
|
41528
41534
|
'Workflow name: echo, pipeline, code-review, security-scan. Use "list" for available workflows.'
|
|
41529
41535
|
),
|
|
41530
|
-
inputs:
|
|
41531
|
-
enableCheckpointing:
|
|
41532
|
-
enableAuditTrail:
|
|
41533
|
-
dispatch:
|
|
41536
|
+
inputs: z80.record(z80.string(), z80.unknown()).optional().describe("Input values for the workflow"),
|
|
41537
|
+
enableCheckpointing: z80.boolean().optional().describe("Enable checkpoint saving"),
|
|
41538
|
+
enableAuditTrail: z80.boolean().optional().describe("Enable audit trail logging"),
|
|
41539
|
+
dispatch: z80.enum(["sync", "async"]).optional().describe(
|
|
41534
41540
|
"Dispatch mode (#3732). 'sync' (default): run inline. 'async': return a jobId immediately + run in background (poll get_job_result)."
|
|
41535
41541
|
)
|
|
41536
41542
|
};
|
|
@@ -42131,11 +42137,11 @@ function suggestImprovement(criterion) {
|
|
|
42131
42137
|
}
|
|
42132
42138
|
|
|
42133
42139
|
// src/mcp/tools/execute-spec-tool.ts
|
|
42134
|
-
import { z as
|
|
42140
|
+
import { z as z81 } from "zod";
|
|
42135
42141
|
import { randomUUID as randomUUID12 } from "node:crypto";
|
|
42136
|
-
var ExecuteSpecInputSchema =
|
|
42137
|
-
spec:
|
|
42138
|
-
dryRun:
|
|
42142
|
+
var ExecuteSpecInputSchema = z81.object({
|
|
42143
|
+
spec: z81.string().min(1).max(5e4).describe("Markdown specification to execute"),
|
|
42144
|
+
dryRun: z81.boolean().optional().default(false).describe("Parse and decompose only"),
|
|
42139
42145
|
/**
|
|
42140
42146
|
* Dispatch mode (#3732). `sync` (default) runs the full DAG pipeline inline
|
|
42141
42147
|
* and returns the result — but a real parse→decompose→compile→execute→
|
|
@@ -42144,7 +42150,7 @@ var ExecuteSpecInputSchema = z80.object({
|
|
|
42144
42150
|
* background; poll `get_job_result({ jobId })` for the result. Ignored when
|
|
42145
42151
|
* `dryRun` is true (parse+decompose completes fast, so dry runs stay sync).
|
|
42146
42152
|
*/
|
|
42147
|
-
dispatch:
|
|
42153
|
+
dispatch: z81.enum(["sync", "async"]).default("sync").describe(
|
|
42148
42154
|
"Dispatch mode (#3732). 'sync' (default): run inline. 'async': return a jobId immediately + run in background (poll get_job_result). Ignored for dryRun."
|
|
42149
42155
|
)
|
|
42150
42156
|
});
|
|
@@ -42246,11 +42252,11 @@ function registerExecuteSpecTool(server, deps) {
|
|
|
42246
42252
|
const timeoutMs = getToolTimeout("execute_spec", deps.security);
|
|
42247
42253
|
const wrapped = wrapToolWithTimeout("execute_spec", secureHandler, { timeoutMs, logger: logger57 });
|
|
42248
42254
|
const toolSchema = {
|
|
42249
|
-
spec:
|
|
42255
|
+
spec: z81.string().min(1).max(5e4).describe(
|
|
42250
42256
|
'Markdown specification to execute. Must contain "## Requirements" and "## Acceptance Criteria" sections.'
|
|
42251
42257
|
),
|
|
42252
|
-
dryRun:
|
|
42253
|
-
dispatch:
|
|
42258
|
+
dryRun: z81.boolean().optional().describe("Parse and decompose only (no execution)"),
|
|
42259
|
+
dispatch: z81.enum(["sync", "async"]).optional().describe(
|
|
42254
42260
|
"Dispatch mode (#3732). 'sync' (default): run inline. 'async': return a jobId immediately + run in background (poll get_job_result). Ignored for dryRun."
|
|
42255
42261
|
)
|
|
42256
42262
|
};
|
|
@@ -42320,11 +42326,11 @@ function recordSpecOutcome(success, durationMs, stage) {
|
|
|
42320
42326
|
}
|
|
42321
42327
|
|
|
42322
42328
|
// src/mcp/tools/memory-query.ts
|
|
42323
|
-
import { z as
|
|
42324
|
-
var MemoryQueryInputSchema =
|
|
42325
|
-
query:
|
|
42326
|
-
limit:
|
|
42327
|
-
source:
|
|
42329
|
+
import { z as z82 } from "zod";
|
|
42330
|
+
var MemoryQueryInputSchema = z82.object({
|
|
42331
|
+
query: z82.string().min(1).max(500).describe("Search query to match against memory contents"),
|
|
42332
|
+
limit: z82.number().int().min(1).max(50).optional().default(10).describe("Maximum results to return (default: 10, max: 50)"),
|
|
42333
|
+
source: z82.enum(["session", "belief", "agentic", "typed", "adaptive", "all"]).optional().default("all").describe("Filter by memory source (default: all)")
|
|
42328
42334
|
});
|
|
42329
42335
|
function describeBackendCoverage(memory, source) {
|
|
42330
42336
|
const optional = [
|
|
@@ -42431,9 +42437,9 @@ async function memoryQueryHandler(args, ctx) {
|
|
|
42431
42437
|
function registerMemoryQueryTool(server, deps) {
|
|
42432
42438
|
const logger57 = deps.logger ?? createLogger({ tool: "memory_query" });
|
|
42433
42439
|
const toolSchema = {
|
|
42434
|
-
query:
|
|
42435
|
-
limit:
|
|
42436
|
-
source:
|
|
42440
|
+
query: z82.string().min(1).max(500).describe("Search query to match against memory contents"),
|
|
42441
|
+
limit: z82.number().int().min(1).max(50).optional().describe("Maximum results to return (default: 10, max: 50)"),
|
|
42442
|
+
source: z82.enum(["session", "belief", "agentic", "typed", "adaptive", "all"]).optional().describe("Filter by memory source (default: all)")
|
|
42437
42443
|
};
|
|
42438
42444
|
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.";
|
|
42439
42445
|
const secureHandler = createSecureHandler(memoryQueryHandler, {
|
|
@@ -42444,19 +42450,19 @@ function registerMemoryQueryTool(server, deps) {
|
|
|
42444
42450
|
const timeoutMs = getToolTimeout("memory_query", deps.security);
|
|
42445
42451
|
const wrappedHandler = wrapToolWithTimeout("memory_query", secureHandler, { timeoutMs, logger: logger57 });
|
|
42446
42452
|
const outputSchema = {
|
|
42447
|
-
query:
|
|
42448
|
-
expandedQuery:
|
|
42449
|
-
results:
|
|
42450
|
-
count:
|
|
42451
|
-
source:
|
|
42453
|
+
query: z82.string(),
|
|
42454
|
+
expandedQuery: z82.string().optional(),
|
|
42455
|
+
results: z82.array(z82.unknown()),
|
|
42456
|
+
count: z82.number(),
|
|
42457
|
+
source: z82.string(),
|
|
42452
42458
|
// #4999: the SDK validates structured content against this schema with
|
|
42453
42459
|
// `additionalProperties: false`, so a field added to the response and not
|
|
42454
42460
|
// declared here makes EVERY call fail with -32602 rather than merely going
|
|
42455
42461
|
// unreported. The integration test caught that; the unit tests could not,
|
|
42456
42462
|
// because they call the handler directly and never cross the protocol.
|
|
42457
|
-
searched:
|
|
42458
|
-
unavailable:
|
|
42459
|
-
errored:
|
|
42463
|
+
searched: z82.array(z82.string()),
|
|
42464
|
+
unavailable: z82.array(z82.string()),
|
|
42465
|
+
errored: z82.array(z82.string())
|
|
42460
42466
|
};
|
|
42461
42467
|
server.registerTool(
|
|
42462
42468
|
"memory_query",
|
|
@@ -42472,9 +42478,9 @@ function registerMemoryQueryTool(server, deps) {
|
|
|
42472
42478
|
}
|
|
42473
42479
|
|
|
42474
42480
|
// src/mcp/tools/memory-stats.ts
|
|
42475
|
-
import { z as
|
|
42476
|
-
var MemoryStatsInputSchema =
|
|
42477
|
-
includeDecay:
|
|
42481
|
+
import { z as z83 } from "zod";
|
|
42482
|
+
var MemoryStatsInputSchema = z83.object({
|
|
42483
|
+
includeDecay: z83.boolean().optional().default(true).describe("Include decay statistics (default: true)")
|
|
42478
42484
|
});
|
|
42479
42485
|
function collectSessionStats(toolMemory) {
|
|
42480
42486
|
const counts = toolMemory.getSessionCounts();
|
|
@@ -42591,7 +42597,7 @@ async function memoryStatsHandler(args, ctx) {
|
|
|
42591
42597
|
function registerMemoryStatsTool(server, deps) {
|
|
42592
42598
|
const logger57 = deps.logger ?? createLogger({ tool: "memory_stats" });
|
|
42593
42599
|
const toolSchema = {
|
|
42594
|
-
includeDecay:
|
|
42600
|
+
includeDecay: z83.boolean().optional().describe("Include decay statistics (default: true)")
|
|
42595
42601
|
};
|
|
42596
42602
|
const description = "Get memory system statistics dashboard. Shows backend availability, entry counts, and decay stats across all 7 memory backends.";
|
|
42597
42603
|
const secureHandler = createSecureHandler(memoryStatsHandler, {
|
|
@@ -42602,14 +42608,14 @@ function registerMemoryStatsTool(server, deps) {
|
|
|
42602
42608
|
const timeoutMs = getToolTimeout("memory_stats", deps.security);
|
|
42603
42609
|
const wrappedHandler = wrapToolWithTimeout("memory_stats", secureHandler, { timeoutMs, logger: logger57 });
|
|
42604
42610
|
const outputSchema = {
|
|
42605
|
-
backends:
|
|
42606
|
-
session:
|
|
42607
|
-
belief:
|
|
42608
|
-
typed:
|
|
42609
|
-
mobimem:
|
|
42610
|
-
decay:
|
|
42611
|
-
registry:
|
|
42612
|
-
collectedAt:
|
|
42611
|
+
backends: z83.unknown(),
|
|
42612
|
+
session: z83.unknown().optional(),
|
|
42613
|
+
belief: z83.unknown().optional(),
|
|
42614
|
+
typed: z83.unknown().optional(),
|
|
42615
|
+
mobimem: z83.unknown().optional(),
|
|
42616
|
+
decay: z83.unknown().optional(),
|
|
42617
|
+
registry: z83.array(z83.unknown()).optional(),
|
|
42618
|
+
collectedAt: z83.string().optional()
|
|
42613
42619
|
};
|
|
42614
42620
|
server.registerTool(
|
|
42615
42621
|
"memory_stats",
|
|
@@ -42625,15 +42631,15 @@ function registerMemoryStatsTool(server, deps) {
|
|
|
42625
42631
|
}
|
|
42626
42632
|
|
|
42627
42633
|
// src/mcp/tools/memory-write.ts
|
|
42628
|
-
import { z as
|
|
42629
|
-
var MemoryWriteInputSchema =
|
|
42630
|
-
key:
|
|
42631
|
-
content:
|
|
42632
|
-
backend:
|
|
42634
|
+
import { z as z84 } from "zod";
|
|
42635
|
+
var MemoryWriteInputSchema = z84.object({
|
|
42636
|
+
key: z84.string().min(1).max(200).describe("Memory identifier or subject"),
|
|
42637
|
+
content: z84.string().min(1).max(5e3).describe("Memory content to store"),
|
|
42638
|
+
backend: z84.enum(["session", "belief", "agentic", "adaptive", "typed"]).describe(
|
|
42633
42639
|
"Target memory backend: session (learnings), belief (triples), agentic (knowledge), adaptive (priority-scored), typed (MIRIX-style semantic)"
|
|
42634
42640
|
),
|
|
42635
|
-
confidence:
|
|
42636
|
-
metadata:
|
|
42641
|
+
confidence: z84.enum(["high", "medium", "low"]).optional().default("medium").describe("Confidence level (default: medium)"),
|
|
42642
|
+
metadata: z84.record(z84.string().max(100), z84.string().max(500)).optional().describe("Optional key-value metadata tags")
|
|
42637
42643
|
});
|
|
42638
42644
|
function writeToSession(key, content, confidence) {
|
|
42639
42645
|
const toolMemory = getToolMemory();
|
|
@@ -42786,13 +42792,13 @@ async function memoryWriteHandler(args, ctx) {
|
|
|
42786
42792
|
function registerMemoryWriteTool(server, deps) {
|
|
42787
42793
|
const logger57 = deps.logger ?? createLogger({ tool: "memory_write" });
|
|
42788
42794
|
const toolSchema = {
|
|
42789
|
-
key:
|
|
42790
|
-
content:
|
|
42791
|
-
backend:
|
|
42795
|
+
key: z84.string().min(1).max(200).describe("Memory identifier or subject"),
|
|
42796
|
+
content: z84.string().min(1).max(5e3).describe("Memory content to store"),
|
|
42797
|
+
backend: z84.enum(["session", "belief", "agentic", "adaptive", "typed"]).describe(
|
|
42792
42798
|
"Target memory backend: session (learnings), belief (triples), agentic (knowledge), adaptive (priority-scored), typed (MIRIX-style semantic)"
|
|
42793
42799
|
),
|
|
42794
|
-
confidence:
|
|
42795
|
-
metadata:
|
|
42800
|
+
confidence: z84.enum(["high", "medium", "low"]).optional().describe("Confidence level (default: medium)"),
|
|
42801
|
+
metadata: z84.record(z84.string().max(100), z84.string().max(500)).optional().describe("Optional key-value metadata tags")
|
|
42796
42802
|
};
|
|
42797
42803
|
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.";
|
|
42798
42804
|
const secureHandler = createSecureHandler(memoryWriteHandler, {
|
|
@@ -42804,11 +42810,11 @@ function registerMemoryWriteTool(server, deps) {
|
|
|
42804
42810
|
const timeoutMs = getToolTimeout("memory_write", deps.security);
|
|
42805
42811
|
const wrappedHandler = wrapToolWithTimeout("memory_write", guardedHandler, { timeoutMs, logger: logger57 });
|
|
42806
42812
|
const outputSchema = {
|
|
42807
|
-
success:
|
|
42808
|
-
backend:
|
|
42809
|
-
key:
|
|
42810
|
-
deduplicated:
|
|
42811
|
-
error:
|
|
42813
|
+
success: z84.boolean(),
|
|
42814
|
+
backend: z84.string(),
|
|
42815
|
+
key: z84.string(),
|
|
42816
|
+
deduplicated: z84.boolean().optional(),
|
|
42817
|
+
error: z84.string().optional()
|
|
42812
42818
|
};
|
|
42813
42819
|
server.registerTool(
|
|
42814
42820
|
"memory_write",
|
|
@@ -42824,7 +42830,7 @@ function registerMemoryWriteTool(server, deps) {
|
|
|
42824
42830
|
}
|
|
42825
42831
|
|
|
42826
42832
|
// src/mcp/tools/weather-report-tool.ts
|
|
42827
|
-
import { z as
|
|
42833
|
+
import { z as z85 } from "zod";
|
|
42828
42834
|
function serializeReport(report) {
|
|
42829
42835
|
return {
|
|
42830
42836
|
...report,
|
|
@@ -42875,8 +42881,8 @@ function weatherReportHandler(args, ctx) {
|
|
|
42875
42881
|
function registerWeatherReportTool(server, deps) {
|
|
42876
42882
|
const logger57 = deps.logger ?? createLogger({ tool: "weather_report" });
|
|
42877
42883
|
const toolSchema = {
|
|
42878
|
-
cli:
|
|
42879
|
-
category:
|
|
42884
|
+
cli: z85.enum(["claude", "gemini", "codex", "opencode"]).optional().describe("Filter by CLI"),
|
|
42885
|
+
category: z85.enum([
|
|
42880
42886
|
"architecture",
|
|
42881
42887
|
"code_generation",
|
|
42882
42888
|
"code_review",
|
|
@@ -42888,7 +42894,7 @@ function registerWeatherReportTool(server, deps) {
|
|
|
42888
42894
|
"devops",
|
|
42889
42895
|
"exploration"
|
|
42890
42896
|
]).optional().describe("Filter by task category"),
|
|
42891
|
-
includeAdaptive:
|
|
42897
|
+
includeAdaptive: z85.boolean().optional().describe("Include adaptive routing bonuses (default: true)")
|
|
42892
42898
|
};
|
|
42893
42899
|
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.";
|
|
42894
42900
|
const secureHandler = createSecureHandler(weatherReportHandler, {
|
|
@@ -42910,18 +42916,18 @@ function registerWeatherReportTool(server, deps) {
|
|
|
42910
42916
|
}
|
|
42911
42917
|
|
|
42912
42918
|
// src/mcp/tools/registry-import-types.ts
|
|
42913
|
-
import { z as
|
|
42914
|
-
var RegistryImportInputSchema =
|
|
42919
|
+
import { z as z86 } from "zod";
|
|
42920
|
+
var RegistryImportInputSchema = z86.object({
|
|
42915
42921
|
/** Model provider. */
|
|
42916
|
-
provider:
|
|
42922
|
+
provider: z86.enum(["anthropic", "google", "openai"]).describe("Model provider (anthropic, google, openai)"),
|
|
42917
42923
|
/** Model identifier from the provider (e.g., "claude-4-opus-20260201"). */
|
|
42918
|
-
modelId:
|
|
42924
|
+
modelId: z86.string().min(1).describe("Provider model identifier"),
|
|
42919
42925
|
/** No-op flag echoed back in the response; the tool never persists regardless. */
|
|
42920
|
-
dryRun:
|
|
42926
|
+
dryRun: z86.boolean().optional().default(true).describe("No-op flag echoed back in the response; the tool never persists regardless")
|
|
42921
42927
|
});
|
|
42922
42928
|
|
|
42923
42929
|
// src/mcp/tools/registry-import-tool.ts
|
|
42924
|
-
import { z as
|
|
42930
|
+
import { z as z87 } from "zod";
|
|
42925
42931
|
|
|
42926
42932
|
// src/mcp/tools/registry-import.ts
|
|
42927
42933
|
var PROVIDER_CLI_MAP = {
|
|
@@ -43031,9 +43037,9 @@ function registryImportHandler(args, ctx) {
|
|
|
43031
43037
|
function registerRegistryImportTool(server, deps) {
|
|
43032
43038
|
const logger57 = deps.logger ?? createLogger({ tool: "registry_import" });
|
|
43033
43039
|
const toolSchema = {
|
|
43034
|
-
provider:
|
|
43035
|
-
modelId:
|
|
43036
|
-
dryRun:
|
|
43040
|
+
provider: z87.enum(["anthropic", "google", "openai"]).describe("Model provider (anthropic, google, openai)"),
|
|
43041
|
+
modelId: z87.string().min(1).describe("Provider model identifier"),
|
|
43042
|
+
dryRun: z87.boolean().optional().describe("No-op flag echoed back in the response; the tool never persists regardless")
|
|
43037
43043
|
};
|
|
43038
43044
|
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`.";
|
|
43039
43045
|
const secureHandler = createSecureHandler(registryImportHandler, {
|
|
@@ -43056,10 +43062,10 @@ function registerRegistryImportTool(server, deps) {
|
|
|
43056
43062
|
}
|
|
43057
43063
|
|
|
43058
43064
|
// src/mcp/tools/repo-analyze-types.ts
|
|
43059
|
-
import { z as
|
|
43060
|
-
var RepoAnalyzeInputSchema =
|
|
43065
|
+
import { z as z88 } from "zod";
|
|
43066
|
+
var RepoAnalyzeInputSchema = z88.object({
|
|
43061
43067
|
/** GitHub repository in "owner/name" format or full URL. */
|
|
43062
|
-
repo:
|
|
43068
|
+
repo: z88.string().min(1).refine(
|
|
43063
43069
|
(v) => !v.includes("://") || /^https?:\/\//i.test(v),
|
|
43064
43070
|
"Only HTTP/HTTPS URLs are allowed"
|
|
43065
43071
|
).describe('GitHub repository in "owner/name" format (e.g., "cloudfoundry/korifi") or full URL'),
|
|
@@ -43068,13 +43074,13 @@ var RepoAnalyzeInputSchema = z87.object({
|
|
|
43068
43074
|
* analysis. Both values resolve to identical behavior; retained for input-shape
|
|
43069
43075
|
* stability until a distinct shallow path is implemented.
|
|
43070
43076
|
*/
|
|
43071
|
-
depth:
|
|
43077
|
+
depth: z88.enum(["shallow", "deep"]).optional().default("shallow").describe(
|
|
43072
43078
|
"Currently a no-op \u2014 the handler always runs the full analysis (both values identical)"
|
|
43073
43079
|
)
|
|
43074
43080
|
});
|
|
43075
43081
|
|
|
43076
43082
|
// src/mcp/tools/repo-analyze-tool.ts
|
|
43077
|
-
import { z as
|
|
43083
|
+
import { z as z89 } from "zod";
|
|
43078
43084
|
async function repoAnalyzeHandler(args, ctx) {
|
|
43079
43085
|
const parsed = RepoAnalyzeInputSchema.safeParse(args);
|
|
43080
43086
|
if (!parsed.success) {
|
|
@@ -43093,8 +43099,8 @@ async function repoAnalyzeHandler(args, ctx) {
|
|
|
43093
43099
|
function registerRepoAnalyzeTool(server, deps) {
|
|
43094
43100
|
const logger57 = deps.logger ?? createLogger({ tool: "repo_analyze" });
|
|
43095
43101
|
const toolSchema = {
|
|
43096
|
-
repo:
|
|
43097
|
-
depth:
|
|
43102
|
+
repo: z89.string().min(1).describe('GitHub repository in "owner/name" format or full URL'),
|
|
43103
|
+
depth: z89.enum(["shallow", "deep"]).optional().describe("Currently a no-op \u2014 the handler always runs the full analysis (both values identical)")
|
|
43098
43104
|
};
|
|
43099
43105
|
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.";
|
|
43100
43106
|
const secureHandler = createSecureHandler(repoAnalyzeHandler, {
|
|
@@ -43116,18 +43122,18 @@ function registerRepoAnalyzeTool(server, deps) {
|
|
|
43116
43122
|
}
|
|
43117
43123
|
|
|
43118
43124
|
// src/mcp/tools/repo-security-plan-types.ts
|
|
43119
|
-
import { z as
|
|
43120
|
-
var RepoSecurityPlanInputSchema =
|
|
43125
|
+
import { z as z90 } from "zod";
|
|
43126
|
+
var RepoSecurityPlanInputSchema = z90.object({
|
|
43121
43127
|
/** GitHub repository in "owner/name" format or full URL. */
|
|
43122
|
-
repo:
|
|
43128
|
+
repo: z90.string().min(1).describe('GitHub repository in "owner/name" format or full URL'),
|
|
43123
43129
|
/** Filter to specific scanner categories. */
|
|
43124
|
-
categories:
|
|
43130
|
+
categories: z90.array(z90.string()).optional().describe('Filter to specific categories (e.g., ["sast", "sca", "secrets"])'),
|
|
43125
43131
|
/** Maximum number of scanners to recommend. */
|
|
43126
|
-
maxScanners:
|
|
43132
|
+
maxScanners: z90.number().min(1).max(20).optional().default(10).describe("Maximum scanners to recommend (default: 10)")
|
|
43127
43133
|
});
|
|
43128
43134
|
|
|
43129
43135
|
// src/mcp/tools/repo-security-plan-tool.ts
|
|
43130
|
-
import { z as
|
|
43136
|
+
import { z as z91 } from "zod";
|
|
43131
43137
|
async function handler(args, ctx) {
|
|
43132
43138
|
const parsed = RepoSecurityPlanInputSchema.safeParse(args);
|
|
43133
43139
|
if (!parsed.success) {
|
|
@@ -43146,9 +43152,9 @@ async function handler(args, ctx) {
|
|
|
43146
43152
|
function registerRepoSecurityPlanTool(server, deps) {
|
|
43147
43153
|
const logger57 = deps.logger ?? createLogger({ tool: "repo_security_plan" });
|
|
43148
43154
|
const toolSchema = {
|
|
43149
|
-
repo:
|
|
43150
|
-
categories:
|
|
43151
|
-
maxScanners:
|
|
43155
|
+
repo: z91.string().min(1).describe('GitHub repository in "owner/name" format or full URL'),
|
|
43156
|
+
categories: z91.array(z91.string().max(50)).max(10).optional().describe('Filter to specific categories (e.g., ["sast", "sca", "secrets"])'),
|
|
43157
|
+
maxScanners: z91.number().min(1).max(20).optional().describe("Maximum scanners to recommend (default: 10)")
|
|
43152
43158
|
};
|
|
43153
43159
|
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.";
|
|
43154
43160
|
const secureHandler = createSecureHandler(handler, {
|
|
@@ -43171,13 +43177,13 @@ function registerRepoSecurityPlanTool(server, deps) {
|
|
|
43171
43177
|
|
|
43172
43178
|
// src/mcp/tools/search-codebase-tool.ts
|
|
43173
43179
|
import { resolve as resolve6, sep as sep3 } from "node:path";
|
|
43174
|
-
import { z as
|
|
43175
|
-
var SearchCodebaseInputSchema =
|
|
43176
|
-
query:
|
|
43177
|
-
directory:
|
|
43178
|
-
limit:
|
|
43179
|
-
mode:
|
|
43180
|
-
maxDepth:
|
|
43180
|
+
import { z as z92 } from "zod";
|
|
43181
|
+
var SearchCodebaseInputSchema = z92.object({
|
|
43182
|
+
query: z92.string().min(1).max(200).describe("Search query (symbol name, keyword, or pattern)"),
|
|
43183
|
+
directory: z92.string().min(1).max(500).optional().describe("Directory to search (default: current working directory)"),
|
|
43184
|
+
limit: z92.number().min(1).max(50).optional().describe("Max results (default: 20)"),
|
|
43185
|
+
mode: z92.enum(["search", "summary", "list"]).optional().describe("search: find symbols. summary: file overview. list: list indexed files."),
|
|
43186
|
+
maxDepth: z92.number().int().min(1).max(MAX_INDEX_MAX_DEPTH).optional().describe(
|
|
43181
43187
|
`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.`
|
|
43182
43188
|
)
|
|
43183
43189
|
});
|
|
@@ -43307,11 +43313,11 @@ async function searchCodebaseHandler(args, ctx) {
|
|
|
43307
43313
|
function registerSearchCodebaseTool(server, deps) {
|
|
43308
43314
|
const logger57 = deps.logger ?? createLogger({ tool: "search_codebase" });
|
|
43309
43315
|
const toolSchema = {
|
|
43310
|
-
query:
|
|
43311
|
-
directory:
|
|
43312
|
-
limit:
|
|
43313
|
-
mode:
|
|
43314
|
-
maxDepth:
|
|
43316
|
+
query: z92.string().min(1).max(200).describe("Search query or file path"),
|
|
43317
|
+
directory: z92.string().max(500).optional().describe("Directory to index"),
|
|
43318
|
+
limit: z92.number().min(1).max(50).optional().describe("Max results"),
|
|
43319
|
+
mode: z92.enum(["search", "summary", "list"]).optional().describe("search/summary/list"),
|
|
43320
|
+
maxDepth: z92.number().int().min(1).max(MAX_INDEX_MAX_DEPTH).optional().describe(
|
|
43315
43321
|
`Max directory depth to index (default: ${String(DEFAULT_INDEX_MAX_DEPTH)}, clamped to ${String(MAX_INDEX_MAX_DEPTH)})`
|
|
43316
43322
|
)
|
|
43317
43323
|
};
|
|
@@ -43333,7 +43339,7 @@ function registerSearchCodebaseTool(server, deps) {
|
|
|
43333
43339
|
|
|
43334
43340
|
// src/mcp/tools/extract-symbols-tool.ts
|
|
43335
43341
|
import { extname as extname3, resolve as resolve7, sep as sep4 } from "node:path";
|
|
43336
|
-
import { z as
|
|
43342
|
+
import { z as z93 } from "zod";
|
|
43337
43343
|
|
|
43338
43344
|
// src/core/task-analysis/tool-refusal-gap.ts
|
|
43339
43345
|
function toolRefusalGapName(tool, capability) {
|
|
@@ -43359,13 +43365,13 @@ function recordToolRefusal(refusal, context, ledger = getGapLedger()) {
|
|
|
43359
43365
|
// src/mcp/tools/extract-symbols-tool.ts
|
|
43360
43366
|
var DEFAULT_EXTRACT_MAX_CHARS = 2e4;
|
|
43361
43367
|
var DEFAULT_EXTRACT_MAX_SYMBOLS = 200;
|
|
43362
|
-
var ExtractSymbolsInputSchema =
|
|
43363
|
-
filePath:
|
|
43364
|
-
mode:
|
|
43365
|
-
maxChars:
|
|
43368
|
+
var ExtractSymbolsInputSchema = z93.object({
|
|
43369
|
+
filePath: z93.string().min(1).max(500).describe("Path to TypeScript/JavaScript file to extract symbols from"),
|
|
43370
|
+
mode: z93.enum(["index", "full"]).optional().describe("index: names+lines only (minimal tokens). full: includes source text."),
|
|
43371
|
+
maxChars: z93.number().int().positive().max(1e6).optional().describe(
|
|
43366
43372
|
`full mode only: cap on total emitted symbol source chars (default ${String(DEFAULT_EXTRACT_MAX_CHARS)}). Excess is truncated and reported, never silently dropped.`
|
|
43367
43373
|
),
|
|
43368
|
-
maxSymbols:
|
|
43374
|
+
maxSymbols: z93.number().int().positive().max(1e4).optional().describe(
|
|
43369
43375
|
`full mode only: cap on number of symbols emitted (default ${String(DEFAULT_EXTRACT_MAX_SYMBOLS)}).`
|
|
43370
43376
|
)
|
|
43371
43377
|
});
|
|
@@ -43509,12 +43515,12 @@ function emptyIndexMessage(reason, filePath) {
|
|
|
43509
43515
|
function registerExtractSymbolsTool(server, deps) {
|
|
43510
43516
|
const logger57 = deps.logger ?? createLogger({ tool: "extract_symbols" });
|
|
43511
43517
|
const toolSchema = {
|
|
43512
|
-
filePath:
|
|
43513
|
-
mode:
|
|
43514
|
-
maxChars:
|
|
43518
|
+
filePath: z93.string().min(1).max(500).describe("Path to TypeScript/JavaScript file"),
|
|
43519
|
+
mode: z93.enum(["index", "full"]).optional().describe("index (default): names+lines. full: includes source text"),
|
|
43520
|
+
maxChars: z93.number().int().positive().max(1e6).optional().describe(
|
|
43515
43521
|
`full mode only: cap on total emitted symbol source chars (default ${String(DEFAULT_EXTRACT_MAX_CHARS)})`
|
|
43516
43522
|
),
|
|
43517
|
-
maxSymbols:
|
|
43523
|
+
maxSymbols: z93.number().int().positive().max(1e4).optional().describe(
|
|
43518
43524
|
`full mode only: cap on number of symbols emitted (default ${String(DEFAULT_EXTRACT_MAX_SYMBOLS)})`
|
|
43519
43525
|
)
|
|
43520
43526
|
};
|
|
@@ -43540,23 +43546,23 @@ function registerExtractSymbolsTool(server, deps) {
|
|
|
43540
43546
|
// src/mcp/tools/search-usages-tool.ts
|
|
43541
43547
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
43542
43548
|
import { relative, resolve as resolve8, sep as sep5 } from "node:path";
|
|
43543
|
-
import { z as
|
|
43549
|
+
import { z as z94 } from "zod";
|
|
43544
43550
|
var DEFAULT_USAGES_LIMIT = 50;
|
|
43545
43551
|
var MAX_USAGES_LIMIT = 500;
|
|
43546
43552
|
var DEFAULT_USAGES_MAX_DEPTH = 24;
|
|
43547
43553
|
var MAX_USAGES_MAX_DEPTH = 64;
|
|
43548
43554
|
var MAX_FILES_SCANNED = 5e3;
|
|
43549
|
-
var SearchUsagesInputSchema =
|
|
43550
|
-
symbol:
|
|
43551
|
-
path:
|
|
43552
|
-
dir:
|
|
43553
|
-
lang:
|
|
43555
|
+
var SearchUsagesInputSchema = z94.object({
|
|
43556
|
+
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)"),
|
|
43557
|
+
path: z94.string().min(1).max(500).optional().describe("Restrict to a single source file (takes precedence over dir)"),
|
|
43558
|
+
dir: z94.string().min(1).max(500).optional().describe("Directory to search recursively (default: current working directory)"),
|
|
43559
|
+
lang: z94.enum(LANG_VALUES).optional().describe(
|
|
43554
43560
|
"Language override (default: inferred from each file extension, fallback typescript)"
|
|
43555
43561
|
),
|
|
43556
|
-
limit:
|
|
43562
|
+
limit: z94.number().int().min(1).max(MAX_USAGES_LIMIT).optional().describe(
|
|
43557
43563
|
`Max usage matches emitted (default ${String(DEFAULT_USAGES_LIMIT)}). Excess is reported.`
|
|
43558
43564
|
),
|
|
43559
|
-
maxDepth:
|
|
43565
|
+
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)}).`)
|
|
43560
43566
|
});
|
|
43561
43567
|
function resolveWithinCwd(target) {
|
|
43562
43568
|
const resolved = resolve8(target);
|
|
@@ -43675,12 +43681,12 @@ async function searchUsagesHandler(args, ctx) {
|
|
|
43675
43681
|
function registerSearchUsagesTool(server, deps) {
|
|
43676
43682
|
const logger57 = deps.logger ?? createLogger({ tool: "search_usages" });
|
|
43677
43683
|
const toolSchema = {
|
|
43678
|
-
symbol:
|
|
43679
|
-
path:
|
|
43680
|
-
dir:
|
|
43681
|
-
lang:
|
|
43682
|
-
limit:
|
|
43683
|
-
maxDepth:
|
|
43684
|
+
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"),
|
|
43685
|
+
path: z94.string().min(1).max(500).optional().describe("Restrict to a single source file"),
|
|
43686
|
+
dir: z94.string().min(1).max(500).optional().describe("Directory to search (default: cwd)"),
|
|
43687
|
+
lang: z94.enum(LANG_VALUES).optional().describe("Language override (default: infer from ext)"),
|
|
43688
|
+
limit: z94.number().int().min(1).max(MAX_USAGES_LIMIT).optional().describe(`Max matches (default ${String(DEFAULT_USAGES_LIMIT)})`),
|
|
43689
|
+
maxDepth: z94.number().int().min(1).max(MAX_USAGES_MAX_DEPTH).optional().describe(`Directory walk depth (default ${String(DEFAULT_USAGES_MAX_DEPTH)})`)
|
|
43684
43690
|
};
|
|
43685
43691
|
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.`;
|
|
43686
43692
|
const secureHandler = createSecureHandler(searchUsagesHandler, {
|
|
@@ -43701,11 +43707,11 @@ function registerSearchUsagesTool(server, deps) {
|
|
|
43701
43707
|
// src/mcp/tools/query-trace-tool.ts
|
|
43702
43708
|
import { readFile as readFile4, stat as stat3 } from "node:fs/promises";
|
|
43703
43709
|
import { join as join7, resolve as resolve9, sep as sep6 } from "node:path";
|
|
43704
|
-
import { z as
|
|
43705
|
-
var QueryTraceInputSchema =
|
|
43706
|
-
runId:
|
|
43707
|
-
eventType:
|
|
43708
|
-
limit:
|
|
43710
|
+
import { z as z95 } from "zod";
|
|
43711
|
+
var QueryTraceInputSchema = z95.object({
|
|
43712
|
+
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"),
|
|
43713
|
+
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"),
|
|
43714
|
+
limit: z95.number().min(1).max(500).optional().describe("Max events to return (default: 100)")
|
|
43709
43715
|
});
|
|
43710
43716
|
var MAX_TRACE_FILE_BYTES = 100 * 1024 * 1024;
|
|
43711
43717
|
var traceLogger = createLogger({ component: "query-trace" });
|
|
@@ -43829,9 +43835,9 @@ function queryTraceHandler(args, ctx) {
|
|
|
43829
43835
|
function registerQueryTraceTool(server, deps) {
|
|
43830
43836
|
const logger57 = deps.logger ?? createLogger({ tool: "query_trace" });
|
|
43831
43837
|
const toolSchema = {
|
|
43832
|
-
runId:
|
|
43833
|
-
eventType:
|
|
43834
|
-
limit:
|
|
43838
|
+
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"),
|
|
43839
|
+
eventType: z95.string().max(100).regex(/^[a-zA-Z0-9._-]+$/).optional().describe("Filter by event type (e.g., model.called)"),
|
|
43840
|
+
limit: z95.number().min(1).max(500).optional().describe("Max events to return (default: 100)")
|
|
43835
43841
|
};
|
|
43836
43842
|
const description = "Query execution traces by run ID. Returns agent and model attribution for pipeline runs including decision paths, error taxonomy, and timing data.";
|
|
43837
43843
|
const secureHandler = createSecureHandler(queryTraceHandler, {
|
|
@@ -43850,7 +43856,7 @@ function registerQueryTraceTool(server, deps) {
|
|
|
43850
43856
|
}
|
|
43851
43857
|
|
|
43852
43858
|
// src/mcp/tools/get-job-result-tool.ts
|
|
43853
|
-
import { z as
|
|
43859
|
+
import { z as z96 } from "zod";
|
|
43854
43860
|
|
|
43855
43861
|
// src/mcp/jobs/task-state-source.ts
|
|
43856
43862
|
var logger34 = createLogger({ component: "task-state-source" });
|
|
@@ -43973,8 +43979,8 @@ function resolveJobListing(customDir) {
|
|
|
43973
43979
|
}
|
|
43974
43980
|
|
|
43975
43981
|
// src/mcp/tools/get-job-result-tool.ts
|
|
43976
|
-
var GetJobResultInputSchema =
|
|
43977
|
-
jobId:
|
|
43982
|
+
var GetJobResultInputSchema = z96.object({
|
|
43983
|
+
jobId: z96.string().min(1).max(128).describe('Job ID returned by orchestrate({ mode: "async" })')
|
|
43978
43984
|
});
|
|
43979
43985
|
function getJobResultHandler(args) {
|
|
43980
43986
|
const parsed = GetJobResultInputSchema.safeParse(args);
|
|
@@ -44013,7 +44019,7 @@ function getJobResultHandler(args) {
|
|
|
44013
44019
|
function registerGetJobResultTool(server, deps) {
|
|
44014
44020
|
const logger57 = deps.logger ?? createLogger({ tool: "get_job_result" });
|
|
44015
44021
|
const toolSchema = {
|
|
44016
|
-
jobId:
|
|
44022
|
+
jobId: z96.string().min(1).max(128).describe('Job ID returned by orchestrate({ mode: "async" })')
|
|
44017
44023
|
};
|
|
44018
44024
|
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.`;
|
|
44019
44025
|
const secureHandler = createSecureHandler(getJobResultHandler, {
|
|
@@ -44035,14 +44041,14 @@ function registerGetJobResultTool(server, deps) {
|
|
|
44035
44041
|
}
|
|
44036
44042
|
|
|
44037
44043
|
// src/mcp/tools/list-jobs-tool.ts
|
|
44038
|
-
import { z as
|
|
44044
|
+
import { z as z97 } from "zod";
|
|
44039
44045
|
var MAX_LIST_JOBS_RESULTS = 200;
|
|
44040
|
-
var ListJobsInputSchema =
|
|
44046
|
+
var ListJobsInputSchema = z97.object({
|
|
44041
44047
|
/**
|
|
44042
44048
|
* Filter to jobs from a specific tool (exact match — e.g. `'orchestrate'`).
|
|
44043
44049
|
* Omit to list every tool's jobs.
|
|
44044
44050
|
*/
|
|
44045
|
-
toolName:
|
|
44051
|
+
toolName: z97.string().min(1).max(128).optional().describe("Filter to one tool (exact match)."),
|
|
44046
44052
|
/**
|
|
44047
44053
|
* Filter to jobs in a specific lifecycle state.
|
|
44048
44054
|
* Omit to list every state.
|
|
@@ -44055,7 +44061,7 @@ var ListJobsInputSchema = z96.object({
|
|
|
44055
44061
|
* Newest jobs are returned first, so a smaller limit shows the most
|
|
44056
44062
|
* recent activity.
|
|
44057
44063
|
*/
|
|
44058
|
-
limit:
|
|
44064
|
+
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).`)
|
|
44059
44065
|
});
|
|
44060
44066
|
function listJobsHandler(args) {
|
|
44061
44067
|
const parsed = ListJobsInputSchema.safeParse(args);
|
|
@@ -44096,11 +44102,11 @@ function listJobsHandler(args) {
|
|
|
44096
44102
|
function registerListJobsTool(server, deps) {
|
|
44097
44103
|
const logger57 = deps.logger ?? createLogger({ tool: "list_jobs" });
|
|
44098
44104
|
const toolSchema = {
|
|
44099
|
-
toolName:
|
|
44105
|
+
toolName: z97.string().min(1).max(128).optional().describe("Filter to one tool (exact match)."),
|
|
44100
44106
|
status: JobStatusSchema.optional().describe(
|
|
44101
44107
|
"Filter to pending | complete | failed | cancelled. Omit for all."
|
|
44102
44108
|
),
|
|
44103
|
-
limit:
|
|
44109
|
+
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).`)
|
|
44104
44110
|
};
|
|
44105
44111
|
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.";
|
|
44106
44112
|
const secureHandler = createSecureHandler(listJobsHandler, {
|
|
@@ -44122,11 +44128,11 @@ function registerListJobsTool(server, deps) {
|
|
|
44122
44128
|
}
|
|
44123
44129
|
|
|
44124
44130
|
// src/mcp/tools/cancel-job-tool.ts
|
|
44125
|
-
import { z as
|
|
44131
|
+
import { z as z98 } from "zod";
|
|
44126
44132
|
var defaultLogger3 = createLogger({ tool: "cancel_job" });
|
|
44127
|
-
var CancelJobInputSchema =
|
|
44128
|
-
jobId:
|
|
44129
|
-
reason:
|
|
44133
|
+
var CancelJobInputSchema = z98.object({
|
|
44134
|
+
jobId: z98.string().min(1).max(128).describe("Job ID returned by orchestrate / run_workflow / consensus_vote in async mode"),
|
|
44135
|
+
reason: z98.string().max(1e3).optional().describe('Optional human-readable note (e.g. "user clicked cancel").')
|
|
44130
44136
|
});
|
|
44131
44137
|
function cancelJobHandler(args, logger57 = defaultLogger3) {
|
|
44132
44138
|
const parsed = CancelJobInputSchema.safeParse(args);
|
|
@@ -44195,8 +44201,8 @@ function cancelPendingJob(jobId, toolName, logger57, reason) {
|
|
|
44195
44201
|
function registerCancelJobTool(server, deps) {
|
|
44196
44202
|
const logger57 = deps.logger ?? defaultLogger3;
|
|
44197
44203
|
const toolSchema = {
|
|
44198
|
-
jobId:
|
|
44199
|
-
reason:
|
|
44204
|
+
jobId: z98.string().min(1).max(128).describe("Job ID returned by orchestrate / run_workflow / consensus_vote in async mode"),
|
|
44205
|
+
reason: z98.string().max(1e3).optional().describe('Optional human-readable note (e.g. "user clicked cancel").')
|
|
44200
44206
|
};
|
|
44201
44207
|
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.";
|
|
44202
44208
|
const secureHandler = createSecureHandler((args) => cancelJobHandler(args, logger57), {
|
|
@@ -44218,7 +44224,7 @@ function registerCancelJobTool(server, deps) {
|
|
|
44218
44224
|
}
|
|
44219
44225
|
|
|
44220
44226
|
// src/audit/audit-types.ts
|
|
44221
|
-
import { z as
|
|
44227
|
+
import { z as z99 } from "zod";
|
|
44222
44228
|
var AuditError = class extends Error {
|
|
44223
44229
|
code = "AUDIT_ERROR";
|
|
44224
44230
|
context;
|
|
@@ -44230,7 +44236,7 @@ var AuditError = class extends Error {
|
|
|
44230
44236
|
this.context = options?.context;
|
|
44231
44237
|
}
|
|
44232
44238
|
};
|
|
44233
|
-
var AuditCategorySchema =
|
|
44239
|
+
var AuditCategorySchema = z99.enum([
|
|
44234
44240
|
"authentication",
|
|
44235
44241
|
// Login, logout, token refresh
|
|
44236
44242
|
"authorization",
|
|
@@ -44250,28 +44256,28 @@ var AuditCategorySchema = z98.enum([
|
|
|
44250
44256
|
"governance"
|
|
44251
44257
|
// Authority-tier transitions, ratification (Epic D, #3842)
|
|
44252
44258
|
]);
|
|
44253
|
-
var TierTransitionKindSchema =
|
|
44254
|
-
var TierTransitionTierSchema =
|
|
44255
|
-
var TierTransitionPayloadSchema =
|
|
44259
|
+
var TierTransitionKindSchema = z99.enum(["promotion", "demotion"]);
|
|
44260
|
+
var TierTransitionTierSchema = z99.enum(["observe", "suggest", "advisory", "enforce"]);
|
|
44261
|
+
var TierTransitionPayloadSchema = z99.object({
|
|
44256
44262
|
/** Whether the loop moved up (`promotion`) or down (`demotion`) the ladder. */
|
|
44257
44263
|
kind: TierTransitionKindSchema,
|
|
44258
44264
|
/** The loop/strategy whose tier changed (manifest `id` or loop identifier). */
|
|
44259
|
-
subject:
|
|
44265
|
+
subject: z99.string().min(1),
|
|
44260
44266
|
/** Tier before the transition. */
|
|
44261
44267
|
fromTier: TierTransitionTierSchema,
|
|
44262
44268
|
/** Tier after the transition. */
|
|
44263
44269
|
toTier: TierTransitionTierSchema,
|
|
44264
44270
|
/** Ref to the promotion-evidence record this transition was earned against. */
|
|
44265
|
-
evidenceRef:
|
|
44271
|
+
evidenceRef: z99.string().min(1),
|
|
44266
44272
|
/**
|
|
44267
44273
|
* Ref to the recorded `consensus_vote` that ratified a PROMOTION. Required
|
|
44268
44274
|
* by the ratification gate for `kind: 'promotion'`; legitimately absent for
|
|
44269
44275
|
* `kind: 'demotion'` (automatic, ADR-0017 §"Demotion is automatic").
|
|
44270
44276
|
*/
|
|
44271
|
-
ratificationVoteRef:
|
|
44277
|
+
ratificationVoteRef: z99.string().min(1).optional()
|
|
44272
44278
|
}).strict();
|
|
44273
44279
|
var TIER_TRANSITION_METADATA_KEY = "tierTransition";
|
|
44274
|
-
var AuditSeveritySchema =
|
|
44280
|
+
var AuditSeveritySchema = z99.enum([
|
|
44275
44281
|
"info",
|
|
44276
44282
|
// Normal operations
|
|
44277
44283
|
"warning",
|
|
@@ -44279,7 +44285,7 @@ var AuditSeveritySchema = z98.enum([
|
|
|
44279
44285
|
"critical"
|
|
44280
44286
|
// Security violations, failures
|
|
44281
44287
|
]);
|
|
44282
|
-
var AuditOutcomeSchema =
|
|
44288
|
+
var AuditOutcomeSchema = z99.enum([
|
|
44283
44289
|
"success",
|
|
44284
44290
|
// Operation completed successfully
|
|
44285
44291
|
"failure",
|
|
@@ -44289,56 +44295,56 @@ var AuditOutcomeSchema = z98.enum([
|
|
|
44289
44295
|
"error"
|
|
44290
44296
|
// Unexpected error occurred
|
|
44291
44297
|
]);
|
|
44292
|
-
var AuditActorSchema =
|
|
44293
|
-
type:
|
|
44294
|
-
id:
|
|
44295
|
-
name:
|
|
44296
|
-
ip:
|
|
44297
|
-
userAgent:
|
|
44298
|
-
});
|
|
44299
|
-
var AuditResourceSchema =
|
|
44300
|
-
type:
|
|
44298
|
+
var AuditActorSchema = z99.object({
|
|
44299
|
+
type: z99.enum(["user", "agent", "system", "external"]),
|
|
44300
|
+
id: z99.string().min(1),
|
|
44301
|
+
name: z99.string().optional(),
|
|
44302
|
+
ip: z99.string().optional(),
|
|
44303
|
+
userAgent: z99.string().optional()
|
|
44304
|
+
});
|
|
44305
|
+
var AuditResourceSchema = z99.object({
|
|
44306
|
+
type: z99.string().min(1),
|
|
44301
44307
|
// e.g., 'file', 'tool', 'config', 'agent'
|
|
44302
|
-
id:
|
|
44303
|
-
name:
|
|
44304
|
-
path:
|
|
44308
|
+
id: z99.string().min(1),
|
|
44309
|
+
name: z99.string().optional(),
|
|
44310
|
+
path: z99.string().optional()
|
|
44305
44311
|
});
|
|
44306
|
-
var AuditEventSchema =
|
|
44312
|
+
var AuditEventSchema = z99.object({
|
|
44307
44313
|
// Identity
|
|
44308
|
-
id:
|
|
44314
|
+
id: z99.string().min(1),
|
|
44309
44315
|
// Unique event ID
|
|
44310
|
-
version:
|
|
44316
|
+
version: z99.literal("1.0"),
|
|
44311
44317
|
// Schema version for migrations
|
|
44312
44318
|
// Timing
|
|
44313
|
-
timestamp:
|
|
44319
|
+
timestamp: z99.string(),
|
|
44314
44320
|
// ISO 8601 format
|
|
44315
|
-
timestampMs:
|
|
44321
|
+
timestampMs: z99.number(),
|
|
44316
44322
|
// Unix epoch milliseconds
|
|
44317
44323
|
// Classification
|
|
44318
44324
|
category: AuditCategorySchema,
|
|
44319
44325
|
severity: AuditSeveritySchema,
|
|
44320
44326
|
outcome: AuditOutcomeSchema,
|
|
44321
44327
|
// Event details
|
|
44322
|
-
action:
|
|
44328
|
+
action: z99.string().min(1),
|
|
44323
44329
|
// e.g., 'tool.invoke', 'policy.evaluate'
|
|
44324
|
-
description:
|
|
44330
|
+
description: z99.string().optional(),
|
|
44325
44331
|
// Actors and resources
|
|
44326
44332
|
actor: AuditActorSchema,
|
|
44327
44333
|
resource: AuditResourceSchema.optional(),
|
|
44328
44334
|
// Correlation
|
|
44329
|
-
requestId:
|
|
44335
|
+
requestId: z99.string().optional(),
|
|
44330
44336
|
// Request correlation ID
|
|
44331
|
-
traceId:
|
|
44337
|
+
traceId: z99.string().optional(),
|
|
44332
44338
|
// Distributed trace ID
|
|
44333
|
-
sessionId:
|
|
44339
|
+
sessionId: z99.string().optional(),
|
|
44334
44340
|
// Session correlation ID
|
|
44335
44341
|
// Context
|
|
44336
|
-
toolName:
|
|
44337
|
-
durationMs:
|
|
44338
|
-
metadata:
|
|
44342
|
+
toolName: z99.string().optional(),
|
|
44343
|
+
durationMs: z99.number().optional(),
|
|
44344
|
+
metadata: z99.record(z99.string(), z99.unknown()).optional(),
|
|
44339
44345
|
// Policy and security
|
|
44340
|
-
policyName:
|
|
44341
|
-
policyDecision:
|
|
44346
|
+
policyName: z99.string().optional(),
|
|
44347
|
+
policyDecision: z99.string().optional(),
|
|
44342
44348
|
/**
|
|
44343
44349
|
* Which occurrence of this `{tool, rule}` near-miss the record represents
|
|
44344
44350
|
* (#5228 review). Present only on a sampled `would_deny`.
|
|
@@ -44355,12 +44361,12 @@ var AuditEventSchema = z98.object({
|
|
|
44355
44361
|
* Absent means "not sampled" — every occurrence was recorded — which is
|
|
44356
44362
|
* distinct from `1`.
|
|
44357
44363
|
*/
|
|
44358
|
-
policyOccurrence:
|
|
44359
|
-
violationType:
|
|
44364
|
+
policyOccurrence: z99.number().int().min(1).optional(),
|
|
44365
|
+
violationType: z99.string().optional(),
|
|
44360
44366
|
// Integrity (for tamper-evidence)
|
|
44361
|
-
previousHash:
|
|
44367
|
+
previousHash: z99.string().optional(),
|
|
44362
44368
|
// Hash of previous event (chain)
|
|
44363
|
-
hash:
|
|
44369
|
+
hash: z99.string().optional(),
|
|
44364
44370
|
// Hash of this event
|
|
44365
44371
|
/**
|
|
44366
44372
|
* Hash-projection version (#3921). ABSENT/`1` = the legacy projection
|
|
@@ -44370,62 +44376,62 @@ var AuditEventSchema = z98.object({
|
|
|
44370
44376
|
* Versioned so pre-existing v1 chains keep verifying under their own
|
|
44371
44377
|
* projection (see {@link AUDIT_HASH_VERSION_TIER_TRANSITION}).
|
|
44372
44378
|
*/
|
|
44373
|
-
hashVersion:
|
|
44379
|
+
hashVersion: z99.number().int().positive().optional()
|
|
44374
44380
|
});
|
|
44375
44381
|
var AUDIT_HASH_VERSION_TIER_TRANSITION = 2;
|
|
44376
|
-
var AuditEventInputSchema =
|
|
44382
|
+
var AuditEventInputSchema = z99.object({
|
|
44377
44383
|
category: AuditCategorySchema,
|
|
44378
44384
|
severity: AuditSeveritySchema.optional().default("info"),
|
|
44379
44385
|
outcome: AuditOutcomeSchema,
|
|
44380
|
-
action:
|
|
44381
|
-
description:
|
|
44386
|
+
action: z99.string().min(1),
|
|
44387
|
+
description: z99.string().optional(),
|
|
44382
44388
|
actor: AuditActorSchema,
|
|
44383
44389
|
resource: AuditResourceSchema.optional(),
|
|
44384
|
-
requestId:
|
|
44385
|
-
traceId:
|
|
44386
|
-
sessionId:
|
|
44387
|
-
toolName:
|
|
44388
|
-
durationMs:
|
|
44389
|
-
metadata:
|
|
44390
|
-
policyName:
|
|
44391
|
-
policyDecision:
|
|
44390
|
+
requestId: z99.string().optional(),
|
|
44391
|
+
traceId: z99.string().optional(),
|
|
44392
|
+
sessionId: z99.string().optional(),
|
|
44393
|
+
toolName: z99.string().optional(),
|
|
44394
|
+
durationMs: z99.number().optional(),
|
|
44395
|
+
metadata: z99.record(z99.string(), z99.unknown()).optional(),
|
|
44396
|
+
policyName: z99.string().optional(),
|
|
44397
|
+
policyDecision: z99.string().optional(),
|
|
44392
44398
|
/** @see AuditEventSchema.policyOccurrence (#5228 review). */
|
|
44393
|
-
policyOccurrence:
|
|
44394
|
-
violationType:
|
|
44399
|
+
policyOccurrence: z99.number().int().min(1).optional(),
|
|
44400
|
+
violationType: z99.string().optional()
|
|
44395
44401
|
});
|
|
44396
|
-
var AuditLogConfigSchema =
|
|
44402
|
+
var AuditLogConfigSchema = z99.object({
|
|
44397
44403
|
// Storage
|
|
44398
|
-
logDir:
|
|
44399
|
-
filePrefix:
|
|
44400
|
-
maxFileSizeBytes:
|
|
44404
|
+
logDir: z99.string().min(1),
|
|
44405
|
+
filePrefix: z99.string().optional().default("audit"),
|
|
44406
|
+
maxFileSizeBytes: z99.number().positive().optional().default(10 * 1024 * 1024),
|
|
44401
44407
|
// 10MB
|
|
44402
|
-
maxFiles:
|
|
44408
|
+
maxFiles: z99.number().positive().optional().default(10),
|
|
44403
44409
|
// Features
|
|
44404
|
-
enableHashChain:
|
|
44405
|
-
enableCompression:
|
|
44406
|
-
flushIntervalMs:
|
|
44410
|
+
enableHashChain: z99.boolean().optional().default(true),
|
|
44411
|
+
enableCompression: z99.boolean().optional().default(false),
|
|
44412
|
+
flushIntervalMs: z99.number().positive().optional().default(1e3),
|
|
44407
44413
|
/**
|
|
44408
44414
|
* Maximum in-memory event queue depth before drop-oldest backpressure
|
|
44409
44415
|
* engages. Bounds memory under load when storage.write is slow or the flush
|
|
44410
44416
|
* timer is overlapping; see #2979.
|
|
44411
44417
|
*/
|
|
44412
|
-
maxQueueDepth:
|
|
44418
|
+
maxQueueDepth: z99.number().positive().optional().default(1e4),
|
|
44413
44419
|
// Filtering
|
|
44414
44420
|
minSeverity: AuditSeveritySchema.optional().default("info"),
|
|
44415
|
-
categories:
|
|
44416
|
-
});
|
|
44417
|
-
var AuditQueryCriteriaSchema =
|
|
44418
|
-
startTime:
|
|
44419
|
-
endTime:
|
|
44420
|
-
categories:
|
|
44421
|
-
severities:
|
|
44422
|
-
outcomes:
|
|
44423
|
-
actorId:
|
|
44424
|
-
resourceId:
|
|
44425
|
-
requestId:
|
|
44426
|
-
traceId:
|
|
44427
|
-
limit:
|
|
44428
|
-
offset:
|
|
44421
|
+
categories: z99.array(AuditCategorySchema).optional()
|
|
44422
|
+
});
|
|
44423
|
+
var AuditQueryCriteriaSchema = z99.object({
|
|
44424
|
+
startTime: z99.date().optional(),
|
|
44425
|
+
endTime: z99.date().optional(),
|
|
44426
|
+
categories: z99.array(AuditCategorySchema).optional(),
|
|
44427
|
+
severities: z99.array(AuditSeveritySchema).optional(),
|
|
44428
|
+
outcomes: z99.array(AuditOutcomeSchema).optional(),
|
|
44429
|
+
actorId: z99.string().optional(),
|
|
44430
|
+
resourceId: z99.string().optional(),
|
|
44431
|
+
requestId: z99.string().optional(),
|
|
44432
|
+
traceId: z99.string().optional(),
|
|
44433
|
+
limit: z99.number().positive().optional().default(100),
|
|
44434
|
+
offset: z99.number().nonnegative().optional().default(0)
|
|
44429
44435
|
});
|
|
44430
44436
|
|
|
44431
44437
|
// src/audit/audit-storage-queries.ts
|
|
@@ -45910,7 +45916,7 @@ function ensureRunnableTemplate(template, stages) {
|
|
|
45910
45916
|
// src/pipeline/pipeline-checkpoint.ts
|
|
45911
45917
|
import * as fs6 from "node:fs";
|
|
45912
45918
|
import * as path4 from "node:path";
|
|
45913
|
-
import { z as
|
|
45919
|
+
import { z as z100 } from "zod";
|
|
45914
45920
|
var logger39 = createLogger({ component: "pipeline-checkpoint" });
|
|
45915
45921
|
var SESSION_ID_REGEX = /^[a-zA-Z0-9_-]{1,128}$/;
|
|
45916
45922
|
function validateSessionId(sessionId) {
|
|
@@ -45958,7 +45964,7 @@ function loadCheckpointState(sessionId, customDir) {
|
|
|
45958
45964
|
return null;
|
|
45959
45965
|
}
|
|
45960
45966
|
}
|
|
45961
|
-
var PipelineStageSchema =
|
|
45967
|
+
var PipelineStageSchema = z100.enum([
|
|
45962
45968
|
"research",
|
|
45963
45969
|
"plan",
|
|
45964
45970
|
"vote",
|
|
@@ -45966,27 +45972,27 @@ var PipelineStageSchema = z99.enum([
|
|
|
45966
45972
|
"implement",
|
|
45967
45973
|
"security"
|
|
45968
45974
|
]);
|
|
45969
|
-
var PipelineStageDataSchema =
|
|
45970
|
-
|
|
45971
|
-
|
|
45972
|
-
|
|
45973
|
-
type:
|
|
45974
|
-
approved:
|
|
45975
|
-
conditional:
|
|
45976
|
-
conditions:
|
|
45977
|
-
caveats:
|
|
45978
|
-
iterations:
|
|
45975
|
+
var PipelineStageDataSchema = z100.discriminatedUnion("type", [
|
|
45976
|
+
z100.object({ type: z100.literal("research"), text: z100.string() }),
|
|
45977
|
+
z100.object({ type: z100.literal("plan"), text: z100.string(), iterations: z100.number() }),
|
|
45978
|
+
z100.object({
|
|
45979
|
+
type: z100.literal("vote"),
|
|
45980
|
+
approved: z100.boolean(),
|
|
45981
|
+
conditional: z100.boolean(),
|
|
45982
|
+
conditions: z100.array(z100.string()).optional(),
|
|
45983
|
+
caveats: z100.array(z100.string()).optional(),
|
|
45984
|
+
iterations: z100.number()
|
|
45979
45985
|
}),
|
|
45980
45986
|
// PipelineTask shape is loose at the persistence layer — capture as
|
|
45981
45987
|
// `z.unknown()` and trust the downstream consumer's narrower validation.
|
|
45982
|
-
|
|
45983
|
-
|
|
45984
|
-
|
|
45988
|
+
z100.object({ type: z100.literal("decompose"), tasks: z100.array(z100.unknown()) }),
|
|
45989
|
+
z100.object({ type: z100.literal("implement"), tasks: z100.array(z100.unknown()) }),
|
|
45990
|
+
z100.object({ type: z100.literal("security"), passed: z100.boolean() })
|
|
45985
45991
|
]);
|
|
45986
|
-
var PipelineCheckpointEntrySchema =
|
|
45987
|
-
sessionId:
|
|
45992
|
+
var PipelineCheckpointEntrySchema = z100.object({
|
|
45993
|
+
sessionId: z100.string(),
|
|
45988
45994
|
stage: PipelineStageSchema,
|
|
45989
|
-
timestamp:
|
|
45995
|
+
timestamp: z100.string(),
|
|
45990
45996
|
data: PipelineStageDataSchema
|
|
45991
45997
|
});
|
|
45992
45998
|
function rebuildState(lines) {
|
|
@@ -46176,7 +46182,7 @@ function buildVotingInput(plan, config) {
|
|
|
46176
46182
|
}
|
|
46177
46183
|
async function executeSingleVote(plan, config, log) {
|
|
46178
46184
|
try {
|
|
46179
|
-
const { executeVoting } = await import("./consensus-vote-
|
|
46185
|
+
const { executeVoting } = await import("./consensus-vote-3M4BDMOJ.js");
|
|
46180
46186
|
const input = buildVotingInput(plan, config);
|
|
46181
46187
|
const result = await executeVoting(input, log);
|
|
46182
46188
|
return parseVotingResult(result);
|
|
@@ -46900,49 +46906,49 @@ Verdict: PASS/NEEDS_WORK/REJECT`;
|
|
|
46900
46906
|
}
|
|
46901
46907
|
|
|
46902
46908
|
// src/security/sarif-parser.ts
|
|
46903
|
-
import { z as
|
|
46904
|
-
var SarifLocationSchema =
|
|
46905
|
-
physicalLocation:
|
|
46906
|
-
artifactLocation:
|
|
46907
|
-
region:
|
|
46908
|
-
startLine:
|
|
46909
|
-
endLine:
|
|
46910
|
-
snippet:
|
|
46909
|
+
import { z as z101 } from "zod";
|
|
46910
|
+
var SarifLocationSchema = z101.object({
|
|
46911
|
+
physicalLocation: z101.object({
|
|
46912
|
+
artifactLocation: z101.object({ uri: z101.string().optional().catch(void 0) }).optional(),
|
|
46913
|
+
region: z101.object({
|
|
46914
|
+
startLine: z101.number().optional().catch(void 0),
|
|
46915
|
+
endLine: z101.number().int().min(1).optional().catch(void 0),
|
|
46916
|
+
snippet: z101.object({ text: z101.string().optional().catch(void 0) }).optional().catch(void 0)
|
|
46911
46917
|
}).optional()
|
|
46912
46918
|
}).optional()
|
|
46913
46919
|
});
|
|
46914
|
-
var SarifResultSchema =
|
|
46915
|
-
ruleId:
|
|
46916
|
-
level:
|
|
46917
|
-
message:
|
|
46918
|
-
locations:
|
|
46919
|
-
});
|
|
46920
|
-
var SarifRuleSchema =
|
|
46921
|
-
id:
|
|
46922
|
-
shortDescription:
|
|
46923
|
-
defaultConfiguration:
|
|
46924
|
-
properties:
|
|
46925
|
-
precision:
|
|
46926
|
-
tags:
|
|
46920
|
+
var SarifResultSchema = z101.object({
|
|
46921
|
+
ruleId: z101.string().nullish(),
|
|
46922
|
+
level: z101.string().nullish(),
|
|
46923
|
+
message: z101.object({ text: z101.string().optional() }).nullish(),
|
|
46924
|
+
locations: z101.array(SarifLocationSchema).nullish()
|
|
46925
|
+
});
|
|
46926
|
+
var SarifRuleSchema = z101.object({
|
|
46927
|
+
id: z101.string(),
|
|
46928
|
+
shortDescription: z101.object({ text: z101.string().optional().catch(void 0) }).optional(),
|
|
46929
|
+
defaultConfiguration: z101.object({ level: z101.string().optional().catch(void 0) }).optional(),
|
|
46930
|
+
properties: z101.object({
|
|
46931
|
+
precision: z101.string().optional().catch(void 0),
|
|
46932
|
+
tags: z101.array(z101.string()).optional().catch(void 0),
|
|
46927
46933
|
// Accept the number form and normalize; `resolveSeverityFromScore`
|
|
46928
46934
|
// parses it either way.
|
|
46929
|
-
"security-severity":
|
|
46935
|
+
"security-severity": z101.union([z101.string(), z101.number()]).optional().catch(void 0)
|
|
46930
46936
|
}).optional().catch(void 0),
|
|
46931
|
-
helpUri:
|
|
46932
|
-
help:
|
|
46933
|
-
});
|
|
46934
|
-
var SarifRunSchema =
|
|
46935
|
-
tool:
|
|
46936
|
-
driver:
|
|
46937
|
-
name:
|
|
46938
|
-
rules:
|
|
46937
|
+
helpUri: z101.string().optional().catch(void 0),
|
|
46938
|
+
help: z101.object({ markdown: z101.string().optional().catch(void 0) }).optional()
|
|
46939
|
+
});
|
|
46940
|
+
var SarifRunSchema = z101.object({
|
|
46941
|
+
tool: z101.object({
|
|
46942
|
+
driver: z101.object({
|
|
46943
|
+
name: z101.string().optional(),
|
|
46944
|
+
rules: z101.array(z101.unknown()).optional()
|
|
46939
46945
|
}).optional()
|
|
46940
46946
|
}).optional(),
|
|
46941
|
-
results:
|
|
46947
|
+
results: z101.array(z101.unknown()).nullish()
|
|
46942
46948
|
});
|
|
46943
|
-
var SarifLogSchema =
|
|
46944
|
-
version:
|
|
46945
|
-
runs:
|
|
46949
|
+
var SarifLogSchema = z101.object({
|
|
46950
|
+
version: z101.string().optional(),
|
|
46951
|
+
runs: z101.array(z101.unknown()).optional()
|
|
46946
46952
|
});
|
|
46947
46953
|
var UNMAPPED_LEVEL_SEVERITY = "high";
|
|
46948
46954
|
var MAX_MESSAGE_LENGTH = 2e3;
|
|
@@ -47210,18 +47216,18 @@ async function executeSecurityScan(input) {
|
|
|
47210
47216
|
}
|
|
47211
47217
|
|
|
47212
47218
|
// src/security/osv-lookup.ts
|
|
47213
|
-
import { z as
|
|
47219
|
+
import { z as z102 } from "zod";
|
|
47214
47220
|
var logger44 = createLogger({ component: "osv-lookup" });
|
|
47215
47221
|
var OSV_API_URL = "https://api.osv.dev/v1/query";
|
|
47216
47222
|
var DEFAULT_TIMEOUT_MS4 = NETWORK_FETCH_TIMEOUT_MS;
|
|
47217
|
-
var OsvVulnerabilitySchema =
|
|
47218
|
-
id:
|
|
47219
|
-
summary:
|
|
47220
|
-
severity:
|
|
47221
|
-
aliases:
|
|
47222
|
-
affectedVersions:
|
|
47223
|
-
fixedVersion:
|
|
47224
|
-
url:
|
|
47223
|
+
var OsvVulnerabilitySchema = z102.object({
|
|
47224
|
+
id: z102.string(),
|
|
47225
|
+
summary: z102.string().optional(),
|
|
47226
|
+
severity: z102.enum(["CRITICAL", "HIGH", "MODERATE", "LOW", "UNKNOWN"]).optional(),
|
|
47227
|
+
aliases: z102.array(z102.string()).default([]),
|
|
47228
|
+
affectedVersions: z102.string().optional(),
|
|
47229
|
+
fixedVersion: z102.string().optional(),
|
|
47230
|
+
url: z102.string().optional()
|
|
47225
47231
|
});
|
|
47226
47232
|
var DEFAULT_OSV_CONFIG = {
|
|
47227
47233
|
timeoutMs: DEFAULT_TIMEOUT_MS4
|
|
@@ -47974,7 +47980,7 @@ ${contextBlock}`;
|
|
|
47974
47980
|
const strategy = config.votingStrategy ?? "higher_order";
|
|
47975
47981
|
await postProgress(config, "Vote", `Running consensus with ${strategy} strategy...`);
|
|
47976
47982
|
try {
|
|
47977
|
-
const { executeVoting } = await import("./consensus-vote-
|
|
47983
|
+
const { executeVoting } = await import("./consensus-vote-3M4BDMOJ.js");
|
|
47978
47984
|
const votingResult = await executeVoting(
|
|
47979
47985
|
{
|
|
47980
47986
|
proposal: buildVoteProposal(plan, research),
|
|
@@ -48683,7 +48689,7 @@ ${FINDINGS_FORMAT_INSTRUCTIONS}
|
|
|
48683
48689
|
}
|
|
48684
48690
|
|
|
48685
48691
|
// src/mcp/tools/pr-review-tool.ts
|
|
48686
|
-
import { z as
|
|
48692
|
+
import { z as z104 } from "zod";
|
|
48687
48693
|
import { randomUUID as randomUUID13 } from "node:crypto";
|
|
48688
48694
|
|
|
48689
48695
|
// src/audit/reviewed-diff-hash.ts
|
|
@@ -48719,17 +48725,17 @@ import { dirname as dirname3, isAbsolute, join as join11, resolve as resolve12 }
|
|
|
48719
48725
|
|
|
48720
48726
|
// src/audit/pr-review-record.ts
|
|
48721
48727
|
import * as crypto3 from "node:crypto";
|
|
48722
|
-
import { z as
|
|
48723
|
-
var PrReviewVerdictSchema =
|
|
48724
|
-
var PrReviewVoteCountsSchema =
|
|
48725
|
-
approve:
|
|
48726
|
-
request_changes:
|
|
48727
|
-
abstain:
|
|
48728
|
-
error:
|
|
48729
|
-
total:
|
|
48728
|
+
import { z as z103 } from "zod";
|
|
48729
|
+
var PrReviewVerdictSchema = z103.enum(["approve", "request_changes", "abstain"]);
|
|
48730
|
+
var PrReviewVoteCountsSchema = z103.object({
|
|
48731
|
+
approve: z103.number().int().nonnegative(),
|
|
48732
|
+
request_changes: z103.number().int().nonnegative(),
|
|
48733
|
+
abstain: z103.number().int().nonnegative(),
|
|
48734
|
+
error: z103.number().int().nonnegative(),
|
|
48735
|
+
total: z103.number().int().nonnegative()
|
|
48730
48736
|
}).strict();
|
|
48731
|
-
var PrReviewDiffSourceSchema =
|
|
48732
|
-
var PrReviewDiffProvenanceSchema =
|
|
48737
|
+
var PrReviewDiffSourceSchema = z103.enum(["canonical-git", "caller-supplied"]);
|
|
48738
|
+
var PrReviewDiffProvenanceSchema = z103.object({
|
|
48733
48739
|
/** How the reviewed diff was obtained. */
|
|
48734
48740
|
source: PrReviewDiffSourceSchema,
|
|
48735
48741
|
/**
|
|
@@ -48741,9 +48747,9 @@ var PrReviewDiffProvenanceSchema = z102.object({
|
|
|
48741
48747
|
* per-file attribution is unavailable. `false` means "a diff, but the packer
|
|
48742
48748
|
* saw it as one undifferentiated blob".
|
|
48743
48749
|
*/
|
|
48744
|
-
fileBoundaries:
|
|
48750
|
+
fileBoundaries: z103.boolean()
|
|
48745
48751
|
}).strict();
|
|
48746
|
-
var PrReviewSanitizationSchema =
|
|
48752
|
+
var PrReviewSanitizationSchema = z103.object({
|
|
48747
48753
|
/**
|
|
48748
48754
|
* The canonical hash (same {@link computeReviewedDiffHash} form) of the
|
|
48749
48755
|
* once-sanitized FULL diff. Equal to the record's `reviewedDiffHash` exactly
|
|
@@ -48760,14 +48766,14 @@ var PrReviewSanitizationSchema = z102.object({
|
|
|
48760
48766
|
* not tell an auditor WHICH one moved it. This field isolates the
|
|
48761
48767
|
* sanitization gap, which is the one `reviewedDiffHash` alone cannot show.
|
|
48762
48768
|
*/
|
|
48763
|
-
sanitizedDiffHash:
|
|
48769
|
+
sanitizedDiffHash: z103.string().length(64),
|
|
48764
48770
|
/**
|
|
48765
48771
|
* HTML comments the middleware stripped before dispatch. Non-zero with an
|
|
48766
48772
|
* EQUAL `sanitizedDiffHash` is not a contradiction: the counter is over the
|
|
48767
48773
|
* whole args object, the hash only over `prDiff`, so a comment stripped from
|
|
48768
48774
|
* a sibling field increments one without moving the other.
|
|
48769
48775
|
*/
|
|
48770
|
-
commentsRemoved:
|
|
48776
|
+
commentsRemoved: z103.number().int().nonnegative(),
|
|
48771
48777
|
/**
|
|
48772
48778
|
* How many FIELDS the sanitizer changed at all.
|
|
48773
48779
|
*
|
|
@@ -48782,7 +48788,7 @@ var PrReviewSanitizationSchema = z102.object({
|
|
|
48782
48788
|
* `fieldsModified === 0` is therefore the ONLY state that licenses "the
|
|
48783
48789
|
* sanitizer removed nothing".
|
|
48784
48790
|
*/
|
|
48785
|
-
fieldsModified:
|
|
48791
|
+
fieldsModified: z103.number().int().nonnegative(),
|
|
48786
48792
|
/**
|
|
48787
48793
|
* XML-like conversation-structure tags the sanitizer removed.
|
|
48788
48794
|
*
|
|
@@ -48793,9 +48799,9 @@ var PrReviewSanitizationSchema = z102.object({
|
|
|
48793
48799
|
* removal was routine. That is the reassurance an attacker wants, and it
|
|
48794
48800
|
* costs them only an HTML comment.
|
|
48795
48801
|
*/
|
|
48796
|
-
tagsRemoved:
|
|
48802
|
+
tagsRemoved: z103.number().int().nonnegative()
|
|
48797
48803
|
}).strict();
|
|
48798
|
-
var PrReviewRecordSchema =
|
|
48804
|
+
var PrReviewRecordSchema = z103.object({
|
|
48799
48805
|
/**
|
|
48800
48806
|
* Schema version. '1.1' was the Option-C binding (#3831): the record binds to
|
|
48801
48807
|
* `{prNumber, baseSha, reviewedDiffHash}` instead of the rejected `headSha`.
|
|
@@ -48814,22 +48820,22 @@ var PrReviewRecordSchema = z102.object({
|
|
|
48814
48820
|
* invalidate. Reading a '1.2' record as if it were '1.3' would be the unsafe
|
|
48815
48821
|
* move — its hash may bind SANITIZED bytes the gate can never reproduce.
|
|
48816
48822
|
*/
|
|
48817
|
-
version:
|
|
48823
|
+
version: z103.literal("1.3"),
|
|
48818
48824
|
/**
|
|
48819
48825
|
* Monotonic sequence number (integer ≥ 0). Assigned as (max existing
|
|
48820
48826
|
* sequence)+1 at write time. Sorted, the set of sequences must cover
|
|
48821
48827
|
* 0..maxSeq with no gap (omission detection); DUPLICATE sequences are a
|
|
48822
48828
|
* benign concurrent-fork signal, not tampering.
|
|
48823
48829
|
*/
|
|
48824
|
-
sequence:
|
|
48830
|
+
sequence: z103.number().int().nonnegative(),
|
|
48825
48831
|
/** The PR number the review covers. */
|
|
48826
|
-
prNumber:
|
|
48832
|
+
prNumber: z103.number().int().positive(),
|
|
48827
48833
|
/**
|
|
48828
48834
|
* The 40-hex BASE commit SHA the reviewed diff was computed against (the
|
|
48829
48835
|
* `<base>..<head>` range base). Part of the Option-C binding so the gate knows
|
|
48830
48836
|
* which range to recompute {@link reviewedDiffHash} over.
|
|
48831
48837
|
*/
|
|
48832
|
-
baseSha:
|
|
48838
|
+
baseSha: z103.string().regex(/^[0-9a-f]{40}$/, "baseSha must be a 40-char lowercase hex commit sha"),
|
|
48833
48839
|
/**
|
|
48834
48840
|
* DIFF-BINDING (Option-C, #3831): sha256 of the canonical reviewed diff bytes
|
|
48835
48841
|
* (see `audit/reviewed-diff-hash.ts` — pinned `git diff` invocation + 50k
|
|
@@ -48838,9 +48844,9 @@ var PrReviewRecordSchema = z102.object({
|
|
|
48838
48844
|
* byte-identical to what the voters saw. Covered by the self-hash below, so it
|
|
48839
48845
|
* cannot be edited to claim a different reviewed diff.
|
|
48840
48846
|
*/
|
|
48841
|
-
reviewedDiffHash:
|
|
48847
|
+
reviewedDiffHash: z103.string().length(64),
|
|
48842
48848
|
/** ISO-8601 timestamp the review was recorded. */
|
|
48843
|
-
recordedAt:
|
|
48849
|
+
recordedAt: z103.string().min(1),
|
|
48844
48850
|
/** The resolved aggregate verdict. */
|
|
48845
48851
|
verdict: PrReviewVerdictSchema,
|
|
48846
48852
|
/**
|
|
@@ -48848,13 +48854,13 @@ var PrReviewRecordSchema = z102.object({
|
|
|
48848
48854
|
* `request_changes` with `verified: true` is a strict blocker; covered by the
|
|
48849
48855
|
* hash so it cannot be flipped without detection.
|
|
48850
48856
|
*/
|
|
48851
|
-
verified:
|
|
48857
|
+
verified: z103.boolean(),
|
|
48852
48858
|
/** Per-decision voter tally from the pr_review aggregate. */
|
|
48853
48859
|
voteCounts: PrReviewVoteCountsSchema,
|
|
48854
48860
|
/** Truncated human-readable review summary for the reviewer record. */
|
|
48855
|
-
summary:
|
|
48861
|
+
summary: z103.string(),
|
|
48856
48862
|
/** Optional correlation/decision id linking to the cost rollup / trace. */
|
|
48857
|
-
correlationId:
|
|
48863
|
+
correlationId: z103.string().min(1).optional(),
|
|
48858
48864
|
/**
|
|
48859
48865
|
* What this record was DERIVED FROM (#4459). OPTIONAL by necessity: the
|
|
48860
48866
|
* schema is `.strict()`, so a required field would reject every record
|
|
@@ -48875,9 +48881,9 @@ var PrReviewRecordSchema = z102.object({
|
|
|
48875
48881
|
* Retained for audit texture but NOT covered by `hash` and NOT verified —
|
|
48876
48882
|
* the record-set model is position-independent (mirrors #3927).
|
|
48877
48883
|
*/
|
|
48878
|
-
previousHash:
|
|
48884
|
+
previousHash: z103.string().length(64).optional(),
|
|
48879
48885
|
/** SHA-256 over every field above EXCEPT `previousHash` (and except `hash`). */
|
|
48880
|
-
hash:
|
|
48886
|
+
hash: z103.string().length(64)
|
|
48881
48887
|
}).strict();
|
|
48882
48888
|
function computePrReviewRecordHash(payload) {
|
|
48883
48889
|
const canonical = JSON.stringify({
|
|
@@ -49543,19 +49549,19 @@ var MAX_REPO_CONTEXT_LENGTH = 2e3;
|
|
|
49543
49549
|
var MAX_TITLE_LENGTH = 500;
|
|
49544
49550
|
var MAX_DESCRIPTION_LENGTH = 1e4;
|
|
49545
49551
|
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.";
|
|
49546
|
-
var PrReviewInputSchema =
|
|
49547
|
-
prTitle:
|
|
49548
|
-
prDescription:
|
|
49549
|
-
prDiff:
|
|
49552
|
+
var PrReviewInputSchema = z104.object({
|
|
49553
|
+
prTitle: z104.string().min(1).max(MAX_TITLE_LENGTH).describe("PR title"),
|
|
49554
|
+
prDescription: z104.string().max(MAX_DESCRIPTION_LENGTH).optional().describe("PR body / description"),
|
|
49555
|
+
prDiff: z104.string().min(1).max(MAX_DIFF_INPUT_LENGTH).refine(looksLikeUnifiedDiff, {
|
|
49550
49556
|
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)."
|
|
49551
49557
|
}).describe(
|
|
49552
49558
|
`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: the panel reads the whole diff whenever it fits the voters' context windows (#6003); a diff larger than that is security-prioritized and PARTIALLY reviewed (lowest-priority whole files dropped; a partial panel read can block but never verified-approve). Separately, the audit record's hash binds only the first ${String(MAX_DIFF_LENGTH)} UTF-8 bytes; the response \`coverage\` and the record summary state both what the panel read and what the hash binds.`
|
|
49553
49559
|
),
|
|
49554
|
-
repoContext:
|
|
49560
|
+
repoContext: z104.string().max(MAX_REPO_CONTEXT_LENGTH).optional().describe(
|
|
49555
49561
|
`Optional one-paragraph repo context (architecture, conventions; max ${String(MAX_REPO_CONTEXT_LENGTH)} chars; trim before calling)`
|
|
49556
49562
|
),
|
|
49557
|
-
baseRef:
|
|
49558
|
-
headRef:
|
|
49563
|
+
baseRef: z104.string().max(200).optional().describe("Base branch ref (e.g. main)"),
|
|
49564
|
+
headRef: z104.string().max(200).optional().describe("Head branch ref"),
|
|
49559
49565
|
/**
|
|
49560
49566
|
* Option-C audit binding (#4031). When BOTH `prNumber` and `baseSha` are
|
|
49561
49567
|
* supplied AND the review is live (not simulated), pr_review persists an
|
|
@@ -49571,14 +49577,14 @@ var PrReviewInputSchema = z103.object({
|
|
|
49571
49577
|
* the PR opened and drifts as main advances), so pass the merge-base as
|
|
49572
49578
|
* `baseSha` or the record will not match on an aged branch (#5692).
|
|
49573
49579
|
*/
|
|
49574
|
-
prNumber:
|
|
49575
|
-
baseSha:
|
|
49580
|
+
prNumber: z104.number().int().positive().optional().describe("PR number \u2014 with baseSha, enables Option-C audit-record persistence (#4031)"),
|
|
49581
|
+
baseSha: z104.string().regex(/^[0-9a-f]{40}$/, "baseSha must be a 40-char lowercase hex commit sha").optional().describe(
|
|
49576
49582
|
"40-hex base commit sha the reviewed diff was computed from \u2014 pass `git merge-base origin/<base> <head>`, the base the gate recomputes (Option-C binding, #4031, #5692)"
|
|
49577
49583
|
),
|
|
49578
|
-
repoPath:
|
|
49584
|
+
repoPath: z104.string().max(1024).optional().describe(
|
|
49579
49585
|
"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."
|
|
49580
49586
|
),
|
|
49581
|
-
simulate:
|
|
49587
|
+
simulate: z104.boolean().default(false).describe("Use simulated voters (testing only; never ship live with this true)"),
|
|
49582
49588
|
/**
|
|
49583
49589
|
* Error policy (#4132). `standard` (default) keeps the pre-#4132 aggregation:
|
|
49584
49590
|
* an errored voter is simply excluded from the panel. `absolute_quorum` gates
|
|
@@ -49590,7 +49596,7 @@ var PrReviewInputSchema = z103.object({
|
|
|
49590
49596
|
* verified approve. A genuine `request_changes` blocker still wins (Tiers 1-2
|
|
49591
49597
|
* run first).
|
|
49592
49598
|
*/
|
|
49593
|
-
errorPolicy:
|
|
49599
|
+
errorPolicy: z104.enum(["standard", "absolute_quorum"]).default("standard").describe(
|
|
49594
49600
|
"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."
|
|
49595
49601
|
),
|
|
49596
49602
|
// #6123: same field as consensus_vote — the panel judges the caller's project.
|
|
@@ -49602,7 +49608,7 @@ var PrReviewInputSchema = z103.object({
|
|
|
49602
49608
|
* runs the panel in the background; poll `get_job_result({ jobId })` for the
|
|
49603
49609
|
* result.
|
|
49604
49610
|
*/
|
|
49605
|
-
dispatch:
|
|
49611
|
+
dispatch: z104.enum(["sync", "async"]).default("sync").describe(
|
|
49606
49612
|
"Dispatch mode (#3731). 'sync' (default): run inline. 'async': return a jobId immediately + run the panel in background (poll get_job_result)."
|
|
49607
49613
|
)
|
|
49608
49614
|
});
|
|
@@ -49811,27 +49817,27 @@ function registerPrReviewTool(server, deps) {
|
|
|
49811
49817
|
}
|
|
49812
49818
|
|
|
49813
49819
|
// src/mcp/tools/survey-oss-landscape.ts
|
|
49814
|
-
import { z as
|
|
49815
|
-
var SurveyOssLandscapeInputSchema =
|
|
49816
|
-
query:
|
|
49817
|
-
maxResults:
|
|
49818
|
-
minStars:
|
|
49819
|
-
language:
|
|
49820
|
-
});
|
|
49821
|
-
var GitHubRepoSchema =
|
|
49822
|
-
full_name:
|
|
49823
|
-
html_url:
|
|
49824
|
-
description:
|
|
49825
|
-
stargazers_count:
|
|
49826
|
-
pushed_at:
|
|
49827
|
-
language:
|
|
49828
|
-
license:
|
|
49829
|
-
spdx_id:
|
|
49820
|
+
import { z as z105 } from "zod";
|
|
49821
|
+
var SurveyOssLandscapeInputSchema = z105.object({
|
|
49822
|
+
query: z105.string().min(1).max(200).describe('Free-text search query, e.g. "cargo nextest replacement" or "OSS SBOM tools"'),
|
|
49823
|
+
maxResults: z105.number().int().min(1).max(50).optional().default(10).describe("Maximum candidates to return (1-50; default 10)"),
|
|
49824
|
+
minStars: z105.number().int().min(0).optional().default(0).describe("Minimum star count to include (default 0; useful for filtering noise)"),
|
|
49825
|
+
language: z105.string().max(50).optional().describe('GitHub language filter, e.g. "rust" or "typescript"')
|
|
49826
|
+
});
|
|
49827
|
+
var GitHubRepoSchema = z105.object({
|
|
49828
|
+
full_name: z105.string().optional(),
|
|
49829
|
+
html_url: z105.string().optional(),
|
|
49830
|
+
description: z105.string().nullable().optional(),
|
|
49831
|
+
stargazers_count: z105.number().optional(),
|
|
49832
|
+
pushed_at: z105.string().nullable().optional(),
|
|
49833
|
+
language: z105.string().nullable().optional(),
|
|
49834
|
+
license: z105.object({
|
|
49835
|
+
spdx_id: z105.string().nullable().optional()
|
|
49830
49836
|
}).nullable().optional()
|
|
49831
49837
|
});
|
|
49832
|
-
var GitHubSearchResponseSchema =
|
|
49833
|
-
total_count:
|
|
49834
|
-
items:
|
|
49838
|
+
var GitHubSearchResponseSchema = z105.object({
|
|
49839
|
+
total_count: z105.number().optional(),
|
|
49840
|
+
items: z105.array(GitHubRepoSchema).optional()
|
|
49835
49841
|
});
|
|
49836
49842
|
var GITHUB_SEARCH_BASE = "https://api.github.com/search/repositories";
|
|
49837
49843
|
function buildGithubQuery(input) {
|
|
@@ -49958,11 +49964,11 @@ function createSurveyHandler(deps) {
|
|
|
49958
49964
|
};
|
|
49959
49965
|
}
|
|
49960
49966
|
var SURVEY_OUTPUT_SCHEMA = {
|
|
49961
|
-
query:
|
|
49962
|
-
totalFound:
|
|
49963
|
-
candidates:
|
|
49964
|
-
sourcesQueried:
|
|
49965
|
-
sourcesFailed:
|
|
49967
|
+
query: z105.string(),
|
|
49968
|
+
totalFound: z105.number(),
|
|
49969
|
+
candidates: z105.array(z105.unknown()),
|
|
49970
|
+
sourcesQueried: z105.array(z105.string()),
|
|
49971
|
+
sourcesFailed: z105.array(z105.string())
|
|
49966
49972
|
};
|
|
49967
49973
|
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?".';
|
|
49968
49974
|
function registerSurveyOssLandscapeTool(server, deps) {
|
|
@@ -49991,7 +49997,7 @@ function registerSurveyOssLandscapeTool(server, deps) {
|
|
|
49991
49997
|
}
|
|
49992
49998
|
|
|
49993
49999
|
// src/mcp/tools/vendor-publishing-audit.ts
|
|
49994
|
-
import { z as
|
|
50000
|
+
import { z as z106 } from "zod";
|
|
49995
50001
|
|
|
49996
50002
|
// src/mcp/tools/vendor-publishing-seed.ts
|
|
49997
50003
|
var VENDOR_PUBLISHING_SEED = {
|
|
@@ -50064,8 +50070,8 @@ function listKnownVendors() {
|
|
|
50064
50070
|
}
|
|
50065
50071
|
|
|
50066
50072
|
// src/mcp/tools/vendor-publishing-audit.ts
|
|
50067
|
-
var VendorPublishingAuditInputSchema =
|
|
50068
|
-
vendor:
|
|
50073
|
+
var VendorPublishingAuditInputSchema = z106.object({
|
|
50074
|
+
vendor: z106.string().min(1).max(50).toLowerCase().describe('Vendor identifier, lowercase. e.g. "ubuntu", "debian", "fedora"')
|
|
50069
50075
|
});
|
|
50070
50076
|
function lookupVendor(vendor) {
|
|
50071
50077
|
if (isKnownVendor(vendor)) {
|
|
@@ -50097,20 +50103,20 @@ function createVendorPublishingAuditHandler(deps) {
|
|
|
50097
50103
|
};
|
|
50098
50104
|
}
|
|
50099
50105
|
var VENDOR_PUBLISHING_OUTPUT_SCHEMA = {
|
|
50100
|
-
vendor:
|
|
50101
|
-
known:
|
|
50106
|
+
vendor: z106.string(),
|
|
50107
|
+
known: z106.boolean(),
|
|
50102
50108
|
// Fields below populate when known=true; permissive optional for known=false.
|
|
50103
|
-
sha256SumsUrlPattern:
|
|
50104
|
-
sha256SumsSignatureUrlPattern:
|
|
50105
|
-
signaturePattern:
|
|
50106
|
-
gpgKeys:
|
|
50107
|
-
releaseCadence:
|
|
50108
|
-
keyRotationNotes:
|
|
50109
|
-
vendorDocUrl:
|
|
50110
|
-
citedAt:
|
|
50109
|
+
sha256SumsUrlPattern: z106.string().optional(),
|
|
50110
|
+
sha256SumsSignatureUrlPattern: z106.string().optional(),
|
|
50111
|
+
signaturePattern: z106.string().optional(),
|
|
50112
|
+
gpgKeys: z106.array(z106.unknown()).optional(),
|
|
50113
|
+
releaseCadence: z106.string().optional(),
|
|
50114
|
+
keyRotationNotes: z106.string().optional(),
|
|
50115
|
+
vendorDocUrl: z106.string().optional(),
|
|
50116
|
+
citedAt: z106.string().optional(),
|
|
50111
50117
|
// Fields below populate when known=false.
|
|
50112
|
-
message:
|
|
50113
|
-
knownVendors:
|
|
50118
|
+
message: z106.string().optional(),
|
|
50119
|
+
knownVendors: z106.array(z106.string()).optional()
|
|
50114
50120
|
};
|
|
50115
50121
|
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.";
|
|
50116
50122
|
function registerVendorPublishingAuditTool(server, deps) {
|
|
@@ -50139,17 +50145,17 @@ function registerVendorPublishingAuditTool(server, deps) {
|
|
|
50139
50145
|
}
|
|
50140
50146
|
|
|
50141
50147
|
// src/mcp/tools/compare-data-feeds.ts
|
|
50142
|
-
import { z as
|
|
50148
|
+
import { z as z107 } from "zod";
|
|
50143
50149
|
import * as path6 from "node:path";
|
|
50144
50150
|
import * as fs7 from "node:fs";
|
|
50145
50151
|
import * as yaml4 from "yaml";
|
|
50146
|
-
var CompareDataFeedsInputSchema =
|
|
50147
|
-
feedAPath:
|
|
50148
|
-
feedBPath:
|
|
50149
|
-
keyPath:
|
|
50152
|
+
var CompareDataFeedsInputSchema = z107.object({
|
|
50153
|
+
feedAPath: z107.string().min(1).max(1e3).describe("Filesystem path to feed A (YAML or JSON, auto-detected by extension)"),
|
|
50154
|
+
feedBPath: z107.string().min(1).max(1e3).describe("Filesystem path to feed B"),
|
|
50155
|
+
keyPath: z107.string().min(1).max(200).describe(
|
|
50150
50156
|
'Dotted path to the entry key, e.g. "id" or "name". Each entry must have this field.'
|
|
50151
50157
|
),
|
|
50152
|
-
compareFields:
|
|
50158
|
+
compareFields: z107.array(z107.string().min(1).max(200)).max(20).optional().describe(
|
|
50153
50159
|
'Optional dotted field paths to compare across matched entries (e.g. ["license", "sha256"])'
|
|
50154
50160
|
)
|
|
50155
50161
|
});
|
|
@@ -50333,24 +50339,24 @@ function createCompareDataFeedsHandler(deps) {
|
|
|
50333
50339
|
};
|
|
50334
50340
|
}
|
|
50335
50341
|
var COMPARE_OUTPUT_SCHEMA = {
|
|
50336
|
-
feedAPath:
|
|
50337
|
-
feedBPath:
|
|
50338
|
-
keyPath:
|
|
50339
|
-
counts:
|
|
50340
|
-
entriesInA:
|
|
50341
|
-
entriesInB:
|
|
50342
|
-
onlyInA:
|
|
50343
|
-
onlyInB:
|
|
50344
|
-
inBoth:
|
|
50345
|
-
fieldDifferences:
|
|
50342
|
+
feedAPath: z107.string(),
|
|
50343
|
+
feedBPath: z107.string(),
|
|
50344
|
+
keyPath: z107.string(),
|
|
50345
|
+
counts: z107.object({
|
|
50346
|
+
entriesInA: z107.number(),
|
|
50347
|
+
entriesInB: z107.number(),
|
|
50348
|
+
onlyInA: z107.number(),
|
|
50349
|
+
onlyInB: z107.number(),
|
|
50350
|
+
inBoth: z107.number(),
|
|
50351
|
+
fieldDifferences: z107.number()
|
|
50346
50352
|
}),
|
|
50347
|
-
coverage:
|
|
50348
|
-
onlyInA:
|
|
50349
|
-
onlyInB:
|
|
50350
|
-
inBoth:
|
|
50353
|
+
coverage: z107.object({
|
|
50354
|
+
onlyInA: z107.array(z107.string()),
|
|
50355
|
+
onlyInB: z107.array(z107.string()),
|
|
50356
|
+
inBoth: z107.array(z107.string())
|
|
50351
50357
|
}),
|
|
50352
|
-
fieldDifferences:
|
|
50353
|
-
summary:
|
|
50358
|
+
fieldDifferences: z107.array(z107.unknown()),
|
|
50359
|
+
summary: z107.string()
|
|
50354
50360
|
};
|
|
50355
50361
|
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.";
|
|
50356
50362
|
function registerCompareDataFeedsTool(server, deps) {
|
|
@@ -50379,9 +50385,9 @@ function registerCompareDataFeedsTool(server, deps) {
|
|
|
50379
50385
|
}
|
|
50380
50386
|
|
|
50381
50387
|
// src/mcp/tools/query-task-state-tool.ts
|
|
50382
|
-
import { z as
|
|
50383
|
-
var QueryTaskStateInputSchema =
|
|
50384
|
-
taskId:
|
|
50388
|
+
import { z as z108 } from "zod";
|
|
50389
|
+
var QueryTaskStateInputSchema = z108.object({
|
|
50390
|
+
taskId: z108.string().min(1).max(128).describe("Task ID whose structured state log should be read")
|
|
50385
50391
|
});
|
|
50386
50392
|
function queryTaskStateHandler(args, ctx) {
|
|
50387
50393
|
const parsed = QueryTaskStateInputSchema.safeParse(args);
|
|
@@ -50416,7 +50422,7 @@ function queryTaskStateHandler(args, ctx) {
|
|
|
50416
50422
|
function registerQueryTaskStateTool(server, deps) {
|
|
50417
50423
|
const logger57 = deps.logger ?? createLogger({ tool: "query_task_state" });
|
|
50418
50424
|
const toolSchema = {
|
|
50419
|
-
taskId:
|
|
50425
|
+
taskId: z108.string().min(1).max(128).describe("Task ID whose structured state log should be read")
|
|
50420
50426
|
};
|
|
50421
50427
|
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.";
|
|
50422
50428
|
const secureHandler = createSecureHandler(queryTaskStateHandler, {
|
|
@@ -50438,28 +50444,28 @@ function registerQueryTaskStateTool(server, deps) {
|
|
|
50438
50444
|
}
|
|
50439
50445
|
|
|
50440
50446
|
// src/mcp/tools/ci-health-check-tool.ts
|
|
50441
|
-
import { z as
|
|
50447
|
+
import { z as z111 } from "zod";
|
|
50442
50448
|
|
|
50443
50449
|
// src/mcp/tools/ci-health-log.ts
|
|
50444
50450
|
import { appendFileSync as appendFileSync4, existsSync as existsSync11, readFileSync as readFileSync10, statSync as statSync2, writeFileSync as writeFileSync3 } from "node:fs";
|
|
50445
|
-
import { z as
|
|
50451
|
+
import { z as z110 } from "zod";
|
|
50446
50452
|
|
|
50447
50453
|
// src/mcp/tools/ci-health-types.ts
|
|
50448
|
-
import { z as
|
|
50449
|
-
var CiHealthStatusSchema =
|
|
50454
|
+
import { z as z109 } from "zod";
|
|
50455
|
+
var CiHealthStatusSchema = z109.enum(["healthy", "degraded", "outage", "unknown"]);
|
|
50450
50456
|
|
|
50451
50457
|
// src/mcp/tools/ci-health-log.ts
|
|
50452
50458
|
var logger47 = createLogger({ component: "ci-health-log" });
|
|
50453
|
-
var CiHealthEventSchema =
|
|
50454
|
-
v:
|
|
50455
|
-
ts:
|
|
50459
|
+
var CiHealthEventSchema = z110.object({
|
|
50460
|
+
v: z110.literal(1),
|
|
50461
|
+
ts: z110.iso.datetime(),
|
|
50456
50462
|
status: CiHealthStatusSchema,
|
|
50457
|
-
repo:
|
|
50458
|
-
signals:
|
|
50459
|
-
|
|
50460
|
-
source:
|
|
50463
|
+
repo: z110.string().optional(),
|
|
50464
|
+
signals: z110.array(
|
|
50465
|
+
z110.object({
|
|
50466
|
+
source: z110.enum(["github-status", "repo-activity-window"]),
|
|
50461
50467
|
status: CiHealthStatusSchema,
|
|
50462
|
-
evidence:
|
|
50468
|
+
evidence: z110.string()
|
|
50463
50469
|
})
|
|
50464
50470
|
)
|
|
50465
50471
|
});
|
|
@@ -50539,17 +50545,17 @@ function eventFromCheck(params) {
|
|
|
50539
50545
|
}
|
|
50540
50546
|
|
|
50541
50547
|
// src/mcp/tools/ci-health-check-tool.ts
|
|
50542
|
-
var CiHealthCheckInputSchema =
|
|
50548
|
+
var CiHealthCheckInputSchema = z111.object({
|
|
50543
50549
|
/**
|
|
50544
50550
|
* Repo to check for the recent-runs activity signal (in `owner/repo` form).
|
|
50545
50551
|
* Optional — when omitted, only the status-page signal is consulted.
|
|
50546
50552
|
*/
|
|
50547
|
-
repo:
|
|
50553
|
+
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."),
|
|
50548
50554
|
/**
|
|
50549
50555
|
* How far back to look for recent-runs activity (minutes). Default 30 —
|
|
50550
50556
|
* matches the typical wedge-detection window from the #3070 / #3076 outages.
|
|
50551
50557
|
*/
|
|
50552
|
-
activityWindowMinutes:
|
|
50558
|
+
activityWindowMinutes: z111.number().int().min(5).max(180).default(30).describe("Recent-runs lookback window in minutes (5-180; default 30).")
|
|
50553
50559
|
});
|
|
50554
50560
|
var STATUS_PAGE_URL = "https://www.githubstatus.com/api/v2/components.json";
|
|
50555
50561
|
function mapStatusPageStatus(raw) {
|
|
@@ -50682,8 +50688,8 @@ var DESCRIPTION = "Check CI infrastructure health before triggering / polling ru
|
|
|
50682
50688
|
function registerCiHealthCheckTool(server, deps) {
|
|
50683
50689
|
const logger57 = deps.logger ?? createLogger({ tool: "ci_health_check" });
|
|
50684
50690
|
const toolSchema = {
|
|
50685
|
-
repo:
|
|
50686
|
-
activityWindowMinutes:
|
|
50691
|
+
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."),
|
|
50692
|
+
activityWindowMinutes: z111.number().int().min(5).max(180).optional().describe("Recent-runs lookback window in minutes (5-180; default 30).")
|
|
50687
50693
|
};
|
|
50688
50694
|
const secureHandler = createSecureHandler((args) => ciHealthCheckHandler(args, logger57), {
|
|
50689
50695
|
toolName: "ci_health_check",
|
|
@@ -50709,18 +50715,18 @@ function registerCiHealthCheckTool(server, deps) {
|
|
|
50709
50715
|
|
|
50710
50716
|
// src/mcp/tools/quality-gate-tool.ts
|
|
50711
50717
|
import { statSync as statSync3 } from "node:fs";
|
|
50712
|
-
import { z as
|
|
50713
|
-
var QualityCheckSchema =
|
|
50718
|
+
import { z as z112 } from "zod";
|
|
50719
|
+
var QualityCheckSchema = z112.enum(["typecheck", "lint", "tests", "build", "security"]);
|
|
50714
50720
|
var DEFAULT_CHECKS = ["typecheck", "lint", "tests"];
|
|
50715
|
-
var RunQualityGateInputSchema =
|
|
50721
|
+
var RunQualityGateInputSchema = z112.object({
|
|
50716
50722
|
/** Project directory to run checks against. Must resolve inside the repo/cwd root. */
|
|
50717
|
-
projectDir:
|
|
50723
|
+
projectDir: z112.string().optional().describe(
|
|
50718
50724
|
"Project directory to run checks against (default: cwd). Must stay inside the repo root."
|
|
50719
50725
|
),
|
|
50720
50726
|
/** Which allowlisted checks to run. */
|
|
50721
|
-
checks:
|
|
50727
|
+
checks: z112.array(QualityCheckSchema).nonempty().default([...DEFAULT_CHECKS]).describe("Allowlisted checks to run (default: ['typecheck','lint','tests'])."),
|
|
50722
50728
|
/** 1-based iteration counter, forwarded to the engine for feedback context. */
|
|
50723
|
-
iteration:
|
|
50729
|
+
iteration: z112.number().int().min(1).default(1).describe("1-based iteration number (default 1).")
|
|
50724
50730
|
});
|
|
50725
50731
|
function validateProjectDir(raw) {
|
|
50726
50732
|
const candidate = raw ?? process.cwd();
|
|
@@ -50795,11 +50801,11 @@ var DESCRIPTION2 = "Run the QA quality gate (#1684 engine) against a project dir
|
|
|
50795
50801
|
function registerRunQualityGateTool(server, deps) {
|
|
50796
50802
|
const logger57 = deps.logger ?? createLogger({ tool: "run_quality_gate" });
|
|
50797
50803
|
const toolSchema = {
|
|
50798
|
-
projectDir:
|
|
50804
|
+
projectDir: z112.string().optional().describe(
|
|
50799
50805
|
"Project directory to run checks against (default: cwd). Must stay inside the repo root."
|
|
50800
50806
|
),
|
|
50801
|
-
checks:
|
|
50802
|
-
iteration:
|
|
50807
|
+
checks: z112.array(QualityCheckSchema).nonempty().optional().describe("Allowlisted checks to run (default: ['typecheck','lint','tests'])."),
|
|
50808
|
+
iteration: z112.number().int().min(1).optional().describe("1-based iteration number (default 1).")
|
|
50803
50809
|
};
|
|
50804
50810
|
const secureHandler = createSecureHandler(
|
|
50805
50811
|
(args) => runQualityGateHandler(args, logger57),
|
|
@@ -50829,9 +50835,9 @@ function registerRunQualityGateTool(server, deps) {
|
|
|
50829
50835
|
// src/mcp/tools/verify-audit-chain-tool.ts
|
|
50830
50836
|
import * as fs8 from "node:fs/promises";
|
|
50831
50837
|
import * as path7 from "node:path";
|
|
50832
|
-
import { z as
|
|
50833
|
-
var VerifyAuditChainInputSchema =
|
|
50834
|
-
logDir:
|
|
50838
|
+
import { z as z113 } from "zod";
|
|
50839
|
+
var VerifyAuditChainInputSchema = z113.object({
|
|
50840
|
+
logDir: z113.string().min(1).max(512).describe(
|
|
50835
50841
|
"Filesystem path to the FileAuditStorage log directory. Tool reads all `audit-*.jsonl` files in lexicographic order and verifies the combined chain."
|
|
50836
50842
|
)
|
|
50837
50843
|
});
|
|
@@ -50921,7 +50927,7 @@ async function handler2(args, ctx) {
|
|
|
50921
50927
|
function registerVerifyAuditChainTool(server, deps) {
|
|
50922
50928
|
const logger57 = deps.logger ?? createLogger({ tool: "verify_audit_chain" });
|
|
50923
50929
|
const toolSchema = {
|
|
50924
|
-
logDir:
|
|
50930
|
+
logDir: z113.string().min(1).max(512).describe(
|
|
50925
50931
|
"Filesystem path to the FileAuditStorage log directory. Tool reads all `audit-*.jsonl` files and verifies the combined hash chain."
|
|
50926
50932
|
)
|
|
50927
50933
|
};
|
|
@@ -50945,7 +50951,7 @@ function registerVerifyAuditChainTool(server, deps) {
|
|
|
50945
50951
|
}
|
|
50946
50952
|
|
|
50947
50953
|
// src/mcp/tools/suggest-research-tasks-tool.ts
|
|
50948
|
-
import { z as
|
|
50954
|
+
import { z as z114 } from "zod";
|
|
50949
50955
|
var SUGGEST_RESEARCH_TASKS_NOTE = "Suggestions derived from external research (untrusted); review before acting \u2014 nothing was executed or filed.";
|
|
50950
50956
|
var RESEARCH_BUDGET_MS = 2e4;
|
|
50951
50957
|
var RESEARCH_TIMED_OUT = /* @__PURE__ */ Symbol("research-budget-exceeded");
|
|
@@ -50962,11 +50968,11 @@ async function withResearchBudget(p, ms) {
|
|
|
50962
50968
|
if (timer !== void 0) clearTimeout(timer);
|
|
50963
50969
|
}
|
|
50964
50970
|
}
|
|
50965
|
-
var SuggestResearchTasksInputSchema =
|
|
50966
|
-
topic:
|
|
50967
|
-
qualityThreshold:
|
|
50968
|
-
maxTriggers:
|
|
50969
|
-
existingTaskIds:
|
|
50971
|
+
var SuggestResearchTasksInputSchema = z114.object({
|
|
50972
|
+
topic: z114.string().optional().describe("Topic filter passed to research_discover. Optional."),
|
|
50973
|
+
qualityThreshold: z114.number().min(0).max(10).optional().describe("Minimum quality score (0-10) a discovery must meet to be suggested. Optional."),
|
|
50974
|
+
maxTriggers: z114.number().int().min(1).optional().describe("Max number of candidate tasks to return (>=1). Optional."),
|
|
50975
|
+
existingTaskIds: z114.array(z114.string()).optional().describe("Known task IDs to skip (dedup). Optional.")
|
|
50970
50976
|
});
|
|
50971
50977
|
function toTriggerConfig(input) {
|
|
50972
50978
|
return {
|
|
@@ -51023,10 +51029,10 @@ var DESCRIPTION3 = "SUGGEST-ONLY: surface candidate pipeline tasks for human/orc
|
|
|
51023
51029
|
function registerSuggestResearchTasksTool(server, deps) {
|
|
51024
51030
|
const logger57 = deps.logger ?? createLogger({ tool: "suggest_research_tasks" });
|
|
51025
51031
|
const toolSchema = {
|
|
51026
|
-
topic:
|
|
51027
|
-
qualityThreshold:
|
|
51028
|
-
maxTriggers:
|
|
51029
|
-
existingTaskIds:
|
|
51032
|
+
topic: z114.string().optional().describe("Topic filter passed to research_discover. Optional."),
|
|
51033
|
+
qualityThreshold: z114.number().min(0).max(10).optional().describe("Minimum quality score (0-10) a discovery must meet to be suggested. Optional."),
|
|
51034
|
+
maxTriggers: z114.number().int().min(1).optional().describe("Max number of candidate tasks to return (>=1). Optional."),
|
|
51035
|
+
existingTaskIds: z114.array(z114.string()).optional().describe("Known task IDs to skip (dedup). Optional.")
|
|
51030
51036
|
};
|
|
51031
51037
|
const secureHandler = createSecureHandler(
|
|
51032
51038
|
(args) => suggestResearchTasksHandler(args, logger57),
|
|
@@ -51054,7 +51060,7 @@ function registerSuggestResearchTasksTool(server, deps) {
|
|
|
51054
51060
|
}
|
|
51055
51061
|
|
|
51056
51062
|
// src/mcp/tools/run-tool.ts
|
|
51057
|
-
import { z as
|
|
51063
|
+
import { z as z118 } from "zod";
|
|
51058
51064
|
import { randomUUID as randomUUID17 } from "node:crypto";
|
|
51059
51065
|
|
|
51060
51066
|
// src/orchestration/meta-dispatcher.ts
|
|
@@ -51514,7 +51520,7 @@ function createMetaOrchestrator(options) {
|
|
|
51514
51520
|
|
|
51515
51521
|
// src/orchestration/meta-shadow-selector.ts
|
|
51516
51522
|
import { appendFileSync as appendFileSync5, existsSync as existsSync12, readFileSync as readFileSync11 } from "node:fs";
|
|
51517
|
-
import { z as
|
|
51523
|
+
import { z as z115 } from "zod";
|
|
51518
51524
|
var SHADOW_STRATEGY_ARMS = [
|
|
51519
51525
|
"single-shot",
|
|
51520
51526
|
"dev-pipeline",
|
|
@@ -51601,19 +51607,19 @@ function createHydratableSelector() {
|
|
|
51601
51607
|
var META_OUTCOME_SCHEMA_VERSION = 1;
|
|
51602
51608
|
var HYDRATE_LOOKBACK_DAYS = 30;
|
|
51603
51609
|
var HYDRATE_LOOKBACK_MS = HYDRATE_LOOKBACK_DAYS * 24 * 60 * 60 * 1e3;
|
|
51604
|
-
var PersistedContextSchema =
|
|
51605
|
-
taskComplexity:
|
|
51606
|
-
contextLengthNormalized:
|
|
51607
|
-
isCodeTask:
|
|
51608
|
-
isReasoningTask:
|
|
51609
|
-
budgetUtilization:
|
|
51610
|
-
timePressure:
|
|
51611
|
-
});
|
|
51612
|
-
var PersistedMetaOutcomeSchema =
|
|
51613
|
-
schema:
|
|
51614
|
-
timestamp:
|
|
51615
|
-
strategy:
|
|
51616
|
-
success:
|
|
51610
|
+
var PersistedContextSchema = z115.object({
|
|
51611
|
+
taskComplexity: z115.number(),
|
|
51612
|
+
contextLengthNormalized: z115.number(),
|
|
51613
|
+
isCodeTask: z115.number(),
|
|
51614
|
+
isReasoningTask: z115.number(),
|
|
51615
|
+
budgetUtilization: z115.number(),
|
|
51616
|
+
timePressure: z115.number()
|
|
51617
|
+
});
|
|
51618
|
+
var PersistedMetaOutcomeSchema = z115.object({
|
|
51619
|
+
schema: z115.literal(META_OUTCOME_SCHEMA_VERSION),
|
|
51620
|
+
timestamp: z115.string(),
|
|
51621
|
+
strategy: z115.enum(SHADOW_STRATEGY_ARMS),
|
|
51622
|
+
success: z115.boolean(),
|
|
51617
51623
|
context: PersistedContextSchema
|
|
51618
51624
|
});
|
|
51619
51625
|
var persistLogger = createLogger({ component: "MetaShadowSelector" });
|
|
@@ -52006,7 +52012,7 @@ function evaluateMetaStrategyReadiness(result, config = DEFAULT_META_STRATEGY_RE
|
|
|
52006
52012
|
}
|
|
52007
52013
|
|
|
52008
52014
|
// src/mcp/tools/dev-pipeline-tool.ts
|
|
52009
|
-
import { z as
|
|
52015
|
+
import { z as z116 } from "zod";
|
|
52010
52016
|
import * as fs10 from "node:fs";
|
|
52011
52017
|
import * as path9 from "node:path";
|
|
52012
52018
|
import { randomUUID as randomUUID15 } from "node:crypto";
|
|
@@ -52159,36 +52165,36 @@ var DEV_PIPELINE_DRY_RUN_NOTE = "This was a dry run (plan+vote), which always ru
|
|
|
52159
52165
|
function dispatchNoteFor(dryRun) {
|
|
52160
52166
|
return dryRun ? DEV_PIPELINE_DRY_RUN_NOTE : DEV_PIPELINE_ASYNC_HINT;
|
|
52161
52167
|
}
|
|
52162
|
-
var DevPipelineInputSchema =
|
|
52168
|
+
var DevPipelineInputSchema = z116.object({
|
|
52163
52169
|
/** Direct task instructions. */
|
|
52164
|
-
task:
|
|
52170
|
+
task: z116.string().max(1e4).optional().describe("Direct task instructions (what to build)"),
|
|
52165
52171
|
/** Path to a plan file (.md, .yaml, .txt) to use as input. */
|
|
52166
|
-
planFile:
|
|
52172
|
+
planFile: z116.string().max(500).optional().describe("Path to a plan/spec file to use as input"),
|
|
52167
52173
|
/** Whether to run in dry-run mode (plan+vote only, no implementation). */
|
|
52168
|
-
dryRun:
|
|
52174
|
+
dryRun: z116.boolean().default(false).describe("If true, stop after plan+vote (no implementation)"),
|
|
52169
52175
|
/** Maximum vote iterations before proceeding (default: 3). */
|
|
52170
|
-
maxVoteIterations:
|
|
52176
|
+
maxVoteIterations: z116.number().int().min(1).max(5).default(3).describe("Max plan\u2192vote iterations"),
|
|
52171
52177
|
/** Maximum QA iterations per task (default: 3). */
|
|
52172
|
-
maxQaIterations:
|
|
52178
|
+
maxQaIterations: z116.number().int().min(1).max(5).default(3).describe("Max QA review iterations per task"),
|
|
52173
52179
|
/** Working directory for the pipeline (default: cwd). Used for security scan and context. */
|
|
52174
|
-
workingDir:
|
|
52180
|
+
workingDir: z116.string().max(500).optional().describe("Working directory (default: cwd)"),
|
|
52175
52181
|
/** GitHub issue number to track progress on. Updates posted as comments. */
|
|
52176
|
-
issueNumber:
|
|
52182
|
+
issueNumber: z116.number().int().positive().optional().describe("GitHub issue to post progress to"),
|
|
52177
52183
|
/** GitHub repo (owner/name) for issue tracking. */
|
|
52178
|
-
repo:
|
|
52184
|
+
repo: z116.string().max(200).optional().describe("GitHub repo for issue tracking (e.g., owner/repo)"),
|
|
52179
52185
|
/** Task tracking backend: github, gitlab, or json (default: json). */
|
|
52180
|
-
trackerBackend:
|
|
52186
|
+
trackerBackend: z116.enum(["github", "gitlab", "json"]).default("json").describe("Task tracking backend for issue creation"),
|
|
52181
52187
|
/** Labels to apply to created issues. */
|
|
52182
|
-
labels:
|
|
52188
|
+
labels: z116.array(z116.string()).optional().describe("Labels for created issues"),
|
|
52183
52189
|
/** Session ID for checkpoint/resume. Enables crash recovery. */
|
|
52184
|
-
sessionId:
|
|
52190
|
+
sessionId: z116.string().max(128).regex(/^[a-zA-Z0-9_-]+$/).optional().describe("Session ID for checkpoint/resume (crash recovery)"),
|
|
52185
52191
|
/**
|
|
52186
52192
|
* TESTS ONLY — when true, voters return random decisions. Must not be used as
|
|
52187
52193
|
* a fallback when adapters are unavailable; configure an adapter instead. (#2319)
|
|
52188
52194
|
*/
|
|
52189
|
-
simulateVotes:
|
|
52195
|
+
simulateVotes: z116.boolean().default(false).describe("TESTS ONLY \u2014 random output, must not be used for real decisions (#2319)"),
|
|
52190
52196
|
/** Voting strategy for consensus stages. */
|
|
52191
|
-
votingStrategy:
|
|
52197
|
+
votingStrategy: z116.enum([
|
|
52192
52198
|
"simple_majority",
|
|
52193
52199
|
"supermajority",
|
|
52194
52200
|
"unanimous",
|
|
@@ -52197,11 +52203,11 @@ var DevPipelineInputSchema = z115.object({
|
|
|
52197
52203
|
"opinion_wise"
|
|
52198
52204
|
]).optional().describe("Voting strategy for plan approval (default: higher_order)"),
|
|
52199
52205
|
/** Use 3 agents instead of 6 for faster voting. */
|
|
52200
|
-
quickMode:
|
|
52206
|
+
quickMode: z116.boolean().default(false).describe("Use 3 agents instead of 6 for faster consensus voting"),
|
|
52201
52207
|
/** Maximum execution time per stage in milliseconds (min 30s, max 600s). */
|
|
52202
|
-
timeoutMs:
|
|
52208
|
+
timeoutMs: z116.number().int().min(3e4).max(6e5).optional().describe("Max time per stage in ms (30000-600000). Default: varies by stage complexity"),
|
|
52203
52209
|
/** Pipeline execution mode. */
|
|
52204
|
-
mode:
|
|
52210
|
+
mode: z116.enum(["autonomous", "harness"]).default("autonomous").describe(
|
|
52205
52211
|
"'autonomous': full pipeline. 'harness': stops after decompose, returns tasks for caller to implement."
|
|
52206
52212
|
),
|
|
52207
52213
|
/**
|
|
@@ -52212,15 +52218,15 @@ var DevPipelineInputSchema = z115.object({
|
|
|
52212
52218
|
* `get_job_result({ jobId })` for the result. Ignored when `dryRun` is
|
|
52213
52219
|
* true (plan+vote completes fast, so dry runs always stay sync).
|
|
52214
52220
|
*/
|
|
52215
|
-
dispatch:
|
|
52221
|
+
dispatch: z116.enum(["sync", "async"]).default("sync").describe(
|
|
52216
52222
|
"Dispatch mode (#3726). 'sync' (default): run inline. 'async': return a jobId immediately + run in background (poll get_job_result). Ignored for dryRun."
|
|
52217
52223
|
),
|
|
52218
52224
|
/** Local pre-ship quality gate (typecheck/lint/tests) mode (#3356). */
|
|
52219
|
-
qualityGate:
|
|
52225
|
+
qualityGate: z116.enum(["off", "advisory", "blocking"]).default("off").describe(
|
|
52220
52226
|
"Pre-ship local quality gate. 'off' (default): skip. 'advisory': run + record feedback, never fail. 'blocking': a red gate fails the pipeline."
|
|
52221
52227
|
),
|
|
52222
52228
|
/** Opt-in per-run token budget — a safety cap for unattended runs (#3395). */
|
|
52223
|
-
maxBudgetTokens:
|
|
52229
|
+
maxBudgetTokens: z116.number().int().positive().optional().describe(
|
|
52224
52230
|
"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)."
|
|
52225
52231
|
)
|
|
52226
52232
|
});
|
|
@@ -52444,20 +52450,20 @@ function registerDevPipelineTool(server, deps) {
|
|
|
52444
52450
|
}
|
|
52445
52451
|
|
|
52446
52452
|
// src/mcp/tools/pipeline-tool.ts
|
|
52447
|
-
import { z as
|
|
52453
|
+
import { z as z117 } from "zod";
|
|
52448
52454
|
import * as fs11 from "node:fs";
|
|
52449
52455
|
import * as path10 from "node:path";
|
|
52450
52456
|
import { randomUUID as randomUUID16 } from "node:crypto";
|
|
52451
52457
|
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.";
|
|
52452
|
-
var PipelineInputSchema =
|
|
52458
|
+
var PipelineInputSchema = z117.object({
|
|
52453
52459
|
/** The task to execute. */
|
|
52454
|
-
task:
|
|
52460
|
+
task: z117.string().min(5).max(1e4).describe("Task description \u2014 pipeline template auto-selected based on content"),
|
|
52455
52461
|
/** Path to a spec file (.md, .yaml) to use as task input. */
|
|
52456
|
-
specFile:
|
|
52462
|
+
specFile: z117.string().max(500).optional().describe("Path to a spec file \u2014 content prepended to task for greenfield projects"),
|
|
52457
52463
|
/** Override template — see `listTemplateIds()` for the canonical list (#2728). Auto-detected if omitted. */
|
|
52458
|
-
template:
|
|
52464
|
+
template: z117.string().max(50).optional().describe(`Pipeline template override. Available: ${listTemplateIds().join(", ")}`),
|
|
52459
52465
|
/** Voting strategy for consensus stages. */
|
|
52460
|
-
votingStrategy:
|
|
52466
|
+
votingStrategy: z117.enum([
|
|
52461
52467
|
"simple_majority",
|
|
52462
52468
|
"supermajority",
|
|
52463
52469
|
"unanimous",
|
|
@@ -52468,11 +52474,11 @@ var PipelineInputSchema = z116.object({
|
|
|
52468
52474
|
"Voting strategy for plan approval. simple_majority (default), supermajority (67%), unanimous, higher_order (Bayesian), proof_of_learning, opinion_wise"
|
|
52469
52475
|
),
|
|
52470
52476
|
/** Use 3 agents instead of 6 for faster voting. */
|
|
52471
|
-
quickMode:
|
|
52477
|
+
quickMode: z117.boolean().default(false).describe("Use 3 agents instead of 6 for faster consensus voting"),
|
|
52472
52478
|
/** Maximum execution time per stage in milliseconds (min 30s, max 600s). */
|
|
52473
|
-
timeoutMs:
|
|
52479
|
+
timeoutMs: z117.number().int().min(3e4).max(6e5).optional().describe("Max time per stage in ms (30000-600000). Default: varies by stage complexity"),
|
|
52474
52480
|
/** Stop after planning/voting (no implementation). */
|
|
52475
|
-
dryRun:
|
|
52481
|
+
dryRun: z117.boolean().default(false).describe("Stop after vote stage (no implementation)"),
|
|
52476
52482
|
/**
|
|
52477
52483
|
* Dispatch mode (#3730). `sync` (default) runs the pipeline inline and
|
|
52478
52484
|
* returns the result — but a real multi-stage adaptive run can exceed the
|
|
@@ -52481,11 +52487,11 @@ var PipelineInputSchema = z116.object({
|
|
|
52481
52487
|
* `get_job_result({ jobId })` for the result. Ignored when `dryRun` is true
|
|
52482
52488
|
* (plan+vote completes fast, so dry runs always stay sync).
|
|
52483
52489
|
*/
|
|
52484
|
-
dispatch:
|
|
52490
|
+
dispatch: z117.enum(["sync", "async"]).default("sync").describe(
|
|
52485
52491
|
"Dispatch mode (#3730). 'sync' (default): run inline. 'async': return a jobId immediately + run in background (poll get_job_result). Ignored for dryRun."
|
|
52486
52492
|
),
|
|
52487
52493
|
/** TESTS ONLY — random output, must not be used for real decisions. (#2319) */
|
|
52488
|
-
simulateVotes:
|
|
52494
|
+
simulateVotes: z117.boolean().default(false).describe("TESTS ONLY \u2014 random output, must not be used for real decisions (#2319)")
|
|
52489
52495
|
});
|
|
52490
52496
|
function buildOutput3(result, simulated) {
|
|
52491
52497
|
return {
|
|
@@ -52656,9 +52662,9 @@ function registerPipelineTool(server, deps) {
|
|
|
52656
52662
|
}
|
|
52657
52663
|
|
|
52658
52664
|
// src/mcp/tools/run-tool.ts
|
|
52659
|
-
var RunInputSchema =
|
|
52660
|
-
goal:
|
|
52661
|
-
forceStrategy:
|
|
52665
|
+
var RunInputSchema = z118.object({
|
|
52666
|
+
goal: z118.string().min(1).describe("Natural-language goal. nexus-agents selects how to execute it."),
|
|
52667
|
+
forceStrategy: z118.enum([
|
|
52662
52668
|
"single-shot",
|
|
52663
52669
|
"dev-pipeline",
|
|
52664
52670
|
"pipeline",
|
|
@@ -52670,10 +52676,10 @@ var RunInputSchema = z117.object({
|
|
|
52670
52676
|
]).optional().describe(
|
|
52671
52677
|
"Power-user override: force a specific strategy instead of letting the router choose."
|
|
52672
52678
|
),
|
|
52673
|
-
requiresConsensus:
|
|
52674
|
-
dependencyStructure:
|
|
52675
|
-
isNovel:
|
|
52676
|
-
execute:
|
|
52679
|
+
requiresConsensus: z118.boolean().optional().describe("Hint: the task needs a multi-perspective consensus decision."),
|
|
52680
|
+
dependencyStructure: z118.enum(["linear", "dag", "independent", "unknown"]).optional().describe("Hint: the dependency structure of the work."),
|
|
52681
|
+
isNovel: z118.boolean().optional().describe("Hint: this kind of task has not been seen before."),
|
|
52682
|
+
execute: z118.boolean().optional().describe(
|
|
52677
52683
|
"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)."
|
|
52678
52684
|
),
|
|
52679
52685
|
/**
|
|
@@ -52688,7 +52694,7 @@ var RunInputSchema = z117.object({
|
|
|
52688
52694
|
* other, the call is REFUSED rather than executed: silently ignoring a
|
|
52689
52695
|
* do-not-act flag is the one outcome a governance substrate cannot allow.
|
|
52690
52696
|
*/
|
|
52691
|
-
dryRun:
|
|
52697
|
+
dryRun: z118.boolean().optional().describe(
|
|
52692
52698
|
"Plan and vote only, no implementation (#4806). Requires the dev-pipeline strategy \u2014 refused (never silently executed) when the router selects another."
|
|
52693
52699
|
),
|
|
52694
52700
|
/**
|
|
@@ -52699,7 +52705,7 @@ var RunInputSchema = z117.object({
|
|
|
52699
52705
|
* envelope immediately and runs in the background; poll
|
|
52700
52706
|
* `get_job_result({ jobId })`. Ignored for read-only routing (execute:false).
|
|
52701
52707
|
*/
|
|
52702
|
-
dispatch:
|
|
52708
|
+
dispatch: z118.enum(["sync", "async"]).optional().describe(
|
|
52703
52709
|
"Dispatch mode (#3732). 'sync' (default): run inline. 'async' (only with execute:true): return a jobId immediately + run in background (poll get_job_result)."
|
|
52704
52710
|
)
|
|
52705
52711
|
});
|
|
@@ -52922,12 +52928,12 @@ function registerRunTool(server, deps) {
|
|
|
52922
52928
|
}
|
|
52923
52929
|
|
|
52924
52930
|
// src/mcp/tools/list-available-models-tool.ts
|
|
52925
|
-
import { z as
|
|
52931
|
+
import { z as z119 } from "zod";
|
|
52926
52932
|
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.";
|
|
52927
52933
|
var PROBE_TIMEOUT_MS = 12e3;
|
|
52928
|
-
var ListAvailableModelsInputSchema =
|
|
52929
|
-
includeModelIds:
|
|
52930
|
-
includeOpenRouter:
|
|
52934
|
+
var ListAvailableModelsInputSchema = z119.object({
|
|
52935
|
+
includeModelIds: z119.boolean().optional().describe("Include the full model-id list per transport (default false \u2192 sample of 5 only)."),
|
|
52936
|
+
includeOpenRouter: z119.boolean().optional().describe("Probe the OpenRouter live catalog (default true).")
|
|
52931
52937
|
});
|
|
52932
52938
|
async function probeSource(source, includeModelIds) {
|
|
52933
52939
|
let timer;
|
|
@@ -52994,8 +53000,8 @@ async function listAvailableModelsHandler(args, deps, logger57) {
|
|
|
52994
53000
|
function registerListAvailableModelsTool(server, deps) {
|
|
52995
53001
|
const logger57 = deps.logger ?? createLogger({ tool: "list_available_models" });
|
|
52996
53002
|
const toolSchema = {
|
|
52997
|
-
includeModelIds:
|
|
52998
|
-
includeOpenRouter:
|
|
53003
|
+
includeModelIds: z119.boolean().optional().describe("Include the full model-id list per transport (default false \u2192 sample of 5 only)."),
|
|
53004
|
+
includeOpenRouter: z119.boolean().optional().describe("Probe the OpenRouter live catalog (default true).")
|
|
52999
53005
|
};
|
|
53000
53006
|
const secureHandler = createSecureHandler(
|
|
53001
53007
|
(args) => listAvailableModelsHandler(args, deps, logger57),
|
|
@@ -53019,7 +53025,7 @@ function registerListAvailableModelsTool(server, deps) {
|
|
|
53019
53025
|
}
|
|
53020
53026
|
|
|
53021
53027
|
// src/mcp/tools/pr-review-eval-types.ts
|
|
53022
|
-
import { z as
|
|
53028
|
+
import { z as z120 } from "zod";
|
|
53023
53029
|
var PR_REVIEW_EVAL_ROLES = [
|
|
53024
53030
|
"architect",
|
|
53025
53031
|
"security",
|
|
@@ -53027,43 +53033,43 @@ var PR_REVIEW_EVAL_ROLES = [
|
|
|
53027
53033
|
"catfish",
|
|
53028
53034
|
"scope_steward"
|
|
53029
53035
|
];
|
|
53030
|
-
var PrReviewEvalRoleSchema =
|
|
53031
|
-
var PrReviewCaseClassSchema =
|
|
53032
|
-
var VoterEvalVerdictSchema =
|
|
53036
|
+
var PrReviewEvalRoleSchema = z120.enum(PR_REVIEW_EVAL_ROLES);
|
|
53037
|
+
var PrReviewCaseClassSchema = z120.enum(["buggy", "clean", "borderline"]);
|
|
53038
|
+
var VoterEvalVerdictSchema = z120.object({
|
|
53033
53039
|
/** Stable record id (e.g. `${runId}:${caseNumber}:${role}`). */
|
|
53034
|
-
id:
|
|
53040
|
+
id: z120.string().min(1).max(160),
|
|
53035
53041
|
/** The pr_review run / batch this verdict belongs to. */
|
|
53036
|
-
runId:
|
|
53042
|
+
runId: z120.string().min(1).max(64),
|
|
53037
53043
|
/** Dataset case identifier (the dataset's `number` field). */
|
|
53038
|
-
caseNumber:
|
|
53044
|
+
caseNumber: z120.string().min(1).max(80),
|
|
53039
53045
|
/** Rubric class of the case (ground-truth label). */
|
|
53040
53046
|
caseClass: PrReviewCaseClassSchema,
|
|
53041
53047
|
/** The voter role being scored. */
|
|
53042
53048
|
role: PrReviewEvalRoleSchema,
|
|
53043
53049
|
/** Verified findings that matched a known bug. */
|
|
53044
|
-
truePositives:
|
|
53050
|
+
truePositives: z120.number().int().nonnegative(),
|
|
53045
53051
|
/** Verified findings on clean code that matched no known bug. */
|
|
53046
|
-
falsePositives:
|
|
53052
|
+
falsePositives: z120.number().int().nonnegative(),
|
|
53047
53053
|
/** Known bugs this voter failed to flag. */
|
|
53048
|
-
falseNegatives:
|
|
53054
|
+
falseNegatives: z120.number().int().nonnegative(),
|
|
53049
53055
|
/** Rubric version the ground truth was adjudicated under. */
|
|
53050
|
-
rubricVersion:
|
|
53056
|
+
rubricVersion: z120.string().min(1).max(32),
|
|
53051
53057
|
/** ISO-8601 timestamp the verdict was recorded. */
|
|
53052
|
-
timestamp:
|
|
53058
|
+
timestamp: z120.string().min(1).max(40)
|
|
53053
53059
|
});
|
|
53054
|
-
var VoterEvalVerdictQuerySchema =
|
|
53060
|
+
var VoterEvalVerdictQuerySchema = z120.object({
|
|
53055
53061
|
role: PrReviewEvalRoleSchema.optional(),
|
|
53056
|
-
runId:
|
|
53062
|
+
runId: z120.string().min(1).max(64).optional(),
|
|
53057
53063
|
caseClass: PrReviewCaseClassSchema.optional(),
|
|
53058
|
-
rubricVersion:
|
|
53064
|
+
rubricVersion: z120.string().min(1).max(32).optional(),
|
|
53059
53065
|
/** ISO-8601 lower bound (inclusive) on `timestamp`. */
|
|
53060
|
-
since:
|
|
53066
|
+
since: z120.string().optional(),
|
|
53061
53067
|
/** Most-recent-N cap. */
|
|
53062
|
-
limit:
|
|
53068
|
+
limit: z120.number().int().positive().optional()
|
|
53063
53069
|
});
|
|
53064
53070
|
|
|
53065
53071
|
// src/mcp/tools/supply-chain-tradeoff-panel.ts
|
|
53066
|
-
import { z as
|
|
53072
|
+
import { z as z121 } from "zod";
|
|
53067
53073
|
import { randomUUID as randomUUID18 } from "node:crypto";
|
|
53068
53074
|
var DEFAULT_AXES = [
|
|
53069
53075
|
"build_time_determinism",
|
|
@@ -53085,16 +53091,16 @@ var FULL_PANEL = [
|
|
|
53085
53091
|
"scope_steward"
|
|
53086
53092
|
];
|
|
53087
53093
|
var QUICK_PANEL = ["architect", "security", "scope_steward"];
|
|
53088
|
-
var SupplyChainTradeoffPanelInputSchema =
|
|
53089
|
-
proposal:
|
|
53090
|
-
axes:
|
|
53094
|
+
var SupplyChainTradeoffPanelInputSchema = z121.object({
|
|
53095
|
+
proposal: z121.string().min(1).max(MAX_PROPOSAL_LENGTH).describe('The proposal under tradeoff review (e.g. "Should aegis-boot adopt cargo-nextest?")'),
|
|
53096
|
+
axes: z121.array(z121.string().min(1).max(MAX_AXIS_NAME_LENGTH)).min(1).max(MAX_AXES).optional().describe(
|
|
53091
53097
|
`Tradeoff axes to evaluate. Default: ${DEFAULT_AXES.join(", ")}. Custom axes accepted; max ${String(MAX_AXES)}.`
|
|
53092
53098
|
),
|
|
53093
|
-
context:
|
|
53099
|
+
context: z121.string().max(MAX_CONTEXT_LENGTH).optional().describe(
|
|
53094
53100
|
"Optional context: relevant repo state, dependency tree, vendor publishing patterns, etc."
|
|
53095
53101
|
),
|
|
53096
|
-
quickMode:
|
|
53097
|
-
simulate:
|
|
53102
|
+
quickMode: z121.boolean().optional().default(false).describe("Use 3 voters (architect, security, scope_steward) instead of 7"),
|
|
53103
|
+
simulate: z121.boolean().optional().default(false).describe("Use simulated voters (testing only)"),
|
|
53098
53104
|
// #6123: same field as consensus_vote — the panel judges the caller's project.
|
|
53099
53105
|
project: VoterProjectInputSchema,
|
|
53100
53106
|
/**
|
|
@@ -53104,7 +53110,7 @@ var SupplyChainTradeoffPanelInputSchema = z120.object({
|
|
|
53104
53110
|
* immediately and runs the panel in the background; poll
|
|
53105
53111
|
* `get_job_result({ jobId })` for the result.
|
|
53106
53112
|
*/
|
|
53107
|
-
dispatch:
|
|
53113
|
+
dispatch: z121.enum(["sync", "async"]).default("sync").describe(
|
|
53108
53114
|
"Dispatch mode (#3731). 'sync' (default): run inline. 'async': return a jobId immediately + run the panel in background (poll get_job_result)."
|
|
53109
53115
|
)
|
|
53110
53116
|
});
|
|
@@ -53586,40 +53592,40 @@ var RiskLevel = /* @__PURE__ */ ((RiskLevel2) => {
|
|
|
53586
53592
|
})(RiskLevel || {});
|
|
53587
53593
|
|
|
53588
53594
|
// src/mcp/safety/stpa-schemas.ts
|
|
53589
|
-
import { z as
|
|
53590
|
-
var HazardCategorySchema =
|
|
53591
|
-
var HazardSeveritySchema =
|
|
53592
|
-
var ConstraintPrioritySchema =
|
|
53593
|
-
var RiskLevelSchema =
|
|
53594
|
-
var TriggerPatternSchema =
|
|
53595
|
-
parameter:
|
|
53596
|
-
matchType:
|
|
53597
|
-
pattern:
|
|
53598
|
-
reason:
|
|
53599
|
-
});
|
|
53600
|
-
var HazardSchema =
|
|
53601
|
-
id:
|
|
53602
|
-
description:
|
|
53595
|
+
import { z as z122 } from "zod";
|
|
53596
|
+
var HazardCategorySchema = z122.enum(HazardCategory);
|
|
53597
|
+
var HazardSeveritySchema = z122.enum(HazardSeverity);
|
|
53598
|
+
var ConstraintPrioritySchema = z122.enum(ConstraintPriority);
|
|
53599
|
+
var RiskLevelSchema = z122.enum(RiskLevel);
|
|
53600
|
+
var TriggerPatternSchema = z122.object({
|
|
53601
|
+
parameter: z122.string().min(1),
|
|
53602
|
+
matchType: z122.enum(["contains", "regex", "equals", "startsWith", "endsWith"]),
|
|
53603
|
+
pattern: z122.string(),
|
|
53604
|
+
reason: z122.string()
|
|
53605
|
+
});
|
|
53606
|
+
var HazardSchema = z122.object({
|
|
53607
|
+
id: z122.string().min(1),
|
|
53608
|
+
description: z122.string(),
|
|
53603
53609
|
category: HazardCategorySchema,
|
|
53604
53610
|
severity: HazardSeveritySchema,
|
|
53605
|
-
likelihood:
|
|
53606
|
-
triggerConditions:
|
|
53607
|
-
consequences:
|
|
53608
|
-
});
|
|
53609
|
-
var UnsafeControlActionSchema =
|
|
53610
|
-
id:
|
|
53611
|
-
toolName:
|
|
53612
|
-
type:
|
|
53613
|
-
description:
|
|
53614
|
-
unsafeContext:
|
|
53615
|
-
relatedHazards:
|
|
53616
|
-
triggerPatterns:
|
|
53617
|
-
});
|
|
53618
|
-
var SafetyConstraintSchema =
|
|
53619
|
-
id:
|
|
53620
|
-
description:
|
|
53621
|
-
mitigates:
|
|
53622
|
-
enforcement:
|
|
53611
|
+
likelihood: z122.enum(["almost_certain", "likely", "possible", "unlikely", "rare"]),
|
|
53612
|
+
triggerConditions: z122.array(z122.string()),
|
|
53613
|
+
consequences: z122.array(z122.string())
|
|
53614
|
+
});
|
|
53615
|
+
var UnsafeControlActionSchema = z122.object({
|
|
53616
|
+
id: z122.string().min(1),
|
|
53617
|
+
toolName: z122.string().min(1),
|
|
53618
|
+
type: z122.enum(["not_provided", "provided_causes_hazard", "wrong_timing", "wrong_duration"]),
|
|
53619
|
+
description: z122.string(),
|
|
53620
|
+
unsafeContext: z122.string(),
|
|
53621
|
+
relatedHazards: z122.array(z122.string()),
|
|
53622
|
+
triggerPatterns: z122.array(TriggerPatternSchema).optional()
|
|
53623
|
+
});
|
|
53624
|
+
var SafetyConstraintSchema = z122.object({
|
|
53625
|
+
id: z122.string().min(1),
|
|
53626
|
+
description: z122.string(),
|
|
53627
|
+
mitigates: z122.array(z122.string()),
|
|
53628
|
+
enforcement: z122.enum([
|
|
53623
53629
|
"prevent",
|
|
53624
53630
|
"require_confirmation",
|
|
53625
53631
|
"alert",
|
|
@@ -53627,52 +53633,52 @@ var SafetyConstraintSchema = z121.object({
|
|
|
53627
53633
|
"rate_limit",
|
|
53628
53634
|
"require_privilege"
|
|
53629
53635
|
]),
|
|
53630
|
-
validationFunction:
|
|
53636
|
+
validationFunction: z122.string().optional(),
|
|
53631
53637
|
priority: ConstraintPrioritySchema
|
|
53632
53638
|
});
|
|
53633
|
-
var PropertySchemaSchema =
|
|
53634
|
-
type:
|
|
53635
|
-
description:
|
|
53636
|
-
enum:
|
|
53637
|
-
pattern:
|
|
53638
|
-
minimum:
|
|
53639
|
-
maximum:
|
|
53640
|
-
});
|
|
53641
|
-
var ToolInputSchemaSchema =
|
|
53642
|
-
type:
|
|
53643
|
-
properties:
|
|
53644
|
-
required:
|
|
53645
|
-
additionalProperties:
|
|
53646
|
-
});
|
|
53647
|
-
var ToolDefinitionSchema =
|
|
53648
|
-
name:
|
|
53649
|
-
description:
|
|
53639
|
+
var PropertySchemaSchema = z122.object({
|
|
53640
|
+
type: z122.string(),
|
|
53641
|
+
description: z122.string().optional(),
|
|
53642
|
+
enum: z122.array(z122.unknown()).optional(),
|
|
53643
|
+
pattern: z122.string().optional(),
|
|
53644
|
+
minimum: z122.number().optional(),
|
|
53645
|
+
maximum: z122.number().optional()
|
|
53646
|
+
});
|
|
53647
|
+
var ToolInputSchemaSchema = z122.object({
|
|
53648
|
+
type: z122.string(),
|
|
53649
|
+
properties: z122.record(z122.string(), PropertySchemaSchema).optional(),
|
|
53650
|
+
required: z122.array(z122.string()).optional(),
|
|
53651
|
+
additionalProperties: z122.boolean().optional()
|
|
53652
|
+
});
|
|
53653
|
+
var ToolDefinitionSchema = z122.object({
|
|
53654
|
+
name: z122.string().min(1),
|
|
53655
|
+
description: z122.string(),
|
|
53650
53656
|
inputSchema: ToolInputSchemaSchema
|
|
53651
53657
|
});
|
|
53652
|
-
var AnalysisConfigurationSchema =
|
|
53653
|
-
includeLowSeverity:
|
|
53654
|
-
generateAllConstraints:
|
|
53655
|
-
checkInteractions:
|
|
53656
|
-
maxHazardsPerTool:
|
|
53657
|
-
categories:
|
|
53658
|
+
var AnalysisConfigurationSchema = z122.object({
|
|
53659
|
+
includeLowSeverity: z122.boolean().default(true),
|
|
53660
|
+
generateAllConstraints: z122.boolean().default(true),
|
|
53661
|
+
checkInteractions: z122.boolean().default(true),
|
|
53662
|
+
maxHazardsPerTool: z122.number().int().min(1).max(100).default(50),
|
|
53663
|
+
categories: z122.array(HazardCategorySchema).default([])
|
|
53658
53664
|
});
|
|
53659
|
-
var ConstraintViolationSchema =
|
|
53660
|
-
constraintId:
|
|
53661
|
-
constraintDescription:
|
|
53665
|
+
var ConstraintViolationSchema = z122.object({
|
|
53666
|
+
constraintId: z122.string().min(1),
|
|
53667
|
+
constraintDescription: z122.string(),
|
|
53662
53668
|
severity: HazardSeveritySchema,
|
|
53663
|
-
details:
|
|
53664
|
-
remediation:
|
|
53665
|
-
});
|
|
53666
|
-
var ValidationWarningSchema =
|
|
53667
|
-
code:
|
|
53668
|
-
message:
|
|
53669
|
-
affected:
|
|
53670
|
-
});
|
|
53671
|
-
var ValidationResultSchema =
|
|
53672
|
-
valid:
|
|
53673
|
-
toolName:
|
|
53674
|
-
violations:
|
|
53675
|
-
passed:
|
|
53669
|
+
details: z122.string(),
|
|
53670
|
+
remediation: z122.string()
|
|
53671
|
+
});
|
|
53672
|
+
var ValidationWarningSchema = z122.object({
|
|
53673
|
+
code: z122.string().min(1),
|
|
53674
|
+
message: z122.string(),
|
|
53675
|
+
affected: z122.string()
|
|
53676
|
+
});
|
|
53677
|
+
var ValidationResultSchema = z122.object({
|
|
53678
|
+
valid: z122.boolean(),
|
|
53679
|
+
toolName: z122.string().min(1),
|
|
53680
|
+
violations: z122.array(ConstraintViolationSchema),
|
|
53681
|
+
passed: z122.array(z122.string()),
|
|
53676
53682
|
// Optional rather than required, deliberately. `ValidationResult` declares
|
|
53677
53683
|
// both fields required because every result this package produces has them;
|
|
53678
53684
|
// the schema is the lenient inbound edge for a result that arrived from
|
|
@@ -53683,10 +53689,10 @@ var ValidationResultSchema = z121.object({
|
|
|
53683
53689
|
// "nothing was evaluated". The strict/lenient split is safe because nothing
|
|
53684
53690
|
// bridges the two with `z.infer`: a parsed result will not typecheck as a
|
|
53685
53691
|
// `ValidationResult` without handling the absent fields.
|
|
53686
|
-
evaluated:
|
|
53687
|
-
notApplicable:
|
|
53688
|
-
warnings:
|
|
53689
|
-
validatedAt:
|
|
53692
|
+
evaluated: z122.array(z122.string()).optional(),
|
|
53693
|
+
notApplicable: z122.array(z122.string()).optional(),
|
|
53694
|
+
warnings: z122.array(ValidationWarningSchema),
|
|
53695
|
+
validatedAt: z122.date()
|
|
53690
53696
|
});
|
|
53691
53697
|
|
|
53692
53698
|
// src/mcp/safety/stpa-types.ts
|
|
@@ -54771,9 +54777,9 @@ var GeminiResponseParser = class {
|
|
|
54771
54777
|
};
|
|
54772
54778
|
|
|
54773
54779
|
// src/cli-adapters/router-types.ts
|
|
54774
|
-
import { z as
|
|
54775
|
-
var RouterConfigSchema =
|
|
54776
|
-
preferCostEfficient:
|
|
54780
|
+
import { z as z123 } from "zod";
|
|
54781
|
+
var RouterConfigSchema = z123.object({
|
|
54782
|
+
preferCostEfficient: z123.boolean().default(false),
|
|
54777
54783
|
/**
|
|
54778
54784
|
* @deprecated Declared but NEVER ENFORCED — nothing on the routing path
|
|
54779
54785
|
* compares anything to it, and `composite-router.ts` measures
|
|
@@ -54782,51 +54788,51 @@ var RouterConfigSchema = z122.object({
|
|
|
54782
54788
|
* because of this. Scheduled for removal in the next major (#5963); the
|
|
54783
54789
|
* default is 50 here and in every other declaration since #5918.
|
|
54784
54790
|
*/
|
|
54785
|
-
maxDecisionTimeMs:
|
|
54791
|
+
maxDecisionTimeMs: z123.number().min(1).max(1e3).default(50)
|
|
54786
54792
|
});
|
|
54787
54793
|
|
|
54788
54794
|
// src/cli-adapters/agreement-cascade-types.ts
|
|
54789
|
-
import { z as
|
|
54790
|
-
var AgreementCascadeConfigSchema =
|
|
54791
|
-
agreementThreshold:
|
|
54792
|
-
maxStages:
|
|
54793
|
-
modelTimeoutMs:
|
|
54795
|
+
import { z as z124 } from "zod";
|
|
54796
|
+
var AgreementCascadeConfigSchema = z124.object({
|
|
54797
|
+
agreementThreshold: z124.number().min(0.5).max(1).default(0.7),
|
|
54798
|
+
maxStages: z124.number().int().min(1).max(5).default(3),
|
|
54799
|
+
modelTimeoutMs: z124.number().int().min(1e3).max(3e5).default(6e4)
|
|
54794
54800
|
});
|
|
54795
54801
|
|
|
54796
54802
|
// src/cli-adapters/agreement-cascade-router.ts
|
|
54797
54803
|
var logger50 = createLogger({ component: "agreement-cascade-router" });
|
|
54798
54804
|
|
|
54799
54805
|
// src/cli-adapters/task-classifier.ts
|
|
54800
|
-
import { z as
|
|
54801
|
-
var ClassificationPatternsSchema =
|
|
54802
|
-
code:
|
|
54803
|
-
research:
|
|
54804
|
-
documentation:
|
|
54805
|
-
analysis:
|
|
54806
|
+
import { z as z125 } from "zod";
|
|
54807
|
+
var ClassificationPatternsSchema = z125.object({
|
|
54808
|
+
code: z125.array(z125.string()).readonly(),
|
|
54809
|
+
research: z125.array(z125.string()).readonly(),
|
|
54810
|
+
documentation: z125.array(z125.string()).readonly(),
|
|
54811
|
+
analysis: z125.array(z125.string()).readonly()
|
|
54806
54812
|
});
|
|
54807
54813
|
|
|
54808
54814
|
// src/cli-adapters/response-cache-types.ts
|
|
54809
|
-
import { z as
|
|
54810
|
-
var ResponseCacheConfigSchema =
|
|
54811
|
-
defaultTTL:
|
|
54815
|
+
import { z as z126 } from "zod";
|
|
54816
|
+
var ResponseCacheConfigSchema = z126.object({
|
|
54817
|
+
defaultTTL: z126.number().min(1e3).max(36e5).default(3e5),
|
|
54812
54818
|
// 5 minutes
|
|
54813
|
-
maxEntries:
|
|
54814
|
-
maxMemoryMB:
|
|
54815
|
-
cleanupInterval:
|
|
54819
|
+
maxEntries: z126.number().min(10).max(1e5).default(1e3),
|
|
54820
|
+
maxMemoryMB: z126.number().min(1).max(1e3).default(50),
|
|
54821
|
+
cleanupInterval: z126.number().min(1e3).max(6e5).default(6e4),
|
|
54816
54822
|
// 1 minute
|
|
54817
|
-
enableLogging:
|
|
54823
|
+
enableLogging: z126.boolean().default(false)
|
|
54818
54824
|
});
|
|
54819
54825
|
|
|
54820
54826
|
// src/cli-adapters/response-cache-utils.ts
|
|
54821
54827
|
var logger51 = createLogger({ component: "ResponseCacheUtils" });
|
|
54822
54828
|
|
|
54823
54829
|
// src/cli-adapters/unified-routing-types.ts
|
|
54824
|
-
import { z as
|
|
54825
|
-
var UnifiedRoutingDecisionSchema =
|
|
54826
|
-
selectedCli:
|
|
54827
|
-
confidence:
|
|
54828
|
-
reason:
|
|
54829
|
-
strategy:
|
|
54830
|
+
import { z as z127 } from "zod";
|
|
54831
|
+
var UnifiedRoutingDecisionSchema = z127.object({
|
|
54832
|
+
selectedCli: z127.string(),
|
|
54833
|
+
confidence: z127.number().min(0).max(1),
|
|
54834
|
+
reason: z127.string(),
|
|
54835
|
+
strategy: z127.enum([
|
|
54830
54836
|
"composite",
|
|
54831
54837
|
"quality",
|
|
54832
54838
|
"budget",
|
|
@@ -54838,60 +54844,60 @@ var UnifiedRoutingDecisionSchema = z126.object({
|
|
|
54838
54844
|
"linucb",
|
|
54839
54845
|
"direct"
|
|
54840
54846
|
]),
|
|
54841
|
-
decisionTimeMs:
|
|
54842
|
-
alternatives:
|
|
54843
|
-
stagesExecuted:
|
|
54844
|
-
withinBudget:
|
|
54845
|
-
estimatedComplexity:
|
|
54846
|
-
estimatedTokens:
|
|
54847
|
-
topsisScore:
|
|
54848
|
-
ucbScore:
|
|
54849
|
-
resolvedAtStage:
|
|
54850
|
-
consensusReached:
|
|
54851
|
-
agreementScore:
|
|
54852
|
-
metadata:
|
|
54847
|
+
decisionTimeMs: z127.number().nonnegative(),
|
|
54848
|
+
alternatives: z127.array(z127.string()).readonly(),
|
|
54849
|
+
stagesExecuted: z127.array(z127.string()).readonly(),
|
|
54850
|
+
withinBudget: z127.boolean().optional(),
|
|
54851
|
+
estimatedComplexity: z127.enum(["simple", "moderate", "complex", "expert"]).optional(),
|
|
54852
|
+
estimatedTokens: z127.number().int().positive().optional(),
|
|
54853
|
+
topsisScore: z127.number().optional(),
|
|
54854
|
+
ucbScore: z127.number().optional(),
|
|
54855
|
+
resolvedAtStage: z127.number().int().nonnegative().optional(),
|
|
54856
|
+
consensusReached: z127.boolean().optional(),
|
|
54857
|
+
agreementScore: z127.number().min(0).max(1).optional(),
|
|
54858
|
+
metadata: z127.record(z127.string(), z127.unknown()).optional()
|
|
54853
54859
|
});
|
|
54854
54860
|
|
|
54855
54861
|
// src/learning/outcome-feedback-types.ts
|
|
54856
|
-
import { z as
|
|
54857
|
-
var QualitySignalsSchema =
|
|
54858
|
-
testsPass:
|
|
54859
|
-
lintErrors:
|
|
54860
|
-
userApproved:
|
|
54861
|
-
retryCount:
|
|
54862
|
-
completionRatio:
|
|
54863
|
-
validStructure:
|
|
54864
|
-
coherenceScore:
|
|
54865
|
-
});
|
|
54866
|
-
var RoutingDecisionSchema =
|
|
54867
|
-
id:
|
|
54868
|
-
timestamp:
|
|
54869
|
-
query:
|
|
54870
|
-
routerType:
|
|
54862
|
+
import { z as z128 } from "zod";
|
|
54863
|
+
var QualitySignalsSchema = z128.object({
|
|
54864
|
+
testsPass: z128.boolean().optional(),
|
|
54865
|
+
lintErrors: z128.number().int().min(0).optional(),
|
|
54866
|
+
userApproved: z128.boolean().optional(),
|
|
54867
|
+
retryCount: z128.number().int().min(0).default(0),
|
|
54868
|
+
completionRatio: z128.number().min(0).max(1).default(1),
|
|
54869
|
+
validStructure: z128.boolean().optional(),
|
|
54870
|
+
coherenceScore: z128.number().min(0).max(1).optional()
|
|
54871
|
+
});
|
|
54872
|
+
var RoutingDecisionSchema = z128.object({
|
|
54873
|
+
id: z128.uuid(),
|
|
54874
|
+
timestamp: z128.iso.datetime(),
|
|
54875
|
+
query: z128.string(),
|
|
54876
|
+
routerType: z128.enum(["linucb", "preference", "quality", "cascade", "topsis"]),
|
|
54871
54877
|
// Optional so a row persisted before #5812 still parses. Absence is read as
|
|
54872
54878
|
// unmeasured by `isRouterTypeMeasured`, never as measured.
|
|
54873
|
-
routerTypeMeasured:
|
|
54874
|
-
selectedModel:
|
|
54875
|
-
selectedTier:
|
|
54876
|
-
armIndex:
|
|
54877
|
-
banditContext:
|
|
54878
|
-
queryFeatures:
|
|
54879
|
-
ucbScore:
|
|
54880
|
-
confidence:
|
|
54881
|
-
traceId:
|
|
54882
|
-
domain:
|
|
54883
|
-
});
|
|
54884
|
-
var TaskOutcomeSchema =
|
|
54885
|
-
routingDecisionId:
|
|
54886
|
-
timestamp:
|
|
54887
|
-
outcomeClass:
|
|
54888
|
-
success:
|
|
54889
|
-
qualityScore:
|
|
54890
|
-
durationMs:
|
|
54891
|
-
tokenUsage:
|
|
54892
|
-
errorMessage:
|
|
54879
|
+
routerTypeMeasured: z128.boolean().optional(),
|
|
54880
|
+
selectedModel: z128.string(),
|
|
54881
|
+
selectedTier: z128.enum(["strong", "weak"]).optional(),
|
|
54882
|
+
armIndex: z128.number().int().min(0).optional(),
|
|
54883
|
+
banditContext: z128.record(z128.string(), z128.unknown()).optional(),
|
|
54884
|
+
queryFeatures: z128.record(z128.string(), z128.unknown()).optional(),
|
|
54885
|
+
ucbScore: z128.number().optional(),
|
|
54886
|
+
confidence: z128.number().min(0).max(1).optional(),
|
|
54887
|
+
traceId: z128.string(),
|
|
54888
|
+
domain: z128.string().optional()
|
|
54889
|
+
});
|
|
54890
|
+
var TaskOutcomeSchema = z128.object({
|
|
54891
|
+
routingDecisionId: z128.uuid(),
|
|
54892
|
+
timestamp: z128.iso.datetime(),
|
|
54893
|
+
outcomeClass: z128.enum(["success", "partial", "failure", "timeout", "error"]),
|
|
54894
|
+
success: z128.boolean(),
|
|
54895
|
+
qualityScore: z128.number().min(0).max(1),
|
|
54896
|
+
durationMs: z128.number().min(0),
|
|
54897
|
+
tokenUsage: z128.number().int().min(0),
|
|
54898
|
+
errorMessage: z128.string().optional(),
|
|
54893
54899
|
qualitySignals: QualitySignalsSchema,
|
|
54894
|
-
traceId:
|
|
54900
|
+
traceId: z128.string()
|
|
54895
54901
|
});
|
|
54896
54902
|
var DEFAULT_FEEDBACK_COLLECTOR_CONFIG = {
|
|
54897
54903
|
maxPendingDecisions: 1e3,
|
|
@@ -54906,17 +54912,17 @@ var DEFAULT_FEEDBACK_COLLECTOR_CONFIG = {
|
|
|
54906
54912
|
targetTokenUsage: 2e3,
|
|
54907
54913
|
maxHistorySize: 1e4
|
|
54908
54914
|
};
|
|
54909
|
-
var FeedbackCollectorConfigSchema =
|
|
54910
|
-
maxPendingDecisions:
|
|
54911
|
-
pendingTimeoutMs:
|
|
54912
|
-
enableAutoReward:
|
|
54913
|
-
qualityWeight:
|
|
54914
|
-
speedWeight:
|
|
54915
|
-
efficiencyWeight:
|
|
54916
|
-
retryPenalty:
|
|
54917
|
-
targetDurationMs:
|
|
54918
|
-
targetTokenUsage:
|
|
54919
|
-
maxHistorySize:
|
|
54915
|
+
var FeedbackCollectorConfigSchema = z128.object({
|
|
54916
|
+
maxPendingDecisions: z128.number().int().positive().default(1e3),
|
|
54917
|
+
pendingTimeoutMs: z128.number().positive().default(3e5),
|
|
54918
|
+
enableAutoReward: z128.boolean().default(true),
|
|
54919
|
+
qualityWeight: z128.number().min(0).max(1).default(0.5),
|
|
54920
|
+
speedWeight: z128.number().min(0).max(1).default(0.2),
|
|
54921
|
+
efficiencyWeight: z128.number().min(0).max(1).default(0.2),
|
|
54922
|
+
retryPenalty: z128.number().min(0).max(1).default(0.1),
|
|
54923
|
+
targetDurationMs: z128.number().positive().default(5e3),
|
|
54924
|
+
targetTokenUsage: z128.number().positive().default(2e3),
|
|
54925
|
+
maxHistorySize: z128.number().int().positive().default(1e4)
|
|
54920
54926
|
});
|
|
54921
54927
|
|
|
54922
54928
|
// src/learning/outcome-feedback-helpers.ts
|
|
@@ -57036,4 +57042,4 @@ export {
|
|
|
57036
57042
|
startPipelineEventBridge,
|
|
57037
57043
|
shutdownPipelineEventBridge
|
|
57038
57044
|
};
|
|
57039
|
-
//# sourceMappingURL=chunk-
|
|
57045
|
+
//# sourceMappingURL=chunk-Z4XCDYPE.js.map
|