nexus-agents 2.94.0 → 2.96.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 (119) hide show
  1. package/README.md +4 -4
  2. package/dist/{child-mcp-config-PPFHJZSO.js → child-mcp-config-HZUEFKXB.js} +2 -2
  3. package/dist/{chunk-77JUKFTG.js → chunk-23NNSR45.js} +7 -7
  4. package/dist/{chunk-G5EBHQ2L.js → chunk-2472O6HR.js} +2 -2
  5. package/dist/{chunk-OT6V5ROA.js → chunk-2KHD2ANY.js} +39 -4
  6. package/dist/chunk-2KHD2ANY.js.map +1 -0
  7. package/dist/chunk-3ZROPKLV.js +2133 -0
  8. package/dist/chunk-3ZROPKLV.js.map +1 -0
  9. package/dist/{chunk-UC3PVIN4.js → chunk-7P3UIYJH.js} +415 -1410
  10. package/dist/chunk-7P3UIYJH.js.map +1 -0
  11. package/dist/{chunk-Q3NUA7CW.js → chunk-AJMHTC4J.js} +3 -3
  12. package/dist/{chunk-63OGXDHS.js → chunk-ANH2A44T.js} +4 -4
  13. package/dist/{chunk-XBPFVWA2.js → chunk-AREIPUCD.js} +2 -2
  14. package/dist/{chunk-L7I55FAN.js → chunk-AW3HJHJT.js} +2 -2
  15. package/dist/{chunk-ROAANOOB.js → chunk-DTFM37IG.js} +2 -2
  16. package/dist/{chunk-24WC4XO2.js → chunk-EUUWRNDZ.js} +2 -2
  17. package/dist/{chunk-EDPDH5YT.js → chunk-FHZUOIVC.js} +3 -3
  18. package/dist/{chunk-R2NKJPUX.js → chunk-FPAUF3YB.js} +2 -2
  19. package/dist/{chunk-ZY2EMD72.js → chunk-ICOHLRHT.js} +5 -5
  20. package/dist/{chunk-ADRTAUJA.js → chunk-INFJH4JX.js} +4 -4
  21. package/dist/{chunk-FUGPKYEJ.js → chunk-JEK5CHK2.js} +2 -2
  22. package/dist/{chunk-43UDRX3N.js → chunk-MMW4KIBH.js} +2 -2
  23. package/dist/{chunk-EJR6U67L.js → chunk-MVCJEIUU.js} +2 -2
  24. package/dist/{chunk-2YMRRZRM.js → chunk-NJN5SGU2.js} +7 -7
  25. package/dist/{chunk-OSSGG7KW.js → chunk-OHGKVMT3.js} +2 -2
  26. package/dist/{chunk-76535ZNP.js → chunk-ONIHS7K7.js} +4 -4
  27. package/dist/{chunk-OKGHHCS5.js → chunk-P7Y3KLKG.js} +3 -3
  28. package/dist/{chunk-EB43BGAR.js → chunk-R2KJ22LX.js} +2 -2
  29. package/dist/chunk-SRSAMAPP.js +1095 -0
  30. package/dist/chunk-SRSAMAPP.js.map +1 -0
  31. package/dist/{chunk-YDXGYKZJ.js → chunk-SSHL5TAX.js} +2 -2
  32. package/dist/{chunk-5ZB3MTA7.js → chunk-THVTU2UG.js} +3 -3
  33. package/dist/{chunk-4QESFYGV.js → chunk-XMYJWMWN.js} +4 -4
  34. package/dist/{chunk-5B4VLSMP.js → chunk-YSYBVLYS.js} +3 -3
  35. package/dist/{chunk-GMZDRTVJ.js → chunk-YWIZ3UQ6.js} +2 -2
  36. package/dist/{chunk-LCLVSNST.js → chunk-Z3XF5LRT.js} +2 -2
  37. package/dist/{chunk-TNBWHOPY.js → chunk-Z7PILY4E.js} +361 -2468
  38. package/dist/chunk-Z7PILY4E.js.map +1 -0
  39. package/dist/{chunk-KSJPDQSG.js → chunk-ZBQXPP7M.js} +2 -2
  40. package/dist/{cli-circuit-breaker-BAERQZ3H.js → cli-circuit-breaker-L6SWUVOP.js} +4 -4
  41. package/dist/cli.js +179 -76
  42. package/dist/cli.js.map +1 -1
  43. package/dist/{composite-router-EONKFRDD.js → composite-router-HFBOUCXD.js} +2 -2
  44. package/dist/{consensus-vote-TO5575P3.js → consensus-vote-YEZIP2JQ.js} +13 -12
  45. package/dist/{context-retriever-JM564MOV.js → context-retriever-PTRDEBBH.js} +6 -6
  46. package/dist/{doctor-deep-VFBQ7TY4.js → doctor-deep-WHCDAV3Z.js} +3 -3
  47. package/dist/{expert-bridge-OXME7FES.js → expert-bridge-N4L47MHU.js} +4 -4
  48. package/dist/{factory-FVZLVIYH.js → factory-EFLOKY32.js} +5 -5
  49. package/dist/{factory-MDT5CFA5.js → factory-ZKGYCGDT.js} +5 -5
  50. package/dist/improvement-review-4MTIYCOZ.js +27 -0
  51. package/dist/index.js +52 -49
  52. package/dist/index.js.map +1 -1
  53. package/dist/{init-opencode-Y6XKR6WS.js → init-opencode-42GKRQDA.js} +5 -5
  54. package/dist/{issue-triage-2XVD4JQ7.js → issue-triage-TEPE6VMA.js} +5 -5
  55. package/dist/{pr-reviewer-helpers-JLWEQIN6.js → pr-reviewer-helpers-G4O22XF6.js} +4 -4
  56. package/dist/{registry-command-FYVOMCBG.js → registry-command-32PUZNNG.js} +2 -2
  57. package/dist/{repo-security-plan-JRDHWI2R.js → repo-security-plan-XWUDQB34.js} +3 -3
  58. package/dist/{research-helpers-synthesize-F7L7M7FJ.js → research-helpers-synthesize-YI6S7SN6.js} +3 -3
  59. package/dist/{routing-memory-JAV2ICXR.js → routing-memory-Z3ZCTPFM.js} +2 -2
  60. package/dist/{session-memory-2XAGY3PX.js → session-memory-5ZZ2SXDE.js} +3 -3
  61. package/dist/{setup-command-6WVEOE4Q.js → setup-command-U3ILRY5H.js} +11 -11
  62. package/dist/{setup-config-KUZU2GFI.js → setup-config-WZYLXPDO.js} +3 -3
  63. package/dist/{setup-custom-api-3M7CU3TF.js → setup-custom-api-K4EN47CP.js} +4 -4
  64. package/dist/{tool-memory-YWX4FTIQ.js → tool-memory-53Y2TUR3.js} +5 -5
  65. package/dist/{weather-report-ZZM5EU7N.js → weather-report-JOBWXWQ3.js} +2 -2
  66. package/dist/weather-report-JOBWXWQ3.js.map +1 -0
  67. package/package.json +12 -2
  68. package/dist/chunk-OT6V5ROA.js.map +0 -1
  69. package/dist/chunk-TNBWHOPY.js.map +0 -1
  70. package/dist/chunk-UC3PVIN4.js.map +0 -1
  71. /package/dist/{child-mcp-config-PPFHJZSO.js.map → child-mcp-config-HZUEFKXB.js.map} +0 -0
  72. /package/dist/{chunk-77JUKFTG.js.map → chunk-23NNSR45.js.map} +0 -0
  73. /package/dist/{chunk-G5EBHQ2L.js.map → chunk-2472O6HR.js.map} +0 -0
  74. /package/dist/{chunk-Q3NUA7CW.js.map → chunk-AJMHTC4J.js.map} +0 -0
  75. /package/dist/{chunk-63OGXDHS.js.map → chunk-ANH2A44T.js.map} +0 -0
  76. /package/dist/{chunk-XBPFVWA2.js.map → chunk-AREIPUCD.js.map} +0 -0
  77. /package/dist/{chunk-L7I55FAN.js.map → chunk-AW3HJHJT.js.map} +0 -0
  78. /package/dist/{chunk-ROAANOOB.js.map → chunk-DTFM37IG.js.map} +0 -0
  79. /package/dist/{chunk-24WC4XO2.js.map → chunk-EUUWRNDZ.js.map} +0 -0
  80. /package/dist/{chunk-EDPDH5YT.js.map → chunk-FHZUOIVC.js.map} +0 -0
  81. /package/dist/{chunk-R2NKJPUX.js.map → chunk-FPAUF3YB.js.map} +0 -0
  82. /package/dist/{chunk-ZY2EMD72.js.map → chunk-ICOHLRHT.js.map} +0 -0
  83. /package/dist/{chunk-ADRTAUJA.js.map → chunk-INFJH4JX.js.map} +0 -0
  84. /package/dist/{chunk-FUGPKYEJ.js.map → chunk-JEK5CHK2.js.map} +0 -0
  85. /package/dist/{chunk-43UDRX3N.js.map → chunk-MMW4KIBH.js.map} +0 -0
  86. /package/dist/{chunk-EJR6U67L.js.map → chunk-MVCJEIUU.js.map} +0 -0
  87. /package/dist/{chunk-2YMRRZRM.js.map → chunk-NJN5SGU2.js.map} +0 -0
  88. /package/dist/{chunk-OSSGG7KW.js.map → chunk-OHGKVMT3.js.map} +0 -0
  89. /package/dist/{chunk-76535ZNP.js.map → chunk-ONIHS7K7.js.map} +0 -0
  90. /package/dist/{chunk-OKGHHCS5.js.map → chunk-P7Y3KLKG.js.map} +0 -0
  91. /package/dist/{chunk-EB43BGAR.js.map → chunk-R2KJ22LX.js.map} +0 -0
  92. /package/dist/{chunk-YDXGYKZJ.js.map → chunk-SSHL5TAX.js.map} +0 -0
  93. /package/dist/{chunk-5ZB3MTA7.js.map → chunk-THVTU2UG.js.map} +0 -0
  94. /package/dist/{chunk-4QESFYGV.js.map → chunk-XMYJWMWN.js.map} +0 -0
  95. /package/dist/{chunk-5B4VLSMP.js.map → chunk-YSYBVLYS.js.map} +0 -0
  96. /package/dist/{chunk-GMZDRTVJ.js.map → chunk-YWIZ3UQ6.js.map} +0 -0
  97. /package/dist/{chunk-LCLVSNST.js.map → chunk-Z3XF5LRT.js.map} +0 -0
  98. /package/dist/{chunk-KSJPDQSG.js.map → chunk-ZBQXPP7M.js.map} +0 -0
  99. /package/dist/{cli-circuit-breaker-BAERQZ3H.js.map → cli-circuit-breaker-L6SWUVOP.js.map} +0 -0
  100. /package/dist/{composite-router-EONKFRDD.js.map → composite-router-HFBOUCXD.js.map} +0 -0
  101. /package/dist/{consensus-vote-TO5575P3.js.map → consensus-vote-YEZIP2JQ.js.map} +0 -0
  102. /package/dist/{context-retriever-JM564MOV.js.map → context-retriever-PTRDEBBH.js.map} +0 -0
  103. /package/dist/{doctor-deep-VFBQ7TY4.js.map → doctor-deep-WHCDAV3Z.js.map} +0 -0
  104. /package/dist/{expert-bridge-OXME7FES.js.map → expert-bridge-N4L47MHU.js.map} +0 -0
  105. /package/dist/{factory-FVZLVIYH.js.map → factory-EFLOKY32.js.map} +0 -0
  106. /package/dist/{factory-MDT5CFA5.js.map → factory-ZKGYCGDT.js.map} +0 -0
  107. /package/dist/{issue-triage-2XVD4JQ7.js.map → improvement-review-4MTIYCOZ.js.map} +0 -0
  108. /package/dist/{init-opencode-Y6XKR6WS.js.map → init-opencode-42GKRQDA.js.map} +0 -0
  109. /package/dist/{pr-reviewer-helpers-JLWEQIN6.js.map → issue-triage-TEPE6VMA.js.map} +0 -0
  110. /package/dist/{repo-security-plan-JRDHWI2R.js.map → pr-reviewer-helpers-G4O22XF6.js.map} +0 -0
  111. /package/dist/{registry-command-FYVOMCBG.js.map → registry-command-32PUZNNG.js.map} +0 -0
  112. /package/dist/{research-helpers-synthesize-F7L7M7FJ.js.map → repo-security-plan-XWUDQB34.js.map} +0 -0
  113. /package/dist/{routing-memory-JAV2ICXR.js.map → research-helpers-synthesize-YI6S7SN6.js.map} +0 -0
  114. /package/dist/{session-memory-2XAGY3PX.js.map → routing-memory-Z3ZCTPFM.js.map} +0 -0
  115. /package/dist/{setup-command-6WVEOE4Q.js.map → session-memory-5ZZ2SXDE.js.map} +0 -0
  116. /package/dist/{setup-config-KUZU2GFI.js.map → setup-command-U3ILRY5H.js.map} +0 -0
  117. /package/dist/{tool-memory-YWX4FTIQ.js.map → setup-config-WZYLXPDO.js.map} +0 -0
  118. /package/dist/{setup-custom-api-3M7CU3TF.js.map → setup-custom-api-K4EN47CP.js.map} +0 -0
  119. /package/dist/{weather-report-ZZM5EU7N.js.map → tool-memory-53Y2TUR3.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createLogger
3
- } from "./chunk-OT6V5ROA.js";
3
+ } from "./chunk-2KHD2ANY.js";
4
4
 
