nexus-agents 2.81.4 → 2.82.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/dist/{child-mcp-config-HVGU73XG.js → child-mcp-config-BMSYR7VV.js} +2 -2
  2. package/dist/{chunk-EGK4RZV5.js → chunk-2R5UUBGA.js} +2 -2
  3. package/dist/{chunk-WVSQGGAH.js → chunk-2SQXJQTA.js} +3 -3
  4. package/dist/{chunk-M6KXR4LO.js → chunk-4XNVJS5A.js} +511 -368
  5. package/dist/{chunk-M6KXR4LO.js.map → chunk-4XNVJS5A.js.map} +1 -1
  6. package/dist/{chunk-HFSSADUV.js → chunk-7VNVDFD5.js} +2 -12
  7. package/dist/{chunk-HFSSADUV.js.map → chunk-7VNVDFD5.js.map} +1 -1
  8. package/dist/{chunk-YW72ORKM.js → chunk-BL5IBHEY.js} +3 -3
  9. package/dist/{chunk-BZVYU4YD.js → chunk-C7P2HLJX.js} +4 -4
  10. package/dist/{chunk-R2VJY7Z4.js → chunk-FTT2IYYX.js} +123 -96
  11. package/dist/chunk-FTT2IYYX.js.map +1 -0
  12. package/dist/{chunk-ZAY5M2AN.js → chunk-G2DZBEMU.js} +2 -2
  13. package/dist/{chunk-6M44ZXB4.js → chunk-GNG7URCR.js} +2 -2
  14. package/dist/{chunk-ITMLH7TF.js → chunk-HJUHDPXJ.js} +3 -3
  15. package/dist/{chunk-2GW2FZXY.js → chunk-HMXQKDUV.js} +36 -24
  16. package/dist/chunk-HMXQKDUV.js.map +1 -0
  17. package/dist/{chunk-B3MCX46I.js → chunk-HVZ52LOL.js} +2 -2
  18. package/dist/{chunk-FAU7LVIG.js → chunk-JM3R267Z.js} +28 -15
  19. package/dist/chunk-JM3R267Z.js.map +1 -0
  20. package/dist/{chunk-AMFVUDWI.js → chunk-NTLJ3INA.js} +2 -2
  21. package/dist/{chunk-XZECNG2Q.js → chunk-OYDJ3C4N.js} +3 -3
  22. package/dist/{chunk-PPV23O3J.js → chunk-PZESEBD3.js} +2 -2
  23. package/dist/{chunk-5TM5VL23.js → chunk-QHL4KGNB.js} +2 -2
  24. package/dist/{chunk-F7N2T53R.js → chunk-S36LIUV2.js} +12 -23
  25. package/dist/chunk-S36LIUV2.js.map +1 -0
  26. package/dist/{chunk-M5ABED6T.js → chunk-SBZVRH4S.js} +2 -2
  27. package/dist/{chunk-2HBQ6XXA.js → chunk-SHWGK7X6.js} +9 -60
  28. package/dist/chunk-SHWGK7X6.js.map +1 -0
  29. package/dist/{chunk-M3KVQK54.js → chunk-SXL744NF.js} +2 -2
  30. package/dist/{chunk-S5HMID6I.js → chunk-TXIUCEFT.js} +4 -4
  31. package/dist/chunk-TXIUCEFT.js.map +1 -0
  32. package/dist/{chunk-JSQV2EOZ.js → chunk-U7JXQSEM.js} +3 -3
  33. package/dist/{chunk-RGKUBFTE.js → chunk-W2AIGD35.js} +2 -2
  34. package/dist/{chunk-7JLSKX3U.js → chunk-WUUEKFKG.js} +2 -2
  35. package/dist/{chunk-K7WUEKCD.js → chunk-X3JR3GMT.js} +3 -3
  36. package/dist/{chunk-ZBABWKEA.js → chunk-XGUDCUMB.js} +2 -2
  37. package/dist/{cli-circuit-breaker-NUZGOAVD.js → cli-circuit-breaker-BIJUQRQI.js} +4 -4
  38. package/dist/cli.js +126 -67
  39. package/dist/cli.js.map +1 -1
  40. package/dist/{composite-router-4CF3P5D4.js → composite-router-FB7P22L5.js} +2 -2
  41. package/dist/{consensus-vote-7PLEGFWZ.js → consensus-vote-KKAIFULI.js} +11 -11
  42. package/dist/{context-retriever-R5W4I4IB.js → context-retriever-4JCGMWH7.js} +5 -5
  43. package/dist/{doctor-deep-7JTGI33O.js → doctor-deep-7YK4BZIJ.js} +3 -3
  44. package/dist/expert-bridge-DJM5GAWZ.js +11 -0
  45. package/dist/{factory-DD2FPM3H.js → factory-DOWBGVAL.js} +5 -5
  46. package/dist/{factory-E2CKCYIK.js → factory-PK4EZL7K.js} +4 -4
  47. package/dist/index.d.ts +13 -1
  48. package/dist/index.js +24 -24
  49. package/dist/index.js.map +1 -1
  50. package/dist/{init-opencode-2BZWAACW.js → init-opencode-QP5CAMWN.js} +5 -5
  51. package/dist/{issue-triage-CRUJLWFY.js → issue-triage-T3SKNBH5.js} +4 -4
  52. package/dist/{registry-command-OHIJNUZJ.js → registry-command-TH7U6UMC.js} +2 -2
  53. package/dist/{repo-security-plan-I4FZP7QA.js → repo-security-plan-V257RYTW.js} +3 -3
  54. package/dist/{research-helpers-synthesize-NMYYERCP.js → research-helpers-synthesize-Y3O76PY4.js} +3 -3
  55. package/dist/{routing-memory-7DA6WNSA.js → routing-memory-AAH7NIHD.js} +2 -2
  56. package/dist/{session-memory-LV35VSBK.js → session-memory-MY6YS2VX.js} +3 -3
  57. package/dist/{setup-command-2OUPZSU7.js → setup-command-B6EC3OJA.js} +10 -10
  58. package/dist/{setup-config-TMXG3O7K.js → setup-config-HVO6ZSLW.js} +3 -3
  59. package/dist/{setup-custom-api-N5VE2YPO.js → setup-custom-api-UOIKUQL4.js} +4 -4
  60. package/dist/{tool-memory-JL5TF5BI.js → tool-memory-T7ZYIUJ2.js} +4 -4
  61. package/dist/{weather-report-CCOWOPFG.js → weather-report-O3Z3BBAX.js} +2 -2
  62. package/package.json +1 -1
  63. package/dist/chunk-2GW2FZXY.js.map +0 -1
  64. package/dist/chunk-2HBQ6XXA.js.map +0 -1
  65. package/dist/chunk-F7N2T53R.js.map +0 -1
  66. package/dist/chunk-FAU7LVIG.js.map +0 -1
  67. package/dist/chunk-R2VJY7Z4.js.map +0 -1
  68. package/dist/chunk-S5HMID6I.js.map +0 -1
  69. package/dist/expert-bridge-J5ZKCYL5.js +0 -11
  70. /package/dist/{child-mcp-config-HVGU73XG.js.map → child-mcp-config-BMSYR7VV.js.map} +0 -0
  71. /package/dist/{chunk-EGK4RZV5.js.map → chunk-2R5UUBGA.js.map} +0 -0
  72. /package/dist/{chunk-WVSQGGAH.js.map → chunk-2SQXJQTA.js.map} +0 -0
  73. /package/dist/{chunk-YW72ORKM.js.map → chunk-BL5IBHEY.js.map} +0 -0
  74. /package/dist/{chunk-BZVYU4YD.js.map → chunk-C7P2HLJX.js.map} +0 -0
  75. /package/dist/{chunk-ZAY5M2AN.js.map → chunk-G2DZBEMU.js.map} +0 -0
  76. /package/dist/{chunk-6M44ZXB4.js.map → chunk-GNG7URCR.js.map} +0 -0
  77. /package/dist/{chunk-ITMLH7TF.js.map → chunk-HJUHDPXJ.js.map} +0 -0
  78. /package/dist/{chunk-B3MCX46I.js.map → chunk-HVZ52LOL.js.map} +0 -0
  79. /package/dist/{chunk-AMFVUDWI.js.map → chunk-NTLJ3INA.js.map} +0 -0
  80. /package/dist/{chunk-XZECNG2Q.js.map → chunk-OYDJ3C4N.js.map} +0 -0
  81. /package/dist/{chunk-PPV23O3J.js.map → chunk-PZESEBD3.js.map} +0 -0
  82. /package/dist/{chunk-5TM5VL23.js.map → chunk-QHL4KGNB.js.map} +0 -0
  83. /package/dist/{chunk-M5ABED6T.js.map → chunk-SBZVRH4S.js.map} +0 -0
  84. /package/dist/{chunk-M3KVQK54.js.map → chunk-SXL744NF.js.map} +0 -0
  85. /package/dist/{chunk-JSQV2EOZ.js.map → chunk-U7JXQSEM.js.map} +0 -0
  86. /package/dist/{chunk-RGKUBFTE.js.map → chunk-W2AIGD35.js.map} +0 -0
  87. /package/dist/{chunk-7JLSKX3U.js.map → chunk-WUUEKFKG.js.map} +0 -0
  88. /package/dist/{chunk-K7WUEKCD.js.map → chunk-X3JR3GMT.js.map} +0 -0
  89. /package/dist/{chunk-ZBABWKEA.js.map → chunk-XGUDCUMB.js.map} +0 -0
  90. /package/dist/{cli-circuit-breaker-NUZGOAVD.js.map → cli-circuit-breaker-BIJUQRQI.js.map} +0 -0
  91. /package/dist/{composite-router-4CF3P5D4.js.map → composite-router-FB7P22L5.js.map} +0 -0
  92. /package/dist/{consensus-vote-7PLEGFWZ.js.map → consensus-vote-KKAIFULI.js.map} +0 -0
  93. /package/dist/{context-retriever-R5W4I4IB.js.map → context-retriever-4JCGMWH7.js.map} +0 -0
  94. /package/dist/{doctor-deep-7JTGI33O.js.map → doctor-deep-7YK4BZIJ.js.map} +0 -0
  95. /package/dist/{expert-bridge-J5ZKCYL5.js.map → expert-bridge-DJM5GAWZ.js.map} +0 -0
  96. /package/dist/{factory-DD2FPM3H.js.map → factory-DOWBGVAL.js.map} +0 -0
  97. /package/dist/{factory-E2CKCYIK.js.map → factory-PK4EZL7K.js.map} +0 -0
  98. /package/dist/{init-opencode-2BZWAACW.js.map → init-opencode-QP5CAMWN.js.map} +0 -0
  99. /package/dist/{issue-triage-CRUJLWFY.js.map → issue-triage-T3SKNBH5.js.map} +0 -0
  100. /package/dist/{registry-command-OHIJNUZJ.js.map → registry-command-TH7U6UMC.js.map} +0 -0
  101. /package/dist/{repo-security-plan-I4FZP7QA.js.map → repo-security-plan-V257RYTW.js.map} +0 -0
  102. /package/dist/{research-helpers-synthesize-NMYYERCP.js.map → research-helpers-synthesize-Y3O76PY4.js.map} +0 -0
  103. /package/dist/{routing-memory-7DA6WNSA.js.map → routing-memory-AAH7NIHD.js.map} +0 -0
  104. /package/dist/{session-memory-LV35VSBK.js.map → session-memory-MY6YS2VX.js.map} +0 -0
  105. /package/dist/{setup-command-2OUPZSU7.js.map → setup-command-B6EC3OJA.js.map} +0 -0
  106. /package/dist/{setup-config-TMXG3O7K.js.map → setup-config-HVO6ZSLW.js.map} +0 -0
  107. /package/dist/{setup-custom-api-N5VE2YPO.js.map → setup-custom-api-UOIKUQL4.js.map} +0 -0
  108. /package/dist/{tool-memory-JL5TF5BI.js.map → tool-memory-T7ZYIUJ2.js.map} +0 -0
  109. /package/dist/{weather-report-CCOWOPFG.js.map → weather-report-O3Z3BBAX.js.map} +0 -0
