@skaile/workspaces 5.9.0 → 5.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (316) hide show
  1. package/CHANGELOG.md +145 -0
  2. package/README.md +12 -0
  3. package/dist/{asset-feeds-XMKKUUK6.js → asset-feeds-CXGQIDFR.js} +19 -19
  4. package/dist/{asset-feeds-XMKKUUK6.js.map → asset-feeds-CXGQIDFR.js.map} +1 -1
  5. package/dist/asset-manager/catalog-deployer.js +8 -8
  6. package/dist/asset-manager/index.js +14 -14
  7. package/dist/asset-manager/installer.js +10 -10
  8. package/dist/asset-manager/renderers.js +9 -9
  9. package/dist/asset-manager/src/index.d.ts +400 -35
  10. package/dist/asset-manager/src/index.d.ts.map +1 -1
  11. package/dist/asset-manager/src/install-agent.d.ts +3 -1
  12. package/dist/asset-manager/src/install-agent.d.ts.map +1 -1
  13. package/dist/asset-manager/src/install-instances.d.ts +31 -1
  14. package/dist/asset-manager/src/install-instances.d.ts.map +1 -1
  15. package/dist/asset-manager/src/installer.d.ts +43 -3
  16. package/dist/asset-manager/src/installer.d.ts.map +1 -1
  17. package/dist/asset-manager/src/renderers.d.ts +4 -5
  18. package/dist/asset-manager/src/renderers.d.ts.map +1 -1
  19. package/dist/bridge/drivers/claude-sdk.js +11 -11
  20. package/dist/bridge/drivers/codex.js +11 -11
  21. package/dist/bridge/drivers/continue.js +10 -10
  22. package/dist/bridge/drivers/echo.js +2 -2
  23. package/dist/bridge/drivers/gemini.js +7 -7
  24. package/dist/bridge/drivers/goose.js +10 -10
  25. package/dist/bridge/drivers/omp.js +19 -3
  26. package/dist/bridge/drivers/omp.js.map +1 -1
  27. package/dist/bridge/drivers/opencode.js +10 -10
  28. package/dist/bridge/drivers/qwen.js +7 -7
  29. package/dist/bridge/index.js +12 -12
  30. package/dist/bridge/src/drivers/omp.d.ts.map +1 -1
  31. package/dist/{chunk-4MQS7CAF.js → chunk-2F5AWQX5.js} +437 -175
  32. package/dist/chunk-2F5AWQX5.js.map +1 -0
  33. package/dist/{chunk-UM7RIAHO.js → chunk-3SM2DL2T.js} +8 -8
  34. package/dist/{chunk-UM7RIAHO.js.map → chunk-3SM2DL2T.js.map} +1 -1
  35. package/dist/{chunk-5NNNV76P.js → chunk-47U4GZ4M.js} +2 -2
  36. package/dist/{chunk-5NNNV76P.js.map → chunk-47U4GZ4M.js.map} +1 -1
  37. package/dist/{chunk-TTRYE6AC.js → chunk-4A4OD24G.js} +9 -9
  38. package/dist/{chunk-TTRYE6AC.js.map → chunk-4A4OD24G.js.map} +1 -1
  39. package/dist/{chunk-ZTBAYUDY.js → chunk-6O2X3GPW.js} +2 -2
  40. package/dist/{chunk-ZTBAYUDY.js.map → chunk-6O2X3GPW.js.map} +1 -1
  41. package/dist/{chunk-JAKOMFC6.js → chunk-ALEYHUC5.js} +114 -46
  42. package/dist/chunk-ALEYHUC5.js.map +1 -0
  43. package/dist/{chunk-QVNRCDTV.js → chunk-BNMZVPYA.js} +7 -7
  44. package/dist/chunk-BNMZVPYA.js.map +1 -0
  45. package/dist/{chunk-2FRUUDZY.js → chunk-CAHB6MHA.js} +5 -5
  46. package/dist/{chunk-2FRUUDZY.js.map → chunk-CAHB6MHA.js.map} +1 -1
  47. package/dist/{chunk-GKMZ6THE.js → chunk-CJERAGFY.js} +44 -33
  48. package/dist/chunk-CJERAGFY.js.map +1 -0
  49. package/dist/{chunk-CKQEIY43.js → chunk-COH6FQAG.js} +4 -4
  50. package/dist/{chunk-CKQEIY43.js.map → chunk-COH6FQAG.js.map} +1 -1
  51. package/dist/{chunk-UO7WPLDY.js → chunk-CPWLNZGJ.js} +3 -3
  52. package/dist/{chunk-UO7WPLDY.js.map → chunk-CPWLNZGJ.js.map} +1 -1
  53. package/dist/{chunk-MGGFBZWA.js → chunk-D3B36CYC.js} +4 -3
  54. package/dist/chunk-D3B36CYC.js.map +1 -0
  55. package/dist/{chunk-UMVKJM4Q.js → chunk-DALV4HHP.js} +18 -3
  56. package/dist/chunk-DALV4HHP.js.map +1 -0
  57. package/dist/{chunk-IMKSM5NL.js → chunk-DZMNFCWB.js} +1447 -199
  58. package/dist/chunk-DZMNFCWB.js.map +1 -0
  59. package/dist/{chunk-GB7WDMH2.js → chunk-EDYHEMJA.js} +4 -4
  60. package/dist/{chunk-GB7WDMH2.js.map → chunk-EDYHEMJA.js.map} +1 -1
  61. package/dist/{chunk-YSHVQGUS.js → chunk-FH7W6TJ4.js} +164 -41
  62. package/dist/chunk-FH7W6TJ4.js.map +1 -0
  63. package/dist/{chunk-W5DWWE4Y.js → chunk-G4FFOV3N.js} +4 -4
  64. package/dist/{chunk-W5DWWE4Y.js.map → chunk-G4FFOV3N.js.map} +1 -1
  65. package/dist/{chunk-2LWYNQK7.js → chunk-GCHPUTA3.js} +3 -3
  66. package/dist/{chunk-2LWYNQK7.js.map → chunk-GCHPUTA3.js.map} +1 -1
  67. package/dist/{chunk-JZ5EHBPI.js → chunk-GV4DZ6MT.js} +20 -4
  68. package/dist/chunk-GV4DZ6MT.js.map +1 -0
  69. package/dist/{chunk-S53LOR7B.js → chunk-HCEVNYSH.js} +3 -3
  70. package/dist/{chunk-S53LOR7B.js.map → chunk-HCEVNYSH.js.map} +1 -1
  71. package/dist/{chunk-EF7NPDDU.js → chunk-HZXUXHIV.js} +31 -17
  72. package/dist/chunk-HZXUXHIV.js.map +1 -0
  73. package/dist/{chunk-IR33D6EP.js → chunk-IER3KIPH.js} +5 -5
  74. package/dist/{chunk-IR33D6EP.js.map → chunk-IER3KIPH.js.map} +1 -1
  75. package/dist/{chunk-Y7QA2OLD.js → chunk-J4RBUFGM.js} +22 -20
  76. package/dist/chunk-J4RBUFGM.js.map +1 -0
  77. package/dist/{chunk-J7U3PIOE.js → chunk-M3B6EIJD.js} +4 -4
  78. package/dist/{chunk-J7U3PIOE.js.map → chunk-M3B6EIJD.js.map} +1 -1
  79. package/dist/{chunk-DNZYOKOJ.js → chunk-MZG34MBZ.js} +3 -3
  80. package/dist/{chunk-DNZYOKOJ.js.map → chunk-MZG34MBZ.js.map} +1 -1
  81. package/dist/{chunk-V2DXZYBB.js → chunk-NWDSLXOX.js} +3 -3
  82. package/dist/{chunk-V2DXZYBB.js.map → chunk-NWDSLXOX.js.map} +1 -1
  83. package/dist/{chunk-36AFURKZ.js → chunk-PBBPZYVG.js} +61 -12
  84. package/dist/chunk-PBBPZYVG.js.map +1 -0
  85. package/dist/{chunk-P67WJVP4.js → chunk-PQFHMQHQ.js} +10 -9
  86. package/dist/chunk-PQFHMQHQ.js.map +1 -0
  87. package/dist/{chunk-UAROCOXF.js → chunk-QVFAS5IO.js} +3 -3
  88. package/dist/{chunk-UAROCOXF.js.map → chunk-QVFAS5IO.js.map} +1 -1
  89. package/dist/{chunk-K3CVFRVS.js → chunk-QZNJOHN6.js} +3 -3
  90. package/dist/{chunk-K3CVFRVS.js.map → chunk-QZNJOHN6.js.map} +1 -1
  91. package/dist/{chunk-FVJK4QWM.js → chunk-R7NHYEJF.js} +4 -4
  92. package/dist/{chunk-FVJK4QWM.js.map → chunk-R7NHYEJF.js.map} +1 -1
  93. package/dist/{chunk-GXLQLPE5.js → chunk-RYYLMBA2.js} +5 -5
  94. package/dist/{chunk-GXLQLPE5.js.map → chunk-RYYLMBA2.js.map} +1 -1
  95. package/dist/{chunk-Y4N2NUZD.js → chunk-S3O3GKB7.js} +4 -4
  96. package/dist/{chunk-Y4N2NUZD.js.map → chunk-S3O3GKB7.js.map} +1 -1
  97. package/dist/{chunk-GTILM2CI.js → chunk-SBSA3IQA.js} +43 -12
  98. package/dist/chunk-SBSA3IQA.js.map +1 -0
  99. package/dist/{chunk-4PTSR4UU.js → chunk-T42WRQ4O.js} +3 -3
  100. package/dist/{chunk-4PTSR4UU.js.map → chunk-T42WRQ4O.js.map} +1 -1
  101. package/dist/{chunk-MR5HBOUF.js → chunk-T7CTHHG7.js} +3 -3
  102. package/dist/{chunk-MR5HBOUF.js.map → chunk-T7CTHHG7.js.map} +1 -1
  103. package/dist/{chunk-FZNG4V4J.js → chunk-TCHRMVTO.js} +4 -4
  104. package/dist/{chunk-FZNG4V4J.js.map → chunk-TCHRMVTO.js.map} +1 -1
  105. package/dist/{chunk-LAMCXQGA.js → chunk-VLTQGE2E.js} +75 -25
  106. package/dist/chunk-VLTQGE2E.js.map +1 -0
  107. package/dist/{chunk-7AI3Q5AQ.js → chunk-WSBKB4CJ.js} +71 -24
  108. package/dist/chunk-WSBKB4CJ.js.map +1 -0
  109. package/dist/{chunk-CGT45WN7.js → chunk-X77SUM4P.js} +3 -3
  110. package/dist/{chunk-CGT45WN7.js.map → chunk-X77SUM4P.js.map} +1 -1
  111. package/dist/{chunk-SCOT677Q.js → chunk-XDKH7XSA.js} +5 -5
  112. package/dist/{chunk-SCOT677Q.js.map → chunk-XDKH7XSA.js.map} +1 -1
  113. package/dist/{chunk-QVEKLSEH.js → chunk-XUSALIEI.js} +6 -6
  114. package/dist/{chunk-QVEKLSEH.js.map → chunk-XUSALIEI.js.map} +1 -1
  115. package/dist/{chunk-FYXZRVID.js → chunk-Y3HTGHJC.js} +3 -3
  116. package/dist/{chunk-FYXZRVID.js.map → chunk-Y3HTGHJC.js.map} +1 -1
  117. package/dist/chunk-YOH2L76X.js +505 -0
  118. package/dist/chunk-YOH2L76X.js.map +1 -0
  119. package/dist/{chunk-B6GIW55K.js → chunk-ZCAJZ4B2.js} +7 -4
  120. package/dist/chunk-ZCAJZ4B2.js.map +1 -0
  121. package/dist/{chunk-BTE2V4IW.js → chunk-ZPWTOUTK.js} +76 -7
  122. package/dist/{chunk-BTE2V4IW.js.map → chunk-ZPWTOUTK.js.map} +1 -1
  123. package/dist/cli/index.js +1034 -794
  124. package/dist/cli/index.js.map +1 -1
  125. package/dist/cli/src/commands/asset-cmd.d.ts.map +1 -1
  126. package/dist/cli/src/commands/catalog.d.ts +8 -5
  127. package/dist/cli/src/commands/catalog.d.ts.map +1 -1
  128. package/dist/cli/src/commands/diff.d.ts +4 -2
  129. package/dist/cli/src/commands/diff.d.ts.map +1 -1
  130. package/dist/cli/src/commands/library-cmd.d.ts.map +1 -1
  131. package/dist/cli/src/commands/library-index.d.ts +34 -2
  132. package/dist/cli/src/commands/library-index.d.ts.map +1 -1
  133. package/dist/cli/src/commands/library-publish.d.ts.map +1 -1
  134. package/dist/cli/src/commands/manage.d.ts +12 -5
  135. package/dist/cli/src/commands/manage.d.ts.map +1 -1
  136. package/dist/cli/src/commands/migrate-assets.d.ts.map +1 -1
  137. package/dist/cli/src/commands/outdated.d.ts +7 -5
  138. package/dist/cli/src/commands/outdated.d.ts.map +1 -1
  139. package/dist/cli/src/commands/project.d.ts +13 -8
  140. package/dist/cli/src/commands/project.d.ts.map +1 -1
  141. package/dist/cli/src/commands/run.d.ts.map +1 -1
  142. package/dist/cli/src/commands/source.d.ts +30 -1
  143. package/dist/cli/src/commands/source.d.ts.map +1 -1
  144. package/dist/cli/src/commands/update.d.ts.map +1 -1
  145. package/dist/cli/src/commands/validate.d.ts.map +1 -1
  146. package/dist/cli/src/commands/why.d.ts +1 -0
  147. package/dist/cli/src/commands/why.d.ts.map +1 -1
  148. package/dist/cli/src/helpers.d.ts +12 -0
  149. package/dist/cli/src/helpers.d.ts.map +1 -1
  150. package/dist/cli/src/skill-checks.d.ts +57 -4
  151. package/dist/cli/src/skill-checks.d.ts.map +1 -1
  152. package/dist/connectors/config.js +5 -5
  153. package/dist/connectors/index.js +16 -16
  154. package/dist/{connectors-C7UQ73BK.js → connectors-4QWAKPHB.js} +19 -19
  155. package/dist/{connectors-C7UQ73BK.js.map → connectors-4QWAKPHB.js.map} +1 -1
  156. package/dist/core/index.js +7 -7
  157. package/dist/core/logging.js +1 -1
  158. package/dist/core/manifest.js +2 -2
  159. package/dist/core/models.js +1 -1
  160. package/dist/core/publish-manifest.js +2 -2
  161. package/dist/core/ref.js +1 -1
  162. package/dist/core/runtime-assets.js +5 -5
  163. package/dist/core/src/index.d.ts +2 -1
  164. package/dist/core/src/index.d.ts.map +1 -1
  165. package/dist/core/src/lock.d.ts +6 -2
  166. package/dist/core/src/lock.d.ts.map +1 -1
  167. package/dist/core/src/logging/sinks/sqlite-runtime.d.ts.map +1 -1
  168. package/dist/core/src/manifest.d.ts.map +1 -1
  169. package/dist/core/src/models.d.ts +22 -6
  170. package/dist/core/src/models.d.ts.map +1 -1
  171. package/dist/core/src/publish-manifest.d.ts +29 -3
  172. package/dist/core/src/publish-manifest.d.ts.map +1 -1
  173. package/dist/core/src/repo-manager.d.ts.map +1 -1
  174. package/dist/core/src/requirements.d.ts +26 -0
  175. package/dist/core/src/requirements.d.ts.map +1 -0
  176. package/dist/core/src/walker.d.ts.map +1 -1
  177. package/dist/core/src/workspace-config.d.ts +22 -1
  178. package/dist/core/src/workspace-config.d.ts.map +1 -1
  179. package/dist/core/src/workspace-yaml-editor.d.ts +4 -1
  180. package/dist/core/src/workspace-yaml-editor.d.ts.map +1 -1
  181. package/dist/core/workspace-config.js +4 -4
  182. package/dist/deploy/index.js +7 -7
  183. package/dist/discovery/index.js +5 -5
  184. package/dist/discovery/src/builtin-providers.d.ts.map +1 -1
  185. package/dist/discovery/src/discover-manifest.d.ts.map +1 -1
  186. package/dist/discovery/src/discover.d.ts.map +1 -1
  187. package/dist/discovery/src/source-config.d.ts.map +1 -1
  188. package/dist/discovery/src/tree-entries.d.ts.map +1 -1
  189. package/dist/{ensure-sources-SRC2DVR5.js → ensure-sources-2RONZKCU.js} +17 -17
  190. package/dist/{ensure-sources-SRC2DVR5.js.map → ensure-sources-2RONZKCU.js.map} +1 -1
  191. package/dist/factory-assets/connectors/box.js +16 -16
  192. package/dist/factory-assets/connectors/deploy.js +16 -16
  193. package/dist/factory-assets/connectors/devserver.js +16 -16
  194. package/dist/factory-assets/connectors/flow/adapter.js +16 -16
  195. package/dist/factory-assets/connectors/flow/contract/normalize.d.ts.map +1 -1
  196. package/dist/factory-assets/connectors/flow/contract.js +1 -1
  197. package/dist/factory-assets/connectors/flow/engine.js +9 -9
  198. package/dist/factory-assets/connectors/flow/run-flow.js +18 -18
  199. package/dist/factory-assets/connectors/flow.js +16 -16
  200. package/dist/factory-assets/connectors/git.js +16 -16
  201. package/dist/factory-assets/connectors/gmail.js +16 -16
  202. package/dist/factory-assets/connectors/googledrive.js +16 -16
  203. package/dist/factory-assets/connectors/local.js +16 -16
  204. package/dist/factory-assets/connectors/mattermost.js +16 -16
  205. package/dist/factory-assets/connectors/memory.js +16 -16
  206. package/dist/factory-assets/connectors/minio.js +16 -16
  207. package/dist/factory-assets/connectors/postgres.js +16 -16
  208. package/dist/factory-assets/connectors/s3.js +16 -16
  209. package/dist/factory-assets/connectors/sharepoint.js +16 -16
  210. package/dist/factory-assets/connectors/sqlite.js +16 -16
  211. package/dist/factory-assets/connectors/static-server.js +16 -16
  212. package/dist/factory-assets/connectors/tunnel.js +16 -16
  213. package/dist/factory-assets/connectors/webdav.js +16 -16
  214. package/dist/factory-assets/connectors/xstate-store.js +16 -16
  215. package/dist/factory-assets/connectors/xstate.js +16 -16
  216. package/dist/factory-assets/skills/authoring-skaile-manifests/SKILL.md +9 -3
  217. package/dist/factory-assets/skills/authoring-skaile-manifests/references/dependency-standard.md +4 -2
  218. package/dist/{flows-CBYRSAGS.js → flows-EQF2CH4U.js} +12 -12
  219. package/dist/{flows-CBYRSAGS.js.map → flows-EQF2CH4U.js.map} +1 -1
  220. package/dist/{helpers-XAEKCZKT.js → helpers-CFK6YP6R.js} +17 -17
  221. package/dist/{helpers-XAEKCZKT.js.map → helpers-CFK6YP6R.js.map} +1 -1
  222. package/dist/library/index.js +11 -11
  223. package/dist/library/install.js +3 -3
  224. package/dist/library/src/index.d.ts +2 -1
  225. package/dist/library/src/index.d.ts.map +1 -1
  226. package/dist/library/src/local/library-dir.d.ts +68 -0
  227. package/dist/library/src/local/library-dir.d.ts.map +1 -0
  228. package/dist/library/src/local/library-manager.d.ts +10 -1
  229. package/dist/library/src/local/library-manager.d.ts.map +1 -1
  230. package/dist/library/src/local/library.d.ts +2 -2
  231. package/dist/library/src/local/library.d.ts.map +1 -1
  232. package/dist/library/src/local/local-catalog-source.d.ts +9 -0
  233. package/dist/library/src/local/local-catalog-source.d.ts.map +1 -1
  234. package/dist/library/src/manifest-writer.d.ts +55 -4
  235. package/dist/library/src/manifest-writer.d.ts.map +1 -1
  236. package/dist/library/src/remote/cache.d.ts +18 -1
  237. package/dist/library/src/remote/cache.d.ts.map +1 -1
  238. package/dist/library/src/remote/remote-catalog-source.d.ts.map +1 -1
  239. package/dist/library/src/remote/rest-catalog-source.d.ts.map +1 -1
  240. package/dist/library/src/sync/git-driver.d.ts +7 -6
  241. package/dist/library/src/sync/git-driver.d.ts.map +1 -1
  242. package/dist/{library-publish-VJSWMOLH.js → library-publish-53UTB3MB.js} +151 -42
  243. package/dist/library-publish-53UTB3MB.js.map +1 -0
  244. package/dist/open-library-BOSPJVID.js +40 -0
  245. package/dist/{open-library-DB2PNL2X.js.map → open-library-BOSPJVID.js.map} +1 -1
  246. package/dist/open-registry-4FI7HKET.js +32 -0
  247. package/dist/{open-registry-ZUZJ7MS7.js.map → open-registry-4FI7HKET.js.map} +1 -1
  248. package/dist/paths-SUS4S4YT.js +22 -0
  249. package/dist/{paths-FQ64OLJG.js.map → paths-SUS4S4YT.js.map} +1 -1
  250. package/dist/{plugin-store-MPAMD5OT.js → plugin-store-AGQDMING.js} +9 -9
  251. package/dist/{plugin-store-MPAMD5OT.js.map → plugin-store-AGQDMING.js.map} +1 -1
  252. package/dist/project-I55A4O2T.js +41 -0
  253. package/dist/{project-I6NX3NFB.js.map → project-I55A4O2T.js.map} +1 -1
  254. package/dist/resolver/index.js +8 -8
  255. package/dist/runner/index.js +30 -30
  256. package/dist/runner/src/agent.d.ts.map +1 -1
  257. package/dist/runner/src/serve.d.ts.map +1 -1
  258. package/dist/runner/src/usage-limit-turn-hold.d.ts +51 -0
  259. package/dist/runner/src/usage-limit-turn-hold.d.ts.map +1 -0
  260. package/dist/sdk/asset-manager.js +14 -14
  261. package/dist/sdk/bridge.js +12 -12
  262. package/dist/sdk/core.js +7 -7
  263. package/dist/sdk/flow.js +9 -9
  264. package/dist/sdk/index.js +30 -30
  265. package/dist/sdk/resolver.js +8 -8
  266. package/dist/sdk/runner.js +30 -30
  267. package/dist/{setup-B7JUHYJW.js → setup-7DQJKHUI.js} +22 -22
  268. package/dist/{setup-B7JUHYJW.js.map → setup-7DQJKHUI.js.map} +1 -1
  269. package/dist/{skills-TVO26Y4V.js → skills-NUEN5NDX.js} +13 -13
  270. package/dist/{skills-TVO26Y4V.js.map → skills-NUEN5NDX.js.map} +1 -1
  271. package/dist/source-G2LV5LVD.js +41 -0
  272. package/dist/{source-PJBMDCKX.js.map → source-G2LV5LVD.js.map} +1 -1
  273. package/dist/{source-manifest-publish-LLJWXGID.js → source-manifest-publish-6RM7SWLZ.js} +24 -24
  274. package/dist/{source-manifest-publish-LLJWXGID.js.map → source-manifest-publish-6RM7SWLZ.js.map} +1 -1
  275. package/dist/tui/index.js +61 -41
  276. package/dist/tui/index.js.map +1 -1
  277. package/dist/tui/src/repl.d.ts.map +1 -1
  278. package/dist/types/manifests.js +1 -1
  279. package/dist/types/src/manifests/agent.d.ts +2 -0
  280. package/dist/types/src/manifests/agent.d.ts.map +1 -1
  281. package/dist/types/src/manifests/contract.d.ts +2 -0
  282. package/dist/types/src/manifests/contract.d.ts.map +1 -1
  283. package/dist/types/src/manifests/index.d.ts +3 -3
  284. package/dist/types/src/manifests/index.d.ts.map +1 -1
  285. package/dist/types/src/manifests/preset.d.ts +1 -1
  286. package/dist/types/src/manifests/prompt.d.ts +2 -0
  287. package/dist/types/src/manifests/prompt.d.ts.map +1 -1
  288. package/dist/workspace-plugin/adapters/mcp.js +23 -23
  289. package/dist/workspace-plugin/adapters/omp.js +14 -14
  290. package/dist/workspace-plugin/index.js +2 -2
  291. package/package.json +1 -1
  292. package/dist/chunk-36AFURKZ.js.map +0 -1
  293. package/dist/chunk-4MQS7CAF.js.map +0 -1
  294. package/dist/chunk-7AI3Q5AQ.js.map +0 -1
  295. package/dist/chunk-B6GIW55K.js.map +0 -1
  296. package/dist/chunk-EF7NPDDU.js.map +0 -1
  297. package/dist/chunk-GKMZ6THE.js.map +0 -1
  298. package/dist/chunk-GTILM2CI.js.map +0 -1
  299. package/dist/chunk-IMKSM5NL.js.map +0 -1
  300. package/dist/chunk-JAKOMFC6.js.map +0 -1
  301. package/dist/chunk-JZ5EHBPI.js.map +0 -1
  302. package/dist/chunk-LAMCXQGA.js.map +0 -1
  303. package/dist/chunk-MGGFBZWA.js.map +0 -1
  304. package/dist/chunk-P67WJVP4.js.map +0 -1
  305. package/dist/chunk-QVNRCDTV.js.map +0 -1
  306. package/dist/chunk-UMVKJM4Q.js.map +0 -1
  307. package/dist/chunk-Y7QA2OLD.js.map +0 -1
  308. package/dist/chunk-YSHVQGUS.js.map +0 -1
  309. package/dist/chunk-ZAOGFXDO.js +0 -112
  310. package/dist/chunk-ZAOGFXDO.js.map +0 -1
  311. package/dist/library-publish-VJSWMOLH.js.map +0 -1
  312. package/dist/open-library-DB2PNL2X.js +0 -40
  313. package/dist/open-registry-ZUZJ7MS7.js +0 -32
  314. package/dist/paths-FQ64OLJG.js +0 -22
  315. package/dist/project-I6NX3NFB.js +0 -41
  316. package/dist/source-PJBMDCKX.js +0 -41
