@skaile/workspaces 5.9.0 → 5.10.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 (296) hide show
  1. package/CHANGELOG.md +96 -0
  2. package/dist/{asset-feeds-XMKKUUK6.js → asset-feeds-ELEBTNUS.js} +18 -18
  3. package/dist/{asset-feeds-XMKKUUK6.js.map → asset-feeds-ELEBTNUS.js.map} +1 -1
  4. package/dist/asset-manager/catalog-deployer.js +8 -8
  5. package/dist/asset-manager/index.js +14 -14
  6. package/dist/asset-manager/installer.js +10 -10
  7. package/dist/asset-manager/renderers.js +9 -9
  8. package/dist/asset-manager/src/index.d.ts +300 -36
  9. package/dist/asset-manager/src/index.d.ts.map +1 -1
  10. package/dist/asset-manager/src/install-agent.d.ts +3 -1
  11. package/dist/asset-manager/src/install-agent.d.ts.map +1 -1
  12. package/dist/asset-manager/src/install-instances.d.ts +31 -1
  13. package/dist/asset-manager/src/install-instances.d.ts.map +1 -1
  14. package/dist/asset-manager/src/installer.d.ts +20 -0
  15. package/dist/asset-manager/src/installer.d.ts.map +1 -1
  16. package/dist/asset-manager/src/renderers.d.ts +4 -5
  17. package/dist/asset-manager/src/renderers.d.ts.map +1 -1
  18. package/dist/bridge/drivers/claude-sdk.js +11 -11
  19. package/dist/bridge/drivers/codex.js +11 -11
  20. package/dist/bridge/drivers/continue.js +10 -10
  21. package/dist/bridge/drivers/echo.js +2 -2
  22. package/dist/bridge/drivers/gemini.js +7 -7
  23. package/dist/bridge/drivers/goose.js +10 -10
  24. package/dist/bridge/drivers/omp.js +3 -3
  25. package/dist/bridge/drivers/opencode.js +10 -10
  26. package/dist/bridge/drivers/qwen.js +7 -7
  27. package/dist/bridge/index.js +12 -12
  28. package/dist/{chunk-36AFURKZ.js → chunk-2FMEGSBN.js} +38 -11
  29. package/dist/chunk-2FMEGSBN.js.map +1 -0
  30. package/dist/{chunk-IMKSM5NL.js → chunk-2JMLDZLP.js} +1069 -182
  31. package/dist/chunk-2JMLDZLP.js.map +1 -0
  32. package/dist/{chunk-B6GIW55K.js → chunk-32XKCNCL.js} +6 -3
  33. package/dist/chunk-32XKCNCL.js.map +1 -0
  34. package/dist/{chunk-4MQS7CAF.js → chunk-3BEY4WK3.js} +371 -175
  35. package/dist/chunk-3BEY4WK3.js.map +1 -0
  36. package/dist/{chunk-FYXZRVID.js → chunk-3KHYGOEY.js} +3 -3
  37. package/dist/{chunk-FYXZRVID.js.map → chunk-3KHYGOEY.js.map} +1 -1
  38. package/dist/{chunk-CGT45WN7.js → chunk-3MKPZZRE.js} +3 -3
  39. package/dist/{chunk-CGT45WN7.js.map → chunk-3MKPZZRE.js.map} +1 -1
  40. package/dist/{chunk-QVNRCDTV.js → chunk-4OV5DSBB.js} +4 -4
  41. package/dist/chunk-4OV5DSBB.js.map +1 -0
  42. package/dist/{chunk-GKMZ6THE.js → chunk-4P3KTUZH.js} +33 -33
  43. package/dist/chunk-4P3KTUZH.js.map +1 -0
  44. package/dist/{chunk-ZTBAYUDY.js → chunk-5QI2JYJC.js} +2 -2
  45. package/dist/{chunk-ZTBAYUDY.js.map → chunk-5QI2JYJC.js.map} +1 -1
  46. package/dist/{chunk-EF7NPDDU.js → chunk-6HHE63CO.js} +31 -17
  47. package/dist/chunk-6HHE63CO.js.map +1 -0
  48. package/dist/{chunk-TTRYE6AC.js → chunk-7CR6HT2X.js} +8 -8
  49. package/dist/{chunk-TTRYE6AC.js.map → chunk-7CR6HT2X.js.map} +1 -1
  50. package/dist/{chunk-FZNG4V4J.js → chunk-7I5VRVDP.js} +3 -3
  51. package/dist/{chunk-FZNG4V4J.js.map → chunk-7I5VRVDP.js.map} +1 -1
  52. package/dist/{chunk-P67WJVP4.js → chunk-CLTHEKHR.js} +10 -9
  53. package/dist/chunk-CLTHEKHR.js.map +1 -0
  54. package/dist/{chunk-UMVKJM4Q.js → chunk-DALV4HHP.js} +18 -3
  55. package/dist/chunk-DALV4HHP.js.map +1 -0
  56. package/dist/{chunk-IR33D6EP.js → chunk-FRPBSUFH.js} +5 -5
  57. package/dist/{chunk-IR33D6EP.js.map → chunk-FRPBSUFH.js.map} +1 -1
  58. package/dist/{chunk-W5DWWE4Y.js → chunk-G54USEUP.js} +4 -4
  59. package/dist/{chunk-W5DWWE4Y.js.map → chunk-G54USEUP.js.map} +1 -1
  60. package/dist/{chunk-Y7QA2OLD.js → chunk-GEWAIQZ5.js} +24 -20
  61. package/dist/chunk-GEWAIQZ5.js.map +1 -0
  62. package/dist/{chunk-GB7WDMH2.js → chunk-GFCXNFTW.js} +4 -4
  63. package/dist/{chunk-GB7WDMH2.js.map → chunk-GFCXNFTW.js.map} +1 -1
  64. package/dist/{chunk-5NNNV76P.js → chunk-HJ5MCB3L.js} +2 -2
  65. package/dist/{chunk-5NNNV76P.js.map → chunk-HJ5MCB3L.js.map} +1 -1
  66. package/dist/{chunk-2LWYNQK7.js → chunk-HOHUEKES.js} +3 -3
  67. package/dist/{chunk-2LWYNQK7.js.map → chunk-HOHUEKES.js.map} +1 -1
  68. package/dist/{chunk-UM7RIAHO.js → chunk-IJHH4DSW.js} +8 -8
  69. package/dist/{chunk-UM7RIAHO.js.map → chunk-IJHH4DSW.js.map} +1 -1
  70. package/dist/{chunk-BTE2V4IW.js → chunk-IXWODEED.js} +40 -7
  71. package/dist/chunk-IXWODEED.js.map +1 -0
  72. package/dist/{chunk-K3CVFRVS.js → chunk-JFXQEVLF.js} +3 -3
  73. package/dist/{chunk-K3CVFRVS.js.map → chunk-JFXQEVLF.js.map} +1 -1
  74. package/dist/{chunk-JAKOMFC6.js → chunk-JZCSNEHK.js} +77 -31
  75. package/dist/chunk-JZCSNEHK.js.map +1 -0
  76. package/dist/{chunk-CKQEIY43.js → chunk-MVQ3Q2HM.js} +4 -4
  77. package/dist/{chunk-CKQEIY43.js.map → chunk-MVQ3Q2HM.js.map} +1 -1
  78. package/dist/{chunk-LAMCXQGA.js → chunk-NRDSGLCQ.js} +31 -24
  79. package/dist/chunk-NRDSGLCQ.js.map +1 -0
  80. package/dist/{chunk-V2DXZYBB.js → chunk-NWDSLXOX.js} +3 -3
  81. package/dist/{chunk-V2DXZYBB.js.map → chunk-NWDSLXOX.js.map} +1 -1
  82. package/dist/{chunk-MR5HBOUF.js → chunk-OBVJ7RPW.js} +3 -3
  83. package/dist/{chunk-MR5HBOUF.js.map → chunk-OBVJ7RPW.js.map} +1 -1
  84. package/dist/{chunk-J7U3PIOE.js → chunk-OOWHXOK6.js} +4 -4
  85. package/dist/{chunk-J7U3PIOE.js.map → chunk-OOWHXOK6.js.map} +1 -1
  86. package/dist/{chunk-YSHVQGUS.js → chunk-PE36IF2D.js} +119 -30
  87. package/dist/chunk-PE36IF2D.js.map +1 -0
  88. package/dist/{chunk-S53LOR7B.js → chunk-QG3HOJEK.js} +3 -3
  89. package/dist/{chunk-S53LOR7B.js.map → chunk-QG3HOJEK.js.map} +1 -1
  90. package/dist/{chunk-2FRUUDZY.js → chunk-SBFW3CJH.js} +5 -5
  91. package/dist/{chunk-2FRUUDZY.js.map → chunk-SBFW3CJH.js.map} +1 -1
  92. package/dist/{chunk-UAROCOXF.js → chunk-SX5U422E.js} +3 -3
  93. package/dist/{chunk-UAROCOXF.js.map → chunk-SX5U422E.js.map} +1 -1
  94. package/dist/{chunk-QVEKLSEH.js → chunk-TH4CTXHX.js} +6 -6
  95. package/dist/{chunk-QVEKLSEH.js.map → chunk-TH4CTXHX.js.map} +1 -1
  96. package/dist/{chunk-JZ5EHBPI.js → chunk-TRSQP3JD.js} +3 -3
  97. package/dist/{chunk-JZ5EHBPI.js.map → chunk-TRSQP3JD.js.map} +1 -1
  98. package/dist/{chunk-FVJK4QWM.js → chunk-V5TZH4GF.js} +4 -4
  99. package/dist/{chunk-FVJK4QWM.js.map → chunk-V5TZH4GF.js.map} +1 -1
  100. package/dist/{chunk-GXLQLPE5.js → chunk-V7PQZOBR.js} +5 -5
  101. package/dist/{chunk-GXLQLPE5.js.map → chunk-V7PQZOBR.js.map} +1 -1
  102. package/dist/{chunk-DNZYOKOJ.js → chunk-VLXDXRRX.js} +3 -3
  103. package/dist/{chunk-DNZYOKOJ.js.map → chunk-VLXDXRRX.js.map} +1 -1
  104. package/dist/{chunk-Y4N2NUZD.js → chunk-WBYDAL6X.js} +4 -4
  105. package/dist/{chunk-Y4N2NUZD.js.map → chunk-WBYDAL6X.js.map} +1 -1
  106. package/dist/{chunk-SCOT677Q.js → chunk-XCNK4UE5.js} +5 -5
  107. package/dist/{chunk-SCOT677Q.js.map → chunk-XCNK4UE5.js.map} +1 -1
  108. package/dist/{chunk-GTILM2CI.js → chunk-Y34MSWEZ.js} +43 -12
  109. package/dist/chunk-Y34MSWEZ.js.map +1 -0
  110. package/dist/{chunk-4PTSR4UU.js → chunk-Y63UQZ7P.js} +3 -3
  111. package/dist/{chunk-4PTSR4UU.js.map → chunk-Y63UQZ7P.js.map} +1 -1
  112. package/dist/chunk-YBQONMH2.js +465 -0
  113. package/dist/chunk-YBQONMH2.js.map +1 -0
  114. package/dist/{chunk-7AI3Q5AQ.js → chunk-Z2K6BGUR.js} +71 -24
  115. package/dist/chunk-Z2K6BGUR.js.map +1 -0
  116. package/dist/{chunk-UO7WPLDY.js → chunk-ZGQTS3Y4.js} +3 -3
  117. package/dist/{chunk-UO7WPLDY.js.map → chunk-ZGQTS3Y4.js.map} +1 -1
  118. package/dist/cli/index.js +910 -717
  119. package/dist/cli/index.js.map +1 -1
  120. package/dist/cli/src/commands/asset-cmd.d.ts.map +1 -1
  121. package/dist/cli/src/commands/catalog.d.ts +8 -5
  122. package/dist/cli/src/commands/catalog.d.ts.map +1 -1
  123. package/dist/cli/src/commands/diff.d.ts +3 -1
  124. package/dist/cli/src/commands/diff.d.ts.map +1 -1
  125. package/dist/cli/src/commands/library-cmd.d.ts.map +1 -1
  126. package/dist/cli/src/commands/library-index.d.ts +34 -2
  127. package/dist/cli/src/commands/library-index.d.ts.map +1 -1
  128. package/dist/cli/src/commands/library-publish.d.ts.map +1 -1
  129. package/dist/cli/src/commands/manage.d.ts +6 -5
  130. package/dist/cli/src/commands/manage.d.ts.map +1 -1
  131. package/dist/cli/src/commands/migrate-assets.d.ts.map +1 -1
  132. package/dist/cli/src/commands/outdated.d.ts +7 -5
  133. package/dist/cli/src/commands/outdated.d.ts.map +1 -1
  134. package/dist/cli/src/commands/project.d.ts +11 -8
  135. package/dist/cli/src/commands/project.d.ts.map +1 -1
  136. package/dist/cli/src/commands/source.d.ts +30 -1
  137. package/dist/cli/src/commands/source.d.ts.map +1 -1
  138. package/dist/cli/src/commands/update.d.ts.map +1 -1
  139. package/dist/cli/src/commands/validate.d.ts.map +1 -1
  140. package/dist/cli/src/commands/why.d.ts.map +1 -1
  141. package/dist/cli/src/skill-checks.d.ts +47 -2
  142. package/dist/cli/src/skill-checks.d.ts.map +1 -1
  143. package/dist/connectors/config.js +5 -5
  144. package/dist/connectors/index.js +15 -15
  145. package/dist/{connectors-C7UQ73BK.js → connectors-OXP2JBGI.js} +18 -18
  146. package/dist/{connectors-C7UQ73BK.js.map → connectors-OXP2JBGI.js.map} +1 -1
  147. package/dist/core/index.js +7 -7
  148. package/dist/core/logging.js +1 -1
  149. package/dist/core/manifest.js +2 -2
  150. package/dist/core/models.js +1 -1
  151. package/dist/core/publish-manifest.js +2 -2
  152. package/dist/core/ref.js +1 -1
  153. package/dist/core/runtime-assets.js +5 -5
  154. package/dist/core/src/index.d.ts +2 -1
  155. package/dist/core/src/index.d.ts.map +1 -1
  156. package/dist/core/src/lock.d.ts +5 -2
  157. package/dist/core/src/lock.d.ts.map +1 -1
  158. package/dist/core/src/logging/sinks/sqlite-runtime.d.ts.map +1 -1
  159. package/dist/core/src/manifest.d.ts.map +1 -1
  160. package/dist/core/src/models.d.ts +21 -5
  161. package/dist/core/src/models.d.ts.map +1 -1
  162. package/dist/core/src/publish-manifest.d.ts +19 -3
  163. package/dist/core/src/publish-manifest.d.ts.map +1 -1
  164. package/dist/core/src/repo-manager.d.ts.map +1 -1
  165. package/dist/core/src/requirements.d.ts +26 -0
  166. package/dist/core/src/requirements.d.ts.map +1 -0
  167. package/dist/core/src/walker.d.ts.map +1 -1
  168. package/dist/core/src/workspace-config.d.ts +18 -0
  169. package/dist/core/src/workspace-config.d.ts.map +1 -1
  170. package/dist/core/src/workspace-yaml-editor.d.ts +4 -1
  171. package/dist/core/src/workspace-yaml-editor.d.ts.map +1 -1
  172. package/dist/core/workspace-config.js +4 -4
  173. package/dist/deploy/index.js +7 -7
  174. package/dist/discovery/index.js +5 -5
  175. package/dist/discovery/src/builtin-providers.d.ts.map +1 -1
  176. package/dist/discovery/src/discover-manifest.d.ts.map +1 -1
  177. package/dist/discovery/src/discover.d.ts.map +1 -1
  178. package/dist/discovery/src/source-config.d.ts.map +1 -1
  179. package/dist/discovery/src/tree-entries.d.ts.map +1 -1
  180. package/dist/{ensure-sources-SRC2DVR5.js → ensure-sources-5ISVIA4T.js} +17 -17
  181. package/dist/{ensure-sources-SRC2DVR5.js.map → ensure-sources-5ISVIA4T.js.map} +1 -1
  182. package/dist/factory-assets/connectors/box.js +15 -15
  183. package/dist/factory-assets/connectors/deploy.js +15 -15
  184. package/dist/factory-assets/connectors/devserver.js +15 -15
  185. package/dist/factory-assets/connectors/flow/adapter.js +15 -15
  186. package/dist/factory-assets/connectors/flow/engine.js +8 -8
  187. package/dist/factory-assets/connectors/flow/run-flow.js +17 -17
  188. package/dist/factory-assets/connectors/flow.js +15 -15
  189. package/dist/factory-assets/connectors/git.js +15 -15
  190. package/dist/factory-assets/connectors/gmail.js +15 -15
  191. package/dist/factory-assets/connectors/googledrive.js +15 -15
  192. package/dist/factory-assets/connectors/local.js +15 -15
  193. package/dist/factory-assets/connectors/mattermost.js +15 -15
  194. package/dist/factory-assets/connectors/memory.js +15 -15
  195. package/dist/factory-assets/connectors/minio.js +15 -15
  196. package/dist/factory-assets/connectors/postgres.js +15 -15
  197. package/dist/factory-assets/connectors/s3.js +15 -15
  198. package/dist/factory-assets/connectors/sharepoint.js +15 -15
  199. package/dist/factory-assets/connectors/sqlite.js +15 -15
  200. package/dist/factory-assets/connectors/static-server.js +15 -15
  201. package/dist/factory-assets/connectors/tunnel.js +15 -15
  202. package/dist/factory-assets/connectors/webdav.js +15 -15
  203. package/dist/factory-assets/connectors/xstate-store.js +15 -15
  204. package/dist/factory-assets/connectors/xstate.js +15 -15
  205. package/dist/factory-assets/skills/authoring-skaile-manifests/SKILL.md +9 -3
  206. package/dist/{flows-CBYRSAGS.js → flows-HMSE76PO.js} +12 -12
  207. package/dist/{flows-CBYRSAGS.js.map → flows-HMSE76PO.js.map} +1 -1
  208. package/dist/{helpers-XAEKCZKT.js → helpers-X6URBGSF.js} +17 -17
  209. package/dist/{helpers-XAEKCZKT.js.map → helpers-X6URBGSF.js.map} +1 -1
  210. package/dist/library/index.js +11 -11
  211. package/dist/library/install.js +3 -3
  212. package/dist/library/src/index.d.ts +2 -1
  213. package/dist/library/src/index.d.ts.map +1 -1
  214. package/dist/library/src/local/library-dir.d.ts +42 -0
  215. package/dist/library/src/local/library-dir.d.ts.map +1 -0
  216. package/dist/library/src/local/library-manager.d.ts +10 -1
  217. package/dist/library/src/local/library-manager.d.ts.map +1 -1
  218. package/dist/library/src/local/library.d.ts +2 -2
  219. package/dist/library/src/local/library.d.ts.map +1 -1
  220. package/dist/library/src/local/local-catalog-source.d.ts +9 -0
  221. package/dist/library/src/local/local-catalog-source.d.ts.map +1 -1
  222. package/dist/library/src/manifest-writer.d.ts +55 -4
  223. package/dist/library/src/manifest-writer.d.ts.map +1 -1
  224. package/dist/library/src/remote/cache.d.ts +18 -1
  225. package/dist/library/src/remote/cache.d.ts.map +1 -1
  226. package/dist/library/src/remote/remote-catalog-source.d.ts.map +1 -1
  227. package/dist/library/src/remote/rest-catalog-source.d.ts.map +1 -1
  228. package/dist/library/src/sync/git-driver.d.ts +5 -6
  229. package/dist/library/src/sync/git-driver.d.ts.map +1 -1
  230. package/dist/{library-publish-VJSWMOLH.js → library-publish-OS3JDW4S.js} +123 -41
  231. package/dist/library-publish-OS3JDW4S.js.map +1 -0
  232. package/dist/open-library-4QSUORI6.js +40 -0
  233. package/dist/{open-library-DB2PNL2X.js.map → open-library-4QSUORI6.js.map} +1 -1
  234. package/dist/open-registry-VCKS3MP5.js +32 -0
  235. package/dist/{open-registry-ZUZJ7MS7.js.map → open-registry-VCKS3MP5.js.map} +1 -1
  236. package/dist/paths-BVO56A25.js +22 -0
  237. package/dist/{paths-FQ64OLJG.js.map → paths-BVO56A25.js.map} +1 -1
  238. package/dist/{plugin-store-MPAMD5OT.js → plugin-store-X7GPWGBG.js} +9 -9
  239. package/dist/{plugin-store-MPAMD5OT.js.map → plugin-store-X7GPWGBG.js.map} +1 -1
  240. package/dist/{project-I6NX3NFB.js → project-PAXP46RD.js} +20 -20
  241. package/dist/{project-I6NX3NFB.js.map → project-PAXP46RD.js.map} +1 -1
  242. package/dist/resolver/index.js +8 -8
  243. package/dist/runner/index.js +29 -29
  244. package/dist/runner/src/agent.d.ts.map +1 -1
  245. package/dist/sdk/asset-manager.js +14 -14
  246. package/dist/sdk/bridge.js +12 -12
  247. package/dist/sdk/core.js +7 -7
  248. package/dist/sdk/flow.js +8 -8
  249. package/dist/sdk/index.js +29 -29
  250. package/dist/sdk/resolver.js +8 -8
  251. package/dist/sdk/runner.js +29 -29
  252. package/dist/{setup-B7JUHYJW.js → setup-BV55VHWC.js} +22 -22
  253. package/dist/{setup-B7JUHYJW.js.map → setup-BV55VHWC.js.map} +1 -1
  254. package/dist/{skills-TVO26Y4V.js → skills-EDFUCJPX.js} +13 -13
  255. package/dist/{skills-TVO26Y4V.js.map → skills-EDFUCJPX.js.map} +1 -1
  256. package/dist/source-E4VAT5RZ.js +41 -0
  257. package/dist/{source-PJBMDCKX.js.map → source-E4VAT5RZ.js.map} +1 -1
  258. package/dist/{source-manifest-publish-LLJWXGID.js → source-manifest-publish-CLEE6TNH.js} +23 -23
  259. package/dist/{source-manifest-publish-LLJWXGID.js.map → source-manifest-publish-CLEE6TNH.js.map} +1 -1
  260. package/dist/tui/index.js +29 -29
  261. package/dist/types/manifests.js +1 -1
  262. package/dist/types/src/manifests/agent.d.ts +2 -0
  263. package/dist/types/src/manifests/agent.d.ts.map +1 -1
  264. package/dist/types/src/manifests/contract.d.ts +2 -0
  265. package/dist/types/src/manifests/contract.d.ts.map +1 -1
  266. package/dist/types/src/manifests/index.d.ts +3 -3
  267. package/dist/types/src/manifests/index.d.ts.map +1 -1
  268. package/dist/types/src/manifests/prompt.d.ts +2 -0
  269. package/dist/types/src/manifests/prompt.d.ts.map +1 -1
  270. package/dist/workspace-plugin/adapters/mcp.js +22 -22
  271. package/dist/workspace-plugin/adapters/omp.js +14 -14
  272. package/dist/workspace-plugin/index.js +2 -2
  273. package/package.json +1 -1
  274. package/dist/chunk-36AFURKZ.js.map +0 -1
  275. package/dist/chunk-4MQS7CAF.js.map +0 -1
  276. package/dist/chunk-7AI3Q5AQ.js.map +0 -1
  277. package/dist/chunk-B6GIW55K.js.map +0 -1
  278. package/dist/chunk-BTE2V4IW.js.map +0 -1
  279. package/dist/chunk-EF7NPDDU.js.map +0 -1
  280. package/dist/chunk-GKMZ6THE.js.map +0 -1
  281. package/dist/chunk-GTILM2CI.js.map +0 -1
  282. package/dist/chunk-IMKSM5NL.js.map +0 -1
  283. package/dist/chunk-JAKOMFC6.js.map +0 -1
  284. package/dist/chunk-LAMCXQGA.js.map +0 -1
  285. package/dist/chunk-P67WJVP4.js.map +0 -1
  286. package/dist/chunk-QVNRCDTV.js.map +0 -1
  287. package/dist/chunk-UMVKJM4Q.js.map +0 -1
  288. package/dist/chunk-Y7QA2OLD.js.map +0 -1
  289. package/dist/chunk-YSHVQGUS.js.map +0 -1
  290. package/dist/chunk-ZAOGFXDO.js +0 -112
  291. package/dist/chunk-ZAOGFXDO.js.map +0 -1
  292. package/dist/library-publish-VJSWMOLH.js.map +0 -1
  293. package/dist/open-library-DB2PNL2X.js +0 -40
  294. package/dist/open-registry-ZUZJ7MS7.js +0 -32
  295. package/dist/paths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AAY,gEAAgE,EAC5E,MAAA,CAAO,sBAAA,EAAwB,mBAAmB,CAAA,CAClD,OAAO,CAAC,EAAA,EAAY,SAAuB,OAAA,CAAQ,EAAA,EAAI,IAAI,CAAC,CAAA;AAE/D,EAAA,OAAO,GAAA;AACT","file":"chunk-SCOT677Q.js","sourcesContent":["/**\n * `skaile providers` — manage the AI provider registry.\n *\n * Endpoints are defined once, in `~/.skaile/providers.yml`, optionally\n * overridden per project in `<workspace>/.skaile/providers.yml` (gitignored by\n * `skaile init`). Every subcommand writes exactly one of those two files and\n * validates the result before it lands — a literal secret never reaches disk.\n *\n * @see PROVIDER-CONFIG-PLAN.md §1, §2.5\n */\n\nimport path from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport {\n catalogLayer,\n expandPreset,\n getProviderPreset,\n listProviderPresets,\n presetBaseUrl,\n probeProviderEntry,\n} from \"@skaile/workspaces/bridge\";\nimport {\n AI_PROVIDER_LAYERS,\n AI_PROVIDER_SURFACES,\n type AIProviderDiagnostic,\n type AIProviderEntry,\n type AIProviderLayerId,\n type AIProviderLlmEntry,\n type AIProviderRegistryDocument,\n type AIProviderSurface,\n entryTransport,\n isEntryEnabled,\n isSafeProviderId,\n loadProviderRegistry,\n type MergedAIProviderRegistry,\n mergeRegistries,\n parseCredentialRef,\n type ProviderRegistryFile,\n resolveCredential,\n resolveEntryBaseUrl,\n saveProviderRegistryFile,\n userProviderRegistryPath,\n validateMergedRegistry,\n validateRegistry,\n workspaceProviderRegistryPath,\n} from \"@skaile/workspaces/core\";\nimport { Command } from \"commander\";\nimport { logErr, logInfo, logOk, logWarn, S } from \"../helpers.ts\";\n\n/** Preset id that means \"no preset — I will supply the three literals\". */\nconst CUSTOM_PRESET = \"custom\";\n\n/** Which of the two registry files a command reads or writes. */\nexport interface ScopeOptions {\n projectDir?: string;\n workspace?: boolean;\n}\n\n/** The file a mutating subcommand writes: the workspace layer or the user one. */\nfunction targetFile(opts: ScopeOptions): { layer: \"user\" | \"workspace\"; path: string } {\n if (opts.workspace) {\n return { layer: \"workspace\", path: workspaceProviderRegistryPath(resolveProjectDir(opts)) };\n }\n return { layer: \"user\", path: userProviderRegistryPath() };\n}\n\n/** Project directory a subcommand operates on — `--project-dir` or the cwd. */\nfunction resolveProjectDir(opts: ScopeOptions): string {\n return opts.projectDir ? path.resolve(opts.projectDir) : process.cwd();\n}\n\n/** Both file layers plus the catalog, merged — what every reader sees. */\nexport interface RegistryView {\n merged: MergedAIProviderRegistry;\n files: ProviderRegistryFile[];\n diagnostics: AIProviderDiagnostic[];\n}\n\n/**\n * Load both file layers and merge them with the catalog layer the configured\n * `preset:` keys pull in, then gate the result. Read once, merged twice — the\n * catalog layer can only be built after the configured entries are known,\n * and it is built from the **pre-gate** merge: an entry that leaves `kind` or\n * its transport `params` to the preset fails the first gate by design.\n *\n * The gate is on the merged view, not per file: a workspace entry that sets\n * one field of an entry the user file defines is an override (§1.5), so it is\n * only here that an entry can be judged complete.\n */\nexport function loadRegistryView(opts: ScopeOptions): RegistryView {\n const loaded = loadProviderRegistry({ projectDir: resolveProjectDir(opts) });\n const fileLayers = loaded.files.map((file) => ({\n layer: file.layer as AIProviderLayerId,\n providers: file.document.providers,\n }));\n const catalog = catalogLayer(loaded.patches);\n const { registry, diagnostics } = validateMergedRegistry(\n mergeRegistries([...fileLayers, catalog]),\n {\n sources: [\n ...loaded.files.map((file) => ({ label: file.path, providers: file.document.providers })),\n ],\n },\n );\n return {\n merged: registry,\n files: loaded.files,\n // `loaded.diagnostics` already carries the merge notes for the file layers\n // alone; this second merge adds the catalog, so its notes replace them.\n diagnostics: [...loaded.files.flatMap((file) => file.diagnostics), ...diagnostics],\n };\n}\n\n/** Print diagnostics; returns how many were errors. */\nfunction reportDiagnostics(diagnostics: AIProviderDiagnostic[]): number {\n let errors = 0;\n for (const diagnostic of diagnostics) {\n const where = diagnostic.path ? `${diagnostic.path}: ` : \"\";\n if (diagnostic.severity === \"error\") {\n errors++;\n logErr(`${where}${diagnostic.message}`);\n } else {\n logWarn(`${where}${diagnostic.message}`);\n }\n }\n return errors;\n}\n\n/** Highest layer that pins an entry with `locked: true`. */\nfunction lockOwner(id: string, files: ProviderRegistryFile[]): AIProviderLayerId | undefined {\n let owner: AIProviderLayerId | undefined;\n for (const file of files) {\n if (file.document.providers[id]?.locked) {\n const layer = file.layer as AIProviderLayerId;\n if (!owner || AI_PROVIDER_LAYERS.indexOf(layer) > AI_PROVIDER_LAYERS.indexOf(owner)) {\n owner = layer;\n }\n }\n }\n return owner;\n}\n\n/**\n * The message for an edit a lock forbids, or `undefined` when it is allowed.\n * The merge ignores a lower layer silently; the CLI must not, or the operator\n * would watch an accepted edit have no effect.\n *\n * `set <id> locked <value>` stays legal at the locking layer itself —\n * otherwise a lock could never be lifted without hand-editing the file.\n */\nfunction lockConflict(\n id: string,\n target: { layer: \"user\" | \"workspace\"; path: string },\n files: ProviderRegistryFile[],\n key?: string,\n): string | undefined {\n const owner = lockOwner(id, files);\n if (!owner) return undefined;\n const ownerRank = AI_PROVIDER_LAYERS.indexOf(owner);\n const targetRank = AI_PROVIDER_LAYERS.indexOf(target.layer);\n if (ownerRank === targetRank && key === \"locked\") return undefined;\n if (ownerRank < targetRank) return undefined;\n return (\n `'${id}' is locked by the ${owner} layer and cannot be changed from ${target.layer}.\\n` +\n (ownerRank === targetRank\n ? ` Unlock it first: skaile providers set ${id} locked false`\n : ` A higher layer owns this entry — change it there.`)\n );\n}\n\n/** Refuse loudly when a locked entry would be edited. */\nfunction exitIfLocked(\n id: string,\n target: { layer: \"user\" | \"workspace\"; path: string },\n files: ProviderRegistryFile[],\n key?: string,\n): void {\n const message = lockConflict(id, target, files, key);\n if (!message) return;\n logErr(message);\n process.exit(1);\n}\n\n/** Read the target file, or an empty document when it does not exist yet. */\nfunction readTargetDocument(\n target: { layer: \"user\" | \"workspace\"; path: string },\n files: ProviderRegistryFile[],\n): AIProviderRegistryDocument {\n const file = files.find((f) => f.path === target.path);\n return file?.document ?? { version: 1, providers: {} };\n}\n\n/**\n * Validate the file that is about to be written; exits non-zero on errors.\n *\n * Validated as the layer it is, so `set` may leave a one-field override in the\n * workspace file (§1.5). Completeness is the merged registry's business, and\n * `loadRegistryView` reports it on the next read.\n */\nfunction validateOrExit(\n document: AIProviderRegistryDocument,\n target: { layer: \"user\" | \"workspace\"; path: string },\n): void {\n const { diagnostics } = validateRegistry(\n { version: 1, providers: document.providers },\n { source: target.path, layer: target.layer },\n );\n if (reportDiagnostics(diagnostics) > 0) process.exit(1);\n}\n\n// ── list ───────────────────────────────────────────────────────────────────\n\nfunction pad(value: string, width: number): string {\n return value.length >= width ? value : value + \" \".repeat(width - value.length);\n}\n\nfunction credentialSummary(entry: AIProviderEntry): string {\n const credential = entry.credential;\n if (!credential || credential.kind === \"none\") return \"none\";\n return credential.ref ? `${credential.kind} ${credential.ref}` : credential.kind;\n}\n\nfunction printPresets(): void {\n const presets = listProviderPresets();\n console.log();\n console.log(` ${S.heading(\"Catalog presets\")}`);\n const idWidth = Math.max(...presets.map((x) => x.id.length)) + 2;\n const surfaceWidth = Math.max(...AI_PROVIDER_SURFACES.map((s) => s.length)) + 2;\n const header = `${pad(\"preset\", idWidth)}${pad(\"kind\", 7)}${pad(\"surface\", surfaceWidth)}${pad(\"transport\", 14)}default base URL`;\n console.log(` ${S.dim(header)}`);\n for (const preset of presets) {\n const row =\n pad(preset.id, idWidth) +\n pad(preset.kind, 7) +\n pad(preset.surface ?? \"—\", surfaceWidth) +\n pad(\n preset.kind === \"llm\" || preset.kind === \"embed\" ? (preset.transport ?? \"direct\") : \"—\",\n 14,\n ) +\n (presetBaseUrl(preset) ?? \"—\");\n console.log(` ${row}`);\n }\n}\n\nfunction printConfigured(view: RegistryView): void {\n const ids = view.merged.order;\n console.log();\n console.log(` ${S.heading(\"Configured providers\")}`);\n if (ids.length === 0) {\n console.log(\n ` ${S.dim(\"none — add one with\")} ${S.cmd(\"skaile providers add --preset <preset>\")}`,\n );\n console.log();\n return;\n }\n const idWidth = Math.max(...ids.map((id) => id.length)) + 2;\n const header = `${pad(\"id\", idWidth)}${pad(\"layer\", 11)}${pad(\"surface\", 26)}${pad(\"transport\", 14)}endpoint`;\n console.log(` ${S.dim(header)}`);\n for (const id of ids) {\n const entry = view.merged.providers[id];\n const surface = (entry as AIProviderLlmEntry).surface ?? \"—\";\n const transport = entryTransport(entry) ?? \"—\";\n const url = resolveEntryBaseUrl(entry) ?? S.dim(\"(unresolved)\");\n const flags = [\n isEntryEnabled(entry) ? \"\" : S.warn(\"disabled\"),\n entry.locked ? S.warn(\"locked\") : \"\",\n ]\n .filter(Boolean)\n .join(\" \");\n console.log(\n ` ${pad(id, idWidth)}${pad(view.merged.origin[id], 11)}${pad(surface, 26)}${pad(transport, 14)}${url} ${flags}`.trimEnd(),\n );\n console.log(` ${S.dim(`${pad(\"\", idWidth)}${credentialSummary(entry)}`)}`);\n }\n console.log();\n}\n\n// ── add ────────────────────────────────────────────────────────────────────\n\ninterface AddOptions extends ScopeOptions {\n preset?: string;\n credential?: string;\n baseUrl?: string;\n surface?: string;\n label?: string;\n kind?: string;\n param: string[];\n force?: boolean;\n}\n\nfunction parseParams(pairs: string[]): Record<string, string> {\n const out: Record<string, string> = {};\n for (const pair of pairs) {\n const eq = pair.indexOf(\"=\");\n if (eq <= 0) {\n logErr(`--param expects <key>=<value> (got '${pair}')`);\n process.exit(1);\n }\n out[pair.slice(0, eq)] = pair.slice(eq + 1);\n }\n return out;\n}\n\n/** Ask for the three literals a custom endpoint needs. Nothing else. */\nasync function promptCustomEntry(\n id: string,\n opts: AddOptions,\n): Promise<{ surface: AIProviderSurface; baseUrl: string; credentialRef: string }> {\n const interactive = process.stdin.isTTY === true;\n let surface = opts.surface as AIProviderSurface | undefined;\n let baseUrl = opts.baseUrl;\n let credentialRef = opts.credential;\n\n if (!interactive && (!surface || !baseUrl || !credentialRef)) {\n logErr(\n \"--preset custom needs --surface, --base-url and --credential when there is no terminal to prompt on\",\n );\n process.exit(1);\n }\n\n if (!surface) {\n const answer = await p.select({\n message: \"Wire surface:\",\n options: AI_PROVIDER_SURFACES.map((value) => ({ value, label: value })),\n initialValue: \"openai-completions\" as AIProviderSurface,\n });\n if (p.isCancel(answer)) {\n p.cancel(\"Cancelled.\");\n process.exit(1);\n }\n surface = answer as AIProviderSurface;\n }\n if (!baseUrl) {\n const answer = await p.text({\n message: \"Base URL:\",\n placeholder: \"https://api.example.com/v1\",\n });\n if (p.isCancel(answer)) {\n p.cancel(\"Cancelled.\");\n process.exit(1);\n }\n baseUrl = answer as string;\n }\n if (!credentialRef) {\n const answer = await p.text({\n message: \"Credential reference (env:NAME, cmd:<shell>, platform:<id>, keyring:<svc>/<acct>):\",\n initialValue: `env:${id.toUpperCase().replace(/[^A-Z0-9]/g, \"_\")}_API_KEY`,\n });\n if (p.isCancel(answer)) {\n p.cancel(\"Cancelled.\");\n process.exit(1);\n }\n credentialRef = answer as string;\n }\n return { surface, baseUrl, credentialRef };\n}\n\n/** A rejected registry write. The message is already CLI-ready. */\nexport class ProviderRegistryWriteError extends Error {}\n\n/** What {@link addProviderEntry} writes. */\nexport interface AddProviderEntryInput extends ScopeOptions {\n /** Registry entry id — `[a-z0-9][a-z0-9_-]*`. */\n id: string;\n /** Catalog preset to expand. Mutually exclusive with `entry`. */\n presetId?: string;\n /** A fully-built entry (the `--preset custom` path, which needs prompts). */\n entry?: AIProviderEntry;\n /** `env:NAME` / `cmd:…` / `platform:…` / `keyring:…` — never a literal. */\n credentialRef?: string;\n baseUrl?: string;\n surface?: AIProviderSurface;\n label?: string;\n params?: Record<string, string>;\n /** Overwrite an entry that already exists in the target file. */\n force?: boolean;\n}\n\n/** Result of {@link addProviderEntry}. */\nexport interface AddedProviderEntry {\n id: string;\n layer: \"user\" | \"workspace\";\n path: string;\n entry: AIProviderEntry;\n /** True when an existing entry in the target file was overwritten. */\n replaced: boolean;\n}\n\n/**\n * Write one entry into a registry file — the single write path behind\n * `skaile providers add` and the `skaile setup` wizard.\n *\n * Throws {@link ProviderRegistryWriteError} instead of exiting, so a wizard\n * can report the failure in its own idiom. Every rejection a caller can\n * provoke (bad id, unknown preset, missing transport parameter, locked entry,\n * a literal secret) lands here, and the document is validated before it is\n * written — a secret cannot reach disk through this function.\n */\nexport function addProviderEntry(input: AddProviderEntryInput): AddedProviderEntry {\n const { id } = input;\n if (!isSafeProviderId(id)) {\n throw new ProviderRegistryWriteError(\n `'${id}' is not a valid entry id — use [a-z0-9][a-z0-9_-]*`,\n );\n }\n if (input.credentialRef && !parseCredentialRef(input.credentialRef)) {\n throw new ProviderRegistryWriteError(\n \"the credential must be a reference, not a secret: \" +\n \"env:NAME, cmd:<shell>, platform:<configId> or keyring:<service>/<account>\",\n );\n }\n\n const view = loadRegistryView(input);\n const target = targetFile(input);\n const locked = lockConflict(id, target, view.files);\n if (locked) throw new ProviderRegistryWriteError(locked);\n\n const document = readTargetDocument(target, view.files);\n const replaced = document.providers[id] !== undefined;\n if (replaced && !input.force) {\n throw new ProviderRegistryWriteError(\n `'${id}' already exists in ${target.path} — pass --force to overwrite it.`,\n );\n }\n\n let entry: AIProviderEntry;\n if (input.entry) {\n entry = input.entry;\n } else {\n const preset = input.presetId ? getProviderPreset(input.presetId) : undefined;\n if (!preset) {\n throw new ProviderRegistryWriteError(\n `Unknown preset '${input.presetId}'. Run \\`skaile providers list\\` to see the catalog, ` +\n \"or use `--preset custom`.\",\n );\n }\n entry = expandPreset(preset, {\n credentialRef: input.credentialRef,\n baseUrl: input.baseUrl,\n surface: input.surface,\n label: input.label,\n params: input.params,\n });\n const missing = (preset.required_params ?? []).filter(\n (key) => !(key in ((entry as AIProviderLlmEntry).params ?? {})),\n );\n if (missing.length > 0) {\n throw new ProviderRegistryWriteError(\n `Preset '${preset.id}' needs ${missing.map((m) => `--param ${m}=<value>`).join(\" \")}`,\n );\n }\n }\n\n const next: AIProviderRegistryDocument = {\n version: 1,\n providers: { ...document.providers, [id]: entry },\n };\n const { diagnostics } = validateRegistry(\n { version: 1, providers: next.providers },\n { source: target.path },\n );\n const errors = diagnostics.filter((d) => d.severity === \"error\");\n if (errors.length > 0) {\n throw new ProviderRegistryWriteError(\n errors.map((d) => (d.path ? `${d.path}: ${d.message}` : d.message)).join(\"\\n\"),\n );\n }\n saveProviderRegistryFile(target.path, next);\n\n return { id, layer: target.layer, path: target.path, entry, replaced };\n}\n\n/** The env var an `env:` credential reference points at, if it is one. */\nexport function credentialEnvVarName(entry: AIProviderEntry): string | undefined {\n const ref = entry.credential?.ref;\n return ref?.startsWith(\"env:\") ? ref.slice(4) : undefined;\n}\n\n/** Build the `--preset custom` entry from the three literals the user gave. */\nfunction customEntry(\n answers: { surface: AIProviderSurface; baseUrl: string; credentialRef: string },\n opts: AddOptions,\n): AIProviderEntry {\n const kind = (opts.kind ?? \"llm\") as AIProviderEntry[\"kind\"];\n // Anthropic- and Google-shaped surfaces read a dedicated API-key header;\n // everything else is a bearer token. `set <id> credential.kind …` adjusts.\n const credentialKind =\n kind === \"stt\" ||\n kind === \"tts\" ||\n answers.surface === \"anthropic-messages\" ||\n answers.surface === \"google-generative-ai\" ||\n answers.surface === \"azure-openai-responses\"\n ? \"api_key_header\"\n : \"bearer\";\n if (kind === \"stt\" || kind === \"tts\") {\n return {\n kind,\n ...(opts.label ? { label: opts.label } : {}),\n base_url: answers.baseUrl,\n credential: { kind: credentialKind, ref: answers.credentialRef },\n };\n }\n return {\n kind,\n ...(opts.label ? { label: opts.label } : {}),\n surface: answers.surface,\n base_url: answers.baseUrl,\n credential: { kind: credentialKind, ref: answers.credentialRef },\n } as AIProviderLlmEntry;\n}\n\nasync function runAdd(idArg: string | undefined, opts: AddOptions): Promise<void> {\n const presetId = opts.preset;\n if (!presetId) {\n logErr(\n `--preset is required. Run ${S.cmd(\"skaile providers list\")} for the catalog, ` +\n `or use ${S.cmd(\"--preset custom\")}.`,\n );\n process.exit(1);\n }\n const id = idArg ?? presetId;\n if (id === CUSTOM_PRESET && !idArg) {\n logErr(\"--preset custom needs an entry id: skaile providers add <id> --preset custom\");\n process.exit(1);\n }\n\n const entry =\n presetId === CUSTOM_PRESET ? customEntry(await promptCustomEntry(id, opts), opts) : undefined;\n\n let added: AddedProviderEntry;\n try {\n added = addProviderEntry({\n id,\n ...(entry ? { entry } : { presetId }),\n credentialRef: opts.credential,\n baseUrl: opts.baseUrl,\n surface: opts.surface as AIProviderSurface | undefined,\n label: opts.label,\n params: parseParams(opts.param),\n projectDir: opts.projectDir,\n workspace: opts.workspace,\n force: opts.force,\n });\n } catch (error) {\n logErr(error instanceof Error ? error.message : String(error));\n process.exit(1);\n }\n\n logOk(`Added ${S.bold(id)} (${presetId}) to the ${added.layer} registry`);\n console.log(S.dim(` → ${added.path}`));\n const name = credentialEnvVarName(added.entry);\n if (name) {\n console.log(\n ` ${S.dim(\"The secret itself never goes in this file — export it:\")} ${S.cmd(`export ${name}=…`)}`,\n );\n }\n console.log(` ${S.dim(\"Verify with:\")} ${S.cmd(`skaile providers test ${id}`)}`);\n}\n\n// ── set / rm ───────────────────────────────────────────────────────────────\n\n/** Coerce a CLI string into the type the schema expects at `key`. */\nfunction coerceValue(key: string, value: string): unknown {\n const leaf = key.split(\".\").pop() ?? key;\n if (leaf === \"enabled\" || leaf === \"locked\" || leaf === \"tools\" || leaf === \"images\") {\n if (value === \"true\") return true;\n if (value === \"false\") return false;\n logErr(`'${key}' takes true or false (got '${value}')`);\n process.exit(1);\n }\n if (leaf === \"context_window\" || leaf === \"thinking_max\") {\n const parsed = Number(value);\n if (!Number.isFinite(parsed)) {\n logErr(`'${key}' takes a number (got '${value}')`);\n process.exit(1);\n }\n return parsed;\n }\n return value;\n}\n\n/** Write `value` at a dotted path, creating intermediate maps. */\nfunction setDotted(entry: Record<string, unknown>, key: string, value: unknown): void {\n const segments = key.split(\".\");\n let cursor = entry;\n for (const segment of segments.slice(0, -1)) {\n const next = cursor[segment];\n if (typeof next !== \"object\" || next === null || Array.isArray(next)) {\n cursor[segment] = {};\n }\n cursor = cursor[segment] as Record<string, unknown>;\n }\n cursor[segments[segments.length - 1]] = value;\n}\n\nfunction runSet(id: string, key: string, value: string, opts: ScopeOptions): void {\n const view = loadRegistryView(opts);\n const target = targetFile(opts);\n exitIfLocked(id, target, view.files, key);\n\n const document = readTargetDocument(target, view.files);\n const existing = document.providers[id];\n const inherited = view.merged.providers[id];\n if (!existing && !inherited) {\n logErr(\n `No provider '${id}'. Add it with ${S.cmd(`skaile providers add ${id} --preset <preset>`)}`,\n );\n process.exit(1);\n }\n\n // Writing a field into a layer that has no entry yet leaves a one-field\n // override: the layers below keep supplying the rest (§1.5), so copying\n // their `kind` down here would pin a value this layer does not own.\n const base = (existing ? structuredClone(existing) : {}) as unknown as Record<string, unknown>;\n setDotted(base, key, coerceValue(key, value));\n\n const next: AIProviderRegistryDocument = {\n version: 1,\n providers: { ...document.providers, [id]: base as unknown as AIProviderEntry },\n };\n validateOrExit(next, target);\n saveProviderRegistryFile(target.path, next);\n\n logOk(`Set ${S.bold(`${id}.${key}`)} = ${value} in the ${target.layer} registry`);\n console.log(S.dim(` → ${target.path}`));\n}\n\nfunction runRemove(id: string, opts: ScopeOptions): void {\n const view = loadRegistryView(opts);\n const target = targetFile(opts);\n exitIfLocked(id, target, view.files);\n\n const document = readTargetDocument(target, view.files);\n if (!document.providers[id]) {\n logErr(`No provider '${id}' in ${target.path}`);\n process.exit(1);\n }\n const providers = { ...document.providers };\n delete providers[id];\n saveProviderRegistryFile(target.path, { version: 1, providers });\n\n logOk(`Removed ${S.bold(id)} from the ${target.layer} registry`);\n console.log(S.dim(` → ${target.path}`));\n if (\n view.merged.providers[id] &&\n view.files.some((f) => f.path !== target.path && f.document.providers[id])\n ) {\n logInfo(`'${id}' is still defined in another layer — run 'skaile providers list' to see it.`);\n }\n}\n\n// ── test ───────────────────────────────────────────────────────────────────\n\nasync function runTest(id: string, opts: ScopeOptions): Promise<void> {\n const view = loadRegistryView(opts);\n const entry = view.merged.providers[id];\n if (!entry) {\n logErr(`No provider '${id}'. Run ${S.cmd(\"skaile providers list\")} to see what is configured.`);\n process.exit(1);\n }\n\n const credential = resolveCredential(entry);\n console.log();\n console.log(` ${S.heading(id)} ${S.dim(`(${view.merged.origin[id]} layer)`)}`);\n console.log(` ${S.label(\"endpoint \")} ${resolveEntryBaseUrl(entry) ?? S.dim(\"(unresolved)\")}`);\n console.log(\n ` ${S.label(\"credential\")} ${credentialSummary(entry)} ${\n credential.error\n ? S.err(`— ${credential.error}`)\n : S.dim(`— resolved from ${credential.source}`)\n }`,\n );\n\n if (credential.error) {\n console.log();\n logErr(`${id} is not usable yet: ${credential.error}`);\n process.exit(1);\n }\n\n const result = await probeProviderEntry(entry, { secret: credential.value });\n if (result.url) console.log(` ${S.label(\"probe \")} GET ${result.url}`);\n console.log();\n if (result.ok) {\n logOk(`${id}: ${result.detail}${result.status ? ` (HTTP ${result.status})` : \"\"}`);\n return;\n }\n if (!result.probed) {\n logWarn(`${id}: ${result.detail}`);\n return;\n }\n logErr(`${id}: ${result.detail}`);\n process.exit(1);\n}\n\n// ── command ────────────────────────────────────────────────────────────────\n\n/**\n * Create the `skaile providers` command group.\n *\n * `list` shows the catalog and what is configured; `add` writes an entry from\n * a preset (or from three literals with `--preset custom`); `set` and `rm`\n * edit one layer; `test` sends one read-only request and reports what came\n * back, never the credential.\n *\n * @returns Configured {@link Command} ready for `program.addCommand()`.\n */\nexport function makeProvidersCommand(): Command {\n const cmd = new Command(\"providers\").description(\n \"Manage AI provider endpoints (~/.skaile/providers.yml)\",\n );\n\n cmd\n .command(\"list\")\n .description(\"List catalog presets and configured providers\")\n .option(\"--project-dir <path>\", \"Project directory\")\n .option(\"--json\", \"Machine-readable output\")\n .action((opts) => {\n const view = loadRegistryView(opts);\n if (opts.json) {\n console.log(\n JSON.stringify(\n {\n presets: listProviderPresets().map((preset) => ({\n id: preset.id,\n kind: preset.kind,\n surface: preset.surface,\n transport: preset.transport ?? (preset.surface ? \"direct\" : undefined),\n base_url: presetBaseUrl(preset),\n credential: preset.credential,\n required_params: preset.required_params,\n })),\n providers: view.merged.order.map((id) => ({\n id,\n layer: view.merged.origin[id],\n entry: view.merged.providers[id],\n base_url: resolveEntryBaseUrl(view.merged.providers[id]),\n })),\n },\n null,\n 2,\n ),\n );\n return;\n }\n reportDiagnostics(view.diagnostics);\n printPresets();\n printConfigured(view);\n });\n\n cmd\n .command(\"add [id]\")\n .description(\"Add a provider from a catalog preset (id defaults to the preset name)\")\n .requiredOption(\"--preset <preset>\", `Catalog preset, or '${CUSTOM_PRESET}'`)\n .option(\"--credential <ref>\", \"Credential reference (env:NAME, cmd:…, platform:…, keyring:…)\")\n .option(\"--base-url <url>\", \"Override the preset endpoint\")\n .option(\"--surface <surface>\", `Wire surface (${AI_PROVIDER_SURFACES.join(\", \")})`)\n .option(\"--kind <kind>\", \"Entry kind for --preset custom (llm, embed, stt, tts)\", \"llm\")\n .option(\"--label <text>\", \"Display label\")\n .option(\n \"--param <key=value>\",\n \"Transport parameter (repeatable): region, project, location, resource, deployment, api_version\",\n (value: string, previous: string[]) => [...previous, value],\n [] as string[],\n )\n .option(\"--workspace\", \"Write <workspace>/.skaile/providers.yml instead of the user file\")\n .option(\"--project-dir <path>\", \"Project directory\")\n .option(\"--force\", \"Overwrite an existing entry in the target file\")\n .action((id: string | undefined, opts: AddOptions) => runAdd(id, opts));\n\n cmd\n .command(\"set <id> <key> <value>\")\n .description(\n \"Set one field (base_url, enabled, credential.ref, headers.<name>, model_map.<id>…)\",\n )\n .option(\"--workspace\", \"Write <workspace>/.skaile/providers.yml instead of the user file\")\n .option(\"--project-dir <path>\", \"Project directory\")\n .action((id: string, key: string, value: string, opts: ScopeOptions) =>\n runSet(id, key, value, opts),\n );\n\n cmd\n .command(\"rm <id>\")\n .description(\"Remove a provider from one layer\")\n .option(\"--workspace\", \"Edit <workspace>/.skaile/providers.yml instead of the user file\")\n .option(\"--project-dir <path>\", \"Project directory\")\n .action((id: string, opts: ScopeOptions) => runRemove(id, opts));\n\n cmd\n .command(\"test <id>\")\n .description(\"Send one read-only request to a provider and report the result\")\n .option(\"--project-dir <path>\", \"Project directory\")\n .action((id: string, opts: ScopeOptions) => runTest(id, opts));\n\n return cmd;\n}\n"]}
