nexus-agents 3.4.7 → 3.5.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-RPGCCPR7.js → child-mcp-config-VVTPONKP.js} +2 -2
  2. package/dist/{chunk-J34IF7WA.js → chunk-3EIACKNR.js} +8 -8
  3. package/dist/{chunk-2KOTMA3Y.js → chunk-3FSBTAEC.js} +2 -2
  4. package/dist/{chunk-ZFLZL6JL.js → chunk-45IB3F6G.js} +71 -10
  5. package/dist/chunk-45IB3F6G.js.map +1 -0
  6. package/dist/{chunk-F4SOZWM5.js → chunk-4ZVNCOZH.js} +2 -2
  7. package/dist/{chunk-UAPIH3ZX.js → chunk-5MRYWJVK.js} +2 -2
  8. package/dist/{chunk-QITBS6CA.js → chunk-6DIGIJIY.js} +8 -8
  9. package/dist/{chunk-PHEB64A5.js → chunk-7GFMCMLF.js} +2 -2
  10. package/dist/{chunk-GMJGQ2XO.js → chunk-C25JA3SI.js} +4 -4
  11. package/dist/{chunk-7BBHGO7A.js → chunk-D3KHLA3D.js} +2 -2
  12. package/dist/{chunk-SLLUTZHU.js → chunk-DDY7JDTZ.js} +35 -35
  13. package/dist/{chunk-RGAC3SAM.js → chunk-EKASN4MV.js} +5 -5
  14. package/dist/{chunk-JHIKOTSP.js → chunk-GVLDWGSK.js} +7 -7
  15. package/dist/{chunk-5542NZXG.js → chunk-GWLBIDS6.js} +3 -3
  16. package/dist/{chunk-UOG5ANHL.js → chunk-HKX7HKDV.js} +3 -3
  17. package/dist/{chunk-TU25EPBM.js → chunk-HPAYIX7E.js} +2 -2
  18. package/dist/{chunk-OR2CJF3R.js → chunk-IK45M7J3.js} +5 -5
  19. package/dist/{chunk-Z53SVS5A.js → chunk-KBVU2GGV.js} +2 -2
  20. package/dist/{chunk-W4GN7VPG.js → chunk-L4J7AXP3.js} +2 -2
  21. package/dist/{chunk-SC7OLO76.js → chunk-LMGXSMC6.js} +2 -2
  22. package/dist/{chunk-WEQNCK5F.js → chunk-NWTACWXE.js} +5 -5
  23. package/dist/{chunk-YO2OXOPU.js → chunk-QDH2SQKE.js} +2 -2
  24. package/dist/{chunk-FTH6XZFA.js → chunk-QDUZSOOU.js} +2 -2
  25. package/dist/{chunk-RSUQCA2E.js → chunk-ROIGF7ZF.js} +4 -4
  26. package/dist/{chunk-6DDKUQFD.js → chunk-TPKK4ANS.js} +2 -2
  27. package/dist/{chunk-KJ2M2L6J.js → chunk-U76AVHIW.js} +2 -2
  28. package/dist/{chunk-H5BWZMLU.js → chunk-UFJDYK22.js} +4 -4
  29. package/dist/{chunk-SC522IDR.js → chunk-UKIFG26L.js} +3 -3
  30. package/dist/{chunk-XND2FD6I.js → chunk-UOA23X5A.js} +2 -2
  31. package/dist/{chunk-WGBVREBV.js → chunk-XKAUANYB.js} +2 -2
  32. package/dist/{chunk-YHSWBCZJ.js → chunk-XKGEKKKQ.js} +3 -3
  33. package/dist/{chunk-CG5TS6GJ.js → chunk-XOWOOBY7.js} +5 -5
  34. package/dist/{chunk-FBTBH65X.js → chunk-YFY64CCU.js} +5 -4
  35. package/dist/chunk-YFY64CCU.js.map +1 -0
  36. package/dist/{chunk-DXORNOYR.js → chunk-Z5HKO4TN.js} +2 -2
  37. package/dist/{cli-circuit-breaker-PETQMWAX.js → cli-circuit-breaker-BKCDXF7A.js} +3 -3
  38. package/dist/cli.js +40 -40
  39. package/dist/{composite-router-D36RXDEN.js → composite-router-7ZQW5X6M.js} +2 -2
  40. package/dist/{consensus-vote-CVXD54KV.js → consensus-vote-JAQXK6NR.js} +16 -16
  41. package/dist/{context-retriever-TCS3ZCHM.js → context-retriever-4BWVW6Z3.js} +8 -8
  42. package/dist/{doctor-deep-KCBA7PRP.js → doctor-deep-XEIFQH2B.js} +3 -3
  43. package/dist/{expert-bridge-4N5Q5T6J.js → expert-bridge-KXXOPEZF.js} +4 -4
  44. package/dist/{factory-KDJP6PLO.js → factory-DFOM4HM5.js} +5 -5
  45. package/dist/{factory-ASP7H2N6.js → factory-L74ZN3ZO.js} +9 -9
  46. package/dist/{improvement-review-5SWVO5KR.js → improvement-review-P5OTBXCR.js} +5 -5
  47. package/dist/index.d.ts +75 -1
  48. package/dist/index.js +30 -30
  49. package/dist/{init-opencode-Q6YEYFJK.js → init-opencode-ZYRLCXUF.js} +6 -6
  50. package/dist/{issue-triage-AOTQZ7RB.js → issue-triage-R543HBHK.js} +6 -6
  51. package/dist/{pr-reviewer-helpers-GAXKDXOB.js → pr-reviewer-helpers-T33G7ACC.js} +4 -4
  52. package/dist/{registry-command-AUHXXQMZ.js → registry-command-PW7PXQDH.js} +2 -2
  53. package/dist/{repo-security-plan-EGRREARY.js → repo-security-plan-RVKAJD7N.js} +3 -3
  54. package/dist/{research-helpers-synthesize-HBR26XOL.js → research-helpers-synthesize-FPBPUTJJ.js} +4 -4
  55. package/dist/{routing-memory-UJ6EC6HP.js → routing-memory-X5KJULU7.js} +2 -2
  56. package/dist/{session-memory-J47B6D5W.js → session-memory-UX5SU2ZG.js} +3 -3
  57. package/dist/{setup-command-OZLCZC5Q.js → setup-command-ISVGN73J.js} +14 -14
  58. package/dist/{setup-config-FTSQUTS7.js → setup-config-IEH3CVR5.js} +3 -3
  59. package/dist/{setup-custom-api-7FACD7AZ.js → setup-custom-api-V4K6SQQN.js} +4 -4
  60. package/dist/{tool-memory-HDV46HBY.js → tool-memory-IALII4YE.js} +5 -5
  61. package/dist/{unified-registry-OOS6RFJT.js → unified-registry-RUA3EHP4.js} +10 -10
  62. package/dist/{weather-report-SMQFSLI4.js → weather-report-PBVXX2HU.js} +2 -2
  63. package/package.json +1 -1
  64. package/dist/chunk-FBTBH65X.js.map +0 -1
  65. package/dist/chunk-ZFLZL6JL.js.map +0 -1
  66. /package/dist/{child-mcp-config-RPGCCPR7.js.map → child-mcp-config-VVTPONKP.js.map} +0 -0
  67. /package/dist/{chunk-J34IF7WA.js.map → chunk-3EIACKNR.js.map} +0 -0
  68. /package/dist/{chunk-2KOTMA3Y.js.map → chunk-3FSBTAEC.js.map} +0 -0
  69. /package/dist/{chunk-F4SOZWM5.js.map → chunk-4ZVNCOZH.js.map} +0 -0
  70. /package/dist/{chunk-UAPIH3ZX.js.map → chunk-5MRYWJVK.js.map} +0 -0
  71. /package/dist/{chunk-QITBS6CA.js.map → chunk-6DIGIJIY.js.map} +0 -0
  72. /package/dist/{chunk-PHEB64A5.js.map → chunk-7GFMCMLF.js.map} +0 -0
  73. /package/dist/{chunk-GMJGQ2XO.js.map → chunk-C25JA3SI.js.map} +0 -0
  74. /package/dist/{chunk-7BBHGO7A.js.map → chunk-D3KHLA3D.js.map} +0 -0
  75. /package/dist/{chunk-SLLUTZHU.js.map → chunk-DDY7JDTZ.js.map} +0 -0
  76. /package/dist/{chunk-RGAC3SAM.js.map → chunk-EKASN4MV.js.map} +0 -0
  77. /package/dist/{chunk-JHIKOTSP.js.map → chunk-GVLDWGSK.js.map} +0 -0
  78. /package/dist/{chunk-5542NZXG.js.map → chunk-GWLBIDS6.js.map} +0 -0
  79. /package/dist/{chunk-UOG5ANHL.js.map → chunk-HKX7HKDV.js.map} +0 -0
  80. /package/dist/{chunk-TU25EPBM.js.map → chunk-HPAYIX7E.js.map} +0 -0
  81. /package/dist/{chunk-OR2CJF3R.js.map → chunk-IK45M7J3.js.map} +0 -0
  82. /package/dist/{chunk-Z53SVS5A.js.map → chunk-KBVU2GGV.js.map} +0 -0
  83. /package/dist/{chunk-W4GN7VPG.js.map → chunk-L4J7AXP3.js.map} +0 -0
  84. /package/dist/{chunk-SC7OLO76.js.map → chunk-LMGXSMC6.js.map} +0 -0
  85. /package/dist/{chunk-WEQNCK5F.js.map → chunk-NWTACWXE.js.map} +0 -0
  86. /package/dist/{chunk-YO2OXOPU.js.map → chunk-QDH2SQKE.js.map} +0 -0
  87. /package/dist/{chunk-FTH6XZFA.js.map → chunk-QDUZSOOU.js.map} +0 -0
  88. /package/dist/{chunk-RSUQCA2E.js.map → chunk-ROIGF7ZF.js.map} +0 -0
  89. /package/dist/{chunk-6DDKUQFD.js.map → chunk-TPKK4ANS.js.map} +0 -0
  90. /package/dist/{chunk-KJ2M2L6J.js.map → chunk-U76AVHIW.js.map} +0 -0
  91. /package/dist/{chunk-H5BWZMLU.js.map → chunk-UFJDYK22.js.map} +0 -0
  92. /package/dist/{chunk-SC522IDR.js.map → chunk-UKIFG26L.js.map} +0 -0
  93. /package/dist/{chunk-XND2FD6I.js.map → chunk-UOA23X5A.js.map} +0 -0
  94. /package/dist/{chunk-WGBVREBV.js.map → chunk-XKAUANYB.js.map} +0 -0
  95. /package/dist/{chunk-YHSWBCZJ.js.map → chunk-XKGEKKKQ.js.map} +0 -0
  96. /package/dist/{chunk-CG5TS6GJ.js.map → chunk-XOWOOBY7.js.map} +0 -0
  97. /package/dist/{chunk-DXORNOYR.js.map → chunk-Z5HKO4TN.js.map} +0 -0
  98. /package/dist/{cli-circuit-breaker-PETQMWAX.js.map → cli-circuit-breaker-BKCDXF7A.js.map} +0 -0
  99. /package/dist/{composite-router-D36RXDEN.js.map → composite-router-7ZQW5X6M.js.map} +0 -0
  100. /package/dist/{consensus-vote-CVXD54KV.js.map → consensus-vote-JAQXK6NR.js.map} +0 -0
  101. /package/dist/{context-retriever-TCS3ZCHM.js.map → context-retriever-4BWVW6Z3.js.map} +0 -0
  102. /package/dist/{doctor-deep-KCBA7PRP.js.map → doctor-deep-XEIFQH2B.js.map} +0 -0
  103. /package/dist/{expert-bridge-4N5Q5T6J.js.map → expert-bridge-KXXOPEZF.js.map} +0 -0
  104. /package/dist/{factory-ASP7H2N6.js.map → factory-DFOM4HM5.js.map} +0 -0
  105. /package/dist/{factory-KDJP6PLO.js.map → factory-L74ZN3ZO.js.map} +0 -0
  106. /package/dist/{improvement-review-5SWVO5KR.js.map → improvement-review-P5OTBXCR.js.map} +0 -0
  107. /package/dist/{init-opencode-Q6YEYFJK.js.map → init-opencode-ZYRLCXUF.js.map} +0 -0
  108. /package/dist/{issue-triage-AOTQZ7RB.js.map → issue-triage-R543HBHK.js.map} +0 -0
  109. /package/dist/{pr-reviewer-helpers-GAXKDXOB.js.map → pr-reviewer-helpers-T33G7ACC.js.map} +0 -0
  110. /package/dist/{registry-command-AUHXXQMZ.js.map → registry-command-PW7PXQDH.js.map} +0 -0
  111. /package/dist/{repo-security-plan-EGRREARY.js.map → repo-security-plan-RVKAJD7N.js.map} +0 -0
  112. /package/dist/{research-helpers-synthesize-HBR26XOL.js.map → research-helpers-synthesize-FPBPUTJJ.js.map} +0 -0
  113. /package/dist/{routing-memory-UJ6EC6HP.js.map → routing-memory-X5KJULU7.js.map} +0 -0
  114. /package/dist/{session-memory-J47B6D5W.js.map → session-memory-UX5SU2ZG.js.map} +0 -0
  115. /package/dist/{setup-command-OZLCZC5Q.js.map → setup-command-ISVGN73J.js.map} +0 -0
  116. /package/dist/{setup-config-FTSQUTS7.js.map → setup-config-IEH3CVR5.js.map} +0 -0
  117. /package/dist/{setup-custom-api-7FACD7AZ.js.map → setup-custom-api-V4K6SQQN.js.map} +0 -0
  118. /package/dist/{tool-memory-HDV46HBY.js.map → tool-memory-IALII4YE.js.map} +0 -0
  119. /package/dist/{unified-registry-OOS6RFJT.js.map → unified-registry-RUA3EHP4.js.map} +0 -0
  120. /package/dist/{weather-report-SMQFSLI4.js.map → weather-report-PBVXX2HU.js.map} +0 -0
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-SNJNRDKZ.js";
4
4
  import {
5
5
  createLogger
6
- } from "./chunk-FBTBH65X.js";
6
+ } from "./chunk-YFY64CCU.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-RPGCCPR7.js.map
65
+ //# sourceMappingURL=child-mcp-config-VVTPONKP.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  readOpenAICompatEnv
3
- } from "./chunk-CG5TS6GJ.js";
3
+ } from "./chunk-XOWOOBY7.js";
4
4
  import {
5
5
  resolveInsideRoot
6
6
  } from "./chunk-NUBSJGQZ.js";
