nexus-agents 6.2.0 → 6.2.1

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 (125) hide show
  1. package/dist/{child-mcp-config-MAEPMEMJ.js → child-mcp-config-GM2RNTZL.js} +2 -2
  2. package/dist/{chunk-LHDMQAYQ.js → chunk-2CZP5HI3.js} +2 -2
  3. package/dist/{chunk-U443FR6F.js → chunk-2QKZC2TZ.js} +4 -4
  4. package/dist/{chunk-NDPUIPKN.js → chunk-56FMLTYA.js} +2 -2
  5. package/dist/{chunk-TCKBYC7Z.js → chunk-5TQC5ZT3.js} +2 -2
  6. package/dist/{chunk-CJQRCKR4.js → chunk-62BXAKN4.js} +2 -2
  7. package/dist/{chunk-ZQSBNRKS.js → chunk-76E4SZ55.js} +3 -3
  8. package/dist/{chunk-5WVP7C3Z.js → chunk-7EXGLORM.js} +4 -4
  9. package/dist/{chunk-5WVP7C3Z.js.map → chunk-7EXGLORM.js.map} +1 -1
  10. package/dist/{chunk-FCJN757G.js → chunk-A337QC7T.js} +2 -2
  11. package/dist/{chunk-P7URBNEC.js → chunk-B5BCAZ67.js} +3 -3
  12. package/dist/{chunk-P7URBNEC.js.map → chunk-B5BCAZ67.js.map} +1 -1
  13. package/dist/{chunk-6JBCXRWI.js → chunk-B7OSEC65.js} +2 -2
  14. package/dist/{chunk-KUP3YM2J.js → chunk-BBROWRNT.js} +2 -2
  15. package/dist/{chunk-AQOUQIIO.js → chunk-BEVDHBLV.js} +8 -8
  16. package/dist/{chunk-AQOUQIIO.js.map → chunk-BEVDHBLV.js.map} +1 -1
  17. package/dist/chunk-C364WBYN.js +7 -0
  18. package/dist/{chunk-7ANADXHH.js → chunk-CWEAD5L5.js} +2 -2
  19. package/dist/{chunk-L4BL4UHG.js → chunk-F7YLKM2N.js} +2 -2
  20. package/dist/{chunk-BA6LALHG.js → chunk-FJPF6NUY.js} +2 -2
  21. package/dist/{chunk-OYMLM23M.js → chunk-J2WPQTXB.js} +2 -2
  22. package/dist/{chunk-HKP47JNU.js → chunk-L4TNK5EV.js} +3 -3
  23. package/dist/{chunk-OWPBJIWP.js → chunk-LWDEI43X.js} +2 -2
  24. package/dist/{chunk-QPGSBGG5.js → chunk-LWDMTCTS.js} +5 -5
  25. package/dist/{chunk-JVQU5EDH.js → chunk-NGRUMP7Q.js} +5 -5
  26. package/dist/{chunk-WP4ILUPM.js → chunk-OIHHLQCQ.js} +35 -35
  27. package/dist/{chunk-WP4ILUPM.js.map → chunk-OIHHLQCQ.js.map} +1 -1
  28. package/dist/{chunk-WZHWX3SA.js → chunk-OTNFLBKH.js} +6 -6
  29. package/dist/{chunk-QKAGRX22.js → chunk-P2KRXJI7.js} +2 -2
  30. package/dist/{chunk-VXXA5UN7.js → chunk-PYSJGQW3.js} +2 -2
  31. package/dist/{chunk-LJEUEU6B.js → chunk-Q7FAI4JO.js} +2 -2
  32. package/dist/{chunk-YAT2GTVH.js → chunk-SMYCLSH6.js} +4 -4
  33. package/dist/{chunk-V36QXMIL.js → chunk-UDOFXNIG.js} +7 -7
  34. package/dist/chunk-UDOFXNIG.js.map +1 -0
  35. package/dist/{chunk-MPCVF44P.js → chunk-UI5JIET2.js} +4 -4
  36. package/dist/{chunk-B7DESALP.js → chunk-UYNAJJQR.js} +2 -2
  37. package/dist/{chunk-SJH3ZEKK.js → chunk-VECTXFPX.js} +8 -8
  38. package/dist/{chunk-74FMJTGV.js → chunk-Z7OXB43V.js} +7 -7
  39. package/dist/{chunk-SEQIGOAF.js → chunk-ZA5F5ESS.js} +3 -3
  40. package/dist/{cli-circuit-breaker-XUP4B3CR.js → cli-circuit-breaker-DW7LLHDL.js} +3 -3
  41. package/dist/cli.js +41 -41
  42. package/dist/{composite-router-EY5NIZUY.js → composite-router-4MOMC7ON.js} +2 -2
  43. package/dist/{consensus-vote-TFCCNC67.js → consensus-vote-B4V5F3LW.js} +17 -17
  44. package/dist/{context-retriever-3UYUB2VS.js → context-retriever-3HRRVJPX.js} +8 -8
  45. package/dist/{doctor-deep-LFUNO5N5.js → doctor-deep-ADQSW3RD.js} +3 -3
  46. package/dist/{doctor-live-PT63BVXI.js → doctor-live-LYCZPZ6R.js} +9 -9
  47. package/dist/{expert-bridge-CLYAPS4Q.js → expert-bridge-7H5ZRUQQ.js} +4 -4
  48. package/dist/{factory-OBIKYM7M.js → factory-7OHJ6VO6.js} +5 -5
  49. package/dist/{factory-RKYK7SS3.js → factory-ABM4AGFY.js} +9 -9
  50. package/dist/{improvement-review-V4AQIMAI.js → improvement-review-GCW3UXQP.js} +6 -6
  51. package/dist/index.d.ts +16 -3
  52. package/dist/index.js +31 -31
  53. package/dist/index.js.map +1 -1
  54. package/dist/{init-opencode-WXD57CGR.js → init-opencode-ZF56EXKA.js} +6 -6
  55. package/dist/issue-triage-JCPJ27PG.js +17 -0
  56. package/dist/{pr-reviewer-helpers-GNQAEMFV.js → pr-reviewer-helpers-TZXSQZS7.js} +4 -4
  57. package/dist/{registry-command-ZSMUSV6O.js → registry-command-QFGRDD2U.js} +2 -2
  58. package/dist/{repo-security-plan-O6V4POGE.js → repo-security-plan-CMAAJI2S.js} +3 -3
  59. package/dist/{research-helpers-synthesize-AKWLYM53.js → research-helpers-synthesize-M5BOALWE.js} +4 -4
  60. package/dist/{routing-memory-6JURKD7X.js → routing-memory-A3YJZSFO.js} +2 -2
  61. package/dist/{session-memory-AOHQ7GFR.js → session-memory-PHJHGRRQ.js} +3 -3
  62. package/dist/{setup-config-YBPHQKMF.js → setup-config-QTUVOUZ4.js} +3 -3
  63. package/dist/{setup-custom-api-F24U4TMD.js → setup-custom-api-FBTU6BYC.js} +4 -4
  64. package/dist/setup-data-dir-QH5D7IYY.js +29 -0
  65. package/dist/{tool-memory-QNOIOXGA.js → tool-memory-BL6YZ7WW.js} +5 -5
  66. package/dist/{unified-registry-YEKBJ4R4.js → unified-registry-HVXWIHRL.js} +10 -10
  67. package/dist/{weather-report-RTKKHFDM.js → weather-report-CVPWMDQF.js} +2 -2
  68. package/package.json +1 -1
  69. package/dist/chunk-V36QXMIL.js.map +0 -1
  70. package/dist/chunk-WTS6XM5S.js +0 -7
  71. package/dist/issue-triage-3BMIT32P.js +0 -17
  72. package/dist/setup-data-dir-2D6SXQHE.js +0 -29
  73. /package/dist/{child-mcp-config-MAEPMEMJ.js.map → child-mcp-config-GM2RNTZL.js.map} +0 -0
  74. /package/dist/{chunk-LHDMQAYQ.js.map → chunk-2CZP5HI3.js.map} +0 -0
  75. /package/dist/{chunk-U443FR6F.js.map → chunk-2QKZC2TZ.js.map} +0 -0
  76. /package/dist/{chunk-NDPUIPKN.js.map → chunk-56FMLTYA.js.map} +0 -0
  77. /package/dist/{chunk-TCKBYC7Z.js.map → chunk-5TQC5ZT3.js.map} +0 -0
  78. /package/dist/{chunk-CJQRCKR4.js.map → chunk-62BXAKN4.js.map} +0 -0
  79. /package/dist/{chunk-ZQSBNRKS.js.map → chunk-76E4SZ55.js.map} +0 -0
  80. /package/dist/{chunk-FCJN757G.js.map → chunk-A337QC7T.js.map} +0 -0
  81. /package/dist/{chunk-6JBCXRWI.js.map → chunk-B7OSEC65.js.map} +0 -0
  82. /package/dist/{chunk-KUP3YM2J.js.map → chunk-BBROWRNT.js.map} +0 -0
  83. /package/dist/{chunk-WTS6XM5S.js.map → chunk-C364WBYN.js.map} +0 -0
  84. /package/dist/{chunk-7ANADXHH.js.map → chunk-CWEAD5L5.js.map} +0 -0
  85. /package/dist/{chunk-L4BL4UHG.js.map → chunk-F7YLKM2N.js.map} +0 -0
  86. /package/dist/{chunk-BA6LALHG.js.map → chunk-FJPF6NUY.js.map} +0 -0
  87. /package/dist/{chunk-OYMLM23M.js.map → chunk-J2WPQTXB.js.map} +0 -0
  88. /package/dist/{chunk-HKP47JNU.js.map → chunk-L4TNK5EV.js.map} +0 -0
  89. /package/dist/{chunk-OWPBJIWP.js.map → chunk-LWDEI43X.js.map} +0 -0
  90. /package/dist/{chunk-QPGSBGG5.js.map → chunk-LWDMTCTS.js.map} +0 -0
  91. /package/dist/{chunk-JVQU5EDH.js.map → chunk-NGRUMP7Q.js.map} +0 -0
  92. /package/dist/{chunk-WZHWX3SA.js.map → chunk-OTNFLBKH.js.map} +0 -0
  93. /package/dist/{chunk-QKAGRX22.js.map → chunk-P2KRXJI7.js.map} +0 -0
  94. /package/dist/{chunk-VXXA5UN7.js.map → chunk-PYSJGQW3.js.map} +0 -0
  95. /package/dist/{chunk-LJEUEU6B.js.map → chunk-Q7FAI4JO.js.map} +0 -0
  96. /package/dist/{chunk-YAT2GTVH.js.map → chunk-SMYCLSH6.js.map} +0 -0
  97. /package/dist/{chunk-MPCVF44P.js.map → chunk-UI5JIET2.js.map} +0 -0
  98. /package/dist/{chunk-B7DESALP.js.map → chunk-UYNAJJQR.js.map} +0 -0
  99. /package/dist/{chunk-SJH3ZEKK.js.map → chunk-VECTXFPX.js.map} +0 -0
  100. /package/dist/{chunk-74FMJTGV.js.map → chunk-Z7OXB43V.js.map} +0 -0
  101. /package/dist/{chunk-SEQIGOAF.js.map → chunk-ZA5F5ESS.js.map} +0 -0
  102. /package/dist/{cli-circuit-breaker-XUP4B3CR.js.map → cli-circuit-breaker-DW7LLHDL.js.map} +0 -0
  103. /package/dist/{composite-router-EY5NIZUY.js.map → composite-router-4MOMC7ON.js.map} +0 -0
  104. /package/dist/{consensus-vote-TFCCNC67.js.map → consensus-vote-B4V5F3LW.js.map} +0 -0
  105. /package/dist/{context-retriever-3UYUB2VS.js.map → context-retriever-3HRRVJPX.js.map} +0 -0
  106. /package/dist/{doctor-deep-LFUNO5N5.js.map → doctor-deep-ADQSW3RD.js.map} +0 -0
  107. /package/dist/{doctor-live-PT63BVXI.js.map → doctor-live-LYCZPZ6R.js.map} +0 -0
  108. /package/dist/{expert-bridge-CLYAPS4Q.js.map → expert-bridge-7H5ZRUQQ.js.map} +0 -0
  109. /package/dist/{factory-OBIKYM7M.js.map → factory-7OHJ6VO6.js.map} +0 -0
  110. /package/dist/{factory-RKYK7SS3.js.map → factory-ABM4AGFY.js.map} +0 -0
  111. /package/dist/{improvement-review-V4AQIMAI.js.map → improvement-review-GCW3UXQP.js.map} +0 -0
  112. /package/dist/{init-opencode-WXD57CGR.js.map → init-opencode-ZF56EXKA.js.map} +0 -0
  113. /package/dist/{issue-triage-3BMIT32P.js.map → issue-triage-JCPJ27PG.js.map} +0 -0
  114. /package/dist/{pr-reviewer-helpers-GNQAEMFV.js.map → pr-reviewer-helpers-TZXSQZS7.js.map} +0 -0
  115. /package/dist/{registry-command-ZSMUSV6O.js.map → registry-command-QFGRDD2U.js.map} +0 -0
  116. /package/dist/{repo-security-plan-O6V4POGE.js.map → repo-security-plan-CMAAJI2S.js.map} +0 -0
  117. /package/dist/{research-helpers-synthesize-AKWLYM53.js.map → research-helpers-synthesize-M5BOALWE.js.map} +0 -0
  118. /package/dist/{routing-memory-6JURKD7X.js.map → routing-memory-A3YJZSFO.js.map} +0 -0
  119. /package/dist/{session-memory-AOHQ7GFR.js.map → session-memory-PHJHGRRQ.js.map} +0 -0
  120. /package/dist/{setup-config-YBPHQKMF.js.map → setup-config-QTUVOUZ4.js.map} +0 -0
  121. /package/dist/{setup-custom-api-F24U4TMD.js.map → setup-custom-api-FBTU6BYC.js.map} +0 -0
  122. /package/dist/{setup-data-dir-2D6SXQHE.js.map → setup-data-dir-QH5D7IYY.js.map} +0 -0
  123. /package/dist/{tool-memory-QNOIOXGA.js.map → tool-memory-BL6YZ7WW.js.map} +0 -0
  124. /package/dist/{unified-registry-YEKBJ4R4.js.map → unified-registry-HVXWIHRL.js.map} +0 -0
  125. /package/dist/{weather-report-RTKKHFDM.js.map → weather-report-CVPWMDQF.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  GitHubProvider,
3
3
  ScmError
4
- } from "./chunk-BA6LALHG.js";
4
+ } from "./chunk-FJPF6NUY.js";
5
5
  import {
6
6
  ROLE_DEFAULT_TRUST,
7
7
  ReputationCache,
@@ -11,20 +11,20 @@ import {
11
11
  gateWithReputation,
12
12
  resolveReputationGatingMode,
13
13
  sanitizeInput
14
- } from "./chunk-FCJN757G.js";
14
+ } from "./chunk-A337QC7T.js";
15
15
  import {
16
16
  emitPolicyEvent
17
- } from "./chunk-OYMLM23M.js";
17
+ } from "./chunk-J2WPQTXB.js";
18
18
  import {
19
19
  hasToken
20
- } from "./chunk-LJEUEU6B.js";
20
+ } from "./chunk-Q7FAI4JO.js";
21
21
  import {
22
22
  CLI_SUBPROCESS_TIMEOUTS,
23
23
  createLogger,
24
24
  err,
25
25
  getTimeProvider,
26
26
  ok
27
- } from "./chunk-P7URBNEC.js";
27
+ } from "./chunk-B5BCAZ67.js";
28
28
 
