@bastani/atomic 0.9.11-alpha.7 → 0.9.11-alpha.8

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 (325) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +3 -5
  3. package/dist/builtin/intercom/package.json +1 -1
  4. package/dist/builtin/mcp/package.json +1 -1
  5. package/dist/builtin/mcp/sampling-handler.ts +1 -5
  6. package/dist/builtin/subagents/package.json +1 -1
  7. package/dist/builtin/web-access/package.json +1 -1
  8. package/dist/builtin/workflows/CHANGELOG.md +1 -0
  9. package/dist/builtin/workflows/README.md +1 -1
  10. package/dist/builtin/workflows/package.json +1 -1
  11. package/dist/builtin/workflows/src/extension/extension-runtime-state.ts +1 -24
  12. package/dist/builtin/workflows/src/extension/index.bundle.mjs +31 -28
  13. package/dist/builtin/workflows/src/extension/workflow-model-catalog.ts +26 -0
  14. package/dist/builtin/workflows/src/extension/workflow-prompts.ts +3 -2
  15. package/dist/builtin/workflows/src/runs/foreground/stage-runner-controller.ts +5 -5
  16. package/dist/builtin/workflows/src/runs/foreground/stage-runner-session-options.ts +3 -3
  17. package/dist/builtin/workflows/src/runs/foreground/stage-runner-session.ts +2 -2
  18. package/dist/cli/list-models.d.ts +2 -2
  19. package/dist/cli/list-models.d.ts.map +1 -1
  20. package/dist/cli/list-models.js +5 -5
  21. package/dist/cli/list-models.js.map +1 -1
  22. package/dist/core/agent-session-accessors.js +1 -1
  23. package/dist/core/agent-session-accessors.js.map +1 -1
  24. package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
  25. package/dist/core/agent-session-auto-compaction.js +2 -5
  26. package/dist/core/agent-session-auto-compaction.js.map +1 -1
  27. package/dist/core/agent-session-compaction.js +1 -1
  28. package/dist/core/agent-session-compaction.js.map +1 -1
  29. package/dist/core/agent-session-extension-bindings.js +5 -5
  30. package/dist/core/agent-session-extension-bindings.js.map +1 -1
  31. package/dist/core/agent-session-methods.d.ts +4 -4
  32. package/dist/core/agent-session-methods.d.ts.map +1 -1
  33. package/dist/core/agent-session-methods.js.map +1 -1
  34. package/dist/core/agent-session-models.d.ts +1 -1
  35. package/dist/core/agent-session-models.d.ts.map +1 -1
  36. package/dist/core/agent-session-models.js +18 -14
  37. package/dist/core/agent-session-models.js.map +1 -1
  38. package/dist/core/agent-session-post-tool-compaction.d.ts.map +1 -1
  39. package/dist/core/agent-session-post-tool-compaction.js +2 -4
  40. package/dist/core/agent-session-post-tool-compaction.js.map +1 -1
  41. package/dist/core/agent-session-prompt.d.ts.map +1 -1
  42. package/dist/core/agent-session-prompt.js +3 -7
  43. package/dist/core/agent-session-prompt.js.map +1 -1
  44. package/dist/core/agent-session-retry.js +1 -1
  45. package/dist/core/agent-session-retry.js.map +1 -1
  46. package/dist/core/agent-session-runtime-auth.d.ts +3 -3
  47. package/dist/core/agent-session-runtime-auth.d.ts.map +1 -1
  48. package/dist/core/agent-session-runtime-auth.js +4 -14
  49. package/dist/core/agent-session-runtime-auth.js.map +1 -1
  50. package/dist/core/agent-session-runtime.d.ts +1 -1
  51. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  52. package/dist/core/agent-session-runtime.js +3 -3
  53. package/dist/core/agent-session-runtime.js.map +1 -1
  54. package/dist/core/agent-session-services.d.ts +3 -8
  55. package/dist/core/agent-session-services.d.ts.map +1 -1
  56. package/dist/core/agent-session-services.js +16 -23
  57. package/dist/core/agent-session-services.js.map +1 -1
  58. package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
  59. package/dist/core/agent-session-tool-registry.js +2 -1
  60. package/dist/core/agent-session-tool-registry.js.map +1 -1
  61. package/dist/core/agent-session-types.d.ts +2 -2
  62. package/dist/core/agent-session-types.d.ts.map +1 -1
  63. package/dist/core/agent-session-types.js.map +1 -1
  64. package/dist/core/agent-session.d.ts +2 -2
  65. package/dist/core/agent-session.d.ts.map +1 -1
  66. package/dist/core/agent-session.js +1 -1
  67. package/dist/core/agent-session.js.map +1 -1
  68. package/dist/core/auth-storage-backends.d.ts +1 -0
  69. package/dist/core/auth-storage-backends.d.ts.map +1 -1
  70. package/dist/core/auth-storage-backends.js +18 -4
  71. package/dist/core/auth-storage-backends.js.map +1 -1
  72. package/dist/core/auth-storage.d.ts +12 -139
  73. package/dist/core/auth-storage.d.ts.map +1 -1
  74. package/dist/core/auth-storage.js +68 -374
  75. package/dist/core/auth-storage.js.map +1 -1
  76. package/dist/core/copilot-env-routing.d.ts +36 -0
  77. package/dist/core/copilot-env-routing.d.ts.map +1 -0
  78. package/dist/core/copilot-env-routing.js +94 -0
  79. package/dist/core/copilot-env-routing.js.map +1 -0
  80. package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
  81. package/dist/core/extensions/loader-virtual-modules.js +10 -2
  82. package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
  83. package/dist/core/extensions/provider-types.d.ts +0 -40
  84. package/dist/core/extensions/provider-types.d.ts.map +1 -1
  85. package/dist/core/extensions/provider-types.js.map +1 -1
  86. package/dist/core/fallback-models.d.ts +4 -4
  87. package/dist/core/fallback-models.d.ts.map +1 -1
  88. package/dist/core/fallback-models.js +3 -3
  89. package/dist/core/fallback-models.js.map +1 -1
  90. package/dist/core/model-config.d.ts +542 -0
  91. package/dist/core/model-config.d.ts.map +1 -0
  92. package/dist/core/{model-registry-schemas.js → model-config.js} +85 -34
  93. package/dist/core/model-config.js.map +1 -0
  94. package/dist/core/model-registry.d.ts +25 -85
  95. package/dist/core/model-registry.d.ts.map +1 -1
  96. package/dist/core/model-registry.js +65 -388
  97. package/dist/core/model-registry.js.map +1 -1
  98. package/dist/core/model-resolver-cli.d.ts +2 -2
  99. package/dist/core/model-resolver-cli.d.ts.map +1 -1
  100. package/dist/core/model-resolver-cli.js +2 -2
  101. package/dist/core/model-resolver-cli.js.map +1 -1
  102. package/dist/core/model-resolver-initial.d.ts +4 -4
  103. package/dist/core/model-resolver-initial.d.ts.map +1 -1
  104. package/dist/core/model-resolver-initial.js +17 -17
  105. package/dist/core/model-resolver-initial.js.map +1 -1
  106. package/dist/core/model-resolver-scope.d.ts +3 -3
  107. package/dist/core/model-resolver-scope.d.ts.map +1 -1
  108. package/dist/core/model-resolver-scope.js +4 -4
  109. package/dist/core/model-resolver-scope.js.map +1 -1
  110. package/dist/core/model-runtime-auth.d.ts +7 -0
  111. package/dist/core/model-runtime-auth.d.ts.map +1 -0
  112. package/dist/core/model-runtime-auth.js +14 -0
  113. package/dist/core/model-runtime-auth.js.map +1 -0
  114. package/dist/core/model-runtime-providers.d.ts +6 -0
  115. package/dist/core/model-runtime-providers.d.ts.map +1 -0
  116. package/dist/core/model-runtime-providers.js +22 -0
  117. package/dist/core/model-runtime-providers.js.map +1 -0
  118. package/dist/core/model-runtime-restoration.d.ts +6 -0
  119. package/dist/core/model-runtime-restoration.d.ts.map +1 -0
  120. package/dist/core/model-runtime-restoration.js +21 -0
  121. package/dist/core/model-runtime-restoration.js.map +1 -0
  122. package/dist/core/model-runtime-snapshot.d.ts +16 -0
  123. package/dist/core/model-runtime-snapshot.d.ts.map +1 -0
  124. package/dist/core/model-runtime-snapshot.js +52 -0
  125. package/dist/core/model-runtime-snapshot.js.map +1 -0
  126. package/dist/core/model-runtime-streaming.d.ts +17 -0
  127. package/dist/core/model-runtime-streaming.d.ts.map +1 -0
  128. package/dist/core/model-runtime-streaming.js +66 -0
  129. package/dist/core/model-runtime-streaming.js.map +1 -0
  130. package/dist/core/model-runtime-types.d.ts +21 -0
  131. package/dist/core/model-runtime-types.d.ts.map +1 -0
  132. package/dist/core/model-runtime-types.js +2 -0
  133. package/dist/core/model-runtime-types.js.map +1 -0
  134. package/dist/core/model-runtime.d.ts +50 -29
  135. package/dist/core/model-runtime.d.ts.map +1 -1
  136. package/dist/core/model-runtime.js +330 -90
  137. package/dist/core/model-runtime.js.map +1 -1
  138. package/dist/core/models-store.d.ts +2 -10
  139. package/dist/core/models-store.d.ts.map +1 -1
  140. package/dist/core/models-store.js +2 -29
  141. package/dist/core/models-store.js.map +1 -1
  142. package/dist/core/oauth-login.d.ts +24 -0
  143. package/dist/core/oauth-login.d.ts.map +1 -0
  144. package/dist/core/oauth-login.js +87 -0
  145. package/dist/core/oauth-login.js.map +1 -0
  146. package/dist/core/oauth-provider-metadata.d.ts +5 -0
  147. package/dist/core/oauth-provider-metadata.d.ts.map +1 -0
  148. package/dist/core/oauth-provider-metadata.js +19 -0
  149. package/dist/core/oauth-provider-metadata.js.map +1 -0
  150. package/dist/core/provider-composer-internal.d.ts +53 -0
  151. package/dist/core/provider-composer-internal.d.ts.map +1 -0
  152. package/dist/core/provider-composer-internal.js +273 -0
  153. package/dist/core/provider-composer-internal.js.map +1 -0
  154. package/dist/core/provider-composer.d.ts +16 -0
  155. package/dist/core/provider-composer.d.ts.map +1 -0
  156. package/dist/core/provider-composer.js +108 -0
  157. package/dist/core/provider-composer.js.map +1 -0
  158. package/dist/core/remote-catalog-provider.d.ts.map +1 -1
  159. package/dist/core/remote-catalog-provider.js +74 -122
  160. package/dist/core/remote-catalog-provider.js.map +1 -1
  161. package/dist/core/resolve-config-value.d.ts +8 -7
  162. package/dist/core/resolve-config-value.d.ts.map +1 -1
  163. package/dist/core/resolve-config-value.js +26 -23
  164. package/dist/core/resolve-config-value.js.map +1 -1
  165. package/dist/core/runtime-credentials.d.ts +16 -0
  166. package/dist/core/runtime-credentials.d.ts.map +1 -0
  167. package/dist/core/runtime-credentials.js +42 -0
  168. package/dist/core/runtime-credentials.js.map +1 -0
  169. package/dist/core/sdk-types.d.ts +1 -7
  170. package/dist/core/sdk-types.d.ts.map +1 -1
  171. package/dist/core/sdk-types.js.map +1 -1
  172. package/dist/core/sdk.d.ts.map +1 -1
  173. package/dist/core/sdk.js +27 -28
  174. package/dist/core/sdk.js.map +1 -1
  175. package/dist/extensions/llama/index.js +1 -1
  176. package/dist/extensions/llama/index.js.map +1 -1
  177. package/dist/extensions/llama/provider.d.ts +2 -4
  178. package/dist/extensions/llama/provider.d.ts.map +1 -1
  179. package/dist/extensions/llama/provider.js +25 -17
  180. package/dist/extensions/llama/provider.js.map +1 -1
  181. package/dist/index.d.ts +2 -3
  182. package/dist/index.d.ts.map +1 -1
  183. package/dist/index.js +3 -4
  184. package/dist/index.js.map +1 -1
  185. package/dist/main-runtime-api-key.d.ts +6 -0
  186. package/dist/main-runtime-api-key.d.ts.map +1 -0
  187. package/dist/main-runtime-api-key.js +6 -0
  188. package/dist/main-runtime-api-key.js.map +1 -0
  189. package/dist/main-session-options.d.ts +2 -2
  190. package/dist/main-session-options.d.ts.map +1 -1
  191. package/dist/main-session-options.js +3 -3
  192. package/dist/main-session-options.js.map +1 -1
  193. package/dist/main.d.ts.map +1 -1
  194. package/dist/main.js +9 -11
  195. package/dist/main.js.map +1 -1
  196. package/dist/modes/interactive/components/footer.js +1 -1
  197. package/dist/modes/interactive/components/footer.js.map +1 -1
  198. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  199. package/dist/modes/interactive/components/login-dialog.js +1 -3
  200. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  201. package/dist/modes/interactive/components/model-selector.d.ts +4 -3
  202. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  203. package/dist/modes/interactive/components/model-selector.js +56 -73
  204. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  205. package/dist/modes/interactive/components/oauth-selector.d.ts +4 -3
  206. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  207. package/dist/modes/interactive/components/oauth-selector.js +15 -24
  208. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  209. package/dist/modes/interactive/interactive-agent-events.js +1 -1
  210. package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
  211. package/dist/modes/interactive/interactive-auth-login.js +20 -31
  212. package/dist/modes/interactive/interactive-auth-login.js.map +1 -1
  213. package/dist/modes/interactive/interactive-auth-routing.d.ts +1 -1
  214. package/dist/modes/interactive/interactive-auth-routing.d.ts.map +1 -1
  215. package/dist/modes/interactive/interactive-auth-routing.js +21 -47
  216. package/dist/modes/interactive/interactive-auth-routing.js.map +1 -1
  217. package/dist/modes/interactive/interactive-autocomplete.js +3 -3
  218. package/dist/modes/interactive/interactive-autocomplete.js.map +1 -1
  219. package/dist/modes/interactive/interactive-deferred-startup.js +8 -8
  220. package/dist/modes/interactive/interactive-deferred-startup.js.map +1 -1
  221. package/dist/modes/interactive/interactive-extension-runtime.js +2 -1
  222. package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -1
  223. package/dist/modes/interactive/interactive-model-catalog-startup.js +2 -2
  224. package/dist/modes/interactive/interactive-model-catalog-startup.js.map +1 -1
  225. package/dist/modes/interactive/interactive-model-routing.js +11 -11
  226. package/dist/modes/interactive/interactive-model-routing.js.map +1 -1
  227. package/dist/modes/interactive/interactive-render-chat.js +1 -1
  228. package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
  229. package/dist/modes/interactive/interactive-slash-commands.js +2 -2
  230. package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
  231. package/dist/modes/interactive/interactive-startup.js +1 -1
  232. package/dist/modes/interactive/interactive-startup.js.map +1 -1
  233. package/dist/modes/interactive-engine/isolated-auth.d.ts +2 -2
  234. package/dist/modes/interactive-engine/isolated-auth.d.ts.map +1 -1
  235. package/dist/modes/interactive-engine/isolated-auth.js +4 -3
  236. package/dist/modes/interactive-engine/isolated-auth.js.map +1 -1
  237. package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
  238. package/dist/modes/interactive-engine/isolated-runtime.js +4 -3
  239. package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
  240. package/dist/modes/interactive-engine/remote-model-catalog.d.ts +0 -1
  241. package/dist/modes/interactive-engine/remote-model-catalog.d.ts.map +1 -1
  242. package/dist/modes/interactive-engine/remote-model-catalog.js +11 -50
  243. package/dist/modes/interactive-engine/remote-model-catalog.js.map +1 -1
  244. package/dist/modes/rpc/rpc-client-api.d.ts +2 -2
  245. package/dist/modes/rpc/rpc-client-api.d.ts.map +1 -1
  246. package/dist/modes/rpc/rpc-client-api.js.map +1 -1
  247. package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
  248. package/dist/modes/rpc/rpc-command-handler.js +26 -19
  249. package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
  250. package/dist/modes/rpc/rpc-oauth-client.d.ts +1 -1
  251. package/dist/modes/rpc/rpc-oauth-client.d.ts.map +1 -1
  252. package/dist/modes/rpc/rpc-oauth-client.js +1 -1
  253. package/dist/modes/rpc/rpc-oauth-client.js.map +1 -1
  254. package/dist/modes/rpc/rpc-oauth-interaction.d.ts +1 -1
  255. package/dist/modes/rpc/rpc-oauth-interaction.d.ts.map +1 -1
  256. package/dist/modes/rpc/rpc-oauth-interaction.js +1 -1
  257. package/dist/modes/rpc/rpc-oauth-interaction.js.map +1 -1
  258. package/dist/modes/rpc/rpc-provider-auth.d.ts +4 -5
  259. package/dist/modes/rpc/rpc-provider-auth.d.ts.map +1 -1
  260. package/dist/modes/rpc/rpc-provider-auth.js +19 -66
  261. package/dist/modes/rpc/rpc-provider-auth.js.map +1 -1
  262. package/dist/modes/rpc/rpc-session-binding.js +1 -1
  263. package/dist/modes/rpc/rpc-session-binding.js.map +1 -1
  264. package/dist/modes/rpc/rpc-types.d.ts +7 -4
  265. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  266. package/dist/modes/rpc/rpc-types.js.map +1 -1
  267. package/dist/package-manager-cli.d.ts.map +1 -1
  268. package/dist/package-manager-cli.js +5 -7
  269. package/dist/package-manager-cli.js.map +1 -1
  270. package/docs/changelog.mdx +1 -1
  271. package/docs/custom-provider.md +1 -1
  272. package/docs/models.md +4 -6
  273. package/docs/providers.md +13 -0
  274. package/docs/quickstart.md +2 -1
  275. package/docs/sdk.md +32 -49
  276. package/docs/workflows.md +3 -3
  277. package/examples/sdk/02-custom-model.ts +8 -10
  278. package/examples/sdk/09-api-keys-and-oauth.ts +17 -23
  279. package/examples/sdk/12-full-control.ts +9 -11
  280. package/examples/sdk/README.md +17 -21
  281. package/npm-shrinkwrap.json +23 -23
  282. package/package.json +2 -2
  283. package/dist/core/model-registry-auth.d.ts +0 -10
  284. package/dist/core/model-registry-auth.d.ts.map +0 -1
  285. package/dist/core/model-registry-auth.js +0 -98
  286. package/dist/core/model-registry-auth.js.map +0 -1
  287. package/dist/core/model-registry-builtins.d.ts +0 -8
  288. package/dist/core/model-registry-builtins.d.ts.map +0 -1
  289. package/dist/core/model-registry-builtins.js +0 -104
  290. package/dist/core/model-registry-builtins.js.map +0 -1
  291. package/dist/core/model-registry-custom-loader.d.ts +0 -3
  292. package/dist/core/model-registry-custom-loader.d.ts.map +0 -1
  293. package/dist/core/model-registry-custom-loader.js +0 -255
  294. package/dist/core/model-registry-custom-loader.js.map +0 -1
  295. package/dist/core/model-registry-dynamic.d.ts +0 -7
  296. package/dist/core/model-registry-dynamic.d.ts.map +0 -1
  297. package/dist/core/model-registry-dynamic.js +0 -189
  298. package/dist/core/model-registry-dynamic.js.map +0 -1
  299. package/dist/core/model-registry-extension-refresh.d.ts +0 -23
  300. package/dist/core/model-registry-extension-refresh.d.ts.map +0 -1
  301. package/dist/core/model-registry-extension-refresh.js +0 -32
  302. package/dist/core/model-registry-extension-refresh.js.map +0 -1
  303. package/dist/core/model-registry-loader.d.ts +0 -5
  304. package/dist/core/model-registry-loader.d.ts.map +0 -1
  305. package/dist/core/model-registry-loader.js +0 -29
  306. package/dist/core/model-registry-loader.js.map +0 -1
  307. package/dist/core/model-registry-schemas.d.ts +0 -1399
  308. package/dist/core/model-registry-schemas.d.ts.map +0 -1
  309. package/dist/core/model-registry-schemas.js.map +0 -1
  310. package/dist/core/model-registry-types.d.ts +0 -91
  311. package/dist/core/model-registry-types.d.ts.map +0 -1
  312. package/dist/core/model-registry-types.js +0 -2
  313. package/dist/core/model-registry-types.js.map +0 -1
  314. package/dist/core/model-registry-validation.d.ts +0 -7
  315. package/dist/core/model-registry-validation.d.ts.map +0 -1
  316. package/dist/core/model-registry-validation.js +0 -12
  317. package/dist/core/model-registry-validation.js.map +0 -1
  318. package/dist/core/oauth-compat.d.ts +0 -17
  319. package/dist/core/oauth-compat.d.ts.map +0 -1
  320. package/dist/core/oauth-compat.js +0 -2
  321. package/dist/core/oauth-compat.js.map +0 -1
  322. package/dist/core/oauth-provider-bridge.d.ts +0 -63
  323. package/dist/core/oauth-provider-bridge.d.ts.map +0 -1
  324. package/dist/core/oauth-provider-bridge.js +0 -232
  325. package/dist/core/oauth-provider-bridge.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"model-registry-schemas.d.ts","sourceRoot":"","sources":["../../src/core/model-registry-schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AA2K/D,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAxDxB,iEAAiE;;;;;;;;;;;;QAkBjE,iEAAiE;;;;;;;;;;;;;;EAgDhE,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAe/D,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAnFvB,iEAAiE;;;;;;;;;;;;YAkBjE,iEAAiE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAlBjE,iEAAiE;;;;;;;;;;;;gBAkBjE,iEAAiE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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G,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;YAC3E,OAAO,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,IAAI,gBAAgB,EAAE,CAAC,CAAC,CAAC,gBAAgB,CAAC;QACxE,CAAC;IACF,CAAC;IACD,MAAM,IAAI,GAAG,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACvE,OAAO,IAAI,IAAI,MAAM,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC9C,OAAO,KAAK;SACV,OAAO,CAAC,+BAA+B,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;SACxE,OAAO,CAAC,gCAAgC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC3F,CAAC","sourcesContent":["import { type Static, Type } from \"typebox\";\nimport { Compile } from \"typebox/compile\";\nimport type { TLocalizedValidationError } from \"typebox/error\";\n\nconst PercentileCutoffsSchema = Type.Object({\n\tp50: Type.Optional(Type.Number()),\n\tp75: Type.Optional(Type.Number()),\n\tp90: Type.Optional(Type.Number()),\n\tp99: Type.Optional(Type.Number()),\n});\n\nconst OpenRouterRoutingSchema = Type.Object({\n\tallow_fallbacks: Type.Optional(Type.Boolean()),\n\trequire_parameters: Type.Optional(Type.Boolean()),\n\tdata_collection: Type.Optional(Type.Union([Type.Literal(\"deny\"), Type.Literal(\"allow\")])),\n\tzdr: Type.Optional(Type.Boolean()),\n\tenforce_distillable_text: Type.Optional(Type.Boolean()),\n\torder: Type.Optional(Type.Array(Type.String())),\n\tonly: Type.Optional(Type.Array(Type.String())),\n\tignore: Type.Optional(Type.Array(Type.String())),\n\tquantizations: Type.Optional(Type.Array(Type.String())),\n\tsort: Type.Optional(\n\t\tType.Union([\n\t\t\tType.String(),\n\t\t\tType.Object({\n\t\t\t\tby: Type.Optional(Type.String()),\n\t\t\t\tpartition: Type.Optional(Type.Union([Type.String(), Type.Null()])),\n\t\t\t}),\n\t\t]),\n\t),\n\tmax_price: Type.Optional(\n\t\tType.Object({\n\t\t\tprompt: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t\tcompletion: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t\timage: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t\taudio: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t\trequest: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t}),\n\t),\n\tpreferred_min_throughput: Type.Optional(Type.Union([Type.Number(), PercentileCutoffsSchema])),\n\tpreferred_max_latency: Type.Optional(Type.Union([Type.Number(), PercentileCutoffsSchema])),\n});\n\nconst VercelGatewayRoutingSchema = Type.Object({\n\tonly: Type.Optional(Type.Array(Type.String())),\n\torder: Type.Optional(Type.Array(Type.String())),\n});\n\nconst ThinkingLevelMapValueSchema = Type.Union([Type.String(), Type.Null()]);\nconst ThinkingLevelMapSchema = Type.Object({\n\toff: Type.Optional(ThinkingLevelMapValueSchema),\n\tminimal: Type.Optional(ThinkingLevelMapValueSchema),\n\tlow: Type.Optional(ThinkingLevelMapValueSchema),\n\tmedium: Type.Optional(ThinkingLevelMapValueSchema),\n\thigh: Type.Optional(ThinkingLevelMapValueSchema),\n\txhigh: Type.Optional(ThinkingLevelMapValueSchema),\n\tmax: Type.Optional(ThinkingLevelMapValueSchema),\n});\nconst ChatTemplateKwargScalarSchema = Type.Union([Type.String(), Type.Number(), Type.Boolean(), Type.Null()]);\nconst ChatTemplateKwargVariableSchema = Type.Object({\n\t$var: Type.Union([Type.Literal(\"thinking.enabled\"), Type.Literal(\"thinking.effort\")]),\n\tomitWhenOff: Type.Optional(Type.Boolean()),\n});\nconst ChatTemplateKwargSchema = Type.Union([ChatTemplateKwargScalarSchema, ChatTemplateKwargVariableSchema]);\n\nconst ModelCostRatesSchema = Type.Object({\n\tinput: Type.Number(),\n\toutput: Type.Number(),\n\tcacheRead: Type.Number(),\n\tcacheWrite: Type.Number(),\n});\nconst ModelCostTierSchema = Type.Intersect([\n\tModelCostRatesSchema,\n\tType.Object({ inputTokensAbove: Type.Number() }),\n]);\nconst ModelCostSchema = Type.Intersect([\n\tModelCostRatesSchema,\n\tType.Object({ tiers: Type.Optional(Type.Array(ModelCostTierSchema)) }),\n]);\nconst ModelCostOverrideSchema = Type.Object({\n\tinput: Type.Optional(Type.Number()),\n\toutput: Type.Optional(Type.Number()),\n\tcacheRead: Type.Optional(Type.Number()),\n\tcacheWrite: Type.Optional(Type.Number()),\n\ttiers: Type.Optional(Type.Array(ModelCostTierSchema)),\n});\n\nconst OpenAICompletionsCompatSchema = Type.Object({\n\tsupportsStore: Type.Optional(Type.Boolean()),\n\tsupportsDeveloperRole: Type.Optional(Type.Boolean()),\n\tsupportsReasoningEffort: Type.Optional(Type.Boolean()),\n\tsupportsUsageInStreaming: Type.Optional(Type.Boolean()),\n\tmaxTokensField: Type.Optional(Type.Union([Type.Literal(\"max_completion_tokens\"), Type.Literal(\"max_tokens\")])),\n\trequiresToolResultName: Type.Optional(Type.Boolean()),\n\trequiresAssistantAfterToolResult: Type.Optional(Type.Boolean()),\n\trequiresThinkingAsText: Type.Optional(Type.Boolean()),\n\trequiresReasoningContentOnAssistantMessages: Type.Optional(Type.Boolean()),\n\tthinkingFormat: Type.Optional(\n\t\tType.Union([\n\t\t\tType.Literal(\"openai\"),\n\t\t\tType.Literal(\"openrouter\"),\n\t\t\tType.Literal(\"together\"),\n\t\t\tType.Literal(\"deepseek\"),\n\t\t\tType.Literal(\"zai\"),\n\t\t\tType.Literal(\"qwen\"),\n\t\t\tType.Literal(\"chat-template\"),\n\t\t\tType.Literal(\"qwen-chat-template\"),\n\t\t\tType.Literal(\"string-thinking\"),\n\t\t\tType.Literal(\"ant-ling\"),\n\t\t]),\n\t),\n\tchatTemplateKwargs: Type.Optional(Type.Record(Type.String(), ChatTemplateKwargSchema)),\n\tcacheControlFormat: Type.Optional(Type.Literal(\"anthropic\")),\n\topenRouterRouting: Type.Optional(OpenRouterRoutingSchema),\n\tvercelGatewayRouting: Type.Optional(VercelGatewayRoutingSchema),\n\tsupportsStrictMode: Type.Optional(Type.Boolean()),\n\tsupportsOpenAIGrammarTools: Type.Optional(Type.Boolean()),\n\t/** Atomic compatibility alias for supportsOpenAIGrammarTools. */\n\tsupportsGrammarTools: Type.Optional(Type.Boolean()),\n\tsendSessionAffinityHeaders: Type.Optional(Type.Boolean()),\n\tdeferredToolsMode: Type.Optional(Type.Literal(\"kimi\")),\n\tsessionAffinityFormat: Type.Optional(\n\t\tType.Union([Type.Literal(\"openai\"), Type.Literal(\"openai-nosession\"), Type.Literal(\"openrouter\")]),\n\t),\n\tsupportsLongCacheRetention: Type.Optional(Type.Boolean()),\n});\n\nconst OpenAIResponsesCompatSchema = Type.Object({\n\tsupportsDeveloperRole: Type.Optional(Type.Boolean()),\n\tsessionAffinityFormat: Type.Optional(\n\t\tType.Union([Type.Literal(\"openai\"), Type.Literal(\"openai-nosession\"), Type.Literal(\"openrouter\")]),\n\t),\n\tsupportsLongCacheRetention: Type.Optional(Type.Boolean()),\n\tsupportsStrictMode: Type.Optional(Type.Boolean()),\n\tsupportsOpenAIGrammarTools: Type.Optional(Type.Boolean()),\n\t/** Atomic compatibility alias for supportsOpenAIGrammarTools. */\n\tsupportsGrammarTools: Type.Optional(Type.Boolean()),\n\tsupportsToolSearch: Type.Optional(Type.Boolean()),\n});\n\nconst AnthropicMessagesCompatSchema = Type.Object({\n\tsupportsEagerToolInputStreaming: Type.Optional(Type.Boolean()),\n\tsupportsLongCacheRetention: Type.Optional(Type.Boolean()),\n\tsendSessionAffinityHeaders: Type.Optional(Type.Boolean()),\n\tsupportsCacheControlOnTools: Type.Optional(Type.Boolean()),\n\tsupportsTemperature: Type.Optional(Type.Boolean()),\n\tforceAdaptiveThinking: Type.Optional(Type.Boolean()),\n\tallowEmptySignature: Type.Optional(Type.Boolean()),\n\tsupportsStrictTools: Type.Optional(Type.Boolean()),\n\tsupportsToolReferences: Type.Optional(Type.Boolean()),\n});\n\nconst ProviderCompatSchema = Type.Union([\n\tOpenAICompletionsCompatSchema,\n\tOpenAIResponsesCompatSchema,\n\tAnthropicMessagesCompatSchema,\n]);\n\nconst ModelDefinitionSchema = Type.Object({\n\tid: Type.String({ minLength: 1 }),\n\tname: Type.Optional(Type.String({ minLength: 1 })),\n\tapi: Type.Optional(Type.String({ minLength: 1 })),\n\tbaseUrl: Type.Optional(Type.String({ minLength: 1 })),\n\treasoning: Type.Optional(Type.Boolean()),\n\tthinkingLevelMap: Type.Optional(ThinkingLevelMapSchema),\n\tinput: Type.Optional(Type.Array(Type.Union([Type.Literal(\"text\"), Type.Literal(\"image\")]))),\n\tcost: Type.Optional(ModelCostSchema),\n\tcontextWindow: Type.Optional(Type.Number()),\n\tmaxTokens: Type.Optional(Type.Number()),\n\theaders: Type.Optional(Type.Record(Type.String(), Type.String())),\n\tcompat: Type.Optional(ProviderCompatSchema),\n});\n\nconst ModelOverrideSchema = Type.Object({\n\tname: Type.Optional(Type.String({ minLength: 1 })),\n\treasoning: Type.Optional(Type.Boolean()),\n\tthinkingLevelMap: Type.Optional(ThinkingLevelMapSchema),\n\tinput: Type.Optional(Type.Array(Type.Union([Type.Literal(\"text\"), Type.Literal(\"image\")]))),\n\tcost: Type.Optional(ModelCostOverrideSchema),\n\tcontextWindow: Type.Optional(Type.Number()),\n\tmaxTokens: Type.Optional(Type.Number()),\n\theaders: Type.Optional(Type.Record(Type.String(), Type.String())),\n\tcompat: Type.Optional(ProviderCompatSchema),\n});\n\nexport type ModelOverride = Static<typeof ModelOverrideSchema>;\n\nconst ProviderConfigSchema = Type.Object({\n\tname: Type.Optional(Type.String({ minLength: 1 })),\n\tbaseUrl: Type.Optional(Type.String({ minLength: 1 })),\n\tapiKey: Type.Optional(Type.String({ minLength: 1 })),\n\tapi: Type.Optional(Type.String({ minLength: 1 })),\n\toauth: Type.Optional(Type.Literal(\"radius\")),\n\theaders: Type.Optional(Type.Record(Type.String(), Type.String())),\n\tcompat: Type.Optional(ProviderCompatSchema),\n\tauthHeader: Type.Optional(Type.Boolean()),\n\tmodels: Type.Optional(Type.Array(ModelDefinitionSchema)),\n\tmodelOverrides: Type.Optional(Type.Record(Type.String(), ModelOverrideSchema)),\n});\n\nconst ModelsConfigSchema = Type.Object({\n\tproviders: Type.Record(Type.String(), ProviderConfigSchema),\n});\n\nexport const validateModelsConfig = Compile(ModelsConfigSchema);\n\nexport type ModelsConfig = Static<typeof ModelsConfigSchema>;\n\nexport function formatValidationPath(error: TLocalizedValidationError): string {\n\tif (error.keyword === \"required\") {\n\t\tconst requiredProperties = (error.params as { requiredProperties?: string[] }).requiredProperties;\n\t\tconst requiredProperty = requiredProperties?.[0];\n\t\tif (requiredProperty) {\n\t\t\tconst basePath = error.instancePath.replace(/^\\//, \"\").replace(/\\//g, \".\");\n\t\t\treturn basePath ? `${basePath}.${requiredProperty}` : requiredProperty;\n\t\t}\n\t}\n\tconst path = error.instancePath.replace(/^\\//, \"\").replace(/\\//g, \".\");\n\treturn path || \"root\";\n}\n\nexport function stripJsonComments(input: string): string {\n\treturn input\n\t\t.replace(/\"(?:\\\\.|[^\"\\\\])*\"|\\/\\/[^\\n]*/g, (m) => (m[0] === '\"' ? m : \"\"))\n\t\t.replace(/\"(?:\\\\.|[^\"\\\\])*\"|,(\\s*[}\\]])/g, (m, tail) => tail ?? (m[0] === '\"' ? m : \"\"));\n}\n"]}
