@skaile/workspaces 5.5.0 → 5.6.1

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 (423) hide show
  1. package/CHANGELOG.md +95 -0
  2. package/dist/app-sdk/index.js +1 -1
  3. package/dist/{asset-feeds-KTFUB7EX.js → asset-feeds-LU7NHOAP.js} +27 -14
  4. package/dist/asset-feeds-LU7NHOAP.js.map +1 -0
  5. package/dist/asset-manager/catalog-deployer.js +9 -9
  6. package/dist/asset-manager/index.js +18 -18
  7. package/dist/asset-manager/installer.js +11 -11
  8. package/dist/asset-manager/renderers.js +20 -2
  9. package/dist/asset-manager/src/index.d.ts +66 -24
  10. package/dist/asset-manager/src/index.d.ts.map +1 -1
  11. package/dist/asset-manager/src/install-agent.d.ts +22 -14
  12. package/dist/asset-manager/src/install-agent.d.ts.map +1 -1
  13. package/dist/asset-manager/src/install-instances.d.ts +55 -0
  14. package/dist/asset-manager/src/install-instances.d.ts.map +1 -0
  15. package/dist/asset-manager/src/installer.d.ts +30 -7
  16. package/dist/asset-manager/src/installer.d.ts.map +1 -1
  17. package/dist/asset-manager/src/renderers.d.ts +29 -8
  18. package/dist/asset-manager/src/renderers.d.ts.map +1 -1
  19. package/dist/bridge/drivers/claude-sdk.js +14 -14
  20. package/dist/bridge/drivers/codex.js +20 -14
  21. package/dist/bridge/drivers/codex.js.map +1 -1
  22. package/dist/bridge/drivers/continue.js +11 -11
  23. package/dist/bridge/drivers/echo.js +3 -3
  24. package/dist/bridge/drivers/gemini.js +6 -6
  25. package/dist/bridge/drivers/goose.js +11 -11
  26. package/dist/bridge/drivers/omp.js +4 -4
  27. package/dist/bridge/drivers/opencode.js +11 -11
  28. package/dist/bridge/drivers/qwen.js +6 -6
  29. package/dist/bridge/index.js +15 -15
  30. package/dist/bridge/src/codex/native-policy.d.ts +1 -1
  31. package/dist/bridge/src/drivers/codex.d.ts +2 -1
  32. package/dist/bridge/src/drivers/codex.d.ts.map +1 -1
  33. package/dist/{chunk-LCULZ4ED.js → chunk-27HS2DHB.js} +4 -4
  34. package/dist/{chunk-LCULZ4ED.js.map → chunk-27HS2DHB.js.map} +1 -1
  35. package/dist/{chunk-X4GO3GJZ.js → chunk-2GRB5ITE.js} +4 -4
  36. package/dist/{chunk-X4GO3GJZ.js.map → chunk-2GRB5ITE.js.map} +1 -1
  37. package/dist/{chunk-75EX5GY4.js → chunk-2KOKBTR4.js} +197 -118
  38. package/dist/chunk-2KOKBTR4.js.map +1 -0
  39. package/dist/{chunk-ES2FXWQ4.js → chunk-2NYXQYHN.js} +4 -4
  40. package/dist/{chunk-ES2FXWQ4.js.map → chunk-2NYXQYHN.js.map} +1 -1
  41. package/dist/{chunk-ORUHADS6.js → chunk-2W4LBLIN.js} +386 -60
  42. package/dist/chunk-2W4LBLIN.js.map +1 -0
  43. package/dist/{chunk-SNVOASTL.js → chunk-2XFUXGV6.js} +3 -3
  44. package/dist/{chunk-SNVOASTL.js.map → chunk-2XFUXGV6.js.map} +1 -1
  45. package/dist/{chunk-ZDKJHQY2.js → chunk-3TXEJN4W.js} +2 -2
  46. package/dist/{chunk-ZDKJHQY2.js.map → chunk-3TXEJN4W.js.map} +1 -1
  47. package/dist/{chunk-JELTQ4H7.js → chunk-45VFGT7A.js} +3 -3
  48. package/dist/{chunk-JELTQ4H7.js.map → chunk-45VFGT7A.js.map} +1 -1
  49. package/dist/{chunk-XGIS325V.js → chunk-46OVMT76.js} +3 -3
  50. package/dist/{chunk-XGIS325V.js.map → chunk-46OVMT76.js.map} +1 -1
  51. package/dist/{chunk-37GBJLF5.js → chunk-47ZD34KB.js} +3 -3
  52. package/dist/{chunk-37GBJLF5.js.map → chunk-47ZD34KB.js.map} +1 -1
  53. package/dist/{chunk-LFEGIZTW.js → chunk-4GNJELPH.js} +2 -2
  54. package/dist/{chunk-LFEGIZTW.js.map → chunk-4GNJELPH.js.map} +1 -1
  55. package/dist/{chunk-V7VDSFPS.js → chunk-5B5IZVEP.js} +2 -2
  56. package/dist/{chunk-V7VDSFPS.js.map → chunk-5B5IZVEP.js.map} +1 -1
  57. package/dist/{chunk-EJYZ3MKJ.js → chunk-65EYRFZJ.js} +4 -4
  58. package/dist/{chunk-EJYZ3MKJ.js.map → chunk-65EYRFZJ.js.map} +1 -1
  59. package/dist/{chunk-CODXK5L5.js → chunk-6NPINANG.js} +6 -6
  60. package/dist/{chunk-CODXK5L5.js.map → chunk-6NPINANG.js.map} +1 -1
  61. package/dist/{chunk-XBM5ND55.js → chunk-7KLC4LZO.js} +8 -8
  62. package/dist/{chunk-XBM5ND55.js.map → chunk-7KLC4LZO.js.map} +1 -1
  63. package/dist/{chunk-SR4RFKHM.js → chunk-7ZHLYXTI.js} +3 -3
  64. package/dist/{chunk-SR4RFKHM.js.map → chunk-7ZHLYXTI.js.map} +1 -1
  65. package/dist/{chunk-WX74MVNA.js → chunk-AO7VJ6G6.js} +3 -24
  66. package/dist/chunk-AO7VJ6G6.js.map +1 -0
  67. package/dist/{chunk-DPMKI26Y.js → chunk-AOAZCSDI.js} +4 -3
  68. package/dist/chunk-AOAZCSDI.js.map +1 -0
  69. package/dist/{chunk-YK7WJSTD.js → chunk-BF33SCLY.js} +10 -5
  70. package/dist/chunk-BF33SCLY.js.map +1 -0
  71. package/dist/{chunk-VKSA2CDJ.js → chunk-BTISGSK4.js} +4 -4
  72. package/dist/{chunk-VKSA2CDJ.js.map → chunk-BTISGSK4.js.map} +1 -1
  73. package/dist/{chunk-TOSHZX4C.js → chunk-CPSIPIX7.js} +2 -2
  74. package/dist/chunk-CPSIPIX7.js.map +1 -0
  75. package/dist/{chunk-5Y3L7XWH.js → chunk-D2V42LUE.js} +15 -15
  76. package/dist/chunk-D2V42LUE.js.map +1 -0
  77. package/dist/{chunk-K2K7OF4P.js → chunk-DMLDYFDS.js} +23 -6
  78. package/dist/chunk-DMLDYFDS.js.map +1 -0
  79. package/dist/{chunk-QMWMSZQ4.js → chunk-FK6HPLQA.js} +3 -3
  80. package/dist/{chunk-QMWMSZQ4.js.map → chunk-FK6HPLQA.js.map} +1 -1
  81. package/dist/chunk-FRHE7FFB.js +655 -0
  82. package/dist/chunk-FRHE7FFB.js.map +1 -0
  83. package/dist/{chunk-UFS3FEBA.js → chunk-GP6ZL7PE.js} +3 -3
  84. package/dist/{chunk-UFS3FEBA.js.map → chunk-GP6ZL7PE.js.map} +1 -1
  85. package/dist/{chunk-P6KFWTGP.js → chunk-I4QBZLOR.js} +7 -12
  86. package/dist/chunk-I4QBZLOR.js.map +1 -0
  87. package/dist/{chunk-C4GF7RSQ.js → chunk-KUFNKVBM.js} +3 -3
  88. package/dist/{chunk-C4GF7RSQ.js.map → chunk-KUFNKVBM.js.map} +1 -1
  89. package/dist/{chunk-GCYD4EGY.js → chunk-KYXOGHY6.js} +4 -4
  90. package/dist/{chunk-GCYD4EGY.js.map → chunk-KYXOGHY6.js.map} +1 -1
  91. package/dist/{chunk-G474PBUQ.js → chunk-LLKKLKZJ.js} +3 -3
  92. package/dist/{chunk-G474PBUQ.js.map → chunk-LLKKLKZJ.js.map} +1 -1
  93. package/dist/{chunk-AC2N5BRP.js → chunk-MX3UQXLU.js} +18 -30
  94. package/dist/chunk-MX3UQXLU.js.map +1 -0
  95. package/dist/{chunk-BNUZEYC3.js → chunk-NARITJS2.js} +3 -3
  96. package/dist/{chunk-BNUZEYC3.js.map → chunk-NARITJS2.js.map} +1 -1
  97. package/dist/{chunk-Y4QWHIHB.js → chunk-OGLDAJFL.js} +4 -4
  98. package/dist/{chunk-Y4QWHIHB.js.map → chunk-OGLDAJFL.js.map} +1 -1
  99. package/dist/chunk-OLLAQLFJ.js +17 -0
  100. package/dist/chunk-OLLAQLFJ.js.map +1 -0
  101. package/dist/{chunk-LFMX2UEF.js → chunk-PA7WLID3.js} +86 -69
  102. package/dist/chunk-PA7WLID3.js.map +1 -0
  103. package/dist/{chunk-K2NUT3HO.js → chunk-PJS2YWGG.js} +6 -6
  104. package/dist/{chunk-K2NUT3HO.js.map → chunk-PJS2YWGG.js.map} +1 -1
  105. package/dist/{chunk-MMC24L2W.js → chunk-PTO2YDDG.js} +286 -121
  106. package/dist/chunk-PTO2YDDG.js.map +1 -0
  107. package/dist/{chunk-3665M43C.js → chunk-QD772CGQ.js} +5 -5
  108. package/dist/{chunk-3665M43C.js.map → chunk-QD772CGQ.js.map} +1 -1
  109. package/dist/{chunk-G2O2AARG.js → chunk-RGXVQZOV.js} +6021 -3099
  110. package/dist/chunk-RGXVQZOV.js.map +1 -0
  111. package/dist/{chunk-JKWU6ULI.js → chunk-SDFROXSA.js} +3 -3
  112. package/dist/{chunk-JKWU6ULI.js.map → chunk-SDFROXSA.js.map} +1 -1
  113. package/dist/{chunk-WHSQSVN2.js → chunk-SX4UIDKT.js} +3 -3
  114. package/dist/{chunk-WHSQSVN2.js.map → chunk-SX4UIDKT.js.map} +1 -1
  115. package/dist/{chunk-3JHFFIQ6.js → chunk-TZCQ7ZWQ.js} +83 -9
  116. package/dist/chunk-TZCQ7ZWQ.js.map +1 -0
  117. package/dist/{chunk-UHLBDAJR.js → chunk-UAP2XHRF.js} +10 -10
  118. package/dist/{chunk-UHLBDAJR.js.map → chunk-UAP2XHRF.js.map} +1 -1
  119. package/dist/{chunk-LAI7X6I2.js → chunk-VBBBZDI7.js} +3 -3
  120. package/dist/{chunk-LAI7X6I2.js.map → chunk-VBBBZDI7.js.map} +1 -1
  121. package/dist/{chunk-R4G7XI7A.js → chunk-VJENKWXF.js} +4 -5
  122. package/dist/chunk-VJENKWXF.js.map +1 -0
  123. package/dist/{chunk-TNWXGHLD.js → chunk-VKSXST23.js} +51 -42
  124. package/dist/chunk-VKSXST23.js.map +1 -0
  125. package/dist/{chunk-HTKZ4AOW.js → chunk-VSQFGU5D.js} +3 -3
  126. package/dist/{chunk-HTKZ4AOW.js.map → chunk-VSQFGU5D.js.map} +1 -1
  127. package/dist/{chunk-JBPG5KQC.js → chunk-VX3INFBA.js} +4 -4
  128. package/dist/{chunk-JBPG5KQC.js.map → chunk-VX3INFBA.js.map} +1 -1
  129. package/dist/{chunk-N3Y43LMZ.js → chunk-WIHQWVWL.js} +34 -11
  130. package/dist/chunk-WIHQWVWL.js.map +1 -0
  131. package/dist/{chunk-Y7UBRRKG.js → chunk-XOGG7VDZ.js} +40 -31
  132. package/dist/chunk-XOGG7VDZ.js.map +1 -0
  133. package/dist/{chunk-JAJG4G5E.js → chunk-ZBBM6O6P.js} +3 -3
  134. package/dist/{chunk-JAJG4G5E.js.map → chunk-ZBBM6O6P.js.map} +1 -1
  135. package/dist/cli/index.js +5025 -3406
  136. package/dist/cli/index.js.map +1 -1
  137. package/dist/cli/src/asset-feeds.d.ts.map +1 -1
  138. package/dist/cli/src/commands/catalog.d.ts +7 -7
  139. package/dist/cli/src/commands/catalog.d.ts.map +1 -1
  140. package/dist/cli/src/commands/connector.d.ts +2 -2
  141. package/dist/cli/src/commands/connector.d.ts.map +1 -1
  142. package/dist/cli/src/commands/diff.d.ts.map +1 -1
  143. package/dist/cli/src/commands/history.d.ts.map +1 -1
  144. package/dist/cli/src/commands/library-cmd.d.ts.map +1 -1
  145. package/dist/cli/src/commands/manage.d.ts.map +1 -1
  146. package/dist/cli/src/commands/migrate-agents.d.ts +131 -0
  147. package/dist/cli/src/commands/migrate-agents.d.ts.map +1 -0
  148. package/dist/cli/src/commands/migrate-assets.d.ts +54 -0
  149. package/dist/cli/src/commands/migrate-assets.d.ts.map +1 -0
  150. package/dist/cli/src/commands/migrate-files.d.ts +52 -0
  151. package/dist/cli/src/commands/migrate-files.d.ts.map +1 -0
  152. package/dist/cli/src/commands/migrate-providers.d.ts +5 -8
  153. package/dist/cli/src/commands/migrate-providers.d.ts.map +1 -1
  154. package/dist/cli/src/commands/migrate.d.ts +21 -0
  155. package/dist/cli/src/commands/migrate.d.ts.map +1 -0
  156. package/dist/cli/src/commands/npx.d.ts.map +1 -1
  157. package/dist/cli/src/commands/outdated.d.ts.map +1 -1
  158. package/dist/cli/src/commands/patch.d.ts.map +1 -1
  159. package/dist/cli/src/commands/preset-cmd.d.ts.map +1 -1
  160. package/dist/cli/src/commands/project.d.ts +13 -1
  161. package/dist/cli/src/commands/project.d.ts.map +1 -1
  162. package/dist/cli/src/commands/rebuild.d.ts.map +1 -1
  163. package/dist/cli/src/commands/run.d.ts.map +1 -1
  164. package/dist/cli/src/commands/show.d.ts.map +1 -1
  165. package/dist/cli/src/commands/tree.d.ts.map +1 -1
  166. package/dist/cli/src/commands/update.d.ts.map +1 -1
  167. package/dist/cli/src/commands/validate-instances.d.ts +17 -0
  168. package/dist/cli/src/commands/validate-instances.d.ts.map +1 -0
  169. package/dist/cli/src/commands/validate.d.ts +14 -0
  170. package/dist/cli/src/commands/validate.d.ts.map +1 -1
  171. package/dist/cli/src/commands/why.d.ts.map +1 -1
  172. package/dist/cli/src/helpers.d.ts.map +1 -1
  173. package/dist/cli/src/open-library.d.ts.map +1 -1
  174. package/dist/cli/src/open-registry.d.ts +13 -16
  175. package/dist/cli/src/open-registry.d.ts.map +1 -1
  176. package/dist/cli/src/type-guards.d.ts +3 -0
  177. package/dist/cli/src/type-guards.d.ts.map +1 -0
  178. package/dist/connectors/config.js +6 -6
  179. package/dist/connectors/index.js +19 -19
  180. package/dist/{connectors-MPYCSQNG.js → connectors-HWENZFKW.js} +22 -22
  181. package/dist/{connectors-MPYCSQNG.js.map → connectors-HWENZFKW.js.map} +1 -1
  182. package/dist/connectors-shared/index.js +2 -2
  183. package/dist/core/driver-targets.js +1 -1
  184. package/dist/core/index.js +8 -8
  185. package/dist/core/manifest.js +2 -2
  186. package/dist/core/models.js +1 -1
  187. package/dist/core/publish-manifest.js +2 -2
  188. package/dist/core/ref.js +1 -1
  189. package/dist/core/runtime-assets.js +6 -6
  190. package/dist/core/src/agent-instances.d.ts +93 -0
  191. package/dist/core/src/agent-instances.d.ts.map +1 -0
  192. package/dist/core/src/agent-prompt-sections.d.ts +90 -0
  193. package/dist/core/src/agent-prompt-sections.d.ts.map +1 -0
  194. package/dist/core/src/driver-targets.d.ts +4 -2
  195. package/dist/core/src/driver-targets.d.ts.map +1 -1
  196. package/dist/core/src/index.d.ts +12 -8
  197. package/dist/core/src/index.d.ts.map +1 -1
  198. package/dist/core/src/manifest.d.ts +71 -27
  199. package/dist/core/src/manifest.d.ts.map +1 -1
  200. package/dist/core/src/models.d.ts +6 -92
  201. package/dist/core/src/models.d.ts.map +1 -1
  202. package/dist/core/src/repo-manager.d.ts +47 -3
  203. package/dist/core/src/repo-manager.d.ts.map +1 -1
  204. package/dist/core/src/type-guards.d.ts +3 -0
  205. package/dist/core/src/type-guards.d.ts.map +1 -0
  206. package/dist/core/src/walker.d.ts +7 -3
  207. package/dist/core/src/walker.d.ts.map +1 -1
  208. package/dist/core/src/workspace-config.d.ts +19 -15
  209. package/dist/core/src/workspace-config.d.ts.map +1 -1
  210. package/dist/core/store.js +2 -2
  211. package/dist/core/workspace-config.js +5 -5
  212. package/dist/deploy/index.js +8 -8
  213. package/dist/discovery/index.js +6 -6
  214. package/dist/discovery/src/builtin-providers.d.ts +5 -4
  215. package/dist/discovery/src/builtin-providers.d.ts.map +1 -1
  216. package/dist/discovery/src/default-registry.d.ts +23 -0
  217. package/dist/discovery/src/default-registry.d.ts.map +1 -0
  218. package/dist/discovery/src/discover.d.ts +0 -6
  219. package/dist/discovery/src/discover.d.ts.map +1 -1
  220. package/dist/discovery/src/index.d.ts +2 -1
  221. package/dist/discovery/src/index.d.ts.map +1 -1
  222. package/dist/discovery/src/tree-entries.d.ts +1 -1
  223. package/dist/discovery/src/tree-entries.d.ts.map +1 -1
  224. package/dist/{ensure-sources-QFRA46DJ.js → ensure-sources-DSTSXJWK.js} +21 -21
  225. package/dist/{ensure-sources-QFRA46DJ.js.map → ensure-sources-DSTSXJWK.js.map} +1 -1
  226. package/dist/factory-assets/README.md +3 -3
  227. package/dist/factory-assets/connectors/box.js +19 -19
  228. package/dist/factory-assets/connectors/deploy.js +19 -19
  229. package/dist/factory-assets/connectors/devserver.js +19 -19
  230. package/dist/factory-assets/connectors/flow/adapter.js +19 -19
  231. package/dist/factory-assets/connectors/flow/engine/flow-kind-provider.d.ts.map +1 -1
  232. package/dist/factory-assets/connectors/flow/engine.js +9 -9
  233. package/dist/factory-assets/connectors/flow/run-flow.js +21 -21
  234. package/dist/factory-assets/connectors/flow.js +19 -19
  235. package/dist/factory-assets/connectors/git.js +19 -19
  236. package/dist/factory-assets/connectors/gmail.js +19 -19
  237. package/dist/factory-assets/connectors/googledrive.js +19 -19
  238. package/dist/factory-assets/connectors/local.js +19 -19
  239. package/dist/factory-assets/connectors/mattermost.js +19 -19
  240. package/dist/factory-assets/connectors/memory.js +19 -19
  241. package/dist/factory-assets/connectors/minio.js +19 -19
  242. package/dist/factory-assets/connectors/postgres.js +19 -19
  243. package/dist/factory-assets/connectors/s3.js +19 -19
  244. package/dist/factory-assets/connectors/sharepoint.js +19 -19
  245. package/dist/factory-assets/connectors/sqlite.js +19 -19
  246. package/dist/factory-assets/connectors/static-server.js +19 -19
  247. package/dist/factory-assets/connectors/tunnel.js +19 -19
  248. package/dist/factory-assets/connectors/webdav.js +19 -19
  249. package/dist/factory-assets/connectors/xstate-store.js +19 -19
  250. package/dist/factory-assets/connectors/xstate.js +19 -19
  251. package/dist/factory-assets/index.js.map +1 -1
  252. package/dist/factory-assets/presets/workspaces-authoring/workspaces-authoring.preset.yaml +9 -0
  253. package/dist/factory-assets/skaile.manifest.yaml +2 -2
  254. package/dist/factory-assets/skills/authoring-skaile-assets/SKILL.md +16 -12
  255. package/dist/factory-assets/skills/authoring-skaile-manifests/SKILL.md +8 -8
  256. package/dist/factory-assets/skills/authoring-skaile-manifests/references/dependency-standard.md +13 -11
  257. package/dist/factory-assets/skills/skaile-manage-workspace/SKILL.md +1 -1
  258. package/dist/{flows-KCARGXRT.js → flows-ENQY2DV7.js} +13 -13
  259. package/dist/{flows-KCARGXRT.js.map → flows-ENQY2DV7.js.map} +1 -1
  260. package/dist/{helpers-PSROT7CU.js → helpers-R44RUTDY.js} +21 -21
  261. package/dist/{helpers-PSROT7CU.js.map → helpers-R44RUTDY.js.map} +1 -1
  262. package/dist/library/index.js +13 -13
  263. package/dist/library/install.js +3 -3
  264. package/dist/library/src/index.d.ts +2 -2
  265. package/dist/library/src/index.d.ts.map +1 -1
  266. package/dist/library/src/library.d.ts +2 -12
  267. package/dist/library/src/library.d.ts.map +1 -1
  268. package/dist/library/src/local/local-catalog-source.d.ts +2 -2
  269. package/dist/library/src/local/local-catalog-source.d.ts.map +1 -1
  270. package/dist/library/src/manifest-writer.d.ts +4 -1
  271. package/dist/library/src/manifest-writer.d.ts.map +1 -1
  272. package/dist/library/src/sync/manifest-writeback.d.ts.map +1 -1
  273. package/dist/{library-publish-YAI7WOXC.js → library-publish-LFOJJVMK.js} +27 -27
  274. package/dist/{library-publish-YAI7WOXC.js.map → library-publish-LFOJJVMK.js.map} +1 -1
  275. package/dist/open-library-4WUMQHES.js +40 -0
  276. package/dist/{open-library-Z5NJU4Z5.js.map → open-library-4WUMQHES.js.map} +1 -1
  277. package/dist/open-registry-NVPCQPND.js +32 -0
  278. package/dist/{open-registry-TYUVN5SG.js.map → open-registry-NVPCQPND.js.map} +1 -1
  279. package/dist/paths-YUCP7K6U.js +22 -0
  280. package/dist/{paths-HKAXUR3W.js.map → paths-YUCP7K6U.js.map} +1 -1
  281. package/dist/{plugin-store-N6SI2TYM.js → plugin-store-66QFBNEO.js} +10 -10
  282. package/dist/{plugin-store-N6SI2TYM.js.map → plugin-store-66QFBNEO.js.map} +1 -1
  283. package/dist/plugins/index.js +1 -1
  284. package/dist/plugins/src/asset-kind-provider.d.ts +14 -2
  285. package/dist/plugins/src/asset-kind-provider.d.ts.map +1 -1
  286. package/dist/plugins/src/index.d.ts +1 -1
  287. package/dist/plugins/src/index.d.ts.map +1 -1
  288. package/dist/project-VMOHUXBD.js +41 -0
  289. package/dist/{project-SVS4UMGL.js.map → project-VMOHUXBD.js.map} +1 -1
  290. package/dist/resolver/index.js +9 -9
  291. package/dist/runner/index.js +34 -29
  292. package/dist/runner/src/agent-capabilities.d.ts +101 -0
  293. package/dist/runner/src/agent-capabilities.d.ts.map +1 -0
  294. package/dist/runner/src/agent.d.ts.map +1 -1
  295. package/dist/runner/src/agents/in-process-host.d.ts +56 -0
  296. package/dist/runner/src/agents/in-process-host.d.ts.map +1 -0
  297. package/dist/runner/src/agents/instances.d.ts +62 -0
  298. package/dist/runner/src/agents/instances.d.ts.map +1 -0
  299. package/dist/runner/src/agents/json-schema.d.ts +16 -0
  300. package/dist/runner/src/agents/json-schema.d.ts.map +1 -0
  301. package/dist/runner/src/agents/memory-run-store.d.ts +19 -0
  302. package/dist/runner/src/agents/memory-run-store.d.ts.map +1 -0
  303. package/dist/runner/src/agents/run-controller.d.ts +208 -0
  304. package/dist/runner/src/agents/run-controller.d.ts.map +1 -0
  305. package/dist/runner/src/agents/standalone-surface.d.ts +30 -0
  306. package/dist/runner/src/agents/standalone-surface.d.ts.map +1 -0
  307. package/dist/runner/src/capability-registry.d.ts.map +1 -1
  308. package/dist/runner/src/composition/bootstrap.d.ts +13 -51
  309. package/dist/runner/src/composition/bootstrap.d.ts.map +1 -1
  310. package/dist/runner/src/composition/compile.d.ts +43 -27
  311. package/dist/runner/src/composition/compile.d.ts.map +1 -1
  312. package/dist/runner/src/composition/content-source.d.ts +94 -0
  313. package/dist/runner/src/composition/content-source.d.ts.map +1 -0
  314. package/dist/runner/src/composition/dry-run.d.ts +34 -0
  315. package/dist/runner/src/composition/dry-run.d.ts.map +1 -0
  316. package/dist/runner/src/composition/errors.d.ts +41 -0
  317. package/dist/runner/src/composition/errors.d.ts.map +1 -0
  318. package/dist/runner/src/composition/index.d.ts +10 -3
  319. package/dist/runner/src/composition/index.d.ts.map +1 -1
  320. package/dist/runner/src/composition/prompt-sections.d.ts +31 -0
  321. package/dist/runner/src/composition/prompt-sections.d.ts.map +1 -0
  322. package/dist/runner/src/composition/resolve-instance.d.ts +140 -0
  323. package/dist/runner/src/composition/resolve-instance.d.ts.map +1 -0
  324. package/dist/runner/src/composition/resolve.d.ts +43 -25
  325. package/dist/runner/src/composition/resolve.d.ts.map +1 -1
  326. package/dist/runner/src/composition/revision-hash.d.ts +58 -0
  327. package/dist/runner/src/composition/revision-hash.d.ts.map +1 -0
  328. package/dist/runner/src/composition/run-snapshot.d.ts +37 -0
  329. package/dist/runner/src/composition/run-snapshot.d.ts.map +1 -0
  330. package/dist/runner/src/composition/types.d.ts +79 -12
  331. package/dist/runner/src/composition/types.d.ts.map +1 -1
  332. package/dist/runner/src/index.d.ts +2 -0
  333. package/dist/runner/src/index.d.ts.map +1 -1
  334. package/dist/runner/src/manifest.d.ts +1 -1
  335. package/dist/runner/src/manifest.d.ts.map +1 -1
  336. package/dist/runner/src/mixin-resolver.d.ts +14 -15
  337. package/dist/runner/src/mixin-resolver.d.ts.map +1 -1
  338. package/dist/runner/src/serve.d.ts +6 -0
  339. package/dist/runner/src/serve.d.ts.map +1 -1
  340. package/dist/runner/src/session-builder.d.ts +35 -6
  341. package/dist/runner/src/session-builder.d.ts.map +1 -1
  342. package/dist/sdk/asset-manager.js +18 -18
  343. package/dist/sdk/bridge.js +15 -15
  344. package/dist/sdk/core.js +8 -8
  345. package/dist/sdk/flow.js +9 -9
  346. package/dist/sdk/index.js +34 -29
  347. package/dist/sdk/index.js.map +1 -1
  348. package/dist/sdk/resolver.js +9 -9
  349. package/dist/sdk/runner.js +34 -29
  350. package/dist/sdk/session.js +2 -2
  351. package/dist/sdk/types.js +1 -1
  352. package/dist/secrets/index.js +2 -2
  353. package/dist/session/index.js +2 -2
  354. package/dist/{setup-IOEZGJNC.js → setup-PYY23HGZ.js} +28 -28
  355. package/dist/{setup-IOEZGJNC.js.map → setup-PYY23HGZ.js.map} +1 -1
  356. package/dist/skills-CS7NE5TT.js +26 -0
  357. package/dist/{skills-HW6I6ZZ7.js.map → skills-CS7NE5TT.js.map} +1 -1
  358. package/dist/source-JCF6KSQN.js +41 -0
  359. package/dist/{source-OKRJT53H.js.map → source-JCF6KSQN.js.map} +1 -1
  360. package/dist/{source-manifest-publish-MILEQDRD.js → source-manifest-publish-O6P7G2M7.js} +27 -27
  361. package/dist/{source-manifest-publish-MILEQDRD.js.map → source-manifest-publish-O6P7G2M7.js.map} +1 -1
  362. package/dist/tui/index.js +34 -29
  363. package/dist/tui/index.js.map +1 -1
  364. package/dist/types/index.js +1 -1
  365. package/dist/types/manifests.js +1 -1
  366. package/dist/types/src/agent-lifecycle.d.ts +402 -0
  367. package/dist/types/src/agent-lifecycle.d.ts.map +1 -0
  368. package/dist/types/src/capabilities.d.ts +0 -4
  369. package/dist/types/src/capabilities.d.ts.map +1 -1
  370. package/dist/types/src/delivery.d.ts.map +1 -1
  371. package/dist/types/src/events.d.ts +66 -4
  372. package/dist/types/src/events.d.ts.map +1 -1
  373. package/dist/types/src/index.d.ts +3 -1
  374. package/dist/types/src/index.d.ts.map +1 -1
  375. package/dist/types/src/lifecycle.d.ts +21 -3
  376. package/dist/types/src/lifecycle.d.ts.map +1 -1
  377. package/dist/types/src/manifests/_shared.d.ts +1 -16
  378. package/dist/types/src/manifests/_shared.d.ts.map +1 -1
  379. package/dist/types/src/manifests/agent-composition.d.ts +44 -0
  380. package/dist/types/src/manifests/agent-composition.d.ts.map +1 -0
  381. package/dist/types/src/manifests/agent.d.ts +184 -6
  382. package/dist/types/src/manifests/agent.d.ts.map +1 -1
  383. package/dist/types/src/manifests/index.d.ts +6 -15
  384. package/dist/types/src/manifests/index.d.ts.map +1 -1
  385. package/dist/types/src/manifests/preset.d.ts +5 -5
  386. package/dist/types/src/version.d.ts +16 -1
  387. package/dist/types/src/version.d.ts.map +1 -1
  388. package/dist/workspace-plugin/adapters/mcp.js +26 -26
  389. package/dist/workspace-plugin/adapters/omp.js +14 -14
  390. package/dist/workspace-plugin/index.js +1 -1
  391. package/package.json +3 -1
  392. package/dist/asset-feeds-KTFUB7EX.js.map +0 -1
  393. package/dist/chunk-2D2P7HSR.js +0 -15
  394. package/dist/chunk-2D2P7HSR.js.map +0 -1
  395. package/dist/chunk-3JHFFIQ6.js.map +0 -1
  396. package/dist/chunk-5CYEWBPB.js +0 -440
  397. package/dist/chunk-5CYEWBPB.js.map +0 -1
  398. package/dist/chunk-5Y3L7XWH.js.map +0 -1
  399. package/dist/chunk-75EX5GY4.js.map +0 -1
  400. package/dist/chunk-AC2N5BRP.js.map +0 -1
  401. package/dist/chunk-DPMKI26Y.js.map +0 -1
  402. package/dist/chunk-G2O2AARG.js.map +0 -1
  403. package/dist/chunk-K2K7OF4P.js.map +0 -1
  404. package/dist/chunk-LFMX2UEF.js.map +0 -1
  405. package/dist/chunk-MMC24L2W.js.map +0 -1
  406. package/dist/chunk-N3Y43LMZ.js.map +0 -1
  407. package/dist/chunk-ORUHADS6.js.map +0 -1
  408. package/dist/chunk-P6KFWTGP.js.map +0 -1
  409. package/dist/chunk-R4G7XI7A.js.map +0 -1
  410. package/dist/chunk-TNWXGHLD.js.map +0 -1
  411. package/dist/chunk-TOSHZX4C.js.map +0 -1
  412. package/dist/chunk-WX74MVNA.js.map +0 -1
  413. package/dist/chunk-Y7UBRRKG.js.map +0 -1
  414. package/dist/chunk-YK7WJSTD.js.map +0 -1
  415. package/dist/factory-assets/bundles/workspaces-authoring/workspaces-authoring.bundle.yaml +0 -9
  416. package/dist/open-library-Z5NJU4Z5.js +0 -40
  417. package/dist/open-registry-TYUVN5SG.js +0 -32
  418. package/dist/paths-HKAXUR3W.js +0 -22
  419. package/dist/project-SVS4UMGL.js +0 -36
  420. package/dist/skills-HW6I6ZZ7.js +0 -26
  421. package/dist/source-OKRJT53H.js +0 -41
  422. package/dist/types/src/manifests/mount.d.ts +0 -21
  423. package/dist/types/src/manifests/mount.d.ts.map +0 -1
