nexus-agents 3.0.0 → 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 (119) hide show
  1. package/dist/{child-mcp-config-ZW5PFQEJ.js → child-mcp-config-IGZEHG37.js} +2 -2
  2. package/dist/{chunk-BFDUELKY.js → chunk-25TDC2C4.js} +2 -2
  3. package/dist/{chunk-IKFUFHEG.js → chunk-2WRW3MWB.js} +3 -3
  4. package/dist/{chunk-7T5LHZLI.js → chunk-344IEWHJ.js} +2 -2
  5. package/dist/{chunk-KDZCQPLH.js → chunk-43YJRZZW.js} +2 -2
  6. package/dist/{chunk-HHV6DOS4.js → chunk-47WSUCLS.js} +3 -3
  7. package/dist/{chunk-4LLIXFC2.js → chunk-4AF6CP7P.js} +4 -4
  8. package/dist/{chunk-DYIDH4YE.js → chunk-4UN4M4NI.js} +8 -8
  9. package/dist/{chunk-NO6GYQAS.js → chunk-A5QBZ5EC.js} +8 -8
  10. package/dist/{chunk-UU6NLFCT.js → chunk-ATNHVLKJ.js} +225 -6
  11. package/dist/chunk-ATNHVLKJ.js.map +1 -0
  12. package/dist/{chunk-NNYEQJGE.js → chunk-D33VCEA6.js} +5 -5
  13. package/dist/{chunk-6H7U2JU4.js → chunk-E6JME6SQ.js} +2 -2
  14. package/dist/{chunk-D3SA4NDV.js → chunk-EL62KWUE.js} +7 -7
  15. package/dist/{chunk-3JH24XIY.js → chunk-ENZ3IWEM.js} +2 -2
  16. package/dist/{chunk-2J4J5QKD.js → chunk-F47KBREM.js} +2 -2
  17. package/dist/{chunk-6ZFBEINO.js → chunk-FVEPECIW.js} +5 -5
  18. package/dist/{chunk-XOA7Y63G.js → chunk-GMJUXSLK.js} +5 -5
  19. package/dist/{chunk-6BQNRHIH.js → chunk-GQ5LHJD2.js} +2 -2
  20. package/dist/{chunk-4QAYK6FB.js → chunk-GTU2GK4H.js} +4 -4
  21. package/dist/{chunk-MCICMFFK.js → chunk-HEZ6VTMO.js} +2 -2
  22. package/dist/{chunk-2UKQZKVD.js → chunk-IMOLBA2M.js} +35 -35
  23. package/dist/{chunk-MHGARBUZ.js → chunk-NGFG5TIB.js} +2 -2
  24. package/dist/{chunk-JKGYQG6V.js → chunk-OKVCJFZM.js} +2 -2
  25. package/dist/{chunk-IEJUO5RB.js → chunk-OVAO5IMR.js} +2 -2
  26. package/dist/{chunk-HEQSO64K.js → chunk-PQQP66XZ.js} +8 -8
  27. package/dist/{chunk-V55IINXG.js → chunk-QRZPGTZN.js} +2 -2
  28. package/dist/{chunk-SVTHQ7DA.js → chunk-QZINUMKA.js} +5 -5
  29. package/dist/{chunk-JHJV7CYZ.js → chunk-RHO52DBX.js} +2 -2
  30. package/dist/{chunk-KAP2ANOE.js → chunk-T6HI32EC.js} +2 -2
  31. package/dist/{chunk-WSNUM6MS.js → chunk-TIQXKIIA.js} +2 -2
  32. package/dist/{chunk-7YGC7EHO.js → chunk-UBHTXZR6.js} +4 -4
  33. package/dist/{chunk-3VRG7I7N.js → chunk-VV7KSMMR.js} +3 -3
  34. package/dist/{chunk-6A33GEM2.js → chunk-Z2VEERCP.js} +3 -3
  35. package/dist/{chunk-54MDYWNI.js → chunk-ZBTEOM3T.js} +2 -2
  36. package/dist/{cli-circuit-breaker-HLZ72N2A.js → cli-circuit-breaker-FTN4E7PN.js} +3 -3
  37. package/dist/cli.js +40 -40
  38. package/dist/{composite-router-KM4TDC75.js → composite-router-AHUNMSEQ.js} +2 -2
  39. package/dist/{consensus-vote-VFOLUM6M.js → consensus-vote-ORVUPPWD.js} +16 -16
  40. package/dist/{context-retriever-ZVFRYEDL.js → context-retriever-UDERFG2L.js} +8 -8
  41. package/dist/{doctor-deep-ZERKQVLV.js → doctor-deep-XZX7RNDG.js} +3 -3
  42. package/dist/{expert-bridge-MMBE2ZPR.js → expert-bridge-NIYLN24L.js} +4 -4
  43. package/dist/{factory-VIB7NIV2.js → factory-2VYANO2Z.js} +5 -5
  44. package/dist/{factory-7EMZS6OF.js → factory-KDNW4GTS.js} +9 -9
  45. package/dist/{improvement-review-ABUGIKOC.js → improvement-review-Z3BEZS73.js} +5 -5
  46. package/dist/index.d.ts +2 -0
  47. package/dist/index.js +30 -30
  48. package/dist/{init-opencode-GETRPKA4.js → init-opencode-3ENXQJKC.js} +6 -6
  49. package/dist/{issue-triage-O6Z2CTJM.js → issue-triage-3YWM3P2C.js} +6 -6
  50. package/dist/{pr-reviewer-helpers-DRQXZBDH.js → pr-reviewer-helpers-CVMB2PRH.js} +4 -4
  51. package/dist/{registry-command-YAIEP7WM.js → registry-command-XPA6LFHZ.js} +2 -2
  52. package/dist/{repo-security-plan-4BYFJZUQ.js → repo-security-plan-NUMTKVMR.js} +3 -3
  53. package/dist/{research-helpers-synthesize-O3UTWKGT.js → research-helpers-synthesize-EHDMCB6P.js} +4 -4
  54. package/dist/{routing-memory-GFCQT2FW.js → routing-memory-3XURCXXF.js} +2 -2
  55. package/dist/{session-memory-Y7WMBRAR.js → session-memory-QISTJJOX.js} +3 -3
  56. package/dist/{setup-command-XUVMMHPF.js → setup-command-QYKLSOC6.js} +14 -14
  57. package/dist/{setup-config-2ABBUEG6.js → setup-config-D6V7HW6W.js} +3 -3
  58. package/dist/{setup-custom-api-GNWOBZ4I.js → setup-custom-api-U2EUVTPO.js} +4 -4
  59. package/dist/{tool-memory-MCPXNF6X.js → tool-memory-BR7N6EB6.js} +5 -5
  60. package/dist/{unified-registry-6YQEVB6A.js → unified-registry-K4DRV5PF.js} +10 -10
  61. package/dist/{weather-report-3EDM3NPV.js → weather-report-22DR27KY.js} +2 -2
  62. package/package.json +1 -1
  63. package/dist/chunk-UU6NLFCT.js.map +0 -1
  64. /package/dist/{child-mcp-config-ZW5PFQEJ.js.map → child-mcp-config-IGZEHG37.js.map} +0 -0
  65. /package/dist/{chunk-BFDUELKY.js.map → chunk-25TDC2C4.js.map} +0 -0
  66. /package/dist/{chunk-IKFUFHEG.js.map → chunk-2WRW3MWB.js.map} +0 -0
  67. /package/dist/{chunk-7T5LHZLI.js.map → chunk-344IEWHJ.js.map} +0 -0
  68. /package/dist/{chunk-KDZCQPLH.js.map → chunk-43YJRZZW.js.map} +0 -0
  69. /package/dist/{chunk-HHV6DOS4.js.map → chunk-47WSUCLS.js.map} +0 -0
  70. /package/dist/{chunk-4LLIXFC2.js.map → chunk-4AF6CP7P.js.map} +0 -0
  71. /package/dist/{chunk-DYIDH4YE.js.map → chunk-4UN4M4NI.js.map} +0 -0
  72. /package/dist/{chunk-NO6GYQAS.js.map → chunk-A5QBZ5EC.js.map} +0 -0
  73. /package/dist/{chunk-NNYEQJGE.js.map → chunk-D33VCEA6.js.map} +0 -0
  74. /package/dist/{chunk-6H7U2JU4.js.map → chunk-E6JME6SQ.js.map} +0 -0
  75. /package/dist/{chunk-D3SA4NDV.js.map → chunk-EL62KWUE.js.map} +0 -0
  76. /package/dist/{chunk-3JH24XIY.js.map → chunk-ENZ3IWEM.js.map} +0 -0
  77. /package/dist/{chunk-2J4J5QKD.js.map → chunk-F47KBREM.js.map} +0 -0
  78. /package/dist/{chunk-6ZFBEINO.js.map → chunk-FVEPECIW.js.map} +0 -0
  79. /package/dist/{chunk-XOA7Y63G.js.map → chunk-GMJUXSLK.js.map} +0 -0
  80. /package/dist/{chunk-6BQNRHIH.js.map → chunk-GQ5LHJD2.js.map} +0 -0
  81. /package/dist/{chunk-4QAYK6FB.js.map → chunk-GTU2GK4H.js.map} +0 -0
  82. /package/dist/{chunk-MCICMFFK.js.map → chunk-HEZ6VTMO.js.map} +0 -0
  83. /package/dist/{chunk-2UKQZKVD.js.map → chunk-IMOLBA2M.js.map} +0 -0
  84. /package/dist/{chunk-MHGARBUZ.js.map → chunk-NGFG5TIB.js.map} +0 -0
  85. /package/dist/{chunk-JKGYQG6V.js.map → chunk-OKVCJFZM.js.map} +0 -0
  86. /package/dist/{chunk-IEJUO5RB.js.map → chunk-OVAO5IMR.js.map} +0 -0
  87. /package/dist/{chunk-HEQSO64K.js.map → chunk-PQQP66XZ.js.map} +0 -0
  88. /package/dist/{chunk-V55IINXG.js.map → chunk-QRZPGTZN.js.map} +0 -0
  89. /package/dist/{chunk-SVTHQ7DA.js.map → chunk-QZINUMKA.js.map} +0 -0
  90. /package/dist/{chunk-JHJV7CYZ.js.map → chunk-RHO52DBX.js.map} +0 -0
  91. /package/dist/{chunk-KAP2ANOE.js.map → chunk-T6HI32EC.js.map} +0 -0
  92. /package/dist/{chunk-WSNUM6MS.js.map → chunk-TIQXKIIA.js.map} +0 -0
  93. /package/dist/{chunk-7YGC7EHO.js.map → chunk-UBHTXZR6.js.map} +0 -0
  94. /package/dist/{chunk-3VRG7I7N.js.map → chunk-VV7KSMMR.js.map} +0 -0
  95. /package/dist/{chunk-6A33GEM2.js.map → chunk-Z2VEERCP.js.map} +0 -0
  96. /package/dist/{chunk-54MDYWNI.js.map → chunk-ZBTEOM3T.js.map} +0 -0
  97. /package/dist/{cli-circuit-breaker-HLZ72N2A.js.map → cli-circuit-breaker-FTN4E7PN.js.map} +0 -0
  98. /package/dist/{composite-router-KM4TDC75.js.map → composite-router-AHUNMSEQ.js.map} +0 -0
  99. /package/dist/{consensus-vote-VFOLUM6M.js.map → consensus-vote-ORVUPPWD.js.map} +0 -0
  100. /package/dist/{context-retriever-ZVFRYEDL.js.map → context-retriever-UDERFG2L.js.map} +0 -0
  101. /package/dist/{doctor-deep-ZERKQVLV.js.map → doctor-deep-XZX7RNDG.js.map} +0 -0
  102. /package/dist/{expert-bridge-MMBE2ZPR.js.map → expert-bridge-NIYLN24L.js.map} +0 -0
  103. /package/dist/{factory-7EMZS6OF.js.map → factory-2VYANO2Z.js.map} +0 -0
  104. /package/dist/{factory-VIB7NIV2.js.map → factory-KDNW4GTS.js.map} +0 -0
  105. /package/dist/{improvement-review-ABUGIKOC.js.map → improvement-review-Z3BEZS73.js.map} +0 -0
  106. /package/dist/{init-opencode-GETRPKA4.js.map → init-opencode-3ENXQJKC.js.map} +0 -0
  107. /package/dist/{issue-triage-O6Z2CTJM.js.map → issue-triage-3YWM3P2C.js.map} +0 -0
  108. /package/dist/{pr-reviewer-helpers-DRQXZBDH.js.map → pr-reviewer-helpers-CVMB2PRH.js.map} +0 -0
  109. /package/dist/{registry-command-YAIEP7WM.js.map → registry-command-XPA6LFHZ.js.map} +0 -0
  110. /package/dist/{repo-security-plan-4BYFJZUQ.js.map → repo-security-plan-NUMTKVMR.js.map} +0 -0
  111. /package/dist/{research-helpers-synthesize-O3UTWKGT.js.map → research-helpers-synthesize-EHDMCB6P.js.map} +0 -0
  112. /package/dist/{routing-memory-GFCQT2FW.js.map → routing-memory-3XURCXXF.js.map} +0 -0
  113. /package/dist/{session-memory-Y7WMBRAR.js.map → session-memory-QISTJJOX.js.map} +0 -0
  114. /package/dist/{setup-command-XUVMMHPF.js.map → setup-command-QYKLSOC6.js.map} +0 -0
  115. /package/dist/{setup-config-2ABBUEG6.js.map → setup-config-D6V7HW6W.js.map} +0 -0
  116. /package/dist/{setup-custom-api-GNWOBZ4I.js.map → setup-custom-api-U2EUVTPO.js.map} +0 -0
  117. /package/dist/{tool-memory-MCPXNF6X.js.map → tool-memory-BR7N6EB6.js.map} +0 -0
  118. /package/dist/{unified-registry-6YQEVB6A.js.map → unified-registry-K4DRV5PF.js.map} +0 -0
  119. /package/dist/{weather-report-3EDM3NPV.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-UU6NLFCT.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-ZW5PFQEJ.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-UU6NLFCT.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-BFDUELKY.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-WSNUM6MS.js";
12
+ } from "./chunk-TIQXKIIA.js";
13
13
  import {
14
14
  createLogger,
15
15
  getTimeProvider
16
- } from "./chunk-UU6NLFCT.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-IKFUFHEG.js.map
291
+ //# sourceMappingURL=chunk-2WRW3MWB.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getDefaultRegistry
3
- } from "./chunk-UU6NLFCT.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-7T5LHZLI.js.map
127
+ //# sourceMappingURL=chunk-344IEWHJ.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getErrorMessage
3
- } from "./chunk-UU6NLFCT.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-KDZCQPLH.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-3VRG7I7N.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-UU6NLFCT.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-HHV6DOS4.js.map
2135
+ //# sourceMappingURL=chunk-47WSUCLS.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  createAutoAdapter
3
- } from "./chunk-NO6GYQAS.js";
3
+ } from "./chunk-A5QBZ5EC.js";
4
4
  import {
5
5
  mapModelErrorToCategory
6
- } from "./chunk-JKGYQG6V.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-UU6NLFCT.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-4LLIXFC2.js.map
836
+ //# sourceMappingURL=chunk-4AF6CP7P.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  computeCostDetail
3
- } from "./chunk-7T5LHZLI.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-3VRG7I7N.js";
21
+ } from "./chunk-VV7KSMMR.js";
22
22
  import {
23
23
  createEvent,
24
24
  getGlobalRegistry
25
- } from "./chunk-4LLIXFC2.js";
25
+ } from "./chunk-4AF6CP7P.js";
26
26
  import {
27
27
  getToolMemory
28
- } from "./chunk-4QAYK6FB.js";
28
+ } from "./chunk-GTU2GK4H.js";
29
29
  import {
30
30
  authRemediation,
31
31
  delay,
32
32
  getAvailableClis,
33
33
  withTimeout
34
- } from "./chunk-NO6GYQAS.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-UU6NLFCT.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-MMBE2ZPR.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-DYIDH4YE.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-MCICMFFK.js";
8
+ } from "./chunk-HEZ6VTMO.js";
9
9
  import {
10
10
  CUSTOM_API_DEFAULT_MODEL
11
- } from "./chunk-MHGARBUZ.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-54MDYWNI.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-JHJV7CYZ.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-BFDUELKY.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-JKGYQG6V.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-UU6NLFCT.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-NO6GYQAS.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-6YQEVB6A.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),
@@ -10737,7 +10913,7 @@ function containsPromotionKeyword(text) {
10737
10913
  }