5
5
  // src/config/available-models-cache.ts
6
6
  var logger = createLogger({ component: "available-models-cache" });
@@ -150,4 +150,4 @@ export {
150
150
  getDefaultAvailableModelsCache,
151
151
  setDefaultAvailableModelsCache
152
152
  };
153
- //# sourceMappingURL=chunk-KSJPDQSG.js.map
153
+ //# sourceMappingURL=chunk-ZBQXPP7M.js.map
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  CliCircuitBreakerIntegration,
3
3
  createCliCircuitBreakerIntegration
4
- } from "./chunk-EDPDH5YT.js";
5
- import "./chunk-24WC4XO2.js";
6
- import "./chunk-OT6V5ROA.js";
4
+ } from "./chunk-FHZUOIVC.js";
5
+ import "./chunk-EUUWRNDZ.js";
6
+ import "./chunk-2KHD2ANY.js";
7
7
  import "./chunk-CH7QIDHQ.js";
8
8
  import "./chunk-PR4QN5HX.js";
9
9
  export {
10
10
  CliCircuitBreakerIntegration,
11
11
  createCliCircuitBreakerIntegration
12
12
  };
13
- //# sourceMappingURL=cli-circuit-breaker-BAERQZ3H.js.map
13
+ //# sourceMappingURL=cli-circuit-breaker-L6SWUVOP.js.map
package/dist/cli.js CHANGED
@@ -13,26 +13,25 @@ import {
13
13
  generateSummary,
14
14
  parseFindings,
15
15
  sumFindings
16
- } from "./chunk-5ZB3MTA7.js";
17
- import "./chunk-R2NKJPUX.js";
16
+ } from "./chunk-THVTU2UG.js";
17
+ import "./chunk-FPAUF3YB.js";
18
18
  import {
19
19
  buildOpenAICompatAdapters,
20
20
  loadUsageEvents,
21
21
  readOpenAICompatEnv,
22
22
  rollupByModel
23
- } from "./chunk-5B4VLSMP.js";
23
+ } from "./chunk-YSYBVLYS.js";
24
24
  import {
25
25
  setupCommandAsync,
26
26
  verifyCommand
27
- } from "./chunk-ZY2EMD72.js";
28
- import "./chunk-ROAANOOB.js";
27
+ } from "./chunk-ICOHLRHT.js";
28
+ import "./chunk-DTFM37IG.js";
29
29
  import {
30
30
  AuthHandler,
31
31
  DEFAULT_EXPERTS,
32
32
  DEVELOPMENT_POLICY,
33
33
  ExpertFactory,
34
34
  FeedbackIntegration,
35
- ImprovementReviewInputSchema,
36
35
  Orchestrator,
37
36
  OrchestratorFactory,
38
37
  PaperStatusSchema,
@@ -44,7 +43,6 @@ import {
44
43
  ValidationDashboard,
45
44
  WorkflowDefinitionSchema,
46
45
  analyzeTools,
47
- calculateFitnessScore,
48
46
  createAgentStages,
49
47
  createAnnotationsProxy,
50
48
  createAuditLogger,
@@ -53,7 +51,6 @@ import {
53
51
  createDefaultPolicyEngine,
54
52
  createEventBusBridge,
55
53
  createFeedbackIntegration,
56
- createFitnessScoreCalculator,
57
54
  createGatewayServerProxy,
58
55
  createLearnablePolicy,
59
56
  createMockOrchestrator,
@@ -119,7 +116,6 @@ import {
119
116
  registerExecuteSpecTool,
120
117
  registerExtractSymbolsTool,
121
118
  registerGetJobResultTool,
122
- registerImprovementReviewTool,
123
119
  registerIssueTriageTool,
124
120
  registerListExpertsTool,
125
121
  registerListJobsTool,
@@ -155,7 +151,6 @@ import {
155
151
  registerWeatherReportTool,
156
152
  resolveV2Config,
157
153
  runDevPipeline,
158
- runImprovementReview,
159
154
  saveSourcesRegistry,
160
155
  setGlobalToolRateLimiterFactory,
161
156
  shutdownFailoverSignals,
@@ -168,64 +163,73 @@ import {
168
163
  validateCommand,
169
164
  validateWorkflow,
170
165
  wrapInMarkdownFence
171
- } from "./chunk-UC3PVIN4.js";
166
+ } from "./chunk-7P3UIYJH.js";
167
+ import "./chunk-3ACDP4E6.js";
172
168
  import {
173
169
  resolveToken
174
- } from "./chunk-OSSGG7KW.js";
170
+ } from "./chunk-OHGKVMT3.js";
175
171
  import {
176
172
  CATEGORY_DISPLAY_NAMES,
177
173
  DEFAULT_PR_REVIEW_CONFIG
178
174
  } from "./chunk-OK6U5N5Y.js";
179
- import "./chunk-Q3NUA7CW.js";
180
- import "./chunk-EDPDH5YT.js";
175
+ import "./chunk-AJMHTC4J.js";
176
+ import "./chunk-FHZUOIVC.js";
181
177
  import {
182
178
  shutdownExpertBridge
183
- } from "./chunk-2YMRRZRM.js";
179
+ } from "./chunk-NJN5SGU2.js";
184
180
  import {
185
181
  DEFAULT_VOTE_TIMEOUT_MS,
186
182
  ErrorPolicySchema,
187
183
  VOTER_ROLES,
188
184
  VoteThresholdSchema,
189
- createDefaultPolicyFirewall,
190
- createSecureHandler,
191
185
  createUnifiedRegistry,
192
186
  executeVoting,
193
- getToolAnnotations,
194
- getToolTimeout,
195
187
  registerConsensusVoteTool,
196
- toSdkCallback,
197
- toolStructuredError,
198
- toolSuccessStructured,
199
- warnIfSimulatedOutsideTests,
200
- wrapToolWithTimeout
201
- } from "./chunk-TNBWHOPY.js";
202
- import "./chunk-L7I55FAN.js";
203
- import "./chunk-YDXGYKZJ.js";
188
+ warnIfSimulatedOutsideTests
189
+ } from "./chunk-Z7PILY4E.js";
190
+ import "./chunk-AW3HJHJT.js";
191
+ import "./chunk-SSHL5TAX.js";
204
192
  import {
205
193
  loadPapersRegistry,
206
194
  loadTechniquesRegistry,
207
195
  savePapersRegistry,
208
196
  synthesizeResearch
209
- } from "./chunk-G5EBHQ2L.js";
197
+ } from "./chunk-2472O6HR.js";
210
198
  import {
211
199
  classifyTrust,
212
200
  createFullGitHubProvider,
213
201
  evaluatePolicy,
214
202
  parsePRUrl
215
- } from "./chunk-76535ZNP.js";
216
- import "./chunk-EJR6U67L.js";
203
+ } from "./chunk-ONIHS7K7.js";
204
+ import "./chunk-MVCJEIUU.js";
217
205
  import {
218
206
  ReputationCache,
219
207
  sanitizeInput
220
- } from "./chunk-EB43BGAR.js";
221
- import "./chunk-FUGPKYEJ.js";
208
+ } from "./chunk-R2KJ22LX.js";
209
+ import {
210
+ ImprovementReviewInputSchema,
211
+ calculateFitnessScore,
212
+ createFitnessScoreCalculator,
213
+ registerImprovementReviewTool,
214
+ runImprovementReview
215
+ } from "./chunk-SRSAMAPP.js";
216
+ import {
217
+ createDefaultPolicyFirewall,
218
+ createSecureHandler,
219
+ getToolAnnotations,
220
+ getToolTimeout,
221
+ toSdkCallback,
222
+ toolStructuredError,
223
+ toolSuccessStructured,
224
+ wrapToolWithTimeout
225
+ } from "./chunk-3ZROPKLV.js";
226
+ import "./chunk-JEK5CHK2.js";
222
227
  import "./chunk-HFOQKCD2.js";