29
29
  // src/security/trust-classifier.ts
30
30
  function mapAuthorAssociation(association) {
@@ -1247,4 +1247,4 @@ export {
1247
1247
  IssueTriage,
1248
1248
  createIssueTriage
1249
1249
  };
1250
- //# sourceMappingURL=chunk-WZHWX3SA.js.map
1250
+ //# sourceMappingURL=chunk-OTNFLBKH.js.map
@@ -13,7 +13,7 @@ import {
13
13
  lookupInTreeCapability,
14
14
  ok,
15
15
  resolveRetryAfterMs
16
- } from "./chunk-P7URBNEC.js";
16
+ } from "./chunk-B5BCAZ67.js";
17
17
 
18
18
  // src/config/model-parameter-support.ts
19
19
  function parseClaudeMajorMinor(bareId) {
@@ -834,4 +834,4 @@ export {
834
834
  DEFAULT_COLLECT_STREAM_MAX_CHUNKS,
835
835
  collectStream
836
836
  };
837
- //# sourceMappingURL=chunk-QKAGRX22.js.map
837
+ //# sourceMappingURL=chunk-P2KRXJI7.js.map
@@ -3,7 +3,7 @@ import {
3
3
  createLogger,
4
4
  err,
5
5
  ok
6
- } from "./chunk-P7URBNEC.js";
6
+ } from "./chunk-B5BCAZ67.js";
7
7
 
