nexus-agents 2.94.0 → 2.95.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-PPFHJZSO.js → child-mcp-config-NW7JMSDK.js} +2 -2
  2. package/dist/{chunk-2YMRRZRM.js → chunk-2X24T4ZD.js} +7 -7
  3. package/dist/{chunk-4QESFYGV.js → chunk-3H6Q3RZM.js} +4 -4
  4. package/dist/{chunk-EDPDH5YT.js → chunk-3HXWI34V.js} +3 -3
  5. package/dist/{chunk-24WC4XO2.js → chunk-47Z3YPOK.js} +2 -2
  6. package/dist/{chunk-76535ZNP.js → chunk-4NVYN2MB.js} +4 -4
  7. package/dist/{chunk-ZY2EMD72.js → chunk-55G7KQ7F.js} +5 -5
  8. package/dist/{chunk-OSSGG7KW.js → chunk-5HBDXW44.js} +2 -2
  9. package/dist/{chunk-LCLVSNST.js → chunk-6IWPN5UB.js} +2 -2
  10. package/dist/{chunk-43UDRX3N.js → chunk-7GUP6KQQ.js} +2 -2
  11. package/dist/{chunk-FUGPKYEJ.js → chunk-BSHDI4BH.js} +2 -2
  12. package/dist/{chunk-L7I55FAN.js → chunk-D3JSXVX3.js} +2 -2
  13. package/dist/{chunk-OT6V5ROA.js → chunk-ECBH5INZ.js} +37 -3
  14. package/dist/chunk-ECBH5INZ.js.map +1 -0
  15. package/dist/{chunk-G5EBHQ2L.js → chunk-ECZW5FXN.js} +2 -2
  16. package/dist/{chunk-ADRTAUJA.js → chunk-FTDVA33Z.js} +4 -4
  17. package/dist/{chunk-ROAANOOB.js → chunk-FXVJLJUF.js} +2 -2
  18. package/dist/{chunk-UC3PVIN4.js → chunk-FYGZ4MEQ.js} +28 -28
  19. package/dist/{chunk-XBPFVWA2.js → chunk-G42N55ZR.js} +2 -2
  20. package/dist/{chunk-77JUKFTG.js → chunk-GC5FH2IA.js} +7 -7
  21. package/dist/{chunk-63OGXDHS.js → chunk-KHZGMF2W.js} +4 -4
  22. package/dist/{chunk-YDXGYKZJ.js → chunk-LXROEQAO.js} +2 -2
  23. package/dist/{chunk-EJR6U67L.js → chunk-LZOTH2GI.js} +2 -2
  24. package/dist/{chunk-EB43BGAR.js → chunk-O4LVC4MQ.js} +2 -2
  25. package/dist/{chunk-5B4VLSMP.js → chunk-PFOY5ML6.js} +3 -3
  26. package/dist/{chunk-GMZDRTVJ.js → chunk-QUPPV6UO.js} +2 -2
  27. package/dist/{chunk-OKGHHCS5.js → chunk-TEKWQNQ2.js} +3 -3
  28. package/dist/{chunk-TNBWHOPY.js → chunk-VTMQND6B.js} +9 -9
  29. package/dist/{chunk-Q3NUA7CW.js → chunk-WGA4VGIR.js} +3 -3
  30. package/dist/{chunk-KSJPDQSG.js → chunk-Y3OOHHKQ.js} +2 -2
  31. package/dist/{chunk-5ZB3MTA7.js → chunk-YYXJ6RTO.js} +3 -3
  32. package/dist/{chunk-R2NKJPUX.js → chunk-ZICVVBDW.js} +2 -2
  33. package/dist/{cli-circuit-breaker-BAERQZ3H.js → cli-circuit-breaker-LNU5DQSB.js} +4 -4
  34. package/dist/cli.js +111 -60
  35. package/dist/cli.js.map +1 -1
  36. package/dist/{composite-router-EONKFRDD.js → composite-router-DJ54ND5X.js} +2 -2
  37. package/dist/{consensus-vote-TO5575P3.js → consensus-vote-XLEQFVE7.js} +12 -12
  38. package/dist/{context-retriever-JM564MOV.js → context-retriever-6O6TREXH.js} +6 -6
  39. package/dist/{doctor-deep-VFBQ7TY4.js → doctor-deep-PSNJPELP.js} +3 -3
  40. package/dist/{expert-bridge-OXME7FES.js → expert-bridge-Q3OWPD4L.js} +4 -4
  41. package/dist/{factory-FVZLVIYH.js → factory-43RVPRT5.js} +5 -5
  42. package/dist/{factory-MDT5CFA5.js → factory-PSMTMC7V.js} +5 -5
  43. package/dist/index.js +26 -26
  44. package/dist/{init-opencode-Y6XKR6WS.js → init-opencode-25AUARJH.js} +5 -5
  45. package/dist/{issue-triage-2XVD4JQ7.js → issue-triage-KZTENUDH.js} +5 -5
  46. package/dist/{pr-reviewer-helpers-JLWEQIN6.js → pr-reviewer-helpers-XENJ4E2T.js} +4 -4
  47. package/dist/{registry-command-FYVOMCBG.js → registry-command-X3O34FAK.js} +2 -2
  48. package/dist/{repo-security-plan-JRDHWI2R.js → repo-security-plan-XCX7EFJR.js} +3 -3
  49. package/dist/{research-helpers-synthesize-F7L7M7FJ.js → research-helpers-synthesize-CGVR6M4S.js} +3 -3
  50. package/dist/{routing-memory-JAV2ICXR.js → routing-memory-YZRYGXQC.js} +2 -2
  51. package/dist/{session-memory-2XAGY3PX.js → session-memory-SXQAA2EN.js} +3 -3
  52. package/dist/{setup-command-6WVEOE4Q.js → setup-command-VG7JZI6O.js} +11 -11
  53. package/dist/{setup-config-KUZU2GFI.js → setup-config-VJAK6AA2.js} +3 -3
  54. package/dist/{setup-custom-api-3M7CU3TF.js → setup-custom-api-KSF2JMTS.js} +4 -4
  55. package/dist/{tool-memory-YWX4FTIQ.js → tool-memory-L7SDFSF5.js} +5 -5
  56. package/dist/{weather-report-ZZM5EU7N.js → weather-report-D6HFOK7S.js} +2 -2
  57. package/package.json +1 -1
  58. package/dist/chunk-OT6V5ROA.js.map +0 -1
  59. /package/dist/{child-mcp-config-PPFHJZSO.js.map → child-mcp-config-NW7JMSDK.js.map} +0 -0
  60. /package/dist/{chunk-2YMRRZRM.js.map → chunk-2X24T4ZD.js.map} +0 -0
  61. /package/dist/{chunk-4QESFYGV.js.map → chunk-3H6Q3RZM.js.map} +0 -0
  62. /package/dist/{chunk-EDPDH5YT.js.map → chunk-3HXWI34V.js.map} +0 -0
  63. /package/dist/{chunk-24WC4XO2.js.map → chunk-47Z3YPOK.js.map} +0 -0
  64. /package/dist/{chunk-76535ZNP.js.map → chunk-4NVYN2MB.js.map} +0 -0
  65. /package/dist/{chunk-ZY2EMD72.js.map → chunk-55G7KQ7F.js.map} +0 -0
  66. /package/dist/{chunk-OSSGG7KW.js.map → chunk-5HBDXW44.js.map} +0 -0
  67. /package/dist/{chunk-LCLVSNST.js.map → chunk-6IWPN5UB.js.map} +0 -0
  68. /package/dist/{chunk-43UDRX3N.js.map → chunk-7GUP6KQQ.js.map} +0 -0
  69. /package/dist/{chunk-FUGPKYEJ.js.map → chunk-BSHDI4BH.js.map} +0 -0
  70. /package/dist/{chunk-L7I55FAN.js.map → chunk-D3JSXVX3.js.map} +0 -0
  71. /package/dist/{chunk-G5EBHQ2L.js.map → chunk-ECZW5FXN.js.map} +0 -0
  72. /package/dist/{chunk-ADRTAUJA.js.map → chunk-FTDVA33Z.js.map} +0 -0
  73. /package/dist/{chunk-ROAANOOB.js.map → chunk-FXVJLJUF.js.map} +0 -0
  74. /package/dist/{chunk-UC3PVIN4.js.map → chunk-FYGZ4MEQ.js.map} +0 -0
  75. /package/dist/{chunk-XBPFVWA2.js.map → chunk-G42N55ZR.js.map} +0 -0
  76. /package/dist/{chunk-77JUKFTG.js.map → chunk-GC5FH2IA.js.map} +0 -0
  77. /package/dist/{chunk-63OGXDHS.js.map → chunk-KHZGMF2W.js.map} +0 -0
  78. /package/dist/{chunk-YDXGYKZJ.js.map → chunk-LXROEQAO.js.map} +0 -0
  79. /package/dist/{chunk-EJR6U67L.js.map → chunk-LZOTH2GI.js.map} +0 -0
  80. /package/dist/{chunk-EB43BGAR.js.map → chunk-O4LVC4MQ.js.map} +0 -0
  81. /package/dist/{chunk-5B4VLSMP.js.map → chunk-PFOY5ML6.js.map} +0 -0
  82. /package/dist/{chunk-GMZDRTVJ.js.map → chunk-QUPPV6UO.js.map} +0 -0
  83. /package/dist/{chunk-OKGHHCS5.js.map → chunk-TEKWQNQ2.js.map} +0 -0
  84. /package/dist/{chunk-TNBWHOPY.js.map → chunk-VTMQND6B.js.map} +0 -0
  85. /package/dist/{chunk-Q3NUA7CW.js.map → chunk-WGA4VGIR.js.map} +0 -0
  86. /package/dist/{chunk-KSJPDQSG.js.map → chunk-Y3OOHHKQ.js.map} +0 -0
  87. /package/dist/{chunk-5ZB3MTA7.js.map → chunk-YYXJ6RTO.js.map} +0 -0
  88. /package/dist/{chunk-R2NKJPUX.js.map → chunk-ZICVVBDW.js.map} +0 -0
  89. /package/dist/{cli-circuit-breaker-BAERQZ3H.js.map → cli-circuit-breaker-LNU5DQSB.js.map} +0 -0
  90. /package/dist/{composite-router-EONKFRDD.js.map → composite-router-DJ54ND5X.js.map} +0 -0
  91. /package/dist/{consensus-vote-TO5575P3.js.map → consensus-vote-XLEQFVE7.js.map} +0 -0
  92. /package/dist/{context-retriever-JM564MOV.js.map → context-retriever-6O6TREXH.js.map} +0 -0
  93. /package/dist/{doctor-deep-VFBQ7TY4.js.map → doctor-deep-PSNJPELP.js.map} +0 -0
  94. /package/dist/{expert-bridge-OXME7FES.js.map → expert-bridge-Q3OWPD4L.js.map} +0 -0
  95. /package/dist/{factory-FVZLVIYH.js.map → factory-43RVPRT5.js.map} +0 -0
  96. /package/dist/{factory-MDT5CFA5.js.map → factory-PSMTMC7V.js.map} +0 -0
  97. /package/dist/{init-opencode-Y6XKR6WS.js.map → init-opencode-25AUARJH.js.map} +0 -0
  98. /package/dist/{issue-triage-2XVD4JQ7.js.map → issue-triage-KZTENUDH.js.map} +0 -0
  99. /package/dist/{pr-reviewer-helpers-JLWEQIN6.js.map → pr-reviewer-helpers-XENJ4E2T.js.map} +0 -0
  100. /package/dist/{registry-command-FYVOMCBG.js.map → registry-command-X3O34FAK.js.map} +0 -0
  101. /package/dist/{repo-security-plan-JRDHWI2R.js.map → repo-security-plan-XCX7EFJR.js.map} +0 -0
  102. /package/dist/{research-helpers-synthesize-F7L7M7FJ.js.map → research-helpers-synthesize-CGVR6M4S.js.map} +0 -0
  103. /package/dist/{routing-memory-JAV2ICXR.js.map → routing-memory-YZRYGXQC.js.map} +0 -0
  104. /package/dist/{session-memory-2XAGY3PX.js.map → session-memory-SXQAA2EN.js.map} +0 -0
  105. /package/dist/{setup-command-6WVEOE4Q.js.map → setup-command-VG7JZI6O.js.map} +0 -0
  106. /package/dist/{setup-config-KUZU2GFI.js.map → setup-config-VJAK6AA2.js.map} +0 -0
  107. /package/dist/{setup-custom-api-3M7CU3TF.js.map → setup-custom-api-KSF2JMTS.js.map} +0 -0
  108. /package/dist/{tool-memory-YWX4FTIQ.js.map → tool-memory-L7SDFSF5.js.map} +0 -0
  109. /package/dist/{weather-report-ZZM5EU7N.js.map → weather-report-D6HFOK7S.js.map} +0 -0
