nexus-agents 8.96.0 → 8.97.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/dist/{ast-rule-runner-QQIRWXJ4.js → ast-rule-runner-YBAZFEUB.js} +3 -3
  2. package/dist/{child-mcp-config-JTOIFT6B.js → child-mcp-config-VUERRL3V.js} +2 -2
  3. package/dist/{chunk-UVPFSWB3.js → chunk-62PINSC6.js} +2 -2
  4. package/dist/{chunk-E3DEDHRY.js → chunk-64R6TZYA.js} +3 -3
  5. package/dist/{chunk-OVE3YJSE.js → chunk-663MAM24.js} +2 -2
  6. package/dist/{chunk-HKTZFZSM.js → chunk-7JV3YVMZ.js} +5 -5
  7. package/dist/{chunk-KB7VXRC4.js → chunk-DEKU3ACZ.js} +2 -2
  8. package/dist/{chunk-FUU6LXIA.js → chunk-EAB77S7U.js} +7 -7
  9. package/dist/{chunk-S2FT4YA6.js → chunk-G6RDJRAV.js} +119 -60
  10. package/dist/chunk-G6RDJRAV.js.map +1 -0
  11. package/dist/{chunk-5I2I5G4U.js → chunk-GOQ6FHJD.js} +4 -4
  12. package/dist/{chunk-CSNLW5ZS.js → chunk-IX42AGSA.js} +2 -2
  13. package/dist/{chunk-UDWF2XCA.js → chunk-IXDWCPN3.js} +3 -3
  14. package/dist/{chunk-ON4YR4KS.js → chunk-JD4PKLC2.js} +2 -2
  15. package/dist/{chunk-LFZUQNUH.js → chunk-LKAH6IYE.js} +2 -2
  16. package/dist/{chunk-R6EP6UNC.js → chunk-MDYMP54L.js} +5 -5
  17. package/dist/{chunk-YUYYMYPU.js → chunk-MK4KQJZV.js} +2 -2
  18. package/dist/{chunk-A7LUQRS4.js → chunk-NITPS7VD.js} +2 -2
  19. package/dist/{chunk-KQJHYWF5.js → chunk-NPXNHUIL.js} +338 -165
  20. package/dist/chunk-NPXNHUIL.js.map +1 -0
  21. package/dist/{chunk-ZQJORAPU.js → chunk-OCMF5DK6.js} +2 -2
  22. package/dist/{chunk-NJ7ZYOFR.js → chunk-OTU374RO.js} +2 -2
  23. package/dist/{chunk-2A52CTLB.js → chunk-OUEHXYFU.js} +2 -2
  24. package/dist/{chunk-GWVSAAW4.js → chunk-PE6RRU2B.js} +3 -3
  25. package/dist/{chunk-6562BJ3L.js → chunk-Q5NXGSDC.js} +2 -2
  26. package/dist/{chunk-3CNLLCDQ.js → chunk-R45O47CR.js} +2 -2
  27. package/dist/{chunk-WFFE7JSD.js → chunk-SDIMXZZD.js} +10 -10
  28. package/dist/{chunk-DGWVJ6HB.js → chunk-SJBEXKHC.js} +4 -4
  29. package/dist/{chunk-BGW4CHYZ.js → chunk-SRFWE23A.js} +2 -2
  30. package/dist/{chunk-YKTA5UBL.js → chunk-T6CLFLGL.js} +13 -2
  31. package/dist/{chunk-YKTA5UBL.js.map → chunk-T6CLFLGL.js.map} +1 -1
  32. package/dist/{chunk-CYP33W2C.js → chunk-V66T427F.js} +2 -2
  33. package/dist/{chunk-F7CB7C3P.js → chunk-VU4LLVHS.js} +4 -4
  34. package/dist/{chunk-4LHLEHIS.js → chunk-WXE4XKDF.js} +10 -9
  35. package/dist/{chunk-OADHASVD.js → chunk-YFRCIJ5F.js} +8 -8
  36. package/dist/{chunk-5VW2Z25X.js → chunk-YLZPEK2H.js} +3 -3
  37. package/dist/{chunk-UKU5ZBZF.js → chunk-YX2V2Y5Q.js} +3 -3
  38. package/dist/{chunk-MEBD2TMO.js → chunk-ZUUXVQI6.js} +2 -2
  39. package/dist/{cli-circuit-breaker-AWZO2BAC.js → cli-circuit-breaker-BVQU6TSV.js} +3 -3
  40. package/dist/cli.js +42 -42
  41. package/dist/{composite-router-BLVJAOFR.js → composite-router-JODIOJ3T.js} +2 -2
  42. package/dist/{consensus-vote-BBLGVUVU.js → consensus-vote-NYXZBC5R.js} +16 -16
  43. package/dist/{context-retriever-QI63DBJI.js → context-retriever-VENNHB6Q.js} +8 -8
  44. package/dist/{doctor-deep-VJVT7H2S.js → doctor-deep-T2BEMMBG.js} +3 -3
  45. package/dist/{doctor-live-PNVKASBK.js → doctor-live-MYBKNA3S.js} +10 -10
  46. package/dist/{expert-bridge-WP7PJDNV.js → expert-bridge-DAJAYNMQ.js} +4 -4
  47. package/dist/{factory-H7WD46ZF.js → factory-LGXPPPBX.js} +5 -5
  48. package/dist/{factory-QJVIUHGU.js → factory-O427FFK5.js} +9 -9
  49. package/dist/{improvement-review-I6H7JWEF.js → improvement-review-KXTJMAY6.js} +5 -5
  50. package/dist/index.d.ts +71 -3
  51. package/dist/index.js +30 -30
  52. package/dist/{init-opencode-3FT4RSEY.js → init-opencode-4QFPIFJM.js} +5 -5
  53. package/dist/issue-triage-BIPWKL66.js +16 -0
  54. package/dist/{pr-reviewer-helpers-BLDZ3ZQ7.js → pr-reviewer-helpers-SJN6OUY6.js} +4 -4
  55. package/dist/{registry-command-CABQPLN4.js → registry-command-6U434CUU.js} +2 -2
  56. package/dist/{repo-security-plan-5GNN6EQ2.js → repo-security-plan-7GPJJ577.js} +3 -3
  57. package/dist/{research-helpers-synthesize-MOJKZLS5.js → research-helpers-synthesize-Z7JMKOOQ.js} +4 -4
  58. package/dist/{routing-memory-FRZ3EZBT.js → routing-memory-S2MZCJBE.js} +2 -2
  59. package/dist/{session-memory-K63UQWAN.js → session-memory-VOFCMXU6.js} +3 -3
  60. package/dist/{setup-config-54EYGCDL.js → setup-config-TWVGUC4Y.js} +3 -3
  61. package/dist/{setup-custom-api-YWOZHDPK.js → setup-custom-api-ONTEN2CU.js} +4 -4
  62. package/dist/setup-data-dir-K3SGRXGO.js +32 -0
  63. package/dist/{tool-memory-ZXN6EYVO.js → tool-memory-7JNUN7Z7.js} +5 -5
  64. package/dist/{unified-registry-BEYNDSAX.js → unified-registry-VOA2IUPK.js} +10 -10
  65. package/dist/{weather-report-YZIE7PAH.js → weather-report-NEHXHTWK.js} +2 -2
  66. package/package.json +1 -1
  67. package/dist/chunk-KQJHYWF5.js.map +0 -1
  68. package/dist/chunk-S2FT4YA6.js.map +0 -1
  69. package/dist/issue-triage-DP27HRIY.js +0 -16
  70. package/dist/setup-data-dir-HUGQDEYI.js +0 -32
  71. /package/dist/{ast-rule-runner-QQIRWXJ4.js.map → ast-rule-runner-YBAZFEUB.js.map} +0 -0
  72. /package/dist/{child-mcp-config-JTOIFT6B.js.map → child-mcp-config-VUERRL3V.js.map} +0 -0
  73. /package/dist/{chunk-UVPFSWB3.js.map → chunk-62PINSC6.js.map} +0 -0
  74. /package/dist/{chunk-E3DEDHRY.js.map → chunk-64R6TZYA.js.map} +0 -0
  75. /package/dist/{chunk-OVE3YJSE.js.map → chunk-663MAM24.js.map} +0 -0
  76. /package/dist/{chunk-HKTZFZSM.js.map → chunk-7JV3YVMZ.js.map} +0 -0
  77. /package/dist/{chunk-KB7VXRC4.js.map → chunk-DEKU3ACZ.js.map} +0 -0
  78. /package/dist/{chunk-FUU6LXIA.js.map → chunk-EAB77S7U.js.map} +0 -0
  79. /package/dist/{chunk-5I2I5G4U.js.map → chunk-GOQ6FHJD.js.map} +0 -0
  80. /package/dist/{chunk-CSNLW5ZS.js.map → chunk-IX42AGSA.js.map} +0 -0
  81. /package/dist/{chunk-UDWF2XCA.js.map → chunk-IXDWCPN3.js.map} +0 -0
  82. /package/dist/{chunk-ON4YR4KS.js.map → chunk-JD4PKLC2.js.map} +0 -0
  83. /package/dist/{chunk-LFZUQNUH.js.map → chunk-LKAH6IYE.js.map} +0 -0
  84. /package/dist/{chunk-R6EP6UNC.js.map → chunk-MDYMP54L.js.map} +0 -0
  85. /package/dist/{chunk-YUYYMYPU.js.map → chunk-MK4KQJZV.js.map} +0 -0
  86. /package/dist/{chunk-A7LUQRS4.js.map → chunk-NITPS7VD.js.map} +0 -0
  87. /package/dist/{chunk-ZQJORAPU.js.map → chunk-OCMF5DK6.js.map} +0 -0
  88. /package/dist/{chunk-NJ7ZYOFR.js.map → chunk-OTU374RO.js.map} +0 -0
  89. /package/dist/{chunk-2A52CTLB.js.map → chunk-OUEHXYFU.js.map} +0 -0
  90. /package/dist/{chunk-GWVSAAW4.js.map → chunk-PE6RRU2B.js.map} +0 -0
  91. /package/dist/{chunk-6562BJ3L.js.map → chunk-Q5NXGSDC.js.map} +0 -0
  92. /package/dist/{chunk-3CNLLCDQ.js.map → chunk-R45O47CR.js.map} +0 -0
  93. /package/dist/{chunk-WFFE7JSD.js.map → chunk-SDIMXZZD.js.map} +0 -0
  94. /package/dist/{chunk-DGWVJ6HB.js.map → chunk-SJBEXKHC.js.map} +0 -0
  95. /package/dist/{chunk-BGW4CHYZ.js.map → chunk-SRFWE23A.js.map} +0 -0
  96. /package/dist/{chunk-CYP33W2C.js.map → chunk-V66T427F.js.map} +0 -0
  97. /package/dist/{chunk-F7CB7C3P.js.map → chunk-VU4LLVHS.js.map} +0 -0
  98. /package/dist/{chunk-4LHLEHIS.js.map → chunk-WXE4XKDF.js.map} +0 -0
  99. /package/dist/{chunk-OADHASVD.js.map → chunk-YFRCIJ5F.js.map} +0 -0
  100. /package/dist/{chunk-5VW2Z25X.js.map → chunk-YLZPEK2H.js.map} +0 -0
  101. /package/dist/{chunk-UKU5ZBZF.js.map → chunk-YX2V2Y5Q.js.map} +0 -0
  102. /package/dist/{chunk-MEBD2TMO.js.map → chunk-ZUUXVQI6.js.map} +0 -0
  103. /package/dist/{cli-circuit-breaker-AWZO2BAC.js.map → cli-circuit-breaker-BVQU6TSV.js.map} +0 -0
  104. /package/dist/{composite-router-BLVJAOFR.js.map → composite-router-JODIOJ3T.js.map} +0 -0
  105. /package/dist/{consensus-vote-BBLGVUVU.js.map → consensus-vote-NYXZBC5R.js.map} +0 -0
  106. /package/dist/{context-retriever-QI63DBJI.js.map → context-retriever-VENNHB6Q.js.map} +0 -0
  107. /package/dist/{doctor-deep-VJVT7H2S.js.map → doctor-deep-T2BEMMBG.js.map} +0 -0
  108. /package/dist/{doctor-live-PNVKASBK.js.map → doctor-live-MYBKNA3S.js.map} +0 -0
  109. /package/dist/{expert-bridge-WP7PJDNV.js.map → expert-bridge-DAJAYNMQ.js.map} +0 -0
  110. /package/dist/{factory-H7WD46ZF.js.map → factory-LGXPPPBX.js.map} +0 -0
  111. /package/dist/{factory-QJVIUHGU.js.map → factory-O427FFK5.js.map} +0 -0
  112. /package/dist/{improvement-review-I6H7JWEF.js.map → improvement-review-KXTJMAY6.js.map} +0 -0
  113. /package/dist/{init-opencode-3FT4RSEY.js.map → init-opencode-4QFPIFJM.js.map} +0 -0
  114. /package/dist/{issue-triage-DP27HRIY.js.map → issue-triage-BIPWKL66.js.map} +0 -0
  115. /package/dist/{pr-reviewer-helpers-BLDZ3ZQ7.js.map → pr-reviewer-helpers-SJN6OUY6.js.map} +0 -0
  116. /package/dist/{registry-command-CABQPLN4.js.map → registry-command-6U434CUU.js.map} +0 -0
  117. /package/dist/{repo-security-plan-5GNN6EQ2.js.map → repo-security-plan-7GPJJ577.js.map} +0 -0
  118. /package/dist/{research-helpers-synthesize-MOJKZLS5.js.map → research-helpers-synthesize-Z7JMKOOQ.js.map} +0 -0
  119. /package/dist/{routing-memory-FRZ3EZBT.js.map → routing-memory-S2MZCJBE.js.map} +0 -0
  120. /package/dist/{session-memory-K63UQWAN.js.map → session-memory-VOFCMXU6.js.map} +0 -0
  121. /package/dist/{setup-config-54EYGCDL.js.map → setup-config-TWVGUC4Y.js.map} +0 -0
  122. /package/dist/{setup-custom-api-YWOZHDPK.js.map → setup-custom-api-ONTEN2CU.js.map} +0 -0
  123. /package/dist/{setup-data-dir-HUGQDEYI.js.map → setup-data-dir-K3SGRXGO.js.map} +0 -0
  124. /package/dist/{tool-memory-ZXN6EYVO.js.map → tool-memory-7JNUN7Z7.js.map} +0 -0
  125. /package/dist/{unified-registry-BEYNDSAX.js.map → unified-registry-VOA2IUPK.js.map} +0 -0
  126. /package/dist/{weather-report-YZIE7PAH.js.map → weather-report-NEHXHTWK.js.map} +0 -0