@@ -1,5 +1,5 @@
1
- import { resolveSkWorkspaceConfig, readLinks, getGlobalCacheDir, sourceCacheKey } from './chunk-JAKOMFC6.js';
2
- import { scanDirectory, tryWithFsDeadline } from './chunk-GTILM2CI.js';
1
+ import { resolveSkWorkspaceConfig, readLinks, getGlobalCacheDir, sourceCacheKey } from './chunk-ALEYHUC5.js';
2
+ import { scanDirectory, tryWithFsDeadline } from './chunk-SBSA3IQA.js';
3
3
  import { existsSync, readFileSync } from 'fs';
4
4
  import { lstat, stat } from 'fs/promises';
5
5
  import { createRequire } from 'module';
@@ -224,5 +224,5 @@ function findCatalogEntry(entries, query) {
224
224
  }
225
225
 
226
226
  export { FACTORY_ASSETS_REPO_NAME, factoryAssetRoots, resolveFactoryAssetsRoot, resolveFactoryAssetsRootOrNull, resolvePackagedAssetsDir, resolveRuntimeAssets, resolveWorkspacesPackageRoot };
227
- //# sourceMappingURL=chunk-GB7WDMH2.js.map
228
- //# sourceMappingURL=chunk-GB7WDMH2.js.map
227
+ //# sourceMappingURL=chunk-EDYHEMJA.js.map
228
+ //# sourceMappingURL=chunk-EDYHEMJA.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../core/src/runtime-assets.ts"],"names":["resolvePath","require"],"mappings":";;;;;;;;AAsDA,SAAS,sBACP,OAAA,EACmC;AACnC,EAAA,MAAM,aAAa,iBAAA,EAAkB;AACrC,EAAA,MAAM,MAAyC,EAAC;AAChD,EAAA,KAAA,MAAW,CAAA,IAAK,OAAA,IAAW,EAAC,EAAG;AAC7B,IAAA,MAAM,GAAA,GAAM,cAAA,CAAe,CAAA,CAAE,GAAG,CAAA;AAChC,IAAA,IAAI,GAAA,CAAI,GAAG,CAAA,EAAG;AACd,IAAA,GAAA,CAAI,GAAG,CAAA,GAAI,EAAE,IAAA,EAAM,IAAA,CAAK,UAAA,EAAY,GAAG,CAAA,EAAG,GAAA,EAAK,CAAA,CAAE,GAAA,EAAK,MAAA,EAAQ,EAAE,GAAA,EAAI;AAAA,EACtE;AACA,EAAA,OAAO,GAAA;AACT;AAqDO,IAAM,wBAAA,GAA2B;AAMxC,IAAM,iCAAA,GAAoC,yBAAA;AAsC1C,eAAsB,qBAAqB,UAAA,EAAkD;AAC3F,EAAA,MAAM,MAAA,GAA8B;AAAA,IAClC,gBAAgB,EAAC;AAAA,IACjB,cAAc,EAAC;AAAA,IACf,iBAAiB,EAAE,QAAA,EAAU,EAAC,EAAG,QAAA,EAAU,EAAC,EAAE;AAAA,IAC9C,UAAU,EAAC;AAAA,IACX,SAAS,YAAY;AACnB,MAAA,MAAM,QAAA,CAAS,YAAY,MAAM,CAAA;AAAA,IACnC,CAAA;AAAA,IACA,WAAW,CAAC,KAAA,KAAU,gBAAA,CAAiB,MAAA,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I,CAAA,CAAA;AAAA,IACZ,YAAY;AACV,MAAA,MAAM,KAAK,IAAI,CAAA;AACf,MAAA,OAAO,IAAA;AAAA,IACT,CAAA;AAAA,IACA;AAAA,GACF;AACF;AAEA,SAAS,sBAAA,CAAuB,MAAc,IAAA,EAAiC;AAC7E,EAAA,IAAI,SAAS,wBAAA,IAA4B,CAAC,KAAK,IAAA,IAAQ,CAAC,KAAK,GAAA,EAAK;AAChE,IAAA,OACE,CAAA,oHAAA,CAAA;AAAA,EAGJ;AACA,EAAA,IAAI,KAAK,GAAA,EAAK;AACZ,IAAA,OAAO,CAAA,YAAA,EAAe,IAAI,CAAA,GAAA,EAAM,IAAA,CAAK,GAAG,CAAA,8EAAA,CAAA;AAAA,EAC1C;AACA,EAAA,IAAI,KAAK,IAAA,EAAM;AACb,IAAA,OAAO,CAAA,YAAA,EAAe,IAAI,CAAA,kBAAA,EAAqB,IAAA,CAAK,IAAI,CAAA,CAAA;AAAA,EAC1D;AACA,EAAA,OAAO,eAAe,IAAI,CAAA,2BAAA,CAAA;AAC5B;AAEA,SAAS,gBAAA,CACP,SACA,KAAA,EACiC;AACjC,EAAA,IAAI,MAAM,IAAA,EAAM;AACd,IAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,CAAC,CAAA,KAAM,CAAA,CAAE,IAAA,KAAS,KAAA,CAAM,IAAA,IAAQ,CAAA,CAAE,IAAA,KAAS,KAAA,CAAM,IAAI,CAAA;AAAA,EAC3E;AACA,EAAA,MAAM,OAAA,GAAU,QAAQ,MAAA,CAAO,CAAC,MAAM,CAAA,CAAE,IAAA,KAAS,MAAM,IAAI,CAAA;AAC3D,EAAA,IAAI,OAAA,CAAQ,MAAA,KAAW,CAAA,EAAG,OAAO,QAAQ,CAAC,CAAA;AAE1C,EAAA,OAAO,MAAA;AACT","file":"chunk-GB7WDMH2.js","sourcesContent":["/**\n * Runtime asset resolution — read `skaile.yaml`, scan all declared repositories\n * (including the built-in `factory-assets/` directory as an implicit default),\n * and produce a unified view of connector catalog entries plus the implicit refs\n * that the `skaile.yaml` `connectors:` section adds to the dependency graph.\n *\n * This module is the single source of truth for \"which connectors does this\n * project see at runtime, and where do their implementations live on disk\".\n * Both the runner (serve, REPL, flow) and the platform's mid-session\n * `add_resource` flow consume `RuntimeAssetsResult.catalogEntries` and pass\n * it into `ConnectorManager` for catalog-based resolution.\n *\n * `factory-assets/` is the single first-party content tree (built-in connectors\n * + first-party skills + bundles) shipped inside the `@skaile/workspaces`\n * package — not a standalone package.\n *\n * It resolves to an **ordered list of roots** ({@link factoryAssetRoots}), not a\n * single dir. The bundled tree is always the baseline; an optional\n * `SKAILE_FACTORY_ASSETS_DIR` (legacy: `SKAILE_BASE_ASSETS_DIR`) is layered\n * **in front** as an additive override source — the agent container points it at\n * `/app/factory-assets/` (or a bind-mounted host dir) to ship updated skills /\n * flows / bundles / connector manifests without rebuilding the image. The two\n * roots resolve uniformly across every consumer (connector catalog scan, skill /\n * flow / completion discovery, the asset-manager factory source):\n * 1. `SKAILE_FACTORY_ASSETS_DIR` env dir, when set and existing (override layer).\n * 2. the bundled tree via {@link resolvePackagedAssetsDir} — the in-repo source\n * `packages/workspaces/factory-assets/` during dev, else the published\n * `dist/factory-assets/` after install (always-present baseline).\n *\n * Override semantics are **env-first**: on a name conflict the env root wins and\n * the bundled root fills the rest. Connector *code* still loads via the package's\n * static `exports` map, so the env root can override/add skills, flows, bundles,\n * and connector **manifests/metadata**, but cannot ship a new executable\n * connector — its `.js` is not on the package's import graph.\n */\n\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { lstat, stat } from \"node:fs/promises\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join, resolve as resolvePath } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { tryWithFsDeadline } from \"./fs-deadline.js\";\nimport { scanDirectory } from \"./manifest.js\";\nimport type { CatalogEntry } from \"./models.js\";\nimport { getGlobalCacheDir, readLinks, sourceCacheKey } from \"./repo-manager.js\";\nimport type { SourceDeclaration, SourceEntry } from \"./workspace-config.js\";\nimport { resolveSkWorkspaceConfig } from \"./workspace-config.js\";\n\n/**\n * Map declared `sources[]` to internal `SourceDeclaration`s keyed by the\n * collision-free {@link sourceCacheKey} (`<host>/<owner>/<repo>`), pointing at\n * the unified machine-cache clone path (`getGlobalCacheDir()/<key>/`). Keyed by\n * the same function every other cache writer/reader uses so the path resolves.\n */\nfunction sourcesToDeclarations(\n sources: SourceEntry[] | undefined,\n): Record<string, SourceDeclaration> {\n const sourcesDir = getGlobalCacheDir();\n const out: Record<string, SourceDeclaration> = {};\n for (const s of sources ?? []) {\n const key = sourceCacheKey(s.url);\n if (out[key]) continue;\n out[key] = { path: join(sourcesDir, key), url: s.url, branch: s.pin };\n }\n return out;\n}\n\n// ─── Types ────────────────────────────────────────────────────────────────────\n\n/**\n * Catalog entry filtered to mount/connector kinds. Same shape as `CatalogEntry`.\n * @docLink packages/core/concepts#runtime-catalog-entry\n */\nexport type RuntimeCatalogEntry = CatalogEntry;\n\n/**\n * Implicit catalog reference derived from a `connectors:` declaration in `skaile.yaml`.\n * Each connector driver becomes an implicit ref that must be resolved in the catalog.\n * @docLink packages/core/concepts#runtime-asset-ref\n */\nexport interface RuntimeAssetRef {\n kind: \"connector\";\n /** Driver name — matches `RuntimeCatalogEntry.name`. */\n name: string;\n /** Source declaration id from `skaile.yaml`. */\n declarationId: string;\n}\n\n/**\n * Aggregated npm packages required by all resolved mount/connector adapters.\n * Populated from `metadata.npm_deps` in each matched catalog entry.\n * @docLink packages/core/concepts#runtime-npm-deps\n */\nexport interface RuntimeNpmDeps {\n required: string[];\n optional: string[];\n}\n\n/**\n * Non-fatal warning emitted during `resolveRuntimeAssets` when a repo is unavailable\n * or a driver is not found in any catalog.\n * @docLink packages/core/concepts#runtime-asset-warning\n */\nexport interface RuntimeAssetWarning {\n /** Stable code for filtering / structured logging. */\n code: \"missing_driver\" | \"repo_unavailable\" | \"invalid_repo_decl\";\n message: string;\n /** Declaration id when applicable. */\n declarationId?: string;\n /** Driver / repository name when applicable. */\n name?: string;\n}\n\n/**\n * Repository name used for the implicit built-in `factory-assets` catalog entry\n * (the in-package connector tree).\n * @docLink packages/core/concepts#factory-assets-repo-name\n */\nexport const FACTORY_ASSETS_REPO_NAME = \"factory-assets\";\n\n/**\n * Repository name for the optional `SKAILE_FACTORY_ASSETS_DIR` override layer,\n * scanned ahead of (and overriding) the bundled {@link FACTORY_ASSETS_REPO_NAME}.\n */\nconst FACTORY_ASSETS_OVERRIDE_REPO_NAME = \"factory-assets:override\";\n\n/**\n * Result of `resolveRuntimeAssets`.\n * The same object is mutated in place by `refresh()`, allowing callers to hold\n * a stable reference and observe updates after a new repository is cloned or\n * a driver is installed mid-session.\n * @docLink packages/core/concepts#runtime-assets-result\n */\nexport interface RuntimeAssetsResult {\n catalogEntries: RuntimeCatalogEntry[];\n implicitRefs: RuntimeAssetRef[];\n requiredNpmDeps: RuntimeNpmDeps;\n warnings: RuntimeAssetWarning[];\n /** Re-scan repositories and re-derive implicit refs. Mutates in place. */\n refresh(): Promise<void>;\n /**\n * Catalog lookup. When `kind` is omitted and multiple entries share the\n * `name`, returns `undefined` (caller must disambiguate).\n */\n findEntry(query: { kind?: \"connector\"; name: string }): RuntimeCatalogEntry | undefined;\n}\n\n// ─── Public API ───────────────────────────────────────────────────────────────\n\n/**\n * Resolve all runtime assets visible to a project by scanning declared repositories.\n *\n * Reads `skaile.yaml`, scans every declared repository (plus the implicit\n * built-in `factory-assets` repo), and derives implicit refs from `mounts:` /\n * `connectors:` declarations. Does not clone or install anything — purely a\n * read-only scan of what is already on disk. URL-only repositories that have\n * not been cloned yet are reported as `repo_unavailable` warnings.\n *\n * @param projectDir - Absolute path to the project workspace root\n * @returns `RuntimeAssetsResult` with catalog entries, implicit refs, npm deps, and warnings\n * @docLink packages/core/concepts#resolve-runtime-assets\n */\nexport async function resolveRuntimeAssets(projectDir: string): Promise<RuntimeAssetsResult> {\n const result: RuntimeAssetsResult = {\n catalogEntries: [],\n implicitRefs: [],\n requiredNpmDeps: { required: [], optional: [] },\n warnings: [],\n refresh: async () => {\n await populate(projectDir, result);\n },\n findEntry: (query) => findCatalogEntry(result.catalogEntries, query),\n };\n\n await populate(projectDir, result);\n return result;\n}\n\n/**\n * Resolve the ordered list of on-disk roots for the built-in `factory-assets`\n * tree (built-in connectors + first-party skills + bundles). This is the single\n * shared resolver every consumer goes through, so the env override and the\n * bundled baseline are honoured uniformly.\n *\n * Order (env-first = override-wins):\n * 1. `SKAILE_FACTORY_ASSETS_DIR` env dir (legacy: `SKAILE_BASE_ASSETS_DIR`),\n * when set and existing — an additive override layer.\n * 2. {@link resolvePackagedAssetsDir} — the bundled tree (in-repo source in dev,\n * `dist/factory-assets/` after install). Always-present baseline.\n *\n * Returns `[]` only when the package cannot be located at all. De-duplicated, so\n * pointing the env var at the bundled dir collapses to one root.\n *\n * @docLink packages/core/concepts#resolve-factory-assets-root\n */\nexport function factoryAssetRoots(): string[] {\n const roots: string[] = [];\n const envDir = process.env.SKAILE_FACTORY_ASSETS_DIR ?? process.env.SKAILE_BASE_ASSETS_DIR;\n // Deliberately still synchronous after #454: both candidates are\n // container-local (the image's `/app/factory-assets/`, or the installed\n // package tree resolved by `resolvePackagedAssetsDir`), never the FUSE\n // workspace mount. The mount-reachable probes on this module's scan path —\n // the project-relative `sources[].path` candidates in `resolveRepoDir` — are\n // async and deadline-bounded.\n if (envDir && existsSync(envDir)) roots.push(resolvePath(envDir));\n const bundled = resolvePackagedAssetsDir(\"factory-assets\");\n if (bundled) roots.push(bundled);\n return [...new Set(roots)];\n}\n\n/**\n * Resolve the primary on-disk root of the `factory-assets` tree — the first of\n * {@link factoryAssetRoots} (the env override when set, else the bundled tree).\n * Prefer {@link factoryAssetRoots} when you need to scan every layer; this\n * single-dir form is for callers that want one canonical path.\n *\n * @returns Absolute path to the highest-precedence `factory-assets` directory\n * @throws When no root can be located\n * @docLink packages/core/concepts#resolve-factory-assets-root\n */\nexport function resolveFactoryAssetsRoot(): string {\n const hit = resolveFactoryAssetsRootOrNull();\n if (hit) return hit;\n\n throw new Error(\n `Cannot resolve the factory-assets directory. ` +\n `Set SKAILE_FACTORY_ASSETS_DIR to the on-disk path, ` +\n `ensure @skaile/workspaces is installed, ` +\n `or run from within the @skaile/workspaces package tree.`,\n );\n}\n\n/**\n * Non-throwing variant of {@link resolveFactoryAssetsRoot}: the same\n * env-then-packaged resolution tiers, returning `null` instead of throwing when\n * none locate the directory. Callers that treat a missing factory tree as a\n * soft \"not present\" (e.g. the asset-manager's implicit-source injection) MUST\n * use this so they honour the `SKAILE_FACTORY_ASSETS_DIR` container override\n * identically to the runtime path.\n */\nexport function resolveFactoryAssetsRootOrNull(): string | null {\n return factoryAssetRoots()[0] ?? null;\n}\n\n/**\n * Resolve the `@skaile/workspaces` package root — the directory containing its\n * `package.json`. Tries `require.resolve` first (works when installed as a\n * dependency *and* in-repo via the self-reference), then walks upward from this\n * module looking for a `package.json` whose `name` is `@skaile/workspaces`\n * (bounded to 8 levels). Returns `null` when neither locates it.\n *\n * The single source of truth for finding content shipped inside the package —\n * the unified `factory-assets/` tree (built-in connectors + first-party skills\n * + bundles) resolves through {@link resolvePackagedAssetsDir} on top of this.\n *\n * Memoized: the package location is immutable for the process lifetime, but\n * this sits on the CLI hot path (every `findSkills` / flow / completion call\n * funnels through here), so the `require.resolve` + upward `package.json` walk\n * runs once. `undefined` = not yet computed.\n *\n * @docLink packages/core/concepts#resolve-factory-assets-root\n */\nlet workspacesPackageRootCache: string | null | undefined;\n\nexport function resolveWorkspacesPackageRoot(): string | null {\n if (workspacesPackageRootCache !== undefined) return workspacesPackageRootCache;\n workspacesPackageRootCache = computeWorkspacesPackageRoot();\n return workspacesPackageRootCache;\n}\n\nfunction computeWorkspacesPackageRoot(): string | null {\n try {\n const require = createRequire(import.meta.url);\n return dirname(require.resolve(\"@skaile/workspaces/package.json\"));\n } catch {\n // Fall through to the workspace walk.\n }\n let dir: string;\n try {\n dir = dirname(fileURLToPath(import.meta.url));\n } catch {\n return null;\n }\n for (let i = 0; i < 8; i++) {\n const pkgPath = join(dir, \"package.json\");\n if (existsSync(pkgPath)) {\n try {\n const pkg = JSON.parse(readFileSync(pkgPath, \"utf-8\")) as { name?: string };\n if (pkg.name === \"@skaile/workspaces\") return dir;\n } catch {\n // Ignore malformed package.json and keep walking.\n }\n }\n const parent = dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n return null;\n}\n\n/**\n * Locate a content-asset directory inside the package. Prefers the in-repo\n * **source** dir `<pkgRoot>/<subdir>` when present — in a dev checkout it is the\n * full tree (e.g. `factory-assets/` keeps the connector `.ts` entry files that\n * `dist/` does not) — then the published `dist/<subdir>` copy (what\n * `files: [\"dist\"]` ships, the only one present after `npm i`). Returns `null`\n * when neither exists.\n *\n * `factory-assets/` resolves to the source tree in dev (code + skills + bundles)\n * and to `dist/factory-assets` post-install (compiled connectors + copied\n * manifests/skills/bundles).\n *\n * @param subdir - `\"factory-assets\"` | …\n * @docLink packages/core/concepts#resolve-factory-assets-root\n */\nexport function resolvePackagedAssetsDir(subdir: string): string | null {\n const root = resolveWorkspacesPackageRoot();\n if (!root) return null;\n for (const cand of [join(root, subdir), join(root, \"dist\", subdir)]) {\n if (existsSync(cand)) return cand;\n }\n return null;\n}\n\n// ─── Internals ────────────────────────────────────────────────────────────────\n\nconst CONNECTOR_SCAN_KINDS: ReadonlySet<string> = new Set([\"connector\"]);\n\nasync function populate(projectDir: string, target: RuntimeAssetsResult): Promise<void> {\n target.catalogEntries = [];\n target.implicitRefs = [];\n target.requiredNpmDeps = { required: [], optional: [] };\n target.warnings = [];\n\n const config = resolveSkWorkspaceConfig(projectDir);\n // Connector catalog scan runs over the project's declared sources[] (resolved\n // to their machine-cache clone paths) plus the implicit factory-assets repo.\n const repositories = buildEffectiveRepositories(sourcesToDeclarations(config.sources));\n const links = readLinks(projectDir);\n\n // Scan each repository for connector entries.\n for (const [name, decl] of Object.entries(repositories)) {\n const repoDir = await resolveRepoDir(name, decl, projectDir, links);\n if (!repoDir) {\n target.warnings.push({\n code: \"repo_unavailable\",\n name,\n message: repoUnavailableMessage(name, decl),\n });\n continue;\n }\n try {\n // Both factory layers carry the same `factory-assets` provenance — the\n // override repo is an internal scan-order device, not a distinct source.\n const repoName = name === FACTORY_ASSETS_OVERRIDE_REPO_NAME ? FACTORY_ASSETS_REPO_NAME : name;\n // Only connector descriptors are consumed here, so only that kind is\n // \"known\": typed manifests of any other kind are irrelevant to this scan.\n const scanned = await scanDirectory(repoDir, repoName, {\n knownKinds: CONNECTOR_SCAN_KINDS,\n onDiagnostic: () => {},\n });\n const entries = scanned.filter((e) => e.kind === \"connector\");\n target.catalogEntries.push(...entries);\n } catch (err) {\n target.warnings.push({\n code: \"repo_unavailable\",\n name,\n message: `Failed to scan repository \"${name}\" at ${repoDir}: ${\n err instanceof Error ? err.message : String(err)\n }`,\n });\n }\n }\n\n // De-duplicate by (kind, name), keeping the first occurrence. Scan order is\n // declared sources → env override → bundled baseline, so an env-supplied\n // connector manifest overrides the bundled one and the bundled one fills the\n // rest (the override layer can refresh built-in manifests in place).\n const seen = new Set<string>();\n target.catalogEntries = target.catalogEntries.filter((e) => {\n const key = `${e.kind}:${e.name}`;\n if (seen.has(key)) return false;\n seen.add(key);\n return true;\n });\n\n // Derive implicit refs from skaile.yaml connectors.\n for (const c of config.connectors ?? []) {\n target.implicitRefs.push({ kind: \"connector\", name: c.driver, declarationId: c.id });\n }\n\n // Validate refs and aggregate npm deps.\n const requiredSet = new Set<string>();\n const optionalSet = new Set<string>();\n for (const ref of target.implicitRefs) {\n const entry = findCatalogEntry(target.catalogEntries, ref);\n if (!entry) {\n target.warnings.push({\n code: \"missing_driver\",\n declarationId: ref.declarationId,\n name: ref.name,\n message:\n `Unknown ${ref.kind} driver \"${ref.name}\" referenced by ${ref.kind} \"${ref.declarationId}\". ` +\n `Run \\`skaile ${ref.kind} catalog\\` to see available drivers, ` +\n `or declare a repository in skaile.yaml that provides this driver.`,\n });\n continue;\n }\n const npm = (entry.metadata?.npm_deps ?? {}) as { required?: string[]; optional?: string[] };\n for (const p of npm.required ?? []) requiredSet.add(p);\n for (const p of npm.optional ?? []) optionalSet.add(p);\n }\n target.requiredNpmDeps.required = [...requiredSet];\n target.requiredNpmDeps.optional = [...optionalSet];\n}\n\n/**\n * Build the effective `repositories` map: caller's declarations first, then the\n * implicit built-in `factory-assets` repos. Each {@link factoryAssetRoots} layer\n * becomes its own repo, the env override inserted **before** the bundled\n * baseline so its connector entries win on the first-match dedup downstream.\n * When the package cannot be located at all, a path-less sentinel under\n * {@link FACTORY_ASSETS_REPO_NAME} drives the `repo_unavailable` warning.\n */\nfunction buildEffectiveRepositories(\n declared: Record<string, SourceDeclaration> | undefined,\n): Record<string, SourceDeclaration> {\n const result: Record<string, SourceDeclaration> = { ...(declared ?? {}) };\n const roots = factoryAssetRoots();\n if (roots.length === 0) {\n // Surface as a warning during scan rather than throwing here — let the\n // caller decide whether factory-assets is required. resolveRepoDir() /\n // repoUnavailableMessage re-discover the failure and emit it.\n if (!result[FACTORY_ASSETS_REPO_NAME]) result[FACTORY_ASSETS_REPO_NAME] = { path: \"\" };\n return result;\n }\n // override-first when both layers exist, so the env root's entries are scanned\n // (and matched) ahead of the bundled baseline.\n const keys =\n roots.length > 1\n ? [FACTORY_ASSETS_OVERRIDE_REPO_NAME, FACTORY_ASSETS_REPO_NAME]\n : [FACTORY_ASSETS_REPO_NAME];\n roots.forEach((dir, i) => {\n const key = keys[i] ?? `${FACTORY_ASSETS_REPO_NAME}:${i}`;\n if (!result[key]) result[key] = { path: dir };\n });\n return result;\n}\n\n/**\n * Resolve a repository declaration to an on-disk directory. Order:\n * 1. Linked override (`.skaile/links.yaml`).\n * 2. Local `path` — relative to `projectDir`.\n * 3. Cloned URL repo at `.skaile/cache/sources/<name>/` (must already exist).\n *\n * Returns `null` when none of these resolve. Does not clone.\n *\n * **Async and deadline-bounded since #454.** Every candidate here is a\n * project-relative or operator-supplied path, so a `sources[].path` of\n * `workspace/my-assets` resolves onto the rclone FUSE mount — the same tree the\n * scan that follows walks. Probing it with `existsSync`/`lstatSync` would park\n * the `skaile serve` event loop *before* the (now async) scan ever ran, which\n * would leave the H2 fix meaningless on the very declaration that triggers it.\n * A probe that misses its deadline reads as \"unavailable\", which is what the\n * caller already does with an absent path — it becomes a `repo_unavailable`\n * warning rather than a stall.\n */\nasync function resolveRepoDir(\n name: string,\n decl: SourceDeclaration,\n projectDir: string,\n links: Record<string, string>,\n): Promise<string | null> {\n // 1. Linked override\n const linked = links[name];\n if (linked && (await pathExists(linked))) return linked;\n\n // 2. Local path\n if (decl.path) {\n const resolved = resolvePath(projectDir, decl.path);\n return (await pathExists(resolved)) ? resolved : null;\n }\n\n // 3. URL repo cloned to project's .skaile/cache/sources/<name> — the\n // project-local clone dir (often a symlink into the global cache, which\n // lives at getGlobalCacheDir()); NOT the global clone root itself.\n if (decl.url) {\n const projectDest = join(projectDir, \".skaile\", \"cache\", \"sources\", name);\n // One `lstat` answers both questions the pre-#454 `existsSync` + `lstatSync`\n // pair asked, and `lstat` (not `stat`) keeps the \"a symlink into the global\n // cache counts\" behaviour intact.\n const found = await tryWithFsDeadline(\n `lstat ${projectDest}`,\n async () => {\n await lstat(projectDest);\n return true;\n },\n false,\n );\n return found ? projectDest : null;\n }\n\n return null;\n}\n\n/** Deadline-bounded `existsSync` replacement — a wedged mount reads as absent. */\nfunction pathExists(path: string): Promise<boolean> {\n return tryWithFsDeadline(\n `stat ${path}`,\n async () => {\n await stat(path);\n return true;\n },\n false,\n );\n}\n\nfunction repoUnavailableMessage(name: string, decl: SourceDeclaration): string {\n if (name === FACTORY_ASSETS_REPO_NAME && !decl.path && !decl.url) {\n return (\n `Cannot resolve the built-in factory-assets. ` +\n `Set SKAILE_FACTORY_ASSETS_DIR or ensure @skaile/workspaces is installed.`\n );\n }\n if (decl.url) {\n return `Repository \"${name}\" (${decl.url}) is not available. Register it as a Library Source via \\`skaile source add\\`.`;\n }\n if (decl.path) {\n return `Repository \"${name}\" path not found: ${decl.path}`;\n }\n return `Repository \"${name}\" has neither url nor path.`;\n}\n\nfunction findCatalogEntry(\n entries: RuntimeCatalogEntry[],\n query: { kind?: \"connector\"; name: string },\n): RuntimeCatalogEntry | undefined {\n if (query.kind) {\n return entries.find((e) => e.kind === query.kind && e.name === query.name);\n }\n const matches = entries.filter((e) => e.name === query.name);\n if (matches.length === 1) return matches[0];\n // 0 or >1 with no kind — caller must disambiguate.\n return undefined;\n}\n"]}
1
+ {"version":3,"sources":["../core/src/runtime-assets.ts"],"names":["resolvePath","require"],"mappings":";;;;;;;;AAsDA,SAAS,sBACP,OAAA,EACmC;AACnC,EAAA,MAAM,aAAa,iBAAA,EAAkB;AACrC,EAAA,MAAM,MAAyC,EAAC;AAChD,EAAA,KAAA,MAAW,CAAA,IAAK,OAAA,IAAW,EAAC,EAAG;AAC7B,IAAA,MAAM,GAAA,GAAM,cAAA,CAAe,CAAA,CAAE,GAAG,CAAA;AAChC,IAAA,IAAI,GAAA,CAAI,GAAG,CAAA,EAAG;AACd,IAAA,GAAA,CAAI,GAAG,CAAA,GAAI,EAAE,IAAA,EAAM,IAAA,CAAK,UAAA,EAAY,GAAG,CAAA,EAAG,GAAA,EAAK,CAAA,CAAE,GAAA,EAAK,MAAA,EAAQ,EAAE,GAAA,EAAI;AAAA,EACtE;AACA,EAAA,OAAO,GAAA;AACT;AAqDO,IAAM,wBAAA,GAA2B;AAMxC,IAAM,iCAAA,GAAoC,yBAAA;AAsC1C,eAAsB,qBAAqB,UAAA,EAAkD;AAC3F,EAAA,MAAM,MAAA,GAA8B;AAAA,IAClC,gBAAgB,EAAC;AAAA,IACjB,cAAc,EAAC;AAAA,IACf,iBAAiB,EAAE,QAAA,EAAU,EAAC,EAAG,QAAA,EAAU,EAAC,EAAE;AAAA,IAC9C,UAAU,EAAC;AAAA,IACX,SAAS,YAAY;AACnB,MAAA,MAAM,QAAA,CAAS,YAAY,MAAM,CAAA;AAAA,IACnC,CAAA;AAAA,IACA,WAAW,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n * (including the built-in `factory-assets/` directory as an implicit default),\n * and produce a unified view of connector catalog entries plus the implicit refs\n * that the `skaile.yaml` `connectors:` section adds to the dependency graph.\n *\n * This module is the single source of truth for \"which connectors does this\n * project see at runtime, and where do their implementations live on disk\".\n * Both the runner (serve, REPL, flow) and the platform's mid-session\n * `add_resource` flow consume `RuntimeAssetsResult.catalogEntries` and pass\n * it into `ConnectorManager` for catalog-based resolution.\n *\n * `factory-assets/` is the single first-party content tree (built-in connectors\n * + first-party skills + bundles) shipped inside the `@skaile/workspaces`\n * package — not a standalone package.\n *\n * It resolves to an **ordered list of roots** ({@link factoryAssetRoots}), not a\n * single dir. The bundled tree is always the baseline; an optional\n * `SKAILE_FACTORY_ASSETS_DIR` (legacy: `SKAILE_BASE_ASSETS_DIR`) is layered\n * **in front** as an additive override source — the agent container points it at\n * `/app/factory-assets/` (or a bind-mounted host dir) to ship updated skills /\n * flows / bundles / connector manifests without rebuilding the image. The two\n * roots resolve uniformly across every consumer (connector catalog scan, skill /\n * flow / completion discovery, the asset-manager factory source):\n * 1. `SKAILE_FACTORY_ASSETS_DIR` env dir, when set and existing (override layer).\n * 2. the bundled tree via {@link resolvePackagedAssetsDir} — the in-repo source\n * `packages/workspaces/factory-assets/` during dev, else the published\n * `dist/factory-assets/` after install (always-present baseline).\n *\n * Override semantics are **env-first**: on a name conflict the env root wins and\n * the bundled root fills the rest. Connector *code* still loads via the package's\n * static `exports` map, so the env root can override/add skills, flows, bundles,\n * and connector **manifests/metadata**, but cannot ship a new executable\n * connector — its `.js` is not on the package's import graph.\n */\n\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { lstat, stat } from \"node:fs/promises\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join, resolve as resolvePath } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { tryWithFsDeadline } from \"./fs-deadline.js\";\nimport { scanDirectory } from \"./manifest.js\";\nimport type { CatalogEntry } from \"./models.js\";\nimport { getGlobalCacheDir, readLinks, sourceCacheKey } from \"./repo-manager.js\";\nimport type { SourceDeclaration, SourceEntry } from \"./workspace-config.js\";\nimport { resolveSkWorkspaceConfig } from \"./workspace-config.js\";\n\n/**\n * Map declared `sources[]` to internal `SourceDeclaration`s keyed by the\n * collision-free {@link sourceCacheKey} (`<host>/<owner>/<repo>`), pointing at\n * the unified machine-cache clone path (`getGlobalCacheDir()/<key>/`). Keyed by\n * the same function every other cache writer/reader uses so the path resolves.\n */\nfunction sourcesToDeclarations(\n sources: SourceEntry[] | undefined,\n): Record<string, SourceDeclaration> {\n const sourcesDir = getGlobalCacheDir();\n const out: Record<string, SourceDeclaration> = {};\n for (const s of sources ?? []) {\n const key = sourceCacheKey(s.url);\n if (out[key]) continue;\n out[key] = { path: join(sourcesDir, key), url: s.url, branch: s.pin };\n }\n return out;\n}\n\n// ─── Types ────────────────────────────────────────────────────────────────────\n\n/**\n * Catalog entry filtered to mount/connector kinds. Same shape as `CatalogEntry`.\n * @docLink packages/core/concepts#runtime-catalog-entry\n */\nexport type RuntimeCatalogEntry = CatalogEntry;\n\n/**\n * Implicit catalog reference derived from a `connectors:` declaration in `skaile.yaml`.\n * Each connector driver becomes an implicit ref that must be resolved in the catalog.\n * @docLink packages/core/concepts#runtime-asset-ref\n */\nexport interface RuntimeAssetRef {\n kind: \"connector\";\n /** Driver name — matches `RuntimeCatalogEntry.name`. */\n name: string;\n /** Source declaration id from `skaile.yaml`. */\n declarationId: string;\n}\n\n/**\n * Aggregated npm packages required by all resolved mount/connector adapters.\n * Populated from `metadata.npm_deps` in each matched catalog entry.\n * @docLink packages/core/concepts#runtime-npm-deps\n */\nexport interface RuntimeNpmDeps {\n required: string[];\n optional: string[];\n}\n\n/**\n * Non-fatal warning emitted during `resolveRuntimeAssets` when a repo is unavailable\n * or a driver is not found in any catalog.\n * @docLink packages/core/concepts#runtime-asset-warning\n */\nexport interface RuntimeAssetWarning {\n /** Stable code for filtering / structured logging. */\n code: \"missing_driver\" | \"repo_unavailable\" | \"invalid_repo_decl\";\n message: string;\n /** Declaration id when applicable. */\n declarationId?: string;\n /** Driver / repository name when applicable. */\n name?: string;\n}\n\n/**\n * Repository name used for the implicit built-in `factory-assets` catalog entry\n * (the in-package connector tree).\n * @docLink packages/core/concepts#factory-assets-repo-name\n */\nexport const FACTORY_ASSETS_REPO_NAME = \"factory-assets\";\n\n/**\n * Repository name for the optional `SKAILE_FACTORY_ASSETS_DIR` override layer,\n * scanned ahead of (and overriding) the bundled {@link FACTORY_ASSETS_REPO_NAME}.\n */\nconst FACTORY_ASSETS_OVERRIDE_REPO_NAME = \"factory-assets:override\";\n\n/**\n * Result of `resolveRuntimeAssets`.\n * The same object is mutated in place by `refresh()`, allowing callers to hold\n * a stable reference and observe updates after a new repository is cloned or\n * a driver is installed mid-session.\n * @docLink packages/core/concepts#runtime-assets-result\n */\nexport interface RuntimeAssetsResult {\n catalogEntries: RuntimeCatalogEntry[];\n implicitRefs: RuntimeAssetRef[];\n requiredNpmDeps: RuntimeNpmDeps;\n warnings: RuntimeAssetWarning[];\n /** Re-scan repositories and re-derive implicit refs. Mutates in place. */\n refresh(): Promise<void>;\n /**\n * Catalog lookup. When `kind` is omitted and multiple entries share the\n * `name`, returns `undefined` (caller must disambiguate).\n */\n findEntry(query: { kind?: \"connector\"; name: string }): RuntimeCatalogEntry | undefined;\n}\n\n// ─── Public API ───────────────────────────────────────────────────────────────\n\n/**\n * Resolve all runtime assets visible to a project by scanning declared repositories.\n *\n * Reads `skaile.yaml`, scans every declared repository (plus the implicit\n * built-in `factory-assets` repo), and derives implicit refs from `mounts:` /\n * `connectors:` declarations. Does not clone or install anything — purely a\n * read-only scan of what is already on disk. URL-only repositories that have\n * not been cloned yet are reported as `repo_unavailable` warnings.\n *\n * @param projectDir - Absolute path to the project workspace root\n * @returns `RuntimeAssetsResult` with catalog entries, implicit refs, npm deps, and warnings\n * @docLink packages/core/concepts#resolve-runtime-assets\n */\nexport async function resolveRuntimeAssets(projectDir: string): Promise<RuntimeAssetsResult> {\n const result: RuntimeAssetsResult = {\n catalogEntries: [],\n implicitRefs: [],\n requiredNpmDeps: { required: [], optional: [] },\n warnings: [],\n refresh: async () => {\n await populate(projectDir, result);\n },\n findEntry: (query) => findCatalogEntry(result.catalogEntries, query),\n };\n\n await populate(projectDir, result);\n return result;\n}\n\n/**\n * Resolve the ordered list of on-disk roots for the built-in `factory-assets`\n * tree (built-in connectors + first-party skills + bundles). This is the single\n * shared resolver every consumer goes through, so the env override and the\n * bundled baseline are honoured uniformly.\n *\n * Order (env-first = override-wins):\n * 1. `SKAILE_FACTORY_ASSETS_DIR` env dir (legacy: `SKAILE_BASE_ASSETS_DIR`),\n * when set and existing — an additive override layer.\n * 2. {@link resolvePackagedAssetsDir} — the bundled tree (in-repo source in dev,\n * `dist/factory-assets/` after install). Always-present baseline.\n *\n * Returns `[]` only when the package cannot be located at all. De-duplicated, so\n * pointing the env var at the bundled dir collapses to one root.\n *\n * @docLink packages/core/concepts#resolve-factory-assets-root\n */\nexport function factoryAssetRoots(): string[] {\n const roots: string[] = [];\n const envDir = process.env.SKAILE_FACTORY_ASSETS_DIR ?? process.env.SKAILE_BASE_ASSETS_DIR;\n // Deliberately still synchronous after #454: both candidates are\n // container-local (the image's `/app/factory-assets/`, or the installed\n // package tree resolved by `resolvePackagedAssetsDir`), never the FUSE\n // workspace mount. The mount-reachable probes on this module's scan path —\n // the project-relative `sources[].path` candidates in `resolveRepoDir` — are\n // async and deadline-bounded.\n if (envDir && existsSync(envDir)) roots.push(resolvePath(envDir));\n const bundled = resolvePackagedAssetsDir(\"factory-assets\");\n if (bundled) roots.push(bundled);\n return [...new Set(roots)];\n}\n\n/**\n * Resolve the primary on-disk root of the `factory-assets` tree — the first of\n * {@link factoryAssetRoots} (the env override when set, else the bundled tree).\n * Prefer {@link factoryAssetRoots} when you need to scan every layer; this\n * single-dir form is for callers that want one canonical path.\n *\n * @returns Absolute path to the highest-precedence `factory-assets` directory\n * @throws When no root can be located\n * @docLink packages/core/concepts#resolve-factory-assets-root\n */\nexport function resolveFactoryAssetsRoot(): string {\n const hit = resolveFactoryAssetsRootOrNull();\n if (hit) return hit;\n\n throw new Error(\n `Cannot resolve the factory-assets directory. ` +\n `Set SKAILE_FACTORY_ASSETS_DIR to the on-disk path, ` +\n `ensure @skaile/workspaces is installed, ` +\n `or run from within the @skaile/workspaces package tree.`,\n );\n}\n\n/**\n * Non-throwing variant of {@link resolveFactoryAssetsRoot}: the same\n * env-then-packaged resolution tiers, returning `null` instead of throwing when\n * none locate the directory. Callers that treat a missing factory tree as a\n * soft \"not present\" (e.g. the asset-manager's implicit-source injection) MUST\n * use this so they honour the `SKAILE_FACTORY_ASSETS_DIR` container override\n * identically to the runtime path.\n */\nexport function resolveFactoryAssetsRootOrNull(): string | null {\n return factoryAssetRoots()[0] ?? null;\n}\n\n/**\n * Resolve the `@skaile/workspaces` package root — the directory containing its\n * `package.json`. Tries `require.resolve` first (works when installed as a\n * dependency *and* in-repo via the self-reference), then walks upward from this\n * module looking for a `package.json` whose `name` is `@skaile/workspaces`\n * (bounded to 8 levels). Returns `null` when neither locates it.\n *\n * The single source of truth for finding content shipped inside the package —\n * the unified `factory-assets/` tree (built-in connectors + first-party skills\n * + bundles) resolves through {@link resolvePackagedAssetsDir} on top of this.\n *\n * Memoized: the package location is immutable for the process lifetime, but\n * this sits on the CLI hot path (every `findSkills` / flow / completion call\n * funnels through here), so the `require.resolve` + upward `package.json` walk\n * runs once. `undefined` = not yet computed.\n *\n * @docLink packages/core/concepts#resolve-factory-assets-root\n */\nlet workspacesPackageRootCache: string | null | undefined;\n\nexport function resolveWorkspacesPackageRoot(): string | null {\n if (workspacesPackageRootCache !== undefined) return workspacesPackageRootCache;\n workspacesPackageRootCache = computeWorkspacesPackageRoot();\n return workspacesPackageRootCache;\n}\n\nfunction computeWorkspacesPackageRoot(): string | null {\n try {\n const require = createRequire(import.meta.url);\n return dirname(require.resolve(\"@skaile/workspaces/package.json\"));\n } catch {\n // Fall through to the workspace walk.\n }\n let dir: string;\n try {\n dir = dirname(fileURLToPath(import.meta.url));\n } catch {\n return null;\n }\n for (let i = 0; i < 8; i++) {\n const pkgPath = join(dir, \"package.json\");\n if (existsSync(pkgPath)) {\n try {\n const pkg = JSON.parse(readFileSync(pkgPath, \"utf-8\")) as { name?: string };\n if (pkg.name === \"@skaile/workspaces\") return dir;\n } catch {\n // Ignore malformed package.json and keep walking.\n }\n }\n const parent = dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n return null;\n}\n\n/**\n * Locate a content-asset directory inside the package. Prefers the in-repo\n * **source** dir `<pkgRoot>/<subdir>` when present — in a dev checkout it is the\n * full tree (e.g. `factory-assets/` keeps the connector `.ts` entry files that\n * `dist/` does not) — then the published `dist/<subdir>` copy (what\n * `files: [\"dist\"]` ships, the only one present after `npm i`). Returns `null`\n * when neither exists.\n *\n * `factory-assets/` resolves to the source tree in dev (code + skills + bundles)\n * and to `dist/factory-assets` post-install (compiled connectors + copied\n * manifests/skills/bundles).\n *\n * @param subdir - `\"factory-assets\"` | …\n * @docLink packages/core/concepts#resolve-factory-assets-root\n */\nexport function resolvePackagedAssetsDir(subdir: string): string | null {\n const root = resolveWorkspacesPackageRoot();\n if (!root) return null;\n for (const cand of [join(root, subdir), join(root, \"dist\", subdir)]) {\n if (existsSync(cand)) return cand;\n }\n return null;\n}\n\n// ─── Internals ────────────────────────────────────────────────────────────────\n\nconst CONNECTOR_SCAN_KINDS: ReadonlySet<string> = new Set([\"connector\"]);\n\nasync function populate(projectDir: string, target: RuntimeAssetsResult): Promise<void> {\n target.catalogEntries = [];\n target.implicitRefs = [];\n target.requiredNpmDeps = { required: [], optional: [] };\n target.warnings = [];\n\n const config = resolveSkWorkspaceConfig(projectDir);\n // Connector catalog scan runs over the project's declared sources[] (resolved\n // to their machine-cache clone paths) plus the implicit factory-assets repo.\n const repositories = buildEffectiveRepositories(sourcesToDeclarations(config.sources));\n const links = readLinks(projectDir);\n\n // Scan each repository for connector entries.\n for (const [name, decl] of Object.entries(repositories)) {\n const repoDir = await resolveRepoDir(name, decl, projectDir, links);\n if (!repoDir) {\n target.warnings.push({\n code: \"repo_unavailable\",\n name,\n message: repoUnavailableMessage(name, decl),\n });\n continue;\n }\n try {\n // Both factory layers carry the same `factory-assets` provenance — the\n // override repo is an internal scan-order device, not a distinct source.\n const repoName = name === FACTORY_ASSETS_OVERRIDE_REPO_NAME ? FACTORY_ASSETS_REPO_NAME : name;\n // Only connector descriptors are consumed here, so only that kind is\n // \"known\": typed manifests of any other kind are irrelevant to this scan.\n const scanned = await scanDirectory(repoDir, repoName, {\n knownKinds: CONNECTOR_SCAN_KINDS,\n onDiagnostic: () => {},\n });\n const entries = scanned.filter((e) => e.kind === \"connector\");\n target.catalogEntries.push(...entries);\n } catch (err) {\n target.warnings.push({\n code: \"repo_unavailable\",\n name,\n message: `Failed to scan repository \"${name}\" at ${repoDir}: ${\n err instanceof Error ? err.message : String(err)\n }`,\n });\n }\n }\n\n // De-duplicate by (kind, name), keeping the first occurrence. Scan order is\n // declared sources → env override → bundled baseline, so an env-supplied\n // connector manifest overrides the bundled one and the bundled one fills the\n // rest (the override layer can refresh built-in manifests in place).\n const seen = new Set<string>();\n target.catalogEntries = target.catalogEntries.filter((e) => {\n const key = `${e.kind}:${e.name}`;\n if (seen.has(key)) return false;\n seen.add(key);\n return true;\n });\n\n // Derive implicit refs from skaile.yaml connectors.\n for (const c of config.connectors ?? []) {\n target.implicitRefs.push({ kind: \"connector\", name: c.driver, declarationId: c.id });\n }\n\n // Validate refs and aggregate npm deps.\n const requiredSet = new Set<string>();\n const optionalSet = new Set<string>();\n for (const ref of target.implicitRefs) {\n const entry = findCatalogEntry(target.catalogEntries, ref);\n if (!entry) {\n target.warnings.push({\n code: \"missing_driver\",\n declarationId: ref.declarationId,\n name: ref.name,\n message:\n `Unknown ${ref.kind} driver \"${ref.name}\" referenced by ${ref.kind} \"${ref.declarationId}\". ` +\n `Run \\`skaile ${ref.kind} catalog\\` to see available drivers, ` +\n `or declare a repository in skaile.yaml that provides this driver.`,\n });\n continue;\n }\n const npm = (entry.metadata?.npm_deps ?? {}) as { required?: string[]; optional?: string[] };\n for (const p of npm.required ?? []) requiredSet.add(p);\n for (const p of npm.optional ?? []) optionalSet.add(p);\n }\n target.requiredNpmDeps.required = [...requiredSet];\n target.requiredNpmDeps.optional = [...optionalSet];\n}\n\n/**\n * Build the effective `repositories` map: caller's declarations first, then the\n * implicit built-in `factory-assets` repos. Each {@link factoryAssetRoots} layer\n * becomes its own repo, the env override inserted **before** the bundled\n * baseline so its connector entries win on the first-match dedup downstream.\n * When the package cannot be located at all, a path-less sentinel under\n * {@link FACTORY_ASSETS_REPO_NAME} drives the `repo_unavailable` warning.\n */\nfunction buildEffectiveRepositories(\n declared: Record<string, SourceDeclaration> | undefined,\n): Record<string, SourceDeclaration> {\n const result: Record<string, SourceDeclaration> = { ...(declared ?? {}) };\n const roots = factoryAssetRoots();\n if (roots.length === 0) {\n // Surface as a warning during scan rather than throwing here — let the\n // caller decide whether factory-assets is required. resolveRepoDir() /\n // repoUnavailableMessage re-discover the failure and emit it.\n if (!result[FACTORY_ASSETS_REPO_NAME]) result[FACTORY_ASSETS_REPO_NAME] = { path: \"\" };\n return result;\n }\n // override-first when both layers exist, so the env root's entries are scanned\n // (and matched) ahead of the bundled baseline.\n const keys =\n roots.length > 1\n ? [FACTORY_ASSETS_OVERRIDE_REPO_NAME, FACTORY_ASSETS_REPO_NAME]\n : [FACTORY_ASSETS_REPO_NAME];\n roots.forEach((dir, i) => {\n const key = keys[i] ?? `${FACTORY_ASSETS_REPO_NAME}:${i}`;\n if (!result[key]) result[key] = { path: dir };\n });\n return result;\n}\n\n/**\n * Resolve a repository declaration to an on-disk directory. Order:\n * 1. Linked override (`.skaile/links.yaml`).\n * 2. Local `path` — relative to `projectDir`.\n * 3. Cloned URL repo at `.skaile/cache/sources/<name>/` (must already exist).\n *\n * Returns `null` when none of these resolve. Does not clone.\n *\n * **Async and deadline-bounded since #454.** Every candidate here is a\n * project-relative or operator-supplied path, so a `sources[].path` of\n * `workspace/my-assets` resolves onto the rclone FUSE mount — the same tree the\n * scan that follows walks. Probing it with `existsSync`/`lstatSync` would park\n * the `skaile serve` event loop *before* the (now async) scan ever ran, which\n * would leave the H2 fix meaningless on the very declaration that triggers it.\n * A probe that misses its deadline reads as \"unavailable\", which is what the\n * caller already does with an absent path — it becomes a `repo_unavailable`\n * warning rather than a stall.\n */\nasync function resolveRepoDir(\n name: string,\n decl: SourceDeclaration,\n projectDir: string,\n links: Record<string, string>,\n): Promise<string | null> {\n // 1. Linked override\n const linked = links[name];\n if (linked && (await pathExists(linked))) return linked;\n\n // 2. Local path\n if (decl.path) {\n const resolved = resolvePath(projectDir, decl.path);\n return (await pathExists(resolved)) ? resolved : null;\n }\n\n // 3. URL repo cloned to project's .skaile/cache/sources/<name> — the\n // project-local clone dir (often a symlink into the global cache, which\n // lives at getGlobalCacheDir()); NOT the global clone root itself.\n if (decl.url) {\n const projectDest = join(projectDir, \".skaile\", \"cache\", \"sources\", name);\n // One `lstat` answers both questions the pre-#454 `existsSync` + `lstatSync`\n // pair asked, and `lstat` (not `stat`) keeps the \"a symlink into the global\n // cache counts\" behaviour intact.\n const found = await tryWithFsDeadline(\n `lstat ${projectDest}`,\n async () => {\n await lstat(projectDest);\n return true;\n },\n false,\n );\n return found ? projectDest : null;\n }\n\n return null;\n}\n\n/** Deadline-bounded `existsSync` replacement — a wedged mount reads as absent. */\nfunction pathExists(path: string): Promise<boolean> {\n return tryWithFsDeadline(\n `stat ${path}`,\n async () => {\n await stat(path);\n return true;\n },\n false,\n );\n}\n\nfunction repoUnavailableMessage(name: string, decl: SourceDeclaration): string {\n if (name === FACTORY_ASSETS_REPO_NAME && !decl.path && !decl.url) {\n return (\n `Cannot resolve the built-in factory-assets. ` +\n `Set SKAILE_FACTORY_ASSETS_DIR or ensure @skaile/workspaces is installed.`\n );\n }\n if (decl.url) {\n return `Repository \"${name}\" (${decl.url}) is not available. Register it as a Library Source via \\`skaile source add\\`.`;\n }\n if (decl.path) {\n return `Repository \"${name}\" path not found: ${decl.path}`;\n }\n return `Repository \"${name}\" has neither url nor path.`;\n}\n\nfunction findCatalogEntry(\n entries: RuntimeCatalogEntry[],\n query: { kind?: \"connector\"; name: string },\n): RuntimeCatalogEntry | undefined {\n if (query.kind) {\n return entries.find((e) => e.kind === query.kind && e.name === query.name);\n }\n const matches = entries.filter((e) => e.name === query.name);\n if (matches.length === 1) return matches[0];\n // 0 or >1 with no kind — caller must disambiguate.\n return undefined;\n}\n"]}
@@ -1,14 +1,17 @@
1
1
  import { resolveFragments, loadPromptExtensions } from './chunk-CGYEHQOX.js';
