nexus-agents 2.70.0 → 2.71.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/{chunk-L4XSIHF5.js → chunk-3BKVYSY6.js} +2 -2
  2. package/dist/{chunk-SU4667UB.js → chunk-7LHQBMBM.js} +2 -2
  3. package/dist/{chunk-5RMZQEP5.js → chunk-AGVLFRN7.js} +1247 -384
  4. package/dist/chunk-AGVLFRN7.js.map +1 -0
  5. package/dist/{chunk-7QWNOE23.js → chunk-KJCSRP34.js} +2 -2
  6. package/dist/{chunk-7ZPYV4HO.js → chunk-NER7H3RJ.js} +1 -1
  7. package/dist/chunk-NER7H3RJ.js.map +1 -0
  8. package/dist/{chunk-UMLBVSW4.js → chunk-POQQ7A5E.js} +1 -1
  9. package/dist/chunk-POQQ7A5E.js.map +1 -0
  10. package/dist/{chunk-PPGX45YS.js → chunk-U6BK5DQU.js} +3 -3
  11. package/dist/cli.js +90 -625
  12. package/dist/cli.js.map +1 -1
  13. package/dist/{consensus-vote-WUGHRBYE.js → consensus-vote-EXWACBMR.js} +2 -2
  14. package/dist/{factory-BHHC6C7W.js → factory-H5BYL4V5.js} +3 -3
  15. package/dist/index.d.ts +1 -1
  16. package/dist/index.js +7 -7
  17. package/dist/{issue-triage-TXQ7J6GG.js → issue-triage-4SEP4WID.js} +3 -3
  18. package/dist/{setup-command-VMN3XXZN.js → setup-command-5VGIQETA.js} +3 -3
  19. package/package.json +1 -1
  20. package/dist/chunk-5RMZQEP5.js.map +0 -1
  21. package/dist/chunk-7ZPYV4HO.js.map +0 -1
  22. package/dist/chunk-UMLBVSW4.js.map +0 -1
  23. /package/dist/{chunk-L4XSIHF5.js.map → chunk-3BKVYSY6.js.map} +0 -0
  24. /package/dist/{chunk-SU4667UB.js.map → chunk-7LHQBMBM.js.map} +0 -0
  25. /package/dist/{chunk-7QWNOE23.js.map → chunk-KJCSRP34.js.map} +0 -0
  26. /package/dist/{chunk-PPGX45YS.js.map → chunk-U6BK5DQU.js.map} +0 -0
  27. /package/dist/{consensus-vote-WUGHRBYE.js.map → consensus-vote-EXWACBMR.js.map} +0 -0
  28. /package/dist/{factory-BHHC6C7W.js.map → factory-H5BYL4V5.js.map} +0 -0
  29. /package/dist/{issue-triage-TXQ7J6GG.js.map → issue-triage-4SEP4WID.js.map} +0 -0
  30. /package/dist/{setup-command-VMN3XXZN.js.map → setup-command-5VGIQETA.js.map} +0 -0
@@ -36,7 +36,7 @@ import {
36
36
  withAccessPolicy,
37
37
  withProgressHeartbeat,
38
38
  wrapToolWithTimeout
39
- } from "./chunk-UMLBVSW4.js";
39
+ } from "./chunk-POQQ7A5E.js";
40
40
  import {
41
41
  REGISTRY_PATH,
42
42
  getProjectRoot,
@@ -49,7 +49,7 @@ import {
49
49
  import {
50
50
  IssueTriage,
51
51
  sanitizeInput
52
- } from "./chunk-7QWNOE23.js";
52
+ } from "./chunk-KJCSRP34.js";
53
53
  import {
54
54
  generateSecurityPlan
55
55
  } from "./chunk-LMRKHQG5.js";
@@ -69,7 +69,7 @@ import {
69
69
  clampTaskTtl,
70
70
  getAvailabilityCache,
71
71
  resolveFallback
72
- } from "./chunk-PPGX45YS.js";
72
+ } from "./chunk-U6BK5DQU.js";
73
73
  import {
74
74
  DEFAULTS
75
75
  } from "./chunk-L2LQ3TSV.js";
@@ -2032,9 +2032,9 @@ var TASK_CATEGORY_KEYWORDS = [
2032
2032
  [["document", "doc"], "documentation"],
2033
2033
  [["refactor"], "refactoring"]
2034
2034
  ];
