nexus-agents 2.178.1 → 3.1.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-PACKMI72.js → child-mcp-config-IGZEHG37.js} +2 -2
  2. package/dist/{chunk-VWKOCFOQ.js → chunk-25TDC2C4.js} +2 -2
  3. package/dist/{chunk-4JIVEF5J.js → chunk-2WRW3MWB.js} +3 -3
  4. package/dist/{chunk-4IOIURV4.js → chunk-344IEWHJ.js} +2 -2
  5. package/dist/{chunk-ELH4PIFM.js → chunk-43YJRZZW.js} +2 -2
  6. package/dist/{chunk-BPGEBBMI.js → chunk-47WSUCLS.js} +3 -3
  7. package/dist/{chunk-SMP4NQ6T.js → chunk-4AF6CP7P.js} +4 -4
  8. package/dist/{chunk-U5ODY6VK.js → chunk-4UN4M4NI.js} +8 -8
  9. package/dist/{chunk-ZQGTPRIM.js → chunk-A5QBZ5EC.js} +8 -8
  10. package/dist/{chunk-2UH5MVYS.js → chunk-ATNHVLKJ.js} +225 -26
  11. package/dist/chunk-ATNHVLKJ.js.map +1 -0
  12. package/dist/{chunk-XXTMXJWZ.js → chunk-D33VCEA6.js} +5 -5
  13. package/dist/{chunk-E7BIMTCD.js → chunk-E6JME6SQ.js} +2 -2
  14. package/dist/{chunk-LJ36QD7F.js → chunk-EL62KWUE.js} +7 -7
  15. package/dist/{chunk-BP662TCH.js → chunk-ENZ3IWEM.js} +2 -2
  16. package/dist/{chunk-KFEHSYLI.js → chunk-F47KBREM.js} +2 -2
  17. package/dist/{chunk-PSSNT4TL.js → chunk-FVEPECIW.js} +5 -5
  18. package/dist/{chunk-LYDBCTT4.js → chunk-GMJUXSLK.js} +5 -5
  19. package/dist/{chunk-4NESLVOU.js → chunk-GQ5LHJD2.js} +2 -2
  20. package/dist/{chunk-H2PV2ZOM.js → chunk-GTU2GK4H.js} +4 -4
  21. package/dist/{chunk-CCOPA2YX.js → chunk-HEZ6VTMO.js} +2 -2
  22. package/dist/{chunk-VFGPZ7FX.js → chunk-IMOLBA2M.js} +35 -35
  23. package/dist/{chunk-KVQD7Z3R.js → chunk-NGFG5TIB.js} +2 -2
  24. package/dist/{chunk-ZH5B2BIL.js → chunk-OKVCJFZM.js} +2 -2
  25. package/dist/{chunk-SKVPP327.js → chunk-OVAO5IMR.js} +2 -2
  26. package/dist/{chunk-BDZJVMEF.js → chunk-PQQP66XZ.js} +8 -8
  27. package/dist/{chunk-BDZJVMEF.js.map → chunk-PQQP66XZ.js.map} +1 -1
  28. package/dist/{chunk-UTWNUG3M.js → chunk-QRZPGTZN.js} +2 -2
  29. package/dist/{chunk-JZDD7Z2Z.js → chunk-QZINUMKA.js} +5 -5
  30. package/dist/{chunk-4AF6VYQ7.js → chunk-RHO52DBX.js} +2 -2
  31. package/dist/{chunk-47UPLZWW.js → chunk-T6HI32EC.js} +2 -2
  32. package/dist/{chunk-27RVYUCU.js → chunk-TIQXKIIA.js} +2 -2
  33. package/dist/{chunk-E5YASO4I.js → chunk-UBHTXZR6.js} +4 -4
  34. package/dist/{chunk-SOZYAAFS.js → chunk-VV7KSMMR.js} +3 -3
  35. package/dist/{chunk-E4PCF6Q5.js → chunk-Z2VEERCP.js} +3 -3
  36. package/dist/{chunk-RTGLOWR6.js → chunk-ZBTEOM3T.js} +2 -2
  37. package/dist/{cli-circuit-breaker-OWSE7HFZ.js → cli-circuit-breaker-FTN4E7PN.js} +3 -3
  38. package/dist/cli.js +40 -40
  39. package/dist/{composite-router-ZTARSEYG.js → composite-router-AHUNMSEQ.js} +2 -2
  40. package/dist/{consensus-vote-BEU24RCT.js → consensus-vote-ORVUPPWD.js} +16 -16
  41. package/dist/{context-retriever-ZX3CBXIC.js → context-retriever-UDERFG2L.js} +8 -8
  42. package/dist/{doctor-deep-U52LMY2R.js → doctor-deep-XZX7RNDG.js} +3 -3
  43. package/dist/{expert-bridge-GY5GGOJW.js → expert-bridge-NIYLN24L.js} +4 -4
  44. package/dist/{factory-PBHDVNU2.js → factory-2VYANO2Z.js} +5 -5
  45. package/dist/{factory-XR2UQOEH.js → factory-KDNW4GTS.js} +9 -9
  46. package/dist/{improvement-review-FPZ23HIJ.js → improvement-review-Z3BEZS73.js} +5 -5
  47. package/dist/index.d.ts +2 -8
  48. package/dist/index.js +54 -57
  49. package/dist/index.js.map +1 -1
  50. package/dist/{init-opencode-LLNCIUUF.js → init-opencode-3ENXQJKC.js} +6 -6
  51. package/dist/{issue-triage-PSHCE7RU.js → issue-triage-3YWM3P2C.js} +6 -6
  52. package/dist/{pr-reviewer-helpers-3WVNJRCK.js → pr-reviewer-helpers-CVMB2PRH.js} +4 -4
  53. package/dist/{registry-command-JNSSDYGB.js → registry-command-XPA6LFHZ.js} +2 -2
  54. package/dist/{repo-security-plan-7QYZJCGT.js → repo-security-plan-NUMTKVMR.js} +3 -3
  55. package/dist/{research-helpers-synthesize-TSIH4U7M.js → research-helpers-synthesize-EHDMCB6P.js} +4 -4
  56. package/dist/{routing-memory-PHOZF4L2.js → routing-memory-3XURCXXF.js} +2 -2
  57. package/dist/{session-memory-T5NHGNC5.js → session-memory-QISTJJOX.js} +3 -3
  58. package/dist/{setup-command-S5NZVYFW.js → setup-command-QYKLSOC6.js} +14 -14
  59. package/dist/{setup-config-2GJZNH7Z.js → setup-config-D6V7HW6W.js} +3 -3
  60. package/dist/{setup-custom-api-F6FEC2HD.js → setup-custom-api-U2EUVTPO.js} +4 -4
  61. package/dist/{tool-memory-UIWAECRB.js → tool-memory-BR7N6EB6.js} +5 -5
  62. package/dist/{unified-registry-J7NOHQ44.js → unified-registry-K4DRV5PF.js} +10 -10
  63. package/dist/{weather-report-DQANKBJK.js → weather-report-22DR27KY.js} +2 -2
  64. package/package.json +1 -1
  65. package/dist/chunk-2UH5MVYS.js.map +0 -1
  66. /package/dist/{child-mcp-config-PACKMI72.js.map → child-mcp-config-IGZEHG37.js.map} +0 -0
  67. /package/dist/{chunk-VWKOCFOQ.js.map → chunk-25TDC2C4.js.map} +0 -0
  68. /package/dist/{chunk-4JIVEF5J.js.map → chunk-2WRW3MWB.js.map} +0 -0
  69. /package/dist/{chunk-4IOIURV4.js.map → chunk-344IEWHJ.js.map} +0 -0
  70. /package/dist/{chunk-ELH4PIFM.js.map → chunk-43YJRZZW.js.map} +0 -0
  71. /package/dist/{chunk-BPGEBBMI.js.map → chunk-47WSUCLS.js.map} +0 -0
  72. /package/dist/{chunk-SMP4NQ6T.js.map → chunk-4AF6CP7P.js.map} +0 -0
  73. /package/dist/{chunk-U5ODY6VK.js.map → chunk-4UN4M4NI.js.map} +0 -0
  74. /package/dist/{chunk-ZQGTPRIM.js.map → chunk-A5QBZ5EC.js.map} +0 -0
  75. /package/dist/{chunk-XXTMXJWZ.js.map → chunk-D33VCEA6.js.map} +0 -0
  76. /package/dist/{chunk-E7BIMTCD.js.map → chunk-E6JME6SQ.js.map} +0 -0
  77. /package/dist/{chunk-LJ36QD7F.js.map → chunk-EL62KWUE.js.map} +0 -0
  78. /package/dist/{chunk-BP662TCH.js.map → chunk-ENZ3IWEM.js.map} +0 -0
  79. /package/dist/{chunk-KFEHSYLI.js.map → chunk-F47KBREM.js.map} +0 -0
  80. /package/dist/{chunk-PSSNT4TL.js.map → chunk-FVEPECIW.js.map} +0 -0
  81. /package/dist/{chunk-LYDBCTT4.js.map → chunk-GMJUXSLK.js.map} +0 -0
  82. /package/dist/{chunk-4NESLVOU.js.map → chunk-GQ5LHJD2.js.map} +0 -0
  83. /package/dist/{chunk-H2PV2ZOM.js.map → chunk-GTU2GK4H.js.map} +0 -0
  84. /package/dist/{chunk-CCOPA2YX.js.map → chunk-HEZ6VTMO.js.map} +0 -0
  85. /package/dist/{chunk-VFGPZ7FX.js.map → chunk-IMOLBA2M.js.map} +0 -0
  86. /package/dist/{chunk-KVQD7Z3R.js.map → chunk-NGFG5TIB.js.map} +0 -0
  87. /package/dist/{chunk-ZH5B2BIL.js.map → chunk-OKVCJFZM.js.map} +0 -0
  88. /package/dist/{chunk-SKVPP327.js.map → chunk-OVAO5IMR.js.map} +0 -0
  89. /package/dist/{chunk-UTWNUG3M.js.map → chunk-QRZPGTZN.js.map} +0 -0
  90. /package/dist/{chunk-JZDD7Z2Z.js.map → chunk-QZINUMKA.js.map} +0 -0
  91. /package/dist/{chunk-4AF6VYQ7.js.map → chunk-RHO52DBX.js.map} +0 -0
  92. /package/dist/{chunk-47UPLZWW.js.map → chunk-T6HI32EC.js.map} +0 -0
  93. /package/dist/{chunk-27RVYUCU.js.map → chunk-TIQXKIIA.js.map} +0 -0
  94. /package/dist/{chunk-E5YASO4I.js.map → chunk-UBHTXZR6.js.map} +0 -0
  95. /package/dist/{chunk-SOZYAAFS.js.map → chunk-VV7KSMMR.js.map} +0 -0
  96. /package/dist/{chunk-E4PCF6Q5.js.map → chunk-Z2VEERCP.js.map} +0 -0
  97. /package/dist/{chunk-RTGLOWR6.js.map → chunk-ZBTEOM3T.js.map} +0 -0
  98. /package/dist/{cli-circuit-breaker-OWSE7HFZ.js.map → cli-circuit-breaker-FTN4E7PN.js.map} +0 -0
  99. /package/dist/{composite-router-ZTARSEYG.js.map → composite-router-AHUNMSEQ.js.map} +0 -0
  100. /package/dist/{consensus-vote-BEU24RCT.js.map → consensus-vote-ORVUPPWD.js.map} +0 -0
  101. /package/dist/{context-retriever-ZX3CBXIC.js.map → context-retriever-UDERFG2L.js.map} +0 -0
  102. /package/dist/{doctor-deep-U52LMY2R.js.map → doctor-deep-XZX7RNDG.js.map} +0 -0
  103. /package/dist/{expert-bridge-GY5GGOJW.js.map → expert-bridge-NIYLN24L.js.map} +0 -0
  104. /package/dist/{factory-PBHDVNU2.js.map → factory-2VYANO2Z.js.map} +0 -0
  105. /package/dist/{factory-XR2UQOEH.js.map → factory-KDNW4GTS.js.map} +0 -0
  106. /package/dist/{improvement-review-FPZ23HIJ.js.map → improvement-review-Z3BEZS73.js.map} +0 -0
  107. /package/dist/{init-opencode-LLNCIUUF.js.map → init-opencode-3ENXQJKC.js.map} +0 -0
  108. /package/dist/{issue-triage-PSHCE7RU.js.map → issue-triage-3YWM3P2C.js.map} +0 -0
  109. /package/dist/{pr-reviewer-helpers-3WVNJRCK.js.map → pr-reviewer-helpers-CVMB2PRH.js.map} +0 -0
  110. /package/dist/{registry-command-JNSSDYGB.js.map → registry-command-XPA6LFHZ.js.map} +0 -0
  111. /package/dist/{repo-security-plan-7QYZJCGT.js.map → repo-security-plan-NUMTKVMR.js.map} +0 -0
  112. /package/dist/{research-helpers-synthesize-TSIH4U7M.js.map → research-helpers-synthesize-EHDMCB6P.js.map} +0 -0
  113. /package/dist/{routing-memory-PHOZF4L2.js.map → routing-memory-3XURCXXF.js.map} +0 -0
  114. /package/dist/{session-memory-T5NHGNC5.js.map → session-memory-QISTJJOX.js.map} +0 -0
  115. /package/dist/{setup-command-S5NZVYFW.js.map → setup-command-QYKLSOC6.js.map} +0 -0
  116. /package/dist/{setup-config-2GJZNH7Z.js.map → setup-config-D6V7HW6W.js.map} +0 -0
  117. /package/dist/{setup-custom-api-F6FEC2HD.js.map → setup-custom-api-U2EUVTPO.js.map} +0 -0
  118. /package/dist/{tool-memory-UIWAECRB.js.map → tool-memory-BR7N6EB6.js.map} +0 -0
  119. /package/dist/{unified-registry-J7NOHQ44.js.map → unified-registry-K4DRV5PF.js.map} +0 -0
  120. /package/dist/{weather-report-DQANKBJK.js.map → weather-report-22DR27KY.js.map} +0 -0
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-YAF73ZMR.js";
4
4
  import {
5
5
  createLogger
6
- } from "./chunk-2UH5MVYS.js";
6
+ } from "./chunk-ATNHVLKJ.js";
7
7
  import "./chunk-2HUC6NZN.js";