2
- import { renderAgentToFramework, CODEX_IDENTITY_DIR } from './chunk-EF7NPDDU.js';
3
- import { SKILL_DESCRIPTION_PLACEHOLDER_PREFIX, SKILL_DESCRIPTION_PLACEHOLDER, PRESET_DESCRIPTION_PLACEHOLDER, PRESET_ITEM_PLACEHOLDER_REF, SKILL_BODY_PLACEHOLDER } from './chunk-B6GIW55K.js';
4
- import { computeHash, applyPatch } from './chunk-36AFURKZ.js';
5
- import { deployedBase, deployedDir, isDeployed, deployedPaths } from './chunk-PMECEZK3.js';
6
- import { resolveSkWorkspaceConfig, agentSourceCacheDir, resolveAgentDefinitionDir, AGENT_INSTANCE_ID_PATTERN } from './chunk-JAKOMFC6.js';
2
+ import { renderAgentToFramework, CODEX_IDENTITY_DIR } from './chunk-HZXUXHIV.js';
3
+ import { SKILL_DESCRIPTION_PLACEHOLDER_PREFIX, SKILL_DESCRIPTION_PLACEHOLDER, PRESET_ITEM_PLACEHOLDER_REF, AGENT_BODY_PLACEHOLDER, PROMPT_BODY_PLACEHOLDER, CONTRACT_BODY_PLACEHOLDER, SKILL_BODY_PLACEHOLDER } from './chunk-ZCAJZ4B2.js';
4
+ import { computeHash, applyPatch } from './chunk-PBBPZYVG.js';
5
+ import { deployedDir, deployedBase, isDeployed, deployedPaths } from './chunk-PMECEZK3.js';
6
+ import { resolveSkWorkspaceConfig, agentSourceCacheDir, resolveAgentDefinitionDir, AGENT_INSTANCE_ID_PATTERN } from './chunk-ALEYHUC5.js';
7
7
  import { DRIVER_TARGETS } from './chunk-CPSIPIX7.js';
