nexus-agents 2.167.1 → 2.168.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 (120) hide show
  1. package/dist/{child-mcp-config-X4YLQKGK.js → child-mcp-config-FAWSJFMQ.js} +2 -2
  2. package/dist/{chunk-KM3YEIEN.js → chunk-2ANAH2UU.js} +4 -4
  3. package/dist/{chunk-7USEQLMS.js → chunk-2Z4QECP7.js} +2 -2
  4. package/dist/{chunk-7K5LSUEU.js → chunk-3KID7AIF.js} +3 -3
  5. package/dist/{chunk-2S7T66IQ.js → chunk-52T2MJDS.js} +34 -34
  6. package/dist/{chunk-PC4Y4VPX.js → chunk-5LPPJIZ4.js} +2 -2
  7. package/dist/{chunk-XUMLVCFL.js → chunk-6ERIC5NJ.js} +2 -2
  8. package/dist/{chunk-S6HCREYY.js → chunk-7IUVW67T.js} +7 -7
  9. package/dist/{chunk-ZIC6ZZFU.js → chunk-CJLMB7MO.js} +3 -3
  10. package/dist/{chunk-O6VL6LA4.js → chunk-CPS2HN4T.js} +2 -2
  11. package/dist/{chunk-TGAVZ2ZL.js → chunk-ELWMGKVP.js} +8 -8
  12. package/dist/{chunk-JKUX73VD.js → chunk-EQLJYWLP.js} +3 -3
  13. package/dist/{chunk-GGYQTV2Y.js → chunk-ETFCT2CH.js} +4 -4
  14. package/dist/{chunk-BB7KSLNA.js → chunk-F5JDQXHJ.js} +2 -2
  15. package/dist/{chunk-STMW5BSR.js → chunk-G7NDNFIE.js} +3 -3
  16. package/dist/{chunk-GRWHPG72.js → chunk-GNCUZDQI.js} +7 -7
  17. package/dist/{chunk-ZSUN7BHE.js → chunk-HJA3Z56H.js} +696 -14
  18. package/dist/chunk-HJA3Z56H.js.map +1 -0
  19. package/dist/{chunk-COIZLMGV.js → chunk-HZNOSJOO.js} +3 -3
  20. package/dist/{chunk-3T6KLPGT.js → chunk-I3LGUSZ3.js} +5 -5
  21. package/dist/{chunk-UNIDAVVR.js → chunk-IAGLVGHN.js} +2 -2
  22. package/dist/{chunk-7YD3TRDX.js → chunk-LNPKBBPG.js} +4 -4
  23. package/dist/{chunk-IFSIKGHI.js → chunk-MSBYVBPX.js} +2 -2
  24. package/dist/{chunk-QPSYBHK6.js → chunk-MX3XD2ML.js} +2 -2
  25. package/dist/{chunk-VNVGGM73.js → chunk-N56C2MWI.js} +2 -2
  26. package/dist/{chunk-CURHM4TH.js → chunk-OKAHIWG4.js} +3 -3
  27. package/dist/{chunk-6KCZA3IO.js → chunk-OLCDGMEO.js} +4 -4
  28. package/dist/{chunk-EUQNHT7O.js → chunk-P7RBQUAG.js} +12 -8
  29. package/dist/chunk-P7RBQUAG.js.map +1 -0
  30. package/dist/{chunk-QV52AXTF.js → chunk-RJHLNI37.js} +2 -2
  31. package/dist/{chunk-GVNY4ZB6.js → chunk-RQNBJ7AS.js} +2 -2
  32. package/dist/{chunk-ZAPCPHGZ.js → chunk-TORS5V2C.js} +2 -2
  33. package/dist/{chunk-RKIPSMCN.js → chunk-TZK7VQAW.js} +5 -5
  34. package/dist/{chunk-ZTTUXPBQ.js → chunk-UGJRDFMN.js} +2 -2
  35. package/dist/{chunk-SRNAXDOT.js → chunk-UN7PYUJB.js} +2 -2
  36. package/dist/{chunk-2NU774CB.js → chunk-VQE3OSUW.js} +2 -2
  37. package/dist/{cli-circuit-breaker-2AAHSCHR.js → cli-circuit-breaker-JDGZ25MD.js} +4 -4
  38. package/dist/cli.js +391 -892
  39. package/dist/cli.js.map +1 -1
  40. package/dist/{composite-router-WOVGICBS.js → composite-router-EZPPVCMD.js} +2 -2
  41. package/dist/{consensus-vote-322S65GQ.js → consensus-vote-YKKJHLOD.js} +15 -15
  42. package/dist/{context-retriever-YMJY6YBJ.js → context-retriever-EGMARBAC.js} +8 -8
  43. package/dist/{doctor-deep-DALT3OXC.js → doctor-deep-QTBDR3VV.js} +3 -3
  44. package/dist/{expert-bridge-WNV3ST2T.js → expert-bridge-FZYJ3XAL.js} +4 -4
  45. package/dist/{factory-TLSTFONW.js → factory-NDMPXPYE.js} +5 -5
  46. package/dist/{factory-33HQYVCK.js → factory-SABHBAHC.js} +8 -8
  47. package/dist/{improvement-review-2W6LKP74.js → improvement-review-WYFGNEVP.js} +5 -5
  48. package/dist/index.js +30 -30
  49. package/dist/{init-opencode-XVTVJ6FN.js → init-opencode-CMGJ3TXZ.js} +5 -5
  50. package/dist/{issue-triage-CVMVZ3IV.js → issue-triage-NHRZGMKC.js} +6 -6
  51. package/dist/{pr-reviewer-helpers-SAMOVLNJ.js → pr-reviewer-helpers-HJRFRUZX.js} +4 -4
  52. package/dist/{registry-command-5D2DJT53.js → registry-command-JCOZA7TM.js} +2 -2
  53. package/dist/{repo-security-plan-F7V5SHAQ.js → repo-security-plan-OMY33VHA.js} +3 -3
  54. package/dist/{research-helpers-synthesize-F4PV4B4B.js → research-helpers-synthesize-DFINP3KN.js} +4 -4
  55. package/dist/{routing-memory-G6YBK4WI.js → routing-memory-KK4GPB64.js} +2 -2
  56. package/dist/{session-memory-DAJHLPOY.js → session-memory-QTHGU2XM.js} +3 -3
  57. package/dist/{setup-command-NUNIRAFN.js → setup-command-CURZCHSQ.js} +13 -13
  58. package/dist/{setup-config-HKUWFV5N.js → setup-config-FX6SJXGQ.js} +3 -3
  59. package/dist/{setup-custom-api-XRUPWEPF.js → setup-custom-api-MYN4EVT2.js} +3 -3
  60. package/dist/{tool-memory-XJ5VRMNQ.js → tool-memory-3W5NXR4P.js} +5 -5
  61. package/dist/{unified-registry-ETKPTZBU.js → unified-registry-PKPNJ3G7.js} +9 -9
  62. package/dist/{weather-report-TWBLIHPZ.js → weather-report-46ZY3X2Z.js} +2 -2
  63. package/package.json +1 -1
  64. package/dist/chunk-EUQNHT7O.js.map +0 -1
  65. package/dist/chunk-ZSUN7BHE.js.map +0 -1
  66. /package/dist/{child-mcp-config-X4YLQKGK.js.map → child-mcp-config-FAWSJFMQ.js.map} +0 -0
  67. /package/dist/{chunk-KM3YEIEN.js.map → chunk-2ANAH2UU.js.map} +0 -0
  68. /package/dist/{chunk-7USEQLMS.js.map → chunk-2Z4QECP7.js.map} +0 -0
  69. /package/dist/{chunk-7K5LSUEU.js.map → chunk-3KID7AIF.js.map} +0 -0
  70. /package/dist/{chunk-2S7T66IQ.js.map → chunk-52T2MJDS.js.map} +0 -0
  71. /package/dist/{chunk-PC4Y4VPX.js.map → chunk-5LPPJIZ4.js.map} +0 -0
  72. /package/dist/{chunk-XUMLVCFL.js.map → chunk-6ERIC5NJ.js.map} +0 -0
  73. /package/dist/{chunk-S6HCREYY.js.map → chunk-7IUVW67T.js.map} +0 -0
  74. /package/dist/{chunk-ZIC6ZZFU.js.map → chunk-CJLMB7MO.js.map} +0 -0
  75. /package/dist/{chunk-O6VL6LA4.js.map → chunk-CPS2HN4T.js.map} +0 -0
  76. /package/dist/{chunk-TGAVZ2ZL.js.map → chunk-ELWMGKVP.js.map} +0 -0
  77. /package/dist/{chunk-JKUX73VD.js.map → chunk-EQLJYWLP.js.map} +0 -0
  78. /package/dist/{chunk-GGYQTV2Y.js.map → chunk-ETFCT2CH.js.map} +0 -0
  79. /package/dist/{chunk-BB7KSLNA.js.map → chunk-F5JDQXHJ.js.map} +0 -0
  80. /package/dist/{chunk-STMW5BSR.js.map → chunk-G7NDNFIE.js.map} +0 -0
  81. /package/dist/{chunk-GRWHPG72.js.map → chunk-GNCUZDQI.js.map} +0 -0
  82. /package/dist/{chunk-COIZLMGV.js.map → chunk-HZNOSJOO.js.map} +0 -0
  83. /package/dist/{chunk-3T6KLPGT.js.map → chunk-I3LGUSZ3.js.map} +0 -0
  84. /package/dist/{chunk-UNIDAVVR.js.map → chunk-IAGLVGHN.js.map} +0 -0
  85. /package/dist/{chunk-7YD3TRDX.js.map → chunk-LNPKBBPG.js.map} +0 -0
  86. /package/dist/{chunk-IFSIKGHI.js.map → chunk-MSBYVBPX.js.map} +0 -0
  87. /package/dist/{chunk-QPSYBHK6.js.map → chunk-MX3XD2ML.js.map} +0 -0
  88. /package/dist/{chunk-VNVGGM73.js.map → chunk-N56C2MWI.js.map} +0 -0
  89. /package/dist/{chunk-CURHM4TH.js.map → chunk-OKAHIWG4.js.map} +0 -0
  90. /package/dist/{chunk-6KCZA3IO.js.map → chunk-OLCDGMEO.js.map} +0 -0
  91. /package/dist/{chunk-QV52AXTF.js.map → chunk-RJHLNI37.js.map} +0 -0
  92. /package/dist/{chunk-GVNY4ZB6.js.map → chunk-RQNBJ7AS.js.map} +0 -0
  93. /package/dist/{chunk-ZAPCPHGZ.js.map → chunk-TORS5V2C.js.map} +0 -0
  94. /package/dist/{chunk-RKIPSMCN.js.map → chunk-TZK7VQAW.js.map} +0 -0
  95. /package/dist/{chunk-ZTTUXPBQ.js.map → chunk-UGJRDFMN.js.map} +0 -0
  96. /package/dist/{chunk-SRNAXDOT.js.map → chunk-UN7PYUJB.js.map} +0 -0
  97. /package/dist/{chunk-2NU774CB.js.map → chunk-VQE3OSUW.js.map} +0 -0
  98. /package/dist/{cli-circuit-breaker-2AAHSCHR.js.map → cli-circuit-breaker-JDGZ25MD.js.map} +0 -0
  99. /package/dist/{composite-router-WOVGICBS.js.map → composite-router-EZPPVCMD.js.map} +0 -0
  100. /package/dist/{consensus-vote-322S65GQ.js.map → consensus-vote-YKKJHLOD.js.map} +0 -0
  101. /package/dist/{context-retriever-YMJY6YBJ.js.map → context-retriever-EGMARBAC.js.map} +0 -0
  102. /package/dist/{doctor-deep-DALT3OXC.js.map → doctor-deep-QTBDR3VV.js.map} +0 -0
  103. /package/dist/{expert-bridge-WNV3ST2T.js.map → expert-bridge-FZYJ3XAL.js.map} +0 -0
  104. /package/dist/{factory-33HQYVCK.js.map → factory-NDMPXPYE.js.map} +0 -0
  105. /package/dist/{factory-TLSTFONW.js.map → factory-SABHBAHC.js.map} +0 -0
  106. /package/dist/{improvement-review-2W6LKP74.js.map → improvement-review-WYFGNEVP.js.map} +0 -0
  107. /package/dist/{init-opencode-XVTVJ6FN.js.map → init-opencode-CMGJ3TXZ.js.map} +0 -0
  108. /package/dist/{issue-triage-CVMVZ3IV.js.map → issue-triage-NHRZGMKC.js.map} +0 -0
  109. /package/dist/{pr-reviewer-helpers-SAMOVLNJ.js.map → pr-reviewer-helpers-HJRFRUZX.js.map} +0 -0
  110. /package/dist/{registry-command-5D2DJT53.js.map → registry-command-JCOZA7TM.js.map} +0 -0
  111. /package/dist/{repo-security-plan-F7V5SHAQ.js.map → repo-security-plan-OMY33VHA.js.map} +0 -0
  112. /package/dist/{research-helpers-synthesize-F4PV4B4B.js.map → research-helpers-synthesize-DFINP3KN.js.map} +0 -0
  113. /package/dist/{routing-memory-G6YBK4WI.js.map → routing-memory-KK4GPB64.js.map} +0 -0
  114. /package/dist/{session-memory-DAJHLPOY.js.map → session-memory-QTHGU2XM.js.map} +0 -0
  115. /package/dist/{setup-command-NUNIRAFN.js.map → setup-command-CURZCHSQ.js.map} +0 -0
  116. /package/dist/{setup-config-HKUWFV5N.js.map → setup-config-FX6SJXGQ.js.map} +0 -0
  117. /package/dist/{setup-custom-api-XRUPWEPF.js.map → setup-custom-api-MYN4EVT2.js.map} +0 -0
  118. /package/dist/{tool-memory-XJ5VRMNQ.js.map → tool-memory-3W5NXR4P.js.map} +0 -0
  119. /package/dist/{unified-registry-ETKPTZBU.js.map → unified-registry-PKPNJ3G7.js.map} +0 -0
  120. /package/dist/{weather-report-TWBLIHPZ.js.map → weather-report-46ZY3X2Z.js.map} +0 -0
package/dist/cli.js CHANGED
@@ -13,13 +13,13 @@ import {
13
13
  generateSummary,
14
14
  parseFindings,
15
15
  sumFindings
16
- } from "./chunk-JKUX73VD.js";
17
- import "./chunk-O6VL6LA4.js";
16
+ } from "./chunk-EQLJYWLP.js";
17
+ import "./chunk-CPS2HN4T.js";
18
18
  import {
19
19
  setupCommandAsync,
20
20
  verifyCommand
21
- } from "./chunk-3T6KLPGT.js";
22
- import "./chunk-XUMLVCFL.js";
21
+ } from "./chunk-I3LGUSZ3.js";
22
+ import "./chunk-6ERIC5NJ.js";
23
23
  import {
24
24
  AuthHandler,
25
25
  DEFAULT_EXPERTS,
@@ -138,8 +138,8 @@ import {
138
138
  validateCommand,
139
139
  validateWorkflow,
140
140
  wrapInMarkdownFence
141
- } from "./chunk-2S7T66IQ.js";
142
- import "./chunk-VNVGGM73.js";
141
+ } from "./chunk-52T2MJDS.js";
142
+ import "./chunk-N56C2MWI.js";
143
143
  import "./chunk-HFOQKCD2.js";
144
144
  import "./chunk-AO4X3BMP.js";
145
145
  import {
@@ -165,15 +165,15 @@ import {
165
165
  loadConfig,
166
166
  runDoctor,
167
167
  validateNexusEnv
168
- } from "./chunk-EUQNHT7O.js";
168
+ } from "./chunk-P7RBQUAG.js";
169
169
  import {
170
170
  buildOpenAICompatAdapters,
171
171
  readOpenAICompatEnv
172
- } from "./chunk-6KCZA3IO.js";
173
- import "./chunk-COIZLMGV.js";
172
+ } from "./chunk-OLCDGMEO.js";
173
+ import "./chunk-HZNOSJOO.js";
174
174
  import {
175
175
  shutdownExpertBridge
176
- } from "./chunk-GRWHPG72.js";
176
+ } from "./chunk-GNCUZDQI.js";
177
177
  import {
178
178
  ConsensusVoteInputSchema,
179
179
  DEFAULT_VOTE_TIMEOUT_MS,
@@ -183,25 +183,25 @@ import {
183
183
  executeVoting,
184
184
  mapOutcomeToDecision,
185
185
  registerConsensusVoteTool
186
- } from "./chunk-TGAVZ2ZL.js";
186
+ } from "./chunk-ELWMGKVP.js";
187
187
  import {
188
188
  loadUsageEvents,
189
189
  rollupByModel
190
- } from "./chunk-ZAPCPHGZ.js";
190
+ } from "./chunk-TORS5V2C.js";
191
191
  import {
192
192
  synthesizeResearch
193
- } from "./chunk-7K5LSUEU.js";
193
+ } from "./chunk-3KID7AIF.js";
194
194
  import {
195
195
  classifyTrust,
196
196
  createFullGitHubProvider,
197
197
  evaluatePolicy,
198
198
  parsePRUrl
199
- } from "./chunk-RKIPSMCN.js";
200
- import "./chunk-BB7KSLNA.js";
199
+ } from "./chunk-TZK7VQAW.js";
200
+ import "./chunk-F5JDQXHJ.js";
201
201
  import {
202
202
  ReputationCache,
203
203
  sanitizeInput
204
- } from "./chunk-SRNAXDOT.js";
204
+ } from "./chunk-UN7PYUJB.js";
205
205
  import {
206
206
  ImprovementReviewInputSchema,
207
207
  calculateFitnessScore,
@@ -215,13 +215,15 @@ import {
215
215
  registerImprovementReviewTool,
216
216
  runImprovementReview,
217
217
  scanForSecrets
218
- } from "./chunk-ZIC6ZZFU.js";
218
+ } from "./chunk-CJLMB7MO.js";
219
219
  import {
220
220
  createDefaultPolicyFirewall
221
- } from "./chunk-STMW5BSR.js";
222
- import "./chunk-QV52AXTF.js";
221
+ } from "./chunk-G7NDNFIE.js";
222
+ import "./chunk-RJHLNI37.js";
223
223
  import {
224
+ CodebaseIndexSchema,
224
225
  PaperStatusSchema,
226
+ buildIndex,
225
227
  createResearchIssue,
226
228
  discoverDeepMind,
227
229
  discoverGitHubRepos,
@@ -231,6 +233,7 @@ import {
231
233
  discoverOpenAlex,
232
234
  discoverPapersWithCode,
233
235
  discoverSemanticScholar,
236
+ extractProject,
234
237
  findOverlaps,
235
238
  formatOverlapResult,
236
239
  formatResearchIssueBody,
@@ -242,32 +245,31 @@ import {
242
245
  loadSourcesRegistry,
243
246
  rankDiscoveredItems,
244
247
  saveSourcesRegistry
245
- } from "./chunk-ZSUN7BHE.js";
248
+ } from "./chunk-HJA3Z56H.js";
246
249
  import {
247
250
  resolveToken
248
- } from "./chunk-UNIDAVVR.js";
251
+ } from "./chunk-IAGLVGHN.js";
249
252
  import {
250
253
  loadPapersRegistry,
251
254
  loadTechniquesRegistry,
252
255
  savePapersRegistry
253
- } from "./chunk-PC4Y4VPX.js";
256
+ } from "./chunk-5LPPJIZ4.js";
254
257
  import "./chunk-NUBSJGQZ.js";