@@ -1,91 +0,0 @@
1
- import type { Api, AssistantMessageEventStream, Context, Model, SimpleStreamOptions } from "@earendil-works/pi-ai/compat";
2
- import type { Provider, ProviderHeaders } from "@earendil-works/pi-ai";
3
- import type { LegacyOAuthProvider } from "./oauth-provider-bridge.ts";
4
- import type { RefreshModelsContext } from "@earendil-works/pi-ai";
5
- import type { AuthStorage } from "./auth-storage.ts";
6
- import type { ModelOverride } from "./model-registry-schemas.ts";
7
- import type { ProviderApiKeyAuth } from "./extensions/provider-types.ts";
8
- import type { AtomicProviderCompat } from "./model-capabilities.ts";
9
- export interface ProviderOverride {
10
- baseUrl?: string;
11
- compat?: AtomicProviderCompat;
12
- }
13
- export interface ProviderRequestConfig {
14
- apiKey?: string;
15
- headers?: Record<string, string>;
16
- authHeader?: boolean;
17
- auth?: {
18
- apiKey?: ProviderApiKeyAuth;
19
- };
20
- }
21
- export type ResolvedRequestAuth = {
22
- ok: true;
23
- apiKey?: string;
24
- headers?: ProviderHeaders;
25
- baseUrl?: string;
26
- } | {
27
- ok: false;
28
- error: string;
29
- };
30
- export type ModelRequestHeaderSource = "model" | "modelOverride";
31
- export interface CustomModelsResult {
32
- models: Model<Api>[];
33
- overrides: Map<string, ProviderOverride>;
34
- modelOverrides: Map<string, Map<string, ModelOverride>>;
35
- providerRequestConfigs: Map<string, ProviderRequestConfig>;
36
- modelRequestHeaders: Map<string, Record<string, string>>;
37
- modelRequestHeaderSources: Map<string, ModelRequestHeaderSource>;
38
- configuredProviders: Map<string, Provider>;
39
- error: string | undefined;
40
- }
41
- export interface ModelRegistryLoadResult {
42
- models: Model<Api>[];
43
- modelOverrides: Map<string, Map<string, ModelOverride>>;
44
- providerRequestConfigs: Map<string, ProviderRequestConfig>;
45
- modelRequestHeaders: Map<string, Record<string, string>>;
46
- configuredProviders: Map<string, Provider>;
47
- builtInProviders: Set<string>;
48
- customOpenAICompatibleProviders: Set<string>;
49
- loadError: string | undefined;
50
- }
51
- export interface DynamicProviderApplyInput {
52
- providerName: string;
53
- registrationSource: string;
54
- registerRuntime?: boolean;
55
- config: ProviderConfigInput;
56
- models: Model<Api>[];
57
- modelOverrides: Map<string, Map<string, ModelOverride>>;
58
- authStorage: AuthStorage;
59
- storeProviderRequestConfig: (providerName: string, config: ProviderRequestConfig) => void;
60
- storeModelHeaders: (providerName: string, modelId: string, headers?: Record<string, string>) => void;
61
- }
62
- export type ProviderCompat = AtomicProviderCompat;
63
- export interface ProviderConfigInput {
64
- name?: string;
65
- baseUrl?: string;
66
- apiKey?: string;
67
- api?: Api;
68
- streamSimple?: (model: Model<Api>, context: Context, options?: SimpleStreamOptions) => AssistantMessageEventStream;
69
- headers?: Record<string, string>;
70
- authHeader?: boolean;
71
- refreshModels?(context: RefreshModelsContext): Promise<NonNullable<ProviderConfigInput["models"]>>;
72
- auth?: {
73
- apiKey?: ProviderApiKeyAuth;
74
- };
75
- oauth?: LegacyOAuthProvider;
76
- models?: Array<{
77
- id: string;
78
- name: string;
79
- api?: Api;
80
- baseUrl?: string;
81
- reasoning: boolean;
82
- thinkingLevelMap?: Model<Api>["thinkingLevelMap"];
83
- input: ("text" | "image")[];
84
- cost: Model<Api>["cost"];
85
- contextWindow: number;
86
- maxTokens: number;
87
- headers?: Record<string, string>;
88
- compat?: AtomicProviderCompat;
89
- }>;
90
- }
91
- //# sourceMappingURL=model-registry-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"model-registry-types.d.ts","sourceRoot":"","sources":["../../src/core/model-registry-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,GAAG,EACH,2BAA2B,EAC3B,OAAO,EACP,KAAK,EACL,mBAAmB,EACnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,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AAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACjC,MAAM,CAAC,EAAE,oBAAoB,CAAC;KAC9B,CAAC,CAAC;CACH"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=model-registry-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"model-registry-types.js","sourceRoot":"","sources":["../../src/core/model-registry-types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n\tApi,\n\tAssistantMessageEventStream,\n\tContext,\n\tModel,\n\tSimpleStreamOptions,\n} from \"@earendil-works/pi-ai/compat\";\nimport type { Provider, ProviderHeaders } from \"@earendil-works/pi-ai\";\nimport type { LegacyOAuthProvider } from \"./oauth-provider-bridge.ts\";\nimport type { RefreshModelsContext } from \"@earendil-works/pi-ai\";\nimport type { AuthStorage } from \"./auth-storage.ts\";\nimport type { ModelOverride } from \"./model-registry-schemas.ts\";\nimport type { ProviderApiKeyAuth } from \"./extensions/provider-types.ts\";\nimport type { AtomicProviderCompat } from \"./model-capabilities.ts\";\n\nexport interface ProviderOverride {\n\tbaseUrl?: string;\n\tcompat?: AtomicProviderCompat;\n}\n\nexport interface ProviderRequestConfig {\n\tapiKey?: string;\n\theaders?: Record<string, string>;\n\tauthHeader?: boolean;\n\tauth?: { apiKey?: ProviderApiKeyAuth };\n}\n\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 }\n\t| {\n\t\t\tok: false;\n\t\t\terror: string;\n\t };\n\nexport type ModelRequestHeaderSource = \"model\" | \"modelOverride\";\n\nexport interface CustomModelsResult {\n\tmodels: Model<Api>[];\n\toverrides: Map<string, ProviderOverride>;\n\tmodelOverrides: Map<string, Map<string, ModelOverride>>;\n\tproviderRequestConfigs: Map<string, ProviderRequestConfig>;\n\tmodelRequestHeaders: Map<string, Record<string, string>>;\n\tmodelRequestHeaderSources: Map<string, ModelRequestHeaderSource>;\n\tconfiguredProviders: Map<string, Provider>;\n\terror: string | undefined;\n}\n\nexport interface ModelRegistryLoadResult {\n\tmodels: Model<Api>[];\n\tmodelOverrides: Map<string, Map<string, ModelOverride>>;\n\tproviderRequestConfigs: Map<string, ProviderRequestConfig>;\n\tmodelRequestHeaders: Map<string, Record<string, string>>;\n\tconfiguredProviders: Map<string, Provider>;\n\tbuiltInProviders: Set<string>;\n\tcustomOpenAICompatibleProviders: Set<string>;\n\tloadError: string | undefined;\n}\n\nexport interface DynamicProviderApplyInput {\n\tproviderName: string;\n\tregistrationSource: string;\n\tregisterRuntime?: boolean;\n\tconfig: ProviderConfigInput;\n\tmodels: Model<Api>[];\n\tmodelOverrides: Map<string, Map<string, ModelOverride>>;\n\tauthStorage: AuthStorage;\n\tstoreProviderRequestConfig: (providerName: string, config: ProviderRequestConfig) => void;\n\tstoreModelHeaders: (providerName: string, modelId: string, headers?: Record<string, string>) => void;\n}\n\nexport type ProviderCompat = AtomicProviderCompat;\n\nexport interface ProviderConfigInput {\n\tname?: string;\n\tbaseUrl?: string;\n\tapiKey?: string;\n\tapi?: Api;\n\tstreamSimple?: (model: Model<Api>, context: Context, options?: SimpleStreamOptions) => AssistantMessageEventStream;\n\theaders?: Record<string, string>;\n\tauthHeader?: boolean;\n\trefreshModels?(context: RefreshModelsContext): Promise<NonNullable<ProviderConfigInput[\"models\"]>>;\n\tauth?: { apiKey?: ProviderApiKeyAuth };\n\toauth?: LegacyOAuthProvider;\n\tmodels?: Array<{\n\t\tid: string;\n\t\tname: string;\n\t\tapi?: Api;\n\t\tbaseUrl?: string;\n\t\treasoning: boolean;\n\t\tthinkingLevelMap?: Model<Api>[\"thinkingLevelMap\"];\n\t\tinput: (\"text\" | \"image\")[];\n\t\tcost: Model<Api>[\"cost\"];\n\t\tcontextWindow: number;\n\t\tmaxTokens: number;\n\t\theaders?: Record<string, string>;\n\t\tcompat?: AtomicProviderCompat;\n\t}>;\n}\n"]}
@@ -1,7 +0,0 @@
1
- /** Shared value validation for custom/dynamic model-registry definitions. */
2
- /**
3
- * Validate a model `contextWindow` token count. Returns an error string when the
4
- * value is not a positive integer, or `undefined` when it is valid.
5
- */
6
- export declare function validateContextWindowValue(value: number): string | undefined;
7
- //# sourceMappingURL=model-registry-validation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"model-registry-validation.d.ts","sourceRoot":"","sources":["../../src/core/model-registry-validation.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAM7E;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE5E"}
@@ -1,12 +0,0 @@
1
- /** Shared value validation for custom/dynamic model-registry definitions. */
2
- function isPositiveInteger(value) {
3
- return Number.isFinite(value) && Number.isInteger(value) && value > 0;
4
- }
5
- /**
6
- * Validate a model `contextWindow` token count. Returns an error string when the
7
- * value is not a positive integer, or `undefined` when it is valid.
8
- */
9
- export function validateContextWindowValue(value) {
10
- return isPositiveInteger(value) ? undefined : "Context window must be a positive integer token count";
11
- }
12
- //# sourceMappingURL=model-registry-validation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"model-registry-validation.js","sourceRoot":"","sources":["../../src/core/model-registry-validation.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAE7E,SAAS,iBAAiB,CAAC,KAAa;IACvC,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC;AACvE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CAAC,KAAa;IACvD,OAAO,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,uDAAuD,CAAC;AACvG,CAAC","sourcesContent":["/** Shared value validation for custom/dynamic model-registry definitions. */\n\nfunction isPositiveInteger(value: number): boolean {\n\treturn Number.isFinite(value) && Number.isInteger(value) && value > 0;\n}\n\n/**\n * Validate a model `contextWindow` token count. Returns an error string when the\n * value is not a positive integer, or `undefined` when it is valid.\n */\nexport function validateContextWindowValue(value: number): string | undefined {\n\treturn isPositiveInteger(value) ? undefined : \"Context window must be a positive integer token count\";\n}\n"]}
@@ -1,17 +0,0 @@
1
- import type { OAuthCredentials } from "@earendil-works/pi-ai/oauth";
2
- import type { LegacyOAuthProvider, OAuthProviderDescriptor } from "./oauth-provider-bridge.ts";
3
- export type { OAuthAuthInfo, OAuthCredentials, OAuthDeviceCodeInfo, OAuthLoginCallbacks, OAuthPrompt, OAuthSelectOption, OAuthSelectPrompt, } from "@earendil-works/pi-ai/oauth";
4
- export { getOAuthApiKey, getOAuthProvider, getOAuthProviders, registerOAuthProvider, resetOAuthProviders, } from "./oauth-provider-bridge.ts";
5
- declare module "@earendil-works/pi-ai/oauth" {
6
- function getOAuthApiKey(providerId: string, credentials: Record<string, OAuthCredentials>): Promise<{
7
- newCredentials: OAuthCredentials;
8
- apiKey: string;
9
- } | null>;
10
- function getOAuthProvider(providerId: string): OAuthProviderDescriptor | undefined;
11
- function getOAuthProviders(): OAuthProviderDescriptor[];
12
- function registerOAuthProvider(provider: LegacyOAuthProvider & {
13
- id: string;
14
- }): void;
15
- function resetOAuthProviders(): void;
16
- }
17
- //# sourceMappingURL=oauth-compat.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"oauth-compat.d.ts","sourceRoot":"","sources":["../../src/core/oauth-compat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAE/F,YAAY,EACX,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,WAAW,EACX,iBAAiB,EACjB,iBAAiB,GACjB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,GACnB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,QAAQ,6BAA6B,CAAC;IAC5C,SAAgB,cAAc,CAC7B,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,GAC3C,OAAO,CAAC;QAAE,cAAc,EAAE,gBAAgB,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;IACxE,SAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,uBAAuB,GAAG,SAAS,CAAC;IAC1F,SAAgB,iBAAiB,IAAI,uBAAuB,EAAE,CAAC;IAC/D,SAAgB,qBAAqB,CAAC,QAAQ,EAAE,mBAAmB,GAAG;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC5F,SAAgB,mBAAmB,IAAI,IAAI,CAAC;CAC5C"}
@@ -1,2 +0,0 @@
1
- export { getOAuthApiKey, getOAuthProvider, getOAuthProviders, registerOAuthProvider, resetOAuthProviders, } from "./oauth-provider-bridge.js";
2
- //# sourceMappingURL=oauth-compat.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"oauth-compat.js","sourceRoot":"","sources":["../../src/core/oauth-compat.ts"],"names":[],"mappings":"AAYA,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,GACnB,MAAM,4BAA4B,CAAC","sourcesContent":["import type { OAuthCredentials } from \"@earendil-works/pi-ai/oauth\";\nimport type { LegacyOAuthProvider, OAuthProviderDescriptor } from \"./oauth-provider-bridge.ts\";\n\nexport type {\n\tOAuthAuthInfo,\n\tOAuthCredentials,\n\tOAuthDeviceCodeInfo,\n\tOAuthLoginCallbacks,\n\tOAuthPrompt,\n\tOAuthSelectOption,\n\tOAuthSelectPrompt,\n} from \"@earendil-works/pi-ai/oauth\";\nexport {\n\tgetOAuthApiKey,\n\tgetOAuthProvider,\n\tgetOAuthProviders,\n\tregisterOAuthProvider,\n\tresetOAuthProviders,\n} from \"./oauth-provider-bridge.ts\";\n\ndeclare module \"@earendil-works/pi-ai/oauth\" {\n\texport function getOAuthApiKey(\n\t\tproviderId: string,\n\t\tcredentials: Record<string, OAuthCredentials>,\n\t): Promise<{ newCredentials: OAuthCredentials; apiKey: string } | null>;\n\texport function getOAuthProvider(providerId: string): OAuthProviderDescriptor | undefined;\n\texport function getOAuthProviders(): OAuthProviderDescriptor[];\n\texport function registerOAuthProvider(provider: LegacyOAuthProvider & { id: string }): void;\n\texport function resetOAuthProviders(): void;\n}\n"]}
@@ -1,63 +0,0 @@
1
- import { type AuthInfoLink, type AuthInteraction, type ModelAuth, type OAuthCredential, type OAuthCredentials, type OAuthLoginCallbacks } from "@earendil-works/pi-ai";
2
- import type { Api, Model } from "@earendil-works/pi-ai/compat";
3
- export interface LegacyOAuthProvider {
4
- name: string;
5
- loginLabel?: string;
6
- usesCallbackServer?: boolean;
7
- login(callbacks: OAuthLoginCallbacks): Promise<OAuthCredentials>;
8
- refreshToken(credentials: OAuthCredentials): Promise<OAuthCredentials>;
9
- getApiKey(credentials: OAuthCredentials): string;
10
- modifyModels?(models: Model<Api>[], credentials: OAuthCredentials): Model<Api>[];
11
- }
12
- export interface OAuthProviderDescriptor extends LegacyOAuthProvider {
13
- id: string;
14
- loginLabel?: string;
15
- }
16
- /** JSON-safe OAuth metadata transported across isolated-engine boundaries. */
17
- export interface OAuthProviderMetadata {
18
- id: string;
19
- name: string;
20
- loginLabel?: string;
21
- usesCallbackServer?: boolean;
22
- }
23
- export interface AtomicOAuthLoginCallbacks extends OAuthLoginCallbacks {
24
- onManualCodeCancel?(): void;
25
- onInfo?(message: string, links: readonly AuthInfoLink[]): void;
26
- }
27
- /** Marks failures after credential acquisition so presentation never mistakes nested AbortErrors for cancellation. */
28
- export declare class OAuthLoginTransactionError extends Error {
29
- constructor(cause: unknown);
30
- }
31
- /** Cycle-safe classification shared by direct, provider-owned, and isolated OAuth. */
32
- export declare function isOAuthLoginCancelled(error: unknown, signal?: AbortSignal, options?: {
33
- includeActiveSignal?: boolean;
34
- }): boolean;
35
- /** Canonicalize only intentional cancellation while retaining the provider error as cause. */
36
- export declare function normalizeOAuthLoginError(error: unknown, signal?: AbortSignal, options?: {
37
- includeActiveSignal?: boolean;
38
- }): unknown;
39
- export declare function createAuthInteraction(callbacks: AtomicOAuthLoginCallbacks): AuthInteraction;
40
- export declare function registerLegacyOAuthProvider(providerId: string, provider: LegacyOAuthProvider, sourceId?: string): void;
41
- /** Legacy registry aliases retained for Atomic's extension/test compatibility. */
42
- export declare function registerOAuthProvider(provider: LegacyOAuthProvider & {
43
- id: string;
44
- }): void;
45
- export declare function getOAuthProvider(providerId: string): OAuthProviderDescriptor | undefined;
46
- export declare function resetLegacyOAuthProviders(): void;
47
- export declare function unregisterLegacyOAuthProviders(sourceId: string): void;
48
- export declare function getLegacyOAuthProvider(providerId: string): LegacyOAuthProvider | undefined;
49
- export declare function getOAuthProviders(): OAuthProviderDescriptor[];
50
- export declare const resetOAuthProviders: typeof resetLegacyOAuthProviders;
51
- export declare function getOAuthProviderDescriptors(): OAuthProviderDescriptor[];
52
- export declare function getOAuthProviderMetadata(): OAuthProviderMetadata[];
53
- export declare function loginOAuthProvider(providerId: string, callbacks: AtomicOAuthLoginCallbacks): Promise<OAuthCredential>;
54
- export declare function refreshOAuthProvider(providerId: string, credential: OAuthCredential): Promise<{
55
- credential: OAuthCredential;
56
- auth: ModelAuth;
57
- } | undefined>;
58
- export declare function oauthCredentialToAuth(providerId: string, credential: OAuthCredential): Promise<ModelAuth | undefined>;
59
- export declare function getOAuthApiKey(providerId: string, credentials: Record<string, OAuthCredentials>): Promise<{
60
- newCredentials: OAuthCredentials;
61
- apiKey: string;
62
- } | null>;
63
- //# sourceMappingURL=oauth-provider-bridge.d.ts.map
@@ -1 +0,0 @@
1
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AAqB,EAAE,CAOlE;AAED,wBAAsB,kBAAkB,CACvC,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,yBAAyB,GAClC,OAAO,CAAC,eAAe,CAAC,CAkB1B;AAED,wBAAsB,oBAAoB,CACzC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,eAAe,GACzB,OAAO,CAAC;IAAE,UAAU,EAAE,eAAe,CAAC;IAAC,IAAI,EAAE,SAAS,CAAA;CAAE,GAAG,SAAS,CAAC,CAWvE;AAED,wBAAsB,qBAAqB,CAC1C,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,eAAe,GACzB,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAIhC;AAED,wBAAsB,cAAc,CACnC,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,GAC3C,OAAO,CAAC;IAAE,cAAc,EAAE,gBAAgB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CAmBtE"}
@@ -1,232 +0,0 @@
1
- import { builtinProviders } from "@earendil-works/pi-ai/providers/all";
2
- const GLOBAL_LEGACY_SOURCE = "atomic:legacy-global";
3
- const legacyProviders = new Map();
4
- const CALLBACK_SERVER_PROVIDERS = new Set(["anthropic", "openai-codex"]);
5
- /** Marks failures after credential acquisition so presentation never mistakes nested AbortErrors for cancellation. */
6
- export class OAuthLoginTransactionError extends Error {
7
- constructor(cause) {
8
- super(cause instanceof Error ? cause.message : String(cause), { cause });
9
- this.name = "OAuthLoginTransactionError";
10
- }
11
- }
12
- /** Cycle-safe classification shared by direct, provider-owned, and isolated OAuth. */
13
- export function isOAuthLoginCancelled(error, signal, options = {}) {
14
- if (error instanceof OAuthLoginTransactionError)
15
- return false;
16
- if (options.includeActiveSignal !== false && signal?.aborted)
17
- return true;
18
- const reason = signal?.reason;
19
- const seen = new Set();
20
- let current = error;
21
- while (current !== undefined && current !== null) {
22
- if (current === reason && reason !== undefined)
23
- return true;
24
- if (current === "Login cancelled")
25
- return true;
26
- if (typeof current !== "object")
27
- return false;
28
- if (seen.has(current))
29
- return false;
30
- seen.add(current);
31
- const candidate = current;
32
- if (candidate.name === "AbortError" || candidate.message === "Login cancelled")
33
- return true;
34
- current = candidate.cause;
35
- }
36
- return false;
37
- }
38
- /** Canonicalize only intentional cancellation while retaining the provider error as cause. */
39
- export function normalizeOAuthLoginError(error, signal, options) {
40
- if (error instanceof Error && error.message === "Login cancelled" && error.cause !== undefined)
41
- return error;
42
- if (!isOAuthLoginCancelled(error, signal, options))
43
- return error;
44
- return new Error("Login cancelled", { cause: error });
45
- }
46
- function abortable(promise, signal, onAbort) {
47
- if (!signal)
48
- return promise;
49
- if (signal.aborted) {
50
- onAbort?.();
51
- return Promise.reject(signal.reason ?? new Error("Authentication prompt cancelled"));
52
- }
53
- return new Promise((resolve, reject) => {
54
- const abort = () => {
55
- onAbort?.();
56
- reject(signal.reason ?? new Error("Authentication prompt cancelled"));
57
- };
58
- signal.addEventListener("abort", abort, { once: true });
59
- promise.then(resolve, reject).finally(() => signal.removeEventListener("abort", abort));
60
- });
61
- }
62
- function builtinOAuth(providerId) {
63
- return builtinProviders().find((provider) => provider.id === providerId)?.auth.oauth;
64
- }
65
- export function createAuthInteraction(callbacks) {
66
- return {
67
- signal: callbacks.signal,
68
- prompt: async (prompt) => {
69
- switch (prompt.type) {
70
- case "select":
71
- return ((await callbacks.onSelect({
72
- message: prompt.message,
73
- options: prompt.options.map(({ id, label }) => ({ id, label })),
74
- })) ?? "");
75
- case "manual_code":
76
- return abortable(callbacks.onManualCodeInput
77
- ? callbacks.onManualCodeInput()
78
- : callbacks.onPrompt({ message: prompt.message, placeholder: prompt.placeholder }), prompt.signal, callbacks.onManualCodeCancel);
79
- default:
80
- return callbacks.onPrompt({ message: prompt.message, placeholder: prompt.placeholder });
81
- }
82
- },
83
- notify: (event) => {
84
- switch (event.type) {
85
- case "auth_url":
86
- callbacks.onAuth({ url: event.url, instructions: event.instructions });
87
- break;
88
- case "device_code":
89
- callbacks.onDeviceCode(event);
90
- break;
91
- case "progress":
92
- callbacks.onProgress?.(event.message);
93
- break;
94
- case "info":
95
- callbacks.onInfo?.(event.message, event.links ?? []);
96
- break;
97
- }
98
- },
99
- };
100
- }
101
- function latestLegacyProvider(providerId) {
102
- const providers = legacyProviders.get(providerId);
103
- return providers ? [...providers.values()].at(-1) : undefined;
104
- }
105
- export function registerLegacyOAuthProvider(providerId, provider, sourceId = GLOBAL_LEGACY_SOURCE) {
106
- const providers = legacyProviders.get(providerId) ?? new Map();
107
- providers.delete(sourceId);
108
- providers.set(sourceId, provider);
109
- legacyProviders.set(providerId, providers);
110
- }
111
- /** Legacy registry aliases retained for Atomic's extension/test compatibility. */
112
- export function registerOAuthProvider(provider) {
113
- registerLegacyOAuthProvider(provider.id, provider);
114
- }
115
- export function getOAuthProvider(providerId) {
116
- const provider = latestLegacyProvider(providerId);
117
- return provider ? { id: providerId, ...provider } : getOAuthProviderDescriptors().find((entry) => entry.id === providerId);
118
- }
119
- export function resetLegacyOAuthProviders() {
120
- legacyProviders.clear();
121
- }
122
- export function unregisterLegacyOAuthProviders(sourceId) {
123
- for (const [providerId, providers] of legacyProviders) {
124
- providers.delete(sourceId);
125
- if (providers.size === 0)
126
- legacyProviders.delete(providerId);
127
- }
128
- }
129
- export function getLegacyOAuthProvider(providerId) {
130
- return latestLegacyProvider(providerId);
131
- }
132
- export function getOAuthProviders() {
133
- return getOAuthProviderDescriptors();
134
- }
135
- export const resetOAuthProviders = resetLegacyOAuthProviders;
136
- export function getOAuthProviderDescriptors() {
137
- const descriptors = new Map();
138
- for (const provider of builtinProviders()) {
139
- const oauth = provider.auth.oauth;
140
- if (!oauth)
141
- continue;
142
- descriptors.set(provider.id, {
143
- id: provider.id,
144
- name: oauth.name,
145
- loginLabel: oauth.loginLabel,
146
- usesCallbackServer: CALLBACK_SERVER_PROVIDERS.has(provider.id),
147
- login: async (callbacks) => oauth.login(createAuthInteraction(callbacks)),
148
- refreshToken: async (credentials) => oauth.refresh({ ...credentials, type: "oauth" }),
149
- getApiKey: (credentials) => credentials.access,
150
- });
151
- }
152
- for (const [id, providers] of legacyProviders) {
153
- const provider = [...providers.values()].at(-1);
154
- if (provider)
155
- descriptors.set(id, { id, ...provider });
156
- }
157
- return [...descriptors.values()];
158
- }
159
- export function getOAuthProviderMetadata() {
160
- return getOAuthProviderDescriptors().map(({ id, name, loginLabel, usesCallbackServer }) => ({
161
- id,
162
- name,
163
- ...(loginLabel === undefined ? {} : { loginLabel }),
164
- ...(usesCallbackServer === undefined ? {} : { usesCallbackServer }),
165
- }));
166
- }
167
- export async function loginOAuthProvider(providerId, callbacks) {
168
- const legacy = latestLegacyProvider(providerId);
169
- const oauth = legacy ? undefined : builtinOAuth(providerId);
170
- if (!legacy && !oauth)
171
- throw new Error(`Unknown OAuth provider: ${providerId}`);
172
- if (callbacks.signal?.aborted) {
173
- throw normalizeOAuthLoginError(callbacks.signal.reason, callbacks.signal);
174
- }
175
- try {
176
- const credential = legacy
177
- ? { type: "oauth", ...(await legacy.login(callbacks)) }
178
- : await oauth.login(createAuthInteraction(callbacks));
179
- if (callbacks.signal?.aborted) {
180
- throw normalizeOAuthLoginError(callbacks.signal.reason, callbacks.signal);
181
- }
182
- return credential;
183
- }
184
- catch (error) {
185
- throw normalizeOAuthLoginError(error, callbacks.signal);
186
- }
187
- }
188
- export async function refreshOAuthProvider(providerId, credential) {
189
- const legacy = latestLegacyProvider(providerId);
190
- if (legacy) {
191
- const { type: _type, ...credentials } = credential;
192
- const refreshed = { type: "oauth", ...(await legacy.refreshToken(credentials)) };
193
- return { credential: refreshed, auth: { apiKey: legacy.getApiKey(refreshed) } };
194
- }
195
- const oauth = builtinOAuth(providerId);
196
- if (!oauth)
197
- return undefined;
198
- const refreshed = await oauth.refresh(credential);
199
- return { credential: refreshed, auth: await oauth.toAuth(refreshed) };
200
- }
201
- export async function oauthCredentialToAuth(providerId, credential) {
202
- const legacy = latestLegacyProvider(providerId);
203
- if (legacy)
204
- return { apiKey: legacy.getApiKey(credential) };
205
- return builtinOAuth(providerId)?.toAuth(credential);
206
- }
207
- export async function getOAuthApiKey(providerId, credentials) {
208
- if (!getOAuthProvider(providerId))
209
- throw new Error(`Unknown OAuth provider: ${providerId}`);
210
- const selected = credentials[providerId];
211
- if (!selected)
212
- return null;
213
- const credential = { type: "oauth", ...selected };
214
- let resolved;
215
- if (Date.now() >= credential.expires) {
216
- try {
217
- resolved = await refreshOAuthProvider(providerId, credential);
218
- }
219
- catch (cause) {
220
- throw new Error(`Failed to refresh OAuth token for ${providerId}`, { cause });
221
- }
222
- }
223
- else {
224
- resolved = { credential, auth: await oauthCredentialToAuth(providerId, credential) };
225
- }
226
- const apiKey = resolved?.auth?.apiKey;
227
- if (!resolved || !apiKey)
228
- return null;
229
- const { type: _type, ...newCredentials } = resolved.credential;
230
- return { newCredentials, apiKey };
231
- }
232
- //# sourceMappingURL=oauth-provider-bridge.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"oauth-provider-bridge.js","sourceRoot":"","sources":["../../src/core/oauth-provider-bridge.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AA+BvE,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;AACpD,MAAM,eAAe,GAAG,IAAI,GAAG,EAA4C,CAAC;AAC5E,MAAM,yBAAyB,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC,CAAC;AACzE,sHAAsH;AACtH,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IACpD,YAAY,KAAc;QACzB,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QACzE,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAC;IAC1C,CAAC;CACD;AAED,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UAAU,EAAE,UAAU,CAAC,CAAC;QAC/D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,qCAAqC,UAAU,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAC/E,CAAC;IACF,CAAC;SAAM,CAAC;QACP,QAAQ,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC,UAAU,EAAE,UAAU,CAAC,EAAE,CAAC;IACtF,CAAC;IACD,MAAM,MAAM,GAAG,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC;IACtC,IAAI,CAAC,QAAQ,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACtC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,cAAc,EAAE,GAAG,QAAQ,CAAC,UAAU,CAAC;IAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC;AACnC,CAAC","sourcesContent":["import {\n\ttype AuthInfoLink,\n\ttype AuthInteraction,\n\ttype ModelAuth,\n\ttype OAuthAuth,\n\ttype OAuthCredential,\n\ttype OAuthCredentials,\n\ttype OAuthLoginCallbacks,\n} from \"@earendil-works/pi-ai\";\nimport { builtinProviders } from \"@earendil-works/pi-ai/providers/all\";\nimport type { Api, Model } from \"@earendil-works/pi-ai/compat\";\n\nexport interface LegacyOAuthProvider {\n\tname: string;\n\tloginLabel?: string;\n\tusesCallbackServer?: boolean;\n\tlogin(callbacks: OAuthLoginCallbacks): Promise<OAuthCredentials>;\n\trefreshToken(credentials: OAuthCredentials): Promise<OAuthCredentials>;\n\tgetApiKey(credentials: OAuthCredentials): string;\n\tmodifyModels?(models: Model<Api>[], credentials: OAuthCredentials): Model<Api>[];\n}\n\nexport interface OAuthProviderDescriptor extends LegacyOAuthProvider {\n\tid: string;\n\tloginLabel?: string;\n}\n\n\n/** JSON-safe OAuth metadata transported across isolated-engine boundaries. */\nexport interface OAuthProviderMetadata {\n\tid: string;\n\tname: string;\n\tloginLabel?: string;\n\tusesCallbackServer?: boolean;\n}\nexport interface AtomicOAuthLoginCallbacks extends OAuthLoginCallbacks {\n\tonManualCodeCancel?(): void;\n\tonInfo?(message: string, links: readonly AuthInfoLink[]): void;\n}\n\nconst GLOBAL_LEGACY_SOURCE = \"atomic:legacy-global\";\nconst legacyProviders = new Map<string, Map<string, LegacyOAuthProvider>>();\nconst CALLBACK_SERVER_PROVIDERS = new Set([\"anthropic\", \"openai-codex\"]);\n/** Marks failures after credential acquisition so presentation never mistakes nested AbortErrors for cancellation. */\nexport class OAuthLoginTransactionError extends Error {\n\tconstructor(cause: unknown) {\n\t\tsuper(cause instanceof Error ? cause.message : String(cause), { cause });\n\t\tthis.name = \"OAuthLoginTransactionError\";\n\t}\n}\n\n/** Cycle-safe classification shared by direct, provider-owned, and isolated OAuth. */\nexport function isOAuthLoginCancelled(\n\terror: unknown,\n\tsignal?: AbortSignal,\n\toptions: { includeActiveSignal?: boolean } = {},\n): boolean {\n\tif (error instanceof OAuthLoginTransactionError) return false;\n\tif (options.includeActiveSignal !== false && signal?.aborted) return true;\n\tconst reason = signal?.reason;\n\tconst seen = new Set<object>();\n\tlet current: unknown = error;\n\twhile (current !== undefined && current !== null) {\n\t\tif (current === reason && reason !== undefined) return true;\n\t\tif (current === \"Login cancelled\") return true;\n\t\tif (typeof current !== \"object\") return false;\n\t\tif (seen.has(current)) return false;\n\t\tseen.add(current);\n\t\tconst candidate = current as { name?: unknown; message?: unknown; cause?: unknown };\n\t\tif (candidate.name === \"AbortError\" || candidate.message === \"Login cancelled\") return true;\n\t\tcurrent = candidate.cause;\n\t}\n\treturn false;\n}\n\n/** Canonicalize only intentional cancellation while retaining the provider error as cause. */\nexport function normalizeOAuthLoginError(\n\terror: unknown,\n\tsignal?: AbortSignal,\n\toptions?: { includeActiveSignal?: boolean },\n): unknown {\n\tif (error instanceof Error && error.message === \"Login cancelled\" && error.cause !== undefined) return error;\n\tif (!isOAuthLoginCancelled(error, signal, options)) return error;\n\treturn new Error(\"Login cancelled\", { cause: error });\n}\n\nfunction abortable<T>(promise: Promise<T>, signal: AbortSignal | undefined, onAbort?: () => void): Promise<T> {\n\tif (!signal) return promise;\n\tif (signal.aborted) {\n\t\tonAbort?.();\n\t\treturn Promise.reject(signal.reason ?? new Error(\"Authentication prompt cancelled\"));\n\t}\n\treturn new Promise<T>((resolve, reject) => {\n\t\tconst abort = () => {\n\t\t\tonAbort?.();\n\t\t\treject(signal.reason ?? new Error(\"Authentication prompt cancelled\"));\n\t\t};\n\t\tsignal.addEventListener(\"abort\", abort, { once: true });\n\t\tpromise.then(resolve, reject).finally(() => signal.removeEventListener(\"abort\", abort));\n\t});\n}\nfunction builtinOAuth(providerId: string): OAuthAuth | undefined {\n\treturn builtinProviders().find((provider) => provider.id === providerId)?.auth.oauth;\n}\n\nexport function createAuthInteraction(callbacks: AtomicOAuthLoginCallbacks): AuthInteraction {\n\treturn {\n\t\tsignal: callbacks.signal,\n\t\tprompt: async (prompt) => {\n\t\t\tswitch (prompt.type) {\n\t\t\t\tcase \"select\":\n\t\t\t\t\treturn (\n\t\t\t\t\t\t(await callbacks.onSelect({\n\t\t\t\t\t\t\tmessage: prompt.message,\n\t\t\t\t\t\t\toptions: prompt.options.map(({ id, label }) => ({ id, label })),\n\t\t\t\t\t\t})) ?? \"\"\n\t\t\t\t\t);\n\t\t\t\tcase \"manual_code\":\n\t\t\t\t\treturn abortable(\n\t\t\t\t\t\tcallbacks.onManualCodeInput\n\t\t\t\t\t\t\t? callbacks.onManualCodeInput()\n\t\t\t\t\t\t\t: callbacks.onPrompt({ message: prompt.message, placeholder: prompt.placeholder }),\n\t\t\t\t\t\tprompt.signal,\n\t\t\t\t\t\tcallbacks.onManualCodeCancel,\n\t\t\t\t\t);\n\t\t\t\tdefault:\n\t\t\t\t\treturn callbacks.onPrompt({ message: prompt.message, placeholder: prompt.placeholder });\n\t\t\t}\n\t\t},\n\t\tnotify: (event) => {\n\t\t\tswitch (event.type) {\n\t\t\t\tcase \"auth_url\":\n\t\t\t\t\tcallbacks.onAuth({ url: event.url, instructions: event.instructions });\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"device_code\":\n\t\t\t\t\tcallbacks.onDeviceCode(event);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"progress\":\n\t\t\t\t\tcallbacks.onProgress?.(event.message);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"info\":\n\t\t\t\t\tcallbacks.onInfo?.(event.message, event.links ?? []);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t},\n\t};\n}\n\nfunction latestLegacyProvider(providerId: string): LegacyOAuthProvider | undefined {\n\tconst providers = legacyProviders.get(providerId);\n\treturn providers ? [...providers.values()].at(-1) : undefined;\n}\n\nexport function registerLegacyOAuthProvider(\n\tproviderId: string,\n\tprovider: LegacyOAuthProvider,\n\tsourceId: string = GLOBAL_LEGACY_SOURCE,\n): void {\n\tconst providers = legacyProviders.get(providerId) ?? new Map<string, LegacyOAuthProvider>();\n\tproviders.delete(sourceId);\n\tproviders.set(sourceId, provider);\n\tlegacyProviders.set(providerId, providers);\n}\n/** Legacy registry aliases retained for Atomic's extension/test compatibility. */\nexport function registerOAuthProvider(provider: LegacyOAuthProvider & { id: string }): void {\n\tregisterLegacyOAuthProvider(provider.id, provider);\n}\n\nexport function getOAuthProvider(providerId: string): OAuthProviderDescriptor | undefined {\n\tconst provider = latestLegacyProvider(providerId);\n\treturn provider ? { id: providerId, ...provider } : getOAuthProviderDescriptors().find((entry) => entry.id === providerId);\n}\n\nexport function resetLegacyOAuthProviders(): void {\n\tlegacyProviders.clear();\n}\n\nexport function unregisterLegacyOAuthProviders(sourceId: string): void {\n\tfor (const [providerId, providers] of legacyProviders) {\n\t\tproviders.delete(sourceId);\n\t\tif (providers.size === 0) legacyProviders.delete(providerId);\n\t}\n}\n\nexport function getLegacyOAuthProvider(providerId: string): LegacyOAuthProvider | undefined {\n\treturn latestLegacyProvider(providerId);\n}\n\nexport function getOAuthProviders(): OAuthProviderDescriptor[] {\n\treturn getOAuthProviderDescriptors();\n}\n\nexport const resetOAuthProviders = resetLegacyOAuthProviders;\nexport function getOAuthProviderDescriptors(): OAuthProviderDescriptor[] {\n\tconst descriptors = new Map<string, OAuthProviderDescriptor>();\n\tfor (const provider of builtinProviders()) {\n\t\tconst oauth = provider.auth.oauth;\n\t\tif (!oauth) continue;\n\t\tdescriptors.set(provider.id, {\n\t\t\tid: provider.id,\n\t\t\tname: oauth.name,\n\t\t\tloginLabel: oauth.loginLabel,\n\t\t\tusesCallbackServer: CALLBACK_SERVER_PROVIDERS.has(provider.id),\n\t\t\tlogin: async (callbacks) => oauth.login(createAuthInteraction(callbacks)),\n\t\t\trefreshToken: async (credentials) => oauth.refresh({ ...credentials, type: \"oauth\" }),\n\t\t\tgetApiKey: (credentials) => credentials.access,\n\t\t});\n\t}\n\tfor (const [id, providers] of legacyProviders) {\n\t\tconst provider = [...providers.values()].at(-1);\n\t\tif (provider) descriptors.set(id, { id, ...provider });\n\t}\n\treturn [...descriptors.values()];\n}\n\nexport function getOAuthProviderMetadata(): OAuthProviderMetadata[] {\n\treturn getOAuthProviderDescriptors().map(({ id, name, loginLabel, usesCallbackServer }) => ({\n\t\tid,\n\t\tname,\n\t\t...(loginLabel === undefined ? {} : { loginLabel }),\n\t\t...(usesCallbackServer === undefined ? {} : { usesCallbackServer }),\n\t}));\n}\n\nexport async function loginOAuthProvider(\n\tproviderId: string,\n\tcallbacks: AtomicOAuthLoginCallbacks,\n): Promise<OAuthCredential> {\n\tconst legacy = latestLegacyProvider(providerId);\n\tconst oauth = legacy ? undefined : builtinOAuth(providerId);\n\tif (!legacy && !oauth) throw new Error(`Unknown OAuth provider: ${providerId}`);\n\tif (callbacks.signal?.aborted) {\n\t\tthrow normalizeOAuthLoginError(callbacks.signal.reason, callbacks.signal);\n\t}\n\ttry {\n\t\tconst credential = legacy\n\t\t\t? { type: \"oauth\" as const, ...(await legacy.login(callbacks)) }\n\t\t\t: await oauth!.login(createAuthInteraction(callbacks));\n\t\tif (callbacks.signal?.aborted) {\n\t\t\tthrow normalizeOAuthLoginError(callbacks.signal.reason, callbacks.signal);\n\t\t}\n\t\treturn credential;\n\t} catch (error) {\n\t\tthrow normalizeOAuthLoginError(error, callbacks.signal);\n\t}\n}\n\nexport async function refreshOAuthProvider(\n\tproviderId: string,\n\tcredential: OAuthCredential,\n): Promise<{ credential: OAuthCredential; auth: ModelAuth } | undefined> {\n\tconst legacy = latestLegacyProvider(providerId);\n\tif (legacy) {\n\t\tconst { type: _type, ...credentials } = credential;\n\t\tconst refreshed = { type: \"oauth\" as const, ...(await legacy.refreshToken(credentials)) };\n\t\treturn { credential: refreshed, auth: { apiKey: legacy.getApiKey(refreshed) } };\n\t}\n\tconst oauth = builtinOAuth(providerId);\n\tif (!oauth) return undefined;\n\tconst refreshed = await oauth.refresh(credential);\n\treturn { credential: refreshed, auth: await oauth.toAuth(refreshed) };\n}\n\nexport async function oauthCredentialToAuth(\n\tproviderId: string,\n\tcredential: OAuthCredential,\n): Promise<ModelAuth | undefined> {\n\tconst legacy = latestLegacyProvider(providerId);\n\tif (legacy) return { apiKey: legacy.getApiKey(credential) };\n\treturn builtinOAuth(providerId)?.toAuth(credential);\n}\n\nexport async function getOAuthApiKey(\n\tproviderId: string,\n\tcredentials: Record<string, OAuthCredentials>,\n): Promise<{ newCredentials: OAuthCredentials; apiKey: string } | null> {\n\tif (!getOAuthProvider(providerId)) throw new Error(`Unknown OAuth provider: ${providerId}`);\n\tconst selected = credentials[providerId];\n\tif (!selected) return null;\n\tconst credential: OAuthCredential = { type: \"oauth\", ...selected };\n\tlet resolved: { credential: OAuthCredential; auth: ModelAuth | undefined } | undefined;\n\tif (Date.now() >= credential.expires) {\n\t\ttry {\n\t\t\tresolved = await refreshOAuthProvider(providerId, credential);\n\t\t} catch (cause) {\n\t\t\tthrow new Error(`Failed to refresh OAuth token for ${providerId}`, { cause });\n\t\t}\n\t} else {\n\t\tresolved = { credential, auth: await oauthCredentialToAuth(providerId, credential) };\n\t}\n\tconst apiKey = resolved?.auth?.apiKey;\n\tif (!resolved || !apiKey) return null;\n\tconst { type: _type, ...newCredentials } = resolved.credential;\n\treturn { newCredentials, apiKey };\n}\n"]}