nexus-agents 8.63.1 → 8.63.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.
@@ -21,7 +21,7 @@ import {
21
21
  import {
22
22
  DEFAULT_TASK_TTL_MS,
23
23
  clampTaskTtl
24
- } from "./chunk-KM2Q6MWR.js";
24
+ } from "./chunk-Y466OQB2.js";
25
25
  import {
26
26
  executeExpert
27
27
  } from "./chunk-3X7U2LTF.js";
@@ -71,7 +71,7 @@ import {
71
71
  updateStage,
72
72
  withWarnings,
73
73
  writeJobCancelled
74
- } from "./chunk-YHJO37S5.js";
74
+ } from "./chunk-BPUYQPXF.js";
75
75
  import {
76
76
  allOf,
77
77
  anyOf
@@ -93,7 +93,7 @@ import {
93
93
  } from "./chunk-PEZRHADK.js";
94
94
  import {
95
95
  withPrerequisite
96
- } from "./chunk-4MYYKOYW.js";
96
+ } from "./chunk-DZPAS2KT.js";
97
97
  import {
98
98
  NOOP_NOTIFIER,
99
99
  RateLimiter,
@@ -116,7 +116,7 @@ import {
116
116
  toolSuccessStructured,
117
117
  withProgressHeartbeat,
118
118
  wrapToolWithTimeout
119
- } from "./chunk-J3WA3SHX.js";
119
+ } from "./chunk-6RTJNYWK.js";
120
120
  import {
121
121
  EventTopics,
122
122
  UNRESOLVED_MODEL_ID,
@@ -27323,10 +27323,10 @@ function calculateDifferenceCI(p1, p2, total1, total2, confidence) {
27323
27323
  const difference = p1 - p2;
27324
27324
  const measured = total1 > 0 && total2 > 0;
27325
27325
  const seDiff = Math.sqrt(p1 * (1 - p1) / (total1 || 1) + p2 * (1 - p2) / (total2 || 1));
27326
- const z127 = getZScore(confidence);
27326
+ const z128 = getZScore(confidence);
27327
27327
  return {
27328
- lower: difference - z127 * seDiff,
27329
- upper: difference + z127 * seDiff,
27328
+ lower: difference - z128 * seDiff,
27329
+ upper: difference + z128 * seDiff,
27330
27330
  estimate: difference,
27331
27331
  confidence,
27332
27332
  n: total1 + total2,
@@ -27354,11 +27354,11 @@ function proportionConfidenceInterval(successes, total, options = {}) {
27354
27354
  measured: false
27355
27355
  };
27356
27356
  }
27357
- const z127 = getZScore(opts.confidence);
27358
- const z210 = z127 * z127;
27357
+ const z128 = getZScore(opts.confidence);
27358
+ const z210 = z128 * z128;
27359
27359
  const denominator = 1 + z210 / n;
27360
27360
  const center = (p + z210 / (2 * n)) / denominator;
27361
- const margin = z127 / denominator * Math.sqrt(p * (1 - p) / n + z210 / (4 * n * n));
27361
+ const margin = z128 / denominator * Math.sqrt(p * (1 - p) / n + z210 / (4 * n * n));
27362
27362
  const lower = Math.max(0, center - margin);
27363
27363
  const upper = Math.min(1, center + margin);
27364
27364
  const standardError = Math.sqrt(p * (1 - p) / n);
@@ -27396,8 +27396,8 @@ function meanConfidenceInterval(values, options = {}) {
27396
27396
  const variance = values.reduce((sum, v) => sum + (v - mean) ** 2, 0) / (n - 1 || 1);
27397
27397
  const stdDev = Math.sqrt(variance);
27398
27398
  const standardError = stdDev / Math.sqrt(n);
27399
- const z127 = getZScore(opts.confidence);
27400
- const margin = z127 * standardError;
27399
+ const z128 = getZScore(opts.confidence);
27400
+ const margin = z128 * standardError;
27401
27401
  return {
27402
27402
  lower: mean - margin,
27403
27403
  upper: mean + margin,
@@ -34523,11 +34523,96 @@ async function maybeRetryAfterTriage(opts) {
34523
34523
  return { ...retryResult, triageAction: triage.action, wasRetried: true };
34524
34524
  }
34525
34525
 
34526
+ // src/orchestration/aorchestra/context-distillation.ts
34527
+ import { z as z63 } from "zod";
34528
+ var PhaseDistillationSchema = z63.object({
34529
+ /** Key decisions made during this phase */
34530
+ decisions: z63.array(z63.string()),
34531
+ /** Artifacts produced (file paths, URLs, IDs) */
34532
+ artifacts: z63.array(z63.string()),
34533
+ /** Important findings or observations */
34534
+ findings: z63.array(z63.string()),
34535
+ /** Errors encountered (if any) */
34536
+ errors: z63.array(z63.string()),
34537
+ /** One-sentence summary of the phase outcome */
34538
+ summary: z63.string()
34539
+ });
34540
+ var DECISION_PATTERNS = [
34541
+ /(?:decided|chosen|selected|using|went with|picked|adopted|approved)\s+(.{10,100})/gi,
34542
+ /(?:will|should|must)\s+(use|implement|create|add|remove|change)\s+(.{10,80})/gi
34543
+ ];
34544
+ var ARTIFACT_PATTERNS = [
34545
+ /(?:created?|wrote|generated|built|saved|output)\s+(?:file|module|component|test|schema)?\s*[`"]?([/\w.-]+\.\w{1,6})[`"]?/gi,
34546
+ /(?:commit|push|deploy|publish)(?:ed|ing)?\s+(.{10,60})/gi
34547
+ ];
34548
+ var ERROR_PATTERNS = [
34549
+ /(?:error|failed|failure|exception|crash|timeout|rejected):\s*(.{10,100})/gi,
34550
+ /(?:could not|unable to|cannot)\s+(.{10,80})/gi
34551
+ ];
34552
+ var FINDING_PATTERNS = [
34553
+ /(?:found|discovered|detected|noticed|identified|observed)\s+(.{10,100})/gi,
34554
+ /(?:vulnerability|issue|bug|problem|concern|risk):\s*(.{10,100})/gi
34555
+ ];
34556
+ function extractMatches(text, patterns, maxItems) {
34557
+ const seen = /* @__PURE__ */ new Set();
34558
+ const results = [];
34559
+ for (const pattern of patterns) {
34560
+ pattern.lastIndex = 0;
34561
+ let match = pattern.exec(text);
34562
+ while (match !== null && results.length < maxItems) {
34563
+ const value = (match[match.length - 1] ?? match[0]).trim();
34564
+ const normalized = value.toLowerCase();
34565
+ if (value.length > 5 && !seen.has(normalized)) {
34566
+ seen.add(normalized);
34567
+ results.push(value);
34568
+ }
34569
+ match = pattern.exec(text);
34570
+ }
34571
+ }
34572
+ return results;
34573
+ }
34574
+ function distillPhaseOutput(phaseOutput, maxItemsPerCategory = 5) {
34575
+ const decisions = extractMatches(phaseOutput, DECISION_PATTERNS, maxItemsPerCategory);
34576
+ const artifacts = extractMatches(phaseOutput, ARTIFACT_PATTERNS, maxItemsPerCategory);
34577
+ const findings = extractMatches(phaseOutput, FINDING_PATTERNS, maxItemsPerCategory);
34578
+ const errors = extractMatches(phaseOutput, ERROR_PATTERNS, maxItemsPerCategory);
34579
+ const firstSentence = phaseOutput.match(/^[^.!?\n]{10,200}[.!?]/);
34580
+ const summary = firstSentence ? firstSentence[0].trim() : phaseOutput.slice(0, 200).trim() + (phaseOutput.length > 200 ? "..." : "");
34581
+ return { decisions, artifacts, findings, errors, summary };
34582
+ }
34583
+ function formatSection(lines, heading, items) {
34584
+ if (items.length === 0) return;
34585
+ lines.push("");
34586
+ lines.push(`### ${heading}`);
34587
+ for (const item of items) {
34588
+ lines.push(`- ${item}`);
34589
+ }
34590
+ }
34591
+ function formatDistillation(distillation, phaseLabel) {
34592
+ const lines = [];
34593
+ const heading = phaseLabel !== void 0 && phaseLabel !== "" ? `## ${phaseLabel} Summary` : "## Prior Phase Summary";
34594
+ lines.push(heading);
34595
+ lines.push("");
34596
+ lines.push(distillation.summary);
34597
+ formatSection(lines, "Decisions", distillation.decisions);
34598
+ formatSection(lines, "Artifacts", distillation.artifacts);
34599
+ formatSection(lines, "Findings", distillation.findings);
34600
+ formatSection(lines, "Errors", distillation.errors);
34601
+ return lines.join("\n");
34602
+ }
34603
+ function compressionRatio(originalLength, distilledLength) {
34604
+ if (originalLength === 0) return 1;
34605
+ return distilledLength / originalLength;
34606
+ }
34607
+
34526
34608
  // src/orchestration/aorchestra/cross-wave-context.ts
34527
34609
  var logger29 = createLogger({ component: "cross-wave-context" });
34528
34610
  var MAX_CHARS_PER_WORKER = 1500;
34529
34611
  var MAX_NAMED_OMITTED_ROLES = 8;
34530
34612
  var MAX_PRIOR_CONTEXT_CHARS = 6e3;
34613
+ var TRUNCATED_MARKER = " [truncated]";
34614
+ var DISTILLATION_SHADOW_LOG_MESSAGE = "Prior-wave distillation shadow (#5974)";
34615
+ var PRIOR_WAVE_HEADER = "## Prior Wave Context\n\nThe following results were produced by prior wave workers. Use this context to inform your work.\n";
34531
34616
  var INJECTION_PATTERNS2 = [
34532
34617
  /<\/?(?:system|human|assistant|instructions)(?:\s[^>]*)?>[\s\S]*?(?:<\/(?:system|human|assistant|instructions)>|$)/gi,
34533
34618
  /<img\b[^>]*>/gi,
@@ -34585,15 +34670,14 @@ function buildPriorWaveContextBlock(results) {
34585
34670
  }
34586
34671
  return "";
34587
34672
  }
34588
- const header = "## Prior Wave Context\n\nThe following results were produced by prior wave workers. Use this context to inform your work.\n";
34589
- let totalChars = header.length;
34673
+ let totalChars = PRIOR_WAVE_HEADER.length;
34590
34674
  const entries = [];
34591
34675
  const omittedRoles = [];
34676
+ const shadowInputs = [];
34592
34677
  for (const result of successResults) {
34593
34678
  const sanitized = sanitizeWorkerOutput(result.output);
34594
- const truncated = sanitized.length > MAX_CHARS_PER_WORKER ? sanitized.slice(0, MAX_CHARS_PER_WORKER) + " [truncated]" : sanitized;
34595
- const entry = `### ${result.role} (${result.status})
34596
- ${truncated}`;
34679
+ shadowInputs.push({ role: result.role, sanitized });
34680
+ const entry = formatEntry(result.role, truncateWorkerOutput(sanitized));
34597
34681
  if (totalChars + entry.length > MAX_PRIOR_CONTEXT_CHARS) {
34598
34682
  omittedRoles.push(result.role);
34599
34683
  continue;
@@ -34601,10 +34685,68 @@ ${truncated}`;
34601
34685
  entries.push(entry);
34602
34686
  totalChars += entry.length;
34603
34687
  }
34688
+ logger29.info(DISTILLATION_SHADOW_LOG_MESSAGE, { ...shadowDistillPriorWave(shadowInputs) });
34604
34689
  if (entries.length === 0) return "";
34605
34690
  const failures = buildFailureSummary(results, MAX_PRIOR_CONTEXT_CHARS - totalChars);
34606
34691
  const omitted = [...omittedRoles, ...failures.omittedRoles];
34607
- return header + "\n" + entries.join("\n\n") + failures.text + buildOmissionNotice(omitted);
34692
+ return PRIOR_WAVE_HEADER + "\n" + entries.join("\n\n") + failures.text + buildOmissionNotice(omitted);
34693
+ }
34694
+ function truncateWorkerOutput(sanitized) {
34695
+ return sanitized.length > MAX_CHARS_PER_WORKER ? sanitized.slice(0, MAX_CHARS_PER_WORKER) + TRUNCATED_MARKER : sanitized;
34696
+ }
34697
+ function formatEntry(role, body) {
34698
+ return `### ${role} (success)
34699
+ ${body}`;
34700
+ }
34701
+ function shadowDistillPriorWave(inputs, budgetChars = MAX_PRIOR_CONTEXT_CHARS) {
34702
+ const workers = inputs.map((input) => measureWorker(input));
34703
+ return {
34704
+ workers,
34705
+ budgetChars,
34706
+ truncationKept: countKeptUnderBudget(workers, (w) => w.truncatedChars, budgetChars),
34707
+ distillationWouldKeep: countKeptUnderBudget(workers, (w) => w.candidateChars, budgetChars),
34708
+ degenerateCount: workers.filter((w) => !w.matchedAnyPattern).length,
34709
+ totalSanitizedChars: workers.reduce((n, w) => n + w.sanitizedChars, 0),
34710
+ totalTruncatedChars: workers.reduce((n, w) => n + w.truncatedChars, 0),
34711
+ totalCandidateChars: workers.reduce((n, w) => n + w.candidateChars, 0)
34712
+ };
34713
+ }
34714
+ function measureWorker(input) {
34715
+ const { role, sanitized } = input;
34716
+ const truncatedChars = truncateWorkerOutput(sanitized).length;
34717
+ const distillation = distillPhaseOutput(sanitized);
34718
+ const distilledChars = formatDistillation(distillation, role).length;
34719
+ const patternHits = {
34720
+ decisions: distillation.decisions.length,
34721
+ artifacts: distillation.artifacts.length,
34722
+ findings: distillation.findings.length,
34723
+ errors: distillation.errors.length
34724
+ };
34725
+ const matchedAnyPattern = patternHits.decisions + patternHits.artifacts + patternHits.findings + patternHits.errors > 0;
34726
+ const fellBackToTruncation = !matchedAnyPattern;
34727
+ return {
34728
+ role,
34729
+ sanitizedChars: sanitized.length,
34730
+ truncatedChars,
34731
+ distilledChars,
34732
+ candidateChars: fellBackToTruncation ? truncatedChars : distilledChars,
34733
+ truncationRatio: compressionRatio(sanitized.length, truncatedChars),
34734
+ distillationRatio: compressionRatio(sanitized.length, distilledChars),
34735
+ patternHits,
34736
+ matchedAnyPattern,
34737
+ fellBackToTruncation
34738
+ };
34739
+ }
34740
+ function countKeptUnderBudget(workers, sizeOf, budgetChars) {
34741
+ let total = PRIOR_WAVE_HEADER.length;
34742
+ let kept = 0;
34743
+ for (const w of workers) {
34744
+ const entryChars = formatEntry(w.role, "").length + sizeOf(w);
34745
+ if (total + entryChars > budgetChars) continue;
34746
+ total += entryChars;
34747
+ kept += 1;
34748
+ }
34749
+ return kept;
34608
34750
  }
34609
34751
  var MAX_ERROR_SNIPPET_CHARS = 100;
34610
34752
  function buildOmissionNotice(omittedRoles) {
@@ -35759,14 +35901,14 @@ function mergeRefinedResults(original, refined) {
35759
35901
  }
35760
35902
 
35761
35903
  // src/mcp/tools/reflective-retriever.ts
35762
- import { z as z63 } from "zod";
35904
+ import { z as z64 } from "zod";
35763
35905
  var REFLECTION_TIMEOUT_MS = REFLECTIVE_TIMEOUTS.reflectionMs;
35764
35906
  var MAX_CACHE_ENTRIES = 50;
35765
35907
  var CACHE_TTL_MS = REFLECTIVE_TIMEOUTS.cacheTtlMs;
35766
35908
  var REFLECTION_MAX_TOKENS = 100;
35767
- var ReflectionCriteriaSchema = z63.object({
35768
- keywords: z63.array(z63.string()).min(1).max(10).describe("Expanded keywords for memory search"),
35769
- context: z63.string().max(200).describe("Brief context about what memories would be useful")
35909
+ var ReflectionCriteriaSchema = z64.object({
35910
+ keywords: z64.array(z64.string()).min(1).max(10).describe("Expanded keywords for memory search"),
35911
+ context: z64.string().max(200).describe("Brief context about what memories would be useful")
35770
35912
  });
35771
35913
  var ReflectionCache = class {
35772
35914
  entries = /* @__PURE__ */ new Map();
@@ -36908,42 +37050,42 @@ function registerOrchestrateTool(server, deps) {
36908
37050
  }
36909
37051
 
36910
37052
  // src/mcp/tools/delegate-to-model-types.ts
36911
- import { z as z64 } from "zod";
37053
+ import { z as z65 } from "zod";
36912
37054
  var MODEL_CAPABILITIES2 = buildCapabilityProfiles();
36913
- var DelegateInputSchema = z64.object({
36914
- task: z64.string().min(1).max(5e4).describe("Task to execute or analyze"),
36915
- preferred_capability: z64.enum(["reasoning", "context", "speed", "code"]).optional().describe("Preferred capability for routing: reasoning, context, speed, or code"),
36916
- model_hint: z64.string().max(100).optional().describe("Explicit model preference (e.g., claude-opus, gemini-pro)"),
37055
+ var DelegateInputSchema = z65.object({
37056
+ task: z65.string().min(1).max(5e4).describe("Task to execute or analyze"),
37057
+ preferred_capability: z65.enum(["reasoning", "context", "speed", "code"]).optional().describe("Preferred capability for routing: reasoning, context, speed, or code"),
37058
+ model_hint: z65.string().max(100).optional().describe("Explicit model preference (e.g., claude-opus, gemini-pro)"),
36917
37059
  // estimate_tokens flag removed (#2723). The field was declared in two schemas
36918
37060
  // (here and in TOOL_SCHEMA below) but never read by any consumer — calling
36919
37061
  // `delegate_to_model { estimate_tokens: true }` returned the full routing
36920
37062
  // decision identical to omitting the flag. The output already carries
36921
37063
  // `estimated_tokens` so the use case the flag advertised is satisfied
36922
37064
  // without the flag.
36923
- billing_mode: z64.enum(["plan", "api"]).optional().describe("Billing mode: plan (monthly subscription, ignore cost) or api (pay-per-token)")
37065
+ billing_mode: z65.enum(["plan", "api"]).optional().describe("Billing mode: plan (monthly subscription, ignore cost) or api (pay-per-token)")
36924
37066
  });
36925
- var DelegateOutputSchema = z64.object({
36926
- recommended_model: z64.string().max(100).describe("The model recommended for this task"),
36927
- reasoning: z64.string().max(2e3).describe("Why this model was selected"),
36928
- capabilities: z64.object({
36929
- reasoning: z64.number(),
36930
- contextWindow: z64.number(),
36931
- codeGeneration: z64.number(),
36932
- speed: z64.number(),
36933
- cost: z64.number()
37067
+ var DelegateOutputSchema = z65.object({
37068
+ recommended_model: z65.string().max(100).describe("The model recommended for this task"),
37069
+ reasoning: z65.string().max(2e3).describe("Why this model was selected"),
37070
+ capabilities: z65.object({
37071
+ reasoning: z65.number(),
37072
+ contextWindow: z65.number(),
37073
+ codeGeneration: z65.number(),
37074
+ speed: z65.number(),
37075
+ cost: z65.number()
36934
37076
  }),
36935
- estimated_tokens: z64.number().describe("Estimated tokens for task"),
36936
- alternatives: z64.array(
36937
- z64.object({
36938
- model: z64.string().max(100),
36939
- score: z64.number(),
36940
- tradeoff: z64.string().max(500)
37077
+ estimated_tokens: z65.number().describe("Estimated tokens for task"),
37078
+ alternatives: z65.array(
37079
+ z65.object({
37080
+ model: z65.string().max(100),
37081
+ score: z65.number(),
37082
+ tradeoff: z65.string().max(500)
36941
37083
  })
36942
37084
  ).max(10).describe("Alternative model options with tradeoffs"),
36943
- governance: z64.object({
36944
- domain: z64.string().max(100).describe("Governance domain (e.g., security, architecture)"),
36945
- votingThreshold: z64.string().max(50).describe("Required voting threshold (e.g., supermajority)"),
36946
- promotionReason: z64.string().max(500).describe("Why governance was promoted")
37085
+ governance: z65.object({
37086
+ domain: z65.string().max(100).describe("Governance domain (e.g., security, architecture)"),
37087
+ votingThreshold: z65.string().max(50).describe("Required voting threshold (e.g., supermajority)"),
37088
+ promotionReason: z65.string().max(500).describe("Why governance was promoted")
36947
37089
  }).optional().describe("Present when task triggers governance promotion")
36948
37090
  });
36949
37091
  var REASONING_KEYWORDS = [
@@ -37020,11 +37162,11 @@ var EXPLORATION_KEYWORDS = [
37020
37162
  "navigate"
37021
37163
  ];
37022
37164
  var TOOL_SCHEMA = {
37023
- task: z64.string().min(1).max(5e4).describe("Task to execute or analyze"),
37024
- preferred_capability: z64.enum(["reasoning", "context", "speed", "code"]).optional().describe("Preferred capability for routing"),
37025
- model_hint: z64.string().max(100).optional().describe("Explicit model preference"),
37165
+ task: z65.string().min(1).max(5e4).describe("Task to execute or analyze"),
37166
+ preferred_capability: z65.enum(["reasoning", "context", "speed", "code"]).optional().describe("Preferred capability for routing"),
37167
+ model_hint: z65.string().max(100).optional().describe("Explicit model preference"),
37026
37168
  // estimate_tokens removed (#2723) — see comment above on DelegateInputSchema.
37027
- billing_mode: z64.enum(["plan", "api"]).optional().describe("Billing mode for cost handling")
37169
+ billing_mode: z65.enum(["plan", "api"]).optional().describe("Billing mode for cost handling")
37028
37170
  };
37029
37171
 
37030
37172
  // src/mcp/tools/delegate-to-model-helpers.ts
@@ -38448,9 +38590,9 @@ function standardReportHandler(state) {
38448
38590
  }
38449
38591
 
38450
38592
  // src/mcp/tools/list-experts.ts
38451
- import { z as z65 } from "zod";
38452
- var ListExpertsInputSchema = z65.object({
38453
- format: z65.enum(["full", "names"]).optional().default("full").describe("Output format: full (with details) or names (just role names)")
38593
+ import { z as z66 } from "zod";
38594
+ var ListExpertsInputSchema = z66.object({
38595
+ format: z66.enum(["full", "names"]).optional().default("full").describe("Output format: full (with details) or names (just role names)")
38454
38596
  });
38455
38597
  var EXPERT_TYPE_TO_ROLE2 = {
38456
38598
  code: "code_expert",
@@ -38521,7 +38663,7 @@ function listExpertsHandler(args, ctx) {
38521
38663
  function registerListExpertsTool(server, deps) {
38522
38664
  const logger57 = deps.logger ?? createLogger({ tool: "list_experts" });
38523
38665
  const toolSchema = {
38524
- format: z65.enum(["full", "names"]).optional().describe("Output format: full (with details) or names (just role names)")
38666
+ format: z66.enum(["full", "names"]).optional().describe("Output format: full (with details) or names (just role names)")
38525
38667
  };
38526
38668
  const description = "Inventory of expert ROLES available to `create_expert` (architect, security, devex, etc.). Use this BEFORE create_expert to pick a role; returns role name and capability summary.";
38527
38669
  const secureHandler = createSecureHandler(listExpertsHandler, {
@@ -38532,15 +38674,15 @@ function registerListExpertsTool(server, deps) {
38532
38674
  const timeoutMs = getToolTimeout("list_experts", deps.security);
38533
38675
  const wrappedHandler = wrapToolWithTimeout("list_experts", secureHandler, { timeoutMs, logger: logger57 });
38534
38676
  const outputSchema = {
38535
- experts: z65.array(
38536
- z65.object({
38537
- role: z65.string(),
38538
- name: z65.string(),
38539
- description: z65.string(),
38540
- capabilities: z65.array(z65.string())
38677
+ experts: z66.array(
38678
+ z66.object({
38679
+ role: z66.string(),
38680
+ name: z66.string(),
38681
+ description: z66.string(),
38682
+ capabilities: z66.array(z66.string())
38541
38683
  })
38542
38684
  ),
38543
- count: z65.number()
38685
+ count: z66.number()
38544
38686
  };
38545
38687
  server.registerTool(
38546
38688
  "list_experts",
@@ -38556,10 +38698,10 @@ function registerListExpertsTool(server, deps) {
38556
38698
  }
38557
38699
 
38558
38700
  // src/mcp/tools/list-workflows.ts
38559
- import { z as z66 } from "zod";
38560
- var ListWorkflowsInputSchema = z66.object({
38561
- category: z66.string().optional().describe("Filter by category (e.g., development, security)"),
38562
- format: z66.enum(["full", "names"]).optional().default("full").describe("Output format: full (with details) or names (just template names)")
38701
+ import { z as z67 } from "zod";
38702
+ var ListWorkflowsInputSchema = z67.object({
38703
+ category: z67.string().optional().describe("Filter by category (e.g., development, security)"),
38704
+ format: z67.enum(["full", "names"]).optional().default("full").describe("Output format: full (with details) or names (just template names)")
38563
38705
  });
38564
38706
  async function handleListWorkflows(workflowEngine, args) {
38565
38707
  const templates = await workflowEngine.listTemplates();
@@ -38613,8 +38755,8 @@ function createListWorkflowsHandler(workflowEngine) {
38613
38755
  function registerListWorkflowsTool(server, deps) {
38614
38756
  const logger57 = deps.logger ?? createLogger({ tool: "list_workflows" });
38615
38757
  const toolSchema = {
38616
- category: z66.string().optional().describe("Filter by category (e.g., development, security)"),
38617
- format: z66.enum(["full", "names"]).optional().describe("Output format: full (with details) or names (just template names)")
38758
+ category: z67.string().optional().describe("Filter by category (e.g., development, security)"),
38759
+ format: z67.enum(["full", "names"]).optional().describe("Output format: full (with details) or names (just template names)")
38618
38760
  };
38619
38761
  const description = "Inventory of multi-step TEMPLATES available to `run_workflow` (code-review, security-audit, etc.). Use this BEFORE run_workflow to pick a template; returns template name, version, description, and category.";
38620
38762
  const secureHandler = createSecureHandler(createListWorkflowsHandler(deps.workflowEngine), {
@@ -38629,16 +38771,16 @@ function registerListWorkflowsTool(server, deps) {
38629
38771
  timeoutMs !== void 0 ? { timeoutMs, logger: logger57 } : { logger: logger57 }
38630
38772
  );
38631
38773
  const outputSchema = {
38632
- workflows: z66.array(
38633
- z66.object({
38634
- name: z66.string(),
38635
- version: z66.string(),
38636
- description: z66.string().optional(),
38637
- category: z66.string().optional()
38774
+ workflows: z67.array(
38775
+ z67.object({
38776
+ name: z67.string(),
38777
+ version: z67.string(),
38778
+ description: z67.string().optional(),
38779
+ category: z67.string().optional()
38638
38780
  })
38639
38781
  ),
38640
- count: z66.number(),
38641
- categories: z66.array(z66.string()).optional()
38782
+ count: z67.number(),
38783
+ categories: z67.array(z67.string()).optional()
38642
38784
  };
38643
38785
  server.registerTool(
38644
38786
  "list_workflows",
@@ -38654,7 +38796,7 @@ function registerListWorkflowsTool(server, deps) {
38654
38796
  }
38655
38797
 
38656
38798
  // src/mcp/tools/execute-expert.ts
38657
- import { z as z68 } from "zod";
38799
+ import { z as z69 } from "zod";
38658
38800
 
38659
38801
  // src/mcp/tools/execute-expert-recording.ts
38660
38802
  var ROLE_TO_CATEGORY = {
@@ -38849,12 +38991,12 @@ function observeExpertContext(observation, logger57, threshold = resolveContextW
38849
38991
  }
38850
38992
 
38851
38993
  // src/mcp/tools/execute-expert-task-handler.ts
38852
- import { z as z67 } from "zod";
38994
+ import { z as z68 } from "zod";
38853
38995
  var EXECUTE_EXPERT_TOOL_SCHEMA = {
38854
- expertId: z67.string().min(1).describe("Expert ID from create_expert tool"),
38855
- task: z67.string().min(1).max(5e4).describe("Task description for the expert to execute"),
38856
- context: z67.record(z67.string(), z67.unknown()).optional().describe("Additional context metadata for the task"),
38857
- timeoutMs: z67.number().int().min(EXPERT_TIMEOUTS.executeFloorMs).max(EXPERT_TIMEOUTS.maxMs).optional().describe("Optional timeout in ms (120s-900s). Overrides auto-detected timeout.")
38996
+ expertId: z68.string().min(1).describe("Expert ID from create_expert tool"),
38997
+ task: z68.string().min(1).max(5e4).describe("Task description for the expert to execute"),
38998
+ context: z68.record(z68.string(), z68.unknown()).optional().describe("Additional context metadata for the task"),
38999
+ timeoutMs: z68.number().int().min(EXPERT_TIMEOUTS.executeFloorMs).max(EXPERT_TIMEOUTS.maxMs).optional().describe("Optional timeout in ms (120s-900s). Overrides auto-detected timeout.")
38858
39000
  };
38859
39001
  function createTaskHandler(deps, logger57, executor) {
38860
39002
  const notifier = deps.notifier ?? NOOP_NOTIFIER;
@@ -38949,12 +39091,12 @@ async function runBackgroundExpertTask(opts) {
38949
39091
 
38950
39092
  // src/mcp/tools/execute-expert.ts
38951
39093
  var EXPERT_TIMEOUT_FLOOR_MS = EXPERT_TIMEOUTS.executeFloorMs;
38952
- var ExecuteExpertInputSchema = z68.object({
38953
- expertId: z68.string().min(1).describe("Expert ID from create_expert tool"),
38954
- task: z68.string().min(1).max(5e4).describe("Task description for the expert to execute"),
38955
- context: z68.record(z68.string(), z68.unknown()).optional().describe("Additional context metadata for the task"),
38956
- timeoutMs: z68.number().int().min(EXPERT_TIMEOUT_FLOOR_MS).max(EXPERT_TIMEOUTS.maxMs).optional().describe("Optional timeout in ms (120s-900s). Overrides auto-detected timeout."),
38957
- previousExpertSummary: z68.string().max(2e3).optional().describe(
39094
+ var ExecuteExpertInputSchema = z69.object({
39095
+ expertId: z69.string().min(1).describe("Expert ID from create_expert tool"),
39096
+ task: z69.string().min(1).max(5e4).describe("Task description for the expert to execute"),
39097
+ context: z69.record(z69.string(), z69.unknown()).optional().describe("Additional context metadata for the task"),
39098
+ 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."),
39099
+ previousExpertSummary: z69.string().max(2e3).optional().describe(
38958
39100
  "Summary from a previous expert in the chain. Injected into prompt for context continuity."
38959
39101
  )
38960
39102
  });
@@ -39288,25 +39430,25 @@ function registerExecuteExpertTool(server, deps) {
39288
39430
  }
39289
39431
 
39290
39432
  // src/mcp/tools/research-query.ts
39291
- import { z as z70 } from "zod";
39433
+ import { z as z71 } from "zod";
39292
39434
  import { join as join6 } from "node:path";
39293
39435
 
39294
39436
  // src/research/negative-results.ts
39295
39437
  import { readFileSync as readFileSync5 } from "node:fs";
39296
39438
  import { join as join5 } from "node:path";
39297
39439
  import yaml3 from "yaml";
39298
- import { z as z69 } from "zod";
39440
+ import { z as z70 } from "zod";
39299
39441
  var logger33 = createLogger({ component: "negative-results" });
39300
- var NegativeResultSchema = z69.object({
39301
- name: z69.string(),
39302
- paper: z69.string(),
39303
- rejection_date: z69.string(),
39304
- failure_mode: z69.string(),
39305
- lessons_learned: z69.array(z69.string()),
39306
- reopen_conditions: z69.array(z69.string())
39442
+ var NegativeResultSchema = z70.object({
39443
+ name: z70.string(),
39444
+ paper: z70.string(),
39445
+ rejection_date: z70.string(),
39446
+ failure_mode: z70.string(),
39447
+ lessons_learned: z70.array(z70.string()),
39448
+ reopen_conditions: z70.array(z70.string())
39307
39449
  });
39308
- var NegativeResultsRegistrySchema = z69.object({
39309
- negative_results: z69.record(z69.string(), NegativeResultSchema)
39450
+ var NegativeResultsRegistrySchema = z70.object({
39451
+ negative_results: z70.record(z70.string(), NegativeResultSchema)
39310
39452
  });
39311
39453
  var NEGATIVE_RESULTS_FILE = "negative-results.yaml";
39312
39454
  function negativeResultsPath() {
@@ -39360,23 +39502,23 @@ function formatRejectionWarning(id, result) {
39360
39502
  }
39361
39503
 
39362
39504
  // src/mcp/tools/research-query.ts
39363
- var ResearchQueryInputSchema = z70.object({
39364
- action: z70.enum(["status", "overlap", "stats", "search"]).describe(
39505
+ var ResearchQueryInputSchema = z71.object({
39506
+ action: z71.enum(["status", "overlap", "stats", "search"]).describe(
39365
39507
  "Query action: status (technique status), overlap (find related techniques), stats (registry statistics), search (text search)"
39366
39508
  ),
39367
- techniqueId: z70.string().optional().describe("Technique ID for status/overlap queries"),
39368
- query: z70.string().optional().describe("Search query string for search action"),
39369
- status: z70.enum(["implemented", "planned", "not-started", "rejected", "all"]).optional().default("all").describe("Filter by technique status (for status action)"),
39370
- threshold: z70.number().min(0).max(1).optional().default(0.3).describe("Overlap threshold (0-1) for overlap action")
39509
+ techniqueId: z71.string().optional().describe("Technique ID for status/overlap queries"),
39510
+ query: z71.string().optional().describe("Search query string for search action"),
39511
+ status: z71.enum(["implemented", "planned", "not-started", "rejected", "all"]).optional().default("all").describe("Filter by technique status (for status action)"),
39512
+ threshold: z71.number().min(0).max(1).optional().default(0.3).describe("Overlap threshold (0-1) for overlap action")
39371
39513
  });
39372
39514
  var ResearchQueryOutputSchema = {
39373
- action: z70.string(),
39374
- success: z70.boolean(),
39375
- data: z70.unknown(),
39376
- rejectionNotice: z70.string().optional(),
39377
- negativeResults: z70.object({
39378
- status: z70.literal("unavailable"),
39379
- reason: z70.string()
39515
+ action: z71.string(),
39516
+ success: z71.boolean(),
39517
+ data: z71.unknown(),
39518
+ rejectionNotice: z71.string().optional(),
39519
+ negativeResults: z71.object({
39520
+ status: z71.literal("unavailable"),
39521
+ reason: z71.string()
39380
39522
  }).optional()
39381
39523
  };
39382
39524
  function rejectionMetadataFor(techniqueId) {
@@ -39514,11 +39656,11 @@ function createResearchQueryHandler(deps) {
39514
39656
  function registerResearchQueryTool(server, deps) {
39515
39657
  const logger57 = deps.logger ?? createLogger({ tool: "research_query" });
39516
39658
  const toolSchema = {
39517
- action: z70.enum(["status", "overlap", "stats", "search"]).describe("Query action: status, overlap, stats, or search"),
39518
- techniqueId: z70.string().optional().describe("Technique ID for status/overlap queries"),
39519
- query: z70.string().optional().describe("Search query string for search action"),
39520
- status: z70.enum(["implemented", "planned", "not-started", "rejected", "all"]).optional().describe("Filter by technique status"),
39521
- threshold: z70.number().min(0).max(1).optional().describe("Overlap threshold (0-1) for overlap action")
39659
+ action: z71.enum(["status", "overlap", "stats", "search"]).describe("Query action: status, overlap, stats, or search"),
39660
+ techniqueId: z71.string().optional().describe("Technique ID for status/overlap queries"),
39661
+ query: z71.string().optional().describe("Search query string for search action"),
39662
+ status: z71.enum(["implemented", "planned", "not-started", "rejected", "all"]).optional().describe("Filter by technique status"),
39663
+ threshold: z71.number().min(0).max(1).optional().describe("Overlap threshold (0-1) for overlap action")
39522
39664
  };
39523
39665
  const description = "Query the research registry for technique status, overlaps, statistics, or text search. Provides read-only access to the research tracking system.";
39524
39666
  const secureHandler = createSecureHandler(createResearchQueryHandler(deps), {
@@ -39545,12 +39687,12 @@ function registerResearchQueryTool(server, deps) {
39545
39687
  }
39546
39688
 
39547
39689
  // src/mcp/tools/research-add.ts
39548
- import { z as z71 } from "zod";
39549
- var ResearchAddInputSchema = z71.object({
39550
- arxivId: z71.string().regex(/^\d{4}\.\d{4,5}$/, "Invalid arXiv ID format (expected XXXX.XXXXX)").describe('arXiv paper ID (e.g., "2401.12345")'),
39551
- topic: z71.string().optional().describe("Research topic to categorize the paper under"),
39552
- priority: z71.enum(["P1", "P2", "P3", "P4"]).optional().describe("Priority level for the paper"),
39553
- dryRun: z71.boolean().optional().default(false).describe("Preview what would be added without persisting")
39690
+ import { z as z72 } from "zod";
39691
+ var ResearchAddInputSchema = z72.object({
39692
+ arxivId: z72.string().regex(/^\d{4}\.\d{4,5}$/, "Invalid arXiv ID format (expected XXXX.XXXXX)").describe('arXiv paper ID (e.g., "2401.12345")'),
39693
+ topic: z72.string().optional().describe("Research topic to categorize the paper under"),
39694
+ priority: z72.enum(["P1", "P2", "P3", "P4"]).optional().describe("Priority level for the paper"),
39695
+ dryRun: z72.boolean().optional().default(false).describe("Preview what would be added without persisting")
39554
39696
  });
39555
39697
  async function executeResearchAdd(input, logger57) {
39556
39698
  const exists = await paperExists(input.arxivId);
@@ -39618,10 +39760,10 @@ function createResearchAddHandler(deps) {
39618
39760
  function registerResearchAddTool(server, deps) {
39619
39761
  const logger57 = deps.logger ?? createLogger({ tool: "research_add" });
39620
39762
  const toolSchema = {
39621
- arxivId: z71.string().regex(/^\d{4}\.\d{4,5}$/).describe('arXiv paper ID (e.g., "2401.12345")'),
39622
- topic: z71.string().optional().describe("Research topic to categorize the paper under"),
39623
- priority: z71.enum(["P1", "P2", "P3", "P4"]).optional().describe("Priority level"),
39624
- dryRun: z71.boolean().optional().default(false).describe("Preview without persisting")
39763
+ arxivId: z72.string().regex(/^\d{4}\.\d{4,5}$/).describe('arXiv paper ID (e.g., "2401.12345")'),
39764
+ topic: z72.string().optional().describe("Research topic to categorize the paper under"),
39765
+ priority: z72.enum(["P1", "P2", "P3", "P4"]).optional().describe("Priority level"),
39766
+ dryRun: z72.boolean().optional().default(false).describe("Preview without persisting")
39625
39767
  };
39626
39768
  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.";
39627
39769
  const secureHandler = createSecureHandler(createResearchAddHandler(deps), {
@@ -39635,11 +39777,11 @@ function registerResearchAddTool(server, deps) {
39635
39777
  logger: logger57
39636
39778
  });
39637
39779
  const outputSchema = {
39638
- success: z71.boolean(),
39639
- paperId: z71.string().optional(),
39640
- title: z71.string().optional(),
39641
- message: z71.string(),
39642
- dryRun: z71.boolean().optional()
39780
+ success: z72.boolean(),
39781
+ paperId: z72.string().optional(),
39782
+ title: z72.string().optional(),
39783
+ message: z72.string(),
39784
+ dryRun: z72.boolean().optional()
39643
39785
  };
39644
39786
  server.registerTool(
39645
39787
  "research_add",
@@ -39655,33 +39797,33 @@ function registerResearchAddTool(server, deps) {
39655
39797
  }
39656
39798
 
39657
39799
  // src/mcp/tools/research-add-source.ts
39658
- import { z as z72 } from "zod";
39659
- var SourceTypeEnum = z72.enum([
39800
+ import { z as z73 } from "zod";
39801
+ var SourceTypeEnum = z73.enum([
39660
39802
  "product_docs",
39661
39803
  "specification",
39662
39804
  "research_blog",
39663
39805
  "code_analysis",
39664
39806
  "open_source_repo"
39665
39807
  ]);
39666
- var VerdictEnum = z72.enum(["adopted", "partially_adopted", "rejected", "monitoring", "planned"]);
39667
- var ResearchAddSourceInputSchema = z72.object({
39668
- url: z72.string().min(1).max(500).describe("Source URL (GitHub repo, docs page, blog post)"),
39669
- name: z72.string().min(1).max(200).describe("Display name for the source"),
39808
+ var VerdictEnum = z73.enum(["adopted", "partially_adopted", "rejected", "monitoring", "planned"]);
39809
+ var ResearchAddSourceInputSchema = z73.object({
39810
+ url: z73.string().min(1).max(500).describe("Source URL (GitHub repo, docs page, blog post)"),
39811
+ name: z73.string().min(1).max(200).describe("Display name for the source"),
39670
39812
  type: SourceTypeEnum.describe("Source type classification"),
39671
- vendor: z72.string().max(100).optional().describe("Vendor or organization"),
39672
- topics: z72.array(z72.string().max(50)).max(5).optional().describe("Research topics (max 5)"),
39673
- tags: z72.array(z72.string().max(50)).max(10).optional().describe("Searchable tags (max 10)"),
39674
- quality_signals: z72.object({
39675
- stars_at_review: z72.number().nonnegative().optional(),
39676
- language: z72.string().max(50).optional(),
39677
- has_tests: z72.boolean().optional(),
39678
- has_docs: z72.boolean().optional(),
39679
- has_paper: z72.boolean().optional()
39813
+ vendor: z73.string().max(100).optional().describe("Vendor or organization"),
39814
+ topics: z73.array(z73.string().max(50)).max(5).optional().describe("Research topics (max 5)"),
39815
+ tags: z73.array(z73.string().max(50)).max(10).optional().describe("Searchable tags (max 10)"),
39816
+ quality_signals: z73.object({
39817
+ stars_at_review: z73.number().nonnegative().optional(),
39818
+ language: z73.string().max(50).optional(),
39819
+ has_tests: z73.boolean().optional(),
39820
+ has_docs: z73.boolean().optional(),
39821
+ has_paper: z73.boolean().optional()
39680
39822
  }).optional().describe("Quality signals used to compute quality_score; provide explicitly \u2014 no GitHub metadata is fetched"),
39681
- techniques_extracted: z72.array(z72.string().max(100)).max(5).optional().describe("Techniques identified in this source (max 5)"),
39823
+ techniques_extracted: z73.array(z73.string().max(100)).max(5).optional().describe("Techniques identified in this source (max 5)"),
39682
39824
  verdict: VerdictEnum.optional().describe("Adoption verdict"),
39683
- verdict_notes: z72.string().max(500).optional().describe("Notes explaining the verdict"),
39684
- dryRun: z72.boolean().optional().default(false).describe("Preview without persisting")
39825
+ verdict_notes: z73.string().max(500).optional().describe("Notes explaining the verdict"),
39826
+ dryRun: z73.boolean().optional().default(false).describe("Preview without persisting")
39685
39827
  });
39686
39828
  function generateSourceId(url) {
39687
39829
  const match = /github\.com\/([^/]+)\/([^/]+)/.exec(url);
@@ -39821,23 +39963,23 @@ function createResearchAddSourceHandler(deps) {
39821
39963
  function registerResearchAddSourceTool(server, deps) {
39822
39964
  const logger57 = deps.logger ?? createLogger({ tool: "research_add_source" });
39823
39965
  const toolSchema = {
39824
- url: z72.string().min(1).describe("Source URL"),
39825
- name: z72.string().min(1).describe("Display name"),
39966
+ url: z73.string().min(1).describe("Source URL"),
39967
+ name: z73.string().min(1).describe("Display name"),
39826
39968
  type: SourceTypeEnum.describe("Source type"),
39827
- vendor: z72.string().optional().describe("Vendor"),
39828
- topics: z72.array(z72.string()).max(5).optional().describe("Topics"),
39829
- tags: z72.array(z72.string()).max(10).optional().describe("Tags"),
39830
- quality_signals: z72.object({
39831
- stars_at_review: z72.number().optional(),
39832
- language: z72.string().optional(),
39833
- has_tests: z72.boolean().optional(),
39834
- has_docs: z72.boolean().optional(),
39835
- has_paper: z72.boolean().optional()
39969
+ vendor: z73.string().optional().describe("Vendor"),
39970
+ topics: z73.array(z73.string()).max(5).optional().describe("Topics"),
39971
+ tags: z73.array(z73.string()).max(10).optional().describe("Tags"),
39972
+ quality_signals: z73.object({
39973
+ stars_at_review: z73.number().optional(),
39974
+ language: z73.string().optional(),
39975
+ has_tests: z73.boolean().optional(),
39976
+ has_docs: z73.boolean().optional(),
39977
+ has_paper: z73.boolean().optional()
39836
39978
  }).optional().describe("Quality signals"),
39837
- techniques_extracted: z72.array(z72.string()).max(5).optional().describe("Techniques"),
39979
+ techniques_extracted: z73.array(z73.string()).max(5).optional().describe("Techniques"),
39838
39980
  verdict: VerdictEnum.optional().describe("Adoption verdict"),
39839
- verdict_notes: z72.string().max(500).optional().describe("Verdict notes"),
39840
- dryRun: z72.boolean().optional().default(false).describe("Preview only")
39981
+ verdict_notes: z73.string().max(500).optional().describe("Verdict notes"),
39982
+ dryRun: z73.boolean().optional().default(false).describe("Preview only")
39841
39983
  };
39842
39984
  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.";
39843
39985
  const secureHandler = createSecureHandler(createResearchAddSourceHandler(deps), {
@@ -39863,22 +40005,22 @@ function registerResearchAddSourceTool(server, deps) {
39863
40005
  );
39864
40006
  }
39865
40007
  var RESEARCH_ADD_SOURCE_OUTPUT_SCHEMA = {
39866
- success: z72.boolean(),
39867
- sourceId: z72.string().optional(),
39868
- name: z72.string().optional(),
39869
- quality_score: z72.number().optional(),
39870
- evidence_tier: z72.string().optional(),
39871
- message: z72.string().optional(),
39872
- dryRun: z72.boolean().optional()
40008
+ success: z73.boolean(),
40009
+ sourceId: z73.string().optional(),
40010
+ name: z73.string().optional(),
40011
+ quality_score: z73.number().optional(),
40012
+ evidence_tier: z73.string().optional(),
40013
+ message: z73.string().optional(),
40014
+ dryRun: z73.boolean().optional()
39873
40015
  };
39874
40016
 
39875
40017
  // src/mcp/tools/research-discover.ts
39876
- import { z as z73 } from "zod";
40018
+ import { z as z74 } from "zod";
39877
40019
  var MAX_RESULTS_PER_SOURCE = 20;
39878
40020
  var DEFAULT_RELEVANCE_THRESHOLD = 0.3;
39879
- var ResearchDiscoverInputSchema = z73.object({
39880
- topic: z73.string().min(1).max(200).describe('Research topic to search for (e.g., "multi-agent orchestration")'),
39881
- source: z73.enum([
40021
+ var ResearchDiscoverInputSchema = z74.object({
40022
+ topic: z74.string().min(1).max(200).describe('Research topic to search for (e.g., "multi-agent orchestration")'),
40023
+ source: z74.enum([
39882
40024
  "arxiv",
39883
40025
  "github",
39884
40026
  "google_ai",
@@ -39892,9 +40034,9 @@ var ResearchDiscoverInputSchema = z73.object({
39892
40034
  ]).optional().default("all").describe(
39893
40035
  "Source to search: arxiv, github, google_ai, meta_fair, microsoft, deepmind, semantic_scholar, papers_with_code, openalex, or all"
39894
40036
  ),
39895
- maxResults: z73.number().min(1).max(MAX_RESULTS_PER_SOURCE).optional().default(10).describe("Maximum results to return"),
39896
- sinceDate: z73.string().optional().describe("Only return results after this date (YYYY-MM-DD format)"),
39897
- relevanceThreshold: z73.number().min(0).max(1).optional().default(DEFAULT_RELEVANCE_THRESHOLD).describe(
40037
+ maxResults: z74.number().min(1).max(MAX_RESULTS_PER_SOURCE).optional().default(10).describe("Maximum results to return"),
40038
+ sinceDate: z74.string().optional().describe("Only return results after this date (YYYY-MM-DD format)"),
40039
+ relevanceThreshold: z74.number().min(0).max(1).optional().default(DEFAULT_RELEVANCE_THRESHOLD).describe(
39898
40040
  "Minimum relevance score (0-1) to include in results. Higher values filter more aggressively."
39899
40041
  )
39900
40042
  });
@@ -40169,8 +40311,8 @@ function createResearchDiscoverHandler(deps) {
40169
40311
  function registerResearchDiscoverTool(server, deps) {
40170
40312
  const logger57 = deps.logger ?? createLogger({ tool: "research_discover" });
40171
40313
  const toolSchema = {
40172
- topic: z73.string().min(1).max(200).describe("Research topic to search for"),
40173
- source: z73.enum([
40314
+ topic: z74.string().min(1).max(200).describe("Research topic to search for"),
40315
+ source: z74.enum([
40174
40316
  "arxiv",
40175
40317
  "github",
40176
40318
  "google_ai",
@@ -40182,9 +40324,9 @@ function registerResearchDiscoverTool(server, deps) {
40182
40324
  "openalex",
40183
40325
  "all"
40184
40326
  ]).optional().describe("Source to search"),
40185
- maxResults: z73.number().min(1).max(MAX_RESULTS_PER_SOURCE).optional().describe("Max results"),
40186
- sinceDate: z73.string().optional().describe("Only results after this date (YYYY-MM-DD)"),
40187
- relevanceThreshold: z73.number().min(0).max(1).optional().describe("Minimum relevance score (0-1) to include results. Higher = stricter filtering.")
40327
+ maxResults: z74.number().min(1).max(MAX_RESULTS_PER_SOURCE).optional().describe("Max results"),
40328
+ sinceDate: z74.string().optional().describe("Only results after this date (YYYY-MM-DD)"),
40329
+ relevanceThreshold: z74.number().min(0).max(1).optional().describe("Minimum relevance score (0-1) to include results. Higher = stricter filtering.")
40188
40330
  };
40189
40331
  const description = "Discover new research papers and repositories from external sources. Searches arXiv, GitHub, and other sources. Filters out items already in the registry.";
40190
40332
  const secureHandler = createSecureHandler(createResearchDiscoverHandler(deps), {
@@ -40210,24 +40352,24 @@ function registerResearchDiscoverTool(server, deps) {
40210
40352
  logger57.info("Registered research_discover tool with secure handler and timeout protection");
40211
40353
  }
40212
40354
  var RESEARCH_DISCOVER_OUTPUT_SCHEMA = {
40213
- topic: z73.string().optional(),
40214
- sourcesQueried: z73.array(z73.string()).optional(),
40215
- failedSources: z73.array(z73.string()).optional(),
40216
- items: z73.array(z73.unknown()).optional(),
40217
- totalFound: z73.number().optional(),
40218
- alreadyInRegistry: z73.number().optional(),
40219
- registryConsulted: z73.boolean().optional(),
40220
- newItems: z73.number().optional(),
40221
- filteredByRelevance: z73.number().optional()
40355
+ topic: z74.string().optional(),
40356
+ sourcesQueried: z74.array(z74.string()).optional(),
40357
+ failedSources: z74.array(z74.string()).optional(),
40358
+ items: z74.array(z74.unknown()).optional(),
40359
+ totalFound: z74.number().optional(),
40360
+ alreadyInRegistry: z74.number().optional(),
40361
+ registryConsulted: z74.boolean().optional(),
40362
+ newItems: z74.number().optional(),
40363
+ filteredByRelevance: z74.number().optional()
40222
40364
  };
40223
40365
 
40224
40366
  // src/mcp/tools/research-analyze.ts
40225
- import { z as z74 } from "zod";
40226
- var ResearchAnalyzeInputSchema = z74.object({
40227
- focus: z74.enum(["gaps", "trends", "priorities", "stale", "coverage"]).describe(
40367
+ import { z as z75 } from "zod";
40368
+ var ResearchAnalyzeInputSchema = z75.object({
40369
+ focus: z75.enum(["gaps", "trends", "priorities", "stale", "coverage"]).describe(
40228
40370
  "Analysis focus: gaps (missing coverage), trends (topic distribution), priorities (P1/P2 backlog), stale (outdated entries), coverage (implementation status)"
40229
40371
  ),
40230
- topic: z74.string().optional().describe("Optional topic filter to narrow analysis")
40372
+ topic: z75.string().optional().describe("Optional topic filter to narrow analysis")
40231
40373
  });
40232
40374
  function failureResponse(focus, registry = "techniques") {
40233
40375
  return {
@@ -40473,8 +40615,8 @@ function createResearchAnalyzeHandler(deps) {
40473
40615
  function registerResearchAnalyzeTool(server, deps) {
40474
40616
  const logger57 = deps.logger ?? createLogger({ tool: "research_analyze" });
40475
40617
  const toolSchema = {
40476
- focus: z74.enum(["gaps", "trends", "priorities", "stale", "coverage"]).describe("Analysis focus area"),
40477
- topic: z74.string().optional().describe("Optional topic filter")
40618
+ focus: z75.enum(["gaps", "trends", "priorities", "stale", "coverage"]).describe("Analysis focus area"),
40619
+ topic: z75.string().optional().describe("Optional topic filter")
40478
40620
  };
40479
40621
  const description = "Analyze the research registry for gaps, trends, priorities, stale entries, or coverage. Returns structured analysis with recommendations.";
40480
40622
  const secureHandler = createSecureHandler(createResearchAnalyzeHandler(deps), {
@@ -40488,10 +40630,10 @@ function registerResearchAnalyzeTool(server, deps) {
40488
40630
  logger: logger57
40489
40631
  });
40490
40632
  const outputSchema = {
40491
- focus: z74.string().optional(),
40492
- success: z74.boolean().optional(),
40493
- analysis: z74.unknown().optional(),
40494
- recommendations: z74.array(z74.string()).optional()
40633
+ focus: z75.string().optional(),
40634
+ success: z75.boolean().optional(),
40635
+ analysis: z75.unknown().optional(),
40636
+ recommendations: z75.array(z75.string()).optional()
40495
40637
  };
40496
40638
  server.registerTool(
40497
40639
  "research_analyze",
@@ -40507,14 +40649,14 @@ function registerResearchAnalyzeTool(server, deps) {
40507
40649
  }
40508
40650
 
40509
40651
  // src/mcp/tools/research-catalog-review.ts
40510
- import { z as z75 } from "zod";
40511
- var ResearchCatalogReviewInputSchema = z75.object({
40512
- action: z75.enum(["list", "approve", "dismiss", "flush"]).describe(
40652
+ import { z as z76 } from "zod";
40653
+ var ResearchCatalogReviewInputSchema = z76.object({
40654
+ action: z76.enum(["list", "approve", "dismiss", "flush"]).describe(
40513
40655
  "Action: list (show pending), approve (add to registry), dismiss (remove), flush (clear all)"
40514
40656
  ),
40515
- identifier: z75.string().optional().describe("Reference identifier for approve/dismiss actions (arXiv ID or GitHub URL)"),
40516
- topic: z75.string().optional().describe("Topic to assign when approving an arXiv paper"),
40517
- createIssue: z75.boolean().optional().default(false).describe("When approving, also create a GitHub issue for the paper")
40657
+ identifier: z76.string().optional().describe("Reference identifier for approve/dismiss actions (arXiv ID or GitHub URL)"),
40658
+ topic: z76.string().optional().describe("Topic to assign when approving an arXiv paper"),
40659
+ createIssue: z76.boolean().optional().default(false).describe("When approving, also create a GitHub issue for the paper")
40518
40660
  });
40519
40661
  function handleList() {
40520
40662
  const catalog = getAutoCatalog();
@@ -40646,10 +40788,10 @@ function createCatalogReviewHandler(deps) {
40646
40788
  function registerResearchCatalogReviewTool(server, deps) {
40647
40789
  const logger57 = deps.logger ?? createLogger({ tool: "research_catalog_review" });
40648
40790
  const toolSchema = {
40649
- action: z75.enum(["list", "approve", "dismiss", "flush"]).describe("Action to perform on cataloged references"),
40650
- identifier: z75.string().optional().describe("Reference identifier for approve/dismiss"),
40651
- topic: z75.string().optional().describe("Topic for approved papers"),
40652
- createIssue: z75.boolean().optional().describe("Create GitHub issue when approving")
40791
+ action: z76.enum(["list", "approve", "dismiss", "flush"]).describe("Action to perform on cataloged references"),
40792
+ identifier: z76.string().optional().describe("Reference identifier for approve/dismiss"),
40793
+ topic: z76.string().optional().describe("Topic for approved papers"),
40794
+ createIssue: z76.boolean().optional().describe("Create GitHub issue when approving")
40653
40795
  };
40654
40796
  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.";
40655
40797
  const secureHandler = createSecureHandler(createCatalogReviewHandler(deps), {
@@ -40663,10 +40805,10 @@ function registerResearchCatalogReviewTool(server, deps) {
40663
40805
  logger: logger57
40664
40806
  });
40665
40807
  const outputSchema = {
40666
- action: z75.string().optional(),
40667
- success: z75.boolean().optional(),
40668
- message: z75.string().optional(),
40669
- data: z75.unknown().optional()
40808
+ action: z76.string().optional(),
40809
+ success: z76.boolean().optional(),
40810
+ message: z76.string().optional(),
40811
+ data: z76.unknown().optional()
40670
40812
  };
40671
40813
  server.registerTool(
40672
40814
  "research_catalog_review",
@@ -40682,9 +40824,9 @@ function registerResearchCatalogReviewTool(server, deps) {
40682
40824
  }
40683
40825
 
40684
40826
  // src/mcp/tools/research-synthesize.ts
40685
- import { z as z76 } from "zod";
40686
- var ResearchSynthesizeInputSchema = z76.object({
40687
- topic: z76.string().optional().describe("Optional topic to filter synthesis to a single cluster")
40827
+ import { z as z77 } from "zod";
40828
+ var ResearchSynthesizeInputSchema = z77.object({
40829
+ topic: z77.string().optional().describe("Optional topic to filter synthesis to a single cluster")
40688
40830
  });
40689
40831
  function createResearchSynthesizeHandler(deps) {
40690
40832
  return async (args, _ctx) => {
@@ -40711,7 +40853,7 @@ function createResearchSynthesizeHandler(deps) {
40711
40853
  function registerResearchSynthesizeTool(server, deps) {
40712
40854
  const logger57 = deps.logger ?? createLogger({ tool: "research_synthesize" });
40713
40855
  const toolSchema = {
40714
- topic: z76.string().optional().describe("Optional topic filter for single-cluster synthesis")
40856
+ topic: z77.string().optional().describe("Optional topic filter for single-cluster synthesis")
40715
40857
  };
40716
40858
  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.";
40717
40859
  const secureHandler = createSecureHandler(createResearchSynthesizeHandler(deps), {
@@ -40725,12 +40867,12 @@ function registerResearchSynthesizeTool(server, deps) {
40725
40867
  logger: logger57
40726
40868
  });
40727
40869
  const outputSchema = {
40728
- clusters: z76.array(z76.unknown()).optional(),
40729
- totalPapers: z76.number().optional(),
40730
- topicCount: z76.number().optional(),
40731
- crossCuttingThemes: z76.array(z76.unknown()).optional(),
40732
- alignmentSummary: z76.unknown().optional(),
40733
- featureGates: z76.array(z76.unknown()).optional()
40870
+ clusters: z77.array(z77.unknown()).optional(),
40871
+ totalPapers: z77.number().optional(),
40872
+ topicCount: z77.number().optional(),
40873
+ crossCuttingThemes: z77.array(z77.unknown()).optional(),
40874
+ alignmentSummary: z77.unknown().optional(),
40875
+ featureGates: z77.array(z77.unknown()).optional()
40734
40876
  };
40735
40877
  server.registerTool(
40736
40878
  "research_synthesize",
@@ -40746,10 +40888,10 @@ function registerResearchSynthesizeTool(server, deps) {
40746
40888
  }
40747
40889
 
40748
40890
  // src/mcp/tools/issue-triage-tool.ts
40749
- import { z as z77 } from "zod";
40750
- var IssueTriageInputSchema = z77.object({
40751
- issueUrl: z77.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)"),
40752
- dryRun: z77.boolean().optional().default(true).describe("Read-only mode (default: true). When false, may apply labels.")
40891
+ import { z as z78 } from "zod";
40892
+ var IssueTriageInputSchema = z78.object({
40893
+ issueUrl: z78.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)"),
40894
+ dryRun: z78.boolean().optional().default(true).describe("Read-only mode (default: true). When false, may apply labels.")
40753
40895
  });
40754
40896
  function buildTriageResponse(value) {
40755
40897
  return {
@@ -40804,8 +40946,8 @@ function createIssueTriageHandler(_deps) {
40804
40946
  function registerIssueTriageTool(server, deps) {
40805
40947
  const logger57 = deps.logger ?? createLogger({ tool: "issue_triage" });
40806
40948
  const toolSchema = {
40807
- issueUrl: z77.string().min(1).describe("GitHub issue URL (e.g., https://github.com/owner/repo/issues/123)"),
40808
- dryRun: z77.boolean().optional().default(true).describe("Read-only mode (default: true)")
40949
+ issueUrl: z78.string().min(1).describe("GitHub issue URL (e.g., https://github.com/owner/repo/issues/123)"),
40950
+ dryRun: z78.boolean().optional().default(true).describe("Read-only mode (default: true)")
40809
40951
  };
40810
40952
  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.";
40811
40953
  const secureHandler = createSecureHandler(createIssueTriageHandler(deps), {
@@ -40884,7 +41026,7 @@ function recordTriageOutcome(success, durationMs, errorMsg) {
40884
41026
  }
40885
41027
 
40886
41028
  // src/mcp/tools/run-graph-workflow.ts
40887
- import { z as z78 } from "zod";
41029
+ import { z as z79 } from "zod";
40888
41030
  import { randomUUID as randomUUID11 } from "node:crypto";
40889
41031
 
40890
41032
  // src/mcp/tools/run-graph-workflow-events.ts
@@ -40936,11 +41078,11 @@ function formatDetail(event) {
40936
41078
  }
40937
41079
 
40938
41080
  // src/mcp/tools/run-graph-workflow.ts
40939
- var RunGraphWorkflowInputSchema = z78.object({
40940
- workflow: z78.string().min(1).max(100).describe("Name of the predefined graph workflow to execute"),
40941
- inputs: z78.record(z78.string(), z78.unknown()).optional().default({}).describe("Input values for the workflow"),
40942
- enableCheckpointing: z78.boolean().optional().default(true).describe("Enable checkpoint saving between steps"),
40943
- enableAuditTrail: z78.boolean().optional().default(false).describe("Enable audit trail event logging"),
41081
+ var RunGraphWorkflowInputSchema = z79.object({
41082
+ workflow: z79.string().min(1).max(100).describe("Name of the predefined graph workflow to execute"),
41083
+ inputs: z79.record(z79.string(), z79.unknown()).optional().default({}).describe("Input values for the workflow"),
41084
+ enableCheckpointing: z79.boolean().optional().default(true).describe("Enable checkpoint saving between steps"),
41085
+ enableAuditTrail: z79.boolean().optional().default(false).describe("Enable audit trail event logging"),
40944
41086
  /**
40945
41087
  * Dispatch mode (#3732). `sync` (default) runs the graph workflow inline and
40946
41088
  * returns the result — but a workflow of up to ~100 expert nodes can exceed
@@ -41038,12 +41180,12 @@ async function handleRunGraphWorkflow(input, logger57, auditLogger, signal) {
41038
41180
  }
41039
41181
  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.";
41040
41182
  var GRAPH_WORKFLOW_SCHEMA = {
41041
- workflow: z78.string().min(1).max(100).describe(
41183
+ workflow: z79.string().min(1).max(100).describe(
41042
41184
  'Workflow name: echo, pipeline, code-review, security-scan. Use "list" for available workflows.'
41043
41185
  ),
41044
- inputs: z78.record(z78.string(), z78.unknown()).optional().describe("Input values for the workflow"),
41045
- enableCheckpointing: z78.boolean().optional().describe("Enable checkpoint saving"),
41046
- enableAuditTrail: z78.boolean().optional().describe("Enable audit trail logging"),
41186
+ inputs: z79.record(z79.string(), z79.unknown()).optional().describe("Input values for the workflow"),
41187
+ enableCheckpointing: z79.boolean().optional().describe("Enable checkpoint saving"),
41188
+ enableAuditTrail: z79.boolean().optional().describe("Enable audit trail logging"),
41047
41189
  // #4968: the same fragment the internal schema composes — the advertised
41048
41190
  // shape is what the SDK parses, so the wrong-key trap must be here too.
41049
41191
  ...asyncDispatchInput("Ignored for the `list` sentinel.")
@@ -41651,11 +41793,11 @@ function suggestImprovement(criterion) {
41651
41793
  }
41652
41794
 
41653
41795
  // src/mcp/tools/execute-spec-tool.ts
41654
- import { z as z79 } from "zod";
41796
+ import { z as z80 } from "zod";
41655
41797
  import { randomUUID as randomUUID12 } from "node:crypto";
41656
- var ExecuteSpecInputSchema = z79.object({
41657
- spec: z79.string().min(1).max(5e4).describe("Markdown specification to execute"),
41658
- dryRun: z79.boolean().optional().default(false).describe("Parse and decompose only"),
41798
+ var ExecuteSpecInputSchema = z80.object({
41799
+ spec: z80.string().min(1).max(5e4).describe("Markdown specification to execute"),
41800
+ dryRun: z80.boolean().optional().default(false).describe("Parse and decompose only"),
41659
41801
  /**
41660
41802
  * Dispatch mode (#3732). `sync` (default) runs the full DAG pipeline inline
41661
41803
  * and returns the result — but a real parse→decompose→compile→execute→
@@ -41767,10 +41909,10 @@ function registerExecuteSpecTool(server, deps) {
41767
41909
  const timeoutMs = getToolTimeout("execute_spec", deps.security);
41768
41910
  const wrapped = wrapToolWithTimeout("execute_spec", secureHandler, { timeoutMs, logger: logger57 });
41769
41911
  const toolSchema = {
41770
- spec: z79.string().min(1).max(5e4).describe(
41912
+ spec: z80.string().min(1).max(5e4).describe(
41771
41913
  'Markdown specification to execute. Must contain "## Requirements" and "## Acceptance Criteria" sections.'
41772
41914
  ),
41773
- dryRun: z79.boolean().optional().describe("Parse and decompose only (no execution)"),
41915
+ dryRun: z80.boolean().optional().describe("Parse and decompose only (no execution)"),
41774
41916
  // #4968: the same fragment the internal schema composes — the advertised
41775
41917
  // shape is what the SDK parses, so the wrong-key trap must be here too.
41776
41918
  ...asyncDispatchInput("Ignored for dryRun.")
@@ -41841,11 +41983,11 @@ function recordSpecOutcome(success, durationMs, stage) {
41841
41983
  }
41842
41984
 
41843
41985
  // src/mcp/tools/memory-query.ts
41844
- import { z as z80 } from "zod";
41845
- var MemoryQueryInputSchema = z80.object({
41846
- query: z80.string().min(1).max(500).describe("Search query to match against memory contents"),
41847
- limit: z80.number().int().min(1).max(50).optional().default(10).describe("Maximum results to return (default: 10, max: 50)"),
41848
- source: z80.enum(["session", "belief", "agentic", "typed", "adaptive", "all"]).optional().default("all").describe("Filter by memory source (default: all)")
41986
+ import { z as z81 } from "zod";
41987
+ var MemoryQueryInputSchema = z81.object({
41988
+ query: z81.string().min(1).max(500).describe("Search query to match against memory contents"),
41989
+ limit: z81.number().int().min(1).max(50).optional().default(10).describe("Maximum results to return (default: 10, max: 50)"),
41990
+ source: z81.enum(["session", "belief", "agentic", "typed", "adaptive", "all"]).optional().default("all").describe("Filter by memory source (default: all)")
41849
41991
  });
41850
41992
  function describeBackendCoverage(memory, source) {
41851
41993
  const optional = [
@@ -41952,9 +42094,9 @@ async function memoryQueryHandler(args, ctx) {
41952
42094
  function registerMemoryQueryTool(server, deps) {
41953
42095
  const logger57 = deps.logger ?? createLogger({ tool: "memory_query" });
41954
42096
  const toolSchema = {
41955
- query: z80.string().min(1).max(500).describe("Search query to match against memory contents"),
41956
- limit: z80.number().int().min(1).max(50).optional().describe("Maximum results to return (default: 10, max: 50)"),
41957
- source: z80.enum(["session", "belief", "agentic", "typed", "adaptive", "all"]).optional().describe("Filter by memory source (default: all)")
42097
+ query: z81.string().min(1).max(500).describe("Search query to match against memory contents"),
42098
+ limit: z81.number().int().min(1).max(50).optional().describe("Maximum results to return (default: 10, max: 50)"),
42099
+ source: z81.enum(["session", "belief", "agentic", "typed", "adaptive", "all"]).optional().describe("Filter by memory source (default: all)")
41958
42100
  };
41959
42101
  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.";
41960
42102
  const secureHandler = createSecureHandler(memoryQueryHandler, {
@@ -41965,19 +42107,19 @@ function registerMemoryQueryTool(server, deps) {
41965
42107
  const timeoutMs = getToolTimeout("memory_query", deps.security);
41966
42108
  const wrappedHandler = wrapToolWithTimeout("memory_query", secureHandler, { timeoutMs, logger: logger57 });
41967
42109
  const outputSchema = {
41968
- query: z80.string(),
41969
- expandedQuery: z80.string().optional(),
41970
- results: z80.array(z80.unknown()),
41971
- count: z80.number(),
41972
- source: z80.string(),
42110
+ query: z81.string(),
42111
+ expandedQuery: z81.string().optional(),
42112
+ results: z81.array(z81.unknown()),
42113
+ count: z81.number(),
42114
+ source: z81.string(),
41973
42115
  // #4999: the SDK validates structured content against this schema with
41974
42116
  // `additionalProperties: false`, so a field added to the response and not
41975
42117
  // declared here makes EVERY call fail with -32602 rather than merely going
41976
42118
  // unreported. The integration test caught that; the unit tests could not,
41977
42119
  // because they call the handler directly and never cross the protocol.
41978
- searched: z80.array(z80.string()),
41979
- unavailable: z80.array(z80.string()),
41980
- errored: z80.array(z80.string())
42120
+ searched: z81.array(z81.string()),
42121
+ unavailable: z81.array(z81.string()),
42122
+ errored: z81.array(z81.string())
41981
42123
  };
41982
42124
  server.registerTool(
41983
42125
  "memory_query",
@@ -41993,9 +42135,9 @@ function registerMemoryQueryTool(server, deps) {
41993
42135
  }
41994
42136
 
41995
42137
  // src/mcp/tools/memory-stats.ts
41996
- import { z as z81 } from "zod";
41997
- var MemoryStatsInputSchema = z81.object({
41998
- includeDecay: z81.boolean().optional().default(true).describe("Include decay statistics (default: true)")
42138
+ import { z as z82 } from "zod";
42139
+ var MemoryStatsInputSchema = z82.object({
42140
+ includeDecay: z82.boolean().optional().default(true).describe("Include decay statistics (default: true)")
41999
42141
  });
42000
42142
  function collectSessionStats(toolMemory) {
42001
42143
  const counts = toolMemory.getSessionCounts();
@@ -42112,7 +42254,7 @@ async function memoryStatsHandler(args, ctx) {
42112
42254
  function registerMemoryStatsTool(server, deps) {
42113
42255
  const logger57 = deps.logger ?? createLogger({ tool: "memory_stats" });
42114
42256
  const toolSchema = {
42115
- includeDecay: z81.boolean().optional().describe("Include decay statistics (default: true)")
42257
+ includeDecay: z82.boolean().optional().describe("Include decay statistics (default: true)")
42116
42258
  };
42117
42259
  const description = "Get memory system statistics dashboard. Shows backend availability, entry counts, and decay stats across all 7 memory backends.";
42118
42260
  const secureHandler = createSecureHandler(memoryStatsHandler, {
@@ -42123,14 +42265,14 @@ function registerMemoryStatsTool(server, deps) {
42123
42265
  const timeoutMs = getToolTimeout("memory_stats", deps.security);
42124
42266
  const wrappedHandler = wrapToolWithTimeout("memory_stats", secureHandler, { timeoutMs, logger: logger57 });
42125
42267
  const outputSchema = {
42126
- backends: z81.unknown(),
42127
- session: z81.unknown().optional(),
42128
- belief: z81.unknown().optional(),
42129
- typed: z81.unknown().optional(),
42130
- mobimem: z81.unknown().optional(),
42131
- decay: z81.unknown().optional(),
42132
- registry: z81.array(z81.unknown()).optional(),
42133
- collectedAt: z81.string().optional()
42268
+ backends: z82.unknown(),
42269
+ session: z82.unknown().optional(),
42270
+ belief: z82.unknown().optional(),
42271
+ typed: z82.unknown().optional(),
42272
+ mobimem: z82.unknown().optional(),
42273
+ decay: z82.unknown().optional(),
42274
+ registry: z82.array(z82.unknown()).optional(),
42275
+ collectedAt: z82.string().optional()
42134
42276
  };
42135
42277
  server.registerTool(
42136
42278
  "memory_stats",
@@ -42146,15 +42288,15 @@ function registerMemoryStatsTool(server, deps) {
42146
42288
  }
42147
42289
 
42148
42290
  // src/mcp/tools/memory-write.ts
42149
- import { z as z82 } from "zod";
42150
- var MemoryWriteInputSchema = z82.object({
42151
- key: z82.string().min(1).max(200).describe("Memory identifier or subject"),
42152
- content: z82.string().min(1).max(5e3).describe("Memory content to store"),
42153
- backend: z82.enum(["session", "belief", "agentic", "adaptive", "typed"]).describe(
42291
+ import { z as z83 } from "zod";
42292
+ var MemoryWriteInputSchema = z83.object({
42293
+ key: z83.string().min(1).max(200).describe("Memory identifier or subject"),
42294
+ content: z83.string().min(1).max(5e3).describe("Memory content to store"),
42295
+ backend: z83.enum(["session", "belief", "agentic", "adaptive", "typed"]).describe(
42154
42296
  "Target memory backend: session (learnings), belief (triples), agentic (knowledge), adaptive (priority-scored), typed (MIRIX-style semantic)"
42155
42297
  ),
42156
- confidence: z82.enum(["high", "medium", "low"]).optional().default("medium").describe("Confidence level (default: medium)"),
42157
- metadata: z82.record(z82.string().max(100), z82.string().max(500)).optional().describe("Optional key-value metadata tags")
42298
+ confidence: z83.enum(["high", "medium", "low"]).optional().default("medium").describe("Confidence level (default: medium)"),
42299
+ metadata: z83.record(z83.string().max(100), z83.string().max(500)).optional().describe("Optional key-value metadata tags")
42158
42300
  });
42159
42301
  function writeToSession(key, content, confidence) {
42160
42302
  const toolMemory = getToolMemory();
@@ -42307,13 +42449,13 @@ async function memoryWriteHandler(args, ctx) {
42307
42449
  function registerMemoryWriteTool(server, deps) {
42308
42450
  const logger57 = deps.logger ?? createLogger({ tool: "memory_write" });
42309
42451
  const toolSchema = {
42310
- key: z82.string().min(1).max(200).describe("Memory identifier or subject"),
42311
- content: z82.string().min(1).max(5e3).describe("Memory content to store"),
42312
- backend: z82.enum(["session", "belief", "agentic", "adaptive", "typed"]).describe(
42452
+ key: z83.string().min(1).max(200).describe("Memory identifier or subject"),
42453
+ content: z83.string().min(1).max(5e3).describe("Memory content to store"),
42454
+ backend: z83.enum(["session", "belief", "agentic", "adaptive", "typed"]).describe(
42313
42455
  "Target memory backend: session (learnings), belief (triples), agentic (knowledge), adaptive (priority-scored), typed (MIRIX-style semantic)"
42314
42456
  ),
42315
- confidence: z82.enum(["high", "medium", "low"]).optional().describe("Confidence level (default: medium)"),
42316
- metadata: z82.record(z82.string().max(100), z82.string().max(500)).optional().describe("Optional key-value metadata tags")
42457
+ confidence: z83.enum(["high", "medium", "low"]).optional().describe("Confidence level (default: medium)"),
42458
+ metadata: z83.record(z83.string().max(100), z83.string().max(500)).optional().describe("Optional key-value metadata tags")
42317
42459
  };
42318
42460
  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.";
42319
42461
  const secureHandler = createSecureHandler(memoryWriteHandler, {
@@ -42325,11 +42467,11 @@ function registerMemoryWriteTool(server, deps) {
42325
42467
  const timeoutMs = getToolTimeout("memory_write", deps.security);
42326
42468
  const wrappedHandler = wrapToolWithTimeout("memory_write", guardedHandler, { timeoutMs, logger: logger57 });
42327
42469
  const outputSchema = {
42328
- success: z82.boolean(),
42329
- backend: z82.string(),
42330
- key: z82.string(),
42331
- deduplicated: z82.boolean().optional(),
42332
- error: z82.string().optional()
42470
+ success: z83.boolean(),
42471
+ backend: z83.string(),
42472
+ key: z83.string(),
42473
+ deduplicated: z83.boolean().optional(),
42474
+ error: z83.string().optional()
42333
42475
  };
42334
42476
  server.registerTool(
42335
42477
  "memory_write",
@@ -42345,7 +42487,7 @@ function registerMemoryWriteTool(server, deps) {
42345
42487
  }
42346
42488
 
42347
42489
  // src/mcp/tools/weather-report-tool.ts
42348
- import { z as z83 } from "zod";
42490
+ import { z as z84 } from "zod";
42349
42491
  function serializeReport(report) {
42350
42492
  return {
42351
42493
  ...report,
@@ -42396,8 +42538,8 @@ function weatherReportHandler(args, ctx) {
42396
42538
  function registerWeatherReportTool(server, deps) {
42397
42539
  const logger57 = deps.logger ?? createLogger({ tool: "weather_report" });
42398
42540
  const toolSchema = {
42399
- cli: z83.enum(["claude", "gemini", "codex", "opencode"]).optional().describe("Filter by CLI"),
42400
- category: z83.enum([
42541
+ cli: z84.enum(["claude", "gemini", "codex", "opencode"]).optional().describe("Filter by CLI"),
42542
+ category: z84.enum([
42401
42543
  "architecture",
42402
42544
  "code_generation",
42403
42545
  "code_review",
@@ -42409,7 +42551,7 @@ function registerWeatherReportTool(server, deps) {
42409
42551
  "devops",
42410
42552
  "exploration"
42411
42553
  ]).optional().describe("Filter by task category"),
42412
- includeAdaptive: z83.boolean().optional().describe("Include adaptive routing bonuses (default: true)")
42554
+ includeAdaptive: z84.boolean().optional().describe("Include adaptive routing bonuses (default: true)")
42413
42555
  };
42414
42556
  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.";
42415
42557
  const secureHandler = createSecureHandler(weatherReportHandler, {
@@ -42431,18 +42573,18 @@ function registerWeatherReportTool(server, deps) {
42431
42573
  }
42432
42574
 
42433
42575
  // src/mcp/tools/registry-import-types.ts
42434
- import { z as z84 } from "zod";
42435
- var RegistryImportInputSchema = z84.object({
42576
+ import { z as z85 } from "zod";
42577
+ var RegistryImportInputSchema = z85.object({
42436
42578
  /** Model provider. */
42437
- provider: z84.enum(["anthropic", "google", "openai"]).describe("Model provider (anthropic, google, openai)"),
42579
+ provider: z85.enum(["anthropic", "google", "openai"]).describe("Model provider (anthropic, google, openai)"),
42438
42580
  /** Model identifier from the provider (e.g., "claude-4-opus-20260201"). */
42439
- modelId: z84.string().min(1).describe("Provider model identifier"),
42581
+ modelId: z85.string().min(1).describe("Provider model identifier"),
42440
42582
  /** No-op flag echoed back in the response; the tool never persists regardless. */
42441
- dryRun: z84.boolean().optional().default(true).describe("No-op flag echoed back in the response; the tool never persists regardless")
42583
+ dryRun: z85.boolean().optional().default(true).describe("No-op flag echoed back in the response; the tool never persists regardless")
42442
42584
  });
42443
42585
 
42444
42586
  // src/mcp/tools/registry-import-tool.ts
42445
- import { z as z85 } from "zod";
42587
+ import { z as z86 } from "zod";
42446
42588
 
42447
42589
  // src/mcp/tools/registry-import.ts
42448
42590
  var PROVIDER_CLI_MAP = {
@@ -42552,9 +42694,9 @@ function registryImportHandler(args, ctx) {
42552
42694
  function registerRegistryImportTool(server, deps) {
42553
42695
  const logger57 = deps.logger ?? createLogger({ tool: "registry_import" });
42554
42696
  const toolSchema = {
42555
- provider: z85.enum(["anthropic", "google", "openai"]).describe("Model provider (anthropic, google, openai)"),
42556
- modelId: z85.string().min(1).describe("Provider model identifier"),
42557
- dryRun: z85.boolean().optional().describe("No-op flag echoed back in the response; the tool never persists regardless")
42697
+ provider: z86.enum(["anthropic", "google", "openai"]).describe("Model provider (anthropic, google, openai)"),
42698
+ modelId: z86.string().min(1).describe("Provider model identifier"),
42699
+ dryRun: z86.boolean().optional().describe("No-op flag echoed back in the response; the tool never persists regardless")
42558
42700
  };
42559
42701
  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`.";
42560
42702
  const secureHandler = createSecureHandler(registryImportHandler, {
@@ -42577,10 +42719,10 @@ function registerRegistryImportTool(server, deps) {
42577
42719
  }
42578
42720
 
42579
42721
  // src/mcp/tools/repo-analyze-types.ts
42580
- import { z as z86 } from "zod";
42581
- var RepoAnalyzeInputSchema = z86.object({
42722
+ import { z as z87 } from "zod";
42723
+ var RepoAnalyzeInputSchema = z87.object({
42582
42724
  /** GitHub repository in "owner/name" format or full URL. */
42583
- repo: z86.string().min(1).refine(
42725
+ repo: z87.string().min(1).refine(
42584
42726
  (v) => !v.includes("://") || /^https?:\/\//i.test(v),
42585
42727
  "Only HTTP/HTTPS URLs are allowed"
42586
42728
  ).describe('GitHub repository in "owner/name" format (e.g., "cloudfoundry/korifi") or full URL'),
@@ -42589,13 +42731,13 @@ var RepoAnalyzeInputSchema = z86.object({
42589
42731
  * analysis. Both values resolve to identical behavior; retained for input-shape
42590
42732
  * stability until a distinct shallow path is implemented.
42591
42733
  */
42592
- depth: z86.enum(["shallow", "deep"]).optional().default("shallow").describe(
42734
+ depth: z87.enum(["shallow", "deep"]).optional().default("shallow").describe(
42593
42735
  "Currently a no-op \u2014 the handler always runs the full analysis (both values identical)"
42594
42736
  )
42595
42737
  });
42596
42738
 
42597
42739
  // src/mcp/tools/repo-analyze-tool.ts
42598
- import { z as z87 } from "zod";
42740
+ import { z as z88 } from "zod";
42599
42741
  async function repoAnalyzeHandler(args, ctx) {
42600
42742
  const parsed = RepoAnalyzeInputSchema.safeParse(args);
42601
42743
  if (!parsed.success) {
@@ -42614,8 +42756,8 @@ async function repoAnalyzeHandler(args, ctx) {
42614
42756
  function registerRepoAnalyzeTool(server, deps) {
42615
42757
  const logger57 = deps.logger ?? createLogger({ tool: "repo_analyze" });
42616
42758
  const toolSchema = {
42617
- repo: z87.string().min(1).describe('GitHub repository in "owner/name" format or full URL'),
42618
- depth: z87.enum(["shallow", "deep"]).optional().describe("Currently a no-op \u2014 the handler always runs the full analysis (both values identical)")
42759
+ repo: z88.string().min(1).describe('GitHub repository in "owner/name" format or full URL'),
42760
+ depth: z88.enum(["shallow", "deep"]).optional().describe("Currently a no-op \u2014 the handler always runs the full analysis (both values identical)")
42619
42761
  };
42620
42762
  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.";
42621
42763
  const secureHandler = createSecureHandler(repoAnalyzeHandler, {
@@ -42637,18 +42779,18 @@ function registerRepoAnalyzeTool(server, deps) {
42637
42779
  }
42638
42780
 
42639
42781
  // src/mcp/tools/repo-security-plan-types.ts
42640
- import { z as z88 } from "zod";
42641
- var RepoSecurityPlanInputSchema = z88.object({
42782
+ import { z as z89 } from "zod";
42783
+ var RepoSecurityPlanInputSchema = z89.object({
42642
42784
  /** GitHub repository in "owner/name" format or full URL. */
42643
- repo: z88.string().min(1).describe('GitHub repository in "owner/name" format or full URL'),
42785
+ repo: z89.string().min(1).describe('GitHub repository in "owner/name" format or full URL'),
42644
42786
  /** Filter to specific scanner categories. */
42645
- categories: z88.array(z88.string()).optional().describe('Filter to specific categories (e.g., ["sast", "sca", "secrets"])'),
42787
+ categories: z89.array(z89.string()).optional().describe('Filter to specific categories (e.g., ["sast", "sca", "secrets"])'),
42646
42788
  /** Maximum number of scanners to recommend. */
42647
- maxScanners: z88.number().min(1).max(20).optional().default(10).describe("Maximum scanners to recommend (default: 10)")
42789
+ maxScanners: z89.number().min(1).max(20).optional().default(10).describe("Maximum scanners to recommend (default: 10)")
42648
42790
  });
42649
42791
 
42650
42792
  // src/mcp/tools/repo-security-plan-tool.ts
42651
- import { z as z89 } from "zod";
42793
+ import { z as z90 } from "zod";
42652
42794
  async function handler(args, ctx) {
42653
42795
  const parsed = RepoSecurityPlanInputSchema.safeParse(args);
42654
42796
  if (!parsed.success) {
@@ -42667,9 +42809,9 @@ async function handler(args, ctx) {
42667
42809
  function registerRepoSecurityPlanTool(server, deps) {
42668
42810
  const logger57 = deps.logger ?? createLogger({ tool: "repo_security_plan" });
42669
42811
  const toolSchema = {
42670
- repo: z89.string().min(1).describe('GitHub repository in "owner/name" format or full URL'),
42671
- categories: z89.array(z89.string().max(50)).max(10).optional().describe('Filter to specific categories (e.g., ["sast", "sca", "secrets"])'),
42672
- maxScanners: z89.number().min(1).max(20).optional().describe("Maximum scanners to recommend (default: 10)")
42812
+ repo: z90.string().min(1).describe('GitHub repository in "owner/name" format or full URL'),
42813
+ categories: z90.array(z90.string().max(50)).max(10).optional().describe('Filter to specific categories (e.g., ["sast", "sca", "secrets"])'),
42814
+ maxScanners: z90.number().min(1).max(20).optional().describe("Maximum scanners to recommend (default: 10)")
42673
42815
  };
42674
42816
  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.";
42675
42817
  const secureHandler = createSecureHandler(handler, {
@@ -42692,13 +42834,13 @@ function registerRepoSecurityPlanTool(server, deps) {
42692
42834
 
42693
42835
  // src/mcp/tools/search-codebase-tool.ts
42694
42836
  import { resolve as resolve6, sep as sep3 } from "node:path";
42695
- import { z as z90 } from "zod";
42696
- var SearchCodebaseInputSchema = z90.object({
42697
- query: z90.string().min(1).max(200).describe("Search query (symbol name, keyword, or pattern)"),
42698
- directory: z90.string().min(1).max(500).optional().describe("Directory to search (default: current working directory)"),
42699
- limit: z90.number().min(1).max(50).optional().describe("Max results (default: 20)"),
42700
- mode: z90.enum(["search", "summary", "list"]).optional().describe("search: find symbols. summary: file overview. list: list indexed files."),
42701
- maxDepth: z90.number().int().min(1).max(MAX_INDEX_MAX_DEPTH).optional().describe(
42837
+ import { z as z91 } from "zod";
42838
+ var SearchCodebaseInputSchema = z91.object({
42839
+ query: z91.string().min(1).max(200).describe("Search query (symbol name, keyword, or pattern)"),
42840
+ directory: z91.string().min(1).max(500).optional().describe("Directory to search (default: current working directory)"),
42841
+ limit: z91.number().min(1).max(50).optional().describe("Max results (default: 20)"),
42842
+ mode: z91.enum(["search", "summary", "list"]).optional().describe("search: find symbols. summary: file overview. list: list indexed files."),
42843
+ maxDepth: z91.number().int().min(1).max(MAX_INDEX_MAX_DEPTH).optional().describe(
42702
42844
  `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.`
42703
42845
  )
42704
42846
  });
@@ -42828,11 +42970,11 @@ async function searchCodebaseHandler(args, ctx) {
42828
42970
  function registerSearchCodebaseTool(server, deps) {
42829
42971
  const logger57 = deps.logger ?? createLogger({ tool: "search_codebase" });
42830
42972
  const toolSchema = {
42831
- query: z90.string().min(1).max(200).describe("Search query or file path"),
42832
- directory: z90.string().max(500).optional().describe("Directory to index"),
42833
- limit: z90.number().min(1).max(50).optional().describe("Max results"),
42834
- mode: z90.enum(["search", "summary", "list"]).optional().describe("search/summary/list"),
42835
- maxDepth: z90.number().int().min(1).max(MAX_INDEX_MAX_DEPTH).optional().describe(
42973
+ query: z91.string().min(1).max(200).describe("Search query or file path"),
42974
+ directory: z91.string().max(500).optional().describe("Directory to index"),
42975
+ limit: z91.number().min(1).max(50).optional().describe("Max results"),
42976
+ mode: z91.enum(["search", "summary", "list"]).optional().describe("search/summary/list"),
42977
+ maxDepth: z91.number().int().min(1).max(MAX_INDEX_MAX_DEPTH).optional().describe(
42836
42978
  `Max directory depth to index (default: ${String(DEFAULT_INDEX_MAX_DEPTH)}, clamped to ${String(MAX_INDEX_MAX_DEPTH)})`
42837
42979
  )
42838
42980
  };
@@ -42854,7 +42996,7 @@ function registerSearchCodebaseTool(server, deps) {
42854
42996
 
42855
42997
  // src/mcp/tools/extract-symbols-tool.ts
42856
42998
  import { extname as extname3, resolve as resolve7, sep as sep4 } from "node:path";
42857
- import { z as z91 } from "zod";
42999
+ import { z as z92 } from "zod";
42858
43000
 
42859
43001
  // src/core/task-analysis/tool-refusal-gap.ts
42860
43002
  function toolRefusalGapName(tool, capability) {
@@ -42880,13 +43022,13 @@ function recordToolRefusal(refusal, context, ledger = getGapLedger()) {
42880
43022
  // src/mcp/tools/extract-symbols-tool.ts
42881
43023
  var DEFAULT_EXTRACT_MAX_CHARS = 2e4;
42882
43024
  var DEFAULT_EXTRACT_MAX_SYMBOLS = 200;
42883
- var ExtractSymbolsInputSchema = z91.object({
42884
- filePath: z91.string().min(1).max(500).describe("Path to TypeScript/JavaScript file to extract symbols from"),
42885
- mode: z91.enum(["index", "full"]).optional().describe("index: names+lines only (minimal tokens). full: includes source text."),
42886
- maxChars: z91.number().int().positive().max(1e6).optional().describe(
43025
+ var ExtractSymbolsInputSchema = z92.object({
43026
+ filePath: z92.string().min(1).max(500).describe("Path to TypeScript/JavaScript file to extract symbols from"),
43027
+ mode: z92.enum(["index", "full"]).optional().describe("index: names+lines only (minimal tokens). full: includes source text."),
43028
+ maxChars: z92.number().int().positive().max(1e6).optional().describe(
42887
43029
  `full mode only: cap on total emitted symbol source chars (default ${String(DEFAULT_EXTRACT_MAX_CHARS)}). Excess is truncated and reported, never silently dropped.`
42888
43030
  ),
42889
- maxSymbols: z91.number().int().positive().max(1e4).optional().describe(
43031
+ maxSymbols: z92.number().int().positive().max(1e4).optional().describe(
42890
43032
  `full mode only: cap on number of symbols emitted (default ${String(DEFAULT_EXTRACT_MAX_SYMBOLS)}).`
42891
43033
  )
42892
43034
  });
@@ -43030,12 +43172,12 @@ function emptyIndexMessage(reason, filePath) {
43030
43172
  function registerExtractSymbolsTool(server, deps) {
43031
43173
  const logger57 = deps.logger ?? createLogger({ tool: "extract_symbols" });
43032
43174
  const toolSchema = {
43033
- filePath: z91.string().min(1).max(500).describe("Path to TypeScript/JavaScript file"),
43034
- mode: z91.enum(["index", "full"]).optional().describe("index (default): names+lines. full: includes source text"),
43035
- maxChars: z91.number().int().positive().max(1e6).optional().describe(
43175
+ filePath: z92.string().min(1).max(500).describe("Path to TypeScript/JavaScript file"),
43176
+ mode: z92.enum(["index", "full"]).optional().describe("index (default): names+lines. full: includes source text"),
43177
+ maxChars: z92.number().int().positive().max(1e6).optional().describe(
43036
43178
  `full mode only: cap on total emitted symbol source chars (default ${String(DEFAULT_EXTRACT_MAX_CHARS)})`
43037
43179
  ),
43038
- maxSymbols: z91.number().int().positive().max(1e4).optional().describe(
43180
+ maxSymbols: z92.number().int().positive().max(1e4).optional().describe(
43039
43181
  `full mode only: cap on number of symbols emitted (default ${String(DEFAULT_EXTRACT_MAX_SYMBOLS)})`
43040
43182
  )
43041
43183
  };
@@ -43061,23 +43203,23 @@ function registerExtractSymbolsTool(server, deps) {
43061
43203
  // src/mcp/tools/search-usages-tool.ts
43062
43204
  import { readFile as readFile3 } from "node:fs/promises";
43063
43205
  import { relative, resolve as resolve8, sep as sep5 } from "node:path";
43064
- import { z as z92 } from "zod";
43206
+ import { z as z93 } from "zod";
43065
43207
  var DEFAULT_USAGES_LIMIT = 50;
43066
43208
  var MAX_USAGES_LIMIT = 500;
43067
43209
  var DEFAULT_USAGES_MAX_DEPTH = 24;
43068
43210
  var MAX_USAGES_MAX_DEPTH = 64;
43069
43211
  var MAX_FILES_SCANNED = 5e3;
43070
- var SearchUsagesInputSchema = z92.object({
43071
- symbol: z92.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)"),
43072
- path: z92.string().min(1).max(500).optional().describe("Restrict to a single source file (takes precedence over dir)"),
43073
- dir: z92.string().min(1).max(500).optional().describe("Directory to search recursively (default: current working directory)"),
43074
- lang: z92.enum(LANG_VALUES).optional().describe(
43212
+ var SearchUsagesInputSchema = z93.object({
43213
+ symbol: z93.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)"),
43214
+ path: z93.string().min(1).max(500).optional().describe("Restrict to a single source file (takes precedence over dir)"),
43215
+ dir: z93.string().min(1).max(500).optional().describe("Directory to search recursively (default: current working directory)"),
43216
+ lang: z93.enum(LANG_VALUES).optional().describe(
43075
43217
  "Language override (default: inferred from each file extension, fallback typescript)"
43076
43218
  ),
43077
- limit: z92.number().int().min(1).max(MAX_USAGES_LIMIT).optional().describe(
43219
+ limit: z93.number().int().min(1).max(MAX_USAGES_LIMIT).optional().describe(
43078
43220
  `Max usage matches emitted (default ${String(DEFAULT_USAGES_LIMIT)}). Excess is reported.`
43079
43221
  ),
43080
- maxDepth: z92.number().int().min(1).max(MAX_USAGES_MAX_DEPTH).optional().describe(`Directory walk depth for dir scope (default ${String(DEFAULT_USAGES_MAX_DEPTH)}).`)
43222
+ maxDepth: z93.number().int().min(1).max(MAX_USAGES_MAX_DEPTH).optional().describe(`Directory walk depth for dir scope (default ${String(DEFAULT_USAGES_MAX_DEPTH)}).`)
43081
43223
  });
43082
43224
  function resolveWithinCwd(target) {
43083
43225
  const resolved = resolve8(target);
@@ -43196,12 +43338,12 @@ async function searchUsagesHandler(args, ctx) {
43196
43338
  function registerSearchUsagesTool(server, deps) {
43197
43339
  const logger57 = deps.logger ?? createLogger({ tool: "search_usages" });
43198
43340
  const toolSchema = {
43199
- symbol: z92.string().min(1).max(200).regex(IDENTIFIER_RE, "symbol must be a single JS identifier").describe("Identifier to find usages/call-sites of"),
43200
- path: z92.string().min(1).max(500).optional().describe("Restrict to a single source file"),
43201
- dir: z92.string().min(1).max(500).optional().describe("Directory to search (default: cwd)"),
43202
- lang: z92.enum(LANG_VALUES).optional().describe("Language override (default: infer from ext)"),
43203
- limit: z92.number().int().min(1).max(MAX_USAGES_LIMIT).optional().describe(`Max matches (default ${String(DEFAULT_USAGES_LIMIT)})`),
43204
- maxDepth: z92.number().int().min(1).max(MAX_USAGES_MAX_DEPTH).optional().describe(`Directory walk depth (default ${String(DEFAULT_USAGES_MAX_DEPTH)})`)
43341
+ symbol: z93.string().min(1).max(200).regex(IDENTIFIER_RE, "symbol must be a single JS identifier").describe("Identifier to find usages/call-sites of"),
43342
+ path: z93.string().min(1).max(500).optional().describe("Restrict to a single source file"),
43343
+ dir: z93.string().min(1).max(500).optional().describe("Directory to search (default: cwd)"),
43344
+ lang: z93.enum(LANG_VALUES).optional().describe("Language override (default: infer from ext)"),
43345
+ limit: z93.number().int().min(1).max(MAX_USAGES_LIMIT).optional().describe(`Max matches (default ${String(DEFAULT_USAGES_LIMIT)})`),
43346
+ maxDepth: z93.number().int().min(1).max(MAX_USAGES_MAX_DEPTH).optional().describe(`Directory walk depth (default ${String(DEFAULT_USAGES_MAX_DEPTH)})`)
43205
43347
  };
43206
43348
  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.`;
43207
43349
  const secureHandler = createSecureHandler(searchUsagesHandler, {
@@ -43222,11 +43364,11 @@ function registerSearchUsagesTool(server, deps) {
43222
43364
  // src/mcp/tools/query-trace-tool.ts
43223
43365
  import { readFile as readFile4, stat as stat3 } from "node:fs/promises";
43224
43366
  import { join as join7, resolve as resolve9, sep as sep6 } from "node:path";
43225
- import { z as z93 } from "zod";
43226
- var QueryTraceInputSchema = z93.object({
43227
- runId: z93.string().min(1).max(128).regex(/^[a-zA-Z0-9_-]+$/, "runId must be alphanumeric, hyphens, or underscores").describe("Run ID to query traces for"),
43228
- eventType: z93.string().max(100).regex(/^[a-zA-Z0-9._-]+$/, "eventType must be alphanumeric with dots, hyphens, or underscores").optional().describe("Filter by event type"),
43229
- limit: z93.number().min(1).max(500).optional().describe("Max events to return (default: 100)")
43367
+ import { z as z94 } from "zod";
43368
+ var QueryTraceInputSchema = z94.object({
43369
+ runId: z94.string().min(1).max(128).regex(/^[a-zA-Z0-9_-]+$/, "runId must be alphanumeric, hyphens, or underscores").describe("Run ID to query traces for"),
43370
+ eventType: z94.string().max(100).regex(/^[a-zA-Z0-9._-]+$/, "eventType must be alphanumeric with dots, hyphens, or underscores").optional().describe("Filter by event type"),
43371
+ limit: z94.number().min(1).max(500).optional().describe("Max events to return (default: 100)")
43230
43372
  });
43231
43373
  var MAX_TRACE_FILE_BYTES = 100 * 1024 * 1024;
43232
43374
  var traceLogger = createLogger({ component: "query-trace" });
@@ -43350,9 +43492,9 @@ function queryTraceHandler(args, ctx) {
43350
43492
  function registerQueryTraceTool(server, deps) {
43351
43493
  const logger57 = deps.logger ?? createLogger({ tool: "query_trace" });
43352
43494
  const toolSchema = {
43353
- runId: z93.string().min(1).max(128).regex(/^[a-zA-Z0-9_-]+$/, "runId must be alphanumeric, hyphens, or underscores").describe("Run ID to query traces for"),
43354
- eventType: z93.string().max(100).regex(/^[a-zA-Z0-9._-]+$/).optional().describe("Filter by event type (e.g., model.called)"),
43355
- limit: z93.number().min(1).max(500).optional().describe("Max events to return (default: 100)")
43495
+ runId: z94.string().min(1).max(128).regex(/^[a-zA-Z0-9_-]+$/, "runId must be alphanumeric, hyphens, or underscores").describe("Run ID to query traces for"),
43496
+ eventType: z94.string().max(100).regex(/^[a-zA-Z0-9._-]+$/).optional().describe("Filter by event type (e.g., model.called)"),
43497
+ limit: z94.number().min(1).max(500).optional().describe("Max events to return (default: 100)")
43356
43498
  };
43357
43499
  const description = "Query execution traces by run ID. Returns agent and model attribution for pipeline runs including decision paths, error taxonomy, and timing data.";
43358
43500
  const secureHandler = createSecureHandler(queryTraceHandler, {
@@ -43371,7 +43513,7 @@ function registerQueryTraceTool(server, deps) {
43371
43513
  }
43372
43514
 
43373
43515
  // src/mcp/tools/get-job-result-tool.ts
43374
- import { z as z94 } from "zod";
43516
+ import { z as z95 } from "zod";
43375
43517
 
43376
43518
  // src/mcp/jobs/task-state-source.ts
43377
43519
  var logger34 = createLogger({ component: "task-state-source" });
@@ -43494,8 +43636,8 @@ function resolveJobListing(customDir) {
43494
43636
  }
43495
43637
 
43496
43638
  // src/mcp/tools/get-job-result-tool.ts
43497
- var GetJobResultInputSchema = z94.object({
43498
- jobId: z94.string().min(1).max(128).describe('Job ID returned by any tool called with dispatch: "async" (e.g. orchestrate)')
43639
+ var GetJobResultInputSchema = z95.object({
43640
+ jobId: z95.string().min(1).max(128).describe('Job ID returned by any tool called with dispatch: "async" (e.g. orchestrate)')
43499
43641
  });
43500
43642
  function getJobResultHandler(args) {
43501
43643
  const parsed = GetJobResultInputSchema.safeParse(args);
@@ -43534,7 +43676,7 @@ function getJobResultHandler(args) {
43534
43676
  function registerGetJobResultTool(server, deps) {
43535
43677
  const logger57 = deps.logger ?? createLogger({ tool: "get_job_result" });
43536
43678
  const toolSchema = {
43537
- jobId: z94.string().min(1).max(128).describe('Job ID returned by any tool called with dispatch: "async" (e.g. orchestrate)')
43679
+ jobId: z95.string().min(1).max(128).describe('Job ID returned by any tool called with dispatch: "async" (e.g. orchestrate)')
43538
43680
  };
43539
43681
  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.`;
43540
43682
  const secureHandler = createSecureHandler(getJobResultHandler, {
@@ -43556,14 +43698,14 @@ function registerGetJobResultTool(server, deps) {
43556
43698
  }
43557
43699
 
43558
43700
  // src/mcp/tools/list-jobs-tool.ts
43559
- import { z as z95 } from "zod";
43701
+ import { z as z96 } from "zod";
43560
43702
  var MAX_LIST_JOBS_RESULTS = 200;
43561
- var ListJobsInputSchema = z95.object({
43703
+ var ListJobsInputSchema = z96.object({
43562
43704
  /**
43563
43705
  * Filter to jobs from a specific tool (exact match — e.g. `'orchestrate'`).
43564
43706
  * Omit to list every tool's jobs.
43565
43707
  */
43566
- toolName: z95.string().min(1).max(128).optional().describe("Filter to one tool (exact match)."),
43708
+ toolName: z96.string().min(1).max(128).optional().describe("Filter to one tool (exact match)."),
43567
43709
  /**
43568
43710
  * Filter to jobs in a specific lifecycle state.
43569
43711
  * Omit to list every state.
@@ -43576,7 +43718,7 @@ var ListJobsInputSchema = z95.object({
43576
43718
  * Newest jobs are returned first, so a smaller limit shows the most
43577
43719
  * recent activity.
43578
43720
  */
43579
- limit: z95.number().int().min(1).max(MAX_LIST_JOBS_RESULTS).optional().describe(`Max summaries to return (1-${String(MAX_LIST_JOBS_RESULTS)}, newest first).`)
43721
+ limit: z96.number().int().min(1).max(MAX_LIST_JOBS_RESULTS).optional().describe(`Max summaries to return (1-${String(MAX_LIST_JOBS_RESULTS)}, newest first).`)
43580
43722
  });
43581
43723
  function listJobsHandler(args) {
43582
43724
  const parsed = ListJobsInputSchema.safeParse(args);
@@ -43617,11 +43759,11 @@ function listJobsHandler(args) {
43617
43759
  function registerListJobsTool(server, deps) {
43618
43760
  const logger57 = deps.logger ?? createLogger({ tool: "list_jobs" });
43619
43761
  const toolSchema = {
43620
- toolName: z95.string().min(1).max(128).optional().describe("Filter to one tool (exact match)."),
43762
+ toolName: z96.string().min(1).max(128).optional().describe("Filter to one tool (exact match)."),
43621
43763
  status: JobStatusSchema.optional().describe(
43622
43764
  "Filter to pending | complete | failed | cancelled. Omit for all."
43623
43765
  ),
43624
- limit: z95.number().int().min(1).max(MAX_LIST_JOBS_RESULTS).optional().describe(`Max summaries to return (1-${String(MAX_LIST_JOBS_RESULTS)}, newest first).`)
43766
+ limit: z96.number().int().min(1).max(MAX_LIST_JOBS_RESULTS).optional().describe(`Max summaries to return (1-${String(MAX_LIST_JOBS_RESULTS)}, newest first).`)
43625
43767
  };
43626
43768
  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.";
43627
43769
  const secureHandler = createSecureHandler(listJobsHandler, {
@@ -43643,11 +43785,11 @@ function registerListJobsTool(server, deps) {
43643
43785
  }
43644
43786
 
43645
43787
  // src/mcp/tools/cancel-job-tool.ts
43646
- import { z as z96 } from "zod";
43788
+ import { z as z97 } from "zod";
43647
43789
  var defaultLogger3 = createLogger({ tool: "cancel_job" });
43648
- var CancelJobInputSchema = z96.object({
43649
- jobId: z96.string().min(1).max(128).describe("Job ID returned by orchestrate / run_workflow / consensus_vote in async mode"),
43650
- reason: z96.string().max(1e3).optional().describe('Optional human-readable note (e.g. "user clicked cancel").')
43790
+ var CancelJobInputSchema = z97.object({
43791
+ jobId: z97.string().min(1).max(128).describe("Job ID returned by orchestrate / run_workflow / consensus_vote in async mode"),
43792
+ reason: z97.string().max(1e3).optional().describe('Optional human-readable note (e.g. "user clicked cancel").')
43651
43793
  });
43652
43794
  function cancelJobHandler(args, logger57 = defaultLogger3) {
43653
43795
  const parsed = CancelJobInputSchema.safeParse(args);
@@ -43716,8 +43858,8 @@ function cancelPendingJob(jobId, toolName, logger57, reason) {
43716
43858
  function registerCancelJobTool(server, deps) {
43717
43859
  const logger57 = deps.logger ?? defaultLogger3;
43718
43860
  const toolSchema = {
43719
- jobId: z96.string().min(1).max(128).describe("Job ID returned by orchestrate / run_workflow / consensus_vote in async mode"),
43720
- reason: z96.string().max(1e3).optional().describe('Optional human-readable note (e.g. "user clicked cancel").')
43861
+ jobId: z97.string().min(1).max(128).describe("Job ID returned by orchestrate / run_workflow / consensus_vote in async mode"),
43862
+ reason: z97.string().max(1e3).optional().describe('Optional human-readable note (e.g. "user clicked cancel").')
43721
43863
  };
43722
43864
  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.";
43723
43865
  const secureHandler = createSecureHandler((args) => cancelJobHandler(args, logger57), {
@@ -43739,7 +43881,7 @@ function registerCancelJobTool(server, deps) {
43739
43881
  }
43740
43882
 
43741
43883
  // src/audit/audit-types.ts
43742
- import { z as z97 } from "zod";
43884
+ import { z as z98 } from "zod";
43743
43885
  var AuditError = class extends Error {
43744
43886
  code = "AUDIT_ERROR";
43745
43887
  context;
@@ -43751,7 +43893,7 @@ var AuditError = class extends Error {
43751
43893
  this.context = options?.context;
43752
43894
  }
43753
43895
  };
43754
- var AuditCategorySchema = z97.enum([
43896
+ var AuditCategorySchema = z98.enum([
43755
43897
  "authentication",
43756
43898
  // Login, logout, token refresh
43757
43899
  "authorization",
@@ -43771,28 +43913,28 @@ var AuditCategorySchema = z97.enum([
43771
43913
  "governance"
43772
43914
  // Authority-tier transitions, ratification (Epic D, #3842)
43773
43915
  ]);
43774
- var TierTransitionKindSchema = z97.enum(["promotion", "demotion"]);
43775
- var TierTransitionTierSchema = z97.enum(["observe", "suggest", "advisory", "enforce"]);
43776
- var TierTransitionPayloadSchema = z97.object({
43916
+ var TierTransitionKindSchema = z98.enum(["promotion", "demotion"]);
43917
+ var TierTransitionTierSchema = z98.enum(["observe", "suggest", "advisory", "enforce"]);
43918
+ var TierTransitionPayloadSchema = z98.object({
43777
43919
  /** Whether the loop moved up (`promotion`) or down (`demotion`) the ladder. */
43778
43920
  kind: TierTransitionKindSchema,
43779
43921
  /** The loop/strategy whose tier changed (manifest `id` or loop identifier). */
43780
- subject: z97.string().min(1),
43922
+ subject: z98.string().min(1),
43781
43923
  /** Tier before the transition. */
43782
43924
  fromTier: TierTransitionTierSchema,
43783
43925
  /** Tier after the transition. */
43784
43926
  toTier: TierTransitionTierSchema,
43785
43927
  /** Ref to the promotion-evidence record this transition was earned against. */
43786
- evidenceRef: z97.string().min(1),
43928
+ evidenceRef: z98.string().min(1),
43787
43929
  /**
43788
43930
  * Ref to the recorded `consensus_vote` that ratified a PROMOTION. Required
43789
43931
  * by the ratification gate for `kind: 'promotion'`; legitimately absent for
43790
43932
  * `kind: 'demotion'` (automatic, ADR-0017 §"Demotion is automatic").
43791
43933
  */
43792
- ratificationVoteRef: z97.string().min(1).optional()
43934
+ ratificationVoteRef: z98.string().min(1).optional()
43793
43935
  }).strict();
43794
43936
  var TIER_TRANSITION_METADATA_KEY = "tierTransition";
43795
- var AuditSeveritySchema = z97.enum([
43937
+ var AuditSeveritySchema = z98.enum([
43796
43938
  "info",
43797
43939
  // Normal operations
43798
43940
  "warning",
@@ -43800,7 +43942,7 @@ var AuditSeveritySchema = z97.enum([
43800
43942
  "critical"
43801
43943
  // Security violations, failures
43802
43944
  ]);
43803
- var AuditOutcomeSchema = z97.enum([
43945
+ var AuditOutcomeSchema = z98.enum([
43804
43946
  "success",
43805
43947
  // Operation completed successfully
43806
43948
  "failure",
@@ -43810,56 +43952,56 @@ var AuditOutcomeSchema = z97.enum([
43810
43952
  "error"
43811
43953
  // Unexpected error occurred
43812
43954
  ]);
43813
- var AuditActorSchema = z97.object({
43814
- type: z97.enum(["user", "agent", "system", "external"]),
43815
- id: z97.string().min(1),
43816
- name: z97.string().optional(),
43817
- ip: z97.string().optional(),
43818
- userAgent: z97.string().optional()
43955
+ var AuditActorSchema = z98.object({
43956
+ type: z98.enum(["user", "agent", "system", "external"]),
43957
+ id: z98.string().min(1),
43958
+ name: z98.string().optional(),
43959
+ ip: z98.string().optional(),
43960
+ userAgent: z98.string().optional()
43819
43961
  });
43820
- var AuditResourceSchema = z97.object({
43821
- type: z97.string().min(1),
43962
+ var AuditResourceSchema = z98.object({
43963
+ type: z98.string().min(1),
43822
43964
  // e.g., 'file', 'tool', 'config', 'agent'
43823
- id: z97.string().min(1),
43824
- name: z97.string().optional(),
43825
- path: z97.string().optional()
43965
+ id: z98.string().min(1),
43966
+ name: z98.string().optional(),
43967
+ path: z98.string().optional()
43826
43968
  });
43827
- var AuditEventSchema = z97.object({
43969
+ var AuditEventSchema = z98.object({
43828
43970
  // Identity
43829
- id: z97.string().min(1),
43971
+ id: z98.string().min(1),
43830
43972
  // Unique event ID
43831
- version: z97.literal("1.0"),
43973
+ version: z98.literal("1.0"),
43832
43974
  // Schema version for migrations
43833
43975
  // Timing
43834
- timestamp: z97.string(),
43976
+ timestamp: z98.string(),
43835
43977
  // ISO 8601 format
43836
- timestampMs: z97.number(),
43978
+ timestampMs: z98.number(),
43837
43979
  // Unix epoch milliseconds
43838
43980
  // Classification
43839
43981
  category: AuditCategorySchema,
43840
43982
  severity: AuditSeveritySchema,
43841
43983
  outcome: AuditOutcomeSchema,
43842
43984
  // Event details
43843
- action: z97.string().min(1),
43985
+ action: z98.string().min(1),
43844
43986
  // e.g., 'tool.invoke', 'policy.evaluate'
43845
- description: z97.string().optional(),
43987
+ description: z98.string().optional(),
43846
43988
  // Actors and resources
43847
43989
  actor: AuditActorSchema,
43848
43990
  resource: AuditResourceSchema.optional(),
43849
43991
  // Correlation
43850
- requestId: z97.string().optional(),
43992
+ requestId: z98.string().optional(),
43851
43993
  // Request correlation ID
43852
- traceId: z97.string().optional(),
43994
+ traceId: z98.string().optional(),
43853
43995
  // Distributed trace ID
43854
- sessionId: z97.string().optional(),
43996
+ sessionId: z98.string().optional(),
43855
43997
  // Session correlation ID
43856
43998
  // Context
43857
- toolName: z97.string().optional(),
43858
- durationMs: z97.number().optional(),
43859
- metadata: z97.record(z97.string(), z97.unknown()).optional(),
43999
+ toolName: z98.string().optional(),
44000
+ durationMs: z98.number().optional(),
44001
+ metadata: z98.record(z98.string(), z98.unknown()).optional(),
43860
44002
  // Policy and security
43861
- policyName: z97.string().optional(),
43862
- policyDecision: z97.string().optional(),
44003
+ policyName: z98.string().optional(),
44004
+ policyDecision: z98.string().optional(),
43863
44005
  /**
43864
44006
  * Which occurrence of this `{tool, rule}` near-miss the record represents
43865
44007
  * (#5228 review). Present only on a sampled `would_deny`.
@@ -43876,12 +44018,12 @@ var AuditEventSchema = z97.object({
43876
44018
  * Absent means "not sampled" — every occurrence was recorded — which is
43877
44019
  * distinct from `1`.
43878
44020
  */
43879
- policyOccurrence: z97.number().int().min(1).optional(),
43880
- violationType: z97.string().optional(),
44021
+ policyOccurrence: z98.number().int().min(1).optional(),
44022
+ violationType: z98.string().optional(),
43881
44023
  // Integrity (for tamper-evidence)
43882
- previousHash: z97.string().optional(),
44024
+ previousHash: z98.string().optional(),
43883
44025
  // Hash of previous event (chain)
43884
- hash: z97.string().optional(),
44026
+ hash: z98.string().optional(),
43885
44027
  // Hash of this event
43886
44028
  /**
43887
44029
  * Hash-projection version (#3921). ABSENT/`1` = the legacy projection
@@ -43891,62 +44033,62 @@ var AuditEventSchema = z97.object({
43891
44033
  * Versioned so pre-existing v1 chains keep verifying under their own
43892
44034
  * projection (see {@link AUDIT_HASH_VERSION_TIER_TRANSITION}).
43893
44035
  */
43894
- hashVersion: z97.number().int().positive().optional()
44036
+ hashVersion: z98.number().int().positive().optional()
43895
44037
  });
43896
44038
  var AUDIT_HASH_VERSION_TIER_TRANSITION = 2;
43897
- var AuditEventInputSchema = z97.object({
44039
+ var AuditEventInputSchema = z98.object({
43898
44040
  category: AuditCategorySchema,
43899
44041
  severity: AuditSeveritySchema.optional().default("info"),
43900
44042
  outcome: AuditOutcomeSchema,
43901
- action: z97.string().min(1),
43902
- description: z97.string().optional(),
44043
+ action: z98.string().min(1),
44044
+ description: z98.string().optional(),
43903
44045
  actor: AuditActorSchema,
43904
44046
  resource: AuditResourceSchema.optional(),
43905
- requestId: z97.string().optional(),
43906
- traceId: z97.string().optional(),
43907
- sessionId: z97.string().optional(),
43908
- toolName: z97.string().optional(),
43909
- durationMs: z97.number().optional(),
43910
- metadata: z97.record(z97.string(), z97.unknown()).optional(),
43911
- policyName: z97.string().optional(),
43912
- policyDecision: z97.string().optional(),
44047
+ requestId: z98.string().optional(),
44048
+ traceId: z98.string().optional(),
44049
+ sessionId: z98.string().optional(),
44050
+ toolName: z98.string().optional(),
44051
+ durationMs: z98.number().optional(),
44052
+ metadata: z98.record(z98.string(), z98.unknown()).optional(),
44053
+ policyName: z98.string().optional(),
44054
+ policyDecision: z98.string().optional(),
43913
44055
  /** @see AuditEventSchema.policyOccurrence (#5228 review). */
43914
- policyOccurrence: z97.number().int().min(1).optional(),
43915
- violationType: z97.string().optional()
44056
+ policyOccurrence: z98.number().int().min(1).optional(),
44057
+ violationType: z98.string().optional()
43916
44058
  });
43917
- var AuditLogConfigSchema = z97.object({
44059
+ var AuditLogConfigSchema = z98.object({
43918
44060
  // Storage
43919
- logDir: z97.string().min(1),
43920
- filePrefix: z97.string().optional().default("audit"),
43921
- maxFileSizeBytes: z97.number().positive().optional().default(10 * 1024 * 1024),
44061
+ logDir: z98.string().min(1),
44062
+ filePrefix: z98.string().optional().default("audit"),
44063
+ maxFileSizeBytes: z98.number().positive().optional().default(10 * 1024 * 1024),
43922
44064
  // 10MB
43923
- maxFiles: z97.number().positive().optional().default(10),
44065
+ maxFiles: z98.number().positive().optional().default(10),
43924
44066
  // Features
43925
- enableHashChain: z97.boolean().optional().default(true),
43926
- enableCompression: z97.boolean().optional().default(false),
43927
- flushIntervalMs: z97.number().positive().optional().default(1e3),
44067
+ enableHashChain: z98.boolean().optional().default(true),
44068
+ enableCompression: z98.boolean().optional().default(false),
44069
+ flushIntervalMs: z98.number().positive().optional().default(1e3),
43928
44070
  /**
43929
44071
  * Maximum in-memory event queue depth before drop-oldest backpressure
43930
44072
  * engages. Bounds memory under load when storage.write is slow or the flush
43931
44073
  * timer is overlapping; see #2979.
43932
44074
  */
43933
- maxQueueDepth: z97.number().positive().optional().default(1e4),
44075
+ maxQueueDepth: z98.number().positive().optional().default(1e4),
43934
44076
  // Filtering
43935
44077
  minSeverity: AuditSeveritySchema.optional().default("info"),
43936
- categories: z97.array(AuditCategorySchema).optional()
44078
+ categories: z98.array(AuditCategorySchema).optional()
43937
44079
  });
43938
- var AuditQueryCriteriaSchema = z97.object({
43939
- startTime: z97.date().optional(),
43940
- endTime: z97.date().optional(),
43941
- categories: z97.array(AuditCategorySchema).optional(),
43942
- severities: z97.array(AuditSeveritySchema).optional(),
43943
- outcomes: z97.array(AuditOutcomeSchema).optional(),
43944
- actorId: z97.string().optional(),
43945
- resourceId: z97.string().optional(),
43946
- requestId: z97.string().optional(),
43947
- traceId: z97.string().optional(),
43948
- limit: z97.number().positive().optional().default(100),
43949
- offset: z97.number().nonnegative().optional().default(0)
44080
+ var AuditQueryCriteriaSchema = z98.object({
44081
+ startTime: z98.date().optional(),
44082
+ endTime: z98.date().optional(),
44083
+ categories: z98.array(AuditCategorySchema).optional(),
44084
+ severities: z98.array(AuditSeveritySchema).optional(),
44085
+ outcomes: z98.array(AuditOutcomeSchema).optional(),
44086
+ actorId: z98.string().optional(),
44087
+ resourceId: z98.string().optional(),
44088
+ requestId: z98.string().optional(),
44089
+ traceId: z98.string().optional(),
44090
+ limit: z98.number().positive().optional().default(100),
44091
+ offset: z98.number().nonnegative().optional().default(0)
43950
44092
  });
43951
44093
 
43952
44094
  // src/audit/audit-storage-queries.ts
@@ -45431,7 +45573,7 @@ function ensureRunnableTemplate(template, stages) {
45431
45573
  // src/pipeline/pipeline-checkpoint.ts
45432
45574
  import * as fs6 from "node:fs";
45433
45575
  import * as path4 from "node:path";
45434
- import { z as z98 } from "zod";
45576
+ import { z as z99 } from "zod";
45435
45577
  var logger39 = createLogger({ component: "pipeline-checkpoint" });
45436
45578
  var SESSION_ID_REGEX = /^[a-zA-Z0-9_-]{1,128}$/;
45437
45579
  function validateSessionId(sessionId) {
@@ -45479,7 +45621,7 @@ function loadCheckpointState(sessionId, customDir) {
45479
45621
  return null;
45480
45622
  }
45481
45623
  }
45482
- var PipelineStageSchema = z98.enum([
45624
+ var PipelineStageSchema = z99.enum([
45483
45625
  "research",
45484
45626
  "plan",
45485
45627
  "vote",
@@ -45487,27 +45629,27 @@ var PipelineStageSchema = z98.enum([
45487
45629
  "implement",
45488
45630
  "security"
45489
45631
  ]);
45490
- var PipelineStageDataSchema = z98.discriminatedUnion("type", [
45491
- z98.object({ type: z98.literal("research"), text: z98.string() }),
45492
- z98.object({ type: z98.literal("plan"), text: z98.string(), iterations: z98.number() }),
45493
- z98.object({
45494
- type: z98.literal("vote"),
45495
- approved: z98.boolean(),
45496
- conditional: z98.boolean(),
45497
- conditions: z98.array(z98.string()).optional(),
45498
- caveats: z98.array(z98.string()).optional(),
45499
- iterations: z98.number()
45632
+ var PipelineStageDataSchema = z99.discriminatedUnion("type", [
45633
+ z99.object({ type: z99.literal("research"), text: z99.string() }),
45634
+ z99.object({ type: z99.literal("plan"), text: z99.string(), iterations: z99.number() }),
45635
+ z99.object({
45636
+ type: z99.literal("vote"),
45637
+ approved: z99.boolean(),
45638
+ conditional: z99.boolean(),
45639
+ conditions: z99.array(z99.string()).optional(),
45640
+ caveats: z99.array(z99.string()).optional(),
45641
+ iterations: z99.number()
45500
45642
  }),
45501
45643
  // PipelineTask shape is loose at the persistence layer — capture as
45502
45644
  // `z.unknown()` and trust the downstream consumer's narrower validation.
45503
- z98.object({ type: z98.literal("decompose"), tasks: z98.array(z98.unknown()) }),
45504
- z98.object({ type: z98.literal("implement"), tasks: z98.array(z98.unknown()) }),
45505
- z98.object({ type: z98.literal("security"), passed: z98.boolean() })
45645
+ z99.object({ type: z99.literal("decompose"), tasks: z99.array(z99.unknown()) }),
45646
+ z99.object({ type: z99.literal("implement"), tasks: z99.array(z99.unknown()) }),
45647
+ z99.object({ type: z99.literal("security"), passed: z99.boolean() })
45506
45648
  ]);
45507
- var PipelineCheckpointEntrySchema = z98.object({
45508
- sessionId: z98.string(),
45649
+ var PipelineCheckpointEntrySchema = z99.object({
45650
+ sessionId: z99.string(),
45509
45651
  stage: PipelineStageSchema,
45510
- timestamp: z98.string(),
45652
+ timestamp: z99.string(),
45511
45653
  data: PipelineStageDataSchema
45512
45654
  });
45513
45655
  function rebuildState(lines) {
@@ -45697,7 +45839,7 @@ function buildVotingInput(plan, config) {
45697
45839
  }
45698
45840
  async function executeSingleVote(plan, config, log) {
45699
45841
  try {
45700
- const { executeVoting } = await import("./consensus-vote-YWUJNA4A.js");
45842
+ const { executeVoting } = await import("./consensus-vote-OL7DLZNL.js");
45701
45843
  const input = buildVotingInput(plan, config);
45702
45844
  const result = await executeVoting(input, log);
45703
45845
  return parseVotingResult(result);
@@ -46421,49 +46563,49 @@ Verdict: PASS/NEEDS_WORK/REJECT`;
46421
46563
  }
46422
46564
 
46423
46565
  // src/security/sarif-parser.ts
46424
- import { z as z99 } from "zod";
46425
- var SarifLocationSchema = z99.object({
46426
- physicalLocation: z99.object({
46427
- artifactLocation: z99.object({ uri: z99.string().optional().catch(void 0) }).optional(),
46428
- region: z99.object({
46429
- startLine: z99.number().optional().catch(void 0),
46430
- endLine: z99.number().int().min(1).optional().catch(void 0),
46431
- snippet: z99.object({ text: z99.string().optional().catch(void 0) }).optional().catch(void 0)
46566
+ import { z as z100 } from "zod";
46567
+ var SarifLocationSchema = z100.object({
46568
+ physicalLocation: z100.object({
46569
+ artifactLocation: z100.object({ uri: z100.string().optional().catch(void 0) }).optional(),
46570
+ region: z100.object({
46571
+ startLine: z100.number().optional().catch(void 0),
46572
+ endLine: z100.number().int().min(1).optional().catch(void 0),
46573
+ snippet: z100.object({ text: z100.string().optional().catch(void 0) }).optional().catch(void 0)
46432
46574
  }).optional()
46433
46575
  }).optional()
46434
46576
  });
46435
- var SarifResultSchema = z99.object({
46436
- ruleId: z99.string().nullish(),
46437
- level: z99.string().nullish(),
46438
- message: z99.object({ text: z99.string().optional() }).nullish(),
46439
- locations: z99.array(SarifLocationSchema).nullish()
46577
+ var SarifResultSchema = z100.object({
46578
+ ruleId: z100.string().nullish(),
46579
+ level: z100.string().nullish(),
46580
+ message: z100.object({ text: z100.string().optional() }).nullish(),
46581
+ locations: z100.array(SarifLocationSchema).nullish()
46440
46582
  });
46441
- var SarifRuleSchema = z99.object({
46442
- id: z99.string(),
46443
- shortDescription: z99.object({ text: z99.string().optional().catch(void 0) }).optional(),
46444
- defaultConfiguration: z99.object({ level: z99.string().optional().catch(void 0) }).optional(),
46445
- properties: z99.object({
46446
- precision: z99.string().optional().catch(void 0),
46447
- tags: z99.array(z99.string()).optional().catch(void 0),
46583
+ var SarifRuleSchema = z100.object({
46584
+ id: z100.string(),
46585
+ shortDescription: z100.object({ text: z100.string().optional().catch(void 0) }).optional(),
46586
+ defaultConfiguration: z100.object({ level: z100.string().optional().catch(void 0) }).optional(),
46587
+ properties: z100.object({
46588
+ precision: z100.string().optional().catch(void 0),
46589
+ tags: z100.array(z100.string()).optional().catch(void 0),
46448
46590
  // Accept the number form and normalize; `resolveSeverityFromScore`
46449
46591
  // parses it either way.
46450
- "security-severity": z99.union([z99.string(), z99.number()]).optional().catch(void 0)
46592
+ "security-severity": z100.union([z100.string(), z100.number()]).optional().catch(void 0)
46451
46593
  }).optional().catch(void 0),
46452
- helpUri: z99.string().optional().catch(void 0),
46453
- help: z99.object({ markdown: z99.string().optional().catch(void 0) }).optional()
46594
+ helpUri: z100.string().optional().catch(void 0),
46595
+ help: z100.object({ markdown: z100.string().optional().catch(void 0) }).optional()
46454
46596
  });
46455
- var SarifRunSchema = z99.object({
46456
- tool: z99.object({
46457
- driver: z99.object({
46458
- name: z99.string().optional(),
46459
- rules: z99.array(z99.unknown()).optional()
46597
+ var SarifRunSchema = z100.object({
46598
+ tool: z100.object({
46599
+ driver: z100.object({
46600
+ name: z100.string().optional(),
46601
+ rules: z100.array(z100.unknown()).optional()
46460
46602
  }).optional()
46461
46603
  }).optional(),
46462
- results: z99.array(z99.unknown()).nullish()
46604
+ results: z100.array(z100.unknown()).nullish()
46463
46605
  });
46464
- var SarifLogSchema = z99.object({
46465
- version: z99.string().optional(),
46466
- runs: z99.array(z99.unknown()).optional()
46606
+ var SarifLogSchema = z100.object({
46607
+ version: z100.string().optional(),
46608
+ runs: z100.array(z100.unknown()).optional()
46467
46609
  });
46468
46610
  var UNMAPPED_LEVEL_SEVERITY = "high";
46469
46611
  var MAX_MESSAGE_LENGTH = 2e3;
@@ -46731,18 +46873,18 @@ async function executeSecurityScan(input) {
46731
46873
  }
46732
46874
 
46733
46875
  // src/security/osv-lookup.ts
46734
- import { z as z100 } from "zod";
46876
+ import { z as z101 } from "zod";
46735
46877
  var logger44 = createLogger({ component: "osv-lookup" });
46736
46878
  var OSV_API_URL = "https://api.osv.dev/v1/query";
46737
46879
  var DEFAULT_TIMEOUT_MS4 = NETWORK_FETCH_TIMEOUT_MS;
46738
- var OsvVulnerabilitySchema = z100.object({
46739
- id: z100.string(),
46740
- summary: z100.string().optional(),
46741
- severity: z100.enum(["CRITICAL", "HIGH", "MODERATE", "LOW", "UNKNOWN"]).optional(),
46742
- aliases: z100.array(z100.string()).default([]),
46743
- affectedVersions: z100.string().optional(),
46744
- fixedVersion: z100.string().optional(),
46745
- url: z100.string().optional()
46880
+ var OsvVulnerabilitySchema = z101.object({
46881
+ id: z101.string(),
46882
+ summary: z101.string().optional(),
46883
+ severity: z101.enum(["CRITICAL", "HIGH", "MODERATE", "LOW", "UNKNOWN"]).optional(),
46884
+ aliases: z101.array(z101.string()).default([]),
46885
+ affectedVersions: z101.string().optional(),
46886
+ fixedVersion: z101.string().optional(),
46887
+ url: z101.string().optional()
46746
46888
  });
46747
46889
  var DEFAULT_OSV_CONFIG = {
46748
46890
  timeoutMs: DEFAULT_TIMEOUT_MS4
@@ -47495,7 +47637,7 @@ ${contextBlock}`;
47495
47637
  const strategy = config.votingStrategy ?? "higher_order";
47496
47638
  await postProgress(config, "Vote", `Running consensus with ${strategy} strategy...`);
47497
47639
  try {
47498
- const { executeVoting } = await import("./consensus-vote-YWUJNA4A.js");
47640
+ const { executeVoting } = await import("./consensus-vote-OL7DLZNL.js");
47499
47641
  const votingResult = await executeVoting(
47500
47642
  {
47501
47643
  proposal: buildVoteProposal(plan, research),
@@ -48204,7 +48346,7 @@ ${FINDINGS_FORMAT_INSTRUCTIONS}
48204
48346
  }
48205
48347
 
48206
48348
  // src/mcp/tools/pr-review-tool.ts
48207
- import { z as z102 } from "zod";
48349
+ import { z as z103 } from "zod";
48208
48350
  import { randomUUID as randomUUID13 } from "node:crypto";
48209
48351
 
48210
48352
  // src/audit/reviewed-diff-hash.ts
@@ -48240,17 +48382,17 @@ import { dirname as dirname3, isAbsolute, join as join11, resolve as resolve12 }
48240
48382
 
48241
48383
  // src/audit/pr-review-record.ts
48242
48384
  import * as crypto3 from "node:crypto";
48243
- import { z as z101 } from "zod";
48244
- var PrReviewVerdictSchema = z101.enum(["approve", "request_changes", "abstain"]);
48245
- var PrReviewVoteCountsSchema = z101.object({
48246
- approve: z101.number().int().nonnegative(),
48247
- request_changes: z101.number().int().nonnegative(),
48248
- abstain: z101.number().int().nonnegative(),
48249
- error: z101.number().int().nonnegative(),
48250
- total: z101.number().int().nonnegative()
48385
+ import { z as z102 } from "zod";
48386
+ var PrReviewVerdictSchema = z102.enum(["approve", "request_changes", "abstain"]);
48387
+ var PrReviewVoteCountsSchema = z102.object({
48388
+ approve: z102.number().int().nonnegative(),
48389
+ request_changes: z102.number().int().nonnegative(),
48390
+ abstain: z102.number().int().nonnegative(),
48391
+ error: z102.number().int().nonnegative(),
48392
+ total: z102.number().int().nonnegative()
48251
48393
  }).strict();
48252
- var PrReviewDiffSourceSchema = z101.enum(["canonical-git", "caller-supplied"]);
48253
- var PrReviewDiffProvenanceSchema = z101.object({
48394
+ var PrReviewDiffSourceSchema = z102.enum(["canonical-git", "caller-supplied"]);
48395
+ var PrReviewDiffProvenanceSchema = z102.object({
48254
48396
  /** How the reviewed diff was obtained. */
48255
48397
  source: PrReviewDiffSourceSchema,
48256
48398
  /**
@@ -48262,9 +48404,9 @@ var PrReviewDiffProvenanceSchema = z101.object({
48262
48404
  * per-file attribution is unavailable. `false` means "a diff, but the packer
48263
48405
  * saw it as one undifferentiated blob".
48264
48406
  */
48265
- fileBoundaries: z101.boolean()
48407
+ fileBoundaries: z102.boolean()
48266
48408
  }).strict();
48267
- var PrReviewSanitizationSchema = z101.object({
48409
+ var PrReviewSanitizationSchema = z102.object({
48268
48410
  /**
48269
48411
  * The canonical hash (same {@link computeReviewedDiffHash} form) of the
48270
48412
  * once-sanitized FULL diff. Equal to the record's `reviewedDiffHash` exactly
@@ -48282,14 +48424,14 @@ var PrReviewSanitizationSchema = z101.object({
48282
48424
  * not tell an auditor WHICH one moved it. This field isolates the
48283
48425
  * sanitization gap, which is the one `reviewedDiffHash` alone cannot show.
48284
48426
  */
48285
- sanitizedDiffHash: z101.string().length(64),
48427
+ sanitizedDiffHash: z102.string().length(64),
48286
48428
  /**
48287
48429
  * HTML comments the middleware stripped before dispatch. Non-zero with an
48288
48430
  * EQUAL `sanitizedDiffHash` is not a contradiction: the counter is over the
48289
48431
  * whole args object, the hash only over `prDiff`, so a comment stripped from
48290
48432
  * a sibling field increments one without moving the other.
48291
48433
  */
48292
- commentsRemoved: z101.number().int().nonnegative(),
48434
+ commentsRemoved: z102.number().int().nonnegative(),
48293
48435
  /**
48294
48436
  * How many FIELDS the sanitizer changed at all.
48295
48437
  *
@@ -48304,7 +48446,7 @@ var PrReviewSanitizationSchema = z101.object({
48304
48446
  * `fieldsModified === 0` is therefore the ONLY state that licenses "the
48305
48447
  * sanitizer removed nothing".
48306
48448
  */
48307
- fieldsModified: z101.number().int().nonnegative(),
48449
+ fieldsModified: z102.number().int().nonnegative(),
48308
48450
  /**
48309
48451
  * XML-like conversation-structure tags the sanitizer removed.
48310
48452
  *
@@ -48315,38 +48457,38 @@ var PrReviewSanitizationSchema = z101.object({
48315
48457
  * removal was routine. That is the reassurance an attacker wants, and it
48316
48458
  * costs them only an HTML comment.
48317
48459
  */
48318
- tagsRemoved: z101.number().int().nonnegative()
48460
+ tagsRemoved: z102.number().int().nonnegative()
48319
48461
  }).strict();
48320
- var PrReviewBudgetSourceSchema = z101.enum(["registry", "binding-cap-fallback"]);
48321
- var PrReviewPanelCoverageSchema = z101.object({
48462
+ var PrReviewBudgetSourceSchema = z102.enum(["registry", "binding-cap-fallback"]);
48463
+ var PrReviewPanelCoverageSchema = z102.object({
48322
48464
  /** `'full'` — the panel was sent the whole diff; `'partial'` — a packed subset. */
48323
- panelRead: z101.enum(["full", "partial"]),
48465
+ panelRead: z102.enum(["full", "partial"]),
48324
48466
  /** Files whose full diff the panel actually reviewed. */
48325
- reviewedFiles: z101.number().int().nonnegative(),
48467
+ reviewedFiles: z102.number().int().nonnegative(),
48326
48468
  /** Files in the original diff. */
48327
- totalFiles: z101.number().int().nonnegative(),
48469
+ totalFiles: z102.number().int().nonnegative(),
48328
48470
  /**
48329
48471
  * EVERY path the panel did not fully review — the complete list, never a
48330
48472
  * prefix of it. The summary stamp lists at most a few of these and says
48331
48473
  * `N dropped (k listed)`; this field is where the rest live.
48332
48474
  */
48333
- droppedFiles: z101.array(z101.string()),
48475
+ droppedFiles: z102.array(z102.string()),
48334
48476
  /** UTF-8 bytes of the diff text the panel actually read. */
48335
- reviewedBytes: z101.number().int().nonnegative(),
48477
+ reviewedBytes: z102.number().int().nonnegative(),
48336
48478
  /** UTF-8 bytes of the input diff. */
48337
- totalBytes: z101.number().int().nonnegative(),
48479
+ totalBytes: z102.number().int().nonnegative(),
48338
48480
  /** Where the panel-read budget came from. */
48339
48481
  budgetSource: PrReviewBudgetSourceSchema,
48340
48482
  /** The budget derivation (registry) or the fallback reason, verbatim. */
48341
- budgetDetail: z101.string()
48483
+ budgetDetail: z102.string()
48342
48484
  }).strict();
48343
- var PrReviewBindingBoundsSchema = z101.object({
48485
+ var PrReviewBindingBoundsSchema = z102.object({
48344
48486
  /** `'full'` — the hash covers every byte; `'prefix'` — only the first `boundBytes`. */
48345
- kind: z101.enum(["full", "prefix"]),
48487
+ kind: z102.enum(["full", "prefix"]),
48346
48488
  /** UTF-8 bytes the hash binds: `min(totalBytes, MAX_REVIEWED_DIFF_BYTES)`. */
48347
- boundBytes: z101.number().int().nonnegative()
48489
+ boundBytes: z102.number().int().nonnegative()
48348
48490
  }).strict();
48349
- var PrReviewRecordSchema = z101.object({
48491
+ var PrReviewRecordSchema = z102.object({
48350
48492
  /**
48351
48493
  * Schema version. '1.1' was the Option-C binding (#3831): the record binds to
48352
48494
  * `{prNumber, baseSha, reviewedDiffHash}` instead of the rejected `headSha`.
@@ -48374,22 +48516,22 @@ var PrReviewRecordSchema = z101.object({
48374
48516
  * in which fields it CAN carry, and reading it as 1.4 is safe because its
48375
48517
  * hash binds the same raw bytes. Tiers are labels; nothing orders them.
48376
48518
  */
48377
- version: z101.enum(["1.3", "1.4"]),
48519
+ version: z102.enum(["1.3", "1.4"]),
48378
48520
  /**
48379
48521
  * Monotonic sequence number (integer ≥ 0). Assigned as (max existing
48380
48522
  * sequence)+1 at write time. Sorted, the set of sequences must cover
48381
48523
  * 0..maxSeq with no gap (omission detection); DUPLICATE sequences are a
48382
48524
  * benign concurrent-fork signal, not tampering.
48383
48525
  */
48384
- sequence: z101.number().int().nonnegative(),
48526
+ sequence: z102.number().int().nonnegative(),
48385
48527
  /** The PR number the review covers. */
48386
- prNumber: z101.number().int().positive(),
48528
+ prNumber: z102.number().int().positive(),
48387
48529
  /**
48388
48530
  * The 40-hex BASE commit SHA the reviewed diff was computed against (the
48389
48531
  * `<base>..<head>` range base). Part of the Option-C binding so the gate knows
48390
48532
  * which range to recompute {@link reviewedDiffHash} over.
48391
48533
  */
48392
- baseSha: z101.string().regex(/^[0-9a-f]{40}$/, "baseSha must be a 40-char lowercase hex commit sha"),
48534
+ baseSha: z102.string().regex(/^[0-9a-f]{40}$/, "baseSha must be a 40-char lowercase hex commit sha"),
48393
48535
  /**
48394
48536
  * DIFF-BINDING (Option-C, #3831): sha256 of the canonical reviewed diff bytes
48395
48537
  * (see `audit/reviewed-diff-hash.ts` — pinned `git diff` invocation + 50k
@@ -48398,9 +48540,9 @@ var PrReviewRecordSchema = z101.object({
48398
48540
  * byte-identical to what the voters saw. Covered by the self-hash below, so it
48399
48541
  * cannot be edited to claim a different reviewed diff.
48400
48542
  */
48401
- reviewedDiffHash: z101.string().length(64),
48543
+ reviewedDiffHash: z102.string().length(64),
48402
48544
  /** ISO-8601 timestamp the review was recorded. */
48403
- recordedAt: z101.string().min(1),
48545
+ recordedAt: z102.string().min(1),
48404
48546
  /** The resolved aggregate verdict. */
48405
48547
  verdict: PrReviewVerdictSchema,
48406
48548
  /**
@@ -48408,13 +48550,13 @@ var PrReviewRecordSchema = z101.object({
48408
48550
  * `request_changes` with `verified: true` is a strict blocker; covered by the
48409
48551
  * hash so it cannot be flipped without detection.
48410
48552
  */
48411
- verified: z101.boolean(),
48553
+ verified: z102.boolean(),
48412
48554
  /** Per-decision voter tally from the pr_review aggregate. */
48413
48555
  voteCounts: PrReviewVoteCountsSchema,
48414
48556
  /** Truncated human-readable review summary for the reviewer record. */
48415
- summary: z101.string(),
48557
+ summary: z102.string(),
48416
48558
  /** Optional correlation/decision id linking to the cost rollup / trace. */
48417
- correlationId: z101.string().min(1).optional(),
48559
+ correlationId: z102.string().min(1).optional(),
48418
48560
  /**
48419
48561
  * What this record was DERIVED FROM (#4459). OPTIONAL by necessity: the
48420
48562
  * schema is `.strict()`, so a required field would reject every record
@@ -48449,9 +48591,9 @@ var PrReviewRecordSchema = z101.object({
48449
48591
  * Retained for audit texture but NOT covered by `hash` and NOT verified —
48450
48592
  * the record-set model is position-independent (mirrors #3927).
48451
48593
  */
48452
- previousHash: z101.string().length(64).optional(),
48594
+ previousHash: z102.string().length(64).optional(),
48453
48595
  /** SHA-256 over every field above EXCEPT `previousHash` (and except `hash`). */
48454
- hash: z101.string().length(64)
48596
+ hash: z102.string().length(64)
48455
48597
  }).strict();
48456
48598
  function projectPanelCoverage(c) {
48457
48599
  return {
@@ -49201,19 +49343,19 @@ var MAX_REPO_CONTEXT_LENGTH = 2e3;
49201
49343
  var MAX_TITLE_LENGTH = 500;
49202
49344
  var MAX_DESCRIPTION_LENGTH = 1e4;
49203
49345
  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.";
49204
- var PrReviewInputSchema = z102.object({
49205
- prTitle: z102.string().min(1).max(MAX_TITLE_LENGTH).describe("PR title"),
49206
- prDescription: z102.string().max(MAX_DESCRIPTION_LENGTH).optional().describe("PR body / description"),
49207
- prDiff: z102.string().min(1).max(MAX_DIFF_INPUT_LENGTH).refine(looksLikeUnifiedDiff, {
49346
+ var PrReviewInputSchema = z103.object({
49347
+ prTitle: z103.string().min(1).max(MAX_TITLE_LENGTH).describe("PR title"),
49348
+ prDescription: z103.string().max(MAX_DESCRIPTION_LENGTH).optional().describe("PR body / description"),
49349
+ prDiff: z103.string().min(1).max(MAX_DIFF_INPUT_LENGTH).refine(looksLikeUnifiedDiff, {
49208
49350
  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)."
49209
49351
  }).describe(
49210
49352
  `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.`
49211
49353
  ),
49212
- repoContext: z102.string().max(MAX_REPO_CONTEXT_LENGTH).optional().describe(
49354
+ repoContext: z103.string().max(MAX_REPO_CONTEXT_LENGTH).optional().describe(
49213
49355
  `Optional one-paragraph repo context (architecture, conventions; max ${String(MAX_REPO_CONTEXT_LENGTH)} chars; trim before calling)`
49214
49356
  ),
49215
- baseRef: z102.string().max(200).optional().describe("Base branch ref (e.g. main)"),
49216
- headRef: z102.string().max(200).optional().describe("Head branch ref"),
49357
+ baseRef: z103.string().max(200).optional().describe("Base branch ref (e.g. main)"),
49358
+ headRef: z103.string().max(200).optional().describe("Head branch ref"),
49217
49359
  /**
49218
49360
  * Option-C audit binding (#4031). When BOTH `prNumber` and `baseSha` are
49219
49361
  * supplied AND the review is live (not simulated), pr_review persists an
@@ -49229,14 +49371,14 @@ var PrReviewInputSchema = z102.object({
49229
49371
  * the PR opened and drifts as main advances), so pass the merge-base as
49230
49372
  * `baseSha` or the record will not match on an aged branch (#5692).
49231
49373
  */
49232
- prNumber: z102.number().int().positive().optional().describe("PR number \u2014 with baseSha, enables Option-C audit-record persistence (#4031)"),
49233
- baseSha: z102.string().regex(/^[0-9a-f]{40}$/, "baseSha must be a 40-char lowercase hex commit sha").optional().describe(
49374
+ prNumber: z103.number().int().positive().optional().describe("PR number \u2014 with baseSha, enables Option-C audit-record persistence (#4031)"),
49375
+ baseSha: z103.string().regex(/^[0-9a-f]{40}$/, "baseSha must be a 40-char lowercase hex commit sha").optional().describe(
49234
49376
  "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)"
49235
49377
  ),
49236
- repoPath: z102.string().max(1024).optional().describe(
49378
+ repoPath: z103.string().max(1024).optional().describe(
49237
49379
  "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."
49238
49380
  ),
49239
- simulate: z102.boolean().default(false).describe("Use simulated voters (testing only; never ship live with this true)"),
49381
+ simulate: z103.boolean().default(false).describe("Use simulated voters (testing only; never ship live with this true)"),
49240
49382
  /**
49241
49383
  * Error policy (#4132). `standard` (default) keeps the pre-#4132 aggregation:
49242
49384
  * an errored voter is simply excluded from the panel. `absolute_quorum` gates
@@ -49248,7 +49390,7 @@ var PrReviewInputSchema = z102.object({
49248
49390
  * verified approve. A genuine `request_changes` blocker still wins (Tiers 1-2
49249
49391
  * run first).
49250
49392
  */
49251
- errorPolicy: z102.enum(["standard", "absolute_quorum"]).default("standard").describe(
49393
+ errorPolicy: z103.enum(["standard", "absolute_quorum"]).default("standard").describe(
49252
49394
  "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."
49253
49395
  ),
49254
49396
  // #6123: same field as consensus_vote — the panel judges the caller's project.
@@ -49473,27 +49615,27 @@ function registerPrReviewTool(server, deps) {
49473
49615
  }
49474
49616
 
49475
49617
  // src/mcp/tools/survey-oss-landscape.ts
49476
- import { z as z103 } from "zod";
49477
- var SurveyOssLandscapeInputSchema = z103.object({
49478
- query: z103.string().min(1).max(200).describe('Free-text search query, e.g. "cargo nextest replacement" or "OSS SBOM tools"'),
49479
- maxResults: z103.number().int().min(1).max(50).optional().default(10).describe("Maximum candidates to return (1-50; default 10)"),
49480
- minStars: z103.number().int().min(0).optional().default(0).describe("Minimum star count to include (default 0; useful for filtering noise)"),
49481
- language: z103.string().max(50).optional().describe('GitHub language filter, e.g. "rust" or "typescript"')
49618
+ import { z as z104 } from "zod";
49619
+ var SurveyOssLandscapeInputSchema = z104.object({
49620
+ query: z104.string().min(1).max(200).describe('Free-text search query, e.g. "cargo nextest replacement" or "OSS SBOM tools"'),
49621
+ maxResults: z104.number().int().min(1).max(50).optional().default(10).describe("Maximum candidates to return (1-50; default 10)"),
49622
+ minStars: z104.number().int().min(0).optional().default(0).describe("Minimum star count to include (default 0; useful for filtering noise)"),
49623
+ language: z104.string().max(50).optional().describe('GitHub language filter, e.g. "rust" or "typescript"')
49482
49624
  });
49483
- var GitHubRepoSchema = z103.object({
49484
- full_name: z103.string().optional(),
49485
- html_url: z103.string().optional(),
49486
- description: z103.string().nullable().optional(),
49487
- stargazers_count: z103.number().optional(),
49488
- pushed_at: z103.string().nullable().optional(),
49489
- language: z103.string().nullable().optional(),
49490
- license: z103.object({
49491
- spdx_id: z103.string().nullable().optional()
49625
+ var GitHubRepoSchema = z104.object({
49626
+ full_name: z104.string().optional(),
49627
+ html_url: z104.string().optional(),
49628
+ description: z104.string().nullable().optional(),
49629
+ stargazers_count: z104.number().optional(),
49630
+ pushed_at: z104.string().nullable().optional(),
49631
+ language: z104.string().nullable().optional(),
49632
+ license: z104.object({
49633
+ spdx_id: z104.string().nullable().optional()
49492
49634
  }).nullable().optional()
49493
49635
  });
49494
- var GitHubSearchResponseSchema = z103.object({
49495
- total_count: z103.number().optional(),
49496
- items: z103.array(GitHubRepoSchema).optional()
49636
+ var GitHubSearchResponseSchema = z104.object({
49637
+ total_count: z104.number().optional(),
49638
+ items: z104.array(GitHubRepoSchema).optional()
49497
49639
  });
49498
49640
  var GITHUB_SEARCH_BASE = "https://api.github.com/search/repositories";
49499
49641
  function buildGithubQuery(input) {
@@ -49620,11 +49762,11 @@ function createSurveyHandler(deps) {
49620
49762
  };
49621
49763
  }
49622
49764
  var SURVEY_OUTPUT_SCHEMA = {
49623
- query: z103.string(),
49624
- totalFound: z103.number(),
49625
- candidates: z103.array(z103.unknown()),
49626
- sourcesQueried: z103.array(z103.string()),
49627
- sourcesFailed: z103.array(z103.string())
49765
+ query: z104.string(),
49766
+ totalFound: z104.number(),
49767
+ candidates: z104.array(z104.unknown()),
49768
+ sourcesQueried: z104.array(z104.string()),
49769
+ sourcesFailed: z104.array(z104.string())
49628
49770
  };
49629
49771
  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?".';
49630
49772
  function registerSurveyOssLandscapeTool(server, deps) {
@@ -49653,7 +49795,7 @@ function registerSurveyOssLandscapeTool(server, deps) {
49653
49795
  }
49654
49796
 
49655
49797
  // src/mcp/tools/vendor-publishing-audit.ts
49656
- import { z as z104 } from "zod";
49798
+ import { z as z105 } from "zod";
49657
49799
 
49658
49800
  // src/mcp/tools/vendor-publishing-seed.ts
49659
49801
  var VENDOR_PUBLISHING_SEED = {
@@ -49726,8 +49868,8 @@ function listKnownVendors() {
49726
49868
  }
49727
49869
 
49728
49870
  // src/mcp/tools/vendor-publishing-audit.ts
49729
- var VendorPublishingAuditInputSchema = z104.object({
49730
- vendor: z104.string().min(1).max(50).toLowerCase().describe('Vendor identifier, lowercase. e.g. "ubuntu", "debian", "fedora"')
49871
+ var VendorPublishingAuditInputSchema = z105.object({
49872
+ vendor: z105.string().min(1).max(50).toLowerCase().describe('Vendor identifier, lowercase. e.g. "ubuntu", "debian", "fedora"')
49731
49873
  });
49732
49874
  function lookupVendor(vendor) {
49733
49875
  if (isKnownVendor(vendor)) {
@@ -49759,20 +49901,20 @@ function createVendorPublishingAuditHandler(deps) {
49759
49901
  };
49760
49902
  }
49761
49903
  var VENDOR_PUBLISHING_OUTPUT_SCHEMA = {
49762
- vendor: z104.string(),
49763
- known: z104.boolean(),
49904
+ vendor: z105.string(),
49905
+ known: z105.boolean(),
49764
49906
  // Fields below populate when known=true; permissive optional for known=false.
49765
- sha256SumsUrlPattern: z104.string().optional(),
49766
- sha256SumsSignatureUrlPattern: z104.string().optional(),
49767
- signaturePattern: z104.string().optional(),
49768
- gpgKeys: z104.array(z104.unknown()).optional(),
49769
- releaseCadence: z104.string().optional(),
49770
- keyRotationNotes: z104.string().optional(),
49771
- vendorDocUrl: z104.string().optional(),
49772
- citedAt: z104.string().optional(),
49907
+ sha256SumsUrlPattern: z105.string().optional(),
49908
+ sha256SumsSignatureUrlPattern: z105.string().optional(),
49909
+ signaturePattern: z105.string().optional(),
49910
+ gpgKeys: z105.array(z105.unknown()).optional(),
49911
+ releaseCadence: z105.string().optional(),
49912
+ keyRotationNotes: z105.string().optional(),
49913
+ vendorDocUrl: z105.string().optional(),
49914
+ citedAt: z105.string().optional(),
49773
49915
  // Fields below populate when known=false.
49774
- message: z104.string().optional(),
49775
- knownVendors: z104.array(z104.string()).optional()
49916
+ message: z105.string().optional(),
49917
+ knownVendors: z105.array(z105.string()).optional()
49776
49918
  };
49777
49919
  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.";
49778
49920
  function registerVendorPublishingAuditTool(server, deps) {
@@ -49801,17 +49943,17 @@ function registerVendorPublishingAuditTool(server, deps) {
49801
49943
  }
49802
49944
 
49803
49945
  // src/mcp/tools/compare-data-feeds.ts
49804
- import { z as z105 } from "zod";
49946
+ import { z as z106 } from "zod";
49805
49947
  import * as path6 from "node:path";
49806
49948
  import * as fs7 from "node:fs";
49807
49949
  import * as yaml4 from "yaml";
49808
- var CompareDataFeedsInputSchema = z105.object({
49809
- feedAPath: z105.string().min(1).max(1e3).describe("Filesystem path to feed A (YAML or JSON, auto-detected by extension)"),
49810
- feedBPath: z105.string().min(1).max(1e3).describe("Filesystem path to feed B"),
49811
- keyPath: z105.string().min(1).max(200).describe(
49950
+ var CompareDataFeedsInputSchema = z106.object({
49951
+ feedAPath: z106.string().min(1).max(1e3).describe("Filesystem path to feed A (YAML or JSON, auto-detected by extension)"),
49952
+ feedBPath: z106.string().min(1).max(1e3).describe("Filesystem path to feed B"),
49953
+ keyPath: z106.string().min(1).max(200).describe(
49812
49954
  'Dotted path to the entry key, e.g. "id" or "name". Each entry must have this field.'
49813
49955
  ),
49814
- compareFields: z105.array(z105.string().min(1).max(200)).max(20).optional().describe(
49956
+ compareFields: z106.array(z106.string().min(1).max(200)).max(20).optional().describe(
49815
49957
  'Optional dotted field paths to compare across matched entries (e.g. ["license", "sha256"])'
49816
49958
  )
49817
49959
  });
@@ -49995,24 +50137,24 @@ function createCompareDataFeedsHandler(deps) {
49995
50137
  };
49996
50138
  }
49997
50139
  var COMPARE_OUTPUT_SCHEMA = {
49998
- feedAPath: z105.string(),
49999
- feedBPath: z105.string(),
50000
- keyPath: z105.string(),
50001
- counts: z105.object({
50002
- entriesInA: z105.number(),
50003
- entriesInB: z105.number(),
50004
- onlyInA: z105.number(),
50005
- onlyInB: z105.number(),
50006
- inBoth: z105.number(),
50007
- fieldDifferences: z105.number()
50140
+ feedAPath: z106.string(),
50141
+ feedBPath: z106.string(),
50142
+ keyPath: z106.string(),
50143
+ counts: z106.object({
50144
+ entriesInA: z106.number(),
50145
+ entriesInB: z106.number(),
50146
+ onlyInA: z106.number(),
50147
+ onlyInB: z106.number(),
50148
+ inBoth: z106.number(),
50149
+ fieldDifferences: z106.number()
50008
50150
  }),
50009
- coverage: z105.object({
50010
- onlyInA: z105.array(z105.string()),
50011
- onlyInB: z105.array(z105.string()),
50012
- inBoth: z105.array(z105.string())
50151
+ coverage: z106.object({
50152
+ onlyInA: z106.array(z106.string()),
50153
+ onlyInB: z106.array(z106.string()),
50154
+ inBoth: z106.array(z106.string())
50013
50155
  }),
50014
- fieldDifferences: z105.array(z105.unknown()),
50015
- summary: z105.string()
50156
+ fieldDifferences: z106.array(z106.unknown()),
50157
+ summary: z106.string()
50016
50158
  };
50017
50159
  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.";
50018
50160
  function registerCompareDataFeedsTool(server, deps) {
@@ -50041,9 +50183,9 @@ function registerCompareDataFeedsTool(server, deps) {
50041
50183
  }
50042
50184
 
50043
50185
  // src/mcp/tools/query-task-state-tool.ts
50044
- import { z as z106 } from "zod";
50045
- var QueryTaskStateInputSchema = z106.object({
50046
- taskId: z106.string().min(1).max(128).describe("Task ID whose structured state log should be read")
50186
+ import { z as z107 } from "zod";
50187
+ var QueryTaskStateInputSchema = z107.object({
50188
+ taskId: z107.string().min(1).max(128).describe("Task ID whose structured state log should be read")
50047
50189
  });
50048
50190
  function queryTaskStateHandler(args, ctx) {
50049
50191
  const parsed = QueryTaskStateInputSchema.safeParse(args);
@@ -50078,7 +50220,7 @@ function queryTaskStateHandler(args, ctx) {
50078
50220
  function registerQueryTaskStateTool(server, deps) {
50079
50221
  const logger57 = deps.logger ?? createLogger({ tool: "query_task_state" });
50080
50222
  const toolSchema = {
50081
- taskId: z106.string().min(1).max(128).describe("Task ID whose structured state log should be read")
50223
+ taskId: z107.string().min(1).max(128).describe("Task ID whose structured state log should be read")
50082
50224
  };
50083
50225
  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.";
50084
50226
  const secureHandler = createSecureHandler(queryTaskStateHandler, {
@@ -50100,28 +50242,28 @@ function registerQueryTaskStateTool(server, deps) {
50100
50242
  }
50101
50243
 
50102
50244
  // src/mcp/tools/ci-health-check-tool.ts
50103
- import { z as z109 } from "zod";
50245
+ import { z as z110 } from "zod";
50104
50246
 
50105
50247
  // src/mcp/tools/ci-health-log.ts
50106
50248
  import { appendFileSync as appendFileSync4, existsSync as existsSync11, readFileSync as readFileSync10, statSync as statSync2, writeFileSync as writeFileSync3 } from "node:fs";
50107
- import { z as z108 } from "zod";
50249
+ import { z as z109 } from "zod";
50108
50250
 
50109
50251
  // src/mcp/tools/ci-health-types.ts
50110
- import { z as z107 } from "zod";
50111
- var CiHealthStatusSchema = z107.enum(["healthy", "degraded", "outage", "unknown"]);
50252
+ import { z as z108 } from "zod";
50253
+ var CiHealthStatusSchema = z108.enum(["healthy", "degraded", "outage", "unknown"]);
50112
50254
 
50113
50255
  // src/mcp/tools/ci-health-log.ts
50114
50256
  var logger47 = createLogger({ component: "ci-health-log" });
50115
- var CiHealthEventSchema = z108.object({
50116
- v: z108.literal(1),
50117
- ts: z108.iso.datetime(),
50257
+ var CiHealthEventSchema = z109.object({
50258
+ v: z109.literal(1),
50259
+ ts: z109.iso.datetime(),
50118
50260
  status: CiHealthStatusSchema,
50119
- repo: z108.string().optional(),
50120
- signals: z108.array(
50121
- z108.object({
50122
- source: z108.enum(["github-status", "repo-activity-window"]),
50261
+ repo: z109.string().optional(),
50262
+ signals: z109.array(
50263
+ z109.object({
50264
+ source: z109.enum(["github-status", "repo-activity-window"]),
50123
50265
  status: CiHealthStatusSchema,
50124
- evidence: z108.string()
50266
+ evidence: z109.string()
50125
50267
  })
50126
50268
  )
50127
50269
  });
@@ -50201,17 +50343,17 @@ function eventFromCheck(params) {
50201
50343
  }
50202
50344
 
50203
50345
  // src/mcp/tools/ci-health-check-tool.ts
50204
- var CiHealthCheckInputSchema = z109.object({
50346
+ var CiHealthCheckInputSchema = z110.object({
50205
50347
  /**
50206
50348
  * Repo to check for the recent-runs activity signal (in `owner/repo` form).
50207
50349
  * Optional — when omitted, only the status-page signal is consulted.
50208
50350
  */
50209
- repo: z109.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."),
50351
+ repo: z110.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."),
50210
50352
  /**
50211
50353
  * How far back to look for recent-runs activity (minutes). Default 30 —
50212
50354
  * matches the typical wedge-detection window from the #3070 / #3076 outages.
50213
50355
  */
50214
- activityWindowMinutes: z109.number().int().min(5).max(180).default(30).describe("Recent-runs lookback window in minutes (5-180; default 30).")
50356
+ activityWindowMinutes: z110.number().int().min(5).max(180).default(30).describe("Recent-runs lookback window in minutes (5-180; default 30).")
50215
50357
  });
50216
50358
  var STATUS_PAGE_URL = "https://www.githubstatus.com/api/v2/components.json";
50217
50359
  function mapStatusPageStatus(raw) {
@@ -50344,8 +50486,8 @@ var DESCRIPTION = "Check CI infrastructure health before triggering / polling ru
50344
50486
  function registerCiHealthCheckTool(server, deps) {
50345
50487
  const logger57 = deps.logger ?? createLogger({ tool: "ci_health_check" });
50346
50488
  const toolSchema = {
50347
- repo: z109.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."),
50348
- activityWindowMinutes: z109.number().int().min(5).max(180).optional().describe("Recent-runs lookback window in minutes (5-180; default 30).")
50489
+ repo: z110.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."),
50490
+ activityWindowMinutes: z110.number().int().min(5).max(180).optional().describe("Recent-runs lookback window in minutes (5-180; default 30).")
50349
50491
  };
50350
50492
  const secureHandler = createSecureHandler((args) => ciHealthCheckHandler(args, logger57), {
50351
50493
  toolName: "ci_health_check",
@@ -50371,18 +50513,18 @@ function registerCiHealthCheckTool(server, deps) {
50371
50513
 
50372
50514
  // src/mcp/tools/quality-gate-tool.ts
50373
50515
  import { statSync as statSync3 } from "node:fs";
50374
- import { z as z110 } from "zod";
50375
- var QualityCheckSchema = z110.enum(["typecheck", "lint", "tests", "build", "security"]);
50516
+ import { z as z111 } from "zod";
50517
+ var QualityCheckSchema = z111.enum(["typecheck", "lint", "tests", "build", "security"]);
50376
50518
  var DEFAULT_CHECKS = ["typecheck", "lint", "tests"];
50377
- var RunQualityGateInputSchema = z110.object({
50519
+ var RunQualityGateInputSchema = z111.object({
50378
50520
  /** Project directory to run checks against. Must resolve inside the repo/cwd root. */
50379
- projectDir: z110.string().optional().describe(
50521
+ projectDir: z111.string().optional().describe(
50380
50522
  "Project directory to run checks against (default: cwd). Must stay inside the repo root."
50381
50523
  ),
50382
50524
  /** Which allowlisted checks to run. */
50383
- checks: z110.array(QualityCheckSchema).nonempty().default([...DEFAULT_CHECKS]).describe("Allowlisted checks to run (default: ['typecheck','lint','tests'])."),
50525
+ checks: z111.array(QualityCheckSchema).nonempty().default([...DEFAULT_CHECKS]).describe("Allowlisted checks to run (default: ['typecheck','lint','tests'])."),
50384
50526
  /** 1-based iteration counter, forwarded to the engine for feedback context. */
50385
- iteration: z110.number().int().min(1).default(1).describe("1-based iteration number (default 1).")
50527
+ iteration: z111.number().int().min(1).default(1).describe("1-based iteration number (default 1).")
50386
50528
  });
50387
50529
  function validateProjectDir(raw) {
50388
50530
  const candidate = raw ?? process.cwd();
@@ -50457,11 +50599,11 @@ var DESCRIPTION2 = "Run the QA quality gate (#1684 engine) against a project dir
50457
50599
  function registerRunQualityGateTool(server, deps) {
50458
50600
  const logger57 = deps.logger ?? createLogger({ tool: "run_quality_gate" });
50459
50601
  const toolSchema = {
50460
- projectDir: z110.string().optional().describe(
50602
+ projectDir: z111.string().optional().describe(
50461
50603
  "Project directory to run checks against (default: cwd). Must stay inside the repo root."
50462
50604
  ),
50463
- checks: z110.array(QualityCheckSchema).nonempty().optional().describe("Allowlisted checks to run (default: ['typecheck','lint','tests'])."),
50464
- iteration: z110.number().int().min(1).optional().describe("1-based iteration number (default 1).")
50605
+ checks: z111.array(QualityCheckSchema).nonempty().optional().describe("Allowlisted checks to run (default: ['typecheck','lint','tests'])."),
50606
+ iteration: z111.number().int().min(1).optional().describe("1-based iteration number (default 1).")
50465
50607
  };
50466
50608
  const secureHandler = createSecureHandler(
50467
50609
  (args) => runQualityGateHandler(args, logger57),
@@ -50491,9 +50633,9 @@ function registerRunQualityGateTool(server, deps) {
50491
50633
  // src/mcp/tools/verify-audit-chain-tool.ts
50492
50634
  import * as fs8 from "node:fs/promises";
50493
50635
  import * as path7 from "node:path";
50494
- import { z as z111 } from "zod";
50495
- var VerifyAuditChainInputSchema = z111.object({
50496
- logDir: z111.string().min(1).max(512).describe(
50636
+ import { z as z112 } from "zod";
50637
+ var VerifyAuditChainInputSchema = z112.object({
50638
+ logDir: z112.string().min(1).max(512).describe(
50497
50639
  "Filesystem path to the FileAuditStorage log directory. Tool reads all `audit-*.jsonl` files in lexicographic order and verifies the combined chain."
50498
50640
  )
50499
50641
  });
@@ -50583,7 +50725,7 @@ async function handler2(args, ctx) {
50583
50725
  function registerVerifyAuditChainTool(server, deps) {
50584
50726
  const logger57 = deps.logger ?? createLogger({ tool: "verify_audit_chain" });
50585
50727
  const toolSchema = {
50586
- logDir: z111.string().min(1).max(512).describe(
50728
+ logDir: z112.string().min(1).max(512).describe(
50587
50729
  "Filesystem path to the FileAuditStorage log directory. Tool reads all `audit-*.jsonl` files and verifies the combined hash chain."
50588
50730
  )
50589
50731
  };
@@ -50607,7 +50749,7 @@ function registerVerifyAuditChainTool(server, deps) {
50607
50749
  }
50608
50750
 
50609
50751
  // src/mcp/tools/suggest-research-tasks-tool.ts
50610
- import { z as z112 } from "zod";
50752
+ import { z as z113 } from "zod";
50611
50753
  var SUGGEST_RESEARCH_TASKS_NOTE = "Suggestions derived from external research (untrusted); review before acting \u2014 nothing was executed or filed.";
50612
50754
  var RESEARCH_BUDGET_MS = 2e4;
50613
50755
  var RESEARCH_TIMED_OUT = /* @__PURE__ */ Symbol("research-budget-exceeded");
@@ -50624,11 +50766,11 @@ async function withResearchBudget(p, ms) {
50624
50766
  if (timer !== void 0) clearTimeout(timer);
50625
50767
  }
50626
50768
  }
50627
- var SuggestResearchTasksInputSchema = z112.object({
50628
- topic: z112.string().optional().describe("Topic filter passed to research_discover. Optional."),
50629
- qualityThreshold: z112.number().min(0).max(10).optional().describe("Minimum quality score (0-10) a discovery must meet to be suggested. Optional."),
50630
- maxTriggers: z112.number().int().min(1).optional().describe("Max number of candidate tasks to return (>=1). Optional."),
50631
- existingTaskIds: z112.array(z112.string()).optional().describe("Known task IDs to skip (dedup). Optional.")
50769
+ var SuggestResearchTasksInputSchema = z113.object({
50770
+ topic: z113.string().optional().describe("Topic filter passed to research_discover. Optional."),
50771
+ qualityThreshold: z113.number().min(0).max(10).optional().describe("Minimum quality score (0-10) a discovery must meet to be suggested. Optional."),
50772
+ maxTriggers: z113.number().int().min(1).optional().describe("Max number of candidate tasks to return (>=1). Optional."),
50773
+ existingTaskIds: z113.array(z113.string()).optional().describe("Known task IDs to skip (dedup). Optional.")
50632
50774
  });
50633
50775
  function toTriggerConfig(input) {
50634
50776
  return {
@@ -50685,10 +50827,10 @@ var DESCRIPTION3 = "SUGGEST-ONLY: surface candidate pipeline tasks for human/orc
50685
50827
  function registerSuggestResearchTasksTool(server, deps) {
50686
50828
  const logger57 = deps.logger ?? createLogger({ tool: "suggest_research_tasks" });
50687
50829
  const toolSchema = {
50688
- topic: z112.string().optional().describe("Topic filter passed to research_discover. Optional."),
50689
- qualityThreshold: z112.number().min(0).max(10).optional().describe("Minimum quality score (0-10) a discovery must meet to be suggested. Optional."),
50690
- maxTriggers: z112.number().int().min(1).optional().describe("Max number of candidate tasks to return (>=1). Optional."),
50691
- existingTaskIds: z112.array(z112.string()).optional().describe("Known task IDs to skip (dedup). Optional.")
50830
+ topic: z113.string().optional().describe("Topic filter passed to research_discover. Optional."),
50831
+ qualityThreshold: z113.number().min(0).max(10).optional().describe("Minimum quality score (0-10) a discovery must meet to be suggested. Optional."),
50832
+ maxTriggers: z113.number().int().min(1).optional().describe("Max number of candidate tasks to return (>=1). Optional."),
50833
+ existingTaskIds: z113.array(z113.string()).optional().describe("Known task IDs to skip (dedup). Optional.")
50692
50834
  };
50693
50835
  const secureHandler = createSecureHandler(
50694
50836
  (args) => suggestResearchTasksHandler(args, logger57),
@@ -50716,7 +50858,7 @@ function registerSuggestResearchTasksTool(server, deps) {
50716
50858
  }
50717
50859
 
50718
50860
  // src/mcp/tools/run-tool.ts
50719
- import { z as z116 } from "zod";
50861
+ import { z as z117 } from "zod";
50720
50862
  import { randomUUID as randomUUID17 } from "node:crypto";
50721
50863
 
50722
50864
  // src/orchestration/meta-dispatcher.ts
@@ -51176,7 +51318,7 @@ function createMetaOrchestrator(options) {
51176
51318
 
51177
51319
  // src/orchestration/meta-shadow-selector.ts
51178
51320
  import { appendFileSync as appendFileSync5, existsSync as existsSync12, readFileSync as readFileSync11 } from "node:fs";
51179
- import { z as z113 } from "zod";
51321
+ import { z as z114 } from "zod";
51180
51322
  var SHADOW_STRATEGY_ARMS = [
51181
51323
  "single-shot",
51182
51324
  "dev-pipeline",
@@ -51263,19 +51405,19 @@ function createHydratableSelector() {
51263
51405
  var META_OUTCOME_SCHEMA_VERSION = 1;
51264
51406
  var HYDRATE_LOOKBACK_DAYS = 30;
51265
51407
  var HYDRATE_LOOKBACK_MS = HYDRATE_LOOKBACK_DAYS * 24 * 60 * 60 * 1e3;
51266
- var PersistedContextSchema = z113.object({
51267
- taskComplexity: z113.number(),
51268
- contextLengthNormalized: z113.number(),
51269
- isCodeTask: z113.number(),
51270
- isReasoningTask: z113.number(),
51271
- budgetUtilization: z113.number(),
51272
- timePressure: z113.number()
51408
+ var PersistedContextSchema = z114.object({
51409
+ taskComplexity: z114.number(),
51410
+ contextLengthNormalized: z114.number(),
51411
+ isCodeTask: z114.number(),
51412
+ isReasoningTask: z114.number(),
51413
+ budgetUtilization: z114.number(),
51414
+ timePressure: z114.number()
51273
51415
  });
51274
- var PersistedMetaOutcomeSchema = z113.object({
51275
- schema: z113.literal(META_OUTCOME_SCHEMA_VERSION),
51276
- timestamp: z113.string(),
51277
- strategy: z113.enum(SHADOW_STRATEGY_ARMS),
51278
- success: z113.boolean(),
51416
+ var PersistedMetaOutcomeSchema = z114.object({
51417
+ schema: z114.literal(META_OUTCOME_SCHEMA_VERSION),
51418
+ timestamp: z114.string(),
51419
+ strategy: z114.enum(SHADOW_STRATEGY_ARMS),
51420
+ success: z114.boolean(),
51279
51421
  context: PersistedContextSchema
51280
51422
  });
51281
51423
  var persistLogger = createLogger({ component: "MetaShadowSelector" });
@@ -51668,7 +51810,7 @@ function evaluateMetaStrategyReadiness(result, config = DEFAULT_META_STRATEGY_RE
51668
51810
  }
51669
51811
 
51670
51812
  // src/mcp/tools/dev-pipeline-tool.ts
51671
- import { z as z114 } from "zod";
51813
+ import { z as z115 } from "zod";
51672
51814
  import * as fs10 from "node:fs";
51673
51815
  import * as path9 from "node:path";
51674
51816
  import { randomUUID as randomUUID15 } from "node:crypto";
@@ -51821,36 +51963,36 @@ var DEV_PIPELINE_DRY_RUN_NOTE = "This was a dry run (plan+vote), which always ru
51821
51963
  function dispatchNoteFor(dryRun) {
51822
51964
  return dryRun ? DEV_PIPELINE_DRY_RUN_NOTE : DEV_PIPELINE_ASYNC_HINT;
51823
51965
  }
51824
- var DevPipelineInputSchema = z114.object({
51966
+ var DevPipelineInputSchema = z115.object({
51825
51967
  /** Direct task instructions. */
51826
- task: z114.string().max(1e4).optional().describe("Direct task instructions (what to build)"),
51968
+ task: z115.string().max(1e4).optional().describe("Direct task instructions (what to build)"),
51827
51969
  /** Path to a plan file (.md, .yaml, .txt) to use as input. */
51828
- planFile: z114.string().max(500).optional().describe("Path to a plan/spec file to use as input"),
51970
+ planFile: z115.string().max(500).optional().describe("Path to a plan/spec file to use as input"),
51829
51971
  /** Whether to run in dry-run mode (plan+vote only, no implementation). */
51830
- dryRun: z114.boolean().default(false).describe("If true, stop after plan+vote (no implementation)"),
51972
+ dryRun: z115.boolean().default(false).describe("If true, stop after plan+vote (no implementation)"),
51831
51973
  /** Maximum vote iterations before proceeding (default: 3). */
51832
- maxVoteIterations: z114.number().int().min(1).max(5).default(3).describe("Max plan\u2192vote iterations"),
51974
+ maxVoteIterations: z115.number().int().min(1).max(5).default(3).describe("Max plan\u2192vote iterations"),
51833
51975
  /** Maximum QA iterations per task (default: 3). */
51834
- maxQaIterations: z114.number().int().min(1).max(5).default(3).describe("Max QA review iterations per task"),
51976
+ maxQaIterations: z115.number().int().min(1).max(5).default(3).describe("Max QA review iterations per task"),
51835
51977
  /** Working directory for the pipeline (default: cwd). Used for security scan and context. */
51836
- workingDir: z114.string().max(500).optional().describe("Working directory (default: cwd)"),
51978
+ workingDir: z115.string().max(500).optional().describe("Working directory (default: cwd)"),
51837
51979
  /** GitHub issue number to track progress on. Updates posted as comments. */
51838
- issueNumber: z114.number().int().positive().optional().describe("GitHub issue to post progress to"),
51980
+ issueNumber: z115.number().int().positive().optional().describe("GitHub issue to post progress to"),
51839
51981
  /** GitHub repo (owner/name) for issue tracking. */
51840
- repo: z114.string().max(200).optional().describe("GitHub repo for issue tracking (e.g., owner/repo)"),
51982
+ repo: z115.string().max(200).optional().describe("GitHub repo for issue tracking (e.g., owner/repo)"),
51841
51983
  /** Task tracking backend: github, gitlab, or json (default: json). */
51842
- trackerBackend: z114.enum(["github", "gitlab", "json"]).default("json").describe("Task tracking backend for issue creation"),
51984
+ trackerBackend: z115.enum(["github", "gitlab", "json"]).default("json").describe("Task tracking backend for issue creation"),
51843
51985
  /** Labels to apply to created issues. */
51844
- labels: z114.array(z114.string()).optional().describe("Labels for created issues"),
51986
+ labels: z115.array(z115.string()).optional().describe("Labels for created issues"),
51845
51987
  /** Session ID for checkpoint/resume. Enables crash recovery. */
51846
- sessionId: z114.string().max(128).regex(/^[a-zA-Z0-9_-]+$/).optional().describe("Session ID for checkpoint/resume (crash recovery)"),
51988
+ sessionId: z115.string().max(128).regex(/^[a-zA-Z0-9_-]+$/).optional().describe("Session ID for checkpoint/resume (crash recovery)"),
51847
51989
  /**
51848
51990
  * TESTS ONLY — when true, voters return random decisions. Must not be used as
51849
51991
  * a fallback when adapters are unavailable; configure an adapter instead. (#2319)
51850
51992
  */
51851
- simulateVotes: z114.boolean().default(false).describe("TESTS ONLY \u2014 random output, must not be used for real decisions (#2319)"),
51993
+ simulateVotes: z115.boolean().default(false).describe("TESTS ONLY \u2014 random output, must not be used for real decisions (#2319)"),
51852
51994
  /** Voting strategy for consensus stages. */
51853
- votingStrategy: z114.enum([
51995
+ votingStrategy: z115.enum([
51854
51996
  "simple_majority",
51855
51997
  "supermajority",
51856
51998
  "unanimous",
@@ -51859,15 +52001,15 @@ var DevPipelineInputSchema = z114.object({
51859
52001
  "opinion_wise"
51860
52002
  ]).optional().describe("Voting strategy for plan approval (default: higher_order)"),
51861
52003
  /** Use 3 agents instead of 6 for faster voting. */
51862
- quickMode: z114.boolean().default(false).describe("Use 3 agents instead of 6 for faster consensus voting"),
52004
+ quickMode: z115.boolean().default(false).describe("Use 3 agents instead of 6 for faster consensus voting"),
51863
52005
  /** Maximum execution time per stage in milliseconds (min 30s, max 600s). */
51864
- timeoutMs: z114.number().int().min(3e4).max(6e5).optional().describe("Max time per stage in ms (30000-600000). Default: varies by stage complexity"),
52006
+ timeoutMs: z115.number().int().min(3e4).max(6e5).optional().describe("Max time per stage in ms (30000-600000). Default: varies by stage complexity"),
51865
52007
  /**
51866
52008
  * Pipeline execution mode — a REAL field on this tool, unrelated to async
51867
52009
  * dispatch. A caller who learned `mode: 'async'` elsewhere gets an error
51868
52010
  * naming `dispatch` rather than the bare enum message (#4968).
51869
52011
  */
51870
- mode: z114.enum(["autonomous", "harness"], { error: modeEnumErrorNamingDispatch }).default("autonomous").describe(
52012
+ mode: z115.enum(["autonomous", "harness"], { error: modeEnumErrorNamingDispatch }).default("autonomous").describe(
51871
52013
  "'autonomous': full pipeline. 'harness': stops after decompose, returns tasks for caller to implement. (Not the async switch \u2014 that is `dispatch`.)"
51872
52014
  ),
51873
52015
  /**
@@ -51881,11 +52023,11 @@ var DevPipelineInputSchema = z114.object({
51881
52023
  */
51882
52024
  dispatch: dispatchFieldDefaultSync("Ignored for dryRun."),
51883
52025
  /** Local pre-ship quality gate (typecheck/lint/tests) mode (#3356). */
51884
- qualityGate: z114.enum(["off", "advisory", "blocking"]).default("off").describe(
52026
+ qualityGate: z115.enum(["off", "advisory", "blocking"]).default("off").describe(
51885
52027
  "Pre-ship local quality gate. 'off' (default): skip. 'advisory': run + record feedback, never fail. 'blocking': a red gate fails the pipeline."
51886
52028
  ),
51887
52029
  /** Opt-in per-run token budget — a safety cap for unattended runs (#3395). */
51888
- maxBudgetTokens: z114.number().int().positive().optional().describe(
52030
+ maxBudgetTokens: z115.number().int().positive().optional().describe(
51889
52031
  "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)."
51890
52032
  )
51891
52033
  });
@@ -52113,20 +52255,20 @@ function registerDevPipelineTool(server, deps) {
52113
52255
  }
52114
52256
 
52115
52257
  // src/mcp/tools/pipeline-tool.ts
52116
- import { z as z115 } from "zod";
52258
+ import { z as z116 } from "zod";
52117
52259
  import * as fs11 from "node:fs";
52118
52260
  import * as path10 from "node:path";
52119
52261
  import { randomUUID as randomUUID16 } from "node:crypto";
52120
52262
  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.";
52121
- var PipelineInputSchema = z115.object({
52263
+ var PipelineInputSchema = z116.object({
52122
52264
  /** The task to execute. */
52123
- task: z115.string().min(5).max(1e4).describe("Task description \u2014 pipeline template auto-selected based on content"),
52265
+ task: z116.string().min(5).max(1e4).describe("Task description \u2014 pipeline template auto-selected based on content"),
52124
52266
  /** Path to a spec file (.md, .yaml) to use as task input. */
52125
- specFile: z115.string().max(500).optional().describe("Path to a spec file \u2014 content prepended to task for greenfield projects"),
52267
+ specFile: z116.string().max(500).optional().describe("Path to a spec file \u2014 content prepended to task for greenfield projects"),
52126
52268
  /** Override template — see `listTemplateIds()` for the canonical list (#2728). Auto-detected if omitted. */
52127
- template: z115.string().max(50).optional().describe(`Pipeline template override. Available: ${listTemplateIds().join(", ")}`),
52269
+ template: z116.string().max(50).optional().describe(`Pipeline template override. Available: ${listTemplateIds().join(", ")}`),
52128
52270
  /** Voting strategy for consensus stages. */
52129
- votingStrategy: z115.enum([
52271
+ votingStrategy: z116.enum([
52130
52272
  "simple_majority",
52131
52273
  "supermajority",
52132
52274
  "unanimous",
@@ -52137,11 +52279,11 @@ var PipelineInputSchema = z115.object({
52137
52279
  "Voting strategy for plan approval. simple_majority (default), supermajority (67%), unanimous, higher_order (Bayesian), proof_of_learning, opinion_wise"
52138
52280
  ),
52139
52281
  /** Use 3 agents instead of 6 for faster voting. */
52140
- quickMode: z115.boolean().default(false).describe("Use 3 agents instead of 6 for faster consensus voting"),
52282
+ quickMode: z116.boolean().default(false).describe("Use 3 agents instead of 6 for faster consensus voting"),
52141
52283
  /** Maximum execution time per stage in milliseconds (min 30s, max 600s). */
52142
- timeoutMs: z115.number().int().min(3e4).max(6e5).optional().describe("Max time per stage in ms (30000-600000). Default: varies by stage complexity"),
52284
+ timeoutMs: z116.number().int().min(3e4).max(6e5).optional().describe("Max time per stage in ms (30000-600000). Default: varies by stage complexity"),
52143
52285
  /** Stop after planning/voting (no implementation). */
52144
- dryRun: z115.boolean().default(false).describe("Stop after vote stage (no implementation)"),
52286
+ dryRun: z116.boolean().default(false).describe("Stop after vote stage (no implementation)"),
52145
52287
  /**
52146
52288
  * Dispatch mode (#3730). `sync` (default) runs the pipeline inline and
52147
52289
  * returns the result — but a real multi-stage adaptive run can exceed the
@@ -52152,7 +52294,7 @@ var PipelineInputSchema = z115.object({
52152
52294
  */
52153
52295
  ...asyncDispatchInputDefaultSync("Ignored for dryRun."),
52154
52296
  /** TESTS ONLY — random output, must not be used for real decisions. (#2319) */
52155
- simulateVotes: z115.boolean().default(false).describe("TESTS ONLY \u2014 random output, must not be used for real decisions (#2319)")
52297
+ simulateVotes: z116.boolean().default(false).describe("TESTS ONLY \u2014 random output, must not be used for real decisions (#2319)")
52156
52298
  });
52157
52299
  function buildOutput3(result, simulated) {
52158
52300
  return {
@@ -52326,9 +52468,9 @@ function registerPipelineTool(server, deps) {
52326
52468
  }
52327
52469
 
52328
52470
  // src/mcp/tools/run-tool.ts
52329
- var RunInputSchema = z116.object({
52330
- goal: z116.string().min(1).describe("Natural-language goal. nexus-agents selects how to execute it."),
52331
- forceStrategy: z116.enum([
52471
+ var RunInputSchema = z117.object({
52472
+ goal: z117.string().min(1).describe("Natural-language goal. nexus-agents selects how to execute it."),
52473
+ forceStrategy: z117.enum([
52332
52474
  "single-shot",
52333
52475
  "dev-pipeline",
52334
52476
  "pipeline",
@@ -52340,10 +52482,10 @@ var RunInputSchema = z116.object({
52340
52482
  ]).optional().describe(
52341
52483
  "Power-user override: force a specific strategy instead of letting the router choose."
52342
52484
  ),
52343
- requiresConsensus: z116.boolean().optional().describe("Hint: the task needs a multi-perspective consensus decision."),
52344
- dependencyStructure: z116.enum(["linear", "dag", "independent", "unknown"]).optional().describe("Hint: the dependency structure of the work."),
52345
- isNovel: z116.boolean().optional().describe("Hint: this kind of task has not been seen before."),
52346
- execute: z116.boolean().optional().describe(
52485
+ requiresConsensus: z117.boolean().optional().describe("Hint: the task needs a multi-perspective consensus decision."),
52486
+ dependencyStructure: z117.enum(["linear", "dag", "independent", "unknown"]).optional().describe("Hint: the dependency structure of the work."),
52487
+ isNovel: z117.boolean().optional().describe("Hint: this kind of task has not been seen before."),
52488
+ execute: z117.boolean().optional().describe(
52347
52489
  "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)."
52348
52490
  ),
52349
52491
  /**
@@ -52358,7 +52500,7 @@ var RunInputSchema = z116.object({
52358
52500
  * other, the call is REFUSED rather than executed: silently ignoring a
52359
52501
  * do-not-act flag is the one outcome a governance substrate cannot allow.
52360
52502
  */
52361
- dryRun: z116.boolean().optional().describe(
52503
+ dryRun: z117.boolean().optional().describe(
52362
52504
  "Plan and vote only, no implementation (#4806). Requires the dev-pipeline strategy \u2014 refused (never silently executed) when the router selects another."
52363
52505
  ),
52364
52506
  /**
@@ -52593,12 +52735,12 @@ function registerRunTool(server, deps) {
52593
52735
  }
52594
52736
 
52595
52737
  // src/mcp/tools/list-available-models-tool.ts
52596
- import { z as z117 } from "zod";
52738
+ import { z as z118 } from "zod";
52597
52739
  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.";
52598
52740
  var PROBE_TIMEOUT_MS = 12e3;
52599
- var ListAvailableModelsInputSchema = z117.object({
52600
- includeModelIds: z117.boolean().optional().describe("Include the full model-id list per transport (default false \u2192 sample of 5 only)."),
52601
- includeOpenRouter: z117.boolean().optional().describe("Probe the OpenRouter live catalog (default true).")
52741
+ var ListAvailableModelsInputSchema = z118.object({
52742
+ includeModelIds: z118.boolean().optional().describe("Include the full model-id list per transport (default false \u2192 sample of 5 only)."),
52743
+ includeOpenRouter: z118.boolean().optional().describe("Probe the OpenRouter live catalog (default true).")
52602
52744
  });
52603
52745
  async function probeSource(source, includeModelIds) {
52604
52746
  let timer;
@@ -52665,8 +52807,8 @@ async function listAvailableModelsHandler(args, deps, logger57) {
52665
52807
  function registerListAvailableModelsTool(server, deps) {
52666
52808
  const logger57 = deps.logger ?? createLogger({ tool: "list_available_models" });
52667
52809
  const toolSchema = {
52668
- includeModelIds: z117.boolean().optional().describe("Include the full model-id list per transport (default false \u2192 sample of 5 only)."),
52669
- includeOpenRouter: z117.boolean().optional().describe("Probe the OpenRouter live catalog (default true).")
52810
+ includeModelIds: z118.boolean().optional().describe("Include the full model-id list per transport (default false \u2192 sample of 5 only)."),
52811
+ includeOpenRouter: z118.boolean().optional().describe("Probe the OpenRouter live catalog (default true).")
52670
52812
  };
52671
52813
  const secureHandler = createSecureHandler(
52672
52814
  (args) => listAvailableModelsHandler(args, deps, logger57),
@@ -52690,7 +52832,7 @@ function registerListAvailableModelsTool(server, deps) {
52690
52832
  }
52691
52833
 
52692
52834
  // src/mcp/tools/pr-review-eval-types.ts
52693
- import { z as z118 } from "zod";
52835
+ import { z as z119 } from "zod";
52694
52836
  var PR_REVIEW_EVAL_ROLES = [
52695
52837
  "architect",
52696
52838
  "security",
@@ -52698,43 +52840,43 @@ var PR_REVIEW_EVAL_ROLES = [
52698
52840
  "catfish",
52699
52841
  "scope_steward"
52700
52842
  ];
52701
- var PrReviewEvalRoleSchema = z118.enum(PR_REVIEW_EVAL_ROLES);
52702
- var PrReviewCaseClassSchema = z118.enum(["buggy", "clean", "borderline"]);
52703
- var VoterEvalVerdictSchema = z118.object({
52843
+ var PrReviewEvalRoleSchema = z119.enum(PR_REVIEW_EVAL_ROLES);
52844
+ var PrReviewCaseClassSchema = z119.enum(["buggy", "clean", "borderline"]);
52845
+ var VoterEvalVerdictSchema = z119.object({
52704
52846
  /** Stable record id (e.g. `${runId}:${caseNumber}:${role}`). */
52705
- id: z118.string().min(1).max(160),
52847
+ id: z119.string().min(1).max(160),
52706
52848
  /** The pr_review run / batch this verdict belongs to. */
52707
- runId: z118.string().min(1).max(64),
52849
+ runId: z119.string().min(1).max(64),
52708
52850
  /** Dataset case identifier (the dataset's `number` field). */
52709
- caseNumber: z118.string().min(1).max(80),
52851
+ caseNumber: z119.string().min(1).max(80),
52710
52852
  /** Rubric class of the case (ground-truth label). */
52711
52853
  caseClass: PrReviewCaseClassSchema,
52712
52854
  /** The voter role being scored. */
52713
52855
  role: PrReviewEvalRoleSchema,
52714
52856
  /** Verified findings that matched a known bug. */
52715
- truePositives: z118.number().int().nonnegative(),
52857
+ truePositives: z119.number().int().nonnegative(),
52716
52858
  /** Verified findings on clean code that matched no known bug. */
52717
- falsePositives: z118.number().int().nonnegative(),
52859
+ falsePositives: z119.number().int().nonnegative(),
52718
52860
  /** Known bugs this voter failed to flag. */
52719
- falseNegatives: z118.number().int().nonnegative(),
52861
+ falseNegatives: z119.number().int().nonnegative(),
52720
52862
  /** Rubric version the ground truth was adjudicated under. */
52721
- rubricVersion: z118.string().min(1).max(32),
52863
+ rubricVersion: z119.string().min(1).max(32),
52722
52864
  /** ISO-8601 timestamp the verdict was recorded. */
52723
- timestamp: z118.string().min(1).max(40)
52865
+ timestamp: z119.string().min(1).max(40)
52724
52866
  });
52725
- var VoterEvalVerdictQuerySchema = z118.object({
52867
+ var VoterEvalVerdictQuerySchema = z119.object({
52726
52868
  role: PrReviewEvalRoleSchema.optional(),
52727
- runId: z118.string().min(1).max(64).optional(),
52869
+ runId: z119.string().min(1).max(64).optional(),
52728
52870
  caseClass: PrReviewCaseClassSchema.optional(),
52729
- rubricVersion: z118.string().min(1).max(32).optional(),
52871
+ rubricVersion: z119.string().min(1).max(32).optional(),
52730
52872
  /** ISO-8601 lower bound (inclusive) on `timestamp`. */
52731
- since: z118.string().optional(),
52873
+ since: z119.string().optional(),
52732
52874
  /** Most-recent-N cap. */
52733
- limit: z118.number().int().positive().optional()
52875
+ limit: z119.number().int().positive().optional()
52734
52876
  });
52735
52877
 
52736
52878
  // src/mcp/tools/supply-chain-tradeoff-panel.ts
52737
- import { z as z119 } from "zod";
52879
+ import { z as z120 } from "zod";
52738
52880
  import { randomUUID as randomUUID18 } from "node:crypto";
52739
52881
  var DEFAULT_AXES = [
52740
52882
  "build_time_determinism",
@@ -52756,16 +52898,16 @@ var FULL_PANEL = [
52756
52898
  "scope_steward"
52757
52899
  ];
52758
52900
  var QUICK_PANEL = ["architect", "security", "scope_steward"];
52759
- var SupplyChainTradeoffPanelInputSchema = z119.object({
52760
- proposal: z119.string().min(1).max(MAX_PROPOSAL_LENGTH).describe('The proposal under tradeoff review (e.g. "Should aegis-boot adopt cargo-nextest?")'),
52761
- axes: z119.array(z119.string().min(1).max(MAX_AXIS_NAME_LENGTH)).min(1).max(MAX_AXES).optional().describe(
52901
+ var SupplyChainTradeoffPanelInputSchema = z120.object({
52902
+ proposal: z120.string().min(1).max(MAX_PROPOSAL_LENGTH).describe('The proposal under tradeoff review (e.g. "Should aegis-boot adopt cargo-nextest?")'),
52903
+ axes: z120.array(z120.string().min(1).max(MAX_AXIS_NAME_LENGTH)).min(1).max(MAX_AXES).optional().describe(
52762
52904
  `Tradeoff axes to evaluate. Default: ${DEFAULT_AXES.join(", ")}. Custom axes accepted; max ${String(MAX_AXES)}.`
52763
52905
  ),
52764
- context: z119.string().max(MAX_CONTEXT_LENGTH).optional().describe(
52906
+ context: z120.string().max(MAX_CONTEXT_LENGTH).optional().describe(
52765
52907
  "Optional context: relevant repo state, dependency tree, vendor publishing patterns, etc."
52766
52908
  ),
52767
- quickMode: z119.boolean().optional().default(false).describe("Use 3 voters (architect, security, scope_steward) instead of 7"),
52768
- simulate: z119.boolean().optional().default(false).describe("Use simulated voters (testing only)"),
52909
+ quickMode: z120.boolean().optional().default(false).describe("Use 3 voters (architect, security, scope_steward) instead of 7"),
52910
+ simulate: z120.boolean().optional().default(false).describe("Use simulated voters (testing only)"),
52769
52911
  // #6123: same field as consensus_vote — the panel judges the caller's project.
52770
52912
  project: VoterProjectInputSchema,
52771
52913
  /**
@@ -53258,40 +53400,40 @@ var RiskLevel = /* @__PURE__ */ ((RiskLevel2) => {
53258
53400
  })(RiskLevel || {});
53259
53401
 
53260
53402
  // src/mcp/safety/stpa-schemas.ts
53261
- import { z as z120 } from "zod";
53262
- var HazardCategorySchema = z120.enum(HazardCategory);
53263
- var HazardSeveritySchema = z120.enum(HazardSeverity);
53264
- var ConstraintPrioritySchema = z120.enum(ConstraintPriority);
53265
- var RiskLevelSchema = z120.enum(RiskLevel);
53266
- var TriggerPatternSchema = z120.object({
53267
- parameter: z120.string().min(1),
53268
- matchType: z120.enum(["contains", "regex", "equals", "startsWith", "endsWith"]),
53269
- pattern: z120.string(),
53270
- reason: z120.string()
53403
+ import { z as z121 } from "zod";
53404
+ var HazardCategorySchema = z121.enum(HazardCategory);
53405
+ var HazardSeveritySchema = z121.enum(HazardSeverity);
53406
+ var ConstraintPrioritySchema = z121.enum(ConstraintPriority);
53407
+ var RiskLevelSchema = z121.enum(RiskLevel);
53408
+ var TriggerPatternSchema = z121.object({
53409
+ parameter: z121.string().min(1),
53410
+ matchType: z121.enum(["contains", "regex", "equals", "startsWith", "endsWith"]),
53411
+ pattern: z121.string(),
53412
+ reason: z121.string()
53271
53413
  });
53272
- var HazardSchema = z120.object({
53273
- id: z120.string().min(1),
53274
- description: z120.string(),
53414
+ var HazardSchema = z121.object({
53415
+ id: z121.string().min(1),
53416
+ description: z121.string(),
53275
53417
  category: HazardCategorySchema,
53276
53418
  severity: HazardSeveritySchema,
53277
- likelihood: z120.enum(["almost_certain", "likely", "possible", "unlikely", "rare"]),
53278
- triggerConditions: z120.array(z120.string()),
53279
- consequences: z120.array(z120.string())
53419
+ likelihood: z121.enum(["almost_certain", "likely", "possible", "unlikely", "rare"]),
53420
+ triggerConditions: z121.array(z121.string()),
53421
+ consequences: z121.array(z121.string())
53280
53422
  });
53281
- var UnsafeControlActionSchema = z120.object({
53282
- id: z120.string().min(1),
53283
- toolName: z120.string().min(1),
53284
- type: z120.enum(["not_provided", "provided_causes_hazard", "wrong_timing", "wrong_duration"]),
53285
- description: z120.string(),
53286
- unsafeContext: z120.string(),
53287
- relatedHazards: z120.array(z120.string()),
53288
- triggerPatterns: z120.array(TriggerPatternSchema).optional()
53423
+ var UnsafeControlActionSchema = z121.object({
53424
+ id: z121.string().min(1),
53425
+ toolName: z121.string().min(1),
53426
+ type: z121.enum(["not_provided", "provided_causes_hazard", "wrong_timing", "wrong_duration"]),
53427
+ description: z121.string(),
53428
+ unsafeContext: z121.string(),
53429
+ relatedHazards: z121.array(z121.string()),
53430
+ triggerPatterns: z121.array(TriggerPatternSchema).optional()
53289
53431
  });
53290
- var SafetyConstraintSchema = z120.object({
53291
- id: z120.string().min(1),
53292
- description: z120.string(),
53293
- mitigates: z120.array(z120.string()),
53294
- enforcement: z120.enum([
53432
+ var SafetyConstraintSchema = z121.object({
53433
+ id: z121.string().min(1),
53434
+ description: z121.string(),
53435
+ mitigates: z121.array(z121.string()),
53436
+ enforcement: z121.enum([
53295
53437
  "prevent",
53296
53438
  "require_confirmation",
53297
53439
  "alert",
@@ -53299,52 +53441,52 @@ var SafetyConstraintSchema = z120.object({
53299
53441
  "rate_limit",
53300
53442
  "require_privilege"
53301
53443
  ]),
53302
- validationFunction: z120.string().optional(),
53444
+ validationFunction: z121.string().optional(),
53303
53445
  priority: ConstraintPrioritySchema
53304
53446
  });
53305
- var PropertySchemaSchema = z120.object({
53306
- type: z120.string(),
53307
- description: z120.string().optional(),
53308
- enum: z120.array(z120.unknown()).optional(),
53309
- pattern: z120.string().optional(),
53310
- minimum: z120.number().optional(),
53311
- maximum: z120.number().optional()
53447
+ var PropertySchemaSchema = z121.object({
53448
+ type: z121.string(),
53449
+ description: z121.string().optional(),
53450
+ enum: z121.array(z121.unknown()).optional(),
53451
+ pattern: z121.string().optional(),
53452
+ minimum: z121.number().optional(),
53453
+ maximum: z121.number().optional()
53312
53454
  });
53313
- var ToolInputSchemaSchema = z120.object({
53314
- type: z120.string(),
53315
- properties: z120.record(z120.string(), PropertySchemaSchema).optional(),
53316
- required: z120.array(z120.string()).optional(),
53317
- additionalProperties: z120.boolean().optional()
53455
+ var ToolInputSchemaSchema = z121.object({
53456
+ type: z121.string(),
53457
+ properties: z121.record(z121.string(), PropertySchemaSchema).optional(),
53458
+ required: z121.array(z121.string()).optional(),
53459
+ additionalProperties: z121.boolean().optional()
53318
53460
  });
53319
- var ToolDefinitionSchema = z120.object({
53320
- name: z120.string().min(1),
53321
- description: z120.string(),
53461
+ var ToolDefinitionSchema = z121.object({
53462
+ name: z121.string().min(1),
53463
+ description: z121.string(),
53322
53464
  inputSchema: ToolInputSchemaSchema
53323
53465
  });
53324
- var AnalysisConfigurationSchema = z120.object({
53325
- includeLowSeverity: z120.boolean().default(true),
53326
- generateAllConstraints: z120.boolean().default(true),
53327
- checkInteractions: z120.boolean().default(true),
53328
- maxHazardsPerTool: z120.number().int().min(1).max(100).default(50),
53329
- categories: z120.array(HazardCategorySchema).default([])
53466
+ var AnalysisConfigurationSchema = z121.object({
53467
+ includeLowSeverity: z121.boolean().default(true),
53468
+ generateAllConstraints: z121.boolean().default(true),
53469
+ checkInteractions: z121.boolean().default(true),
53470
+ maxHazardsPerTool: z121.number().int().min(1).max(100).default(50),
53471
+ categories: z121.array(HazardCategorySchema).default([])
53330
53472
  });
53331
- var ConstraintViolationSchema = z120.object({
53332
- constraintId: z120.string().min(1),
53333
- constraintDescription: z120.string(),
53473
+ var ConstraintViolationSchema = z121.object({
53474
+ constraintId: z121.string().min(1),
53475
+ constraintDescription: z121.string(),
53334
53476
  severity: HazardSeveritySchema,
53335
- details: z120.string(),
53336
- remediation: z120.string()
53477
+ details: z121.string(),
53478
+ remediation: z121.string()
53337
53479
  });
53338
- var ValidationWarningSchema = z120.object({
53339
- code: z120.string().min(1),
53340
- message: z120.string(),
53341
- affected: z120.string()
53480
+ var ValidationWarningSchema = z121.object({
53481
+ code: z121.string().min(1),
53482
+ message: z121.string(),
53483
+ affected: z121.string()
53342
53484
  });
53343
- var ValidationResultSchema = z120.object({
53344
- valid: z120.boolean(),
53345
- toolName: z120.string().min(1),
53346
- violations: z120.array(ConstraintViolationSchema),
53347
- passed: z120.array(z120.string()),
53485
+ var ValidationResultSchema = z121.object({
53486
+ valid: z121.boolean(),
53487
+ toolName: z121.string().min(1),
53488
+ violations: z121.array(ConstraintViolationSchema),
53489
+ passed: z121.array(z121.string()),
53348
53490
  // Optional rather than required, deliberately. `ValidationResult` declares
53349
53491
  // both fields required because every result this package produces has them;
53350
53492
  // the schema is the lenient inbound edge for a result that arrived from
@@ -53355,10 +53497,10 @@ var ValidationResultSchema = z120.object({
53355
53497
  // "nothing was evaluated". The strict/lenient split is safe because nothing
53356
53498
  // bridges the two with `z.infer`: a parsed result will not typecheck as a
53357
53499
  // `ValidationResult` without handling the absent fields.
53358
- evaluated: z120.array(z120.string()).optional(),
53359
- notApplicable: z120.array(z120.string()).optional(),
53360
- warnings: z120.array(ValidationWarningSchema),
53361
- validatedAt: z120.date()
53500
+ evaluated: z121.array(z121.string()).optional(),
53501
+ notApplicable: z121.array(z121.string()).optional(),
53502
+ warnings: z121.array(ValidationWarningSchema),
53503
+ validatedAt: z121.date()
53362
53504
  });
53363
53505
 
53364
53506
  // src/mcp/safety/stpa-types.ts
@@ -54443,9 +54585,9 @@ var GeminiResponseParser = class {
54443
54585
  };
54444
54586
 
54445
54587
  // src/cli-adapters/router-types.ts
54446
- import { z as z121 } from "zod";
54447
- var RouterConfigSchema = z121.object({
54448
- preferCostEfficient: z121.boolean().default(false),
54588
+ import { z as z122 } from "zod";
54589
+ var RouterConfigSchema = z122.object({
54590
+ preferCostEfficient: z122.boolean().default(false),
54449
54591
  /**
54450
54592
  * @deprecated Declared but NEVER ENFORCED — nothing on the routing path
54451
54593
  * compares anything to it, and `composite-router.ts` measures
@@ -54454,51 +54596,51 @@ var RouterConfigSchema = z121.object({
54454
54596
  * because of this. Scheduled for removal in the next major (#5963); the
54455
54597
  * default is 50 here and in every other declaration since #5918.
54456
54598
  */
54457
- maxDecisionTimeMs: z121.number().min(1).max(1e3).default(50)
54599
+ maxDecisionTimeMs: z122.number().min(1).max(1e3).default(50)
54458
54600
  });
54459
54601
 
54460
54602
  // src/cli-adapters/agreement-cascade-types.ts
54461
- import { z as z122 } from "zod";
54462
- var AgreementCascadeConfigSchema = z122.object({
54463
- agreementThreshold: z122.number().min(0.5).max(1).default(0.7),
54464
- maxStages: z122.number().int().min(1).max(5).default(3),
54465
- modelTimeoutMs: z122.number().int().min(1e3).max(3e5).default(6e4)
54603
+ import { z as z123 } from "zod";
54604
+ var AgreementCascadeConfigSchema = z123.object({
54605
+ agreementThreshold: z123.number().min(0.5).max(1).default(0.7),
54606
+ maxStages: z123.number().int().min(1).max(5).default(3),
54607
+ modelTimeoutMs: z123.number().int().min(1e3).max(3e5).default(6e4)
54466
54608
  });
54467
54609
 
54468
54610
  // src/cli-adapters/agreement-cascade-router.ts
54469
54611
  var logger50 = createLogger({ component: "agreement-cascade-router" });
54470
54612
 
54471
54613
  // src/cli-adapters/task-classifier.ts
54472
- import { z as z123 } from "zod";
54473
- var ClassificationPatternsSchema = z123.object({
54474
- code: z123.array(z123.string()).readonly(),
54475
- research: z123.array(z123.string()).readonly(),
54476
- documentation: z123.array(z123.string()).readonly(),
54477
- analysis: z123.array(z123.string()).readonly()
54614
+ import { z as z124 } from "zod";
54615
+ var ClassificationPatternsSchema = z124.object({
54616
+ code: z124.array(z124.string()).readonly(),
54617
+ research: z124.array(z124.string()).readonly(),
54618
+ documentation: z124.array(z124.string()).readonly(),
54619
+ analysis: z124.array(z124.string()).readonly()
54478
54620
  });
54479
54621
 
54480
54622
  // src/cli-adapters/response-cache-types.ts
54481
- import { z as z124 } from "zod";
54482
- var ResponseCacheConfigSchema = z124.object({
54483
- defaultTTL: z124.number().min(1e3).max(36e5).default(3e5),
54623
+ import { z as z125 } from "zod";
54624
+ var ResponseCacheConfigSchema = z125.object({
54625
+ defaultTTL: z125.number().min(1e3).max(36e5).default(3e5),
54484
54626
  // 5 minutes
54485
- maxEntries: z124.number().min(10).max(1e5).default(1e3),
54486
- maxMemoryMB: z124.number().min(1).max(1e3).default(50),
54487
- cleanupInterval: z124.number().min(1e3).max(6e5).default(6e4),
54627
+ maxEntries: z125.number().min(10).max(1e5).default(1e3),
54628
+ maxMemoryMB: z125.number().min(1).max(1e3).default(50),
54629
+ cleanupInterval: z125.number().min(1e3).max(6e5).default(6e4),
54488
54630
  // 1 minute
54489
- enableLogging: z124.boolean().default(false)
54631
+ enableLogging: z125.boolean().default(false)
54490
54632
  });
54491
54633
 
54492
54634
  // src/cli-adapters/response-cache-utils.ts
54493
54635
  var logger51 = createLogger({ component: "ResponseCacheUtils" });
54494
54636
 
54495
54637
  // src/cli-adapters/unified-routing-types.ts
54496
- import { z as z125 } from "zod";
54497
- var UnifiedRoutingDecisionSchema = z125.object({
54498
- selectedCli: z125.string(),
54499
- confidence: z125.number().min(0).max(1),
54500
- reason: z125.string(),
54501
- strategy: z125.enum([
54638
+ import { z as z126 } from "zod";
54639
+ var UnifiedRoutingDecisionSchema = z126.object({
54640
+ selectedCli: z126.string(),
54641
+ confidence: z126.number().min(0).max(1),
54642
+ reason: z126.string(),
54643
+ strategy: z126.enum([
54502
54644
  "composite",
54503
54645
  "quality",
54504
54646
  "budget",
@@ -54510,60 +54652,60 @@ var UnifiedRoutingDecisionSchema = z125.object({
54510
54652
  "linucb",
54511
54653
  "direct"
54512
54654
  ]),
54513
- decisionTimeMs: z125.number().nonnegative(),
54514
- alternatives: z125.array(z125.string()).readonly(),
54515
- stagesExecuted: z125.array(z125.string()).readonly(),
54516
- withinBudget: z125.boolean().optional(),
54517
- estimatedComplexity: z125.enum(["simple", "moderate", "complex", "expert"]).optional(),
54518
- estimatedTokens: z125.number().int().positive().optional(),
54519
- topsisScore: z125.number().optional(),
54520
- ucbScore: z125.number().optional(),
54521
- resolvedAtStage: z125.number().int().nonnegative().optional(),
54522
- consensusReached: z125.boolean().optional(),
54523
- agreementScore: z125.number().min(0).max(1).optional(),
54524
- metadata: z125.record(z125.string(), z125.unknown()).optional()
54655
+ decisionTimeMs: z126.number().nonnegative(),
54656
+ alternatives: z126.array(z126.string()).readonly(),
54657
+ stagesExecuted: z126.array(z126.string()).readonly(),
54658
+ withinBudget: z126.boolean().optional(),
54659
+ estimatedComplexity: z126.enum(["simple", "moderate", "complex", "expert"]).optional(),
54660
+ estimatedTokens: z126.number().int().positive().optional(),
54661
+ topsisScore: z126.number().optional(),
54662
+ ucbScore: z126.number().optional(),
54663
+ resolvedAtStage: z126.number().int().nonnegative().optional(),
54664
+ consensusReached: z126.boolean().optional(),
54665
+ agreementScore: z126.number().min(0).max(1).optional(),
54666
+ metadata: z126.record(z126.string(), z126.unknown()).optional()
54525
54667
  });
54526
54668
 
54527
54669
  // src/learning/outcome-feedback-types.ts
54528
- import { z as z126 } from "zod";
54529
- var QualitySignalsSchema = z126.object({
54530
- testsPass: z126.boolean().optional(),
54531
- lintErrors: z126.number().int().min(0).optional(),
54532
- userApproved: z126.boolean().optional(),
54533
- retryCount: z126.number().int().min(0).default(0),
54534
- completionRatio: z126.number().min(0).max(1).default(1),
54535
- validStructure: z126.boolean().optional(),
54536
- coherenceScore: z126.number().min(0).max(1).optional()
54670
+ import { z as z127 } from "zod";
54671
+ var QualitySignalsSchema = z127.object({
54672
+ testsPass: z127.boolean().optional(),
54673
+ lintErrors: z127.number().int().min(0).optional(),
54674
+ userApproved: z127.boolean().optional(),
54675
+ retryCount: z127.number().int().min(0).default(0),
54676
+ completionRatio: z127.number().min(0).max(1).default(1),
54677
+ validStructure: z127.boolean().optional(),
54678
+ coherenceScore: z127.number().min(0).max(1).optional()
54537
54679
  });
54538
- var RoutingDecisionSchema = z126.object({
54539
- id: z126.uuid(),
54540
- timestamp: z126.iso.datetime(),
54541
- query: z126.string(),
54542
- routerType: z126.enum(["linucb", "preference", "quality", "cascade", "topsis"]),
54680
+ var RoutingDecisionSchema = z127.object({
54681
+ id: z127.uuid(),
54682
+ timestamp: z127.iso.datetime(),
54683
+ query: z127.string(),
54684
+ routerType: z127.enum(["linucb", "preference", "quality", "cascade", "topsis"]),
54543
54685
  // Optional so a row persisted before #5812 still parses. Absence is read as
54544
54686
  // unmeasured by `isRouterTypeMeasured`, never as measured.
54545
- routerTypeMeasured: z126.boolean().optional(),
54546
- selectedModel: z126.string(),
54547
- selectedTier: z126.enum(["strong", "weak"]).optional(),
54548
- armIndex: z126.number().int().min(0).optional(),
54549
- banditContext: z126.record(z126.string(), z126.unknown()).optional(),
54550
- queryFeatures: z126.record(z126.string(), z126.unknown()).optional(),
54551
- ucbScore: z126.number().optional(),
54552
- confidence: z126.number().min(0).max(1).optional(),
54553
- traceId: z126.string(),
54554
- domain: z126.string().optional()
54687
+ routerTypeMeasured: z127.boolean().optional(),
54688
+ selectedModel: z127.string(),
54689
+ selectedTier: z127.enum(["strong", "weak"]).optional(),
54690
+ armIndex: z127.number().int().min(0).optional(),
54691
+ banditContext: z127.record(z127.string(), z127.unknown()).optional(),
54692
+ queryFeatures: z127.record(z127.string(), z127.unknown()).optional(),
54693
+ ucbScore: z127.number().optional(),
54694
+ confidence: z127.number().min(0).max(1).optional(),
54695
+ traceId: z127.string(),
54696
+ domain: z127.string().optional()
54555
54697
  });
54556
- var TaskOutcomeSchema = z126.object({
54557
- routingDecisionId: z126.uuid(),
54558
- timestamp: z126.iso.datetime(),
54559
- outcomeClass: z126.enum(["success", "partial", "failure", "timeout", "error"]),
54560
- success: z126.boolean(),
54561
- qualityScore: z126.number().min(0).max(1),
54562
- durationMs: z126.number().min(0),
54563
- tokenUsage: z126.number().int().min(0),
54564
- errorMessage: z126.string().optional(),
54698
+ var TaskOutcomeSchema = z127.object({
54699
+ routingDecisionId: z127.uuid(),
54700
+ timestamp: z127.iso.datetime(),
54701
+ outcomeClass: z127.enum(["success", "partial", "failure", "timeout", "error"]),
54702
+ success: z127.boolean(),
54703
+ qualityScore: z127.number().min(0).max(1),
54704
+ durationMs: z127.number().min(0),
54705
+ tokenUsage: z127.number().int().min(0),
54706
+ errorMessage: z127.string().optional(),
54565
54707
  qualitySignals: QualitySignalsSchema,
54566
- traceId: z126.string()
54708
+ traceId: z127.string()
54567
54709
  });
54568
54710
  var DEFAULT_FEEDBACK_COLLECTOR_CONFIG = {
54569
54711
  maxPendingDecisions: 1e3,
@@ -54578,17 +54720,17 @@ var DEFAULT_FEEDBACK_COLLECTOR_CONFIG = {
54578
54720
  targetTokenUsage: 2e3,
54579
54721
  maxHistorySize: 1e4
54580
54722
  };
54581
- var FeedbackCollectorConfigSchema = z126.object({
54582
- maxPendingDecisions: z126.number().int().positive().default(1e3),
54583
- pendingTimeoutMs: z126.number().positive().default(3e5),
54584
- enableAutoReward: z126.boolean().default(true),
54585
- qualityWeight: z126.number().min(0).max(1).default(0.5),
54586
- speedWeight: z126.number().min(0).max(1).default(0.2),
54587
- efficiencyWeight: z126.number().min(0).max(1).default(0.2),
54588
- retryPenalty: z126.number().min(0).max(1).default(0.1),
54589
- targetDurationMs: z126.number().positive().default(5e3),
54590
- targetTokenUsage: z126.number().positive().default(2e3),
54591
- maxHistorySize: z126.number().int().positive().default(1e4)
54723
+ var FeedbackCollectorConfigSchema = z127.object({
54724
+ maxPendingDecisions: z127.number().int().positive().default(1e3),
54725
+ pendingTimeoutMs: z127.number().positive().default(3e5),
54726
+ enableAutoReward: z127.boolean().default(true),
54727
+ qualityWeight: z127.number().min(0).max(1).default(0.5),
54728
+ speedWeight: z127.number().min(0).max(1).default(0.2),
54729
+ efficiencyWeight: z127.number().min(0).max(1).default(0.2),
54730
+ retryPenalty: z127.number().min(0).max(1).default(0.1),
54731
+ targetDurationMs: z127.number().positive().default(5e3),
54732
+ targetTokenUsage: z127.number().positive().default(2e3),
54733
+ maxHistorySize: z127.number().int().positive().default(1e4)
54592
54734
  });
54593
54735
 
54594
54736
  // src/learning/outcome-feedback-helpers.ts
@@ -56708,4 +56850,4 @@ export {
56708
56850
  startPipelineEventBridge,
56709
56851
  shutdownPipelineEventBridge
56710
56852
  };
56711
- //# sourceMappingURL=chunk-SYMY2WZI.js.map
56853
+ //# sourceMappingURL=chunk-TZKXFJSF.js.map