nexus-agents 2.58.0 → 2.60.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.
@@ -1,7 +1,13 @@
1
+ import {
2
+ SharedMemoryStore
3
+ } from "./chunk-ED6VQWNG.js";
1
4
  import {
2
5
  getTokenEnvVars,
3
6
  resolveToken
4
7
  } from "./chunk-EZXOJZYE.js";
8
+ import {
9
+ executeExpert
10
+ } from "./chunk-JKDHWOQL.js";
5
11
  import {
6
12
  ClaudeAdapter,
7
13
  DEFAULT_RELEVANCE_CONFIG,
@@ -29,7 +35,7 @@ import {
29
35
  withAccessPolicy,
30
36
  withProgressHeartbeat,
31
37
  wrapToolWithTimeout
32
- } from "./chunk-L3NHOUEX.js";
38
+ } from "./chunk-FEWWXGFE.js";
33
39
  import {
34
40
  REGISTRY_PATH,
35
41
  getProjectRoot,
@@ -56,22 +62,22 @@ import {
56
62
  extractSymbolIndex,
57
63
  extractSymbols
58
64
  } from "./chunk-BQ4YXGGQ.js";
59
- import {
60
- SharedMemoryStore
61
- } from "./chunk-ED6VQWNG.js";
62
65
  import {
63
66
  DEFAULT_TASK_TTL_MS,
64
67
  DEFAULT_TOOL_RATE_LIMITS,
65
68
  clampTaskTtl,
66
69
  getAvailabilityCache,
67
70
  resolveFallback
68
- } from "./chunk-7EYQBG3W.js";
71
+ } from "./chunk-XRXUCE6K.js";
69
72
  import {
70
73
  DEFAULTS
71
74
  } from "./chunk-H43PABG4.js";
72
75
  import {
73
76
  resolveInsideRoot
74
77
  } from "./chunk-NUBSJGQZ.js";