@@ -9,8 +9,8 @@ import {
9
9
  getBuiltInAstRulesPath,
10
10
  loadRules,
11
11
  runAstQaRules
12
- } from "./chunk-A7LUQRS4.js";
13
- import "./chunk-UDWF2XCA.js";
12
+ } from "./chunk-NITPS7VD.js";
13
+ import "./chunk-IXDWCPN3.js";
14
14
  import "./chunk-UE7A2XHM.js";
15
15
  import "./chunk-LWOX65CP.js";
16
16
  import "./chunk-PX6F3LHL.js";
@@ -26,4 +26,4 @@ export {
26
26
  loadRules,
27
27
  runAstQaRules
28
28
  };
29
- //# sourceMappingURL=ast-rule-runner-QQIRWXJ4.js.map
29
+ //# sourceMappingURL=ast-rule-runner-YBAZFEUB.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-OITVVSWO.js";
4
4
  import {
5
5
  createLogger
6
- } from "./chunk-UDWF2XCA.js";
6
+ } from "./chunk-IXDWCPN3.js";
7
7
  import "./chunk-UE7A2XHM.js";
8
8
  import "./chunk-LWOX65CP.js";
9
9
  import "./chunk-PX6F3LHL.js";
@@ -56,4 +56,4 @@ async function generateMcpConfig(options) {
56
56
  export {
57
57
  generateMcpConfig
58
58
  };
59
- //# sourceMappingURL=child-mcp-config-JTOIFT6B.js.map
59
+ //# sourceMappingURL=child-mcp-config-VUERRL3V.js.map
@@ -5,7 +5,7 @@ import {
5
5
  err,
6
6
  getErrorMessage,
7
7
  ok
8
- } from "./chunk-UDWF2XCA.js";
8
+ } from "./chunk-IXDWCPN3.js";
9
9
  import {
10
10
  findRepoRoot,
11
11
  getActiveWorkspaceRoot,
@@ -290,4 +290,4 @@ export {
290
290
  loadPapersRegistry,
291
291
  savePapersRegistry
292
292
  };
293
- //# sourceMappingURL=chunk-UVPFSWB3.js.map
293
+ //# sourceMappingURL=chunk-62PINSC6.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  loadPapersRegistry
3
- } from "./chunk-UVPFSWB3.js";
3
+ } from "./chunk-62PINSC6.js";
4
4
  import {
5
5
  getErrorMessage
6
- } from "./chunk-UDWF2XCA.js";
6
+ } from "./chunk-IXDWCPN3.js";
7
7
 