8
8
  // src/adapters/sdk/types.ts
9
9
  var PROVIDER_ENV_KEYS = {
@@ -260,4 +260,4 @@ export {
260
260
  validateCustomApiBaseUrl,
261
261
  assertCustomApiHostResolvesPublic
262
262
  };
263
- //# sourceMappingURL=chunk-VXXA5UN7.js.map
263
+ //# sourceMappingURL=chunk-PYSJGQW3.js.map
@@ -2,7 +2,7 @@ import {
2
2
  createLogger,
3
3
  err,
4
4
  ok
5
- } from "./chunk-P7URBNEC.js";
5
+ } from "./chunk-B5BCAZ67.js";
6
6
 
7
7
  // src/scm/token-resolver.ts
8
8
  import { execFile } from "child_process";
@@ -87,4 +87,4 @@ export {
87
87
  hasToken,
88
88
  getTokenEnvVars
89
89
  };
90
- //# sourceMappingURL=chunk-LJEUEU6B.js.map
90
+ //# sourceMappingURL=chunk-Q7FAI4JO.js.map
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-6T3EPABN.js";
6
6
  import {
7
7
  SessionMemory
8
- } from "./chunk-7ANADXHH.js";
8
+ } from "./chunk-CWEAD5L5.js";
9
9
  import {
10
10
  StatsOnlyAdapter,
11
11
  ensureSharedMemoryRegistry
@@ -15,7 +15,7 @@ import {
15
15
  } from "./chunk-KSQSWEFH.js";
16
16
  import {
17
17
  generateId
18
- } from "./chunk-L4BL4UHG.js";
18
+ } from "./chunk-F7YLKM2N.js";
19
19
  import {
20
20
  ErrorCode,
21
21
  NexusError,
@@ -28,7 +28,7 @@ import {
28
28
  getTimeProvider,
29
29
  ok,
30
30
  setSharedMobiMemDbPathResolver
31
- } from "./chunk-P7URBNEC.js";
31
+ } from "./chunk-B5BCAZ67.js";
32
32
  import {
33
33
  nexusDataPath
34
34
  } from "./chunk-OGHEKPLD.js";
@@ -5622,4 +5622,4 @@ export {
5622
5622
  reinitializeMemoryBackends,
5623
5623
  ToolMemoryManager
5624
5624
  };
5625
- //# sourceMappingURL=chunk-YAT2GTVH.js.map
5625
+ //# sourceMappingURL=chunk-SMYCLSH6.js.map
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  resolveCliSlot
3
- } from "./chunk-LHDMQAYQ.js";
3
+ } from "./chunk-2CZP5HI3.js";
4
4
  import {
5
5
  createLogger,
6
6
  getTimeProvider,
7
7
  isRateLimitText
8
- } from "./chunk-P7URBNEC.js";
8
+ } from "./chunk-B5BCAZ67.js";
9
9
 
10
10
  // src/pipeline/expert-bridge.ts
