@bastani/atomic 0.9.20-alpha.7 → 0.9.20-alpha.9

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 (315) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/dist/builtin/intercom/package.json +3 -5
  3. package/dist/builtin/mcp/package.json +3 -3
  4. package/dist/builtin/subagents/CHANGELOG.md +6 -0
  5. package/dist/builtin/subagents/package.json +3 -3
  6. package/dist/builtin/subagents/src/extension/index.bundle.mjs +11 -2
  7. package/dist/builtin/web-access/package.json +1 -1
  8. package/dist/builtin/workflows/CHANGELOG.md +37 -0
  9. package/dist/builtin/workflows/builtin/adversarial-verification.js +3 -3
  10. package/dist/builtin/workflows/builtin/{chunk-ffdrv23t.js → chunk-18yz7r43.js} +1 -1
  11. package/dist/builtin/workflows/builtin/{chunk-9z3ztr2a.js → chunk-1pd5zcfa.js} +1 -1
  12. package/dist/builtin/workflows/builtin/{chunk-5724b0cf.js → chunk-24c235x7.js} +1 -1
  13. package/dist/builtin/workflows/builtin/{chunk-vn0wb31x.js → chunk-2jv44yz7.js} +1 -1
  14. package/dist/builtin/workflows/builtin/{chunk-hmt5w62g.js → chunk-2npg6daz.js} +1 -1
  15. package/dist/builtin/workflows/builtin/{chunk-njmf5ze7.js → chunk-7ps7bnb4.js} +1 -1
  16. package/dist/builtin/workflows/builtin/{chunk-jngsbbpm.js → chunk-ad864596.js} +3 -3
  17. package/dist/builtin/workflows/builtin/{chunk-7n51c5gh.js → chunk-f8jjd90r.js} +1 -1
  18. package/dist/builtin/workflows/builtin/{chunk-3tx8ry44.js → chunk-gxrhbnaj.js} +2 -1
  19. package/dist/builtin/workflows/builtin/{chunk-2hzrv5y8.js → chunk-twefqrv0.js} +986 -199
  20. package/dist/builtin/workflows/builtin/{chunk-7bzcersz.js → chunk-ynded223.js} +3 -3
  21. package/dist/builtin/workflows/builtin/{chunk-dxjxtgmp.js → chunk-z5xdqrs6.js} +1 -1
  22. package/dist/builtin/workflows/builtin/classify-and-act.js +3 -3
  23. package/dist/builtin/workflows/builtin/fan-out-and-synthesize.js +3 -3
  24. package/dist/builtin/workflows/builtin/generate-and-filter.js +3 -3
  25. package/dist/builtin/workflows/builtin/goal.js +4 -4
  26. package/dist/builtin/workflows/builtin/index.js +12 -12
  27. package/dist/builtin/workflows/builtin/loop-until-done.js +3 -3
  28. package/dist/builtin/workflows/builtin/open-claude-design.js +3 -3
  29. package/dist/builtin/workflows/builtin/ralph.js +4 -4
  30. package/dist/builtin/workflows/builtin/steering-context.js +1 -1
  31. package/dist/builtin/workflows/builtin/tournament.js +3 -3
  32. package/dist/builtin/workflows/package.json +4 -4
  33. package/dist/builtin/workflows/src/authoring.d.ts +6 -3
  34. package/dist/builtin/workflows/src/extension/index.bundle.mjs +26991 -26238
  35. package/dist/builtin/workflows/src/index.js +41619 -12907
  36. package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +13 -0
  37. package/dist/core/agent-session-boundaries.d.ts.map +1 -1
  38. package/dist/core/agent-session-boundaries.js +9 -4
  39. package/dist/core/agent-session-boundaries.js.map +1 -1
  40. package/dist/core/agent-session-events.d.ts.map +1 -1
  41. package/dist/core/agent-session-events.js +4 -0
  42. package/dist/core/agent-session-events.js.map +1 -1
  43. package/dist/core/agent-session-methods.d.ts +3 -0
  44. package/dist/core/agent-session-methods.d.ts.map +1 -1
  45. package/dist/core/agent-session-methods.js.map +1 -1
  46. package/dist/core/agent-session-tasks.js +4 -4
  47. package/dist/core/agent-session-tasks.js.map +1 -1
  48. package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
  49. package/dist/core/agent-session-tool-registry.js +4 -3
  50. package/dist/core/agent-session-tool-registry.js.map +1 -1
  51. package/dist/core/agent-session.d.ts +3 -0
  52. package/dist/core/agent-session.d.ts.map +1 -1
  53. package/dist/core/agent-session.js +3 -0
  54. package/dist/core/agent-session.js.map +1 -1
  55. package/dist/core/cache-stats.d.ts +7 -1
  56. package/dist/core/cache-stats.d.ts.map +1 -1
  57. package/dist/core/cache-stats.js +24 -5
  58. package/dist/core/cache-stats.js.map +1 -1
  59. package/dist/core/execution-model-router.d.ts +1 -1
  60. package/dist/core/execution-model-router.d.ts.map +1 -1
  61. package/dist/core/execution-model-router.js +23 -14
  62. package/dist/core/execution-model-router.js.map +1 -1
  63. package/dist/core/extensions/agent-events.d.ts +9 -1
  64. package/dist/core/extensions/agent-events.d.ts.map +1 -1
  65. package/dist/core/extensions/agent-events.js.map +1 -1
  66. package/dist/core/extensions/api-types.d.ts +2 -1
  67. package/dist/core/extensions/api-types.d.ts.map +1 -1
  68. package/dist/core/extensions/api-types.js.map +1 -1
  69. package/dist/core/extensions/event-types.d.ts +2 -2
  70. package/dist/core/extensions/event-types.d.ts.map +1 -1
  71. package/dist/core/extensions/event-types.js.map +1 -1
  72. package/dist/core/extensions/index.d.ts +1 -1
  73. package/dist/core/extensions/index.d.ts.map +1 -1
  74. package/dist/core/extensions/index.js.map +1 -1
  75. package/dist/core/extensions/loader-core.d.ts.map +1 -1
  76. package/dist/core/extensions/loader-core.js +1 -0
  77. package/dist/core/extensions/loader-core.js.map +1 -1
  78. package/dist/core/extensions/provider-types.d.ts +34 -16
  79. package/dist/core/extensions/provider-types.d.ts.map +1 -1
  80. package/dist/core/extensions/provider-types.js.map +1 -1
  81. package/dist/core/extensions/runtime-types.d.ts +4 -0
  82. package/dist/core/extensions/runtime-types.d.ts.map +1 -1
  83. package/dist/core/extensions/runtime-types.js.map +1 -1
  84. package/dist/core/extensions/tool-types.d.ts +9 -0
  85. package/dist/core/extensions/tool-types.d.ts.map +1 -1
  86. package/dist/core/extensions/tool-types.js.map +1 -1
  87. package/dist/core/fast-model-routing.d.ts.map +1 -1
  88. package/dist/core/fast-model-routing.js +1 -0
  89. package/dist/core/fast-model-routing.js.map +1 -1
  90. package/dist/core/fast-model-variants.d.ts +10 -0
  91. package/dist/core/fast-model-variants.d.ts.map +1 -1
  92. package/dist/core/fast-model-variants.js +13 -1
  93. package/dist/core/fast-model-variants.js.map +1 -1
  94. package/dist/core/model-registry.d.ts +3 -1
  95. package/dist/core/model-registry.d.ts.map +1 -1
  96. package/dist/core/model-registry.js +6 -0
  97. package/dist/core/model-registry.js.map +1 -1
  98. package/dist/core/model-runtime-auth.d.ts +2 -2
  99. package/dist/core/model-runtime-auth.d.ts.map +1 -1
  100. package/dist/core/model-runtime-auth.js.map +1 -1
  101. package/dist/core/model-runtime-streaming.d.ts.map +1 -1
  102. package/dist/core/model-runtime-streaming.js +2 -1
  103. package/dist/core/model-runtime-streaming.js.map +1 -1
  104. package/dist/core/model-runtime.d.ts +11 -3
  105. package/dist/core/model-runtime.d.ts.map +1 -1
  106. package/dist/core/model-runtime.js +41 -6
  107. package/dist/core/model-runtime.js.map +1 -1
  108. package/dist/core/package-manager-npm.d.ts.map +1 -1
  109. package/dist/core/package-manager-npm.js +32 -8
  110. package/dist/core/package-manager-npm.js.map +1 -1
  111. package/dist/core/package-manager-resolver.js +3 -1
  112. package/dist/core/package-manager-resolver.js.map +1 -1
  113. package/dist/core/package-manager-types.d.ts +1 -0
  114. package/dist/core/package-manager-types.d.ts.map +1 -1
  115. package/dist/core/package-manager-types.js.map +1 -1
  116. package/dist/core/provider-composer-internal.d.ts +40 -21
  117. package/dist/core/provider-composer-internal.d.ts.map +1 -1
  118. package/dist/core/provider-composer-internal.js +22 -20
  119. package/dist/core/provider-composer-internal.js.map +1 -1
  120. package/dist/core/provider-composer.d.ts +3 -3
  121. package/dist/core/provider-composer.d.ts.map +1 -1
  122. package/dist/core/provider-composer.js +54 -10
  123. package/dist/core/provider-composer.js.map +1 -1
  124. package/dist/core/remote-catalog-provider.d.ts +8 -1
  125. package/dist/core/remote-catalog-provider.d.ts.map +1 -1
  126. package/dist/core/remote-catalog-provider.js +46 -4
  127. package/dist/core/remote-catalog-provider.js.map +1 -1
  128. package/dist/core/resource-loader-core.d.ts.map +1 -1
  129. package/dist/core/resource-loader-core.js +7 -3
  130. package/dist/core/resource-loader-core.js.map +1 -1
  131. package/dist/core/resource-loader-extension-warnings.d.ts +9 -0
  132. package/dist/core/resource-loader-extension-warnings.d.ts.map +1 -0
  133. package/dist/core/resource-loader-extension-warnings.js +54 -0
  134. package/dist/core/resource-loader-extension-warnings.js.map +1 -0
  135. package/dist/core/resource-loader-extensions.d.ts.map +1 -1
  136. package/dist/core/resource-loader-extensions.js +1 -0
  137. package/dist/core/resource-loader-extensions.js.map +1 -1
  138. package/dist/core/resource-loader-reload.d.ts.map +1 -1
  139. package/dist/core/resource-loader-reload.js +6 -0
  140. package/dist/core/resource-loader-reload.js.map +1 -1
  141. package/dist/core/runtime-credentials.d.ts.map +1 -1
  142. package/dist/core/runtime-credentials.js +3 -1
  143. package/dist/core/runtime-credentials.js.map +1 -1
  144. package/dist/core/sdk.js +16 -6
  145. package/dist/core/sdk.js.map +1 -1
  146. package/dist/core/settings-manager-basic-accessors.js +4 -4
  147. package/dist/core/settings-manager-basic-accessors.js.map +1 -1
  148. package/dist/core/skill-catalog.d.ts.map +1 -1
  149. package/dist/core/skill-catalog.js +18 -6
  150. package/dist/core/skill-catalog.js.map +1 -1
  151. package/dist/core/structured-output/choice-schema.d.ts +8 -0
  152. package/dist/core/structured-output/choice-schema.d.ts.map +1 -0
  153. package/dist/core/structured-output/choice-schema.js +79 -0
  154. package/dist/core/structured-output/choice-schema.js.map +1 -0
  155. package/dist/core/structured-output/index.d.ts +3 -5
  156. package/dist/core/structured-output/index.d.ts.map +1 -1
  157. package/dist/core/structured-output/index.js +218 -41
  158. package/dist/core/structured-output/index.js.map +1 -1
  159. package/dist/core/structured-output/resolver.d.ts +0 -46
  160. package/dist/core/structured-output/resolver.d.ts.map +1 -1
  161. package/dist/core/structured-output/resolver.js +15 -93
  162. package/dist/core/structured-output/resolver.js.map +1 -1
  163. package/dist/core/structured-output/types.d.ts +27 -21
  164. package/dist/core/structured-output/types.d.ts.map +1 -1
  165. package/dist/core/structured-output/types.js.map +1 -1
  166. package/dist/core/system-prompt.d.ts.map +1 -1
  167. package/dist/core/system-prompt.js +9 -1
  168. package/dist/core/system-prompt.js.map +1 -1
  169. package/dist/core/tasks/owner-store.d.ts +6 -0
  170. package/dist/core/tasks/owner-store.d.ts.map +1 -1
  171. package/dist/core/tasks/owner-store.js +16 -3
  172. package/dist/core/tasks/owner-store.js.map +1 -1
  173. package/dist/core/tasks/pause.js +1 -1
  174. package/dist/core/tasks/pause.js.map +1 -1
  175. package/dist/core/tasks/supervisor.d.ts +4 -2
  176. package/dist/core/tasks/supervisor.d.ts.map +1 -1
  177. package/dist/core/tasks/supervisor.js +9 -3
  178. package/dist/core/tasks/supervisor.js.map +1 -1
  179. package/dist/core/tools/ask-user-question/ask-user-question.d.ts.map +1 -1
  180. package/dist/core/tools/ask-user-question/ask-user-question.js +1 -0
  181. package/dist/core/tools/ask-user-question/ask-user-question.js.map +1 -1
  182. package/dist/core/tools/bash.d.ts.map +1 -1
  183. package/dist/core/tools/bash.js +16 -13
  184. package/dist/core/tools/bash.js.map +1 -1
  185. package/dist/core/tools/edit.d.ts.map +1 -1
  186. package/dist/core/tools/edit.js +1 -0
  187. package/dist/core/tools/edit.js.map +1 -1
  188. package/dist/core/tools/file-mutation-coordinator.d.ts +4 -3
  189. package/dist/core/tools/file-mutation-coordinator.d.ts.map +1 -1
  190. package/dist/core/tools/file-mutation-coordinator.js +45 -38
  191. package/dist/core/tools/file-mutation-coordinator.js.map +1 -1
  192. package/dist/core/tools/powershell.d.ts +16 -0
  193. package/dist/core/tools/powershell.d.ts.map +1 -1
  194. package/dist/core/tools/structured-output.d.ts +9 -6
  195. package/dist/core/tools/structured-output.d.ts.map +1 -1
  196. package/dist/core/tools/structured-output.js +36 -8
  197. package/dist/core/tools/structured-output.js.map +1 -1
  198. package/dist/core/tools/todos.d.ts.map +1 -1
  199. package/dist/core/tools/todos.js +1 -0
  200. package/dist/core/tools/todos.js.map +1 -1
  201. package/dist/core/tools/tool-concurrency.d.ts +23 -0
  202. package/dist/core/tools/tool-concurrency.d.ts.map +1 -0
  203. package/dist/core/tools/tool-concurrency.js +58 -0
  204. package/dist/core/tools/tool-concurrency.js.map +1 -0
  205. package/dist/core/tools/tool-definition-wrapper.d.ts +4 -1
  206. package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
  207. package/dist/core/tools/tool-definition-wrapper.js +2 -0
  208. package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
  209. package/dist/core/tools/write.d.ts.map +1 -1
  210. package/dist/core/tools/write.js +1 -0
  211. package/dist/core/tools/write.js.map +1 -1
  212. package/dist/index-extensions.d.ts +1 -1
  213. package/dist/index-extensions.d.ts.map +1 -1
  214. package/dist/index-extensions.js.map +1 -1
  215. package/dist/index.d.ts +2 -2
  216. package/dist/index.d.ts.map +1 -1
  217. package/dist/index.js +2 -2
  218. package/dist/index.js.map +1 -1
  219. package/dist/main.d.ts.map +1 -1
  220. package/dist/main.js +4 -0
  221. package/dist/main.js.map +1 -1
  222. package/dist/modes/interactive/components/atomic-banner.d.ts.map +1 -1
  223. package/dist/modes/interactive/components/atomic-banner.js +3 -2
  224. package/dist/modes/interactive/components/atomic-banner.js.map +1 -1
  225. package/dist/modes/interactive/components/settings-selector-items.d.ts.map +1 -1
  226. package/dist/modes/interactive/components/settings-selector-items.js +11 -9
  227. package/dist/modes/interactive/components/settings-selector-items.js.map +1 -1
  228. package/dist/modes/interactive/components/settings-selector-types.d.ts +2 -1
  229. package/dist/modes/interactive/components/settings-selector-types.d.ts.map +1 -1
  230. package/dist/modes/interactive/components/settings-selector-types.js.map +1 -1
  231. package/dist/modes/interactive/components/startup-identity.d.ts +3 -0
  232. package/dist/modes/interactive/components/startup-identity.d.ts.map +1 -1
  233. package/dist/modes/interactive/components/startup-identity.js +11 -2
  234. package/dist/modes/interactive/components/startup-identity.js.map +1 -1
  235. package/dist/modes/interactive/components/task-inspector.d.ts +1 -0
  236. package/dist/modes/interactive/components/task-inspector.d.ts.map +1 -1
  237. package/dist/modes/interactive/components/task-inspector.js +11 -11
  238. package/dist/modes/interactive/components/task-inspector.js.map +1 -1
  239. package/dist/modes/interactive/components/task-list.d.ts +9 -3
  240. package/dist/modes/interactive/components/task-list.d.ts.map +1 -1
  241. package/dist/modes/interactive/components/task-list.js +26 -2
  242. package/dist/modes/interactive/components/task-list.js.map +1 -1
  243. package/dist/modes/interactive/interactive-agent-events.js +3 -9
  244. package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
  245. package/dist/modes/interactive/interactive-auth-login.js +1 -1
  246. package/dist/modes/interactive/interactive-auth-login.js.map +1 -1
  247. package/dist/modes/interactive/interactive-render-chat.js +3 -9
  248. package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
  249. package/dist/modes/interactive/interactive-resource-rendering.js +6 -9
  250. package/dist/modes/interactive/interactive-resource-rendering.js.map +1 -1
  251. package/dist/modes/interactive/interactive-selectors.js +1 -0
  252. package/dist/modes/interactive/interactive-selectors.js.map +1 -1
  253. package/dist/modes/interactive/interactive-slash-commands.js +2 -4
  254. package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
  255. package/dist/modes/interactive/interactive-tui.d.ts.map +1 -1
  256. package/dist/modes/interactive/interactive-tui.js +2 -0
  257. package/dist/modes/interactive/interactive-tui.js.map +1 -1
  258. package/dist/modes/interactive/overlay-line-composite.d.ts +7 -0
  259. package/dist/modes/interactive/overlay-line-composite.d.ts.map +1 -0
  260. package/dist/modes/interactive/overlay-line-composite.js +24 -0
  261. package/dist/modes/interactive/overlay-line-composite.js.map +1 -0
  262. package/dist/modes/interactive-engine/isolated-runtime.d.ts +1 -0
  263. package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
  264. package/dist/modes/interactive-engine/isolated-runtime.js +5 -0
  265. package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
  266. package/dist/utils/child-process.d.ts +1 -0
  267. package/dist/utils/child-process.d.ts.map +1 -1
  268. package/dist/utils/child-process.js +7 -8
  269. package/dist/utils/child-process.js.map +1 -1
  270. package/dist/utils/clipboard-image.d.ts.map +1 -1
  271. package/dist/utils/clipboard-image.js +14 -17
  272. package/dist/utils/clipboard-image.js.map +1 -1
  273. package/dist/utils/shell.d.ts.map +1 -1
  274. package/dist/utils/shell.js +18 -1
  275. package/dist/utils/shell.js.map +1 -1
  276. package/docs/background-tasks.md +1 -0
  277. package/docs/computer-use.md +2 -2
  278. package/docs/custom-provider/registration.md +1 -1
  279. package/docs/custom-provider.md +43 -1
  280. package/docs/extensions/authoring.md +22 -3
  281. package/docs/extensions/events.md +18 -0
  282. package/docs/extensions/examples.md +1 -0
  283. package/docs/models/evals.md +31 -79
  284. package/docs/models/model-selection.md +5 -1
  285. package/docs/packages/authoring.md +3 -1
  286. package/docs/providers.md +11 -12
  287. package/docs/sdk/reference.md +18 -42
  288. package/docs/sdk/structured-decisions.md +44 -89
  289. package/docs/sdk.md +1 -1
  290. package/docs/settings.md +6 -6
  291. package/docs/subagents/reference.md +7 -8
  292. package/docs/usage.md +13 -0
  293. package/docs/workflows/api-reference.md +38 -35
  294. package/docs/workflows/authoring.md +113 -1
  295. package/docs/workflows/builtins.md +1 -1
  296. package/docs/workflows/operations.md +51 -29
  297. package/docs/workflows/verification.md +13 -0
  298. package/examples/extensions/README.md +1 -0
  299. package/examples/extensions/debug-provider.ts +90 -0
  300. package/examples/extensions/structured-output.ts +6 -0
  301. package/npm-shrinkwrap.json +32 -32
  302. package/package.json +3 -3
  303. package/dist/builtin/workflows/src/durable/dependency-doctor-types.d.ts +0 -42
  304. package/dist/core/decision-provider.d.ts +0 -4
  305. package/dist/core/decision-provider.d.ts.map +0 -1
  306. package/dist/core/decision-provider.js +0 -12
  307. package/dist/core/decision-provider.js.map +0 -1
  308. package/dist/core/structured-output/jev-client.d.ts +0 -25
  309. package/dist/core/structured-output/jev-client.d.ts.map +0 -1
  310. package/dist/core/structured-output/jev-client.js +0 -174
  311. package/dist/core/structured-output/jev-client.js.map +0 -1
  312. package/dist/core/structured-output/jev.d.ts +0 -5
  313. package/dist/core/structured-output/jev.d.ts.map +0 -1
  314. package/dist/core/structured-output/jev.js +0 -249
  315. package/dist/core/structured-output/jev.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"model-registry.js","sourceRoot":"","sources":["../../src/core/model-registry.ts"],"names":[],"mappings":"AA4BA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D;;;GAGG;AACH,MAAM,OAAO,aAAa;IAGzB,YAAY,OAAqB;QAChC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,OAAO,CAAC,OAA8B;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAED,QAAQ;QACP,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;IAChC,CAAC;IAED,MAAM;QACL,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IACtC,CAAC;IAED,YAAY;QACX,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAAC;IACjD,CAAC;IAED,IAAI,CAAC,QAAgB,EAAE,OAAe;QACrC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;IAED,iBAAiB,CAAC,KAAiB;QAClC,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACvD,CAAC;IAED,8FAA8F;IAC9F,4BAA4B,CAAC,UAAkB;QAC9C,OAAO,IAAI,CAAC,OAAO,CAAC,4BAA4B,CAAC,UAAU,CAAC,CAAC;IAC9D,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,KAAiB;QAC1C,IAAI,CAAC;YACJ,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,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AO,SAAS,CAAC;QAClB,CAAC;IACF,CAAC;IAED,YAAY,CAAC,KAAiB;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAClD,CAAC;IAID,gBAAgB,CAAC,cAAiC,EAAE,MAA4B;QAC/E,IAAI,OAAO,cAAc,KAAK,QAAQ,EAAE,CAAC;YACxC,IAAI,CAAC,MAAM;gBAAE,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;YACrF,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;YACtD,OAAO;QACR,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC,cAAc,CAAC,CAAC;IACrD,CAAC;IAED,kBAAkB,CAAC,YAAoB;QACtC,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;IAC/C,CAAC;IAED,2BAA2B,CAAC,YAAoB;QAC/C,OAAO,IAAI,CAAC,OAAO,CAAC,2BAA2B,CAAC,YAAY,CAAC,CAAC;IAC/D,CAAC;IAED,2BAA2B,CAAC,YAAoB;QAC/C,OAAO,IAAI,CAAC,OAAO,CAAC,2BAA2B,CAAC,YAAY,CAAC,CAAC;IAC/D,CAAC;IAED,wBAAwB;QACvB,OAAO,IAAI,CAAC,OAAO,CAAC,wBAAwB,EAAE,CAAC;IAChD,CAAC;CACD","sourcesContent":["import type {\n\tApi,\n\tAssistantMessage,\n\tAssistantMessageEventStream,\n\tAuthOperationOptions,\n\tAuthResult,\n\tContext,\n\tModel,\n\tModelsApiStreamOptions,\n\tModelsRefreshOptions,\n\tModelsRefreshResult,\n\tModelsSimpleStreamOptions,\n\tProvider,\n\tProviderHeaders,\n} from \"@bastani/pi-ai\";\nimport type { ModelRuntime } from \"./model-runtime.js\";\nimport type { AuthStatus, ProviderConfigInput } from \"./provider-composer.ts\";\n\nexport type { ProviderConfigInput } from \"./provider-composer.ts\";\nexport type ResolvedRequestAuth =\n\t| {\n\t\t\tok: true;\n\t\t\tapiKey?: string;\n\t\t\theaders?: ProviderHeaders;\n\t\t\tbaseUrl?: string;\n\t\t\tenv?: Record<string, string>;\n\t }\n\t| { ok: false; error: string };\nexport { clearApiKeyCache } from \"./provider-composer.ts\";\n\n/**\n * Compatibility facade exposed to extensions.\n * Coding-agent internals use ModelRuntime directly.\n */\nexport class ModelRegistry {\n\tprivate readonly runtime: ModelRuntime;\n\n\tconstructor(runtime: ModelRuntime) {\n\t\tthis.runtime = runtime;\n\t}\n\n\t/**\n\t * Reload models.json asynchronously. Await before making synchronous registry reads.\n\t * Returns pi's refresh result so callers can react to per-provider failures\n\t * (`errors`) and cancellation (`aborted`); pi reports both without rejecting.\n\t */\n\tasync refresh(options?: ModelsRefreshOptions): Promise<ModelsRefreshResult> {\n\t\treturn this.runtime.refresh(options);\n\t}\n\n\tgetError(): string | undefined {\n\t\treturn this.runtime.getError();\n\t}\n\n\tgetAll(): Model<Api>[] {\n\t\treturn [...this.runtime.getModels()];\n\t}\n\n\tgetAvailable(): Model<Api>[] {\n\t\treturn [...this.runtime.getAvailableSnapshot()];\n\t}\n\n\tfind(provider: string, modelId: string): Model<Api> | undefined {\n\t\treturn this.runtime.getModel(provider, modelId);\n\t}\n\n\thasConfiguredAuth(model: Model<Api>): boolean {\n\t\treturn this.runtime.hasConfiguredAuth(model.provider);\n\t}\n\n\t/** Boolean-only access to configured credential screening, without resolving request auth. */\n\tcontainsConfiguredCredential(serialized: string): Promise<boolean> {\n\t\treturn this.runtime.containsConfiguredCredential(serialized);\n\t}\n\n\tasync getApiKeyAndHeaders(model: Model<Api>): Promise<ResolvedRequestAuth> {\n\t\ttry {\n\t\t\tconst resolution = await this.runtime.getAuth(model);\n\t\t\tif (!resolution) {\n\t\t\t\tconst compatibility = this.runtime.getCompatibilityRequestConfig(model);\n\t\t\t\tif (compatibility.authHeader) {\n\t\t\t\t\treturn { ok: false, error: `No API key found for \"${model.provider}\"` };\n\t\t\t\t}\n\t\t\t\treturn { ok: true, headers: compatibility.headers };\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tok: true,\n\t\t\t\tapiKey: resolution.auth.apiKey,\n\t\t\t\theaders: resolution.auth.headers,\n\t\t\t\t...(resolution.auth.baseUrl === undefined ? {} : { baseUrl: resolution.auth.baseUrl }),\n\t\t\t\tenv: resolution.env,\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tconst cause = error instanceof Error ? error.cause : undefined;\n\t\t\tconst message =\n\t\t\t\tcause instanceof Error ? cause.message : error instanceof Error ? error.message : String(error);\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\terror:\n\t\t\t\t\tmessage === \"authHeader requires a resolved API key\"\n\t\t\t\t\t\t? `No API key found for \"${model.provider}\"`\n\t\t\t\t\t\t: message,\n\t\t\t};\n\t\t}\n\t}\n\n\tgetProviderAuthStatus(provider: string): AuthStatus {\n\t\treturn this.runtime.getProviderAuthStatus(provider);\n\t}\n\n\tgetProvider(provider: string): Provider | undefined {\n\t\treturn this.runtime.getProvider(provider);\n\t}\n\n\t/** Stream through the configured provider with request-time authentication. */\n\tstream<TApi extends Api>(\n\t\tmodel: Model<TApi>,\n\t\tcontext: Context,\n\t\toptions?: ModelsApiStreamOptions<TApi>,\n\t): AssistantMessageEventStream {\n\t\treturn this.runtime.stream(model, context, options);\n\t}\n\n\t/** Stream with provider-neutral options and request-time authentication. */\n\tstreamSimple(model: Model<Api>, context: Context, options?: ModelsSimpleStreamOptions): AssistantMessageEventStream {\n\t\treturn this.runtime.streamSimple(model, context, options);\n\t}\n\n\t/** Complete through the active runtime so provider composition and request auth apply. */\n\tcomplete<TApi extends Api>(\n\t\tmodel: Model<TApi>,\n\t\tcontext: Context,\n\t\toptions?: ModelsApiStreamOptions<TApi>,\n\t): Promise<AssistantMessage> {\n\t\treturn this.runtime.complete(model, context, options);\n\t}\n\n\tgetProviderDisplayName(provider: string): string {\n\t\treturn this.runtime.getProvider(provider)?.name ?? provider;\n\t}\n\n\tgetProviderAuth(provider: string, options?: AuthOperationOptions): Promise<AuthResult | undefined> {\n\t\treturn this.runtime.getAuth(provider, options);\n\t}\n\n\tasync getApiKeyForProvider(provider: string): Promise<string | undefined> {\n\t\ttry {\n\t\t\treturn (await this.runtime.getAuth(provider))?.auth.apiKey;\n\t\t} catch {\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\tisUsingOAuth(model: Model<Api>): boolean {\n\t\treturn this.runtime.isUsingOAuth(model.provider);\n\t}\n\n\tregisterProvider(provider: Provider): void;\n\tregisterProvider(providerName: string, config: ProviderConfigInput): void;\n\tregisterProvider(providerOrName: Provider | string, config?: ProviderConfigInput): void {\n\t\tif (typeof providerOrName === \"string\") {\n\t\t\tif (!config) throw new Error(\"Provider config is required when registering by name\");\n\t\t\tthis.runtime.registerProvider(providerOrName, config);\n\t\t\treturn;\n\t\t}\n\t\tthis.runtime.registerNativeProvider(providerOrName);\n\t}\n\n\tunregisterProvider(providerName: string): void {\n\t\tthis.runtime.unregisterProvider(providerName);\n\t}\n\n\tgetRegisteredProviderConfig(providerName: string): ProviderConfigInput | undefined {\n\t\treturn this.runtime.getRegisteredProviderConfig(providerName);\n\t}\n\n\tgetRegisteredNativeProvider(providerName: string): Provider | undefined {\n\t\treturn this.runtime.getRegisteredNativeProvider(providerName);\n\t}\n\n\tgetRegisteredProviderIds(): readonly string[] {\n\t\treturn this.runtime.getRegisteredProviderIds();\n\t}\n}\n"]}
