@skaile/workspaces 5.16.0 → 5.18.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 (369) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/dist/app-sdk/index.js +1 -1
  3. package/dist/{asset-feeds-BELBSJEE.js → asset-feeds-WAKBHGEV.js} +21 -21
  4. package/dist/{asset-feeds-BELBSJEE.js.map → asset-feeds-WAKBHGEV.js.map} +1 -1
  5. package/dist/asset-manager/catalog-deployer.js +8 -8
  6. package/dist/asset-manager/index.js +18 -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 +122 -5
  10. package/dist/asset-manager/src/index.d.ts.map +1 -1
  11. package/dist/asset-manager/src/installer.d.ts +13 -10
  12. package/dist/asset-manager/src/installer.d.ts.map +1 -1
  13. package/dist/asset-manager/src/mcp-config.d.ts +61 -1
  14. package/dist/asset-manager/src/mcp-config.d.ts.map +1 -1
  15. package/dist/asset-manager/src/renderers.d.ts.map +1 -1
  16. package/dist/bridge/drivers/claude-sdk.js +287 -104
  17. package/dist/bridge/drivers/claude-sdk.js.map +1 -1
  18. package/dist/bridge/drivers/codex.js +12 -12
  19. package/dist/bridge/drivers/continue.js +11 -11
  20. package/dist/bridge/drivers/echo.js +4 -4
  21. package/dist/bridge/drivers/gemini.js +7 -7
  22. package/dist/bridge/drivers/goose.js +11 -11
  23. package/dist/bridge/drivers/omp.js +34 -8
  24. package/dist/bridge/drivers/omp.js.map +1 -1
  25. package/dist/bridge/drivers/opencode.js +11 -11
  26. package/dist/bridge/drivers/qwen.js +7 -7
  27. package/dist/bridge/index.js +16 -16
  28. package/dist/bridge/src/driver-model-check.d.ts +8 -8
  29. package/dist/bridge/src/driver-model-check.d.ts.map +1 -1
  30. package/dist/bridge/src/drivers/claude-sdk.d.ts +74 -20
  31. package/dist/bridge/src/drivers/claude-sdk.d.ts.map +1 -1
  32. package/dist/bridge/src/drivers/claude-self-turns.d.ts +25 -6
  33. package/dist/bridge/src/drivers/claude-self-turns.d.ts.map +1 -1
  34. package/dist/bridge/src/drivers/omp-models-yml.d.ts +5 -0
  35. package/dist/bridge/src/drivers/omp-models-yml.d.ts.map +1 -1
  36. package/dist/bridge/src/drivers/omp.d.ts.map +1 -1
  37. package/dist/bridge/src/drivers/sanitize-assistant-text.d.ts +10 -0
  38. package/dist/bridge/src/drivers/sanitize-assistant-text.d.ts.map +1 -1
  39. package/dist/bridge/src/drivers/scrub-transcript.d.ts +20 -0
  40. package/dist/bridge/src/drivers/scrub-transcript.d.ts.map +1 -1
  41. package/dist/bridge/src/index.d.ts +1 -1
  42. package/dist/bridge/src/index.d.ts.map +1 -1
  43. package/dist/{chunk-FWAJUWXQ.js → chunk-24AXETE3.js} +55 -17
  44. package/dist/chunk-24AXETE3.js.map +1 -0
  45. package/dist/{chunk-ZVZTCDUN.js → chunk-2NOLF7B2.js} +37 -9
  46. package/dist/chunk-2NOLF7B2.js.map +1 -0
  47. package/dist/{chunk-NSNM2ZXF.js → chunk-3KMREAR2.js} +45 -5
  48. package/dist/chunk-3KMREAR2.js.map +1 -0
  49. package/dist/{chunk-D54T2F54.js → chunk-5TBFN46Z.js} +4 -4
  50. package/dist/chunk-5TBFN46Z.js.map +1 -0
  51. package/dist/{chunk-6RTEUWXX.js → chunk-6HK6RUFM.js} +3 -3
  52. package/dist/{chunk-6RTEUWXX.js.map → chunk-6HK6RUFM.js.map} +1 -1
  53. package/dist/{chunk-PGZDSDOB.js → chunk-6Z5KTFJT.js} +3 -3
  54. package/dist/{chunk-PGZDSDOB.js.map → chunk-6Z5KTFJT.js.map} +1 -1
  55. package/dist/{chunk-PW3TYWOI.js → chunk-AJ7EGIFR.js} +3 -3
  56. package/dist/{chunk-PW3TYWOI.js.map → chunk-AJ7EGIFR.js.map} +1 -1
  57. package/dist/{chunk-46IRZJV4.js → chunk-CD7SVH6W.js} +4 -4
  58. package/dist/{chunk-46IRZJV4.js.map → chunk-CD7SVH6W.js.map} +1 -1
  59. package/dist/{chunk-WKEBNB5S.js → chunk-CKBCX3HQ.js} +4 -4
  60. package/dist/{chunk-WKEBNB5S.js.map → chunk-CKBCX3HQ.js.map} +1 -1
  61. package/dist/{chunk-H7R7R5BN.js → chunk-CKICWXMU.js} +18 -15
  62. package/dist/chunk-CKICWXMU.js.map +1 -0
  63. package/dist/{chunk-YK3XLEQJ.js → chunk-CKNIYIV2.js} +83 -77
  64. package/dist/chunk-CKNIYIV2.js.map +1 -0
  65. package/dist/{chunk-SPV2CXJ3.js → chunk-D6UBEYQH.js} +4 -4
  66. package/dist/{chunk-SPV2CXJ3.js.map → chunk-D6UBEYQH.js.map} +1 -1
  67. package/dist/{chunk-5CE6J4DB.js → chunk-DA2MCPFN.js} +53 -16
  68. package/dist/chunk-DA2MCPFN.js.map +1 -0
  69. package/dist/{chunk-A26MUUN7.js → chunk-DJD36HC5.js} +7 -7
  70. package/dist/{chunk-A26MUUN7.js.map → chunk-DJD36HC5.js.map} +1 -1
  71. package/dist/{chunk-Y25V2MW2.js → chunk-E5YNGE3I.js} +4 -4
  72. package/dist/{chunk-Y25V2MW2.js.map → chunk-E5YNGE3I.js.map} +1 -1
  73. package/dist/{chunk-OJHPG6HK.js → chunk-EELKR2WP.js} +45 -28
  74. package/dist/chunk-EELKR2WP.js.map +1 -0
  75. package/dist/{chunk-YIDZJHY6.js → chunk-EFLKSMCO.js} +3 -3
  76. package/dist/{chunk-YIDZJHY6.js.map → chunk-EFLKSMCO.js.map} +1 -1
  77. package/dist/{chunk-SMUIYYCH.js → chunk-EZVZDCHZ.js} +24 -15
  78. package/dist/chunk-EZVZDCHZ.js.map +1 -0
  79. package/dist/{chunk-SAGBVBY2.js → chunk-FHIMIXT3.js} +5 -5
  80. package/dist/{chunk-SAGBVBY2.js.map → chunk-FHIMIXT3.js.map} +1 -1
  81. package/dist/{chunk-D5REDKVU.js → chunk-FKU57Q5Q.js} +3 -3
  82. package/dist/{chunk-D5REDKVU.js.map → chunk-FKU57Q5Q.js.map} +1 -1
  83. package/dist/{chunk-J4RRH2NP.js → chunk-FV2MSBVA.js} +4 -4
  84. package/dist/{chunk-J4RRH2NP.js.map → chunk-FV2MSBVA.js.map} +1 -1
  85. package/dist/{chunk-YW2BNDSE.js → chunk-GOCWM7FN.js} +22 -4
  86. package/dist/chunk-GOCWM7FN.js.map +1 -0
  87. package/dist/{chunk-TXGVG7VH.js → chunk-GRKU3S5V.js} +3 -3
  88. package/dist/{chunk-TXGVG7VH.js.map → chunk-GRKU3S5V.js.map} +1 -1
  89. package/dist/{chunk-AP24HESN.js → chunk-H6UVIKQ2.js} +3 -3
  90. package/dist/{chunk-AP24HESN.js.map → chunk-H6UVIKQ2.js.map} +1 -1
  91. package/dist/{chunk-ES6ARJPQ.js → chunk-HPVMTX6M.js} +15 -10
  92. package/dist/chunk-HPVMTX6M.js.map +1 -0
  93. package/dist/{chunk-A7AZ3RL5.js → chunk-JJ7LDI3S.js} +7 -7
  94. package/dist/{chunk-A7AZ3RL5.js.map → chunk-JJ7LDI3S.js.map} +1 -1
  95. package/dist/{chunk-OHNNCXMB.js → chunk-JY7GVNYU.js} +32 -18
  96. package/dist/chunk-JY7GVNYU.js.map +1 -0
  97. package/dist/{chunk-HUKUYWBJ.js → chunk-JYWW32JI.js} +17 -6
  98. package/dist/chunk-JYWW32JI.js.map +1 -0
  99. package/dist/{chunk-VJ2DZLDM.js → chunk-K5LVU2MN.js} +13 -7
  100. package/dist/chunk-K5LVU2MN.js.map +1 -0
  101. package/dist/{chunk-5RDZ5JHH.js → chunk-KC6HGWXN.js} +4 -4
  102. package/dist/{chunk-5RDZ5JHH.js.map → chunk-KC6HGWXN.js.map} +1 -1
  103. package/dist/{chunk-X5O56UO4.js → chunk-L2AMXONH.js} +3 -3
  104. package/dist/chunk-L2AMXONH.js.map +1 -0
  105. package/dist/{chunk-RTNWU2UD.js → chunk-L5XUEC2W.js} +4 -4
  106. package/dist/{chunk-RTNWU2UD.js.map → chunk-L5XUEC2W.js.map} +1 -1
  107. package/dist/{chunk-TKI7YDWE.js → chunk-L6IFN6ER.js} +54 -9
  108. package/dist/chunk-L6IFN6ER.js.map +1 -0
  109. package/dist/{chunk-L6UMSKDF.js → chunk-LW7ZI6EQ.js} +8 -36
  110. package/dist/chunk-LW7ZI6EQ.js.map +1 -0
  111. package/dist/{chunk-XGR7IDTY.js → chunk-MQIRRN76.js} +3 -3
  112. package/dist/{chunk-XGR7IDTY.js.map → chunk-MQIRRN76.js.map} +1 -1
  113. package/dist/{chunk-ISSYT5AZ.js → chunk-N5P2WBUL.js} +3 -3
  114. package/dist/{chunk-ISSYT5AZ.js.map → chunk-N5P2WBUL.js.map} +1 -1
  115. package/dist/{chunk-E634MBP6.js → chunk-ODDATIII.js} +8 -8
  116. package/dist/{chunk-E634MBP6.js.map → chunk-ODDATIII.js.map} +1 -1
  117. package/dist/{chunk-WXWQNJCT.js → chunk-PUK7TQT4.js} +3 -3
  118. package/dist/{chunk-WXWQNJCT.js.map → chunk-PUK7TQT4.js.map} +1 -1
  119. package/dist/{chunk-72KZJE3G.js → chunk-PZ6NF5DE.js} +16 -23
  120. package/dist/chunk-PZ6NF5DE.js.map +1 -0
  121. package/dist/{chunk-5DCOG5B5.js → chunk-RD6N2D7I.js} +3 -3
  122. package/dist/{chunk-5DCOG5B5.js.map → chunk-RD6N2D7I.js.map} +1 -1
  123. package/dist/{chunk-TADJCATD.js → chunk-RO2BPKXK.js} +3 -3
  124. package/dist/{chunk-TADJCATD.js.map → chunk-RO2BPKXK.js.map} +1 -1
  125. package/dist/{chunk-6GSE63K2.js → chunk-SRNCN4X2.js} +13 -5
  126. package/dist/chunk-SRNCN4X2.js.map +1 -0
  127. package/dist/{chunk-PIC23DDE.js → chunk-T2TQAH2X.js} +42 -11
  128. package/dist/chunk-T2TQAH2X.js.map +1 -0
  129. package/dist/{chunk-DADAZLFW.js → chunk-TDQ2ERCM.js} +695 -96
  130. package/dist/chunk-TDQ2ERCM.js.map +1 -0
  131. package/dist/{chunk-SXWGLW23.js → chunk-U2FI547Z.js} +4 -4
  132. package/dist/{chunk-SXWGLW23.js.map → chunk-U2FI547Z.js.map} +1 -1
  133. package/dist/{chunk-CQFVKN6S.js → chunk-V4RV2NJF.js} +240 -84
  134. package/dist/chunk-V4RV2NJF.js.map +1 -0
  135. package/dist/{chunk-D3PU3C6F.js → chunk-VKPBUPH7.js} +41 -15
  136. package/dist/chunk-VKPBUPH7.js.map +1 -0
  137. package/dist/{chunk-FT4ZHLYR.js → chunk-WDXZA7QW.js} +33 -3
  138. package/dist/chunk-WDXZA7QW.js.map +1 -0
  139. package/dist/{chunk-FSSRBWYL.js → chunk-WJCQFNF6.js} +4 -4
  140. package/dist/chunk-WJCQFNF6.js.map +1 -0
  141. package/dist/{chunk-2SKPPIV7.js → chunk-WJLYL6RY.js} +5 -5
  142. package/dist/{chunk-2SKPPIV7.js.map → chunk-WJLYL6RY.js.map} +1 -1
  143. package/dist/{chunk-6Q7NKTDG.js → chunk-X54YR4AW.js} +2 -2
  144. package/dist/{chunk-6Q7NKTDG.js.map → chunk-X54YR4AW.js.map} +1 -1
  145. package/dist/{chunk-D5WTOVLG.js → chunk-Y56YIT6J.js} +2 -2
  146. package/dist/chunk-Y56YIT6J.js.map +1 -0
  147. package/dist/{chunk-ZIW34FGO.js → chunk-YIF2IJUA.js} +3 -3
  148. package/dist/{chunk-ZIW34FGO.js.map → chunk-YIF2IJUA.js.map} +1 -1
  149. package/dist/{chunk-HG52NGAV.js → chunk-YU6AURJY.js} +3 -3
  150. package/dist/{chunk-HG52NGAV.js.map → chunk-YU6AURJY.js.map} +1 -1
  151. package/dist/{chunk-FSLVMZXR.js → chunk-YZ3N7IUU.js} +72 -31
  152. package/dist/chunk-YZ3N7IUU.js.map +1 -0
  153. package/dist/{chunk-DQOAPR4M.js → chunk-ZNN7ONJX.js} +8 -4
  154. package/dist/chunk-ZNN7ONJX.js.map +1 -0
  155. package/dist/cli/index.js +349 -150
  156. package/dist/cli/index.js.map +1 -1
  157. package/dist/cli/src/commands/asset-cmd.d.ts.map +1 -1
  158. package/dist/cli/src/commands/catalog.d.ts.map +1 -1
  159. package/dist/cli/src/commands/config.d.ts.map +1 -1
  160. package/dist/cli/src/commands/integration.d.ts.map +1 -1
  161. package/dist/cli/src/commands/library-cmd.d.ts.map +1 -1
  162. package/dist/cli/src/commands/library-publish.d.ts.map +1 -1
  163. package/dist/cli/src/commands/plugin/claude-code.d.ts.map +1 -1
  164. package/dist/cli/src/commands/plugin/codex.d.ts +6 -0
  165. package/dist/cli/src/commands/plugin/codex.d.ts.map +1 -1
  166. package/dist/cli/src/commands/project.d.ts.map +1 -1
  167. package/dist/cli/src/commands/run.d.ts.map +1 -1
  168. package/dist/cli/src/commands/serve.d.ts +5 -0
  169. package/dist/cli/src/commands/serve.d.ts.map +1 -1
  170. package/dist/cli/src/commands/source.d.ts.map +1 -1
  171. package/dist/cli/src/commands/validate.d.ts.map +1 -1
  172. package/dist/cli/src/commands/verify.d.ts.map +1 -1
  173. package/dist/cli/src/driver-error.d.ts +3 -1
  174. package/dist/cli/src/driver-error.d.ts.map +1 -1
  175. package/dist/cli/src/helpers.d.ts +6 -4
  176. package/dist/cli/src/helpers.d.ts.map +1 -1
  177. package/dist/cli/src/plugin-store/index.d.ts +6 -0
  178. package/dist/cli/src/plugin-store/index.d.ts.map +1 -1
  179. package/dist/cli/src/skill-checks.d.ts +4 -3
  180. package/dist/cli/src/skill-checks.d.ts.map +1 -1
  181. package/dist/connectors/config.js +5 -5
  182. package/dist/connectors/index.js +22 -22
  183. package/dist/connectors/src/connector-manager.d.ts.map +1 -1
  184. package/dist/connectors/src/connector-types.d.ts +5 -0
  185. package/dist/connectors/src/connector-types.d.ts.map +1 -1
  186. package/dist/connectors/src/watcher.d.ts.map +1 -1
  187. package/dist/{connectors-44RE2QEM.js → connectors-QL4GBMH3.js} +25 -25
  188. package/dist/{connectors-44RE2QEM.js.map → connectors-QL4GBMH3.js.map} +1 -1
  189. package/dist/connectors-shared/index.js +2 -2
  190. package/dist/core/index.js +7 -7
  191. package/dist/core/manifest.js +2 -2
  192. package/dist/core/models.js +1 -1
  193. package/dist/core/publish-manifest.js +3 -3
  194. package/dist/core/ref.js +1 -1
  195. package/dist/core/runtime-assets.js +5 -5
  196. package/dist/core/src/bind.d.ts +30 -0
  197. package/dist/core/src/bind.d.ts.map +1 -0
  198. package/dist/core/src/index.d.ts +4 -3
  199. package/dist/core/src/index.d.ts.map +1 -1
  200. package/dist/core/src/lock.d.ts +11 -2
  201. package/dist/core/src/lock.d.ts.map +1 -1
  202. package/dist/core/src/manifest.d.ts.map +1 -1
  203. package/dist/core/src/models.d.ts +19 -0
  204. package/dist/core/src/models.d.ts.map +1 -1
  205. package/dist/core/src/publish-manifest.d.ts +15 -13
  206. package/dist/core/src/publish-manifest.d.ts.map +1 -1
  207. package/dist/core/src/store.d.ts +2 -1
  208. package/dist/core/src/store.d.ts.map +1 -1
  209. package/dist/core/src/workspace-config.d.ts +26 -1
  210. package/dist/core/src/workspace-config.d.ts.map +1 -1
  211. package/dist/core/store.js +1 -1
  212. package/dist/core/workspace-config.js +4 -4
  213. package/dist/deploy/index.js +7 -7
  214. package/dist/discovery/index.js +5 -5
  215. package/dist/discovery/src/parse-manifest.d.ts +1 -1
  216. package/dist/discovery/src/source-config.d.ts +2 -1
  217. package/dist/discovery/src/source-config.d.ts.map +1 -1
  218. package/dist/{ensure-sources-R6AHZ7RV.js → ensure-sources-CEFODJCE.js} +21 -17
  219. package/dist/ensure-sources-CEFODJCE.js.map +1 -0
  220. package/dist/factory-assets/connectors/box.js +22 -22
  221. package/dist/factory-assets/connectors/deploy.js +22 -22
  222. package/dist/factory-assets/connectors/devserver.js +22 -22
  223. package/dist/factory-assets/connectors/flow/adapter.js +22 -22
  224. package/dist/factory-assets/connectors/flow/engine.js +9 -9
  225. package/dist/factory-assets/connectors/flow/run-flow.js +24 -24
  226. package/dist/factory-assets/connectors/flow.js +22 -22
  227. package/dist/factory-assets/connectors/git.js +22 -22
  228. package/dist/factory-assets/connectors/gmail.js +22 -22
  229. package/dist/factory-assets/connectors/googledrive.js +22 -22
  230. package/dist/factory-assets/connectors/local.js +22 -22
  231. package/dist/factory-assets/connectors/mattermost.js +22 -22
  232. package/dist/factory-assets/connectors/memory.js +22 -22
  233. package/dist/factory-assets/connectors/minio.js +22 -22
  234. package/dist/factory-assets/connectors/postgres.js +22 -22
  235. package/dist/factory-assets/connectors/s3.js +22 -22
  236. package/dist/factory-assets/connectors/sharepoint.js +22 -22
  237. package/dist/factory-assets/connectors/sqlite.js +22 -22
  238. package/dist/factory-assets/connectors/static-server.js +22 -22
  239. package/dist/factory-assets/connectors/tunnel.js +22 -22
  240. package/dist/factory-assets/connectors/webdav.js +22 -22
  241. package/dist/factory-assets/connectors/xstate-store/adapter.d.ts +1 -1
  242. package/dist/factory-assets/connectors/xstate-store/adapter.d.ts.map +1 -1
  243. package/dist/factory-assets/connectors/xstate-store.js +22 -22
  244. package/dist/factory-assets/connectors/xstate.js +22 -22
  245. package/dist/{flows-YKC53LDP.js → flows-BHY73K3O.js} +12 -12
  246. package/dist/{flows-YKC53LDP.js.map → flows-BHY73K3O.js.map} +1 -1
  247. package/dist/{helpers-FNQL5PI7.js → helpers-R22QNPFN.js} +21 -17
  248. package/dist/{helpers-FNQL5PI7.js.map → helpers-R22QNPFN.js.map} +1 -1
  249. package/dist/library/index.js +11 -11
  250. package/dist/library/install.js +4 -4
  251. package/dist/library/src/index.d.ts +1 -1
  252. package/dist/library/src/index.d.ts.map +1 -1
  253. package/dist/library/src/manifest-writer.d.ts +17 -1
  254. package/dist/library/src/manifest-writer.d.ts.map +1 -1
  255. package/dist/{library-publish-GHPVY42Y.js → library-publish-VBE3X2TH.js} +63 -66
  256. package/dist/library-publish-VBE3X2TH.js.map +1 -0
  257. package/dist/model-endpoint/index.js +10 -10
  258. package/dist/model-endpoint/src/server.d.ts.map +1 -1
  259. package/dist/open-library-JP5TC5UX.js +42 -0
  260. package/dist/{open-library-YSUGNP36.js.map → open-library-JP5TC5UX.js.map} +1 -1
  261. package/dist/open-registry-RBELV5YH.js +32 -0
  262. package/dist/{open-registry-YPRQDUMK.js.map → open-registry-RBELV5YH.js.map} +1 -1
  263. package/dist/paths-BFM6K2QO.js +22 -0
  264. package/dist/{paths-P55DTBEK.js.map → paths-BFM6K2QO.js.map} +1 -1
  265. package/dist/plugin-store-QOQDM24E.js +23 -0
  266. package/dist/{plugin-store-IPIBZRBX.js.map → plugin-store-QOQDM24E.js.map} +1 -1
  267. package/dist/{project-NDSLXERO.js → project-6ETXGQWD.js} +48 -48
  268. package/dist/{project-NDSLXERO.js.map → project-6ETXGQWD.js.map} +1 -1
  269. package/dist/resolver/index.js +8 -8
  270. package/dist/runner/index.js +40 -40
  271. package/dist/runner/src/agent.d.ts.map +1 -1
  272. package/dist/runner/src/capability-roundtrip.d.ts.map +1 -1
  273. package/dist/runner/src/coalesced-restart.d.ts +41 -0
  274. package/dist/runner/src/coalesced-restart.d.ts.map +1 -0
  275. package/dist/runner/src/compaction/prompt.d.ts.map +1 -1
  276. package/dist/runner/src/mcp-runtime-handlers.d.ts +27 -0
  277. package/dist/runner/src/mcp-runtime-handlers.d.ts.map +1 -1
  278. package/dist/runner/src/runner-capabilities.d.ts +7 -0
  279. package/dist/runner/src/runner-capabilities.d.ts.map +1 -1
  280. package/dist/runner/src/serve.d.ts.map +1 -1
  281. package/dist/runner/src/session-capability-wiring.d.ts +2 -0
  282. package/dist/runner/src/session-capability-wiring.d.ts.map +1 -1
  283. package/dist/sdk/asset-manager.js +18 -14
  284. package/dist/sdk/bridge.js +16 -16
  285. package/dist/sdk/core.js +7 -7
  286. package/dist/sdk/flow.js +9 -9
  287. package/dist/sdk/index.js +40 -40
  288. package/dist/sdk/resolver.js +8 -8
  289. package/dist/sdk/runner.js +40 -40
  290. package/dist/sdk/session.js +2 -2
  291. package/dist/sdk/transport/ws/server.js +19 -1
  292. package/dist/sdk/transport/ws.js +19 -1
  293. package/dist/sdk/transport.js +19 -1
  294. package/dist/sdk/types.js +1 -1
  295. package/dist/{serve-preflight-ON2LS3SD.js → serve-preflight-BTGTZUDN.js} +9 -9
  296. package/dist/{serve-preflight-ON2LS3SD.js.map → serve-preflight-BTGTZUDN.js.map} +1 -1
  297. package/dist/session/index.js +2 -2
  298. package/dist/{setup-MFPEQS2I.js → setup-JQDTYPSD.js} +30 -26
  299. package/dist/setup-JQDTYPSD.js.map +1 -0
  300. package/dist/{skills-7G6QCDEM.js → skills-RSZVUIYZ.js} +13 -13
  301. package/dist/{skills-7G6QCDEM.js.map → skills-RSZVUIYZ.js.map} +1 -1
  302. package/dist/{source-4QVRD5NV.js → source-FPLHY3DP.js} +50 -50
  303. package/dist/{source-4QVRD5NV.js.map → source-FPLHY3DP.js.map} +1 -1
  304. package/dist/{source-manifest-publish-ZIO24GUM.js → source-manifest-publish-LY4H63VA.js} +52 -52
  305. package/dist/{source-manifest-publish-ZIO24GUM.js.map → source-manifest-publish-LY4H63VA.js.map} +1 -1
  306. package/dist/transport/index.js +19 -1
  307. package/dist/transport/src/ws/server.d.ts +2 -16
  308. package/dist/transport/src/ws/server.d.ts.map +1 -1
  309. package/dist/transport/ws/server.js +19 -1
  310. package/dist/transport/ws.js +19 -1
  311. package/dist/tui/index.js +57 -45
  312. package/dist/tui/index.js.map +1 -1
  313. package/dist/tui/src/repl.d.ts +4 -1
  314. package/dist/tui/src/repl.d.ts.map +1 -1
  315. package/dist/types/index.js +1 -1
  316. package/dist/types/manifests.js +1 -1
  317. package/dist/types/src/events.d.ts +7 -4
  318. package/dist/types/src/events.d.ts.map +1 -1
  319. package/dist/types/src/manifests/index.d.ts +1 -1
  320. package/dist/types/src/manifests/index.d.ts.map +1 -1
  321. package/dist/types/src/manifests/scaffold-body.d.ts +8 -0
  322. package/dist/types/src/manifests/scaffold-body.d.ts.map +1 -1
  323. package/dist/types/src/manifests/skill.d.ts +0 -2
  324. package/dist/types/src/manifests/skill.d.ts.map +1 -1
  325. package/dist/workspace-plugin/adapters/mcp.js +29 -29
  326. package/dist/workspace-plugin/adapters/omp.js +32 -18
  327. package/dist/workspace-plugin/adapters/omp.js.map +1 -1
  328. package/dist/workspace-plugin/index.js +1 -1
  329. package/dist/workspace-plugin/src/adapters/claude-code.d.ts +1 -1
  330. package/dist/workspace-plugin/src/adapters/omp.d.ts +8 -5
  331. package/dist/workspace-plugin/src/adapters/omp.d.ts.map +1 -1
  332. package/dist/workspace-plugin/src/plugin.d.ts +7 -1
  333. package/dist/workspace-plugin/src/plugin.d.ts.map +1 -1
  334. package/package.json +1 -1
  335. package/dist/chunk-5CE6J4DB.js.map +0 -1
  336. package/dist/chunk-6GSE63K2.js.map +0 -1
  337. package/dist/chunk-72KZJE3G.js.map +0 -1
  338. package/dist/chunk-CQFVKN6S.js.map +0 -1
  339. package/dist/chunk-D3PU3C6F.js.map +0 -1
  340. package/dist/chunk-D54T2F54.js.map +0 -1
  341. package/dist/chunk-D5WTOVLG.js.map +0 -1
  342. package/dist/chunk-DADAZLFW.js.map +0 -1
  343. package/dist/chunk-DQOAPR4M.js.map +0 -1
  344. package/dist/chunk-ES6ARJPQ.js.map +0 -1
  345. package/dist/chunk-FSLVMZXR.js.map +0 -1
  346. package/dist/chunk-FSSRBWYL.js.map +0 -1
  347. package/dist/chunk-FT4ZHLYR.js.map +0 -1
  348. package/dist/chunk-FWAJUWXQ.js.map +0 -1
  349. package/dist/chunk-H7R7R5BN.js.map +0 -1
  350. package/dist/chunk-HUKUYWBJ.js.map +0 -1
  351. package/dist/chunk-L6UMSKDF.js.map +0 -1
  352. package/dist/chunk-NSNM2ZXF.js.map +0 -1
  353. package/dist/chunk-OHNNCXMB.js.map +0 -1
  354. package/dist/chunk-OJHPG6HK.js.map +0 -1
  355. package/dist/chunk-PIC23DDE.js.map +0 -1
  356. package/dist/chunk-SMUIYYCH.js.map +0 -1
  357. package/dist/chunk-TKI7YDWE.js.map +0 -1
  358. package/dist/chunk-VJ2DZLDM.js.map +0 -1
  359. package/dist/chunk-X5O56UO4.js.map +0 -1
  360. package/dist/chunk-YK3XLEQJ.js.map +0 -1
  361. package/dist/chunk-YW2BNDSE.js.map +0 -1
  362. package/dist/chunk-ZVZTCDUN.js.map +0 -1
  363. package/dist/ensure-sources-R6AHZ7RV.js.map +0 -1
  364. package/dist/library-publish-GHPVY42Y.js.map +0 -1
  365. package/dist/open-library-YSUGNP36.js +0 -40
  366. package/dist/open-registry-YPRQDUMK.js +0 -32
  367. package/dist/paths-P55DTBEK.js +0 -22
  368. package/dist/plugin-store-IPIBZRBX.js +0 -23
  369. package/dist/setup-MFPEQS2I.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../cli/src/plugin-store/paths.ts","../cli/src/plugin-store/spec.ts","../cli/src/plugin-store/load.ts","../cli/src/plugin-store/reconcile.ts","../cli/src/plugin-store/index.ts"],"names":["existsSync","readFileSync","join"],"mappings":";;;;;;;;AAWO,SAAS,WAAW,UAAA,EAA4B;AACrD,EAAA,OAAO,IAAA,CAAK,UAAA,EAAY,SAAA,EAAW,SAAS,CAAA;AAC9C;AAGO,SAAS,eAAe,UAAA,EAA4B;AACzD,EAAA,OAAO,IAAA,CAAK,UAAA,CAAW,UAAU,CAAA,EAAG,cAAc,CAAA;AACpD;AAGO,SAAS,eAAe,UAAA,EAA4B;AACzD,EAAA,OAAO,IAAA,CAAK,UAAA,CAAW,UAAU,CAAA,EAAG,cAAc,CAAA;AACpD;AAGO,SAAS,kBAAkB,UAAA,EAA4B;AAC5D,EAAA,OAAO,IAAA,CAAK,UAAA,CAAW,UAAU,CAAA,EAAG,iBAAiB,CAAA;AACvD;AAGA,SAAS,cAAc,MAAA,EAAqC;AAC1D,EAAA,IAAI,OAAO,MAAA,KAAW,QAAA,EAAU,OAAO,MAAA;AACvC,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,MAAM,CAAA,EAAG;AACzB,IAAA,KAAA,MAAW,KAAK,MAAA,EAAQ;AAC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,KAAW,CAAA,EAAG;AACtC,EAAA,IAAI;AACF,IAAA,MAAM,MAAA,GAAS,MAAM,mBAAA,CAAoB,UAAA,EAAY,SAAS,cAAc,CAAA;AAC5E,IAAA,KAAA,MAAW,KAAK,MAAA,CAAO,MAAA,mBAAyB,CAAA,CAAE,IAAA,EAAM,EAAE,MAAM,CAAA;AAAA,EAClE,SAAS,GAAA,EAAK;AAEZ,IAAA,MAAM,SAAS,GAAA,YAAe,KAAA,GAAQ,GAAA,CAAI,OAAA,GAAU,OAAO,GAAG,CAAA;AAC9D,IAAA,KAAA,MAAW,IAAA,IAAQ,OAAA,EAAS,gBAAA,CAAiB,IAAA,EAAM,MAAM,CAAA;AAAA,EAC3D;AACF","file":"chunk-JYWW32JI.js","sourcesContent":["/**\n * Pure path helpers for the project-local plugin store.\n *\n * The store is a self-contained npm workspace owned by the CLI under\n * `<projectDir>/.skaile/plugins/`. Only `resolvePluginEntry` reads the filesystem.\n */\n\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\n\n/** `<projectDir>/.skaile/plugins` — the store root. */\nexport function pluginsDir(projectDir: string): string {\n return join(projectDir, \".skaile\", \"plugins\");\n}\n\n/** `<store>/package.json` — generated, never user-edited. */\nexport function pluginsPkgJson(projectDir: string): string {\n return join(pluginsDir(projectDir), \"package.json\");\n}\n\n/** `<store>/node_modules` — where reconciled plugin packages land. */\nexport function nodeModulesDir(projectDir: string): string {\n return join(pluginsDir(projectDir), \"node_modules\");\n}\n\n/** `<store>/.reconcile-hash` — SHA of plugins-list + lock slice; skip reinstall when unchanged. */\nexport function reconcileHashFile(projectDir: string): string {\n return join(pluginsDir(projectDir), \".reconcile-hash\");\n}\n\n/** Pick the file an `exports` target points at, preferring the ESM-friendly conditions. */\nfunction exportsTarget(target: unknown): string | undefined {\n if (typeof target === \"string\") return target;\n if (Array.isArray(target)) {\n for (const t of target) {\n const hit = exportsTarget(t);\n if (hit) return hit;\n }\n return undefined;\n }\n if (target && typeof target === \"object\") {\n const map = target as Record<string, unknown>;\n for (const cond of [\"import\", \"node\", \"default\", \"require\"]) {\n if (cond in map) {\n const hit = exportsTarget(map[cond]);\n if (hit) return hit;\n }\n }\n }\n return undefined;\n}\n\n/**\n * Absolute path to a plugin package's entry file under the store's\n * `node_modules`, resolved from its `package.json` (`exports[\".\"]`, then\n * `module`, then `main`, then `index.js`). Node's ESM loader rejects directory\n * imports, so the entry must be a file; `import()` of the result works inside\n * compiled binaries via `pathToFileURL`.\n *\n * @throws When the package is not installed or declares no resolvable entry.\n */\nexport function resolvePluginEntry(projectDir: string, pkgName: string): string {\n const pkgDir = join(nodeModulesDir(projectDir), pkgName);\n const pkgJsonPath = join(pkgDir, \"package.json\");\n if (!existsSync(pkgJsonPath)) {\n throw new Error(`package \"${pkgName}\" is not installed in ${nodeModulesDir(projectDir)}`);\n }\n const pkg = JSON.parse(readFileSync(pkgJsonPath, \"utf8\")) as {\n exports?: unknown;\n module?: string;\n main?: string;\n };\n let rel: string | undefined;\n if (pkg.exports !== undefined) {\n const root =\n typeof pkg.exports === \"object\" && pkg.exports !== null && !Array.isArray(pkg.exports)\n ? ((pkg.exports as Record<string, unknown>)[\".\"] ?? pkg.exports)\n : pkg.exports;\n rel = exportsTarget(root);\n }\n rel ??= pkg.module ?? pkg.main ?? \"index.js\";\n const entry = resolve(pkgDir, rel);\n if (!existsSync(entry)) {\n throw new Error(`package \"${pkgName}\" entry ${rel} does not exist`);\n }\n return entry;\n}\n","/**\n * Parse npm package specifiers from the `plugins:` list into name + range.\n *\n * The leading `@` of a scope is NOT a separator: only the last `@` at a\n * non-zero index splits the package name from its semver range.\n * \"@skaile/provider-fly@^0.1.0\" → { name: \"@skaile/provider-fly\", range: \"^0.1.0\" }\n * \"@skaile/connector-redis\" → { name: \"@skaile/connector-redis\", range: \"*\" }\n * \"lodash@^4\" → { name: \"lodash\", range: \"^4\" }\n */\n\n/** A parsed plugin specifier: package name plus a semver range (`\"*\"` when omitted). */\nexport interface PluginSpec {\n name: string;\n range: string;\n}\n\n/**\n * Parse a single plugin specifier into `{ name, range }`.\n *\n * @param spec - An npm specifier, e.g. `\"@skaile/provider-fly@^0.1.0\"` or `\"lodash\"`.\n * @returns The package name and semver range (range defaults to `\"*\"`).\n * @throws Error when the specifier is empty.\n */\nexport function parseSpec(spec: string): PluginSpec {\n const trimmed = spec.trim();\n if (!trimmed) throw new Error(\"parseSpec: empty specifier\");\n\n // Find the version-separating `@` — the last one that is not the scope `@`\n // at index 0. A bare `@scope/name` has its only `@` at index 0 (no range).\n const at = trimmed.lastIndexOf(\"@\");\n if (at <= 0) {\n return { name: trimmed, range: \"*\" };\n }\n const name = trimmed.slice(0, at);\n const range = trimmed.slice(at + 1);\n return { name, range: range.length > 0 ? range : \"*\" };\n}\n\n/** Convenience: just the package name of a specifier. */\nexport function specName(spec: string): string {\n return parseSpec(spec).name;\n}\n","/**\n * Runtime plugin loader: dynamic-import each reconciled plugin and let it\n * self-register into the `pluginRegistry`.\n *\n * Each plugin specifier resolves to an absolute path under the store's\n * `node_modules`; we import it via a `file://` URL so the import works inside\n * `bun --compile` binaries (which bundle only the literal-string switches, but\n * can still execute a `file://` import against the unpacked store on disk).\n * Failures are caught per-plugin so one broken plugin never aborts the rest.\n */\n\nimport { pathToFileURL } from \"node:url\";\nimport { type PluginRegistry, pluginRegistry } from \"@skaile/workspaces/plugin-registry\";\nimport type { Logger } from \"@skaile/workspaces/types\";\nimport { resolvePluginEntry } from \"./paths.js\";\nimport { parseSpec } from \"./spec.js\";\n\n/** Options for {@link loadPlugins}. */\nexport interface LoadOptions {\n log?: Logger;\n}\n\n/** Result of a load pass: which specs registered and which failed. */\nexport interface LoadResult {\n loaded: string[];\n failed: { spec: string; error: string; reason: string }[];\n}\n\n/** The self-registration entrypoint a plugin module is expected to export. */\ntype PluginModule = { register?: (registry: PluginRegistry) => void };\n\n/**\n * Load and register each plugin in `plugins` into `registry`.\n *\n * @param projectDir - Project root holding `.skaile/plugins/node_modules`.\n * @param plugins - The `skaile.yaml` `plugins:` list (npm specifiers).\n * @param registry - Registry to register into. Defaults to the process-wide `pluginRegistry`.\n * @param opts - Optional logger.\n * @returns Loaded specs + per-plugin failures (never throws).\n */\nexport async function loadPlugins(\n projectDir: string,\n plugins: string[],\n registry: PluginRegistry = pluginRegistry,\n opts: LoadOptions = {},\n): Promise<LoadResult> {\n const loaded: string[] = [];\n const failed: { spec: string; error: string; reason: string }[] = [];\n\n for (const spec of plugins) {\n try {\n const { name } = parseSpec(spec);\n const entry = resolvePluginEntry(projectDir, name);\n const mod = (await import(pathToFileURL(entry).href)) as PluginModule;\n if (typeof mod.register !== \"function\") {\n throw new Error(`plugin \"${name}\" does not export a register() function`);\n }\n mod.register(registry);\n loaded.push(spec);\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n failed.push({ spec, error: `failed to load plugin \"${spec}\": ${message}`, reason: message });\n opts.log?.warn(`plugin load failed: ${spec}`, { error: message });\n }\n }\n\n return { loaded, failed };\n}\n","/**\n * Reconcile the project-local plugin store (`<projectDir>/.skaile/plugins/`).\n *\n * The reconciler is hash-skipped: it computes a SHA-256 over the sorted plugin\n * list plus the lock file's `plugins` slice and compares it to the stored\n * `.reconcile-hash`. On a match it returns with zero further I/O; otherwise it\n * regenerates the store's `package.json` and runs `bun install` against it.\n *\n * The install step is injectable (`InstallFn`) so tests stay hermetic — they\n * pass a fake installer that records calls and writes a stub `node_modules`.\n */\n\nimport { createHash } from \"node:crypto\";\nimport { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { readPluginsLockSlice } from \"@skaile/workspaces/core\";\nimport { nodeModulesDir, pluginsDir, pluginsPkgJson, reconcileHashFile } from \"./paths.js\";\nimport { parseSpec } from \"./spec.js\";\n\n/** How `InstallFn` may treat the store's lock: `frozen` forbids lock changes. */\nexport interface InstallOptions {\n /**\n * `false` when the spec list changed since the last `package.json`, so the\n * lock has to change too. Defaults to `true` (frozen when a lock exists).\n */\n frozen?: boolean;\n}\n\n/**\n * Installs the store's dependencies. Returns `ok: false` (never throws) on a\n * failed install so the reconciler can surface the captured `output`.\n */\nexport type InstallFn = (\n pluginsDir: string,\n opts?: InstallOptions,\n) => Promise<{ ok: boolean; output: string }>;\n\n/** Options for {@link reconcilePlugins}. */\nexport interface ReconcileOptions {\n /** Injectable installer. Defaults to a real `bun install` of the store. */\n runInstall?: InstallFn;\n /**\n * Lock slice to fold into the reconcile-hash. Defaults to\n * `readPluginsLockSlice(projectDir)` so a lock edit invalidates the hash.\n */\n lockSlice?: unknown;\n}\n\n/** Result of a reconcile pass. */\nexport interface ReconcileResult {\n changed: boolean;\n reason: \"no-plugins\" | \"up-to-date\" | \"reconciled\";\n}\n\n/** Run a command to completion, capturing stdout+stderr. `started: false` when it cannot spawn. */\nasync function runCapture(\n args: string[],\n cwd: string,\n): Promise<{ started: boolean; code: number; output: string }> {\n const { portableSpawn } = await import(\"@skaile/workspaces/core\");\n const proc = portableSpawn(args, { cwd });\n const chunks: string[] = [];\n const decoder = new TextDecoder();\n const pump = async (stream: ReadableStream<Uint8Array>) => {\n const reader = stream.getReader();\n for (;;) {\n const { done, value } = await reader.read();\n if (done) break;\n if (value) chunks.push(decoder.decode(value, { stream: true }));\n }\n };\n await Promise.all([pump(proc.stdout), pump(proc.stderr)]);\n const code = await proc.exited;\n // `portableSpawn` reports a spawn error (ENOENT) as exit -1 with no pid.\n return { started: proc.pid !== -1, code, output: chunks.join(\"\") };\n}\n\n/**\n * The default real installer: `bun install` inside the store directory, or\n * `npm install` when `bun` is not on PATH. Frozen only when a lock exists and\n * the spec list did not change (`opts.frozen !== false`): a changed list has to\n * rewrite the lock, which a frozen install refuses.\n */\nexport const defaultInstall: InstallFn = async (dir, opts = {}) => {\n const hasBunLock = existsSync(`${dir}/bun.lock`) || existsSync(`${dir}/bun.lockb`);\n const hasNpmLock = existsSync(`${dir}/package-lock.json`);\n const frozen = opts.frozen !== false;\n\n const bunArgs =\n frozen && (hasBunLock || hasNpmLock)\n ? [\"bun\", \"install\", \"--frozen-lockfile\"]\n : [\"bun\", \"install\"];\n const withBun = await runCapture(bunArgs, dir);\n if (withBun.started) return { ok: withBun.code === 0, output: withBun.output };\n\n const npmArgs =\n frozen && hasNpmLock\n ? [\"npm\", \"ci\", \"--ignore-scripts\", \"--no-audit\", \"--no-fund\"]\n : [\"npm\", \"install\", \"--ignore-scripts\", \"--no-audit\", \"--no-fund\"];\n const withNpm = await runCapture(npmArgs, dir);\n if (withNpm.started) return { ok: withNpm.code === 0, output: withNpm.output };\n return {\n ok: false,\n output:\n \"neither bun nor npm found on PATH; plugin install needs one of them (https://bun.sh or https://nodejs.org)\",\n };\n};\n\n/**\n * Generate the store's `package.json` from the plugin specs. Returns the\n * previous file content (`undefined` when there was none) and whether the\n * dependency set changed.\n */\nfunction writePackageJson(\n projectDir: string,\n plugins: string[],\n): { previous: string | undefined; depsChanged: boolean } {\n const dependencies: Record<string, string> = {};\n for (const spec of plugins) {\n const { name, range } = parseSpec(spec);\n dependencies[name] = range;\n }\n const pkg = {\n name: \"skaile-project-plugins\",\n private: true,\n dependencies,\n };\n const file = pluginsPkgJson(projectDir);\n const previous = existsSync(file) ? readFileSync(file, \"utf8\") : undefined;\n let before: Record<string, string> | undefined;\n try {\n before = previous === undefined ? undefined : JSON.parse(previous).dependencies;\n } catch {\n before = undefined;\n }\n const sortedJson = (d: Record<string, string> | undefined) =>\n JSON.stringify(Object.entries(d ?? {}).sort(([a], [b]) => a.localeCompare(b)));\n const depsChanged = before === undefined || sortedJson(before) !== sortedJson(dependencies);\n mkdirSync(pluginsDir(projectDir), { recursive: true });\n writeFileSync(file, `${JSON.stringify(pkg, null, 2)}\\n`);\n return { previous, depsChanged };\n}\n\n/**\n * Reconcile the plugin store for a project.\n *\n * @param projectDir - Project root containing `skaile.yaml` / `skaile.lock.yaml`.\n * @param plugins - The `skaile.yaml` `plugins:` list (npm specifiers).\n * @param opts - Optional injectable installer + lock slice override.\n * @returns Whether the store changed and why.\n */\nexport async function reconcilePlugins(\n projectDir: string,\n plugins: string[],\n opts: ReconcileOptions = {},\n): Promise<ReconcileResult> {\n if (plugins.length === 0) {\n return { changed: false, reason: \"no-plugins\" };\n }\n\n const lockSlice = opts.lockSlice ?? readPluginsLockSlice(projectDir);\n const wantHash = createHash(\"sha256\")\n .update(JSON.stringify({ plugins: [...plugins].sort(), lock: lockSlice }))\n .digest(\"hex\");\n\n const hashFile = reconcileHashFile(projectDir);\n if (existsSync(hashFile)) {\n const have = readFileSync(hashFile, \"utf8\").trim();\n if (have === wantHash) {\n return { changed: false, reason: \"up-to-date\" };\n }\n }\n\n const { previous, depsChanged } = writePackageJson(projectDir, plugins);\n\n const install = opts.runInstall ?? defaultInstall;\n const result = await install(pluginsDir(projectDir), { frozen: !depsChanged });\n if (!result.ok) {\n // A failed install must not leave the spec behind: the next reconcile\n // would compare against it and treat the store as already changed.\n if (previous === undefined) rmSync(pluginsPkgJson(projectDir), { force: true });\n else writeFileSync(pluginsPkgJson(projectDir), previous);\n throw new Error(`plugin install failed:\\n${result.output}`);\n }\n\n writeFileSync(hashFile, wantHash);\n return { changed: true, reason: \"reconciled\" };\n}\n\n/**\n * Put the store back to `previousPlugins` after `plugin install` failed past\n * the reconcile (the plugin installed but does not load). Best effort: a\n * failing reinstall is swallowed, the store is then rebuilt by the next\n * reconcile because the hash no longer matches the declared list.\n *\n * With no previous plugins every generated file of the store goes away\n * (`package.json`, hash, lock file and `node_modules`), so the store keeps\n * neither the rejected spec nor its installed package.\n */\nexport async function rollbackPluginStore(\n projectDir: string,\n previousPlugins: string[],\n opts: ReconcileOptions = {},\n): Promise<void> {\n if (previousPlugins.length === 0) {\n const dir = pluginsDir(projectDir);\n rmSync(pluginsPkgJson(projectDir), { force: true });\n rmSync(reconcileHashFile(projectDir), { force: true });\n rmSync(nodeModulesDir(projectDir), { recursive: true, force: true });\n for (const lock of [\"bun.lock\", \"bun.lockb\", \"package-lock.json\"]) {\n rmSync(join(dir, lock), { force: true });\n }\n return;\n }\n try {\n await reconcilePlugins(projectDir, previousPlugins, opts);\n } catch {\n // the next reconcile retries\n }\n}\n","/**\n * The project-local plugin store: reconcile (`<projectDir>/.skaile/plugins/`)\n * then load the reconciled plugins into the `pluginRegistry`.\n *\n * `ensurePluginsLoaded` is the single entrypoint commands wire in. It is a\n * guarded no-op when `plugins` is empty/undefined — zero overhead for the\n * common case where no project declares `plugins:` in `skaile.yaml`.\n */\n\nimport { type PluginRegistry, pluginRegistry } from \"@skaile/workspaces/plugin-registry\";\nimport type { Logger } from \"@skaile/workspaces/types\";\nimport pc from \"picocolors\";\nimport { type LoadResult, loadPlugins } from \"./load.js\";\nimport { type ReconcileOptions, reconcilePlugins } from \"./reconcile.js\";\nimport { specName } from \"./spec.js\";\n\nexport type { LoadResult } from \"./load.js\";\nexport { loadPlugins } from \"./load.js\";\nexport type { ReconcileOptions } from \"./reconcile.js\";\nexport { reconcilePlugins, rollbackPluginStore } from \"./reconcile.js\";\nexport { specName } from \"./spec.js\";\n\n/** Options for {@link ensurePluginsLoaded}. */\nexport interface EnsurePluginsOptions extends ReconcileOptions {\n log?: Logger;\n}\n\n/**\n * Reconcile the plugin store then load each plugin into `registry`.\n *\n * No-op (returns immediately) when `plugins` is empty/undefined, so the common\n * no-plugins path costs nothing.\n *\n * @param projectDir - Project root.\n * @param plugins - The `skaile.yaml` `plugins:` list (may be undefined).\n * @param registry - Registry to register into. Defaults to `pluginRegistry`.\n * @param opts - Injectable installer / lock slice + optional logger.\n * @returns The load result, or an empty result when there are no plugins.\n */\nexport async function ensurePluginsLoaded(\n projectDir: string,\n plugins: string[] | undefined,\n registry: PluginRegistry = pluginRegistry,\n opts: EnsurePluginsOptions = {},\n): Promise<LoadResult> {\n if (!plugins || plugins.length === 0) {\n return { loaded: [], failed: [] };\n }\n await reconcilePlugins(projectDir, plugins, opts);\n return loadPlugins(projectDir, plugins, registry, { log: opts.log });\n}\n\n/**\n * The installer's output of a failed `plugin install` is a dump (bun's banner, resolver\n * progress, then the `error:` lines). A load warning keeps the first line and the last error\n * line of it (p1113); `skaile plugin install <spec>` prints the whole output.\n */\nexport function condensePluginFailure(reason: string): string {\n const lines = reason\n .split(\"\\n\")\n .map((l) => l.trim())\n .filter((l) => l !== \"\");\n const [first, ...rest] = lines;\n if (!reason.startsWith(\"plugin install failed\") || first === undefined || rest.length === 0) {\n return reason;\n }\n const last = rest.filter((l) => /^(error|npm (ERR!|error))\\b/i.test(l)).pop() ?? rest.at(-1);\n return `${first.replace(/:$/, \"\")}: ${last}`;\n}\n\n/** One `! plugin <name> failed to load: <reason>` line on stderr (stdout carries a run's answer). */\nfunction warnPluginFailed(spec: string, reason: string): void {\n let name = spec;\n try {\n name = specName(spec);\n } catch {\n /* a spec that does not parse is named as written */\n }\n process.stderr.write(\n ` ${pc.yellow(\"!\")} plugin ${name} failed to load: ${condensePluginFailure(reason)}\\n`,\n );\n}\n\n/**\n * Reconcile + load the `plugins:` of the project's `skaile.yaml` into the process registry, so a\n * plugin's driver is known to `run`, `repl` and `config set driver`. A plugin that fails to\n * reconcile or load is skipped (its driver stays unknown, the command goes on) and named in one\n * `! plugin <name> failed to load: <reason>` line on stderr. An unreadable config is not this\n * function's to report: the command reads it again and says so.\n */\nexport async function loadDeclaredPlugins(projectDir: string): Promise<void> {\n let plugins: string[] | undefined;\n try {\n const { resolveSkWorkspaceConfig } = await import(\"@skaile/workspaces/core\");\n plugins = resolveSkWorkspaceConfig(projectDir).plugins;\n } catch {\n return;\n }\n if (!plugins || plugins.length === 0) return;\n try {\n const result = await ensurePluginsLoaded(projectDir, plugins, pluginRegistry);\n for (const f of result.failed) warnPluginFailed(f.spec, f.reason);\n } catch (err) {\n // The store could not be reconciled: no plugin was loaded.\n const reason = err instanceof Error ? err.message : String(err);\n for (const spec of plugins) warnPluginFailed(spec, reason);\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { softDepName } from './chunk-DADAZLFW.js';
2
- import { SKAILE_YAML_DEFAULT, resolveSkWorkspaceConfig } from './chunk-ZVZTCDUN.js';
1
+ import { softDepName } from './chunk-TDQ2ERCM.js';
2
+ import { SKAILE_YAML_DEFAULT, resolveSkWorkspaceConfig } from './chunk-2NOLF7B2.js';
3
3
  import { SUPPORTED_DRIVER_TARGETS } from './chunk-IG5LZ3WU.js';
4
4
  import { existsSync, readdirSync, readFileSync } from 'fs';
5
5
  import { homedir } from 'os';
@@ -62,10 +62,16 @@ function logErr(msg) {
62
62
  function logWarn(msg) {
63
63
  console.log(` ${pc.yellow("!")} ${msg}`);
64
64
  }
65
- function warnPlaceholderBodies(refs) {
66
- for (const ref of refs ?? []) {
65
+ function warnPlaceholderBodies(bodies, descriptions) {
66
+ const refs = [.../* @__PURE__ */ new Set([...bodies ?? [], ...descriptions ?? []])];
67
+ for (const ref of refs) {
68
+ const parts = [
69
+ ...descriptions?.includes(ref) ? ["description"] : [],
70
+ ...bodies?.includes(ref) ? ["body"] : []
71
+ ];
72
+ const both = parts.length > 1;
67
73
  logWarn(
68
- `${ref} body is still the scaffold placeholder; write it (\`skaile validate\` fails it)`
74
+ `${ref} ${parts.join(" and ")} ${both ? "are" : "is"} still the scaffold placeholder; write ${both ? "them" : "it"} (\`skaile validate\` fails ${both ? "them" : "it"})`
69
75
  );
70
76
  }
71
77
  }
@@ -213,5 +219,5 @@ function warnFilesOnlyDelegates(projectDir, target) {
213
219
  }
214
220
 
215
221
  export { KIND_COL_WIDTH, S, TARGET_DEFAULT_HINT, bareSoftDepName, colorRef, deferredWarnings, fitWidth, formatRelativeTime, formatSoftDepAddPreview, formatSoftDepHint, formatSoftDepRemovePreview, formatSoftDepSection, kindColor, kindColorPad, logErr, logInfo, logNoProject, logOk, logWarn, parseHarnessFilter, reportLegacyOmpCopies, requireProjectConfig, warnFilesOnlyDelegates, warnLegacyClaudeCopies, warnPlaceholderBodies };
216
- //# sourceMappingURL=chunk-VJ2DZLDM.js.map
217
- //# sourceMappingURL=chunk-VJ2DZLDM.js.map
222
+ //# sourceMapp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GAAA,GAAM,MAAA;AAChC;AAGA,IAAM,gBAAA,GAAmB,sBAAA;AAQlB,SAAS,sBAAA,CAAuB,YAAoB,MAAA,EAAsB;AAC/E,EAAA,IAAI,WAAW,OAAA,EAAS;AACxB,EAAA,MAAM,GAAA,GAAM,IAAA,CAAK,IAAA,CAAK,UAAA,EAAY,UAAU,eAAe,CAAA;AAC3D,EAAA,IAAI,KAAA;AACJ,EAAA,IAAI;AACF,IAAA,KAAA,GAAQ,WAAA,CAAY,GAAG,CAAA,CAAE,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,QAAA,CAAS,KAAK,CAAC,CAAA;AAAA,EAC1D,CAAA,CAAA,MAAQ;AACN,IAAA;AAAA,EACF;AACA,EAAA,MAAM,SAAA,GAAY,KAAA,CACf,MAAA,CAAO,CAAC,CAAA,KAAM;AACb,IAAA,IAAI;AACF,MAAA,OAAO,YAAA,CAAa,KAAK,IAAA,CAAK,GAAA,EAAK,CAAC,CAAA,EAAG,MAAM,CAAA,CAAE,QAAA,CAAS,gBAAgB,CAAA;AAAA,IAC1E,CAAA,CAAA,MAAQ;AACN,MAAA,OAAO,KAAA;AAAA,IACT;AAAA,EACF,CAAC,CAAA,CACA,GAAA,CAAI,CAAC,CAAA,KAAM,CAAA,CAAE,OAAA,CAAQ,OAAA,EAAS,EAAE,CAAC,CAAA,CACjC,IAAA,EAAK;AACR,EAAA,IAAI,SAAA,CAAU,WAAW,CAAA,EAAG;AAC5B,EAAA,OAAA;AAAA,IACE,CAAA,uCAAA,EAA0C,SAAA,CAAU,IAAA,CAAK,IAAI,CAAC,CAAA,wFAAA;AAAA,GAChE;AACF","file":"chunk-K5LVU2MN.js","sourcesContent":["import { existsSync, readdirSync, readFileSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport path from \"node:path\";\nimport { softDepName } from \"@skaile/workspaces/asset-manager\";\nimport {\n type DriverTarget,\n resolveSkWorkspaceConfig,\n SKAILE_YAML_DEFAULT,\n SUPPORTED_DRIVER_TARGETS,\n} from \"@skaile/workspaces/core\";\nimport pc from \"picocolors\";\n\n/**\n * Terminal styling helpers used across all CLI commands.\n *\n * @docLink cli/dev-guide#helpers\n */\nexport const S = {\n brand: (s: string) => pc.cyan(pc.bold(s)),\n cmd: (s: string) => pc.cyan(s),\n heading: (s: string) => pc.bold(s),\n bold: (s: string) => pc.bold(s),\n dim: (s: string) => pc.dim(s),\n ok: (s: string) => pc.green(s),\n warn: (s: string) => pc.yellow(s),\n err: (s: string) => pc.red(s),\n label: (s: string) => pc.dim(s),\n rule: (w = 40) => pc.dim(\"─\".repeat(w)),\n};\n\nconst KIND_COLORS: Record<string, (s: string) => string> = {\n skill: pc.blue,\n agent: pc.magenta,\n prompt: pc.yellow,\n flow: pc.green,\n preset: pc.cyan,\n contract: pc.red,\n connector: pc.green,\n knowledge: pc.cyan,\n persona: pc.cyan,\n ruleset: pc.cyan,\n \"mcp-server\": pc.magenta,\n};\n\n/**\n * Fit a plain (ANSI-free) string into exactly `width` columns: truncate with a\n * trailing `…` when too long, pad with spaces when too short. Keeps fixed-width\n * columns from overflowing the row when a value (e.g. an asset name) is wider\n * than its budget.\n */\nexport function fitWidth(s: string, width: number): string {\n if (width <= 0) return \"\";\n if (s.length > width) return width === 1 ? \"…\" : `${s.slice(0, width - 1)}…`;\n return s.padEnd(width);\n}\n\n/** Color-code an asset kind string. */\nexport function kindColor(kind: string): string {\n const colorFn = KIND_COLORS[kind] ?? pc.dim;\n return colorFn(kind);\n}\n\n/**\n * Widest kind label (`mcp-server`); the default kind-column width fits it so\n * long kinds don't shove the rest of the row out of alignment.\n */\nexport const KIND_COL_WIDTH = 10;\n\n/**\n * Shared `--target` help suffix: with no flag, the manager deploys into the\n * harness the project is configured for (the driver `skaile config show`\n * resolves), and only then falls back to `claude-code`.\n */\nexport const TARGET_DEFAULT_HINT = \"default: the project's configured harness, else claude-code\";\n\n/**\n * Color-code an asset kind string fit to exactly `width` columns — pads short\n * kinds, truncates over-long ones (via {@link fitWidth}) so the column can never\n * overflow and break row alignment.\n */\nexport function kindColorPad(kind: string, width = KIND_COL_WIDTH): string {\n const colorFn = KIND_COLORS[kind] ?? pc.dim;\n return colorFn(fitWidth(kind, width));\n}\n\n/** Color-code a \"kind:name\" reference string. */\nexport function colorRef(ref: string): string {\n const colonIdx = ref.indexOf(\":\");\n if (colonIdx === -1) return ref;\n const kind = ref.slice(0, colonIdx);\n const rest = ref.slice(colonIdx);\n return `${kindColor(kind)}${rest}`;\n}\n\n/**\n * Print a success line prefixed with a green check mark.\n *\n * @param msg - Message to display.\n * @docLink cli/dev-guide#helpers\n */\nexport function logOk(msg: string) {\n console.log(` ${pc.green(\"✓\")} ${msg}`);\n}\n/**\n * Print an error line prefixed with a red cross to stderr.\n *\n * @param msg - Message to display.\n * @docLink cli/dev-guide#helpers\n */\nexport function logErr(msg: string) {\n console.error(` ${pc.red(\"✗\")} ${msg}`);\n}\n/**\n * Print a warning line prefixed with a yellow exclamation mark.\n *\n * @param msg - Message to display.\n * @docLink cli/dev-guide#helpers\n */\nexport function logWarn(msg: string) {\n console.log(` ${pc.yellow(\"!\")} ${msg}`);\n}\n/**\n * One `!` line per deployed library asset whose body or description is still the untouched\n * `library create` scaffold: `validate` and the publish plan fail both, so `add`, `install` and\n * `update` name every placeholder they fail (p926).\n *\n * @param bodies - Canonical refs the asset manager reported as placeholder bodies.\n * @param descriptions - Canonical refs the asset manager reported as placeholder descriptions.\n */\nexport function warnPlaceholderBodies(\n bodies: readonly string[] | undefined,\n descriptions?: readonly string[],\n) {\n const refs = [...new Set([...(bodies ?? []), ...(descriptions ?? [])])];\n for (const ref of refs) {\n const parts = [\n ...(descriptions?.includes(ref) ? [\"description\"] : []),\n ...(bodies?.includes(ref) ? [\"body\"] : []),\n ];\n const both = parts.length > 1;\n logWarn(\n `${ref} ${parts.join(\" and \")} ${both ? \"are\" : \"is\"} still the scaffold placeholder; write ${both ? \"them\" : \"it\"} (\\`skaile validate\\` fails ${both ? \"them\" : \"it\"})`,\n );\n }\n}\n/**\n * Print an info line prefixed with a dim dot.\n *\n * @param msg - Message to display.\n * @docLink cli/dev-guide#helpers\n */\nexport function logInfo(msg: string) {\n console.log(` ${pc.dim(\"·\")} ${msg}`);\n}\n\n/** The nearest parent directory of `dir` that holds a `skaile.yaml`, or `undefined`. */\nfunction nearestParentProject(dir: string): string | undefined {\n for (let up = path.dirname(dir); up !== dir; dir = up, up = path.dirname(dir)) {\n if (existsSync(path.join(up, SKAILE_YAML_DEFAULT))) return up;\n }\n return undefined;\n}\n\n/**\n * Print the `No skaile.yaml found` line for `projectDir`, plus a second line naming the nearest\n * parent directory that holds a `skaile.yaml` and `--project-dir`, when there is one: skaile\n * does not search parent directories.\n */\nexport function logNoProject(projectDir: string): void {\n const dir = path.resolve(projectDir);\n logErr(`No ${S.cmd(\"skaile.yaml\")} found. Run ${S.cmd(\"skaile init\")} to create one.`);\n const parent = nearestParentProject(dir);\n if (parent) {\n logErr(\n `${S.cmd(parent)} holds a ${S.cmd(\"skaile.yaml\")}: run from there or pass ${S.cmd(`--project-dir ${parent}`)}.`,\n );\n }\n}\n\n/**\n * Stop a project command that has no usable project: print one `✗` line and exit 1, before\n * the command deploys, undeploys, locks or clones anything. Two causes: no `skaile.yaml` in\n * `projectDir` (`No skaile.yaml found`), or a `skaile.yaml` — project, app or user scope —\n * that does not parse (`<file> — parse error: …`, a duplicate key included). Without this a\n * broken file would read as \"nothing declared\" and `install` would undeploy every asset.\n *\n * Library-level commands (`library …`, `search`, `init`) have no project and do not call it.\n */\nexport function requireProjectConfig(\n projectDir: string,\n opts: { allowMissing?: boolean } = {},\n): void {\n const dir = path.resolve(projectDir);\n if (!existsSync(path.join(dir, SKAILE_YAML_DEFAULT))) {\n if (opts.allowMissing) return;\n logNoProject(dir);\n process.exit(1);\n }\n try {\n resolveSkWorkspaceConfig(dir);\n } catch (err) {\n logErr(err instanceof Error ? err.message : String(err));\n process.exit(1);\n }\n}\n\n/**\n * Hold warnings raised while a spinner animates and print them once it stops:\n * on a TTY a line written mid-spin is overwritten by the next frame. Pass\n * `push` as `AssetManager`'s `onLibraryCollision`, call `flush()` after\n * `spinner.stop(...)`. Warnings pushed after `flush()` print immediately.\n */\nexport function deferredWarnings(): { push: (msg: string) => void; flush: () => void } {\n const held: string[] = [];\n let live = false;\n return {\n push: (msg) => {\n if (live) logWarn(msg);\n else held.push(msg);\n },\n flush: () => {\n for (const msg of held.splice(0)) logWarn(msg);\n live = true;\n },\n };\n}\n\n/** Max stale `.claude/` copies named inline by {@link warnLegacyClaudeCopies}. */\nconst LEGACY_COPY_LIST_MAX = 5;\n\n/**\n * Print ONE warning when tracked assets still have a copy in `.claude/` although\n * the project deploys to another harness (the old default target, see\n * MIGRATION.md). Those copies are orphans: `remove` / `clean` / `list` only look\n * in the active harness dir. Nothing is deleted. Silent when there are none.\n */\nexport function warnLegacyClaudeCopies(am: {\n projectDir: string;\n driverTarget: string;\n listLegacyClaudeDeployed(): Array<{ path: string }>;\n}): void {\n let legacy: Array<{ path: string }>;\n try {\n legacy = am.listLegacyClaudeDeployed();\n } catch {\n return; // advisory only — never fail the command\n }\n if (legacy.length === 0) return;\n const rel = legacy.map((l) => path.relative(am.projectDir, l.path));\n const shown = rel.slice(0, LEGACY_COPY_LIST_MAX).join(\", \");\n const more =\n rel.length > LEGACY_COPY_LIST_MAX ? `, +${rel.length - LEGACY_COPY_LIST_MAX} more` : \"\";\n logWarn(\n `Stale ${S.cmd(\".claude/\")} copies no longer managed (deploying to ${am.driverTarget}): ${shown}${more}. ` +\n `Delete them once ${S.cmd(\"skaile install\")} has deployed to ${am.driverTarget}, or pass ${S.cmd(\"--target claude-code\")} to keep using .claude/.`,\n );\n}\n\n/**\n * Bare asset name of a canonical soft-dep target ref (`@pub/name@ver` → `name`),\n * for compact rendering in `info` / `tree` / `why`. Delegates to the asset-manager\n * parser (the soft-dep read surface) so the two never diverge.\n */\nexport function bareSoftDepName(ref: string): string {\n return softDepName(ref);\n}\n\n/**\n * The report-only soft-dep hint line shared by the `add` no-TTY branch and the\n * `install` surface, so the two user-facing wordings can't drift. Appends a\n * runnable `skaile add` suffix only when the target has a parseable ref.\n */\nexport function formatSoftDepHint(edge: { from: string; to: string; toRef?: string }): string {\n const suffix = edge.toRef ? ` — run \\`skaile add ${edge.toRef}\\` to include it.` : \"\";\n return `${bareSoftDepName(edge.from)} references ${bareSoftDepName(edge.to)} (soft dependency)${suffix}`;\n}\n\n/**\n * Build the \"Soft dependencies (inferred)\" section for `skaile info`. Returns one\n * header line plus one line per soft-dep target, each marked `(soft)` to read\n * differently from a typed `requires`. Empty array when there are no soft deps,\n * so the caller prints nothing.\n */\nexport function formatSoftDepSection(targets: string[]): string[] {\n if (targets.length === 0) return [];\n const out = [` ${S.label(\"Soft dependencies (inferred)\")}:`];\n for (const t of targets) out.push(` ${S.dim(\"·\")} ${t} ${S.dim(\"(soft)\")}`);\n return out;\n}\n\n/**\n * Footer line previewing the soft deps that *adding* the highlighted asset would\n * reference (manage TUI). \"references\" + \"not auto-added\" makes clear the pull is\n * report-only. Empty string when there are no targets, so the caller clears.\n */\nexport function formatSoftDepAddPreview(name: string, targets: string[]): string {\n if (targets.length === 0) return \"\";\n return S.dim(`${name} references ${targets.join(\", \")} (soft dep, not auto-added)`);\n}\n\n/**\n * Footer line previewing the soft deps that *removing* the highlighted asset\n * would orphan (manage TUI) — symmetric with {@link formatSoftDepAddPreview}.\n * Empty string when nothing would be orphaned, so the caller clears.\n */\nexport function formatSoftDepRemovePreview(name: string, targets: string[]): string {\n if (targets.length === 0) return \"\";\n return S.dim(`removing ${name} would orphan ${targets.join(\", \")} (soft dep)`);\n}\n\n/** Format a Date as a human-readable relative time string (e.g. \"5m ago\"). */\nexport function formatRelativeTime(date: Date): string {\n const diff = Date.now() - date.getTime();\n const seconds = Math.floor(diff / 1000);\n if (seconds < 60) return \"just now\";\n const minutes = Math.floor(seconds / 60);\n if (minutes < 60) return `${minutes}m ago`;\n const hours = Math.floor(minutes / 60);\n if (hours < 24) return `${hours}h ago`;\n const days = Math.floor(hours / 24);\n return `${days}d ago`;\n}\n\n/** Name the old `~/.omp/<dir>` copies a global deploy replaced (omp reads `~/.omp/agent/<dir>`). */\nexport function reportLegacyOmpCopies(removed: string[], kept: string[] = []): void {\n for (const p of removed) {\n logInfo(\n S.dim(`removed the old omp copy ${p.replace(homedir(), \"~\")} (omp reads ~/.omp/agent)`),\n );\n }\n for (const p of kept) {\n logWarn(\n `${p.replace(homedir(), \"~\")} is an old omp location and skaile did not write this copy, so it was kept: delete it if you do not need it`,\n );\n }\n}\n\n/**\n * Parse a `--harness a,b` value into validated {@link DriverTarget}s, exiting on\n * an unknown id. Returns `undefined` when the flag is absent (the caller then\n * resolves the full global harness set).\n */\nexport function parseHarnessFilter(raw: string | undefined): DriverTarget[] | undefined {\n if (!raw) return undefined;\n const ids = raw\n .split(\",\")\n .map((s) => s.trim())\n .filter(Boolean);\n const out: DriverTarget[] = [];\n for (const id of ids) {\n if (!(SUPPORTED_DRIVER_TARGETS as string[]).includes(id)) {\n logErr(`unknown harness '${id}' — expected one of: ${SUPPORTED_DRIVER_TARGETS.join(\", \")}`);\n process.exit(1);\n }\n out.push(id as DriverTarget);\n }\n return out.length > 0 ? out : undefined;\n}\n\n/** The sentence the agent renderer puts into a delegate sub-agent's file (`asset-manager` fragments). */\nconst SUB_AGENT_MARKER = \"You are a sub-agent:\";\n\n/**\n * One line when a Codex project holds delegate sub-agents. Codex does not load\n * `.codex/agents/*.toml` as spawnable agents (its `spawn_agent` has no `agent_type`), so the\n * delegate exists only as a file there and the orchestrator cannot call it (p428). A delegate is\n * found by the sentence the renderer writes into its file. Silent for every other harness.\n */\nexport function warnFilesOnlyDelegates(projectDir: string, target: string): void {\n if (target !== \"codex\") return;\n const dir = path.join(projectDir, \".codex\", \"skaile-agents\");\n let names: string[];\n try {\n names = readdirSync(dir).filter((f) => f.endsWith(\".md\"));\n } catch {\n return;\n }\n const delegates = names\n .filter((f) => {\n try {\n return readFileSync(path.join(dir, f), \"utf8\").includes(SUB_AGENT_MARKER);\n } catch {\n return false;\n }\n })\n .map((f) => f.replace(/\\.md$/, \"\"))\n .sort();\n if (delegates.length === 0) return;\n logWarn(\n `codex: delegate agents are files only (${delegates.join(\", \")}): Codex does not load .codex/agents as sub-agents, so the orchestrator cannot call them`,\n );\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { resolveSkWorkspaceConfig, readLinks, getGlobalCacheDir, sourceCacheKey } from './chunk-ZVZTCDUN.js';
2
- import { scanDirectory, tryWithFsDeadline } from './chunk-YW2BNDSE.js';
1
+ import { resolveSkWorkspaceConfig, readLinks, getGlobalCacheDir, sourceCacheKey } from './chunk-2NOLF7B2.js';
2
+ import { scanDirectory, tryWithFsDeadline } from './chunk-GOCWM7FN.js';
3
3
  import { existsSync, readFileSync } from 'fs';
4
4
  import { lstat, stat } from 'fs/promises';
5
5
  import { createRequire } from 'module';
@@ -229,5 +229,5 @@ function findCatalogEntry(entries, query) {
229
229
  }
230
230
 
231
231
  export { FACTORY_ASSETS_REPO_NAME, factoryAssetRoots, resolveFactoryAssetsRoot, resolveFactoryAssetsRootOrNull, resolvePackagedAssetsDir, resolveRuntimeAssets, resolveWorkspacesPackageRoot };
232
- //# sourceMappingURL=chunk-5RDZ5JHH.js.map
233
- //# sourceMappingURL=chunk-5RDZ5JHH.js.map
232
+ //# sourceMappingURL=chunk-KC6HGWXN.js.map
233
+ //# sourceMappingURL=chunk-KC6HGWXN.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,G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AK,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-5RDZ5JHH.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] = {\n path: join(sourcesDir, key),\n url: s.url,\n branch: s.pin,\n ...(s.publisher ? { publisher: s.publisher } : {}),\n };\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,EA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GJ;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-KC6HGWXN.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] = {\n path: join(sourcesDir, key),\n url: s.url,\n branch: s.pin,\n ...(s.publisher ? { publisher: s.publisher } : {}),\n };\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"]}
@@ -146,6 +146,6 @@ function formatDroppedToolsNotice(dropped) {
146
146
  return `Some MCP tools were not loaded because the Claude API would reject their input schema: ${items}. Do not try to call them.`;
147
147
  }
148
148
 
149
- export { checkToolInputSchema, checkToolPropertyKeys, filterInProcessMcpServerTools, formatDroppedToolsNotice };
150
- //# sourceMappingURL=chunk-X5O56UO4.js.map
151
- //# sourceMappingURL=chunk-X5O56UO4.js.map
149
+ export { TOOL_PROPERTY_KEY_PATTERN, checkToolInputSchema, checkToolPropertyKeys, filterInProcessMcpServerTools, formatDroppedToolsNotice };
150
+ //# sourceMappingURL=chunk-L2AMXONH.js.map
151
+ //# sourceMappingURL=chunk-L2AMXONH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../bridge/src/mcp-tool-schema-filter.ts"],"names":[],"mappings":";;;;AAuBO,IAAM,yBAAA,GAA4B;AAEzC,IAAM,kBAAA,GAAqB,8CAAA;AAC3B,IAAM,gBAAA,GAAmB,GAAA;AAYzB,IAAI,aAAA,GAAyC,IAAA;AAE7C,SAAS,wBAAA,GAA6C;AACpD,EAAA,IAAI,eAAe,OAAO,aAAA;AAG1B,EAAA,MAAM,GAAA,GAAM,IAAI,OAAA,CAAQ,EAAE,MAAA,EAAQ,OAAO,eAAA,EAAiB,KAAA,EAAO,MAAA,EAAQ,KAAA,EAAO,CAAA;AAChF,EAAA,MAAM,QAAA,GAAW,GAAA,CAAI,SAAA,CAAU,kBAAkB,CAAA;AACjD,EAAA,IAAI,CAAC,QAAA,EAAU,MAAM,IAAI,MAAM,8CAA8C,CAAA;AAC7E,EAAA,aAAA,GAAgB,QAAA;AAChB,EAAA,OAAO,QAAA;AACT;AAOO,SAAS,sBAAsB,MAAA,EAAgC;AACpE,EAAA,IAAI,CAAC,UAAU,OAAO,MAAA,KAAW,YAAY,KAAA,CAAM,OAAA,CAAQ,MAAM,CAAA,EAAG,OAAO,IAAA;AAC3E,EAAA,MAAM,QAAS,MAAA,CAAoC,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A,OAAO,0FAA0F,KAAK,CAAA,0BAAA,CAAA;AACxG","file":"chunk-L2AMXONH.js","sourcesContent":["/**\n * Drop MCP tools whose input schema the Claude API would reject.\n *\n * The API refuses a whole request when any one tool fails either check below,\n * so a single bad tool turns every turn of the session into a 400. The Claude\n * CLI drops such tools itself, but only after it has fetched its remote\n * feature flags; with flag fetching off (`DISABLE_TELEMETRY=1` and friends)\n * it sends them as they are. The driver therefore runs both checks itself\n * before any tool reaches the CLI:\n *\n * 1. every top-level property key matches {@link TOOL_PROPERTY_KEY_PATTERN};\n * 2. the schema is valid JSON Schema draft 2020-12 (ajv's meta-schema).\n *\n * In-process servers are inspected through their own `tools/list`, over an\n * in-memory transport, so the checked schema is byte-for-byte what the CLI\n * would receive (zod shape → JSON Schema exactly as the server converts it).\n */\nimport { InMemoryTransport } from \"@modelcontextprotocol/sdk/inMemory.js\";\nimport { createLogger } from \"@skaile/workspaces/core/logging\";\nimport type { Logger } from \"@skaile/workspaces/types\";\nimport { Ajv2020, type ValidateFunction } from \"ajv/dist/2020.js\";\n\n/** The Claude API's rule for top-level `input_schema.properties` keys. */\nexport const TOOL_PROPERTY_KEY_PATTERN = /^[a-zA-Z0-9_.-]{1,64}$/;\n\nconst DRAFT_2020_12_META = \"https://json-schema.org/draft/2020-12/schema\";\nconst PROBE_TIMEOUT_MS = 5_000;\n\n/** One tool removed before it reached the CLI. */\nexport interface DroppedMcpTool {\n /** MCP server name as passed to the SDK (`skaile-capabilities`, `skaile-connectors`, ...). */\n server: string;\n /** Tool name on that server. */\n tool: string;\n /** Human-readable reason; safe to show to the agent. */\n reason: string;\n}\n\nlet metaValidator: ValidateFunction | null = null;\n\nfunction draft202012MetaValidator(): ValidateFunction {\n if (metaValidator) return metaValidator;\n // Only the bundled meta-schema is compiled; tool schemas are validated as\n // data. validateFormats:false — the API checks structure, not `format` strings.\n const ajv = new Ajv2020({ strict: false, validateFormats: false, logger: false });\n const validate = ajv.getSchema(DRAFT_2020_12_META);\n if (!validate) throw new Error(\"ajv draft 2020-12 meta-schema is unavailable\");\n metaValidator = validate;\n return validate;\n}\n\n/**\n * Check only the property-key rule (rule 1).\n *\n * @returns `null` when every top-level property key is acceptable, otherwise the reason.\n */\nexport function checkToolPropertyKeys(schema: unknown): string | null {\n if (!schema || typeof schema !== \"object\" || Array.isArray(schema)) return null;\n const props = (schema as { properties?: unknown }).properties;\n if (!props || typeof props !== \"object\" || Array.isArray(props)) return null;\n for (const key of Object.keys(props)) {\n if (!TOOL_PROPERTY_KEY_PATTERN.test(key)) {\n return `property key ${JSON.stringify(key)} does not match ${TOOL_PROPERTY_KEY_PATTERN.source}`;\n }\n }\n return null;\n}\n\n/**\n * Check one tool input schema, as it goes on the wire, against both API rules.\n *\n * @returns `null` when the schema is acceptable, otherwise the reason it is not.\n */\nexport function checkToolInputSchema(schema: unknown): string | null {\n if (!schema || typeof schema !== \"object\" || Array.isArray(schema)) {\n return \"input schema is not a JSON object\";\n }\n const keyReason = checkToolPropertyKeys(schema);\n if (keyReason) return keyReason;\n // Validated against the 2020-12 meta-schema regardless of the schema's own\n // `$schema` (the MCP SDK stamps draft-07 on every in-process tool), because\n // the API names 2020-12 in its 400. Deliberate consequence: a draft-07-only\n // construct such as a tuple's `items: [...]` (`z.tuple()`) is dropped too.\n const validate = draft202012MetaValidator();\n if (!validate(schema)) {\n const first = validate.errors?.[0];\n const where = first?.instancePath || \"/\";\n return `not valid JSON Schema draft 2020-12: ${where} ${first?.message ?? \"is invalid\"}`;\n }\n return null;\n}\n\n// ── In-process (type: \"sdk\") servers ─────────────────────────────────────────\n\ninterface RegisteredToolLike {\n enabled?: boolean;\n disable?: () => void;\n}\n\ninterface McpServerInstanceLike {\n connect(transport: unknown): Promise<void>;\n close(): Promise<void>;\n isConnected?: () => boolean;\n _registeredTools?: Record<string, RegisteredToolLike>;\n}\n\ninterface WireTool {\n name: string;\n inputSchema?: unknown;\n}\n\n/** Instances already filtered; their bad tools stay disabled for good. */\nconst filteredInstances = new WeakMap<object, DroppedMcpTool[]>();\n\nfunction sdkInstanceOf(config: unknown): McpServerInstanceLike | null {\n if (!config || typeof config !== \"object\") return null;\n const c = config as { type?: unknown; instance?: unknown };\n if (c.type !== \"sdk\" || !c.instance || typeof c.instance !== \"object\") return null;\n const inst = c.instance as McpServerInstanceLike;\n return typeof inst.connect === \"function\" && typeof inst.close === \"function\" ? inst : null;\n}\n\nfunction withTimeout<T>(p: Promise<T>, what: string): Promise<T> {\n let timer: ReturnType<typeof setTimeout> | undefined;\n const timeout = new Promise<never>((_, reject) => {\n timer = setTimeout(() => reject(new Error(`${what} timed out`)), PROBE_TIMEOUT_MS);\n });\n return Promise.race([p, timeout]).finally(() => clearTimeout(timer));\n}\n\n/**\n * Speak just enough JSON-RPC to read the server's `tools/list`. A hand-rolled\n * exchange rather than the SDK `Client`, whose result validation would reject\n * the whole list over the one malformed tool this exists to find.\n */\nasync function listInProcessTools(instance: McpServerInstanceLike): Promise<WireTool[]> {\n const [clientSide, serverSide] = InMemoryTransport.createLinkedPair();\n const pending = new Map<number, (msg: Record<string, unknown>) => void>();\n clientSide.onmessage = (msg) => {\n const m = msg as Record<string, unknown>;\n const id = typeof m.id === \"number\" ? m.id : undefined;\n if (id === undefined) return;\n pending.get(id)?.(m);\n pending.delete(id);\n };\n let nextId = 1;\n const call = (method: string, params: Record<string, unknown>) =>\n withTimeout(\n new Promise<Record<string, unknown>>((resolve, reject) => {\n const id = nextId++;\n pending.set(id, resolve);\n clientSide.send({ jsonrpc: \"2.0\", id, method, params }).catch(reject);\n }),\n method,\n ).then((res) => {\n if (res.error) throw new Error(`${method} failed: ${JSON.stringify(res.error)}`);\n return (res.result ?? {}) as Record<string, unknown>;\n });\n\n await clientSide.start();\n await instance.connect(serverSide);\n try {\n await call(\"initialize\", {\n protocolVersion: \"2025-06-18\",\n capabilities: {},\n clientInfo: { name: \"skaile-tool-schema-filter\", version: \"1.0.0\" },\n });\n await clientSide.send({ jsonrpc: \"2.0\", method: \"notifications/initialized\" });\n const tools: WireTool[] = [];\n let cursor: string | undefined;\n do {\n const page = await call(\"tools/list\", cursor ? { cursor } : {});\n tools.push(...((page.tools as WireTool[] | undefined) ?? []));\n cursor = typeof page.nextCursor === \"string\" ? page.nextCursor : undefined;\n } while (cursor);\n return tools;\n } finally {\n // Leaves the instance unconnected so the SDK can attach its own transport.\n await instance.close().catch(() => {});\n }\n}\n\nconst defaultLog = createLogger({ kind: \"mcp\", subkind: \"tool-schema-filter\" });\n\n/**\n * Disable every tool on an in-process MCP server whose wire input schema\n * fails {@link checkToolInputSchema}. Valid tools on the same server stay.\n *\n * Mutates the server in place (`RegisteredTool.disable()` hides a tool from\n * `tools/list` and refuses calls to it). Non-`sdk` configs (stdio/sse/http)\n * are returned untouched: the CLI spawns those, so the bridge cannot see\n * their tools. Fails open — a server that cannot be inspected is passed\n * through and a warning is logged, because blocking it would cost the\n * session every one of its valid tools.\n *\n * @returns the tools dropped from this server (empty when none or not inspectable).\n */\nexport async function filterInProcessMcpServerTools(\n server: string,\n config: unknown,\n log: Logger = defaultLog,\n): Promise<DroppedMcpTool[]> {\n const instance = sdkInstanceOf(config);\n if (!instance) return [];\n const cached = filteredInstances.get(instance);\n if (cached) return cached;\n const registered = instance._registeredTools;\n if (!registered || Object.keys(registered).length === 0) return [];\n if (instance.isConnected?.()) {\n // Already attached to a live query; it was either filtered when first\n // passed or belongs to someone else's transport. Do not steal it.\n log.debug(\"in-process MCP server already connected; schema check skipped\", { server });\n return [];\n }\n\n let wireTools: WireTool[];\n try {\n wireTools = await listInProcessTools(instance);\n } catch (err) {\n log.warn(\"could not inspect in-process MCP server tools; passing it unchanged\", {\n server,\n error: err instanceof Error ? err.message : String(err),\n });\n return [];\n }\n\n const dropped: DroppedMcpTool[] = [];\n for (const tool of wireTools) {\n const reason = checkToolInputSchema(tool.inputSchema);\n if (!reason) continue;\n const handle = registered[tool.name];\n if (typeof handle?.disable !== \"function\") {\n log.warn(\"MCP tool has an invalid input schema but cannot be disabled\", {\n server,\n tool: tool.name,\n reason,\n });\n continue;\n }\n handle.disable();\n dropped.push({ server, tool: tool.name, reason });\n log.warn(\"MCP tool dropped: invalid input schema\", { server, tool: tool.name, reason });\n }\n filteredInstances.set(instance, dropped);\n return dropped;\n}\n\n/**\n * The line the agent reads about dropped tools, mirroring what the CLI\n * reports when it drops them itself. `null` when nothing was dropped.\n */\nexport function formatDroppedToolsNotice(dropped: readonly DroppedMcpTool[]): string | null {\n if (dropped.length === 0) return null;\n const items = dropped.map((d) => `${d.tool} (server ${d.server}: ${d.reason})`).join(\"; \");\n return `Some MCP tools were not loaded because the Claude API would reject their input schema: ${items}. Do not try to call them.`;\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { getProviderPreset, resolvePresetBaseUrl, expandPreset, resolveProbeUrl, buildCredentialHeaders, presetBaseUrl } from './chunk-6Q7NKTDG.js';
2
- import { modelIdSchemaForTarget } from './chunk-YK3XLEQJ.js';
1
+ import { getProviderPreset, resolvePresetBaseUrl, expandPreset, resolveProbeUrl, buildCredentialHeaders, presetBaseUrl } from './chunk-X54YR4AW.js';
2
+ import { modelIdSchemaForTarget } from './chunk-CKNIYIV2.js';
3
3
  import { resolveEntryBaseUrl, entryTransport, parseModelRef, registryEntries } from './chunk-MJHSLODD.js';
4
4
 
5
5
  // bridge/src/models.ts
@@ -323,5 +323,5 @@ function resolveModelTier(tier, sessionModel, options = {}) {
323
323
  }
324
324
 
325
325
  export { ModelTierResolutionError, PROVIDER_MODEL_TIERS, STATIC_MODELS, fetchProviderModels, getModels, getStaticModels, modelIdTargetForEntry, resolveManifestModel, resolveModelCapabilities, resolveModelTier };
326
- //# sourceMappingURL=chunk-RTNWU2UD.js.map
327
- //# sourceMappingURL=chunk-RTNWU2UD.js.map
326
+ //# sourceMappingURL=chunk-L5XUEC2W.js.map
327
+ //# sourceMappingURL=chunk-L5XUEC2W.js.map