@@ -7,10 +7,10 @@ import {
7
7
  import {
8
8
  getTokenEnvVars,
9
9
  resolveToken
10
- } from "./chunk-ZAY5M2AN.js";
10
+ } from "./chunk-G2DZBEMU.js";
11
11
  import {
12
12
  executeExpert
13
- } from "./chunk-2GW2FZXY.js";
13
+ } from "./chunk-HMXQKDUV.js";
14
14
  import {
15
15
  EventTopics,
16
16
  NOOP_NOTIFIER,
@@ -36,7 +36,7 @@ import {
36
36
  withAccessPolicy,
37
37
  withProgressHeartbeat,
38
38
  wrapToolWithTimeout
39
- } from "./chunk-R2VJY7Z4.js";
39
+ } from "./chunk-FTT2IYYX.js";
40
40
  import {
41
41
  REGISTRY_PATH,
42
42
  getProjectRoot,
@@ -45,14 +45,14 @@ import {
45
45
  normalizeTopicToCanonical,
46
46
  savePapersRegistry,
47
47
  synthesizeResearch
48
- } from "./chunk-EGK4RZV5.js";
48
+ } from "./chunk-2R5UUBGA.js";
49
49
  import {
50
50
  IssueTriage,
51
51
  sanitizeInput
52
- } from "./chunk-ITMLH7TF.js";
52
+ } from "./chunk-HJUHDPXJ.js";
53
53
  import {
54
54
  generateSecurityPlan
55
- } from "./chunk-RGKUBFTE.js";
55
+ } from "./chunk-W2AIGD35.js";
56
56
  import {
57
57
  analyzeGitHubRepo
58
58
  } from "./chunk-7J7PNOJQ.js";
@@ -64,7 +64,7 @@ import {
64
64
  getContextForTask,
65
65
  inferTaskCategory,
66
66
  summarizeContextForPrompt
67
- } from "./chunk-S5HMID6I.js";
67
+ } from "./chunk-TXIUCEFT.js";
68
68
  import {
69
69
  DEFAULT_RELEVANCE_CONFIG,
70
70
  MemoryImportance,
@@ -72,19 +72,19 @@ import {
72
72
  generateHyphenId,
73
73
  generateUUID,
74
74
  getToolMemory
75
- } from "./chunk-JSQV2EOZ.js";
75
+ } from "./chunk-U7JXQSEM.js";
76
76
  import {
77
77
  DEFAULT_TASK_TTL_MS,
78
78
  DEFAULT_TOOL_RATE_LIMITS,
79
79
  clampTaskTtl
80
- } from "./chunk-F7N2T53R.js";
80
+ } from "./chunk-S36LIUV2.js";
81
81
  import {
82
82
  getAvailabilityCache,
83
83
  resolveFallback
84
- } from "./chunk-6M44ZXB4.js";
84
+ } from "./chunk-GNG7URCR.js";
85
85
  import {
86
86
  DEFAULTS
87
- } from "./chunk-2HBQ6XXA.js";
87
+ } from "./chunk-SHWGK7X6.js";
88
88
  import {
89
89
  resolveInsideRoot
90
90
  } from "./chunk-NUBSJGQZ.js";