8
8
  // src/cli/research-helpers-synthesize.ts
9
9
  import { z } from "zod";
@@ -876,4 +876,4 @@ export {
876
876
  AttributedInsightSchema,
877
877
  synthesizeResearch
878
878
  };
879
- //# sourceMappingURL=chunk-E3DEDHRY.js.map
879
+ //# sourceMappingURL=chunk-64R6TZYA.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getErrorMessage
3
- } from "./chunk-UDWF2XCA.js";
3
+ } from "./chunk-IXDWCPN3.js";
4
4
 
5
5
  // src/cli/setup-config.ts
6
6
  import { copyFileSync, existsSync, mkdirSync, writeFileSync } from "node:fs";
@@ -77,4 +77,4 @@ function ensureBackup(outputPath) {
77
77
  export {
78
78
  runConfigInitSync
79
79
  };
80
- //# sourceMappingURL=chunk-OVE3YJSE.js.map
80
+ //# sourceMappingURL=chunk-663MAM24.js.map
@@ -8,13 +8,13 @@ import {
8
8
  loadTechniquesRegistry,
9
9
  resolveInsideRoot,
10
10
  savePapersRegistry
11
- } from "./chunk-UVPFSWB3.js";
11
+ } from "./chunk-62PINSC6.js";
12
12
  import {
13
13
  resolveToken
14
- } from "./chunk-ON4YR4KS.js";
14
+ } from "./chunk-JD4PKLC2.js";
15
15
  import {
16
16
  getToolMemory
17
- } from "./chunk-F7CB7C3P.js";
17
+ } from "./chunk-VU4LLVHS.js";
18
18
  import {
19
19
  capitalizeWords,
20
20
  tokenizeFiltered,
@@ -43,7 +43,7 @@ import {
43
43
  ok,
44
44
  registerPersistentDistillerFactory,
45
45
  sigmoidConfidence
46
- } from "./chunk-UDWF2XCA.js";
46
+ } from "./chunk-IXDWCPN3.js";
47
47
  import {
48
48
  ensureLearningDir,
49
49
  getRulesFile
@@ -4275,4 +4275,4 @@ export {
4275
4275
  DEFAULT_CONTEXT_BUDGET_TOKENS,
4276
4276
  getContextPromptPrefix
4277
4277
  };
4278
- //# sourceMappingURL=chunk-HKTZFZSM.js.map
4278
+ //# sourceMappingURL=chunk-7JV3YVMZ.js.map
@@ -10,7 +10,7 @@ import {
10
10
  isRateLimitText,
11
11
  observedArmDisplaySlot,
12
12
  ok
13
- } from "./chunk-UDWF2XCA.js";
13
+ } from "./chunk-IXDWCPN3.js";
14
14
 
