nexus-agents 8.74.2 → 8.75.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 (129) hide show
  1. package/dist/{ast-rule-runner-K35WYUOD.js → ast-rule-runner-S6BMBE5T.js} +3 -3
  2. package/dist/{child-mcp-config-B2CWZ2ZK.js → child-mcp-config-ZZ66QGIU.js} +2 -2
  3. package/dist/{chunk-43RJNTUZ.js → chunk-2BTJ5FNP.js} +2 -2
  4. package/dist/{chunk-PWEGOADT.js → chunk-2WO24CL5.js} +22 -14
  5. package/dist/chunk-2WO24CL5.js.map +1 -0
  6. package/dist/{chunk-2KXRL4OW.js → chunk-3CTDUBNC.js} +2 -2
  7. package/dist/{chunk-TUTS6S2G.js → chunk-4D3LWDEK.js} +8 -8
  8. package/dist/{chunk-ZKEULHX6.js → chunk-4I66XLEU.js} +7 -7
  9. package/dist/{chunk-4PWDDMLH.js → chunk-4Q3EURVU.js} +51 -10
  10. package/dist/chunk-4Q3EURVU.js.map +1 -0
  11. package/dist/{chunk-5QE6DJMH.js → chunk-5AR3IEKE.js} +5 -5
  12. package/dist/{chunk-GENL3TXA.js → chunk-5DQDMHSW.js} +2 -2
  13. package/dist/{chunk-Z2XB5IKO.js → chunk-74UUAGBU.js} +2 -2
  14. package/dist/{chunk-QW5FSTLJ.js → chunk-7GOBJ6MR.js} +2 -2
  15. package/dist/{chunk-ADHIHFBA.js → chunk-A3Q4QZ6G.js} +2 -2
  16. package/dist/{chunk-6Y24JDBR.js → chunk-A3TT5LFA.js} +49 -36
  17. package/dist/chunk-A3TT5LFA.js.map +1 -0
  18. package/dist/{chunk-D5ST2Y4W.js → chunk-BM272XDR.js} +3 -3
  19. package/dist/{chunk-MYGTMAHW.js → chunk-DTT5TSJV.js} +3 -3
  20. package/dist/{chunk-GW7SZ555.js → chunk-DYCSNMYD.js} +2 -2
  21. package/dist/{chunk-CYZ3DUQV.js → chunk-GA5VPMGG.js} +2 -2
  22. package/dist/{chunk-NC7X6WQL.js → chunk-GEZQW3SK.js} +2 -2
  23. package/dist/{chunk-HO2UPJ7T.js → chunk-HO4P3ONC.js} +36 -11
  24. package/dist/{chunk-HO2UPJ7T.js.map → chunk-HO4P3ONC.js.map} +1 -1
  25. package/dist/{chunk-DSTEEVDR.js → chunk-IZGDLLDP.js} +2 -2
  26. package/dist/{chunk-5E33WGDR.js → chunk-J6VKBPJQ.js} +2 -2
  27. package/dist/{chunk-22VQMTR6.js → chunk-KUCHJFK3.js} +2 -2
  28. package/dist/{chunk-47624RRN.js → chunk-LMCC5TTU.js} +2 -2
  29. package/dist/{chunk-6DPQOIE7.js → chunk-LY53XG4N.js} +2 -2
  30. package/dist/{chunk-NLRIEHAY.js → chunk-M2WCQBXR.js} +4 -4
  31. package/dist/{chunk-RGEJZIOJ.js → chunk-NDFVPB3Q.js} +2 -2
  32. package/dist/{chunk-M6DJ6AE3.js → chunk-OB2BQ2ES.js} +9 -9
  33. package/dist/{chunk-I2KBD37Y.js → chunk-SPQILQFG.js} +3 -3
  34. package/dist/{chunk-ZDVNHXRV.js → chunk-UVLHFNVM.js} +2 -2
  35. package/dist/{chunk-IQTHG5BO.js → chunk-W6YF4G2Y.js} +2 -2
  36. package/dist/{chunk-TL5NV5JH.js → chunk-WBPQYYTY.js} +4 -4
  37. package/dist/{chunk-B227FYGQ.js → chunk-WZPF7SI7.js} +4 -4
  38. package/dist/{chunk-ST7RKS3P.js → chunk-X4BBJZDE.js} +2 -2
  39. package/dist/{chunk-I5DGPV2X.js → chunk-Y4WMOZNI.js} +3 -3
  40. package/dist/{chunk-3PI3INR3.js → chunk-ZVINGGSG.js} +5 -5
  41. package/dist/{cli-circuit-breaker-Q73YH6FS.js → cli-circuit-breaker-YXZUZW2J.js} +3 -3
  42. package/dist/cli.js +235 -45
  43. package/dist/cli.js.map +1 -1
  44. package/dist/{composite-router-XKE225G5.js → composite-router-JLI4TRKG.js} +2 -2
  45. package/dist/{consensus-vote-YCETKP4M.js → consensus-vote-NU7M7ESH.js} +16 -16
  46. package/dist/{context-retriever-5BL34V6Y.js → context-retriever-6QUKMGAE.js} +8 -8
  47. package/dist/{doctor-deep-UYXLA4HG.js → doctor-deep-2WDIAMWF.js} +3 -3
  48. package/dist/{doctor-live-7I6STRL7.js → doctor-live-RAZLLAGJ.js} +10 -10
  49. package/dist/{expert-bridge-PLY7MNUK.js → expert-bridge-VJNZ6HBX.js} +4 -4
  50. package/dist/{factory-5XIEO5EA.js → factory-2LWHAH27.js} +5 -5
  51. package/dist/{factory-ZCMLOSDY.js → factory-PTY5BXS5.js} +9 -9
  52. package/dist/{improvement-review-CF5SWXUB.js → improvement-review-NHUWYT4N.js} +5 -5
  53. package/dist/index.js +31 -31
  54. package/dist/{init-opencode-UTF4K2LR.js → init-opencode-ADIEXXXN.js} +6 -6
  55. package/dist/issue-triage-55YTFO6G.js +16 -0
  56. package/dist/{pr-reviewer-helpers-RMOEXYCO.js → pr-reviewer-helpers-3PNRHJFT.js} +4 -4
  57. package/dist/{registry-command-XFM4XIGJ.js → registry-command-KI2RZGFI.js} +2 -2
  58. package/dist/{repo-security-plan-YWANNRJE.js → repo-security-plan-M4XWUPTW.js} +3 -3
  59. package/dist/{research-helpers-synthesize-QFKDDHRE.js → research-helpers-synthesize-CB2IUVZ3.js} +4 -4
  60. package/dist/{routing-memory-T22PQ5FF.js → routing-memory-RO2J5NBQ.js} +2 -2
  61. package/dist/{session-memory-ZNIJGF7Z.js → session-memory-VXMVCDJU.js} +3 -3
  62. package/dist/{setup-config-XC5KSYGO.js → setup-config-4EHZ5LHZ.js} +3 -3
  63. package/dist/{setup-custom-api-5WL5D24S.js → setup-custom-api-YCHOWLRA.js} +4 -4
  64. package/dist/setup-data-dir-FMUOFRN6.js +31 -0
  65. package/dist/{tool-memory-JNHE2VP2.js → tool-memory-EXKJZ34V.js} +5 -5
  66. package/dist/{unified-registry-5IIFYGBI.js → unified-registry-PPLQ26Q6.js} +10 -10
  67. package/dist/{weather-report-3AZHFDM3.js → weather-report-PJC3GJLD.js} +2 -2
  68. package/package.json +1 -1
  69. package/dist/chunk-4PWDDMLH.js.map +0 -1
  70. package/dist/chunk-6Y24JDBR.js.map +0 -1
  71. package/dist/chunk-PWEGOADT.js.map +0 -1
  72. package/dist/issue-triage-KCRQNDYX.js +0 -16
  73. package/dist/setup-data-dir-6PEJ3YF7.js +0 -31
  74. /package/dist/{ast-rule-runner-K35WYUOD.js.map → ast-rule-runner-S6BMBE5T.js.map} +0 -0
  75. /package/dist/{child-mcp-config-B2CWZ2ZK.js.map → child-mcp-config-ZZ66QGIU.js.map} +0 -0
  76. /package/dist/{chunk-43RJNTUZ.js.map → chunk-2BTJ5FNP.js.map} +0 -0
  77. /package/dist/{chunk-2KXRL4OW.js.map → chunk-3CTDUBNC.js.map} +0 -0
  78. /package/dist/{chunk-TUTS6S2G.js.map → chunk-4D3LWDEK.js.map} +0 -0
  79. /package/dist/{chunk-ZKEULHX6.js.map → chunk-4I66XLEU.js.map} +0 -0
  80. /package/dist/{chunk-5QE6DJMH.js.map → chunk-5AR3IEKE.js.map} +0 -0
  81. /package/dist/{chunk-GENL3TXA.js.map → chunk-5DQDMHSW.js.map} +0 -0
  82. /package/dist/{chunk-Z2XB5IKO.js.map → chunk-74UUAGBU.js.map} +0 -0
  83. /package/dist/{chunk-QW5FSTLJ.js.map → chunk-7GOBJ6MR.js.map} +0 -0
  84. /package/dist/{chunk-ADHIHFBA.js.map → chunk-A3Q4QZ6G.js.map} +0 -0
  85. /package/dist/{chunk-D5ST2Y4W.js.map → chunk-BM272XDR.js.map} +0 -0
  86. /package/dist/{chunk-MYGTMAHW.js.map → chunk-DTT5TSJV.js.map} +0 -0
  87. /package/dist/{chunk-GW7SZ555.js.map → chunk-DYCSNMYD.js.map} +0 -0
  88. /package/dist/{chunk-CYZ3DUQV.js.map → chunk-GA5VPMGG.js.map} +0 -0
  89. /package/dist/{chunk-NC7X6WQL.js.map → chunk-GEZQW3SK.js.map} +0 -0
  90. /package/dist/{chunk-DSTEEVDR.js.map → chunk-IZGDLLDP.js.map} +0 -0
  91. /package/dist/{chunk-5E33WGDR.js.map → chunk-J6VKBPJQ.js.map} +0 -0
  92. /package/dist/{chunk-22VQMTR6.js.map → chunk-KUCHJFK3.js.map} +0 -0
  93. /package/dist/{chunk-47624RRN.js.map → chunk-LMCC5TTU.js.map} +0 -0
  94. /package/dist/{chunk-6DPQOIE7.js.map → chunk-LY53XG4N.js.map} +0 -0
  95. /package/dist/{chunk-NLRIEHAY.js.map → chunk-M2WCQBXR.js.map} +0 -0
  96. /package/dist/{chunk-RGEJZIOJ.js.map → chunk-NDFVPB3Q.js.map} +0 -0
  97. /package/dist/{chunk-M6DJ6AE3.js.map → chunk-OB2BQ2ES.js.map} +0 -0
  98. /package/dist/{chunk-I2KBD37Y.js.map → chunk-SPQILQFG.js.map} +0 -0
  99. /package/dist/{chunk-ZDVNHXRV.js.map → chunk-UVLHFNVM.js.map} +0 -0
  100. /package/dist/{chunk-IQTHG5BO.js.map → chunk-W6YF4G2Y.js.map} +0 -0
  101. /package/dist/{chunk-TL5NV5JH.js.map → chunk-WBPQYYTY.js.map} +0 -0
  102. /package/dist/{chunk-B227FYGQ.js.map → chunk-WZPF7SI7.js.map} +0 -0
  103. /package/dist/{chunk-ST7RKS3P.js.map → chunk-X4BBJZDE.js.map} +0 -0
  104. /package/dist/{chunk-I5DGPV2X.js.map → chunk-Y4WMOZNI.js.map} +0 -0
  105. /package/dist/{chunk-3PI3INR3.js.map → chunk-ZVINGGSG.js.map} +0 -0
  106. /package/dist/{cli-circuit-breaker-Q73YH6FS.js.map → cli-circuit-breaker-YXZUZW2J.js.map} +0 -0
  107. /package/dist/{composite-router-XKE225G5.js.map → composite-router-JLI4TRKG.js.map} +0 -0
  108. /package/dist/{consensus-vote-YCETKP4M.js.map → consensus-vote-NU7M7ESH.js.map} +0 -0
  109. /package/dist/{context-retriever-5BL34V6Y.js.map → context-retriever-6QUKMGAE.js.map} +0 -0
  110. /package/dist/{doctor-deep-UYXLA4HG.js.map → doctor-deep-2WDIAMWF.js.map} +0 -0
  111. /package/dist/{doctor-live-7I6STRL7.js.map → doctor-live-RAZLLAGJ.js.map} +0 -0
  112. /package/dist/{expert-bridge-PLY7MNUK.js.map → expert-bridge-VJNZ6HBX.js.map} +0 -0
  113. /package/dist/{factory-5XIEO5EA.js.map → factory-2LWHAH27.js.map} +0 -0
  114. /package/dist/{factory-ZCMLOSDY.js.map → factory-PTY5BXS5.js.map} +0 -0
  115. /package/dist/{improvement-review-CF5SWXUB.js.map → improvement-review-NHUWYT4N.js.map} +0 -0
  116. /package/dist/{init-opencode-UTF4K2LR.js.map → init-opencode-ADIEXXXN.js.map} +0 -0
  117. /package/dist/{issue-triage-KCRQNDYX.js.map → issue-triage-55YTFO6G.js.map} +0 -0
  118. /package/dist/{pr-reviewer-helpers-RMOEXYCO.js.map → pr-reviewer-helpers-3PNRHJFT.js.map} +0 -0
  119. /package/dist/{registry-command-XFM4XIGJ.js.map → registry-command-KI2RZGFI.js.map} +0 -0
  120. /package/dist/{repo-security-plan-YWANNRJE.js.map → repo-security-plan-M4XWUPTW.js.map} +0 -0
  121. /package/dist/{research-helpers-synthesize-QFKDDHRE.js.map → research-helpers-synthesize-CB2IUVZ3.js.map} +0 -0
  122. /package/dist/{routing-memory-T22PQ5FF.js.map → routing-memory-RO2J5NBQ.js.map} +0 -0
  123. /package/dist/{session-memory-ZNIJGF7Z.js.map → session-memory-VXMVCDJU.js.map} +0 -0
  124. /package/dist/{setup-config-XC5KSYGO.js.map → setup-config-4EHZ5LHZ.js.map} +0 -0
  125. /package/dist/{setup-custom-api-5WL5D24S.js.map → setup-custom-api-YCHOWLRA.js.map} +0 -0
  126. /package/dist/{setup-data-dir-6PEJ3YF7.js.map → setup-data-dir-FMUOFRN6.js.map} +0 -0
  127. /package/dist/{tool-memory-JNHE2VP2.js.map → tool-memory-EXKJZ34V.js.map} +0 -0
  128. /package/dist/{unified-registry-5IIFYGBI.js.map → unified-registry-PPLQ26Q6.js.map} +0 -0
  129. /package/dist/{weather-report-3AZHFDM3.js.map → weather-report-PJC3GJLD.js.map} +0 -0