11
11
  function resolveCliFromModelString(model) {
@@ -21,7 +21,7 @@ async function getMcpConfigPath() {
21
21
  if (cachedMcpConfigPath !== null) return cachedMcpConfigPath;
22
22
  mcpConfigInitPromise ??= (async () => {
23
23
  try {
24
- const { generateMcpConfig } = await import("./child-mcp-config-MAEPMEMJ.js");
24
+ const { generateMcpConfig } = await import("./child-mcp-config-GM2RNTZL.js");
25
25
  const config = await generateMcpConfig();
26
26
  cachedMcpConfigPath = config.configPath;
27
27
  cachedMcpConfigCleanup = config.cleanup;
@@ -93,8 +93,8 @@ var routerInitPromise = null;
93
93
  async function getRouter() {
94
94
  if (cachedRouter !== null) return cachedRouter;
95
95
  routerInitPromise ??= (async () => {
96
- const { createAllAdapters } = await import("./factory-RKYK7SS3.js");
97
- const { createCompositeRouter } = await import("./composite-router-EY5NIZUY.js");
96
+ const { createAllAdapters } = await import("./factory-ABM4AGFY.js");
97
+ const { createCompositeRouter } = await import("./composite-router-4MOMC7ON.js");
98
98
  const adapters = createAllAdapters();
99
99
  if (adapters.size === 0) {
100
100
  routerInitPromise = null;
@@ -102,7 +102,7 @@ async function getRouter() {
102
102
  }
103
103
  cachedRouter = adaptCompositeRouter(createCompositeRouter(adapters));
104
104
  try {
105
- const { createCliCircuitBreakerIntegration } = await import("./cli-circuit-breaker-XUP4B3CR.js");
105
+ const { createCliCircuitBreakerIntegration } = await import("./cli-circuit-breaker-DW7LLHDL.js");
106
106
  cachedCircuitBreaker = createCliCircuitBreakerIntegration([...adapters.values()]);
107
107
  } catch (error) {
108
108
  const msg = error instanceof Error ? error.message : String(error);
@@ -213,4 +213,4 @@ export {
213
213
  tokenSplitFromUsage,
214
214
  executeExpert
215
215
  };
216
- //# sourceMappingURL=chunk-V36QXMIL.js.map
216
+ //# sourceMappingURL=chunk-UDOFXNIG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/pipeline/expert-bridge.ts"],"sourcesContent":["/**\n * Expert Bridge — Programmatic access to the execute_expert pipeline (#1693)\n *\n * Provides a clean wrapper for calling experts with the full pipeline:\n * timeout, fallback cascade, degradation detection, heartbeat, outcome recording.\n *\n * DRY: reuses createBuiltInExpert + CompositeRouter instead of reimplementing.\n *\n * @module pipeline/expert-bridge\n */\n\nimport { createLogger, getTimeProvider } from '../core/index.js';\nimport type { BuiltInExpertType } from '../agents/experts/expert-config.js';\nimport { isRateLimitText } from '../adapters/rate-limit-detector.js';\nimport { resolveCliSlot } from '../config/model-availability.js';\nimport type { CliNameLiteral } from '../config/model-capabilities-types.js';\n\n/**\n * Resolves a CLI slot from the model string a (CLI or API) adapter returned.\n * Known models resolve to their exact slot; **unknown** models — new releases\n * or API/openrouter models not in the curated registry — fall back to the\n * vendor-derived slot (#3317 / #3293) so the outcome is recorded against a real\n * slot instead of being dropped with an undefined cli (the api-mode gap).\n * Returns undefined only when no model is present (the bridge failed before\n * dispatch — no execution to attribute).\n */\nfunction resolveCliFromModelString(model: string | undefined): CliNameLiteral | undefined {\n return resolveCliSlot(model);\n}\n\nconst logger = createLogger({ component: 'expert-bridge' });\n\n/** Base delay for rate limit retry backoff (ms). Scales linearly: 3s, 6s, 9s. */\nconst RATE_LIMIT_BASE_DELAY_MS = 3000;\n\n/** Result of an expert execution. */\nexport interface ExpertBridgeResult {\n readonly success: boolean;\n readonly text: string;\n readonly expertType: BuiltInExpertType;\n readonly durationMs: number;\n readonly error?: string;\n /**\n * CLI that actually executed the task, resolved from the underlying\n * `CliResponse.model` via `getCliForModelId`. Undefined when the bridge\n * failed before dispatch (no adapters / circuit-open / rate-limit cap).\n * Callers writing to OutcomeStore should use this rather than hardcoding\n * a cli — see #2823 (#1154 regression).\n */\n readonly cli?: CliNameLiteral;\n /**\n * Total tokens (input + output) the underlying CLI/adapter reported for this\n * call, when available (#3396). Best-effort: `CliResponse.usage` is optional\n * — CLI-subprocess paths whose `extractUsage` returns null leave this\n * undefined. Consumers (budget enforcement #3395, model.called attribution\n * #3387, routing-experience metrics) must tolerate `undefined`.\n */\n readonly tokensUsed?: number;\n /**\n * Concrete model id the underlying adapter reported (`CliResponse.model`),\n * when present (#3387). Distinct from {@link cli} (the slot): one CLI can run\n * several models. Undefined when the adapter didn't report a model or the\n * bridge failed before dispatch. Required to emit a `model.called` event.\n */\n readonly model?: string;\n /**\n * Input/output token split from the adapter's `CliResponse.usage` (#3387),\n * when reported. Best-effort like {@link tokensUsed}; both undefined together\n * when no usage was available. `tokensIn + tokensOut` reconciles with\n * `tokensUsed` (single source of truth — both derive from the same record).\n */\n readonly tokensIn?: number;\n readonly tokensOut?: number;\n}\n\n/** Minimal router interface for the bridge. */\ninterface RouterLike {\n executeTask(task: { content: string; options?: Record<string, unknown> | undefined }): Promise<{\n ok: boolean;\n value: {\n text: string;\n cli?: CliNameLiteral;\n tokensUsed?: number;\n model?: string;\n tokensIn?: number;\n tokensOut?: number;\n };\n error: { message: string };\n }>;\n}\n\n// Cached router — lazily initialized, reused across calls within a session\nlet cachedRouter: RouterLike | null = null;\n\n// Cached MCP config — generated once, reused across expert calls (#1708)\nlet cachedMcpConfigPath: string | null = null;\n// Cached cleanup for the cached config's tempdir (closes #2946). Previously\n// the cleanup returned by `generateMcpConfig` was thrown away, so\n// `/tmp/nexus-mcp-XXXXXX/` accumulated one entry per MCP server lifetime.\n// Stored here + invoked by `shutdownExpertBridge()` from the server's\n// graceful-shutdown path.\nlet cachedMcpConfigCleanup: (() => Promise<void>) | null = null;\n// Coalesces concurrent init under voter fan-out (closes #2969). consensus_vote\n// fans out N=7 callers on cold start; without this each one ran the full init\n// including a mkdtemp() that the loser N-1 instances never cleaned up.\nlet mcpConfigInitPromise: Promise<string | null> | null = null;\n\n/** Get or create cached MCP config path for expert CLI sessions (#1708). */\nasync function getMcpConfigPath(): Promise<string | null> {\n if (cachedMcpConfigPath !== null) return cachedMcpConfigPath;\n mcpConfigInitPromise ??= (async (): Promise<string | null> => {\n try {\n const { generateMcpConfig } = await import('../cli-adapters/child-mcp-config.js');\n const config = await generateMcpConfig();\n cachedMcpConfigPath = config.configPath;\n cachedMcpConfigCleanup = config.cleanup;\n return cachedMcpConfigPath;\n } catch {\n mcpConfigInitPromise = null; // allow retry on next call\n return null; // MCP config not available — experts run without tools\n }\n })();\n return mcpConfigInitPromise;\n}\n\n/**\n * Removes the cached MCP-config tempdir (closes #2946). Invoke from the\n * server's graceful-shutdown path so stale nexus-mcp-* tempdirs (under\n * the OS tmpdir, see child-mcp-config.ts) don't accumulate across daemon\n * restarts. Idempotent; safe to call multiple times. Never throws —\n * cleanup failures are logged and swallowed.\n */\nexport async function shutdownExpertBridge(): Promise<void> {\n const cleanup = cachedMcpConfigCleanup;\n if (cleanup === null) return;\n cachedMcpConfigCleanup = null;\n cachedMcpConfigPath = null;\n mcpConfigInitPromise = null;\n try {\n await cleanup();\n } catch (error: unknown) {\n const msg = error instanceof Error ? error.message : String(error);\n logger.debug('Expert-bridge MCP-config cleanup failed', { error: msg });\n }\n}\n\n/** Cached circuit breaker for health monitoring (#1766). */\nlet cachedCircuitBreaker: {\n getHealthStatus(): {\n systemHealthy: boolean;\n healthyCount: number;\n clis: ReadonlyArray<{ name: string; healthy: boolean }>;\n };\n} | null = null;\n\n/**\n * Adapt a CompositeRouter to the narrower RouterLike interface used by this\n * bridge. Previously did `as unknown as RouterLike` which hid any structural\n * mismatch between CompositeRouter's `Result<CliResponse, CliError>` and\n * RouterLike's flat `{ ok, value: { text }, error: { message } }` shape.\n * If CliResponse renames `.text` → `.output` (or similar), this adapter\n * breaks at compile time instead of silently returning wrong data (#1921).\n */\n/**\n * Total tokens from a best-effort `CliResponse.usage` record (#3396). Prefers\n * the reported `totalTokens`; falls back to input+output; returns undefined\n * when no usage was reported (so callers can distinguish \"0 tokens\" — which\n * never happens for a real call — from \"unknown\").\n */\nexport function totalTokensFromUsage(\n usage: { totalTokens?: number; inputTokens?: number; outputTokens?: number } | undefined\n): number | undefined {\n if (usage === undefined) return undefined;\n if (typeof usage.totalTokens === 'number') return usage.totalTokens;\n const total = (usage.inputTokens ?? 0) + (usage.outputTokens ?? 0);\n return total > 0 ? total : undefined;\n}\n\n/**\n * Per-direction token split from a best-effort `CliResponse.usage` record\n * (#3387). Unlike {@link totalTokensFromUsage} this keeps `tokensIn`/`tokensOut`\n * separate — the granularity `ModelCalledEvent` requires for attribution.\n * Returns undefined when no usage was reported or both directions are zero (no\n * real call), so callers skip emitting a noise event instead of recording\n * zeros. Reconciles with the total: `tokensIn + tokensOut === totalTokensFromUsage`.\n */\nexport function tokenSplitFromUsage(\n usage: { inputTokens?: number; outputTokens?: number; totalTokens?: number } | undefined\n): { tokensIn: number; tokensOut: number } | undefined {\n if (usage === undefined) return undefined;\n const tokensIn = usage.inputTokens ?? 0;\n const tokensOut = usage.outputTokens ?? 0;\n if (tokensIn + tokensOut === 0) return undefined;\n return { tokensIn, tokensOut };\n}\n\nfunction adaptCompositeRouter(\n compositeRouter: import('../cli-adapters/composite-router.js').ICompositeRouter\n): RouterLike {\n return {\n async executeTask(task): Promise<{\n ok: boolean;\n value: {\n text: string;\n cli?: CliNameLiteral;\n tokensUsed?: number;\n model?: string;\n tokensIn?: number;\n tokensOut?: number;\n };\n error: { message: string };\n }> {\n const cliTask: import('../cli-adapters/types.js').CliTask = {\n content: task.content,\n ...(task.options !== undefined ? { options: task.options } : {}),\n };\n const result = await compositeRouter.executeTask(cliTask);\n if (result.ok) {\n // #2823: surface which CLI actually executed so callers writing to\n // OutcomeStore don't have to hardcode 'claude' (the bug #1154 fixed\n // and that regressed into the pipeline/ tree). Derive via the\n // canonical model→cli mapping in the registry — if the underlying\n // adapter didn't set `model` or the model isn't in the registry,\n // cli stays undefined and downstream code can skip the record\n // rather than lie.\n const cli = resolveCliFromModelString(result.value.model);\n // #3396: surface token usage (best-effort) so budget enforcement,\n // attribution, and routing-experience metrics get real numbers instead\n // of zeros. `usage` is optional and `totalTokens` may be absent — fall\n // back to input+output, and leave undefined when no usage was reported.\n const tokensUsed = totalTokensFromUsage(result.value.usage);\n // #3387: also surface the concrete model + per-direction token split so\n // a meaningful `model.called` event can be emitted. Both derive from the\n // same CliResponse, so tokensIn+tokensOut reconciles with tokensUsed.\n const model = result.value.model;\n const split = tokenSplitFromUsage(result.value.usage);\n return {\n ok: true,\n value: {\n text: result.value.text,\n ...(cli !== undefined && { cli }),\n ...(tokensUsed !== undefined && { tokensUsed }),\n ...(model !== undefined && { model }),\n ...(split !== undefined && { tokensIn: split.tokensIn, tokensOut: split.tokensOut }),\n },\n error: { message: '' },\n };\n }\n return { ok: false, value: { text: '' }, error: { message: result.error.message } };\n },\n };\n}\n\n// Coalesces concurrent router init the same way mcpConfigInitPromise does\n// (closes #2969). N=7 voter fan-out previously ran createAllAdapters() N times\n// — N sets of CLI probe subprocesses, all but one discarded.\nlet routerInitPromise: Promise<RouterLike | null> | null = null;\n\n/** Get or create a cached CompositeRouter with circuit breaker monitoring. */\nasync function getRouter(): Promise<RouterLike | null> {\n if (cachedRouter !== null) return cachedRouter;\n routerInitPromise ??= (async (): Promise<RouterLike | null> => {\n // ROUTER CONSTRUCTION, a distinct operation from adapter acquisition\n // (#5191, ratified 5/6). `createCompositeRouter` needs\n // `Map<RoutingArmId, ICliAdapter>`; `getGlobalRegistry()` returns\n // `IResilientAdapter` (extends `IModelAdapter`) one CLI at a time, so the\n // canonical path cannot type-check here.\n //\n // It also should not be used: the router IS the selection/failover layer,\n // so resilient-wrapped arms would nest two failover mechanisms, and the\n // shared circuit breaker would make an arm report unavailable without the\n // router ever testing it. That is the doctor-probe defect (#5209) applied\n // to routing — and this map is the LinUCB arm space, so a coupled arm\n // availability would distort exploration signals.\n //\n // Pinned by `router-operation.test.ts`.\n const { createAllAdapters } = await import('../cli-adapters/factory.js');\n const { createCompositeRouter } = await import('../cli-adapters/composite-router.js');\n const adapters = createAllAdapters();\n if (adapters.size === 0) {\n routerInitPromise = null; // allow retry once adapters become available\n return null;\n }\n cachedRouter = adaptCompositeRouter(createCompositeRouter(adapters));\n\n // Initialize circuit breaker monitoring (#1766)\n try {\n const { createCliCircuitBreakerIntegration } =\n await import('../cli-adapters/cli-circuit-breaker.js');\n cachedCircuitBreaker = createCliCircuitBreakerIntegration([...adapters.values()]);\n } catch (error: unknown) {\n // Circuit breaker not available — continue without it. Log so we can\n // notice if initialization silently stops working (#1913 Class B).\n const msg = error instanceof Error ? error.message : String(error);\n logger.debug('Circuit breaker init failed; continuing without it', { error: msg });\n }\n\n return cachedRouter;\n })();\n return routerInitPromise;\n}\n\n/** Check CLI health before dispatch (#1766). */\nfunction checkCircuitHealth(): { healthy: boolean; message: string } {\n if (cachedCircuitBreaker === null) return { healthy: true, message: '' };\n const status = cachedCircuitBreaker.getHealthStatus();\n if (!status.systemHealthy) {\n return {\n healthy: false,\n message: `All CLI circuits open (${String(status.healthyCount)}/${String(status.clis.length)} healthy)`,\n };\n }\n return { healthy: true, message: '' };\n}\n\n/** Dispatch task to router with rate limit retry (#1802). */\nasync function dispatchWithRateLimitRetry(\n router: RouterLike,\n task: { content: string; options?: Record<string, unknown> | undefined },\n expertType: BuiltInExpertType,\n start: number\n): Promise<ExpertBridgeResult> {\n const maxAttempts = 3;\n for (let attempt = 0; attempt < maxAttempts; attempt++) {\n const result = await router.executeTask(task);\n const durationMs = getTimeProvider().now() - start;\n\n if (result.ok) {\n logger.info('Expert executed successfully', {\n expertType,\n durationMs,\n cli: result.value.cli,\n });\n return {\n success: true,\n text: result.value.text,\n expertType,\n durationMs,\n ...(result.value.cli !== undefined && { cli: result.value.cli }),\n ...(result.value.tokensUsed !== undefined && { tokensUsed: result.value.tokensUsed }),\n ...(result.value.model !== undefined && { model: result.value.model }),\n ...(result.value.tokensIn !== undefined && { tokensIn: result.value.tokensIn }),\n ...(result.value.tokensOut !== undefined && { tokensOut: result.value.tokensOut }),\n };\n }\n\n const isRateLimit = isRateLimitText(result.error.message);\n if (isRateLimit && attempt < maxAttempts - 1) {\n const backoffMs = RATE_LIMIT_BASE_DELAY_MS * (attempt + 1);\n logger.warn('Expert rate limited, retrying', { expertType, attempt: attempt + 1, backoffMs });\n await new Promise((resolve) => setTimeout(resolve, backoffMs));\n continue;\n }\n\n logger.warn('Expert execution failed', { expertType, error: result.error.message });\n return { success: false, text: '', expertType, durationMs, error: result.error.message };\n }\n\n return {\n success: false,\n text: '',\n expertType,\n durationMs: getTimeProvider().now() - start,\n error: 'Max retry attempts exceeded',\n };\n}\n\n/**\n * Execute an expert task with the full nexus-agents expert pipeline.\n *\n * Creates a built-in expert, executes via CompositeRouter (for intelligent\n * CLI routing), and records outcomes. Falls back gracefully on failure.\n *\n * @param expertType - Built-in expert type (code, architecture, security, qa, etc.)\n * @param prompt - Task prompt for the expert\n * @returns Expert result with text output\n */\nexport async function executeExpert(\n expertType: BuiltInExpertType,\n prompt: string\n): Promise<ExpertBridgeResult> {\n const start = getTimeProvider().now();\n try {\n const { BUILT_IN_EXPERTS } = await import('../agents/experts/expert-config.js');\n const config = BUILT_IN_EXPERTS[expertType];\n const fullPrompt = `${config.systemPrompt}\\n\\n${prompt}`;\n\n const router = await getRouter();\n if (router === null) {\n return {\n success: false,\n text: `[No adapters] ${prompt}`,\n expertType,\n durationMs: getTimeProvider().now() - start,\n error: 'No CLI adapters available',\n };\n }\n\n // Check circuit breaker health before dispatch (#1766)\n const health = checkCircuitHealth();\n if (!health.healthy) {\n logger.warn('Circuit breaker: all CLIs unavailable', { expertType, reason: health.message });\n return {\n success: false,\n text: '',\n expertType,\n durationMs: getTimeProvider().now() - start,\n error: health.message,\n };\n }\n\n // Pass MCP config so CLI experts can call nexus-agents tools (#1708)\n const mcpConfigPath = await getMcpConfigPath();\n const task: { content: string; options?: Record<string, unknown> | undefined } = {\n content: fullPrompt,\n };\n if (mcpConfigPath !== null) task.options = { mcpConfigPath };\n\n return await dispatchWithRateLimitRetry(router, task, expertType, start);\n } catch (error) {\n const durationMs = getTimeProvider().now() - start;\n const msg = error instanceof Error ? error.message : String(error);\n logger.warn('Expert bridge error', { expertType, error: msg });\n return { success: false, text: '', expertType, durationMs, error: msg };\n }\n}\n"],"mappings":";;;;;;;;;;AA0BA,SAAS,0BAA0B,OAAuD;AACxF,SAAO,eAAe,KAAK;AAC7B;AAEA,IAAM,SAAS,aAAa,EAAE,WAAW,gBAAgB,CAAC;AAG1D,IAAM,2BAA2B;AA2DjC,IAAI,eAAkC;AAGtC,IAAI,sBAAqC;AAMzC,IAAI,yBAAuD;AAI3D,IAAI,uBAAsD;AAG1D,eAAe,mBAA2C;AACxD,MAAI,wBAAwB,KAAM,QAAO;AACzC,4BAA0B,YAAoC;AAC5D,QAAI;AACF,YAAM,EAAE,kBAAkB,IAAI,MAAM,OAAO,gCAAqC;AAChF,YAAM,SAAS,MAAM,kBAAkB;AACvC,4BAAsB,OAAO;AAC7B,+BAAyB,OAAO;AAChC,aAAO;AAAA,IACT,QAAQ;AACN,6BAAuB;AACvB,aAAO;AAAA,IACT;AAAA,EACF,GAAG;AACH,SAAO;AACT;AASA,eAAsB,uBAAsC;AAC1D,QAAM,UAAU;AAChB,MAAI,YAAY,KAAM;AACtB,2BAAyB;AACzB,wBAAsB;AACtB,yBAAuB;AACvB,MAAI;AACF,UAAM,QAAQ;AAAA,EAChB,SAAS,OAAgB;AACvB,UAAM,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AACjE,WAAO,MAAM,2CAA2C,EAAE,OAAO,IAAI,CAAC;AAAA,EACxE;AACF;AAGA,IAAI,uBAMO;AAgBJ,SAAS,qBACd,OACoB;AACpB,MAAI,UAAU,OAAW,QAAO;AAChC,MAAI,OAAO,MAAM,gBAAgB,SAAU,QAAO,MAAM;AACxD,QAAM,SAAS,MAAM,eAAe,MAAM,MAAM,gBAAgB;AAChE,SAAO,QAAQ,IAAI,QAAQ;AAC7B;AAUO,SAAS,oBACd,OACqD;AACrD,MAAI,UAAU,OAAW,QAAO;AAChC,QAAM,WAAW,MAAM,eAAe;AACtC,QAAM,YAAY,MAAM,gBAAgB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AAI,IAAI;AAAA,QACtC,OAAO;AAAA,MACT;AAAA,IACF;AAGA,UAAM,SAAS,mBAAmB;AAClC,QAAI,CAAC,OAAO,SAAS;AACnB,aAAO,KAAK,yCAAyC,EAAE,YAAY,QAAQ,OAAO,QAAQ,CAAC;AAC3F,aAAO;AAAA,QACL,SAAS;AAAA,QACT,MAAM;AAAA,QACN;AAAA,QACA,YAAY,gBAAgB,EAAE,IAAI,IAAI;AAAA,QACtC,OAAO,OAAO;AAAA,MAChB;AAAA,IACF;AAGA,UAAM,gBAAgB,MAAM,iBAAiB;AAC7C,UAAM,OAA2E;AAAA,MAC/E,SAAS;AAAA,IACX;AACA,QAAI,kBAAkB,KAAM,MAAK,UAAU,EAAE,cAAc;AAE3D,WAAO,MAAM,2BAA2B,QAAQ,MAAM,YAAY,KAAK;AAAA,EACzE,SAAS,OAAO;AACd,UAAM,aAAa,gBAAgB,EAAE,IAAI,IAAI;AAC7C,UAAM,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AACjE,WAAO,KAAK,uBAAuB,EAAE,YAAY,OAAO,IAAI,CAAC;AAC7D,WAAO,EAAE,SAAS,OAAO,MAAM,IAAI,YAAY,YAAY,OAAO,IAAI;AAAA,EACxE;AACF;","names":[]}
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  GitHubProvider,
3
3
  ScmError
4
- } from "./chunk-BA6LALHG.js";
4
+ } from "./chunk-FJPF6NUY.js";
5
5
  import {
6
6
  resolveToken
7
- } from "./chunk-LJEUEU6B.js";
7
+ } from "./chunk-Q7FAI4JO.js";
8
8
  import {
9
9
  err,
10
10
  ok
11
- } from "./chunk-P7URBNEC.js";
11
+ } from "./chunk-B5BCAZ67.js";
12
12
 
13
13
  // src/scm/factory.ts
14
14
  async function createScmProvider(config) {
@@ -41,4 +41,4 @@ export {
41
41
  createScmProvider,
42
42
  createGitHubProvider
43
43
  };
44
- //# sourceMappingURL=chunk-MPCVF44P.js.map
44
+ //# sourceMappingURL=chunk-UI5JIET2.js.map
@@ -2,7 +2,7 @@ import {
2
2
  TASK_CATEGORIES,
3
3
  getAdaptiveBonus,
4
4
  getOutcomeStore
5
- } from "./chunk-P7URBNEC.js";
5
+ } from "./chunk-B5BCAZ67.js";
6
6
 
7
7
  // src/cli/doctor-deep.ts
8
8
  var CLI_NAMES = ["claude", "gemini", "codex", "opencode"];
@@ -106,4 +106,4 @@ export {
106
106
  runDeepDiagnostics,
107
107
  formatDeepDiagnostics
108
108
  };
109
- //# sourceMappingURL=chunk-B7DESALP.js.map
109
+ //# sourceMappingURL=chunk-UYNAJJQR.js.map
@@ -5,34 +5,34 @@ import {
5
5
  planOptionalParams,
6
6
  requireApiKey,
7
7
  validateApiKeyPresence
8
- } from "./chunk-QKAGRX22.js";
8
+ } from "./chunk-P2KRXJI7.js";
9
9
  import {
10
10
  CUSTOM_API_DEFAULT_MODEL
11
- } from "./chunk-NDPUIPKN.js";
11
+ } from "./chunk-56FMLTYA.js";
12
12
  import {
13
13
  CUSTOM_API_BASE_URL_ENV,
14
14
  PROVIDER_ENV_KEYS,
15
15
  assertCustomApiHostResolvesPublic,
16
16
  validateCustomApiBaseUrl
17
- } from "./chunk-VXXA5UN7.js";
17
+ } from "./chunk-PYSJGQW3.js";
18
18
  import {
19
19
  nexusMkdtempSync
20
20
  } from "./chunk-4OW67KT2.js";
21
21
  import {
22
22
  getAvailabilityCache
23
- } from "./chunk-LHDMQAYQ.js";
23
+ } from "./chunk-2CZP5HI3.js";
24
24
  import {
25
25
  extractSystemPrompt
26
26
  } from "./chunk-QZUG667L.js";
27
27
  import {
28
28
  generateHyphenId
29
- } from "./chunk-L4BL4UHG.js";
29
+ } from "./chunk-F7YLKM2N.js";
30
30
  import {
31
31
  CliCircuitBreaker,
32
32
  DEFAULT_CIRCUIT_BREAKER_CONFIG,
33
33
  getCliCircuitBreakerSnapshot,
34
34
  getDefaultCliCircuitBreakerRegistry
35
- } from "./chunk-OWPBJIWP.js";
35
+ } from "./chunk-LWDEI43X.js";
36
36
  import {
37
37
  CLI_SUBPROCESS_TIMEOUTS,
38
38
  CLI_TIMEOUTS,
@@ -72,7 +72,7 @@ import {
72
72
  resolveCliAlias,
73
73
  resolveRetryAfterMs,
74
74
  retryAfterMsFromContext
75
- } from "./chunk-P7URBNEC.js";
75
+ } from "./chunk-B5BCAZ67.js";
76
76
 
