@daniel156161/prism 0.2.78 → 0.2.82

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 (204) hide show
  1. package/dist/pi/pi-env.d.ts +1 -1
  2. package/dist/pi/pi-env.js +1 -1
  3. package/dist/pi/pi-patch-interactive.js +8 -5
  4. package/dist/pi/pi-patch-interactive.js.map +1 -1
  5. package/dist/prism-extensions/integrations/ai-memory-errors.d.ts +29 -0
  6. package/dist/prism-extensions/integrations/ai-memory-errors.js +106 -0
  7. package/dist/prism-extensions/integrations/ai-memory-errors.js.map +1 -0
  8. package/dist/prism-extensions/integrations/ai-memory-http.d.ts +28 -0
  9. package/dist/prism-extensions/integrations/ai-memory-http.js +92 -0
  10. package/dist/prism-extensions/integrations/ai-memory-http.js.map +1 -0
  11. package/dist/prism-extensions/integrations/ai-memory-system.d.ts +5 -0
  12. package/dist/prism-extensions/integrations/ai-memory-system.js +205 -123
  13. package/dist/prism-extensions/integrations/ai-memory-system.js.map +1 -1
  14. package/dist/prism-extensions/integrations/ai-memory-write-preview.d.ts +36 -0
  15. package/dist/prism-extensions/integrations/ai-memory-write-preview.js +67 -0
  16. package/dist/prism-extensions/integrations/ai-memory-write-preview.js.map +1 -0
  17. package/dist/prism-extensions/integrations/research-tools.js +3 -3
  18. package/dist/prism-extensions/integrations/research-tools.js.map +1 -1
  19. package/dist/prism-extensions/integrations/youtube.d.ts +2 -2
  20. package/dist/prism-extensions/integrations/youtube.js +6 -7
  21. package/dist/prism-extensions/integrations/youtube.js.map +1 -1
  22. package/dist/prism-extensions/ui/collapsed-text-rendering.d.ts +4 -2
  23. package/dist/prism-extensions/ui/collapsed-text-rendering.js +12 -7
  24. package/dist/prism-extensions/ui/collapsed-text-rendering.js.map +1 -1
  25. package/node_modules/@earendil-works/pi-agent-core/README.md +4 -4
  26. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
  27. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +5 -1
  28. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -1
  29. package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts.map +1 -1
  30. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js +3 -0
  31. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js.map +1 -1
  32. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +6 -0
  33. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts.map +1 -1
  34. package/node_modules/@earendil-works/pi-agent-core/dist/types.js.map +1 -1
  35. package/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
  36. package/node_modules/@earendil-works/pi-ai/README.md +8 -1
  37. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.d.ts.map +1 -1
  38. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js +1 -0
  39. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js.map +1 -1
  40. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +2 -0
  41. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts.map +1 -1
  42. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +2 -0
  43. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js.map +1 -1
  44. package/node_modules/@earendil-works/pi-ai/dist/providers/all.d.ts.map +1 -1
  45. package/node_modules/@earendil-works/pi-ai/dist/providers/all.js +2 -0
  46. package/node_modules/@earendil-works/pi-ai/dist/providers/all.js.map +1 -1
  47. package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  48. package/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
  49. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
  50. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  51. package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-individual.json +1 -0
  52. package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  53. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual.d.ts +3 -0
  54. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual.d.ts.map +1 -0
  55. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual.js +15 -0
  56. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual.js.map +1 -0
  57. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual.models.d.ts +4 -0
  58. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual.models.d.ts.map +1 -0
  59. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual.models.js +6 -0
  60. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual.models.js.map +1 -0
  61. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +1 -1
  62. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
  63. package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
  64. package/node_modules/@earendil-works/pi-ai/package.json +2 -2
  65. package/node_modules/@earendil-works/pi-client/CHANGELOG.md +1 -1
  66. package/node_modules/@earendil-works/pi-client/package.json +2 -2
  67. package/node_modules/@earendil-works/pi-coding-agent/CHANGELOG.md +31 -2
  68. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.d.ts.map +1 -1
  69. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.js +3 -3
  70. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.js.map +1 -1
  71. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/auth-check.d.ts +19 -0
  72. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/auth-check.d.ts.map +1 -0
  73. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/auth-check.js +50 -0
  74. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/auth-check.js.map +1 -0
  75. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/auth-command.d.ts +24 -0
  76. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/auth-command.d.ts.map +1 -0
  77. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/auth-command.js +102 -0
  78. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/auth-command.js.map +1 -0
  79. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/credential-print.d.ts +4 -14
  80. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/credential-print.d.ts.map +1 -1
  81. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/credential-print.js +38 -79
  82. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/credential-print.js.map +1 -1
  83. package/node_modules/@earendil-works/pi-coding-agent/dist/cli.js +1 -1
  84. package/node_modules/@earendil-works/pi-coding-agent/dist/config.js +11 -6
  85. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-services.js +1 -1
  86. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.js +0 -5
  87. package/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.d.ts +10 -0
  88. package/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.d.ts.map +1 -1
  89. package/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.js +79 -2
  90. package/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.js.map +1 -1
  91. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/loader.js +1 -3
  92. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/types.d.ts +5 -0
  93. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
  94. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/types.js.map +1 -1
  95. package/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings.d.ts +8 -0
  96. package/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings.d.ts.map +1 -1
  97. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-resolver.d.ts.map +1 -1
  98. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-resolver.js +1 -0
  99. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-resolver.js.map +1 -1
  100. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-runtime.d.ts +2 -0
  101. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-runtime.d.ts.map +1 -1
  102. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-runtime.js +3 -1
  103. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-runtime.js.map +1 -1
  104. package/node_modules/@earendil-works/pi-coding-agent/dist/core/project-trust.js +1 -1
  105. package/node_modules/@earendil-works/pi-coding-agent/dist/core/sdk.js +1 -1
  106. package/node_modules/@earendil-works/pi-coding-agent/dist/core/session-manager.js +37 -39
  107. package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.js +16 -20
  108. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.d.ts +4 -0
  109. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.d.ts.map +1 -1
  110. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.js +6 -4
  111. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.js.map +1 -1
  112. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit.d.ts +4 -0
  113. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit.d.ts.map +1 -1
  114. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit.js +11 -7
  115. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit.js.map +1 -1
  116. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/find.d.ts +4 -0
  117. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/find.d.ts.map +1 -1
  118. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/find.js +5 -1
  119. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/find.js.map +1 -1
  120. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/grep.d.ts +4 -0
  121. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/grep.d.ts.map +1 -1
  122. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/grep.js +5 -1
  123. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/grep.js.map +1 -1
  124. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/ls.d.ts +4 -0
  125. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/ls.d.ts.map +1 -1
  126. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/ls.js +5 -1
  127. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/ls.js.map +1 -1
  128. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.d.ts +4 -0
  129. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.d.ts.map +1 -1
  130. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.js +6 -2
  131. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.js.map +1 -1
  132. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/write.d.ts +4 -0
  133. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/write.d.ts.map +1 -1
  134. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/write.js +6 -2
  135. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/write.js.map +1 -1
  136. package/node_modules/@earendil-works/pi-coding-agent/dist/main.d.ts.map +1 -1
  137. package/node_modules/@earendil-works/pi-coding-agent/dist/main.js +57 -21
  138. package/node_modules/@earendil-works/pi-coding-agent/dist/main.js.map +1 -1
  139. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/session-selector.js +0 -4
  140. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +3 -0
  141. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  142. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js +48 -233
  143. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
  144. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  145. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.js +11 -3
  146. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.js.map +1 -1
  147. package/node_modules/@earendil-works/pi-coding-agent/dist/server/create-harness.d.ts +26 -0
  148. package/node_modules/@earendil-works/pi-coding-agent/dist/server/create-harness.d.ts.map +1 -0
  149. package/node_modules/@earendil-works/pi-coding-agent/dist/server/create-harness.js +104 -0
  150. package/node_modules/@earendil-works/pi-coding-agent/dist/server/create-harness.js.map +1 -0
  151. package/node_modules/@earendil-works/pi-coding-agent/docs/extensions.md +3 -2
  152. package/node_modules/@earendil-works/pi-coding-agent/docs/keybindings.md +9 -5
  153. package/node_modules/@earendil-works/pi-coding-agent/docs/providers.md +8 -1
  154. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  155. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-anthropic/package.json +1 -1
  156. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  157. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/gondolin/package-lock.json +2 -2
  158. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/gondolin/package.json +1 -1
  159. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/sandbox/package-lock.json +2 -2
  160. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/sandbox/package.json +1 -1
  161. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/with-deps/package-lock.json +2 -2
  162. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/with-deps/package.json +1 -1
  163. package/node_modules/@earendil-works/pi-coding-agent/package.json +7 -7
  164. package/node_modules/@earendil-works/pi-protocol/package.json +1 -1
  165. package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
  166. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js +1 -1
  167. package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts +10 -0
  168. package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts.map +1 -1
  169. package/node_modules/@earendil-works/pi-tui/dist/keybindings.js +8 -0
  170. package/node_modules/@earendil-works/pi-tui/dist/keybindings.js.map +1 -1
  171. package/node_modules/@earendil-works/pi-tui/dist/latex.d.ts.map +1 -1
  172. package/node_modules/@earendil-works/pi-tui/dist/latex.js +188 -48
  173. package/node_modules/@earendil-works/pi-tui/dist/latex.js.map +1 -1
  174. package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts +12 -0
  175. package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts.map +1 -1
  176. package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js +146 -12
  177. package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js.map +1 -1
  178. package/node_modules/@earendil-works/pi-tui/package.json +1 -1
  179. package/node_modules/@types/node/README.md +1 -1
  180. package/node_modules/@types/node/child_process.d.ts +0 -1
  181. package/node_modules/@types/node/crypto.d.ts +6 -6
  182. package/node_modules/@types/node/dns/promises.d.ts +5 -5
  183. package/node_modules/@types/node/dns.d.ts +5 -5
  184. package/node_modules/@types/node/fs.d.ts +7 -0
  185. package/node_modules/@types/node/http.d.ts +30 -0
  186. package/node_modules/@types/node/http2.d.ts +4 -4
  187. package/node_modules/@types/node/os.d.ts +30 -30
  188. package/node_modules/@types/node/package.json +2 -2
  189. package/node_modules/@types/node/perf_hooks.d.ts +2 -1
  190. package/node_modules/@types/node/process.d.ts +42 -43
  191. package/node_modules/@types/node/quic.d.ts +1049 -84
  192. package/node_modules/@types/node/sqlite.d.ts +14 -1
  193. package/node_modules/@types/node/stream/iter.d.ts +3 -2
  194. package/node_modules/@types/node/test.d.ts +61 -0
  195. package/node_modules/@types/node/v8.d.ts +20 -23
  196. package/package.json +6 -6
  197. package/src/prism-extensions/integrations/ai-memory-errors.ts +112 -0
  198. package/src/prism-extensions/integrations/ai-memory-http.ts +114 -0
  199. package/src/prism-extensions/integrations/ai-memory-system.ts +221 -132
  200. package/src/prism-extensions/integrations/ai-memory-write-preview.ts +83 -0
  201. package/src/prism-extensions/integrations/research-tools.ts +3 -3
  202. package/src/prism-extensions/integrations/youtube.ts +6 -6
  203. package/src/prism-extensions/ui/collapsed-text-rendering.ts +14 -8
  204. package/node_modules/@earendil-works/pi-coding-agent/dist/core/prism-session-db.js +0 -128
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,GAAG,EACH,gBAAgB,EAChB,qBAAqB,EACrB,2BAA2B,EAC3B,OAAO,EACP,YAAY,EACZ,OAAO,EACP,KAAK,EACL,mBAAmB,EACnB,WAAW,EACX,IAAI,EACJ,iBAAiB,EACjB,KAAK,EACL,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAE/C;;;;;;;;;GASG;AACH,MAAM,MAAM,QAAQ,GAAG,CACtB,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EACjB,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,mBAAmB,KACzB,2BAA2B,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;AAExE;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG,UAAU,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,eAAe,CAAC;AAEhD,wEAAwE;AACxE,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,EA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EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,GAAG,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC","sourcesContent":["import type {\n\tApi,\n\tAssistantMessage,\n\tAssistantMessageEvent,\n\tAssistantMessageEventStream,\n\tContext,\n\tImageContent,\n\tMessage,\n\tModel,\n\tSimpleStreamOptions,\n\tTextContent,\n\tTool,\n\tToolResultMessage,\n\tUsage,\n} from \"@earendil-works/pi-ai\";\nimport type { Static, TSchema } from \"typebox\";\n\n/**\n * Stream function used by the agent loop. `Models.streamSimple` satisfies\n * this shape.\n *\n * Contract:\n * - Must not throw or return a rejected promise for request/model/runtime failures.\n * - Must return an AssistantMessageEventStream.\n * - Failures must be encoded in the returned stream via protocol events and a\n * final AssistantMessage with stopReason \"error\" or \"aborted\" and errorMessage.\n */\nexport type StreamFn = (\n\tmodel: Model<Api>,\n\tcontext: Context,\n\toptions?: SimpleStreamOptions,\n) => AssistantMessageEventStream | Promise<AssistantMessageEventStream>;\n\n/**\n * Configuration for how tool calls from a single assistant message are executed.\n *\n * - \"sequential\": each tool call is prepared, executed, and finalized before the next one starts.\n * - \"parallel\": tool calls are prepared sequentially, then allowed tools execute concurrently.\n * `tool_execution_end` is emitted in tool completion order after each tool is finalized,\n * while tool-result message artifacts are emitted later in assistant source order.\n */\nexport type ToolExecutionMode = \"sequential\" | \"parallel\";\n\n/**\n * Controls how many queued user messages are injected when the agent loop reaches a queue drain point.\n *\n * - \"all\": drain and inject every queued message at that point.\n * - \"one-at-a-time\": drain and inject only the oldest queued message, leaving the rest queued for later drain points.\n */\nexport type QueueMode = \"all\" | \"one-at-a-time\";\n\n/** A single tool call content block emitted by an assistant message. */\nexport type AgentToolCall = Extract<AssistantMessage[\"content\"][number], { type: \"toolCall\" }>;\n\n/**\n * Result returned from `beforeToolCall`.\n *\n * Returning `{ block: true }` prevents the tool from executing. The loop emits an error tool result instead.\n * `reason` becomes the text shown in that error result. If omitted, a default blocked message is used.\n */\nexport interface BeforeToolCallResult {\n\tblock?: boolean;\n\treason?: string;\n}\n\n/**\n * Partial override returned from `afterToolCall`.\n *\n * Merge semantics are field-by-field:\n * - `content`: if provided, replaces the tool result content array in full\n * - `details`: if provided, replaces the tool result details value in full\n * - `isError`: if provided, replaces the tool result error flag\n * - `usage`: if provided, replaces the tool result usage\n * - `terminate`: if provided, replaces the early-termination hint\n *\n * Omitted fields keep the original executed tool result values.\n * There is no deep merge for `content`, `details`, or `usage`.\n */\nexport interface AfterToolCallResult {\n\tcontent?: (TextContent | ImageContent)[];\n\tdetails?: unknown;\n\tisError?: boolean;\n\t/** Usage from the final tool execution itself, if available. Not used for main LLM context accounting. */\n\tusage?: Usage;\n\t/**\n\t * Hint that the agent should stop after the current tool batch.\n\t * Early termination only happens when every finalized tool result in the batch sets this to true.\n\t */\n\tterminate?: boolean;\n}\n\n/** Context passed to `beforeToolCall`. */\nexport interface BeforeToolCallContext {\n\t/** The assistant message that requested the tool call. */\n\tassistantMessage: AssistantMessage;\n\t/** The raw tool call block from `assistantMessage.content`. */\n\ttoolCall: AgentToolCall;\n\t/** Validated tool arguments for the target tool schema. */\n\targs: unknown;\n\t/** Current agent context at the time the tool call is prepared. */\n\tcontext: AgentContext;\n}\n\n/** Context passed to `afterToolCall`. */\nexport interface AfterToolCallContext {\n\t/** The assistant message that requested the tool call. */\n\tassistantMessage: AssistantMessage;\n\t/** The raw tool call block from `assistantMessage.content`. */\n\ttoolCall: AgentToolCall;\n\t/** Validated tool arguments for the target tool schema. */\n\targs: unknown;\n\t/** The executed tool result before any `afterToolCall` overrides are applied. */\n\tresult: AgentToolResult<any>;\n\t/** Whether the executed tool result is currently treated as an error. */\n\tisError: boolean;\n\t/** Current agent context at the time the tool call is finalized. */\n\tcontext: AgentContext;\n}\n\n/** Context passed to `shouldStopAfterTurn`. */\nexport interface ShouldStopAfterTurnContext {\n\t/** The assistant message that completed the turn. */\n\tmessage: AssistantMessage;\n\t/** Tool result messages passed to the preceding `turn_end` event. */\n\ttoolResults: ToolResultMessage[];\n\t/** Current agent context after the turn's assistant message and tool results have been appended. */\n\tcontext: AgentContext;\n\t/** Messages that this loop invocation will return if it exits at this point. Prompt runs include the initial prompt messages; continuation runs do not include pre-existing context messages. */\n\tnewMessages: AgentMessage[];\n}\n\n/** Replacement runtime state used by the agent loop before starting another provider request. */\nexport interface AgentLoopTurnUpdate {\n\t/** Context for the next provider request. */\n\tcontext?: AgentContext;\n\t/** Model for the next provider request. */\n\tmodel?: Model<any>;\n\t/** Thinking level for the next provider request. */\n\tthinkingLevel?: ThinkingLevel;\n}\n\nexport interface PrepareNextTurnContext extends ShouldStopAfterTurnContext {}\n\nexport interface AgentLoopConfig extends SimpleStreamOptions {\n\tmodel: Model<any>;\n\n\t/**\n\t * Converts AgentMessage[] to LLM-compatible Message[] before each LLM call.\n\t *\n\t * Each AgentMessage must be converted to a UserMessage, AssistantMessage, or ToolResultMessage\n\t * that the LLM can understand. AgentMessages that cannot be converted (e.g., UI-only notifications,\n\t * status messages) should be filtered out.\n\t *\n\t * Contract: must not throw or reject. Return a safe fallback value instead.\n\t * Throwing interrupts the low-level agent loop without producing a normal event sequence.\n\t *\n\t * @example\n\t * ```typescript\n\t * convertToLlm: (messages) => messages.flatMap(m => {\n\t * if (m.role === \"custom\") {\n\t * // Convert custom message to user message\n\t * return [{ role: \"user\", content: m.content, timestamp: m.timestamp }];\n\t * }\n\t * if (m.role === \"notification\") {\n\t * // Filter out UI-only messages\n\t * return [];\n\t * }\n\t * // Pass through standard LLM messages\n\t * return [m];\n\t * })\n\t * ```\n\t */\n\tconvertToLlm: (messages: AgentMessage[]) => Message[] | Promise<Message[]>;\n\n\t/**\n\t * Optional transform applied to the context before `convertToLlm`.\n\t *\n\t * Use this for operations that work at the AgentMessage level:\n\t * - Context window management (pruning old messages)\n\t * - Injecting context from external sources\n\t *\n\t * Contract: must not throw or reject. Return the original messages or another\n\t * safe fallback value instead.\n\t *\n\t * @example\n\t * ```typescript\n\t * transformContext: async (messages) => {\n\t * if (estimateTokens(messages) > MAX_TOKENS) {\n\t * return pruneOldMessages(messages);\n\t * }\n\t * return messages;\n\t * }\n\t * ```\n\t */\n\ttransformContext?: (messages: AgentMessage[], signal?: AbortSignal) => Promise<AgentMessage[]>;\n\n\t/**\n\t * Resolves an API key dynamically for each LLM call.\n\t *\n\t * Useful for short-lived OAuth tokens (e.g., GitHub Copilot) that may expire\n\t * during long-running tool execution phases.\n\t *\n\t * Contract: must not throw or reject. Return undefined when no key is available.\n\t */\n\tgetApiKey?: (provider: string) => Promise<string | undefined> | string | undefined;\n\n\t/**\n\t * Called after each turn fully completes and `turn_end` has been emitted.\n\t *\n\t * If it returns true, the loop emits `agent_end` and exits before polling steering or follow-up queues,\n\t * without starting another LLM call. The current assistant response and any tool executions finish normally.\n\t *\n\t * Use this to request a graceful stop after the current turn, e.g. before context gets too full.\n\t *\n\t * Contract: must not throw or reject. Throwing interrupts the low-level agent loop without producing a normal event sequence.\n\t */\n\tshouldStopAfterTurn?: (context: ShouldStopAfterTurnContext) => boolean | Promise<boolean>;\n\n\t/**\n\t * Called after `turn_end` and before the loop decides whether another provider request should start.\n\t * Return replacement context/model/thinking state to affect the next turn in this run.\n\t * Return undefined to keep using the current context/config.\n\t */\n\tprepareNextTurn?: (\n\t\tcontext: PrepareNextTurnContext,\n\t) => AgentLoopTurnUpdate | undefined | Promise<AgentLoopTurnUpdate | undefined>;\n\n\t/**\n\t * Returns steering messages to inject into the conversation mid-run.\n\t *\n\t * Called after the current assistant turn finishes executing its tool calls, unless `shouldStopAfterTurn` exits first.\n\t * If messages are returned, they are added to the context before the next LLM call.\n\t * Tool calls from the current assistant message are not skipped.\n\t *\n\t * Use this for \"steering\" the agent while it's working.\n\t *\n\t * Contract: must not throw or reject. Return [] when no steering messages are available.\n\t */\n\tgetSteeringMessages?: () => Promise<AgentMessage[]>;\n\n\t/**\n\t * Returns follow-up messages to process after the agent would otherwise stop.\n\t *\n\t * Called when the agent has no more tool calls and no steering messages.\n\t * If messages are returned, they're added to the context and the agent\n\t * continues with another turn.\n\t *\n\t * Use this for follow-up messages that should wait until the agent finishes.\n\t *\n\t * Contract: must not throw or reject. Return [] when no follow-up messages are available.\n\t */\n\tgetFollowUpMessages?: () => Promise<AgentMessage[]>;\n\n\t/**\n\t * Tool execution mode.\n\t * - \"sequential\": execute tool calls one by one\n\t * - \"parallel\": preflight tool calls sequentially, then execute allowed tools concurrently;\n\t * emit `tool_execution_end` in tool completion order after each tool is finalized,\n\t * then emit tool-result message artifacts later in assistant source order\n\t *\n\t * Default: \"parallel\"\n\t */\n\ttoolExecution?: ToolExecutionMode;\n\n\t/**\n\t * Called before a tool is executed, after arguments have been validated.\n\t *\n\t * Return `{ block: true }` to prevent execution. The loop emits an error tool result instead.\n\t * The hook receives the agent abort signal and is responsible for honoring it.\n\t */\n\tbeforeToolCall?: (context: BeforeToolCallContext, signal?: AbortSignal) => Promise<BeforeToolCallResult | undefined>;\n\n\t/**\n\t * Called after a tool finishes executing, before `tool_execution_end` and tool-result message events are emitted.\n\t *\n\t * Return an `AfterToolCallResult` to override parts of the executed tool result:\n\t * - `content` replaces the full content array\n\t * - `details` replaces the full details payload\n\t * - `isError` replaces the error flag\n\t * - `usage` replaces the tool result usage\n\t * - `terminate` replaces the early-termination hint\n\t *\n\t * Any omitted fields keep their original values. No deep merge is performed.\n\t * The hook receives the agent abort signal and is responsible for honoring it.\n\t */\n\tafterToolCall?: (context: AfterToolCallContext, signal?: AbortSignal) => Promise<AfterToolCallResult | undefined>;\n}\n\n/**\n * Thinking/reasoning level for models that support it.\n * Note: \"xhigh\" and \"max\" are only supported by selected model families. Use model\n * thinking-level metadata from @earendil-works/pi-ai to detect support for a concrete model.\n */\nexport type ThinkingLevel = \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\n\n/**\n * Extensible interface for custom app messages.\n * Apps can extend via declaration merging:\n *\n * @example\n * ```typescript\n * declare module \"@mariozechner/agent\" {\n * interface CustomAgentMessages {\n * artifact: ArtifactMessage;\n * notification: NotificationMessage;\n * }\n * }\n * ```\n */\nexport interface CustomAgentMessages {\n\t// Empty by default - apps extend via declaration merging\n}\n\n/**\n * AgentMessage: Union of LLM messages + custom messages.\n * This abstraction allows apps to add custom message types while maintaining\n * type safety and compatibility with the base LLM messages.\n */\nexport type AgentMessage = Message | CustomAgentMessages[keyof CustomAgentMessages];\n\n/**\n * Public agent state.\n *\n * `tools` and `messages` use accessor properties so implementations can copy\n * assigned arrays before storing them.\n */\nexport interface AgentState {\n\t/** System prompt sent with each model request. */\n\tsystemPrompt: string;\n\t/** Active model used for future turns. */\n\tmodel: Model<any>;\n\t/** Requested reasoning level for future turns. */\n\tthinkingLevel: ThinkingLevel;\n\t/** Available tools. Assigning a new array copies the top-level array. */\n\tset tools(tools: AgentTool<any>[]);\n\tget tools(): AgentTool<any>[];\n\t/** Conversation transcript. Assigning a new array copies the top-level array. */\n\tset messages(messages: AgentMessage[]);\n\tget messages(): AgentMessage[];\n\t/**\n\t * True while the agent is processing a prompt or continuation.\n\t *\n\t * This remains true until awaited `agent_end` listeners settle.\n\t */\n\treadonly isStreaming: boolean;\n\t/** Partial assistant message for the current streamed response, if any. */\n\treadonly streamingMessage?: AgentMessage;\n\t/** Tool call ids currently executing. */\n\treadonly pendingToolCalls: ReadonlySet<string>;\n\t/** Error message from the most recent failed or aborted assistant turn, if any. */\n\treadonly errorMessage?: string;\n}\n\n/** Final or partial result produced by a tool. */\nexport interface AgentToolResult<T> {\n\t/** Text or image content returned to the model. */\n\tcontent: (TextContent | ImageContent)[];\n\t/** Arbitrary structured details for logs or UI rendering. */\n\tdetails: T;\n\t/** Usage from the final tool execution itself, if available. Not used for main LLM context accounting. */\n\tusage?: Usage;\n\t/** Names of tools introduced by this result and available from this transcript point onward. */\n\taddedToolNames?: string[];\n\t/**\n\t * Hint that the agent should stop after the current tool batch.\n\t * Early termination only happens when every finalized tool result in the batch sets this to true.\n\t */\n\tterminate?: boolean;\n}\n\n/**\n * Callback used by tools to stream partial execution updates.\n *\n * The callback is scoped to the current `execute()` invocation. Calls made after\n * the tool promise settles are ignored.\n */\nexport type AgentToolUpdateCallback<T = any> = (partialResult: AgentToolResult<T>) => void;\n\n/** Tool definition used by the agent runtime. */\nexport interface AgentTool<TParameters extends TSchema = TSchema, TDetails = any> extends Tool<TParameters> {\n\t/** Human-readable label for UI display. */\n\tlabel: string;\n\t/**\n\t * Optional compatibility shim for raw tool-call arguments before schema validation.\n\t * Must return an object that matches `TParameters`.\n\t */\n\tprepareArguments?: (args: unknown) => Static<TParameters>;\n\t/** Execute the tool call. Throw on failure instead of encoding errors in `content`. */\n\texecute: (\n\t\ttoolCallId: string,\n\t\tparams: Static<TParameters>,\n\t\tsignal?: AbortSignal,\n\t\tonUpdate?: AgentToolUpdateCallback<TDetails>,\n\t) => Promise<AgentToolResult<TDetails>>;\n\t/**\n\t * Per-tool execution mode override.\n\t * - \"sequential\": this tool must execute one at a time with other tool calls.\n\t * - \"parallel\": this tool can execute concurrently with other tool calls.\n\t *\n\t * If omitted, the default execution mode applies.\n\t */\n\texecutionMode?: ToolExecutionMode;\n}\n\n/** Context snapshot passed into the low-level agent loop. */\nexport interface AgentContext {\n\t/** System prompt included with the request. */\n\tsystemPrompt: string;\n\t/** Transcript visible to the model. */\n\tmessages: AgentMessage[];\n\t/** Tools available for this run. */\n\ttools?: AgentTool<any>[];\n}\n\n/**\n * Events emitted by the Agent for UI updates.\n *\n * `agent_end` is the last event emitted for a run, but awaited `Agent.subscribe()`\n * listeners for that event are still part of run settlement. The agent becomes\n * idle only after those listeners finish.\n */\nexport type AgentEvent =\n\t// Agent lifecycle\n\t| { type: \"agent_start\" }\n\t| { type: \"agent_end\"; messages: AgentMessage[] }\n\t// Turn lifecycle - a turn is one assistant response + any tool calls/results\n\t| { type: \"turn_start\" }\n\t| { type: \"turn_end\"; message: AgentMessage; toolResults: ToolResultMessage[] }\n\t// Message lifecycle - emitted for user, assistant, and toolResult messages\n\t| { type: \"message_start\"; message: AgentMessage }\n\t// Only emitted for assistant messages during streaming\n\t| { type: \"message_update\"; message: AgentMessage; assistantMessageEvent: AssistantMessageEvent }\n\t| { type: \"message_end\"; message: AgentMessage }\n\t// Tool execution lifecycle\n\t| { type: \"tool_execution_start\"; toolCallId: string; toolName: string; args: any }\n\t| { type: \"tool_execution_update\"; toolCallId: string; toolName: string; args: any; partialResult: any }\n\t| { type: \"tool_execution_end\"; toolCallId: string; toolName: string; result: any; isError: boolean };\n"]}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,GAAG,EACH,gBAAgB,EAChB,qBAAqB,EACrB,2BAA2B,EAC3B,OAAO,EACP,YAAY,EACZ,OAAO,EACP,KAAK,EACL,mBAAmB,EACnB,WAAW,EACX,IAAI,EACJ,iBAAiB,EACjB,KAAK,EACL,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAE/C;;;;;;;;;GASG;AACH,MAAM,MAAM,QAAQ,GAAG,CACtB,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EACjB,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,mBAAmB,KACzB,2BAA2B,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;AAExE;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG,UAAU,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,eAAe,CAAC;AAEhD,wEAAwE;AACxE,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,CAAC;AAE/F;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACpC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAA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sourcesContent":["import type {\n\tApi,\n\tAssistantMessage,\n\tAssistantMessageEvent,\n\tAssistantMessageEventStream,\n\tContext,\n\tImageContent,\n\tMessage,\n\tModel,\n\tSimpleStreamOptions,\n\tTextContent,\n\tTool,\n\tToolResultMessage,\n\tUsage,\n} from \"@earendil-works/pi-ai\";\nimport type { Static, TSchema } from \"typebox\";\n\n/**\n * Stream function used by the agent loop. `Models.streamSimple` satisfies\n * this shape.\n *\n * Contract:\n * - Must not throw or return a rejected promise for request/model/runtime failures.\n * - Must return an AssistantMessageEventStream.\n * - Failures must be encoded in the returned stream via protocol events and a\n * final AssistantMessage with stopReason \"error\" or \"aborted\" and errorMessage.\n */\nexport type StreamFn = (\n\tmodel: Model<Api>,\n\tcontext: Context,\n\toptions?: SimpleStreamOptions,\n) => AssistantMessageEventStream | Promise<AssistantMessageEventStream>;\n\n/**\n * Configuration for how tool calls from a single assistant message are executed.\n *\n * - \"sequential\": each tool call is prepared, executed, and finalized before the next one starts.\n * - \"parallel\": tool calls are prepared sequentially, then allowed tools execute concurrently.\n * `tool_execution_end` is emitted in tool completion order after each tool is finalized,\n * while tool-result message artifacts are emitted later in assistant source order.\n */\nexport type ToolExecutionMode = \"sequential\" | \"parallel\";\n\n/**\n * Controls how many queued user messages are injected when the agent loop reaches a queue drain point.\n *\n * - \"all\": drain and inject every queued message at that point.\n * - \"one-at-a-time\": drain and inject only the oldest queued message, leaving the rest queued for later drain points.\n */\nexport type QueueMode = \"all\" | \"one-at-a-time\";\n\n/** A single tool call content block emitted by an assistant message. */\nexport type AgentToolCall = Extract<AssistantMessage[\"content\"][number], { type: \"toolCall\" }>;\n\n/**\n * Result returned from `beforeToolCall`.\n *\n * Returning `{ block: true }` prevents the tool from executing. The loop emits an error tool result instead.\n * `reason` becomes the text shown in that error result. If omitted, a default blocked message is used.\n */\nexport interface BeforeToolCallResult {\n\tblock?: boolean;\n\treason?: string;\n\t/**\n\t * Hint that the agent should stop after the current tool batch when this call is blocked.\n\t * Early termination only happens when every finalized tool result in the batch sets this to true.\n\t */\n\tterminate?: boolean;\n}\n\n/**\n * Partial override returned from `afterToolCall`.\n *\n * Merge semantics are field-by-field:\n * - `content`: if provided, replaces the tool result content array in full\n * - `details`: if provided, replaces the tool result details value in full\n * - `isError`: if provided, replaces the tool result error flag\n * - `usage`: if provided, replaces the tool result usage\n * - `terminate`: if provided, replaces the early-termination hint\n *\n * Omitted fields keep the original executed tool result values.\n * There is no deep merge for `content`, `details`, or `usage`.\n */\nexport interface AfterToolCallResult {\n\tcontent?: (TextContent | ImageContent)[];\n\tdetails?: unknown;\n\tisError?: boolean;\n\t/** Usage from the final tool execution itself, if available. Not used for main LLM context accounting. */\n\tusage?: Usage;\n\t/**\n\t * Hint that the agent should stop after the current tool batch.\n\t * Early termination only happens when every finalized tool result in the batch sets this to true.\n\t */\n\tterminate?: boolean;\n}\n\n/** Context passed to `beforeToolCall`. */\nexport interface BeforeToolCallContext {\n\t/** The assistant message that requested the tool call. */\n\tassistantMessage: AssistantMessage;\n\t/** The raw tool call block from `assistantMessage.content`. */\n\ttoolCall: AgentToolCall;\n\t/** Validated tool arguments for the target tool schema. */\n\targs: unknown;\n\t/** Current agent context at the time the tool call is prepared. */\n\tcontext: AgentContext;\n}\n\n/** Context passed to `afterToolCall`. */\nexport interface AfterToolCallContext {\n\t/** The assistant message that requested the tool call. */\n\tassistantMessage: AssistantMessage;\n\t/** The raw tool call block from `assistantMessage.content`. */\n\ttoolCall: AgentToolCall;\n\t/** Validated tool arguments for the target tool schema. */\n\targs: unknown;\n\t/** The executed tool result before any `afterToolCall` overrides are applied. */\n\tresult: AgentToolResult<any>;\n\t/** Whether the executed tool result is currently treated as an error. */\n\tisError: boolean;\n\t/** Current agent context at the time the tool call is finalized. */\n\tcontext: AgentContext;\n}\n\n/** Context passed to `shouldStopAfterTurn`. */\nexport interface ShouldStopAfterTurnContext {\n\t/** The assistant message that completed the turn. */\n\tmessage: AssistantMessage;\n\t/** Tool result messages passed to the preceding `turn_end` event. */\n\ttoolResults: ToolResultMessage[];\n\t/** Current agent context after the turn's assistant message and tool results have been appended. */\n\tcontext: AgentContext;\n\t/** Messages that this loop invocation will return if it exits at this point. Prompt runs include the initial prompt messages; continuation runs do not include pre-existing context messages. */\n\tnewMessages: AgentMessage[];\n}\n\n/** Replacement runtime state used by the agent loop before starting another provider request. */\nexport interface AgentLoopTurnUpdate {\n\t/** Context for the next provider request. */\n\tcontext?: AgentContext;\n\t/** Model for the next provider request. */\n\tmodel?: Model<any>;\n\t/** Thinking level for the next provider request. */\n\tthinkingLevel?: ThinkingLevel;\n}\n\nexport interface PrepareNextTurnContext extends ShouldStopAfterTurnContext {}\n\nexport interface AgentLoopConfig extends SimpleStreamOptions {\n\tmodel: Model<any>;\n\n\t/**\n\t * Converts AgentMessage[] to LLM-compatible Message[] before each LLM call.\n\t *\n\t * Each AgentMessage must be converted to a UserMessage, AssistantMessage, or ToolResultMessage\n\t * that the LLM can understand. AgentMessages that cannot be converted (e.g., UI-only notifications,\n\t * status messages) should be filtered out.\n\t *\n\t * Contract: must not throw or reject. Return a safe fallback value instead.\n\t * Throwing interrupts the low-level agent loop without producing a normal event sequence.\n\t *\n\t * @example\n\t * ```typescript\n\t * convertToLlm: (messages) => messages.flatMap(m => {\n\t * if (m.role === \"custom\") {\n\t * // Convert custom message to user message\n\t * return [{ role: \"user\", content: m.content, timestamp: m.timestamp }];\n\t * }\n\t * if (m.role === \"notification\") {\n\t * // Filter out UI-only messages\n\t * return [];\n\t * }\n\t * // Pass through standard LLM messages\n\t * return [m];\n\t * })\n\t * ```\n\t */\n\tconvertToLlm: (messages: AgentMessage[]) => Message[] | Promise<Message[]>;\n\n\t/**\n\t * Optional transform applied to the context before `convertToLlm`.\n\t *\n\t * Use this for operations that work at the AgentMessage level:\n\t * - Context window management (pruning old messages)\n\t * - Injecting context from external sources\n\t *\n\t * Contract: must not throw or reject. Return the original messages or another\n\t * safe fallback value instead.\n\t *\n\t * @example\n\t * ```typescript\n\t * transformContext: async (messages) => {\n\t * if (estimateTokens(messages) > MAX_TOKENS) {\n\t * return pruneOldMessages(messages);\n\t * }\n\t * return messages;\n\t * }\n\t * ```\n\t */\n\ttransformContext?: (messages: AgentMessage[], signal?: AbortSignal) => Promise<AgentMessage[]>;\n\n\t/**\n\t * Resolves an API key dynamically for each LLM call.\n\t *\n\t * Useful for short-lived OAuth tokens (e.g., GitHub Copilot) that may expire\n\t * during long-running tool execution phases.\n\t *\n\t * Contract: must not throw or reject. Return undefined when no key is available.\n\t */\n\tgetApiKey?: (provider: string) => Promise<string | undefined> | string | undefined;\n\n\t/**\n\t * Called after each turn fully completes and `turn_end` has been emitted.\n\t *\n\t * If it returns true, the loop emits `agent_end` and exits before polling steering or follow-up queues,\n\t * without starting another LLM call. The current assistant response and any tool executions finish normally.\n\t *\n\t * Use this to request a graceful stop after the current turn, e.g. before context gets too full.\n\t *\n\t * Contract: must not throw or reject. Throwing interrupts the low-level agent loop without producing a normal event sequence.\n\t */\n\tshouldStopAfterTurn?: (context: ShouldStopAfterTurnContext) => boolean | Promise<boolean>;\n\n\t/**\n\t * Called after `turn_end` and before the loop decides whether another provider request should start.\n\t * Return replacement context/model/thinking state to affect the next turn in this run.\n\t * Return undefined to keep using the current context/config.\n\t */\n\tprepareNextTurn?: (\n\t\tcontext: PrepareNextTurnContext,\n\t) => AgentLoopTurnUpdate | undefined | Promise<AgentLoopTurnUpdate | undefined>;\n\n\t/**\n\t * Returns steering messages to inject into the conversation mid-run.\n\t *\n\t * Called after the current assistant turn finishes executing its tool calls, unless `shouldStopAfterTurn` exits first.\n\t * If messages are returned, they are added to the context before the next LLM call.\n\t * Tool calls from the current assistant message are not skipped.\n\t *\n\t * Use this for \"steering\" the agent while it's working.\n\t *\n\t * Contract: must not throw or reject. Return [] when no steering messages are available.\n\t */\n\tgetSteeringMessages?: () => Promise<AgentMessage[]>;\n\n\t/**\n\t * Returns follow-up messages to process after the agent would otherwise stop.\n\t *\n\t * Called when the agent has no more tool calls and no steering messages.\n\t * If messages are returned, they're added to the context and the agent\n\t * continues with another turn.\n\t *\n\t * Use this for follow-up messages that should wait until the agent finishes.\n\t *\n\t * Contract: must not throw or reject. Return [] when no follow-up messages are available.\n\t */\n\tgetFollowUpMessages?: () => Promise<AgentMessage[]>;\n\n\t/**\n\t * Tool execution mode.\n\t * - \"sequential\": execute tool calls one by one\n\t * - \"parallel\": preflight tool calls sequentially, then execute allowed tools concurrently;\n\t * emit `tool_execution_end` in tool completion order after each tool is finalized,\n\t * then emit tool-result message artifacts later in assistant source order\n\t *\n\t * Default: \"parallel\"\n\t */\n\ttoolExecution?: ToolExecutionMode;\n\n\t/**\n\t * Called before a tool is executed, after arguments have been validated.\n\t *\n\t * Return `{ block: true }` to prevent execution. The loop emits an error tool result instead.\n\t * A blocked result can also set `terminate: true` to participate in the batch early-termination rule.\n\t * The hook receives the agent abort signal and is responsible for honoring it.\n\t */\n\tbeforeToolCall?: (context: BeforeToolCallContext, signal?: AbortSignal) => Promise<BeforeToolCallResult | undefined>;\n\n\t/**\n\t * Called after a tool finishes executing, before `tool_execution_end` and tool-result message events are emitted.\n\t *\n\t * Return an `AfterToolCallResult` to override parts of the executed tool result:\n\t * - `content` replaces the full content array\n\t * - `details` replaces the full details payload\n\t * - `isError` replaces the error flag\n\t * - `usage` replaces the tool result usage\n\t * - `terminate` replaces the early-termination hint\n\t *\n\t * Any omitted fields keep their original values. No deep merge is performed.\n\t * The hook receives the agent abort signal and is responsible for honoring it.\n\t */\n\tafterToolCall?: (context: AfterToolCallContext, signal?: AbortSignal) => Promise<AfterToolCallResult | undefined>;\n}\n\n/**\n * Thinking/reasoning level for models that support it.\n * Note: \"xhigh\" and \"max\" are only supported by selected model families. Use model\n * thinking-level metadata from @earendil-works/pi-ai to detect support for a concrete model.\n */\nexport type ThinkingLevel = \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\n\n/**\n * Extensible interface for custom app messages.\n * Apps can extend via declaration merging:\n *\n * @example\n * ```typescript\n * declare module \"@mariozechner/agent\" {\n * interface CustomAgentMessages {\n * artifact: ArtifactMessage;\n * notification: NotificationMessage;\n * }\n * }\n * ```\n */\nexport interface CustomAgentMessages {\n\t// Empty by default - apps extend via declaration merging\n}\n\n/**\n * AgentMessage: Union of LLM messages + custom messages.\n * This abstraction allows apps to add custom message types while maintaining\n * type safety and compatibility with the base LLM messages.\n */\nexport type AgentMessage = Message | CustomAgentMessages[keyof CustomAgentMessages];\n\n/**\n * Public agent state.\n *\n * `tools` and `messages` use accessor properties so implementations can copy\n * assigned arrays before storing them.\n */\nexport interface AgentState {\n\t/** System prompt sent with each model request. */\n\tsystemPrompt: string;\n\t/** Active model used for future turns. */\n\tmodel: Model<any>;\n\t/** Requested reasoning level for future turns. */\n\tthinkingLevel: ThinkingLevel;\n\t/** Available tools. Assigning a new array copies the top-level array. */\n\tset tools(tools: AgentTool<any>[]);\n\tget tools(): AgentTool<any>[];\n\t/** Conversation transcript. Assigning a new array copies the top-level array. */\n\tset messages(messages: AgentMessage[]);\n\tget messages(): AgentMessage[];\n\t/**\n\t * True while the agent is processing a prompt or continuation.\n\t *\n\t * This remains true until awaited `agent_end` listeners settle.\n\t */\n\treadonly isStreaming: boolean;\n\t/** Partial assistant message for the current streamed response, if any. */\n\treadonly streamingMessage?: AgentMessage;\n\t/** Tool call ids currently executing. */\n\treadonly pendingToolCalls: ReadonlySet<string>;\n\t/** Error message from the most recent failed or aborted assistant turn, if any. */\n\treadonly errorMessage?: string;\n}\n\n/** Final or partial result produced by a tool. */\nexport interface AgentToolResult<T> {\n\t/** Text or image content returned to the model. */\n\tcontent: (TextContent | ImageContent)[];\n\t/** Arbitrary structured details for logs or UI rendering. */\n\tdetails: T;\n\t/** Usage from the final tool execution itself, if available. Not used for main LLM context accounting. */\n\tusage?: Usage;\n\t/** Names of tools introduced by this result and available from this transcript point onward. */\n\taddedToolNames?: string[];\n\t/**\n\t * Hint that the agent should stop after the current tool batch.\n\t * Early termination only happens when every finalized tool result in the batch sets this to true.\n\t */\n\tterminate?: boolean;\n}\n\n/**\n * Callback used by tools to stream partial execution updates.\n *\n * The callback is scoped to the current `execute()` invocation. Calls made after\n * the tool promise settles are ignored.\n */\nexport type AgentToolUpdateCallback<T = any> = (partialResult: AgentToolResult<T>) => void;\n\n/** Tool definition used by the agent runtime. */\nexport interface AgentTool<TParameters extends TSchema = TSchema, TDetails = any> extends Tool<TParameters> {\n\t/** Human-readable label for UI display. */\n\tlabel: string;\n\t/**\n\t * Optional compatibility shim for raw tool-call arguments before schema validation.\n\t * Must return an object that matches `TParameters`.\n\t */\n\tprepareArguments?: (args: unknown) => Static<TParameters>;\n\t/** Execute the tool call. Throw on failure instead of encoding errors in `content`. */\n\texecute: (\n\t\ttoolCallId: string,\n\t\tparams: Static<TParameters>,\n\t\tsignal?: AbortSignal,\n\t\tonUpdate?: AgentToolUpdateCallback<TDetails>,\n\t) => Promise<AgentToolResult<TDetails>>;\n\t/**\n\t * Per-tool execution mode override.\n\t * - \"sequential\": this tool must execute one at a time with other tool calls.\n\t * - \"parallel\": this tool can execute concurrently with other tool calls.\n\t *\n\t * If omitted, the default execution mode applies.\n\t */\n\texecutionMode?: ToolExecutionMode;\n}\n\n/** Context snapshot passed into the low-level agent loop. */\nexport interface AgentContext {\n\t/** System prompt included with the request. */\n\tsystemPrompt: string;\n\t/** Transcript visible to the model. */\n\tmessages: AgentMessage[];\n\t/** Tools available for this run. */\n\ttools?: AgentTool<any>[];\n}\n\n/**\n * Events emitted by the Agent for UI updates.\n *\n * `agent_end` is the last event emitted for a run, but awaited `Agent.subscribe()`\n * listeners for that event are still part of run settlement. The agent becomes\n * idle only after those listeners finish.\n */\nexport type AgentEvent =\n\t// Agent lifecycle\n\t| { type: \"agent_start\" }\n\t| { type: \"agent_end\"; messages: AgentMessage[] }\n\t// Turn lifecycle - a turn is one assistant response + any tool calls/results\n\t| { type: \"turn_start\" }\n\t| { type: \"turn_end\"; message: AgentMessage; toolResults: ToolResultMessage[] }\n\t// Message lifecycle - emitted for user, assistant, and toolResult messages\n\t| { type: \"message_start\"; message: AgentMessage }\n\t// Only emitted for assistant messages during streaming\n\t| { type: \"message_update\"; message: AgentMessage; assistantMessageEvent: AssistantMessageEvent }\n\t| { type: \"message_end\"; message: AgentMessage }\n\t// Tool execution lifecycle\n\t| { type: \"tool_execution_start\"; toolCallId: string; toolName: string; args: any }\n\t| { type: \"tool_execution_update\"; toolCallId: string; toolName: string; args: any; partialResult: any }\n\t| { type: \"tool_execution_end\"; toolCallId: string; toolName: string; result: any; isError: boolean };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n\tApi,\n\tAssistantMessage,\n\tAssistantMessageEvent,\n\tAssistantMessageEventStream,\n\tContext,\n\tImageContent,\n\tMessage,\n\tModel,\n\tSimpleStreamOptions,\n\tTextContent,\n\tTool,\n\tToolResultMessage,\n\tUsage,\n} from \"@earendil-works/pi-ai\";\nimport type { Static, TSchema } from \"typebox\";\n\n/**\n * Stream function used by the agent loop. `Models.streamSimple` satisfies\n * this shape.\n *\n * Contract:\n * - Must not throw or return a rejected promise for request/model/runtime failures.\n * - Must return an AssistantMessageEventStream.\n * - Failures must be encoded in the returned stream via protocol events and a\n * final AssistantMessage with stopReason \"error\" or \"aborted\" and errorMessage.\n */\nexport type StreamFn = (\n\tmodel: Model<Api>,\n\tcontext: Context,\n\toptions?: SimpleStreamOptions,\n) => AssistantMessageEventStream | Promise<AssistantMessageEventStream>;\n\n/**\n * Configuration for how tool calls from a single assistant message are executed.\n *\n * - \"sequential\": each tool call is prepared, executed, and finalized before the next one starts.\n * - \"parallel\": tool calls are prepared sequentially, then allowed tools execute concurrently.\n * `tool_execution_end` is emitted in tool completion order after each tool is finalized,\n * while tool-result message artifacts are emitted later in assistant source order.\n */\nexport type ToolExecutionMode = \"sequential\" | \"parallel\";\n\n/**\n * Controls how many queued user messages are injected when the agent loop reaches a queue drain point.\n *\n * - \"all\": drain and inject every queued message at that point.\n * - \"one-at-a-time\": drain and inject only the oldest queued message, leaving the rest queued for later drain points.\n */\nexport type QueueMode = \"all\" | \"one-at-a-time\";\n\n/** A single tool call content block emitted by an assistant message. */\nexport type AgentToolCall = Extract<AssistantMessage[\"content\"][number], { type: \"toolCall\" }>;\n\n/**\n * Result returned from `beforeToolCall`.\n *\n * Returning `{ block: true }` prevents the tool from executing. The loop emits an error tool result instead.\n * `reason` becomes the text shown in that error result. If omitted, a default blocked message is used.\n */\nexport interface BeforeToolCallResult {\n\tblock?: boolean;\n\treason?: string;\n}\n\n/**\n * Partial override returned from `afterToolCall`.\n *\n * Merge semantics are field-by-field:\n * - `content`: if provided, replaces the tool result content array in full\n * - `details`: if provided, replaces the tool result details value in full\n * - `isError`: if provided, replaces the tool result error flag\n * - `usage`: if provided, replaces the tool result usage\n * - `terminate`: if provided, replaces the early-termination hint\n *\n * Omitted fields keep the original executed tool result values.\n * There is no deep merge for `content`, `details`, or `usage`.\n */\nexport interface AfterToolCallResult {\n\tcontent?: (TextContent | ImageContent)[];\n\tdetails?: unknown;\n\tisError?: boolean;\n\t/** Usage from the final tool execution itself, if available. Not used for main LLM context accounting. */\n\tusage?: Usage;\n\t/**\n\t * Hint that the agent should stop after the current tool batch.\n\t * Early termination only happens when every finalized tool result in the batch sets this to true.\n\t */\n\tterminate?: boolean;\n}\n\n/** Context passed to `beforeToolCall`. */\nexport interface BeforeToolCallContext {\n\t/** The assistant message that requested the tool call. */\n\tassistantMessage: AssistantMessage;\n\t/** The raw tool call block from `assistantMessage.content`. */\n\ttoolCall: AgentToolCall;\n\t/** Validated tool arguments for the target tool schema. */\n\targs: unknown;\n\t/** Current agent context at the time the tool call is prepared. */\n\tcontext: AgentContext;\n}\n\n/** Context passed to `afterToolCall`. */\nexport interface AfterToolCallContext {\n\t/** The assistant message that requested the tool call. */\n\tassistantMessage: AssistantMessage;\n\t/** The raw tool call block from `assistantMessage.content`. */\n\ttoolCall: AgentToolCall;\n\t/** Validated tool arguments for the target tool schema. */\n\targs: unknown;\n\t/** The executed tool result before any `afterToolCall` overrides are applied. */\n\tresult: AgentToolResult<any>;\n\t/** Whether the executed tool result is currently treated as an error. */\n\tisError: boolean;\n\t/** Current agent context at the time the tool call is finalized. */\n\tcontext: AgentContext;\n}\n\n/** Context passed to `shouldStopAfterTurn`. */\nexport interface ShouldStopAfterTurnContext {\n\t/** The assistant message that completed the turn. */\n\tmessage: AssistantMessage;\n\t/** Tool result messages passed to the preceding `turn_end` event. */\n\ttoolResults: ToolResultMessage[];\n\t/** Current agent context after the turn's assistant message and tool results have been appended. */\n\tcontext: AgentContext;\n\t/** Messages that this loop invocation will return if it exits at this point. Prompt runs include the initial prompt messages; continuation runs do not include pre-existing context messages. */\n\tnewMessages: AgentMessage[];\n}\n\n/** Replacement runtime state used by the agent loop before starting another provider request. */\nexport interface AgentLoopTurnUpdate {\n\t/** Context for the next provider request. */\n\tcontext?: AgentContext;\n\t/** Model for the next provider request. */\n\tmodel?: Model<any>;\n\t/** Thinking level for the next provider request. */\n\tthinkingLevel?: ThinkingLevel;\n}\n\nexport interface PrepareNextTurnContext extends ShouldStopAfterTurnContext {}\n\nexport interface AgentLoopConfig extends SimpleStreamOptions {\n\tmodel: Model<any>;\n\n\t/**\n\t * Converts AgentMessage[] to LLM-compatible Message[] before each LLM call.\n\t *\n\t * Each AgentMessage must be converted to a UserMessage, AssistantMessage, or ToolResultMessage\n\t * that the LLM can understand. AgentMessages that cannot be converted (e.g., UI-only notifications,\n\t * status messages) should be filtered out.\n\t *\n\t * Contract: must not throw or reject. Return a safe fallback value instead.\n\t * Throwing interrupts the low-level agent loop without producing a normal event sequence.\n\t *\n\t * @example\n\t * ```typescript\n\t * convertToLlm: (messages) => messages.flatMap(m => {\n\t * if (m.role === \"custom\") {\n\t * // Convert custom message to user message\n\t * return [{ role: \"user\", content: m.content, timestamp: m.timestamp }];\n\t * }\n\t * if (m.role === \"notification\") {\n\t * // Filter out UI-only messages\n\t * return [];\n\t * }\n\t * // Pass through standard LLM messages\n\t * return [m];\n\t * })\n\t * ```\n\t */\n\tconvertToLlm: (messages: AgentMessage[]) => Message[] | Promise<Message[]>;\n\n\t/**\n\t * Optional transform applied to the context before `convertToLlm`.\n\t *\n\t * Use this for operations that work at the AgentMessage level:\n\t * - Context window management (pruning old messages)\n\t * - Injecting context from external sources\n\t *\n\t * Contract: must not throw or reject. Return the original messages or another\n\t * safe fallback value instead.\n\t *\n\t * @example\n\t * ```typescript\n\t * transformContext: async (messages) => {\n\t * if (estimateTokens(messages) > MAX_TOKENS) {\n\t * return pruneOldMessages(messages);\n\t * }\n\t * return messages;\n\t * }\n\t * ```\n\t */\n\ttransformContext?: (messages: AgentMessage[], signal?: AbortSignal) => Promise<AgentMessage[]>;\n\n\t/**\n\t * Resolves an API key dynamically for each LLM call.\n\t *\n\t * Useful for short-lived OAuth tokens (e.g., GitHub Copilot) that may expire\n\t * during long-running tool execution phases.\n\t *\n\t * Contract: must not throw or reject. Return undefined when no key is available.\n\t */\n\tgetApiKey?: (provider: string) => Promise<string | undefined> | string | undefined;\n\n\t/**\n\t * Called after each turn fully completes and `turn_end` has been emitted.\n\t *\n\t * If it returns true, the loop emits `agent_end` and exits before polling steering or follow-up queues,\n\t * without starting another LLM call. The current assistant response and any tool executions finish normally.\n\t *\n\t * Use this to request a graceful stop after the current turn, e.g. before context gets too full.\n\t *\n\t * Contract: must not throw or reject. Throwing interrupts the low-level agent loop without producing a normal event sequence.\n\t */\n\tshouldStopAfterTurn?: (context: ShouldStopAfterTurnContext) => boolean | Promise<boolean>;\n\n\t/**\n\t * Called after `turn_end` and before the loop decides whether another provider request should start.\n\t * Return replacement context/model/thinking state to affect the next turn in this run.\n\t * Return undefined to keep using the current context/config.\n\t */\n\tprepareNextTurn?: (\n\t\tcontext: PrepareNextTurnContext,\n\t) => AgentLoopTurnUpdate | undefined | Promise<AgentLoopTurnUpdate | undefined>;\n\n\t/**\n\t * Returns steering messages to inject into the conversation mid-run.\n\t *\n\t * Called after the current assistant turn finishes executing its tool calls, unless `shouldStopAfterTurn` exits first.\n\t * If messages are returned, they are added to the context before the next LLM call.\n\t * Tool calls from the current assistant message are not skipped.\n\t *\n\t * Use this for \"steering\" the agent while it's working.\n\t *\n\t * Contract: must not throw or reject. Return [] when no steering messages are available.\n\t */\n\tgetSteeringMessages?: () => Promise<AgentMessage[]>;\n\n\t/**\n\t * Returns follow-up messages to process after the agent would otherwise stop.\n\t *\n\t * Called when the agent has no more tool calls and no steering messages.\n\t * If messages are returned, they're added to the context and the agent\n\t * continues with another turn.\n\t *\n\t * Use this for follow-up messages that should wait until the agent finishes.\n\t *\n\t * Contract: must not throw or reject. Return [] when no follow-up messages are available.\n\t */\n\tgetFollowUpMessages?: () => Promise<AgentMessage[]>;\n\n\t/**\n\t * Tool execution mode.\n\t * - \"sequential\": execute tool calls one by one\n\t * - \"parallel\": preflight tool calls sequentially, then execute allowed tools concurrently;\n\t * emit `tool_execution_end` in tool completion order after each tool is finalized,\n\t * then emit tool-result message artifacts later in assistant source order\n\t *\n\t * Default: \"parallel\"\n\t */\n\ttoolExecution?: ToolExecutionMode;\n\n\t/**\n\t * Called before a tool is executed, after arguments have been validated.\n\t *\n\t * Return `{ block: true }` to prevent execution. The loop emits an error tool result instead.\n\t * The hook receives the agent abort signal and is responsible for honoring it.\n\t */\n\tbeforeToolCall?: (context: BeforeToolCallContext, signal?: AbortSignal) => Promise<BeforeToolCallResult | undefined>;\n\n\t/**\n\t * Called after a tool finishes executing, before `tool_execution_end` and tool-result message events are emitted.\n\t *\n\t * Return an `AfterToolCallResult` to override parts of the executed tool result:\n\t * - `content` replaces the full content array\n\t * - `details` replaces the full details payload\n\t * - `isError` replaces the error flag\n\t * - `usage` replaces the tool result usage\n\t * - `terminate` replaces the early-termination hint\n\t *\n\t * Any omitted fields keep their original values. No deep merge is performed.\n\t * The hook receives the agent abort signal and is responsible for honoring it.\n\t */\n\tafterToolCall?: (context: AfterToolCallContext, signal?: AbortSignal) => Promise<AfterToolCallResult | undefined>;\n}\n\n/**\n * Thinking/reasoning level for models that support it.\n * Note: \"xhigh\" and \"max\" are only supported by selected model families. Use model\n * thinking-level metadata from @earendil-works/pi-ai to detect support for a concrete model.\n */\nexport type ThinkingLevel = \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\n\n/**\n * Extensible interface for custom app messages.\n * Apps can extend via declaration merging:\n *\n * @example\n * ```typescript\n * declare module \"@mariozechner/agent\" {\n * interface CustomAgentMessages {\n * artifact: ArtifactMessage;\n * notification: NotificationMessage;\n * }\n * }\n * ```\n */\nexport interface CustomAgentMessages {\n\t// Empty by default - apps extend via declaration merging\n}\n\n/**\n * AgentMessage: Union of LLM messages + custom messages.\n * This abstraction allows apps to add custom message types while maintaining\n * type safety and compatibility with the base LLM messages.\n */\nexport type AgentMessage = Message | CustomAgentMessages[keyof CustomAgentMessages];\n\n/**\n * Public agent state.\n *\n * `tools` and `messages` use accessor properties so implementations can copy\n * assigned arrays before storing them.\n */\nexport interface AgentState {\n\t/** System prompt sent with each model request. */\n\tsystemPrompt: string;\n\t/** Active model used for future turns. */\n\tmodel: Model<any>;\n\t/** Requested reasoning level for future turns. */\n\tthinkingLevel: ThinkingLevel;\n\t/** Available tools. Assigning a new array copies the top-level array. */\n\tset tools(tools: AgentTool<any>[]);\n\tget tools(): AgentTool<any>[];\n\t/** Conversation transcript. Assigning a new array copies the top-level array. */\n\tset messages(messages: AgentMessage[]);\n\tget messages(): AgentMessage[];\n\t/**\n\t * True while the agent is processing a prompt or continuation.\n\t *\n\t * This remains true until awaited `agent_end` listeners settle.\n\t */\n\treadonly isStreaming: boolean;\n\t/** Partial assistant message for the current streamed response, if any. */\n\treadonly streamingMessage?: AgentMessage;\n\t/** Tool call ids currently executing. */\n\treadonly pendingToolCalls: ReadonlySet<string>;\n\t/** Error message from the most recent failed or aborted assistant turn, if any. */\n\treadonly errorMessage?: string;\n}\n\n/** Final or partial result produced by a tool. */\nexport interface AgentToolResult<T> {\n\t/** Text or image content returned to the model. */\n\tcontent: (TextContent | ImageContent)[];\n\t/** Arbitrary structured details for logs or UI rendering. */\n\tdetails: T;\n\t/** Usage from the final tool execution itself, if available. Not used for main LLM context accounting. */\n\tusage?: Usage;\n\t/** Names of tools introduced by this result and available from this transcript point onward. */\n\taddedToolNames?: string[];\n\t/**\n\t * Hint that the agent should stop after the current tool batch.\n\t * Early termination only happens when every finalized tool result in the batch sets this to true.\n\t */\n\tterminate?: boolean;\n}\n\n/**\n * Callback used by tools to stream partial execution updates.\n *\n * The callback is scoped to the current `execute()` invocation. Calls made after\n * the tool promise settles are ignored.\n */\nexport type AgentToolUpdateCallback<T = any> = (partialResult: AgentToolResult<T>) => void;\n\n/** Tool definition used by the agent runtime. */\nexport interface AgentTool<TParameters extends TSchema = TSchema, TDetails = any> extends Tool<TParameters> {\n\t/** Human-readable label for UI display. */\n\tlabel: string;\n\t/**\n\t * Optional compatibility shim for raw tool-call arguments before schema validation.\n\t * Must return an object that matches `TParameters`.\n\t */\n\tprepareArguments?: (args: unknown) => Static<TParameters>;\n\t/** Execute the tool call. Throw on failure instead of encoding errors in `content`. */\n\texecute: (\n\t\ttoolCallId: string,\n\t\tparams: Static<TParameters>,\n\t\tsignal?: AbortSignal,\n\t\tonUpdate?: AgentToolUpdateCallback<TDetails>,\n\t) => Promise<AgentToolResult<TDetails>>;\n\t/**\n\t * Per-tool execution mode override.\n\t * - \"sequential\": this tool must execute one at a time with other tool calls.\n\t * - \"parallel\": this tool can execute concurrently with other tool calls.\n\t *\n\t * If omitted, the default execution mode applies.\n\t */\n\texecutionMode?: ToolExecutionMode;\n}\n\n/** Context snapshot passed into the low-level agent loop. */\nexport interface AgentContext {\n\t/** System prompt included with the request. */\n\tsystemPrompt: string;\n\t/** Transcript visible to the model. */\n\tmessages: AgentMessage[];\n\t/** Tools available for this run. */\n\ttools?: AgentTool<any>[];\n}\n\n/**\n * Events emitted by the Agent for UI updates.\n *\n * `agent_end` is the last event emitted for a run, but awaited `Agent.subscribe()`\n * listeners for that event are still part of run settlement. The agent becomes\n * idle only after those listeners finish.\n */\nexport type AgentEvent =\n\t// Agent lifecycle\n\t| { type: \"agent_start\" }\n\t| { type: \"agent_end\"; messages: AgentMessage[] }\n\t// Turn lifecycle - a turn is one assistant response + any tool calls/results\n\t| { type: \"turn_start\" }\n\t| { type: \"turn_end\"; message: AgentMessage; toolResults: ToolResultMessage[] }\n\t// Message lifecycle - emitted for user, assistant, and toolResult messages\n\t| { type: \"message_start\"; message: AgentMessage }\n\t// Only emitted for assistant messages during streaming\n\t| { type: \"message_update\"; message: AgentMessage; assistantMessageEvent: AssistantMessageEvent }\n\t| { type: \"message_end\"; message: AgentMessage }\n\t// Tool execution lifecycle\n\t| { type: \"tool_execution_start\"; toolCallId: string; toolName: string; args: any }\n\t| { type: \"tool_execution_update\"; toolCallId: string; toolName: string; args: any; partialResult: any }\n\t| { type: \"tool_execution_end\"; toolCallId: string; toolName: string; result: any; isError: boolean };\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n\tApi,\n\tAssistantMessage,\n\tAssistantMessageEvent,\n\tAssistantMessageEventStream,\n\tContext,\n\tImageContent,\n\tMessage,\n\tModel,\n\tSimpleStreamOptions,\n\tTextContent,\n\tTool,\n\tToolResultMessage,\n\tUsage,\n} from \"@earendil-works/pi-ai\";\nimport type { Static, TSchema } from \"typebox\";\n\n/**\n * Stream function used by the agent loop. `Models.streamSimple` satisfies\n * this shape.\n *\n * Contract:\n * - Must not throw or return a rejected promise for request/model/runtime failures.\n * - Must return an AssistantMessageEventStream.\n * - Failures must be encoded in the returned stream via protocol events and a\n * final AssistantMessage with stopReason \"error\" or \"aborted\" and errorMessage.\n */\nexport type StreamFn = (\n\tmodel: Model<Api>,\n\tcontext: Context,\n\toptions?: SimpleStreamOptions,\n) => AssistantMessageEventStream | Promise<AssistantMessageEventStream>;\n\n/**\n * Configuration for how tool calls from a single assistant message are executed.\n *\n * - \"sequential\": each tool call is prepared, executed, and finalized before the next one starts.\n * - \"parallel\": tool calls are prepared sequentially, then allowed tools execute concurrently.\n * `tool_execution_end` is emitted in tool completion order after each tool is finalized,\n * while tool-result message artifacts are emitted later in assistant source order.\n */\nexport type ToolExecutionMode = \"sequential\" | \"parallel\";\n\n/**\n * Controls how many queued user messages are injected when the agent loop reaches a queue drain point.\n *\n * - \"all\": drain and inject every queued message at that point.\n * - \"one-at-a-time\": drain and inject only the oldest queued message, leaving the rest queued for later drain points.\n */\nexport type QueueMode = \"all\" | \"one-at-a-time\";\n\n/** A single tool call content block emitted by an assistant message. */\nexport type AgentToolCall = Extract<AssistantMessage[\"content\"][number], { type: \"toolCall\" }>;\n\n/**\n * Result returned from `beforeToolCall`.\n *\n * Returning `{ block: true }` prevents the tool from executing. The loop emits an error tool result instead.\n * `reason` becomes the text shown in that error result. If omitted, a default blocked message is used.\n */\nexport interface BeforeToolCallResult {\n\tblock?: boolean;\n\treason?: string;\n\t/**\n\t * Hint that the agent should stop after the current tool batch when this call is blocked.\n\t * Early termination only happens when every finalized tool result in the batch sets this to true.\n\t */\n\tterminate?: boolean;\n}\n\n/**\n * Partial override returned from `afterToolCall`.\n *\n * Merge semantics are field-by-field:\n * - `content`: if provided, replaces the tool result content array in full\n * - `details`: if provided, replaces the tool result details value in full\n * - `isError`: if provided, replaces the tool result error flag\n * - `usage`: if provided, replaces the tool result usage\n * - `terminate`: if provided, replaces the early-termination hint\n *\n * Omitted fields keep the original executed tool result values.\n * There is no deep merge for `content`, `details`, or `usage`.\n */\nexport interface AfterToolCallResult {\n\tcontent?: (TextContent | ImageContent)[];\n\tdetails?: unknown;\n\tisError?: boolean;\n\t/** Usage from the final tool execution itself, if available. Not used for main LLM context accounting. */\n\tusage?: Usage;\n\t/**\n\t * Hint that the agent should stop after the current tool batch.\n\t * Early termination only happens when every finalized tool result in the batch sets this to true.\n\t */\n\tterminate?: boolean;\n}\n\n/** Context passed to `beforeToolCall`. */\nexport interface BeforeToolCallContext {\n\t/** The assistant message that requested the tool call. */\n\tassistantMessage: AssistantMessage;\n\t/** The raw tool call block from `assistantMessage.content`. */\n\ttoolCall: AgentToolCall;\n\t/** Validated tool arguments for the target tool schema. */\n\targs: unknown;\n\t/** Current agent context at the time the tool call is prepared. */\n\tcontext: AgentContext;\n}\n\n/** Context passed to `afterToolCall`. */\nexport interface AfterToolCallContext {\n\t/** The assistant message that requested the tool call. */\n\tassistantMessage: AssistantMessage;\n\t/** The raw tool call block from `assistantMessage.content`. */\n\ttoolCall: AgentToolCall;\n\t/** Validated tool arguments for the target tool schema. */\n\targs: unknown;\n\t/** The executed tool result before any `afterToolCall` overrides are applied. */\n\tresult: AgentToolResult<any>;\n\t/** Whether the executed tool result is currently treated as an error. */\n\tisError: boolean;\n\t/** Current agent context at the time the tool call is finalized. */\n\tcontext: AgentContext;\n}\n\n/** Context passed to `shouldStopAfterTurn`. */\nexport interface ShouldStopAfterTurnContext {\n\t/** The assistant message that completed the turn. */\n\tmessage: AssistantMessage;\n\t/** Tool result messages passed to the preceding `turn_end` event. */\n\ttoolResults: ToolResultMessage[];\n\t/** Current agent context after the turn's assistant message and tool results have been appended. */\n\tcontext: AgentContext;\n\t/** Messages that this loop invocation will return if it exits at this point. Prompt runs include the initial prompt messages; continuation runs do not include pre-existing context messages. */\n\tnewMessages: AgentMessage[];\n}\n\n/** Replacement runtime state used by the agent loop before starting another provider request. */\nexport interface AgentLoopTurnUpdate {\n\t/** Context for the next provider request. */\n\tcontext?: AgentContext;\n\t/** Model for the next provider request. */\n\tmodel?: Model<any>;\n\t/** Thinking level for the next provider request. */\n\tthinkingLevel?: ThinkingLevel;\n}\n\nexport interface PrepareNextTurnContext extends ShouldStopAfterTurnContext {}\n\nexport interface AgentLoopConfig extends SimpleStreamOptions {\n\tmodel: Model<any>;\n\n\t/**\n\t * Converts AgentMessage[] to LLM-compatible Message[] before each LLM call.\n\t *\n\t * Each AgentMessage must be converted to a UserMessage, AssistantMessage, or ToolResultMessage\n\t * that the LLM can understand. AgentMessages that cannot be converted (e.g., UI-only notifications,\n\t * status messages) should be filtered out.\n\t *\n\t * Contract: must not throw or reject. Return a safe fallback value instead.\n\t * Throwing interrupts the low-level agent loop without producing a normal event sequence.\n\t *\n\t * @example\n\t * ```typescript\n\t * convertToLlm: (messages) => messages.flatMap(m => {\n\t * if (m.role === \"custom\") {\n\t * // Convert custom message to user message\n\t * return [{ role: \"user\", content: m.content, timestamp: m.timestamp }];\n\t * }\n\t * if (m.role === \"notification\") {\n\t * // Filter out UI-only messages\n\t * return [];\n\t * }\n\t * // Pass through standard LLM messages\n\t * return [m];\n\t * })\n\t * ```\n\t */\n\tconvertToLlm: (messages: AgentMessage[]) => Message[] | Promise<Message[]>;\n\n\t/**\n\t * Optional transform applied to the context before `convertToLlm`.\n\t *\n\t * Use this for operations that work at the AgentMessage level:\n\t * - Context window management (pruning old messages)\n\t * - Injecting context from external sources\n\t *\n\t * Contract: must not throw or reject. Return the original messages or another\n\t * safe fallback value instead.\n\t *\n\t * @example\n\t * ```typescript\n\t * transformContext: async (messages) => {\n\t * if (estimateTokens(messages) > MAX_TOKENS) {\n\t * return pruneOldMessages(messages);\n\t * }\n\t * return messages;\n\t * }\n\t * ```\n\t */\n\ttransformContext?: (messages: AgentMessage[], signal?: AbortSignal) => Promise<AgentMessage[]>;\n\n\t/**\n\t * Resolves an API key dynamically for each LLM call.\n\t *\n\t * Useful for short-lived OAuth tokens (e.g., GitHub Copilot) that may expire\n\t * during long-running tool execution phases.\n\t *\n\t * Contract: must not throw or reject. Return undefined when no key is available.\n\t */\n\tgetApiKey?: (provider: string) => Promise<string | undefined> | string | undefined;\n\n\t/**\n\t * Called after each turn fully completes and `turn_end` has been emitted.\n\t *\n\t * If it returns true, the loop emits `agent_end` and exits before polling steering or follow-up queues,\n\t * without starting another LLM call. The current assistant response and any tool executions finish normally.\n\t *\n\t * Use this to request a graceful stop after the current turn, e.g. before context gets too full.\n\t *\n\t * Contract: must not throw or reject. Throwing interrupts the low-level agent loop without producing a normal event sequence.\n\t */\n\tshouldStopAfterTurn?: (context: ShouldStopAfterTurnContext) => boolean | Promise<boolean>;\n\n\t/**\n\t * Called after `turn_end` and before the loop decides whether another provider request should start.\n\t * Return replacement context/model/thinking state to affect the next turn in this run.\n\t * Return undefined to keep using the current context/config.\n\t */\n\tprepareNextTurn?: (\n\t\tcontext: PrepareNextTurnContext,\n\t) => AgentLoopTurnUpdate | undefined | Promise<AgentLoopTurnUpdate | undefined>;\n\n\t/**\n\t * Returns steering messages to inject into the conversation mid-run.\n\t *\n\t * Called after the current assistant turn finishes executing its tool calls, unless `shouldStopAfterTurn` exits first.\n\t * If messages are returned, they are added to the context before the next LLM call.\n\t * Tool calls from the current assistant message are not skipped.\n\t *\n\t * Use this for \"steering\" the agent while it's working.\n\t *\n\t * Contract: must not throw or reject. Return [] when no steering messages are available.\n\t */\n\tgetSteeringMessages?: () => Promise<AgentMessage[]>;\n\n\t/**\n\t * Returns follow-up messages to process after the agent would otherwise stop.\n\t *\n\t * Called when the agent has no more tool calls and no steering messages.\n\t * If messages are returned, they're added to the context and the agent\n\t * continues with another turn.\n\t *\n\t * Use this for follow-up messages that should wait until the agent finishes.\n\t *\n\t * Contract: must not throw or reject. Return [] when no follow-up messages are available.\n\t */\n\tgetFollowUpMessages?: () => Promise<AgentMessage[]>;\n\n\t/**\n\t * Tool execution mode.\n\t * - \"sequential\": execute tool calls one by one\n\t * - \"parallel\": preflight tool calls sequentially, then execute allowed tools concurrently;\n\t * emit `tool_execution_end` in tool completion order after each tool is finalized,\n\t * then emit tool-result message artifacts later in assistant source order\n\t *\n\t * Default: \"parallel\"\n\t */\n\ttoolExecution?: ToolExecutionMode;\n\n\t/**\n\t * Called before a tool is executed, after arguments have been validated.\n\t *\n\t * Return `{ block: true }` to prevent execution. The loop emits an error tool result instead.\n\t * A blocked result can also set `terminate: true` to participate in the batch early-termination rule.\n\t * The hook receives the agent abort signal and is responsible for honoring it.\n\t */\n\tbeforeToolCall?: (context: BeforeToolCallContext, signal?: AbortSignal) => Promise<BeforeToolCallResult | undefined>;\n\n\t/**\n\t * Called after a tool finishes executing, before `tool_execution_end` and tool-result message events are emitted.\n\t *\n\t * Return an `AfterToolCallResult` to override parts of the executed tool result:\n\t * - `content` replaces the full content array\n\t * - `details` replaces the full details payload\n\t * - `isError` replaces the error flag\n\t * - `usage` replaces the tool result usage\n\t * - `terminate` replaces the early-termination hint\n\t *\n\t * Any omitted fields keep their original values. No deep merge is performed.\n\t * The hook receives the agent abort signal and is responsible for honoring it.\n\t */\n\tafterToolCall?: (context: AfterToolCallContext, signal?: AbortSignal) => Promise<AfterToolCallResult | undefined>;\n}\n\n/**\n * Thinking/reasoning level for models that support it.\n * Note: \"xhigh\" and \"max\" are only supported by selected model families. Use model\n * thinking-level metadata from @earendil-works/pi-ai to detect support for a concrete model.\n */\nexport type ThinkingLevel = \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\n\n/**\n * Extensible interface for custom app messages.\n * Apps can extend via declaration merging:\n *\n * @example\n * ```typescript\n * declare module \"@mariozechner/agent\" {\n * interface CustomAgentMessages {\n * artifact: ArtifactMessage;\n * notification: NotificationMessage;\n * }\n * }\n * ```\n */\nexport interface CustomAgentMessages {\n\t// Empty by default - apps extend via declaration merging\n}\n\n/**\n * AgentMessage: Union of LLM messages + custom messages.\n * This abstraction allows apps to add custom message types while maintaining\n * type safety and compatibility with the base LLM messages.\n */\nexport type AgentMessage = Message | CustomAgentMessages[keyof CustomAgentMessages];\n\n/**\n * Public agent state.\n *\n * `tools` and `messages` use accessor properties so implementations can copy\n * assigned arrays before storing them.\n */\nexport interface AgentState {\n\t/** System prompt sent with each model request. */\n\tsystemPrompt: string;\n\t/** Active model used for future turns. */\n\tmodel: Model<any>;\n\t/** Requested reasoning level for future turns. */\n\tthinkingLevel: ThinkingLevel;\n\t/** Available tools. Assigning a new array copies the top-level array. */\n\tset tools(tools: AgentTool<any>[]);\n\tget tools(): AgentTool<any>[];\n\t/** Conversation transcript. Assigning a new array copies the top-level array. */\n\tset messages(messages: AgentMessage[]);\n\tget messages(): AgentMessage[];\n\t/**\n\t * True while the agent is processing a prompt or continuation.\n\t *\n\t * This remains true until awaited `agent_end` listeners settle.\n\t */\n\treadonly isStreaming: boolean;\n\t/** Partial assistant message for the current streamed response, if any. */\n\treadonly streamingMessage?: AgentMessage;\n\t/** Tool call ids currently executing. */\n\treadonly pendingToolCalls: ReadonlySet<string>;\n\t/** Error message from the most recent failed or aborted assistant turn, if any. */\n\treadonly errorMessage?: string;\n}\n\n/** Final or partial result produced by a tool. */\nexport interface AgentToolResult<T> {\n\t/** Text or image content returned to the model. */\n\tcontent: (TextContent | ImageContent)[];\n\t/** Arbitrary structured details for logs or UI rendering. */\n\tdetails: T;\n\t/** Usage from the final tool execution itself, if available. Not used for main LLM context accounting. */\n\tusage?: Usage;\n\t/** Names of tools introduced by this result and available from this transcript point onward. */\n\taddedToolNames?: string[];\n\t/**\n\t * Hint that the agent should stop after the current tool batch.\n\t * Early termination only happens when every finalized tool result in the batch sets this to true.\n\t */\n\tterminate?: boolean;\n}\n\n/**\n * Callback used by tools to stream partial execution updates.\n *\n * The callback is scoped to the current `execute()` invocation. Calls made after\n * the tool promise settles are ignored.\n */\nexport type AgentToolUpdateCallback<T = any> = (partialResult: AgentToolResult<T>) => void;\n\n/** Tool definition used by the agent runtime. */\nexport interface AgentTool<TParameters extends TSchema = TSchema, TDetails = any> extends Tool<TParameters> {\n\t/** Human-readable label for UI display. */\n\tlabel: string;\n\t/**\n\t * Optional compatibility shim for raw tool-call arguments before schema validation.\n\t * Must return an object that matches `TParameters`.\n\t */\n\tprepareArguments?: (args: unknown) => Static<TParameters>;\n\t/** Execute the tool call. Throw on failure instead of encoding errors in `content`. */\n\texecute: (\n\t\ttoolCallId: string,\n\t\tparams: Static<TParameters>,\n\t\tsignal?: AbortSignal,\n\t\tonUpdate?: AgentToolUpdateCallback<TDetails>,\n\t) => Promise<AgentToolResult<TDetails>>;\n\t/**\n\t * Per-tool execution mode override.\n\t * - \"sequential\": this tool must execute one at a time with other tool calls.\n\t * - \"parallel\": this tool can execute concurrently with other tool calls.\n\t *\n\t * If omitted, the default execution mode applies.\n\t */\n\texecutionMode?: ToolExecutionMode;\n}\n\n/** Context snapshot passed into the low-level agent loop. */\nexport interface AgentContext {\n\t/** System prompt included with the request. */\n\tsystemPrompt: string;\n\t/** Transcript visible to the model. */\n\tmessages: AgentMessage[];\n\t/** Tools available for this run. */\n\ttools?: AgentTool<any>[];\n}\n\n/**\n * Events emitted by the Agent for UI updates.\n *\n * `agent_end` is the last event emitted for a run, but awaited `Agent.subscribe()`\n * listeners for that event are still part of run settlement. The agent becomes\n * idle only after those listeners finish.\n */\nexport type AgentEvent =\n\t// Agent lifecycle\n\t| { type: \"agent_start\" }\n\t| { type: \"agent_end\"; messages: AgentMessage[] }\n\t// Turn lifecycle - a turn is one assistant response + any tool calls/results\n\t| { type: \"turn_start\" }\n\t| { type: \"turn_end\"; message: AgentMessage; toolResults: ToolResultMessage[] }\n\t// Message lifecycle - emitted for user, assistant, and toolResult messages\n\t| { type: \"message_start\"; message: AgentMessage }\n\t// Only emitted for assistant messages during streaming\n\t| { type: \"message_update\"; message: AgentMessage; assistantMessageEvent: AssistantMessageEvent }\n\t| { type: \"message_end\"; message: AgentMessage }\n\t// Tool execution lifecycle\n\t| { type: \"tool_execution_start\"; toolCallId: string; toolName: string; args: any }\n\t| { type: \"tool_execution_update\"; toolCallId: string; toolName: string; args: any; partialResult: any }\n\t| { type: \"tool_execution_end\"; toolCallId: string; toolName: string; result: any; isError: boolean };\n"]}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@earendil-works/pi-agent-core",
3
- "version": "0.84.0",
3
+ "version": "0.84.1",
4
4
  "description": "General-purpose agent with transport abstraction, state management, and attachment support",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -35,8 +35,8 @@