package/dist/cli.js CHANGED
@@ -23,11 +23,11 @@ import {
23
23
  parseExpertReview,
24
24
  reviewPostingBlock,
25
25
  sumFindings
26
- } from "./chunk-I5DGPV2X.js";
27
- import "./chunk-DSTEEVDR.js";
26
+ } from "./chunk-Y4WMOZNI.js";
27
+ import "./chunk-IZGDLLDP.js";
28
28
  import {
29
29
  runConfigInitSync
30
- } from "./chunk-2KXRL4OW.js";
30
+ } from "./chunk-3CTDUBNC.js";
31
31
  import {
32
32
  AuthHandler,
33
33
  CustomExpertDefinitionSchema,
@@ -156,11 +156,11 @@ import {
156
156
  validateNexusEnv,
157
157
  validateWorkflow,
158
158
  wrapInMarkdownFence
159
- } from "./chunk-6Y24JDBR.js";
160
- import "./chunk-CYZ3DUQV.js";
159
+ } from "./chunk-A3TT5LFA.js";
160
+ import "./chunk-GA5VPMGG.js";
161
161
  import "./chunk-4GDMHCKX.js";
162
162
  import "./chunk-M7DUOIAK.js";
163
- import "./chunk-Z2XB5IKO.js";
163
+ import "./chunk-74UUAGBU.js";
164
164
  import {
165
165
  CATEGORY_DISPLAY_NAMES,
166
166
  DEFAULT_PR_REVIEW_CONFIG
@@ -176,15 +176,16 @@ import {
176
176
  doctorCommand,
177
177
  initDataDirectories,
178
178
  runDoctor
179
- } from "./chunk-PWEGOADT.js";
180
- import "./chunk-43RJNTUZ.js";
179
+ } from "./chunk-2WO24CL5.js";
180
+ import "./chunk-2BTJ5FNP.js";
181
181
  import {
182
182
  buildOpenAICompatAdapters,
183
+ readOpenAICompatEndpoint,
183
184
  readOpenAICompatEnv
184
- } from "./chunk-HO2UPJ7T.js";
185
+ } from "./chunk-HO4P3ONC.js";
185
186
  import {
186
187
  shutdownExpertBridge
187
- } from "./chunk-ZKEULHX6.js";
188
+ } from "./chunk-4I66XLEU.js";
188
189
  import {
189
190
  ConsensusVoteInputSchema,
190
191
  DEFAULT_VOTE_TIMEOUT_MS,
@@ -202,18 +203,18 @@ import {
202
203
  registerConsensusVoteTool,
203
204
  seatFallbacks,
204
205
  toRecordDecision
205
- } from "./chunk-M6DJ6AE3.js";
206
+ } from "./chunk-OB2BQ2ES.js";
206
207
  import {
207
208
  loadUsageEvents,
208
209
  rollupByModel
209
- } from "./chunk-47624RRN.js";
210
+ } from "./chunk-LMCC5TTU.js";
210
211
  import {
211
212
  allOf,
212
213
  anyOf
213
214
  } from "./chunk-OQB3XC5O.js";