package/dist/cli.js CHANGED
@@ -13,19 +13,19 @@ import {
13
13
  generateSummary,
14
14
  parseFindings,
15
15
  sumFindings
16
- } from "./chunk-5ZB3MTA7.js";
17
- import "./chunk-R2NKJPUX.js";
16
+ } from "./chunk-YYXJ6RTO.js";
17
+ import "./chunk-ZICVVBDW.js";
18
18
  import {
19
19
  buildOpenAICompatAdapters,
20
20
  loadUsageEvents,
21
21
  readOpenAICompatEnv,
22
22
  rollupByModel
23
- } from "./chunk-5B4VLSMP.js";
23
+ } from "./chunk-PFOY5ML6.js";
24
24
  import {
25
25
  setupCommandAsync,
26
26
  verifyCommand
27
- } from "./chunk-ZY2EMD72.js";
28
- import "./chunk-ROAANOOB.js";
27
+ } from "./chunk-55G7KQ7F.js";
28
+ import "./chunk-FXVJLJUF.js";
29
29
  import {
30
30
  AuthHandler,
31
31
  DEFAULT_EXPERTS,
@@ -168,19 +168,19 @@ import {
168
168
  validateCommand,
169
169
  validateWorkflow,
170
170
  wrapInMarkdownFence
171
- } from "./chunk-UC3PVIN4.js";
171
+ } from "./chunk-FYGZ4MEQ.js";
172
172
  import {
173
173
  resolveToken
174
- } from "./chunk-OSSGG7KW.js";
174
+ } from "./chunk-5HBDXW44.js";
175
175
  import {
176
176
  CATEGORY_DISPLAY_NAMES,
177
177
  DEFAULT_PR_REVIEW_CONFIG
178
178
  } from "./chunk-OK6U5N5Y.js";