77
77
  // src/cli-adapters/cli-to-model-adapter.ts
78
78
  var CliToModelAdapter = class {
@@ -4946,4 +4946,4 @@ export {
4946
4946
  SdkAdapter,
4947
4947
  createAutoAdapter
4948
4948
  };
4949
- //# sourceMappingURL=chunk-SJH3ZEKK.js.map
4949
+ //# sourceMappingURL=chunk-VECTXFPX.js.map
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  readOpenAICompatEnv
3
- } from "./chunk-QPGSBGG5.js";
3
+ } from "./chunk-LWDMTCTS.js";
4
4
  import {
5
5
  allOf
6
6
  } from "./chunk-OQB3XC5O.js";
7
7
  import {
8
8
  VERSION
9
- } from "./chunk-WTS6XM5S.js";
9
+ } from "./chunk-C364WBYN.js";
10
10
  import {
11
11
  capitalize
12
12
  } from "./chunk-6T3EPABN.js";
13
13
  import {
14
14
  createAllAdapters,
15
15
  probeCli
16
- } from "./chunk-SJH3ZEKK.js";
16
+ } from "./chunk-VECTXFPX.js";
17
17
  import {
18
18
  getNexusTmpDir
19
19
  } from "./chunk-4OW67KT2.js";
@@ -28,7 +28,7 @@ import {
28
28
  ok,
29
29
  symbols,
30
30
  writeLine
31
- } from "./chunk-P7URBNEC.js";
31
+ } from "./chunk-B5BCAZ67.js";
32
32
  import {
33
33
  getLearningDir,
34
34
  getOutcomesFile,
@@ -1201,13 +1201,13 @@ async function runDoctorFix(result) {
1201
1201
  writeLine2("\u2500".repeat(40));
1202
1202
  let fixCount = 0;
1203
1203
  if (!result.dataDirectory.rootExists || result.dataDirectory.subdirectories.some((d) => !d.exists || !d.writable)) {
1204
- const { initDataDirectories: initDataDirectories2, describeDataDirFix: describeDataDirFix2 } = await import("./setup-data-dir-2D6SXQHE.js");
1204
+ const { initDataDirectories: initDataDirectories2, describeDataDirFix: describeDataDirFix2 } = await import("./setup-data-dir-QH5D7IYY.js");
1205
1205
  const outcome = describeDataDirFix2(initDataDirectories2());
1206
1206
  writeLine2(outcome.line);
1207
1207
  if (outcome.counted) fixCount++;
1208
1208
  }
1209
1209
  if (!result.configFile.found) {
1210
- const { runConfigInitSync } = await import("./setup-config-YBPHQKMF.js");
1210
+ const { runConfigInitSync } = await import("./setup-config-QTUVOUZ4.js");
1211
1211
  const configResult = runConfigInitSync(process.cwd(), false, false);
1212
1212
  if (configResult.success && configResult.created) {
1213
1213
  writeLine2(`\u2713 Generated config: ${configResult.path}`);
@@ -1303,4 +1303,4 @@ export {
1303
1303
  startStdioServer,
1304
1304
  closeServer
1305
1305
  };
1306
- //# sourceMappingURL=chunk-74FMJTGV.js.map
1306
+ //# sourceMappingURL=chunk-Z7OXB43V.js.map
@@ -7,7 +7,7 @@ import {
7
7
  toolStructuredError,
8
8
  toolSuccessStructured,
9
9
  wrapToolWithTimeout
10
- } from "./chunk-5WVP7C3Z.js";
10
+ } from "./chunk-7EXGLORM.js";
11
11
  import {
12
12
  JsonlStore,
13
13
  SECURITY_KEYWORDS,
@@ -20,7 +20,7 @@ import {
20
20
  getTimeProvider,
21
21
  isDeclaredNeverDeprecate,
22
22
  isRegisteredToolName
23
- } from "./chunk-P7URBNEC.js";
23
+ } from "./chunk-B5BCAZ67.js";
24
24
  import {
25
25
  getNexusDataDir,
26
26
  nexusDataPath
@@ -2159,4 +2159,4 @@ export {
2159
2159
  runImprovementReview,
2160
2160
  registerImprovementReviewTool
2161
2161
  };
2162
- //# sourceMappingURL=chunk-SEQIGOAF.js.map
2162
+ //# sourceMappingURL=chunk-ZA5F5ESS.js.map
@@ -3,8 +3,8 @@ import {
3
3
  createCliCircuitBreakerIntegration,
4
4
  getCliCircuitBreakerSnapshot,
5
5
  getDefaultCliCircuitBreakerRegistry
6
- } from "./chunk-OWPBJIWP.js";
7
- import "./chunk-P7URBNEC.js";
6
+ } from "./chunk-LWDEI43X.js";
7
+ import "./chunk-B5BCAZ67.js";
8
8
  import "./chunk-GBHJ37V3.js";
9
9
  import "./chunk-OGHEKPLD.js";
10
10
  import "./chunk-ZPWHCABL.js";
@@ -14,4 +14,4 @@ export {
14
14
  getCliCircuitBreakerSnapshot,
15
15
  getDefaultCliCircuitBreakerRegistry
16
16
  };
17
- //# sourceMappingURL=cli-circuit-breaker-XUP4B3CR.js.map
17
+ //# sourceMappingURL=cli-circuit-breaker-DW7LLHDL.js.map
package/dist/cli.js CHANGED
@@ -19,11 +19,11 @@ import {
19
19
  parseFindings,
20
20
  reviewPostingBlock,
21
21
  sumFindings
22
- } from "./chunk-HKP47JNU.js";
23
- import "./chunk-B7DESALP.js";
22
+ } from "./chunk-L4TNK5EV.js";
23
+ import "./chunk-UYNAJJQR.js";
24
24
  import {
25
25
  runConfigInitSync
26
- } from "./chunk-CJQRCKR4.js";
26
+ } from "./chunk-62BXAKN4.js";
27
27
  import {
28
28
  AuthHandler,
29
29
  CustomExpertDefinitionSchema,
@@ -153,8 +153,8 @@ import {
153
153
  validateNexusEnv,
154
154
  validateWorkflow,
155
155
  wrapInMarkdownFence
156
- } from "./chunk-WP4ILUPM.js";
157
- import "./chunk-KUP3YM2J.js";
156
+ } from "./chunk-OIHHLQCQ.js";
157
+ import "./chunk-BBROWRNT.js";
158
158
  import "./chunk-HFOQKCD2.js";
159
159
  import "./chunk-RSMG2DPB.js";
160
160
  import {
@@ -172,14 +172,14 @@ import {
172
172
  doctorCommand,
173
173
  initDataDirectories,
174
174
  runDoctor
175
- } from "./chunk-74FMJTGV.js";
175
+ } from "./chunk-Z7OXB43V.js";
176
176
  import {
177
177
  buildOpenAICompatAdapters,
178
178
  readOpenAICompatEnv
179
- } from "./chunk-QPGSBGG5.js";
179
+ } from "./chunk-LWDMTCTS.js";
180
180
  import {
181
181
  shutdownExpertBridge
182
- } from "./chunk-V36QXMIL.js";
182
+ } from "./chunk-UDOFXNIG.js";
183
183
  import {
184
184
  ConsensusVoteInputSchema,
185
185
  DEFAULT_VOTE_TIMEOUT_MS,
@@ -191,29 +191,29 @@ import {
191
191
  recordAuthenticVote,
192
192
  registerConsensusVoteTool,
193
193
  toRecordDecision
194
- } from "./chunk-AQOUQIIO.js";
194
+ } from "./chunk-BEVDHBLV.js";
195
195
  import {
196
196
  loadUsageEvents,
197
197
  rollupByModel
198
- } from "./chunk-TCKBYC7Z.js";
198
+ } from "./chunk-5TQC5ZT3.js";
199
199
  import {
200
200
  allOf,
201
201
  anyOf
202
202
  } from "./chunk-OQB3XC5O.js";
