@skaile/workspaces 6.0.0 → 6.1.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 (320) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/dist/{asset-feeds-PXUWCXVI.js → asset-feeds-HJFV7UPW.js} +26 -18
  3. package/dist/asset-feeds-HJFV7UPW.js.map +1 -0
  4. package/dist/asset-manager/catalog-deployer.js +7 -7
  5. package/dist/asset-manager/index.js +13 -13
  6. package/dist/asset-manager/installer.js +8 -8
  7. package/dist/asset-manager/renderers.js +7 -7
  8. package/dist/asset-manager/src/index.d.ts +192 -5
  9. package/dist/asset-manager/src/index.d.ts.map +1 -1
  10. package/dist/asset-manager/src/installer.d.ts +31 -0
  11. package/dist/asset-manager/src/installer.d.ts.map +1 -1
  12. package/dist/asset-manager/src/mcp-config.d.ts +21 -0
  13. package/dist/asset-manager/src/mcp-config.d.ts.map +1 -1
  14. package/dist/bridge/harnesses/claude-sdk.js +13 -17
  15. package/dist/bridge/harnesses/claude-sdk.js.map +1 -1
  16. package/dist/bridge/harnesses/codex.js +10 -10
  17. package/dist/bridge/harnesses/continue.js +10 -10
  18. package/dist/bridge/harnesses/echo.js +2 -2
  19. package/dist/bridge/harnesses/gemini.js +6 -6
  20. package/dist/bridge/harnesses/goose.js +10 -10
  21. package/dist/bridge/harnesses/omp.js +4 -4
  22. package/dist/bridge/harnesses/opencode.js +10 -10
  23. package/dist/bridge/harnesses/qwen.js +6 -6
  24. package/dist/bridge/index.js +14 -14
  25. package/dist/bridge/src/claude-sdk-surface.d.ts +17 -0
  26. package/dist/bridge/src/claude-sdk-surface.d.ts.map +1 -0
  27. package/dist/bridge/src/harness-model-check.d.ts +15 -0
  28. package/dist/bridge/src/harness-model-check.d.ts.map +1 -1
  29. package/dist/bridge/src/harnesses/claude-sdk.d.ts.map +1 -1
  30. package/dist/bridge/src/index.d.ts +2 -1
  31. package/dist/bridge/src/index.d.ts.map +1 -1
  32. package/dist/bridge/src/normalizer.d.ts +3 -1
  33. package/dist/bridge/src/normalizer.d.ts.map +1 -1
  34. package/dist/{chunk-VJRTDKXS.js → chunk-2LAPHLDH.js} +144 -94
  35. package/dist/chunk-2LAPHLDH.js.map +1 -0
  36. package/dist/{chunk-VXEYX73S.js → chunk-3GMOPFWH.js} +4 -4
  37. package/dist/{chunk-VXEYX73S.js.map → chunk-3GMOPFWH.js.map} +1 -1
  38. package/dist/{chunk-MCUJTNY5.js → chunk-4FVIT5DI.js} +3 -3
  39. package/dist/{chunk-MCUJTNY5.js.map → chunk-4FVIT5DI.js.map} +1 -1
  40. package/dist/{chunk-SZXGRHQQ.js → chunk-4MUDQCBP.js} +4 -4
  41. package/dist/{chunk-SZXGRHQQ.js.map → chunk-4MUDQCBP.js.map} +1 -1
  42. package/dist/{chunk-7CV3HFWJ.js → chunk-5J4NPGFM.js} +3 -3
  43. package/dist/{chunk-7CV3HFWJ.js.map → chunk-5J4NPGFM.js.map} +1 -1
  44. package/dist/{chunk-4XWLB7JB.js → chunk-5Y2KGB4H.js} +69 -34
  45. package/dist/chunk-5Y2KGB4H.js.map +1 -0
  46. package/dist/{chunk-OULSJRXV.js → chunk-6YR4ALVX.js} +6 -6
  47. package/dist/{chunk-OULSJRXV.js.map → chunk-6YR4ALVX.js.map} +1 -1
  48. package/dist/chunk-7HX6FNKL.js +317 -0
  49. package/dist/chunk-7HX6FNKL.js.map +1 -0
  50. package/dist/{chunk-WDAIWDLK.js → chunk-7LP7RCZI.js} +4 -4
  51. package/dist/{chunk-WDAIWDLK.js.map → chunk-7LP7RCZI.js.map} +1 -1
  52. package/dist/{chunk-2UUKCROR.js → chunk-AATHJRKL.js} +4 -4
  53. package/dist/{chunk-2UUKCROR.js.map → chunk-AATHJRKL.js.map} +1 -1
  54. package/dist/{chunk-DUMTLYSO.js → chunk-ABFPSVIS.js} +3 -3
  55. package/dist/{chunk-DUMTLYSO.js.map → chunk-ABFPSVIS.js.map} +1 -1
  56. package/dist/{chunk-TKHJXPSB.js → chunk-AITJ7ELM.js} +140 -26
  57. package/dist/chunk-AITJ7ELM.js.map +1 -0
  58. package/dist/{chunk-Y2TO2U7W.js → chunk-ASWTQQ7E.js} +3 -3
  59. package/dist/{chunk-Y2TO2U7W.js.map → chunk-ASWTQQ7E.js.map} +1 -1
  60. package/dist/{chunk-WYHQUCHR.js → chunk-AZ2H6R5I.js} +51 -25
  61. package/dist/chunk-AZ2H6R5I.js.map +1 -0
  62. package/dist/{chunk-LN6QB7XI.js → chunk-BBBCJSSU.js} +4 -4
  63. package/dist/{chunk-LN6QB7XI.js.map → chunk-BBBCJSSU.js.map} +1 -1
  64. package/dist/{chunk-WEH33JSG.js → chunk-CEKW3KXP.js} +87 -26
  65. package/dist/chunk-CEKW3KXP.js.map +1 -0
  66. package/dist/{chunk-ARWKK325.js → chunk-COYF6IG2.js} +5 -5
  67. package/dist/{chunk-ARWKK325.js.map → chunk-COYF6IG2.js.map} +1 -1
  68. package/dist/{chunk-SNEE6UGY.js → chunk-DGTI65OC.js} +11 -11
  69. package/dist/{chunk-SNEE6UGY.js.map → chunk-DGTI65OC.js.map} +1 -1
  70. package/dist/{chunk-HK7HMEPT.js → chunk-DIGFA7Z5.js} +3 -3
  71. package/dist/{chunk-HK7HMEPT.js.map → chunk-DIGFA7Z5.js.map} +1 -1
  72. package/dist/{chunk-AF432MS3.js → chunk-EJPMNDTP.js} +3 -3
  73. package/dist/{chunk-AF432MS3.js.map → chunk-EJPMNDTP.js.map} +1 -1
  74. package/dist/chunk-EX3GLAL6.js +31 -0
  75. package/dist/chunk-EX3GLAL6.js.map +1 -0
  76. package/dist/{chunk-UVVVR4XO.js → chunk-FKQNBCDW.js} +3 -3
  77. package/dist/{chunk-UVVVR4XO.js.map → chunk-FKQNBCDW.js.map} +1 -1
  78. package/dist/{chunk-GEQSUC6U.js → chunk-GNZBFSRB.js} +3 -3
  79. package/dist/{chunk-GEQSUC6U.js.map → chunk-GNZBFSRB.js.map} +1 -1
  80. package/dist/{chunk-U56GGCC2.js → chunk-HMISULVD.js} +4 -4
  81. package/dist/{chunk-U56GGCC2.js.map → chunk-HMISULVD.js.map} +1 -1
  82. package/dist/{chunk-GN4VVSAA.js → chunk-HPMQRAIF.js} +7 -7
  83. package/dist/{chunk-GN4VVSAA.js.map → chunk-HPMQRAIF.js.map} +1 -1
  84. package/dist/{chunk-OAHVKSQJ.js → chunk-HWNK3F3X.js} +913 -80
  85. package/dist/chunk-HWNK3F3X.js.map +1 -0
  86. package/dist/{chunk-NMI2TWMH.js → chunk-IHFGPHCT.js} +131 -341
  87. package/dist/chunk-IHFGPHCT.js.map +1 -0
  88. package/dist/{chunk-F2GOZMRA.js → chunk-ILLTBKDJ.js} +47 -47
  89. package/dist/chunk-ILLTBKDJ.js.map +1 -0
  90. package/dist/{chunk-FKU57Q5Q.js → chunk-IRYKRKVQ.js} +3 -3
  91. package/dist/{chunk-FKU57Q5Q.js.map → chunk-IRYKRKVQ.js.map} +1 -1
  92. package/dist/{chunk-T2BDID2J.js → chunk-J72MO2WA.js} +8 -8
  93. package/dist/{chunk-T2BDID2J.js.map → chunk-J72MO2WA.js.map} +1 -1
  94. package/dist/{chunk-X3RMRJNR.js → chunk-JRN5QF4C.js} +8 -3
  95. package/dist/chunk-JRN5QF4C.js.map +1 -0
  96. package/dist/{chunk-E3GPGTW3.js → chunk-KUQAJVYT.js} +5 -5
  97. package/dist/{chunk-E3GPGTW3.js.map → chunk-KUQAJVYT.js.map} +1 -1
  98. package/dist/{chunk-WDXZA7QW.js → chunk-LSSYC5IC.js} +2 -2
  99. package/dist/{chunk-WDXZA7QW.js.map → chunk-LSSYC5IC.js.map} +1 -1
  100. package/dist/{chunk-3IXIEHUB.js → chunk-NB7SYQYP.js} +5 -5
  101. package/dist/{chunk-3IXIEHUB.js.map → chunk-NB7SYQYP.js.map} +1 -1
  102. package/dist/{chunk-3JKGY2YC.js → chunk-NUA33BYO.js} +149 -27
  103. package/dist/chunk-NUA33BYO.js.map +1 -0
  104. package/dist/{chunk-VBI7HGHB.js → chunk-QAKUD6QN.js} +2 -2
  105. package/dist/{chunk-VBI7HGHB.js.map → chunk-QAKUD6QN.js.map} +1 -1
  106. package/dist/{chunk-KX2PT5Q4.js → chunk-QEULL4Q3.js} +4 -4
  107. package/dist/{chunk-KX2PT5Q4.js.map → chunk-QEULL4Q3.js.map} +1 -1
  108. package/dist/{chunk-YGRZNFRO.js → chunk-QSYQOTWN.js} +3 -3
  109. package/dist/{chunk-YGRZNFRO.js.map → chunk-QSYQOTWN.js.map} +1 -1
  110. package/dist/{chunk-DHYSUJ3H.js → chunk-RDTLPOPD.js} +4 -4
  111. package/dist/{chunk-DHYSUJ3H.js.map → chunk-RDTLPOPD.js.map} +1 -1
  112. package/dist/{chunk-GOCWM7FN.js → chunk-RHN5MRQO.js} +21 -4
  113. package/dist/chunk-RHN5MRQO.js.map +1 -0
  114. package/dist/{chunk-UL22SDGR.js → chunk-S2XHGWQC.js} +161 -123
  115. package/dist/chunk-S2XHGWQC.js.map +1 -0
  116. package/dist/{chunk-4DWBSTYA.js → chunk-SVTMNSPI.js} +22 -5
  117. package/dist/chunk-SVTMNSPI.js.map +1 -0
  118. package/dist/{chunk-QOM5Z62G.js → chunk-UI745XC3.js} +9 -22
  119. package/dist/chunk-UI745XC3.js.map +1 -0
  120. package/dist/{chunk-L4YKW5AY.js → chunk-VMVDAZLA.js} +20 -8
  121. package/dist/chunk-VMVDAZLA.js.map +1 -0
  122. package/dist/{chunk-H6UVIKQ2.js → chunk-VYVTEMAW.js} +3 -3
  123. package/dist/{chunk-H6UVIKQ2.js.map → chunk-VYVTEMAW.js.map} +1 -1
  124. package/dist/{chunk-SRODW6M2.js → chunk-X3YGUKCG.js} +3 -3
  125. package/dist/{chunk-SRODW6M2.js.map → chunk-X3YGUKCG.js.map} +1 -1
  126. package/dist/{chunk-JDR6ILCW.js → chunk-XGULGQA3.js} +3 -3
  127. package/dist/{chunk-JDR6ILCW.js.map → chunk-XGULGQA3.js.map} +1 -1
  128. package/dist/{chunk-7XSAW5OC.js → chunk-YLLVSR2U.js} +4 -4
  129. package/dist/{chunk-7XSAW5OC.js.map → chunk-YLLVSR2U.js.map} +1 -1
  130. package/dist/{chunk-6Z5KTFJT.js → chunk-Z3VKUWAX.js} +3 -3
  131. package/dist/{chunk-6Z5KTFJT.js.map → chunk-Z3VKUWAX.js.map} +1 -1
  132. package/dist/{chunk-7TPYPVAH.js → chunk-ZAELRYKS.js} +3 -3
  133. package/dist/{chunk-7TPYPVAH.js.map → chunk-ZAELRYKS.js.map} +1 -1
  134. package/dist/{chunk-UQ33Y4DM.js → chunk-ZBHZLWV3.js} +4 -4
  135. package/dist/{chunk-UQ33Y4DM.js.map → chunk-ZBHZLWV3.js.map} +1 -1
  136. package/dist/{chunk-OTIB4D2K.js → chunk-ZDLUQLI6.js} +4 -4
  137. package/dist/{chunk-OTIB4D2K.js.map → chunk-ZDLUQLI6.js.map} +1 -1
  138. package/dist/{chunk-OHNKYHRR.js → chunk-ZHGKAZJ7.js} +214 -16
  139. package/dist/chunk-ZHGKAZJ7.js.map +1 -0
  140. package/dist/{claude-code-VJGYBXQR.js → claude-code-RE46FJXI.js} +4 -4
  141. package/dist/{claude-code-VJGYBXQR.js.map → claude-code-RE46FJXI.js.map} +1 -1
  142. package/dist/cli/index.js +704 -448
  143. package/dist/cli/index.js.map +1 -1
  144. package/dist/cli/src/agent-pins.d.ts +11 -0
  145. package/dist/cli/src/agent-pins.d.ts.map +1 -1
  146. package/dist/cli/src/commands/catalog.d.ts +1 -1
  147. package/dist/cli/src/commands/catalog.d.ts.map +1 -1
  148. package/dist/cli/src/commands/config.d.ts.map +1 -1
  149. package/dist/cli/src/commands/diff.d.ts.map +1 -1
  150. package/dist/cli/src/commands/harness.d.ts +24 -0
  151. package/dist/cli/src/commands/harness.d.ts.map +1 -0
  152. package/dist/cli/src/commands/integration.d.ts.map +1 -1
  153. package/dist/cli/src/commands/library-cmd.d.ts.map +1 -1
  154. package/dist/cli/src/commands/library-index.d.ts +20 -2
  155. package/dist/cli/src/commands/library-index.d.ts.map +1 -1
  156. package/dist/cli/src/commands/library-publish.d.ts.map +1 -1
  157. package/dist/cli/src/commands/migrate-assets.d.ts.map +1 -1
  158. package/dist/cli/src/commands/project.d.ts +19 -1
  159. package/dist/cli/src/commands/project.d.ts.map +1 -1
  160. package/dist/cli/src/commands/run.d.ts.map +1 -1
  161. package/dist/cli/src/commands/serve-preflight.d.ts.map +1 -1
  162. package/dist/cli/src/commands/session-logs/local-query.d.ts +2 -0
  163. package/dist/cli/src/commands/session-logs/local-query.d.ts.map +1 -1
  164. package/dist/cli/src/commands/source.d.ts +9 -2
  165. package/dist/cli/src/commands/source.d.ts.map +1 -1
  166. package/dist/cli/src/commands/store.d.ts.map +1 -1
  167. package/dist/cli/src/commands/update.d.ts.map +1 -1
  168. package/dist/cli/src/commands/validate.d.ts.map +1 -1
  169. package/dist/cli/src/config-checks.d.ts +37 -0
  170. package/dist/cli/src/config-checks.d.ts.map +1 -0
  171. package/dist/cli/src/skill-checks.d.ts +27 -0
  172. package/dist/cli/src/skill-checks.d.ts.map +1 -1
  173. package/dist/cli/src/store-addable.d.ts +11 -0
  174. package/dist/cli/src/store-addable.d.ts.map +1 -1
  175. package/dist/connectors/config.js +5 -5
  176. package/dist/connectors/index.js +18 -18
  177. package/dist/{connectors-CXZLXAFZ.js → connectors-7THEF7YA.js} +21 -21
  178. package/dist/{connectors-CXZLXAFZ.js.map → connectors-7THEF7YA.js.map} +1 -1
  179. package/dist/core/index.js +6 -6
  180. package/dist/core/manifest.js +2 -2
  181. package/dist/core/models.js +1 -1
  182. package/dist/core/publish-manifest.js +3 -3
  183. package/dist/core/ref.js +1 -1
  184. package/dist/core/runtime-assets.js +5 -5
  185. package/dist/core/src/agent-instances.d.ts.map +1 -1
  186. package/dist/core/src/config-key-diagnostics.d.ts +9 -0
  187. package/dist/core/src/config-key-diagnostics.d.ts.map +1 -0
  188. package/dist/core/src/index.d.ts +1 -1
  189. package/dist/core/src/index.d.ts.map +1 -1
  190. package/dist/core/src/manifest.d.ts +10 -0
  191. package/dist/core/src/manifest.d.ts.map +1 -1
  192. package/dist/core/src/models.d.ts +8 -0
  193. package/dist/core/src/models.d.ts.map +1 -1
  194. package/dist/core/src/workspace-config.d.ts +8 -0
  195. package/dist/core/src/workspace-config.d.ts.map +1 -1
  196. package/dist/core/src/workspace-yaml-editor.d.ts +9 -2
  197. package/dist/core/src/workspace-yaml-editor.d.ts.map +1 -1
  198. package/dist/core/workspace-config.js +4 -4
  199. package/dist/deploy/index.js +6 -6
  200. package/dist/discovery/index.js +4 -4
  201. package/dist/discovery/src/builtin-providers.d.ts.map +1 -1
  202. package/dist/discovery/src/parse-manifest.d.ts.map +1 -1
  203. package/dist/{ensure-sources-UPTHZKGF.js → ensure-sources-IH7CHSJF.js} +16 -16
  204. package/dist/{ensure-sources-UPTHZKGF.js.map → ensure-sources-IH7CHSJF.js.map} +1 -1
  205. package/dist/factory-assets/connectors/box.js +18 -18
  206. package/dist/factory-assets/connectors/deploy.js +18 -18
  207. package/dist/factory-assets/connectors/devserver.js +18 -18
  208. package/dist/factory-assets/connectors/flow/adapter.js +18 -18
  209. package/dist/factory-assets/connectors/flow/contract/normalize.d.ts.map +1 -1
  210. package/dist/factory-assets/connectors/flow/contract.js +1 -1
  211. package/dist/factory-assets/connectors/flow/engine.js +8 -8
  212. package/dist/factory-assets/connectors/flow/run-flow.js +20 -20
  213. package/dist/factory-assets/connectors/flow.js +18 -18
  214. package/dist/factory-assets/connectors/git.js +18 -18
  215. package/dist/factory-assets/connectors/gmail.js +18 -18
  216. package/dist/factory-assets/connectors/googledrive.js +18 -18
  217. package/dist/factory-assets/connectors/local.js +18 -18
  218. package/dist/factory-assets/connectors/mattermost.js +18 -18
  219. package/dist/factory-assets/connectors/memory.js +18 -18
  220. package/dist/factory-assets/connectors/minio.js +18 -18
  221. package/dist/factory-assets/connectors/postgres.js +18 -18
  222. package/dist/factory-assets/connectors/s3.js +18 -18
  223. package/dist/factory-assets/connectors/sharepoint.js +18 -18
  224. package/dist/factory-assets/connectors/sqlite.js +18 -18
  225. package/dist/factory-assets/connectors/static-server.js +18 -18
  226. package/dist/factory-assets/connectors/tunnel.js +18 -18
  227. package/dist/factory-assets/connectors/webdav.js +18 -18
  228. package/dist/factory-assets/connectors/xstate-store.js +18 -18
  229. package/dist/factory-assets/connectors/xstate.js +18 -18
  230. package/dist/factory-assets/skills/authoring-skaile-assets/SKILL.md +1 -1
  231. package/dist/factory-assets/skills/authoring-skaile-manifests/SKILL.md +2 -2
  232. package/dist/factory-assets/skills/authoring-skaile-manifests/references/dependency-standard.md +3 -3
  233. package/dist/{flows-TJQIMGUX.js → flows-4JZQ3XFK.js} +11 -11
  234. package/dist/{flows-TJQIMGUX.js.map → flows-4JZQ3XFK.js.map} +1 -1
  235. package/dist/{helpers-DE53KG3E.js → helpers-JNMK3FC2.js} +16 -16
  236. package/dist/{helpers-DE53KG3E.js.map → helpers-JNMK3FC2.js.map} +1 -1
  237. package/dist/library/index.js +9 -9
  238. package/dist/library/install.js +4 -4
  239. package/dist/library/src/index.d.ts +1 -1
  240. package/dist/library/src/index.d.ts.map +1 -1
  241. package/dist/library/src/local/library-dir.d.ts +22 -5
  242. package/dist/library/src/local/library-dir.d.ts.map +1 -1
  243. package/dist/library/src/local/local-catalog-source.d.ts.map +1 -1
  244. package/dist/library/src/remote/remote-catalog-source.d.ts +6 -0
  245. package/dist/library/src/remote/remote-catalog-source.d.ts.map +1 -1
  246. package/dist/{library-publish-KKQ2ULLX.js → library-publish-I3UWXAHI.js} +52 -50
  247. package/dist/library-publish-I3UWXAHI.js.map +1 -0
  248. package/dist/model-endpoint/index.js +9 -9
  249. package/dist/{open-library-RJGJIW5H.js → open-library-NKKUJLWA.js} +19 -19
  250. package/dist/{open-library-RJGJIW5H.js.map → open-library-NKKUJLWA.js.map} +1 -1
  251. package/dist/{open-registry-3QS3J7KO.js → open-registry-BYAXSHUI.js} +14 -14
  252. package/dist/{open-registry-3QS3J7KO.js.map → open-registry-BYAXSHUI.js.map} +1 -1
  253. package/dist/{paths-QAV4C3KX.js → paths-UKWE35XS.js} +9 -9
  254. package/dist/{paths-QAV4C3KX.js.map → paths-UKWE35XS.js.map} +1 -1
  255. package/dist/{plugin-store-MSH6GK6T.js → plugin-store-ABE35NRX.js} +9 -9
  256. package/dist/{plugin-store-MSH6GK6T.js.map → plugin-store-ABE35NRX.js.map} +1 -1
  257. package/dist/project-BIPK47JK.js +86 -0
  258. package/dist/{project-HZW2MZPA.js.map → project-BIPK47JK.js.map} +1 -1
  259. package/dist/resolver/index.js +7 -7
  260. package/dist/runner/index.js +33 -33
  261. package/dist/runner/src/composition/content-source.d.ts.map +1 -1
  262. package/dist/runner/src/composition/errors.d.ts +16 -1
  263. package/dist/runner/src/composition/errors.d.ts.map +1 -1
  264. package/dist/runner/src/credential-notice.d.ts +3 -3
  265. package/dist/runner/src/credential-notice.d.ts.map +1 -1
  266. package/dist/runner/src/serve.d.ts +14 -2
  267. package/dist/runner/src/serve.d.ts.map +1 -1
  268. package/dist/sdk/asset-manager.js +13 -13
  269. package/dist/sdk/bridge.js +14 -14
  270. package/dist/sdk/core.js +6 -6
  271. package/dist/sdk/flow.js +8 -8
  272. package/dist/sdk/index.js +33 -33
  273. package/dist/sdk/resolver.js +7 -7
  274. package/dist/sdk/runner.js +33 -33
  275. package/dist/sdk/transport/ws/server.js +7 -7
  276. package/dist/sdk/transport/ws.js +7 -7
  277. package/dist/sdk/transport.js +7 -7
  278. package/dist/{serve-preflight-L4POEHNQ.js → serve-preflight-FLTIBTEX.js} +28 -29
  279. package/dist/serve-preflight-FLTIBTEX.js.map +1 -0
  280. package/dist/{setup-AGYB4PKR.js → setup-AG6NFHSN.js} +25 -25
  281. package/dist/{setup-AGYB4PKR.js.map → setup-AG6NFHSN.js.map} +1 -1
  282. package/dist/{skills-2LMQ2IAD.js → skills-UQYUHVKO.js} +12 -12
  283. package/dist/{skills-2LMQ2IAD.js.map → skills-UQYUHVKO.js.map} +1 -1
  284. package/dist/source-ASEHI2XS.js +85 -0
  285. package/dist/{source-GBMYD3RO.js.map → source-ASEHI2XS.js.map} +1 -1
  286. package/dist/{source-manifest-publish-FK22TVQT.js → source-manifest-publish-IEVV3W6J.js} +45 -45
  287. package/dist/{source-manifest-publish-FK22TVQT.js.map → source-manifest-publish-IEVV3W6J.js.map} +1 -1
  288. package/dist/transport/index.js +7 -7
  289. package/dist/transport/ws/server.js +7 -7
  290. package/dist/transport/ws.js +7 -7
  291. package/dist/tui/index.js +33 -33
  292. package/dist/types/src/install-manifest.d.ts +1 -1
  293. package/dist/types/src/install-manifest.d.ts.map +1 -1
  294. package/dist/workspace-plugin/adapters/mcp.js +25 -25
  295. package/dist/workspace-plugin/adapters/omp.js +14 -14
  296. package/dist/workspace-plugin/index.js +1 -1
  297. package/package.json +1 -1
  298. package/dist/asset-feeds-PXUWCXVI.js.map +0 -1
  299. package/dist/chunk-3JKGY2YC.js.map +0 -1
  300. package/dist/chunk-4DWBSTYA.js.map +0 -1
  301. package/dist/chunk-4XWLB7JB.js.map +0 -1
  302. package/dist/chunk-F2GOZMRA.js.map +0 -1
  303. package/dist/chunk-GOCWM7FN.js.map +0 -1
  304. package/dist/chunk-L4YKW5AY.js.map +0 -1
  305. package/dist/chunk-NMI2TWMH.js.map +0 -1
  306. package/dist/chunk-OAHVKSQJ.js.map +0 -1
  307. package/dist/chunk-OHNKYHRR.js.map +0 -1
  308. package/dist/chunk-PUK7TQT4.js +0 -13
  309. package/dist/chunk-PUK7TQT4.js.map +0 -1
  310. package/dist/chunk-QOM5Z62G.js.map +0 -1
  311. package/dist/chunk-TKHJXPSB.js.map +0 -1
  312. package/dist/chunk-UL22SDGR.js.map +0 -1
  313. package/dist/chunk-VJRTDKXS.js.map +0 -1
  314. package/dist/chunk-WEH33JSG.js.map +0 -1
  315. package/dist/chunk-WYHQUCHR.js.map +0 -1
  316. package/dist/chunk-X3RMRJNR.js.map +0 -1
  317. package/dist/library-publish-KKQ2ULLX.js.map +0 -1
  318. package/dist/project-HZW2MZPA.js +0 -84
  319. package/dist/serve-preflight-L4POEHNQ.js.map +0 -1
  320. package/dist/source-GBMYD3RO.js +0 -85
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../bridge/src/harness-model-check.ts","../bridge/src/normalizer.ts","../bridge/src/runtime.ts","../bridge/src/validation.ts"],"names":["path"],"mappings":";;;;;;;;;;;;AAmCA,SAAS,gBAAgB,SAAA,EAAoD;AAC3E,EAAA,IAAI,cAAc,OAAA,EAAS,2BAAW,GAAA,CAAI,CAAC,QAAQ,CAAC,CAAA;AACpD,EAAA,IAAI,cAAc,YAAA,EAAc,2BAAW,GAAA,CAAI,CAAC,WAAW,CAAC,CAAA;AAC5D,EAAA,IAAI,SAAA,KAAc,OAAO,OAAO,IAAI,IAAI,MAAA,CAAO,IAAA,CAAK,mBAAmB,CAAC,CAAA;AACxE,EAAA,OAAO,MAAA;AACT;AAOA,SAAS,UAAA,GAAoE;AAC3E,EAAA,MAAM,GAAA,GAAM,OAAA,CAAQ,GAAA,CAAI,mBAAA,IAAuB,IAAA,CAAK,KAAK,EAAA,CAAG,OAAA,EAAQ,EAAG,MAAA,EAAQ,OAAO,CAAA;AACtF,EAAA,MAAM,SAAA,uBAAgB,GAAA,EAAY;AAClC,EAAA,IAAI;AACF,IAAA,MAAM,GAAA,GAAM,MAAM,YAAA,CAAa,IAAA,CAAK,KAAK,GAAA,EAAK,YAAY,CAAA,EAAG,OAAO,CAAC,CAAA;AAGrE,IAAA,MAAM,QAAQ,GAAA,EAAK,SAAA;AACnB,IAAA,IAAI,KAAA,IAAS,OAAO,KAAA,KAAU,QAAA,IAAY,CAAC,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG;AAC/D,MAAA,KAAA,MAAW,MAAM,MAAA,CAAO,IAAA,CAAK,KAAK,CAAA,EAAG,SAAA,CAAU,IAAI,EAAE,CAAA;AAAA,IACvD;AAAA,EACF,CAAA,CAAA,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AA,EAAG;AAAA,EAC3D,SAAS,GAAA,EAAU;AACjB,IAAA,IAAI,GAAA,CAAI,SAAS,YAAA,EAAc,OAAO,EAAE,EAAA,EAAI,KAAA,EAAO,OAAO,wBAAA,EAAyB;AACnF,IAAA,OAAO,EAAE,EAAA,EAAI,KAAA,EAAO,KAAA,EAAO,GAAA,CAAI,WAAW,eAAA,EAAgB;AAAA,EAC5D;AACF","file":"chunk-4XWLB7JB.js","sourcesContent":["/**\n * Pre-flight model check: would the harness refuse the selected model before it starts a turn?\n *\n * `skaile run --dry-run` uses it so a setup check learns about a refusal that a real run would\n * print. The codex harness refuses a selection up front when it cannot address the AI provider\n * surface; codex, omp and the Claude SDK refuse a provider nothing serves\n * ({@link checkModelProvider}); every other harness answers `undefined`.\n */\nimport { existsSync, readFileSync } from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport {\n type AIProviderRegistry,\n isEntryEnabled,\n type MergedAIProviderRegistry,\n registryEntries,\n} from \"@skaile/workspaces/core/provider-registry\";\nimport { parse } from \"yaml\";\nimport { buildCodexConfigDocument } from \"./codex/config-toml.js\";\nimport { ompRegistryModelRefusal } from \"./harnesses/omp-models-yml.js\";\nimport { AI_PROVIDER_PRESETS } from \"./provider-catalog.js\";\n\n/** What {@link checkHarnessModel} reads. */\nexport interface HarnessModelCheckInput {\n registry?: AIProviderRegistry | MergedAIProviderRegistry;\n /** The model selector: `<providerId>/<modelId>`, a bare id or `@role`. */\n model?: string;\n roles?: Record<string, string>;\n}\n\n/**\n * Providers a harness reaches with its own login, without a registry entry: codex talks to\n * OpenAI, the Claude SDK to Anthropic, omp to every vendor it ships a login for. A harness not\n * listed here (a plugin's, `echo`) is not checked.\n */\nfunction nativeProviders(harnessId: string): ReadonlySet<string> | undefined {\n if (harnessId === \"codex\") return new Set([\"openai\"]);\n if (harnessId === \"claude-sdk\") return new Set([\"anthropic\"]);\n if (harnessId === \"omp\") return new Set(Object.keys(AI_PROVIDER_PRESETS));\n return undefined;\n}\n\n/**\n * What omp can serve on the user's own agent directory (`PI_CODING_AGENT_DIR`, else\n * `~/.omp/agent`): the provider ids their `models.yml` defines, and whether they have a login\n * (`agent.db`), which may carry built-in providers this list cannot name (p1111).\n */\nfunction ompOwnHome(): { providers: ReadonlySet<string>; hasLogin: boolean } {\n const dir = process.env.PI_CODING_AGENT_DIR || path.join(os.homedir(), \".omp\", \"agent\");\n const providers = new Set<string>();\n try {\n const doc = parse(readFileSync(path.join(dir, \"models.yml\"), \"utf-8\")) as {\n providers?: unknown;\n } | null;\n const block = doc?.providers;\n if (block && typeof block === \"object\" && !Array.isArray(block)) {\n for (const id of Object.keys(block)) providers.add(id);\n }\n } catch {\n // no models.yml, or one omp itself will reject\n }\n return { providers, hasLogin: existsSync(path.join(dir, \"agent.db\")) };\n}\n\n/**\n * `<provider>/<model>` whose provider nothing can serve: not a registry entry and not a\n * provider the harness has its own login for. Without this the id goes to the harness's default\n * provider verbatim and fails there with a message that blames the login.\n *\n * The rule differs per harness (p1111). omp and the Claude SDK route through a registry entry,\n * so while any enabled registry entry is left they take an unknown head as a vendor-scoped\n * model id (`meta-llama/Llama-3.3-70B`). codex talks to OpenAI only and cannot, so it refuses\n * a head that is neither a registered provider nor `openai`, whatever else is registered.\n */\nexport function checkModelProvider(\n harnessId: string,\n input: HarnessModelCheckInput,\n): string | undefined {\n const native = nativeProviders(harnessId);\n let selector = input.model?.trim() ?? \"\";\n if (selector.startsWith(\"@\")) selector = input.roles?.[selector.slice(1)]?.trim() ?? \"\";\n const slash = selector.indexOf(\"/\");\n if (!native || slash <= 0 || selector.startsWith(\"@\")) return undefined;\n const head = selector.slice(0, slash);\n if (native.has(head)) return undefined;\n const entries = input.registry ? registryEntries(input.registry) : [];\n if (entries.some(([id]) => id === head)) return undefined;\n const servesVendorIds =\n harnessId !== \"codex\" &&\n entries.some(\n ([, entry]) => (entry.kind === \"llm\" || entry.kind === \"embed\") && isEntryEnabled(entry),\n );\n if (servesVendorIds) return undefined;\n if (harnessId === \"omp\") {\n // With no registry entry omp runs on the user's own agent directory: their `models.yml`\n // providers and the logins omp ships are served there.\n const own = ompOwnHome();\n if (own.providers.has(head) || own.hasLogin) return undefined;\n }\n return `provider '${head}' is not configured: run skaile providers list`;\n}\n\n/**\n * The refusal message the harness prints for this model, or `undefined` when it takes it.\n * The text matches the one the harness throws at start.\n */\nexport function checkHarnessModel(\n harnessId: string,\n input: HarnessModelCheckInput,\n): string | undefined {\n const unknownProvider = checkModelProvider(harnessId, input);\n if (unknownProvider) return unknownProvider;\n if (harnessId === \"omp\") {\n let selector = input.model?.trim() ?? \"\";\n if (selector.startsWith(\"@\")) selector = input.roles?.[selector.slice(1)]?.trim() ?? \"\";\n return ompRegistryModelRefusal(input.registry, selector, nativeProviders(\"omp\") ?? new Set());\n }\n if (harnessId !== \"codex\") return undefined;\n const build = buildCodexConfigDocument({\n registry: input.registry,\n ...(input.model ? { modelRef: input.model, model: input.model } : {}),\n ...(input.roles ? { roles: input.roles } : {}),\n });\n if (!build.unaddressable) return undefined;\n const { id, reason } = build.unaddressable;\n return `AI provider '${id}' cannot be used with the codex harness: ${reason}. Pick a model of another provider.`;\n}\n","/**\n * EventNormalizer — converts bridge-level AgentEvent (raw harness events) to\n * skaile-agent-types AgentEvent (normalized, human-readable events).\n *\n * Stateful: tracks active subagents and dev-server detection across a session.\n * Call reset() between sessions.\n */\n\nimport {\n type AgentEvent as NormalizedEvent,\n type NativeApprovalDescription,\n stripActivityLabel,\n TOOL_ACTIVITY_LABEL_MAX_CHARS,\n TOOL_ACTIVITY_LABEL_PARAM,\n} from \"@skaile/workspaces/types\";\nimport { classifyClaudeSdkError } from \"./error-classifier.js\";\nimport type { AgentMessage, AgentEvent as BridgeEvent, ContentBlock } from \"./types.js\";\n\n/**\n * The optional usage keys a `result` event carries, in the shape both\n * `finished` and a result-sourced `error` emit them. Absent keys stay absent.\n */\nfunction resultUsageFields(\n event: Pick<\n Extract<BridgeEvent, { type: \"result\" | \"error\" }>,\n \"tokens\" | \"modelUsage\" | \"contextTokens\" | \"contextWindow\"\n >,\n) {\n return {\n ...(event.tokens ? { tokens: event.tokens } : {}),\n ...(event.modelUsage ? { modelUsage: event.modelUsage } : {}),\n ...(typeof event.contextTokens === \"number\" ? { contextTokens: event.contextTokens } : {}),\n ...(typeof event.contextWindow === \"number\" ? { contextWindow: event.contextWindow } : {}),\n };\n}\n\n/**\n * The tool a harness uses to park a turn on a human answer. Both branches that\n * recognise it must use this constant: `message_start` turns it into a\n * `question`, and `tool_call` must then stay silent about it.\n */\nconst QUESTION_TOOL = \"AskUserQuestion\";\n\nconst MAX_ANNOUNCED_TOOL_USES = 64;\n\n/**\n * Bridge `tool_call` inputs are loosely typed: Codex MCP arguments may arrive\n * as a JSON string, and the echo harness passes a bare path.\n */\nfunction toolInputRecord(input: unknown): Record<string, unknown> {\n let value = input;\n if (typeof value === \"string\") {\n try {\n value = JSON.parse(value);\n } catch {\n return { input };\n }\n }\n if (typeof value === \"object\" && value !== null && !Array.isArray(value)) {\n return value as Record<string, unknown>;\n }\n return value === undefined ? {} : { input };\n}\n\n/**\n * Converts raw bridge-level {@link BridgeEvent} payloads into normalized\n * `@skaile/workspaces/types` `AgentEvent` payloads consumed by the runner and transport.\n *\n * Stateful: tracks active subagents and dev-server detection across a session.\n * Call {@link EventNormalizer.reset} between sessions to clear accumulated state.\n *\n * @docLink packages/bridge/api-reference#normalizer\n */\nexport class EventNormalizer {\n private activeSubagents = new Map<string, string>();\n private devServerStartingEmitted = false;\n private devServerReadyEmitted = false;\n /** True when message_update deltas have been emitted for the current message. */\n private hasStreamedText = false;\n /**\n * True once a `_thinkingDelta` run has been reported as `status: thinking`;\n * cleared by the next text delta or assistant message, so a run reports once.\n */\n private thinkingAnnounced = false;\n /**\n * tool_use blocks `message_start` already reported, awaiting the harness's\n * matching bridge `tool_call` — which must then not report the call again.\n */\n private announcedToolUses: Array<{ id?: string; name: string }> = [];\n\n /**\n * Convert a single bridge event into zero or more normalized events.\n * One bridge event can produce multiple normalized events (e.g., a message_start\n * with text + tool_use blocks produces both text and tool_call events).\n */\n normalize(event: BridgeEvent): NormalizedEvent[] {\n switch (event.type) {\n case \"message_start\":\n return this.handleMessageStart(event.message);\n\n case \"message_update\":\n return this.handleMessageUpdate(event);\n\n case \"message_end\":\n return [];\n\n case \"message_retract\":\n // The replay streams its reply afresh, so its deltas (or, failing\n // those, its message_start text) must count as a new message.\n this.hasStreamedText = false;\n return event.text ? [{ type: \"text_retract\", content: event.text }] : [];\n\n case \"turn_end\":\n return this.handleTurnEnd(event.toolResults);\n\n case \"result\":\n return this.handleResult(event);\n\n case \"error\":\n this.announcedToolUses = [];\n return [\n {\n type: \"error\",\n message: event.error,\n fatal: event.fatal ?? true,\n category: event.detail?.category,\n ...(event.detail?.hint ? { hint: event.detail.hint } : {}),\n ...resultUsageFields(event),\n ...(event.retrying === true\n ? { retrying: true, ...(event.retryReason ? { retryReason: event.retryReason } : {}) }\n : {}),\n ...(event.selfStarted === true ? { selfStarted: true as const } : {}),\n },\n ];\n\n case \"background_task_started\":\n return [{ type: \"background_task_started\", taskId: event.taskId }];\n\n case \"self_turn_started\":\n return [{ type: \"self_turn_started\", taskIds: [...event.taskIds] }];\n\n case \"tool_call\": {\n // The question tool parks the turn on the user's answer, so reporting\n // work here would undo the idle its `question` event just set, and\n // nothing follows to correct it while the user reads the prompt.\n const toolName = event.name ?? event.tool?.name;\n if (toolName === QUESTION_TOOL) return [];\n // A harness that also sent the call as a `message_start` tool_use block\n // (Claude) was already reported there; the rest only ever send this.\n if (!toolName || this.consumeAnnouncedToolUse(toolName, event.toolCallId)) {\n return [{ type: \"status\", phase: \"working\" }];\n }\n return this.handleToolUse(\n {\n type: \"tool_use\",\n id: typeof event.toolCallId === \"string\" ? event.toolCallId : undefined,\n name: toolName,\n input: toolInputRecord(event.input),\n },\n typeof event.parentToolUseId === \"string\" ? event.parentToolUseId : undefined,\n );\n }\n\n case \"tool_execution_end\":\n return [];\n\n case \"agent_end\":\n this.announcedToolUses = [];\n return [{ type: \"status\", phase: \"idle\" }];\n\n case \"commands_available\":\n // Pass through to transport — the gateway caches this event\n return [event as unknown as NormalizedEvent];\n\n case \"session_info\":\n // Pass through to transport — the forge layer stores the OMP session ID\n return [event as unknown as NormalizedEvent];\n\n case \"ui_render\":\n case \"ui_render_update\":\n case \"ui_clear\":\n // Pass through verbatim — harnesses that implement the Agent UI Protocol emit these directly\n return [event as unknown as NormalizedEvent];\n\n default:\n return [];\n }\n }\n\n /** Clear all stateful tracking between sessions. */\n reset(): void {\n this.activeSubagents.clear();\n this.devServerStartingEmitted = false;\n this.devServerReadyEmitted = false;\n this.hasStreamedText = false;\n this.thinkingAnnounced = false;\n this.announcedToolUses = [];\n }\n\n private consumeAnnouncedToolUse(name: string, id: unknown): boolean {\n const callId = typeof id === \"string\" ? id : undefined;\n const index = this.announcedToolUses.findIndex(\n (entry) => entry.name === name && (!callId || !entry.id || entry.id === callId),\n );\n if (index === -1) return false;\n this.announcedToolUses.splice(index, 1);\n return true;\n }\n\n // ---------------------------------------------------------------------------\n // message_start → text, tool_call, question, subagent\n // ---------------------------------------------------------------------------\n\n private handleMessageStart(message: AgentMessage): NormalizedEvent[] {\n // Only process assistant messages. Harnesses (e.g. omp) may echo the user's\n // message as a message_start with role:\"user\" before streaming the response.\n // Emitting a text event for that echo would prepend the user's input to the\n // assistant bubble on the frontend.\n if (message.role !== \"assistant\") return [];\n\n // A subagent's message is not the main reply: its text belongs to the\n // subagent's own result, and it must not reset the main stream's state.\n const parentToolUseId = message.parentToolUseId;\n const events: NormalizedEvent[] = [];\n const blocks = this.getContentBlocks(message);\n\n for (const block of blocks) {\n if (block.type === \"text\" && block.text) {\n if (parentToolUseId) continue;\n // Skip full text if we already streamed it via message_update deltas\n if (!this.hasStreamedText) {\n events.push({ type: \"text\", content: block.text });\n }\n } else if (block.type === \"tool_use\" && block.name) {\n if (block.name !== QUESTION_TOOL) {\n this.announcedToolUses.push({ id: block.id, name: block.name });\n // Bounded in case a harness never echoes a block as a tool_call.\n if (this.announcedToolUses.length > MAX_ANNOUNCED_TOOL_USES) {\n this.announcedToolUses.shift();\n }\n }\n events.push(...this.handleToolUse(block, parentToolUseId));\n }\n }\n\n if (!parentToolUseId) this.hasStreamedText = false;\n if (!parentToolUseId) this.thinkingAnnounced = false;\n return events;\n }\n\n private handleToolUse(block: ContentBlock, parentToolUseId?: string): NormalizedEvent[] {\n const name = block.name!;\n const input = (block.input ?? {}) as Record<string, unknown>;\n\n if (name === QUESTION_TOOL) {\n return this.handleAskUserQuestion(input);\n }\n if (name === \"Agent\") {\n return this.handleAgentToolUse(block, input);\n }\n return this.handleGenericToolUse(name, input, parentToolUseId);\n }\n\n private handleAskUserQuestion(input: Record<string, unknown>): NormalizedEvent[] {\n const events: NormalizedEvent[] = [];\n const candidate = input.approval as Partial<NativeApprovalDescription> | undefined;\n const approval =\n candidate &&\n [\"command\", \"file\", \"permissions\", \"mcp\"].includes(candidate.kind ?? \"\") &&\n Array.isArray(candidate.details) &&\n candidate.details.length > 0 &&\n candidate.details.length <= 64 &&\n candidate.details.every((detail) => typeof detail === \"string\" && detail.length <= 8192) &&\n candidate.details.reduce((total, detail) => total + detail.length, 0) <= 65536\n ? (candidate as NativeApprovalDescription)\n : undefined;\n if (Object.hasOwn(input, \"approval\") && !approval) return [];\n // Claude SDK sends { questions: [{ question, header, options: [{ label, description }] }] }\n // Legacy/simple format sends { question: string, options?: string[] }\n const questions = input.questions;\n if (Array.isArray(questions)) {\n for (const q of questions) {\n const qObj = q as Record<string, unknown>;\n const question = String(qObj.question ?? \"\");\n const rawOpts = qObj.options;\n const options = Array.isArray(rawOpts)\n ? rawOpts.map((o: any) => (typeof o === \"string\" ? o : String(o.label ?? o)))\n : undefined;\n events.push({\n type: \"question\",\n question,\n options,\n ...(typeof input.requestId === \"string\" ? { requestId: input.requestId } : {}),\n ...(approval ? { approval } : {}),\n });\n }\n } else {\n const question = String(input.question ?? input.text ?? \"\");\n const rawOptions = input.options;\n const options = Array.isArray(rawOptions) ? rawOptions.map(String) : undefined;\n events.push({\n type: \"question\",\n question,\n options,\n ...(typeof input.requestId === \"string\" ? { requestId: input.requestId } : {}),\n ...(approval ? { approval } : {}),\n });\n }\n return events;\n }\n\n private handleAgentToolUse(\n block: ContentBlock,\n input: Record<string, unknown>,\n ): NormalizedEvent[] {\n const agentName = String(input.subagent_type ?? input.description ?? \"unknown\");\n const description = String(input.description ?? input.prompt ?? \"\").slice(0, 200);\n if (block.id) {\n this.activeSubagents.set(block.id, agentName);\n }\n return [\n { type: \"subagent\", name: agentName, status: \"started\", description },\n { type: \"status\", phase: \"working\" },\n ];\n }\n\n private handleGenericToolUse(\n name: string,\n input: Record<string, unknown>,\n parentToolUseId?: string,\n ): NormalizedEvent[] {\n const events: NormalizedEvent[] = [];\n const label = labelToolCall(name, input);\n events.push({\n type: \"tool_call\",\n tool: name,\n input,\n // Summarize without the label: it would eat the default branch's\n // 100-char argument budget and push the real args out.\n summary: summarizeToolCall(name, stripActivityLabel(input)),\n ...(label ? { label } : {}),\n ...(parentToolUseId ? { parentToolUseId } : {}),\n });\n events.push({ type: \"status\", phase: \"working\" });\n\n if (name === \"Bash\" && typeof input.command === \"string\") {\n const devEvent = this.detectDevServerStarting(input.command);\n if (devEvent) events.push(devEvent);\n }\n\n return events;\n }\n\n // ---------------------------------------------------------------------------\n // message_update → streaming text\n // ---------------------------------------------------------------------------\n\n private handleMessageUpdate(event: BridgeEvent): NormalizedEvent[] {\n // Bridge deltas carry no subagent tag: a harness must drop a subagent's\n // partials itself (claude-sdk does in handleStreamEvent), or they read as main text.\n const delta = (event as any)._textDelta as string | undefined;\n if (delta) {\n this.hasStreamedText = true;\n this.thinkingAnnounced = false;\n return [{ type: \"text\", content: delta }];\n }\n // The protocol has no thinking-content event, so reasoning surfaces as the\n // existing `thinking` phase, once per run. The text is never forwarded as\n // `text`; a harness keeps it out of `_textDelta`.\n const thinking: unknown = \"_thinkingDelta\" in event ? event._thinkingDelta : undefined;\n if (typeof thinking === \"string\" && thinking && !this.thinkingAnnounced) {\n this.thinkingAnnounced = true;\n return [{ type: \"status\", phase: \"thinking\" }];\n }\n return [];\n }\n\n // ---------------------------------------------------------------------------\n // turn_end → tool_result, subagent finished, file_changed, dev_server\n // ---------------------------------------------------------------------------\n\n private handleTurnEnd(toolResults?: AgentMessage[]): NormalizedEvent[] {\n if (!toolResults?.length) return [];\n\n const events: NormalizedEvent[] = [];\n\n for (const result of toolResults) {\n const toolName = result.toolName ?? \"unknown\";\n const outputData = result.data ?? result.content;\n const output = typeof outputData === \"string\" ? outputData : JSON.stringify(outputData);\n\n // Check if this is a subagent result\n if (toolName === \"Agent\" || this.isSubagentResult(result)) {\n events.push(...this.handleSubagentResult(result, output));\n } else {\n events.push(...this.handleToolResult(toolName, outputData, output, result.parentToolUseId));\n }\n }\n\n return events;\n }\n\n private handleSubagentResult(result: AgentMessage, output: string): NormalizedEvent[] {\n const events: NormalizedEvent[] = [];\n const agentName = this.resolveSubagentName(result);\n const description = output.slice(0, 200);\n events.push({ type: \"subagent\", name: agentName, status: \"finished\", description });\n\n if (agentName === \"dev-server\") {\n const devEvent = this.detectDevServerReady(output);\n if (devEvent) events.push(devEvent);\n }\n return events;\n }\n\n private handleToolResult(\n toolName: string,\n outputData: unknown,\n output: string,\n parentToolUseId?: string,\n ): NormalizedEvent[] {\n const events: NormalizedEvent[] = [];\n events.push({\n type: \"tool_result\",\n tool: toolName,\n output: outputData,\n summary: summarizeToolResult(toolName, outputData),\n ...(parentToolUseId ? { parentToolUseId } : {}),\n });\n\n // Detect file changes from Write/Edit results\n const fileEvents = detectFileChanges(toolName, outputData);\n if (fileEvents.length > 0) events.push(...fileEvents);\n\n // Detect dev server from Bash output\n if (toolName === \"Bash\") {\n const devEvent = this.detectDevServerReady(output);\n if (devEvent) events.push(devEvent);\n }\n return events;\n }\n\n private isSubagentResult(result: AgentMessage): boolean {\n // Check if the tool result's id maps to a tracked subagent\n if (result.toolName && this.activeSubagents.has(result.toolName)) return true;\n return false;\n }\n\n private resolveSubagentName(result: AgentMessage): string {\n // toolName on bridge AgentMessage is resolved from toolIdToName in the harness\n const name = result.toolName ? this.activeSubagents.get(result.toolName) : undefined;\n if (name) {\n this.activeSubagents.delete(result.toolName!);\n return name;\n }\n return result.toolName ?? \"unknown\";\n }\n\n // ---------------------------------------------------------------------------\n // result → finished or error\n // ---------------------------------------------------------------------------\n\n private handleResult(event: BridgeEvent & { type: \"result\" }): NormalizedEvent[] {\n const usage = resultUsageFields(event);\n if (event.subtype === \"success\") {\n return [\n {\n type: \"finished\",\n summary: event.summary ?? \"Task completed\",\n costUsd: event.costUsd ?? 0,\n ...usage,\n ...(event.selfStarted === true ? { selfStarted: true as const } : {}),\n },\n ];\n }\n\n const errors = event.errors ?? [];\n // Run the same classifier the claude-sdk harness uses on its `error`\n // event so the result-error path also surfaces a category and hint\n // (harnesses other than claude-sdk emit `result` without a paired\n // `error`, so this is the only place they get classified).\n const detail = classifyClaudeSdkError({ errors, subtype: event.subtype });\n // The turn billed even though it failed: carry its usage so a ledger\n // that only writes on `finished` can write here too. Unlike the finished\n // branch, no `costUsd: 0` fallback — an absent figure stays absent.\n return [\n {\n type: \"error\",\n message: `Agent stopped: ${event.subtype}${errors.length ? ` — ${errors.join(\"; \")}` : \"\"}`,\n fatal: event.subtype === \"error_during_execution\",\n category: detail.category,\n ...(detail.hint ? { hint: detail.hint } : {}),\n ...(typeof event.costUsd === \"number\" ? { costUsd: event.costUsd } : {}),\n ...usage,\n ...(event.selfStarted === true ? { selfStarted: true as const } : {}),\n },\n ];\n }\n\n // ---------------------------------------------------------------------------\n // Dev server detection\n // ---------------------------------------------------------------------------\n\n private detectDevServerStarting(command: string): NormalizedEvent | null {\n if (this.devServerStartingEmitted) return null;\n const cmd = command.toLowerCase();\n const isFrontendStart =\n (cmd.includes(\"pnpm run dev\") || cmd.includes(\"pnpm dev\") || cmd.includes(\"vite\")) &&\n (cmd.includes(\"frontend\") || cmd.includes(\"dev:preview\"));\n if (isFrontendStart) {\n this.devServerStartingEmitted = true;\n return { type: \"dev_server\", url: \"http://localhost:3000\", status: \"starting\" };\n }\n return null;\n }\n\n private detectDevServerReady(text: string): NormalizedEvent | null {\n if (this.devServerReadyEmitted) return null;\n\n const explicitMatch = text.match(/DEVSERVER_READY:(https?:\\/\\/[^\\s\"\\\\]+)/);\n if (explicitMatch) {\n this.devServerReadyEmitted = true;\n return { type: \"dev_server\", url: explicitMatch[1]!, status: \"ready\" };\n }\n\n const viteMatch = text.match(/Local:\\s+(https?:\\/\\/localhost:\\d+)/);\n if (viteMatch) {\n this.devServerReadyEmitted = true;\n return { type: \"dev_server\", url: viteMatch[1]!, status: \"ready\" };\n }\n\n if (text.includes(\"FRONTEND_READY\")) {\n this.devServerReadyEmitted = true;\n return { type: \"dev_server\", url: \"http://localhost:3000\", status: \"ready\" };\n }\n\n return null;\n }\n\n // ---------------------------------------------------------------------------\n // Helpers\n // ---------------------------------------------------------------------------\n\n private getContentBlocks(message: AgentMessage): ContentBlock[] {\n if (Array.isArray(message.content)) return message.content;\n if (typeof message.content === \"string\" && message.content) {\n return [{ type: \"text\", text: message.content }];\n }\n return [];\n }\n}\n\n// ---------------------------------------------------------------------------\n// Pure helper functions (exported for reuse)\n// ---------------------------------------------------------------------------\n\n/**\n * Produce a human-readable one-line summary of a tool call for the activity log.\n *\n * Returns a string like `$ git status` for Bash, `Read src/index.ts` for Read, etc.\n * Falls back to `ToolName({...input...})` for unrecognised tools.\n *\n * @param tool - Tool name (e.g. `\"Bash\"`, `\"Write\"`, `\"Grep\"`).\n * @param input - Tool input record passed to the call.\n * @returns A short display string suitable for the activity feed.\n * @docLink packages/bridge/api-reference#normalizer\n */\nexport function summarizeToolCall(tool: string, input: Record<string, unknown>): string {\n // A harness that sent a bare value instead of named args has it under `input`.\n const arg = (key: string) => String(input[key] ?? input.input);\n switch (tool) {\n case \"Bash\":\n return `$ ${String(input.command ?? input.input ?? \"\").slice(0, 200)}`;\n case \"Write\":\n return `Create ${arg(\"file_path\")}`;\n case \"Edit\":\n return `Edit ${arg(\"file_path\")}`;\n case \"Read\":\n return `Read ${arg(\"file_path\")}`;\n case \"Glob\":\n return `Find ${arg(\"pattern\")}`;\n case \"Grep\":\n return `Search for ${arg(\"pattern\")}`;\n case \"ApplyPatch\": {\n // Paths only: stringifying the input would serialize every full diff.\n const changes = Array.isArray(input.changes) ? input.changes : [];\n const paths = changes\n .map((change) => (change as { path?: unknown } | null)?.path)\n .filter((path): path is string => typeof path === \"string\");\n return `Edit ${paths.join(\", \").slice(0, 200) || \"files\"}`;\n }\n default:\n return `${tool}(${JSON.stringify(input).slice(0, 100)})`;\n }\n}\n\n/**\n * Produce the plain-language label shown to non-technical users while a tool\n * call runs: the agent's own `activity_label`, Bash's `description`, else a\n * derived phrase for Claude Code built-ins. `undefined` for any other tool —\n * the UI then falls back to a generic \"working\" line rather than raw input.\n *\n * @param tool - Tool name as the model called it.\n * @param input - Tool input record, still carrying `activity_label`.\n * @returns A trimmed label capped at `TOOL_ACTIVITY_LABEL_MAX_CHARS`, or `undefined`.\n * @docLink packages/bridge/api-reference#normalizer\n */\nexport function labelToolCall(tool: string, input: Record<string, unknown>): string | undefined {\n const authored =\n nonEmpty(input[TOOL_ACTIVITY_LABEL_PARAM]) ??\n (tool === \"Bash\" ? nonEmpty(input.description) : undefined);\n const label = authored ?? builtinToolLabel(tool, input);\n if (!label) return undefined;\n return label.length > TOOL_ACTIVITY_LABEL_MAX_CHARS\n ? `${label.slice(0, TOOL_ACTIVITY_LABEL_MAX_CHARS - 1).trimEnd()}…`\n : label;\n}\n\nfunction nonEmpty(value: unknown): string | undefined {\n if (typeof value !== \"string\") return undefined;\n const trimmed = value.replace(/\\s+/g, \" \").trim();\n return trimmed.length > 0 ? trimmed : undefined;\n}\n\nfunction builtinToolLabel(tool: string, input: Record<string, unknown>): string | undefined {\n switch (tool) {\n case \"Read\":\n return withTarget(\"Reading\", baseName(input.file_path));\n case \"Edit\":\n case \"MultiEdit\":\n case \"NotebookEdit\":\n return withTarget(\"Editing\", baseName(input.file_path ?? input.notebook_path));\n case \"Write\":\n return withTarget(\"Creating\", baseName(input.file_path));\n case \"Grep\":\n case \"Glob\":\n return \"Searching files\";\n case \"WebSearch\":\n return \"Searching the web\";\n case \"WebFetch\":\n return withTarget(\"Fetching\", hostOf(input.url), \"a web page\");\n case \"TodoWrite\":\n return \"Updating the task list\";\n case \"ApplyPatch\":\n return \"Editing files\";\n default:\n return undefined;\n }\n}\n\nfunction withTarget(verb: string, target: string | undefined, fallback = \"a file\"): string {\n return `${verb} ${target ?? fallback}`;\n}\n\nfunction baseName(value: unknown): string | undefined {\n if (typeof value !== \"string\" || value.length === 0) return undefined;\n return value.split(/[\\\\/]/).filter(Boolean).pop();\n}\n\nfunction hostOf(value: unknown): string | undefined {\n if (typeof value !== \"string\") return undefined;\n try {\n return new URL(value).host || undefined;\n } catch {\n return undefined;\n }\n}\n\n/** Extract plain text from an Anthropic content-block array (e.g. tool results returned by Claude SDK). */\nfunction extractContentBlockText(blocks: unknown[]): string | null {\n const textBlocks = blocks.filter(\n (b): b is { type: \"text\"; text: string } =>\n typeof b === \"object\" &&\n b !== null &&\n (b as Record<string, unknown>).type === \"text\" &&\n typeof (b as Record<string, unknown>).text === \"string\",\n );\n if (textBlocks.length === 0) return null;\n return textBlocks.map((b) => b.text).join(\"\\n\");\n}\n\n/**\n * Produce a human-readable one-line summary of a tool result for the activity log.\n *\n * Handles Bash stdout/stderr, Write/Edit file paths, ApplyPatch change counts, and\n * Anthropic content-block arrays. Falls back to `JSON.stringify` for unknown shapes.\n *\n * @param tool - Tool name.\n * @param result - Raw tool result payload.\n * @returns A short display string, truncated to 200 characters.\n * @docLink packages/bridge/api-reference#normalizer\n */\nexport function summarizeToolResult(tool: string, result: unknown): string {\n // Handle Anthropic content-block arrays: [{ type: \"text\", text: \"...\" }, ...]\n if (Array.isArray(result)) {\n const text = extractContentBlockText(result);\n return (text ?? JSON.stringify(result)).slice(0, 200);\n }\n if (typeof result !== \"object\" || !result) {\n return String(result).slice(0, 200);\n }\n const r = result as Record<string, unknown>;\n switch (tool) {\n case \"Bash\": {\n const stderr = String(r.stderr ?? \"\").trim();\n if (stderr) return `stderr: ${stderr.slice(0, 200)}`;\n return (\n String(r.stdout ?? \"\")\n .trim()\n .slice(0, 200) || \"(no output)\"\n );\n }\n case \"Write\":\n return `${String(r.type)}: ${String(r.filePath)}`;\n case \"Edit\":\n return `Edited ${String(r.filePath)}`;\n case \"ApplyPatch\":\n return `${Array.isArray(r.changes) ? r.changes.length : 0} file changes`;\n default:\n return JSON.stringify(result).slice(0, 200);\n }\n}\n\n/**\n * Detect file-change events from a tool result, returning zero or more `file_changed` events.\n *\n * Handles `Write` (single create/edit), `Edit` (single edit), and `ApplyPatch` (multi-file\n * patch with per-change `kind` classification). Returns an empty array for all other tools.\n *\n * @param toolName - Name of the tool that produced the result.\n * @param result - Raw tool result payload.\n * @returns Array of `file_changed` normalized events.\n * @docLink packages/bridge/api-reference#normalizer\n */\nexport function detectFileChanges(toolName: string, result: unknown): NormalizedEvent[] {\n if (typeof result !== \"object\" || !result) return [];\n const r = result as Record<string, unknown>;\n\n if (toolName === \"Write\" && r.filePath) {\n return [\n {\n type: \"file_changed\",\n path: String(r.filePath),\n action: r.type === \"create\" ? \"create\" : \"edit\",\n },\n ];\n }\n if (toolName === \"Edit\" && r.filePath) {\n return [{ type: \"file_changed\", path: String(r.filePath), action: \"edit\" }];\n }\n if (toolName === \"ApplyPatch\" && Array.isArray(r.changes)) {\n return r.changes\n .filter(\n (change): change is { path: string; kind: \"add\" | \"delete\" | \"update\" } =>\n typeof change === \"object\" &&\n change !== null &&\n typeof (change as Record<string, unknown>).path === \"string\" &&\n typeof (change as Record<string, unknown>).kind === \"string\",\n )\n .map((change) => ({\n type: \"file_changed\" as const,\n path: change.path,\n action: change.kind === \"add\" ? \"create\" : change.kind === \"delete\" ? \"delete\" : \"edit\",\n }));\n }\n\n return [];\n}\n\n/**\n * Backward-compatible single-event helper; returns the first `file_changed` event or `null`.\n *\n * Prefer {@link detectFileChanges} for multi-file patches (e.g. `ApplyPatch`).\n *\n * @param toolName - Name of the tool that produced the result.\n * @param result - Raw tool result payload.\n * @returns First detected `file_changed` event, or `null`.\n * @docLink packages/bridge/api-reference#normalizer\n */\nexport function detectFileChange(toolName: string, result: unknown): NormalizedEvent | null {\n return detectFileChanges(toolName, result)[0] ?? null;\n}\n","/**\n * BridgeRuntime — implements IAgentRuntime from @skaile/workspaces/types by wrapping\n * an AgentHarness + EventNormalizer. This is the primary integration point for\n * consumers that want normalized events from any harness.\n */\n\nimport type {\n AgentEvent,\n AgentPromptInput,\n AgentReconfigureOptions,\n AgentRuntimeConfig,\n IAgentRuntime,\n} from \"@skaile/workspaces/types\";\n\nimport { EventNormalizer } from \"./normalizer.js\";\nimport { toMergedRegistry } from \"./provider-registry-derive.js\";\nimport { createHarness } from \"./registry.js\";\nimport type { AgentConfig, AgentHarness } from \"./types.js\";\n\n/**\n * Implements `IAgentRuntime` from `@skaile/workspaces/types` by wrapping an {@link AgentHarness}\n * and an {@link EventNormalizer}.\n *\n * This is the primary integration point for consumers that want normalized `AgentEvent`\n * payloads from any harness without managing the harness lifecycle directly. Create via\n * {@link createRuntime} to avoid coupling to `BridgeRuntime` directly.\n *\n * @docLink packages/bridge/api-reference#runtime\n */\nexport class BridgeRuntime implements IAgentRuntime {\n private harness: AgentHarness | null = null;\n private normalizer = new EventNormalizer();\n private handlers = new Set<(event: AgentEvent) => void>();\n private boundEventHandler: ((event: any) => void) | null = null;\n private harnessId: string;\n\n constructor(harnessId: string = \"claude-sdk\") {\n this.harnessId = harnessId;\n }\n\n async start(config: AgentRuntimeConfig): Promise<void> {\n // Dispose previous harness if any\n if (this.harness) {\n await this.dispose();\n }\n\n this.normalizer.reset();\n\n const bridgeConfig: AgentConfig = {\n cwd: config.cwd,\n model: config.model,\n systemPrompt: config.systemPrompt,\n env: config.env,\n agentDir: config.agentDir,\n sessionId: config.sessionId,\n resumeSessionId: config.resumeSessionId,\n maxTurns: config.maxTurns,\n ...(config.registry ? { registry: toMergedRegistry(config.registry, \"runtime\") } : {}),\n ...(config.modelRef ? { modelRef: config.modelRef } : {}),\n };\n\n this.harness = await createHarness(this.harnessId, bridgeConfig);\n\n // Wire bridge events through normalizer to handlers\n this.boundEventHandler = (bridgeEvent: any) => {\n const normalized = this.normalizer.normalize(bridgeEvent);\n for (const event of normalized) {\n for (const handler of this.handlers) {\n handler(event);\n }\n }\n };\n this.harness.on(\"agent-event\", this.boundEventHandler);\n\n await this.harness.start();\n }\n\n async configure(_config: AgentReconfigureOptions): Promise<void> {\n // Runtime reconfiguration for BridgeRuntime is a no-op for now.\n // Future: reconnect connectors, reload ai-assets, update subagents.\n }\n\n async prompt(message: string): Promise<void> {\n if (!this.harness) throw new Error(\"Runtime not started — call start() first\");\n await this.harness.prompt(message);\n }\n\n async promptInput(input: AgentPromptInput): Promise<void> {\n if (!this.harness) throw new Error(\"Runtime not started — call start() first\");\n await this.harness.promptInput(input);\n }\n\n async reply(answer: string, question?: string, requestId?: string): Promise<void> {\n if (!this.harness) throw new Error(\"Runtime not started — call start() first\");\n // Mirror serve.ts handleReply: an answer must resume the paused turn. Falling through to\n // prompt() would deny the question as superseded and drop the structured answer.\n if (\n this.harness?.hasPendingQuestion() &&\n this.harness.answerQuestion(answer, question, requestId)\n )\n return;\n if (this.harness?.acceptsReplyAsPrompt) await this.prompt(answer);\n }\n\n async abort(): Promise<void> {\n if (this.harness) {\n await this.harness.abort();\n }\n }\n\n async dispose(): Promise<void> {\n if (this.harness) {\n if (this.boundEventHandler) {\n this.harness.off(\"agent-event\", this.boundEventHandler);\n this.boundEventHandler = null;\n }\n this.harness.kill();\n this.harness = null;\n }\n this.normalizer.reset();\n }\n\n onEvent(handler: (event: AgentEvent) => void): void {\n this.handlers.add(handler);\n }\n\n offEvent(handler: (event: AgentEvent) => void): void {\n this.handlers.delete(handler);\n }\n\n get isRunning(): boolean {\n return this.harness?.isRunning ?? false;\n }\n}\n\n/**\n * Factory function to create a {@link BridgeRuntime} with the specified harness.\n *\n * @param harnessId - Registered harness id (default: `\"claude-sdk\"`).\n * @returns A new `IAgentRuntime` wrapping the selected harness with event normalization.\n * @docLink packages/bridge/api-reference#runtime\n */\nexport function createRuntime(harnessId: string = \"claude-sdk\"): IAgentRuntime {\n return new BridgeRuntime(harnessId);\n}\n","/** Provider API key validation — hits each provider's models endpoint to verify the key works. */\n\nimport {\n buildCredentialHeaders,\n expandPreset,\n getProviderPreset,\n resolvePresetBaseUrl,\n resolveProbeUrl,\n} from \"./provider-catalog.js\";\n\n/**\n * Result of an API key validation check performed by {@link validateApiKey}.\n *\n * @docLink packages/bridge/api-reference#validation\n */\nexport interface ValidationResult {\n /** `true` when the API key was accepted by the provider's models endpoint. */\n ok: boolean;\n /** Human-readable error description when `ok` is `false`. */\n error?: string;\n}\n\n/**\n * Validate an API key by sending a lightweight GET request to the provider's models endpoint.\n *\n * Returns `{ ok: true }` when the provider accepts the key (HTTP 2xx). Returns\n * `{ ok: false, error }` on 401/403 (invalid key), other HTTP errors, network failures,\n * or unsupported providers. Requests time out after 8 seconds.\n *\n * @param provider - Catalog preset id (e.g. `\"anthropic\"`, `\"openai\"`, `\"google\"`).\n * @param key - API key to validate.\n * @param options - Optional base-URL / environment overrides; defaults to the\n * provider's own API, or its `base_url_env` value when one is set.\n * @returns Validation result with optional error description.\n * @docLink packages/bridge/api-reference#validation\n */\nexport async function validateApiKey(\n provider: string,\n key: string,\n options: { baseUrl?: string; env?: Record<string, string | undefined> } = {},\n): Promise<ValidationResult> {\n const preset = getProviderPreset(provider);\n if (!preset) return { ok: false, error: `Unknown provider: ${provider}` };\n\n // Validate against the same endpoint discovery/dispatch use: behind a gateway\n // the key is the gateway's, and the provider's public API would reject it.\n const baseUrl = resolvePresetBaseUrl(preset, {\n ...(options.baseUrl ? { baseUrl: options.baseUrl } : {}),\n env: options.env ?? process.env,\n });\n const entry = expandPreset(preset, baseUrl ? { baseUrl } : {});\n const url = resolveProbeUrl(entry);\n if (!url) return { ok: false, error: `Provider ${provider} exposes no models endpoint` };\n // Static non-secret headers (Anthropic's `anthropic-version`) plus the\n // credential carrier the preset's `auth_header` names.\n const headers = { ...entry.headers, ...buildCredentialHeaders(entry, key) };\n\n try {\n const controller = new AbortController();\n const timeout = setTimeout(() => controller.abort(), 8000);\n\n const response = await fetch(url, {\n method: \"GET\",\n headers,\n signal: controller.signal,\n });\n\n clearTimeout(timeout);\n\n if (response.ok) return { ok: true };\n\n const status = response.status;\n if (status === 401 || status === 403) {\n return { ok: false, error: \"Invalid API key (authentication failed)\" };\n }\n return { ok: false, error: `API returned HTTP ${status}` };\n } catch (err: any) {\n if (err.name === \"AbortError\") return { ok: false, error: \"Request timed out (8s)\" };\n return { ok: false, error: err.message ?? \"Network error\" };\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../bridge/src/provider-catalog.ts","../bridge/src/provider-materialize/credential-env.ts","../bridge/src/harness-capabilities.ts","../bridge/src/registry.ts"],"names":[],"mappings":";;;;;AAsFA,IAAM,wBAAA,GAAmD,EAAE,mBAAA,EAAqB,YAAA,EAAa;AAE7F,IAAM,SAAA,GAAkC,EAAE,IAAA,EAAM,WAAA,EAAa,UAAU,cAAA,EAAe;AAEtF,IAAM,kBAAA,GAAqB,YAAA;AAYpB,IAAM,mBAAA,GAAwD;AAAA,EACnE,SAAA,EAAW;AAAA,IACT,EAAA,EAAI,WAAA;AAAA,IACJ,IAAA,EAAM,KAAA;AAAA,IACN,KAAA,EAAO,WAAA;AAAA,IACP,OAAA,EAAS,oBAAA;AAAA,IACT,QAAA,EAAU,2BAAA;AAAA,IACV,YAAA,EAAc,oBAAA;AAAA,IACd,OAAA,EAAS,wBAAA;AAAA,IACT,UAAA,EAAY,EAAE,IAAA,EAAM,gBAAA,EAAkB,KAAK,mBAAA,EAAoB;AAAA,IAC/D,WAAA,EAAa,SAAA;AAAA,IACb,UAAA,EAAY,YAAA;AAAA,IACZ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AQ,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,oBAAA,CACpB,SAAA,EACA,QAAA,EACA,OAAA,EACuB;AACvB,EAAA,MAAM,MAAA,GAAS,MAAM,oBAAA,CAAqB,SAAS,CAAA;AACnD,EAAA,OAAQ,MAAM,MAAA,CAAO,UAAA,GAAa,QAAA,EAAU,OAAO,KAAM,EAAC;AAC5D","file":"chunk-F2GOZMRA.js","sourcesContent":["/**\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 harness 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 harness 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 harness 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 * What the runner may ask of a harness, by harness id.\n *\n * Deliberately light: this module imports no harness, no SDK and no `zod`, so a\n * runner file that only needs a capability can import it without loading the\n * harness 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 { HarnessCapabilities } from \"@skaile/workspaces/types\";\n\n/**\n * Capabilities of a harness that declares none: it recomposes its tools per\n * turn like every bridge harness that is not an in-process SDK, and has no\n * managed session, credentials file or transcript-file resume.\n */\nconst GENERIC_HARNESS_CAPABILITIES: HarnessCapabilities = {\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_HARNESS_CATALOG` rows point at these entries, so `listHarnesses()` and\n * {@link harnessCapabilities} read one table. A built-in absent here (echo,\n * gemini, qwen, opencode, goose, continue) takes the generic defaults.\n */\nexport const BUILTIN_HARNESS_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, HarnessCapabilities>;\n\n/**\n * Resolve what the runner may ask of a harness, by harness id, without loading\n * its module. Built-ins read {@link BUILTIN_HARNESS_CAPABILITIES}; a third-party\n * harness reads its registered `HarnessTarget`; an unknown or absent id gets the\n * generic defaults. Fields a harness omits take the generic default too.\n *\n * This is the one place the runner learns harness facts — it never compares an\n * id against `\"claude-sdk\"`, `\"codex\"` or `\"omp\"`.\n *\n * @param id - Harness id (e.g. a session's `harnessType`); `undefined` resolves to the defaults.\n * @docLink packages/bridge/api-reference#registry\n */\nexport function harnessCapabilities(id: string | undefined): HarnessCapabilities {\n const declared = id\n ? Object.hasOwn(BUILTIN_HARNESS_CAPABILITIES, id)\n ? BUILTIN_HARNESS_CAPABILITIES[id as keyof typeof BUILTIN_HARNESS_CAPABILITIES]\n : pluginRegistry.get(\"harness\", id)?.capabilities\n : undefined;\n return { ...GENERIC_HARNESS_CAPABILITIES, ...declared };\n}\n\n/**\n * Whether a hot-plugged MCP server reaches the agent's next turn without a\n * harness restart. A host-managed session refreshes its native tool snapshot\n * itself, so it never takes live updates, whatever the standalone harness does.\n *\n * @param id - Harness 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 = harnessCapabilities(id);\n return caps.liveToolUpdates && !(managed && caps.managedSession);\n}\n","import type {\n AIProviderRegistry,\n AIProviderSurface,\n MergedAIProviderRegistry,\n} from \"@skaile/workspaces/core/provider-registry\";\nimport type { HarnessContext } 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_HARNESS_CAPABILITIES } from \"./harness-capabilities.js\";\nimport type { AgentConfig, AgentHarness, HarnessInfo } from \"./types.js\";\n\n// Build-time harness gating. `bun build --compile --define:__INCLUDE_*__=...`\n// folds these to literal booleans so an excluded harness 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 harness module and references no harness\n * SDK. {@link listHarnesses} returns it (merged with any third-party harnesses)\n * so selection UIs can enumerate every harness without loading a single\n * harness module. The matching harness module's `HarnessTarget` is registered\n * into the plugin registry by {@link registerBuiltinHarnesses}.\n *\n * `surfaces` and `providerPlurality` are the harness-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_HARNESS_CATALOG: Record<string, HarnessInfo> = {\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_HARNESS_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_HARNESS_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_HARNESS_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\nlet _harnessesRegistered = false;\n\n/**\n * Register every built-in harness's `HarnessTarget` 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 harness 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 registerBuiltinHarnesses(\n registry: PluginRegistry = pluginRegistry,\n): Promise<void> {\n if (registry === pluginRegistry && _harnessesRegistered) return;\n\n if (!registry.get(\"harness\", \"omp\")) {\n const m = await import(\"@skaile/workspaces/harnesses/omp\");\n registry.register(\"harness\", m.ompHarnessTarget);\n }\n if (!registry.get(\"harness\", \"echo\")) {\n const m = await import(\"@skaile/workspaces/harnesses/echo\");\n registry.register(\"harness\", m.echoHarnessTarget);\n }\n if (INCLUDE_CLAUDE_SDK && !registry.get(\"harness\", \"claude-sdk\")) {\n const m = await import(\"@skaile/workspaces/harnesses/claude-sdk\");\n registry.register(\"harness\", m.claudeSdkHarnessTarget);\n }\n if (INCLUDE_CODEX && !registry.get(\"harness\", \"codex\")) {\n const m = await import(\"@skaile/workspaces/harnesses/codex\");\n registry.register(\"harness\", m.codexHarnessTarget);\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(\"harness\", \"gemini\")) {\n const m = await import(\"@skaile/workspaces/harnesses/gemini\");\n registry.register(\"harness\", m.geminiHarnessTarget);\n }\n if (!registry.get(\"harness\", \"qwen\")) {\n const m = await import(\"@skaile/workspaces/harnesses/qwen\");\n registry.register(\"harness\", m.qwenHarnessTarget);\n }\n if (!registry.get(\"harness\", \"opencode\")) {\n const m = await import(\"@skaile/workspaces/harnesses/opencode\");\n registry.register(\"harness\", m.opencodeHarnessTarget);\n }\n if (!registry.get(\"harness\", \"goose\")) {\n const m = await import(\"@skaile/workspaces/harnesses/goose\");\n registry.register(\"harness\", m.gooseHarnessTarget);\n }\n if (!registry.get(\"harness\", \"continue\")) {\n const m = await import(\"@skaile/workspaces/harnesses/continue\");\n registry.register(\"harness\", m.continueHarnessTarget);\n }\n\n if (registry === pluginRegistry) _harnessesRegistered = true;\n}\n\n/**\n * Creates a new harness instance for the given harness id.\n *\n * Ensures the built-in harness targets are registered (idempotent), then looks\n * up the target in the plugin registry and calls its `create()`. The returned\n * harness has not been started yet — call `harness.start()` before sending\n * prompts.\n *\n * @param id - Registered harness identifier (e.g. `\"omp\"`, `\"claude-sdk\"`).\n * @param config - Configuration forwarded to the harness constructor.\n * @param ctx - Optional harness context (logger / abort signal). Defaults to `{}`.\n * @returns A freshly constructed (not yet started) {@link AgentHarness}.\n * @throws {Error} When `id` is a known harness excluded from this build, or\n * when `id` does not match any registered harness at all.\n * @docLink packages/bridge/api-reference#registry\n */\nexport async function createHarness(\n id: string,\n config: AgentConfig,\n ctx?: HarnessContext,\n): Promise<AgentHarness> {\n const target = await resolveHarnessTarget(id);\n return target.create(config, ctx ?? {});\n}\n\n/**\n * Resolve a registered harness target by id, ensuring the built-ins are\n * registered first. Throws the canonical \"not bundled\" / \"unknown harness\"\n * errors so every caller (`createHarness`, `listModelsForHarness`) 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 harness at all.\n */\nasync function resolveHarnessTarget(id: string) {\n await registerBuiltinHarnesses();\n const target = pluginRegistry.get(\"harness\", id);\n if (!target) {\n if (id in BUILTIN_HARNESS_CATALOG) {\n throw new Error(`Agent harness \"${id}\" is not bundled in this build.`);\n }\n throw new Error(\n `Unknown agent harness: \"${id}\". Available: ${listHarnesses()\n .map((d) => d.id)\n .join(\", \")}`,\n );\n }\n return target;\n}\n\n/**\n * Returns the capability metadata for every available harness.\n *\n * Enumerates every built-in harness from {@link BUILTIN_HARNESS_CATALOG} without\n * loading a single harness module or harness SDK, then merges in any third-party\n * harness targets registered into the plugin registry that are not already in\n * the catalog. Use this to populate harness selection UIs.\n *\n * @returns Array of {@link HarnessInfo} objects, one per available harness.\n * @docLink packages/bridge/api-reference#registry\n */\nexport function listHarnesses(): HarnessInfo[] {\n const merged = new Map<string, HarnessInfo>();\n for (const info of Object.values(BUILTIN_HARNESS_CATALOG)) {\n merged.set(info.id, info);\n }\n for (const meta of pluginRegistry.list(\"harness\")) {\n if (!merged.has(meta.id)) {\n // Third-party harnesses carry no HarnessInfo 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(\"harness\", 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 harness 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 harness without starting a full agent session.\n *\n * Ensures the built-in harness 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 createHarness}); returns `[]` only\n * when the target exists but exposes no `listModels`.\n *\n * @param harnessId - Registered harness 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 * harness 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 `harnessId` is unknown or excluded from this build.\n * @docLink packages/bridge/api-reference#registry\n */\nexport async function listModelsForHarness(\n harnessId: string,\n registry: AIProviderRegistry | MergedAIProviderRegistry,\n options?: RegistryCredentialOptions,\n): Promise<ModelEntry[]> {\n const target = await resolveHarnessTarget(harnessId);\n return (await target.listModels?.(registry, options)) ?? [];\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../core/src/fs-deadline.ts","../core/src/requirements.ts","../core/src/manifest.ts"],"names":["parse"],"mappings":";;;;;;;;AA4BO,IAAM,sBAAA,GAAyB;AAQ/B,IAAM,mBAAA,GAAsB;AAQ5B,IAAM,eAAA,GAAN,cAA8B,KAAA,CAAM;AAAA,EAChC,SAAA;AAAA,EACA,SAAA;AAAA,EAET,WAAA,CAAY,WAAmB,SAAA,EAAmB;AAChD,IAAA,KAAA;AAAA,MACE,CAAA,sBAAA,EAAyB,SAAS,CAAA,WAAA,EAAc,SAAS,CAAA,uCAAA;AAAA,KAC3D;AACA,IAAA,IAAA,CAAK,IAAA,GAAO,iBAAA;AACZ,IAAA,IAAA,CAAK,SAAA,GAAY,SAAA;AACjB,IAAA,IAAA,CAAK,SAAA,GAAY,SAAA;AAAA,EACnB;AACF;AAYO,SAAS,YAAA,CAAa,WAAmB,sBAAA,EAAgC;AAC9E,EAAA,MAAM,GAAA,GAAM,OAAA,CAAQ,GAAA,CAAI,mBAAmB,CAAA;AAC3C,EAAA,IAAI,GAAA,KAAQ,QAAW,OAAO,QAAA;AAC9B,EAAA,MAAM,MAAA,GAAS,MAAA,CAAO,QAAA,CAAS,GAAA,EAAK,EAAE,CAAA;AAGtC,EAAA,OAAO,OAAO,QAAA,CAAS,MAAM,CAAA,IAAK,MAAA,GAAS,IAAI,MAAA,GAAS,QAAA;AAC1D;AAaA,eAAsB,cAAA,CACpB,SAAA,EACA,EAAA,EACA,SAAA,GAAoB,cAAa,EACrB;AACZ,EAAA,IAAI,KAAA;AACJ,EAAA,IAAI;AACF,IAAA,OAAO,MAAM,QAAQ,IAAA,CAAK;AAAA,MACxB,EAAA,EAAG;AAAA,MACH,IAAI,OAAA,CAAe,CAAC,QAAA,EAAU,MAAA,KAAW;AACvC,QAAA,KAAA,GAAQ,UAAA,CAAW,MAAM,MAAA,CAAO,IAAI,gBAAgB,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AC/B,IAAA;AAAA,MACA;AAAA,KACF;AACA,IAAA,IAAI,YAAY,IAAA,EAAM;AAGpB,MAAA,IAAI,CAAC,QAAA,CAAS,GAAA,CAAI,YAAY,CAAA,EAAG,KAAA,CAAM,EAAE,MAAA,EAAQ,YAAA,EAAc,IAAA,EAAM,QAAA,EAAU,CAAA;AAC/E,MAAA;AAAA,IACF;AACA,IAAA,IAAI;AACF,MAAA,MAAM,QAAQ,iBAAA,CAAkB,IAAA,EAAM,SAAS,QAAA,EAAU,QAAA,EAAU,QAAQ,UAAU,CAAA;AACrF,MAAA,IAAI,KAAA,MAAW,KAAK,CAAA;AAAA,IACtB,SAAS,GAAA,EAAK;AACZ,MAAA,IAAI,eAAe,iBAAA,EAAmB;AACpC,QAAA,CAAC,OAAA,CAAQ,YAAA,IAAgB,cAAA,EAAgB,sBAAA,CAAuB,GAAG,CAAC,CAAA;AAAA,MACtE;AAAA,IACF;AAAA,EACF;AAEA,EAAA,OAAO,QAAQ,cAAA,GAAiB,MAAA,GAAS,CAAC,GAAG,OAAA,CAAQ,QAAQ,CAAA;AAC/D;AAUO,SAAS,aAAA,CAAc,MAAc,IAAA,EAAkC;AAC5E,EAAA,IAAI,KAAK,QAAA,CAAS,KAAK,GAAG,OAAO,gBAAA,CAAiB,IAAI,CAAA,CAAE,IAAA;AACxD,EAAA,IAAI,QAAA,CAAS,IAAI,CAAA,KAAM,YAAA,EAAc,OAAO,MAAA;AAC5C,EAAA,MAAM,IAAA,GAAO,IAAA,CAAK,OAAA,CAAQ,IAAI,GAAG,SAAS,CAAA;AAC1C,EAAA,OAAO,UAAA,CAAW,IAAI,CAAA,GAAI,YAAA,CAAa,MAAM,MAAM,CAAA,CAAE,MAAK,GAAI,MAAA;AAChE","file":"chunk-GOCWM7FN.js","sourcesContent":["/**\n * Deadline guards for filesystem work that can land on a network mount.\n *\n * Inside the agent container `/skaile/workspace` **is** an rclone FUSE mount\n * (SharePoint / OneDrive / WebDAV). When the host rclone process wedges, a\n * filesystem call against that path parks in an uninterruptible kernel wait.\n * A **synchronous** call there stops the entire single-threaded event loop —\n * the whole `skaile serve` process stops serving, and the platform reads the\n * session as dead or idle. A hang is not an error, so `try/catch` never fires.\n *\n * Two rules follow, and both matter:\n *\n * 1. **Never touch a mount synchronously.** Async `node:fs/promises` keeps the\n * loop free, so a wedged mount degrades to one stuck request instead of a\n * dead session. This is the actual fix.\n * 2. **Bound the wait.** {@link withFsDeadline} converts an unbounded wait into\n * a bounded failure so the requester gets an error rather than nothing.\n *\n * `withFsDeadline` does **not** cancel the underlying operation — Node cannot\n * abort a syscall already in the kernel. The losing promise stays pending until\n * the mount recovers or the process exits. That is acceptable precisely because\n * rule 1 holds: a pending promise costs one handle, not the event loop.\n *\n * Modelled on `connectors/src/fleet-utils.ts` (`ensureFleetMounted`), which\n * already does async-stat-with-deadline correctly.\n */\n\n/** Default deadline for a single filesystem operation on a possibly-networked mount. */\nexport const DEFAULT_FS_DEADLINE_MS = 15_000;\n\n/**\n * Env override for {@link DEFAULT_FS_DEADLINE_MS}, in milliseconds.\n *\n * A cloud-backed mount over a slow link can legitimately need longer than the\n * default; operators raise this rather than patching call sites.\n */\nexport const FS_DEADLINE_ENV_VAR = \"SKAILE_FS_DEADLINE_MS\";\n\n/**\n * Thrown when a filesystem operation misses its deadline.\n *\n * Distinct from a plain `Error` so callers can tell \"the mount is wedged\" apart\n * from \"the file does not exist\" and surface the right message to the frontend.\n */\nexport class FsDeadlineError extends Error {\n readonly timeoutMs: number;\n readonly operation: string;\n\n constructor(operation: string, timeoutMs: number) {\n super(\n `filesystem operation \"${operation}\" exceeded ${timeoutMs}ms — the mount may be unresponsive`,\n );\n this.name = \"FsDeadlineError\";\n this.operation = operation;\n this.timeoutMs = timeoutMs;\n }\n}\n\n/**\n * Resolve the effective filesystem deadline.\n *\n * Reads {@link FS_DEADLINE_ENV_VAR} on every call rather than caching it: the\n * runner mutates `process.env` while wiring a session, so a module-load-time\n * snapshot would pin the value set before configuration ran.\n *\n * @param fallback - Deadline to use when the env var is absent or unusable.\n * @returns The deadline in milliseconds.\n */\nexport function fsDeadlineMs(fallback: number = DEFAULT_FS_DEADLINE_MS): number {\n const raw = process.env[FS_DEADLINE_ENV_VAR];\n if (raw === undefined) return fallback;\n const parsed = Number.parseInt(raw, 10);\n // A non-positive or non-numeric override would disable the guard entirely,\n // which is exactly the failure mode this module exists to prevent.\n return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;\n}\n\n/**\n * Run an async filesystem operation under a deadline.\n *\n * @param operation - Short label used in the timeout message (e.g. `\"readdir /skaile/workspace\"`).\n * @param fn - Thunk performing the operation. Called immediately.\n * @param timeoutMs - Deadline override; defaults to {@link fsDeadlineMs}.\n * @returns The operation's result.\n * @throws {FsDeadlineError} when the deadline elapses first.\n * @throws Whatever `fn` rejects with, unchanged, when it loses no race.\n * @docLink packages/core/api-reference#with-fs-deadline\n */\nexport async function withFsDeadline<T>(\n operation: string,\n fn: () => Promise<T>,\n timeoutMs: number = fsDeadlineMs(),\n): Promise<T> {\n let timer: ReturnType<typeof setTimeout> | undefined;\n try {\n return await Promise.race([\n fn(),\n new Promise<never>((_resolve, reject) => {\n timer = setTimeout(() => reject(new FsDeadlineError(operation, timeoutMs)), timeoutMs);\n // Never hold the process open on the guard alone — without unref a\n // pending deadline would keep `skaile serve` alive after shutdown.\n timer.unref?.();\n }),\n ]);\n } finally {\n if (timer !== undefined) clearTimeout(timer);\n }\n}\n\n/**\n * Run an async filesystem operation under a deadline, mapping every failure to\n * `fallback`.\n *\n * For best-effort probes that previously used `existsSync` — a missing file, an\n * unreadable file, and a wedged mount are all \"nothing usable here\", and the\n * caller has no better move than to continue without it.\n *\n * @param operation - Short label used in the timeout message.\n * @param fn - Thunk performing the operation.\n * @param fallback - Value returned when `fn` rejects or the deadline elapses.\n * @param timeoutMs - Deadline override; defaults to {@link fsDeadlineMs}.\n */\nexport async function tryWithFsDeadline<T>(\n operation: string,\n fn: () => Promise<T>,\n fallback: T,\n timeoutMs: number = fsDeadlineMs(),\n): Promise<T> {\n try {\n return await withFsDeadline(operation, fn, timeoutMs);\n } catch {\n return fallback;\n }\n}\n","/**\n * Requirement identity — one key for \"asset X requires asset Y\", wherever the\n * declaration comes from (a SKILL.md `metadata.requires` entry, a manifest\n * `dependencies:` entry, a lock-time edge).\n *\n * A requirement is identified by `publisher/kind:name`. A declaration that names\n * no publisher means \"the declaring asset's own publisher\", so `report-table` on a\n * `@skaile-ai` asset and `skill:@skaile-ai/report-table` are the same requirement.\n * Every command that lists, dedupes or compares requirements goes through here.\n */\n\nimport { type Dependency, depToStr, parseDep } from \"./models.js\";\n\n/**\n * `publisher/kind:name` identity of a requirement. A dependency that names no\n * publisher takes `fallbackPublisher` (the declaring asset's); without either, the\n * key is the unqualified `kind:name`.\n */\nexport function requirementKey(dep: Dependency, fallbackPublisher?: string): string {\n const publisher = dep.publisher ?? fallbackPublisher ?? \"\";\n return publisher ? `${publisher}/${dep.kind}:${dep.name}` : `${dep.kind}:${dep.name}`;\n}\n\n/**\n * Each requirement once, in first-seen order. Two declarations of the same\n * {@link requirementKey} collapse into one; the surviving entry carries the\n * publisher and the pin of whichever declaration named them.\n */\nexport function dedupeRequirements(\n deps: readonly Dependency[],\n fallbackPublisher?: string,\n): Dependency[] {\n const out: Dependency[] = [];\n const at = new Map<string, number>();\n for (const dep of deps) {\n const key = requirementKey(dep, fallbackPublisher);\n const i = at.get(key);\n if (i === undefined) {\n at.set(key, out.length);\n out.push({ ...dep });\n continue;\n }\n const kept = out[i] as Dependency;\n if (!kept.publisher && dep.publisher) kept.publisher = dep.publisher;\n if (!kept.pin && dep.pin) kept.pin = dep.pin;\n }\n return out;\n}\n\n/** {@link dedupeRequirements} for requirement strings (`kind:name[#pin]`, `kind:@pub/name[#pin]`). */\nexport function dedupeRequirementRefs(\n refs: readonly string[],\n fallbackPublisher?: string,\n): string[] {\n const parse = (ref: string): Dependency => {\n const dep = parseDep(ref);\n // The scoped form carries its own pin; a bare `kind:name#pin` keeps it in the name.\n const hash = dep.name.indexOf(\"#\");\n if (hash === -1) return dep;\n const pin = dep.name.slice(hash + 1).trim();\n dep.name = dep.name.slice(0, hash);\n if (pin && !dep.pin) dep.pin = pin;\n return dep;\n };\n return dedupeRequirements(refs.map(parse), fallbackPublisher).map(depToStr);\n}\n","/**\n * Manifest parsing — reads SKILL.md, AGENT.md, agent.yaml, CONTRACT.md,\n * CONNECTOR.md, *.prompt.md, *.flow.yaml, *.preset.yaml files and\n * produces CatalogEntry objects.\n * Used by @skaile/asset-manager for on-demand repo scanning.\n *\n * **All filesystem access here is async and bounded** (issue #454). A repo root\n * can resolve onto the rclone FUSE mount at `/skaile/workspace` — either\n * directly (a `sources[].path` pointing into the workspace) or indirectly, since\n * the walk follows symlinks and an off-mount tree can link into one. A\n * synchronous `readdirSync`/`statSync`/`readFileSync` there parks the whole\n * `skaile serve` event loop in an uninterruptible kernel wait, and a hang is not\n * an error so `try/catch` never fires. Every call goes through\n * {@link withFsDeadline}/{@link tryWithFsDeadline}, and the walk itself is\n * bounded by depth, entry count, a wall-clock budget, and an ancestor-inode set.\n */\n\nimport type { Dirent } from \"node:fs\";\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { opendir, readFile, stat } from \"node:fs/promises\";\nimport { basename, dirname, join } from \"node:path\";\nimport { parse } from \"yaml\";\nimport { fsDeadlineMs, tryWithFsDeadline, withFsDeadline } from \"./fs-deadline.js\";\nimport { createLogger } from \"./logging/create-logger.js\";\nimport type { AssetKind, CatalogEntry, Dependency } from \"./models.js\";\nimport { isValidAssetName, parseDep, slugifyAssetName } from \"./models.js\";\nimport { dedupeRequirements } from \"./requirements.js\";\nimport type { Diagnostic } from \"./workspace-config.js\";\n\n// ── Bounded manifest I/O ──────────────────────────────────────────────────────\n\n/**\n * Read one manifest file under a deadline.\n *\n * @param filePath - Absolute path to the manifest.\n * @param timeoutMs - Per-operation deadline; defaults to {@link fsDeadlineMs}.\n * @throws {import(\"./fs-deadline.js\").FsDeadlineError} when the read outlives the deadline.\n */\nfunction readManifestFile(filePath: string, timeoutMs?: number): Promise<string> {\n return withFsDeadline(`readFile ${filePath}`, () => readFile(filePath, \"utf8\"), timeoutMs);\n}\n\n/**\n * Read one manifest file under a deadline, degrading an unreadable/slow file to\n * an empty document. Mirrors the pre-#454 `try { readFileSync } catch {}` shape\n * of the YAML parsers: a file we cannot read yields `{}` metadata rather than\n * aborting the caller.\n */\nfunction readManifestFileOrEmpty(filePath: string, timeoutMs?: number): Promise<string> {\n return tryWithFsDeadline(`readFile ${filePath}`, () => readFile(filePath, \"utf8\"), \"\", timeoutMs);\n}\n\n// ── Frontmatter helpers ───────────────────────────────────────────────────────\n\n/**\n * Result of parsing YAML frontmatter from a markdown file.\n * @docLink packages/core/concepts#frontmatter-result\n */\nexport interface FrontmatterResult {\n /** Parsed YAML data. Empty object if no frontmatter block is present. */\n data: Record<string, unknown>;\n /** Markdown body below the frontmatter block (trimmed). */\n body: string;\n}\n\n/**\n * Parse YAML frontmatter from a markdown file (`---` delimited).\n * Returns `{ data: {}, body: text }` when no frontmatter block is present.\n * A leading UTF-8 byte-order mark and `\\r\\n` line endings (Windows editors, `git` autocrlf)\n * are read as plain `\\n` text: the same file parses the same on every platform, and a\n * scalar never carries a trailing `\\r`.\n *\n * @param raw - Raw file contents\n * @returns Parsed frontmatter data and the remaining body text\n * @docLink packages/core/concepts#parse-frontmatter\n */\nexport function parseFrontmatter(raw: string): FrontmatterResult {\n const text = raw.replace(/^\\uFEFF/, \"\").replace(/\\r\\n/g, \"\\n\");\n const m = text.match(/^---\\s*\\n([\\s\\S]*?)\\n---/);\n if (!m) return { data: {}, body: text.trim() };\n try {\n const data = (parse(m[1]!) as Record<string, unknown>) ?? {};\n const body = text.slice(m[0].length).trim();\n return { data, body };\n } catch {\n return { data: {}, body: text.trim() };\n }\n}\n\n/** Extract version from frontmatter, checking both top-level and metadata.version. */\nfunction extractVersion(meta: Record<string, unknown>): string {\n return String(\n meta.version ?? (meta.metadata as Record<string, unknown> | undefined)?.version ?? \"\",\n );\n}\n\n/**\n * Parse the `requires:` field from manifest frontmatter into typed `Dependency` objects.\n * Accepts a comma-separated string or an array of `\"kind:name\"` strings. Reads from either\n * the root or `metadata.requires` (matching `extractVersion`'s dual-location behavior) so\n * skill authors can follow the agentskills.io convention of placing skaile extensions under\n * `metadata:` while remaining backward-compatible with root-level declarations.\n *\n * @param meta - Parsed frontmatter data object\n * @returns Array of `Dependency` objects (empty when `requires` is absent)\n * @docLink packages/core/concepts#parse-requires\n */\nexport function parseRequires(meta: Record<string, unknown>): Dependency[] {\n const raw = meta.requires ?? (meta.metadata as Record<string, unknown> | undefined)?.requires;\n if (!raw) return [];\n const list =\n typeof raw === \"string\"\n ? raw.split(\",\").map((s) => s.trim())\n : Array.isArray(raw)\n ? (raw as string[])\n : [];\n return list.filter(Boolean).map(parseDep);\n}\n\n// ── agent.yaml composes → requires ─────────────────────────────────────────────\n\n/**\n * Collect the catalog refs of an `agent.yaml` `composes[]` list as requires so\n * `skaile install` pulls them automatically. Local paths (`.`/`/`) and\n * `library://` instance refs are skipped — not catalog assets. A ref without a\n * `kind:` prefix takes the item's `kind`; the publisher scope, `@version` and\n * `#pin` are stripped so only `kind:name` is tracked.\n */\nfunction collectComposeRefs(raw: unknown, out: Dependency[]): void {\n if (!Array.isArray(raw)) return;\n for (const item of raw) {\n if (typeof item !== \"object\" || item === null) continue;\n const { kind: itemKind, ref } = item as Record<string, unknown>;\n if (typeof ref !== \"string\" || !ref) continue;\n if (ref.startsWith(\".\") || ref.startsWith(\"/\") || ref.includes(\"://\")) continue;\n if (typeof itemKind !== \"string\" || !itemKind) continue;\n const normalized = ref.includes(\":\") ? ref : `${itemKind}:${ref}`;\n const colonIdx = normalized.indexOf(\":\");\n const kind = normalized.slice(0, colonIdx).trim();\n let rest = normalized.slice(colonIdx + 1).trim();\n const hashIdx = rest.indexOf(\"#\");\n if (hashIdx !== -1) rest = rest.slice(0, hashIdx).trim();\n if (rest.startsWith(\"@\")) {\n // Scoped form @publisher/name → name is the segment after the slash.\n const slashIdx = rest.indexOf(\"/\");\n rest = slashIdx !== -1 ? rest.slice(slashIdx + 1).trim() : \"\";\n }\n // A trailing `@<version>` range (`name@^1`) is not part of the name.\n const atIdx = rest.indexOf(\"@\");\n const name = atIdx !== -1 ? rest.slice(0, atIdx).trim() : rest;\n if (name) out.push({ kind, name });\n }\n}\n\n// ── Manifest parsers ──────────────────────────────────────────────────────────\n\n/**\n * Thrown when a `SKILL.md`-style manifest declares a `type:` that is not a\n * registered asset kind. The kind registry is the only authority on kinds, so an\n * unregistered `type:` is reported (see {@link manifestKindDiagnostic}) instead\n * of being silently catalogued as a skill.\n */\nexport class ManifestKindError extends Error {\n constructor(\n readonly filePath: string,\n readonly kind: string,\n ) {\n super(`${filePath}: unknown asset kind \"${kind}\" in frontmatter \\`type:\\``);\n this.name = \"ManifestKindError\";\n }\n}\n\n/** Convert a {@link ManifestKindError} into the `unknown_asset_kind` error diagnostic. */\nexport function manifestKindDiagnostic(err: ManifestKindError): Diagnostic {\n return {\n code: \"unknown_asset_kind\",\n severity: \"error\",\n message: `${err.filePath}: asset kind \"${err.kind}\" is not registered`,\n path: err.filePath,\n };\n}\n\n/**\n * Parse a `SKILL.md` file into a `CatalogEntry`.\n * The `kind` field defaults to `\"skill\"` but can be overridden via the `type:`\n * frontmatter key to any registered kind. Falls back to the parent directory name\n * when `name:` is absent.\n *\n * Async since #454 — the file may live on the FUSE workspace mount.\n *\n * @param filePath - Absolute path to the `SKILL.md` file\n * @param repoName - Repository name used as the `repository` field of the entry\n * @param knownKinds - Registered asset kinds (`registry.getAllKinds()`); a `type:` outside it throws\n * @returns Populated `CatalogEntry` with kind, name, description, version, and requires\n * @throws {ManifestKindError} when `type:` names an unregistered kind\n * @docLink packages/core/concepts#from-skill-md\n */\nexport async function fromSkillMd(\n filePath: string,\n repoName: string,\n knownKinds: ReadonlySet<string>,\n): Promise<CatalogEntry> {\n return fromSkillMdContent(await readManifestFile(filePath), repoName, filePath, knownKinds);\n}\n\n/** Pure {@link fromSkillMd} core over already-read content (no I/O). */\nfunction fromSkillMdContent(\n content: string,\n repoName: string,\n filePath: string,\n knownKinds: ReadonlySet<string>,\n): CatalogEntry {\n const { data: meta } = parseFrontmatter(content);\n // An absent `type:` is the SKILL.md default; an explicit one must be registered.\n const kind = meta.type === undefined ? \"skill\" : String(meta.type);\n if (meta.type !== undefined && !knownKinds.has(kind)) throw new ManifestKindError(filePath, kind);\n return {\n name: String(meta.name ?? basename(dirname(filePath))),\n kind,\n description: String(meta.description ?? \"\"),\n source: filePath,\n publisher: repoName,\n version: extractVersion(meta),\n requires: parseRequires(meta),\n dependencies: [],\n };\n}\n\n/**\n * Parse an `AGENT.md` file into a `CatalogEntry` with `kind: \"agent\"`.\n * Falls back to the parent directory name when `name:` is absent.\n *\n * Async since #454 — the file may live on the FUSE workspace mount.\n *\n * @param filePath - Absolute path to the `AGENT.md` file\n * @param repoName - Repository name used as the `repository` field of the entry\n * @returns Populated `CatalogEntry` with kind `\"agent\"`\n * @docLink packages/core/concepts#from-agent-md\n */\nexport async function fromAgentMd(filePath: string, repoName: string): Promise<CatalogEntry> {\n return fromAgentMdContent(await readManifestFile(filePath), repoName, filePath);\n}\n\n/** Pure {@link fromAgentMd} core over already-read content (no I/O). */\nfunction fromAgentMdContent(content: string, repoName: string, filePath: string): CatalogEntry {\n const { data: meta } = parseFrontmatter(content);\n return {\n name: String(meta.name ?? basename(dirname(filePath))),\n kind: \"agent\",\n description: String(meta.description ?? \"\"),\n source: filePath,\n publisher: repoName,\n version: extractVersion(meta),\n requires: parseRequires(meta),\n dependencies: [],\n };\n}\n\n/**\n * Parse an `agent.yaml` file into a `CatalogEntry` with `kind: \"agent\"`.\n * `requires` lists the catalog refs of `composes[]` (local paths and `library://`\n * instances excluded). The deprecated 0.1 fields (`skills`, `requires`, `persona`,\n * …) are not read; `skaile validate` reports them.\n *\n * Async since #454 — the file may live on the FUSE workspace mount.\n *\n * @param filePath - Absolute path to the `agent.yaml` file\n * @param repoName - Repository name used as the `repository` field of the entry\n * @returns Populated `CatalogEntry` with kind `\"agent\"` and full dependency graph\n * @docLink packages/core/concepts#from-agent-yaml\n */\nexport async function fromAgentYaml(filePath: string, repoName: string): Promise<CatalogEntry> {\n return fromAgentYamlContent(await readManifestFileOrEmpty(filePath), repoName, filePath);\n}\n\n/**\n * The catalog requirements of an `agent.yaml` text: its `composes[]` refs (see\n * {@link collectComposeRefs}). Empty for text that is not YAML.\n */\nexport function agentYamlRequires(content: string): Dependency[] {\n let meta: Record<string, unknown> = {};\n try {\n meta = (parse(content) as Record<string, unknown>) ?? {};\n } catch {}\n const requires: Dependency[] = [];\n collectComposeRefs(meta.composes, requires);\n return requires;\n}\n\n/** Pure {@link fromAgentYaml} core over already-read content (no I/O). */\nfunction fromAgentYamlContent(content: string, repoName: string, filePath: string): CatalogEntry {\n let meta: Record<string, unknown> = {};\n try {\n meta = (parse(content) as Record<string, unknown>) ?? {};\n } catch {}\n\n const requires = agentYamlRequires(content);\n return {\n name: String(meta.name ?? basename(dirname(filePath))),\n kind: \"agent\",\n description: String(meta.description ?? \"\"),\n source: filePath,\n publisher: repoName,\n version: String(meta.version ?? \"\"),\n requires,\n dependencies: [],\n };\n}\n\n/**\n * Parse a `*.prompt.md` file into a `CatalogEntry` with `kind: \"prompt\"`.\n * The name defaults to the filename stem (without the `.prompt.md` suffix)\n * when no `name:` frontmatter key is present.\n *\n * Async since #454 — the file may live on the FUSE workspace mount.\n *\n * @param filePath - Absolute path to the `.prompt.md` file\n * @param repoName - Repository name used as the `repository` field of the entry\n * @returns Populated `CatalogEntry` with kind `\"prompt\"`\n * @docLink packages/core/concepts#from-prompt-md\n */\nexport async function fromPromptMd(filePath: string, repoName: string): Promise<CatalogEntry> {\n return fromPromptMdContent(await readManifestFile(filePath), repoName, filePath);\n}\n\n/** Pure {@link fromPromptMd} core over already-read content (no I/O). */\nfunction fromPromptMdContent(content: string, repoName: string, filePath: string): CatalogEntry {\n const { data: meta } = parseFrontmatter(content);\n const name = String(meta.name ?? basename(filePath).replace(/\\.prompt\\.md$/, \"\"));\n return {\n name,\n kind: \"prompt\",\n description: String(meta.description ?? \"\"),\n source: filePath,\n publisher: repoName,\n version: extractVersion(meta),\n requires: parseRequires(meta),\n dependencies: [],\n };\n}\n\n/**\n * Parse a `*.flow.yaml` or `*.flow.json` file into a `CatalogEntry` with `kind: \"flow\"`.\n * The name resolves from `id:` (a flow asset is named by its id, which the flow engine loads it\n * by), then `name:`, falling back to the filename stem; `name:` stays a display label.\n *\n * Async since #454 — the file may live on the FUSE workspace mount.\n *\n * @param filePath - Absolute path to the flow definition file\n * @param repoName - Repository name used as the `repository` field of the entry\n * @returns Populated `CatalogEntry` with kind `\"flow\"`\n * @docLink packages/core/concepts#from-flow-yaml\n */\nexport async function fromFlowYaml(filePath: string, repoName: string): Promise<CatalogEntry> {\n return fromFlowYamlContent(await readManifestFileOrEmpty(filePath), repoName, filePath);\n}\n\n/**\n * The `kind:name[#pin]` refs the nodes of a v2 flow name in `run.assets`, deduped. They are the\n * flow's dependencies: `add flow:…` deploys them and `info` / `check` list them (p676). A string\n * without a `kind:` prefix is no asset ref and is left out.\n */\nfunction flowNodeAssetRefs(meta: Record<string, unknown>): string[] {\n const refs = new Set<string>();\n if (!Array.isArray(meta.nodes)) return [];\n for (const node of meta.nodes) {\n const run = (node as { run?: { assets?: unknown } } | null)?.run;\n if (!Array.isArray(run?.assets)) continue;\n for (const asset of run.assets) {\n if (typeof asset === \"string\" && /^[a-z][a-z-]*:/.test(asset.trim())) refs.add(asset.trim());\n }\n }\n return [...refs];\n}\n\n/** Pure {@link fromFlowYaml} core over already-read content (no I/O). */\nfunction fromFlowYamlContent(content: string, repoName: string, filePath: string): CatalogEntry {\n let meta: Record<string, unknown> = {};\n try {\n meta = (parse(content) as Record<string, unknown>) ?? {};\n } catch {}\n\n const stem = basename(filePath)\n .replace(/\\.flow\\.yaml$/, \"\")\n .replace(/\\.flow\\.json$/, \"\");\n return {\n name: String(meta.id ?? meta.name ?? stem),\n kind: \"flow\",\n description: String(meta.description ?? \"\"),\n source: filePath,\n publisher: repoName,\n version: String(meta.version ?? \"\"),\n requires: parseRequires(meta),\n dependencies: flowNodeAssetRefs(meta),\n };\n}\n\n/**\n * Split a preset's `items[]` into the asset refs a dependency expansion installs\n * and the instance items it cannot: `library://` instance refs, `#item` cross\n * references, items that prompt for `placeholders`, and `connector:`/`mcp:` items\n * with an `id` (those become `skaile.yaml` declarations through\n * `skaile preset apply`). Refs are kept verbatim — publisher/pin qualifiers\n * preserved, nested `preset:` refs included.\n *\n * @param items - The raw `items` value of a parsed preset manifest.\n * @returns Deduped asset refs plus the count of skipped instance items.\n * @docLink packages/core/concepts#preset-item-refs\n */\nexport function presetItemRefs(items: unknown): { refs: string[]; skipped: number } {\n const refs = new Set<string>();\n let skipped = 0;\n if (!Array.isArray(items)) return { refs: [], skipped };\n for (const raw of items) {\n if (raw === null || typeof raw !== \"object\") continue;\n const item = raw as Record<string, unknown>;\n const ref = typeof item.ref === \"string\" ? item.ref.trim() : \"\";\n if (!ref) continue;\n const hasPlaceholders = Array.isArray(item.placeholders) && item.placeholders.length > 0;\n const declaresInstance =\n typeof item.id === \"string\" && (ref.startsWith(\"connector:\") || ref.startsWith(\"mcp:\"));\n if (\n ref.startsWith(\"library://\") ||\n ref.startsWith(\"#\") ||\n hasPlaceholders ||\n declaresInstance\n ) {\n skipped++;\n continue;\n }\n refs.add(ref);\n }\n return { refs: [...refs], skipped };\n}\n\n/**\n * Parse a `*.preset.yaml` file into a `CatalogEntry` with `kind: \"preset\"`.\n * `dependencies` carries the asset refs of its items (see {@link presetItemRefs}).\n *\n * Async since #454 — the file may live on the FUSE workspace mount.\n *\n * @param filePath - Absolute path to the preset YAML file\n * @param repoName - Repository name used as the `repository` field of the entry\n * @returns Populated `CatalogEntry` with kind `\"preset\"`\n * @docLink packages/core/concepts#from-preset-yaml\n */\nexport async function fromPresetYaml(filePath: string, repoName: string): Promise<CatalogEntry> {\n return fromPresetYamlContent(await readManifestFileOrEmpty(filePath), repoName, filePath);\n}\n\n/** Pure {@link fromPresetYaml} core over already-read content (no I/O). */\nfunction fromPresetYamlContent(content: string, repoName: string, filePath: string): CatalogEntry {\n let meta: Record<string, unknown> = {};\n try {\n meta = (parse(content) as Record<string, unknown>) ?? {};\n } catch {}\n\n const { refs, skipped } = presetItemRefs(meta.items);\n return {\n name: String(meta.name ?? basename(filePath).replace(/\\.preset\\.yaml$/, \"\")),\n kind: \"preset\",\n description: String(meta.description ?? \"\"),\n source: filePath,\n publisher: repoName,\n version: String(meta.version ?? \"\"),\n requires: [],\n dependencies: refs,\n ...(skipped > 0 ? { skippedItems: skipped } : {}),\n };\n}\n\n/**\n * Extract an asset's raw transitive dependency ref strings from its manifest\n * file, kept verbatim (publisher/pin qualifiers preserved, comments dropped by\n * the parser): a `*.preset.yaml`'s asset items (see {@link presetItemRefs}) or the\n * union of a `*.flow.{yaml,json}`'s top-level `requires` / `dependencies`. Unlike\n * {@link parseRequires}, refs are returned as-is — the resolver needs the full\n * `kind:@<publisher>/name[#pin]` form, not a publisher-stripped {@link Dependency}.\n *\n * Async since #454 — the file may live on the FUSE workspace mount.\n *\n * @param filePath - Absolute path to a `.preset.yaml` or `.flow.{yaml,json}`.\n * @returns Deduped `refs` (`[]` on parse failure or no deps) and the count of\n * preset instance items that are not expanded.\n * @docLink packages/core/concepts#asset-dep-refs\n */\nexport async function assetDepRefs(filePath: string): Promise<{ refs: string[]; skipped: number }> {\n return assetDepRefsFromContent(await readManifestFileOrEmpty(filePath), filePath);\n}\n\n/** Pure {@link assetDepRefs} core over already-read content (no I/O). */\nfunction assetDepRefsFromContent(\n content: string,\n filePath: string,\n): { refs: string[]; skipped: number } {\n // YAML is a JSON superset, so `parse` reads `.flow.json` too.\n let meta: Record<string, unknown> = {};\n try {\n meta = (parse(content) as Record<string, unknown>) ?? {};\n } catch {\n return { refs: [], skipped: 0 };\n }\n if (filePath.endsWith(\".preset.yaml\")) return presetItemRefs(meta.items);\n const out: string[] = [];\n const collect = (v: unknown) => {\n if (Array.isArray(v))\n for (const x of v) if (typeof x === \"string\" && x.trim()) out.push(x.trim());\n };\n collect(meta.requires);\n collect((meta.metadata as Record<string, unknown> | undefined)?.requires);\n collect(meta.dependencies);\n return { refs: [...new Set(out)], skipped: 0 };\n}\n\n/**\n * Parse a `CONTRACT.md` file into a `CatalogEntry` with `kind: \"contract\"`.\n * Falls back to the parent directory name when `name:` is absent.\n *\n * Async since #454 — the file may live on the FUSE workspace mount.\n *\n * @param filePath - Absolute path to the `CONTRACT.md` file\n * @param repoName - Repository name used as the `repository` field of the entry\n * @returns Populated `CatalogEntry` with kind `\"contract\"`\n * @docLink packages/core/concepts#from-contract-md\n */\nexport async function fromContractMd(filePath: string, repoName: string): Promise<CatalogEntry> {\n return fromContractMdContent(await readManifestFile(filePath), repoName, filePath);\n}\n\n/** Pure {@link fromContractMd} core over already-read content (no I/O). */\nfunction fromContractMdContent(content: string, repoName: string, filePath: string): CatalogEntry {\n const { data: meta } = parseFrontmatter(content);\n return {\n name: String(meta.name ?? basename(dirname(filePath))),\n kind: \"contract\",\n description: String(meta.description ?? \"\"),\n source: filePath,\n publisher: repoName,\n version: extractVersion(meta),\n requires: parseRequires(meta),\n dependencies: [],\n };\n}\n\n/**\n * Pure core of a standalone, composition-only markdown asset (`PERSONA.md`, `RULESET.md`):\n * identity from the frontmatter, the parent directory name when `name:` is absent. A library\n * lists these in its manifest, validates and indexes them like every other kind (p1041).\n */\nfunction fromComposableMdContent(\n kind: \"persona\" | \"ruleset\",\n content: string,\n repoName: string,\n filePath: string,\n): CatalogEntry {\n const { data: meta } = parseFrontmatter(content);\n return {\n name: String(meta.name ?? basename(dirname(filePath))),\n kind,\n description: String(meta.description ?? \"\"),\n source: filePath,\n publisher: repoName,\n version: extractVersion(meta),\n requires: [],\n dependencies: [],\n };\n}\n\n/**\n * Parse an `MCP.md` file into a `CatalogEntry` with `kind: \"mcp-server\"`.\n * Falls back to the parent directory name when `name:` is absent.\n *\n * Frontmatter fields (catalog identity):\n * - `name` — server name (default: parent dir name)\n * - `description` — short description\n * - `version` — semver\n * - `keywords` — array of discovery tags\n *\n * Frontmatter fields (runtime defaults, stored in `metadata`):\n * - `transport` — \"stdio\" | \"sse\" | \"http\" (default: \"stdio\")\n * - `command` — command to execute (stdio)\n * - `args` — command arguments (stdio)\n * - `env` — environment variables (stdio)\n * - `url` — server URL (sse/http)\n * - `headers` — HTTP headers (sse/http)\n *\n * When `mcp:name` appears in `skaile.yaml` `dependencies`, the runner reads\n * these defaults from `metadata` to build a `McpServerDeclaration` without\n * requiring verbose inline config.\n *\n * Async since #454 — the file may live on the FUSE workspace mount.\n *\n * @param filePath - Absolute path to the `MCP.md` file\n * @param repoName - Repository name used as the `repository` field of the entry\n * @returns Populated `CatalogEntry` with kind `\"mcp-server\"`\n * @docLink packages/core/concepts#from-mcp-server-md\n */\nexport async function fromMcpServerMd(filePath: string, repoName: string): Promise<CatalogEntry> {\n return fromMcpServerMdContent(await readManifestFile(filePath), repoName, filePath);\n}\n\n/**\n * Parse pre-read MCP.md content into a `CatalogEntry`.\n * Callers that already hold the file content (e.g. to avoid a second read) use\n * this directly; `fromMcpServerMd` is a thin wrapper that reads then delegates here.\n *\n * @param content - UTF-8 content of the `MCP.md` file\n * @param repoName - Repository name used as the `publisher` field of the entry\n * @param filePath - Absolute path (used as `source` and for name fallback)\n * @returns Populated `CatalogEntry` with kind `\"mcp-server\"`\n */\nexport function fromMcpServerMdContent(\n content: string,\n repoName: string,\n filePath: string,\n): CatalogEntry {\n const { data: meta } = parseFrontmatter(content);\n\n // Extract runtime defaults into metadata\n const metadata: Record<string, unknown> = {};\n if (meta.transport) metadata.transport = String(meta.transport);\n if (meta.command) metadata.command = String(meta.command);\n if (Array.isArray(meta.args)) metadata.args = meta.args.map(String);\n if (meta.env && typeof meta.env === \"object\" && !Array.isArray(meta.env)) {\n metadata.env = meta.env as Record<string, string>;\n }\n if (meta.url) metadata.url = String(meta.url);\n if (typeof meta.ca === \"string\") metadata.ca = meta.ca;\n if (meta.headers && typeof meta.headers === \"object\" && !Array.isArray(meta.headers)) {\n metadata.headers = meta.headers as Record<string, string>;\n }\n if (meta.recipe && typeof meta.recipe === \"object\" && !Array.isArray(meta.recipe)) {\n metadata.recipe = meta.recipe;\n }\n if (meta.payload && typeof meta.payload === \"object\" && !Array.isArray(meta.payload)) {\n metadata.payload = meta.payload;\n }\n if (Array.isArray(meta.fields)) {\n metadata.fields = meta.fields;\n }\n\n return {\n name: String(meta.name ?? basename(dirname(filePath))),\n kind: \"mcp-server\",\n description: String(meta.description ?? \"\"),\n source: filePath,\n publisher: repoName,\n version: extractVersion(meta),\n requires: parseRequires(meta),\n dependencies: [],\n metadata: Object.keys(metadata).length > 0 ? metadata : undefined,\n };\n}\n\n/**\n * Parse a `knowledge.yaml` file into a `CatalogEntry` with `kind: \"knowledge\"`.\n * Falls back to the parent directory name when `name:` is absent.\n *\n * Async since #454 — the file may live on the FUSE workspace mount.\n *\n * @param filePath - Absolute path to the `knowledge.yaml` file\n * @param repoName - Repository name used as the `repository` field of the entry\n * @returns Populated `CatalogEntry` with kind `\"knowledge\"`\n * @docLink packages/core/concepts#from-knowledge-yaml\n */\nexport async function fromKnowledgeYaml(filePath: string, repoName: string): Promise<CatalogEntry> {\n return fromKnowledgeYamlContent(await readManifestFileOrEmpty(filePath), repoName, filePath);\n}\n\n/** Pure {@link fromKnowledgeYaml} core over already-read content (no I/O). */\nfunction fromKnowledgeYamlContent(\n content: string,\n repoName: string,\n filePath: string,\n): CatalogEntry {\n let meta: Record<string, unknown> = {};\n try {\n meta = (parse(content) as Record<string, unknown>) ?? {};\n } catch {}\n return {\n name: String(meta.name ?? basename(dirname(filePath))),\n kind: \"knowledge\",\n description: String(meta.description ?? \"\"),\n source: filePath,\n publisher: repoName,\n version: String(meta.version ?? \"\"),\n requires: parseRequires(meta),\n dependencies: [],\n };\n}\n\n/**\n * Parse a `CONNECTOR.md` file into a `CatalogEntry` with `kind: \"connector\"`.\n * Falls back to the parent directory name when `name:` is absent.\n *\n * Frontmatter fields (catalog identity):\n * - `name` — connector name (default: parent dir name)\n * - `description` — short description\n * - `version` — semver\n *\n * Frontmatter fields (runtime defaults, stored in `metadata`):\n * - `entry` — adapter entry point (default: \"./adapter.ts\")\n * - `npm_deps` — npm dependencies required by the adapter\n * - `fields` — configuration fields the adapter expects\n * - `health_check` — whether to run a health check on connect\n *\n * The markdown body (below the frontmatter) is stored in `metadata.body`\n * so the runner can inject the connector's skill description into the\n * system prompt when `expose_as_skill` is enabled.\n *\n * Async since #454 — the file may live on the FUSE workspace mount.\n *\n * @param filePath - Absolute path to the `CONNECTOR.md` file\n * @param repoName - Repository name used as the `repository` field of the entry\n * @returns Populated `CatalogEntry` with kind `\"connector\"`\n * @docLink packages/core/concepts#from-connector-md\n */\nexport async function fromConnectorMd(filePath: string, repoName: string): Promise<CatalogEntry> {\n return fromConnectorMdContent(await readManifestFile(filePath), repoName, filePath);\n}\n\n/** Pure {@link fromConnectorMd} core over already-read content (no I/O). */\nfunction fromConnectorMdContent(content: string, repoName: string, filePath: string): CatalogEntry {\n const { data: meta, body } = parseFrontmatter(content);\n const name = String(meta.name ?? basename(dirname(filePath)));\n return {\n name,\n kind: \"connector\" as AssetKind,\n description: String(meta.description ?? \"\"),\n source: filePath,\n publisher: repoName,\n version: extractVersion(meta),\n requires: parseRequires(meta),\n dependencies: [],\n metadata: {\n entry: meta.entry ?? \"./adapter.ts\",\n npm_deps: meta.npm_deps ?? {},\n fields: meta.fields ?? [],\n health_check: meta.health_check ?? null,\n body,\n },\n };\n}\n\n// ── Recursive walker ──────────────────────────────────────────────────────────\n\ninterface WalkEntry {\n path: string;\n name: string;\n}\n\n/** Default maximum directory nesting the walk descends into. */\nexport const DEFAULT_WALK_MAX_DEPTH = 32;\n\n/** Default maximum number of directory entries a single walk may examine. */\nexport const DEFAULT_WALK_MAX_ENTRIES = 50_000;\n\n/** Default wall-clock budget for one whole walk / scan pass, in milliseconds. */\nexport const DEFAULT_WALK_BUDGET_MS = 60_000;\n\n/** Env override for {@link DEFAULT_WALK_MAX_DEPTH}. */\nexport const WALK_MAX_DEPTH_ENV_VAR = \"SKAILE_SCAN_MAX_DEPTH\";\n\n/** Env override for {@link DEFAULT_WALK_MAX_ENTRIES}. */\nexport const WALK_MAX_ENTRIES_ENV_VAR = \"SKAILE_SCAN_MAX_ENTRIES\";\n\n/** Env override for {@link DEFAULT_WALK_BUDGET_MS}. */\nexport const WALK_BUDGET_MS_ENV_VAR = \"SKAILE_SCAN_DEADLINE_MS\";\n\n/** Read a positive-integer env override, falling back when absent or unusable. */\nfunction envInt(name: string, fallback: number): number {\n const raw = process.env[name];\n if (raw === undefined) return fallback;\n const parsed = Number.parseInt(raw, 10);\n return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;\n}\n\n/**\n * Why a walk stopped early. Every one of these means the returned entries are a\n * **partial** view of the tree — never present a truncated walk as complete.\n *\n * @docLink packages/core/concepts#walk-dir\n */\nexport interface WalkTruncation {\n reason: \"depth\" | \"entries\" | \"budget\" | \"cycle\" | \"unreadable\";\n /** Directory (or symlink) at which the bound was hit. */\n path: string;\n /** The bound that was hit, when the reason has a numeric limit. */\n limit?: number;\n}\n\n/**\n * Bounds for {@link walkDir} / {@link scanDirectory}.\n *\n * @docLink packages/core/concepts#walk-dir\n */\nexport interface WalkOptions {\n /** Maximum nesting depth below the root. Default {@link DEFAULT_WALK_MAX_DEPTH}. */\n maxDepth?: number;\n /** Maximum directory entries examined across the whole walk. Default {@link DEFAULT_WALK_MAX_ENTRIES}. */\n maxEntries?: number;\n /**\n * Wall-clock budget for the whole walk. Default {@link DEFAULT_WALK_BUDGET_MS}.\n * The check is inclusive, so `0` yields no entries at all.\n */\n budgetMs?: number;\n /** Per-`opendir`/`stat`/`readFile` deadline. Default {@link fsDeadlineMs}. */\n opTimeoutMs?: number;\n /**\n * Called once per distinct truncation reason. Defaults to a `warn` on the\n * core logger — override to route the signal somewhere the caller can act on.\n */\n onTruncate?: (info: WalkTruncation) => void;\n}\n\n/**\n * Options for {@link scanDirectory}: the walk bounds plus the registered kind set\n * (`new Set(registry.getAllKinds())`) that typed frontmatter is checked against.\n */\nexport interface ScanOptions extends WalkOptions {\n /** Registered asset kinds; a `SKILL.md` `type:` outside it is reported, not catalogued. */\n knownKinds: ReadonlySet<string>;\n /** Sink for scan diagnostics (`unknown_asset_kind`). Defaults to a `warn` on the core logger. */\n onDiagnostic?: (diagnostic: Diagnostic) => void;\n /**\n * Return every asset found instead of one per `kind:name`. The default keeps the\n * alphabetically later source path, which hides a second directory holding the\n * same asset; a caller that must report such duplicates (`library index`) sets this.\n */\n keepDuplicates?: boolean;\n}\n\n/** Mutable bookkeeping threaded through one walk. */\ninterface WalkState {\n maxDepth: number;\n maxEntries: number;\n opTimeoutMs: number | undefined;\n deadlineAt: number;\n examined: number;\n /**\n * `dev:ino` of the directories on the **current path from the root** — an\n * ancestor stack, not an ever-visited set. Re-entering an ancestor is a cycle;\n * re-reaching a directory off the current path is a diamond, and must be walked.\n */\n ancestors: Set<string>;\n reported: Set<WalkTruncation[\"reason\"]>;\n onTruncate: (info: WalkTruncation) => void;\n}\n\nlet walkLogger: ReturnType<typeof createLogger> | undefined;\n\n/** `root` + reason pairs already warned about in this process (see {@link warnTruncation}). */\nconst warnedTruncations = new Set<string>();\n\n/**\n * Default truncation sink: a warning naming the walked directory (the library) and the bound\n * that was hit, once per directory and reason for the whole process. A command that looks at\n * several libraries (`add`, `search --local`) walks each more than once; a symlink cycle in one\n * of them must not repeat on every walk (p524). A cycle says what to do: remove the symlink.\n */\nfunction warnTruncation(info: WalkTruncation, root: string): void {\n const key = `${root}\\0${info.reason}`;\n if (warnedTruncations.has(key)) return;\n warnedTruncations.add(key);\n walkLogger ??= createLogger({ kind: \"runner\", subkind: \"asset-scan\" });\n if (info.reason === \"cycle\") {\n walkLogger.warn(\n `asset scan truncated (cycle) — results are incomplete: in ${root}, the symlink ${info.path} points back into the tree; remove the symlink`,\n );\n return;\n }\n walkLogger.warn(`asset scan truncated (${info.reason}) — results are incomplete: ${root}`, {\n ...info,\n });\n}\n\n/** Default diagnostic sink for {@link scanDirectory}. */\nfunction warnDiagnostic(d: Diagnostic): void {\n walkLogger ??= createLogger({ kind: \"runner\", subkind: \"asset-scan\" });\n walkLogger.warn(d.message, { code: d.code, path: d.path });\n}\n\n/** Record a truncation once per reason so a wide tree does not spam the log. */\nfunction truncate(state: WalkState, info: WalkTruncation): void {\n if (state.reported.has(info.reason)) return;\n state.reported.add(info.reason);\n state.onTruncate(info);\n}\n\n/**\n * Stable identity (`dev:ino`) of the directory `path` resolves to, or `null`\n * when it cannot be stat'ed within the deadline. Used to terminate symlink\n * cycles — the pre-#454 walker recursed forever on `a/link -> a`.\n */\nasync function dirIdentity(path: string, timeoutMs: number | undefined): Promise<string | null> {\n const st = await tryWithFsDeadline(`stat ${path}`, () => stat(path), null, timeoutMs);\n return st ? `${st.dev}:${st.ino}` : null;\n}\n\n/**\n * Read one directory's entries under a deadline, capped at the walk's remaining\n * entry budget. Uses `opendir` rather than `readdir` so a pathological directory\n * streams instead of materialising in full; entries are collected and sorted\n * because the `scanDirectory` dedup rule (\"alphabetically later source wins\")\n * depends on a deterministic per-level order.\n */\nasync function readDirEntries(\n dir: string,\n state: WalkState,\n): Promise<{ entries: Dirent[]; capped: boolean } | null> {\n const remaining = state.maxEntries - state.examined;\n if (remaining <= 0) return { entries: [], capped: true };\n try {\n return await withFsDeadline(\n `opendir ${dir}`,\n async () => {\n const handle = await opendir(dir);\n const entries: Dirent[] = [];\n let capped = false;\n for await (const e of handle) {\n // Stop *before* keeping the over-budget entry, so `capped` means \"an\n // entry was actually dropped\". Breaking after the push instead marked\n // a directory of exactly `remaining` entries as truncated — and since\n // `truncate()` reports once per reason for the whole walk, that\n // spurious first report swallowed a later genuine one.\n if (entries.length >= remaining) {\n capped = true;\n break;\n }\n entries.push(e);\n }\n entries.sort((a, b) => (a.name < b.name ? -1 : 1));\n return { entries, capped };\n },\n state.opTimeoutMs,\n );\n } catch {\n // Unreadable (permissions, vanished mid-walk) or the mount missed its\n // deadline. Either way this subtree contributes nothing; keep walking.\n truncate(state, { reason: \"unreadable\", path: dir });\n return null;\n }\n}\n\n/**\n * Recursively yield every file entry under `dir`, sorted alphabetically at each\n * level. Skips `.git` and `node_modules` directories and follows symlinks\n * (resolving to the stat target). `node_modules` is excluded because Bun's\n * `node_modules/.bun/...` layout contains symlink farms that form cycles when\n * packages reference each other transitively.\n *\n * **Async and bounded since #454.** A repo root can resolve onto the rclone FUSE\n * mount, where the previous synchronous `readdirSync`/`statSync` walk parked the\n * whole event loop. Four bounds now hold, and hitting any of them reports a\n * {@link WalkTruncation} — a truncated walk is never presented as a complete one:\n *\n * - **depth** ({@link WalkOptions.maxDepth}) — also the backstop for a cycle no\n * inode check can see, e.g. a bind mount of the root inside itself.\n * - **entry count** ({@link WalkOptions.maxEntries}) — total directory entries\n * examined, so an enormous tree cannot run unbounded.\n * - **wall-clock budget** ({@link WalkOptions.budgetMs}) — a wedged mount that\n * times out one operation at a time cannot add up to an unbounded scan.\n * - **ancestor inodes** — the `dev:ino` of every directory on the path from the\n * root is held while its subtree is walked, so `a/link -> a` terminates\n * instead of recursing forever. Two sibling symlinks onto one shared\n * directory are a diamond, not a cycle: both are walked, at the price of\n * visiting the shared subtree twice — bounded by the entry and time budgets.\n *\n * @param dir - Absolute path to the directory to walk\n * @param options - Bounds and truncation sink; see {@link WalkOptions}\n * @docLink packages/core/concepts#walk-dir\n */\nexport async function* walkDir(dir: string, options: WalkOptions = {}): AsyncGenerator<WalkEntry> {\n const state: WalkState = {\n maxDepth: options.maxDepth ?? envInt(WALK_MAX_DEPTH_ENV_VAR, DEFAULT_WALK_MAX_DEPTH),\n maxEntries: options.maxEntries ?? envInt(WALK_MAX_ENTRIES_ENV_VAR, DEFAULT_WALK_MAX_ENTRIES),\n opTimeoutMs: options.opTimeoutMs,\n deadlineAt:\n Date.now() + (options.budgetMs ?? envInt(WALK_BUDGET_MS_ENV_VAR, DEFAULT_WALK_BUDGET_MS)),\n examined: 0,\n ancestors: new Set<string>(),\n reported: new Set<WalkTruncation[\"reason\"]>(),\n onTruncate: options.onTruncate ?? ((info) => warnTruncation(info, dir)),\n };\n // The root is an ancestor of everything, so it is seeded here and never\n // popped — a self-referential `root/link -> root` is caught on first descent.\n const rootId = await dirIdentity(dir, state.opTimeoutMs);\n if (rootId) state.ancestors.add(rootId);\n yield* walkFrom(dir, 0, state);\n}\n\nasync function* walkFrom(dir: string, depth: number, state: WalkState): AsyncGenerator<WalkEntry> {\n if (depth > state.maxDepth) {\n truncate(state, { reason: \"depth\", path: dir, limit: state.maxDepth });\n return;\n }\n if (Date.now() >= state.deadlineAt) {\n truncate(state, { reason: \"budget\", path: dir });\n return;\n }\n\n const read = await readDirEntries(dir, state);\n if (!read) return;\n if (read.capped) truncate(state, { reason: \"entries\", path: dir, limit: state.maxEntries });\n\n for (const e of read.entries) {\n if (state.examined >= state.maxEntries) {\n truncate(state, { reason: \"entries\", path: dir, limit: state.maxEntries });\n return;\n }\n if (Date.now() >= state.deadlineAt) {\n truncate(state, { reason: \"budget\", path: dir });\n return;\n }\n state.examined++;\n const full = join(dir, e.name);\n\n if (e.isSymbolicLink()) {\n // A symlink is the only way a cycle can enter this walk, so identity is\n // resolved here and nowhere else — one extra stat per link, none per\n // ordinary directory.\n const st = await tryWithFsDeadline(`stat ${full}`, () => stat(full), null, state.opTimeoutMs);\n if (!st) continue;\n if (st.isDirectory()) {\n if (e.name === \".git\" || e.name === \"node_modules\") continue;\n const id = `${st.dev}:${st.ino}`;\n // Only an *ancestor* is a cycle. A target already walked elsewhere in\n // the tree is a diamond (`a/link -> shared`, `b/link -> shared`) and\n // dropping it would silently lose that subtree from the scan.\n if (state.ancestors.has(id)) {\n truncate(state, { reason: \"cycle\", path: full });\n continue;\n }\n state.ancestors.add(id);\n try {\n yield* walkFrom(full, depth + 1, state);\n } finally {\n // finally, not a trailing delete: an early `return` from the bounds\n // checks — or an abandoned consumer — would otherwise leave the\n // ancestor stack holding a directory the walk has already left.\n state.ancestors.delete(id);\n }\n } else {\n yield { path: full, name: e.name };\n }\n } else if (e.isDirectory()) {\n if (e.name !== \".git\" && e.name !== \"node_modules\") yield* walkFrom(full, depth + 1, state);\n } else if (e.isFile()) {\n yield { path: full, name: e.name };\n }\n }\n}\n\n// ── Public scanner ────────────────────────────────────────────────────────────\n\n/**\n * Coerce a scanned entry's `name` to a canonical asset name in place. When the\n * raw name is already canonical this is a no-op; otherwise the original is stashed\n * on `metadata.displayName` (only when not already set) so callers keep the pretty\n * label for display while identity uses the slug. A name that slugifies to empty\n * is left untouched — `parseAssetRef` will reject it downstream with its full hint.\n */\nfunction normalizeEntryName(e: CatalogEntry): void {\n if (isValidAssetName(e.name)) return;\n let slug: string;\n try {\n slug = slugifyAssetName(e.name);\n } catch {\n return;\n }\n const original = e.name;\n e.name = slug;\n if (e.metadata?.displayName === undefined) {\n e.metadata = { ...e.metadata, displayName: original };\n }\n}\n\n/**\n * Build a `CatalogEntry` from an already-read manifest, dispatching on filename.\n * Returns `null` when the filename is not a recognized manifest.\n */\nfunction entryFromManifest(\n name: string,\n content: string,\n filePath: string,\n repoName: string,\n knownKinds: ReadonlySet<string>,\n): CatalogEntry | null {\n if (name === \"SKILL.md\") return fromSkillMdContent(content, repoName, filePath, knownKinds);\n if (name === \"AGENT.md\") return fromAgentMdContent(content, repoName, filePath);\n if (name === \"agent.yaml\") return fromAgentYamlContent(content, repoName, filePath);\n if (name === \"CONTRACT.md\") return fromContractMdContent(content, repoName, filePath);\n if (name === \"PERSONA.md\") return fromComposableMdContent(\"persona\", content, repoName, filePath);\n if (name === \"RULESET.md\") return fromComposableMdContent(\"ruleset\", content, repoName, filePath);\n if (name === \"MCP.md\") return fromMcpServerMdContent(content, repoName, filePath);\n if (name === \"CONNECTOR.md\") return fromConnectorMdContent(content, repoName, filePath);\n if (name === \"knowledge.yaml\") return fromKnowledgeYamlContent(content, repoName, filePath);\n if (name.endsWith(\".prompt.md\")) return fromPromptMdContent(content, repoName, filePath);\n if (name.endsWith(\".preset.yaml\")) return fromPresetYamlContent(content, repoName, filePath);\n if (name.endsWith(\".flow.yaml\") || name.endsWith(\".flow.json\"))\n return fromFlowYamlContent(content, repoName, filePath);\n return null;\n}\n\n/** Filenames {@link scanDirectory} recognises as asset manifests. */\nexport function isManifestName(name: string): boolean {\n return (\n name === \"SKILL.md\" ||\n name === \"AGENT.md\" ||\n name === \"agent.yaml\" ||\n name === \"CONTRACT.md\" ||\n name === \"PERSONA.md\" ||\n name === \"RULESET.md\" ||\n name === \"MCP.md\" ||\n name === \"CONNECTOR.md\" ||\n name === \"knowledge.yaml\" ||\n name.endsWith(\".prompt.md\") ||\n name.endsWith(\".preset.yaml\") ||\n name.endsWith(\".flow.yaml\") ||\n name.endsWith(\".flow.json\")\n );\n}\n\n/** Per-asset values a `skaile.manifest.yaml` `assets[]` entry overrides on the scanned entry. */\ninterface ManifestAssetOverride {\n publisher?: string;\n version?: string;\n dependencies: string[];\n}\n\n/**\n * Per-asset overrides declared in `<root>/skaile.manifest.yaml` `assets[]` (`publisher`,\n * `dependencies`), keyed `kind:name`. Empty when the manifest is absent, unreadable within\n * the deadline, or not valid YAML — a scan never fails on it.\n */\nasync function readManifestAssetOverrides(\n root: string,\n opTimeoutMs: number,\n): Promise<Record<string, ManifestAssetOverride>> {\n const out: Record<string, ManifestAssetOverride> = {};\n const file = join(root, \"skaile.manifest.yaml\");\n const content = await tryWithFsDeadline(\n `readFile ${file}`,\n () => readFile(file, \"utf8\"),\n null,\n opTimeoutMs,\n );\n if (content === null) return out;\n let doc: unknown;\n try {\n doc = parse(content);\n } catch {\n return out;\n }\n const assets = (doc as { assets?: unknown } | null)?.assets;\n if (!Array.isArray(assets)) return out;\n for (const a of assets) {\n const { kind, name, publisher, dependencies, version } = (a ?? {}) as Record<string, unknown>;\n if (typeof kind !== \"string\" || typeof name !== \"string\") continue;\n const override: ManifestAssetOverride = {\n dependencies: Array.isArray(dependencies)\n ? dependencies.filter((d): d is string => typeof d === \"string\" && d.trim().length > 0)\n : [],\n };\n const bare = typeof publisher === \"string\" ? publisher.trim().replace(/^@/, \"\") : \"\";\n if (bare) override.publisher = bare;\n if (typeof version === \"string\" && version.trim() !== \"\") override.version = version.trim();\n if (override.publisher || override.version || override.dependencies.length > 0)\n out[`${kind}:${name}`] = override;\n }\n return out;\n}\n\n/**\n * Fold a manifest entry's `dependencies` into `entry.requires`: the manifest field is the\n * author-declared requirement list of the entry (same meaning as `requires`), so every\n * consumer of the scanned entry (`add`, `install`, `info`, `check`, `doctor`) sees it.\n * A requirement the file already declares is not repeated, by {@link requirementKey}\n * identity: the file's bare `report-table` and the manifest's `skill:@pub/report-table`\n * are one requirement when `pub` is the entry's own publisher.\n */\nfunction mergeManifestDependencies(entry: CatalogEntry, dependencies: readonly string[]): void {\n entry.requires = dedupeRequirements(\n [...entry.requires, ...dependencies.map((raw) => parseDep(raw))],\n entry.publisher,\n );\n}\n\n/**\n * Walk `root` recursively and return a `CatalogEntry` for every recognized asset manifest found.\n *\n * Recognized filenames: `SKILL.md`, `AGENT.md`, `agent.yaml`, `CONTRACT.md`, `MCP.md`,\n * `CONNECTOR.md`, `knowledge.yaml`, `*.prompt.md`, `*.preset.yaml`, `*.flow.yaml`, `*.flow.json`.\n *\n * When two entries share the same `kind:name` key, the one with the alphabetically\n * later source path wins (consistent with catalog precedence rules), unless\n * {@link ScanOptions.keepDuplicates} asks for every copy.\n *\n * **Async and bounded since #454.** `root` can resolve onto the rclone FUSE mount\n * (a `sources[].path` under `/skaile/workspace`), and the walk follows symlinks, so\n * even an off-mount root can descend into one. Every `opendir`/`stat`/`readFile`\n * is deadline-bounded and the walk is capped by depth, entry count, a wall-clock\n * budget, and an ancestor-inode set — see {@link walkDir}. Hitting any bound reports\n * a {@link WalkTruncation} through {@link WalkOptions.onTruncate} (a `warn` by\n * default); the returned array is then a **partial** scan, never a complete one.\n *\n * A manifest that cannot be read within its deadline is skipped rather than\n * failing the whole scan — one unreachable file must not cost the whole catalog.\n *\n * **Per-asset publisher.** When `root` holds a `skaile.manifest.yaml` whose `assets[]`\n * entry names a `publisher` for a scanned `kind`/`name`, that publisher replaces\n * `repoName` on the produced entry — the same identity the library index and\n * `library create --publisher` write, so `kind:@<publisher>/<name>` resolves.\n *\n * **Per-asset dependencies.** The same entry's `dependencies` (`kind:@<publisher>/name[#pin]`)\n * are appended to the produced entry's `requires`, next to the file's own `requires`.\n *\n * @param root - Absolute path to the directory tree to scan\n * @param repoName - Publisher attached to every produced entry without a per-asset override\n * @param options - Walk bounds and truncation sink; see {@link WalkOptions}\n * @returns Array of deduplicated `CatalogEntry` objects, one per manifest file\n * @docLink packages/core/concepts#scan-directory\n */\nexport async function scanDirectory(\n root: string,\n repoName: string,\n options: ScanOptions,\n): Promise<CatalogEntry[]> {\n const entries = new Map<string, CatalogEntry>();\n const copies: CatalogEntry[] = [];\n const onTruncate = options.onTruncate ?? ((info: WalkTruncation) => warnTruncation(info, root));\n const reported = new Set<WalkTruncation[\"reason\"]>();\n const relay = (info: WalkTruncation) => {\n reported.add(info.reason);\n onTruncate(info);\n };\n const opTimeoutMs = options.opTimeoutMs ?? fsDeadlineMs();\n const manifestOverrides = await readManifestAssetOverrides(root, opTimeoutMs);\n\n function add(e: CatalogEntry): void {\n // Boundary normalization: a third-party source we don't control may name an\n // asset with a human-styled identity (\"Complex App\"). Slugify it to a\n // canonical name so the ref it produces parses, preserving the original on\n // `metadata.displayName` for display. No-op for already-canonical names.\n normalizeEntryName(e);\n const key = `${e.kind}:${e.name}`;\n const override = manifestOverrides[key];\n if (override?.publisher) e.publisher = override.publisher;\n // A file that declares no version (AGENT.md, agent.yaml) has the manifest entry's, so every\n // library holding it agrees on the version.\n if (!e.version && override?.version) e.version = override.version;\n if (override) mergeManifestDependencies(e, override.dependencies);\n if (options.keepDuplicates) {\n copies.push(e);\n return;\n }\n const existing = entries.get(key);\n if (!existing) {\n entries.set(key, e);\n return;\n }\n // Among duplicates, alphabetically later source path wins\n if (e.source > existing.source) entries.set(key, e);\n }\n\n for await (const { path: filePath, name } of walkDir(root, {\n ...options,\n opTimeoutMs,\n onTruncate: relay,\n })) {\n if (!isManifestName(name)) continue;\n const content = await tryWithFsDeadline(\n `readFile ${filePath}`,\n () => readFile(filePath, \"utf8\"),\n null,\n opTimeoutMs,\n );\n if (content === null) {\n // Unreadable or past its deadline — the catalog loses this asset, not the\n // whole scan. Reported once so a wedged mount is visible in the logs.\n if (!reported.has(\"unreadable\")) relay({ reason: \"unreadable\", path: filePath });\n continue;\n }\n try {\n const entry = entryFromManifest(name, content, filePath, repoName, options.knownKinds);\n if (entry) add(entry);\n } catch (err) {\n if (err instanceof ManifestKindError) {\n (options.onDiagnostic ?? warnDiagnostic)(manifestKindDiagnostic(err));\n }\n }\n }\n\n return options.keepDuplicates ? copies : [...entries.values()];\n}\n\n/**\n * The prompt text of a manifest file, as the scaffold-body check wants it: the\n * markdown body of a `.md` marker (`SKILL.md`, `AGENT.md`, …), the `SOUL.md` next to\n * an `agent.yaml` agent, `undefined` for every other YAML manifest.\n *\n * @param file Absolute path of the manifest file.\n * @param text The file's content.\n */\nexport function readAssetBody(file: string, text: string): string | undefined {\n if (file.endsWith(\".md\")) return parseFrontmatter(text).body;\n if (basename(file) !== \"agent.yaml\") return undefined;\n const soul = join(dirname(file), \"SOUL.md\");\n return existsSync(soul) ? readFileSync(soul, \"utf8\").trim() : undefined;\n}\n"]}