179
- import "./chunk-Q3NUA7CW.js";
180
- import "./chunk-EDPDH5YT.js";
179
+ import "./chunk-WGA4VGIR.js";
180
+ import "./chunk-3HXWI34V.js";
181
181
  import {
182
182
  shutdownExpertBridge
183
- } from "./chunk-2YMRRZRM.js";
183
+ } from "./chunk-2X24T4ZD.js";
184
184
  import {
185
185
  DEFAULT_VOTE_TIMEOUT_MS,
186
186
  ErrorPolicySchema,
@@ -198,34 +198,34 @@ import {
198
198
  toolSuccessStructured,
199
199
  warnIfSimulatedOutsideTests,
200
200
  wrapToolWithTimeout
201
- } from "./chunk-TNBWHOPY.js";
202
- import "./chunk-L7I55FAN.js";
203
- import "./chunk-YDXGYKZJ.js";
201
+ } from "./chunk-VTMQND6B.js";
202
+ import "./chunk-D3JSXVX3.js";
203
+ import "./chunk-LXROEQAO.js";
204
204
  import {
205
205
  loadPapersRegistry,
206
206
  loadTechniquesRegistry,
207
207
  savePapersRegistry,
208
208
  synthesizeResearch
209
- } from "./chunk-G5EBHQ2L.js";
209
+ } from "./chunk-ECZW5FXN.js";
210
210
  import {
211
211
  classifyTrust,
212
212
  createFullGitHubProvider,
213
213
  evaluatePolicy,
214
214
  parsePRUrl
215
- } from "./chunk-76535ZNP.js";
216
- import "./chunk-EJR6U67L.js";
215
+ } from "./chunk-4NVYN2MB.js";
216
+ import "./chunk-LZOTH2GI.js";
217
217
  import {
218
218
  ReputationCache,
219
219
  sanitizeInput
220
- } from "./chunk-EB43BGAR.js";
221
- import "./chunk-FUGPKYEJ.js";
220
+ } from "./chunk-O4LVC4MQ.js";
221
+ import "./chunk-BSHDI4BH.js";
222
222
  import "./chunk-HFOQKCD2.js";