15
15
  // src/cli-adapters/circuit-breaker-types.ts
16
16
  var CircuitErrorCode = {
@@ -592,4 +592,4 @@ export {
592
592
  CliCircuitBreakerIntegration,
593
593
  createCliCircuitBreakerIntegration
594
594
  };
595
- //# sourceMappingURL=chunk-KB7VXRC4.js.map
595
+ //# sourceMappingURL=chunk-DEKU3ACZ.js.map
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  resolveCliSlot
3
- } from "./chunk-YUYYMYPU.js";
3
+ } from "./chunk-MK4KQJZV.js";
4
4
  import {
5
5
  createLogger,
6
6
  getTimeProvider,
7
7
  isRateLimitText
8
- } from "./chunk-UDWF2XCA.js";
8
+ } from "./chunk-IXDWCPN3.js";
9
9
 
10
10
  // src/pipeline/expert-bridge.ts
11
11
  function resolveCliFromModelString(model) {
@@ -30,7 +30,7 @@ async function getMcpConfigPath() {
30
30
  if (cachedMcpConfigPath !== null) return cachedMcpConfigPath;
31
31
  mcpConfigInitPromise ??= (async () => {
32
32
  try {
33
- const { generateMcpConfig } = await import("./child-mcp-config-JTOIFT6B.js");
33
+ const { generateMcpConfig } = await import("./child-mcp-config-VUERRL3V.js");
34
34
  const config = await generateMcpConfig();
35
35
  cachedMcpConfigPath = config.configPath;
36
36
  cachedMcpConfigCleanup = config.cleanup;
@@ -107,8 +107,8 @@ var routerInitPromise = null;
107
107
  async function getRouter() {
108
108
  if (cachedRouter !== null) return cachedRouter;
109
109
  routerInitPromise ??= (async () => {
110
- const { createAllAdapters } = await import("./factory-QJVIUHGU.js");
111
- const { createCompositeRouter } = await import("./composite-router-BLVJAOFR.js");
110
+ const { createAllAdapters } = await import("./factory-O427FFK5.js");
111
+ const { createCompositeRouter } = await import("./composite-router-JODIOJ3T.js");
112
112
  const adapters = createAllAdapters();
113
113
  if (adapters.size === 0) {
114
114
  routerInitPromise = null;
@@ -116,7 +116,7 @@ async function getRouter() {
116
116
  }
117
117
  cachedRouter = adaptCompositeRouter(createCompositeRouter(adapters));
118
118
  try {
119
- const { createCliCircuitBreakerIntegration } = await import("./cli-circuit-breaker-AWZO2BAC.js");
119
+ const { createCliCircuitBreakerIntegration } = await import("./cli-circuit-breaker-BVQU6TSV.js");
120
120
  cachedCircuitBreaker = createCliCircuitBreakerIntegration([...adapters.values()]);
121
121
  } catch (error) {
122
122
  const msg = error instanceof Error ? error.message : String(error);
@@ -248,4 +248,4 @@ export {
248
248
  tokenSplitFromUsage,
249
249
  executeExpert
250
250
  };
251
- //# sourceMappingURL=chunk-FUU6LXIA.js.map
251
+ //# sourceMappingURL=chunk-EAB77S7U.js.map
@@ -1,22 +1,25 @@
1
1
  import {
2
2
  BaseAdapter,
3
3
  createStream,
4
+ getMaxTokensParamForModel,
4
5
  planOptionalParams,
5
6
  requireApiKey,
6
7
  validateApiKeyPresence
7
- } from "./chunk-YKTA5UBL.js";
8
+ } from "./chunk-T6CLFLGL.js";
8
9
  import {
9
10
  assertCustomApiHostResolvesPublic,
10
11
  hostnameOf,
11
12
  redactApiKey
12
- } from "./chunk-3CNLLCDQ.js";
13
+ } from "./chunk-R45O47CR.js";
13
14
  import {
14
15
  sanitizeErrorDetails
15
16
  } from "./chunk-2NDA4DHW.js";
16
17
  import {
17
18
  ConfigError,
18
19
  DEFAULT_OPENAI_COMPAT_ENDPOINT,
20
+ ErrorCode,
19
21
  ModelCapability,
22
+ ModelError,
20
23
  OPENAI_COMPAT_ENDPOINT_ENV,
21
24
  OPENAI_COMPAT_KEY_ENV,
22
25
  OPENAI_COMPAT_MODELS_ENV,
@@ -32,7 +35,7 @@ import {
32
35
  isEndpointArmId,
33
36
  ok,
34
37
  recordUsageEvent
35
- } from "./chunk-UDWF2XCA.js";
38
+ } from "./chunk-IXDWCPN3.js";
36
39
 
37
40
  // src/adapters/openai-types.ts
38
41
  var OPENAI_MODELS = {
@@ -93,12 +96,42 @@ function mapStopReason(openaiReason) {
93
96
  case "tool_calls":
94
97
  case "function_call":
95
98
  return "tool_use";
96
- case "content_filter":
97
- return "end_turn";
99
+ // `content_filter` is never mapped as a finish: the adapter turns it into an
100
+ // error before a response is built (#6607, see detectNonAnswer), because
101
+ // every consumer reads a mapped response as an answer.
98
102
  default:
99
103
  return "end_turn";
100
104
  }
101
105
  }
106
+ var CONTENT_FILTERED = {
107
+ reason: "content_filter",
108
+ detail: "the reply was blocked by a content filter"
109
+ };
110
+ function detectNonAnswer(choice, usage, reasoningFamily) {
111
+ if (choice.finish_reason === "content_filter") return CONTENT_FILTERED;
112
+ if (choice.finish_reason !== "length" || hasVisibleOutput(choice)) return void 0;
113
+ const reasoningTokens = usage?.completion_tokens_details?.reasoning_tokens;
114
+ if (!reasoningFamily && !(reasoningTokens !== void 0 && reasoningTokens > 0)) {
115
+ return void 0;
116
+ }
117
+ return {
118
+ reason: "reasoning_truncated",
119
+ detail: "the completion budget was spent on reasoning before any output (empty reply, finish length)",
120
+ ...reasoningTokens !== void 0 ? { reasoningTokens } : {}
121
+ };
122
+ }
123
+ function hasVisibleOutput(choice) {
124
+ const text = choice.message.content;
125
+ if (text !== null && text !== "") return true;
126
+ return (choice.message.tool_calls?.length ?? 0) > 0;
127
+ }
128
+ function parseToolArguments(args) {
129
+ try {
130
+ return JSON.parse(args);
131
+ } catch {
132
+ return { _raw: args };
133
+ }
134
+ }
102
135
  function mapChoiceToContentBlocks(choice) {
103
136
  const blocks = [];
104
137
  const message = choice.message;
@@ -108,17 +141,11 @@ function mapChoiceToContentBlocks(choice) {
108
141
  if (message.tool_calls !== void 0 && message.tool_calls.length > 0) {
109
142
  for (const toolCall of message.tool_calls) {
110
143
  if (isFunctionToolCall(toolCall)) {
111
- let parsedInput;
112
- try {
113
- parsedInput = JSON.parse(toolCall.function.arguments);
114
- } catch {
115
- parsedInput = { _raw: toolCall.function.arguments };
116
- }
117
144
  blocks.push({
118
145
  type: "tool_use",
119
146
  id: toolCall.id,
120
147
  name: toolCall.function.name,
121
- input: parsedInput
148
+ input: parseToolArguments(toolCall.function.arguments)
122
149
  });
123
150
  }
124
151
  }
@@ -130,12 +157,12 @@ function mapChoiceToContentBlocks(choice) {
130
157
  }
131
158
  function mapMessage(message) {
132
159
  if (message.role === "system") {
133
- return mapSystemMessage(message);
160
+ return [mapSystemMessage(message)];
134
161
  }
135
162
  if (message.role === "user") {
136
163
  return mapUserMessage(message);
137
164
  }
138
- return mapAssistantMessage(message);
165
+ return [mapAssistantMessage(message)];
139
166
  }
140
167
  function mapSystemMessage(message) {
141
168
  const content = typeof message.content === "string" ? message.content : message.content.filter((b) => b.type === "text").map((b) => b.text).join("\n");
@@ -143,20 +170,17 @@ function mapSystemMessage(message) {
143
170
  }
144
171
  function mapUserMessage(message) {
145
172
  if (typeof message.content === "string") {
146
- return { role: "user", content: message.content };
173
+ return [{ role: "user", content: message.content }];
147
174
  }
148
175
  const toolResults = message.content.filter(
149
176
  (b) => b.type === "tool_result"
150
177
  );
151
178
  if (toolResults.length > 0) {
152
- const firstResult = toolResults[0];
153
- if (firstResult !== void 0) {
154
- return {
155
- role: "tool",
156
- tool_call_id: firstResult.tool_use_id,
157
- content: firstResult.content
158
- };
159
- }
179
+ return toolResults.map((result) => ({
180
+ role: "tool",
181
+ tool_call_id: result.tool_use_id,
182
+ content: result.content
183
+ }));
160
184
  }
161
185
  const content = message.content.map((block) => {
162
186
  if (block.type === "text") {
@@ -172,7 +196,7 @@ function mapUserMessage(message) {
172
196
  }
173
197
  return { type: "text", text: "" };
174
198
  });
175
- return { role: "user", content };
199
+ return [{ role: "user", content }];
176
200
  }
177
201
  function mapAssistantMessage(message) {
178
202
  if (typeof message.content === "string") {
@@ -238,29 +262,36 @@ function mapContentDelta(delta, currentIndex, hasStarted) {
238
262
  }
239
263
  return chunks;
240
264
  }
241
- function mapToolCallsDelta(delta) {
242
- const chunks = [];
243
- if (delta.tool_calls !== void 0 && delta.tool_calls.length > 0) {
244
- for (const toolCall of delta.tool_calls) {
245
- if (toolCall.function?.name !== void 0) {
246
- chunks.push({
247
- type: "content_block_start",
248
- index: toolCall.index,
249
- contentBlock: {
250
- type: "tool_use",
251
- id: toolCall.id ?? "",
252
- name: toolCall.function.name,
253
- input: {}
254
- }
255
- });
256
- }
257
- }
265
+ function createStreamToolCallState() {
266
+ return { calls: /* @__PURE__ */ new Map() };
267
+ }
268
+ function accumulateToolCallsDelta(delta, state) {
269
+ for (const toolCall of delta.tool_calls ?? []) {
270
+ const entry = state.calls.get(toolCall.index) ?? { id: "", name: "", args: "" };
271
+ if (toolCall.id !== void 0) entry.id = toolCall.id;
272
+ if (toolCall.function?.name !== void 0) entry.name = toolCall.function.name;
273
+ if (toolCall.function?.arguments !== void 0) entry.args += toolCall.function.arguments;
274
+ state.calls.set(toolCall.index, entry);
258
275
  }
276
+ }
277
+ function flushToolCalls(state) {
278
+ const chunks = [...state.calls.entries()].sort(([a], [b]) => a - b).map(([index, call]) => ({
279
+ type: "content_block_start",
280
+ index,
281
+ contentBlock: {
282
+ type: "tool_use",
283
+ id: call.id,
284
+ name: call.name,
285
+ input: call.args === "" ? {} : parseToolArguments(call.args)
286
+ }
287
+ }));
288
+ state.calls.clear();
259
289
  return chunks;
260
290
  }
261
- function mapFinishChunks(choice, chunk, currentIndex) {
291
+ function mapFinishChunks(choice, chunk, currentIndex, toolCalls) {
262
292
  const chunks = [];
263
293
  if (choice.finish_reason !== null) {
294
+ chunks.push(...flushToolCalls(toolCalls));
264
295
  chunks.push({
265
296
  type: "content_block_stop",
266
297
  index: currentIndex
@@ -284,7 +315,7 @@ function mapFinishChunks(choice, chunk, currentIndex) {
284
315
  }
285
316
  return chunks;
286
317
  }
287
- function mapStreamChunk(chunk, currentIndex, hasStarted) {
318
+ function mapStreamChunk(chunk, currentIndex, hasStarted, toolCalls) {
288
319
  const chunks = [];
289
320
  const choice = chunk.choices[0];
290
321
  if (!hasStarted) {
@@ -298,8 +329,8 @@ function mapStreamChunk(chunk, currentIndex, hasStarted) {
298
329
  }
299
330
  const delta = choice.delta;
300
331
  chunks.push(...mapContentDelta(delta, currentIndex, hasStarted));
301
- chunks.push(...mapToolCallsDelta(delta));
302
- chunks.push(...mapFinishChunks(choice, chunk, currentIndex));
332
+ accumulateToolCallsDelta(delta, toolCalls);
333
+ chunks.push(...mapFinishChunks(choice, chunk, currentIndex, toolCalls));
303
334
  return chunks;
304
335
  }
305
336
 
@@ -477,8 +508,12 @@ var OpenAIAdapter = class extends BaseAdapter {
477
508
  const stream = await this.client.chat.completions.create({ ...params, stream: true });
478
509
  let contentIndex = 0;
479
510
  let hasStarted = false;
511
+ const toolCalls = createStreamToolCallState();
480
512
  for await (const chunk of stream) {
481
- const mappedChunks = mapStreamChunk(chunk, contentIndex, hasStarted);
513
+ if (chunk.choices[0]?.finish_reason === "content_filter") {
514
+ throw nonAnswerError(`${this.providerId}/${this.modelId}`, CONTENT_FILTERED, chunk.model);
515
+ }
516
+ const mappedChunks = mapStreamChunk(chunk, contentIndex, hasStarted, toolCalls);
482
517
  for (const mappedChunk of mappedChunks) {
483
518
  if (mappedChunk.type === "message_start") {
484
519
  hasStarted = true;
@@ -503,7 +538,7 @@ var OpenAIAdapter = class extends BaseAdapter {
503
538
  const params = {
504
539
  model: this.resolvedModelId,
505
540
  messages,
506
- max_completion_tokens: request.maxTokens ?? DEFAULT_MAX_TOKENS
541
+ max_completion_tokens: request.maxTokens ?? this.defaultMaxCompletionTokens()
507
542
  };
508
543
  const dropped = this.addOptionalParams(params, request);
509
544
  return { params, dropped };
@@ -520,7 +555,7 @@ var OpenAIAdapter = class extends BaseAdapter {
520
555
  if (msg.role === "system" && request.systemPrompt !== void 0) {
521
556
  continue;
522
557
  }
523
- messages.push(mapMessage(msg));
558
+ messages.push(...mapMessage(msg));
524
559
  }
525
560
  return messages;
526
561
  }
@@ -566,8 +601,15 @@ var OpenAIAdapter = class extends BaseAdapter {
566
601
  mapResponse(response, dropped = []) {
567
602
  const firstChoice = response.choices[0];
568
603
  if (firstChoice === void 0) {
569
- return this.createEmptyResponse(response, dropped);
604
+ throw nonAnswerError(
605
+ `${this.providerId}/${this.modelId}`,
606
+ { reason: "no_choices", detail: "the response contained no choices" },
607
+ response.model
608
+ );
570
609
  }
610
+ const nonAnswer = detectNonAnswer(firstChoice, response.usage, this.isReasoningFamily());
611
+ if (nonAnswer !== void 0)
612
+ throw nonAnswerError(`${this.providerId}/${this.modelId}`, nonAnswer, response.model);
571
613
  const content = mapChoiceToContentBlocks(firstChoice);
572
614
  const usage = mapResponseUsage(response);
573
615
  return {
@@ -581,17 +623,23 @@ var OpenAIAdapter = class extends BaseAdapter {
581
623
  };
582
624
  }
583
625
  /**
584
- * Creates an empty response when no choices are returned.
626
+ * Reasoning families are the models that take `max_completion_tokens`
627
+ * (o-series, gpt-5, codex); the registry answers first, a regex second.
585
628
  */
586
- createEmptyResponse(response, dropped = []) {
587
- const emptyUsage = mapResponseUsage(response);
588
- return {
589
- content: [{ type: "text", text: "" }],
590
- ...emptyUsage !== void 0 ? { usage: emptyUsage } : {},
591
- stopReason: "end_turn",
592
- model: response.model,
593
- ...dropped.length > 0 ? { warnings: dropped } : {}
594
- };
629
+ isReasoningFamily() {
630
+ return getMaxTokensParamForModel(this.resolvedModelId) === "max_completion_tokens";
631
+ }
632
+ /**
633
+ * Default completion cap when the request sets none (#6607). On a reasoning
634
+ * model the cap covers hidden reasoning tokens AND the visible reply, and
635
+ * 4,096 can be spent entirely on reasoning, leaving an empty reply. OpenAI's
636
+ * reasoning guide recommends reserving at least 25,000 tokens for reasoning
637
+ * and output when starting out, so that is the reasoning default. It is a
638
+ * ceiling, not a spend: a reply that finishes early is billed for what it
639
+ * used. Other models keep `DEFAULT_MAX_TOKENS`.
640
+ */
641
+ defaultMaxCompletionTokens() {
642
+ return this.isReasoningFamily() ? REASONING_DEFAULT_MAX_COMPLETION_TOKENS : DEFAULT_MAX_TOKENS;
595
643
  }
596
644
  /**
597
645
  * (#2529) List models served by this OpenAI-compatible endpoint.
@@ -640,6 +688,17 @@ var OpenAIAdapter = class extends BaseAdapter {
640
688
  }
641
689
  };
642
690
  var LIST_MODELS_TTL_MS = 5 * 60 * 1e3;
691
+ var REASONING_DEFAULT_MAX_COMPLETION_TOKENS = 25e3;
692
+ function nonAnswerError(source, nonAnswer, servedModel) {
693
+ return new ModelError(`${source}: ${nonAnswer.detail}`, {
694
+ code: ErrorCode.MODEL_ERROR,
695
+ context: {
696
+ reason: nonAnswer.reason,
697
+ ...servedModel !== void 0 ? { servedModel } : {},
698
+ ...nonAnswer.reasoningTokens !== void 0 ? { reasoningTokens: nonAnswer.reasoningTokens } : {}
699
+ }
700
+ });
701
+ }
643
702
  function createOpenAIAdapter(config) {
644
703
  return new OpenAIAdapter(config);
645
704
  }
@@ -1047,4 +1106,4 @@ export {
1047
1106
  discoverModels,
1048
1107
  buildOpenAICompatAdapters
1049
1108
  };
1050
- //# sourceMappingURL=chunk-S2FT4YA6.js.map
1109
+ //# sourceMappingURL=chunk-G6RDJRAV.js.map