255
258
  import {
256
259
  MemoryError,
257
260
  shutdownToolMemory
258
- } from "./chunk-KM3YEIEN.js";
261
+ } from "./chunk-2ANAH2UU.js";
259
262
  import {
260
263
  capitalize,
261
- capitalizeKebab,
262
- truncateSentence
264
+ capitalizeKebab
263
265
  } from "./chunk-6T3EPABN.js";
264
- import "./chunk-QPSYBHK6.js";
266
+ import "./chunk-MX3XD2ML.js";
265
267
  import "./chunk-ZM4O442V.js";
266
268
  import "./chunk-PINS44XA.js";
267
269
  import "./chunk-KSQSWEFH.js";
268
270
  import {
269
271
  createUnifiedRegistry
270
- } from "./chunk-GGYQTV2Y.js";
272
+ } from "./chunk-ETFCT2CH.js";
271
273
  import {
272
274
  NEXUS_SUBPROCESS_DEPTH_ENV,
273
275
  createAllAdapters,
@@ -275,15 +277,15 @@ import {
275
277
  isRecord,
276
278
  probeAllClis,
277
279
  readSubprocessDepth
278
- } from "./chunk-S6HCREYY.js";
279
- import "./chunk-IFSIKGHI.js";
280
+ } from "./chunk-7IUVW67T.js";
281
+ import "./chunk-MSBYVBPX.js";
280
282
  import {
281
283
  DEFAULTS
282
- } from "./chunk-2NU774CB.js";
283
- import "./chunk-GVNY4ZB6.js";
284
- import "./chunk-ZTTUXPBQ.js";
284
+ } from "./chunk-VQE3OSUW.js";
285
+ import "./chunk-RQNBJ7AS.js";
286
+ import "./chunk-UGJRDFMN.js";
285
287
  import "./chunk-QZUG667L.js";
286
- import "./chunk-7USEQLMS.js";
288
+ import "./chunk-2Z4QECP7.js";
287
289
  import {
288
290
  API_TIMEOUTS,
289
291
  AgentCapability,
@@ -357,7 +359,7 @@ import {
357
359
  validateTimeout,
358
360
  writeEmptyLine,
359
361
  writeLine
360
- } from "./chunk-CURHM4TH.js";
362
+ } from "./chunk-OKAHIWG4.js";
361
363
  import "./chunk-AXTD4TFK.js";
362
364
  import {
363
365
  applyPortableMode,
@@ -645,8 +647,8 @@ function resolveOutputPath(output2) {
645
647
  }
646
648
  return resolve(process.cwd(), DEFAULT_CONFIG_REL_PATH);
647
649
  }
648
- function fileExists(path21) {
649
- return existsSync(path21);
650
+ function fileExists(path18) {
651
+ return existsSync(path18);
650
652
  }
651
653
  async function ensureDirectory(filePath) {
652
654
  const dir = dirname(filePath);
@@ -654,9 +656,9 @@ async function ensureDirectory(filePath) {
654
656
  await mkdir(dir, { recursive: true });
655
657
  }
656
658
  }
657
- async function writeConfigFile(path21) {
658
- await ensureDirectory(path21);
659
- await writeFile(path21, renderConfigTemplate() + CONFIG_TEMPLATE_TAIL, "utf-8");
659
+ async function writeConfigFile(path18) {
660
+ await ensureDirectory(path18);
661
+ await writeFile(path18, renderConfigTemplate() + CONFIG_TEMPLATE_TAIL, "utf-8");
660
662
  }
661
663
  async function runConfigInit(options = {}) {
662
664
  const outputPath = resolveOutputPath(options.output);
@@ -1636,14 +1638,14 @@ ${colors.dim}Session ended.${colors.reset}
1636
1638
  });
1637
1639
  });
1638
1640
  rl.prompt();
1639
- return new Promise((resolve14) => {
1641
+ return new Promise((resolve13) => {
1640
1642
  rl.on("line", (line) => {
1641
1643
  void (async () => {
1642
1644
  try {
1643
1645
  const shouldExit = await processLine(line, session, logger19);
1644
1646
  if (shouldExit) {
1645
1647
  rl.close();
1646
- resolve14();
1648
+ resolve13();
1647
1649
  return;
1648
1650
  }
1649
1651
  } catch (error) {
@@ -1655,7 +1657,7 @@ ${colors.dim}Session ended.${colors.reset}
1655
1657
  })();
1656
1658
  });
1657
1659
  rl.on("close", () => {
1658
- resolve14();
1660
+ resolve13();
1659
1661
  });
1660
1662
  });
1661
1663
  }
@@ -2701,9 +2703,9 @@ async function evaluateDirectory(target, timeoutMs, store = getOutcomeStore()) {
2701
2703
  }
2702
2704
  const aggregator = createAggregator();
2703
2705
  const results = [];
2704
- for (const [path21, evaluations] of evaluationsByComponent) {
2706
+ for (const [path18, evaluations] of evaluationsByComponent) {
2705
2707
  if (evaluations.length > 0) {
2706
- results.push(aggregator.aggregate(path21, evaluations));
2708
+ results.push(aggregator.aggregate(path18, evaluations));
2707
2709
  }
2708
2710
  }
2709
2711
  const priority = { deprecate: 0, refactor: 1, review: 2, retain: 3 };
@@ -4035,7 +4037,7 @@ ${file.patch}
4035
4037
  violations: policyResult.violations
4036
4038
  });
4037
4039
  }
4038
- const { formatReviewComment: formatReviewComment2 } = await import("./pr-reviewer-helpers-SAMOVLNJ.js");
4040
+ const { formatReviewComment: formatReviewComment2 } = await import("./pr-reviewer-helpers-HJRFRUZX.js");
4039
4041
  const body = formatReviewComment2(result);
4040
4042
  const postResult = await provider.createReview(pr.prNumber, body, result.decision);