78
+ import {
79
+ nexusDataPath
80
+ } from "./chunk-FDNWRZNJ.js";
75
81
  import {
76
82
  BUILT_IN_EXPERTS,
77
83
  BuiltInExpertTypeSchema,
@@ -97,9 +103,6 @@ import {
97
103
  import {
98
104
  getFallbackChainForCategory
99
105
  } from "./chunk-PTGBJFSD.js";
100
- import {
101
- executeExpert
102
- } from "./chunk-JKDHWOQL.js";
103
106
  import {
104
107
  ClaudeCliAdapter,
105
108
  CliDetectionCache,
@@ -13860,7 +13863,7 @@ function wouldCreateCycle(from, to, getNode) {
13860
13863
  return canReach(to, from, /* @__PURE__ */ new Set(), getNode);
13861
13864
  }
13862
13865
  function findCyclePath(from, to, getNode) {
13863
- const path21 = [from, to];
13866
+ const path20 = [from, to];
13864
13867
  const visited = /* @__PURE__ */ new Set([from]);
13865
13868
  const findPath = (current) => {
13866
13869
  if (current === from) return true;
@@ -13869,9 +13872,9 @@ function findCyclePath(from, to, getNode) {
13869
13872
  for (const depId of node.dependencies.keys()) {
13870
13873
  if (!visited.has(depId)) {
13871
13874
  visited.add(depId);
13872
- path21.push(depId);
13875
+ path20.push(depId);
13873
13876
  if (findPath(depId)) return true;
13874
- path21.pop();
13877
+ path20.pop();
13875
13878
  } else if (depId === from) {
13876
13879
  return true;
13877
13880
  }
@@ -13879,7 +13882,7 @@ function findCyclePath(from, to, getNode) {
13879
13882
  return false;
13880
13883
  };
13881
13884
  findPath(to);
13882
- return path21;
13885
+ return path20;
13883
13886
  }
13884
13887
  function detectCycleDFS(nodeId, visited, stack, getNode) {
13885
13888
  visited.add(nodeId);
@@ -13898,29 +13901,29 @@ function detectCycleDFS(nodeId, visited, stack, getNode) {
13898
13901
  return false;
13899
13902
  }
13900
13903
  function findCycleFromNode(startId, getNode) {
13901
- const path21 = [];
13904
+ const path20 = [];
13902
13905
  const visited = /* @__PURE__ */ new Set();
13903
13906
  const dfs = (nodeId) => {
13904
- if (path21.includes(nodeId)) {
13905
- const cycleStart = path21.indexOf(nodeId);
13906
- path21.splice(0, cycleStart);
13907
- path21.push(nodeId);
13907
+ if (path20.includes(nodeId)) {
13908
+ const cycleStart = path20.indexOf(nodeId);
13909
+ path20.splice(0, cycleStart);
13910
+ path20.push(nodeId);
13908
13911
  return true;
13909
13912
  }
13910
13913
  if (visited.has(nodeId)) return false;
13911
13914
  visited.add(nodeId);
13912
- path21.push(nodeId);
13915
+ path20.push(nodeId);
13913
13916
  const node = getNode(nodeId);
13914
13917
  if (node) {
13915
13918
  for (const depId of node.dependencies.keys()) {
13916
13919
  if (dfs(depId)) return true;
13917
13920
  }
13918
13921
  }
13919
- path21.pop();
13922
+ path20.pop();
13920
13923
  return false;
13921
13924
  };
13922
13925
  dfs(startId);
13923
- return path21;
13926
+ return path20;
13924
13927
  }
13925
13928
 
13926
13929
  // src/agents/skills/skill-dependency-graph.ts
@@ -15078,7 +15081,6 @@ function createContextItem(id, content, source, relevance, timestamp) {
15078
15081
  // src/agents/wave-checkpoint-persistence.ts
15079
15082
  import * as fs from "fs";
15080
15083
  import * as path from "path";
15081
- import * as os from "os";
15082
15084
 
15083
15085
  // src/agents/wave-checkpoint-types.ts
15084
15086
  import { z as z27 } from "zod";
@@ -15103,13 +15105,13 @@ var WaveCheckpointEntrySchema = z27.object({
15103
15105
 
15104
15106
  // src/agents/wave-checkpoint-persistence.ts
15105
15107
  var logger5 = createLogger({ component: "wave-checkpoint" });
15106
- var CHECKPOINT_DIR = path.join(".nexus-agents", "checkpoints");
15108
+ var CHECKPOINT_SUBDIR = "checkpoints";
15107
15109
  var DIR_MODE = 448;
15108
15110
  function getCheckpointDir(customDir) {
15109
15111
  if (customDir !== void 0) {
15110
15112
  return path.resolve(customDir);
15111
15113
  }
15112
- return path.join(os.homedir(), CHECKPOINT_DIR);
15114
+ return nexusDataPath(CHECKPOINT_SUBDIR);
15113
15115
  }
15114
15116
  function ensureCheckpointDir(customDir) {
15115
15117
  const dirPath = getCheckpointDir(customDir);
@@ -18466,18 +18468,18 @@ var DependencyGraph = class {
18466
18468
  }
18467
18469
  const startNode = firstNode;
18468
18470
  const visited = /* @__PURE__ */ new Set();
18469
- const path21 = [];
18471
+ const path20 = [];
18470
18472
  const dfs = (nodeId) => {
18471
- if (path21.includes(nodeId)) {
18472
- const cycleStart = path21.indexOf(nodeId);
18473
- path21.splice(0, cycleStart);
18473
+ if (path20.includes(nodeId)) {
18474
+ const cycleStart = path20.indexOf(nodeId);
18475
+ path20.splice(0, cycleStart);
18474
18476
  return true;
18475
18477
  }
18476
18478
  if (visited.has(nodeId)) {
18477
18479
  return false;
18478
18480
  }
18479
18481
  visited.add(nodeId);
18480
- path21.push(nodeId);
18482
+ path20.push(nodeId);
18481
18483
  const node = this.nodes.get(nodeId);
18482
18484
  if (node) {
18483
18485
  for (const depId of node.dependencies) {
@@ -18488,11 +18490,11 @@ var DependencyGraph = class {
18488
18490
  }
18489
18491
  }
18490
18492
  }
18491
- path21.pop();
18493
+ path20.pop();
18492
18494
  return false;
18493
18495
  };
18494
18496
  dfs(startNode);
18495
- return path21.length > 0 ? path21 : cycleNodes.slice(0, 3);
18497
+ return path20.length > 0 ? path20 : cycleNodes.slice(0, 3);
18496
18498
  }
18497
18499
  /**
18498
18500
  * Gets the execution order (topologically sorted step IDs).
@@ -19344,9 +19346,9 @@ function getBuiltInTemplatesPath() {
19344
19346
  join3(dirname2(currentDir), "workflows", "templates"),
19345
19347
  join3(dirname2(currentDir), "dist", "workflows", "templates")
19346
19348
  ];
19347
- for (const path21 of possiblePaths) {
19348
- if (existsSync3(path21)) {
19349
- return path21;
19349
+ for (const path20 of possiblePaths) {
19350
+ if (existsSync3(path20)) {
19351
+ return path20;
19350
19352
  }
19351
19353
  }
19352
19354
  return join3(currentDir, "templates");
@@ -19887,9 +19889,9 @@ function validateRequiredInputs(inputs, required) {
19887
19889
  }
19888
19890
 
19889
19891
  // src/workflows/expression-resolver-helpers.ts
19890
- function getNestedValue(obj, path21) {
19892
+ function getNestedValue(obj, path20) {
19891
19893
  let current = obj;
19892
- for (const key of path21) {
19894
+ for (const key of path20) {
19893
19895
  if (current === null || current === void 0) {
19894
19896
  return void 0;
19895
19897
  }
@@ -19900,24 +19902,24 @@ function getNestedValue(obj, path21) {
19900
19902
  }
19901
19903
  return current;
19902
19904
  }
19903
- function resolveInputs(path21, context) {
19904
- const value = getNestedValue(context.inputs, path21);
19905
+ function resolveInputs(path20, context) {
19906
+ const value = getNestedValue(context.inputs, path20);
19905
19907
  if (value === void 0) {
19906
19908
  return {
19907
19909
  success: false,
19908
- error: `Input '${path21.join(".")}' not found`
19910
+ error: `Input '${path20.join(".")}' not found`
19909
19911
  };
19910
19912
  }
19911
19913
  return { success: true, value };
19912
19914
  }
19913
- function validateStepPath(path21) {
19914
- if (path21.length < 2) {
19915
+ function validateStepPath(path20) {
19916
+ if (path20.length < 2) {
19915
19917
  return {
19916
19918
  success: false,
19917
19919
  error: "Steps expression requires at least stepId and output"
19918
19920
  };
19919
19921
  }
19920
- if (path21[0] === void 0 || path21[1] === void 0) {
19922
+ if (path20[0] === void 0 || path20[1] === void 0) {
19921
19923
  return {
19922
19924
  success: false,
19923
19925
  error: "Steps expression requires stepId and output"
@@ -19943,12 +19945,12 @@ function validateStepResult(stepId, outputKey, stepResult) {
19943
19945
  }
19944
19946
  return null;
19945
19947
  }
19946
- function resolveSteps(path21, context) {
19947
- const pathError = validateStepPath(path21);
19948
+ function resolveSteps(path20, context) {
19949
+ const pathError = validateStepPath(path20);
19948
19950
  if (pathError !== null) return pathError;
19949
- const stepId = path21[0] ?? "";
19950
- const outputKey = path21[1] ?? "";
19951
- const rest = path21.slice(2);
19951
+ const stepId = path20[0] ?? "";
19952
+ const outputKey = path20[1] ?? "";
19953
+ const rest = path20.slice(2);
19952
19954
  const stepResult = context.stepResults.get(stepId);
19953
19955
  const earlyReturn = validateStepResult(stepId, outputKey, stepResult);
19954
19956
  if (earlyReturn !== null) return earlyReturn;
@@ -19964,15 +19966,15 @@ function resolveSteps(path21, context) {
19964
19966
  }
19965
19967
  return { success: true, value };
19966
19968
  }
19967
- function resolveVariables(path21, context) {
19968
- if (path21.length === 0) {
19969
+ function resolveVariables(path20, context) {
19970
+ if (path20.length === 0) {
19969
19971
  return {
19970
19972
  success: false,
19971
19973
  error: "Variables expression requires a variable name"
19972
19974
  };
19973
19975
  }
19974
- const varName = path21[0];
19975
- const rest = path21.slice(1);
19976
+ const varName = path20[0];
19977
+ const rest = path20.slice(1);
19976
19978
  if (varName === void 0) {
19977
19979
  return {
19978
19980
  success: false,
@@ -20995,8 +20997,8 @@ var WorkflowEngine = class {
20995
20997
  this.config = resolveConfig2(config);
20996
20998
  }
20997
20999
  /** Load workflow template from file. */
20998
- async loadTemplate(path21) {
20999
- return this.deps.loadWorkflowFile(path21);
21000
+ async loadTemplate(path20) {
21001
+ return this.deps.loadWorkflowFile(path20);
21000
21002
  }
21001
21003
  /** Execute a workflow with inputs. */
21002
21004
  async execute(workflow, inputs) {
@@ -21100,8 +21102,8 @@ var WorkflowEngine = class {
21100
21102
  }
21101
21103
  return Promise.resolve(templates);
21102
21104
  }
21103
- createTemplate(workflow, path21, category) {
21104
- const t = { name: workflow.name, version: workflow.version, path: path21, category };
21105
+ createTemplate(workflow, path20, category) {
21106
+ const t = { name: workflow.name, version: workflow.version, path: path20, category };
21105
21107
  if (workflow.description !== void 0) t.description = workflow.description;
21106
21108
  return t;
21107
21109
  }
@@ -21387,8 +21389,8 @@ function createParseWorkflow() {
21387
21389
  };
21388
21390
  }
21389
21391
  function createLoadWorkflowFile() {
21390
- return async (path21) => {
21391
- const result = await loadWorkflowFile(path21);
21392
+ return async (path20) => {
21393
+ const result = await loadWorkflowFile(path20);
21392
21394
  if (!result.ok) {
21393
21395
  if (result.error instanceof ParseError) {
21394
21396
  return result;
@@ -21617,13 +21619,12 @@ function withLogging(toolName, handler3, logger56) {
21617
21619
  // src/mcp/middleware/auth-handler.ts
21618
21620
  import { randomBytes, timingSafeEqual } from "crypto";
21619
21621
  import { readFileSync as readFileSync2, writeFileSync, existsSync as existsSync4, mkdirSync as mkdirSync2 } from "fs";
21620
- import { join as join4, dirname as dirname3 } from "path";
21621
- import { homedir as homedir2 } from "os";
21622
- var DEFAULT_AUTH_DIR = ".nexus-agents/auth";
21622
+ import { dirname as dirname3 } from "path";
21623
+ var DEFAULT_AUTH_SUBDIR = "auth";
21623
21624
  var DEFAULT_TOKEN_FILE = "server-token";
21624
21625
  var TOKEN_LENGTH_BYTES = 32;
21625
21626
  function getDefaultTokenPath() {
21626
- return join4(homedir2(), DEFAULT_AUTH_DIR, DEFAULT_TOKEN_FILE);
21627
+ return nexusDataPath(DEFAULT_AUTH_SUBDIR, DEFAULT_TOKEN_FILE);
21627
21628
  }
21628
21629
  function generateSecureToken() {
21629
21630
  return randomBytes(TOKEN_LENGTH_BYTES).toString("hex");
@@ -23437,10 +23438,10 @@ function calculateZStatistic(params) {
23437
23438
  function calculateDifferenceCI(p1, p2, total1, total2, confidence) {
23438
23439
  const difference = p1 - p2;
23439
23440
  const seDiff = Math.sqrt(p1 * (1 - p1) / (total1 || 1) + p2 * (1 - p2) / (total2 || 1));
23440
- const z103 = getZScore(confidence);
23441
+ const z104 = getZScore(confidence);
23441
23442
  return {
23442
- lower: difference - z103 * seDiff,
23443
- upper: difference + z103 * seDiff,
23443
+ lower: difference - z104 * seDiff,
23444
+ upper: difference + z104 * seDiff,
23444
23445
  estimate: difference,
23445
23446
  confidence,
23446
23447
  n: total1 + total2,
@@ -23463,11 +23464,11 @@ function proportionConfidenceInterval(successes, total, options = {}) {
23463
23464
  standardError: 0
23464
23465
  };
23465
23466
  }
23466
- const z103 = getZScore(opts.confidence);
23467
- const z210 = z103 * z103;
23467
+ const z104 = getZScore(opts.confidence);
23468
+ const z210 = z104 * z104;
23468
23469
  const denominator = 1 + z210 / n;
23469
23470
  const center = (p + z210 / (2 * n)) / denominator;
23470
- const margin = z103 / denominator * Math.sqrt(p * (1 - p) / n + z210 / (4 * n * n));
23471
+ const margin = z104 / denominator * Math.sqrt(p * (1 - p) / n + z210 / (4 * n * n));
23471
23472
  const lower = Math.max(0, center - margin);
23472
23473
  const upper = Math.min(1, center + margin);
23473
23474
  const standardError = Math.sqrt(p * (1 - p) / n);
@@ -23497,8 +23498,8 @@ function meanConfidenceInterval(values, options = {}) {
23497
23498
  const variance = values.reduce((sum, v) => sum + (v - mean) ** 2, 0) / (n - 1 || 1);
23498
23499
  const stdDev = Math.sqrt(variance);
23499
23500
  const standardError = stdDev / Math.sqrt(n);
23500
- const z103 = getZScore(opts.confidence);
23501
- const margin = z103 * standardError;
23501
+ const z104 = getZScore(opts.confidence);
23502
+ const margin = z104 * standardError;
23502
23503
  return {
23503
23504
  lower: mean - margin,
23504
23505
  upper: mean + margin,
@@ -27030,31 +27031,31 @@ var GraphBuilder = class {
27030
27031
  }
27031
27032
  const visited = /* @__PURE__ */ new Set();
27032
27033
  const stack = /* @__PURE__ */ new Set();
27033
- const path21 = [];
27034
+ const path20 = [];
27034
27035
  for (const nodeId of this.nodes.keys()) {
27035
- const cycle = this.dfs(nodeId, adj, visited, stack, path21);
27036
+ const cycle = this.dfs(nodeId, adj, visited, stack, path20);
27036
27037
  if (cycle !== void 0) return cycle;
27037
27038
  }
27038
27039
  return void 0;
27039
27040
  }
27040
- dfs(nodeId, adj, visited, stack, path21) {
27041
+ dfs(nodeId, adj, visited, stack, path20) {
27041
27042
  if (stack.has(nodeId)) {
27042
- const cycleStart = path21.indexOf(nodeId);
27043
- const cyclePath = path21.slice(cycleStart);
27043
+ const cycleStart = path20.indexOf(nodeId);
27044
+ const cyclePath = path20.slice(cycleStart);
27044
27045
  cyclePath.push(nodeId);
27045
27046
  return { type: "cycle_detected", path: cyclePath };
27046
27047
  }
27047
27048
  if (visited.has(nodeId)) return void 0;
27048
27049
  visited.add(nodeId);
27049
27050
  stack.add(nodeId);
27050
- path21.push(nodeId);
27051
+ path20.push(nodeId);
27051
27052
  const neighbors = adj.get(nodeId) ?? [];
27052
27053
  for (const neighbor of neighbors) {
27053
- const cycle = this.dfs(neighbor, adj, visited, stack, path21);
27054
+ const cycle = this.dfs(neighbor, adj, visited, stack, path20);
27054
27055
  if (cycle !== void 0) return cycle;
27055
27056
  }
27056
27057
  stack.delete(nodeId);
27057
- path21.pop();
27058
+ path20.pop();
27058
27059
  return void 0;
27059
27060
  }
27060
27061
  checkReachability() {
@@ -27594,13 +27595,13 @@ function emitPipelineStageEvent(prefix, stage, status, details) {
27594
27595
 
27595
27596
  // src/pipeline/trace-writer.ts
27596
27597
  import { mkdir, writeFile, rename, unlink } from "fs/promises";
27597
- import { join as join6 } from "path";
27598
+ import { join as join5 } from "path";
27598
27599
  var logger18 = createLogger({ component: "TraceWriter" });
27599
27600
  var MAX_BUFFER_SIZE = 5e4;
27600
27601
  var TraceWriter = class {
27601
27602
  constructor(bus, options) {
27602
27603
  this.options = options;
27603
- this.runDir = join6(options.runsDir, options.runId);
27604
+ this.runDir = join5(options.runsDir, options.runId);
27604
27605
  this.maxBuffer = options.maxBufferSize ?? MAX_BUFFER_SIZE;
27605
27606
  this.unsubscribe = bus.subscribe({}, (event) => {
27606
27607
  if (!this.stopped) {
@@ -27621,7 +27622,7 @@ var TraceWriter = class {
27621
27622
  if (this.buffer.length === 0) return;
27622
27623
  await mkdir(this.runDir, { recursive: true });
27623
27624
  const lines = this.buffer.map((e) => JSON.stringify(e)).join("\n");
27624
- const tracePath = join6(this.runDir, "trace.jsonl");
27625
+ const tracePath = join5(this.runDir, "trace.jsonl");
27625
27626
  const traceTmp = `${tracePath}.tmp.${String(process.pid)}`;
27626
27627
  try {
27627
27628
  await writeFile(traceTmp, lines + "\n", "utf-8");
@@ -27634,7 +27635,7 @@ var TraceWriter = class {
27634
27635
  throw err2;
27635
27636
  }
27636
27637
  const indexContent = this.buildIndex();
27637
- const indexPath = join6(this.runDir, "index.md");
27638
+ const indexPath = join5(this.runDir, "index.md");
27638
27639
  const indexTmp = `${indexPath}.tmp.${String(process.pid)}`;
27639
27640
  try {
27640
27641
  await writeFile(indexTmp, indexContent, "utf-8");
@@ -27722,8 +27723,8 @@ function extractModelAttribution(event) {
27722
27723
  };
27723
27724
  }
27724
27725
  function extractRoutingAttribution(event) {
27725
- const path21 = event.decisionPath !== void 0 ? [...event.decisionPath] : void 0;
27726
- return { modelId: event.selectedModel, reasoning: event.reasoning, decisionPath: path21 };
27726
+ const path20 = event.decisionPath !== void 0 ? [...event.decisionPath] : void 0;
27727
+ return { modelId: event.selectedModel, reasoning: event.reasoning, decisionPath: path20 };
27727
27728
  }
27728
27729
  function extractPipelineAttribution(event) {
27729
27730
  if (event.type === "pipeline.completed") {
@@ -29284,10 +29285,8 @@ function createSicaOrchestratorAdapter(sicaAgent, _logger) {
29284
29285
 
29285
29286
  // src/mcp/tools/research-auto-catalog.ts
29286
29287
  import * as fs4 from "fs";
29287
- import * as path4 from "path";
29288
- import * as os2 from "os";
29289
29288
  import { z as z51 } from "zod";
29290
- var CATALOG_DIR = path4.join(".nexus-agents", "research");
29289
+ var CATALOG_SUBDIR = "research";
29291
29290
  var CATALOG_FILE = "pending-catalog.json";
29292
29291
  var FILE_MODE = 384;
29293
29292
  var DIR_MODE2 = 448;
@@ -29305,7 +29304,7 @@ var PersistedCatalogSchema = z51.object({
29305
29304
  savedAt: z51.string()
29306
29305
  });
29307
29306
  function getCatalogPath() {
29308
- return path4.join(os2.homedir(), CATALOG_DIR, CATALOG_FILE);
29307
+ return nexusDataPath(CATALOG_SUBDIR, CATALOG_FILE);
29309
29308
  }
29310
29309
  function loadPersistedCatalog(logger56) {
29311
29310
  const filePath = getCatalogPath();
@@ -29330,7 +29329,7 @@ function loadPersistedCatalog(logger56) {
29330
29329
  }
29331
29330
  }
29332
29331
  function savePersistedCatalog(references, logger56) {
29333
- const dirPath = path4.join(os2.homedir(), CATALOG_DIR);
29332
+ const dirPath = nexusDataPath(CATALOG_SUBDIR);
29334
29333
  const filePath = getCatalogPath();
29335
29334
  const tempPath = `${filePath}.tmp.${String(process.pid)}`;
29336
29335
  try {
@@ -31931,8 +31930,8 @@ function isReflectiveShadowMode() {
31931
31930
  }
31932
31931
 
31933
31932
  // src/mcp/tools/orchestrate-reflection.ts
31934
- import * as os3 from "os";
31935
- import * as path5 from "path";
31933
+ import * as os from "os";
31934
+ import * as path4 from "path";
31936
31935
  var logger28 = createLogger({ component: "orchestrate-reflection" });
31937
31936
  var REFLECTION_MAX_TOKENS2 = 1e3;
31938
31937
  var REFLECTION_WRITE_CONFIDENCE_THRESHOLD = 0.6;
@@ -32023,7 +32022,7 @@ function writeLearningsToSession(learnings, taskDescription) {
32023
32022
  }
32024
32023
  if (eligible.length === 0) return 0;
32025
32024
  try {
32026
- const memoryDir = path5.join(os3.homedir(), ".nexus-agents", "memory", "sessions");
32025
+ const memoryDir = path4.join(os.homedir(), ".nexus-agents", "memory", "sessions");
32027
32026
  const memory = createSessionMemory(memoryDir);
32028
32027
  const sessionId = `reflection-${String(Date.now())}`;
32029
32028
  const startResult = memory.startSession(sessionId);
@@ -32471,8 +32470,8 @@ function hashObjective(userObjective) {
32471
32470
 
32472
32471
  // src/context/structured-task-state.ts
32473
32472
  import * as fs5 from "fs";
32474
- import * as path6 from "path";
32475
- import * as os4 from "os";
32473
+ import * as path5 from "path";
32474
+ import * as os2 from "os";
32476
32475
 
32477
32476
  // src/context/structured-task-state-types.ts
32478
32477
  import { z as z55 } from "zod";
@@ -32595,15 +32594,15 @@ var StructuredTaskLogEntrySchema = z55.discriminatedUnion("event", [
32595
32594
 
32596
32595
  // src/context/structured-task-state.ts
32597
32596
  var logger29 = createLogger({ component: "structured-task-state" });
32598
- var TASKS_DIR = path6.join(".nexus-agents", "tasks");
32597
+ var TASKS_DIR = path5.join(".nexus-agents", "tasks");
32599
32598
  var FILE_MODE2 = 384;
32600
32599
  var DIR_MODE3 = 448;
32601
32600
  function getTasksDir(customDir) {
32602
- if (customDir !== void 0) return path6.resolve(customDir);
32603
- return path6.join(os4.homedir(), TASKS_DIR);
32601
+ if (customDir !== void 0) return path5.resolve(customDir);
32602
+ return path5.join(os2.homedir(), TASKS_DIR);
32604
32603
  }
32605
32604
  function getLogPath(taskId, customDir) {
32606
- return path6.join(getTasksDir(customDir), `state-${taskId}.jsonl`);
32605
+ return path5.join(getTasksDir(customDir), `state-${taskId}.jsonl`);
32607
32606
  }
32608
32607
  function validateTaskId(taskId) {
32609
32608
  if (taskId.includes("..") || taskId.includes("/") || taskId.includes("\\")) {
@@ -36384,18 +36383,18 @@ function parseArxivEntries(xml, source, topic = "") {
36384
36383
 
36385
36384
  // src/cli/research-helpers-sources-io.ts
36386
36385
  import * as fs6 from "fs/promises";
36387
- import * as path7 from "path";
36386
+ import * as path6 from "path";
36388
36387
  import { parse as parseYaml2, stringify as stringifyYaml } from "yaml";
36389
36388
  var SOURCES_FILE = "sources.yaml";
36390
36389
  function validatePath3(constructedPath, allowedRoot) {
36391
36390
  const resolved = resolveInsideRoot(constructedPath, allowedRoot);
36392
36391
  if (resolved === null) {
36393
- const root = path7.resolve(allowedRoot);
36392
+ const root = path6.resolve(allowedRoot);
36394
36393
  return {
36395
36394
  ok: false,
36396
36395
  error: {
36397
36396
  code: "PATH_TRAVERSAL",
36398
- message: `Path ${path7.resolve(constructedPath)} is outside ${root}`
36397
+ message: `Path ${path6.resolve(constructedPath)} is outside ${root}`
36399
36398
  }
36400
36399
  };
36401
36400
  }
@@ -36403,7 +36402,7 @@ function validatePath3(constructedPath, allowedRoot) {
36403
36402
  }
36404
36403
  async function loadSourcesRegistry(rootDir) {
36405
36404
  const root = rootDir ?? getProjectRoot();
36406
- const filePath = path7.join(root, REGISTRY_PATH, SOURCES_FILE);
36405
+ const filePath = path6.join(root, REGISTRY_PATH, SOURCES_FILE);
36407
36406
  const pathResult = validatePath3(filePath, root);
36408
36407
  if (!pathResult.ok) return pathResult;
36409
36408
  try {
@@ -36429,7 +36428,7 @@ async function loadSourcesRegistry(rootDir) {
36429
36428
  }
36430
36429
  async function saveSourcesRegistry(registry, rootDir) {
36431
36430
  const root = rootDir ?? getProjectRoot();
36432
- const filePath = path7.join(root, REGISTRY_PATH, SOURCES_FILE);
36431
+ const filePath = path6.join(root, REGISTRY_PATH, SOURCES_FILE);
36433
36432
  const pathResult = validatePath3(filePath, root);
36434
36433
  if (!pathResult.ok) return pathResult;
36435
36434
  try {
@@ -36736,12 +36735,12 @@ function rankDiscoveredItems(items, topic) {
36736
36735
 
36737
36736
  // src/cli/research-helpers-index-ops.ts
36738
36737
  import * as fs7 from "fs/promises";
36739
- import * as path8 from "path";
36738
+ import * as path7 from "path";
36740
36739
  function getRegistryPath() {
36741
- return path8.resolve(process.cwd(), "docs/research/registry");
36740
+ return path7.resolve(process.cwd(), "docs/research/registry");
36742
36741
  }
36743
36742
  function getIndexPath() {
36744
- return path8.resolve(process.cwd(), "docs/research/RESEARCH_INDEX.md");
36743
+ return path7.resolve(process.cwd(), "docs/research/RESEARCH_INDEX.md");
36745
36744
  }
36746
36745
  async function handleStatsCommand(options) {
36747
36746
  const registryPath = getRegistryPath();
@@ -36771,7 +36770,7 @@ async function handleRefreshCommand(options) {
36771
36770
  if (!mdResult.ok) {
36772
36771
  return `Error: Failed to generate markdown: ${mdResult.error.message}`;
36773
36772
  }
36774
- await fs7.mkdir(path8.dirname(outputPath), { recursive: true });
36773
+ await fs7.mkdir(path7.dirname(outputPath), { recursive: true });
36775
36774
  await fs7.writeFile(outputPath, mdResult.value, "utf-8");
36776
36775
  const stats = index.stats;
36777
36776
  return [
@@ -38711,12 +38710,12 @@ function extractFileReferences(markdown) {
38711
38710
  let match;
38712
38711
  FILE_REF_PATTERN.lastIndex = 0;
38713
38712
  while ((match = FILE_REF_PATTERN.exec(markdown)) !== null) {
38714
- const path21 = match[1];
38715
- if (path21 === void 0 || seen.has(path21)) continue;
38716
- seen.add(path21);
38713
+ const path20 = match[1];
38714
+ if (path20 === void 0 || seen.has(path20)) continue;
38715
+ seen.add(path20);
38717
38716
  const lineStr = match[2];
38718
38717
  const line = lineStr !== void 0 ? parseInt(lineStr, 10) : void 0;
38719
- refs.push(line !== void 0 ? { path: path21, line } : { path: path21 });
38718
+ refs.push(line !== void 0 ? { path: path20, line } : { path: path20 });
38720
38719
  }
38721
38720
  return refs;
38722
38721
  }
@@ -40000,7 +39999,7 @@ function registerExtractSymbolsTool(server, deps) {
40000
39999
 
40001
40000
  // src/mcp/tools/query-trace-tool.ts
40002
40001
  import { readFile as readFile5, stat as stat3 } from "fs/promises";
40003
- import { join as join11, resolve as resolve11, sep as sep3 } from "path";
40002
+ import { join as join9, resolve as resolve11, sep as sep3 } from "path";
40004
40003
  import { z as z84 } from "zod";
40005
40004
  var QueryTraceInputSchema = z84.object({
40006
40005
  runId: z84.string().min(1).max(128).regex(/^[a-zA-Z0-9_-]+$/, "runId must be alphanumeric, hyphens, or underscores").describe("Run ID to query traces for"),
@@ -40041,7 +40040,7 @@ var EMPTY_RESPONSE = {
40041
40040
  };
40042
40041
  async function queryTraceFromDisk(input, runsDir) {
40043
40042
  const dir = runsDir ?? DEFAULT_RUNS_DIR;
40044
- const tracePath = join11(dir, input.runId, "trace.jsonl");
40043
+ const tracePath = join9(dir, input.runId, "trace.jsonl");
40045
40044
  const resolvedDir = resolve11(dir);
40046
40045
  const resolvedTrace = resolve11(tracePath);
40047
40046
  if (!resolvedTrace.startsWith(resolvedDir + sep3) && resolvedTrace !== resolvedDir) {
@@ -40351,11 +40350,11 @@ var InMemoryAuditStorage = class {
40351
40350
 
40352
40351
  // src/audit/audit-storage.ts
40353
40352
  import * as fs9 from "fs";
40354
- import * as path9 from "path";
40353
+ import * as path8 from "path";
40355
40354
  function validateLogDir(logDir, allowedRoot) {
40356
- const resolvedRoot = path9.resolve(allowedRoot);
40357
- const resolvedLogDir = path9.resolve(allowedRoot, logDir);
40358
- if (!resolvedLogDir.startsWith(resolvedRoot + path9.sep) && resolvedLogDir !== resolvedRoot) {
40355
+ const resolvedRoot = path8.resolve(allowedRoot);
40356
+ const resolvedLogDir = path8.resolve(allowedRoot, logDir);
40357
+ if (!resolvedLogDir.startsWith(resolvedRoot + path8.sep) && resolvedLogDir !== resolvedRoot) {
40359
40358
  return {
40360
40359
  ok: false,
40361
40360
  error: new SecurityError("Path traversal detected: logDir escapes allowed root directory", {
@@ -40378,10 +40377,10 @@ function validateLogDirBasic(logDir) {
40378
40377
  };
40379
40378
  }
40380
40379
  }
40381
- const resolved = path9.resolve(logDir);
40380
+ const resolved = path8.resolve(logDir);
40382
40381
  const systemDirs = ["/etc", "/var", "/usr", "/bin", "/sbin", "/root", "/proc", "/sys"];
40383
40382
  for (const sysDir of systemDirs) {
40384
- if (resolved === sysDir || resolved.startsWith(sysDir + path9.sep)) {
40383
+ if (resolved === sysDir || resolved.startsWith(sysDir + path8.sep)) {
40385
40384
  return {
40386
40385
  ok: false,
40387
40386
  error: new SecurityError("logDir cannot be a system directory", {
@@ -40470,7 +40469,7 @@ var FileAuditStorage = class _FileAuditStorage {
40470
40469
  const existingFiles = this.getExistingLogFiles();
40471
40470
  const latestFileName = existingFiles[0];
40472
40471
  if (existingFiles.length > 0 && latestFileName !== void 0) {
40473
- const latestFile = path9.join(this.logDir, latestFileName);
40472
+ const latestFile = path8.join(this.logDir, latestFileName);
40474
40473
  const stats = fs9.statSync(latestFile);
40475
40474
  if (stats.size < this.maxFileSizeBytes) {
40476
40475
  this.currentFile = latestFile;
@@ -40493,7 +40492,7 @@ var FileAuditStorage = class _FileAuditStorage {
40493
40492
  this.writeStream.end();
40494
40493
  this.writeStream = null;
40495
40494
  }
40496
- this.currentFile = path9.join(this.logDir, this.generateFileName());
40495
+ this.currentFile = path8.join(this.logDir, this.generateFileName());
40497
40496
  this.currentFileSize = 0;
40498
40497
  this.openWriteStream();
40499
40498
  this.logger.debug("Rotated audit log file", { file: this.currentFile });
@@ -40504,7 +40503,7 @@ var FileAuditStorage = class _FileAuditStorage {
40504
40503
  if (files.length > this.maxFiles) {
40505
40504
  const filesToDelete = files.slice(this.maxFiles);
40506
40505
  for (const file of filesToDelete) {
40507
- const filePath = path9.join(this.logDir, file);
40506
+ const filePath = path8.join(this.logDir, file);
40508
40507
  fs9.unlinkSync(filePath);
40509
40508
  this.logger.info("Pruned old audit log", { file });
40510
40509
  }
@@ -40558,7 +40557,7 @@ var FileAuditStorage = class _FileAuditStorage {
40558
40557
  let skipped = 0;
40559
40558
  for (const file of files) {
40560
40559
  if (results.length >= limit) break;
40561
- const filePath = path9.join(this.logDir, file);
40560
+ const filePath = path8.join(this.logDir, file);
40562
40561
  const events = await readAuditFile({
40563
40562
  filePath,
40564
40563
  criteria,
@@ -41529,7 +41528,7 @@ function resolveConfidence(rule) {
41529
41528
  }
41530
41529
 
41531
41530
  // src/mcp/tools/security-scan.ts
41532
- import * as path10 from "path";
41531
+ import * as path9 from "path";
41533
41532
  var logger33 = createLogger({ component: "security-scan" });
41534
41533
  var SCAN_TIMEOUT_MS = 3e5;
41535
41534
  async function isSemgrepAvailable() {
@@ -41556,9 +41555,9 @@ async function runSemgrep(targetDir, rulesets) {
41556
41555
  return stdout;
41557
41556
  }
41558
41557
  function validateTargetPath(target) {
41559
- const root = path10.resolve(process.cwd());
41560
- const resolved = path10.resolve(root, target);
41561
- if (resolved !== root && !resolved.startsWith(root + path10.sep)) {
41558
+ const root = path9.resolve(process.cwd());
41559
+ const resolved = path9.resolve(root, target);
41560
+ if (resolved !== root && !resolved.startsWith(root + path9.sep)) {
41562
41561
  throw new Error(
41563
41562
  `Invalid target path: must resolve inside ${root} (got ${resolved})`
41564
41563
  );
@@ -41987,8 +41986,8 @@ async function runOsvCheck(targetDir, enabled) {
41987
41986
  if (!enabled) return [];
41988
41987
  try {
41989
41988
  const fs20 = await import("fs");
41990
- const path21 = await import("path");
41991
- const pkgPath = path21.join(targetDir, "package.json");
41989
+ const path20 = await import("path");
41990
+ const pkgPath = path20.join(targetDir, "package.json");
41992
41991
  if (!fs20.existsSync(pkgPath)) return [];
41993
41992
  const pkg = JSON.parse(fs20.readFileSync(pkgPath, "utf-8"));
41994
41993
  const deps = Object.entries(pkg.dependencies ?? {}).slice(0, 20).map(([name, version]) => ({
@@ -42099,11 +42098,10 @@ async function persistMobiMemState() {
42099
42098
  try {
42100
42099
  const { isPersistenceEnabled } = await import("./learning-persistence-WMWZJZ35.js");
42101
42100
  if (!isPersistenceEnabled()) return;
42102
- const os6 = await import("os");
42103
- const path21 = await import("path");
42101
+ const { nexusDataPath: nexusDataPath2 } = await import("./nexus-data-dir-M6DYKIHJ.js");
42104
42102
  const { createMobiMem } = await import("./mobimem-QDBP37H7.js");
42105
42103
  const mobimem = createMobiMem();
42106
- const savePath = path21.join(os6.homedir(), ".nexus-agents", "memory", "mobimem-state.json");
42104
+ const savePath = nexusDataPath2("memory", "mobimem-state.json");
42107
42105
  await mobimem.save(savePath);
42108
42106
  } catch {
42109
42107
  }
@@ -42257,7 +42255,7 @@ ${contextBlock}`;
42257
42255
  const strategy = config.votingStrategy ?? "higher_order";
42258
42256
  await postProgress(config, "Vote", `Running consensus with ${strategy} strategy...`);
42259
42257
  try {
42260
- const { executeVoting } = await import("./consensus-vote-HDM6HA5Z.js");
42258
+ const { executeVoting } = await import("./consensus-vote-PRLGGUNY.js");
42261
42259
  const votingResult = await executeVoting(
42262
42260
  {
42263
42261
  proposal: plan.slice(0, 4e3),
@@ -42417,7 +42415,7 @@ function extractIssues(text) {
42417
42415
 
42418
42416
  // src/pipeline/pipeline-checkpoint.ts
42419
42417
  import * as fs10 from "fs";
42420
- import * as path11 from "path";
42418
+ import * as path10 from "path";
42421
42419
  var logger38 = createLogger({ component: "pipeline-checkpoint" });
42422
42420
  var SESSION_ID_REGEX = /^[a-zA-Z0-9_-]{1,128}$/;
42423
42421
  function validateSessionId(sessionId) {
@@ -42429,7 +42427,7 @@ function getCheckpointPath(sessionId, customDir) {
42429
42427
  logger38.warn("Checkpoint directory unavailable", { error: dirResult.error.message });
42430
42428
  return null;
42431
42429
  }
42432
- return path11.join(dirResult.value, `pipeline-${sessionId}.jsonl`);
42430
+ return path10.join(dirResult.value, `pipeline-${sessionId}.jsonl`);
42433
42431
  }
42434
42432
  function saveStageCheckpoint(sessionId, stage, data, customDir) {
42435
42433
  if (!validateSessionId(sessionId)) {
@@ -42521,10 +42519,6 @@ function checkpointToResult(state) {
42521
42519
  return result;
42522
42520
  }
42523
42521
 
42524
- // src/pipeline/dev-pipeline.ts
42525
- import { homedir as homedir6 } from "os";
42526
- import { join as join14 } from "path";
42527
-
42528
42522
  // src/orchestration/qa-loop.ts
42529
42523
  var logger39 = createLogger({ component: "qa-loop" });
42530
42524
  var DEFAULT_MAX_QA_ITERATIONS = 3;
@@ -42611,7 +42605,7 @@ async function runDevPipelineInner(task, stages, options, sid, prior) {
42611
42605
  function createTraceWriter(sessionId) {
42612
42606
  if (sessionId === void 0) return null;
42613
42607
  try {
42614
- const tracesDir = join14(homedir6(), ".nexus-agents", "traces");
42608
+ const tracesDir = nexusDataPath("traces");
42615
42609
  return new TraceWriter(getPipelineEventBus(), {
42616
42610
  runsDir: tracesDir,
42617
42611
  runId: `pipeline-${sessionId}`
@@ -43106,11 +43100,11 @@ async function extractSymbolsForTask(task) {
43106
43100
  const fileRefs = task.match(/(?:src|lib|packages)\/[^\s,)]+\.ts/g);
43107
43101
  if (fileRefs === null || fileRefs.length === 0) return null;
43108
43102
  const { extractSymbols: extractSymbols2 } = await import("./symbol-extractor-UEBANFSN.js");
43109
- const path21 = await import("path");
43103
+ const path20 = await import("path");
43110
43104
  const summaries = [];
43111
43105
  for (const ref of fileRefs.slice(0, 3)) {
43112
43106
  try {
43113
- const resolved = path21.resolve(ref);
43107
+ const resolved = path20.resolve(ref);
43114
43108
  const result = await extractSymbols2(resolved);
43115
43109
  const exported = result.symbols.filter((s) => s.exported);
43116
43110
  if (exported.length > 0) {
@@ -43127,12 +43121,12 @@ async function extractSymbolsForTask(task) {
43127
43121
  async function retrieveAdaptiveMemory(task) {
43128
43122
  try {
43129
43123
  const { AdaptiveMemoryBackend } = await import("./adaptive-memory-TSZEJUJC.js");
43130
- const os6 = await import("os");
43131
- const path21 = await import("path");
43132
- const baseDir = path21.join(os6.homedir(), ".nexus-agents", "memory");
43124
+ const path20 = await import("path");
43125
+ const { nexusDataPath: nexusDataPath2 } = await import("./nexus-data-dir-M6DYKIHJ.js");
43126
+ const baseDir = nexusDataPath2("memory");
43133
43127
  const memory = new AdaptiveMemoryBackend({
43134
- dbPath: path21.join(baseDir, "adaptive.db"),
43135
- markdownDir: path21.join(baseDir, "adaptive-md")
43128
+ dbPath: path20.join(baseDir, "adaptive.db"),
43129
+ markdownDir: path20.join(baseDir, "adaptive-md")
43136
43130
  });
43137
43131
  const key = task.slice(0, 50).replace(/\s+/g, "-").toLowerCase();
43138
43132
  const result = await memory.retrieve(key);
@@ -43581,7 +43575,7 @@ function registerQueryTaskStateTool(server, deps) {
43581
43575
 
43582
43576
  // src/mcp/tools/verify-audit-chain-tool.ts
43583
43577
  import * as fs11 from "fs/promises";
43584
- import * as path12 from "path";
43578
+ import * as path11 from "path";
43585
43579
  import { z as z92 } from "zod";
43586
43580
  var VerifyAuditChainInputSchema = z92.object({
43587
43581
  logDir: z92.string().min(1).max(512).describe(
@@ -43593,7 +43587,7 @@ async function loadAuditEvents(dir, logger56) {
43593
43587
  const auditFiles = entries.filter((name) => name.startsWith("audit-") && name.endsWith(".jsonl")).sort();
43594
43588
  const events = [];
43595
43589
  for (const filename of auditFiles) {
43596
- const fullPath = path12.join(dir, filename);
43590
+ const fullPath = path11.join(dir, filename);
43597
43591
  let content;
43598
43592
  try {
43599
43593
  content = await fs11.readFile(fullPath, "utf-8");
@@ -43628,7 +43622,7 @@ async function handler2(args, ctx) {
43628
43622
  if (!parsed.success) {
43629
43623
  return toolError(`Validation error: ${formatZodError(parsed.error)}`);
43630
43624
  }
43631
- const resolvedDir = path12.resolve(parsed.data.logDir);
43625
+ const resolvedDir = path11.resolve(parsed.data.logDir);
43632
43626
  let dirStats;
43633
43627
  try {
43634
43628
  dirStats = await fs11.stat(resolvedDir);
@@ -43678,7 +43672,7 @@ function registerVerifyAuditChainTool(server, deps) {
43678
43672
  // src/mcp/tools/pipeline-tool.ts
43679
43673
  import { z as z93 } from "zod";
43680
43674
  import * as fs12 from "fs";
43681
- import * as path13 from "path";
43675
+ import * as path12 from "path";
43682
43676
  var PipelineInputSchema = z93.object({
43683
43677
  /** The task to execute. */
43684
43678
  task: z93.string().min(5).max(1e4).describe("Task description \u2014 pipeline template auto-selected based on content"),
@@ -43721,8 +43715,8 @@ function buildOutput2(result) {
43721
43715
  }
43722
43716
  function resolveTask(task, specFile) {
43723
43717
  if (specFile === void 0) return task;
43724
- const resolved = path13.resolve(specFile);
43725
- const cwdRoot = path13.resolve(".");
43718
+ const resolved = path12.resolve(specFile);
43719
+ const cwdRoot = path12.resolve(".");
43726
43720
  if (!resolved.startsWith(cwdRoot)) {
43727
43721
  throw new Error(`Path traversal denied: specFile must be within ${cwdRoot}`);
43728
43722
  }
@@ -43776,6 +43770,29 @@ function registerPipelineTool(server, _deps) {
43776
43770
  });
43777
43771
  }
43778
43772
 
43773
+ // src/mcp/tools/supply-chain-tradeoff-panel.ts
43774
+ import { z as z94 } from "zod";
43775
+ var DEFAULT_AXES = [
43776
+ "build_time_determinism",
43777
+ "supply_chain_risk",
43778
+ "update_cadence"
43779
+ ];
43780
+ var MAX_AXES = 6;
43781
+ var MAX_AXIS_NAME_LENGTH = 64;
43782
+ var MAX_PROPOSAL_LENGTH = 4e3;
43783
+ var MAX_CONTEXT_LENGTH = 4e3;
43784
+ var SupplyChainTradeoffPanelInputSchema = z94.object({
43785
+ proposal: z94.string().min(1).max(MAX_PROPOSAL_LENGTH).describe('The proposal under tradeoff review (e.g. "Should aegis-boot adopt cargo-nextest?")'),
43786
+ axes: z94.array(z94.string().min(1).max(MAX_AXIS_NAME_LENGTH)).min(1).max(MAX_AXES).optional().describe(
43787
+ `Tradeoff axes to evaluate. Default: ${DEFAULT_AXES.join(", ")}. Custom axes accepted; max ${String(MAX_AXES)}.`
43788
+ ),
43789
+ context: z94.string().max(MAX_CONTEXT_LENGTH).optional().describe(
43790
+ "Optional context: relevant repo state, dependency tree, vendor publishing patterns, etc."
43791
+ ),
43792
+ quickMode: z94.boolean().optional().default(false).describe("Use 3 voters (architect, security, scope_steward) instead of 7"),
43793
+ simulate: z94.boolean().optional().default(false).describe("Use simulated voters (testing only)")
43794
+ });
43795
+
43779
43796
  // src/mcp/tools/tool-annotations.ts
43780
43797
  var TOOL_ANNOTATIONS = {
43781
43798
  delegate_to_model: {
@@ -44194,7 +44211,8 @@ function registerTools(server, options) {
44194
44211
  "search_codebase",
44195
44212
  "run_dev_pipeline",
44196
44213
  "run_pipeline",
44197
- "pr_review"
44214
+ "pr_review",
44215
+ "supply_chain_tradeoff_panel"
44198
44216
  ],
44199
44217
  logger: logger56,
44200
44218
  rateLimiter
@@ -44322,40 +44340,40 @@ var RiskLevel = /* @__PURE__ */ ((RiskLevel2) => {
44322
44340
  })(RiskLevel || {});
44323
44341
 
44324
44342
  // src/mcp/safety/stpa-schemas.ts
44325
- import { z as z94 } from "zod";
44326
- var HazardCategorySchema = z94.enum(HazardCategory);
44327
- var HazardSeveritySchema = z94.enum(HazardSeverity);
44328
- var ConstraintPrioritySchema = z94.enum(ConstraintPriority);
44329
- var RiskLevelSchema = z94.enum(RiskLevel);
44330
- var TriggerPatternSchema = z94.object({
44331
- parameter: z94.string().min(1),
44332
- matchType: z94.enum(["contains", "regex", "equals", "startsWith", "endsWith"]),
44333
- pattern: z94.string(),
44334
- reason: z94.string()
44343
+ import { z as z95 } from "zod";
44344
+ var HazardCategorySchema = z95.enum(HazardCategory);
44345
+ var HazardSeveritySchema = z95.enum(HazardSeverity);
44346
+ var ConstraintPrioritySchema = z95.enum(ConstraintPriority);
44347
+ var RiskLevelSchema = z95.enum(RiskLevel);
44348
+ var TriggerPatternSchema = z95.object({
44349
+ parameter: z95.string().min(1),
44350
+ matchType: z95.enum(["contains", "regex", "equals", "startsWith", "endsWith"]),
44351
+ pattern: z95.string(),
44352
+ reason: z95.string()
44335
44353
  });
44336
- var HazardSchema = z94.object({
44337
- id: z94.string().min(1),
44338
- description: z94.string(),
44354
+ var HazardSchema = z95.object({
44355
+ id: z95.string().min(1),
44356
+ description: z95.string(),
44339
44357
  category: HazardCategorySchema,
44340
44358
  severity: HazardSeveritySchema,
44341
- likelihood: z94.enum(["almost_certain", "likely", "possible", "unlikely", "rare"]),
44342
- triggerConditions: z94.array(z94.string()),
44343
- consequences: z94.array(z94.string())
44359
+ likelihood: z95.enum(["almost_certain", "likely", "possible", "unlikely", "rare"]),
44360
+ triggerConditions: z95.array(z95.string()),
44361
+ consequences: z95.array(z95.string())
44344
44362
  });
44345
- var UnsafeControlActionSchema = z94.object({
44346
- id: z94.string().min(1),
44347
- toolName: z94.string().min(1),
44348
- type: z94.enum(["not_provided", "provided_causes_hazard", "wrong_timing", "wrong_duration"]),
44349
- description: z94.string(),
44350
- unsafeContext: z94.string(),
44351
- relatedHazards: z94.array(z94.string()),
44352
- triggerPatterns: z94.array(TriggerPatternSchema).optional()
44363
+ var UnsafeControlActionSchema = z95.object({
44364
+ id: z95.string().min(1),
44365
+ toolName: z95.string().min(1),
44366
+ type: z95.enum(["not_provided", "provided_causes_hazard", "wrong_timing", "wrong_duration"]),
44367
+ description: z95.string(),
44368
+ unsafeContext: z95.string(),
44369
+ relatedHazards: z95.array(z95.string()),
44370
+ triggerPatterns: z95.array(TriggerPatternSchema).optional()
44353
44371
  });
44354
- var SafetyConstraintSchema = z94.object({
44355
- id: z94.string().min(1),
44356
- description: z94.string(),
44357
- mitigates: z94.array(z94.string()),
44358
- enforcement: z94.enum([
44372
+ var SafetyConstraintSchema = z95.object({
44373
+ id: z95.string().min(1),
44374
+ description: z95.string(),
44375
+ mitigates: z95.array(z95.string()),
44376
+ enforcement: z95.enum([
44359
44377
  "prevent",
44360
44378
  "require_confirmation",
44361
44379
  "alert",
@@ -44363,54 +44381,54 @@ var SafetyConstraintSchema = z94.object({
44363
44381
  "rate_limit",
44364
44382
  "require_privilege"
44365
44383
  ]),
44366
- validationFunction: z94.string().optional(),
44384
+ validationFunction: z95.string().optional(),
44367
44385
  priority: ConstraintPrioritySchema
44368
44386
  });
44369
- var PropertySchemaSchema = z94.object({
44370
- type: z94.string(),
44371
- description: z94.string().optional(),
44372
- enum: z94.array(z94.unknown()).optional(),
44373
- pattern: z94.string().optional(),
44374
- minimum: z94.number().optional(),
44375
- maximum: z94.number().optional()
44387
+ var PropertySchemaSchema = z95.object({
44388
+ type: z95.string(),
44389
+ description: z95.string().optional(),
44390
+ enum: z95.array(z95.unknown()).optional(),
44391
+ pattern: z95.string().optional(),
44392
+ minimum: z95.number().optional(),
44393
+ maximum: z95.number().optional()
44376
44394
  });
44377
- var ToolInputSchemaSchema = z94.object({
44378
- type: z94.string(),
44379
- properties: z94.record(z94.string(), PropertySchemaSchema).optional(),
44380
- required: z94.array(z94.string()).optional(),
44381
- additionalProperties: z94.boolean().optional()
44395
+ var ToolInputSchemaSchema = z95.object({
44396
+ type: z95.string(),
44397
+ properties: z95.record(z95.string(), PropertySchemaSchema).optional(),
44398
+ required: z95.array(z95.string()).optional(),
44399
+ additionalProperties: z95.boolean().optional()
44382
44400
  });
44383
- var ToolDefinitionSchema = z94.object({
44384
- name: z94.string().min(1),
44385
- description: z94.string(),
44401
+ var ToolDefinitionSchema = z95.object({
44402
+ name: z95.string().min(1),
44403
+ description: z95.string(),
44386
44404
  inputSchema: ToolInputSchemaSchema
44387
44405
  });
44388
- var AnalysisConfigurationSchema = z94.object({
44389
- includeLowSeverity: z94.boolean().default(true),
44390
- generateAllConstraints: z94.boolean().default(true),
44391
- checkInteractions: z94.boolean().default(true),
44392
- maxHazardsPerTool: z94.number().int().min(1).max(100).default(50),
44393
- categories: z94.array(HazardCategorySchema).default([])
44406
+ var AnalysisConfigurationSchema = z95.object({
44407
+ includeLowSeverity: z95.boolean().default(true),
44408
+ generateAllConstraints: z95.boolean().default(true),
44409
+ checkInteractions: z95.boolean().default(true),
44410
+ maxHazardsPerTool: z95.number().int().min(1).max(100).default(50),
44411
+ categories: z95.array(HazardCategorySchema).default([])
44394
44412
  });
44395
- var ConstraintViolationSchema = z94.object({
44396
- constraintId: z94.string().min(1),
44397
- constraintDescription: z94.string(),
44413
+ var ConstraintViolationSchema = z95.object({
44414
+ constraintId: z95.string().min(1),
44415
+ constraintDescription: z95.string(),
44398
44416
  severity: HazardSeveritySchema,
44399
- details: z94.string(),
44400
- remediation: z94.string()
44417
+ details: z95.string(),
44418
+ remediation: z95.string()
44401
44419
  });
44402
- var ValidationWarningSchema = z94.object({
44403
- code: z94.string().min(1),
44404
- message: z94.string(),
44405
- affected: z94.string()
44420
+ var ValidationWarningSchema = z95.object({
44421
+ code: z95.string().min(1),
44422
+ message: z95.string(),
44423
+ affected: z95.string()
44406
44424
  });
44407
- var ValidationResultSchema = z94.object({
44408
- valid: z94.boolean(),
44409
- toolName: z94.string().min(1),
44410
- violations: z94.array(ConstraintViolationSchema),
44411
- passed: z94.array(z94.string()),
44412
- warnings: z94.array(ValidationWarningSchema),
44413
- validatedAt: z94.date()
44425
+ var ValidationResultSchema = z95.object({
44426
+ valid: z95.boolean(),
44427
+ toolName: z95.string().min(1),
44428
+ violations: z95.array(ConstraintViolationSchema),
44429
+ passed: z95.array(z95.string()),
44430
+ warnings: z95.array(ValidationWarningSchema),
44431
+ validatedAt: z95.date()
44414
44432
  });
44415
44433
 
44416
44434
  // src/mcp/safety/stpa-types.ts
@@ -45495,22 +45513,22 @@ var GeminiResponseParser = class {
45495
45513
  };
45496
45514
 
45497
45515
  // src/cli-adapters/task-analyzer.ts
45498
- import { z as z95 } from "zod";
45499
- var TaskProfileSchema = z95.object({
45516
+ import { z as z96 } from "zod";
45517
+ var TaskProfileSchema = z96.object({
45500
45518
  /** Estimated input tokens required */
45501
- contextRequired: z95.number().min(0),
45519
+ contextRequired: z96.number().min(0),
45502
45520
  /** Reasoning complexity on 0-10 scale */
45503
- reasoningComplexity: z95.number().min(0).max(10),
45521
+ reasoningComplexity: z96.number().min(0).max(10),
45504
45522
  /** Whether task involves code generation */
45505
- codeGeneration: z95.boolean(),
45523
+ codeGeneration: z96.boolean(),
45506
45524
  /** Whether task involves multimodal content (images, etc.) */
45507
- multimodal: z95.boolean(),
45525
+ multimodal: z96.boolean(),
45508
45526
  /** Whether task can be split into parallel subtasks */
45509
- parallelizable: z95.boolean(),
45527
+ parallelizable: z96.boolean(),
45510
45528
  /** Whether cost should be minimized */
45511
- budgetSensitive: z95.boolean(),
45529
+ budgetSensitive: z96.boolean(),
45512
45530
  /** Primary task type classification */
45513
- taskType: z95.enum([
45531
+ taskType: z96.enum([
45514
45532
  "architecture",
45515
45533
  "code_implementation",
45516
45534
  "code_review",
@@ -45524,53 +45542,53 @@ var TaskProfileSchema = z95.object({
45524
45542
  });
45525
45543
 
45526
45544
  // src/cli-adapters/router-types.ts
45527
- import { z as z96 } from "zod";
45528
- var RouterConfigSchema = z96.object({
45529
- minCapacityThreshold: z96.number().min(0).max(1).default(0.1),
45530
- preferCostEfficient: z96.boolean().default(false),
45531
- maxDecisionTimeMs: z96.number().min(1).max(1e3).default(100)
45545
+ import { z as z97 } from "zod";
45546
+ var RouterConfigSchema = z97.object({
45547
+ minCapacityThreshold: z97.number().min(0).max(1).default(0.1),
45548
+ preferCostEfficient: z97.boolean().default(false),
45549
+ maxDecisionTimeMs: z97.number().min(1).max(1e3).default(100)
45532
45550
  });
45533
45551
 
45534
45552
  // src/cli-adapters/agreement-cascade-types.ts
45535
- import { z as z97 } from "zod";
45536
- var AgreementCascadeConfigSchema = z97.object({
45537
- agreementThreshold: z97.number().min(0.5).max(1).default(0.7),
45538
- maxStages: z97.number().int().min(1).max(5).default(3),
45539
- modelTimeoutMs: z97.number().int().min(1e3).max(3e5).default(6e4)
45553
+ import { z as z98 } from "zod";
45554
+ var AgreementCascadeConfigSchema = z98.object({
45555
+ agreementThreshold: z98.number().min(0.5).max(1).default(0.7),
45556
+ maxStages: z98.number().int().min(1).max(5).default(3),
45557
+ modelTimeoutMs: z98.number().int().min(1e3).max(3e5).default(6e4)
45540
45558
  });
45541
45559
 
45542
45560
  // src/cli-adapters/agreement-cascade-router.ts
45543
45561
  var logger42 = createLogger({ component: "agreement-cascade-router" });
45544
45562
 
45545
45563
  // src/cli-adapters/daao-types.ts
45546
- import { z as z98 } from "zod";
45547
- var EncodedFeaturesSchema = z98.object({
45564
+ import { z as z99 } from "zod";
45565
+ var EncodedFeaturesSchema = z99.object({
45548
45566
  /** Lexical complexity score (vocabulary diversity, rare words) */
45549
- lexicalComplexity: z98.number().min(0).max(1),
45567
+ lexicalComplexity: z99.number().min(0).max(1),
45550
45568
  /** Syntactic complexity score (sentence structure, nesting) */
45551
- syntacticComplexity: z98.number().min(0).max(1),
45569
+ syntacticComplexity: z99.number().min(0).max(1),
45552
45570
  /** Semantic density score (concept density, abstraction level) */
45553
- semanticDensity: z98.number().min(0).max(1),
45571
+ semanticDensity: z99.number().min(0).max(1),
45554
45572
  /** Technical specificity (domain-specific terminology) */
45555
- technicalSpecificity: z98.number().min(0).max(1),
45573
+ technicalSpecificity: z99.number().min(0).max(1),
45556
45574
  /** Task scope (breadth of requirements) */
45557
- taskScope: z98.number().min(0).max(1),
45575
+ taskScope: z99.number().min(0).max(1),
45558
45576
  /** Constraint complexity (constraints, edge cases, requirements) */
45559
- constraintComplexity: z98.number().min(0).max(1),
45577
+ constraintComplexity: z99.number().min(0).max(1),
45560
45578
  /** Ambiguity level (inverse - higher means more clear/specific) */
45561
- clarity: z98.number().min(0).max(1),
45579
+ clarity: z99.number().min(0).max(1),
45562
45580
  /** Output complexity expectation */
45563
- outputComplexity: z98.number().min(0).max(1)
45581
+ outputComplexity: z99.number().min(0).max(1)
45564
45582
  });
45565
- var FeatureWeightsSchema = z98.object({
45566
- lexicalComplexity: z98.number().min(0).max(1),
45567
- syntacticComplexity: z98.number().min(0).max(1),
45568
- semanticDensity: z98.number().min(0).max(1),
45569
- technicalSpecificity: z98.number().min(0).max(1),
45570
- taskScope: z98.number().min(0).max(1),
45571
- constraintComplexity: z98.number().min(0).max(1),
45572
- clarity: z98.number().min(0).max(1),
45573
- outputComplexity: z98.number().min(0).max(1)
45583
+ var FeatureWeightsSchema = z99.object({
45584
+ lexicalComplexity: z99.number().min(0).max(1),
45585
+ syntacticComplexity: z99.number().min(0).max(1),
45586
+ semanticDensity: z99.number().min(0).max(1),
45587
+ technicalSpecificity: z99.number().min(0).max(1),
45588
+ taskScope: z99.number().min(0).max(1),
45589
+ constraintComplexity: z99.number().min(0).max(1),
45590
+ clarity: z99.number().min(0).max(1),
45591
+ outputComplexity: z99.number().min(0).max(1)
45574
45592
  });
45575
45593
  var DEFAULT_FEATURE_WEIGHTS = {
45576
45594
  lexicalComplexity: 0.1,
@@ -45592,50 +45610,50 @@ var DEFAULT_DAAO_TIER_TO_CLIS = {
45592
45610
  balanced: ["codex", "opencode", "gemini", "claude"],
45593
45611
  powerful: ["claude", "codex", "opencode", "gemini"]
45594
45612
  };
45595
- var DAAOConfigSchema = z98.object({
45613
+ var DAAOConfigSchema = z99.object({
45596
45614
  /** Difficulty thresholds for level classification */
45597
- thresholds: z98.object({
45598
- easyUpperBound: z98.number().min(0).max(1),
45599
- hardLowerBound: z98.number().min(0).max(1)
45615
+ thresholds: z99.object({
45616
+ easyUpperBound: z99.number().min(0).max(1),
45617
+ hardLowerBound: z99.number().min(0).max(1)
45600
45618
  }).default(DEFAULT_DAAO_THRESHOLDS),
45601
45619
  /** Feature weights for difficulty aggregation */
45602
45620
  weights: FeatureWeightsSchema.default(DEFAULT_FEATURE_WEIGHTS),
45603
45621
  /** Mapping from model tier to CLI preference order */
45604
- tierToClis: z98.record(
45605
- z98.enum(["fast", "balanced", "powerful"]),
45606
- z98.array(z98.enum(["claude", "gemini", "codex", "opencode"]))
45622
+ tierToClis: z99.record(
45623
+ z99.enum(["fast", "balanced", "powerful"]),
45624
+ z99.array(z99.enum(["claude", "gemini", "codex", "opencode"]))
45607
45625
  ).default(DEFAULT_DAAO_TIER_TO_CLIS),
45608
45626
  /** Enable adaptive calibration from outcomes */
45609
- enableCalibration: z98.boolean().default(true),
45627
+ enableCalibration: z99.boolean().default(true),
45610
45628
  /** Maximum outcomes to store for calibration */
45611
- maxCalibrationOutcomes: z98.number().int().positive().default(1e3),
45629
+ maxCalibrationOutcomes: z99.number().int().positive().default(1e3),
45612
45630
  /** Minimum outcomes before applying calibration adjustments */
45613
- minCalibrationOutcomes: z98.number().int().positive().default(50),
45631
+ minCalibrationOutcomes: z99.number().int().positive().default(50),
45614
45632
  /** Reconstruction error threshold for typical patterns */
45615
- typicalPatternThreshold: z98.number().min(0).max(1).default(0.3),
45633
+ typicalPatternThreshold: z99.number().min(0).max(1).default(0.3),
45616
45634
  /** Verbose logging */
45617
- verbose: z98.boolean().default(false)
45635
+ verbose: z99.boolean().default(false)
45618
45636
  });
45619
45637
 
45620
45638
  // src/cli-adapters/task-classifier.ts
45621
- import { z as z99 } from "zod";
45622
- var ClassificationPatternsSchema = z99.object({
45623
- code: z99.array(z99.string()).readonly(),
45624
- research: z99.array(z99.string()).readonly(),
45625
- documentation: z99.array(z99.string()).readonly(),
45626
- analysis: z99.array(z99.string()).readonly()
45639
+ import { z as z100 } from "zod";
45640
+ var ClassificationPatternsSchema = z100.object({
45641
+ code: z100.array(z100.string()).readonly(),
45642
+ research: z100.array(z100.string()).readonly(),
45643
+ documentation: z100.array(z100.string()).readonly(),
45644
+ analysis: z100.array(z100.string()).readonly()
45627
45645
  });
45628
45646
 
45629
45647
  // src/cli-adapters/response-cache-types.ts
45630
- import { z as z100 } from "zod";
45631
- var ResponseCacheConfigSchema = z100.object({
45632
- defaultTTL: z100.number().min(1e3).max(36e5).default(3e5),
45648
+ import { z as z101 } from "zod";
45649
+ var ResponseCacheConfigSchema = z101.object({
45650
+ defaultTTL: z101.number().min(1e3).max(36e5).default(3e5),
45633
45651
  // 5 minutes
45634
- maxEntries: z100.number().min(10).max(1e5).default(1e3),
45635
- maxMemoryMB: z100.number().min(1).max(1e3).default(50),
45636
- cleanupInterval: z100.number().min(1e3).max(6e5).default(6e4),
45652
+ maxEntries: z101.number().min(10).max(1e5).default(1e3),
45653
+ maxMemoryMB: z101.number().min(1).max(1e3).default(50),
45654
+ cleanupInterval: z101.number().min(1e3).max(6e5).default(6e4),
45637
45655
  // 1 minute
45638
- enableLogging: z100.boolean().default(false)
45656
+ enableLogging: z101.boolean().default(false)
45639
45657
  });
45640
45658
 
45641
45659
  // src/cli-adapters/response-cache-utils.ts
@@ -45643,12 +45661,12 @@ import { createHash as createHash4 } from "crypto";
45643
45661
  var logger43 = createLogger({ component: "ResponseCacheUtils" });
45644
45662
 
45645
45663
  // src/cli-adapters/unified-routing-types.ts
45646
- import { z as z101 } from "zod";
45647
- var UnifiedRoutingDecisionSchema = z101.object({
45648
- selectedCli: z101.string(),
45649
- confidence: z101.number().min(0).max(1),
45650
- reason: z101.string(),
45651
- strategy: z101.enum([
45664
+ import { z as z102 } from "zod";
45665
+ var UnifiedRoutingDecisionSchema = z102.object({
45666
+ selectedCli: z102.string(),
45667
+ confidence: z102.number().min(0).max(1),
45668
+ reason: z102.string(),
45669
+ strategy: z102.enum([
45652
45670
  "composite",
45653
45671
  "quality",
45654
45672
  "budget",
@@ -45660,57 +45678,57 @@ var UnifiedRoutingDecisionSchema = z101.object({
45660
45678
  "linucb",
45661
45679
  "direct"
45662
45680
  ]),
45663
- decisionTimeMs: z101.number().nonnegative(),
45664
- alternatives: z101.array(z101.string()).readonly(),
45665
- stagesExecuted: z101.array(z101.string()).readonly(),
45666
- withinBudget: z101.boolean().optional(),
45667
- estimatedComplexity: z101.enum(["simple", "moderate", "complex", "expert"]).optional(),
45668
- estimatedTokens: z101.number().int().positive().optional(),
45669
- topsisScore: z101.number().optional(),
45670
- ucbScore: z101.number().optional(),
45671
- resolvedAtStage: z101.number().int().nonnegative().optional(),
45672
- consensusReached: z101.boolean().optional(),
45673
- agreementScore: z101.number().min(0).max(1).optional(),
45674
- metadata: z101.record(z101.string(), z101.unknown()).optional()
45681
+ decisionTimeMs: z102.number().nonnegative(),
45682
+ alternatives: z102.array(z102.string()).readonly(),
45683
+ stagesExecuted: z102.array(z102.string()).readonly(),
45684
+ withinBudget: z102.boolean().optional(),
45685
+ estimatedComplexity: z102.enum(["simple", "moderate", "complex", "expert"]).optional(),
45686
+ estimatedTokens: z102.number().int().positive().optional(),
45687
+ topsisScore: z102.number().optional(),
45688
+ ucbScore: z102.number().optional(),
45689
+ resolvedAtStage: z102.number().int().nonnegative().optional(),
45690
+ consensusReached: z102.boolean().optional(),
45691
+ agreementScore: z102.number().min(0).max(1).optional(),
45692
+ metadata: z102.record(z102.string(), z102.unknown()).optional()
45675
45693
  });
45676
45694
 
45677
45695
  // src/learning/outcome-feedback-types.ts
45678
- import { z as z102 } from "zod";
45679
- var QualitySignalsSchema = z102.object({
45680
- testsPass: z102.boolean().optional(),
45681
- lintErrors: z102.number().int().min(0).optional(),
45682
- userApproved: z102.boolean().optional(),
45683
- retryCount: z102.number().int().min(0).default(0),
45684
- completionRatio: z102.number().min(0).max(1).default(1),
45685
- validStructure: z102.boolean().optional(),
45686
- coherenceScore: z102.number().min(0).max(1).optional()
45696
+ import { z as z103 } from "zod";
45697
+ var QualitySignalsSchema = z103.object({
45698
+ testsPass: z103.boolean().optional(),
45699
+ lintErrors: z103.number().int().min(0).optional(),
45700
+ userApproved: z103.boolean().optional(),
45701
+ retryCount: z103.number().int().min(0).default(0),
45702
+ completionRatio: z103.number().min(0).max(1).default(1),
45703
+ validStructure: z103.boolean().optional(),
45704
+ coherenceScore: z103.number().min(0).max(1).optional()
45687
45705
  });
45688
- var RoutingDecisionSchema = z102.object({
45689
- id: z102.uuid(),
45690
- timestamp: z102.iso.datetime(),
45691
- query: z102.string(),
45692
- routerType: z102.enum(["linucb", "preference", "quality", "cascade", "topsis"]),
45693
- selectedModel: z102.string(),
45694
- selectedTier: z102.enum(["strong", "weak"]).optional(),
45695
- armIndex: z102.number().int().min(0).optional(),
45696
- banditContext: z102.record(z102.string(), z102.unknown()).optional(),
45697
- queryFeatures: z102.record(z102.string(), z102.unknown()).optional(),
45698
- ucbScore: z102.number().optional(),
45699
- confidence: z102.number().min(0).max(1).optional(),
45700
- traceId: z102.string(),
45701
- domain: z102.string().optional()
45706
+ var RoutingDecisionSchema = z103.object({
45707
+ id: z103.uuid(),
45708
+ timestamp: z103.iso.datetime(),
45709
+ query: z103.string(),
45710
+ routerType: z103.enum(["linucb", "preference", "quality", "cascade", "topsis"]),
45711
+ selectedModel: z103.string(),
45712
+ selectedTier: z103.enum(["strong", "weak"]).optional(),
45713
+ armIndex: z103.number().int().min(0).optional(),
45714
+ banditContext: z103.record(z103.string(), z103.unknown()).optional(),
45715
+ queryFeatures: z103.record(z103.string(), z103.unknown()).optional(),
45716
+ ucbScore: z103.number().optional(),
45717
+ confidence: z103.number().min(0).max(1).optional(),
45718
+ traceId: z103.string(),
45719
+ domain: z103.string().optional()
45702
45720
  });
45703
- var TaskOutcomeSchema = z102.object({
45704
- routingDecisionId: z102.uuid(),
45705
- timestamp: z102.iso.datetime(),
45706
- outcomeClass: z102.enum(["success", "partial", "failure", "timeout", "error"]),
45707
- success: z102.boolean(),
45708
- qualityScore: z102.number().min(0).max(1),
45709
- durationMs: z102.number().min(0),
45710
- tokenUsage: z102.number().int().min(0),
45711
- errorMessage: z102.string().optional(),
45721
+ var TaskOutcomeSchema = z103.object({
45722
+ routingDecisionId: z103.uuid(),
45723
+ timestamp: z103.iso.datetime(),
45724
+ outcomeClass: z103.enum(["success", "partial", "failure", "timeout", "error"]),
45725
+ success: z103.boolean(),
45726
+ qualityScore: z103.number().min(0).max(1),
45727
+ durationMs: z103.number().min(0),
45728
+ tokenUsage: z103.number().int().min(0),
45729
+ errorMessage: z103.string().optional(),
45712
45730
  qualitySignals: QualitySignalsSchema,
45713
- traceId: z102.string()
45731
+ traceId: z103.string()
45714
45732
  });
45715
45733
  var DEFAULT_FEEDBACK_COLLECTOR_CONFIG = {
45716
45734
  maxPendingDecisions: 1e3,
@@ -45725,17 +45743,17 @@ var DEFAULT_FEEDBACK_COLLECTOR_CONFIG = {
45725
45743
  targetTokenUsage: 2e3,
45726
45744
  maxHistorySize: 1e4
45727
45745
  };
45728
- var FeedbackCollectorConfigSchema = z102.object({
45729
- maxPendingDecisions: z102.number().int().positive().default(1e3),
45730
- pendingTimeoutMs: z102.number().positive().default(3e5),
45731
- enableAutoReward: z102.boolean().default(true),
45732
- qualityWeight: z102.number().min(0).max(1).default(0.5),
45733
- speedWeight: z102.number().min(0).max(1).default(0.2),
45734
- efficiencyWeight: z102.number().min(0).max(1).default(0.2),
45735
- retryPenalty: z102.number().min(0).max(1).default(0.1),
45736
- targetDurationMs: z102.number().positive().default(5e3),
45737
- targetTokenUsage: z102.number().positive().default(2e3),
45738
- maxHistorySize: z102.number().int().positive().default(1e4)
45746
+ var FeedbackCollectorConfigSchema = z103.object({
45747
+ maxPendingDecisions: z103.number().int().positive().default(1e3),
45748
+ pendingTimeoutMs: z103.number().positive().default(3e5),
45749
+ enableAutoReward: z103.boolean().default(true),
45750
+ qualityWeight: z103.number().min(0).max(1).default(0.5),
45751
+ speedWeight: z103.number().min(0).max(1).default(0.2),
45752
+ efficiencyWeight: z103.number().min(0).max(1).default(0.2),
45753
+ retryPenalty: z103.number().min(0).max(1).default(0.1),
45754
+ targetDurationMs: z103.number().positive().default(5e3),
45755
+ targetTokenUsage: z103.number().positive().default(2e3),
45756
+ maxHistorySize: z103.number().int().positive().default(1e4)
45739
45757
  });
45740
45758
 
45741
45759
  // src/learning/outcome-feedback-helpers.ts
@@ -48129,13 +48147,13 @@ function createEmptyContext() {
48129
48147
  approachHistory: []
48130
48148
  };
48131
48149
  }
48132
- function assignRelevance(path21, response) {
48150
+ function assignRelevance(path20, response) {
48133
48151
  const lowerResponse = response.toLowerCase();
48134
- const lowerPath = path21.toLowerCase();
48152
+ const lowerPath = path20.toLowerCase();
48135
48153
  const idx = lowerResponse.indexOf(lowerPath);
48136
48154
  if (idx === -1) return "low";
48137
48155
  const surroundStart = Math.max(0, idx - 100);
48138
- const surroundEnd = Math.min(lowerResponse.length, idx + path21.length + 100);
48156
+ const surroundEnd = Math.min(lowerResponse.length, idx + path20.length + 100);
48139
48157
  const surrounding = lowerResponse.slice(surroundStart, surroundEnd);
48140
48158
  if (/(?:root cause|bug|fix|patch|change|modify|edit)/i.test(surrounding)) {
48141
48159
  return "high";
@@ -48279,9 +48297,9 @@ var SAFE_COMMIT_RE = /^[0-9a-f]{7,40}$/i;
48279
48297
  var SAFE_REPO_RE = /^[a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+$/;
48280
48298
  async function tryExistingClone(repoDir, commit, exec5) {
48281
48299
  const fs20 = await import("fs/promises");
48282
- const path21 = await import("path");
48300
+ const path20 = await import("path");
48283
48301
  try {
48284
- await fs20.access(path21.join(repoDir, ".git"));
48302
+ await fs20.access(path20.join(repoDir, ".git"));
48285
48303
  await exec5(`git checkout -- .`, { cwd: repoDir, timeout: GIT_TIMEOUT_MS });
48286
48304
  await exec5(`git clean -fd`, { cwd: repoDir, timeout: GIT_TIMEOUT_MS });
48287
48305
  try {
@@ -48300,7 +48318,7 @@ async function tryExistingClone(repoDir, commit, exec5) {
48300
48318
  }
48301
48319
  }
48302
48320
  async function cloneRepository(repo, commit, workDir) {
48303
- const path21 = await import("path");
48321
+ const path20 = await import("path");
48304
48322
  const fs20 = await import("fs/promises");
48305
48323
  const childProcess = await import("child_process");
48306
48324
  const { promisify: promisify9 } = await import("util");
@@ -48311,7 +48329,7 @@ async function cloneRepository(repo, commit, workDir) {
48311
48329
  if (!SAFE_COMMIT_RE.test(commit)) {
48312
48330
  return { ok: false, error: new AgentRunnerError(`Invalid commit hash: ${commit}`) };
48313
48331
  }
48314
- const repoDir = path21.join(workDir, repo.replaceAll("/", "__"));
48332
+ const repoDir = path20.join(workDir, repo.replaceAll("/", "__"));
48315
48333
  try {
48316
48334
  await fs20.mkdir(workDir, { recursive: true });
48317
48335
  const cloned = await tryExistingClone(repoDir, commit, exec5);
@@ -48330,8 +48348,8 @@ async function applyPatch(repoDir, patch) {
48330
48348
  const { promisify: promisify9 } = await import("util");
48331
48349
  const exec5 = promisify9(childProcess.exec);
48332
48350
  const fs20 = await import("fs/promises");
48333
- const path21 = await import("path");
48334
- const patchFile = path21.join(repoDir, ".agent_patch.diff");
48351
+ const path20 = await import("path");
48352
+ const patchFile = path20.join(repoDir, ".agent_patch.diff");
48335
48353
  try {
48336
48354
  await fs20.writeFile(patchFile, patch);
48337
48355
  await exec5(`git apply --whitespace=fix ${patchFile}`, {
@@ -49469,7 +49487,7 @@ function transformHarnessOutput(raw) {
49469
49487
  // src/swe-bench/harness-file-operations.ts
49470
49488
  import { spawn } from "child_process";
49471
49489
  import * as fs14 from "fs/promises";
49472
- import * as path14 from "path";
49490
+ import * as path13 from "path";
49473
49491
  var capitalizeFirst = capitalize;
49474
49492
  function buildHarnessArgs(config) {
49475
49493
  const args = [
@@ -49566,7 +49584,7 @@ function createInitialProgress(totalCount) {
49566
49584
  };
49567
49585
  }
49568
49586
  function getResultsFilePath(config) {
49569
- return path14.join(config.outputDir, config.runId, "results.json");
49587
+ return path13.join(config.outputDir, config.runId, "results.json");
49570
49588
  }
49571
49589
 
49572
49590
  // src/swe-bench/harness-process-runner.ts
@@ -50123,7 +50141,7 @@ function formatValidationResult(result) {
50123
50141
  }
50124
50142
 
50125
50143
  // src/swe-bench/evaluation-harness-helpers.ts
50126
- import * as os5 from "os";
50144
+ import * as os3 from "os";
50127
50145
  function calculateMetrics(results) {
50128
50146
  const totalInstances = results.length;
50129
50147
  const predictedInstances = totalInstances;
@@ -50215,12 +50233,12 @@ function createProgressAdapter(totalPredictions, onProgress) {
50215
50233
  }
50216
50234
  function getMemoryInfo() {
50217
50235
  return {
50218
- total: os5.totalmem(),
50219
- free: os5.freemem()
50236
+ total: os3.totalmem(),
50237
+ free: os3.freemem()
50220
50238
  };
50221
50239
  }
50222
50240
  function getCpuCores() {
50223
- return os5.cpus().length;
50241
+ return os3.cpus().length;
50224
50242
  }
50225
50243
 
50226
50244
  // src/swe-bench/evaluation-harness.ts
@@ -51304,11 +51322,11 @@ function parsePatch(patch) {
51304
51322
  import { execFile as execFile5 } from "child_process";
51305
51323
  import { promisify as promisify7 } from "util";
51306
51324
  import * as fs15 from "fs/promises";
51307
- import * as path15 from "path";
51325
+ import * as path14 from "path";
51308
51326
  var execFileAsync5 = promisify7(execFile5);
51309
51327
  var MAX_OUTPUT_BUFFER = 5 * 1024 * 1024;
51310
51328
  async function writeTempPatch(patch, workDir) {
51311
- const tempPath = path15.join(workDir, `.patch-${String(getTimeProvider().now())}.patch`);
51329
+ const tempPath = path14.join(workDir, `.patch-${String(getTimeProvider().now())}.patch`);
51312
51330
  await fs15.writeFile(tempPath, patch, "utf-8");
51313
51331
  return tempPath;
51314
51332
  }
@@ -51559,9 +51577,9 @@ var TestRunnerError = class extends Error {
51559
51577
 
51560
51578
  // src/swe-bench/test-runner-parser.ts
51561
51579
  import * as fs16 from "fs/promises";
51562
- import * as path16 from "path";
51580
+ import * as path15 from "path";
51563
51581
  async function readJsonResults(workDir) {
51564
- const jsonPath = path16.join(workDir, "test-results.json");
51582
+ const jsonPath = path15.join(workDir, "test-results.json");
51565
51583
  try {
51566
51584
  const content = await fs16.readFile(jsonPath, "utf-8");
51567
51585
  return JSON.parse(content);
@@ -51756,7 +51774,7 @@ ${getStderr()}`.trim();
51756
51774
  import { exec as exec3 } from "child_process";
51757
51775
  import { promisify as promisify8 } from "util";
51758
51776
  import * as fs17 from "fs/promises";
51759
- import * as path17 from "path";
51777
+ import * as path16 from "path";
51760
51778
  var execAsync3 = promisify8(exec3);
51761
51779
  var FRAMEWORK_CONFIG_FILES = {
51762
51780
  pytest: ["pytest.ini", "pyproject.toml", "setup.cfg", "conftest.py", "tox.ini"],
@@ -51862,7 +51880,7 @@ var TestRunner = class {
51862
51880
  async findConfigFiles(workDir, configFiles) {
51863
51881
  const found = [];
51864
51882
  for (const file of configFiles) {
51865
- const filePath = path17.join(workDir, file);
51883
+ const filePath = path16.join(workDir, file);
51866
51884
  try {
51867
51885
  await fs17.access(filePath);
51868
51886
  found.push(file);
@@ -52015,7 +52033,7 @@ async function detectTestFramework(workDir) {
52015
52033
 
52016
52034
  // src/swe-bench/report-generator.ts
52017
52035
  import * as fs18 from "fs/promises";
52018
- import * as path18 from "path";
52036
+ import * as path17 from "path";
52019
52037
 
52020
52038
  // src/swe-bench/report-renderer.ts
52021
52039
  function renderReport(report, format) {
@@ -52371,7 +52389,7 @@ var ReportGenerator = class {
52371
52389
  async save(report, config) {
52372
52390
  this.logger.info("Saving report", { outputPath: config.outputPath });
52373
52391
  const content = await this.render(report, config.format);
52374
- await fs18.mkdir(path18.dirname(config.outputPath), { recursive: true });
52392
+ await fs18.mkdir(path17.dirname(config.outputPath), { recursive: true });
52375
52393
  await fs18.writeFile(config.outputPath, content, "utf-8");
52376
52394
  this.logger.info("Report saved", { path: config.outputPath, format: config.format });
52377
52395
  }
@@ -52591,14 +52609,14 @@ async function exportReport(result, outputPath, config) {
52591
52609
 
52592
52610
  // src/swe-bench/trace-logger.ts
52593
52611
  import { appendFile, writeFile as writeFile6 } from "fs/promises";
52594
- import * as path19 from "path";
52612
+ import * as path18 from "path";
52595
52613
  function deriveTracePath(outputPath) {
52596
- const ext = path19.extname(outputPath);
52614
+ const ext = path18.extname(outputPath);
52597
52615
  const base = outputPath.slice(0, outputPath.length - ext.length);
52598
52616
  return `${base}-trace.jsonl`;
52599
52617
  }
52600
52618
  function deriveStatusPath(outputPath) {
52601
- const ext = path19.extname(outputPath);
52619
+ const ext = path18.extname(outputPath);
52602
52620
  const base = outputPath.slice(0, outputPath.length - ext.length);
52603
52621
  return `${base}-status.json`;
52604
52622
  }
@@ -52804,7 +52822,7 @@ function getStdinLifecycleMonitor() {
52804
52822
 
52805
52823
  // src/pipeline/task-tracker.ts
52806
52824
  import * as fs19 from "fs";
52807
- import * as path20 from "path";
52825
+ import * as path19 from "path";
52808
52826
  var logger55 = createLogger({ component: "task-tracker" });
52809
52827
  async function exec4(cmd, args, timeout = 15e3) {
52810
52828
  const { execFile: execFile6 } = await import("child_process");
@@ -52882,8 +52900,8 @@ var JsonTaskTracker = class {
52882
52900
  outputPath;
52883
52901
  constructor(config) {
52884
52902
  const dir = config.outputDir ?? ".nexus-pipeline";
52885
- this.outputPath = path20.resolve(dir, "tasks.json");
52886
- fs19.mkdirSync(path20.dirname(this.outputPath), { recursive: true });
52903
+ this.outputPath = path19.resolve(dir, "tasks.json");
52904
+ fs19.mkdirSync(path19.dirname(this.outputPath), { recursive: true });
52887
52905
  }
52888
52906
  async createTask(title, body) {
52889
52907
  const id = String(this.nextId++);
@@ -53643,4 +53661,4 @@ export {
53643
53661
  detectBackend,
53644
53662
  createTaskTracker
53645
53663
  };
53646
- //# sourceMappingURL=chunk-JLYJQ7OG.js.map
53664
+ //# sourceMappingURL=chunk-5JSMLCCK.js.map