gsd-pi 2.72.0-dev.3118184 → 2.72.0-dev.4f3264a

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 (183) hide show
  1. package/dist/resources/extensions/async-jobs/await-tool.js +4 -7
  2. package/dist/resources/extensions/async-jobs/job-manager.js +3 -28
  3. package/dist/resources/extensions/claude-code-cli/stream-adapter.js +26 -27
  4. package/dist/resources/extensions/gsd/auto/loop.js +1 -84
  5. package/dist/resources/extensions/gsd/auto-post-unit.js +0 -6
  6. package/dist/resources/extensions/gsd/auto.js +19 -25
  7. package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +11 -9
  8. package/dist/resources/extensions/gsd/commands-handlers.js +1 -4
  9. package/dist/resources/extensions/gsd/context-injector.js +1 -1
  10. package/dist/resources/extensions/gsd/custom-workflow-engine.js +7 -3
  11. package/dist/resources/extensions/gsd/gsd-db.js +5 -47
  12. package/dist/resources/extensions/gsd/key-manager.js +0 -2
  13. package/dist/resources/extensions/gsd/preferences-skills.js +34 -2
  14. package/dist/resources/extensions/gsd/preferences-types.js +0 -15
  15. package/dist/resources/extensions/gsd/preferences.js +3 -16
  16. package/dist/resources/extensions/gsd/prompt-loader.js +1 -4
  17. package/dist/resources/extensions/gsd/state.js +1 -21
  18. package/dist/resources/extensions/gsd/write-intercept.js +1 -10
  19. package/dist/resources/extensions/ollama/index.js +5 -4
  20. package/dist/resources/extensions/ollama/ollama-client.js +6 -35
  21. package/dist/resources/extensions/ollama/ollama-discovery.js +6 -32
  22. package/dist/web/standalone/.next/BUILD_ID +1 -1
  23. package/dist/web/standalone/.next/app-path-routes-manifest.json +12 -12
  24. package/dist/web/standalone/.next/build-manifest.json +2 -2
  25. package/dist/web/standalone/.next/prerender-manifest.json +3 -3
  26. package/dist/web/standalone/.next/server/app/_global-error/page.js +3 -3
  27. package/dist/web/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  28. package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
  29. package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
  30. package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  31. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  32. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  33. package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  34. package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  35. package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  36. package/dist/web/standalone/.next/server/app/_not-found/page.js +2 -2
  37. package/dist/web/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  38. package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
  39. package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
  40. package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  41. package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  42. package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  43. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  44. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  45. package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  46. package/dist/web/standalone/.next/server/app/api/boot/route.js +1 -1
  47. package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js +1 -1
  48. package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js +1 -1
  49. package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js +2 -2
  50. package/dist/web/standalone/.next/server/app/api/browse-directories/route.js +1 -1
  51. package/dist/web/standalone/.next/server/app/api/captures/route.js +1 -1
  52. package/dist/web/standalone/.next/server/app/api/cleanup/route.js +1 -1
  53. package/dist/web/standalone/.next/server/app/api/dev-mode/route.js +1 -1
  54. package/dist/web/standalone/.next/server/app/api/doctor/route.js +1 -1
  55. package/dist/web/standalone/.next/server/app/api/experimental/route.js +2 -2
  56. package/dist/web/standalone/.next/server/app/api/export-data/route.js +1 -1
  57. package/dist/web/standalone/.next/server/app/api/files/route.js +1 -1
  58. package/dist/web/standalone/.next/server/app/api/forensics/route.js +1 -1
  59. package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
  60. package/dist/web/standalone/.next/server/app/api/history/route.js +1 -1
  61. package/dist/web/standalone/.next/server/app/api/hooks/route.js +1 -1
  62. package/dist/web/standalone/.next/server/app/api/inspect/route.js +1 -1
  63. package/dist/web/standalone/.next/server/app/api/knowledge/route.js +1 -1
  64. package/dist/web/standalone/.next/server/app/api/live-state/route.js +1 -1
  65. package/dist/web/standalone/.next/server/app/api/notifications/route.js +2 -2
  66. package/dist/web/standalone/.next/server/app/api/onboarding/route.js +1 -1
  67. package/dist/web/standalone/.next/server/app/api/preferences/route.js +1 -1
  68. package/dist/web/standalone/.next/server/app/api/projects/route.js +1 -1
  69. package/dist/web/standalone/.next/server/app/api/recovery/route.js +1 -1
  70. package/dist/web/standalone/.next/server/app/api/remote-questions/route.js +2 -2
  71. package/dist/web/standalone/.next/server/app/api/session/browser/route.js +1 -1
  72. package/dist/web/standalone/.next/server/app/api/session/command/route.js +1 -1
  73. package/dist/web/standalone/.next/server/app/api/session/events/route.js +2 -2
  74. package/dist/web/standalone/.next/server/app/api/session/manage/route.js +1 -1
  75. package/dist/web/standalone/.next/server/app/api/settings-data/route.js +1 -1
  76. package/dist/web/standalone/.next/server/app/api/shutdown/route.js +1 -1
  77. package/dist/web/standalone/.next/server/app/api/skill-health/route.js +1 -1
  78. package/dist/web/standalone/.next/server/app/api/steer/route.js +1 -1
  79. package/dist/web/standalone/.next/server/app/api/switch-root/route.js +1 -1
  80. package/dist/web/standalone/.next/server/app/api/terminal/input/route.js +2 -2
  81. package/dist/web/standalone/.next/server/app/api/terminal/resize/route.js +2 -2
  82. package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js +2 -2
  83. package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js +3 -3
  84. package/dist/web/standalone/.next/server/app/api/terminal/upload/route.js +1 -1
  85. package/dist/web/standalone/.next/server/app/api/undo/route.js +1 -1
  86. package/dist/web/standalone/.next/server/app/api/update/route.js +1 -1
  87. package/dist/web/standalone/.next/server/app/api/visualizer/route.js +1 -1
  88. package/dist/web/standalone/.next/server/app/index.html +1 -1
  89. package/dist/web/standalone/.next/server/app/index.rsc +1 -1
  90. package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  91. package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
  92. package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  93. package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
  94. package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  95. package/dist/web/standalone/.next/server/app/page.js +2 -2
  96. package/dist/web/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  97. package/dist/web/standalone/.next/server/app-paths-manifest.json +12 -12
  98. package/dist/web/standalone/.next/server/chunks/2331.js +16 -16
  99. package/dist/web/standalone/.next/server/chunks/4741.js +12 -12
  100. package/dist/web/standalone/.next/server/chunks/5822.js +2 -2
  101. package/dist/web/standalone/.next/server/chunks/63.js +8 -8
  102. package/dist/web/standalone/.next/server/chunks/6897.js +3 -3
  103. package/dist/web/standalone/.next/server/functions-config-manifest.json +9 -0
  104. package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
  105. package/dist/web/standalone/.next/server/middleware-manifest.json +2 -29
  106. package/dist/web/standalone/.next/server/middleware.js +12 -4
  107. package/dist/web/standalone/.next/server/pages/404.html +1 -1
  108. package/dist/web/standalone/.next/server/pages/500.html +1 -1
  109. package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
  110. package/dist/web/standalone/.next/server/webpack-runtime.js +1 -1
  111. package/package.json +1 -1
  112. package/packages/pi-ai/dist/env-api-keys.js +0 -1
  113. package/packages/pi-ai/dist/env-api-keys.js.map +1 -1
  114. package/packages/pi-ai/dist/models.custom.d.ts +0 -105
  115. package/packages/pi-ai/dist/models.custom.d.ts.map +1 -1
  116. package/packages/pi-ai/dist/models.custom.js +0 -97
  117. package/packages/pi-ai/dist/models.custom.js.map +1 -1
  118. package/packages/pi-ai/dist/models.generated.d.ts +140 -648
  119. package/packages/pi-ai/dist/models.generated.d.ts.map +1 -1
  120. package/packages/pi-ai/dist/models.generated.js +364 -861
  121. package/packages/pi-ai/dist/models.generated.js.map +1 -1
  122. package/packages/pi-ai/dist/models.test.js +0 -105
  123. package/packages/pi-ai/dist/models.test.js.map +1 -1
  124. package/packages/pi-ai/dist/types.d.ts +1 -1
  125. package/packages/pi-ai/dist/types.d.ts.map +1 -1
  126. package/packages/pi-ai/dist/types.js.map +1 -1
  127. package/packages/pi-ai/src/env-api-keys.ts +0 -1
  128. package/packages/pi-ai/src/models.custom.ts +0 -98
  129. package/packages/pi-ai/src/models.generated.ts +364 -861
  130. package/packages/pi-ai/src/models.test.ts +0 -135
  131. package/packages/pi-ai/src/types.ts +0 -1
  132. package/packages/pi-coding-agent/dist/core/model-resolver.d.ts.map +1 -1
  133. package/packages/pi-coding-agent/dist/core/model-resolver.js +0 -1
  134. package/packages/pi-coding-agent/dist/core/model-resolver.js.map +1 -1
  135. package/packages/pi-coding-agent/src/core/model-resolver.ts +0 -1
  136. package/src/resources/extensions/async-jobs/await-tool.test.ts +7 -40
  137. package/src/resources/extensions/async-jobs/await-tool.ts +4 -7
  138. package/src/resources/extensions/async-jobs/job-manager.ts +3 -33
  139. package/src/resources/extensions/claude-code-cli/stream-adapter.ts +26 -27
  140. package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +2 -20
  141. package/src/resources/extensions/gsd/auto/loop.ts +1 -89
  142. package/src/resources/extensions/gsd/auto-post-unit.ts +0 -7
  143. package/src/resources/extensions/gsd/auto.ts +20 -25
  144. package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +10 -8
  145. package/src/resources/extensions/gsd/commands-handlers.ts +1 -5
  146. package/src/resources/extensions/gsd/context-injector.ts +1 -1
  147. package/src/resources/extensions/gsd/custom-workflow-engine.ts +8 -4
  148. package/src/resources/extensions/gsd/gsd-db.ts +5 -52
  149. package/src/resources/extensions/gsd/key-manager.ts +0 -2
  150. package/src/resources/extensions/gsd/preferences-skills.ts +36 -2
  151. package/src/resources/extensions/gsd/preferences-types.ts +0 -16
  152. package/src/resources/extensions/gsd/preferences.ts +6 -19
  153. package/src/resources/extensions/gsd/prompt-loader.ts +1 -6
  154. package/src/resources/extensions/gsd/state.ts +0 -20
  155. package/src/resources/extensions/gsd/tests/gsd-db.test.ts +0 -74
  156. package/src/resources/extensions/gsd/tests/key-manager.test.ts +0 -63
  157. package/src/resources/extensions/gsd/tests/preferences.test.ts +0 -53
  158. package/src/resources/extensions/gsd/write-intercept.ts +1 -10
  159. package/src/resources/extensions/ollama/index.ts +5 -4
  160. package/src/resources/extensions/ollama/ollama-client.ts +6 -35
  161. package/src/resources/extensions/ollama/ollama-discovery.ts +6 -37
  162. package/src/resources/extensions/ollama/tests/ollama-discovery.test.ts +0 -54
  163. package/dist/resources/extensions/gsd/definition-io.js +0 -15
  164. package/dist/web/standalone/.next/server/edge-runtime-webpack.js +0 -2
  165. package/packages/pi-ai/dist/models.generated.test.d.ts +0 -2
  166. package/packages/pi-ai/dist/models.generated.test.d.ts.map +0 -1
  167. package/packages/pi-ai/dist/models.generated.test.js +0 -334
  168. package/packages/pi-ai/dist/models.generated.test.js.map +0 -1
  169. package/packages/pi-ai/src/models.generated.test.ts +0 -373
  170. package/src/resources/extensions/gsd/definition-io.ts +0 -18
  171. package/src/resources/extensions/gsd/tests/auto-paused-ui-cleanup.test.ts +0 -27
  172. package/src/resources/extensions/gsd/tests/block-db-writes.test.ts +0 -63
  173. package/src/resources/extensions/gsd/tests/definition-io.test.ts +0 -57
  174. package/src/resources/extensions/gsd/tests/doctor-heal-fixable-warnings.test.ts +0 -14
  175. package/src/resources/extensions/gsd/tests/false-degraded-mode-warning.test.ts +0 -104
  176. package/src/resources/extensions/gsd/tests/memory-pressure-stuck-state.test.ts +0 -54
  177. package/src/resources/extensions/gsd/tests/post-unit-state-rebuild.test.ts +0 -34
  178. package/src/resources/extensions/gsd/tests/preferences-formatting.test.ts +0 -87
  179. package/src/resources/extensions/gsd/tests/prompt-loader-working-directory.test.ts +0 -19
  180. package/src/resources/extensions/gsd/tests/register-hooks-depth-verification.test.ts +0 -97
  181. package/src/resources/extensions/gsd/tests/stale-slice-rows.test.ts +0 -41
  182. /package/dist/web/standalone/.next/static/{NzO79SOz9jHX-VY5-0t2O → vr6Pbde48w4rMUplqDdh_}/_buildManifest.js +0 -0
  183. /package/dist/web/standalone/.next/static/{NzO79SOz9jHX-VY5-0t2O → vr6Pbde48w4rMUplqDdh_}/_ssgManifest.js +0 -0
