@skaile/workspaces 5.11.0 → 5.12.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 (403) hide show
  1. package/CHANGELOG.md +97 -0
  2. package/README.md +2 -2
  3. package/dist/{asset-feeds-CXGQIDFR.js → asset-feeds-AM6PSSGM.js} +24 -21
  4. package/dist/asset-feeds-AM6PSSGM.js.map +1 -0
  5. package/dist/asset-manager/catalog-deployer.js +8 -8
  6. package/dist/asset-manager/fragments.js +1 -1
  7. package/dist/asset-manager/index.js +16 -16
  8. package/dist/asset-manager/installer.js +11 -11
  9. package/dist/asset-manager/renderers.js +9 -9
  10. package/dist/asset-manager/src/fragments.d.ts +5 -0
  11. package/dist/asset-manager/src/fragments.d.ts.map +1 -1
  12. package/dist/asset-manager/src/index.d.ts +95 -10
  13. package/dist/asset-manager/src/index.d.ts.map +1 -1
  14. package/dist/asset-manager/src/install-agent.d.ts +9 -1
  15. package/dist/asset-manager/src/install-agent.d.ts.map +1 -1
  16. package/dist/asset-manager/src/installer.d.ts +10 -0
  17. package/dist/asset-manager/src/installer.d.ts.map +1 -1
  18. package/dist/asset-manager/src/renderers.d.ts +5 -0
  19. package/dist/asset-manager/src/renderers.d.ts.map +1 -1
  20. package/dist/bridge/drivers/claude-sdk.js +16 -13
  21. package/dist/bridge/drivers/claude-sdk.js.map +1 -1
  22. package/dist/bridge/drivers/codex.js +43 -16
  23. package/dist/bridge/drivers/codex.js.map +1 -1
  24. package/dist/bridge/drivers/continue.js +10 -10
  25. package/dist/bridge/drivers/echo.js +2 -2
  26. package/dist/bridge/drivers/gemini.js +7 -7
  27. package/dist/bridge/drivers/goose.js +10 -10
  28. package/dist/bridge/drivers/omp.js +37 -10
  29. package/dist/bridge/drivers/omp.js.map +1 -1
  30. package/dist/bridge/drivers/opencode.js +10 -10
  31. package/dist/bridge/drivers/qwen.js +7 -7
  32. package/dist/bridge/index.js +12 -12
  33. package/dist/bridge/src/codex/config-toml.d.ts +8 -3
  34. package/dist/bridge/src/codex/config-toml.d.ts.map +1 -1
  35. package/dist/bridge/src/codex/managed-driver.d.ts.map +1 -1
  36. package/dist/bridge/src/drivers/claude-sdk.d.ts +1 -1
  37. package/dist/bridge/src/drivers/claude-sdk.d.ts.map +1 -1
  38. package/dist/bridge/src/drivers/codex.d.ts.map +1 -1
  39. package/dist/bridge/src/drivers/omp-models-yml.d.ts.map +1 -1
  40. package/dist/bridge/src/drivers/omp.d.ts +9 -0
  41. package/dist/bridge/src/drivers/omp.d.ts.map +1 -1
  42. package/dist/bridge/src/provider-materialize/credential-env.d.ts +15 -0
  43. package/dist/bridge/src/provider-materialize/credential-env.d.ts.map +1 -1
  44. package/dist/{chunk-4A4OD24G.js → chunk-27L6BBAT.js} +9 -9
  45. package/dist/{chunk-4A4OD24G.js.map → chunk-27L6BBAT.js.map} +1 -1
  46. package/dist/{chunk-HCEVNYSH.js → chunk-2JFIFDDO.js} +3 -3
  47. package/dist/{chunk-HCEVNYSH.js.map → chunk-2JFIFDDO.js.map} +1 -1
  48. package/dist/{chunk-3SM2DL2T.js → chunk-2X3JBVGD.js} +11 -10
  49. package/dist/chunk-2X3JBVGD.js.map +1 -0
  50. package/dist/{chunk-G4FFOV3N.js → chunk-3HUV2LJF.js} +4 -4
  51. package/dist/{chunk-G4FFOV3N.js.map → chunk-3HUV2LJF.js.map} +1 -1
  52. package/dist/{chunk-QZNJOHN6.js → chunk-3LVB3HGH.js} +3 -3
  53. package/dist/{chunk-QZNJOHN6.js.map → chunk-3LVB3HGH.js.map} +1 -1
  54. package/dist/{chunk-ZCAJZ4B2.js → chunk-6VLHITAM.js} +145 -3
  55. package/dist/chunk-6VLHITAM.js.map +1 -0
  56. package/dist/{chunk-J4RBUFGM.js → chunk-7CR2OZPA.js} +6 -6
  57. package/dist/{chunk-J4RBUFGM.js.map → chunk-7CR2OZPA.js.map} +1 -1
  58. package/dist/{chunk-HZXUXHIV.js → chunk-7QWQTA5S.js} +89 -12
  59. package/dist/chunk-7QWQTA5S.js.map +1 -0
  60. package/dist/{chunk-TCHRMVTO.js → chunk-7XWUJC3A.js} +4 -4
  61. package/dist/{chunk-TCHRMVTO.js.map → chunk-7XWUJC3A.js.map} +1 -1
  62. package/dist/{chunk-2F5AWQX5.js → chunk-C3BMXXTN.js} +137 -31
  63. package/dist/chunk-C3BMXXTN.js.map +1 -0
  64. package/dist/{chunk-ZPWTOUTK.js → chunk-CTP3XBMF.js} +7 -4
  65. package/dist/chunk-CTP3XBMF.js.map +1 -0
  66. package/dist/{chunk-GCHPUTA3.js → chunk-DCHQ6BAZ.js} +3 -3
  67. package/dist/{chunk-GCHPUTA3.js.map → chunk-DCHQ6BAZ.js.map} +1 -1
  68. package/dist/{chunk-DALV4HHP.js → chunk-DKXNKFKP.js} +3 -2
  69. package/dist/{chunk-DALV4HHP.js.map → chunk-DKXNKFKP.js.map} +1 -1
  70. package/dist/{chunk-X77SUM4P.js → chunk-G3X4MLDB.js} +3 -3
  71. package/dist/{chunk-X77SUM4P.js.map → chunk-G3X4MLDB.js.map} +1 -1
  72. package/dist/{chunk-CAHB6MHA.js → chunk-GWD3QNVS.js} +5 -5
  73. package/dist/{chunk-CAHB6MHA.js.map → chunk-GWD3QNVS.js.map} +1 -1
  74. package/dist/chunk-H5U7LNTJ.js +122 -0
  75. package/dist/chunk-H5U7LNTJ.js.map +1 -0
  76. package/dist/{chunk-QVFAS5IO.js → chunk-HYMERG57.js} +3 -3
  77. package/dist/{chunk-QVFAS5IO.js.map → chunk-HYMERG57.js.map} +1 -1
  78. package/dist/{chunk-R7NHYEJF.js → chunk-ICIYSJBQ.js} +4 -4
  79. package/dist/{chunk-R7NHYEJF.js.map → chunk-ICIYSJBQ.js.map} +1 -1
  80. package/dist/{chunk-YOH2L76X.js → chunk-ID745F3R.js} +353 -233
  81. package/dist/chunk-ID745F3R.js.map +1 -0
  82. package/dist/{chunk-PQFHMQHQ.js → chunk-JQ3DXNQV.js} +4 -4
  83. package/dist/{chunk-PQFHMQHQ.js.map → chunk-JQ3DXNQV.js.map} +1 -1
  84. package/dist/chunk-K4VOEYOR.js +21 -0
  85. package/dist/chunk-K4VOEYOR.js.map +1 -0
  86. package/dist/{chunk-XDKH7XSA.js → chunk-KVSDRB35.js} +5 -5
  87. package/dist/{chunk-XDKH7XSA.js.map → chunk-KVSDRB35.js.map} +1 -1
  88. package/dist/{chunk-47U4GZ4M.js → chunk-MF54ZHWT.js} +20 -3
  89. package/dist/chunk-MF54ZHWT.js.map +1 -0
  90. package/dist/{chunk-VLTQGE2E.js → chunk-N5M2EISA.js} +197 -52
  91. package/dist/chunk-N5M2EISA.js.map +1 -0
  92. package/dist/{chunk-T7CTHHG7.js → chunk-NDF24LYP.js} +3 -3
  93. package/dist/{chunk-T7CTHHG7.js.map → chunk-NDF24LYP.js.map} +1 -1
  94. package/dist/{chunk-CPWLNZGJ.js → chunk-NGJIVDDD.js} +3 -3
  95. package/dist/{chunk-CPWLNZGJ.js.map → chunk-NGJIVDDD.js.map} +1 -1
  96. package/dist/{chunk-FH7W6TJ4.js → chunk-NJV5SLEK.js} +104 -23
  97. package/dist/chunk-NJV5SLEK.js.map +1 -0
  98. package/dist/{chunk-M3B6EIJD.js → chunk-NJXR5OAM.js} +4 -4
  99. package/dist/{chunk-M3B6EIJD.js.map → chunk-NJXR5OAM.js.map} +1 -1
  100. package/dist/{chunk-CGYEHQOX.js → chunk-NOA6EJXE.js} +11 -2
  101. package/dist/chunk-NOA6EJXE.js.map +1 -0
  102. package/dist/{chunk-RYYLMBA2.js → chunk-NR7H7ZJP.js} +14 -6
  103. package/dist/chunk-NR7H7ZJP.js.map +1 -0
  104. package/dist/{chunk-OBYKJB4U.js → chunk-O2SYFJWP.js} +79 -5
  105. package/dist/chunk-O2SYFJWP.js.map +1 -0
  106. package/dist/{chunk-5LKOAX7I.js → chunk-OQ5MKDS3.js} +21 -5
  107. package/dist/chunk-OQ5MKDS3.js.map +1 -0
  108. package/dist/{chunk-CJERAGFY.js → chunk-P23WJCH2.js} +37 -11
  109. package/dist/chunk-P23WJCH2.js.map +1 -0
  110. package/dist/{chunk-NWDSLXOX.js → chunk-PHRNUTSG.js} +118 -118
  111. package/dist/chunk-PHRNUTSG.js.map +1 -0
  112. package/dist/{chunk-ALEYHUC5.js → chunk-PNOGX36L.js} +104 -24
  113. package/dist/chunk-PNOGX36L.js.map +1 -0
  114. package/dist/{chunk-BNMZVPYA.js → chunk-PNTXHTBC.js} +2 -2
  115. package/dist/{chunk-BNMZVPYA.js.map → chunk-PNTXHTBC.js.map} +1 -1
  116. package/dist/{chunk-GV4DZ6MT.js → chunk-POQ6PGNE.js} +4 -4
  117. package/dist/{chunk-GV4DZ6MT.js.map → chunk-POQ6PGNE.js.map} +1 -1
  118. package/dist/{chunk-T42WRQ4O.js → chunk-QCEKGYHF.js} +3 -3
  119. package/dist/{chunk-T42WRQ4O.js.map → chunk-QCEKGYHF.js.map} +1 -1
  120. package/dist/{chunk-EDYHEMJA.js → chunk-SHQMPGOL.js} +4 -4
  121. package/dist/{chunk-EDYHEMJA.js.map → chunk-SHQMPGOL.js.map} +1 -1
  122. package/dist/{chunk-S3O3GKB7.js → chunk-SMT3LNAG.js} +4 -4
  123. package/dist/{chunk-S3O3GKB7.js.map → chunk-SMT3LNAG.js.map} +1 -1
  124. package/dist/{chunk-PBBPZYVG.js → chunk-T5TSLSRO.js} +110 -44
  125. package/dist/chunk-T5TSLSRO.js.map +1 -0
  126. package/dist/{chunk-DZMNFCWB.js → chunk-TVAR4JHA.js} +530 -126
  127. package/dist/chunk-TVAR4JHA.js.map +1 -0
  128. package/dist/{chunk-COH6FQAG.js → chunk-UTKENBB6.js} +5 -5
  129. package/dist/{chunk-COH6FQAG.js.map → chunk-UTKENBB6.js.map} +1 -1
  130. package/dist/{chunk-XUSALIEI.js → chunk-VRLKHL74.js} +6 -6
  131. package/dist/{chunk-XUSALIEI.js.map → chunk-VRLKHL74.js.map} +1 -1
  132. package/dist/{chunk-WSBKB4CJ.js → chunk-WI4T3KIS.js} +51 -16
  133. package/dist/chunk-WI4T3KIS.js.map +1 -0
  134. package/dist/{chunk-D3B36CYC.js → chunk-X3RMRJNR.js} +4 -3
  135. package/dist/chunk-X3RMRJNR.js.map +1 -0
  136. package/dist/{chunk-IER3KIPH.js → chunk-X6LKA3TJ.js} +5 -5
  137. package/dist/{chunk-IER3KIPH.js.map → chunk-X6LKA3TJ.js.map} +1 -1
  138. package/dist/{chunk-Y3HTGHJC.js → chunk-XMAJJPA4.js} +3 -3
  139. package/dist/{chunk-Y3HTGHJC.js.map → chunk-XMAJJPA4.js.map} +1 -1
  140. package/dist/{chunk-SBSA3IQA.js → chunk-XTVSNWLL.js} +19 -7
  141. package/dist/chunk-XTVSNWLL.js.map +1 -0
  142. package/dist/{chunk-MZG34MBZ.js → chunk-XZY6SBGU.js} +3 -3
  143. package/dist/{chunk-MZG34MBZ.js.map → chunk-XZY6SBGU.js.map} +1 -1
  144. package/dist/{chunk-6O2X3GPW.js → chunk-YQU2BPQD.js} +7 -5
  145. package/dist/chunk-YQU2BPQD.js.map +1 -0
  146. package/dist/cli/index.js +1077 -497
  147. package/dist/cli/index.js.map +1 -1
  148. package/dist/cli/src/agent-checks.d.ts +40 -0
  149. package/dist/cli/src/agent-checks.d.ts.map +1 -0
  150. package/dist/cli/src/asset-feeds.d.ts.map +1 -1
  151. package/dist/cli/src/commands/asset-cmd.d.ts.map +1 -1
  152. package/dist/cli/src/commands/catalog.d.ts +24 -0
  153. package/dist/cli/src/commands/catalog.d.ts.map +1 -1
  154. package/dist/cli/src/commands/config.d.ts.map +1 -1
  155. package/dist/cli/src/commands/diff.d.ts.map +1 -1
  156. package/dist/cli/src/commands/integration.d.ts.map +1 -1
  157. package/dist/cli/src/commands/library-cmd.d.ts.map +1 -1
  158. package/dist/cli/src/commands/library-publish.d.ts.map +1 -1
  159. package/dist/cli/src/commands/mcp-server.d.ts +1 -1
  160. package/dist/cli/src/commands/migrate-assets.d.ts +2 -1
  161. package/dist/cli/src/commands/migrate-assets.d.ts.map +1 -1
  162. package/dist/cli/src/commands/migrate.d.ts.map +1 -1
  163. package/dist/cli/src/commands/plugin/claude-code.d.ts +1 -1
  164. package/dist/cli/src/commands/plugin/claude-code.d.ts.map +1 -1
  165. package/dist/cli/src/commands/plugin/types.d.ts +1 -1
  166. package/dist/cli/src/commands/plugin-registry-cmd.d.ts.map +1 -1
  167. package/dist/cli/src/commands/project.d.ts.map +1 -1
  168. package/dist/cli/src/commands/publish-core.d.ts +5 -0
  169. package/dist/cli/src/commands/publish-core.d.ts.map +1 -1
  170. package/dist/cli/src/commands/run.d.ts +2 -1
  171. package/dist/cli/src/commands/run.d.ts.map +1 -1
  172. package/dist/cli/src/commands/serve-preflight.d.ts +22 -0
  173. package/dist/cli/src/commands/serve-preflight.d.ts.map +1 -0
  174. package/dist/cli/src/commands/serve.d.ts.map +1 -1
  175. package/dist/cli/src/commands/source-manifest-publish.d.ts.map +1 -1
  176. package/dist/cli/src/commands/source-manifest.d.ts.map +1 -1
  177. package/dist/cli/src/commands/source.d.ts.map +1 -1
  178. package/dist/cli/src/commands/store.d.ts.map +1 -1
  179. package/dist/cli/src/commands/tree.d.ts.map +1 -1
  180. package/dist/cli/src/commands/update.d.ts.map +1 -1
  181. package/dist/cli/src/commands/validate.d.ts.map +1 -1
  182. package/dist/cli/src/commands/why.d.ts.map +1 -1
  183. package/dist/cli/src/curated-manifests.d.ts +21 -0
  184. package/dist/cli/src/curated-manifests.d.ts.map +1 -0
  185. package/dist/cli/src/index-busy.d.ts +8 -0
  186. package/dist/cli/src/index-busy.d.ts.map +1 -0
  187. package/dist/cli/src/plugin-store/paths.d.ts +7 -3
  188. package/dist/cli/src/plugin-store/paths.d.ts.map +1 -1
  189. package/dist/cli/src/skill-checks.d.ts +15 -2
  190. package/dist/cli/src/skill-checks.d.ts.map +1 -1
  191. package/dist/cli/src/store-addable.d.ts +18 -0
  192. package/dist/cli/src/store-addable.d.ts.map +1 -0
  193. package/dist/connectors/config.js +5 -5
  194. package/dist/connectors/index.js +16 -16
  195. package/dist/{connectors-4QWAKPHB.js → connectors-UNKUKEPG.js} +19 -19
  196. package/dist/{connectors-4QWAKPHB.js.map → connectors-UNKUKEPG.js.map} +1 -1
  197. package/dist/core/index.js +7 -7
  198. package/dist/core/logging.js +1 -1
  199. package/dist/core/manifest.js +2 -2
  200. package/dist/core/models.js +1 -1
  201. package/dist/core/publish-manifest.js +2 -2
  202. package/dist/core/ref.js +1 -1
  203. package/dist/core/runtime-assets.js +5 -5
  204. package/dist/core/src/index.d.ts +5 -4
  205. package/dist/core/src/index.d.ts.map +1 -1
  206. package/dist/core/src/lock.d.ts +15 -5
  207. package/dist/core/src/lock.d.ts.map +1 -1
  208. package/dist/core/src/logging/sinks/sqlite-sink.d.ts.map +1 -1
  209. package/dist/core/src/manifest.d.ts +5 -0
  210. package/dist/core/src/manifest.d.ts.map +1 -1
  211. package/dist/core/src/models.d.ts +3 -3
  212. package/dist/core/src/package-manager.d.ts +19 -0
  213. package/dist/core/src/package-manager.d.ts.map +1 -0
  214. package/dist/core/src/publish-manifest.d.ts.map +1 -1
  215. package/dist/core/src/repo-manager.d.ts +11 -0
  216. package/dist/core/src/repo-manager.d.ts.map +1 -1
  217. package/dist/core/src/settings.d.ts +26 -6
  218. package/dist/core/src/settings.d.ts.map +1 -1
  219. package/dist/core/src/walker.d.ts +6 -1
  220. package/dist/core/src/walker.d.ts.map +1 -1
  221. package/dist/core/src/workspace-config.d.ts.map +1 -1
  222. package/dist/core/workspace-config.js +4 -4
  223. package/dist/deploy/index.js +7 -7
  224. package/dist/discovery/index.js +5 -5
  225. package/dist/{ensure-sources-2RONZKCU.js → ensure-sources-POMEQSTM.js} +19 -19
  226. package/dist/{ensure-sources-2RONZKCU.js.map → ensure-sources-POMEQSTM.js.map} +1 -1
  227. package/dist/factory-assets/connectors/box.js +16 -16
  228. package/dist/factory-assets/connectors/deploy.js +16 -16
  229. package/dist/factory-assets/connectors/devserver.js +16 -16
  230. package/dist/factory-assets/connectors/flow/adapter.js +16 -16
  231. package/dist/factory-assets/connectors/flow/contract/normalize.d.ts.map +1 -1
  232. package/dist/factory-assets/connectors/flow/contract.js +1 -1
  233. package/dist/factory-assets/connectors/flow/engine.js +9 -9
  234. package/dist/factory-assets/connectors/flow/run-flow.d.ts.map +1 -1
  235. package/dist/factory-assets/connectors/flow/run-flow.js +18 -18
  236. package/dist/factory-assets/connectors/flow.js +16 -16
  237. package/dist/factory-assets/connectors/git.js +16 -16
  238. package/dist/factory-assets/connectors/gmail.js +16 -16
  239. package/dist/factory-assets/connectors/googledrive.js +16 -16
  240. package/dist/factory-assets/connectors/local.js +16 -16
  241. package/dist/factory-assets/connectors/mattermost.js +16 -16
  242. package/dist/factory-assets/connectors/memory.js +16 -16
  243. package/dist/factory-assets/connectors/minio.js +16 -16
  244. package/dist/factory-assets/connectors/postgres.js +16 -16
  245. package/dist/factory-assets/connectors/s3.js +16 -16
  246. package/dist/factory-assets/connectors/sharepoint.js +16 -16
  247. package/dist/factory-assets/connectors/sqlite.js +16 -16
  248. package/dist/factory-assets/connectors/static-server.js +16 -16
  249. package/dist/factory-assets/connectors/tunnel.js +16 -16
  250. package/dist/factory-assets/connectors/webdav.js +16 -16
  251. package/dist/factory-assets/connectors/xstate-store.js +16 -16
  252. package/dist/factory-assets/connectors/xstate.js +16 -16
  253. package/dist/factory-assets/skills/authoring-skaile-assets/SKILL.md +10 -8
  254. package/dist/factory-assets/skills/authoring-skaile-manifests/SKILL.md +15 -11
  255. package/dist/factory-assets/skills/authoring-skaile-manifests/references/dependency-standard.md +12 -9
  256. package/dist/factory-assets/skills/skaile-author-asset/SKILL.md +2 -2
  257. package/dist/{flows-EQF2CH4U.js → flows-DVKMZKM4.js} +12 -12
  258. package/dist/{flows-EQF2CH4U.js.map → flows-DVKMZKM4.js.map} +1 -1
  259. package/dist/{helpers-CFK6YP6R.js → helpers-Y4OT7VIS.js} +19 -19
  260. package/dist/{helpers-CFK6YP6R.js.map → helpers-Y4OT7VIS.js.map} +1 -1
  261. package/dist/library/index.js +12 -12
  262. package/dist/library/install.js +4 -4
  263. package/dist/library/src/index.d.ts +2 -2
  264. package/dist/library/src/index.d.ts.map +1 -1
  265. package/dist/library/src/install/source-fetch-github.d.ts.map +1 -1
  266. package/dist/library/src/local/db.d.ts +2 -0
  267. package/dist/library/src/local/db.d.ts.map +1 -1
  268. package/dist/library/src/local/library-manager.d.ts +5 -0
  269. package/dist/library/src/local/library-manager.d.ts.map +1 -1
  270. package/dist/library/src/local/library.d.ts +5 -3
  271. package/dist/library/src/local/library.d.ts.map +1 -1
  272. package/dist/library/src/local/local-catalog-source.d.ts.map +1 -1
  273. package/dist/library/src/local/store-paths.d.ts +9 -0
  274. package/dist/library/src/local/store-paths.d.ts.map +1 -1
  275. package/dist/library/src/manifest-writer.d.ts.map +1 -1
  276. package/dist/library/src/remote/index.d.ts +1 -1
  277. package/dist/library/src/remote/index.d.ts.map +1 -1
  278. package/dist/library/src/remote/remote-catalog-source.d.ts +17 -0
  279. package/dist/library/src/remote/remote-catalog-source.d.ts.map +1 -1
  280. package/dist/library/src/sync/git-driver.d.ts.map +1 -1
  281. package/dist/{library-publish-53UTB3MB.js → library-publish-DI4Q5UOG.js} +45 -37
  282. package/dist/library-publish-DI4Q5UOG.js.map +1 -0
  283. package/dist/open-library-N6ESO6IK.js +40 -0
  284. package/dist/{open-library-BOSPJVID.js.map → open-library-N6ESO6IK.js.map} +1 -1
  285. package/dist/open-registry-CBZ5MWTT.js +32 -0
  286. package/dist/{open-registry-4FI7HKET.js.map → open-registry-CBZ5MWTT.js.map} +1 -1
  287. package/dist/paths-U6W6MQNQ.js +22 -0
  288. package/dist/{paths-SUS4S4YT.js.map → paths-U6W6MQNQ.js.map} +1 -1
  289. package/dist/{plugin-store-AGQDMING.js → plugin-store-XMZSPVBF.js} +48 -12
  290. package/dist/plugin-store-XMZSPVBF.js.map +1 -0
  291. package/dist/project-UP52HEHC.js +79 -0
  292. package/dist/{project-I55A4O2T.js.map → project-UP52HEHC.js.map} +1 -1
  293. package/dist/resolver/index.js +8 -8
  294. package/dist/runner/index.js +33 -33
  295. package/dist/runner/src/agent.d.ts.map +1 -1
  296. package/dist/runner/src/agents/in-process-host.d.ts.map +1 -1
  297. package/dist/runner/src/composition/index.d.ts +1 -0
  298. package/dist/runner/src/composition/index.d.ts.map +1 -1
  299. package/dist/runner/src/composition/prompt-sections.d.ts +7 -4
  300. package/dist/runner/src/composition/prompt-sections.d.ts.map +1 -1
  301. package/dist/runner/src/composition/resolve.d.ts +10 -1
  302. package/dist/runner/src/composition/resolve.d.ts.map +1 -1
  303. package/dist/runner/src/composition/verify.d.ts +29 -0
  304. package/dist/runner/src/composition/verify.d.ts.map +1 -0
  305. package/dist/runner/src/credential-notice.d.ts +14 -0
  306. package/dist/runner/src/credential-notice.d.ts.map +1 -0
  307. package/dist/runner/src/environment.d.ts.map +1 -1
  308. package/dist/runner/src/final-text.d.ts +17 -0
  309. package/dist/runner/src/final-text.d.ts.map +1 -0
  310. package/dist/runner/src/index.d.ts +2 -0
  311. package/dist/runner/src/index.d.ts.map +1 -1
  312. package/dist/runner/src/resource-handler.d.ts.map +1 -1
  313. package/dist/runner/src/serve.d.ts +13 -0
  314. package/dist/runner/src/serve.d.ts.map +1 -1
  315. package/dist/sdk/asset-manager.js +16 -16
  316. package/dist/sdk/bridge.js +12 -12
  317. package/dist/sdk/core.js +7 -7
  318. package/dist/sdk/flow.js +9 -9
  319. package/dist/sdk/index.js +36 -34
  320. package/dist/sdk/index.js.map +1 -1
  321. package/dist/sdk/resolver.js +8 -8
  322. package/dist/sdk/runner.js +33 -33
  323. package/dist/sdk/src/local-runtime.d.ts.map +1 -1
  324. package/dist/sdk/transport/ws/client.js +1 -1
  325. package/dist/sdk/transport/ws/server.js +1 -1
  326. package/dist/sdk/transport/ws.js +2 -2
  327. package/dist/sdk/transport.js +2 -2
  328. package/dist/serve-preflight-6P2JJEJ3.js +47 -0
  329. package/dist/serve-preflight-6P2JJEJ3.js.map +1 -0
  330. package/dist/{setup-7DQJKHUI.js → setup-5IRUH5OS.js} +24 -24
  331. package/dist/{setup-7DQJKHUI.js.map → setup-5IRUH5OS.js.map} +1 -1
  332. package/dist/{skills-NUEN5NDX.js → skills-HA36RFNM.js} +13 -13
  333. package/dist/{skills-NUEN5NDX.js.map → skills-HA36RFNM.js.map} +1 -1
  334. package/dist/source-DX5SGWEI.js +41 -0
  335. package/dist/{source-G2LV5LVD.js.map → source-DX5SGWEI.js.map} +1 -1
  336. package/dist/source-fetch-github-PIO6EMMF.js +4 -0
  337. package/dist/{source-fetch-github-QN4LLTL5.js.map → source-fetch-github-PIO6EMMF.js.map} +1 -1
  338. package/dist/{source-manifest-publish-6RM7SWLZ.js → source-manifest-publish-NMRLXWVW.js} +27 -26
  339. package/dist/source-manifest-publish-NMRLXWVW.js.map +1 -0
  340. package/dist/transport/index.js +2 -2
  341. package/dist/transport/src/ws/client.d.ts +6 -0
  342. package/dist/transport/src/ws/client.d.ts.map +1 -1
  343. package/dist/transport/src/ws/server.d.ts +4 -0
  344. package/dist/transport/src/ws/server.d.ts.map +1 -1
  345. package/dist/transport/ws/client.js +1 -1
  346. package/dist/transport/ws/server.js +1 -1
  347. package/dist/transport/ws.js +2 -2
  348. package/dist/tui/index.js +58 -41
  349. package/dist/tui/index.js.map +1 -1
  350. package/dist/tui/src/repl-session.d.ts +1 -1
  351. package/dist/tui/src/repl-session.d.ts.map +1 -1
  352. package/dist/tui/src/repl.d.ts +3 -0
  353. package/dist/tui/src/repl.d.ts.map +1 -1
  354. package/dist/types/manifests.js +1 -1
  355. package/dist/types/src/manifests/agent-composition.d.ts +20 -0
  356. package/dist/types/src/manifests/agent-composition.d.ts.map +1 -1
  357. package/dist/types/src/manifests/agent.d.ts.map +1 -1
  358. package/dist/types/src/manifests/cron.d.ts +15 -0
  359. package/dist/types/src/manifests/cron.d.ts.map +1 -0
  360. package/dist/types/src/manifests/index.d.ts +3 -2
  361. package/dist/types/src/manifests/index.d.ts.map +1 -1
  362. package/dist/workspace-plugin/adapters/mcp.js +23 -23
  363. package/dist/workspace-plugin/adapters/omp.js +106 -51
  364. package/dist/workspace-plugin/adapters/omp.js.map +1 -1
  365. package/dist/workspace-plugin/index.js +2 -2
  366. package/dist/workspace-plugin/src/adapters/claude-code.d.ts.map +1 -1
  367. package/dist/workspace-plugin/src/adapters/omp.d.ts +11 -2
  368. package/dist/workspace-plugin/src/adapters/omp.d.ts.map +1 -1
  369. package/package.json +1 -1
  370. package/dist/asset-feeds-CXGQIDFR.js.map +0 -1
  371. package/dist/chunk-2F5AWQX5.js.map +0 -1
  372. package/dist/chunk-3SM2DL2T.js.map +0 -1
  373. package/dist/chunk-47U4GZ4M.js.map +0 -1
  374. package/dist/chunk-5LKOAX7I.js.map +0 -1
  375. package/dist/chunk-6O2X3GPW.js.map +0 -1
  376. package/dist/chunk-ALEYHUC5.js.map +0 -1
  377. package/dist/chunk-CGYEHQOX.js.map +0 -1
  378. package/dist/chunk-CJERAGFY.js.map +0 -1
  379. package/dist/chunk-D3B36CYC.js.map +0 -1
  380. package/dist/chunk-DZMNFCWB.js.map +0 -1
  381. package/dist/chunk-FH7W6TJ4.js.map +0 -1
  382. package/dist/chunk-HZXUXHIV.js.map +0 -1
  383. package/dist/chunk-NWDSLXOX.js.map +0 -1
  384. package/dist/chunk-OBYKJB4U.js.map +0 -1
  385. package/dist/chunk-PBBPZYVG.js.map +0 -1
  386. package/dist/chunk-R7FOF242.js +0 -59
  387. package/dist/chunk-R7FOF242.js.map +0 -1
  388. package/dist/chunk-RYYLMBA2.js.map +0 -1
  389. package/dist/chunk-SBSA3IQA.js.map +0 -1
  390. package/dist/chunk-VLTQGE2E.js.map +0 -1
  391. package/dist/chunk-WSBKB4CJ.js.map +0 -1
  392. package/dist/chunk-YOH2L76X.js.map +0 -1
  393. package/dist/chunk-ZCAJZ4B2.js.map +0 -1
  394. package/dist/chunk-ZPWTOUTK.js.map +0 -1
  395. package/dist/library-publish-53UTB3MB.js.map +0 -1
  396. package/dist/open-library-BOSPJVID.js +0 -40
  397. package/dist/open-registry-4FI7HKET.js +0 -32
  398. package/dist/paths-SUS4S4YT.js +0 -22
  399. package/dist/plugin-store-AGQDMING.js.map +0 -1
  400. package/dist/project-I55A4O2T.js +0 -41
  401. package/dist/source-G2LV5LVD.js +0 -41
  402. package/dist/source-fetch-github-QN4LLTL5.js +0 -4
  403. package/dist/source-manifest-publish-6RM7SWLZ.js.map +0 -1