8
8
  import "./chunk-OQLFRJCW.js";
9
9
  import "./chunk-ZPWHCABL.js";
@@ -62,4 +62,4 @@ export {
62
62
  generateMcpConfig,
63
63
  getDefaultAllowedTools
64
64
  };
65
- //# sourceMappingURL=child-mcp-config-PACKMI72.js.map
65
+ //# sourceMappingURL=child-mcp-config-IGZEHG37.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getRandomProvider,
3
3
  getTimeProvider
4
- } from "./chunk-2UH5MVYS.js";
4
+ } from "./chunk-ATNHVLKJ.js";
5
5
 
6
6
  // src/utils/id-utils.ts
7
7
  import { randomUUID } from "crypto";
@@ -24,4 +24,4 @@ export {
24
24
  generateHyphenId,
25
25
  generateUUID
26
26
  };
27
- //# sourceMappingURL=chunk-VWKOCFOQ.js.map
27
+ //# sourceMappingURL=chunk-25TDC2C4.js.map
@@ -9,11 +9,11 @@ import {
9
9
  gateWithReputation,
10
10
  resolveReputationGatingMode,
11
11
  sanitizeInput
12
- } from "./chunk-27RVYUCU.js";
12
+ } from "./chunk-TIQXKIIA.js";
13
13
  import {
14
14
  createLogger,
15
15
  getTimeProvider
16
- } from "./chunk-2UH5MVYS.js";
16
+ } from "./chunk-ATNHVLKJ.js";
17
17
 