4041
4043
  if (!postResult.ok) {
@@ -5081,27 +5083,27 @@ var CliAdapterAgent = class {
5081
5083
  };
5082
5084
 
5083
5085
  // src/cli/orchestrate-puppeteer.ts
5084
- function loadPolicyParameters(path21, logger19) {
5086
+ function loadPolicyParameters(path18, logger19) {
5085
5087
  try {
5086
- if (fs2.existsSync(path21)) {
5087
- const content = fs2.readFileSync(path21, "utf-8");
5088
+ if (fs2.existsSync(path18)) {
5089
+ const content = fs2.readFileSync(path18, "utf-8");
5088
5090
  const params = JSON.parse(content);
5089
- logger19.info("Loaded policy parameters", { path: path21 });
5091
+ logger19.info("Loaded policy parameters", { path: path18 });
5090
5092
  return params;
5091
5093
  }
5092
5094
  } catch (error) {
5093
5095
  const message = getErrorMessage(error);
5094
- logger19.warn("Failed to load policy parameters", { path: path21, error: message });
5096
+ logger19.warn("Failed to load policy parameters", { path: path18, error: message });
5095
5097
  }
5096
5098
  return void 0;
5097
5099
  }
5098
- function savePolicyParameters(path21, params, logger19) {
5100
+ function savePolicyParameters(path18, params, logger19) {
5099
5101
  try {
5100
- fs2.writeFileSync(path21, JSON.stringify(params, null, 2));
5101
- logger19.info("Saved policy parameters", { path: path21 });
5102
+ fs2.writeFileSync(path18, JSON.stringify(params, null, 2));
5103
+ logger19.info("Saved policy parameters", { path: path18 });
5102
5104
  } catch (error) {
5103
5105
  const message = getErrorMessage(error);
5104
- logger19.warn("Failed to save policy parameters", { path: path21, error: message });
5106
+ logger19.warn("Failed to save policy parameters", { path: path18, error: message });
5105
5107
  }
5106
5108
  }
5107
5109
  function createAgentsFromAdapters(adapters) {
@@ -9800,515 +9802,12 @@ async function researchCommand(subcommand, args, options) {
9800
9802
 
9801
9803
  // src/cli/index-command.ts
9802
9804
  import * as fs13 from "fs/promises";
9803
- import * as path17 from "path";
9805
+ import * as path14 from "path";
9804
9806
  import * as yaml6 from "yaml";
9805
9807
 
9806
- // src/indexer/types.ts
9807
- import { z as z4 } from "zod";
9808
- var SCHEMA_VERSION = "1.0";
9809
- var ExportEntrySchema = z4.object({
9810
- name: z4.string(),
9811
- kind: z4.enum(["type", "interface", "class", "function", "const", "enum", "unknown"]),
9812
- isReExport: z4.boolean(),
9813
- sourceModule: z4.string().optional()
9814
- });
9815
- var DependencyEntrySchema = z4.object({
9816
- specifier: z4.string(),
9817
- isExternal: z4.boolean(),
9818
- imports: z4.array(z4.string()).readonly()
9819
- });
9820
- var FileEntrySchema = z4.object({
9821
- path: z4.string(),
9822
- lines: z4.number().int().nonnegative(),
9823
- category: z4.enum(["types", "implementation", "test", "config", "cli", "util", "index"]),
9824
- exports: z4.array(ExportEntrySchema).readonly(),
9825
- dependencies: z4.array(DependencyEntrySchema).readonly(),
9826
- description: z4.string().optional()
9827
- });
9828
- var ModuleStatsSchema = z4.object({
9829
- fileCount: z4.number().int().nonnegative(),
9830
- totalLines: z4.number().int().nonnegative(),
9831
- exportCount: z4.number().int().nonnegative(),
9832
- internalDeps: z4.number().int().nonnegative(),
9833
- externalDeps: z4.number().int().nonnegative()
9834
- });
9835
- var ModuleEntrySchema = z4.object({
9836
- name: z4.string(),
9837
- path: z4.string(),
9838
- purpose: z4.string(),
9839
- files: z4.array(FileEntrySchema).readonly(),
9840
- stats: ModuleStatsSchema,
9841
- dependsOn: z4.array(z4.string()).readonly()
9842
- });
9843
- var IndexStatsSchema = z4.object({
9844
- totalFiles: z4.number().int().nonnegative(),
9845
- totalLines: z4.number().int().nonnegative(),
9846
- totalExports: z4.number().int().nonnegative(),
9847
- moduleCount: z4.number().int().nonnegative(),
9848
- externalPackages: z4.array(z4.string()).readonly()
9849
- });
9850
- var CodebaseIndexSchema = z4.object({
9851
- schemaVersion: z4.literal(SCHEMA_VERSION),
9852
- generatedAt: z4.string(),
9853
- stats: IndexStatsSchema,
9854
- modules: z4.record(z4.string(), ModuleEntrySchema)
9855
- });
9856
- var DEFAULT_EXTRACTOR_OPTIONS = {
9857
- rootDir: "src",
9858
- include: ["**/*.ts"],
9859
- exclude: ["**/*.test.ts", "**/*.d.ts", "**/node_modules/**"],
9860
- extractDescriptions: true
9861
- };
9862
-
9863
- // src/indexer/category-detection.ts
9864
- import * as path8 from "path";
9865
- var FILE_SUFFIX_PATTERNS = [
9866
- [".test.ts", "test"],
9867
- [".spec.ts", "test"],
9868
- ["-types.ts", "types"],
9869
- [".types.ts", "types"],
9870
- ["-command.ts", "cli"]
9871
- ];
9872
- var FILE_PATH_PATTERNS = [
9873
- { test: (f) => f === "index.ts", category: "index" },
9874
- { test: (_, d) => d.includes("/cli"), category: "cli" },
9875
- { test: (f, d) => d.includes("config") || f.includes("config"), category: "config" },
9876
- { test: (f) => f.includes("helper") || f.includes("util"), category: "util" }
9877
- ];
9878
- function detectCategoryFromPath(fileName, dirName) {
9879
- for (const [suffix, category] of FILE_SUFFIX_PATTERNS) {
9880
- if (fileName.endsWith(suffix)) return category;
9881
- }
9882
- for (const { test, category } of FILE_PATH_PATTERNS) {
9883
- if (test(fileName, dirName)) return category;
9884
- }
9885
- return void 0;
9886
- }
9887
- function isTypesOnlyFile(sourceFile) {
9888
- const typeCount = sourceFile.getTypeAliases().length + sourceFile.getInterfaces().length;
9889
- const implCount = sourceFile.getFunctions().length + sourceFile.getClasses().length + sourceFile.getVariableDeclarations().length;
9890
- return typeCount > 0 && implCount === 0;
9891
- }
9892
- function detectFileCategory(filePath, sourceFile) {
9893
- const pathCategory = detectCategoryFromPath(path8.basename(filePath), path8.dirname(filePath));
9894
- if (pathCategory !== void 0) return pathCategory;
9895
- if (isTypesOnlyFile(sourceFile)) return "types";
9896
- return "implementation";
9897
- }
9898
-
9899
- // src/indexer/export-extraction.ts
9900
- function addExport(state, name, kind, reExportInfo) {
9901
- if (state.seenNames.has(name)) return;
9902
- state.seenNames.add(name);
9903
- const entry = { name, kind, isReExport: reExportInfo !== void 0 };
9904
- if (reExportInfo !== void 0)
9905
- entry.sourceModule = reExportInfo.sourceModule;
9906
- state.exports.push(entry);
9907
- }
9908
- function extractFunctionClassExports(sourceFile, state) {
9909
- for (const fn of sourceFile.getFunctions()) {
9910
- if (fn.isExported()) {
9911
- const name = fn.getName();
9912
- if (name !== void 0) addExport(state, name, "function");
9913
- }
9914
- }
9915
- for (const cls of sourceFile.getClasses()) {
9916
- if (cls.isExported()) {
9917
- const name = cls.getName();
9918
- if (name !== void 0) addExport(state, name, "class");
9919
- }
9920
- }
9921
- }
9922
- function extractTypeExports(sourceFile, state) {
9923
- for (const iface of sourceFile.getInterfaces()) {
9924
- if (iface.isExported()) addExport(state, iface.getName(), "interface");
9925
- }
9926
- for (const typeAlias of sourceFile.getTypeAliases()) {
9927
- if (typeAlias.isExported()) addExport(state, typeAlias.getName(), "type");
9928
- }
9929
- for (const enumDecl of sourceFile.getEnums()) {
9930
- if (enumDecl.isExported()) addExport(state, enumDecl.getName(), "enum");
9931
- }
9932
- }
9933
- function extractVariableExports(sourceFile, state) {
9934
- for (const varStmt of sourceFile.getVariableStatements()) {
9935
- if (varStmt.isExported()) {
9936
- for (const decl of varStmt.getDeclarations()) addExport(state, decl.getName(), "const");
9937
- }
9938
- }
9939
- }
9940
- function extractReExports(sourceFile, state) {
9941
- for (const exportDecl of sourceFile.getExportDeclarations()) {
9942
- const moduleSpecifier = exportDecl.getModuleSpecifierValue();
9943
- const namedExports = exportDecl.getNamedExports();
9944
- const reExportInfo = moduleSpecifier !== void 0 ? { sourceModule: moduleSpecifier } : void 0;
9945
- for (const namedExport of namedExports) {
9946
- const name = namedExport.getAliasNode()?.getText() ?? namedExport.getName();
9947
- addExport(state, name, "unknown", reExportInfo);
9948
- }
9949
- if (namedExports.length === 0 && reExportInfo !== void 0) {
9950
- addExport(state, "*", "unknown", reExportInfo);
9951
- }
9952
- }
9953
- }
9954
- function extractExports(sourceFile) {
9955
- const state = { exports: [], seenNames: /* @__PURE__ */ new Set() };
9956
- extractFunctionClassExports(sourceFile, state);
9957
- extractTypeExports(sourceFile, state);
9958
- extractVariableExports(sourceFile, state);
9959
- extractReExports(sourceFile, state);
9960
- return state.exports;
9961
- }
9962
-
9963
- // src/indexer/dependency-extraction.ts
9964
- function isExternalImport(specifier) {
9965
- if (specifier.startsWith(".") || specifier.startsWith("/")) {
9966
- return false;
9967
- }
9968
- if (specifier.startsWith("node:")) {
9969
- return true;
9970
- }
9971
- return true;
9972
- }
9973
- function extractDependencies(sourceFile) {
9974
- const deps = [];
9975
- const seenSpecifiers = /* @__PURE__ */ new Set();
9976
- for (const importDecl of sourceFile.getImportDeclarations()) {
9977
- const specifier = importDecl.getModuleSpecifierValue();
9978
- if (seenSpecifiers.has(specifier)) continue;
9979
- seenSpecifiers.add(specifier);
9980
- const imports = [];
9981
- const namedImports = importDecl.getNamedImports();
9982
- for (const namedImport of namedImports) {
9983
- imports.push(namedImport.getName());
9984
- }
9985
- const defaultImport = importDecl.getDefaultImport();
9986
- if (defaultImport !== void 0) {
9987
- imports.push(defaultImport.getText());
9988
- }
9989
- const namespaceImport = importDecl.getNamespaceImport();
9990
- if (namespaceImport !== void 0) {
9991
- imports.push(`* as ${namespaceImport.getText()}`);
9992
- }
9993
- deps.push({
9994
- specifier,
9995
- isExternal: isExternalImport(specifier),
9996
- imports
9997
- });
9998
- }
9999
- return deps;
10000
- }
10001
-
10002
- // src/indexer/description-extraction.ts
10003
- function isPlainBlockComment(trimmed) {
10004
- return trimmed.startsWith("/*") && trimmed.endsWith("*/");
10005
- }
10006
- function classifyOutsideComment(trimmed) {
10007
- if (isPlainBlockComment(trimmed)) return "skip";
10008
- if (trimmed.length > 0 && !trimmed.startsWith("//")) return "stop";
10009
- return "skip";
10010
- }
10011
- function classifyInsideComment(trimmed) {
10012
- if (trimmed.endsWith("*/")) return "end";
10013
- if (trimmed.startsWith("* @") || trimmed.startsWith("@")) return "skip";
10014
- return "content";
10015
- }
10016
- function classifyJsDocLine(trimmed, inComment) {
10017
- if (trimmed.startsWith("/**")) {
10018
- return trimmed.endsWith("*/") ? "startEnd" : "start";
10019
- }
10020
- return inComment ? classifyInsideComment(trimmed) : classifyOutsideComment(trimmed);
10021
- }
10022
- function extractJsDocLineContent(trimmed) {
10023
- return trimmed.startsWith("*") ? trimmed.slice(1).trim() : trimmed;
10024
- }
10025
- function extractInlineJsDocContent(trimmed) {
10026
- return trimmed.slice(3, -2).trim();
10027
- }
10028
- function truncateDescription(full) {
10029
- return truncateSentence(full, 150);
10030
- }
10031
- function extractDescription(sourceFile) {
10032
- const lines = sourceFile.getFullText().split("\n");
10033
- let inComment = false;
10034
- const description = [];
10035
- for (const line of lines) {
10036
- const trimmed = line.trim();
10037
- const result = classifyJsDocLine(trimmed, inComment);
10038
- if (result === "start") {
10039
- inComment = true;
10040
- continue;
10041
- }
10042
- if (result === "startEnd") {
10043
- const inline = extractInlineJsDocContent(trimmed);
10044
- if (inline.length > 0) description.push(inline);
10045
- break;
10046
- }
10047
- if (result === "end" || result === "stop") break;
10048
- if (result === "skip") continue;
10049
- const content = extractJsDocLineContent(trimmed);
10050
- if (content.length > 0) description.push(content);
10051
- }
10052
- if (description.length === 0) return void 0;
10053
- return truncateDescription(description.join(" "));
10054
- }
10055
-
10056
- // src/indexer/project-extraction.ts
10057
- import { Project } from "ts-morph";
10058
- import * as path9 from "path";
10059
- function extractFileEntry(sourceFile, rootDir, extractDescriptions) {
10060
- const absolutePath = sourceFile.getFilePath();
10061
- const relativePath = path9.relative(rootDir, absolutePath);
10062
- const lineCount = sourceFile.getEndLineNumber();
10063
- const entry = {
10064
- path: relativePath,
10065
- lines: lineCount,
10066
- category: detectFileCategory(relativePath, sourceFile),
10067
- exports: extractExports(sourceFile),
10068
- dependencies: extractDependencies(sourceFile)
10069
- };
10070
- if (extractDescriptions) {
10071
- const desc = extractDescription(sourceFile);
10072
- if (desc !== void 0) {
10073
- entry.description = desc;
10074
- }
10075
- }
10076
- return entry;
10077
- }
10078
- function processSourceFiles(project, rootDir, extractDescriptions) {
10079
- const files = [];
10080
- const errors = [];
10081
- for (const sourceFile of project.getSourceFiles()) {
10082
- const filePath = sourceFile.getFilePath();
10083
- try {
10084
- files.push(extractFileEntry(sourceFile, rootDir, extractDescriptions));
10085
- } catch (err2) {
10086
- const message = err2 instanceof Error ? err2.message : String(err2);
10087
- errors.push(`Error extracting ${filePath}: ${message}`);
10088
- }
10089
- }
10090
- return { files, errors };
10091
- }
10092
- function extractProject(options = {}) {
10093
- const opts = { ...DEFAULT_EXTRACTOR_OPTIONS, ...options };
10094
- const startTime = getTimeProvider().now();
10095
- const project = new Project({
10096
- skipAddingFilesFromTsConfig: true,
10097
- skipFileDependencyResolution: true
10098
- });
10099
- const rootDir = path9.resolve(process.cwd(), opts.rootDir);
10100
- const includePatterns = opts.include.map((p) => path9.join(rootDir, p));
10101
- const excludePatterns = opts.exclude.map((p) => `!${path9.join(rootDir, p)}`);
10102
- try {
10103
- project.addSourceFilesAtPaths([...includePatterns, ...excludePatterns]);
10104
- const { files, errors } = processSourceFiles(project, rootDir, opts.extractDescriptions);
10105
- return { files, errors, durationMs: getTimeProvider().now() - startTime };
10106
- } catch (err2) {
10107
- const message = err2 instanceof Error ? err2.message : String(err2);
10108
- return {
10109
- files: [],
10110
- errors: [`Error loading project: ${message}`],
10111
- durationMs: getTimeProvider().now() - startTime
10112
- };
10113
- }
10114
- }
10115
-
10116
- // src/indexer/analyzer.ts
10117
- import * as path10 from "path";
10118
- var MODULE_PURPOSES = {
10119
- core: "Types, Result<T,E>, errors, logger",
10120
- config: "Configuration loading, validation, Zod schemas",
10121
- adapters: "Model adapters (Claude, OpenAI, Gemini, Ollama)",
10122
- agents: "Agent framework, Orchestrator, Experts, collaboration",
10123
- workflows: "Workflow engine, templates, execution",
10124
- mcp: "MCP server, tool definitions",
10125
- cli: "CLI interface, mode detection, commands",
10126
- "cli-adapters": "External CLI integrations (Claude, Gemini, Codex)",
10127
- context: "Context management, token counting, memory",
10128
- consensus: "Multi-agent consensus, voting strategies",
10129
- learning: "Feedback collection, outcome tracking",
10130
- indexer: "Codebase indexing and documentation",
10131
- security: "Sandbox execution, secrets management"
10132
- };
10133
- function detectModulePurpose(moduleName, files) {
10134
- const known = MODULE_PURPOSES[moduleName];
10135
- if (known !== void 0) {
10136
- return known;
10137
- }
10138
- const descriptions = files.filter((f) => f.description !== void 0).map((f) => f.description).slice(0, 3);
10139
- if (descriptions.length > 0) {
10140
- return descriptions.join("; ");
10141
- }
10142
- return `${moduleName} module`;
10143
- }
10144
- function extractPackageName(specifier) {
10145
- if (specifier.startsWith("@")) {
10146
- const parts2 = specifier.split("/");
10147
- const scope = parts2[0];
10148
- const name = parts2[1];
10149
- if (scope !== void 0 && name !== void 0) {
10150
- return `${scope}/${name}`;
10151
- }
10152
- return void 0;
10153
- }
10154
- if (specifier.startsWith("node:")) {
10155
- return specifier;
10156
- }
10157
- const parts = specifier.split("/");
10158
- return parts[0];
10159
- }
10160
- function groupFilesByModule(files) {
10161
- const modules = /* @__PURE__ */ new Map();
10162
- for (const file of files) {
10163
- const parts = file.path.split("/");
10164
- const moduleName = parts.length > 1 ? parts[0] ?? "root" : "root";
10165
- const existing = modules.get(moduleName);
10166
- if (existing !== void 0) {
10167
- existing.push(file);
10168
- } else {
10169
- modules.set(moduleName, [file]);
10170
- }
10171
- }
10172
- return modules;
10173
- }
10174
- function collectExternalPackages(file, packages) {
10175
- for (const dep of file.dependencies) {
10176
- if (dep.isExternal) {
10177
- const pkgName = extractPackageName(dep.specifier);
10178
- if (pkgName !== void 0) {
10179
- packages.add(pkgName);
10180
- }
10181
- }
10182
- }
10183
- }
10184
- function computeModuleStats(files) {
10185
- let totalLines = 0;
10186
- let exportCount = 0;
10187
- let internalDeps = 0;
10188
- let externalDeps = 0;
10189
- for (const file of files) {
10190
- totalLines += file.lines;
10191
- exportCount += file.exports.length;
10192
- for (const dep of file.dependencies) {
10193
- if (dep.isExternal) {
10194
- externalDeps++;
10195
- } else {
10196
- internalDeps++;
10197
- }
10198
- }
10199
- }
10200
- return {
10201
- fileCount: files.length,
10202
- totalLines,
10203
- exportCount,
10204
- internalDeps,
10205
- externalDeps
10206
- };
10207
- }
10208
- function resolveTargetModule(filePath, specifier) {
10209
- if (!specifier.startsWith(".")) return void 0;
10210
- const resolved = path10.join(path10.dirname(filePath), specifier);
10211
- const parts = resolved.split("/");
10212
- return parts[0];
10213
- }
10214
- function isValidModuleDep(targetModule, moduleName, allModules) {
10215
- return targetModule !== void 0 && targetModule !== moduleName && allModules.has(targetModule);
10216
- }
10217
- function detectModuleDependencies(moduleName, files, allModules) {
10218
- const deps = /* @__PURE__ */ new Set();
10219
- for (const file of files) {
10220
- for (const dep of file.dependencies) {
10221
- if (dep.isExternal) continue;
10222
- const targetModule = resolveTargetModule(file.path, dep.specifier);
10223
- if (isValidModuleDep(targetModule, moduleName, allModules)) {
10224
- deps.add(targetModule);
10225
- }
10226
- }
10227
- }
10228
- return Array.from(deps).sort();
10229
- }
10230
- function analyzeModules(files) {
10231
- const filesByModule = groupFilesByModule(files);
10232
- const moduleNames = new Set(filesByModule.keys());
10233
- const modules = /* @__PURE__ */ new Map();
10234
- for (const [moduleName, moduleFiles] of filesByModule) {
10235
- modules.set(moduleName, {
10236
- name: moduleName,
10237
- path: moduleName === "root" ? "." : moduleName,
10238
- purpose: detectModulePurpose(moduleName, moduleFiles),
10239
- files: moduleFiles,
10240
- stats: computeModuleStats(moduleFiles),
10241
- dependsOn: detectModuleDependencies(moduleName, moduleFiles, moduleNames)
10242
- });
10243
- }
10244
- return modules;
10245
- }
10246
- function computeIndexStats(modules) {
10247
- let totalFiles = 0;
10248
- let totalLines = 0;
10249
- let totalExports = 0;
10250
- const externalPackages = /* @__PURE__ */ new Set();
10251
- for (const module of modules.values()) {
10252
- totalFiles += module.stats.fileCount;
10253
- totalLines += module.stats.totalLines;
10254
- totalExports += module.stats.exportCount;
10255
- for (const file of module.files) {
10256
- collectExternalPackages(file, externalPackages);
10257
- }
10258
- }
10259
- return {
10260
- totalFiles,
10261
- totalLines,
10262
- totalExports,
10263
- moduleCount: modules.size,
10264
- externalPackages: Array.from(externalPackages).sort()
10265
- };
10266
- }
10267
- function buildIndex(files) {
10268
- const modules = analyzeModules(files);
10269
- const stats = computeIndexStats(modules);
10270
- const now = new Date(getTimeProvider().now());
10271
- const etFormatter = new Intl.DateTimeFormat("en-US", {
10272
- timeZone: "America/New_York",
10273
- year: "numeric",
10274
- month: "2-digit",
10275
- day: "2-digit",
10276
- hour: "2-digit",
10277
- minute: "2-digit",
10278
- second: "2-digit",
10279
- hour12: false
10280
- });
10281
- const parts = etFormatter.formatToParts(now);
10282
- const getPart = (type) => parts.find((p) => p.type === type)?.value ?? "00";
10283
- const utcFormatter = new Intl.DateTimeFormat("en-US", {
10284
- timeZone: "UTC",
10285
- hour: "numeric",
10286
- hour12: false
10287
- });
10288
- const utcHour = Number(
10289
- utcFormatter.formatToParts(now).find((p) => p.type === "hour")?.value ?? "0"
10290
- );
10291
- const etHour = Number(getPart("hour"));
10292
- const rawDiff = etHour - utcHour;
10293
- const offsetHours = rawDiff > 12 ? rawDiff - 24 : rawDiff < -12 ? rawDiff + 24 : rawDiff;
10294
- const offsetSign = offsetHours <= 0 ? "-" : "+";
10295
- const absOffset = String(Math.abs(offsetHours)).padStart(2, "0");
10296
- const timestamp = `${getPart("year")}-${getPart("month")}-${getPart("day")}T${getPart("hour")}:${getPart("minute")}:${getPart("second")}${offsetSign}${absOffset}:00`;
10297
- const modulesRecord = {};
10298
- for (const [name, entry] of modules) {
10299
- modulesRecord[name] = entry;
10300
- }
10301
- return {
10302
- schemaVersion: SCHEMA_VERSION,
10303
- generatedAt: timestamp,
10304
- stats,
10305
- modules: modulesRecord
10306
- };
10307
- }
10308
-
10309
9808
  // src/indexer/generator.ts
10310
9809
  import * as fs10 from "fs/promises";
10311
- import * as path11 from "path";
9810
+ import * as path8 from "path";
10312
9811
  import * as yaml4 from "yaml";
10313
9812
  function indexToYaml(index) {
10314
9813
  const doc = new yaml4.Document(index);
@@ -10438,43 +9937,43 @@ function validateIndex(index, currentFiles) {
10438
9937
  }
10439
9938
 
10440
9939
  // src/indexer/entrypoint-types.ts
10441
- import { z as z5 } from "zod";
9940
+ import { z as z4 } from "zod";
10442
9941
  var ENTRYPOINT_SCHEMA_VERSION = "1.0";
10443
- var OptionSpecSchema = z5.object({
10444
- name: z5.string(),
10445
- type: z5.string(),
10446
- description: z5.string().optional(),
10447
- required: z5.boolean().optional(),
10448
- default: z5.string().optional(),
10449
- short: z5.string().optional()
9942
+ var OptionSpecSchema = z4.object({
9943
+ name: z4.string(),
9944
+ type: z4.string(),
9945
+ description: z4.string().optional(),
9946
+ required: z4.boolean().optional(),
9947
+ default: z4.string().optional(),
9948
+ short: z4.string().optional()
10450
9949
  });
10451
- var ParameterSpecSchema = z5.object({
10452
- name: z5.string(),
10453
- type: z5.string(),
10454
- description: z5.string().optional(),
10455
- required: z5.boolean().optional(),
10456
- default: z5.string().optional()
9950
+ var ParameterSpecSchema = z4.object({
9951
+ name: z4.string(),
9952
+ type: z4.string(),
9953
+ description: z4.string().optional(),
9954
+ required: z4.boolean().optional(),
9955
+ default: z4.string().optional()
10457
9956
  });
10458
- var CliCommandSpecSchema = z5.object({
10459
- name: z5.string(),
10460
- description: z5.string(),
10461
- subcommands: z5.array(z5.string()).readonly().optional(),
10462
- options: z5.array(OptionSpecSchema).readonly().optional(),
10463
- source_file: z5.string(),
10464
- source_line: z5.number().int().positive()
9957
+ var CliCommandSpecSchema = z4.object({
9958
+ name: z4.string(),
9959
+ description: z4.string(),
9960
+ subcommands: z4.array(z4.string()).readonly().optional(),
9961
+ options: z4.array(OptionSpecSchema).readonly().optional(),
9962
+ source_file: z4.string(),
9963
+ source_line: z4.number().int().positive()
10465
9964
  });
10466
- var McpToolSpecSchema = z5.object({
10467
- name: z5.string(),
10468
- description: z5.string(),
10469
- parameters: z5.array(ParameterSpecSchema).readonly(),
10470
- source_file: z5.string(),
10471
- source_line: z5.number().int().positive()
9965
+ var McpToolSpecSchema = z4.object({
9966
+ name: z4.string(),
9967
+ description: z4.string(),
9968
+ parameters: z4.array(ParameterSpecSchema).readonly(),
9969
+ source_file: z4.string(),
9970
+ source_line: z4.number().int().positive()
10472
9971
  });
10473
- var EntrypointManifestSchema = z5.object({
10474
- schema_version: z5.literal(ENTRYPOINT_SCHEMA_VERSION),
10475
- generated_at: z5.string(),
10476
- cli_commands: z5.array(CliCommandSpecSchema).readonly(),
10477
- mcp_tools: z5.array(McpToolSpecSchema).readonly()
9972
+ var EntrypointManifestSchema = z4.object({
9973
+ schema_version: z4.literal(ENTRYPOINT_SCHEMA_VERSION),
9974
+ generated_at: z4.string(),
9975
+ cli_commands: z4.array(CliCommandSpecSchema).readonly(),
9976
+ mcp_tools: z4.array(McpToolSpecSchema).readonly()
10478
9977
  });
10479
9978
  var DEFAULT_ENTRYPOINT_EXTRACTOR_OPTIONS = {
10480
9979
  packageRoot: "packages/nexus-agents",
@@ -10484,8 +9983,8 @@ var DEFAULT_ENTRYPOINT_EXTRACTOR_OPTIONS = {
10484
9983
  };
10485
9984
 
10486
9985
  // src/indexer/entrypoint-extractor.ts
10487
- import { Project as Project2 } from "ts-morph";
10488
- import * as path14 from "path";
9986
+ import { Project } from "ts-morph";
9987
+ import * as path11 from "path";
10489
9988
  import * as yaml5 from "yaml";
10490
9989
 
10491
9990
  // src/indexer/entrypoint-sanitizer.ts
@@ -10582,7 +10081,7 @@ function sanitizeTool(tool) {
10582
10081
 
10583
10082
  // src/indexer/entrypoint-cli-extractor.ts
10584
10083
  import { SyntaxKind } from "ts-morph";
10585
- import * as path12 from "path";
10084
+ import * as path9 from "path";
10586
10085
  function extractCliOptions(sourceFile) {
10587
10086
  const options = /* @__PURE__ */ new Map();
10588
10087
  const configVar = sourceFile.getVariableDeclaration("PARSE_ARGS_CONFIG");
@@ -10698,7 +10197,7 @@ function buildCommandSpec(entry, ctx) {
10698
10197
  return cmdSpec;
10699
10198
  }
10700
10199
  function extractCliCommands(project, packageRoot, cliCommandsPath, cliTypesPath, warnings) {
10701
- const typesFullPath = path12.join(packageRoot, cliTypesPath);
10200
+ const typesFullPath = path9.join(packageRoot, cliTypesPath);
10702
10201
  const typesFile = project.getSourceFile(typesFullPath);
10703
10202
  if (typesFile === void 0 && warnings !== void 0) {
10704
10203
  warnings.push(
@@ -10706,7 +10205,7 @@ function extractCliCommands(project, packageRoot, cliCommandsPath, cliTypesPath,
10706
10205
  );
10707
10206
  }
10708
10207
  const cliOptions = typesFile !== void 0 ? extractCliOptions(typesFile) : /* @__PURE__ */ new Map();
10709
- const commandsFullPath = path12.join(packageRoot, cliCommandsPath);
10208
+ const commandsFullPath = path9.join(packageRoot, cliCommandsPath);
10710
10209
  const commandsFile = project.getSourceFile(commandsFullPath);
10711
10210
  if (commandsFile === void 0) {
10712
10211
  if (warnings !== void 0) {
@@ -10718,7 +10217,7 @@ function extractCliCommands(project, packageRoot, cliCommandsPath, cliTypesPath,
10718
10217
  }
10719
10218
  const ctx = {
10720
10219
  commandsFile,
10721
- relativePath: path12.relative(process.cwd(), commandsFullPath),
10220
+ relativePath: path9.relative(process.cwd(), commandsFullPath),
10722
10221
  cliOptions,
10723
10222
  cliCommandsPath,
10724
10223
  ...warnings !== void 0 && { warnings }
@@ -10728,7 +10227,7 @@ function extractCliCommands(project, packageRoot, cliCommandsPath, cliTypesPath,
10728
10227
 
10729
10228
  // src/indexer/entrypoint-mcp-extractor.ts
10730
10229
  import { SyntaxKind as SyntaxKind2 } from "ts-morph";
10731
- import * as path13 from "path";
10230
+ import * as path10 from "path";
10732
10231
  function inferZodType(zodExpr) {
10733
10232
  if (zodExpr.includes("z.string()")) return "string";
10734
10233
  if (zodExpr.includes("z.number()")) return "number";
@@ -10771,7 +10270,7 @@ function extractZodParameters(schemaObj) {
10771
10270
  }
10772
10271
  function extractMcpTools(project, packageRoot, mcpToolsPath, warnings) {
10773
10272
  const tools = [];
10774
- const toolsDir = path13.join(packageRoot, mcpToolsPath);
10273
+ const toolsDir = path10.join(packageRoot, mcpToolsPath);
10775
10274
  const toolFiles = project.getSourceFiles(`${toolsDir}/*.ts`);
10776
10275
  if (toolFiles.length === 0 && warnings !== void 0) {
10777
10276
  warnings.push(
@@ -10780,9 +10279,9 @@ function extractMcpTools(project, packageRoot, mcpToolsPath, warnings) {
10780
10279
  }
10781
10280
  for (const sourceFile of toolFiles) {
10782
10281
  const filePath = sourceFile.getFilePath();
10783
- const fileName = path13.basename(filePath);
10282
+ const fileName = path10.basename(filePath);
10784
10283
  if (fileName.endsWith(".test.ts") || fileName === "index.ts") continue;
10785
- const relativePath = path13.relative(process.cwd(), filePath);
10284
+ const relativePath = path10.relative(process.cwd(), filePath);
10786
10285
  const extractedTools = extractToolsFromFile(sourceFile, relativePath, warnings);
10787
10286
  tools.push(...extractedTools);
10788
10287
  }
@@ -10910,19 +10409,19 @@ function generateTimestamp() {
10910
10409
  });
10911
10410
  }
10912
10411
  function createProject(opts) {
10913
- const project = new Project2({
10914
- tsConfigFilePath: path14.join(opts.packageRoot, "tsconfig.json"),
10412
+ const project = new Project({
10413
+ tsConfigFilePath: path11.join(opts.packageRoot, "tsconfig.json"),
10915
10414
  skipAddingFilesFromTsConfig: true
10916
10415
  });
10917
10416
  project.addSourceFilesAtPaths([
10918
- path14.join(opts.packageRoot, opts.cliCommandsPath),
10919
- path14.join(opts.packageRoot, "src/cli-types.ts"),
10417
+ path11.join(opts.packageRoot, opts.cliCommandsPath),
10418
+ path11.join(opts.packageRoot, "src/cli-types.ts"),
10920
10419
  // HELP_TEXT was extracted to cli-help-text.ts in #293 (Jan 2026) and
10921
10420
  // cli-types.ts now only re-exports it. The extractor reads it via AST,
10922
10421
  // so we have to load the defining file — a bare re-export isn't enough.
10923
10422
  // Without this line the CLI command list silently came back empty.
10924
- path14.join(opts.packageRoot, "src/cli-help-text.ts"),
10925
- path14.join(opts.packageRoot, opts.mcpToolsPath, "*.ts")
10423
+ path11.join(opts.packageRoot, "src/cli-help-text.ts"),
10424
+ path11.join(opts.packageRoot, opts.mcpToolsPath, "*.ts")
10926
10425
  ]);
10927
10426
  return project;
10928
10427
  }
@@ -10969,17 +10468,17 @@ function manifestToJson(manifest) {
10969
10468
 
10970
10469
  // src/cli/index-command-link-validator.ts
10971
10470
  import * as fs12 from "fs/promises";
10972
- import * as path16 from "path";
10471
+ import * as path13 from "path";
10973
10472
 
10974
10473
  // src/cli/index-command-link-validation-helpers.ts
10975
10474
  import * as fs11 from "fs/promises";
10976
- import * as path15 from "path";
10475
+ import * as path12 from "path";
10977
10476
  async function validateInternalLink(url, sourceFile) {
10978
10477
  const [filePath, anchor] = url.split("#");
10979
10478
  if (filePath === void 0 || filePath === "") {
10980
10479
  return { valid: true };
10981
10480
  }
10982
- const resolvedPath = path15.resolve(path15.dirname(sourceFile), filePath);
10481
+ const resolvedPath = path12.resolve(path12.dirname(sourceFile), filePath);
10983
10482
  try {
10984
10483
  await fs11.access(resolvedPath);
10985
10484
  if (anchor !== void 0 && anchor !== "") {
@@ -11064,9 +10563,9 @@ async function validateAnchorInFile(anchor, targetFile) {
11064
10563
  return { valid: true };
11065
10564
  }
11066
10565
  }
11067
- return { valid: false, error: `Anchor '#${anchor}' not found in ${path15.basename(targetFile)}` };
10566
+ return { valid: false, error: `Anchor '#${anchor}' not found in ${path12.basename(targetFile)}` };
11068
10567
  } catch {
11069
- return { valid: false, error: `Failed to read ${path15.basename(targetFile)} for anchor check` };
10568
+ return { valid: false, error: `Failed to read ${path12.basename(targetFile)} for anchor check` };
11070
10569
  }
11071
10570
  }
11072
10571
  async function validateAnchorLink(anchor, sourceFile) {
@@ -11158,7 +10657,7 @@ async function findMarkdownFiles(dir) {
11158
10657
  try {
11159
10658
  const entries = await fs12.readdir(dir, { withFileTypes: true });
11160
10659
  for (const entry of entries) {
11161
- const fullPath = path16.join(dir, entry.name);
10660
+ const fullPath = path13.join(dir, entry.name);
11162
10661
  if (entry.name === "node_modules" || entry.name === "dist") {
11163
10662
  continue;
11164
10663
  }
@@ -11353,7 +10852,7 @@ async function generateIndex(options) {
11353
10852
  `Extracted ${String(extraction.files.length)} files in ${String(extraction.durationMs)}ms`
11354
10853
  );
11355
10854
  const index = buildIndex(extraction.files);
11356
- const outputDir = path17.dirname(outputPath);
10855
+ const outputDir = path14.dirname(outputPath);
11357
10856
  await fs13.mkdir(outputDir, { recursive: true });
11358
10857
  const content = format === "yaml" ? indexToYaml(index) : indexToJson(index);
11359
10858
  await fs13.writeFile(outputPath, content, "utf-8");
@@ -11424,7 +10923,7 @@ async function generateDiagram(options) {
11424
10923
  CodebaseIndexSchema.parse(parsed);
11425
10924
  const index = parsed;
11426
10925
  const diagram = generateDiagramMarkdown(index);
11427
- await fs13.mkdir(path17.dirname(diagramPath), { recursive: true });
10926
+ await fs13.mkdir(path14.dirname(diagramPath), { recursive: true });
11428
10927
  await fs13.writeFile(diagramPath, diagram, "utf-8");
11429
10928
  logger10.info(`Wrote diagram to ${diagramPath}`);
11430
10929
  return {
@@ -11530,7 +11029,7 @@ async function entrypointsCommand(options) {
11530
11029
  for (const warning of result.warnings) {
11531
11030
  logger10.warn(warning);
11532
11031
  }
11533
- const outputDir = path17.dirname(outputPath);
11032
+ const outputDir = path14.dirname(outputPath);
11534
11033
  await fs13.mkdir(outputDir, { recursive: true });
11535
11034
  const content = format === "yaml" ? manifestToYaml(manifest) : manifestToJson(manifest);
11536
11035
  await fs13.writeFile(outputPath, content, "utf-8");
@@ -11552,7 +11051,7 @@ async function freshnessCommand(options) {
11552
11051
  const hasIssues = summary.stale > 0 || summary.warning > 0 || summary.unknown > 0;
11553
11052
  const output2 = options.format === "json" ? formatFreshnessJson(result) : formatFreshnessTable(result);
11554
11053
  if (options.output !== void 0) {
11555
- const outputDir = path17.dirname(options.output);
11054
+ const outputDir = path14.dirname(options.output);
11556
11055
  await fs13.mkdir(outputDir, { recursive: true });
11557
11056
  await fs13.writeFile(options.output, output2, "utf-8");
11558
11057
  logger10.info(`Wrote freshness report to ${options.output}`);
@@ -11586,7 +11085,7 @@ async function linksCommand(options) {
11586
11085
  const hasBrokenLinks = summary.brokenLinks > 0;
11587
11086
  const output2 = options.format === "json" ? formatLinkValidationJson(result) : formatLinkValidationTable(result);
11588
11087
  if (options.output !== void 0) {
11589
- const outputDir = path17.dirname(options.output);
11088
+ const outputDir = path14.dirname(options.output);
11590
11089
  await fs13.mkdir(outputDir, { recursive: true });
11591
11090
  await fs13.writeFile(options.output, output2, "utf-8");
11592
11091
  logger10.info(`Wrote link validation report to ${options.output}`);
@@ -12082,32 +11581,32 @@ function learningMetricsCommand(options, context) {
12082
11581
  }
12083
11582
 
12084
11583
  // src/cli/config-command-types.ts
12085
- import { z as z6 } from "zod";
11584
+ import { z as z5 } from "zod";
12086
11585
  var CONFIG_ACTIONS = ["get", "set", "list", "reset", "export", "import"];
12087
11586
  var CONFIG_FORMATS = ["json", "yaml"];
12088
- var ConfigCommandOptionsSchema = z6.object({
11587
+ var ConfigCommandOptionsSchema = z5.object({
12089
11588
  /** Command action */
12090
- action: z6.enum(CONFIG_ACTIONS),
11589
+ action: z5.enum(CONFIG_ACTIONS),
12091
11590
  /** Configuration key (dot notation supported) */
12092
- key: z6.string().optional(),
11591
+ key: z5.string().optional(),
12093
11592
  /** Value to set */
12094
- value: z6.string().optional(),
11593
+ value: z5.string().optional(),
12095
11594
  /** File path for import/export */
12096
- file: z6.string().optional(),
11595
+ file: z5.string().optional(),
12097
11596
  /** Export format */
12098
- format: z6.enum(CONFIG_FORMATS).default("json"),
11597
+ format: z5.enum(CONFIG_FORMATS).default("json"),
12099
11598
  /** Force overwrite without backup */
12100
- force: z6.boolean().default(false),
11599
+ force: z5.boolean().default(false),
12101
11600
  /** Show verbose output */
12102
- verbose: z6.boolean().default(false)
11601
+ verbose: z5.boolean().default(false)
12103
11602
  });
12104
- var ParsedConfigKeySchema = z6.object({
11603
+ var ParsedConfigKeySchema = z5.object({
12105
11604
  /** Full key string */
12106
- fullKey: z6.string(),
11605
+ fullKey: z5.string(),
12107
11606
  /** Category portion */
12108
- category: z6.string(),
11607
+ category: z5.string(),
12109
11608
  /** Key within category */
12110
- key: z6.string()
11609
+ key: z5.string()
12111
11610
  });
12112
11611
  var ConfigCommandError = class extends Error {
12113
11612
  code;
@@ -12123,7 +11622,7 @@ function isValidConfigAction(value) {
12123
11622
 
12124
11623
  // src/cli/config-command-helpers.ts
12125
11624
  import * as fs14 from "fs/promises";
12126
- import * as path18 from "path";
11625
+ import * as path15 from "path";
12127
11626
  import { existsSync as existsSync10 } from "fs";
12128
11627
 
12129
11628
  // src/cli/config-command-formatting.ts
@@ -12391,10 +11890,10 @@ function parseValueFromString(stringValue, defaultValue) {
12391
11890
  }
12392
11891
  function resolveFilePath(filePath, allowedBase) {
12393
11892
  const base = allowedBase ?? process.cwd();
12394
- const resolved = path18.isAbsolute(filePath) ? filePath : path18.resolve(base, filePath);
12395
- const normalizedResolved = path18.normalize(resolved);
12396
- const normalizedBase = path18.normalize(base);
12397
- const isWithinBase = normalizedResolved === normalizedBase || normalizedResolved.startsWith(normalizedBase + path18.sep);
11893
+ const resolved = path15.isAbsolute(filePath) ? filePath : path15.resolve(base, filePath);
11894
+ const normalizedResolved = path15.normalize(resolved);
11895
+ const normalizedBase = path15.normalize(base);
11896
+ const isWithinBase = normalizedResolved === normalizedBase || normalizedResolved.startsWith(normalizedBase + path15.sep);
12398
11897
  if (!isWithinBase) {
12399
11898
  throw new ConfigCommandError(
12400
11899
  "PATH_TRAVERSAL",
@@ -12405,7 +11904,7 @@ function resolveFilePath(filePath, allowedBase) {
12405
11904
  }
12406
11905
  function getDefaultExportPath(format) {
12407
11906
  const extension = format === "json" ? "json" : "yaml";
12408
- return path18.resolve(process.cwd(), `nexus-config.${extension}`);
11907
+ return path15.resolve(process.cwd(), `nexus-config.${extension}`);
12409
11908
  }
12410
11909
 
12411
11910
  // src/cli/config-command-handlers.ts
@@ -12775,8 +12274,8 @@ async function configCommand(options) {
12775
12274
  }
12776
12275
 
12777
12276
  // src/cli/hooks/hook-types.ts
12778
- import { z as z7 } from "zod";
12779
- var HookEventName = z7.enum([
12277
+ import { z as z6 } from "zod";
12278
+ var HookEventName = z6.enum([
12780
12279
  "SessionStart",
12781
12280
  "UserPromptSubmit",
12782
12281
  "PreToolUse",
@@ -12791,100 +12290,100 @@ var HookEventName = z7.enum([
12791
12290
  "Notification",
12792
12291
  "Setup"
12793
12292
  ]);
12794
- var PermissionMode = z7.enum([
12293
+ var PermissionMode = z6.enum([
12795
12294
  "default",
12796
12295
  "plan",
12797
12296
  "acceptEdits",
12798
12297
  "dontAsk",
12799
12298
  "bypassPermissions"
12800
12299
  ]);
12801
- var HookInputBaseSchema = z7.object({
12802
- session_id: z7.string(),
12803
- transcript_path: z7.string(),
12804
- cwd: z7.string(),
12300
+ var HookInputBaseSchema = z6.object({
12301
+ session_id: z6.string(),
12302
+ transcript_path: z6.string(),
12303
+ cwd: z6.string(),
12805
12304
  permission_mode: PermissionMode,
12806
12305
  hook_event_name: HookEventName
12807
12306
  });
12808
- var SessionStartSource = z7.enum(["startup", "resume", "clear", "compact"]);
12307
+ var SessionStartSource = z6.enum(["startup", "resume", "clear", "compact"]);
12809
12308
  var SessionStartInputSchema = HookInputBaseSchema.extend({
12810
- hook_event_name: z7.literal("SessionStart"),
12309
+ hook_event_name: z6.literal("SessionStart"),
12811
12310
  source: SessionStartSource,
12812
- model: z7.string().optional(),
12813
- agent_type: z7.string().optional()
12311
+ model: z6.string().optional(),
12312
+ agent_type: z6.string().optional()
12814
12313
  });
12815
- var SessionEndReason = z7.enum(["clear", "logout", "prompt_input_exit", "other"]);
12314
+ var SessionEndReason = z6.enum(["clear", "logout", "prompt_input_exit", "other"]);
12816
12315
  var SessionEndInputSchema = HookInputBaseSchema.extend({
12817
- hook_event_name: z7.literal("SessionEnd"),
12316
+ hook_event_name: z6.literal("SessionEnd"),
12818
12317
  reason: SessionEndReason
12819
12318
  });
12820
12319
  var PreToolUseInputSchema = HookInputBaseSchema.extend({
12821
- hook_event_name: z7.literal("PreToolUse"),
12822
- tool_name: z7.string(),
12823
- tool_input: z7.record(z7.string(), z7.unknown()),
12824
- tool_use_id: z7.string()
12320
+ hook_event_name: z6.literal("PreToolUse"),
12321
+ tool_name: z6.string(),
12322
+ tool_input: z6.record(z6.string(), z6.unknown()),
12323
+ tool_use_id: z6.string()
12825
12324
  });
12826
12325
  var PostToolUseInputSchema = HookInputBaseSchema.extend({
12827
- hook_event_name: z7.literal("PostToolUse"),
12828
- tool_name: z7.string(),
12829
- tool_input: z7.record(z7.string(), z7.unknown()),
12830
- tool_response: z7.record(z7.string(), z7.unknown()),
12831
- tool_use_id: z7.string()
12326
+ hook_event_name: z6.literal("PostToolUse"),
12327
+ tool_name: z6.string(),
12328
+ tool_input: z6.record(z6.string(), z6.unknown()),
12329
+ tool_response: z6.record(z6.string(), z6.unknown()),
12330
+ tool_use_id: z6.string()
12832
12331
  });
12833
12332
  var PostToolUseFailureInputSchema = HookInputBaseSchema.extend({
12834
- hook_event_name: z7.literal("PostToolUseFailure"),
12835
- tool_name: z7.string(),
12836
- tool_input: z7.record(z7.string(), z7.unknown()),
12837
- tool_use_id: z7.string(),
12838
- error: z7.string().optional()
12333
+ hook_event_name: z6.literal("PostToolUseFailure"),
12334
+ tool_name: z6.string(),
12335
+ tool_input: z6.record(z6.string(), z6.unknown()),
12336
+ tool_use_id: z6.string(),
12337
+ error: z6.string().optional()
12839
12338
  });
12840
12339
  var StopInputSchema = HookInputBaseSchema.extend({
12841
- hook_event_name: z7.literal("Stop"),
12842
- stop_hook_active: z7.boolean()
12340
+ hook_event_name: z6.literal("Stop"),
12341
+ stop_hook_active: z6.boolean()
12843
12342
  });
12844
12343
  var SubagentStopInputSchema = HookInputBaseSchema.extend({
12845
- hook_event_name: z7.literal("SubagentStop"),
12846
- stop_hook_active: z7.boolean(),
12847
- agent_id: z7.string(),
12848
- agent_transcript_path: z7.string()
12344
+ hook_event_name: z6.literal("SubagentStop"),
12345
+ stop_hook_active: z6.boolean(),
12346
+ agent_id: z6.string(),
12347
+ agent_transcript_path: z6.string()
12849
12348
  });
12850
12349
  var UserPromptSubmitInputSchema = HookInputBaseSchema.extend({
12851
- hook_event_name: z7.literal("UserPromptSubmit"),
12852
- prompt: z7.string()
12350
+ hook_event_name: z6.literal("UserPromptSubmit"),
12351
+ prompt: z6.string()
12853
12352
  });
12854
- var NotificationType = z7.enum([
12353
+ var NotificationType = z6.enum([
12855
12354
  "permission_prompt",
12856
12355
  "idle_prompt",
12857
12356
  "auth_success",
12858
12357
  "elicitation_dialog"
12859
12358
  ]);
12860
12359
  var NotificationInputSchema = HookInputBaseSchema.extend({
12861
- hook_event_name: z7.literal("Notification"),
12862
- message: z7.string(),
12360
+ hook_event_name: z6.literal("Notification"),
12361
+ message: z6.string(),
12863
12362
  notification_type: NotificationType
12864
12363
  });
12865
- var PreCompactTrigger = z7.enum(["manual", "auto"]);
12364
+ var PreCompactTrigger = z6.enum(["manual", "auto"]);
12866
12365
  var PreCompactInputSchema = HookInputBaseSchema.extend({
12867
- hook_event_name: z7.literal("PreCompact"),
12366
+ hook_event_name: z6.literal("PreCompact"),
12868
12367
  trigger: PreCompactTrigger,
12869
- custom_instructions: z7.string().optional()
12368
+ custom_instructions: z6.string().optional()
12870
12369
  });
12871
- var SetupTrigger = z7.enum(["init", "maintenance"]);
12370
+ var SetupTrigger = z6.enum(["init", "maintenance"]);
12872
12371
  var SetupInputSchema = HookInputBaseSchema.extend({
12873
- hook_event_name: z7.literal("Setup"),
12372
+ hook_event_name: z6.literal("Setup"),
12874
12373
  trigger: SetupTrigger
12875
12374
  });
12876
12375
  var SubagentStartInputSchema = HookInputBaseSchema.extend({
12877
- hook_event_name: z7.literal("SubagentStart"),
12878
- agent_id: z7.string(),
12879
- agent_type: z7.string()
12376
+ hook_event_name: z6.literal("SubagentStart"),
12377
+ agent_id: z6.string(),
12378
+ agent_type: z6.string()
12880
12379
  });
12881
12380
  var PermissionRequestInputSchema = HookInputBaseSchema.extend({
12882
- hook_event_name: z7.literal("PermissionRequest"),
12883
- tool_name: z7.string(),
12884
- tool_input: z7.record(z7.string(), z7.unknown()),
12885
- tool_use_id: z7.string()
12381
+ hook_event_name: z6.literal("PermissionRequest"),
12382
+ tool_name: z6.string(),
12383
+ tool_input: z6.record(z6.string(), z6.unknown()),
12384
+ tool_use_id: z6.string()
12886
12385
  });
12887
- var HookInputSchema = z7.discriminatedUnion("hook_event_name", [
12386
+ var HookInputSchema = z6.discriminatedUnion("hook_event_name", [
12888
12387
  SessionStartInputSchema,
12889
12388
  SessionEndInputSchema,
12890
12389
  PreToolUseInputSchema,
@@ -12899,57 +12398,57 @@ var HookInputSchema = z7.discriminatedUnion("hook_event_name", [
12899
12398
  SubagentStartInputSchema,
12900
12399
  PermissionRequestInputSchema
12901
12400
  ]);
12902
- var PermissionDecision = z7.enum(["allow", "deny", "ask"]);
12903
- var HookDecision = z7.enum(["block"]);
12904
- var HookOutputBaseSchema = z7.object({
12905
- continue: z7.boolean().optional(),
12906
- stopReason: z7.string().optional(),
12907
- suppressOutput: z7.boolean().optional(),
12908
- systemMessage: z7.string().optional()
12401
+ var PermissionDecision = z6.enum(["allow", "deny", "ask"]);
12402
+ var HookDecision = z6.enum(["block"]);
12403
+ var HookOutputBaseSchema = z6.object({
12404
+ continue: z6.boolean().optional(),
12405
+ stopReason: z6.string().optional(),
12406
+ suppressOutput: z6.boolean().optional(),
12407
+ systemMessage: z6.string().optional()
12909
12408
  });
12910
12409
  var PreToolUseOutputSchema = HookOutputBaseSchema.extend({
12911
- hookSpecificOutput: z7.object({
12912
- hookEventName: z7.literal("PreToolUse"),
12410
+ hookSpecificOutput: z6.object({
12411
+ hookEventName: z6.literal("PreToolUse"),
12913
12412
  permissionDecision: PermissionDecision.optional(),
12914
- permissionDecisionReason: z7.string().optional(),
12915
- updatedInput: z7.record(z7.string(), z7.unknown()).optional(),
12916
- additionalContext: z7.string().optional()
12413
+ permissionDecisionReason: z6.string().optional(),
12414
+ updatedInput: z6.record(z6.string(), z6.unknown()).optional(),
12415
+ additionalContext: z6.string().optional()
12917
12416
  }).optional()
12918
12417
  });
12919
12418
  var PostToolUseOutputSchema = HookOutputBaseSchema.extend({
12920
12419
  decision: HookDecision.optional(),
12921
- reason: z7.string().optional(),
12922
- hookSpecificOutput: z7.object({
12923
- hookEventName: z7.literal("PostToolUse"),
12924
- additionalContext: z7.string().optional()
12420
+ reason: z6.string().optional(),
12421
+ hookSpecificOutput: z6.object({
12422
+ hookEventName: z6.literal("PostToolUse"),
12423
+ additionalContext: z6.string().optional()
12925
12424
  }).optional()
12926
12425
  });
12927
12426
  var StopOutputSchema = HookOutputBaseSchema.extend({
12928
12427
  decision: HookDecision.optional(),
12929
- reason: z7.string().optional()
12428
+ reason: z6.string().optional()
12930
12429
  });
12931
12430
  var UserPromptSubmitOutputSchema = HookOutputBaseSchema.extend({
12932
12431
  decision: HookDecision.optional(),
12933
- reason: z7.string().optional(),
12934
- hookSpecificOutput: z7.object({
12935
- hookEventName: z7.literal("UserPromptSubmit"),
12936
- additionalContext: z7.string().optional()
12432
+ reason: z6.string().optional(),
12433
+ hookSpecificOutput: z6.object({
12434
+ hookEventName: z6.literal("UserPromptSubmit"),
12435
+ additionalContext: z6.string().optional()
12937
12436
  }).optional()
12938
12437
  });
12939
12438
  var SessionStartOutputSchema = HookOutputBaseSchema.extend({
12940
- hookSpecificOutput: z7.object({
12941
- hookEventName: z7.literal("SessionStart"),
12942
- additionalContext: z7.string().optional()
12439
+ hookSpecificOutput: z6.object({
12440
+ hookEventName: z6.literal("SessionStart"),
12441
+ additionalContext: z6.string().optional()
12943
12442
  }).optional()
12944
12443
  });
12945
12444
  var PermissionRequestOutputSchema = HookOutputBaseSchema.extend({
12946
- hookSpecificOutput: z7.object({
12947
- hookEventName: z7.literal("PermissionRequest"),
12948
- decision: z7.object({
12949
- behavior: z7.enum(["allow", "deny"]),
12950
- updatedInput: z7.record(z7.string(), z7.unknown()).optional(),
12951
- message: z7.string().optional(),
12952
- interrupt: z7.boolean().optional()
12445
+ hookSpecificOutput: z6.object({
12446
+ hookEventName: z6.literal("PermissionRequest"),
12447
+ decision: z6.object({
12448
+ behavior: z6.enum(["allow", "deny"]),
12449
+ updatedInput: z6.record(z6.string(), z6.unknown()).optional(),
12450
+ message: z6.string().optional(),
12451
+ interrupt: z6.boolean().optional()
12953
12452
  })
12954
12453
  }).optional()
12955
12454
  });
@@ -13035,7 +12534,7 @@ function writeResultAndExit(result) {
13035
12534
 
13036
12535
  // src/cli/hooks/hook-router.ts
13037
12536
  async function readStdin() {
13038
- return new Promise((resolve14, reject) => {
12537
+ return new Promise((resolve13, reject) => {
13039
12538
  let data = "";
13040
12539
  process.stdin.setEncoding("utf8");
13041
12540
  process.stdin.on("readable", () => {
@@ -13046,24 +12545,24 @@ async function readStdin() {
13046
12545
  }
13047
12546
  });
13048
12547
  process.stdin.on("end", () => {
13049
- resolve14(data);
12548
+ resolve13(data);
13050
12549
  });
13051
12550
  process.stdin.on("error", (err2) => {
13052
12551
  reject(err2);
13053
12552
  });
13054
12553
  if (process.stdin.isTTY) {
13055
- resolve14("");
12554
+ resolve13("");
13056
12555
  }
13057
12556
  });
13058
12557
  }
13059
12558
  async function readStdinWithTimeout(timeoutMs = 5e3) {
13060
- return new Promise((resolve14, reject) => {
12559
+ return new Promise((resolve13, reject) => {
13061
12560
  const timeout2 = setTimeout(() => {
13062
12561
  reject(new Error(`Stdin read timeout after ${String(timeoutMs)}ms`));
13063
12562
  }, timeoutMs);
13064
12563
  readStdin().then((data) => {
13065
12564
  clearTimeout(timeout2);
13066
- resolve14(data);
12565
+ resolve13(data);
13067
12566
  }).catch((err2) => {
13068
12567
  clearTimeout(timeout2);
13069
12568
  reject(err2 instanceof Error ? err2 : new Error(String(err2)));
@@ -14553,9 +14052,9 @@ function interactiveIO() {
14553
14052
  write: (text) => {
14554
14053
  process.stdout.write(text);
14555
14054
  },
14556
- prompt: (question) => new Promise((resolve14) => {
14055
+ prompt: (question) => new Promise((resolve13) => {
14557
14056
  rl.question(question, (answer) => {
14558
- resolve14(answer.trim());
14057
+ resolve13(answer.trim());
14559
14058
  });
14560
14059
  }),
14561
14060
  close: () => {
@@ -14577,8 +14076,8 @@ function scriptedIO() {
14577
14076
  // src/governance/claims-registry.ts
14578
14077
  import { existsSync as existsSync12, readFileSync as readFileSync6 } from "fs";
14579
14078
  import { parse as parseYaml2 } from "yaml";
14580
- import { z as z8 } from "zod";
14581
- var VerificationMethodSchema = z8.enum([
14079
+ import { z as z7 } from "zod";
14080
+ var VerificationMethodSchema = z7.enum([
14582
14081
  "file-exists",
14583
14082
  "file-contains",
14584
14083
  "source-contains-all",
@@ -14586,7 +14085,7 @@ var VerificationMethodSchema = z8.enum([
14586
14085
  "manifest-tool-count",
14587
14086
  "roadmap-status"
14588
14087
  ]);
14589
- var ClaimStatusSchema = z8.enum([
14088
+ var ClaimStatusSchema = z7.enum([
14590
14089
  "verified",
14591
14090
  // backed by live evidence the runner checks every CI run
14592
14091
  "partial",
@@ -14596,25 +14095,25 @@ var ClaimStatusSchema = z8.enum([
14596
14095
  "stale"
14597
14096
  // known-broken backing; tracked, must not regress to silent
14598
14097
  ]);
14599
- var EvidenceTypeSchema = z8.enum(["test", "gate", "eval-artifact", "adr", "source"]);
14600
- var VerificationSchema = z8.object({
14098
+ var EvidenceTypeSchema = z7.enum(["test", "gate", "eval-artifact", "adr", "source"]);
14099
+ var VerificationSchema = z7.object({
14601
14100
  method: VerificationMethodSchema,
14602
14101
  /** Repo-root-relative path to the live backing evidence. */
14603
- path: z8.string().min(1),
14102
+ path: z7.string().min(1),
14604
14103
  /**
14605
14104
  * Expected value. Numeric for `enum-member-count` / `manifest-tool-count`,
14606
14105
  * string for `file-contains` / `roadmap-status`. Unused by `file-exists`.
14607
14106
  */
14608
- expected: z8.union([z8.number().int().nonnegative(), z8.string().min(1)]).optional(),
14107
+ expected: z7.union([z7.number().int().nonnegative(), z7.string().min(1)]).optional(),
14609
14108
  /** Target symbol name (e.g. the exported `z.enum` const) for count methods. */
14610
- symbol: z8.string().min(1).optional(),
14109
+ symbol: z7.string().min(1).optional(),
14611
14110
  /**
14612
14111
  * Literal the claim's `subject` doc must contain (#3877). When present, the
14613
14112
  * runner verifies the doc making the claim — not just the source of truth —
14614
14113
  * so README/ARCHITECTURE drift fails the gate. Omit only for claims whose
14615
14114
  * `subject` IS the verification `path` (e.g. `roadmap-status`).
14616
14115
  */
14617
- subjectContains: z8.string().min(1).optional()
14116
+ subjectContains: z7.string().min(1).optional()
14618
14117
  }).strict().superRefine((v, ctx) => {
14619
14118
  const needsNumber = v.method === "enum-member-count" || v.method === "manifest-tool-count";
14620
14119
  const needsString = v.method === "file-contains" || v.method === "source-contains-all" || v.method === "roadmap-status";
@@ -14640,24 +14139,24 @@ var VerificationSchema = z8.object({
14640
14139
  });
14641
14140
  }
14642
14141
  });
14643
- var ClaimEntrySchema = z8.object({
14142
+ var ClaimEntrySchema = z7.object({
14644
14143
  /** Stable, kebab-case identifier; never reused. */
14645
- id: z8.string().regex(/^[a-z0-9]+(-[a-z0-9]+)*$/, "id must be kebab-case"),
14144
+ id: z7.string().regex(/^[a-z0-9]+(-[a-z0-9]+)*$/, "id must be kebab-case"),
14646
14145
  /** Human-readable claim text (<=25 words). */
14647
- claim: z8.string().min(1).refine((s) => s.trim().split(/\s+/).length <= 25, "claim must be <=25 words"),
14146
+ claim: z7.string().min(1).refine((s) => s.trim().split(/\s+/).length <= 25, "claim must be <=25 words"),
14648
14147
  /** Repo-root-relative doc that makes the claim (e.g. README.md). */
14649
- subject: z8.string().min(1),
14148
+ subject: z7.string().min(1),
14650
14149
  status: ClaimStatusSchema,
14651
14150
  evidenceType: EvidenceTypeSchema,
14652
14151
  verification: VerificationSchema,
14653
14152
  /** ISO date (YYYY-MM-DD) the claim was last manually verified. */
14654
- lastVerified: z8.string().regex(/^\d{4}-\d{2}-\d{2}$/, "lastVerified must be YYYY-MM-DD"),
14153
+ lastVerified: z7.string().regex(/^\d{4}-\d{2}-\d{2}$/, "lastVerified must be YYYY-MM-DD"),
14655
14154
  /** Optional caveat surfaced in reports (required-ish for `partial`). */
14656
- caveat: z8.string().optional()
14155
+ caveat: z7.string().optional()
14657
14156
  }).strict();
14658
- var ClaimsRegistrySchema = z8.object({
14659
- version: z8.number().int().positive(),
14660
- claims: z8.array(ClaimEntrySchema).min(1).superRefine((claims, ctx) => {
14157
+ var ClaimsRegistrySchema = z7.object({
14158
+ version: z7.number().int().positive(),
14159
+ claims: z7.array(ClaimEntrySchema).min(1).superRefine((claims, ctx) => {
14661
14160
  const seen = /* @__PURE__ */ new Set();
14662
14161
  for (const [i, c] of claims.entries()) {
14663
14162
  if (seen.has(c.id)) {
@@ -14674,7 +14173,7 @@ var ClaimsRegistrySchema = z8.object({
14674
14173
 
14675
14174
  // src/governance/claims-verify.ts
14676
14175
  import { existsSync as existsSync13, readFileSync as readFileSync7 } from "fs";
14677
- import { isAbsolute as isAbsolute2, join as join12 } from "path";
14176
+ import { isAbsolute as isAbsolute2, join as join10 } from "path";
14678
14177
 
14679
14178
  // src/cli/fitness-audit.ts
14680
14179
  var COLORS = colors;
@@ -15879,7 +15378,7 @@ async function releaseAnnounceCommand(args) {
15879
15378
 
15880
15379
  // src/cli/scaffold.ts
15881
15380
  import * as fs16 from "fs";
15882
- import * as path19 from "path";
15381
+ import * as path16 from "path";
15883
15382
 
15884
15383
  // src/cli/scaffold-templates.ts
15885
15384
  function toolImportsAndSchema(name, pascal) {
@@ -16215,8 +15714,8 @@ ${lines}`;
16215
15714
  function writeFiles(files) {
16216
15715
  const createdPaths = [];
16217
15716
  for (const file of files) {
16218
- const fullPath = path19.resolve(process.cwd(), file.path);
16219
- const dir = path19.dirname(fullPath);
15717
+ const fullPath = path16.resolve(process.cwd(), file.path);
15718
+ const dir = path16.dirname(fullPath);
16220
15719
  fs16.mkdirSync(dir, { recursive: true });
16221
15720
  if (fs16.existsSync(fullPath)) {
16222
15721
  return {
@@ -17013,11 +16512,11 @@ import {
17013
16512
  appendFileSync as appendFileSync2,
17014
16513
  readFileSync as readFileSync13
17015
16514
  } from "fs";
17016
- import { resolve as resolve10, join as join16, isAbsolute as isAbsolute3 } from "path";
16515
+ import { resolve as resolve9, join as join14, isAbsolute as isAbsolute3 } from "path";
17017
16516
 
17018
16517
  // src/cli/mcp-config-emitter.ts
17019
16518
  import { existsSync as existsSync18, readFileSync as readFileSync11, writeFileSync as writeFileSync5, appendFileSync } from "fs";
17020
- import { join as join13 } from "path";
16519
+ import { join as join11 } from "path";
17021
16520
  var MCP_CONFIG_FILENAME = ".mcp.json";
17022
16521
  var NEXUS_SERVER_KEY = "nexus-agents";
17023
16522
  function buildNexusServerEntry(dataDir, commandPath) {
@@ -17039,23 +16538,23 @@ function entriesEqual(a, b) {
17039
16538
  for (const k of aKeys) if (aEnv[k] !== bEnv[k]) return false;
17040
16539
  return true;
17041
16540
  }
17042
- function loadExistingConfig(path21) {
17043
- if (!existsSync18(path21)) return { ok: true, value: void 0 };
16541
+ function loadExistingConfig(path18) {
16542
+ if (!existsSync18(path18)) return { ok: true, value: void 0 };
17044
16543
  let raw;
17045
16544
  try {
17046
- raw = readFileSync11(path21, "utf-8");
16545
+ raw = readFileSync11(path18, "utf-8");
17047
16546
  } catch (e) {
17048
16547
  return { ok: false, error: e instanceof Error ? e.message : String(e) };
17049
16548
  }
17050
16549
  try {
17051
16550
  const parsed = JSON.parse(raw);
17052
16551
  if (typeof parsed !== "object" || parsed === null) {
17053
- return { ok: false, error: `${path21}: top-level JSON must be an object` };
16552
+ return { ok: false, error: `${path18}: top-level JSON must be an object` };
17054
16553
  }
17055
16554
  return { ok: true, value: parsed };
17056
16555
  } catch (e) {
17057
16556
  const msg = e instanceof Error ? e.message : String(e);
17058
- return { ok: false, error: `${path21}: invalid JSON \u2014 ${msg}` };
16557
+ return { ok: false, error: `${path18}: invalid JSON \u2014 ${msg}` };
17059
16558
  }
17060
16559
  }
17061
16560
  function decideEmission(existing, desired, force) {
@@ -17077,9 +16576,9 @@ function decideEmission(existing, desired, force) {
17077
16576
  return { kind: "write", nextConfig: { ...existing, mcpServers: nextServers } };
17078
16577
  }
17079
16578
  function autoGitignoreMcpConfig(workspaceDir, dryRun) {
17080
- const gitDir = join13(workspaceDir, ".git");
16579
+ const gitDir = join11(workspaceDir, ".git");
17081
16580
  if (!existsSync18(gitDir)) return false;
17082
- const gitignorePath = join13(workspaceDir, ".gitignore");
16581
+ const gitignorePath = join11(workspaceDir, ".gitignore");
17083
16582
  let existing = "";
17084
16583
  if (existsSync18(gitignorePath)) {
17085
16584
  existing = readFileSync11(gitignorePath, "utf-8");
@@ -17094,7 +16593,7 @@ function autoGitignoreMcpConfig(workspaceDir, dryRun) {
17094
16593
  return true;
17095
16594
  }
17096
16595
  function emitMcpConfig(options) {
17097
- const mcpConfigPath = join13(options.workspaceDir, MCP_CONFIG_FILENAME);
16596
+ const mcpConfigPath = join11(options.workspaceDir, MCP_CONFIG_FILENAME);
17098
16597
  const dryRun = options.dryRun === true;
17099
16598
  const force = options.force === true;
17100
16599
  const desired = buildNexusServerEntry(options.dataDir, options.commandPath);
@@ -17133,12 +16632,12 @@ function makeFailure(mcpConfigPath, error) {
17133
16632
  // src/cli/portable-installer.ts
17134
16633
  import { execFile as execFile2 } from "child_process";
17135
16634
  import { existsSync as existsSync20, mkdirSync as mkdirSync4, rmSync, writeFileSync as writeFileSync7 } from "fs";
17136
- import { join as join15 } from "path";
16635
+ import { join as join13 } from "path";
17137
16636
  import { promisify as promisify2 } from "util";
17138
16637
 
17139
16638
  // src/cli/bin-shim.ts
17140
16639
  import { existsSync as existsSync19, readFileSync as readFileSync12, writeFileSync as writeFileSync6, chmodSync as chmodSync2, mkdirSync as mkdirSync3 } from "fs";
17141
- import { join as join14 } from "path";
16640
+ import { join as join12 } from "path";
17142
16641
  var SHIM_BASENAME = "nexus-agents";
17143
16642
  var SHIM_MODE = 493;
17144
16643
  function buildShimContents(cliEntryPath) {
@@ -17152,7 +16651,7 @@ function buildShimContents(cliEntryPath) {
17152
16651
  return lines.join("\n");
17153
16652
  }
17154
16653
  function writeBinShim(options) {
17155
- const shimPath = join14(options.binDir, SHIM_BASENAME);
16654
+ const shimPath = join12(options.binDir, SHIM_BASENAME);
17156
16655
  const desired = buildShimContents(options.cliEntryPath);
17157
16656
  const dryRun = options.dryRun === true;
17158
16657
  try {
@@ -17198,10 +16697,10 @@ function writeInstallManifest(cliDir, version) {
17198
16697
  description: "Local install root for portable nexus-agents (generated; do not commit)",
17199
16698
  dependencies: { "nexus-agents": version }
17200
16699
  };
17201
- writeFileSync7(join15(cliDir, "package.json"), JSON.stringify(manifest, null, 2) + "\n", "utf-8");
16700
+ writeFileSync7(join13(cliDir, "package.json"), JSON.stringify(manifest, null, 2) + "\n", "utf-8");
17202
16701
  }
17203
16702
  function isAlreadyInstalled(cliDir) {
17204
- return existsSync20(join15(cliDir, "node_modules", "nexus-agents", "package.json"));
16703
+ return existsSync20(join13(cliDir, "node_modules", "nexus-agents", "package.json"));
17205
16704
  }
17206
16705
  async function spawnNpmInstall(cliDir) {
17207
16706
  await execFileAsync2("npm", ["install", "--no-audit", "--no-fund", "--silent"], {
@@ -17228,8 +16727,8 @@ async function runNpmStep(ctx) {
17228
16727
  }
17229
16728
  }
17230
16729
  async function installPortable(options) {
17231
- const cliDir = join15(options.dataDir, CLI_SUBDIR);
17232
- const binDir = join15(options.dataDir, BIN_SUBDIR);
16730
+ const cliDir = join13(options.dataDir, CLI_SUBDIR);
16731
+ const binDir = join13(options.dataDir, BIN_SUBDIR);
17233
16732
  const versionResolution = resolveInstallVersion(options.version);
17234
16733
  if (!versionResolution.ok) {
17235
16734
  return {
@@ -17250,7 +16749,7 @@ async function installPortable(options) {
17250
16749
  }
17251
16750
  const npmFailure = await runNpmStep(ctx);
17252
16751
  if (npmFailure !== void 0) return npmFailure;
17253
- const shim = writeBinShim({ binDir, cliEntryPath: join15(cliDir, CLI_ENTRY_RELATIVE) });
16752
+ const shim = writeBinShim({ binDir, cliEntryPath: join13(cliDir, CLI_ENTRY_RELATIVE) });
17254
16753
  if (!shim.success) {
17255
16754
  cleanupOnFailure(cliDir);
17256
16755
  return {
@@ -17264,8 +16763,8 @@ async function installPortable(options) {
17264
16763
  return { success: true, ...ctx, shim, skipped: false, error: null };
17265
16764
  }
17266
16765
  function uninstallPortable(options) {
17267
- const cliDir = join15(options.dataDir, CLI_SUBDIR);
17268
- const binDir = join15(options.dataDir, BIN_SUBDIR);
16766
+ const cliDir = join13(options.dataDir, CLI_SUBDIR);
16767
+ const binDir = join13(options.dataDir, BIN_SUBDIR);
17269
16768
  const removed = [];
17270
16769
  const notPresent = [];
17271
16770
  const dryRun = options.dryRun === true;
@@ -17285,7 +16784,7 @@ function uninstallPortable(options) {
17285
16784
  }
17286
16785
  }
17287
16786
  function findBinShim(dataDir) {
17288
- const shimPath = join15(dataDir, BIN_SUBDIR, "nexus-agents");
16787
+ const shimPath = join13(dataDir, BIN_SUBDIR, "nexus-agents");
17289
16788
  return existsSync20(shimPath) ? shimPath : void 0;
17290
16789
  }
17291
16790
 
@@ -17294,9 +16793,9 @@ var DEFAULT_PORTABLE_DIRNAME = ".nexus-agents";
17294
16793
  var RESTRICTED_SUBDIRS = /* @__PURE__ */ new Set(["auth"]);
17295
16794
  function resolveTargetPath(rawPath) {
17296
16795
  if (rawPath === void 0 || rawPath === "") {
17297
- return resolve10(process.cwd(), DEFAULT_PORTABLE_DIRNAME);
16796
+ return resolve9(process.cwd(), DEFAULT_PORTABLE_DIRNAME);
17298
16797
  }
17299
- return isAbsolute3(rawPath) ? rawPath : resolve10(process.cwd(), rawPath);
16798
+ return isAbsolute3(rawPath) ? rawPath : resolve9(process.cwd(), rawPath);
17300
16799
  }
17301
16800
  function isNonEmpty(dir) {
17302
16801
  if (!existsSync21(dir)) return false;
@@ -17304,20 +16803,20 @@ function isNonEmpty(dir) {
17304
16803
  if (!stat2.isDirectory()) return true;
17305
16804
  return readdirSync(dir).length > 0;
17306
16805
  }
17307
- function ensureDir(path21, dryRun, created, alreadyExisted, mode) {
17308
- if (existsSync21(path21)) {
17309
- alreadyExisted.push(path21);
16806
+ function ensureDir(path18, dryRun, created, alreadyExisted, mode) {
16807
+ if (existsSync21(path18)) {
16808
+ alreadyExisted.push(path18);
17310
16809
  return;
17311
16810
  }
17312
16811
  if (!dryRun) {
17313
- mkdirSync5(path21, { recursive: true, ...mode !== void 0 ? { mode } : {} });
16812
+ mkdirSync5(path18, { recursive: true, ...mode !== void 0 ? { mode } : {} });
17314
16813
  }
17315
- created.push(path21);
16814
+ created.push(path18);
17316
16815
  }
17317
16816
  function maybeUpdateGitignore(workspaceDir, portableDirName, dryRun) {
17318
- const gitDir = join16(workspaceDir, ".git");
16817
+ const gitDir = join14(workspaceDir, ".git");
17319
16818
  if (!existsSync21(gitDir)) return false;
17320
- const gitignorePath = join16(workspaceDir, ".gitignore");
16819
+ const gitignorePath = join14(workspaceDir, ".gitignore");
17321
16820
  const entry = `${portableDirName}/`;
17322
16821
  let existing = "";
17323
16822
  if (existsSync21(gitignorePath)) {
@@ -17338,14 +16837,14 @@ function inspectTarget(target) {
17338
16837
  if (!exists) return { exists: false, nonEmpty: false, isExistingNexusDir: false };
17339
16838
  const nonEmpty = isNonEmpty(target);
17340
16839
  const stat2 = statSync2(target);
17341
- const isExistingNexusDir = stat2.isDirectory() && existsSync21(join16(target, "audit"));
16840
+ const isExistingNexusDir = stat2.isDirectory() && existsSync21(join14(target, "audit"));
17342
16841
  return { exists, nonEmpty, isExistingNexusDir };
17343
16842
  }
17344
16843
  function createDataLayout(target, dryRun, created, alreadyExisted) {
17345
16844
  ensureDir(target, dryRun, created, alreadyExisted);
17346
16845
  for (const subdir of DATA_SUBDIRECTORIES) {
17347
16846
  const mode = RESTRICTED_SUBDIRS.has(subdir) ? 448 : void 0;
17348
- ensureDir(join16(target, subdir), dryRun, created, alreadyExisted, mode);
16847
+ ensureDir(join14(target, subdir), dryRun, created, alreadyExisted, mode);
17349
16848
  }
17350
16849
  }
17351
16850
  function makeResult(opts) {
@@ -17364,13 +16863,13 @@ function makeResult(opts) {
17364
16863
  }
17365
16864
  function applyGitignoreOption(target, options, dryRun) {
17366
16865
  if (options.gitignore !== true) return false;
17367
- const workspaceDir = resolve10(target, "..");
16866
+ const workspaceDir = resolve9(target, "..");
17368
16867
  const portableName = target.slice(workspaceDir.length + 1);
17369
16868
  return maybeUpdateGitignore(workspaceDir, portableName, dryRun);
17370
16869
  }
17371
16870
  function applyMcpConfigOption(target, options, dryRun) {
17372
16871
  if (options.mcpConfig !== true) return void 0;
17373
- const workspaceDir = resolve10(target, "..");
16872
+ const workspaceDir = resolve9(target, "..");
17374
16873
  const shimPath = findBinShim(target);
17375
16874
  return emitMcpConfig({
17376
16875
  workspaceDir,
@@ -17886,7 +17385,7 @@ function startImprovementReviewScheduler(options) {
17886
17385
  let running = false;
17887
17386
  const runOnce = async () => {
17888
17387
  try {
17889
- const { runImprovementReview: runImprovementReview2, ImprovementReviewInputSchema: ImprovementReviewInputSchema2 } = await import("./improvement-review-2W6LKP74.js");
17388
+ const { runImprovementReview: runImprovementReview2, ImprovementReviewInputSchema: ImprovementReviewInputSchema2 } = await import("./improvement-review-WYFGNEVP.js");
17890
17389
  const input = ImprovementReviewInputSchema2.parse({ fileIssues });
17891
17390
  const result = await runImprovementReview2(input, { logger: logger19 });
17892
17391
  logger19.info("Scheduled improvement_review complete", {
@@ -18307,8 +17806,8 @@ async function initUpstreamServers(gatewayConfig, server, logger19) {
18307
17806
  servers: upstreamServers.length,
18308
17807
  tools: tools.length
18309
17808
  });
18310
- const { z: z14 } = await import("zod");
18311
- const passthroughSchema = z14.looseObject({});
17809
+ const { z: z13 } = await import("zod");
17810
+ const passthroughSchema = z13.looseObject({});
18312
17811
  for (const tool of tools) {
18313
17812
  const toolName = tool.name;
18314
17813
  const desc = tool.description ?? `Upstream tool: ${toolName}`;
@@ -18568,21 +18067,21 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
18568
18067
 
18569
18068
  // src/mcp/workspace-roots.ts
18570
18069
  import { existsSync as existsSync22 } from "fs";
18571
- import { join as join17 } from "path";
18070
+ import { join as join15 } from "path";
18572
18071
  import { fileURLToPath } from "url";
18573
18072
  function deriveWorkspaceRootFromRoots(roots) {
18574
18073
  let first = null;
18575
18074
  let gitRoot = null;
18576
18075
  for (const root of roots) {
18577
18076
  if (typeof root.uri !== "string" || !root.uri.startsWith("file://")) continue;
18578
- let path21;
18077
+ let path18;
18579
18078
  try {
18580
- path21 = fileURLToPath(root.uri);
18079
+ path18 = fileURLToPath(root.uri);
18581
18080
  } catch {
18582
18081
  continue;
18583
18082
  }
18584
- first ??= path21;
18585
- if (gitRoot === null && existsSync22(join17(path21, ".git"))) gitRoot = path21;
18083
+ first ??= path18;
18084
+ if (gitRoot === null && existsSync22(join15(path18, ".git"))) gitRoot = path18;
18586
18085
  }
18587
18086
  return gitRoot ?? first;
18588
18087
  }
@@ -18765,7 +18264,7 @@ async function executeReplTask(task, options, logger19, rl) {
18765
18264
  }
18766
18265
  }
18767
18266
  function runOrchestratorRepl(options, logger19) {
18768
- return new Promise((resolve14) => {
18267
+ return new Promise((resolve13) => {
18769
18268
  const rl = readline2.createInterface({
18770
18269
  input: process.stdin,
18771
18270
  output: process.stdout,
@@ -18788,7 +18287,7 @@ function runOrchestratorRepl(options, logger19) {
18788
18287
  });
18789
18288
  rl.on("close", () => {
18790
18289
  logger19.info("Orchestrator REPL closed");
18791
- resolve14();
18290
+ resolve13();
18792
18291
  });
18793
18292
  });
18794
18293
  }
@@ -19939,7 +19438,7 @@ function adaptConfigToLibrary(config) {
19939
19438
  }
19940
19439
  function createBeliefPromoter() {
19941
19440
  return async (event) => {
19942
- const { getToolMemory } = await import("./tool-memory-XJ5VRMNQ.js");
19441
+ const { getToolMemory } = await import("./tool-memory-3W5NXR4P.js");
19943
19442
  const tm = getToolMemory();
19944
19443
  await tm.recordBelief(
19945
19444
  `skill:${event.name}`,
@@ -21115,7 +20614,7 @@ async function handleResearchCommand(args) {
21115
20614
  }
21116
20615
  }
21117
20616
  async function handleRegistryCommand(args) {
21118
- const { registryCommand, isValidRegistrySubcommand, formatRegistryUsage } = await import("./registry-command-5D2DJT53.js");
20617
+ const { registryCommand, isValidRegistrySubcommand, formatRegistryUsage } = await import("./registry-command-JCOZA7TM.js");
21119
20618
  const subcommand = args.subcommand;
21120
20619
  if (!isValidRegistrySubcommand(subcommand)) {
21121
20620
  process.stdout.write(`${formatRegistryUsage()}
@@ -21163,7 +20662,7 @@ async function handleVerifyCommand(args) {
21163
20662
  async function handleDoctorCommand(args) {
21164
20663
  const exitCode = await doctorCommand({ fix: args.options.fix });
21165
20664
  if (args.options.deep) {
21166
- const { runDeepDiagnostics: runDeepDiagnostics2, formatDeepDiagnostics: formatDeepDiagnostics2 } = await import("./doctor-deep-DALT3OXC.js");
20665
+ const { runDeepDiagnostics: runDeepDiagnostics2, formatDeepDiagnostics: formatDeepDiagnostics2 } = await import("./doctor-deep-QTBDR3VV.js");
21167
20666
  const diag = runDeepDiagnostics2();
21168
20667
  process.stdout.write(formatDeepDiagnostics2(diag) + "\n");
21169
20668
  }
@@ -21213,7 +20712,7 @@ async function runInitPortableFlow(args) {
21213
20712
  return cliExit(result.success ? EXIT_CODES.SUCCESS : EXIT_CODES.SERVER_START_FAILED);
21214
20713
  }
21215
20714
  async function runInitOpencodeFlow(args) {
21216
- const { runInitOpencode } = await import("./init-opencode-XVTVJ6FN.js");
20715
+ const { runInitOpencode } = await import("./init-opencode-CMGJ3TXZ.js");
21217
20716
  const opencodePath = args.options.opencode;
21218
20717
  if (opencodePath === void 0 || opencodePath === "") {
21219
20718
  process.stderr.write("Error: --opencode requires a path argument.\n");
@@ -21239,7 +20738,7 @@ async function runInitOpencodeFlow(args) {
21239
20738
  return cliExit(EXIT_CODES.SUCCESS);
21240
20739
  }
21241
20740
  async function renderOpencodeValidate(opencodePath) {
21242
- const { runOpencodeValidate } = await import("./init-opencode-XVTVJ6FN.js");
20741
+ const { runOpencodeValidate } = await import("./init-opencode-CMGJ3TXZ.js");
21243
20742
  const result = await runOpencodeValidate(opencodePath);
21244
20743
  if (!result.ok) {
21245
20744
  process.stderr.write(`init --opencode --validate: ${result.reason ?? "failed"}
@@ -21278,7 +20777,7 @@ async function handleSetupCommandAsync(args) {
21278
20777
  return cliExitFromStatus(exitCode);
21279
20778
  }
21280
20779
  async function runCustomApiSetup(args) {
21281
- const { configureCustomApi } = await import("./setup-custom-api-XRUPWEPF.js");
20780
+ const { configureCustomApi } = await import("./setup-custom-api-MYN4EVT2.js");
21282
20781
  const baseUrl = args.options.customApi;
21283
20782
  if (baseUrl === void 0) return EXIT_CODES.SERVER_START_FAILED;
21284
20783
  const input = {
@@ -21640,13 +21139,13 @@ function handleScaffoldCommand(args) {
21640
21139
 
21641
21140
  // src/cli/visualize-summary.ts
21642
21141
  import * as fs17 from "fs";
21643
- import * as path20 from "path";
21142
+ import * as path17 from "path";
21644
21143
  import { fileURLToPath as fileURLToPath2 } from "url";
21645
21144
  function findPackageRoot(startDir) {
21646
21145
  let dir = startDir;
21647
21146
  for (let i = 0; i < 5; i++) {
21648
- if (fs17.existsSync(path20.join(dir, "package.json"))) return dir;
21649
- const parent = path20.dirname(dir);
21147
+ if (fs17.existsSync(path17.join(dir, "package.json"))) return dir;
21148
+ const parent = path17.dirname(dir);
21650
21149
  if (parent === dir) break;
21651
21150
  dir = parent;
21652
21151
  }
@@ -21657,7 +21156,7 @@ function countFiles(dir, pattern) {
21657
21156
  let count = 0;
21658
21157
  for (const entry of fs17.readdirSync(dir, { withFileTypes: true })) {
21659
21158
  if (entry.isDirectory() && entry.name !== "node_modules" && entry.name !== "dist") {
21660
- count += countFiles(path20.join(dir, entry.name), pattern);
21159
+ count += countFiles(path17.join(dir, entry.name), pattern);
21661
21160
  } else if (entry.isFile() && pattern.test(entry.name)) {
21662
21161
  count++;
21663
21162
  }
@@ -21666,7 +21165,7 @@ function countFiles(dir, pattern) {
21666
21165
  }
21667
21166
  function readVersion(pkgRoot) {
21668
21167
  try {
21669
- const raw = fs17.readFileSync(path20.join(pkgRoot, "package.json"), "utf-8");
21168
+ const raw = fs17.readFileSync(path17.join(pkgRoot, "package.json"), "utf-8");
21670
21169
  const pkg = JSON.parse(raw);
21671
21170
  return pkg.version ?? "unknown";
21672
21171
  } catch {
@@ -21687,13 +21186,13 @@ var LAYER_DIRS = [
21687
21186
  ];
21688
21187
  function gatherSystemSummary() {
21689
21188
  const thisFile = fileURLToPath2(import.meta.url);
21690
- const pkgRoot = findPackageRoot(path20.dirname(thisFile));
21691
- const srcDir = path20.resolve(pkgRoot, "src");
21189
+ const pkgRoot = findPackageRoot(path17.dirname(thisFile));
21190
+ const srcDir = path17.resolve(pkgRoot, "src");
21692
21191
  const allTs = countFiles(srcDir, /\.ts$/);
21693
21192
  const testTs = countFiles(srcDir, /\.test\.ts$/);
21694
21193
  const layers = LAYER_DIRS.map(({ name, dir }) => ({
21695
21194
  name,
21696
- files: countFiles(path20.join(srcDir, dir), /\.ts$/)
21195
+ files: countFiles(path17.join(srcDir, dir), /\.ts$/)
21697
21196
  })).filter((l) => l.files > 0);
21698
21197
  return {
21699
21198
  version: readVersion(pkgRoot),
@@ -22851,7 +22350,7 @@ function handleStatusCommand2(args) {
22851
22350
 
22852
22351
  // src/cli/scenario-command.ts
22853
22352
  import { readdir as readdir4 } from "fs/promises";
22854
- import { join as join19, resolve as resolve12 } from "path";
22353
+ import { join as join17, resolve as resolve11 } from "path";
22855
22354
 
22856
22355
  // src/testing/e2e/scenario-runner.ts
22857
22356
  import { readFile as readFile7 } from "fs/promises";
@@ -22982,9 +22481,9 @@ function checkCircularDependencies(workflow) {
22982
22481
  for (const step of workflow.steps) {
22983
22482
  stepMap.set(step.id, step);
22984
22483
  }
22985
- const visit = (stepId, path21) => {
22484
+ const visit = (stepId, path18) => {
22986
22485
  if (visiting.has(stepId)) {
22987
- errors.push(`Circular dependency detected: ${[...path21, stepId].join(" -> ")}`);
22486
+ errors.push(`Circular dependency detected: ${[...path18, stepId].join(" -> ")}`);
22988
22487
  return false;
22989
22488
  }
22990
22489
  if (visited.has(stepId)) return true;
@@ -22992,7 +22491,7 @@ function checkCircularDependencies(workflow) {
22992
22491
  const step = stepMap.get(stepId);
22993
22492
  if (step?.dependsOn) {
22994
22493
  for (const dep of step.dependsOn) {
22995
- if (!visit(dep, [...path21, stepId])) {
22494
+ if (!visit(dep, [...path18, stepId])) {
22996
22495
  return false;
22997
22496
  }
22998
22497
  }
@@ -23011,7 +22510,7 @@ function checkCircularDependencies(workflow) {
23011
22510
  var defaultStubFactory = {
23012
22511
  createAgentStub(agentType, action) {
23013
22512
  return async (inputs) => {
23014
- await new Promise((resolve14) => setTimeout(resolve14, 10));
22513
+ await new Promise((resolve13) => setTimeout(resolve13, 10));
23015
22514
  return {
23016
22515
  stepId: `${agentType}-${action}`,
23017
22516
  status: "success",
@@ -23036,8 +22535,8 @@ var ScenarioRunner = class {
23036
22535
  /**
23037
22536
  * Load a scenario fixture from a YAML file.
23038
22537
  */
23039
- async loadFixture(path21) {
23040
- const content = await readFile7(path21, "utf-8");
22538
+ async loadFixture(path18) {
22539
+ const content = await readFile7(path18, "utf-8");
23041
22540
  const data = yaml7.parse(content);
23042
22541
  return ScenarioFixtureSchema.parse(data);
23043
22542
  }
@@ -23170,7 +22669,7 @@ function createScenarioRunner(stubFactory) {
23170
22669
  }
23171
22670
 
23172
22671
  // src/cli/scenario-command.ts
23173
- var FIXTURES_DIR = resolve12(import.meta.dirname, "../testing/e2e/fixtures");
22672
+ var FIXTURES_DIR = resolve11(import.meta.dirname, "../testing/e2e/fixtures");
23174
22673
  var SCENARIO_SUFFIX = ".scenario.yaml";
23175
22674
  async function listScenarios() {
23176
22675
  try {
@@ -23221,7 +22720,7 @@ async function handleRun(args) {
23221
22720
  return cliExit(EXIT_CODES.SERVER_START_FAILED);
23222
22721
  }
23223
22722
  const runner = createScenarioRunner();
23224
- const fixturePath = join19(FIXTURES_DIR, `${name}${SCENARIO_SUFFIX}`);
22723
+ const fixturePath = join17(FIXTURES_DIR, `${name}${SCENARIO_SUFFIX}`);
23225
22724
  try {
23226
22725
  const fixture = await runner.loadFixture(fixturePath);
23227
22726
  const result = await runner.run(fixture);
@@ -23776,10 +23275,10 @@ function stripRefsPrefix(ref) {
23776
23275
  import { execFile as execFile4 } from "child_process";
23777
23276
  import { promisify as promisify4 } from "util";
23778
23277
  import { writeFile as writeFile6, mkdir as mkdir5 } from "fs/promises";
23779
- import { join as join20, dirname as dirname11 } from "path";
23278
+ import { join as join18, dirname as dirname9 } from "path";
23780
23279
 
23781
23280
  // src/mcp/tools/improvement-remediation-capability.ts
23782
- import { z as z9 } from "zod";
23281
+ import { z as z8 } from "zod";
23783
23282
  var PHASE_CAPABILITIES = {
23784
23283
  research: /* @__PURE__ */ new Set(["untrusted-input", "secrets"]),
23785
23284
  implement: /* @__PURE__ */ new Set(["repo-write", "secrets"])
@@ -23820,7 +23319,7 @@ var CapabilityLedger = class {
23820
23319
  }
23821
23320
  }
23822
23321
  };
23823
- var RemediationActionKindSchema = z9.enum([
23322
+ var RemediationActionKindSchema = z8.enum([
23824
23323
  "investigate",
23825
23324
  "adjust-routing",
23826
23325
  "add-test",
@@ -23828,17 +23327,17 @@ var RemediationActionKindSchema = z9.enum([
23828
23327
  "update-docs",
23829
23328
  "fix-bug"
23830
23329
  ]);
23831
- var RemediationStepSchema = z9.object({
23330
+ var RemediationStepSchema = z8.object({
23832
23331
  kind: RemediationActionKindSchema,
23833
- description: z9.string().min(1).max(500),
23332
+ description: z8.string().min(1).max(500),
23834
23333
  /** Optional path hint; bounded inert string, validated for traversal at use. */
23835
- targetPath: z9.string().min(1).max(300).optional()
23334
+ targetPath: z8.string().min(1).max(300).optional()
23836
23335
  }).strict();
23837
- var RemediationPlanSchema = z9.object({
23336
+ var RemediationPlanSchema = z8.object({
23838
23337
  /** Source signal key (mirrors ImprovementSignal.signalKey). */
23839
- signalKey: z9.string().min(1).max(200),
23338
+ signalKey: z8.string().min(1).max(200),
23840
23339
  /** Signal category (mirrors SignalCategory; 'tool-fitness' #3852, 'perf-regression' #3692). */
23841
- category: z9.enum([
23340
+ category: z8.enum([
23842
23341
  "routing",
23843
23342
  "tech-debt",
23844
23343
  "bug",
@@ -23847,8 +23346,8 @@ var RemediationPlanSchema = z9.object({
23847
23346
  "tool-fitness",
23848
23347
  "perf-regression"
23849
23348
  ]),
23850
- summary: z9.string().min(1).max(1e3),
23851
- steps: z9.array(RemediationStepSchema).min(1).max(20)
23349
+ summary: z8.string().min(1).max(1e3),
23350
+ steps: z8.array(RemediationStepSchema).min(1).max(20)
23852
23351
  }).strict();
23853
23352
  function parseRemediationPlan(raw) {
23854
23353
  const result = RemediationPlanSchema.safeParse(raw);
@@ -23935,13 +23434,13 @@ function makeGitWorktreeOps(repoRoot) {
23935
23434
  };
23936
23435
  return {
23937
23436
  async addWorktree(branch, baseBranch) {
23938
- const path21 = join20(repoRoot, ".nexus-worktrees", branch.replace(/\//g, "_"));
23939
- await git2(["worktree", "add", "-b", branch, path21, baseBranch], repoRoot);
23940
- return path21;
23437
+ const path18 = join18(repoRoot, ".nexus-worktrees", branch.replace(/\//g, "_"));
23438
+ await git2(["worktree", "add", "-b", branch, path18, baseBranch], repoRoot);
23439
+ return path18;
23941
23440
  },
23942
23441
  async writeFileIn(worktreePath, relPath, content) {
23943
- const abs = join20(worktreePath, relPath);
23944
- await mkdir5(dirname11(abs), { recursive: true });
23442
+ const abs = join18(worktreePath, relPath);
23443
+ await mkdir5(dirname9(abs), { recursive: true });
23945
23444
  await writeFile6(abs, content, "utf8");
23946
23445
  },
23947
23446
  async commitAll(worktreePath, message) {
@@ -23978,25 +23477,25 @@ function makeGhPrCreator() {
23978
23477
  }
23979
23478
 
23980
23479
  // src/mcp/tools/remediation-review.ts
23981
- import { z as z10 } from "zod";
23480
+ import { z as z9 } from "zod";
23982
23481
  function soakRefOf(record) {
23983
23482
  return `${record.signalKey}::${record.timestamp}`;
23984
23483
  }
23985
- var ReviewRecordSchema = z10.object({
23484
+ var ReviewRecordSchema = z9.object({
23986
23485
  /** Reference to the reviewed soak selection (`signalKey::timestamp`). */
23987
- soakRef: z10.string(),
23486
+ soakRef: z9.string(),
23988
23487
  /** ISO-8601 time the review was recorded. */
23989
- reviewedAt: z10.string(),
23488
+ reviewedAt: z9.string(),
23990
23489
  /** Always true — a persisted record is, by construction, a review. */
23991
- reviewed: z10.literal(true),
23490
+ reviewed: z9.literal(true),
23992
23491
  /** Whether the evaluator assessed the selection SOUND. */
23993
- sound: z10.boolean(),
23492
+ sound: z9.boolean(),
23994
23493
  /** Named evaluator who performed the review (required — the gate's named-evaluator criterion). */
23995
- evaluator: z10.string().min(1),
23494
+ evaluator: z9.string().min(1),
23996
23495
  /** Named owner accepting enforcement, recorded at sign-off time (optional per record). */
23997
- owner: z10.string().min(1).optional(),
23496
+ owner: z9.string().min(1).optional(),
23998
23497
  /** Free-text note (secret-scrubbed). */
23999
- note: z10.string().optional()
23498
+ note: z9.string().optional()
24000
23499
  });
24001
23500
  var REVIEW_MAX_RECORDS = 1e4;
24002
23501
  function getRemediationReviewFile() {
@@ -24141,14 +23640,14 @@ import { createHash as createHash4 } from "crypto";
24141
23640
  import { createHash as createHash3 } from "crypto";
24142
23641
  import { mkdtempSync, mkdirSync as mkdirSync6, writeFileSync as writeFileSync8, rmSync as rmSync2, realpathSync as realpathSync2 } from "fs";
24143
23642
  import { tmpdir } from "os";
24144
- import { dirname as dirname13, join as join21 } from "path";
23643
+ import { dirname as dirname11, join as join19 } from "path";
24145
23644
  import { execFileSync as execFileSync3 } from "child_process";
24146
- import { z as z12 } from "zod";
23645
+ import { z as z11 } from "zod";
24147
23646
 
24148
23647
  // src/mcp/tools/codepr-guards.ts
24149
23648
  import { realpathSync } from "fs";
24150
- import { isAbsolute as isAbsolute4, resolve as resolve13, relative as relative5, sep as sep3, dirname as dirname12, basename as basename5 } from "path";
24151
- import { z as z11 } from "zod";
23649
+ import { isAbsolute as isAbsolute4, resolve as resolve12, relative as relative4, sep as sep3, dirname as dirname10, basename as basename4 } from "path";
23650
+ import { z as z10 } from "zod";
24152
23651
  function deny(reason, detail) {
24153
23652
  return { ok: false, reason, detail };
24154
23653
  }
@@ -24169,7 +23668,7 @@ function confinePath(worktreeRoot, candidatePath, realpath = realpathSync) {
24169
23668
  } catch {
24170
23669
  return deny("path_escape", "worktreeRoot could not be resolved (fail-closed)");
24171
23670
  }
24172
- const joined = isAbsolute4(candidatePath) ? candidatePath : resolve13(resolvedRoot, candidatePath);
23671
+ const joined = isAbsolute4(candidatePath) ? candidatePath : resolve12(resolvedRoot, candidatePath);
24173
23672
  const reassembled = resolveNewFilePath(joined, realpath);
24174
23673
  if (reassembled === void 0) {
24175
23674
  return deny("path_escape", "candidate path could not be resolved (fail-closed)");
@@ -24188,17 +23687,17 @@ function resolveNewFilePath(joined, realpath) {
24188
23687
  break;
24189
23688
  } catch (err2) {
24190
23689
  if (errnoCode(err2) !== "ENOENT") return void 0;
24191
- const parent = dirname12(existing);
23690
+ const parent = dirname10(existing);
24192
23691
  if (parent === existing) return void 0;
24193
- trailing.push(basename5(existing));
23692
+ trailing.push(basename4(existing));
24194
23693
  existing = parent;
24195
23694
  }
24196
23695
  }
24197
- return trailing.length === 0 ? existing : resolve13(existing, ...trailing.reverse());
23696
+ return trailing.length === 0 ? existing : resolve12(existing, ...trailing.reverse());
24198
23697
  }
24199
23698
  function isWithin(parent, child) {
24200
23699
  if (child === parent) return true;
24201
- const rel = relative5(parent, child);
23700
+ const rel = relative4(parent, child);
24202
23701
  if (rel === "") return true;
24203
23702
  if (rel === ".." || rel.startsWith(".." + sep3)) return false;
24204
23703
  if (isAbsolute4(rel)) return false;
@@ -24294,11 +23793,11 @@ function classifyPath(relPath) {
24294
23793
  }
24295
23794
  return { sensitive: false };
24296
23795
  }
24297
- var BlastRadiusLimitsSchema = z11.object({
23796
+ var BlastRadiusLimitsSchema = z10.object({
24298
23797
  /** Max number of files the change may touch. Default 20. */
24299
- maxFiles: z11.number().int().positive().default(20),
23798
+ maxFiles: z10.number().int().positive().default(20),
24300
23799
  /** Max total changed lines (added + removed across all files). Default 400. */
24301
- maxLines: z11.number().int().positive().default(400)
23800
+ maxLines: z10.number().int().positive().default(400)
24302
23801
  }).strict();
24303
23802
  var DEFAULT_BLAST_RADIUS_LIMITS = Object.freeze(
24304
23803
  BlastRadiusLimitsSchema.parse({})
@@ -24376,13 +23875,13 @@ function auditAutonomousEvent(logger19, record) {
24376
23875
  }
24377
23876
  return { ok: true };
24378
23877
  }
24379
- var ResourceBudgetLimitsSchema = z11.object({
23878
+ var ResourceBudgetLimitsSchema = z10.object({
24380
23879
  /** Wall-clock ceiling in ms. Default 600000 (10 min). */
24381
- maxWallClockMs: z11.number().int().positive().default(6e5),
23880
+ maxWallClockMs: z10.number().int().positive().default(6e5),
24382
23881
  /** Token ceiling. Default 200000. */
24383
- maxTokens: z11.number().int().positive().default(2e5),
23882
+ maxTokens: z10.number().int().positive().default(2e5),
24384
23883
  /** Tool-call ceiling. Default 200. */
24385
- maxToolCalls: z11.number().int().positive().default(200)
23884
+ maxToolCalls: z10.number().int().positive().default(200)
24386
23885
  }).strict();
24387
23886
  var DEFAULT_RESOURCE_BUDGET_LIMITS = Object.freeze(
24388
23887
  ResourceBudgetLimitsSchema.parse({})
@@ -24442,19 +23941,19 @@ function runGuard(name, fn) {
24442
23941
  }
24443
23942
 
24444
23943
  // src/mcp/tools/codepr-orchestrator.ts
24445
- var ProposedChangeSchema = z12.object({
23944
+ var ProposedChangeSchema = z11.object({
24446
23945
  /** Repo-relative path the change would write. */
24447
- relPath: z12.string().min(1),
23946
+ relPath: z11.string().min(1),
24448
23947
  /** The full new file content. */
24449
- newContent: z12.string()
23948
+ newContent: z11.string()
24450
23949
  }).strict();
24451
- var CodePrRunInputSchema = z12.object({
23950
+ var CodePrRunInputSchema = z11.object({
24452
23951
  /** Correlates all audit events for this run. */
24453
- runId: z12.string().min(1),
23952
+ runId: z11.string().min(1),
24454
23953
  /** Hash of the source signal (fitness/improvement) that triggered the run. */
24455
- sourceSignalHash: z12.string().min(1),
23954
+ sourceSignalHash: z11.string().min(1),
24456
23955
  /** The proposed change set. */
24457
- changes: z12.array(ProposedChangeSchema).min(1)
23956
+ changes: z11.array(ProposedChangeSchema).min(1)
24458
23957
  }).strict();
24459
23958
  var ORCHESTRATOR_USAGE_ZERO = { wallClockMs: 0, tokens: 0, toolCalls: 0 };
24460
23959
  function sha256(s) {
@@ -24471,9 +23970,9 @@ function parseNumstat(numstat) {
24471
23970
  if (parts.length < 3) continue;
24472
23971
  const added = parts[0] === "-" ? 0 : Number.parseInt(parts[0] ?? "0", 10);
24473
23972
  const removed = parts[1] === "-" ? 0 : Number.parseInt(parts[1] ?? "0", 10);
24474
- const path21 = parts.slice(2).join(" ");
23973
+ const path18 = parts.slice(2).join(" ");
24475
23974
  files.push({
24476
- path: path21,
23975
+ path: path18,
24477
23976
  addedLines: Number.isFinite(added) ? added : 0,
24478
23977
  removedLines: Number.isFinite(removed) ? removed : 0
24479
23978
  });
@@ -24528,7 +24027,7 @@ function applyChanges(worktreeRoot, run) {
24528
24027
  for (const change of run.changes) {
24529
24028
  const confined = confinePath(worktreeRoot, change.relPath);
24530
24029
  if (!confined.ok) throw new Error(`apply: ${confined.detail}`);
24531
- mkdirSync6(dirname13(confined.resolvedPath), { recursive: true });
24030
+ mkdirSync6(dirname11(confined.resolvedPath), { recursive: true });
24532
24031
  writeFileSync8(confined.resolvedPath, change.newContent);
24533
24032
  }
24534
24033
  }
@@ -24590,8 +24089,8 @@ function runGuardsAndPlan(args, logger19) {
24590
24089
  function runInWorktree(run, logger19, options, handle) {
24591
24090
  const fault = options.faultInjector;
24592
24091
  const repoRoot = options.repoRoot ?? process.cwd();
24593
- handle.tempParent = realpathSync2(mkdtempSync(join21(tmpdir(), "codepr-orchestrator-")));
24594
- handle.worktreeRoot = join21(handle.tempParent, "wt");
24092
+ handle.tempParent = realpathSync2(mkdtempSync(join19(tmpdir(), "codepr-orchestrator-")));
24093
+ handle.worktreeRoot = join19(handle.tempParent, "wt");
24595
24094
  git(repoRoot, ["worktree", "add", "--detach", handle.worktreeRoot]);
24596
24095
  fault?.("after-worktree");
24597
24096
  const precheck = precheckChanges(handle.worktreeRoot, run, logger19);
@@ -24657,20 +24156,20 @@ function planCodePrRun(input, logger19, options = {}) {
24657
24156
  }
24658
24157
 
24659
24158
  // src/mcp/tools/codepr-soak-store.ts
24660
- import { z as z13 } from "zod";
24661
- var CodePrSoakRecordSchema = z13.object({
24159
+ import { z as z12 } from "zod";
24160
+ var CodePrSoakRecordSchema = z12.object({
24662
24161
  /** ISO-8601 capture time. */
24663
- timestamp: z13.string(),
24162
+ timestamp: z12.string(),
24664
24163
  /** Correlates the data point to the dry-run's orchestrator runId. */
24665
- runId: z13.string(),
24164
+ runId: z12.string(),
24666
24165
  /** The improvement signal's stable key that triggered the dry-run. */
24667
- signalKey: z13.string(),
24166
+ signalKey: z12.string(),
24668
24167
  /** True when the dry-run plan succeeded with ZERO guard denial. */
24669
- green: z13.boolean(),
24168
+ green: z12.boolean(),
24670
24169
  /** The guard denial reason when `green` is false; omitted for a green plan. */
24671
- denialReason: z13.string().optional(),
24170
+ denialReason: z12.string().optional(),
24672
24171
  /** Files the dry-run plan touched (0 on denial before the diff was realized). */
24673
- filesTouched: z13.number().int().nonnegative()
24172
+ filesTouched: z12.number().int().nonnegative()
24674
24173
  }).strict();
24675
24174
  var CODEPR_SOAK_MAX_RECORDS = 1e4;
24676
24175
  function getCodePrSoakFile() {
@@ -24736,11 +24235,11 @@ function deriveProposedChanges(plan) {
24736
24235
  const changes = [];
24737
24236
  for (const step of plan.steps) {
24738
24237
  if (!CODE_TOUCHING_KINDS.has(step.kind)) continue;
24739
- const path21 = step.targetPath !== void 0 && step.targetPath !== "" ? step.targetPath : placeholderPathFor(plan, step.kind);
24740
- if (seen.has(path21)) continue;
24741
- seen.add(path21);
24238
+ const path18 = step.targetPath !== void 0 && step.targetPath !== "" ? step.targetPath : placeholderPathFor(plan, step.kind);
24239
+ if (seen.has(path18)) continue;
24240
+ seen.add(path18);
24742
24241
  changes.push({
24743
- relPath: path21,
24242
+ relPath: path18,
24744
24243
  newContent: `// codepr soak dry-run placeholder for ${plan.signalKey} (${step.kind})
24745
24244
  `
24746
24245
  });
@@ -25016,11 +24515,11 @@ var PROTECTED_PATH_FRAGMENTS = [
25016
24515
  "secret",
25017
24516
  "credential"
25018
24517
  ];
25019
- function normalize2(path21) {
25020
- return path21.replace(/\\/g, "/").replace(/^\.\//, "").toLowerCase();
24518
+ function normalize2(path18) {
24519
+ return path18.replace(/\\/g, "/").replace(/^\.\//, "").toLowerCase();
25021
24520
  }
25022
- function isProtectedPath(path21) {
25023
- const p = normalize2(path21);
24521
+ function isProtectedPath(path18) {
24522
+ const p = normalize2(path18);
25024
24523
  return PROTECTED_PATH_FRAGMENTS.some((frag) => p.includes(frag));
25025
24524
  }
25026
24525
  function planTouchesProtectedPath(plan) {
@@ -25460,16 +24959,16 @@ async function handleRemediationReviewCommand(args) {
25460
24959
  // src/cli/migrate-command.ts
25461
24960
  import { cpSync, existsSync as existsSync24, mkdirSync as mkdirSync7, readdirSync as readdirSync3 } from "fs";
25462
24961
  import { homedir } from "os";
25463
- import { join as join22 } from "path";
24962
+ import { join as join20 } from "path";
25464
24963
  var logger18 = createLogger({ component: "migrate-command" });
25465
- var HOMEDIR_DEFAULT_BASE = join22(homedir(), ".nexus-agents");
24964
+ var HOMEDIR_DEFAULT_BASE = join20(homedir(), ".nexus-agents");
25466
24965
  function countItems(dir) {
25467
24966
  if (!existsSync24(dir)) return 0;
25468
24967
  try {
25469
24968
  const entries = readdirSync3(dir, { withFileTypes: true });
25470
24969
  let n = 0;
25471
24970
  for (const e of entries) {
25472
- const p = join22(dir, e.name);
24971
+ const p = join20(dir, e.name);
25473
24972
  if (e.isDirectory()) {
25474
24973
  n += countItems(p);
25475
24974
  } else {
@@ -25524,8 +25023,8 @@ function checkEarlyExits(fromBase, toBase, dryRun) {
25524
25023
  return null;
25525
25024
  }
25526
25025
  function planAndExecuteEntry(name, fromBase, toBase, perRepoSet, dryRun) {
25527
- const source = join22(fromBase, name);
25528
- const target = join22(toBase, name);
25026
+ const source = join20(fromBase, name);
25027
+ const target = join20(toBase, name);
25529
25028
  if (!perRepoSet.has(name)) {
25530
25029
  return { subdir: name, status: "skipped-not-per-repo", source, target: "", itemsCopied: 0 };
25531
25030
  }
@@ -25545,7 +25044,7 @@ function planAndExecuteEntry(name, fromBase, toBase, perRepoSet, dryRun) {
25545
25044
  function resolveDefaultTarget(cwd) {
25546
25045
  const repoRoot = findRepoRoot(cwd);
25547
25046
  if (repoRoot === null) return null;
25548
- return join22(repoRoot, ".nexus-agents");
25047
+ return join20(repoRoot, ".nexus-agents");
25549
25048
  }
25550
25049
  function formatMigrationResult(result) {
25551
25050
  if (!result.success) {
@@ -25588,7 +25087,7 @@ async function handleMigrateCommand(args) {
25588
25087
 
25589
25088
  // src/cli/first-run-hint.ts
25590
25089
  import { existsSync as existsSync25, mkdirSync as mkdirSync8, writeFileSync as writeFileSync9 } from "fs";
25591
- import { dirname as dirname14 } from "path";
25090
+ import { dirname as dirname12 } from "path";
25592
25091
  var HINT_SUPPRESSED_COMMANDS = /* @__PURE__ */ new Set(["version", "help", "setup"]);
25593
25092
  function firstRunMarkerPath() {
25594
25093
  return nexusSharedPath(".first-run-done");
@@ -25605,7 +25104,7 @@ function maybeShowFirstRunHint(command) {
25605
25104
  "\x1B[36mnexus-agents\x1B[0m: First time? Run \x1B[1mnexus-agents setup\x1B[0m to configure.\n (This one-time hint is now dismissed.)\n"
25606
25105
  );
25607
25106
  try {
25608
- mkdirSync8(dirname14(marker), { recursive: true });
25107
+ mkdirSync8(dirname12(marker), { recursive: true });
25609
25108
  writeFileSync9(marker, `${(/* @__PURE__ */ new Date()).toISOString()}
25610
25109
  `, { flag: "w" });
25611
25110
  } catch {