10738
10914
 
10739
10915
  // src/mcp/gateway/tier-recommender.ts
10740
- var DEFAULT_CONFIG7 = {
10916
+ var DEFAULT_CONFIG8 = {
10741
10917
  minSamples: 20,
10742
10918
  promoteFailureRate: 0.3,
10743
10919
  demoteSuccessRate: 0.95,
@@ -10763,7 +10939,7 @@ function getCategoryTier(category) {
10763
10939
  return 2 /* ANALYZED */;
10764
10940
  }
10765
10941
  function generateTierRecommendations(summary, config) {
10766
- const cfg = { ...DEFAULT_CONFIG7, ...config };
10942
+ const cfg = { ...DEFAULT_CONFIG8, ...config };
10767
10943
  const recommendations = [];
10768
10944
  for (const [category, stats] of summary.byCategory) {
10769
10945
  const rec = evaluateCategory(category, stats, cfg);
@@ -13037,6 +13213,39 @@ function runBudgetStage(task, candidates, stagesExecuted, deps) {
13037
13213
  }
13038
13214
  return ok({ candidates: result.eligible, withinBudget: result.withinBudget });
13039
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
+ }
13040
13249
  var DEFAULT_COMPLEXITY = "moderate";
13041
13250
  function extractComplexityFromSignals(signals) {
13042
13251
  for (const s of signals) {
@@ -13468,6 +13677,9 @@ async function runPipeline(task, taskProfile, stagesExecuted, cliNames, deps) {
13468
13677
  if (!budgetResult.ok) return budgetResult;
13469
13678
  candidates = budgetResult.value.candidates;
13470
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;
13471
13683
  const scoring = await runScoringStages(task, candidates, stagesExecuted, deps);
13472
13684
  candidates = scoring.candidates;
13473
13685
  const constrained = await applyQualityConstraints(candidates, stagesExecuted, deps);
@@ -14192,6 +14404,8 @@ var CompositeRouter = class _CompositeRouter {
14192
14404
  qualityConstraintStage;
14193
14405
  /** Resource strategy stage instance (Issue #998) */
14194
14406
  resourceStrategyStage;
14407
+ /** Capacity filter stage instance (#4373, #4351 criterion 3) */
14408
+ capacityFilterStage;
14195
14409
  /** Distilled rule stage instance (Issue #999) */
14196
14410
  distilledRuleStage;
14197
14411
  /** KNN routing stage instance (arXiv:2505.12601) */
@@ -14317,6 +14531,9 @@ var CompositeRouter = class _CompositeRouter {
14317
14531
  if (this.config.enableResourceStrategy) {
14318
14532
  this.resourceStrategyStage = new ResourceStrategyStage(stageConfigs.resourceStrategy);
14319
14533
  }
14534
+ if (this.config.enableCapacityBalancing) {
14535
+ this.capacityFilterStage = new CapacityFilterStage(this.adapters, {}, this.logger);
14536
+ }
14320
14537
  if (this.config.enableStrategyDistillation) {
14321
14538
  this.strategyDistiller = isPersistenceEnabled() ? createPersistentDistillerOrFallback(getOutcomeStore(), this.logger) : new StrategyDistiller(getOutcomeStore(), this.logger);
14322
14539
  this.distilledRuleStage = new DistilledRuleStage(
@@ -14410,7 +14627,7 @@ var CompositeRouter = class _CompositeRouter {
14410
14627
  */
14411
14628
  async consultUnifiedContext(task) {
14412
14629
  try {
14413
- const { getContextForTask, inferTaskCategory } = await import("./context-retriever-ZVFRYEDL.js");
14630
+ const { getContextForTask, inferTaskCategory } = await import("./context-retriever-UDERFG2L.js");
14414
14631
  const ctx = await getContextForTask({
14415
14632
  task: task.content,
14416
14633
  category: inferTaskCategory(task.content),
@@ -14614,6 +14831,8 @@ var CompositeRouter = class _CompositeRouter {
14614
14831
  qualityConstraintStage: this.qualityConstraintStage,
14615
14832
  // Issue #998 resource strategy
14616
14833
  resourceStrategyStage: this.resourceStrategyStage,
14834
+ // #4373 capacity exclusion
14835
+ capacityFilterStage: this.capacityFilterStage,
14617
14836
  // Issue #999 distilled rule stage
14618
14837
  distilledRuleStage: this.distilledRuleStage,
14619
14838
  // arXiv:2505.12601 KNN routing
@@ -15992,4 +16211,4 @@ export {
15992
16211
  AgentCapability,
15993
16212
  OrchestratorError
15994
16213
  };
15995
- //# sourceMappingURL=chunk-UU6NLFCT.js.map
16214
+ //# sourceMappingURL=chunk-ATNHVLKJ.js.map