18
18
  // src/dogfooding/pr-reviewer-helpers.ts
19
19
  import { randomUUID } from "crypto";
@@ -288,4 +288,4 @@ export {
288
288
  formatReviewComment,
289
289
  createFailedReview
290
290
  };
291
- //# sourceMappingURL=chunk-4JIVEF5J.js.map
291
+ //# sourceMappingURL=chunk-2WRW3MWB.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getDefaultRegistry
3
- } from "./chunk-2UH5MVYS.js";
3
+ } from "./chunk-ATNHVLKJ.js";
4
4
  import {
5
5
  getNexusDataDir
6
6
  } from "./chunk-OQLFRJCW.js";
@@ -124,4 +124,4 @@ export {
124
124
  loadUsageEvents,
125
125
  rollupByModel
126
126
  };
127
- //# sourceMappingURL=chunk-4IOIURV4.js.map
127
+ //# sourceMappingURL=chunk-344IEWHJ.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getErrorMessage
3
- } from "./chunk-2UH5MVYS.js";
3
+ } from "./chunk-ATNHVLKJ.js";
4
4
 
5
5
  // src/cli/setup-config.ts
6
6
  import { copyFileSync, existsSync, mkdirSync, writeFileSync } from "fs";
@@ -77,4 +77,4 @@ function ensureBackup(outputPath) {
77
77
  export {
78
78
  runConfigInitSync
79
79
  };
80
- //# sourceMappingURL=chunk-ELH4PIFM.js.map
80
+ //# sourceMappingURL=chunk-43YJRZZW.js.map
@@ -7,7 +7,7 @@ import {
7
7
  toolStructuredError,
8
8
  toolSuccessStructured,
9
9
  wrapToolWithTimeout
10
- } from "./chunk-SOZYAAFS.js";
10
+ } from "./chunk-VV7KSMMR.js";
11
11
  import {
12
12
  JsonlStore,
13
13
  SECURITY_KEYWORDS,
@@ -19,7 +19,7 @@ import {
19
19
  getPipelineEventBus,
20
20
  getTimeProvider,
21
21
  isDeclaredNeverDeprecate
22
- } from "./chunk-2UH5MVYS.js";
22
+ } from "./chunk-ATNHVLKJ.js";
23
23
  import {
24
24
  getNexusDataDir,
25
25
  nexusDataPath
@@ -2132,4 +2132,4 @@ export {
2132
2132
  runImprovementReview,
2133
2133
  registerImprovementReviewTool
2134
2134
  };
2135
- //# sourceMappingURL=chunk-BPGEBBMI.js.map
2135
+ //# sourceMappingURL=chunk-47WSUCLS.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  createAutoAdapter
3
- } from "./chunk-ZQGTPRIM.js";
3
+ } from "./chunk-A5QBZ5EC.js";
4
4
  import {
5
5
  mapModelErrorToCategory
6
- } from "./chunk-ZH5B2BIL.js";
6
+ } from "./chunk-OKVCJFZM.js";
7
7
  import {
8
8
  CLI_NAMES,
9
9
  CircularBuffer,
@@ -21,7 +21,7 @@ import {
21
21
  ok,
22
22
  recordRateLimitEvent,
23
23
  toRateLimitError
24
- } from "./chunk-2UH5MVYS.js";
24
+ } from "./chunk-ATNHVLKJ.js";
25
25
 