214
215
  import {
215
216
  synthesizeResearch
216
- } from "./chunk-MYGTMAHW.js";
217
+ } from "./chunk-DTT5TSJV.js";
217
218
  import {
218
219
  DRAFT_REPLY_BODY_MAX_LENGTH,
219
220
  configureUntrustedInputFirewall,
@@ -224,12 +225,12 @@ import {
224
225
  runUntrustedInputFirewall,
225
226
  validateAgentAction,
226
227
  validateCorroboration
227
- } from "./chunk-3PI3INR3.js";
228
- import "./chunk-NC7X6WQL.js";
228
+ } from "./chunk-ZVINGGSG.js";
229
+ import "./chunk-GEZQW3SK.js";
229
230
  import {
230
231
  ReputationCache,
231
232
  sanitizeInput
232
- } from "./chunk-ADHIHFBA.js";
233
+ } from "./chunk-A3Q4QZ6G.js";
233
234
  import {
234
235
  ImprovementReviewInputSchema,
235
236
  calculateFitnessScore,
@@ -243,23 +244,23 @@ import {
243
244
  registerImprovementReviewTool,
244
245
  runImprovementReview,
245
246
  scanForSecrets
246
- } from "./chunk-I2KBD37Y.js";
247
+ } from "./chunk-SPQILQFG.js";
247
248
  import {
248
249
  createDefaultPolicyFirewall,
249
250
  setGlobalPolicyFirewall,
250
251
  setSecureHandlerAuditLogger,
251
252
  stagePolicyFirewallForRollout
252
- } from "./chunk-D5ST2Y4W.js";
253
+ } from "./chunk-BM272XDR.js";
253
254
  import {
254
255
  NODE_ENGINE_RANGE,
255
256
  VERSION,
256
257
  isNodeVersionSupported
257
- } from "./chunk-QW5FSTLJ.js";
258
+ } from "./chunk-7GOBJ6MR.js";
258
259
  import {
259
260
  claimGlobalRegistry,
260
261
  createUnifiedRegistry,
261
262
  getGlobalRegistry
262
- } from "./chunk-TL5NV5JH.js";
263
+ } from "./chunk-WBPQYYTY.js";
263
264
  import {
264
265
  CodebaseIndexSchema,
265
266
  PaperStatusSchema,
@@ -285,26 +286,26 @@ import {
285
286
  loadSourcesRegistry,
286
287
  rankDiscoveredItems,
287
288
  saveSourcesRegistry
288
- } from "./chunk-5QE6DJMH.js";
289
+ } from "./chunk-5AR3IEKE.js";
289
290
  import {
290
291
  loadPapersRegistry,
291
292
  loadTechniquesRegistry,
292
293
  savePapersRegistry
293
- } from "./chunk-GW7SZ555.js";
294
+ } from "./chunk-DYCSNMYD.js";
294
295
  import {
295
296
  resolveToken
296
- } from "./chunk-22VQMTR6.js";
297
+ } from "./chunk-KUCHJFK3.js";
297
298
  import {
298
299
  MemoryError,
299
300
  configureToolMemory,
300
301
  shutdownToolMemory
301
- } from "./chunk-B227FYGQ.js";
302
+ } from "./chunk-WZPF7SI7.js";
302
303
  import {
303
304
  capitalize,
304
305
  capitalizeKebab,
305
306
  truncateText
306
307
  } from "./chunk-7LP6VJRP.js";