203
203
  import {
204
204
  synthesizeResearch
205
- } from "./chunk-ZQSBNRKS.js";
205
+ } from "./chunk-76E4SZ55.js";
206
206
  import {
207
207
  classifyTrust,
208
208
  createFullGitHubProvider,
209
209
  evaluatePolicy,
210
210
  parsePRUrl
211
- } from "./chunk-WZHWX3SA.js";
212
- import "./chunk-BA6LALHG.js";
211
+ } from "./chunk-OTNFLBKH.js";
212
+ import "./chunk-FJPF6NUY.js";
213
213
  import {
214
214
  ReputationCache,
215
215
  sanitizeInput
216
- } from "./chunk-FCJN757G.js";
216
+ } from "./chunk-A337QC7T.js";
217
217
  import {
218
218
  ImprovementReviewInputSchema,
219
219
  calculateFitnessScore,
@@ -227,20 +227,20 @@ import {
227
227
  registerImprovementReviewTool,
228
228
  runImprovementReview,
229
229
  scanForSecrets
230
- } from "./chunk-SEQIGOAF.js";
230
+ } from "./chunk-ZA5F5ESS.js";
231
231
  import {
232
232
  createDefaultPolicyFirewall,
233
233
  setGlobalPolicyFirewall,
234
234
  stagePolicyFirewallForRollout
235
- } from "./chunk-5WVP7C3Z.js";
235
+ } from "./chunk-7EXGLORM.js";
236
236
  import {
237
237
  VERSION
238
- } from "./chunk-WTS6XM5S.js";
239
- import "./chunk-OYMLM23M.js";
238
+ } from "./chunk-C364WBYN.js";
239
+ import "./chunk-J2WPQTXB.js";
240
240
  import {
241
241
  createUnifiedRegistry,
242
242
  getGlobalRegistry
243
- } from "./chunk-U443FR6F.js";
243
+ } from "./chunk-2QKZC2TZ.js";
244
244
  import {
245
245
  CodebaseIndexSchema,
246
246
  PaperStatusSchema,
@@ -266,24 +266,24 @@ import {
266
266
  loadSourcesRegistry,
267
267
  rankDiscoveredItems,
268
268
  saveSourcesRegistry
269
- } from "./chunk-JVQU5EDH.js";
269
+ } from "./chunk-NGRUMP7Q.js";
270
270
  import {
271
271
  loadPapersRegistry,
272
272
  loadTechniquesRegistry,
273
273
  savePapersRegistry
274
- } from "./chunk-6JBCXRWI.js";
274
+ } from "./chunk-B7OSEC65.js";
275
275
  import {
276
276
  resolveToken
277
- } from "./chunk-LJEUEU6B.js";
277
+ } from "./chunk-Q7FAI4JO.js";
278
278
  import {
279
279
  MemoryError,
280
280
  shutdownToolMemory
281
- } from "./chunk-YAT2GTVH.js";
281
+ } from "./chunk-SMYCLSH6.js";
282
282
  import {
283
283
  capitalize,
284
284
  capitalizeKebab
285
285
  } from "./chunk-6T3EPABN.js";
