nexus-agents 2.63.6 → 2.64.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.
@@ -69,7 +69,7 @@ import {
69
69
  clampTaskTtl,
70
70
  getAvailabilityCache,
71
71
  resolveFallback
72
- } from "./chunk-HRTGSG4L.js";
72
+ } from "./chunk-Q3PDQ3FZ.js";
73
73
  import {
74
74
  DEFAULTS
75
75
  } from "./chunk-6MRF2PE2.js";
@@ -2468,13 +2468,13 @@ function makeCancelError(taskId) {
2468
2468
  }
2469
2469
  function executeWithTimeout(params) {
2470
2470
  const { task, maxDurationMs, executeTask, transformError, signal } = params;
2471
- return new Promise((resolve18) => {
2471
+ return new Promise((resolve19) => {
2472
2472
  let settled = false;
2473
2473
  const settle = (result) => {
2474
2474
  if (settled) return;
2475
2475
  settled = true;
2476
2476
  clearTimeout(timeoutId);
2477
- resolve18(result);
2477
+ resolve19(result);
2478
2478
  };
2479
2479
  const timeoutId = setTimeout(() => {
2480
2480
  settle(
@@ -7856,13 +7856,13 @@ var WaveScheduler = class {
7856
7856
  }
7857
7857
  async withTimeout(promise, timeoutMs, taskId) {
7858
7858
  if (timeoutMs <= 0) return promise;
7859
- return new Promise((resolve18, reject) => {
7859
+ return new Promise((resolve19, reject) => {
7860
7860
  const timer = setTimeout(() => {
7861
7861
  reject(new Error(`Task ${taskId} timed out after ${String(timeoutMs)}ms`));
7862
7862
  }, timeoutMs);
7863
7863
  promise.then((result) => {
7864
7864
  clearTimeout(timer);
7865
- resolve18(result);
7865
+ resolve19(result);
7866
7866
  }).catch((error) => {
7867
7867
  clearTimeout(timer);
7868
7868
  reject(error instanceof Error ? error : new Error(String(error)));
@@ -13903,7 +13903,7 @@ function wouldCreateCycle(from, to, getNode) {
13903
13903
  return canReach(to, from, /* @__PURE__ */ new Set(), getNode);
13904
13904
  }
13905
13905
  function findCyclePath(from, to, getNode) {
13906
- const path19 = [from, to];
13906
+ const path20 = [from, to];
13907
13907
  const visited = /* @__PURE__ */ new Set([from]);
13908
13908
  const findPath = (current) => {
13909
13909
  if (current === from) return true;
@@ -13912,9 +13912,9 @@ function findCyclePath(from, to, getNode) {
13912
13912
  for (const depId of node.dependencies.keys()) {
13913
13913
  if (!visited.has(depId)) {
13914
13914
  visited.add(depId);
13915
- path19.push(depId);
13915
+ path20.push(depId);
13916
13916
  if (findPath(depId)) return true;
13917
- path19.pop();
13917
+ path20.pop();
13918
13918
  } else if (depId === from) {
13919
13919
  return true;
13920
13920
  }
@@ -13922,7 +13922,7 @@ function findCyclePath(from, to, getNode) {
13922
13922
  return false;
13923
13923
  };
13924
13924
  findPath(to);
13925
- return path19;
13925
+ return path20;
13926
13926
  }
13927
13927
  function detectCycleDFS(nodeId, visited, stack, getNode) {
13928
13928
  visited.add(nodeId);
@@ -13941,29 +13941,29 @@ function detectCycleDFS(nodeId, visited, stack, getNode) {
13941
13941
  return false;
13942
13942
  }
13943
13943
  function findCycleFromNode(startId, getNode) {
13944
- const path19 = [];
13944
+ const path20 = [];
13945
13945
  const visited = /* @__PURE__ */ new Set();
13946
13946
  const dfs = (nodeId) => {
13947
- if (path19.includes(nodeId)) {
13948
- const cycleStart = path19.indexOf(nodeId);
13949
- path19.splice(0, cycleStart);
13950
- path19.push(nodeId);
13947
+ if (path20.includes(nodeId)) {
13948
+ const cycleStart = path20.indexOf(nodeId);
13949
+ path20.splice(0, cycleStart);
13950
+ path20.push(nodeId);
13951
13951
  return true;
13952
13952
  }
13953
13953
  if (visited.has(nodeId)) return false;
13954
13954
  visited.add(nodeId);
13955
- path19.push(nodeId);
13955
+ path20.push(nodeId);
13956
13956
  const node = getNode(nodeId);
13957
13957
  if (node) {
13958
13958
  for (const depId of node.dependencies.keys()) {
13959
13959
  if (dfs(depId)) return true;
13960
13960
  }
13961
13961
  }
13962
- path19.pop();
13962
+ path20.pop();
13963
13963
  return false;
13964
13964
  };
13965
13965
  dfs(startId);
13966
- return path19;
13966
+ return path20;
13967
13967
  }
13968
13968
 
13969
13969
  // src/agents/skills/skill-dependency-graph.ts
@@ -18202,9 +18202,9 @@ var ExpertPool = class {
18202
18202
  if (this.active < this.capacity) {
18203
18203
  return this.issuePermit();
18204
18204
  }
18205
- return new Promise((resolve18, reject) => {
18205
+ return new Promise((resolve19, reject) => {
18206
18206
  const timer = setTimeout(() => {
18207
- const idx = this.queue.findIndex((e) => e.resolve === resolve18);
18207
+ const idx = this.queue.findIndex((e) => e.resolve === resolve19);
18208
18208
  if (idx !== -1) {
18209
18209
  this.queue.splice(idx, 1);
18210
18210
  }
@@ -18214,7 +18214,7 @@ var ExpertPool = class {
18214
18214
  )
18215
18215
  );
18216
18216
  }, this.acquireTimeoutMs);
18217
- this.queue.push({ resolve: resolve18, reject, timer });
18217
+ this.queue.push({ resolve: resolve19, reject, timer });
18218
18218
  });
18219
18219
  }
18220
18220
  /** Release a permit back to the pool. */
@@ -18508,18 +18508,18 @@ var DependencyGraph = class {
18508
18508
  }
18509
18509
  const startNode = firstNode;
18510
18510
  const visited = /* @__PURE__ */ new Set();
18511
- const path19 = [];
18511
+ const path20 = [];
18512
18512
  const dfs = (nodeId) => {
18513
- if (path19.includes(nodeId)) {
18514
- const cycleStart = path19.indexOf(nodeId);
18515
- path19.splice(0, cycleStart);
18513
+ if (path20.includes(nodeId)) {
18514
+ const cycleStart = path20.indexOf(nodeId);
18515
+ path20.splice(0, cycleStart);
18516
18516
  return true;
18517
18517
  }
18518
18518
  if (visited.has(nodeId)) {
18519
18519
  return false;
18520
18520
  }
18521
18521
  visited.add(nodeId);
18522
- path19.push(nodeId);
18522
+ path20.push(nodeId);
18523
18523
  const node = this.nodes.get(nodeId);
18524
18524
  if (node) {
18525
18525
  for (const depId of node.dependencies) {
@@ -18530,11 +18530,11 @@ var DependencyGraph = class {
18530
18530
  }
18531
18531
  }
18532
18532
  }
18533
- path19.pop();
18533
+ path20.pop();
18534
18534
  return false;
18535
18535
  };
18536
18536
  dfs(startNode);
18537
- return path19.length > 0 ? path19 : cycleNodes.slice(0, 3);
18537
+ return path20.length > 0 ? path20 : cycleNodes.slice(0, 3);
18538
18538
  }
18539
18539
  /**
18540
18540
  * Gets the execution order (topologically sorted step IDs).
@@ -18800,8 +18800,8 @@ var TaskQueue = class {
18800
18800
  if (this.cancelled) {
18801
18801
  return Promise.reject(new Error("Queue has been cancelled"));
18802
18802
  }
18803
- return new Promise((resolve18, reject) => {
18804
- this.queue.push({ task, resolve: resolve18, reject });
18803
+ return new Promise((resolve19, reject) => {
18804
+ this.queue.push({ task, resolve: resolve19, reject });
18805
18805
  this.processNext();
18806
18806
  });
18807
18807
  }
@@ -19077,16 +19077,16 @@ async function executeStepWithTimeout(step, context, stepExecutor, signal) {
19077
19077
  return executeWithTimeout2(step, stepContext, stepExecutor, stepTimeout, startTime);
19078
19078
  }
19079
19079
  function executeWithTimeout2(step, context, executor, timeout, startTime) {
19080
- return new Promise((resolve18) => {
19080
+ return new Promise((resolve19) => {
19081
19081
  const timeoutId = setTimeout(() => {
19082
- resolve18(createTimeoutResult(step.id, getTimeProvider().now() - startTime, timeout));
19082
+ resolve19(createTimeoutResult(step.id, getTimeProvider().now() - startTime, timeout));
19083
19083
  }, timeout);
19084
19084
  executor(step, context).then((result) => {
19085
19085
  clearTimeout(timeoutId);
19086
- resolve18(result);
19086
+ resolve19(result);
19087
19087
  }).catch((error) => {
19088
19088
  clearTimeout(timeoutId);
19089
- resolve18(createErrorResult(step.id, getTimeProvider().now() - startTime, error));
19089
+ resolve19(createErrorResult(step.id, getTimeProvider().now() - startTime, error));
19090
19090
  });
19091
19091
  });
19092
19092
  }
@@ -19386,9 +19386,9 @@ function getBuiltInTemplatesPath() {
19386
19386
  join3(dirname2(currentDir), "workflows", "templates"),
19387
19387
  join3(dirname2(currentDir), "dist", "workflows", "templates")
19388
19388
  ];
19389
- for (const path19 of possiblePaths) {
19390
- if (existsSync3(path19)) {
19391
- return path19;
19389
+ for (const path20 of possiblePaths) {
19390
+ if (existsSync3(path20)) {
19391
+ return path20;
19392
19392
  }
19393
19393
  }
19394
19394
  return join3(currentDir, "templates");
@@ -19929,9 +19929,9 @@ function validateRequiredInputs(inputs, required) {
19929
19929
  }
19930
19930
 
19931
19931
  // src/workflows/expression-resolver-helpers.ts
19932
- function getNestedValue(obj, path19) {
19932
+ function getNestedValue(obj, path20) {
19933
19933
  let current = obj;
19934
- for (const key of path19) {
19934
+ for (const key of path20) {
19935
19935
  if (current === null || current === void 0) {
19936
19936
  return void 0;
19937
19937
  }
@@ -19942,24 +19942,24 @@ function getNestedValue(obj, path19) {
19942
19942
  }
19943
19943
  return current;
19944
19944
  }
19945
- function resolveInputs(path19, context) {
19946
- const value = getNestedValue(context.inputs, path19);
19945
+ function resolveInputs(path20, context) {
19946
+ const value = getNestedValue(context.inputs, path20);
19947
19947
  if (value === void 0) {
19948
19948
  return {
19949
19949
  success: false,
19950
- error: `Input '${path19.join(".")}' not found`
19950
+ error: `Input '${path20.join(".")}' not found`
19951
19951
  };
19952
19952
  }
19953
19953
  return { success: true, value };
19954
19954
  }
19955
- function validateStepPath(path19) {
19956
- if (path19.length < 2) {
19955
+ function validateStepPath(path20) {
19956
+ if (path20.length < 2) {
19957
19957
  return {
19958
19958
  success: false,
19959
19959
  error: "Steps expression requires at least stepId and output"
19960
19960
  };
19961
19961
  }
19962
- if (path19[0] === void 0 || path19[1] === void 0) {
19962
+ if (path20[0] === void 0 || path20[1] === void 0) {
19963
19963
  return {
19964
19964
  success: false,
19965
19965
  error: "Steps expression requires stepId and output"
@@ -19985,12 +19985,12 @@ function validateStepResult(stepId, outputKey, stepResult) {
19985
19985
  }
19986
19986
  return null;
19987
19987
  }
19988
- function resolveSteps(path19, context) {
19989
- const pathError = validateStepPath(path19);
19988
+ function resolveSteps(path20, context) {
19989
+ const pathError = validateStepPath(path20);
19990
19990
  if (pathError !== null) return pathError;
19991
- const stepId = path19[0] ?? "";
19992
- const outputKey = path19[1] ?? "";
19993
- const rest = path19.slice(2);
19991
+ const stepId = path20[0] ?? "";
19992
+ const outputKey = path20[1] ?? "";
19993
+ const rest = path20.slice(2);
19994
19994
  const stepResult = context.stepResults.get(stepId);
19995
19995
  const earlyReturn = validateStepResult(stepId, outputKey, stepResult);
19996
19996
  if (earlyReturn !== null) return earlyReturn;
@@ -20006,15 +20006,15 @@ function resolveSteps(path19, context) {
20006
20006
  }
20007
20007
  return { success: true, value };
20008
20008
  }
20009
- function resolveVariables(path19, context) {
20010
- if (path19.length === 0) {
20009
+ function resolveVariables(path20, context) {
20010
+ if (path20.length === 0) {
20011
20011
  return {
20012
20012
  success: false,
20013
20013
  error: "Variables expression requires a variable name"
20014
20014
  };
20015
20015
  }
20016
- const varName = path19[0];
20017
- const rest = path19.slice(1);
20016
+ const varName = path20[0];
20017
+ const rest = path20.slice(1);
20018
20018
  if (varName === void 0) {
20019
20019
  return {
20020
20020
  success: false,
@@ -21037,8 +21037,8 @@ var WorkflowEngine = class {
21037
21037
  this.config = resolveConfig2(config);
21038
21038
  }
21039
21039
  /** Load workflow template from file. */
21040
- async loadTemplate(path19) {
21041
- return this.deps.loadWorkflowFile(path19);
21040
+ async loadTemplate(path20) {
21041
+ return this.deps.loadWorkflowFile(path20);
21042
21042
  }
21043
21043
  /** Execute a workflow with inputs. */
21044
21044
  async execute(workflow, inputs) {
@@ -21142,8 +21142,8 @@ var WorkflowEngine = class {
21142
21142
  }
21143
21143
  return Promise.resolve(templates);
21144
21144
  }
21145
- createTemplate(workflow, path19, category) {
21146
- const t = { name: workflow.name, version: workflow.version, path: path19, category };
21145
+ createTemplate(workflow, path20, category) {
21146
+ const t = { name: workflow.name, version: workflow.version, path: path20, category };
21147
21147
  if (workflow.description !== void 0) t.description = workflow.description;
21148
21148
  return t;
21149
21149
  }
@@ -21429,8 +21429,8 @@ function createParseWorkflow() {
21429
21429
  };
21430
21430
  }
21431
21431
  function createLoadWorkflowFile() {
21432
- return async (path19) => {
21433
- const result = await loadWorkflowFile(path19);
21432
+ return async (path20) => {
21433
+ const result = await loadWorkflowFile(path20);
21434
21434
  if (!result.ok) {
21435
21435
  if (result.error instanceof ParseError) {
21436
21436
  return result;
@@ -23478,10 +23478,10 @@ function calculateZStatistic(params) {
23478
23478
  function calculateDifferenceCI(p1, p2, total1, total2, confidence) {
23479
23479
  const difference = p1 - p2;
23480
23480
  const seDiff = Math.sqrt(p1 * (1 - p1) / (total1 || 1) + p2 * (1 - p2) / (total2 || 1));
23481
- const z104 = getZScore(confidence);
23481
+ const z107 = getZScore(confidence);
23482
23482
  return {
23483
- lower: difference - z104 * seDiff,
23484
- upper: difference + z104 * seDiff,
23483
+ lower: difference - z107 * seDiff,
23484
+ upper: difference + z107 * seDiff,
23485
23485
  estimate: difference,
23486
23486
  confidence,
23487
23487
  n: total1 + total2,
@@ -23504,11 +23504,11 @@ function proportionConfidenceInterval(successes, total, options = {}) {
23504
23504
  standardError: 0
23505
23505
  };
23506
23506
  }
23507
- const z104 = getZScore(opts.confidence);
23508
- const z210 = z104 * z104;
23507
+ const z107 = getZScore(opts.confidence);
23508
+ const z210 = z107 * z107;
23509
23509
  const denominator = 1 + z210 / n;
23510
23510
  const center = (p + z210 / (2 * n)) / denominator;
23511
- const margin = z104 / denominator * Math.sqrt(p * (1 - p) / n + z210 / (4 * n * n));
23511
+ const margin = z107 / denominator * Math.sqrt(p * (1 - p) / n + z210 / (4 * n * n));
23512
23512
  const lower = Math.max(0, center - margin);
23513
23513
  const upper = Math.min(1, center + margin);
23514
23514
  const standardError = Math.sqrt(p * (1 - p) / n);
@@ -23538,8 +23538,8 @@ function meanConfidenceInterval(values, options = {}) {
23538
23538
  const variance = values.reduce((sum, v) => sum + (v - mean) ** 2, 0) / (n - 1 || 1);
23539
23539
  const stdDev = Math.sqrt(variance);
23540
23540
  const standardError = stdDev / Math.sqrt(n);
23541
- const z104 = getZScore(opts.confidence);
23542
- const margin = z104 * standardError;
23541
+ const z107 = getZScore(opts.confidence);
23542
+ const margin = z107 * standardError;
23543
23543
  return {
23544
23544
  lower: mean - margin,
23545
23545
  upper: mean + margin,
@@ -26932,13 +26932,13 @@ function dedupe(ids) {
26932
26932
  return [...new Set(ids)];
26933
26933
  }
26934
26934
  async function withTimeout2(promise, ms) {
26935
- return new Promise((resolve18, reject) => {
26935
+ return new Promise((resolve19, reject) => {
26936
26936
  const timer = setTimeout(() => {
26937
26937
  reject(new Error(`Node timed out after ${String(ms)}ms`));
26938
26938
  }, ms);
26939
26939
  promise.then((result) => {
26940
26940
  clearTimeout(timer);
26941
- resolve18(result);
26941
+ resolve19(result);
26942
26942
  }).catch((error) => {
26943
26943
  clearTimeout(timer);
26944
26944
  reject(error instanceof Error ? error : new Error(String(error)));
@@ -27071,31 +27071,31 @@ var GraphBuilder = class {
27071
27071
  }
27072
27072
  const visited = /* @__PURE__ */ new Set();
27073
27073
  const stack = /* @__PURE__ */ new Set();
27074
- const path19 = [];
27074
+ const path20 = [];
27075
27075
  for (const nodeId of this.nodes.keys()) {
27076
- const cycle = this.dfs(nodeId, adj, visited, stack, path19);
27076
+ const cycle = this.dfs(nodeId, adj, visited, stack, path20);
27077
27077
  if (cycle !== void 0) return cycle;
27078
27078
  }
27079
27079
  return void 0;
27080
27080
  }
27081
- dfs(nodeId, adj, visited, stack, path19) {
27081
+ dfs(nodeId, adj, visited, stack, path20) {
27082
27082
  if (stack.has(nodeId)) {
27083
- const cycleStart = path19.indexOf(nodeId);
27084
- const cyclePath = path19.slice(cycleStart);
27083
+ const cycleStart = path20.indexOf(nodeId);
27084
+ const cyclePath = path20.slice(cycleStart);
27085
27085
  cyclePath.push(nodeId);
27086
27086
  return { type: "cycle_detected", path: cyclePath };
27087
27087
  }
27088
27088
  if (visited.has(nodeId)) return void 0;
27089
27089
  visited.add(nodeId);
27090
27090
  stack.add(nodeId);
27091
- path19.push(nodeId);
27091
+ path20.push(nodeId);
27092
27092
  const neighbors = adj.get(nodeId) ?? [];
27093
27093
  for (const neighbor of neighbors) {
27094
- const cycle = this.dfs(neighbor, adj, visited, stack, path19);
27094
+ const cycle = this.dfs(neighbor, adj, visited, stack, path20);
27095
27095
  if (cycle !== void 0) return cycle;
27096
27096
  }
27097
27097
  stack.delete(nodeId);
27098
- path19.pop();
27098
+ path20.pop();
27099
27099
  return void 0;
27100
27100
  }
27101
27101
  checkReachability() {
@@ -27763,8 +27763,8 @@ function extractModelAttribution(event) {
27763
27763
  };
27764
27764
  }
27765
27765
  function extractRoutingAttribution(event) {
27766
- const path19 = event.decisionPath !== void 0 ? [...event.decisionPath] : void 0;
27767
- return { modelId: event.selectedModel, reasoning: event.reasoning, decisionPath: path19 };
27766
+ const path20 = event.decisionPath !== void 0 ? [...event.decisionPath] : void 0;
27767
+ return { modelId: event.selectedModel, reasoning: event.reasoning, decisionPath: path20 };
27768
27768
  }
27769
27769
  function extractPipelineAttribution(event) {
27770
27770
  if (event.type === "pipeline.completed") {
@@ -29190,10 +29190,10 @@ function createMockTechLead() {
29190
29190
  async function raceAgainstDeadline(promise, deadlineMs, onTimeout) {
29191
29191
  const startedAt = Date.now();
29192
29192
  let timer;
29193
- const timeoutP = new Promise((resolve18) => {
29193
+ const timeoutP = new Promise((resolve19) => {
29194
29194
  timer = setTimeout(
29195
29195
  () => {
29196
- resolve18(onTimeout(Date.now() - startedAt));
29196
+ resolve19(onTimeout(Date.now() - startedAt));
29197
29197
  },
29198
29198
  Math.max(0, deadlineMs)
29199
29199
  );
@@ -30373,11 +30373,11 @@ function createWorkerTask(entry, taskIndex, waveNumber, opts) {
30373
30373
  }
30374
30374
  const staggerMs = taskIndex * opts.staggerDelayMs;
30375
30375
  if (staggerMs > 0) {
30376
- await new Promise((resolve18) => setTimeout(resolve18, staggerMs));
30376
+ await new Promise((resolve19) => setTimeout(resolve19, staggerMs));
30377
30377
  }
30378
30378
  const spacingDelay = opts.failureTracker.getSpacingDelay(entry.role);
30379
30379
  if (spacingDelay > 0) {
30380
- await new Promise((resolve18) => setTimeout(resolve18, spacingDelay));
30380
+ await new Promise((resolve19) => setTimeout(resolve19, spacingDelay));
30381
30381
  }
30382
30382
  const timeoutMs = opts.options.workerTimeoutMs ?? getExpertTaskTimeout(entry.subTask);
30383
30383
  const result = await executeSafe({
@@ -30429,7 +30429,7 @@ async function maybeDelayForRateLimit(results, waveIdx, totalWaves) {
30429
30429
  );
30430
30430
  if (hasRateLimit) {
30431
30431
  logger24.warn("Rate-limit detected \u2014 delaying next wave", { delayMs: RATE_LIMIT_WAVE_DELAY_MS });
30432
- await new Promise((resolve18) => setTimeout(resolve18, RATE_LIMIT_WAVE_DELAY_MS));
30432
+ await new Promise((resolve19) => setTimeout(resolve19, RATE_LIMIT_WAVE_DELAY_MS));
30433
30433
  }
30434
30434
  }
30435
30435
  function emitWaveStarted(ctx, workerCount, roles) {
@@ -30523,7 +30523,7 @@ async function maybeRetryAfterTriage(opts) {
30523
30523
  }
30524
30524
  const useAltCli = triage.action === "retry_different_cli" && altExecuteWorker !== void 0;
30525
30525
  if (triage.action === "retry_different_cli") {
30526
- await new Promise((resolve18) => setTimeout(resolve18, RATE_LIMIT_SPACING_MS));
30526
+ await new Promise((resolve19) => setTimeout(resolve19, RATE_LIMIT_SPACING_MS));
30527
30527
  }
30528
30528
  const retryTimeout = triage.action === "extend_timeout" ? Math.min(timeoutMs * TIMEOUT_EXTENSION_FACTOR, MAX_WORKER_TIMEOUT_MS) : timeoutMs;
30529
30529
  const retryExecutor = useAltCli ? altExecuteWorker : executeWorker;
@@ -36466,8 +36466,8 @@ async function saveSourcesRegistry(registry, rootDir) {
36466
36466
  const pathResult = validatePath3(filePath, root);
36467
36467
  if (!pathResult.ok) return pathResult;
36468
36468
  try {
36469
- const yaml3 = stringifyYaml(registry, { indent: 2 });
36470
- await fs6.writeFile(pathResult.value, yaml3, "utf-8");
36469
+ const yaml4 = stringifyYaml(registry, { indent: 2 });
36470
+ await fs6.writeFile(pathResult.value, yaml4, "utf-8");
36471
36471
  return { ok: true, value: void 0 };
36472
36472
  } catch (error) {
36473
36473
  return {
@@ -38793,12 +38793,12 @@ function extractFileReferences(markdown) {
38793
38793
  let match;
38794
38794
  FILE_REF_PATTERN.lastIndex = 0;
38795
38795
  while ((match = FILE_REF_PATTERN.exec(markdown)) !== null) {
38796
- const path19 = match[1];
38797
- if (path19 === void 0 || seen.has(path19)) continue;
38798
- seen.add(path19);
38796
+ const path20 = match[1];
38797
+ if (path20 === void 0 || seen.has(path20)) continue;
38798
+ seen.add(path20);
38799
38799
  const lineStr = match[2];
38800
38800
  const line = lineStr !== void 0 ? parseInt(lineStr, 10) : void 0;
38801
- refs.push(line !== void 0 ? { path: path19, line } : { path: path19 });
38801
+ refs.push(line !== void 0 ? { path: path20, line } : { path: path20 });
38802
38802
  }
38803
38803
  return refs;
38804
38804
  }
@@ -40631,27 +40631,27 @@ var FileAuditStorage = class _FileAuditStorage {
40631
40631
  const data = this.writeBuffer.join("");
40632
40632
  this.writeBuffer = [];
40633
40633
  const stream = this.writeStream;
40634
- return new Promise((resolve18, reject) => {
40634
+ return new Promise((resolve19, reject) => {
40635
40635
  stream.write(data, (err2) => {
40636
40636
  if (err2 !== void 0 && err2 !== null) {
40637
40637
  reject(new AuditError("Failed to flush audit log", { cause: err2 }));
40638
40638
  } else {
40639
- resolve18();
40639
+ resolve19();
40640
40640
  }
40641
40641
  });
40642
40642
  });
40643
40643
  }
40644
40644
  async close() {
40645
40645
  await this.flush();
40646
- return new Promise((resolve18) => {
40646
+ return new Promise((resolve19) => {
40647
40647
  if (this.writeStream === null) {
40648
- resolve18();
40648
+ resolve19();
40649
40649
  return;
40650
40650
  }
40651
40651
  this.writeStream.end(() => {
40652
40652
  this.writeStream = null;
40653
40653
  this.logger.info("Audit storage closed");
40654
- resolve18();
40654
+ resolve19();
40655
40655
  });
40656
40656
  });
40657
40657
  }
@@ -42091,11 +42091,11 @@ function recordTriageLifecycle(findings, verdicts, entries) {
42091
42091
  async function runOsvCheck(targetDir, enabled) {
42092
42092
  if (!enabled) return [];
42093
42093
  try {
42094
- const fs20 = await import("fs");
42095
- const path19 = await import("path");
42096
- const pkgPath = path19.join(targetDir, "package.json");
42097
- if (!fs20.existsSync(pkgPath)) return [];
42098
- const pkg = JSON.parse(fs20.readFileSync(pkgPath, "utf-8"));
42094
+ const fs21 = await import("fs");
42095
+ const path20 = await import("path");
42096
+ const pkgPath = path20.join(targetDir, "package.json");
42097
+ if (!fs21.existsSync(pkgPath)) return [];
42098
+ const pkg = JSON.parse(fs21.readFileSync(pkgPath, "utf-8"));
42099
42099
  const deps = Object.entries(pkg.dependencies ?? {}).slice(0, 20).map(([name, version]) => ({
42100
42100
  name,
42101
42101
  version: version.replace(/^[\^~>=<]+/, "")
@@ -43206,11 +43206,11 @@ async function extractSymbolsForTask(task) {
43206
43206
  const fileRefs = task.match(/(?:src|lib|packages)\/[^\s,)]+\.ts/g);
43207
43207
  if (fileRefs === null || fileRefs.length === 0) return null;
43208
43208
  const { extractSymbols: extractSymbols2 } = await import("./symbol-extractor-UEBANFSN.js");
43209
- const path19 = await import("path");
43209
+ const path20 = await import("path");
43210
43210
  const summaries = [];
43211
43211
  for (const ref of fileRefs.slice(0, 3)) {
43212
43212
  try {
43213
- const resolved = path19.resolve(ref);
43213
+ const resolved = path20.resolve(ref);
43214
43214
  const result = await extractSymbols2(resolved);
43215
43215
  const exported = result.symbols.filter((s) => s.exported);
43216
43216
  if (exported.length > 0) {
@@ -43227,12 +43227,12 @@ async function extractSymbolsForTask(task) {
43227
43227
  async function retrieveAdaptiveMemory(task) {
43228
43228
  try {
43229
43229
  const { AdaptiveMemoryBackend } = await import("./adaptive-memory-XD5O3TC4.js");
43230
- const path19 = await import("path");
43230
+ const path20 = await import("path");
43231
43231
  const { nexusDataPath: nexusDataPath2 } = await import("./nexus-data-dir-M6DYKIHJ.js");
43232
43232
  const baseDir = nexusDataPath2("memory");
43233
43233
  const memory = new AdaptiveMemoryBackend({
43234
- dbPath: path19.join(baseDir, "adaptive.db"),
43235
- markdownDir: path19.join(baseDir, "adaptive-md")
43234
+ dbPath: path20.join(baseDir, "adaptive.db"),
43235
+ markdownDir: path20.join(baseDir, "adaptive-md")
43236
43236
  });
43237
43237
  const key = task.slice(0, 50).replace(/\s+/g, "-").toLowerCase();
43238
43238
  const result = await memory.retrieve(key);
@@ -43625,10 +43625,566 @@ function registerPrReviewTool(server, deps) {
43625
43625
  logger56.info("Registered pr_review tool");
43626
43626
  }
43627
43627
 
43628
- // src/mcp/tools/query-task-state-tool.ts
43628
+ // src/mcp/tools/survey-oss-landscape.ts
43629
43629
  import { z as z91 } from "zod";
43630
- var QueryTaskStateInputSchema = z91.object({
43631
- taskId: z91.string().min(1).max(128).describe("Task ID whose structured state log should be read")
43630
+ var SurveyOssLandscapeInputSchema = z91.object({
43631
+ query: z91.string().min(1).max(200).describe('Free-text search query, e.g. "cargo nextest replacement" or "OSS SBOM tools"'),
43632
+ maxResults: z91.number().int().min(1).max(50).optional().default(10).describe("Maximum candidates to return (1-50; default 10)"),
43633
+ minStars: z91.number().int().min(0).optional().default(0).describe("Minimum star count to include (default 0; useful for filtering noise)"),
43634
+ language: z91.string().max(50).optional().describe('GitHub language filter, e.g. "rust" or "typescript"')
43635
+ });
43636
+ var GitHubRepoSchema2 = z91.object({
43637
+ full_name: z91.string().optional(),
43638
+ html_url: z91.string().optional(),
43639
+ description: z91.string().nullable().optional(),
43640
+ stargazers_count: z91.number().optional(),
43641
+ pushed_at: z91.string().nullable().optional(),
43642
+ language: z91.string().nullable().optional(),
43643
+ license: z91.object({
43644
+ spdx_id: z91.string().nullable().optional()
43645
+ }).nullable().optional()
43646
+ });
43647
+ var GitHubSearchResponseSchema2 = z91.object({
43648
+ total_count: z91.number().optional(),
43649
+ items: z91.array(GitHubRepoSchema2).optional()
43650
+ });
43651
+ var GITHUB_SEARCH_BASE = "https://api.github.com/search/repositories";
43652
+ function buildGithubQuery(input) {
43653
+ const parts = [input.query];
43654
+ if (input.language !== void 0 && input.language.length > 0) {
43655
+ parts.push(`language:${input.language}`);
43656
+ }
43657
+ if (input.minStars > 0) {
43658
+ parts.push(`stars:>=${String(input.minStars)}`);
43659
+ }
43660
+ return parts.join(" ");
43661
+ }
43662
+ function splitFullName(fullName) {
43663
+ if (fullName === void 0) return { owner: "", name: "" };
43664
+ const idx = fullName.indexOf("/");
43665
+ if (idx === -1) return { owner: "", name: fullName };
43666
+ return { owner: fullName.slice(0, idx), name: fullName.slice(idx + 1) };
43667
+ }
43668
+ function parseCandidates(data) {
43669
+ const items = data.items ?? [];
43670
+ const candidates = items.map((repo) => {
43671
+ const { owner, name } = splitFullName(repo.full_name);
43672
+ return {
43673
+ name,
43674
+ owner,
43675
+ url: repo.html_url ?? "",
43676
+ stars: repo.stargazers_count ?? 0,
43677
+ lastCommitAt: repo.pushed_at ?? null,
43678
+ license: repo.license?.spdx_id ?? null,
43679
+ language: repo.language ?? null,
43680
+ description: repo.description ?? null,
43681
+ source: "github"
43682
+ };
43683
+ });
43684
+ return { totalFound: data.total_count ?? candidates.length, candidates };
43685
+ }
43686
+ async function fetchGithubCandidates(input, logger56) {
43687
+ const query = encodeURIComponent(buildGithubQuery(input));
43688
+ const perPage = String(input.maxResults);
43689
+ const url = `${GITHUB_SEARCH_BASE}?q=${query}&sort=stars&order=desc&per_page=${perPage}`;
43690
+ const headers = {
43691
+ Accept: "application/vnd.github.v3+json",
43692
+ "User-Agent": "nexus-agents"
43693
+ };
43694
+ const tokenResult = await resolveToken({ platform: "github" });
43695
+ if (tokenResult.ok) {
43696
+ headers["Authorization"] = `Bearer ${tokenResult.value.value}`;
43697
+ } else {
43698
+ logger56.debug("No GitHub token; using unauthenticated rate limit (60/hr)");
43699
+ }
43700
+ const fetchResult = await fetchSource({ url, source: "github", headers });
43701
+ if (!fetchResult.ok) return fetchResult;
43702
+ let raw;
43703
+ try {
43704
+ raw = await fetchResult.value.json();
43705
+ } catch (err2) {
43706
+ return {
43707
+ ok: false,
43708
+ error: {
43709
+ code: "PARSE_ERROR",
43710
+ message: "GitHub response is not valid JSON",
43711
+ source: "github",
43712
+ cause: err2
43713
+ }
43714
+ };
43715
+ }
43716
+ const parsed = GitHubSearchResponseSchema2.safeParse(raw);
43717
+ if (!parsed.success) {
43718
+ return {
43719
+ ok: false,
43720
+ error: {
43721
+ code: "PARSE_ERROR",
43722
+ message: "GitHub API response did not match the expected schema",
43723
+ source: "github"
43724
+ }
43725
+ };
43726
+ }
43727
+ return { ok: true, value: parseCandidates(parsed.data) };
43728
+ }
43729
+ async function executeSurvey(input, logger56) {
43730
+ const sourcesQueried = ["github"];
43731
+ const sourcesFailed = [];
43732
+ const githubResult = await fetchGithubCandidates(input, logger56);
43733
+ if (!githubResult.ok) {
43734
+ logger56.warn("GitHub source failed", {
43735
+ code: githubResult.error.code,
43736
+ message: githubResult.error.message
43737
+ });
43738
+ sourcesFailed.push("github");
43739
+ return {
43740
+ query: input.query,
43741
+ totalFound: 0,
43742
+ candidates: [],
43743
+ sourcesQueried,
43744
+ sourcesFailed
43745
+ };
43746
+ }
43747
+ return {
43748
+ query: input.query,
43749
+ totalFound: githubResult.value.totalFound,
43750
+ candidates: githubResult.value.candidates,
43751
+ sourcesQueried,
43752
+ sourcesFailed
43753
+ };
43754
+ }
43755
+ function createSurveyHandler(deps) {
43756
+ return async (args, ctx) => {
43757
+ const validation = SurveyOssLandscapeInputSchema.safeParse(args);
43758
+ if (!validation.success) {
43759
+ return toolError(`Validation error: ${formatZodError(validation.error)}`);
43760
+ }
43761
+ const logger56 = deps.logger ?? createLogger({ tool: "survey_oss_landscape" });
43762
+ ctx.logger.debug("Surveying OSS landscape", {
43763
+ query: validation.data.query,
43764
+ maxResults: validation.data.maxResults
43765
+ });
43766
+ return withToolError("Survey failed", logger56, async () => {
43767
+ const result = await executeSurvey(validation.data, logger56);
43768
+ return toolSuccessStructured(result);
43769
+ });
43770
+ };
43771
+ }
43772
+ var SURVEY_OUTPUT_SCHEMA = {
43773
+ query: z91.string(),
43774
+ totalFound: z91.number(),
43775
+ candidates: z91.array(z91.unknown()),
43776
+ sourcesQueried: z91.array(z91.string()),
43777
+ sourcesFailed: z91.array(z91.string())
43778
+ };
43779
+ var SURVEY_DESCRIPTION = 'Transient OSS project search. Returns a ranked list of GitHub repositories with license, last-commit, star-count, and one-line description. Does NOT persist to the research registry \u2014 use `research_add_source` for that. Best for one-off engineering decisions like "what tools exist in this space?".';
43780
+ function registerSurveyOssLandscapeTool(server, deps) {
43781
+ const logger56 = deps.logger ?? createLogger({ tool: "survey_oss_landscape" });
43782
+ const secureHandler = createSecureHandler(createSurveyHandler(deps), {
43783
+ toolName: "survey_oss_landscape",
43784
+ rateLimiter: deps.rateLimiter,
43785
+ logger: logger56
43786
+ });
43787
+ const timeoutMs = getToolTimeout("survey_oss_landscape", deps.security);
43788
+ const wrappedHandler = wrapToolWithTimeout("survey_oss_landscape", secureHandler, {
43789
+ timeoutMs,
43790
+ logger: logger56
43791
+ });
43792
+ server.registerTool(
43793
+ "survey_oss_landscape",
43794
+ {
43795
+ description: SURVEY_DESCRIPTION,
43796
+ inputSchema: SurveyOssLandscapeInputSchema.shape,
43797
+ outputSchema: SURVEY_OUTPUT_SCHEMA
43798
+ },
43799
+ toSdkCallback(wrappedHandler)
43800
+ );
43801
+ logger56.info("Registered survey_oss_landscape tool");
43802
+ }
43803
+
43804
+ // src/mcp/tools/vendor-publishing-audit.ts
43805
+ import { z as z92 } from "zod";
43806
+
43807
+ // src/mcp/tools/vendor-publishing-seed.ts
43808
+ var VENDOR_PUBLISHING_SEED = {
43809
+ ubuntu: {
43810
+ vendor: "ubuntu",
43811
+ sha256SumsUrlPattern: "https://releases.ubuntu.com/{release}/SHA256SUMS",
43812
+ sha256SumsSignatureUrlPattern: "https://releases.ubuntu.com/{release}/SHA256SUMS.gpg",
43813
+ signaturePattern: "detached",
43814
+ gpgKeys: [
43815
+ {
43816
+ name: "Ubuntu CD Image Automatic Signing Key (2012)",
43817
+ fingerprint: "843938DF228D22F7B3742BC0D94AA3F0EFE21092",
43818
+ role: "release-signing",
43819
+ source: "https://help.ubuntu.com/community/VerifyIsoHowto"
43820
+ },
43821
+ {
43822
+ name: "Ubuntu CD Image Automatic Signing Key (2018)",
43823
+ fingerprint: "F6ECB3762474EDA9D21B7022871920D1991BC93C",
43824
+ role: "release-signing",
43825
+ source: "https://help.ubuntu.com/community/VerifyIsoHowto"
43826
+ }
43827
+ ],
43828
+ releaseCadence: "LTS every 2 years (April even-numbered), interim every 6 months",
43829
+ keyRotationNotes: "2018 key signs current-and-recent releases; 2012 key still valid for older releases. Both keys are published on keyserver.ubuntu.com and ship in /usr/share/keyrings/ubuntu-archive-keyring.gpg on Ubuntu hosts.",
43830
+ vendorDocUrl: "https://help.ubuntu.com/community/VerifyIsoHowto",
43831
+ citedAt: "2026-05-04"
43832
+ },
43833
+ debian: {
43834
+ vendor: "debian",
43835
+ sha256SumsUrlPattern: "https://cdimage.debian.org/debian-cd/current/{arch}/iso-cd/SHA256SUMS",
43836
+ sha256SumsSignatureUrlPattern: "https://cdimage.debian.org/debian-cd/current/{arch}/iso-cd/SHA256SUMS.sign",
43837
+ signaturePattern: "detached",
43838
+ gpgKeys: [
43839
+ {
43840
+ name: "Debian CD signing key (DA87E80D6294BE9B)",
43841
+ fingerprint: "DF9B9C49EAA9298432589D76DA87E80D6294BE9B",
43842
+ role: "release-signing",
43843
+ source: "https://www.debian.org/CD/verify"
43844
+ }
43845
+ ],
43846
+ releaseCadence: "Stable release approximately every 2 years; point releases ~quarterly",
43847
+ keyRotationNotes: "CD signing key rotates per stable release cycle. The vendor doc page lists the current fingerprint; older keys are kept in keyring.debian.org for historical verification.",
43848
+ vendorDocUrl: "https://www.debian.org/CD/verify",
43849
+ citedAt: "2026-05-04"
43850
+ },
43851
+ fedora: {
43852
+ vendor: "fedora",
43853
+ sha256SumsUrlPattern: "https://download.fedoraproject.org/pub/fedora/linux/releases/{release}/{edition}/{arch}/iso/Fedora-{edition}-{release}-{arch}-CHECKSUM",
43854
+ /** Fedora ships clearsigned CHECKSUM files; signature is inline. */
43855
+ signaturePattern: "clearsigned",
43856
+ gpgKeys: [
43857
+ {
43858
+ name: "Fedora project release-signing keys (per-release)",
43859
+ fingerprint: "see-source",
43860
+ role: "release-signing",
43861
+ source: "https://fedoraproject.org/security"
43862
+ }
43863
+ ],
43864
+ releaseCadence: "Major release every ~6 months; supported for ~13 months",
43865
+ keyRotationNotes: "Per-release signing keys. Fingerprints rotate every release and are published on the Fedora security page and in the fedora-gpg-keys package. Use `gpg --keyserver hkp://keys.fedoraproject.org --recv-keys <ID>` to fetch a specific release key.",
43866
+ vendorDocUrl: "https://fedoraproject.org/security",
43867
+ citedAt: "2026-05-04"
43868
+ }
43869
+ };
43870
+ function isKnownVendor(vendor) {
43871
+ return vendor in VENDOR_PUBLISHING_SEED;
43872
+ }
43873
+ function listKnownVendors() {
43874
+ return Object.keys(VENDOR_PUBLISHING_SEED).sort();
43875
+ }
43876
+
43877
+ // src/mcp/tools/vendor-publishing-audit.ts
43878
+ var VendorPublishingAuditInputSchema = z92.object({
43879
+ vendor: z92.string().min(1).max(50).toLowerCase().describe('Vendor identifier, lowercase. e.g. "ubuntu", "debian", "fedora"')
43880
+ });
43881
+ function lookupVendor(vendor) {
43882
+ if (isKnownVendor(vendor)) {
43883
+ return { ...VENDOR_PUBLISHING_SEED[vendor], known: true };
43884
+ }
43885
+ const knownVendors = listKnownVendors();
43886
+ return {
43887
+ vendor,
43888
+ known: false,
43889
+ message: `No seed entry for vendor "${vendor}". Known vendors: ${knownVendors.join(", ")}. Adding a vendor is data-only \u2014 see packages/nexus-agents/src/mcp/tools/vendor-publishing-seed.ts.`,
43890
+ knownVendors
43891
+ };
43892
+ }
43893
+ function createVendorPublishingAuditHandler(deps) {
43894
+ return async (args, ctx) => {
43895
+ const validation = VendorPublishingAuditInputSchema.safeParse(args);
43896
+ if (!validation.success) {
43897
+ return toolError(`Validation error: ${formatZodError(validation.error)}`);
43898
+ }
43899
+ const logger56 = deps.logger ?? createLogger({ tool: "vendor_publishing_audit" });
43900
+ ctx.logger.debug("Vendor publishing audit", { vendor: validation.data.vendor });
43901
+ return withToolError("Vendor publishing audit failed", logger56, () => {
43902
+ const result = lookupVendor(validation.data.vendor);
43903
+ return Promise.resolve(toolSuccessStructured(result));
43904
+ });
43905
+ };
43906
+ }
43907
+ var VENDOR_PUBLISHING_OUTPUT_SCHEMA = {
43908
+ vendor: z92.string(),
43909
+ known: z92.boolean(),
43910
+ // Fields below populate when known=true; permissive optional for known=false.
43911
+ sha256SumsUrlPattern: z92.string().optional(),
43912
+ sha256SumsSignatureUrlPattern: z92.string().optional(),
43913
+ signaturePattern: z92.string().optional(),
43914
+ gpgKeys: z92.array(z92.unknown()).optional(),
43915
+ releaseCadence: z92.string().optional(),
43916
+ keyRotationNotes: z92.string().optional(),
43917
+ vendorDocUrl: z92.string().optional(),
43918
+ citedAt: z92.string().optional(),
43919
+ // Fields below populate when known=false.
43920
+ message: z92.string().optional(),
43921
+ knownVendors: z92.array(z92.string()).optional()
43922
+ };
43923
+ var VENDOR_PUBLISHING_DESCRIPTION = "Look up a vendor's published-artifact signing infrastructure: GPG key fingerprints, SHA256SUMS URL pattern, signature shape (clearsigned / detached / detached-on-iso), release cadence, key rotation notes, and the vendor doc citation. Static lookup against a curated seed dataset; the vendor doc URL is the authoritative source. Returns `{known: false, knownVendors: [...]}` for vendors without a seed entry. v1 covers ubuntu, debian, fedora.";
43924
+ function registerVendorPublishingAuditTool(server, deps) {
43925
+ const logger56 = deps.logger ?? createLogger({ tool: "vendor_publishing_audit" });
43926
+ const secureHandler = createSecureHandler(createVendorPublishingAuditHandler(deps), {
43927
+ toolName: "vendor_publishing_audit",
43928
+ rateLimiter: deps.rateLimiter,
43929
+ logger: logger56
43930
+ });
43931
+ const timeoutMs = getToolTimeout("vendor_publishing_audit", deps.security);
43932
+ const wrappedHandler = wrapToolWithTimeout("vendor_publishing_audit", secureHandler, {
43933
+ timeoutMs,
43934
+ logger: logger56
43935
+ });
43936
+ server.registerTool(
43937
+ "vendor_publishing_audit",
43938
+ {
43939
+ description: VENDOR_PUBLISHING_DESCRIPTION,
43940
+ inputSchema: VendorPublishingAuditInputSchema.shape,
43941
+ outputSchema: VENDOR_PUBLISHING_OUTPUT_SCHEMA
43942
+ },
43943
+ toSdkCallback(wrappedHandler)
43944
+ );
43945
+ logger56.info("Registered vendor_publishing_audit tool");
43946
+ }
43947
+
43948
+ // src/mcp/tools/compare-data-feeds.ts
43949
+ import { z as z93 } from "zod";
43950
+ import * as path10 from "path";
43951
+ import * as fs11 from "fs";
43952
+ import * as yaml3 from "yaml";
43953
+ var CompareDataFeedsInputSchema = z93.object({
43954
+ feedAPath: z93.string().min(1).max(1e3).describe("Filesystem path to feed A (YAML or JSON, auto-detected by extension)"),
43955
+ feedBPath: z93.string().min(1).max(1e3).describe("Filesystem path to feed B"),
43956
+ keyPath: z93.string().min(1).max(200).describe(
43957
+ 'Dotted path to the entry key, e.g. "id" or "name". Each entry must have this field.'
43958
+ ),
43959
+ compareFields: z93.array(z93.string().min(1).max(200)).max(20).optional().describe(
43960
+ 'Optional dotted field paths to compare across matched entries (e.g. ["license", "sha256"])'
43961
+ )
43962
+ });
43963
+ function readDottedPath(obj, dottedPath) {
43964
+ const parts = dottedPath.split(".");
43965
+ let cursor = obj;
43966
+ for (const part of parts) {
43967
+ if (cursor === null || cursor === void 0) return void 0;
43968
+ if (typeof cursor !== "object") return void 0;
43969
+ cursor = cursor[part];
43970
+ }
43971
+ return cursor;
43972
+ }
43973
+ function parseFeedContent(content, sourcePath) {
43974
+ const ext = path10.extname(sourcePath).toLowerCase();
43975
+ if (ext === ".json") {
43976
+ return JSON.parse(content);
43977
+ }
43978
+ return yaml3.parse(content);
43979
+ }
43980
+ function asEntryArray(parsed) {
43981
+ if (Array.isArray(parsed)) return parsed;
43982
+ if (parsed !== null && typeof parsed === "object") {
43983
+ const obj = parsed;
43984
+ const arrayValues = Object.values(obj).filter((v) => Array.isArray(v));
43985
+ if (arrayValues.length === 1) {
43986
+ const first = arrayValues[0];
43987
+ if (first !== void 0) return first;
43988
+ }
43989
+ }
43990
+ throw new Error(
43991
+ "Feed must be a top-level array, or an object with exactly one array-valued field. Top-level objects with multiple array fields are ambiguous; flatten the feed first."
43992
+ );
43993
+ }
43994
+ function indexByKey(entries, keyPath) {
43995
+ const index = /* @__PURE__ */ new Map();
43996
+ const missingKeyAt = [];
43997
+ for (let i = 0; i < entries.length; i++) {
43998
+ const entry = entries[i];
43999
+ const key = readDottedPath(entry, keyPath);
44000
+ if (key === void 0 || key === null) {
44001
+ missingKeyAt.push(i);
44002
+ continue;
44003
+ }
44004
+ if (typeof key === "object") {
44005
+ missingKeyAt.push(i);
44006
+ continue;
44007
+ }
44008
+ const keyStr = typeof key === "string" ? key : typeof key === "number" ? String(key) : typeof key === "bigint" ? key.toString() : typeof key === "boolean" ? String(key) : "";
44009
+ if (keyStr === "") {
44010
+ missingKeyAt.push(i);
44011
+ continue;
44012
+ }
44013
+ index.set(keyStr, entry);
44014
+ }
44015
+ return { index, missingKeyAt };
44016
+ }
44017
+ function membershipDiff(indexA, indexB) {
44018
+ const onlyInA = [];
44019
+ const onlyInB = [];
44020
+ const inBoth = [];
44021
+ for (const key of indexA.keys()) {
44022
+ if (indexB.has(key)) inBoth.push(key);
44023
+ else onlyInA.push(key);
44024
+ }
44025
+ for (const key of indexB.keys()) {
44026
+ if (!indexA.has(key)) onlyInB.push(key);
44027
+ }
44028
+ onlyInA.sort();
44029
+ onlyInB.sort();
44030
+ inBoth.sort();
44031
+ return { onlyInA, onlyInB, inBoth };
44032
+ }
44033
+ function compareFields(inBothKeys, indexA, indexB, fields) {
44034
+ const out = [];
44035
+ for (const key of inBothKeys) {
44036
+ const a = indexA.get(key);
44037
+ const b = indexB.get(key);
44038
+ for (const field of fields) {
44039
+ const valueA = readDottedPath(a, field);
44040
+ const valueB = readDottedPath(b, field);
44041
+ if (!deepEqual(valueA, valueB)) {
44042
+ out.push({ key, field, valueA, valueB });
44043
+ }
44044
+ }
44045
+ }
44046
+ return out;
44047
+ }
44048
+ function deepEqualArrays(a, b) {
44049
+ if (a.length !== b.length) return false;
44050
+ return a.every((v, i) => deepEqual(v, b[i]));
44051
+ }
44052
+ function deepEqualObjects(a, b) {
44053
+ const aKeys = Object.keys(a).sort();
44054
+ const bKeys = Object.keys(b).sort();
44055
+ if (aKeys.length !== bKeys.length) return false;
44056
+ if (!aKeys.every((k, i) => k === bKeys[i])) return false;
44057
+ return aKeys.every((k) => deepEqual(a[k], b[k]));
44058
+ }
44059
+ function deepEqual(a, b) {
44060
+ if (a === b) return true;
44061
+ if (a === null || b === null) return false;
44062
+ if (typeof a !== typeof b) return false;
44063
+ if (typeof a !== "object") return false;
44064
+ if (Array.isArray(a) !== Array.isArray(b)) return false;
44065
+ if (Array.isArray(a) && Array.isArray(b)) return deepEqualArrays(a, b);
44066
+ return deepEqualObjects(a, b);
44067
+ }
44068
+ function buildSummary(feedAPath, feedBPath, diff, fieldDiffs, fields) {
44069
+ const lines = [];
44070
+ lines.push(`Feed A: ${feedAPath} (${String(diff.onlyInA.length)} only-in-A)`);
44071
+ lines.push(`Feed B: ${feedBPath} (${String(diff.onlyInB.length)} only-in-B)`);
44072
+ lines.push(`In both: ${String(diff.inBoth.length)} entries`);
44073
+ if (fields.length > 0) {
44074
+ lines.push(
44075
+ `Field comparison across ${String(fields.length)} field(s) found ${String(fieldDiffs.length)} differences in ${String(diff.inBoth.length)} matched entries`
44076
+ );
44077
+ }
44078
+ return lines.join("\n");
44079
+ }
44080
+ function loadFeed(feedPath) {
44081
+ const resolved = path10.resolve(feedPath);
44082
+ const cwdRoot = path10.resolve(".");
44083
+ if (!resolved.startsWith(cwdRoot)) {
44084
+ throw new Error(`Path traversal denied: ${feedPath} must be within ${cwdRoot}`);
44085
+ }
44086
+ if (!fs11.existsSync(resolved)) {
44087
+ throw new Error(`Feed file not found: ${resolved}`);
44088
+ }
44089
+ const content = fs11.readFileSync(resolved, "utf-8");
44090
+ const parsed = parseFeedContent(content, resolved);
44091
+ return asEntryArray(parsed);
44092
+ }
44093
+ function executeCompare(input) {
44094
+ const entriesA = loadFeed(input.feedAPath);
44095
+ const entriesB = loadFeed(input.feedBPath);
44096
+ const indexA = indexByKey(entriesA, input.keyPath).index;
44097
+ const indexB = indexByKey(entriesB, input.keyPath).index;
44098
+ const diff = membershipDiff(indexA, indexB);
44099
+ const fields = input.compareFields ?? [];
44100
+ const fieldDiffs = compareFields(diff.inBoth, indexA, indexB, fields);
44101
+ return {
44102
+ feedAPath: input.feedAPath,
44103
+ feedBPath: input.feedBPath,
44104
+ keyPath: input.keyPath,
44105
+ counts: {
44106
+ entriesInA: indexA.size,
44107
+ entriesInB: indexB.size,
44108
+ onlyInA: diff.onlyInA.length,
44109
+ onlyInB: diff.onlyInB.length,
44110
+ inBoth: diff.inBoth.length,
44111
+ fieldDifferences: fieldDiffs.length
44112
+ },
44113
+ coverage: {
44114
+ onlyInA: diff.onlyInA,
44115
+ onlyInB: diff.onlyInB,
44116
+ inBoth: diff.inBoth
44117
+ },
44118
+ fieldDifferences: fieldDiffs,
44119
+ summary: buildSummary(input.feedAPath, input.feedBPath, diff, fieldDiffs, fields)
44120
+ };
44121
+ }
44122
+ function createCompareDataFeedsHandler(deps) {
44123
+ return async (args, ctx) => {
44124
+ const validation = CompareDataFeedsInputSchema.safeParse(args);
44125
+ if (!validation.success) {
44126
+ return toolError(`Validation error: ${formatZodError(validation.error)}`);
44127
+ }
44128
+ const logger56 = deps.logger ?? createLogger({ tool: "compare_data_feeds" });
44129
+ ctx.logger.debug("Comparing data feeds", {
44130
+ feedAPath: validation.data.feedAPath,
44131
+ feedBPath: validation.data.feedBPath
44132
+ });
44133
+ return withToolError("Compare data feeds failed", logger56, () => {
44134
+ const result = executeCompare(validation.data);
44135
+ return Promise.resolve(toolSuccessStructured(result));
44136
+ });
44137
+ };
44138
+ }
44139
+ var COMPARE_OUTPUT_SCHEMA = {
44140
+ feedAPath: z93.string(),
44141
+ feedBPath: z93.string(),
44142
+ keyPath: z93.string(),
44143
+ counts: z93.object({
44144
+ entriesInA: z93.number(),
44145
+ entriesInB: z93.number(),
44146
+ onlyInA: z93.number(),
44147
+ onlyInB: z93.number(),
44148
+ inBoth: z93.number(),
44149
+ fieldDifferences: z93.number()
44150
+ }),
44151
+ coverage: z93.object({
44152
+ onlyInA: z93.array(z93.string()),
44153
+ onlyInB: z93.array(z93.string()),
44154
+ inBoth: z93.array(z93.string())
44155
+ }),
44156
+ fieldDifferences: z93.array(z93.unknown()),
44157
+ summary: z93.string()
44158
+ };
44159
+ var COMPARE_DESCRIPTION = "Diff two upstream data feeds (YAML or JSON files) along coverage and per-field axes. Returns which entries exist in A, B, both, plus optional field-level diffs across matched entries. v1 takes file paths only (no URL fetch \u2014 that needs an SSRF design pass). Both feeds must be a top-level array OR a top-level object with exactly one array field.";
44160
+ function registerCompareDataFeedsTool(server, deps) {
44161
+ const logger56 = deps.logger ?? createLogger({ tool: "compare_data_feeds" });
44162
+ const secureHandler = createSecureHandler(createCompareDataFeedsHandler(deps), {
44163
+ toolName: "compare_data_feeds",
44164
+ rateLimiter: deps.rateLimiter,
44165
+ logger: logger56
44166
+ });
44167
+ const timeoutMs = getToolTimeout("compare_data_feeds", deps.security);
44168
+ const wrappedHandler = wrapToolWithTimeout("compare_data_feeds", secureHandler, {
44169
+ timeoutMs,
44170
+ logger: logger56
44171
+ });
44172
+ server.registerTool(
44173
+ "compare_data_feeds",
44174
+ {
44175
+ description: COMPARE_DESCRIPTION,
44176
+ inputSchema: CompareDataFeedsInputSchema.shape,
44177
+ outputSchema: COMPARE_OUTPUT_SCHEMA
44178
+ },
44179
+ toSdkCallback(wrappedHandler)
44180
+ );
44181
+ logger56.info("Registered compare_data_feeds tool");
44182
+ }
44183
+
44184
+ // src/mcp/tools/query-task-state-tool.ts
44185
+ import { z as z94 } from "zod";
44186
+ var QueryTaskStateInputSchema = z94.object({
44187
+ taskId: z94.string().min(1).max(128).describe("Task ID whose structured state log should be read")
43632
44188
  });
43633
44189
  function queryTaskStateHandler(args, ctx) {
43634
44190
  const parsed = QueryTaskStateInputSchema.safeParse(args);
@@ -43658,7 +44214,7 @@ function queryTaskStateHandler(args, ctx) {
43658
44214
  function registerQueryTaskStateTool(server, deps) {
43659
44215
  const logger56 = deps.logger ?? createLogger({ tool: "query_task_state" });
43660
44216
  const toolSchema = {
43661
- taskId: z91.string().min(1).max(128).describe("Task ID whose structured state log should be read")
44217
+ taskId: z94.string().min(1).max(128).describe("Task ID whose structured state log should be read")
43662
44218
  };
43663
44219
  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.";
43664
44220
  const secureHandler = createSecureHandler(queryTaskStateHandler, {
@@ -43680,23 +44236,23 @@ function registerQueryTaskStateTool(server, deps) {
43680
44236
  }
43681
44237
 
43682
44238
  // src/mcp/tools/verify-audit-chain-tool.ts
43683
- import * as fs11 from "fs/promises";
43684
- import * as path10 from "path";
43685
- import { z as z92 } from "zod";
43686
- var VerifyAuditChainInputSchema = z92.object({
43687
- logDir: z92.string().min(1).max(512).describe(
44239
+ import * as fs12 from "fs/promises";
44240
+ import * as path11 from "path";
44241
+ import { z as z95 } from "zod";
44242
+ var VerifyAuditChainInputSchema = z95.object({
44243
+ logDir: z95.string().min(1).max(512).describe(
43688
44244
  "Filesystem path to the FileAuditStorage log directory. Tool reads all `audit-*.jsonl` files in lexicographic order and verifies the combined chain."
43689
44245
  )
43690
44246
  });
43691
44247
  async function loadAuditEvents(dir, logger56) {
43692
- const entries = await fs11.readdir(dir);
44248
+ const entries = await fs12.readdir(dir);
43693
44249
  const auditFiles = entries.filter((name) => name.startsWith("audit-") && name.endsWith(".jsonl")).sort();
43694
44250
  const events = [];
43695
44251
  for (const filename of auditFiles) {
43696
- const fullPath = path10.join(dir, filename);
44252
+ const fullPath = path11.join(dir, filename);
43697
44253
  let content;
43698
44254
  try {
43699
- content = await fs11.readFile(fullPath, "utf-8");
44255
+ content = await fs12.readFile(fullPath, "utf-8");
43700
44256
  } catch (cause) {
43701
44257
  const msg = cause instanceof Error ? cause.message : String(cause);
43702
44258
  logger56.warn("Skipping unreadable audit log file", { filename, error: msg });
@@ -43728,10 +44284,10 @@ async function handler2(args, ctx) {
43728
44284
  if (!parsed.success) {
43729
44285
  return toolError(`Validation error: ${formatZodError(parsed.error)}`);
43730
44286
  }
43731
- const resolvedDir = path10.resolve(parsed.data.logDir);
44287
+ const resolvedDir = path11.resolve(parsed.data.logDir);
43732
44288
  let dirStats;
43733
44289
  try {
43734
- dirStats = await fs11.stat(resolvedDir);
44290
+ dirStats = await fs12.stat(resolvedDir);
43735
44291
  } catch (cause) {
43736
44292
  const msg = cause instanceof Error ? cause.message : String(cause);
43737
44293
  return toolError(`Cannot access logDir "${resolvedDir}": ${msg}`);
@@ -43752,7 +44308,7 @@ async function handler2(args, ctx) {
43752
44308
  function registerVerifyAuditChainTool(server, deps) {
43753
44309
  const logger56 = deps.logger ?? createLogger({ tool: "verify_audit_chain" });
43754
44310
  const toolSchema = {
43755
- logDir: z92.string().min(1).max(512).describe(
44311
+ logDir: z95.string().min(1).max(512).describe(
43756
44312
  "Filesystem path to the FileAuditStorage log directory. Tool reads all `audit-*.jsonl` files and verifies the combined hash chain."
43757
44313
  )
43758
44314
  };
@@ -43776,18 +44332,18 @@ function registerVerifyAuditChainTool(server, deps) {
43776
44332
  }
43777
44333
 
43778
44334
  // src/mcp/tools/pipeline-tool.ts
43779
- import { z as z93 } from "zod";
43780
- import * as fs12 from "fs";
43781
- import * as path11 from "path";
43782
- var PipelineInputSchema = z93.object({
44335
+ import { z as z96 } from "zod";
44336
+ import * as fs13 from "fs";
44337
+ import * as path12 from "path";
44338
+ var PipelineInputSchema = z96.object({
43783
44339
  /** The task to execute. */
43784
- task: z93.string().min(5).max(1e4).describe("Task description \u2014 pipeline template auto-selected based on content"),
44340
+ task: z96.string().min(5).max(1e4).describe("Task description \u2014 pipeline template auto-selected based on content"),
43785
44341
  /** Path to a spec file (.md, .yaml) to use as task input. */
43786
- specFile: z93.string().max(500).optional().describe("Path to a spec file \u2014 content prepended to task for greenfield projects"),
44342
+ specFile: z96.string().max(500).optional().describe("Path to a spec file \u2014 content prepended to task for greenfield projects"),
43787
44343
  /** Override template (dev, research, audit, greenfield). Auto-detected if omitted. */
43788
- template: z93.string().max(50).optional().describe(`Pipeline template override. Available: ${listTemplateIds().join(", ")}`),
44344
+ template: z96.string().max(50).optional().describe(`Pipeline template override. Available: ${listTemplateIds().join(", ")}`),
43789
44345
  /** Voting strategy for consensus stages. */
43790
- votingStrategy: z93.enum([
44346
+ votingStrategy: z96.enum([
43791
44347
  "simple_majority",
43792
44348
  "supermajority",
43793
44349
  "unanimous",
@@ -43798,13 +44354,13 @@ var PipelineInputSchema = z93.object({
43798
44354
  "Voting strategy for plan approval. simple_majority (default), supermajority (67%), unanimous, higher_order (Bayesian), proof_of_learning, opinion_wise"
43799
44355
  ),
43800
44356
  /** Use 3 agents instead of 6 for faster voting. */
43801
- quickMode: z93.boolean().default(false).describe("Use 3 agents instead of 6 for faster consensus voting"),
44357
+ quickMode: z96.boolean().default(false).describe("Use 3 agents instead of 6 for faster consensus voting"),
43802
44358
  /** Maximum execution time per stage in milliseconds (min 30s, max 600s). */
43803
- timeoutMs: z93.number().int().min(3e4).max(6e5).optional().describe("Max time per stage in ms (30000-600000). Default: varies by stage complexity"),
44359
+ timeoutMs: z96.number().int().min(3e4).max(6e5).optional().describe("Max time per stage in ms (30000-600000). Default: varies by stage complexity"),
43804
44360
  /** Stop after planning/voting (no implementation). */
43805
- dryRun: z93.boolean().default(false).describe("Stop after vote stage (no implementation)"),
44361
+ dryRun: z96.boolean().default(false).describe("Stop after vote stage (no implementation)"),
43806
44362
  /** TESTS ONLY — random output, must not be used for real decisions. (#2319) */
43807
- simulateVotes: z93.boolean().default(false).describe("TESTS ONLY \u2014 random output, must not be used for real decisions (#2319)")
44363
+ simulateVotes: z96.boolean().default(false).describe("TESTS ONLY \u2014 random output, must not be used for real decisions (#2319)")
43808
44364
  });
43809
44365
  function buildOutput2(result) {
43810
44366
  return {
@@ -43821,13 +44377,13 @@ function buildOutput2(result) {
43821
44377
  }
43822
44378
  async function resolveTask(task, specFile) {
43823
44379
  if (specFile === void 0) return task;
43824
- const resolved = path11.resolve(specFile);
43825
- const cwdRoot = path11.resolve(".");
44380
+ const resolved = path12.resolve(specFile);
44381
+ const cwdRoot = path12.resolve(".");
43826
44382
  if (!resolved.startsWith(cwdRoot)) {
43827
44383
  throw new Error(`Path traversal denied: specFile must be within ${cwdRoot}`);
43828
44384
  }
43829
44385
  try {
43830
- const specContent = await fs12.promises.readFile(resolved, "utf-8");
44386
+ const specContent = await fs13.promises.readFile(resolved, "utf-8");
43831
44387
  return `${specContent}
43832
44388
 
43833
44389
  ---
@@ -43889,7 +44445,7 @@ function registerPipelineTool(server, _deps) {
43889
44445
  }
43890
44446
 
43891
44447
  // src/mcp/tools/supply-chain-tradeoff-panel.ts
43892
- import { z as z94 } from "zod";
44448
+ import { z as z97 } from "zod";
43893
44449
  var DEFAULT_AXES = [
43894
44450
  "build_time_determinism",
43895
44451
  "supply_chain_risk",
@@ -43899,16 +44455,16 @@ var MAX_AXES = 6;
43899
44455
  var MAX_AXIS_NAME_LENGTH = 64;
43900
44456
  var MAX_PROPOSAL_LENGTH = 4e3;
43901
44457
  var MAX_CONTEXT_LENGTH = 4e3;
43902
- var SupplyChainTradeoffPanelInputSchema = z94.object({
43903
- proposal: z94.string().min(1).max(MAX_PROPOSAL_LENGTH).describe('The proposal under tradeoff review (e.g. "Should aegis-boot adopt cargo-nextest?")'),
43904
- axes: z94.array(z94.string().min(1).max(MAX_AXIS_NAME_LENGTH)).min(1).max(MAX_AXES).optional().describe(
44458
+ var SupplyChainTradeoffPanelInputSchema = z97.object({
44459
+ proposal: z97.string().min(1).max(MAX_PROPOSAL_LENGTH).describe('The proposal under tradeoff review (e.g. "Should aegis-boot adopt cargo-nextest?")'),
44460
+ axes: z97.array(z97.string().min(1).max(MAX_AXIS_NAME_LENGTH)).min(1).max(MAX_AXES).optional().describe(
43905
44461
  `Tradeoff axes to evaluate. Default: ${DEFAULT_AXES.join(", ")}. Custom axes accepted; max ${String(MAX_AXES)}.`
43906
44462
  ),
43907
- context: z94.string().max(MAX_CONTEXT_LENGTH).optional().describe(
44463
+ context: z97.string().max(MAX_CONTEXT_LENGTH).optional().describe(
43908
44464
  "Optional context: relevant repo state, dependency tree, vendor publishing patterns, etc."
43909
44465
  ),
43910
- quickMode: z94.boolean().optional().default(false).describe("Use 3 voters (architect, security, scope_steward) instead of 7"),
43911
- simulate: z94.boolean().optional().default(false).describe("Use simulated voters (testing only)")
44466
+ quickMode: z97.boolean().optional().default(false).describe("Use 3 voters (architect, security, scope_steward) instead of 7"),
44467
+ simulate: z97.boolean().optional().default(false).describe("Use simulated voters (testing only)")
43912
44468
  });
43913
44469
 
43914
44470
  // src/mcp/tools/tool-annotations.ts
@@ -44050,6 +44606,40 @@ var TOOL_ANNOTATIONS = {
44050
44606
  { category: "coupling", description: "Auto-catalogs discovered references" }
44051
44607
  ]
44052
44608
  },
44609
+ survey_oss_landscape: {
44610
+ annotations: {
44611
+ title: "Survey OSS Landscape",
44612
+ readOnlyHint: true,
44613
+ destructiveHint: false,
44614
+ // Same query may return different results day-to-day as star counts
44615
+ // and last-commit dates evolve; idempotentHint=false matches reality.
44616
+ idempotentHint: false,
44617
+ openWorldHint: true
44618
+ },
44619
+ sideEffects: [{ category: "implicit", description: "Queries the GitHub search API" }]
44620
+ },
44621
+ vendor_publishing_audit: {
44622
+ annotations: {
44623
+ title: "Vendor Publishing Audit",
44624
+ readOnlyHint: true,
44625
+ destructiveHint: false,
44626
+ // Pure static lookup against the in-process seed dataset.
44627
+ idempotentHint: true,
44628
+ openWorldHint: false
44629
+ },
44630
+ sideEffects: [{ category: "implicit", description: "Consumes rate limit quota" }]
44631
+ },
44632
+ compare_data_feeds: {
44633
+ annotations: {
44634
+ title: "Compare Data Feeds",
44635
+ readOnlyHint: true,
44636
+ destructiveHint: false,
44637
+ // Same input → same output; pure file diff with no external calls.
44638
+ idempotentHint: true,
44639
+ openWorldHint: false
44640
+ },
44641
+ sideEffects: [{ category: "implicit", description: "Reads two files from the workspace" }]
44642
+ },
44053
44643
  research_analyze: {
44054
44644
  annotations: {
44055
44645
  title: "Research Analyze",
@@ -44290,48 +44880,52 @@ function wrapWithObservability(toolName, cb, eventBus) {
44290
44880
  }
44291
44881
 
44292
44882
  // src/mcp/tools/index.ts
44883
+ var REGISTERED_TOOL_NAMES = [
44884
+ "orchestrate",
44885
+ "create_expert",
44886
+ "execute_expert",
44887
+ "run_workflow",
44888
+ "delegate_to_model",
44889
+ "list_experts",
44890
+ "list_workflows",
44891
+ "consensus_vote",
44892
+ "research_query",
44893
+ "research_add",
44894
+ "research_add_source",
44895
+ "research_discover",
44896
+ "research_analyze",
44897
+ "research_catalog_review",
44898
+ "research_synthesize",
44899
+ "survey_oss_landscape",
44900
+ "vendor_publishing_audit",
44901
+ "compare_data_feeds",
44902
+ "memory_query",
44903
+ "memory_stats",
44904
+ "memory_write",
44905
+ "weather_report",
44906
+ "issue_triage",
44907
+ "run_graph_workflow",
44908
+ "execute_spec",
44909
+ "registry_import",
44910
+ "query_trace",
44911
+ "query_task_state",
44912
+ "verify_audit_chain",
44913
+ "repo_analyze",
44914
+ "repo_security_plan",
44915
+ "extract_symbols",
44916
+ "search_codebase",
44917
+ "run_dev_pipeline",
44918
+ "run_pipeline",
44919
+ "pr_review",
44920
+ "supply_chain_tradeoff_panel"
44921
+ ];
44293
44922
  function registerTools(server, options) {
44294
44923
  const logger56 = options?.logger ?? createMcpLogger({ component: "tools" });
44295
44924
  const rateLimiter = options?.rateLimiter ?? createDefaultRateLimiter("mcp-tools", logger56);
44296
44925
  logger56.info("Tool registration infrastructure initialized");
44297
44926
  void server;
44298
44927
  return {
44299
- tools: [
44300
- "orchestrate",
44301
- "create_expert",
44302
- "execute_expert",
44303
- "run_workflow",
44304
- "delegate_to_model",
44305
- "list_experts",
44306
- "list_workflows",
44307
- "consensus_vote",
44308
- "research_query",
44309
- "research_add",
44310
- "research_add_source",
44311
- "research_discover",
44312
- "research_analyze",
44313
- "research_catalog_review",
44314
- "research_synthesize",
44315
- "memory_query",
44316
- "memory_stats",
44317
- "memory_write",
44318
- "weather_report",
44319
- "issue_triage",
44320
- "run_graph_workflow",
44321
- "execute_spec",
44322
- "registry_import",
44323
- "query_trace",
44324
- "query_task_state",
44325
- "verify_audit_chain",
44326
- "repo_analyze",
44327
- "repo_security_plan",
44328
- "extract_symbols",
44329
- "search_codebase",
44330
- "run_dev_pipeline",
44331
- "run_pipeline",
44332
- "pr_review",
44333
- "supply_chain_tradeoff_panel"
44334
- ],
44928
+ tools: [...REGISTERED_TOOL_NAMES],
44335
44929
  logger: logger56,
44336
44930
  rateLimiter
44337
44931
  };
@@ -44458,40 +45052,40 @@ var RiskLevel = /* @__PURE__ */ ((RiskLevel2) => {
44458
45052
  })(RiskLevel || {});
44459
45053
 
44460
45054
  // src/mcp/safety/stpa-schemas.ts
44461
- import { z as z95 } from "zod";
44462
- var HazardCategorySchema = z95.enum(HazardCategory);
44463
- var HazardSeveritySchema = z95.enum(HazardSeverity);
44464
- var ConstraintPrioritySchema = z95.enum(ConstraintPriority);
44465
- var RiskLevelSchema = z95.enum(RiskLevel);
44466
- var TriggerPatternSchema = z95.object({
44467
- parameter: z95.string().min(1),
44468
- matchType: z95.enum(["contains", "regex", "equals", "startsWith", "endsWith"]),
44469
- pattern: z95.string(),
44470
- reason: z95.string()
45055
+ import { z as z98 } from "zod";
45056
+ var HazardCategorySchema = z98.enum(HazardCategory);
45057
+ var HazardSeveritySchema = z98.enum(HazardSeverity);
45058
+ var ConstraintPrioritySchema = z98.enum(ConstraintPriority);
45059
+ var RiskLevelSchema = z98.enum(RiskLevel);
45060
+ var TriggerPatternSchema = z98.object({
45061
+ parameter: z98.string().min(1),
45062
+ matchType: z98.enum(["contains", "regex", "equals", "startsWith", "endsWith"]),
45063
+ pattern: z98.string(),
45064
+ reason: z98.string()
44471
45065
  });
44472
- var HazardSchema = z95.object({
44473
- id: z95.string().min(1),
44474
- description: z95.string(),
45066
+ var HazardSchema = z98.object({
45067
+ id: z98.string().min(1),
45068
+ description: z98.string(),
44475
45069
  category: HazardCategorySchema,
44476
45070
  severity: HazardSeveritySchema,
44477
- likelihood: z95.enum(["almost_certain", "likely", "possible", "unlikely", "rare"]),
44478
- triggerConditions: z95.array(z95.string()),
44479
- consequences: z95.array(z95.string())
45071
+ likelihood: z98.enum(["almost_certain", "likely", "possible", "unlikely", "rare"]),
45072
+ triggerConditions: z98.array(z98.string()),
45073
+ consequences: z98.array(z98.string())
44480
45074
  });
44481
- var UnsafeControlActionSchema = z95.object({
44482
- id: z95.string().min(1),
44483
- toolName: z95.string().min(1),
44484
- type: z95.enum(["not_provided", "provided_causes_hazard", "wrong_timing", "wrong_duration"]),
44485
- description: z95.string(),
44486
- unsafeContext: z95.string(),
44487
- relatedHazards: z95.array(z95.string()),
44488
- triggerPatterns: z95.array(TriggerPatternSchema).optional()
45075
+ var UnsafeControlActionSchema = z98.object({
45076
+ id: z98.string().min(1),
45077
+ toolName: z98.string().min(1),
45078
+ type: z98.enum(["not_provided", "provided_causes_hazard", "wrong_timing", "wrong_duration"]),
45079
+ description: z98.string(),
45080
+ unsafeContext: z98.string(),
45081
+ relatedHazards: z98.array(z98.string()),
45082
+ triggerPatterns: z98.array(TriggerPatternSchema).optional()
44489
45083
  });
44490
- var SafetyConstraintSchema = z95.object({
44491
- id: z95.string().min(1),
44492
- description: z95.string(),
44493
- mitigates: z95.array(z95.string()),
44494
- enforcement: z95.enum([
45084
+ var SafetyConstraintSchema = z98.object({
45085
+ id: z98.string().min(1),
45086
+ description: z98.string(),
45087
+ mitigates: z98.array(z98.string()),
45088
+ enforcement: z98.enum([
44495
45089
  "prevent",
44496
45090
  "require_confirmation",
44497
45091
  "alert",
@@ -44499,54 +45093,54 @@ var SafetyConstraintSchema = z95.object({
44499
45093
  "rate_limit",
44500
45094
  "require_privilege"
44501
45095
  ]),
44502
- validationFunction: z95.string().optional(),
45096
+ validationFunction: z98.string().optional(),
44503
45097
  priority: ConstraintPrioritySchema
44504
45098
  });
44505
- var PropertySchemaSchema = z95.object({
44506
- type: z95.string(),
44507
- description: z95.string().optional(),
44508
- enum: z95.array(z95.unknown()).optional(),
44509
- pattern: z95.string().optional(),
44510
- minimum: z95.number().optional(),
44511
- maximum: z95.number().optional()
45099
+ var PropertySchemaSchema = z98.object({
45100
+ type: z98.string(),
45101
+ description: z98.string().optional(),
45102
+ enum: z98.array(z98.unknown()).optional(),
45103
+ pattern: z98.string().optional(),
45104
+ minimum: z98.number().optional(),
45105
+ maximum: z98.number().optional()
44512
45106
  });
44513
- var ToolInputSchemaSchema = z95.object({
44514
- type: z95.string(),
44515
- properties: z95.record(z95.string(), PropertySchemaSchema).optional(),
44516
- required: z95.array(z95.string()).optional(),
44517
- additionalProperties: z95.boolean().optional()
45107
+ var ToolInputSchemaSchema = z98.object({
45108
+ type: z98.string(),
45109
+ properties: z98.record(z98.string(), PropertySchemaSchema).optional(),
45110
+ required: z98.array(z98.string()).optional(),
45111
+ additionalProperties: z98.boolean().optional()
44518
45112
  });
44519
- var ToolDefinitionSchema = z95.object({
44520
- name: z95.string().min(1),
44521
- description: z95.string(),
45113
+ var ToolDefinitionSchema = z98.object({
45114
+ name: z98.string().min(1),
45115
+ description: z98.string(),
44522
45116
  inputSchema: ToolInputSchemaSchema
44523
45117
  });
44524
- var AnalysisConfigurationSchema = z95.object({
44525
- includeLowSeverity: z95.boolean().default(true),
44526
- generateAllConstraints: z95.boolean().default(true),
44527
- checkInteractions: z95.boolean().default(true),
44528
- maxHazardsPerTool: z95.number().int().min(1).max(100).default(50),
44529
- categories: z95.array(HazardCategorySchema).default([])
45118
+ var AnalysisConfigurationSchema = z98.object({
45119
+ includeLowSeverity: z98.boolean().default(true),
45120
+ generateAllConstraints: z98.boolean().default(true),
45121
+ checkInteractions: z98.boolean().default(true),
45122
+ maxHazardsPerTool: z98.number().int().min(1).max(100).default(50),
45123
+ categories: z98.array(HazardCategorySchema).default([])
44530
45124
  });
44531
- var ConstraintViolationSchema = z95.object({
44532
- constraintId: z95.string().min(1),
44533
- constraintDescription: z95.string(),
45125
+ var ConstraintViolationSchema = z98.object({
45126
+ constraintId: z98.string().min(1),
45127
+ constraintDescription: z98.string(),
44534
45128
  severity: HazardSeveritySchema,
44535
- details: z95.string(),
44536
- remediation: z95.string()
45129
+ details: z98.string(),
45130
+ remediation: z98.string()
44537
45131
  });
44538
- var ValidationWarningSchema = z95.object({
44539
- code: z95.string().min(1),
44540
- message: z95.string(),
44541
- affected: z95.string()
45132
+ var ValidationWarningSchema = z98.object({
45133
+ code: z98.string().min(1),
45134
+ message: z98.string(),
45135
+ affected: z98.string()
44542
45136
  });
44543
- var ValidationResultSchema = z95.object({
44544
- valid: z95.boolean(),
44545
- toolName: z95.string().min(1),
44546
- violations: z95.array(ConstraintViolationSchema),
44547
- passed: z95.array(z95.string()),
44548
- warnings: z95.array(ValidationWarningSchema),
44549
- validatedAt: z95.date()
45137
+ var ValidationResultSchema = z98.object({
45138
+ valid: z98.boolean(),
45139
+ toolName: z98.string().min(1),
45140
+ violations: z98.array(ConstraintViolationSchema),
45141
+ passed: z98.array(z98.string()),
45142
+ warnings: z98.array(ValidationWarningSchema),
45143
+ validatedAt: z98.date()
44550
45144
  });
44551
45145
 
44552
45146
  // src/mcp/safety/stpa-types.ts
@@ -45631,22 +46225,22 @@ var GeminiResponseParser = class {
45631
46225
  };
45632
46226
 
45633
46227
  // src/cli-adapters/task-analyzer.ts
45634
- import { z as z96 } from "zod";
45635
- var TaskProfileSchema = z96.object({
46228
+ import { z as z99 } from "zod";
46229
+ var TaskProfileSchema = z99.object({
45636
46230
  /** Estimated input tokens required */
45637
- contextRequired: z96.number().min(0),
46231
+ contextRequired: z99.number().min(0),
45638
46232
  /** Reasoning complexity on 0-10 scale */
45639
- reasoningComplexity: z96.number().min(0).max(10),
46233
+ reasoningComplexity: z99.number().min(0).max(10),
45640
46234
  /** Whether task involves code generation */
45641
- codeGeneration: z96.boolean(),
46235
+ codeGeneration: z99.boolean(),
45642
46236
  /** Whether task involves multimodal content (images, etc.) */
45643
- multimodal: z96.boolean(),
46237
+ multimodal: z99.boolean(),
45644
46238
  /** Whether task can be split into parallel subtasks */
45645
- parallelizable: z96.boolean(),
46239
+ parallelizable: z99.boolean(),
45646
46240
  /** Whether cost should be minimized */
45647
- budgetSensitive: z96.boolean(),
46241
+ budgetSensitive: z99.boolean(),
45648
46242
  /** Primary task type classification */
45649
- taskType: z96.enum([
46243
+ taskType: z99.enum([
45650
46244
  "architecture",
45651
46245
  "code_implementation",
45652
46246
  "code_review",
@@ -45660,53 +46254,53 @@ var TaskProfileSchema = z96.object({
45660
46254
  });
45661
46255
 
45662
46256
  // src/cli-adapters/router-types.ts
45663
- import { z as z97 } from "zod";
45664
- var RouterConfigSchema = z97.object({
45665
- minCapacityThreshold: z97.number().min(0).max(1).default(0.1),
45666
- preferCostEfficient: z97.boolean().default(false),
45667
- maxDecisionTimeMs: z97.number().min(1).max(1e3).default(100)
46257
+ import { z as z100 } from "zod";
46258
+ var RouterConfigSchema = z100.object({
46259
+ minCapacityThreshold: z100.number().min(0).max(1).default(0.1),
46260
+ preferCostEfficient: z100.boolean().default(false),
46261
+ maxDecisionTimeMs: z100.number().min(1).max(1e3).default(100)
45668
46262
  });
45669
46263
 
45670
46264
  // src/cli-adapters/agreement-cascade-types.ts
45671
- import { z as z98 } from "zod";
45672
- var AgreementCascadeConfigSchema = z98.object({
45673
- agreementThreshold: z98.number().min(0.5).max(1).default(0.7),
45674
- maxStages: z98.number().int().min(1).max(5).default(3),
45675
- modelTimeoutMs: z98.number().int().min(1e3).max(3e5).default(6e4)
46265
+ import { z as z101 } from "zod";
46266
+ var AgreementCascadeConfigSchema = z101.object({
46267
+ agreementThreshold: z101.number().min(0.5).max(1).default(0.7),
46268
+ maxStages: z101.number().int().min(1).max(5).default(3),
46269
+ modelTimeoutMs: z101.number().int().min(1e3).max(3e5).default(6e4)
45676
46270
  });
45677
46271
 
45678
46272
  // src/cli-adapters/agreement-cascade-router.ts
45679
46273
  var logger42 = createLogger({ component: "agreement-cascade-router" });
45680
46274
 
45681
46275
  // src/cli-adapters/daao-types.ts
45682
- import { z as z99 } from "zod";
45683
- var EncodedFeaturesSchema = z99.object({
46276
+ import { z as z102 } from "zod";
46277
+ var EncodedFeaturesSchema = z102.object({
45684
46278
  /** Lexical complexity score (vocabulary diversity, rare words) */
45685
- lexicalComplexity: z99.number().min(0).max(1),
46279
+ lexicalComplexity: z102.number().min(0).max(1),
45686
46280
  /** Syntactic complexity score (sentence structure, nesting) */
45687
- syntacticComplexity: z99.number().min(0).max(1),
46281
+ syntacticComplexity: z102.number().min(0).max(1),
45688
46282
  /** Semantic density score (concept density, abstraction level) */
45689
- semanticDensity: z99.number().min(0).max(1),
46283
+ semanticDensity: z102.number().min(0).max(1),
45690
46284
  /** Technical specificity (domain-specific terminology) */
45691
- technicalSpecificity: z99.number().min(0).max(1),
46285
+ technicalSpecificity: z102.number().min(0).max(1),
45692
46286
  /** Task scope (breadth of requirements) */
45693
- taskScope: z99.number().min(0).max(1),
46287
+ taskScope: z102.number().min(0).max(1),
45694
46288
  /** Constraint complexity (constraints, edge cases, requirements) */
45695
- constraintComplexity: z99.number().min(0).max(1),
46289
+ constraintComplexity: z102.number().min(0).max(1),
45696
46290
  /** Ambiguity level (inverse - higher means more clear/specific) */
45697
- clarity: z99.number().min(0).max(1),
46291
+ clarity: z102.number().min(0).max(1),
45698
46292
  /** Output complexity expectation */
45699
- outputComplexity: z99.number().min(0).max(1)
46293
+ outputComplexity: z102.number().min(0).max(1)
45700
46294
  });
45701
- var FeatureWeightsSchema = z99.object({
45702
- lexicalComplexity: z99.number().min(0).max(1),
45703
- syntacticComplexity: z99.number().min(0).max(1),
45704
- semanticDensity: z99.number().min(0).max(1),
45705
- technicalSpecificity: z99.number().min(0).max(1),
45706
- taskScope: z99.number().min(0).max(1),
45707
- constraintComplexity: z99.number().min(0).max(1),
45708
- clarity: z99.number().min(0).max(1),
45709
- outputComplexity: z99.number().min(0).max(1)
46295
+ var FeatureWeightsSchema = z102.object({
46296
+ lexicalComplexity: z102.number().min(0).max(1),
46297
+ syntacticComplexity: z102.number().min(0).max(1),
46298
+ semanticDensity: z102.number().min(0).max(1),
46299
+ technicalSpecificity: z102.number().min(0).max(1),
46300
+ taskScope: z102.number().min(0).max(1),
46301
+ constraintComplexity: z102.number().min(0).max(1),
46302
+ clarity: z102.number().min(0).max(1),
46303
+ outputComplexity: z102.number().min(0).max(1)
45710
46304
  });
45711
46305
  var DEFAULT_FEATURE_WEIGHTS = {
45712
46306
  lexicalComplexity: 0.1,
@@ -45728,50 +46322,50 @@ var DEFAULT_DAAO_TIER_TO_CLIS = {
45728
46322
  balanced: ["codex", "opencode", "gemini", "claude"],
45729
46323
  powerful: ["claude", "codex", "opencode", "gemini"]
45730
46324
  };
45731
- var DAAOConfigSchema = z99.object({
46325
+ var DAAOConfigSchema = z102.object({
45732
46326
  /** Difficulty thresholds for level classification */
45733
- thresholds: z99.object({
45734
- easyUpperBound: z99.number().min(0).max(1),
45735
- hardLowerBound: z99.number().min(0).max(1)
46327
+ thresholds: z102.object({
46328
+ easyUpperBound: z102.number().min(0).max(1),
46329
+ hardLowerBound: z102.number().min(0).max(1)
45736
46330
  }).default(DEFAULT_DAAO_THRESHOLDS),
45737
46331
  /** Feature weights for difficulty aggregation */
45738
46332
  weights: FeatureWeightsSchema.default(DEFAULT_FEATURE_WEIGHTS),
45739
46333
  /** Mapping from model tier to CLI preference order */
45740
- tierToClis: z99.record(
45741
- z99.enum(["fast", "balanced", "powerful"]),
45742
- z99.array(z99.enum(["claude", "gemini", "codex", "opencode"]))
46334
+ tierToClis: z102.record(
46335
+ z102.enum(["fast", "balanced", "powerful"]),
46336
+ z102.array(z102.enum(["claude", "gemini", "codex", "opencode"]))
45743
46337
  ).default(DEFAULT_DAAO_TIER_TO_CLIS),
45744
46338
  /** Enable adaptive calibration from outcomes */
45745
- enableCalibration: z99.boolean().default(true),
46339
+ enableCalibration: z102.boolean().default(true),
45746
46340
  /** Maximum outcomes to store for calibration */
45747
- maxCalibrationOutcomes: z99.number().int().positive().default(1e3),
46341
+ maxCalibrationOutcomes: z102.number().int().positive().default(1e3),
45748
46342
  /** Minimum outcomes before applying calibration adjustments */
45749
- minCalibrationOutcomes: z99.number().int().positive().default(50),
46343
+ minCalibrationOutcomes: z102.number().int().positive().default(50),
45750
46344
  /** Reconstruction error threshold for typical patterns */
45751
- typicalPatternThreshold: z99.number().min(0).max(1).default(0.3),
46345
+ typicalPatternThreshold: z102.number().min(0).max(1).default(0.3),
45752
46346
  /** Verbose logging */
45753
- verbose: z99.boolean().default(false)
46347
+ verbose: z102.boolean().default(false)
45754
46348
  });
45755
46349
 
45756
46350
  // src/cli-adapters/task-classifier.ts
45757
- import { z as z100 } from "zod";
45758
- var ClassificationPatternsSchema = z100.object({
45759
- code: z100.array(z100.string()).readonly(),
45760
- research: z100.array(z100.string()).readonly(),
45761
- documentation: z100.array(z100.string()).readonly(),
45762
- analysis: z100.array(z100.string()).readonly()
46351
+ import { z as z103 } from "zod";
46352
+ var ClassificationPatternsSchema = z103.object({
46353
+ code: z103.array(z103.string()).readonly(),
46354
+ research: z103.array(z103.string()).readonly(),
46355
+ documentation: z103.array(z103.string()).readonly(),
46356
+ analysis: z103.array(z103.string()).readonly()
45763
46357
  });
45764
46358
 
45765
46359
  // src/cli-adapters/response-cache-types.ts
45766
- import { z as z101 } from "zod";
45767
- var ResponseCacheConfigSchema = z101.object({
45768
- defaultTTL: z101.number().min(1e3).max(36e5).default(3e5),
46360
+ import { z as z104 } from "zod";
46361
+ var ResponseCacheConfigSchema = z104.object({
46362
+ defaultTTL: z104.number().min(1e3).max(36e5).default(3e5),
45769
46363
  // 5 minutes
45770
- maxEntries: z101.number().min(10).max(1e5).default(1e3),
45771
- maxMemoryMB: z101.number().min(1).max(1e3).default(50),
45772
- cleanupInterval: z101.number().min(1e3).max(6e5).default(6e4),
46364
+ maxEntries: z104.number().min(10).max(1e5).default(1e3),
46365
+ maxMemoryMB: z104.number().min(1).max(1e3).default(50),
46366
+ cleanupInterval: z104.number().min(1e3).max(6e5).default(6e4),
45773
46367
  // 1 minute
45774
- enableLogging: z101.boolean().default(false)
46368
+ enableLogging: z104.boolean().default(false)
45775
46369
  });
45776
46370
 
45777
46371
  // src/cli-adapters/response-cache-utils.ts
@@ -45779,12 +46373,12 @@ import { createHash as createHash4 } from "crypto";
45779
46373
  var logger43 = createLogger({ component: "ResponseCacheUtils" });
45780
46374
 
45781
46375
  // src/cli-adapters/unified-routing-types.ts
45782
- import { z as z102 } from "zod";
45783
- var UnifiedRoutingDecisionSchema = z102.object({
45784
- selectedCli: z102.string(),
45785
- confidence: z102.number().min(0).max(1),
45786
- reason: z102.string(),
45787
- strategy: z102.enum([
46376
+ import { z as z105 } from "zod";
46377
+ var UnifiedRoutingDecisionSchema = z105.object({
46378
+ selectedCli: z105.string(),
46379
+ confidence: z105.number().min(0).max(1),
46380
+ reason: z105.string(),
46381
+ strategy: z105.enum([
45788
46382
  "composite",
45789
46383
  "quality",
45790
46384
  "budget",
@@ -45796,57 +46390,57 @@ var UnifiedRoutingDecisionSchema = z102.object({
45796
46390
  "linucb",
45797
46391
  "direct"
45798
46392
  ]),
45799
- decisionTimeMs: z102.number().nonnegative(),
45800
- alternatives: z102.array(z102.string()).readonly(),
45801
- stagesExecuted: z102.array(z102.string()).readonly(),
45802
- withinBudget: z102.boolean().optional(),
45803
- estimatedComplexity: z102.enum(["simple", "moderate", "complex", "expert"]).optional(),
45804
- estimatedTokens: z102.number().int().positive().optional(),
45805
- topsisScore: z102.number().optional(),
45806
- ucbScore: z102.number().optional(),
45807
- resolvedAtStage: z102.number().int().nonnegative().optional(),
45808
- consensusReached: z102.boolean().optional(),
45809
- agreementScore: z102.number().min(0).max(1).optional(),
45810
- metadata: z102.record(z102.string(), z102.unknown()).optional()
46393
+ decisionTimeMs: z105.number().nonnegative(),
46394
+ alternatives: z105.array(z105.string()).readonly(),
46395
+ stagesExecuted: z105.array(z105.string()).readonly(),
46396
+ withinBudget: z105.boolean().optional(),
46397
+ estimatedComplexity: z105.enum(["simple", "moderate", "complex", "expert"]).optional(),
46398
+ estimatedTokens: z105.number().int().positive().optional(),
46399
+ topsisScore: z105.number().optional(),
46400
+ ucbScore: z105.number().optional(),
46401
+ resolvedAtStage: z105.number().int().nonnegative().optional(),
46402
+ consensusReached: z105.boolean().optional(),
46403
+ agreementScore: z105.number().min(0).max(1).optional(),
46404
+ metadata: z105.record(z105.string(), z105.unknown()).optional()
45811
46405
  });
45812
46406
 
45813
46407
  // src/learning/outcome-feedback-types.ts
45814
- import { z as z103 } from "zod";
45815
- var QualitySignalsSchema = z103.object({
45816
- testsPass: z103.boolean().optional(),
45817
- lintErrors: z103.number().int().min(0).optional(),
45818
- userApproved: z103.boolean().optional(),
45819
- retryCount: z103.number().int().min(0).default(0),
45820
- completionRatio: z103.number().min(0).max(1).default(1),
45821
- validStructure: z103.boolean().optional(),
45822
- coherenceScore: z103.number().min(0).max(1).optional()
46408
+ import { z as z106 } from "zod";
46409
+ var QualitySignalsSchema = z106.object({
46410
+ testsPass: z106.boolean().optional(),
46411
+ lintErrors: z106.number().int().min(0).optional(),
46412
+ userApproved: z106.boolean().optional(),
46413
+ retryCount: z106.number().int().min(0).default(0),
46414
+ completionRatio: z106.number().min(0).max(1).default(1),
46415
+ validStructure: z106.boolean().optional(),
46416
+ coherenceScore: z106.number().min(0).max(1).optional()
45823
46417
  });
45824
- var RoutingDecisionSchema = z103.object({
45825
- id: z103.uuid(),
45826
- timestamp: z103.iso.datetime(),
45827
- query: z103.string(),
45828
- routerType: z103.enum(["linucb", "preference", "quality", "cascade", "topsis"]),
45829
- selectedModel: z103.string(),
45830
- selectedTier: z103.enum(["strong", "weak"]).optional(),
45831
- armIndex: z103.number().int().min(0).optional(),
45832
- banditContext: z103.record(z103.string(), z103.unknown()).optional(),
45833
- queryFeatures: z103.record(z103.string(), z103.unknown()).optional(),
45834
- ucbScore: z103.number().optional(),
45835
- confidence: z103.number().min(0).max(1).optional(),
45836
- traceId: z103.string(),
45837
- domain: z103.string().optional()
46418
+ var RoutingDecisionSchema = z106.object({
46419
+ id: z106.uuid(),
46420
+ timestamp: z106.iso.datetime(),
46421
+ query: z106.string(),
46422
+ routerType: z106.enum(["linucb", "preference", "quality", "cascade", "topsis"]),
46423
+ selectedModel: z106.string(),
46424
+ selectedTier: z106.enum(["strong", "weak"]).optional(),
46425
+ armIndex: z106.number().int().min(0).optional(),
46426
+ banditContext: z106.record(z106.string(), z106.unknown()).optional(),
46427
+ queryFeatures: z106.record(z106.string(), z106.unknown()).optional(),
46428
+ ucbScore: z106.number().optional(),
46429
+ confidence: z106.number().min(0).max(1).optional(),
46430
+ traceId: z106.string(),
46431
+ domain: z106.string().optional()
45838
46432
  });
45839
- var TaskOutcomeSchema = z103.object({
45840
- routingDecisionId: z103.uuid(),
45841
- timestamp: z103.iso.datetime(),
45842
- outcomeClass: z103.enum(["success", "partial", "failure", "timeout", "error"]),
45843
- success: z103.boolean(),
45844
- qualityScore: z103.number().min(0).max(1),
45845
- durationMs: z103.number().min(0),
45846
- tokenUsage: z103.number().int().min(0),
45847
- errorMessage: z103.string().optional(),
46433
+ var TaskOutcomeSchema = z106.object({
46434
+ routingDecisionId: z106.uuid(),
46435
+ timestamp: z106.iso.datetime(),
46436
+ outcomeClass: z106.enum(["success", "partial", "failure", "timeout", "error"]),
46437
+ success: z106.boolean(),
46438
+ qualityScore: z106.number().min(0).max(1),
46439
+ durationMs: z106.number().min(0),
46440
+ tokenUsage: z106.number().int().min(0),
46441
+ errorMessage: z106.string().optional(),
45848
46442
  qualitySignals: QualitySignalsSchema,
45849
- traceId: z103.string()
46443
+ traceId: z106.string()
45850
46444
  });
45851
46445
  var DEFAULT_FEEDBACK_COLLECTOR_CONFIG = {
45852
46446
  maxPendingDecisions: 1e3,
@@ -45861,17 +46455,17 @@ var DEFAULT_FEEDBACK_COLLECTOR_CONFIG = {
45861
46455
  targetTokenUsage: 2e3,
45862
46456
  maxHistorySize: 1e4
45863
46457
  };
45864
- var FeedbackCollectorConfigSchema = z103.object({
45865
- maxPendingDecisions: z103.number().int().positive().default(1e3),
45866
- pendingTimeoutMs: z103.number().positive().default(3e5),
45867
- enableAutoReward: z103.boolean().default(true),
45868
- qualityWeight: z103.number().min(0).max(1).default(0.5),
45869
- speedWeight: z103.number().min(0).max(1).default(0.2),
45870
- efficiencyWeight: z103.number().min(0).max(1).default(0.2),
45871
- retryPenalty: z103.number().min(0).max(1).default(0.1),
45872
- targetDurationMs: z103.number().positive().default(5e3),
45873
- targetTokenUsage: z103.number().positive().default(2e3),
45874
- maxHistorySize: z103.number().int().positive().default(1e4)
46458
+ var FeedbackCollectorConfigSchema = z106.object({
46459
+ maxPendingDecisions: z106.number().int().positive().default(1e3),
46460
+ pendingTimeoutMs: z106.number().positive().default(3e5),
46461
+ enableAutoReward: z106.boolean().default(true),
46462
+ qualityWeight: z106.number().min(0).max(1).default(0.5),
46463
+ speedWeight: z106.number().min(0).max(1).default(0.2),
46464
+ efficiencyWeight: z106.number().min(0).max(1).default(0.2),
46465
+ retryPenalty: z106.number().min(0).max(1).default(0.1),
46466
+ targetDurationMs: z106.number().positive().default(5e3),
46467
+ targetTokenUsage: z106.number().positive().default(2e3),
46468
+ maxHistorySize: z106.number().int().positive().default(1e4)
45875
46469
  });
45876
46470
 
45877
46471
  // src/learning/outcome-feedback-helpers.ts
@@ -46935,7 +47529,7 @@ function getPolicy(id) {
46935
47529
  // src/security/sandbox/sandbox-executor.ts
46936
47530
  import { execFile as execFile2 } from "child_process";
46937
47531
  import { promisify as promisify2 } from "util";
46938
- import { resolve as resolve16, normalize as normalize2, sep as sep6 } from "path";
47532
+ import { resolve as resolve17, normalize as normalize2, sep as sep6 } from "path";
46939
47533
  var execFileAsync2 = promisify2(execFile2);
46940
47534
  var logger45 = createLogger({ component: "sandbox-executor" });
46941
47535
  function parseExecError(error) {
@@ -47015,9 +47609,9 @@ var PolicySandboxExecutor = class {
47015
47609
  */
47016
47610
  validateCwd(cwd, policy) {
47017
47611
  if (cwd === void 0) return null;
47018
- const normalizedCwd = normalize2(resolve16(cwd));
47612
+ const normalizedCwd = normalize2(resolve17(cwd));
47019
47613
  const isAllowed = policy.pathRules.some((rule) => {
47020
- const normalizedRule = normalize2(resolve16(rule.path));
47614
+ const normalizedRule = normalize2(resolve17(rule.path));
47021
47615
  const isUnderRule = normalizedCwd === normalizedRule || normalizedCwd.startsWith(normalizedRule + sep6);
47022
47616
  return isUnderRule && rule.access !== "none";
47023
47617
  });
@@ -47884,10 +48478,10 @@ var PredictionWriter = class {
47884
48478
  * Opens the output file for writing.
47885
48479
  */
47886
48480
  async open() {
47887
- const fs20 = await import("fs/promises");
48481
+ const fs21 = await import("fs/promises");
47888
48482
  try {
47889
48483
  const flags = this.options.append ? "a" : "w";
47890
- this.fileHandle = await fs20.open(this.options.outputPath, flags);
48484
+ this.fileHandle = await fs21.open(this.options.outputPath, flags);
47891
48485
  return { ok: true, value: void 0 };
47892
48486
  } catch (err2) {
47893
48487
  return {
@@ -47961,11 +48555,11 @@ var PredictionWriter = class {
47961
48555
  }
47962
48556
  };
47963
48557
  async function writePredictions(predictions, outputPath, options = {}) {
47964
- const fs20 = await import("fs/promises");
48558
+ const fs21 = await import("fs/promises");
47965
48559
  try {
47966
48560
  const lines = predictions.map(formatPrediction).join("\n") + "\n";
47967
48561
  const flags = options.append === true ? "a" : "w";
47968
- await fs20.writeFile(outputPath, lines, { flag: flags });
48562
+ await fs21.writeFile(outputPath, lines, { flag: flags });
47969
48563
  return { ok: true, value: predictions.length };
47970
48564
  } catch (err2) {
47971
48565
  return {
@@ -47990,9 +48584,9 @@ function parsePredictionLine(line) {
47990
48584
  }
47991
48585
  }
47992
48586
  async function readPredictions(inputPath) {
47993
- const fs20 = await import("fs/promises");
48587
+ const fs21 = await import("fs/promises");
47994
48588
  try {
47995
- const content = await fs20.readFile(inputPath, "utf-8");
48589
+ const content = await fs21.readFile(inputPath, "utf-8");
47996
48590
  const lines = content.trim().split("\n").filter(Boolean);
47997
48591
  const predictions = [];
47998
48592
  for (const line of lines) {
@@ -48265,13 +48859,13 @@ function createEmptyContext() {
48265
48859
  approachHistory: []
48266
48860
  };
48267
48861
  }
48268
- function assignRelevance(path19, response) {
48862
+ function assignRelevance(path20, response) {
48269
48863
  const lowerResponse = response.toLowerCase();
48270
- const lowerPath = path19.toLowerCase();
48864
+ const lowerPath = path20.toLowerCase();
48271
48865
  const idx = lowerResponse.indexOf(lowerPath);
48272
48866
  if (idx === -1) return "low";
48273
48867
  const surroundStart = Math.max(0, idx - 100);
48274
- const surroundEnd = Math.min(lowerResponse.length, idx + path19.length + 100);
48868
+ const surroundEnd = Math.min(lowerResponse.length, idx + path20.length + 100);
48275
48869
  const surrounding = lowerResponse.slice(surroundStart, surroundEnd);
48276
48870
  if (/(?:root cause|bug|fix|patch|change|modify|edit)/i.test(surrounding)) {
48277
48871
  return "high";
@@ -48414,10 +49008,10 @@ var GIT_TIMEOUT_MS = 3e5;
48414
49008
  var SAFE_COMMIT_RE = /^[0-9a-f]{7,40}$/i;
48415
49009
  var SAFE_REPO_RE = /^[a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+$/;
48416
49010
  async function tryExistingClone(repoDir, commit, exec5) {
48417
- const fs20 = await import("fs/promises");
48418
- const path19 = await import("path");
49011
+ const fs21 = await import("fs/promises");
49012
+ const path20 = await import("path");
48419
49013
  try {
48420
- await fs20.access(path19.join(repoDir, ".git"));
49014
+ await fs21.access(path20.join(repoDir, ".git"));
48421
49015
  await exec5(`git checkout -- .`, { cwd: repoDir, timeout: GIT_TIMEOUT_MS });
48422
49016
  await exec5(`git clean -fd`, { cwd: repoDir, timeout: GIT_TIMEOUT_MS });
48423
49017
  try {
@@ -48436,8 +49030,8 @@ async function tryExistingClone(repoDir, commit, exec5) {
48436
49030
  }
48437
49031
  }
48438
49032
  async function cloneRepository(repo, commit, workDir) {
48439
- const path19 = await import("path");
48440
- const fs20 = await import("fs/promises");
49033
+ const path20 = await import("path");
49034
+ const fs21 = await import("fs/promises");
48441
49035
  const childProcess = await import("child_process");
48442
49036
  const { promisify: promisify9 } = await import("util");
48443
49037
  const exec5 = promisify9(childProcess.exec);
@@ -48447,9 +49041,9 @@ async function cloneRepository(repo, commit, workDir) {
48447
49041
  if (!SAFE_COMMIT_RE.test(commit)) {
48448
49042
  return { ok: false, error: new AgentRunnerError(`Invalid commit hash: ${commit}`) };
48449
49043
  }
48450
- const repoDir = path19.join(workDir, repo.replaceAll("/", "__"));
49044
+ const repoDir = path20.join(workDir, repo.replaceAll("/", "__"));
48451
49045
  try {
48452
- await fs20.mkdir(workDir, { recursive: true });
49046
+ await fs21.mkdir(workDir, { recursive: true });
48453
49047
  const cloned = await tryExistingClone(repoDir, commit, exec5);
48454
49048
  if (cloned) return { ok: true, value: repoDir };
48455
49049
  await exec5(`git clone --filter=blob:none --no-tags https://github.com/${repo}.git ${repoDir}`, {
@@ -48465,19 +49059,19 @@ async function applyPatch(repoDir, patch) {
48465
49059
  const childProcess = await import("child_process");
48466
49060
  const { promisify: promisify9 } = await import("util");
48467
49061
  const exec5 = promisify9(childProcess.exec);
48468
- const fs20 = await import("fs/promises");
48469
- const path19 = await import("path");
48470
- const patchFile = path19.join(repoDir, ".agent_patch.diff");
49062
+ const fs21 = await import("fs/promises");
49063
+ const path20 = await import("path");
49064
+ const patchFile = path20.join(repoDir, ".agent_patch.diff");
48471
49065
  try {
48472
- await fs20.writeFile(patchFile, patch);
49066
+ await fs21.writeFile(patchFile, patch);
48473
49067
  await exec5(`git apply --whitespace=fix ${patchFile}`, {
48474
49068
  cwd: repoDir,
48475
49069
  timeout: GIT_TIMEOUT_MS
48476
49070
  });
48477
- await fs20.unlink(patchFile);
49071
+ await fs21.unlink(patchFile);
48478
49072
  return { ok: true, value: void 0 };
48479
49073
  } catch (err2) {
48480
- await fs20.unlink(patchFile).catch((e) => {
49074
+ await fs21.unlink(patchFile).catch((e) => {
48481
49075
  logger50.debug("Failed to clean up patch file", {
48482
49076
  error: e instanceof Error ? e.message : String(e)
48483
49077
  });
@@ -49501,7 +50095,7 @@ async function getDockerVersion(logger56) {
49501
50095
  }
49502
50096
 
49503
50097
  // src/swe-bench/harness-output-parsing.ts
49504
- import * as fs13 from "fs/promises";
50098
+ import * as fs14 from "fs/promises";
49505
50099
  function parseHarnessOutput(output2, logger56) {
49506
50100
  try {
49507
50101
  const parsed = JSON.parse(output2);
@@ -49522,7 +50116,7 @@ function isValidHarnessOutput(obj) {
49522
50116
  }
49523
50117
  async function parseHarnessLogFile(logPath, logger56) {
49524
50118
  try {
49525
- const content = await fs13.readFile(logPath, "utf-8");
50119
+ const content = await fs14.readFile(logPath, "utf-8");
49526
50120
  return parseHarnessOutput(content, logger56);
49527
50121
  } catch (err2) {
49528
50122
  logger56?.warn("Failed to read harness log file", { logPath, error: String(err2) });
@@ -49604,8 +50198,8 @@ function transformHarnessOutput(raw) {
49604
50198
 
49605
50199
  // src/swe-bench/harness-file-operations.ts
49606
50200
  import { spawn } from "child_process";
49607
- import * as fs14 from "fs/promises";
49608
- import * as path12 from "path";
50201
+ import * as fs15 from "fs/promises";
50202
+ import * as path13 from "path";
49609
50203
  var capitalizeFirst = capitalize;
49610
50204
  function buildHarnessArgs(config) {
49611
50205
  const args = [
@@ -49647,11 +50241,11 @@ function countValidPredictions(content) {
49647
50241
  }
49648
50242
  async function validatePredictionsFile(predictionsPath, logger56) {
49649
50243
  try {
49650
- const stat6 = await fs14.stat(predictionsPath);
50244
+ const stat6 = await fs15.stat(predictionsPath);
49651
50245
  if (!stat6.isFile()) {
49652
50246
  return { valid: false, lineCount: 0, error: "Path is not a file" };
49653
50247
  }
49654
- const content = await fs14.readFile(predictionsPath, "utf-8");
50248
+ const content = await fs15.readFile(predictionsPath, "utf-8");
49655
50249
  const validCount = countValidPredictions(content);
49656
50250
  if (validCount === 0) {
49657
50251
  return { valid: false, lineCount: 0, error: "No valid predictions found" };
@@ -49665,7 +50259,7 @@ async function validatePredictionsFile(predictionsPath, logger56) {
49665
50259
  }
49666
50260
  async function ensureOutputDir(outputDir, logger56) {
49667
50261
  try {
49668
- await fs14.mkdir(outputDir, { recursive: true });
50262
+ await fs15.mkdir(outputDir, { recursive: true });
49669
50263
  logger56?.debug("Output directory ensured", { path: outputDir });
49670
50264
  } catch (err2) {
49671
50265
  logger56?.warn("Failed to create output directory", { path: outputDir, error: String(err2) });
@@ -49702,7 +50296,7 @@ function createInitialProgress(totalCount) {
49702
50296
  };
49703
50297
  }
49704
50298
  function getResultsFilePath(config) {
49705
- return path12.join(config.outputDir, config.runId, "results.json");
50299
+ return path13.join(config.outputDir, config.runId, "results.json");
49706
50300
  }
49707
50301
 
49708
50302
  // src/swe-bench/harness-process-runner.ts
@@ -49752,13 +50346,13 @@ function handleStdoutChunk(chunk, currentProgress, startTime, onProgress) {
49752
50346
  }
49753
50347
  }
49754
50348
  function handleProcessClose(options) {
49755
- const { code, config, stderr, context, resolve: resolve18, reject } = options;
50349
+ const { code, config, stderr, context, resolve: resolve19, reject } = options;
49756
50350
  if (context.isCancelled) {
49757
50351
  reject(new HarnessExecutorError("Execution cancelled", "CANCELLED"));
49758
50352
  return;
49759
50353
  }
49760
50354
  handleProcessExitAsync(code, config, stderr, context.logger).then((result) => {
49761
- resolve18(result);
50355
+ resolve19(result);
49762
50356
  }).catch((err2) => {
49763
50357
  if (err2 instanceof HarnessExecutorError) {
49764
50358
  reject(err2);
@@ -49799,7 +50393,7 @@ async function parseResultsFile(config, logger56) {
49799
50393
  };
49800
50394
  }
49801
50395
  function runHarnessProcess(config, totalInstances, context, onProgress) {
49802
- return new Promise((resolve18, reject) => {
50396
+ return new Promise((resolve19, reject) => {
49803
50397
  const startTime = performance.now();
49804
50398
  let progress = createInitialProgress(totalInstances);
49805
50399
  progress = { ...progress, state: "starting" };
@@ -49821,7 +50415,7 @@ function runHarnessProcess(config, totalInstances, context, onProgress) {
49821
50415
  config,
49822
50416
  stderr: stderrCollector.value,
49823
50417
  context,
49824
- resolve: resolve18,
50418
+ resolve: resolve19,
49825
50419
  reject
49826
50420
  });
49827
50421
  });
@@ -49975,7 +50569,7 @@ var HarnessExecutor = class {
49975
50569
  const proc = this.currentProcess;
49976
50570
  if (proc !== null) {
49977
50571
  proc.kill("SIGTERM");
49978
- await new Promise((resolve18) => setTimeout(resolve18, 1e3));
50572
+ await new Promise((resolve19) => setTimeout(resolve19, 1e3));
49979
50573
  if (!proc.killed) {
49980
50574
  proc.kill("SIGKILL");
49981
50575
  }
@@ -51097,8 +51691,8 @@ var SWEBenchRunner = class {
51097
51691
  return { ok: true, value: null };
51098
51692
  }
51099
51693
  try {
51100
- const fs20 = await import("fs/promises");
51101
- const content = await fs20.readFile(this.config.checkpointPath, "utf-8");
51694
+ const fs21 = await import("fs/promises");
51695
+ const content = await fs21.readFile(this.config.checkpointPath, "utf-8");
51102
51696
  const checkpoint = JSON.parse(content);
51103
51697
  this.config.onMessage?.(
51104
51698
  `Resuming from checkpoint: ${String(checkpoint.completed_instances.length)} completed`
@@ -51127,8 +51721,8 @@ var SWEBenchRunner = class {
51127
51721
  last_updated: getTimeProvider().nowIso()
51128
51722
  };
51129
51723
  try {
51130
- const fs20 = await import("fs/promises");
51131
- await fs20.writeFile(this.config.checkpointPath, JSON.stringify(checkpoint, null, 2));
51724
+ const fs21 = await import("fs/promises");
51725
+ await fs21.writeFile(this.config.checkpointPath, JSON.stringify(checkpoint, null, 2));
51132
51726
  return { ok: true, value: void 0 };
51133
51727
  } catch (err2) {
51134
51728
  return {
@@ -51439,18 +52033,18 @@ function parsePatch(patch) {
51439
52033
  // src/swe-bench/patch-applicator-executor.ts
51440
52034
  import { execFile as execFile5 } from "child_process";
51441
52035
  import { promisify as promisify7 } from "util";
51442
- import * as fs15 from "fs/promises";
51443
- import * as path13 from "path";
52036
+ import * as fs16 from "fs/promises";
52037
+ import * as path14 from "path";
51444
52038
  var execFileAsync5 = promisify7(execFile5);
51445
52039
  var MAX_OUTPUT_BUFFER = 5 * 1024 * 1024;
51446
52040
  async function writeTempPatch(patch, workDir) {
51447
- const tempPath = path13.join(workDir, `.patch-${String(getTimeProvider().now())}.patch`);
51448
- await fs15.writeFile(tempPath, patch, "utf-8");
52041
+ const tempPath = path14.join(workDir, `.patch-${String(getTimeProvider().now())}.patch`);
52042
+ await fs16.writeFile(tempPath, patch, "utf-8");
51449
52043
  return tempPath;
51450
52044
  }
51451
52045
  async function cleanupTempFile(patchPath) {
51452
52046
  try {
51453
- await fs15.unlink(patchPath);
52047
+ await fs16.unlink(patchPath);
51454
52048
  } catch (cleanupErr) {
51455
52049
  void cleanupErr;
51456
52050
  }
@@ -51694,12 +52288,12 @@ var TestRunnerError = class extends Error {
51694
52288
  };
51695
52289
 
51696
52290
  // src/swe-bench/test-runner-parser.ts
51697
- import * as fs16 from "fs/promises";
51698
- import * as path14 from "path";
52291
+ import * as fs17 from "fs/promises";
52292
+ import * as path15 from "path";
51699
52293
  async function readJsonResults(workDir) {
51700
- const jsonPath = path14.join(workDir, "test-results.json");
52294
+ const jsonPath = path15.join(workDir, "test-results.json");
51701
52295
  try {
51702
- const content = await fs16.readFile(jsonPath, "utf-8");
52296
+ const content = await fs17.readFile(jsonPath, "utf-8");
51703
52297
  return JSON.parse(content);
51704
52298
  } catch {
51705
52299
  return null;
@@ -51860,7 +52454,7 @@ function executeInDocker(options) {
51860
52454
  const image = config.dockerImage ?? "python:3.11-slim";
51861
52455
  logger56.debug("Executing tests in Docker", { image, command });
51862
52456
  const dockerArgs = buildDockerArgs(command, config, image);
51863
- return new Promise((resolve18) => {
52457
+ return new Promise((resolve19) => {
51864
52458
  const proc = spawn2("docker", dockerArgs, {
51865
52459
  stdio: ["ignore", "pipe", "pipe"]
51866
52460
  });
@@ -51873,17 +52467,17 @@ function executeInDocker(options) {
51873
52467
  clearTimeout(timeoutId);
51874
52468
  state.currentProcess = null;
51875
52469
  if (state.isCancelled) {
51876
- resolve18(createCancelledResult2(startTime));
52470
+ resolve19(createCancelledResult2(startTime));
51877
52471
  return;
51878
52472
  }
51879
52473
  const output2 = `${getStdout()}
51880
52474
  ${getStderr()}`.trim();
51881
- void parseTestResults(output2, startTime, config.workDir).then(resolve18);
52475
+ void parseTestResults(output2, startTime, config.workDir).then(resolve19);
51882
52476
  });
51883
52477
  proc.on("error", (err2) => {
51884
52478
  clearTimeout(timeoutId);
51885
52479
  state.currentProcess = null;
51886
- resolve18(handleTestError(err2, startTime));
52480
+ resolve19(handleTestError(err2, startTime));
51887
52481
  });
51888
52482
  });
51889
52483
  }
@@ -51891,8 +52485,8 @@ ${getStderr()}`.trim();
51891
52485
  // src/swe-bench/test-runner.ts
51892
52486
  import { exec as exec3 } from "child_process";
51893
52487
  import { promisify as promisify8 } from "util";
51894
- import * as fs17 from "fs/promises";
51895
- import * as path15 from "path";
52488
+ import * as fs18 from "fs/promises";
52489
+ import * as path16 from "path";
51896
52490
  var execAsync3 = promisify8(exec3);
51897
52491
  var FRAMEWORK_CONFIG_FILES = {
51898
52492
  pytest: ["pytest.ini", "pyproject.toml", "setup.cfg", "conftest.py", "tox.ini"],
@@ -51998,9 +52592,9 @@ var TestRunner = class {
51998
52592
  async findConfigFiles(workDir, configFiles) {
51999
52593
  const found = [];
52000
52594
  for (const file of configFiles) {
52001
- const filePath = path15.join(workDir, file);
52595
+ const filePath = path16.join(workDir, file);
52002
52596
  try {
52003
- await fs17.access(filePath);
52597
+ await fs18.access(filePath);
52004
52598
  found.push(file);
52005
52599
  } catch (accessErr) {
52006
52600
  void accessErr;
@@ -52150,8 +52744,8 @@ async function detectTestFramework(workDir) {
52150
52744
  }
52151
52745
 
52152
52746
  // src/swe-bench/report-generator.ts
52153
- import * as fs18 from "fs/promises";
52154
- import * as path16 from "path";
52747
+ import * as fs19 from "fs/promises";
52748
+ import * as path17 from "path";
52155
52749
 
52156
52750
  // src/swe-bench/report-renderer.ts
52157
52751
  function renderReport(report, format) {
@@ -52507,8 +53101,8 @@ var ReportGenerator = class {
52507
53101
  async save(report, config) {
52508
53102
  this.logger.info("Saving report", { outputPath: config.outputPath });
52509
53103
  const content = await this.render(report, config.format);
52510
- await fs18.mkdir(path16.dirname(config.outputPath), { recursive: true });
52511
- await fs18.writeFile(config.outputPath, content, "utf-8");
53104
+ await fs19.mkdir(path17.dirname(config.outputPath), { recursive: true });
53105
+ await fs19.writeFile(config.outputPath, content, "utf-8");
52512
53106
  this.logger.info("Report saved", { path: config.outputPath, format: config.format });
52513
53107
  }
52514
53108
  /**
@@ -52727,14 +53321,14 @@ async function exportReport(result, outputPath, config) {
52727
53321
 
52728
53322
  // src/swe-bench/trace-logger.ts
52729
53323
  import { appendFile, writeFile as writeFile6 } from "fs/promises";
52730
- import * as path17 from "path";
53324
+ import * as path18 from "path";
52731
53325
  function deriveTracePath(outputPath) {
52732
- const ext = path17.extname(outputPath);
53326
+ const ext = path18.extname(outputPath);
52733
53327
  const base = outputPath.slice(0, outputPath.length - ext.length);
52734
53328
  return `${base}-trace.jsonl`;
52735
53329
  }
52736
53330
  function deriveStatusPath(outputPath) {
52737
- const ext = path17.extname(outputPath);
53331
+ const ext = path18.extname(outputPath);
52738
53332
  const base = outputPath.slice(0, outputPath.length - ext.length);
52739
53333
  return `${base}-status.json`;
52740
53334
  }
@@ -52939,8 +53533,8 @@ function getStdinLifecycleMonitor() {
52939
53533
  }
52940
53534
 
52941
53535
  // src/pipeline/task-tracker.ts
52942
- import * as fs19 from "fs";
52943
- import * as path18 from "path";
53536
+ import * as fs20 from "fs";
53537
+ import * as path19 from "path";
52944
53538
  var logger55 = createLogger({ component: "task-tracker" });
52945
53539
  async function exec4(cmd, args, timeout = 15e3) {
52946
53540
  const { execFile: execFile6 } = await import("child_process");
@@ -53018,8 +53612,8 @@ var JsonTaskTracker = class {
53018
53612
  outputPath;
53019
53613
  constructor(config) {
53020
53614
  const dir = config.outputDir ?? ".nexus-pipeline";
53021
- this.outputPath = path18.resolve(dir, "tasks.json");
53022
- fs19.mkdirSync(path18.dirname(this.outputPath), { recursive: true });
53615
+ this.outputPath = path19.resolve(dir, "tasks.json");
53616
+ fs20.mkdirSync(path19.dirname(this.outputPath), { recursive: true });
53023
53617
  }
53024
53618
  async createTask(title, body) {
53025
53619
  const id = String(this.nextId++);
@@ -53051,7 +53645,7 @@ var JsonTaskTracker = class {
53051
53645
  comments: Object.fromEntries(this.comments),
53052
53646
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
53053
53647
  };
53054
- fs19.writeFileSync(this.outputPath, JSON.stringify(data, null, 2));
53648
+ fs20.writeFileSync(this.outputPath, JSON.stringify(data, null, 2));
53055
53649
  }
53056
53650
  };
53057
53651
  async function detectBackend() {
@@ -53525,6 +54119,9 @@ export {
53525
54119
  registerResearchAddTool,
53526
54120
  ResearchAddSourceInputSchema,
53527
54121
  registerResearchAddSourceTool,
54122
+ registerSurveyOssLandscapeTool,
54123
+ registerVendorPublishingAuditTool,
54124
+ registerCompareDataFeedsTool,
53528
54125
  ResearchDiscoverInputSchema,
53529
54126
  registerResearchDiscoverTool,
53530
54127
  ResearchAnalyzeInputSchema,
@@ -53779,4 +54376,4 @@ export {
53779
54376
  detectBackend,
53780
54377
  createTaskTracker
53781
54378
  };
53782
- //# sourceMappingURL=chunk-CUGQAPGY.js.map
54379
+ //# sourceMappingURL=chunk-RLLMWZAE.js.map