223
223
  import "./chunk-3ACDP4E6.js";
224
- import "./chunk-OKGHHCS5.js";
224
+ import "./chunk-TEKWQNQ2.js";
225
225
  import {
226
226
  MemoryError,
227
227
  shutdownToolMemory
228
- } from "./chunk-63OGXDHS.js";
228
+ } from "./chunk-KHZGMF2W.js";
229
229
  import {
230
230
  CustomExpertDefinitionSchema,
231
231
  DATA_SUBDIRECTORIES,
@@ -244,12 +244,12 @@ import {
244
244
  loadConfig,
245
245
  runDoctor,
246
246
  validateNexusEnv
247
- } from "./chunk-77JUKFTG.js";
248
- import "./chunk-GMZDRTVJ.js";
249
- import "./chunk-KSJPDQSG.js";
247
+ } from "./chunk-GC5FH2IA.js";
248
+ import "./chunk-QUPPV6UO.js";
249
+ import "./chunk-Y3OOHHKQ.js";
250
250
  import {
251
251
  DEFAULTS
252
- } from "./chunk-43UDRX3N.js";
252
+ } from "./chunk-7GUP6KQQ.js";
253
253
  import "./chunk-NUBSJGQZ.js";
254
254
  import {
255
255
  capitalize,
@@ -261,12 +261,12 @@ import {
261
261
  getAvailableClis,
262
262
  isRecord,
263
263
  probeAllClis
264
- } from "./chunk-4QESFYGV.js";
265
- import "./chunk-24WC4XO2.js";
266
- import "./chunk-XBPFVWA2.js";
264
+ } from "./chunk-3H6Q3RZM.js";
265
+ import "./chunk-47Z3YPOK.js";
266
+ import "./chunk-G42N55ZR.js";
267
267
  import "./chunk-ZM4O442V.js";