26
26
  // src/agents/collaboration/event-bus-helpers.ts
27
27
  import { randomUUID } from "crypto";
@@ -833,4 +833,4 @@ export {
833
833
  getGlobalRegistry,
834
834
  resetGlobalRegistry
835
835
  };
836
- //# sourceMappingURL=chunk-SMP4NQ6T.js.map
836
+ //# sourceMappingURL=chunk-4AF6CP7P.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  computeCostDetail
3
- } from "./chunk-4IOIURV4.js";
3
+ } from "./chunk-344IEWHJ.js";
4
4
  import {
5
5
  DEFAULT_CONSENSUS_CONFIG,
6
6
  DEFAULT_INCREMENTAL_QUORUM_CONFIG,
@@ -18,20 +18,20 @@ import {
18
18
  toolSuccess,
19
19
  withProgressHeartbeat,
20
20
  wrapToolWithTimeout
21
- } from "./chunk-SOZYAAFS.js";
21
+ } from "./chunk-VV7KSMMR.js";
22
22
  import {
23
23
  createEvent,
24
24
  getGlobalRegistry
25
- } from "./chunk-SMP4NQ6T.js";
25
+ } from "./chunk-4AF6CP7P.js";
26
26
  import {
27
27
  getToolMemory
28
- } from "./chunk-H2PV2ZOM.js";
28
+ } from "./chunk-GTU2GK4H.js";
29
29
  import {
30
30
  authRemediation,
31
31
  delay,
32
32
  getAvailableClis,
33
33
  withTimeout
34
- } from "./chunk-ZQGTPRIM.js";
34
+ } from "./chunk-A5QBZ5EC.js";
35
35
  import {
36
36
  AgentError,
37
37
  CLI_NAMES,
@@ -60,7 +60,7 @@ import {
60
60
  resolveClassGuardMs,
61
61
  resolveModelIdentitySync,
62
62
  resolveVoteTimeout
63
- } from "./chunk-2UH5MVYS.js";
63
+ } from "./chunk-ATNHVLKJ.js";
64
64
  import {
65
65
  ensureLearningDir,
66
66
  getOutcomesFile
@@ -5939,7 +5939,7 @@ async function processVotesWithCascade(engineVotes, opts) {
5939
5939
  var CONTRARIAN_ESCALATION_THRESHOLD = 0.8;
5940
5940
  async function runContrarianCheck(proposal, log) {
5941
5941
  try {
5942
- const { executeExpert } = await import("./expert-bridge-GY5GGOJW.js");
5942
+ const { executeExpert } = await import("./expert-bridge-NIYLN24L.js");
5943
5943
  const prompt = [
5944
5944
  "You are a contrarian analyst. Your job is to find reasons this proposal should be REJECTED.",
5945
5945
  "Look for: YAGNI (not needed), MISALIGNED (wrong tech/architecture), SECURITY_RISK, SCOPE_CREEP.",
@@ -6466,4 +6466,4 @@ export {
6466
6466
  CONSENSUS_VOTE_OUTPUT_SCHEMA,
6467
6467
  registerConsensusVoteTool
6468
6468
  };
6469
- //# sourceMappingURL=chunk-U5ODY6VK.js.map
6469
+ //# sourceMappingURL=chunk-4UN4M4NI.js.map
@@ -5,34 +5,34 @@ import {
5
5
  planOptionalParams,
6
6
  requireApiKey,
7
7
  validateApiKeyPresence
8
- } from "./chunk-CCOPA2YX.js";
8
+ } from "./chunk-HEZ6VTMO.js";
9
9
  import {
10
10
  CUSTOM_API_DEFAULT_MODEL
11
- } from "./chunk-KVQD7Z3R.js";
11
+ } from "./chunk-NGFG5TIB.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-RTGLOWR6.js";
17
+ } from "./chunk-ZBTEOM3T.js";
18
18
  import {
19
19
  nexusMkdtempSync
20
20
  } from "./chunk-YAF73ZMR.js";
21
21
  import {
22
22
  getAvailabilityCache
23
- } from "./chunk-4AF6VYQ7.js";
23
+ } from "./chunk-RHO52DBX.js";
24
24
  import {
25
25
  extractSystemPrompt
26
26
  } from "./chunk-QZUG667L.js";
27
27
  import {
28
28
  generateHyphenId
29
- } from "./chunk-VWKOCFOQ.js";
29
+ } from "./chunk-25TDC2C4.js";
30
30
  import {
31
31
  CliCircuitBreaker,
32
32
  DEFAULT_CIRCUIT_BREAKER_CONFIG,
33
33
  getCliCircuitBreakerSnapshot,
34
34
  getDefaultCliCircuitBreakerRegistry
35
- } from "./chunk-ZH5B2BIL.js";
35
+ } from "./chunk-OKVCJFZM.js";
36
36
  import {
37
37
  CLI_SUBPROCESS_TIMEOUTS,
38
38
  CLI_TIMEOUTS,
@@ -69,7 +69,7 @@ import {
69
69
  ok,
70
70
  parseRetryAfterMs,
71
71
  resolveCliAlias
72
- } from "./chunk-2UH5MVYS.js";
72
+ } from "./chunk-ATNHVLKJ.js";
73
73
 