223
- import "./chunk-3ACDP4E6.js";
224
- import "./chunk-OKGHHCS5.js";
228
+ import "./chunk-P7Y3KLKG.js";
225
229
  import {
226
230
  MemoryError,
227
231
  shutdownToolMemory
228
- } from "./chunk-63OGXDHS.js";
232
+ } from "./chunk-ANH2A44T.js";
229
233
  import {
230
234
  CustomExpertDefinitionSchema,
231
235
  DATA_SUBDIRECTORIES,
@@ -244,12 +248,12 @@ import {
244
248
  loadConfig,
245
249
  runDoctor,
246
250
  validateNexusEnv
247
- } from "./chunk-77JUKFTG.js";
248
- import "./chunk-GMZDRTVJ.js";
249
- import "./chunk-KSJPDQSG.js";
251
+ } from "./chunk-23NNSR45.js";
252
+ import "./chunk-YWIZ3UQ6.js";
253
+ import "./chunk-ZBQXPP7M.js";
250
254
  import {
251
255
  DEFAULTS
252
- } from "./chunk-43UDRX3N.js";
256
+ } from "./chunk-MMW4KIBH.js";
253
257
  import "./chunk-NUBSJGQZ.js";
254
258
  import {
255
259
  capitalize,
@@ -261,12 +265,12 @@ import {
261
265
  getAvailableClis,
262
266
  isRecord,
263
267
  probeAllClis
264
- } from "./chunk-4QESFYGV.js";
265
- import "./chunk-24WC4XO2.js";
266
- import "./chunk-XBPFVWA2.js";
268
+ } from "./chunk-XMYJWMWN.js";
269
+ import "./chunk-EUUWRNDZ.js";
270
+ import "./chunk-AREIPUCD.js";
267
271
  import "./chunk-ZM4O442V.js";