8
- import { parseFrontmatter } from './chunk-GTILM2CI.js';
9
- import { assetRefToStr, parseAssetRefLoose } from './chunk-QVNRCDTV.js';
10
- import { statSync, mkdirSync, lstatSync, existsSync, unlinkSync, rmSync, writeFileSync, readFileSync, symlinkSync, cpSync, readdirSync } from 'fs';
11
- import { resolve, basename, dirname, join, relative } from 'path';
8
+ import { listAssetFiles, isNonAssetDir, isNonAssetFile, isEnvFileName, listSkippedSymlinks, listEnvFiles } from './chunk-ZPWTOUTK.js';
9
+ import { parseFrontmatter } from './chunk-SBSA3IQA.js';
10
+ import { assetRefToStr, parseAssetRefLoose } from './chunk-BNMZVPYA.js';
11
+ import { spawnSync } from 'child_process';
12
+ import { lstatSync, existsSync, statSync, mkdirSync, mkdtempSync, readdirSync, rmSync, unlinkSync, writeFileSync, readFileSync, symlinkSync, cpSync } from 'fs';
13
+ import { tmpdir } from 'os';
14
+ import { resolve, basename, join, dirname, sep, relative } from 'path';
12
15
  import { parse, stringify } from 'yaml';
13
16
 