@@ -1,4 +1,4 @@
1
- import { declaresActivityLabel, stripActivityLabel } from './chunk-K2K7OF4P.js';
1
+ import { declaresActivityLabel, stripActivityLabel } from './chunk-DMLDYFDS.js';
2
2
  import { randomUUID } from 'crypto';
3
3
 
4
4
  async function dispatchCapability(hooks, name, input, onBackgroundError = () => {
@@ -52,5 +52,5 @@ function filterRenderCapabilities(caps) {
52
52
  }
53
53
 
54
54
  export { dispatchCapability, filterRenderCapabilities, renderFallback };
55
- //# sourceMappingURL=chunk-BNUZEYC3.js.map
56
- //# sourceMappingURL=chunk-BNUZEYC3.js.map
55
+ //# sourceMappingURL=chunk-NARITJS2.js.map
56
+ //# sourceMappingURL=chunk-NARITJS2.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../bridge/src/capability-dispatch.ts"],"names":[],"mappings":";;;AAgFA,eAAsB,kBAAA,CACpB,KAAA,EACA,IAAA,EACA,KAAA,EACA,oBAA4D,MAAM;AAAC,CAAA,EACnE,MAAA,EACmC;AACnC,EAAA,MAAA,EAAQ,cAAA,EAAe;AACvB,EAAA,MAAM,SAAS,UAAA,EAAW;AAC1B,EAAA,MAAM,GAAA,GAAM,KAAA,CAAM,OAAA,CAAQ,IAAI,CAAA;AAI9B,EAAA,IAAI,CAAC,qBAAA,CAAsB,GAAA,EAAK,WAAW,CAAA,EAAG,KAAA,GAAQ,mBAAmB,KAAK,CAAA;AAK9E,EAAA,IAAI,GAAA,EAAK,MAAA,IAAU,KAAA,CAAM,UAAA,EAAY;AACnC,IAAA,KAAA,CAAM,UAAA,CAAW;AAAA,MACf,IAAA,EAAM,gBAAA;AAAA,MACN,cAAA,EAAgB,IAAA;AAAA,MAChB,KAAA,EAAO,KAAA;AAAA,MACP;AAAA,KACD,CAAA;AACD,IAAA,IAAI,GAAA,CAAI,MAAA,CAAO,QAAA,IAAY,KAAA,CAAM,QAAA,EAAU;AACzC,MAAA,MAAM,QAAA,GAAW,cAAA,CAAe,GAAA,CAAI,MAAA,CAAO,UAAU,KAAK,CAAA;AAC1D,MAAA,KAAA,CAAM,SAAS,QAAQ,CAAA;AAAA,IACzB;AAAA,EACF;AAEA,EAAA,IAAI,KAAK,aAAA,EAAe;AAEtB,IAAA,KAAK,KAAA,CAAM,MAAA,CAAO,IAAA,EAAM,KAAA,EAAO,MAAA,E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rD;AACA,EAAA,OAAO,OAAA;AACT;AAYO,SAAS,yBAAyB,IAAA,EAAkC;AACzE,EAAA,OAAO,KAAK,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,WAAW,MAAS,CAAA;AAClD","file":"chunk-BNUZEYC3.js","sourcesContent":["/**\n * Capability dispatch helpers for bridge drivers.\n *\n * The runner builds a {@link BridgeCapabilityHooks} bundle from its\n * `CapabilityRegistry` and threads it through `AgentConfig.capabilities`.\n * Drivers consume the bundle via these helpers without taking a runtime\n * dependency on `@skaile/workspaces/runner` (which would create a circular dep).\n *\n * Three behaviours are layered into a single dispatch path:\n *\n * 1. **Standard tool call** — the LLM invokes a capability; the bridge calls\n * `hooks.invoke()`, awaits the result, and returns it to the LLM.\n * 2. **Fire-and-forget** — when the resolved Capability has `fireAndForget`\n * set, the bridge resolves to `{}` immediately and runs the handler in\n * the background. Background errors are logged but never surfaced to the\n * LLM since the call is already settled.\n * 3. **Render capability** — when the resolved Capability has a non-undefined\n * `render`, the bridge emits `RenderInvokedEvent` to the runner via\n * `hooks.emitRender` and (when `render.fallback` is set) a parallel text\n * event via `hooks.emitText` with simple `{{prop}}` substitution. The\n * placeholder convention follows the v2 spec — top-level keys of `props`\n * only, with optional dotted-path traversal (`{{user.name}}`). The legacy\n * AAP `{{props.x}}` form was retired in Phase 6.\n *\n * @category Capabilities\n * @since 2.0.0\n */\nimport { randomUUID } from \"node:crypto\";\nimport {\n type Capability,\n declaresActivityLabel,\n stripActivityLabel,\n} from \"@skaile/workspaces/types\";\nimport type { BridgeCapabilityHooks } from \"./types.js\";\n\n/**\n * Result of a capability dispatch returned by {@link dispatchCapability}.\n *\n * The bridge feeds `{ result }` back to the LLM tool-use response. For\n * fire-and-forget capabilities `result` is always `{}` and `background` is `true`.\n *\n * @docLink packages/bridge/concepts#capability-dispatch-result\n */\nexport interface CapabilityDispatchResult {\n /** Value returned to the LLM. `{}` for fire-and-forget capabilities. */\n result: unknown;\n /** True when the handler is still running in the background (fire-and-forget). */\n background: boolean;\n /** The per-dispatch call id minted for this invocation (see {@link dispatchCapability}). */\n callId: string;\n}\n\n/**\n * Run a capability invocation through the runner-provided hooks, applying\n * render-event emission and fire-and-forget short-circuit.\n *\n * The result is always shaped for direct return to the LLM. For\n * fire-and-forget capabilities the background promise is fired and any error\n * is logged through `onBackgroundError` (defaulting to a no-op). For all\n * other capabilities the handler is awaited; errors propagate as a rejection\n * so the driver can surface them as tool errors.\n *\n * **Dispatch call id.** Every dispatch mints a fresh `randomUUID()` and uses it\n * for `render_invoked.callId`, `hooks.invoke`'s `callId` and — for client\n * capabilities — the outbound `capability_invoked.callId`. It is deliberately\n * NOT the driver's tool-call id: those are only as unique as the model\n * provider makes them (some harnesses emit `call_0` on every turn), and the\n * runner's pending-call map is keyed by this id, so a late `capability_result`\n * for a timed-out call must never be able to resolve a later call that reused\n * the provider's id. Drivers map results back to their tool calls through the\n * returned value, never through this id.\n *\n * @param hooks - Capability dispatch bundle from `AgentConfig.capabilities`.\n * @param name - Registered capability name.\n * @param input - Raw tool input from the LLM.\n * @param onBackgroundError - Optional error handler for fire-and-forget failures; receives the dispatch call id.\n * @param signal - Optional abort signal forwarded to the handler.\n * @returns Resolved dispatch result with the LLM-facing value, background flag and dispatch call id.\n * @docLink packages/bridge/concepts#dispatch-capability\n */\nexport async function dispatchCapability(\n hooks: BridgeCapabilityHooks,\n name: string,\n input: unknown,\n onBackgroundError: (err: unknown, callId: string) => void = () => {},\n signal?: AbortSignal,\n): Promise<CapabilityDispatchResult> {\n signal?.throwIfAborted();\n const callId = randomUUID();\n const cap = hooks.resolve(name);\n // The advertised `activity_label` is for the UI only. Strip it before render\n // props and the handler: strict inputs would reject it and external MCP\n // passthrough would forward it. Kept when the capability declares it itself.\n if (!declaresActivityLabel(cap?.inputSchema)) input = stripActivityLabel(input);\n\n // Render emission happens before invocation so clients see the props the\n // LLM passed in even if the handler errors. The runner's gateway forwards\n // the event over the transport.\n if (cap?.render && hooks.emitRender) {\n hooks.emitRender({\n type: \"render_invoked\",\n capabilityName: name,\n props: input,\n callId,\n });\n if (cap.render.fallback && hooks.emitText) {\n const fallback = renderFallback(cap.render.fallback, input);\n hooks.emitText(fallback);\n }\n }\n\n if (cap?.fireAndForget) {\n // Resolve immediately; run handler in background.\n void hooks.invoke(name, input, signal, callId).catch((err) => onBackgroundError(err, callId));\n return { result: {}, background: true, callId };\n }\n\n const result = await hooks.invoke(name, input, signal, callId);\n return { result, background: false, callId };\n}\n\n/**\n * Substitute `{{prop}}` placeholders inside a fallback template using the\n * input record. Top-level keys of `props` resolve directly\n * (`{{name}}` → `props.name`); dotted paths traverse nested records\n * (`{{user.name}}` → `props.user.name`). Missing keys collapse to an empty\n * string; non-record inputs collapse all placeholders.\n *\n * The convention is fixed by the v2 spec (§1, `RenderSpec.fallback`). The\n * legacy AAP form `{{props.x}}` is no longer accepted — author fallbacks\n * with bare keys.\n *\n * Intentionally minimal — full template engines belong in the platform's\n * render layer, not the bridge.\n *\n * @param template - Fallback string from `RenderSpec.fallback` with `{{key}}` placeholders.\n * @param input - LLM tool input object; non-object values collapse all placeholders.\n * @returns Template with all resolvable placeholders replaced.\n * @docLink packages/bridge/concepts#render-fallback\n */\nexport function renderFallback(template: string, input: unknown): string {\n if (!input || typeof input !== \"object\") {\n return template.replace(/\\{\\{\\s*[\\w$.]+\\s*\\}\\}/g, \"\");\n }\n const props = input as Record<string, unknown>;\n return template.replace(/\\{\\{\\s*([\\w$.]+)\\s*\\}\\}/g, (_match, path: string) => {\n const value = readPath(props, path);\n return value === undefined || value === null ? \"\" : String(value);\n });\n}\n\nfunction readPath(obj: Record<string, unknown>, path: string): unknown {\n const parts = path.split(\".\");\n let current: unknown = obj;\n for (const part of parts) {\n if (current === null || current === undefined || typeof current !== \"object\") {\n return undefined;\n }\n current = (current as Record<string, unknown>)[part];\n }\n return current;\n}\n\n/**\n * Filter a capability list to those marked as render-capable (having a `render` spec).\n *\n * Used by drivers that emit a separate render manifest at registration time.\n * Currently unused in production drivers; reserved for future phases.\n *\n * @param caps - Full capability list to filter.\n * @returns Subset of capabilities with a non-undefined `render` property.\n * @docLink packages/bridge/concepts#filter-render-capabilities\n */\nexport function filterRenderCapabilities(caps: Capability[]): Capability[] {\n return caps.filter((c) => c.render !== undefined);\n}\n"]}
1
+ {"version":3,"sources":["../bridge/src/capability-dispatch.ts"],"names":[],"mappings":";;;AAgFA,eAAsB,kBAAA,CACpB,KAAA,EACA,IAAA,EACA,KAAA,EACA,oBAA4D,MAAM;AAAC,CAAA,EACnE,MAAA,EACmC;AACnC,EAAA,MAAA,EAAQ,cAAA,EAAe;AACvB,EAAA,MAAM,SAAS,UAAA,EAAW;AAC1B,EAAA,MAAM,GAAA,GAAM,KAAA,CAAM,OAAA,CAAQ,IAAI,CAAA;AAI9B,EAAA,IAAI,CAAC,qBAAA,CAAsB,GAAA,EAAK,WAAW,CAAA,EAAG,KAAA,GAAQ,mBAAmB,KAAK,CAAA;AAK9E,EAAA,IAAI,GAAA,EAAK,MAAA,IAAU,KAAA,CAAM,UAAA,EAAY;AACnC,IAAA,KAAA,CAAM,UAAA,CAAW;AAAA,MACf,IAAA,EAAM,gBAAA;AAAA,MACN,cAAA,EAAgB,IAAA;AAAA,MAChB,KAAA,EAAO,KAAA;AAAA,MACP;AAAA,KACD,CAAA;AACD,IAAA,IAAI,GAAA,CAAI,MAAA,CAAO,QAAA,IAAY,KAAA,CAAM,QAAA,EAAU;AACzC,MAAA,MAAM,QAAA,GAAW,cAAA,CAAe,GAAA,CAAI,MAAA,CAAO,UAAU,KAAK,CAAA;AAC1D,MAAA,KAAA,CAAM,SAAS,QAAQ,CAAA;AAAA,IACzB;AAAA,EACF;AAEA,EAAA,IAAI,KAAK,aAAA,EAAe;AAEtB,IAAA,KAAK,KAAA,CAAM,MAAA,CAAO,IAAA,EAAM,KAAA,EAAO,MAAA,EAAQ,MAAM,CAAA,CAAE,KAAA,CAAM,CAAC,GAAA,KAAQ,iBAAA,CAAkB,GAAA,EAAK,MA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AAK,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,WAAW,MAAS,CAAA;AAClD","file":"chunk-NARITJS2.js","sourcesContent":["/**\n * Capability dispatch helpers for bridge drivers.\n *\n * The runner builds a {@link BridgeCapabilityHooks} bundle from its\n * `CapabilityRegistry` and threads it through `AgentConfig.capabilities`.\n * Drivers consume the bundle via these helpers without taking a runtime\n * dependency on `@skaile/workspaces/runner` (which would create a circular dep).\n *\n * Three behaviours are layered into a single dispatch path:\n *\n * 1. **Standard tool call** — the LLM invokes a capability; the bridge calls\n * `hooks.invoke()`, awaits the result, and returns it to the LLM.\n * 2. **Fire-and-forget** — when the resolved Capability has `fireAndForget`\n * set, the bridge resolves to `{}` immediately and runs the handler in\n * the background. Background errors are logged but never surfaced to the\n * LLM since the call is already settled.\n * 3. **Render capability** — when the resolved Capability has a non-undefined\n * `render`, the bridge emits `RenderInvokedEvent` to the runner via\n * `hooks.emitRender` and (when `render.fallback` is set) a parallel text\n * event via `hooks.emitText` with simple `{{prop}}` substitution. The\n * placeholder convention follows the v2 spec — top-level keys of `props`\n * only, with optional dotted-path traversal (`{{user.name}}`). The legacy\n * AAP `{{props.x}}` form was retired in Phase 6.\n *\n * @category Capabilities\n * @since 2.0.0\n */\nimport { randomUUID } from \"node:crypto\";\nimport {\n type Capability,\n declaresActivityLabel,\n stripActivityLabel,\n} from \"@skaile/workspaces/types\";\nimport type { BridgeCapabilityHooks } from \"./types.js\";\n\n/**\n * Result of a capability dispatch returned by {@link dispatchCapability}.\n *\n * The bridge feeds `{ result }` back to the LLM tool-use response. For\n * fire-and-forget capabilities `result` is always `{}` and `background` is `true`.\n *\n * @docLink packages/bridge/concepts#capability-dispatch-result\n */\nexport interface CapabilityDispatchResult {\n /** Value returned to the LLM. `{}` for fire-and-forget capabilities. */\n result: unknown;\n /** True when the handler is still running in the background (fire-and-forget). */\n background: boolean;\n /** The per-dispatch call id minted for this invocation (see {@link dispatchCapability}). */\n callId: string;\n}\n\n/**\n * Run a capability invocation through the runner-provided hooks, applying\n * render-event emission and fire-and-forget short-circuit.\n *\n * The result is always shaped for direct return to the LLM. For\n * fire-and-forget capabilities the background promise is fired and any error\n * is logged through `onBackgroundError` (defaulting to a no-op). For all\n * other capabilities the handler is awaited; errors propagate as a rejection\n * so the driver can surface them as tool errors.\n *\n * **Dispatch call id.** Every dispatch mints a fresh `randomUUID()` and uses it\n * for `render_invoked.callId`, `hooks.invoke`'s `callId` and — for client\n * capabilities — the outbound `capability_invoked.callId`. It is deliberately\n * NOT the driver's tool-call id: those are only as unique as the model\n * provider makes them (some harnesses emit `call_0` on every turn), and the\n * runner's pending-call map is keyed by this id, so a late `capability_result`\n * for a timed-out call must never be able to resolve a later call that reused\n * the provider's id. Drivers map results back to their tool calls through the\n * returned value, never through this id.\n *\n * @param hooks - Capability dispatch bundle from `AgentConfig.capabilities`.\n * @param name - Registered capability name.\n * @param input - Raw tool input from the LLM.\n * @param onBackgroundError - Optional error handler for fire-and-forget failures; receives the dispatch call id.\n * @param signal - Optional abort signal forwarded to the handler.\n * @returns Resolved dispatch result with the LLM-facing value, background flag and dispatch call id.\n * @docLink packages/bridge/concepts#dispatch-capability\n */\nexport async function dispatchCapability(\n hooks: BridgeCapabilityHooks,\n name: string,\n input: unknown,\n onBackgroundError: (err: unknown, callId: string) => void = () => {},\n signal?: AbortSignal,\n): Promise<CapabilityDispatchResult> {\n signal?.throwIfAborted();\n const callId = randomUUID();\n const cap = hooks.resolve(name);\n // The advertised `activity_label` is for the UI only. Strip it before render\n // props and the handler: strict inputs would reject it and external MCP\n // passthrough would forward it. Kept when the capability declares it itself.\n if (!declaresActivityLabel(cap?.inputSchema)) input = stripActivityLabel(input);\n\n // Render emission happens before invocation so clients see the props the\n // LLM passed in even if the handler errors. The runner's gateway forwards\n // the event over the transport.\n if (cap?.render && hooks.emitRender) {\n hooks.emitRender({\n type: \"render_invoked\",\n capabilityName: name,\n props: input,\n callId,\n });\n if (cap.render.fallback && hooks.emitText) {\n const fallback = renderFallback(cap.render.fallback, input);\n hooks.emitText(fallback);\n }\n }\n\n if (cap?.fireAndForget) {\n // Resolve immediately; run handler in background.\n void hooks.invoke(name, input, signal, callId).catch((err) => onBackgroundError(err, callId));\n return { result: {}, background: true, callId };\n }\n\n const result = await hooks.invoke(name, input, signal, callId);\n return { result, background: false, callId };\n}\n\n/**\n * Substitute `{{prop}}` placeholders inside a fallback template using the\n * input record. Top-level keys of `props` resolve directly\n * (`{{name}}` → `props.name`); dotted paths traverse nested records\n * (`{{user.name}}` → `props.user.name`). Missing keys collapse to an empty\n * string; non-record inputs collapse all placeholders.\n *\n * The convention is fixed by the v2 spec (§1, `RenderSpec.fallback`). The\n * legacy AAP form `{{props.x}}` is no longer accepted — author fallbacks\n * with bare keys.\n *\n * Intentionally minimal — full template engines belong in the platform's\n * render layer, not the bridge.\n *\n * @param template - Fallback string from `RenderSpec.fallback` with `{{key}}` placeholders.\n * @param input - LLM tool input object; non-object values collapse all placeholders.\n * @returns Template with all resolvable placeholders replaced.\n * @docLink packages/bridge/concepts#render-fallback\n */\nexport function renderFallback(template: string, input: unknown): string {\n if (!input || typeof input !== \"object\") {\n return template.replace(/\\{\\{\\s*[\\w$.]+\\s*\\}\\}/g, \"\");\n }\n const props = input as Record<string, unknown>;\n return template.replace(/\\{\\{\\s*([\\w$.]+)\\s*\\}\\}/g, (_match, path: string) => {\n const value = readPath(props, path);\n return value === undefined || value === null ? \"\" : String(value);\n });\n}\n\nfunction readPath(obj: Record<string, unknown>, path: string): unknown {\n const parts = path.split(\".\");\n let current: unknown = obj;\n for (const part of parts) {\n if (current === null || current === undefined || typeof current !== \"object\") {\n return undefined;\n }\n current = (current as Record<string, unknown>)[part];\n }\n return current;\n}\n\n/**\n * Filter a capability list to those marked as render-capable (having a `render` spec).\n *\n * Used by drivers that emit a separate render manifest at registration time.\n * Currently unused in production drivers; reserved for future phases.\n *\n * @param caps - Full capability list to filter.\n * @returns Subset of capabilities with a non-undefined `render` property.\n * @docLink packages/bridge/concepts#filter-render-capabilities\n */\nexport function filterRenderCapabilities(caps: Capability[]): Capability[] {\n return caps.filter((c) => c.render !== undefined);\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { defaultLibraryDir } from './chunk-3JHFFIQ6.js';
2
- import { factoryAssetRoots } from './chunk-YK7WJSTD.js';
1
+ import { defaultLibraryDir } from './chunk-TZCQ7ZWQ.js';
2
+ import { factoryAssetRoots } from './chunk-BF33SCLY.js';
3
3
  import fs from 'fs';
4
4
  import path from 'path';
5
5
  import { fileURLToPath } from 'url';
@@ -19,5 +19,5 @@ var MONOREPO_ROOT = findMonorepoRoot(__ownDir);
19
19
  var AI_RESOURCES = factoryAssetRoots()[0] ?? defaultLibraryDir();
20
20
 
21
21
  export { AI_RESOURCES, MONOREPO_ROOT };
22
- //# sourceMappingURL=chunk-Y4QWHIHB.js.map
23
- //# sourceMappingURL=chunk-Y4QWHIHB.js.map
22
+ //# sourceMappingURL=chunk-OGLDAJFL.js.map
23
+ //# sourceMappingURL=chunk-OGLDAJFL.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../cli/src/paths.ts"],"names":[],"mappings":";;;;;;AAeA,IAAM,WAAW,IAAA,CAAK,OAAA,CAAQ,aAAA,CAAc,MAAA,CAAA,IAAA,CAAY,GAAG,CAAC,CAAA;AAW5D,SAAS,iBAAiB,IAAA,EAA6B;AACrD,EAAA,IAAI,GAAA,GAAM,IAAA;AACV,EAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,CAAA,EAAG,CAAA,EAAA,EAAK;AAC1B,IAAA,IAAI,EAAA,CAAG,WAAW,IAAA,CAAK,IAAA,CAAK,KAAK,YAAY,CAAC,GAAG,OAAO,GAAA;AACxD,IAAA,MAAM,MAAA,GAAS,IAAA,CAAK,OAAA,CAAQ,GAAG,CAAA;AAC/B,IAAA,IAAI,WAAW,GAAA,EAAK;AACpB,IAAA,GAAA,GAAM,MAAA;AAAA,EACR;AACA,EAAA,OAAO,IAAA;AACT;AAYO,IAAM,aAAA,GAA+B,iBAAiB,QAAQ;AAc9D,IAAM,YAAA,GAAuB,iBAAA,EAAkB,CAAE,CAAC,KAAK,iBAAA","file":"chunk-Y4QWHIHB.js","sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { defaultLibraryDir, factoryAssetRoots } from \"@skaile/workspaces/core\";\n\n/**\n * The content-root policy lives in `@skaile/workspaces/core` so the flow\n * connector's resolution surfaces can reach it too — `factory-assets → cli`\n * would be a module cycle. Re-exported here because this module is the CLI's\n * documented path surface and every CLI caller imports it from here.\n *\n * @docLink cli/dev-guide#paths\n */\nexport { aiResourceRoots } from \"@skaile/workspaces/core\";\n\nconst __ownDir = path.dirname(fileURLToPath(import.meta.url));\n\n/**\n * Walk up from `from` looking for the monorepo marker (`biome.json`, the\n * repo-root shared tooling config). Returns the matching directory or `null`\n * when none is found within eight levels — the latter is the typical case when\n * `@skaile/workspaces` has been installed via `npm i` without a skaile-dev\n * workspace context. Used only to gate dev-only commands (e.g.\n * `serve --compile-test`); first-party content is located via\n * {@link aiResourceRoots}, not this.\n */\nfunction findMonorepoRoot(from: string): string | null {\n let dir = from;\n for (let i = 0; i < 8; i++) {\n if (fs.existsSync(path.join(dir, \"biome.json\"))) return dir;\n const parent = path.dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n return null;\n}\n\n/**\n * Absolute path to the monorepo root, or `null` when the CLI is running\n * outside the skaile-dev workspace (typical for `npm i -g` installs).\n *\n * Consumers that only make sense inside the workspace (e.g.\n * `skaile serve --compile-test`) MUST check for `null` and report a\n * \"monorepo-only feature\" error before proceeding.\n *\n * @docLink cli/dev-guide#paths\n */\nexport const MONOREPO_ROOT: string | null = findMonorepoRoot(__ownDir);\n\n/**\n * Default content root used by path display and the `validate` command.\n *\n * The primary first-party `factory-assets/` root resolved through the shared\n * `factoryAssetRoots()` helper — the `SKAILE_FACTORY_ASSETS_DIR` override when\n * set, else the in-repo source during dev / bundled `dist/factory-assets/` after\n * `npm i`. Falls back to `$SKAILE_HOME/libraries/` (`~/.skaile/libraries/`) — the user-library directory\n * managed by `skaile library add` — when the package cannot be located.\n * Consumers `fs.existsSync` first and degrade to \"no skills / flows discovered\".\n *\n * @docLink cli/dev-guide#paths\n */\nexport const AI_RESOURCES: string = factoryAssetRoots()[0] ?? defaultLibraryDir();\n"]}
1
+ {"version":3,"sources":["../cli/src/paths.ts"],"names":[],"mappings":";;;;;;AAeA,IAAM,WAAW,IAAA,CAAK,OAAA,CAAQ,aAAA,CAAc,MAAA,CAAA,IAAA,CAAY,GAAG,CAAC,CAAA;AAW5D,SAAS,iBAAiB,IAAA,EAA6B;AACrD,EAAA,IAAI,GAAA,GAAM,IAAA;AACV,EAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,CAAA,EAAG,CAAA,EAAA,EAAK;AAC1B,IAAA,IAAI,EAAA,CAAG,WAAW,IAAA,CAAK,IAAA,CAAK,KAAK,YAAY,CAAC,GAAG,OAAO,GAAA;AACxD,IAAA,MAAM,MAAA,GAAS,IAAA,CAAK,OAAA,CAAQ,GAAG,CAAA;AAC/B,IAAA,IAAI,WAAW,GAAA,EAAK;AACpB,IAAA,GAAA,GAAM,MAAA;AAAA,EACR;AACA,EAAA,OAAO,IAAA;AACT;AAYO,IAAM,aAAA,GAA+B,iBAAiB,QAAQ;AAc9D,IAAM,YAAA,GAAuB,iBAAA,EAAkB,CAAE,CAAC,KAAK,iBAAA","file":"chunk-OGLDAJFL.js","sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { defaultLibraryDir, factoryAssetRoots } from \"@skaile/workspaces/core\";\n\n/**\n * The content-root policy lives in `@skaile/workspaces/core` so the flow\n * connector's resolution surfaces can reach it too — `factory-assets → cli`\n * would be a module cycle. Re-exported here because this module is the CLI's\n * documented path surface and every CLI caller imports it from here.\n *\n * @docLink cli/dev-guide#paths\n */\nexport { aiResourceRoots } from \"@skaile/workspaces/core\";\n\nconst __ownDir = path.dirname(fileURLToPath(import.meta.url));\n\n/**\n * Walk up from `from` looking for the monorepo marker (`biome.json`, the\n * repo-root shared tooling config). Returns the matching directory or `null`\n * when none is found within eight levels — the latter is the typical case when\n * `@skaile/workspaces` has been installed via `npm i` without a skaile-dev\n * workspace context. Used only to gate dev-only commands (e.g.\n * `serve --compile-test`); first-party content is located via\n * {@link aiResourceRoots}, not this.\n */\nfunction findMonorepoRoot(from: string): string | null {\n let dir = from;\n for (let i = 0; i < 8; i++) {\n if (fs.existsSync(path.join(dir, \"biome.json\"))) return dir;\n const parent = path.dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n return null;\n}\n\n/**\n * Absolute path to the monorepo root, or `null` when the CLI is running\n * outside the skaile-dev workspace (typical for `npm i -g` installs).\n *\n * Consumers that only make sense inside the workspace (e.g.\n * `skaile serve --compile-test`) MUST check for `null` and report a\n * \"monorepo-only feature\" error before proceeding.\n *\n * @docLink cli/dev-guide#paths\n */\nexport const MONOREPO_ROOT: string | null = findMonorepoRoot(__ownDir);\n\n/**\n * Default content root used by path display and the `validate` command.\n *\n * The primary first-party `factory-assets/` root resolved through the shared\n * `factoryAssetRoots()` helper — the `SKAILE_FACTORY_ASSETS_DIR` override when\n * set, else the in-repo source during dev / bundled `dist/factory-assets/` after\n * `npm i`. Falls back to `$SKAILE_HOME/libraries/` (`~/.skaile/libraries/`) — the user-library directory\n * managed by `skaile library add` — when the package cannot be located.\n * Consumers `fs.existsSync` first and degrade to \"no skills / flows discovered\".\n *\n * @docLink cli/dev-guide#paths\n */\nexport const AI_RESOURCES: string = factoryAssetRoots()[0] ?? defaultLibraryDir();\n"]}
@@ -0,0 +1,17 @@
1
+ import { flowKindProvider } from './chunk-AOAZCSDI.js';
2
+ import { knowledgeKindProvider } from './chunk-MX3UQXLU.js';
3
+ import { createDefaultKindRegistry } from './chunk-XOGG7VDZ.js';
4
+
5
+ // cli/src/open-registry.ts
6
+ var registry;
7
+ function getKindRegistry() {
8
+ registry ??= createDefaultKindRegistry([flowKindProvider, knowledgeKindProvider]);
9
+ return registry;
10
+ }
11
+ function getKnownKinds() {
12
+ return new Set(getKindRegistry().getAllKinds());
13
+ }
14
+
15
+ export { getKindRegistry, getKnownKinds };
16
+ //# sourceMappingURL=chunk-OLLAQLFJ.js.map
17
+ //# sourceMappingURL=chunk-OLLAQLFJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../cli/src/open-registry.ts"],"names":[],"mappings":";;;;;AAgBA,IAAI,QAAA;AAQG,SAAS,eAAA,GAAqC;AACnD,EAAA,QAAA,KAAa,yBAAA,CAA0B,CAAC,gBAAA,EAAkB,qBAAqB,CAAC,CAAA;AAChF,EAAA,OAAO,QAAA;AACT;AAGO,SAAS,aAAA,GAAqC;AACnD,EAAA,OAAO,IAAI,GAAA,CAAI,eAAA,EAAgB,CAAE,aAAa,CAAA;AAChD","file":"chunk-OLLAQLFJ.js","sourcesContent":["/**\n * open-registry.ts — the CLI's one AssetKindRegistry.\n *\n * The provider registry is the only authority on asset kinds. The CLI builds it\n * once per process with all built-in providers (from @skaile/workspaces/discovery)\n * plus the extension kinds (flow from\n * @skaile/workspaces/factory-assets/connectors/flow/engine, knowledge from\n * @skaile/workspaces/library) and hands the same instance to every consumer\n * (catalog sources, the installer, validation, composition).\n */\n\nimport type { AssetKindRegistry } from \"@skaile/workspaces/discovery\";\nimport { createDefaultKindRegistry } from \"@skaile/workspaces/discovery\";\nimport { flowKindProvider } from \"@skaile/workspaces/factory-assets/connectors/flow/engine\";\nimport { knowledgeKindProvider } from \"@skaile/workspaces/library\";\n\nlet registry: AssetKindRegistry | undefined;\n\n/**\n * The process-wide, fully-configured AssetKindRegistry.\n *\n * Registers every built-in kind plus flow and knowledge. Built lazily on first\n * call; every later call returns the same instance.\n */\nexport function getKindRegistry(): AssetKindRegistry {\n registry ??= createDefaultKindRegistry([flowKindProvider, knowledgeKindProvider]);\n return registry;\n}\n\n/** Registered kind names as a set — the `knownKinds` argument of the manifest scanners. */\nexport function getKnownKinds(): ReadonlySet<string> {\n return new Set(getKindRegistry().getAllKinds());\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { parseDep, isValidAssetName, slugifyAssetName } from './chunk-WX74MVNA.js';
1
+ import { parseDep, isValidAssetName, slugifyAssetName } from './chunk-AO7VJ6G6.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';
@@ -76,50 +76,54 @@ function parseRequires(meta) {
76
76
  const list = typeof raw === "string" ? raw.split(",").map((s) => s.trim()) : Array.isArray(raw) ? raw : [];
77
77
  return list.filter(Boolean).map(parseDep);
78
78
  }
79
- function collectAgentDeps(raw, out) {
79
+ function collectComposeRefs(raw, out) {
80
80
  if (!Array.isArray(raw)) return;
81
- for (const d of raw) {
82
- if (typeof d === "object" && d !== null && "name" in d) {
83
- out.push({ kind: "agent", name: String(d.name) });
84
- }
85
- }
86
- }
87
- function collectStringRefs(raw, kind, out) {
88
- if (!Array.isArray(raw)) return;
89
- for (const r of raw) {
90
- if (typeof r === "string" && r) out.push({ kind, name: r });
91
- }
92
- }
93
- function collectMixinRefs(raw, defaultKind, out) {
94
- if (!Array.isArray(raw)) return;
95
- for (const r of raw) {
96
- if (typeof r !== "string" || !r) continue;
97
- if (r.startsWith(".") || r.startsWith("/")) continue;
98
- const normalized = r.includes(":") ? r : `${defaultKind}:${r}`;
81
+ for (const item of raw) {
82
+ if (typeof item !== "object" || item === null) continue;
83
+ const { kind: itemKind, ref } = item;
84
+ if (typeof ref !== "string" || !ref) continue;
85
+ if (ref.startsWith(".") || ref.startsWith("/") || ref.includes("://")) continue;
86
+ if (typeof itemKind !== "string" || !itemKind) continue;
87
+ const normalized = ref.includes(":") ? ref : `${itemKind}:${ref}`;
99
88
  const colonIdx = normalized.indexOf(":");
100
89
  const kind = normalized.slice(0, colonIdx).trim();
101
90
  let rest = normalized.slice(colonIdx + 1).trim();
102
91
  const hashIdx = rest.indexOf("#");
103
92
  if (hashIdx !== -1) rest = rest.slice(0, hashIdx).trim();
104
- let name;
105
93
  if (rest.startsWith("@")) {
106
94
  const slashIdx = rest.indexOf("/");
107
- name = slashIdx !== -1 ? rest.slice(slashIdx + 1).trim() : "";
108
- } else {
109
- const atIdx = rest.indexOf("@");
110
- name = atIdx !== -1 ? rest.slice(0, atIdx).trim() : rest;
95
+ rest = slashIdx !== -1 ? rest.slice(slashIdx + 1).trim() : "";
111
96
  }
97
+ const atIdx = rest.indexOf("@");
98
+ const name = atIdx !== -1 ? rest.slice(0, atIdx).trim() : rest;
112
99
  if (name) out.push({ kind, name });
113
100
  }
114
101
  }
115
- async function fromSkillMd(filePath, repoName) {
116
- return fromSkillMdContent(await readManifestFile(filePath), repoName, filePath);
102
+ var ManifestKindError = class extends Error {
103
+ constructor(filePath, kind) {
104
+ super(`${filePath}: unknown asset kind "${kind}" in frontmatter \`type:\``);
105
+ this.filePath = filePath;
106
+ this.kind = kind;
107
+ this.name = "ManifestKindError";
108
+ }
109
+ filePath;
110
+ kind;
111
+ };
112
+ function manifestKindDiagnostic(err) {
113
+ return {
114
+ code: "unknown_asset_kind",
115
+ severity: "error",
116
+ message: `${err.filePath}: asset kind "${err.kind}" is not registered`,
117
+ path: err.filePath
118
+ };
119
+ }
120
+ async function fromSkillMd(filePath, repoName, knownKinds) {
121
+ return fromSkillMdContent(await readManifestFile(filePath), repoName, filePath, knownKinds);
117
122
  }
118
- function fromSkillMdContent(content, repoName, filePath) {
123
+ function fromSkillMdContent(content, repoName, filePath, knownKinds) {
119
124
  const { data: meta } = parseFrontmatter(content);
120
- let kind = String(meta.type ?? "skill");
121
- if (!["skill", "agent", "prompt", "persona", "ruleset", "knowledge"].includes(kind))
122
- kind = "skill";
125
+ const kind = meta.type === void 0 ? "skill" : String(meta.type);
126
+ if (meta.type !== void 0 && !knownKinds.has(kind)) throw new ManifestKindError(filePath, kind);
123
127
  return {
124
128
  name: String(meta.name ?? basename(dirname(filePath))),
125
129
  kind,
@@ -157,17 +161,7 @@ function fromAgentYamlContent(content, repoName, filePath) {
157
161
  } catch {
158
162
  }
159
163
  const requires = [];
160
- collectAgentDeps(meta.requires, requires);
161
- collectAgentDeps(meta.dependencies, requires);
162
- collectStringRefs(meta.abilities, "skill", requires);
163
- collectStringRefs(meta.contracts, "contract", requires);
164
- for (const [field, defaultKind] of [
165
- ["persona", "persona"],
166
- ["rules", "ruleset"],
167
- ["knowledge", "knowledge"]
168
- ]) {
169
- collectMixinRefs(meta[field], defaultKind, requires);
170
- }
164
+ collectComposeRefs(meta.composes, requires);
171
165
  return {
172
166
  name: String(meta.name ?? basename(dirname(filePath))),
173
167
  kind: "agent",
@@ -217,40 +211,56 @@ function fromFlowYamlContent(content, repoName, filePath) {
217
211
  dependencies: []
218
212
  };
219
213
  }
220
- async function fromBundleYaml(filePath, repoName) {
221
- return fromBundleYamlContent(await readManifestFileOrEmpty(filePath), repoName, filePath);
214
+ function presetItemRefs(items) {
215
+ const refs = /* @__PURE__ */ new Set();
216
+ let skipped = 0;
217
+ if (!Array.isArray(items)) return { refs: [], skipped };
218
+ for (const raw of items) {
219
+ if (raw === null || typeof raw !== "object") continue;
220
+ const item = raw;
221
+ const ref = typeof item.ref === "string" ? item.ref.trim() : "";
222
+ if (!ref) continue;
223
+ const hasPlaceholders = Array.isArray(item.placeholders) && item.placeholders.length > 0;
224
+ const declaresInstance = typeof item.id === "string" && (ref.startsWith("connector:") || ref.startsWith("mcp:"));
225
+ if (ref.startsWith("library://") || ref.startsWith("#") || hasPlaceholders || declaresInstance) {
226
+ skipped++;
227
+ continue;
228
+ }
229
+ refs.add(ref);
230
+ }
231
+ return { refs: [...refs], skipped };
232
+ }
233
+ async function fromPresetYaml(filePath, repoName) {
234
+ return fromPresetYamlContent(await readManifestFileOrEmpty(filePath), repoName, filePath);
222
235
  }
223
- function fromBundleYamlContent(content, repoName, filePath) {
236
+ function fromPresetYamlContent(content, repoName, filePath) {
224
237
  let meta = {};
225
238
  try {
226
239
  meta = parse(content) ?? {};
227
240
  } catch {
228
241
  }
229
- const name = String(meta.name ?? basename(filePath).replace(/\.bundle\.yaml$/, ""));
230
- const deps = meta.dependencies;
231
- const dependencies = Array.isArray(deps) ? deps.filter(Boolean) : [];
232
242
  return {
233
- name,
234
- kind: "bundle",
243
+ name: String(meta.name ?? basename(filePath).replace(/\.preset\.yaml$/, "")),
244
+ kind: "preset",
235
245
  description: String(meta.description ?? ""),
236
246
  source: filePath,
237
247
  publisher: repoName,
238
248
  version: String(meta.version ?? ""),
239
- requires: parseRequires(meta),
240
- dependencies
249
+ requires: [],
250
+ dependencies: presetItemRefs(meta.items).refs
241
251
  };
242
252
  }
243
- async function bundleDepRefs(filePath) {
244
- return bundleDepRefsFromContent(await readManifestFileOrEmpty(filePath), filePath);
253
+ async function assetDepRefs(filePath) {
254
+ return assetDepRefsFromContent(await readManifestFileOrEmpty(filePath), filePath);
245
255
  }
246
- function bundleDepRefsFromContent(content, filePath) {
247
- const wholeDoc = /\.(bundle\.yaml|flow\.yaml|flow\.json)$/.test(filePath);
256
+ function assetDepRefsFromContent(content, filePath) {
248
257
  let meta = {};
249
258
  try {
250
- meta = wholeDoc ? parse(content) ?? {} : parseFrontmatter(content).data;
259
+ meta = parse(content) ?? {};
251
260
  } catch {
252
- return [];
261
+ return { refs: [], skipped: 0 };
253
262
  }
263
+ if (filePath.endsWith(".preset.yaml")) return presetItemRefs(meta.items);
254
264
  const out = [];
255
265
  const collect = (v) => {
256
266
  if (Array.isArray(v)) {
@@ -260,7 +270,7 @@ function bundleDepRefsFromContent(content, filePath) {
260
270
  collect(meta.requires);
261
271
  collect(meta.metadata?.requires);
262
272
  collect(meta.dependencies);
263
- return [...new Set(out)];
273
+ return { refs: [...new Set(out)], skipped: 0 };
264
274
  }
265
275
  async function fromContractMd(filePath, repoName) {
266
276
  return fromContractMdContent(await readManifestFile(filePath), repoName, filePath);
@@ -373,6 +383,10 @@ function warnTruncation(info) {
373
383
  ...info
374
384
  });
375
385
  }
386
+ function warnDiagnostic(d) {
387
+ walkLogger ??= createLogger({ kind: "runner", subkind: "asset-scan" });
388
+ walkLogger.warn(d.message, { code: d.code, path: d.path });
389
+ }
376
390
  function truncate(state, info) {
377
391
  if (state.reported.has(info.reason)) return;
378
392
  state.reported.add(info.reason);
@@ -487,8 +501,8 @@ function normalizeEntryName(e) {
487
501
  e.metadata = { ...e.metadata, displayName: original };
488
502
  }
489
503
  }
490
- function entryFromManifest(name, content, filePath, repoName) {
491
- if (name === "SKILL.md") return fromSkillMdContent(content, repoName, filePath);
504
+ function entryFromManifest(name, content, filePath, repoName, knownKinds) {
505
+ if (name === "SKILL.md") return fromSkillMdContent(content, repoName, filePath, knownKinds);
492
506
  if (name === "AGENT.md") return fromAgentMdContent(content, repoName, filePath);
493
507
  if (name === "agent.yaml") return fromAgentYamlContent(content, repoName, filePath);
494
508
  if (name === "CONTRACT.md") return fromContractMdContent(content, repoName, filePath);
@@ -496,15 +510,15 @@ function entryFromManifest(name, content, filePath, repoName) {
496
510
  if (name === "CONNECTOR.md") return fromConnectorMdContent(content, repoName, filePath);
497
511
  if (name === "knowledge.yaml") return fromKnowledgeYamlContent(content, repoName, filePath);
498
512
  if (name.endsWith(".prompt.md")) return fromPromptMdContent(content, repoName, filePath);
499
- if (name.endsWith(".bundle.yaml")) return fromBundleYamlContent(content, repoName, filePath);
513
+ if (name.endsWith(".preset.yaml")) return fromPresetYamlContent(content, repoName, filePath);
500
514
  if (name.endsWith(".flow.yaml") || name.endsWith(".flow.json"))
501
515
  return fromFlowYamlContent(content, repoName, filePath);
502
516
  return null;
503
517
  }
504
518
  function isManifestName(name) {
505
- return name === "SKILL.md" || name === "AGENT.md" || name === "agent.yaml" || name === "CONTRACT.md" || name === "MCP.md" || name === "CONNECTOR.md" || name === "knowledge.yaml" || name.endsWith(".prompt.md") || name.endsWith(".bundle.yaml") || name.endsWith(".flow.yaml") || name.endsWith(".flow.json");
519
+ return name === "SKILL.md" || name === "AGENT.md" || name === "agent.yaml" || name === "CONTRACT.md" || name === "MCP.md" || name === "CONNECTOR.md" || name === "knowledge.yaml" || name.endsWith(".prompt.md") || name.endsWith(".preset.yaml") || name.endsWith(".flow.yaml") || name.endsWith(".flow.json");
506
520
  }
507
- async function scanDirectory(root, repoName, options = {}) {
521
+ async function scanDirectory(root, repoName, options) {
508
522
  const entries = /* @__PURE__ */ new Map();
509
523
  const onTruncate = options.onTruncate ?? warnTruncation;
510
524
  const reported = /* @__PURE__ */ new Set();
@@ -540,14 +554,17 @@ async function scanDirectory(root, repoName, options = {}) {
540
554
  continue;
541
555
  }
542
556
  try {
543
- const entry = entryFromManifest(name, content, filePath, repoName);
557
+ const entry = entryFromManifest(name, content, filePath, repoName, options.knownKinds);
544
558
  if (entry) add(entry);
545
- } catch {
559
+ } catch (err) {
560
+ if (err instanceof ManifestKindError) {
561
+ (options.onDiagnostic ?? warnDiagnostic)(manifestKindDiagnostic(err));
562
+ }
546
563
  }
547
564
  }
548
565
  return [...entries.values()];
549
566
  }
550
567
 
551
- export { DEFAULT_FS_DEADLINE_MS, DEFAULT_WALK_BUDGET_MS, DEFAULT_WALK_MAX_DEPTH, DEFAULT_WALK_MAX_ENTRIES, FS_DEADLINE_ENV_VAR, FsDeadlineError, WALK_BUDGET_MS_ENV_VAR, WALK_MAX_DEPTH_ENV_VAR, WALK_MAX_ENTRIES_ENV_VAR, bundleDepRefs, fromAgentMd, fromAgentYaml, fromBundleYaml, fromConnectorMd, fromContractMd, fromFlowYaml, fromKnowledgeYaml, fromMcpServerMd, fromMcpServerMdContent, fromPromptMd, fromSkillMd, fsDeadlineMs, parseFrontmatter, parseRequires, scanDirectory, tryWithFsDeadline, walkDir, withFsDeadline };
552
- //# sourceMappingURL=chunk-LFMX2UEF.js.map
553
- //# sourceMappingURL=chunk-LFMX2UEF.js.map
568
+ 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 };
569
+ //# sourceMappingURL=chunk-PA7WLID3.js.map
570
+ //# sourceMappingURL=chunk-PA7WLID3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../core/src/fs-deadline.ts","../core/src/manifest.ts"],"names":[],"mappings":";;;;;;;AA4BO,IAAM,sBAAA,GAAyB;AAQ/B,IAAM,mBAAA,GAAsB;AAQ5B,IAAM,eAAA,GAAN,cAA8B,KAAA,CAAM;AAAA,EAChC,SAAA;AAAA,EACA,SAAA;AAAA,EAET,WAAA,CAAY,WAAmB,SAAA,EAAmB;AAChD,IAAA,KAAA;AAAA,MACE,CAAA,sBAAA,EAAyB,SAAS,CAAA,WAAA,EAAc,SAAS,CAAA,uCAAA;AAAA,KAC3D;AACA,IAAA,IAAA,CAAK,IAAA,GAAO,iBAAA;AACZ,IAAA,IAAA,CAAK,SAAA,GAAY,SAAA;AACjB,IAAA,IAAA,CAAK,SAAA,GAAY,SAAA;AAAA,EACnB;AACF;AAYO,SAAS,YAAA,CAAa,WAAmB,sBAAA,EAAgC;AAC9E,EAAA,MAAM,GAAA,GAAM,OAAA,CAAQ,GAAA,CAAI,mBAAmB,CAAA;AAC3C,EAAA,IAAI,GAAA,KAAQ,QAAW,OAAO,QAAA;AAC9B,EAAA,MAAM,MAAA,GAAS,MAAA,CAAO,QAAA,CAAS,GAAA,EAAK,EAAE,CAAA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AAA,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,CAAC,GAAG,OAAA,CAAQ,MAAA,EAAQ,CAAA;AAC7B","file":"chunk-PA7WLID3.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 * 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 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 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: presetItemRefs(meta.items).refs,\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\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/**\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).\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 * @param root - Absolute path to the directory tree to scan\n * @param repoName - Repository name attached to every produced entry\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 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\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 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 [...entries.values()];\n}\n"]}
@@ -1,7 +1,7 @@
1
- import { SubprocessCliDriver, extractText, extractCost, extractTokens } from './chunk-C4GF7RSQ.js';
2
- import { resolveEnvDriverSession, bindSingleProviderEntry, resolveRegistryBinding } from './chunk-G474PBUQ.js';
3
- import { getStaticModels, fetchProviderModels } from './chunk-LCULZ4ED.js';
4
- import { getProviderPreset, BUILTIN_DRIVER_CATALOG, getBridgeLogger, entryCredentialValue, registryDriverConfig } from './chunk-V7VDSFPS.js';
1
+ import { SubprocessCliDriver, extractText, extractCost, extractTokens } from './chunk-KUFNKVBM.js';
2
+ import { resolveEnvDriverSession, bindSingleProviderEntry, resolveRegistryBinding } from './chunk-LLKKLKZJ.js';
3
+ import { getStaticModels, fetchProviderModels } from './chunk-27HS2DHB.js';
4
+ import { getProviderPreset, BUILTIN_DRIVER_CATALOG, getBridgeLogger, entryCredentialValue, registryDriverConfig } from './chunk-5B5IZVEP.js';
5
5
  import * as z from 'zod';
6
6
 
7
7
  var GOOGLE_DEFAULT_BASE_URL = getProviderPreset("google")?.base_url;
@@ -184,5 +184,5 @@ var geminiDriverTarget = {
184
184
  };
185
185
 
186
186
  export { GeminiDriver, GeminiFamilyDriver, geminiDriverTarget };
187
- //# sourceMappingURL=chunk-K2NUT3HO.js.map
188
- //# sourceMappingURL=chunk-K2NUT3HO.js.map
187
+ //# sourceMappingURL=chunk-PJS2YWGG.js.map
188
+ //# sourceMappingURL=chunk-PJS2YWGG.js.map