74
74
  // src/cli-adapters/cli-to-model-adapter.ts
75
75
  var CliToModelAdapter = class {
@@ -4724,4 +4724,4 @@ export {
4724
4724
  SdkAdapter,
4725
4725
  createAutoAdapter
4726
4726
  };
4727
- //# sourceMappingURL=chunk-ZQGTPRIM.js.map
4727
+ //# sourceMappingURL=chunk-A5QBZ5EC.js.map
@@ -2623,7 +2623,7 @@ function setDefaultRegistry(registry) {
2623
2623
  }
2624
2624
  async function reloadDefaultRegistry() {
2625
2625
  globalRegistry = buildDefaultRegistry();
2626
- const { resetGlobalRegistry } = await import("./unified-registry-J7NOHQ44.js");
2626
+ const { resetGlobalRegistry } = await import("./unified-registry-K4DRV5PF.js");
2627
2627
  resetGlobalRegistry();
2628
2628
  return globalRegistry;
2629
2629
  }
@@ -9120,6 +9120,172 @@ var KnnRoutingStage = class {
9120
9120
  }
9121
9121
  };
9122
9122
 
9123
+ // src/cli-adapters/routing/stages/capacity-stage.ts
9124
+ var CAPACITY_EXHAUSTED = "capacity_exhausted";
9125
+ var DEFAULT_CONFIG7 = {
9126
+ enforceHardLimits: false,
9127
+ probeTimeoutMs: 2e3
9128
+ };
9129
+ function assessCapacity(status) {
9130
+ if (!status.observed) return "unmeasured";
9131
+ if (status.exhausted || status.remainingTokens <= 0) return "exhausted";
9132
+ return "healthy";
9133
+ }
9134
+ var CapacityFilterStage = class {
9135
+ name = "capacity-filter";
9136
+ /**
9137
+ * Only consulted by `RoutingPipeline`. `CompositeRouter` hand-wires stages and
9138
+ * takes call order from the body of `composite-router-stages.ts`, so this
9139
+ * number does not position the stage there. Set adjacent to
9140
+ * `BudgetFilterStage` (20) to keep the two hard filters together.
9141
+ */
9142
+ priority = 25;
9143
+ adapters;
9144
+ config;
9145
+ logger;
9146
+ excludedCount = 0;
9147
+ unmeasuredCount = 0;
9148
+ constructor(adapters, config = {}, logger15) {
9149
+ this.adapters = adapters;
9150
+ this.config = { ...DEFAULT_CONFIG7, ...config };
9151
+ this.logger = logger15 ?? createLogger({ component: "CapacityFilterStage" });
9152
+ }
9153
+ canHandle(ctx) {
9154
+ return getRemainingCandidates(ctx).length > 0;
9155
+ }
9156
+ async route(ctx) {
9157
+ const time = getTimeProvider();
9158
+ const startTime = time.now();
9159
+ const remaining = getRemainingCandidates(ctx);
9160
+ const assessments = await this.assessAll(remaining);
9161
+ let updatedCtx = ctx;
9162
+ let exhausted = 0;
9163
+ let unmeasured = 0;
9164
+ for (const [cli, assessment] of assessments) {
9165
+ if (assessment === "unmeasured") {
9166
+ unmeasured++;
9167
+ continue;
9168
+ }
9169
+ if (assessment !== "exhausted") continue;
9170
+ exhausted++;
9171
+ if (this.config.enforceHardLimits) {
9172
+ updatedCtx = filterCandidate(
9173
+ updatedCtx,
9174
+ cli,
9175
+ `${CAPACITY_EXHAUSTED}: no capacity remaining`
9176
+ );
9177
+ this.excludedCount++;
9178
+ }
9179
+ }
9180
+ this.unmeasuredCount += unmeasured;
9181
+ const signals = this.buildSignals(ctx.signals, exhausted, unmeasured);
9182
+ const eligible = getRemainingCandidates(updatedCtx);
9183
+ const durationMs2 = time.now() - startTime;
9184
+ const finalCtx = addTrace(
9185
+ updatedCtx,
9186
+ this.name,
9187
+ durationMs2,
9188
+ "filter",
9189
+ `Eligible: ${String(eligible.length)}/${String(remaining.length)}, exhausted: ${String(exhausted)}, unmeasured: ${String(unmeasured)}`
9190
+ );
9191
+ this.logger.debug("Capacity filter complete", {
9192
+ eligible: eligible.length,
9193
+ exhausted,
9194
+ unmeasured,
9195
+ enforced: this.config.enforceHardLimits
9196
+ });
9197
+ return ok({
9198
+ context: { ...finalCtx, signals },
9199
+ continuesPipeline: eligible.length > 0
9200
+ });
9201
+ }
9202
+ getStats() {
9203
+ return { excludedCount: this.excludedCount, unmeasuredCount: this.unmeasuredCount };
9204
+ }
9205
+ /**
9206
+ * Races a capacity probe against `probeTimeoutMs`.
9207
+ *
9208
+ * `ICliAdapter.getCapacity()` carries no timeout of its own, and the router's
9209
+ * `maxDecisionTimeMs` is declared but not enforced anywhere, so without this a
9210
+ * single hanging adapter would stall every routing decision. A timed-out probe
9211
+ * rejects, which lands in the `unmeasured` branch — never `exhausted`.
9212
+ */
9213
+ async probeWithTimeout(adapter) {
9214
+ let timer;
9215
+ try {
9216
+ return await Promise.race([
9217
+ adapter.getCapacity(),
9218
+ new Promise((_, reject) => {
9219
+ timer = setTimeout(() => {
9220
+ reject(
9221
+ new Error(`capacity probe timed out after ${String(this.config.probeTimeoutMs)}ms`)
9222
+ );
9223
+ }, this.config.probeTimeoutMs);
9224
+ })
9225
+ ]);
9226
+ } finally {
9227
+ if (timer !== void 0) clearTimeout(timer);
9228
+ }
9229
+ }
9230
+ /**
9231
+ * Reads capacity for every remaining candidate concurrently.
9232
+ *
9233
+ * A candidate with no registered adapter, whose probe rejects, or whose
9234
+ * adapter does not implement `getCapacity` at all, is reported `unmeasured` —
9235
+ * never excluded. Exclusion is destructive and a failed probe is an absence of
9236
+ * evidence, not evidence of exhaustion.
9237
+ *
9238
+ * The callback is `async` deliberately. An adapter that does not implement
9239
+ * `getCapacity` makes `adapter.getCapacity()` throw a TypeError *synchronously*
9240
+ * inside `.map()`, which escapes `Promise.allSettled` entirely and would take
9241
+ * down the whole routing call — turning a partially-implemented adapter into a
9242
+ * total routing failure. An async callback converts that throw into a
9243
+ * rejection, so it lands in the `unmeasured` branch like any other bad probe.
9244
+ * `ICliAdapter` declares `getCapacity` as required, so only a structurally
9245
+ * partial adapter reaches this path — which is exactly the case that must not
9246
+ * be fatal.
9247
+ */
9248
+ async assessAll(candidates) {
9249
+ const settled = await Promise.allSettled(
9250
+ candidates.map(async (cli) => {
9251
+ const adapter = this.adapters.get(cli);
9252
+ if (adapter === void 0) throw new Error("no adapter registered");
9253
+ return this.probeWithTimeout(adapter);
9254
+ })
9255
+ );
9256
+ const result = /* @__PURE__ */ new Map();
9257
+ for (const [idx, cli] of candidates.entries()) {
9258
+ const outcome = settled[idx];
9259
+ if (outcome?.status === "fulfilled") {
9260
+ result.set(cli, assessCapacity(outcome.value));
9261
+ } else {
9262
+ this.logger.debug("Capacity probe unavailable \u2014 not excluding", { cli });
9263
+ result.set(cli, "unmeasured");
9264
+ }
9265
+ }
9266
+ return result;
9267
+ }
9268
+ /**
9269
+ * Emits counts for both exhausted and unmeasured candidates.
9270
+ *
9271
+ * `capacity:unmeasured-N` lets a downstream consumer tell a genuinely healthy
9272
+ * panel from one nobody has measured. It is emitted only when the count is
9273
+ * non-zero — its *absence* therefore means every candidate was measured, which
9274
+ * is the distinction that matters. (An earlier version of this comment claimed
9275
+ * the signal was emitted at zero too; it never was.)
9276
+ */
9277
+ buildSignals(existing, exhausted, unmeasured) {
9278
+ const signals = [...existing];
9279
+ if (exhausted > 0) {
9280
+ signals.push(`${CAPACITY_EXHAUSTED}:${String(exhausted)}`);
9281
+ }
9282
+ if (unmeasured > 0) {
9283
+ signals.push(`capacity:unmeasured-${String(unmeasured)}`);
9284
+ }
9285
+ return signals;
9286
+ }
9287
+ };
9288
+
9123
9289
  // src/learning/strategy-distiller-types.ts
