@humain/humain-code 0.7.0 → 0.8.0

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 (650) hide show
  1. package/CHANGELOG.md +139 -0
  2. package/README.md +2 -2
  3. package/dist/bundle/agent-monitor.js +1 -1
  4. package/dist/bundle/chunks/anthropic-messages-UZB5HJE3.js +77 -0
  5. package/dist/bundle/chunks/anthropic.js +25 -24
  6. package/dist/bundle/chunks/azure-openai-responses-J3LCMWPQ.js +15 -0
  7. package/dist/bundle/chunks/bedrock-converse-stream.js +460 -431
  8. package/dist/bundle/chunks/bowser-DXKSTXFQ.js +89 -0
  9. package/dist/bundle/chunks/{chunk-HTA325LJ.js → chunk-2NVGOSBN.js} +1 -1
  10. package/dist/bundle/chunks/{chunk-5B25YXF7.js → chunk-3CGMVKHA.js} +13 -3
  11. package/dist/bundle/chunks/{chunk-SCINMV4X.js → chunk-46C6D7UC.js} +22 -21
  12. package/dist/bundle/chunks/{chunk-RS6PZK35.js → chunk-4EV7CK26.js} +249 -216
  13. package/dist/bundle/chunks/{chunk-T7BXP46S.js → chunk-4SFWYKL5.js} +1848 -1662
  14. package/dist/bundle/chunks/{chunk-TGDPZCSW.js → chunk-4TDNOR36.js} +1 -1
  15. package/dist/bundle/chunks/{chunk-C6VERWRZ.js → chunk-4XF5JX7X.js} +1 -1
  16. package/dist/bundle/chunks/chunk-6HTHDVJC.js +4 -0
  17. package/dist/bundle/chunks/{chunk-2G7YVAVF.js → chunk-7EONJCBE.js} +1 -1
  18. package/dist/bundle/chunks/chunk-7H2WNBX7.js +11 -0
  19. package/dist/bundle/chunks/{chunk-2FYYW6FY.js → chunk-7OZNMWAJ.js} +1 -1
  20. package/dist/bundle/chunks/{chunk-R6YQR7TZ.js → chunk-7WE77IE3.js} +1 -1
  21. package/dist/bundle/chunks/{chunk-Z5YLKK3S.js → chunk-7WETECIB.js} +1 -1
  22. package/dist/bundle/chunks/{chunk-EIC7CQX3.js → chunk-AI7EHDAX.js} +1 -1
  23. package/dist/bundle/chunks/{chunk-KRCX3ZBA.js → chunk-APNPBT7Y.js} +1 -1
  24. package/dist/bundle/chunks/{chunk-4HTVBBJD.js → chunk-ATFZAFMS.js} +2 -2
  25. package/dist/bundle/chunks/{chunk-R5OOX7RW.js → chunk-B47PNNLL.js} +9 -2
  26. package/dist/bundle/chunks/{chunk-AZXVJN6E.js → chunk-C4DHVDYT.js} +1 -1
  27. package/dist/bundle/chunks/{chunk-4PRNKB6V.js → chunk-CET2MXXN.js} +7 -7
  28. package/dist/bundle/chunks/{chunk-66FZJO75.js → chunk-CU6KU7JK.js} +472 -3924
  29. package/dist/bundle/chunks/{chunk-MD7K7RPN.js → chunk-D3KYOSQY.js} +1 -1
  30. package/dist/bundle/chunks/{chunk-I3NDOUHE.js → chunk-DCXHRP6C.js} +1 -1
  31. package/dist/bundle/chunks/{chunk-OB332KMV.js → chunk-DD5UT56Y.js} +46 -32
  32. package/dist/bundle/chunks/{chunk-G4QPSFBF.js → chunk-EMBIUIQ2.js} +216 -223
  33. package/dist/bundle/chunks/{chunk-Q7VXYXY3.js → chunk-ENBDASDN.js} +2 -2
  34. package/dist/bundle/chunks/{chunk-2H3LUS62.js → chunk-FJIISX5W.js} +241 -229
  35. package/dist/bundle/chunks/{chunk-WQOOJP7U.js → chunk-GV5OVRKK.js} +1 -1
  36. package/dist/bundle/chunks/{chunk-KTSJYIYC.js → chunk-HHWVVNGG.js} +1 -1
  37. package/dist/bundle/chunks/{chunk-4JRER4XK.js → chunk-HQMUDHC3.js} +19 -19
  38. package/dist/bundle/chunks/{chunk-WQ7EJQIT.js → chunk-IOLLZXQN.js} +225 -239
  39. package/dist/bundle/chunks/chunk-IXQYPQRQ.js +2079 -0
  40. package/dist/bundle/chunks/{chunk-RU7ADKA7.js → chunk-J4GII2EE.js} +112 -96
  41. package/dist/bundle/chunks/chunk-J5TSAJGC.js +22 -0
  42. package/dist/bundle/chunks/{chunk-QT6ZHDMP.js → chunk-JBSWWCT5.js} +1 -1
  43. package/dist/bundle/chunks/{chunk-P6AXBESH.js → chunk-JV7VHOAY.js} +1119 -1098
  44. package/dist/bundle/chunks/{chunk-PWUDFU5V.js → chunk-JWOPWHVH.js} +4 -4
  45. package/dist/bundle/chunks/{chunk-4V5VL2BO.js → chunk-KLSRGGOH.js} +131 -154
  46. package/dist/bundle/chunks/{chunk-JF7FYXAI.js → chunk-KONLZKPL.js} +7 -6
  47. package/dist/bundle/chunks/{chunk-32QLLD2P.js → chunk-KQXXBQ57.js} +360 -332
  48. package/dist/bundle/chunks/{chunk-UZNIPOGS.js → chunk-L4J7SMJB.js} +1 -1
  49. package/dist/bundle/chunks/chunk-MPRAQ6ZI.js +41 -0
  50. package/dist/bundle/chunks/{chunk-GUHNFZ2Q.js → chunk-NNWNIBLG.js} +20 -19
  51. package/dist/bundle/chunks/{chunk-TWAHPPXN.js → chunk-OVDMYBIT.js} +1307 -1194
  52. package/dist/bundle/chunks/{chunk-WAPZN4KP.js → chunk-P2Y2H7SD.js} +2 -2
  53. package/dist/bundle/chunks/{chunk-PPBDDQHP.js → chunk-PGVDL4KB.js} +7 -6
  54. package/dist/bundle/chunks/{chunk-XHDVDJM7.js → chunk-PVNXN2TC.js} +7 -7
  55. package/dist/bundle/chunks/{chunk-RNBZBCH2.js → chunk-QJB5YI3I.js} +1 -1
  56. package/dist/bundle/chunks/{chunk-I5E7RQ5V.js → chunk-QRYDGY5I.js} +5 -5
  57. package/dist/bundle/chunks/{chunk-4QAXV5T6.js → chunk-R3VDXQW2.js} +9 -9
  58. package/dist/bundle/chunks/chunk-SKCJ25SX.js +24 -0
  59. package/dist/bundle/chunks/chunk-SQ7NTRLJ.js +77 -0
  60. package/dist/bundle/chunks/{chunk-SSRCVJZK.js → chunk-TYN46EVI.js} +5 -5
  61. package/dist/bundle/chunks/{chunk-6E6RHNOU.js → chunk-UXM4WFLH.js} +12 -11
  62. package/dist/bundle/chunks/{chunk-LB4CIS4F.js → chunk-VCMXBP5S.js} +17 -17
  63. package/dist/bundle/chunks/{chunk-N2SNMUD3.js → chunk-VKQNYZUA.js} +1 -1
  64. package/dist/bundle/chunks/{chunk-JYWUOKOI.js → chunk-WBSGWISD.js} +367 -353
  65. package/dist/bundle/chunks/{chunk-3EDMWQ35.js → chunk-WGXMYMPE.js} +17 -15
  66. package/dist/bundle/chunks/chunk-WRYGY5XG.js +24 -0
  67. package/dist/bundle/chunks/{chunk-GRJUKEE3.js → chunk-XVIQYONJ.js} +4 -4
  68. package/dist/bundle/chunks/chunk-YSWDFV2L.js +11 -0
  69. package/dist/bundle/chunks/{chunk-AEWYICBL.js → chunk-Z5UFSRO4.js} +2 -2
  70. package/dist/bundle/chunks/chunk-ZG74NES2.js +2 -0
  71. package/dist/bundle/chunks/chunk-ZTG5OKI7.js +3 -0
  72. package/dist/bundle/chunks/{cli-H4LJNE2V.js → cli-6DJO467D.js} +2 -2
  73. package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-T5R2RVFQ.js → cloudflare-workers-ai-system-one-ETKC6B2S.js} +1 -1
  74. package/dist/bundle/chunks/codemode-worker.js +68 -68
  75. package/dist/bundle/chunks/compat-HS4ARZK3.js +15 -0
  76. package/dist/bundle/chunks/curator-server-TC7RVVN2.js +3600 -0
  77. package/dist/bundle/chunks/dist-35STTNYA.js +37 -0
  78. package/dist/bundle/chunks/{dist-FMWWM4H7.js → dist-5AQPJ2TI.js} +2 -2
  79. package/dist/bundle/chunks/{dist-NHQTBDHT.js → dist-DYB3AR7C.js} +91 -257
  80. package/dist/bundle/chunks/dist-NMEXYUP3.js +11 -0
  81. package/dist/bundle/chunks/dist-cjs-EROMDUKS.js +193 -0
  82. package/dist/bundle/chunks/{easter-egg-3d-BUEOC3NO.js → easter-egg-3d-VVUF3C3X.js} +1 -1
  83. package/dist/bundle/chunks/entry-2GZ3PTWQ.js +2 -0
  84. package/dist/bundle/chunks/{entry-A2CSLKHC.js → entry-SRYLSS5P.js} +3 -3
  85. package/dist/bundle/chunks/{event-streams-7YGFEPBZ.js → event-streams-F67JLS6B.js} +1 -1
  86. package/dist/bundle/chunks/{execute-MY5JSEPV.js → execute-I3WGGPWL.js} +2 -2
  87. package/dist/bundle/chunks/{extract-PTGACPGP.js → extract-QHZTEVJP.js} +68 -65
  88. package/dist/bundle/chunks/{flow-implementer-APJFY4YI.js → flow-implementer-QMN3HKE2.js} +8 -9
  89. package/dist/bundle/chunks/github-copilot.js +55 -45
  90. package/dist/bundle/chunks/google-generative-ai-ZND73WDQ.js +22 -0
  91. package/dist/bundle/chunks/google-vertex-YAH62YRM.js +25 -0
  92. package/dist/bundle/chunks/host-Q565BCXB.js +3 -0
  93. package/dist/bundle/chunks/image-resize-worker.js +3 -3
  94. package/dist/bundle/chunks/{index.bundle-THL4EUSU.js → index.bundle-HONF3PUD.js} +177 -176
  95. package/dist/bundle/chunks/{inprocess-5NP5VJHZ.js → inprocess-453SLFL5.js} +6 -6
  96. package/dist/bundle/chunks/interactive-mode-MVZOJ5OU.js +5 -0
  97. package/dist/bundle/chunks/{llama-cpp-classify-GJAXULWL.js → llama-cpp-classify-Z4GZY4GC.js} +1 -1
  98. package/dist/bundle/chunks/mistral-conversations-7I5JURDP.js +43 -0
  99. package/dist/bundle/chunks/{node-ZFIIS5IM.js → node-IMSYVRPL.js} +53 -30
  100. package/dist/bundle/chunks/{node-UNHECG4X.js → node-MHHE76P4.js} +475 -440
  101. package/dist/bundle/chunks/{openai-codex-responses-S7CMCAOY.js → openai-codex-responses-LTHOMN37.js} +30 -29
  102. package/dist/bundle/chunks/openai-codex.js +9 -8
  103. package/dist/bundle/chunks/{openai-completions-2Z57N7PC.js → openai-completions-W2X635EE.js} +22 -22
  104. package/dist/bundle/chunks/{openai-decisions-JIOJDB4C.js → openai-decisions-TN2GNOYI.js} +1 -1
  105. package/dist/bundle/chunks/{openai-responses-5VBZSTHL.js → openai-responses-DVY4QXOG.js} +4 -5
  106. package/dist/bundle/chunks/{openrouter-images-S6O7DBEJ.js → openrouter-images-SE2JMS44.js} +1 -1
  107. package/dist/bundle/chunks/openrouter.js +9 -8
  108. package/dist/bundle/chunks/pdfjs-FE3L72A6.js +3662 -0
  109. package/dist/bundle/chunks/{pdfjs-decoders-OFXX4HDZ.js → pdfjs-decoders-VCMCTQJ2.js} +1 -1
  110. package/dist/bundle/chunks/pdfjs-jbig2_nowasm_fallback-I4K6AIV4.js +295 -0
  111. package/dist/bundle/chunks/pdfjs-openjpeg-PYQCV6CM.js +590 -0
  112. package/dist/bundle/chunks/pdfjs-openjpeg_nowasm_fallback-G363SGDI.js +775 -0
  113. package/dist/bundle/chunks/{pi-messages-SMLN5J2W.js → pi-messages-WAS6Z5L5.js} +11 -11
  114. package/dist/bundle/chunks/radius.js +8 -7
  115. package/dist/bundle/chunks/{runtime-OYTWXIUM.js → runtime-H7LYNKCZ.js} +1 -1
  116. package/dist/bundle/chunks/session-picker-XNVLSJ22.js +4 -0
  117. package/dist/bundle/chunks/startup-ui-3TCT465D.js +3 -0
  118. package/dist/bundle/chunks/{trace-command-YLDYCL55.js → trace-command-7ORDQ3JS.js} +4 -4
  119. package/dist/bundle/chunks/{typesafe-system-one-7BEL3H5N.js → typesafe-system-one-AAZH6S3I.js} +1 -1
  120. package/dist/bundle/chunks/{undici-C6S56CGI.js → undici-WVNE45GY.js} +1 -1
  121. package/dist/bundle/chunks/virtual-modules-CIVXCEAN.js +28 -0
  122. package/dist/bundle/cli-runtime.js +5 -5
  123. package/dist/bundle/flow/package.json +5 -5
  124. package/dist/bundle/index.js +13 -13
  125. package/dist/bundle/orchestrate/package.json +22 -6
  126. package/dist/bundle/rpc-entry.js +4 -5
  127. package/dist/cli/args.d.ts.map +1 -1
  128. package/dist/cli/args.js +4 -3
  129. package/dist/cli/args.js.map +1 -1
  130. package/dist/cli/config-selector.d.ts.map +1 -1
  131. package/dist/cli/config-selector.js +9 -6
  132. package/dist/cli/config-selector.js.map +1 -1
  133. package/dist/cli/session-picker.d.ts.map +1 -1
  134. package/dist/cli/session-picker.js +9 -6
  135. package/dist/cli/session-picker.js.map +1 -1
  136. package/dist/cli/startup-ui.d.ts.map +1 -1
  137. package/dist/cli/startup-ui.js +8 -4
  138. package/dist/cli/startup-ui.js.map +1 -1
  139. package/dist/cli.js.map +1 -1
  140. package/dist/core/agent-session-runtime.d.ts +11 -0
  141. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  142. package/dist/core/agent-session-runtime.js +19 -0
  143. package/dist/core/agent-session-runtime.js.map +1 -1
  144. package/dist/core/agent-session-services.d.ts +0 -2
  145. package/dist/core/agent-session-services.d.ts.map +1 -1
  146. package/dist/core/agent-session-services.js +0 -2
  147. package/dist/core/agent-session-services.js.map +1 -1
  148. package/dist/core/agent-session.d.ts +31 -39
  149. package/dist/core/agent-session.d.ts.map +1 -1
  150. package/dist/core/agent-session.js +231 -535
  151. package/dist/core/agent-session.js.map +1 -1
  152. package/dist/core/anthropic-subscription-usage.d.ts +4 -2
  153. package/dist/core/anthropic-subscription-usage.d.ts.map +1 -1
  154. package/dist/core/anthropic-subscription-usage.js +32 -16
  155. package/dist/core/anthropic-subscription-usage.js.map +1 -1
  156. package/dist/core/auto-session-namer.js +1 -1
  157. package/dist/core/auto-session-namer.js.map +1 -1
  158. package/dist/core/cache-warmer.d.ts.map +1 -1
  159. package/dist/core/cache-warmer.js +2 -0
  160. package/dist/core/cache-warmer.js.map +1 -1
  161. package/dist/core/exec.d.ts +1 -0
  162. package/dist/core/exec.d.ts.map +1 -1
  163. package/dist/core/exec.js +4 -1
  164. package/dist/core/exec.js.map +1 -1
  165. package/dist/core/export-html/ansi-to-html.d.ts +6 -1
  166. package/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
  167. package/dist/core/export-html/ansi-to-html.js +57 -20
  168. package/dist/core/export-html/ansi-to-html.js.map +1 -1
  169. package/dist/core/export-html/template.js +1 -1
  170. package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
  171. package/dist/core/export-html/tool-renderer.js +2 -3
  172. package/dist/core/export-html/tool-renderer.js.map +1 -1
  173. package/dist/core/extensions/loader.d.ts.map +1 -1
  174. package/dist/core/extensions/loader.js +18 -1
  175. package/dist/core/extensions/loader.js.map +1 -1
  176. package/dist/core/extensions/runner.d.ts.map +1 -1
  177. package/dist/core/extensions/runner.js +5 -0
  178. package/dist/core/extensions/runner.js.map +1 -1
  179. package/dist/core/extensions/types.d.ts +5 -0
  180. package/dist/core/extensions/types.d.ts.map +1 -1
  181. package/dist/core/extensions/types.js.map +1 -1
  182. package/dist/core/flow-implementer.d.ts.map +1 -1
  183. package/dist/core/flow-implementer.js +3 -9
  184. package/dist/core/flow-implementer.js.map +1 -1
  185. package/dist/core/keybindings.d.ts +40 -0
  186. package/dist/core/keybindings.d.ts.map +1 -1
  187. package/dist/core/keybindings.js +5 -0
  188. package/dist/core/keybindings.js.map +1 -1
  189. package/dist/core/model-config.d.ts +13 -0
  190. package/dist/core/model-config.d.ts.map +1 -1
  191. package/dist/core/model-registry.d.ts +3 -0
  192. package/dist/core/model-registry.d.ts.map +1 -1
  193. package/dist/core/model-registry.js +32 -8
  194. package/dist/core/model-registry.js.map +1 -1
  195. package/dist/core/model-resolver.d.ts +0 -1
  196. package/dist/core/model-resolver.d.ts.map +1 -1
  197. package/dist/core/model-resolver.js +3 -10
  198. package/dist/core/model-resolver.js.map +1 -1
  199. package/dist/core/model-runtime.d.ts +18 -7
  200. package/dist/core/model-runtime.d.ts.map +1 -1
  201. package/dist/core/model-runtime.js +41 -8
  202. package/dist/core/model-runtime.js.map +1 -1
  203. package/dist/core/oauth-account-pool.d.ts +5 -0
  204. package/dist/core/oauth-account-pool.d.ts.map +1 -1
  205. package/dist/core/oauth-account-pool.js +34 -3
  206. package/dist/core/oauth-account-pool.js.map +1 -1
  207. package/dist/core/package-manager.d.ts +16 -0
  208. package/dist/core/package-manager.d.ts.map +1 -1
  209. package/dist/core/package-manager.js +46 -3
  210. package/dist/core/package-manager.js.map +1 -1
  211. package/dist/core/pi-ai-schemas.d.ts +1 -0
  212. package/dist/core/pi-ai-schemas.d.ts.map +1 -1
  213. package/dist/core/remote-catalog-provider.d.ts.map +1 -1
  214. package/dist/core/remote-catalog-provider.js +7 -0
  215. package/dist/core/remote-catalog-provider.js.map +1 -1
  216. package/dist/core/resource-loader.d.ts +5 -1
  217. package/dist/core/resource-loader.d.ts.map +1 -1
  218. package/dist/core/resource-loader.js +2 -0
  219. package/dist/core/resource-loader.js.map +1 -1
  220. package/dist/core/run-outcome.d.ts +6 -3
  221. package/dist/core/run-outcome.d.ts.map +1 -1
  222. package/dist/core/run-outcome.js +36 -9
  223. package/dist/core/run-outcome.js.map +1 -1
  224. package/dist/core/run-preflight.d.ts +1 -1
  225. package/dist/core/run-preflight.d.ts.map +1 -1
  226. package/dist/core/run-preflight.js +19 -11
  227. package/dist/core/run-preflight.js.map +1 -1
  228. package/dist/core/sdk.d.ts +0 -6
  229. package/dist/core/sdk.d.ts.map +1 -1
  230. package/dist/core/sdk.js +7 -16
  231. package/dist/core/sdk.js.map +1 -1
  232. package/dist/core/settings-manager.d.ts +0 -5
  233. package/dist/core/settings-manager.d.ts.map +1 -1
  234. package/dist/core/settings-manager.js +0 -9
  235. package/dist/core/settings-manager.js.map +1 -1
  236. package/dist/core/settings-schema.d.ts +0 -4
  237. package/dist/core/settings-schema.d.ts.map +1 -1
  238. package/dist/core/settings-schema.js +0 -1
  239. package/dist/core/settings-schema.js.map +1 -1
  240. package/dist/core/tools/bash-jobs.d.ts.map +1 -1
  241. package/dist/core/tools/bash-jobs.js +2 -9
  242. package/dist/core/tools/bash-jobs.js.map +1 -1
  243. package/dist/core/tools/find.d.ts.map +1 -1
  244. package/dist/core/tools/find.js +28 -16
  245. package/dist/core/tools/find.js.map +1 -1
  246. package/dist/core/tools/output-accumulator.d.ts.map +1 -1
  247. package/dist/core/tools/output-accumulator.js +4 -1
  248. package/dist/core/tools/output-accumulator.js.map +1 -1
  249. package/dist/core/tools/read.d.ts +8 -4
  250. package/dist/core/tools/read.d.ts.map +1 -1
  251. package/dist/core/tools/read.js +10 -15
  252. package/dist/core/tools/read.js.map +1 -1
  253. package/dist/core/tools/renderers/read.d.ts.map +1 -1
  254. package/dist/core/tools/renderers/read.js +6 -2
  255. package/dist/core/tools/renderers/read.js.map +1 -1
  256. package/dist/core/tools/subagent-worktree.d.ts.map +1 -1
  257. package/dist/core/tools/subagent-worktree.js +2 -10
  258. package/dist/core/tools/subagent-worktree.js.map +1 -1
  259. package/dist/core/trace-client/credential-store.d.ts.map +1 -1
  260. package/dist/core/trace-client/credential-store.js +9 -5
  261. package/dist/core/trace-client/credential-store.js.map +1 -1
  262. package/dist/extensions/codemode/execute.js +2 -2
  263. package/dist/extensions/codemode/execute.js.map +1 -1
  264. package/dist/extensions/llama/provider.d.ts +1 -1
  265. package/dist/extensions/llama/provider.d.ts.map +1 -1
  266. package/dist/extensions/llama/provider.js +6 -4
  267. package/dist/extensions/llama/provider.js.map +1 -1
  268. package/dist/extensions/usage/account-reconnect.d.ts +5 -0
  269. package/dist/extensions/usage/account-reconnect.d.ts.map +1 -0
  270. package/dist/extensions/usage/account-reconnect.js +12 -0
  271. package/dist/extensions/usage/account-reconnect.js.map +1 -0
  272. package/dist/extensions/usage/hcode-overview.d.ts +6 -19
  273. package/dist/extensions/usage/hcode-overview.d.ts.map +1 -1
  274. package/dist/extensions/usage/hcode-overview.js +86 -100
  275. package/dist/extensions/usage/hcode-overview.js.map +1 -1
  276. package/dist/extensions/usage/index.d.ts.map +1 -1
  277. package/dist/extensions/usage/index.js +74 -98
  278. package/dist/extensions/usage/index.js.map +1 -1
  279. package/dist/extensions/usage/overview.d.ts +22 -17
  280. package/dist/extensions/usage/overview.d.ts.map +1 -1
  281. package/dist/extensions/usage/overview.js +98 -13
  282. package/dist/extensions/usage/overview.js.map +1 -1
  283. package/dist/extensions/usage/popup.d.ts +9 -14
  284. package/dist/extensions/usage/popup.d.ts.map +1 -1
  285. package/dist/extensions/usage/popup.js +78 -165
  286. package/dist/extensions/usage/popup.js.map +1 -1
  287. package/dist/humain/bedrock-provider/vendor/index.bundle.mjs +4 -1
  288. package/dist/humain/flow-command.js +1 -1
  289. package/dist/humain/flow-command.js.map +1 -1
  290. package/dist/humain/flow-loader.d.ts +9 -4
  291. package/dist/humain/flow-loader.d.ts.map +1 -1
  292. package/dist/humain/flow-loader.js +30 -21
  293. package/dist/humain/flow-loader.js.map +1 -1
  294. package/dist/humain/gateway/client.d.ts +3 -1
  295. package/dist/humain/gateway/client.d.ts.map +1 -1
  296. package/dist/humain/gateway/client.js +10 -5
  297. package/dist/humain/gateway/client.js.map +1 -1
  298. package/dist/humain/gateway/login.d.ts.map +1 -1
  299. package/dist/humain/gateway/login.js +160 -53
  300. package/dist/humain/gateway/login.js.map +1 -1
  301. package/dist/humain/hcode/account-store.d.ts +29 -5
  302. package/dist/humain/hcode/account-store.d.ts.map +1 -1
  303. package/dist/humain/hcode/account-store.js +224 -124
  304. package/dist/humain/hcode/account-store.js.map +1 -1
  305. package/dist/humain/hcode/account.d.ts +6 -0
  306. package/dist/humain/hcode/account.d.ts.map +1 -1
  307. package/dist/humain/hcode/account.js +348 -129
  308. package/dist/humain/hcode/account.js.map +1 -1
  309. package/dist/humain/hcode/catalog-watch.d.ts +21 -0
  310. package/dist/humain/hcode/catalog-watch.d.ts.map +1 -0
  311. package/dist/humain/hcode/catalog-watch.js +46 -0
  312. package/dist/humain/hcode/catalog-watch.js.map +1 -0
  313. package/dist/humain/hcode/contracts.d.ts +16 -1
  314. package/dist/humain/hcode/contracts.d.ts.map +1 -1
  315. package/dist/humain/hcode/contracts.js +122 -128
  316. package/dist/humain/hcode/contracts.js.map +1 -1
  317. package/dist/humain/hcode/environment.d.ts +3 -1
  318. package/dist/humain/hcode/environment.d.ts.map +1 -1
  319. package/dist/humain/hcode/environment.js +12 -2
  320. package/dist/humain/hcode/environment.js.map +1 -1
  321. package/dist/humain/hcode/facade.d.ts +26 -6
  322. package/dist/humain/hcode/facade.d.ts.map +1 -1
  323. package/dist/humain/hcode/facade.js +148 -38
  324. package/dist/humain/hcode/facade.js.map +1 -1
  325. package/dist/humain/hcode/http.d.ts +3 -1
  326. package/dist/humain/hcode/http.d.ts.map +1 -1
  327. package/dist/humain/hcode/http.js +44 -23
  328. package/dist/humain/hcode/http.js.map +1 -1
  329. package/dist/humain/hcode/images.d.ts +67 -0
  330. package/dist/humain/hcode/images.d.ts.map +1 -0
  331. package/dist/humain/hcode/images.js +463 -0
  332. package/dist/humain/hcode/images.js.map +1 -0
  333. package/dist/humain/hcode/login-copy.d.ts +28 -0
  334. package/dist/humain/hcode/login-copy.d.ts.map +1 -0
  335. package/dist/humain/hcode/login-copy.js +74 -0
  336. package/dist/humain/hcode/login-copy.js.map +1 -0
  337. package/dist/humain/hcode/login-failure.d.ts +26 -0
  338. package/dist/humain/hcode/login-failure.d.ts.map +1 -0
  339. package/dist/humain/hcode/login-failure.js +50 -0
  340. package/dist/humain/hcode/login-failure.js.map +1 -0
  341. package/dist/humain/hcode/notices.d.ts +24 -1
  342. package/dist/humain/hcode/notices.d.ts.map +1 -1
  343. package/dist/humain/hcode/notices.js +93 -7
  344. package/dist/humain/hcode/notices.js.map +1 -1
  345. package/dist/humain/hcode/provider.d.ts +7 -3
  346. package/dist/humain/hcode/provider.d.ts.map +1 -1
  347. package/dist/humain/hcode/provider.js +123 -19
  348. package/dist/humain/hcode/provider.js.map +1 -1
  349. package/dist/humain/hcode/selection.d.ts +2 -0
  350. package/dist/humain/hcode/selection.d.ts.map +1 -1
  351. package/dist/humain/hcode/selection.js +8 -1
  352. package/dist/humain/hcode/selection.js.map +1 -1
  353. package/dist/humain/hcode/transport.d.ts +13 -10
  354. package/dist/humain/hcode/transport.d.ts.map +1 -1
  355. package/dist/humain/hcode/transport.js +103 -148
  356. package/dist/humain/hcode/transport.js.map +1 -1
  357. package/dist/humain/hcode/wire.d.ts +3 -0
  358. package/dist/humain/hcode/wire.d.ts.map +1 -1
  359. package/dist/humain/hcode/wire.js +11 -0
  360. package/dist/humain/hcode/wire.js.map +1 -1
  361. package/dist/humain/metadata/contracts.d.ts +1 -0
  362. package/dist/humain/metadata/contracts.d.ts.map +1 -1
  363. package/dist/humain/metadata/contracts.js +2 -1
  364. package/dist/humain/metadata/contracts.js.map +1 -1
  365. package/dist/humain/web-access/vendor/anysearch.d.ts.map +1 -1
  366. package/dist/humain/web-access/vendor/anysearch.js +7 -3
  367. package/dist/humain/web-access/vendor/anysearch.js.map +1 -1
  368. package/dist/humain/web-access/vendor/autom.d.ts +4 -0
  369. package/dist/humain/web-access/vendor/autom.d.ts.map +1 -0
  370. package/dist/humain/web-access/vendor/autom.js +191 -0
  371. package/dist/humain/web-access/vendor/autom.js.map +1 -0
  372. package/dist/humain/web-access/vendor/cloro.d.ts +4 -0
  373. package/dist/humain/web-access/vendor/cloro.d.ts.map +1 -0
  374. package/dist/humain/web-access/vendor/cloro.js +236 -0
  375. package/dist/humain/web-access/vendor/cloro.js.map +1 -0
  376. package/dist/humain/web-access/vendor/curator-page.d.ts.map +1 -1
  377. package/dist/humain/web-access/vendor/curator-page.js +7 -1
  378. package/dist/humain/web-access/vendor/curator-page.js.map +1 -1
  379. package/dist/humain/web-access/vendor/curator-server.d.ts.map +1 -1
  380. package/dist/humain/web-access/vendor/curator-server.js +6 -0
  381. package/dist/humain/web-access/vendor/curator-server.js.map +1 -1
  382. package/dist/humain/web-access/vendor/domain-filter-normalization.d.ts +8 -0
  383. package/dist/humain/web-access/vendor/domain-filter-normalization.d.ts.map +1 -1
  384. package/dist/humain/web-access/vendor/domain-filter-normalization.js +37 -0
  385. package/dist/humain/web-access/vendor/domain-filter-normalization.js.map +1 -1
  386. package/dist/humain/web-access/vendor/duckduckgo-rate-limit.d.ts +28 -8
  387. package/dist/humain/web-access/vendor/duckduckgo-rate-limit.d.ts.map +1 -1
  388. package/dist/humain/web-access/vendor/duckduckgo-rate-limit.js +135 -34
  389. package/dist/humain/web-access/vendor/duckduckgo-rate-limit.js.map +1 -1
  390. package/dist/humain/web-access/vendor/duckduckgo.d.ts +1 -1
  391. package/dist/humain/web-access/vendor/duckduckgo.d.ts.map +1 -1
  392. package/dist/humain/web-access/vendor/duckduckgo.js +10 -3
  393. package/dist/humain/web-access/vendor/duckduckgo.js.map +1 -1
  394. package/dist/humain/web-access/vendor/extract.d.ts.map +1 -1
  395. package/dist/humain/web-access/vendor/extract.js +61 -5
  396. package/dist/humain/web-access/vendor/extract.js.map +1 -1
  397. package/dist/humain/web-access/vendor/gemini-search.d.ts +3 -3
  398. package/dist/humain/web-access/vendor/gemini-search.d.ts.map +1 -1
  399. package/dist/humain/web-access/vendor/gemini-search.js +35 -5
  400. package/dist/humain/web-access/vendor/gemini-search.js.map +1 -1
  401. package/dist/humain/web-access/vendor/index.d.ts.map +1 -1
  402. package/dist/humain/web-access/vendor/index.js +8 -1
  403. package/dist/humain/web-access/vendor/index.js.map +1 -1
  404. package/dist/humain/web-access/vendor/page-query.d.ts +5 -0
  405. package/dist/humain/web-access/vendor/page-query.d.ts.map +1 -1
  406. package/dist/humain/web-access/vendor/page-query.js +12 -2
  407. package/dist/humain/web-access/vendor/page-query.js.map +1 -1
  408. package/dist/humain/web-access/vendor/specstream.d.ts +6 -0
  409. package/dist/humain/web-access/vendor/specstream.d.ts.map +1 -0
  410. package/dist/humain/web-access/vendor/specstream.js +253 -0
  411. package/dist/humain/web-access/vendor/specstream.js.map +1 -0
  412. package/dist/humain/web-access/vendor/tool-activation.d.ts.map +1 -1
  413. package/dist/humain/web-access/vendor/tool-activation.js +21 -5
  414. package/dist/humain/web-access/vendor/tool-activation.js.map +1 -1
  415. package/dist/humain/web-access/vendor/upgrade-notice.d.ts +1 -1
  416. package/dist/humain/web-access/vendor/upgrade-notice.js +1 -1
  417. package/dist/humain/web-access/vendor/upgrade-notice.js.map +1 -1
  418. package/dist/humain/web-access/vendor/utils.d.ts +1 -0
  419. package/dist/humain/web-access/vendor/utils.d.ts.map +1 -1
  420. package/dist/humain/web-access/vendor/utils.js +3 -0
  421. package/dist/humain/web-access/vendor/utils.js.map +1 -1
  422. package/dist/humain/web-access/vendor/video-extract.js +2 -2
  423. package/dist/humain/web-access/vendor/video-extract.js.map +1 -1
  424. package/dist/humain/web-access/vendor/web-tool-core.d.ts +13 -0
  425. package/dist/humain/web-access/vendor/web-tool-core.d.ts.map +1 -1
  426. package/dist/humain/web-access/vendor/web-tool-core.js +16 -5
  427. package/dist/humain/web-access/vendor/web-tool-core.js.map +1 -1
  428. package/dist/humain/web-access/vendor/youtube-extract.js +2 -2
  429. package/dist/humain/web-access/vendor/youtube-extract.js.map +1 -1
  430. package/dist/index.d.ts +0 -2
  431. package/dist/index.d.ts.map +1 -1
  432. package/dist/index.js.map +1 -1
  433. package/dist/main.d.ts.map +1 -1
  434. package/dist/main.js +96 -28
  435. package/dist/main.js.map +1 -1
  436. package/dist/modes/diagnostics-stderr.d.ts +4 -0
  437. package/dist/modes/diagnostics-stderr.d.ts.map +1 -0
  438. package/dist/modes/diagnostics-stderr.js +11 -0
  439. package/dist/modes/diagnostics-stderr.js.map +1 -0
  440. package/dist/modes/interactive/components/assistant-message.d.ts +1 -1
  441. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  442. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  443. package/dist/modes/interactive/components/bash-execution.js.map +1 -1
  444. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
  445. package/dist/modes/interactive/components/config-selector.js +5 -2
  446. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  447. package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
  448. package/dist/modes/interactive/components/extension-selector.js +14 -5
  449. package/dist/modes/interactive/components/extension-selector.js.map +1 -1
  450. package/dist/modes/interactive/components/first-time-setup.d.ts +1 -1
  451. package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -1
  452. package/dist/modes/interactive/components/first-time-setup.js.map +1 -1
  453. package/dist/modes/interactive/components/keybinding-hints.d.ts +2 -0
  454. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
  455. package/dist/modes/interactive/components/keybinding-hints.js +6 -0
  456. package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
  457. package/dist/modes/interactive/components/model-selector.d.ts +10 -0
  458. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  459. package/dist/modes/interactive/components/model-selector.js +101 -23
  460. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  461. package/dist/modes/interactive/components/oauth-selector.d.ts +5 -0
  462. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  463. package/dist/modes/interactive/components/oauth-selector.js +17 -6
  464. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  465. package/dist/modes/interactive/components/radius-login-selector.d.ts.map +1 -1
  466. package/dist/modes/interactive/components/radius-login-selector.js +2 -1
  467. package/dist/modes/interactive/components/radius-login-selector.js.map +1 -1
  468. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  469. package/dist/modes/interactive/components/scoped-models-selector.js +13 -6
  470. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  471. package/dist/modes/interactive/components/session-selector.d.ts +8 -1
  472. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  473. package/dist/modes/interactive/components/session-selector.js +41 -9
  474. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  475. package/dist/modes/interactive/components/settings-submenu.d.ts +1 -1
  476. package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -1
  477. package/dist/modes/interactive/components/settings-submenu.js +5 -1
  478. package/dist/modes/interactive/components/settings-submenu.js.map +1 -1
  479. package/dist/modes/interactive/components/status-indicator.d.ts +0 -17
  480. package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
  481. package/dist/modes/interactive/components/status-indicator.js +1 -78
  482. package/dist/modes/interactive/components/status-indicator.js.map +1 -1
  483. package/dist/modes/interactive/components/themed-text.d.ts +1 -1
  484. package/dist/modes/interactive/components/themed-text.d.ts.map +1 -1
  485. package/dist/modes/interactive/components/themed-text.js.map +1 -1
  486. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
  487. package/dist/modes/interactive/components/thinking-selector.js +5 -1
  488. package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  489. package/dist/modes/interactive/components/tool-execution.d.ts +1 -1
  490. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  491. package/dist/modes/interactive/components/tool-execution.js +3 -1
  492. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  493. package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -1
  494. package/dist/modes/interactive/components/trust-selector.js +14 -5
  495. package/dist/modes/interactive/components/trust-selector.js.map +1 -1
  496. package/dist/modes/interactive/components/user-message.d.ts +1 -1
  497. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  498. package/dist/modes/interactive/components/user-message.js.map +1 -1
  499. package/dist/modes/interactive/components/visual-truncate.d.ts +2 -2
  500. package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
  501. package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
  502. package/dist/modes/interactive/interactive-mode.d.ts +20 -2
  503. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  504. package/dist/modes/interactive/interactive-mode.js +605 -223
  505. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  506. package/dist/modes/interactive/model-catalog-refresh.d.ts +4 -0
  507. package/dist/modes/interactive/model-catalog-refresh.d.ts.map +1 -1
  508. package/dist/modes/interactive/model-catalog-refresh.js +40 -1
  509. package/dist/modes/interactive/model-catalog-refresh.js.map +1 -1
  510. package/dist/modes/interactive/oauth-account-format.d.ts +6 -2
  511. package/dist/modes/interactive/oauth-account-format.d.ts.map +1 -1
  512. package/dist/modes/interactive/oauth-account-format.js +12 -3
  513. package/dist/modes/interactive/oauth-account-format.js.map +1 -1
  514. package/dist/modes/interactive/session-share.js +2 -0
  515. package/dist/modes/interactive/session-share.js.map +1 -1
  516. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  517. package/dist/modes/interactive/theme/theme.js +1 -0
  518. package/dist/modes/interactive/theme/theme.js.map +1 -1
  519. package/dist/modes/print-mode.d.ts.map +1 -1
  520. package/dist/modes/print-mode.js +30 -32
  521. package/dist/modes/print-mode.js.map +1 -1
  522. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  523. package/dist/modes/rpc/rpc-mode.js +26 -39
  524. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  525. package/dist/modes/rpc/rpc-types.d.ts +1 -0
  526. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  527. package/dist/modes/rpc/rpc-types.js.map +1 -1
  528. package/dist/package-manager-cli.d.ts.map +1 -1
  529. package/dist/package-manager-cli.js +14 -1
  530. package/dist/package-manager-cli.js.map +1 -1
  531. package/dist/utils/abort.d.ts +5 -0
  532. package/dist/utils/abort.d.ts.map +1 -1
  533. package/dist/utils/abort.js +9 -0
  534. package/dist/utils/abort.js.map +1 -1
  535. package/dist/utils/changelog.d.ts.map +1 -1
  536. package/dist/utils/changelog.js +3 -2
  537. package/dist/utils/changelog.js.map +1 -1
  538. package/dist/utils/flush-stdout.d.ts +8 -0
  539. package/dist/utils/flush-stdout.d.ts.map +1 -0
  540. package/dist/utils/flush-stdout.js +23 -0
  541. package/dist/utils/flush-stdout.js.map +1 -0
  542. package/dist/utils/image-process.d.ts +2 -0
  543. package/dist/utils/image-process.d.ts.map +1 -1
  544. package/dist/utils/image-process.js +3 -3
  545. package/dist/utils/image-process.js.map +1 -1
  546. package/dist/utils/image-resize-core.js +2 -2
  547. package/dist/utils/image-resize-core.js.map +1 -1
  548. package/dist/utils/shell.d.ts +2 -0
  549. package/dist/utils/shell.d.ts.map +1 -1
  550. package/dist/utils/shell.js +19 -0
  551. package/dist/utils/shell.js.map +1 -1
  552. package/docs/cli.md +1 -1
  553. package/docs/development.md +0 -13
  554. package/docs/extensions.md +6 -4
  555. package/docs/flow.md +4 -62
  556. package/docs/humain-code-forge-architecture.md +1 -47
  557. package/docs/humain-code-forge-flow-walkthrough.md +1 -1
  558. package/docs/humain-code.md +1 -1
  559. package/docs/keybindings.md +2 -0
  560. package/docs/llama-cpp.md +5 -5
  561. package/docs/models-configuration.md +4 -2
  562. package/docs/nvidia-rtx-llama-cpp.md +5 -5
  563. package/docs/providers.md +14 -9
  564. package/docs/rpc-commands.md +1 -1
  565. package/docs/run-preflight.md +1 -1
  566. package/docs/slash-commands.md +1 -1
  567. package/docs/tui.md +2 -0
  568. package/examples/README.md +0 -3
  569. package/examples/extensions/custom-provider-anthropic/package-lock.json +4 -4
  570. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  571. package/examples/extensions/gondolin/index.ts +4 -7
  572. package/examples/tsconfig.json +96 -76
  573. package/npm-shrinkwrap.json +285 -764
  574. package/package.json +24 -37
  575. package/schemas/keybindings.schema.json +20 -0
  576. package/schemas/models.schema.json +5 -1
  577. package/schemas/settings.schema.json +0 -13
  578. package/src/humain/web-access/UPSTREAM.md +52 -1
  579. package/src/humain/web-access/upstream.json +5 -5
  580. package/src/humain/web-access/vendor/CHANGELOG.md +29 -0
  581. package/dist/bundle/chunks/adaptive-peer-worker-X2ZNZE3S.js +0 -8
  582. package/dist/bundle/chunks/adaptive-session-host-7KDSQV5I.js +0 -162
  583. package/dist/bundle/chunks/anthropic-messages-TQK3FUV3.js +0 -68
  584. package/dist/bundle/chunks/azure-openai-responses-JY7OSLH2.js +0 -15
  585. package/dist/bundle/chunks/chunk-5L4PBYC7.js +0 -11
  586. package/dist/bundle/chunks/chunk-6PNQYO6A.js +0 -10
  587. package/dist/bundle/chunks/chunk-CRN54O4D.js +0 -24
  588. package/dist/bundle/chunks/chunk-CTU2ECLD.js +0 -7
  589. package/dist/bundle/chunks/chunk-DBL35X7L.js +0 -3
  590. package/dist/bundle/chunks/chunk-GME4AWDG.js +0 -23
  591. package/dist/bundle/chunks/chunk-GTILMMUF.js +0 -12
  592. package/dist/bundle/chunks/chunk-J57HOSWD.js +0 -21
  593. package/dist/bundle/chunks/chunk-KQM7ZGL6.js +0 -11
  594. package/dist/bundle/chunks/chunk-MX4Q4W6H.js +0 -214
  595. package/dist/bundle/chunks/chunk-NXA6NEHE.js +0 -54
  596. package/dist/bundle/chunks/chunk-PJACZCIR.js +0 -2
  597. package/dist/bundle/chunks/chunk-T5A6T24H.js +0 -93
  598. package/dist/bundle/chunks/chunk-WCFHG6NO.js +0 -16
  599. package/dist/bundle/chunks/chunk-ZJUU6WOV.js +0 -2052
  600. package/dist/bundle/chunks/compat-ZK2DIW3P.js +0 -15
  601. package/dist/bundle/chunks/dist-EY7YKQHB.js +0 -11
  602. package/dist/bundle/chunks/dist-J5IUPLMH.js +0 -37
  603. package/dist/bundle/chunks/dist-cjs-2SKN226B.js +0 -184
  604. package/dist/bundle/chunks/entry-AL54ZGYO.js +0 -2
  605. package/dist/bundle/chunks/es5-GYTRHFKS.js +0 -77
  606. package/dist/bundle/chunks/google-generative-ai-UL7YEQ6J.js +0 -21
  607. package/dist/bundle/chunks/google-vertex-OTMSPUYH.js +0 -26
  608. package/dist/bundle/chunks/host-75YAHLDR.js +0 -3
  609. package/dist/bundle/chunks/interactive-mode-IW4PIVAQ.js +0 -5
  610. package/dist/bundle/chunks/mistral-conversations-E72Y6OC3.js +0 -43
  611. package/dist/bundle/chunks/pdfjs-AKD6EBKN.js +0 -3614
  612. package/dist/bundle/chunks/pdfjs-jbig2_nowasm_fallback-FH3KJM4H.js +0 -326
  613. package/dist/bundle/chunks/pdfjs-openjpeg-SKR7C34X.js +0 -671
  614. package/dist/bundle/chunks/pdfjs-openjpeg_nowasm_fallback-VUBL7UEE.js +0 -974
  615. package/dist/bundle/chunks/session-picker-DM6S37IF.js +0 -4
  616. package/dist/bundle/chunks/startup-ui-4GGLWNSU.js +0 -3
  617. package/dist/bundle/chunks/virtual-modules-TI3W24YL.js +0 -28
  618. package/dist/core/internal-process.d.ts +0 -23
  619. package/dist/core/internal-process.d.ts.map +0 -1
  620. package/dist/core/internal-process.js +0 -88
  621. package/dist/core/internal-process.js.map +0 -1
  622. package/dist/humain/adaptive-execution.d.ts +0 -51
  623. package/dist/humain/adaptive-execution.d.ts.map +0 -1
  624. package/dist/humain/adaptive-execution.js +0 -100
  625. package/dist/humain/adaptive-execution.js.map +0 -1
  626. package/dist/humain/adaptive-peer-process.d.ts +0 -44
  627. package/dist/humain/adaptive-peer-process.d.ts.map +0 -1
  628. package/dist/humain/adaptive-peer-process.js +0 -159
  629. package/dist/humain/adaptive-peer-process.js.map +0 -1
  630. package/dist/humain/adaptive-peer-worker.d.ts +0 -3
  631. package/dist/humain/adaptive-peer-worker.d.ts.map +0 -1
  632. package/dist/humain/adaptive-peer-worker.js +0 -122
  633. package/dist/humain/adaptive-peer-worker.js.map +0 -1
  634. package/dist/humain/adaptive-runtime-types.d.ts +0 -621
  635. package/dist/humain/adaptive-runtime-types.d.ts.map +0 -1
  636. package/dist/humain/adaptive-runtime-types.js +0 -3
  637. package/dist/humain/adaptive-runtime-types.js.map +0 -1
  638. package/dist/humain/adaptive-session-host.d.ts +0 -113
  639. package/dist/humain/adaptive-session-host.d.ts.map +0 -1
  640. package/dist/humain/adaptive-session-host.js +0 -1838
  641. package/dist/humain/adaptive-session-host.js.map +0 -1
  642. package/dist/utils/deprecation.d.ts +0 -4
  643. package/dist/utils/deprecation.d.ts.map +0 -1
  644. package/dist/utils/deprecation.js +0 -13
  645. package/dist/utils/deprecation.js.map +0 -1
  646. package/examples/plugins/pi-example-plugin/README.md +0 -38
  647. package/examples/plugins/pi-example-plugin/package.json +0 -10
  648. package/examples/plugins/pi-example-plugin/src/contract.ts +0 -13
  649. package/examples/plugins/pi-example-plugin/src/session.ts +0 -24
  650. package/examples/plugins/pi-example-plugin/src/tui.ts +0 -31
@@ -1 +1 @@
1
- {"version":3,"file":"model-runtime.js","sourceRoot":"","sources":["../../src/core/model-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM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CAAC,GAAG,MAAM,6BAA6B,CAAC,CAAC;QACtG,IAAI,MAAM,CAAC,QAAQ,KAAK,cAAc,IAAI,CAAC,0BAA0B,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC;YAC1G,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;QACrD,OAAO;YACN,KAAK,EAAE,MAAM;YACb,aAAa,EACZ,MAAM,CAAC,QAAQ,KAAK,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC;YAC3G,KAAK,EAAE,KAAK,CAAC,KAAK;SAClB,CAAC;IACH,CAAC;IAED,gDAAgD;IAChD,gBAAgB,CAAC,UAAkB,EAAE,OAAe;QACnD,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QACxD,8EAA8E;QAC9E,IAAI,KAAK,EAAE,QAAQ,KAAK,cAAc,IAAI,UAAU,KAAK,cAAc;YAAE,OAAO,SAAS,CAAC;QAC1F,OAAO,KAAK,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5D,CAAC;CACD","sourcesContent":["import { AsyncLocalStorage } from \"node:async_hooks\";\nimport { dirname, join } from \"node:path\";\nimport {\n\ttype AnyModel,\n\ttype Api,\n\ttype ApiStreamOptions,\n\ttype AssistantImages,\n\ttype AssistantMessage,\n\ttype AssistantMessageEventStream,\n\ttype AttestationIntent,\n\ttype AuthCheck,\n\ttype AuthInteraction,\n\ttype AuthOperationOptions,\n\ttype AuthResult,\n\ttype AuthType,\n\ttype ClassifierApi,\n\ttype ClassifierContext,\n\ttype ClassifierModel,\n\ttype ClassifierOptions,\n\ttype ClassifierResult,\n\ttype Context,\n\ttype Credential,\n\ttype CredentialInfo,\n\ttype CredentialStore,\n\tclampThinkingLevel,\n\tcommitLoginCredential,\n\tcreateModels,\n\ttype DeferredCancelOptions,\n\ttype DeferredFetchOptions,\n\ttype DeferredHandle,\n\tdefaultProviderAuthContext,\n\tdrainStream,\n\tgetOpenCodeSessionHeaders,\n\tgetSupportedThinkingLevels,\n\ttype ImageApi,\n\ttype ImageModel,\n\ttype ImagesContext,\n\ttype ImagesOptions,\n\tisModelType,\n\ttype LoginOptions,\n\tlazyStream,\n\ttype Message,\n\ttype Model,\n\ttype Models,\n\ttype ModelsApiStreamOptions,\n\ttype ModelsClassifierOptions,\n\ttype ModelsDeferredCancelOptions,\n\ttype ModelsDeferredFetchOptions,\n\tModelsError,\n\ttype ModelsImagesOptions,\n\ttype ModelsRefreshOptions,\n\ttype ModelsRefreshResult,\n\ttype ModelsRequestTransforms,\n\ttype ModelsSimpleStreamOptions,\n\ttype ModelsStore,\n\ttype ModelThinkingLevel,\n\ttype ModelType,\n\ttype ModelTypeMap,\n\ttype MutableModels,\n\tnormalizeContext,\n\ttype Provider,\n\ttype ProviderAuthInteraction,\n\ttype ProviderHeaders,\n\ttype ProviderRequestObservation,\n\ttype ProviderRequestOptions,\n\ttype ProviderResponse,\n\ttype SimpleStreamOptions,\n\ttype StreamOptions,\n\tSubmissionAdmissionError,\n\tstreamWithProgressTimeout,\n\ttype Usage,\n} from \"@earendil-works/pi-ai\";\nimport { findEnvKeys } from \"@earendil-works/pi-ai/compat\";\nimport * as builtinProviderCatalog from \"@earendil-works/pi-ai/providers/all\";\nimport { getModelListing, type ModelListing, setModelListing } from \"@earendil-works/pi-ai/providers/model-listing\";\nimport { personalizeOpenRouterCatalog } from \"@earendil-works/pi-ai/providers/openrouter\";\nimport {\n\tassertChatModel,\n\tassertClassifierInputSupported,\n\tassertClassifierModel,\n\tassertImageModel,\n\tclassifierErrorResult,\n\timageErrorResult,\n} from \"@earendil-works/pi-ai/utils/model-operations\";\nimport { getAgentDir } from \"../config.ts\";\nimport { describeGatewayCredential, HUMAIN_GATEWAY_PROVIDER } from \"../humain/gateway/constants.ts\";\nimport { resolveHcodeEnvironment } from \"../humain/hcode/environment.ts\";\nimport {\n\tcreateHcodeFacade,\n\ttype HcodeContext,\n\ttype HcodeFacade,\n\ttype HcodeFacadeOptions,\n\ttype HcodeSupportSnapshot,\n\treferenceFromCredential,\n} from \"../humain/hcode/facade.ts\";\nimport { HCODE_PROVIDER } from \"../humain/hcode/http.ts\";\nimport type { HcodeAccountRef } from \"../humain/hcode/ports.ts\";\nimport { hcodeReferenceCredential } from \"../humain/hcode/provider.ts\";\nimport { HCODE_UNSUPPORTED_THINKING_MESSAGE } from \"../humain/hcode/selection.ts\";\nimport type { CliMetadataError, CliMetadataOutcome } from \"../humain/metadata/contracts.ts\";\nimport type { MetadataProducer } from \"../humain/metadata/index.ts\";\nimport {\n\tFileNodeAccountMetadataStore,\n\tInMemoryNodeAccountMetadataStore,\n\ttype NodeAccountMetadataStore,\n} from \"../humain/node-account-fallback.ts\";\nimport { hasHumainNodeAdmissionTransport } from \"../humain/node-provider.ts\";\nimport { operationSignal, raceWithAbortSignal } from \"../utils/abort.ts\";\nimport {\n\tANTHROPIC_PROVIDER_ID,\n\tAnthropicRateLimitStore,\n\tisOfficialAnthropicBaseUrl,\n\tparseAnthropicRateLimits,\n} from \"./anthropic-account-reporting.ts\";\nimport { AccountSourceReplacementError, AuthStorage as DefaultAuthStorage } from \"./auth-storage.ts\";\nimport { filterBedrockCatalog } from \"./model-catalog-filter.ts\";\nimport { ModelConfig } from \"./model-config.ts\";\nimport {\n\tadmissionIntent,\n\tassertAdmittedModelInput,\n\ttype ModelRequestAdmission,\n\treconcileAdmittedUsage,\n\tsubmissionAdmission,\n} from \"./model-request-admission.ts\";\nimport { FileModelsStore, InMemoryCodingAgentModelsStore } from \"./models-store.ts\";\nimport {\n\ttype AccountRemoveResult,\n\tOAUTH_ACCOUNT_IDENTITY_FIELDS,\n\tOAuthAccountPool,\n\tsameCredential,\n} from \"./oauth-account-pool.ts\";\nimport {\n\ttype AuthStatus,\n\ttype CompatibilityRequestConfig,\n\tcomposeModelProvider,\n\tconfiguredRequestAuthStatus,\n\ttype ProviderConfigInput,\n\tresolveCompatibilityRequestConfig,\n\tresolveConfiguredModelHeaders,\n\tvalidateExtensionProvider,\n} from \"./provider-composer.ts\";\nimport { withPersonalizedCatalog, withRemoteCatalog } from \"./remote-catalog-provider.ts\";\nimport { isCommandConfigValue, resolveConfigValue } from \"./resolve-config-value.ts\";\nimport { RuntimeCredentials } from \"./runtime-credentials.ts\";\nimport { SafeCredentialError } from \"./safe-credential-error.ts\";\nimport {\n\tcreateVirtualModel,\n\tfindLatestResponse,\n\tisVirtualModel,\n\ttype ModelRoute,\n\ttype ModelRouteReason,\n\ttype VirtualModelDefinition,\n\twithVirtualModels,\n} from \"./virtual-models.ts\";\n\ninterface RegisteredVirtualModel {\n\tmodel: Model<Api>;\n\troute: VirtualModelDefinition[\"route\"];\n}\n\n/**\n * Every provider's chat models as they were when taken (what `getModels()` returned then, in its order), without building the\n * catalogs not yet built: such a provider is held as its listing, whose models are built when first needed. Every model of a\n * listing has the listing's provider as its `provider`.\n */\nclass ChatModelsSnapshot {\n\tprivate readonly parts: readonly (\n\t\t| { provider: string; listing: ModelListing; models?: undefined }\n\t\t| { provider: string; models: readonly Model<Api>[] }\n\t)[];\n\n\tconstructor(providers: readonly Provider[]) {\n\t\tthis.parts = providers.map((provider) => {\n\t\t\tconst listing = getModelListing(provider);\n\t\t\tif (listing) return { provider: provider.id, listing };\n\t\t\ttry {\n\t\t\t\treturn { provider: provider.id, models: provider.getModels() };\n\t\t\t} catch {\n\t\t\t\t// As in Models.getModels(): a provider whose getModels() throws has no models.\n\t\t\t\treturn { provider: provider.id, models: [] };\n\t\t\t}\n\t\t});\n\t}\n\n\t/** The models whose `provider` is one of `providers`, in order. */\n\tofProviders(providers: ReadonlySet<string>): Model<Api>[] {\n\t\tconst models: Model<Api>[] = [];\n\t\tfor (const part of this.parts) {\n\t\t\tif (part.models) {\n\t\t\t\tfor (const model of part.models) if (providers.has(model.provider)) models.push(model);\n\t\t\t} else if (providers.has(part.provider)) {\n\t\t\t\tmodels.push(...part.listing.models());\n\t\t\t}\n\t\t}\n\t\treturn models;\n\t}\n}\n\ninterface ModelRuntimeSnapshot {\n\tall: ChatModelsSnapshot;\n\tavailable: readonly Model<Api>[];\n\tconfiguredProviders: ReadonlySet<string>;\n\tstoredProviders: ReadonlySet<string>;\n\tauth: ReadonlyMap<string, AuthCheck | undefined>;\n}\n\nexport interface CreateModelRuntimeOptions {\n\t/** Credential storage. Defaults to the file at authPath. */\n\tcredentials?: CredentialStore;\n\t/** Host policy applied to raw credentials and each loaded/registered provider configuration before resolution. */\n\tconfigurationGuard?: (configuration: unknown) => void;\n\tauthPath?: string;\n\t/**\n\t * Multi-account OAuth pool. Defaults to `oauth-accounts.json` next to auth.json, or an\n\t * in-memory pool when a custom `credentials` store is supplied.\n\t */\n\toauthAccountPool?: OAuthAccountPool;\n\t/**\n\t * HUMAIN Node fallback policy and labels. Defaults to `humain-node-accounts.json` next to auth.json, or an\n\t * in-memory store when a custom `credentials` store is supplied.\n\t */\n\tnodeAccountMetadata?: NodeAccountMetadataStore;\n\tmodelsPath?: string | null;\n\tmodelsStore?: ModelsStore;\n\tmodelsStorePath?: string;\n\t/** Allow create() to refresh model catalogs over the network. Defaults to false. */\n\tallowModelNetwork?: boolean;\n\t/** Timeout for the create-time network model refresh. */\n\tmodelRefreshTimeoutMs?: number;\n\tcatalogBaseUrl?: string;\n\t/** Optional caller cancellation for initial cache restoration and availability checks. */\n\tsignal?: AbortSignal;\n\t/** Skip initial catalog and availability refresh. Static models remain available. */\n\trefreshOnCreate?: boolean;\n\t/** Trusted host dependencies for the fixed native account; never sourced from models.json or project settings. */\n\thcode?: HcodeFacadeOptions;\n\t/** @internal SDK/services-created contexts release owned resources after their final session owner leaves. */\n\tsessionOwned?: boolean;\n}\n\ntype OAuthAccountObserver = (providerId: string, accountKey: string | undefined) => void;\n\nexport interface ModelRuntimeSimpleStreamOptions extends ModelsSimpleStreamOptions {\n\t/** @internal Reports the account derived from the credential used for this request, before streaming. */\n\tonOAuthAccount?: OAuthAccountObserver;\n\t/** @internal Notifies the session of the physical target before request preparation can yield. */\n\tonPhysicalTarget?: (model: Model<Api>) => void;\n\t/** @internal Resolves live payload-hook interest after auth and header transforms. */\n\tresolveOnPayload?: (model: Model<Api>) => ModelsSimpleStreamOptions[\"onPayload\"];\n}\n\nexport interface ModelRuntimeAuthOverrides extends AuthOperationOptions {\n\t/** @internal Scoped to this auth resolution, never catalog checks or background requests. */\n\tonOAuthAccount?: OAuthAccountObserver;\n\tapiKey?: string;\n\tenv?: Record<string, string>;\n\t/** Require this much remaining OAuth-token validity; defaults to five minutes. */\n\tminOAuthValidityMs?: number;\n}\n\nexport type CredentialSynchronizationOperation =\n\t| \"login\"\n\t| \"logout\"\n\t| \"switchAccount\"\n\t| \"setRuntimeApiKey\"\n\t| \"removeRuntimeApiKey\";\n\n/** Secret-free account metadata, safe for display and host serialization. */\nexport interface AccountInfo {\n\tkey: string;\n\tlabel: string;\n\ttype: AuthType;\n\tactive: boolean;\n\teffective: boolean;\n\texhaustedUntil?: number;\n}\n\nexport interface AccountSource {\n\tsource: \"runtime\" | \"auth_json\" | \"configuration\" | \"environment\";\n\tlabel: string;\n\ttype: AuthType;\n\treadOnly: true;\n\t/** Selected source for the next dispatch, not proof that its credential is valid. */\n\teffective: boolean;\n}\n\n/** Credentials changed successfully, but the local model/auth snapshot could not be synchronized. */\nexport class CredentialSynchronizationError extends Error {\n\treadonly providerId: string;\n\treadonly operation: CredentialSynchronizationOperation;\n\n\tconstructor(providerId: string, operation: CredentialSynchronizationOperation) {\n\t\tsuper(\n\t\t\t`Credential ${operation} committed, but local synchronization failed. Refresh local models or restart before retrying requests.`,\n\t\t);\n\t\tthis.name = \"CredentialSynchronizationError\";\n\t\tthis.providerId = providerId;\n\t\tthis.operation = operation;\n\t}\n}\n\n/** Only prompt/login cancellation creates this marker; backend failures are never relayed. */\nclass LoginCancellationError extends Error {\n\tconstructor() {\n\t\tsuper(\"Login cancelled\");\n\t\tthis.name = \"AbortError\";\n\t}\n}\n\n/** Providers whose origin, headers and models are fixed; overlays would bypass their request safeguards. */\nconst OVERLAY_REJECTING_PROVIDERS: ReadonlySet<string> = new Set([HUMAIN_GATEWAY_PROVIDER, HCODE_PROVIDER]);\n\nfunction assertCustomProviderId(providerId: string): void {\n\tif (providerId === HCODE_PROVIDER)\n\t\tthrow new Error(\"HUMAIN Code account does not accept custom registration or API keys.\");\n}\n\nfunction rejectsConfigOverlays(providerId: string): boolean {\n\treturn OVERLAY_REJECTING_PROVIDERS.has(providerId);\n}\n\nfunction 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\nconst CREDENTIAL_HEADERS = [\"x-api-key\", \"authorization\"] as const;\n\nfunction headerValue(headers: ProviderHeaders | undefined, lowerName: string): string | null | undefined {\n\tfor (const [name, value] of Object.entries(headers ?? {})) if (name.toLowerCase() === lowerName) return value;\n\treturn undefined;\n}\n\n/** True when the final request headers replace or add a credential header the resolved auth did not supply. */\nfunction overridesCredentialHeaders(\n\tresolved: ProviderHeaders | undefined,\n\tfinal: ProviderHeaders | undefined,\n): boolean {\n\treturn CREDENTIAL_HEADERS.some((name) => headerValue(final, name) !== headerValue(resolved, name));\n}\n\n/** Why a request was made. `bug-report` is internal: it is never written to the trace payload. */\nexport type ModelRequestPurpose = \"chat\" | \"compaction\" | \"branch-summary\" | \"cache-warming\" | \"bug-report\";\n\n/** Outcome of one observed submission. Carries no hidden reasoning and no credentials. */\nexport interface ModelResponseObservation {\n\tpurpose: ModelRequestPurpose | undefined;\n\trequestId: string;\n\tsubmissionId: string;\n\tsubmissionNumber: number;\n\toperation: ProviderRequestObservation[\"operation\"];\n\tprovider: string;\n\tapi: string;\n\tmodel: string;\n\t/** `pending` on a superseded submission: its transport outcome was never observed. */\n\tstopReason: \"pending\" | \"stop\" | \"length\" | \"toolUse\" | \"error\" | \"aborted\" | \"deferred\";\n\t/** Final assistant message for chat requests. */\n\tmessage?: AssistantMessage;\n\terrorMessage?: string;\n\tusage?: Usage;\n\t/** True when a later submission of the same request (a transport retry) replaced this one; its outcome is unknown. */\n\tsuperseded: boolean;\n}\n\n/** Read-only, per-session receiver of actual provider submissions. Failures never affect requests. */\nexport interface ModelRequestObserver {\n\tonRequest(\n\t\tobservation: Readonly<ProviderRequestObservation>,\n\t\tpurpose: ModelRequestPurpose | undefined,\n\t): void | Promise<void>;\n\tonResponse(response: Readonly<ModelResponseObservation>): void | Promise<void>;\n\t/** No submission could be observed, or a direct call could not be attributed to one session. */\n\tonUnattributed?(): void | Promise<void>;\n}\n\ninterface ModelRequestScope {\n\tobserver: ModelRequestObserver;\n\tpurpose: ModelRequestPurpose | undefined;\n}\n\ninterface ModelRequestAdmissionScope {\n\tadmission: ModelRequestAdmission;\n\tobservers: Set<ModelRequestObserver>;\n}\n\nfunction swallow(fn: () => void | Promise<void>): void {\n\ttry {\n\t\tconst result = fn();\n\t\tif (result) result.catch(() => {});\n\t} catch {\n\t\t// Observation is best effort.\n\t}\n}\n\ntype SubmissionLink = Pick<\n\tProviderRequestObservation,\n\t\"requestId\" | \"submissionId\" | \"submissionNumber\" | \"operation\" | \"provider\" | \"api\" | \"model\"\n>;\n\n/**\n * Collects the submissions of one logical request and reports their outcome once. Only the latest\n * submission is held (without its body); a newer submission settles the previous one at once as\n * superseded, so every submission is answered with O(1) storage however many a request makes.\n */\nclass RequestTracker {\n\tprivate readonly scope: ModelRequestScope | undefined;\n\tprivate readonly admission: ModelRequestAdmission | undefined;\n\tprivate readonly model: AnyModel;\n\tprivate latest: SubmissionLink | undefined;\n\tprivate settled = false;\n\n\tconstructor(scope: ModelRequestScope | undefined, model: AnyModel, admission?: ModelRequestAdmission) {\n\t\tthis.scope = scope;\n\t\tthis.admission = admission;\n\t\tthis.model = model;\n\t}\n\n\t/** Wraps a caller `onRequest` so the observer sees the same submissions. */\n\thook(caller: ProviderRequestOptions[\"onRequest\"]): NonNullable<ProviderRequestOptions[\"onRequest\"]> {\n\t\treturn async (value) => {\n\t\t\tconst previous = this.latest;\n\t\t\tthis.latest = {\n\t\t\t\trequestId: value.requestId,\n\t\t\t\tsubmissionId: value.submissionId,\n\t\t\t\tsubmissionNumber: value.submissionNumber,\n\t\t\t\toperation: value.operation,\n\t\t\t\tprovider: value.provider,\n\t\t\t\tapi: value.api,\n\t\t\t\tmodel: value.model,\n\t\t\t};\n\t\t\ttry {\n\t\t\t\tawait this.scope?.observer.onRequest(value, this.scope.purpose);\n\t\t\t} catch {\n\t\t\t\t// Observation is best effort.\n\t\t\t}\n\t\t\t// The transport outcome of a replaced submission is not visible here: report it as unknown.\n\t\t\tif (previous) this.report(previous, { stopReason: \"pending\" }, true);\n\t\t\tawait caller?.(value);\n\t\t};\n\t}\n\n\tsettleMessage(message: AssistantMessage): void {\n\t\tthis.settle({\n\t\t\tstopReason: message.stopReason,\n\t\t\tmessage,\n\t\t\terrorMessage: message.errorMessage,\n\t\t\tusage: message.usage,\n\t\t});\n\t}\n\n\tsettleResult(result: { stopReason: string; errorMessage?: string; usage?: Usage }): void {\n\t\tconst stopReason = result.stopReason === \"error\" || result.stopReason === \"aborted\" ? result.stopReason : \"stop\";\n\t\tthis.settle({ stopReason, errorMessage: result.errorMessage, usage: result.usage });\n\t}\n\n\tsettleFailure(aborted: boolean): void {\n\t\tthis.settle({ stopReason: aborted ? \"aborted\" : \"error\" });\n\t}\n\n\tprivate settle(outcome: Pick<ModelResponseObservation, \"stopReason\" | \"message\" | \"errorMessage\" | \"usage\">): void {\n\t\tif (this.settled) return;\n\t\tthis.settled = true;\n\t\tif (this.latest) {\n\t\t\tif (this.admission) reconcileAdmittedUsage(this.admission, this.latest, outcome.usage, this.model);\n\t\t\tthis.report(this.latest, outcome, false);\n\t\t} else if (this.scope) swallow(() => this.scope?.observer.onUnattributed?.());\n\t}\n\n\tprivate report(\n\t\tsubmission: SubmissionLink,\n\t\toutcome: Pick<ModelResponseObservation, \"stopReason\" | \"message\" | \"errorMessage\" | \"usage\">,\n\t\tsuperseded: boolean,\n\t): void {\n\t\tconst response: ModelResponseObservation = {\n\t\t\tpurpose: this.scope?.purpose,\n\t\t\trequestId: submission.requestId,\n\t\t\tsubmissionId: submission.submissionId,\n\t\t\tsubmissionNumber: submission.submissionNumber,\n\t\t\toperation: submission.operation,\n\t\t\tprovider: submission.provider,\n\t\t\tapi: submission.api,\n\t\t\tmodel: submission.model,\n\t\t\t...outcome,\n\t\t\tsuperseded,\n\t\t};\n\t\tswallow(() => this.scope?.observer.onResponse(response));\n\t}\n}\n\n/** Configured pi-ai Models collection used by coding-agent and SDK consumers. */\nexport class ModelRuntime implements Models {\n\tprivate readonly models: MutableModels;\n\tprivate readonly hcodeFacade: HcodeFacade;\n\tprivate readonly sessionOwned: boolean;\n\tprivate hcodeSession: HcodeAccountRef | undefined;\n\t/** Shared token-free account/usage facet, independent of the selected model. */\n\treadonly hcode: HcodeContext;\n\t/** Scalar-only observation bridge; no account, raw enqueue, identity, or flush API. */\n\treadonly metadata: Pick<MetadataProducer, \"feature\" | \"tool\" | \"inference\" | \"failure\">;\n\tprivate readonly credentials: RuntimeCredentials;\n\tprivate readonly configurationGuard: ((configuration: unknown) => void) | undefined;\n\tprivate readonly oauthAccountPool: OAuthAccountPool;\n\t/** Secret-free HUMAIN Node fallback policy and user labels; keys stay in the credential pool. */\n\treadonly nodeAccountMetadata: NodeAccountMetadataStore;\n\t/** Latest Anthropic API rate-limit headers per account, observed from this runtime's own responses. */\n\treadonly anthropicRateLimits = new AnthropicRateLimitStore();\n\tprivate readonly defaultBuiltins: ReadonlyMap<string, Provider>;\n\tprivate readonly builtins = new Map<string, Provider>();\n\tprivate readonly nativeExtensionProviders = new Map<string, Provider>();\n\tprivate readonly extensionProviders = new Map<string, ProviderConfigInput>();\n\t/** Virtual models by provider id, then model id. */\n\tprivate readonly virtualModels = new Map<string, Map<string, RegisteredVirtualModel>>();\n\tprivate readonly compositionErrors = new Map<string, string>();\n\tprivate readonly modelsPath: string | undefined;\n\tprivate readonly modelNetworkEnabled: boolean;\n\tprivate config: ModelConfig;\n\tprivate snapshot: ModelRuntimeSnapshot = {\n\t\tall: new ChatModelsSnapshot([]),\n\t\tavailable: [],\n\t\tconfiguredProviders: new Set(),\n\t\tstoredProviders: new Set(),\n\t\tauth: new Map(),\n\t};\n\tprivate availabilityRefreshSeq = 0;\n\tprivate availabilityErrorSeq = 0;\n\tprivate readonly providerAvailabilitySeq = new Map<string, number>();\n\tprivate availabilityError: string | undefined;\n\tprivate readonly credentialOperations = new Map<string, Promise<unknown>>();\n\tprivate readonly oauthAccountObserver = new AsyncLocalStorage<OAuthAccountObserver | undefined>();\n\tprivate readonly resolvedRequestAuth = new AsyncLocalStorage<{\n\t\tmodel: AnyModel;\n\t\tresolution: AuthResult;\n\t\taccountKey: string | undefined;\n\t}>();\n\tprivate readonly requestScope = new AsyncLocalStorage<ModelRequestScope>();\n\tprivate readonly admissionScope = new AsyncLocalStorage<ModelRequestAdmissionScope>();\n\tprivate readonly activeAdmissions = new Set<ModelRequestAdmissionScope>();\n\t/** Observers of sessions that own this runtime; they attribute direct calls made outside any request scope. */\n\tprivate readonly ownerObservers = new Set<ModelRequestObserver>();\n\n\tprivate constructor(\n\t\tcredentials: RuntimeCredentials,\n\t\toauthAccountPool: OAuthAccountPool,\n\t\tnodeAccountMetadata: NodeAccountMetadataStore,\n\t\tconfig: ModelConfig,\n\t\tmodelsPath: string | undefined,\n\t\tmodelsStore: ModelsStore,\n\t\tproviders: readonly Provider[],\n\t\tmodelNetworkEnabled: boolean,\n\t\thcodeFacade: HcodeFacade,\n\t\tsessionOwned: boolean,\n\t\tconfigurationGuard?: (configuration: unknown) => void,\n\t) {\n\t\tthis.hcodeFacade = hcodeFacade;\n\t\tthis.hcode = hcodeFacade.context;\n\t\tthis.metadata = {\n\t\t\tfeature: (...args) => swallow(() => hcodeFacade.metadata.feature(...args)),\n\t\t\ttool: (...args) => swallow(() => hcodeFacade.metadata.tool(...args)),\n\t\t\tinference: (...args) => swallow(() => hcodeFacade.metadata.inference(...args)),\n\t\t\tfailure: (...args) => swallow(() => hcodeFacade.metadata.failure(...args)),\n\t\t};\n\t\tthis.sessionOwned = sessionOwned;\n\t\tthis.credentials = credentials;\n\t\tthis.configurationGuard = configurationGuard;\n\t\tthis.assertConfiguration(config);\n\t\tthis.oauthAccountPool = oauthAccountPool;\n\t\tthis.nodeAccountMetadata = nodeAccountMetadata;\n\t\tthis.config = config;\n\t\tthis.modelsPath = modelsPath;\n\t\tthis.modelNetworkEnabled = modelNetworkEnabled;\n\t\tthis.defaultBuiltins = new Map(providers.map((provider) => [provider.id, provider]));\n\t\tfor (const [providerId, provider] of this.defaultBuiltins) this.builtins.set(providerId, provider);\n\t\tthis.models = createModels({ credentials, modelsStore });\n\t\tthis.rebuildProviders();\n\t}\n\n\tstatic async create(options: CreateModelRuntimeOptions = {}): Promise<ModelRuntime> {\n\t\tconst environment = resolveHcodeEnvironment(options.hcode?.environment);\n\t\tif (options.hcode?.profile && options.hcode.profile.environmentId !== environment.id)\n\t\t\tthrow new Error(\"HUMAIN Code account environment conflicts with the requested environment.\");\n\t\tconst credentials = new RuntimeCredentials(\n\t\t\toptions.credentials ?? DefaultAuthStorage.create(options.authPath),\n\t\t\tenvironment.id,\n\t\t\toptions.configurationGuard,\n\t\t);\n\t\tconst oauthAccountPool =\n\t\t\toptions.oauthAccountPool ??\n\t\t\t(options.credentials\n\t\t\t\t? OAuthAccountPool.inMemory(credentials.accountStore)\n\t\t\t\t: OAuthAccountPool.create(\n\t\t\t\t\t\tcredentials.accountStore,\n\t\t\t\t\t\tjoin(dirname(options.authPath ?? join(getAgentDir(), \"auth.json\")), \"oauth-accounts.json\"),\n\t\t\t\t\t));\n\t\tconst nodeAccountMetadata =\n\t\t\toptions.nodeAccountMetadata ??\n\t\t\t(options.credentials\n\t\t\t\t? new InMemoryNodeAccountMetadataStore()\n\t\t\t\t: new FileNodeAccountMetadataStore(\n\t\t\t\t\t\tjoin(dirname(options.authPath ?? join(getAgentDir(), \"auth.json\")), \"humain-node-accounts.json\"),\n\t\t\t\t\t));\n\t\tconst modelsPath =\n\t\t\toptions.modelsPath === null ? undefined : (options.modelsPath ?? join(getAgentDir(), \"models.json\"));\n\t\tconst config = await ModelConfig.load(modelsPath);\n\t\tconst modelsStore =\n\t\t\toptions.modelsStore ??\n\t\t\t(modelsPath\n\t\t\t\t? new FileModelsStore(options.modelsStorePath ?? join(dirname(modelsPath), \"models-store.json\"))\n\t\t\t\t: new InMemoryCodingAgentModelsStore());\n\t\tconst builtinModelDataGeneratedAt = builtinProviderCatalog.getBuiltinModelDataGeneratedAt();\n\t\tconst providers = builtinProviderCatalog\n\t\t\t.builtinProviders()\n\t\t\t.map((provider) => {\n\t\t\t\tif (provider.id === \"radius\") return provider;\n\t\t\t\t// OpenRouter narrows the catalog to the models, limits and prices of the user's key.\n\t\t\t\tif (provider.id === \"openrouter\") {\n\t\t\t\t\treturn withPersonalizedCatalog(\n\t\t\t\t\t\tprovider,\n\t\t\t\t\t\tpersonalizeOpenRouterCatalog,\n\t\t\t\t\t\toptions.catalogBaseUrl,\n\t\t\t\t\t\tbuiltinModelDataGeneratedAt,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn withRemoteCatalog(provider, options.catalogBaseUrl, builtinModelDataGeneratedAt);\n\t\t\t})\n\t\t\t.map((provider) => {\n\t\t\t\tif (provider.id !== \"amazon-bedrock\") return provider;\n\t\t\t\tconst getModels = provider.getModels.bind(provider);\n\t\t\t\tconst filtered: Provider = { ...provider, getModels: () => filterBedrockCatalog(getModels()) };\n\t\t\t\t// The filter keeps or drops models by id alone: the listing is filtered as the models are.\n\t\t\t\treturn setModelListing(filtered, () => {\n\t\t\t\t\tconst listing = getModelListing(provider);\n\t\t\t\t\treturn listing && { entries: filterBedrockCatalog(listing.entries), models: filtered.getModels };\n\t\t\t\t});\n\t\t\t});\n\t\tconst hcodeFacade = createHcodeFacade(\n\t\t\t{\n\t\t\t\t...options.hcode,\n\t\t\t\tpublication: {\n\t\t\t\t\t// A durable decision must reject I/O failure, not use AuthStorage's signal-free cached-read fallback.\n\t\t\t\t\tread: async (signal) =>\n\t\t\t\t\t\treferenceFromCredential(\n\t\t\t\t\t\t\tawait credentials.readStored(HCODE_PROVIDER, { signal: operationSignal(signal) }),\n\t\t\t\t\t\t),\n\t\t\t\t\tclear: async (expected, signal) => {\n\t\t\t\t\t\tawait credentials.deleteStored(HCODE_PROVIDER, {\n\t\t\t\t\t\t\tsignal,\n\t\t\t\t\t\t\tifCurrent: (current) =>\n\t\t\t\t\t\t\t\texpected !== null && sameCredential(current, hcodeReferenceCredential(expected)),\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tawait credentials.readStored(HCODE_PROVIDER, { signal: options.signal }),\n\t\t);\n\t\t// Trusted builtin installation bypasses no custom registration guard and survives reconstruction.\n\t\tproviders.push(hcodeFacade.provider);\n\t\tconst runtime = new ModelRuntime(\n\t\t\tcredentials,\n\t\t\toauthAccountPool,\n\t\t\tnodeAccountMetadata,\n\t\t\tconfig,\n\t\t\tmodelsPath,\n\t\t\tmodelsStore,\n\t\t\tproviders,\n\t\t\tprocess.env.PI_OFFLINE === undefined,\n\t\t\thcodeFacade,\n\t\t\toptions.sessionOwned === true,\n\t\t\toptions.configurationGuard,\n\t\t);\n\t\t// The public account port must use the same CAS publisher as runtime/provider login.\n\t\thcodeFacade.context.account.login = async (interaction, signal) => {\n\t\t\tconst credential = await runtime.login(HCODE_PROVIDER, \"api_key\", {\n\t\t\t\t...interaction,\n\t\t\t\tsignal: interaction.signal ? AbortSignal.any([interaction.signal, signal]) : signal,\n\t\t\t});\n\t\t\tconst reference = referenceFromCredential(credential);\n\t\t\tif (!reference) throw new ModelsError(\"auth\", \"HUMAIN Code account changed.\");\n\t\t\treturn reference;\n\t\t};\n\t\truntime.configureRadiusProviders();\n\t\truntime.rebuildProviders();\n\t\tconst refreshFromNetwork = runtime.modelNetworkEnabled && options.allowModelNetwork === true;\n\t\tconst controller =\n\t\t\trefreshFromNetwork && options.modelRefreshTimeoutMs !== undefined ? new AbortController() : undefined;\n\t\tconst timeout = controller ? setTimeout(() => controller.abort(), options.modelRefreshTimeoutMs) : undefined;\n\t\tconst signal = controller\n\t\t\t? options.signal\n\t\t\t\t? AbortSignal.any([options.signal, controller.signal])\n\t\t\t\t: controller.signal\n\t\t\t: options.signal;\n\t\ttry {\n\t\t\tif (options.refreshOnCreate !== false) {\n\t\t\t\tawait runtime.refresh({\n\t\t\t\t\tallowNetwork: refreshFromNetwork,\n\t\t\t\t\t// Native catalogs require an explicit account action, not generic startup network consent.\n\t\t\t\t\tproviders: refreshFromNetwork\n\t\t\t\t\t\t? runtime\n\t\t\t\t\t\t\t\t.getProviders()\n\t\t\t\t\t\t\t\t.filter((provider) => provider.id !== HCODE_PROVIDER)\n\t\t\t\t\t\t\t\t.map((provider) => provider.id)\n\t\t\t\t\t\t: undefined,\n\t\t\t\t\tsignal,\n\t\t\t\t});\n\t\t\t}\n\t\t} catch (error) {\n\t\t\truntime.dispose();\n\t\t\tthrow error;\n\t\t} finally {\n\t\t\tif (timeout) clearTimeout(timeout);\n\t\t}\n\t\treturn runtime;\n\t}\n\n\tprivate assertConfiguration(config: ModelConfig): void {\n\t\tif (this.configurationGuard)\n\t\t\tthis.configurationGuard(Object.fromEntries(config.getProviderIds().map((id) => [id, config.getProvider(id)])));\n\t}\n\n\tprivate configureRadiusProviders(): void {\n\t\tthis.builtins.clear();\n\t\tfor (const [providerId, provider] of this.defaultBuiltins) this.builtins.set(providerId, provider);\n\t\tfor (const providerId of this.config.getProviderIds()) {\n\t\t\tif (providerId === HCODE_PROVIDER) continue;\n\t\t\tconst config = this.config.getProvider(providerId);\n\t\t\tif (config?.oauth !== \"radius\" || !config.baseUrl) continue;\n\t\t\tthis.builtins.set(\n\t\t\t\tproviderId,\n\t\t\t\tbuiltinProviderCatalog.radiusProvider({\n\t\t\t\t\tid: providerId,\n\t\t\t\t\tname: config.name ?? providerId,\n\t\t\t\t\tgateway: config.baseUrl.replace(/\\/v1\\/?$/u, \"\"),\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate providerIds(): Set<string> {\n\t\treturn new Set([\n\t\t\t...this.builtins.keys(),\n\t\t\t...this.nativeExtensionProviders.keys(),\n\t\t\t...this.config.getProviderIds(),\n\t\t\t...this.extensionProviders.keys(),\n\t\t\t...this.virtualModels.keys(),\n\t\t]);\n\t}\n\n\t/** Returns the provider without virtual models, or undefined when only virtual models define it. */\n\tprivate recomposeProvider(providerId: string): Provider | undefined {\n\t\tconst composed = this.composeProvider(providerId);\n\t\tlet provider = composed;\n\t\tif (provider?.auth.apiKey) {\n\t\t\tconst apiKey = provider.auth.apiKey;\n\t\t\tconst withCredentialEnv = (input: Parameters<typeof apiKey.resolve>[0]) => {\n\t\t\t\tconst env = input.credential?.env;\n\t\t\t\tconst ctx = input.ctx;\n\t\t\t\treturn env\n\t\t\t\t\t? { ...input, ctx: { ...ctx, env: async (name: string) => env[name] || (await ctx.env(name)) } }\n\t\t\t\t\t: input;\n\t\t\t};\n\t\t\tprovider = {\n\t\t\t\t...provider,\n\t\t\t\tauth: {\n\t\t\t\t\t...provider.auth,\n\t\t\t\t\tapiKey: {\n\t\t\t\t\t\t...apiKey,\n\t\t\t\t\t\tresolve: async (input) => {\n\t\t\t\t\t\t\tif (input.purpose !== \"catalog\") {\n\t\t\t\t\t\t\t\tconst result = await apiKey.resolve(withCredentialEnv(input));\n\t\t\t\t\t\t\t\tconst key =\n\t\t\t\t\t\t\t\t\t!this.credentials.hasRuntimeApiKey(providerId) &&\n\t\t\t\t\t\t\t\t\tinput.credential?.key &&\n\t\t\t\t\t\t\t\t\tinput.credential.key === result?.auth.apiKey\n\t\t\t\t\t\t\t\t\t\t? this.oauthAccountPool.getAccountKeyForApiKey(providerId, input.credential.key)\n\t\t\t\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\t\t\t\tthis.oauthAccountObserver.getStore()?.(providerId, key);\n\t\t\t\t\t\t\t\treturn result;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Models restores caches first. Evaluate commands only when it authorizes online auth.\n\t\t\t\t\t\t\tconst credential = await this.credentials.authResolution.run(providerId, () =>\n\t\t\t\t\t\t\t\tthis.credentials.read(providerId, { signal: input.signal }),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif (credential?.type === \"oauth\") return undefined;\n\t\t\t\t\t\t\treturn apiKey.resolve(withCredentialEnv({ ...input, credential }));\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcheck: apiKey.check ? (input) => apiKey.check!(withCredentialEnv(input)) : undefined,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tconst oauth = provider?.auth.oauth;\n\t\tif (provider && oauth && this.oauthAccountPool.isPooled(providerId)) {\n\t\t\tprovider = {\n\t\t\t\t...provider,\n\t\t\t\tauth: {\n\t\t\t\t\t...provider.auth,\n\t\t\t\t\toauth: {\n\t\t\t\t\t\t...oauth,\n\t\t\t\t\t\trefresh: async (credential, signal) => {\n\t\t\t\t\t\t\tconst refreshed = { ...(await oauth.refresh(credential, signal)) };\n\t\t\t\t\t\t\tfor (const field of OAUTH_ACCOUNT_IDENTITY_FIELDS) {\n\t\t\t\t\t\t\t\tif (refreshed[field] === undefined && credential[field] !== undefined) {\n\t\t\t\t\t\t\t\t\trefreshed[field] = credential[field];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn refreshed;\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttoAuth: async (credential) => {\n\t\t\t\t\t\t\tconst auth = await oauth.toAuth(credential);\n\t\t\t\t\t\t\tthis.oauthAccountObserver.getStore()?.(\n\t\t\t\t\t\t\t\tproviderId,\n\t\t\t\t\t\t\t\tthis.oauthAccountPool.getAccountIdentity(providerId, credential)?.key,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn auth;\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tif (providerId === \"openrouter\" && provider?.refreshModels && !this.nativeExtensionProviders.has(providerId)) {\n\t\t\tconst refreshModels = provider.refreshModels.bind(provider);\n\t\t\tprovider = {\n\t\t\t\t...provider,\n\t\t\t\trefreshModels: async (context) => {\n\t\t\t\t\tlet credential = context.credential;\n\t\t\t\t\tif (!context.allowNetwork && credential?.type !== \"oauth\") {\n\t\t\t\t\t\tconst stored = this.credentials.getRuntimeApiKey(providerId)\n\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t: await this.credentials.readStored(providerId, { signal: context.signal });\n\t\t\t\t\t\tconst command =\n\t\t\t\t\t\t\tthis.credentials.isExternalCredential(stored) &&\n\t\t\t\t\t\t\tstored?.type === \"api_key\" &&\n\t\t\t\t\t\t\tstored.key !== undefined &&\n\t\t\t\t\t\t\tisCommandConfigValue(stored.key);\n\t\t\t\t\t\tconst configuredKey =\n\t\t\t\t\t\t\tthis.extensionProviders.get(providerId)?.apiKey ?? this.config.getProvider(providerId)?.apiKey;\n\t\t\t\t\t\t// Cache identity checks must not execute commands, resolve headers or refresh OAuth.\n\t\t\t\t\t\tlet key = credential?.key || credential?.env?.OPENROUTER_API_KEY || process.env.OPENROUTER_API_KEY;\n\t\t\t\t\t\tif (command) key = undefined;\n\t\t\t\t\t\telse if (!credential && configuredKey !== undefined) {\n\t\t\t\t\t\t\tkey = isCommandConfigValue(configuredKey) ? undefined : resolveConfigValue(configuredKey);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcredential = key ? { ...credential, type: \"api_key\", key } : undefined;\n\t\t\t\t\t}\n\t\t\t\t\tawait refreshModels({ ...context, credential });\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\t// The wrappers above change auth and refresh only: the provider's models are still named by its listing.\n\t\tif (provider && composed && provider !== composed) setModelListing(provider, () => getModelListing(composed));\n\t\tconst virtualModels = [...(this.virtualModels.get(providerId)?.values() ?? [])].map((entry) => entry.model);\n\t\tif (virtualModels.length > 0) this.models.setProvider(withVirtualModels(providerId, provider, virtualModels));\n\t\telse if (provider) this.models.setProvider(provider);\n\t\telse this.models.deleteProvider(providerId);\n\t\treturn provider;\n\t}\n\n\t/** The provider without virtual models, or undefined when nothing defines it. */\n\tprivate composeProvider(providerId: string): Provider | undefined {\n\t\tconst base = this.nativeExtensionProviders.get(providerId) ?? this.builtins.get(providerId);\n\t\tconst extension = this.extensionProviders.get(providerId);\n\t\t// HUMAIN Gateway origin, headers and models are fixed; overlays would bypass its request safeguards.\n\t\tif (rejectsConfigOverlays(providerId) && (this.config.getProvider(providerId) || extension)) {\n\t\t\tthis.compositionErrors.set(\n\t\t\t\tproviderId,\n\t\t\t\t`${providerId === HCODE_PROVIDER ? \"HUMAIN Code account\" : \"HUMAIN Gateway\"} does not accept models.json overrides.`,\n\t\t\t);\n\t\t\treturn base;\n\t\t}\n\t\tif (!this.config.getProvider(providerId) && !extension) {\n\t\t\t// No overlays: use the builtin untouched so its auth/login/stream behavior is exact.\n\t\t\tthis.compositionErrors.delete(providerId);\n\t\t\treturn base;\n\t\t}\n\t\ttry {\n\t\t\tconst provider = composeModelProvider(providerId, base, this.config, extension);\n\t\t\tthis.compositionErrors.delete(providerId);\n\t\t\treturn provider;\n\t\t} catch (error) {\n\t\t\tthis.compositionErrors.set(providerId, error instanceof Error ? error.message : String(error));\n\t\t\treturn base;\n\t\t}\n\t}\n\n\tprivate rebuildProviders(): void {\n\t\tthis.models.clearProviders();\n\t\tthis.compositionErrors.clear();\n\t\tfor (const providerId of this.providerIds()) this.recomposeProvider(providerId);\n\t\tthis.updateModelSnapshot();\n\t}\n\n\tprivate updateModelSnapshot(): void {\n\t\tconst all = new ChatModelsSnapshot(this.models.getProviders());\n\t\tthis.snapshot = {\n\t\t\t...this.snapshot,\n\t\t\tall,\n\t\t\tavailable: all.ofProviders(this.snapshot.configuredProviders),\n\t\t};\n\t}\n\n\tprivate async runAvailabilityRefresh(seq: number, errorSeq: number, signal: AbortSignal): Promise<void> {\n\t\tconst providers = this.models.getProviders();\n\t\tconst [available, checks, credentials] = await Promise.all([\n\t\t\tthis.models.getAvailable(undefined, { signal }),\n\t\t\tPromise.all(\n\t\t\t\tproviders.map(\n\t\t\t\t\tasync (provider): Promise<[string, AuthCheck | undefined]> => [\n\t\t\t\t\t\tprovider.id,\n\t\t\t\t\t\tawait this.models.checkAuth(provider.id, { signal }),\n\t\t\t\t\t],\n\t\t\t\t),\n\t\t\t),\n\t\t\tthis.credentials.list({ signal }),\n\t\t]);\n\t\tif (seq !== this.availabilityRefreshSeq) return;\n\t\tconst auth = new Map(checks);\n\t\tconst configuredProviders = new Set(\n\t\t\tchecks\n\t\t\t\t.filter((entry): entry is [string, AuthCheck] => entry[1] !== undefined)\n\t\t\t\t.map(([providerId]) => providerId),\n\t\t);\n\t\tthis.snapshot = {\n\t\t\tall: new ChatModelsSnapshot(this.models.getProviders()),\n\t\t\tavailable: [...available],\n\t\t\tconfiguredProviders,\n\t\t\tstoredProviders: new Set(credentials.map((entry) => entry.providerId)),\n\t\t\tauth,\n\t\t};\n\t\tif (errorSeq === this.availabilityErrorSeq) this.availabilityError = undefined;\n\t}\n\n\tprivate queueAvailabilityRefresh(signal?: AbortSignal): Promise<void> {\n\t\tconst seq = ++this.availabilityRefreshSeq;\n\t\tfor (const [providerId, providerSeq] of this.providerAvailabilitySeq) {\n\t\t\tthis.providerAvailabilitySeq.set(providerId, providerSeq + 1);\n\t\t}\n\t\tconst errorSeq = ++this.availabilityErrorSeq;\n\t\tconst effectiveSignal = operationSignal(signal);\n\t\treturn this.runAvailabilityRefresh(seq, errorSeq, effectiveSignal).catch((error) => {\n\t\t\tif (errorSeq === this.availabilityErrorSeq && !effectiveSignal.aborted) {\n\t\t\t\tthis.availabilityError = error instanceof Error ? error.message : String(error);\n\t\t\t}\n\t\t\tthrow error;\n\t\t});\n\t}\n\n\tprivate async refreshProviderAvailability(providerId: string, signal: AbortSignal): Promise<void> {\n\t\t// Invalidate any full availability pass that started before this credential change.\n\t\t++this.availabilityRefreshSeq;\n\t\tconst providerSeq = (this.providerAvailabilitySeq.get(providerId) ?? 0) + 1;\n\t\tthis.providerAvailabilitySeq.set(providerId, providerSeq);\n\t\tconst errorSeq = ++this.availabilityErrorSeq;\n\t\ttry {\n\t\t\tconst [available, auth, credential] = await Promise.all([\n\t\t\t\tthis.models.getAvailable(providerId, { signal }),\n\t\t\t\tthis.models.checkAuth(providerId, { signal }),\n\t\t\t\tthis.credentials.read(providerId, { signal }),\n\t\t\t]);\n\t\t\tsignal.throwIfAborted();\n\t\t\tif (this.providerAvailabilitySeq.get(providerId) !== providerSeq) return;\n\t\t\tconst configuredProviders = new Set(this.snapshot.configuredProviders);\n\t\t\tconst storedProviders = new Set(this.snapshot.storedProviders);\n\t\t\tconst authByProvider = new Map(this.snapshot.auth);\n\t\t\tif (auth) {\n\t\t\t\tconfiguredProviders.add(providerId);\n\t\t\t\tauthByProvider.set(providerId, auth);\n\t\t\t} else {\n\t\t\t\tconfiguredProviders.delete(providerId);\n\t\t\t\tauthByProvider.delete(providerId);\n\t\t\t}\n\t\t\tif (credential) storedProviders.add(providerId);\n\t\t\telse storedProviders.delete(providerId);\n\t\t\tconst all = new ChatModelsSnapshot(this.models.getProviders());\n\t\t\tconst availableById = new Map(\n\t\t\t\t[...this.snapshot.available.filter((model) => model.provider !== providerId), ...available].map((model) => [\n\t\t\t\t\t`${model.provider}\\0${model.id}`,\n\t\t\t\t\tmodel,\n\t\t\t\t]),\n\t\t\t);\n\t\t\t// (Only the providers of these models have models to look up.)\n\t\t\tconst availableProviders = new Set(Array.from(availableById.values(), (model) => model.provider));\n\t\t\tthis.snapshot = {\n\t\t\t\tall,\n\t\t\t\tavailable: all\n\t\t\t\t\t.ofProviders(availableProviders)\n\t\t\t\t\t.flatMap((model) => availableById.get(`${model.provider}\\0${model.id}`) ?? []),\n\t\t\t\tconfiguredProviders,\n\t\t\t\tstoredProviders,\n\t\t\t\tauth: authByProvider,\n\t\t\t};\n\t\t\tif (errorSeq === this.availabilityErrorSeq) this.availabilityError = undefined;\n\t\t} catch (error) {\n\t\t\tif (\n\t\t\t\tthis.providerAvailabilitySeq.get(providerId) === providerSeq &&\n\t\t\t\terrorSeq === this.availabilityErrorSeq &&\n\t\t\t\t!signal.aborted\n\t\t\t) {\n\t\t\t\tthis.availabilityError = error instanceof Error ? error.message : String(error);\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tgetProviders(): readonly Provider[] {\n\t\treturn this.models.getProviders();\n\t}\n\n\tgetProvider(providerId: string): Provider | undefined {\n\t\treturn this.models.getProvider(providerId);\n\t}\n\n\tgetModels(providerId?: string): readonly Model<Api>[] {\n\t\treturn this.models.getModels(providerId);\n\t}\n\n\tgetModel(providerId: string, modelId: string): Model<Api> | undefined {\n\t\treturn this.models.getModel(providerId, modelId);\n\t}\n\n\t/**\n\t * Every chat model in `getModels()` order, for choosing models by provider, id and name without building every catalog:\n\t * a provider whose catalog is not built yet is listed by stand-ins that have only `provider`, `id` and `name`.\n\t * `model()` returns the model a stand-in stands for (building that provider's catalog), and a model as it is.\n\t */\n\tgetModelChoices(): { models: readonly Model<Api>[]; model(choice: Model<Api>): Model<Api> } {\n\t\tconst models: Model<Api>[] = [];\n\t\tconst standIns = new Map<Model<Api>, { listing: ModelListing; index: number }>();\n\t\tfor (const provider of this.models.getProviders()) {\n\t\t\tconst listing = getModelListing(provider);\n\t\t\tif (!listing) {\n\t\t\t\ttry {\n\t\t\t\t\tmodels.push(...provider.getModels());\n\t\t\t\t} catch {\n\t\t\t\t\t// As in Models.getModels(): a provider whose getModels() throws has no models.\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tlisting.entries.forEach((entry, index) => {\n\t\t\t\tconst standIn = entry as Model<Api>;\n\t\t\t\tmodels.push(standIn);\n\t\t\t\tstandIns.set(standIn, { listing, index });\n\t\t\t});\n\t\t}\n\t\treturn {\n\t\t\tmodels,\n\t\t\tmodel: (choice) => {\n\t\t\t\tconst standIn = standIns.get(choice);\n\t\t\t\treturn standIn ? standIn.listing.models()[standIn.index] : choice;\n\t\t\t},\n\t\t};\n\t}\n\n\tgetModelsOfType<TType extends ModelType>(type: TType, providerId?: string): readonly ModelTypeMap[TType][] {\n\t\treturn this.models.getModelsOfType(type, providerId);\n\t}\n\n\tgetModelOfType<TType extends ModelType>(\n\t\ttype: TType,\n\t\tproviderId: string,\n\t\tmodelId: string,\n\t): ModelTypeMap[TType] | undefined {\n\t\treturn this.models.getModelOfType(type, providerId, modelId);\n\t}\n\n\tgetAllModels(providerId?: string): readonly AnyModel[] {\n\t\treturn this.models.getAllModels(providerId);\n\t}\n\n\tgetAvailableOfType<TType extends ModelType>(\n\t\ttype: TType,\n\t\tproviderId?: string,\n\t\toptions?: AuthOperationOptions,\n\t): Promise<readonly ModelTypeMap[TType][]> {\n\t\treturn this.models.getAvailableOfType(type, providerId, options);\n\t}\n\n\tgetAllAvailable(providerId?: string, options?: AuthOperationOptions): Promise<readonly AnyModel[]> {\n\t\treturn this.models.getAllAvailable(providerId, options);\n\t}\n\n\tasync checkAuth(providerId: string, options?: AuthOperationOptions): Promise<AuthCheck | undefined> {\n\t\treturn this.models.checkAuth(providerId, options);\n\t}\n\n\tasync getAvailable(providerId?: string, options?: AuthOperationOptions): Promise<readonly Model<Api>[]> {\n\t\tif (providerId) {\n\t\t\tconst errorSeq = ++this.availabilityErrorSeq;\n\t\t\ttry {\n\t\t\t\tconst available = await this.models.getAvailable(providerId, options);\n\t\t\t\tif (errorSeq === this.availabilityErrorSeq) this.availabilityError = undefined;\n\t\t\t\treturn available;\n\t\t\t} catch (error) {\n\t\t\t\tif (errorSeq === this.availabilityErrorSeq && !options?.signal?.aborted) {\n\t\t\t\t\tthis.availabilityError = error instanceof Error ? error.message : String(error);\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t\tawait this.queueAvailabilityRefresh(options?.signal);\n\t\treturn this.snapshot.available;\n\t}\n\n\tgetAvailableSnapshot(): readonly Model<Api>[] {\n\t\treturn this.snapshot.available;\n\t}\n\n\tgetError(): string | undefined {\n\t\tconst errors: string[] = [];\n\t\tconst configError = this.config.getError();\n\t\tif (configError) errors.push(configError);\n\t\tfor (const [providerId, error] of this.compositionErrors) {\n\t\t\terrors.push(`Provider \"${providerId}\": ${error}`);\n\t\t}\n\t\tif (this.availabilityError) errors.push(`Availability refresh: ${this.availabilityError}`);\n\t\tconst poolError = this.oauthAccountPool.getError();\n\t\tif (poolError) errors.push(poolError);\n\t\treturn errors.length > 0 ? errors.join(\"\\n\\n\") : undefined;\n\t}\n\n\tgetRegisteredProviderConfig(providerId: string): ProviderConfigInput | undefined {\n\t\treturn this.extensionProviders.get(providerId);\n\t}\n\n\tgetRegisteredProviderIds(): readonly string[] {\n\t\treturn [...new Set([...this.extensionProviders.keys(), ...this.nativeExtensionProviders.keys()])];\n\t}\n\n\tgetRegisteredNativeProvider(providerId: string): Provider | undefined {\n\t\treturn this.nativeExtensionProviders.get(providerId);\n\t}\n\n\t/** @internal Compatibility fallback for ModelRegistry when provider auth is unconfigured. */\n\tgetCompatibilityRequestConfig(model: Model<Api>): CompatibilityRequestConfig {\n\t\tif (model.provider === HCODE_PROVIDER) throw new ModelsError(\"auth\", \"HUMAIN Code account is unavailable.\");\n\t\tif (rejectsConfigOverlays(model.provider)) return resolveCompatibilityRequestConfig(model, undefined, undefined);\n\t\treturn resolveCompatibilityRequestConfig(\n\t\t\tmodel,\n\t\t\tthis.config.getProvider(model.provider),\n\t\t\tthis.extensionProviders.get(model.provider),\n\t\t);\n\t}\n\n\tisUsingOAuth(providerId: string): boolean {\n\t\treturn this.snapshot.auth.get(providerId)?.type === \"oauth\";\n\t}\n\n\tisUsingSubscription(providerId: string): boolean {\n\t\tconst auth = this.models.getProvider(providerId)?.auth;\n\t\treturn this.isUsingOAuth(providerId)\n\t\t\t? auth?.oauth?.isSubscription === true\n\t\t\t: this.hasConfiguredAuth(providerId) && auth?.apiKey?.isSubscription === true;\n\t}\n\n\thasConfiguredAuth(providerId: string): boolean {\n\t\treturn this.snapshot.configuredProviders.has(providerId);\n\t}\n\n\t/** @internal Pin an already-resolved identity to this model's probe, without changing concurrent requests. */\n\twithResolvedAuth<T>(model: AnyModel, resolution: AuthResult, accountKey: string | undefined, run: () => T): T {\n\t\treturn this.resolvedRequestAuth.run({ model, resolution, accountKey }, run);\n\t}\n\n\tgetAuth(providerId: string, overrides?: ModelRuntimeAuthOverrides): Promise<AuthResult | undefined>;\n\tgetAuth(model: AnyModel, overrides?: ModelRuntimeAuthOverrides): Promise<AuthResult | undefined>;\n\tasync getAuth(\n\t\tproviderOrModel: string | AnyModel,\n\t\toverrides: ModelRuntimeAuthOverrides = {},\n\t): Promise<AuthResult | undefined> {\n\t\tconst providerId = typeof providerOrModel === \"string\" ? providerOrModel : providerOrModel.provider;\n\t\tconst pinned = this.resolvedRequestAuth.getStore();\n\t\tif (pinned?.model === providerOrModel) {\n\t\t\toverrides.signal?.throwIfAborted();\n\t\t\toverrides.onOAuthAccount?.(providerId, pinned.accountKey);\n\t\t\treturn pinned.resolution;\n\t\t}\n\t\tconst resolution = await this.credentials.authResolution.run(providerId, () =>\n\t\t\tthis.oauthAccountObserver.run(overrides.onOAuthAccount, () =>\n\t\t\t\ttypeof providerOrModel === \"string\"\n\t\t\t\t\t? this.models.getAuth(providerOrModel, overrides)\n\t\t\t\t\t: this.models.getAuth(providerOrModel, overrides),\n\t\t\t),\n\t\t);\n\t\tif (typeof providerOrModel === \"string\") return resolution;\n\t\tif (!resolution) return undefined;\n\t\t// Rejected HUMAIN Gateway overlays must not reach requests either.\n\t\tif (rejectsConfigOverlays(providerOrModel.provider)) return resolution;\n\t\tconst configuredHeaders = resolveConfiguredModelHeaders(\n\t\t\tproviderOrModel,\n\t\t\tthis.config.getProvider(providerOrModel.provider),\n\t\t\tthis.extensionProviders.get(providerOrModel.provider),\n\t\t\t{ ...(resolution.env ?? {}), ...(overrides.env ?? {}) },\n\t\t);\n\t\treturn {\n\t\t\t...resolution,\n\t\t\tauth: {\n\t\t\t\t...resolution.auth,\n\t\t\t\theaders: mergeHeaders(resolution.auth.headers, configuredHeaders),\n\t\t\t},\n\t\t};\n\t}\n\n\tprivate protectCredentialOperation<T>(operation: Promise<T>, signal?: AbortSignal, mutation = true): Promise<T> {\n\t\treturn operation.catch((error: unknown) => {\n\t\t\tif (error instanceof CredentialSynchronizationError)\n\t\t\t\tthrow new CredentialSynchronizationError(error.providerId, error.operation);\n\t\t\tif (error instanceof AccountSourceReplacementError) throw new AccountSourceReplacementError();\n\t\t\tif (error instanceof LoginCancellationError) throw new LoginCancellationError();\n\t\t\t// Fixed-text errors stay readable; a fresh instance drops any cause or extra properties.\n\t\t\tif (error instanceof SafeCredentialError && !signal?.aborted) throw new SafeCredentialError(error.message);\n\t\t\t// Backends can reject after writing. Never claim rollback or attach arbitrary errors, causes or abort reasons.\n\t\t\tconst safe = new ModelsError(\n\t\t\t\t\"auth\",\n\t\t\t\tmutation\n\t\t\t\t\t? \"Credential operation failed. Stored state may have changed. Inspect accounts and refresh local models before retrying.\"\n\t\t\t\t\t: \"Could not read account metadata. Check credential storage and provider configuration.\",\n\t\t\t);\n\t\t\tif (signal?.aborted) safe.name = \"AbortError\";\n\t\t\tthrow safe;\n\t\t});\n\t}\n\n\tprivate enqueueCredentialOperation<T>(providerId: string, signal: AbortSignal, task: () => Promise<T>): Promise<T> {\n\t\tconst previous = this.credentialOperations.get(providerId) ?? Promise.resolve();\n\t\tlet markStarted: (() => void) | undefined;\n\t\tconst started = new Promise<void>((resolve) => {\n\t\t\tmarkStarted = resolve;\n\t\t});\n\t\tconst operation = (async () => {\n\t\t\tawait previous.catch(() => {});\n\t\t\tsignal.throwIfAborted();\n\t\t\tmarkStarted?.();\n\t\t\treturn task();\n\t\t})();\n\t\tconst tail = operation.catch(() => {});\n\t\tthis.credentialOperations.set(providerId, tail);\n\t\tvoid tail.then(() => {\n\t\t\tif (this.credentialOperations.get(providerId) === tail) this.credentialOperations.delete(providerId);\n\t\t});\n\t\treturn this.protectCredentialOperation(\n\t\t\traceWithAbortSignal(started, signal).then(() => operation),\n\t\t\tsignal,\n\t\t);\n\t}\n\n\tprivate async synchronizeCredentialState(\n\t\tproviderId: string,\n\t\toperation: CredentialSynchronizationOperation,\n\t\tsignal: AbortSignal,\n\t): Promise<void> {\n\t\ttry {\n\t\t\tsignal.throwIfAborted();\n\t\t\tthis.recomposeProvider(providerId);\n\t\t\tconst compositionError = this.compositionErrors.get(providerId);\n\t\t\t// The rejected Gateway overlay leaves the native provider intact, so credentials still sync.\n\t\t\tif (compositionError && !rejectsConfigOverlays(providerId)) throw new Error(compositionError);\n\t\t\tconst result = await this.models.refresh({ allowNetwork: false, providers: [providerId], signal });\n\t\t\tif (result.aborted) signal.throwIfAborted();\n\t\t\tconst refreshError = result.errors.get(providerId);\n\t\t\tif (refreshError) throw refreshError;\n\t\t\tthis.updateModelSnapshot();\n\t\t\tawait this.refreshProviderAvailability(providerId, signal);\n\t\t} catch {\n\t\t\t// Adapter failures may contain credentials, including nested causes and custom properties.\n\t\t\tconst error = new CredentialSynchronizationError(providerId, operation);\n\t\t\tif (this.compositionErrors.has(providerId)) this.compositionErrors.set(providerId, error.message);\n\t\t\tif (this.availabilityError) this.availabilityError = error.message;\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tasync setRuntimeApiKey(providerId: string, apiKey: string, options: AuthOperationOptions = {}): Promise<void> {\n\t\tassertCustomProviderId(providerId);\n\t\tconst signal = operationSignal(options.signal);\n\t\treturn this.enqueueCredentialOperation(providerId, signal, async () => {\n\t\t\tthis.credentials.setRuntimeApiKey(providerId, apiKey);\n\t\t\tawait this.synchronizeCredentialState(providerId, \"setRuntimeApiKey\", signal);\n\t\t});\n\t}\n\n\tremoveRuntimeApiKey(providerId: string, options: AuthOperationOptions = {}): Promise<void> {\n\t\tconst signal = operationSignal(options.signal);\n\t\treturn this.enqueueCredentialOperation(providerId, signal, async () => {\n\t\t\tthis.credentials.removeRuntimeApiKey(providerId);\n\t\t\tawait this.synchronizeCredentialState(providerId, \"removeRuntimeApiKey\", signal);\n\t\t});\n\t}\n\n\t/**\n\t * Raw stored credential for host-owned reporting: no command or environment resolution, so reading it runs nothing.\n\t * Sensitive; callers must never display, log or persist it.\n\t */\n\treadStoredCredential(providerId: string, options?: AuthOperationOptions): Promise<Credential | undefined> {\n\t\treturn this.protectCredentialOperation(this.credentials.readStored(providerId, options), options?.signal, false);\n\t}\n\n\t/** Wait for started credential and pooled-account writes before process exit. */\n\tasync settleCredentialWrites(): Promise<void> {\n\t\twhile (this.credentialOperations.size > 0) await Promise.all(this.credentialOperations.values());\n\t\tawait this.credentials.settled();\n\t\tawait this.oauthAccountPool.settled();\n\t}\n\n\tlistCredentials(options?: AuthOperationOptions): Promise<readonly CredentialInfo[]> {\n\t\treturn this.protectCredentialOperation(this.credentials.list(options), options?.signal, false);\n\t}\n\n\t/** Global account management. Lists contain metadata only, never resolved credentials. */\n\treadonly accounts = {\n\t\tlist: (providerId: string, options?: AuthOperationOptions): Promise<AccountInfo[]> =>\n\t\t\tthis.protectCredentialOperation(\n\t\t\t\t(async () => {\n\t\t\t\t\tconst { storedEffective } = await this.readAccountSources(providerId, options);\n\t\t\t\t\t// Native references are never pooled; a session overlay must not depend on saved storage.\n\t\t\t\t\tif (providerId === HCODE_PROVIDER) return [];\n\t\t\t\t\tconst accounts = await this.oauthAccountPool.listAccounts(providerId, options);\n\t\t\t\t\tconst current = await this.oauthAccountPool.getCurrentAccount(providerId, options);\n\t\t\t\t\treturn accounts.map(({ key, label, credential, exhaustedUntil }) => ({\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tlabel,\n\t\t\t\t\t\ttype: credential.type,\n\t\t\t\t\t\texhaustedUntil,\n\t\t\t\t\t\tactive: key === current?.key,\n\t\t\t\t\t\teffective: key === current?.key && storedEffective,\n\t\t\t\t\t}));\n\t\t\t\t})(),\n\t\t\t\toptions?.signal,\n\t\t\t\tfalse,\n\t\t\t),\n\t\tsources: (providerId: string, options?: AuthOperationOptions): Promise<AccountSource[]> =>\n\t\t\tthis.protectCredentialOperation(\n\t\t\t\tthis.readAccountSources(providerId, options).then((result) => result.sources),\n\t\t\t\toptions?.signal,\n\t\t\t\tfalse,\n\t\t\t),\n\t\tswitch: (\n\t\t\tproviderId: string,\n\t\t\taccountKey: string,\n\t\t\toptions: AuthOperationOptions = {},\n\t\t): Promise<AccountInfo | undefined> => {\n\t\t\tconst signal = operationSignal(options.signal);\n\t\t\treturn this.enqueueCredentialOperation(providerId, signal, async () => {\n\t\t\t\tconst account = await this.oauthAccountPool.setActiveAccount(providerId, accountKey, { signal });\n\t\t\t\tif (!account) return undefined;\n\t\t\t\tawait this.synchronizeCredentialState(providerId, \"switchAccount\", signal);\n\t\t\t\treturn (await this.accounts.list(providerId, { signal })).find((entry) => entry.key === accountKey);\n\t\t\t});\n\t\t},\n\t\trename: (\n\t\t\tproviderId: string,\n\t\t\taccountKey: string,\n\t\t\tlabel: string,\n\t\t\toptions?: AuthOperationOptions,\n\t\t): Promise<AccountInfo | undefined> =>\n\t\t\tthis.protectCredentialOperation(\n\t\t\t\t(async () => {\n\t\t\t\t\tconst account = await this.oauthAccountPool.renameAccount(providerId, accountKey, label, options);\n\t\t\t\t\treturn account\n\t\t\t\t\t\t? (await this.accounts.list(providerId, options)).find((entry) => entry.key === accountKey)\n\t\t\t\t\t\t: undefined;\n\t\t\t\t})(),\n\t\t\t\toptions?.signal,\n\t\t\t),\n\t\tremove: (\n\t\t\tproviderId: string,\n\t\t\taccountKey: string,\n\t\t\toptions?: AuthOperationOptions,\n\t\t): Promise<AccountRemoveResult[\"status\"]> => this.logoutWithStatus(providerId, { ...options, accountKey }),\n\t};\n\n\t/** Enumerate raw source metadata without OAuth refresh, configuration commands or custom resolve callbacks. */\n\tprivate async readAccountSources(\n\t\tproviderId: string,\n\t\toptions?: AuthOperationOptions,\n\t): Promise<{ sources: AccountSource[]; storedEffective: boolean }> {\n\t\tconst signal = operationSignal(options?.signal);\n\t\tconst provider = this.models.getProvider(providerId);\n\t\tconst session = providerId === HCODE_PROVIDER ? this.hcodeSession : undefined;\n\t\tconst stored = session ? undefined : await this.credentials.readStored(providerId, { signal });\n\t\tif (providerId === HCODE_PROVIDER) {\n\t\t\tconst credential = session ? hcodeReferenceCredential(session) : stored;\n\t\t\tconst checked = await provider?.auth.apiKey?.check?.({\n\t\t\t\tctx: defaultProviderAuthContext(),\n\t\t\t\tcredential: credential?.type === \"api_key\" ? credential : undefined,\n\t\t\t\tsignal,\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tsources: credential\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tsource: session ? \"runtime\" : \"auth_json\",\n\t\t\t\t\t\t\t\tlabel: this.hcodeFacade.provider.name,\n\t\t\t\t\t\t\t\ttype: \"api_key\",\n\t\t\t\t\t\t\t\treadOnly: true,\n\t\t\t\t\t\t\t\teffective: !!checked,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t]\n\t\t\t\t\t: [],\n\t\t\t\tstoredEffective: !session && !!checked,\n\t\t\t};\n\t\t}\n\t\tconst runtimeKey = this.credentials.getRuntimeApiKey(providerId);\n\t\tconst extensionKey = this.extensionProviders.get(providerId)?.apiKey;\n\t\tconst modelsKey = this.config.getProvider(providerId)?.apiKey;\n\t\tconst configKey = extensionKey ?? modelsKey;\n\t\tconst external = this.credentials.isExternalCredential(stored);\n\t\tconst sources: AccountSource[] = [];\n\t\tconst add = (source: AccountSource[\"source\"], label: string, effective = false) =>\n\t\t\tsources.push({ source, label, type: \"api_key\", readOnly: true, effective });\n\t\tif (runtimeKey) add(\"runtime\", \"runtime API key\", provider?.auth.apiKey !== undefined);\n\t\tif (stored?.type === \"api_key\" && (external || !stored.key?.trim()))\n\t\t\tadd(\n\t\t\t\t\"auth_json\",\n\t\t\t\tstored.key\n\t\t\t\t\t? isCommandConfigValue(stored.key)\n\t\t\t\t\t\t? \"command in auth.json\"\n\t\t\t\t\t\t: \"environment reference in auth.json\"\n\t\t\t\t\t: ((providerId === HUMAIN_GATEWAY_PROVIDER ? describeGatewayCredential(stored.env) : undefined) ??\n\t\t\t\t\t\t\t\"provider configuration in auth.json\"),\n\t\t\t);\n\t\tif (extensionKey !== undefined) add(\"configuration\", \"extension API key\");\n\t\tif (modelsKey !== undefined) add(\"configuration\", \"API key in models.json\");\n\t\tconst env = stored?.type === \"api_key\" ? stored.env : undefined;\n\t\tconst ambientNames =\n\t\t\tproviderId === \"amazon-bedrock\"\n\t\t\t\t? [\n\t\t\t\t\t\t\"AWS_BEARER_TOKEN_BEDROCK\",\n\t\t\t\t\t\t\"AWS_PROFILE\",\n\t\t\t\t\t\t\"AWS_ACCESS_KEY_ID\",\n\t\t\t\t\t\t\"AWS_SECRET_ACCESS_KEY\",\n\t\t\t\t\t\t\"AWS_SESSION_TOKEN\",\n\t\t\t\t\t\t\"AWS_CONTAINER_CREDENTIALS_RELATIVE_URI\",\n\t\t\t\t\t\t\"AWS_CONTAINER_CREDENTIALS_FULL_URI\",\n\t\t\t\t\t\t\"AWS_WEB_IDENTITY_TOKEN_FILE\",\n\t\t\t\t\t\t\"AWS_ROLE_ARN\",\n\t\t\t\t\t\t\"AWS_REGION\",\n\t\t\t\t\t\t\"AWS_DEFAULT_REGION\",\n\t\t\t\t\t\t\"AWS_SHARED_CREDENTIALS_FILE\",\n\t\t\t\t\t\t\"AWS_CONFIG_FILE\",\n\t\t\t\t\t]\n\t\t\t\t: providerId === \"google-vertex\"\n\t\t\t\t\t? [\"GOOGLE_APPLICATION_CREDENTIALS\", \"GOOGLE_CLOUD_PROJECT\", \"GCLOUD_PROJECT\", \"GOOGLE_CLOUD_LOCATION\"]\n\t\t\t\t\t: [];\n\t\tconst authEnvironmentNames = new Set([\n\t\t\t...(findEnvKeys(providerId) ?? []),\n\t\t\t...(findEnvKeys(providerId, env) ?? []),\n\t\t\t...ambientNames.filter((name) => !!(env?.[name] || process.env[name])),\n\t\t]);\n\t\tfor (const name of authEnvironmentNames) add(\"environment\", name);\n\t\tlet storedEffective = false;\n\t\tif (!runtimeKey && provider) {\n\t\t\tif (stored?.type === \"oauth\") {\n\t\t\t\tstoredEffective = provider.auth.oauth !== undefined;\n\t\t\t} else if (provider.auth.apiKey) {\n\t\t\t\tif (\n\t\t\t\t\texternal &&\n\t\t\t\t\tstored?.type === \"api_key\" &&\n\t\t\t\t\tstored.key !== undefined &&\n\t\t\t\t\tisCommandConfigValue(stored.key)\n\t\t\t\t) {\n\t\t\t\t\t// A command owns this dispatch branch; listing never runs it to validate its result.\n\t\t\t\t\tsources.find((entry) => entry.source === \"auth_json\")!.effective = true;\n\t\t\t\t} else if (!stored && configKey !== undefined) {\n\t\t\t\t\tconst configured = isCommandConfigValue(configKey) || resolveConfigValue(configKey) !== undefined;\n\t\t\t\t\tsources.find((entry) => entry.source === \"configuration\")!.effective = configured;\n\t\t\t\t} else {\n\t\t\t\t\t// Builtin resolvers only read environment/files. Never call an extension resolver for a list;\n\t\t\t\t\t// extensions can supply the side-effect-free ApiKeyAuth.check contract instead.\n\t\t\t\t\tconst base = this.nativeExtensionProviders.get(providerId) ?? this.builtins.get(providerId);\n\t\t\t\t\tconst method = base?.auth.apiKey;\n\t\t\t\t\tconst check =\n\t\t\t\t\t\tmethod?.check ?? (this.nativeExtensionProviders.has(providerId) ? undefined : method?.resolve);\n\t\t\t\t\tconst credential =\n\t\t\t\t\t\tstored?.type === \"api_key\"\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t...stored,\n\t\t\t\t\t\t\t\t\tkey:\n\t\t\t\t\t\t\t\t\t\texternal && stored.key !== undefined\n\t\t\t\t\t\t\t\t\t\t\t? resolveConfigValue(stored.key, stored.env)\n\t\t\t\t\t\t\t\t\t\t\t: stored.key,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\tconst ctx = defaultProviderAuthContext();\n\t\t\t\t\tconst usedEnvironment = new Set<string>();\n\t\t\t\t\tconst result = check\n\t\t\t\t\t\t? await check({\n\t\t\t\t\t\t\t\tctx: {\n\t\t\t\t\t\t\t\t\t...ctx,\n\t\t\t\t\t\t\t\t\tenv: async (name) => {\n\t\t\t\t\t\t\t\t\t\tconst value = env?.[name] || (await ctx.env(name));\n\t\t\t\t\t\t\t\t\t\tif (value && authEnvironmentNames.has(name)) usedEnvironment.add(name);\n\t\t\t\t\t\t\t\t\t\treturn value;\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tcredential,\n\t\t\t\t\t\t\t\tsignal,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t: undefined;\n\t\t\t\t\t// Native check labels are display text, not a source contract. Attribute by the inputs used,\n\t\t\t\t\t// never by arbitrary labels (which may themselves contain credential material).\n\t\t\t\t\tconst native = this.nativeExtensionProviders.has(providerId);\n\t\t\t\t\tconst source = native ? undefined : result?.source;\n\t\t\t\t\tstoredEffective =\n\t\t\t\t\t\t!!stored &&\n\t\t\t\t\t\t(native\n\t\t\t\t\t\t\t? check\n\t\t\t\t\t\t\t\t? !!result && usedEnvironment.size === 0\n\t\t\t\t\t\t\t\t: !!credential?.key\n\t\t\t\t\t\t\t: source === \"stored credential\" || source === \"stored\" || (!check && !!credential?.key));\n\t\t\t\t\tif (result && !storedEffective) {\n\t\t\t\t\t\tconst selectedNames =\n\t\t\t\t\t\t\tsource && sources.some((entry) => entry.label === source) ? [source] : [...usedEnvironment];\n\t\t\t\t\t\tlet marked = false;\n\t\t\t\t\t\tfor (const name of selectedNames) {\n\t\t\t\t\t\t\tconst entry = sources.find((entry) => entry.source === \"environment\" && entry.label === name);\n\t\t\t\t\t\t\tif (entry) {\n\t\t\t\t\t\t\t\tentry.effective = true;\n\t\t\t\t\t\t\t\tmarked = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!marked) add(\"environment\", \"ambient credentials\", true);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tconst storedSource = sources.find((entry) => entry.source === \"auth_json\");\n\t\tif (storedSource && storedEffective) storedSource.effective = true;\n\t\tsignal.throwIfAborted();\n\t\treturn { sources, storedEffective };\n\t}\n\n\t/** Request-boundary return. External overrides/references never authorize a stored-account switch. */\n\tasync prepareAccountRequest(\n\t\tproviderId: string,\n\t\tautoSwitch: () => boolean,\n\t\tskipKeys: ReadonlySet<string>,\n\t\tsignal?: AbortSignal,\n\t): Promise<void> {\n\t\tif (!autoSwitch() || this.credentials.hasRuntimeApiKey(providerId)) return;\n\t\tconst stored = await this.credentials.readStored(providerId, { signal });\n\t\tif (!stored || this.credentials.isExternalCredential(stored)) return;\n\t\tconst returned = await this.oauthAccountPool.returnToPreferred(providerId, {\n\t\t\tsignal,\n\t\t\tskipKeys,\n\t\t\tcanActivate: () => autoSwitch() && !this.credentials.hasRuntimeApiKey(providerId),\n\t\t});\n\t\tif (returned) await this.synchronizeCredentialState(providerId, \"switchAccount\", operationSignal(signal));\n\t}\n\n\t/** Low-level pool APIs contain credentials; never serialize them into UI, events or logs. */\n\tget oauthAccounts(): OAuthAccountPool {\n\t\treturn this.oauthAccountPool;\n\t}\n\n\tgetProviderAuthStatus(providerId: string): AuthStatus {\n\t\tif (providerId === HCODE_PROVIDER)\n\t\t\treturn this.hasConfiguredAuth(providerId)\n\t\t\t\t? { configured: true, source: this.hcodeSession ? \"runtime\" : \"stored\" }\n\t\t\t\t: { configured: false };\n\t\tif (this.credentials.hasRuntimeApiKey(providerId)) return { configured: true, source: \"runtime\" };\n\t\tif (this.snapshot.storedProviders.has(providerId)) return { configured: true, source: \"stored\" };\n\t\tconst configured = configuredRequestAuthStatus(\n\t\t\tthis.config.getProvider(providerId),\n\t\t\tthis.extensionProviders.get(providerId),\n\t\t);\n\t\tif (configured) return configured;\n\t\tconst check = this.snapshot.auth.get(providerId);\n\t\treturn check ? { configured: true, source: \"environment\", label: check.source } : { configured: false };\n\t}\n\n\tprivate async prepareRequest<\n\t\tTModel extends AnyModel,\n\t\tTOptions extends ProviderRequestOptions<TModel> &\n\t\t\tModelsRequestTransforms & {\n\t\t\t\tonOAuthAccount?: OAuthAccountObserver;\n\t\t\t\tonPhysicalTarget?: (model: TModel) => void;\n\t\t\t\tresolveOnPayload?: (model: TModel) => ProviderRequestOptions<TModel>[\"onPayload\"];\n\t\t\t},\n\t>(\n\t\tmodel: TModel,\n\t\toptions: TOptions | undefined,\n\t\tintent?: AttestationIntent,\n\t): Promise<{\n\t\tprovider: Provider;\n\t\tmodel: TModel;\n\t\toptions: Omit<TOptions, \"transformHeaders\"> & ProviderRequestOptions<TModel>;\n\t\ttracker: RequestTracker | undefined;\n\t}> {\n\t\tconst admission = this.currentAdmission();\n\t\tconst currentProvider = this.models.getProvider(model.provider);\n\t\t// Capture dispatch values once before qualification or any async auth/header callback can replace them.\n\t\tconst provider =\n\t\t\tcurrentProvider && (admission || options?.beforeSubmission ? { ...currentProvider } : currentProvider);\n\t\tif (admission || options?.beforeSubmission) {\n\t\t\tconst native = this.nativeExtensionProviders.get(model.provider);\n\t\t\t// Trust boundary: Node requires source-owned transport identity. Bedrock is installed through the\n\t\t\t// builtin catalog and source-owned module loader, not native extension registration.\n\t\t\tif (\n\t\t\t\t!intent ||\n\t\t\t\t!isModelType(model, \"chat\") ||\n\t\t\t\t![\"anthropic-messages\", \"bedrock-converse-stream\", \"openai-completions\", \"openai-responses\"].includes(\n\t\t\t\t\tmodel.api,\n\t\t\t\t) ||\n\t\t\t\t(native !== undefined && (!provider || !hasHumainNodeAdmissionTransport(native, provider))) ||\n\t\t\t\tthis.extensionProviders.get(model.provider)?.streamSimple\n\t\t\t) {\n\t\t\t\tthrow new SubmissionAdmissionError(\"unsupported-route\");\n\t\t\t}\n\t\t}\n\t\tthis.assertHcodeModel(model);\n\t\t// The agent's automatic transport selects the native provider's only supported protocol.\n\t\tif (model.provider === HCODE_PROVIDER && options && \"transport\" in options && options.transport === \"auto\")\n\t\t\toptions = { ...options, transport: \"sse\" };\n\t\tif (model.provider === HCODE_PROVIDER && this.currentRequestPurpose() === \"cache-warming\")\n\t\t\tthrow new ModelsError(\"model_validation\", \"HUMAIN Code account cache warming is disabled.\");\n\t\tconst signal =\n\t\t\tmodel.provider === HCODE_PROVIDER\n\t\t\t\t? AbortSignal.any([this.hcodeFacade.signal, ...(options?.signal ? [options.signal] : [])])\n\t\t\t\t: options?.signal;\n\t\tif (!provider) throw new ModelsError(\"provider\", `Unknown provider: ${model.provider}`);\n\t\tlet resolvedAccount: { provider: string; key: string | undefined } | undefined;\n\t\t// Anthropic rate-limit headers are only recorded for a credential whose account is identified for this request.\n\t\tconst observesAnthropicLimits = model.provider === ANTHROPIC_PROVIDER_ID;\n\t\tconst resolution = await this.getAuth(model, {\n\t\t\tapiKey: options?.apiKey,\n\t\t\tenv: options?.env,\n\t\t\tsignal,\n\t\t\tonOAuthAccount:\n\t\t\t\toptions?.onOAuthAccount || observesAnthropicLimits\n\t\t\t\t\t? (provider, key) => {\n\t\t\t\t\t\t\tresolvedAccount = { provider, key };\n\t\t\t\t\t\t}\n\t\t\t\t\t: undefined,\n\t\t});\n\t\tif (!resolution) throw new ModelsError(\"auth\", `Provider is not configured: ${model.provider}`);\n\n\t\tconst {\n\t\t\ttransformHeaders,\n\t\t\tresolveOnPayload,\n\t\t\tonPhysicalTarget: _onPhysicalTarget,\n\t\t\tonOAuthAccount: _onOAuthAccount,\n\t\t\t...rawProviderOptions\n\t\t} = options ?? {};\n\t\tconst providerOptions = rawProviderOptions as Omit<TOptions, \"transformHeaders\"> & ProviderRequestOptions<TModel>;\n\t\tconst requestModel: TModel = resolution.auth.baseUrl ? { ...model, baseUrl: resolution.auth.baseUrl } : model;\n\t\tconst sessionId =\n\t\t\t\"sessionId\" in providerOptions && typeof providerOptions.sessionId === \"string\"\n\t\t\t\t? providerOptions.sessionId\n\t\t\t\t: undefined;\n\t\tlet headers = mergeHeaders(\n\t\t\tmergeHeaders(getOpenCodeSessionHeaders(requestModel, sessionId), resolution.auth.headers),\n\t\t\tproviderOptions.headers,\n\t\t);\n\t\tif (transformHeaders) headers = await transformHeaders(headers ?? {});\n\t\t// Auth and extension callbacks can yield across native account/catalog replacement.\n\t\tthis.assertHcodeModel(model);\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\tconst apiKey = providerOptions.apiKey ?? resolution.auth.apiKey;\n\t\tlet attributedAccountKey: string | undefined;\n\t\tif ((options?.onOAuthAccount || observesAnthropicLimits) && this.oauthAccountPool.isPooled(model.provider)) {\n\t\t\t// OAuth-only providers still resolve stored auth even with an explicit request key. That\n\t\t\t// credential is not necessarily dispatched: preserve the key override and attribute it,\n\t\t\t// failing closed if its account is unknown. A resolved/refreshed key keeps its identity.\n\t\t\tattributedAccountKey =\n\t\t\t\tresolvedAccount?.provider === model.provider && apiKey === resolution.auth.apiKey\n\t\t\t\t\t? resolvedAccount.key\n\t\t\t\t\t: apiKey\n\t\t\t\t\t\t? this.oauthAccountPool.getAccountKeyForAccessToken(model.provider, apiKey)\n\t\t\t\t\t\t: undefined;\n\t\t\toptions?.onOAuthAccount?.(model.provider, attributedAccountKey);\n\t\t}\n\t\tconst callerOnResponse = providerOptions.onResponse;\n\t\tconst onResponse =\n\t\t\tobservesAnthropicLimits &&\n\t\t\tattributedAccountKey !== undefined &&\n\t\t\t!overridesCredentialHeaders(resolution.auth.headers, headers) &&\n\t\t\tisOfficialAnthropicBaseUrl(requestModel.baseUrl)\n\t\t\t\t? async (response: ProviderResponse, responseModel: TModel) => {\n\t\t\t\t\t\tthis.observeAnthropicLimits(attributedAccountKey, response);\n\t\t\t\t\t\tawait callerOnResponse?.(response, responseModel);\n\t\t\t\t\t}\n\t\t\t\t: callerOnResponse;\n\t\t// The one request boundary: every chat, image, classifier and deferred call is prepared here, so\n\t\t// the scope bound by the owning session observes it exactly once per real submission.\n\t\tconst scope = this.currentScope();\n\t\tconst tracker = scope || admission ? new RequestTracker(scope, requestModel, admission) : undefined;\n\t\tconst gate =\n\t\t\tadmission && intent ? submissionAdmission(admission, requestModel, intent, scope?.purpose) : undefined;\n\t\tconst callerGate = providerOptions.beforeSubmission;\n\t\tconst beforeSubmission = gate\n\t\t\t? async (observation: Readonly<ProviderRequestObservation>) => {\n\t\t\t\t\t// A caller veto precedes allocation; the run-owned gate cannot be replaced by request options.\n\t\t\t\t\tawait callerGate?.(observation);\n\t\t\t\t\tawait gate(observation);\n\t\t\t\t}\n\t\t\t: callerGate;\n\t\t// Payload hooks may run from a shared queue; rebind the scope so they see this request's purpose.\n\t\tconst callerOnPayload = resolveOnPayload ? resolveOnPayload(model) : providerOptions.onPayload;\n\t\tconst onPayload =\n\t\t\tscope && callerOnPayload\n\t\t\t\t? (payload: unknown, payloadModel: TModel) =>\n\t\t\t\t\t\tthis.requestScope.run(scope, () => callerOnPayload(payload, payloadModel))\n\t\t\t\t: callerOnPayload;\n\t\treturn {\n\t\t\tprovider,\n\t\t\tmodel: requestModel,\n\t\t\toptions: {\n\t\t\t\t...providerOptions,\n\t\t\t\tsignal,\n\t\t\t\tapiKey,\n\t\t\t\theaders,\n\t\t\t\tenv,\n\t\t\t\tonPayload,\n\t\t\t\t...(onResponse ? { onResponse } : {}),\n\t\t\t\t...(tracker ? { onRequest: tracker.hook(providerOptions.onRequest) } : {}),\n\t\t\t\t...(beforeSubmission ? { beforeSubmission } : {}),\n\t\t\t} as Omit<TOptions, \"transformHeaders\"> & ProviderRequestOptions<TModel>,\n\t\t\ttracker,\n\t\t};\n\t}\n\n\tprivate observeAnthropicLimits(accountKey: string, response: ProviderResponse): void {\n\t\ttry {\n\t\t\tconst snapshot = parseAnthropicRateLimits(response.headers, Date.now());\n\t\t\tif (snapshot) this.anthropicRateLimits.record(accountKey, snapshot);\n\t\t} catch {\n\t\t\t// Observation is best effort and never affects the request.\n\t\t}\n\t}\n\n\t/**\n\t * Run `fn` so every request it starts (including background work it schedules) is reported to\n\t * `observer`. The binding follows async context, so concurrent sessions sharing this runtime keep\n\t * their own observers.\n\t */\n\tobserveRequests<T>(observer: ModelRequestObserver, purpose: ModelRequestPurpose | undefined, fn: () => T): T {\n\t\t// The primary host binds observation after admission; nested observers cannot shed that run's gate.\n\t\tthis.admissionScope.getStore()?.observers.add(observer);\n\t\treturn this.requestScope.run({ observer, purpose }, fn);\n\t}\n\n\t/** Bind every descendant model helper to the host's frozen run budget, independently of observers. */\n\tasync admitRequests<T>(admission: ModelRequestAdmission, fn: () => Promise<T>): Promise<T> {\n\t\tif (this.admissionScope.getStore()) throw new SubmissionAdmissionError(\"unattributed\");\n\t\tconst scope: ModelRequestAdmissionScope = { admission, observers: new Set() };\n\t\tconst observer = this.requestScope.getStore()?.observer;\n\t\tif (observer) scope.observers.add(observer);\n\t\tthis.activeAdmissions.add(scope);\n\t\ttry {\n\t\t\treturn await this.admissionScope.run(scope, fn);\n\t\t} finally {\n\t\t\tthis.activeAdmissions.delete(scope);\n\t\t}\n\t}\n\n\tprivate currentAdmission(): ModelRequestAdmission | undefined {\n\t\tconst scope = this.admissionScope.getStore();\n\t\tif (!scope && this.activeAdmissions.size > 0) {\n\t\t\tconst observer = this.requestScope.getStore()?.observer;\n\t\t\t// Only an attributed session owner may run independently; read-only observation grants no admission.\n\t\t\tif (!observer || !this.ownerObservers.has(observer)) throw new SubmissionAdmissionError(\"unattributed\");\n\t\t\tfor (const active of this.activeAdmissions) {\n\t\t\t\tif (active.observers.has(observer)) throw new SubmissionAdmissionError(\"unattributed\");\n\t\t\t}\n\t\t}\n\t\treturn scope?.admission;\n\t}\n\n\t/** Observe only the installed version under the selected environment's lifetime/network veto. */\n\tobserveHcodeVersion(version: string): void {\n\t\tthis.hcodeFacade.observeVersion(version);\n\t}\n\n\t/** Export only already-available same-environment support IDs; never bootstrap account or identity state. */\n\tgetHcodeSupportSnapshot(signal: AbortSignal): Promise<HcodeSupportSnapshot> {\n\t\treturn this.hcodeFacade.supportSnapshot(signal);\n\t}\n\n\t/** Recheck the selected environment's public native profile without private account I/O. */\n\tprobeHcodeLogin(signal: AbortSignal): Promise<{ kind: \"ready\" } | { kind: \"unavailable\" }> {\n\t\treturn this.hcodeFacade.probeLogin(signal);\n\t}\n\n\t/** Revoke an ephemeral device family once; hosts explicitly own shutdown of injected runtimes. */\n\tasync shutdownHcodeSession(\n\t\tsignal: AbortSignal,\n\t): Promise<{ remoteRevocation: \"confirmed\" | \"unconfirmed\" | \"not-needed\" }> {\n\t\ttry {\n\t\t\treturn await this.hcodeFacade.shutdown(signal);\n\t\t} finally {\n\t\t\tthis.credentials.clearHcodeSessionReference();\n\t\t}\n\t}\n\n\t/** Application teardown must not revoke a borrowed host runtime. */\n\tshutdownOwnedHcodeSession(\n\t\tsignal: AbortSignal,\n\t): Promise<{ remoteRevocation: \"confirmed\" | \"unconfirmed\" | \"not-needed\" }> {\n\t\treturn this.sessionOwned\n\t\t\t? this.shutdownHcodeSession(signal)\n\t\t\t: Promise.resolve({ remoteRevocation: \"not-needed\" });\n\t}\n\n\t/** Stop owned private sends/publication without logout, persisted credential changes or an exit flush. */\n\tdispose(): void {\n\t\tthis.credentials.clearHcodeSessionReference();\n\t\tthis.hcodeFacade.dispose();\n\t}\n\n\t/** Register a session observer that owns direct calls on this runtime; returns the unregister function. */\n\taddOwnerObserver(observer: ModelRequestObserver): () => void {\n\t\tthis.ownerObservers.add(observer);\n\t\treturn () => {\n\t\t\tif (this.ownerObservers.delete(observer) && this.sessionOwned && this.ownerObservers.size === 0)\n\t\t\t\tthis.dispose();\n\t\t};\n\t}\n\n\t/**\n\t * The active request scope, else the sole owning session's chat scope for a direct SDK call. With\n\t * several owners the call cannot be attributed: nothing is observed and the first owner is told of the gap.\n\t */\n\tprivate currentScope(): ModelRequestScope | undefined {\n\t\tconst scope = this.requestScope.getStore();\n\t\tif (scope || this.ownerObservers.size === 0) return scope;\n\t\tif (this.ownerObservers.size === 1) {\n\t\t\tconst [observer] = this.ownerObservers;\n\t\t\treturn { observer, purpose: \"chat\" };\n\t\t}\n\t\t// One content-free notice is enough; the recorder is process-wide.\n\t\tconst [first] = this.ownerObservers;\n\t\tif (first?.onUnattributed) swallow(() => first.onUnattributed?.());\n\t\treturn undefined;\n\t}\n\n\t/** Purpose of the request scope the caller runs in; undefined outside a scope or for purpose-less requests. */\n\tcurrentRequestPurpose(): ModelRequestPurpose | undefined {\n\t\treturn this.requestScope.getStore()?.purpose;\n\t}\n\n\t/** Change the purpose of requests started by `fn`, keeping the current observer. No-op outside a scope. */\n\twithRequestPurpose<T>(purpose: ModelRequestPurpose | undefined, fn: () => T): T {\n\t\tconst scope = this.currentScope();\n\t\treturn scope ? this.observeRequests(scope.observer, purpose, fn) : fn();\n\t}\n\n\t/** Reject host-supplied native model facts at the SDK/router request boundary. */\n\tprivate assertHcodeModel(model: AnyModel): void {\n\t\tif (model.provider === HCODE_PROVIDER && this.getPhysicalModel(HCODE_PROVIDER, model.id) !== model)\n\t\t\tthrow new ModelsError(\"model_validation\", \"HUMAIN Code account approved model changed or is unavailable.\");\n\t}\n\n\t/** Keep the outer watchdog from turning a managed request into a resend instruction. */\n\tprivate guardHcodeTimeout(\n\t\tmodel: Model<Api>,\n\t\tstream: AssistantMessageEventStream,\n\t\tactualModel: () => Model<Api>,\n\t\tonTimeout: () => void,\n\t): AssistantMessageEventStream {\n\t\tif (model.provider !== HCODE_PROVIDER && !isVirtualModel(model)) return stream;\n\t\treturn lazyStream(model, async () => ({\n\t\t\tasync *[Symbol.asyncIterator]() {\n\t\t\t\tfor await (const event of stream) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tevent.type === \"error\" &&\n\t\t\t\t\t\tactualModel().provider === HCODE_PROVIDER &&\n\t\t\t\t\t\tevent.error.diagnostics?.some((entry) => entry.type === \"provider_no_progress_timeout\")\n\t\t\t\t\t) {\n\t\t\t\t\t\tonTimeout();\n\t\t\t\t\t\tevent.error.errorMessage = \"HUMAIN Code request unavailable. Do not automatically resend.\";\n\t\t\t\t\t\tevent.error.diagnostics = [\n\t\t\t\t\t\t\t{ type: \"provider_http_error\", timestamp: Date.now(), details: { retryable: false } },\n\t\t\t\t\t\t];\n\t\t\t\t\t}\n\t\t\t\t\tyield event;\n\t\t\t\t}\n\t\t\t},\n\t\t\tresult: () => stream.result(),\n\t\t}));\n\t}\n\n\tprivate inferenceObservation(\n\t\tmodel: Model<Api>,\n\t\tstarted: number,\n\t): (message: AssistantMessage | undefined, submissions: number, observedFailure?: CliMetadataError) => void {\n\t\t// Only a trusted declaration, captured before auth clones, may supply a public pair.\n\t\tconst native =\n\t\t\tthis.getPhysicalModel(model.provider, model.id) === model &&\n\t\t\t(model.provider === HCODE_PROVIDER ||\n\t\t\t\t(this.defaultBuiltins.has(model.provider) &&\n\t\t\t\t\t!this.nativeExtensionProviders.has(model.provider) &&\n\t\t\t\t\t!this.extensionProviders.has(model.provider) &&\n\t\t\t\t\t!this.config.getProvider(model.provider)));\n\t\tconst provider = native ? model.provider : \"other\";\n\t\tconst id = native && model.provider !== HCODE_PROVIDER ? model.id : \"other\";\n\t\treturn (message, submissions, observedFailure) => {\n\t\t\tconst usage = message?.usage;\n\t\t\tconst known = usage && !usage.usageIncomplete && usage.totalTokens > 0;\n\t\t\tconst token = (value: number | undefined) =>\n\t\t\t\tknown && value !== undefined && Number.isInteger(value) && value >= 0 && value <= 2147483647 ? value : null;\n\t\t\tconst outcome: CliMetadataOutcome =\n\t\t\t\tmessage?.stopReason === \"aborted\"\n\t\t\t\t\t? \"cancelled\"\n\t\t\t\t\t: message?.stopReason === \"stop\" || message?.stopReason === \"toolUse\"\n\t\t\t\t\t\t? usage?.usageIncomplete\n\t\t\t\t\t\t\t? \"unknown\"\n\t\t\t\t\t\t\t: \"success\"\n\t\t\t\t\t\t: \"failure\";\n\t\t\tconst retries = Math.max(0, submissions - 1);\n\t\t\tthis.metadata.inference(provider, id, {\n\t\t\t\tdurationMs: Math.min(2147483647, Math.round(performance.now() - started)),\n\t\t\t\tinputTokens: token(usage?.input),\n\t\t\t\toutputTokens: token(usage?.output),\n\t\t\t\tcacheReadTokens: token(usage?.cacheRead),\n\t\t\t\tcacheWriteTokens: token(usage?.cacheWrite),\n\t\t\t\tretries,\n\t\t\t\toutcome,\n\t\t\t});\n\t\t\tif (outcome !== \"success\") {\n\t\t\t\tconst http = message?.diagnostics?.findLast((entry) => entry.type === \"provider_http_error\");\n\t\t\t\tconst hcode = http?.details?.hcode;\n\t\t\t\tconst status =\n\t\t\t\t\thcode && typeof hcode === \"object\" && \"status\" in hcode ? hcode.status : http?.details?.status;\n\t\t\t\tconst code: CliMetadataError =\n\t\t\t\t\tobservedFailure ??\n\t\t\t\t\t(message?.diagnostics?.some((entry) => entry.type === \"provider_no_progress_timeout\")\n\t\t\t\t\t\t? \"timeout\"\n\t\t\t\t\t\t: status === 401\n\t\t\t\t\t\t\t? \"auth\"\n\t\t\t\t\t\t\t: status === 403\n\t\t\t\t\t\t\t\t? \"approval\"\n\t\t\t\t\t\t\t\t: status === 429\n\t\t\t\t\t\t\t\t\t? \"quota\"\n\t\t\t\t\t\t\t\t\t: message?.stopReason === \"length\"\n\t\t\t\t\t\t\t\t\t\t? \"invalid\"\n\t\t\t\t\t\t\t\t\t\t: \"transport\");\n\n\t\t\t\tthis.metadata.failure(\"prompt\", code, retries, outcome);\n\t\t\t}\n\t\t};\n\t}\n\n\t/** Report the outcome of a stream once it ends. */\n\tprivate trackStream(\n\t\tstream: AssistantMessageEventStream,\n\t\ttracker: () => RequestTracker | undefined,\n\t\tobserve?: (message: AssistantMessage | undefined) => void,\n\t): AssistantMessageEventStream {\n\t\tstream.result().then(\n\t\t\t(message) => {\n\t\t\t\tobserve?.(message);\n\t\t\t\ttracker()?.settleMessage(message);\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tobserve?.(undefined);\n\t\t\t\ttracker()?.settleFailure(false);\n\t\t\t},\n\t\t);\n\t\treturn stream;\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\tlet tracker: RequestTracker | undefined;\n\t\tconst observe = this.inferenceObservation(model, performance.now());\n\t\tlet observedFailure: CliMetadataError | undefined;\n\t\tlet submissions = 0;\n\t\tconst callerRequest = options?.onRequest;\n\t\tconst onRequest: ProviderRequestOptions[\"onRequest\"] = async (request) => {\n\t\t\tsubmissions++;\n\t\t\tawait callerRequest?.(request);\n\t\t};\n\t\treturn this.trackStream(\n\t\t\tthis.guardHcodeTimeout(\n\t\t\t\tmodel,\n\t\t\t\tstreamWithProgressTimeout(\n\t\t\t\t\tmodel,\n\t\t\t\t\tasync (signal) => {\n\t\t\t\t\t\tassertChatModel(model);\n\t\t\t\t\t\tconst intent = admissionIntent(model, options);\n\t\t\t\t\t\tif (this.currentAdmission()) intent.requiredImageCount = assertAdmittedModelInput(model, context);\n\t\t\t\t\t\tconst prepared = await this.prepareRequest(\n\t\t\t\t\t\t\tmodel,\n\t\t\t\t\t\t\t{ ...options, signal, onRequest } as StreamOptions & ModelsRequestTransforms,\n\t\t\t\t\t\t\tintent,\n\t\t\t\t\t\t);\n\t\t\t\t\t\ttracker = prepared.tracker;\n\t\t\t\t\t\tsignal.throwIfAborted();\n\t\t\t\t\t\treturn prepared.provider.stream(\n\t\t\t\t\t\t\tprepared.model,\n\t\t\t\t\t\t\ttranscript,\n\t\t\t\t\t\t\tprepared.options as ApiStreamOptions<TApi>,\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t\toptions,\n\t\t\t\t),\n\t\t\t\t() => model,\n\t\t\t\t() => {\n\t\t\t\t\tobservedFailure = \"timeout\";\n\t\t\t\t},\n\t\t\t),\n\t\t\t() => tracker,\n\t\t\t(message) => observe(message, submissions, observedFailure),\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 drainStream(this.stream(model, context, options));\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\tlet tracker: RequestTracker | undefined;\n\t\tlet requestModel = model;\n\t\tconst started = performance.now();\n\t\tlet observe = this.inferenceObservation(model, started);\n\t\tlet observedFailure: CliMetadataError | undefined;\n\t\tlet submissions = 0;\n\t\tconst callerRequest = options?.onRequest;\n\t\toptions = {\n\t\t\t...options,\n\t\t\tonRequest: async (request) => {\n\t\t\t\tsubmissions++;\n\t\t\t\tawait callerRequest?.(request);\n\t\t\t},\n\t\t};\n\t\treturn this.trackStream(\n\t\t\tthis.guardHcodeTimeout(\n\t\t\t\tmodel,\n\t\t\t\tstreamWithProgressTimeout(\n\t\t\t\t\tmodel,\n\t\t\t\t\tasync (signal) => {\n\t\t\t\t\t\tlet requestOptions = options;\n\t\t\t\t\t\tif (isVirtualModel(model)) {\n\t\t\t\t\t\t\t// Requests outside the agent loop are routed here. Callers sized them before routing, so\n\t\t\t\t\t\t\t// cap the output budget to the routed model.\n\t\t\t\t\t\t\tconst route = await this.resolveModel(model, transcript.messages, {\n\t\t\t\t\t\t\t\treason: \"direct\",\n\t\t\t\t\t\t\t\tthinkingLevel: options?.reasoning ?? \"off\",\n\t\t\t\t\t\t\t\tsignal,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tsignal.throwIfAborted();\n\t\t\t\t\t\t\tconst { maxTokens: limit } = route.model;\n\t\t\t\t\t\t\tconst maxTokens =\n\t\t\t\t\t\t\t\toptions?.maxTokens && limit > 0 ? Math.min(options.maxTokens, limit) : options?.maxTokens;\n\t\t\t\t\t\t\tconst reasoning = route.thinkingLevel === \"off\" ? undefined : route.thinkingLevel;\n\t\t\t\t\t\t\t// Caller credentials were resolved for the virtual model's provider. Another provider\n\t\t\t\t\t\t\t// resolves its own, so they are not sent to the wrong vendor.\n\t\t\t\t\t\t\tconst { apiKey, headers, env, ...rest } = options ?? {};\n\t\t\t\t\t\t\tconst auth = route.model.provider === model.provider ? { apiKey, headers, env } : {};\n\t\t\t\t\t\t\trequestModel = route.model;\n\t\t\t\t\t\t\trequestOptions = { ...rest, ...auth, maxTokens, reasoning };\n\t\t\t\t\t\t}\n\t\t\t\t\t\tobserve = this.inferenceObservation(requestModel, started);\n\t\t\t\t\t\trequestOptions?.onPhysicalTarget?.(requestModel);\n\t\t\t\t\t\tassertChatModel(requestModel);\n\t\t\t\t\t\tconst intent = admissionIntent(model, options);\n\t\t\t\t\t\tif (this.currentAdmission())\n\t\t\t\t\t\t\tintent.requiredImageCount = assertAdmittedModelInput(requestModel, context);\n\t\t\t\t\t\tconst prepared = await this.prepareRequest(requestModel, { ...requestOptions, signal }, intent);\n\t\t\t\t\t\ttracker = prepared.tracker;\n\t\t\t\t\t\tsignal.throwIfAborted();\n\t\t\t\t\t\treturn prepared.provider.streamSimple(\n\t\t\t\t\t\t\tprepared.model,\n\t\t\t\t\t\t\ttranscript,\n\t\t\t\t\t\t\tprepared.options as SimpleStreamOptions,\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t\toptions,\n\t\t\t\t),\n\t\t\t\t() => requestModel,\n\t\t\t\t() => {\n\t\t\t\t\tobservedFailure = \"timeout\";\n\t\t\t\t},\n\t\t\t),\n\t\t\t() => tracker,\n\t\t\t(message) => observe(message, submissions, observedFailure),\n\t\t);\n\t}\n\n\tcompleteSimple(model: Model<Api>, context: Context, options?: ModelsSimpleStreamOptions): Promise<AssistantMessage> {\n\t\treturn drainStream(this.streamSimple(model, context, options));\n\t}\n\n\tstreamDeferred(\n\t\tmodel: Model<Api>,\n\t\thandle: DeferredHandle,\n\t\toptions?: ModelsDeferredFetchOptions,\n\t): AssistantMessageEventStream {\n\t\tlet tracker: RequestTracker | undefined;\n\t\treturn this.trackStream(\n\t\t\tlazyStream(\n\t\t\t\tmodel,\n\t\t\t\tasync () => {\n\t\t\t\t\tassertChatModel(model);\n\t\t\t\t\tconst prepared = await this.prepareRequest(model, options);\n\t\t\t\t\ttracker = prepared.tracker;\n\t\t\t\t\tif (!prepared.provider.fetchDeferred) {\n\t\t\t\t\t\tthrow new ModelsError(\"provider\", `Provider ${model.provider} does not support deferred responses`);\n\t\t\t\t\t}\n\t\t\t\t\treturn prepared.provider.fetchDeferred(prepared.model, handle, prepared.options as DeferredFetchOptions);\n\t\t\t\t},\n\t\t\t\tundefined,\n\t\t\t\toptions?.signal,\n\t\t\t),\n\t\t\t() => tracker,\n\t\t);\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 drainStream(this.streamDeferred(model, handle, options));\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\tassertChatModel(model);\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\tasync generateImages(\n\t\tmodel: ImageModel<ImageApi>,\n\t\tcontext: ImagesContext,\n\t\toptions?: ModelsImagesOptions,\n\t): Promise<AssistantImages> {\n\t\tlet tracker: RequestTracker | undefined;\n\t\ttry {\n\t\t\tassertImageModel(model);\n\t\t\tconst prepared = await this.prepareRequest(model, options);\n\t\t\ttracker = prepared.tracker;\n\t\t\tif (!prepared.provider.generateImages) {\n\t\t\t\tthrow new ModelsError(\"provider\", `Provider ${model.provider} does not support image generation`);\n\t\t\t}\n\t\t\tconst result = await prepared.provider.generateImages(\n\t\t\t\tprepared.model,\n\t\t\t\tcontext,\n\t\t\t\tprepared.options as ImagesOptions,\n\t\t\t);\n\t\t\ttracker?.settleResult(result);\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\ttracker?.settleFailure(options?.signal?.aborted === true);\n\t\t\treturn imageErrorResult(model, error, options?.signal?.aborted);\n\t\t}\n\t}\n\n\tasync classify(\n\t\tmodel: ClassifierModel<ClassifierApi>,\n\t\tcontext: ClassifierContext,\n\t\toptions?: ModelsClassifierOptions,\n\t): Promise<ClassifierResult> {\n\t\tlet tracker: RequestTracker | undefined;\n\t\ttry {\n\t\t\tassertClassifierModel(model);\n\t\t\tassertClassifierInputSupported(model, context);\n\t\t\tconst prepared = await this.prepareRequest(model, options);\n\t\t\ttracker = prepared.tracker;\n\t\t\tif (!prepared.provider.classify) {\n\t\t\t\tthrow new ModelsError(\"provider\", `Provider ${model.provider} does not support classification`);\n\t\t\t}\n\t\t\tconst result = await prepared.provider.classify(\n\t\t\t\tprepared.model,\n\t\t\t\tcontext,\n\t\t\t\tprepared.options as ClassifierOptions,\n\t\t\t);\n\t\t\ttracker?.settleResult(result);\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\ttracker?.settleFailure(options?.signal?.aborted === true);\n\t\t\treturn classifierErrorResult(model, error, options?.signal?.aborted);\n\t\t}\n\t}\n\n\tlogin(\n\t\tproviderId: string,\n\t\ttype: AuthType,\n\t\tinteraction: AuthInteraction,\n\t\toptions?: LoginOptions & { accountKey?: string },\n\t): Promise<Credential> {\n\t\tconst signal = operationSignal(interaction.signal);\n\t\tconst started = performance.now();\n\t\treturn this.enqueueCredentialOperation(providerId, signal, async () => {\n\t\t\tconst provider = this.models.getProvider(providerId);\n\t\t\tif (!provider) throw new ModelsError(\"provider\", `Unknown provider: ${providerId}`);\n\t\t\tconst method = type === \"oauth\" ? provider.auth.oauth : provider.auth.apiKey;\n\t\t\tif (!method?.login) throw new ModelsError(\"auth\", `${provider.name} does not support ${type} login`);\n\t\t\tif (options?.accountKey !== undefined) {\n\t\t\t\tconst selected = (await this.oauthAccountPool.listAccounts(providerId, { signal })).find(\n\t\t\t\t\t(account) => account.key === options.accountKey,\n\t\t\t\t);\n\t\t\t\tif (!selected || selected.credential.type !== type)\n\t\t\t\t\tthrow new ModelsError(\"auth\", \"Account is no longer available for reauthentication\");\n\t\t\t}\n\t\t\tif (providerId === HCODE_PROVIDER) await this.hcodeFacade.recover(signal);\n\t\t\tconst nativeReference =\n\t\t\t\tproviderId === HCODE_PROVIDER ? await this.credentials.readStored(providerId, { signal }) : undefined;\n\t\t\tif (providerId !== HCODE_PROVIDER) await this.oauthAccountPool.adoptCurrentAccount(providerId, { signal });\n\t\t\tlet promptCancelled = false;\n\t\t\tlet login: Credential;\n\t\t\ttry {\n\t\t\t\tconst input: ProviderAuthInteraction = {\n\t\t\t\t\t...interaction,\n\t\t\t\t\tsignal,\n\t\t\t\t\tprompt: async (prompt) => {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\treturn await interaction.prompt(prompt);\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t// A callback winner aborts only its pending prompt, not the whole login.\n\t\t\t\t\t\t\tif (signal.aborted || !prompt.signal?.aborted) promptCancelled = true;\n\t\t\t\t\t\t\tthrow new LoginCancellationError();\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\tlogin = await raceWithAbortSignal<Credential>(\n\t\t\t\t\tproviderId === HCODE_PROVIDER\n\t\t\t\t\t\t? this.hcodeFacade\n\t\t\t\t\t\t\t\t.login(input, signal, async (reference) => {\n\t\t\t\t\t\t\t\t\t// The generic pool intentionally excludes keyless references; only native login may replace its observed reference.\n\t\t\t\t\t\t\t\t\tconst candidate = hcodeReferenceCredential(reference);\n\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\tawait this.credentials.modify(\n\t\t\t\t\t\t\t\t\t\t\tproviderId,\n\t\t\t\t\t\t\t\t\t\t\tasync (current) => {\n\t\t\t\t\t\t\t\t\t\t\t\tif (!sameCredential(current, nativeReference))\n\t\t\t\t\t\t\t\t\t\t\t\t\tthrow new SafeCredentialError(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"HUMAIN Code account reference changed. Refresh local models before retrying.\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\treturn candidate;\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t{ signal },\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\t\t\t\t// A backend may reject after writing; compensate only our candidate, never a competing publication.\n\t\t\t\t\t\t\t\t\t\tif (nativeReference)\n\t\t\t\t\t\t\t\t\t\t\tawait this.credentials.modify(providerId, async (current) =>\n\t\t\t\t\t\t\t\t\t\t\t\tsameCredential(current, candidate) ? nativeReference : undefined,\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\t\tawait this.credentials.deleteStored(providerId, {\n\t\t\t\t\t\t\t\t\t\t\t\tifCurrent: (current) => sameCredential(current, candidate),\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\tthrow error;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.then(hcodeReferenceCredential)\n\t\t\t\t\t\t: method.login(input, options),\n\t\t\t\t\tsignal,\n\t\t\t\t);\n\t\t\t} catch (error) {\n\t\t\t\tif (promptCancelled || signal.aborted) throw new LoginCancellationError();\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tif (promptCancelled) throw new LoginCancellationError();\n\t\t\t// Login returns credentials, not configuration expressions. Ambient-only entries stay external.\n\t\t\tconst poolable = login.type === \"oauth\" || !!login.key?.trim();\n\t\t\tif (options?.accountKey !== undefined && !poolable)\n\t\t\t\tthrow new ModelsError(\"auth\", \"Reauthentication must return a literal account credential\");\n\t\t\tconst account = poolable\n\t\t\t\t? await this.oauthAccountPool.addAccount(providerId, login, { signal, key: options?.accountKey })\n\t\t\t\t: undefined;\n\t\t\tconst credential = account?.credential ?? login;\n\t\t\tif (providerId === HCODE_PROVIDER) {\n\t\t\t\tconst reference = this.hcode.account.status(this.hcode.environmentId);\n\t\t\t\tif (!reference || login.type !== \"api_key\") throw new ModelsError(\"auth\", \"HUMAIN Code account changed.\");\n\t\t\t\tif (this.hcodeFacade.persistence(reference) === \"session\") {\n\t\t\t\t\tthis.hcodeSession = reference;\n\t\t\t\t\tthis.credentials.setHcodeSessionReference(login);\n\t\t\t\t\tawait this.synchronizeCredentialState(providerId, \"login\", signal);\n\t\t\t\t\treturn login;\n\t\t\t\t}\n\t\t\t\tthis.hcodeSession = undefined;\n\t\t\t} else if (!account) await commitLoginCredential(this.credentials.accountStore, providerId, login, signal);\n\t\t\tawait this.synchronizeCredentialState(providerId, \"login\", signal);\n\t\t\treturn credential;\n\t\t}).then(\n\t\t\t(credential) => {\n\t\t\t\tthis.metadata.feature(\"login\", Math.round(performance.now() - started), \"success\");\n\t\t\t\treturn credential;\n\t\t\t},\n\t\t\t(error: unknown) => {\n\t\t\t\tconst outcome = signal.aborted || error instanceof LoginCancellationError ? \"cancelled\" : \"failure\";\n\t\t\t\tthis.metadata.feature(\"login\", Math.round(performance.now() - started), outcome);\n\t\t\t\tthis.metadata.failure(\n\t\t\t\t\t\"login\",\n\t\t\t\t\terror instanceof CredentialSynchronizationError ? \"storage\" : \"auth\",\n\t\t\t\t\t0,\n\t\t\t\t\toutcome,\n\t\t\t\t);\n\t\t\t\tthrow error;\n\t\t\t},\n\t\t);\n\t}\n\n\t/**\n\t * Remove the selected account, or without a key the account whose credential is stored. Removing the active\n\t * account promotes the next account of the same credential type; otherwise the credential is deleted.\n\t * Literal legacy credentials are adopted first, including OAuth credentials without identity. An unknown\n\t * explicit account key leaves stored credentials unchanged, and so does a stored credential that changed while\n\t * the account was being removed. `logoutWithStatus` reports which of these happened.\n\t */\n\tasync logout(providerId: string, options: AuthOperationOptions & { accountKey?: string } = {}): Promise<void> {\n\t\tawait this.logoutWithStatus(providerId, options);\n\t}\n\n\tprivate async deleteObservedStoredCredential(\n\t\tproviderId: string,\n\t\tobserved: Credential | undefined,\n\t\tsignal: AbortSignal,\n\t): Promise<AccountRemoveResult[\"status\"]> {\n\t\tif (providerId === HCODE_PROVIDER) await this.hcodeFacade.logoutStored(observed, signal);\n\t\tlet status: AccountRemoveResult[\"status\"] = \"changed\";\n\t\tawait this.credentials.deleteStored(providerId, {\n\t\t\tsignal,\n\t\t\tifCurrent: (latest) => {\n\t\t\t\tif (!sameCredential(latest, observed)) return false;\n\t\t\t\tstatus = \"removed\";\n\t\t\t\treturn true;\n\t\t\t},\n\t\t});\n\t\treturn status;\n\t}\n\n\t/** Capture a non-pooled raw credential before confirmation, without exposing it to the UI. */\n\tprepareStoredCredentialRemoval(\n\t\tproviderId: string,\n\t\toptions?: AuthOperationOptions,\n\t): Promise<((options?: AuthOperationOptions) => Promise<AccountRemoveResult[\"status\"]>) | undefined> {\n\t\treturn this.protectCredentialOperation(\n\t\t\t(async () => {\n\t\t\t\tconst observed = structuredClone(await this.credentials.readStored(providerId, options));\n\t\t\t\tif (!observed || (await this.oauthAccountPool.getCurrentAccount(providerId, options))) return undefined;\n\t\t\t\treturn (removalOptions?: AuthOperationOptions) => {\n\t\t\t\t\tconst signal = operationSignal(removalOptions?.signal);\n\t\t\t\t\treturn this.enqueueCredentialOperation(providerId, signal, async () => {\n\t\t\t\t\t\tconst status = await this.deleteObservedStoredCredential(providerId, observed, signal);\n\t\t\t\t\t\tif (status === \"removed\") await this.synchronizeCredentialState(providerId, \"logout\", signal);\n\t\t\t\t\t\treturn status;\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t})(),\n\t\t\toptions?.signal,\n\t\t\tfalse,\n\t\t);\n\t}\n\n\t/**\n\t * `logout`, resolving `removed`, `unmatched` (unknown explicit account key; nothing changed), or `changed` (the stored\n\t * credential changed concurrently; nothing removed).\n\t */\n\tlogoutWithStatus(\n\t\tproviderId: string,\n\t\toptions: AuthOperationOptions & { accountKey?: string } = {},\n\t): Promise<AccountRemoveResult[\"status\"]> {\n\t\tconst signal = operationSignal(options.signal);\n\t\treturn this.enqueueCredentialOperation(providerId, signal, async () => {\n\t\t\tif (providerId === HCODE_PROVIDER) await this.hcodeFacade.recover(signal);\n\t\t\tif (providerId === HCODE_PROVIDER && this.hcodeSession) {\n\t\t\t\tconst reference = this.hcodeSession;\n\t\t\t\tconst retained = this.hcodeFacade.persistence(reference) === \"session\";\n\t\t\t\ttry {\n\t\t\t\t\tif (retained) await this.hcode.account.logout(reference, signal);\n\t\t\t\t} finally {\n\t\t\t\t\tthis.credentials.clearHcodeSessionReference();\n\t\t\t\t}\n\t\t\t\tawait this.synchronizeCredentialState(providerId, \"logout\", signal);\n\t\t\t\treturn retained ? \"removed\" : \"unmatched\";\n\t\t\t}\n\t\t\t// Raw stored credential (`read` resolves configured API-key values), observed before the pool's read.\n\t\t\tconst observed =\n\t\t\t\toptions.accountKey === undefined\n\t\t\t\t\t? structuredClone(await this.credentials.modify(providerId, async () => undefined, { signal }))\n\t\t\t\t\t: undefined;\n\t\t\t// A stored-only removal never goes through the pool: another session may select an account after\n\t\t\t// this observation, and adopting/removing that replacement would silently retarget the logout.\n\t\t\tif (\n\t\t\t\tthis.credentials.isExternalCredential(observed) ||\n\t\t\t\t(observed?.type === \"api_key\" && !observed.key?.trim()) ||\n\t\t\t\t(providerId === \"openai-codex\" &&\n\t\t\t\t\tobserved?.type === \"oauth\" &&\n\t\t\t\t\t!this.oauthAccountPool.getAccountIdentity(providerId, observed))\n\t\t\t) {\n\t\t\t\tconst status = await this.deleteObservedStoredCredential(providerId, observed, signal);\n\t\t\t\tif (status === \"removed\") await this.synchronizeCredentialState(providerId, \"logout\", signal);\n\t\t\t\treturn status;\n\t\t\t}\n\t\t\tconst stored =\n\t\t\t\toptions.accountKey === undefined ? observed : await this.credentials.readStored(providerId, { signal });\n\t\t\t// Keep Codex's fail-closed handling of legacy unstamped credentials with no identifiable account.\n\t\t\t// Generalized login always stamps even opaque Codex credentials, so they use the account API normally.\n\t\t\tconst legacyUnmatchedCodex =\n\t\t\t\tproviderId === \"openai-codex\" &&\n\t\t\t\tstored?.type === \"oauth\" &&\n\t\t\t\t!this.oauthAccountPool.getAccountIdentity(providerId, stored);\n\t\t\t// A generalized list can give an unstamped legacy credential a temporary local key.\n\t\t\tconst selectedLegacyCurrent =\n\t\t\t\tlegacyUnmatchedCodex &&\n\t\t\t\toptions.accountKey?.startsWith(\"account-\") &&\n\t\t\t\t(await this.oauthAccountPool.getCurrentAccount(providerId, { signal }))?.key === options.accountKey;\n\t\t\t// Removal already reconciles legacy credentials under the pool lock; separate adoption can retarget logout.\n\t\t\tconst removal =\n\t\t\t\tlegacyUnmatchedCodex && !selectedLegacyCurrent\n\t\t\t\t\t? await this.oauthAccountPool.remove(providerId, options.accountKey, { signal })\n\t\t\t\t\t: await this.oauthAccountPool.removeAccount(providerId, options.accountKey, {\n\t\t\t\t\t\t\tsignal,\n\t\t\t\t\t\t\tifCurrent:\n\t\t\t\t\t\t\t\toptions.accountKey === undefined ? (latest) => sameCredential(latest, observed) : undefined,\n\t\t\t\t\t\t});\n\t\t\tlet status = removal.status;\n\t\t\tif (status === \"unmatched\") {\n\t\t\t\tif (options.accountKey !== undefined) return status;\n\t\t\t\t// Unlike Models.logout, delete only the observed credential, never one written since.\n\t\t\t\tstatus = await this.deleteObservedStoredCredential(providerId, observed, signal);\n\t\t\t}\n\t\t\tif (status === \"removed\") await this.synchronizeCredentialState(providerId, \"logout\", signal);\n\t\t\treturn status;\n\t\t});\n\t}\n\n\t/**\n\t * Provider and virtual-model registration changes each queue an un-awaited\n\t * offline refresh after recomposing a provider, unless batched without refresh\n\t * (e.g. the always-loaded llama.cpp builtin extension registers itself\n\t * on every startup). Left unbounded, that background refresh can still be\n\t * running when a caller later does an explicit `await refresh(...)` (startup's\n\t * HUMAIN Node discovery, or the provider-registration refresh in\n\t * createAgentSessionServices) and can finish after it, recomposing every\n\t * provider back to its static definition and clobbering the just-discovered\n\t * dynamic model list or the auth snapshot `hasConfiguredAuth()` reads.\n\t *\n\t * Every non-registration refresh() call waits for these to settle before doing\n\t * its own snapshot work, so it always lands last. Registration-triggered\n\t * refreshes never wait on this set (or on each other via it), so they can't\n\t * deadlock on one another, and unrelated explicit refreshes (e.g. two\n\t * provider-scoped catalog refreshes) remain fully concurrent with each other,\n\t * exactly as before.\n\t */\n\tprivate readonly pendingRegistrationRefreshes = new Set<Promise<void>>();\n\tprivate registeringWithoutRefresh = false;\n\n\t/** Runs synchronous registrations without background refreshes; the caller must refresh afterward. */\n\tregisterWithoutRefresh(register: () => void): void {\n\t\tconst previous = this.registeringWithoutRefresh;\n\t\tthis.registeringWithoutRefresh = true;\n\t\ttry {\n\t\t\tregister();\n\t\t} finally {\n\t\t\tthis.registeringWithoutRefresh = previous;\n\t\t}\n\t}\n\n\tprivate queueRegistrationRefresh(): void {\n\t\tif (this.registeringWithoutRefresh) return;\n\t\tconst p = this.refreshInternal({ allowNetwork: false }, { fromRegistration: true }).then(\n\t\t\t() => {},\n\t\t\t() => {},\n\t\t);\n\t\tthis.pendingRegistrationRefreshes.add(p);\n\t\tvoid p.finally(() => this.pendingRegistrationRefreshes.delete(p));\n\t}\n\n\trefresh(options: ModelsRefreshOptions = {}): Promise<ModelsRefreshResult> {\n\t\treturn this.refreshInternal(options, { fromRegistration: false });\n\t}\n\n\tprivate async refreshInternal(\n\t\toptions: ModelsRefreshOptions,\n\t\t{ fromRegistration }: { fromRegistration: boolean },\n\t): Promise<ModelsRefreshResult> {\n\t\tif (!fromRegistration && this.pendingRegistrationRefreshes.size > 0) {\n\t\t\tawait Promise.allSettled([...this.pendingRegistrationRefreshes]);\n\t\t}\n\t\tconst config = await ModelConfig.load(this.modelsPath);\n\t\tthis.assertConfiguration(config);\n\t\tthis.config = config;\n\t\tthis.configureRadiusProviders();\n\t\tif (options.providers) {\n\t\t\tfor (const providerId of new Set(options.providers)) this.recomposeProvider(providerId);\n\t\t\tthis.updateModelSnapshot();\n\t\t} else {\n\t\t\tthis.rebuildProviders();\n\t\t}\n\t\tconst refreshOptions = {\n\t\t\t...options,\n\t\t\tallowNetwork: options.allowNetwork ?? this.modelNetworkEnabled,\n\t\t};\n\t\t// Published pi-ai builds before ModelsStore returned void and accepted a provider ID.\n\t\t// The fallback keeps source-mode CLI tests working without rebuilding workspace dependencies.\n\t\tconst result = ((await this.models.refresh(refreshOptions)) as ModelsRefreshResult | undefined) ?? {\n\t\t\taborted: refreshOptions.signal?.aborted ?? false,\n\t\t\terrors: new Map(),\n\t\t};\n\t\tconst errors = new Map(result.errors);\n\t\tthis.updateModelSnapshot();\n\t\tif (options.providers) {\n\t\t\tawait Promise.all(\n\t\t\t\t[...new Set(options.providers)].map(async (providerId) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait this.refreshProviderAvailability(providerId, operationSignal(options.signal));\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tif (!options.signal?.aborted) {\n\t\t\t\t\t\t\terrors.set(providerId, error instanceof Error ? error : new Error(String(error)));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t);\n\t\t} else {\n\t\t\ttry {\n\t\t\t\tawait this.queueAvailabilityRefresh(options.signal);\n\t\t\t} catch {\n\t\t\t\t// Availability errors are recorded by the latest pass; refreshed models remain usable.\n\t\t\t}\n\t\t}\n\t\treturn { aborted: result.aborted || (options.signal?.aborted ?? false), errors };\n\t}\n\n\tregisterNativeProvider(provider: Provider): void {\n\t\tassertCustomProviderId(provider.id);\n\t\tif (!provider.id.trim()) throw new Error(\"Provider id must not be empty.\");\n\t\tthis.extensionProviders.delete(provider.id);\n\t\tthis.nativeExtensionProviders.set(provider.id, provider);\n\t\tthis.recomposeProvider(provider.id);\n\t\tthis.updateModelSnapshot();\n\t\tthis.markProvisionallyConfigured(\n\t\t\tprovider.id,\n\t\t\tconfiguredRequestAuthStatus(this.config.getProvider(provider.id), undefined),\n\t\t\tprovider.auth.oauth && !provider.auth.apiKey ? \"oauth\" : \"api_key\",\n\t\t);\n\t\tthis.queueRegistrationRefresh();\n\t}\n\n\t/**\n\t * Mark a newly registered provider as configured when it has a stored credential or a configured\n\t * API key. Availability checks run asynchronously, and callers such as initial model selection\n\t * read the snapshot before they finish. The next availability pass replaces this entry.\n\t */\n\tprivate markProvisionallyConfigured(\n\t\tproviderId: string,\n\t\tconfiguredStatus: AuthStatus | undefined,\n\t\ttype: AuthType,\n\t): void {\n\t\tif (!this.snapshot.storedProviders.has(providerId) && !configuredStatus?.configured) return;\n\t\tconst configuredProviders = new Set(this.snapshot.configuredProviders).add(providerId);\n\t\tconst auth = new Map(this.snapshot.auth);\n\t\t// Never clobber a real check result.\n\t\tif (!auth.get(providerId)) auth.set(providerId, { type, source: \"configured provider\" });\n\t\tthis.snapshot = {\n\t\t\t...this.snapshot,\n\t\t\tauth,\n\t\t\tconfiguredProviders,\n\t\t\tavailable: this.snapshot.all.ofProviders(configuredProviders),\n\t\t};\n\t}\n\n\tregisterProvider(providerId: string, config: ProviderConfigInput): void {\n\t\tassertCustomProviderId(providerId);\n\t\tthis.configurationGuard?.({ [providerId]: config });\n\t\t// Validate the incoming registration on its own, like the legacy registry:\n\t\t// a broken re-registration must throw without touching the stored config.\n\t\tvalidateExtensionProvider(providerId, this.builtins.get(providerId), this.config.getProvider(providerId), config);\n\t\tthis.nativeExtensionProviders.delete(providerId);\n\t\t// Re-registration merges defined values over the previous registration and\n\t\t// preserves undefined ones, matching the legacy ModelRegistry contract.\n\t\tconst previous = this.extensionProviders.get(providerId);\n\t\tconst effective: ProviderConfigInput = { ...previous };\n\t\tfor (const [key, value] of Object.entries(config)) {\n\t\t\tif (value !== undefined) (effective as Record<string, unknown>)[key] = value;\n\t\t}\n\t\tthis.extensionProviders.set(providerId, effective);\n\t\tthis.recomposeProvider(providerId);\n\t\tthis.updateModelSnapshot();\n\t\tthis.markProvisionallyConfigured(\n\t\t\tproviderId,\n\t\t\tconfiguredRequestAuthStatus(this.config.getProvider(providerId), effective),\n\t\t\teffective.oauth && !effective.apiKey ? \"oauth\" : \"api_key\",\n\t\t);\n\t\tthis.queueRegistrationRefresh();\n\t}\n\n\tunregisterProvider(providerId: string): void {\n\t\tassertCustomProviderId(providerId);\n\t\tthis.extensionProviders.delete(providerId);\n\t\tthis.nativeExtensionProviders.delete(providerId);\n\t\tthis.recomposeProvider(providerId);\n\t\tthis.updateModelSnapshot();\n\t\tthis.queueRegistrationRefresh();\n\t}\n\n\t/**\n\t * Register a virtual model under `definition.provider`, which may also list physical models or\n\t * several virtual models. Re-registering the same provider and id replaces the virtual model.\n\t * Throws when the id belongs to a physical model of that provider.\n\t */\n\tregisterVirtualModel(definition: VirtualModelDefinition): void {\n\t\tconst { provider: providerId, id } = definition;\n\t\tassertCustomProviderId(providerId);\n\t\tif (!providerId.trim() || !id.trim()) throw new Error(\"Virtual model provider and id must not be empty.\");\n\t\tconst existing = this.models.getModel(providerId, id);\n\t\tif (existing && !isVirtualModel(existing)) {\n\t\t\tthrow new Error(`Virtual model ${providerId}/${id} conflicts with a physical model.`);\n\t\t}\n\t\tconst models = this.virtualModels.get(providerId) ?? new Map<string, RegisteredVirtualModel>();\n\t\tmodels.set(id, { model: createVirtualModel(definition), route: (request) => definition.route(request) });\n\t\tthis.virtualModels.set(providerId, models);\n\t\tif (!this.recomposeProvider(providerId) && !this.snapshot.configuredProviders.has(providerId)) {\n\t\t\t// A provider of only virtual models needs no credentials. Mark it configured now: session\n\t\t\t// restore checks auth before the refresh below lands.\n\t\t\tconst auth = new Map(this.snapshot.auth).set(providerId, { type: \"api_key\", source: \"virtual\" });\n\t\t\tconst configuredProviders = new Set(this.snapshot.configuredProviders).add(providerId);\n\t\t\tthis.snapshot = { ...this.snapshot, auth, configuredProviders };\n\t\t}\n\t\tthis.updateModelSnapshot();\n\t\tthis.queueRegistrationRefresh();\n\t}\n\n\tunregisterVirtualModel(providerId: string, id: string): void {\n\t\tassertCustomProviderId(providerId);\n\t\tconst models = this.virtualModels.get(providerId);\n\t\tif (!models?.delete(id)) return;\n\t\tif (models.size === 0) this.virtualModels.delete(providerId);\n\t\tthis.recomposeProvider(providerId);\n\t\tthis.updateModelSnapshot();\n\t\tthis.queueRegistrationRefresh();\n\t}\n\n\t/**\n\t * Ask a virtual model's router for the model and thinking level of one request. The router must\n\t * return a physical catalog model whose provider has credentials; the thinking level is clamped\n\t * to that model. Throws when routing fails.\n\t *\n\t * `previous` reports the latest successful response in `messages`. A retry passes the failed\n\t * response as `options.failed`; `messages` no longer contains it. `options.state` is the router\n\t * state stored by the caller, which also stores the returned state.\n\t */\n\tasync resolveModel(\n\t\tmodel: Model<Api>,\n\t\tmessages: readonly Message[],\n\t\toptions: {\n\t\t\treason: ModelRouteReason;\n\t\t\tthinkingLevel: ModelThinkingLevel;\n\t\t\tsignal?: AbortSignal;\n\t\t\tfailed?: AssistantMessage;\n\t\t\tstate?: unknown;\n\t\t},\n\t): Promise<ModelRoute> {\n\t\tconst name = `Virtual model ${model.provider}/${model.id}`;\n\t\tconst virtual = this.virtualModels.get(model.provider)?.get(model.id);\n\t\tif (!virtual) throw new Error(`${name} is not registered.`);\n\t\tconst { failed, ...request } = options;\n\t\tconst latest = findLatestResponse(messages);\n\t\tconst previousModel = latest && this.getPhysicalModel(latest.provider, latest.model);\n\t\t// A failed routing attempt names the virtual model; there is no physical request to report.\n\t\tconst failedModel = failed && this.getPhysicalModel(failed.provider, failed.model);\n\t\tconst route = await virtual.route({\n\t\t\t...request,\n\t\t\tmodel,\n\t\t\tprevious: previousModel && { model: previousModel, thinkingLevel: latest?.thinkingLevel },\n\t\t\tfailed: failedModel && failed && { model: failedModel, thinkingLevel: failed.thinkingLevel, message: failed },\n\t\t\tmessages,\n\t\t});\n\t\tthis.assertHcodeModel(route.model);\n\t\tconst target = this.getPhysicalModel(route.model.provider, route.model.id);\n\t\tconst routed = `${name} routed to ${route.model.provider}/${route.model.id}`;\n\t\tif (!target) throw new Error(`${routed}, which is not a physical model.`);\n\t\tif (!this.hasConfiguredAuth(target.provider)) throw new Error(`${routed}, which has no credentials.`);\n\t\tif (target.provider === HCODE_PROVIDER && !getSupportedThinkingLevels(target).includes(route.thinkingLevel))\n\t\t\tthrow new Error(HCODE_UNSUPPORTED_THINKING_MESSAGE);\n\t\treturn {\n\t\t\tmodel: target,\n\t\t\tthinkingLevel:\n\t\t\t\ttarget.provider === HCODE_PROVIDER ? route.thinkingLevel : clampThinkingLevel(target, route.thinkingLevel),\n\t\t\tstate: route.state,\n\t\t};\n\t}\n\n\t/** A catalog chat model that is not virtual. */\n\tgetPhysicalModel(providerId: string, modelId: string): Model<Api> | undefined {\n\t\tconst model = this.models.getModel(providerId, modelId);\n\t\t// A custom catalog cannot lend its provider ID to the reserved native target.\n\t\tif (model?.provider === HCODE_PROVIDER && providerId !== HCODE_PROVIDER) return undefined;\n\t\treturn model && !isVirtualModel(model) ? model : undefined;\n\t}\n}\n"]}
1
+ {"version":3,"file":"model-runtime.js","sourceRoot":"","sources":["../../src/core/model-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE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AM;YAAE,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,kCAAkC,CAAC,CAAC;QAC1E,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,QAAQ,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,6BAA6B,CAAC,CAAC;QACtG,IAAI,kBAAkB;YAAE,OAAO,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAC3D,OAAO;YACN,KAAK,EAAE,MAAM;YACb,aAAa,EAAE,kBAAkB,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC;YAC9D,KAAK,EAAE,KAAK,CAAC,KAAK;SAClB,CAAC;IACH,CAAC;IAED,gDAAgD;IAChD,gBAAgB,CAAC,UAAkB,EAAE,OAAe;QACnD,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QACxD,8EAA8E;QAC9E,IAAI,KAAK,EAAE,QAAQ,KAAK,cAAc,IAAI,UAAU,KAAK,cAAc;YAAE,OAAO,SAAS,CAAC;QAC1F,OAAO,KAAK,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5D,CAAC;CACD","sourcesContent":["import { AsyncLocalStorage } from \"node:async_hooks\";\nimport { dirname, join } from \"node:path\";\nimport {\n\ttype AnyModel,\n\ttype Api,\n\ttype ApiStreamOptions,\n\ttype AssistantImages,\n\ttype AssistantMessage,\n\ttype AssistantMessageEventStream,\n\ttype AttestationIntent,\n\ttype AuthCheck,\n\ttype AuthInteraction,\n\ttype AuthOperationOptions,\n\ttype AuthResult,\n\ttype AuthType,\n\ttype ClassifierApi,\n\ttype ClassifierContext,\n\ttype ClassifierModel,\n\ttype ClassifierOptions,\n\ttype ClassifierResult,\n\ttype Context,\n\ttype Credential,\n\ttype CredentialInfo,\n\ttype CredentialStore,\n\tclampThinkingLevel,\n\tcommitLoginCredential,\n\tcreateModels,\n\ttype DeferredCancelOptions,\n\ttype DeferredFetchOptions,\n\ttype DeferredHandle,\n\tdefaultProviderAuthContext,\n\tdrainStream,\n\tgetOpenCodeSessionHeaders,\n\ttype ImageApi,\n\ttype ImageModel,\n\ttype ImagesContext,\n\ttype ImagesOptions,\n\tisModelType,\n\ttype LoginOptions,\n\tlazyStream,\n\ttype Message,\n\ttype Model,\n\ttype Models,\n\ttype ModelsApiStreamOptions,\n\ttype ModelsClassifierOptions,\n\ttype ModelsDeferredCancelOptions,\n\ttype ModelsDeferredFetchOptions,\n\tModelsError,\n\ttype ModelsImagesOptions,\n\ttype ModelsRefreshOptions,\n\ttype ModelsRefreshResult,\n\ttype ModelsRequestTransforms,\n\ttype ModelsSimpleStreamOptions,\n\ttype ModelsStore,\n\ttype ModelThinkingLevel,\n\ttype ModelType,\n\ttype ModelTypeMap,\n\ttype MutableModels,\n\tnormalizeContext,\n\ttype Provider,\n\ttype ProviderAuthInteraction,\n\ttype ProviderHeaders,\n\ttype ProviderRequestObservation,\n\ttype ProviderRequestOptions,\n\ttype ProviderResponse,\n\ttype SimpleStreamOptions,\n\ttype StreamOptions,\n\tSubmissionAdmissionError,\n\tstreamWithProgressTimeout,\n\ttype Usage,\n} from \"@earendil-works/pi-ai\";\nimport { findEnvKeys } from \"@earendil-works/pi-ai/compat\";\nimport * as builtinProviderCatalog from \"@earendil-works/pi-ai/providers/all\";\nimport { getModelListing, type ModelListing, setModelListing } from \"@earendil-works/pi-ai/providers/model-listing\";\nimport { personalizeOpenRouterCatalog } from \"@earendil-works/pi-ai/providers/openrouter\";\nimport {\n\tassertChatModel,\n\tassertClassifierInputSupported,\n\tassertClassifierModel,\n\tassertImageModel,\n\tclassifierErrorResult,\n\timageErrorResult,\n} from \"@earendil-works/pi-ai/utils/model-operations\";\nimport { getAgentDir } from \"../config.ts\";\nimport { describeGatewayCredential, HUMAIN_GATEWAY_PROVIDER } from \"../humain/gateway/constants.ts\";\nimport type { HcodeCatalogEmptyReason } from \"../humain/hcode/contracts.ts\";\nimport { type HcodeEnvironmentName, resolveHcodeEnvironment } from \"../humain/hcode/environment.ts\";\nimport {\n\tcreateHcodeFacade,\n\ttype HcodeContext,\n\ttype HcodeFacade,\n\ttype HcodeFacadeOptions,\n\ttype HcodeLoginReadiness,\n\ttype HcodeSupportSnapshot,\n\treferenceFromCredential,\n} from \"../humain/hcode/facade.ts\";\nimport { HCODE_PROVIDER } from \"../humain/hcode/http.ts\";\nimport { HCODE_LOGIN_FAILURES } from \"../humain/hcode/login-failure.ts\";\nimport type { HcodeAccountRef } from \"../humain/hcode/ports.ts\";\nimport { hcodeReferenceCredential } from \"../humain/hcode/provider.ts\";\nimport type { CliMetadataError, CliMetadataOutcome } from \"../humain/metadata/contracts.ts\";\nimport type { MetadataProducer } from \"../humain/metadata/index.ts\";\nimport {\n\tFileNodeAccountMetadataStore,\n\tInMemoryNodeAccountMetadataStore,\n\ttype NodeAccountMetadataStore,\n} from \"../humain/node-account-fallback.ts\";\nimport { hasHumainNodeAdmissionTransport } from \"../humain/node-provider.ts\";\nimport { operationSignal, raceWithAbortSignal } from \"../utils/abort.ts\";\nimport {\n\tANTHROPIC_PROVIDER_ID,\n\tAnthropicRateLimitStore,\n\tisOfficialAnthropicBaseUrl,\n\tparseAnthropicRateLimits,\n} from \"./anthropic-account-reporting.ts\";\nimport { AccountSourceReplacementError, AuthStorage as DefaultAuthStorage } from \"./auth-storage.ts\";\nimport { filterBedrockCatalog } from \"./model-catalog-filter.ts\";\nimport { ModelConfig } from \"./model-config.ts\";\nimport {\n\tadmissionIntent,\n\tassertAdmittedModelInput,\n\ttype ModelRequestAdmission,\n\treconcileAdmittedUsage,\n\tsubmissionAdmission,\n} from \"./model-request-admission.ts\";\nimport { FileModelsStore, InMemoryCodingAgentModelsStore } from \"./models-store.ts\";\nimport {\n\ttype AccountRemoveResult,\n\tOAUTH_ACCOUNT_IDENTITY_FIELDS,\n\tOAuthAccountPool,\n\tsameCredential,\n} from \"./oauth-account-pool.ts\";\nimport {\n\ttype AuthStatus,\n\ttype CompatibilityRequestConfig,\n\tcomposeModelProvider,\n\tconfiguredRequestAuthStatus,\n\ttype ProviderConfigInput,\n\tresolveCompatibilityRequestConfig,\n\tresolveConfiguredModelHeaders,\n\tvalidateExtensionProvider,\n} from \"./provider-composer.ts\";\nimport { withPersonalizedCatalog, withRemoteCatalog } from \"./remote-catalog-provider.ts\";\nimport { isCommandConfigValue, resolveConfigValue } from \"./resolve-config-value.ts\";\nimport { RuntimeCredentials } from \"./runtime-credentials.ts\";\nimport { SafeCredentialError } from \"./safe-credential-error.ts\";\nimport {\n\tcreateVirtualModel,\n\tfindLatestResponse,\n\tisVirtualModel,\n\ttype ModelRoute,\n\ttype ModelRouteReason,\n\ttype VirtualModelDefinition,\n\twithVirtualModels,\n} from \"./virtual-models.ts\";\n\ninterface RegisteredVirtualModel {\n\tmodel: Model<Api>;\n\troute: VirtualModelDefinition[\"route\"];\n}\n\n/**\n * Every provider's chat models as they were when taken (what `getModels()` returned then, in its order), without building the\n * catalogs not yet built: such a provider is held as its listing, whose models are built when first needed. Every model of a\n * listing has the listing's provider as its `provider`.\n */\nclass ChatModelsSnapshot {\n\tprivate readonly parts: readonly (\n\t\t| { provider: string; listing: ModelListing; models?: undefined }\n\t\t| { provider: string; models: readonly Model<Api>[] }\n\t)[];\n\n\tconstructor(providers: readonly Provider[]) {\n\t\tthis.parts = providers.map((provider) => {\n\t\t\tconst listing = getModelListing(provider);\n\t\t\tif (listing) return { provider: provider.id, listing };\n\t\t\ttry {\n\t\t\t\treturn { provider: provider.id, models: provider.getModels() };\n\t\t\t} catch {\n\t\t\t\t// As in Models.getModels(): a provider whose getModels() throws has no models.\n\t\t\t\treturn { provider: provider.id, models: [] };\n\t\t\t}\n\t\t});\n\t}\n\n\t/** The models whose `provider` is one of `providers`, in order. */\n\tofProviders(providers: ReadonlySet<string>): Model<Api>[] {\n\t\tconst models: Model<Api>[] = [];\n\t\tfor (const part of this.parts) {\n\t\t\tif (part.models) {\n\t\t\t\tfor (const model of part.models) if (providers.has(model.provider)) models.push(model);\n\t\t\t} else if (providers.has(part.provider)) {\n\t\t\t\tmodels.push(...part.listing.models());\n\t\t\t}\n\t\t}\n\t\treturn models;\n\t}\n}\n\ninterface ModelRuntimeSnapshot {\n\tall: ChatModelsSnapshot;\n\tavailable: readonly Model<Api>[];\n\tconfiguredProviders: ReadonlySet<string>;\n\tstoredProviders: ReadonlySet<string>;\n\tauth: ReadonlyMap<string, AuthCheck | undefined>;\n}\n\nexport interface CreateModelRuntimeOptions {\n\t/** Credential storage. Defaults to the file at authPath. */\n\tcredentials?: CredentialStore;\n\t/** Host policy applied to raw credentials and each loaded/registered provider configuration before resolution. */\n\tconfigurationGuard?: (configuration: unknown) => void;\n\tauthPath?: string;\n\t/**\n\t * Multi-account OAuth pool. Defaults to `oauth-accounts.json` next to auth.json, or an\n\t * in-memory pool when a custom `credentials` store is supplied.\n\t */\n\toauthAccountPool?: OAuthAccountPool;\n\t/**\n\t * HUMAIN Node fallback policy and labels. Defaults to `humain-node-accounts.json` next to auth.json, or an\n\t * in-memory store when a custom `credentials` store is supplied.\n\t */\n\tnodeAccountMetadata?: NodeAccountMetadataStore;\n\tmodelsPath?: string | null;\n\tmodelsStore?: ModelsStore;\n\tmodelsStorePath?: string;\n\t/** Allow create() to refresh model catalogs over the network. Defaults to false. */\n\tallowModelNetwork?: boolean;\n\t/** Timeout for the create-time network model refresh. */\n\tmodelRefreshTimeoutMs?: number;\n\tcatalogBaseUrl?: string;\n\t/** Optional caller cancellation for initial cache restoration and availability checks. */\n\tsignal?: AbortSignal;\n\t/** Skip initial catalog and availability refresh. Static models remain available. */\n\trefreshOnCreate?: boolean;\n\t/** Trusted host dependencies for the fixed native account; never sourced from models.json or project settings. */\n\thcode?: HcodeFacadeOptions;\n\t/** @internal SDK/services-created contexts release owned resources after their final session owner leaves. */\n\tsessionOwned?: boolean;\n}\n\ntype OAuthAccountObserver = (providerId: string, accountKey: string | undefined) => void;\n\nexport interface ModelRuntimeSimpleStreamOptions extends ModelsSimpleStreamOptions {\n\t/** @internal Reports the account derived from the credential used for this request, before streaming. */\n\tonOAuthAccount?: OAuthAccountObserver;\n\t/** @internal Notifies the session of the physical target before request preparation can yield. */\n\tonPhysicalTarget?: (model: Model<Api>) => void;\n\t/** @internal Resolves live payload-hook interest after auth and header transforms. */\n\tresolveOnPayload?: (model: Model<Api>) => ModelsSimpleStreamOptions[\"onPayload\"];\n}\n\nexport interface ModelRuntimeAuthOverrides extends AuthOperationOptions {\n\t/** @internal Scoped to this auth resolution, never catalog checks or background requests. */\n\tonOAuthAccount?: OAuthAccountObserver;\n\tapiKey?: string;\n\tenv?: Record<string, string>;\n\t/** Require this much remaining OAuth-token validity; defaults to five minutes. */\n\tminOAuthValidityMs?: number;\n}\n\nexport type CredentialSynchronizationOperation =\n\t| \"login\"\n\t| \"logout\"\n\t| \"switchAccount\"\n\t| \"setRuntimeApiKey\"\n\t| \"removeRuntimeApiKey\";\n\n/** Secret-free account metadata, safe for display and host serialization. */\nexport interface AccountInfo {\n\tkey: string;\n\tlabel: string;\n\ttype: AuthType;\n\tactive: boolean;\n\teffective: boolean;\n\texhaustedUntil?: number;\n}\n\nexport interface AccountSource {\n\tsource: \"runtime\" | \"auth_json\" | \"configuration\" | \"environment\";\n\tlabel: string;\n\ttype: AuthType;\n\treadOnly: true;\n\t/** Selected source for the next dispatch, not proof that its credential is valid. */\n\teffective: boolean;\n}\n\n/** Credentials changed successfully, but the local model/auth snapshot could not be synchronized. */\nexport class CredentialSynchronizationError extends Error {\n\treadonly providerId: string;\n\treadonly operation: CredentialSynchronizationOperation;\n\n\tconstructor(providerId: string, operation: CredentialSynchronizationOperation) {\n\t\tsuper(\n\t\t\t`Credential ${operation} committed, but local synchronization failed. Refresh local models or restart before retrying requests.`,\n\t\t);\n\t\tthis.name = \"CredentialSynchronizationError\";\n\t\tthis.providerId = providerId;\n\t\tthis.operation = operation;\n\t}\n}\n\n/** Only prompt/login cancellation creates this marker; backend failures are never relayed. */\nclass LoginCancellationError extends Error {\n\tconstructor() {\n\t\tsuper(\"Login cancelled\");\n\t\tthis.name = \"AbortError\";\n\t}\n}\n\n/** Providers whose origin, headers and models are fixed; overlays would bypass their request safeguards. */\nconst OVERLAY_REJECTING_PROVIDERS: ReadonlySet<string> = new Set([HUMAIN_GATEWAY_PROVIDER, HCODE_PROVIDER]);\n\nfunction assertCustomProviderId(providerId: string): void {\n\tif (providerId === HCODE_PROVIDER)\n\t\tthrow new Error(\"HUMAIN Code account does not accept custom registration or API keys.\");\n}\n\nfunction rejectsConfigOverlays(providerId: string): boolean {\n\treturn OVERLAY_REJECTING_PROVIDERS.has(providerId);\n}\n\nfunction 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\nconst CREDENTIAL_HEADERS = [\"x-api-key\", \"authorization\"] as const;\n\nfunction headerValue(headers: ProviderHeaders | undefined, lowerName: string): string | null | undefined {\n\tfor (const [name, value] of Object.entries(headers ?? {})) if (name.toLowerCase() === lowerName) return value;\n\treturn undefined;\n}\n\n/** True when the final request headers replace or add a credential header the resolved auth did not supply. */\nfunction overridesCredentialHeaders(\n\tresolved: ProviderHeaders | undefined,\n\tfinal: ProviderHeaders | undefined,\n): boolean {\n\treturn CREDENTIAL_HEADERS.some((name) => headerValue(final, name) !== headerValue(resolved, name));\n}\n\n/** Why a request was made. `bug-report` is internal: it is never written to the trace payload. */\nexport type ModelRequestPurpose = \"chat\" | \"compaction\" | \"branch-summary\" | \"cache-warming\" | \"bug-report\";\n\n/** Outcome of one observed submission. Carries no hidden reasoning and no credentials. */\nexport interface ModelResponseObservation {\n\tpurpose: ModelRequestPurpose | undefined;\n\trequestId: string;\n\tsubmissionId: string;\n\tsubmissionNumber: number;\n\toperation: ProviderRequestObservation[\"operation\"];\n\tprovider: string;\n\tapi: string;\n\tmodel: string;\n\t/** `pending` on a superseded submission: its transport outcome was never observed. */\n\tstopReason: \"pending\" | \"stop\" | \"length\" | \"toolUse\" | \"error\" | \"aborted\" | \"deferred\";\n\t/** Final assistant message for chat requests. */\n\tmessage?: AssistantMessage;\n\terrorMessage?: string;\n\tusage?: Usage;\n\t/** True when a later submission of the same request (a transport retry) replaced this one; its outcome is unknown. */\n\tsuperseded: boolean;\n}\n\n/** Read-only, per-session receiver of actual provider submissions. Failures never affect requests. */\nexport interface ModelRequestObserver {\n\tonRequest(\n\t\tobservation: Readonly<ProviderRequestObservation>,\n\t\tpurpose: ModelRequestPurpose | undefined,\n\t): void | Promise<void>;\n\tonResponse(response: Readonly<ModelResponseObservation>): void | Promise<void>;\n\t/** No submission could be observed, or a direct call could not be attributed to one session. */\n\tonUnattributed?(): void | Promise<void>;\n}\n\ninterface ModelRequestScope {\n\tobserver: ModelRequestObserver;\n\tpurpose: ModelRequestPurpose | undefined;\n}\n\ninterface ModelRequestAdmissionScope {\n\tadmission: ModelRequestAdmission;\n\tobservers: Set<ModelRequestObserver>;\n}\n\nfunction swallow(fn: () => void | Promise<void>): void {\n\ttry {\n\t\tconst result = fn();\n\t\tif (result) result.catch(() => {});\n\t} catch {\n\t\t// Observation is best effort.\n\t}\n}\n\ntype SubmissionLink = Pick<\n\tProviderRequestObservation,\n\t\"requestId\" | \"submissionId\" | \"submissionNumber\" | \"operation\" | \"provider\" | \"api\" | \"model\"\n>;\n\n/**\n * Collects the submissions of one logical request and reports their outcome once. Only the latest\n * submission is held (without its body); a newer submission settles the previous one at once as\n * superseded, so every submission is answered with O(1) storage however many a request makes.\n */\nclass RequestTracker {\n\tprivate readonly scope: ModelRequestScope | undefined;\n\tprivate readonly admission: ModelRequestAdmission | undefined;\n\tprivate readonly model: AnyModel;\n\tprivate latest: SubmissionLink | undefined;\n\tprivate settled = false;\n\n\tconstructor(scope: ModelRequestScope | undefined, model: AnyModel, admission?: ModelRequestAdmission) {\n\t\tthis.scope = scope;\n\t\tthis.admission = admission;\n\t\tthis.model = model;\n\t}\n\n\t/** Wraps a caller `onRequest` so the observer sees the same submissions. */\n\thook(caller: ProviderRequestOptions[\"onRequest\"]): NonNullable<ProviderRequestOptions[\"onRequest\"]> {\n\t\treturn async (value) => {\n\t\t\tconst previous = this.latest;\n\t\t\tthis.latest = {\n\t\t\t\trequestId: value.requestId,\n\t\t\t\tsubmissionId: value.submissionId,\n\t\t\t\tsubmissionNumber: value.submissionNumber,\n\t\t\t\toperation: value.operation,\n\t\t\t\tprovider: value.provider,\n\t\t\t\tapi: value.api,\n\t\t\t\tmodel: value.model,\n\t\t\t};\n\t\t\ttry {\n\t\t\t\tawait this.scope?.observer.onRequest(value, this.scope.purpose);\n\t\t\t} catch {\n\t\t\t\t// Observation is best effort.\n\t\t\t}\n\t\t\t// The transport outcome of a replaced submission is not visible here: report it as unknown.\n\t\t\tif (previous) this.report(previous, { stopReason: \"pending\" }, true);\n\t\t\tawait caller?.(value);\n\t\t};\n\t}\n\n\tsettleMessage(message: AssistantMessage): void {\n\t\tthis.settle({\n\t\t\tstopReason: message.stopReason,\n\t\t\tmessage,\n\t\t\terrorMessage: message.errorMessage,\n\t\t\tusage: message.usage,\n\t\t});\n\t}\n\n\tsettleResult(result: { stopReason: string; errorMessage?: string; usage?: Usage }): void {\n\t\tconst stopReason = result.stopReason === \"error\" || result.stopReason === \"aborted\" ? result.stopReason : \"stop\";\n\t\tthis.settle({ stopReason, errorMessage: result.errorMessage, usage: result.usage });\n\t}\n\n\tsettleFailure(aborted: boolean): void {\n\t\tthis.settle({ stopReason: aborted ? \"aborted\" : \"error\" });\n\t}\n\n\tprivate settle(outcome: Pick<ModelResponseObservation, \"stopReason\" | \"message\" | \"errorMessage\" | \"usage\">): void {\n\t\tif (this.settled) return;\n\t\tthis.settled = true;\n\t\tif (this.latest) {\n\t\t\tif (this.admission) reconcileAdmittedUsage(this.admission, this.latest, outcome.usage, this.model);\n\t\t\tthis.report(this.latest, outcome, false);\n\t\t} else if (this.scope) swallow(() => this.scope?.observer.onUnattributed?.());\n\t}\n\n\tprivate report(\n\t\tsubmission: SubmissionLink,\n\t\toutcome: Pick<ModelResponseObservation, \"stopReason\" | \"message\" | \"errorMessage\" | \"usage\">,\n\t\tsuperseded: boolean,\n\t): void {\n\t\tconst response: ModelResponseObservation = {\n\t\t\tpurpose: this.scope?.purpose,\n\t\t\trequestId: submission.requestId,\n\t\t\tsubmissionId: submission.submissionId,\n\t\t\tsubmissionNumber: submission.submissionNumber,\n\t\t\toperation: submission.operation,\n\t\t\tprovider: submission.provider,\n\t\t\tapi: submission.api,\n\t\t\tmodel: submission.model,\n\t\t\t...outcome,\n\t\t\tsuperseded,\n\t\t};\n\t\tswallow(() => this.scope?.observer.onResponse(response));\n\t}\n}\n\n/** Configured pi-ai Models collection used by coding-agent and SDK consumers. */\nexport class ModelRuntime implements Models {\n\tprivate readonly models: MutableModels;\n\tprivate readonly hcodeFacade: HcodeFacade;\n\tprivate readonly sessionOwned: boolean;\n\tprivate hcodeSession: HcodeAccountRef | undefined;\n\t/** Shared token-free account/usage facet, independent of the selected model. */\n\treadonly hcode: HcodeContext;\n\t/** Scalar-only observation bridge; no account, raw enqueue, identity, or flush API. */\n\treadonly metadata: Pick<MetadataProducer, \"feature\" | \"tool\" | \"inference\" | \"failure\">;\n\tprivate readonly credentials: RuntimeCredentials;\n\tprivate readonly configurationGuard: ((configuration: unknown) => void) | undefined;\n\tprivate readonly oauthAccountPool: OAuthAccountPool;\n\t/** Secret-free HUMAIN Node fallback policy and user labels; keys stay in the credential pool. */\n\treadonly nodeAccountMetadata: NodeAccountMetadataStore;\n\t/** Latest Anthropic API rate-limit headers per account, observed from this runtime's own responses. */\n\treadonly anthropicRateLimits = new AnthropicRateLimitStore();\n\tprivate readonly defaultBuiltins: ReadonlyMap<string, Provider>;\n\tprivate readonly builtins = new Map<string, Provider>();\n\tprivate readonly nativeExtensionProviders = new Map<string, Provider>();\n\tprivate readonly extensionProviders = new Map<string, ProviderConfigInput>();\n\t/** Virtual models by provider id, then model id. */\n\tprivate readonly virtualModels = new Map<string, Map<string, RegisteredVirtualModel>>();\n\tprivate readonly compositionErrors = new Map<string, string>();\n\tprivate readonly modelsPath: string | undefined;\n\tprivate readonly modelNetworkEnabled: boolean;\n\tprivate config: ModelConfig;\n\tprivate snapshot: ModelRuntimeSnapshot = {\n\t\tall: new ChatModelsSnapshot([]),\n\t\tavailable: [],\n\t\tconfiguredProviders: new Set(),\n\t\tstoredProviders: new Set(),\n\t\tauth: new Map(),\n\t};\n\tprivate availabilityRefreshSeq = 0;\n\tprivate availabilityErrorSeq = 0;\n\tprivate readonly providerAvailabilitySeq = new Map<string, number>();\n\tprivate availabilityError: string | undefined;\n\tprivate readonly credentialOperations = new Map<string, Promise<unknown>>();\n\tprivate readonly oauthAccountObserver = new AsyncLocalStorage<OAuthAccountObserver | undefined>();\n\tprivate readonly resolvedRequestAuth = new AsyncLocalStorage<{\n\t\tmodel: AnyModel;\n\t\tresolution: AuthResult;\n\t\taccountKey: string | undefined;\n\t}>();\n\tprivate readonly requestScope = new AsyncLocalStorage<ModelRequestScope>();\n\tprivate readonly admissionScope = new AsyncLocalStorage<ModelRequestAdmissionScope>();\n\tprivate readonly activeAdmissions = new Set<ModelRequestAdmissionScope>();\n\t/** Observers of sessions that own this runtime; they attribute direct calls made outside any request scope. */\n\tprivate readonly ownerObservers = new Set<ModelRequestObserver>();\n\n\tprivate constructor(\n\t\tcredentials: RuntimeCredentials,\n\t\toauthAccountPool: OAuthAccountPool,\n\t\tnodeAccountMetadata: NodeAccountMetadataStore,\n\t\tconfig: ModelConfig,\n\t\tmodelsPath: string | undefined,\n\t\tmodelsStore: ModelsStore,\n\t\tproviders: readonly Provider[],\n\t\tmodelNetworkEnabled: boolean,\n\t\thcodeFacade: HcodeFacade,\n\t\tsessionOwned: boolean,\n\t\tconfigurationGuard?: (configuration: unknown) => void,\n\t) {\n\t\tthis.hcodeFacade = hcodeFacade;\n\t\tthis.hcode = hcodeFacade.context;\n\t\tthis.metadata = {\n\t\t\tfeature: (...args) => swallow(() => hcodeFacade.metadata.feature(...args)),\n\t\t\ttool: (...args) => swallow(() => hcodeFacade.metadata.tool(...args)),\n\t\t\tinference: (...args) => swallow(() => hcodeFacade.metadata.inference(...args)),\n\t\t\tfailure: (...args) => swallow(() => hcodeFacade.metadata.failure(...args)),\n\t\t};\n\t\tthis.sessionOwned = sessionOwned;\n\t\tthis.credentials = credentials;\n\t\tthis.configurationGuard = configurationGuard;\n\t\tthis.assertConfiguration(config);\n\t\tthis.oauthAccountPool = oauthAccountPool;\n\t\tthis.nodeAccountMetadata = nodeAccountMetadata;\n\t\tthis.config = config;\n\t\tthis.modelsPath = modelsPath;\n\t\tthis.modelNetworkEnabled = modelNetworkEnabled;\n\t\tthis.defaultBuiltins = new Map(providers.map((provider) => [provider.id, provider]));\n\t\tfor (const [providerId, provider] of this.defaultBuiltins) this.builtins.set(providerId, provider);\n\t\tthis.models = createModels({ credentials, modelsStore });\n\t\tthis.rebuildProviders();\n\t}\n\n\tstatic async create(options: CreateModelRuntimeOptions = {}): Promise<ModelRuntime> {\n\t\tconst environment = resolveHcodeEnvironment(options.hcode?.environment);\n\t\tif (options.hcode?.profile && options.hcode.profile.environmentId !== environment.id)\n\t\t\tthrow new Error(\"HUMAIN Code account environment conflicts with the requested environment.\");\n\t\tconst credentials = new RuntimeCredentials(\n\t\t\toptions.credentials ?? DefaultAuthStorage.create(options.authPath),\n\t\t\tenvironment.id,\n\t\t\toptions.configurationGuard,\n\t\t);\n\t\tconst oauthAccountPool =\n\t\t\toptions.oauthAccountPool ??\n\t\t\t(options.credentials\n\t\t\t\t? OAuthAccountPool.inMemory(credentials.accountStore)\n\t\t\t\t: OAuthAccountPool.create(\n\t\t\t\t\t\tcredentials.accountStore,\n\t\t\t\t\t\tjoin(dirname(options.authPath ?? join(getAgentDir(), \"auth.json\")), \"oauth-accounts.json\"),\n\t\t\t\t\t));\n\t\tconst nodeAccountMetadata =\n\t\t\toptions.nodeAccountMetadata ??\n\t\t\t(options.credentials\n\t\t\t\t? new InMemoryNodeAccountMetadataStore()\n\t\t\t\t: new FileNodeAccountMetadataStore(\n\t\t\t\t\t\tjoin(dirname(options.authPath ?? join(getAgentDir(), \"auth.json\")), \"humain-node-accounts.json\"),\n\t\t\t\t\t));\n\t\tconst modelsPath =\n\t\t\toptions.modelsPath === null ? undefined : (options.modelsPath ?? join(getAgentDir(), \"models.json\"));\n\t\tconst config = await ModelConfig.load(modelsPath);\n\t\tconst modelsStore =\n\t\t\toptions.modelsStore ??\n\t\t\t(modelsPath\n\t\t\t\t? new FileModelsStore(options.modelsStorePath ?? join(dirname(modelsPath), \"models-store.json\"))\n\t\t\t\t: new InMemoryCodingAgentModelsStore());\n\t\tconst builtinModelDataGeneratedAt = builtinProviderCatalog.getBuiltinModelDataGeneratedAt();\n\t\tconst providers = builtinProviderCatalog\n\t\t\t.builtinProviders()\n\t\t\t.map((provider) => {\n\t\t\t\tif (provider.id === \"radius\") return provider;\n\t\t\t\t// OpenRouter narrows the catalog to the models, limits and prices of the user's key.\n\t\t\t\tif (provider.id === \"openrouter\") {\n\t\t\t\t\treturn withPersonalizedCatalog(\n\t\t\t\t\t\tprovider,\n\t\t\t\t\t\tpersonalizeOpenRouterCatalog,\n\t\t\t\t\t\toptions.catalogBaseUrl,\n\t\t\t\t\t\tbuiltinModelDataGeneratedAt,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn withRemoteCatalog(provider, options.catalogBaseUrl, builtinModelDataGeneratedAt);\n\t\t\t})\n\t\t\t.map((provider) => {\n\t\t\t\tif (provider.id !== \"amazon-bedrock\") return provider;\n\t\t\t\tconst getModels = provider.getModels.bind(provider);\n\t\t\t\tconst filtered: Provider = { ...provider, getModels: () => filterBedrockCatalog(getModels()) };\n\t\t\t\t// The filter keeps or drops models by id alone: the listing is filtered as the models are.\n\t\t\t\treturn setModelListing(filtered, () => {\n\t\t\t\t\tconst listing = getModelListing(provider);\n\t\t\t\t\treturn listing && { entries: filterBedrockCatalog(listing.entries), models: filtered.getModels };\n\t\t\t\t});\n\t\t\t});\n\t\tconst hcodeFacade = createHcodeFacade(\n\t\t\t{\n\t\t\t\t...options.hcode,\n\t\t\t\tpublication: {\n\t\t\t\t\t// A durable decision must reject I/O failure, not use AuthStorage's signal-free cached-read fallback.\n\t\t\t\t\tread: async (signal) =>\n\t\t\t\t\t\treferenceFromCredential(\n\t\t\t\t\t\t\tawait credentials.readStored(HCODE_PROVIDER, { signal: operationSignal(signal) }),\n\t\t\t\t\t\t),\n\t\t\t\t\tclear: async (expected, signal) => {\n\t\t\t\t\t\tawait credentials.deleteStored(HCODE_PROVIDER, {\n\t\t\t\t\t\t\tsignal,\n\t\t\t\t\t\t\tifCurrent: (current) =>\n\t\t\t\t\t\t\t\texpected !== null && sameCredential(current, hcodeReferenceCredential(expected)),\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tawait credentials.readStored(HCODE_PROVIDER, { signal: options.signal }),\n\t\t);\n\t\t// Trusted builtin installation bypasses no custom registration guard and survives reconstruction.\n\t\tproviders.push(hcodeFacade.provider);\n\t\tconst runtime = new ModelRuntime(\n\t\t\tcredentials,\n\t\t\toauthAccountPool,\n\t\t\tnodeAccountMetadata,\n\t\t\tconfig,\n\t\t\tmodelsPath,\n\t\t\tmodelsStore,\n\t\t\tproviders,\n\t\t\tprocess.env.PI_OFFLINE === undefined,\n\t\t\thcodeFacade,\n\t\t\toptions.sessionOwned === true,\n\t\t\toptions.configurationGuard,\n\t\t);\n\t\t// The public account port must use the same CAS publisher as runtime/provider login.\n\t\thcodeFacade.context.account.login = async (interaction, signal) => {\n\t\t\tconst credential = await runtime.login(HCODE_PROVIDER, \"api_key\", {\n\t\t\t\t...interaction,\n\t\t\t\tsignal: interaction.signal ? AbortSignal.any([interaction.signal, signal]) : signal,\n\t\t\t});\n\t\t\tconst reference = referenceFromCredential(credential);\n\t\t\tif (!reference) throw new ModelsError(\"auth\", \"HUMAIN Code account changed.\");\n\t\t\treturn reference;\n\t\t};\n\t\truntime.configureRadiusProviders();\n\t\truntime.rebuildProviders();\n\t\tconst refreshFromNetwork = runtime.modelNetworkEnabled && options.allowModelNetwork === true;\n\t\tconst controller =\n\t\t\trefreshFromNetwork && options.modelRefreshTimeoutMs !== undefined ? new AbortController() : undefined;\n\t\tconst timeout = controller ? setTimeout(() => controller.abort(), options.modelRefreshTimeoutMs) : undefined;\n\t\tconst signal = controller\n\t\t\t? options.signal\n\t\t\t\t? AbortSignal.any([options.signal, controller.signal])\n\t\t\t\t: controller.signal\n\t\t\t: options.signal;\n\t\ttry {\n\t\t\tif (options.refreshOnCreate !== false) {\n\t\t\t\tawait runtime.refresh({\n\t\t\t\t\tallowNetwork: refreshFromNetwork,\n\t\t\t\t\t// Native catalogs require an explicit account action, not generic startup network consent.\n\t\t\t\t\tproviders: refreshFromNetwork\n\t\t\t\t\t\t? runtime\n\t\t\t\t\t\t\t\t.getProviders()\n\t\t\t\t\t\t\t\t.filter((provider) => provider.id !== HCODE_PROVIDER)\n\t\t\t\t\t\t\t\t.map((provider) => provider.id)\n\t\t\t\t\t\t: undefined,\n\t\t\t\t\tsignal,\n\t\t\t\t});\n\t\t\t}\n\t\t} catch (error) {\n\t\t\truntime.dispose();\n\t\t\tthrow error;\n\t\t} finally {\n\t\t\tif (timeout) clearTimeout(timeout);\n\t\t}\n\t\treturn runtime;\n\t}\n\n\tprivate assertConfiguration(config: ModelConfig): void {\n\t\tif (this.configurationGuard)\n\t\t\tthis.configurationGuard(Object.fromEntries(config.getProviderIds().map((id) => [id, config.getProvider(id)])));\n\t}\n\n\tprivate configureRadiusProviders(): void {\n\t\tthis.builtins.clear();\n\t\tfor (const [providerId, provider] of this.defaultBuiltins) this.builtins.set(providerId, provider);\n\t\tfor (const providerId of this.config.getProviderIds()) {\n\t\t\tif (providerId === HCODE_PROVIDER) continue;\n\t\t\tconst config = this.config.getProvider(providerId);\n\t\t\tif (config?.oauth !== \"radius\" || !config.baseUrl) continue;\n\t\t\tthis.builtins.set(\n\t\t\t\tproviderId,\n\t\t\t\tbuiltinProviderCatalog.radiusProvider({\n\t\t\t\t\tid: providerId,\n\t\t\t\t\tname: config.name ?? providerId,\n\t\t\t\t\tgateway: config.baseUrl.replace(/\\/v1\\/?$/u, \"\"),\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate providerIds(): Set<string> {\n\t\treturn new Set([\n\t\t\t...this.builtins.keys(),\n\t\t\t...this.nativeExtensionProviders.keys(),\n\t\t\t...this.config.getProviderIds(),\n\t\t\t...this.extensionProviders.keys(),\n\t\t\t...this.virtualModels.keys(),\n\t\t]);\n\t}\n\n\t/** Returns the provider without virtual models, or undefined when only virtual models define it. */\n\tprivate recomposeProvider(providerId: string): Provider | undefined {\n\t\tconst composed = this.composeProvider(providerId);\n\t\tlet provider = composed;\n\t\tif (provider?.auth.apiKey) {\n\t\t\tconst apiKey = provider.auth.apiKey;\n\t\t\tconst withCredentialEnv = (input: Parameters<typeof apiKey.resolve>[0]) => {\n\t\t\t\tconst env = input.credential?.env;\n\t\t\t\tconst ctx = input.ctx;\n\t\t\t\treturn env\n\t\t\t\t\t? { ...input, ctx: { ...ctx, env: async (name: string) => env[name] || (await ctx.env(name)) } }\n\t\t\t\t\t: input;\n\t\t\t};\n\t\t\tprovider = {\n\t\t\t\t...provider,\n\t\t\t\tauth: {\n\t\t\t\t\t...provider.auth,\n\t\t\t\t\tapiKey: {\n\t\t\t\t\t\t...apiKey,\n\t\t\t\t\t\tresolve: async (input) => {\n\t\t\t\t\t\t\tif (input.purpose !== \"catalog\") {\n\t\t\t\t\t\t\t\tconst result = await apiKey.resolve(withCredentialEnv(input));\n\t\t\t\t\t\t\t\tconst key =\n\t\t\t\t\t\t\t\t\t!this.credentials.hasRuntimeApiKey(providerId) &&\n\t\t\t\t\t\t\t\t\tinput.credential?.key &&\n\t\t\t\t\t\t\t\t\tinput.credential.key === result?.auth.apiKey\n\t\t\t\t\t\t\t\t\t\t? this.oauthAccountPool.getAccountKeyForApiKey(providerId, input.credential.key)\n\t\t\t\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\t\t\t\tthis.oauthAccountObserver.getStore()?.(providerId, key);\n\t\t\t\t\t\t\t\treturn result;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Models restores caches first. Evaluate commands only when it authorizes online auth.\n\t\t\t\t\t\t\tconst credential = await this.credentials.authResolution.run(providerId, () =>\n\t\t\t\t\t\t\t\tthis.credentials.read(providerId, { signal: input.signal }),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif (credential?.type === \"oauth\") return undefined;\n\t\t\t\t\t\t\treturn apiKey.resolve(withCredentialEnv({ ...input, credential }));\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcheck: apiKey.check ? (input) => apiKey.check!(withCredentialEnv(input)) : undefined,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tconst oauth = provider?.auth.oauth;\n\t\tif (provider && oauth && this.oauthAccountPool.isPooled(providerId)) {\n\t\t\tprovider = {\n\t\t\t\t...provider,\n\t\t\t\tauth: {\n\t\t\t\t\t...provider.auth,\n\t\t\t\t\toauth: {\n\t\t\t\t\t\t...oauth,\n\t\t\t\t\t\trefresh: async (credential, signal) => {\n\t\t\t\t\t\t\tconst refreshed = { ...(await oauth.refresh(credential, signal)) };\n\t\t\t\t\t\t\tfor (const field of OAUTH_ACCOUNT_IDENTITY_FIELDS) {\n\t\t\t\t\t\t\t\tif (refreshed[field] === undefined && credential[field] !== undefined) {\n\t\t\t\t\t\t\t\t\trefreshed[field] = credential[field];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn refreshed;\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttoAuth: async (credential) => {\n\t\t\t\t\t\t\tconst auth = await oauth.toAuth(credential);\n\t\t\t\t\t\t\tthis.oauthAccountObserver.getStore()?.(\n\t\t\t\t\t\t\t\tproviderId,\n\t\t\t\t\t\t\t\tthis.oauthAccountPool.getAccountIdentity(providerId, credential)?.key,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn auth;\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tif (providerId === \"openrouter\" && provider?.refreshModels && !this.nativeExtensionProviders.has(providerId)) {\n\t\t\tconst refreshModels = provider.refreshModels.bind(provider);\n\t\t\tprovider = {\n\t\t\t\t...provider,\n\t\t\t\trefreshModels: async (context) => {\n\t\t\t\t\tlet credential = context.credential;\n\t\t\t\t\tif (!context.allowNetwork && credential?.type !== \"oauth\") {\n\t\t\t\t\t\tconst stored = this.credentials.getRuntimeApiKey(providerId)\n\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t: await this.credentials.readStored(providerId, { signal: context.signal });\n\t\t\t\t\t\tconst command =\n\t\t\t\t\t\t\tthis.credentials.isExternalCredential(stored) &&\n\t\t\t\t\t\t\tstored?.type === \"api_key\" &&\n\t\t\t\t\t\t\tstored.key !== undefined &&\n\t\t\t\t\t\t\tisCommandConfigValue(stored.key);\n\t\t\t\t\t\tconst configuredKey =\n\t\t\t\t\t\t\tthis.extensionProviders.get(providerId)?.apiKey ?? this.config.getProvider(providerId)?.apiKey;\n\t\t\t\t\t\t// Cache identity checks must not execute commands, resolve headers or refresh OAuth.\n\t\t\t\t\t\tlet key = credential?.key || credential?.env?.OPENROUTER_API_KEY || process.env.OPENROUTER_API_KEY;\n\t\t\t\t\t\tif (command) key = undefined;\n\t\t\t\t\t\telse if (!credential && configuredKey !== undefined) {\n\t\t\t\t\t\t\tkey = isCommandConfigValue(configuredKey) ? undefined : resolveConfigValue(configuredKey);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcredential = key ? { ...credential, type: \"api_key\", key } : undefined;\n\t\t\t\t\t}\n\t\t\t\t\tawait refreshModels({ ...context, credential });\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\t// The wrappers above change auth and refresh only: the provider's models are still named by its listing.\n\t\tif (provider && composed && provider !== composed) setModelListing(provider, () => getModelListing(composed));\n\t\tconst virtualModels = [...(this.virtualModels.get(providerId)?.values() ?? [])].map((entry) => entry.model);\n\t\tif (virtualModels.length > 0) this.models.setProvider(withVirtualModels(providerId, provider, virtualModels));\n\t\telse if (provider) this.models.setProvider(provider);\n\t\telse this.models.deleteProvider(providerId);\n\t\treturn provider;\n\t}\n\n\t/** The provider without virtual models, or undefined when nothing defines it. */\n\tprivate composeProvider(providerId: string): Provider | undefined {\n\t\tconst base = this.nativeExtensionProviders.get(providerId) ?? this.builtins.get(providerId);\n\t\tconst extension = this.extensionProviders.get(providerId);\n\t\t// HUMAIN Gateway origin, headers and models are fixed; overlays would bypass its request safeguards.\n\t\tif (rejectsConfigOverlays(providerId) && (this.config.getProvider(providerId) || extension)) {\n\t\t\tthis.compositionErrors.set(\n\t\t\t\tproviderId,\n\t\t\t\t`${providerId === HCODE_PROVIDER ? \"HUMAIN Code account\" : \"HUMAIN Gateway\"} does not accept models.json overrides.`,\n\t\t\t);\n\t\t\treturn base;\n\t\t}\n\t\tif (!this.config.getProvider(providerId) && !extension) {\n\t\t\t// No overlays: use the builtin untouched so its auth/login/stream behavior is exact.\n\t\t\tthis.compositionErrors.delete(providerId);\n\t\t\treturn base;\n\t\t}\n\t\ttry {\n\t\t\tconst provider = composeModelProvider(providerId, base, this.config, extension);\n\t\t\tthis.compositionErrors.delete(providerId);\n\t\t\treturn provider;\n\t\t} catch (error) {\n\t\t\tthis.compositionErrors.set(providerId, error instanceof Error ? error.message : String(error));\n\t\t\treturn base;\n\t\t}\n\t}\n\n\tprivate rebuildProviders(): void {\n\t\tthis.models.clearProviders();\n\t\tthis.compositionErrors.clear();\n\t\tfor (const providerId of this.providerIds()) this.recomposeProvider(providerId);\n\t\tthis.updateModelSnapshot();\n\t}\n\n\tprivate updateModelSnapshot(): void {\n\t\tconst all = new ChatModelsSnapshot(this.models.getProviders());\n\t\tthis.snapshot = {\n\t\t\t...this.snapshot,\n\t\t\tall,\n\t\t\tavailable: all.ofProviders(this.snapshot.configuredProviders),\n\t\t};\n\t}\n\n\tprivate async runAvailabilityRefresh(seq: number, errorSeq: number, signal: AbortSignal): Promise<void> {\n\t\tconst providers = this.models.getProviders();\n\t\tconst [available, checks, credentials] = await Promise.all([\n\t\t\tthis.models.getAvailable(undefined, { signal }),\n\t\t\tPromise.all(\n\t\t\t\tproviders.map(\n\t\t\t\t\tasync (provider): Promise<[string, AuthCheck | undefined]> => [\n\t\t\t\t\t\tprovider.id,\n\t\t\t\t\t\tawait this.models.checkAuth(provider.id, { signal }),\n\t\t\t\t\t],\n\t\t\t\t),\n\t\t\t),\n\t\t\tthis.credentials.list({ signal }),\n\t\t]);\n\t\tif (seq !== this.availabilityRefreshSeq) return;\n\t\tconst auth = new Map(checks);\n\t\tconst configuredProviders = new Set(\n\t\t\tchecks\n\t\t\t\t.filter((entry): entry is [string, AuthCheck] => entry[1] !== undefined)\n\t\t\t\t.map(([providerId]) => providerId),\n\t\t);\n\t\tthis.snapshot = {\n\t\t\tall: new ChatModelsSnapshot(this.models.getProviders()),\n\t\t\tavailable: [...available],\n\t\t\tconfiguredProviders,\n\t\t\tstoredProviders: new Set(credentials.map((entry) => entry.providerId)),\n\t\t\tauth,\n\t\t};\n\t\tif (errorSeq === this.availabilityErrorSeq) this.availabilityError = undefined;\n\t}\n\n\tprivate queueAvailabilityRefresh(signal?: AbortSignal): Promise<void> {\n\t\tconst seq = ++this.availabilityRefreshSeq;\n\t\tfor (const [providerId, providerSeq] of this.providerAvailabilitySeq) {\n\t\t\tthis.providerAvailabilitySeq.set(providerId, providerSeq + 1);\n\t\t}\n\t\tconst errorSeq = ++this.availabilityErrorSeq;\n\t\tconst effectiveSignal = operationSignal(signal);\n\t\treturn this.runAvailabilityRefresh(seq, errorSeq, effectiveSignal).catch((error) => {\n\t\t\tif (errorSeq === this.availabilityErrorSeq && !effectiveSignal.aborted) {\n\t\t\t\tthis.availabilityError = error instanceof Error ? error.message : String(error);\n\t\t\t}\n\t\t\tthrow error;\n\t\t});\n\t}\n\n\tprivate async refreshProviderAvailability(providerId: string, signal: AbortSignal): Promise<void> {\n\t\t// Invalidate any full availability pass that started before this credential change.\n\t\t++this.availabilityRefreshSeq;\n\t\tconst providerSeq = (this.providerAvailabilitySeq.get(providerId) ?? 0) + 1;\n\t\tthis.providerAvailabilitySeq.set(providerId, providerSeq);\n\t\tconst errorSeq = ++this.availabilityErrorSeq;\n\t\ttry {\n\t\t\tconst [available, auth, credential] = await Promise.all([\n\t\t\t\tthis.models.getAvailable(providerId, { signal }),\n\t\t\t\tthis.models.checkAuth(providerId, { signal }),\n\t\t\t\tthis.credentials.read(providerId, { signal }),\n\t\t\t]);\n\t\t\tsignal.throwIfAborted();\n\t\t\tif (this.providerAvailabilitySeq.get(providerId) !== providerSeq) return;\n\t\t\tconst configuredProviders = new Set(this.snapshot.configuredProviders);\n\t\t\tconst storedProviders = new Set(this.snapshot.storedProviders);\n\t\t\tconst authByProvider = new Map(this.snapshot.auth);\n\t\t\tif (auth) {\n\t\t\t\tconfiguredProviders.add(providerId);\n\t\t\t\tauthByProvider.set(providerId, auth);\n\t\t\t} else {\n\t\t\t\tconfiguredProviders.delete(providerId);\n\t\t\t\tauthByProvider.delete(providerId);\n\t\t\t}\n\t\t\tif (credential) storedProviders.add(providerId);\n\t\t\telse storedProviders.delete(providerId);\n\t\t\tconst all = new ChatModelsSnapshot(this.models.getProviders());\n\t\t\tconst availableById = new Map(\n\t\t\t\t[...this.snapshot.available.filter((model) => model.provider !== providerId), ...available].map((model) => [\n\t\t\t\t\t`${model.provider}\\0${model.id}`,\n\t\t\t\t\tmodel,\n\t\t\t\t]),\n\t\t\t);\n\t\t\t// (Only the providers of these models have models to look up.)\n\t\t\tconst availableProviders = new Set(Array.from(availableById.values(), (model) => model.provider));\n\t\t\tthis.snapshot = {\n\t\t\t\tall,\n\t\t\t\tavailable: all\n\t\t\t\t\t.ofProviders(availableProviders)\n\t\t\t\t\t.flatMap((model) => availableById.get(`${model.provider}\\0${model.id}`) ?? []),\n\t\t\t\tconfiguredProviders,\n\t\t\t\tstoredProviders,\n\t\t\t\tauth: authByProvider,\n\t\t\t};\n\t\t\tif (errorSeq === this.availabilityErrorSeq) this.availabilityError = undefined;\n\t\t} catch (error) {\n\t\t\tif (\n\t\t\t\tthis.providerAvailabilitySeq.get(providerId) === providerSeq &&\n\t\t\t\terrorSeq === this.availabilityErrorSeq &&\n\t\t\t\t!signal.aborted\n\t\t\t) {\n\t\t\t\tthis.availabilityError = error instanceof Error ? error.message : String(error);\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tgetProviders(): readonly Provider[] {\n\t\treturn this.models.getProviders();\n\t}\n\n\tgetProvider(providerId: string): Provider | undefined {\n\t\treturn this.models.getProvider(providerId);\n\t}\n\n\tgetModels(providerId?: string): readonly Model<Api>[] {\n\t\treturn this.models.getModels(providerId);\n\t}\n\n\tgetModel(providerId: string, modelId: string): Model<Api> | undefined {\n\t\treturn this.models.getModel(providerId, modelId);\n\t}\n\n\t/**\n\t * Every chat model in `getModels()` order, for choosing models by provider, id and name without building every catalog:\n\t * a provider whose catalog is not built yet is listed by stand-ins that have only `provider`, `id` and `name`.\n\t * `model()` returns the model a stand-in stands for (building that provider's catalog), and a model as it is.\n\t */\n\tgetModelChoices(): { models: readonly Model<Api>[]; model(choice: Model<Api>): Model<Api> } {\n\t\tconst models: Model<Api>[] = [];\n\t\tconst standIns = new Map<Model<Api>, { listing: ModelListing; index: number }>();\n\t\tfor (const provider of this.models.getProviders()) {\n\t\t\tconst listing = getModelListing(provider);\n\t\t\tif (!listing) {\n\t\t\t\ttry {\n\t\t\t\t\tmodels.push(...provider.getModels());\n\t\t\t\t} catch {\n\t\t\t\t\t// As in Models.getModels(): a provider whose getModels() throws has no models.\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tlisting.entries.forEach((entry, index) => {\n\t\t\t\tconst standIn = entry as Model<Api>;\n\t\t\t\tmodels.push(standIn);\n\t\t\t\tstandIns.set(standIn, { listing, index });\n\t\t\t});\n\t\t}\n\t\treturn {\n\t\t\tmodels,\n\t\t\tmodel: (choice) => {\n\t\t\t\tconst standIn = standIns.get(choice);\n\t\t\t\treturn standIn ? standIn.listing.models()[standIn.index] : choice;\n\t\t\t},\n\t\t};\n\t}\n\n\tgetModelsOfType<TType extends ModelType>(type: TType, providerId?: string): readonly ModelTypeMap[TType][] {\n\t\treturn this.models.getModelsOfType(type, providerId);\n\t}\n\n\tgetModelOfType<TType extends ModelType>(\n\t\ttype: TType,\n\t\tproviderId: string,\n\t\tmodelId: string,\n\t): ModelTypeMap[TType] | undefined {\n\t\treturn this.models.getModelOfType(type, providerId, modelId);\n\t}\n\n\tgetAllModels(providerId?: string): readonly AnyModel[] {\n\t\treturn this.models.getAllModels(providerId);\n\t}\n\n\tgetAvailableOfType<TType extends ModelType>(\n\t\ttype: TType,\n\t\tproviderId?: string,\n\t\toptions?: AuthOperationOptions,\n\t): Promise<readonly ModelTypeMap[TType][]> {\n\t\treturn this.models.getAvailableOfType(type, providerId, options);\n\t}\n\n\tgetAllAvailable(providerId?: string, options?: AuthOperationOptions): Promise<readonly AnyModel[]> {\n\t\treturn this.models.getAllAvailable(providerId, options);\n\t}\n\n\tasync checkAuth(providerId: string, options?: AuthOperationOptions): Promise<AuthCheck | undefined> {\n\t\treturn this.models.checkAuth(providerId, options);\n\t}\n\n\tasync getAvailable(providerId?: string, options?: AuthOperationOptions): Promise<readonly Model<Api>[]> {\n\t\tif (providerId) {\n\t\t\tconst errorSeq = ++this.availabilityErrorSeq;\n\t\t\ttry {\n\t\t\t\tconst available = await this.models.getAvailable(providerId, options);\n\t\t\t\tif (errorSeq === this.availabilityErrorSeq) this.availabilityError = undefined;\n\t\t\t\treturn available;\n\t\t\t} catch (error) {\n\t\t\t\tif (errorSeq === this.availabilityErrorSeq && !options?.signal?.aborted) {\n\t\t\t\t\tthis.availabilityError = error instanceof Error ? error.message : String(error);\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t\tawait this.queueAvailabilityRefresh(options?.signal);\n\t\treturn this.snapshot.available;\n\t}\n\n\tgetAvailableSnapshot(): readonly Model<Api>[] {\n\t\treturn this.snapshot.available;\n\t}\n\n\tgetError(): string | undefined {\n\t\tconst errors: string[] = [];\n\t\tconst configError = this.config.getError();\n\t\tif (configError) errors.push(configError);\n\t\tfor (const [providerId, error] of this.compositionErrors) {\n\t\t\terrors.push(`Provider \"${providerId}\": ${error}`);\n\t\t}\n\t\tif (this.availabilityError) errors.push(`Availability refresh: ${this.availabilityError}`);\n\t\tconst poolError = this.oauthAccountPool.getError();\n\t\tif (poolError) errors.push(poolError);\n\t\treturn errors.length > 0 ? errors.join(\"\\n\\n\") : undefined;\n\t}\n\n\tgetRegisteredProviderConfig(providerId: string): ProviderConfigInput | undefined {\n\t\treturn this.extensionProviders.get(providerId);\n\t}\n\n\tgetRegisteredProviderIds(): readonly string[] {\n\t\treturn [...new Set([...this.extensionProviders.keys(), ...this.nativeExtensionProviders.keys()])];\n\t}\n\n\tgetRegisteredNativeProvider(providerId: string): Provider | undefined {\n\t\treturn this.nativeExtensionProviders.get(providerId);\n\t}\n\n\t/** @internal Compatibility fallback for ModelRegistry when provider auth is unconfigured. */\n\tgetCompatibilityRequestConfig(model: Model<Api>): CompatibilityRequestConfig {\n\t\tif (model.provider === HCODE_PROVIDER) throw new ModelsError(\"auth\", \"HUMAIN Code account is unavailable.\");\n\t\tif (rejectsConfigOverlays(model.provider)) return resolveCompatibilityRequestConfig(model, undefined, undefined);\n\t\treturn resolveCompatibilityRequestConfig(\n\t\t\tmodel,\n\t\t\tthis.config.getProvider(model.provider),\n\t\t\tthis.extensionProviders.get(model.provider),\n\t\t);\n\t}\n\n\tisUsingOAuth(providerId: string): boolean {\n\t\treturn this.snapshot.auth.get(providerId)?.type === \"oauth\";\n\t}\n\n\tisUsingSubscription(providerId: string): boolean {\n\t\tconst auth = this.models.getProvider(providerId)?.auth;\n\t\treturn this.isUsingOAuth(providerId)\n\t\t\t? auth?.oauth?.isSubscription === true\n\t\t\t: this.hasConfiguredAuth(providerId) && auth?.apiKey?.isSubscription === true;\n\t}\n\n\thasConfiguredAuth(providerId: string): boolean {\n\t\treturn this.snapshot.configuredProviders.has(providerId);\n\t}\n\n\t/** @internal Pin an already-resolved identity to this model's probe, without changing concurrent requests. */\n\twithResolvedAuth<T>(model: AnyModel, resolution: AuthResult, accountKey: string | undefined, run: () => T): T {\n\t\treturn this.resolvedRequestAuth.run({ model, resolution, accountKey }, run);\n\t}\n\n\tgetAuth(providerId: string, overrides?: ModelRuntimeAuthOverrides): Promise<AuthResult | undefined>;\n\tgetAuth(model: AnyModel, overrides?: ModelRuntimeAuthOverrides): Promise<AuthResult | undefined>;\n\tasync getAuth(\n\t\tproviderOrModel: string | AnyModel,\n\t\toverrides: ModelRuntimeAuthOverrides = {},\n\t): Promise<AuthResult | undefined> {\n\t\tconst providerId = typeof providerOrModel === \"string\" ? providerOrModel : providerOrModel.provider;\n\t\tconst pinned = this.resolvedRequestAuth.getStore();\n\t\tif (pinned?.model === providerOrModel) {\n\t\t\toverrides.signal?.throwIfAborted();\n\t\t\toverrides.onOAuthAccount?.(providerId, pinned.accountKey);\n\t\t\treturn pinned.resolution;\n\t\t}\n\t\tconst resolution = await this.credentials.authResolution.run(providerId, () =>\n\t\t\tthis.oauthAccountObserver.run(overrides.onOAuthAccount, () =>\n\t\t\t\ttypeof providerOrModel === \"string\"\n\t\t\t\t\t? this.models.getAuth(providerOrModel, overrides)\n\t\t\t\t\t: this.models.getAuth(providerOrModel, overrides),\n\t\t\t),\n\t\t);\n\t\tif (typeof providerOrModel === \"string\") return resolution;\n\t\tif (!resolution) return undefined;\n\t\t// Rejected HUMAIN Gateway overlays must not reach requests either.\n\t\tif (rejectsConfigOverlays(providerOrModel.provider)) return resolution;\n\t\tconst configuredHeaders = resolveConfiguredModelHeaders(\n\t\t\tproviderOrModel,\n\t\t\tthis.config.getProvider(providerOrModel.provider),\n\t\t\tthis.extensionProviders.get(providerOrModel.provider),\n\t\t\t{ ...(resolution.env ?? {}), ...(overrides.env ?? {}) },\n\t\t);\n\t\treturn {\n\t\t\t...resolution,\n\t\t\tauth: {\n\t\t\t\t...resolution.auth,\n\t\t\t\theaders: mergeHeaders(resolution.auth.headers, configuredHeaders),\n\t\t\t},\n\t\t};\n\t}\n\n\tprivate protectCredentialOperation<T>(operation: Promise<T>, signal?: AbortSignal, mutation = true): Promise<T> {\n\t\treturn operation.catch((error: unknown) => {\n\t\t\tif (error instanceof CredentialSynchronizationError)\n\t\t\t\tthrow new CredentialSynchronizationError(error.providerId, error.operation);\n\t\t\tif (error instanceof AccountSourceReplacementError) throw new AccountSourceReplacementError();\n\t\t\tif (error instanceof LoginCancellationError) throw new LoginCancellationError();\n\t\t\t// Fixed-text errors stay readable; a fresh instance drops any cause or extra properties.\n\t\t\tif (error instanceof SafeCredentialError && !signal?.aborted) throw new SafeCredentialError(error.message);\n\t\t\t// Backends can reject after writing. Never claim rollback or attach arbitrary errors, causes or abort reasons.\n\t\t\tconst safe = new ModelsError(\n\t\t\t\t\"auth\",\n\t\t\t\tmutation\n\t\t\t\t\t? \"Credential operation failed. Stored state may have changed. Inspect accounts and refresh local models before retrying.\"\n\t\t\t\t\t: \"Could not read account metadata. Check credential storage and provider configuration.\",\n\t\t\t);\n\t\t\tif (signal?.aborted) safe.name = \"AbortError\";\n\t\t\tthrow safe;\n\t\t});\n\t}\n\n\tprivate enqueueCredentialOperation<T>(providerId: string, signal: AbortSignal, task: () => Promise<T>): Promise<T> {\n\t\tconst previous = this.credentialOperations.get(providerId) ?? Promise.resolve();\n\t\tlet markStarted: (() => void) | undefined;\n\t\tconst started = new Promise<void>((resolve) => {\n\t\t\tmarkStarted = resolve;\n\t\t});\n\t\tconst operation = (async () => {\n\t\t\tawait previous.catch(() => {});\n\t\t\tsignal.throwIfAborted();\n\t\t\tmarkStarted?.();\n\t\t\treturn task();\n\t\t})();\n\t\tconst tail = operation.catch(() => {});\n\t\tthis.credentialOperations.set(providerId, tail);\n\t\tvoid tail.then(() => {\n\t\t\tif (this.credentialOperations.get(providerId) === tail) this.credentialOperations.delete(providerId);\n\t\t});\n\t\treturn this.protectCredentialOperation(\n\t\t\traceWithAbortSignal(started, signal).then(() => operation),\n\t\t\tsignal,\n\t\t);\n\t}\n\n\tprivate async synchronizeCredentialState(\n\t\tproviderId: string,\n\t\toperation: CredentialSynchronizationOperation,\n\t\tsignal: AbortSignal,\n\t): Promise<void> {\n\t\ttry {\n\t\t\tsignal.throwIfAborted();\n\t\t\tthis.recomposeProvider(providerId);\n\t\t\tconst compositionError = this.compositionErrors.get(providerId);\n\t\t\t// The rejected Gateway overlay leaves the native provider intact, so credentials still sync.\n\t\t\tif (compositionError && !rejectsConfigOverlays(providerId)) throw new Error(compositionError);\n\t\t\tconst result = await this.models.refresh({ allowNetwork: false, providers: [providerId], signal });\n\t\t\tif (result.aborted) signal.throwIfAborted();\n\t\t\tconst refreshError = result.errors.get(providerId);\n\t\t\tif (refreshError) throw refreshError;\n\t\t\tthis.updateModelSnapshot();\n\t\t\tawait this.refreshProviderAvailability(providerId, signal);\n\t\t} catch {\n\t\t\t// Adapter failures may contain credentials, including nested causes and custom properties.\n\t\t\tconst error = new CredentialSynchronizationError(providerId, operation);\n\t\t\tif (this.compositionErrors.has(providerId)) this.compositionErrors.set(providerId, error.message);\n\t\t\tif (this.availabilityError) this.availabilityError = error.message;\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tasync setRuntimeApiKey(providerId: string, apiKey: string, options: AuthOperationOptions = {}): Promise<void> {\n\t\tassertCustomProviderId(providerId);\n\t\tconst signal = operationSignal(options.signal);\n\t\treturn this.enqueueCredentialOperation(providerId, signal, async () => {\n\t\t\tthis.credentials.setRuntimeApiKey(providerId, apiKey);\n\t\t\tawait this.synchronizeCredentialState(providerId, \"setRuntimeApiKey\", signal);\n\t\t});\n\t}\n\n\tremoveRuntimeApiKey(providerId: string, options: AuthOperationOptions = {}): Promise<void> {\n\t\tconst signal = operationSignal(options.signal);\n\t\treturn this.enqueueCredentialOperation(providerId, signal, async () => {\n\t\t\tthis.credentials.removeRuntimeApiKey(providerId);\n\t\t\tawait this.synchronizeCredentialState(providerId, \"removeRuntimeApiKey\", signal);\n\t\t});\n\t}\n\n\t/**\n\t * Raw stored credential for host-owned reporting: no command or environment resolution, so reading it runs nothing.\n\t * Sensitive; callers must never display, log or persist it.\n\t */\n\treadStoredCredential(providerId: string, options?: AuthOperationOptions): Promise<Credential | undefined> {\n\t\treturn this.protectCredentialOperation(this.credentials.readStored(providerId, options), options?.signal, false);\n\t}\n\n\t/** Wait for started credential and pooled-account writes before process exit. */\n\tasync settleCredentialWrites(): Promise<void> {\n\t\twhile (this.credentialOperations.size > 0) await Promise.all(this.credentialOperations.values());\n\t\tawait this.credentials.settled();\n\t\tawait this.oauthAccountPool.settled();\n\t}\n\n\tlistCredentials(options?: AuthOperationOptions): Promise<readonly CredentialInfo[]> {\n\t\treturn this.protectCredentialOperation(this.credentials.list(options), options?.signal, false);\n\t}\n\n\t/** Global account management. Lists contain metadata only, never resolved credentials. */\n\treadonly accounts = {\n\t\tlist: (providerId: string, options?: AuthOperationOptions): Promise<AccountInfo[]> =>\n\t\t\tthis.protectCredentialOperation(\n\t\t\t\t(async () => {\n\t\t\t\t\tconst { storedEffective } = await this.readAccountSources(providerId, options);\n\t\t\t\t\t// Native references are never pooled; a session overlay must not depend on saved storage.\n\t\t\t\t\tif (providerId === HCODE_PROVIDER) return [];\n\t\t\t\t\tconst accounts = await this.oauthAccountPool.listAccounts(providerId, options);\n\t\t\t\t\tconst current = await this.oauthAccountPool.getCurrentAccount(providerId, options);\n\t\t\t\t\treturn accounts.map(({ key, label, credential, exhaustedUntil }) => ({\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tlabel,\n\t\t\t\t\t\ttype: credential.type,\n\t\t\t\t\t\texhaustedUntil,\n\t\t\t\t\t\tactive: key === current?.key,\n\t\t\t\t\t\teffective: key === current?.key && storedEffective,\n\t\t\t\t\t}));\n\t\t\t\t})(),\n\t\t\t\toptions?.signal,\n\t\t\t\tfalse,\n\t\t\t),\n\t\tsources: (providerId: string, options?: AuthOperationOptions): Promise<AccountSource[]> =>\n\t\t\tthis.protectCredentialOperation(\n\t\t\t\tthis.readAccountSources(providerId, options).then((result) => result.sources),\n\t\t\t\toptions?.signal,\n\t\t\t\tfalse,\n\t\t\t),\n\t\tswitch: (\n\t\t\tproviderId: string,\n\t\t\taccountKey: string,\n\t\t\toptions: AuthOperationOptions = {},\n\t\t): Promise<AccountInfo | undefined> => {\n\t\t\tconst signal = operationSignal(options.signal);\n\t\t\treturn this.enqueueCredentialOperation(providerId, signal, async () => {\n\t\t\t\tconst account = await this.oauthAccountPool.setActiveAccount(providerId, accountKey, { signal });\n\t\t\t\tif (!account) return undefined;\n\t\t\t\tawait this.synchronizeCredentialState(providerId, \"switchAccount\", signal);\n\t\t\t\treturn (await this.accounts.list(providerId, { signal })).find((entry) => entry.key === accountKey);\n\t\t\t});\n\t\t},\n\t\trename: (\n\t\t\tproviderId: string,\n\t\t\taccountKey: string,\n\t\t\tlabel: string,\n\t\t\toptions?: AuthOperationOptions,\n\t\t): Promise<AccountInfo | undefined> =>\n\t\t\tthis.protectCredentialOperation(\n\t\t\t\t(async () => {\n\t\t\t\t\tconst account = await this.oauthAccountPool.renameAccount(providerId, accountKey, label, options);\n\t\t\t\t\treturn account\n\t\t\t\t\t\t? (await this.accounts.list(providerId, options)).find((entry) => entry.key === accountKey)\n\t\t\t\t\t\t: undefined;\n\t\t\t\t})(),\n\t\t\t\toptions?.signal,\n\t\t\t),\n\t\tremove: (\n\t\t\tproviderId: string,\n\t\t\taccountKey: string,\n\t\t\toptions?: AuthOperationOptions,\n\t\t): Promise<AccountRemoveResult[\"status\"]> => this.logoutWithStatus(providerId, { ...options, accountKey }),\n\t};\n\n\t/** Enumerate raw source metadata without OAuth refresh, configuration commands or custom resolve callbacks. */\n\tprivate async readAccountSources(\n\t\tproviderId: string,\n\t\toptions?: AuthOperationOptions,\n\t): Promise<{ sources: AccountSource[]; storedEffective: boolean }> {\n\t\tconst signal = operationSignal(options?.signal);\n\t\tconst provider = this.models.getProvider(providerId);\n\t\tconst session = providerId === HCODE_PROVIDER ? this.hcodeSession : undefined;\n\t\tconst stored = session ? undefined : await this.credentials.readStored(providerId, { signal });\n\t\tif (providerId === HCODE_PROVIDER) {\n\t\t\tconst credential = session ? hcodeReferenceCredential(session) : stored;\n\t\t\tconst checked = await provider?.auth.apiKey?.check?.({\n\t\t\t\tctx: defaultProviderAuthContext(),\n\t\t\t\tcredential: credential?.type === \"api_key\" ? credential : undefined,\n\t\t\t\tsignal,\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tsources: credential\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tsource: session ? \"runtime\" : \"auth_json\",\n\t\t\t\t\t\t\t\tlabel: this.hcodeFacade.provider.name,\n\t\t\t\t\t\t\t\ttype: \"api_key\",\n\t\t\t\t\t\t\t\treadOnly: true,\n\t\t\t\t\t\t\t\teffective: !!checked,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t]\n\t\t\t\t\t: [],\n\t\t\t\tstoredEffective: !session && !!checked,\n\t\t\t};\n\t\t}\n\t\tconst runtimeKey = this.credentials.getRuntimeApiKey(providerId);\n\t\tconst extensionKey = this.extensionProviders.get(providerId)?.apiKey;\n\t\tconst modelsKey = this.config.getProvider(providerId)?.apiKey;\n\t\tconst configKey = extensionKey ?? modelsKey;\n\t\tconst external = this.credentials.isExternalCredential(stored);\n\t\tconst sources: AccountSource[] = [];\n\t\tconst add = (source: AccountSource[\"source\"], label: string, effective = false) =>\n\t\t\tsources.push({ source, label, type: \"api_key\", readOnly: true, effective });\n\t\tif (runtimeKey) add(\"runtime\", \"runtime API key\", provider?.auth.apiKey !== undefined);\n\t\tif (stored?.type === \"api_key\" && (external || !stored.key?.trim()))\n\t\t\tadd(\n\t\t\t\t\"auth_json\",\n\t\t\t\tstored.key\n\t\t\t\t\t? isCommandConfigValue(stored.key)\n\t\t\t\t\t\t? \"command in auth.json\"\n\t\t\t\t\t\t: \"environment reference in auth.json\"\n\t\t\t\t\t: ((providerId === HUMAIN_GATEWAY_PROVIDER ? describeGatewayCredential(stored.env) : undefined) ??\n\t\t\t\t\t\t\t\"provider configuration in auth.json\"),\n\t\t\t);\n\t\tif (extensionKey !== undefined) add(\"configuration\", \"extension API key\");\n\t\tif (modelsKey !== undefined) add(\"configuration\", \"API key in models.json\");\n\t\tconst env = stored?.type === \"api_key\" ? stored.env : undefined;\n\t\tconst ambientNames =\n\t\t\tproviderId === \"amazon-bedrock\"\n\t\t\t\t? [\n\t\t\t\t\t\t\"AWS_BEARER_TOKEN_BEDROCK\",\n\t\t\t\t\t\t\"AWS_PROFILE\",\n\t\t\t\t\t\t\"AWS_ACCESS_KEY_ID\",\n\t\t\t\t\t\t\"AWS_SECRET_ACCESS_KEY\",\n\t\t\t\t\t\t\"AWS_SESSION_TOKEN\",\n\t\t\t\t\t\t\"AWS_CONTAINER_CREDENTIALS_RELATIVE_URI\",\n\t\t\t\t\t\t\"AWS_CONTAINER_CREDENTIALS_FULL_URI\",\n\t\t\t\t\t\t\"AWS_WEB_IDENTITY_TOKEN_FILE\",\n\t\t\t\t\t\t\"AWS_ROLE_ARN\",\n\t\t\t\t\t\t\"AWS_REGION\",\n\t\t\t\t\t\t\"AWS_DEFAULT_REGION\",\n\t\t\t\t\t\t\"AWS_SHARED_CREDENTIALS_FILE\",\n\t\t\t\t\t\t\"AWS_CONFIG_FILE\",\n\t\t\t\t\t]\n\t\t\t\t: providerId === \"google-vertex\"\n\t\t\t\t\t? [\"GOOGLE_APPLICATION_CREDENTIALS\", \"GOOGLE_CLOUD_PROJECT\", \"GCLOUD_PROJECT\", \"GOOGLE_CLOUD_LOCATION\"]\n\t\t\t\t\t: [];\n\t\tconst authEnvironmentNames = new Set([\n\t\t\t...(findEnvKeys(providerId) ?? []),\n\t\t\t...(findEnvKeys(providerId, env) ?? []),\n\t\t\t...ambientNames.filter((name) => !!(env?.[name] || process.env[name])),\n\t\t]);\n\t\tfor (const name of authEnvironmentNames) add(\"environment\", name);\n\t\tlet storedEffective = false;\n\t\tif (!runtimeKey && provider) {\n\t\t\tif (stored?.type === \"oauth\") {\n\t\t\t\tstoredEffective = provider.auth.oauth !== undefined;\n\t\t\t} else if (provider.auth.apiKey) {\n\t\t\t\tif (\n\t\t\t\t\texternal &&\n\t\t\t\t\tstored?.type === \"api_key\" &&\n\t\t\t\t\tstored.key !== undefined &&\n\t\t\t\t\tisCommandConfigValue(stored.key)\n\t\t\t\t) {\n\t\t\t\t\t// A command owns this dispatch branch; listing never runs it to validate its result.\n\t\t\t\t\tsources.find((entry) => entry.source === \"auth_json\")!.effective = true;\n\t\t\t\t} else if (!stored && configKey !== undefined) {\n\t\t\t\t\tconst configured = isCommandConfigValue(configKey) || resolveConfigValue(configKey) !== undefined;\n\t\t\t\t\tsources.find((entry) => entry.source === \"configuration\")!.effective = configured;\n\t\t\t\t} else {\n\t\t\t\t\t// Builtin resolvers only read environment/files. Never call an extension resolver for a list;\n\t\t\t\t\t// extensions can supply the side-effect-free ApiKeyAuth.check contract instead.\n\t\t\t\t\tconst base = this.nativeExtensionProviders.get(providerId) ?? this.builtins.get(providerId);\n\t\t\t\t\tconst method = base?.auth.apiKey;\n\t\t\t\t\tconst check =\n\t\t\t\t\t\tmethod?.check ?? (this.nativeExtensionProviders.has(providerId) ? undefined : method?.resolve);\n\t\t\t\t\tconst credential =\n\t\t\t\t\t\tstored?.type === \"api_key\"\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t...stored,\n\t\t\t\t\t\t\t\t\tkey:\n\t\t\t\t\t\t\t\t\t\texternal && stored.key !== undefined\n\t\t\t\t\t\t\t\t\t\t\t? resolveConfigValue(stored.key, stored.env)\n\t\t\t\t\t\t\t\t\t\t\t: stored.key,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\tconst ctx = defaultProviderAuthContext();\n\t\t\t\t\tconst usedEnvironment = new Set<string>();\n\t\t\t\t\tconst result = check\n\t\t\t\t\t\t? await check({\n\t\t\t\t\t\t\t\tctx: {\n\t\t\t\t\t\t\t\t\t...ctx,\n\t\t\t\t\t\t\t\t\tenv: async (name) => {\n\t\t\t\t\t\t\t\t\t\tconst value = env?.[name] || (await ctx.env(name));\n\t\t\t\t\t\t\t\t\t\tif (value && authEnvironmentNames.has(name)) usedEnvironment.add(name);\n\t\t\t\t\t\t\t\t\t\treturn value;\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tcredential,\n\t\t\t\t\t\t\t\tsignal,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t: undefined;\n\t\t\t\t\t// Native check labels are display text, not a source contract. Attribute by the inputs used,\n\t\t\t\t\t// never by arbitrary labels (which may themselves contain credential material).\n\t\t\t\t\tconst native = this.nativeExtensionProviders.has(providerId);\n\t\t\t\t\tconst source = native ? undefined : result?.source;\n\t\t\t\t\tstoredEffective =\n\t\t\t\t\t\t!!stored &&\n\t\t\t\t\t\t(native\n\t\t\t\t\t\t\t? check\n\t\t\t\t\t\t\t\t? !!result && usedEnvironment.size === 0\n\t\t\t\t\t\t\t\t: !!credential?.key\n\t\t\t\t\t\t\t: source === \"stored credential\" || source === \"stored\" || (!check && !!credential?.key));\n\t\t\t\t\tif (result && !storedEffective) {\n\t\t\t\t\t\tconst selectedNames =\n\t\t\t\t\t\t\tsource && sources.some((entry) => entry.label === source) ? [source] : [...usedEnvironment];\n\t\t\t\t\t\tlet marked = false;\n\t\t\t\t\t\tfor (const name of selectedNames) {\n\t\t\t\t\t\t\tconst entry = sources.find((entry) => entry.source === \"environment\" && entry.label === name);\n\t\t\t\t\t\t\tif (entry) {\n\t\t\t\t\t\t\t\tentry.effective = true;\n\t\t\t\t\t\t\t\tmarked = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!marked) add(\"environment\", \"ambient credentials\", true);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tconst storedSource = sources.find((entry) => entry.source === \"auth_json\");\n\t\tif (storedSource && storedEffective) storedSource.effective = true;\n\t\tsignal.throwIfAborted();\n\t\treturn { sources, storedEffective };\n\t}\n\n\t/** Request-boundary return. External overrides/references never authorize a stored-account switch. */\n\tasync prepareAccountRequest(\n\t\tproviderId: string,\n\t\tautoSwitch: () => boolean,\n\t\tskipKeys: ReadonlySet<string>,\n\t\tsignal?: AbortSignal,\n\t): Promise<void> {\n\t\tif (!autoSwitch() || this.credentials.hasRuntimeApiKey(providerId)) return;\n\t\tconst stored = await this.credentials.readStored(providerId, { signal });\n\t\tif (!stored || this.credentials.isExternalCredential(stored)) return;\n\t\tconst returned = await this.oauthAccountPool.returnToPreferred(providerId, {\n\t\t\tsignal,\n\t\t\tskipKeys,\n\t\t\tcanActivate: () => autoSwitch() && !this.credentials.hasRuntimeApiKey(providerId),\n\t\t});\n\t\tif (returned) await this.synchronizeCredentialState(providerId, \"switchAccount\", operationSignal(signal));\n\t}\n\n\t/** Low-level pool APIs contain credentials; never serialize them into UI, events or logs. */\n\tget oauthAccounts(): OAuthAccountPool {\n\t\treturn this.oauthAccountPool;\n\t}\n\n\tgetProviderAuthStatus(providerId: string): AuthStatus {\n\t\tif (providerId === HCODE_PROVIDER)\n\t\t\treturn this.hasConfiguredAuth(providerId)\n\t\t\t\t? { configured: true, source: this.hcodeSession ? \"runtime\" : \"stored\" }\n\t\t\t\t: { configured: false };\n\t\tif (this.credentials.hasRuntimeApiKey(providerId)) return { configured: true, source: \"runtime\" };\n\t\tif (this.snapshot.storedProviders.has(providerId)) return { configured: true, source: \"stored\" };\n\t\tconst configured = configuredRequestAuthStatus(\n\t\t\tthis.config.getProvider(providerId),\n\t\t\tthis.extensionProviders.get(providerId),\n\t\t);\n\t\tif (configured) return configured;\n\t\tconst check = this.snapshot.auth.get(providerId);\n\t\treturn check ? { configured: true, source: \"environment\", label: check.source } : { configured: false };\n\t}\n\n\tprivate async prepareRequest<\n\t\tTModel extends AnyModel,\n\t\tTOptions extends ProviderRequestOptions<TModel> &\n\t\t\tModelsRequestTransforms & {\n\t\t\t\tonOAuthAccount?: OAuthAccountObserver;\n\t\t\t\tonPhysicalTarget?: (model: TModel) => void;\n\t\t\t\tresolveOnPayload?: (model: TModel) => ProviderRequestOptions<TModel>[\"onPayload\"];\n\t\t\t},\n\t>(\n\t\tmodel: TModel,\n\t\toptions: TOptions | undefined,\n\t\tintent?: AttestationIntent,\n\t): Promise<{\n\t\tprovider: Provider;\n\t\tmodel: TModel;\n\t\toptions: Omit<TOptions, \"transformHeaders\"> & ProviderRequestOptions<TModel>;\n\t\ttracker: RequestTracker | undefined;\n\t}> {\n\t\tconst admission = this.currentAdmission();\n\t\tconst currentProvider = this.models.getProvider(model.provider);\n\t\t// Capture dispatch values once before qualification or any async auth/header callback can replace them.\n\t\tconst provider =\n\t\t\tcurrentProvider && (admission || options?.beforeSubmission ? { ...currentProvider } : currentProvider);\n\t\tif (admission || options?.beforeSubmission) {\n\t\t\tconst native = this.nativeExtensionProviders.get(model.provider);\n\t\t\t// Trust boundary: Node requires source-owned transport identity. Bedrock is installed through the\n\t\t\t// builtin catalog and source-owned module loader, not native extension registration.\n\t\t\tif (\n\t\t\t\t!intent ||\n\t\t\t\t!isModelType(model, \"chat\") ||\n\t\t\t\t![\"anthropic-messages\", \"bedrock-converse-stream\", \"openai-completions\", \"openai-responses\"].includes(\n\t\t\t\t\tmodel.api,\n\t\t\t\t) ||\n\t\t\t\t(native !== undefined && (!provider || !hasHumainNodeAdmissionTransport(native, provider))) ||\n\t\t\t\tthis.extensionProviders.get(model.provider)?.streamSimple\n\t\t\t) {\n\t\t\t\tthrow new SubmissionAdmissionError(\"unsupported-route\");\n\t\t\t}\n\t\t}\n\t\tthis.assertHcodeModel(model);\n\t\t// The agent's automatic transport selects the native provider's only supported protocol.\n\t\tif (model.provider === HCODE_PROVIDER && options && \"transport\" in options && options.transport === \"auto\")\n\t\t\toptions = { ...options, transport: \"sse\" };\n\t\tif (model.provider === HCODE_PROVIDER && this.currentRequestPurpose() === \"cache-warming\")\n\t\t\tthrow new ModelsError(\"model_validation\", \"HUMAIN Code account cache warming is disabled.\");\n\t\tconst signal =\n\t\t\tmodel.provider === HCODE_PROVIDER\n\t\t\t\t? AbortSignal.any([this.hcodeFacade.signal, ...(options?.signal ? [options.signal] : [])])\n\t\t\t\t: options?.signal;\n\t\tif (!provider) throw new ModelsError(\"provider\", `Unknown provider: ${model.provider}`);\n\t\tlet resolvedAccount: { provider: string; key: string | undefined } | undefined;\n\t\t// Anthropic rate-limit headers are only recorded for a credential whose account is identified for this request.\n\t\tconst observesAnthropicLimits = model.provider === ANTHROPIC_PROVIDER_ID;\n\t\tconst resolution = await this.getAuth(model, {\n\t\t\tapiKey: options?.apiKey,\n\t\t\tenv: options?.env,\n\t\t\tsignal,\n\t\t\tonOAuthAccount:\n\t\t\t\toptions?.onOAuthAccount || observesAnthropicLimits\n\t\t\t\t\t? (provider, key) => {\n\t\t\t\t\t\t\tresolvedAccount = { provider, key };\n\t\t\t\t\t\t}\n\t\t\t\t\t: undefined,\n\t\t});\n\t\tif (!resolution) throw new ModelsError(\"auth\", `Provider is not configured: ${model.provider}`);\n\n\t\tconst {\n\t\t\ttransformHeaders,\n\t\t\tresolveOnPayload,\n\t\t\tonPhysicalTarget: _onPhysicalTarget,\n\t\t\tonOAuthAccount: _onOAuthAccount,\n\t\t\t...rawProviderOptions\n\t\t} = options ?? {};\n\t\tconst providerOptions = rawProviderOptions as Omit<TOptions, \"transformHeaders\"> & ProviderRequestOptions<TModel>;\n\t\tconst requestModel: TModel = resolution.auth.baseUrl ? { ...model, baseUrl: resolution.auth.baseUrl } : model;\n\t\tconst sessionId =\n\t\t\t\"sessionId\" in providerOptions && typeof providerOptions.sessionId === \"string\"\n\t\t\t\t? providerOptions.sessionId\n\t\t\t\t: undefined;\n\t\tlet headers = mergeHeaders(\n\t\t\tmergeHeaders(getOpenCodeSessionHeaders(requestModel, sessionId), resolution.auth.headers),\n\t\t\tproviderOptions.headers,\n\t\t);\n\t\tif (transformHeaders) headers = await transformHeaders(headers ?? {});\n\t\t// Auth and extension callbacks can yield across native account/catalog replacement.\n\t\tthis.assertHcodeModel(model);\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\tconst apiKey = providerOptions.apiKey ?? resolution.auth.apiKey;\n\t\tlet attributedAccountKey: string | undefined;\n\t\tif ((options?.onOAuthAccount || observesAnthropicLimits) && this.oauthAccountPool.isPooled(model.provider)) {\n\t\t\t// OAuth-only providers still resolve stored auth even with an explicit request key. That\n\t\t\t// credential is not necessarily dispatched: preserve the key override and attribute it,\n\t\t\t// failing closed if its account is unknown. A resolved/refreshed key keeps its identity.\n\t\t\tattributedAccountKey =\n\t\t\t\tresolvedAccount?.provider === model.provider && apiKey === resolution.auth.apiKey\n\t\t\t\t\t? resolvedAccount.key\n\t\t\t\t\t: apiKey\n\t\t\t\t\t\t? this.oauthAccountPool.getAccountKeyForAccessToken(model.provider, apiKey)\n\t\t\t\t\t\t: undefined;\n\t\t\toptions?.onOAuthAccount?.(model.provider, attributedAccountKey);\n\t\t}\n\t\tconst callerOnResponse = providerOptions.onResponse;\n\t\tconst onResponse =\n\t\t\tobservesAnthropicLimits &&\n\t\t\tattributedAccountKey !== undefined &&\n\t\t\t!overridesCredentialHeaders(resolution.auth.headers, headers) &&\n\t\t\tisOfficialAnthropicBaseUrl(requestModel.baseUrl)\n\t\t\t\t? async (response: ProviderResponse, responseModel: TModel) => {\n\t\t\t\t\t\tthis.observeAnthropicLimits(attributedAccountKey, response);\n\t\t\t\t\t\tawait callerOnResponse?.(response, responseModel);\n\t\t\t\t\t}\n\t\t\t\t: callerOnResponse;\n\t\t// The one request boundary: every chat, image, classifier and deferred call is prepared here, so\n\t\t// the scope bound by the owning session observes it exactly once per real submission.\n\t\tconst scope = this.currentScope();\n\t\tconst tracker = scope || admission ? new RequestTracker(scope, requestModel, admission) : undefined;\n\t\tconst gate =\n\t\t\tadmission && intent ? submissionAdmission(admission, requestModel, intent, scope?.purpose) : undefined;\n\t\tconst callerGate = providerOptions.beforeSubmission;\n\t\tconst beforeSubmission = gate\n\t\t\t? async (observation: Readonly<ProviderRequestObservation>) => {\n\t\t\t\t\t// A caller veto precedes allocation; the run-owned gate cannot be replaced by request options.\n\t\t\t\t\tawait callerGate?.(observation);\n\t\t\t\t\tawait gate(observation);\n\t\t\t\t}\n\t\t\t: callerGate;\n\t\t// Payload hooks may run from a shared queue; rebind the scope so they see this request's purpose.\n\t\tconst callerOnPayload = resolveOnPayload ? resolveOnPayload(model) : providerOptions.onPayload;\n\t\tconst onPayload =\n\t\t\tscope && callerOnPayload\n\t\t\t\t? (payload: unknown, payloadModel: TModel) =>\n\t\t\t\t\t\tthis.requestScope.run(scope, () => callerOnPayload(payload, payloadModel))\n\t\t\t\t: callerOnPayload;\n\t\treturn {\n\t\t\tprovider,\n\t\t\tmodel: requestModel,\n\t\t\toptions: {\n\t\t\t\t...providerOptions,\n\t\t\t\tsignal,\n\t\t\t\tapiKey,\n\t\t\t\theaders,\n\t\t\t\tenv,\n\t\t\t\tonPayload,\n\t\t\t\t...(onResponse ? { onResponse } : {}),\n\t\t\t\t...(tracker ? { onRequest: tracker.hook(providerOptions.onRequest) } : {}),\n\t\t\t\t...(beforeSubmission ? { beforeSubmission } : {}),\n\t\t\t} as Omit<TOptions, \"transformHeaders\"> & ProviderRequestOptions<TModel>,\n\t\t\ttracker,\n\t\t};\n\t}\n\n\tprivate observeAnthropicLimits(accountKey: string, response: ProviderResponse): void {\n\t\ttry {\n\t\t\tconst snapshot = parseAnthropicRateLimits(response.headers, Date.now());\n\t\t\tif (snapshot) this.anthropicRateLimits.record(accountKey, snapshot);\n\t\t} catch {\n\t\t\t// Observation is best effort and never affects the request.\n\t\t}\n\t}\n\n\t/**\n\t * Run `fn` so every request it starts (including background work it schedules) is reported to\n\t * `observer`. The binding follows async context, so concurrent sessions sharing this runtime keep\n\t * their own observers.\n\t */\n\tobserveRequests<T>(observer: ModelRequestObserver, purpose: ModelRequestPurpose | undefined, fn: () => T): T {\n\t\t// The primary host binds observation after admission; nested observers cannot shed that run's gate.\n\t\tthis.admissionScope.getStore()?.observers.add(observer);\n\t\treturn this.requestScope.run({ observer, purpose }, fn);\n\t}\n\n\t/** Bind every descendant model helper to the host's frozen run budget, independently of observers. */\n\tasync admitRequests<T>(admission: ModelRequestAdmission, fn: () => Promise<T>): Promise<T> {\n\t\tif (this.admissionScope.getStore()) throw new SubmissionAdmissionError(\"unattributed\");\n\t\tconst scope: ModelRequestAdmissionScope = { admission, observers: new Set() };\n\t\tconst observer = this.requestScope.getStore()?.observer;\n\t\tif (observer) scope.observers.add(observer);\n\t\tthis.activeAdmissions.add(scope);\n\t\ttry {\n\t\t\treturn await this.admissionScope.run(scope, fn);\n\t\t} finally {\n\t\t\tthis.activeAdmissions.delete(scope);\n\t\t}\n\t}\n\n\tprivate currentAdmission(): ModelRequestAdmission | undefined {\n\t\tconst scope = this.admissionScope.getStore();\n\t\tif (!scope && this.activeAdmissions.size > 0) {\n\t\t\tconst observer = this.requestScope.getStore()?.observer;\n\t\t\t// Only an attributed session owner may run independently; read-only observation grants no admission.\n\t\t\tif (!observer || !this.ownerObservers.has(observer)) throw new SubmissionAdmissionError(\"unattributed\");\n\t\t\tfor (const active of this.activeAdmissions) {\n\t\t\t\tif (active.observers.has(observer)) throw new SubmissionAdmissionError(\"unattributed\");\n\t\t\t}\n\t\t}\n\t\treturn scope?.admission;\n\t}\n\n\t/** Observe only the installed version under the selected environment's lifetime/network veto. */\n\tobserveHcodeVersion(version: string): void {\n\t\tthis.hcodeFacade.observeVersion(version);\n\t}\n\n\t/** Export only already-available same-environment support IDs; never bootstrap account or identity state. */\n\tgetHcodeSupportSnapshot(signal: AbortSignal): Promise<HcodeSupportSnapshot> {\n\t\treturn this.hcodeFacade.supportSnapshot(signal);\n\t}\n\n\t/** Forge's reason the current HUMAIN Code account's catalog is empty, if it sent a known one. */\n\thcodeCatalogEmptyReason(): HcodeCatalogEmptyReason | undefined {\n\t\treturn this.hcodeFacade.provider.catalogEmptyReason();\n\t}\n\n\t/** Whether this process has read the current HUMAIN Code account's catalog. */\n\thcodeCatalogLoaded(): boolean {\n\t\treturn this.hcodeFacade.provider.catalogLoaded();\n\t}\n\n\t/** Verify the environment's public sign-in config and issuer without private account I/O; ready is cached 5 minutes. */\n\tprobeHcodeLogin(signal: AbortSignal): Promise<HcodeLoginReadiness> {\n\t\treturn this.hcodeFacade.probeLogin(signal);\n\t}\n\n\t/** Re-read the HUMAIN Code sign-in another process saved or removed for this environment; true when it changed. */\n\treloadHcodeAccount(signal: AbortSignal): Promise<boolean> {\n\t\treturn this.enqueueCredentialOperation(HCODE_PROVIDER, signal, async () => {\n\t\t\tif (this.hcodeSession && this.hcodeFacade.persistence(this.hcodeSession) === \"session\") return false;\n\t\t\tconst stored = await this.credentials.readStored(HCODE_PROVIDER, { signal });\n\t\t\tif (!this.hcodeFacade.adopt(stored)) return false;\n\t\t\t// Keep the logged-out overlay's logout fence until a new saved sign-in becomes current.\n\t\t\tif (this.hcode.account.status(this.hcode.environmentId)) this.hcodeSession = undefined;\n\t\t\tawait this.synchronizeCredentialState(HCODE_PROVIDER, stored ? \"login\" : \"logout\", signal);\n\t\t\treturn true;\n\t\t});\n\t}\n\n\t/** Other HUMAIN Code environments with a saved sign-in on this machine, from local metadata only. */\n\thcodeSignedInElsewhere(): HcodeEnvironmentName[] {\n\t\treturn this.hcodeFacade.signedInElsewhere();\n\t}\n\n\t/** Email the server reported when this HUMAIN Code account signed in during this process, if any. */\n\thcodeAccountEmail(expected: HcodeAccountRef): string | undefined {\n\t\treturn this.hcodeFacade.accountEmail(expected);\n\t}\n\n\t/** Revoke an ephemeral device family once; hosts explicitly own shutdown of injected runtimes. */\n\tasync shutdownHcodeSession(\n\t\tsignal: AbortSignal,\n\t): Promise<{ remoteRevocation: \"confirmed\" | \"unconfirmed\" | \"not-needed\" }> {\n\t\ttry {\n\t\t\treturn await this.hcodeFacade.shutdown(signal);\n\t\t} finally {\n\t\t\tthis.credentials.clearHcodeSessionReference();\n\t\t}\n\t}\n\n\t/** Application teardown must not revoke a borrowed host runtime. */\n\tshutdownOwnedHcodeSession(\n\t\tsignal: AbortSignal,\n\t): Promise<{ remoteRevocation: \"confirmed\" | \"unconfirmed\" | \"not-needed\" }> {\n\t\treturn this.sessionOwned\n\t\t\t? this.shutdownHcodeSession(signal)\n\t\t\t: Promise.resolve({ remoteRevocation: \"not-needed\" });\n\t}\n\n\t/** Stop owned private sends/publication without logout, persisted credential changes or an exit flush. */\n\tdispose(): void {\n\t\tthis.credentials.clearHcodeSessionReference();\n\t\tthis.hcodeFacade.dispose();\n\t}\n\n\t/** Register a session observer that owns direct calls on this runtime; returns the unregister function. */\n\taddOwnerObserver(observer: ModelRequestObserver): () => void {\n\t\tthis.ownerObservers.add(observer);\n\t\treturn () => {\n\t\t\tif (this.ownerObservers.delete(observer) && this.sessionOwned && this.ownerObservers.size === 0)\n\t\t\t\tthis.dispose();\n\t\t};\n\t}\n\n\t/**\n\t * The active request scope, else the sole owning session's chat scope for a direct SDK call. With\n\t * several owners the call cannot be attributed: nothing is observed and the first owner is told of the gap.\n\t */\n\tprivate currentScope(): ModelRequestScope | undefined {\n\t\tconst scope = this.requestScope.getStore();\n\t\tif (scope || this.ownerObservers.size === 0) return scope;\n\t\tif (this.ownerObservers.size === 1) {\n\t\t\tconst [observer] = this.ownerObservers;\n\t\t\treturn { observer, purpose: \"chat\" };\n\t\t}\n\t\t// One content-free notice is enough; the recorder is process-wide.\n\t\tconst [first] = this.ownerObservers;\n\t\tif (first?.onUnattributed) swallow(() => first.onUnattributed?.());\n\t\treturn undefined;\n\t}\n\n\t/** Purpose of the request scope the caller runs in; undefined outside a scope or for purpose-less requests. */\n\tcurrentRequestPurpose(): ModelRequestPurpose | undefined {\n\t\treturn this.requestScope.getStore()?.purpose;\n\t}\n\n\t/** Change the purpose of requests started by `fn`, keeping the current observer. No-op outside a scope. */\n\twithRequestPurpose<T>(purpose: ModelRequestPurpose | undefined, fn: () => T): T {\n\t\tconst scope = this.currentScope();\n\t\treturn scope ? this.observeRequests(scope.observer, purpose, fn) : fn();\n\t}\n\n\t/** Reject host-supplied native model facts at the SDK/router request boundary. */\n\tprivate assertHcodeModel(model: AnyModel): void {\n\t\tif (model.provider === HCODE_PROVIDER && this.getPhysicalModel(HCODE_PROVIDER, model.id) !== model)\n\t\t\tthrow new ModelsError(\"model_validation\", \"HUMAIN Code account approved model changed or is unavailable.\");\n\t}\n\n\t/** Keep the outer watchdog from turning a managed request into a resend instruction. */\n\tprivate guardHcodeTimeout(\n\t\tmodel: Model<Api>,\n\t\tstream: AssistantMessageEventStream,\n\t\tactualModel: () => Model<Api>,\n\t\tonTimeout: () => void,\n\t): AssistantMessageEventStream {\n\t\tif (model.provider !== HCODE_PROVIDER && !isVirtualModel(model)) return stream;\n\t\treturn lazyStream(model, async () => ({\n\t\t\tasync *[Symbol.asyncIterator]() {\n\t\t\t\tfor await (const event of stream) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tevent.type === \"error\" &&\n\t\t\t\t\t\tactualModel().provider === HCODE_PROVIDER &&\n\t\t\t\t\t\tevent.error.diagnostics?.some((entry) => entry.type === \"provider_no_progress_timeout\")\n\t\t\t\t\t) {\n\t\t\t\t\t\tonTimeout();\n\t\t\t\t\t\tevent.error.errorMessage = \"HUMAIN Code request unavailable. Do not automatically resend.\";\n\t\t\t\t\t\tevent.error.diagnostics = [\n\t\t\t\t\t\t\t{ type: \"provider_http_error\", timestamp: Date.now(), details: { retryable: false } },\n\t\t\t\t\t\t];\n\t\t\t\t\t}\n\t\t\t\t\tyield event;\n\t\t\t\t}\n\t\t\t},\n\t\t\tresult: () => stream.result(),\n\t\t}));\n\t}\n\n\tprivate inferenceObservation(\n\t\tmodel: Model<Api>,\n\t\tstarted: number,\n\t): (message: AssistantMessage | undefined, submissions: number, observedFailure?: CliMetadataError) => void {\n\t\t// Only a trusted declaration, captured before auth clones, may supply a public pair.\n\t\tconst native =\n\t\t\tthis.getPhysicalModel(model.provider, model.id) === model &&\n\t\t\t(model.provider === HCODE_PROVIDER ||\n\t\t\t\t(this.defaultBuiltins.has(model.provider) &&\n\t\t\t\t\t!this.nativeExtensionProviders.has(model.provider) &&\n\t\t\t\t\t!this.extensionProviders.has(model.provider) &&\n\t\t\t\t\t!this.config.getProvider(model.provider)));\n\t\tconst provider = native ? model.provider : \"other\";\n\t\tconst id = native && model.provider !== HCODE_PROVIDER ? model.id : \"other\";\n\t\treturn (message, submissions, observedFailure) => {\n\t\t\tconst usage = message?.usage;\n\t\t\tconst known = usage && !usage.usageIncomplete && usage.totalTokens > 0;\n\t\t\tconst token = (value: number | undefined) =>\n\t\t\t\tknown && value !== undefined && Number.isInteger(value) && value >= 0 && value <= 2147483647 ? value : null;\n\t\t\tconst outcome: CliMetadataOutcome =\n\t\t\t\tmessage?.stopReason === \"aborted\"\n\t\t\t\t\t? \"cancelled\"\n\t\t\t\t\t: message?.stopReason === \"stop\" || message?.stopReason === \"toolUse\"\n\t\t\t\t\t\t? usage?.usageIncomplete\n\t\t\t\t\t\t\t? \"unknown\"\n\t\t\t\t\t\t\t: \"success\"\n\t\t\t\t\t\t: \"failure\";\n\t\t\tconst retries = Math.max(0, submissions - 1);\n\t\t\tthis.metadata.inference(provider, id, {\n\t\t\t\tdurationMs: Math.min(2147483647, Math.round(performance.now() - started)),\n\t\t\t\tinputTokens: token(usage?.input),\n\t\t\t\toutputTokens: token(usage?.output),\n\t\t\t\tcacheReadTokens: token(usage?.cacheRead),\n\t\t\t\tcacheWriteTokens: token(usage?.cacheWrite),\n\t\t\t\tretries,\n\t\t\t\toutcome,\n\t\t\t});\n\t\t\tif (outcome !== \"success\") {\n\t\t\t\tconst http = message?.diagnostics?.findLast((entry) => entry.type === \"provider_http_error\");\n\t\t\t\tconst hcode = http?.details?.hcode;\n\t\t\t\tconst status =\n\t\t\t\t\thcode && typeof hcode === \"object\" && \"status\" in hcode ? hcode.status : http?.details?.status;\n\t\t\t\tconst code: CliMetadataError =\n\t\t\t\t\tobservedFailure ??\n\t\t\t\t\t(message?.diagnostics?.some((entry) => entry.type === \"provider_no_progress_timeout\")\n\t\t\t\t\t\t? \"timeout\"\n\t\t\t\t\t\t: status === 401\n\t\t\t\t\t\t\t? \"auth\"\n\t\t\t\t\t\t\t: status === 403\n\t\t\t\t\t\t\t\t? \"approval\"\n\t\t\t\t\t\t\t\t: status === 429\n\t\t\t\t\t\t\t\t\t? \"quota\"\n\t\t\t\t\t\t\t\t\t: message?.stopReason === \"length\"\n\t\t\t\t\t\t\t\t\t\t? \"invalid\"\n\t\t\t\t\t\t\t\t\t\t: \"transport\");\n\n\t\t\t\tthis.metadata.failure(\"prompt\", code, retries, outcome);\n\t\t\t}\n\t\t};\n\t}\n\n\t/** Report the outcome of a stream once it ends. */\n\tprivate trackStream(\n\t\tstream: AssistantMessageEventStream,\n\t\ttracker: () => RequestTracker | undefined,\n\t\tobserve?: (message: AssistantMessage | undefined) => void,\n\t): AssistantMessageEventStream {\n\t\tstream.result().then(\n\t\t\t(message) => {\n\t\t\t\tobserve?.(message);\n\t\t\t\ttracker()?.settleMessage(message);\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tobserve?.(undefined);\n\t\t\t\ttracker()?.settleFailure(false);\n\t\t\t},\n\t\t);\n\t\treturn stream;\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\tlet tracker: RequestTracker | undefined;\n\t\tconst observe = this.inferenceObservation(model, performance.now());\n\t\tlet observedFailure: CliMetadataError | undefined;\n\t\tlet submissions = 0;\n\t\tconst callerRequest = options?.onRequest;\n\t\tconst onRequest: ProviderRequestOptions[\"onRequest\"] = async (request) => {\n\t\t\tsubmissions++;\n\t\t\tawait callerRequest?.(request);\n\t\t};\n\t\treturn this.trackStream(\n\t\t\tthis.guardHcodeTimeout(\n\t\t\t\tmodel,\n\t\t\t\tstreamWithProgressTimeout(\n\t\t\t\t\tmodel,\n\t\t\t\t\tasync (signal) => {\n\t\t\t\t\t\tassertChatModel(model);\n\t\t\t\t\t\tconst intent = admissionIntent(model, options);\n\t\t\t\t\t\tif (this.currentAdmission()) intent.requiredImageCount = assertAdmittedModelInput(model, context);\n\t\t\t\t\t\tconst prepared = await this.prepareRequest(\n\t\t\t\t\t\t\tmodel,\n\t\t\t\t\t\t\t{ ...options, signal, onRequest } as StreamOptions & ModelsRequestTransforms,\n\t\t\t\t\t\t\tintent,\n\t\t\t\t\t\t);\n\t\t\t\t\t\ttracker = prepared.tracker;\n\t\t\t\t\t\tsignal.throwIfAborted();\n\t\t\t\t\t\treturn prepared.provider.stream(\n\t\t\t\t\t\t\tprepared.model,\n\t\t\t\t\t\t\ttranscript,\n\t\t\t\t\t\t\tprepared.options as ApiStreamOptions<TApi>,\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t\toptions,\n\t\t\t\t),\n\t\t\t\t() => model,\n\t\t\t\t() => {\n\t\t\t\t\tobservedFailure = \"timeout\";\n\t\t\t\t},\n\t\t\t),\n\t\t\t() => tracker,\n\t\t\t(message) => observe(message, submissions, observedFailure),\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 drainStream(this.stream(model, context, options));\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\tlet tracker: RequestTracker | undefined;\n\t\tlet requestModel = model;\n\t\tconst started = performance.now();\n\t\tlet observe = this.inferenceObservation(model, started);\n\t\tlet observedFailure: CliMetadataError | undefined;\n\t\tlet submissions = 0;\n\t\tconst callerRequest = options?.onRequest;\n\t\toptions = {\n\t\t\t...options,\n\t\t\tonRequest: async (request) => {\n\t\t\t\tsubmissions++;\n\t\t\t\tawait callerRequest?.(request);\n\t\t\t},\n\t\t};\n\t\treturn this.trackStream(\n\t\t\tthis.guardHcodeTimeout(\n\t\t\t\tmodel,\n\t\t\t\tstreamWithProgressTimeout(\n\t\t\t\t\tmodel,\n\t\t\t\t\tasync (signal) => {\n\t\t\t\t\t\tlet requestOptions = options;\n\t\t\t\t\t\tif (isVirtualModel(model)) {\n\t\t\t\t\t\t\t// Requests outside the agent loop are routed here. Callers sized them before routing, so\n\t\t\t\t\t\t\t// cap the output budget to the routed model.\n\t\t\t\t\t\t\tconst route = await this.resolveModel(model, transcript.messages, {\n\t\t\t\t\t\t\t\treason: \"direct\",\n\t\t\t\t\t\t\t\tthinkingLevel: options?.reasoning ?? \"off\",\n\t\t\t\t\t\t\t\tsignal,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tsignal.throwIfAborted();\n\t\t\t\t\t\t\tconst { maxTokens: limit } = route.model;\n\t\t\t\t\t\t\tconst maxTokens =\n\t\t\t\t\t\t\t\toptions?.maxTokens && limit > 0 ? Math.min(options.maxTokens, limit) : options?.maxTokens;\n\t\t\t\t\t\t\tconst reasoning = route.thinkingLevel === \"off\" ? undefined : route.thinkingLevel;\n\t\t\t\t\t\t\t// Caller credentials were resolved for the virtual model's provider. Another provider\n\t\t\t\t\t\t\t// resolves its own, so they are not sent to the wrong vendor.\n\t\t\t\t\t\t\tconst { apiKey, headers, env, ...rest } = options ?? {};\n\t\t\t\t\t\t\tconst auth = route.model.provider === model.provider ? { apiKey, headers, env } : {};\n\t\t\t\t\t\t\trequestModel = route.model;\n\t\t\t\t\t\t\trequestOptions = { ...rest, ...auth, maxTokens, reasoning };\n\t\t\t\t\t\t}\n\t\t\t\t\t\tobserve = this.inferenceObservation(requestModel, started);\n\t\t\t\t\t\trequestOptions?.onPhysicalTarget?.(requestModel);\n\t\t\t\t\t\tassertChatModel(requestModel);\n\t\t\t\t\t\tconst intent = admissionIntent(model, options);\n\t\t\t\t\t\tif (this.currentAdmission())\n\t\t\t\t\t\t\tintent.requiredImageCount = assertAdmittedModelInput(requestModel, context);\n\t\t\t\t\t\tconst prepared = await this.prepareRequest(requestModel, { ...requestOptions, signal }, intent);\n\t\t\t\t\t\ttracker = prepared.tracker;\n\t\t\t\t\t\tsignal.throwIfAborted();\n\t\t\t\t\t\treturn prepared.provider.streamSimple(\n\t\t\t\t\t\t\tprepared.model,\n\t\t\t\t\t\t\ttranscript,\n\t\t\t\t\t\t\tprepared.options as SimpleStreamOptions,\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t\toptions,\n\t\t\t\t),\n\t\t\t\t() => requestModel,\n\t\t\t\t() => {\n\t\t\t\t\tobservedFailure = \"timeout\";\n\t\t\t\t},\n\t\t\t),\n\t\t\t() => tracker,\n\t\t\t(message) => observe(message, submissions, observedFailure),\n\t\t);\n\t}\n\n\tcompleteSimple(model: Model<Api>, context: Context, options?: ModelsSimpleStreamOptions): Promise<AssistantMessage> {\n\t\treturn drainStream(this.streamSimple(model, context, options));\n\t}\n\n\tstreamDeferred(\n\t\tmodel: Model<Api>,\n\t\thandle: DeferredHandle,\n\t\toptions?: ModelsDeferredFetchOptions,\n\t): AssistantMessageEventStream {\n\t\tlet tracker: RequestTracker | undefined;\n\t\treturn this.trackStream(\n\t\t\tlazyStream(\n\t\t\t\tmodel,\n\t\t\t\tasync () => {\n\t\t\t\t\tassertChatModel(model);\n\t\t\t\t\tconst prepared = await this.prepareRequest(model, options);\n\t\t\t\t\ttracker = prepared.tracker;\n\t\t\t\t\tif (!prepared.provider.fetchDeferred) {\n\t\t\t\t\t\tthrow new ModelsError(\"provider\", `Provider ${model.provider} does not support deferred responses`);\n\t\t\t\t\t}\n\t\t\t\t\treturn prepared.provider.fetchDeferred(prepared.model, handle, prepared.options as DeferredFetchOptions);\n\t\t\t\t},\n\t\t\t\tundefined,\n\t\t\t\toptions?.signal,\n\t\t\t),\n\t\t\t() => tracker,\n\t\t);\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 drainStream(this.streamDeferred(model, handle, options));\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\tassertChatModel(model);\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\tasync generateImages(\n\t\tmodel: ImageModel<ImageApi>,\n\t\tcontext: ImagesContext,\n\t\toptions?: ModelsImagesOptions,\n\t): Promise<AssistantImages> {\n\t\tlet tracker: RequestTracker | undefined;\n\t\ttry {\n\t\t\tassertImageModel(model);\n\t\t\tconst prepared = await this.prepareRequest(model, options);\n\t\t\ttracker = prepared.tracker;\n\t\t\tif (!prepared.provider.generateImages) {\n\t\t\t\tthrow new ModelsError(\"provider\", `Provider ${model.provider} does not support image generation`);\n\t\t\t}\n\t\t\tconst result = await prepared.provider.generateImages(\n\t\t\t\tprepared.model,\n\t\t\t\tcontext,\n\t\t\t\tprepared.options as ImagesOptions,\n\t\t\t);\n\t\t\ttracker?.settleResult(result);\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\ttracker?.settleFailure(options?.signal?.aborted === true);\n\t\t\treturn imageErrorResult(model, error, options?.signal?.aborted);\n\t\t}\n\t}\n\n\tasync classify(\n\t\tmodel: ClassifierModel<ClassifierApi>,\n\t\tcontext: ClassifierContext,\n\t\toptions?: ModelsClassifierOptions,\n\t): Promise<ClassifierResult> {\n\t\tlet tracker: RequestTracker | undefined;\n\t\ttry {\n\t\t\tassertClassifierModel(model);\n\t\t\tassertClassifierInputSupported(model, context);\n\t\t\tconst prepared = await this.prepareRequest(model, options);\n\t\t\ttracker = prepared.tracker;\n\t\t\tif (!prepared.provider.classify) {\n\t\t\t\tthrow new ModelsError(\"provider\", `Provider ${model.provider} does not support classification`);\n\t\t\t}\n\t\t\tconst result = await prepared.provider.classify(\n\t\t\t\tprepared.model,\n\t\t\t\tcontext,\n\t\t\t\tprepared.options as ClassifierOptions,\n\t\t\t);\n\t\t\ttracker?.settleResult(result);\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\ttracker?.settleFailure(options?.signal?.aborted === true);\n\t\t\treturn classifierErrorResult(model, error, options?.signal?.aborted);\n\t\t}\n\t}\n\n\tlogin(\n\t\tproviderId: string,\n\t\ttype: AuthType,\n\t\tinteraction: AuthInteraction,\n\t\toptions?: LoginOptions & { accountKey?: string },\n\t): Promise<Credential> {\n\t\tconst signal = operationSignal(interaction.signal);\n\t\tconst started = performance.now();\n\t\treturn this.enqueueCredentialOperation(providerId, signal, async () => {\n\t\t\tconst provider = this.models.getProvider(providerId);\n\t\t\tif (!provider) throw new ModelsError(\"provider\", `Unknown provider: ${providerId}`);\n\t\t\tconst method = type === \"oauth\" ? provider.auth.oauth : provider.auth.apiKey;\n\t\t\tif (!method?.login) throw new ModelsError(\"auth\", `${provider.name} does not support ${type} login`);\n\t\t\tif (options?.accountKey !== undefined) {\n\t\t\t\tconst selected = (await this.oauthAccountPool.listAccounts(providerId, { signal })).find(\n\t\t\t\t\t(account) => account.key === options.accountKey,\n\t\t\t\t);\n\t\t\t\tif (!selected || selected.credential.type !== type)\n\t\t\t\t\tthrow new ModelsError(\"auth\", \"Account is no longer available for reauthentication\");\n\t\t\t}\n\t\t\tif (providerId === HCODE_PROVIDER) await this.hcodeFacade.recover(signal);\n\t\t\tconst nativeReference =\n\t\t\t\tproviderId === HCODE_PROVIDER ? await this.credentials.readStored(providerId, { signal }) : undefined;\n\t\t\tif (providerId !== HCODE_PROVIDER) await this.oauthAccountPool.adoptCurrentAccount(providerId, { signal });\n\t\t\tlet promptCancelled = false;\n\t\t\tlet login: Credential;\n\t\t\ttry {\n\t\t\t\tconst input: ProviderAuthInteraction = {\n\t\t\t\t\t...interaction,\n\t\t\t\t\tsignal,\n\t\t\t\t\tprompt: async (prompt) => {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\treturn await interaction.prompt(prompt);\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t// A callback winner aborts only its pending prompt, not the whole login.\n\t\t\t\t\t\t\tif (signal.aborted || !prompt.signal?.aborted) promptCancelled = true;\n\t\t\t\t\t\t\tthrow new LoginCancellationError();\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\tlogin = await raceWithAbortSignal<Credential>(\n\t\t\t\t\tproviderId === HCODE_PROVIDER\n\t\t\t\t\t\t? this.hcodeFacade\n\t\t\t\t\t\t\t\t.login(input, signal, async (reference) => {\n\t\t\t\t\t\t\t\t\t// The generic pool intentionally excludes keyless references; only native login may replace its observed reference.\n\t\t\t\t\t\t\t\t\tconst candidate = hcodeReferenceCredential(reference);\n\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\tawait this.credentials.modify(\n\t\t\t\t\t\t\t\t\t\t\tproviderId,\n\t\t\t\t\t\t\t\t\t\t\tasync (current) => {\n\t\t\t\t\t\t\t\t\t\t\t\tif (!sameCredential(current, nativeReference))\n\t\t\t\t\t\t\t\t\t\t\t\t\tthrow new SafeCredentialError(HCODE_LOGIN_FAILURES.accountChanged);\n\t\t\t\t\t\t\t\t\t\t\t\treturn candidate;\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t{ signal },\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\t\t\t\t// A backend may reject after writing; compensate only our candidate, never a competing publication.\n\t\t\t\t\t\t\t\t\t\tif (nativeReference)\n\t\t\t\t\t\t\t\t\t\t\tawait this.credentials.modify(providerId, async (current) =>\n\t\t\t\t\t\t\t\t\t\t\t\tsameCredential(current, candidate) ? nativeReference : undefined,\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\t\tawait this.credentials.deleteStored(providerId, {\n\t\t\t\t\t\t\t\t\t\t\t\tifCurrent: (current) => sameCredential(current, candidate),\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\tthrow error;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.then(hcodeReferenceCredential)\n\t\t\t\t\t\t: method.login(input, options),\n\t\t\t\t\tsignal,\n\t\t\t\t);\n\t\t\t} catch (error) {\n\t\t\t\tif (promptCancelled || signal.aborted) throw new LoginCancellationError();\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tif (promptCancelled) throw new LoginCancellationError();\n\t\t\t// Login returns credentials, not configuration expressions. Ambient-only entries stay external.\n\t\t\tconst poolable = login.type === \"oauth\" || !!login.key?.trim();\n\t\t\tif (options?.accountKey !== undefined && !poolable)\n\t\t\t\tthrow new ModelsError(\"auth\", \"Reauthentication must return a literal account credential\");\n\t\t\tconst account = poolable\n\t\t\t\t? await this.oauthAccountPool.addAccount(providerId, login, { signal, key: options?.accountKey })\n\t\t\t\t: undefined;\n\t\t\tconst credential = account?.credential ?? login;\n\t\t\tif (providerId === HCODE_PROVIDER) {\n\t\t\t\tconst reference = this.hcode.account.status(this.hcode.environmentId);\n\t\t\t\tif (!reference || login.type !== \"api_key\") throw new ModelsError(\"auth\", \"HUMAIN Code account changed.\");\n\t\t\t\tif (this.hcodeFacade.persistence(reference) === \"session\") {\n\t\t\t\t\tthis.hcodeSession = reference;\n\t\t\t\t\tthis.credentials.setHcodeSessionReference(login);\n\t\t\t\t\tawait this.synchronizeCredentialState(providerId, \"login\", signal);\n\t\t\t\t\treturn login;\n\t\t\t\t}\n\t\t\t\tthis.hcodeSession = undefined;\n\t\t\t} else if (!account) await commitLoginCredential(this.credentials.accountStore, providerId, login, signal);\n\t\t\tawait this.synchronizeCredentialState(providerId, \"login\", signal);\n\t\t\treturn credential;\n\t\t}).then(\n\t\t\t(credential) => {\n\t\t\t\tthis.metadata.feature(\"login\", Math.round(performance.now() - started), \"success\");\n\t\t\t\treturn credential;\n\t\t\t},\n\t\t\t(error: unknown) => {\n\t\t\t\tconst outcome = signal.aborted || error instanceof LoginCancellationError ? \"cancelled\" : \"failure\";\n\t\t\t\tthis.metadata.feature(\"login\", Math.round(performance.now() - started), outcome);\n\t\t\t\tthis.metadata.failure(\n\t\t\t\t\t\"login\",\n\t\t\t\t\terror instanceof CredentialSynchronizationError ? \"storage\" : \"auth\",\n\t\t\t\t\t0,\n\t\t\t\t\toutcome,\n\t\t\t\t);\n\t\t\t\tif (providerId === HCODE_PROVIDER && signal.aborted && !(error instanceof CredentialSynchronizationError))\n\t\t\t\t\tthrow new LoginCancellationError();\n\t\t\t\tthrow error;\n\t\t\t},\n\t\t);\n\t}\n\n\t/**\n\t * Remove the selected account, or without a key the account whose credential is stored. Removing the active\n\t * account promotes the next account of the same credential type; otherwise the credential is deleted.\n\t * Literal legacy credentials are adopted first, including OAuth credentials without identity. An unknown\n\t * explicit account key leaves stored credentials unchanged, and so does a stored credential that changed while\n\t * the account was being removed. `logoutWithStatus` reports which of these happened.\n\t */\n\tasync logout(providerId: string, options: AuthOperationOptions & { accountKey?: string } = {}): Promise<void> {\n\t\tawait this.logoutWithStatus(providerId, options);\n\t}\n\n\tprivate async deleteObservedStoredCredential(\n\t\tproviderId: string,\n\t\tobserved: Credential | undefined,\n\t\tsignal: AbortSignal,\n\t): Promise<AccountRemoveResult[\"status\"]> {\n\t\tif (providerId === HCODE_PROVIDER) await this.hcodeFacade.logoutStored(observed, signal);\n\t\tlet status: AccountRemoveResult[\"status\"] = \"changed\";\n\t\tawait this.credentials.deleteStored(providerId, {\n\t\t\tsignal,\n\t\t\tifCurrent: (latest) => {\n\t\t\t\tif (!sameCredential(latest, observed)) return false;\n\t\t\t\tstatus = \"removed\";\n\t\t\t\treturn true;\n\t\t\t},\n\t\t});\n\t\treturn status;\n\t}\n\n\t/** Capture a non-pooled raw credential before confirmation, without exposing it to the UI. */\n\tprepareStoredCredentialRemoval(\n\t\tproviderId: string,\n\t\toptions?: AuthOperationOptions,\n\t): Promise<((options?: AuthOperationOptions) => Promise<AccountRemoveResult[\"status\"]>) | undefined> {\n\t\treturn this.protectCredentialOperation(\n\t\t\t(async () => {\n\t\t\t\tconst observed = structuredClone(await this.credentials.readStored(providerId, options));\n\t\t\t\tif (!observed || (await this.oauthAccountPool.getCurrentAccount(providerId, options))) return undefined;\n\t\t\t\treturn (removalOptions?: AuthOperationOptions) => {\n\t\t\t\t\tconst signal = operationSignal(removalOptions?.signal);\n\t\t\t\t\treturn this.enqueueCredentialOperation(providerId, signal, async () => {\n\t\t\t\t\t\tconst status = await this.deleteObservedStoredCredential(providerId, observed, signal);\n\t\t\t\t\t\tif (status === \"removed\") await this.synchronizeCredentialState(providerId, \"logout\", signal);\n\t\t\t\t\t\treturn status;\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t})(),\n\t\t\toptions?.signal,\n\t\t\tfalse,\n\t\t);\n\t}\n\n\t/**\n\t * `logout`, resolving `removed`, `unmatched` (unknown explicit account key; nothing changed), or `changed` (the stored\n\t * credential changed concurrently; nothing removed).\n\t */\n\tlogoutWithStatus(\n\t\tproviderId: string,\n\t\toptions: AuthOperationOptions & { accountKey?: string } = {},\n\t): Promise<AccountRemoveResult[\"status\"]> {\n\t\tconst signal = operationSignal(options.signal);\n\t\treturn this.enqueueCredentialOperation(providerId, signal, async () => {\n\t\t\tif (providerId === HCODE_PROVIDER) await this.hcodeFacade.recover(signal);\n\t\t\tif (providerId === HCODE_PROVIDER && this.hcodeSession) {\n\t\t\t\tconst reference = this.hcodeSession;\n\t\t\t\tconst retained = this.hcodeFacade.persistence(reference) === \"session\";\n\t\t\t\ttry {\n\t\t\t\t\tif (retained) await this.hcode.account.logout(reference, signal);\n\t\t\t\t} finally {\n\t\t\t\t\tthis.credentials.clearHcodeSessionReference();\n\t\t\t\t}\n\t\t\t\tawait this.synchronizeCredentialState(providerId, \"logout\", signal);\n\t\t\t\treturn retained ? \"removed\" : \"unmatched\";\n\t\t\t}\n\t\t\t// Raw stored credential (`read` resolves configured API-key values), observed before the pool's read.\n\t\t\tconst observed =\n\t\t\t\toptions.accountKey === undefined\n\t\t\t\t\t? structuredClone(await this.credentials.modify(providerId, async () => undefined, { signal }))\n\t\t\t\t\t: undefined;\n\t\t\t// A stored-only removal never goes through the pool: another session may select an account after\n\t\t\t// this observation, and adopting/removing that replacement would silently retarget the logout.\n\t\t\tif (\n\t\t\t\tthis.credentials.isExternalCredential(observed) ||\n\t\t\t\t(observed?.type === \"api_key\" && !observed.key?.trim()) ||\n\t\t\t\t(providerId === \"openai-codex\" &&\n\t\t\t\t\tobserved?.type === \"oauth\" &&\n\t\t\t\t\t!this.oauthAccountPool.getAccountIdentity(providerId, observed))\n\t\t\t) {\n\t\t\t\tconst status = await this.deleteObservedStoredCredential(providerId, observed, signal);\n\t\t\t\tif (status === \"removed\") await this.synchronizeCredentialState(providerId, \"logout\", signal);\n\t\t\t\treturn status;\n\t\t\t}\n\t\t\tconst stored =\n\t\t\t\toptions.accountKey === undefined ? observed : await this.credentials.readStored(providerId, { signal });\n\t\t\t// Keep Codex's fail-closed handling of legacy unstamped credentials with no identifiable account.\n\t\t\t// Generalized login always stamps even opaque Codex credentials, so they use the account API normally.\n\t\t\tconst legacyUnmatchedCodex =\n\t\t\t\tproviderId === \"openai-codex\" &&\n\t\t\t\tstored?.type === \"oauth\" &&\n\t\t\t\t!this.oauthAccountPool.getAccountIdentity(providerId, stored);\n\t\t\t// A generalized list can give an unstamped legacy credential a temporary local key.\n\t\t\tconst selectedLegacyCurrent =\n\t\t\t\tlegacyUnmatchedCodex &&\n\t\t\t\toptions.accountKey?.startsWith(\"account-\") &&\n\t\t\t\t(await this.oauthAccountPool.getCurrentAccount(providerId, { signal }))?.key === options.accountKey;\n\t\t\t// Removal already reconciles legacy credentials under the pool lock; separate adoption can retarget logout.\n\t\t\tconst removal =\n\t\t\t\tlegacyUnmatchedCodex && !selectedLegacyCurrent\n\t\t\t\t\t? await this.oauthAccountPool.remove(providerId, options.accountKey, { signal })\n\t\t\t\t\t: await this.oauthAccountPool.removeAccount(providerId, options.accountKey, {\n\t\t\t\t\t\t\tsignal,\n\t\t\t\t\t\t\tifCurrent:\n\t\t\t\t\t\t\t\toptions.accountKey === undefined ? (latest) => sameCredential(latest, observed) : undefined,\n\t\t\t\t\t\t});\n\t\t\tlet status = removal.status;\n\t\t\tif (status === \"unmatched\") {\n\t\t\t\tif (options.accountKey !== undefined) return status;\n\t\t\t\t// Unlike Models.logout, delete only the observed credential, never one written since.\n\t\t\t\tstatus = await this.deleteObservedStoredCredential(providerId, observed, signal);\n\t\t\t}\n\t\t\tif (status === \"removed\") await this.synchronizeCredentialState(providerId, \"logout\", signal);\n\t\t\treturn status;\n\t\t});\n\t}\n\n\t/**\n\t * Provider and virtual-model registration changes each queue an un-awaited\n\t * offline refresh after recomposing a provider, unless batched without refresh\n\t * (e.g. the always-loaded llama.cpp builtin extension registers itself\n\t * on every startup). Left unbounded, that background refresh can still be\n\t * running when a caller later does an explicit `await refresh(...)` (startup's\n\t * HUMAIN Node discovery, or the provider-registration refresh in\n\t * createAgentSessionServices) and can finish after it, recomposing every\n\t * provider back to its static definition and clobbering the just-discovered\n\t * dynamic model list or the auth snapshot `hasConfiguredAuth()` reads.\n\t *\n\t * Every non-registration refresh() call waits for these to settle before doing\n\t * its own snapshot work, so it always lands last. Registration-triggered\n\t * refreshes never wait on this set (or on each other via it), so they can't\n\t * deadlock on one another, and unrelated explicit refreshes (e.g. two\n\t * provider-scoped catalog refreshes) remain fully concurrent with each other,\n\t * exactly as before.\n\t */\n\tprivate readonly pendingRegistrationRefreshes = new Set<Promise<void>>();\n\tprivate registeringWithoutRefresh = false;\n\n\t/** Runs synchronous registrations without background refreshes; the caller must refresh afterward. */\n\tregisterWithoutRefresh(register: () => void): void {\n\t\tconst previous = this.registeringWithoutRefresh;\n\t\tthis.registeringWithoutRefresh = true;\n\t\ttry {\n\t\t\tregister();\n\t\t} finally {\n\t\t\tthis.registeringWithoutRefresh = previous;\n\t\t}\n\t}\n\n\tprivate queueRegistrationRefresh(): void {\n\t\tif (this.registeringWithoutRefresh) return;\n\t\tconst p = this.refreshInternal({ allowNetwork: false }, { fromRegistration: true }).then(\n\t\t\t() => {},\n\t\t\t() => {},\n\t\t);\n\t\tthis.pendingRegistrationRefreshes.add(p);\n\t\tvoid p.finally(() => this.pendingRegistrationRefreshes.delete(p));\n\t}\n\n\trefresh(options: ModelsRefreshOptions = {}): Promise<ModelsRefreshResult> {\n\t\treturn this.refreshInternal(options, { fromRegistration: false });\n\t}\n\n\tprivate async refreshInternal(\n\t\toptions: ModelsRefreshOptions,\n\t\t{ fromRegistration }: { fromRegistration: boolean },\n\t): Promise<ModelsRefreshResult> {\n\t\tif (!fromRegistration && this.pendingRegistrationRefreshes.size > 0) {\n\t\t\tawait Promise.allSettled([...this.pendingRegistrationRefreshes]);\n\t\t}\n\t\tconst config = await ModelConfig.load(this.modelsPath);\n\t\tthis.assertConfiguration(config);\n\t\tthis.config = config;\n\t\tthis.configureRadiusProviders();\n\t\tif (options.providers) {\n\t\t\tfor (const providerId of new Set(options.providers)) this.recomposeProvider(providerId);\n\t\t\tthis.updateModelSnapshot();\n\t\t} else {\n\t\t\tthis.rebuildProviders();\n\t\t}\n\t\tconst refreshOptions = {\n\t\t\t...options,\n\t\t\tallowNetwork: options.allowNetwork ?? this.modelNetworkEnabled,\n\t\t};\n\t\t// Published pi-ai builds before ModelsStore returned void and accepted a provider ID.\n\t\t// The fallback keeps source-mode CLI tests working without rebuilding workspace dependencies.\n\t\tconst result = ((await this.models.refresh(refreshOptions)) as ModelsRefreshResult | undefined) ?? {\n\t\t\taborted: refreshOptions.signal?.aborted ?? false,\n\t\t\terrors: new Map(),\n\t\t};\n\t\tconst errors = new Map(result.errors);\n\t\tthis.updateModelSnapshot();\n\t\tif (options.providers) {\n\t\t\tawait Promise.all(\n\t\t\t\t[...new Set(options.providers)].map(async (providerId) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait this.refreshProviderAvailability(providerId, operationSignal(options.signal));\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tif (!options.signal?.aborted) {\n\t\t\t\t\t\t\terrors.set(providerId, error instanceof Error ? error : new Error(String(error)));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t);\n\t\t} else {\n\t\t\ttry {\n\t\t\t\tawait this.queueAvailabilityRefresh(options.signal);\n\t\t\t} catch {\n\t\t\t\t// Availability errors are recorded by the latest pass; refreshed models remain usable.\n\t\t\t}\n\t\t}\n\t\treturn { aborted: result.aborted || (options.signal?.aborted ?? false), errors };\n\t}\n\n\tregisterNativeProvider(provider: Provider): void {\n\t\tassertCustomProviderId(provider.id);\n\t\tif (!provider.id.trim()) throw new Error(\"Provider id must not be empty.\");\n\t\tthis.extensionProviders.delete(provider.id);\n\t\tthis.nativeExtensionProviders.set(provider.id, provider);\n\t\tthis.recomposeProvider(provider.id);\n\t\tthis.updateModelSnapshot();\n\t\tthis.markProvisionallyConfigured(\n\t\t\tprovider.id,\n\t\t\tconfiguredRequestAuthStatus(this.config.getProvider(provider.id), undefined),\n\t\t\tprovider.auth.oauth && !provider.auth.apiKey ? \"oauth\" : \"api_key\",\n\t\t);\n\t\tthis.queueRegistrationRefresh();\n\t}\n\n\t/**\n\t * Mark a newly registered provider as configured when it has a stored credential or a configured\n\t * API key. Availability checks run asynchronously, and callers such as initial model selection\n\t * read the snapshot before they finish. The next availability pass replaces this entry.\n\t */\n\tprivate markProvisionallyConfigured(\n\t\tproviderId: string,\n\t\tconfiguredStatus: AuthStatus | undefined,\n\t\ttype: AuthType,\n\t): void {\n\t\tif (!this.snapshot.storedProviders.has(providerId) && !configuredStatus?.configured) return;\n\t\tconst configuredProviders = new Set(this.snapshot.configuredProviders).add(providerId);\n\t\tconst auth = new Map(this.snapshot.auth);\n\t\t// Never clobber a real check result.\n\t\tif (!auth.get(providerId)) auth.set(providerId, { type, source: \"configured provider\" });\n\t\tthis.snapshot = {\n\t\t\t...this.snapshot,\n\t\t\tauth,\n\t\t\tconfiguredProviders,\n\t\t\tavailable: this.snapshot.all.ofProviders(configuredProviders),\n\t\t};\n\t}\n\n\tregisterProvider(providerId: string, config: ProviderConfigInput): void {\n\t\tassertCustomProviderId(providerId);\n\t\tthis.configurationGuard?.({ [providerId]: config });\n\t\t// Validate the incoming registration on its own, like the legacy registry:\n\t\t// a broken re-registration must throw without touching the stored config.\n\t\tvalidateExtensionProvider(providerId, this.builtins.get(providerId), this.config.getProvider(providerId), config);\n\t\tthis.nativeExtensionProviders.delete(providerId);\n\t\t// Re-registration merges defined values over the previous registration and\n\t\t// preserves undefined ones, matching the legacy ModelRegistry contract.\n\t\tconst previous = this.extensionProviders.get(providerId);\n\t\tconst effective: ProviderConfigInput = { ...previous };\n\t\tfor (const [key, value] of Object.entries(config)) {\n\t\t\tif (value !== undefined) (effective as Record<string, unknown>)[key] = value;\n\t\t}\n\t\tthis.extensionProviders.set(providerId, effective);\n\t\tthis.recomposeProvider(providerId);\n\t\tthis.updateModelSnapshot();\n\t\tthis.markProvisionallyConfigured(\n\t\t\tproviderId,\n\t\t\tconfiguredRequestAuthStatus(this.config.getProvider(providerId), effective),\n\t\t\teffective.oauth && !effective.apiKey ? \"oauth\" : \"api_key\",\n\t\t);\n\t\tthis.queueRegistrationRefresh();\n\t}\n\n\tunregisterProvider(providerId: string): void {\n\t\tassertCustomProviderId(providerId);\n\t\tthis.extensionProviders.delete(providerId);\n\t\tthis.nativeExtensionProviders.delete(providerId);\n\t\tthis.recomposeProvider(providerId);\n\t\tthis.updateModelSnapshot();\n\t\tthis.queueRegistrationRefresh();\n\t}\n\n\t/**\n\t * Register a virtual model under `definition.provider`, which may also list physical models or\n\t * several virtual models. Re-registering the same provider and id replaces the virtual model.\n\t * Throws when the id belongs to a physical model of that provider.\n\t */\n\tregisterVirtualModel(definition: VirtualModelDefinition): void {\n\t\tconst { provider: providerId, id } = definition;\n\t\tassertCustomProviderId(providerId);\n\t\tif (!providerId.trim() || !id.trim()) throw new Error(\"Virtual model provider and id must not be empty.\");\n\t\tconst existing = this.models.getModel(providerId, id);\n\t\tif (existing && !isVirtualModel(existing)) {\n\t\t\tthrow new Error(`Virtual model ${providerId}/${id} conflicts with a physical model.`);\n\t\t}\n\t\tconst models = this.virtualModels.get(providerId) ?? new Map<string, RegisteredVirtualModel>();\n\t\tmodels.set(id, { model: createVirtualModel(definition), route: (request) => definition.route(request) });\n\t\tthis.virtualModels.set(providerId, models);\n\t\tif (!this.recomposeProvider(providerId) && !this.snapshot.configuredProviders.has(providerId)) {\n\t\t\t// A provider of only virtual models needs no credentials. Mark it configured now: session\n\t\t\t// restore checks auth before the refresh below lands.\n\t\t\tconst auth = new Map(this.snapshot.auth).set(providerId, { type: \"api_key\", source: \"virtual\" });\n\t\t\tconst configuredProviders = new Set(this.snapshot.configuredProviders).add(providerId);\n\t\t\tthis.snapshot = { ...this.snapshot, auth, configuredProviders };\n\t\t}\n\t\tthis.updateModelSnapshot();\n\t\tthis.queueRegistrationRefresh();\n\t}\n\n\tunregisterVirtualModel(providerId: string, id: string): void {\n\t\tassertCustomProviderId(providerId);\n\t\tconst models = this.virtualModels.get(providerId);\n\t\tif (!models?.delete(id)) return;\n\t\tif (models.size === 0) this.virtualModels.delete(providerId);\n\t\tthis.recomposeProvider(providerId);\n\t\tthis.updateModelSnapshot();\n\t\tthis.queueRegistrationRefresh();\n\t}\n\n\t/**\n\t * Ask a virtual model's router for the model and thinking level of one request. The router must\n\t * return a physical catalog model whose provider has credentials; the thinking level is clamped\n\t * to that model. Throws when routing fails.\n\t *\n\t * `previous` reports the latest successful response in `messages`. A retry passes the failed\n\t * response as `options.failed`; `messages` no longer contains it. `options.state` is the router\n\t * state stored by the caller, which also stores the returned state.\n\t */\n\tasync resolveModel(\n\t\tmodel: Model<Api>,\n\t\tmessages: readonly Message[],\n\t\toptions: {\n\t\t\treason: ModelRouteReason;\n\t\t\t/** Let the session clamp and report the original effort at request projection. */\n\t\t\tdeferThinkingClamp?: boolean;\n\t\t\tthinkingLevel: ModelThinkingLevel;\n\t\t\tsignal?: AbortSignal;\n\t\t\tfailed?: AssistantMessage;\n\t\t\tstate?: unknown;\n\t\t},\n\t): Promise<ModelRoute> {\n\t\tconst name = `Virtual model ${model.provider}/${model.id}`;\n\t\tconst virtual = this.virtualModels.get(model.provider)?.get(model.id);\n\t\tif (!virtual) throw new Error(`${name} is not registered.`);\n\t\tconst { failed, deferThinkingClamp, ...request } = options;\n\t\tconst latest = findLatestResponse(messages);\n\t\tconst previousModel = latest && this.getPhysicalModel(latest.provider, latest.model);\n\t\t// A failed routing attempt names the virtual model; there is no physical request to report.\n\t\tconst failedModel = failed && this.getPhysicalModel(failed.provider, failed.model);\n\t\tconst route = await virtual.route({\n\t\t\t...request,\n\t\t\tmodel,\n\t\t\tprevious: previousModel && { model: previousModel, thinkingLevel: latest?.thinkingLevel },\n\t\t\tfailed: failedModel && failed && { model: failedModel, thinkingLevel: failed.thinkingLevel, message: failed },\n\t\t\tmessages,\n\t\t});\n\t\tthis.assertHcodeModel(route.model);\n\t\tconst target = this.getPhysicalModel(route.model.provider, route.model.id);\n\t\tconst routed = `${name} routed to ${route.model.provider}/${route.model.id}`;\n\t\tif (!target) throw new Error(`${routed}, which is not a physical model.`);\n\t\tif (!this.hasConfiguredAuth(target.provider)) throw new Error(`${routed}, which has no credentials.`);\n\t\tif (deferThinkingClamp) return { ...route, model: target };\n\t\treturn {\n\t\t\tmodel: target,\n\t\t\tthinkingLevel: clampThinkingLevel(target, route.thinkingLevel),\n\t\t\tstate: route.state,\n\t\t};\n\t}\n\n\t/** A catalog chat model that is not virtual. */\n\tgetPhysicalModel(providerId: string, modelId: string): Model<Api> | undefined {\n\t\tconst model = this.models.getModel(providerId, modelId);\n\t\t// A custom catalog cannot lend its provider ID to the reserved native target.\n\t\tif (model?.provider === HCODE_PROVIDER && providerId !== HCODE_PROVIDER) return undefined;\n\t\treturn model && !isVirtualModel(model) ? model : undefined;\n\t}\n}\n"]}