1
+ {"version":3,"sources":["../cli/src/commands/providers.ts"],"names":[],"mappings":";;;;;;;;;AAkDA,IAAM,aAAA,GAAgB,QAAA;AAStB,SAAS,WAAW,IAAA,EAAmE;AACrF,EAAA,IAAI,KAAK,SAAA,EAAW;AAClB,IAAA,OAAO,EAAE,OAAO,WAAA,EAAa,IAAA,EAAM,8BAA8B,iBAAA,CAAkB,IAAI,CAAC,CAAA,EAAE;AAAA,EAC5F;AACA,EAAA,OAAO,EAAE,KAAA,EAAO,MAAA,EAAQ,IAAA,EAAM,0BAAyB,EAAE;AAC3D;AAGA,SAAS,kBAAkB,IAAA,EAA4B;AACrD,EAAA,OAAO,IAAA,CAAK,aAAa,IAAA,CAAK,OAAA,CAAQ,KAAK,UAAU,CAAA,GAAI,QAAQ,GAAA,EAAI;AACvE;AAoBO,SAAS,iBAAiB,IAAA,EAAkC;AACjE,EAAA,MAAM,SAAS,oBAAA,CAAqB,EAAE,YAAY,iBAAA,CAAkB,IAAI,GAAG,CAAA;AAC3E,EAAA,MAAM,UAAA,GAAa,MAAA,CAAO,KAAA,CAAM,GAAA,CAAI,CAAC,IAAA,MAAU;AAAA,IAC7C,OAAO,IAAA,CAAK,KAAA;AAAA,IACZ,SAAA,EAAW,KAAK,QAAA,CAAS;AAAA,GAC3B,CAAE,CAAA;AACF,EAAA,MAAM,OAAA,GAAU,YAAA,CAAa,MAAA,CAAO,OAAO,CAAA;AAC3C,EAAA,MAAM,EAAE,QAAA,EAAU,WAAA,EAAY,GAAI,sBAAA;AAAA,IAChC,eAAA,CAAgB,CAAC,GAAG,UAAA,EAAY,OAAO,CAAC,CAAA;AAAA,IACxC;AAAA,MACE,OAAA,EAAS;AAAA,QACP,GAAG,MAAA,CAAO,KAAA,CAAM,GAAA,CAAI,CAAC,IAAA,MAAU,EAAE,KAAA,EAAO,IAAA,CAAK,I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,WAAW,CAAA,CACnB,WAAA,CAAY,gEAAgE,EAC5E,MAAA,CAAO,sBAAA,EAAwB,mBAAmB,CAAA,CAClD,OAAO,CAAC,EAAA,EAAY,SAAuB,OAAA,CAAQ,EAAA,EAAI,IAAI,CAAC,CAAA;AAE/D,EAAA,OAAO,GAAA;AACT","file":"chunk-XCNK4UE5.js","sourcesContent":["/**\n * `skaile providers` — manage the AI provider registry.\n *\n * Endpoints are defined once, in `~/.skaile/providers.yml`, optionally\n * overridden per project in `<workspace>/.skaile/providers.yml` (gitignored by\n * `skaile init`). Every subcommand writes exactly one of those two files and\n * validates the result before it lands — a literal secret never reaches disk.\n *\n * @see PROVIDER-CONFIG-PLAN.md §1, §2.5\n */\n\nimport path from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport {\n catalogLayer,\n expandPreset,\n getProviderPreset,\n listProviderPresets,\n presetBaseUrl,\n probeProviderEntry,\n} from \"@skaile/workspaces/bridge\";\nimport {\n AI_PROVIDER_LAYERS,\n AI_PROVIDER_SURFACES,\n type AIProviderDiagnostic,\n type AIProviderEntry,\n type AIProviderLayerId,\n type AIProviderLlmEntry,\n type AIProviderRegistryDocument,\n type AIProviderSurface,\n entryTransport,\n isEntryEnabled,\n isSafeProviderId,\n loadProviderRegistry,\n type MergedAIProviderRegistry,\n mergeRegistries,\n parseCredentialRef,\n type ProviderRegistryFile,\n resolveCredential,\n resolveEntryBaseUrl,\n saveProviderRegistryFile,\n userProviderRegistryPath,\n validateMergedRegistry,\n validateRegistry,\n workspaceProviderRegistryPath,\n} from \"@skaile/workspaces/core\";\nimport { Command } from \"commander\";\nimport { logErr, logInfo, logOk, logWarn, S } from \"../helpers.ts\";\n\n/** Preset id that means \"no preset — I will supply the three literals\". */\nconst CUSTOM_PRESET = \"custom\";\n\n/** Which of the two registry files a command reads or writes. */\nexport interface ScopeOptions {\n projectDir?: string;\n workspace?: boolean;\n}\n\n/** The file a mutating subcommand writes: the workspace layer or the user one. */\nfunction targetFile(opts: ScopeOptions): { layer: \"user\" | \"workspace\"; path: string } {\n if (opts.workspace) {\n return { layer: \"workspace\", path: workspaceProviderRegistryPath(resolveProjectDir(opts)) };\n }\n return { layer: \"user\", path: userProviderRegistryPath() };\n}\n\n/** Project directory a subcommand operates on — `--project-dir` or the cwd. */\nfunction resolveProjectDir(opts: ScopeOptions): string {\n return opts.projectDir ? path.resolve(opts.projectDir) : process.cwd();\n}\n\n/** Both file layers plus the catalog, merged — what every reader sees. */\nexport interface RegistryView {\n merged: MergedAIProviderRegistry;\n files: ProviderRegistryFile[];\n diagnostics: AIProviderDiagnostic[];\n}\n\n/**\n * Load both file layers and merge them with the catalog layer the configured\n * `preset:` keys pull in, then gate the result. Read once, merged twice — the\n * catalog layer can only be built after the configured entries are known,\n * and it is built from the **pre-gate** merge: an entry that leaves `kind` or\n * its transport `params` to the preset fails the first gate by design.\n *\n * The gate is on the merged view, not per file: a workspace entry that sets\n * one field of an entry the user file defines is an override (§1.5), so it is\n * only here that an entry can be judged complete.\n */\nexport function loadRegistryView(opts: ScopeOptions): RegistryView {\n const loaded = loadProviderRegistry({ projectDir: resolveProjectDir(opts) });\n const fileLayers = loaded.files.map((file) => ({\n layer: file.layer as AIProviderLayerId,\n providers: file.document.providers,\n }));\n const catalog = catalogLayer(loaded.patches);\n const { registry, diagnostics } = validateMergedRegistry(\n mergeRegistries([...fileLayers, catalog]),\n {\n sources: [\n ...loaded.files.map((file) => ({ label: file.path, providers: file.document.providers })),\n ],\n },\n );\n return {\n merged: registry,\n files: loaded.files,\n // `loaded.diagnostics` already carries the merge notes for the file layers\n // alone; this second merge adds the catalog, so its notes replace them.\n diagnostics: [...loaded.files.flatMap((file) => file.diagnostics), ...diagnostics],\n };\n}\n\n/** Print diagnostics; returns how many were errors. */\nfunction reportDiagnostics(diagnostics: AIProviderDiagnostic[]): number {\n let errors = 0;\n for (const diagnostic of diagnostics) {\n const where = diagnostic.path ? `${diagnostic.path}: ` : \"\";\n if (diagnostic.severity === \"error\") {\n errors++;\n logErr(`${where}${diagnostic.message}`);\n } else {\n logWarn(`${where}${diagnostic.message}`);\n }\n }\n return errors;\n}\n\n/** Highest layer that pins an entry with `locked: true`. */\nfunction lockOwner(id: string, files: ProviderRegistryFile[]): AIProviderLayerId | undefined {\n let owner: AIProviderLayerId | undefined;\n for (const file of files) {\n if (file.document.providers[id]?.locked) {\n const layer = file.layer as AIProviderLayerId;\n if (!owner || AI_PROVIDER_LAYERS.indexOf(layer) > AI_PROVIDER_LAYERS.indexOf(owner)) {\n owner = layer;\n }\n }\n }\n return owner;\n}\n\n/**\n * The message for an edit a lock forbids, or `undefined` when it is allowed.\n * The merge ignores a lower layer silently; the CLI must not, or the operator\n * would watch an accepted edit have no effect.\n *\n * `set <id> locked <value>` stays legal at the locking layer itself —\n * otherwise a lock could never be lifted without hand-editing the file.\n */\nfunction lockConflict(\n id: string,\n target: { layer: \"user\" | \"workspace\"; path: string },\n files: ProviderRegistryFile[],\n key?: string,\n): string | undefined {\n const owner = lockOwner(id, files);\n if (!owner) return undefined;\n const ownerRank = AI_PROVIDER_LAYERS.indexOf(owner);\n const targetRank = AI_PROVIDER_LAYERS.indexOf(target.layer);\n if (ownerRank === targetRank && key === \"locked\") return undefined;\n if (ownerRank < targetRank) return undefined;\n return (\n `'${id}' is locked by the ${owner} layer and cannot be changed from ${target.layer}.\\n` +\n (ownerRank === targetRank\n ? ` Unlock it first: skaile providers set ${id} locked false`\n : ` A higher layer owns this entry — change it there.`)\n );\n}\n\n/** Refuse loudly when a locked entry would be edited. */\nfunction exitIfLocked(\n id: string,\n target: { layer: \"user\" | \"workspace\"; path: string },\n files: ProviderRegistryFile[],\n key?: string,\n): void {\n const message = lockConflict(id, target, files, key);\n if (!message) return;\n logErr(message);\n process.exit(1);\n}\n\n/** Read the target file, or an empty document when it does not exist yet. */\nfunction readTargetDocument(\n target: { layer: \"user\" | \"workspace\"; path: string },\n files: ProviderRegistryFile[],\n): AIProviderRegistryDocument {\n const file = files.find((f) => f.path === target.path);\n return file?.document ?? { version: 1, providers: {} };\n}\n\n/**\n * Validate the file that is about to be written; exits non-zero on errors.\n *\n * Validated as the layer it is, so `set` may leave a one-field override in the\n * workspace file (§1.5). Completeness is the merged registry's business, and\n * `loadRegistryView` reports it on the next read.\n */\nfunction validateOrExit(\n document: AIProviderRegistryDocument,\n target: { layer: \"user\" | \"workspace\"; path: string },\n): void {\n const { diagnostics } = validateRegistry(\n { version: 1, providers: document.providers },\n { source: target.path, layer: target.layer },\n );\n if (reportDiagnostics(diagnostics) > 0) process.exit(1);\n}\n\n// ── list ───────────────────────────────────────────────────────────────────\n\nfunction pad(value: string, width: number): string {\n return value.length >= width ? value : value + \" \".repeat(width - value.length);\n}\n\nfunction credentialSummary(entry: AIProviderEntry): string {\n const credential = entry.credential;\n if (!credential || credential.kind === \"none\") return \"none\";\n return credential.ref ? `${credential.kind} ${credential.ref}` : credential.kind;\n}\n\nfunction printPresets(): void {\n const presets = listProviderPresets();\n console.log();\n console.log(` ${S.heading(\"Catalog presets\")}`);\n const idWidth = Math.max(...presets.map((x) => x.id.length)) + 2;\n const surfaceWidth = Math.max(...AI_PROVIDER_SURFACES.map((s) => s.length)) + 2;\n const header = `${pad(\"preset\", idWidth)}${pad(\"kind\", 7)}${pad(\"surface\", surfaceWidth)}${pad(\"transport\", 14)}default base URL`;\n console.log(` ${S.dim(header)}`);\n for (const preset of presets) {\n const row =\n pad(preset.id, idWidth) +\n pad(preset.kind, 7) +\n pad(preset.surface ?? \"—\", surfaceWidth) +\n pad(\n preset.kind === \"llm\" || preset.kind === \"embed\" ? (preset.transport ?? \"direct\") : \"—\",\n 14,\n ) +\n (presetBaseUrl(preset) ?? \"—\");\n console.log(` ${row}`);\n }\n}\n\nfunction printConfigured(view: RegistryView): void {\n const ids = view.merged.order;\n console.log();\n console.log(` ${S.heading(\"Configured providers\")}`);\n if (ids.length === 0) {\n console.log(\n ` ${S.dim(\"none — add one with\")} ${S.cmd(\"skaile providers add --preset <preset>\")}`,\n );\n console.log();\n return;\n }\n const idWidth = Math.max(...ids.map((id) => id.length)) + 2;\n const header = `${pad(\"id\", idWidth)}${pad(\"layer\", 11)}${pad(\"surface\", 26)}${pad(\"transport\", 14)}endpoint`;\n console.log(` ${S.dim(header)}`);\n for (const id of ids) {\n const entry = view.merged.providers[id];\n const surface = (entry as AIProviderLlmEntry).surface ?? \"—\";\n const transport = entryTransport(entry) ?? \"—\";\n const url = resolveEntryBaseUrl(entry) ?? S.dim(\"(unresolved)\");\n const flags = [\n isEntryEnabled(entry) ? \"\" : S.warn(\"disabled\"),\n entry.locked ? S.warn(\"locked\") : \"\",\n ]\n .filter(Boolean)\n .join(\" \");\n console.log(\n ` ${pad(id, idWidth)}${pad(view.merged.origin[id], 11)}${pad(surface, 26)}${pad(transport, 14)}${url} ${flags}`.trimEnd(),\n );\n console.log(` ${S.dim(`${pad(\"\", idWidth)}${credentialSummary(entry)}`)}`);\n }\n console.log();\n}\n\n// ── add ────────────────────────────────────────────────────────────────────\n\ninterface AddOptions extends ScopeOptions {\n preset?: string;\n credential?: string;\n baseUrl?: string;\n surface?: string;\n label?: string;\n kind?: string;\n param: string[];\n force?: boolean;\n}\n\nfunction parseParams(pairs: string[]): Record<string, string> {\n const out: Record<string, string> = {};\n for (const pair of pairs) {\n const eq = pair.indexOf(\"=\");\n if (eq <= 0) {\n logErr(`--param expects <key>=<value> (got '${pair}')`);\n process.exit(1);\n }\n out[pair.slice(0, eq)] = pair.slice(eq + 1);\n }\n return out;\n}\n\n/** Ask for the three literals a custom endpoint needs. Nothing else. */\nasync function promptCustomEntry(\n id: string,\n opts: AddOptions,\n): Promise<{ surface: AIProviderSurface; baseUrl: string; credentialRef: string }> {\n const interactive = process.stdin.isTTY === true;\n let surface = opts.surface as AIProviderSurface | undefined;\n let baseUrl = opts.baseUrl;\n let credentialRef = opts.credential;\n\n if (!interactive && (!surface || !baseUrl || !credentialRef)) {\n logErr(\n \"--preset custom needs --surface, --base-url and --credential when there is no terminal to prompt on\",\n );\n process.exit(1);\n }\n\n if (!surface) {\n const answer = await p.select({\n message: \"Wire surface:\",\n options: AI_PROVIDER_SURFACES.map((value) => ({ value, label: value })),\n initialValue: \"openai-completions\" as AIProviderSurface,\n });\n if (p.isCancel(answer)) {\n p.cancel(\"Cancelled.\");\n process.exit(1);\n }\n surface = answer as AIProviderSurface;\n }\n if (!baseUrl) {\n const answer = await p.text({\n message: \"Base URL:\",\n placeholder: \"https://api.example.com/v1\",\n });\n if (p.isCancel(answer)) {\n p.cancel(\"Cancelled.\");\n process.exit(1);\n }\n baseUrl = answer as string;\n }\n if (!credentialRef) {\n const answer = await p.text({\n message: \"Credential reference (env:NAME, cmd:<shell>, platform:<id>, keyring:<svc>/<acct>):\",\n initialValue: `env:${id.toUpperCase().replace(/[^A-Z0-9]/g, \"_\")}_API_KEY`,\n });\n if (p.isCancel(answer)) {\n p.cancel(\"Cancelled.\");\n process.exit(1);\n }\n credentialRef = answer as string;\n }\n return { surface, baseUrl, credentialRef };\n}\n\n/** A rejected registry write. The message is already CLI-ready. */\nexport class ProviderRegistryWriteError extends Error {}\n\n/** What {@link addProviderEntry} writes. */\nexport interface AddProviderEntryInput extends ScopeOptions {\n /** Registry entry id — `[a-z0-9][a-z0-9_-]*`. */\n id: string;\n /** Catalog preset to expand. Mutually exclusive with `entry`. */\n presetId?: string;\n /** A fully-built entry (the `--preset custom` path, which needs prompts). */\n entry?: AIProviderEntry;\n /** `env:NAME` / `cmd:…` / `platform:…` / `keyring:…` — never a literal. */\n credentialRef?: string;\n baseUrl?: string;\n surface?: AIProviderSurface;\n label?: string;\n params?: Record<string, string>;\n /** Overwrite an entry that already exists in the target file. */\n force?: boolean;\n}\n\n/** Result of {@link addProviderEntry}. */\nexport interface AddedProviderEntry {\n id: string;\n layer: \"user\" | \"workspace\";\n path: string;\n entry: AIProviderEntry;\n /** True when an existing entry in the target file was overwritten. */\n replaced: boolean;\n}\n\n/**\n * Write one entry into a registry file — the single write path behind\n * `skaile providers add` and the `skaile setup` wizard.\n *\n * Throws {@link ProviderRegistryWriteError} instead of exiting, so a wizard\n * can report the failure in its own idiom. Every rejection a caller can\n * provoke (bad id, unknown preset, missing transport parameter, locked entry,\n * a literal secret) lands here, and the document is validated before it is\n * written — a secret cannot reach disk through this function.\n */\nexport function addProviderEntry(input: AddProviderEntryInput): AddedProviderEntry {\n const { id } = input;\n if (!isSafeProviderId(id)) {\n throw new ProviderRegistryWriteError(\n `'${id}' is not a valid entry id — use [a-z0-9][a-z0-9_-]*`,\n );\n }\n if (input.credentialRef && !parseCredentialRef(input.credentialRef)) {\n throw new ProviderRegistryWriteError(\n \"the credential must be a reference, not a secret: \" +\n \"env:NAME, cmd:<shell>, platform:<configId> or keyring:<service>/<account>\",\n );\n }\n\n const view = loadRegistryView(input);\n const target = targetFile(input);\n const locked = lockConflict(id, target, view.files);\n if (locked) throw new ProviderRegistryWriteError(locked);\n\n const document = readTargetDocument(target, view.files);\n const replaced = document.providers[id] !== undefined;\n if (replaced && !input.force) {\n throw new ProviderRegistryWriteError(\n `'${id}' already exists in ${target.path} — pass --force to overwrite it.`,\n );\n }\n\n let entry: AIProviderEntry;\n if (input.entry) {\n entry = input.entry;\n } else {\n const preset = input.presetId ? getProviderPreset(input.presetId) : undefined;\n if (!preset) {\n throw new ProviderRegistryWriteError(\n `Unknown preset '${input.presetId}'. Run \\`skaile providers list\\` to see the catalog, ` +\n \"or use `--preset custom`.\",\n );\n }\n entry = expandPreset(preset, {\n credentialRef: input.credentialRef,\n baseUrl: input.baseUrl,\n surface: input.surface,\n label: input.label,\n params: input.params,\n });\n const missing = (preset.required_params ?? []).filter(\n (key) => !(key in ((entry as AIProviderLlmEntry).params ?? {})),\n );\n if (missing.length > 0) {\n throw new ProviderRegistryWriteError(\n `Preset '${preset.id}' needs ${missing.map((m) => `--param ${m}=<value>`).join(\" \")}`,\n );\n }\n }\n\n const next: AIProviderRegistryDocument = {\n version: 1,\n providers: { ...document.providers, [id]: entry },\n };\n const { diagnostics } = validateRegistry(\n { version: 1, providers: next.providers },\n { source: target.path },\n );\n const errors = diagnostics.filter((d) => d.severity === \"error\");\n if (errors.length > 0) {\n throw new ProviderRegistryWriteError(\n errors.map((d) => (d.path ? `${d.path}: ${d.message}` : d.message)).join(\"\\n\"),\n );\n }\n saveProviderRegistryFile(target.path, next);\n\n return { id, layer: target.layer, path: target.path, entry, replaced };\n}\n\n/** The env var an `env:` credential reference points at, if it is one. */\nexport function credentialEnvVarName(entry: AIProviderEntry): string | undefined {\n const ref = entry.credential?.ref;\n return ref?.startsWith(\"env:\") ? ref.slice(4) : undefined;\n}\n\n/** Build the `--preset custom` entry from the three literals the user gave. */\nfunction customEntry(\n answers: { surface: AIProviderSurface; baseUrl: string; credentialRef: string },\n opts: AddOptions,\n): AIProviderEntry {\n const kind = (opts.kind ?? \"llm\") as AIProviderEntry[\"kind\"];\n // Anthropic- and Google-shaped surfaces read a dedicated API-key header;\n // everything else is a bearer token. `set <id> credential.kind …` adjusts.\n const credentialKind =\n kind === \"stt\" ||\n kind === \"tts\" ||\n answers.surface === \"anthropic-messages\" ||\n answers.surface === \"google-generative-ai\" ||\n answers.surface === \"azure-openai-responses\"\n ? \"api_key_header\"\n : \"bearer\";\n if (kind === \"stt\" || kind === \"tts\") {\n return {\n kind,\n ...(opts.label ? { label: opts.label } : {}),\n base_url: answers.baseUrl,\n credential: { kind: credentialKind, ref: answers.credentialRef },\n };\n }\n return {\n kind,\n ...(opts.label ? { label: opts.label } : {}),\n surface: answers.surface,\n base_url: answers.baseUrl,\n credential: { kind: credentialKind, ref: answers.credentialRef },\n } as AIProviderLlmEntry;\n}\n\nasync function runAdd(idArg: string | undefined, opts: AddOptions): Promise<void> {\n const presetId = opts.preset;\n if (!presetId) {\n logErr(\n `--preset is required. Run ${S.cmd(\"skaile providers list\")} for the catalog, ` +\n `or use ${S.cmd(\"--preset custom\")}.`,\n );\n process.exit(1);\n }\n const id = idArg ?? presetId;\n if (id === CUSTOM_PRESET && !idArg) {\n logErr(\"--preset custom needs an entry id: skaile providers add <id> --preset custom\");\n process.exit(1);\n }\n\n const entry =\n presetId === CUSTOM_PRESET ? customEntry(await promptCustomEntry(id, opts), opts) : undefined;\n\n let added: AddedProviderEntry;\n try {\n added = addProviderEntry({\n id,\n ...(entry ? { entry } : { presetId }),\n credentialRef: opts.credential,\n baseUrl: opts.baseUrl,\n surface: opts.surface as AIProviderSurface | undefined,\n label: opts.label,\n params: parseParams(opts.param),\n projectDir: opts.projectDir,\n workspace: opts.workspace,\n force: opts.force,\n });\n } catch (error) {\n logErr(error instanceof Error ? error.message : String(error));\n process.exit(1);\n }\n\n logOk(`Added ${S.bold(id)} (${presetId}) to the ${added.layer} registry`);\n console.log(S.dim(` → ${added.path}`));\n const name = credentialEnvVarName(added.entry);\n if (name) {\n console.log(\n ` ${S.dim(\"The secret itself never goes in this file — export it:\")} ${S.cmd(`export ${name}=…`)}`,\n );\n }\n console.log(` ${S.dim(\"Verify with:\")} ${S.cmd(`skaile providers test ${id}`)}`);\n}\n\n// ── set / rm ───────────────────────────────────────────────────────────────\n\n/** Coerce a CLI string into the type the schema expects at `key`. */\nfunction coerceValue(key: string, value: string): unknown {\n const leaf = key.split(\".\").pop() ?? key;\n if (leaf === \"enabled\" || leaf === \"locked\" || leaf === \"tools\" || leaf === \"images\") {\n if (value === \"true\") return true;\n if (value === \"false\") return false;\n logErr(`'${key}' takes true or false (got '${value}')`);\n process.exit(1);\n }\n if (leaf === \"context_window\" || leaf === \"thinking_max\") {\n const parsed = Number(value);\n if (!Number.isFinite(parsed)) {\n logErr(`'${key}' takes a number (got '${value}')`);\n process.exit(1);\n }\n return parsed;\n }\n return value;\n}\n\n/** Write `value` at a dotted path, creating intermediate maps. */\nfunction setDotted(entry: Record<string, unknown>, key: string, value: unknown): void {\n const segments = key.split(\".\");\n let cursor = entry;\n for (const segment of segments.slice(0, -1)) {\n const next = cursor[segment];\n if (typeof next !== \"object\" || next === null || Array.isArray(next)) {\n cursor[segment] = {};\n }\n cursor = cursor[segment] as Record<string, unknown>;\n }\n cursor[segments[segments.length - 1]] = value;\n}\n\nfunction runSet(id: string, key: string, value: string, opts: ScopeOptions): void {\n const view = loadRegistryView(opts);\n const target = targetFile(opts);\n exitIfLocked(id, target, view.files, key);\n\n const document = readTargetDocument(target, view.files);\n const existing = document.providers[id];\n const inherited = view.merged.providers[id];\n if (!existing && !inherited) {\n logErr(\n `No provider '${id}'. Add it with ${S.cmd(`skaile providers add ${id} --preset <preset>`)}`,\n );\n process.exit(1);\n }\n\n // Writing a field into a layer that has no entry yet leaves a one-field\n // override: the layers below keep supplying the rest (§1.5), so copying\n // their `kind` down here would pin a value this layer does not own.\n const base = (existing ? structuredClone(existing) : {}) as unknown as Record<string, unknown>;\n setDotted(base, key, coerceValue(key, value));\n\n const next: AIProviderRegistryDocument = {\n version: 1,\n providers: { ...document.providers, [id]: base as unknown as AIProviderEntry },\n };\n validateOrExit(next, target);\n saveProviderRegistryFile(target.path, next);\n\n logOk(`Set ${S.bold(`${id}.${key}`)} = ${value} in the ${target.layer} registry`);\n console.log(S.dim(` → ${target.path}`));\n}\n\nfunction runRemove(id: string, opts: ScopeOptions): void {\n const view = loadRegistryView(opts);\n const target = targetFile(opts);\n exitIfLocked(id, target, view.files);\n\n const document = readTargetDocument(target, view.files);\n if (!document.providers[id]) {\n logErr(`No provider '${id}' in ${target.path}`);\n process.exit(1);\n }\n const providers = { ...document.providers };\n delete providers[id];\n saveProviderRegistryFile(target.path, { version: 1, providers });\n\n logOk(`Removed ${S.bold(id)} from the ${target.layer} registry`);\n console.log(S.dim(` → ${target.path}`));\n if (\n view.merged.providers[id] &&\n view.files.some((f) => f.path !== target.path && f.document.providers[id])\n ) {\n logInfo(`'${id}' is still defined in another layer — run 'skaile providers list' to see it.`);\n }\n}\n\n// ── test ───────────────────────────────────────────────────────────────────\n\nasync function runTest(id: string, opts: ScopeOptions): Promise<void> {\n const view = loadRegistryView(opts);\n const entry = view.merged.providers[id];\n if (!entry) {\n logErr(`No provider '${id}'. Run ${S.cmd(\"skaile providers list\")} to see what is configured.`);\n process.exit(1);\n }\n\n const credential = resolveCredential(entry);\n console.log();\n console.log(` ${S.heading(id)} ${S.dim(`(${view.merged.origin[id]} layer)`)}`);\n console.log(` ${S.label(\"endpoint \")} ${resolveEntryBaseUrl(entry) ?? S.dim(\"(unresolved)\")}`);\n console.log(\n ` ${S.label(\"credential\")} ${credentialSummary(entry)} ${\n credential.error\n ? S.err(`— ${credential.error}`)\n : S.dim(`— resolved from ${credential.source}`)\n }`,\n );\n\n if (credential.error) {\n console.log();\n logErr(`${id} is not usable yet: ${credential.error}`);\n process.exit(1);\n }\n\n const result = await probeProviderEntry(entry, { secret: credential.value });\n if (result.url) console.log(` ${S.label(\"probe \")} GET ${result.url}`);\n console.log();\n if (result.ok) {\n logOk(`${id}: ${result.detail}${result.status ? ` (HTTP ${result.status})` : \"\"}`);\n return;\n }\n if (!result.probed) {\n logWarn(`${id}: ${result.detail}`);\n return;\n }\n logErr(`${id}: ${result.detail}`);\n process.exit(1);\n}\n\n// ── command ────────────────────────────────────────────────────────────────\n\n/**\n * Create the `skaile providers` command group.\n *\n * `list` shows the catalog and what is configured; `add` writes an entry from\n * a preset (or from three literals with `--preset custom`); `set` and `rm`\n * edit one layer; `test` sends one read-only request and reports what came\n * back, never the credential.\n *\n * @returns Configured {@link Command} ready for `program.addCommand()`.\n */\nexport function makeProvidersCommand(): Command {\n const cmd = new Command(\"providers\").description(\n \"Manage AI provider endpoints (~/.skaile/providers.yml)\",\n );\n\n cmd\n .command(\"list\")\n .description(\"List catalog presets and configured providers\")\n .option(\"--project-dir <path>\", \"Project directory\")\n .option(\"--json\", \"Machine-readable output\")\n .action((opts) => {\n const view = loadRegistryView(opts);\n if (opts.json) {\n console.log(\n JSON.stringify(\n {\n presets: listProviderPresets().map((preset) => ({\n id: preset.id,\n kind: preset.kind,\n surface: preset.surface,\n transport: preset.transport ?? (preset.surface ? \"direct\" : undefined),\n base_url: presetBaseUrl(preset),\n credential: preset.credential,\n required_params: preset.required_params,\n })),\n providers: view.merged.order.map((id) => ({\n id,\n layer: view.merged.origin[id],\n entry: view.merged.providers[id],\n base_url: resolveEntryBaseUrl(view.merged.providers[id]),\n })),\n },\n null,\n 2,\n ),\n );\n return;\n }\n reportDiagnostics(view.diagnostics);\n printPresets();\n printConfigured(view);\n });\n\n cmd\n .command(\"add [id]\")\n .description(\"Add a provider from a catalog preset (id defaults to the preset name)\")\n .requiredOption(\"--preset <preset>\", `Catalog preset, or '${CUSTOM_PRESET}'`)\n .option(\"--credential <ref>\", \"Credential reference (env:NAME, cmd:…, platform:…, keyring:…)\")\n .option(\"--base-url <url>\", \"Override the preset endpoint\")\n .option(\"--surface <surface>\", `Wire surface (${AI_PROVIDER_SURFACES.join(\", \")})`)\n .option(\"--kind <kind>\", \"Entry kind for --preset custom (llm, embed, stt, tts)\", \"llm\")\n .option(\"--label <text>\", \"Display label\")\n .option(\n \"--param <key=value>\",\n \"Transport parameter (repeatable): region, project, location, resource, deployment, api_version\",\n (value: string, previous: string[]) => [...previous, value],\n [] as string[],\n )\n .option(\"--workspace\", \"Write <workspace>/.skaile/providers.yml instead of the user file\")\n .option(\"--project-dir <path>\", \"Project directory\")\n .option(\"--force\", \"Overwrite an existing entry in the target file\")\n .action((id: string | undefined, opts: AddOptions) => runAdd(id, opts));\n\n cmd\n .command(\"set <id> <key> <value>\")\n .description(\n \"Set one field (base_url, enabled, credential.ref, headers.<name>, model_map.<id>…)\",\n )\n .option(\"--workspace\", \"Write <workspace>/.skaile/providers.yml instead of the user file\")\n .option(\"--project-dir <path>\", \"Project directory\")\n .action((id: string, key: string, value: string, opts: ScopeOptions) =>\n runSet(id, key, value, opts),\n );\n\n cmd\n .command(\"rm <id>\")\n .description(\"Remove a provider from one layer\")\n .option(\"--workspace\", \"Edit <workspace>/.skaile/providers.yml instead of the user file\")\n .option(\"--project-dir <path>\", \"Project directory\")\n .action((id: string, opts: ScopeOptions) => runRemove(id, opts));\n\n cmd\n .command(\"test <id>\")\n .description(\"Send one read-only request to a provider and report the result\")\n .option(\"--project-dir <path>\", \"Project directory\")\n .action((id: string, opts: ScopeOptions) => runTest(id, opts));\n\n return cmd;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { parseDep, isValidAssetName, slugifyAssetName } from './chunk-QVNRCDTV.js';
1
+ import { depToStr, parseDep, isValidAssetName, slugifyAssetName } from './chunk-4OV5DSBB.js';
2
2
  import { createLogger } from './chunk-BOFL7GIF.js';
3
3
  import { stat, readFile, opendir } from 'fs/promises';
4
4
  import { basename, dirname, join } from 'path';
@@ -47,6 +47,41 @@ async function tryWithFsDeadline(operation, fn, fallback, timeoutMs = fsDeadline
47
47
  }
48
48
  }
49
49
 
50
+ // core/src/requirements.ts
51
+ function requirementKey(dep, fallbackPublisher) {
52
+ const publisher = dep.publisher ?? fallbackPublisher ?? "";
53
+ return publisher ? `${publisher}/${dep.kind}:${dep.name}` : `${dep.kind}:${dep.name}`;
54
+ }
55
+ function dedupeRequirements(deps, fallbackPublisher) {
56
+ const out = [];
57
+ const at = /* @__PURE__ */ new Map();
58
+ for (const dep of deps) {
59
+ const key = requirementKey(dep, fallbackPublisher);
60
+ const i = at.get(key);
61
+ if (i === void 0) {
62
+ at.set(key, out.length);
63
+ out.push({ ...dep });
64
+ continue;
65
+ }
66
+ const kept = out[i];
67
+ if (!kept.publisher && dep.publisher) kept.publisher = dep.publisher;
68
+ if (!kept.pin && dep.pin) kept.pin = dep.pin;
69
+ }
70
+ return out;
71
+ }
72
+ function dedupeRequirementRefs(refs, fallbackPublisher) {
73
+ const parse2 = (ref) => {
74
+ const dep = parseDep(ref);
75
+ const hash = dep.name.indexOf("#");
76
+ if (hash === -1) return dep;
77
+ const pin = dep.name.slice(hash + 1).trim();
78
+ dep.name = dep.name.slice(0, hash);
79
+ if (pin && !dep.pin) dep.pin = pin;
80
+ return dep;
81
+ };
82
+ return dedupeRequirements(refs.map(parse2), fallbackPublisher).map(depToStr);
83
+ }
84
+
50
85
  // core/src/manifest.ts
51
86
  function readManifestFile(filePath, timeoutMs) {
52
87
  return withFsDeadline(`readFile ${filePath}`, () => readFile(filePath, "utf8"), timeoutMs);
@@ -551,14 +586,10 @@ async function readManifestAssetOverrides(root, opTimeoutMs) {
551
586
  return out;
552
587
  }
553
588
  function mergeManifestDependencies(entry, dependencies) {
554
- const idOf = (d) => `${d.kind}:@${d.publisher ?? ""}/${d.name}`;
555
- const seen = new Set(entry.requires.map(idOf));
556
- for (const raw of dependencies) {
557
- const dep = parseDep(raw);
558
- if (seen.has(idOf(dep))) continue;
559
- seen.add(idOf(dep));
560
- entry.requires.push(dep);
561
- }
589
+ entry.requires = dedupeRequirements(
590
+ [...entry.requires, ...dependencies.map((raw) => parseDep(raw))],
591
+ entry.publisher
592
+ );
562
593
  }
563
594
  async function scanDirectory(root, repoName, options) {
564
595
  const entries = /* @__PURE__ */ new Map();
@@ -616,6 +647,6 @@ async function scanDirectory(root, repoName, options) {
616
647
  return options.keepDuplicates ? copies : [...entries.values()];
617
648
  }
618
649
 
619
- export { DEFAULT_FS_DEADLINE_MS, DEFAULT_WALK_BUDGET_MS, DEFAULT_WALK_MAX_DEPTH, DEFAULT_WALK_MAX_ENTRIES, FS_DEADLINE_ENV_VAR, FsDeadlineError, ManifestKindError, WALK_BUDGET_MS_ENV_VAR, WALK_MAX_DEPTH_ENV_VAR, WALK_MAX_ENTRIES_ENV_VAR, assetDepRefs, fromAgentMd, fromAgentYaml, fromConnectorMd, fromContractMd, fromFlowYaml, fromKnowledgeYaml, fromMcpServerMd, fromMcpServerMdContent, fromPresetYaml, fromPromptMd, fromSkillMd, fsDeadlineMs, manifestKindDiagnostic, parseFrontmatter, parseRequires, presetItemRefs, scanDirectory, tryWithFsDeadline, walkDir, withFsDeadline };
620
- //# sourceMappingURL=chunk-GTILM2CI.js.map
621
- //# sourceMappingURL=chunk-GTILM2CI.js.map
650
+ export { DEFAULT_FS_DEADLINE_MS, DEFAULT_WALK_BUDGET_MS, DEFAULT_WALK_MAX_DEPTH, DEFAULT_WALK_MAX_ENTRIES, FS_DEADLINE_ENV_VAR, FsDeadlineError, ManifestKindError, WALK_BUDGET_MS_ENV_VAR, WALK_MAX_DEPTH_ENV_VAR, WALK_MAX_ENTRIES_ENV_VAR, assetDepRefs, dedupeRequirementRefs, dedupeRequirements, fromAgentMd, fromAgentYaml, fromConnectorMd, fromContractMd, fromFlowYaml, fromKnowledgeYaml, fromMcpServerMd, fromMcpServerMdContent, fromPresetYaml, fromPromptMd, fromSkillMd, fsDeadlineMs, manifestKindDiagnostic, parseFrontmatter, parseRequires, presetItemRefs, requirementKey, scanDirectory, tryWithFsDeadline, walkDir, withFsDeadline };
651
+ //# sourceMappingURL=chunk-Y34MSWEZ.js.map
652
+ //# sourceMappingURL=chunk-Y34MSWEZ.js.map
@@ -0,0 +1 @@
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,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AA,MAC/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","file":"chunk-Y34MSWEZ.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 { 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 *\n * @param text - Raw file contents\n * @returns Parsed frontmatter data and the remaining body text\n * @docLink packages/core/concepts#parse-frontmatter\n */\nexport function parseFrontmatter(text: string): FrontmatterResult {\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/** 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: Dependency[] = [];\n collectComposeRefs(meta.composes, requires);\n\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 `name:` or `id:` frontmatter, falling back to the filename stem.\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/** 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.name ?? meta.id ?? 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: [],\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 * 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\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/** Default truncation sink — a structured warning naming the bound that was hit. */\nfunction warnTruncation(info: WalkTruncation): void {\n walkLogger ??= createLogger({ kind: \"runner\", subkind: \"asset-scan\" });\n walkLogger.warn(`asset scan truncated (${info.reason}) — results are incomplete`, {\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 ?? warnTruncation,\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 === \"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. */\nfunction isManifestName(name: string): boolean {\n return (\n name === \"SKILL.md\" ||\n name === \"AGENT.md\" ||\n name === \"agent.yaml\" ||\n name === \"CONTRACT.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 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 } = (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 (override.publisher || override.dependencies.length > 0) 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 ?? warnTruncation;\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 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"]}
@@ -1,4 +1,4 @@
1
- import { findAiAssetsRoot } from './chunk-2LWYNQK7.js';
1
+ import { findAiAssetsRoot } from './chunk-HOHUEKES.js';
2
2
 
3
3
  // workspace-plugin/src/utils/ai-assets.ts
4
4
  function findAiAssetsRoot2(startDir) {
@@ -6,5 +6,5 @@ function findAiAssetsRoot2(startDir) {
6
6
  }
7
7
 
8
8
  export { findAiAssetsRoot2 as findAiAssetsRoot };
9
- //# sourceMappingURL=chunk-4PTSR4UU.js.map
10
- //# sourceMappingURL=chunk-4PTSR4UU.js.map
9
+ //# sourceMappingURL=chunk-Y63UQZ7P.js.map
10
+ //# sourceMappingURL=chunk-Y63UQZ7P.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../workspace-plugin/src/utils/ai-assets.ts"],"names":["findAiAssetsRoot"],"mappings":";;;AA+BO,SAASA,kBAAiB,QAAA,EAA0C;AACzE,EAAA,OAAO,iBAAuB,QAAQ,CAAA;AACxC","file":"chunk-4PTSR4UU.js","sourcesContent":["// utils/ai-assets.ts\n// Shared utility for locating the ai-assets root directory.\n//\n// This is NOT a startup path (an earlier comment here claimed it was). Every\n// caller is an agent-invokable tool in `tools/flows.ts` / `tools/skills.ts`, so\n// the walk runs on a request path inside the long-lived `skaile serve` process,\n// once per tool invocation. With `projectDir = /skaile` the upward walk passes\n// directly beside the rclone FUSE workspace mount, so a synchronous `statSync`\n// here parks the whole event loop when that mount wedges — the failure mode\n// behind the 2026-08-07 outages. See issue #454.\nimport { findAiAssetsRoot as findAiAssetsRootShared } from \"@skaile/workspaces/asset-manager/catalog-deployer\";\n\n/**\n * Walk up from `startDir` looking for an `ai-assets/` directory.\n *\n * Delegates to the shared implementation in `asset-manager/catalog-deployer`,\n * which is async, deadline-bounded, level-capped, and refuses a candidate that\n * resolves at or under a workspace mount (continuing upward so a legitimate\n * parent still wins).\n *\n * @param startDir - Absolute path to begin the upward search from (typically\n * the skaile `projectDir`).\n * Note the upward walk is now level-capped rather than running to the\n * filesystem root. Six levels covers every real layout and stops an\n * unbounded climb across mount boundaries.\n *\n * @returns Absolute path to the first usable `ai-assets/` directory found, or\n * `null` if no match exists within the cap.\n *\n * @docLink packages/workspace-plugin/concepts#workspaceplugin-lifecycle\n */\nexport function findAiAssetsRoot(startDir: string): Promise<string | null> {\n return findAiAssetsRootShared(startDir);\n}\n"]}
1
+ {"version":3,"sources":["../workspace-plugin/src/utils/ai-assets.ts"],"names":["findAiAssetsRoot"],"mappings":";;;AA+BO,SAASA,kBAAiB,QAAA,EAA0C;AACzE,EAAA,OAAO,iBAAuB,QAAQ,CAAA;AACxC","file":"chunk-Y63UQZ7P.js","sourcesContent":["// utils/ai-assets.ts\n// Shared utility for locating the ai-assets root directory.\n//\n// This is NOT a startup path (an earlier comment here claimed it was). Every\n// caller is an agent-invokable tool in `tools/flows.ts` / `tools/skills.ts`, so\n// the walk runs on a request path inside the long-lived `skaile serve` process,\n// once per tool invocation. With `projectDir = /skaile` the upward walk passes\n// directly beside the rclone FUSE workspace mount, so a synchronous `statSync`\n// here parks the whole event loop when that mount wedges — the failure mode\n// behind the 2026-08-07 outages. See issue #454.\nimport { findAiAssetsRoot as findAiAssetsRootShared } from \"@skaile/workspaces/asset-manager/catalog-deployer\";\n\n/**\n * Walk up from `startDir` looking for an `ai-assets/` directory.\n *\n * Delegates to the shared implementation in `asset-manager/catalog-deployer`,\n * which is async, deadline-bounded, level-capped, and refuses a candidate that\n * resolves at or under a workspace mount (continuing upward so a legitimate\n * parent still wins).\n *\n * @param startDir - Absolute path to begin the upward search from (typically\n * the skaile `projectDir`).\n * Note the upward walk is now level-capped rather than running to the\n * filesystem root. Six levels covers every real layout and stops an\n * unbounded climb across mount boundaries.\n *\n * @returns Absolute path to the first usable `ai-assets/` directory found, or\n * `null` if no match exists within the cap.\n *\n * @docLink packages/workspace-plugin/concepts#workspaceplugin-lifecycle\n */\nexport function findAiAssetsRoot(startDir: string): Promise<string | null> {\n return findAiAssetsRootShared(startDir);\n}\n"]}