286
- import "./chunk-7ANADXHH.js";
286
+ import "./chunk-CWEAD5L5.js";
287
287
  import {
288
288
  BUILT_IN_EXPERTS
289
289
  } from "./chunk-YPNQPT2F.js";
@@ -296,19 +296,19 @@ import {
296
296
  isRecord,
297
297
  probeAllClis,
298
298
  readSubprocessDepth
299
- } from "./chunk-SJH3ZEKK.js";
300
- import "./chunk-QKAGRX22.js";
299
+ } from "./chunk-VECTXFPX.js";
300
+ import "./chunk-P2KRXJI7.js";
301
301
  import {
302
302
  DEFAULTS
303
- } from "./chunk-NDPUIPKN.js";
304
- import "./chunk-VXXA5UN7.js";
303
+ } from "./chunk-56FMLTYA.js";
304
+ import "./chunk-PYSJGQW3.js";
305
305
  import {
306
306
  nexusMkdtempSync
307
307
  } from "./chunk-4OW67KT2.js";
308
- import "./chunk-LHDMQAYQ.js";
308
+ import "./chunk-2CZP5HI3.js";
309
309
  import "./chunk-QZUG667L.js";
310
- import "./chunk-L4BL4UHG.js";
311
- import "./chunk-OWPBJIWP.js";
310
+ import "./chunk-F7YLKM2N.js";
311
+ import "./chunk-LWDEI43X.js";
312
312
  import {
313
313
  API_TIMEOUTS,
314
314
  AgentCapability,
@@ -385,7 +385,7 @@ import {
385
385
  validateTimeout,
386
386
  writeEmptyLine,
387
387
  writeLine
388
- } from "./chunk-P7URBNEC.js";
388
+ } from "./chunk-B5BCAZ67.js";
389
389
  import "./chunk-GBHJ37V3.js";