35
35
  "prepublishOnly": "npm run build"
36
36
  },
37
37
  "dependencies": {
38
- "@earendil-works/pi-ai": "^0.84.0",
39
- "@earendil-works/pi-telemetry": "^0.84.0",
38
+ "@earendil-works/pi-ai": "^0.84.1",
39
+ "@earendil-works/pi-telemetry": "^0.84.1",
40
40
  "diff": "8.0.4",
41
41
  "ignore": "7.0.5",
42
42
  "typebox": "1.3.7",
@@ -85,6 +85,7 @@ Unified LLM API with provider collections, automatic auth resolution, token and
85
85
  - **OpenCode Go**
86
86
  - **Fireworks** (uses OpenAI- and Anthropic-compatible APIs)
87
87
  - **Kimi For Coding** (Moonshot AI subscription endpoint, uses Anthropic-compatible API)
88
+ - **Qwen Token Plan** (separate Individual and existing catalogs, with a separate China provider)
88
89
  - **Xiaomi MiMo** (defaults to API billing endpoint, with separate Token Plan providers for `cn`/`ams`/`sgp` regions)
89
90
  - **Any OpenAI-compatible API**: Ollama, vLLM, LM Studio, etc.
90
91
 
@@ -438,7 +439,8 @@ Built-in providers resolve these env vars (Node.js; in browsers pass `apiKey` ex
438
439
  | Hugging Face | `HF_TOKEN` |
439
440
  | OpenCode Zen / OpenCode Go | `OPENCODE_API_KEY` |
440
441
  | Kimi For Coding | `KIMI_API_KEY` |
441
- | Qwen Token Plan | `QWEN_TOKEN_PLAN_API_KEY` |
442
+ | Qwen Token Plan (existing catalog) | `QWEN_TOKEN_PLAN_API_KEY` |
443
+ | Qwen Token Plan (Individual) | `QWEN_TOKEN_PLAN_API_KEY` |
442
444
  | Qwen Token Plan (China) | `QWEN_TOKEN_PLAN_CN_API_KEY` |
443
445
  | Xiaomi MiMo (API billing) | `XIAOMI_API_KEY` |
444
446
  | Xiaomi MiMo Token Plan (China) | `XIAOMI_TOKEN_PLAN_CN_API_KEY` |
@@ -446,6 +448,11 @@ Built-in providers resolve these env vars (Node.js; in browsers pass `apiKey` ex
446
448
  | Xiaomi MiMo Token Plan (Singapore) | `XIAOMI_TOKEN_PLAN_SGP_API_KEY` |
447
449
  | GitHub Copilot | `COPILOT_GITHUB_TOKEN` |
448
450
 
451
+ `qwen-token-plan-individual` and `qwen-token-plan` share the international endpoint and
452
+ `QWEN_TOKEN_PLAN_API_KEY`. The Individual provider exposes only the models documented for Individual
453
+ subscriptions, while the existing provider retains its broader catalog for backward compatibility.
454
+ Stored credentials remain provider-scoped, so save the key under the provider ID you register.
455
+
449
456
  Amazon Bedrock resolves ambient AWS credentials (`AWS_PROFILE`, access key pairs, `AWS_BEARER_TOKEN_BEDROCK`, ECS task roles, web identity tokens); its provider-owned login flow supports bearer tokens, AWS profiles, and the existing credential chain. Vertex AI resolves either an explicit key or gcloud Application Default Credentials plus project/location, with a provider-owned login flow for API keys, ADC, and service-account files.
450
457
 
451
458
  ## Tools
@@ -1 +1 @@
1
- {"version":3,"file":"env-api-keys.d.ts","sourceRoot":"","sources":["../src/env-api-keys.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAG7D,eAAO,MAAM,wBAAwB,yBAAyB,CAAC;AAC/D,eAAO,MAAM,yBAAyB,0BAA0B,CAAC;AACjE,eAAO,MAAM,qBAAqB,sBAAsB,CAAC;AA0FzD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;AAC9F,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;AASvF;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,CAAC;AAC7F,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,CAAC","sourcesContent":["// NEVER convert to top-level imports - breaks browser/Vite builds\nlet _existsSync: typeof import(\"node:fs\").existsSync | null = null;\nlet _homedir: typeof import(\"node:os\").homedir | null = null;\nlet _join: typeof import(\"node:path\").join | null = null;\n\ntype DynamicImport = (specifier: string) => Promise<unknown>;\n\nconst dynamicImport: DynamicImport = (specifier) => import(specifier);\nconst NODE_FS_SPECIFIER = \"node:\" + \"fs\";\nconst NODE_OS_SPECIFIER = \"node:\" + \"os\";\nconst NODE_PATH_SPECIFIER = \"node:\" + \"path\";\n\n// Eagerly load in Node.js/Bun environment only\nif (typeof process !== \"undefined\" && (process.versions?.node || process.versions?.bun)) {\n\tdynamicImport(NODE_FS_SPECIFIER).then((m) => {\n\t\t_existsSync = (m as typeof import(\"node:fs\")).existsSync;\n\t});\n\tdynamicImport(NODE_OS_SPECIFIER).then((m) => {\n\t\t_homedir = (m as typeof import(\"node:os\")).homedir;\n\t});\n\tdynamicImport(NODE_PATH_SPECIFIER).then((m) => {\n\t\t_join = (m as typeof import(\"node:path\")).join;\n\t});\n}\n\nimport type { KnownProvider, ProviderEnv } from \"./types.ts\";\nimport { getProviderEnvValue } from \"./utils/provider-env.ts\";\n\nexport const ANTHROPIC_AUTH_TOKEN_ENV = \"ANTHROPIC_AUTH_TOKEN\";\nexport const ANTHROPIC_OAUTH_TOKEN_ENV = \"ANTHROPIC_OAUTH_TOKEN\";\nexport const ANTHROPIC_API_KEY_ENV = \"ANTHROPIC_API_KEY\";\n\nlet cachedVertexAdcCredentialsExists: boolean | null = null;\n\nfunction hasVertexAdcCredentials(env?: ProviderEnv): boolean {\n\tconst explicitCredentialsPath = env?.GOOGLE_APPLICATION_CREDENTIALS;\n\tif (explicitCredentialsPath) {\n\t\treturn _existsSync ? _existsSync(explicitCredentialsPath) : false;\n\t}\n\n\tif (cachedVertexAdcCredentialsExists === null) {\n\t\t// If node modules haven't loaded yet (async import race at startup),\n\t\t// return false WITHOUT caching so the next call retries once they're ready.\n\t\t// Only cache false permanently in a browser environment where fs is never available.\n\t\tif (!_existsSync || !_homedir || !_join) {\n\t\t\tconst isNode = typeof process !== \"undefined\" && (process.versions?.node || process.versions?.bun);\n\t\t\tif (!isNode) {\n\t\t\t\t// Definitively in a browser — safe to cache false permanently\n\t\t\t\tcachedVertexAdcCredentialsExists = false;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\t// Check GOOGLE_APPLICATION_CREDENTIALS env var first (standard way)\n\t\tconst gacPath = getProviderEnvValue(\"GOOGLE_APPLICATION_CREDENTIALS\", env);\n\t\tif (gacPath) {\n\t\t\tcachedVertexAdcCredentialsExists = _existsSync(gacPath);\n\t\t} else {\n\t\t\t// Fall back to default ADC path (lazy evaluation)\n\t\t\tcachedVertexAdcCredentialsExists = _existsSync(\n\t\t\t\t_join(_homedir(), \".config\", \"gcloud\", \"application_default_credentials.json\"),\n\t\t\t);\n\t\t}\n\t}\n\treturn cachedVertexAdcCredentialsExists;\n}\n\nfunction getApiKeyEnvVars(provider: string): readonly string[] | undefined {\n\tif (provider === \"github-copilot\") {\n\t\treturn [\"COPILOT_GITHUB_TOKEN\"];\n\t}\n\n\t// ANTHROPIC_AUTH_TOKEN participates in env discovery/status, but\n\t// getEnvApiKey() skips it because requests must pass it as Authorization: Bearer.\n\tif (provider === \"anthropic\") {\n\t\treturn [ANTHROPIC_AUTH_TOKEN_ENV, ANTHROPIC_OAUTH_TOKEN_ENV, ANTHROPIC_API_KEY_ENV];\n\t}\n\n\tconst envMap: Record<string, string> = {\n\t\t\"ant-ling\": \"ANT_LING_API_KEY\",\n\t\t\"qwen-token-plan\": \"QWEN_TOKEN_PLAN_API_KEY\",\n\t\t\"qwen-token-plan-cn\": \"QWEN_TOKEN_PLAN_CN_API_KEY\",\n\t\topenai: \"OPENAI_API_KEY\",\n\t\t\"azure-openai-responses\": \"AZURE_OPENAI_API_KEY\",\n\t\tnvidia: \"NVIDIA_API_KEY\",\n\t\tdeepseek: \"DEEPSEEK_API_KEY\",\n\t\tgoogle: \"GEMINI_API_KEY\",\n\t\t\"google-vertex\": \"GOOGLE_CLOUD_API_KEY\",\n\t\tgroq: \"GROQ_API_KEY\",\n\t\tcerebras: \"CEREBRAS_API_KEY\",\n\t\txai: \"XAI_API_KEY\",\n\t\tradius: \"RADIUS_API_KEY\",\n\t\topenrouter: \"OPENROUTER_API_KEY\",\n\t\t\"vercel-ai-gateway\": \"AI_GATEWAY_API_KEY\",\n\t\tzai: \"ZAI_API_KEY\",\n\t\t\"zai-coding-cn\": \"ZAI_CODING_CN_API_KEY\",\n\t\tmistral: \"MISTRAL_API_KEY\",\n\t\tminimax: \"MINIMAX_API_KEY\",\n\t\t\"minimax-cn\": \"MINIMAX_CN_API_KEY\",\n\t\tmoonshotai: \"MOONSHOT_API_KEY\",\n\t\t\"moonshotai-cn\": \"MOONSHOT_API_KEY\",\n\t\thuggingface: \"HF_TOKEN\",\n\t\tfireworks: \"FIREWORKS_API_KEY\",\n\t\ttogether: \"TOGETHER_API_KEY\",\n\t\tbaseten: \"BASETEN_API_KEY\",\n\t\topencode: \"OPENCODE_API_KEY\",\n\t\t\"opencode-go\": \"OPENCODE_API_KEY\",\n\t\t\"kimi-coding\": \"KIMI_API_KEY\",\n\t\t\"cloudflare-workers-ai\": \"CLOUDFLARE_API_KEY\",\n\t\t\"cloudflare-ai-gateway\": \"CLOUDFLARE_API_KEY\",\n\t\txiaomi: \"XIAOMI_API_KEY\",\n\t\t\"xiaomi-token-plan-cn\": \"XIAOMI_TOKEN_PLAN_CN_API_KEY\",\n\t\t\"xiaomi-token-plan-ams\": \"XIAOMI_TOKEN_PLAN_AMS_API_KEY\",\n\t\t\"xiaomi-token-plan-sgp\": \"XIAOMI_TOKEN_PLAN_SGP_API_KEY\",\n\t};\n\n\tconst envVar = envMap[provider];\n\treturn envVar ? [envVar] : undefined;\n}\n\n/**\n * Find configured environment variables that can provide an API key for a provider.\n *\n * This only reports actual API key variables. It intentionally excludes ambient\n * credential sources such as AWS profiles, AWS IAM credentials, and Google\n * Application Default Credentials.\n */\nexport function findEnvKeys(provider: KnownProvider, env?: ProviderEnv): string[] | undefined;\nexport function findEnvKeys(provider: string, env?: ProviderEnv): string[] | undefined;\nexport function findEnvKeys(provider: string, env?: ProviderEnv): string[] | undefined {\n\tconst envVars = getApiKeyEnvVars(provider);\n\tif (!envVars) return undefined;\n\n\tconst found = envVars.filter((envVar) => !!getProviderEnvValue(envVar, env));\n\treturn found.length > 0 ? found : undefined;\n}\n\n/**\n * Get API key for provider from known environment variables, e.g. OPENAI_API_KEY.\n *\n * Will not return API keys for providers that require OAuth tokens.\n */\nexport function getEnvApiKey(provider: KnownProvider, env?: ProviderEnv): string | undefined;\nexport function getEnvApiKey(provider: string, env?: ProviderEnv): string | undefined;\nexport function getEnvApiKey(provider: string, env?: ProviderEnv): string | undefined {\n\tconst envKeys = findEnvKeys(provider, env);\n\tif (envKeys?.[0]) {\n\t\tconst apiKeyEnv = provider === \"anthropic\" ? envKeys.find((key) => key !== ANTHROPIC_AUTH_TOKEN_ENV) : envKeys[0];\n\t\tif (apiKeyEnv) return getProviderEnvValue(apiKeyEnv, env);\n\t}\n\n\t// Vertex AI supports either an explicit API key or Application Default Credentials.\n\t// Auth is configured via `gcloud auth application-default login`.\n\tif (provider === \"google-vertex\") {\n\t\tconst hasCredentials = hasVertexAdcCredentials(env);\n\t\tconst hasProject = !!(\n\t\t\tgetProviderEnvValue(\"GOOGLE_CLOUD_PROJECT\", env) || getProviderEnvValue(\"GCLOUD_PROJECT\", env)\n\t\t);\n\t\tconst hasLocation = !!getProviderEnvValue(\"GOOGLE_CLOUD_LOCATION\", env);\n\n\t\tif (hasCredentials && hasProject && hasLocation) {\n\t\t\treturn \"<authenticated>\";\n\t\t}\n\t}\n\n\tif (provider === \"amazon-bedrock\") {\n\t\t// Amazon Bedrock supports multiple credential sources:\n\t\t// 1. AWS_PROFILE - named profile from ~/.aws/credentials\n\t\t// 2. AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY - standard IAM keys\n\t\t// 3. AWS_BEARER_TOKEN_BEDROCK - Bedrock bearer token\n\t\t// 4. AWS_CONTAINER_CREDENTIALS_RELATIVE_URI - ECS task roles\n\t\t// 5. AWS_CONTAINER_CREDENTIALS_FULL_URI - ECS task roles (full URI)\n\t\t// 6. AWS_WEB_IDENTITY_TOKEN_FILE - IRSA (IAM Roles for Service Accounts)\n\t\tif (\n\t\t\tgetProviderEnvValue(\"AWS_PROFILE\", env) ||\n\t\t\t(getProviderEnvValue(\"AWS_ACCESS_KEY_ID\", env) && getProviderEnvValue(\"AWS_SECRET_ACCESS_KEY\", env)) ||\n\t\t\tgetProviderEnvValue(\"AWS_BEARER_TOKEN_BEDROCK\", env) ||\n\t\t\tgetProviderEnvValue(\"AWS_CONTAINER_CREDENTIALS_RELATIVE_URI\", env) ||\n\t\t\tgetProviderEnvValue(\"AWS_CONTAINER_CREDENTIALS_FULL_URI\", env) ||\n\t\t\tgetProviderEnvValue(\"AWS_WEB_IDENTITY_TOKEN_FILE\", env)\n\t\t) {\n\t\t\treturn \"<authenticated>\";\n\t\t}\n\t}\n\n\treturn undefined;\n}\n"]}
1
+ {"version":3,"file":"env-api-keys.d.ts","sourceRoot":"","sources":["../src/env-api-keys.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAG7D,eAAO,MAAM,wBAAwB,yBAAyB,CAAC;AAC/D,eAAO,MAAM,yBAAyB,0BAA0B,CAAC;AACjE,eAAO,MAAM,qBAAqB,sBAAsB,CAAC;AA2FzD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;AAC9F,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;AASvF;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,CAAC;AAC7F,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,CAAC","sourcesContent":["// NEVER convert to top-level imports - breaks browser/Vite builds\nlet _existsSync: typeof import(\"node:fs\").existsSync | null = null;\nlet _homedir: typeof import(\"node:os\").homedir | null = null;\nlet _join: typeof import(\"node:path\").join | null = null;\n\ntype DynamicImport = (specifier: string) => Promise<unknown>;\n\nconst dynamicImport: DynamicImport = (specifier) => import(specifier);\nconst NODE_FS_SPECIFIER = \"node:\" + \"fs\";\nconst NODE_OS_SPECIFIER = \"node:\" + \"os\";\nconst NODE_PATH_SPECIFIER = \"node:\" + \"path\";\n\n// Eagerly load in Node.js/Bun environment only\nif (typeof process !== \"undefined\" && (process.versions?.node || process.versions?.bun)) {\n\tdynamicImport(NODE_FS_SPECIFIER).then((m) => {\n\t\t_existsSync = (m as typeof import(\"node:fs\")).existsSync;\n\t});\n\tdynamicImport(NODE_OS_SPECIFIER).then((m) => {\n\t\t_homedir = (m as typeof import(\"node:os\")).homedir;\n\t});\n\tdynamicImport(NODE_PATH_SPECIFIER).then((m) => {\n\t\t_join = (m as typeof import(\"node:path\")).join;\n\t});\n}\n\nimport type { KnownProvider, ProviderEnv } from \"./types.ts\";\nimport { getProviderEnvValue } from \"./utils/provider-env.ts\";\n\nexport const ANTHROPIC_AUTH_TOKEN_ENV = \"ANTHROPIC_AUTH_TOKEN\";\nexport const ANTHROPIC_OAUTH_TOKEN_ENV = \"ANTHROPIC_OAUTH_TOKEN\";\nexport const ANTHROPIC_API_KEY_ENV = \"ANTHROPIC_API_KEY\";\n\nlet cachedVertexAdcCredentialsExists: boolean | null = null;\n\nfunction hasVertexAdcCredentials(env?: ProviderEnv): boolean {\n\tconst explicitCredentialsPath = env?.GOOGLE_APPLICATION_CREDENTIALS;\n\tif (explicitCredentialsPath) {\n\t\treturn _existsSync ? _existsSync(explicitCredentialsPath) : false;\n\t}\n\n\tif (cachedVertexAdcCredentialsExists === null) {\n\t\t// If node modules haven't loaded yet (async import race at startup),\n\t\t// return false WITHOUT caching so the next call retries once they're ready.\n\t\t// Only cache false permanently in a browser environment where fs is never available.\n\t\tif (!_existsSync || !_homedir || !_join) {\n\t\t\tconst isNode = typeof process !== \"undefined\" && (process.versions?.node || process.versions?.bun);\n\t\t\tif (!isNode) {\n\t\t\t\t// Definitively in a browser — safe to cache false permanently\n\t\t\t\tcachedVertexAdcCredentialsExists = false;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\t// Check GOOGLE_APPLICATION_CREDENTIALS env var first (standard way)\n\t\tconst gacPath = getProviderEnvValue(\"GOOGLE_APPLICATION_CREDENTIALS\", env);\n\t\tif (gacPath) {\n\t\t\tcachedVertexAdcCredentialsExists = _existsSync(gacPath);\n\t\t} else {\n\t\t\t// Fall back to default ADC path (lazy evaluation)\n\t\t\tcachedVertexAdcCredentialsExists = _existsSync(\n\t\t\t\t_join(_homedir(), \".config\", \"gcloud\", \"application_default_credentials.json\"),\n\t\t\t);\n\t\t}\n\t}\n\treturn cachedVertexAdcCredentialsExists;\n}\n\nfunction getApiKeyEnvVars(provider: string): readonly string[] | undefined {\n\tif (provider === \"github-copilot\") {\n\t\treturn [\"COPILOT_GITHUB_TOKEN\"];\n\t}\n\n\t// ANTHROPIC_AUTH_TOKEN participates in env discovery/status, but\n\t// getEnvApiKey() skips it because requests must pass it as Authorization: Bearer.\n\tif (provider === \"anthropic\") {\n\t\treturn [ANTHROPIC_AUTH_TOKEN_ENV, ANTHROPIC_OAUTH_TOKEN_ENV, ANTHROPIC_API_KEY_ENV];\n\t}\n\n\tconst envMap: Record<string, string> = {\n\t\t\"ant-ling\": \"ANT_LING_API_KEY\",\n\t\t\"qwen-token-plan\": \"QWEN_TOKEN_PLAN_API_KEY\",\n\t\t\"qwen-token-plan-cn\": \"QWEN_TOKEN_PLAN_CN_API_KEY\",\n\t\t\"qwen-token-plan-individual\": \"QWEN_TOKEN_PLAN_API_KEY\",\n\t\topenai: \"OPENAI_API_KEY\",\n\t\t\"azure-openai-responses\": \"AZURE_OPENAI_API_KEY\",\n\t\tnvidia: \"NVIDIA_API_KEY\",\n\t\tdeepseek: \"DEEPSEEK_API_KEY\",\n\t\tgoogle: \"GEMINI_API_KEY\",\n\t\t\"google-vertex\": \"GOOGLE_CLOUD_API_KEY\",\n\t\tgroq: \"GROQ_API_KEY\",\n\t\tcerebras: \"CEREBRAS_API_KEY\",\n\t\txai: \"XAI_API_KEY\",\n\t\tradius: \"RADIUS_API_KEY\",\n\t\topenrouter: \"OPENROUTER_API_KEY\",\n\t\t\"vercel-ai-gateway\": \"AI_GATEWAY_API_KEY\",\n\t\tzai: \"ZAI_API_KEY\",\n\t\t\"zai-coding-cn\": \"ZAI_CODING_CN_API_KEY\",\n\t\tmistral: \"MISTRAL_API_KEY\",\n\t\tminimax: \"MINIMAX_API_KEY\",\n\t\t\"minimax-cn\": \"MINIMAX_CN_API_KEY\",\n\t\tmoonshotai: \"MOONSHOT_API_KEY\",\n\t\t\"moonshotai-cn\": \"MOONSHOT_API_KEY\",\n\t\thuggingface: \"HF_TOKEN\",\n\t\tfireworks: \"FIREWORKS_API_KEY\",\n\t\ttogether: \"TOGETHER_API_KEY\",\n\t\tbaseten: \"BASETEN_API_KEY\",\n\t\topencode: \"OPENCODE_API_KEY\",\n\t\t\"opencode-go\": \"OPENCODE_API_KEY\",\n\t\t\"kimi-coding\": \"KIMI_API_KEY\",\n\t\t\"cloudflare-workers-ai\": \"CLOUDFLARE_API_KEY\",\n\t\t\"cloudflare-ai-gateway\": \"CLOUDFLARE_API_KEY\",\n\t\txiaomi: \"XIAOMI_API_KEY\",\n\t\t\"xiaomi-token-plan-cn\": \"XIAOMI_TOKEN_PLAN_CN_API_KEY\",\n\t\t\"xiaomi-token-plan-ams\": \"XIAOMI_TOKEN_PLAN_AMS_API_KEY\",\n\t\t\"xiaomi-token-plan-sgp\": \"XIAOMI_TOKEN_PLAN_SGP_API_KEY\",\n\t};\n\n\tconst envVar = envMap[provider];\n\treturn envVar ? [envVar] : undefined;\n}\n\n/**\n * Find configured environment variables that can provide an API key for a provider.\n *\n * This only reports actual API key variables. It intentionally excludes ambient\n * credential sources such as AWS profiles, AWS IAM credentials, and Google\n * Application Default Credentials.\n */\nexport function findEnvKeys(provider: KnownProvider, env?: ProviderEnv): string[] | undefined;\nexport function findEnvKeys(provider: string, env?: ProviderEnv): string[] | undefined;\nexport function findEnvKeys(provider: string, env?: ProviderEnv): string[] | undefined {\n\tconst envVars = getApiKeyEnvVars(provider);\n\tif (!envVars) return undefined;\n\n\tconst found = envVars.filter((envVar) => !!getProviderEnvValue(envVar, env));\n\treturn found.length > 0 ? found : undefined;\n}\n\n/**\n * Get API key for provider from known environment variables, e.g. OPENAI_API_KEY.\n *\n * Will not return API keys for providers that require OAuth tokens.\n */\nexport function getEnvApiKey(provider: KnownProvider, env?: ProviderEnv): string | undefined;\nexport function getEnvApiKey(provider: string, env?: ProviderEnv): string | undefined;\nexport function getEnvApiKey(provider: string, env?: ProviderEnv): string | undefined {\n\tconst envKeys = findEnvKeys(provider, env);\n\tif (envKeys?.[0]) {\n\t\tconst apiKeyEnv = provider === \"anthropic\" ? envKeys.find((key) => key !== ANTHROPIC_AUTH_TOKEN_ENV) : envKeys[0];\n\t\tif (apiKeyEnv) return getProviderEnvValue(apiKeyEnv, env);\n\t}\n\n\t// Vertex AI supports either an explicit API key or Application Default Credentials.\n\t// Auth is configured via `gcloud auth application-default login`.\n\tif (provider === \"google-vertex\") {\n\t\tconst hasCredentials = hasVertexAdcCredentials(env);\n\t\tconst hasProject = !!(\n\t\t\tgetProviderEnvValue(\"GOOGLE_CLOUD_PROJECT\", env) || getProviderEnvValue(\"GCLOUD_PROJECT\", env)\n\t\t);\n\t\tconst hasLocation = !!getProviderEnvValue(\"GOOGLE_CLOUD_LOCATION\", env);\n\n\t\tif (hasCredentials && hasProject && hasLocation) {\n\t\t\treturn \"<authenticated>\";\n\t\t}\n\t}\n\n\tif (provider === \"amazon-bedrock\") {\n\t\t// Amazon Bedrock supports multiple credential sources:\n\t\t// 1. AWS_PROFILE - named profile from ~/.aws/credentials\n\t\t// 2. AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY - standard IAM keys\n\t\t// 3. AWS_BEARER_TOKEN_BEDROCK - Bedrock bearer token\n\t\t// 4. AWS_CONTAINER_CREDENTIALS_RELATIVE_URI - ECS task roles\n\t\t// 5. AWS_CONTAINER_CREDENTIALS_FULL_URI - ECS task roles (full URI)\n\t\t// 6. AWS_WEB_IDENTITY_TOKEN_FILE - IRSA (IAM Roles for Service Accounts)\n\t\tif (\n\t\t\tgetProviderEnvValue(\"AWS_PROFILE\", env) ||\n\t\t\t(getProviderEnvValue(\"AWS_ACCESS_KEY_ID\", env) && getProviderEnvValue(\"AWS_SECRET_ACCESS_KEY\", env)) ||\n\t\t\tgetProviderEnvValue(\"AWS_BEARER_TOKEN_BEDROCK\", env) ||\n\t\t\tgetProviderEnvValue(\"AWS_CONTAINER_CREDENTIALS_RELATIVE_URI\", env) ||\n\t\t\tgetProviderEnvValue(\"AWS_CONTAINER_CREDENTIALS_FULL_URI\", env) ||\n\t\t\tgetProviderEnvValue(\"AWS_WEB_IDENTITY_TOKEN_FILE\", env)\n\t\t) {\n\t\t\treturn \"<authenticated>\";\n\t\t}\n\t}\n\n\treturn undefined;\n}\n"]}
@@ -73,6 +73,7 @@ function getApiKeyEnvVars(provider) {
73
73
  "ant-ling": "ANT_LING_API_KEY",
74
74
  "qwen-token-plan": "QWEN_TOKEN_PLAN_API_KEY",
75
75
  "qwen-token-plan-cn": "QWEN_TOKEN_PLAN_CN_API_KEY",
76
+ "qwen-token-plan-individual": "QWEN_TOKEN_PLAN_API_KEY",
76
77
  openai: "OPENAI_API_KEY",
77
78
  "azure-openai-responses": "AZURE_OPENA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AG,CAAC,IAAI,mBAAmB,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAC9F,CAAC;QACF,MAAM,WAAW,GAAG,CAAC,CAAC,mBAAmB,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;QAExE,IAAI,cAAc,IAAI,UAAU,IAAI,WAAW,EAAE,CAAC;YACjD,OAAO,iBAAiB,CAAC;QAC1B,CAAC;IACF,CAAC;IAED,IAAI,QAAQ,KAAK,gBAAgB,EAAE,CAAC;QACnC,uDAAuD;QACvD,yDAAyD;QACzD,mEAAmE;QACnE,qDAAqD;QACrD,6DAA6D;QAC7D,oEAAoE;QACpE,yEAAyE;QACzE,IACC,mBAAmB,CAAC,aAAa,EAAE,GAAG,CAAC;YACvC,CAAC,mBAAmB,CAAC,mBAAmB,EAAE,GAAG,CAAC,IAAI,mBAAmB,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;YACpG,mBAAmB,CAAC,0BAA0B,EAAE,GAAG,CAAC;YACpD,mBAAmB,CAAC,wCAAwC,EAAE,GAAG,CAAC;YAClE,mBAAmB,CAAC,oCAAoC,EAAE,GAAG,CAAC;YAC9D,mBAAmB,CAAC,6BAA6B,EAAE,GAAG,CAAC,EACtD,CAAC;YACF,OAAO,iBAAiB,CAAC;QAC1B,CAAC;IACF,CAAC;IAED,OAAO,SAAS,CAAC;AAAA,CACjB","sourcesContent":["// NEVER convert to top-level imports - breaks browser/Vite builds\nlet _existsSync: typeof import(\"node:fs\").existsSync | null = null;\nlet _homedir: typeof import(\"node:os\").homedir | null = null;\nlet _join: typeof import(\"node:path\").join | null = null;\n\ntype DynamicImport = (specifier: string) => Promise<unknown>;\n\nconst dynamicImport: DynamicImport = (specifier) => import(specifier);\nconst NODE_FS_SPECIFIER = \"node:\" + \"fs\";\nconst NODE_OS_SPECIFIER = \"node:\" + \"os\";\nconst NODE_PATH_SPECIFIER = \"node:\" + \"path\";\n\n// Eagerly load in Node.js/Bun environment only\nif (typeof process !== \"undefined\" && (process.versions?.node || process.versions?.bun)) {\n\tdynamicImport(NODE_FS_SPECIFIER).then((m) => {\n\t\t_existsSync = (m as typeof import(\"node:fs\")).existsSync;\n\t});\n\tdynamicImport(NODE_OS_SPECIFIER).then((m) => {\n\t\t_homedir = (m as typeof import(\"node:os\")).homedir;\n\t});\n\tdynamicImport(NODE_PATH_SPECIFIER).then((m) => {\n\t\t_join = (m as typeof import(\"node:path\")).join;\n\t});\n}\n\nimport type { KnownProvider, ProviderEnv } from \"./types.ts\";\nimport { getProviderEnvValue } from \"./utils/provider-env.ts\";\n\nexport const ANTHROPIC_AUTH_TOKEN_ENV = \"ANTHROPIC_AUTH_TOKEN\";\nexport const ANTHROPIC_OAUTH_TOKEN_ENV = \"ANTHROPIC_OAUTH_TOKEN\";\nexport const ANTHROPIC_API_KEY_ENV = \"ANTHROPIC_API_KEY\";\n\nlet cachedVertexAdcCredentialsExists: boolean | null = null;\n\nfunction hasVertexAdcCredentials(env?: ProviderEnv): boolean {\n\tconst explicitCredentialsPath = env?.GOOGLE_APPLICATION_CREDENTIALS;\n\tif (explicitCredentialsPath) {\n\t\treturn _existsSync ? _existsSync(explicitCredentialsPath) : false;\n\t}\n\n\tif (cachedVertexAdcCredentialsExists === null) {\n\t\t// If node modules haven't loaded yet (async import race at startup),\n\t\t// return false WITHOUT caching so the next call retries once they're ready.\n\t\t// Only cache false permanently in a browser environment where fs is never available.\n\t\tif (!_existsSync || !_homedir || !_join) {\n\t\t\tconst isNode = typeof process !== \"undefined\" && (process.versions?.node || process.versions?.bun);\n\t\t\tif (!isNode) {\n\t\t\t\t// Definitively in a browser — safe to cache false permanently\n\t\t\t\tcachedVertexAdcCredentialsExists = false;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\t// Check GOOGLE_APPLICATION_CREDENTIALS env var first (standard way)\n\t\tconst gacPath = getProviderEnvValue(\"GOOGLE_APPLICATION_CREDENTIALS\", env);\n\t\tif (gacPath) {\n\t\t\tcachedVertexAdcCredentialsExists = _existsSync(gacPath);\n\t\t} else {\n\t\t\t// Fall back to default ADC path (lazy evaluation)\n\t\t\tcachedVertexAdcCredentialsExists = _existsSync(\n\t\t\t\t_join(_homedir(), \".config\", \"gcloud\", \"application_default_credentials.json\"),\n\t\t\t);\n\t\t}\n\t}\n\treturn cachedVertexAdcCredentialsExists;\n}\n\nfunction getApiKeyEnvVars(provider: string): readonly string[] | undefined {\n\tif (provider === \"github-copilot\") {\n\t\treturn [\"COPILOT_GITHUB_TOKEN\"];\n\t}\n\n\t// ANTHROPIC_AUTH_TOKEN participates in env discovery/status, but\n\t// getEnvApiKey() skips it because requests must pass it as Authorization: Bearer.\n\tif (provider === \"anthropic\") {\n\t\treturn [ANTHROPIC_AUTH_TOKEN_ENV, ANTHROPIC_OAUTH_TOKEN_ENV, ANTHROPIC_API_KEY_ENV];\n\t}\n\n\tconst envMap: Record<string, string> = {\n\t\t\"ant-ling\": \"ANT_LING_API_KEY\",\n\t\t\"qwen-token-plan\": \"QWEN_TOKEN_PLAN_API_KEY\",\n\t\t\"qwen-token-plan-cn\": \"QWEN_TOKEN_PLAN_CN_API_KEY\",\n\t\topenai: \"OPENAI_API_KEY\",\n\t\t\"azure-openai-responses\": \"AZURE_OPENAI_API_KEY\",\n\t\tnvidia: \"NVIDIA_API_KEY\",\n\t\tdeepseek: \"DEEPSEEK_API_KEY\",\n\t\tgoogle: \"GEMINI_API_KEY\",\n\t\t\"google-vertex\": \"GOOGLE_CLOUD_API_KEY\",\n\t\tgroq: \"GROQ_API_KEY\",\n\t\tcerebras: \"CEREBRAS_API_KEY\",\n\t\txai: \"XAI_API_KEY\",\n\t\tradius: \"RADIUS_API_KEY\",\n\t\topenrouter: \"OPENROUTER_API_KEY\",\n\t\t\"vercel-ai-gateway\": \"AI_GATEWAY_API_KEY\",\n\t\tzai: \"ZAI_API_KEY\",\n\t\t\"zai-coding-cn\": \"ZAI_CODING_CN_API_KEY\",\n\t\tmistral: \"MISTRAL_API_KEY\",\n\t\tminimax: \"MINIMAX_API_KEY\",\n\t\t\"minimax-cn\": \"MINIMAX_CN_API_KEY\",\n\t\tmoonshotai: \"MOONSHOT_API_KEY\",\n\t\t\"moonshotai-cn\": \"MOONSHOT_API_KEY\",\n\t\thuggingface: \"HF_TOKEN\",\n\t\tfireworks: \"FIREWORKS_API_KEY\",\n\t\ttogether: \"TOGETHER_API_KEY\",\n\t\tbaseten: \"BASETEN_API_KEY\",\n\t\topencode: \"OPENCODE_API_KEY\",\n\t\t\"opencode-go\": \"OPENCODE_API_KEY\",\n\t\t\"kimi-coding\": \"KIMI_API_KEY\",\n\t\t\"cloudflare-workers-ai\": \"CLOUDFLARE_API_KEY\",\n\t\t\"cloudflare-ai-gateway\": \"CLOUDFLARE_API_KEY\",\n\t\txiaomi: \"XIAOMI_API_KEY\",\n\t\t\"xiaomi-token-plan-cn\": \"XIAOMI_TOKEN_PLAN_CN_API_KEY\",\n\t\t\"xiaomi-token-plan-ams\": \"XIAOMI_TOKEN_PLAN_AMS_API_KEY\",\n\t\t\"xiaomi-token-plan-sgp\": \"XIAOMI_TOKEN_PLAN_SGP_API_KEY\",\n\t};\n\n\tconst envVar = envMap[provider];\n\treturn envVar ? [envVar] : undefined;\n}\n\n/**\n * Find configured environment variables that can provide an API key for a provider.\n *\n * This only reports actual API key variables. It intentionally excludes ambient\n * credential sources such as AWS profiles, AWS IAM credentials, and Google\n * Application Default Credentials.\n */\nexport function findEnvKeys(provider: KnownProvider, env?: ProviderEnv): string[] | undefined;\nexport function findEnvKeys(provider: string, env?: ProviderEnv): string[] | undefined;\nexport function findEnvKeys(provider: string, env?: ProviderEnv): string[] | undefined {\n\tconst envVars = getApiKeyEnvVars(provider);\n\tif (!envVars) return undefined;\n\n\tconst found = envVars.filter((envVar) => !!getProviderEnvValue(envVar, env));\n\treturn found.length > 0 ? found : undefined;\n}\n\n/**\n * Get API key for provider from known environment variables, e.g. OPENAI_API_KEY.\n *\n * Will not return API keys for providers that require OAuth tokens.\n */\nexport function getEnvApiKey(provider: KnownProvider, env?: ProviderEnv): string | undefined;\nexport function getEnvApiKey(provider: string, env?: ProviderEnv): string | undefined;\nexport function getEnvApiKey(provider: string, env?: ProviderEnv): string | undefined {\n\tconst envKeys = findEnvKeys(provider, env);\n\tif (envKeys?.[0]) {\n\t\tconst apiKeyEnv = provider === \"anthropic\" ? envKeys.find((key) => key !== ANTHROPIC_AUTH_TOKEN_ENV) : envKeys[0];\n\t\tif (apiKeyEnv) return getProviderEnvValue(apiKeyEnv, env);\n\t}\n\n\t// Vertex AI supports either an explicit API key or Application Default Credentials.\n\t// Auth is configured via `gcloud auth application-default login`.\n\tif (provider === \"google-vertex\") {\n\t\tconst hasCredentials = hasVertexAdcCredentials(env);\n\t\tconst hasProject = !!(\n\t\t\tgetProviderEnvValue(\"GOOGLE_CLOUD_PROJECT\", env) || getProviderEnvValue(\"GCLOUD_PROJECT\", env)\n\t\t);\n\t\tconst hasLocation = !!getProviderEnvValue(\"GOOGLE_CLOUD_LOCATION\", env);\n\n\t\tif (hasCredentials && hasProject && hasLocation) {\n\t\t\treturn \"<authenticated>\";\n\t\t}\n\t}\n\n\tif (provider === \"amazon-bedrock\") {\n\t\t// Amazon Bedrock supports multiple credential sources:\n\t\t// 1. AWS_PROFILE - named profile from ~/.aws/credentials\n\t\t// 2. AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY - standard IAM keys\n\t\t// 3. AWS_BEARER_TOKEN_BEDROCK - Bedrock bearer token\n\t\t// 4. AWS_CONTAINER_CREDENTIALS_RELATIVE_URI - ECS task roles\n\t\t// 5. AWS_CONTAINER_CREDENTIALS_FULL_URI - ECS task roles (full URI)\n\t\t// 6. AWS_WEB_IDENTITY_TOKEN_FILE - IRSA (IAM Roles for Service Accounts)\n\t\tif (\n\t\t\tgetProviderEnvValue(\"AWS_PROFILE\", env) ||\n\t\t\t(getProviderEnvValue(\"AWS_ACCESS_KEY_ID\", env) && getProviderEnvValue(\"AWS_SECRET_ACCESS_KEY\", env)) ||\n\t\t\tgetProviderEnvValue(\"AWS_BEARER_TOKEN_BEDROCK\", env) ||\n\t\t\tgetProviderEnvValue(\"AWS_CONTAINER_CREDENTIALS_RELATIVE_URI\", env) ||\n\t\t\tgetProviderEnvValue(\"AWS_CONTAINER_CREDENTIALS_FULL_URI\", env) ||\n\t\t\tgetProviderEnvValue(\"AWS_WEB_IDENTITY_TOKEN_FILE\", env)\n\t\t) {\n\t\t\treturn \"<authenticated>\";\n\t\t}\n\t}\n\n\treturn undefined;\n}\n"]}
1
+ {"version":3,"file":"env-api-keys.js","sourceRoot":"","sources":["../src/env-api-keys.ts"],"names":[],"mappings":";;;;;;;;AAAA,kEAAkE;AAClE,IAAI,WAAW,GAA+C,IAAI,CAAC;AACnE,IAAI,QAAQ,GAA4C,IAAI,CAAC;AAC7D,IAAI,KAAK,GAA2C,IAAI,CAAC;AAIzD,MAAM,aAAa,GAAkB,CAAC,SAAS,EAAE,EAAE,CAAC,MAAM,kCAAC,SAAS,EAAC,CAAC;AACtE,MAAM,iBAAiB,GAAG,OAAO,GAAG,IAAI,CAAC;AACzC,MAAM,iBAAiB,GAAG,OAAO,GAAG,IAAI,CAAC;AACzC,MAAM,mBAAmB,GAAG,OAAO,GAAG,MAAM,CAAC;AAE7C,+CAA+C;AAC/C,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,IAAI,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC;IACzF,aAAa,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QAC5C,WAAW,GAAI,CAA8B,CAAC,UAAU,CAAC;IAAA,CACzD,CAAC,CAAC;IACH,aAAa,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QAC5C,QAAQ,GAAI,CAA8B,CAAC,OAAO,CAAC;IAAA,CACnD,CAAC,CAAC;IACH,aAAa,CAAC,mBA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ClH,IAAI,SAAS;YAAE,OAAO,mBAAmB,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IAC3D,CAAC;IAED,oFAAoF;IACpF,kEAAkE;IAClE,IAAI,QAAQ,KAAK,eAAe,EAAE,CAAC;QAClC,MAAM,cAAc,GAAG,uBAAuB,CAAC,GAAG,CAAC,CAAC;QACpD,MAAM,UAAU,GAAG,CAAC,CAAC,CACpB,mBAAmB,CAAC,sBAAsB,EAAE,GAAG,CAAC,IAAI,mBAAmB,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAC9F,CAAC;QACF,MAAM,WAAW,GAAG,CAAC,CAAC,mBAAmB,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;QAExE,IAAI,cAAc,IAAI,UAAU,IAAI,WAAW,EAAE,CAAC;YACjD,OAAO,iBAAiB,CAAC;QAC1B,CAAC;IACF,CAAC;IAED,IAAI,QAAQ,KAAK,gBAAgB,EAAE,CAAC;QACnC,uDAAuD;QACvD,yDAAyD;QACzD,mEAAmE;QACnE,qDAAqD;QACrD,6DAA6D;QAC7D,oEAAoE;QACpE,yEAAyE;QACzE,IACC,mBAAmB,CAAC,aAAa,EAAE,GAAG,CAAC;YACvC,CAAC,mBAAmB,CAAC,mBAAmB,EAAE,GAAG,CAAC,IAAI,mBAAmB,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;YACpG,mBAAmB,CAAC,0BAA0B,EAAE,GAAG,CAAC;YACpD,mBAAmB,CAAC,wCAAwC,EAAE,GAAG,CAAC;YAClE,mBAAmB,CAAC,oCAAoC,EAAE,GAAG,CAAC;YAC9D,mBAAmB,CAAC,6BAA6B,EAAE,GAAG,CAAC,EACtD,CAAC;YACF,OAAO,iBAAiB,CAAC;QAC1B,CAAC;IACF,CAAC;IAED,OAAO,SAAS,CAAC;AAAA,CACjB","sourcesContent":["// NEVER convert to top-level imports - breaks browser/Vite builds\nlet _existsSync: typeof import(\"node:fs\").existsSync | null = null;\nlet _homedir: typeof import(\"node:os\").homedir | null = null;\nlet _join: typeof import(\"node:path\").join | null = null;\n\ntype DynamicImport = (specifier: string) => Promise<unknown>;\n\nconst dynamicImport: DynamicImport = (specifier) => import(specifier);\nconst NODE_FS_SPECIFIER = \"node:\" + \"fs\";\nconst NODE_OS_SPECIFIER = \"node:\" + \"os\";\nconst NODE_PATH_SPECIFIER = \"node:\" + \"path\";\n\n// Eagerly load in Node.js/Bun environment only\nif (typeof process !== \"undefined\" && (process.versions?.node || process.versions?.bun)) {\n\tdynamicImport(NODE_FS_SPECIFIER).then((m) => {\n\t\t_existsSync = (m as typeof import(\"node:fs\")).existsSync;\n\t});\n\tdynamicImport(NODE_OS_SPECIFIER).then((m) => {\n\t\t_homedir = (m as typeof import(\"node:os\")).homedir;\n\t});\n\tdynamicImport(NODE_PATH_SPECIFIER).then((m) => {\n\t\t_join = (m as typeof import(\"node:path\")).join;\n\t});\n}\n\nimport type { KnownProvider, ProviderEnv } from \"./types.ts\";\nimport { getProviderEnvValue } from \"./utils/provider-env.ts\";\n\nexport const ANTHROPIC_AUTH_TOKEN_ENV = \"ANTHROPIC_AUTH_TOKEN\";\nexport const ANTHROPIC_OAUTH_TOKEN_ENV = \"ANTHROPIC_OAUTH_TOKEN\";\nexport const ANTHROPIC_API_KEY_ENV = \"ANTHROPIC_API_KEY\";\n\nlet cachedVertexAdcCredentialsExists: boolean | null = null;\n\nfunction hasVertexAdcCredentials(env?: ProviderEnv): boolean {\n\tconst explicitCredentialsPath = env?.GOOGLE_APPLICATION_CREDENTIALS;\n\tif (explicitCredentialsPath) {\n\t\treturn _existsSync ? _existsSync(explicitCredentialsPath) : false;\n\t}\n\n\tif (cachedVertexAdcCredentialsExists === null) {\n\t\t// If node modules haven't loaded yet (async import race at startup),\n\t\t// return false WITHOUT caching so the next call retries once they're ready.\n\t\t// Only cache false permanently in a browser environment where fs is never available.\n\t\tif (!_existsSync || !_homedir || !_join) {\n\t\t\tconst isNode = typeof process !== \"undefined\" && (process.versions?.node || process.versions?.bun);\n\t\t\tif (!isNode) {\n\t\t\t\t// Definitively in a browser — safe to cache false permanently\n\t\t\t\tcachedVertexAdcCredentialsExists = false;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\t// Check GOOGLE_APPLICATION_CREDENTIALS env var first (standard way)\n\t\tconst gacPath = getProviderEnvValue(\"GOOGLE_APPLICATION_CREDENTIALS\", env);\n\t\tif (gacPath) {\n\t\t\tcachedVertexAdcCredentialsExists = _existsSync(gacPath);\n\t\t} else {\n\t\t\t// Fall back to default ADC path (lazy evaluation)\n\t\t\tcachedVertexAdcCredentialsExists = _existsSync(\n\t\t\t\t_join(_homedir(), \".config\", \"gcloud\", \"application_default_credentials.json\"),\n\t\t\t);\n\t\t}\n\t}\n\treturn cachedVertexAdcCredentialsExists;\n}\n\nfunction getApiKeyEnvVars(provider: string): readonly string[] | undefined {\n\tif (provider === \"github-copilot\") {\n\t\treturn [\"COPILOT_GITHUB_TOKEN\"];\n\t}\n\n\t// ANTHROPIC_AUTH_TOKEN participates in env discovery/status, but\n\t// getEnvApiKey() skips it because requests must pass it as Authorization: Bearer.\n\tif (provider === \"anthropic\") {\n\t\treturn [ANTHROPIC_AUTH_TOKEN_ENV, ANTHROPIC_OAUTH_TOKEN_ENV, ANTHROPIC_API_KEY_ENV];\n\t}\n\n\tconst envMap: Record<string, string> = {\n\t\t\"ant-ling\": \"ANT_LING_API_KEY\",\n\t\t\"qwen-token-plan\": \"QWEN_TOKEN_PLAN_API_KEY\",\n\t\t\"qwen-token-plan-cn\": \"QWEN_TOKEN_PLAN_CN_API_KEY\",\n\t\t\"qwen-token-plan-individual\": \"QWEN_TOKEN_PLAN_API_KEY\",\n\t\topenai: \"OPENAI_API_KEY\",\n\t\t\"azure-openai-responses\": \"AZURE_OPENAI_API_KEY\",\n\t\tnvidia: \"NVIDIA_API_KEY\",\n\t\tdeepseek: \"DEEPSEEK_API_KEY\",\n\t\tgoogle: \"GEMINI_API_KEY\",\n\t\t\"google-vertex\": \"GOOGLE_CLOUD_API_KEY\",\n\t\tgroq: \"GROQ_API_KEY\",\n\t\tcerebras: \"CEREBRAS_API_KEY\",\n\t\txai: \"XAI_API_KEY\",\n\t\tradius: \"RADIUS_API_KEY\",\n\t\topenrouter: \"OPENROUTER_API_KEY\",\n\t\t\"vercel-ai-gateway\": \"AI_GATEWAY_API_KEY\",\n\t\tzai: \"ZAI_API_KEY\",\n\t\t\"zai-coding-cn\": \"ZAI_CODING_CN_API_KEY\",\n\t\tmistral: \"MISTRAL_API_KEY\",\n\t\tminimax: \"MINIMAX_API_KEY\",\n\t\t\"minimax-cn\": \"MINIMAX_CN_API_KEY\",\n\t\tmoonshotai: \"MOONSHOT_API_KEY\",\n\t\t\"moonshotai-cn\": \"MOONSHOT_API_KEY\",\n\t\thuggingface: \"HF_TOKEN\",\n\t\tfireworks: \"FIREWORKS_API_KEY\",\n\t\ttogether: \"TOGETHER_API_KEY\",\n\t\tbaseten: \"BASETEN_API_KEY\",\n\t\topencode: \"OPENCODE_API_KEY\",\n\t\t\"opencode-go\": \"OPENCODE_API_KEY\",\n\t\t\"kimi-coding\": \"KIMI_API_KEY\",\n\t\t\"cloudflare-workers-ai\": \"CLOUDFLARE_API_KEY\",\n\t\t\"cloudflare-ai-gateway\": \"CLOUDFLARE_API_KEY\",\n\t\txiaomi: \"XIAOMI_API_KEY\",\n\t\t\"xiaomi-token-plan-cn\": \"XIAOMI_TOKEN_PLAN_CN_API_KEY\",\n\t\t\"xiaomi-token-plan-ams\": \"XIAOMI_TOKEN_PLAN_AMS_API_KEY\",\n\t\t\"xiaomi-token-plan-sgp\": \"XIAOMI_TOKEN_PLAN_SGP_API_KEY\",\n\t};\n\n\tconst envVar = envMap[provider];\n\treturn envVar ? [envVar] : undefined;\n}\n\n/**\n * Find configured environment variables that can provide an API key for a provider.\n *\n * This only reports actual API key variables. It intentionally excludes ambient\n * credential sources such as AWS profiles, AWS IAM credentials, and Google\n * Application Default Credentials.\n */\nexport function findEnvKeys(provider: KnownProvider, env?: ProviderEnv): string[] | undefined;\nexport function findEnvKeys(provider: string, env?: ProviderEnv): string[] | undefined;\nexport function findEnvKeys(provider: string, env?: ProviderEnv): string[] | undefined {\n\tconst envVars = getApiKeyEnvVars(provider);\n\tif (!envVars) return undefined;\n\n\tconst found = envVars.filter((envVar) => !!getProviderEnvValue(envVar, env));\n\treturn found.length > 0 ? found : undefined;\n}\n\n/**\n * Get API key for provider from known environment variables, e.g. OPENAI_API_KEY.\n *\n * Will not return API keys for providers that require OAuth tokens.\n */\nexport function getEnvApiKey(provider: KnownProvider, env?: ProviderEnv): string | undefined;\nexport function getEnvApiKey(provider: string, env?: ProviderEnv): string | undefined;\nexport function getEnvApiKey(provider: string, env?: ProviderEnv): string | undefined {\n\tconst envKeys = findEnvKeys(provider, env);\n\tif (envKeys?.[0]) {\n\t\tconst apiKeyEnv = provider === \"anthropic\" ? envKeys.find((key) => key !== ANTHROPIC_AUTH_TOKEN_ENV) : envKeys[0];\n\t\tif (apiKeyEnv) return getProviderEnvValue(apiKeyEnv, env);\n\t}\n\n\t// Vertex AI supports either an explicit API key or Application Default Credentials.\n\t// Auth is configured via `gcloud auth application-default login`.\n\tif (provider === \"google-vertex\") {\n\t\tconst hasCredentials = hasVertexAdcCredentials(env);\n\t\tconst hasProject = !!(\n\t\t\tgetProviderEnvValue(\"GOOGLE_CLOUD_PROJECT\", env) || getProviderEnvValue(\"GCLOUD_PROJECT\", env)\n\t\t);\n\t\tconst hasLocation = !!getProviderEnvValue(\"GOOGLE_CLOUD_LOCATION\", env);\n\n\t\tif (hasCredentials && hasProject && hasLocation) {\n\t\t\treturn \"<authenticated>\";\n\t\t}\n\t}\n\n\tif (provider === \"amazon-bedrock\") {\n\t\t// Amazon Bedrock supports multiple credential sources:\n\t\t// 1. AWS_PROFILE - named profile from ~/.aws/credentials\n\t\t// 2. AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY - standard IAM keys\n\t\t// 3. AWS_BEARER_TOKEN_BEDROCK - Bedrock bearer token\n\t\t// 4. AWS_CONTAINER_CREDENTIALS_RELATIVE_URI - ECS task roles\n\t\t// 5. AWS_CONTAINER_CREDENTIALS_FULL_URI - ECS task roles (full URI)\n\t\t// 6. AWS_WEB_IDENTITY_TOKEN_FILE - IRSA (IAM Roles for Service Accounts)\n\t\tif (\n\t\t\tgetProviderEnvValue(\"AWS_PROFILE\", env) ||\n\t\t\t(getProviderEnvValue(\"AWS_ACCESS_KEY_ID\", env) && getProviderEnvValue(\"AWS_SECRET_ACCESS_KEY\", env)) ||\n\t\t\tgetProviderEnvValue(\"AWS_BEARER_TOKEN_BEDROCK\", env) ||\n\t\t\tgetProviderEnvValue(\"AWS_CONTAINER_CREDENTIALS_RELATIVE_URI\", env) ||\n\t\t\tgetProviderEnvValue(\"AWS_CONTAINER_CREDENTIALS_FULL_URI\", env) ||\n\t\t\tgetProviderEnvValue(\"AWS_WEB_IDENTITY_TOKEN_FILE\", env)\n\t\t) {\n\t\t\treturn \"<authenticated>\";\n\t\t}\n\t}\n\n\treturn undefined;\n}\n"]}
@@ -27,6 +27,7 @@ import { OPENCODE_GO_MODELS } from "./providers/opencode-go.models.ts";
27
27
  import { OPENROUTER_MODELS } from "./providers/openrouter.models.ts";
28
28
  import { QWEN_TOKEN_PLAN_MODELS } from "./providers/qwen-token-plan.models.ts";
29
29
  import { QWEN_TOKEN_PLAN_CN_MODELS } from "./providers/qwen-token-plan-cn.models.ts";
30
+ import { QWEN_TOKEN_PLAN_INDIVIDUAL_MODELS } from "./providers/qwen-token-plan-individual.models.ts";
30
31
  import { TOGETHER_MODELS } from "./providers/together.models.ts";
31
32
  import { VERCEL_AI_GATEWAY_MODELS } from "./providers/vercel-ai-gateway.models.ts";
32
33
  import { XAI_MODELS } from "./providers/xai.models.ts";
@@ -66,6 +67,7 @@ export declare const MODELS: {
66
67
  readonly "openrouter": typeof OPENROUTER_MODELS;
67
68
  readonly "qwen-token-plan": typeof QWEN_TOKEN_PLAN_MODELS;
68
69
  readonly "qwen-token-plan-cn": typeof QWEN_TOKEN_PLAN_CN_MODELS;
70
+ readonly "qwen-token-plan-individual": typeof QWEN_TOKEN_PLAN_INDIVIDUAL_MODELS;
69
71
  readonly "together": typeof TOGETHER_MODELS;
70
72
  readonly "vercel-ai-gateway": typeof VERCEL_AI_GATEWAY_MODELS;
71
73
  readonly "xai": typeof XAI_MODELS;
@@ -1 +1 @@
1
- {"version":3,"file":"models.generated.d.ts","sourceRoot":"","sources":["../src/models.generated.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,6BAA6B,EAAE,MAAM,8CAA8C,CAAC;AAC7F,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,iBAAiB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,CAAC,YAAY,EAAE,OAAO,iBAAiB,CAAC;IAChD,QAAQ,CAAC,iBAAiB,EAAE,OAAO,sBAAsB,CAAC;IAC1D,QAAQ,CAAC,oBAAoB,EAAE,OAAO,yBAAyB,CAAC;IAChE,QAAQ,CAAC,UAAU,EAAE,OAAO,eAAe,CAAC;IAC5C,QAAQ,CAAC,mBAAmB,EAAE,OAAO,wBAAwB,CAAC;IAC9D,QAAQ,CAAC,KAAK,EAAE,OAAO,UAAU,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,OAAO,aAAa,CAAC;IACxC,QAAQ,CAAC,uBAAuB,EAAE,OAAO,4BAA4B,CAAC;IACtE,QAAQ,CAAC,sBAAsB,EAAE,OAAO,2BAA2B,CAAC;IACpE,QAAQ,CAAC,uBAAuB,EAAE,OAAO,4BAA4B,CAAC;IACtE,QAAQ,CAAC,KAAK,EAAE,OAAO,UAAU,CAAC;IAClC,QAAQ,CAAC,eAAe,EAAE,OAAO,oBAAoB,CAAC;CAwCtD,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 { AMAZON_BEDROCK_MODELS } from \"./providers/amazon-bedrock.models.ts\";\nimport { ANT_LING_MODELS } from \"./providers/ant-ling.models.ts\";\nimport { ANTHROPIC_MODELS } from \"./providers/anthropic.models.ts\";\nimport { AZURE_OPENAI_RESPONSES_MODELS } from \"./providers/azure-openai-responses.models.ts\";\nimport { BASETEN_MODELS } from \"./providers/baseten.models.ts\";\nimport { CEREBRAS_MODELS } from \"./providers/cerebras.models.ts\";\nimport { CLOUDFLARE_AI_GATEWAY_MODELS } from \"./providers/cloudflare-ai-gateway.models.ts\";\nimport { CLOUDFLARE_WORKERS_AI_MODELS } from \"./providers/cloudflare-workers-ai.models.ts\";\nimport { DEEPSEEK_MODELS } from \"./providers/deepseek.models.ts\";\nimport { FIREWORKS_MODELS } from \"./providers/fireworks.models.ts\";\nimport { GITHUB_COPILOT_MODELS } from \"./providers/github-copilot.models.ts\";\nimport { GOOGLE_MODELS } from \"./providers/google.models.ts\";\nimport { GOOGLE_VERTEX_MODELS } from \"./providers/google-vertex.models.ts\";\nimport { GROQ_MODELS } from \"./providers/groq.models.ts\";\nimport { HUGGINGFACE_MODELS } from \"./providers/huggingface.models.ts\";\nimport { KIMI_CODING_MODELS } from \"./providers/kimi-coding.models.ts\";\nimport { MINIMAX_MODELS } from \"./providers/minimax.models.ts\";\nimport { MINIMAX_CN_MODELS } from \"./providers/minimax-cn.models.ts\";\nimport { MISTRAL_MODELS } from \"./providers/mistral.models.ts\";\nimport { MOONSHOTAI_MODELS } from \"./providers/moonshotai.models.ts\";\nimport { MOONSHOTAI_CN_MODELS } from \"./providers/moonshotai-cn.models.ts\";\nimport { NVIDIA_MODELS } from \"./providers/nvidia.models.ts\";\nimport { OPENAI_MODELS } from \"./providers/openai.models.ts\";\nimport { OPENAI_CODEX_MODELS } from \"./providers/openai-codex.models.ts\";\nimport { OPENCODE_MODELS } from \"./providers/opencode.models.ts\";\nimport { OPENCODE_GO_MODELS } from \"./providers/opencode-go.models.ts\";\nimport { OPENROUTER_MODELS } from \"./providers/openrouter.models.ts\";\nimport { QWEN_TOKEN_PLAN_MODELS } from \"./providers/qwen-token-plan.models.ts\";\nimport { QWEN_TOKEN_PLAN_CN_MODELS } from \"./providers/qwen-token-plan-cn.models.ts\";\nimport { TOGETHER_MODELS } from \"./providers/together.models.ts\";\nimport { VERCEL_AI_GATEWAY_MODELS } from \"./providers/vercel-ai-gateway.models.ts\";\nimport { XAI_MODELS } from \"./providers/xai.models.ts\";\nimport { XIAOMI_MODELS } from \"./providers/xiaomi.models.ts\";\nimport { XIAOMI_TOKEN_PLAN_AMS_MODELS } from \"./providers/xiaomi-token-plan-ams.models.ts\";\nimport { XIAOMI_TOKEN_PLAN_CN_MODELS } from \"./providers/xiaomi-token-plan-cn.models.ts\";\nimport { XIAOMI_TOKEN_PLAN_SGP_MODELS } from \"./providers/xiaomi-token-plan-sgp.models.ts\";\nimport { ZAI_MODELS } from \"./providers/zai.models.ts\";\nimport { ZAI_CODING_CN_MODELS } from \"./providers/zai-coding-cn.models.ts\";\n\nexport const MODELS: {\n\treadonly \"amazon-bedrock\": typeof AMAZON_BEDROCK_MODELS;\n\treadonly \"ant-ling\": typeof ANT_LING_MODELS;\n\treadonly \"anthropic\": typeof ANTHROPIC_MODELS;\n\treadonly \"azure-openai-responses\": typeof AZURE_OPENAI_RESPONSES_MODELS;\n\treadonly \"baseten\": typeof BASETEN_MODELS;\n\treadonly \"cerebras\": typeof CEREBRAS_MODELS;\n\treadonly \"cloudflare-ai-gateway\": typeof CLOUDFLARE_AI_GATEWAY_MODELS;\n\treadonly \"cloudflare-workers-ai\": typeof CLOUDFLARE_WORKERS_AI_MODELS;\n\treadonly \"deepseek\": typeof DEEPSEEK_MODELS;\n\treadonly \"fireworks\": typeof FIREWORKS_MODELS;\n\treadonly \"github-copilot\": typeof GITHUB_COPILOT_MODELS;\n\treadonly \"google\": typeof GOOGLE_MODELS;\n\treadonly \"google-vertex\": typeof GOOGLE_VERTEX_MODELS;\n\treadonly \"groq\": typeof GROQ_MODELS;\n\treadonly \"huggingface\": typeof HUGGINGFACE_MODELS;\n\treadonly \"kimi-coding\": typeof KIMI_CODING_MODELS;\n\treadonly \"minimax\": typeof MINIMAX_MODELS;\n\treadonly \"minimax-cn\": typeof MINIMAX_CN_MODELS;\n\treadonly \"mistral\": typeof MISTRAL_MODELS;\n\treadonly \"moonshotai\": typeof MOONSHOTAI_MODELS;\n\treadonly \"moonshotai-cn\": typeof MOONSHOTAI_CN_MODELS;\n\treadonly \"nvidia\": typeof NVIDIA_MODELS;\n\treadonly \"openai\": typeof OPENAI_MODELS;\n\treadonly \"openai-codex\": typeof OPENAI_CODEX_MODELS;\n\treadonly \"opencode\": typeof OPENCODE_MODELS;\n\treadonly \"opencode-go\": typeof OPENCODE_GO_MODELS;\n\treadonly \"openrouter\": typeof OPENROUTER_MODELS;\n\treadonly \"qwen-token-plan\": typeof QWEN_TOKEN_PLAN_MODELS;\n\treadonly \"qwen-token-plan-cn\": typeof QWEN_TOKEN_PLAN_CN_MODELS;\n\treadonly \"together\": typeof TOGETHER_MODELS;\n\treadonly \"vercel-ai-gateway\": typeof VERCEL_AI_GATEWAY_MODELS;\n\treadonly \"xai\": typeof XAI_MODELS;\n\treadonly \"xiaomi\": typeof XIAOMI_MODELS;\n\treadonly \"xiaomi-token-plan-ams\": typeof XIAOMI_TOKEN_PLAN_AMS_MODELS;\n\treadonly \"xiaomi-token-plan-cn\": typeof XIAOMI_TOKEN_PLAN_CN_MODELS;\n\treadonly \"xiaomi-token-plan-sgp\": typeof XIAOMI_TOKEN_PLAN_SGP_MODELS;\n\treadonly \"zai\": typeof ZAI_MODELS;\n\treadonly \"zai-coding-cn\": typeof ZAI_CODING_CN_MODELS;\n} = {\n\t\"amazon-bedrock\": AMAZON_BEDROCK_MODELS,\n\t\"ant-ling\": ANT_LING_MODELS,\n\t\"anthropic\": ANTHROPIC_MODELS,\n\t\"azure-openai-responses\": AZURE_OPENAI_RESPONSES_MODELS,\n\t\"baseten\": BASETEN_MODELS,\n\t\"cerebras\": CEREBRAS_MODELS,\n\t\"cloudflare-ai-gateway\": CLOUDFLARE_AI_GATEWAY_MODELS,\n\t\"cloudflare-workers-ai\": CLOUDFLARE_WORKERS_AI_MODELS,\n\t\"deepseek\": DEEPSEEK_MODELS,\n\t\"fireworks\": FIREWORKS_MODELS,\n\t\"github-copilot\": GITHUB_COPILOT_MODELS,\n\t\"google\": GOOGLE_MODELS,\n\t\"google-vertex\": GOOGLE_VERTEX_MODELS,\n\t\"groq\": GROQ_MODELS,\n\t\"huggingface\": HUGGINGFACE_MODELS,\n\t\"kimi-coding\": KIMI_CODING_MODELS,\n\t\"minimax\": MINIMAX_MODELS,\n\t\"minimax-cn\": MINIMAX_CN_MODELS,\n\t\"mistral\": MISTRAL_MODELS,\n\t\"moonshotai\": MOONSHOTAI_MODELS,\n\t\"moonshotai-cn\": MOONSHOTAI_CN_MODELS,\n\t\"nvidia\": NVIDIA_MODELS,\n\t\"openai\": OPENAI_MODELS,\n\t\"openai-codex\": OPENAI_CODEX_MODELS,\n\t\"opencode\": OPENCODE_MODELS,\n\t\"opencode-go\": OPENCODE_GO_MODELS,\n\t\"openrouter\": OPENROUTER_MODELS,\n\t\"qwen-token-plan\": QWEN_TOKEN_PLAN_MODELS,\n\t\"qwen-token-plan-cn\": QWEN_TOKEN_PLAN_CN_MODELS,\n\t\"together\": TOGETHER_MODELS,\n\t\"vercel-ai-gateway\": VERCEL_AI_GATEWAY_MODELS,\n\t\"xai\": XAI_MODELS,\n\t\"xiaomi\": XIAOMI_MODELS,\n\t\"xiaomi-token-plan-ams\": XIAOMI_TOKEN_PLAN_AMS_MODELS,\n\t\"xiaomi-token-plan-cn\": XIAOMI_TOKEN_PLAN_CN_MODELS,\n\t\"xiaomi-token-plan-sgp\": XIAOMI_TOKEN_PLAN_SGP_MODELS,\n\t\"zai\": ZAI_MODELS,\n\t\"zai-coding-cn\": ZAI_CODING_CN_MODELS,\n};\n"]}
1
+ {"version":3,"file":"models.generated.d.ts","sourceRoot":"","sources":["../src/models.generated.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,6BAA6B,EAAE,MAAM,8CAA8C,CAAC;AAC7F,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OA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m run generate-models' to update\n\nimport { AMAZON_BEDROCK_MODELS } from \"./providers/amazon-bedrock.models.ts\";\nimport { ANT_LING_MODELS } from \"./providers/ant-ling.models.ts\";\nimport { ANTHROPIC_MODELS } from \"./providers/anthropic.models.ts\";\nimport { AZURE_OPENAI_RESPONSES_MODELS } from \"./providers/azure-openai-responses.models.ts\";\nimport { BASETEN_MODELS } from \"./providers/baseten.models.ts\";\nimport { CEREBRAS_MODELS } from \"./providers/cerebras.models.ts\";\nimport { CLOUDFLARE_AI_GATEWAY_MODELS } from \"./providers/cloudflare-ai-gateway.models.ts\";\nimport { CLOUDFLARE_WORKERS_AI_MODELS } from \"./providers/cloudflare-workers-ai.models.ts\";\nimport { DEEPSEEK_MODELS } from \"./providers/deepseek.models.ts\";\nimport { FIREWORKS_MODELS } from \"./providers/fireworks.models.ts\";\nimport { GITHUB_COPILOT_MODELS } from \"./providers/github-copilot.models.ts\";\nimport { GOOGLE_MODELS } from \"./providers/google.models.ts\";\nimport { GOOGLE_VERTEX_MODELS } from \"./providers/google-vertex.models.ts\";\nimport { GROQ_MODELS } from \"./providers/groq.models.ts\";\nimport { HUGGINGFACE_MODELS } from \"./providers/huggingface.models.ts\";\nimport { KIMI_CODING_MODELS } from \"./providers/kimi-coding.models.ts\";\nimport { MINIMAX_MODELS } from \"./providers/minimax.models.ts\";\nimport { MINIMAX_CN_MODELS } from \"./providers/minimax-cn.models.ts\";\nimport { MISTRAL_MODELS } from \"./providers/mistral.models.ts\";\nimport { MOONSHOTAI_MODELS } from \"./providers/moonshotai.models.ts\";\nimport { MOONSHOTAI_CN_MODELS } from \"./providers/moonshotai-cn.models.ts\";\nimport { NVIDIA_MODELS } from \"./providers/nvidia.models.ts\";\nimport { OPENAI_MODELS } from \"./providers/openai.models.ts\";\nimport { OPENAI_CODEX_MODELS } from \"./providers/openai-codex.models.ts\";\nimport { OPENCODE_MODELS } from \"./providers/opencode.models.ts\";\nimport { OPENCODE_GO_MODELS } from \"./providers/opencode-go.models.ts\";\nimport { OPENROUTER_MODELS } from \"./providers/openrouter.models.ts\";\nimport { QWEN_TOKEN_PLAN_MODELS } from \"./providers/qwen-token-plan.models.ts\";\nimport { QWEN_TOKEN_PLAN_CN_MODELS } from \"./providers/qwen-token-plan-cn.models.ts\";\nimport { QWEN_TOKEN_PLAN_INDIVIDUAL_MODELS } from \"./providers/qwen-token-plan-individual.models.ts\";\nimport { TOGETHER_MODELS } from \"./providers/together.models.ts\";\nimport { VERCEL_AI_GATEWAY_MODELS } from \"./providers/vercel-ai-gateway.models.ts\";\nimport { XAI_MODELS } from \"./providers/xai.models.ts\";\nimport { XIAOMI_MODELS } from \"./providers/xiaomi.models.ts\";\nimport { XIAOMI_TOKEN_PLAN_AMS_MODELS } from \"./providers/xiaomi-token-plan-ams.models.ts\";\nimport { XIAOMI_TOKEN_PLAN_CN_MODELS } from \"./providers/xiaomi-token-plan-cn.models.ts\";\nimport { XIAOMI_TOKEN_PLAN_SGP_MODELS } from \"./providers/xiaomi-token-plan-sgp.models.ts\";\nimport { ZAI_MODELS } from \"./providers/zai.models.ts\";\nimport { ZAI_CODING_CN_MODELS } from \"./providers/zai-coding-cn.models.ts\";\n\nexport const MODELS: {\n\treadonly \"amazon-bedrock\": typeof AMAZON_BEDROCK_MODELS;\n\treadonly \"ant-ling\": typeof ANT_LING_MODELS;\n\treadonly \"anthropic\": typeof ANTHROPIC_MODELS;\n\treadonly \"azure-openai-responses\": typeof AZURE_OPENAI_RESPONSES_MODELS;\n\treadonly \"baseten\": typeof BASETEN_MODELS;\n\treadonly \"cerebras\": typeof CEREBRAS_MODELS;\n\treadonly \"cloudflare-ai-gateway\": typeof CLOUDFLARE_AI_GATEWAY_MODELS;\n\treadonly \"cloudflare-workers-ai\": typeof CLOUDFLARE_WORKERS_AI_MODELS;\n\treadonly \"deepseek\": typeof DEEPSEEK_MODELS;\n\treadonly \"fireworks\": typeof FIREWORKS_MODELS;\n\treadonly \"github-copilot\": typeof GITHUB_COPILOT_MODELS;\n\treadonly \"google\": typeof GOOGLE_MODELS;\n\treadonly \"google-vertex\": typeof GOOGLE_VERTEX_MODELS;\n\treadonly \"groq\": typeof GROQ_MODELS;\n\treadonly \"huggingface\": typeof HUGGINGFACE_MODELS;\n\treadonly \"kimi-coding\": typeof KIMI_CODING_MODELS;\n\treadonly \"minimax\": typeof MINIMAX_MODELS;\n\treadonly \"minimax-cn\": typeof MINIMAX_CN_MODELS;\n\treadonly \"mistral\": typeof MISTRAL_MODELS;\n\treadonly \"moonshotai\": typeof MOONSHOTAI_MODELS;\n\treadonly \"moonshotai-cn\": typeof MOONSHOTAI_CN_MODELS;\n\treadonly \"nvidia\": typeof NVIDIA_MODELS;\n\treadonly \"openai\": typeof OPENAI_MODELS;\n\treadonly \"openai-codex\": typeof OPENAI_CODEX_MODELS;\n\treadonly \"opencode\": typeof OPENCODE_MODELS;\n\treadonly \"opencode-go\": typeof OPENCODE_GO_MODELS;\n\treadonly \"openrouter\": typeof OPENROUTER_MODELS;\n\treadonly \"qwen-token-plan\": typeof QWEN_TOKEN_PLAN_MODELS;\n\treadonly \"qwen-token-plan-cn\": typeof QWEN_TOKEN_PLAN_CN_MODELS;\n\treadonly \"qwen-token-plan-individual\": typeof QWEN_TOKEN_PLAN_INDIVIDUAL_MODELS;\n\treadonly \"together\": typeof TOGETHER_MODELS;\n\treadonly \"vercel-ai-gateway\": typeof VERCEL_AI_GATEWAY_MODELS;\n\treadonly \"xai\": typeof XAI_MODELS;\n\treadonly \"xiaomi\": typeof XIAOMI_MODELS;\n\treadonly \"xiaomi-token-plan-ams\": typeof XIAOMI_TOKEN_PLAN_AMS_MODELS;\n\treadonly \"xiaomi-token-plan-cn\": typeof XIAOMI_TOKEN_PLAN_CN_MODELS;\n\treadonly \"xiaomi-token-plan-sgp\": typeof XIAOMI_TOKEN_PLAN_SGP_MODELS;\n\treadonly \"zai\": typeof ZAI_MODELS;\n\treadonly \"zai-coding-cn\": typeof ZAI_CODING_CN_MODELS;\n} = {\n\t\"amazon-bedrock\": AMAZON_BEDROCK_MODELS,\n\t\"ant-ling\": ANT_LING_MODELS,\n\t\"anthropic\": ANTHROPIC_MODELS,\n\t\"azure-openai-responses\": AZURE_OPENAI_RESPONSES_MODELS,\n\t\"baseten\": BASETEN_MODELS,\n\t\"cerebras\": CEREBRAS_MODELS,\n\t\"cloudflare-ai-gateway\": CLOUDFLARE_AI_GATEWAY_MODELS,\n\t\"cloudflare-workers-ai\": CLOUDFLARE_WORKERS_AI_MODELS,\n\t\"deepseek\": DEEPSEEK_MODELS,\n\t\"fireworks\": FIREWORKS_MODELS,\n\t\"github-copilot\": GITHUB_COPILOT_MODELS,\n\t\"google\": GOOGLE_MODELS,\n\t\"google-vertex\": GOOGLE_VERTEX_MODELS,\n\t\"groq\": GROQ_MODELS,\n\t\"huggingface\": HUGGINGFACE_MODELS,\n\t\"kimi-coding\": KIMI_CODING_MODELS,\n\t\"minimax\": MINIMAX_MODELS,\n\t\"minimax-cn\": MINIMAX_CN_MODELS,\n\t\"mistral\": MISTRAL_MODELS,\n\t\"moonshotai\": MOONSHOTAI_MODELS,\n\t\"moonshotai-cn\": MOONSHOTAI_CN_MODELS,\n\t\"nvidia\": NVIDIA_MODELS,\n\t\"openai\": OPENAI_MODELS,\n\t\"openai-codex\": OPENAI_CODEX_MODELS,\n\t\"opencode\": OPENCODE_MODELS,\n\t\"opencode-go\": OPENCODE_GO_MODELS,\n\t\"openrouter\": OPENROUTER_MODELS,\n\t\"qwen-token-plan\": QWEN_TOKEN_PLAN_MODELS,\n\t\"qwen-token-plan-cn\": QWEN_TOKEN_PLAN_CN_MODELS,\n\t\"qwen-token-plan-individual\": QWEN_TOKEN_PLAN_INDIVIDUAL_MODELS,\n\t\"together\": TOGETHER_MODELS,\n\t\"vercel-ai-gateway\": VERCEL_AI_GATEWAY_MODELS,\n\t\"xai\": XAI_MODELS,\n\t\"xiaomi\": XIAOMI_MODELS,\n\t\"xiaomi-token-plan-ams\": XIAOMI_TOKEN_PLAN_AMS_MODELS,\n\t\"xiaomi-token-plan-cn\": XIAOMI_TOKEN_PLAN_CN_MODELS,\n\t\"xiaomi-token-plan-sgp\": XIAOMI_TOKEN_PLAN_SGP_MODELS,\n\t\"zai\": ZAI_MODELS,\n\t\"zai-coding-cn\": ZAI_CODING_CN_MODELS,\n};\n"]}
@@ -29,6 +29,7 @@ import { OPENCODE_GO_MODELS } from "./providers/opencode-go.models.js";
29
29
  import { OPENROUTER_MODELS } from "./providers/openrouter.models.js";
30
30
  import { QWEN_TOKEN_PLAN_MODELS } from "./providers/qwen-token-plan.models.js";
31
31
  import { QWEN_TOKEN_PLAN_CN_MODELS } from "./providers/qwen-token-plan-cn.models.js";
32
+ import { QWEN_TOKEN_PLAN_INDIVIDUAL_MODELS } from "./providers/qwen-token-plan-individual.models.js";
32
33
  import { TOGETHER_MODELS } from "./providers/together.models.js";
33
34
  import { VERCEL_AI_GATEWAY_MODELS } from "./providers/vercel-ai-gateway.models.js";
34
35
  import { XAI_MODELS } from "./providers/xai.models.js";
@@ -68,6 +69,7 @@ export const MODELS = {
68
69
  "openrouter": OPENROUTER_MODELS,
69
70
  "qwen-token-plan": QWEN_TOKEN_PLAN_MODELS,
70
71
  "qwen-token-plan-cn": QWEN_TOKEN_PLAN_CN_MODELS,
72
+ "qwen-token-plan-individual": QWEN_TOKEN_PLAN_INDIVIDUAL_MODELS,
71
73
  "together": TOGETHER_MODELS,
72
74
  "vercel-ai-gateway": VERCEL_AI_GATEWAY_MODELS,
73
75
  "xai": XAI_MODELS,
@@ -1 +1 @@
1
- {"version":3,"file":"models.generated.js","sourceRoot":"","sources":["../src/models.generated.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,iEAAiE;AAEjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,6BAA6B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,cAAc,EAAE,mBAAmB;IACnC,UAAU,EAAE,eAAe;IAC3B,aAAa,EAAE,kBAAkB;IACjC,YAAY,EAAE,iBAAiB;IAC/B,iBAAiB,EAAE,sBAAsB;IACzC,oBAAoB,EAAE,yBAAyB;IAC/C,UAAU,EAAE,eAAe;IAC3B,mBAAmB,EAAE,wBAAwB;IAC7C,KAAK,EAAE,UAAU;IACjB,QAAQ,EAAE,aAAa;IACvB,uBAAuB,EAAE,4BAA4B;IACrD,sBAAsB,EAAE,2BAA2B;IACnD,uBAAuB,EAAE,4BAA4B;IACrD,KAAK,EAAE,UAAU;IACjB,eAAe,EAAE,oBAAoB;CACrC,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 { AMAZON_BEDROCK_MODELS } from \"./providers/amazon-bedrock.models.ts\";\nimport { ANT_LING_MODELS } from \"./providers/ant-ling.models.ts\";\nimport { ANTHROPIC_MODELS } from \"./providers/anthropic.models.ts\";\nimport { AZURE_OPENAI_RESPONSES_MODELS } from \"./providers/azure-openai-responses.models.ts\";\nimport { BASETEN_MODELS } from \"./providers/baseten.models.ts\";\nimport { CEREBRAS_MODELS } from \"./providers/cerebras.models.ts\";\nimport { CLOUDFLARE_AI_GATEWAY_MODELS } from \"./providers/cloudflare-ai-gateway.models.ts\";\nimport { CLOUDFLARE_WORKERS_AI_MODELS } from \"./providers/cloudflare-workers-ai.models.ts\";\nimport { DEEPSEEK_MODELS } from \"./providers/deepseek.models.ts\";\nimport { FIREWORKS_MODELS } from \"./providers/fireworks.models.ts\";\nimport { GITHUB_COPILOT_MODELS } from \"./providers/github-copilot.models.ts\";\nimport { GOOGLE_MODELS } from \"./providers/google.models.ts\";\nimport { GOOGLE_VERTEX_MODELS } from \"./providers/google-vertex.models.ts\";\nimport { GROQ_MODELS } from \"./providers/groq.models.ts\";\nimport { HUGGINGFACE_MODELS } from \"./providers/huggingface.models.ts\";\nimport { KIMI_CODING_MODELS } from \"./providers/kimi-coding.models.ts\";\nimport { MINIMAX_MODELS } from \"./providers/minimax.models.ts\";\nimport { MINIMAX_CN_MODELS } from \"./providers/minimax-cn.models.ts\";\nimport { MISTRAL_MODELS } from \"./providers/mistral.models.ts\";\nimport { MOONSHOTAI_MODELS } from \"./providers/moonshotai.models.ts\";\nimport { MOONSHOTAI_CN_MODELS } from \"./providers/moonshotai-cn.models.ts\";\nimport { NVIDIA_MODELS } from \"./providers/nvidia.models.ts\";\nimport { OPENAI_MODELS } from \"./providers/openai.models.ts\";\nimport { OPENAI_CODEX_MODELS } from \"./providers/openai-codex.models.ts\";\nimport { OPENCODE_MODELS } from \"./providers/opencode.models.ts\";\nimport { OPENCODE_GO_MODELS } from \"./providers/opencode-go.models.ts\";\nimport { OPENROUTER_MODELS } from \"./providers/openrouter.models.ts\";\nimport { QWEN_TOKEN_PLAN_MODELS } from \"./providers/qwen-token-plan.models.ts\";\nimport { QWEN_TOKEN_PLAN_CN_MODELS } from \"./providers/qwen-token-plan-cn.models.ts\";\nimport { TOGETHER_MODELS } from \"./providers/together.models.ts\";\nimport { VERCEL_AI_GATEWAY_MODELS } from \"./providers/vercel-ai-gateway.models.ts\";\nimport { XAI_MODELS } from \"./providers/xai.models.ts\";\nimport { XIAOMI_MODELS } from \"./providers/xiaomi.models.ts\";\nimport { XIAOMI_TOKEN_PLAN_AMS_MODELS } from \"./providers/xiaomi-token-plan-ams.models.ts\";\nimport { XIAOMI_TOKEN_PLAN_CN_MODELS } from \"./providers/xiaomi-token-plan-cn.models.ts\";\nimport { XIAOMI_TOKEN_PLAN_SGP_MODELS } from \"./providers/xiaomi-token-plan-sgp.models.ts\";\nimport { ZAI_MODELS } from \"./providers/zai.models.ts\";\nimport { ZAI_CODING_CN_MODELS } from \"./providers/zai-coding-cn.models.ts\";\n\nexport const MODELS: {\n\treadonly \"amazon-bedrock\": typeof AMAZON_BEDROCK_MODELS;\n\treadonly \"ant-ling\": typeof ANT_LING_MODELS;\n\treadonly \"anthropic\": typeof ANTHROPIC_MODELS;\n\treadonly \"azure-openai-responses\": typeof AZURE_OPENAI_RESPONSES_MODELS;\n\treadonly \"baseten\": typeof BASETEN_MODELS;\n\treadonly \"cerebras\": typeof CEREBRAS_MODELS;\n\treadonly \"cloudflare-ai-gateway\": typeof CLOUDFLARE_AI_GATEWAY_MODELS;\n\treadonly \"cloudflare-workers-ai\": typeof CLOUDFLARE_WORKERS_AI_MODELS;\n\treadonly \"deepseek\": typeof DEEPSEEK_MODELS;\n\treadonly \"fireworks\": typeof FIREWORKS_MODELS;\n\treadonly \"github-copilot\": typeof GITHUB_COPILOT_MODELS;\n\treadonly \"google\": typeof GOOGLE_MODELS;\n\treadonly \"google-vertex\": typeof GOOGLE_VERTEX_MODELS;\n\treadonly \"groq\": typeof GROQ_MODELS;\n\treadonly \"huggingface\": typeof HUGGINGFACE_MODELS;\n\treadonly \"kimi-coding\": typeof KIMI_CODING_MODELS;\n\treadonly \"minimax\": typeof MINIMAX_MODELS;\n\treadonly \"minimax-cn\": typeof MINIMAX_CN_MODELS;\n\treadonly \"mistral\": typeof MISTRAL_MODELS;\n\treadonly \"moonshotai\": typeof MOONSHOTAI_MODELS;\n\treadonly \"moonshotai-cn\": typeof MOONSHOTAI_CN_MODELS;\n\treadonly \"nvidia\": typeof NVIDIA_MODELS;\n\treadonly \"openai\": typeof OPENAI_MODELS;\n\treadonly \"openai-codex\": typeof OPENAI_CODEX_MODELS;\n\treadonly \"opencode\": typeof OPENCODE_MODELS;\n\treadonly \"opencode-go\": typeof OPENCODE_GO_MODELS;\n\treadonly \"openrouter\": typeof OPENROUTER_MODELS;\n\treadonly \"qwen-token-plan\": typeof QWEN_TOKEN_PLAN_MODELS;\n\treadonly \"qwen-token-plan-cn\": typeof QWEN_TOKEN_PLAN_CN_MODELS;\n\treadonly \"together\": typeof TOGETHER_MODELS;\n\treadonly \"vercel-ai-gateway\": typeof VERCEL_AI_GATEWAY_MODELS;\n\treadonly \"xai\": typeof XAI_MODELS;\n\treadonly \"xiaomi\": typeof XIAOMI_MODELS;\n\treadonly \"xiaomi-token-plan-ams\": typeof XIAOMI_TOKEN_PLAN_AMS_MODELS;\n\treadonly \"xiaomi-token-plan-cn\": typeof XIAOMI_TOKEN_PLAN_CN_MODELS;\n\treadonly \"xiaomi-token-plan-sgp\": typeof XIAOMI_TOKEN_PLAN_SGP_MODELS;\n\treadonly \"zai\": typeof ZAI_MODELS;\n\treadonly \"zai-coding-cn\": typeof ZAI_CODING_CN_MODELS;\n} = {\n\t\"amazon-bedrock\": AMAZON_BEDROCK_MODELS,\n\t\"ant-ling\": ANT_LING_MODELS,\n\t\"anthropic\": ANTHROPIC_MODELS,\n\t\"azure-openai-responses\": AZURE_OPENAI_RESPONSES_MODELS,\n\t\"baseten\": BASETEN_MODELS,\n\t\"cerebras\": CEREBRAS_MODELS,\n\t\"cloudflare-ai-gateway\": CLOUDFLARE_AI_GATEWAY_MODELS,\n\t\"cloudflare-workers-ai\": CLOUDFLARE_WORKERS_AI_MODELS,\n\t\"deepseek\": DEEPSEEK_MODELS,\n\t\"fireworks\": FIREWORKS_MODELS,\n\t\"github-copilot\": GITHUB_COPILOT_MODELS,\n\t\"google\": GOOGLE_MODELS,\n\t\"google-vertex\": GOOGLE_VERTEX_MODELS,\n\t\"groq\": GROQ_MODELS,\n\t\"huggingface\": HUGGINGFACE_MODELS,\n\t\"kimi-coding\": KIMI_CODING_MODELS,\n\t\"minimax\": MINIMAX_MODELS,\n\t\"minimax-cn\": MINIMAX_CN_MODELS,\n\t\"mistral\": MISTRAL_MODELS,\n\t\"moonshotai\": MOONSHOTAI_MODELS,\n\t\"moonshotai-cn\": MOONSHOTAI_CN_MODELS,\n\t\"nvidia\": NVIDIA_MODELS,\n\t\"openai\": OPENAI_MODELS,\n\t\"openai-codex\": OPENAI_CODEX_MODELS,\n\t\"opencode\": OPENCODE_MODELS,\n\t\"opencode-go\": OPENCODE_GO_MODELS,\n\t\"openrouter\": OPENROUTER_MODELS,\n\t\"qwen-token-plan\": QWEN_TOKEN_PLAN_MODELS,\n\t\"qwen-token-plan-cn\": QWEN_TOKEN_PLAN_CN_MODELS,\n\t\"together\": TOGETHER_MODELS,\n\t\"vercel-ai-gateway\": VERCEL_AI_GATEWAY_MODELS,\n\t\"xai\": XAI_MODELS,\n\t\"xiaomi\": XIAOMI_MODELS,\n\t\"xiaomi-token-plan-ams\": XIAOMI_TOKEN_PLAN_AMS_MODELS,\n\t\"xiaomi-token-plan-cn\": XIAOMI_TOKEN_PLAN_CN_MODELS,\n\t\"xiaomi-token-plan-sgp\": XIAOMI_TOKEN_PLAN_SGP_MODELS,\n\t\"zai\": ZAI_MODELS,\n\t\"zai-coding-cn\": ZAI_CODING_CN_MODELS,\n};\n"]}
1
+ {"version":3,"file":"models.generated.js","sourceRoot":"","sources":["../src/models.generated.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,iEAAiE;AAEjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,6BAA6B,EAAE,MAAM,8CAA8C,CAAC;AAC7F,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCA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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 { AMAZON_BEDROCK_MODELS } from \"./providers/amazon-bedrock.models.ts\";\nimport { ANT_LING_MODELS } from \"./providers/ant-ling.models.ts\";\nimport { ANTHROPIC_MODELS } from \"./providers/anthropic.models.ts\";\nimport { AZURE_OPENAI_RESPONSES_MODELS } from \"./providers/azure-openai-responses.models.ts\";\nimport { BASETEN_MODELS } from \"./providers/baseten.models.ts\";\nimport { CEREBRAS_MODELS } from \"./providers/cerebras.models.ts\";\nimport { CLOUDFLARE_AI_GATEWAY_MODELS } from \"./providers/cloudflare-ai-gateway.models.ts\";\nimport { CLOUDFLARE_WORKERS_AI_MODELS } from \"./providers/cloudflare-workers-ai.models.ts\";\nimport { DEEPSEEK_MODELS } from \"./providers/deepseek.models.ts\";\nimport { FIREWORKS_MODELS } from \"./providers/fireworks.models.ts\";\nimport { GITHUB_COPILOT_MODELS } from \"./providers/github-copilot.models.ts\";\nimport { GOOGLE_MODELS } from \"./providers/google.models.ts\";\nimport { GOOGLE_VERTEX_MODELS } from \"./providers/google-vertex.models.ts\";\nimport { GROQ_MODELS } from \"./providers/groq.models.ts\";\nimport { HUGGINGFACE_MODELS } from \"./providers/huggingface.models.ts\";\nimport { KIMI_CODING_MODELS } from \"./providers/kimi-coding.models.ts\";\nimport { MINIMAX_MODELS } from \"./providers/minimax.models.ts\";\nimport { MINIMAX_CN_MODELS } from \"./providers/minimax-cn.models.ts\";\nimport { MISTRAL_MODELS } from \"./providers/mistral.models.ts\";\nimport { MOONSHOTAI_MODELS } from \"./providers/moonshotai.models.ts\";\nimport { MOONSHOTAI_CN_MODELS } from \"./providers/moonshotai-cn.models.ts\";\nimport { NVIDIA_MODELS } from \"./providers/nvidia.models.ts\";\nimport { OPENAI_MODELS } from \"./providers/openai.models.ts\";\nimport { OPENAI_CODEX_MODELS } from \"./providers/openai-codex.models.ts\";\nimport { OPENCODE_MODELS } from \"./providers/opencode.models.ts\";\nimport { OPENCODE_GO_MODELS } from \"./providers/opencode-go.models.ts\";\nimport { OPENROUTER_MODELS } from \"./providers/openrouter.models.ts\";\nimport { QWEN_TOKEN_PLAN_MODELS } from \"./providers/qwen-token-plan.models.ts\";\nimport { QWEN_TOKEN_PLAN_CN_MODELS } from \"./providers/qwen-token-plan-cn.models.ts\";\nimport { QWEN_TOKEN_PLAN_INDIVIDUAL_MODELS } from \"./providers/qwen-token-plan-individual.models.ts\";\nimport { TOGETHER_MODELS } from \"./providers/together.models.ts\";\nimport { VERCEL_AI_GATEWAY_MODELS } from \"./providers/vercel-ai-gateway.models.ts\";\nimport { XAI_MODELS } from \"./providers/xai.models.ts\";\nimport { XIAOMI_MODELS } from \"./providers/xiaomi.models.ts\";\nimport { XIAOMI_TOKEN_PLAN_AMS_MODELS } from \"./providers/xiaomi-token-plan-ams.models.ts\";\nimport { XIAOMI_TOKEN_PLAN_CN_MODELS } from \"./providers/xiaomi-token-plan-cn.models.ts\";\nimport { XIAOMI_TOKEN_PLAN_SGP_MODELS } from \"./providers/xiaomi-token-plan-sgp.models.ts\";\nimport { ZAI_MODELS } from \"./providers/zai.models.ts\";\nimport { ZAI_CODING_CN_MODELS } from \"./providers/zai-coding-cn.models.ts\";\n\nexport const MODELS: {\n\treadonly \"amazon-bedrock\": typeof AMAZON_BEDROCK_MODELS;\n\treadonly \"ant-ling\": typeof ANT_LING_MODELS;\n\treadonly \"anthropic\": typeof ANTHROPIC_MODELS;\n\treadonly \"azure-openai-responses\": typeof AZURE_OPENAI_RESPONSES_MODELS;\n\treadonly \"baseten\": typeof BASETEN_MODELS;\n\treadonly \"cerebras\": typeof CEREBRAS_MODELS;\n\treadonly \"cloudflare-ai-gateway\": typeof CLOUDFLARE_AI_GATEWAY_MODELS;\n\treadonly \"cloudflare-workers-ai\": typeof CLOUDFLARE_WORKERS_AI_MODELS;\n\treadonly \"deepseek\": typeof DEEPSEEK_MODELS;\n\treadonly \"fireworks\": typeof FIREWORKS_MODELS;\n\treadonly \"github-copilot\": typeof GITHUB_COPILOT_MODELS;\n\treadonly \"google\": typeof GOOGLE_MODELS;\n\treadonly \"google-vertex\": typeof GOOGLE_VERTEX_MODELS;\n\treadonly \"groq\": typeof GROQ_MODELS;\n\treadonly \"huggingface\": typeof HUGGINGFACE_MODELS;\n\treadonly \"kimi-coding\": typeof KIMI_CODING_MODELS;\n\treadonly \"minimax\": typeof MINIMAX_MODELS;\n\treadonly \"minimax-cn\": typeof MINIMAX_CN_MODELS;\n\treadonly \"mistral\": typeof MISTRAL_MODELS;\n\treadonly \"moonshotai\": typeof MOONSHOTAI_MODELS;\n\treadonly \"moonshotai-cn\": typeof MOONSHOTAI_CN_MODELS;\n\treadonly \"nvidia\": typeof NVIDIA_MODELS;\n\treadonly \"openai\": typeof OPENAI_MODELS;\n\treadonly \"openai-codex\": typeof OPENAI_CODEX_MODELS;\n\treadonly \"opencode\": typeof OPENCODE_MODELS;\n\treadonly \"opencode-go\": typeof OPENCODE_GO_MODELS;\n\treadonly \"openrouter\": typeof OPENROUTER_MODELS;\n\treadonly \"qwen-token-plan\": typeof QWEN_TOKEN_PLAN_MODELS;\n\treadonly \"qwen-token-plan-cn\": typeof QWEN_TOKEN_PLAN_CN_MODELS;\n\treadonly \"qwen-token-plan-individual\": typeof QWEN_TOKEN_PLAN_INDIVIDUAL_MODELS;\n\treadonly \"together\": typeof TOGETHER_MODELS;\n\treadonly \"vercel-ai-gateway\": typeof VERCEL_AI_GATEWAY_MODELS;\n\treadonly \"xai\": typeof XAI_MODELS;\n\treadonly \"xiaomi\": typeof XIAOMI_MODELS;\n\treadonly \"xiaomi-token-plan-ams\": typeof XIAOMI_TOKEN_PLAN_AMS_MODELS;\n\treadonly \"xiaomi-token-plan-cn\": typeof XIAOMI_TOKEN_PLAN_CN_MODELS;\n\treadonly \"xiaomi-token-plan-sgp\": typeof XIAOMI_TOKEN_PLAN_SGP_MODELS;\n\treadonly \"zai\": typeof ZAI_MODELS;\n\treadonly \"zai-coding-cn\": typeof ZAI_CODING_CN_MODELS;\n} = {\n\t\"amazon-bedrock\": AMAZON_BEDROCK_MODELS,\n\t\"ant-ling\": ANT_LING_MODELS,\n\t\"anthropic\": ANTHROPIC_MODELS,\n\t\"azure-openai-responses\": AZURE_OPENAI_RESPONSES_MODELS,\n\t\"baseten\": BASETEN_MODELS,\n\t\"cerebras\": CEREBRAS_MODELS,\n\t\"cloudflare-ai-gateway\": CLOUDFLARE_AI_GATEWAY_MODELS,\n\t\"cloudflare-workers-ai\": CLOUDFLARE_WORKERS_AI_MODELS,\n\t\"deepseek\": DEEPSEEK_MODELS,\n\t\"fireworks\": FIREWORKS_MODELS,\n\t\"github-copilot\": GITHUB_COPILOT_MODELS,\n\t\"google\": GOOGLE_MODELS,\n\t\"google-vertex\": GOOGLE_VERTEX_MODELS,\n\t\"groq\": GROQ_MODELS,\n\t\"huggingface\": HUGGINGFACE_MODELS,\n\t\"kimi-coding\": KIMI_CODING_MODELS,\n\t\"minimax\": MINIMAX_MODELS,\n\t\"minimax-cn\": MINIMAX_CN_MODELS,\n\t\"mistral\": MISTRAL_MODELS,\n\t\"moonshotai\": MOONSHOTAI_MODELS,\n\t\"moonshotai-cn\": MOONSHOTAI_CN_MODELS,\n\t\"nvidia\": NVIDIA_MODELS,\n\t\"openai\": OPENAI_MODELS,\n\t\"openai-codex\": OPENAI_CODEX_MODELS,\n\t\"opencode\": OPENCODE_MODELS,\n\t\"opencode-go\": OPENCODE_GO_MODELS,\n\t\"openrouter\": OPENROUTER_MODELS,\n\t\"qwen-token-plan\": QWEN_TOKEN_PLAN_MODELS,\n\t\"qwen-token-plan-cn\": QWEN_TOKEN_PLAN_CN_MODELS,\n\t\"qwen-token-plan-individual\": QWEN_TOKEN_PLAN_INDIVIDUAL_MODELS,\n\t\"together\": TOGETHER_MODELS,\n\t\"vercel-ai-gateway\": VERCEL_AI_GATEWAY_MODELS,\n\t\"xai\": XAI_MODELS,\n\t\"xiaomi\": XIAOMI_MODELS,\n\t\"xiaomi-token-plan-ams\": XIAOMI_TOKEN_PLAN_AMS_MODELS,\n\t\"xiaomi-token-plan-cn\": XIAOMI_TOKEN_PLAN_CN_MODELS,\n\t\"xiaomi-token-plan-sgp\": XIAOMI_TOKEN_PLAN_SGP_MODELS,\n\t\"zai\": ZAI_MODELS,\n\t\"zai-coding-cn\": ZAI_CODING_CN_MODELS,\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"all.d.ts","sourceRoot":"","sources":["../../src/providers/all.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACxG,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,KAAK,mBAAmB,EAAgB,KAAK,aAAa,EAAE,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AACzG,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAgC9C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAW7C,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B;;oBAEoB;AACpB,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,MAAM,CAAC;AAElD,KAAK,eAAe,CACnB,SAAS,SAAS,eAAe,EACjC,QAAQ,SAAS,MAAM,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,IAC9C,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,SAAS;IAAE,GAAG,EAAE,MAAM,IAAI,CAAA;CAAE,GAAG,CAAC,IAAI,SAAS,GAAG,GAAG,IAAI,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC;AAEjH,oDAAoD;AACpD,wBAAgB,eAAe,CAAC,SAAS,SAAS,eAAe,EAAE,QAAQ,SAAS,MAAM,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,EACnH,QAAQ,EAAE,SAAS,EACnB,OAAO,EAAE,QAAQ,GACf,KAAK,CAAC,eAAe,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAG7C;AAED,wBAAgB,mBAAmB,IAAI,eAAe,EAAE,CAEvD;AAED,qEAAqE;AACrE,wBAAgB,8BAA8B,IAAI,MAAM,GAAG,SAAS,CAGnE;AAED,wBAAgB,gBAAgB,CAAC,SAAS,SAAS,eAAe,EACjE,QAAQ,EAAE,SAAS,GACjB,KAAK,CAAC,eAAe,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAKvE;AAED,mDAAmD;AACnD,wBAAgB,gBAAgB,IAAI,QAAQ,EAAE,CA0C7C;AAED,qEAAqE;AACrE,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,aAAa,CAM1E;AAED,oEAAoE;AACpE,wBAAgB,sBAAsB,IAAI,cAAc,EAAE,CAEzD;AAED,6FAA6F;AAC7F,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,mBAAmB,CAMtF","sourcesContent":["import { createImagesModels, type ImagesProvider, type MutableImagesModels } from \"../images-models.ts\";\nimport { MODELS } from \"../models.generated.ts\";\nimport { type CreateModelsOptions, createModels, type MutableModels, type Provider } from \"../models.ts\";\nimport type { Api, Model } from \"../types.ts\";\nimport { amazonBedrockProvider } from \"./amazon-bedrock.ts\";\nimport { antLingProvider } from \"./ant-ling.ts\";\nimport { anthropicProvider } from \"./anthropic.ts\";\nimport { azureOpenAIResponsesProvider } from \"./azure-openai-responses.ts\";\nimport { basetenProvider } from \"./baseten.ts\";\nimport { cerebrasProvider } from \"./cerebras.ts\";\nimport { cloudflareAIGatewayProvider } from \"./cloudflare-ai-gateway.ts\";\nimport { cloudflareWorkersAIProvider } from \"./cloudflare-workers-ai.ts\";\nimport modelDataManifest from \"./data/.manifest.json\" with { type: \"json\" };\nimport { deepseekProvider } from \"./deepseek.ts\";\nimport { fireworksProvider } from \"./fireworks.ts\";\nimport { githubCopilotProvider } from \"./github-copilot.ts\";\nimport { googleProvider } from \"./google.ts\";\nimport { googleVertexProvider } from \"./google-vertex.ts\";\nimport { groqProvider } from \"./groq.ts\";\nimport { huggingfaceProvider } from \"./huggingface.ts\";\nimport { kimiCodingProvider } from \"./kimi-coding.ts\";\nimport { minimaxProvider } from \"./minimax.ts\";\nimport { minimaxCnProvider } from \"./minimax-cn.ts\";\nimport { mistralProvider } from \"./mistral.ts\";\nimport { moonshotaiProvider } from \"./moonshotai.ts\";\nimport { moonshotaiCnProvider } from \"./moonshotai-cn.ts\";\nimport { nvidiaProvider } from \"./nvidia.ts\";\nimport { openaiProvider } from \"./openai.ts\";\nimport { openaiCodexProvider } from \"./openai-codex.ts\";\nimport { opencodeProvider } from \"./opencode.ts\";\nimport { opencodeGoProvider } from \"./opencode-go.ts\";\nimport { openrouterProvider } from \"./openrouter.ts\";\nimport { openrouterImagesProvider } from \"./openrouter-images.ts\";\nimport { qwenTokenPlanProvider } from \"./qwen-token-plan.ts\";\nimport { qwenTokenPlanCnProvider } from \"./qwen-token-plan-cn.ts\";\nimport { radiusProvider } from \"./radius.ts\";\nimport { togetherProvider } from \"./together.ts\";\nimport { vercelAIGatewayProvider } from \"./vercel-ai-gateway.ts\";\nimport { xaiProvider } from \"./xai.ts\";\nimport { xiaomiProvider } from \"./xiaomi.ts\";\nimport { xiaomiTokenPlanAmsProvider } from \"./xiaomi-token-plan-ams.ts\";\nimport { xiaomiTokenPlanCnProvider } from \"./xiaomi-token-plan-cn.ts\";\nimport { xiaomiTokenPlanSgpProvider } from \"./xiaomi-token-plan-sgp.ts\";\nimport { zaiProvider } from \"./zai.ts\";\nimport { zaiCodingCnProvider } from \"./zai-coding-cn.ts\";\n\nexport { radiusProvider };\n\n/** Providers present in the generated catalog. `KnownProvider` additionally\n * includes purely dynamic providers (e.g. \"radius\") that have no static\n * catalog entry. */\nexport type BuiltinProvider = keyof typeof MODELS;\n\ntype BuiltinModelApi<\n\tTProvider extends BuiltinProvider,\n\tTModelId extends keyof (typeof MODELS)[TProvider],\n> = (typeof MODELS)[TProvider][TModelId] extends { api: infer TApi } ? (TApi extends Api ? TApi : never) : never;\n\n/** Typed read of the generated built-in catalog. */\nexport function getBuiltinModel<TProvider extends BuiltinProvider, TModelId extends keyof (typeof MODELS)[TProvider]>(\n\tprovider: TProvider,\n\tmodelId: TModelId,\n): Model<BuiltinModelApi<TProvider, TModelId>> {\n\tconst models = MODELS[provider] as Record<string, Model<Api>> | undefined;\n\treturn models?.[modelId as string] as Model<BuiltinModelApi<TProvider, TModelId>>;\n}\n\nexport function getBuiltinProviders(): BuiltinProvider[] {\n\treturn Object.keys(MODELS) as BuiltinProvider[];\n}\n\n/** Generation timestamp shared by all built-in provider catalogs. */\nexport function getBuiltinModelDataGeneratedAt(): number | undefined {\n\tconst generatedAt = Date.parse(modelDataManifest.generatedAt);\n\treturn Number.isNaN(generatedAt) ? undefined : generatedAt;\n}\n\nexport function getBuiltinModels<TProvider extends BuiltinProvider>(\n\tprovider: TProvider,\n): Model<BuiltinModelApi<TProvider, keyof (typeof MODELS)[TProvider]>>[] {\n\tconst models = MODELS[provider] as Record<string, Model<Api>> | undefined;\n\treturn models\n\t\t? (Object.values(models) as Model<BuiltinModelApi<TProvider, keyof (typeof MODELS)[TProvider]>>[])\n\t\t: [];\n}\n\n/** All built-in providers, freshly constructed. */\nexport function builtinProviders(): Provider[] {\n\treturn [\n\t\tamazonBedrockProvider(),\n\t\tantLingProvider(),\n\t\tanthropicProvider(),\n\t\tazureOpenAIResponsesProvider(),\n\t\tbasetenProvider(),\n\t\tcerebrasProvider(),\n\t\tcloudflareAIGatewayProvider(),\n\t\tcloudflareWorkersAIProvider(),\n\t\tdeepseekProvider(),\n\t\tfireworksProvider(),\n\t\tgithubCopilotProvider(),\n\t\tgoogleProvider(),\n\t\tgoogleVertexProvider(),\n\t\tgroqProvider(),\n\t\thuggingfaceProvider(),\n\t\tkimiCodingProvider(),\n\t\tminimaxProvider(),\n\t\tminimaxCnProvider(),\n\t\tmistralProvider(),\n\t\tmoonshotaiProvider(),\n\t\tmoonshotaiCnProvider(),\n\t\tnvidiaProvider(),\n\t\topenaiProvider(),\n\t\topenaiCodexProvider(),\n\t\topencodeProvider(),\n\t\topencodeGoProvider(),\n\t\topenrouterProvider(),\n\t\tqwenTokenPlanProvider(),\n\t\tqwenTokenPlanCnProvider(),\n\t\tradiusProvider(),\n\t\ttogetherProvider(),\n\t\tvercelAIGatewayProvider(),\n\t\txaiProvider(),\n\t\txiaomiProvider(),\n\t\txiaomiTokenPlanAmsProvider(),\n\t\txiaomiTokenPlanCnProvider(),\n\t\txiaomiTokenPlanSgpProvider(),\n\t\tzaiProvider(),\n\t\tzaiCodingCnProvider(),\n\t];\n}\n\n/** A `Models` collection with every built-in provider registered. */\nexport function builtinModels(options?: CreateModelsOptions): MutableModels {\n\tconst models = createModels(options);\n\tfor (const provider of builtinProviders()) {\n\t\tmodels.setProvider(provider);\n\t}\n\treturn models;\n}\n\n/** All built-in image-generation providers, freshly constructed. */\nexport function builtinImagesProviders(): ImagesProvider[] {\n\treturn [openrouterImagesProvider()];\n}\n\n/** An `ImagesModels` collection with every built-in image-generation provider registered. */\nexport function builtinImagesModels(options?: CreateModelsOptions): MutableImagesModels {\n\tconst models = createImagesModels(options);\n\tfor (const provider of builtinImagesProviders()) {\n\t\tmodels.setProvider(provider);\n\t}\n\treturn models;\n}\n"]}
1
+ {"version":3,"file":"all.d.ts","sourceRoot":"","sources":["../../src/providers/all.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACxG,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,KAAK,mBAAmB,EAAgB,KAAK,aAAa,EAAE,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AACzG,OAAO,K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BAAgB,sBAAsB,IAAI,cAAc,EAAE,CAEzD;AAED,6FAA6F;AAC7F,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,mBAAmB,CAMtF","sourcesContent":["import { createImagesModels, type ImagesProvider, type MutableImagesModels } from \"../images-models.ts\";\nimport { MODELS } from \"../models.generated.ts\";\nimport { type CreateModelsOptions, createModels, type MutableModels, type Provider } from \"../models.ts\";\nimport type { Api, Model } from \"../types.ts\";\nimport { amazonBedrockProvider } from \"./amazon-bedrock.ts\";\nimport { antLingProvider } from \"./ant-ling.ts\";\nimport { anthropicProvider } from \"./anthropic.ts\";\nimport { azureOpenAIResponsesProvider } from \"./azure-openai-responses.ts\";\nimport { basetenProvider } from \"./baseten.ts\";\nimport { cerebrasProvider } from \"./cerebras.ts\";\nimport { cloudflareAIGatewayProvider } from \"./cloudflare-ai-gateway.ts\";\nimport { cloudflareWorkersAIProvider } from \"./cloudflare-workers-ai.ts\";\nimport modelDataManifest from \"./data/.manifest.json\" with { type: \"json\" };\nimport { deepseekProvider } from \"./deepseek.ts\";\nimport { fireworksProvider } from \"./fireworks.ts\";\nimport { githubCopilotProvider } from \"./github-copilot.ts\";\nimport { googleProvider } from \"./google.ts\";\nimport { googleVertexProvider } from \"./google-vertex.ts\";\nimport { groqProvider } from \"./groq.ts\";\nimport { huggingfaceProvider } from \"./huggingface.ts\";\nimport { kimiCodingProvider } from \"./kimi-coding.ts\";\nimport { minimaxProvider } from \"./minimax.ts\";\nimport { minimaxCnProvider } from \"./minimax-cn.ts\";\nimport { mistralProvider } from \"./mistral.ts\";\nimport { moonshotaiProvider } from \"./moonshotai.ts\";\nimport { moonshotaiCnProvider } from \"./moonshotai-cn.ts\";\nimport { nvidiaProvider } from \"./nvidia.ts\";\nimport { openaiProvider } from \"./openai.ts\";\nimport { openaiCodexProvider } from \"./openai-codex.ts\";\nimport { opencodeProvider } from \"./opencode.ts\";\nimport { opencodeGoProvider } from \"./opencode-go.ts\";\nimport { openrouterProvider } from \"./openrouter.ts\";\nimport { openrouterImagesProvider } from \"./openrouter-images.ts\";\nimport { qwenTokenPlanProvider } from \"./qwen-token-plan.ts\";\nimport { qwenTokenPlanCnProvider } from \"./qwen-token-plan-cn.ts\";\nimport { qwenTokenPlanIndividualProvider } from \"./qwen-token-plan-individual.ts\";\nimport { radiusProvider } from \"./radius.ts\";\nimport { togetherProvider } from \"./together.ts\";\nimport { vercelAIGatewayProvider } from \"./vercel-ai-gateway.ts\";\nimport { xaiProvider } from \"./xai.ts\";\nimport { xiaomiProvider } from \"./xiaomi.ts\";\nimport { xiaomiTokenPlanAmsProvider } from \"./xiaomi-token-plan-ams.ts\";\nimport { xiaomiTokenPlanCnProvider } from \"./xiaomi-token-plan-cn.ts\";\nimport { xiaomiTokenPlanSgpProvider } from \"./xiaomi-token-plan-sgp.ts\";\nimport { zaiProvider } from \"./zai.ts\";\nimport { zaiCodingCnProvider } from \"./zai-coding-cn.ts\";\n\nexport { radiusProvider };\n\n/** Providers present in the generated catalog. `KnownProvider` additionally\n * includes purely dynamic providers (e.g. \"radius\") that have no static\n * catalog entry. */\nexport type BuiltinProvider = keyof typeof MODELS;\n\ntype BuiltinModelApi<\n\tTProvider extends BuiltinProvider,\n\tTModelId extends keyof (typeof MODELS)[TProvider],\n> = (typeof MODELS)[TProvider][TModelId] extends { api: infer TApi } ? (TApi extends Api ? TApi : never) : never;\n\n/** Typed read of the generated built-in catalog. */\nexport function getBuiltinModel<TProvider extends BuiltinProvider, TModelId extends keyof (typeof MODELS)[TProvider]>(\n\tprovider: TProvider,\n\tmodelId: TModelId,\n): Model<BuiltinModelApi<TProvider, TModelId>> {\n\tconst models = MODELS[provider] as Record<string, Model<Api>> | undefined;\n\treturn models?.[modelId as string] as Model<BuiltinModelApi<TProvider, TModelId>>;\n}\n\nexport function getBuiltinProviders(): BuiltinProvider[] {\n\treturn Object.keys(MODELS) as BuiltinProvider[];\n}\n\n/** Generation timestamp shared by all built-in provider catalogs. */\nexport function getBuiltinModelDataGeneratedAt(): number | undefined {\n\tconst generatedAt = Date.parse(modelDataManifest.generatedAt);\n\treturn Number.isNaN(generatedAt) ? undefined : generatedAt;\n}\n\nexport function getBuiltinModels<TProvider extends BuiltinProvider>(\n\tprovider: TProvider,\n): Model<BuiltinModelApi<TProvider, keyof (typeof MODELS)[TProvider]>>[] {\n\tconst models = MODELS[provider] as Record<string, Model<Api>> | undefined;\n\treturn models\n\t\t? (Object.values(models) as Model<BuiltinModelApi<TProvider, keyof (typeof MODELS)[TProvider]>>[])\n\t\t: [];\n}\n\n/** All built-in providers, freshly constructed. */\nexport function builtinProviders(): Provider[] {\n\treturn [\n\t\tamazonBedrockProvider(),\n\t\tantLingProvider(),\n\t\tanthropicProvider(),\n\t\tazureOpenAIResponsesProvider(),\n\t\tbasetenProvider(),\n\t\tcerebrasProvider(),\n\t\tcloudflareAIGatewayProvider(),\n\t\tcloudflareWorkersAIProvider(),\n\t\tdeepseekProvider(),\n\t\tfireworksProvider(),\n\t\tgithubCopilotProvider(),\n\t\tgoogleProvider(),\n\t\tgoogleVertexProvider(),\n\t\tgroqProvider(),\n\t\thuggingfaceProvider(),\n\t\tkimiCodingProvider(),\n\t\tminimaxProvider(),\n\t\tminimaxCnProvider(),\n\t\tmistralProvider(),\n\t\tmoonshotaiProvider(),\n\t\tmoonshotaiCnProvider(),\n\t\tnvidiaProvider(),\n\t\topenaiProvider(),\n\t\topenaiCodexProvider(),\n\t\topencodeProvider(),\n\t\topencodeGoProvider(),\n\t\topenrouterProvider(),\n\t\tqwenTokenPlanProvider(),\n\t\tqwenTokenPlanCnProvider(),\n\t\tqwenTokenPlanIndividualProvider(),\n\t\tradiusProvider(),\n\t\ttogetherProvider(),\n\t\tvercelAIGatewayProvider(),\n\t\txaiProvider(),\n\t\txiaomiProvider(),\n\t\txiaomiTokenPlanAmsProvider(),\n\t\txiaomiTokenPlanCnProvider(),\n\t\txiaomiTokenPlanSgpProvider(),\n\t\tzaiProvider(),\n\t\tzaiCodingCnProvider(),\n\t];\n}\n\n/** A `Models` collection with every built-in provider registered. */\nexport function builtinModels(options?: CreateModelsOptions): MutableModels {\n\tconst models = createModels(options);\n\tfor (const provider of builtinProviders()) {\n\t\tmodels.setProvider(provider);\n\t}\n\treturn models;\n}\n\n/** All built-in image-generation providers, freshly constructed. */\nexport function builtinImagesProviders(): ImagesProvider[] {\n\treturn [openrouterImagesProvider()];\n}\n\n/** An `ImagesModels` collection with every built-in image-generation provider registered. */\nexport function builtinImagesModels(options?: CreateModelsOptions): MutableImagesModels {\n\tconst models = createImagesModels(options);\n\tfor (const provider of builtinImagesProviders()) {\n\t\tmodels.setProvider(provider);\n\t}\n\treturn models;\n}\n"]}