268
268
  import "./chunk-PQHVC4BD.js";
269
- import "./chunk-LCLVSNST.js";
269
+ import "./chunk-6IWPN5UB.js";
270
270
  import {
271
271
  API_TIMEOUTS,
272
272
  AgentCapability,
@@ -336,7 +336,7 @@ import {
336
336
  validateTimeout,
337
337
  writeEmptyLine,
338
338
  writeLine
339
- } from "./chunk-OT6V5ROA.js";
339
+ } from "./chunk-ECBH5INZ.js";
340
340
  import {
341
341
  applyPortableMode,
342
342
  detectSandbox,
@@ -3115,7 +3115,7 @@ ${file.patch}
3115
3115
  violations: policyResult.violations
3116
3116
  });
3117
3117
  }
3118
- const { formatReviewComment: formatReviewComment2 } = await import("./pr-reviewer-helpers-JLWEQIN6.js");
3118
+ const { formatReviewComment: formatReviewComment2 } = await import("./pr-reviewer-helpers-XENJ4E2T.js");
3119
3119
  const body = formatReviewComment2(result);
3120
3120
  const postResult = await provider.createReview(pr.prNumber, body, result.decision);
3121
3121
  if (!postResult.ok) {
@@ -17435,6 +17435,7 @@ function runStpaSafetyAnalysis(logger18, failOnHighSeverity) {
17435
17435
  var defaultLogger = createLogger({ component: "TuneStage" });
17436
17436
  var TUNE_ENFORCE_ENV = "NEXUS_TUNE_ENFORCE";
17437
17437
  var TUNE_ENFORCE_DEMOTION = 0.15;
17438
+ var AUDIT_REASON_MAX = 512;
17438
17439
  var TUNE_SIGNAL_TYPES = [
17439
17440
  "signal.fitness_declined",
17440
17441
  "signal.swarm_unhealthy",
@@ -17464,27 +17465,58 @@ function intendedActionFor(event) {
17464
17465
  return void 0;
17465
17466
  }
17466
17467
  }
17468
+ function auditDemotion(auditLogger, agentId, adjustment, log) {
17469
+ if (auditLogger === void 0 || adjustment === void 0) return;
17470
+ const reason = adjustment.reason.length > AUDIT_REASON_MAX ? adjustment.reason.slice(0, AUDIT_REASON_MAX) : adjustment.reason;
17471
+ try {
17472
+ auditLogger.log({
17473
+ category: "configuration",
17474
+ severity: "warning",
17475
+ outcome: "success",
17476
+ action: "tune.demote",
17477
+ actor: { type: "system", id: "tune-stage" },
17478
+ description: `Bounded routing demotion applied to ${agentId} (swarm_unhealthy)`,
17479
+ metadata: {
17480
+ cli: agentId,
17481
+ magnitude: TUNE_ENFORCE_DEMOTION,
17482
+ multiplier: adjustment.multiplier,
17483
+ reason,
17484
+ provenance: "signal.swarm_unhealthy",
17485
+ appliedAt: adjustment.appliedAt
17486
+ }
17487
+ });
17488
+ } catch (auditError) {
17489
+ log.warn("TuneStage \u2014 audit log failed (demotion still applied)", {
17490
+ error: getErrorMessage(auditError)
17491
+ });
17492
+ }
17493
+ }
17494
+ function enforceSwarmDemotion(event, action, auditLogger, log) {
17495
+ const adjustment = getTuneAdjustmentStore().demote(
17496
+ event.agentId,
17497
+ TUNE_ENFORCE_DEMOTION,
17498
+ `swarm_unhealthy: ${event.reason}`
17499
+ );
17500
+ log.info("TuneStage (enforce) \u2014 applied bounded routing demotion", {
17501
+ kind: action.kind,
17502
+ signal: action.signal,
17503
+ agentId: event.agentId,
17504
+ reason: event.reason,
17505
+ multiplier: adjustment?.multiplier
17506
+ });
17507
+ auditDemotion(auditLogger, event.agentId, adjustment, log);
17508
+ }
17467
17509
  function createTuneStage(bus, options = {}) {
17468
17510
  const enabled = options.enabled ?? false;
17469
17511
  const log = options.logger ?? defaultLogger;
17512
+ const auditLogger = options.auditLogger;
17470
17513
  return bus.subscribe({ type: [...TUNE_SIGNAL_TYPES] }, (event) => {
17471
17514
  try {
17472
17515
  const action = intendedActionFor(event);
17473
17516
  if (action === void 0) return;
17474
17517
  if (enabled) {
17475
17518
  if (event.type === "signal.swarm_unhealthy") {
17476
- const adjustment = getTuneAdjustmentStore().demote(
17477
- event.agentId,
17478
- TUNE_ENFORCE_DEMOTION,
17479
- `swarm_unhealthy: ${event.reason}`
17480
- );
17481
- log.info("TuneStage (enforce) \u2014 applied bounded routing demotion", {
17482
- kind: action.kind,
17483
- signal: action.signal,
17484
- agentId: event.agentId,
17485
- reason: event.reason,
17486
- multiplier: adjustment?.multiplier
17487
- });
17519
+ enforceSwarmDemotion(event, action, auditLogger, log);
17488
17520
  return;
17489
17521
  }
17490
17522
  log.info("TuneStage (enforce) \u2014 non-routing action, shadow-only", {
@@ -17494,6 +17526,9 @@ function createTuneStage(bus, options = {}) {
17494
17526
  });
17495
17527
  return;
17496
17528
  }
17529
+ if (event.type === "signal.swarm_unhealthy") {
17530
+ getTuneAdjustmentStore().recordIntended(event.agentId, `swarm_unhealthy: ${event.reason}`);
17531
+ }
17497
17532
  log.info("TuneStage (shadow) \u2014 intended action", {
17498
17533
  kind: action.kind,
17499
17534
  signal: action.signal,
@@ -18037,12 +18072,12 @@ function registerToolCategories(ctx) {
18037
18072
  if (allowed(tool.name)) tool.register(ctx.server, buildStandardDeps(ctx, tool.name));
18038
18073
  }
18039
18074
  }
18040
- function initV2PipelineSubsystems(logger18) {
18075
+ function initV2PipelineSubsystems(logger18, auditLogger) {
18041
18076
  const pluginRegistry = getPipelinePluginRegistry();
18042
18077
  const pipelineEventBus = getPipelineEventBus();
18043
18078
  const bridge = createEventBusBridge({ source: pipelineEventBus });
18044
18079
  startFeedbackSubscriber(pipelineEventBus, getOutcomeStore());
18045
- startTuneStage(pipelineEventBus);
18080
+ startTuneStage(pipelineEventBus, auditLogger !== void 0 ? { auditLogger } : void 0);
18046
18081
  startSwarmHealthSignals(getSwarmObserver(), pipelineEventBus);
18047
18082
  startFailoverSignals({ pipelineBus: pipelineEventBus });
18048
18083
  const policyEngine = createDefaultPolicyEngine();
@@ -18079,7 +18114,7 @@ function registerMcpTools(options) {
18079
18114
  logger: toolInfra.logger
18080
18115
  });
18081
18116
  setGlobalToolRateLimiterFactory(rateLimiterFactory);
18082
- initV2PipelineSubsystems(logger18);
18117
+ initV2PipelineSubsystems(logger18, options.auditLogger);
18083
18118
  const gatewayOptions = { ...options, server: observableServer };
18084
18119
  const ctx = createToolContext(gatewayOptions, toolInfra, rateLimiterFactory);
18085
18120
  registerToolCategories(ctx);
@@ -19370,7 +19405,7 @@ function adaptConfigToLibrary(config) {
19370
19405
  }
19371
19406
  function createBeliefPromoter() {
19372
19407
  return async (event) => {
19373
- const { getToolMemory } = await import("./tool-memory-YWX4FTIQ.js");
19408
+ const { getToolMemory } = await import("./tool-memory-L7SDFSF5.js");
19374
19409
  const tm = getToolMemory();
19375
19410
  await tm.recordBelief(
19376
19411
  `skill:${event.name}`,
@@ -19742,7 +19777,8 @@ function buildGatewayConfig(config, logger18) {
19742
19777
  ...tierOverrides !== void 0 && { tierOverrides }
19743
19778
  };
19744
19779
  }
19745
- async function initializeAndRegisterTools(server, logger18, policyFirewall, config, feedbackIntegration) {
19780
+ async function initializeAndRegisterTools(server, logger18, policyFirewall, config, deps) {
19781
+ const { feedbackIntegration, auditLogger } = deps ?? {};
19746
19782
  logger18.info("Loading built-in workflow templates");
19747
19783
  const builtInTemplates = await initializeBuiltInTemplates();
19748
19784
  logger18.info("Loaded built-in templates", { count: builtInTemplates.size });
@@ -19765,7 +19801,8 @@ async function initializeAndRegisterTools(server, logger18, policyFirewall, conf
19765
19801
  ...allowedPaths !== void 0 && { allowedPaths },
19766
19802
  ...securityConfig !== void 0 && { securityConfig },
19767
19803
  ...workflowConfig !== void 0 && { workflowConfig },
19768
- ...feedbackIntegration !== void 0 && { feedbackIntegration }
19804
+ ...feedbackIntegration !== void 0 && { feedbackIntegration },
19805
+ ...auditLogger !== null && auditLogger !== void 0 && { auditLogger }
19769
19806
  };
19770
19807
  registerMcpTools(toolsOptions);
19771
19808
  }
@@ -19816,13 +19853,10 @@ async function initializeSubsystems(config, logger18) {
19816
19853
  const policyFirewall = logSecurityConfig(serverLogger, config);
19817
19854
  const auditLogger = initializeAuditLogger(config.security, serverLogger);
19818
19855
  initializeAuth(config, serverLogger);
19819
- await initializeAndRegisterTools(
19820
- server,
19821
- serverLogger,
19822
- policyFirewall,
19823
- config,
19824
- feedbackResult.feedbackIntegration
19825
- );
19856
+ await initializeAndRegisterTools(server, serverLogger, policyFirewall, config, {
19857
+ feedbackIntegration: feedbackResult.feedbackIntegration,
19858
+ auditLogger
19859
+ });
19826
19860
  return { server, serverLogger, observer, eventBusBridge, auditLogger };
19827
19861
  }
19828
19862
  var SERVER_STARTUP_TIMEOUT_MS = 3e4;
@@ -20236,7 +20270,7 @@ async function handleResearchCommand(args) {
20236
20270
  }
20237
20271
  }
20238
20272
  async function handleRegistryCommand(args) {
20239
- const { registryCommand, isValidRegistrySubcommand, formatRegistryUsage } = await import("./registry-command-FYVOMCBG.js");
20273
+ const { registryCommand, isValidRegistrySubcommand, formatRegistryUsage } = await import("./registry-command-X3O34FAK.js");
20240
20274
  const subcommand = args.subcommand;
20241
20275
  if (!isValidRegistrySubcommand(subcommand)) {
20242
20276
  process.stdout.write(`${formatRegistryUsage()}
@@ -20284,7 +20318,7 @@ async function handleVerifyCommand(args) {
20284
20318
  async function handleDoctorCommand(args) {
20285
20319
  const exitCode = await doctorCommand({ fix: args.options.fix });
20286
20320
  if (args.options.deep) {
20287
- const { runDeepDiagnostics: runDeepDiagnostics2, formatDeepDiagnostics: formatDeepDiagnostics2 } = await import("./doctor-deep-VFBQ7TY4.js");
20321
+ const { runDeepDiagnostics: runDeepDiagnostics2, formatDeepDiagnostics: formatDeepDiagnostics2 } = await import("./doctor-deep-PSNJPELP.js");
20288
20322
  const diag = runDeepDiagnostics2();
20289
20323
  process.stdout.write(formatDeepDiagnostics2(diag) + "\n");
20290
20324
  }
@@ -20328,7 +20362,7 @@ async function handleInitCommand(args) {
20328
20362
  process.exit(result.success ? EXIT_CODES.SUCCESS : EXIT_CODES.SERVER_START_FAILED);
20329
20363
  }
20330
20364
  async function runInitOpencodeFlow(args) {
20331
- const { runInitOpencode } = await import("./init-opencode-Y6XKR6WS.js");
20365
+ const { runInitOpencode } = await import("./init-opencode-25AUARJH.js");
20332
20366
  const opencodePath = args.options.opencode;
20333
20367
  if (opencodePath === void 0 || opencodePath === "") {
20334
20368
  process.stderr.write("Error: --opencode requires a path argument.\n");
@@ -20355,7 +20389,7 @@ async function runInitOpencodeFlow(args) {
20355
20389
  process.exit(EXIT_CODES.SUCCESS);
20356
20390
  }
20357
20391
  async function renderOpencodeValidate(opencodePath) {
20358
- const { runOpencodeValidate } = await import("./init-opencode-Y6XKR6WS.js");
20392
+ const { runOpencodeValidate } = await import("./init-opencode-25AUARJH.js");
20359
20393
  const result = await runOpencodeValidate(opencodePath);
20360
20394
  if (!result.ok) {
20361
20395
  process.stderr.write(`init --opencode --validate: ${result.reason ?? "failed"}
@@ -20395,7 +20429,7 @@ async function handleSetupCommandAsync(args) {
20395
20429
  process.exit(exitCode === 0 ? EXIT_CODES.SUCCESS : EXIT_CODES.SERVER_START_FAILED);
20396
20430
  }
20397
20431
  async function runCustomApiSetup(args) {
20398
- const { configureCustomApi } = await import("./setup-custom-api-3M7CU3TF.js");
20432
+ const { configureCustomApi } = await import("./setup-custom-api-KSF2JMTS.js");
20399
20433
  const baseUrl = args.options.customApi;
20400
20434
  if (baseUrl === void 0) return EXIT_CODES.SERVER_START_FAILED;
20401
20435
  const input = {
@@ -22371,6 +22405,7 @@ function collectHealth() {
22371
22405
  failureBreakdown: report.failureBreakdown ?? [],
22372
22406
  cliCount: report.cliWeather.length,
22373
22407
  cliHealth: report.cliWeather.map(toCliSummary),
22408
+ tuneAdjustments: getTuneAdjustmentStore().demotionStats(),
22374
22409
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
22375
22410
  };
22376
22411
  }
@@ -22486,6 +22521,22 @@ ${c.bold}nexus-agents${c.reset}`);
22486
22521
  `);
22487
22522
  }
22488
22523
  renderFailureBreakdown(w, health.failureBreakdown);
22524
+ renderTuneAdjustments(w, health.tuneAdjustments);
22525
+ }
22526
+ function renderTuneAdjustments(w, stats) {
22527
+ if (stats.length === 0) return;
22528
+ const c = colors;
22529
+ w(
22530
+ ` ${c.bold}Self-Tuning Demotions${c.reset} ${c.dim}(applied = enforced, intended = shadow)${c.reset}
22531
+ `
22532
+ );
22533
+ for (const stat2 of stats) {
22534
+ w(
22535
+ ` ${stat2.cli.padEnd(10)} applied: ${c.cyan}${String(stat2.applied)}${c.reset} intended: ${c.cyan}${String(stat2.intended)}${c.reset} ${c.dim}${stat2.lastReason}${c.reset}
22536
+ `
22537
+ );
22538
+ }
22539
+ w("\n");
22489
22540
  }
22490
22541
  function renderJson2(health) {
22491
22542
  process.stdout.write(JSON.stringify(health, null, 2) + "\n");