@@ -10,10 +10,10 @@ import {
10
10
  import {
11
11
  createAllAdapters,
12
12
  probeCli
13
- } from "./chunk-ZFLZL6JL.js";
13
+ } from "./chunk-45IB3F6G.js";
14
14
  import {
15
15
  DEFAULTS
16
- } from "./chunk-2KOTMA3Y.js";
16
+ } from "./chunk-3FSBTAEC.js";
17
17
  import {
18
18
  getNexusTmpDir
19
19
  } from "./chunk-SNJNRDKZ.js";
@@ -33,7 +33,7 @@ import {
33
33
  ok,
34
34
  symbols,
35
35
  writeLine
36
- } from "./chunk-FBTBH65X.js";
36
+ } from "./chunk-YFY64CCU.js";
37
37
  import {
38
38
  getLearningDir,
39
39
  getOutcomesFile,
@@ -49,7 +49,7 @@ import {
49
49
  } from "./chunk-OQLFRJCW.js";
50
50
 
51
51
  // src/version.ts
52
- var VERSION = true ? "3.4.7" : "dev";
52
+ var VERSION = true ? "3.5.0" : "dev";
53
53
 
54
54
  // src/config/schemas-core.ts
55
55
  import { z } from "zod";
@@ -2287,7 +2287,7 @@ async function runDoctorFix(result) {
2287
2287
  writeLine2("\u2500".repeat(40));
2288
2288
  let fixCount = 0;
2289
2289
  if (!result.dataDirectory.rootExists || result.dataDirectory.subdirectories.some((d) => !d.exists || !d.writable)) {
2290
- const { runSetup } = await import("./setup-command-OZLCZC5Q.js");
2290
+ const { runSetup } = await import("./setup-command-ISVGN73J.js");
2291
2291
  const setupResult = runSetup({
2292
2292
  skipMcp: true,
2293
2293
  skipRules: true,
@@ -2301,7 +2301,7 @@ async function runDoctorFix(result) {
2301
2301
  }
2302
2302
  }
2303
2303
  if (!result.configFile.found) {
2304
- const { runConfigInitSync } = await import("./setup-config-FTSQUTS7.js");
2304
+ const { runConfigInitSync } = await import("./setup-config-IEH3CVR5.js");
2305
2305
  const configResult = runConfigInitSync(process.cwd(), false, false);
2306
2306
  if (configResult.success && configResult.created) {
2307
2307
  writeLine2(`\u2713 Generated config: ${configResult.path}`);
@@ -2400,4 +2400,4 @@ export {
2400
2400
  startStdioServer,
2401
2401
  closeServer
2402
2402
  };
2403
- //# sourceMappingURL=chunk-J34IF7WA.js.map
2403
+ //# sourceMappingURL=chunk-3EIACKNR.js.map
@@ -11,7 +11,7 @@ import {
11
11
  createGetRetryConfig,
12
12
  createGetTimeout,
13
13
  createGetToolRateLimit
14
- } from "./chunk-FBTBH65X.js";
14
+ } from "./chunk-YFY64CCU.js";
15
15
 
16
16
  // src/config/defaults.ts
17
17
  var CUSTOM_API_DEFAULT_MODEL = "gpt-5.5";
@@ -230,4 +230,4 @@ export {
230
230
  CUSTOM_API_DEFAULT_MODEL,
231
231
  DEFAULTS
232
232
  };
233
- //# sourceMappingURL=chunk-2KOTMA3Y.js.map
233
+ //# sourceMappingURL=chunk-3FSBTAEC.js.map
@@ -5,34 +5,34 @@ import {
5
5
  planOptionalParams,
6
6
  requireApiKey,
7
7
  validateApiKeyPresence
8
- } from "./chunk-PHEB64A5.js";
8
+ } from "./chunk-7GFMCMLF.js";
9
9
  import {
10
10
  CUSTOM_API_DEFAULT_MODEL
11
- } from "./chunk-2KOTMA3Y.js";
11
+ } from "./chunk-3FSBTAEC.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-XND2FD6I.js";
17
+ } from "./chunk-UOA23X5A.js";
18
18
  import {
19
19
  nexusMkdtempSync
20
20
  } from "./chunk-SNJNRDKZ.js";
21
21
  import {
22
22
  getAvailabilityCache
23
- } from "./chunk-SC7OLO76.js";
23
+ } from "./chunk-LMGXSMC6.js";
24
24
  import {
25
25
  extractSystemPrompt
26
26
  } from "./chunk-QZUG667L.js";
27
27
  import {
28
28
  generateHyphenId
29
- } from "./chunk-UAPIH3ZX.js";
29
+ } from "./chunk-5MRYWJVK.js";
30
30
  import {
31
31
  CliCircuitBreaker,
32
32
  DEFAULT_CIRCUIT_BREAKER_CONFIG,
33
33
  getCliCircuitBreakerSnapshot,
34
34
  getDefaultCliCircuitBreakerRegistry
35
- } from "./chunk-7BBHGO7A.js";
35
+ } from "./chunk-D3KHLA3D.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-FBTBH65X.js";
72
+ } from "./chunk-YFY64CCU.js";
73
73
 