307
- import "./chunk-6DPQOIE7.js";
308
+ import "./chunk-LY53XG4N.js";
308
309
  import {
309
310
  BUILT_IN_EXPERTS
310
311
  } from "./chunk-AHI43IQB.js";
@@ -318,26 +319,30 @@ import {
318
319
  probeAllClis,
319
320
  readSubprocessDepth,
320
321
  safeJsonParse
321
- } from "./chunk-TUTS6S2G.js";
322
- import "./chunk-ZDVNHXRV.js";
322
+ } from "./chunk-4D3LWDEK.js";
323
+ import "./chunk-UVLHFNVM.js";
323
324
  import {
324
325
  DEFAULTS
325
- } from "./chunk-ST7RKS3P.js";
326
- import "./chunk-5E33WGDR.js";
326
+ } from "./chunk-X4BBJZDE.js";
327
+ import "./chunk-J6VKBPJQ.js";
327
328
  import {
328
329
  getNexusTmpDir,
329
330
  nexusMkdtempSync
330
331
  } from "./chunk-HERI7LXN.js";
331
- import "./chunk-RGEJZIOJ.js";
332
+ import "./chunk-NDFVPB3Q.js";
332
333
  import "./chunk-QZUG667L.js";
333
- import "./chunk-IQTHG5BO.js";
334
- import "./chunk-GENL3TXA.js";
334
+ import "./chunk-W6YF4G2Y.js";
335
+ import {
336
+ getDefaultCliCircuitBreakerRegistry,
337
+ mapModelErrorToCategory
338
+ } from "./chunk-5DQDMHSW.js";
335
339
  import {
336
340
  API_TIMEOUTS,
337
341
  AgentCapability,
338
342
  AgentError,
339
343
  CLI_NAMES,
340
344
  CLI_SUBPROCESS_TIMEOUTS,
345
+ ConfigError,
341
346
  DEFAULT_CLI,
342
347
  DEFAULT_MODEL_PROFILES,
343
348
  ErrorCode,
@@ -361,6 +366,7 @@ import {
361
366
  calculateCost,
362
367
  clamp,
363
368
  clamp01,
369
+ clearGatewayCatalog,
364
370
  color,
365
371
  colors,
366
372
  createCompositeRouter,
@@ -390,15 +396,20 @@ import {
390
396
  getRandomProvider,
391
397
  getTimeProvider,
392
398
  getTuneAdjustmentStore,
399
+ isDurableCapacityError,
400
+ isEndpointArmId,
401
+ isRateLimitLikeError,
393
402
  logger,
394
403
  lookupInTreeCapability,
395
404
  ok,
396
405
  openSqliteDatabase,
397
406
  parseTierOverrides,
407
+ recordRateLimitEvent,
398
408
  resetOutcomeStore,
399
409
  routingArmDisplaySlot,
400
410
  runWarmUp,
401
411
  safeRegex,
412
+ setGatewayCatalog,
402
413
  setGlobalLogLevel,
403
414
  setOutcomeStore,
404
415
  summarizeTaskProfile,
@@ -406,10 +417,11 @@ import {
406
417
  taskAnalysisResultToTaskProfile,
407
418
  taskProfileToBanditContext,
408
419
  toError,
420
+ toRateLimitError,
409
421
  validateTimeout,
410
422
  writeEmptyLine,
411
423
  writeLine
412
- } from "./chunk-4PWDDMLH.js";
424
+ } from "./chunk-4Q3EURVU.js";
413
425
  import "./chunk-4UHDDCRB.js";
414
426
  import {
415
427
  applyPortableMode,
@@ -4559,7 +4571,7 @@ Provide a structured review with:
4559
4571
  * (Source: Issue #828 — Wire policy gate into production pipeline)
4560
4572
  */
4561
4573
  async postReviewToGitHub(provider, pr, result, gateDecision, reputation) {
4562
- const { formatReviewComment: formatReviewComment2 } = await import("./pr-reviewer-helpers-RMOEXYCO.js");
4574
+ const { formatReviewComment: formatReviewComment2 } = await import("./pr-reviewer-helpers-3PNRHJFT.js");
4563
4575
  const formattedBody = formatReviewComment2(result);
4564
4576
  const body = truncateText(formattedBody, DRAFT_REPLY_BODY_MAX_LENGTH, "\u2026[review truncated]");
4565
4577
  const sources = buildReviewCitations(pr.files);
@@ -12222,7 +12234,7 @@ function probeGrammars(register, parse6, probes = GRAMMAR_PROBES) {
12222
12234
  }
12223
12235
  async function loadGrammarModules() {
12224
12236
  const [{ ensurePolyglotLangs }, napi] = await Promise.all([
12225
- import("./ast-rule-runner-K35WYUOD.js"),
12237
+ import("./ast-rule-runner-S6BMBE5T.js"),
12226
12238
  import("@ast-grep/napi")
12227
12239
  ]);
12228
12240
  return { register: ensurePolyglotLangs, parse: napi.parse };
@@ -19679,7 +19691,7 @@ function startImprovementReviewScheduler(options) {
19679
19691
  let running = false;
19680
19692
  const runOnce = async () => {
19681
19693
  try {
19682
- const { runImprovementReview: runImprovementReview2, ImprovementReviewInputSchema: ImprovementReviewInputSchema2 } = await import("./improvement-review-CF5SWXUB.js");
19694
+ const { runImprovementReview: runImprovementReview2, ImprovementReviewInputSchema: ImprovementReviewInputSchema2 } = await import("./improvement-review-NHUWYT4N.js");
19683
19695
  const input = ImprovementReviewInputSchema2.parse({ fileIssues });
19684
19696
  const result = await runImprovementReview2(input, { logger: logger22 });
19685
19697
  logger22.info("Scheduled improvement_review complete", {
@@ -20805,6 +20817,154 @@ function initializeExperts(options) {
20805
20817
  };
20806
20818
  }
20807
20819
 
20820
+ // src/adapters/gateway-arm-adapter.ts
20821
+ function createGatewayArmAdapter(armId, models, deps) {
20822
+ const delegate = models[0];
20823
+ if (delegate === void 0) {
20824
+ throw new ConfigError(`Gateway arm ${armId} has no models; nothing to register`);
20825
+ }
20826
+ return new GatewayArmAdapter(armId, delegate, models, deps);
20827
+ }
20828
+ var GatewayArmAdapter = class {
20829
+ constructor(armId, delegate, models, deps) {
20830
+ this.armId = armId;
20831
+ this.delegate = delegate;
20832
+ this.models = models;
20833
+ this.deps = deps;
20834
+ }
20835
+ armId;
20836
+ delegate;
20837
+ models;
20838
+ deps;
20839
+ selectedAt = /* @__PURE__ */ new Date();
20840
+ // --- IModelAdapter (forwarded to the delegate) ---
20841
+ get providerId() {
20842
+ return this.delegate.providerId;
20843
+ }
20844
+ get modelId() {
20845
+ return this.delegate.modelId;
20846
+ }
20847
+ get capabilities() {
20848
+ return this.delegate.capabilities;
20849
+ }
20850
+ /**
20851
+ * Both halves of the breaker contract, as `base-adapter.ts` records them
20852
+ * for the CLI slots on the same shared registry. The success half matters
20853
+ * (#6403 review): in the closed state `recordSuccess` zeroes the failure
20854
+ * count, which is what makes the threshold mean CONSECUTIVE failures, and
20855
+ * in half-open it is what closes the circuit again. Without it a long-lived
20856
+ * process counted scattered blips for its whole lifetime and, once open,
20857
+ * sat half-open forever with any single error re-opening it.
20858
+ */
20859
+ async complete(request) {
20860
+ const result = await this.delegate.complete(request);
20861
+ if (result.ok) {
20862
+ this.deps.circuitBreakerRegistry.getArmBreaker(this.armId).recordSuccess();
20863
+ } else {
20864
+ this.recordFailure(result.error);
20865
+ }
20866
+ return result;
20867
+ }
20868
+ stream(request) {
20869
+ return this.delegate.stream(request);
20870
+ }
20871
+ countTokens(text) {
20872
+ return this.delegate.countTokens(text);
20873
+ }
20874
+ validateConfig() {
20875
+ return this.delegate.validateConfig();
20876
+ }
20877
+ /** The whole catalogue, not the delegate alone — that is what the arm fronts. */
20878
+ listModels() {
20879
+ return Promise.resolve(this.models.map((m) => ({ id: m.modelId })));
20880
+ }
20881
+ // --- IResilientAdapter ---
20882
+ /**
20883
+ * `source: 'api'` always; `degraded` while the arm's breaker is open. There
20884
+ * is no `unavailable`: the arm exists only once discovery succeeded.
20885
+ */
20886
+ getHealth() {
20887
+ return {
20888
+ source: "api",
20889
+ state: this.deps.circuitBreakerRegistry.isArmOpen(this.armId) ? "degraded" : "healthy",
20890
+ selectedAt: this.selectedAt,
20891
+ failoverCount: 0
20892
+ };
20893
+ }
20894
+ /** Nothing to re-detect: the catalogue is fixed at registration. */
20895
+ refresh() {
20896
+ return Promise.resolve();
20897
+ }
20898
+ /** A gateway arm has no CLI to prefer; said at debug so a caller can see it was ignored. */
20899
+ setPreferredCli(cli) {
20900
+ this.deps.logger.debug("setPreferredCli ignored on a gateway arm", { arm: this.armId, cli });
20901
+ }
20902
+ /** The arm never fails over, so the callback is never invoked. */
20903
+ onFailover() {
20904
+ return () => void 0;
20905
+ }
20906
+ getCircuitBreakerRegistry() {
20907
+ return this.deps.circuitBreakerRegistry;
20908
+ }
20909
+ /**
20910
+ * No listeners or timers are held; the breaker outlives the arm on purpose
20911
+ * (a re-registered gateway keeps its failure history). The catalogue does
20912
+ * not: it describes THIS arm's models, so it goes when the arm goes
20913
+ * (`UnifiedAdapterRegistry.dispose()`, or the re-registration that disposes
20914
+ * the earlier adapter). The re-registering caller therefore sets the new
20915
+ * catalogue AFTER `registerApiArm`, never before.
20916
+ */
20917
+ dispose() {
20918
+ clearGatewayCatalog(this.armId);
20919
+ }
20920
+ // --- Private ---
20921
+ /**
20922
+ * `ResilientAdapter.recordBreakerFailure`, keyed on the ARM (#3423, #5359):
20923
+ * a transient rate limit is recorded by the telemetry branch and exempt from
20924
+ * the breaker (it would double-count, and open a breaker on a condition that
20925
+ * clears within the minute); a DURABLE capacity cap is counted even though it
20926
+ * is rate-limit-shaped, because it never clears; everything else counts.
20927
+ * Every rate-limit-shaped failure, durable or not, is a telemetry event.
20928
+ */
20929
+ recordFailure(error) {
20930
+ const breaker = this.deps.circuitBreakerRegistry.getArmBreaker(this.armId);
20931
+ const category = mapModelErrorToCategory(error);
20932
+ const rateLimitLike = category === "rate_limit" || isRateLimitLikeError(error);
20933
+ if (rateLimitLike) this.recordRateLimit(error);
20934
+ if (isDurableCapacityError(error)) {
20935
+ breaker.recordFailure(category);
20936
+ this.deps.logger.warn("Durable capacity cap recorded to gateway arm breaker", {
20937
+ arm: this.armId,
20938
+ provider: this.delegate.providerId,
20939
+ category
20940
+ });
20941
+ return;
20942
+ }
20943
+ if (rateLimitLike) return;
20944
+ breaker.recordFailure(category);
20945
+ this.deps.logger.warn("Gateway arm failure recorded to circuit breaker", {
20946
+ arm: this.armId,
20947
+ provider: this.delegate.providerId,
20948
+ category
20949
+ });
20950
+ }
20951
+ /** The telemetry branch of `ResilientAdapter.complete`, for the exempted case. */
20952
+ recordRateLimit(error) {
20953
+ const provider = this.delegate.providerId;
20954
+ const rlError = toRateLimitError(error, provider);
20955
+ recordRateLimitEvent({
20956
+ provider,
20957
+ timestamp: getTimeProvider().now(),
20958
+ retryAfterMs: rlError.retryAfterMs
20959
+ });
20960
+ this.deps.logger.warn("Rate limit detected on gateway arm", {
20961
+ arm: this.armId,
20962
+ provider,
20963
+ retryAfterMs: rlError.retryAfterMs
20964
+ });
20965
+ }
20966
+ };
20967
+
20808
20968
  // src/cli-server-gateway.ts
20809
20969
  async function tryWireGatewayAdapters(logger22) {
20810
20970
  const sandboxActive = detectSandbox().active;
@@ -20814,7 +20974,7 @@ async function tryWireGatewayAdapters(logger22) {
20814
20974
  noticeCliSubprocessFallback(logger22);
20815
20975
  return void 0;
20816
20976
  }
20817
- const result = await buildOpenAICompatAdapters();
20977
+ const result = await buildOpenAICompatAdapters(logger22);
20818
20978
  if (result === null) {
20819
20979
  noticeCliSubprocessFallback(logger22);
20820
20980
  return void 0;
@@ -20847,6 +21007,36 @@ function noticeCliSubprocessFallback(logger22) {
20847
21007
  function resolveDefaultModelAdapter(gatewayAdapters, adapterRegistry) {
20848
21008
  return gatewayAdapters?.[0] ?? adapterRegistry.getDefault();
20849
21009
  }
21010
+ function registerGatewayArm(adapters, endpoint, registry) {
21011
+ const logger22 = registry.getLogger();
21012
+ if (adapters === void 0 || adapters.length === 0) {
21013
+ logger22.debug("No gateway adapters discovered; no api: arm registered");
21014
+ return void 0;
21015
+ }
21016
+ const armId = `api:${endpoint}`;
21017
+ if (!isEndpointArmId(armId)) {
21018
+ logger22.warn("Gateway endpoint is not a valid endpoint id; no api: arm registered");
21019
+ return void 0;
21020
+ }
21021
+ registry.registerApiArm(
21022
+ armId,
21023
+ createGatewayArmAdapter(armId, adapters, {
21024
+ circuitBreakerRegistry: getDefaultCliCircuitBreakerRegistry(),
21025
+ logger: logger22
21026
+ })
21027
+ );
21028
+ setGatewayCatalog(
21029
+ armId,
21030
+ adapters.map((a) => a.modelId)
21031
+ );
21032
+ logger22.info("Gateway registered as one api: arm", { arm: armId, modelCount: adapters.length });
21033
+ return armId;
21034
+ }
21035
+ async function wireGateway(logger22, registry) {
21036
+ const adapters = await tryWireGatewayAdapters(logger22);
21037
+ registerGatewayArm(adapters, readOpenAICompatEndpoint(), registry);
21038
+ return adapters;
21039
+ }
20850
21040
  function handleMissingEnv(logger22, sandboxActive) {
20851
21041
  if (sandboxActive) {
20852
21042
  logger22.error(
@@ -21779,7 +21969,7 @@ function adaptConfigToLibrary(config) {
21779
21969
  }
21780
21970
  function createBeliefPromoter() {
21781
21971
  return async (event) => {
21782
- const { getToolMemory } = await import("./tool-memory-JNHE2VP2.js");
21972
+ const { getToolMemory } = await import("./tool-memory-EXKJZ34V.js");
21783
21973
  const tm = getToolMemory();
21784
21974
  await tm.recordBelief(
21785
21975
  `skill:${event.name}`,
@@ -22190,7 +22380,7 @@ async function initializeAndRegisterTools(server, logger22, policyFirewall, conf
22190
22380
  const builtInTemplates = await initializeBuiltInTemplates();
22191
22381
  logger22.info("Loaded built-in templates", { count: builtInTemplates.size });
22192
22382
  const adapterRegistry = createAdapterRegistry(logger22);
22193
- const gatewayAdapters = await tryWireGatewayAdapters(logger22);
22383
+ const gatewayAdapters = await wireGateway(logger22, adapterRegistry);
22194
22384
  const modelAdapter = resolveDefaultModelAdapter(gatewayAdapters, adapterRegistry);
22195
22385
  const policyVals = getPolicyValues(config);
22196
22386
  const allowedPaths = config.security?.allowedPaths;
@@ -23053,7 +23243,7 @@ async function handleResearchCommand(args) {
23053
23243
  }
23054
23244
  }
23055
23245
  async function handleRegistryCommand(args) {
23056
- const { registryCommand, isValidRegistrySubcommand, formatRegistryUsage } = await import("./registry-command-XFM4XIGJ.js");
23246
+ const { registryCommand, isValidRegistrySubcommand, formatRegistryUsage } = await import("./registry-command-KI2RZGFI.js");
23057
23247
  const subcommand = args.subcommand;
23058
23248
  if (!isValidRegistrySubcommand(subcommand)) {
23059
23249
  process.stdout.write(`${formatRegistryUsage()}
@@ -23101,12 +23291,12 @@ async function handleVerifyCommand(args) {
23101
23291
  async function handleDoctorCommand(args) {
23102
23292
  const exitCode = await doctorCommand({ fix: args.options.fix });
23103
23293
  if (args.options.deep) {
23104
- const { runDeepDiagnostics: runDeepDiagnostics2, formatDeepDiagnostics: formatDeepDiagnostics2 } = await import("./doctor-deep-UYXLA4HG.js");
23294
+ const { runDeepDiagnostics: runDeepDiagnostics2, formatDeepDiagnostics: formatDeepDiagnostics2 } = await import("./doctor-deep-2WDIAMWF.js");
23105
23295
  const diag = runDeepDiagnostics2();
23106
23296
  process.stdout.write(formatDeepDiagnostics2(diag) + "\n");
23107
23297
  }
23108
23298
  if (args.options.live) {
23109
- const { runLiveReadiness, formatLiveReadiness } = await import("./doctor-live-7I6STRL7.js");
23299
+ const { runLiveReadiness, formatLiveReadiness } = await import("./doctor-live-RAZLLAGJ.js");
23110
23300
  const report = await runLiveReadiness();
23111
23301
  process.stdout.write(formatLiveReadiness(report) + "\n");
23112
23302
  if (report.some((r) => r.levels.serves.status === "failed")) {
@@ -23839,7 +24029,7 @@ async function runInitPortableFlow(args) {
23839
24029
  return cliExit(result.success ? EXIT_CODES.SUCCESS : EXIT_CODES.SERVER_START_FAILED);
23840
24030
  }
23841
24031
  async function runInitOpencodeFlow(args) {
23842
- const { runInitOpencode } = await import("./init-opencode-UTF4K2LR.js");
24032
+ const { runInitOpencode } = await import("./init-opencode-ADIEXXXN.js");
23843
24033
  const opencodePath = args.options.opencode;
23844
24034
  if (opencodePath === void 0 || opencodePath === "") {
23845
24035
  process.stderr.write("Error: --opencode requires a path argument.\n");
@@ -23865,7 +24055,7 @@ async function runInitOpencodeFlow(args) {
23865
24055
  return cliExit(EXIT_CODES.SUCCESS);
23866
24056
  }
23867
24057
  async function renderOpencodeValidate(opencodePath) {
23868
- const { runOpencodeValidate } = await import("./init-opencode-UTF4K2LR.js");
24058
+ const { runOpencodeValidate } = await import("./init-opencode-ADIEXXXN.js");
23869
24059
  const result = await runOpencodeValidate(opencodePath);
23870
24060
  if (!result.ok) {
23871
24061
  process.stderr.write(`init --opencode --validate: ${result.reason ?? "failed"}
@@ -23904,7 +24094,7 @@ async function handleSetupCommandAsync(args) {
23904
24094
  return cliExitFromStatus(exitCode);
23905
24095
  }
23906
24096
  async function runCustomApiSetup(args) {
23907
- const { configureCustomApi } = await import("./setup-custom-api-5WL5D24S.js");
24097
+ const { configureCustomApi } = await import("./setup-custom-api-YCHOWLRA.js");
23908
24098
  const baseUrl = args.options.customApi;
23909
24099
  if (baseUrl === void 0) return EXIT_CODES.SERVER_START_FAILED;
23910
24100
  const input = {