1
+ {"version":3,"file":"model-registry.js","sourceRoot":"","sources":["../../src/core/model-registry.ts"],"names":[],"mappings":"AAiCA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D;;;GAGG;AACH,MAAM,OAAO,aAAa;IAGzB,YAAY,OAAqB;QAChC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,OAAO,CAAC,OAA8B;QAC3C,OAAO,IAAI,CAAC,O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AK,CAAC,QAAQ,CAAC,CAAC;IAClD,CAAC;IAID,gBAAgB,CAAC,cAAiC,EAAE,MAA4B;QAC/E,IAAI,OAAO,cAAc,KAAK,QAAQ,EAAE,CAAC;YACxC,IAAI,CAAC,MAAM;gBAAE,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;YACrF,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;YACtD,OAAO;QACR,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC,cAAc,CAAC,CAAC;IACrD,CAAC;IAED,kBAAkB,CAAC,YAAoB;QACtC,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;IAC/C,CAAC;IAED,2BAA2B,CAAC,YAAoB;QAC/C,OAAO,IAAI,CAAC,OAAO,CAAC,2BAA2B,CAAC,YAAY,CAAC,CAAC;IAC/D,CAAC;IAED,2BAA2B,CAAC,YAAoB;QAC/C,OAAO,IAAI,CAAC,OAAO,CAAC,2BAA2B,CAAC,YAAY,CAAC,CAAC;IAC/D,CAAC;IAED,wBAAwB;QACvB,OAAO,IAAI,CAAC,OAAO,CAAC,wBAAwB,EAAE,CAAC;IAChD,CAAC;CACD","sourcesContent":["import type {\n\tApi,\n\tAssistantMessage,\n\tAssistantMessageEventStream,\n\tAuthOperationOptions,\n\tAuthResult,\n\tClassifierApi,\n\tClassifierContext,\n\tClassifierModel,\n\tClassifierResult,\n\tContext,\n\tModel,\n\tModelsApiStreamOptions,\n\tModelsClassifierOptions,\n\tModelsRefreshOptions,\n\tModelsRefreshResult,\n\tModelsSimpleStreamOptions,\n\tProvider,\n\tProviderHeaders,\n} from \"@bastani/pi-ai\";\nimport type { ModelRuntime } from \"./model-runtime.js\";\nimport type { AuthStatus, ProviderConfigInput } from \"./provider-composer.ts\";\n\nexport type { ProviderConfigInput } from \"./provider-composer.ts\";\nexport type ResolvedRequestAuth =\n\t| {\n\t\t\tok: true;\n\t\t\tapiKey?: string;\n\t\t\theaders?: ProviderHeaders;\n\t\t\tbaseUrl?: string;\n\t\t\tenv?: Record<string, string>;\n\t }\n\t| { ok: false; error: string };\nexport { clearApiKeyCache } from \"./provider-composer.ts\";\n\n/**\n * Compatibility facade exposed to extensions.\n * Coding-agent internals use ModelRuntime directly.\n */\nexport class ModelRegistry {\n\tprivate readonly runtime: ModelRuntime;\n\n\tconstructor(runtime: ModelRuntime) {\n\t\tthis.runtime = runtime;\n\t}\n\n\t/**\n\t * Reload models.json asynchronously. Await before making synchronous registry reads.\n\t * Returns pi's refresh result so callers can react to per-provider failures\n\t * (`errors`) and cancellation (`aborted`); pi reports both without rejecting.\n\t */\n\tasync refresh(options?: ModelsRefreshOptions): Promise<ModelsRefreshResult> {\n\t\treturn this.runtime.refresh(options);\n\t}\n\n\tgetError(): string | undefined {\n\t\treturn this.runtime.getError();\n\t}\n\n\tgetAll(): Model<Api>[] {\n\t\treturn [...this.runtime.getModels()];\n\t}\n\n\tgetAvailable(): Model<Api>[] {\n\t\treturn [...this.runtime.getAvailableSnapshot()];\n\t}\n\n\tfind(provider: string, modelId: string): Model<Api> | undefined {\n\t\treturn this.runtime.getModel(provider, modelId);\n\t}\n\n\tgetClassifierModel(provider: string, modelId: string): ClassifierModel<ClassifierApi> | undefined {\n\t\treturn this.runtime.getModelOfType(\"classifier\", provider, modelId);\n\t}\n\n\thasConfiguredAuth(model: Model<Api>): boolean {\n\t\treturn this.runtime.hasConfiguredAuth(model.provider);\n\t}\n\n\t/** Boolean-only access to configured credential screening, without resolving request auth. */\n\tcontainsConfiguredCredential(serialized: string): Promise<boolean> {\n\t\treturn this.runtime.containsConfiguredCredential(serialized);\n\t}\n\n\tasync getApiKeyAndHeaders(model: Model<Api>): Promise<ResolvedRequestAuth> {\n\t\ttry {\n\t\t\tconst resolution = await this.runtime.getAuth(model);\n\t\t\tif (!resolution) {\n\t\t\t\tconst compatibility = this.runtime.getCompatibilityRequestConfig(model);\n\t\t\t\tif (compatibility.authHeader) {\n\t\t\t\t\treturn { ok: false, error: `No API key found for \"${model.provider}\"` };\n\t\t\t\t}\n\t\t\t\treturn { ok: true, headers: compatibility.headers };\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tok: true,\n\t\t\t\tapiKey: resolution.auth.apiKey,\n\t\t\t\theaders: resolution.auth.headers,\n\t\t\t\t...(resolution.auth.baseUrl === undefined ? {} : { baseUrl: resolution.auth.baseUrl }),\n\t\t\t\tenv: resolution.env,\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tconst cause = error instanceof Error ? error.cause : undefined;\n\t\t\tconst message =\n\t\t\t\tcause instanceof Error ? cause.message : error instanceof Error ? error.message : String(error);\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\terror:\n\t\t\t\t\tmessage === \"authHeader requires a resolved API key\"\n\t\t\t\t\t\t? `No API key found for \"${model.provider}\"`\n\t\t\t\t\t\t: message,\n\t\t\t};\n\t\t}\n\t}\n\n\tgetProviderAuthStatus(provider: string): AuthStatus {\n\t\treturn this.runtime.getProviderAuthStatus(provider);\n\t}\n\n\tgetProvider(provider: string): Provider | undefined {\n\t\treturn this.runtime.getProvider(provider);\n\t}\n\n\t/** Stream through the configured provider with request-time authentication. */\n\tstream<TApi extends Api>(\n\t\tmodel: Model<TApi>,\n\t\tcontext: Context,\n\t\toptions?: ModelsApiStreamOptions<TApi>,\n\t): AssistantMessageEventStream {\n\t\treturn this.runtime.stream(model, context, options);\n\t}\n\n\t/** Stream with provider-neutral options and request-time authentication. */\n\tstreamSimple(model: Model<Api>, context: Context, options?: ModelsSimpleStreamOptions): AssistantMessageEventStream {\n\t\treturn this.runtime.streamSimple(model, context, options);\n\t}\n\n\t/** Complete through the active runtime so provider composition and request auth apply. */\n\tcomplete<TApi extends Api>(\n\t\tmodel: Model<TApi>,\n\t\tcontext: Context,\n\t\toptions?: ModelsApiStreamOptions<TApi>,\n\t): Promise<AssistantMessage> {\n\t\treturn this.runtime.complete(model, context, options);\n\t}\n\n\tclassify(\n\t\tmodel: ClassifierModel<ClassifierApi>,\n\t\tcontext: ClassifierContext,\n\t\toptions?: ModelsClassifierOptions,\n\t): Promise<ClassifierResult> {\n\t\treturn this.runtime.classify(model, context, options);\n\t}\n\n\tgetProviderDisplayName(provider: string): string {\n\t\treturn this.runtime.getProvider(provider)?.name ?? provider;\n\t}\n\n\tgetProviderAuth(provider: string, options?: AuthOperationOptions): Promise<AuthResult | undefined> {\n\t\treturn this.runtime.getAuth(provider, options);\n\t}\n\n\tasync getApiKeyForProvider(provider: string): Promise<string | undefined> {\n\t\ttry {\n\t\t\treturn (await this.runtime.getAuth(provider))?.auth.apiKey;\n\t\t} catch {\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\tisUsingOAuth(model: Model<Api>): boolean {\n\t\treturn this.runtime.isUsingOAuth(model.provider);\n\t}\n\n\tregisterProvider(provider: Provider): void;\n\tregisterProvider(providerName: string, config: ProviderConfigInput): void;\n\tregisterProvider(providerOrName: Provider | string, config?: ProviderConfigInput): void {\n\t\tif (typeof providerOrName === \"string\") {\n\t\t\tif (!config) throw new Error(\"Provider config is required when registering by name\");\n\t\t\tthis.runtime.registerProvider(providerOrName, config);\n\t\t\treturn;\n\t\t}\n\t\tthis.runtime.registerNativeProvider(providerOrName);\n\t}\n\n\tunregisterProvider(providerName: string): void {\n\t\tthis.runtime.unregisterProvider(providerName);\n\t}\n\n\tgetRegisteredProviderConfig(providerName: string): ProviderConfigInput | undefined {\n\t\treturn this.runtime.getRegisteredProviderConfig(providerName);\n\t}\n\n\tgetRegisteredNativeProvider(providerName: string): Provider | undefined {\n\t\treturn this.runtime.getRegisteredNativeProvider(providerName);\n\t}\n\n\tgetRegisteredProviderIds(): readonly string[] {\n\t\treturn this.runtime.getRegisteredProviderIds();\n\t}\n}\n"]}
@@ -1,7 +1,7 @@
1
- import type { Api, AuthResult, Model } from "@bastani/pi-ai";
1
+ import type { AnyModel, AuthResult } from "@bastani/pi-ai";
2
2
  import type { ModelConfig } from "./model-config.ts";