74
74
  // src/cli-adapters/cli-to-model-adapter.ts
75
75
  var CliToModelAdapter = class {
@@ -329,7 +329,9 @@ var ModelToCliAdapter = class {
329
329
  remainingRequests: Number.POSITIVE_INFINITY,
330
330
  resetTime: /* @__PURE__ */ new Date(0),
331
331
  utilizationPercent: 0,
332
+ rateLimited: false,
332
333
  exhausted: false,
334
+ quotaExhausted: false,
333
335
  observed: false
334
336
  });
335
337
  }
@@ -1682,6 +1684,11 @@ var CapacityTracker = class {
1682
1684
  * from an idle healthy one, and both report full remaining capacity.
1683
1685
  */
1684
1686
  hasObserved = false;
1687
+ /**
1688
+ * Provider-asserted quota exhaustion (#4456), with the horizon the provider
1689
+ * gave. Null until a provider says so — never inferred from local counting.
1690
+ */
1691
+ quotaExhaustedUntil = null;
1685
1692
  constructor(config) {
1686
1693
  this.config = config;
1687
1694
  this.usageHistory = [];
@@ -1718,17 +1725,48 @@ var CapacityTracker = class {
1718
1725
  const tokenUtilization = usedTokens / this.config.tokenLimit * 100;
1719
1726
  const requestUtilization = this.requestCount / this.config.requestLimit * 100;
1720
1727
  const utilizationPercent = clampPercent(Math.max(tokenUtilization, requestUtilization));
1721
- const exhausted = remainingTokens === 0 || remainingRequests === 0;
1728
+ const rateLimited = remainingTokens === 0 || remainingRequests === 0;
1722
1729
  const resetTime = new Date(this.windowStart + this.config.windowMs);
1730
+ if (this.quotaExhaustedUntil !== null && now >= this.quotaExhaustedUntil) {
1731
+ this.quotaExhaustedUntil = null;
1732
+ }
1733
+ const quotaExhausted = this.quotaExhaustedUntil !== null;
1723
1734
  return {
1724
1735
  remainingTokens,
1725
1736
  remainingRequests,
1726
1737
  resetTime,
1727
1738
  utilizationPercent: Math.round(utilizationPercent * 100) / 100,
1728
- exhausted,
1739
+ rateLimited,
1740
+ // #4456: identical value, deprecated name. Kept so the rename is not a
1741
+ // breaking change to an exported type; removal is scheduled for the next
1742
+ // major, and `no-restricted-syntax` blocks new reads in the meantime.
1743
+ exhausted: rateLimited,
1744
+ quotaExhausted,
1745
+ ...this.quotaExhaustedUntil !== null ? { quotaResetAt: new Date(this.quotaExhaustedUntil) } : {},
1729
1746
  observed: this.hasObserved
1730
1747
  };
1731
1748
  }
1749
+ /**
1750
+ * Record a PROVIDER's assertion that durable quota is exhausted (#4456).
1751
+ *
1752
+ * Only a `retryAfterMs` longer than the local window counts. A shorter one
1753
+ * is an ordinary per-minute throttle, which {@link CapacityStatus.rateLimited}
1754
+ * already covers — treating it as quota exhaustion would empty the candidate
1755
+ * pool for a condition that clears in under a minute, the failure mode that
1756
+ * kept #4373's enforcement stage switched off.
1757
+ *
1758
+ * Without a `retryAfterMs` the provider gave no horizon, so nothing is
1759
+ * asserted: an exhaustion with no end is not distinguishable here from a
1760
+ * transient error, and inventing a horizon would manufacture a measurement.
1761
+ *
1762
+ * @param retryAfterMs - The provider's stated wait, from `retry-after`.
1763
+ * @returns true when the assertion was durable enough to record.
1764
+ */
1765
+ recordProviderQuotaExhaustion(retryAfterMs) {
1766
+ if (retryAfterMs === void 0 || retryAfterMs <= this.config.windowMs) return false;
1767
+ this.quotaExhaustedUntil = getTimeProvider().now() + retryAfterMs;
1768
+ return true;
1769
+ }
1732
1770
  /**
1733
1771
  * Gets time until the rate limit window resets.
1734
1772
  */
@@ -1745,6 +1783,7 @@ var CapacityTracker = class {
1745
1783
  this.requestTimestamps.length = 0;
1746
1784
  this.requestCount = 0;
1747
1785
  this.windowStart = getTimeProvider().now();
1786
+ this.quotaExhaustedUntil = null;
1748
1787
  }
1749
1788
  /**
1750
1789
  * Updates configuration (e.g., after receiving actual rate limit info).
@@ -1996,6 +2035,7 @@ var BaseCliAdapter = class {
1996
2035
  });
1997
2036
  return { ok: true, value: result.value.response };
1998
2037
  }
2038
+ this.recordQuotaSignal(result.error);
1999
2039
  this.logger.warn("Task execution failed", {
2000
2040
  cli: this.name,
2001
2041
  error: result.error.message,
@@ -2003,6 +2043,27 @@ var BaseCliAdapter = class {
2003
2043
  });
2004
2044
  return result;
2005
2045
  }
2046
+ /**
2047
+ * Feed a provider's own rate-limit assertion into capacity tracking (#4456).
2048
+ *
2049
+ * A `retry-after` the provider stated is far stronger evidence than local
2050
+ * counting: the tracker otherwise sees only this process's spend and cannot
2051
+ * observe a plan quota burned gradually or burned elsewhere, which is the
2052
+ * incident #4351 reported. Only RATE_LIMITED carries that assertion; the
2053
+ * tracker itself decides whether the stated wait is long enough to mean
2054
+ * durable quota rather than a per-minute throttle.
2055
+ */
2056
+ recordQuotaSignal(error) {
2057
+ if (error.code !== "RATE_LIMITED") return;
2058
+ if (this.capacityTracker === null) return;
2059
+ const recorded = this.capacityTracker.recordProviderQuotaExhaustion(error.retryAfterMs);
2060
+ if (recorded) {
2061
+ this.logger.warn("Provider asserted durable quota exhaustion", {
2062
+ cli: this.name,
2063
+ retryAfterMs: error.retryAfterMs
2064
+ });
2065
+ }
2066
+ }
2006
2067
  /**
2007
2068
  * Performs a health check.
2008
2069
  */
@@ -4762,4 +4823,4 @@ export {
4762
4823
  SdkAdapter,
4763
4824
  createAutoAdapter
4764
4825
  };
4765
- //# sourceMappingURL=chunk-ZFLZL6JL.js.map
4826
+ //# sourceMappingURL=chunk-45IB3F6G.js.map