390
390
  import {
391
391
  applyPortableMode,
@@ -4438,7 +4438,7 @@ ${file.patch}
4438
4438
  violations: policyResult.violations
4439
4439
  });
4440
4440
  }
4441
- const { formatReviewComment: formatReviewComment2 } = await import("./pr-reviewer-helpers-GNQAEMFV.js");
4441
+ const { formatReviewComment: formatReviewComment2 } = await import("./pr-reviewer-helpers-TZXSQZS7.js");
4442
4442
  const body = formatReviewComment2(result);
4443
4443
  const postResult = await provider.createReview(pr.prNumber, body, result.decision);
4444
4444
  if (!postResult.ok) {
@@ -19579,7 +19579,7 @@ function startImprovementReviewScheduler(options) {
19579
19579
  let running = false;
19580
19580
  const runOnce = async () => {
19581
19581
  try {
19582
- const { runImprovementReview: runImprovementReview2, ImprovementReviewInputSchema: ImprovementReviewInputSchema2 } = await import("./improvement-review-V4AQIMAI.js");
19582
+ const { runImprovementReview: runImprovementReview2, ImprovementReviewInputSchema: ImprovementReviewInputSchema2 } = await import("./improvement-review-GCW3UXQP.js");
19583
19583
  const input = ImprovementReviewInputSchema2.parse({ fileIssues });
19584
19584
  const result = await runImprovementReview2(input, { logger: logger22 });
19585
19585
  logger22.info("Scheduled improvement_review complete", {
@@ -21664,7 +21664,7 @@ function adaptConfigToLibrary(config) {
21664
21664
  }
21665
21665
  function createBeliefPromoter() {
21666
21666
  return async (event) => {
21667
- const { getToolMemory } = await import("./tool-memory-QNOIOXGA.js");
21667
+ const { getToolMemory } = await import("./tool-memory-BL6YZ7WW.js");
21668
21668
  const tm = getToolMemory();
21669
21669
  await tm.recordBelief(
21670
21670
  `skill:${event.name}`,
@@ -22885,7 +22885,7 @@ async function handleResearchCommand(args) {
22885
22885
  }
22886
22886
  }
22887
22887
  async function handleRegistryCommand(args) {
22888
- const { registryCommand, isValidRegistrySubcommand, formatRegistryUsage } = await import("./registry-command-ZSMUSV6O.js");
22888
+ const { registryCommand, isValidRegistrySubcommand, formatRegistryUsage } = await import("./registry-command-QFGRDD2U.js");
22889
22889
  const subcommand = args.subcommand;
22890
22890
  if (!isValidRegistrySubcommand(subcommand)) {
22891
22891
  process.stdout.write(`${formatRegistryUsage()}
@@ -22933,12 +22933,12 @@ async function handleVerifyCommand(args) {
22933
22933
  async function handleDoctorCommand(args) {
22934
22934
  const exitCode = await doctorCommand({ fix: args.options.fix });
22935
22935
  if (args.options.deep) {
22936
- const { runDeepDiagnostics: runDeepDiagnostics2, formatDeepDiagnostics: formatDeepDiagnostics2 } = await import("./doctor-deep-LFUNO5N5.js");
22936
+ const { runDeepDiagnostics: runDeepDiagnostics2, formatDeepDiagnostics: formatDeepDiagnostics2 } = await import("./doctor-deep-ADQSW3RD.js");
22937
22937
  const diag = runDeepDiagnostics2();
22938
22938
  process.stdout.write(formatDeepDiagnostics2(diag) + "\n");
22939
22939
  }
22940
22940
  if (args.options.live) {
22941
- const { runLiveReadiness, formatLiveReadiness } = await import("./doctor-live-PT63BVXI.js");
22941
+ const { runLiveReadiness, formatLiveReadiness } = await import("./doctor-live-LYCZPZ6R.js");
22942
22942
  const report = await runLiveReadiness();
22943
22943
  process.stdout.write(formatLiveReadiness(report) + "\n");
22944
22944
  if (report.some((r) => r.levels.serves.status === "failed")) {
@@ -22991,7 +22991,7 @@ async function runInitPortableFlow(args) {
22991
22991
  return cliExit(result.success ? EXIT_CODES.SUCCESS : EXIT_CODES.SERVER_START_FAILED);
22992
22992
  }
22993
22993
  async function runInitOpencodeFlow(args) {
22994
- const { runInitOpencode } = await import("./init-opencode-WXD57CGR.js");
22994
+ const { runInitOpencode } = await import("./init-opencode-ZF56EXKA.js");
22995
22995
  const opencodePath = args.options.opencode;
22996
22996
  if (opencodePath === void 0 || opencodePath === "") {
22997
22997
  process.stderr.write("Error: --opencode requires a path argument.\n");
@@ -23017,7 +23017,7 @@ async function runInitOpencodeFlow(args) {
23017
23017
  return cliExit(EXIT_CODES.SUCCESS);
23018
23018
  }
23019
23019
  async function renderOpencodeValidate(opencodePath) {
23020
- const { runOpencodeValidate } = await import("./init-opencode-WXD57CGR.js");
23020
+ const { runOpencodeValidate } = await import("./init-opencode-ZF56EXKA.js");
23021
23021
  const result = await runOpencodeValidate(opencodePath);
23022
23022
  if (!result.ok) {
23023
23023
  process.stderr.write(`init --opencode --validate: ${result.reason ?? "failed"}
@@ -23056,7 +23056,7 @@ async function handleSetupCommandAsync(args) {
23056
23056
  return cliExitFromStatus(exitCode);
23057
23057
  }
23058
23058
  async function runCustomApiSetup(args) {
23059
- const { configureCustomApi } = await import("./setup-custom-api-F24U4TMD.js");
23059
+ const { configureCustomApi } = await import("./setup-custom-api-FBTU6BYC.js");
23060
23060
  const baseUrl = args.options.customApi;
23061
23061
  if (baseUrl === void 0) return EXIT_CODES.SERVER_START_FAILED;
23062
23062
  const input = {