268
272
  import "./chunk-PQHVC4BD.js";
269
- import "./chunk-LCLVSNST.js";
273
+ import "./chunk-Z3XF5LRT.js";
270
274
  import {
271
275
  API_TIMEOUTS,
272
276
  AgentCapability,
@@ -323,6 +327,7 @@ import {
323
327
  lookupInTreeCapability,
324
328
  ok,
325
329
  parseBoolEnv,
330
+ parseIntEnv,
326
331
  parseTierOverrides,
327
332
  resetOutcomeStore,
328
333
  runWarmUp,
@@ -336,7 +341,7 @@ import {
336
341
  validateTimeout,
337
342
  writeEmptyLine,
338
343
  writeLine
339
- } from "./chunk-OT6V5ROA.js";
344
+ } from "./chunk-2KHD2ANY.js";
340
345
  import {
341
346
  applyPortableMode,
342
347
  detectSandbox,
@@ -3115,7 +3120,7 @@ ${file.patch}
3115
3120
  violations: policyResult.violations
3116
3121
  });
3117
3122
  }
3118
- const { formatReviewComment: formatReviewComment2 } = await import("./pr-reviewer-helpers-JLWEQIN6.js");
3123
+ const { formatReviewComment: formatReviewComment2 } = await import("./pr-reviewer-helpers-G4O22XF6.js");
3119
3124
  const body = formatReviewComment2(result);