3
3
  import type { ModelRuntimeAuthOverrides } from "./model-runtime-types.ts";
4
4
  import type { ProviderConfigInput } from "./provider-composer.ts";
5
5
  /** Apply models.json and extension headers after pi-ai resolves provider credentials. */
6
- export declare function mergeConfiguredAuthHeaders(resolution: AuthResult, model: Model<Api>, config: ModelConfig, extension: ProviderConfigInput | undefined, overrides: ModelRuntimeAuthOverrides): AuthResult;
6
+ export declare function mergeConfiguredAuthHeaders(resolution: AuthResult, model: AnyModel, config: ModelConfig, extension: ProviderConfigInput | undefined, overrides: ModelRuntimeAuthOverrides): AuthResult;
7
7
  //# sourceMappingURL=model-runtime-auth.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"model-runtime-auth.d.ts","sourceRoot":"","sources":["../../src/core/model-runtime-auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAGlE,yFAAyF;AACzF,wBAAgB,0BAA0B,CACzC,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EACjB,MAAM,EAAE,WAAW,EACnB,SAAS,EAAE,mBAAmB,GAAG,SAAS,EAC1C,SAAS,EAAE,yBAAyB,GAClC,UAAU,CAYZ"}
1
+ {"version":3,"file":"model-runtime-auth.d.ts","sourceRoot":"","sources":["../../src/core/model-runtime-auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAGlE,yFAAyF;AACzF,wBAAgB,0BAA0B,CACzC,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,QAAQ,EACf,MAAM,EAAE,WAAW,EACnB,SAAS,EAAE,mBAAmB,GAAG,SAAS,EAC1C,SAAS,EAAE,yBAAyB,GAClC,UAAU,CAYZ"}
@@ -1 +1 @@
1
- {"version":3,"file":"model-runtime-auth.js","sourceRoot":"","sources":["../../src/core/model-runtime-auth.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAG5D,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AAEvE,yFAAyF;AACzF,MAAM,UAAU,0BAA0B,CACzC,UAAsB,EACtB,KAAiB,EACjB,MAAmB,EACnB,SAA0C,EAC1C,SAAoC;IAEpC,MAAM,iBAAiB,GAAG,6BAA6B,CAAC,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE;QAC7G,GAAG,CAAC,UAAU,CAAC,GAAG,IAAI,EAAE,CAAC;QACzB,GAAG,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,CAAC;KACxB,CAAC,CAAC;IACH,OAAO;QACN,GAAG,UAAU;QACb,IAAI,EAAE;YACL,GAAG,UAAU,CAAC,IAAI;YAClB,OAAO,EAAE,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,iBAAiB,CAAC;SACjE;KACD,CAAC;AACH,CAAC","sourcesContent":["import type { Api, AuthResult, Model } from \"@bastani/pi-ai\";\nimport type { ModelConfig } from \"./model-config.ts\";\nimport { mergeHeaders } from \"./model-runtime-streaming.ts\";\nimport type { ModelRuntimeAuthOverrides } from \"./model-runtime-types.ts\";\nimport type { ProviderConfigInput } from \"./provider-composer.ts\";\nimport { resolveConfiguredModelHeaders } from \"./provider-composer.ts\";\n\n/** Apply models.json and extension headers after pi-ai resolves provider credentials. */\nexport function mergeConfiguredAuthHeaders(\n\tresolution: AuthResult,\n\tmodel: Model<Api>,\n\tconfig: ModelConfig,\n\textension: ProviderConfigInput | undefined,\n\toverrides: ModelRuntimeAuthOverrides,\n): AuthResult {\n\tconst configuredHeaders = resolveConfiguredModelHeaders(model, config.getProvider(model.provider), extension, {\n\t\t...(resolution.env ?? {}),\n\t\t...(overrides.env ?? {}),\n\t});\n\treturn {\n\t\t...resolution,\n\t\tauth: {\n\t\t\t...resolution.auth,\n\t\t\theaders: mergeHeaders(resolution.auth.headers, configuredHeaders),\n\t\t},\n\t};\n}\n"]}
1
+ {"version":3,"file":"model-runtime-auth.js","sourceRoot":"","sources":["../../src/core/model-runtime-auth.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAG5D,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AAEvE,yFAAyF;AACzF,MAAM,UAAU,0BAA0B,CACzC,UAAsB,EACtB,KAAe,EACf,MAAmB,EACnB,SAA0C,EAC1C,SAAoC;IAEpC,MAAM,iBAAiB,GAAG,6BAA6B,CAAC,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE;QAC7G,GAAG,CAAC,UAAU,CAAC,GAAG,IAAI,EAAE,CAAC;QACzB,GAAG,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,CAAC;KACxB,CAAC,CAAC;IACH,OAAO;QACN,GAAG,UAAU;QACb,IAAI,EAAE;YACL,GAAG,UAAU,CAAC,IAAI;YAClB,OAAO,EAAE,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,iBAAiB,CAAC;SACjE;KACD,CAAC;AACH,CAAC","sourcesContent":["import type { AnyModel, AuthResult } from \"@bastani/pi-ai\";\nimport type { ModelConfig } from \"./model-config.ts\";\nimport { mergeHeaders } from \"./model-runtime-streaming.ts\";\nimport type { ModelRuntimeAuthOverrides } from \"./model-runtime-types.ts\";\nimport type { ProviderConfigInput } from \"./provider-composer.ts\";\nimport { resolveConfiguredModelHeaders } from \"./provider-composer.ts\";\n\n/** Apply models.json and extension headers after pi-ai resolves provider credentials. */\nexport function mergeConfiguredAuthHeaders(\n\tresolution: AuthResult,\n\tmodel: AnyModel,\n\tconfig: ModelConfig,\n\textension: ProviderConfigInput | undefined,\n\toverrides: ModelRuntimeAuthOverrides,\n): AuthResult {\n\tconst configuredHeaders = resolveConfiguredModelHeaders(model, config.getProvider(model.provider), extension, {\n\t\t...(resolution.env ?? {}),\n\t\t...(overrides.env ?? {}),\n\t});\n\treturn {\n\t\t...resolution,\n\t\tauth: {\n\t\t\t...resolution.auth,\n\t\t\theaders: mergeHeaders(resolution.auth.headers, configuredHeaders),\n\t\t},\n\t};\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"model-runtime-streaming.d.ts","sourceRoot":"","sources":["../../src/core/model-runtime-streaming.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,GAAG,EAER,KAAK,gBAAgB,EACrB,KAAK,2BAA2B,EAChC,KAAK,UAAU,EACf,KAAK,OAAO,EAGZ,KAAK,cAAc,EAEnB,KAAK,KAAK,EACV,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAE/B,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAC9B,KAAK,aAAa,EAGlB,KAAK,eAAe,EAEpB,KAAK,aAAa,EAClB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAE1E,wBAAgB,YAAY,CAC3B,IAAI,EAAE,eAAe,GAAG,SAAS,EACjC,QAAQ,EAAE,eAAe,GAAG,SAAS,GACnC,eAAe,GAAG,SAAS,CAW7B;AAED,+FAA+F;AAC/F,MAAM,WAA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Y,CACX,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EACjB,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,+BAA+B,GACvC,2BAA2B,CAU7B;IAED,cAAc,CACb,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EACjB,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,+BAA+B,GACvC,OAAO,CAAC,gBAAgB,CAAC,CAE3B;IAEK,aAAa,CAClB,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EACjB,MAAM,EAAE,cAAc,EACtB,OAAO,CAAC,EAAE,0BAA0B,GAClC,OAAO,CAAC,gBAAgB,CAAC,CAQ3B;IAEK,cAAc,CACnB,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EACjB,MAAM,EAAE,cAAc,EACtB,OAAO,CAAC,EAAE,2BAA2B,GACnC,OAAO,CAAC,IAAI,CAAC,CAMf;CACD"}
1
+ {"version":3,"file":"model-runtime-streaming.d.ts","sourceRoot":"","sources":["../../src/core/model-runtime-streaming.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,GAAG,EAER,KAAK,gBAAgB,EACrB,KAAK,2BAA2B,EAChC,KAAK,UAAU,EAEf,KAAK,OAAO,EAGZ,KAAK,cAAc,EAEnB,KAAK,KAAK,EACV,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAE/B,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAC9B,KAAK,aAAa,EAGlB,KAAK,eAAe,EAEpB,KAAK,aAAa,EAClB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAE1E,wBAAgB,YAAY,CAC3B,IAAI,EAAE,eAAe,GAAG,SAAS,EACjC,QAAQ,EAAE,eAAe,GAAG,SAAS,GACnC,eAAe,GAAG,SAAS,CAW7B;AAED,+FAA+F;AAC/F,MAAM,WAAW,mBAAmB;IACnC,QA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KAAK,CAAC,GAAG,CAAC,EACjB,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,+BAA+B,GACvC,2BAA2B,CAU7B;IAED,cAAc,CACb,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EACjB,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,+BAA+B,GACvC,OAAO,CAAC,gBAAgB,CAAC,CAE3B;IAEK,aAAa,CAClB,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EACjB,MAAM,EAAE,cAAc,EACtB,OAAO,CAAC,EAAE,0BAA0B,GAClC,OAAO,CAAC,gBAAgB,CAAC,CAQ3B;IAEK,cAAc,CACnB,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EACjB,MAAM,EAAE,cAAc,EACtB,OAAO,CAAC,EAAE,2BAA2B,GACnC,OAAO,CAAC,IAAI,CAAC,CAMf;CACD"}
@@ -1,4 +1,4 @@
1
- import { lazyStream, ModelsError, normalizeContext, } from "@bastani/pi-ai";
1
+ import { assertChatModel, lazyStream, ModelsError, normalizeContext, } from "@bastani/pi-ai";
2
2
  import { usesChatGptCodexTransport, withChatGptCodexTransportRouting } from "./fast-model-routing.js";
3
3
  import { installCodexFastRouteWebSocketIdentity } from "./fast-model-routing-transport.js";
4
4
  export function mergeHeaders(base, override) {
@@ -42,6 +42,7 @@ export class ModelRuntimeStreaming {
42
42
  return withChatGptCodexTransportRouting(model, options);
43
43
  }
44
44
  async prepareRequest(model, options) {
45
+ assertChatModel(model);
45
46
  const provider = this.models.getProvider(model.provider);
46
47
  if (!provider)
47
48
  throw new ModelsError("provider", `Unknown provider: ${model.provider}`);
@@ -1 +1 @@
1
- {"version":3,"file":"model-runtime-streaming.js","sourceRoot":"","sources":["../../src/core/model-runtime-streaming.ts"],"names":[],"mappings":"AAAA,OAAO,EAUN,UAAU,EAKV,WAAW,EAIX,gBAAgB,GAKhB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,gCAAg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AAY,KAAK,CAAC,QAAQ,sCAAsC,CAAC,CAAC;QACrG,CAAC;QACD,MAAM,QAAQ,CAAC,QAAQ,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,OAAgC,CAAC,CAAC;IAC3G,CAAC;CACD","sourcesContent":["import {\n\ttype Api,\n\ttype ApiStreamOptions,\n\ttype AssistantMessage,\n\ttype AssistantMessageEventStream,\n\ttype AuthResult,\n\ttype Context,\n\ttype DeferredCancelOptions,\n\ttype DeferredFetchOptions,\n\ttype DeferredHandle,\n\tlazyStream,\n\ttype Model,\n\ttype ModelsApiStreamOptions,\n\ttype ModelsDeferredCancelOptions,\n\ttype ModelsDeferredFetchOptions,\n\tModelsError,\n\ttype ModelsRequestTransforms,\n\ttype ModelsSimpleStreamOptions,\n\ttype MutableModels,\n\tnormalizeContext,\n\ttype Provider,\n\ttype ProviderHeaders,\n\ttype SimpleStreamOptions,\n\ttype StreamOptions,\n} from \"@bastani/pi-ai\";\nimport { usesChatGptCodexTransport, withChatGptCodexTransportRouting } from \"./fast-model-routing.ts\";\nimport { installCodexFastRouteWebSocketIdentity } from \"./fast-model-routing-transport.ts\";\nimport type { ModelRuntimeAuthOverrides } from \"./model-runtime-types.ts\";\n\nexport function mergeHeaders(\n\tbase: ProviderHeaders | undefined,\n\toverride: ProviderHeaders | undefined,\n): ProviderHeaders | undefined {\n\tif (!base && !override) return undefined;\n\tconst merged = { ...base };\n\tfor (const [name, value] of Object.entries(override ?? {})) {\n\t\tconst lowerName = name.toLowerCase();\n\t\tfor (const existingName of Object.keys(merged)) {\n\t\t\tif (existingName.toLowerCase() === lowerName) delete merged[existingName];\n\t\t}\n\t\tmerged[name] = value;\n\t}\n\treturn merged;\n}\n\n/** SDK-owned request-auth result so transport preparation does not start a second deadline. */\nexport interface PreparedRequestAuth {\n\treadonly resolution: AuthResult | undefined;\n}\n\nexport type ModelRuntimePreparedStreamOptions = StreamOptions &\n\tModelsRequestTransforms & {\n\t\tpreparedRequestAuth?: PreparedRequestAuth;\n\t};\n\nexport type ModelRuntimeSimpleStreamOptions = ModelsSimpleStreamOptions & {\n\tpreparedRequestAuth?: PreparedRequestAuth;\n};\n\ntype ResolveAuth = (model: Model<Api>, overrides?: ModelRuntimeAuthOverrides) => Promise<AuthResult | undefined>;\n/** Whether an extension owns this model's transport, in which case it owns its serialization too. */\ntype OwnsExtensionTransport = (model: Model<Api>) => boolean;\n\n/** Streaming request preparation split from ModelRuntime solely for Atomic's 500-line source gate. */\nexport class ModelRuntimeStreaming {\n\tprivate readonly models: MutableModels;\n\tprivate readonly resolveAuth: ResolveAuth;\n\tprivate readonly ownsExtensionTransport: OwnsExtensionTransport;\n\tconstructor(models: MutableModels, resolveAuth: ResolveAuth, ownsExtensionTransport: OwnsExtensionTransport) {\n\t\tthis.models = models;\n\t\tthis.resolveAuth = resolveAuth;\n\t\tthis.ownsExtensionTransport = ownsExtensionTransport;\n\t}\n\n\t/**\n\t * Attach the first-party ChatGPT Codex routing identity to a prepared request.\n\t *\n\t * This must happen *after* `prepareRequest`, not before it. The wrapper works by mutating the\n\t * header object it captures at construction, and `prepareRequest` rebuilds headers through\n\t * `mergeHeaders`, which copies — so a wrapper applied upstream is silently inert. The wrapper\n\t * decides from the final payload whether the request is priority, so a normal model still ends up\n\t * with `originator: pi` and no routing hint.\n\t */\n\tprivate withCodexRouting<TOptions extends StreamOptions>(model: Model<Api>, options: TOptions): TOptions {\n\t\tif (!usesChatGptCodexTransport(model) || this.ownsExtensionTransport(model)) return options;\n\t\t// The WebSocket handshake builds its headers inside pi-ai and the constructor can be cached, so\n\t\t// the identity is repaired through the global constructor rather than per-request options. CLI\n\t\t// entrypoints install this through the HTTP dispatcher; a pure SDK embedder never does.\n\t\tif (options.transport !== \"sse\") installCodexFastRouteWebSocketIdentity();\n\t\treturn withChatGptCodexTransportRouting(model, options);\n\t}\n\n\tprivate async prepareRequest(\n\t\tmodel: Model<Api>,\n\t\toptions: ModelRuntimePreparedStreamOptions | undefined,\n\t): Promise<{ provider: Provider; model: Model<Api>; options: StreamOptions }> {\n\t\tconst provider = this.models.getProvider(model.provider);\n\t\tif (!provider) throw new ModelsError(\"provider\", `Unknown provider: ${model.provider}`);\n\t\tconst { transformHeaders, preparedRequestAuth, ...providerOptions } = options ?? {};\n\t\tconst resolution = preparedRequestAuth\n\t\t\t? preparedRequestAuth.resolution\n\t\t\t: await this.resolveAuth(model, {\n\t\t\t\t\tapiKey: options?.apiKey,\n\t\t\t\t\tenv: options?.env,\n\t\t\t\t\tsignal: options?.signal,\n\t\t\t\t});\n\t\toptions?.signal?.throwIfAborted();\n\t\tif (!resolution) throw new ModelsError(\"auth\", `Provider is not configured: ${model.provider}`);\n\n\t\tlet headers = mergeHeaders(resolution.auth.headers, providerOptions.headers);\n\t\tif (transformHeaders) headers = await transformHeaders(headers ?? {});\n\t\toptions?.signal?.throwIfAborted();\n\t\tconst env =\n\t\t\tresolution.env || providerOptions.env\n\t\t\t\t? { ...(resolution.env ?? {}), ...(providerOptions.env ?? {}) }\n\t\t\t\t: undefined;\n\t\treturn {\n\t\t\tprovider,\n\t\t\tmodel: resolution.auth.baseUrl ? { ...model, baseUrl: resolution.auth.baseUrl } : model,\n\t\t\toptions: {\n\t\t\t\t...providerOptions,\n\t\t\t\tapiKey: providerOptions.apiKey ?? resolution.auth.apiKey,\n\t\t\t\theaders,\n\t\t\t\tenv,\n\t\t\t},\n\t\t};\n\t}\n\n\tstream<TApi extends Api>(\n\t\tmodel: Model<TApi>,\n\t\tcontext: Context,\n\t\toptions?: ModelsApiStreamOptions<TApi>,\n\t): AssistantMessageEventStream {\n\t\tconst transcript = normalizeContext(context);\n\t\treturn lazyStream(model, async () => {\n\t\t\tconst prepared = await this.prepareRequest(\n\t\t\t\tmodel,\n\t\t\t\toptions as (StreamOptions & ModelsRequestTransforms) | undefined,\n\t\t\t);\n\t\t\treturn prepared.provider.stream(\n\t\t\t\tprepared.model as Model<TApi>,\n\t\t\t\ttranscript,\n\t\t\t\tthis.withCodexRouting(prepared.model, prepared.options) as ApiStreamOptions<TApi>,\n\t\t\t);\n\t\t});\n\t}\n\n\tcomplete<TApi extends Api>(\n\t\tmodel: Model<TApi>,\n\t\tcontext: Context,\n\t\toptions?: ModelsApiStreamOptions<TApi>,\n\t): Promise<AssistantMessage> {\n\t\treturn this.stream(model, context, options).result();\n\t}\n\n\tstreamSimple(\n\t\tmodel: Model<Api>,\n\t\tcontext: Context,\n\t\toptions?: ModelRuntimeSimpleStreamOptions,\n\t): AssistantMessageEventStream {\n\t\tconst transcript = normalizeContext(context);\n\t\treturn lazyStream(model, async () => {\n\t\t\tconst prepared = await this.prepareRequest(model, options);\n\t\t\treturn prepared.provider.streamSimple(\n\t\t\t\tprepared.model,\n\t\t\t\ttranscript,\n\t\t\t\tthis.withCodexRouting(prepared.model, prepared.options) as SimpleStreamOptions,\n\t\t\t);\n\t\t});\n\t}\n\n\tcompleteSimple(\n\t\tmodel: Model<Api>,\n\t\tcontext: Context,\n\t\toptions?: ModelRuntimeSimpleStreamOptions,\n\t): Promise<AssistantMessage> {\n\t\treturn this.streamSimple(model, context, options).result();\n\t}\n\n\tasync fetchDeferred(\n\t\tmodel: Model<Api>,\n\t\thandle: DeferredHandle,\n\t\toptions?: ModelsDeferredFetchOptions,\n\t): Promise<AssistantMessage> {\n\t\treturn lazyStream(model, async () => {\n\t\t\tconst prepared = await this.prepareRequest(model, options);\n\t\t\tif (!prepared.provider.fetchDeferred) {\n\t\t\t\tthrow new ModelsError(\"provider\", `Provider ${model.provider} does not support deferred responses`);\n\t\t\t}\n\t\t\treturn prepared.provider.fetchDeferred(prepared.model, handle, prepared.options as DeferredFetchOptions);\n\t\t}).result();\n\t}\n\n\tasync cancelDeferred(\n\t\tmodel: Model<Api>,\n\t\thandle: DeferredHandle,\n\t\toptions?: ModelsDeferredCancelOptions,\n\t): Promise<void> {\n\t\tconst prepared = await this.prepareRequest(model, options);\n\t\tif (!prepared.provider.cancelDeferred) {\n\t\t\tthrow new ModelsError(\"provider\", `Provider ${model.provider} does not support deferred responses`);\n\t\t}\n\t\tawait prepared.provider.cancelDeferred(prepared.model, handle, prepared.options as DeferredCancelOptions);\n\t}\n}\n"]}
1
+ {"version":3,"file":"model-runtime-streaming.js","sourceRoot":"","sources":["../../src/core/model-runtime-streaming.ts"],"names":[],"mappings":"AAAA,OAAO,EAMN,eAAe,EAKf,UAAU,EAKV,WAAW,EAIX,gBAAgB,GAKhB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,gCAAgC,EAAE,MAAM,yBAAyB,CAAC;AACtG,OAAO,EAAE,sCAAsC,EAAE,MAAM,mCAAmC,CAAC;AAG3F,MAAM,UAAU,YAAY,CAC3B,IAAiC,EACjC,QAAqC;IAErC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ;QAAE,OAAO,SAAS,CAAC;IACzC,MAAM,MAAM,GAAG,EAAE,GAAG,IAAI,EAAE,CAAC;IAC3B,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAE,CAAC;QAC5D,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QACrC,KAAK,MAAM,YAAY,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;YAChD,IAAI,YAAY,CAAC,WAAW,EAAE,KAAK,SAAS;gBAAE,OAAO,MAAM,CAAC,YAAY,CAAC,CAAC;QAC3E,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;IACtB,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC;AAoBD,sGAAsG;AACtG,MAAM,OAAO,qBAAqB;IAIjC,YAAY,MAAqB,EAAE,WAAwB,EAAE,sBAA8C;QAC1G,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/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AAC,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,OAA+B,CAAC,CAAC;QAC1G,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACb,CAAC;IAED,KAAK,CAAC,cAAc,CACnB,KAAiB,EACjB,MAAsB,EACtB,OAAqC;QAErC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAC3D,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,cAAc,EAAE,CAAC;YACvC,MAAM,IAAI,WAAW,CAAC,UAAU,EAAE,YAAY,KAAK,CAAC,QAAQ,sCAAsC,CAAC,CAAC;QACrG,CAAC;QACD,MAAM,QAAQ,CAAC,QAAQ,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,OAAgC,CAAC,CAAC;IAC3G,CAAC;CACD","sourcesContent":["import {\n\ttype Api,\n\ttype ApiStreamOptions,\n\ttype AssistantMessage,\n\ttype AssistantMessageEventStream,\n\ttype AuthResult,\n\tassertChatModel,\n\ttype Context,\n\ttype DeferredCancelOptions,\n\ttype DeferredFetchOptions,\n\ttype DeferredHandle,\n\tlazyStream,\n\ttype Model,\n\ttype ModelsApiStreamOptions,\n\ttype ModelsDeferredCancelOptions,\n\ttype ModelsDeferredFetchOptions,\n\tModelsError,\n\ttype ModelsRequestTransforms,\n\ttype ModelsSimpleStreamOptions,\n\ttype MutableModels,\n\tnormalizeContext,\n\ttype Provider,\n\ttype ProviderHeaders,\n\ttype SimpleStreamOptions,\n\ttype StreamOptions,\n} from \"@bastani/pi-ai\";\nimport { usesChatGptCodexTransport, withChatGptCodexTransportRouting } from \"./fast-model-routing.ts\";\nimport { installCodexFastRouteWebSocketIdentity } from \"./fast-model-routing-transport.ts\";\nimport type { ModelRuntimeAuthOverrides } from \"./model-runtime-types.ts\";\n\nexport function mergeHeaders(\n\tbase: ProviderHeaders | undefined,\n\toverride: ProviderHeaders | undefined,\n): ProviderHeaders | undefined {\n\tif (!base && !override) return undefined;\n\tconst merged = { ...base };\n\tfor (const [name, value] of Object.entries(override ?? {})) {\n\t\tconst lowerName = name.toLowerCase();\n\t\tfor (const existingName of Object.keys(merged)) {\n\t\t\tif (existingName.toLowerCase() === lowerName) delete merged[existingName];\n\t\t}\n\t\tmerged[name] = value;\n\t}\n\treturn merged;\n}\n\n/** SDK-owned request-auth result so transport preparation does not start a second deadline. */\nexport interface PreparedRequestAuth {\n\treadonly resolution: AuthResult | undefined;\n}\n\nexport type ModelRuntimePreparedStreamOptions = StreamOptions &\n\tModelsRequestTransforms & {\n\t\tpreparedRequestAuth?: PreparedRequestAuth;\n\t};\n\nexport type ModelRuntimeSimpleStreamOptions = ModelsSimpleStreamOptions & {\n\tpreparedRequestAuth?: PreparedRequestAuth;\n};\n\ntype ResolveAuth = (model: Model<Api>, overrides?: ModelRuntimeAuthOverrides) => Promise<AuthResult | undefined>;\n/** Whether an extension owns this model's transport, in which case it owns its serialization too. */\ntype OwnsExtensionTransport = (model: Model<Api>) => boolean;\n\n/** Streaming request preparation split from ModelRuntime solely for Atomic's 500-line source gate. */\nexport class ModelRuntimeStreaming {\n\tprivate readonly models: MutableModels;\n\tprivate readonly resolveAuth: ResolveAuth;\n\tprivate readonly ownsExtensionTransport: OwnsExtensionTransport;\n\tconstructor(models: MutableModels, resolveAuth: ResolveAuth, ownsExtensionTransport: OwnsExtensionTransport) {\n\t\tthis.models = models;\n\t\tthis.resolveAuth = resolveAuth;\n\t\tthis.ownsExtensionTransport = ownsExtensionTransport;\n\t}\n\n\t/**\n\t * Attach the first-party ChatGPT Codex routing identity to a prepared request.\n\t *\n\t * This must happen *after* `prepareRequest`, not before it. The wrapper works by mutating the\n\t * header object it captures at construction, and `prepareRequest` rebuilds headers through\n\t * `mergeHeaders`, which copies — so a wrapper applied upstream is silently inert. The wrapper\n\t * decides from the final payload whether the request is priority, so a normal model still ends up\n\t * with `originator: pi` and no routing hint.\n\t */\n\tprivate withCodexRouting<TOptions extends StreamOptions>(model: Model<Api>, options: TOptions): TOptions {\n\t\tif (!usesChatGptCodexTransport(model) || this.ownsExtensionTransport(model)) return options;\n\t\t// The WebSocket handshake builds its headers inside pi-ai and the constructor can be cached, so\n\t\t// the identity is repaired through the global constructor rather than per-request options. CLI\n\t\t// entrypoints install this through the HTTP dispatcher; a pure SDK embedder never does.\n\t\tif (options.transport !== \"sse\") installCodexFastRouteWebSocketIdentity();\n\t\treturn withChatGptCodexTransportRouting(model, options);\n\t}\n\n\tprivate async prepareRequest(\n\t\tmodel: Model<Api>,\n\t\toptions: ModelRuntimePreparedStreamOptions | undefined,\n\t): Promise<{ provider: Provider; model: Model<Api>; options: StreamOptions }> {\n\t\tassertChatModel(model);\n\t\tconst provider = this.models.getProvider(model.provider);\n\t\tif (!provider) throw new ModelsError(\"provider\", `Unknown provider: ${model.provider}`);\n\t\tconst { transformHeaders, preparedRequestAuth, ...providerOptions } = options ?? {};\n\t\tconst resolution = preparedRequestAuth\n\t\t\t? preparedRequestAuth.resolution\n\t\t\t: await this.resolveAuth(model, {\n\t\t\t\t\tapiKey: options?.apiKey,\n\t\t\t\t\tenv: options?.env,\n\t\t\t\t\tsignal: options?.signal,\n\t\t\t\t});\n\t\toptions?.signal?.throwIfAborted();\n\t\tif (!resolution) throw new ModelsError(\"auth\", `Provider is not configured: ${model.provider}`);\n\n\t\tlet headers = mergeHeaders(resolution.auth.headers, providerOptions.headers);\n\t\tif (transformHeaders) headers = await transformHeaders(headers ?? {});\n\t\toptions?.signal?.throwIfAborted();\n\t\tconst env =\n\t\t\tresolution.env || providerOptions.env\n\t\t\t\t? { ...(resolution.env ?? {}), ...(providerOptions.env ?? {}) }\n\t\t\t\t: undefined;\n\t\treturn {\n\t\t\tprovider,\n\t\t\tmodel: resolution.auth.baseUrl ? { ...model, baseUrl: resolution.auth.baseUrl } : model,\n\t\t\toptions: {\n\t\t\t\t...providerOptions,\n\t\t\t\tapiKey: providerOptions.apiKey ?? resolution.auth.apiKey,\n\t\t\t\theaders,\n\t\t\t\tenv,\n\t\t\t},\n\t\t};\n\t}\n\n\tstream<TApi extends Api>(\n\t\tmodel: Model<TApi>,\n\t\tcontext: Context,\n\t\toptions?: ModelsApiStreamOptions<TApi>,\n\t): AssistantMessageEventStream {\n\t\tconst transcript = normalizeContext(context);\n\t\treturn lazyStream(model, async () => {\n\t\t\tconst prepared = await this.prepareRequest(\n\t\t\t\tmodel,\n\t\t\t\toptions as (StreamOptions & ModelsRequestTransforms) | undefined,\n\t\t\t);\n\t\t\treturn prepared.provider.stream(\n\t\t\t\tprepared.model as Model<TApi>,\n\t\t\t\ttranscript,\n\t\t\t\tthis.withCodexRouting(prepared.model, prepared.options) as ApiStreamOptions<TApi>,\n\t\t\t);\n\t\t});\n\t}\n\n\tcomplete<TApi extends Api>(\n\t\tmodel: Model<TApi>,\n\t\tcontext: Context,\n\t\toptions?: ModelsApiStreamOptions<TApi>,\n\t): Promise<AssistantMessage> {\n\t\treturn this.stream(model, context, options).result();\n\t}\n\n\tstreamSimple(\n\t\tmodel: Model<Api>,\n\t\tcontext: Context,\n\t\toptions?: ModelRuntimeSimpleStreamOptions,\n\t): AssistantMessageEventStream {\n\t\tconst transcript = normalizeContext(context);\n\t\treturn lazyStream(model, async () => {\n\t\t\tconst prepared = await this.prepareRequest(model, options);\n\t\t\treturn prepared.provider.streamSimple(\n\t\t\t\tprepared.model,\n\t\t\t\ttranscript,\n\t\t\t\tthis.withCodexRouting(prepared.model, prepared.options) as SimpleStreamOptions,\n\t\t\t);\n\t\t});\n\t}\n\n\tcompleteSimple(\n\t\tmodel: Model<Api>,\n\t\tcontext: Context,\n\t\toptions?: ModelRuntimeSimpleStreamOptions,\n\t): Promise<AssistantMessage> {\n\t\treturn this.streamSimple(model, context, options).result();\n\t}\n\n\tasync fetchDeferred(\n\t\tmodel: Model<Api>,\n\t\thandle: DeferredHandle,\n\t\toptions?: ModelsDeferredFetchOptions,\n\t): Promise<AssistantMessage> {\n\t\treturn lazyStream(model, async () => {\n\t\t\tconst prepared = await this.prepareRequest(model, options);\n\t\t\tif (!prepared.provider.fetchDeferred) {\n\t\t\t\tthrow new ModelsError(\"provider\", `Provider ${model.provider} does not support deferred responses`);\n\t\t\t}\n\t\t\treturn prepared.provider.fetchDeferred(prepared.model, handle, prepared.options as DeferredFetchOptions);\n\t\t}).result();\n\t}\n\n\tasync cancelDeferred(\n\t\tmodel: Model<Api>,\n\t\thandle: DeferredHandle,\n\t\toptions?: ModelsDeferredCancelOptions,\n\t): Promise<void> {\n\t\tconst prepared = await this.prepareRequest(model, options);\n\t\tif (!prepared.provider.cancelDeferred) {\n\t\t\tthrow new ModelsError(\"provider\", `Provider ${model.provider} does not support deferred responses`);\n\t\t}\n\t\tawait prepared.provider.cancelDeferred(prepared.model, handle, prepared.options as DeferredCancelOptions);\n\t}\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { type Api, type AssistantMessage, type AssistantMessageEventStream, type AuthCheck, type AuthInteraction, type AuthOperationOptions, type AuthResult, type AuthType, type Context, type Credential, type CredentialInfo, type DeferredHandle, type Model, type Models, type ModelsApiStreamOptions, type ModelsDeferredCancelOptions, type ModelsDeferredFetchOptions, type ModelsRefreshOptions, type ModelsRefreshResult, type Provider } from "@bastani/pi-ai";
1
+ import { type AnyModel, type Api, type AssistantImages, type AssistantMessage, type AssistantMessageEventStream, type AuthCheck, type AuthInteraction, type AuthOperationOptions, type AuthResult, type AuthType, type ClassifierApi, type ClassifierContext, type ClassifierModel, type ClassifierResult, type Context, type Credential, type CredentialInfo, type DeferredHandle, type ImageApi, type ImageModel, type ImagesContext, type Model, type Models, type ModelsApiStreamOptions, type ModelsClassifierOptions, type ModelsDeferredCancelOptions, type ModelsDeferredFetchOptions, type ModelsImagesOptions, type ModelsRefreshOptions, type ModelsRefreshResult, type ModelType, type ModelTypeMap, type Provider } from "@bastani/pi-ai";
2
2
  import { type FastModelVariantDiagnostic } from "./fast-model-variants.ts";
3
3
  import { type AuthStatus, type CompatibilityRequestConfig, type ProviderConfigInput } from "./provider-composer.ts";
4
4
  export type { CreateModelRuntimeOptions, ModelRuntimeAuthOverrides } from "./model-runtime-types.ts";
@@ -88,7 +88,12 @@ export declare class ModelRuntime implements Models {
88
88
  canRestoreUnknownModel(providerId: string, modelId?: string): boolean;
89
89
  getModels(providerId?: string): readonly Model<Api>[];
90
90
  getModel(providerId: string, modelId: string): Model<Api> | undefined;
91
- checkAuth(providerId: string): Promise<AuthCheck | undefined>;
91
+ getModelsOfType<TType extends ModelType>(type: TType, providerId?: string): readonly ModelTypeMap[TType][];
92
+ getModelOfType<TType extends ModelType>(type: TType, providerId: string, modelId: string): ModelTypeMap[TType] | undefined;
93
+ getAllModels(providerId?: string): readonly AnyModel[];
94
+ getAvailableOfType<TType extends ModelType>(type: TType, providerId?: string, options?: AuthOperationOptions): Promise<readonly ModelTypeMap[TType][]>;
95
+ getAllAvailable(providerId?: string, options?: AuthOperationOptions): Promise<readonly AnyModel[]>;
96
+ checkAuth(providerId: string, options?: AuthOperationOptions): Promise<AuthCheck | undefined>;
92
97
  getAvailable(providerId?: string, options?: AuthOperationOptions): Promise<readonly Model<Api>[]>;
93
98
  getAvailableSnapshot(): readonly Model<Api>[];
94
99
  getError(): string | undefined;
@@ -116,7 +121,7 @@ export declare class ModelRuntime implements Models {
116
121
  /** Return stored credential metadata synchronously without refreshing auth. */
117
122
  getCredentialSnapshot(providerId: string): Credential | undefined;
118
123
  getAuth(providerId: string, overrides?: ModelRuntimeAuthOverrides): Promise<AuthResult | undefined>;
119
- getAuth(model: Model<Api>, overrides?: ModelRuntimeAuthOverrides): Promise<AuthResult | undefined>;
124
+ getAuth(model: AnyModel, overrides?: ModelRuntimeAuthOverrides): Promise<AuthResult | undefined>;
120
125
  /**
121
126
  * Resolve request-owned auth/config headers without copying the model's static
122
127
  * catalog headers into the per-request override layer. The API provider reads
@@ -200,6 +205,9 @@ export declare class ModelRuntime implements Models {
200
205
  completeSimple(model: Model<Api>, context: Context, options?: ModelRuntimeSimpleStreamOptions): Promise<AssistantMessage>;
201
206
  fetchDeferred(model: Model<Api>, handle: DeferredHandle, options?: ModelsDeferredFetchOptions): Promise<AssistantMessage>;
202
207
  cancelDeferred(model: Model<Api>, handle: DeferredHandle, options?: ModelsDeferredCancelOptions): Promise<void>;
208
+ private operationHeaders;
209
+ generateImages(model: ImageModel<ImageApi>, context: ImagesContext, options?: ModelsImagesOptions): Promise<AssistantImages>;
210
+ classify(model: ClassifierModel<ClassifierApi>, context: ClassifierContext, options?: ModelsClassifierOptions): Promise<ClassifierResult>;
203
211
  login(providerId: string, type: AuthType, interaction: AuthInteraction): Promise<Credential>;
204
212
  logout(providerId: string, options?: AuthOperationOptions): Promise<void>;
205
213
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"model-runtime.d.ts","sourceRoot":"","sources":["../../src/core/model-runtime.ts"],"names":[],"mappings":"AAGA,OAAO,EACN,KAAK,GAAG,EACR,KAAK,gBAAgB,EACrB,KAAK,2BAA2B,EAChC,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,OAAO,EACZ,KAAK,UAAU,EACf,KAAK,cAAc,EAEnB,KAAK,cAAc,EACnB,KAAK,KAAK,EACV,KAAK,MAAM,EACX,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAC/B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EAGxB,KAAK,QAAQ,EACb,MAAM,gBAAgB,CAAC;AAQxB,OAAO,EAIN,KAAK,0BAA0B,EAG/B,MAAM,0BAA0B,CAAC;AAkBlC,OAAO,EACN,KAAK,UAAU,EACf,KAAK,0BAA0B,EAG/B,KAAK,mBAAmB,EAGxB,MAAM,wBAAwB,CAAC;AAIhC,YAAY,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAKrG,OAAO,EAAE,KAAK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Storage } from "./auth-storage.js";
10
10
  import { containsAuthConfig } from "./credential-screening.js";
11
- import { jevAuthProvider } from "./decision-provider.js";
12
11
  import { copilotAdvertisedFastModelIds, copilotAdvertisesModelId, FAST_MODEL_ID_SUFFIX, isGitHubCopilotModel, withFastModelVariants, } from "./fast-model-variants.js";
13
12
  import { ModelConfig } from "./model-config.js";
14
13
  import { POST_LOGOUT_AUTH_CHECK_TIMEOUT_MS } from "./model-refresh-timeout.js";
@@ -16,13 +15,13 @@ import { addRuntimeApiKeyProvider, addStoredCredentialProvider, createEmptyModel
16
15
  import { FileModelsStore, InMemoryCodingAgentModelsStore } from "./models-store.js";
17
16
  import { collectOAuthProviderMetadata } from "./oauth-provider-metadata.js";
18
17
  import { isOfflineModeEnabled } from "./package-manager-env.js";
19
- import { composeModelProvider, configuredRequestAuthStatus, resolveCompatibilityRequestConfig, validateExtensionProvider, } from "./provider-composer.js";
18
+ import { composeModelProvider, configuredRequestAuthStatus, resolveCompatibilityRequestConfig, resolveConfiguredModelHeaders, validateExtensionProvider, } from "./provider-composer.js";
20
19
  import { withRemoteCatalog } from "./remote-catalog-provider.js";
21
20
  import { RuntimeCredentials } from "./runtime-credentials.js";
22
21
  import { mergeConfiguredAuthHeaders } from "./model-runtime-auth.js";
23
22
  import { configureBuiltinProviders } from "./model-runtime-providers.js";
24
23
  import { canRestoreUnknownModel as canRestoreUnknownModelProvider } from "./model-runtime-restoration.js";
25
- import { ModelRuntimeStreaming } from "./model-runtime-streaming.js";
24
+ import { ModelRuntimeStreaming, mergeHeaders, } from "./model-runtime-streaming.js";
26
25
  /** Credentials changed successfully, but local model state could not be synchronized. */
27
26
  export class CredentialSynchronizationError extends Error {
28
27
  constructor(providerId, operation, credential, options) {
@@ -86,7 +85,6 @@ export class ModelRuntime {
86
85
  .map((provider) => provider.id === "radius"
87
86
  ? provider
88
87
  : withRemoteCatalog(provider, options.catalogBaseUrl, builtinModelDataGeneratedAt));
89
- providers.push(jevAuthProvider());
90
88
  const runtime = new ModelRuntime(credentials, config, modelsPath, modelsStore, providers, !isOfflineModeEnabled());
91
89
  runtime.configureRadiusProviders();
92
90
  runtime.rebuildProviders();
@@ -329,8 +327,23 @@ export class ModelRuntime {
329
327
  getModel(providerId, modelId) {
330
328
  return this.models.getModel(providerId, modelId);
331
329
  }
332
- async checkAuth(providerId) {
333
- return this.models.checkAuth(providerId);
330
+ getModelsOfType(type, providerId) {
331
+ return this.models.getModelsOfType(type, providerId);
332
+ }
333
+ getModelOfType(type, providerId, modelId) {
334
+ return this.models.getModelOfType(type, providerId, modelId);
335
+ }
336
+ getAllModels(providerId) {
337
+ return this.models.getAllModels(providerId);
338
+ }
339
+ getAvailableOfType(type, providerId, options) {
340
+ return this.models.getAvailableOfType(type, providerId, options);
341
+ }
342
+ getAllAvailable(providerId, options) {
343
+ return this.models.getAllAvailable(providerId, options);
344
+ }
345
+ async checkAuth(providerId, options) {
346
+ return this.models.checkAuth(providerId, options);
334
347
  }
335
348
  async getAvailable(providerId, options) {
336
349
  if (providerId) {
@@ -679,6 +692,28 @@ export class ModelRuntime {
679
692
  cancelDeferred(model, handle, options) {
680
693
  return this.streaming.cancelDeferred(model, handle, options);
681
694
  }
695
+ operationHeaders(model, headers, env) {
696
+ const configured = resolveConfiguredModelHeaders(model, this.config.getProvider(model.provider), this.extensionProviders.get(model.provider), env);
697
+ return mergeHeaders(configured, headers) ?? {};
698
+ }
699
+ generateImages(model, context, options) {
700
+ return this.models.generateImages(model, context, {
701
+ ...options,
702
+ transformHeaders: async (headers) => {
703
+ const prepared = this.operationHeaders(model, headers, options?.env);
704
+ return (await options?.transformHeaders?.(prepared)) ?? prepared;
705
+ },
706
+ });
707
+ }
708
+ classify(model, context, options) {
709
+ return this.models.classify(model, context, {
710
+ ...options,
711
+ transformHeaders: async (headers) => {
712
+ const prepared = this.operationHeaders(model, headers, options?.env);
713
+ return (await options?.transformHeaders?.(prepared)) ?? prepared;
714
+ },
715
+ });
716
+ }
682
717
  async login(providerId, type, interaction) {
683
718
  const signal = operationSignal(interaction.signal);
684
719
  return this.enqueueCredentialOperation(providerId, signal, async () => {