@@ -429,6 +429,23 @@ function resolveEntryCredential(entry, options = {}) {
429
429
  function entryCredentialValue(providerId, entry, options = {}) {
430
430
  return resolveEntryCredential(entry, options) ?? options.env?.[providerCredentialEnvName(providerId)];
431
431
  }
432
+ function unresolvedProviderCredentials(registry, options = {}) {
433
+ const out = [];
434
+ for (const [id, entry] of registryEntries(registry)) {
435
+ if (entry.kind !== "llm" && entry.kind !== "embed") continue;
436
+ if (!isEntryEnabled(entry)) continue;
437
+ if (options.providerId && id !== options.providerId) continue;
438
+ const resolved = resolveCredential(entry, {
439
+ ...options.env ? { env: options.env } : {},
440
+ ...options.secrets ? { secrets: options.secrets } : {},
441
+ ...options.allowCommand === void 0 ? {} : { allowCommand: options.allowCommand }
442
+ });
443
+ if (!resolved.error) continue;
444
+ if (options.env?.[providerCredentialEnvName(id)]) continue;
445
+ out.push({ providerId: id, reason: resolved.error });
446
+ }
447
+ return out;
448
+ }
432
449
  function entryCredentialEnv(providerId, entry, options = {}) {
433
450
  const value = resolveEntryCredential(entry, options);
434
451
  if (!value) return {};
@@ -912,6 +929,6 @@ async function listModelsForDriver(driverId, registry, options) {
912
929
  return await target.listModels?.(registry, options) ?? [];
913
930
  }
914
931
 
915
- export { AGENT_EFFORT_LEVELS, AI_PROVIDER_PRESETS, AgentDriver, BUILTIN_DRIVER_CATALOG, DRIVER_CATALOG, PROVIDER_CREDENTIAL_ENV_PREFIX, PROVIDER_CREDENTIAL_ENV_SUFFIX, TOOL_ALLOWLIST_UNSUPPORTED, buildCredentialHeaders, catalogLayer, conventionalCredentialEnvName, createDriver, driverCapabilities, entryCredentialEnv, entryCredentialValue, expandPreset, getBridgeLogger, getProviderPreset, listDrivers, listModelsForDriver, listProviderPresets, presetBaseUrl, probeProviderEntry, providerCredentialEnvName, registerBuiltinDrivers, registryCredentialEnv, registryDriverConfig, resolveEntryCredential, resolvePresetBaseUrl, resolveProbeUrl, supportsLiveToolUpdates, toAgentEffort, toMergedRegistry };
916
- //# sourceMappingURL=chunk-47U4GZ4M.js.map
917
- //# sourceMappingURL=chunk-47U4GZ4M.js.map
932
+ export { AGENT_EFFORT_LEVELS, AI_PROVIDER_PRESETS, AgentDriver, BUILTIN_DRIVER_CATALOG, DRIVER_CATALOG, PROVIDER_CREDENTIAL_ENV_PREFIX, PROVIDER_CREDENTIAL_ENV_SUFFIX, TOOL_ALLOWLIST_UNSUPPORTED, buildCredentialHeaders, catalogLayer, conventionalCredentialEnvName, createDriver, driverCapabilities, entryCredentialEnv, entryCredentialValue, expandPreset, getBridgeLogger, getProviderPreset, listDrivers, listModelsForDriver, listProviderPresets, presetBaseUrl, probeProviderEntry, providerCredentialEnvName, registerBuiltinDrivers, registryCredentialEnv, registryDriverConfig, resolveEntryCredential, resolvePresetBaseUrl, resolveProbeUrl, supportsLiveToolUpdates, toAgentEffort, toMergedRegistry, unresolvedProviderCredentials };
933
+ //# sourceMappingURL=chunk-MF54ZHWT.js.map
934
+ //# sourceMappingURL=chunk-MF54ZHWT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../bridge/src/driver-capabilities.ts","../bridge/src/logger.ts","../bridge/src/provider-catalog.ts","../bridge/src/provider-materialize/credential-env.ts","../bridge/src/provider-registry-derive.ts","../bridge/src/types.ts","../bridge/src/registry.ts"],"names":[],"mappings":";;;;;;;AAqBA,IAAM,2BAAA,GAAkD;AAAA,EACtD,mBAAA,EAAqB,KAAA;AAAA,EACrB,eAAA,EAAiB,IAAA;AAAA,EACjB,cAAA,EAAgB,KAAA;AAAA,EAChB,qBAA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AAA,EAAG;AACxD,IAAA,MAAA,CAAO,GAAA,CAAI,IAAA,CAAK,EAAA,EAAI,IAAI,CAAA;AAAA,EAC1B;AACA,EAAA,KAAA,MAAW,IAAA,IAAQ,cAAA,CAAe,IAAA,CAAK,QAAQ,CAAA,EAAG;AAChD,IAAA,IAAI,CAAC,MAAA,CAAO,GAAA,CAAI,IAAA,CAAK,EAAE,CAAA,EAAG;AAIxB,MAAA,MAAM,MAAA,GAAS,cAAA,CAAe,GAAA,CAAI,QAAA,EAAU,KAAK,EAAE,CAAA;AACnD,MAAA,MAAA,CAAO,GAAA,CAAI,KAAK,EAAA,EAAI;AAAA,QAClB,IAAI,IAAA,CAAK,EAAA;AAAA,QACT,MAAM,IAAA,CAAK,WAAA;AAAA,QACX,aAAA,EAAe,QAAQ,aAAA,IAAiB,KAAA;AAAA,QACxC,mBAAA,EAAqB,QAAQ,mBAAA,IAAuB,KAAA;AAAA;AAAA;AAAA;AAAA,QAIpD,GAAI,QAAQ,QAAA,GAAW,EAAE,UAAU,MAAA,CAAO,QAAA,KAAa,EAAC;AAAA,QACxD,GAAI,QAAQ,iBAAA,GAAoB,EAAE,mBAAmB,MAAA,CAAO,iBAAA,KAAsB,EAAC;AAAA,QACnF,GAAI,QAAQ,YAAA,GAAe,EAAE,cAAc,MAAA,CAAO,YAAA,KAAiB;AAAC,OACrE,CAAA;AAAA,IACH;AAAA,EACF;AACA,EAAA,OAAO,CAAC,GAAG,MAAA,CAAO,MAAA,EAAQ,CAAA;AAC5B;AAqBA,eAAsB,mBAAA,CACpB,QAAA,EACA,QAAA,EACA,OAAA,EACuB;AACvB,EAAA,MAAM,MAAA,GAAS,MAAM,mBAAA,CAAoB,QAAQ,CAAA;AACjD,EAAA,OAAQ,MAAM,MAAA,CAAO,UAAA,GAAa,QAAA,EAAU,OAAO,KAAM,EAAC;AAC5D","file":"chunk-MF54ZHWT.js","sourcesContent":["/**\n * What the runner may ask of a harness, by driver id.\n *\n * Deliberately light: this module imports no driver, no SDK and no `zod`, so a\n * runner file that only needs a capability can import it without loading the\n * driver graph. The plugin-registry singleton is read through its `internal`\n * module (the same file `@skaile/workspaces/plugin-registry` re-exports, so one\n * instance under the bundler's shared chunks), not through the package index,\n * which pulls in the deploy helpers and their `zod` schemas.\n *\n * @docLink packages/bridge/api-reference#registry\n */\n\nimport { pluginRegistry } from \"../../plugin-registry/src/internal.js\";\nimport type { DriverCapabilities } from \"@skaile/workspaces/types\";\n\n/**\n * Capabilities of a harness that declares none: it recomposes its tools per\n * turn like every bridge driver that is not an in-process SDK, and has no\n * managed session, credentials file or transcript-file resume.\n */\nconst GENERIC_DRIVER_CAPABILITIES: DriverCapabilities = {\n inProcessMcpServers: false,\n liveToolUpdates: true,\n managedSession: false,\n claudeCodeCredentials: false,\n resumeNeedsTranscript: false,\n};\n\n/**\n * Declared capabilities of the built-in harnesses that differ from nothing.\n * `BUILTIN_DRIVER_CATALOG` rows point at these entries, so `listDrivers()` and\n * {@link driverCapabilities} read one table. A built-in absent here (echo,\n * gemini, qwen, opencode, goose, continue) takes the generic defaults.\n */\nexport const BUILTIN_DRIVER_CAPABILITIES = {\n // Recomposes its tools per turn, so a hot-plugged MCP server is live.\n omp: {\n inProcessMcpServers: false,\n liveToolUpdates: true,\n managedSession: false,\n claudeCodeCredentials: false,\n resumeNeedsTranscript: false,\n },\n // The SDK takes in-process server instances and bakes its tool set at\n // creation; it reads Claude's `~/.claude` credentials and JSONL transcripts.\n \"claude-sdk\": {\n inProcessMcpServers: true,\n liveToolUpdates: false,\n managedSession: false,\n claudeCodeCredentials: true,\n resumeNeedsTranscript: true,\n },\n // Standalone SDK recomposes its tools per turn. A host-managed session\n // (native app-server) refreshes its own native tool snapshot instead.\n codex: {\n inProcessMcpServers: false,\n liveToolUpdates: true,\n managedSession: true,\n claudeCodeCredentials: false,\n resumeNeedsTranscript: false,\n },\n} as const satisfies Record<string, DriverCapabilities>;\n\n/**\n * Resolve what the runner may ask of a harness, by driver id, without loading\n * its module. Built-ins read {@link BUILTIN_DRIVER_CAPABILITIES}; a third-party\n * driver reads its registered `DriverTarget`; an unknown or absent id gets the\n * generic defaults. Fields a driver omits take the generic default too.\n *\n * This is the one place the runner learns driver facts — it never compares an\n * id against `\"claude-sdk\"`, `\"codex\"` or `\"omp\"`.\n *\n * @param id - Driver id (e.g. a session's `driverType`); `undefined` resolves to the defaults.\n * @docLink packages/bridge/api-reference#registry\n */\nexport function driverCapabilities(id: string | undefined): DriverCapabilities {\n const declared = id\n ? Object.hasOwn(BUILTIN_DRIVER_CAPABILITIES, id)\n ? BUILTIN_DRIVER_CAPABILITIES[id as keyof typeof BUILTIN_DRIVER_CAPABILITIES]\n : pluginRegistry.get(\"driver\", id)?.capabilities\n : undefined;\n return { ...GENERIC_DRIVER_CAPABILITIES, ...declared };\n}\n\n/**\n * Whether a hot-plugged MCP server reaches the agent's next turn without a\n * driver restart. A host-managed session refreshes its native tool snapshot\n * itself, so it never takes live updates, whatever the standalone driver does.\n *\n * @param id - Driver id of the live session.\n * @param managed - Whether the session is host-managed (`managedCodex`).\n * @docLink packages/bridge/api-reference#registry\n */\nexport function supportsLiveToolUpdates(id: string | undefined, managed = false): boolean {\n const caps = driverCapabilities(id);\n return caps.liveToolUpdates && !(managed && caps.managedSession);\n}\n","/**\n * Bridge-layer logger factory.\n *\n * Each driver creates its own Logger via `getBridgeLogger(subkind)` at\n * construction time. Falls back to an off-mode Logger (stdout only) when\n * no LogStore is registered — see @skaile/workspaces/core/logging for details.\n */\n\nimport { createLogger } from \"@skaile/workspaces/core/logging\";\nimport type { Logger } from \"@skaile/workspaces/types\";\n\n/**\n * Construct a bridge-scoped Logger for a given driver subkind.\n *\n * Creates a `Logger` with `kind: \"bridge\"` and the specified `subkind`. Falls back to\n * an off-mode Logger (stdout only) when no `LogStore` is registered — see\n * `@skaile/workspaces/core/logging` for details. Each driver calls this once at construction\n * time; never re-construct per call.\n *\n * @param subkind - Driver id, e.g. `\"claude-sdk\"`, `\"omp\"`, `\"echo\"`, `\"codex\"`.\n * @returns A `Logger` scoped to `bridge:<subkind>`.\n * @docLink packages/bridge/api-reference#logger\n */\nexport function getBridgeLogger(subkind: string): Logger {\n return createLogger({ kind: \"bridge\", subkind });\n}\n","/**\n * The AI provider catalog — the preset layer of the provider registry (§1.5,\n * layer 5).\n *\n * A preset is the three-or-four literals an endpoint needs beyond a credential:\n * its wire `surface`, its `base_url` (or the transport that derives one), the\n * header the credential rides in, and the path a read-only probe can GET. With\n * them, `skaile providers add --preset groq` needs nothing but an env var name.\n *\n * This replaced `provider-endpoints.ts` `PROVIDER_ENDPOINTS`: every endpoint\n * that table knew is present here, with the surface/transport/credential facts\n * it could not express.\n *\n * The record types come from `@skaile/workspaces/core/provider-registry` — the\n * schema has exactly one home.\n *\n * @see PROVIDER-CONFIG-PLAN.md §1.2, §1.3, §2.5\n */\n\nimport {\n AI_PROVIDER_BASE_URL_TEMPLATES,\n type AIProviderCredentialKind,\n type AIProviderDiscovery,\n type AIProviderEntry,\n type AIProviderKind,\n type AIProviderLlmEntry,\n type AIProviderRegistry,\n type AIProviderRegistryLayer,\n type AIProviderRegistryPatch,\n type AIProviderSurface,\n type AIProviderTransport,\n type AIProviderVoiceParams,\n resolveEntryBaseUrl,\n} from \"@skaile/workspaces/core/provider-registry\";\n\n/**\n * Where the credential goes on the wire. `{credential}` is replaced with the\n * resolved secret. Needed because `credential.kind` alone is ambiguous:\n * `api_key_header` is `x-api-key` for Anthropic, `x-goog-api-key` for Gemini,\n * `api-key` for Azure OpenAI and `Authorization: Token …` for Deepgram.\n */\nexport interface AIProviderAuthHeader {\n name: string;\n template: string;\n}\n\n/** A catalog preset — the fields an entry inherits by naming it. */\nexport interface AIProviderPreset {\n /** Preset id; also the default entry id `skaile providers add` writes. */\n id: string;\n kind: AIProviderKind;\n label: string;\n /** `llm`/`embed` only. */\n surface?: AIProviderSurface;\n /** `llm`/`embed` only; omitted means `direct`. */\n transport?: AIProviderTransport;\n /** Literal endpoint. Absent when the transport derives one from `params`. */\n base_url?: string;\n /**\n * Env var the vendor's own SDK reads as a base-URL override, when one\n * exists. Consulted by the callers that still address an endpoint by preset\n * id — model discovery, key validation, and `skaile migrate providers` — so\n * a shell already pointed at a gateway keeps pointing there.\n */\n base_url_env?: string;\n /** Static non-secret headers, e.g. Anthropic's `anthropic-version`. */\n headers?: Record<string, string>;\n /** Credential shape plus the conventional env var holding the secret. */\n credential: { kind: AIProviderCredentialKind; env?: string };\n /** Header the credential rides in; defaults per surface when omitted. */\n auth_header?: AIProviderAuthHeader;\n /** Default routing/voice parameters. */\n params?: Record<string, string>;\n /** `params` keys the operator must supply — the preset cannot know them. */\n required_params?: string[];\n /**\n * Read-only path a health probe GETs, relative to `base_url`: the models\n * list for LLM surfaces, an equivalent authenticated read for voice.\n * Absent when the endpoint has none (Bedrock's runtime host).\n */\n probe_path?: string;\n discovery?: AIProviderDiscovery;\n /** Anything the operator has to know that the fields do not say. */\n notes?: string;\n}\n\nconst ANTHROPIC_VERSION_HEADER: Record<string, string> = { \"anthropic-version\": \"2023-06-01\" };\n\nconst X_API_KEY: AIProviderAuthHeader = { name: \"x-api-key\", template: \"{credential}\" };\n\nconst OPENAI_MODELS_PATH = \"/v1/models\";\n\n/**\n * Every preset the runtime ships.\n *\n * Insertion order is display order in `skaile providers list`: first-party\n * clouds, then OpenAI-compatible vendors, then the transports that need\n * routing parameters, then local runtimes and gateways, then voice.\n *\n * Sources: `platform/_devlog/reports/2026-09-20-inference-provider-market-survey.md`\n * (36 endpoints, base URLs and auth headers verified there).\n */\nexport const AI_PROVIDER_PRESETS: Record<string, AIProviderPreset> = {\n anthropic: {\n id: \"anthropic\",\n kind: \"llm\",\n label: \"Anthropic\",\n surface: \"anthropic-messages\",\n base_url: \"https://api.anthropic.com\",\n base_url_env: \"ANTHROPIC_BASE_URL\",\n headers: ANTHROPIC_VERSION_HEADER,\n credential: { kind: \"api_key_header\", env: \"ANTHROPIC_API_KEY\" },\n auth_header: X_API_KEY,\n probe_path: \"/v1/models\",\n discovery: { type: \"anthropic-models-list\" },\n },\n openai: {\n id: \"openai\",\n kind: \"llm\",\n label: \"OpenAI\",\n surface: \"openai-responses\",\n base_url: \"https://api.openai.com/v1\",\n base_url_env: \"OPENAI_BASE_URL\",\n credential: { kind: \"bearer\", env: \"OPENAI_API_KEY\" },\n probe_path: OPENAI_MODELS_PATH,\n discovery: { type: \"openai-models-list\" },\n notes:\n \"Responses is OpenAI's current API; set surface openai-completions for chat-only clients.\",\n },\n google: {\n id: \"google\",\n kind: \"llm\",\n label: \"Google Gemini API\",\n surface: \"google-generative-ai\",\n base_url: \"https://generativelanguage.googleapis.com/v1beta\",\n credential: { kind: \"api_key_header\", env: \"GEMINI_API_KEY\" },\n auth_header: { name: \"x-goog-api-key\", template: \"{credential}\" },\n probe_path: \"/v1beta/models\",\n discovery: { type: \"google-models-list\" },\n },\n groq: {\n id: \"groq\",\n kind: \"llm\",\n label: \"Groq\",\n surface: \"openai-completions\",\n base_url: \"https://api.groq.com/openai/v1\",\n credential: { kind: \"bearer\", env: \"GROQ_API_KEY\" },\n probe_path: OPENAI_MODELS_PATH,\n discovery: { type: \"openai-models-list\" },\n },\n deepseek: {\n id: \"deepseek\",\n kind: \"llm\",\n label: \"DeepSeek\",\n surface: \"openai-completions\",\n base_url: \"https://api.deepseek.com\",\n credential: { kind: \"bearer\", env: \"DEEPSEEK_API_KEY\" },\n probe_path: \"/models\",\n discovery: { type: \"openai-models-list\" },\n notes:\n \"Anthropic-shaped clients use https://api.deepseek.com/anthropic with surface anthropic-messages.\",\n },\n openrouter: {\n id: \"openrouter\",\n kind: \"llm\",\n label: \"OpenRouter\",\n surface: \"openai-completions\",\n base_url: \"https://openrouter.ai/api/v1\",\n credential: { kind: \"bearer\", env: \"OPENROUTER_API_KEY\" },\n probe_path: OPENAI_MODELS_PATH,\n discovery: { type: \"openai-models-list\" },\n },\n mistral: {\n id: \"mistral\",\n kind: \"llm\",\n label: \"Mistral\",\n surface: \"openai-completions\",\n base_url: \"https://api.mistral.ai/v1\",\n credential: { kind: \"bearer\", env: \"MISTRAL_API_KEY\" },\n probe_path: OPENAI_MODELS_PATH,\n discovery: { type: \"openai-models-list\" },\n },\n xai: {\n id: \"xai\",\n kind: \"llm\",\n label: \"xAI (Grok)\",\n surface: \"openai-completions\",\n base_url: \"https://api.x.ai/v1\",\n credential: { kind: \"bearer\", env: \"XAI_API_KEY\" },\n probe_path: OPENAI_MODELS_PATH,\n discovery: { type: \"openai-models-list\" },\n },\n together: {\n id: \"together\",\n kind: \"llm\",\n label: \"Together AI\",\n surface: \"openai-completions\",\n base_url: \"https://api.together.ai/v1\",\n credential: { kind: \"bearer\", env: \"TOGETHER_API_KEY\" },\n probe_path: OPENAI_MODELS_PATH,\n discovery: { type: \"openai-models-list\" },\n },\n fireworks: {\n id: \"fireworks\",\n kind: \"llm\",\n label: \"Fireworks AI\",\n surface: \"openai-completions\",\n base_url: \"https://api.fireworks.ai/inference/v1\",\n credential: { kind: \"bearer\", env: \"FIREWORKS_API_KEY\" },\n probe_path: OPENAI_MODELS_PATH,\n discovery: { type: \"openai-models-list\" },\n },\n bedrock: {\n id: \"bedrock\",\n kind: \"llm\",\n label: \"AWS Bedrock\",\n surface: \"bedrock-converse-stream\",\n transport: \"bedrock\",\n credential: { kind: \"sigv4\" },\n required_params: [\"region\"],\n notes: \"Credentials come from the AWS default chain; the runtime host serves no models list.\",\n },\n vertex: {\n id: \"vertex\",\n kind: \"llm\",\n label: \"Google Vertex AI\",\n surface: \"google-vertex\",\n transport: \"vertex\",\n credential: { kind: \"google_adc\" },\n params: { publisher: \"google\" },\n required_params: [\"project\", \"location\"],\n probe_path: \"/models\",\n },\n \"azure-openai\": {\n id: \"azure-openai\",\n kind: \"llm\",\n label: \"Azure OpenAI\",\n surface: \"azure-openai-responses\",\n transport: \"azure-openai\",\n credential: { kind: \"api_key_header\", env: \"AZURE_OPENAI_API_KEY\" },\n auth_header: { name: \"api-key\", template: \"{credential}\" },\n required_params: [\"resource\", \"deployment\", \"api_version\"],\n probe_path: \"/models\",\n notes:\n \"api_version is mirrored into query_params['api-version']; switch credential.kind to azure_entra for Entra tokens.\",\n },\n foundry: {\n id: \"foundry\",\n kind: \"llm\",\n label: \"Claude on Microsoft Foundry\",\n surface: \"anthropic-messages\",\n transport: \"foundry\",\n headers: ANTHROPIC_VERSION_HEADER,\n credential: { kind: \"api_key_header\", env: \"ANTHROPIC_FOUNDRY_API_KEY\" },\n auth_header: X_API_KEY,\n required_params: [\"resource\"],\n probe_path: \"/v1/models\",\n },\n ollama: {\n id: \"ollama\",\n kind: \"llm\",\n label: \"Ollama (local)\",\n surface: \"openai-completions\",\n base_url: \"http://localhost:11434/v1\",\n credential: { kind: \"none\" },\n probe_path: OPENAI_MODELS_PATH,\n discovery: { type: \"openai-models-list\" },\n },\n lmstudio: {\n id: \"lmstudio\",\n kind: \"llm\",\n label: \"LM Studio (local)\",\n surface: \"openai-completions\",\n base_url: \"http://localhost:1234/v1\",\n credential: { kind: \"none\" },\n probe_path: OPENAI_MODELS_PATH,\n discovery: { type: \"openai-models-list\" },\n },\n vllm: {\n id: \"vllm\",\n kind: \"llm\",\n label: \"vLLM (self-hosted)\",\n surface: \"openai-completions\",\n base_url: \"http://localhost:8000/v1\",\n credential: { kind: \"none\" },\n probe_path: OPENAI_MODELS_PATH,\n discovery: { type: \"openai-models-list\" },\n notes: \"A server started with --api-key expects credential.kind bearer and an env: ref.\",\n },\n litellm: {\n id: \"litellm\",\n kind: \"llm\",\n label: \"LiteLLM proxy\",\n surface: \"openai-completions\",\n base_url: \"http://localhost:4000\",\n credential: { kind: \"bearer\", env: \"LITELLM_API_KEY\" },\n probe_path: OPENAI_MODELS_PATH,\n discovery: { type: \"openai-models-list\" },\n notes: \"The credential is the proxy's virtual key; upstream keys stay in the proxy config.\",\n },\n deepgram: {\n id: \"deepgram\",\n kind: \"stt\",\n label: \"Deepgram\",\n base_url: \"https://api.deepgram.com\",\n credential: { kind: \"api_key_header\", env: \"DEEPGRAM_API_KEY\" },\n auth_header: { name: \"Authorization\", template: \"Token {credential}\" },\n params: { model: \"nova-3\", language: \"en\" },\n probe_path: \"/v1/projects\",\n },\n elevenlabs: {\n id: \"elevenlabs\",\n kind: \"tts\",\n label: \"ElevenLabs\",\n base_url: \"https://api.elevenlabs.io\",\n credential: { kind: \"api_key_header\", env: \"ELEVENLABS_API_KEY\" },\n auth_header: { name: \"xi-api-key\", template: \"{credential}\" },\n params: { voice_id: \"21m00Tcm4TlvDq8ikWAM\", output_format: \"mp3_44100_128\" },\n probe_path: \"/v1/models\",\n },\n};\n\n/** Presets in catalog order. */\nexport function listProviderPresets(): AIProviderPreset[] {\n return Object.values(AI_PROVIDER_PRESETS);\n}\n\n/** Look up a preset by id. */\nexport function getProviderPreset(id: string): AIProviderPreset | undefined {\n return AI_PROVIDER_PRESETS[id];\n}\n\n/**\n * The endpoint `skaile providers list` shows for a preset: the literal when\n * there is one, otherwise the transport's `base_url` template (§1.3) with its\n * `{param}` placeholders left in — they are exactly what the operator must\n * supply.\n */\nexport function presetBaseUrl(preset: AIProviderPreset): string | undefined {\n if (preset.base_url) return preset.base_url;\n if (!preset.transport || preset.transport === \"direct\") return undefined;\n return AI_PROVIDER_BASE_URL_TEMPLATES[preset.transport];\n}\n\n/**\n * The endpoint a request to this preset should actually go to: an explicit\n * override first, then the vendor's own `*_BASE_URL` variable\n * ({@link AIProviderPreset.base_url_env}), then the preset literal.\n *\n * Behind a gateway the credential in play is the *gateway's*, not the\n * vendor's, so discovery and key validation have to follow dispatch — firing\n * either at the vendor's public API 401s and yields an empty catalog, which a\n * caller that reads \"empty\" as \"unknown\" then degrades into \"accept anything\".\n *\n * Pure: reads only the `env` record it is handed.\n */\nexport function resolvePresetBaseUrl(\n preset: AIProviderPreset,\n options: { baseUrl?: string; env?: Record<string, string | undefined> } = {},\n): string | undefined {\n const explicit = options.baseUrl?.trim();\n if (explicit) return explicit;\n const fromEnv = preset.base_url_env ? options.env?.[preset.base_url_env]?.trim() : undefined;\n return fromEnv || preset.base_url;\n}\n\n/** Overrides {@link expandPreset} accepts from `skaile providers add`. */\nexport interface ExpandPresetOptions {\n /** `env:NAME` / `cmd:…` / `platform:…` / `keyring:…`. Never a literal. */\n credentialRef?: string;\n baseUrl?: string;\n surface?: AIProviderSurface;\n label?: string;\n /** Transport routing parameters, or voice parameters for `stt`/`tts`. */\n params?: Record<string, string>;\n}\n\n/**\n * Materialize a preset into a registry entry.\n *\n * The credential is always a reference: the preset's conventional `env:` var\n * unless the caller names another ref. No code path here can write a secret.\n * For `transport: azure-openai` the `api_version` parameter is mirrored into\n * `query_params['api-version']`, which is where the wire expects it (§1.3).\n */\nexport function expandPreset(\n preset: AIProviderPreset,\n options: ExpandPresetOptions = {},\n): AIProviderEntry {\n const ref =\n options.credentialRef ?? (preset.credential.env ? `env:${preset.credential.env}` : undefined);\n const credential = ref ? { kind: preset.credential.kind, ref } : { kind: preset.credential.kind };\n const base_url = options.baseUrl ?? preset.base_url;\n const params = { ...preset.params, ...options.params };\n\n if (preset.kind === \"stt\" || preset.kind === \"tts\") {\n return {\n kind: preset.kind,\n label: options.label ?? preset.label,\n preset: preset.id,\n ...(base_url ? { base_url } : {}),\n ...(preset.headers ? { headers: { ...preset.headers } } : {}),\n credential,\n ...(Object.keys(params).length > 0 ? { params: params as AIProviderVoiceParams } : {}),\n };\n }\n\n const transport = preset.transport ?? \"direct\";\n const entry: AIProviderLlmEntry = {\n kind: preset.kind === \"embed\" ? \"embed\" : \"llm\",\n label: options.label ?? preset.label,\n preset: preset.id,\n ...((options.surface ?? preset.surface) ? { surface: options.surface ?? preset.surface } : {}),\n ...(base_url ? { base_url } : {}),\n ...(preset.headers ? { headers: { ...preset.headers } } : {}),\n credential,\n ...(preset.discovery ? { discovery: { ...preset.discovery } } : {}),\n } as AIProviderLlmEntry;\n\n if (transport !== \"direct\") {\n Object.assign(entry, { transport, params });\n if (transport === \"azure-openai\" && params.api_version) {\n entry.query_params = { \"api-version\": params.api_version };\n }\n }\n return entry;\n}\n\n/**\n * Build the catalog merge layer for a set of configured entries (§1.5).\n *\n * Only the presets actually referenced by a `preset:` key are expanded, keyed\n * by the *entry* id — so `groq: {kind: llm, preset: groq}` deep-merges onto a\n * full Groq definition while an unreferenced preset stays out of the registry.\n *\n * Takes the **pre-gate** merge (`LoadedProviderRegistry.patches`), not the\n * gated registry: an entry that leaves `kind` or its transport `params` to the\n * preset is exactly the one the gate drops before this layer exists, and a\n * dropped entry names no preset to expand.\n */\nexport function catalogLayer(providers: AIProviderRegistryPatch): AIProviderRegistryLayer {\n const expanded: AIProviderRegistry = {};\n for (const [id, entry] of Object.entries(providers)) {\n if (!entry.preset) continue;\n const preset = AI_PROVIDER_PRESETS[entry.preset];\n if (!preset) continue;\n expanded[id] = expandPreset(preset);\n }\n return { layer: \"catalog\", providers: expanded };\n}\n\n/**\n * Join a base URL and a path without duplicating a shared leading segment:\n * `(\"https://gw/v1\", \"/v1/models\")` → `https://gw/v1/models`. Both spellings\n * are common in the wild, and a preset's path must work against a gateway base\n * the operator typed either way.\n */\nfunction joinBaseAndPath(base: string, path: string): string {\n const trimmed = base.replace(/\\/+$/, \"\");\n const segments = path.split(\"/\").filter(Boolean);\n const lead = segments[0];\n if (lead && trimmed.toLowerCase().endsWith(`/${lead.toLowerCase()}`)) {\n return `${trimmed}/${segments.slice(1).join(\"/\")}`;\n }\n return `${trimmed}${path}`;\n}\n\n/**\n * The read-only URL a health probe or model discovery can GET for an entry —\n * the models list on LLM surfaces, the equivalent authenticated read on voice\n * ones. `undefined` when the entry has no endpoint yet (missing transport\n * parameters) or the surface serves no such path (Bedrock runtime).\n *\n * This is the catalog method that supersedes `resolveProviderModelsUrl`.\n */\nexport function resolveProbeUrl(entry: AIProviderEntry): string | undefined {\n const base = resolveEntryBaseUrl(entry);\n if (!base) return undefined;\n const preset = entry.preset ? AI_PROVIDER_PRESETS[entry.preset] : undefined;\n const path = (entry as AIProviderLlmEntry).discovery?.path ?? preset?.probe_path;\n if (!path) return undefined;\n const url = joinBaseAndPath(base, path);\n const query = (entry as AIProviderLlmEntry).query_params;\n if (!query || Object.keys(query).length === 0) return url;\n const search = new URLSearchParams(query).toString();\n return `${url}${url.includes(\"?\") ? \"&\" : \"?\"}${search}`;\n}\n\n/**\n * The header(s) that present a credential on the wire for an entry.\n *\n * `credential.kind` alone does not determine the header — `api_key_header` is\n * `x-api-key` at Anthropic, `x-goog-api-key` at Google and `api-key` at Azure —\n * so the preset's `auth_header` wins, then a per-surface default.\n * Returns `{}` when the credential is signed elsewhere (`sigv4`, `google_adc`)\n * or absent.\n */\nexport function buildCredentialHeaders(\n entry: AIProviderEntry,\n secret: string | undefined,\n): Record<string, string> {\n const kind = entry.credential?.kind ?? \"none\";\n if (!secret || kind === \"none\" || kind === \"sigv4\" || kind === \"google_adc\") return {};\n\n const preset = entry.preset ? AI_PROVIDER_PRESETS[entry.preset] : undefined;\n if (preset?.auth_header) {\n return {\n [preset.auth_header.name]: preset.auth_header.template.replace(\"{credential}\", secret),\n };\n }\n if (kind === \"api_key_header\") {\n const surface = (entry as AIProviderLlmEntry).surface;\n if (surface === \"google-generative-ai\") return { \"x-goog-api-key\": secret };\n if (surface === \"azure-openai-responses\") return { \"api-key\": secret };\n return { \"x-api-key\": secret };\n }\n return { Authorization: `Bearer ${secret}` };\n}\n\n/** Outcome of {@link probeProviderEntry}. Never carries the credential. */\nexport interface AIProviderProbeResult {\n /** The endpoint answered 2xx. */\n ok: boolean;\n /** `false` when no request was made — nothing was verified either way. */\n probed: boolean;\n url?: string;\n status?: number;\n /** Human-readable outcome. Secret-free. */\n detail: string;\n}\n\n/** Options for {@link probeProviderEntry}. */\nexport interface ProbeProviderOptions {\n /** Resolved credential value, if the entry has one. Never logged. */\n secret?: string;\n /** Request deadline; default 8000 ms, matching `validateApiKey`. */\n timeoutMs?: number;\n}\n\n/**\n * Send one minimal, read-only request to an entry's endpoint and report what\n * came back.\n *\n * Returns `probed: false` — rather than a false negative — when the entry has\n * no probe path (Bedrock's runtime host) or no resolvable endpoint yet: a\n * SigV4- or ADC-signed request is the transport SDK's job, not this function's.\n */\nexport async function probeProviderEntry(\n entry: AIProviderEntry,\n options: ProbeProviderOptions = {},\n): Promise<AIProviderProbeResult> {\n const url = resolveProbeUrl(entry);\n if (!url) {\n const base = resolveEntryBaseUrl(entry);\n return {\n ok: false,\n probed: false,\n detail: base\n ? `no read-only probe endpoint is defined for this entry (${base})`\n : \"no base_url could be resolved — set base_url or the transport's params\",\n };\n }\n\n const headers: Record<string, string> = {\n ...entry.headers,\n ...buildCredentialHeaders(entry, options.secret),\n };\n\n const controller = new AbortController();\n const timeout = setTimeout(() => controller.abort(), options.timeoutMs ?? 8000);\n try {\n const response = await fetch(url, { method: \"GET\", headers, signal: controller.signal });\n if (response.ok) {\n return { ok: true, probed: true, url, status: response.status, detail: \"endpoint reachable\" };\n }\n const detail =\n response.status === 401 || response.status === 403\n ? \"credential rejected (authentication failed)\"\n : `endpoint returned HTTP ${response.status}`;\n return { ok: false, probed: true, url, status: response.status, detail };\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n const detail =\n err instanceof Error && err.name === \"AbortError\"\n ? `request timed out after ${options.timeoutMs ?? 8000}ms`\n : message;\n return { ok: false, probed: true, url, detail };\n } finally {\n clearTimeout(timeout);\n }\n}\n","/**\n * Credential delivery for driver adapters — the one naming rule (§2.3).\n *\n * Every adapter that hands a registry entry's secret to a child process, and\n * every renderer that has to *name* that secret in a config file it writes\n * (omp's `models.yml` `apiKey:`, Codex's `env_key`, OpenCode's `{env:…}`),\n * agrees on one env-var name per entry: `SKAILE_AIP_<UPPER_ID>_KEY`. The name\n * goes in the file, the value goes in the child environment — a rendered\n * config never contains a secret.\n *\n * The platform's secret-env allowlist is a prefix rule on exactly that name,\n * and forge-common delivers the same names when it spawns `skaile serve`, so\n * the transform below is a cross-repo contract: uppercase, every character\n * outside `[A-Za-z0-9]` mapped to `_` (registry ids are `[a-z0-9][a-z0-9_-]*`,\n * so in practice only `-`).\n *\n * Alongside the canonical name, {@link registryCredentialEnv} also sets the\n * *conventional* carrier a CLI already reads (`ANTHROPIC_API_KEY`,\n * `GEMINI_API_KEY`, `GROQ_API_KEY`, …) so a catalog-preset entry works in a\n * harness that has no per-endpoint config file yet.\n *\n * @see PROVIDER-CONFIG-PLAN.md §1.4, §2.3\n */\n\nimport {\n type AIProviderEntry,\n type AIProviderRegistry,\n isEntryEnabled,\n type MergedAIProviderRegistry,\n parseCredentialRef,\n registryEntries,\n} from \"@skaile/workspaces/core/provider-registry\";\nimport { resolveCredential } from \"@skaile/workspaces/core/provider-registry-credentials\";\nimport { AI_PROVIDER_PRESETS } from \"../provider-catalog.js\";\n\n/** Options shared by every registry-shaped credential resolution. */\nexport interface RegistryCredentialOptions {\n /** Restrict resolution to one entry — the provider half of a `modelRef`. */\n providerId?: string;\n /** Environment `env:` refs resolve against. Defaults to `process.env`. */\n env?: Record<string, string | undefined>;\n /** Control-plane secrets keyed by config id, for `platform:` refs. */\n secrets?: Record<string, string>;\n /** Run `cmd:` references. Default `true`. */\n allowCommand?: boolean;\n}\n\n/** Prefix of the canonical per-entry credential variable. */\nexport const PROVIDER_CREDENTIAL_ENV_PREFIX = \"SKAILE_AIP_\";\n\n/** Suffix of the canonical per-entry credential variable. */\nexport const PROVIDER_CREDENTIAL_ENV_SUFFIX = \"_KEY\";\n\n/**\n * The env-var name that carries a registry entry's credential:\n * `anthropic` → `SKAILE_AIP_ANTHROPIC_KEY`, `my-gw.eu` → `SKAILE_AIP_MY_GW_EU_KEY`.\n *\n * Pure: no environment, no registry, no I/O. Renderers call it per entry while\n * emitting a config file, adapters call it while assembling a child env, and\n * the platform allowlist matches the prefix.\n */\nexport function providerCredentialEnvName(providerId: string): string {\n const slug = providerId.replace(/[^A-Za-z0-9]/g, \"_\").toUpperCase();\n return `${PROVIDER_CREDENTIAL_ENV_PREFIX}${slug}${PROVIDER_CREDENTIAL_ENV_SUFFIX}`;\n}\n\n/**\n * The env var a harness already looks for on its own, when the entry names one.\n *\n * The catalog preset's conventional carrier wins (`GEMINI_API_KEY` for\n * `google`), because that is the name the vendor's own CLI reads; otherwise an\n * `env:NAME` credential reference is taken at face value — the operator named\n * that variable, so the child gets it under the same name. `cmd:`, `platform:`\n * and `keyring:` refs have no conventional carrier and return `undefined`.\n */\nexport function conventionalCredentialEnvName(entry: AIProviderEntry): string | undefined {\n const preset = entry.preset ? AI_PROVIDER_PRESETS[entry.preset] : undefined;\n if (preset?.credential.env) return preset.credential.env;\n const ref = entry.credential?.ref ? parseCredentialRef(entry.credential.ref) : undefined;\n return ref?.form === \"env\" ? ref.name : undefined;\n}\n\n/**\n * Resolve one entry's credential to its value, or `undefined` when there is\n * none to hand over (`kind: none`, an ambient `sigv4`/`google_adc` chain, an\n * unset variable, a reserved `keyring:` ref).\n */\nexport function resolveEntryCredential(\n entry: AIProviderEntry,\n options: RegistryCredentialOptions = {},\n): string | undefined {\n return resolveCredential(entry, {\n ...(options.env ? { env: options.env } : {}),\n ...(options.secrets ? { secrets: options.secrets } : {}),\n ...(options.allowCommand === undefined ? {} : { allowCommand: options.allowCommand }),\n }).value;\n}\n\n/**\n * One entry's credential value, including the one the session boundary\n * already resolved for it.\n *\n * A `platform:<configId>` reference is resolved by the runner — it holds the\n * `session_init` secrets map, the driver does not — and materialized into the\n * child environment under {@link providerCredentialEnvName}. So when the\n * reference itself yields nothing, that carrier is consulted: it is the same\n * secret, delivered one step earlier.\n */\nexport function entryCredentialValue(\n providerId: string,\n entry: AIProviderEntry,\n options: RegistryCredentialOptions = {},\n): string | undefined {\n return (\n resolveEntryCredential(entry, options) ?? options.env?.[providerCredentialEnvName(providerId)]\n );\n}\n\n/** One enabled entry whose credential is declared but cannot be resolved. */\nexport interface UnresolvedProviderCredential {\n providerId: string;\n /** Why it does not resolve, e.g. `environment variable ANTHROPIC_API_KEY is not set`. */\n reason: string;\n}\n\n/**\n * The enabled LLM/embed entries that name a credential this process cannot\n * resolve (the variable is unset, the command fails). A driver must not be\n * handed such an entry: the child would send an empty key and fail with a 401\n * instead of using its own login. Entries with no credential, an ambient\n * signing chain, or a value the session boundary already delivered under\n * {@link providerCredentialEnvName} are fine.\n */\nexport function unresolvedProviderCredentials(\n registry: AIProviderRegistry | MergedAIProviderRegistry,\n options: RegistryCredentialOptions = {},\n): UnresolvedProviderCredential[] {\n const out: UnresolvedProviderCredential[] = [];\n for (const [id, entry] of registryEntries(registry)) {\n if (entry.kind !== \"llm\" && entry.kind !== \"embed\") continue;\n if (!isEntryEnabled(entry)) continue;\n if (options.providerId && id !== options.providerId) continue;\n const resolved = resolveCredential(entry, {\n ...(options.env ? { env: options.env } : {}),\n ...(options.secrets ? { secrets: options.secrets } : {}),\n ...(options.allowCommand === undefined ? {} : { allowCommand: options.allowCommand }),\n });\n if (!resolved.error) continue;\n if (options.env?.[providerCredentialEnvName(id)]) continue;\n out.push({ providerId: id, reason: resolved.error });\n }\n return out;\n}\n\n/** Options for {@link entryCredentialEnv} / {@link registryCredentialEnv}. */\nexport interface RegistryCredentialEnvOptions extends RegistryCredentialOptions {\n /**\n * Also set the harness-conventional carrier\n * ({@link conventionalCredentialEnvName}). Default `true`. Set `false` for a\n * harness that reads every endpoint out of a rendered config file and must\n * not inherit a vendor default from a neighbouring entry.\n */\n aliases?: boolean;\n}\n\n/**\n * The credential variables one entry contributes: always\n * `SKAILE_AIP_<ID>_KEY`, plus the conventional carrier unless `aliases` is\n * `false`. Empty when the entry has no resolvable secret.\n */\nexport function entryCredentialEnv(\n providerId: string,\n entry: AIProviderEntry,\n options: RegistryCredentialEnvOptions = {},\n): Record<string, string> {\n const value = resolveEntryCredential(entry, options);\n if (!value) return {};\n const out: Record<string, string> = { [providerCredentialEnvName(providerId)]: value };\n if (options.aliases !== false) {\n const alias = conventionalCredentialEnvName(entry);\n if (alias) out[alias] = value;\n }\n return out;\n}\n\n/**\n * Every enabled entry's credential, as a child-process environment fragment.\n *\n * One canonical `SKAILE_AIP_<ID>_KEY` per entry whose credential resolves; the\n * conventional carriers are added underneath, first entry in registry order\n * winning a collision (registry order is highest-precedence layer first, so\n * the alias follows the same precedence the selector does). Entries whose\n * credential cannot be resolved contribute nothing.\n */\nexport function registryCredentialEnv(\n registry: AIProviderRegistry | MergedAIProviderRegistry,\n options: RegistryCredentialEnvOptions = {},\n): Record<string, string> {\n const canonical: Record<string, string> = {};\n const aliases: Record<string, string> = {};\n for (const [id, entry] of registryEntries(registry)) {\n if (options.providerId && id !== options.providerId) continue;\n if (!isEntryEnabled(entry)) continue;\n const value = resolveEntryCredential(entry, options);\n if (!value) continue;\n canonical[providerCredentialEnvName(id)] = value;\n if (options.aliases === false) continue;\n const alias = conventionalCredentialEnvName(entry);\n if (alias && aliases[alias] === undefined) aliases[alias] = value;\n }\n return { ...aliases, ...canonical };\n}\n","/**\n * The two shaping helpers every registry consumer needs.\n *\n * The legacy provider axis — `provider` / `cloud` / `cloud_config` /\n * `cloudSecrets` — is gone from the runtime, and so is the user-local\n * `settings.json` `apiKeys{}` map: a session carries an AI provider registry\n * and a model selector, nothing else. Credentials are named by a\n * `credential.ref` and resolved into the child environment; no literal secret\n * ever enters an entry.\n */\n\nimport {\n type AIProviderLayerId,\n type AIProviderRegistry,\n type MergedAIProviderRegistry,\n mergeRegistries,\n} from \"@skaile/workspaces/core/provider-registry\";\nimport {\n type RegistryCredentialOptions,\n registryCredentialEnv,\n} from \"./provider-materialize/credential-env.js\";\n\n/** Turn any registry shape into the merged view, without re-merging one. */\nexport function toMergedRegistry(\n registry: AIProviderRegistry | MergedAIProviderRegistry,\n layer: AIProviderLayerId = \"session\",\n): MergedAIProviderRegistry {\n if (Array.isArray((registry as MergedAIProviderRegistry).order)) {\n return registry as MergedAIProviderRegistry;\n }\n return mergeRegistries([{ layer, providers: registry as AIProviderRegistry }]);\n}\n\n/**\n * The `AgentConfig` slice a `DriverTarget.listModels` closure builds its\n * throwaway driver from: the registry, the selector when the caller named one\n * entry, and the credentials as a child-environment fragment.\n *\n * The credentials have to ride `env`, not a side channel: a `platform:` or\n * `cmd:` reference resolves where the *caller* stands, and this process's own\n * environment cannot see it. `registryCredentialEnv` writes each one under\n * `SKAILE_AIP_<ID>_KEY`, which is the carrier every driver already consults.\n */\nexport function registryDriverConfig(\n registry: AIProviderRegistry | MergedAIProviderRegistry,\n options: RegistryCredentialOptions = {},\n): { registry: MergedAIProviderRegistry; env: Record<string, string>; modelRef?: string } {\n const merged = toMergedRegistry(registry, \"runtime\");\n return {\n registry: merged,\n env: registryCredentialEnv(merged, options),\n ...(options.providerId ? { modelRef: options.providerId } : {}),\n };\n}\n","import { EventEmitter } from \"node:events\";\nimport type { Span, TelemetryProvider, Trace } from \"@skaile/workspaces/telemetry\";\nimport type {\n AgentPromptInput,\n Capability,\n CredentialMint,\n CodexCredentialDelivery,\n ContextUsageDetail,\n DriverContextReport,\n DriverInfo,\n ErrorRetryReason,\n CodexSubscriptionRefreshInput,\n CodexSubscriptionRefreshResult,\n FlowExecution,\n ModelTokenUsage,\n RenderInvokedEvent,\n TokenUsage,\n} from \"@skaile/workspaces/types\";\nimport type { CodexServerRequestHandlers } from \"./codex-app-server.js\";\nexport type { AgentPromptInput } from \"@skaile/workspaces/types\";\nimport type { MergedAIProviderRegistry } from \"@skaile/workspaces/core/provider-registry\";\nimport type { ModelEntry } from \"./models.js\";\n\n/**\n * Test-only hook injected by the runner so a no-LLM driver (the echo driver's\n * scripted-flow mode) can read flow state and drive flow-adapter mutations\n * without an SDK/MCP round-trip. The runner wires this in `createActiveFlow`\n * from the active FlowAdapter + handle.\n *\n * This is an internal runner↔driver interface — NOT part of any wire\n * protocol or flow contract. Production drivers ignore it.\n *\n * @see packages/bridge/drivers/echo — scripted-flow mode\n * @since 3.6.0\n */\nexport interface FlowTestDriverHook {\n /** Current flow execution snapshot, or `null` when no flow is active. */\n getState(): FlowExecution | null;\n /**\n * Execute a flow-adapter operation (`start_node`, `request_approval`,\n * `complete_node`, `request_input`, `skip_node`, `fail_node`, …). Returns\n * the adapter's JSON string result (or rejects on an illegal transition).\n */\n execute(op: string, args: Record<string, unknown>): Promise<string>;\n /**\n * Node IDs marked as mandatory approval gates. The scripted policy resolves\n * `auto` to `request_approval` for these even in autonomous mode, so hosts\n * can drive a mandatory gate deterministically. Optional — absent hooks\n * behave as if no node is mandatory.\n */\n mandatoryGates?(): string[];\n}\n\n/**\n * Minimal LLM tool descriptor used by the capability dispatch path. Mirrors\n * the runner's `LLMTool` shape so drivers can consume registry output without\n * importing `@skaile/workspaces/runner` (which would create a circular dep).\n *\n * @category Capabilities\n * @since 2.0.0\n * @docLink packages/bridge/concepts#bridge-capability-tool\n */\nexport interface BridgeCapabilityTool {\n /** Capability name; used as the LLM-visible tool name. */\n name: string;\n /** Human/LLM-readable description. */\n description: string;\n /** JSON Schema for the tool's input parameters. */\n parameters: Record<string, unknown>;\n}\n\n/**\n * Render-cap event emission callback used by the bridge when the LLM invokes\n * a capability that carries a `render` spec. The runner provides the actual\n * sink (transport.send / sendEvent); the bridge only emits.\n *\n * @category Capabilities\n * @since 2.0.0\n * @docLink packages/bridge/concepts#bridge-render-emit\n */\nexport type BridgeRenderEmit = (event: RenderInvokedEvent) => void;\n\n/**\n * Text-event emission callback for render-capability fallbacks. When a\n * `RenderCapability` carries `render.fallback` and the LLM invokes it, the\n * bridge substitutes `{{prop}}` placeholders (top-level keys of `props`,\n * optional dotted-path traversal `{{user.name}}`) and pushes the rendered\n * string through this callback so clients without a render layer still see\n * a textual representation. No-op when `fallback` is absent.\n *\n * @category Capabilities\n * @since 2.0.0\n * @docLink packages/bridge/concepts#bridge-text-emit\n */\nexport type BridgeTextEmit = (text: string) => void;\n\n/**\n * Bundle of capability dispatch hooks. Registered into the driver via\n * `AgentConfig.capabilities`; the driver routes registered LLM tool calls\n * back into `invoke()` instead of using its native dispatch path.\n *\n * The runner constructs this from a `CapabilityRegistry` instance and threads\n * it through `createAgentSession()`. Drivers that don't yet implement\n * capability dispatch ignore the field — legacy v1 paths stay intact.\n *\n * @category Capabilities\n * @since 2.0.0\n * @docLink packages/bridge/concepts#bridge-capability-hooks\n */\nexport interface BridgeCapabilityHooks {\n /** Build the LLM tool descriptor list from the registry. Called per turn so registration changes take effect. */\n composeTools(): BridgeCapabilityTool[];\n /** Resolve a wire-format Capability descriptor by name. Used by the bridge to inspect `fireAndForget` / `render`. */\n resolve(name: string): Capability | null;\n /**\n * Validate input + dispatch through the registry. Logging is wired by the\n * registry.\n *\n * `callId` is the per-dispatch id minted by `dispatchCapability`. It MUST be\n * unique per process (never a driver/provider tool-call id, which only the\n * model backend keeps unique): it is the `render_invoked.callId`, the\n * registry's log correlation id, the handler's `ctx.callId` and — for client\n * capabilities — the `capability_invoked.callId` keying the runner's pending\n * map, so a reused id would let a late `capability_result` for a timed-out\n * call resolve a later call. Callers without one omit it and the registry\n * generates a fresh id.\n */\n invoke(name: string, input: unknown, signal?: AbortSignal, callId?: string): Promise<unknown>;\n /** Subscribe to registry changes; callback carries no credentials or tool payloads. */\n onToolsChanged?(listener: () => void): () => void;\n /** Emit a render-invoked event. The runner forwards via the WebSocket transport. */\n emitRender?: BridgeRenderEmit;\n /** Emit a text fallback for render capabilities with `render.fallback`. */\n emitText?: BridgeTextEmit;\n /** Session id passed through to the runner's per-handler logger. */\n sessionId: string;\n}\n\n/**\n * Static metadata for a registered agent driver (the harness it drives).\n *\n * Declared once in `@skaile/workspaces/types` — it is protocol surface (the\n * platform reads `surfaces` to decide which AI provider registry entries a\n * driver can serve) and was previously duplicated here field-for-field.\n *\n * Returned by {@link listDrivers} and exposed on every {@link AgentDriver}\n * instance via `driverInfo`.\n *\n * @docLink packages/bridge/concepts#driver-info\n */\nexport type { DriverInfo };\n\n/** Closed, passive managed-MCP observations. Counts saturate at 512. */\nexport interface CodexNativeMcpDiagnostics {\n startupBeforeTurn: \"unknown\" | \"starting\" | \"ready\" | \"failed\" | \"cancelled\";\n startupAtEnd: CodexNativeMcpDiagnostics[\"startupBeforeTurn\"];\n toolsListBeforeTurn: number;\n toolsListTotal: number;\n toolsCallTotal: number;\n nativeMcpToolItemCount: number;\n}\n\n/** Trusted session-local tool transport; fulfilled only after required tools are ready. */\nexport interface CodexToolTransport {\n mcpServers: Record<string, Record<string, unknown>>;\n /** Trusted runner server eligible for human native consent; must name its configured entry. */\n approvalServerName?: string;\n onServerRequest?: CodexServerRequestHandlers;\n /** Revalidate the required live inventory before starting each turn. */\n validate?(): Promise<void>;\n /** Rebuild the native generation at idle when its advertised inventory is stale. */\n needsReload?(): boolean;\n instructions?: string;\n /** Restrict model calls to the active turn and abort outstanding calls when it ends. */\n beginTurn?(signal: AbortSignal): void;\n /** Trusted private server binding and passive request-handler counters; never performs I/O. */\n diagnostics?: {\n serverName: string;\n requestCounts(): { toolsListTotal: number; toolsCallTotal: number };\n };\n dispose(): Promise<void>;\n}\n\n/** Explicit managed instance inputs; none are inferred from ambient developer state. */\nexport interface CodexManagedRuntimeOptions {\n executable: string;\n /** Optional launcher arguments, for the caller-owned executable wrapper. */\n executableArgs?: string[];\n /** Private local filesystem state; the host must fence old native processes before reuse. */\n privateDirectory: string;\n /** Host-owned private mount containing every parent/child instance; denied to native tools. */\n privateRoot: string;\n environment: Record<string, string>;\n credential: CodexCredentialDelivery;\n instructionFiles?: string[];\n skillsDirectory?: string;\n prepareTools(signal: AbortSignal): Promise<CodexToolTransport>;\n /**\n * Passive snapshots before/after turns, plus final local counts after successful transport closure.\n * No final snapshot is emitted on uncertain cleanup or a failed final counter read. Earlier snapshots\n * are not proof of completed cleanup. Sink failures never affect native execution or cleanup.\n */\n onNativeMcpDiagnostics?(value: Readonly<CodexNativeMcpDiagnostics>): void | Promise<void>;\n refreshCredential?: (\n input: CodexSubscriptionRefreshInput,\n signal: AbortSignal,\n ) => Promise<CodexSubscriptionRefreshResult>;\n requestTimeoutMs?: number;\n turnTimeoutMs?: number;\n /** Maximum native turns admitted by this instance; reserved for disposable one-turn children. */\n nativeTurnBudget?: 1;\n /** Human interaction deadline, bounded separately from ordinary RPCs. */\n interactionTimeoutMs?: number;\n}\n\n/**\n * Codex-specific tuning options passed through `DriverOptions.codex`.\n *\n * @remarks These are forwarded verbatim to the Codex driver and have no effect on other drivers.\n * @docLink packages/bridge/concepts#codex-driver-options\n */\nexport interface CodexDriverOptions {\n /** Omission retains the standalone SDK path; managed mode always requires App Server inputs. */\n authSource?: \"local\" | \"managed\";\n managedRuntime?: CodexManagedRuntimeOptions;\n /** Controls whether Codex may auto-apply edits without user approval. */\n approvalPolicy?: \"never\" | \"on-request\" | \"on-failure\" | \"untrusted\";\n /** Filesystem sandbox level for the Codex process. */\n sandboxMode?: \"read-only\" | \"workspace-write\" | \"danger-full-access\";\n /** Reasoning budget passed to the model. */\n reasoningEffort?: \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\";\n /** When `true`, the Codex sandbox is allowed to make outbound network requests. */\n networkAccessEnabled?: boolean;\n /** Extra directories made accessible to the Codex sandbox in addition to `cwd`. */\n additionalDirectories?: string[];\n}\n\n/**\n * omp-specific options passed through `DriverOptions.omp`.\n *\n * They govern the session-private agent directory the omp adapter renders the\n * provider registry into (`omp-models-yml.ts`); every one of them has a\n * working default, so a caller that sets none still gets a correct session.\n *\n * @remarks Forwarded verbatim to the omp driver; no effect on other drivers.\n * @see PROVIDER-CONFIG-PLAN.md §2.3\n */\nexport interface OmpDriverOptions {\n /**\n * Explicit session-private agent directory for `PI_CODING_AGENT_DIR`.\n * Defaults to `<cwd>/.omp/agent-home/<sessionId>`.\n */\n agentHome?: string;\n /**\n * Inherit the developer's own omp state (auth store, blobs, extensions) by\n * symlinking {@link OmpDriverOptions.userAgentDir} into the session\n * directory. Defaults to *on when that directory exists*, which is exactly\n * the standalone case: a platform container has none, so its session starts\n * empty. Set `false` to force an empty session directory regardless.\n */\n seedUserAgentDir?: boolean;\n /** Seed source. Defaults to `~/.omp/agent`. */\n userAgentDir?: string;\n}\n\n/**\n * Driver-specific configuration bag.\n *\n * Fields are keyed by driver ID so that callers can pass driver-specific options\n * through the common {@link AgentConfig} without breaking other drivers.\n *\n * @docLink packages/bridge/concepts#driver-options\n */\nexport interface DriverOptions {\n /** Codex-specific options. Ignored by all other drivers. */\n codex?: CodexDriverOptions;\n /** omp-specific options. Ignored by all other drivers. */\n omp?: OmpDriverOptions;\n}\n\n/**\n * What the driver tells the host about a turn blocked by an upstream usage\n * limit. Everything but `configId` is best-effort: the SDK reports the limit\n * window only on its structured telemetry, not on the error result text.\n *\n * @see AgentConfig.onLimitBlocked\n * @category Configuration\n * @since 3.9.0\n */\nexport interface LimitBlockedContext {\n /** The AI provider config the blocked turn ran on (`\"\"` when unmediated). */\n configId: string;\n /** Upstream limit window (`five_hour`, `seven_day`, …) when reported. */\n limitType?: string;\n /** Epoch seconds at which the limit window resets, when reported. */\n resetsAt?: number;\n /** Fraction of the limit window consumed (0–1) when reported. */\n utilization?: number;\n}\n\n/**\n * The host's verdict on a limit-blocked turn. `switched: true` is a promise\n * that a different seat's credential is already on disk — the driver acts on it\n * by respawning the CLI and replaying the prompt, so returning it without\n * having rewritten the credential file would just replay onto the dead seat.\n *\n * @see AgentConfig.onLimitBlocked\n * @category Configuration\n * @since 3.9.0\n */\nexport interface LimitFailoverResult {\n /** Whether the session was repointed at a different AI provider config. */\n switched: boolean;\n /** The config id now in effect. Informational — used for logs. */\n configId?: string;\n /**\n * Why no switch happened: `same-config`, `standalone`,\n * `platform-omitted-config-id` (the mint succeeded but named no seat, so a\n * re-resolution is indistinguishable from none), or a `CredentialMint`\n * failure code. Diagnostic only — the driver branches on `switched`.\n */\n reason?: string;\n}\n\n/**\n * One observed AI-provider rejection, reported to the host for per-seat health\n * attribution. Fire-and-forget — see {@link AgentConfig.onProviderResponse}.\n *\n * @category Configuration\n * @since 3.9.0\n */\nexport interface ProviderResponseObservation {\n /** 401 — the credential was rejected. 429 — an upstream rate/session limit. */\n status: 401 | 429;\n /** The AI provider config the observation is attributed to, when known. */\n configId?: string;\n /** Upstream limit window (`five_hour`, `seven_day`, …) when reported. */\n limitType?: string;\n /** Fraction of the limit window consumed (0–1) when reported. */\n utilization?: number;\n /** Epoch seconds at which the limit window resets, when reported. */\n resetsAt?: number;\n /**\n * What the 429 was, when the driver recognised something narrower than a\n * usage limit. `long-context-entitlement`: the account may not use a long\n * (1M) context window; the seat is not out of quota. Diagnostic only — the\n * driver still treats the rejection as before.\n */\n cause?: ProviderResponseCause;\n}\n\n/**\n * Why a 429 {@link ProviderResponseObservation} was rejected, when the driver\n * recognised it. Consumers must tolerate values they do not know.\n *\n * @category Configuration\n * @since 4.11.0\n */\nexport type ProviderResponseCause = \"long-context-entitlement\";\n\n/**\n * One upstream quota-window reading, reported to the host for every SDK\n * `rate_limit_event` — allowed, warning or rejected alike. Fire-and-forget —\n * see {@link AgentConfig.onProviderQuota}.\n *\n * @category Configuration\n * @since 4.1.0\n */\nexport interface ProviderQuotaObservation {\n /** The AI provider config the reading is attributed to, when known. */\n configId?: string;\n /** Upstream window, verbatim (`five_hour`, `seven_day`, or a future value). */\n window: string;\n /** Upstream status, verbatim (`allowed`, `allowed_warning`, `rejected`, …). */\n status: string;\n /** Fraction of the window consumed (0–1); the SDK reports it on warnings and rejections only. */\n utilization?: number;\n /** Epoch seconds at which the window resets, when reported. */\n resetsAt?: number;\n}\n\n/**\n * Reasoning effort levels a host may set. The platform sends all five, the\n * Agent SDK accepts all five, omp has a same-named thinking level for each, and\n * managed codex passes the value to its app server.\n *\n * @since 4.22.0\n */\nexport const AGENT_EFFORT_LEVELS = [\"low\", \"medium\", \"high\", \"xhigh\", \"max\"] as const;\nexport type AgentEffort = (typeof AGENT_EFFORT_LEVELS)[number];\n\n/**\n * Narrow a free-form effort (the wire `agentConfig.effort`, a `skaile.yaml`\n * default) to an {@link AgentEffort}; anything else gives `undefined`, so an\n * unknown value never reaches a driver.\n */\nexport function toAgentEffort(value: unknown): AgentEffort | undefined {\n return isAgentEffort(value) ? value : undefined;\n}\n\nfunction isAgentEffort(value: unknown): value is AgentEffort {\n return (AGENT_EFFORT_LEVELS as readonly unknown[]).includes(value);\n}\n\n/**\n * Configuration passed to a driver when it is created via {@link createDriver}.\n *\n * All fields are shared across drivers; driver-specific behaviour is documented\n * per field. Fields that are silently ignored by a driver are marked accordingly.\n *\n * @docLink packages/bridge/concepts#agent-config\n */\nexport interface AgentConfig {\n /** Absolute path to the working directory the agent operates in. */\n cwd: string;\n /**\n * LLM model identifier (e.g. `\"claude-sonnet-4-5\"`, `\"gpt-4o\"`).\n *\n * The unscoped fallback: {@link AgentConfig.modelRef} is what a session\n * normally carries, and this is what a driver falls back to when no\n * registry entry resolved one.\n */\n model?: string;\n /**\n * The AI provider registry for this session — every endpoint the driver may\n * address, already merged across the catalog / user / workspace / runtime /\n * control-plane layers and in registry order.\n *\n * This is the *only* provider surface a driver reads. Entries reference\n * their credential (`credential.ref`) and never carry the secret itself;\n * the value reaches the child under `SKAILE_AIP_<ID>_KEY`\n * (`provider-materialize/credential-env.ts`), which the session boundary\n * puts in {@link AgentConfig.env}.\n *\n * Absent (or empty) means no endpoint was configured at all — the driver\n * then falls back to whatever native auth it can discover on its own (a\n * `claude` OAuth login, `codex login`, an ambient vendor key).\n */\n registry?: MergedAIProviderRegistry;\n /**\n * Model selector resolved against {@link AgentConfig.registry}:\n * `\"<providerId>/<modelId>\"`, a bare `\"<modelId>\"` (first registry entry\n * that maps it wins), or `\"@role\"`. Absent when no model was configured at\n * all — the driver then applies its own default, exactly as it does for an\n * absent `model`.\n */\n modelRef?: string;\n /**\n * The `skaile.yaml` `roles` table — role name → model selector\n * (`{default: \"anthropic/opus\", smol: \"groq/llama-3.1-8b\"}`, §9.8). It is\n * what `\"@role\"` in {@link AgentConfig.modelRef} expands through, and what\n * a driver that supports per-role models materializes natively: omp renders\n * it as `modelRoles` in its session-private `config.yml`, so `@smol` inside\n * the session reaches a different provider than `@default`.\n *\n * Resolution is lenient: a role naming an entry this registry does not have\n * is a warning, never a failure.\n */\n roles?: Record<string, string>;\n /**\n * Additional environment variables merged into the child process\n * environment. The session boundary delivers resolved registry credentials\n * here as `SKAILE_AIP_<ID>_KEY` entries; anything else the caller sets is\n * merged over the driver's own allowlist, never instead of it.\n */\n env?: Record<string, string>;\n /** Inline system prompt — written to .omp/system.md and passed via --append-system-prompt (omp driver) */\n systemPrompt?: string;\n /** Path to project .omp/ directory (PI_CODING_AGENT_DIR for omp driver) */\n agentDir?: string;\n /** SSH key path — injected as GIT_SSH_COMMAND */\n sshKeyPath?: string;\n /** Pre-assign a UUID as the session ID for a new session (claude-sdk: passed as sessionId option) */\n sessionId?: string;\n /** Resume this specific past session by UUID instead of starting fresh (claude-sdk: passed as resume option) */\n resumeSessionId?: string;\n /** Maximum agentic turns per query (claude-sdk: passed as maxTurns option) */\n maxTurns?: number;\n /** Agent name — selects a deployed sub-agent definition as the main agent identity.\n * claude-sdk: passed as `agent` option to query() → reads .claude/agents/<name>.md natively.\n * omp: ignored (omp uses agentDir/PI_CODING_AGENT_DIR instead). */\n agentName?: string;\n /** In-process SDK MCP servers for custom tool injection (Claude SDK only, ignored by other drivers) */\n mcpServers?: Record<string, unknown>;\n /** Tool restrictions from agent.yaml — applied to the main agent session */\n tools?: {\n /** Tool names that the agent is allowed to invoke. An empty array means no restriction. */\n allowed?: string[];\n /** Tool names that the agent is explicitly forbidden from invoking. */\n denied?: string[];\n };\n /** Thinking mode for Claude models: adaptive (Claude decides), enabled (always think), disabled (no thinking). */\n thinking?: \"adaptive\" | \"enabled\" | \"disabled\";\n /** Reasoning effort level; each driver maps it to its own scale (see {@link AgentEffort}). */\n effort?: AgentEffort;\n /** Driver-specific configuration bag. */\n driverOptions?: DriverOptions;\n /**\n * Protocol v2 capability dispatch hooks. When present, the driver uses the\n * registry as the source of LLM tool definitions and routes invocations\n * through `capabilities.invoke()`. Absent → legacy v1 path (existing\n * mcpServers / native dispatch).\n *\n * @since 2.0.0\n */\n capabilities?: BridgeCapabilityHooks;\n /**\n * The platform's `AIProviderConfig.id` for the AI credential currently\n * provisioned into this driver. The runner reads this off `AgentConfig`\n * during 401 mediation and passes it as `configId` in\n * `request_access_token { kind: 'ai-credentials' }`. The driver itself\n * does not consume this field — only the runner uses it.\n *\n * Set by the platform agent-gateway in `ConfigureCommandV2` for mediated\n * sessions. Standalone runners (CLI / forge / Claude plugin) leave it\n * undefined; the runner falls back to surfacing the auth error to the\n * user without mediating.\n *\n * Spec: `_devlog/specs/2026-05-07-unified-credential-mediation.md`\n * § \"Wire `aiProviderConfigId` end-to-end\".\n *\n * @since 3.3.0\n */\n aiProviderConfigId?: string;\n /**\n * Optional callback invoked by the driver when the underlying agent\n * surfaces an `authentication_error`. In Protocol v3 the runner mediates\n * the refresh via the `host.refresh_credential` capability and returns a\n * typed {@link CredentialMint}. The driver inspects the discriminator:\n *\n * - `mint.ok === true`: a fresh credential is now provisioned. The\n * driver re-attempts the in-flight prompt once.\n * - `mint.ok === false`: refresh failed (`code` carries a stable reason\n * such as `revoked`, `not-configured`, `provider-error`,\n * `backend-error`). The driver surfaces the original `AuthError` to\n * the caller.\n *\n * `args.configId` carries the platform `AIProviderConfig.id` the driver\n * was provisioned with (mirrors {@link AgentConfig.aiProviderConfigId}).\n * The runner uses it to scope the refresh to the correct AI credential.\n *\n * When omitted, the driver throws `AuthError` immediately as before\n * (standalone CLI / forge mode — there is no platform mediator to ask).\n *\n * Centralising auth-retry inside the driver means every consumer of\n * `driver.prompt(...)` (serve handler, compaction orchestrator, flow\n * orchestrator, …) gets self-healing for free — there is no per-call-site\n * wrapping.\n *\n * Spec: `_devlog/specs/2026-05-10-deterministic-session-bootstrap.md`\n * § \"host.refresh_credential capability\".\n *\n * @since 3.4.0\n */\n onAuthError?: (args: { configId: string }) => Promise<CredentialMint>;\n /**\n * Optional callback invoked by the driver when a turn is blocked by an\n * upstream **usage limit** rather than a bad credential — the subscription\n * five-hour / seven-day ceiling, or any `rate_limit` the classifier\n * recognises. Called at most once per logical turn, and only after the\n * blocked attempt has already failed, so it never runs mid-turn.\n *\n * The runner implements it by asking the platform to re-resolve the seat:\n *\n * - `switched: true` — the session was repointed at a DIFFERENT AI\n * provider config and `.credentials.json` was rewritten. The driver\n * drops its query (forcing a fresh CLI spawn, which is what clears a\n * resident CLI's cached \"blocked until <reset>\" state — a hot file\n * rewrite alone does not) and replays the prompt once.\n * - `switched: false` — no alternative seat was available. The driver\n * surfaces the original limit error unchanged.\n *\n * Left unset by standalone runners (CLI / forge / Claude plugin): there is\n * no platform mediator to re-resolve a seat, so the limit error surfaces\n * exactly as it does today.\n *\n * Companion to {@link onAuthError}: that one covers 401s, this one covers\n * the rejection path, which previously reached no failover at all\n * (skaile-ai/workspaces#567, skaile-ai/platform#2976).\n *\n * @since 3.9.0\n */\n onLimitBlocked?: (ctx: LimitBlockedContext) => Promise<LimitFailoverResult>;\n /**\n * Optional fire-and-forget hook invoked when the driver observes a 401 or a\n * 429 / subscription-limit rejection from the AI provider. The runner\n * forwards it to the platform as a `provider_response_seen` event so the\n * owning `AIProviderConfig`'s live health counters can be bumped — the cron\n * health probe only samples auth, never capacity\n * (skaile-ai/workspaces#368, skaile-ai/platform#3539).\n *\n * Never awaited and never retried; the driver swallows a throwing\n * implementation so telemetry can never fail a turn.\n *\n * @since 3.9.0\n */\n onProviderResponse?: (observation: ProviderResponseObservation) => void;\n /**\n * Optional fire-and-forget hook invoked for every upstream quota-window\n * reading (claude-sdk `rate_limit_event`), not only rejections. The runner\n * forwards it as `provider_quota_observed`, which is the only quota signal\n * the platform has for a seat whose token cannot read the OAuth usage\n * endpoint (a `claude setup-token` seat).\n *\n * Never awaited and never retried; the driver swallows a throwing\n * implementation so telemetry can never fail a turn. Unlike\n * {@link onProviderResponse} it fires on every event, so dedupe at the host.\n *\n * @since 4.1.0\n */\n onProviderQuota?: (observation: ProviderQuotaObservation) => void;\n /**\n * Test-only flow driver hook. When present, the echo driver's scripted-flow\n * mode uses it to advance flow nodes deterministically (no LLM). The runner\n * injects it in `createActiveFlow`; every other driver ignores it.\n *\n * @see FlowTestDriverHook\n * @since 3.6.0\n */\n flowTestDriver?: FlowTestDriverHook;\n}\n\n/**\n * A single message in an agent conversation.\n *\n * Emitted as part of {@link AgentEvent} variants (`message_start`, `message_update`, `message_end`).\n *\n * @docLink packages/bridge/concepts#agent-message\n */\nexport interface AgentMessage {\n /** Originator of the message. */\n role: \"user\" | \"assistant\" | \"tool\";\n /** Message body — either a plain string or a list of typed content blocks. */\n content: string | ContentBlock[];\n /** Tool invocations made by the assistant in this message. */\n toolCalls?: ToolCall[];\n /** For `role === \"tool\"`: the name of the tool whose result this message carries. */\n toolName?: string;\n /** For `role === \"tool\"`: `true` when the tool returned an error. */\n isError?: boolean;\n /** Optional structured payload for tool results. */\n data?: unknown;\n /**\n * Set when a subagent produced this message: the id of the tool use that\n * runs the subagent. Absent on main-thread messages.\n */\n parentToolUseId?: string;\n}\n\n/**\n * A typed block within an {@link AgentMessage}'s content array.\n *\n * Mirrors the Anthropic content block schema but is driver-agnostic.\n *\n * @docLink packages/bridge/concepts#content-block\n */\nexport interface ContentBlock {\n /** Block discriminant. */\n type: \"text\" | \"tool_use\" | \"tool_result\" | \"thinking\";\n /** Present for `text` and `thinking` blocks. */\n text?: string;\n /** Tool use / tool result correlation ID. */\n id?: string;\n /** Tool name (present on `tool_use` blocks). */\n name?: string;\n /** Tool input arguments (present on `tool_use` blocks). */\n input?: any;\n /** Serialised tool result content (present on `tool_result` blocks). */\n content?: string;\n}\n\n/**\n * A single tool invocation made by the agent within a message.\n *\n * @docLink packages/bridge/concepts#tool-call\n */\nexport interface ToolCall {\n /** Correlation ID used to match the call with its result. */\n id: string;\n /** Name of the tool being invoked. */\n name: string;\n /** Arguments passed to the tool. */\n input: any;\n}\n\n/**\n * Error classification for agent failures.\n *\n * Used to determine whether a failure is retryable and to surface actionable\n * hints to the user. See `bridge/CLAUDE.md` for the full category-to-behaviour matrix.\n *\n * @see AgentError\n * @docLink packages/bridge/concepts#error-category\n */\nexport type ErrorCategory =\n | \"auth\"\n | \"account\"\n | \"rate_limit\"\n | \"model\"\n | \"network\"\n | \"config\"\n | \"process\"\n | \"validation\"\n | \"unknown\";\n\n/**\n * Structured error payload emitted inside the `error` {@link AgentEvent}.\n *\n * Consumers should inspect `retryable` before deciding to surface a retry button,\n * and `hint` to provide an actionable message to the user.\n *\n * @docLink packages/bridge/concepts#agent-error\n */\nexport interface AgentError {\n /** Human-readable error description. */\n message: string;\n /** Coarse failure classification used for retry logic and telemetry. */\n category: ErrorCategory;\n /** HTTP status code if the error originated from an API response. */\n statusCode?: number;\n /** `true` when the caller may safely retry the same operation. */\n retryable: boolean;\n /** Short actionable advice suitable for display in the UI. */\n hint?: string;\n}\n\n/**\n * Metadata for a slash command exposed by the active agent runtime.\n *\n * @docLink packages/bridge/concepts#slash-command-info\n */\nexport interface SlashCommandInfo {\n /** Command name without the leading slash (e.g. `\"compact\"`). */\n name: string;\n /** One-line description shown in command pickers. */\n description: string;\n /** Placeholder text describing what argument the command expects. */\n argumentHint?: string;\n}\n\n/**\n * Discriminated union of all events emitted by a driver on the `'agent-event'` channel.\n *\n * @remarks\n * Consumers listen via `driver.on('agent-event', (event: AgentEvent) => ...)`.\n * The `[k: string]: any` index signature on most variants allows drivers to attach\n * driver-specific fields (e.g. `_textDelta`) without breaking the union.\n *\n * @docLink packages/bridge/concepts#agent-event\n */\nexport type AgentEvent =\n | { type: \"message_start\"; message: AgentMessage; [k: string]: any }\n | { type: \"message_update\"; message: AgentMessage; [k: string]: any }\n | { type: \"message_end\"; message: AgentMessage; [k: string]: any }\n /**\n * Takes back `text`, the unfinished tail of streamed `_textDelta`s, before the\n * driver replays an abandoned attempt. Always a suffix of what was streamed\n * since the last completed assistant message; see `TextRetractEvent` in the types package.\n */\n | { type: \"message_retract\"; text: string; [k: string]: any }\n | { type: \"turn_end\"; toolResults?: AgentMessage[]; [k: string]: any }\n | { type: \"agent_end\"; [k: string]: any }\n | {\n type: \"result\";\n subtype: string;\n summary?: string;\n costUsd?: number;\n /** Per-turn token usage when the driver tracks it. Added in 3.1.0. */\n tokens?: TokenUsage;\n /** Per-turn usage keyed by model, subagent calls included. Added in 3.11.0. */\n modelUsage?: Record<string, ModelTokenUsage>;\n /** Prompt size of the turn's last main-thread API call. Added in 3.11.0. */\n contextTokens?: number;\n /** Context window of the main model, in tokens. Added in 3.11.0. */\n contextWindow?: number;\n errors?: string[];\n [k: string]: any;\n }\n | {\n type: \"error\";\n error: string;\n detail?: AgentError;\n fatal?: boolean;\n /** Set (with `fatal: false`) when the driver replays the prompt in place; see `ErrorEvent.retrying`. */\n retrying?: boolean;\n retryReason?: ErrorRetryReason;\n /** Usage of a failed provider turn, when reported. */\n tokens?: TokenUsage;\n /** Failed-turn usage keyed by the actual model. */\n modelUsage?: Record<string, ModelTokenUsage>;\n contextTokens?: number;\n contextWindow?: number;\n [k: string]: any;\n }\n | {\n type: \"tool_call\";\n name?: string;\n tool?: { name: string };\n /** Set when a subagent made the call. */\n parentToolUseId?: string;\n [k: string]: any;\n }\n | { type: \"tool_execution_end\"; toolName?: string; parentToolUseId?: string; [k: string]: any }\n | { type: \"commands_available\"; commands: SlashCommandInfo[] }\n | { type: \"session_info\"; driverSessionId: string; sessionFile?: string }\n | { type: \"ui_render\"; [k: string]: any }\n | { type: \"ui_render_update\"; [k: string]: any }\n | { type: \"ui_clear\"; [k: string]: any }\n // Phase 3 (resume cascade) — driver-emitted resume outcome.\n | {\n type: \"resume_failed\";\n resumeSessionId: string;\n reason:\n | \"signature_mismatch\"\n | \"model_mismatch\"\n | \"jsonl_lost\"\n | \"jsonl_poisoned\"\n | \"native_state_unavailable\";\n [k: string]: any;\n };\n\n/** The settings a live reconfigure may change. */\nexport type ReconfigurePatch = Partial<Pick<AgentConfig, \"model\" | \"thinking\" | \"effort\">>;\n\n/**\n * What a driver now holds for the fields of an accepted reconfigure. `modelRef`\n * is the registry selector the model was scoped to; it is absent when the\n * session has none. A host remembers exactly this, never the raw patch.\n */\nexport interface ReconfigureApplied {\n model?: string;\n modelRef?: string;\n thinking?: AgentConfig[\"thinking\"];\n effort?: AgentConfig[\"effort\"];\n}\n\n/**\n * Result of `AgentDriver.reconfigure()`. `ok: true` means effective from the\n * next turn (live switch, query recycle or respawn); a driver that cannot\n * promise that answers `ok: false` instead.\n *\n * - `not_supported`: the driver cannot change settings live.\n * - `model_not_on_provider`: the session's AI provider entry does not list the\n * model (`providerId` names the entry).\n * - `rejected`: the running process refused the change; the driver config is\n * unchanged.\n *\n * @category Bridge\n */\nexport type ReconfigureOutcome =\n | { ok: true; applied: ReconfigureApplied }\n | {\n ok: false;\n code: \"not_supported\" | \"model_not_on_provider\" | \"rejected\";\n message: string;\n providerId?: string;\n };\n\n/**\n * A reconfigure the driver answered `ok` (it landed mid-turn) and then refused\n * at the next turn boundary. The driver already rolled its config back;\n * `requested` is what was asked, `restored` what it holds again. Emitted as the\n * driver event `'reconfigure-rollback'`.\n */\nexport interface ReconfigureRollback {\n message: string;\n requested: ReconfigureApplied;\n restored: ReconfigureApplied;\n}\n\n/** Rejection message of a driver asked to run a turn under a tool allowlist it cannot enforce. */\nexport const TOOL_ALLOWLIST_UNSUPPORTED = \"This agent harness cannot enforce a tool allowlist\";\n\n/**\n * Abstract base class for agent drivers.\n *\n * Wraps an LLM coding agent behind a single `prompt()` interface.\n * All drivers emit `'agent-event'` with {@link AgentEvent} payloads.\n *\n * @remarks\n * Subclasses must implement `start`, `prompt`, `abort`, `kill`, and `isRunning`.\n * Implementations should never emit an event name other than `'agent-event'` as\n * the public streaming channel — internal events (`'ready'`, `'exit'`, etc.) are\n * driver-private. The one other public event is `'reconfigure-rollback'` (a\n * {@link ReconfigureRollback}): a live reconfigure the driver had accepted and\n * then refused at the turn boundary, already rolled back in the driver.\n *\n * @example\n * ```ts\n * const driver = createDriver('omp', config);\n * driver.on('agent-event', (event) => console.log(event.type));\n * await driver.start();\n * await driver.prompt('Refactor the auth module');\n * driver.kill();\n * ```\n *\n * @docLink packages/bridge/concepts#agent-driver\n */\nexport abstract class AgentDriver extends EventEmitter {\n /** Static metadata describing this driver's capabilities. */\n abstract readonly driverInfo: DriverInfo;\n\n /**\n * Initialises the driver's harness — spawns the child process (omp) or loads\n * the SDK module (claude-sdk). Resolves when the harness is ready to accept\n * prompts. Idempotent: calling `start()` on an already-running driver is a no-op.\n *\n * @throws {Error} When the harness binary is missing or the SDK cannot be loaded.\n */\n abstract start(): Promise<void>;\n\n /**\n * Sends a user message to the agent and resolves when the agent's turn completes\n * (i.e. after the `agent_end` event has been emitted).\n *\n * @param message - Plain-text user prompt to send to the agent.\n * @throws {Error} When the driver is not running or the underlying harness reports a fatal error.\n */\n abstract prompt(message: string): Promise<void>;\n\n /**\n * Preserve text-only callers; drivers must explicitly support attachments.\n * A `toolAllowlist` is refused here: only a driver that overrides\n * {@link enforcesToolAllowlist} may run a restricted turn.\n */\n promptInput(input: AgentPromptInput): Promise<void> {\n if (input.toolAllowlist !== undefined)\n return Promise.reject(new Error(TOOL_ALLOWLIST_UNSUPPORTED));\n if (input.attachments?.length) return Promise.reject(new Error(\"Structured input unsupported\"));\n return this.prompt(input.text);\n }\n\n /**\n * Whether {@link promptInput} enforces `AgentPromptInput.toolAllowlist` for\n * the whole turn, subagents included. A driver that answers `false` must\n * reject an input carrying one; the runner refuses such a prompt before it\n * reaches the driver.\n */\n get enforcesToolAllowlist(): boolean {\n return false;\n }\n\n /**\n * The names in `allowlist` this driver does not recognize as a tool it could\n * offer. The runner refuses a prompt whose allowlist names any, rather than\n * guess. A driver that does not enforce allowlists recognizes none.\n */\n unknownAllowlistedTools(allowlist: readonly string[]): string[] {\n return [...allowlist];\n }\n\n /** Managed replies never fall back to a new prompt after a request has settled. */\n get acceptsReplyAsPrompt(): boolean {\n return true;\n }\n\n /**\n * Sends an in-band abort signal to the agent, requesting it to stop the current\n * turn without terminating the process. The driver remains usable after `abort()`.\n *\n * @remarks Only meaningful when `driverInfo.supportsInBandAbort` is `true`.\n * For other drivers, prefer `kill()` followed by creating a new driver instance.\n */\n abstract abort(): Promise<void>;\n\n /**\n * Terminates the agent harness immediately (SIGTERM for subprocess drivers,\n * `close()` for in-process drivers). The driver instance must not be reused\n * after `kill()`.\n */\n abstract kill(): void;\n\n /** Stop the driver and await owned process/state cleanup when the harness supports it. */\n async dispose(): Promise<void> {\n this.kill();\n }\n\n /** `true` when the harness is alive and able to accept new prompts. */\n abstract get isRunning(): boolean;\n\n /** Optional provider-native session/thread identifier for resume support. */\n get runtimeSessionId(): string | undefined {\n return undefined;\n }\n\n /** Slash commands discovered from the agent runtime. Override in drivers that support introspection. */\n getSlashCommands(): SlashCommandInfo[] {\n return [];\n }\n\n // ── Interactive questions (AskUserQuestion) ──────────────────────────────\n\n /**\n * `true` while the driver is paused on an interactive question and waiting\n * for the user's answer rather than a new prompt. The runner routes a\n * `reply` command to {@link answerQuestion} instead of {@link prompt} when\n * this returns `true`. Drivers without interactive-question support return\n * `false` (the default), so a `reply` falls back to `prompt`.\n */\n hasPendingQuestion(): boolean {\n return false;\n }\n\n /**\n * Deliver the user's answer to the question the driver is currently paused\n * on. This resumes the in-flight turn — it does NOT start a new one. When a\n * single tool call asks several questions, the driver resolves the underlying\n * call only once every sub-question has an answer.\n *\n * @param answer - The user's reply text (an option label, free text, or for\n * multi-select a comma-joined list).\n * @param question - The sub-question this answers, verbatim from the\n * `question` event that asked it. Supply it whenever the host lets the user\n * answer out of order — without it the answer fills the next unanswered\n * slot in order, which silently mismatches a non-sequential reply.\n * @returns `true` when the answer was consumed by a pending question; `false`\n * when no question was pending (caller should treat the reply as a prompt).\n */\n answerQuestion(answer: string, question?: string, requestId?: string): boolean {\n void requestId;\n void answer;\n void question;\n return false;\n }\n\n /**\n * Apply this driver's rule for a new prompt that meets a pending question,\n * ahead of the prompt itself. The runner queues a prompt behind the turn in\n * flight, so a turn paused on a question would otherwise hold that prompt\n * until the user answered. Drivers whose `prompt()` cancels the question\n * (claude-sdk, omp) do the same here; the default keeps the question.\n */\n supersedePendingQuestion(): void {\n // No-op: a driver without this rule keeps the question pending.\n }\n\n // ── Live reconfiguration ────────────────────────────────────────────────\n\n /**\n * Live-update driver configuration. `ok: true` means effective from the next\n * turn: the next turn runs on the new settings, by live switch, query recycle\n * or respawn, and the host needs no restart. A turn in progress finishes on\n * the old settings. Only model/thinking/effort are reconfigurable mid-session.\n *\n * Drivers that can honour that promise build a `ReconfigureLedger` and\n * delegate to it; it owns the model scope rule, ordering, drift and rollback.\n * The base implementation answers `not_supported`.\n */\n reconfigure(patch: ReconfigurePatch): Promise<ReconfigureOutcome> {\n const fields = Object.keys(patch).join(\", \");\n return Promise.resolve({\n ok: false,\n code: \"not_supported\",\n message: `The ${this.driverInfo.id} driver cannot change ${fields} live; the change applies when the session next starts.`,\n });\n }\n\n /**\n * Returns the model identifier currently configured on this driver.\n * Subclasses that store config locally should override this.\n */\n getModel(): string | undefined {\n return undefined;\n }\n\n // ── Compaction support ──────────────────────────────────────────────────\n\n /**\n * `Date.now()` of the harness's most recent sign of life, counting messages\n * that emit no `agent-event` (thinking deltas, rate-limit telemetry, API\n * retries). A stall check reads it alongside the events it sees. `null` when\n * the driver does not track it.\n */\n lastActivityAt(): number | null {\n return null;\n }\n\n /**\n * Returns the token usage from the most recent completed turn.\n * Returns `null` if usage data is unavailable (e.g. driver doesn't track it).\n *\n * Widened in 3.1.0 to return the full `TokenUsage` shape (input / output /\n * cache-read / cache-creation / reasoning). All fields are optional so\n * drivers can populate just what their provider reports. Existing callers\n * that read only `inputTokens` / `outputTokens` keep working — those fields\n * are still present and carry the same semantics as before.\n */\n getTokenUsage(): TokenUsage | null {\n return null;\n }\n\n /**\n * Prompt tokens occupying the context window as of the most recent API\n * request — i.e. how full the context actually is right now.\n *\n * Deliberately NOT the same number as {@link getTokenUsage}, whose usage is\n * cumulative over every API call in the turn and therefore overstates the\n * context by 10-40x on any multi-tool turn. Callers measuring context fill\n * (compaction thresholds) must prefer this; callers billing a turn\n * (usage ledgers, the `finished` event) must keep using `getTokenUsage()`.\n *\n * Returns `null` both when the driver cannot report a per-call figure at all\n * and when it can but has no reading yet. Falling back to `getTokenUsage()`\n * is safe in either case only because a driver clears the two in lockstep: no\n * reading means no API call landed, so there is no cumulative usage to\n * overstate. A driver implementing this must preserve that invariant.\n */\n getContextTokens(): number | null {\n return null;\n }\n\n /**\n * Returns the model's context window size in tokens.\n * Returns `null` if unknown.\n */\n getContextWindow(): number | null {\n return null;\n }\n\n /**\n * What the driver can measure natively about its context window, in the\n * neutral {@link DriverContextReport} shape, or `null` when it measures\n * nothing beyond {@link getContextTokens} / {@link getContextWindow}.\n *\n * `detail: \"full\"` (the default) may be expensive — claude-sdk issues\n * `count_tokens` requests — so the runner asks for it only when a host\n * requests a measured breakdown; `\"summary\"` must make no provider call and\n * is what the per-turn snapshot uses. Implementations must not throw for\n * \"unsupported\"; a rejection means the measurement itself failed and the\n * runner falls back to estimates.\n */\n async getContextUsageReport(_opts?: {\n detail?: ContextUsageDetail;\n }): Promise<DriverContextReport | null> {\n return null;\n }\n\n /**\n * Returns the list of models available to this driver without starting a session.\n * Drivers that can enumerate their own models override this method.\n * Returns an empty array by default.\n */\n async listModels(): Promise<ModelEntry[]> {\n return [];\n }\n\n /**\n * Closes the current conversation session and prepares for a fresh start.\n * The next `prompt()` call will begin a new session without prior history.\n * The driver remains usable after `resetSession()`.\n */\n abstract resetSession(): Promise<void>;\n\n // ── Telemetry ─────────────────────────────────────────────────────────────\n\n protected _telemetry?: TelemetryProvider;\n protected _activeTrace?: Trace;\n protected _activeTurnSpan?: Span;\n private _turnStartTime?: number;\n\n /**\n * Attach a telemetry provider and active trace to this driver.\n * Called by the runner after creating the driver but before start().\n */\n setTelemetry(provider: TelemetryProvider, trace: Trace): void {\n this._telemetry = provider;\n this._activeTrace = trace;\n }\n\n /**\n * Begin a turn span. Called by the runner before prompt().\n * Pass a parent span (e.g. the turn span from the orchestrator) for nesting.\n * Returns the span so the runner can annotate it further.\n */\n beginTurnSpan(\n parent?: Trace | Span,\n attrs?: Record<string, string | number | boolean>,\n ): Span | undefined {\n if (!this._telemetry || !this._activeTrace) return undefined;\n this._turnStartTime = Date.now();\n this._activeTurnSpan = this._telemetry.startSpan(parent ?? this._activeTrace, {\n name: \"llm_generation\",\n kind: \"llm_generation\",\n attributes: attrs,\n });\n return this._activeTurnSpan;\n }\n\n /**\n * End the current turn span with generation data.\n * Called by the runner after agent_end. Model and provider are passed\n * explicitly — the driver base class does not access config directly.\n */\n endTurnSpan(result?: {\n model?: string;\n provider?: string;\n inputTokens?: number;\n outputTokens?: number;\n stopReason?: string;\n error?: string;\n }): void {\n if (!this._telemetry || !this._activeTurnSpan) return;\n const durationMs = this._turnStartTime ? Date.now() - this._turnStartTime : 0;\n\n if (result?.inputTokens !== undefined || result?.outputTokens !== undefined) {\n this._telemetry.logGeneration(this._activeTurnSpan, {\n model: result?.model ?? \"unknown\",\n provider: result?.provider ?? \"unknown\",\n inputTokens: result.inputTokens,\n outputTokens: result.outputTokens,\n durationMs,\n stopReason: result.stopReason,\n });\n }\n\n this._telemetry.endSpan(this._activeTurnSpan, {\n status: result?.error ? \"error\" : \"ok\",\n error: result?.error,\n attributes: { \"skaile.turn.duration_ms\": durationMs },\n });\n\n this._activeTurnSpan = undefined;\n this._turnStartTime = undefined;\n }\n}\n\n/**\n * Factory function signature registered in the driver registry.\n *\n * @param config - Configuration for the new driver instance.\n * @returns A freshly constructed (not yet started) {@link AgentDriver}.\n * @docLink packages/bridge/concepts#driver-factory\n */\nexport type DriverFactory = (config: AgentConfig) => AgentDriver;\n","import type {\n AIProviderRegistry,\n AIProviderSurface,\n MergedAIProviderRegistry,\n} from \"@skaile/workspaces/core/provider-registry\";\nimport type { DriverContext } from \"@skaile/workspaces/plugin-registry\";\nimport { type PluginRegistry, pluginRegistry } from \"@skaile/workspaces/plugin-registry\";\nimport type { ModelEntry } from \"./models.js\";\nimport type { RegistryCredentialOptions } from \"./provider-materialize/credential-env.js\";\nimport { BUILTIN_DRIVER_CAPABILITIES } from \"./driver-capabilities.js\";\nimport type { AgentConfig, AgentDriver, DriverInfo } from \"./types.js\";\n\n// Build-time harness gating. `bun build --compile --define:__INCLUDE_*__=...`\n// folds these to literal booleans so an excluded harness's driver module and\n// its SDK are dead-code-stripped from the binary. Under tsup / vitest / bun\n// run-on-source no `--define` runs and the `typeof` guard defaults to `true` —\n// every harness is available (the SDKs stay optional peers).\ndeclare const __INCLUDE_CLAUDE_SDK__: boolean;\ndeclare const __INCLUDE_CODEX__: boolean;\nconst INCLUDE_CLAUDE_SDK =\n typeof __INCLUDE_CLAUDE_SDK__ === \"undefined\" ? true : __INCLUDE_CLAUDE_SDK__;\nconst INCLUDE_CODEX = typeof __INCLUDE_CODEX__ === \"undefined\" ? true : __INCLUDE_CODEX__;\n\n/**\n * Every wire surface omp can speak — it is the harness the `surface` enum was\n * lifted from, so its list is the enum.\n */\nconst OMP_SURFACES = [\n \"anthropic-messages\",\n \"openai-completions\",\n \"openai-responses\",\n \"openai-codex-responses\",\n \"azure-openai-responses\",\n \"bedrock-converse-stream\",\n \"google-generative-ai\",\n \"google-vertex\",\n] as const satisfies readonly AIProviderSurface[];\n\n/**\n * Static capability metadata for every built-in harness.\n *\n * Pure data — this object imports no driver module and references no harness\n * SDK. {@link listDrivers} returns it (merged with any third-party drivers)\n * so selection UIs can enumerate every harness without loading a single\n * driver module. The matching driver module's `DriverTarget` is registered\n * into the plugin registry by {@link registerBuiltinDrivers}.\n *\n * `surfaces` and `providerPlurality` are the driver-capability declaration\n * the AI provider registry resolves against (plan §2.3): which wire protocols\n * a harness can be pointed at, and how many registry entries it can use at\n * once. The platform's resolver filters candidate entries on `surfaces`\n * instead of matching vendor names.\n *\n * @docLink packages/bridge/api-reference#registry\n */\nexport const BUILTIN_DRIVER_CATALOG: Record<string, DriverInfo> = {\n omp: {\n id: \"omp\",\n name: \"omp (oh-my-pi)\",\n modelAgnostic: true,\n supportsInBandAbort: true,\n surfaces: OMP_SURFACES,\n // omp renders the whole registry as its own `models.yml`, so every entry\n // stays selectable and roles / per-subagent models resolve across them.\n providerPlurality: \"registry\",\n capabilities: BUILTIN_DRIVER_CAPABILITIES.omp,\n },\n \"claude-sdk\": {\n id: \"claude-sdk\",\n name: \"Claude Agent SDK\",\n modelAgnostic: false,\n supportsInBandAbort: true,\n // Anthropic's own API, plus the two clouds the SDK addresses natively.\n // Foundry is `anthropic-messages` at a different host, not a surface.\n surfaces: [\"anthropic-messages\", \"bedrock-converse-stream\", \"google-vertex\"],\n providerPlurality: \"single\",\n capabilities: BUILTIN_DRIVER_CAPABILITIES[\"claude-sdk\"],\n },\n codex: {\n id: \"codex\",\n name: \"OpenAI Codex\",\n modelAgnostic: false,\n supportsInBandAbort: true,\n // Codex's `wire_api` is `responses` or `chat`; its subscription transport\n // is the codex-specific responses flavour.\n surfaces: [\"openai-codex-responses\", \"openai-responses\", \"openai-completions\"],\n providerPlurality: \"single\",\n capabilities: BUILTIN_DRIVER_CAPABILITIES.codex,\n },\n echo: {\n id: \"echo\",\n name: \"Echo (E2E mock)\",\n modelAgnostic: true,\n supportsInBandAbort: false,\n // Deterministic mock: it never opens a connection, so it speaks no wire\n // surface and no registry entry can be dispatched to it.\n surfaces: [],\n providerPlurality: \"single\",\n },\n gemini: {\n id: \"gemini\",\n name: \"Gemini CLI\",\n modelAgnostic: false,\n supportsInBandAbort: false,\n surfaces: [\"google-generative-ai\"],\n providerPlurality: \"single\",\n },\n qwen: {\n id: \"qwen\",\n name: \"Qwen Code\",\n modelAgnostic: true,\n supportsInBandAbort: false,\n // Driven entirely through OPENAI_BASE_URL / OPENAI_API_KEY.\n surfaces: [\"openai-completions\"],\n providerPlurality: \"single\",\n },\n opencode: {\n id: \"opencode\",\n name: \"OpenCode\",\n modelAgnostic: true,\n supportsInBandAbort: false,\n surfaces: [\n \"anthropic-messages\",\n \"openai-completions\",\n \"openai-responses\",\n \"google-generative-ai\",\n ],\n providerPlurality: \"credentials-n\",\n },\n goose: {\n id: \"goose\",\n name: \"Goose\",\n modelAgnostic: true,\n supportsInBandAbort: false,\n surfaces: [\n \"anthropic-messages\",\n \"openai-completions\",\n \"google-generative-ai\",\n \"bedrock-converse-stream\",\n ],\n providerPlurality: \"credentials-n\",\n },\n continue: {\n id: \"continue\",\n name: \"Continue CLI\",\n modelAgnostic: true,\n supportsInBandAbort: false,\n surfaces: [\"anthropic-messages\", \"openai-completions\", \"google-generative-ai\"],\n providerPlurality: \"credentials-n\",\n },\n};\n\n/**\n * Back-compat alias for {@link BUILTIN_DRIVER_CATALOG}. Consumers and tests that\n * predate the plugin-registry refactor still import `DRIVER_CATALOG`.\n *\n * @docLink packages/bridge/api-reference#registry\n */\nexport const DRIVER_CATALOG = BUILTIN_DRIVER_CATALOG;\n\nlet _driversRegistered = false;\n\n/**\n * Register every built-in driver's `DriverTarget` into the plugin registry.\n *\n * This is the single id → module map in bridge core. Every specifier is a\n * literal string so `bun --compile` can statically bundle the driver module\n * (and, transitively, its SDK). The in-process-SDK harnesses (`claude-sdk`,\n * `codex`) are wrapped in build-constant guards so an excluded harness's\n * `await import` folds to dead code in the compiled binary. `omp` and `echo`\n * carry no SDK weight and are always available.\n *\n * **Static import discipline.** Every `import()` specifier below must be a\n * string literal — never aliased through a variable. Indirection defeats\n * `bun --compile`'s static analysis and silently drops the module from the\n * binary.\n *\n * Idempotent: guarded by a module flag so a second call is a no-op (a duplicate\n * `register` would otherwise throw `RegistrationError`).\n *\n * @docLink packages/bridge/api-reference#registry\n */\nexport async function registerBuiltinDrivers(\n registry: PluginRegistry = pluginRegistry,\n): Promise<void> {\n if (registry === pluginRegistry && _driversRegistered) return;\n\n if (!registry.get(\"driver\", \"omp\")) {\n const m = await import(\"@skaile/workspaces/drivers/omp\");\n registry.register(\"driver\", m.ompDriverTarget);\n }\n if (!registry.get(\"driver\", \"echo\")) {\n const m = await import(\"@skaile/workspaces/drivers/echo\");\n registry.register(\"driver\", m.echoDriverTarget);\n }\n if (INCLUDE_CLAUDE_SDK && !registry.get(\"driver\", \"claude-sdk\")) {\n const m = await import(\"@skaile/workspaces/drivers/claude-sdk\");\n registry.register(\"driver\", m.claudeSdkDriverTarget);\n }\n if (INCLUDE_CODEX && !registry.get(\"driver\", \"codex\")) {\n const m = await import(\"@skaile/workspaces/drivers/codex\");\n registry.register(\"driver\", m.codexDriverTarget);\n }\n // Subprocess CLI harnesses spawn an external binary the user installs\n // separately — no bundled SDK to dead-code-strip, so (like omp/echo) they\n // carry no build constant and are always registered.\n if (!registry.get(\"driver\", \"gemini\")) {\n const m = await import(\"@skaile/workspaces/drivers/gemini\");\n registry.register(\"driver\", m.geminiDriverTarget);\n }\n if (!registry.get(\"driver\", \"qwen\")) {\n const m = await import(\"@skaile/workspaces/drivers/qwen\");\n registry.register(\"driver\", m.qwenDriverTarget);\n }\n if (!registry.get(\"driver\", \"opencode\")) {\n const m = await import(\"@skaile/workspaces/drivers/opencode\");\n registry.register(\"driver\", m.opencodeDriverTarget);\n }\n if (!registry.get(\"driver\", \"goose\")) {\n const m = await import(\"@skaile/workspaces/drivers/goose\");\n registry.register(\"driver\", m.gooseDriverTarget);\n }\n if (!registry.get(\"driver\", \"continue\")) {\n const m = await import(\"@skaile/workspaces/drivers/continue\");\n registry.register(\"driver\", m.continueDriverTarget);\n }\n\n if (registry === pluginRegistry) _driversRegistered = true;\n}\n\n/**\n * Creates a new driver instance for the given harness id.\n *\n * Ensures the built-in driver targets are registered (idempotent), then looks\n * up the target in the plugin registry and calls its `create()`. The returned\n * driver has not been started yet — call `driver.start()` before sending\n * prompts.\n *\n * @param id - Registered driver identifier (e.g. `\"omp\"`, `\"claude-sdk\"`).\n * @param config - Configuration forwarded to the driver constructor.\n * @param ctx - Optional driver context (logger / abort signal). Defaults to `{}`.\n * @returns A freshly constructed (not yet started) {@link AgentDriver}.\n * @throws {Error} When `id` is a known harness excluded from this build, or\n * when `id` does not match any registered driver at all.\n * @docLink packages/bridge/api-reference#registry\n */\nexport async function createDriver(\n id: string,\n config: AgentConfig,\n ctx?: DriverContext,\n): Promise<AgentDriver> {\n const target = await resolveDriverTarget(id);\n return target.create(config, ctx ?? {});\n}\n\n/**\n * Resolve a registered driver target by id, ensuring the built-ins are\n * registered first. Throws the canonical \"not bundled\" / \"unknown driver\"\n * errors so every caller (`createDriver`, `listModelsForDriver`) reports an\n * unrecognized id the same way instead of silently degrading.\n *\n * @throws {Error} When `id` is a known harness excluded from this build, or\n * when `id` does not match any registered driver at all.\n */\nasync function resolveDriverTarget(id: string) {\n await registerBuiltinDrivers();\n const target = pluginRegistry.get(\"driver\", id);\n if (!target) {\n if (id in BUILTIN_DRIVER_CATALOG) {\n throw new Error(`Agent driver \"${id}\" is not bundled in this build.`);\n }\n throw new Error(\n `Unknown agent driver: \"${id}\". Available: ${listDrivers()\n .map((d) => d.id)\n .join(\", \")}`,\n );\n }\n return target;\n}\n\n/**\n * Returns the capability metadata for every available driver.\n *\n * Enumerates every built-in harness from {@link BUILTIN_DRIVER_CATALOG} without\n * loading a single driver module or harness SDK, then merges in any third-party\n * driver targets registered into the plugin registry that are not already in\n * the catalog. Use this to populate driver selection UIs.\n *\n * @returns Array of {@link DriverInfo} objects, one per available driver.\n * @docLink packages/bridge/api-reference#registry\n */\nexport function listDrivers(): DriverInfo[] {\n const merged = new Map<string, DriverInfo>();\n for (const info of Object.values(BUILTIN_DRIVER_CATALOG)) {\n merged.set(info.id, info);\n }\n for (const meta of pluginRegistry.list(\"driver\")) {\n if (!merged.has(meta.id)) {\n // Third-party drivers carry no DriverInfo row; read the capability flags\n // off the registered target (defaulting to conservative false) so a\n // model-agnostic / in-band-abort harness can still advertise them.\n const target = pluginRegistry.get(\"driver\", meta.id);\n merged.set(meta.id, {\n id: meta.id,\n name: meta.displayName,\n modelAgnostic: target?.modelAgnostic ?? false,\n supportsInBandAbort: target?.supportsInBandAbort ?? false,\n // Left absent when the target declares nothing: \"speaks no surface\" and\n // \"did not say\" are different claims, and the platform resolver must be\n // able to tell them apart before it filters a driver out.\n ...(target?.surfaces ? { surfaces: target.surfaces } : {}),\n ...(target?.providerPlurality ? { providerPlurality: target.providerPlurality } : {}),\n ...(target?.capabilities ? { capabilities: target.capabilities } : {}),\n });\n }\n }\n return [...merged.values()];\n}\n\n/**\n * List models available to a specific driver without starting a full agent session.\n *\n * Ensures the built-in driver targets are registered (idempotent), then\n * delegates to the target's optional `listModels()`. Throws on an unknown /\n * not-bundled id (same contract as {@link createDriver}); returns `[]` only\n * when the target exists but exposes no `listModels`.\n *\n * @param driverId - Registered driver id (e.g. `\"omp\"`, `\"claude-sdk\"`, `\"codex\"`).\n * @param registry - The AI provider registry to discover against — either the\n * bare `id → entry` map or a merged view. Each entry names its credential by\n * reference, resolved through `options` and delivered to the throwaway\n * driver as `SKAILE_AIP_<ID>_KEY` environment entries.\n * @param options - Which entry to restrict to, and where `env:` / `platform:`\n * references resolve from. Defaults to the whole registry against\n * `process.env`.\n * @throws {Error} When `driverId` is unknown or excluded from this build.\n * @docLink packages/bridge/api-reference#registry\n */\nexport async function listModelsForDriver(\n driverId: string,\n registry: AIProviderRegistry | MergedAIProviderRegistry,\n options?: RegistryCredentialOptions,\n): Promise<ModelEntry[]> {\n const target = await resolveDriverTarget(driverId);\n return (await target.listModels?.(registry, options)) ?? [];\n}\n"]}