@bastani/pi-ai 0.9.21-alpha.1 → 0.9.21

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 (336) hide show
  1. package/CHANGELOG.md +25 -1
  2. package/NOTICE.md +1 -1
  3. package/dist/api/anthropic-messages.d.ts.map +1 -1
  4. package/dist/api/anthropic-messages.js.map +1 -1
  5. package/dist/api/anthropic-messages.lazy.d.ts.map +1 -1
  6. package/dist/api/azure-openai-responses.d.ts.map +1 -1
  7. package/dist/api/azure-openai-responses.js +2 -4
  8. package/dist/api/azure-openai-responses.js.map +1 -1
  9. package/dist/api/azure-openai-responses.lazy.d.ts.map +1 -1
  10. package/dist/api/bedrock-converse-stream.d.ts.map +1 -1
  11. package/dist/api/bedrock-converse-stream.js.map +1 -1
  12. package/dist/api/bedrock-converse-stream.lazy.d.ts.map +1 -1
  13. package/dist/api/bedrock-converse-stream.lazy.js.map +1 -1
  14. package/dist/api/cloudflare-gateway-binding.d.ts.map +1 -1
  15. package/dist/api/cloudflare-gateway-binding.js.map +1 -1
  16. package/dist/api/cloudflare-workers-ai-system-one.d.ts.map +1 -1
  17. package/dist/api/cloudflare-workers-ai-system-one.js.map +1 -1
  18. package/dist/api/cloudflare-workers-ai-system-one.lazy.d.ts.map +1 -1
  19. package/dist/api/cloudflare.d.ts.map +1 -1
  20. package/dist/api/cloudflare.js.map +1 -1
  21. package/dist/api/constrained-sampling.d.ts.map +1 -1
  22. package/dist/api/constrained-sampling.js.map +1 -1
  23. package/dist/api/github-copilot-headers.d.ts.map +1 -1
  24. package/dist/api/github-copilot-headers.js.map +1 -1
  25. package/dist/api/google-generative-ai.d.ts.map +1 -1
  26. package/dist/api/google-generative-ai.js.map +1 -1
  27. package/dist/api/google-generative-ai.lazy.d.ts.map +1 -1
  28. package/dist/api/google-shared.d.ts.map +1 -1
  29. package/dist/api/google-shared.js.map +1 -1
  30. package/dist/api/google-vertex.d.ts.map +1 -1
  31. package/dist/api/google-vertex.js.map +1 -1
  32. package/dist/api/google-vertex.lazy.d.ts.map +1 -1
  33. package/dist/api/lazy.d.ts.map +1 -1
  34. package/dist/api/lazy.js.map +1 -1
  35. package/dist/api/mistral-conversations.d.ts.map +1 -1
  36. package/dist/api/mistral-conversations.js +6 -0
  37. package/dist/api/mistral-conversations.js.map +1 -1
  38. package/dist/api/mistral-conversations.lazy.d.ts.map +1 -1
  39. package/dist/api/openai-codex-responses.d.ts.map +1 -1
  40. package/dist/api/openai-codex-responses.js.map +1 -1
  41. package/dist/api/openai-codex-responses.lazy.d.ts.map +1 -1
  42. package/dist/api/openai-completions.d.ts.map +1 -1
  43. package/dist/api/openai-completions.js +5 -6
  44. package/dist/api/openai-completions.js.map +1 -1
  45. package/dist/api/openai-completions.lazy.d.ts.map +1 -1
  46. package/dist/api/openai-prompt-cache.d.ts.map +1 -1
  47. package/dist/api/openai-prompt-cache.js.map +1 -1
  48. package/dist/api/openai-responses-shared.d.ts.map +1 -1
  49. package/dist/api/openai-responses-shared.js.map +1 -1
  50. package/dist/api/openai-responses.d.ts.map +1 -1
  51. package/dist/api/openai-responses.js +3 -4
  52. package/dist/api/openai-responses.js.map +1 -1
  53. package/dist/api/openai-responses.lazy.d.ts.map +1 -1
  54. package/dist/api/openrouter-images.d.ts.map +1 -1
  55. package/dist/api/openrouter-images.js.map +1 -1
  56. package/dist/api/openrouter-images.lazy.d.ts.map +1 -1
  57. package/dist/api/pi-messages.d.ts.map +1 -1
  58. package/dist/api/pi-messages.js.map +1 -1
  59. package/dist/api/pi-messages.lazy.d.ts.map +1 -1
  60. package/dist/api/simple-options.d.ts.map +1 -1
  61. package/dist/api/simple-options.js +1 -4
  62. package/dist/api/simple-options.js.map +1 -1
  63. package/dist/api/system-one-shared.d.ts.map +1 -1
  64. package/dist/api/system-one-shared.js.map +1 -1
  65. package/dist/api/transform-messages.d.ts.map +1 -1
  66. package/dist/api/transform-messages.js.map +1 -1
  67. package/dist/api/typesafe-system-one.d.ts.map +1 -1
  68. package/dist/api/typesafe-system-one.js.map +1 -1
  69. package/dist/api/typesafe-system-one.lazy.d.ts.map +1 -1
  70. package/dist/auth/context.d.ts.map +1 -1
  71. package/dist/auth/context.js.map +1 -1
  72. package/dist/auth/credential-store.d.ts.map +1 -1
  73. package/dist/auth/credential-store.js.map +1 -1
  74. package/dist/auth/helpers.d.ts.map +1 -1
  75. package/dist/auth/helpers.js.map +1 -1
  76. package/dist/auth/oauth/anthropic.d.ts.map +1 -1
  77. package/dist/auth/oauth/anthropic.js.map +1 -1
  78. package/dist/auth/oauth/device-code.d.ts.map +1 -1
  79. package/dist/auth/oauth/device-code.js.map +1 -1
  80. package/dist/auth/oauth/github-copilot.d.ts.map +1 -1
  81. package/dist/auth/oauth/github-copilot.js.map +1 -1
  82. package/dist/auth/oauth/kimi-coding.d.ts.map +1 -1
  83. package/dist/auth/oauth/kimi-coding.js.map +1 -1
  84. package/dist/auth/oauth/load.d.ts.map +1 -1
  85. package/dist/auth/oauth/load.js.map +1 -1
  86. package/dist/auth/oauth/meta.d.ts.map +1 -1
  87. package/dist/auth/oauth/meta.js.map +1 -1
  88. package/dist/auth/oauth/oauth-page.d.ts.map +1 -1
  89. package/dist/auth/oauth/oauth-page.js.map +1 -1
  90. package/dist/auth/oauth/openai-codex.d.ts.map +1 -1
  91. package/dist/auth/oauth/openai-codex.js.map +1 -1
  92. package/dist/auth/oauth/openrouter.d.ts.map +1 -1
  93. package/dist/auth/oauth/openrouter.js.map +1 -1
  94. package/dist/auth/oauth/pkce.d.ts.map +1 -1
  95. package/dist/auth/oauth/pkce.js.map +1 -1
  96. package/dist/auth/oauth/radius.d.ts.map +1 -1
  97. package/dist/auth/oauth/radius.js.map +1 -1
  98. package/dist/auth/oauth/xai.d.ts.map +1 -1
  99. package/dist/auth/oauth/xai.js.map +1 -1
  100. package/dist/auth/resolve.d.ts.map +1 -1
  101. package/dist/auth/resolve.js.map +1 -1
  102. package/dist/auth/types.d.ts.map +1 -1
  103. package/dist/bedrock-provider.d.ts.map +1 -1
  104. package/dist/bun-oauth.d.ts.map +1 -1
  105. package/dist/bun-oauth.js.map +1 -1
  106. package/dist/cli.d.ts.map +1 -1
  107. package/dist/cli.js.map +1 -1
  108. package/dist/compat/extension-oauth-types.d.ts.map +1 -1
  109. package/dist/compat.d.ts.map +1 -1
  110. package/dist/compat.js.map +1 -1
  111. package/dist/decision-models.d.ts.map +1 -1
  112. package/dist/decision-models.generated.d.ts.map +1 -1
  113. package/dist/decision-models.js.map +1 -1
  114. package/dist/env-api-keys.d.ts.map +1 -1
  115. package/dist/env-api-keys.js.map +1 -1
  116. package/dist/image-models.d.ts.map +1 -1
  117. package/dist/image-models.js.map +1 -1
  118. package/dist/images-api-registry.d.ts.map +1 -1
  119. package/dist/images-api-registry.js.map +1 -1
  120. package/dist/images.d.ts.map +1 -1
  121. package/dist/images.js.map +1 -1
  122. package/dist/index.d.ts.map +1 -1
  123. package/dist/legacy-api-aliases.d.ts.map +1 -1
  124. package/dist/model-catalog.d.ts.map +1 -1
  125. package/dist/model-catalog.js.map +1 -1
  126. package/dist/models-store.d.ts.map +1 -1
  127. package/dist/models-store.js.map +1 -1
  128. package/dist/models.d.ts.map +1 -1
  129. package/dist/models.generated.d.ts.map +1 -1
  130. package/dist/models.js.map +1 -1
  131. package/dist/oauth.d.ts.map +1 -1
  132. package/dist/providers/all.d.ts.map +1 -1
  133. package/dist/providers/all.js.map +1 -1
  134. package/dist/providers/amazon-bedrock.d.ts.map +1 -1
  135. package/dist/providers/amazon-bedrock.js.map +1 -1
  136. package/dist/providers/amazon-bedrock.models.d.ts.map +1 -1
  137. package/dist/providers/ant-ling.d.ts.map +1 -1
  138. package/dist/providers/ant-ling.js.map +1 -1
  139. package/dist/providers/ant-ling.models.d.ts.map +1 -1
  140. package/dist/providers/anthropic.d.ts.map +1 -1
  141. package/dist/providers/anthropic.js.map +1 -1
  142. package/dist/providers/anthropic.models.d.ts.map +1 -1
  143. package/dist/providers/azure-openai-responses.d.ts.map +1 -1
  144. package/dist/providers/azure-openai-responses.js.map +1 -1
  145. package/dist/providers/azure-openai-responses.models.d.ts.map +1 -1
  146. package/dist/providers/baseten.d.ts.map +1 -1
  147. package/dist/providers/baseten.js.map +1 -1
  148. package/dist/providers/baseten.models.d.ts.map +1 -1
  149. package/dist/providers/cerebras.d.ts.map +1 -1
  150. package/dist/providers/cerebras.js.map +1 -1
  151. package/dist/providers/cerebras.models.d.ts.map +1 -1
  152. package/dist/providers/cloudflare-ai-gateway.d.ts.map +1 -1
  153. package/dist/providers/cloudflare-ai-gateway.js.map +1 -1
  154. package/dist/providers/cloudflare-ai-gateway.models.d.ts.map +1 -1
  155. package/dist/providers/cloudflare-auth.d.ts.map +1 -1
  156. package/dist/providers/cloudflare-auth.js.map +1 -1
  157. package/dist/providers/cloudflare-stream.d.ts.map +1 -1
  158. package/dist/providers/cloudflare-stream.js.map +1 -1
  159. package/dist/providers/cloudflare-workers-ai.d.ts.map +1 -1
  160. package/dist/providers/cloudflare-workers-ai.js.map +1 -1
  161. package/dist/providers/cloudflare-workers-ai.models.d.ts.map +1 -1
  162. package/dist/providers/data/.manifest.json +1 -1
  163. package/dist/providers/data/fireworks.json +1 -1
  164. package/dist/providers/data/opencode-go.json +1 -1
  165. package/dist/providers/data/opencode.json +1 -1
  166. package/dist/providers/data/openrouter.json +1 -1
  167. package/dist/providers/data/vercel-ai-gateway.json +1 -1
  168. package/dist/providers/deepseek.d.ts.map +1 -1
  169. package/dist/providers/deepseek.js.map +1 -1
  170. package/dist/providers/deepseek.models.d.ts.map +1 -1
  171. package/dist/providers/faux.d.ts +2 -2
  172. package/dist/providers/faux.d.ts.map +1 -1
  173. package/dist/providers/faux.js.map +1 -1
  174. package/dist/providers/fireworks.d.ts.map +1 -1
  175. package/dist/providers/fireworks.js.map +1 -1
  176. package/dist/providers/fireworks.models.d.ts.map +1 -1
  177. package/dist/providers/github-copilot-env.d.ts.map +1 -1
  178. package/dist/providers/github-copilot-env.js.map +1 -1
  179. package/dist/providers/github-copilot.d.ts.map +1 -1
  180. package/dist/providers/github-copilot.js.map +1 -1
  181. package/dist/providers/github-copilot.models.d.ts.map +1 -1
  182. package/dist/providers/google-vertex.d.ts.map +1 -1
  183. package/dist/providers/google-vertex.js.map +1 -1
  184. package/dist/providers/google-vertex.models.d.ts.map +1 -1
  185. package/dist/providers/google.d.ts.map +1 -1
  186. package/dist/providers/google.js.map +1 -1
  187. package/dist/providers/google.models.d.ts.map +1 -1
  188. package/dist/providers/groq.d.ts.map +1 -1
  189. package/dist/providers/groq.js.map +1 -1
  190. package/dist/providers/groq.models.d.ts.map +1 -1
  191. package/dist/providers/huggingface.d.ts.map +1 -1
  192. package/dist/providers/huggingface.js.map +1 -1
  193. package/dist/providers/huggingface.models.d.ts.map +1 -1
  194. package/dist/providers/images/register-builtins.d.ts.map +1 -1
  195. package/dist/providers/images/register-builtins.js.map +1 -1
  196. package/dist/providers/kimi-coding.d.ts.map +1 -1
  197. package/dist/providers/kimi-coding.js.map +1 -1
  198. package/dist/providers/kimi-coding.models.d.ts.map +1 -1
  199. package/dist/providers/meta.d.ts.map +1 -1
  200. package/dist/providers/meta.js.map +1 -1
  201. package/dist/providers/meta.models.d.ts.map +1 -1
  202. package/dist/providers/minimax-cn.d.ts.map +1 -1
  203. package/dist/providers/minimax-cn.js.map +1 -1
  204. package/dist/providers/minimax-cn.models.d.ts.map +1 -1
  205. package/dist/providers/minimax.d.ts.map +1 -1
  206. package/dist/providers/minimax.js.map +1 -1
  207. package/dist/providers/minimax.models.d.ts.map +1 -1
  208. package/dist/providers/mistral.d.ts.map +1 -1
  209. package/dist/providers/mistral.js.map +1 -1
  210. package/dist/providers/mistral.models.d.ts.map +1 -1
  211. package/dist/providers/moonshotai-cn.d.ts.map +1 -1
  212. package/dist/providers/moonshotai-cn.js.map +1 -1
  213. package/dist/providers/moonshotai-cn.models.d.ts.map +1 -1
  214. package/dist/providers/moonshotai.d.ts.map +1 -1
  215. package/dist/providers/moonshotai.js.map +1 -1
  216. package/dist/providers/moonshotai.models.d.ts.map +1 -1
  217. package/dist/providers/nvidia.d.ts.map +1 -1
  218. package/dist/providers/nvidia.js.map +1 -1
  219. package/dist/providers/nvidia.models.d.ts.map +1 -1
  220. package/dist/providers/openai-codex.d.ts.map +1 -1
  221. package/dist/providers/openai-codex.js.map +1 -1
  222. package/dist/providers/openai-codex.models.d.ts.map +1 -1
  223. package/dist/providers/openai.d.ts.map +1 -1
  224. package/dist/providers/openai.js.map +1 -1
  225. package/dist/providers/openai.models.d.ts.map +1 -1
  226. package/dist/providers/opencode-go.d.ts.map +1 -1
  227. package/dist/providers/opencode-go.js.map +1 -1
  228. package/dist/providers/opencode-go.models.d.ts.map +1 -1
  229. package/dist/providers/opencode.d.ts.map +1 -1
  230. package/dist/providers/opencode.js.map +1 -1
  231. package/dist/providers/opencode.models.d.ts.map +1 -1
  232. package/dist/providers/openrouter.d.ts.map +1 -1
  233. package/dist/providers/openrouter.js.map +1 -1
  234. package/dist/providers/openrouter.models.d.ts.map +1 -1
  235. package/dist/providers/qwen-token-plan-cn.d.ts.map +1 -1
  236. package/dist/providers/qwen-token-plan-cn.js.map +1 -1
  237. package/dist/providers/qwen-token-plan-cn.models.d.ts.map +1 -1
  238. package/dist/providers/qwen-token-plan-individual.d.ts.map +1 -1
  239. package/dist/providers/qwen-token-plan-individual.js.map +1 -1
  240. package/dist/providers/qwen-token-plan-individual.models.d.ts.map +1 -1
  241. package/dist/providers/qwen-token-plan.d.ts.map +1 -1
  242. package/dist/providers/qwen-token-plan.js.map +1 -1
  243. package/dist/providers/qwen-token-plan.models.d.ts.map +1 -1
  244. package/dist/providers/radius-config.d.ts.map +1 -1
  245. package/dist/providers/radius-config.js.map +1 -1
  246. package/dist/providers/radius.d.ts.map +1 -1
  247. package/dist/providers/radius.js.map +1 -1
  248. package/dist/providers/radius.models.d.ts.map +1 -1
  249. package/dist/providers/together.d.ts.map +1 -1
  250. package/dist/providers/together.js.map +1 -1
  251. package/dist/providers/together.models.d.ts.map +1 -1
  252. package/dist/providers/typesafe.d.ts.map +1 -1
  253. package/dist/providers/typesafe.js.map +1 -1
  254. package/dist/providers/typesafe.models.d.ts.map +1 -1
  255. package/dist/providers/vercel-ai-gateway.d.ts.map +1 -1
  256. package/dist/providers/vercel-ai-gateway.js.map +1 -1
  257. package/dist/providers/vercel-ai-gateway.models.d.ts.map +1 -1
  258. package/dist/providers/xai.d.ts.map +1 -1
  259. package/dist/providers/xai.js.map +1 -1
  260. package/dist/providers/xai.models.d.ts.map +1 -1
  261. package/dist/providers/xiaomi-token-plan-ams.d.ts.map +1 -1
  262. package/dist/providers/xiaomi-token-plan-ams.js.map +1 -1
  263. package/dist/providers/xiaomi-token-plan-ams.models.d.ts.map +1 -1
  264. package/dist/providers/xiaomi-token-plan-cn.d.ts.map +1 -1
  265. package/dist/providers/xiaomi-token-plan-cn.js.map +1 -1
  266. package/dist/providers/xiaomi-token-plan-cn.models.d.ts.map +1 -1
  267. package/dist/providers/xiaomi-token-plan-sgp.d.ts.map +1 -1
  268. package/dist/providers/xiaomi-token-plan-sgp.js.map +1 -1
  269. package/dist/providers/xiaomi-token-plan-sgp.models.d.ts.map +1 -1
  270. package/dist/providers/xiaomi.d.ts.map +1 -1
  271. package/dist/providers/xiaomi.js.map +1 -1
  272. package/dist/providers/xiaomi.models.d.ts.map +1 -1
  273. package/dist/providers/zai-coding-cn.d.ts.map +1 -1
  274. package/dist/providers/zai-coding-cn.js.map +1 -1
  275. package/dist/providers/zai-coding-cn.models.d.ts.map +1 -1
  276. package/dist/providers/zai.d.ts.map +1 -1
  277. package/dist/providers/zai.js.map +1 -1
  278. package/dist/providers/zai.models.d.ts.map +1 -1
  279. package/dist/session-resources.d.ts.map +1 -1
  280. package/dist/session-resources.js.map +1 -1
  281. package/dist/types.d.ts.map +1 -1
  282. package/dist/utils/abort-signals.d.ts.map +1 -1
  283. package/dist/utils/abort-signals.js.map +1 -1
  284. package/dist/utils/abort.d.ts.map +1 -1
  285. package/dist/utils/abort.js.map +1 -1
  286. package/dist/utils/assistant-message-frame.d.ts.map +1 -1
  287. package/dist/utils/assistant-message-frame.js.map +1 -1
  288. package/dist/utils/diagnostics.d.ts.map +1 -1
  289. package/dist/utils/diagnostics.js.map +1 -1
  290. package/dist/utils/document-input.d.ts.map +1 -1
  291. package/dist/utils/document-input.js.map +1 -1
  292. package/dist/utils/error-body.d.ts.map +1 -1
  293. package/dist/utils/error-body.js.map +1 -1
  294. package/dist/utils/estimate.d.ts.map +1 -1
  295. package/dist/utils/estimate.js.map +1 -1
  296. package/dist/utils/event-stream.d.ts.map +1 -1
  297. package/dist/utils/event-stream.js.map +1 -1
  298. package/dist/utils/hash.d.ts.map +1 -1
  299. package/dist/utils/hash.js.map +1 -1
  300. package/dist/utils/headers.d.ts.map +1 -1
  301. package/dist/utils/headers.js.map +1 -1
  302. package/dist/utils/json-parse.d.ts.map +1 -1
  303. package/dist/utils/json-parse.js.map +1 -1
  304. package/dist/utils/model-operations.d.ts.map +1 -1
  305. package/dist/utils/model-operations.js.map +1 -1
  306. package/dist/utils/models-error.d.ts.map +1 -1
  307. package/dist/utils/models-error.js.map +1 -1
  308. package/dist/utils/node-http-proxy.d.ts.map +1 -1
  309. package/dist/utils/node-http-proxy.js.map +1 -1
  310. package/dist/utils/overflow.d.ts.map +1 -1
  311. package/dist/utils/overflow.js.map +1 -1
  312. package/dist/utils/pi-user-agent.d.ts.map +1 -1
  313. package/dist/utils/pi-user-agent.js.map +1 -1
  314. package/dist/utils/provider-env.d.ts.map +1 -1
  315. package/dist/utils/provider-env.js.map +1 -1
  316. package/dist/utils/provider-retry.d.ts.map +1 -1
  317. package/dist/utils/provider-retry.js.map +1 -1
  318. package/dist/utils/retry.d.ts.map +1 -1
  319. package/dist/utils/retry.js.map +1 -1
  320. package/dist/utils/sanitize-unicode.d.ts.map +1 -1
  321. package/dist/utils/sanitize-unicode.js.map +1 -1
  322. package/dist/utils/sleep.d.ts.map +1 -1
  323. package/dist/utils/sleep.js.map +1 -1
  324. package/dist/utils/stream-deadline.d.ts.map +1 -1
  325. package/dist/utils/stream-deadline.js.map +1 -1
  326. package/dist/utils/text.d.ts.map +1 -1
  327. package/dist/utils/text.js.map +1 -1
  328. package/dist/utils/transcript.d.ts.map +1 -1
  329. package/dist/utils/transcript.js.map +1 -1
  330. package/dist/utils/typebox-helpers.d.ts.map +1 -1
  331. package/dist/utils/typebox-helpers.js.map +1 -1
  332. package/dist/utils/uuid.d.ts.map +1 -1
  333. package/dist/utils/uuid.js.map +1 -1
  334. package/dist/utils/validation.d.ts.map +1 -1
  335. package/dist/utils/validation.js.map +1 -1
  336. package/package.json +5 -6