3120
3125
  const postResult = await provider.createReview(pr.prNumber, body, result.decision);
3121
3126
  if (!postResult.ok) {
@@ -17435,6 +17440,7 @@ function runStpaSafetyAnalysis(logger18, failOnHighSeverity) {
17435
17440
  var defaultLogger = createLogger({ component: "TuneStage" });
17436
17441
  var TUNE_ENFORCE_ENV = "NEXUS_TUNE_ENFORCE";
17437
17442
  var TUNE_ENFORCE_DEMOTION = 0.15;
17443
+ var AUDIT_REASON_MAX = 512;
17438
17444
  var TUNE_SIGNAL_TYPES = [
17439
17445
  "signal.fitness_declined",
17440
17446
  "signal.swarm_unhealthy",
@@ -17464,27 +17470,58 @@ function intendedActionFor(event) {
17464
17470
  return void 0;
17465
17471
  }
17466
17472
  }
17473
+ function auditDemotion(auditLogger, agentId, adjustment, log) {
17474
+ if (auditLogger === void 0 || adjustment === void 0) return;
17475
+ const reason = adjustment.reason.length > AUDIT_REASON_MAX ? adjustment.reason.slice(0, AUDIT_REASON_MAX) : adjustment.reason;
17476
+ try {
17477
+ auditLogger.log({
17478
+ category: "configuration",
17479
+ severity: "warning",
17480
+ outcome: "success",
17481
+ action: "tune.demote",
17482
+ actor: { type: "system", id: "tune-stage" },
17483
+ description: `Bounded routing demotion applied to ${agentId} (swarm_unhealthy)`,
17484
+ metadata: {
17485
+ cli: agentId,
17486
+ magnitude: TUNE_ENFORCE_DEMOTION,
17487
+ multiplier: adjustment.multiplier,
17488
+ reason,
17489
+ provenance: "signal.swarm_unhealthy",
17490
+ appliedAt: adjustment.appliedAt
17491
+ }
17492
+ });
17493
+ } catch (auditError) {
17494
+ log.warn("TuneStage \u2014 audit log failed (demotion still applied)", {
17495
+ error: getErrorMessage(auditError)
17496
+ });
17497
+ }
17498
+ }
17499
+ function enforceSwarmDemotion(event, action, auditLogger, log) {
17500
+ const adjustment = getTuneAdjustmentStore().demote(
17501
+ event.agentId,
17502
+ TUNE_ENFORCE_DEMOTION,
17503
+ `swarm_unhealthy: ${event.reason}`
17504
+ );
17505
+ log.info("TuneStage (enforce) \u2014 applied bounded routing demotion", {
17506
+ kind: action.kind,
17507
+ signal: action.signal,
17508
+ agentId: event.agentId,
17509
+ reason: event.reason,
17510
+ multiplier: adjustment?.multiplier
17511
+ });
17512
+ auditDemotion(auditLogger, event.agentId, adjustment, log);
17513
+ }
17467
17514
  function createTuneStage(bus, options = {}) {
17468
17515
  const enabled = options.enabled ?? false;
17469
17516
  const log = options.logger ?? defaultLogger;
17517
+ const auditLogger = options.auditLogger;
17470
17518
  return bus.subscribe({ type: [...TUNE_SIGNAL_TYPES] }, (event) => {
17471
17519
  try {
17472
17520
  const action = intendedActionFor(event);
17473
17521
  if (action === void 0) return;
17474
17522
  if (enabled) {
17475
17523
  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
- });
17524
+ enforceSwarmDemotion(event, action, auditLogger, log);
17488
17525
  return;
17489
17526
  }
17490
17527
  log.info("TuneStage (enforce) \u2014 non-routing action, shadow-only", {
@@ -17494,6 +17531,9 @@ function createTuneStage(bus, options = {}) {
17494
17531
  });
17495
17532
  return;
17496
17533
  }
17534
+ if (event.type === "signal.swarm_unhealthy") {
17535
+ getTuneAdjustmentStore().recordIntended(event.agentId, `swarm_unhealthy: ${event.reason}`);
17536
+ }
17497
17537
  log.info("TuneStage (shadow) \u2014 intended action", {
17498
17538
  kind: action.kind,
17499
17539
  signal: action.signal,
@@ -17507,7 +17547,7 @@ function createTuneStage(bus, options = {}) {
17507
17547
  var cachedTuneUnsubscribe = null;
17508
17548
  function startTuneStage(bus, options) {
17509
17549
  if (cachedTuneUnsubscribe !== null) return;
17510
- const enabled = options?.enabled ?? parseBoolEnv(TUNE_ENFORCE_ENV, false);
17550
+ const enabled = options?.enabled ?? parseBoolEnv(TUNE_ENFORCE_ENV, true);
17511
17551
  cachedTuneUnsubscribe = createTuneStage(bus, { ...options, enabled });
17512
17552
  }
17513
17553
  function shutdownTuneStage() {
@@ -17517,6 +17557,51 @@ function shutdownTuneStage() {
17517
17557
  }
17518
17558
  }
17519
17559
 
17560
+ // src/mcp/tools/improvement-review-scheduler.ts
17561
+ var defaultLogger2 = createLogger({ component: "ImprovementReviewScheduler" });
17562
+ var INTERVAL_ENV = "NEXUS_IMPROVEMENT_REVIEW_INTERVAL_MS";
17563
+ var FILE_ISSUES_ENV = "NEXUS_IMPROVEMENT_REVIEW_FILE_ISSUES";
17564
+ var schedulerTimer;
17565
+ function startImprovementReviewScheduler(options) {
17566
+ if (schedulerTimer !== void 0) return;
17567
+ const logger18 = options?.logger ?? defaultLogger2;
17568
+ const intervalMs = options?.intervalMs ?? parseIntEnv(INTERVAL_ENV, 0);
17569
+ if (intervalMs <= 0) return;
17570
+ const fileIssues = options?.fileIssues ?? parseBoolEnv(FILE_ISSUES_ENV, false);
17571
+ let running = false;
17572
+ const runOnce = async () => {
17573
+ try {
17574
+ const { runImprovementReview: runImprovementReview2, ImprovementReviewInputSchema: ImprovementReviewInputSchema2 } = await import("./improvement-review-4MTIYCOZ.js");
17575
+ const input = ImprovementReviewInputSchema2.parse({ fileIssues });
17576
+ const result = await runImprovementReview2(input, { logger: logger18 });
17577
+ logger18.info("Scheduled improvement_review complete", {
17578
+ signals: result.signals.length,
17579
+ issuesFiled: result.issuesFiled.length
17580
+ });
17581
+ } catch (error) {
17582
+ logger18.warn("Scheduled improvement_review failed", { error: getErrorMessage(error) });
17583
+ } finally {
17584
+ running = false;
17585
+ }
17586
+ };
17587
+ schedulerTimer = setInterval(() => {
17588
+ if (running) {
17589
+ logger18.debug("Scheduled improvement_review skipped \u2014 previous run still in progress");
17590
+ return;
17591
+ }
17592
+ running = true;
17593
+ void runOnce();
17594
+ }, intervalMs);
17595
+ schedulerTimer.unref();
17596
+ logger18.info("Scheduled improvement_review enabled", { intervalMs, fileIssues });
17597
+ }
17598
+ function shutdownImprovementReviewScheduler() {
17599
+ if (schedulerTimer !== void 0) {
17600
+ clearInterval(schedulerTimer);
17601
+ schedulerTimer = void 0;
17602
+ }
17603
+ }
17604
+
17520
17605
  // src/mcp/gateway/upstream-client.ts
17521
17606
  import { Client } from "@modelcontextprotocol/sdk/client/index.js";
17522
17607
  import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
@@ -18037,14 +18122,15 @@ function registerToolCategories(ctx) {
18037
18122
  if (allowed(tool.name)) tool.register(ctx.server, buildStandardDeps(ctx, tool.name));
18038
18123
  }
18039
18124
  }
18040
- function initV2PipelineSubsystems(logger18) {
18125
+ function initV2PipelineSubsystems(logger18, auditLogger) {
18041
18126
  const pluginRegistry = getPipelinePluginRegistry();
18042
18127
  const pipelineEventBus = getPipelineEventBus();
18043
18128
  const bridge = createEventBusBridge({ source: pipelineEventBus });
18044
18129
  startFeedbackSubscriber(pipelineEventBus, getOutcomeStore());
18045
- startTuneStage(pipelineEventBus);
18130
+ startTuneStage(pipelineEventBus, auditLogger !== void 0 ? { auditLogger } : void 0);
18046
18131
  startSwarmHealthSignals(getSwarmObserver(), pipelineEventBus);
18047
18132
  startFailoverSignals({ pipelineBus: pipelineEventBus });
18133
+ startImprovementReviewScheduler();
18048
18134
  const policyEngine = createDefaultPolicyEngine();
18049
18135
  const v2Config = resolveV2Config();
18050
18136
  logger18.info("V2 Pipeline OS initialized", {
@@ -18079,7 +18165,7 @@ function registerMcpTools(options) {
18079
18165
  logger: toolInfra.logger
18080
18166
  });
18081
18167
  setGlobalToolRateLimiterFactory(rateLimiterFactory);
18082
- initV2PipelineSubsystems(logger18);
18168
+ initV2PipelineSubsystems(logger18, options.auditLogger);
18083
18169
  const gatewayOptions = { ...options, server: observableServer };
18084
18170
  const ctx = createToolContext(gatewayOptions, toolInfra, rateLimiterFactory);
18085
18171
  registerToolCategories(ctx);
@@ -19370,7 +19456,7 @@ function adaptConfigToLibrary(config) {
19370
19456
  }
19371
19457
  function createBeliefPromoter() {
19372
19458
  return async (event) => {
19373
- const { getToolMemory } = await import("./tool-memory-YWX4FTIQ.js");
19459
+ const { getToolMemory } = await import("./tool-memory-53Y2TUR3.js");
19374
19460
  const tm = getToolMemory();
19375
19461
  await tm.recordBelief(
19376
19462
  `skill:${event.name}`,
@@ -19687,6 +19773,7 @@ function createShutdownCleanup(options) {
19687
19773
  shutdownTuneStage();
19688
19774
  shutdownSwarmHealthSignals();
19689
19775
  shutdownFailoverSignals();
19776
+ shutdownImprovementReviewScheduler();
19690
19777
  const closeResult = await closeServer(server, serverLogger);
19691
19778
  if (!closeResult.ok) {
19692
19779
  throw new Error(closeResult.error.message);
@@ -19742,7 +19829,8 @@ function buildGatewayConfig(config, logger18) {
19742
19829
  ...tierOverrides !== void 0 && { tierOverrides }
19743
19830
  };
19744
19831
  }
19745
- async function initializeAndRegisterTools(server, logger18, policyFirewall, config, feedbackIntegration) {
19832
+ async function initializeAndRegisterTools(server, logger18, policyFirewall, config, deps) {
19833
+ const { feedbackIntegration, auditLogger } = deps ?? {};
19746
19834
  logger18.info("Loading built-in workflow templates");
19747
19835
  const builtInTemplates = await initializeBuiltInTemplates();
19748
19836
  logger18.info("Loaded built-in templates", { count: builtInTemplates.size });
@@ -19765,7 +19853,8 @@ async function initializeAndRegisterTools(server, logger18, policyFirewall, conf
19765
19853
  ...allowedPaths !== void 0 && { allowedPaths },
19766
19854
  ...securityConfig !== void 0 && { securityConfig },
19767
19855
  ...workflowConfig !== void 0 && { workflowConfig },
19768
- ...feedbackIntegration !== void 0 && { feedbackIntegration }
19856
+ ...feedbackIntegration !== void 0 && { feedbackIntegration },
19857
+ ...auditLogger !== null && auditLogger !== void 0 && { auditLogger }
19769
19858
  };
19770
19859
  registerMcpTools(toolsOptions);
19771
19860
  }
@@ -19816,13 +19905,10 @@ async function initializeSubsystems(config, logger18) {
19816
19905
  const policyFirewall = logSecurityConfig(serverLogger, config);
19817
19906
  const auditLogger = initializeAuditLogger(config.security, serverLogger);
19818
19907
  initializeAuth(config, serverLogger);
19819
- await initializeAndRegisterTools(
19820
- server,
19821
- serverLogger,
19822
- policyFirewall,
19823
- config,
19824
- feedbackResult.feedbackIntegration
19825
- );
19908
+ await initializeAndRegisterTools(server, serverLogger, policyFirewall, config, {
19909
+ feedbackIntegration: feedbackResult.feedbackIntegration,
19910
+ auditLogger
19911
+ });
19826
19912
  return { server, serverLogger, observer, eventBusBridge, auditLogger };
19827
19913
  }
19828
19914
  var SERVER_STARTUP_TIMEOUT_MS = 3e4;
@@ -20236,7 +20322,7 @@ async function handleResearchCommand(args) {
20236
20322
  }
20237
20323
  }
20238
20324
  async function handleRegistryCommand(args) {
20239
- const { registryCommand, isValidRegistrySubcommand, formatRegistryUsage } = await import("./registry-command-FYVOMCBG.js");
20325
+ const { registryCommand, isValidRegistrySubcommand, formatRegistryUsage } = await import("./registry-command-32PUZNNG.js");
20240
20326
  const subcommand = args.subcommand;
20241
20327
  if (!isValidRegistrySubcommand(subcommand)) {
20242
20328
  process.stdout.write(`${formatRegistryUsage()}
@@ -20284,7 +20370,7 @@ async function handleVerifyCommand(args) {
20284
20370
  async function handleDoctorCommand(args) {
20285
20371
  const exitCode = await doctorCommand({ fix: args.options.fix });
20286
20372
  if (args.options.deep) {
20287
- const { runDeepDiagnostics: runDeepDiagnostics2, formatDeepDiagnostics: formatDeepDiagnostics2 } = await import("./doctor-deep-VFBQ7TY4.js");
20373
+ const { runDeepDiagnostics: runDeepDiagnostics2, formatDeepDiagnostics: formatDeepDiagnostics2 } = await import("./doctor-deep-WHCDAV3Z.js");
20288
20374
  const diag = runDeepDiagnostics2();
20289
20375
  process.stdout.write(formatDeepDiagnostics2(diag) + "\n");
20290
20376
  }
@@ -20328,7 +20414,7 @@ async function handleInitCommand(args) {
20328
20414
  process.exit(result.success ? EXIT_CODES.SUCCESS : EXIT_CODES.SERVER_START_FAILED);
20329
20415
  }
20330
20416
  async function runInitOpencodeFlow(args) {
20331
- const { runInitOpencode } = await import("./init-opencode-Y6XKR6WS.js");
20417
+ const { runInitOpencode } = await import("./init-opencode-42GKRQDA.js");
20332
20418
  const opencodePath = args.options.opencode;
20333
20419
  if (opencodePath === void 0 || opencodePath === "") {
20334
20420
  process.stderr.write("Error: --opencode requires a path argument.\n");
@@ -20355,7 +20441,7 @@ async function runInitOpencodeFlow(args) {
20355
20441
  process.exit(EXIT_CODES.SUCCESS);
20356
20442
  }
20357
20443
  async function renderOpencodeValidate(opencodePath) {
20358
- const { runOpencodeValidate } = await import("./init-opencode-Y6XKR6WS.js");
20444
+ const { runOpencodeValidate } = await import("./init-opencode-42GKRQDA.js");
20359
20445
  const result = await runOpencodeValidate(opencodePath);
20360
20446
  if (!result.ok) {
20361
20447
  process.stderr.write(`init --opencode --validate: ${result.reason ?? "failed"}
@@ -20395,7 +20481,7 @@ async function handleSetupCommandAsync(args) {
20395
20481
  process.exit(exitCode === 0 ? EXIT_CODES.SUCCESS : EXIT_CODES.SERVER_START_FAILED);
20396
20482
  }
20397
20483
  async function runCustomApiSetup(args) {
20398
- const { configureCustomApi } = await import("./setup-custom-api-3M7CU3TF.js");
20484
+ const { configureCustomApi } = await import("./setup-custom-api-K4EN47CP.js");
20399
20485
  const baseUrl = args.options.customApi;
20400
20486
  if (baseUrl === void 0) return EXIT_CODES.SERVER_START_FAILED;
20401
20487
  const input = {
@@ -22371,6 +22457,7 @@ function collectHealth() {
22371
22457
  failureBreakdown: report.failureBreakdown ?? [],
22372
22458
  cliCount: report.cliWeather.length,
22373
22459
  cliHealth: report.cliWeather.map(toCliSummary),
22460
+ tuneAdjustments: getTuneAdjustmentStore().demotionStats(),
22374
22461
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
22375
22462
  };
22376
22463
  }
@@ -22486,6 +22573,22 @@ ${c.bold}nexus-agents${c.reset}`);
22486
22573
  `);
22487
22574
  }
22488
22575
  renderFailureBreakdown(w, health.failureBreakdown);
22576
+ renderTuneAdjustments(w, health.tuneAdjustments);
22577
+ }
22578
+ function renderTuneAdjustments(w, stats) {
22579
+ if (stats.length === 0) return;
22580
+ const c = colors;
22581
+ w(
22582
+ ` ${c.bold}Self-Tuning Demotions${c.reset} ${c.dim}(applied = enforced, intended = shadow)${c.reset}
22583
+ `
22584
+ );
22585
+ for (const stat2 of stats) {
22586
+ w(
22587
+ ` ${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}
22588
+ `
22589
+ );
22590
+ }
22591
+ w("\n");
22489
22592
  }
22490
22593
  function renderJson2(health) {
22491
22594
  process.stdout.write(JSON.stringify(health, null, 2) + "\n");