@@ -100,7 +100,7 @@ import {
100
100
  getAvailableClis,
101
101
  sleep,
102
102
  withTimeout
103
- } from "./chunk-WVSQGGAH.js";
103
+ } from "./chunk-2SQXJQTA.js";
104
104
  import {
105
105
  BUILT_IN_EXPERTS,
106
106
  BuiltInExpertTypeSchema,
@@ -112,7 +112,7 @@ import {
112
112
  } from "./chunk-PQHVC4BD.js";
113
113
  import {
114
114
  createSessionMemory
115
- } from "./chunk-B3MCX46I.js";
115
+ } from "./chunk-HVZ52LOL.js";
116
116
  import {
117
117
  AGENT_ROUTER_TIMEOUTS,
118
118
  API_TIMEOUTS,
@@ -182,7 +182,7 @@ import {
182
182
  resolveModelIdentitySync,
183
183
  toExpertTaskAnalysisResult,
184
184
  withStep
185
- } from "./chunk-HFSSADUV.js";
185
+ } from "./chunk-7VNVDFD5.js";
186
186
  import {
187
187
  getNexusDataDir,
188
188
  nexusDataPath
@@ -19198,14 +19198,8 @@ async function runAllSteps(steps, context, stepExecutor, opts, state) {
19198
19198
  async function executeStepInQueue(step, context, stepExecutor, opts, state) {
19199
19199
  try {
19200
19200
  const result = await state.queue.add((signal) => {
19201
- const combined = new AbortController();
19202
- signal.addEventListener("abort", () => {
19203
- combined.abort();
19204
- });
19205
- state.abortController.signal.addEventListener("abort", () => {
19206
- combined.abort();
19207
- });
19208
- return executeStepWithTimeout(step, context, stepExecutor, combined.signal);
19201
+ const combined = AbortSignal.any([signal, state.abortController.signal]);
19202
+ return executeStepWithTimeout(step, context, stepExecutor, combined);
19209
19203
  });
19210
19204
  state.results.push(result);
19211
19205
  if (opts.failFast && result.status === "failed" && state.firstError === null) {
@@ -23494,10 +23488,10 @@ function calculateZStatistic(params) {
23494
23488
  function calculateDifferenceCI(p1, p2, total1, total2, confidence) {
23495
23489
  const difference = p1 - p2;
23496
23490
  const seDiff = Math.sqrt(p1 * (1 - p1) / (total1 || 1) + p2 * (1 - p2) / (total2 || 1));
23497
- const z107 = getZScore(confidence);
23491
+ const z108 = getZScore(confidence);
23498
23492
  return {
23499
- lower: difference - z107 * seDiff,
23500
- upper: difference + z107 * seDiff,
23493
+ lower: difference - z108 * seDiff,
23494
+ upper: difference + z108 * seDiff,
23501
23495
  estimate: difference,
23502
23496
  confidence,
23503
23497
  n: total1 + total2,
@@ -23520,11 +23514,11 @@ function proportionConfidenceInterval(successes, total, options = {}) {
23520
23514
  standardError: 0
23521
23515
  };
23522
23516
  }
23523
- const z107 = getZScore(opts.confidence);
23524
- const z210 = z107 * z107;
23517
+ const z108 = getZScore(opts.confidence);
23518
+ const z210 = z108 * z108;
23525
23519
  const denominator = 1 + z210 / n;
23526
23520
  const center = (p + z210 / (2 * n)) / denominator;
23527
- const margin = z107 / denominator * Math.sqrt(p * (1 - p) / n + z210 / (4 * n * n));
23521
+ const margin = z108 / denominator * Math.sqrt(p * (1 - p) / n + z210 / (4 * n * n));
23528
23522
  const lower = Math.max(0, center - margin);
23529
23523
  const upper = Math.min(1, center + margin);
23530
23524
  const standardError = Math.sqrt(p * (1 - p) / n);
@@ -23554,8 +23548,8 @@ function meanConfidenceInterval(values, options = {}) {
23554
23548
  const variance = values.reduce((sum, v) => sum + (v - mean) ** 2, 0) / (n - 1 || 1);
23555
23549
  const stdDev = Math.sqrt(variance);
23556
23550
  const standardError = stdDev / Math.sqrt(n);
23557
- const z107 = getZScore(opts.confidence);
23558
- const margin = z107 * standardError;
23551
+ const z108 = getZScore(opts.confidence);
23552
+ const margin = z108 * standardError;
23559
23553
  return {
23560
23554
  lower: mean - margin,
23561
23555
  upper: mean + margin,
@@ -26699,7 +26693,7 @@ async function populateUnifiedContextOnState(state) {
26699
26693
  try {
26700
26694
  const taskCandidate = state["task"];
26701
26695
  if (typeof taskCandidate !== "string" || taskCandidate === "") return;
26702
- const { getContextForTask: getContextForTask2, inferTaskCategory: inferTaskCategory2 } = await import("./context-retriever-R5W4I4IB.js");
26696
+ const { getContextForTask: getContextForTask2, inferTaskCategory: inferTaskCategory2 } = await import("./context-retriever-4JCGMWH7.js");
26703
26697
  const ctx = await getContextForTask2({
26704
26698
  task: taskCandidate,
26705
26699
  category: inferTaskCategory2(taskCandidate),
@@ -33428,9 +33422,22 @@ async function deriveOrchestratePolicy(taskText, deps, logger52) {
33428
33422
  }
33429
33423
  return policy;
33430
33424
  } catch (error) {
33431
- logger52.warn("access-policy: derivation failed, falling back to off", {
33432
- error: getErrorMessage(error)
33425
+ logger52.warn("access-policy: derivation failed", {
33426
+ mode,
33427
+ error: getErrorMessage(error),
33428
+ failClosed: mode === "enforce" || mode === "confirm_risky"
33433
33429
  });
33430
+ if (mode === "enforce" || mode === "confirm_risky") {
33431
+ return {
33432
+ allowedTools: [],
33433
+ allowedPathPatterns: [],
33434
+ allowedOperations: [],
33435
+ objectiveHash: "derivation-failed",
33436
+ derivedAt: getTimeProvider().nowIso(),
33437
+ source: "bypass",
33438
+ mode
33439
+ };
33440
+ }
33434
33441
  return {
33435
33442
  allowedTools: "*",
33436
33443
  allowedPathPatterns: [],
@@ -33438,7 +33445,7 @@ async function deriveOrchestratePolicy(taskText, deps, logger52) {
33438
33445
  objectiveHash: "derivation-failed",
33439
33446
  derivedAt: getTimeProvider().nowIso(),
33440
33447
  source: "bypass",
33441
- mode: "off"
33448
+ mode
33442
33449
  };
33443
33450
  }
33444
33451
  }
@@ -35635,9 +35642,22 @@ async function deriveExpertAccessPolicy(task, logger52) {
35635
35642
  }
35636
35643
  return policy;
35637
35644
  } catch (error) {
35638
- logger52?.warn("access-policy: derivation failed, falling back to off (expert)", {
35639
- error: getErrorMessage(error)
35645
+ logger52?.warn("access-policy: derivation failed (expert)", {
35646
+ mode,
35647
+ error: getErrorMessage(error),
35648
+ failClosed: mode === "enforce" || mode === "confirm_risky"
35640
35649
  });
35650
+ if (mode === "enforce" || mode === "confirm_risky") {
35651
+ return {
35652
+ allowedTools: [],
35653
+ allowedPathPatterns: [],
35654
+ allowedOperations: [],
35655
+ objectiveHash: "derivation-failed",
35656
+ derivedAt: getTimeProvider().nowIso(),
35657
+ source: "bypass",
35658
+ mode
35659
+ };
35660
+ }
35641
35661
  return {
35642
35662
  allowedTools: "*",
35643
35663
  allowedPathPatterns: [],
@@ -35645,7 +35665,7 @@ async function deriveExpertAccessPolicy(task, logger52) {
35645
35665
  objectiveHash: "derivation-failed",
35646
35666
  derivedAt: getTimeProvider().nowIso(),
35647
35667
  source: "bypass",
35648
- mode: "off"
35668
+ mode
35649
35669
  };
35650
35670
  }
35651
35671
  }
@@ -40479,7 +40499,7 @@ function registerRepoSecurityPlanTool(server, deps) {
40479
40499
  }
40480
40500
 
40481
40501
  // src/mcp/tools/search-codebase-tool.ts
40482
- import { resolve as resolve9 } from "path";
40502
+ import { resolve as resolve9, sep as sep3 } from "path";
40483
40503
  import { z as z82 } from "zod";
40484
40504
  var SearchCodebaseInputSchema = z82.object({
40485
40505
  query: z82.string().min(1).max(200).describe("Search query (symbol name, keyword, or pattern)"),
@@ -40487,22 +40507,49 @@ var SearchCodebaseInputSchema = z82.object({
40487
40507
  limit: z82.number().min(1).max(50).optional().describe("Max results (default: 20)"),
40488
40508
  mode: z82.enum(["search", "summary", "list"]).optional().describe("search: find symbols. summary: file overview. list: list indexed files.")
40489
40509
  });
40490
- var cachedIndex;
40491
- var cachedDir = "";
40492
- async function getIndex(dir) {
40493
- if (cachedIndex !== void 0 && cachedDir === dir) {
40494
- return cachedIndex;
40510
+ var MAX_CACHED_DIRS = 3;
40511
+ var INDEX_TTL_MS = 15 * 60 * 1e3;
40512
+ var indexCache = /* @__PURE__ */ new Map();
40513
+ var inflightIndex = /* @__PURE__ */ new Map();
40514
+ function getFromCache(dir) {
40515
+ const entry = indexCache.get(dir);
40516
+ if (entry === void 0) return void 0;
40517
+ if (entry.expiresAt <= getTimeProvider().now()) {
40518
+ indexCache.delete(dir);
40519
+ return void 0;
40495
40520
  }
40496
- const index = new CodebaseIndex(dir);
40497
- await index.index(4);
40498
- cachedIndex = index;
40499
- cachedDir = dir;
40500
- return index;
40521
+ indexCache.delete(dir);
40522
+ indexCache.set(dir, entry);
40523
+ return entry.index;
40524
+ }
40525
+ function putInCache(dir, index) {
40526
+ indexCache.set(dir, { index, expiresAt: getTimeProvider().now() + INDEX_TTL_MS });
40527
+ while (indexCache.size > MAX_CACHED_DIRS) {
40528
+ const lruKey = indexCache.keys().next().value;
40529
+ if (lruKey === void 0) break;
40530
+ indexCache.delete(lruKey);
40531
+ }
40532
+ }
40533
+ async function getIndex(dir) {
40534
+ const cached = getFromCache(dir);
40535
+ if (cached !== void 0) return cached;
40536
+ const inflight = inflightIndex.get(dir);
40537
+ if (inflight !== void 0) return inflight;
40538
+ const promise = (async () => {
40539
+ const index = new CodebaseIndex(dir);
40540
+ await index.index(4);
40541
+ putInCache(dir, index);
40542
+ return index;
40543
+ })().finally(() => {
40544
+ inflightIndex.delete(dir);
40545
+ });
40546
+ inflightIndex.set(dir, promise);
40547
+ return promise;
40501
40548
  }
40502
40549
  function resolveSearchDir(directory) {
40503
40550
  const dir = resolve9(directory ?? process.cwd());
40504
40551
  const cwdRoot = resolve9(".");
40505
- if (!dir.startsWith(cwdRoot)) {
40552
+ if (dir !== cwdRoot && !dir.startsWith(cwdRoot + sep3)) {
40506
40553
  return { error: `Path traversal denied: directory must be within ${cwdRoot}` };
40507
40554
  }
40508
40555
  return { dir };
@@ -40588,7 +40635,7 @@ function registerSearchCodebaseTool(server, deps) {
40588
40635
  }
40589
40636
 
40590
40637
  // src/mcp/tools/extract-symbols-tool.ts
40591
- import { resolve as resolve10 } from "path";
40638
+ import { resolve as resolve10, sep as sep4 } from "path";
40592
40639
  import { z as z83 } from "zod";
40593
40640
  var ExtractSymbolsInputSchema = z83.object({
40594
40641
  filePath: z83.string().min(1).max(500).describe("Path to TypeScript/JavaScript file to extract symbols from"),
@@ -40626,7 +40673,7 @@ async function extractSymbolsHandler(args, ctx) {
40626
40673
  const { filePath, mode } = parsed.data;
40627
40674
  const resolvedPath = resolve10(filePath);
40628
40675
  const cwdRoot = resolve10(".");
40629
- if (!resolvedPath.startsWith(cwdRoot)) {
40676
+ if (resolvedPath !== cwdRoot && !resolvedPath.startsWith(cwdRoot + sep4)) {
40630
40677
  return toolStructuredError({
40631
40678
  errorCategory: "permission",
40632
40679
  message: `Path traversal denied: path must be within ${cwdRoot}`
@@ -40677,7 +40724,7 @@ function registerExtractSymbolsTool(server, deps) {
40677
40724
 
40678
40725
  // src/mcp/tools/query-trace-tool.ts
40679
40726
  import { readFile as readFile5, stat as stat3 } from "fs/promises";
40680
- import { join as join8, resolve as resolve11, sep as sep3 } from "path";
40727
+ import { join as join8, resolve as resolve11, sep as sep5 } from "path";
40681
40728
  import { z as z84 } from "zod";
40682
40729
  var QueryTraceInputSchema = z84.object({
40683
40730
  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"),
@@ -40728,7 +40775,7 @@ async function queryTraceFromDisk(input, runsDir) {
40728
40775
  const tracePath = join8(dir, input.runId, "trace.jsonl");
40729
40776
  const resolvedDir = resolve11(dir);
40730
40777
  const resolvedTrace = resolve11(tracePath);
40731
- if (!resolvedTrace.startsWith(resolvedDir + sep3) && resolvedTrace !== resolvedDir) {
40778
+ if (!resolvedTrace.startsWith(resolvedDir + sep5) && resolvedTrace !== resolvedDir) {
40732
40779
  return { runId: input.runId, ...EMPTY_RESPONSE };
40733
40780
  }
40734
40781
  try {
@@ -40942,6 +40989,12 @@ var AuditLogConfigSchema = z85.object({
40942
40989
  enableHashChain: z85.boolean().optional().default(true),
40943
40990
  enableCompression: z85.boolean().optional().default(false),
40944
40991
  flushIntervalMs: z85.number().positive().optional().default(1e3),
40992
+ /**
40993
+ * Maximum in-memory event queue depth before drop-oldest backpressure
40994
+ * engages. Bounds memory under load when storage.write is slow or the flush
40995
+ * timer is overlapping; see #2979.
40996
+ */
40997
+ maxQueueDepth: z85.number().positive().optional().default(1e4),
40945
40998
  // Filtering
40946
40999
  minSeverity: AuditSeveritySchema.optional().default("info"),
40947
41000
  categories: z85.array(AuditCategorySchema).optional()
@@ -41339,17 +41392,21 @@ var SYSTEM_ACTOR = {
41339
41392
  id: "nexus-agents",
41340
41393
  name: "Nexus Agents System"
41341
41394
  };
41395
+ var DROP_WARN_INTERVAL = 1e3;
41342
41396
  var AuditLogger = class {
41343
41397
  storage;
41344
41398
  logger;
41345
41399
  enableHashChain;
41346
41400
  minSeverity;
41347
41401
  categories;
41402
+ maxQueueDepth;
41348
41403
  lastHash = null;
41349
41404
  eventQueue = [];
41350
41405
  flushTimer = null;
41351
41406
  flushIntervalMs;
41352
41407
  closed = false;
41408
+ inFlightFlush = null;
41409
+ droppedEventCount = 0;
41353
41410
  constructor(config, storage, logger52) {
41354
41411
  const validated = AuditLogConfigSchema.safeParse(config);
41355
41412
  if (!validated.success) {
@@ -41361,13 +41418,14 @@ var AuditLogger = class {
41361
41418
  this.minSeverity = validated.data.minSeverity;
41362
41419
  this.categories = validated.data.categories;
41363
41420
  this.flushIntervalMs = validated.data.flushIntervalMs;
41421
+ this.maxQueueDepth = validated.data.maxQueueDepth;
41364
41422
  this.storage = storage ?? new FileAuditStorage(validated.data, this.logger);
41365
41423
  this.startFlushTimer();
41366
41424
  this.logger.info("AuditLogger initialized", { logDir: config.logDir });
41367
41425
  }
41368
41426
  startFlushTimer() {
41369
41427
  this.flushTimer = setInterval(() => {
41370
- this.flushQueue().catch((err2) => {
41428
+ this.flush().catch((err2) => {
41371
41429
  this.logger.error("Audit flush failed", err2 instanceof Error ? err2 : void 0);
41372
41430
  });
41373
41431
  }, this.flushIntervalMs);
@@ -41419,6 +41477,19 @@ var AuditLogger = class {
41419
41477
  if (!this.shouldLog(input)) return;
41420
41478
  const event = this.createEvent(input);
41421
41479
  this.eventQueue.push(event);
41480
+ if (this.eventQueue.length > this.maxQueueDepth) {
41481
+ const dropCount = this.eventQueue.length - this.maxQueueDepth;
41482
+ this.eventQueue.splice(0, dropCount);
41483
+ const priorDropped = this.droppedEventCount;
41484
+ this.droppedEventCount += dropCount;
41485
+ const crossedThreshold = Math.floor(this.droppedEventCount / DROP_WARN_INTERVAL) > Math.floor(priorDropped / DROP_WARN_INTERVAL);
41486
+ if (priorDropped === 0 || crossedThreshold) {
41487
+ this.logger.warn("Audit event queue full; dropping oldest events", {
41488
+ maxQueueDepth: this.maxQueueDepth,
41489
+ totalDropped: this.droppedEventCount
41490
+ });
41491
+ }
41492
+ }
41422
41493
  this.logger.debug("Audit event queued", {
41423
41494
  id: event.id,
41424
41495
  category: event.category,
@@ -41506,16 +41577,30 @@ var AuditLogger = class {
41506
41577
  metadata
41507
41578
  });
41508
41579
  }
41509
- async flushQueue() {
41510
- if (this.eventQueue.length === 0) return;
41511
- const events = this.eventQueue.splice(0, this.eventQueue.length);
41512
- for (const event of events) {
41513
- await this.storage.write(event);
41580
+ async drainAndFlushOnce() {
41581
+ if (this.eventQueue.length > 0) {
41582
+ const events = this.eventQueue.splice(0, this.eventQueue.length);
41583
+ for (const event of events) {
41584
+ await this.storage.write(event);
41585
+ }
41514
41586
  }
41587
+ await this.storage.flush();
41515
41588
  }
41589
+ /**
41590
+ * Drain the in-memory queue to storage AND flush the storage's own buffer
41591
+ * to disk. Concurrent calls are coalesced into a single in-flight promise
41592
+ * so an overlapping flush-timer tick cannot spawn parallel drains (see
41593
+ * #2979). A caller arriving while a flush is already running awaits the
41594
+ * existing promise; their newly-queued events, if any, are picked up by
41595
+ * the next flush.
41596
+ */
41516
41597
  async flush() {
41517
- await this.flushQueue();
41518
- await this.storage.flush();
41598
+ if (this.inFlightFlush !== null) return this.inFlightFlush;
41599
+ const drain = this.drainAndFlushOnce().finally(() => {
41600
+ this.inFlightFlush = null;
41601
+ });
41602
+ this.inFlightFlush = drain;
41603
+ return drain;
41519
41604
  }
41520
41605
  async close() {
41521
41606
  if (this.closed) return;
@@ -41918,7 +42003,7 @@ async function tryIssueTriage(task) {
41918
42003
  try {
41919
42004
  const issueMatch = task.match(/github\.com\/([^/]+\/[^/]+)\/issues\/(\d+)/);
41920
42005
  if (issueMatch === null) return null;
41921
- const { createIssueTriage } = await import("./issue-triage-CRUJLWFY.js");
42006
+ const { createIssueTriage } = await import("./issue-triage-T3SKNBH5.js");
41922
42007
  const triage = createIssueTriage();
41923
42008
  const owner = issueMatch[1] ?? "";
41924
42009
  const num = issueMatch[2] ?? "";
@@ -41946,7 +42031,7 @@ var VALID_TEMPLATES = /* @__PURE__ */ new Set([
41946
42031
  ]);
41947
42032
  async function classifyWithLLM(task) {
41948
42033
  try {
41949
- const { executeExpert: executeExpert2 } = await import("./expert-bridge-J5ZKCYL5.js");
42034
+ const { executeExpert: executeExpert2 } = await import("./expert-bridge-DJM5GAWZ.js");
41950
42035
  const prompt = [
41951
42036
  "Classify this task into exactly one pipeline template.",
41952
42037
  "Templates: dev (implementation/bug fix/refactor), research (investigate/evaluate/compare),",
@@ -42728,7 +42813,7 @@ var memoryInitPromise = null;
42728
42813
  async function initPipelineMemory() {
42729
42814
  if (cachedMemory !== null) return cachedMemory;
42730
42815
  try {
42731
- const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-LV35VSBK.js");
42816
+ const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-MY6YS2VX.js");
42732
42817
  const { getLearningDir } = await import("./learning-persistence-NX2KHL5T.js");
42733
42818
  const mem = createSessionMemory2(getLearningDir());
42734
42819
  mem.startSession(`pipeline-${String(getTimeProvider().now())}`);
@@ -42775,6 +42860,7 @@ function flushPipelineMemory() {
42775
42860
  void getPipelineMemoryAsync().then((m) => m?.flush());
42776
42861
  }
42777
42862
  var routingMemoryCache = null;
42863
+ var routingMemoryInitPromise = null;
42778
42864
  function recordRoutingExperience(category, success, durationMs) {
42779
42865
  const metrics = { durationMs, tokensUsed: 0 };
42780
42866
  const callRecord = (rm) => {
@@ -42784,12 +42870,17 @@ function recordRoutingExperience(category, success, durationMs) {
42784
42870
  callRecord(routingMemoryCache);
42785
42871
  return;
42786
42872
  }
42787
- void import("./routing-memory-7DA6WNSA.js").then(({ createRoutingMemory }) => {
42788
- routingMemoryCache = createRoutingMemory();
42789
- callRecord(routingMemoryCache);
42873
+ routingMemoryInitPromise ??= import("./routing-memory-AAH7NIHD.js").then(({ createRoutingMemory }) => {
42874
+ routingMemoryCache ??= createRoutingMemory();
42875
+ return routingMemoryCache;
42790
42876
  }).catch((error) => {
42877
+ routingMemoryInitPromise = null;
42791
42878
  const msg = error instanceof Error ? error.message : String(error);
42792
42879
  logger38.debug("Routing memory init failed; continuing without it", { error: msg });
42880
+ return null;
42881
+ });
42882
+ void routingMemoryInitPromise.then((rm) => {
42883
+ if (rm !== null) callRecord(rm);
42793
42884
  });
42794
42885
  }
42795
42886
  async function postProgress(config, stage, message) {
@@ -42813,7 +42904,7 @@ ${text}` : "";
42813
42904
  }
42814
42905
  async function getWeatherContext() {
42815
42906
  try {
42816
- const { generateWeatherReport: generateWeatherReport2 } = await import("./weather-report-CCOWOPFG.js");
42907
+ const { generateWeatherReport: generateWeatherReport2 } = await import("./weather-report-O3Z3BBAX.js");
42817
42908
  const report = generateWeatherReport2({ includeAdaptive: true });
42818
42909
  const mappings = "recommendedMappings" in report ? report.recommendedMappings : [];
42819
42910
  if (!Array.isArray(mappings) || mappings.length === 0) return "";
@@ -42831,7 +42922,7 @@ ${lines}
42831
42922
  }
42832
42923
  async function getMemoryContext(task) {
42833
42924
  try {
42834
- const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-LV35VSBK.js");
42925
+ const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-MY6YS2VX.js");
42835
42926
  const { getLearningDir } = await import("./learning-persistence-NX2KHL5T.js");
42836
42927
  const memory = createSessionMemory2(getLearningDir(), { maxLearningsInContext: 10 });
42837
42928
  const learnings = memory.searchLearnings(task.slice(0, 200));
@@ -42937,7 +43028,7 @@ ${contextBlock}`;
42937
43028
  const strategy = config.votingStrategy ?? "higher_order";
42938
43029
  await postProgress(config, "Vote", `Running consensus with ${strategy} strategy...`);
42939
43030
  try {
42940
- const { executeVoting } = await import("./consensus-vote-7PLEGFWZ.js");
43031
+ const { executeVoting } = await import("./consensus-vote-KKAIFULI.js");
42941
43032
  const votingResult = await executeVoting(
42942
43033
  {
42943
43034
  proposal: plan.slice(0, 4e3),
@@ -43134,6 +43225,7 @@ function extractIssues(text) {
43134
43225
  // src/pipeline/pipeline-checkpoint.ts
43135
43226
  import * as fs10 from "fs";
43136
43227
  import * as path9 from "path";
43228
+ import { z as z90 } from "zod";
43137
43229
  var logger39 = createLogger({ component: "pipeline-checkpoint" });
43138
43230
  var SESSION_ID_REGEX = /^[a-zA-Z0-9_-]{1,128}$/;
43139
43231
  function validateSessionId(sessionId) {
@@ -43181,14 +43273,65 @@ function loadCheckpointState(sessionId, customDir) {
43181
43273
  return null;
43182
43274
  }
43183
43275
  }
43276
+ var PipelineStageSchema = z90.enum([
43277
+ "research",
43278
+ "plan",
43279
+ "vote",
43280
+ "decompose",
43281
+ "implement",
43282
+ "security"
43283
+ ]);
43284
+ var PipelineStageDataSchema = z90.discriminatedUnion("type", [
43285
+ z90.object({ type: z90.literal("research"), text: z90.string() }),
43286
+ z90.object({ type: z90.literal("plan"), text: z90.string(), iterations: z90.number() }),
43287
+ z90.object({
43288
+ type: z90.literal("vote"),
43289
+ approved: z90.boolean(),
43290
+ conditional: z90.boolean(),
43291
+ conditions: z90.array(z90.string()).optional(),
43292
+ caveats: z90.array(z90.string()).optional(),
43293
+ iterations: z90.number()
43294
+ }),
43295
+ // PipelineTask shape is loose at the persistence layer — capture as
43296
+ // `z.unknown()` and trust the downstream consumer's narrower validation.
43297
+ z90.object({ type: z90.literal("decompose"), tasks: z90.array(z90.unknown()) }),
43298
+ z90.object({ type: z90.literal("implement"), tasks: z90.array(z90.unknown()) }),
43299
+ z90.object({ type: z90.literal("security"), passed: z90.boolean() })
43300
+ ]);
43301
+ var PipelineCheckpointEntrySchema = z90.object({
43302
+ sessionId: z90.string(),
43303
+ stage: PipelineStageSchema,
43304
+ timestamp: z90.string(),
43305
+ data: PipelineStageDataSchema
43306
+ });
43184
43307
  function rebuildState(lines) {
43185
43308
  const state = {};
43309
+ let skippedCount = 0;
43310
+ let firstSkipReason;
43186
43311
  for (const line of lines) {
43312
+ let parsed;
43187
43313
  try {
43188
- const entry = JSON.parse(line);
43189
- applyEntry(state, entry);
43190
- } catch {
43314
+ parsed = JSON.parse(line);
43315
+ } catch (error) {
43316
+ skippedCount++;
43317
+ firstSkipReason ??= `JSON.parse failed: ${error instanceof Error ? error.message : String(error)}`;
43318
+ continue;
43319
+ }
43320
+ const result = PipelineCheckpointEntrySchema.safeParse(parsed);
43321
+ if (!result.success) {
43322
+ skippedCount++;
43323
+ firstSkipReason ??= `schema validation failed: ${result.error.message}`;
43324
+ continue;
43191
43325
  }
43326
+ applyEntry(state, result.data);
43327
+ }
43328
+ if (skippedCount > 0) {
43329
+ logger39.warn("Skipped malformed checkpoint lines during state rebuild", {
43330
+ skippedCount,
43331
+ totalLines: lines.length,
43332
+ firstSkipReason,
43333
+ recovered: state.lastCompletedStage
43334
+ });
43192
43335
  }
43193
43336
  return state;
43194
43337
  }
@@ -43833,7 +43976,7 @@ async function extractSymbolsForTask(task) {
43833
43976
  }
43834
43977
  async function queryResearchRegistry(task) {
43835
43978
  try {
43836
- const { synthesizeResearch: synthesizeResearch2 } = await import("./research-helpers-synthesize-NMYYERCP.js");
43979
+ const { synthesizeResearch: synthesizeResearch2 } = await import("./research-helpers-synthesize-Y3O76PY4.js");
43837
43980
  const topic = task.split(/[.!?\n]/).filter((s) => s.trim().length > 10)[0]?.trim();
43838
43981
  if (topic === void 0) return null;
43839
43982
  const result = await synthesizeResearch2(topic.slice(0, 50));
@@ -43918,7 +44061,7 @@ function createScanStageWrapper() {
43918
44061
  try {
43919
44062
  const slug = ctx.task.match(/([a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+)/)?.[1];
43920
44063
  if (slug !== void 0) {
43921
- const { generateSecurityPlan: generateSecurityPlan2 } = await import("./repo-security-plan-I4FZP7QA.js");
44064
+ const { generateSecurityPlan: generateSecurityPlan2 } = await import("./repo-security-plan-V257RYTW.js");
43922
44065
  const plan = await generateSecurityPlan2({ repo: slug, maxScanners: 10 });
43923
44066
  const recs = plan.recommendations.slice(0, 5).map((r) => `${r.priority}: ${r.displayName} (${r.category})`).join("; ");
43924
44067
  ctx.sharedMemory.write("scan", "decision", { recommendations: recs });
@@ -43959,7 +44102,7 @@ function createAuditStageRegistry() {
43959
44102
  }
43960
44103
 
43961
44104
  // src/mcp/tools/pr-review-tool.ts
43962
- import { z as z90 } from "zod";
44105
+ import { z as z91 } from "zod";
43963
44106
 
43964
44107
  // src/mcp/tools/pr-review-findings.ts
43965
44108
  import { parse as parseYaml3 } from "yaml";
@@ -44051,14 +44194,14 @@ var PR_REVIEW_ROLES = [
44051
44194
  ];
44052
44195
  var MAX_DIFF_LENGTH = 5e4;
44053
44196
  var MAX_DESCRIPTION_LENGTH = 1e4;
44054
- var PrReviewInputSchema = z90.object({
44055
- prTitle: z90.string().min(1).max(500).describe("PR title"),
44056
- prDescription: z90.string().max(MAX_DESCRIPTION_LENGTH).optional().describe("PR body / description"),
44057
- prDiff: z90.string().min(1).max(MAX_DIFF_LENGTH).describe(`Unified diff text (max ${String(MAX_DIFF_LENGTH)} chars; truncate before calling)`),
44058
- repoContext: z90.string().max(2e3).optional().describe("Optional one-paragraph repo context (architecture, conventions)"),
44059
- baseRef: z90.string().max(200).optional().describe("Base branch ref (e.g. main)"),
44060
- headRef: z90.string().max(200).optional().describe("Head branch ref"),
44061
- simulate: z90.boolean().default(false).describe("Use simulated voters (testing only; never ship live with this true)")
44197
+ var PrReviewInputSchema = z91.object({
44198
+ prTitle: z91.string().min(1).max(500).describe("PR title"),
44199
+ prDescription: z91.string().max(MAX_DESCRIPTION_LENGTH).optional().describe("PR body / description"),
44200
+ prDiff: z91.string().min(1).max(MAX_DIFF_LENGTH).describe(`Unified diff text (max ${String(MAX_DIFF_LENGTH)} chars; truncate before calling)`),
44201
+ repoContext: z91.string().max(2e3).optional().describe("Optional one-paragraph repo context (architecture, conventions)"),
44202
+ baseRef: z91.string().max(200).optional().describe("Base branch ref (e.g. main)"),
44203
+ headRef: z91.string().max(200).optional().describe("Head branch ref"),
44204
+ simulate: z91.boolean().default(false).describe("Use simulated voters (testing only; never ship live with this true)")
44062
44205
  });
44063
44206
  function mapVoteDecisionToPrDecision(voteDecision) {
44064
44207
  if (voteDecision === "reject") return "request_changes";
@@ -44224,27 +44367,27 @@ function registerPrReviewTool(server, deps) {
44224
44367
  }
44225
44368
 
44226
44369
  // src/mcp/tools/survey-oss-landscape.ts
44227
- import { z as z91 } from "zod";
44228
- var SurveyOssLandscapeInputSchema = z91.object({
44229
- query: z91.string().min(1).max(200).describe('Free-text search query, e.g. "cargo nextest replacement" or "OSS SBOM tools"'),
44230
- maxResults: z91.number().int().min(1).max(50).optional().default(10).describe("Maximum candidates to return (1-50; default 10)"),
44231
- minStars: z91.number().int().min(0).optional().default(0).describe("Minimum star count to include (default 0; useful for filtering noise)"),
44232
- language: z91.string().max(50).optional().describe('GitHub language filter, e.g. "rust" or "typescript"')
44370
+ import { z as z92 } from "zod";
44371
+ var SurveyOssLandscapeInputSchema = z92.object({
44372
+ query: z92.string().min(1).max(200).describe('Free-text search query, e.g. "cargo nextest replacement" or "OSS SBOM tools"'),
44373
+ maxResults: z92.number().int().min(1).max(50).optional().default(10).describe("Maximum candidates to return (1-50; default 10)"),
44374
+ minStars: z92.number().int().min(0).optional().default(0).describe("Minimum star count to include (default 0; useful for filtering noise)"),
44375
+ language: z92.string().max(50).optional().describe('GitHub language filter, e.g. "rust" or "typescript"')
44233
44376
  });
44234
- var GitHubRepoSchema2 = z91.object({
44235
- full_name: z91.string().optional(),
44236
- html_url: z91.string().optional(),
44237
- description: z91.string().nullable().optional(),
44238
- stargazers_count: z91.number().optional(),
44239
- pushed_at: z91.string().nullable().optional(),
44240
- language: z91.string().nullable().optional(),
44241
- license: z91.object({
44242
- spdx_id: z91.string().nullable().optional()
44377
+ var GitHubRepoSchema2 = z92.object({
44378
+ full_name: z92.string().optional(),
44379
+ html_url: z92.string().optional(),
44380
+ description: z92.string().nullable().optional(),
44381
+ stargazers_count: z92.number().optional(),
44382
+ pushed_at: z92.string().nullable().optional(),
44383
+ language: z92.string().nullable().optional(),
44384
+ license: z92.object({
44385
+ spdx_id: z92.string().nullable().optional()
44243
44386
  }).nullable().optional()
44244
44387
  });
44245
- var GitHubSearchResponseSchema2 = z91.object({
44246
- total_count: z91.number().optional(),
44247
- items: z91.array(GitHubRepoSchema2).optional()
44388
+ var GitHubSearchResponseSchema2 = z92.object({
44389
+ total_count: z92.number().optional(),
44390
+ items: z92.array(GitHubRepoSchema2).optional()
44248
44391
  });
44249
44392
  var GITHUB_SEARCH_BASE = "https://api.github.com/search/repositories";
44250
44393
  function buildGithubQuery(input) {
@@ -44371,11 +44514,11 @@ function createSurveyHandler(deps) {
44371
44514
  };
44372
44515
  }
44373
44516
  var SURVEY_OUTPUT_SCHEMA = {
44374
- query: z91.string(),
44375
- totalFound: z91.number(),
44376
- candidates: z91.array(z91.unknown()),
44377
- sourcesQueried: z91.array(z91.string()),
44378
- sourcesFailed: z91.array(z91.string())
44517
+ query: z92.string(),
44518
+ totalFound: z92.number(),
44519
+ candidates: z92.array(z92.unknown()),
44520
+ sourcesQueried: z92.array(z92.string()),
44521
+ sourcesFailed: z92.array(z92.string())
44379
44522
  };
44380
44523
  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?".';
44381
44524
  function registerSurveyOssLandscapeTool(server, deps) {
@@ -44404,7 +44547,7 @@ function registerSurveyOssLandscapeTool(server, deps) {
44404
44547
  }
44405
44548
 
44406
44549
  // src/mcp/tools/vendor-publishing-audit.ts
44407
- import { z as z92 } from "zod";
44550
+ import { z as z93 } from "zod";
44408
44551
 
44409
44552
  // src/mcp/tools/vendor-publishing-seed.ts
44410
44553
  var VENDOR_PUBLISHING_SEED = {
@@ -44477,8 +44620,8 @@ function listKnownVendors() {
44477
44620
  }
44478
44621
 
44479
44622
  // src/mcp/tools/vendor-publishing-audit.ts
44480
- var VendorPublishingAuditInputSchema = z92.object({
44481
- vendor: z92.string().min(1).max(50).toLowerCase().describe('Vendor identifier, lowercase. e.g. "ubuntu", "debian", "fedora"')
44623
+ var VendorPublishingAuditInputSchema = z93.object({
44624
+ vendor: z93.string().min(1).max(50).toLowerCase().describe('Vendor identifier, lowercase. e.g. "ubuntu", "debian", "fedora"')
44482
44625
  });
44483
44626
  function lookupVendor(vendor) {
44484
44627
  if (isKnownVendor(vendor)) {
@@ -44510,20 +44653,20 @@ function createVendorPublishingAuditHandler(deps) {
44510
44653
  };
44511
44654
  }
44512
44655
  var VENDOR_PUBLISHING_OUTPUT_SCHEMA = {
44513
- vendor: z92.string(),
44514
- known: z92.boolean(),
44656
+ vendor: z93.string(),
44657
+ known: z93.boolean(),
44515
44658
  // Fields below populate when known=true; permissive optional for known=false.
44516
- sha256SumsUrlPattern: z92.string().optional(),
44517
- sha256SumsSignatureUrlPattern: z92.string().optional(),
44518
- signaturePattern: z92.string().optional(),
44519
- gpgKeys: z92.array(z92.unknown()).optional(),
44520
- releaseCadence: z92.string().optional(),
44521
- keyRotationNotes: z92.string().optional(),
44522
- vendorDocUrl: z92.string().optional(),
44523
- citedAt: z92.string().optional(),
44659
+ sha256SumsUrlPattern: z93.string().optional(),
44660
+ sha256SumsSignatureUrlPattern: z93.string().optional(),
44661
+ signaturePattern: z93.string().optional(),
44662
+ gpgKeys: z93.array(z93.unknown()).optional(),
44663
+ releaseCadence: z93.string().optional(),
44664
+ keyRotationNotes: z93.string().optional(),
44665
+ vendorDocUrl: z93.string().optional(),
44666
+ citedAt: z93.string().optional(),
44524
44667
  // Fields below populate when known=false.
44525
- message: z92.string().optional(),
44526
- knownVendors: z92.array(z92.string()).optional()
44668
+ message: z93.string().optional(),
44669
+ knownVendors: z93.array(z93.string()).optional()
44527
44670
  };
44528
44671
  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.";
44529
44672
  function registerVendorPublishingAuditTool(server, deps) {
@@ -44552,17 +44695,17 @@ function registerVendorPublishingAuditTool(server, deps) {
44552
44695
  }
44553
44696
 
44554
44697
  // src/mcp/tools/compare-data-feeds.ts
44555
- import { z as z93 } from "zod";
44698
+ import { z as z94 } from "zod";
44556
44699
  import * as path10 from "path";
44557
44700
  import * as fs11 from "fs";
44558
44701
  import * as yaml3 from "yaml";
44559
- var CompareDataFeedsInputSchema = z93.object({
44560
- feedAPath: z93.string().min(1).max(1e3).describe("Filesystem path to feed A (YAML or JSON, auto-detected by extension)"),
44561
- feedBPath: z93.string().min(1).max(1e3).describe("Filesystem path to feed B"),
44562
- keyPath: z93.string().min(1).max(200).describe(
44702
+ var CompareDataFeedsInputSchema = z94.object({
44703
+ feedAPath: z94.string().min(1).max(1e3).describe("Filesystem path to feed A (YAML or JSON, auto-detected by extension)"),
44704
+ feedBPath: z94.string().min(1).max(1e3).describe("Filesystem path to feed B"),
44705
+ keyPath: z94.string().min(1).max(200).describe(
44563
44706
  'Dotted path to the entry key, e.g. "id" or "name". Each entry must have this field.'
44564
44707
  ),
44565
- compareFields: z93.array(z93.string().min(1).max(200)).max(20).optional().describe(
44708
+ compareFields: z94.array(z94.string().min(1).max(200)).max(20).optional().describe(
44566
44709
  'Optional dotted field paths to compare across matched entries (e.g. ["license", "sha256"])'
44567
44710
  )
44568
44711
  });
@@ -44686,7 +44829,7 @@ function buildSummary(feedAPath, feedBPath, diff, fieldDiffs, fields) {
44686
44829
  function loadFeed(feedPath) {
44687
44830
  const resolved = path10.resolve(feedPath);
44688
44831
  const cwdRoot = path10.resolve(".");
44689
- if (!resolved.startsWith(cwdRoot)) {
44832
+ if (resolved !== cwdRoot && !resolved.startsWith(cwdRoot + path10.sep)) {
44690
44833
  throw new Error(`Path traversal denied: ${feedPath} must be within ${cwdRoot}`);
44691
44834
  }
44692
44835
  if (!fs11.existsSync(resolved)) {
@@ -44746,24 +44889,24 @@ function createCompareDataFeedsHandler(deps) {
44746
44889
  };
44747
44890
  }
44748
44891
  var COMPARE_OUTPUT_SCHEMA = {
44749
- feedAPath: z93.string(),
44750
- feedBPath: z93.string(),
44751
- keyPath: z93.string(),
44752
- counts: z93.object({
44753
- entriesInA: z93.number(),
44754
- entriesInB: z93.number(),
44755
- onlyInA: z93.number(),
44756
- onlyInB: z93.number(),
44757
- inBoth: z93.number(),
44758
- fieldDifferences: z93.number()
44892
+ feedAPath: z94.string(),
44893
+ feedBPath: z94.string(),
44894
+ keyPath: z94.string(),
44895
+ counts: z94.object({
44896
+ entriesInA: z94.number(),
44897
+ entriesInB: z94.number(),
44898
+ onlyInA: z94.number(),
44899
+ onlyInB: z94.number(),
44900
+ inBoth: z94.number(),
44901
+ fieldDifferences: z94.number()
44759
44902
  }),
44760
- coverage: z93.object({
44761
- onlyInA: z93.array(z93.string()),
44762
- onlyInB: z93.array(z93.string()),
44763
- inBoth: z93.array(z93.string())
44903
+ coverage: z94.object({
44904
+ onlyInA: z94.array(z94.string()),
44905
+ onlyInB: z94.array(z94.string()),
44906
+ inBoth: z94.array(z94.string())
44764
44907
  }),
44765
- fieldDifferences: z93.array(z93.unknown()),
44766
- summary: z93.string()
44908
+ fieldDifferences: z94.array(z94.unknown()),
44909
+ summary: z94.string()
44767
44910
  };
44768
44911
  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.";
44769
44912
  function registerCompareDataFeedsTool(server, deps) {
@@ -44794,7 +44937,7 @@ function registerCompareDataFeedsTool(server, deps) {
44794
44937
  // src/mcp/tools/improvement-review.ts
44795
44938
  import { execFile as execFile3 } from "child_process";
44796
44939
  import { promisify as promisify3 } from "util";
44797
- import { z as z94 } from "zod";
44940
+ import { z as z95 } from "zod";
44798
44941
 
44799
44942
  // src/governance/fitness-score.ts
44800
44943
  import { existsSync as existsSync11, readFileSync as readFileSync9, readdirSync as readdirSync2, statSync as statSync2 } from "fs";
@@ -45371,13 +45514,13 @@ function calculateFitnessScore(version) {
45371
45514
 
45372
45515
  // src/mcp/tools/improvement-review.ts
45373
45516
  var execFileAsync3 = promisify3(execFile3);
45374
- var ImprovementReviewInputSchema = z94.object({
45375
- lookbackDays: z94.number().int().min(1).max(90).optional().default(7).describe("Lookback window for outcome data, in days. Default 7."),
45376
- fileIssues: z94.boolean().optional().default(false).describe(
45517
+ var ImprovementReviewInputSchema = z95.object({
45518
+ lookbackDays: z95.number().int().min(1).max(90).optional().default(7).describe("Lookback window for outcome data, in days. Default 7."),
45519
+ fileIssues: z95.boolean().optional().default(false).describe(
45377
45520
  "When true, file candidate issues via `gh issue create` for crossed thresholds (rate-limited to 5 per run, deduped against open issues). When false (default), return signals only."
45378
45521
  ),
45379
- minSampleSize: z94.number().int().min(1).max(1e3).optional().default(5).describe("Minimum sample size before a CLI/category signal can fire."),
45380
- fitnessFloor: z94.number().int().min(0).max(100).optional().default(90).describe("Fitness score below this threshold triggers a tech-debt signal.")
45522
+ minSampleSize: z95.number().int().min(1).max(1e3).optional().default(5).describe("Minimum sample size before a CLI/category signal can fire."),
45523
+ fitnessFloor: z95.number().int().min(0).max(100).optional().default(90).describe("Fitness score below this threshold triggers a tech-debt signal.")
45381
45524
  });
45382
45525
  var MAX_ISSUES_PER_RUN = 5;
45383
45526
  var HOUR_MS = 60 * 60 * 1e3;
@@ -45645,12 +45788,12 @@ async function reviewHandler(args, ctx) {
45645
45788
  }
45646
45789
  var description = "Periodic threshold-gated observability-driven improvement loop. Reads OutcomeStore + fitness audit, surfaces patterns crossing documented thresholds as candidate findings. When fileIssues=true, files candidate GitHub issues via `gh issue create` (rate-limited to 5 per run, deduped against open issues). Never auto-merges. Replaces the deleted self-development engine (#2402).";
45647
45790
  var TOOL_INPUT_SCHEMA = {
45648
- lookbackDays: z94.number().int().min(1).max(90).optional().describe("Lookback window for outcome data, in days. Default 7."),
45649
- fileIssues: z94.boolean().optional().describe(
45791
+ lookbackDays: z95.number().int().min(1).max(90).optional().describe("Lookback window for outcome data, in days. Default 7."),
45792
+ fileIssues: z95.boolean().optional().describe(
45650
45793
  "When true, file candidate issues for crossed thresholds (default false \u2014 return signals only)"
45651
45794
  ),
45652
- minSampleSize: z94.number().int().min(1).max(1e3).optional().describe("Minimum sample size before a CLI/category signal fires (default 5)."),
45653
- fitnessFloor: z94.number().int().min(0).max(100).optional().describe("Fitness score below this threshold triggers a tech-debt signal (default 90).")
45795
+ minSampleSize: z95.number().int().min(1).max(1e3).optional().describe("Minimum sample size before a CLI/category signal fires (default 5)."),
45796
+ fitnessFloor: z95.number().int().min(0).max(100).optional().describe("Fitness score below this threshold triggers a tech-debt signal (default 90).")
45654
45797
  };
45655
45798
  function registerImprovementReviewTool(server, deps) {
45656
45799
  const logger52 = deps.logger ?? createLogger({ tool: "improvement_review" });
@@ -45678,9 +45821,9 @@ function registerImprovementReviewTool(server, deps) {
45678
45821
  }
45679
45822
 
45680
45823
  // src/mcp/tools/query-task-state-tool.ts
45681
- import { z as z95 } from "zod";
45682
- var QueryTaskStateInputSchema = z95.object({
45683
- taskId: z95.string().min(1).max(128).describe("Task ID whose structured state log should be read")
45824
+ import { z as z96 } from "zod";
45825
+ var QueryTaskStateInputSchema = z96.object({
45826
+ taskId: z96.string().min(1).max(128).describe("Task ID whose structured state log should be read")
45684
45827
  });
45685
45828
  function queryTaskStateHandler(args, ctx) {
45686
45829
  const parsed = QueryTaskStateInputSchema.safeParse(args);
@@ -45715,7 +45858,7 @@ function queryTaskStateHandler(args, ctx) {
45715
45858
  function registerQueryTaskStateTool(server, deps) {
45716
45859
  const logger52 = deps.logger ?? createLogger({ tool: "query_task_state" });
45717
45860
  const toolSchema = {
45718
- taskId: z95.string().min(1).max(128).describe("Task ID whose structured state log should be read")
45861
+ taskId: z96.string().min(1).max(128).describe("Task ID whose structured state log should be read")
45719
45862
  };
45720
45863
  const description2 = "Read the structured state log for a task ID and return the current snapshot. Includes Magentic-One Task Ledger (facts/guesses/openQuestions) and Progress Ledger (per-step reflections with suggestedAction) when orchestrators have written them. Structured state is only written when NEXUS_TASK_STATE_ENABLED=1 was set during the orchestrate invocation.";
45721
45864
  const secureHandler = createSecureHandler(queryTaskStateHandler, {
@@ -45739,9 +45882,9 @@ function registerQueryTaskStateTool(server, deps) {
45739
45882
  // src/mcp/tools/verify-audit-chain-tool.ts
45740
45883
  import * as fs12 from "fs/promises";
45741
45884
  import * as path11 from "path";
45742
- import { z as z96 } from "zod";
45743
- var VerifyAuditChainInputSchema = z96.object({
45744
- logDir: z96.string().min(1).max(512).describe(
45885
+ import { z as z97 } from "zod";
45886
+ var VerifyAuditChainInputSchema = z97.object({
45887
+ logDir: z97.string().min(1).max(512).describe(
45745
45888
  "Filesystem path to the FileAuditStorage log directory. Tool reads all `audit-*.jsonl` files in lexicographic order and verifies the combined chain."
45746
45889
  )
45747
45890
  });
@@ -45818,7 +45961,7 @@ async function handler2(args, ctx) {
45818
45961
  function registerVerifyAuditChainTool(server, deps) {
45819
45962
  const logger52 = deps.logger ?? createLogger({ tool: "verify_audit_chain" });
45820
45963
  const toolSchema = {
45821
- logDir: z96.string().min(1).max(512).describe(
45964
+ logDir: z97.string().min(1).max(512).describe(
45822
45965
  "Filesystem path to the FileAuditStorage log directory. Tool reads all `audit-*.jsonl` files and verifies the combined hash chain."
45823
45966
  )
45824
45967
  };
@@ -45842,18 +45985,18 @@ function registerVerifyAuditChainTool(server, deps) {
45842
45985
  }
45843
45986
 
45844
45987
  // src/mcp/tools/pipeline-tool.ts
45845
- import { z as z97 } from "zod";
45988
+ import { z as z98 } from "zod";
45846
45989
  import * as fs13 from "fs";
45847
45990
  import * as path12 from "path";
45848
- var PipelineInputSchema = z97.object({
45991
+ var PipelineInputSchema = z98.object({
45849
45992
  /** The task to execute. */
45850
- task: z97.string().min(5).max(1e4).describe("Task description \u2014 pipeline template auto-selected based on content"),
45993
+ task: z98.string().min(5).max(1e4).describe("Task description \u2014 pipeline template auto-selected based on content"),
45851
45994
  /** Path to a spec file (.md, .yaml) to use as task input. */
45852
- specFile: z97.string().max(500).optional().describe("Path to a spec file \u2014 content prepended to task for greenfield projects"),
45995
+ specFile: z98.string().max(500).optional().describe("Path to a spec file \u2014 content prepended to task for greenfield projects"),
45853
45996
  /** Override template — see `listTemplateIds()` for the canonical list (#2728). Auto-detected if omitted. */
45854
- template: z97.string().max(50).optional().describe(`Pipeline template override. Available: ${listTemplateIds().join(", ")}`),
45997
+ template: z98.string().max(50).optional().describe(`Pipeline template override. Available: ${listTemplateIds().join(", ")}`),
45855
45998
  /** Voting strategy for consensus stages. */
45856
- votingStrategy: z97.enum([
45999
+ votingStrategy: z98.enum([
45857
46000
  "simple_majority",
45858
46001
  "supermajority",
45859
46002
  "unanimous",
@@ -45864,13 +46007,13 @@ var PipelineInputSchema = z97.object({
45864
46007
  "Voting strategy for plan approval. simple_majority (default), supermajority (67%), unanimous, higher_order (Bayesian), proof_of_learning, opinion_wise"
45865
46008
  ),
45866
46009
  /** Use 3 agents instead of 6 for faster voting. */
45867
- quickMode: z97.boolean().default(false).describe("Use 3 agents instead of 6 for faster consensus voting"),
46010
+ quickMode: z98.boolean().default(false).describe("Use 3 agents instead of 6 for faster consensus voting"),
45868
46011
  /** Maximum execution time per stage in milliseconds (min 30s, max 600s). */
45869
- timeoutMs: z97.number().int().min(3e4).max(6e5).optional().describe("Max time per stage in ms (30000-600000). Default: varies by stage complexity"),
46012
+ timeoutMs: z98.number().int().min(3e4).max(6e5).optional().describe("Max time per stage in ms (30000-600000). Default: varies by stage complexity"),
45870
46013
  /** Stop after planning/voting (no implementation). */
45871
- dryRun: z97.boolean().default(false).describe("Stop after vote stage (no implementation)"),
46014
+ dryRun: z98.boolean().default(false).describe("Stop after vote stage (no implementation)"),
45872
46015
  /** TESTS ONLY — random output, must not be used for real decisions. (#2319) */
45873
- simulateVotes: z97.boolean().default(false).describe("TESTS ONLY \u2014 random output, must not be used for real decisions (#2319)")
46016
+ simulateVotes: z98.boolean().default(false).describe("TESTS ONLY \u2014 random output, must not be used for real decisions (#2319)")
45874
46017
  });
45875
46018
  function buildOutput2(result) {
45876
46019
  return {
@@ -45889,7 +46032,7 @@ async function resolveTask(task, specFile) {
45889
46032
  if (specFile === void 0) return task;
45890
46033
  const resolved = path12.resolve(specFile);
45891
46034
  const cwdRoot = path12.resolve(".");
45892
- if (!resolved.startsWith(cwdRoot)) {
46035
+ if (resolved !== cwdRoot && !resolved.startsWith(cwdRoot + path12.sep)) {
45893
46036
  throw new Error(`Path traversal denied: specFile must be within ${cwdRoot}`);
45894
46037
  }
45895
46038
  try {
@@ -45972,7 +46115,7 @@ function registerPipelineTool(server, deps) {
45972
46115
  }
45973
46116
 
45974
46117
  // src/mcp/tools/supply-chain-tradeoff-panel.ts
45975
- import { z as z98 } from "zod";
46118
+ import { z as z99 } from "zod";
45976
46119
  var DEFAULT_AXES = [
45977
46120
  "build_time_determinism",
45978
46121
  "supply_chain_risk",
@@ -45992,16 +46135,16 @@ var FULL_PANEL = [
45992
46135
  "scope_steward"
45993
46136
  ];
45994
46137
  var QUICK_PANEL = ["architect", "security", "scope_steward"];
45995
- var SupplyChainTradeoffPanelInputSchema = z98.object({
45996
- proposal: z98.string().min(1).max(MAX_PROPOSAL_LENGTH).describe('The proposal under tradeoff review (e.g. "Should aegis-boot adopt cargo-nextest?")'),
45997
- axes: z98.array(z98.string().min(1).max(MAX_AXIS_NAME_LENGTH)).min(1).max(MAX_AXES).optional().describe(
46138
+ var SupplyChainTradeoffPanelInputSchema = z99.object({
46139
+ proposal: z99.string().min(1).max(MAX_PROPOSAL_LENGTH).describe('The proposal under tradeoff review (e.g. "Should aegis-boot adopt cargo-nextest?")'),
46140
+ axes: z99.array(z99.string().min(1).max(MAX_AXIS_NAME_LENGTH)).min(1).max(MAX_AXES).optional().describe(
45998
46141
  `Tradeoff axes to evaluate. Default: ${DEFAULT_AXES.join(", ")}. Custom axes accepted; max ${String(MAX_AXES)}.`
45999
46142
  ),
46000
- context: z98.string().max(MAX_CONTEXT_LENGTH).optional().describe(
46143
+ context: z99.string().max(MAX_CONTEXT_LENGTH).optional().describe(
46001
46144
  "Optional context: relevant repo state, dependency tree, vendor publishing patterns, etc."
46002
46145
  ),
46003
- quickMode: z98.boolean().optional().default(false).describe("Use 3 voters (architect, security, scope_steward) instead of 7"),
46004
- simulate: z98.boolean().optional().default(false).describe("Use simulated voters (testing only)")
46146
+ quickMode: z99.boolean().optional().default(false).describe("Use 3 voters (architect, security, scope_steward) instead of 7"),
46147
+ simulate: z99.boolean().optional().default(false).describe("Use simulated voters (testing only)")
46005
46148
  });
46006
46149
  function buildTradeoffProposal(input) {
46007
46150
  const axes = input.axes ?? DEFAULT_AXES;
@@ -46997,40 +47140,40 @@ var RiskLevel = /* @__PURE__ */ ((RiskLevel2) => {
46997
47140
  })(RiskLevel || {});
46998
47141
 
46999
47142
  // src/mcp/safety/stpa-schemas.ts
47000
- import { z as z99 } from "zod";
47001
- var HazardCategorySchema = z99.enum(HazardCategory);
47002
- var HazardSeveritySchema = z99.enum(HazardSeverity);
47003
- var ConstraintPrioritySchema = z99.enum(ConstraintPriority);
47004
- var RiskLevelSchema = z99.enum(RiskLevel);
47005
- var TriggerPatternSchema = z99.object({
47006
- parameter: z99.string().min(1),
47007
- matchType: z99.enum(["contains", "regex", "equals", "startsWith", "endsWith"]),
47008
- pattern: z99.string(),
47009
- reason: z99.string()
47143
+ import { z as z100 } from "zod";
47144
+ var HazardCategorySchema = z100.enum(HazardCategory);
47145
+ var HazardSeveritySchema = z100.enum(HazardSeverity);
47146
+ var ConstraintPrioritySchema = z100.enum(ConstraintPriority);
47147
+ var RiskLevelSchema = z100.enum(RiskLevel);
47148
+ var TriggerPatternSchema = z100.object({
47149
+ parameter: z100.string().min(1),
47150
+ matchType: z100.enum(["contains", "regex", "equals", "startsWith", "endsWith"]),
47151
+ pattern: z100.string(),
47152
+ reason: z100.string()
47010
47153
  });
47011
- var HazardSchema = z99.object({
47012
- id: z99.string().min(1),
47013
- description: z99.string(),
47154
+ var HazardSchema = z100.object({
47155
+ id: z100.string().min(1),
47156
+ description: z100.string(),
47014
47157
  category: HazardCategorySchema,
47015
47158
  severity: HazardSeveritySchema,
47016
- likelihood: z99.enum(["almost_certain", "likely", "possible", "unlikely", "rare"]),
47017
- triggerConditions: z99.array(z99.string()),
47018
- consequences: z99.array(z99.string())
47159
+ likelihood: z100.enum(["almost_certain", "likely", "possible", "unlikely", "rare"]),
47160
+ triggerConditions: z100.array(z100.string()),
47161
+ consequences: z100.array(z100.string())
47019
47162
  });
47020
- var UnsafeControlActionSchema = z99.object({
47021
- id: z99.string().min(1),
47022
- toolName: z99.string().min(1),
47023
- type: z99.enum(["not_provided", "provided_causes_hazard", "wrong_timing", "wrong_duration"]),
47024
- description: z99.string(),
47025
- unsafeContext: z99.string(),
47026
- relatedHazards: z99.array(z99.string()),
47027
- triggerPatterns: z99.array(TriggerPatternSchema).optional()
47163
+ var UnsafeControlActionSchema = z100.object({
47164
+ id: z100.string().min(1),
47165
+ toolName: z100.string().min(1),
47166
+ type: z100.enum(["not_provided", "provided_causes_hazard", "wrong_timing", "wrong_duration"]),
47167
+ description: z100.string(),
47168
+ unsafeContext: z100.string(),
47169
+ relatedHazards: z100.array(z100.string()),
47170
+ triggerPatterns: z100.array(TriggerPatternSchema).optional()
47028
47171
  });
47029
- var SafetyConstraintSchema = z99.object({
47030
- id: z99.string().min(1),
47031
- description: z99.string(),
47032
- mitigates: z99.array(z99.string()),
47033
- enforcement: z99.enum([
47172
+ var SafetyConstraintSchema = z100.object({
47173
+ id: z100.string().min(1),
47174
+ description: z100.string(),
47175
+ mitigates: z100.array(z100.string()),
47176
+ enforcement: z100.enum([
47034
47177
  "prevent",
47035
47178
  "require_confirmation",
47036
47179
  "alert",
@@ -47038,54 +47181,54 @@ var SafetyConstraintSchema = z99.object({
47038
47181
  "rate_limit",
47039
47182
  "require_privilege"
47040
47183
  ]),
47041
- validationFunction: z99.string().optional(),
47184
+ validationFunction: z100.string().optional(),
47042
47185
  priority: ConstraintPrioritySchema
47043
47186
  });
47044
- var PropertySchemaSchema = z99.object({
47045
- type: z99.string(),
47046
- description: z99.string().optional(),
47047
- enum: z99.array(z99.unknown()).optional(),
47048
- pattern: z99.string().optional(),
47049
- minimum: z99.number().optional(),
47050
- maximum: z99.number().optional()
47187
+ var PropertySchemaSchema = z100.object({
47188
+ type: z100.string(),
47189
+ description: z100.string().optional(),
47190
+ enum: z100.array(z100.unknown()).optional(),
47191
+ pattern: z100.string().optional(),
47192
+ minimum: z100.number().optional(),
47193
+ maximum: z100.number().optional()
47051
47194
  });
47052
- var ToolInputSchemaSchema = z99.object({
47053
- type: z99.string(),
47054
- properties: z99.record(z99.string(), PropertySchemaSchema).optional(),
47055
- required: z99.array(z99.string()).optional(),
47056
- additionalProperties: z99.boolean().optional()
47195
+ var ToolInputSchemaSchema = z100.object({
47196
+ type: z100.string(),
47197
+ properties: z100.record(z100.string(), PropertySchemaSchema).optional(),
47198
+ required: z100.array(z100.string()).optional(),
47199
+ additionalProperties: z100.boolean().optional()
47057
47200
  });
47058
- var ToolDefinitionSchema = z99.object({
47059
- name: z99.string().min(1),
47060
- description: z99.string(),
47201
+ var ToolDefinitionSchema = z100.object({
47202
+ name: z100.string().min(1),
47203
+ description: z100.string(),
47061
47204
  inputSchema: ToolInputSchemaSchema
47062
47205
  });
47063
- var AnalysisConfigurationSchema = z99.object({
47064
- includeLowSeverity: z99.boolean().default(true),
47065
- generateAllConstraints: z99.boolean().default(true),
47066
- checkInteractions: z99.boolean().default(true),
47067
- maxHazardsPerTool: z99.number().int().min(1).max(100).default(50),
47068
- categories: z99.array(HazardCategorySchema).default([])
47206
+ var AnalysisConfigurationSchema = z100.object({
47207
+ includeLowSeverity: z100.boolean().default(true),
47208
+ generateAllConstraints: z100.boolean().default(true),
47209
+ checkInteractions: z100.boolean().default(true),
47210
+ maxHazardsPerTool: z100.number().int().min(1).max(100).default(50),
47211
+ categories: z100.array(HazardCategorySchema).default([])
47069
47212
  });
47070
- var ConstraintViolationSchema = z99.object({
47071
- constraintId: z99.string().min(1),
47072
- constraintDescription: z99.string(),
47213
+ var ConstraintViolationSchema = z100.object({
47214
+ constraintId: z100.string().min(1),
47215
+ constraintDescription: z100.string(),
47073
47216
  severity: HazardSeveritySchema,
47074
- details: z99.string(),
47075
- remediation: z99.string()
47217
+ details: z100.string(),
47218
+ remediation: z100.string()
47076
47219
  });
47077
- var ValidationWarningSchema = z99.object({
47078
- code: z99.string().min(1),
47079
- message: z99.string(),
47080
- affected: z99.string()
47220
+ var ValidationWarningSchema = z100.object({
47221
+ code: z100.string().min(1),
47222
+ message: z100.string(),
47223
+ affected: z100.string()
47081
47224
  });
47082
- var ValidationResultSchema = z99.object({
47083
- valid: z99.boolean(),
47084
- toolName: z99.string().min(1),
47085
- violations: z99.array(ConstraintViolationSchema),
47086
- passed: z99.array(z99.string()),
47087
- warnings: z99.array(ValidationWarningSchema),
47088
- validatedAt: z99.date()
47225
+ var ValidationResultSchema = z100.object({
47226
+ valid: z100.boolean(),
47227
+ toolName: z100.string().min(1),
47228
+ violations: z100.array(ConstraintViolationSchema),
47229
+ passed: z100.array(z100.string()),
47230
+ warnings: z100.array(ValidationWarningSchema),
47231
+ validatedAt: z100.date()
47089
47232
  });
47090
47233
 
47091
47234
  // src/mcp/safety/stpa-types.ts
@@ -48170,53 +48313,53 @@ var GeminiResponseParser = class {
48170
48313
  };
48171
48314
 
48172
48315
  // src/cli-adapters/router-types.ts
48173
- import { z as z100 } from "zod";
48174
- var RouterConfigSchema = z100.object({
48175
- minCapacityThreshold: z100.number().min(0).max(1).default(0.1),
48176
- preferCostEfficient: z100.boolean().default(false),
48177
- maxDecisionTimeMs: z100.number().min(1).max(1e3).default(100)
48316
+ import { z as z101 } from "zod";
48317
+ var RouterConfigSchema = z101.object({
48318
+ minCapacityThreshold: z101.number().min(0).max(1).default(0.1),
48319
+ preferCostEfficient: z101.boolean().default(false),
48320
+ maxDecisionTimeMs: z101.number().min(1).max(1e3).default(100)
48178
48321
  });
48179
48322
 
48180
48323
  // src/cli-adapters/agreement-cascade-types.ts
48181
- import { z as z101 } from "zod";
48182
- var AgreementCascadeConfigSchema = z101.object({
48183
- agreementThreshold: z101.number().min(0.5).max(1).default(0.7),
48184
- maxStages: z101.number().int().min(1).max(5).default(3),
48185
- modelTimeoutMs: z101.number().int().min(1e3).max(3e5).default(6e4)
48324
+ import { z as z102 } from "zod";
48325
+ var AgreementCascadeConfigSchema = z102.object({
48326
+ agreementThreshold: z102.number().min(0.5).max(1).default(0.7),
48327
+ maxStages: z102.number().int().min(1).max(5).default(3),
48328
+ modelTimeoutMs: z102.number().int().min(1e3).max(3e5).default(6e4)
48186
48329
  });
48187
48330
 
48188
48331
  // src/cli-adapters/agreement-cascade-router.ts
48189
48332
  var logger43 = createLogger({ component: "agreement-cascade-router" });
48190
48333
 
48191
48334
  // src/cli-adapters/daao-types.ts
48192
- import { z as z102 } from "zod";
48193
- var EncodedFeaturesSchema = z102.object({
48335
+ import { z as z103 } from "zod";
48336
+ var EncodedFeaturesSchema = z103.object({
48194
48337
  /** Lexical complexity score (vocabulary diversity, rare words) */
48195
- lexicalComplexity: z102.number().min(0).max(1),
48338
+ lexicalComplexity: z103.number().min(0).max(1),
48196
48339
  /** Syntactic complexity score (sentence structure, nesting) */
48197
- syntacticComplexity: z102.number().min(0).max(1),
48340
+ syntacticComplexity: z103.number().min(0).max(1),
48198
48341
  /** Semantic density score (concept density, abstraction level) */
48199
- semanticDensity: z102.number().min(0).max(1),
48342
+ semanticDensity: z103.number().min(0).max(1),
48200
48343
  /** Technical specificity (domain-specific terminology) */
48201
- technicalSpecificity: z102.number().min(0).max(1),
48344
+ technicalSpecificity: z103.number().min(0).max(1),
48202
48345
  /** Task scope (breadth of requirements) */
48203
- taskScope: z102.number().min(0).max(1),
48346
+ taskScope: z103.number().min(0).max(1),
48204
48347
  /** Constraint complexity (constraints, edge cases, requirements) */
48205
- constraintComplexity: z102.number().min(0).max(1),
48348
+ constraintComplexity: z103.number().min(0).max(1),
48206
48349
  /** Ambiguity level (inverse - higher means more clear/specific) */
48207
- clarity: z102.number().min(0).max(1),
48350
+ clarity: z103.number().min(0).max(1),
48208
48351
  /** Output complexity expectation */
48209
- outputComplexity: z102.number().min(0).max(1)
48352
+ outputComplexity: z103.number().min(0).max(1)
48210
48353
  });
48211
- var FeatureWeightsSchema = z102.object({
48212
- lexicalComplexity: z102.number().min(0).max(1),
48213
- syntacticComplexity: z102.number().min(0).max(1),
48214
- semanticDensity: z102.number().min(0).max(1),
48215
- technicalSpecificity: z102.number().min(0).max(1),
48216
- taskScope: z102.number().min(0).max(1),
48217
- constraintComplexity: z102.number().min(0).max(1),
48218
- clarity: z102.number().min(0).max(1),
48219
- outputComplexity: z102.number().min(0).max(1)
48354
+ var FeatureWeightsSchema = z103.object({
48355
+ lexicalComplexity: z103.number().min(0).max(1),
48356
+ syntacticComplexity: z103.number().min(0).max(1),
48357
+ semanticDensity: z103.number().min(0).max(1),
48358
+ technicalSpecificity: z103.number().min(0).max(1),
48359
+ taskScope: z103.number().min(0).max(1),
48360
+ constraintComplexity: z103.number().min(0).max(1),
48361
+ clarity: z103.number().min(0).max(1),
48362
+ outputComplexity: z103.number().min(0).max(1)
48220
48363
  });
48221
48364
  var DEFAULT_FEATURE_WEIGHTS = {
48222
48365
  lexicalComplexity: 0.1,
@@ -48238,50 +48381,50 @@ var DEFAULT_DAAO_TIER_TO_CLIS = {
48238
48381
  balanced: ["codex", "opencode", "gemini", "claude"],
48239
48382
  powerful: ["claude", "codex", "opencode", "gemini"]
48240
48383
  };
48241
- var DAAOConfigSchema = z102.object({
48384
+ var DAAOConfigSchema = z103.object({
48242
48385
  /** Difficulty thresholds for level classification */
48243
- thresholds: z102.object({
48244
- easyUpperBound: z102.number().min(0).max(1),
48245
- hardLowerBound: z102.number().min(0).max(1)
48386
+ thresholds: z103.object({
48387
+ easyUpperBound: z103.number().min(0).max(1),
48388
+ hardLowerBound: z103.number().min(0).max(1)
48246
48389
  }).default(DEFAULT_DAAO_THRESHOLDS),
48247
48390
  /** Feature weights for difficulty aggregation */
48248
48391
  weights: FeatureWeightsSchema.default(DEFAULT_FEATURE_WEIGHTS),
48249
48392
  /** Mapping from model tier to CLI preference order */
48250
- tierToClis: z102.record(
48251
- z102.enum(["fast", "balanced", "powerful"]),
48252
- z102.array(z102.enum(["claude", "gemini", "codex", "opencode"]))
48393
+ tierToClis: z103.record(
48394
+ z103.enum(["fast", "balanced", "powerful"]),
48395
+ z103.array(z103.enum(["claude", "gemini", "codex", "opencode"]))
48253
48396
  ).default(DEFAULT_DAAO_TIER_TO_CLIS),
48254
48397
  /** Enable adaptive calibration from outcomes */
48255
- enableCalibration: z102.boolean().default(true),
48398
+ enableCalibration: z103.boolean().default(true),
48256
48399
  /** Maximum outcomes to store for calibration */
48257
- maxCalibrationOutcomes: z102.number().int().positive().default(1e3),
48400
+ maxCalibrationOutcomes: z103.number().int().positive().default(1e3),
48258
48401
  /** Minimum outcomes before applying calibration adjustments */
48259
- minCalibrationOutcomes: z102.number().int().positive().default(50),
48402
+ minCalibrationOutcomes: z103.number().int().positive().default(50),
48260
48403
  /** Reconstruction error threshold for typical patterns */
48261
- typicalPatternThreshold: z102.number().min(0).max(1).default(0.3),
48404
+ typicalPatternThreshold: z103.number().min(0).max(1).default(0.3),
48262
48405
  /** Verbose logging */
48263
- verbose: z102.boolean().default(false)
48406
+ verbose: z103.boolean().default(false)
48264
48407
  });
48265
48408
 
48266
48409
  // src/cli-adapters/task-classifier.ts
48267
- import { z as z103 } from "zod";
48268
- var ClassificationPatternsSchema = z103.object({
48269
- code: z103.array(z103.string()).readonly(),
48270
- research: z103.array(z103.string()).readonly(),
48271
- documentation: z103.array(z103.string()).readonly(),
48272
- analysis: z103.array(z103.string()).readonly()
48410
+ import { z as z104 } from "zod";
48411
+ var ClassificationPatternsSchema = z104.object({
48412
+ code: z104.array(z104.string()).readonly(),
48413
+ research: z104.array(z104.string()).readonly(),
48414
+ documentation: z104.array(z104.string()).readonly(),
48415
+ analysis: z104.array(z104.string()).readonly()
48273
48416
  });
48274
48417
 
48275
48418
  // src/cli-adapters/response-cache-types.ts
48276
- import { z as z104 } from "zod";
48277
- var ResponseCacheConfigSchema = z104.object({
48278
- defaultTTL: z104.number().min(1e3).max(36e5).default(3e5),
48419
+ import { z as z105 } from "zod";
48420
+ var ResponseCacheConfigSchema = z105.object({
48421
+ defaultTTL: z105.number().min(1e3).max(36e5).default(3e5),
48279
48422
  // 5 minutes
48280
- maxEntries: z104.number().min(10).max(1e5).default(1e3),
48281
- maxMemoryMB: z104.number().min(1).max(1e3).default(50),
48282
- cleanupInterval: z104.number().min(1e3).max(6e5).default(6e4),
48423
+ maxEntries: z105.number().min(10).max(1e5).default(1e3),
48424
+ maxMemoryMB: z105.number().min(1).max(1e3).default(50),
48425
+ cleanupInterval: z105.number().min(1e3).max(6e5).default(6e4),
48283
48426
  // 1 minute
48284
- enableLogging: z104.boolean().default(false)
48427
+ enableLogging: z105.boolean().default(false)
48285
48428
  });
48286
48429
 
48287
48430
  // src/cli-adapters/response-cache-utils.ts
@@ -48289,12 +48432,12 @@ import { createHash as createHash4 } from "crypto";
48289
48432
  var logger44 = createLogger({ component: "ResponseCacheUtils" });
48290
48433
 
48291
48434
  // src/cli-adapters/unified-routing-types.ts
48292
- import { z as z105 } from "zod";
48293
- var UnifiedRoutingDecisionSchema = z105.object({
48294
- selectedCli: z105.string(),
48295
- confidence: z105.number().min(0).max(1),
48296
- reason: z105.string(),
48297
- strategy: z105.enum([
48435
+ import { z as z106 } from "zod";
48436
+ var UnifiedRoutingDecisionSchema = z106.object({
48437
+ selectedCli: z106.string(),
48438
+ confidence: z106.number().min(0).max(1),
48439
+ reason: z106.string(),
48440
+ strategy: z106.enum([
48298
48441
  "composite",
48299
48442
  "quality",
48300
48443
  "budget",
@@ -48306,57 +48449,57 @@ var UnifiedRoutingDecisionSchema = z105.object({
48306
48449
  "linucb",
48307
48450
  "direct"
48308
48451
  ]),
48309
- decisionTimeMs: z105.number().nonnegative(),
48310
- alternatives: z105.array(z105.string()).readonly(),
48311
- stagesExecuted: z105.array(z105.string()).readonly(),
48312
- withinBudget: z105.boolean().optional(),
48313
- estimatedComplexity: z105.enum(["simple", "moderate", "complex", "expert"]).optional(),
48314
- estimatedTokens: z105.number().int().positive().optional(),
48315
- topsisScore: z105.number().optional(),
48316
- ucbScore: z105.number().optional(),
48317
- resolvedAtStage: z105.number().int().nonnegative().optional(),
48318
- consensusReached: z105.boolean().optional(),
48319
- agreementScore: z105.number().min(0).max(1).optional(),
48320
- metadata: z105.record(z105.string(), z105.unknown()).optional()
48452
+ decisionTimeMs: z106.number().nonnegative(),
48453
+ alternatives: z106.array(z106.string()).readonly(),
48454
+ stagesExecuted: z106.array(z106.string()).readonly(),
48455
+ withinBudget: z106.boolean().optional(),
48456
+ estimatedComplexity: z106.enum(["simple", "moderate", "complex", "expert"]).optional(),
48457
+ estimatedTokens: z106.number().int().positive().optional(),
48458
+ topsisScore: z106.number().optional(),
48459
+ ucbScore: z106.number().optional(),
48460
+ resolvedAtStage: z106.number().int().nonnegative().optional(),
48461
+ consensusReached: z106.boolean().optional(),
48462
+ agreementScore: z106.number().min(0).max(1).optional(),
48463
+ metadata: z106.record(z106.string(), z106.unknown()).optional()
48321
48464
  });
48322
48465
 
48323
48466
  // src/learning/outcome-feedback-types.ts
48324
- import { z as z106 } from "zod";
48325
- var QualitySignalsSchema = z106.object({
48326
- testsPass: z106.boolean().optional(),
48327
- lintErrors: z106.number().int().min(0).optional(),
48328
- userApproved: z106.boolean().optional(),
48329
- retryCount: z106.number().int().min(0).default(0),
48330
- completionRatio: z106.number().min(0).max(1).default(1),
48331
- validStructure: z106.boolean().optional(),
48332
- coherenceScore: z106.number().min(0).max(1).optional()
48467
+ import { z as z107 } from "zod";
48468
+ var QualitySignalsSchema = z107.object({
48469
+ testsPass: z107.boolean().optional(),
48470
+ lintErrors: z107.number().int().min(0).optional(),
48471
+ userApproved: z107.boolean().optional(),
48472
+ retryCount: z107.number().int().min(0).default(0),
48473
+ completionRatio: z107.number().min(0).max(1).default(1),
48474
+ validStructure: z107.boolean().optional(),
48475
+ coherenceScore: z107.number().min(0).max(1).optional()
48333
48476
  });
48334
- var RoutingDecisionSchema = z106.object({
48335
- id: z106.uuid(),
48336
- timestamp: z106.iso.datetime(),
48337
- query: z106.string(),
48338
- routerType: z106.enum(["linucb", "preference", "quality", "cascade", "topsis"]),
48339
- selectedModel: z106.string(),
48340
- selectedTier: z106.enum(["strong", "weak"]).optional(),
48341
- armIndex: z106.number().int().min(0).optional(),
48342
- banditContext: z106.record(z106.string(), z106.unknown()).optional(),
48343
- queryFeatures: z106.record(z106.string(), z106.unknown()).optional(),
48344
- ucbScore: z106.number().optional(),
48345
- confidence: z106.number().min(0).max(1).optional(),
48346
- traceId: z106.string(),
48347
- domain: z106.string().optional()
48477
+ var RoutingDecisionSchema = z107.object({
48478
+ id: z107.uuid(),
48479
+ timestamp: z107.iso.datetime(),
48480
+ query: z107.string(),
48481
+ routerType: z107.enum(["linucb", "preference", "quality", "cascade", "topsis"]),
48482
+ selectedModel: z107.string(),
48483
+ selectedTier: z107.enum(["strong", "weak"]).optional(),
48484
+ armIndex: z107.number().int().min(0).optional(),
48485
+ banditContext: z107.record(z107.string(), z107.unknown()).optional(),
48486
+ queryFeatures: z107.record(z107.string(), z107.unknown()).optional(),
48487
+ ucbScore: z107.number().optional(),
48488
+ confidence: z107.number().min(0).max(1).optional(),
48489
+ traceId: z107.string(),
48490
+ domain: z107.string().optional()
48348
48491
  });
48349
- var TaskOutcomeSchema = z106.object({
48350
- routingDecisionId: z106.uuid(),
48351
- timestamp: z106.iso.datetime(),
48352
- outcomeClass: z106.enum(["success", "partial", "failure", "timeout", "error"]),
48353
- success: z106.boolean(),
48354
- qualityScore: z106.number().min(0).max(1),
48355
- durationMs: z106.number().min(0),
48356
- tokenUsage: z106.number().int().min(0),
48357
- errorMessage: z106.string().optional(),
48492
+ var TaskOutcomeSchema = z107.object({
48493
+ routingDecisionId: z107.uuid(),
48494
+ timestamp: z107.iso.datetime(),
48495
+ outcomeClass: z107.enum(["success", "partial", "failure", "timeout", "error"]),
48496
+ success: z107.boolean(),
48497
+ qualityScore: z107.number().min(0).max(1),
48498
+ durationMs: z107.number().min(0),
48499
+ tokenUsage: z107.number().int().min(0),
48500
+ errorMessage: z107.string().optional(),
48358
48501
  qualitySignals: QualitySignalsSchema,
48359
- traceId: z106.string()
48502
+ traceId: z107.string()
48360
48503
  });
48361
48504
  var DEFAULT_FEEDBACK_COLLECTOR_CONFIG = {
48362
48505
  maxPendingDecisions: 1e3,
@@ -48371,17 +48514,17 @@ var DEFAULT_FEEDBACK_COLLECTOR_CONFIG = {
48371
48514
  targetTokenUsage: 2e3,
48372
48515
  maxHistorySize: 1e4
48373
48516
  };
48374
- var FeedbackCollectorConfigSchema = z106.object({
48375
- maxPendingDecisions: z106.number().int().positive().default(1e3),
48376
- pendingTimeoutMs: z106.number().positive().default(3e5),
48377
- enableAutoReward: z106.boolean().default(true),
48378
- qualityWeight: z106.number().min(0).max(1).default(0.5),
48379
- speedWeight: z106.number().min(0).max(1).default(0.2),
48380
- efficiencyWeight: z106.number().min(0).max(1).default(0.2),
48381
- retryPenalty: z106.number().min(0).max(1).default(0.1),
48382
- targetDurationMs: z106.number().positive().default(5e3),
48383
- targetTokenUsage: z106.number().positive().default(2e3),
48384
- maxHistorySize: z106.number().int().positive().default(1e4)
48517
+ var FeedbackCollectorConfigSchema = z107.object({
48518
+ maxPendingDecisions: z107.number().int().positive().default(1e3),
48519
+ pendingTimeoutMs: z107.number().positive().default(3e5),
48520
+ enableAutoReward: z107.boolean().default(true),
48521
+ qualityWeight: z107.number().min(0).max(1).default(0.5),
48522
+ speedWeight: z107.number().min(0).max(1).default(0.2),
48523
+ efficiencyWeight: z107.number().min(0).max(1).default(0.2),
48524
+ retryPenalty: z107.number().min(0).max(1).default(0.1),
48525
+ targetDurationMs: z107.number().positive().default(5e3),
48526
+ targetTokenUsage: z107.number().positive().default(2e3),
48527
+ maxHistorySize: z107.number().int().positive().default(1e4)
48385
48528
  });
48386
48529
 
48387
48530
  // src/learning/outcome-feedback-helpers.ts
@@ -49445,7 +49588,7 @@ function getPolicy(id) {
49445
49588
  // src/security/sandbox/sandbox-executor.ts
49446
49589
  import { execFile as execFile4 } from "child_process";
49447
49590
  import { promisify as promisify4 } from "util";
49448
- import { resolve as resolve17, normalize as normalize2, sep as sep6 } from "path";
49591
+ import { resolve as resolve17, normalize as normalize2, sep as sep10 } from "path";
49449
49592
  var execFileAsync4 = promisify4(execFile4);
49450
49593
  var logger46 = createLogger({ component: "sandbox-executor" });
49451
49594
  function parseExecError(error) {
@@ -49528,7 +49671,7 @@ var PolicySandboxExecutor = class {
49528
49671
  const normalizedCwd = normalize2(resolve17(cwd));
49529
49672
  const isAllowed = policy.pathRules.some((rule) => {
49530
49673
  const normalizedRule = normalize2(resolve17(rule.path));
49531
- const isUnderRule = normalizedCwd === normalizedRule || normalizedCwd.startsWith(normalizedRule + sep6);
49674
+ const isUnderRule = normalizedCwd === normalizedRule || normalizedCwd.startsWith(normalizedRule + sep10);
49532
49675
  return isUnderRule && rule.access !== "none";
49533
49676
  });
49534
49677
  if (!isAllowed) {
@@ -49928,7 +50071,7 @@ var GitHubTaskTracker = class {
49928
50071
  cachedProvider = null;
49929
50072
  async getProvider() {
49930
50073
  if (this.cachedProvider !== null) return this.cachedProvider;
49931
- const { createScmProvider } = await import("./factory-DD2FPM3H.js");
50074
+ const { createScmProvider } = await import("./factory-DOWBGVAL.js");
49932
50075
  const result = await createScmProvider({ repo: this.config.repo ?? "" });
49933
50076
  if (!result.ok) throw new Error(`SCM provider error: ${result.error.message}`);
49934
50077
  this.cachedProvider = result.value;
@@ -50634,4 +50777,4 @@ export {
50634
50777
  detectBackend,
50635
50778
  createTaskTracker
50636
50779
  };
50637
- //# sourceMappingURL=chunk-M6KXR4LO.js.map
50780
+ //# sourceMappingURL=chunk-4XNVJS5A.js.map