2035
- function categorizeTaskByKeywords(description) {
2035
+ function categorizeTaskByKeywords(description2) {
2036
2036
  for (const [keywords, category] of TASK_CATEGORY_KEYWORDS) {
2037
- if (keywords.some((kw) => description.includes(kw))) {
2037
+ if (keywords.some((kw) => description2.includes(kw))) {
2038
2038
  return category;
2039
2039
  }
2040
2040
  }
@@ -2568,8 +2568,8 @@ async function persistMemoryAfterTask(params) {
2568
2568
  });
2569
2569
  return updatedState;
2570
2570
  }
2571
- function categorizeTaskType(description) {
2572
- const desc = description.toLowerCase();
2571
+ function categorizeTaskType(description2) {
2572
+ const desc = description2.toLowerCase();
2573
2573
  return categorizeTaskByKeywords(desc);
2574
2574
  }
2575
2575
  async function persistMemoryOnCleanup(params) {
@@ -6208,8 +6208,8 @@ function scoreRoleCapabilities(subtask, role, expertWeights) {
6208
6208
  const weight = expertWeights[role] ?? 1;
6209
6209
  return score * weight;
6210
6210
  }
6211
- function applyKeywordBoosts(scores, description) {
6212
- const desc = description.toLowerCase();
6211
+ function applyKeywordBoosts(scores, description2) {
6212
+ const desc = description2.toLowerCase();
6213
6213
  const boosts = [
6214
6214
  { keywords: ["code", "implement"], role: "code_expert" },
6215
6215
  { keywords: ["architecture", "design"], role: "architecture_expert" },
@@ -6273,7 +6273,7 @@ function selectExpertForSubtask(subtask, expertWeights) {
6273
6273
  }
6274
6274
 
6275
6275
  // src/agents/tech-lead-helpers.ts
6276
- function inferTaskType(description) {
6276
+ function inferTaskType(description2) {
6277
6277
  const typeKeywords = {
6278
6278
  implementation: ["implement", "create", "build", "develop", "write code"],
6279
6279
  refactoring: ["refactor", "improve", "optimize", "clean up"],
@@ -6285,16 +6285,16 @@ function inferTaskType(description) {
6285
6285
  };
6286
6286
  for (const [taskType, keywords] of Object.entries(typeKeywords)) {
6287
6287
  for (const keyword of keywords) {
6288
- if (description.includes(keyword)) {
6288
+ if (description2.includes(keyword)) {
6289
6289
  return taskType;
6290
6290
  }
6291
6291
  }
6292
6292
  }
6293
6293
  return "general";
6294
6294
  }
6295
- function extractRequirements(description) {
6295
+ function extractRequirements(description2) {
6296
6296
  const requirements = [];
6297
- const lines = description.split(/[.\n]/);
6297
+ const lines = description2.split(/[.\n]/);
6298
6298
  for (const line of lines) {
6299
6299
  const trimmed = line.trim();
6300
6300
  if (trimmed.length > 10 && (trimmed.includes("must") || trimmed.includes("should") || trimmed.includes("need") || trimmed.includes("require"))) {
@@ -6303,21 +6303,21 @@ function extractRequirements(description) {
6303
6303
  }
6304
6304
  return requirements.slice(0, 5);
6305
6305
  }
6306
- function identifyRisks(description) {
6306
+ function identifyRisks(description2) {
6307
6307
  const risks = [];
6308
- if (description.includes("database") || description.includes("migration")) {
6308
+ if (description2.includes("database") || description2.includes("migration")) {
6309
6309
  risks.push("Data integrity during changes");
6310
6310
  }
6311
- if (description.includes("security")) {
6311
+ if (description2.includes("security")) {
6312
6312
  risks.push("Security vulnerabilities if not thorough");
6313
6313
  }
6314
- if (description.includes("performance")) {
6314
+ if (description2.includes("performance")) {
6315
6315
  risks.push("Performance regression");
6316
6316
  }
6317
- if (description.includes("api") || description.includes("interface")) {
6317
+ if (description2.includes("api") || description2.includes("interface")) {
6318
6318
  risks.push("Breaking API changes");
6319
6319
  }
6320
- if (description.includes("concurrent") || description.includes("parallel")) {
6320
+ if (description2.includes("concurrent") || description2.includes("parallel")) {
6321
6321
  risks.push("Race conditions");
6322
6322
  }
6323
6323
  return risks;
@@ -6332,23 +6332,23 @@ function suggestApproach(taskType, complexity) {
6332
6332
  return `Low complexity ${taskType} task. Direct implementation with basic validation.`;
6333
6333
  }
6334
6334
  function heuristicAnalysis(task, options) {
6335
- const description = task.description.toLowerCase();
6335
+ const description2 = task.description.toLowerCase();
6336
6336
  const wordCount = task.description.split(/\s+/).length;
6337
6337
  let complexity = 3;
6338
6338
  if (wordCount > 100) complexity += 2;
6339
6339
  if (wordCount > 200) complexity += 2;
6340
- if (description.includes("security")) complexity += 1;
6341
- if (description.includes("architecture")) complexity += 1;
6342
- if (description.includes("refactor")) complexity += 1;
6340
+ if (description2.includes("security")) complexity += 1;
6341
+ if (description2.includes("architecture")) complexity += 1;
6342
+ if (description2.includes("refactor")) complexity += 1;
6343
6343
  complexity = Math.min(10, complexity);
6344
- const taskType = inferTaskType(description);
6345
- const requirements = extractRequirements(description);
6344
+ const taskType = inferTaskType(description2);
6345
+ const requirements = extractRequirements(description2);
6346
6346
  return {
6347
6347
  taskId: task.id,
6348
6348
  complexity,
6349
6349
  taskType,
6350
6350
  requirements,
6351
- risks: identifyRisks(description),
6351
+ risks: identifyRisks(description2),
6352
6352
  needsDecomposition: complexity >= options.decompositionThreshold,
6353
6353
  approach: suggestApproach(taskType, complexity),
6354
6354
  estimatedEffort: Math.ceil(complexity * 1.5)
@@ -6426,7 +6426,7 @@ function createSubtask(params) {
6426
6426
  baseId,
6427
6427
  num,
6428
6428
  parentTaskId,
6429
- description,
6429
+ description: description2,
6430
6430
  expectedOutput,
6431
6431
  deps,
6432
6432
  priority,
@@ -6436,7 +6436,7 @@ function createSubtask(params) {
6436
6436
  return {
6437
6437
  id: `${baseId}-${String(num)}`,
6438
6438
  parentTaskId,
6439
- description,
6439
+ description: description2,
6440
6440
  expectedOutput,
6441
6441
  dependencies: deps.map((d) => `${baseId}-${d}`),
6442
6442
  priority,
@@ -6757,13 +6757,13 @@ function buildBaseWorkflow(plan, steps, options) {
6757
6757
  };
6758
6758
  }
6759
6759
  function addDescription(workflow, plan, options) {
6760
- const description = generateDescription(
6760
+ const description2 = generateDescription(
6761
6761
  plan.analysis,
6762
6762
  options?.description,
6763
6763
  options?.includeAnalysis
6764
6764
  );
6765
- if (description !== void 0) {
6766
- workflow.description = description;
6765
+ if (description2 !== void 0) {
6766
+ workflow.description = description2;
6767
6767
  }
6768
6768
  }
6769
6769
  function addTimeout(workflow, estimatedDuration) {
@@ -8015,8 +8015,8 @@ function buildCodeExpertBaseOptions(options, expertOpts) {
8015
8015
  if (options.logger !== void 0) baseOptions.logger = options.logger;
8016
8016
  return baseOptions;
8017
8017
  }
8018
- function inferOperationType(description) {
8019
- const desc = description.toLowerCase();
8018
+ function inferOperationType(description2) {
8019
+ const desc = description2.toLowerCase();
8020
8020
  if (desc.includes("debug") || desc.includes("fix bug") || desc.includes("error")) {
8021
8021
  return "debugging";
8022
8022
  }
@@ -8043,9 +8043,9 @@ function generateHeuristicRecommendations(operationType) {
8043
8043
  return baseRecs;
8044
8044
  }
8045
8045
  }
8046
- function detectHeuristicWarnings(description) {
8046
+ function detectHeuristicWarnings(description2) {
8047
8047
  const warnings = [];
8048
- const desc = description.toLowerCase();
8048
+ const desc = description2.toLowerCase();
8049
8049
  if (desc.includes("database") || desc.includes("sql")) {
8050
8050
  warnings.push("Database changes may require migration");
8051
8051
  }
@@ -9024,9 +9024,9 @@ var VULNERABILITY_PATTERNS = [
9024
9024
  cweId: "CWE-942"
9025
9025
  }
9026
9026
  ];
9027
- function detectHeuristicVulnerabilities(description, options = {}) {
9027
+ function detectHeuristicVulnerabilities(description2, options = {}) {
9028
9028
  const vulnerabilities = [];
9029
- const desc = description.toLowerCase();
9029
+ const desc = description2.toLowerCase();
9030
9030
  let vulnId = 1;
9031
9031
  for (const p of VULNERABILITY_PATTERNS) {
9032
9032
  if (p.pattern.test(desc)) {
@@ -9347,9 +9347,9 @@ var COMPONENT_PATTERNS = [
9347
9347
  responsibilities: ["Business rules", "Domain operations", "Workflow management"]
9348
9348
  }
9349
9349
  ];
9350
- function identifyHeuristicPatterns(description) {
9350
+ function identifyHeuristicPatterns(description2) {
9351
9351
  const patterns = [];
9352
- const desc = description.toLowerCase();
9352
+ const desc = description2.toLowerCase();
9353
9353
  for (const match of ARCHITECTURE_PATTERNS) {
9354
9354
  if (match.pattern.test(desc)) {
9355
9355
  patterns.push({
@@ -9362,9 +9362,9 @@ function identifyHeuristicPatterns(description) {
9362
9362
  }
9363
9363
  return patterns.slice(0, 5);
9364
9364
  }
9365
- function identifyHeuristicComponents(description) {
9365
+ function identifyHeuristicComponents(description2) {
9366
9366
  const components = [];
9367
- const desc = description.toLowerCase();
9367
+ const desc = description2.toLowerCase();
9368
9368
  for (const cp of COMPONENT_PATTERNS) {
9369
9369
  if (cp.pattern.test(desc)) {
9370
9370
  components.push({
@@ -9395,8 +9395,8 @@ function generateHeuristicADRs(task, patterns) {
9395
9395
  }
9396
9396
  ];
9397
9397
  }
9398
- function inferAnalysisType(description) {
9399
- const desc = description.toLowerCase();
9398
+ function inferAnalysisType(description2) {
9399
+ const desc = description2.toLowerCase();
9400
9400
  if (desc.includes("pattern") || desc.includes("which approach")) {
9401
9401
  return "pattern_selection";
9402
9402
  }
@@ -9423,9 +9423,9 @@ function generateHeuristicRecommendations3(analysisType) {
9423
9423
  return base;
9424
9424
  }
9425
9425
  }
9426
- function detectArchitectureWarnings(description) {
9426
+ function detectArchitectureWarnings(description2) {
9427
9427
  const warnings = [];
9428
- const desc = description.toLowerCase();
9428
+ const desc = description2.toLowerCase();
9429
9429
  if (desc.includes("monolith") && desc.includes("microservice")) {
9430
9430
  warnings.push("Migration from monolith to microservices is complex - plan carefully");
9431
9431
  }
@@ -9751,8 +9751,8 @@ function createHeuristicCoverage() {
9751
9751
  ]
9752
9752
  };
9753
9753
  }
9754
- function assessHeuristicQuality(description) {
9755
- const desc = description.toLowerCase();
9754
+ function assessHeuristicQuality(description2) {
9755
+ const desc = description2.toLowerCase();
9756
9756
  const issues = [];
9757
9757
  if (desc.includes("flaky") || desc.includes("intermittent")) {
9758
9758
  issues.push("Flaky tests detected - improve test isolation");
@@ -9798,9 +9798,9 @@ function generateHeuristicRecommendations4(operationType) {
9798
9798
  return base;
9799
9799
  }
9800
9800
  }
9801
- function detectTestingWarnings(description) {
9801
+ function detectTestingWarnings(description2) {
9802
9802
  const warnings = [];
9803
- const desc = description.toLowerCase();
9803
+ const desc = description2.toLowerCase();
9804
9804
  if (desc.includes("database") || desc.includes("external")) {
9805
9805
  warnings.push("Integration tests with external dependencies need careful setup/teardown");
9806
9806
  }
@@ -9815,8 +9815,8 @@ function detectTestingWarnings(description) {
9815
9815
  }
9816
9816
  return warnings;
9817
9817
  }
9818
- function inferOperationType2(description) {
9819
- const desc = description.toLowerCase();
9818
+ function inferOperationType2(description2) {
9819
+ const desc = description2.toLowerCase();
9820
9820
  if (desc.includes("coverage") || desc.includes("uncovered")) {
9821
9821
  return "coverage_analysis";
9822
9822
  }
@@ -10127,9 +10127,9 @@ function generateHeuristicRecommendations5(docType) {
10127
10127
  return base;
10128
10128
  }
10129
10129
  }
10130
- function detectDocumentationWarnings(description) {
10130
+ function detectDocumentationWarnings(description2) {
10131
10131
  const warnings = [];
10132
- const desc = description.toLowerCase();
10132
+ const desc = description2.toLowerCase();
10133
10133
  if (desc.includes("internal") || desc.includes("private")) {
10134
10134
  warnings.push("Document internal APIs carefully - they may change");
10135
10135
  }
@@ -10144,8 +10144,8 @@ function detectDocumentationWarnings(description) {
10144
10144
  }
10145
10145
  return warnings;
10146
10146
  }
10147
- function inferDocumentationType(description) {
10148
- const desc = description.toLowerCase();
10147
+ function inferDocumentationType(description2) {
10148
+ const desc = description2.toLowerCase();
10149
10149
  if (desc.includes("api") || desc.includes("endpoint") || desc.includes("function doc")) {
10150
10150
  return "api";
10151
10151
  }
@@ -11742,14 +11742,14 @@ var TrinityStopReasonSchema = z13.enum(["verified", "max_iterations", "timeout",
11742
11742
  // src/agents/collaboration/trinity-helpers.ts
11743
11743
  function buildRoleTask(baseTask, role, context) {
11744
11744
  const rolePrompt = TRINITY_ROLE_PROMPTS[role];
11745
- const description = `${rolePrompt}
11745
+ const description2 = `${rolePrompt}
11746
11746
 
11747
11747
  ---
11748
11748
 
11749
11749
  Original Task: ${baseTask.description}
11750
11750
 
11751
11751
  ${context}`;
11752
- return { id: `${baseTask.id}-${role}`, description, context: baseTask.context };
11752
+ return { id: `${baseTask.id}-${role}`, description: description2, context: baseTask.context };
11753
11753
  }
11754
11754
  function extractSections(text) {
11755
11755
  const sections = {};
@@ -13158,8 +13158,8 @@ var SkillComposer = class {
13158
13158
  /**
13159
13159
  * Extracts keywords from task description.
13160
13160
  */
13161
- extractTaskKeywords(description) {
13162
- return description.toLowerCase().split(/\W+/).filter((word) => word.length > 2);
13161
+ extractTaskKeywords(description2) {
13162
+ return description2.toLowerCase().split(/\W+/).filter((word) => word.length > 2);
13163
13163
  }
13164
13164
  /**
13165
13165
  * Scores skills for a specific task.
@@ -15958,8 +15958,8 @@ var AGENT_PATTERN_MAP = {
15958
15958
  executor: "execution",
15959
15959
  terminator: "termination"
15960
15960
  };
15961
- function extractKeywords3(description) {
15962
- return description.toLowerCase().split(/\W+/).filter((word) => word.length > 2 && !STOPWORDS.has(word)).slice(0, 10);
15961
+ function extractKeywords3(description2) {
15962
+ return description2.toLowerCase().split(/\W+/).filter((word) => word.length > 2 && !STOPWORDS.has(word)).slice(0, 10);
15963
15963
  }
15964
15964
  function computeSimilarity(strings) {
15965
15965
  if (strings.length < 2) return 0;
@@ -23001,10 +23001,10 @@ function calculateZStatistic(params) {
23001
23001
  function calculateDifferenceCI(p1, p2, total1, total2, confidence) {
23002
23002
  const difference = p1 - p2;
23003
23003
  const seDiff = Math.sqrt(p1 * (1 - p1) / (total1 || 1) + p2 * (1 - p2) / (total2 || 1));
23004
- const z105 = getZScore(confidence);
23004
+ const z106 = getZScore(confidence);
23005
23005
  return {
23006
- lower: difference - z105 * seDiff,
23007
- upper: difference + z105 * seDiff,
23006
+ lower: difference - z106 * seDiff,
23007
+ upper: difference + z106 * seDiff,
23008
23008
  estimate: difference,
23009
23009
  confidence,
23010
23010
  n: total1 + total2,
@@ -23027,11 +23027,11 @@ function proportionConfidenceInterval(successes, total, options = {}) {
23027
23027
  standardError: 0
23028
23028
  };
23029
23029
  }
23030
- const z105 = getZScore(opts.confidence);
23031
- const z210 = z105 * z105;
23030
+ const z106 = getZScore(opts.confidence);
23031
+ const z210 = z106 * z106;
23032
23032
  const denominator = 1 + z210 / n;
23033
23033
  const center = (p + z210 / (2 * n)) / denominator;
23034
- const margin = z105 / denominator * Math.sqrt(p * (1 - p) / n + z210 / (4 * n * n));
23034
+ const margin = z106 / denominator * Math.sqrt(p * (1 - p) / n + z210 / (4 * n * n));
23035
23035
  const lower = Math.max(0, center - margin);
23036
23036
  const upper = Math.min(1, center + margin);
23037
23037
  const standardError = Math.sqrt(p * (1 - p) / n);
@@ -23061,8 +23061,8 @@ function meanConfidenceInterval(values, options = {}) {
23061
23061
  const variance = values.reduce((sum, v) => sum + (v - mean) ** 2, 0) / (n - 1 || 1);
23062
23062
  const stdDev = Math.sqrt(variance);
23063
23063
  const standardError = stdDev / Math.sqrt(n);
23064
- const z105 = getZScore(opts.confidence);
23065
- const margin = z105 * standardError;
23064
+ const z106 = getZScore(opts.confidence);
23065
+ const margin = z106 * standardError;
23066
23066
  return {
23067
23067
  lower: mean - margin,
23068
23068
  upper: mean + margin,
@@ -24684,9 +24684,9 @@ function generateTopicsTable(index) {
24684
24684
  "multi-agent-worker-dispatch": "Worker dispatch and wave execution"
24685
24685
  };
24686
24686
  const rows = topicStats.map((stat6) => {
24687
- const description = topicDescriptions[stat6.topic];
24687
+ const description2 = topicDescriptions[stat6.topic];
24688
24688
  const topicLink = `[${capitalizeWords(stat6.topic.replaceAll("-", " "))}](topics/${stat6.topic}/README.md)`;
24689
- return `| ${topicLink} | ${String(stat6.paperCount)} | ${String(stat6.techniqueCount)} | ${description ?? ""} |`;
24689
+ return `| ${topicLink} | ${String(stat6.paperCount)} | ${String(stat6.techniqueCount)} | ${description2 ?? ""} |`;
24690
24690
  });
24691
24691
  return `---
24692
24692
 
@@ -25349,7 +25349,7 @@ function registerCreateExpertTool(server, deps) {
25349
25349
  ]).describe("Expert role to create"),
25350
25350
  modelPreference: z44.string().max(100).optional().describe("Preferred model (e.g., claude-sonnet-4)")
25351
25351
  };
25352
- const description = "Create a specialized expert agent for code, architecture, security, documentation, testing, devops, research, product management, UX, or infrastructure tasks";
25352
+ const description2 = "Create a specialized expert agent for code, architecture, security, documentation, testing, devops, research, product management, UX, or infrastructure tasks";
25353
25353
  const secureHandler = createSecureHandler(createCreateExpertHandler(deps), {
25354
25354
  toolName: "create_expert",
25355
25355
  rateLimiter: deps.rateLimiter,
@@ -25359,7 +25359,7 @@ function registerCreateExpertTool(server, deps) {
25359
25359
  const wrappedHandler = wrapToolWithTimeout("create_expert", secureHandler, { timeoutMs, logger: logger56 });
25360
25360
  server.registerTool(
25361
25361
  "create_expert",
25362
- { description, inputSchema: toolSchema },
25362
+ { description: description2, inputSchema: toolSchema },
25363
25363
  toSdkCallback(wrappedHandler)
25364
25364
  );
25365
25365
  logger56.info("Registered create_expert tool with secure handler and timeout protection");
@@ -27020,12 +27020,12 @@ var logger17 = createLogger({ component: "CorePlugins" });
27020
27020
  function noopStageResult() {
27021
27021
  return { success: true, outputArtifacts: [], metadata: { stub: true } };
27022
27022
  }
27023
- function createCorePlugin(id, description, stages) {
27023
+ function createCorePlugin(id, description2, stages) {
27024
27024
  return {
27025
27025
  manifest: {
27026
27026
  id,
27027
27027
  version: "1.0.0",
27028
- description,
27028
+ description: description2,
27029
27029
  stages,
27030
27030
  requiredCapabilities: [],
27031
27031
  trustLevel: "core",
@@ -32932,7 +32932,7 @@ function registerOrchestrateTool(server, deps) {
32932
32932
  const logger56 = deps.logger ?? createLogger({ tool: "orchestrate" });
32933
32933
  const notifier = deps.notifier ?? createMcpNotifier(server);
32934
32934
  const depsWithNotifier = { ...deps, notifier };
32935
- const description = "Orchestrate a task by analyzing it, breaking it into subtasks if needed, and coordinating expert agents";
32935
+ const description2 = "Orchestrate a task by analyzing it, breaking it into subtasks if needed, and coordinating expert agents";
32936
32936
  const secureHandler = createSecureHandler(createOrchestrateHandler(depsWithNotifier), {
32937
32937
  toolName: "orchestrate",
32938
32938
  securityTier: "user-facing",
@@ -32945,7 +32945,7 @@ function registerOrchestrateTool(server, deps) {
32945
32945
  });
32946
32946
  server.registerTool(
32947
32947
  "orchestrate",
32948
- { description, inputSchema: ORCHESTRATE_TOOL_SCHEMA },
32948
+ { description: description2, inputSchema: ORCHESTRATE_TOOL_SCHEMA },
32949
32949
  toSdkCallback(wrappedHandler)
32950
32950
  );
32951
32951
  logger56.info("Registered orchestrate tool with secure handler and timeout protection");
@@ -34504,7 +34504,7 @@ function registerListExpertsTool(server, deps) {
34504
34504
  const toolSchema = {
34505
34505
  format: z56.enum(["full", "names"]).optional().describe("Output format: full (with details) or names (just role names)")
34506
34506
  };
34507
- const description = "List available expert types that can be created with create_expert. Returns role names, descriptions, and capabilities for each expert type.";
34507
+ const description2 = "List available expert types that can be created with create_expert. Returns role names, descriptions, and capabilities for each expert type.";
34508
34508
  const secureHandler = createSecureHandler(listExpertsHandler, {
34509
34509
  toolName: "list_experts",
34510
34510
  rateLimiter: deps.rateLimiter,
@@ -34525,7 +34525,7 @@ function registerListExpertsTool(server, deps) {
34525
34525
  };
34526
34526
  server.registerTool(
34527
34527
  "list_experts",
34528
- { description, inputSchema: toolSchema, outputSchema },
34528
+ { description: description2, inputSchema: toolSchema, outputSchema },
34529
34529
  toSdkCallback(wrappedHandler)
34530
34530
  );
34531
34531
  logger56.info("Registered list_experts tool with secure handler and timeout protection");
@@ -34589,7 +34589,7 @@ function registerListWorkflowsTool(server, deps) {
34589
34589
  category: z57.string().optional().describe("Filter by category (e.g., development, security)"),
34590
34590
  format: z57.enum(["full", "names"]).optional().describe("Output format: full (with details) or names (just template names)")
34591
34591
  };
34592
- const description = "List available workflow templates that can be executed with run_workflow. Returns template names, versions, descriptions, and categories.";
34592
+ const description2 = "List available workflow templates that can be executed with run_workflow. Returns template names, versions, descriptions, and categories.";
34593
34593
  const secureHandler = createSecureHandler(createListWorkflowsHandler(deps.workflowEngine), {
34594
34594
  toolName: "list_workflows",
34595
34595
  rateLimiter: deps.rateLimiter,
@@ -34615,7 +34615,7 @@ function registerListWorkflowsTool(server, deps) {
34615
34615
  };
34616
34616
  server.registerTool(
34617
34617
  "list_workflows",
34618
- { description, inputSchema: toolSchema, outputSchema },
34618
+ { description: description2, inputSchema: toolSchema, outputSchema },
34619
34619
  toSdkCallback(wrappedHandler)
34620
34620
  );
34621
34621
  logger56.info("Registered list_workflows tool with secure handler and timeout protection");
@@ -34826,10 +34826,10 @@ function sanitizeExpertSummary(summary) {
34826
34826
  function buildTask(input) {
34827
34827
  const autoTimeout = getExpertTaskTimeout(input.task);
34828
34828
  const timeoutMs = input.timeoutMs ?? autoTimeout;
34829
- let description = input.task;
34829
+ let description2 = input.task;
34830
34830
  if (input.previousExpertSummary !== void 0) {
34831
34831
  const sanitized = sanitizeExpertSummary(input.previousExpertSummary);
34832
- description = `[Previous expert context]
34832
+ description2 = `[Previous expert context]
34833
34833
  ${sanitized}
34834
34834
 
34835
34835
  [Your task]
@@ -34837,7 +34837,7 @@ ${input.task}`;
34837
34837
  }
34838
34838
  return {
34839
34839
  id: `exec-${String(getTimeProvider().now())}-${getRandomProvider().random().toString(36).slice(2, 9)}`,
34840
- description,
34840
+ description: description2,
34841
34841
  context: {
34842
34842
  metadata: input.context ?? {}
34843
34843
  },
@@ -35171,11 +35171,11 @@ function registerExecuteExpertTool(server, deps) {
35171
35171
  const logger56 = deps.logger ?? createLogger({ tool: "execute_expert" });
35172
35172
  const notifier = deps.notifier ?? createMcpNotifier(server);
35173
35173
  const depsWithNotifier = { ...deps, notifier };
35174
- const description = "Execute a task using a previously created expert agent. Returns the expert analysis including output, confidence, and token usage.";
35174
+ const description2 = "Execute a task using a previously created expert agent. Returns the expert analysis including output, confidence, and token usage.";
35175
35175
  server.experimental.tasks.registerToolTask(
35176
35176
  "execute_expert",
35177
35177
  {
35178
- description,
35178
+ description: description2,
35179
35179
  inputSchema: EXECUTE_EXPERT_TOOL_SCHEMA,
35180
35180
  execution: { taskSupport: "optional" }
35181
35181
  },
@@ -36552,7 +36552,7 @@ function registerResearchQueryTool(server, deps) {
36552
36552
  status: z61.enum(["implemented", "planned", "not-started", "rejected", "all"]).optional().describe("Filter by technique status"),
36553
36553
  threshold: z61.number().min(0).max(1).optional().describe("Overlap threshold (0-1) for overlap action")
36554
36554
  };
36555
- const description = "Query the research registry for technique status, overlaps, statistics, or text search. Provides read-only access to the research tracking system.";
36555
+ const description2 = "Query the research registry for technique status, overlaps, statistics, or text search. Provides read-only access to the research tracking system.";
36556
36556
  const secureHandler = createSecureHandler(createResearchQueryHandler(deps), {
36557
36557
  toolName: "research_query",
36558
36558
  rateLimiter: deps.rateLimiter,
@@ -36570,7 +36570,7 @@ function registerResearchQueryTool(server, deps) {
36570
36570
  };
36571
36571
  server.registerTool(
36572
36572
  "research_query",
36573
- { description, inputSchema: toolSchema, outputSchema },
36573
+ { description: description2, inputSchema: toolSchema, outputSchema },
36574
36574
  toSdkCallback(wrappedHandler)
36575
36575
  );
36576
36576
  logger56.info("Registered research_query tool with secure handler and timeout protection");
@@ -36648,7 +36648,7 @@ function registerResearchAddTool(server, deps) {
36648
36648
  priority: z62.enum(["P1", "P2", "P3", "P4"]).optional().describe("Priority level"),
36649
36649
  dryRun: z62.boolean().optional().default(false).describe("Preview without persisting")
36650
36650
  };
36651
- const description = "Add an arXiv paper to the research registry. Fetches metadata from the arXiv API and persists to the registry. Use dryRun=true to preview without saving.";
36651
+ const description2 = "Add an arXiv paper to the research registry. Fetches metadata from the arXiv API and persists to the registry. Use dryRun=true to preview without saving.";
36652
36652
  const secureHandler = createSecureHandler(createResearchAddHandler(deps), {
36653
36653
  toolName: "research_add",
36654
36654
  rateLimiter: deps.rateLimiter,
@@ -36668,7 +36668,7 @@ function registerResearchAddTool(server, deps) {
36668
36668
  };
36669
36669
  server.registerTool(
36670
36670
  "research_add",
36671
- { description, inputSchema: toolSchema, outputSchema },
36671
+ { description: description2, inputSchema: toolSchema, outputSchema },
36672
36672
  toSdkCallback(wrappedHandler)
36673
36673
  );
36674
36674
  logger56.info("Registered research_add tool with secure handler and timeout protection");
@@ -36850,7 +36850,7 @@ function registerResearchAddSourceTool(server, deps) {
36850
36850
  verdict_notes: z63.string().max(500).optional().describe("Verdict notes"),
36851
36851
  dryRun: z63.boolean().optional().default(false).describe("Preview only")
36852
36852
  };
36853
- const description = "Add a non-paper source (GitHub repo, tool, blog) to the research registry. Auto-computes quality_score from provided quality_signals. Use dryRun=true to preview without saving.";
36853
+ const description2 = "Add a non-paper source (GitHub repo, tool, blog) to the research registry. Auto-computes quality_score from provided quality_signals. Use dryRun=true to preview without saving.";
36854
36854
  const secureHandler = createSecureHandler(createResearchAddSourceHandler(deps), {
36855
36855
  toolName: "research_add_source",
36856
36856
  securityTier: "external",
@@ -36864,7 +36864,7 @@ function registerResearchAddSourceTool(server, deps) {
36864
36864
  });
36865
36865
  server.registerTool(
36866
36866
  "research_add_source",
36867
- { description, inputSchema: toolSchema, outputSchema: RESEARCH_ADD_SOURCE_OUTPUT_SCHEMA },
36867
+ { description: description2, inputSchema: toolSchema, outputSchema: RESEARCH_ADD_SOURCE_OUTPUT_SCHEMA },
36868
36868
  toSdkCallback(wrappedHandler)
36869
36869
  );
36870
36870
  }
@@ -37176,7 +37176,7 @@ function registerResearchDiscoverTool(server, deps) {
37176
37176
  sinceDate: z64.string().optional().describe("Only results after this date (YYYY-MM-DD)"),
37177
37177
  relevanceThreshold: z64.number().min(0).max(1).optional().describe("Minimum relevance score (0-1) to include results. Higher = stricter filtering.")
37178
37178
  };
37179
- const description = "Discover new research papers and repositories from external sources. Searches arXiv, GitHub, and other sources. Filters out items already in the registry.";
37179
+ const description2 = "Discover new research papers and repositories from external sources. Searches arXiv, GitHub, and other sources. Filters out items already in the registry.";
37180
37180
  const secureHandler = createSecureHandler(createResearchDiscoverHandler(deps), {
37181
37181
  toolName: "research_discover",
37182
37182
  rateLimiter: deps.rateLimiter,
@@ -37189,7 +37189,7 @@ function registerResearchDiscoverTool(server, deps) {
37189
37189
  });
37190
37190
  server.registerTool(
37191
37191
  "research_discover",
37192
- { description, inputSchema: toolSchema, outputSchema: RESEARCH_DISCOVER_OUTPUT_SCHEMA },
37192
+ { description: description2, inputSchema: toolSchema, outputSchema: RESEARCH_DISCOVER_OUTPUT_SCHEMA },
37193
37193
  toSdkCallback(wrappedHandler)
37194
37194
  );
37195
37195
  logger56.info("Registered research_discover tool with secure handler and timeout protection");
@@ -37456,7 +37456,7 @@ function registerResearchAnalyzeTool(server, deps) {
37456
37456
  focus: z65.enum(["gaps", "trends", "priorities", "stale", "coverage"]).describe("Analysis focus area"),
37457
37457
  topic: z65.string().optional().describe("Optional topic filter")
37458
37458
  };
37459
- const description = "Analyze the research registry for gaps, trends, priorities, stale entries, or coverage. Returns structured analysis with recommendations.";
37459
+ const description2 = "Analyze the research registry for gaps, trends, priorities, stale entries, or coverage. Returns structured analysis with recommendations.";
37460
37460
  const secureHandler = createSecureHandler(createResearchAnalyzeHandler(deps), {
37461
37461
  toolName: "research_analyze",
37462
37462
  rateLimiter: deps.rateLimiter,
@@ -37475,7 +37475,7 @@ function registerResearchAnalyzeTool(server, deps) {
37475
37475
  };
37476
37476
  server.registerTool(
37477
37477
  "research_analyze",
37478
- { description, inputSchema: toolSchema, outputSchema },
37478
+ { description: description2, inputSchema: toolSchema, outputSchema },
37479
37479
  toSdkCallback(wrappedHandler)
37480
37480
  );
37481
37481
  logger56.info("Registered research_analyze tool with secure handler and timeout protection");
@@ -37623,7 +37623,7 @@ function registerResearchCatalogReviewTool(server, deps) {
37623
37623
  topic: z66.string().optional().describe("Topic for approved papers"),
37624
37624
  createIssue: z66.boolean().optional().describe("Create GitHub issue when approving")
37625
37625
  };
37626
- const description = "Review auto-cataloged research references found during tool execution. List pending references, approve them for registry addition, dismiss, or clear all.";
37626
+ const description2 = "Review auto-cataloged research references found during tool execution. List pending references, approve them for registry addition, dismiss, or clear all.";
37627
37627
  const secureHandler = createSecureHandler(createCatalogReviewHandler(deps), {
37628
37628
  toolName: "research_catalog_review",
37629
37629
  rateLimiter: deps.rateLimiter,
@@ -37642,7 +37642,7 @@ function registerResearchCatalogReviewTool(server, deps) {
37642
37642
  };
37643
37643
  server.registerTool(
37644
37644
  "research_catalog_review",
37645
- { description, inputSchema: toolSchema, outputSchema },
37645
+ { description: description2, inputSchema: toolSchema, outputSchema },
37646
37646
  toSdkCallback(wrappedHandler)
37647
37647
  );
37648
37648
  logger56.info("Registered research_catalog_review tool");
@@ -37674,7 +37674,7 @@ function registerResearchSynthesizeTool(server, deps) {
37674
37674
  const toolSchema = {
37675
37675
  topic: z67.string().optional().describe("Optional topic filter for single-cluster synthesis")
37676
37676
  };
37677
- 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.";
37677
+ const description2 = "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.";
37678
37678
  const secureHandler = createSecureHandler(createResearchSynthesizeHandler(deps), {
37679
37679
  toolName: "research_synthesize",
37680
37680
  rateLimiter: deps.rateLimiter,
@@ -37693,7 +37693,7 @@ function registerResearchSynthesizeTool(server, deps) {
37693
37693
  };
37694
37694
  server.registerTool(
37695
37695
  "research_synthesize",
37696
- { description, inputSchema: toolSchema, outputSchema },
37696
+ { description: description2, inputSchema: toolSchema, outputSchema },
37697
37697
  toSdkCallback(wrappedHandler)
37698
37698
  );
37699
37699
  logger56.info("Registered research_synthesize tool");
@@ -37755,7 +37755,7 @@ function registerIssueTriageTool(server, deps) {
37755
37755
  issueUrl: z68.string().min(1).describe("GitHub issue URL (e.g., https://github.com/owner/repo/issues/123)"),
37756
37756
  dryRun: z68.boolean().optional().default(true).describe("Read-only mode (default: true)")
37757
37757
  };
37758
- 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.";
37758
+ const description2 = "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.";
37759
37759
  const secureHandler = createSecureHandler(createIssueTriageHandler(deps), {
37760
37760
  toolName: "issue_triage",
37761
37761
  securityTier: "external",
@@ -37769,7 +37769,7 @@ function registerIssueTriageTool(server, deps) {
37769
37769
  });
37770
37770
  server.registerTool(
37771
37771
  "issue_triage",
37772
- { description, inputSchema: toolSchema },
37772
+ { description: description2, inputSchema: toolSchema },
37773
37773
  toSdkCallback(wrappedHandler)
37774
37774
  );
37775
37775
  logger56.info("Registered issue_triage tool with secure handler and timeout protection");
@@ -38719,10 +38719,10 @@ function registerExecuteSpecTool(server, deps) {
38719
38719
  ),
38720
38720
  dryRun: z70.boolean().optional().describe("Parse and decompose only (no execution)")
38721
38721
  };
38722
- const description = "Execute a markdown specification through the full pipeline: parse, decompose into task DAG, compile to graph, execute, validate against acceptance criteria, and analyze failures.";
38722
+ const description2 = "Execute a markdown specification through the full pipeline: parse, decompose into task DAG, compile to graph, execute, validate against acceptance criteria, and analyze failures.";
38723
38723
  server.registerTool(
38724
38724
  "execute_spec",
38725
- { description, inputSchema: toolSchema },
38725
+ { description: description2, inputSchema: toolSchema },
38726
38726
  toSdkCallback(wrapped)
38727
38727
  );
38728
38728
  logger56.info("Registered execute_spec tool");
@@ -38861,7 +38861,7 @@ function registerMemoryQueryTool(server, deps) {
38861
38861
  limit: z71.number().int().min(1).max(50).optional().describe("Maximum results to return (default: 10, max: 50)"),
38862
38862
  source: z71.enum(["session", "belief", "agentic", "typed", "adaptive", "all"]).optional().describe("Filter by memory source (default: all)")
38863
38863
  };
38864
- 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.";
38864
+ const description2 = "Query across all memory backends (session, belief, agentic, adaptive, typed) with unified results. Returns memories matching the query with source attribution and relevance scores.";
38865
38865
  const secureHandler = createSecureHandler(memoryQueryHandler, {
38866
38866
  toolName: "memory_query",
38867
38867
  rateLimiter: deps.rateLimiter,
@@ -38878,7 +38878,7 @@ function registerMemoryQueryTool(server, deps) {
38878
38878
  };
38879
38879
  server.registerTool(
38880
38880
  "memory_query",
38881
- { description, inputSchema: toolSchema, outputSchema },
38881
+ { description: description2, inputSchema: toolSchema, outputSchema },
38882
38882
  toSdkCallback(wrappedHandler)
38883
38883
  );
38884
38884
  logger56.info("Registered memory_query tool");
@@ -38952,7 +38952,7 @@ function registerMemoryStatsTool(server, deps) {
38952
38952
  const toolSchema = {
38953
38953
  includeDecay: z72.boolean().optional().describe("Include decay statistics (default: true)")
38954
38954
  };
38955
- const description = "Get memory system statistics dashboard. Shows backend availability, entry counts, and decay stats across all 7 memory backends.";
38955
+ const description2 = "Get memory system statistics dashboard. Shows backend availability, entry counts, and decay stats across all 7 memory backends.";
38956
38956
  const secureHandler = createSecureHandler(memoryStatsHandler, {
38957
38957
  toolName: "memory_stats",
38958
38958
  rateLimiter: deps.rateLimiter,
@@ -38971,7 +38971,7 @@ function registerMemoryStatsTool(server, deps) {
38971
38971
  };
38972
38972
  server.registerTool(
38973
38973
  "memory_stats",
38974
- { description, inputSchema: toolSchema, outputSchema },
38974
+ { description: description2, inputSchema: toolSchema, outputSchema },
38975
38975
  toSdkCallback(wrappedHandler)
38976
38976
  );
38977
38977
  logger56.info("Registered memory_stats tool");
@@ -39110,7 +39110,7 @@ function registerMemoryWriteTool(server, deps) {
39110
39110
  confidence: z73.enum(["high", "medium", "low"]).optional().describe("Confidence level (default: medium)"),
39111
39111
  metadata: z73.record(z73.string().max(100), z73.string().max(500)).optional().describe("Optional key-value metadata tags")
39112
39112
  };
39113
- const description = "Write a memory entry to a specific backend. Supports session (learnings), belief (subject-predicate-object triples), agentic (knowledge with attributes), adaptive (priority-scored), and typed (MIRIX-style semantic) backends.";
39113
+ const description2 = "Write a memory entry to a specific backend. Supports session (learnings), belief (subject-predicate-object triples), agentic (knowledge with attributes), adaptive (priority-scored), and typed (MIRIX-style semantic) backends.";
39114
39114
  const secureHandler = createSecureHandler(memoryWriteHandler, {
39115
39115
  toolName: "memory_write",
39116
39116
  rateLimiter: deps.rateLimiter,
@@ -39127,7 +39127,7 @@ function registerMemoryWriteTool(server, deps) {
39127
39127
  };
39128
39128
  server.registerTool(
39129
39129
  "memory_write",
39130
- { description, inputSchema: toolSchema, outputSchema },
39130
+ { description: description2, inputSchema: toolSchema, outputSchema },
39131
39131
  toSdkCallback(wrappedHandler)
39132
39132
  );
39133
39133
  logger56.info("Registered memory_write tool");
@@ -39192,7 +39192,7 @@ function registerWeatherReportTool(server, deps) {
39192
39192
  ]).optional().describe("Filter by task category"),
39193
39193
  includeAdaptive: z74.boolean().optional().describe("Include adaptive routing bonuses (default: true)")
39194
39194
  };
39195
- 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.";
39195
+ const description2 = "Get multi-CLI performance weather report. Shows per-CLI success rates, per-category breakdowns, and adaptive routing bonus recommendations based on observed task outcomes.";
39196
39196
  const secureHandler = createSecureHandler(weatherReportHandler, {
39197
39197
  toolName: "weather_report",
39198
39198
  rateLimiter: deps.rateLimiter,
@@ -39205,7 +39205,7 @@ function registerWeatherReportTool(server, deps) {
39205
39205
  });
39206
39206
  server.registerTool(
39207
39207
  "weather_report",
39208
- { description, inputSchema: toolSchema },
39208
+ { description: description2, inputSchema: toolSchema },
39209
39209
  toSdkCallback(wrappedHandler)
39210
39210
  );
39211
39211
  logger56.info("Registered weather_report tool");
@@ -39332,7 +39332,7 @@ function registerRegistryImportTool(server, deps) {
39332
39332
  modelId: z76.string().min(1).describe("Provider model identifier"),
39333
39333
  dryRun: z76.boolean().optional().describe("Preview without persisting (default: true)")
39334
39334
  };
39335
- const description = "Add an AI model to the registry. Generates a draft ModelCapability entry with conservative quality scores (5/10) for human review. Use dryRun=true (default) to preview the entry without saving.";
39335
+ const description2 = "Add an AI model to the registry. Generates a draft ModelCapability entry with conservative quality scores (5/10) for human review. Use dryRun=true (default) to preview the entry without saving.";
39336
39336
  const secureHandler = createSecureHandler(registryImportHandler, {
39337
39337
  toolName: "registry_import",
39338
39338
  rateLimiter: deps.rateLimiter,
@@ -39345,7 +39345,7 @@ function registerRegistryImportTool(server, deps) {
39345
39345
  });
39346
39346
  server.registerTool(
39347
39347
  "registry_import",
39348
- { description, inputSchema: toolSchema },
39348
+ { description: description2, inputSchema: toolSchema },
39349
39349
  toSdkCallback(wrappedHandler)
39350
39350
  );
39351
39351
  logger56.info("Registered registry_import tool");
@@ -39383,7 +39383,7 @@ function registerRepoAnalyzeTool(server, deps) {
39383
39383
  repo: z78.string().min(1).describe('GitHub repository in "owner/name" format or full URL'),
39384
39384
  depth: z78.enum(["shallow", "deep"]).optional().describe("Analysis depth: shallow (tree + README) or deep")
39385
39385
  };
39386
- 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.";
39386
+ const description2 = "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.";
39387
39387
  const secureHandler = createSecureHandler(repoAnalyzeHandler, {
39388
39388
  toolName: "repo_analyze",
39389
39389
  rateLimiter: deps.rateLimiter,
@@ -39396,7 +39396,7 @@ function registerRepoAnalyzeTool(server, deps) {
39396
39396
  });
39397
39397
  server.registerTool(
39398
39398
  "repo_analyze",
39399
- { description, inputSchema: toolSchema },
39399
+ { description: description2, inputSchema: toolSchema },
39400
39400
  toSdkCallback(wrappedHandler)
39401
39401
  );
39402
39402
  logger56.info("Registered repo_analyze tool");
@@ -39434,7 +39434,7 @@ function registerRepoSecurityPlanTool(server, deps) {
39434
39434
  categories: z80.array(z80.string().max(50)).max(10).optional().describe('Filter to specific categories (e.g., ["sast", "sca", "secrets"])'),
39435
39435
  maxScanners: z80.number().min(1).max(20).optional().describe("Maximum scanners to recommend (default: 10)")
39436
39436
  };
39437
- 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.";
39437
+ const description2 = "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.";
39438
39438
  const secureHandler = createSecureHandler(handler, {
39439
39439
  toolName: "repo_security_plan",
39440
39440
  rateLimiter: deps.rateLimiter,
@@ -39447,7 +39447,7 @@ function registerRepoSecurityPlanTool(server, deps) {
39447
39447
  });
39448
39448
  server.registerTool(
39449
39449
  "repo_security_plan",
39450
- { description, inputSchema: toolSchema },
39450
+ { description: description2, inputSchema: toolSchema },
39451
39451
  toSdkCallback(wrappedHandler)
39452
39452
  );
39453
39453
  logger56.info("Registered repo_security_plan tool");
@@ -39538,7 +39538,7 @@ function registerSearchCodebaseTool(server, deps) {
39538
39538
  limit: z81.number().min(1).max(50).optional().describe("Max results"),
39539
39539
  mode: z81.enum(["search", "summary", "list"]).optional().describe("search/summary/list")
39540
39540
  };
39541
- const description = "Search a codebase for functions, classes, methods, interfaces, and types. Builds an in-memory symbol index and supports keyword search with relevance scoring. Modes: search (find symbols), summary (file overview), list (all indexed files).";
39541
+ const description2 = "Search a codebase for functions, classes, methods, interfaces, and types. Builds an in-memory symbol index and supports keyword search with relevance scoring. Modes: search (find symbols), summary (file overview), list (all indexed files).";
39542
39542
  const secureHandler = createSecureHandler(searchCodebaseHandler, {
39543
39543
  toolName: "search_codebase",
39544
39544
  rateLimiter: deps.rateLimiter,
@@ -39548,7 +39548,7 @@ function registerSearchCodebaseTool(server, deps) {
39548
39548
  const wrapped = wrapToolWithTimeout("search_codebase", secureHandler, { timeoutMs, logger: logger56 });
39549
39549
  server.registerTool(
39550
39550
  "search_codebase",
39551
- { description, inputSchema: toolSchema },
39551
+ { description: description2, inputSchema: toolSchema },
39552
39552
  toSdkCallback(wrapped)
39553
39553
  );
39554
39554
  logger56.info("Registered search_codebase tool");
@@ -39614,7 +39614,7 @@ function registerExtractSymbolsTool(server, deps) {
39614
39614
  filePath: z82.string().min(1).max(500).describe("Path to TypeScript/JavaScript file"),
39615
39615
  mode: z82.enum(["index", "full"]).optional().describe("index (default): names+lines. full: includes source text")
39616
39616
  };
39617
- const description = "Extract function, class, method, interface, and type definitions from a TypeScript/JavaScript file. Returns a compact symbol index (80%+ smaller than reading the full file) for token-efficient code retrieval.";
39617
+ const description2 = "Extract function, class, method, interface, and type definitions from a TypeScript/JavaScript file. Returns a compact symbol index (80%+ smaller than reading the full file) for token-efficient code retrieval.";
39618
39618
  const secureHandler = createSecureHandler(extractSymbolsHandler, {
39619
39619
  toolName: "extract_symbols",
39620
39620
  rateLimiter: deps.rateLimiter,
@@ -39627,7 +39627,7 @@ function registerExtractSymbolsTool(server, deps) {
39627
39627
  });
39628
39628
  server.registerTool(
39629
39629
  "extract_symbols",
39630
- { description, inputSchema: toolSchema },
39630
+ { description: description2, inputSchema: toolSchema },
39631
39631
  toSdkCallback(wrapped)
39632
39632
  );
39633
39633
  logger56.info("Registered extract_symbols tool");
@@ -39734,7 +39734,7 @@ function registerQueryTraceTool(server, deps) {
39734
39734
  eventType: z83.string().max(100).regex(/^[a-zA-Z0-9._-]+$/).optional().describe("Filter by event type (e.g., model.called)"),
39735
39735
  limit: z83.number().min(1).max(500).optional().describe("Max events to return (default: 100)")
39736
39736
  };
39737
- const description = "Query execution traces by run ID. Returns agent and model attribution for pipeline runs including decision paths, error taxonomy, and timing data.";
39737
+ const description2 = "Query execution traces by run ID. Returns agent and model attribution for pipeline runs including decision paths, error taxonomy, and timing data.";
39738
39738
  const secureHandler = createSecureHandler(queryTraceHandler, {
39739
39739
  toolName: "query_trace",
39740
39740
  rateLimiter: deps.rateLimiter,
@@ -39744,7 +39744,7 @@ function registerQueryTraceTool(server, deps) {
39744
39744
  const wrappedHandler = wrapToolWithTimeout("query_trace", secureHandler, { timeoutMs, logger: logger56 });
39745
39745
  server.registerTool(
39746
39746
  "query_trace",
39747
- { description, inputSchema: toolSchema },
39747
+ { description: description2, inputSchema: toolSchema },
39748
39748
  toSdkCallback(wrappedHandler)
39749
39749
  );
39750
39750
  logger56.info("Registered query_trace tool");
@@ -40861,7 +40861,7 @@ async function tryIssueTriage(task) {
40861
40861
  try {
40862
40862
  const issueMatch = task.match(/github\.com\/([^/]+\/[^/]+)\/issues\/(\d+)/);
40863
40863
  if (issueMatch === null) return null;
40864
- const { createIssueTriage } = await import("./issue-triage-TXQ7J6GG.js");
40864
+ const { createIssueTriage } = await import("./issue-triage-4SEP4WID.js");
40865
40865
  const triage = createIssueTriage();
40866
40866
  const owner = issueMatch[1] ?? "";
40867
40867
  const num = issueMatch[2] ?? "";
@@ -41169,9 +41169,9 @@ var logger33 = createLogger({ component: "security-scan" });
41169
41169
  var SCAN_TIMEOUT_MS = 3e5;
41170
41170
  async function isSemgrepAvailable() {
41171
41171
  try {
41172
- const { execFile: execFile6 } = await import("child_process");
41173
- const { promisify: promisify9 } = await import("util");
41174
- const exec5 = promisify9(execFile6);
41172
+ const { execFile: execFile7 } = await import("child_process");
41173
+ const { promisify: promisify10 } = await import("util");
41174
+ const exec5 = promisify10(execFile7);
41175
41175
  await exec5("semgrep", ["--version"], { timeout: 1e4 });
41176
41176
  return true;
41177
41177
  } catch {
@@ -41179,9 +41179,9 @@ async function isSemgrepAvailable() {
41179
41179
  }
41180
41180
  }
41181
41181
  async function runSemgrep(targetDir, rulesets) {
41182
- const { execFile: execFile6 } = await import("child_process");
41183
- const { promisify: promisify9 } = await import("util");
41184
- const exec5 = promisify9(execFile6);
41182
+ const { execFile: execFile7 } = await import("child_process");
41183
+ const { promisify: promisify10 } = await import("util");
41184
+ const exec5 = promisify10(execFile7);
41185
41185
  const args = ["--sarif", "--quiet", ...rulesets.flatMap((r) => ["--config", r]), targetDir];
41186
41186
  const { stdout } = await exec5("semgrep", args, {
41187
41187
  timeout: SCAN_TIMEOUT_MS,
@@ -41891,7 +41891,7 @@ ${contextBlock}`;
41891
41891
  const strategy = config.votingStrategy ?? "higher_order";
41892
41892
  await postProgress(config, "Vote", `Running consensus with ${strategy} strategy...`);
41893
41893
  try {
41894
- const { executeVoting } = await import("./consensus-vote-WUGHRBYE.js");
41894
+ const { executeVoting } = await import("./consensus-vote-EXWACBMR.js");
41895
41895
  const votingResult = await executeVoting(
41896
41896
  {
41897
41897
  proposal: plan.slice(0, 4e3),
@@ -43139,7 +43139,7 @@ async function prReviewHandler(args, ctx) {
43139
43139
  }
43140
43140
  function registerPrReviewTool(server, deps) {
43141
43141
  const logger56 = deps.logger ?? createLogger({ tool: "pr_review" });
43142
- const description = "Run multi-voter consensus review on a PR diff (#2233). 5 voters (architect, security, devex, catfish, scope_steward) each emit approve/request_changes/abstain with reasoning and citations. Reuses consensus_vote infra; experimental.";
43142
+ const description2 = "Run multi-voter consensus review on a PR diff (#2233). 5 voters (architect, security, devex, catfish, scope_steward) each emit approve/request_changes/abstain with reasoning and citations. Reuses consensus_vote infra; experimental.";
43143
43143
  const secureHandler = createSecureHandler(prReviewHandler, {
43144
43144
  toolName: "pr_review",
43145
43145
  rateLimiter: deps.rateLimiter,
@@ -43149,7 +43149,7 @@ function registerPrReviewTool(server, deps) {
43149
43149
  const wrappedHandler = wrapToolWithTimeout("pr_review", secureHandler, { timeoutMs, logger: logger56 });
43150
43150
  server.registerTool(
43151
43151
  "pr_review",
43152
- { description, inputSchema: PrReviewInputSchema.shape },
43152
+ { description: description2, inputSchema: PrReviewInputSchema.shape },
43153
43153
  toSdkCallback(wrappedHandler)
43154
43154
  );
43155
43155
  logger56.info("Registered pr_review tool");
@@ -43711,10 +43711,851 @@ function registerCompareDataFeedsTool(server, deps) {
43711
43711
  logger56.info("Registered compare_data_feeds tool");
43712
43712
  }
43713
43713
 
43714
- // src/mcp/tools/query-task-state-tool.ts
43714
+ // src/mcp/tools/improvement-review.ts
43715
+ import { execFile as execFile2 } from "child_process";
43716
+ import { promisify as promisify2 } from "util";
43715
43717
  import { z as z93 } from "zod";
43716
- var QueryTaskStateInputSchema = z93.object({
43717
- taskId: z93.string().min(1).max(128).describe("Task ID whose structured state log should be read")
43718
+
43719
+ // src/governance/fitness-score.ts
43720
+ import { existsSync as existsSync11, readFileSync as readFileSync9, readdirSync as readdirSync2, statSync as statSync2 } from "fs";
43721
+ import { join as join11 } from "path";
43722
+ function findPkgRoot() {
43723
+ let dir = import.meta.dirname;
43724
+ for (let i = 0; i < 10; i++) {
43725
+ const pkgPath = join11(dir, "package.json");
43726
+ if (existsSync11(pkgPath)) {
43727
+ const content = readFileSync9(pkgPath, "utf-8");
43728
+ if (content.includes('"nexus-agents"')) return dir;
43729
+ }
43730
+ dir = join11(dir, "..");
43731
+ }
43732
+ return join11(import.meta.dirname, "../..");
43733
+ }
43734
+ var PKG_ROOT = findPkgRoot();
43735
+ var SRC_ROOT = join11(PKG_ROOT, "src");
43736
+ var REPO_ROOT = join11(PKG_ROOT, "../..");
43737
+ var DOCS_ROOT = join11(REPO_ROOT, "docs");
43738
+ var DETERMINISM_EXCLUDES = [
43739
+ /\.test\.ts$/,
43740
+ /\.spec\.ts$/,
43741
+ /random-provider\.ts$/,
43742
+ /time-provider\.ts$/
43743
+ ];
43744
+ function countFiles(dir, pattern) {
43745
+ if (!existsSync11(dir)) return 0;
43746
+ let count = 0;
43747
+ for (const entry of readdirSync2(dir)) {
43748
+ const fullPath = join11(dir, entry);
43749
+ const stat6 = statSync2(fullPath);
43750
+ if (stat6.isDirectory() && !entry.startsWith(".")) {
43751
+ count += countFiles(fullPath, pattern);
43752
+ } else if (pattern.test(entry)) {
43753
+ count++;
43754
+ }
43755
+ }
43756
+ return count;
43757
+ }
43758
+ function fileContains(filePath, pattern) {
43759
+ if (!existsSync11(filePath)) return false;
43760
+ return pattern.test(readFileSync9(filePath, "utf-8"));
43761
+ }
43762
+ function isExcluded(entry, excludePatterns) {
43763
+ return excludePatterns?.some((p) => p.test(entry)) ?? false;
43764
+ }
43765
+ function countMatchesInFile(fullPath, contentPattern) {
43766
+ const matches = readFileSync9(fullPath, "utf-8").match(contentPattern);
43767
+ return matches?.length ?? 0;
43768
+ }
43769
+ function countPatternInDir(dir, filePattern, contentPattern, excludePatterns) {
43770
+ if (!existsSync11(dir)) return 0;
43771
+ let count = 0;
43772
+ for (const entry of readdirSync2(dir)) {
43773
+ const fullPath = join11(dir, entry);
43774
+ const stat6 = statSync2(fullPath);
43775
+ if (stat6.isDirectory() && !entry.startsWith(".") && entry !== "node_modules") {
43776
+ count += countPatternInDir(fullPath, filePattern, contentPattern, excludePatterns);
43777
+ } else if (filePattern.test(entry) && !isExcluded(entry, excludePatterns)) {
43778
+ count += countMatchesInFile(fullPath, contentPattern);
43779
+ }
43780
+ }
43781
+ return count;
43782
+ }
43783
+ function clamp2(score, max) {
43784
+ return Math.max(0, Math.min(max, score));
43785
+ }
43786
+ var FitnessScoreCalculator = class {
43787
+ logger;
43788
+ checks = [];
43789
+ constructor(logger56) {
43790
+ this.logger = logger56 ?? createLogger({ component: "FitnessScoreCalculator" });
43791
+ this.registerDefaultChecks();
43792
+ }
43793
+ /** Register default fitness checks. */
43794
+ registerDefaultChecks() {
43795
+ const reg = (dimension, maxPoints, name, check) => {
43796
+ this.checks.push({ dimension, maxPoints, name, check });
43797
+ };
43798
+ reg("canonicalPaths", 20, "Canonical Paths", () => this.checkCanonicalPaths());
43799
+ reg("explicitBehavior", 15, "Explicit Behavior", () => this.checkExplicitBehavior());
43800
+ reg("determinism", 15, "Determinism", () => this.checkDeterminism());
43801
+ reg("observability", 15, "Observability", () => this.checkObservability());
43802
+ reg("configSimplicity", 10, "Config Simplicity", () => this.checkConfigSimplicity());
43803
+ reg("layerSeparation", 10, "Layer Separation", () => this.checkLayerSeparation());
43804
+ reg("operatorErgonomics", 10, "Operator Ergonomics", () => this.checkOperatorErgonomics());
43805
+ reg(
43806
+ "governanceIntegration",
43807
+ 5,
43808
+ "Governance Integration",
43809
+ () => this.checkGovernanceIntegration()
43810
+ );
43811
+ }
43812
+ /** Run full fitness audit. */
43813
+ audit(version) {
43814
+ const findings = [];
43815
+ const dimensions = {};
43816
+ for (const check of this.checks) {
43817
+ this.logger.debug(`Running fitness check: ${check.name}`);
43818
+ const result = check.check();
43819
+ dimensions[check.dimension] = result.score;
43820
+ findings.push(...result.findings);
43821
+ }
43822
+ const score = Object.values(dimensions).reduce((sum, val) => sum + val, 0);
43823
+ this.logger.info("Fitness audit complete", { score, version });
43824
+ const safeDim = (k) => dimensions[k] ?? 0;
43825
+ const typedDimensions = {
43826
+ canonicalPaths: safeDim("canonicalPaths"),
43827
+ explicitBehavior: safeDim("explicitBehavior"),
43828
+ determinism: safeDim("determinism"),
43829
+ observability: safeDim("observability"),
43830
+ configSimplicity: safeDim("configSimplicity"),
43831
+ layerSeparation: safeDim("layerSeparation"),
43832
+ operatorErgonomics: safeDim("operatorErgonomics"),
43833
+ governanceIntegration: safeDim("governanceIntegration")
43834
+ };
43835
+ return {
43836
+ score,
43837
+ dimensions: typedDimensions,
43838
+ findings,
43839
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
43840
+ version
43841
+ };
43842
+ }
43843
+ // =========================================================================
43844
+ // Individual Checks — real filesystem analysis
43845
+ // =========================================================================
43846
+ /**
43847
+ * Check canonical paths: penalize duplicate router implementations.
43848
+ *
43849
+ * The current minimum is 6 (raised from 5 in #2063 after an audit):
43850
+ * 1. composite-router — pipeline orchestrator
43851
+ * 2. budget-router — budget/cost filtering
43852
+ * 3. zero-router — hard-constraint exclusion
43853
+ * 4. preference-router — user/task preference application
43854
+ * 5. topsis-router — TOPSIS multi-criteria scoring
43855
+ * 6. agreement-cascade-router — agreement-based cascade retry
43856
+ *
43857
+ * Each stage is distinct per CLAUDE.md's documented pipeline:
43858
+ * Task → BudgetRouter → ZeroRouter → PreferenceRouter → TopsisRouter → Agreement → Model
43859
+ */
43860
+ checkCanonicalPaths() {
43861
+ const findings = [];
43862
+ let score = 20;
43863
+ const routerCount = countFiles(join11(SRC_ROOT, "cli-adapters"), /router\.ts$/);
43864
+ const ROUTER_COUNT_THRESHOLD = 6;
43865
+ if (routerCount > ROUTER_COUNT_THRESHOLD) {
43866
+ const excess = routerCount - ROUTER_COUNT_THRESHOLD;
43867
+ const deduction = Math.min(5, excess);
43868
+ score -= deduction;
43869
+ findings.push(
43870
+ this.finding(
43871
+ "canonicalPaths",
43872
+ "warning",
43873
+ `${String(routerCount)} router implementations found (target: <=${String(ROUTER_COUNT_THRESHOLD)})`,
43874
+ deduction,
43875
+ "Consolidate duplicate routers into CompositeRouter"
43876
+ )
43877
+ );
43878
+ }
43879
+ if (existsSync11(join11(SRC_ROOT, "cli-adapters/composite-router.ts"))) {
43880
+ score += 2;
43881
+ } else {
43882
+ score -= 3;
43883
+ findings.push(
43884
+ this.finding(
43885
+ "canonicalPaths",
43886
+ "critical",
43887
+ "CompositeRouter missing \u2014 no unified routing entry point",
43888
+ 3
43889
+ )
43890
+ );
43891
+ }
43892
+ score = this.checkOrchestratorInterface(score, findings);
43893
+ return { score: clamp2(score, 20), findings };
43894
+ }
43895
+ /** Sub-check for IOrchestrator interface and adapter wiring. */
43896
+ checkOrchestratorInterface(score, findings) {
43897
+ const orchPath = join11(SRC_ROOT, "core/types/orchestrator.ts");
43898
+ if (existsSync11(orchPath) && fileContains(orchPath, /interface IOrchestrator/)) {
43899
+ score += 3;
43900
+ } else {
43901
+ score -= 2;
43902
+ findings.push(
43903
+ this.finding("canonicalPaths", "warning", "No IOrchestrator interface in core/types", 2)
43904
+ );
43905
+ }
43906
+ const adapterPath = join11(SRC_ROOT, "orchestration/orchestrator-adapters.ts");
43907
+ if (existsSync11(adapterPath) && fileContains(adapterPath, /TechLeadAdapter|PuppeteerAdapter/)) {
43908
+ score += 2;
43909
+ }
43910
+ return score;
43911
+ }
43912
+ /**
43913
+ * Check explicit behavior: penalize hidden/magic behavior.
43914
+ *
43915
+ * Implementation is intentionally filesystem-signal-based (no AST parse).
43916
+ * The `NEXUS_ALLOW_MOCK_ORCHESTRATION` guard and magic-routing pattern
43917
+ * grep capture the observable failure modes that historically slipped
43918
+ * past review. AST-based detection of implicit fallbacks was considered
43919
+ * but not pursued — it would significantly widen this function's
43920
+ * footprint and the filesystem signals already catch the recurring
43921
+ * regressions. Revisit only if a new class of hidden-behavior bug
43922
+ * surfaces that this grep-over-source approach can't catch.
43923
+ */
43924
+ checkExplicitBehavior() {
43925
+ const findings = [];
43926
+ let score = 15;
43927
+ const mockGuardCount = countPatternInDir(
43928
+ SRC_ROOT,
43929
+ /\.ts$/,
43930
+ /NEXUS_ALLOW_MOCK_ORCHESTRATION/g,
43931
+ DETERMINISM_EXCLUDES
43932
+ );
43933
+ if (mockGuardCount === 0) {
43934
+ score -= 3;
43935
+ findings.push(
43936
+ this.finding(
43937
+ "explicitBehavior",
43938
+ "warning",
43939
+ "No NEXUS_ALLOW_MOCK_ORCHESTRATION guard found \u2014 mock fallback may be implicit",
43940
+ 3,
43941
+ "Require explicit env var for mock orchestration"
43942
+ )
43943
+ );
43944
+ }
43945
+ const magicRouting = countPatternInDir(
43946
+ SRC_ROOT,
43947
+ /\.ts$/,
43948
+ /fallback.*=.*true|implicitRoute/g,
43949
+ DETERMINISM_EXCLUDES
43950
+ );
43951
+ if (magicRouting > 5) {
43952
+ const deduction = Math.min(3, Math.floor(magicRouting / 3));
43953
+ score -= deduction;
43954
+ findings.push(
43955
+ this.finding(
43956
+ "explicitBehavior",
43957
+ "info",
43958
+ `${String(magicRouting)} implicit fallback/routing patterns detected`,
43959
+ deduction
43960
+ )
43961
+ );
43962
+ }
43963
+ return { score: clamp2(score, 15), findings };
43964
+ }
43965
+ /** Check determinism: penalize unseeded random and raw Date.now(). */
43966
+ checkDeterminism() {
43967
+ const findings = [];
43968
+ let score = 15;
43969
+ score = this.checkRandomDeterminism(score, findings);
43970
+ score = this.checkTimeDeterminism(score, findings);
43971
+ return { score: clamp2(score, 15), findings };
43972
+ }
43973
+ /** Sub-check for Math.random() and injectable random provider. */
43974
+ checkRandomDeterminism(score, findings) {
43975
+ const randomCount = countPatternInDir(
43976
+ SRC_ROOT,
43977
+ /\.ts$/,
43978
+ /Math\.random\(\)/g,
43979
+ DETERMINISM_EXCLUDES
43980
+ );
43981
+ if (randomCount > 10) {
43982
+ const deduction = Math.min(5, Math.floor(randomCount / 5));
43983
+ score -= deduction;
43984
+ findings.push(
43985
+ this.finding(
43986
+ "determinism",
43987
+ "warning",
43988
+ `${String(randomCount)} unseeded Math.random() calls in production code`,
43989
+ deduction,
43990
+ "Use getRandomProvider() for injectable randomness"
43991
+ )
43992
+ );
43993
+ } else if (randomCount === 0) {
43994
+ score += 2;
43995
+ }
43996
+ if (existsSync11(join11(SRC_ROOT, "core/random-provider.ts"))) {
43997
+ score += 1;
43998
+ }
43999
+ const randomUsage = countPatternInDir(
44000
+ SRC_ROOT,
44001
+ /\.ts$/,
44002
+ /getRandomProvider\(\)/g,
44003
+ DETERMINISM_EXCLUDES
44004
+ );
44005
+ if (randomUsage > 5) {
44006
+ score += 1;
44007
+ }
44008
+ return score;
44009
+ }
44010
+ /** Sub-check for Date.now() and injectable time provider. */
44011
+ checkTimeDeterminism(score, findings) {
44012
+ const dateNowCount = countPatternInDir(
44013
+ SRC_ROOT,
44014
+ /\.ts$/,
44015
+ /Date\.now\(\)/g,
44016
+ DETERMINISM_EXCLUDES
44017
+ );
44018
+ if (dateNowCount > 50) {
44019
+ score -= 2;
44020
+ findings.push(
44021
+ this.finding(
44022
+ "determinism",
44023
+ "info",
44024
+ `${String(dateNowCount)} Date.now() calls in production code`,
44025
+ 2,
44026
+ "Use getTimeProvider() for injectable time"
44027
+ )
44028
+ );
44029
+ }
44030
+ if (existsSync11(join11(SRC_ROOT, "core/time-provider.ts"))) {
44031
+ score += 1;
44032
+ }
44033
+ const timeUsage = countPatternInDir(
44034
+ SRC_ROOT,
44035
+ /\.ts$/,
44036
+ /getTimeProvider\(\)/g,
44037
+ DETERMINISM_EXCLUDES
44038
+ );
44039
+ if (timeUsage > 10) {
44040
+ score += 1;
44041
+ }
44042
+ return score;
44043
+ }
44044
+ /** Check observability: reward tracing, logging, and audit coverage. */
44045
+ checkObservability() {
44046
+ const findings = [];
44047
+ let score = 15;
44048
+ if (existsSync11(join11(SRC_ROOT, "observability/swarm-observer.ts"))) {
44049
+ score += 3;
44050
+ } else {
44051
+ score -= 3;
44052
+ findings.push(
44053
+ this.finding(
44054
+ "observability",
44055
+ "warning",
44056
+ "No SwarmObserver found",
44057
+ 3,
44058
+ "Add observability/swarm-observer.ts"
44059
+ )
44060
+ );
44061
+ }
44062
+ if (existsSync11(join11(SRC_ROOT, "core/trace.ts"))) {
44063
+ score += 2;
44064
+ }
44065
+ const loggerCount = countPatternInDir(SRC_ROOT, /\.ts$/, /createLogger\(/g);
44066
+ if (loggerCount > 50) {
44067
+ score += 2;
44068
+ } else {
44069
+ findings.push(
44070
+ this.finding(
44071
+ "observability",
44072
+ "info",
44073
+ `Only ${String(loggerCount)} createLogger() calls (target: >50)`,
44074
+ 0
44075
+ )
44076
+ );
44077
+ }
44078
+ if (existsSync11(join11(SRC_ROOT, "audit"))) {
44079
+ score += 2;
44080
+ }
44081
+ return { score: clamp2(score, 15), findings };
44082
+ }
44083
+ /** Check config simplicity: penalize excessive schema sprawl. */
44084
+ checkConfigSimplicity() {
44085
+ const findings = [];
44086
+ let score = 10;
44087
+ const schemaCount = countFiles(join11(SRC_ROOT, "config"), /schema.*\.ts$/);
44088
+ if (schemaCount > 10) {
44089
+ score -= 2;
44090
+ findings.push(
44091
+ this.finding(
44092
+ "configSimplicity",
44093
+ "info",
44094
+ `${String(schemaCount)} config schemas (target: <=10)`,
44095
+ 2,
44096
+ "Consolidate related schemas"
44097
+ )
44098
+ );
44099
+ } else {
44100
+ score += 1;
44101
+ }
44102
+ if (existsSync11(join11(SRC_ROOT, "config/config-loader.ts"))) {
44103
+ score += 2;
44104
+ }
44105
+ if (existsSync11(join11(SRC_ROOT, "config/config-manager.ts"))) {
44106
+ score += 1;
44107
+ }
44108
+ return { score: clamp2(score, 10), findings };
44109
+ }
44110
+ /** Check layer separation: penalize cross-layer imports. */
44111
+ checkLayerSeparation() {
44112
+ const findings = [];
44113
+ let score = 10;
44114
+ const adapterAgentImports = countPatternInDir(
44115
+ join11(SRC_ROOT, "adapters"),
44116
+ /\.ts$/,
44117
+ /from ['"]\.\.\/agents\//g
44118
+ );
44119
+ if (adapterAgentImports > 0) {
44120
+ const deduction = Math.min(5, adapterAgentImports);
44121
+ score -= deduction;
44122
+ findings.push(
44123
+ this.finding(
44124
+ "layerSeparation",
44125
+ "warning",
44126
+ `${String(adapterAgentImports)} adapter->agent import violations`,
44127
+ deduction,
44128
+ "Adapters should not import from agents layer"
44129
+ )
44130
+ );
44131
+ } else {
44132
+ score += 2;
44133
+ }
44134
+ const coreMcpImports = countPatternInDir(
44135
+ join11(SRC_ROOT, "core"),
44136
+ /\.ts$/,
44137
+ /from ['"]\.\.\/mcp\//g
44138
+ );
44139
+ if (coreMcpImports > 0) {
44140
+ const deduction = Math.min(3, coreMcpImports);
44141
+ score -= deduction;
44142
+ findings.push(
44143
+ this.finding(
44144
+ "layerSeparation",
44145
+ "critical",
44146
+ `${String(coreMcpImports)} core->MCP import violations`,
44147
+ deduction,
44148
+ "Core must not depend on MCP layer"
44149
+ )
44150
+ );
44151
+ } else {
44152
+ score += 1;
44153
+ }
44154
+ return { score: clamp2(score, 10), findings };
44155
+ }
44156
+ /** Check operator ergonomics: reward rich CLI commands. */
44157
+ checkOperatorErgonomics() {
44158
+ const findings = [];
44159
+ let score = 10;
44160
+ const commandCount = countFiles(join11(SRC_ROOT, "cli"), /\.ts$/);
44161
+ if (commandCount >= 20) {
44162
+ score += 3;
44163
+ } else {
44164
+ findings.push(
44165
+ this.finding(
44166
+ "operatorErgonomics",
44167
+ "info",
44168
+ `${String(commandCount)} CLI commands (target: >=20)`,
44169
+ 0
44170
+ )
44171
+ );
44172
+ }
44173
+ score = this.checkCliCommands(score, findings);
44174
+ return { score: clamp2(score, 10), findings };
44175
+ }
44176
+ /** Sub-check for essential CLI commands (doctor, setup, demo, config). */
44177
+ checkCliCommands(score, findings) {
44178
+ const commands = [
44179
+ ["cli/doctor.ts", "Doctor command", 2],
44180
+ ["cli/setup-command.ts", "Setup wizard", 2],
44181
+ ["cli/demo-command.ts", "Demo command", 1],
44182
+ ["cli/config-command.ts", "Config command", 1]
44183
+ ];
44184
+ for (const [path20, name, bonus] of commands) {
44185
+ if (existsSync11(join11(SRC_ROOT, path20))) {
44186
+ score += bonus;
44187
+ } else {
44188
+ findings.push(this.finding("operatorErgonomics", "info", `Missing ${name} (${path20})`, 0));
44189
+ }
44190
+ }
44191
+ return score;
44192
+ }
44193
+ /** Check governance integration: policy firewall, rate limiter, docs. */
44194
+ checkGovernanceIntegration() {
44195
+ const findings = [];
44196
+ let score = 5;
44197
+ score = this.checkGovernanceDocs(score, findings);
44198
+ score = this.checkGovernanceInfra(score, findings);
44199
+ return { score: clamp2(score, 5), findings };
44200
+ }
44201
+ /** Sub-check for governance documentation artifacts. */
44202
+ checkGovernanceDocs(score, findings) {
44203
+ if (!existsSync11(join11(REPO_ROOT, "CLAUDE.md"))) {
44204
+ score -= 3;
44205
+ findings.push(
44206
+ this.finding("governanceIntegration", "critical", "No CLAUDE.md governance document", 3)
44207
+ );
44208
+ } else {
44209
+ score += 1;
44210
+ }
44211
+ if (existsSync11(join11(DOCS_ROOT, "architecture/wiring-graph.json"))) {
44212
+ score += 1;
44213
+ }
44214
+ if (existsSync11(join11(DOCS_ROOT, "adr"))) {
44215
+ score += 1;
44216
+ } else {
44217
+ findings.push(this.finding("governanceIntegration", "info", "No ADR directory", 0));
44218
+ }
44219
+ return score;
44220
+ }
44221
+ /** Sub-check for governance runtime infrastructure. */
44222
+ checkGovernanceInfra(score, findings) {
44223
+ const hasPolicyFirewall = countPatternInDir(join11(SRC_ROOT, "security"), /\.ts$/, /PolicyGate|policyFirewall/g) > 0;
44224
+ if (hasPolicyFirewall) {
44225
+ score += 1;
44226
+ } else {
44227
+ findings.push(
44228
+ this.finding(
44229
+ "governanceIntegration",
44230
+ "warning",
44231
+ "No policy firewall detected in security layer",
44232
+ 0
44233
+ )
44234
+ );
44235
+ }
44236
+ const hasRateLimiter = countPatternInDir(SRC_ROOT, /\.ts$/, /RateLimiter|rateLimiter/g) > 0;
44237
+ if (hasRateLimiter) {
44238
+ score += 1;
44239
+ }
44240
+ return score;
44241
+ }
44242
+ /** Helper to create a FitnessFinding with defaults. */
44243
+ finding(dimension, severity, description2, pointsDeducted, suggestion) {
44244
+ const base = { dimension, severity, description: description2, pointsDeducted };
44245
+ if (suggestion !== void 0) {
44246
+ return { ...base, suggestion };
44247
+ }
44248
+ return base;
44249
+ }
44250
+ };
44251
+ function createFitnessScoreCalculator(logger56) {
44252
+ return new FitnessScoreCalculator(logger56);
44253
+ }
44254
+ function calculateFitnessScore(version) {
44255
+ const calculator = createFitnessScoreCalculator();
44256
+ return calculator.audit(version);
44257
+ }
44258
+
44259
+ // src/mcp/tools/improvement-review.ts
44260
+ var execFileAsync2 = promisify2(execFile2);
44261
+ var ImprovementReviewInputSchema = z93.object({
44262
+ lookbackDays: z93.number().int().min(1).max(90).optional().default(7).describe("Lookback window for outcome data, in days. Default 7."),
44263
+ fileIssues: z93.boolean().optional().default(false).describe(
44264
+ "When true, file candidate issues via `gh issue create` for crossed thresholds (rate-limited to 5 per run, deduped against open issues). When false (default), return signals only."
44265
+ ),
44266
+ minSampleSize: z93.number().int().min(1).max(1e3).optional().default(5).describe("Minimum sample size before a CLI/category signal can fire."),
44267
+ fitnessFloor: z93.number().int().min(0).max(100).optional().default(90).describe("Fitness score below this threshold triggers a tech-debt signal.")
44268
+ });
44269
+ var MAX_ISSUES_PER_RUN = 5;
44270
+ var HOUR_MS = 60 * 60 * 1e3;
44271
+ var DAY_MS = 24 * HOUR_MS;
44272
+ function filterByLookback(outcomes, lookbackDays, now) {
44273
+ const cutoff = now - lookbackDays * DAY_MS;
44274
+ return outcomes.filter((o) => {
44275
+ const t = Date.parse(o.timestamp);
44276
+ return Number.isFinite(t) && t >= cutoff;
44277
+ });
44278
+ }
44279
+ function detectCliPerformanceFloor(outcomes, minSamples, windowLabel) {
44280
+ const buckets = /* @__PURE__ */ new Map();
44281
+ for (const o of outcomes) {
44282
+ const key = `${o.cli}::${o.category}`;
44283
+ const bucket = buckets.get(key) ?? { cli: o.cli, category: o.category, ok: 0, total: 0 };
44284
+ bucket.total += 1;
44285
+ if (o.success) bucket.ok += 1;
44286
+ buckets.set(key, bucket);
44287
+ }
44288
+ const signals = [];
44289
+ for (const b of buckets.values()) {
44290
+ if (b.total < minSamples) continue;
44291
+ const rate = b.ok / b.total;
44292
+ if (rate >= 0.6) continue;
44293
+ const ratePct = Math.round(rate * 100);
44294
+ signals.push({
44295
+ category: "routing",
44296
+ signalKey: `routing:cli-floor:${b.cli}:${b.category}`,
44297
+ severity: rate < 0.4 ? "critical" : "warning",
44298
+ title: `routing: ${b.cli} success rate ${String(ratePct)}% on ${b.category} (${windowLabel})`,
44299
+ body: [
44300
+ `Observed performance floor breach in the ${windowLabel} window.`,
44301
+ "",
44302
+ `- CLI: \`${b.cli}\``,
44303
+ `- Category: \`${b.category}\``,
44304
+ `- Success rate: ${String(ratePct)}% (${String(b.ok)}/${String(b.total)})`,
44305
+ `- Threshold: 60% with \u2265${String(minSamples)} samples`,
44306
+ "",
44307
+ "Consider routing this category away from this CLI, or investigating the failure pattern via `weather_report` and the OutcomeStore."
44308
+ ].join("\n"),
44309
+ evidence: {
44310
+ samples: b.total,
44311
+ window: windowLabel,
44312
+ observedValue: rate,
44313
+ threshold: 0.6
44314
+ }
44315
+ });
44316
+ }
44317
+ return signals;
44318
+ }
44319
+ function detectFailureCategoryConcentration(outcomes, windowLabel) {
44320
+ const failures = outcomes.filter((o) => !o.success);
44321
+ if (failures.length < 10) return [];
44322
+ const byCategory = /* @__PURE__ */ new Map();
44323
+ for (const f of failures) {
44324
+ const cat = f.failureCategory ?? "unknown";
44325
+ byCategory.set(cat, (byCategory.get(cat) ?? 0) + 1);
44326
+ }
44327
+ const signals = [];
44328
+ for (const [cat, count] of byCategory) {
44329
+ const share = count / failures.length;
44330
+ if (share <= 0.5) continue;
44331
+ const sharePct = Math.round(share * 100);
44332
+ signals.push({
44333
+ category: "bug",
44334
+ signalKey: `bug:failure-concentration:${cat}`,
44335
+ severity: "warning",
44336
+ title: `bug: ${String(sharePct)}% of failures in ${windowLabel} share category \`${cat}\``,
44337
+ body: [
44338
+ `Failure-category concentration breach in the ${windowLabel} window.`,
44339
+ "",
44340
+ `- Category: \`${cat}\``,
44341
+ `- Share: ${String(sharePct)}% (${String(count)}/${String(failures.length)} failures)`,
44342
+ `- Threshold: > 50% with \u226510 failures`,
44343
+ "",
44344
+ "A single failure mode dominating the error budget usually means a systemic bug or routing miss. Investigate via `query_trace` and the OutcomeStore."
44345
+ ].join("\n"),
44346
+ evidence: {
44347
+ samples: failures.length,
44348
+ window: windowLabel,
44349
+ observedValue: share,
44350
+ threshold: 0.5
44351
+ }
44352
+ });
44353
+ }
44354
+ return signals;
44355
+ }
44356
+ function buildFloorSignal(audit, fitnessFloor) {
44357
+ return {
44358
+ category: "tech-debt",
44359
+ signalKey: `tech-debt:fitness-below-floor`,
44360
+ severity: audit.score < 70 ? "critical" : "warning",
44361
+ title: `tech-debt: fitness score ${String(audit.score)}/100 below floor ${String(fitnessFloor)}`,
44362
+ body: [
44363
+ `Code fitness score has dropped below the governance floor.`,
44364
+ "",
44365
+ `- Score: ${String(audit.score)} / 100`,
44366
+ `- Floor: ${String(fitnessFloor)} (governance threshold per CLAUDE.md)`,
44367
+ `- Findings: ${String(audit.findings.length)} total`,
44368
+ "",
44369
+ "Run `nexus-agents fitness-audit` for the full breakdown. Critical findings:",
44370
+ ...audit.findings.filter((f) => f.severity === "critical").slice(0, 5).map((f) => `- ${f.dimension}: ${f.description}`)
44371
+ ].join("\n"),
44372
+ evidence: { observedValue: audit.score, threshold: fitnessFloor }
44373
+ };
44374
+ }
44375
+ function buildCriticalFindingSignal(finding) {
44376
+ return {
44377
+ category: "tech-debt",
44378
+ signalKey: `tech-debt:fitness-critical:${finding.dimension}`,
44379
+ severity: "critical",
44380
+ title: `tech-debt: critical fitness finding in ${finding.dimension}`,
44381
+ body: [
44382
+ `Fitness audit returned a CRITICAL finding.`,
44383
+ "",
44384
+ `- Dimension: \`${finding.dimension}\``,
44385
+ `- Description: ${finding.description}`,
44386
+ `- Points deducted: ${String(finding.pointsDeducted)}`,
44387
+ finding.location !== void 0 ? `- Location: ${finding.location}` : "",
44388
+ finding.suggestion !== void 0 ? `- Suggestion: ${finding.suggestion}` : ""
44389
+ ].filter((line) => line.length > 0).join("\n"),
44390
+ evidence: { observedValue: -finding.pointsDeducted }
44391
+ };
44392
+ }
44393
+ function detectFitnessSignals(audit, fitnessFloor) {
44394
+ const signals = [];
44395
+ if (audit.score < fitnessFloor) signals.push(buildFloorSignal(audit, fitnessFloor));
44396
+ for (const finding of audit.findings) {
44397
+ if (finding.severity === "critical") signals.push(buildCriticalFindingSignal(finding));
44398
+ }
44399
+ return signals;
44400
+ }
44401
+ async function existingIssueForSignal(signalKey) {
44402
+ try {
44403
+ const { stdout } = await execFileAsync2("gh", [
44404
+ "issue",
44405
+ "list",
44406
+ "--state",
44407
+ "open",
44408
+ "--search",
44409
+ `"${signalKey}" in:body`,
44410
+ "--json",
44411
+ "number,url",
44412
+ "--limit",
44413
+ "5"
44414
+ ]);
44415
+ const parsed = JSON.parse(stdout);
44416
+ if (parsed.length > 0 && typeof parsed[0]?.url === "string") {
44417
+ return parsed[0].url;
44418
+ }
44419
+ return null;
44420
+ } catch {
44421
+ return null;
44422
+ }
44423
+ }
44424
+ async function fileIssueForSignal(signal) {
44425
+ const body = `${signal.body}
44426
+
44427
+ ---
44428
+
44429
+ _Signal key (do not edit): \`${signal.signalKey}\` \xB7 Generated by \`improvement_review\` (#2402) \xB7 Severity: ${signal.severity}_`;
44430
+ const labels = signal.category === "security" ? "security" : signal.category;
44431
+ try {
44432
+ const { stdout } = await execFileAsync2("gh", [
44433
+ "issue",
44434
+ "create",
44435
+ "--title",
44436
+ signal.title,
44437
+ "--body",
44438
+ body,
44439
+ "--label",
44440
+ labels
44441
+ ]);
44442
+ const url = stdout.trim();
44443
+ if (!url.startsWith("https://")) {
44444
+ return { ok: false, error: `gh returned unexpected output: ${stdout.slice(0, 200)}` };
44445
+ }
44446
+ return { ok: true, url };
44447
+ } catch (caught) {
44448
+ const message = caught instanceof Error ? caught.message : String(caught);
44449
+ return { ok: false, error: message };
44450
+ }
44451
+ }
44452
+ function safeFitnessAudit(now, ctx) {
44453
+ try {
44454
+ return calculateFitnessScore("improvement-review");
44455
+ } catch (caught) {
44456
+ ctx.logger.warn("fitness audit failed; skipping fitness signals", {
44457
+ error: caught instanceof Error ? caught.message : String(caught)
44458
+ });
44459
+ return {
44460
+ score: 100,
44461
+ dimensions: {},
44462
+ findings: [],
44463
+ timestamp: new Date(now).toISOString(),
44464
+ version: "improvement-review-fallback"
44465
+ };
44466
+ }
44467
+ }
44468
+ var SEVERITY_ORDER3 = {
44469
+ critical: 0,
44470
+ warning: 1,
44471
+ info: 2
44472
+ };
44473
+ async function fileSignalsAsIssues(signals, ctx) {
44474
+ const issuesFiled = [];
44475
+ const issuesSkipped = [];
44476
+ for (const signal of signals) {
44477
+ if (issuesFiled.length >= MAX_ISSUES_PER_RUN) {
44478
+ issuesSkipped.push({ signalKey: signal.signalKey, reason: "rate-limit" });
44479
+ continue;
44480
+ }
44481
+ const existing = await existingIssueForSignal(signal.signalKey);
44482
+ if (existing !== null) {
44483
+ issuesSkipped.push({ signalKey: signal.signalKey, reason: `dup:${existing}` });
44484
+ continue;
44485
+ }
44486
+ const result = await fileIssueForSignal(signal);
44487
+ if (result.ok) {
44488
+ issuesFiled.push({ signalKey: signal.signalKey, issueUrl: result.url });
44489
+ ctx.logger.info("improvement signal filed", {
44490
+ signalKey: signal.signalKey,
44491
+ url: result.url
44492
+ });
44493
+ } else {
44494
+ issuesSkipped.push({ signalKey: signal.signalKey, reason: `error:${result.error}` });
44495
+ }
44496
+ }
44497
+ return { issuesFiled, issuesSkipped };
44498
+ }
44499
+ async function reviewHandler(args, ctx) {
44500
+ const parsed = ImprovementReviewInputSchema.safeParse(args);
44501
+ if (!parsed.success) {
44502
+ return toolError(`Validation error: ${formatZodError(parsed.error)}`);
44503
+ }
44504
+ const { lookbackDays, fileIssues, minSampleSize, fitnessFloor } = parsed.data;
44505
+ const now = Date.now();
44506
+ const windowLabel = `${String(lookbackDays)}d`;
44507
+ const allOutcomes = getOutcomeStore().query();
44508
+ const windowed = filterByLookback(allOutcomes, lookbackDays, now);
44509
+ const audit = safeFitnessAudit(now, ctx);
44510
+ const signals = [
44511
+ ...detectCliPerformanceFloor(windowed, minSampleSize, windowLabel),
44512
+ ...detectFailureCategoryConcentration(windowed, windowLabel),
44513
+ ...detectFitnessSignals(audit, fitnessFloor)
44514
+ ];
44515
+ signals.sort((a, b) => SEVERITY_ORDER3[a.severity] - SEVERITY_ORDER3[b.severity]);
44516
+ const { issuesFiled, issuesSkipped } = fileIssues ? await fileSignalsAsIssues(signals, ctx) : { issuesFiled: [], issuesSkipped: [] };
44517
+ const response = {
44518
+ window: windowLabel,
44519
+ totalOutcomes: windowed.length,
44520
+ signals,
44521
+ issuesFiled,
44522
+ issuesSkipped
44523
+ };
44524
+ return toolSuccessStructured(response);
44525
+ }
44526
+ var description = "Periodic threshold-gated observability-driven improvement loop. Reads OutcomeStore + fitness audit, surfaces patterns crossing documented thresholds as candidate findings. When fileIssues=true, files candidate GitHub issues via `gh issue create` (rate-limited to 5 per run, deduped against open issues). Never auto-merges. Replaces the deleted self-development engine (#2402).";
44527
+ var TOOL_INPUT_SCHEMA = {
44528
+ lookbackDays: z93.number().int().min(1).max(90).optional().describe("Lookback window for outcome data, in days. Default 7."),
44529
+ fileIssues: z93.boolean().optional().describe(
44530
+ "When true, file candidate issues for crossed thresholds (default false \u2014 return signals only)"
44531
+ ),
44532
+ minSampleSize: z93.number().int().min(1).max(1e3).optional().describe("Minimum sample size before a CLI/category signal fires (default 5)."),
44533
+ fitnessFloor: z93.number().int().min(0).max(100).optional().describe("Fitness score below this threshold triggers a tech-debt signal (default 90).")
44534
+ };
44535
+ function registerImprovementReviewTool(server, deps) {
44536
+ const logger56 = deps.logger ?? createLogger({ tool: "improvement_review" });
44537
+ const secureHandler = createSecureHandler(reviewHandler, {
44538
+ toolName: "improvement_review",
44539
+ rateLimiter: deps.rateLimiter,
44540
+ logger: logger56
44541
+ });
44542
+ const timeoutMs = getToolTimeout("improvement_review", deps.security);
44543
+ const wrappedHandler = wrapToolWithTimeout("improvement_review", secureHandler, {
44544
+ timeoutMs,
44545
+ logger: logger56
44546
+ });
44547
+ server.registerTool(
44548
+ "improvement_review",
44549
+ { description, inputSchema: TOOL_INPUT_SCHEMA },
44550
+ toSdkCallback(wrappedHandler)
44551
+ );
44552
+ logger56.info("Registered improvement_review tool");
44553
+ }
44554
+
44555
+ // src/mcp/tools/query-task-state-tool.ts
44556
+ import { z as z94 } from "zod";
44557
+ var QueryTaskStateInputSchema = z94.object({
44558
+ taskId: z94.string().min(1).max(128).describe("Task ID whose structured state log should be read")
43718
44559
  });
43719
44560
  function queryTaskStateHandler(args, ctx) {
43720
44561
  const parsed = QueryTaskStateInputSchema.safeParse(args);
@@ -43744,9 +44585,9 @@ function queryTaskStateHandler(args, ctx) {
43744
44585
  function registerQueryTaskStateTool(server, deps) {
43745
44586
  const logger56 = deps.logger ?? createLogger({ tool: "query_task_state" });
43746
44587
  const toolSchema = {
43747
- taskId: z93.string().min(1).max(128).describe("Task ID whose structured state log should be read")
44588
+ taskId: z94.string().min(1).max(128).describe("Task ID whose structured state log should be read")
43748
44589
  };
43749
- 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.";
44590
+ const description2 = "Read the structured state log for a task ID and return the current snapshot. Includes Magentic-One Task Ledger (facts/guesses/openQuestions) and Progress Ledger (per-step reflections with suggestedAction) when orchestrators have written them. Structured state is only written when NEXUS_TASK_STATE_ENABLED=1 was set during the orchestrate invocation.";
43750
44591
  const secureHandler = createSecureHandler(queryTaskStateHandler, {
43751
44592
  toolName: "query_task_state",
43752
44593
  rateLimiter: deps.rateLimiter,
@@ -43759,7 +44600,7 @@ function registerQueryTaskStateTool(server, deps) {
43759
44600
  });
43760
44601
  server.registerTool(
43761
44602
  "query_task_state",
43762
- { description, inputSchema: toolSchema },
44603
+ { description: description2, inputSchema: toolSchema },
43763
44604
  toSdkCallback(wrappedHandler)
43764
44605
  );
43765
44606
  logger56.info("Registered query_task_state tool");
@@ -43768,9 +44609,9 @@ function registerQueryTaskStateTool(server, deps) {
43768
44609
  // src/mcp/tools/verify-audit-chain-tool.ts
43769
44610
  import * as fs12 from "fs/promises";
43770
44611
  import * as path11 from "path";
43771
- import { z as z94 } from "zod";
43772
- var VerifyAuditChainInputSchema = z94.object({
43773
- logDir: z94.string().min(1).max(512).describe(
44612
+ import { z as z95 } from "zod";
44613
+ var VerifyAuditChainInputSchema = z95.object({
44614
+ logDir: z95.string().min(1).max(512).describe(
43774
44615
  "Filesystem path to the FileAuditStorage log directory. Tool reads all `audit-*.jsonl` files in lexicographic order and verifies the combined chain."
43775
44616
  )
43776
44617
  });
@@ -43838,11 +44679,11 @@ async function handler2(args, ctx) {
43838
44679
  function registerVerifyAuditChainTool(server, deps) {
43839
44680
  const logger56 = deps.logger ?? createLogger({ tool: "verify_audit_chain" });
43840
44681
  const toolSchema = {
43841
- logDir: z94.string().min(1).max(512).describe(
44682
+ logDir: z95.string().min(1).max(512).describe(
43842
44683
  "Filesystem path to the FileAuditStorage log directory. Tool reads all `audit-*.jsonl` files and verifies the combined hash chain."
43843
44684
  )
43844
44685
  };
43845
- const description = "Verify the hash chain of a persisted FileAuditStorage audit log. Reads all `audit-*.jsonl` files in the given directory, parses events, and runs `verifyChain()` to detect tampering. Returns a structured result with eventCount, fileCount, and one of three tamper signals if detected (hash_mismatch, previous_hash_mismatch, missing_hash). Read-only \u2014 never writes or deletes events.";
44686
+ const description2 = "Verify the hash chain of a persisted FileAuditStorage audit log. Reads all `audit-*.jsonl` files in the given directory, parses events, and runs `verifyChain()` to detect tampering. Returns a structured result with eventCount, fileCount, and one of three tamper signals if detected (hash_mismatch, previous_hash_mismatch, missing_hash). Read-only \u2014 never writes or deletes events.";
43846
44687
  const secureHandler = createSecureHandler(handler2, {
43847
44688
  toolName: "verify_audit_chain",
43848
44689
  rateLimiter: deps.rateLimiter,
@@ -43855,25 +44696,25 @@ function registerVerifyAuditChainTool(server, deps) {
43855
44696
  });
43856
44697
  server.registerTool(
43857
44698
  "verify_audit_chain",
43858
- { description, inputSchema: toolSchema },
44699
+ { description: description2, inputSchema: toolSchema },
43859
44700
  toSdkCallback(wrappedHandler)
43860
44701
  );
43861
44702
  logger56.info("Registered verify_audit_chain tool");
43862
44703
  }
43863
44704
 
43864
44705
  // src/mcp/tools/pipeline-tool.ts
43865
- import { z as z95 } from "zod";
44706
+ import { z as z96 } from "zod";
43866
44707
  import * as fs13 from "fs";
43867
44708
  import * as path12 from "path";
43868
- var PipelineInputSchema = z95.object({
44709
+ var PipelineInputSchema = z96.object({
43869
44710
  /** The task to execute. */
43870
- task: z95.string().min(5).max(1e4).describe("Task description \u2014 pipeline template auto-selected based on content"),
44711
+ task: z96.string().min(5).max(1e4).describe("Task description \u2014 pipeline template auto-selected based on content"),
43871
44712
  /** Path to a spec file (.md, .yaml) to use as task input. */
43872
- specFile: z95.string().max(500).optional().describe("Path to a spec file \u2014 content prepended to task for greenfield projects"),
44713
+ specFile: z96.string().max(500).optional().describe("Path to a spec file \u2014 content prepended to task for greenfield projects"),
43873
44714
  /** Override template (dev, research, audit, greenfield). Auto-detected if omitted. */
43874
- template: z95.string().max(50).optional().describe(`Pipeline template override. Available: ${listTemplateIds().join(", ")}`),
44715
+ template: z96.string().max(50).optional().describe(`Pipeline template override. Available: ${listTemplateIds().join(", ")}`),
43875
44716
  /** Voting strategy for consensus stages. */
43876
- votingStrategy: z95.enum([
44717
+ votingStrategy: z96.enum([
43877
44718
  "simple_majority",
43878
44719
  "supermajority",
43879
44720
  "unanimous",
@@ -43884,13 +44725,13 @@ var PipelineInputSchema = z95.object({
43884
44725
  "Voting strategy for plan approval. simple_majority (default), supermajority (67%), unanimous, higher_order (Bayesian), proof_of_learning, opinion_wise"
43885
44726
  ),
43886
44727
  /** Use 3 agents instead of 6 for faster voting. */
43887
- quickMode: z95.boolean().default(false).describe("Use 3 agents instead of 6 for faster consensus voting"),
44728
+ quickMode: z96.boolean().default(false).describe("Use 3 agents instead of 6 for faster consensus voting"),
43888
44729
  /** Maximum execution time per stage in milliseconds (min 30s, max 600s). */
43889
- timeoutMs: z95.number().int().min(3e4).max(6e5).optional().describe("Max time per stage in ms (30000-600000). Default: varies by stage complexity"),
44730
+ timeoutMs: z96.number().int().min(3e4).max(6e5).optional().describe("Max time per stage in ms (30000-600000). Default: varies by stage complexity"),
43890
44731
  /** Stop after planning/voting (no implementation). */
43891
- dryRun: z95.boolean().default(false).describe("Stop after vote stage (no implementation)"),
44732
+ dryRun: z96.boolean().default(false).describe("Stop after vote stage (no implementation)"),
43892
44733
  /** TESTS ONLY — random output, must not be used for real decisions. (#2319) */
43893
- simulateVotes: z95.boolean().default(false).describe("TESTS ONLY \u2014 random output, must not be used for real decisions (#2319)")
44734
+ simulateVotes: z96.boolean().default(false).describe("TESTS ONLY \u2014 random output, must not be used for real decisions (#2319)")
43894
44735
  });
43895
44736
  function buildOutput2(result) {
43896
44737
  return {
@@ -43975,7 +44816,7 @@ function registerPipelineTool(server, _deps) {
43975
44816
  }
43976
44817
 
43977
44818
  // src/mcp/tools/supply-chain-tradeoff-panel.ts
43978
- import { z as z96 } from "zod";
44819
+ import { z as z97 } from "zod";
43979
44820
  var DEFAULT_AXES = [
43980
44821
  "build_time_determinism",
43981
44822
  "supply_chain_risk",
@@ -43985,16 +44826,16 @@ var MAX_AXES = 6;
43985
44826
  var MAX_AXIS_NAME_LENGTH = 64;
43986
44827
  var MAX_PROPOSAL_LENGTH = 4e3;
43987
44828
  var MAX_CONTEXT_LENGTH = 4e3;
43988
- var SupplyChainTradeoffPanelInputSchema = z96.object({
43989
- proposal: z96.string().min(1).max(MAX_PROPOSAL_LENGTH).describe('The proposal under tradeoff review (e.g. "Should aegis-boot adopt cargo-nextest?")'),
43990
- axes: z96.array(z96.string().min(1).max(MAX_AXIS_NAME_LENGTH)).min(1).max(MAX_AXES).optional().describe(
44829
+ var SupplyChainTradeoffPanelInputSchema = z97.object({
44830
+ proposal: z97.string().min(1).max(MAX_PROPOSAL_LENGTH).describe('The proposal under tradeoff review (e.g. "Should aegis-boot adopt cargo-nextest?")'),
44831
+ axes: z97.array(z97.string().min(1).max(MAX_AXIS_NAME_LENGTH)).min(1).max(MAX_AXES).optional().describe(
43991
44832
  `Tradeoff axes to evaluate. Default: ${DEFAULT_AXES.join(", ")}. Custom axes accepted; max ${String(MAX_AXES)}.`
43992
44833
  ),
43993
- context: z96.string().max(MAX_CONTEXT_LENGTH).optional().describe(
44834
+ context: z97.string().max(MAX_CONTEXT_LENGTH).optional().describe(
43994
44835
  "Optional context: relevant repo state, dependency tree, vendor publishing patterns, etc."
43995
44836
  ),
43996
- quickMode: z96.boolean().optional().default(false).describe("Use 3 voters (architect, security, scope_steward) instead of 7"),
43997
- simulate: z96.boolean().optional().default(false).describe("Use simulated voters (testing only)")
44837
+ quickMode: z97.boolean().optional().default(false).describe("Use 3 voters (architect, security, scope_steward) instead of 7"),
44838
+ simulate: z97.boolean().optional().default(false).describe("Use simulated voters (testing only)")
43998
44839
  });
43999
44840
 
44000
44841
  // src/mcp/tools/tool-annotations.ts
@@ -44239,6 +45080,24 @@ var TOOL_ANNOTATIONS = {
44239
45080
  },
44240
45081
  sideEffects: [{ category: "implicit", description: "Consumes rate limit quota" }]
44241
45082
  },
45083
+ improvement_review: {
45084
+ annotations: {
45085
+ title: "Improvement Review",
45086
+ readOnlyHint: false,
45087
+ destructiveHint: false,
45088
+ // When fileIssues=true, creates GitHub issues — not idempotent.
45089
+ idempotentHint: false,
45090
+ openWorldHint: true
45091
+ },
45092
+ sideEffects: [
45093
+ { category: "implicit", description: "Reads OutcomeStore and runs fitness audit" },
45094
+ {
45095
+ category: "explicit",
45096
+ description: "When fileIssues=true, files candidate GitHub issues via gh CLI"
45097
+ },
45098
+ { category: "implicit", description: "Consumes rate limit quota" }
45099
+ ]
45100
+ },
44242
45101
  issue_triage: {
44243
45102
  annotations: {
44244
45103
  title: "Issue Triage",
@@ -44447,7 +45306,8 @@ var REGISTERED_TOOL_NAMES = [
44447
45306
  "run_dev_pipeline",
44448
45307
  "run_pipeline",
44449
45308
  "pr_review",
44450
- "supply_chain_tradeoff_panel"
45309
+ "supply_chain_tradeoff_panel",
45310
+ "improvement_review"
44451
45311
  ];
44452
45312
  function registerTools(server, options) {
44453
45313
  const logger56 = options?.logger ?? createMcpLogger({ component: "tools" });
@@ -44582,40 +45442,40 @@ var RiskLevel = /* @__PURE__ */ ((RiskLevel2) => {
44582
45442
  })(RiskLevel || {});
44583
45443
 
44584
45444
  // src/mcp/safety/stpa-schemas.ts
44585
- import { z as z97 } from "zod";
44586
- var HazardCategorySchema = z97.enum(HazardCategory);
44587
- var HazardSeveritySchema = z97.enum(HazardSeverity);
44588
- var ConstraintPrioritySchema = z97.enum(ConstraintPriority);
44589
- var RiskLevelSchema = z97.enum(RiskLevel);
44590
- var TriggerPatternSchema = z97.object({
44591
- parameter: z97.string().min(1),
44592
- matchType: z97.enum(["contains", "regex", "equals", "startsWith", "endsWith"]),
44593
- pattern: z97.string(),
44594
- reason: z97.string()
45445
+ import { z as z98 } from "zod";
45446
+ var HazardCategorySchema = z98.enum(HazardCategory);
45447
+ var HazardSeveritySchema = z98.enum(HazardSeverity);
45448
+ var ConstraintPrioritySchema = z98.enum(ConstraintPriority);
45449
+ var RiskLevelSchema = z98.enum(RiskLevel);
45450
+ var TriggerPatternSchema = z98.object({
45451
+ parameter: z98.string().min(1),
45452
+ matchType: z98.enum(["contains", "regex", "equals", "startsWith", "endsWith"]),
45453
+ pattern: z98.string(),
45454
+ reason: z98.string()
44595
45455
  });
44596
- var HazardSchema = z97.object({
44597
- id: z97.string().min(1),
44598
- description: z97.string(),
45456
+ var HazardSchema = z98.object({
45457
+ id: z98.string().min(1),
45458
+ description: z98.string(),
44599
45459
  category: HazardCategorySchema,
44600
45460
  severity: HazardSeveritySchema,
44601
- likelihood: z97.enum(["almost_certain", "likely", "possible", "unlikely", "rare"]),
44602
- triggerConditions: z97.array(z97.string()),
44603
- consequences: z97.array(z97.string())
45461
+ likelihood: z98.enum(["almost_certain", "likely", "possible", "unlikely", "rare"]),
45462
+ triggerConditions: z98.array(z98.string()),
45463
+ consequences: z98.array(z98.string())
44604
45464
  });
44605
- var UnsafeControlActionSchema = z97.object({
44606
- id: z97.string().min(1),
44607
- toolName: z97.string().min(1),
44608
- type: z97.enum(["not_provided", "provided_causes_hazard", "wrong_timing", "wrong_duration"]),
44609
- description: z97.string(),
44610
- unsafeContext: z97.string(),
44611
- relatedHazards: z97.array(z97.string()),
44612
- triggerPatterns: z97.array(TriggerPatternSchema).optional()
45465
+ var UnsafeControlActionSchema = z98.object({
45466
+ id: z98.string().min(1),
45467
+ toolName: z98.string().min(1),
45468
+ type: z98.enum(["not_provided", "provided_causes_hazard", "wrong_timing", "wrong_duration"]),
45469
+ description: z98.string(),
45470
+ unsafeContext: z98.string(),
45471
+ relatedHazards: z98.array(z98.string()),
45472
+ triggerPatterns: z98.array(TriggerPatternSchema).optional()
44613
45473
  });
44614
- var SafetyConstraintSchema = z97.object({
44615
- id: z97.string().min(1),
44616
- description: z97.string(),
44617
- mitigates: z97.array(z97.string()),
44618
- enforcement: z97.enum([
45474
+ var SafetyConstraintSchema = z98.object({
45475
+ id: z98.string().min(1),
45476
+ description: z98.string(),
45477
+ mitigates: z98.array(z98.string()),
45478
+ enforcement: z98.enum([
44619
45479
  "prevent",
44620
45480
  "require_confirmation",
44621
45481
  "alert",
@@ -44623,54 +45483,54 @@ var SafetyConstraintSchema = z97.object({
44623
45483
  "rate_limit",
44624
45484
  "require_privilege"
44625
45485
  ]),
44626
- validationFunction: z97.string().optional(),
45486
+ validationFunction: z98.string().optional(),
44627
45487
  priority: ConstraintPrioritySchema
44628
45488
  });
44629
- var PropertySchemaSchema = z97.object({
44630
- type: z97.string(),
44631
- description: z97.string().optional(),
44632
- enum: z97.array(z97.unknown()).optional(),
44633
- pattern: z97.string().optional(),
44634
- minimum: z97.number().optional(),
44635
- maximum: z97.number().optional()
45489
+ var PropertySchemaSchema = z98.object({
45490
+ type: z98.string(),
45491
+ description: z98.string().optional(),
45492
+ enum: z98.array(z98.unknown()).optional(),
45493
+ pattern: z98.string().optional(),
45494
+ minimum: z98.number().optional(),
45495
+ maximum: z98.number().optional()
44636
45496
  });
44637
- var ToolInputSchemaSchema = z97.object({
44638
- type: z97.string(),
44639
- properties: z97.record(z97.string(), PropertySchemaSchema).optional(),
44640
- required: z97.array(z97.string()).optional(),
44641
- additionalProperties: z97.boolean().optional()
45497
+ var ToolInputSchemaSchema = z98.object({
45498
+ type: z98.string(),
45499
+ properties: z98.record(z98.string(), PropertySchemaSchema).optional(),
45500
+ required: z98.array(z98.string()).optional(),
45501
+ additionalProperties: z98.boolean().optional()
44642
45502
  });
44643
- var ToolDefinitionSchema = z97.object({
44644
- name: z97.string().min(1),
44645
- description: z97.string(),
45503
+ var ToolDefinitionSchema = z98.object({
45504
+ name: z98.string().min(1),
45505
+ description: z98.string(),
44646
45506
  inputSchema: ToolInputSchemaSchema
44647
45507
  });
44648
- var AnalysisConfigurationSchema = z97.object({
44649
- includeLowSeverity: z97.boolean().default(true),
44650
- generateAllConstraints: z97.boolean().default(true),
44651
- checkInteractions: z97.boolean().default(true),
44652
- maxHazardsPerTool: z97.number().int().min(1).max(100).default(50),
44653
- categories: z97.array(HazardCategorySchema).default([])
45508
+ var AnalysisConfigurationSchema = z98.object({
45509
+ includeLowSeverity: z98.boolean().default(true),
45510
+ generateAllConstraints: z98.boolean().default(true),
45511
+ checkInteractions: z98.boolean().default(true),
45512
+ maxHazardsPerTool: z98.number().int().min(1).max(100).default(50),
45513
+ categories: z98.array(HazardCategorySchema).default([])
44654
45514
  });
44655
- var ConstraintViolationSchema = z97.object({
44656
- constraintId: z97.string().min(1),
44657
- constraintDescription: z97.string(),
45515
+ var ConstraintViolationSchema = z98.object({
45516
+ constraintId: z98.string().min(1),
45517
+ constraintDescription: z98.string(),
44658
45518
  severity: HazardSeveritySchema,
44659
- details: z97.string(),
44660
- remediation: z97.string()
45519
+ details: z98.string(),
45520
+ remediation: z98.string()
44661
45521
  });
44662
- var ValidationWarningSchema = z97.object({
44663
- code: z97.string().min(1),
44664
- message: z97.string(),
44665
- affected: z97.string()
45522
+ var ValidationWarningSchema = z98.object({
45523
+ code: z98.string().min(1),
45524
+ message: z98.string(),
45525
+ affected: z98.string()
44666
45526
  });
44667
- var ValidationResultSchema = z97.object({
44668
- valid: z97.boolean(),
44669
- toolName: z97.string().min(1),
44670
- violations: z97.array(ConstraintViolationSchema),
44671
- passed: z97.array(z97.string()),
44672
- warnings: z97.array(ValidationWarningSchema),
44673
- validatedAt: z97.date()
45527
+ var ValidationResultSchema = z98.object({
45528
+ valid: z98.boolean(),
45529
+ toolName: z98.string().min(1),
45530
+ violations: z98.array(ConstraintViolationSchema),
45531
+ passed: z98.array(z98.string()),
45532
+ warnings: z98.array(ValidationWarningSchema),
45533
+ validatedAt: z98.date()
44674
45534
  });
44675
45535
 
44676
45536
  // src/mcp/safety/stpa-types.ts
@@ -45755,53 +46615,53 @@ var GeminiResponseParser = class {
45755
46615
  };
45756
46616
 
45757
46617
  // src/cli-adapters/router-types.ts
45758
- import { z as z98 } from "zod";
45759
- var RouterConfigSchema = z98.object({
45760
- minCapacityThreshold: z98.number().min(0).max(1).default(0.1),
45761
- preferCostEfficient: z98.boolean().default(false),
45762
- maxDecisionTimeMs: z98.number().min(1).max(1e3).default(100)
46618
+ import { z as z99 } from "zod";
46619
+ var RouterConfigSchema = z99.object({
46620
+ minCapacityThreshold: z99.number().min(0).max(1).default(0.1),
46621
+ preferCostEfficient: z99.boolean().default(false),
46622
+ maxDecisionTimeMs: z99.number().min(1).max(1e3).default(100)
45763
46623
  });
45764
46624
 
45765
46625
  // src/cli-adapters/agreement-cascade-types.ts
45766
- import { z as z99 } from "zod";
45767
- var AgreementCascadeConfigSchema = z99.object({
45768
- agreementThreshold: z99.number().min(0.5).max(1).default(0.7),
45769
- maxStages: z99.number().int().min(1).max(5).default(3),
45770
- modelTimeoutMs: z99.number().int().min(1e3).max(3e5).default(6e4)
46626
+ import { z as z100 } from "zod";
46627
+ var AgreementCascadeConfigSchema = z100.object({
46628
+ agreementThreshold: z100.number().min(0.5).max(1).default(0.7),
46629
+ maxStages: z100.number().int().min(1).max(5).default(3),
46630
+ modelTimeoutMs: z100.number().int().min(1e3).max(3e5).default(6e4)
45771
46631
  });
45772
46632
 
45773
46633
  // src/cli-adapters/agreement-cascade-router.ts
45774
46634
  var logger42 = createLogger({ component: "agreement-cascade-router" });
45775
46635
 
45776
46636
  // src/cli-adapters/daao-types.ts
45777
- import { z as z100 } from "zod";
45778
- var EncodedFeaturesSchema = z100.object({
46637
+ import { z as z101 } from "zod";
46638
+ var EncodedFeaturesSchema = z101.object({
45779
46639
  /** Lexical complexity score (vocabulary diversity, rare words) */
45780
- lexicalComplexity: z100.number().min(0).max(1),
46640
+ lexicalComplexity: z101.number().min(0).max(1),
45781
46641
  /** Syntactic complexity score (sentence structure, nesting) */
45782
- syntacticComplexity: z100.number().min(0).max(1),
46642
+ syntacticComplexity: z101.number().min(0).max(1),
45783
46643
  /** Semantic density score (concept density, abstraction level) */
45784
- semanticDensity: z100.number().min(0).max(1),
46644
+ semanticDensity: z101.number().min(0).max(1),
45785
46645
  /** Technical specificity (domain-specific terminology) */
45786
- technicalSpecificity: z100.number().min(0).max(1),
46646
+ technicalSpecificity: z101.number().min(0).max(1),
45787
46647
  /** Task scope (breadth of requirements) */
45788
- taskScope: z100.number().min(0).max(1),
46648
+ taskScope: z101.number().min(0).max(1),
45789
46649
  /** Constraint complexity (constraints, edge cases, requirements) */
45790
- constraintComplexity: z100.number().min(0).max(1),
46650
+ constraintComplexity: z101.number().min(0).max(1),
45791
46651
  /** Ambiguity level (inverse - higher means more clear/specific) */
45792
- clarity: z100.number().min(0).max(1),
46652
+ clarity: z101.number().min(0).max(1),
45793
46653
  /** Output complexity expectation */
45794
- outputComplexity: z100.number().min(0).max(1)
46654
+ outputComplexity: z101.number().min(0).max(1)
45795
46655
  });
45796
- var FeatureWeightsSchema = z100.object({
45797
- lexicalComplexity: z100.number().min(0).max(1),
45798
- syntacticComplexity: z100.number().min(0).max(1),
45799
- semanticDensity: z100.number().min(0).max(1),
45800
- technicalSpecificity: z100.number().min(0).max(1),
45801
- taskScope: z100.number().min(0).max(1),
45802
- constraintComplexity: z100.number().min(0).max(1),
45803
- clarity: z100.number().min(0).max(1),
45804
- outputComplexity: z100.number().min(0).max(1)
46656
+ var FeatureWeightsSchema = z101.object({
46657
+ lexicalComplexity: z101.number().min(0).max(1),
46658
+ syntacticComplexity: z101.number().min(0).max(1),
46659
+ semanticDensity: z101.number().min(0).max(1),
46660
+ technicalSpecificity: z101.number().min(0).max(1),
46661
+ taskScope: z101.number().min(0).max(1),
46662
+ constraintComplexity: z101.number().min(0).max(1),
46663
+ clarity: z101.number().min(0).max(1),
46664
+ outputComplexity: z101.number().min(0).max(1)
45805
46665
  });
45806
46666
  var DEFAULT_FEATURE_WEIGHTS = {
45807
46667
  lexicalComplexity: 0.1,
@@ -45823,50 +46683,50 @@ var DEFAULT_DAAO_TIER_TO_CLIS = {
45823
46683
  balanced: ["codex", "opencode", "gemini", "claude"],
45824
46684
  powerful: ["claude", "codex", "opencode", "gemini"]
45825
46685
  };
45826
- var DAAOConfigSchema = z100.object({
46686
+ var DAAOConfigSchema = z101.object({
45827
46687
  /** Difficulty thresholds for level classification */
45828
- thresholds: z100.object({
45829
- easyUpperBound: z100.number().min(0).max(1),
45830
- hardLowerBound: z100.number().min(0).max(1)
46688
+ thresholds: z101.object({
46689
+ easyUpperBound: z101.number().min(0).max(1),
46690
+ hardLowerBound: z101.number().min(0).max(1)
45831
46691
  }).default(DEFAULT_DAAO_THRESHOLDS),
45832
46692
  /** Feature weights for difficulty aggregation */
45833
46693
  weights: FeatureWeightsSchema.default(DEFAULT_FEATURE_WEIGHTS),
45834
46694
  /** Mapping from model tier to CLI preference order */
45835
- tierToClis: z100.record(
45836
- z100.enum(["fast", "balanced", "powerful"]),
45837
- z100.array(z100.enum(["claude", "gemini", "codex", "opencode"]))
46695
+ tierToClis: z101.record(
46696
+ z101.enum(["fast", "balanced", "powerful"]),
46697
+ z101.array(z101.enum(["claude", "gemini", "codex", "opencode"]))
45838
46698
  ).default(DEFAULT_DAAO_TIER_TO_CLIS),
45839
46699
  /** Enable adaptive calibration from outcomes */
45840
- enableCalibration: z100.boolean().default(true),
46700
+ enableCalibration: z101.boolean().default(true),
45841
46701
  /** Maximum outcomes to store for calibration */
45842
- maxCalibrationOutcomes: z100.number().int().positive().default(1e3),
46702
+ maxCalibrationOutcomes: z101.number().int().positive().default(1e3),
45843
46703
  /** Minimum outcomes before applying calibration adjustments */
45844
- minCalibrationOutcomes: z100.number().int().positive().default(50),
46704
+ minCalibrationOutcomes: z101.number().int().positive().default(50),
45845
46705
  /** Reconstruction error threshold for typical patterns */
45846
- typicalPatternThreshold: z100.number().min(0).max(1).default(0.3),
46706
+ typicalPatternThreshold: z101.number().min(0).max(1).default(0.3),
45847
46707
  /** Verbose logging */
45848
- verbose: z100.boolean().default(false)
46708
+ verbose: z101.boolean().default(false)
45849
46709
  });
45850
46710
 
45851
46711
  // src/cli-adapters/task-classifier.ts
45852
- import { z as z101 } from "zod";
45853
- var ClassificationPatternsSchema = z101.object({
45854
- code: z101.array(z101.string()).readonly(),
45855
- research: z101.array(z101.string()).readonly(),
45856
- documentation: z101.array(z101.string()).readonly(),
45857
- analysis: z101.array(z101.string()).readonly()
46712
+ import { z as z102 } from "zod";
46713
+ var ClassificationPatternsSchema = z102.object({
46714
+ code: z102.array(z102.string()).readonly(),
46715
+ research: z102.array(z102.string()).readonly(),
46716
+ documentation: z102.array(z102.string()).readonly(),
46717
+ analysis: z102.array(z102.string()).readonly()
45858
46718
  });
45859
46719
 
45860
46720
  // src/cli-adapters/response-cache-types.ts
45861
- import { z as z102 } from "zod";
45862
- var ResponseCacheConfigSchema = z102.object({
45863
- defaultTTL: z102.number().min(1e3).max(36e5).default(3e5),
46721
+ import { z as z103 } from "zod";
46722
+ var ResponseCacheConfigSchema = z103.object({
46723
+ defaultTTL: z103.number().min(1e3).max(36e5).default(3e5),
45864
46724
  // 5 minutes
45865
- maxEntries: z102.number().min(10).max(1e5).default(1e3),
45866
- maxMemoryMB: z102.number().min(1).max(1e3).default(50),
45867
- cleanupInterval: z102.number().min(1e3).max(6e5).default(6e4),
46725
+ maxEntries: z103.number().min(10).max(1e5).default(1e3),
46726
+ maxMemoryMB: z103.number().min(1).max(1e3).default(50),
46727
+ cleanupInterval: z103.number().min(1e3).max(6e5).default(6e4),
45868
46728
  // 1 minute
45869
- enableLogging: z102.boolean().default(false)
46729
+ enableLogging: z103.boolean().default(false)
45870
46730
  });
45871
46731
 
45872
46732
  // src/cli-adapters/response-cache-utils.ts
@@ -45874,12 +46734,12 @@ import { createHash as createHash4 } from "crypto";
45874
46734
  var logger43 = createLogger({ component: "ResponseCacheUtils" });
45875
46735
 
45876
46736
  // src/cli-adapters/unified-routing-types.ts
45877
- import { z as z103 } from "zod";
45878
- var UnifiedRoutingDecisionSchema = z103.object({
45879
- selectedCli: z103.string(),
45880
- confidence: z103.number().min(0).max(1),
45881
- reason: z103.string(),
45882
- strategy: z103.enum([
46737
+ import { z as z104 } from "zod";
46738
+ var UnifiedRoutingDecisionSchema = z104.object({
46739
+ selectedCli: z104.string(),
46740
+ confidence: z104.number().min(0).max(1),
46741
+ reason: z104.string(),
46742
+ strategy: z104.enum([
45883
46743
  "composite",
45884
46744
  "quality",
45885
46745
  "budget",
@@ -45891,57 +46751,57 @@ var UnifiedRoutingDecisionSchema = z103.object({
45891
46751
  "linucb",
45892
46752
  "direct"
45893
46753
  ]),
45894
- decisionTimeMs: z103.number().nonnegative(),
45895
- alternatives: z103.array(z103.string()).readonly(),
45896
- stagesExecuted: z103.array(z103.string()).readonly(),
45897
- withinBudget: z103.boolean().optional(),
45898
- estimatedComplexity: z103.enum(["simple", "moderate", "complex", "expert"]).optional(),
45899
- estimatedTokens: z103.number().int().positive().optional(),
45900
- topsisScore: z103.number().optional(),
45901
- ucbScore: z103.number().optional(),
45902
- resolvedAtStage: z103.number().int().nonnegative().optional(),
45903
- consensusReached: z103.boolean().optional(),
45904
- agreementScore: z103.number().min(0).max(1).optional(),
45905
- metadata: z103.record(z103.string(), z103.unknown()).optional()
46754
+ decisionTimeMs: z104.number().nonnegative(),
46755
+ alternatives: z104.array(z104.string()).readonly(),
46756
+ stagesExecuted: z104.array(z104.string()).readonly(),
46757
+ withinBudget: z104.boolean().optional(),
46758
+ estimatedComplexity: z104.enum(["simple", "moderate", "complex", "expert"]).optional(),
46759
+ estimatedTokens: z104.number().int().positive().optional(),
46760
+ topsisScore: z104.number().optional(),
46761
+ ucbScore: z104.number().optional(),
46762
+ resolvedAtStage: z104.number().int().nonnegative().optional(),
46763
+ consensusReached: z104.boolean().optional(),
46764
+ agreementScore: z104.number().min(0).max(1).optional(),
46765
+ metadata: z104.record(z104.string(), z104.unknown()).optional()
45906
46766
  });
45907
46767
 
45908
46768
  // src/learning/outcome-feedback-types.ts
45909
- import { z as z104 } from "zod";
45910
- var QualitySignalsSchema = z104.object({
45911
- testsPass: z104.boolean().optional(),
45912
- lintErrors: z104.number().int().min(0).optional(),
45913
- userApproved: z104.boolean().optional(),
45914
- retryCount: z104.number().int().min(0).default(0),
45915
- completionRatio: z104.number().min(0).max(1).default(1),
45916
- validStructure: z104.boolean().optional(),
45917
- coherenceScore: z104.number().min(0).max(1).optional()
46769
+ import { z as z105 } from "zod";
46770
+ var QualitySignalsSchema = z105.object({
46771
+ testsPass: z105.boolean().optional(),
46772
+ lintErrors: z105.number().int().min(0).optional(),
46773
+ userApproved: z105.boolean().optional(),
46774
+ retryCount: z105.number().int().min(0).default(0),
46775
+ completionRatio: z105.number().min(0).max(1).default(1),
46776
+ validStructure: z105.boolean().optional(),
46777
+ coherenceScore: z105.number().min(0).max(1).optional()
45918
46778
  });
45919
- var RoutingDecisionSchema = z104.object({
45920
- id: z104.uuid(),
45921
- timestamp: z104.iso.datetime(),
45922
- query: z104.string(),
45923
- routerType: z104.enum(["linucb", "preference", "quality", "cascade", "topsis"]),
45924
- selectedModel: z104.string(),
45925
- selectedTier: z104.enum(["strong", "weak"]).optional(),
45926
- armIndex: z104.number().int().min(0).optional(),
45927
- banditContext: z104.record(z104.string(), z104.unknown()).optional(),
45928
- queryFeatures: z104.record(z104.string(), z104.unknown()).optional(),
45929
- ucbScore: z104.number().optional(),
45930
- confidence: z104.number().min(0).max(1).optional(),
45931
- traceId: z104.string(),
45932
- domain: z104.string().optional()
46779
+ var RoutingDecisionSchema = z105.object({
46780
+ id: z105.uuid(),
46781
+ timestamp: z105.iso.datetime(),
46782
+ query: z105.string(),
46783
+ routerType: z105.enum(["linucb", "preference", "quality", "cascade", "topsis"]),
46784
+ selectedModel: z105.string(),
46785
+ selectedTier: z105.enum(["strong", "weak"]).optional(),
46786
+ armIndex: z105.number().int().min(0).optional(),
46787
+ banditContext: z105.record(z105.string(), z105.unknown()).optional(),
46788
+ queryFeatures: z105.record(z105.string(), z105.unknown()).optional(),
46789
+ ucbScore: z105.number().optional(),
46790
+ confidence: z105.number().min(0).max(1).optional(),
46791
+ traceId: z105.string(),
46792
+ domain: z105.string().optional()
45933
46793
  });
45934
- var TaskOutcomeSchema = z104.object({
45935
- routingDecisionId: z104.uuid(),
45936
- timestamp: z104.iso.datetime(),
45937
- outcomeClass: z104.enum(["success", "partial", "failure", "timeout", "error"]),
45938
- success: z104.boolean(),
45939
- qualityScore: z104.number().min(0).max(1),
45940
- durationMs: z104.number().min(0),
45941
- tokenUsage: z104.number().int().min(0),
45942
- errorMessage: z104.string().optional(),
46794
+ var TaskOutcomeSchema = z105.object({
46795
+ routingDecisionId: z105.uuid(),
46796
+ timestamp: z105.iso.datetime(),
46797
+ outcomeClass: z105.enum(["success", "partial", "failure", "timeout", "error"]),
46798
+ success: z105.boolean(),
46799
+ qualityScore: z105.number().min(0).max(1),
46800
+ durationMs: z105.number().min(0),
46801
+ tokenUsage: z105.number().int().min(0),
46802
+ errorMessage: z105.string().optional(),
45943
46803
  qualitySignals: QualitySignalsSchema,
45944
- traceId: z104.string()
46804
+ traceId: z105.string()
45945
46805
  });
45946
46806
  var DEFAULT_FEEDBACK_COLLECTOR_CONFIG = {
45947
46807
  maxPendingDecisions: 1e3,
@@ -45956,17 +46816,17 @@ var DEFAULT_FEEDBACK_COLLECTOR_CONFIG = {
45956
46816
  targetTokenUsage: 2e3,
45957
46817
  maxHistorySize: 1e4
45958
46818
  };
45959
- var FeedbackCollectorConfigSchema = z104.object({
45960
- maxPendingDecisions: z104.number().int().positive().default(1e3),
45961
- pendingTimeoutMs: z104.number().positive().default(3e5),
45962
- enableAutoReward: z104.boolean().default(true),
45963
- qualityWeight: z104.number().min(0).max(1).default(0.5),
45964
- speedWeight: z104.number().min(0).max(1).default(0.2),
45965
- efficiencyWeight: z104.number().min(0).max(1).default(0.2),
45966
- retryPenalty: z104.number().min(0).max(1).default(0.1),
45967
- targetDurationMs: z104.number().positive().default(5e3),
45968
- targetTokenUsage: z104.number().positive().default(2e3),
45969
- maxHistorySize: z104.number().int().positive().default(1e4)
46819
+ var FeedbackCollectorConfigSchema = z105.object({
46820
+ maxPendingDecisions: z105.number().int().positive().default(1e3),
46821
+ pendingTimeoutMs: z105.number().positive().default(3e5),
46822
+ enableAutoReward: z105.boolean().default(true),
46823
+ qualityWeight: z105.number().min(0).max(1).default(0.5),
46824
+ speedWeight: z105.number().min(0).max(1).default(0.2),
46825
+ efficiencyWeight: z105.number().min(0).max(1).default(0.2),
46826
+ retryPenalty: z105.number().min(0).max(1).default(0.1),
46827
+ targetDurationMs: z105.number().positive().default(5e3),
46828
+ targetTokenUsage: z105.number().positive().default(2e3),
46829
+ maxHistorySize: z105.number().int().positive().default(1e4)
45970
46830
  });
45971
46831
 
45972
46832
  // src/learning/outcome-feedback-helpers.ts
@@ -47028,10 +47888,10 @@ function getPolicy(id) {
47028
47888
  }
47029
47889
 
47030
47890
  // src/security/sandbox/sandbox-executor.ts
47031
- import { execFile as execFile2 } from "child_process";
47032
- import { promisify as promisify2 } from "util";
47891
+ import { execFile as execFile3 } from "child_process";
47892
+ import { promisify as promisify3 } from "util";
47033
47893
  import { resolve as resolve17, normalize as normalize2, sep as sep6 } from "path";
47034
- var execFileAsync2 = promisify2(execFile2);
47894
+ var execFileAsync3 = promisify3(execFile3);
47035
47895
  var logger45 = createLogger({ component: "sandbox-executor" });
47036
47896
  function parseExecError(error) {
47037
47897
  const execError = error;
@@ -47140,7 +48000,7 @@ var PolicySandboxExecutor = class {
47140
48000
  * Executes command with resource limits.
47141
48001
  */
47142
48002
  async executeWithLimits(command, args, cwd, env, limits) {
47143
- const { stdout, stderr } = await execFileAsync2(command, [...args], {
48003
+ const { stdout, stderr } = await execFileAsync3(command, [...args], {
47144
48004
  cwd: cwd ?? process.cwd(),
47145
48005
  timeout: limits.maxWallTimeMs,
47146
48006
  maxBuffer: limits.maxOutputBytes,
@@ -47268,14 +48128,14 @@ function createSandboxExecutor(config) {
47268
48128
  }
47269
48129
 
47270
48130
  // src/security/sandbox/docker-sandbox-executor.ts
47271
- import { execFile as execFile4 } from "child_process";
47272
- import { promisify as promisify4 } from "util";
48131
+ import { execFile as execFile5 } from "child_process";
48132
+ import { promisify as promisify5 } from "util";
47273
48133
 
47274
48134
  // src/security/sandbox/docker-sandbox-helpers.ts
47275
- import { execFile as execFile3 } from "child_process";
47276
- import { promisify as promisify3 } from "util";
48135
+ import { execFile as execFile4 } from "child_process";
48136
+ import { promisify as promisify4 } from "util";
47277
48137
  var logger46 = createLogger({ component: "docker-sandbox-helpers" });
47278
- var execFileAsync3 = promisify3(execFile3);
48138
+ var execFileAsync4 = promisify4(execFile4);
47279
48139
  var MAX_OUTPUT_SIZE = 1024 * 1024;
47280
48140
  var DEFAULT_IMAGE = "node:22-alpine";
47281
48141
  var dockerAvailableCache = null;
@@ -47284,7 +48144,7 @@ async function isDockerAvailable() {
47284
48144
  return dockerAvailableCache;
47285
48145
  }
47286
48146
  try {
47287
- await execFileAsync3("docker", ["version"], { timeout: CLI_SUBPROCESS_TIMEOUTS.dockerCheckMs });
48147
+ await execFileAsync4("docker", ["version"], { timeout: CLI_SUBPROCESS_TIMEOUTS.dockerCheckMs });
47288
48148
  dockerAvailableCache = true;
47289
48149
  return true;
47290
48150
  } catch (err2) {
@@ -47355,7 +48215,7 @@ function createResourceUsageFromOutput(stdout, stderr, durationMs) {
47355
48215
  }
47356
48216
 
47357
48217
  // src/security/sandbox/docker-sandbox-executor.ts
47358
- var execFileAsync4 = promisify4(execFile4);
48218
+ var execFileAsync5 = promisify5(execFile5);
47359
48219
  var logger47 = createLogger({ component: "docker-sandbox" });
47360
48220
  var DockerSandboxExecutor = class {
47361
48221
  name = "DockerSandboxExecutor";
@@ -47480,7 +48340,7 @@ var DockerSandboxExecutor = class {
47480
48340
  */
47481
48341
  async executeDocker(args, timeoutMs) {
47482
48342
  logger47.debug("Executing Docker command", { timeout: timeoutMs });
47483
- const { stdout, stderr } = await execFileAsync4("docker", args, {
48343
+ const { stdout, stderr } = await execFileAsync5("docker", args, {
47484
48344
  timeout: timeoutMs,
47485
48345
  maxBuffer: MAX_OUTPUT_SIZE * 2
47486
48346
  });
@@ -48534,8 +49394,8 @@ async function cloneRepository(repo, commit, workDir) {
48534
49394
  const path20 = await import("path");
48535
49395
  const fs21 = await import("fs/promises");
48536
49396
  const childProcess = await import("child_process");
48537
- const { promisify: promisify9 } = await import("util");
48538
- const exec5 = promisify9(childProcess.exec);
49397
+ const { promisify: promisify10 } = await import("util");
49398
+ const exec5 = promisify10(childProcess.exec);
48539
49399
  if (!SAFE_REPO_RE.test(repo)) {
48540
49400
  return { ok: false, error: new AgentRunnerError(`Invalid repo slug: ${repo}`) };
48541
49401
  }
@@ -48558,8 +49418,8 @@ async function cloneRepository(repo, commit, workDir) {
48558
49418
  }
48559
49419
  async function applyPatch(repoDir, patch) {
48560
49420
  const childProcess = await import("child_process");
48561
- const { promisify: promisify9 } = await import("util");
48562
- const exec5 = promisify9(childProcess.exec);
49421
+ const { promisify: promisify10 } = await import("util");
49422
+ const exec5 = promisify10(childProcess.exec);
48563
49423
  const fs21 = await import("fs/promises");
48564
49424
  const path20 = await import("path");
48565
49425
  const patchFile = path20.join(repoDir, ".agent_patch.diff");
@@ -48582,8 +49442,8 @@ async function applyPatch(repoDir, patch) {
48582
49442
  }
48583
49443
  async function captureWorkingDirDiff(repoDir) {
48584
49444
  const childProcess = await import("child_process");
48585
- const { promisify: promisify9 } = await import("util");
48586
- const exec5 = promisify9(childProcess.exec);
49445
+ const { promisify: promisify10 } = await import("util");
49446
+ const exec5 = promisify10(childProcess.exec);
48587
49447
  try {
48588
49448
  const { stdout } = await exec5("git diff", {
48589
49449
  cwd: repoDir,
@@ -48598,8 +49458,8 @@ async function captureWorkingDirDiff(repoDir) {
48598
49458
  }
48599
49459
  async function resetRepository(repoDir) {
48600
49460
  const childProcess = await import("child_process");
48601
- const { promisify: promisify9 } = await import("util");
48602
- const exec5 = promisify9(childProcess.exec);
49461
+ const { promisify: promisify10 } = await import("util");
49462
+ const exec5 = promisify10(childProcess.exec);
48603
49463
  try {
48604
49464
  await exec5(`git checkout -- .`, { cwd: repoDir, timeout: GIT_TIMEOUT_MS });
48605
49465
  await exec5(`git clean -fd`, { cwd: repoDir, timeout: GIT_TIMEOUT_MS });
@@ -49544,8 +50404,8 @@ function mapResolutionStatus(raw) {
49544
50404
 
49545
50405
  // src/swe-bench/harness-version-detection.ts
49546
50406
  import { exec } from "child_process";
49547
- import { promisify as promisify5 } from "util";
49548
- var execAsync = promisify5(exec);
50407
+ import { promisify as promisify6 } from "util";
50408
+ var execAsync = promisify6(exec);
49549
50409
  async function getSwebenchVersion(logger56) {
49550
50410
  try {
49551
50411
  const result = await execAsync(
@@ -50106,7 +50966,7 @@ async function executeHarness(predictionsPath, options = {}, onProgress) {
50106
50966
 
50107
50967
  // src/swe-bench/environment-validator-checks.ts
50108
50968
  import { exec as exec2 } from "child_process";
50109
- import { promisify as promisify6 } from "util";
50969
+ import { promisify as promisify7 } from "util";
50110
50970
 
50111
50971
  // src/swe-bench/environment-validator-types.ts
50112
50972
  var MIN_PYTHON_VERSION = [3, 10];
@@ -50116,7 +50976,7 @@ var COMMAND_TIMEOUT_MS = 1e4;
50116
50976
  var BYTES_PER_GB = 1024 * 1024 * 1024;
50117
50977
 
50118
50978
  // src/swe-bench/environment-validator-checks.ts
50119
- var execAsync2 = promisify6(exec2);
50979
+ var execAsync2 = promisify7(exec2);
50120
50980
  function parseVersion2(versionStr) {
50121
50981
  const match = versionStr.match(/(\d+)\.(\d+)(?:\.(\d+))?/);
50122
50982
  if (!match) return null;
@@ -51532,11 +52392,11 @@ function parsePatch(patch) {
51532
52392
  }
51533
52393
 
51534
52394
  // src/swe-bench/patch-applicator-executor.ts
51535
- import { execFile as execFile5 } from "child_process";
51536
- import { promisify as promisify7 } from "util";
52395
+ import { execFile as execFile6 } from "child_process";
52396
+ import { promisify as promisify8 } from "util";
51537
52397
  import * as fs16 from "fs/promises";
51538
52398
  import * as path14 from "path";
51539
- var execFileAsync5 = promisify7(execFile5);
52399
+ var execFileAsync6 = promisify8(execFile6);
51540
52400
  var MAX_OUTPUT_BUFFER = 5 * 1024 * 1024;
51541
52401
  async function writeTempPatch(patch, workDir) {
51542
52402
  const tempPath = path14.join(workDir, `.patch-${String(getTimeProvider().now())}.patch`);
@@ -51644,7 +52504,7 @@ async function executePatch(patchPath, options, reverse, logger56) {
51644
52504
  const args = buildPatchArgs(patchPath, options, reverse);
51645
52505
  logger56.debug("Executing patch command", { args, cwd: options.workDir });
51646
52506
  try {
51647
- const { stdout, stderr } = await execFileAsync5("patch", args, {
52507
+ const { stdout, stderr } = await execFileAsync6("patch", args, {
51648
52508
  cwd: options.workDir,
51649
52509
  timeout: options.timeoutMs,
51650
52510
  maxBuffer: MAX_OUTPUT_BUFFER
@@ -51985,10 +52845,10 @@ ${getStderr()}`.trim();
51985
52845
 
51986
52846
  // src/swe-bench/test-runner.ts
51987
52847
  import { exec as exec3 } from "child_process";
51988
- import { promisify as promisify8 } from "util";
52848
+ import { promisify as promisify9 } from "util";
51989
52849
  import * as fs18 from "fs/promises";
51990
52850
  import * as path16 from "path";
51991
- var execAsync3 = promisify8(exec3);
52851
+ var execAsync3 = promisify9(exec3);
51992
52852
  var FRAMEWORK_CONFIG_FILES = {
51993
52853
  pytest: ["pytest.ini", "pyproject.toml", "setup.cfg", "conftest.py", "tox.ini"],
51994
52854
  unittest: ["setup.py", "setup.cfg"],
@@ -52434,10 +53294,10 @@ function detectFailurePatterns(failures) {
52434
53294
  errorGroups.set(key, group);
52435
53295
  }
52436
53296
  }
52437
- for (const [description, instances] of errorGroups) {
53297
+ for (const [description2, instances] of errorGroups) {
52438
53298
  if (instances.length >= 2) {
52439
53299
  patterns.push({
52440
- description,
53300
+ description: description2,
52441
53301
  occurrences: instances.length,
52442
53302
  examples: instances.slice(0, 3)
52443
53303
  });
@@ -53038,9 +53898,9 @@ import * as fs20 from "fs";
53038
53898
  import * as path19 from "path";
53039
53899
  var logger55 = createLogger({ component: "task-tracker" });
53040
53900
  async function exec4(cmd, args, timeout = 15e3) {
53041
- const { execFile: execFile6 } = await import("child_process");
53042
- const { promisify: promisify9 } = await import("util");
53043
- const run = promisify9(execFile6);
53901
+ const { execFile: execFile7 } = await import("child_process");
53902
+ const { promisify: promisify10 } = await import("util");
53903
+ const run = promisify10(execFile7);
53044
53904
  const { stdout } = await run(cmd, [...args], { timeout });
53045
53905
  return stdout.trim();
53046
53906
  }
@@ -53051,7 +53911,7 @@ var GitHubTaskTracker = class {
53051
53911
  cachedProvider = null;
53052
53912
  async getProvider() {
53053
53913
  if (this.cachedProvider !== null) return this.cachedProvider;
53054
- const { createScmProvider } = await import("./factory-BHHC6C7W.js");
53914
+ const { createScmProvider } = await import("./factory-H5BYL4V5.js");
53055
53915
  const result = await createScmProvider({ repo: this.config.repo ?? "" });
53056
53916
  if (!result.ok) throw new Error(`SCM provider error: ${result.error.message}`);
53057
53917
  this.cachedProvider = result.value;
@@ -53655,6 +54515,9 @@ export {
53655
54515
  registerMemoryStatsTool,
53656
54516
  MemoryWriteInputSchema,
53657
54517
  registerMemoryWriteTool,
54518
+ createFitnessScoreCalculator,
54519
+ calculateFitnessScore,
54520
+ registerImprovementReviewTool,
53658
54521
  registerWeatherReportTool,
53659
54522
  RegistryImportInputSchema,
53660
54523
  registerRegistryImportTool,
@@ -53872,4 +54735,4 @@ export {
53872
54735
  detectBackend,
53873
54736
  createTaskTracker
53874
54737
  };
53875
- //# sourceMappingURL=chunk-5RMZQEP5.js.map
54738
+ //# sourceMappingURL=chunk-AGVLFRN7.js.map