@@ -1 +1 @@
1
- {"version":3,"file":"deepseek.d.ts","sourceRoot":"","sources":["../../src/providers/deepseek.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG7D,wBAAgB,gBAAgB,IAAI,QAAQ,CAAC,oBAAoB,CAAC,CASjE","sourcesContent":["import { openAICompletionsApi } from \"../api/openai-completions.lazy.ts\";\nimport { envApiKeyAuth } from \"../auth/helpers.ts\";\nimport { createProvider, type Provider } from \"../models.ts\";\nimport { DEEPSEEK_MODELS } from \"./deepseek.models.ts\";\n\nexport function deepseekProvider(): Provider<\"openai-completions\"> {\n\treturn createProvider({\n\t\tid: \"deepseek\",\n\t\tname: \"DeepSeek\",\n\t\tbaseUrl: \"https://api.deepseek.com\",\n\t\tauth: { apiKey: envApiKeyAuth(\"DeepSeek API key\", [\"DEEPSEEK_API_KEY\"]) },\n\t\tmodels: Object.values(DEEPSEEK_MODELS),\n\t\tapi: openAICompletionsApi(),\n\t});\n}\n"]}
1
+ {"version":3,"file":"deepseek.d.ts","sourceRoot":"","sources":["../../src/providers/deepseek.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG7D,wBAAgB,gBAAgB,IAAI,QAAQ,CAAC,oBAAoB,CAAC,CASjE"}
@@ -1 +1 @@
1
- {"version":3,"file":"deepseek.js","sourceRoot":"","sources":["../../src/providers/deepseek.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAiB,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,UAAU,gBAAgB,GAAmC;IAClE,OAAO,cAAc,CAAC;QACrB,EAAE,EAAE,UAAU;QACd,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,0BAA0B;QACnC,IAAI,EAAE,EAAE,MAAM,EAAE,aAAa,CAAC,kBAAkB,EAAE,CAAC,kBAAkB,CAAC,CAAC,EAAE;QACzE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC;QACtC,GAAG,EAAE,oBAAoB,EAAE;KAC3B,CAAC,CAAC;AAAA,CACH","sourcesContent":["import { openAICompletionsApi } from \"../api/openai-completions.lazy.ts\";\nimport { envApiKeyAuth } from \"../auth/helpers.ts\";\nimport { createProvider, type Provider } from \"../models.ts\";\nimport { DEEPSEEK_MODELS } from \"./deepseek.models.ts\";\n\nexport function deepseekProvider(): Provider<\"openai-completions\"> {\n\treturn createProvider({\n\t\tid: \"deepseek\",\n\t\tname: \"DeepSeek\",\n\t\tbaseUrl: \"https://api.deepseek.com\",\n\t\tauth: { apiKey: envApiKeyAuth(\"DeepSeek API key\", [\"DEEPSEEK_API_KEY\"]) },\n\t\tmodels: Object.values(DEEPSEEK_MODELS),\n\t\tapi: openAICompletionsApi(),\n\t});\n}\n"]}
1
+ {"version":3,"file":"deepseek.js","sourceRoot":"","sources":["../../src/providers/deepseek.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAiB,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,UAAU,gBAAgB;IAC/B,OAAO,cAAc,CAAC;QACrB,EAAE,EAAE,UAAU;QACd,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,0BAA0B;QACnC,IAAI,EAAE,EAAE,MAAM,EAAE,aAAa,CAAC,kBAAkB,EAAE,CAAC,kBAAkB,CAAC,CAAC,EAAE;QACzE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC;QACtC,GAAG,EAAE,oBAAoB,EAAE;KAC3B,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { openAICompletionsApi } from \"../api/openai-completions.lazy.ts\";\nimport { envApiKeyAuth } from \"../auth/helpers.ts\";\nimport { createProvider, type Provider } from \"../models.ts\";\nimport { DEEPSEEK_MODELS } from \"./deepseek.models.ts\";\n\nexport function deepseekProvider(): Provider<\"openai-completions\"> {\n\treturn createProvider({\n\t\tid: \"deepseek\",\n\t\tname: \"DeepSeek\",\n\t\tbaseUrl: \"https://api.deepseek.com\",\n\t\tauth: { apiKey: envApiKeyAuth(\"DeepSeek API key\", [\"DEEPSEEK_API_KEY\"]) },\n\t\tmodels: Object.values(DEEPSEEK_MODELS),\n\t\tapi: openAICompletionsApi(),\n\t});\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"deepseek.models.d.ts","sourceRoot":"","sources":["../../src/providers/deepseek.models.ts"],"names":[],"mappings":"AAIA,OAAO,EAAoF,KAAK,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAEnM,eAAO,MAAM,eAAe,EAAE,gBAAgB,CAAC,cAAc,sBAAsB,EAAU,UAAE,IAAI,EAAE,MAAM,IAAE,CAAG,EAAE,UAAU,CAChF,CAAC;AAE7C,eAAO,MAAM,qBAAqB,EAAE,iBAAiB,CAAC,cAAc,sBAAsB,EAAU,UAAE,IAAI,EAAE,MAAM,IAAE,CAAG,EAAE,UAAU,CACtF,CAAC;AAE9C,eAAO,MAAM,0BAA0B,EAAE,sBAAsB,CAAC,cAAc,sBAAsB,EAAU,UAAE,IAAI,EAAE,MAAM,IAAE,CAAG,EAAE,UAAU,CAC3F,CAAC","sourcesContent":["// This file is auto-generated by scripts/generate-models.ts\n// Do not edit manually - run 'npm run generate-models' to update\n\nimport values from \"./data/deepseek.json\" with { type: \"json\" };\nimport { flattenChatModelCatalog, flattenImageModelCatalog, flattenClassifierModelCatalog, type ChatModelCatalog, type ImageModelCatalog, type ClassifierModelCatalog } from \"../model-catalog.ts\";\n\nexport const DEEPSEEK_MODELS: ChatModelCatalog<typeof import(\"./data/deepseek.json\", { with: { type: \"json\" } }), \"deepseek\"> =\n\tflattenChatModelCatalog(\"deepseek\", values);\n\nexport const DEEPSEEK_IMAGE_MODELS: ImageModelCatalog<typeof import(\"./data/deepseek.json\", { with: { type: \"json\" } }), \"deepseek\"> =\n\tflattenImageModelCatalog(\"deepseek\", values);\n\nexport const DEEPSEEK_CLASSIFIER_MODELS: ClassifierModelCatalog<typeof import(\"./data/deepseek.json\", { with: { type: \"json\" } }), \"deepseek\"> =\n\tflattenClassifierModelCatalog(\"deepseek\", values);\n"]}
1
+ {"version":3,"file":"deepseek.models.d.ts","sourceRoot":"","sources":["../../src/providers/deepseek.models.ts"],"names":[],"mappings":"AAIA,OAAO,EAAoF,KAAK,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAEnM,eAAO,MAAM,eAAe,EAAE,gBAAgB,CAAC,cAAc,sBAAsB,EAAU,UAAE,IAAI,EAAE,MAAM,IAAE,CAAG,EAAE,UAAU,CAChF,CAAC;AAE7C,eAAO,MAAM,qBAAqB,EAAE,iBAAiB,CAAC,cAAc,sBAAsB,EAAU,UAAE,IAAI,EAAE,MAAM,IAAE,CAAG,EAAE,UAAU,CACtF,CAAC;AAE9C,eAAO,MAAM,0BAA0B,EAAE,sBAAsB,CAAC,cAAc,sBAAsB,EAAU,UAAE,IAAI,EAAE,MAAM,IAAE,CAAG,EAAE,UAAU,CAC3F,CAAC"}
@@ -78,8 +78,8 @@ export declare function createFauxCore(options: RegisterFauxProviderOptions): {
78
78
  models: [Model<string>, ...Model<string>[]];
79
79
  stream: StreamFunction<string, SimpleStreamOptions>;
80
80
  streamSimple: StreamFunction<string, SimpleStreamOptions>;
81
- fetchDeferred: (requestModel: Model<string>, handle: DeferredHandle, fetchOptions?: DeferredFetchOptions | undefined) => AssistantMessageEventStream;
82
- cancelDeferred: (requestModel: Model<string>, handle: DeferredHandle, cancelOptions?: DeferredCancelOptions | undefined) => Promise<void>;
81
+ fetchDeferred: (requestModel: Model<string>, handle: DeferredHandle, fetchOptions?: DeferredFetchOptions) => AssistantMessageEventStream;
82
+ cancelDeferred: (requestModel: Model<string>, handle: DeferredHandle, cancelOptions?: DeferredCancelOptions) => Promise<void>;
83
83
  getModel: {
84
84
  (): Model<string>;
85
85
  (requestedModelId: string): Model<string> | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"faux.d.ts","sourceRoot":"","sources":["../../src/providers/faux.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAAK,EACX,gBAAgB,EAChB,2BAA2B,EAC3B,qBAAqB,EACrB,oBAAoB,EACpB,cAAc,EAId,KAAK,EACL,mBAAmB,EACnB,cAAc,EAEd,WAAW,EACX,eAAe,EACf,QAAQ,EAER,iBAAiB,EAEjB,MAAM,aAAa,CAAC;AAqBrB,MAAM,WAAW,mBAAmB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,CAAC,MAAM,GAAG,OAAO,CAAC,EAAE,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C;IACZ,MAAM,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC5C,QAAQ,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IACrD,KAAK,EAAE,iBAAiB,CAAC;IACzB,YAAY,EAAE,CAAC,SAAS,EAAE,gBAAgB,EAAE,KAAK,IAAI,CAAC;IACtD,eAAe,EAAE,CAAC,SAAS,EAAE,gBAAgB,EAAE,KAAK,IAAI,CAAC;IACzD,uBAAuB,EAAE,MAAM,MAAM,CAAC;CACtC;AA0SD,wBAAgB,cAAc,CAAC,OAAO,EAAE,2BAA2B;;;;;;;;;;;;;;;;EA8OlE;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,2BAAgC,GAAG,kBAAkB,CAuB1F","sourcesContent":["import { createProvider, type Provider } from \"../models.ts\";\nimport type {\n\tAssistantMessage,\n\tAssistantMessageEventStream,\n\tDeferredCancelOptions,\n\tDeferredFetchOptions,\n\tDeferredHandle,\n\tDocumentContent,\n\tImageContent,\n\tMessage,\n\tModel,\n\tSimpleStreamOptions,\n\tStreamFunction,\n\tStreamOptions,\n\tTextContent,\n\tThinkingContent,\n\tToolCall,\n\tToolResultMessage,\n\tTranscriptContext,\n\tUsage,\n} from \"../types.ts\";\nimport { createAssistantMessageEventStream } from \"../utils/event-stream.ts\";\nimport { getSystemMessageText } from \"../utils/text.ts\";\n\nconst DEFAULT_API = \"faux\";\nconst DEFAULT_PROVIDER = \"faux\";\nconst DEFAULT_MODEL_ID = \"faux-1\";\nconst DEFAULT_MODEL_NAME = \"Faux Model\";\nconst DEFAULT_BASE_URL = \"http://localhost:0\";\nconst DEFAULT_MIN_TOKEN_SIZE = 3;\nconst DEFAULT_MAX_TOKEN_SIZE = 5;\n\nconst DEFAULT_USAGE: Usage = {\n\tinput: 0,\n\toutput: 0,\n\tcacheRead: 0,\n\tcacheWrite: 0,\n\ttotalTokens: 0,\n\tcost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },\n};\n\nexport interface FauxModelDefinition {\n\tid: string;\n\tname?: string;\n\treasoning?: boolean;\n\tinput?: (\"text\" | \"image\")[];\n\tinputLimits?: Model<string>[\"inputLimits\"];\n\tcost?: { input: number; output: number; cacheRead: number; cacheWrite: number };\n\tcontextWindow?: number;\n\tmaxTokens?: number;\n}\n\nexport type FauxContentBlock = TextContent | ThinkingContent | ToolCall;\n\nexport function fauxText(text: string): TextContent {\n\treturn { type: \"text\", text };\n}\n\nexport function fauxThinking(thinking: string): ThinkingContent {\n\treturn { type: \"thinking\", thinking };\n}\n\nexport function fauxToolCall(name: string, arguments_: ToolCall[\"arguments\"], options: { id?: string } = {}): ToolCall {\n\treturn {\n\t\ttype: \"toolCall\",\n\t\tid: options.id ?? randomId(\"tool\"),\n\t\tname,\n\t\targuments: arguments_,\n\t};\n}\n\nfunction normalizeFauxAssistantContent(content: string | FauxContentBlock | FauxContentBlock[]): FauxContentBlock[] {\n\tif (typeof content === \"string\") {\n\t\treturn [fauxText(content)];\n\t}\n\treturn Array.isArray(content) ? content : [content];\n}\n\nexport function fauxAssistantMessage(\n\tcontent: string | FauxContentBlock | FauxContentBlock[],\n\toptions: {\n\t\tstopReason?: AssistantMessage[\"stopReason\"];\n\t\tdeferred?: DeferredHandle;\n\t\terrorMessage?: string;\n\t\tresponseId?: string;\n\t\ttimestamp?: number;\n\t} = {},\n): AssistantMessage {\n\treturn {\n\t\trole: \"assistant\",\n\t\tcontent: normalizeFauxAssistantContent(content),\n\t\tapi: DEFAULT_API,\n\t\tprovider: DEFAULT_PROVIDER,\n\t\tmodel: DEFAULT_MODEL_ID,\n\t\tusage: DEFAULT_USAGE,\n\t\tstopReason: options.stopReason ?? \"stop\",\n\t\tdeferred: options.deferred,\n\t\terrorMessage: options.errorMessage,\n\t\tresponseId: options.responseId,\n\t\ttimestamp: options.timestamp ?? Date.now(),\n\t};\n}\n\nexport interface FauxProviderState {\n\tcallCount: number;\n\tdeferredFetchCount: number;\n\tcancelledDeferred: DeferredHandle[];\n}\n\nexport type FauxResponseFactory = (\n\tcontext: TranscriptContext,\n\toptions: SimpleStreamOptions | undefined,\n\tstate: FauxProviderState,\n\tmodel: Model<string>,\n) => AssistantMessage | Promise<AssistantMessage>;\n\nexport type FauxResponseStep = AssistantMessage | FauxResponseFactory;\n\nexport interface RegisterFauxProviderOptions {\n\tapi?: string;\n\tprovider?: string;\n\tmodels?: FauxModelDefinition[];\n\tdeferred?: {\n\t\t/** Number of fetches that return the original handle before the scripted response becomes ready. */\n\t\tpendingFetches?: number;\n\t\tpollAfterMs?: number;\n\t};\n\ttokensPerSecond?: number;\n\ttokenSize?: {\n\t\tmin?: number;\n\t\tmax?: number;\n\t};\n}\n\nexport interface FauxProviderRegistration {\n\tapi: string;\n\tmodels: [Model<string>, ...Model<string>[]];\n\tgetModel(): Model<string>;\n\tgetModel(modelId: string): Model<string> | undefined;\n\tstate: FauxProviderState;\n\tsetResponses: (responses: FauxResponseStep[]) => void;\n\tappendResponses: (responses: FauxResponseStep[]) => void;\n\tgetPendingResponseCount: () => number;\n\tunregister: () => void;\n}\n\nexport interface FauxProviderHandle {\n\tprovider: Provider;\n\tapi: string;\n\tmodels: [Model<string>, ...Model<string>[]];\n\tgetModel(): Model<string>;\n\tgetModel(modelId: string): Model<string> | undefined;\n\tstate: FauxProviderState;\n\tsetResponses: (responses: FauxResponseStep[]) => void;\n\tappendResponses: (responses: FauxResponseStep[]) => void;\n\tgetPendingResponseCount: () => number;\n}\n\nfunction estimateTokens(text: string): number {\n\treturn Math.ceil(text.length / 4);\n}\n\nfunction randomId(prefix: string): string {\n\treturn `${prefix}:${Date.now()}:${Math.random().toString(36).slice(2)}`;\n}\n\nfunction contentToText(content: string | Array<TextContent | ImageContent | DocumentContent>): string {\n\tif (typeof content === \"string\") {\n\t\treturn content;\n\t}\n\treturn content\n\t\t.map((block) => {\n\t\t\tif (block.type === \"text\") {\n\t\t\t\treturn block.text;\n\t\t\t}\n\t\t\tif (block.type === \"document\") {\n\t\t\t\treturn `[document:${block.mimeType}:${block.data.length}]`;\n\t\t\t}\n\t\t\treturn `[image:${block.mimeType}:${block.data.length}]`;\n\t\t})\n\t\t.join(\"\\n\");\n}\n\nfunction assistantContentToText(content: AssistantMessage[\"content\"]): string {\n\treturn content\n\t\t.map((block) => {\n\t\t\tif (block.type === \"text\") {\n\t\t\t\treturn block.text;\n\t\t\t}\n\t\t\tif (block.type === \"thinking\") {\n\t\t\t\treturn block.thinking;\n\t\t\t}\n\t\t\t// Fallback boundary markers carry no text.\n\t\t\tif (block.type !== \"toolCall\") {\n\t\t\t\treturn \"\";\n\t\t\t}\n\t\t\treturn `${block.name}:${JSON.stringify(block.arguments)}`;\n\t\t})\n\t\t.join(\"\\n\");\n}\n\nfunction toolResultToText(message: ToolResultMessage): string {\n\treturn [message.toolName, ...message.content.map((block) => contentToText([block]))].join(\"\\n\");\n}\n\nfunction messageToText(message: Message): string {\n\tif (message.role === \"system\") {\n\t\treturn [\n\t\t\tgetSystemMessageText(message),\n\t\t\t...(message.toolsRemoved?.map((tool) => `tool-:${JSON.stringify(tool)}`) ?? []),\n\t\t\t...(message.toolsAdded?.map((tool) => `tool+:${JSON.stringify(tool)}`) ?? []),\n\t\t]\n\t\t\t.filter((part) => part.length > 0)\n\t\t\t.join(\"\\n\");\n\t}\n\tif (message.role === \"user\") {\n\t\treturn contentToText(message.content);\n\t}\n\tif (message.role === \"assistant\") {\n\t\treturn assistantContentToText(message.content);\n\t}\n\treturn toolResultToText(message);\n}\n\nfunction serializeContext(context: TranscriptContext): string {\n\treturn context.messages.map((message) => `${message.role}:${messageToText(message)}`).join(\"\\n\\n\");\n}\n\nfunction commonPrefixLength(a: string, b: string): number {\n\tconst length = Math.min(a.length, b.length);\n\tlet index = 0;\n\twhile (index < length && a[index] === b[index]) {\n\t\tindex++;\n\t}\n\treturn index;\n}\n\nfunction withUsageEstimate(\n\tmessage: AssistantMessage,\n\tcontext: TranscriptContext,\n\toptions: StreamOptions | undefined,\n\tpromptCache: Map<string, string>,\n): AssistantMessage {\n\tconst promptText = serializeContext(context);\n\tconst promptTokens = estimateTokens(promptText);\n\tconst outputTokens = estimateTokens(assistantContentToText(message.content));\n\tlet input = promptTokens;\n\tlet cacheRead = 0;\n\tlet cacheWrite = 0;\n\tconst sessionId = options?.sessionId;\n\n\tif (sessionId && options?.cacheRetention !== \"none\") {\n\t\tconst previousPrompt = promptCache.get(sessionId);\n\t\tif (previousPrompt) {\n\t\t\tconst cachedChars = commonPrefixLength(previousPrompt, promptText);\n\t\t\tcacheRead = estimateTokens(previousPrompt.slice(0, cachedChars));\n\t\t\tcacheWrite = estimateTokens(promptText.slice(cachedChars));\n\t\t\tinput = Math.max(0, promptTokens - cacheRead);\n\t\t} else {\n\t\t\tcacheWrite = promptTokens;\n\t\t}\n\t\tpromptCache.set(sessionId, promptText);\n\t}\n\n\treturn {\n\t\t...message,\n\t\tusage: {\n\t\t\tinput,\n\t\t\toutput: outputTokens,\n\t\t\tcacheRead,\n\t\t\tcacheWrite,\n\t\t\ttotalTokens: input + outputTokens + cacheRead + cacheWrite,\n\t\t\tcost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },\n\t\t},\n\t};\n}\n\nfunction splitStringByTokenSize(text: string, minTokenSize: number, maxTokenSize: number): string[] {\n\tconst chunks: string[] = [];\n\tlet index = 0;\n\twhile (index < text.length) {\n\t\tconst tokenSize = minTokenSize + Math.floor(Math.random() * (maxTokenSize - minTokenSize + 1));\n\t\tconst charSize = Math.max(1, tokenSize * 4);\n\t\tchunks.push(text.slice(index, index + charSize));\n\t\tindex += charSize;\n\t}\n\treturn chunks.length > 0 ? chunks : [\"\"];\n}\n\nfunction cloneMessage(message: AssistantMessage, api: string, provider: string, modelId: string): AssistantMessage {\n\tconst cloned = structuredClone(message);\n\treturn {\n\t\t...cloned,\n\t\tapi,\n\t\tprovider,\n\t\tmodel: modelId,\n\t\ttimestamp: cloned.timestamp ?? Date.now(),\n\t\tusage: cloned.usage ?? DEFAULT_USAGE,\n\t};\n}\n\nfunction createDeferredMessage(model: Model<string>, handle: DeferredHandle): AssistantMessage {\n\treturn {\n\t\trole: \"assistant\",\n\t\tcontent: [],\n\t\tapi: model.api,\n\t\tprovider: model.provider,\n\t\tmodel: model.id,\n\t\tusage: DEFAULT_USAGE,\n\t\tstopReason: \"deferred\",\n\t\tdeferred: handle,\n\t\ttimestamp: Date.now(),\n\t};\n}\n\nfunction createErrorMessage(error: unknown, api: string, provider: string, modelId: string): AssistantMessage {\n\treturn {\n\t\trole: \"assistant\",\n\t\tcontent: [],\n\t\tapi,\n\t\tprovider,\n\t\tmodel: modelId,\n\t\tusage: DEFAULT_USAGE,\n\t\tstopReason: \"error\",\n\t\terrorMessage: error instanceof Error ? error.message : String(error),\n\t\ttimestamp: Date.now(),\n\t};\n}\n\nfunction createAbortedMessage(partial: AssistantMessage): AssistantMessage {\n\treturn {\n\t\t...partial,\n\t\tstopReason: \"aborted\",\n\t\terrorMessage: \"Request was aborted\",\n\t\ttimestamp: Date.now(),\n\t};\n}\n\nfunction scheduleChunk(chunk: string, tokensPerSecond: number | undefined): Promise<void> {\n\tif (!tokensPerSecond || tokensPerSecond <= 0) {\n\t\treturn new Promise((resolve) => queueMicrotask(resolve));\n\t}\n\tconst delayMs = (estimateTokens(chunk) / tokensPerSecond) * 1000;\n\treturn new Promise((resolve) => setTimeout(resolve, delayMs));\n}\n\nasync function streamWithDeltas(\n\tstream: AssistantMessageEventStream,\n\tmessage: AssistantMessage,\n\tminTokenSize: number,\n\tmaxTokenSize: number,\n\ttokensPerSecond: number | undefined,\n\tsignal: AbortSignal | undefined,\n): Promise<void> {\n\tconst partial: AssistantMessage = { ...message, content: [], stopReason: \"pending\" };\n\tif (signal?.aborted) {\n\t\tconst aborted = createAbortedMessage(partial);\n\t\tstream.push({ type: \"error\", reason: \"aborted\", error: aborted });\n\t\tstream.end(aborted);\n\t\treturn;\n\t}\n\n\tstream.push({ type: \"start\", partial: { ...partial } });\n\n\tfor (let index = 0; index < message.content.length; index++) {\n\t\tif (signal?.aborted) {\n\t\t\tconst aborted = createAbortedMessage(partial);\n\t\t\tstream.push({ type: \"error\", reason: \"aborted\", error: aborted });\n\t\t\tstream.end(aborted);\n\t\t\treturn;\n\t\t}\n\n\t\tconst block = message.content[index];\n\n\t\tif (block.type === \"thinking\") {\n\t\t\tpartial.content = [...partial.content, { type: \"thinking\", thinking: \"\" }];\n\t\t\tstream.push({ type: \"thinking_start\", contentIndex: index, partial: { ...partial } });\n\t\t\tfor (const chunk of splitStringByTokenSize(block.thinking, minTokenSize, maxTokenSize)) {\n\t\t\t\tawait scheduleChunk(chunk, tokensPerSecond);\n\t\t\t\tif (signal?.aborted) {\n\t\t\t\t\tconst aborted = createAbortedMessage(partial);\n\t\t\t\t\tstream.push({ type: \"error\", reason: \"aborted\", error: aborted });\n\t\t\t\t\tstream.end(aborted);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t(partial.content[index] as ThinkingContent).thinking += chunk;\n\t\t\t\tstream.push({ type: \"thinking_delta\", contentIndex: index, delta: chunk, partial: { ...partial } });\n\t\t\t}\n\t\t\tstream.push({\n\t\t\t\ttype: \"thinking_end\",\n\t\t\t\tcontentIndex: index,\n\t\t\t\tcontent: block.thinking,\n\t\t\t\tpartial: { ...partial },\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (block.type === \"text\") {\n\t\t\tpartial.content = [...partial.content, { type: \"text\", text: \"\" }];\n\t\t\tstream.push({ type: \"text_start\", contentIndex: index, partial: { ...partial } });\n\t\t\tfor (const chunk of splitStringByTokenSize(block.text, minTokenSize, maxTokenSize)) {\n\t\t\t\tawait scheduleChunk(chunk, tokensPerSecond);\n\t\t\t\tif (signal?.aborted) {\n\t\t\t\t\tconst aborted = createAbortedMessage(partial);\n\t\t\t\t\tstream.push({ type: \"error\", reason: \"aborted\", error: aborted });\n\t\t\t\t\tstream.end(aborted);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t(partial.content[index] as TextContent).text += chunk;\n\t\t\t\tstream.push({ type: \"text_delta\", contentIndex: index, delta: chunk, partial: { ...partial } });\n\t\t\t}\n\t\t\tstream.push({ type: \"text_end\", contentIndex: index, content: block.text, partial: { ...partial } });\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Fallback boundary markers are replay metadata with nothing to stream, but they still\n\t\t// occupy a slot in `partial.content` so later blocks keep their source `contentIndex`.\n\t\t// This matches the real Anthropic provider, which pushes the wire `fallback` block into\n\t\t// `output.content` and emits no event for it; every `contentIndex` consumer indexes\n\t\t// `partial.content` directly, so skipping the slot would shift every later block by one.\n\t\tif (block.type !== \"toolCall\") {\n\t\t\tpartial.content = [...partial.content, block];\n\t\t\tcontinue;\n\t\t}\n\n\t\tpartial.content = [...partial.content, { type: \"toolCall\", id: block.id, name: block.name, arguments: {} }];\n\t\tstream.push({ type: \"toolcall_start\", contentIndex: index, partial: { ...partial } });\n\t\tfor (const chunk of splitStringByTokenSize(JSON.stringify(block.arguments), minTokenSize, maxTokenSize)) {\n\t\t\tawait scheduleChunk(chunk, tokensPerSecond);\n\t\t\tif (signal?.aborted) {\n\t\t\t\tconst aborted = createAbortedMessage(partial);\n\t\t\t\tstream.push({ type: \"error\", reason: \"aborted\", error: aborted });\n\t\t\t\tstream.end(aborted);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tstream.push({ type: \"toolcall_delta\", contentIndex: index, delta: chunk, partial: { ...partial } });\n\t\t}\n\t\t(partial.content[index] as ToolCall).arguments = block.arguments;\n\t\tstream.push({ type: \"toolcall_end\", contentIndex: index, toolCall: block, partial: { ...partial } });\n\t}\n\n\tif (message.stopReason === \"pending\") {\n\t\tthrow new Error(\"Faux response ended without a stop reason\");\n\t}\n\tif (message.stopReason === \"error\" || message.stopReason === \"aborted\") {\n\t\tstream.push({ type: \"error\", reason: message.stopReason, error: message });\n\t\tstream.end(message);\n\t\treturn;\n\t}\n\n\tstream.push({ type: \"done\", reason: message.stopReason, message });\n\tstream.end(message);\n}\n\nexport function createFauxCore(options: RegisterFauxProviderOptions) {\n\tconst api = options.api ?? randomId(DEFAULT_API);\n\tconst provider = options.provider ?? DEFAULT_PROVIDER;\n\tconst minTokenSize = Math.max(\n\t\t1,\n\t\tMath.min(options.tokenSize?.min ?? DEFAULT_MIN_TOKEN_SIZE, options.tokenSize?.max ?? DEFAULT_MAX_TOKEN_SIZE),\n\t);\n\tconst maxTokenSize = Math.max(minTokenSize, options.tokenSize?.max ?? DEFAULT_MAX_TOKEN_SIZE);\n\tlet pendingResponses: FauxResponseStep[] = [];\n\tconst tokensPerSecond = options.tokensPerSecond;\n\tconst state: FauxProviderState = { callCount: 0, deferredFetchCount: 0, cancelledDeferred: [] };\n\tconst promptCache = new Map<string, string>();\n\tconst deferredResponses = new Map<\n\t\tstring,\n\t\t{\n\t\t\thandle: DeferredHandle;\n\t\t\tstep: FauxResponseStep;\n\t\t\tcontext: TranscriptContext;\n\t\t\toptions: SimpleStreamOptions | undefined;\n\t\t\tmodel: Model<string>;\n\t\t\tpendingFetches: number;\n\t\t\tcancelled: boolean;\n\t\t\tfinal?: AssistantMessage;\n\t\t}\n\t>();\n\n\tconst modelDefinitions = options.models?.length\n\t\t? options.models\n\t\t: [\n\t\t\t\t{\n\t\t\t\t\tid: DEFAULT_MODEL_ID,\n\t\t\t\t\tname: DEFAULT_MODEL_NAME,\n\t\t\t\t\treasoning: false,\n\t\t\t\t\tinput: [\"text\", \"image\"] as (\"text\" | \"image\")[],\n\t\t\t\t\tcost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },\n\t\t\t\t\tcontextWindow: 128000,\n\t\t\t\t\tmaxTokens: 16384,\n\t\t\t\t},\n\t\t\t];\n\tconst models = modelDefinitions.map((definition) => ({\n\t\tid: definition.id,\n\t\tname: definition.name ?? definition.id,\n\t\tapi,\n\t\tprovider,\n\t\tbaseUrl: DEFAULT_BASE_URL,\n\t\treasoning: definition.reasoning ?? false,\n\t\tinput: definition.input ?? [\"text\", \"image\"],\n\t\tinputLimits: definition.inputLimits,\n\t\tcost: definition.cost ?? { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },\n\t\tcontextWindow: definition.contextWindow ?? 128000,\n\t\tmaxTokens: definition.maxTokens ?? 16384,\n\t})) as [Model<string>, ...Model<string>[]];\n\n\tconst resolveResponse = async (\n\t\tstep: FauxResponseStep,\n\t\tcontext: TranscriptContext,\n\t\tstreamOptions: SimpleStreamOptions | undefined,\n\t\trequestModel: Model<string>,\n\t): Promise<AssistantMessage> => {\n\t\tconst resolved = typeof step === \"function\" ? await step(context, streamOptions, state, requestModel) : step;\n\t\treturn withUsageEstimate(\n\t\t\tcloneMessage(resolved, api, provider, requestModel.id),\n\t\t\tcontext,\n\t\t\tstreamOptions,\n\t\t\tpromptCache,\n\t\t);\n\t};\n\n\tconst stream: StreamFunction<string, SimpleStreamOptions> = (requestModel, context, streamOptions) => {\n\t\tconst outer = createAssistantMessageEventStream();\n\t\tconst step = pendingResponses.shift();\n\t\tstate.callCount++;\n\n\t\tqueueMicrotask(async () => {\n\t\t\ttry {\n\t\t\t\tawait streamOptions?.onResponse?.({ status: 200, headers: {} }, requestModel);\n\t\t\t\tif (!step) {\n\t\t\t\t\tlet message = createErrorMessage(\n\t\t\t\t\t\tnew Error(\"No more faux responses queued\"),\n\t\t\t\t\t\tapi,\n\t\t\t\t\t\tprovider,\n\t\t\t\t\t\trequestModel.id,\n\t\t\t\t\t);\n\t\t\t\t\tmessage = withUsageEstimate(message, context, streamOptions, promptCache);\n\t\t\t\t\touter.push({ type: \"error\", reason: \"error\", error: message });\n\t\t\t\t\touter.end(message);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (streamOptions?.deferred) {\n\t\t\t\t\tconst handle: DeferredHandle = {\n\t\t\t\t\t\tprovider: requestModel.provider,\n\t\t\t\t\t\tmodelId: requestModel.id,\n\t\t\t\t\t\tapi: requestModel.api,\n\t\t\t\t\t\tid: randomId(\"deferred\"),\n\t\t\t\t\t\t...(options.deferred?.pollAfterMs !== undefined ? { pollAfterMs: options.deferred.pollAfterMs } : {}),\n\t\t\t\t\t};\n\t\t\t\t\tdeferredResponses.set(handle.id, {\n\t\t\t\t\t\thandle,\n\t\t\t\t\t\tstep,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\toptions: streamOptions,\n\t\t\t\t\t\tmodel: requestModel,\n\t\t\t\t\t\tpendingFetches: Math.max(0, Math.floor(options.deferred?.pendingFetches ?? 0)),\n\t\t\t\t\t\tcancelled: false,\n\t\t\t\t\t});\n\t\t\t\t\tawait streamWithDeltas(\n\t\t\t\t\t\touter,\n\t\t\t\t\t\tcreateDeferredMessage(requestModel, handle),\n\t\t\t\t\t\tminTokenSize,\n\t\t\t\t\t\tmaxTokenSize,\n\t\t\t\t\t\ttokensPerSecond,\n\t\t\t\t\t\tstreamOptions.signal,\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst message = await resolveResponse(step, context, streamOptions, requestModel);\n\t\t\t\tawait streamWithDeltas(outer, message, minTokenSize, maxTokenSize, tokensPerSecond, streamOptions?.signal);\n\t\t\t} catch (error) {\n\t\t\t\tconst message = createErrorMessage(error, api, provider, requestModel.id);\n\t\t\t\touter.push({ type: \"error\", reason: \"error\", error: message });\n\t\t\t\touter.end(message);\n\t\t\t}\n\t\t});\n\n\t\treturn outer;\n\t};\n\n\tconst streamSimple: StreamFunction<string, SimpleStreamOptions> = (streamModel, context, streamOptions) =>\n\t\tstream(streamModel, context, streamOptions);\n\n\tconst fetchDeferred = (\n\t\trequestModel: Model<string>,\n\t\thandle: DeferredHandle,\n\t\tfetchOptions?: DeferredFetchOptions,\n\t): AssistantMessageEventStream => {\n\t\tconst outer = createAssistantMessageEventStream();\n\t\tstate.deferredFetchCount++;\n\n\t\tqueueMicrotask(async () => {\n\t\t\ttry {\n\t\t\t\tawait fetchOptions?.onResponse?.({ status: 200, headers: {} }, requestModel);\n\t\t\t\tconst entry = deferredResponses.get(handle.id);\n\t\t\t\tif (\n\t\t\t\t\t!entry ||\n\t\t\t\t\tentry.handle.provider !== handle.provider ||\n\t\t\t\t\tentry.handle.modelId !== handle.modelId ||\n\t\t\t\t\tentry.handle.api !== handle.api\n\t\t\t\t) {\n\t\t\t\t\tthrow new Error(`Unknown faux deferred response: ${handle.id}`);\n\t\t\t\t}\n\t\t\t\tif (entry.cancelled) throw new Error(`Faux deferred response was cancelled: ${handle.id}`);\n\n\t\t\t\tif (entry.pendingFetches > 0) {\n\t\t\t\t\tentry.pendingFetches--;\n\t\t\t\t\tawait streamWithDeltas(\n\t\t\t\t\t\touter,\n\t\t\t\t\t\tcreateDeferredMessage(requestModel, entry.handle),\n\t\t\t\t\t\tminTokenSize,\n\t\t\t\t\t\tmaxTokenSize,\n\t\t\t\t\t\ttokensPerSecond,\n\t\t\t\t\t\tfetchOptions?.signal,\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (!entry.final) {\n\t\t\t\t\tconst {\n\t\t\t\t\t\tdeferred: _deferred,\n\t\t\t\t\t\tsignal: _submissionSignal,\n\t\t\t\t\t\tonResponse: _submissionOnResponse,\n\t\t\t\t\t\t...submissionOptions\n\t\t\t\t\t} = entry.options ?? {};\n\t\t\t\t\ttry {\n\t\t\t\t\t\tentry.final = await resolveResponse(entry.step, entry.context, submissionOptions, entry.model);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tentry.final = createErrorMessage(error, api, provider, entry.model.id);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tawait streamWithDeltas(\n\t\t\t\t\touter,\n\t\t\t\t\tentry.final,\n\t\t\t\t\tminTokenSize,\n\t\t\t\t\tmaxTokenSize,\n\t\t\t\t\ttokensPerSecond,\n\t\t\t\t\tfetchOptions?.signal,\n\t\t\t\t);\n\t\t\t} catch (error) {\n\t\t\t\tconst message = createErrorMessage(error, api, provider, requestModel.id);\n\t\t\t\touter.push({ type: \"error\", reason: \"error\", error: message });\n\t\t\t\touter.end(message);\n\t\t\t}\n\t\t});\n\n\t\treturn outer;\n\t};\n\n\tconst cancelDeferred = async (\n\t\trequestModel: Model<string>,\n\t\thandle: DeferredHandle,\n\t\tcancelOptions?: DeferredCancelOptions,\n\t): Promise<void> => {\n\t\tstate.cancelledDeferred.push(structuredClone(handle));\n\t\tconst entry = deferredResponses.get(handle.id);\n\t\tif (entry) entry.cancelled = true;\n\t\tawait cancelOptions?.onResponse?.({ status: 200, headers: {} }, requestModel);\n\t};\n\n\tfunction getModel(): Model<string>;\n\tfunction getModel(requestedModelId: string): Model<string> | undefined;\n\tfunction getModel(requestedModelId?: string): Model<string> | undefined {\n\t\tif (!requestedModelId) {\n\t\t\treturn models[0];\n\t\t}\n\t\treturn models.find((candidate) => candidate.id === requestedModelId);\n\t}\n\n\treturn {\n\t\tapi,\n\t\tprovider,\n\t\tmodels,\n\t\tstream,\n\t\tstreamSimple,\n\t\tfetchDeferred,\n\t\tcancelDeferred,\n\t\tgetModel,\n\t\tstate,\n\t\tsetResponses(responses: FauxResponseStep[]) {\n\t\t\tpendingResponses = [...responses];\n\t\t},\n\t\tappendResponses(responses: FauxResponseStep[]) {\n\t\t\tpendingResponses.push(...responses);\n\t\t},\n\t\tgetPendingResponseCount() {\n\t\t\treturn pendingResponses.length;\n\t\t},\n\t};\n}\n\n/**\n * Faux provider for tests built on explicit `Models` collections:\n *\n * ```ts\n * const faux = fauxProvider();\n * const models = createModels();\n * models.setProvider(faux.provider);\n * faux.setResponses([fauxAssistantMessage(\"hi\")]);\n * ```\n */\nexport function fauxProvider(options: RegisterFauxProviderOptions = {}): FauxProviderHandle {\n\tconst core = createFauxCore(options);\n\tconst provider = createProvider({\n\t\tid: core.provider,\n\t\tauth: { apiKey: { name: \"Faux\", resolve: async () => ({ auth: {} }) } },\n\t\tmodels: core.models,\n\t\tapi: {\n\t\t\tstream: core.stream,\n\t\t\tstreamSimple: core.streamSimple,\n\t\t\tfetchDeferred: core.fetchDeferred,\n\t\t\tcancelDeferred: core.cancelDeferred,\n\t\t},\n\t});\n\treturn {\n\t\tprovider,\n\t\tapi: core.api,\n\t\tmodels: core.models,\n\t\tgetModel: core.getModel,\n\t\tstate: core.state,\n\t\tsetResponses: core.setResponses,\n\t\tappendResponses: core.appendResponses,\n\t\tgetPendingResponseCount: core.getPendingResponseCount,\n\t};\n}\n"]}
1
+ {"version":3,"file":"faux.d.ts","sourceRoot":"","sources":["../../src/providers/faux.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAAK,EACX,gBAAgB,EAChB,2BAA2B,EAC3B,qBAAqB,EACrB,oBAAoB,EACpB,cAAc,EAId,KAAK,EACL,mBAAmB,EACnB,cAAc,EAEd,WAAW,EACX,eAAe,EACf,QAAQ,EAER,iBAAiB,EAEjB,MAAM,aAAa,CAAC;AAqBrB,MAAM,WAAW,mBAAmB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,CAAC,MAAM,GAAG,OAAO,CAAC,EAAE,CAAC;IAC7B,WAAW,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC;IAC3C,IAAI,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IAChF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,gBAAgB,GA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,uBAAuB,GAAG;YACzB,OAAO,gBAAgB,CAAC,MAAM,CAAC;QAAA,CAC/B;KACD,CAAC;AAAA,CACF;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,YAAY,CAAC,OAAO,GAAgC,EAAE,EAAsB;IAC3F,MAAM,IAAI,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IACrC,MAAM,QAAQ,GAAG,cAAc,CAAC;QAC/B,EAAE,EAAE,IAAI,CAAC,QAAQ;QACjB,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE;QACvE,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,GAAG,EAAE;YACJ,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,cAAc,EAAE,IAAI,CAAC,cAAc;SACnC;KACD,CAAC,CAAC;IACH,OAAO;QACN,QAAQ;QACR,GAAG,EAAE,IAAI,CAAC,GAAG;QACb,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,uBAAuB,EAAE,IAAI,CAAC,uBAAuB;KACrD,CAAC;AAAA,CACF","sourcesContent":["import { createProvider, type Provider } from \"../models.ts\";\nimport type {\n\tAssistantMessage,\n\tAssistantMessageEventStream,\n\tDeferredCancelOptions,\n\tDeferredFetchOptions,\n\tDeferredHandle,\n\tDocumentContent,\n\tImageContent,\n\tMessage,\n\tModel,\n\tSimpleStreamOptions,\n\tStreamFunction,\n\tStreamOptions,\n\tTextContent,\n\tThinkingContent,\n\tToolCall,\n\tToolResultMessage,\n\tTranscriptContext,\n\tUsage,\n} from \"../types.ts\";\nimport { createAssistantMessageEventStream } from \"../utils/event-stream.ts\";\nimport { getSystemMessageText } from \"../utils/text.ts\";\n\nconst DEFAULT_API = \"faux\";\nconst DEFAULT_PROVIDER = \"faux\";\nconst DEFAULT_MODEL_ID = \"faux-1\";\nconst DEFAULT_MODEL_NAME = \"Faux Model\";\nconst DEFAULT_BASE_URL = \"http://localhost:0\";\nconst DEFAULT_MIN_TOKEN_SIZE = 3;\nconst DEFAULT_MAX_TOKEN_SIZE = 5;\n\nconst DEFAULT_USAGE: Usage = {\n\tinput: 0,\n\toutput: 0,\n\tcacheRead: 0,\n\tcacheWrite: 0,\n\ttotalTokens: 0,\n\tcost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },\n};\n\nexport interface FauxModelDefinition {\n\tid: string;\n\tname?: string;\n\treasoning?: boolean;\n\tinput?: (\"text\" | \"image\")[];\n\tinputLimits?: Model<string>[\"inputLimits\"];\n\tcost?: { input: number; output: number; cacheRead: number; cacheWrite: number };\n\tcontextWindow?: number;\n\tmaxTokens?: number;\n}\n\nexport type FauxContentBlock = TextContent | ThinkingContent | ToolCall;\n\nexport function fauxText(text: string): TextContent {\n\treturn { type: \"text\", text };\n}\n\nexport function fauxThinking(thinking: string): ThinkingContent {\n\treturn { type: \"thinking\", thinking };\n}\n\nexport function fauxToolCall(name: string, arguments_: ToolCall[\"arguments\"], options: { id?: string } = {}): ToolCall {\n\treturn {\n\t\ttype: \"toolCall\",\n\t\tid: options.id ?? randomId(\"tool\"),\n\t\tname,\n\t\targuments: arguments_,\n\t};\n}\n\nfunction normalizeFauxAssistantContent(content: string | FauxContentBlock | FauxContentBlock[]): FauxContentBlock[] {\n\tif (typeof content === \"string\") {\n\t\treturn [fauxText(content)];\n\t}\n\treturn Array.isArray(content) ? content : [content];\n}\n\nexport function fauxAssistantMessage(\n\tcontent: string | FauxContentBlock | FauxContentBlock[],\n\toptions: {\n\t\tstopReason?: AssistantMessage[\"stopReason\"];\n\t\tdeferred?: DeferredHandle;\n\t\terrorMessage?: string;\n\t\tresponseId?: string;\n\t\ttimestamp?: number;\n\t} = {},\n): AssistantMessage {\n\treturn {\n\t\trole: \"assistant\",\n\t\tcontent: normalizeFauxAssistantContent(content),\n\t\tapi: DEFAULT_API,\n\t\tprovider: DEFAULT_PROVIDER,\n\t\tmodel: DEFAULT_MODEL_ID,\n\t\tusage: DEFAULT_USAGE,\n\t\tstopReason: options.stopReason ?? \"stop\",\n\t\tdeferred: options.deferred,\n\t\terrorMessage: options.errorMessage,\n\t\tresponseId: options.responseId,\n\t\ttimestamp: options.timestamp ?? Date.now(),\n\t};\n}\n\nexport interface FauxProviderState {\n\tcallCount: number;\n\tdeferredFetchCount: number;\n\tcancelledDeferred: DeferredHandle[];\n}\n\nexport type FauxResponseFactory = (\n\tcontext: TranscriptContext,\n\toptions: SimpleStreamOptions | undefined,\n\tstate: FauxProviderState,\n\tmodel: Model<string>,\n) => AssistantMessage | Promise<AssistantMessage>;\n\nexport type FauxResponseStep = AssistantMessage | FauxResponseFactory;\n\nexport interface RegisterFauxProviderOptions {\n\tapi?: string;\n\tprovider?: string;\n\tmodels?: FauxModelDefinition[];\n\tdeferred?: {\n\t\t/** Number of fetches that return the original handle before the scripted response becomes ready. */\n\t\tpendingFetches?: number;\n\t\tpollAfterMs?: number;\n\t};\n\ttokensPerSecond?: number;\n\ttokenSize?: {\n\t\tmin?: number;\n\t\tmax?: number;\n\t};\n}\n\nexport interface FauxProviderRegistration {\n\tapi: string;\n\tmodels: [Model<string>, ...Model<string>[]];\n\tgetModel(): Model<string>;\n\tgetModel(modelId: string): Model<string> | undefined;\n\tstate: FauxProviderState;\n\tsetResponses: (responses: FauxResponseStep[]) => void;\n\tappendResponses: (responses: FauxResponseStep[]) => void;\n\tgetPendingResponseCount: () => number;\n\tunregister: () => void;\n}\n\nexport interface FauxProviderHandle {\n\tprovider: Provider;\n\tapi: string;\n\tmodels: [Model<string>, ...Model<string>[]];\n\tgetModel(): Model<string>;\n\tgetModel(modelId: string): Model<string> | undefined;\n\tstate: FauxProviderState;\n\tsetResponses: (responses: FauxResponseStep[]) => void;\n\tappendResponses: (responses: FauxResponseStep[]) => void;\n\tgetPendingResponseCount: () => number;\n}\n\nfunction estimateTokens(text: string): number {\n\treturn Math.ceil(text.length / 4);\n}\n\nfunction randomId(prefix: string): string {\n\treturn `${prefix}:${Date.now()}:${Math.random().toString(36).slice(2)}`;\n}\n\nfunction contentToText(content: string | Array<TextContent | ImageContent | DocumentContent>): string {\n\tif (typeof content === \"string\") {\n\t\treturn content;\n\t}\n\treturn content\n\t\t.map((block) => {\n\t\t\tif (block.type === \"text\") {\n\t\t\t\treturn block.text;\n\t\t\t}\n\t\t\tif (block.type === \"document\") {\n\t\t\t\treturn `[document:${block.mimeType}:${block.data.length}]`;\n\t\t\t}\n\t\t\treturn `[image:${block.mimeType}:${block.data.length}]`;\n\t\t})\n\t\t.join(\"\\n\");\n}\n\nfunction assistantContentToText(content: AssistantMessage[\"content\"]): string {\n\treturn content\n\t\t.map((block) => {\n\t\t\tif (block.type === \"text\") {\n\t\t\t\treturn block.text;\n\t\t\t}\n\t\t\tif (block.type === \"thinking\") {\n\t\t\t\treturn block.thinking;\n\t\t\t}\n\t\t\t// Fallback boundary markers carry no text.\n\t\t\tif (block.type !== \"toolCall\") {\n\t\t\t\treturn \"\";\n\t\t\t}\n\t\t\treturn `${block.name}:${JSON.stringify(block.arguments)}`;\n\t\t})\n\t\t.join(\"\\n\");\n}\n\nfunction toolResultToText(message: ToolResultMessage): string {\n\treturn [message.toolName, ...message.content.map((block) => contentToText([block]))].join(\"\\n\");\n}\n\nfunction messageToText(message: Message): string {\n\tif (message.role === \"system\") {\n\t\treturn [\n\t\t\tgetSystemMessageText(message),\n\t\t\t...(message.toolsRemoved?.map((tool) => `tool-:${JSON.stringify(tool)}`) ?? []),\n\t\t\t...(message.toolsAdded?.map((tool) => `tool+:${JSON.stringify(tool)}`) ?? []),\n\t\t]\n\t\t\t.filter((part) => part.length > 0)\n\t\t\t.join(\"\\n\");\n\t}\n\tif (message.role === \"user\") {\n\t\treturn contentToText(message.content);\n\t}\n\tif (message.role === \"assistant\") {\n\t\treturn assistantContentToText(message.content);\n\t}\n\treturn toolResultToText(message);\n}\n\nfunction serializeContext(context: TranscriptContext): string {\n\treturn context.messages.map((message) => `${message.role}:${messageToText(message)}`).join(\"\\n\\n\");\n}\n\nfunction commonPrefixLength(a: string, b: string): number {\n\tconst length = Math.min(a.length, b.length);\n\tlet index = 0;\n\twhile (index < length && a[index] === b[index]) {\n\t\tindex++;\n\t}\n\treturn index;\n}\n\nfunction withUsageEstimate(\n\tmessage: AssistantMessage,\n\tcontext: TranscriptContext,\n\toptions: StreamOptions | undefined,\n\tpromptCache: Map<string, string>,\n): AssistantMessage {\n\tconst promptText = serializeContext(context);\n\tconst promptTokens = estimateTokens(promptText);\n\tconst outputTokens = estimateTokens(assistantContentToText(message.content));\n\tlet input = promptTokens;\n\tlet cacheRead = 0;\n\tlet cacheWrite = 0;\n\tconst sessionId = options?.sessionId;\n\n\tif (sessionId && options?.cacheRetention !== \"none\") {\n\t\tconst previousPrompt = promptCache.get(sessionId);\n\t\tif (previousPrompt) {\n\t\t\tconst cachedChars = commonPrefixLength(previousPrompt, promptText);\n\t\t\tcacheRead = estimateTokens(previousPrompt.slice(0, cachedChars));\n\t\t\tcacheWrite = estimateTokens(promptText.slice(cachedChars));\n\t\t\tinput = Math.max(0, promptTokens - cacheRead);\n\t\t} else {\n\t\t\tcacheWrite = promptTokens;\n\t\t}\n\t\tpromptCache.set(sessionId, promptText);\n\t}\n\n\treturn {\n\t\t...message,\n\t\tusage: {\n\t\t\tinput,\n\t\t\toutput: outputTokens,\n\t\t\tcacheRead,\n\t\t\tcacheWrite,\n\t\t\ttotalTokens: input + outputTokens + cacheRead + cacheWrite,\n\t\t\tcost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },\n\t\t},\n\t};\n}\n\nfunction splitStringByTokenSize(text: string, minTokenSize: number, maxTokenSize: number): string[] {\n\tconst chunks: string[] = [];\n\tlet index = 0;\n\twhile (index < text.length) {\n\t\tconst tokenSize = minTokenSize + Math.floor(Math.random() * (maxTokenSize - minTokenSize + 1));\n\t\tconst charSize = Math.max(1, tokenSize * 4);\n\t\tchunks.push(text.slice(index, index + charSize));\n\t\tindex += charSize;\n\t}\n\treturn chunks.length > 0 ? chunks : [\"\"];\n}\n\nfunction cloneMessage(message: AssistantMessage, api: string, provider: string, modelId: string): AssistantMessage {\n\tconst cloned = structuredClone(message);\n\treturn {\n\t\t...cloned,\n\t\tapi,\n\t\tprovider,\n\t\tmodel: modelId,\n\t\ttimestamp: cloned.timestamp ?? Date.now(),\n\t\tusage: cloned.usage ?? DEFAULT_USAGE,\n\t};\n}\n\nfunction createDeferredMessage(model: Model<string>, handle: DeferredHandle): AssistantMessage {\n\treturn {\n\t\trole: \"assistant\",\n\t\tcontent: [],\n\t\tapi: model.api,\n\t\tprovider: model.provider,\n\t\tmodel: model.id,\n\t\tusage: DEFAULT_USAGE,\n\t\tstopReason: \"deferred\",\n\t\tdeferred: handle,\n\t\ttimestamp: Date.now(),\n\t};\n}\n\nfunction createErrorMessage(error: unknown, api: string, provider: string, modelId: string): AssistantMessage {\n\treturn {\n\t\trole: \"assistant\",\n\t\tcontent: [],\n\t\tapi,\n\t\tprovider,\n\t\tmodel: modelId,\n\t\tusage: DEFAULT_USAGE,\n\t\tstopReason: \"error\",\n\t\terrorMessage: error instanceof Error ? error.message : String(error),\n\t\ttimestamp: Date.now(),\n\t};\n}\n\nfunction createAbortedMessage(partial: AssistantMessage): AssistantMessage {\n\treturn {\n\t\t...partial,\n\t\tstopReason: \"aborted\",\n\t\terrorMessage: \"Request was aborted\",\n\t\ttimestamp: Date.now(),\n\t};\n}\n\nfunction scheduleChunk(chunk: string, tokensPerSecond: number | undefined): Promise<void> {\n\tif (!tokensPerSecond || tokensPerSecond <= 0) {\n\t\treturn new Promise((resolve) => queueMicrotask(resolve));\n\t}\n\tconst delayMs = (estimateTokens(chunk) / tokensPerSecond) * 1000;\n\treturn new Promise((resolve) => setTimeout(resolve, delayMs));\n}\n\nasync function streamWithDeltas(\n\tstream: AssistantMessageEventStream,\n\tmessage: AssistantMessage,\n\tminTokenSize: number,\n\tmaxTokenSize: number,\n\ttokensPerSecond: number | undefined,\n\tsignal: AbortSignal | undefined,\n): Promise<void> {\n\tconst partial: AssistantMessage = { ...message, content: [], stopReason: \"pending\" };\n\tif (signal?.aborted) {\n\t\tconst aborted = createAbortedMessage(partial);\n\t\tstream.push({ type: \"error\", reason: \"aborted\", error: aborted });\n\t\tstream.end(aborted);\n\t\treturn;\n\t}\n\n\tstream.push({ type: \"start\", partial: { ...partial } });\n\n\tfor (let index = 0; index < message.content.length; index++) {\n\t\tif (signal?.aborted) {\n\t\t\tconst aborted = createAbortedMessage(partial);\n\t\t\tstream.push({ type: \"error\", reason: \"aborted\", error: aborted });\n\t\t\tstream.end(aborted);\n\t\t\treturn;\n\t\t}\n\n\t\tconst block = message.content[index];\n\n\t\tif (block.type === \"thinking\") {\n\t\t\tpartial.content = [...partial.content, { type: \"thinking\", thinking: \"\" }];\n\t\t\tstream.push({ type: \"thinking_start\", contentIndex: index, partial: { ...partial } });\n\t\t\tfor (const chunk of splitStringByTokenSize(block.thinking, minTokenSize, maxTokenSize)) {\n\t\t\t\tawait scheduleChunk(chunk, tokensPerSecond);\n\t\t\t\tif (signal?.aborted) {\n\t\t\t\t\tconst aborted = createAbortedMessage(partial);\n\t\t\t\t\tstream.push({ type: \"error\", reason: \"aborted\", error: aborted });\n\t\t\t\t\tstream.end(aborted);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t(partial.content[index] as ThinkingContent).thinking += chunk;\n\t\t\t\tstream.push({ type: \"thinking_delta\", contentIndex: index, delta: chunk, partial: { ...partial } });\n\t\t\t}\n\t\t\tstream.push({\n\t\t\t\ttype: \"thinking_end\",\n\t\t\t\tcontentIndex: index,\n\t\t\t\tcontent: block.thinking,\n\t\t\t\tpartial: { ...partial },\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (block.type === \"text\") {\n\t\t\tpartial.content = [...partial.content, { type: \"text\", text: \"\" }];\n\t\t\tstream.push({ type: \"text_start\", contentIndex: index, partial: { ...partial } });\n\t\t\tfor (const chunk of splitStringByTokenSize(block.text, minTokenSize, maxTokenSize)) {\n\t\t\t\tawait scheduleChunk(chunk, tokensPerSecond);\n\t\t\t\tif (signal?.aborted) {\n\t\t\t\t\tconst aborted = createAbortedMessage(partial);\n\t\t\t\t\tstream.push({ type: \"error\", reason: \"aborted\", error: aborted });\n\t\t\t\t\tstream.end(aborted);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t(partial.content[index] as TextContent).text += chunk;\n\t\t\t\tstream.push({ type: \"text_delta\", contentIndex: index, delta: chunk, partial: { ...partial } });\n\t\t\t}\n\t\t\tstream.push({ type: \"text_end\", contentIndex: index, content: block.text, partial: { ...partial } });\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Fallback boundary markers are replay metadata with nothing to stream, but they still\n\t\t// occupy a slot in `partial.content` so later blocks keep their source `contentIndex`.\n\t\t// This matches the real Anthropic provider, which pushes the wire `fallback` block into\n\t\t// `output.content` and emits no event for it; every `contentIndex` consumer indexes\n\t\t// `partial.content` directly, so skipping the slot would shift every later block by one.\n\t\tif (block.type !== \"toolCall\") {\n\t\t\tpartial.content = [...partial.content, block];\n\t\t\tcontinue;\n\t\t}\n\n\t\tpartial.content = [...partial.content, { type: \"toolCall\", id: block.id, name: block.name, arguments: {} }];\n\t\tstream.push({ type: \"toolcall_start\", contentIndex: index, partial: { ...partial } });\n\t\tfor (const chunk of splitStringByTokenSize(JSON.stringify(block.arguments), minTokenSize, maxTokenSize)) {\n\t\t\tawait scheduleChunk(chunk, tokensPerSecond);\n\t\t\tif (signal?.aborted) {\n\t\t\t\tconst aborted = createAbortedMessage(partial);\n\t\t\t\tstream.push({ type: \"error\", reason: \"aborted\", error: aborted });\n\t\t\t\tstream.end(aborted);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tstream.push({ type: \"toolcall_delta\", contentIndex: index, delta: chunk, partial: { ...partial } });\n\t\t}\n\t\t(partial.content[index] as ToolCall).arguments = block.arguments;\n\t\tstream.push({ type: \"toolcall_end\", contentIndex: index, toolCall: block, partial: { ...partial } });\n\t}\n\n\tif (message.stopReason === \"pending\") {\n\t\tthrow new Error(\"Faux response ended without a stop reason\");\n\t}\n\tif (message.stopReason === \"error\" || message.stopReason === \"aborted\") {\n\t\tstream.push({ type: \"error\", reason: message.stopReason, error: message });\n\t\tstream.end(message);\n\t\treturn;\n\t}\n\n\tstream.push({ type: \"done\", reason: message.stopReason, message });\n\tstream.end(message);\n}\n\nexport function createFauxCore(options: RegisterFauxProviderOptions) {\n\tconst api = options.api ?? randomId(DEFAULT_API);\n\tconst provider = options.provider ?? DEFAULT_PROVIDER;\n\tconst minTokenSize = Math.max(\n\t\t1,\n\t\tMath.min(options.tokenSize?.min ?? DEFAULT_MIN_TOKEN_SIZE, options.tokenSize?.max ?? DEFAULT_MAX_TOKEN_SIZE),\n\t);\n\tconst maxTokenSize = Math.max(minTokenSize, options.tokenSize?.max ?? DEFAULT_MAX_TOKEN_SIZE);\n\tlet pendingResponses: FauxResponseStep[] = [];\n\tconst tokensPerSecond = options.tokensPerSecond;\n\tconst state: FauxProviderState = { callCount: 0, deferredFetchCount: 0, cancelledDeferred: [] };\n\tconst promptCache = new Map<string, string>();\n\tconst deferredResponses = new Map<\n\t\tstring,\n\t\t{\n\t\t\thandle: DeferredHandle;\n\t\t\tstep: FauxResponseStep;\n\t\t\tcontext: TranscriptContext;\n\t\t\toptions: SimpleStreamOptions | undefined;\n\t\t\tmodel: Model<string>;\n\t\t\tpendingFetches: number;\n\t\t\tcancelled: boolean;\n\t\t\tfinal?: AssistantMessage;\n\t\t}\n\t>();\n\n\tconst modelDefinitions = options.models?.length\n\t\t? options.models\n\t\t: [\n\t\t\t\t{\n\t\t\t\t\tid: DEFAULT_MODEL_ID,\n\t\t\t\t\tname: DEFAULT_MODEL_NAME,\n\t\t\t\t\treasoning: false,\n\t\t\t\t\tinput: [\"text\", \"image\"] as (\"text\" | \"image\")[],\n\t\t\t\t\tcost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },\n\t\t\t\t\tcontextWindow: 128000,\n\t\t\t\t\tmaxTokens: 16384,\n\t\t\t\t},\n\t\t\t];\n\tconst models = modelDefinitions.map((definition) => ({\n\t\tid: definition.id,\n\t\tname: definition.name ?? definition.id,\n\t\tapi,\n\t\tprovider,\n\t\tbaseUrl: DEFAULT_BASE_URL,\n\t\treasoning: definition.reasoning ?? false,\n\t\tinput: definition.input ?? [\"text\", \"image\"],\n\t\tinputLimits: definition.inputLimits,\n\t\tcost: definition.cost ?? { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },\n\t\tcontextWindow: definition.contextWindow ?? 128000,\n\t\tmaxTokens: definition.maxTokens ?? 16384,\n\t})) as [Model<string>, ...Model<string>[]];\n\n\tconst resolveResponse = async (\n\t\tstep: FauxResponseStep,\n\t\tcontext: TranscriptContext,\n\t\tstreamOptions: SimpleStreamOptions | undefined,\n\t\trequestModel: Model<string>,\n\t): Promise<AssistantMessage> => {\n\t\tconst resolved = typeof step === \"function\" ? await step(context, streamOptions, state, requestModel) : step;\n\t\treturn withUsageEstimate(\n\t\t\tcloneMessage(resolved, api, provider, requestModel.id),\n\t\t\tcontext,\n\t\t\tstreamOptions,\n\t\t\tpromptCache,\n\t\t);\n\t};\n\n\tconst stream: StreamFunction<string, SimpleStreamOptions> = (requestModel, context, streamOptions) => {\n\t\tconst outer = createAssistantMessageEventStream();\n\t\tconst step = pendingResponses.shift();\n\t\tstate.callCount++;\n\n\t\tqueueMicrotask(async () => {\n\t\t\ttry {\n\t\t\t\tawait streamOptions?.onResponse?.({ status: 200, headers: {} }, requestModel);\n\t\t\t\tif (!step) {\n\t\t\t\t\tlet message = createErrorMessage(\n\t\t\t\t\t\tnew Error(\"No more faux responses queued\"),\n\t\t\t\t\t\tapi,\n\t\t\t\t\t\tprovider,\n\t\t\t\t\t\trequestModel.id,\n\t\t\t\t\t);\n\t\t\t\t\tmessage = withUsageEstimate(message, context, streamOptions, promptCache);\n\t\t\t\t\touter.push({ type: \"error\", reason: \"error\", error: message });\n\t\t\t\t\touter.end(message);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (streamOptions?.deferred) {\n\t\t\t\t\tconst handle: DeferredHandle = {\n\t\t\t\t\t\tprovider: requestModel.provider,\n\t\t\t\t\t\tmodelId: requestModel.id,\n\t\t\t\t\t\tapi: requestModel.api,\n\t\t\t\t\t\tid: randomId(\"deferred\"),\n\t\t\t\t\t\t...(options.deferred?.pollAfterMs !== undefined ? { pollAfterMs: options.deferred.pollAfterMs } : {}),\n\t\t\t\t\t};\n\t\t\t\t\tdeferredResponses.set(handle.id, {\n\t\t\t\t\t\thandle,\n\t\t\t\t\t\tstep,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\toptions: streamOptions,\n\t\t\t\t\t\tmodel: requestModel,\n\t\t\t\t\t\tpendingFetches: Math.max(0, Math.floor(options.deferred?.pendingFetches ?? 0)),\n\t\t\t\t\t\tcancelled: false,\n\t\t\t\t\t});\n\t\t\t\t\tawait streamWithDeltas(\n\t\t\t\t\t\touter,\n\t\t\t\t\t\tcreateDeferredMessage(requestModel, handle),\n\t\t\t\t\t\tminTokenSize,\n\t\t\t\t\t\tmaxTokenSize,\n\t\t\t\t\t\ttokensPerSecond,\n\t\t\t\t\t\tstreamOptions.signal,\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst message = await resolveResponse(step, context, streamOptions, requestModel);\n\t\t\t\tawait streamWithDeltas(outer, message, minTokenSize, maxTokenSize, tokensPerSecond, streamOptions?.signal);\n\t\t\t} catch (error) {\n\t\t\t\tconst message = createErrorMessage(error, api, provider, requestModel.id);\n\t\t\t\touter.push({ type: \"error\", reason: \"error\", error: message });\n\t\t\t\touter.end(message);\n\t\t\t}\n\t\t});\n\n\t\treturn outer;\n\t};\n\n\tconst streamSimple: StreamFunction<string, SimpleStreamOptions> = (streamModel, context, streamOptions) =>\n\t\tstream(streamModel, context, streamOptions);\n\n\tconst fetchDeferred = (\n\t\trequestModel: Model<string>,\n\t\thandle: DeferredHandle,\n\t\tfetchOptions?: DeferredFetchOptions,\n\t): AssistantMessageEventStream => {\n\t\tconst outer = createAssistantMessageEventStream();\n\t\tstate.deferredFetchCount++;\n\n\t\tqueueMicrotask(async () => {\n\t\t\ttry {\n\t\t\t\tawait fetchOptions?.onResponse?.({ status: 200, headers: {} }, requestModel);\n\t\t\t\tconst entry = deferredResponses.get(handle.id);\n\t\t\t\tif (\n\t\t\t\t\t!entry ||\n\t\t\t\t\tentry.handle.provider !== handle.provider ||\n\t\t\t\t\tentry.handle.modelId !== handle.modelId ||\n\t\t\t\t\tentry.handle.api !== handle.api\n\t\t\t\t) {\n\t\t\t\t\tthrow new Error(`Unknown faux deferred response: ${handle.id}`);\n\t\t\t\t}\n\t\t\t\tif (entry.cancelled) throw new Error(`Faux deferred response was cancelled: ${handle.id}`);\n\n\t\t\t\tif (entry.pendingFetches > 0) {\n\t\t\t\t\tentry.pendingFetches--;\n\t\t\t\t\tawait streamWithDeltas(\n\t\t\t\t\t\touter,\n\t\t\t\t\t\tcreateDeferredMessage(requestModel, entry.handle),\n\t\t\t\t\t\tminTokenSize,\n\t\t\t\t\t\tmaxTokenSize,\n\t\t\t\t\t\ttokensPerSecond,\n\t\t\t\t\t\tfetchOptions?.signal,\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (!entry.final) {\n\t\t\t\t\tconst {\n\t\t\t\t\t\tdeferred: _deferred,\n\t\t\t\t\t\tsignal: _submissionSignal,\n\t\t\t\t\t\tonResponse: _submissionOnResponse,\n\t\t\t\t\t\t...submissionOptions\n\t\t\t\t\t} = entry.options ?? {};\n\t\t\t\t\ttry {\n\t\t\t\t\t\tentry.final = await resolveResponse(entry.step, entry.context, submissionOptions, entry.model);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tentry.final = createErrorMessage(error, api, provider, entry.model.id);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tawait streamWithDeltas(\n\t\t\t\t\touter,\n\t\t\t\t\tentry.final,\n\t\t\t\t\tminTokenSize,\n\t\t\t\t\tmaxTokenSize,\n\t\t\t\t\ttokensPerSecond,\n\t\t\t\t\tfetchOptions?.signal,\n\t\t\t\t);\n\t\t\t} catch (error) {\n\t\t\t\tconst message = createErrorMessage(error, api, provider, requestModel.id);\n\t\t\t\touter.push({ type: \"error\", reason: \"error\", error: message });\n\t\t\t\touter.end(message);\n\t\t\t}\n\t\t});\n\n\t\treturn outer;\n\t};\n\n\tconst cancelDeferred = async (\n\t\trequestModel: Model<string>,\n\t\thandle: DeferredHandle,\n\t\tcancelOptions?: DeferredCancelOptions,\n\t): Promise<void> => {\n\t\tstate.cancelledDeferred.push(structuredClone(handle));\n\t\tconst entry = deferredResponses.get(handle.id);\n\t\tif (entry) entry.cancelled = true;\n\t\tawait cancelOptions?.onResponse?.({ status: 200, headers: {} }, requestModel);\n\t};\n\n\tfunction getModel(): Model<string>;\n\tfunction getModel(requestedModelId: string): Model<string> | undefined;\n\tfunction getModel(requestedModelId?: string): Model<string> | undefined {\n\t\tif (!requestedModelId) {\n\t\t\treturn models[0];\n\t\t}\n\t\treturn models.find((candidate) => candidate.id === requestedModelId);\n\t}\n\n\treturn {\n\t\tapi,\n\t\tprovider,\n\t\tmodels,\n\t\tstream,\n\t\tstreamSimple,\n\t\tfetchDeferred,\n\t\tcancelDeferred,\n\t\tgetModel,\n\t\tstate,\n\t\tsetResponses(responses: FauxResponseStep[]) {\n\t\t\tpendingResponses = [...responses];\n\t\t},\n\t\tappendResponses(responses: FauxResponseStep[]) {\n\t\t\tpendingResponses.push(...responses);\n\t\t},\n\t\tgetPendingResponseCount() {\n\t\t\treturn pendingResponses.length;\n\t\t},\n\t};\n}\n\n/**\n * Faux provider for tests built on explicit `Models` collections:\n *\n * ```ts\n * const faux = fauxProvider();\n * const models = createModels();\n * models.setProvider(faux.provider);\n * faux.setResponses([fauxAssistantMessage(\"hi\")]);\n * ```\n */\nexport function fauxProvider(options: RegisterFauxProviderOptions = {}): FauxProviderHandle {\n\tconst core = createFauxCore(options);\n\tconst provider = createProvider({\n\t\tid: core.provider,\n\t\tauth: { apiKey: { name: \"Faux\", resolve: async () => ({ auth: {} }) } },\n\t\tmodels: core.models,\n\t\tapi: {\n\t\t\tstream: core.stream,\n\t\t\tstreamSimple: core.streamSimple,\n\t\t\tfetchDeferred: core.fetchDeferred,\n\t\t\tcancelDeferred: core.cancelDeferred,\n\t\t},\n\t});\n\treturn {\n\t\tprovider,\n\t\tapi: core.api,\n\t\tmodels: core.models,\n\t\tgetModel: core.getModel,\n\t\tstate: core.state,\n\t\tsetResponses: core.setResponses,\n\t\tappendResponses: core.appendResponses,\n\t\tgetPendingResponseCount: core.getPendingResponseCount,\n\t};\n}\n"]}
1
+ {"version":3,"file":"faux.js","sourceRoot":"","sources":["../../src/providers/faux.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiB,MAAM,cAAc,CAAC;AAqB7D,OAAO,EAAE,iCAAiC,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,MAAM,WAAW,GAAG,MAAM,CAAC;AAC3B,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAChC,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAClC,MAAM,kBAAkB,GAAG,YAAY,CAAC;AACxC,MAAM,gBAAgB,GAAG,oBAAoB,CAAC;AAC9C,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACjC,MAAM,sBAAsB,GAAG,CAAC,CAAC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C;QAChC,CAAC;KACD,CAAC;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,YAAY,CAAC,OAAO,GAAgC,EAAE;IACrE,MAAM,IAAI,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IACrC,MAAM,QAAQ,GAAG,cAAc,CAAC;QAC/B,EAAE,EAAE,IAAI,CAAC,QAAQ;QACjB,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE;QACvE,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,GAAG,EAAE;YACJ,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,cAAc,EAAE,IAAI,CAAC,cAAc;SACnC;KACD,CAAC,CAAC;IACH,OAAO;QACN,QAAQ;QACR,GAAG,EAAE,IAAI,CAAC,GAAG;QACb,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,uBAAuB,EAAE,IAAI,CAAC,uBAAuB;KACrD,CAAC;AACH,CAAC","sourcesContent":["import { createProvider, type Provider } from \"../models.ts\";\nimport type {\n\tAssistantMessage,\n\tAssistantMessageEventStream,\n\tDeferredCancelOptions,\n\tDeferredFetchOptions,\n\tDeferredHandle,\n\tDocumentContent,\n\tImageContent,\n\tMessage,\n\tModel,\n\tSimpleStreamOptions,\n\tStreamFunction,\n\tStreamOptions,\n\tTextContent,\n\tThinkingContent,\n\tToolCall,\n\tToolResultMessage,\n\tTranscriptContext,\n\tUsage,\n} from \"../types.ts\";\nimport { createAssistantMessageEventStream } from \"../utils/event-stream.ts\";\nimport { getSystemMessageText } from \"../utils/text.ts\";\n\nconst DEFAULT_API = \"faux\";\nconst DEFAULT_PROVIDER = \"faux\";\nconst DEFAULT_MODEL_ID = \"faux-1\";\nconst DEFAULT_MODEL_NAME = \"Faux Model\";\nconst DEFAULT_BASE_URL = \"http://localhost:0\";\nconst DEFAULT_MIN_TOKEN_SIZE = 3;\nconst DEFAULT_MAX_TOKEN_SIZE = 5;\n\nconst DEFAULT_USAGE: Usage = {\n\tinput: 0,\n\toutput: 0,\n\tcacheRead: 0,\n\tcacheWrite: 0,\n\ttotalTokens: 0,\n\tcost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },\n};\n\nexport interface FauxModelDefinition {\n\tid: string;\n\tname?: string;\n\treasoning?: boolean;\n\tinput?: (\"text\" | \"image\")[];\n\tinputLimits?: Model<string>[\"inputLimits\"];\n\tcost?: { input: number; output: number; cacheRead: number; cacheWrite: number };\n\tcontextWindow?: number;\n\tmaxTokens?: number;\n}\n\nexport type FauxContentBlock = TextContent | ThinkingContent | ToolCall;\n\nexport function fauxText(text: string): TextContent {\n\treturn { type: \"text\", text };\n}\n\nexport function fauxThinking(thinking: string): ThinkingContent {\n\treturn { type: \"thinking\", thinking };\n}\n\nexport function fauxToolCall(name: string, arguments_: ToolCall[\"arguments\"], options: { id?: string } = {}): ToolCall {\n\treturn {\n\t\ttype: \"toolCall\",\n\t\tid: options.id ?? randomId(\"tool\"),\n\t\tname,\n\t\targuments: arguments_,\n\t};\n}\n\nfunction normalizeFauxAssistantContent(content: string | FauxContentBlock | FauxContentBlock[]): FauxContentBlock[] {\n\tif (typeof content === \"string\") {\n\t\treturn [fauxText(content)];\n\t}\n\treturn Array.isArray(content) ? content : [content];\n}\n\nexport function fauxAssistantMessage(\n\tcontent: string | FauxContentBlock | FauxContentBlock[],\n\toptions: {\n\t\tstopReason?: AssistantMessage[\"stopReason\"];\n\t\tdeferred?: DeferredHandle;\n\t\terrorMessage?: string;\n\t\tresponseId?: string;\n\t\ttimestamp?: number;\n\t} = {},\n): AssistantMessage {\n\treturn {\n\t\trole: \"assistant\",\n\t\tcontent: normalizeFauxAssistantContent(content),\n\t\tapi: DEFAULT_API,\n\t\tprovider: DEFAULT_PROVIDER,\n\t\tmodel: DEFAULT_MODEL_ID,\n\t\tusage: DEFAULT_USAGE,\n\t\tstopReason: options.stopReason ?? \"stop\",\n\t\tdeferred: options.deferred,\n\t\terrorMessage: options.errorMessage,\n\t\tresponseId: options.responseId,\n\t\ttimestamp: options.timestamp ?? Date.now(),\n\t};\n}\n\nexport interface FauxProviderState {\n\tcallCount: number;\n\tdeferredFetchCount: number;\n\tcancelledDeferred: DeferredHandle[];\n}\n\nexport type FauxResponseFactory = (\n\tcontext: TranscriptContext,\n\toptions: SimpleStreamOptions | undefined,\n\tstate: FauxProviderState,\n\tmodel: Model<string>,\n) => AssistantMessage | Promise<AssistantMessage>;\n\nexport type FauxResponseStep = AssistantMessage | FauxResponseFactory;\n\nexport interface RegisterFauxProviderOptions {\n\tapi?: string;\n\tprovider?: string;\n\tmodels?: FauxModelDefinition[];\n\tdeferred?: {\n\t\t/** Number of fetches that return the original handle before the scripted response becomes ready. */\n\t\tpendingFetches?: number;\n\t\tpollAfterMs?: number;\n\t};\n\ttokensPerSecond?: number;\n\ttokenSize?: {\n\t\tmin?: number;\n\t\tmax?: number;\n\t};\n}\n\nexport interface FauxProviderRegistration {\n\tapi: string;\n\tmodels: [Model<string>, ...Model<string>[]];\n\tgetModel(): Model<string>;\n\tgetModel(modelId: string): Model<string> | undefined;\n\tstate: FauxProviderState;\n\tsetResponses: (responses: FauxResponseStep[]) => void;\n\tappendResponses: (responses: FauxResponseStep[]) => void;\n\tgetPendingResponseCount: () => number;\n\tunregister: () => void;\n}\n\nexport interface FauxProviderHandle {\n\tprovider: Provider;\n\tapi: string;\n\tmodels: [Model<string>, ...Model<string>[]];\n\tgetModel(): Model<string>;\n\tgetModel(modelId: string): Model<string> | undefined;\n\tstate: FauxProviderState;\n\tsetResponses: (responses: FauxResponseStep[]) => void;\n\tappendResponses: (responses: FauxResponseStep[]) => void;\n\tgetPendingResponseCount: () => number;\n}\n\nfunction estimateTokens(text: string): number {\n\treturn Math.ceil(text.length / 4);\n}\n\nfunction randomId(prefix: string): string {\n\treturn `${prefix}:${Date.now()}:${Math.random().toString(36).slice(2)}`;\n}\n\nfunction contentToText(content: string | Array<TextContent | ImageContent | DocumentContent>): string {\n\tif (typeof content === \"string\") {\n\t\treturn content;\n\t}\n\treturn content\n\t\t.map((block) => {\n\t\t\tif (block.type === \"text\") {\n\t\t\t\treturn block.text;\n\t\t\t}\n\t\t\tif (block.type === \"document\") {\n\t\t\t\treturn `[document:${block.mimeType}:${block.data.length}]`;\n\t\t\t}\n\t\t\treturn `[image:${block.mimeType}:${block.data.length}]`;\n\t\t})\n\t\t.join(\"\\n\");\n}\n\nfunction assistantContentToText(content: AssistantMessage[\"content\"]): string {\n\treturn content\n\t\t.map((block) => {\n\t\t\tif (block.type === \"text\") {\n\t\t\t\treturn block.text;\n\t\t\t}\n\t\t\tif (block.type === \"thinking\") {\n\t\t\t\treturn block.thinking;\n\t\t\t}\n\t\t\t// Fallback boundary markers carry no text.\n\t\t\tif (block.type !== \"toolCall\") {\n\t\t\t\treturn \"\";\n\t\t\t}\n\t\t\treturn `${block.name}:${JSON.stringify(block.arguments)}`;\n\t\t})\n\t\t.join(\"\\n\");\n}\n\nfunction toolResultToText(message: ToolResultMessage): string {\n\treturn [message.toolName, ...message.content.map((block) => contentToText([block]))].join(\"\\n\");\n}\n\nfunction messageToText(message: Message): string {\n\tif (message.role === \"system\") {\n\t\treturn [\n\t\t\tgetSystemMessageText(message),\n\t\t\t...(message.toolsRemoved?.map((tool) => `tool-:${JSON.stringify(tool)}`) ?? []),\n\t\t\t...(message.toolsAdded?.map((tool) => `tool+:${JSON.stringify(tool)}`) ?? []),\n\t\t]\n\t\t\t.filter((part) => part.length > 0)\n\t\t\t.join(\"\\n\");\n\t}\n\tif (message.role === \"user\") {\n\t\treturn contentToText(message.content);\n\t}\n\tif (message.role === \"assistant\") {\n\t\treturn assistantContentToText(message.content);\n\t}\n\treturn toolResultToText(message);\n}\n\nfunction serializeContext(context: TranscriptContext): string {\n\treturn context.messages.map((message) => `${message.role}:${messageToText(message)}`).join(\"\\n\\n\");\n}\n\nfunction commonPrefixLength(a: string, b: string): number {\n\tconst length = Math.min(a.length, b.length);\n\tlet index = 0;\n\twhile (index < length && a[index] === b[index]) {\n\t\tindex++;\n\t}\n\treturn index;\n}\n\nfunction withUsageEstimate(\n\tmessage: AssistantMessage,\n\tcontext: TranscriptContext,\n\toptions: StreamOptions | undefined,\n\tpromptCache: Map<string, string>,\n): AssistantMessage {\n\tconst promptText = serializeContext(context);\n\tconst promptTokens = estimateTokens(promptText);\n\tconst outputTokens = estimateTokens(assistantContentToText(message.content));\n\tlet input = promptTokens;\n\tlet cacheRead = 0;\n\tlet cacheWrite = 0;\n\tconst sessionId = options?.sessionId;\n\n\tif (sessionId && options?.cacheRetention !== \"none\") {\n\t\tconst previousPrompt = promptCache.get(sessionId);\n\t\tif (previousPrompt) {\n\t\t\tconst cachedChars = commonPrefixLength(previousPrompt, promptText);\n\t\t\tcacheRead = estimateTokens(previousPrompt.slice(0, cachedChars));\n\t\t\tcacheWrite = estimateTokens(promptText.slice(cachedChars));\n\t\t\tinput = Math.max(0, promptTokens - cacheRead);\n\t\t} else {\n\t\t\tcacheWrite = promptTokens;\n\t\t}\n\t\tpromptCache.set(sessionId, promptText);\n\t}\n\n\treturn {\n\t\t...message,\n\t\tusage: {\n\t\t\tinput,\n\t\t\toutput: outputTokens,\n\t\t\tcacheRead,\n\t\t\tcacheWrite,\n\t\t\ttotalTokens: input + outputTokens + cacheRead + cacheWrite,\n\t\t\tcost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },\n\t\t},\n\t};\n}\n\nfunction splitStringByTokenSize(text: string, minTokenSize: number, maxTokenSize: number): string[] {\n\tconst chunks: string[] = [];\n\tlet index = 0;\n\twhile (index < text.length) {\n\t\tconst tokenSize = minTokenSize + Math.floor(Math.random() * (maxTokenSize - minTokenSize + 1));\n\t\tconst charSize = Math.max(1, tokenSize * 4);\n\t\tchunks.push(text.slice(index, index + charSize));\n\t\tindex += charSize;\n\t}\n\treturn chunks.length > 0 ? chunks : [\"\"];\n}\n\nfunction cloneMessage(message: AssistantMessage, api: string, provider: string, modelId: string): AssistantMessage {\n\tconst cloned = structuredClone(message);\n\treturn {\n\t\t...cloned,\n\t\tapi,\n\t\tprovider,\n\t\tmodel: modelId,\n\t\ttimestamp: cloned.timestamp ?? Date.now(),\n\t\tusage: cloned.usage ?? DEFAULT_USAGE,\n\t};\n}\n\nfunction createDeferredMessage(model: Model<string>, handle: DeferredHandle): AssistantMessage {\n\treturn {\n\t\trole: \"assistant\",\n\t\tcontent: [],\n\t\tapi: model.api,\n\t\tprovider: model.provider,\n\t\tmodel: model.id,\n\t\tusage: DEFAULT_USAGE,\n\t\tstopReason: \"deferred\",\n\t\tdeferred: handle,\n\t\ttimestamp: Date.now(),\n\t};\n}\n\nfunction createErrorMessage(error: unknown, api: string, provider: string, modelId: string): AssistantMessage {\n\treturn {\n\t\trole: \"assistant\",\n\t\tcontent: [],\n\t\tapi,\n\t\tprovider,\n\t\tmodel: modelId,\n\t\tusage: DEFAULT_USAGE,\n\t\tstopReason: \"error\",\n\t\terrorMessage: error instanceof Error ? error.message : String(error),\n\t\ttimestamp: Date.now(),\n\t};\n}\n\nfunction createAbortedMessage(partial: AssistantMessage): AssistantMessage {\n\treturn {\n\t\t...partial,\n\t\tstopReason: \"aborted\",\n\t\terrorMessage: \"Request was aborted\",\n\t\ttimestamp: Date.now(),\n\t};\n}\n\nfunction scheduleChunk(chunk: string, tokensPerSecond: number | undefined): Promise<void> {\n\tif (!tokensPerSecond || tokensPerSecond <= 0) {\n\t\treturn new Promise((resolve) => queueMicrotask(resolve));\n\t}\n\tconst delayMs = (estimateTokens(chunk) / tokensPerSecond) * 1000;\n\treturn new Promise((resolve) => setTimeout(resolve, delayMs));\n}\n\nasync function streamWithDeltas(\n\tstream: AssistantMessageEventStream,\n\tmessage: AssistantMessage,\n\tminTokenSize: number,\n\tmaxTokenSize: number,\n\ttokensPerSecond: number | undefined,\n\tsignal: AbortSignal | undefined,\n): Promise<void> {\n\tconst partial: AssistantMessage = { ...message, content: [], stopReason: \"pending\" };\n\tif (signal?.aborted) {\n\t\tconst aborted = createAbortedMessage(partial);\n\t\tstream.push({ type: \"error\", reason: \"aborted\", error: aborted });\n\t\tstream.end(aborted);\n\t\treturn;\n\t}\n\n\tstream.push({ type: \"start\", partial: { ...partial } });\n\n\tfor (let index = 0; index < message.content.length; index++) {\n\t\tif (signal?.aborted) {\n\t\t\tconst aborted = createAbortedMessage(partial);\n\t\t\tstream.push({ type: \"error\", reason: \"aborted\", error: aborted });\n\t\t\tstream.end(aborted);\n\t\t\treturn;\n\t\t}\n\n\t\tconst block = message.content[index];\n\n\t\tif (block.type === \"thinking\") {\n\t\t\tpartial.content = [...partial.content, { type: \"thinking\", thinking: \"\" }];\n\t\t\tstream.push({ type: \"thinking_start\", contentIndex: index, partial: { ...partial } });\n\t\t\tfor (const chunk of splitStringByTokenSize(block.thinking, minTokenSize, maxTokenSize)) {\n\t\t\t\tawait scheduleChunk(chunk, tokensPerSecond);\n\t\t\t\tif (signal?.aborted) {\n\t\t\t\t\tconst aborted = createAbortedMessage(partial);\n\t\t\t\t\tstream.push({ type: \"error\", reason: \"aborted\", error: aborted });\n\t\t\t\t\tstream.end(aborted);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t(partial.content[index] as ThinkingContent).thinking += chunk;\n\t\t\t\tstream.push({ type: \"thinking_delta\", contentIndex: index, delta: chunk, partial: { ...partial } });\n\t\t\t}\n\t\t\tstream.push({\n\t\t\t\ttype: \"thinking_end\",\n\t\t\t\tcontentIndex: index,\n\t\t\t\tcontent: block.thinking,\n\t\t\t\tpartial: { ...partial },\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (block.type === \"text\") {\n\t\t\tpartial.content = [...partial.content, { type: \"text\", text: \"\" }];\n\t\t\tstream.push({ type: \"text_start\", contentIndex: index, partial: { ...partial } });\n\t\t\tfor (const chunk of splitStringByTokenSize(block.text, minTokenSize, maxTokenSize)) {\n\t\t\t\tawait scheduleChunk(chunk, tokensPerSecond);\n\t\t\t\tif (signal?.aborted) {\n\t\t\t\t\tconst aborted = createAbortedMessage(partial);\n\t\t\t\t\tstream.push({ type: \"error\", reason: \"aborted\", error: aborted });\n\t\t\t\t\tstream.end(aborted);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t(partial.content[index] as TextContent).text += chunk;\n\t\t\t\tstream.push({ type: \"text_delta\", contentIndex: index, delta: chunk, partial: { ...partial } });\n\t\t\t}\n\t\t\tstream.push({ type: \"text_end\", contentIndex: index, content: block.text, partial: { ...partial } });\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Fallback boundary markers are replay metadata with nothing to stream, but they still\n\t\t// occupy a slot in `partial.content` so later blocks keep their source `contentIndex`.\n\t\t// This matches the real Anthropic provider, which pushes the wire `fallback` block into\n\t\t// `output.content` and emits no event for it; every `contentIndex` consumer indexes\n\t\t// `partial.content` directly, so skipping the slot would shift every later block by one.\n\t\tif (block.type !== \"toolCall\") {\n\t\t\tpartial.content = [...partial.content, block];\n\t\t\tcontinue;\n\t\t}\n\n\t\tpartial.content = [...partial.content, { type: \"toolCall\", id: block.id, name: block.name, arguments: {} }];\n\t\tstream.push({ type: \"toolcall_start\", contentIndex: index, partial: { ...partial } });\n\t\tfor (const chunk of splitStringByTokenSize(JSON.stringify(block.arguments), minTokenSize, maxTokenSize)) {\n\t\t\tawait scheduleChunk(chunk, tokensPerSecond);\n\t\t\tif (signal?.aborted) {\n\t\t\t\tconst aborted = createAbortedMessage(partial);\n\t\t\t\tstream.push({ type: \"error\", reason: \"aborted\", error: aborted });\n\t\t\t\tstream.end(aborted);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tstream.push({ type: \"toolcall_delta\", contentIndex: index, delta: chunk, partial: { ...partial } });\n\t\t}\n\t\t(partial.content[index] as ToolCall).arguments = block.arguments;\n\t\tstream.push({ type: \"toolcall_end\", contentIndex: index, toolCall: block, partial: { ...partial } });\n\t}\n\n\tif (message.stopReason === \"pending\") {\n\t\tthrow new Error(\"Faux response ended without a stop reason\");\n\t}\n\tif (message.stopReason === \"error\" || message.stopReason === \"aborted\") {\n\t\tstream.push({ type: \"error\", reason: message.stopReason, error: message });\n\t\tstream.end(message);\n\t\treturn;\n\t}\n\n\tstream.push({ type: \"done\", reason: message.stopReason, message });\n\tstream.end(message);\n}\n\nexport function createFauxCore(options: RegisterFauxProviderOptions) {\n\tconst api = options.api ?? randomId(DEFAULT_API);\n\tconst provider = options.provider ?? DEFAULT_PROVIDER;\n\tconst minTokenSize = Math.max(\n\t\t1,\n\t\tMath.min(options.tokenSize?.min ?? DEFAULT_MIN_TOKEN_SIZE, options.tokenSize?.max ?? DEFAULT_MAX_TOKEN_SIZE),\n\t);\n\tconst maxTokenSize = Math.max(minTokenSize, options.tokenSize?.max ?? DEFAULT_MAX_TOKEN_SIZE);\n\tlet pendingResponses: FauxResponseStep[] = [];\n\tconst tokensPerSecond = options.tokensPerSecond;\n\tconst state: FauxProviderState = { callCount: 0, deferredFetchCount: 0, cancelledDeferred: [] };\n\tconst promptCache = new Map<string, string>();\n\tconst deferredResponses = new Map<\n\t\tstring,\n\t\t{\n\t\t\thandle: DeferredHandle;\n\t\t\tstep: FauxResponseStep;\n\t\t\tcontext: TranscriptContext;\n\t\t\toptions: SimpleStreamOptions | undefined;\n\t\t\tmodel: Model<string>;\n\t\t\tpendingFetches: number;\n\t\t\tcancelled: boolean;\n\t\t\tfinal?: AssistantMessage;\n\t\t}\n\t>();\n\n\tconst modelDefinitions = options.models?.length\n\t\t? options.models\n\t\t: [\n\t\t\t\t{\n\t\t\t\t\tid: DEFAULT_MODEL_ID,\n\t\t\t\t\tname: DEFAULT_MODEL_NAME,\n\t\t\t\t\treasoning: false,\n\t\t\t\t\tinput: [\"text\", \"image\"] as (\"text\" | \"image\")[],\n\t\t\t\t\tcost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },\n\t\t\t\t\tcontextWindow: 128000,\n\t\t\t\t\tmaxTokens: 16384,\n\t\t\t\t},\n\t\t\t];\n\tconst models = modelDefinitions.map((definition) => ({\n\t\tid: definition.id,\n\t\tname: definition.name ?? definition.id,\n\t\tapi,\n\t\tprovider,\n\t\tbaseUrl: DEFAULT_BASE_URL,\n\t\treasoning: definition.reasoning ?? false,\n\t\tinput: definition.input ?? [\"text\", \"image\"],\n\t\tinputLimits: definition.inputLimits,\n\t\tcost: definition.cost ?? { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },\n\t\tcontextWindow: definition.contextWindow ?? 128000,\n\t\tmaxTokens: definition.maxTokens ?? 16384,\n\t})) as [Model<string>, ...Model<string>[]];\n\n\tconst resolveResponse = async (\n\t\tstep: FauxResponseStep,\n\t\tcontext: TranscriptContext,\n\t\tstreamOptions: SimpleStreamOptions | undefined,\n\t\trequestModel: Model<string>,\n\t): Promise<AssistantMessage> => {\n\t\tconst resolved = typeof step === \"function\" ? await step(context, streamOptions, state, requestModel) : step;\n\t\treturn withUsageEstimate(\n\t\t\tcloneMessage(resolved, api, provider, requestModel.id),\n\t\t\tcontext,\n\t\t\tstreamOptions,\n\t\t\tpromptCache,\n\t\t);\n\t};\n\n\tconst stream: StreamFunction<string, SimpleStreamOptions> = (requestModel, context, streamOptions) => {\n\t\tconst outer = createAssistantMessageEventStream();\n\t\tconst step = pendingResponses.shift();\n\t\tstate.callCount++;\n\n\t\tqueueMicrotask(async () => {\n\t\t\ttry {\n\t\t\t\tawait streamOptions?.onResponse?.({ status: 200, headers: {} }, requestModel);\n\t\t\t\tif (!step) {\n\t\t\t\t\tlet message = createErrorMessage(\n\t\t\t\t\t\tnew Error(\"No more faux responses queued\"),\n\t\t\t\t\t\tapi,\n\t\t\t\t\t\tprovider,\n\t\t\t\t\t\trequestModel.id,\n\t\t\t\t\t);\n\t\t\t\t\tmessage = withUsageEstimate(message, context, streamOptions, promptCache);\n\t\t\t\t\touter.push({ type: \"error\", reason: \"error\", error: message });\n\t\t\t\t\touter.end(message);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (streamOptions?.deferred) {\n\t\t\t\t\tconst handle: DeferredHandle = {\n\t\t\t\t\t\tprovider: requestModel.provider,\n\t\t\t\t\t\tmodelId: requestModel.id,\n\t\t\t\t\t\tapi: requestModel.api,\n\t\t\t\t\t\tid: randomId(\"deferred\"),\n\t\t\t\t\t\t...(options.deferred?.pollAfterMs !== undefined ? { pollAfterMs: options.deferred.pollAfterMs } : {}),\n\t\t\t\t\t};\n\t\t\t\t\tdeferredResponses.set(handle.id, {\n\t\t\t\t\t\thandle,\n\t\t\t\t\t\tstep,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\toptions: streamOptions,\n\t\t\t\t\t\tmodel: requestModel,\n\t\t\t\t\t\tpendingFetches: Math.max(0, Math.floor(options.deferred?.pendingFetches ?? 0)),\n\t\t\t\t\t\tcancelled: false,\n\t\t\t\t\t});\n\t\t\t\t\tawait streamWithDeltas(\n\t\t\t\t\t\touter,\n\t\t\t\t\t\tcreateDeferredMessage(requestModel, handle),\n\t\t\t\t\t\tminTokenSize,\n\t\t\t\t\t\tmaxTokenSize,\n\t\t\t\t\t\ttokensPerSecond,\n\t\t\t\t\t\tstreamOptions.signal,\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst message = await resolveResponse(step, context, streamOptions, requestModel);\n\t\t\t\tawait streamWithDeltas(outer, message, minTokenSize, maxTokenSize, tokensPerSecond, streamOptions?.signal);\n\t\t\t} catch (error) {\n\t\t\t\tconst message = createErrorMessage(error, api, provider, requestModel.id);\n\t\t\t\touter.push({ type: \"error\", reason: \"error\", error: message });\n\t\t\t\touter.end(message);\n\t\t\t}\n\t\t});\n\n\t\treturn outer;\n\t};\n\n\tconst streamSimple: StreamFunction<string, SimpleStreamOptions> = (streamModel, context, streamOptions) =>\n\t\tstream(streamModel, context, streamOptions);\n\n\tconst fetchDeferred = (\n\t\trequestModel: Model<string>,\n\t\thandle: DeferredHandle,\n\t\tfetchOptions?: DeferredFetchOptions,\n\t): AssistantMessageEventStream => {\n\t\tconst outer = createAssistantMessageEventStream();\n\t\tstate.deferredFetchCount++;\n\n\t\tqueueMicrotask(async () => {\n\t\t\ttry {\n\t\t\t\tawait fetchOptions?.onResponse?.({ status: 200, headers: {} }, requestModel);\n\t\t\t\tconst entry = deferredResponses.get(handle.id);\n\t\t\t\tif (\n\t\t\t\t\t!entry ||\n\t\t\t\t\tentry.handle.provider !== handle.provider ||\n\t\t\t\t\tentry.handle.modelId !== handle.modelId ||\n\t\t\t\t\tentry.handle.api !== handle.api\n\t\t\t\t) {\n\t\t\t\t\tthrow new Error(`Unknown faux deferred response: ${handle.id}`);\n\t\t\t\t}\n\t\t\t\tif (entry.cancelled) throw new Error(`Faux deferred response was cancelled: ${handle.id}`);\n\n\t\t\t\tif (entry.pendingFetches > 0) {\n\t\t\t\t\tentry.pendingFetches--;\n\t\t\t\t\tawait streamWithDeltas(\n\t\t\t\t\t\touter,\n\t\t\t\t\t\tcreateDeferredMessage(requestModel, entry.handle),\n\t\t\t\t\t\tminTokenSize,\n\t\t\t\t\t\tmaxTokenSize,\n\t\t\t\t\t\ttokensPerSecond,\n\t\t\t\t\t\tfetchOptions?.signal,\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (!entry.final) {\n\t\t\t\t\tconst {\n\t\t\t\t\t\tdeferred: _deferred,\n\t\t\t\t\t\tsignal: _submissionSignal,\n\t\t\t\t\t\tonResponse: _submissionOnResponse,\n\t\t\t\t\t\t...submissionOptions\n\t\t\t\t\t} = entry.options ?? {};\n\t\t\t\t\ttry {\n\t\t\t\t\t\tentry.final = await resolveResponse(entry.step, entry.context, submissionOptions, entry.model);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tentry.final = createErrorMessage(error, api, provider, entry.model.id);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tawait streamWithDeltas(\n\t\t\t\t\touter,\n\t\t\t\t\tentry.final,\n\t\t\t\t\tminTokenSize,\n\t\t\t\t\tmaxTokenSize,\n\t\t\t\t\ttokensPerSecond,\n\t\t\t\t\tfetchOptions?.signal,\n\t\t\t\t);\n\t\t\t} catch (error) {\n\t\t\t\tconst message = createErrorMessage(error, api, provider, requestModel.id);\n\t\t\t\touter.push({ type: \"error\", reason: \"error\", error: message });\n\t\t\t\touter.end(message);\n\t\t\t}\n\t\t});\n\n\t\treturn outer;\n\t};\n\n\tconst cancelDeferred = async (\n\t\trequestModel: Model<string>,\n\t\thandle: DeferredHandle,\n\t\tcancelOptions?: DeferredCancelOptions,\n\t): Promise<void> => {\n\t\tstate.cancelledDeferred.push(structuredClone(handle));\n\t\tconst entry = deferredResponses.get(handle.id);\n\t\tif (entry) entry.cancelled = true;\n\t\tawait cancelOptions?.onResponse?.({ status: 200, headers: {} }, requestModel);\n\t};\n\n\tfunction getModel(): Model<string>;\n\tfunction getModel(requestedModelId: string): Model<string> | undefined;\n\tfunction getModel(requestedModelId?: string): Model<string> | undefined {\n\t\tif (!requestedModelId) {\n\t\t\treturn models[0];\n\t\t}\n\t\treturn models.find((candidate) => candidate.id === requestedModelId);\n\t}\n\n\treturn {\n\t\tapi,\n\t\tprovider,\n\t\tmodels,\n\t\tstream,\n\t\tstreamSimple,\n\t\tfetchDeferred,\n\t\tcancelDeferred,\n\t\tgetModel,\n\t\tstate,\n\t\tsetResponses(responses: FauxResponseStep[]) {\n\t\t\tpendingResponses = [...responses];\n\t\t},\n\t\tappendResponses(responses: FauxResponseStep[]) {\n\t\t\tpendingResponses.push(...responses);\n\t\t},\n\t\tgetPendingResponseCount() {\n\t\t\treturn pendingResponses.length;\n\t\t},\n\t};\n}\n\n/**\n * Faux provider for tests built on explicit `Models` collections:\n *\n * ```ts\n * const faux = fauxProvider();\n * const models = createModels();\n * models.setProvider(faux.provider);\n * faux.setResponses([fauxAssistantMessage(\"hi\")]);\n * ```\n */\nexport function fauxProvider(options: RegisterFauxProviderOptions = {}): FauxProviderHandle {\n\tconst core = createFauxCore(options);\n\tconst provider = createProvider({\n\t\tid: core.provider,\n\t\tauth: { apiKey: { name: \"Faux\", resolve: async () => ({ auth: {} }) } },\n\t\tmodels: core.models,\n\t\tapi: {\n\t\t\tstream: core.stream,\n\t\t\tstreamSimple: core.streamSimple,\n\t\t\tfetchDeferred: core.fetchDeferred,\n\t\t\tcancelDeferred: core.cancelDeferred,\n\t\t},\n\t});\n\treturn {\n\t\tprovider,\n\t\tapi: core.api,\n\t\tmodels: core.models,\n\t\tgetModel: core.getModel,\n\t\tstate: core.state,\n\t\tsetResponses: core.setResponses,\n\t\tappendResponses: core.appendResponses,\n\t\tgetPendingResponseCount: core.getPendingResponseCount,\n\t};\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"fireworks.d.ts","sourceRoot":"","sources":["../../src/providers/fireworks.ts"],"names":[],"mappings":"AAGA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG7D,wBAAgB,iBAAiB,IAAI,QAAQ,CAAC,oBAAoB,GAAG,oBAAoB,CAAC,CAYzF","sourcesContent":["import { anthropicMessagesApi } from \"../api/anthropic-messages.lazy.ts\";\nimport { openAICompletionsApi } from \"../api/openai-completions.lazy.ts\";\nimport { envApiKeyAuth } from \"../auth/helpers.ts\";\nimport { createProvider, type Provider } from \"../models.ts\";\nimport { FIREWORKS_MODELS } from \"./fireworks.models.ts\";\n\nexport function fireworksProvider(): Provider<\"anthropic-messages\" | \"openai-completions\"> {\n\treturn createProvider({\n\t\tid: \"fireworks\",\n\t\tname: \"Fireworks\",\n\t\tbaseUrl: \"https://api.fireworks.ai/inference\",\n\t\tauth: { apiKey: envApiKeyAuth(\"Fireworks API key\", [\"FIREWORKS_API_KEY\"]) },\n\t\tmodels: Object.values(FIREWORKS_MODELS),\n\t\tapi: {\n\t\t\t\"anthropic-messages\": anthropicMessagesApi(),\n\t\t\t\"openai-completions\": openAICompletionsApi(),\n\t\t},\n\t});\n}\n"]}
1
+ {"version":3,"file":"fireworks.d.ts","sourceRoot":"","sources":["../../src/providers/fireworks.ts"],"names":[],"mappings":"AAGA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG7D,wBAAgB,iBAAiB,IAAI,QAAQ,CAAC,oBAAoB,GAAG,oBAAoB,CAAC,CAYzF"}
@@ -1 +1 @@
1
- {"version":3,"file":"fireworks.js","sourceRoot":"","sources":["../../src/providers/fireworks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAiB,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,MAAM,UAAU,iBAAiB,GAA0D;IAC1F,OAAO,cAAc,CAAC;QACrB,EAAE,EAAE,WAAW;QACf,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,oCAAoC;QAC7C,IAAI,EAAE,EAAE,MAAM,EAAE,aAAa,CAAC,mBAAmB,EAAE,CAAC,mBAAmB,CAAC,CAAC,EAAE;QAC3E,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC;QACvC,GAAG,EAAE;YACJ,oBAAoB,EAAE,oBAAoB,EAAE;YAC5C,oBAAoB,EAAE,oBAAoB,EAAE;SAC5C;KACD,CAAC,CAAC;AAAA,CACH","sourcesContent":["import { anthropicMessagesApi } from \"../api/anthropic-messages.lazy.ts\";\nimport { openAICompletionsApi } from \"../api/openai-completions.lazy.ts\";\nimport { envApiKeyAuth } from \"../auth/helpers.ts\";\nimport { createProvider, type Provider } from \"../models.ts\";\nimport { FIREWORKS_MODELS } from \"./fireworks.models.ts\";\n\nexport function fireworksProvider(): Provider<\"anthropic-messages\" | \"openai-completions\"> {\n\treturn createProvider({\n\t\tid: \"fireworks\",\n\t\tname: \"Fireworks\",\n\t\tbaseUrl: \"https://api.fireworks.ai/inference\",\n\t\tauth: { apiKey: envApiKeyAuth(\"Fireworks API key\", [\"FIREWORKS_API_KEY\"]) },\n\t\tmodels: Object.values(FIREWORKS_MODELS),\n\t\tapi: {\n\t\t\t\"anthropic-messages\": anthropicMessagesApi(),\n\t\t\t\"openai-completions\": openAICompletionsApi(),\n\t\t},\n\t});\n}\n"]}
1
+ {"version":3,"file":"fireworks.js","sourceRoot":"","sources":["../../src/providers/fireworks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAiB,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,MAAM,UAAU,iBAAiB;IAChC,OAAO,cAAc,CAAC;QACrB,EAAE,EAAE,WAAW;QACf,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,oCAAoC;QAC7C,IAAI,EAAE,EAAE,MAAM,EAAE,aAAa,CAAC,mBAAmB,EAAE,CAAC,mBAAmB,CAAC,CAAC,EAAE;QAC3E,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC;QACvC,GAAG,EAAE;YACJ,oBAAoB,EAAE,oBAAoB,EAAE;YAC5C,oBAAoB,EAAE,oBAAoB,EAAE;SAC5C;KACD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { anthropicMessagesApi } from \"../api/anthropic-messages.lazy.ts\";\nimport { openAICompletionsApi } from \"../api/openai-completions.lazy.ts\";\nimport { envApiKeyAuth } from \"../auth/helpers.ts\";\nimport { createProvider, type Provider } from \"../models.ts\";\nimport { FIREWORKS_MODELS } from \"./fireworks.models.ts\";\n\nexport function fireworksProvider(): Provider<\"anthropic-messages\" | \"openai-completions\"> {\n\treturn createProvider({\n\t\tid: \"fireworks\",\n\t\tname: \"Fireworks\",\n\t\tbaseUrl: \"https://api.fireworks.ai/inference\",\n\t\tauth: { apiKey: envApiKeyAuth(\"Fireworks API key\", [\"FIREWORKS_API_KEY\"]) },\n\t\tmodels: Object.values(FIREWORKS_MODELS),\n\t\tapi: {\n\t\t\t\"anthropic-messages\": anthropicMessagesApi(),\n\t\t\t\"openai-completions\": openAICompletionsApi(),\n\t\t},\n\t});\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"fireworks.models.d.ts","sourceRoot":"","sources":["../../src/providers/fireworks.models.ts"],"names":[],"mappings":"AAIA,OAAO,EAAoF,KAAK,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAEnM,eAAO,MAAM,gBAAgB,EAAE,gBAAgB,CAAC,cAAc,uBAAuB,EAAU,UAAE,IAAI,EAAE,MAAM,IAAE,CAAG,EAAE,WAAW,CAClF,CAAC;AAE9C,eAAO,MAAM,sBAAsB,EAAE,iBAAiB,CAAC,cAAc,uBAAuB,EAAU,UAAE,IAAI,EAAE,MAAM,IAAE,CAAG,EAAE,WAAW,CACxF,CAAC;AAE/C,eAAO,MAAM,2BAA2B,EAAE,sBAAsB,CAAC,cAAc,uBAAuB,EAAU,UAAE,IAAI,EAAE,MAAM,IAAE,CAAG,EAAE,WAAW,CAC7F,CAAC","sourcesContent":["// This file is auto-generated by scripts/generate-models.ts\n// Do not edit manually - run 'npm run generate-models' to update\n\nimport values from \"./data/fireworks.json\" with { type: \"json\" };\nimport { flattenChatModelCatalog, flattenImageModelCatalog, flattenClassifierModelCatalog, type ChatModelCatalog, type ImageModelCatalog, type ClassifierModelCatalog } from \"../model-catalog.ts\";\n\nexport const FIREWORKS_MODELS: ChatModelCatalog<typeof import(\"./data/fireworks.json\", { with: { type: \"json\" } }), \"fireworks\"> =\n\tflattenChatModelCatalog(\"fireworks\", values);\n\nexport const FIREWORKS_IMAGE_MODELS: ImageModelCatalog<typeof import(\"./data/fireworks.json\", { with: { type: \"json\" } }), \"fireworks\"> =\n\tflattenImageModelCatalog(\"fireworks\", values);\n\nexport const FIREWORKS_CLASSIFIER_MODELS: ClassifierModelCatalog<typeof import(\"./data/fireworks.json\", { with: { type: \"json\" } }), \"fireworks\"> =\n\tflattenClassifierModelCatalog(\"fireworks\", values);\n"]}
1
+ {"version":3,"file":"fireworks.models.d.ts","sourceRoot":"","sources":["../../src/providers/fireworks.models.ts"],"names":[],"mappings":"AAIA,OAAO,EAAoF,KAAK,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAEnM,eAAO,MAAM,gBAAgB,EAAE,gBAAgB,CAAC,cAAc,uBAAuB,EAAU,UAAE,IAAI,EAAE,MAAM,IAAE,CAAG,EAAE,WAAW,CAClF,CAAC;AAE9C,eAAO,MAAM,sBAAsB,EAAE,iBAAiB,CAAC,cAAc,uBAAuB,EAAU,UAAE,IAAI,EAAE,MAAM,IAAE,CAAG,EAAE,WAAW,CACxF,CAAC;AAE/C,eAAO,MAAM,2BAA2B,EAAE,sBAAsB,CAAC,cAAc,uBAAuB,EAAU,UAAE,IAAI,EAAE,MAAM,IAAE,CAAG,EAAE,WAAW,CAC7F,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"github-copilot-env.d.ts","sourceRoot":"","sources":["../../src/providers/github-copilot-env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG7C;;;;;;;;;;;;GAYG;AAEH,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;AAyC7E;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,iBAAiB,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAoB9G;AAMD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,iBAAiB,GAAG,QAAQ,CAU1F","sourcesContent":["import type { Provider } from \"../models.ts\";\nimport type { Api, Model } from \"../types.ts\";\n\n/**\n * GitHub Copilot host routing for `COPILOT_GITHUB_TOKEN` (PAT) auth.\n *\n * Upstream pi pins `github-copilot` to `https://api.individual.githubcopilot.com`\n * and only derives a per-tenant host inside the OAuth loader, which returns an\n * `auth.baseUrl` from the token's `proxy-ep` segment. `envApiKeyAuth` resolves\n * `COPILOT_GITHUB_TOKEN` without a base URL, so business/enterprise tokens are\n * sent to the individual CAPI host and GitHub answers `421 Misdirected Request`.\n *\n * This module restores the routing precedence for the env-token path only; the\n * OAuth path stays exactly upstream. A `models.json` provider `baseUrl` still\n * wins, because it is applied as a later overlay in `applyModelsJson`.\n */\n\nexport type CopilotRoutingEnv = Readonly<Record<string, string | undefined>>;\n\nconst COPILOT_PROVIDER_ID = \"github-copilot\";\n/** Public routing hub: resolves the caller's plan-specific CAPI host server-side. */\nconst PUBLIC_COPILOT_HUB = \"https://api.githubcopilot.com\";\nconst ENTERPRISE_COPILOT_HOST = \"https://api.enterprise.githubcopilot.com\";\n\nfunction normalizeBaseUrl(value: string): string {\n\tconst trimmed = value.trim().replace(/\\/+$/u, \"\");\n\tif (!trimmed) return \"\";\n\treturn /^https?:\\/\\//u.test(trimmed) ? trimmed : `https://${trimmed}`;\n}\n\n/** `tid=...;exp=...;proxy-ep=proxy.business.githubcopilot.com;...` -> API host. */\nfunction baseUrlFromToken(token: string): string | undefined {\n\tconst match = token.match(/proxy-ep=([^;]+)/u);\n\tif (!match?.[1]) return undefined;\n\tconst host = match[1].trim().replace(/^proxy\\./u, \"api.\");\n\treturn host ? normalizeBaseUrl(host) : undefined;\n}\n\nfunction hostFromServerUrl(serverUrl: string): string | undefined {\n\ttry {\n\t\treturn new URL(normalizeBaseUrl(serverUrl)).hostname.toLowerCase() || undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nfunction baseUrlFromServerHost(host: string): string | undefined {\n\tif (host === \"github.com\" || host.endsWith(\".github.com\")) return undefined;\n\t// Tenant-scoped GHE.com: octocorp.ghe.com -> copilot-api.octocorp.ghe.com\n\tif (host.endsWith(\".ghe.com\")) {\n\t\tconst tenant = host.slice(0, -\".ghe.com\".length).split(\".\").pop();\n\t\treturn tenant ? `https://copilot-api.${tenant}.ghe.com` : ENTERPRISE_COPILOT_HOST;\n\t}\n\t// GitHub Enterprise Server on a self-hosted domain routes through the\n\t// enterprise CAPI host rather than a per-appliance Copilot endpoint.\n\treturn ENTERPRISE_COPILOT_HOST;\n}\n\n/**\n * Resolve the Copilot API base URL for env-token auth, highest precedence first:\n *\n * 1. `COPILOT_API_TARGET` / `GITHUB_COPILOT_BASE_URL` explicit override\n * 2. the `proxy-ep` segment embedded in `COPILOT_GITHUB_TOKEN`\n * 3. an explicit `enterpriseDomain`\n * 4. `GITHUB_SERVER_URL` (`*.ghe.com` tenant host, else the enterprise host)\n * 5. the public Copilot routing hub when `COPILOT_GITHUB_TOKEN` is set\n *\n * Returns `undefined` when nothing applies, leaving pi's individual-host default.\n */\nexport function resolveCopilotEnvBaseUrl(env: CopilotRoutingEnv, enterpriseDomain?: string): string | undefined {\n\tconst override = env.COPILOT_API_TARGET?.trim() || env.GITHUB_COPILOT_BASE_URL?.trim();\n\tif (override) return normalizeBaseUrl(override);\n\n\tconst token = env.COPILOT_GITHUB_TOKEN?.trim();\n\tif (token) {\n\t\tconst fromToken = baseUrlFromToken(token);\n\t\tif (fromToken) return fromToken;\n\t}\n\n\tif (enterpriseDomain?.trim()) return `https://copilot-api.${enterpriseDomain.trim()}`;\n\n\tconst serverUrl = env.GITHUB_SERVER_URL?.trim();\n\tif (serverUrl) {\n\t\tconst host = hostFromServerUrl(serverUrl);\n\t\tconst fromServer = host ? baseUrlFromServerHost(host) : undefined;\n\t\tif (fromServer) return fromServer;\n\t}\n\n\treturn token ? PUBLIC_COPILOT_HUB : undefined;\n}\n\nfunction withModelBaseUrl<TApi extends Api>(models: readonly Model<TApi>[], baseUrl: string): Model<TApi>[] {\n\treturn models.map((model) => ({ ...model, baseUrl }));\n}\n\n/**\n * Rewrite the builtin Copilot provider's host when `COPILOT_GITHUB_TOKEN` is set.\n *\n * Applied to the builtin layer so a `models.json` `baseUrl` override, which is\n * composed afterwards, still takes precedence. Providers without the env token\n * are returned untouched so OAuth logins keep pi's exact behavior.\n */\nexport function withCopilotEnvBaseUrl(provider: Provider, env: CopilotRoutingEnv): Provider {\n\tif (provider.id !== COPILOT_PROVIDER_ID || !env.COPILOT_GITHUB_TOKEN?.trim()) return provider;\n\tconst baseUrl = resolveCopilotEnvBaseUrl(env);\n\tif (!baseUrl || baseUrl === provider.baseUrl) return provider;\n\treturn {\n\t\t...provider,\n\t\tbaseUrl,\n\t\t// Wrap the getter so dynamically refreshed models are routed too.\n\t\tgetModels: () => withModelBaseUrl(provider.getModels(), baseUrl),\n\t};\n}\n"]}
1
+ {"version":3,"file":"github-copilot-env.d.ts","sourceRoot":"","sources":["../../src/providers/github-copilot-env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG7C;;;;;;;;;;;;GAYG;AAEH,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;AAyC7E;;;;;;;;;;GAUG;AACH,wBAAgB,w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GitHub Copilot host routing for `COPILOT_GITHUB_TOKEN` (PAT) auth.\n *\n * Upstream pi pins `github-copilot` to `https://api.individual.githubcopilot.com`\n * and only derives a per-tenant host inside the OAuth loader, which returns an\n * `auth.baseUrl` from the token's `proxy-ep` segment. `envApiKeyAuth` resolves\n * `COPILOT_GITHUB_TOKEN` without a base URL, so business/enterprise tokens are\n * sent to the individual CAPI host and GitHub answers `421 Misdirected Request`.\n *\n * This module restores the routing precedence for the env-token path only; the\n * OAuth path stays exactly upstream. A `models.json` provider `baseUrl` still\n * wins, because it is applied as a later overlay in `applyModelsJson`.\n */\n\nexport type CopilotRoutingEnv = Readonly<Record<string, string | undefined>>;\n\nconst COPILOT_PROVIDER_ID = \"github-copilot\";\n/** Public routing hub: resolves the caller's plan-specific CAPI host server-side. */\nconst PUBLIC_COPILOT_HUB = \"https://api.githubcopilot.com\";\nconst ENTERPRISE_COPILOT_HOST = \"https://api.enterprise.githubcopilot.com\";\n\nfunction normalizeBaseUrl(value: string): string {\n\tconst trimmed = value.trim().replace(/\\/+$/u, \"\");\n\tif (!trimmed) return \"\";\n\treturn /^https?:\\/\\//u.test(trimmed) ? trimmed : `https://${trimmed}`;\n}\n\n/** `tid=...;exp=...;proxy-ep=proxy.business.githubcopilot.com;...` -> API host. */\nfunction baseUrlFromToken(token: string): string | undefined {\n\tconst match = token.match(/proxy-ep=([^;]+)/u);\n\tif (!match?.[1]) return undefined;\n\tconst host = match[1].trim().replace(/^proxy\\./u, \"api.\");\n\treturn host ? normalizeBaseUrl(host) : undefined;\n}\n\nfunction hostFromServerUrl(serverUrl: string): string | undefined {\n\ttry {\n\t\treturn new URL(normalizeBaseUrl(serverUrl)).hostname.toLowerCase() || undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nfunction baseUrlFromServerHost(host: string): string | undefined {\n\tif (host === \"github.com\" || host.endsWith(\".github.com\")) return undefined;\n\t// Tenant-scoped GHE.com: octocorp.ghe.com -> copilot-api.octocorp.ghe.com\n\tif (host.endsWith(\".ghe.com\")) {\n\t\tconst tenant = host.slice(0, -\".ghe.com\".length).split(\".\").pop();\n\t\treturn tenant ? `https://copilot-api.${tenant}.ghe.com` : ENTERPRISE_COPILOT_HOST;\n\t}\n\t// GitHub Enterprise Server on a self-hosted domain routes through the\n\t// enterprise CAPI host rather than a per-appliance Copilot endpoint.\n\treturn ENTERPRISE_COPILOT_HOST;\n}\n\n/**\n * Resolve the Copilot API base URL for env-token auth, highest precedence first:\n *\n * 1. `COPILOT_API_TARGET` / `GITHUB_COPILOT_BASE_URL` explicit override\n * 2. the `proxy-ep` segment embedded in `COPILOT_GITHUB_TOKEN`\n * 3. an explicit `enterpriseDomain`\n * 4. `GITHUB_SERVER_URL` (`*.ghe.com` tenant host, else the enterprise host)\n * 5. the public Copilot routing hub when `COPILOT_GITHUB_TOKEN` is set\n *\n * Returns `undefined` when nothing applies, leaving pi's individual-host default.\n */\nexport function resolveCopilotEnvBaseUrl(env: CopilotRoutingEnv, enterpriseDomain?: string): string | undefined {\n\tconst override = env.COPILOT_API_TARGET?.trim() || env.GITHUB_COPILOT_BASE_URL?.trim();\n\tif (override) return normalizeBaseUrl(override);\n\n\tconst token = env.COPILOT_GITHUB_TOKEN?.trim();\n\tif (token) {\n\t\tconst fromToken = baseUrlFromToken(token);\n\t\tif (fromToken) return fromToken;\n\t}\n\n\tif (enterpriseDomain?.trim()) return `https://copilot-api.${enterpriseDomain.trim()}`;\n\n\tconst serverUrl = env.GITHUB_SERVER_URL?.trim();\n\tif (serverUrl) {\n\t\tconst host = hostFromServerUrl(serverUrl);\n\t\tconst fromServer = host ? baseUrlFromServerHost(host) : undefined;\n\t\tif (fromServer) return fromServer;\n\t}\n\n\treturn token ? PUBLIC_COPILOT_HUB : undefined;\n}\n\nfunction withModelBaseUrl<TApi extends Api>(models: readonly Model<TApi>[], baseUrl: string): Model<TApi>[] {\n\treturn models.map((model) => ({ ...model, baseUrl }));\n}\n\n/**\n * Rewrite the builtin Copilot provider's host when `COPILOT_GITHUB_TOKEN` is set.\n *\n * Applied to the builtin layer so a `models.json` `baseUrl` override, which is\n * composed afterwards, still takes precedence. Providers without the env token\n * are returned untouched so OAuth logins keep pi's exact behavior.\n */\nexport function withCopilotEnvBaseUrl(provider: Provider, env: CopilotRoutingEnv): Provider {\n\tif (provider.id !== COPILOT_PROVIDER_ID || !env.COPILOT_GITHUB_TOKEN?.trim()) return provider;\n\tconst baseUrl = resolveCopilotEnvBaseUrl(env);\n\tif (!baseUrl || baseUrl === provider.baseUrl) return provider;\n\treturn {\n\t\t...provider,\n\t\tbaseUrl,\n\t\t// Wrap the getter so dynamically refreshed models are routed too.\n\t\tgetModels: () => withModelBaseUrl(provider.getModels(), baseUrl),\n\t};\n}\n"]}
1
+ {"version":3,"file":"github-copilot-env.js","sourceRoot":"","sources":["../../src/providers/github-copilot-env.ts"],"names":[],"mappings":"AAmBA,MAAM,mBAAmB,GAAG,gBAAgB,CAAC;AAC7C,qFAAqF;AACrF,MAAM,kBAAkB,GAAG,+BAA+B,CAAC;AAC3D,MAAM,uBAAuB,GAAG,0CAA0C,CAAC;AAE3E,SAAS,gBAAgB,CAAC,KAAa;IACtC,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAClD,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IACxB,OAAO,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,OAAO,EAAE,CAAC;AACvE,CAAC;AAED,mFAAmF;AACnF,SAAS,gBAAgB,CAAC,KAAa;IACtC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAC/C,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAAE,OAAO,SAAS,CAAC;IAClC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI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AClE,SAAS,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,QAAQ,CAAC,SAAS,EAAE,EAAE,OAAO,CAAC;KAChE,CAAC;AACH,CAAC","sourcesContent":["import type { Provider } from \"../models.ts\";\nimport type { Api, Model } from \"../types.ts\";\n\n/**\n * GitHub Copilot host routing for `COPILOT_GITHUB_TOKEN` (PAT) auth.\n *\n * Upstream pi pins `github-copilot` to `https://api.individual.githubcopilot.com`\n * and only derives a per-tenant host inside the OAuth loader, which returns an\n * `auth.baseUrl` from the token's `proxy-ep` segment. `envApiKeyAuth` resolves\n * `COPILOT_GITHUB_TOKEN` without a base URL, so business/enterprise tokens are\n * sent to the individual CAPI host and GitHub answers `421 Misdirected Request`.\n *\n * This module restores the routing precedence for the env-token path only; the\n * OAuth path stays exactly upstream. A `models.json` provider `baseUrl` still\n * wins, because it is applied as a later overlay in `applyModelsJson`.\n */\n\nexport type CopilotRoutingEnv = Readonly<Record<string, string | undefined>>;\n\nconst COPILOT_PROVIDER_ID = \"github-copilot\";\n/** Public routing hub: resolves the caller's plan-specific CAPI host server-side. */\nconst PUBLIC_COPILOT_HUB = \"https://api.githubcopilot.com\";\nconst ENTERPRISE_COPILOT_HOST = \"https://api.enterprise.githubcopilot.com\";\n\nfunction normalizeBaseUrl(value: string): string {\n\tconst trimmed = value.trim().replace(/\\/+$/u, \"\");\n\tif (!trimmed) return \"\";\n\treturn /^https?:\\/\\//u.test(trimmed) ? trimmed : `https://${trimmed}`;\n}\n\n/** `tid=...;exp=...;proxy-ep=proxy.business.githubcopilot.com;...` -> API host. */\nfunction baseUrlFromToken(token: string): string | undefined {\n\tconst match = token.match(/proxy-ep=([^;]+)/u);\n\tif (!match?.[1]) return undefined;\n\tconst host = match[1].trim().replace(/^proxy\\./u, \"api.\");\n\treturn host ? normalizeBaseUrl(host) : undefined;\n}\n\nfunction hostFromServerUrl(serverUrl: string): string | undefined {\n\ttry {\n\t\treturn new URL(normalizeBaseUrl(serverUrl)).hostname.toLowerCase() || undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nfunction baseUrlFromServerHost(host: string): string | undefined {\n\tif (host === \"github.com\" || host.endsWith(\".github.com\")) return undefined;\n\t// Tenant-scoped GHE.com: octocorp.ghe.com -> copilot-api.octocorp.ghe.com\n\tif (host.endsWith(\".ghe.com\")) {\n\t\tconst tenant = host.slice(0, -\".ghe.com\".length).split(\".\").pop();\n\t\treturn tenant ? `https://copilot-api.${tenant}.ghe.com` : ENTERPRISE_COPILOT_HOST;\n\t}\n\t// GitHub Enterprise Server on a self-hosted domain routes through the\n\t// enterprise CAPI host rather than a per-appliance Copilot endpoint.\n\treturn ENTERPRISE_COPILOT_HOST;\n}\n\n/**\n * Resolve the Copilot API base URL for env-token auth, highest precedence first:\n *\n * 1. `COPILOT_API_TARGET` / `GITHUB_COPILOT_BASE_URL` explicit override\n * 2. the `proxy-ep` segment embedded in `COPILOT_GITHUB_TOKEN`\n * 3. an explicit `enterpriseDomain`\n * 4. `GITHUB_SERVER_URL` (`*.ghe.com` tenant host, else the enterprise host)\n * 5. the public Copilot routing hub when `COPILOT_GITHUB_TOKEN` is set\n *\n * Returns `undefined` when nothing applies, leaving pi's individual-host default.\n */\nexport function resolveCopilotEnvBaseUrl(env: CopilotRoutingEnv, enterpriseDomain?: string): string | undefined {\n\tconst override = env.COPILOT_API_TARGET?.trim() || env.GITHUB_COPILOT_BASE_URL?.trim();\n\tif (override) return normalizeBaseUrl(override);\n\n\tconst token = env.COPILOT_GITHUB_TOKEN?.trim();\n\tif (token) {\n\t\tconst fromToken = baseUrlFromToken(token);\n\t\tif (fromToken) return fromToken;\n\t}\n\n\tif (enterpriseDomain?.trim()) return `https://copilot-api.${enterpriseDomain.trim()}`;\n\n\tconst serverUrl = env.GITHUB_SERVER_URL?.trim();\n\tif (serverUrl) {\n\t\tconst host = hostFromServerUrl(serverUrl);\n\t\tconst fromServer = host ? baseUrlFromServerHost(host) : undefined;\n\t\tif (fromServer) return fromServer;\n\t}\n\n\treturn token ? PUBLIC_COPILOT_HUB : undefined;\n}\n\nfunction withModelBaseUrl<TApi extends Api>(models: readonly Model<TApi>[], baseUrl: string): Model<TApi>[] {\n\treturn models.map((model) => ({ ...model, baseUrl }));\n}\n\n/**\n * Rewrite the builtin Copilot provider's host when `COPILOT_GITHUB_TOKEN` is set.\n *\n * Applied to the builtin layer so a `models.json` `baseUrl` override, which is\n * composed afterwards, still takes precedence. Providers without the env token\n * are returned untouched so OAuth logins keep pi's exact behavior.\n */\nexport function withCopilotEnvBaseUrl(provider: Provider, env: CopilotRoutingEnv): Provider {\n\tif (provider.id !== COPILOT_PROVIDER_ID || !env.COPILOT_GITHUB_TOKEN?.trim()) return provider;\n\tconst baseUrl = resolveCopilotEnvBaseUrl(env);\n\tif (!baseUrl || baseUrl === provider.baseUrl) return provider;\n\treturn {\n\t\t...provider,\n\t\tbaseUrl,\n\t\t// Wrap the getter so dynamically refreshed models are routed too.\n\t\tgetModels: () => withModelBaseUrl(provider.getModels(), baseUrl),\n\t};\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"github-copilot.d.ts","sourceRoot":"","sources":["../../src/providers/github-copilot.ts"],"names":[],"mappings":"AAKA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAS7D,wBAAgB,qBAAqB,IAAI,QAAQ,CAAC,oBAAoB,GAAG,oBAAoB,GAAG,kBAAkB,CAAC,CA4BlH","sourcesContent":["import { anthropicMessagesApi } from \"../api/anthropic-messages.lazy.ts\";\nimport { openAICompletionsApi } from \"../api/openai-completions.lazy.ts\";\nimport { openAIResponsesApi } from \"../api/openai-responses.lazy.ts\";\nimport { envApiKeyAuth, lazyOAuth } from \"../auth/helpers.ts\";\nimport { loadGitHubCopilotOAuth } from \"../auth/oauth/load.ts\";\nimport { createProvider, type Provider } from \"../models.ts\";\nimport { GITHUB_COPILOT_MODELS } from \"./github-copilot.models.ts\";\n\n/** Copilot advertises entitlements as string ID arrays on the OAuth credential; ignore any other shape. */\nfunction advertisedModelIds(value: unknown): ReadonlySet<string> | undefined {\n\tif (!Array.isArray(value) || !value.every((entry) => typeof entry === \"string\")) return undefined;\n\treturn new Set(value);\n}\n\nexport function githubCopilotProvider(): Provider<\"anthropic-messages\" | \"openai-completions\" | \"openai-responses\"> {\n\treturn createProvider({\n\t\tid: \"github-copilot\",\n\t\tname: \"GitHub Copilot\",\n\t\tbaseUrl: \"https://api.individual.githubcopilot.com\",\n\t\tauth: {\n\t\t\tapiKey: envApiKeyAuth(\"GitHub Copilot token\", [\"COPILOT_GITHUB_TOKEN\"]),\n\t\t\toauth: lazyOAuth({ name: \"GitHub Copilot\", isSubscription: true, load: loadGitHubCopilotOAuth }),\n\t\t},\n\t\tmodels: Object.values(GITHUB_COPILOT_MODELS),\n\t\tfilterModels: (models, credential) => {\n\t\t\tconst oauth = credential?.type === \"oauth\" ? credential : undefined;\n\t\t\tconst entitledFastModelIds = advertisedModelIds(oauth?.fastModelIds);\n\t\t\tconst availableModelIds = advertisedModelIds(oauth?.availableModelIds);\n\t\t\treturn models.filter((model) => {\n\t\t\t\t// Fast siblings are advertised per account, so expose only the exact IDs this credential\n\t\t\t\t// entitles. Fast-ness comes from the explicit route metadata, never from the `-fast` suffix:\n\t\t\t\t// a Copilot-owned model that merely ends in `-fast` is an ordinary picker model.\n\t\t\t\tif (model.fastRoute !== undefined) return entitledFastModelIds?.has(model.id) === true;\n\t\t\t\treturn availableModelIds?.has(model.id) ?? true;\n\t\t\t});\n\t\t},\n\t\tapi: {\n\t\t\t\"anthropic-messages\": anthropicMessagesApi(),\n\t\t\t\"openai-completions\": openAICompletionsApi(),\n\t\t\t\"openai-responses\": openAIResponsesApi(),\n\t\t},\n\t});\n}\n"]}
1
+ {"version":3,"file":"github-copilot.d.ts","sourceRoot":"","sources":["../../src/providers/github-copilot.ts"],"names":[],"mappings":"AAKA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAS7D,wBAAgB,qBAAqB,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B,CAAC;QAC5C,YAAY,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,CAAC;YACrC,MAAM,KAAK,GAAG,UAAU,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;YACpE,MAAM,oBAAoB,GAAG,kBAAkB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;YACrE,MAAM,iBAAiB,GAAG,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;YACvE,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC;gBAC/B,yFAAyF;gBACzF,6FAA6F;gBAC7F,iFAAiF;gBACjF,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS;oBAAE,OAAO,oBAAoB,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC;gBACvF,OAAO,iBAAiB,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC;YAAA,CAChD,CAAC,CAAC;QAAA,CACH;QACD,GAAG,EAAE;YACJ,oBAAoB,EAAE,oBAAoB,EAAE;YAC5C,oBAAoB,EAAE,oBAAoB,EAAE;YAC5C,kBAAkB,EAAE,kBAAkB,EAAE;SACxC;KACD,CAAC,CAAC;AAAA,CACH","sourcesContent":["import { anthropicMessagesApi } from \"../api/anthropic-messages.lazy.ts\";\nimport { openAICompletionsApi } from \"../api/openai-completions.lazy.ts\";\nimport { openAIResponsesApi } from \"../api/openai-responses.lazy.ts\";\nimport { envApiKeyAuth, lazyOAuth } from \"../auth/helpers.ts\";\nimport { loadGitHubCopilotOAuth } from \"../auth/oauth/load.ts\";\nimport { createProvider, type Provider } from \"../models.ts\";\nimport { GITHUB_COPILOT_MODELS } from \"./github-copilot.models.ts\";\n\n/** Copilot advertises entitlements as string ID arrays on the OAuth credential; ignore any other shape. */\nfunction advertisedModelIds(value: unknown): ReadonlySet<string> | undefined {\n\tif (!Array.isArray(value) || !value.every((entry) => typeof entry === \"string\")) return undefined;\n\treturn new Set(value);\n}\n\nexport function githubCopilotProvider(): Provider<\"anthropic-messages\" | \"openai-completions\" | \"openai-responses\"> {\n\treturn createProvider({\n\t\tid: \"github-copilot\",\n\t\tname: \"GitHub Copilot\",\n\t\tbaseUrl: \"https://api.individual.githubcopilot.com\",\n\t\tauth: {\n\t\t\tapiKey: envApiKeyAuth(\"GitHub Copilot token\", [\"COPILOT_GITHUB_TOKEN\"]),\n\t\t\toauth: lazyOAuth({ name: \"GitHub Copilot\", isSubscription: true, load: loadGitHubCopilotOAuth }),\n\t\t},\n\t\tmodels: Object.values(GITHUB_COPILOT_MODELS),\n\t\tfilterModels: (models, credential) => {\n\t\t\tconst oauth = credential?.type === \"oauth\" ? credential : undefined;\n\t\t\tconst entitledFastModelIds = advertisedModelIds(oauth?.fastModelIds);\n\t\t\tconst availableModelIds = advertisedModelIds(oauth?.availableModelIds);\n\t\t\treturn models.filter((model) => {\n\t\t\t\t// Fast siblings are advertised per account, so expose only the exact IDs this credential\n\t\t\t\t// entitles. Fast-ness comes from the explicit route metadata, never from the `-fast` suffix:\n\t\t\t\t// a Copilot-owned model that merely ends in `-fast` is an ordinary picker model.\n\t\t\t\tif (model.fastRoute !== undefined) return entitledFastModelIds?.has(model.id) === true;\n\t\t\t\treturn availableModelIds?.has(model.id) ?? true;\n\t\t\t});\n\t\t},\n\t\tapi: {\n\t\t\t\"anthropic-messages\": anthropicMessagesApi(),\n\t\t\t\"openai-completions\": openAICompletionsApi(),\n\t\t\t\"openai-responses\": openAIResponsesApi(),\n\t\t},\n\t});\n}\n"]}
1
+ {"version":3,"file":"github-copilot.js","sourceRoot":"","sources":["../../src/providers/github-copilot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,kBAAkB,E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AAC;YACvE,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;gBAC9B,yFAAyF;gBACzF,6FAA6F;gBAC7F,iFAAiF;gBACjF,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS;oBAAE,OAAO,oBAAoB,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC;gBACvF,OAAO,iBAAiB,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC;YACjD,CAAC,CAAC,CAAC;QACJ,CAAC;QACD,GAAG,EAAE;YACJ,oBAAoB,EAAE,oBAAoB,EAAE;YAC5C,oBAAoB,EAAE,oBAAoB,EAAE;YAC5C,kBAAkB,EAAE,kBAAkB,EAAE;SACxC;KACD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { anthropicMessagesApi } from \"../api/anthropic-messages.lazy.ts\";\nimport { openAICompletionsApi } from \"../api/openai-completions.lazy.ts\";\nimport { openAIResponsesApi } from \"../api/openai-responses.lazy.ts\";\nimport { envApiKeyAuth, lazyOAuth } from \"../auth/helpers.ts\";\nimport { loadGitHubCopilotOAuth } from \"../auth/oauth/load.ts\";\nimport { createProvider, type Provider } from \"../models.ts\";\nimport { GITHUB_COPILOT_MODELS } from \"./github-copilot.models.ts\";\n\n/** Copilot advertises entitlements as string ID arrays on the OAuth credential; ignore any other shape. */\nfunction advertisedModelIds(value: unknown): ReadonlySet<string> | undefined {\n\tif (!Array.isArray(value) || !value.every((entry) => typeof entry === \"string\")) return undefined;\n\treturn new Set(value);\n}\n\nexport function githubCopilotProvider(): Provider<\"anthropic-messages\" | \"openai-completions\" | \"openai-responses\"> {\n\treturn createProvider({\n\t\tid: \"github-copilot\",\n\t\tname: \"GitHub Copilot\",\n\t\tbaseUrl: \"https://api.individual.githubcopilot.com\",\n\t\tauth: {\n\t\t\tapiKey: envApiKeyAuth(\"GitHub Copilot token\", [\"COPILOT_GITHUB_TOKEN\"]),\n\t\t\toauth: lazyOAuth({ name: \"GitHub Copilot\", isSubscription: true, load: loadGitHubCopilotOAuth }),\n\t\t},\n\t\tmodels: Object.values(GITHUB_COPILOT_MODELS),\n\t\tfilterModels: (models, credential) => {\n\t\t\tconst oauth = credential?.type === \"oauth\" ? credential : undefined;\n\t\t\tconst entitledFastModelIds = advertisedModelIds(oauth?.fastModelIds);\n\t\t\tconst availableModelIds = advertisedModelIds(oauth?.availableModelIds);\n\t\t\treturn models.filter((model) => {\n\t\t\t\t// Fast siblings are advertised per account, so expose only the exact IDs this credential\n\t\t\t\t// entitles. Fast-ness comes from the explicit route metadata, never from the `-fast` suffix:\n\t\t\t\t// a Copilot-owned model that merely ends in `-fast` is an ordinary picker model.\n\t\t\t\tif (model.fastRoute !== undefined) return entitledFastModelIds?.has(model.id) === true;\n\t\t\t\treturn availableModelIds?.has(model.id) ?? true;\n\t\t\t});\n\t\t},\n\t\tapi: {\n\t\t\t\"anthropic-messages\": anthropicMessagesApi(),\n\t\t\t\"openai-completions\": openAICompletionsApi(),\n\t\t\t\"openai-responses\": openAIResponsesApi(),\n\t\t},\n\t});\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"github-copilot.models.d.ts","sourceRoot":"","sources":["../../src/providers/github-copilot.models.ts"],"names":[],"mappings":"AAIA,OAAO,EAAoF,KAAK,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAEnM,eAAO,MAAM,qBAAqB,EAAE,gBAAgB,CAAC,cAAc,4BAA4B,EAAU,UAAE,IAAI,EAAE,MAAM,IAAE,CAAG,EAAE,gBAAgB,CAC5F,CAAC;AAEnD,eAAO,MAAM,2BAA2B,EAAE,iBAAiB,CAAC,cAAc,4BAA4B,EAAU,UAAE,IAAI,EAAE,MAAM,IAAE,CAAG,EAAE,gBAAgB,CAClG,CAAC;AAEpD,eAAO,MAAM,gCAAgC,EAAE,sBAAsB,CAAC,cAAc,4BAA4B,EAAU,UAAE,IAAI,EAAE,MAAM,IAAE,CAAG,EAAE,gBAAgB,CACvG,CAAC","sourcesContent":["// This file is auto-generated by scripts/generate-models.ts\n// Do not edit manually - run 'npm run generate-models' to update\n\nimport values from \"./data/github-copilot.json\" with { type: \"json\" };\nimport { flattenChatModelCatalog, flattenImageModelCatalog, flattenClassifierModelCatalog, type ChatModelCatalog, type ImageModelCatalog, type ClassifierModelCatalog } from \"../model-catalog.ts\";\n\nexport const GITHUB_COPILOT_MODELS: ChatModelCatalog<typeof import(\"./data/github-copilot.json\", { with: { type: \"json\" } }), \"github-copilot\"> =\n\tflattenChatModelCatalog(\"github-copilot\", values);\n\nexport const GITHUB_COPILOT_IMAGE_MODELS: ImageModelCatalog<typeof import(\"./data/github-copilot.json\", { with: { type: \"json\" } }), \"github-copilot\"> =\n\tflattenImageModelCatalog(\"github-copilot\", values);\n\nexport const GITHUB_COPILOT_CLASSIFIER_MODELS: ClassifierModelCatalog<typeof import(\"./data/github-copilot.json\", { with: { type: \"json\" } }), \"github-copilot\"> =\n\tflattenClassifierModelCatalog(\"github-copilot\", values);\n"]}
1
+ {"version":3,"file":"github-copilot.models.d.ts","sourceRoot":"","sources":["../../src/providers/github-copilot.models.ts"],"names":[],"mappings":"AAIA,OAAO,EAAoF,KAAK,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAEnM,eAAO,MAAM,qBAAqB,EAAE,gBAAgB,CAAC,cAAc,4BAA4B,EAAU,UAAE,IAAI,EAAE,MAAM,IAAE,CAAG,EAAE,gBAAgB,CAC5F,CAAC;AAEnD,eAAO,MAAM,2BAA2B,EAAE,iBAAiB,CAAC,cAAc,4BAA4B,EAAU,UAAE,IAAI,EAAE,MAAM,IAAE,CAAG,EAAE,gBAAgB,CAClG,CAAC;AAEpD,eAAO,MAAM,gCAAgC,EAAE,sBAAsB,CAAC,cAAc,4BAA4B,EAAU,UAAE,IAAI,EAAE,MAAM,IAAE,CAAG,EAAE,gBAAgB,CACvG,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"google-vertex.d.ts","sourceRoot":"","sources":["../../src/providers/google-vertex.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAyF7D,wBAAgB,oBAAoB,IAAI,QAAQ,CAAC,eAAe,CAAC,CAQhE","sourcesContent":["import { googleVertexApi } from \"../api/google-vertex.lazy.ts\";\nimport type { ApiKeyAuth } from \"../auth/types.ts\";\nimport { createProvider, type Provider } from \"../models.ts\";\nimport { GOOGLE_VERTEX_MODELS } from \"./google-vertex.models.ts\";\n\nconst VERTEX_ADC_PATH = \"~/.config/gcloud/application_default_credentials.json\";\n\n/**\n * Vertex accepts an explicit API key or Application Default Credentials\n * (`gcloud auth application-default login`). ADC additionally requires\n * project and location env vars, which the implementation reads itself.\n */\nconst vertexAuth: ApiKeyAuth = {\n\tname: \"Google Cloud credentials\",\n\tlogin: async (interaction) => {\n\t\tinteraction.signal.throwIfAborted();\n\t\tconst method = await interaction.prompt({\n\t\t\ttype: \"select\",\n\t\t\tmessage: \"Select Google Vertex AI authentication method:\",\n\t\t\toptions: [\n\t\t\t\t{ id: \"api-key\", label: \"Google Cloud API key\" },\n\t\t\t\t{ id: \"adc\", label: \"Application Default Credentials\" },\n\t\t\t\t{ id: \"service-account\", label: \"Service account credentials file\" },\n\t\t\t],\n\t\t});\n\t\tinteraction.signal.throwIfAborted();\n\t\tif (method === \"api-key\") {\n\t\t\treturn {\n\t\t\t\ttype: \"api_key\",\n\t\t\t\tkey: await interaction.prompt({ type: \"secret\", message: \"Enter Google Cloud API key\" }),\n\t\t\t};\n\t\t}\n\t\tif (method !== \"adc\" && method !== \"service-account\") {\n\t\t\tthrow new Error(`Unknown Google Vertex AI auth method: ${method}`);\n\t\t}\n\t\tinteraction.notify({\n\t\t\ttype: \"info\",\n\t\t\tmessage:\n\t\t\t\tmethod === \"adc\"\n\t\t\t\t\t? \"Run `gcloud auth application-default login`, then provide the project and location.\"\n\t\t\t\t\t: \"Provide a service account credentials file, project, and location.\",\n\t\t\tlinks: [\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Application Default Credentials\",\n\t\t\t\t\turl: \"https://cloud.google.com/docs/authentication/provide-credentials-adc\",\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\t\tconst project = await interaction.prompt({ type: \"text\", message: \"Enter Google Cloud project ID\" });\n\t\tconst location = await interaction.prompt({ type: \"text\", message: \"Enter Google Cloud location\" });\n\t\tconst credentialsPath =\n\t\t\tmethod === \"service-account\"\n\t\t\t\t? await interaction.prompt({ type: \"text\", message: \"Enter service account credentials file path\" })\n\t\t\t\t: undefined;\n\t\treturn {\n\t\t\ttype: \"api_key\",\n\t\t\tenv: {\n\t\t\t\tGOOGLE_CLOUD_PROJECT: project,\n\t\t\t\tGOOGLE_CLOUD_LOCATION: location,\n\t\t\t\t...(credentialsPath ? { GOOGLE_APPLICATION_CREDENTIALS: credentialsPath } : {}),\n\t\t\t},\n\t\t};\n\t},\n\tresolve: async ({ ctx, credential, signal }) => {\n\t\tconst env = async (name: string) => {\n\t\t\tsignal.throwIfAborted();\n\t\t\tconst value = await ctx.env(name);\n\t\t\tsignal.throwIfAborted();\n\t\t\treturn value;\n\t\t};\n\t\tconst key = credential?.key ?? (await env(\"GOOGLE_CLOUD_API_KEY\"));\n\t\tif (key) return { auth: { apiKey: key }, source: credential?.key ? \"stored credential\" : \"GOOGLE_CLOUD_API_KEY\" };\n\n\t\tconst adcPath = credential?.env?.GOOGLE_APPLICATION_CREDENTIALS ?? (await env(\"GOOGLE_APPLICATION_CREDENTIALS\"));\n\t\tsignal.throwIfAborted();\n\t\tconst hasCredentials = await ctx.fileExists(adcPath ?? VERTEX_ADC_PATH);\n\t\tsignal.throwIfAborted();\n\t\tconst project =\n\t\t\tcredential?.env?.GOOGLE_CLOUD_PROJECT ?? (await env(\"GOOGLE_CLOUD_PROJECT\")) ?? (await env(\"GCLOUD_PROJECT\"));\n\t\tconst location = credential?.env?.GOOGLE_CLOUD_LOCATION ?? (await env(\"GOOGLE_CLOUD_LOCATION\"));\n\t\tif (hasCredentials && project && location) {\n\t\t\treturn {\n\t\t\t\tauth: {},\n\t\t\t\tenv: credential?.env,\n\t\t\t\tsource: credential ? \"stored credential\" : \"gcloud application default credentials\",\n\t\t\t};\n\t\t}\n\t\treturn undefined;\n\t},\n};\n\nexport function googleVertexProvider(): Provider<\"google-vertex\"> {\n\treturn createProvider({\n\t\tid: \"google-vertex\",\n\t\tname: \"Google Vertex AI\",\n\t\tauth: { apiKey: vertexAuth },\n\t\tmodels: Object.values(GOOGLE_VERTEX_MODELS),\n\t\tapi: googleVertexApi(),\n\t});\n}\n"]}
1
+ {"version":3,"file":"google-vertex.d.ts","sourceRoot":"","sources":["../../src/providers/google-vertex.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAyF7D,wBAAgB,oBAAoB,IAAI,QAAQ,CAAC,eAAe,CAAC,CAQhE"}
@@ -1 +1 @@
1
- {"version":3,"file":"google-vertex.js","sourceRoot":"","sources":["../../src/providers/google-vertex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,EAAE,cAAc,EAAiB,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,MAAM,eAAe,GAAG,uDAAuD,CAAC;AAEhF;;;;GAIG;AACH,MAAM,UAAU,GAAe;IAC9B,IAAI,EAAE,0BAA0B;IAChC,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,CAAC;QAC7B,WAAW,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;QACpC,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,MAAM,CAAC;YACvC,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,gDAAgD;YACzD,OAA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,EAAE,GAAG,EAAE,oBAAoB,IAAI,CAAC,MAAM,GAAG,CAAC,sBAAsB,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC;QAC/G,MAAM,QAAQ,GAAG,UAAU,EAAE,GAAG,EAAE,qBAAqB,IAAI,CAAC,MAAM,GAAG,CAAC,uBAAuB,CAAC,CAAC,CAAC;QAChG,IAAI,cAAc,IAAI,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC3C,OAAO;gBACN,IAAI,EAAE,EAAE;gBACR,GAAG,EAAE,UAAU,EAAE,GAAG;gBACpB,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,wCAAwC;aACnF,CAAC;QACH,CAAC;QACD,OAAO,SAAS,CAAC;IAAA,CACjB;CACD,CAAC;AAEF,MAAM,UAAU,oBAAoB,GAA8B;IACjE,OAAO,cAAc,CAAC;QACrB,EAAE,EAAE,eAAe;QACnB,IAAI,EAAE,kBAAkB;QACxB,IAAI,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE;QAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC;QAC3C,GAAG,EAAE,eAAe,EAAE;KACtB,CAAC,CAAC;AAAA,CACH","sourcesContent":["import { googleVertexApi } from \"../api/google-vertex.lazy.ts\";\nimport type { ApiKeyAuth } from \"../auth/types.ts\";\nimport { createProvider, type Provider } from \"../models.ts\";\nimport { GOOGLE_VERTEX_MODELS } from \"./google-vertex.models.ts\";\n\nconst VERTEX_ADC_PATH = \"~/.config/gcloud/application_default_credentials.json\";\n\n/**\n * Vertex accepts an explicit API key or Application Default Credentials\n * (`gcloud auth application-default login`). ADC additionally requires\n * project and location env vars, which the implementation reads itself.\n */\nconst vertexAuth: ApiKeyAuth = {\n\tname: \"Google Cloud credentials\",\n\tlogin: async (interaction) => {\n\t\tinteraction.signal.throwIfAborted();\n\t\tconst method = await interaction.prompt({\n\t\t\ttype: \"select\",\n\t\t\tmessage: \"Select Google Vertex AI authentication method:\",\n\t\t\toptions: [\n\t\t\t\t{ id: \"api-key\", label: \"Google Cloud API key\" },\n\t\t\t\t{ id: \"adc\", label: \"Application Default Credentials\" },\n\t\t\t\t{ id: \"service-account\", label: \"Service account credentials file\" },\n\t\t\t],\n\t\t});\n\t\tinteraction.signal.throwIfAborted();\n\t\tif (method === \"api-key\") {\n\t\t\treturn {\n\t\t\t\ttype: \"api_key\",\n\t\t\t\tkey: await interaction.prompt({ type: \"secret\", message: \"Enter Google Cloud API key\" }),\n\t\t\t};\n\t\t}\n\t\tif (method !== \"adc\" && method !== \"service-account\") {\n\t\t\tthrow new Error(`Unknown Google Vertex AI auth method: ${method}`);\n\t\t}\n\t\tinteraction.notify({\n\t\t\ttype: \"info\",\n\t\t\tmessage:\n\t\t\t\tmethod === \"adc\"\n\t\t\t\t\t? \"Run `gcloud auth application-default login`, then provide the project and location.\"\n\t\t\t\t\t: \"Provide a service account credentials file, project, and location.\",\n\t\t\tlinks: [\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Application Default Credentials\",\n\t\t\t\t\turl: \"https://cloud.google.com/docs/authentication/provide-credentials-adc\",\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\t\tconst project = await interaction.prompt({ type: \"text\", message: \"Enter Google Cloud project ID\" });\n\t\tconst location = await interaction.prompt({ type: \"text\", message: \"Enter Google Cloud location\" });\n\t\tconst credentialsPath =\n\t\t\tmethod === \"service-account\"\n\t\t\t\t? await interaction.prompt({ type: \"text\", message: \"Enter service account credentials file path\" })\n\t\t\t\t: undefined;\n\t\treturn {\n\t\t\ttype: \"api_key\",\n\t\t\tenv: {\n\t\t\t\tGOOGLE_CLOUD_PROJECT: project,\n\t\t\t\tGOOGLE_CLOUD_LOCATION: location,\n\t\t\t\t...(credentialsPath ? { GOOGLE_APPLICATION_CREDENTIALS: credentialsPath } : {}),\n\t\t\t},\n\t\t};\n\t},\n\tresolve: async ({ ctx, credential, signal }) => {\n\t\tconst env = async (name: string) => {\n\t\t\tsignal.throwIfAborted();\n\t\t\tconst value = await ctx.env(name);\n\t\t\tsignal.throwIfAborted();\n\t\t\treturn value;\n\t\t};\n\t\tconst key = credential?.key ?? (await env(\"GOOGLE_CLOUD_API_KEY\"));\n\t\tif (key) return { auth: { apiKey: key }, source: credential?.key ? \"stored credential\" : \"GOOGLE_CLOUD_API_KEY\" };\n\n\t\tconst adcPath = credential?.env?.GOOGLE_APPLICATION_CREDENTIALS ?? (await env(\"GOOGLE_APPLICATION_CREDENTIALS\"));\n\t\tsignal.throwIfAborted();\n\t\tconst hasCredentials = await ctx.fileExists(adcPath ?? VERTEX_ADC_PATH);\n\t\tsignal.throwIfAborted();\n\t\tconst project =\n\t\t\tcredential?.env?.GOOGLE_CLOUD_PROJECT ?? (await env(\"GOOGLE_CLOUD_PROJECT\")) ?? (await env(\"GCLOUD_PROJECT\"));\n\t\tconst location = credential?.env?.GOOGLE_CLOUD_LOCATION ?? (await env(\"GOOGLE_CLOUD_LOCATION\"));\n\t\tif (hasCredentials && project && location) {\n\t\t\treturn {\n\t\t\t\tauth: {},\n\t\t\t\tenv: credential?.env,\n\t\t\t\tsource: credential ? \"stored credential\" : \"gcloud application default credentials\",\n\t\t\t};\n\t\t}\n\t\treturn undefined;\n\t},\n};\n\nexport function googleVertexProvider(): Provider<\"google-vertex\"> {\n\treturn createProvider({\n\t\tid: \"google-vertex\",\n\t\tname: \"Google Vertex AI\",\n\t\tauth: { apiKey: vertexAuth },\n\t\tmodels: Object.values(GOOGLE_VERTEX_MODELS),\n\t\tapi: googleVertexApi(),\n\t});\n}\n"]}
1
+ {"version":3,"file":"google-vertex.js","sourceRoot":"","sources":["../../src/providers/google-vertex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,EAAE,cAAc,EAAiB,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2B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sBAAsB,EAAE,CAAC;QAElH,MAAM,OAAO,GAAG,UAAU,EAAE,GAAG,EAAE,8BAA8B,IAAI,CAAC,MAAM,GAAG,CAAC,gCAAgC,CAAC,CAAC,CAAC;QACjH,MAAM,CAAC,cAAc,EAAE,CAAC;QACxB,MAAM,cAAc,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC,OAAO,IAAI,eAAe,CAAC,CAAC;QACxE,MAAM,CAAC,cAAc,EAAE,CAAC;QACxB,MAAM,OAAO,GACZ,UAAU,EAAE,GAAG,EAAE,oBAAoB,IAAI,CAAC,MAAM,GAAG,CAAC,sBAAsB,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC;QAC/G,MAAM,QAAQ,GAAG,UAAU,EAAE,GAAG,EAAE,qBAAqB,IAAI,CAAC,MAAM,GAAG,CAAC,uBAAuB,CAAC,CAAC,CAAC;QAChG,IAAI,cAAc,IAAI,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC3C,OAAO;gBACN,IAAI,EAAE,EAAE;gBACR,GAAG,EAAE,UAAU,EAAE,GAAG;gBACpB,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,wCAAwC;aACnF,CAAC;QACH,CAAC;QACD,OAAO,SAAS,CAAC;IAClB,CAAC;CACD,CAAC;AAEF,MAAM,UAAU,oBAAoB;IACnC,OAAO,cAAc,CAAC;QACrB,EAAE,EAAE,eAAe;QACnB,IAAI,EAAE,kBAAkB;QACxB,IAAI,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE;QAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC;QAC3C,GAAG,EAAE,eAAe,EAAE;KACtB,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { googleVertexApi } from \"../api/google-vertex.lazy.ts\";\nimport type { ApiKeyAuth } from \"../auth/types.ts\";\nimport { createProvider, type Provider } from \"../models.ts\";\nimport { GOOGLE_VERTEX_MODELS } from \"./google-vertex.models.ts\";\n\nconst VERTEX_ADC_PATH = \"~/.config/gcloud/application_default_credentials.json\";\n\n/**\n * Vertex accepts an explicit API key or Application Default Credentials\n * (`gcloud auth application-default login`). ADC additionally requires\n * project and location env vars, which the implementation reads itself.\n */\nconst vertexAuth: ApiKeyAuth = {\n\tname: \"Google Cloud credentials\",\n\tlogin: async (interaction) => {\n\t\tinteraction.signal.throwIfAborted();\n\t\tconst method = await interaction.prompt({\n\t\t\ttype: \"select\",\n\t\t\tmessage: \"Select Google Vertex AI authentication method:\",\n\t\t\toptions: [\n\t\t\t\t{ id: \"api-key\", label: \"Google Cloud API key\" },\n\t\t\t\t{ id: \"adc\", label: \"Application Default Credentials\" },\n\t\t\t\t{ id: \"service-account\", label: \"Service account credentials file\" },\n\t\t\t],\n\t\t});\n\t\tinteraction.signal.throwIfAborted();\n\t\tif (method === \"api-key\") {\n\t\t\treturn {\n\t\t\t\ttype: \"api_key\",\n\t\t\t\tkey: await interaction.prompt({ type: \"secret\", message: \"Enter Google Cloud API key\" }),\n\t\t\t};\n\t\t}\n\t\tif (method !== \"adc\" && method !== \"service-account\") {\n\t\t\tthrow new Error(`Unknown Google Vertex AI auth method: ${method}`);\n\t\t}\n\t\tinteraction.notify({\n\t\t\ttype: \"info\",\n\t\t\tmessage:\n\t\t\t\tmethod === \"adc\"\n\t\t\t\t\t? \"Run `gcloud auth application-default login`, then provide the project and location.\"\n\t\t\t\t\t: \"Provide a service account credentials file, project, and location.\",\n\t\t\tlinks: [\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Application Default Credentials\",\n\t\t\t\t\turl: \"https://cloud.google.com/docs/authentication/provide-credentials-adc\",\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\t\tconst project = await interaction.prompt({ type: \"text\", message: \"Enter Google Cloud project ID\" });\n\t\tconst location = await interaction.prompt({ type: \"text\", message: \"Enter Google Cloud location\" });\n\t\tconst credentialsPath =\n\t\t\tmethod === \"service-account\"\n\t\t\t\t? await interaction.prompt({ type: \"text\", message: \"Enter service account credentials file path\" })\n\t\t\t\t: undefined;\n\t\treturn {\n\t\t\ttype: \"api_key\",\n\t\t\tenv: {\n\t\t\t\tGOOGLE_CLOUD_PROJECT: project,\n\t\t\t\tGOOGLE_CLOUD_LOCATION: location,\n\t\t\t\t...(credentialsPath ? { GOOGLE_APPLICATION_CREDENTIALS: credentialsPath } : {}),\n\t\t\t},\n\t\t};\n\t},\n\tresolve: async ({ ctx, credential, signal }) => {\n\t\tconst env = async (name: string) => {\n\t\t\tsignal.throwIfAborted();\n\t\t\tconst value = await ctx.env(name);\n\t\t\tsignal.throwIfAborted();\n\t\t\treturn value;\n\t\t};\n\t\tconst key = credential?.key ?? (await env(\"GOOGLE_CLOUD_API_KEY\"));\n\t\tif (key) return { auth: { apiKey: key }, source: credential?.key ? \"stored credential\" : \"GOOGLE_CLOUD_API_KEY\" };\n\n\t\tconst adcPath = credential?.env?.GOOGLE_APPLICATION_CREDENTIALS ?? (await env(\"GOOGLE_APPLICATION_CREDENTIALS\"));\n\t\tsignal.throwIfAborted();\n\t\tconst hasCredentials = await ctx.fileExists(adcPath ?? VERTEX_ADC_PATH);\n\t\tsignal.throwIfAborted();\n\t\tconst project =\n\t\t\tcredential?.env?.GOOGLE_CLOUD_PROJECT ?? (await env(\"GOOGLE_CLOUD_PROJECT\")) ?? (await env(\"GCLOUD_PROJECT\"));\n\t\tconst location = credential?.env?.GOOGLE_CLOUD_LOCATION ?? (await env(\"GOOGLE_CLOUD_LOCATION\"));\n\t\tif (hasCredentials && project && location) {\n\t\t\treturn {\n\t\t\t\tauth: {},\n\t\t\t\tenv: credential?.env,\n\t\t\t\tsource: credential ? \"stored credential\" : \"gcloud application default credentials\",\n\t\t\t};\n\t\t}\n\t\treturn undefined;\n\t},\n};\n\nexport function googleVertexProvider(): Provider<\"google-vertex\"> {\n\treturn createProvider({\n\t\tid: \"google-vertex\",\n\t\tname: \"Google Vertex AI\",\n\t\tauth: { apiKey: vertexAuth },\n\t\tmodels: Object.values(GOOGLE_VERTEX_MODELS),\n\t\tapi: googleVertexApi(),\n\t});\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"google-vertex.models.d.ts","sourceRoot":"","sources":["../../src/providers/google-vertex.models.ts"],"names":[],"mappings":"AAIA,OAAO,EAAoF,KAAK,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAEnM,eAAO,MAAM,oBAAoB,EAAE,gBAAgB,CAAC,cAAc,2BAA2B,EAAU,UAAE,IAAI,EAAE,MAAM,IAAE,CAAG,EAAE,eAAe,CAC1F,CAAC;AAElD,eAAO,MAAM,0BAA0B,EAAE,iBAAiB,CAAC,cAAc,2BAA2B,EAAU,UAAE,IAAI,EAAE,MAAM,IAAE,CAAG,EAAE,eAAe,CAChG,CAAC;AAEnD,eAAO,MAAM,+BAA+B,EAAE,sBAAsB,CAAC,cAAc,2BAA2B,EAAU,UAAE,IAAI,EAAE,MAAM,IAAE,CAAG,EAAE,eAAe,CACrG,CAAC","sourcesContent":["// This file is auto-generated by scripts/generate-models.ts\n// Do not edit manually - run 'npm run generate-models' to update\n\nimport values from \"./data/google-vertex.json\" with { type: \"json\" };\nimport { flattenChatModelCatalog, flattenImageModelCatalog, flattenClassifierModelCatalog, type ChatModelCatalog, type ImageModelCatalog, type ClassifierModelCatalog } from \"../model-catalog.ts\";\n\nexport const GOOGLE_VERTEX_MODELS: ChatModelCatalog<typeof import(\"./data/google-vertex.json\", { with: { type: \"json\" } }), \"google-vertex\"> =\n\tflattenChatModelCatalog(\"google-vertex\", values);\n\nexport const GOOGLE_VERTEX_IMAGE_MODELS: ImageModelCatalog<typeof import(\"./data/google-vertex.json\", { with: { type: \"json\" } }), \"google-vertex\"> =\n\tflattenImageModelCatalog(\"google-vertex\", values);\n\nexport const GOOGLE_VERTEX_CLASSIFIER_MODELS: ClassifierModelCatalog<typeof import(\"./data/google-vertex.json\", { with: { type: \"json\" } }), \"google-vertex\"> =\n\tflattenClassifierModelCatalog(\"google-vertex\", values);\n"]}
1
+ {"version":3,"file":"google-vertex.models.d.ts","sourceRoot":"","sources":["../../src/providers/google-vertex.models.ts"],"names":[],"mappings":"AAIA,OAAO,EAAoF,KAAK,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAEnM,eAAO,MAAM,oBAAoB,EAAE,gBAAgB,CAAC,cAAc,2BAA2B,EAAU,UAAE,IAAI,EAAE,MAAM,IAAE,CAAG,EAAE,eAAe,CAC1F,CAAC;AAElD,eAAO,MAAM,0BAA0B,EAAE,iBAAiB,CAAC,cAAc,2BAA2B,EAAU,UAAE,IAAI,EAAE,MAAM,IAAE,CAAG,EAAE,eAAe,CAChG,CAAC;AAEnD,eAAO,MAAM,+BAA+B,EAAE,sBAAsB,CAAC,cAAc,2BAA2B,EAAU,UAAE,IAAI,EAAE,MAAM,IAAE,CAAG,EAAE,eAAe,CACrG,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"google.d.ts","sourceRoot":"","sources":["../../src/providers/google.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG7D,wBAAgB,cAAc,IAAI,QAAQ,CAAC,sBAAsB,CAAC,CASjE","sourcesContent":["import { googleGenerativeAIApi } from \"../api/google-generative-ai.lazy.ts\";\nimport { envApiKeyAuth } from \"../auth/helpers.ts\";\nimport { createProvider, type Provider } from \"../models.ts\";\nimport { GOOGLE_MODELS } from \"./google.models.ts\";\n\nexport function googleProvider(): Provider<\"google-generative-ai\"> {\n\treturn createProvider({\n\t\tid: \"google\",\n\t\tname: \"Google\",\n\t\tbaseUrl: \"https://generativelanguage.googleapis.com/v1beta\",\n\t\tauth: { apiKey: envApiKeyAuth(\"Gemini API key\", [\"GEMINI_API_KEY\"]) },\n\t\tmodels: Object.values(GOOGLE_MODELS),\n\t\tapi: googleGenerativeAIApi(),\n\t});\n}\n"]}
1
+ {"version":3,"file":"google.d.ts","sourceRoot":"","sources":["../../src/providers/google.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG7D,wBAAgB,cAAc,IAAI,QAAQ,CAAC,sBAAsB,CAAC,CASjE"}
@@ -1 +1 @@
1
- {"version":3,"file":"google.js","sourceRoot":"","sources":["../../src/providers/google.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAiB,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,MAAM,UAAU,cAAc,GAAqC;IAClE,OAAO,cAAc,CAAC;QACrB,EAAE,EAAE,QAAQ;QACZ,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,kDAAkD;QAC3D,IAAI,EAAE,EAAE,MAAM,EAAE,aAAa,CAAC,gBAAgB,EAAE,CAAC,gBAAgB,CAAC,CAAC,EAAE;QACrE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC;QACpC,GAAG,EAAE,qBAAqB,EAAE;KAC5B,CAAC,CAAC;AAAA,CACH","sourcesContent":["import { googleGenerativeAIApi } from \"../api/google-generative-ai.lazy.ts\";\nimport { envApiKeyAuth } from \"../auth/helpers.ts\";\nimport { createProvider, type Provider } from \"../models.ts\";\nimport { GOOGLE_MODELS } from \"./google.models.ts\";\n\nexport function googleProvider(): Provider<\"google-generative-ai\"> {\n\treturn createProvider({\n\t\tid: \"google\",\n\t\tname: \"Google\",\n\t\tbaseUrl: \"https://generativelanguage.googleapis.com/v1beta\",\n\t\tauth: { apiKey: envApiKeyAuth(\"Gemini API key\", [\"GEMINI_API_KEY\"]) },\n\t\tmodels: Object.values(GOOGLE_MODELS),\n\t\tapi: googleGenerativeAIApi(),\n\t});\n}\n"]}
1
+ {"version":3,"file":"google.js","sourceRoot":"","sources":["../../src/providers/google.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAiB,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,MAAM,UAAU,cAAc;IAC7B,OAAO,cAAc,CAAC;QACrB,EAAE,EAAE,QAAQ;QACZ,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,kDAAkD;QAC3D,IAAI,EAAE,EAAE,MAAM,EAAE,aAAa,CAAC,gBAAgB,EAAE,CAAC,gBAAgB,CAAC,CAAC,EAAE;QACrE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC;QACpC,GAAG,EAAE,qBAAqB,EAAE;KAC5B,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { googleGenerativeAIApi } from \"../api/google-generative-ai.lazy.ts\";\nimport { envApiKeyAuth } from \"../auth/helpers.ts\";\nimport { createProvider, type Provider } from \"../models.ts\";\nimport { GOOGLE_MODELS } from \"./google.models.ts\";\n\nexport function googleProvider(): Provider<\"google-generative-ai\"> {\n\treturn createProvider({\n\t\tid: \"google\",\n\t\tname: \"Google\",\n\t\tbaseUrl: \"https://generativelanguage.googleapis.com/v1beta\",\n\t\tauth: { apiKey: envApiKeyAuth(\"Gemini API key\", [\"GEMINI_API_KEY\"]) },\n\t\tmodels: Object.values(GOOGLE_MODELS),\n\t\tapi: googleGenerativeAIApi(),\n\t});\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"google.models.d.ts","sourceRoot":"","sources":["../../src/providers/google.models.ts"],"names":[],"mappings":"AAIA,OAAO,EAAoF,KAAK,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAEnM,eAAO,MAAM,aAAa,EAAE,gBAAgB,CAAC,cAAc,oBAAoB,EAAU,UAAE,IAAI,EAAE,MAAM,IAAE,CAAG,EAAE,QAAQ,CAC5E,CAAC;AAE3C,eAAO,MAAM,mBAAmB,EAAE,iBAAiB,CAAC,cAAc,oBAAoB,EAAU,UAAE,IAAI,EAAE,MAAM,IAAE,CAAG,EAAE,QAAQ,CAClF,CAAC;AAE5C,eAAO,MAAM,wBAAwB,EAAE,sBAAsB,CAAC,cAAc,oBAAoB,EAAU,UAAE,IAAI,EAAE,MAAM,IAAE,CAAG,EAAE,QAAQ,CACvF,CAAC","sourcesContent":["// This file is auto-generated by scripts/generate-models.ts\n// Do not edit manually - run 'npm run generate-models' to update\n\nimport values from \"./data/google.json\" with { type: \"json\" };\nimport { flattenChatModelCatalog, flattenImageModelCatalog, flattenClassifierModelCatalog, type ChatModelCatalog, type ImageModelCatalog, type ClassifierModelCatalog } from \"../model-catalog.ts\";\n\nexport const GOOGLE_MODELS: ChatModelCatalog<typeof import(\"./data/google.json\", { with: { type: \"json\" } }), \"google\"> =\n\tflattenChatModelCatalog(\"google\", values);\n\nexport const GOOGLE_IMAGE_MODELS: ImageModelCatalog<typeof import(\"./data/google.json\", { with: { type: \"json\" } }), \"google\"> =\n\tflattenImageModelCatalog(\"google\", values);\n\nexport const GOOGLE_CLASSIFIER_MODELS: ClassifierModelCatalog<typeof import(\"./data/google.json\", { with: { type: \"json\" } }), \"google\"> =\n\tflattenClassifierModelCatalog(\"google\", values);\n"]}
1
+ {"version":3,"file":"google.models.d.ts","sourceRoot":"","sources":["../../src/providers/google.models.ts"],"names":[],"mappings":"AAIA,OAAO,EAAoF,KAAK,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAEnM,eAAO,MAAM,aAAa,EAAE,gBAAgB,CAAC,cAAc,oBAAoB,EAAU,UAAE,IAAI,EAAE,MAAM,IAAE,CAAG,EAAE,QAAQ,CAC5E,CAAC;AAE3C,eAAO,MAAM,mBAAmB,EAAE,iBAAiB,CAAC,cAAc,oBAAoB,EAAU,UAAE,IAAI,EAAE,MAAM,IAAE,CAAG,EAAE,QAAQ,CAClF,CAAC;AAE5C,eAAO,MAAM,wBAAwB,EAAE,sBAAsB,CAAC,cAAc,oBAAoB,EAAU,UAAE,IAAI,EAAE,MAAM,IAAE,CAAG,EAAE,QAAQ,CACvF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"groq.d.ts","sourceRoot":"","sources":["../../src/providers/groq.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG7D,wBAAgB,YAAY,IAAI,QAAQ,CAAC,oBAAoB,CAAC,CAS7D","sourcesContent":["import { openAICompletionsApi } from \"../api/openai-completions.lazy.ts\";\nimport { envApiKeyAuth } from \"../auth/helpers.ts\";\nimport { createProvider, type Provider } from \"../models.ts\";\nimport { GROQ_MODELS } from \"./groq.models.ts\";\n\nexport function groqProvider(): Provider<\"openai-completions\"> {\n\treturn createProvider({\n\t\tid: \"groq\",\n\t\tname: \"Groq\",\n\t\tbaseUrl: \"https://api.groq.com/openai/v1\",\n\t\tauth: { apiKey: envApiKeyAuth(\"Groq API key\", [\"GROQ_API_KEY\"]) },\n\t\tmodels: Object.values(GROQ_MODELS),\n\t\tapi: openAICompletionsApi(),\n\t});\n}\n"]}
1
+ {"version":3,"file":"groq.d.ts","sourceRoot":"","sources":["../../src/providers/groq.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG7D,wBAAgB,YAAY,IAAI,QAAQ,CAAC,oBAAoB,CAAC,CAS7D"}
@@ -1 +1 @@
1
- {"version":3,"file":"groq.js","sourceRoot":"","sources":["../../src/providers/groq.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAiB,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,UAAU,YAAY,GAAmC;IAC9D,OAAO,cAAc,CAAC;QACrB,EAAE,EAAE,MAAM;QACV,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,gCAAgC;QACzC,IAAI,EAAE,EAAE,MAAM,EAAE,aAAa,CAAC,cAAc,EAAE,CAAC,cAAc,CAAC,CAAC,EAAE;QACjE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC;QAClC,GAAG,EAAE,oBAAoB,EAAE;KAC3B,CAAC,CAAC;AAAA,CACH","sourcesContent":["import { openAICompletionsApi } from \"../api/openai-completions.lazy.ts\";\nimport { envApiKeyAuth } from \"../auth/helpers.ts\";\nimport { createProvider, type Provider } from \"../models.ts\";\nimport { GROQ_MODELS } from \"./groq.models.ts\";\n\nexport function groqProvider(): Provider<\"openai-completions\"> {\n\treturn createProvider({\n\t\tid: \"groq\",\n\t\tname: \"Groq\",\n\t\tbaseUrl: \"https://api.groq.com/openai/v1\",\n\t\tauth: { apiKey: envApiKeyAuth(\"Groq API key\", [\"GROQ_API_KEY\"]) },\n\t\tmodels: Object.values(GROQ_MODELS),\n\t\tapi: openAICompletionsApi(),\n\t});\n}\n"]}
1
+ {"version":3,"file":"groq.js","sourceRoot":"","sources":["../../src/providers/groq.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAiB,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,UAAU,YAAY;IAC3B,OAAO,cAAc,CAAC;QACrB,EAAE,EAAE,MAAM;QACV,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,gCAAgC;QACzC,IAAI,EAAE,EAAE,MAAM,EAAE,aAAa,CAAC,cAAc,EAAE,CAAC,cAAc,CAAC,CAAC,EAAE;QACjE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC;QAClC,GAAG,EAAE,oBAAoB,EAAE;KAC3B,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { openAICompletionsApi } from \"../api/openai-completions.lazy.ts\";\nimport { envApiKeyAuth } from \"../auth/helpers.ts\";\nimport { createProvider, type Provider } from \"../models.ts\";\nimport { GROQ_MODELS } from \"./groq.models.ts\";\n\nexport function groqProvider(): Provider<\"openai-completions\"> {\n\treturn createProvider({\n\t\tid: \"groq\",\n\t\tname: \"Groq\",\n\t\tbaseUrl: \"https://api.groq.com/openai/v1\",\n\t\tauth: { apiKey: envApiKeyAuth(\"Groq API key\", [\"GROQ_API_KEY\"]) },\n\t\tmodels: Object.values(GROQ_MODELS),\n\t\tapi: openAICompletionsApi(),\n\t});\n}\n"]}