9124
9290
  var DEFAULT_DISTILLER_CONFIG = {
9125
9291
  triggerThreshold: 50,
@@ -10182,7 +10348,17 @@ var CompositeRouterConfigSchema = z12.object({
10182
10348
  linucbAlpha: z12.number().positive().default(1),
10183
10349
  /** Billing mode: 'plan' zeroes cost weight, 'api' preserves current behavior (default: 'plan') */
10184
10350
  billingMode: z12.enum(["plan", "api"]).default("plan"),
10185
- /** Enable capacity-aware load balancing (deprioritize exhausted CLIs) (default: true) (Issue #807) */
10351
+ /**
10352
+ * Enable capacity-aware routing exclusion — remove a candidate whose adapter
10353
+ * reports *measurably* exhausted capacity (default: true) (#807, #4373).
10354
+ *
10355
+ * Declared for #807 but never read by any stage until #4373: for its whole
10356
+ * life this flag defaulted to `true` while promising a behaviour that did not
10357
+ * exist. It is reused rather than replaced by a new flag so there is one
10358
+ * canonical switch for the concern. The wording changed from "deprioritize"
10359
+ * to "exclude" to match #4351 criterion 3; nothing can depend on the former,
10360
+ * since no deprioritization was ever implemented.
10361
+ */
10186
10362
  enableCapacityBalancing: z12.boolean().default(true),
10187
10363
  /** Maximum routing decision time in ms (default: 50) */
10188
10364
  maxDecisionTimeMs: z12.number().positive().default(50),
@@ -10458,18 +10634,6 @@ function buildPreferenceStats(enablePreferenceRouting, preferenceRouter) {
10458
10634
  strongModelPreferenceRate: stats.strongModelPreferenceRate
10459
10635
  };
10460
10636
  }
10461
- async function fetchCapacityData(adapters) {
10462
- const result = /* @__PURE__ */ new Map();
10463
- const entries = [...adapters];
10464
- const settled = await Promise.allSettled(entries.map(([, a]) => a.getCapacity()));
10465
- for (const [idx, entry] of entries.entries()) {
10466
- const outcome = settled[idx];
10467
- if (outcome?.status === "fulfilled") {
10468
- result.set(entry[0], outcome.value);
10469
- }
10470
- }
10471
- return result;
10472
- }
10473
10637
 
10474
10638
  // src/config/defaults-env.ts
10475
10639
  function parseIntEnv(envKey, fallback) {
@@ -10749,7 +10913,7 @@ function containsPromotionKeyword(text) {
10749
10913
  }
10750
10914
 
10751
10915
  // src/mcp/gateway/tier-recommender.ts
10752
- var DEFAULT_CONFIG7 = {
10916
+ var DEFAULT_CONFIG8 = {
10753
10917
  minSamples: 20,
10754
10918
  promoteFailureRate: 0.3,
10755
10919
  demoteSuccessRate: 0.95,
@@ -10775,7 +10939,7 @@ function getCategoryTier(category) {
10775
10939
  return 2 /* ANALYZED */;
10776
10940
  }
10777
10941
  function generateTierRecommendations(summary, config) {
10778
- const cfg = { ...DEFAULT_CONFIG7, ...config };
10942
+ const cfg = { ...DEFAULT_CONFIG8, ...config };
10779
10943
  const recommendations = [];
10780
10944
  for (const [category, stats] of summary.byCategory) {
10781
10945
  const rec = evaluateCategory(category, stats, cfg);
@@ -13049,6 +13213,39 @@ function runBudgetStage(task, candidates, stagesExecuted, deps) {
13049
13213
  }
13050
13214
  return ok({ candidates: result.eligible, withinBudget: result.withinBudget });
13051
13215
  }
13216
+ async function runCapacityStage(task, candidates, stagesExecuted, deps) {
13217
+ if (!deps.config.enableCapacityBalancing || deps.capacityFilterStage === void 0) {
13218
+ return ok(candidates);
13219
+ }
13220
+ const ctx = createRoutingContext(task.content, armsToSlots(candidates));
13221
+ stagesExecuted.push("capacity-filter");
13222
+ let result;
13223
+ try {
13224
+ result = await deps.capacityFilterStage.route(ctx);
13225
+ } catch (error) {
13226
+ deps.logger.debug("Capacity stage threw - keeping all candidates", {
13227
+ error: error instanceof Error ? error.message : String(error)
13228
+ });
13229
+ return ok(candidates);
13230
+ }
13231
+ if (!result.ok) {
13232
+ deps.logger.debug("Capacity stage failed - keeping all candidates", {
13233
+ error: result.error.message
13234
+ });
13235
+ return ok(candidates);
13236
+ }
13237
+ const eligible = keepArmsForSlots(candidates, getRemainingCandidates(result.value.context));
13238
+ if (eligible.length === 0) {
13239
+ const reasons = [...result.value.context.filtered.entries()].map(([cli, reason]) => `${cli} (${reason})`).join(", ");
13240
+ return err(
13241
+ new CompositeRoutingError(
13242
+ `All routing candidates excluded \u2014 ${CAPACITY_EXHAUSTED}. Excluded: ${reasons}`,
13243
+ "capacity-filter"
13244
+ )
13245
+ );
13246
+ }
13247
+ return ok(eligible);
13248
+ }
13052
13249
  var DEFAULT_COMPLEXITY = "moderate";
13053
13250
  function extractComplexityFromSignals(signals) {
13054
13251
  for (const s of signals) {
@@ -13480,6 +13677,9 @@ async function runPipeline(task, taskProfile, stagesExecuted, cliNames, deps) {
13480
13677
  if (!budgetResult.ok) return budgetResult;
13481
13678
  candidates = budgetResult.value.candidates;
13482
13679
  const withinBudget = budgetResult.value.withinBudget;
13680
+ const capacityResult = await runCapacityStage(task, candidates, stagesExecuted, deps);
13681
+ if (!capacityResult.ok) return capacityResult;
13682
+ candidates = capacityResult.value;
13483
13683
  const scoring = await runScoringStages(task, candidates, stagesExecuted, deps);
13484
13684
  candidates = scoring.candidates;
13485
13685
  const constrained = await applyQualityConstraints(candidates, stagesExecuted, deps);
@@ -14204,6 +14404,8 @@ var CompositeRouter = class _CompositeRouter {
14204
14404
  qualityConstraintStage;
14205
14405
  /** Resource strategy stage instance (Issue #998) */
14206
14406
  resourceStrategyStage;
14407
+ /** Capacity filter stage instance (#4373, #4351 criterion 3) */
14408
+ capacityFilterStage;
14207
14409
  /** Distilled rule stage instance (Issue #999) */
14208
14410
  distilledRuleStage;
14209
14411
  /** KNN routing stage instance (arXiv:2505.12601) */
@@ -14329,6 +14531,9 @@ var CompositeRouter = class _CompositeRouter {
14329
14531
  if (this.config.enableResourceStrategy) {
14330
14532
  this.resourceStrategyStage = new ResourceStrategyStage(stageConfigs.resourceStrategy);
14331
14533
  }
14534
+ if (this.config.enableCapacityBalancing) {
14535
+ this.capacityFilterStage = new CapacityFilterStage(this.adapters, {}, this.logger);
14536
+ }
14332
14537
  if (this.config.enableStrategyDistillation) {
14333
14538
  this.strategyDistiller = isPersistenceEnabled() ? createPersistentDistillerOrFallback(getOutcomeStore(), this.logger) : new StrategyDistiller(getOutcomeStore(), this.logger);
14334
14539
  this.distilledRuleStage = new DistilledRuleStage(
@@ -14422,7 +14627,7 @@ var CompositeRouter = class _CompositeRouter {
14422
14627
  */
14423
14628
  async consultUnifiedContext(task) {
14424
14629
  try {
14425
- const { getContextForTask, inferTaskCategory } = await import("./context-retriever-ZX3CBXIC.js");
14630
+ const { getContextForTask, inferTaskCategory } = await import("./context-retriever-UDERFG2L.js");
14426
14631
  const ctx = await getContextForTask({
14427
14632
  task: task.content,
14428
14633
  category: inferTaskCategory(task.content),
@@ -14626,6 +14831,8 @@ var CompositeRouter = class _CompositeRouter {
14626
14831
  qualityConstraintStage: this.qualityConstraintStage,
14627
14832
  // Issue #998 resource strategy
14628
14833
  resourceStrategyStage: this.resourceStrategyStage,
14834
+ // #4373 capacity exclusion
14835
+ capacityFilterStage: this.capacityFilterStage,
14629
14836
  // Issue #999 distilled rule stage
14630
14837
  distilledRuleStage: this.distilledRuleStage,
14631
14838
  // arXiv:2505.12601 KNN routing
@@ -14830,14 +15037,6 @@ var CompositeRouter = class _CompositeRouter {
14830
15037
  getOrchestrationObserver() {
14831
15038
  return this.orchestrationObserver;
14832
15039
  }
14833
- /**
14834
- * Get capacity status for all registered routing arms — CLI slots plus any
14835
- * `api:*` arms (Issue #807, #3422). Matches the `ITaskRouter` interface doc;
14836
- * the return key is `RoutingArmId` (`CliName | ApiArmId`), not just CLIs.
14837
- */
14838
- async getCapacityDashboard() {
14839
- return fetchCapacityData(this.adapters);
14840
- }
14841
15040
  getStats() {
14842
15041
  const preferenceStats = buildPreferenceStats(
14843
15042
  this.config.enablePreferenceRouting,
@@ -16012,4 +16211,4 @@ export {
16012
16211
  AgentCapability,
16013
16212
  OrchestratorError
16014
16213
  };
16015
- //# sourceMappingURL=chunk-2UH5MVYS.js.map
16214
+ //# sourceMappingURL=chunk-ATNHVLKJ.js.map