@@ -85,111 +85,6 @@ describe("model registry — custom zai provider (GLM-5.1)", () => {
85
85
  assert.ok(ids.includes("glm-5-turbo"), "Generated glm-5-turbo should still exist");
86
86
  });
87
87
  });
88
- // ═══════════════════════════════════════════════════════════════════════════
89
- // New provider: alibaba-dashscope (feat: #3891)
90
- //
91
- // Regular DashScope API for users without the Coding Plan.
92
- // Separate from alibaba-coding-plan — different endpoint, auth, and pricing.
93
- // ═══════════════════════════════════════════════════════════════════════════
94
- describe("model registry — alibaba-dashscope provider", () => {
95
- it("alibaba-dashscope is a registered provider", () => {
96
- const providers = getProviders();
97
- assert.ok(providers.includes("alibaba-dashscope"), `Expected "alibaba-dashscope" in providers, got: ${providers.join(", ")}`);
98
- });
99
- it("alibaba-dashscope has all expected models", () => {
100
- const models = getModels("alibaba-dashscope");
101
- const ids = models.map((m) => m.id).sort();
102
- const expected = [
103
- "qwen3-coder-plus",
104
- "qwen3-max",
105
- "qwen3.5-flash",
106
- "qwen3.5-plus",
107
- "qwen3.6-plus",
108
- ];
109
- assert.deepEqual(ids, expected);
110
- });
111
- it("alibaba-dashscope models use the international DashScope base URL", () => {
112
- const models = getModels("alibaba-dashscope");
113
- for (const model of models) {
114
- assert.equal(model.baseUrl, "https://dashscope-intl.aliyuncs.com/compatible-mode/v1", `Model ${model.id} has wrong baseUrl: ${model.baseUrl}`);
115
- }
116
- });
117
- it("alibaba-dashscope models use openai-completions API", () => {
118
- const models = getModels("alibaba-dashscope");
119
- for (const model of models) {
120
- assert.equal(model.api, "openai-completions", `Model ${model.id} has wrong api: ${model.api}`);
121
- }
122
- });
123
- it("alibaba-dashscope models have provider set correctly", () => {
124
- const models = getModels("alibaba-dashscope");
125
- for (const model of models) {
126
- assert.equal(model.provider, "alibaba-dashscope", `Model ${model.id} has wrong provider: ${model.provider}`);
127
- }
128
- });
129
- it("alibaba-dashscope models all have 1M context window", () => {
130
- const models = getModels("alibaba-dashscope");
131
- for (const model of models) {
132
- assert.equal(model.contextWindow, 1_000_000, `Model ${model.id} has wrong contextWindow: ${model.contextWindow}`);
133
- }
134
- });
135
- it("alibaba-dashscope models have positive paid costs (not free-tier)", () => {
136
- const models = getModels("alibaba-dashscope");
137
- for (const model of models) {
138
- assert.ok(model.cost.input > 0, `${model.id}: input cost should be > 0 (paid tier)`);
139
- assert.ok(model.cost.output > 0, `${model.id}: output cost should be > 0 (paid tier)`);
140
- }
141
- });
142
- it("qwen3-max is a reasoning model with correct pricing", () => {
143
- const model = getModel("alibaba-dashscope", "qwen3-max");
144
- assert.ok(model, "Expected getModel to return qwen3-max for alibaba-dashscope");
145
- assert.equal(model.reasoning, true);
146
- assert.equal(model.cost.input, 1.2);
147
- assert.equal(model.cost.output, 6);
148
- assert.equal(model.maxTokens, 32768);
149
- });
150
- it("qwen3.5-plus is a reasoning model with correct pricing", () => {
151
- const model = getModel("alibaba-dashscope", "qwen3.5-plus");
152
- assert.ok(model, "Expected getModel to return qwen3.5-plus for alibaba-dashscope");
153
- assert.equal(model.reasoning, true);
154
- assert.equal(model.cost.input, 0.4);
155
- assert.equal(model.cost.output, 1.2);
156
- assert.equal(model.maxTokens, 65536);
157
- });
158
- it("qwen3.5-flash is not a reasoning model", () => {
159
- const model = getModel("alibaba-dashscope", "qwen3.5-flash");
160
- assert.ok(model, "Expected getModel to return qwen3.5-flash for alibaba-dashscope");
161
- assert.equal(model.reasoning, false);
162
- assert.equal(model.cost.input, 0.1);
163
- assert.equal(model.cost.output, 0.4);
164
- });
165
- it("qwen3-coder-plus is not a reasoning model", () => {
166
- const model = getModel("alibaba-dashscope", "qwen3-coder-plus");
167
- assert.ok(model, "Expected getModel to return qwen3-coder-plus for alibaba-dashscope");
168
- assert.equal(model.reasoning, false);
169
- assert.equal(model.cost.input, 1.0);
170
- assert.equal(model.cost.output, 5.0);
171
- });
172
- it("qwen3.6-plus is a reasoning model", () => {
173
- const model = getModel("alibaba-dashscope", "qwen3.6-plus");
174
- assert.ok(model, "Expected getModel to return qwen3.6-plus for alibaba-dashscope");
175
- assert.equal(model.reasoning, true);
176
- assert.equal(model.cost.input, 0.5);
177
- assert.equal(model.cost.output, 3.0);
178
- });
179
- it("alibaba-dashscope is independent of alibaba-coding-plan (different endpoint)", () => {
180
- const dashscope = getModels("alibaba-dashscope");
181
- const codingPlan = getModels("alibaba-coding-plan");
182
- for (const m of dashscope) {
183
- assert.notEqual(m.baseUrl, "https://coding-intl.dashscope.aliyuncs.com/v1", `${m.id} must not use the Coding Plan endpoint`);
184
- }
185
- // Both providers must coexist — coding-plan must not have been overwritten
186
- assert.ok(codingPlan.length > 0, "alibaba-coding-plan must still have models");
187
- });
188
- it("getModel returns undefined for unknown model in alibaba-dashscope (failure path)", () => {
189
- const model = getModel("alibaba-dashscope", "does-not-exist");
190
- assert.equal(model, undefined);
191
- });
192
- });
193
88
  describe("model registry — custom models do not collide with generated models", () => {
194
89
  it("generated providers still exist alongside custom providers", () => {
195
90
  const providers = getProviders();
@@ -1 +1 @@
1
-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port assert from \"node:assert/strict\";\nimport { getProviders, getModels, getModel, supportsXhigh, applyCapabilityPatches } from \"./models.js\";\nimport type { Api, Model } from \"./types.js\";\n\n// ═══════════════════════════════════════════════════════════════════════════\n// Custom provider preservation (regression: #2339)\n//\n// Custom providers (like alibaba-coding-plan) are manually maintained and\n// NOT sourced from models.dev. They must survive models.generated.ts\n// regeneration by living in models.custom.ts.\n// ═══════════════════════════════════════════════════════════════════════════\n\ndescribe(\"model registry — custom providers\", () => {\n\tit(\"alibaba-coding-plan is a registered provider\", () => {\n\t\tconst providers = getProviders();\n\t\tassert.ok(\n\t\t\tproviders.includes(\"alibaba-coding-plan\"),\n\t\t\t`Expected \"alibaba-coding-plan\" in providers, got: ${providers.join(\", \")}`,\n\t\t);\n\t});\n\n\tit(\"alibaba-coding-plan has all expected models\", () => {\n\t\tconst models = getModels(\"alibaba-coding-plan\");\n\t\tconst ids = models.map((m) => m.id).sort();\n\t\tconst expected = [\n\t\t\t\"MiniMax-M2.5\",\n\t\t\t\"glm-4.7\",\n\t\t\t\"glm-5\",\n\t\t\t\"kimi-k2.5\",\n\t\t\t\"qwen3-coder-next\",\n\t\t\t\"qwen3-coder-plus\",\n\t\t\t\"qwen3-max-2026-01-23\",\n\t\t\t\"qwen3.5-plus\",\n\t\t];\n\t\tassert.deepEqual(ids, expected);\n\t});\n\n\tit(\"alibaba-coding-plan models use the correct base URL\", () => {\n\t\tconst models = getModels(\"alibaba-coding-plan\");\n\t\tfor (const model of models) {\n\t\t\tassert.equal(\n\t\t\t\tmodel.baseUrl,\n\t\t\t\t\"https://coding-intl.dashscope.aliyuncs.com/v1\",\n\t\t\t\t`Model ${model.id} has wrong baseUrl: ${model.baseUrl}`,\n\t\t\t);\n\t\t}\n\t});\n\n\tit(\"alibaba-coding-plan models use openai-completions API\", () => {\n\t\tconst models = getModels(\"alibaba-coding-plan\");\n\t\tfor (const model of models) {\n\t\t\tassert.equal(model.api, \"openai-completions\", `Model ${model.id} has wrong api: ${model.api}`);\n\t\t}\n\t});\n\n\tit(\"alibaba-coding-plan models have provider set correctly\", () => {\n\t\tconst models = getModels(\"alibaba-coding-plan\");\n\t\tfor (const model of models) {\n\t\t\tassert.equal(\n\t\t\t\tmodel.provider,\n\t\t\t\t\"alibaba-coding-plan\",\n\t\t\t\t`Model ${model.id} has wrong provider: ${model.provider}`,\n\t\t\t);\n\t\t}\n\t});\n\n\tit(\"getModel retrieves alibaba-coding-plan models by provider+id\", () => {\n\t\t// Use type assertion to test runtime behavior — alibaba-coding-plan may come\n\t\t// from custom models rather than the generated file, so the narrow\n\t\t// GeneratedProvider type doesn't include it until models.custom.ts is merged.\n\t\tconst model = getModel(\"alibaba-coding-plan\" as any, \"qwen3.5-plus\" as any);\n\t\tassert.ok(model, \"Expected getModel to return a model for alibaba-coding-plan/qwen3.5-plus\");\n\t\tassert.equal(model.id, \"qwen3.5-plus\");\n\t\tassert.equal(model.provider, \"alibaba-coding-plan\");\n\t});\n});\n\ndescribe(\"model registry — custom zai provider (GLM-5.1)\", () => {\n\tit(\"zai provider includes glm-5.1 from custom models\", () => {\n\t\tconst models = getModels(\"zai\" as any);\n\t\tconst ids = models.map((m) => m.id);\n\t\tassert.ok(ids.includes(\"glm-5.1\"), `Expected \"glm-5.1\" in zai models, got: ${ids.join(\", \")}`);\n\t});\n\n\tit(\"glm-5.1 has correct provider and base URL\", () => {\n\t\tconst model = getModel(\"zai\" as any, \"glm-5.1\" as any);\n\t\tassert.ok(model, \"Expected getModel to return a model for zai/glm-5.1\");\n\t\tassert.equal(model.id, \"glm-5.1\");\n\t\tassert.equal(model.provider, \"zai\");\n\t\tassert.equal(model.baseUrl, \"https://api.z.ai/api/coding/paas/v4\");\n\t\tassert.equal(model.api, \"openai-completions\");\n\t});\n\n\tit(\"glm-5.1 has reasoning enabled and correct context window\", () => {\n\t\tconst model = getModel(\"zai\" as any, \"glm-5.1\" as any);\n\t\tassert.ok(model);\n\t\tassert.equal(model.reasoning, true);\n\t\tassert.equal(model.contextWindow, 204800);\n\t\tassert.equal(model.maxTokens, 131072);\n\t});\n\n\tit(\"custom glm-5.1 does not overwrite generated zai models\", () => {\n\t\tconst models = getModels(\"zai\" as any);\n\t\tconst ids = models.map((m) => m.id);\n\t\t// Generated models must still exist alongside custom glm-5.1\n\t\tassert.ok(ids.includes(\"glm-5\"), \"Generated glm-5 should still exist\");\n\t\tassert.ok(ids.includes(\"glm-5-turbo\"), \"Generated glm-5-turbo should still exist\");\n\t});\n});\n\n// ═══════════════════════════════════════════════════════════════════════════\n// New provider: alibaba-dashscope (feat: #3891)\n//\n// Regular DashScope API for users without the Coding Plan.\n// Separate from alibaba-coding-plan — different endpoint, auth, and pricing.\n// ═══════════════════════════════════════════════════════════════════════════\n\ndescribe(\"model registry — alibaba-dashscope provider\", () => {\n\tit(\"alibaba-dashscope is a registered provider\", () => {\n\t\tconst providers = getProviders();\n\t\tassert.ok(\n\t\t\tproviders.includes(\"alibaba-dashscope\"),\n\t\t\t`Expected \"alibaba-dashscope\" in providers, got: ${providers.join(\", \")}`,\n\t\t);\n\t});\n\n\tit(\"alibaba-dashscope has all expected models\", () => {\n\t\tconst models = getModels(\"alibaba-dashscope\");\n\t\tconst ids = models.map((m) => m.id).sort();\n\t\tconst expected = [\n\t\t\t\"qwen3-coder-plus\",\n\t\t\t\"qwen3-max\",\n\t\t\t\"qwen3.5-flash\",\n\t\t\t\"qwen3.5-plus\",\n\t\t\t\"qwen3.6-plus\",\n\t\t];\n\t\tassert.deepEqual(ids, expected);\n\t});\n\n\tit(\"alibaba-dashscope models use the international DashScope base URL\", () => {\n\t\tconst models = getModels(\"alibaba-dashscope\");\n\t\tfor (const model of models) {\n\t\t\tassert.equal(\n\t\t\t\tmodel.baseUrl,\n\t\t\t\t\"https://dashscope-intl.aliyuncs.com/compatible-mode/v1\",\n\t\t\t\t`Model ${model.id} has wrong baseUrl: ${model.baseUrl}`,\n\t\t\t);\n\t\t}\n\t});\n\n\tit(\"alibaba-dashscope models use openai-completions API\", () => {\n\t\tconst models = getModels(\"alibaba-dashscope\");\n\t\tfor (const model of models) {\n\t\t\tassert.equal(model.api, \"openai-completions\", `Model ${model.id} has wrong api: ${model.api}`);\n\t\t}\n\t});\n\n\tit(\"alibaba-dashscope models have provider set correctly\", () => {\n\t\tconst models = getModels(\"alibaba-dashscope\");\n\t\tfor (const model of models) {\n\t\t\tassert.equal(\n\t\t\t\tmodel.provider,\n\t\t\t\t\"alibaba-dashscope\",\n\t\t\t\t`Model ${model.id} has wrong provider: ${model.provider}`,\n\t\t\t);\n\t\t}\n\t});\n\n\tit(\"alibaba-dashscope models all have 1M context window\", () => {\n\t\tconst models = getModels(\"alibaba-dashscope\");\n\t\tfor (const model of models) {\n\t\t\tassert.equal(model.contextWindow, 1_000_000, `Model ${model.id} has wrong contextWindow: ${model.contextWindow}`);\n\t\t}\n\t});\n\n\tit(\"alibaba-dashscope models have positive paid costs (not free-tier)\", () => {\n\t\tconst models = getModels(\"alibaba-dashscope\");\n\t\tfor (const model of models) {\n\t\t\tassert.ok(model.cost.input > 0, `${model.id}: input cost should be > 0 (paid tier)`);\n\t\t\tassert.ok(model.cost.output > 0, `${model.id}: output cost should be > 0 (paid tier)`);\n\t\t}\n\t});\n\n\tit(\"qwen3-max is a reasoning model with correct pricing\", () => {\n\t\tconst model = getModel(\"alibaba-dashscope\" as any, \"qwen3-max\" as any);\n\t\tassert.ok(model, \"Expected getModel to return qwen3-max for alibaba-dashscope\");\n\t\tassert.equal(model.reasoning, true);\n\t\tassert.equal(model.cost.input, 1.2);\n\t\tassert.equal(model.cost.output, 6);\n\t\tassert.equal(model.maxTokens, 32768);\n\t});\n\n\tit(\"qwen3.5-plus is a reasoning model with correct pricing\", () => {\n\t\tconst model = getModel(\"alibaba-dashscope\" as any, \"qwen3.5-plus\" as any);\n\t\tassert.ok(model, \"Expected getModel to return qwen3.5-plus for alibaba-dashscope\");\n\t\tassert.equal(model.reasoning, true);\n\t\tassert.equal(model.cost.input, 0.4);\n\t\tassert.equal(model.cost.output, 1.2);\n\t\tassert.equal(model.maxTokens, 65536);\n\t});\n\n\tit(\"qwen3.5-flash is not a reasoning model\", () => {\n\t\tconst model = getModel(\"alibaba-dashscope\" as any, \"qwen3.5-flash\" as any);\n\t\tassert.ok(model, \"Expected getModel to return qwen3.5-flash for alibaba-dashscope\");\n\t\tassert.equal(model.reasoning, false);\n\t\tassert.equal(model.cost.input, 0.1);\n\t\tassert.equal(model.cost.output, 0.4);\n\t});\n\n\tit(\"qwen3-coder-plus is not a reasoning model\", () => {\n\t\tconst model = getModel(\"alibaba-dashscope\" as any, \"qwen3-coder-plus\" as any);\n\t\tassert.ok(model, \"Expected getModel to return qwen3-coder-plus for alibaba-dashscope\");\n\t\tassert.equal(model.reasoning, false);\n\t\tassert.equal(model.cost.input, 1.0);\n\t\tassert.equal(model.cost.output, 5.0);\n\t});\n\n\tit(\"qwen3.6-plus is a reasoning model\", () => {\n\t\tconst model = getModel(\"alibaba-dashscope\" as any, \"qwen3.6-plus\" as any);\n\t\tassert.ok(model, \"Expected getModel to return qwen3.6-plus for alibaba-dashscope\");\n\t\tassert.equal(model.reasoning, true);\n\t\tassert.equal(model.cost.input, 0.5);\n\t\tassert.equal(model.cost.output, 3.0);\n\t});\n\n\tit(\"alibaba-dashscope is independent of alibaba-coding-plan (different endpoint)\", () => {\n\t\tconst dashscope = getModels(\"alibaba-dashscope\");\n\t\tconst codingPlan = getModels(\"alibaba-coding-plan\");\n\t\tfor (const m of dashscope) {\n\t\t\tassert.notEqual(\n\t\t\t\tm.baseUrl,\n\t\t\t\t\"https://coding-intl.dashscope.aliyuncs.com/v1\",\n\t\t\t\t`${m.id} must not use the Coding Plan endpoint`,\n\t\t\t);\n\t\t}\n\t\t// Both providers must coexist — coding-plan must not have been overwritten\n\t\tassert.ok(codingPlan.length > 0, \"alibaba-coding-plan must still have models\");\n\t});\n\n\tit(\"getModel returns undefined for unknown model in alibaba-dashscope (failure path)\", () => {\n\t\tconst model = getModel(\"alibaba-dashscope\" as any, \"does-not-exist\" as any);\n\t\tassert.equal(model, undefined);\n\t});\n});\n\ndescribe(\"model registry — custom models do not collide with generated models\", () => {\n\tit(\"generated providers still exist alongside custom providers\", () => {\n\t\tconst providers = getProviders();\n\t\t// Spot-check a few generated providers\n\t\tassert.ok(providers.includes(\"openai\"), \"openai should be in providers\");\n\t\tassert.ok(providers.includes(\"anthropic\"), \"anthropic should be in providers\");\n\t});\n});\n\n// ═══════════════════════════════════════════════════════════════════════════\n// Capability patches (regression: #2546)\n//\n// CAPABILITY_PATCHES must apply capabilities to models in the static\n// registry AND to models constructed outside of it (custom, extension,\n// discovered). supportsXhigh() reads model.capabilities — not model IDs.\n// ═══════════════════════════════════════════════════════════════════════════\n\n/** Helper: build a minimal synthetic model for testing */\nfunction syntheticModel(overrides: Partial<Model<Api>>): Model<Api> {\n\treturn {\n\t\tid: \"test-model\",\n\t\tname: \"Test Model\",\n\t\tapi: \"openai-completions\" as Api,\n\t\tprovider: \"test-provider\",\n\t\tbaseUrl: \"https://example.com\",\n\t\treasoning: false,\n\t\tinput: [\"text\"],\n\t\tcost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },\n\t\tcontextWindow: 128000,\n\t\tmaxTokens: 16384,\n\t\t...overrides,\n\t} as Model<Api>;\n}\n\ndescribe(\"supportsXhigh — registry models\", () => {\n\tit(\"returns true for GPT-5.4 from the registry\", () => {\n\t\tconst model = getModel(\"openai\", \"gpt-5.4\" as any);\n\t\tif (!model) return; // skip if model not in generated catalog\n\t\tassert.equal(supportsXhigh(model), true);\n\t});\n\n\tit(\"returns false for a non-reasoning model\", () => {\n\t\tconst models = getModels(\"openai\");\n\t\tconst nonXhigh = models.find((m) => !m.id.includes(\"gpt-5.\"));\n\t\tif (!nonXhigh) return;\n\t\tassert.equal(supportsXhigh(nonXhigh), false);\n\t});\n});\n\ndescribe(\"supportsXhigh — synthetic models (regression: custom/extension models)\", () => {\n\tit(\"returns false for a model without capabilities\", () => {\n\t\tconst model = syntheticModel({ id: \"my-custom-model\" });\n\t\tassert.equal(supportsXhigh(model), false);\n\t});\n\n\tit(\"returns true when capabilities.supportsXhigh is explicitly set\", () => {\n\t\tconst model = syntheticModel({\n\t\t\tid: \"my-custom-model\",\n\t\t\tcapabilities: { supportsXhigh: true },\n\t\t});\n\t\tassert.equal(supportsXhigh(model), true);\n\t});\n});\n\ndescribe(\"applyCapabilityPatches\", () => {\n\tit(\"patches a GPT-5.4 model that has no capabilities\", () => {\n\t\tconst model = syntheticModel({ id: \"gpt-5.4-custom\" });\n\t\tassert.equal(model.capabilities, undefined);\n\n\t\tconst [patched] = applyCapabilityPatches([model]);\n\t\tassert.equal(patched.capabilities?.supportsXhigh, true);\n\t\tassert.equal(patched.capabilities?.supportsServiceTier, true);\n\t});\n\n\tit(\"patches a GPT-5.2 model\", () => {\n\t\tconst model = syntheticModel({ id: \"gpt-5.2\" });\n\t\tconst [patched] = applyCapabilityPatches([model]);\n\t\tassert.equal(patched.capabilities?.supportsXhigh, true);\n\t});\n\n\tit(\"patches an Anthropic Opus 4.6 model\", () => {\n\t\tconst model = syntheticModel({\n\t\t\tid: \"claude-opus-4-6-20260301\",\n\t\t\tapi: \"anthropic-messages\" as Api,\n\t\t});\n\t\tconst [patched] = applyCapabilityPatches([model]);\n\t\tassert.equal(patched.capabilities?.supportsXhigh, true);\n\t\t// Opus should not get supportsServiceTier\n\t\tassert.equal(patched.capabilities?.supportsServiceTier, undefined);\n\t});\n\n\tit(\"preserves explicit capabilities over patches\", () => {\n\t\tconst model = syntheticModel({\n\t\t\tid: \"gpt-5.4-custom\",\n\t\t\tcapabilities: { supportsXhigh: false, charsPerToken: 3 },\n\t\t});\n\t\tconst [patched] = applyCapabilityPatches([model]);\n\t\t// Explicit supportsXhigh: false wins over patch's true\n\t\tassert.equal(patched.capabilities?.supportsXhigh, false);\n\t\t// Patch fills in supportsServiceTier since it wasn't explicitly set\n\t\tassert.equal(patched.capabilities?.supportsServiceTier, true);\n\t\t// Explicit charsPerToken is preserved\n\t\tassert.equal(patched.capabilities?.charsPerToken, 3);\n\t});\n\n\tit(\"does not modify models that match no patches\", () => {\n\t\tconst model = syntheticModel({ id: \"gemini-2.5-pro\" });\n\t\tconst [patched] = applyCapabilityPatches([model]);\n\t\tassert.equal(patched.capabilities, undefined);\n\t\t// Should return the same reference when unpatched\n\t\tassert.equal(patched, model);\n\t});\n\n\tit(\"is idempotent — re-applying patches produces the same result\", () => {\n\t\tconst model = syntheticModel({ id: \"gpt-5.3\" });\n\t\tconst first = applyCapabilityPatches([model]);\n\t\tconst second = applyCapabilityPatches(first);\n\t\tassert.deepEqual(first[0].capabilities, second[0].capabilities);\n\t});\n});\n"]}
1
+ {"version":3,"file":"models.test.js","sourceRoot":"","sources":["../src/models.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAGvG,8EAA8E;AAC9E,mDAAmD;AACnD,EAAE;AACF,0EAA0E;AAC1E,qEAAqE;AACrE,8CAA8C;AAC9C,8EAA8E;AAE9E,QAAQ,CAAC,mCAAmC,EAAE,GAAG,EAAE;IAClD,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACvD,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;QACjC,MAAM,CAAC,EAAE,CACR,SAAS,CAAC,QAAQ,CAAC,qBAAqB,CAAC,EACzC,qDAAqD,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC3E,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;QACtD,MAAM,MAAM,GAAG,SAAS,CAAC,qBAAqB,CAAC,CAAC;QAChD,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,C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,OAAO,CAAC,YAAY,EAAE,mBAAmB,EAAE,IAAI,CAAC,CAAC;QAC9D,sCAAsC;QACtC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACvD,MAAM,KAAK,GAAG,cAAc,CAAC,EAAE,EAAE,EAAE,gBAAgB,EAAE,CAAC,CAAC;QACvD,MAAM,CAAC,OAAO,CAAC,GAAG,sBAAsB,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QAClD,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;QAC9C,kDAAkD;QAClD,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8DAA8D,EAAE,GAAG,EAAE;QACvE,MAAM,KAAK,GAAG,cAAc,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;QAChD,MAAM,KAAK,GAAG,sBAAsB,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QAC9C,MAAM,MAAM,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAC;QAC7C,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import { describe, it } from \"node:test\";\nimport assert from \"node:assert/strict\";\nimport { getProviders, getModels, getModel, supportsXhigh, applyCapabilityPatches } from \"./models.js\";\nimport type { Api, Model } from \"./types.js\";\n\n// ═══════════════════════════════════════════════════════════════════════════\n// Custom provider preservation (regression: #2339)\n//\n// Custom providers (like alibaba-coding-plan) are manually maintained and\n// NOT sourced from models.dev. They must survive models.generated.ts\n// regeneration by living in models.custom.ts.\n// ═══════════════════════════════════════════════════════════════════════════\n\ndescribe(\"model registry — custom providers\", () => {\n\tit(\"alibaba-coding-plan is a registered provider\", () => {\n\t\tconst providers = getProviders();\n\t\tassert.ok(\n\t\t\tproviders.includes(\"alibaba-coding-plan\"),\n\t\t\t`Expected \"alibaba-coding-plan\" in providers, got: ${providers.join(\", \")}`,\n\t\t);\n\t});\n\n\tit(\"alibaba-coding-plan has all expected models\", () => {\n\t\tconst models = getModels(\"alibaba-coding-plan\");\n\t\tconst ids = models.map((m) => m.id).sort();\n\t\tconst expected = [\n\t\t\t\"MiniMax-M2.5\",\n\t\t\t\"glm-4.7\",\n\t\t\t\"glm-5\",\n\t\t\t\"kimi-k2.5\",\n\t\t\t\"qwen3-coder-next\",\n\t\t\t\"qwen3-coder-plus\",\n\t\t\t\"qwen3-max-2026-01-23\",\n\t\t\t\"qwen3.5-plus\",\n\t\t];\n\t\tassert.deepEqual(ids, expected);\n\t});\n\n\tit(\"alibaba-coding-plan models use the correct base URL\", () => {\n\t\tconst models = getModels(\"alibaba-coding-plan\");\n\t\tfor (const model of models) {\n\t\t\tassert.equal(\n\t\t\t\tmodel.baseUrl,\n\t\t\t\t\"https://coding-intl.dashscope.aliyuncs.com/v1\",\n\t\t\t\t`Model ${model.id} has wrong baseUrl: ${model.baseUrl}`,\n\t\t\t);\n\t\t}\n\t});\n\n\tit(\"alibaba-coding-plan models use openai-completions API\", () => {\n\t\tconst models = getModels(\"alibaba-coding-plan\");\n\t\tfor (const model of models) {\n\t\t\tassert.equal(model.api, \"openai-completions\", `Model ${model.id} has wrong api: ${model.api}`);\n\t\t}\n\t});\n\n\tit(\"alibaba-coding-plan models have provider set correctly\", () => {\n\t\tconst models = getModels(\"alibaba-coding-plan\");\n\t\tfor (const model of models) {\n\t\t\tassert.equal(\n\t\t\t\tmodel.provider,\n\t\t\t\t\"alibaba-coding-plan\",\n\t\t\t\t`Model ${model.id} has wrong provider: ${model.provider}`,\n\t\t\t);\n\t\t}\n\t});\n\n\tit(\"getModel retrieves alibaba-coding-plan models by provider+id\", () => {\n\t\t// Use type assertion to test runtime behavior — alibaba-coding-plan may come\n\t\t// from custom models rather than the generated file, so the narrow\n\t\t// GeneratedProvider type doesn't include it until models.custom.ts is merged.\n\t\tconst model = getModel(\"alibaba-coding-plan\" as any, \"qwen3.5-plus\" as any);\n\t\tassert.ok(model, \"Expected getModel to return a model for alibaba-coding-plan/qwen3.5-plus\");\n\t\tassert.equal(model.id, \"qwen3.5-plus\");\n\t\tassert.equal(model.provider, \"alibaba-coding-plan\");\n\t});\n});\n\ndescribe(\"model registry — custom zai provider (GLM-5.1)\", () => {\n\tit(\"zai provider includes glm-5.1 from custom models\", () => {\n\t\tconst models = getModels(\"zai\" as any);\n\t\tconst ids = models.map((m) => m.id);\n\t\tassert.ok(ids.includes(\"glm-5.1\"), `Expected \"glm-5.1\" in zai models, got: ${ids.join(\", \")}`);\n\t});\n\n\tit(\"glm-5.1 has correct provider and base URL\", () => {\n\t\tconst model = getModel(\"zai\" as any, \"glm-5.1\" as any);\n\t\tassert.ok(model, \"Expected getModel to return a model for zai/glm-5.1\");\n\t\tassert.equal(model.id, \"glm-5.1\");\n\t\tassert.equal(model.provider, \"zai\");\n\t\tassert.equal(model.baseUrl, \"https://api.z.ai/api/coding/paas/v4\");\n\t\tassert.equal(model.api, \"openai-completions\");\n\t});\n\n\tit(\"glm-5.1 has reasoning enabled and correct context window\", () => {\n\t\tconst model = getModel(\"zai\" as any, \"glm-5.1\" as any);\n\t\tassert.ok(model);\n\t\tassert.equal(model.reasoning, true);\n\t\tassert.equal(model.contextWindow, 204800);\n\t\tassert.equal(model.maxTokens, 131072);\n\t});\n\n\tit(\"custom glm-5.1 does not overwrite generated zai models\", () => {\n\t\tconst models = getModels(\"zai\" as any);\n\t\tconst ids = models.map((m) => m.id);\n\t\t// Generated models must still exist alongside custom glm-5.1\n\t\tassert.ok(ids.includes(\"glm-5\"), \"Generated glm-5 should still exist\");\n\t\tassert.ok(ids.includes(\"glm-5-turbo\"), \"Generated glm-5-turbo should still exist\");\n\t});\n});\n\ndescribe(\"model registry — custom models do not collide with generated models\", () => {\n\tit(\"generated providers still exist alongside custom providers\", () => {\n\t\tconst providers = getProviders();\n\t\t// Spot-check a few generated providers\n\t\tassert.ok(providers.includes(\"openai\"), \"openai should be in providers\");\n\t\tassert.ok(providers.includes(\"anthropic\"), \"anthropic should be in providers\");\n\t});\n});\n\n// ═══════════════════════════════════════════════════════════════════════════\n// Capability patches (regression: #2546)\n//\n// CAPABILITY_PATCHES must apply capabilities to models in the static\n// registry AND to models constructed outside of it (custom, extension,\n// discovered). supportsXhigh() reads model.capabilities — not model IDs.\n// ═══════════════════════════════════════════════════════════════════════════\n\n/** Helper: build a minimal synthetic model for testing */\nfunction syntheticModel(overrides: Partial<Model<Api>>): Model<Api> {\n\treturn {\n\t\tid: \"test-model\",\n\t\tname: \"Test Model\",\n\t\tapi: \"openai-completions\" as Api,\n\t\tprovider: \"test-provider\",\n\t\tbaseUrl: \"https://example.com\",\n\t\treasoning: false,\n\t\tinput: [\"text\"],\n\t\tcost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },\n\t\tcontextWindow: 128000,\n\t\tmaxTokens: 16384,\n\t\t...overrides,\n\t} as Model<Api>;\n}\n\ndescribe(\"supportsXhigh — registry models\", () => {\n\tit(\"returns true for GPT-5.4 from the registry\", () => {\n\t\tconst model = getModel(\"openai\", \"gpt-5.4\" as any);\n\t\tif (!model) return; // skip if model not in generated catalog\n\t\tassert.equal(supportsXhigh(model), true);\n\t});\n\n\tit(\"returns false for a non-reasoning model\", () => {\n\t\tconst models = getModels(\"openai\");\n\t\tconst nonXhigh = models.find((m) => !m.id.includes(\"gpt-5.\"));\n\t\tif (!nonXhigh) return;\n\t\tassert.equal(supportsXhigh(nonXhigh), false);\n\t});\n});\n\ndescribe(\"supportsXhigh — synthetic models (regression: custom/extension models)\", () => {\n\tit(\"returns false for a model without capabilities\", () => {\n\t\tconst model = syntheticModel({ id: \"my-custom-model\" });\n\t\tassert.equal(supportsXhigh(model), false);\n\t});\n\n\tit(\"returns true when capabilities.supportsXhigh is explicitly set\", () => {\n\t\tconst model = syntheticModel({\n\t\t\tid: \"my-custom-model\",\n\t\t\tcapabilities: { supportsXhigh: true },\n\t\t});\n\t\tassert.equal(supportsXhigh(model), true);\n\t});\n});\n\ndescribe(\"applyCapabilityPatches\", () => {\n\tit(\"patches a GPT-5.4 model that has no capabilities\", () => {\n\t\tconst model = syntheticModel({ id: \"gpt-5.4-custom\" });\n\t\tassert.equal(model.capabilities, undefined);\n\n\t\tconst [patched] = applyCapabilityPatches([model]);\n\t\tassert.equal(patched.capabilities?.supportsXhigh, true);\n\t\tassert.equal(patched.capabilities?.supportsServiceTier, true);\n\t});\n\n\tit(\"patches a GPT-5.2 model\", () => {\n\t\tconst model = syntheticModel({ id: \"gpt-5.2\" });\n\t\tconst [patched] = applyCapabilityPatches([model]);\n\t\tassert.equal(patched.capabilities?.supportsXhigh, true);\n\t});\n\n\tit(\"patches an Anthropic Opus 4.6 model\", () => {\n\t\tconst model = syntheticModel({\n\t\t\tid: \"claude-opus-4-6-20260301\",\n\t\t\tapi: \"anthropic-messages\" as Api,\n\t\t});\n\t\tconst [patched] = applyCapabilityPatches([model]);\n\t\tassert.equal(patched.capabilities?.supportsXhigh, true);\n\t\t// Opus should not get supportsServiceTier\n\t\tassert.equal(patched.capabilities?.supportsServiceTier, undefined);\n\t});\n\n\tit(\"preserves explicit capabilities over patches\", () => {\n\t\tconst model = syntheticModel({\n\t\t\tid: \"gpt-5.4-custom\",\n\t\t\tcapabilities: { supportsXhigh: false, charsPerToken: 3 },\n\t\t});\n\t\tconst [patched] = applyCapabilityPatches([model]);\n\t\t// Explicit supportsXhigh: false wins over patch's true\n\t\tassert.equal(patched.capabilities?.supportsXhigh, false);\n\t\t// Patch fills in supportsServiceTier since it wasn't explicitly set\n\t\tassert.equal(patched.capabilities?.supportsServiceTier, true);\n\t\t// Explicit charsPerToken is preserved\n\t\tassert.equal(patched.capabilities?.charsPerToken, 3);\n\t});\n\n\tit(\"does not modify models that match no patches\", () => {\n\t\tconst model = syntheticModel({ id: \"gemini-2.5-pro\" });\n\t\tconst [patched] = applyCapabilityPatches([model]);\n\t\tassert.equal(patched.capabilities, undefined);\n\t\t// Should return the same reference when unpatched\n\t\tassert.equal(patched, model);\n\t});\n\n\tit(\"is idempotent — re-applying patches produces the same result\", () => {\n\t\tconst model = syntheticModel({ id: \"gpt-5.3\" });\n\t\tconst first = applyCapabilityPatches([model]);\n\t\tconst second = applyCapabilityPatches(first);\n\t\tassert.deepEqual(first[0].capabilities, second[0].capabilities);\n\t});\n});\n"]}
@@ -2,7 +2,7 @@ import type { AssistantMessageEventStream } from "./utils/event-stream.js";
2
2
  export type { AssistantMessageEventStream } from "./utils/event-stream.js";
3
3
  export type KnownApi = "openai-completions" | "mistral-conversations" | "openai-responses" | "azure-openai-responses" | "openai-codex-responses" | "anthropic-messages" | "anthropic-vertex" | "bedrock-converse-stream" | "google-generative-ai" | "google-gemini-cli" | "google-vertex" | "ollama-chat";
4
4
  export type Api = KnownApi | (string & {});
5
- export type KnownProvider = "amazon-bedrock" | "anthropic" | "anthropic-vertex" | "google" | "google-gemini-cli" | "google-antigravity" | "google-vertex" | "openai" | "azure-openai-responses" | "openai-codex" | "github-copilot" | "xai" | "groq" | "cerebras" | "openrouter" | "vercel-ai-gateway" | "zai" | "mistral" | "minimax" | "minimax-cn" | "huggingface" | "opencode" | "opencode-go" | "kimi-coding" | "alibaba-coding-plan" | "alibaba-dashscope" | "ollama" | "ollama-cloud";
5
+ export type KnownProvider = "amazon-bedrock" | "anthropic" | "anthropic-vertex" | "google" | "google-gemini-cli" | "google-antigravity" | "google-vertex" | "openai" | "azure-openai-responses" | "openai-codex" | "github-copilot" | "xai" | "groq" | "cerebras" | "openrouter" | "vercel-ai-gateway" | "zai" | "mistral" | "minimax" | "minimax-cn" | "huggingface" | "opencode" | "opencode-go" | "kimi-coding" | "alibaba-coding-plan" | "ollama" | "ollama-cloud";
6
6
  export type Provider = KnownProvider | string;
7
7
  export type ThinkingLevel = "minimal" | "low" | "medium" | "high" | "xhigh";
8
8
  /** Token budgets for each thinking level (token-based providers only) */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAE3E,YAAY,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAE3E,MAAM,MAAM,QAAQ,GACjB,oBAAoB,GACpB,uBAAuB,GACvB,kBAAkB,GAClB,wBAAwB,GACxB,wBAAwB,GACxB,oBAAoB,GACpB,kBAAkB,GAClB,yBAAyB,GACzB,sBAAsB,GACtB,mBAAmB,GACnB,eAAe,GACf,aAAa,CAAC;AAEjB,MAAM,MAAM,GAAG,GAAG,QAAQ,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAE3C,MAAM,MAAM,aAAa,GACtB,gBAAgB,GAChB,WAAW,GACX,kBAAkB,GAClB,QAAQ,GACR,mBAAmB,GACnB,oBAAoB,GACpB,eAAe,GACf,QAAQ,GACR,wBAAwB,GACxB,cAAc,GACd,gBAAgB,GAChB,KAAK,GACL,MAAM,GACN,UAAU,GACV,YAAY,GACZ,mBAAmB,GACnB,KAAK,GACL,SAAS,GACT,SAAS,GACT,YAAY,GACZ,aAAa,GACb,UAAU,GACV,aAAa,GACb,aAAa,GACb,qBAAqB,GACrB,mBAAmB,GACnB,QAAQ,GACR,cAAc,CAAC;AAClB,MAAM,MAAM,QAAQ,GAAG,aAAa,GAAG,MAAM,CAAC;AAE9C,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AAE5E,yEAAyE;AACzE,MAAM,WAAW,eAAe;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB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"names":[],"mappings":"","sourcesContent":["import type { AssistantMessageEventStream } from \"./utils/event-stream.js\";\n\nexport type { AssistantMessageEventStream } from \"./utils/event-stream.js\";\n\nexport type KnownApi =\n\t| \"openai-completions\"\n\t| \"mistral-conversations\"\n\t| \"openai-responses\"\n\t| \"azure-openai-responses\"\n\t| \"openai-codex-responses\"\n\t| \"anthropic-messages\"\n\t| \"anthropic-vertex\"\n\t| \"bedrock-converse-stream\"\n\t| \"google-generative-ai\"\n\t| \"google-gemini-cli\"\n\t| \"google-vertex\"\n\t| \"ollama-chat\";\n\nexport type Api = KnownApi | (string & {});\n\nexport type KnownProvider =\n\t| \"amazon-bedrock\"\n\t| \"anthropic\"\n\t| \"anthropic-vertex\"\n\t| \"google\"\n\t| \"google-gemini-cli\"\n\t| \"google-antigravity\"\n\t| \"google-vertex\"\n\t| \"openai\"\n\t| \"azure-openai-responses\"\n\t| \"openai-codex\"\n\t| \"github-copilot\"\n\t| \"xai\"\n\t| \"groq\"\n\t| \"cerebras\"\n\t| \"openrouter\"\n\t| \"vercel-ai-gateway\"\n\t| \"zai\"\n\t| \"mistral\"\n\t| \"minimax\"\n\t| \"minimax-cn\"\n\t| \"huggingface\"\n\t| \"opencode\"\n\t| \"opencode-go\"\n\t| \"kimi-coding\"\n\t| \"alibaba-coding-plan\"\n\t| \"alibaba-dashscope\"\n\t| \"ollama\"\n\t| \"ollama-cloud\";\nexport type Provider = KnownProvider | string;\n\nexport type ThinkingLevel = \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\";\n\n/** Token budgets for each thinking level (token-based providers only) */\nexport interface ThinkingBudgets {\n\tminimal?: number;\n\tlow?: number;\n\tmedium?: number;\n\thigh?: number;\n}\n\n// Base options all providers share\nexport type CacheRetention = \"none\" | \"short\" | \"long\";\n\nexport type Transport = \"sse\" | \"websocket\" | \"auto\";\n\nexport interface StreamOptions {\n\ttemperature?: number;\n\tmaxTokens?: number;\n\tsignal?: AbortSignal;\n\tapiKey?: string;\n\t/**\n\t * Preferred transport for providers that support multiple transports.\n\t * Providers that do not support this option ignore it.\n\t */\n\ttransport?: Transport;\n\t/**\n\t * Prompt cache retention preference. Providers map this to their supported values.\n\t * Default: \"short\".\n\t */\n\tcacheRetention?: CacheRetention;\n\t/**\n\t * Optional session identifier for providers that support session-based caching.\n\t * Providers can use this to enable prompt caching, request routing, or other\n\t * session-aware features. Ignored by providers that don't support it.\n\t */\n\tsessionId?: string;\n\t/**\n\t * Optional callback for inspecting or replacing provider payloads before sending.\n\t * Return undefined to keep the payload unchanged.\n\t */\n\tonPayload?: (payload: unknown, model: Model<Api>) => unknown | undefined | Promise<unknown | undefined>;\n\t/**\n\t * Optional custom HTTP headers to include in API requests.\n\t * Merged with provider defaults; can override default headers.\n\t * Not supported by all providers (e.g., AWS Bedrock uses SDK auth).\n\t */\n\theaders?: Record<string, string>;\n\t/**\n\t * Maximum delay in milliseconds to wait for a retry when the server requests a long wait.\n\t * If the server's requested delay exceeds this value, the request fails immediately\n\t * with an error containing the requested delay, allowing higher-level retry logic\n\t * to handle it with user visibility.\n\t * Default: 60000 (60 seconds). Set to 0 to disable the cap.\n\t */\n\tmaxRetryDelayMs?: number;\n\t/**\n\t * Optional metadata to include in API requests.\n\t * Providers extract the fields they understand and ignore the rest.\n\t * For example, Anthropic uses `user_id` for abuse tracking and rate limiting.\n\t */\n\tmetadata?: Record<string, unknown>;\n}\n\nexport type ProviderStreamOptions = StreamOptions & Record<string, unknown>;\n\n// Unified options with reasoning passed to streamSimple() and completeSimple()\nexport interface SimpleStreamOptions extends StreamOptions {\n\treasoning?: ThinkingLevel;\n\t/** Custom token budgets for thinking levels (token-based providers only) */\n\tthinkingBudgets?: ThinkingBudgets;\n}\n\n// Generic StreamFunction with typed options\nexport type StreamFunction<TApi extends Api = Api, TOptions extends StreamOptions = StreamOptions> = (\n\tmodel: Model<TApi>,\n\tcontext: Context,\n\toptions?: TOptions,\n) => AssistantMessageEventStream;\n\nexport interface TextSignatureV1 {\n\tv: 1;\n\tid: string;\n\tphase?: \"commentary\" | \"final_answer\";\n}\n\nexport interface TextContent {\n\ttype: \"text\";\n\ttext: string;\n\ttextSignature?: string; // e.g., for OpenAI responses, message metadata (legacy id string or TextSignatureV1 JSON)\n}\n\nexport interface ThinkingContent {\n\ttype: \"thinking\";\n\tthinking: string;\n\tthinkingSignature?: string; // e.g., for OpenAI responses, the reasoning item ID\n\t/** When true, the thinking content was redacted by safety filters. The opaque\n\t * encrypted payload is stored in `thinkingSignature` so it can be passed back\n\t * to the API for multi-turn continuity. */\n\tredacted?: boolean;\n}\n\nexport interface ImageContent {\n\ttype: \"image\";\n\tdata: string; // base64 encoded image data\n\tmimeType: string; // e.g., \"image/jpeg\", \"image/png\"\n}\n\nexport interface ToolCall {\n\ttype: \"toolCall\";\n\tid: string;\n\tname: string;\n\targuments: Record<string, any>;\n\tthoughtSignature?: string; // Google-specific: opaque signature for reusing thought context\n}\n\n/** Server-side tool use (e.g., Anthropic native web search). Executed by the API, not the client. */\nexport interface ServerToolUseContent {\n\ttype: \"serverToolUse\";\n\tid: string;\n\tname: string; // e.g., \"web_search\"\n\tinput: unknown;\n}\n\n/** Result of a server-side tool execution, paired with a ServerToolUseContent by toolUseId. */\nexport interface WebSearchResultContent {\n\ttype: \"webSearchResult\";\n\ttoolUseId: string;\n\t/** Search results or error from the server. Opaque — stored for API replay. */\n\tcontent: unknown;\n}\n\nexport interface Usage {\n\tinput: number;\n\toutput: number;\n\tcacheRead: number;\n\tcacheWrite: number;\n\ttotalTokens: number;\n\tcost: {\n\t\tinput: number;\n\t\toutput: number;\n\t\tcacheRead: number;\n\t\tcacheWrite: number;\n\t\ttotal: number;\n\t};\n}\n\nexport type StopReason = \"stop\" | \"length\" | \"toolUse\" | \"pauseTurn\" | \"error\" | \"aborted\";\n\nexport interface UserMessage {\n\trole: \"user\";\n\tcontent: string | (TextContent | ImageContent)[];\n\ttimestamp: number; // Unix timestamp in milliseconds\n}\n\nexport interface AssistantMessage {\n\trole: \"assistant\";\n\tcontent: (TextContent | ThinkingContent | ToolCall | ServerToolUseContent | WebSearchResultContent)[];\n\tapi: Api;\n\tprovider: Provider;\n\tmodel: string;\n\tusage: Usage;\n\tstopReason: StopReason;\n\terrorMessage?: string;\n\t/** Server-requested retry delay in milliseconds (from Retry-After or rate limit headers). */\n\tretryAfterMs?: number;\n\t/** Provider inference performance metrics (e.g. tokens/sec from local models). */\n\tinferenceMetrics?: InferenceMetrics;\n\ttimestamp: number; // Unix timestamp in milliseconds\n}\n\n/** Inference performance metrics reported by providers that support it (e.g. Ollama). */\nexport interface InferenceMetrics {\n\t/** Tokens generated per second during eval phase. */\n\ttokensPerSecond: number;\n\t/** Wall-clock duration of the full request in milliseconds. */\n\ttotalDurationMs: number;\n\t/** Duration of the eval (generation) phase in milliseconds. */\n\tevalDurationMs: number;\n\t/** Duration of the prompt eval phase in milliseconds. */\n\tpromptEvalDurationMs: number;\n}\n\nexport interface ToolResultMessage<TDetails = any> {\n\trole: \"toolResult\";\n\ttoolCallId: string;\n\ttoolName: string;\n\tcontent: (TextContent | ImageContent)[]; // Supports text and images\n\tdetails?: TDetails;\n\tisError: boolean;\n\ttimestamp: number; // Unix timestamp in milliseconds\n}\n\nexport type Message = UserMessage | AssistantMessage | ToolResultMessage;\n\nimport type { TSchema } from \"@sinclair/typebox\";\n\nexport interface Tool<TParameters extends TSchema = TSchema> {\n\tname: string;\n\tdescription: string;\n\tparameters: TParameters;\n}\n\nexport interface Context {\n\tsystemPrompt?: string;\n\tmessages: Message[];\n\ttools?: Tool[];\n}\n\nexport type AssistantMessageEvent =\n\t| { type: \"start\"; partial: AssistantMessage }\n\t| { type: \"text_start\"; contentIndex: number; partial: AssistantMessage }\n\t| { type: \"text_delta\"; contentIndex: number; delta: string; partial: AssistantMessage }\n\t| { type: \"text_end\"; contentIndex: number; content: string; partial: AssistantMessage }\n\t| { type: \"thinking_start\"; contentIndex: number; partial: AssistantMessage }\n\t| { type: \"thinking_delta\"; contentIndex: number; delta: string; partial: AssistantMessage }\n\t| { type: \"thinking_end\"; contentIndex: number; content: string; partial: AssistantMessage }\n\t| { type: \"toolcall_start\"; contentIndex: number; partial: AssistantMessage }\n\t| { type: \"toolcall_delta\"; contentIndex: number; delta: string; partial: AssistantMessage }\n\t| { type: \"toolcall_end\"; contentIndex: number; toolCall: ToolCall; partial: AssistantMessage; malformedArguments?: boolean }\n\t| { type: \"server_tool_use\"; contentIndex: number; partial: AssistantMessage }\n\t| { type: \"web_search_result\"; contentIndex: number; partial: AssistantMessage }\n\t| { type: \"done\"; reason: Extract<StopReason, \"stop\" | \"length\" | \"toolUse\" | \"pauseTurn\">; message: AssistantMessage }\n\t| { type: \"error\"; reason: Extract<StopReason, \"aborted\" | \"error\">; error: AssistantMessage };\n\n/**\n * Compatibility settings for OpenAI-compatible completions APIs.\n * Use this to override URL-based auto-detection for custom providers.\n */\nexport interface OpenAICompletionsCompat {\n\t/** Whether the provider supports the `store` field. Default: auto-detected from URL. */\n\tsupportsStore?: boolean;\n\t/** Whether the provider supports the `developer` role (vs `system`). Default: auto-detected from URL. */\n\tsupportsDeveloperRole?: boolean;\n\t/** Whether the provider supports `reasoning_effort`. Default: auto-detected from URL. */\n\tsupportsReasoningEffort?: boolean;\n\t/** Optional mapping from pi-ai reasoning levels to provider/model-specific `reasoning_effort` values. */\n\treasoningEffortMap?: Partial<Record<ThinkingLevel, string>>;\n\t/** Whether the provider supports `stream_options: { include_usage: true }` for token usage in streaming responses. Default: true. */\n\tsupportsUsageInStreaming?: boolean;\n\t/** Which field to use for max tokens. Default: auto-detected from URL. */\n\tmaxTokensField?: \"max_completion_tokens\" | \"max_tokens\";\n\t/** Whether tool results require the `name` field. Default: auto-detected from URL. */\n\trequiresToolResultName?: boolean;\n\t/** Whether a user message after tool results requires an assistant message in between. Default: auto-detected from URL. */\n\trequiresAssistantAfterToolResult?: boolean;\n\t/** Whether thinking blocks must be converted to text blocks with <thinking> delimiters. Default: auto-detected from URL. */\n\trequiresThinkingAsText?: boolean;\n\t/** Format for reasoning/thinking parameter. \"openai\" uses reasoning_effort, \"zai\" uses thinking: { type: \"enabled\" }, \"qwen\" uses enable_thinking: boolean. Default: \"openai\". */\n\tthinkingFormat?: \"openai\" | \"zai\" | \"qwen\";\n\t/** OpenRouter-specific routing preferences. Only used when baseUrl points to OpenRouter. */\n\topenRouterRouting?: OpenRouterRouting;\n\t/** Vercel AI Gateway routing preferences. Only used when baseUrl points to Vercel AI Gateway. */\n\tvercelGatewayRouting?: VercelGatewayRouting;\n\t/** Whether the provider supports the `strict` field in tool definitions. Default: true. */\n\tsupportsStrictMode?: boolean;\n}\n\n/** Compatibility settings for OpenAI Responses APIs. */\nexport interface OpenAIResponsesCompat {\n\t// Reserved for future use\n}\n\n/**\n * OpenRouter provider routing preferences.\n * Controls which upstream providers OpenRouter routes requests to.\n * @see https://openrouter.ai/docs/provider-routing\n */\nexport interface OpenRouterRouting {\n\t/** List of provider slugs to exclusively use for this request (e.g., [\"amazon-bedrock\", \"anthropic\"]). */\n\tonly?: string[];\n\t/** List of provider slugs to try in order (e.g., [\"anthropic\", \"openai\"]). */\n\torder?: string[];\n}\n\n/**\n * Vercel AI Gateway routing preferences.\n * Controls which upstream providers the gateway routes requests to.\n * @see https://vercel.com/docs/ai-gateway/models-and-providers/provider-options\n */\nexport interface VercelGatewayRouting {\n\t/** List of provider slugs to exclusively use for this request (e.g., [\"bedrock\", \"anthropic\"]). */\n\tonly?: string[];\n\t/** List of provider slugs to try in order (e.g., [\"anthropic\", \"openai\"]). */\n\torder?: string[];\n}\n\n/**\n * Provider-agnostic capability declarations for a model.\n *\n * These fields allow models to self-declare supported features so that call\n * sites can read from metadata rather than pattern-matching on model IDs or\n * provider names. Add fields here as new cross-provider capabilities emerge.\n */\nexport interface ModelCapabilities {\n\t/** Whether the model supports xhigh thinking level. */\n\tsupportsXhigh?: boolean;\n\t/**\n\t * Whether tool call IDs must be included and normalised in tool results for\n\t * this model. Relevant for models deployed cross-provider (e.g. Claude or\n\t * GPT variants via Google APIs) where the host API imposes stricter ID rules.\n\t */\n\trequiresToolCallId?: boolean;\n\t/** Whether OpenAI-style service tiers (priority/flex) apply to this model. */\n\tsupportsServiceTier?: boolean;\n\t/**\n\t * Approximate characters per token for this model.\n\t * Used as a fallback when an accurate tokenizer is unavailable.\n\t * If omitted, the provider-level default is used.\n\t */\n\tcharsPerToken?: number;\n}\n\n// Model interface for the unified model system\nexport interface Model<TApi extends Api> {\n\tid: string;\n\tname: string;\n\tapi: TApi;\n\tprovider: Provider;\n\tbaseUrl: string;\n\treasoning: boolean;\n\tinput: (\"text\" | \"image\")[];\n\tcost: {\n\t\tinput: number; // $/million tokens\n\t\toutput: number; // $/million tokens\n\t\tcacheRead: number; // $/million tokens\n\t\tcacheWrite: number; // $/million tokens\n\t};\n\tcontextWindow: number;\n\tmaxTokens: number;\n\theaders?: Record<string, string>;\n\t/** Compatibility overrides for OpenAI-compatible APIs. If not set, auto-detected from baseUrl. */\n\tcompat?: TApi extends \"openai-completions\"\n\t\t? OpenAICompletionsCompat\n\t\t: TApi extends \"openai-responses\"\n\t\t\t? OpenAIResponsesCompat\n\t\t\t: never;\n\t/**\n\t * Provider-agnostic capability declarations for this model.\n\t * Read these fields instead of pattern-matching on model IDs or provider names.\n\t */\n\tcapabilities?: ModelCapabilities;\n\t/** Opaque provider-specific options. Cast to the appropriate type in the provider's stream handler. */\n\tproviderOptions?: Record<string, unknown>;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { AssistantMessageEventStream } from \"./utils/event-stream.js\";\n\nexport type { AssistantMessageEventStream } from \"./utils/event-stream.js\";\n\nexport type KnownApi =\n\t| \"openai-completions\"\n\t| \"mistral-conversations\"\n\t| \"openai-responses\"\n\t| \"azure-openai-responses\"\n\t| \"openai-codex-responses\"\n\t| \"anthropic-messages\"\n\t| \"anthropic-vertex\"\n\t| \"bedrock-converse-stream\"\n\t| \"google-generative-ai\"\n\t| \"google-gemini-cli\"\n\t| \"google-vertex\"\n\t| \"ollama-chat\";\n\nexport type Api = KnownApi | (string & {});\n\nexport type KnownProvider =\n\t| \"amazon-bedrock\"\n\t| \"anthropic\"\n\t| \"anthropic-vertex\"\n\t| \"google\"\n\t| \"google-gemini-cli\"\n\t| \"google-antigravity\"\n\t| \"google-vertex\"\n\t| \"openai\"\n\t| \"azure-openai-responses\"\n\t| \"openai-codex\"\n\t| \"github-copilot\"\n\t| \"xai\"\n\t| \"groq\"\n\t| \"cerebras\"\n\t| \"openrouter\"\n\t| \"vercel-ai-gateway\"\n\t| \"zai\"\n\t| \"mistral\"\n\t| \"minimax\"\n\t| \"minimax-cn\"\n\t| \"huggingface\"\n\t| \"opencode\"\n\t| \"opencode-go\"\n\t| \"kimi-coding\"\n\t| \"alibaba-coding-plan\"\n\t| \"ollama\"\n\t| \"ollama-cloud\";\nexport type Provider = KnownProvider | string;\n\nexport type ThinkingLevel = \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\";\n\n/** Token budgets for each thinking level (token-based providers only) */\nexport interface ThinkingBudgets {\n\tminimal?: number;\n\tlow?: number;\n\tmedium?: number;\n\thigh?: number;\n}\n\n// Base options all providers share\nexport type CacheRetention = \"none\" | \"short\" | \"long\";\n\nexport type Transport = \"sse\" | \"websocket\" | \"auto\";\n\nexport interface StreamOptions {\n\ttemperature?: number;\n\tmaxTokens?: number;\n\tsignal?: AbortSignal;\n\tapiKey?: string;\n\t/**\n\t * Preferred transport for providers that support multiple transports.\n\t * Providers that do not support this option ignore it.\n\t */\n\ttransport?: Transport;\n\t/**\n\t * Prompt cache retention preference. Providers map this to their supported values.\n\t * Default: \"short\".\n\t */\n\tcacheRetention?: CacheRetention;\n\t/**\n\t * Optional session identifier for providers that support session-based caching.\n\t * Providers can use this to enable prompt caching, request routing, or other\n\t * session-aware features. Ignored by providers that don't support it.\n\t */\n\tsessionId?: string;\n\t/**\n\t * Optional callback for inspecting or replacing provider payloads before sending.\n\t * Return undefined to keep the payload unchanged.\n\t */\n\tonPayload?: (payload: unknown, model: Model<Api>) => unknown | undefined | Promise<unknown | undefined>;\n\t/**\n\t * Optional custom HTTP headers to include in API requests.\n\t * Merged with provider defaults; can override default headers.\n\t * Not supported by all providers (e.g., AWS Bedrock uses SDK auth).\n\t */\n\theaders?: Record<string, string>;\n\t/**\n\t * Maximum delay in milliseconds to wait for a retry when the server requests a long wait.\n\t * If the server's requested delay exceeds this value, the request fails immediately\n\t * with an error containing the requested delay, allowing higher-level retry logic\n\t * to handle it with user visibility.\n\t * Default: 60000 (60 seconds). Set to 0 to disable the cap.\n\t */\n\tmaxRetryDelayMs?: number;\n\t/**\n\t * Optional metadata to include in API requests.\n\t * Providers extract the fields they understand and ignore the rest.\n\t * For example, Anthropic uses `user_id` for abuse tracking and rate limiting.\n\t */\n\tmetadata?: Record<string, unknown>;\n}\n\nexport type ProviderStreamOptions = StreamOptions & Record<string, unknown>;\n\n// Unified options with reasoning passed to streamSimple() and completeSimple()\nexport interface SimpleStreamOptions extends StreamOptions {\n\treasoning?: ThinkingLevel;\n\t/** Custom token budgets for thinking levels (token-based providers only) */\n\tthinkingBudgets?: ThinkingBudgets;\n}\n\n// Generic StreamFunction with typed options\nexport type StreamFunction<TApi extends Api = Api, TOptions extends StreamOptions = StreamOptions> = (\n\tmodel: Model<TApi>,\n\tcontext: Context,\n\toptions?: TOptions,\n) => AssistantMessageEventStream;\n\nexport interface TextSignatureV1 {\n\tv: 1;\n\tid: string;\n\tphase?: \"commentary\" | \"final_answer\";\n}\n\nexport interface TextContent {\n\ttype: \"text\";\n\ttext: string;\n\ttextSignature?: string; // e.g., for OpenAI responses, message metadata (legacy id string or TextSignatureV1 JSON)\n}\n\nexport interface ThinkingContent {\n\ttype: \"thinking\";\n\tthinking: string;\n\tthinkingSignature?: string; // e.g., for OpenAI responses, the reasoning item ID\n\t/** When true, the thinking content was redacted by safety filters. The opaque\n\t * encrypted payload is stored in `thinkingSignature` so it can be passed back\n\t * to the API for multi-turn continuity. */\n\tredacted?: boolean;\n}\n\nexport interface ImageContent {\n\ttype: \"image\";\n\tdata: string; // base64 encoded image data\n\tmimeType: string; // e.g., \"image/jpeg\", \"image/png\"\n}\n\nexport interface ToolCall {\n\ttype: \"toolCall\";\n\tid: string;\n\tname: string;\n\targuments: Record<string, any>;\n\tthoughtSignature?: string; // Google-specific: opaque signature for reusing thought context\n}\n\n/** Server-side tool use (e.g., Anthropic native web search). Executed by the API, not the client. */\nexport interface ServerToolUseContent {\n\ttype: \"serverToolUse\";\n\tid: string;\n\tname: string; // e.g., \"web_search\"\n\tinput: unknown;\n}\n\n/** Result of a server-side tool execution, paired with a ServerToolUseContent by toolUseId. */\nexport interface WebSearchResultContent {\n\ttype: \"webSearchResult\";\n\ttoolUseId: string;\n\t/** Search results or error from the server. Opaque — stored for API replay. */\n\tcontent: unknown;\n}\n\nexport interface Usage {\n\tinput: number;\n\toutput: number;\n\tcacheRead: number;\n\tcacheWrite: number;\n\ttotalTokens: number;\n\tcost: {\n\t\tinput: number;\n\t\toutput: number;\n\t\tcacheRead: number;\n\t\tcacheWrite: number;\n\t\ttotal: number;\n\t};\n}\n\nexport type StopReason = \"stop\" | \"length\" | \"toolUse\" | \"pauseTurn\" | \"error\" | \"aborted\";\n\nexport interface UserMessage {\n\trole: \"user\";\n\tcontent: string | (TextContent | ImageContent)[];\n\ttimestamp: number; // Unix timestamp in milliseconds\n}\n\nexport interface AssistantMessage {\n\trole: \"assistant\";\n\tcontent: (TextContent | ThinkingContent | ToolCall | ServerToolUseContent | WebSearchResultContent)[];\n\tapi: Api;\n\tprovider: Provider;\n\tmodel: string;\n\tusage: Usage;\n\tstopReason: StopReason;\n\terrorMessage?: string;\n\t/** Server-requested retry delay in milliseconds (from Retry-After or rate limit headers). */\n\tretryAfterMs?: number;\n\t/** Provider inference performance metrics (e.g. tokens/sec from local models). */\n\tinferenceMetrics?: InferenceMetrics;\n\ttimestamp: number; // Unix timestamp in milliseconds\n}\n\n/** Inference performance metrics reported by providers that support it (e.g. Ollama). */\nexport interface InferenceMetrics {\n\t/** Tokens generated per second during eval phase. */\n\ttokensPerSecond: number;\n\t/** Wall-clock duration of the full request in milliseconds. */\n\ttotalDurationMs: number;\n\t/** Duration of the eval (generation) phase in milliseconds. */\n\tevalDurationMs: number;\n\t/** Duration of the prompt eval phase in milliseconds. */\n\tpromptEvalDurationMs: number;\n}\n\nexport interface ToolResultMessage<TDetails = any> {\n\trole: \"toolResult\";\n\ttoolCallId: string;\n\ttoolName: string;\n\tcontent: (TextContent | ImageContent)[]; // Supports text and images\n\tdetails?: TDetails;\n\tisError: boolean;\n\ttimestamp: number; // Unix timestamp in milliseconds\n}\n\nexport type Message = UserMessage | AssistantMessage | ToolResultMessage;\n\nimport type { TSchema } from \"@sinclair/typebox\";\n\nexport interface Tool<TParameters extends TSchema = TSchema> {\n\tname: string;\n\tdescription: string;\n\tparameters: TParameters;\n}\n\nexport interface Context {\n\tsystemPrompt?: string;\n\tmessages: Message[];\n\ttools?: Tool[];\n}\n\nexport type AssistantMessageEvent =\n\t| { type: \"start\"; partial: AssistantMessage }\n\t| { type: \"text_start\"; contentIndex: number; partial: AssistantMessage }\n\t| { type: \"text_delta\"; contentIndex: number; delta: string; partial: AssistantMessage }\n\t| { type: \"text_end\"; contentIndex: number; content: string; partial: AssistantMessage }\n\t| { type: \"thinking_start\"; contentIndex: number; partial: AssistantMessage }\n\t| { type: \"thinking_delta\"; contentIndex: number; delta: string; partial: AssistantMessage }\n\t| { type: \"thinking_end\"; contentIndex: number; content: string; partial: AssistantMessage }\n\t| { type: \"toolcall_start\"; contentIndex: number; partial: AssistantMessage }\n\t| { type: \"toolcall_delta\"; contentIndex: number; delta: string; partial: AssistantMessage }\n\t| { type: \"toolcall_end\"; contentIndex: number; toolCall: ToolCall; partial: AssistantMessage; malformedArguments?: boolean }\n\t| { type: \"server_tool_use\"; contentIndex: number; partial: AssistantMessage }\n\t| { type: \"web_search_result\"; contentIndex: number; partial: AssistantMessage }\n\t| { type: \"done\"; reason: Extract<StopReason, \"stop\" | \"length\" | \"toolUse\" | \"pauseTurn\">; message: AssistantMessage }\n\t| { type: \"error\"; reason: Extract<StopReason, \"aborted\" | \"error\">; error: AssistantMessage };\n\n/**\n * Compatibility settings for OpenAI-compatible completions APIs.\n * Use this to override URL-based auto-detection for custom providers.\n */\nexport interface OpenAICompletionsCompat {\n\t/** Whether the provider supports the `store` field. Default: auto-detected from URL. */\n\tsupportsStore?: boolean;\n\t/** Whether the provider supports the `developer` role (vs `system`). Default: auto-detected from URL. */\n\tsupportsDeveloperRole?: boolean;\n\t/** Whether the provider supports `reasoning_effort`. Default: auto-detected from URL. */\n\tsupportsReasoningEffort?: boolean;\n\t/** Optional mapping from pi-ai reasoning levels to provider/model-specific `reasoning_effort` values. */\n\treasoningEffortMap?: Partial<Record<ThinkingLevel, string>>;\n\t/** Whether the provider supports `stream_options: { include_usage: true }` for token usage in streaming responses. Default: true. */\n\tsupportsUsageInStreaming?: boolean;\n\t/** Which field to use for max tokens. Default: auto-detected from URL. */\n\tmaxTokensField?: \"max_completion_tokens\" | \"max_tokens\";\n\t/** Whether tool results require the `name` field. Default: auto-detected from URL. */\n\trequiresToolResultName?: boolean;\n\t/** Whether a user message after tool results requires an assistant message in between. Default: auto-detected from URL. */\n\trequiresAssistantAfterToolResult?: boolean;\n\t/** Whether thinking blocks must be converted to text blocks with <thinking> delimiters. Default: auto-detected from URL. */\n\trequiresThinkingAsText?: boolean;\n\t/** Format for reasoning/thinking parameter. \"openai\" uses reasoning_effort, \"zai\" uses thinking: { type: \"enabled\" }, \"qwen\" uses enable_thinking: boolean. Default: \"openai\". */\n\tthinkingFormat?: \"openai\" | \"zai\" | \"qwen\";\n\t/** OpenRouter-specific routing preferences. Only used when baseUrl points to OpenRouter. */\n\topenRouterRouting?: OpenRouterRouting;\n\t/** Vercel AI Gateway routing preferences. Only used when baseUrl points to Vercel AI Gateway. */\n\tvercelGatewayRouting?: VercelGatewayRouting;\n\t/** Whether the provider supports the `strict` field in tool definitions. Default: true. */\n\tsupportsStrictMode?: boolean;\n}\n\n/** Compatibility settings for OpenAI Responses APIs. */\nexport interface OpenAIResponsesCompat {\n\t// Reserved for future use\n}\n\n/**\n * OpenRouter provider routing preferences.\n * Controls which upstream providers OpenRouter routes requests to.\n * @see https://openrouter.ai/docs/provider-routing\n */\nexport interface OpenRouterRouting {\n\t/** List of provider slugs to exclusively use for this request (e.g., [\"amazon-bedrock\", \"anthropic\"]). */\n\tonly?: string[];\n\t/** List of provider slugs to try in order (e.g., [\"anthropic\", \"openai\"]). */\n\torder?: string[];\n}\n\n/**\n * Vercel AI Gateway routing preferences.\n * Controls which upstream providers the gateway routes requests to.\n * @see https://vercel.com/docs/ai-gateway/models-and-providers/provider-options\n */\nexport interface VercelGatewayRouting {\n\t/** List of provider slugs to exclusively use for this request (e.g., [\"bedrock\", \"anthropic\"]). */\n\tonly?: string[];\n\t/** List of provider slugs to try in order (e.g., [\"anthropic\", \"openai\"]). */\n\torder?: string[];\n}\n\n/**\n * Provider-agnostic capability declarations for a model.\n *\n * These fields allow models to self-declare supported features so that call\n * sites can read from metadata rather than pattern-matching on model IDs or\n * provider names. Add fields here as new cross-provider capabilities emerge.\n */\nexport interface ModelCapabilities {\n\t/** Whether the model supports xhigh thinking level. */\n\tsupportsXhigh?: boolean;\n\t/**\n\t * Whether tool call IDs must be included and normalised in tool results for\n\t * this model. Relevant for models deployed cross-provider (e.g. Claude or\n\t * GPT variants via Google APIs) where the host API imposes stricter ID rules.\n\t */\n\trequiresToolCallId?: boolean;\n\t/** Whether OpenAI-style service tiers (priority/flex) apply to this model. */\n\tsupportsServiceTier?: boolean;\n\t/**\n\t * Approximate characters per token for this model.\n\t * Used as a fallback when an accurate tokenizer is unavailable.\n\t * If omitted, the provider-level default is used.\n\t */\n\tcharsPerToken?: number;\n}\n\n// Model interface for the unified model system\nexport interface Model<TApi extends Api> {\n\tid: string;\n\tname: string;\n\tapi: TApi;\n\tprovider: Provider;\n\tbaseUrl: string;\n\treasoning: boolean;\n\tinput: (\"text\" | \"image\")[];\n\tcost: {\n\t\tinput: number; // $/million tokens\n\t\toutput: number; // $/million tokens\n\t\tcacheRead: number; // $/million tokens\n\t\tcacheWrite: number; // $/million tokens\n\t};\n\tcontextWindow: number;\n\tmaxTokens: number;\n\theaders?: Record<string, string>;\n\t/** Compatibility overrides for OpenAI-compatible APIs. If not set, auto-detected from baseUrl. */\n\tcompat?: TApi extends \"openai-completions\"\n\t\t? OpenAICompletionsCompat\n\t\t: TApi extends \"openai-responses\"\n\t\t\t? OpenAIResponsesCompat\n\t\t\t: never;\n\t/**\n\t * Provider-agnostic capability declarations for this model.\n\t * Read these fields instead of pattern-matching on model IDs or provider names.\n\t */\n\tcapabilities?: ModelCapabilities;\n\t/** Opaque provider-specific options. Cast to the appropriate type in the provider's stream handler. */\n\tproviderOptions?: Record<string, unknown>;\n}\n"]}
@@ -137,7 +137,6 @@ export function getEnvApiKey(provider: any): string | undefined {
137
137
  "opencode-go": "OPENCODE_API_KEY",
138
138
  "kimi-coding": "KIMI_API_KEY",
139
139
  "alibaba-coding-plan": "ALIBABA_API_KEY",
140
- "alibaba-dashscope": "DASHSCOPE_API_KEY",
141
140
  ollama: "OLLAMA_API_KEY",
142
141
  "ollama-cloud": "OLLAMA_API_KEY",
143
142
  "custom-openai": "CUSTOM_OPENAI_API_KEY",
@@ -170,104 +170,6 @@ export const CUSTOM_MODELS = {
170
170
  } satisfies Model<"openai-completions">,
171
171
  },
172
172
 
173
- // ─── Alibaba DashScope ───────────────────────────────────────────────
174
- // Regular DashScope API for users without the Coding Plan.
175
- // Uses the international OpenAI-compatible endpoint.
176
- // Requires DASHSCOPE_API_KEY from: dashscope.console.aliyun.com
177
- // Pricing: https://www.alibabacloud.com/help/en/model-studio/model-pricing
178
- "alibaba-dashscope": {
179
- "qwen3-max": {
180
- id: "qwen3-max",
181
- name: "Qwen3 Max",
182
- api: "openai-completions",
183
- provider: "alibaba-dashscope",
184
- baseUrl: "https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
185
- reasoning: true,
186
- input: ["text"],
187
- cost: {
188
- input: 1.2,
189
- output: 6,
190
- cacheRead: 0,
191
- cacheWrite: 0,
192
- },
193
- contextWindow: 1000000,
194
- maxTokens: 32768,
195
- compat: { thinkingFormat: "qwen", supportsDeveloperRole: false },
196
- } satisfies Model<"openai-completions">,
197
- "qwen3.5-plus": {
198
- id: "qwen3.5-plus",
199
- name: "Qwen3.5 Plus",
200
- api: "openai-completions",
201
- provider: "alibaba-dashscope",
202
- baseUrl: "https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
203
- reasoning: true,
204
- input: ["text"],
205
- cost: {
206
- input: 0.4,
207
- output: 1.2,
208
- cacheRead: 0,
209
- cacheWrite: 0,
210
- },
211
- contextWindow: 1000000,
212
- maxTokens: 65536,
213
- compat: { thinkingFormat: "qwen", supportsDeveloperRole: false },
214
- } satisfies Model<"openai-completions">,
215
- "qwen3.5-flash": {
216
- id: "qwen3.5-flash",
217
- name: "Qwen3.5 Flash",
218
- api: "openai-completions",
219
- provider: "alibaba-dashscope",
220
- baseUrl: "https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
221
- reasoning: false,
222
- input: ["text"],
223
- cost: {
224
- input: 0.1,
225
- output: 0.4,
226
- cacheRead: 0,
227
- cacheWrite: 0,
228
- },
229
- contextWindow: 1000000,
230
- maxTokens: 32768,
231
- compat: { supportsDeveloperRole: false },
232
- } satisfies Model<"openai-completions">,
233
- "qwen3-coder-plus": {
234
- id: "qwen3-coder-plus",
235
- name: "Qwen3 Coder Plus",
236
- api: "openai-completions",
237
- provider: "alibaba-dashscope",
238
- baseUrl: "https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
239
- reasoning: false,
240
- input: ["text"],
241
- cost: {
242
- input: 1.0,
243
- output: 5.0,
244
- cacheRead: 0,
245
- cacheWrite: 0,
246
- },
247
- contextWindow: 1000000,
248
- maxTokens: 65536,
249
- compat: { supportsDeveloperRole: false },
250
- } satisfies Model<"openai-completions">,
251
- "qwen3.6-plus": {
252
- id: "qwen3.6-plus",
253
- name: "Qwen3.6 Plus",
254
- api: "openai-completions",
255
- provider: "alibaba-dashscope",
256
- baseUrl: "https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
257
- reasoning: true,
258
- input: ["text"],
259
- cost: {
260
- input: 0.5,
261
- output: 3.0,
262
- cacheRead: 0,
263
- cacheWrite: 0,
264
- },
265
- contextWindow: 1000000,
266
- maxTokens: 65536,
267
- compat: { thinkingFormat: "qwen", supportsDeveloperRole: false },
268
- } satisfies Model<"openai-completions">,
269
- },
270
-
271
173
  // ─── Z.AI (GLM-5.1) ────────────────────────────────────────────────
272
174
  // GLM-5.1 is the latest GLM model from Zhipu AI, not yet in models.dev.
273
175
  // Uses the Z.AI Coding Plan endpoint (OpenAI-compatible).