14
17
  var AGENT_MD_FILE = "AGENT.md";
@@ -211,14 +214,15 @@ function buildFragmentContext(subAgentNames, driverTarget, skillsRelDir, wsConfi
211
214
  }
212
215
  function installAgent(srcDir, agentDeployDir, workspaceRoot, driverTarget, skillsRelDir, nameOverride, includeSubAgents, visited, wsConfig, log, instance) {
213
216
  const created = [];
217
+ const changed = [];
214
218
  const warnings = [];
215
219
  const realSrc = resolve(srcDir);
216
- if (visited.has(realSrc)) return { created, warnings };
220
+ if (visited.has(realSrc)) return { created, changed, warnings };
217
221
  visited.add(realSrc);
218
222
  const initialManifest = readManifest(srcDir);
219
223
  if (!initialManifest) {
220
224
  warnings.push(`${srcDir} has no agent.yaml or AGENT.md \u2014 skipping (not an agent package)`);
221
- return { created, warnings };
225
+ return { created, changed, warnings };
222
226
  }
223
227
  const { manifest, lifecycle } = applyInstanceOverrides(
224
228
  applyExtendsMerge(initialManifest, srcDir, warnings),
@@ -229,7 +233,7 @@ function installAgent(srcDir, agentDeployDir, workspaceRoot, driverTarget, skill
229
233
  warnings.push(
230
234
  `${srcDir}: agent name ${JSON.stringify(agentName)} is not a valid file name (no path separators) \u2014 skipping`
231
235
  );
232
- return { created, warnings };
236
+ return { created, changed, warnings };
233
237
  }
234
238
  log?.(`Installing git-agent: ${agentName} (${driverTarget})`);
235
239
  const abilityRefs = resolveAbilityRefs(manifest, workspaceRoot, skillsRelDir);
@@ -270,6 +274,7 @@ function installAgent(srcDir, agentDeployDir, workspaceRoot, driverTarget, skill
270
274
  };
271
275
  const result = renderAgentToFramework(input, driverTarget, log);
272
276
  created.push(...result.created);
277
+ changed.push(...result.changed);
273
278
  warnings.push(...result.warnings);
274
279
  if (includeSubAgents) {
275
280
  for (const delegate of delegates) {
@@ -287,10 +292,11 @@ function installAgent(srcDir, agentDeployDir, workspaceRoot, driverTarget, skill
287
292
  log
288
293
  );
289
294
  created.push(...sub.created);
295
+ changed.push(...sub.changed);
290
296
  warnings.push(...sub.warnings);
291
297
  }
292
298
  }
293
- return { created, warnings };
299
+ return { created, changed, warnings };
294
300
  }
295
301
 
296
302
  // asset-manager/src/installer.ts
@@ -323,12 +329,28 @@ function manifestFileOf(provider, source) {
323
329
  const hit = readdirSync(source).find((f) => provider.matchesPath(f));
324
330
  return hit ? join(source, hit) : void 0;
325
331
  }
326
- function copyAsset(provider, entry, dest) {
332
+ function copyAsset(provider, entry, dest, onSkippedSymlink, onEnvFile) {
327
333
  const source = entry.source;
328
334
  clearDest(dest);
329
335
  const manifestPath = manifestFileOf(provider, source);
330
336
  if (!manifestPath) {
331
- cpSync(source, dest, { recursive: true });
337
+ cpSync(source, dest, {
338
+ recursive: true,
339
+ filter: (src) => {
340
+ if (src === source) return true;
341
+ if (isNonAssetDir(basename(src)) || isNonAssetFile(basename(src))) {
342
+ if (isEnvFileName(basename(src))) {
343
+ onEnvFile?.(entry, join(basename(source), relative(source, src)));
344
+ }
345
+ return false;
346
+ }
347
+ if (lstatSync(src).isSymbolicLink()) {
348
+ onSkippedSymlink?.(entry, join(basename(source), relative(source, src)));
349
+ return false;
350
+ }
351
+ return true;
352
+ }
353
+ });
332
354
  return;
333
355
  }
334
356
  const filter = provider.defaultFileFilter(manifestPath);
@@ -340,6 +362,16 @@ function copyAsset(provider, entry, dest) {
340
362
  mkdirSync(dirname(target), { recursive: true });
341
363
  cpSync(join(assetRoot, rel), target);
342
364
  }
365
+ if (files.length > 1 || basename(assetRoot) === entry.name) {
366
+ if (onSkippedSymlink) {
367
+ for (const rel of listSkippedSymlinks(assetRoot)) {
368
+ onSkippedSymlink(entry, join(basename(assetRoot), rel));
369
+ }
370
+ }
371
+ if (onEnvFile) {
372
+ for (const rel of listEnvFiles(assetRoot)) onEnvFile(entry, join(basename(assetRoot), rel));
373
+ }
374
+ }
343
375
  }
344
376
  function symlinkAsset(provider, source, dest, name) {
345
377
  clearDest(dest);
@@ -357,6 +389,37 @@ function symlinkAsset(provider, source, dest, name) {
357
389
  symlinkSync(resolve(manifestPath), join(dest, basename(manifestPath)));
358
390
  }
359
391
  }
392
+ function deployedAssetDrift(entry, opts) {
393
+ const provider = opts.registry.getProvider(entry.kind);
394
+ const component = provider?.installTarget;
395
+ if (!provider || !component || component === "agent") return null;
396
+ const dest = deployedDir(
397
+ component,
398
+ entry.name,
399
+ opts.driverTarget ?? "claude-code",
400
+ opts.global ?? false,
401
+ opts.cwd
402
+ );
403
+ try {
404
+ const deployed = lstatSync(dest);
405
+ if (deployed.isSymbolicLink() || !deployed.isDirectory()) return null;
406
+ const manifestPath = manifestFileOf(provider, entry.source);
407
+ const filter = manifestPath ? provider.defaultFileFilter(manifestPath) : void 0;
408
+ const assetRoot = filter ? filter.assetRoot : entry.source;
409
+ const files = filter ? entry.files ?? filter.files : listAssetFiles(entry.source);
410
+ const modified = [];
411
+ for (const rel of files) {
412
+ const deployedFile = join(dest, rel);
413
+ if (!existsSync(deployedFile)) continue;
414
+ if (computeHash(join(assetRoot, rel)) !== computeHash(deployedFile)) modified.push(rel);
415
+ }
416
+ const expected = new Set(files);
417
+ const extra = listAssetFiles(dest).filter((rel) => !expected.has(rel));
418
+ return { modified, extra };
419
+ } catch {
420
+ return null;
421
+ }
422
+ }
360
423
  function materializeAgentSource(provider, entry, srcDir, workspaceRoot, log) {
361
424
  const dest = join(agentSourceCacheDir(workspaceRoot), entry.name);
362
425
  try {
@@ -378,12 +441,15 @@ function materializeAgentSource(provider, entry, srcDir, workspaceRoot, log) {
378
441
  }
379
442
  }
380
443
  function deployAsset(entry, repositories, opts, log = noop) {
444
+ return deployEntry(entry, repositories, opts, log).deployed;
445
+ }
446
+ function deployEntry(entry, repositories, opts, log) {
381
447
  const driverTarget = opts.driverTarget ?? "claude-code";
382
448
  const globalInstall = opts.global ?? false;
383
449
  const cwd = opts.cwd;
384
450
  const provider = opts.registry.getProvider(entry.kind);
385
451
  const component = provider?.installTarget;
386
- if (!provider || !component) return true;
452
+ if (!provider || !component) return { deployed: true, changed: false };
387
453
  if (component === "agent") {
388
454
  const workspaceRoot = cwd ?? process.cwd();
389
455
  const agentDeployDir = deployedBase(
@@ -411,9 +477,14 @@ function deployAsset(entry, repositories, opts, log = noop) {
411
477
  );
412
478
  for (const w of result.warnings) log(` warn: ${w}`);
413
479
  if (result.created.length > 0) {
414
- if (driverTarget !== "omp") clearDest(join(agentDeployDir, entry.name));
480
+ let changed = result.changed.length > 0;
481
+ const staleRawCopy = join(agentDeployDir, entry.name);
482
+ if (driverTarget !== "omp" && existsSync(staleRawCopy)) {
483
+ clearDest(staleRawCopy);
484
+ changed = true;
485
+ }
415
486
  if (!globalInstall) materializeAgentSource(provider, entry, srcDir, workspaceRoot, log);
416
- return true;
487
+ return { deployed: true, changed };
417
488
  }
418
489
  }
419
490
  const dest = deployedDir(component, entry.name, driverTarget, globalInstall, cwd);
@@ -424,10 +495,10 @@ function deployAsset(entry, repositories, opts, log = noop) {
424
495
  symlinkAsset(provider, entry.source, dest, entry.name);
425
496
  log(` symlink ${entry.kind}:${entry.name}`);
426
497
  } else {
427
- copyAsset(provider, entry, dest);
498
+ copyAsset(provider, entry, dest, opts.onSkippedSymlink, opts.onEnvFile);
428
499
  log(` copy ${entry.kind}:${entry.name}`);
429
500
  }
430
- return true;
501
+ return { deployed: true, changed: true };
431
502
  }
432
503
  function deployAll(resolved, repositories, patches, opts, log = noop) {
433
504
  const deployed = [];
@@ -467,7 +538,8 @@ function deployAll(resolved, repositories, patches, opts, log = noop) {
467
538
  return false;
468
539
  }
469
540
  });
470
- if (manifestUnchanged && companionsUnchanged) {
541
+ const strayFiles = deployedAssetDrift(entry, { ...opts, driverTarget, global: globalInstall, cwd })?.extra.length ?? 0;
542
+ if (manifestUnchanged && companionsUnchanged && strayFiles === 0) {
471
543
  log(` already deployed: ${ref}`);
472
544
  continue;
473
545
  }
@@ -475,8 +547,8 @@ function deployAll(resolved, repositories, patches, opts, log = noop) {
475
547
  }
476
548
  }
477
549
  }
478
- deployAsset(entry, repositories, opts, log);
479
- deployed.push(canonicalEntryRef(entry));
550
+ const { changed } = deployEntry(entry, repositories, opts, log);
551
+ if (changed) deployed.push(canonicalEntryRef(entry));
480
552
  const patchFile = patches[ref];
481
553
  if (patchFile && existsSync(patchFile)) {
482
554
  const dest = deployedDir(component, entry.name, driverTarget, globalInstall, cwd);
@@ -489,6 +561,53 @@ function deployAll(resolved, repositories, patches, opts, log = noop) {
489
561
  }
490
562
  return deployed;
491
563
  }
564
+ function diffDeployedAgent(entry, opts) {
565
+ const driverTarget = opts.driverTarget ?? "claude-code";
566
+ const workspaceRoot = opts.cwd ?? process.cwd();
567
+ const deployedAgents = deployedBase("agent", driverTarget, opts.global ?? false, opts.cwd);
568
+ const scratch = mkdtempSync(join(tmpdir(), "skaile-diff-agent-"));
569
+ try {
570
+ const renderedAgents = join(scratch, "agents");
571
+ const srcDir = statSync(entry.source).isDirectory() ? entry.source : dirname(entry.source);
572
+ const rendered = installAgent(
573
+ srcDir,
574
+ renderedAgents,
575
+ workspaceRoot,
576
+ driverTarget,
577
+ DRIVER_TARGETS[driverTarget]?.local.skill ?? "",
578
+ entry.name,
579
+ /* includeSubAgents */
580
+ false,
581
+ /* @__PURE__ */ new Set(),
582
+ resolveSkWorkspaceConfig(workspaceRoot)
583
+ );
584
+ if (rendered.created.length === 0) return null;
585
+ const pairs = [];
586
+ for (const [renderedRoot, deployedRoot] of [
587
+ [renderedAgents, deployedAgents],
588
+ [join(scratch, CODEX_IDENTITY_DIR), join(dirname(deployedAgents), CODEX_IDENTITY_DIR)]
589
+ ]) {
590
+ if (!existsSync(renderedRoot)) continue;
591
+ for (const item of readdirSync(renderedRoot)) {
592
+ pairs.push([join(deployedRoot, item), join(renderedRoot, item)]);
593
+ }
594
+ }
595
+ if (!pairs.some(([from]) => existsSync(from))) return null;
596
+ const diffs = [];
597
+ for (const [from, to] of pairs) {
598
+ const r = spawnSync("diff", ["-ruN", from, to], { encoding: "utf8" });
599
+ if (r.status === 1) diffs.push(r.stdout);
600
+ else if (r.status !== 0) {
601
+ throw new Error(
602
+ `diff failed for agent:${entry.name}: ${r.stderr || r.error?.message || "unknown error"}`
603
+ );
604
+ }
605
+ }
606
+ return diffs.join("").split(`${scratch}${sep}`).join(`rendered${sep}`);
607
+ } finally {
608
+ rmSync(scratch, { recursive: true, force: true });
609
+ }
610
+ }
492
611
  function removeAsset(kind, name, opts) {
493
612
  const driverTarget = opts.driverTarget ?? "claude-code";
494
613
  const globalInstall = opts.global ?? false;
@@ -518,7 +637,7 @@ function removeAsset(kind, name, opts) {
518
637
  }
519
638
  return removed;
520
639
  }
521
- function markdownTemplate(name, description) {
640
+ function markdownTemplate(name, description, body) {
522
641
  return `---
523
642
  name: "${name}"
524
643
  description: ${JSON.stringify(description)}
@@ -528,7 +647,7 @@ metadata:
528
647
 
529
648
  # ${name}
530
649
 
531
- ${SKILL_BODY_PLACEHOLDER}
650
+ ${body}
532
651
  `;
533
652
  }
534
653
  function agentTemplate(name, description) {
@@ -542,7 +661,7 @@ lifecycle: standing
542
661
  function soulTemplate(name) {
543
662
  return `# ${name}
544
663
 
545
- ${SKILL_BODY_PLACEHOLDER}
664
+ ${AGENT_BODY_PLACEHOLDER}
546
665
  `;
547
666
  }
548
667
  function presetTemplate(name, description) {
@@ -578,32 +697,36 @@ function createScaffold(name, kind, destDir, opts = {}) {
578
697
  return { ok: false, path: `Directory '${name}' already exists in ${destDir}` };
579
698
  }
580
699
  mkdirSync(dest, { recursive: true });
581
- const mdDescription = opts.description ?? (["agent", "contract", "prompt"].includes(kind) ? `${SKILL_DESCRIPTION_PLACEHOLDER_PREFIX} describe this ${kind}.` : SKILL_DESCRIPTION_PLACEHOLDER);
700
+ const mdDescription = opts.description ?? (["agent", "contract", "prompt", "flow", "preset"].includes(kind) ? `${SKILL_DESCRIPTION_PLACEHOLDER_PREFIX} describe this ${kind}.` : SKILL_DESCRIPTION_PLACEHOLDER);
582
701
  if (kind === "preset") {
583
- writeFileSync(
584
- join(dest, `${name}.preset.yaml`),
585
- presetTemplate(name, opts.description ?? PRESET_DESCRIPTION_PLACEHOLDER),
586
- "utf8"
587
- );
702
+ writeFileSync(join(dest, `${name}.preset.yaml`), presetTemplate(name, mdDescription), "utf8");
588
703
  } else if (kind === "flow") {
704
+ writeFileSync(join(dest, `${name}.flow.yaml`), flowTemplate(name, mdDescription), "utf8");
705
+ } else if (kind === "prompt") {
589
706
  writeFileSync(
590
- join(dest, `${name}.flow.yaml`),
591
- flowTemplate(name, opts.description ?? "Flow description"),
707
+ join(dest, `${name}.prompt.md`),
708
+ markdownTemplate(name, mdDescription, PROMPT_BODY_PLACEHOLDER),
592
709
  "utf8"
593
710
  );
594
- } else if (kind === "prompt") {
595
- writeFileSync(join(dest, `${name}.prompt.md`), markdownTemplate(name, mdDescription), "utf8");
596
711
  } else if (kind === "agent") {
597
712
  writeFileSync(join(dest, "agent.yaml"), agentTemplate(name, mdDescription), "utf8");
598
713
  writeFileSync(join(dest, "SOUL.md"), soulTemplate(name), "utf8");
599
714
  } else if (kind === "contract") {
600
- writeFileSync(join(dest, "CONTRACT.md"), markdownTemplate(name, mdDescription), "utf8");
715
+ writeFileSync(
716
+ join(dest, "CONTRACT.md"),
717
+ markdownTemplate(name, mdDescription, CONTRACT_BODY_PLACEHOLDER),
718
+ "utf8"
719
+ );
601
720
  } else {
602
- writeFileSync(join(dest, "SKILL.md"), markdownTemplate(name, mdDescription), "utf8");
721
+ writeFileSync(
722
+ join(dest, "SKILL.md"),
723
+ markdownTemplate(name, mdDescription, SKILL_BODY_PLACEHOLDER),
724
+ "utf8"
725
+ );
603
726
  }
604
727
  return { ok: true, path: dest };
605
728
  }
606
729
 
607
- export { SCAFFOLD_KINDS, canonicalEntryRef, createScaffold, deployAll, deployAsset, installAgent, installTargetOf, removeAsset };
608
- //# sourceMappingURL=chunk-YSHVQGUS.js.map
609
- //# sourceMappingURL=chunk-YSHVQGUS.js.map
730
+ export { SCAFFOLD_KINDS, canonicalEntryRef, createScaffold, deployAll, deployAsset, deployedAssetDrift, diffDeployedAgent, installAgent, installTargetOf, removeAsset };
731
+ //# sourceMappingURL=chunk-FH7W6TJ4.js.map
732
+ //# sourceMappingURL=chunk-FH7W6TJ4.js.map