@skaile/workspaces 4.11.0 → 4.12.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 (260) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/{asset-feeds-3TOP4ZKE.js → asset-feeds-WSKIL5GA.js} +13 -13
  3. package/dist/{asset-feeds-3TOP4ZKE.js.map → asset-feeds-WSKIL5GA.js.map} +1 -1
  4. package/dist/asset-manager/catalog-deployer.js +9 -9
  5. package/dist/asset-manager/index.js +13 -13
  6. package/dist/asset-manager/installer.js +9 -9
  7. package/dist/bridge/drivers/claude-sdk.js +16 -14
  8. package/dist/bridge/drivers/claude-sdk.js.map +1 -1
  9. package/dist/bridge/drivers/codex.js +11 -11
  10. package/dist/bridge/drivers/continue.js +13 -12
  11. package/dist/bridge/drivers/continue.js.map +1 -1
  12. package/dist/bridge/drivers/echo.js +10 -8
  13. package/dist/bridge/drivers/echo.js.map +1 -1
  14. package/dist/bridge/drivers/gemini.js +9 -8
  15. package/dist/bridge/drivers/goose.js +12 -11
  16. package/dist/bridge/drivers/goose.js.map +1 -1
  17. package/dist/bridge/drivers/omp.js +7 -6
  18. package/dist/bridge/drivers/omp.js.map +1 -1
  19. package/dist/bridge/drivers/opencode.js +14 -12
  20. package/dist/bridge/drivers/opencode.js.map +1 -1
  21. package/dist/bridge/drivers/qwen.js +9 -8
  22. package/dist/bridge/drivers/qwen.js.map +1 -1
  23. package/dist/bridge/index.js +13 -13
  24. package/dist/bridge/src/cloud.d.ts.map +1 -1
  25. package/dist/bridge/src/drivers/claude-sdk.d.ts.map +1 -1
  26. package/dist/bridge/src/drivers/echo.d.ts.map +1 -1
  27. package/dist/bridge/src/drivers/omp-models-yml.d.ts.map +1 -1
  28. package/dist/bridge/src/provider-materialize/continue-config-yaml.d.ts.map +1 -1
  29. package/dist/bridge/src/provider-materialize/env-drivers.d.ts +20 -5
  30. package/dist/bridge/src/provider-materialize/env-drivers.d.ts.map +1 -1
  31. package/dist/bridge/src/provider-materialize/opencode-config.d.ts.map +1 -1
  32. package/dist/bridge/src/types.d.ts +6 -2
  33. package/dist/bridge/src/types.d.ts.map +1 -1
  34. package/dist/{chunk-MKZOK4JU.js → chunk-2FBPAR2V.js} +3 -3
  35. package/dist/{chunk-MKZOK4JU.js.map → chunk-2FBPAR2V.js.map} +1 -1
  36. package/dist/{chunk-HO4UO25I.js → chunk-2J3PASYF.js} +3 -3
  37. package/dist/{chunk-HO4UO25I.js.map → chunk-2J3PASYF.js.map} +1 -1
  38. package/dist/{chunk-JECDED7B.js → chunk-3QCLMSXU.js} +5 -5
  39. package/dist/{chunk-JECDED7B.js.map → chunk-3QCLMSXU.js.map} +1 -1
  40. package/dist/{chunk-BXV6RLF4.js → chunk-4G6HFU27.js} +4 -4
  41. package/dist/{chunk-BXV6RLF4.js.map → chunk-4G6HFU27.js.map} +1 -1
  42. package/dist/{chunk-OUJVFZWJ.js → chunk-4SIMGJIU.js} +4 -9
  43. package/dist/chunk-4SIMGJIU.js.map +1 -0
  44. package/dist/{chunk-L3PZINDD.js → chunk-5UPJWC3M.js} +8 -8
  45. package/dist/{chunk-L3PZINDD.js.map → chunk-5UPJWC3M.js.map} +1 -1
  46. package/dist/{chunk-O3DHAGBO.js → chunk-626UIDZT.js} +6 -5
  47. package/dist/chunk-626UIDZT.js.map +1 -0
  48. package/dist/{chunk-2HUQUTJ3.js → chunk-6XIIGQXL.js} +4 -4
  49. package/dist/{chunk-2HUQUTJ3.js.map → chunk-6XIIGQXL.js.map} +1 -1
  50. package/dist/{chunk-A3X4LDOD.js → chunk-7EYRYGIM.js} +6 -6
  51. package/dist/{chunk-A3X4LDOD.js.map → chunk-7EYRYGIM.js.map} +1 -1
  52. package/dist/{chunk-7IRJ4K4F.js → chunk-7IH3RKKK.js} +3 -3
  53. package/dist/{chunk-7IRJ4K4F.js.map → chunk-7IH3RKKK.js.map} +1 -1
  54. package/dist/chunk-ALLCAFHQ.js +365 -0
  55. package/dist/chunk-ALLCAFHQ.js.map +1 -0
  56. package/dist/{chunk-W4IPN3DD.js → chunk-BOFL7GIF.js} +62 -10
  57. package/dist/chunk-BOFL7GIF.js.map +1 -0
  58. package/dist/{chunk-JM2LRJ46.js → chunk-BVYTXIN5.js} +3 -3
  59. package/dist/{chunk-JM2LRJ46.js.map → chunk-BVYTXIN5.js.map} +1 -1
  60. package/dist/{chunk-S2MT6SDZ.js → chunk-BYBIEHQX.js} +98 -39
  61. package/dist/chunk-BYBIEHQX.js.map +1 -0
  62. package/dist/{chunk-WXB6YEHZ.js → chunk-C7DPL3YA.js} +3 -3
  63. package/dist/{chunk-WXB6YEHZ.js.map → chunk-C7DPL3YA.js.map} +1 -1
  64. package/dist/{chunk-CJXSTOGW.js → chunk-C7R65ZTD.js} +4 -4
  65. package/dist/{chunk-CJXSTOGW.js.map → chunk-C7R65ZTD.js.map} +1 -1
  66. package/dist/{chunk-35PMOWAD.js → chunk-CPIAQTYM.js} +4 -4
  67. package/dist/chunk-CPIAQTYM.js.map +1 -0
  68. package/dist/{chunk-REYJKU7T.js → chunk-DHMBE5J7.js} +12 -364
  69. package/dist/chunk-DHMBE5J7.js.map +1 -0
  70. package/dist/chunk-DMJ4FUEO.js +141 -0
  71. package/dist/chunk-DMJ4FUEO.js.map +1 -0
  72. package/dist/{chunk-7ZJXFQ42.js → chunk-DPKRBLYC.js} +3 -3
  73. package/dist/{chunk-7ZJXFQ42.js.map → chunk-DPKRBLYC.js.map} +1 -1
  74. package/dist/{chunk-KSIRR5PL.js → chunk-DPLIN2RA.js} +3 -3
  75. package/dist/{chunk-KSIRR5PL.js.map → chunk-DPLIN2RA.js.map} +1 -1
  76. package/dist/{chunk-ILG4BXYE.js → chunk-GZZPKAV5.js} +27 -3
  77. package/dist/chunk-GZZPKAV5.js.map +1 -0
  78. package/dist/{chunk-M5H4DWIA.js → chunk-HGPSZXZP.js} +3 -3
  79. package/dist/{chunk-M5H4DWIA.js.map → chunk-HGPSZXZP.js.map} +1 -1
  80. package/dist/{chunk-MMLXSVQ3.js → chunk-IGI6M7MS.js} +5 -5
  81. package/dist/{chunk-MMLXSVQ3.js.map → chunk-IGI6M7MS.js.map} +1 -1
  82. package/dist/{chunk-VLXODO37.js → chunk-KECSNBET.js} +3 -3
  83. package/dist/{chunk-VLXODO37.js.map → chunk-KECSNBET.js.map} +1 -1
  84. package/dist/{chunk-3YTFHHMI.js → chunk-LHBWHIIT.js} +3 -3
  85. package/dist/{chunk-3YTFHHMI.js.map → chunk-LHBWHIIT.js.map} +1 -1
  86. package/dist/{chunk-IGGHUTOW.js → chunk-MH4GYGOW.js} +4 -4
  87. package/dist/{chunk-IGGHUTOW.js.map → chunk-MH4GYGOW.js.map} +1 -1
  88. package/dist/{chunk-WILO77HE.js → chunk-N4DHPRBS.js} +4 -4
  89. package/dist/{chunk-WILO77HE.js.map → chunk-N4DHPRBS.js.map} +1 -1
  90. package/dist/{chunk-SIGVAFRJ.js → chunk-N5O6Z7HV.js} +10 -10
  91. package/dist/{chunk-SIGVAFRJ.js.map → chunk-N5O6Z7HV.js.map} +1 -1
  92. package/dist/{chunk-FAI2SMFE.js → chunk-P2DLXBZK.js} +4 -4
  93. package/dist/{chunk-FAI2SMFE.js.map → chunk-P2DLXBZK.js.map} +1 -1
  94. package/dist/{chunk-GUZNTYHE.js → chunk-PCM75ICY.js} +4 -4
  95. package/dist/{chunk-GUZNTYHE.js.map → chunk-PCM75ICY.js.map} +1 -1
  96. package/dist/{chunk-7BUZQVRR.js → chunk-Q6NDQ6BH.js} +4 -4
  97. package/dist/{chunk-7BUZQVRR.js.map → chunk-Q6NDQ6BH.js.map} +1 -1
  98. package/dist/{chunk-PBCNRS7Q.js → chunk-QOCH3LO7.js} +6 -6
  99. package/dist/{chunk-PBCNRS7Q.js.map → chunk-QOCH3LO7.js.map} +1 -1
  100. package/dist/{chunk-GXACG5ZE.js → chunk-QUSE2T4N.js} +50 -41
  101. package/dist/chunk-QUSE2T4N.js.map +1 -0
  102. package/dist/{chunk-AT2TJEWG.js → chunk-RE2XE2AP.js} +11 -11
  103. package/dist/chunk-RE2XE2AP.js.map +1 -0
  104. package/dist/{chunk-DMUY5C3X.js → chunk-RJNBMEFG.js} +7 -7
  105. package/dist/{chunk-DMUY5C3X.js.map → chunk-RJNBMEFG.js.map} +1 -1
  106. package/dist/{chunk-2D5BYAL6.js → chunk-RQLL7L72.js} +3 -3
  107. package/dist/{chunk-2D5BYAL6.js.map → chunk-RQLL7L72.js.map} +1 -1
  108. package/dist/{chunk-3T5DRUNZ.js → chunk-RQRWMKST.js} +5 -5
  109. package/dist/{chunk-3T5DRUNZ.js.map → chunk-RQRWMKST.js.map} +1 -1
  110. package/dist/{chunk-3HKYCT2M.js → chunk-RUBPZLMO.js} +3 -3
  111. package/dist/{chunk-3HKYCT2M.js.map → chunk-RUBPZLMO.js.map} +1 -1
  112. package/dist/{chunk-3XXQPHGL.js → chunk-T3YUSWVK.js} +4 -4
  113. package/dist/{chunk-3XXQPHGL.js.map → chunk-T3YUSWVK.js.map} +1 -1
  114. package/dist/{chunk-6XKQEDF7.js → chunk-TMOS6KL5.js} +6 -5
  115. package/dist/chunk-TMOS6KL5.js.map +1 -0
  116. package/dist/{chunk-7SNYWCQS.js → chunk-TVQPJZSO.js} +3 -3
  117. package/dist/{chunk-7SNYWCQS.js.map → chunk-TVQPJZSO.js.map} +1 -1
  118. package/dist/{chunk-IECQMSQ5.js → chunk-UE4AKJNQ.js} +4 -129
  119. package/dist/chunk-UE4AKJNQ.js.map +1 -0
  120. package/dist/{chunk-ELPR5XBG.js → chunk-V4RGCKYC.js} +5 -3
  121. package/dist/chunk-V4RGCKYC.js.map +1 -0
  122. package/dist/{chunk-UKJMQZV6.js → chunk-VOEBLPXO.js} +2 -2
  123. package/dist/chunk-VOEBLPXO.js.map +1 -0
  124. package/dist/{chunk-KJM7Y2FW.js → chunk-WNDDWWGU.js} +7 -7
  125. package/dist/{chunk-KJM7Y2FW.js.map → chunk-WNDDWWGU.js.map} +1 -1
  126. package/dist/{chunk-KLMXMW6Z.js → chunk-XPDB4O4H.js} +3 -3
  127. package/dist/{chunk-KLMXMW6Z.js.map → chunk-XPDB4O4H.js.map} +1 -1
  128. package/dist/{chunk-I3UWSGEB.js → chunk-ZK7DQRB2.js} +3 -3
  129. package/dist/{chunk-I3UWSGEB.js.map → chunk-ZK7DQRB2.js.map} +1 -1
  130. package/dist/{chunk-UXUDNBJM.js → chunk-ZSB2SPV4.js} +3 -3
  131. package/dist/{chunk-UXUDNBJM.js.map → chunk-ZSB2SPV4.js.map} +1 -1
  132. package/dist/cli/index.js +69 -68
  133. package/dist/cli/index.js.map +1 -1
  134. package/dist/connectors/config.js +4 -13
  135. package/dist/connectors/index.js +21 -20
  136. package/dist/connectors/src/config.d.ts.map +1 -1
  137. package/dist/connectors/src/connector-manager.d.ts.map +1 -1
  138. package/dist/connectors/src/materialized-connectors.d.ts.map +1 -1
  139. package/dist/connectors/src/secrets.d.ts.map +1 -1
  140. package/dist/core/index.js +8 -8
  141. package/dist/core/logging.js +2 -2
  142. package/dist/core/manifest.js +2 -2
  143. package/dist/core/provider-registry-credentials.js +2 -2
  144. package/dist/core/provider-registry.js +1 -1
  145. package/dist/core/runtime-assets.js +4 -4
  146. package/dist/core/src/index.d.ts +1 -1
  147. package/dist/core/src/index.d.ts.map +1 -1
  148. package/dist/core/src/logging/create-logger.d.ts.map +1 -1
  149. package/dist/core/src/logging/index.d.ts +1 -0
  150. package/dist/core/src/logging/index.d.ts.map +1 -1
  151. package/dist/core/src/logging/redact.d.ts +33 -0
  152. package/dist/core/src/logging/redact.d.ts.map +1 -0
  153. package/dist/core/src/logging/sanitize.d.ts +11 -0
  154. package/dist/core/src/logging/sanitize.d.ts.map +1 -1
  155. package/dist/core/src/provider-registry.d.ts +22 -0
  156. package/dist/core/src/provider-registry.d.ts.map +1 -1
  157. package/dist/core/workspace-config.js +3 -3
  158. package/dist/deploy/index.js +8 -8
  159. package/dist/discovery/index.js +3 -3
  160. package/dist/{ensure-sources-2OC2X3ZM.js → ensure-sources-ZZRU74UG.js} +16 -16
  161. package/dist/{ensure-sources-2OC2X3ZM.js.map → ensure-sources-ZZRU74UG.js.map} +1 -1
  162. package/dist/factory-assets/connectors/box.js +21 -20
  163. package/dist/factory-assets/connectors/deploy.js +21 -20
  164. package/dist/factory-assets/connectors/devserver.js +21 -20
  165. package/dist/factory-assets/connectors/flow/CONNECTOR.md +4 -2
  166. package/dist/factory-assets/connectors/flow/adapter.js +21 -20
  167. package/dist/factory-assets/connectors/flow/contract/schema.d.ts +12 -0
  168. package/dist/factory-assets/connectors/flow/contract/schema.d.ts.map +1 -1
  169. package/dist/factory-assets/connectors/flow/contract.js +4 -3
  170. package/dist/factory-assets/connectors/flow/engine/node-shape.d.ts.map +1 -1
  171. package/dist/factory-assets/connectors/flow/engine.js +12 -11
  172. package/dist/factory-assets/connectors/flow/prompt-fragments.js +3 -2
  173. package/dist/factory-assets/connectors/flow/run-flow.js +23 -22
  174. package/dist/factory-assets/connectors/flow.js +21 -20
  175. package/dist/factory-assets/connectors/git/driver.d.ts.map +1 -1
  176. package/dist/factory-assets/connectors/git.js +21 -20
  177. package/dist/factory-assets/connectors/gmail.js +21 -20
  178. package/dist/factory-assets/connectors/googledrive.js +21 -20
  179. package/dist/factory-assets/connectors/local.js +21 -20
  180. package/dist/factory-assets/connectors/mattermost.js +21 -20
  181. package/dist/factory-assets/connectors/memory.js +21 -20
  182. package/dist/factory-assets/connectors/minio.js +21 -20
  183. package/dist/factory-assets/connectors/postgres.js +21 -20
  184. package/dist/factory-assets/connectors/s3.js +21 -20
  185. package/dist/factory-assets/connectors/sharepoint.js +21 -20
  186. package/dist/factory-assets/connectors/sqlite.js +21 -20
  187. package/dist/factory-assets/connectors/static-server.js +21 -20
  188. package/dist/factory-assets/connectors/tunnel.js +21 -20
  189. package/dist/factory-assets/connectors/webdav.js +21 -20
  190. package/dist/factory-assets/connectors/xstate-store.js +21 -20
  191. package/dist/factory-assets/connectors/xstate.js +21 -20
  192. package/dist/flows-XHRUNYJV.js +23 -0
  193. package/dist/{flows-H6FL4NZU.js.map → flows-XHRUNYJV.js.map} +1 -1
  194. package/dist/{helpers-RPJUSSG3.js → helpers-M76C6JVC.js} +16 -16
  195. package/dist/{helpers-RPJUSSG3.js.map → helpers-M76C6JVC.js.map} +1 -1
  196. package/dist/library/index.js +11 -11
  197. package/dist/library/install.js +1 -15
  198. package/dist/library/src/install/install-from-manifest.d.ts.map +1 -1
  199. package/dist/{library-publish-AAD6GTIF.js → library-publish-EQYEJXWO.js} +23 -22
  200. package/dist/library-publish-EQYEJXWO.js.map +1 -0
  201. package/dist/open-library-YTP7CVVT.js +36 -0
  202. package/dist/{open-library-HDOM4MLS.js.map → open-library-YTP7CVVT.js.map} +1 -1
  203. package/dist/paths-BG3I2LPM.js +19 -0
  204. package/dist/{paths-RL6NZW5X.js.map → paths-BG3I2LPM.js.map} +1 -1
  205. package/dist/{plugin-store-ZTAJCMTY.js → plugin-store-BCNR6ZBP.js} +10 -10
  206. package/dist/{plugin-store-ZTAJCMTY.js.map → plugin-store-BCNR6ZBP.js.map} +1 -1
  207. package/dist/{project-2B52FKAY.js → project-THCZLS67.js} +17 -17
  208. package/dist/{project-2B52FKAY.js.map → project-THCZLS67.js.map} +1 -1
  209. package/dist/resolver/index.js +9 -9
  210. package/dist/runner/index.js +32 -31
  211. package/dist/runner/src/capability-registry.d.ts +13 -1
  212. package/dist/runner/src/capability-registry.d.ts.map +1 -1
  213. package/dist/runner/src/lifecycle-handler.d.ts.map +1 -1
  214. package/dist/runner/src/log-content.d.ts +22 -0
  215. package/dist/runner/src/log-content.d.ts.map +1 -0
  216. package/dist/runner/src/serve.d.ts.map +1 -1
  217. package/dist/runner/src/session-builder.d.ts.map +1 -1
  218. package/dist/sdk/asset-manager.js +13 -13
  219. package/dist/sdk/bridge.js +13 -13
  220. package/dist/sdk/core.js +8 -8
  221. package/dist/sdk/flow.js +12 -11
  222. package/dist/sdk/index.js +32 -31
  223. package/dist/sdk/index.js.map +1 -1
  224. package/dist/sdk/resolver.js +9 -9
  225. package/dist/sdk/runner.js +32 -31
  226. package/dist/{setup-MVBITSVT.js → setup-QN4HKSFJ.js} +22 -22
  227. package/dist/{setup-MVBITSVT.js.map → setup-QN4HKSFJ.js.map} +1 -1
  228. package/dist/skills-FKVBIDNM.js +23 -0
  229. package/dist/{skills-Y6MU2NRI.js.map → skills-FKVBIDNM.js.map} +1 -1
  230. package/dist/source-5EAGZA6K.js +37 -0
  231. package/dist/{source-53PY7DXF.js.map → source-5EAGZA6K.js.map} +1 -1
  232. package/dist/{source-manifest-publish-ALRZKEBO.js → source-manifest-publish-57SGT7Q3.js} +24 -23
  233. package/dist/source-manifest-publish-57SGT7Q3.js.map +1 -0
  234. package/dist/tui/index.js +32 -31
  235. package/dist/tui/index.js.map +1 -1
  236. package/dist/types/src/manifests/preset.d.ts +5 -5
  237. package/dist/workspace-plugin/adapters/mcp.js +14 -14
  238. package/dist/workspace-plugin/adapters/omp.js +7 -7
  239. package/dist/workspace-plugin/index.js +3 -3
  240. package/package.json +2 -1
  241. package/dist/chunk-35PMOWAD.js.map +0 -1
  242. package/dist/chunk-6XKQEDF7.js.map +0 -1
  243. package/dist/chunk-AT2TJEWG.js.map +0 -1
  244. package/dist/chunk-ELPR5XBG.js.map +0 -1
  245. package/dist/chunk-GXACG5ZE.js.map +0 -1
  246. package/dist/chunk-IECQMSQ5.js.map +0 -1
  247. package/dist/chunk-ILG4BXYE.js.map +0 -1
  248. package/dist/chunk-O3DHAGBO.js.map +0 -1
  249. package/dist/chunk-OUJVFZWJ.js.map +0 -1
  250. package/dist/chunk-REYJKU7T.js.map +0 -1
  251. package/dist/chunk-S2MT6SDZ.js.map +0 -1
  252. package/dist/chunk-UKJMQZV6.js.map +0 -1
  253. package/dist/chunk-W4IPN3DD.js.map +0 -1
  254. package/dist/flows-H6FL4NZU.js +0 -23
  255. package/dist/library-publish-AAD6GTIF.js.map +0 -1
  256. package/dist/open-library-HDOM4MLS.js +0 -35
  257. package/dist/paths-RL6NZW5X.js +0 -19
  258. package/dist/skills-Y6MU2NRI.js +0 -23
  259. package/dist/source-53PY7DXF.js +0 -36
  260. package/dist/source-manifest-publish-ALRZKEBO.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../core/src/logging/sinks/sqlite-runtime.ts","../core/src/logging/sinks/sqlite-sink.ts","../core/src/logging/config.ts","../core/src/logging/retention.ts","../core/src/logging/sinks/on-log-bridge-sink.ts","../core/src/logging/sinks/ws-log-sink.ts"],"names":["path"],"mappings":";;;;;AAeA,IAAM,WAAA,GAAc,aAAA,CAAc,MAAA,CAAA,IAAA,CAAY,GAAG,CAAA;AAGjD,IAAM,KAAA,GAAQ,OAAQ,UAAA,CAAiC,GAAA,KAAQ,WAAA;AAyC/D,SAAS,cAAc,IAAA,EAAuC;AAC5D,EAAA,OAAO;AAAA,IACL,GAAA,EAAK,CAAC,MAAA,KAAW;AACf,MAAA,MAAM,GAAA,GAAO,WAAW,MAAA,GAAY,IAAA,CAAK,KAAI,GAAI,IAAA,CAAK,IAAI,MAAM,CAAA;AAGhE,MAAA,OAAO,EAAE,OAAA,EAAS,MAAA,CAAO,GAAA,EAAK,OAAA,IAAW,CAAC,CAAA,EAAE;AAAA,IAC9C,CAAA;AAAA,IACA,GAAA,EAAK,CAAC,MAAA,KAAY,MAAA,KAAW,MAAA,GAAY,KAAK,GAAA,EAAI,GAAI,IAAA,CAAK,GAAA,CAAI,MAAM,CAAA;AAAA,IACrE,GAAA,EAAK,CAAC,MAAA,KAAY,MAAA,KAAW,MAAA,GAAY,KAAK,GAAA,EAAI,GAAI,IAAA,CAAK,GAAA,CAAI,MAAM;AAAA,GACvE;AACF;AAEA,SAAS,aAAA,CAAcA,OAAc,IAAA,EAA2C;AAC9E,EAAA,MAAM,EAAE,QAAA,EAAS,GAAI,WAAA,CAAY,YAAY,CAAA;AAQ7C,EAAA,MAAM,EAAA,GAAK,IAAA,CAAK,QAAA,GAAW,IAAI,QA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KAAA,CAAM,OAAO,CAAA,CAAA;AAAA,IACnC;AACA,IAAA,IAAA,CAAK,MAAM,IAAI,CAAA;AAAA,EACjB;AAAA,EAEA,WAAW,OAAA,EAA2B;AACpC,IAAA,KAAA,MAAW,CAAA,IAAK,OAAA,EAAS,IAAA,CAAK,KAAA,CAAM,CAAC,CAAA;AAAA,EACvC;AAAA,EAEA,KAAA,GAAc;AAAA,EAEd;AACF;;;ACfO,IAAM,YAAN,MAAmC;AAAA,EACvB,IAAA;AAAA,EAEjB,YAAY,IAAA,EAAwB;AAClC,IAAA,IAAA,CAAK,OAAO,IAAA,CAAK,IAAA;AAAA,EACnB;AAAA,EAEA,MAAM,KAAA,EAAuB;AAC3B,IAAA,IAAI;AACF,MAAA,IAAA,CAAK,IAAA,CAAK,EAAE,IAAA,EAAM,WAAA,EAAa,OAAO,CAAA;AAAA,IACxC,CAAA,CAAA,MAAQ;AAAA,IAER;AAAA,EACF;AAAA,EAEA,WAAW,OAAA,EAA2B;AACpC,IAAA,KAAA,MAAW,CAAA,IAAK,OAAA,EAAS,IAAA,CAAK,KAAA,CAAM,CAAC,CAAA;AAAA,EACvC;AAAA,EAEA,KAAA,GAAc;AAAA,EAEd;AACF","file":"chunk-3HKYCT2M.js","sourcesContent":["/**\n * Runtime-portable embedded SQLite for the logging sink.\n *\n * The log store needs a synchronous, embedded SQLite driver. Bun ships\n * `bun:sqlite`; Node 22.5+ ships `node:sqlite`. This shim selects the right\n * one at runtime so the CLI and runtime run unmodified under either — no Bun\n * dependency baked into the published build.\n *\n * Both drivers accept `$`-prefixed named-parameter keys directly, so callers\n * use one binding convention. The only API gap is transactions: `bun:sqlite`\n * has `db.transaction()`, `node:sqlite` does not — {@link openSqlite}\n * synthesizes it with manual `BEGIN`/`COMMIT`/`ROLLBACK`.\n */\nimport { createRequire } from \"node:module\";\n\nconst nodeRequire = createRequire(import.meta.url);\n\n/** True when executing under the Bun runtime. */\nconst isBun = typeof (globalThis as { Bun?: unknown }).Bun !== \"undefined\";\n\n/** A prepared statement bound with `$`-prefixed named parameters. */\nexport interface PortableStatement {\n /** Returns the number of rows the statement changed. */\n run(params?: Record<string, unknown>): PortableRunResult;\n all<T = unknown>(params?: Record<string, unknown>): T[];\n get<T = unknown>(params?: Record<string, unknown>): T | undefined;\n}\n\n/** Outcome of {@link PortableStatement.run}, normalised across drivers. */\nexport interface PortableRunResult {\n changes: number;\n}\n\n/** A synchronous embedded SQLite handle, uniform across Bun and Node. */\nexport interface PortableDatabase {\n exec(sql: string): void;\n prepare(sql: string): PortableStatement;\n /** Wrap `fn` so the statements it runs commit as one transaction. */\n transaction<A extends unknown[]>(fn: (...args: A) => void): (...args: A) => void;\n close(): void;\n}\n\nexport interface OpenSqliteOptions {\n /** Open read-only. The database file must already exist. */\n readonly?: boolean;\n}\n\n/** Minimal structural shape shared by `bun:sqlite` and `node:sqlite` handles. */\ninterface RawStatement {\n run(params?: unknown): unknown;\n all(params?: unknown): unknown[];\n get(params?: unknown): unknown;\n}\ninterface RawDatabase {\n exec(sql: string): unknown;\n prepare(sql: string): RawStatement;\n close(): void;\n}\n\nfunction wrapStatement(stmt: RawStatement): PortableStatement {\n return {\n run: (params) => {\n const raw = (params === undefined ? stmt.run() : stmt.run(params)) as\n | { changes?: number | bigint }\n | undefined;\n return { changes: Number(raw?.changes ?? 0) };\n },\n all: (params) => (params === undefined ? stmt.all() : stmt.all(params)) as never,\n get: (params) => (params === undefined ? stmt.get() : stmt.get(params)) as never,\n };\n}\n\nfunction openBunSqlite(path: string, opts: OpenSqliteOptions): PortableDatabase {\n const { Database } = nodeRequire(\"bun:sqlite\") as {\n Database: new (\n p: string,\n o?: { readonly?: boolean },\n ) => RawDatabase & {\n transaction<A extends unknown[]>(fn: (...args: A) => void): (...args: A) => void;\n };\n };\n const db = opts.readonly ? new Database(path, { readonly: true }) : new Database(path);\n return {\n exec: (sql) => {\n db.exec(sql);\n },\n prepare: (sql) => wrapStatement(db.prepare(sql)),\n transaction: (fn) => db.transaction(fn),\n close: () => {\n db.close();\n },\n };\n}\n\nfunction openNodeSqlite(path: string, opts: OpenSqliteOptions): PortableDatabase {\n const { DatabaseSync } = nodeRequire(\"node:sqlite\") as {\n DatabaseSync: new (p: string, o?: { readOnly?: boolean }) => RawDatabase;\n };\n const db = opts.readonly ? new DatabaseSync(path, { readOnly: true }) : new DatabaseSync(path);\n return {\n exec: (sql) => {\n db.exec(sql);\n },\n prepare: (sql) => wrapStatement(db.prepare(sql)),\n transaction:\n (fn) =>\n (...args) => {\n db.exec(\"BEGIN\");\n try {\n fn(...args);\n db.exec(\"COMMIT\");\n } catch (err) {\n db.exec(\"ROLLBACK\");\n throw err;\n }\n },\n close: () => {\n db.close();\n },\n };\n}\n\n/**\n * Open an embedded SQLite database using the runtime's native driver —\n * `bun:sqlite` under Bun, `node:sqlite` under Node 22.5+.\n */\nexport function openSqlite(path: string, opts: OpenSqliteOptions = {}): PortableDatabase {\n return isBun ? openBunSqlite(path, opts) : openNodeSqlite(path, opts);\n}\n","import { chmodSync } from \"node:fs\";\nimport type { LogEntry, LogQuery, LogQueryResult } from \"@skaile/workspaces/types\";\nimport { openSqlite, type PortableDatabase, type PortableStatement } from \"./sqlite-runtime.js\";\nimport type { LogSink } from \"./types.js\";\n\nexport interface SqliteSinkOptions {\n path: string; // ':memory:' or filesystem path\n}\n\nconst SCHEMA = `\nCREATE TABLE IF NOT EXISTS log_entries (\n id TEXT PRIMARY KEY,\n timestamp TEXT NOT NULL,\n session_id TEXT NOT NULL,\n kind TEXT NOT NULL,\n subkind TEXT NOT NULL,\n instance TEXT,\n level TEXT NOT NULL,\n message TEXT NOT NULL,\n data_json TEXT,\n error_json TEXT\n);\nCREATE INDEX IF NOT EXISTS idx_logs_timestamp ON log_entries(timestamp);\nCREATE INDEX IF NOT EXISTS idx_logs_kind_level ON log_entries(kind, level);\nCREATE INDEX IF NOT EXISTS idx_logs_source ON log_entries(kind, subkind, instance);\n`;\n\ninterface LogEntryRow {\n id: string;\n timestamp: string;\n session_id: string;\n kind: string;\n subkind: string;\n instance: string | null;\n level: string;\n message: string;\n data_json: string | null;\n error_json: string | null;\n}\n\nexport class SqliteSink implements LogSink {\n private db: PortableDatabase;\n private insertStmt: PortableStatement;\n private insertMany: (entries: LogEntry[]) => void;\n private closed = false;\n\n constructor(opts: SqliteSinkOptions) {\n this.db = openSqlite(opts.path);\n if (opts.path !== \":memory:\") {\n this.db.exec(\"PRAGMA journal_mode = WAL\");\n }\n this.db.exec(SCHEMA);\n if (opts.path !== \":memory:\") {\n // Group-writable so a co-grouped host process can open read-write for retention.\n makeGroupWritable(opts.path);\n }\n this.insertStmt = this.db.prepare(\n `INSERT INTO log_entries (id, timestamp, session_id, kind, subkind, instance, level, message, data_json, error_json)\n VALUES ($id, $timestamp, $session_id, $kind, $subkind, $instance, $level, $message, $data_json, $error_json)`,\n );\n this.insertMany = this.db.transaction((entries: LogEntry[]) => {\n for (const e of entries) this.insertStmt.run(this.toRow(e));\n });\n }\n\n write(entry: LogEntry): void {\n if (this.closed) return;\n this.insertStmt.run(this.toRow(entry));\n }\n\n writeBatch(entries: LogEntry[]): void {\n if (this.closed || entries.length === 0) return;\n this.insertMany(entries);\n }\n\n close(): void {\n if (this.closed) return;\n this.closed = true;\n this.db.close();\n }\n\n query(q: LogQuery): LogQueryResult {\n if (this.closed) return { entries: [] };\n const where: string[] = [\"session_id = $sessionId\"];\n const params: Record<string, unknown> = { $sessionId: q.sessionId };\n\n if (q.source?.kind) {\n where.push(\"kind = $kind\");\n params.$kind = q.source.kind;\n }\n if (q.source?.subkind) {\n where.push(\"subkind = $subkind\");\n params.$subkind = q.source.subkind;\n }\n if (q.source?.instance) {\n where.push(\"instance = $instance\");\n params.$instance = q.source.instance;\n }\n if (q.levels && q.levels.length > 0) {\n const placeholders = q.levels.map((_, i) => `$level${i}`).join(\", \");\n where.push(`level IN (${placeholders})`);\n q.levels.forEach((lvl, i) => {\n params[`$level${i}`] = lvl;\n });\n }\n if (q.since) {\n where.push(\"timestamp >= $since\");\n params.$since = q.since;\n }\n if (q.until) {\n where.push(\"timestamp < $until\");\n params.$until = q.until;\n }\n if (q.search) {\n // Escape SQL LIKE wildcards so a search for \"100%\" matches the literal string,\n // not \"100<anything>\". \\\\ is also escaped because it's the escape character itself.\n const escaped = q.search.replace(/[\\\\%_]/g, \"\\\\$&\");\n where.push(\"message LIKE $search ESCAPE '\\\\'\");\n params.$search = `%${escaped}%`;\n }\n if (q.cursor) {\n where.push(\"id < $cursor\");\n params.$cursor = q.cursor;\n }\n\n const limit = Math.min(q.limit ?? 500, 5000);\n params.$limit = limit + 1;\n\n const sql = `SELECT id, timestamp, session_id, kind, subkind, instance, level, message, data_json, error_json\n FROM log_entries\n WHERE ${where.join(\" AND \")}\n ORDER BY id DESC\n LIMIT $limit`;\n\n const rows = this.db.prepare(sql).all<LogEntryRow>(params);\n\n const hasMore = rows.length > limit;\n const sliced = hasMore ? rows.slice(0, limit) : rows;\n const entries: LogEntry[] = sliced.map((r) => ({\n id: r.id,\n timestamp: r.timestamp,\n sessionId: r.session_id,\n source: {\n kind: r.kind as LogEntry[\"source\"][\"kind\"],\n subkind: r.subkind,\n instance: r.instance ?? undefined,\n },\n level: r.level as LogEntry[\"level\"],\n message: r.message,\n data: r.data_json ? JSON.parse(r.data_json) : undefined,\n error: r.error_json ? JSON.parse(r.error_json) : undefined,\n }));\n\n return {\n entries,\n nextCursor: hasMore ? entries[entries.length - 1].id : undefined,\n };\n }\n\n // Both bun:sqlite and node:sqlite bind `$name` SQL placeholders from\n // matching `$`-prefixed object keys.\n private toRow(e: LogEntry): Record<string, unknown> {\n return {\n $id: e.id,\n $timestamp: e.timestamp,\n $session_id: e.sessionId,\n $kind: e.source.kind,\n $subkind: e.source.subkind,\n $instance: e.source.instance ?? null,\n $level: e.level,\n $message: e.message,\n $data_json: e.data ? JSON.stringify(e.data) : null,\n $error_json: e.error ? JSON.stringify(e.error) : null,\n };\n }\n}\n\n/**\n * Best-effort `chmod 0664` on the db file and its WAL/SHM siblings. Swallows all\n * errors (missing sibling, EPERM when not the owner) so logging never throws.\n */\nfunction makeGroupWritable(dbPath: string): void {\n for (const p of [dbPath, `${dbPath}-wal`, `${dbPath}-shm`]) {\n try {\n chmodSync(p, 0o664);\n } catch {\n // Sibling may not exist yet, or this process may not own the file.\n // Either way, retention degrades cleanly — never break logging.\n }\n }\n}\n","import { mkdirSync } from \"node:fs\";\nimport path from \"node:path\";\nimport type { LogLevel, LogStoreConfig, LogStoreMode } from \"@skaile/workspaces/types\";\nimport { LogStore } from \"./log-store.js\";\nimport { NoOpSink } from \"./sinks/no-op-sink.js\";\nimport { SqliteSink } from \"./sinks/sqlite-sink.js\";\nimport { StdoutSink } from \"./sinks/stdout-sink.js\";\n\nconst VALID_MODES: LogStoreMode[] = [\"persistent\", \"ephemeral\", \"off\"];\nconst VALID_LEVELS: LogLevel[] = [\"debug\", \"info\", \"warn\", \"error\"];\n\nexport interface ResolveLogStoreConfigInput {\n sessionId: string;\n workspacePath?: string;\n yamlBlock?: Partial<{\n mode: LogStoreMode;\n level: LogLevel;\n retention: { maxEntries?: number; maxAgeDays?: number };\n }>;\n}\n\nexport function resolveLogStoreConfig(input: ResolveLogStoreConfigInput): LogStoreConfig {\n const yaml = input.yamlBlock ?? {};\n const envMode = process.env.SKAILE_LOG_MODE as LogStoreMode | undefined;\n const envLevel = process.env.SKAILE_LOG_LEVEL as LogLevel | undefined;\n\n const mode = envMode ?? yaml.mode ?? \"persistent\";\n if (!VALID_MODES.includes(mode)) {\n throw new Error(`Invalid logging.mode: ${mode}`);\n }\n const level = envLevel ?? yaml.level ?? \"info\";\n if (!VALID_LEVELS.includes(level)) {\n throw new Error(`Invalid logging.level: ${level}`);\n }\n\n return {\n sessionId: input.sessionId,\n workspacePath: input.workspacePath,\n mode,\n level,\n retention: yaml.retention,\n };\n}\n\nexport function createLogStoreFromConfig(cfg: LogStoreConfig): LogStore {\n const sinks = [];\n if (cfg.mode === \"off\") {\n sinks.push(new NoOpSink());\n } else if (cfg.mode === \"ephemeral\") {\n sinks.push(new SqliteSink({ path: \":memory:\" }));\n } else {\n if (!cfg.workspacePath) {\n throw new Error(\"logging.mode=persistent requires workspacePath\");\n }\n const dir = path.join(cfg.workspacePath, \".skaile\");\n mkdirSync(dir, { recursive: true });\n const dbPath = path.join(dir, \"logs.db\");\n sinks.push(new SqliteSink({ path: dbPath }));\n }\n // Always include stdout for live container logs (dev-friendly).\n sinks.push(new StdoutSink());\n return new LogStore({\n sessionId: cfg.sessionId,\n level: cfg.level,\n sinks,\n });\n}\n","/**\n * Retention for the per-session structured-log SQLite store (`logs.db`).\n *\n * Mirrors the platform's `enforceLogsRetention`\n * (`platform/backend/libs/session/src/logs-retention.utils.ts`): the same\n * age-then-count semantics, batch size, pass ceiling and busy timeout. The\n * platform trims the host copy of the file once per wake; in broker mode that\n * copy is not the file the runner writes, so the runner trims its own file at\n * boot. In docker mode both trim the same file with the same rules, which is\n * harmless: a second pass finds nothing left to delete.\n */\nimport { existsSync } from \"node:fs\";\nimport type { LogStoreRetention } from \"@skaile/workspaces/types\";\nimport { openSqlite, type PortableStatement } from \"./sinks/sqlite-runtime.js\";\n\n/** Rows removed by one {@link enforceLogsRetention} run. */\nexport interface EnforceLogsRetentionResult {\n deletedByAge: number;\n deletedByCount: number;\n}\n\n/**\n * The platform's cloud-mode retention defaults (docker and broker). Used when\n * `skaile.yaml` has no `logging.retention` value for a field.\n */\nexport const DEFAULT_LOGS_RETENTION: Readonly<Required<LogStoreRetention>> = Object.freeze({\n maxEntries: 100_000,\n maxAgeDays: 7,\n});\n\nconst DAY_MS = 86_400_000;\n\n/** Rows deleted per statement. Caps both the write lock and the loop stall. */\nconst BATCH_SIZE = 500;\n\n/**\n * Pass ceiling per statement. Concurrent inserts keep refilling the count-trim\n * delete-set, so \"loop until a short batch\" is not a guaranteed bound;\n * leftovers are trimmed on the next boot.\n */\nconst MAX_TRIM_PASSES = 200;\n\n/** Wait on a lock held by another connection instead of failing with SQLITE_BUSY. */\nconst BUSY_TIMEOUT_MS = 2_000;\n\n// `LIMIT` directly on `DELETE` needs SQLITE_ENABLE_UPDATE_DELETE_LIMIT; the\n// `id IN (SELECT ... LIMIT)` form works under both bun:sqlite and node:sqlite.\nconst AGE_TRIM_SQL = `DELETE FROM log_entries WHERE id IN (\n SELECT id FROM log_entries WHERE timestamp < $cutoff ORDER BY id LIMIT $batch\n)`;\n\nconst COUNT_TRIM_SQL = `DELETE FROM log_entries WHERE id IN (\n SELECT id FROM log_entries\n WHERE id NOT IN (SELECT id FROM log_entries ORDER BY id DESC LIMIT $keep)\n ORDER BY id LIMIT $batch\n)`;\n\nfunction isRetentionValue(v: unknown): v is number {\n return typeof v === \"number\" && Number.isFinite(v) && v >= 0;\n}\n\n/**\n * Overlay the configured retention on {@link DEFAULT_LOGS_RETENTION}, field by\n * field. A value that is not a non-negative finite number counts as unset.\n * `0` is a valid value: `maxEntries: 0` or `maxAgeDays: 0` deletes every row,\n * as it does on the platform.\n */\nexport function resolveLogsRetention(\n configured: LogStoreRetention | undefined,\n): Required<LogStoreRetention> {\n return {\n maxEntries: isRetentionValue(configured?.maxEntries)\n ? configured.maxEntries\n : DEFAULT_LOGS_RETENTION.maxEntries,\n maxAgeDays: isRetentionValue(configured?.maxAgeDays)\n ? configured.maxAgeDays\n : DEFAULT_LOGS_RETENTION.maxAgeDays,\n };\n}\n\nfunction yieldToEventLoop(): Promise<void> {\n return new Promise<void>((resolve) => setImmediate(resolve));\n}\n\n/**\n * Run one bounded delete until it stops filling a batch. Each statement is its\n * own implicit transaction, so no lock is held across the yield and the\n * in-process sink can write between batches.\n */\nasync function runBoundedTrim(\n stmt: PortableStatement,\n params: Record<string, unknown>,\n): Promise<number> {\n let deleted = 0;\n for (let pass = 0; pass < MAX_TRIM_PASSES; pass++) {\n const { changes } = stmt.run(params);\n deleted += changes;\n if (changes < BATCH_SIZE) break;\n await yieldToEventLoop();\n }\n return deleted;\n}\n\n/**\n * Delete rows older than `maxAgeDays`, then keep at most the `maxEntries`\n * newest rows (by ULID id). Uses its own connection with a busy timeout, in\n * bounded batches that yield to the event loop between passes.\n *\n * Returns zero counts when the file does not exist or the policy is empty.\n * Other failures (lock timeout, not a log store) reject; the caller decides\n * how loud to be.\n */\nexport async function enforceLogsRetention(\n dbPath: string,\n retention: LogStoreRetention,\n): Promise<EnforceLogsRetentionResult> {\n const result: EnforceLogsRetentionResult = { deletedByAge: 0, deletedByCount: 0 };\n if (!existsSync(dbPath)) return result;\n if (retention.maxAgeDays == null && retention.maxEntries == null) return result;\n\n const db = openSqlite(dbPath);\n try {\n db.exec(`PRAGMA busy_timeout = ${BUSY_TIMEOUT_MS}`);\n if (retention.maxAgeDays != null) {\n const cutoff = new Date(Date.now() - retention.maxAgeDays * DAY_MS).toISOString();\n result.deletedByAge = await runBoundedTrim(db.prepare(AGE_TRIM_SQL), {\n $cutoff: cutoff,\n $batch: BATCH_SIZE,\n });\n }\n if (retention.maxEntries != null) {\n result.deletedByCount = await runBoundedTrim(db.prepare(COUNT_TRIM_SQL), {\n $keep: retention.maxEntries,\n $batch: BATCH_SIZE,\n });\n }\n return result;\n } finally {\n db.close();\n }\n}\n","import type { LogEntry, LogSink } from \"@skaile/workspaces/types\";\n\n/**\n * OnLogBridgeSink — forwards every entry as a single formatted text line to\n * a legacy `onLog(line)` callback. Used as a back-compat bridge for callers\n * that historically received plain text lines from the runner.\n *\n * Format: `[level] [kind:subkind[:instance]] message [data-json] [— error.message]`\n */\nexport class OnLogBridgeSink implements LogSink {\n constructor(private readonly onLog: (line: string) => void) {}\n\n write(entry: LogEntry): void {\n const tag = entry.source.instance\n ? `${entry.source.kind}:${entry.source.subkind}:${entry.source.instance}`\n : `${entry.source.kind}:${entry.source.subkind}`;\n let line = `[${entry.level}] [${tag}] ${entry.message}`;\n if (entry.data && Object.keys(entry.data).length > 0) {\n line += ` ${JSON.stringify(entry.data)}`;\n }\n if (entry.error?.message) {\n line += ` — ${entry.error.message}`;\n }\n this.onLog(line);\n }\n\n writeBatch(entries: LogEntry[]): void {\n for (const e of entries) this.write(e);\n }\n\n close(): void {\n /* no-op */\n }\n}\n","import type { LogEntry, LogEntryEvent } from \"@skaile/workspaces/types\";\nimport type { LogSink } from \"./types.js\";\n\nexport interface WsLogSinkOptions {\n /**\n * Transport send callback. Typically wired to `transport.send` on the\n * runner's `WebSocketServerTransport`. The transport already drops sends\n * when no client is connected — this sink does not buffer.\n */\n send: (event: LogEntryEvent) => void;\n}\n\n/**\n * Forwards every LogEntry recorded by LogStore as a `log_entry` AgentEvent\n * over the configured transport. Used by the runner to make container-side\n * structured logs visible to the platform gateway in real time. Historical\n * reads still go through SQLite — this sink is for live tail only.\n */\nexport class WsLogSink implements LogSink {\n private readonly send: (event: LogEntryEvent) => void;\n\n constructor(opts: WsLogSinkOptions) {\n this.send = opts.send;\n }\n\n write(entry: LogEntry): void {\n try {\n this.send({ type: \"log_entry\", entry });\n } catch {\n // Logging must never break the agent — drop on transport failure.\n }\n }\n\n writeBatch(entries: LogEntry[]): void {\n for (const e of entries) this.write(e);\n }\n\n close(): void {\n /* nothing to release — transport lifecycle is owned by the caller */\n }\n}\n"]}
1
+ {"version":3,"sources":["../core/src/logging/sinks/sqlite-runtime.ts","../core/src/logging/sinks/sqlite-sink.ts","../core/src/logging/config.ts","../core/src/logging/retention.ts","../core/src/logging/sinks/on-log-bridge-sink.ts","../core/src/logging/sinks/ws-log-sink.ts"],"names":["path"],"mappings":";;;;;AAeA,IAAM,WAAA,GAAc,aAAA,CAAc,MAAA,CAAA,IAAA,CAAY,GAAG,CAAA;AAGjD,IAAM,KAAA,GAAQ,OAAQ,UAAA,CAAiC,GAAA,KAAQ,WAAA;AAyC/D,SAAS,cAAc,IAAA,EAAuC;AAC5D,EAAA,OAAO;AAAA,IACL,GAAA,EAAK,CAAC,MAAA,KAAW;AACf,MAAA,MAAM,GAAA,GAAO,WAAW,MAAA,GAAY,IAAA,CAAK,KAAI,GAAI,IAAA,CAAK,IAAI,MAAM,CAAA;AAGhE,MAAA,O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;AAAA,EACvC;AAAA,EAEA,KAAA,GAAc;AAAA,EAEd;AACF","file":"chunk-RUBPZLMO.js","sourcesContent":["/**\n * Runtime-portable embedded SQLite for the logging sink.\n *\n * The log store needs a synchronous, embedded SQLite driver. Bun ships\n * `bun:sqlite`; Node 22.5+ ships `node:sqlite`. This shim selects the right\n * one at runtime so the CLI and runtime run unmodified under either — no Bun\n * dependency baked into the published build.\n *\n * Both drivers accept `$`-prefixed named-parameter keys directly, so callers\n * use one binding convention. The only API gap is transactions: `bun:sqlite`\n * has `db.transaction()`, `node:sqlite` does not — {@link openSqlite}\n * synthesizes it with manual `BEGIN`/`COMMIT`/`ROLLBACK`.\n */\nimport { createRequire } from \"node:module\";\n\nconst nodeRequire = createRequire(import.meta.url);\n\n/** True when executing under the Bun runtime. */\nconst isBun = typeof (globalThis as { Bun?: unknown }).Bun !== \"undefined\";\n\n/** A prepared statement bound with `$`-prefixed named parameters. */\nexport interface PortableStatement {\n /** Returns the number of rows the statement changed. */\n run(params?: Record<string, unknown>): PortableRunResult;\n all<T = unknown>(params?: Record<string, unknown>): T[];\n get<T = unknown>(params?: Record<string, unknown>): T | undefined;\n}\n\n/** Outcome of {@link PortableStatement.run}, normalised across drivers. */\nexport interface PortableRunResult {\n changes: number;\n}\n\n/** A synchronous embedded SQLite handle, uniform across Bun and Node. */\nexport interface PortableDatabase {\n exec(sql: string): void;\n prepare(sql: string): PortableStatement;\n /** Wrap `fn` so the statements it runs commit as one transaction. */\n transaction<A extends unknown[]>(fn: (...args: A) => void): (...args: A) => void;\n close(): void;\n}\n\nexport interface OpenSqliteOptions {\n /** Open read-only. The database file must already exist. */\n readonly?: boolean;\n}\n\n/** Minimal structural shape shared by `bun:sqlite` and `node:sqlite` handles. */\ninterface RawStatement {\n run(params?: unknown): unknown;\n all(params?: unknown): unknown[];\n get(params?: unknown): unknown;\n}\ninterface RawDatabase {\n exec(sql: string): unknown;\n prepare(sql: string): RawStatement;\n close(): void;\n}\n\nfunction wrapStatement(stmt: RawStatement): PortableStatement {\n return {\n run: (params) => {\n const raw = (params === undefined ? stmt.run() : stmt.run(params)) as\n | { changes?: number | bigint }\n | undefined;\n return { changes: Number(raw?.changes ?? 0) };\n },\n all: (params) => (params === undefined ? stmt.all() : stmt.all(params)) as never,\n get: (params) => (params === undefined ? stmt.get() : stmt.get(params)) as never,\n };\n}\n\nfunction openBunSqlite(path: string, opts: OpenSqliteOptions): PortableDatabase {\n const { Database } = nodeRequire(\"bun:sqlite\") as {\n Database: new (\n p: string,\n o?: { readonly?: boolean },\n ) => RawDatabase & {\n transaction<A extends unknown[]>(fn: (...args: A) => void): (...args: A) => void;\n };\n };\n const db = opts.readonly ? new Database(path, { readonly: true }) : new Database(path);\n return {\n exec: (sql) => {\n db.exec(sql);\n },\n prepare: (sql) => wrapStatement(db.prepare(sql)),\n transaction: (fn) => db.transaction(fn),\n close: () => {\n db.close();\n },\n };\n}\n\nfunction openNodeSqlite(path: string, opts: OpenSqliteOptions): PortableDatabase {\n const { DatabaseSync } = nodeRequire(\"node:sqlite\") as {\n DatabaseSync: new (p: string, o?: { readOnly?: boolean }) => RawDatabase;\n };\n const db = opts.readonly ? new DatabaseSync(path, { readOnly: true }) : new DatabaseSync(path);\n return {\n exec: (sql) => {\n db.exec(sql);\n },\n prepare: (sql) => wrapStatement(db.prepare(sql)),\n transaction:\n (fn) =>\n (...args) => {\n db.exec(\"BEGIN\");\n try {\n fn(...args);\n db.exec(\"COMMIT\");\n } catch (err) {\n db.exec(\"ROLLBACK\");\n throw err;\n }\n },\n close: () => {\n db.close();\n },\n };\n}\n\n/**\n * Open an embedded SQLite database using the runtime's native driver —\n * `bun:sqlite` under Bun, `node:sqlite` under Node 22.5+.\n */\nexport function openSqlite(path: string, opts: OpenSqliteOptions = {}): PortableDatabase {\n return isBun ? openBunSqlite(path, opts) : openNodeSqlite(path, opts);\n}\n","import { chmodSync } from \"node:fs\";\nimport type { LogEntry, LogQuery, LogQueryResult } from \"@skaile/workspaces/types\";\nimport { openSqlite, type PortableDatabase, type PortableStatement } from \"./sqlite-runtime.js\";\nimport type { LogSink } from \"./types.js\";\n\nexport interface SqliteSinkOptions {\n path: string; // ':memory:' or filesystem path\n}\n\nconst SCHEMA = `\nCREATE TABLE IF NOT EXISTS log_entries (\n id TEXT PRIMARY KEY,\n timestamp TEXT NOT NULL,\n session_id TEXT NOT NULL,\n kind TEXT NOT NULL,\n subkind TEXT NOT NULL,\n instance TEXT,\n level TEXT NOT NULL,\n message TEXT NOT NULL,\n data_json TEXT,\n error_json TEXT\n);\nCREATE INDEX IF NOT EXISTS idx_logs_timestamp ON log_entries(timestamp);\nCREATE INDEX IF NOT EXISTS idx_logs_kind_level ON log_entries(kind, level);\nCREATE INDEX IF NOT EXISTS idx_logs_source ON log_entries(kind, subkind, instance);\n`;\n\ninterface LogEntryRow {\n id: string;\n timestamp: string;\n session_id: string;\n kind: string;\n subkind: string;\n instance: string | null;\n level: string;\n message: string;\n data_json: string | null;\n error_json: string | null;\n}\n\nexport class SqliteSink implements LogSink {\n private db: PortableDatabase;\n private insertStmt: PortableStatement;\n private insertMany: (entries: LogEntry[]) => void;\n private closed = false;\n\n constructor(opts: SqliteSinkOptions) {\n this.db = openSqlite(opts.path);\n if (opts.path !== \":memory:\") {\n this.db.exec(\"PRAGMA journal_mode = WAL\");\n }\n this.db.exec(SCHEMA);\n if (opts.path !== \":memory:\") {\n // Group-writable so a co-grouped host process can open read-write for retention.\n makeGroupWritable(opts.path);\n }\n this.insertStmt = this.db.prepare(\n `INSERT INTO log_entries (id, timestamp, session_id, kind, subkind, instance, level, message, data_json, error_json)\n VALUES ($id, $timestamp, $session_id, $kind, $subkind, $instance, $level, $message, $data_json, $error_json)`,\n );\n this.insertMany = this.db.transaction((entries: LogEntry[]) => {\n for (const e of entries) this.insertStmt.run(this.toRow(e));\n });\n }\n\n write(entry: LogEntry): void {\n if (this.closed) return;\n this.insertStmt.run(this.toRow(entry));\n }\n\n writeBatch(entries: LogEntry[]): void {\n if (this.closed || entries.length === 0) return;\n this.insertMany(entries);\n }\n\n close(): void {\n if (this.closed) return;\n this.closed = true;\n this.db.close();\n }\n\n query(q: LogQuery): LogQueryResult {\n if (this.closed) return { entries: [] };\n const where: string[] = [\"session_id = $sessionId\"];\n const params: Record<string, unknown> = { $sessionId: q.sessionId };\n\n if (q.source?.kind) {\n where.push(\"kind = $kind\");\n params.$kind = q.source.kind;\n }\n if (q.source?.subkind) {\n where.push(\"subkind = $subkind\");\n params.$subkind = q.source.subkind;\n }\n if (q.source?.instance) {\n where.push(\"instance = $instance\");\n params.$instance = q.source.instance;\n }\n if (q.levels && q.levels.length > 0) {\n const placeholders = q.levels.map((_, i) => `$level${i}`).join(\", \");\n where.push(`level IN (${placeholders})`);\n q.levels.forEach((lvl, i) => {\n params[`$level${i}`] = lvl;\n });\n }\n if (q.since) {\n where.push(\"timestamp >= $since\");\n params.$since = q.since;\n }\n if (q.until) {\n where.push(\"timestamp < $until\");\n params.$until = q.until;\n }\n if (q.search) {\n // Escape SQL LIKE wildcards so a search for \"100%\" matches the literal string,\n // not \"100<anything>\". \\\\ is also escaped because it's the escape character itself.\n const escaped = q.search.replace(/[\\\\%_]/g, \"\\\\$&\");\n where.push(\"message LIKE $search ESCAPE '\\\\'\");\n params.$search = `%${escaped}%`;\n }\n if (q.cursor) {\n where.push(\"id < $cursor\");\n params.$cursor = q.cursor;\n }\n\n const limit = Math.min(q.limit ?? 500, 5000);\n params.$limit = limit + 1;\n\n const sql = `SELECT id, timestamp, session_id, kind, subkind, instance, level, message, data_json, error_json\n FROM log_entries\n WHERE ${where.join(\" AND \")}\n ORDER BY id DESC\n LIMIT $limit`;\n\n const rows = this.db.prepare(sql).all<LogEntryRow>(params);\n\n const hasMore = rows.length > limit;\n const sliced = hasMore ? rows.slice(0, limit) : rows;\n const entries: LogEntry[] = sliced.map((r) => ({\n id: r.id,\n timestamp: r.timestamp,\n sessionId: r.session_id,\n source: {\n kind: r.kind as LogEntry[\"source\"][\"kind\"],\n subkind: r.subkind,\n instance: r.instance ?? undefined,\n },\n level: r.level as LogEntry[\"level\"],\n message: r.message,\n data: r.data_json ? JSON.parse(r.data_json) : undefined,\n error: r.error_json ? JSON.parse(r.error_json) : undefined,\n }));\n\n return {\n entries,\n nextCursor: hasMore ? entries[entries.length - 1].id : undefined,\n };\n }\n\n // Both bun:sqlite and node:sqlite bind `$name` SQL placeholders from\n // matching `$`-prefixed object keys.\n private toRow(e: LogEntry): Record<string, unknown> {\n return {\n $id: e.id,\n $timestamp: e.timestamp,\n $session_id: e.sessionId,\n $kind: e.source.kind,\n $subkind: e.source.subkind,\n $instance: e.source.instance ?? null,\n $level: e.level,\n $message: e.message,\n $data_json: e.data ? JSON.stringify(e.data) : null,\n $error_json: e.error ? JSON.stringify(e.error) : null,\n };\n }\n}\n\n/**\n * Best-effort `chmod 0664` on the db file and its WAL/SHM siblings. Swallows all\n * errors (missing sibling, EPERM when not the owner) so logging never throws.\n */\nfunction makeGroupWritable(dbPath: string): void {\n for (const p of [dbPath, `${dbPath}-wal`, `${dbPath}-shm`]) {\n try {\n chmodSync(p, 0o664);\n } catch {\n // Sibling may not exist yet, or this process may not own the file.\n // Either way, retention degrades cleanly — never break logging.\n }\n }\n}\n","import { mkdirSync } from \"node:fs\";\nimport path from \"node:path\";\nimport type { LogLevel, LogStoreConfig, LogStoreMode } from \"@skaile/workspaces/types\";\nimport { LogStore } from \"./log-store.js\";\nimport { NoOpSink } from \"./sinks/no-op-sink.js\";\nimport { SqliteSink } from \"./sinks/sqlite-sink.js\";\nimport { StdoutSink } from \"./sinks/stdout-sink.js\";\n\nconst VALID_MODES: LogStoreMode[] = [\"persistent\", \"ephemeral\", \"off\"];\nconst VALID_LEVELS: LogLevel[] = [\"debug\", \"info\", \"warn\", \"error\"];\n\nexport interface ResolveLogStoreConfigInput {\n sessionId: string;\n workspacePath?: string;\n yamlBlock?: Partial<{\n mode: LogStoreMode;\n level: LogLevel;\n retention: { maxEntries?: number; maxAgeDays?: number };\n }>;\n}\n\nexport function resolveLogStoreConfig(input: ResolveLogStoreConfigInput): LogStoreConfig {\n const yaml = input.yamlBlock ?? {};\n const envMode = process.env.SKAILE_LOG_MODE as LogStoreMode | undefined;\n const envLevel = process.env.SKAILE_LOG_LEVEL as LogLevel | undefined;\n\n const mode = envMode ?? yaml.mode ?? \"persistent\";\n if (!VALID_MODES.includes(mode)) {\n throw new Error(`Invalid logging.mode: ${mode}`);\n }\n const level = envLevel ?? yaml.level ?? \"info\";\n if (!VALID_LEVELS.includes(level)) {\n throw new Error(`Invalid logging.level: ${level}`);\n }\n\n return {\n sessionId: input.sessionId,\n workspacePath: input.workspacePath,\n mode,\n level,\n retention: yaml.retention,\n };\n}\n\nexport function createLogStoreFromConfig(cfg: LogStoreConfig): LogStore {\n const sinks = [];\n if (cfg.mode === \"off\") {\n sinks.push(new NoOpSink());\n } else if (cfg.mode === \"ephemeral\") {\n sinks.push(new SqliteSink({ path: \":memory:\" }));\n } else {\n if (!cfg.workspacePath) {\n throw new Error(\"logging.mode=persistent requires workspacePath\");\n }\n const dir = path.join(cfg.workspacePath, \".skaile\");\n mkdirSync(dir, { recursive: true });\n const dbPath = path.join(dir, \"logs.db\");\n sinks.push(new SqliteSink({ path: dbPath }));\n }\n // Always include stdout for live container logs (dev-friendly).\n sinks.push(new StdoutSink());\n return new LogStore({\n sessionId: cfg.sessionId,\n level: cfg.level,\n sinks,\n });\n}\n","/**\n * Retention for the per-session structured-log SQLite store (`logs.db`).\n *\n * Mirrors the platform's `enforceLogsRetention`\n * (`platform/backend/libs/session/src/logs-retention.utils.ts`): the same\n * age-then-count semantics, batch size, pass ceiling and busy timeout. The\n * platform trims the host copy of the file once per wake; in broker mode that\n * copy is not the file the runner writes, so the runner trims its own file at\n * boot. In docker mode both trim the same file with the same rules, which is\n * harmless: a second pass finds nothing left to delete.\n */\nimport { existsSync } from \"node:fs\";\nimport type { LogStoreRetention } from \"@skaile/workspaces/types\";\nimport { openSqlite, type PortableStatement } from \"./sinks/sqlite-runtime.js\";\n\n/** Rows removed by one {@link enforceLogsRetention} run. */\nexport interface EnforceLogsRetentionResult {\n deletedByAge: number;\n deletedByCount: number;\n}\n\n/**\n * The platform's cloud-mode retention defaults (docker and broker). Used when\n * `skaile.yaml` has no `logging.retention` value for a field.\n */\nexport const DEFAULT_LOGS_RETENTION: Readonly<Required<LogStoreRetention>> = Object.freeze({\n maxEntries: 100_000,\n maxAgeDays: 7,\n});\n\nconst DAY_MS = 86_400_000;\n\n/** Rows deleted per statement. Caps both the write lock and the loop stall. */\nconst BATCH_SIZE = 500;\n\n/**\n * Pass ceiling per statement. Concurrent inserts keep refilling the count-trim\n * delete-set, so \"loop until a short batch\" is not a guaranteed bound;\n * leftovers are trimmed on the next boot.\n */\nconst MAX_TRIM_PASSES = 200;\n\n/** Wait on a lock held by another connection instead of failing with SQLITE_BUSY. */\nconst BUSY_TIMEOUT_MS = 2_000;\n\n// `LIMIT` directly on `DELETE` needs SQLITE_ENABLE_UPDATE_DELETE_LIMIT; the\n// `id IN (SELECT ... LIMIT)` form works under both bun:sqlite and node:sqlite.\nconst AGE_TRIM_SQL = `DELETE FROM log_entries WHERE id IN (\n SELECT id FROM log_entries WHERE timestamp < $cutoff ORDER BY id LIMIT $batch\n)`;\n\nconst COUNT_TRIM_SQL = `DELETE FROM log_entries WHERE id IN (\n SELECT id FROM log_entries\n WHERE id NOT IN (SELECT id FROM log_entries ORDER BY id DESC LIMIT $keep)\n ORDER BY id LIMIT $batch\n)`;\n\nfunction isRetentionValue(v: unknown): v is number {\n return typeof v === \"number\" && Number.isFinite(v) && v >= 0;\n}\n\n/**\n * Overlay the configured retention on {@link DEFAULT_LOGS_RETENTION}, field by\n * field. A value that is not a non-negative finite number counts as unset.\n * `0` is a valid value: `maxEntries: 0` or `maxAgeDays: 0` deletes every row,\n * as it does on the platform.\n */\nexport function resolveLogsRetention(\n configured: LogStoreRetention | undefined,\n): Required<LogStoreRetention> {\n return {\n maxEntries: isRetentionValue(configured?.maxEntries)\n ? configured.maxEntries\n : DEFAULT_LOGS_RETENTION.maxEntries,\n maxAgeDays: isRetentionValue(configured?.maxAgeDays)\n ? configured.maxAgeDays\n : DEFAULT_LOGS_RETENTION.maxAgeDays,\n };\n}\n\nfunction yieldToEventLoop(): Promise<void> {\n return new Promise<void>((resolve) => setImmediate(resolve));\n}\n\n/**\n * Run one bounded delete until it stops filling a batch. Each statement is its\n * own implicit transaction, so no lock is held across the yield and the\n * in-process sink can write between batches.\n */\nasync function runBoundedTrim(\n stmt: PortableStatement,\n params: Record<string, unknown>,\n): Promise<number> {\n let deleted = 0;\n for (let pass = 0; pass < MAX_TRIM_PASSES; pass++) {\n const { changes } = stmt.run(params);\n deleted += changes;\n if (changes < BATCH_SIZE) break;\n await yieldToEventLoop();\n }\n return deleted;\n}\n\n/**\n * Delete rows older than `maxAgeDays`, then keep at most the `maxEntries`\n * newest rows (by ULID id). Uses its own connection with a busy timeout, in\n * bounded batches that yield to the event loop between passes.\n *\n * Returns zero counts when the file does not exist or the policy is empty.\n * Other failures (lock timeout, not a log store) reject; the caller decides\n * how loud to be.\n */\nexport async function enforceLogsRetention(\n dbPath: string,\n retention: LogStoreRetention,\n): Promise<EnforceLogsRetentionResult> {\n const result: EnforceLogsRetentionResult = { deletedByAge: 0, deletedByCount: 0 };\n if (!existsSync(dbPath)) return result;\n if (retention.maxAgeDays == null && retention.maxEntries == null) return result;\n\n const db = openSqlite(dbPath);\n try {\n db.exec(`PRAGMA busy_timeout = ${BUSY_TIMEOUT_MS}`);\n if (retention.maxAgeDays != null) {\n const cutoff = new Date(Date.now() - retention.maxAgeDays * DAY_MS).toISOString();\n result.deletedByAge = await runBoundedTrim(db.prepare(AGE_TRIM_SQL), {\n $cutoff: cutoff,\n $batch: BATCH_SIZE,\n });\n }\n if (retention.maxEntries != null) {\n result.deletedByCount = await runBoundedTrim(db.prepare(COUNT_TRIM_SQL), {\n $keep: retention.maxEntries,\n $batch: BATCH_SIZE,\n });\n }\n return result;\n } finally {\n db.close();\n }\n}\n","import type { LogEntry, LogSink } from \"@skaile/workspaces/types\";\n\n/**\n * OnLogBridgeSink — forwards every entry as a single formatted text line to\n * a legacy `onLog(line)` callback. Used as a back-compat bridge for callers\n * that historically received plain text lines from the runner.\n *\n * Format: `[level] [kind:subkind[:instance]] message [data-json] [— error.message]`\n */\nexport class OnLogBridgeSink implements LogSink {\n constructor(private readonly onLog: (line: string) => void) {}\n\n write(entry: LogEntry): void {\n const tag = entry.source.instance\n ? `${entry.source.kind}:${entry.source.subkind}:${entry.source.instance}`\n : `${entry.source.kind}:${entry.source.subkind}`;\n let line = `[${entry.level}] [${tag}] ${entry.message}`;\n if (entry.data && Object.keys(entry.data).length > 0) {\n line += ` ${JSON.stringify(entry.data)}`;\n }\n if (entry.error?.message) {\n line += ` — ${entry.error.message}`;\n }\n this.onLog(line);\n }\n\n writeBatch(entries: LogEntry[]): void {\n for (const e of entries) this.write(e);\n }\n\n close(): void {\n /* no-op */\n }\n}\n","import type { LogEntry, LogEntryEvent } from \"@skaile/workspaces/types\";\nimport type { LogSink } from \"./types.js\";\n\nexport interface WsLogSinkOptions {\n /**\n * Transport send callback. Typically wired to `transport.send` on the\n * runner's `WebSocketServerTransport`. The transport already drops sends\n * when no client is connected — this sink does not buffer.\n */\n send: (event: LogEntryEvent) => void;\n}\n\n/**\n * Forwards every LogEntry recorded by LogStore as a `log_entry` AgentEvent\n * over the configured transport. Used by the runner to make container-side\n * structured logs visible to the platform gateway in real time. Historical\n * reads still go through SQLite — this sink is for live tail only.\n */\nexport class WsLogSink implements LogSink {\n private readonly send: (event: LogEntryEvent) => void;\n\n constructor(opts: WsLogSinkOptions) {\n this.send = opts.send;\n }\n\n write(entry: LogEntry): void {\n try {\n this.send({ type: \"log_entry\", entry });\n } catch {\n // Logging must never break the agent — drop on transport failure.\n }\n }\n\n writeBatch(entries: LogEntry[]): void {\n for (const e of entries) this.write(e);\n }\n\n close(): void {\n /* nothing to release — transport lifecycle is owned by the caller */\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { withFsDeadline, tryWithFsDeadline, walkDir } from './chunk-MKZOK4JU.js';
2
- import { createLogger } from './chunk-W4IPN3DD.js';
1
+ import { withFsDeadline, tryWithFsDeadline, walkDir } from './chunk-2FBPAR2V.js';
2
+ import { createLogger } from './chunk-BOFL7GIF.js';
3
3
  import { parse } from 'yaml';
4
4
  import { readFile, stat } from 'fs/promises';
5
5
  import path from 'path';
@@ -329,5 +329,5 @@ function validateFlowVersions(nodes, skillVersions) {
329
329
  }
330
330
 
331
331
  export { buildRequiresPreamble, parseCompactionDirectives, parseSkillFrontmatter, parseSkillRequirements, validateConnectorRequirements, validateFlowVersions, validateRequirements };
332
- //# sourceMappingURL=chunk-3XXQPHGL.js.map
333
- //# sourceMappingURL=chunk-3XXQPHGL.js.map
332
+ //# sourceMappingURL=chunk-T3YUSWVK.js.map
333
+ //# sourceMappingURL=chunk-T3YUSWVK.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../resolver/src/parser.ts","../resolver/src/preamble.ts","../resolver/src/validator.ts","../resolver/src/version.ts"],"names":["parseYaml"],"mappings":";;;;;;;AAeO,SAAS,sBAAsB,OAAA,EAAsC;AAC1E,EAAA,MAAM,KAAA,GAAQ,OAAA,CAAQ,KAAA,CAAM,uBAAuB,CAAA;AACnD,EAAA,IAAI,CAAC,KAAA,EAAO,OAAO,EAAC;AACpB,EAAA,IAAI;AACF,IAAA,OAAOA,KAAA,CAAU,KAAA,CAAM,CAAC,CAAE,KAAK,EAAC;AAAA,EAClC,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,EAAC;AAAA,EACV;AACF;AAmBO,SAAS,uBAAuB,OAAA,EAAoC;AACzE,EAAA,MAAM,EAAA,GAAK,sBAAsB,OAAO,CAAA;AACxC,EAAA,MAAM,IAAA,GAAO,EAAA,CAAG,QAAA,IAAY,EAAC;AAC7B,EAAA,MAAM,aAAA,GAAgB,IAAA,CAAK,aAAA,IAAiB,EAAC;AAE7C,EAAA,MA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AAW;AAAA,KACZ,CAAA;AAAA,EACH;AAEA,EAAA,OAAO,MAAA;AACT","file":"chunk-3XXQPHGL.js","sourcesContent":["import { parse as parseYaml } from \"yaml\";\nimport type { ConnectorRequirement, InputField, SkillRequirements } from \"./types.js\";\n\n/**\n * Extract YAML frontmatter from a SKILL.md string.\n *\n * Frontmatter is delimited by leading `---` fences. Returns the parsed object,\n * or an empty object `{}` if no frontmatter block is found or if the YAML is malformed.\n * Errors are silently swallowed — callers should treat an empty result as \"no requirements\".\n *\n * @param content - Raw SKILL.md file content (full string, including `---` fences)\n * @returns Parsed frontmatter object, or `{}` on absence or parse failure\n *\n * @docLink packages/resolver/api-reference#parseskill-frontmatter\n */\nexport function parseSkillFrontmatter(content: string): Record<string, any> {\n const match = content.match(/^---\\n([\\s\\S]*?)\\n---/);\n if (!match) return {};\n try {\n return parseYaml(match[1]!) ?? {};\n } catch {\n return {};\n }\n}\n\n/**\n * Parse skill requirements from raw SKILL.md content into a `SkillRequirements` object.\n *\n * Supports two frontmatter formats:\n * 1. **New format** — `metadata.prerequisites` with explicit\n * `files`, `inputs_required`, `inputs_optional`, `reads`, `produces`, and `resources` arrays.\n * 2. **Legacy format** — `metadata.user_inputs.dialog[]` array, automatically promoted to\n * `inputs_required` / `inputs_optional` based on each entry's `required` flag.\n *\n * Returns empty requirements `{ files: [], inputs_required: [], inputs_optional: [], reads: [], produces: [], resources: [] }`\n * when no recognisable prerequisites section is found.\n *\n * @param content - Raw SKILL.md file content (full string, including `---` fences)\n * @returns Structured `SkillRequirements` (never throws)\n *\n * @docLink packages/resolver/api-reference#parseskill-requirements\n */\nexport function parseSkillRequirements(content: string): SkillRequirements {\n const fm = parseSkillFrontmatter(content);\n const meta = fm.metadata ?? {};\n const prerequisites = meta.prerequisites ?? {};\n\n const empty: SkillRequirements = {\n files: [],\n inputs_required: [],\n inputs_optional: [],\n reads: [],\n produces: [],\n resources: [],\n connectors: [],\n };\n\n // New format: metadata.prerequisites\n if (\n prerequisites.files ||\n prerequisites.inputs_required ||\n prerequisites.inputs_optional ||\n prerequisites.reads ||\n prerequisites.produces ||\n prerequisites.resources ||\n prerequisites.connectors\n ) {\n return {\n files: (prerequisites.files ?? []).map((f: any) => ({\n path: f.path,\n gate: f.gate ?? \"hard\",\n description: f.description ?? \"\",\n ...(f.min_entries != null ? { min_entries: f.min_entries } : {}),\n })),\n inputs_required: (prerequisites.inputs_required ?? []).map(normalizeInputField(true)),\n inputs_optional: (prerequisites.inputs_optional ?? []).map(normalizeInputField(false)),\n reads: (prerequisites.reads ?? []).map((r: any) => ({\n path: r.path,\n description: r.description ?? \"\",\n })),\n produces: (prerequisites.produces ?? []).map((p: any) => ({\n path: p.path,\n description: p.description ?? \"\",\n })),\n resources: (prerequisites.resources ?? []).map((r: any) => ({\n id: r.id,\n ...(r.operations ? { operations: r.operations } : {}),\n optional: r.optional ?? false,\n ...(r.description ? { description: r.description } : {}),\n })),\n connectors: parseConnectorRequirements(prerequisites.connectors),\n };\n }\n\n // Legacy format: metadata.user_inputs.dialog[]\n const dialog = meta.user_inputs?.dialog;\n if (Array.isArray(dialog)) {\n const required: InputField[] = [];\n const optional: InputField[] = [];\n for (const d of dialog) {\n const field = normalizeInputField(d.required ?? false)(d);\n if (d.required) required.push(field);\n else optional.push(field);\n }\n return { ...empty, inputs_required: required, inputs_optional: optional, resources: [] };\n }\n\n return empty;\n}\n\n/**\n * Extract compaction directives from a SKILL.md markdown body.\n *\n * Scans the markdown body (not frontmatter) for a `## Compaction Directives` section\n * and returns each bullet point as a trimmed string. Compaction directives are hints\n * the agent uses to summarise context when the conversation history grows long.\n * Returns an empty array when the section is absent.\n *\n * @param content - Raw SKILL.md file content (full string including frontmatter and body)\n * @returns Array of directive strings extracted from the bullet list, or `[]` if none found\n *\n * @docLink packages/resolver/api-reference#parse-compaction-directives\n */\nexport function parseCompactionDirectives(content: string): string[] {\n const headerIdx = content.search(/^## Compaction Directives/m);\n if (headerIdx === -1) return [];\n\n // Header on the last line (no trailing newline) → no body to scan.\n const newlineIdx = content.indexOf(\"\\n\", headerIdx);\n if (newlineIdx === -1) return [];\n const bodyStart = newlineIdx + 1;\n const rest = content.slice(bodyStart);\n const nextSection = rest.search(/^##\\s/m);\n const sectionBody = nextSection === -1 ? rest : rest.slice(0, nextSection);\n\n const bullets: string[] = [];\n for (const line of sectionBody.split(\"\\n\")) {\n const match = line.match(/^\\s*[-*]\\s+(.+)/);\n if (match) bullets.push(match[1].trim());\n }\n return bullets;\n}\n\nfunction normalizeInputField(defaultRequired: boolean) {\n return (d: any): InputField => ({\n // UserInputSchema permits `key` or `id`; `prompt` is the legacy label alias.\n id: d.id ?? d.key,\n label: d.label ?? d.prompt ?? d.id ?? d.key,\n type: d.type ?? \"text\",\n required: d.required ?? defaultRequired,\n ...(d.options ? { options: d.options } : {}),\n ...(d.default != null ? { default: d.default } : {}),\n ...(d.hint ? { hint: d.hint } : {}),\n ...(d.schema ? { schema: d.schema } : {}),\n });\n}\n\nfunction parseConnectorRequirements(raw: unknown): ConnectorRequirement[] {\n if (!Array.isArray(raw)) return [];\n return raw\n .filter((c): c is Record<string, unknown> => typeof c === \"object\" && c !== null)\n .map((c) => ({\n driver: String(c.driver ?? \"\"),\n ...(c.access === \"read-write\"\n ? { access: \"read-write\" as const }\n : { access: \"read-only\" as const }),\n }))\n .filter((c) => c.driver.length > 0);\n}\n","import type { SkillRequirements } from \"./types.js\";\n\n/**\n * Generate a DSL-format preamble from skill requirements.\n *\n * The preamble is prepended to the skill prompt when the skill runs standalone\n * (without an orchestrator), giving the agent an explicit checklist of what to\n * verify before starting work. Each section maps to a requirement category:\n *\n * - `REQUIRES` — file/directory gates (`hard:` or `soft:` prefix)\n * - `INPUT` — user input fields, with a pointer to `input.json` if `skillId` is provided\n * - `READS` — informational read sources (not gated)\n * - `WRITES` — files the skill will produce\n * - `RESOURCE` — runtime resource dependencies\n *\n * Sections with no entries are omitted. Returns an empty string when all\n * requirement arrays are empty.\n *\n * @param requirements - Parsed requirements (output of `parseSkillRequirements`)\n * @param skillId - Optional skill identifier; when provided, the INPUT section includes\n * the canonical `input.json` path so the agent knows where to read collected values\n * @returns Multi-section DSL string, or `\"\"` if there are no requirements to list\n *\n * @example\n * ```ts\n * const preamble = buildRequiresPreamble(requirements, \"cf_overview\");\n * const fullPrompt = preamble ? `${preamble}\\n\\n${skillBody}` : skillBody;\n * ```\n *\n * @docLink packages/resolver/api-reference#build-requires-preamble\n */\nexport function buildRequiresPreamble(requirements: SkillRequirements, skillId?: string): string {\n const sections: string[] = [];\n\n pushSection(sections, buildRequiresSection(requirements));\n pushSection(sections, buildInputSection(requirements, skillId));\n pushSection(sections, buildReadsSection(requirements));\n pushSection(sections, buildWritesSection(requirements));\n pushSection(sections, buildResourceSection(requirements));\n\n return sections.join(\"\\n\\n\");\n}\n\n/** Append a section to the list when it produced output. */\nfunction pushSection(sections: string[], section: string | null): void {\n if (section !== null) sections.push(section);\n}\n\n/** REQUIRES section (file gates). Returns `null` when there are no file gates. */\nfunction buildRequiresSection(requirements: SkillRequirements): string | null {\n if (requirements.files.length === 0) return null;\n const lines = [\"REQUIRES\"];\n for (const f of requirements.files) {\n const prefix = f.gate === \"hard\" ? \"hard\" : \"soft\";\n lines.push(` ${prefix}: ${f.path} — ${f.description}`);\n }\n return lines.join(\"\\n\");\n}\n\n/** INPUT section (user inputs). Returns `null` when there are no inputs. */\nfunction buildInputSection(requirements: SkillRequirements, skillId?: string): string | null {\n const allInputs = [...requirements.inputs_required, ...requirements.inputs_optional];\n if (allInputs.length === 0) return null;\n const lines = [\"INPUT\"];\n if (skillId) {\n lines.push(` Read from: _concept/_grounding/${skillId}/input.json`);\n lines.push(\n ` If input.json is missing, ask the user for the following values and write the file:`,\n );\n }\n for (const input of allInputs) {\n const req = input.required ? \"(required)\" : \"(optional)\";\n const opts = input.options ? ` [${input.options.join(\" | \")}]` : \"\";\n const def = input.default != null ? ` default: ${input.default}` : \"\";\n lines.push(` - ${input.id}: ${input.label} ${req}${opts}${def}`);\n if (input.hint) lines.push(` hint: ${input.hint}`);\n }\n return lines.join(\"\\n\");\n}\n\n/** READS section. Returns `null` when there are no read sources. */\nfunction buildReadsSection(requirements: SkillRequirements): string | null {\n if (requirements.reads.length === 0) return null;\n const lines = [\"READS\"];\n for (const r of requirements.reads) {\n lines.push(` ? ${r.path} — ${r.description}`);\n }\n return lines.join(\"\\n\");\n}\n\n/** WRITES section (produces). Returns `null` when there is nothing produced. */\nfunction buildWritesSection(requirements: SkillRequirements): string | null {\n if (requirements.produces.length === 0) return null;\n const lines = [\"WRITES\"];\n for (const p of requirements.produces) {\n lines.push(` ${p.path} — ${p.description}`);\n }\n return lines.join(\"\\n\");\n}\n\n/** RESOURCE section. Returns `null` when there are no resources. */\nfunction buildResourceSection(requirements: SkillRequirements): string | null {\n if (!requirements.resources || requirements.resources.length === 0) return null;\n const lines = [\"RESOURCE\"];\n for (const r of requirements.resources) {\n const req = r.optional ? \"(optional)\" : \"(required)\";\n const ops = r.operations ? ` ops: [${r.operations.join(\", \")}]` : \"\";\n lines.push(` ${r.id} ${req}${ops}`);\n if (r.description) lines.push(` — ${r.description}`);\n }\n return lines.join(\"\\n\");\n}\n","import { readFile, stat } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport {\n tryWithFsDeadline,\n walkDir,\n type WalkTruncation,\n withFsDeadline,\n} from \"@skaile/workspaces/core\";\nimport { createLogger } from \"@skaile/workspaces/core/logging\";\nimport type {\n ConnectorRequirement,\n FileCheck,\n InputCheck,\n NodeOverrides,\n ReadCheck,\n RequirementsReport,\n ResourceCheck,\n SkillInputFile,\n SkillRequirements,\n} from \"./types.js\";\n\nlet validatorLogger: ReturnType<typeof createLogger> | undefined;\n\nfunction log(): ReturnType<typeof createLogger> {\n validatorLogger ??= createLogger({ kind: \"runner\", subkind: \"skill-requirements\" });\n return validatorLogger;\n}\n\n/** Best-effort existence probe. A missing path, an unreadable one, and an\n * unresponsive mount are all \"not usable here\" for a requirement check. */\nasync function pathExists(target: string): Promise<boolean> {\n return tryWithFsDeadline(\n `stat ${target}`,\n async () => {\n await stat(target);\n return true;\n },\n false,\n );\n}\n\n/**\n * Validate skill requirements against the filesystem and collected inputs.\n *\n * File checks resolve paths relative to `projectDir`. Hard-gate files that are absent\n * set `satisfied: false` on the returned report; soft-gate misses are recorded but do not block.\n * Input checks read `_concept/_grounding/{skillId}/input.json`; missing files are treated as\n * no inputs collected. Resource checks are always recorded as `available: true` — actual\n * availability must be confirmed by the runner's `ResourceManager`.\n *\n * **Async and bounded since #454.** `projectDir` reaches this function straight\n * from the agent — `workspace_check_skill_requirements` takes `target_dir` as a\n * tool argument — so it can be `/skaile/workspace`, the rclone FUSE mount. Every\n * probe is now awaited and deadline-bounded, and the `min_entries` count walks\n * through the bounded {@link walkDir}, so a wedged mount or a symlink cycle\n * costs one failed tool call instead of the whole `skaile serve` event loop.\n *\n * @param skillId - Canonical skill identifier, used to locate `input.json`\n * @param requirements - Parsed requirements from SKILL.md (`parseSkillRequirements` output)\n * @param projectDir - Absolute path to the project root directory\n * @param overrides - Optional flow-level overrides; paths in `skip_checks` are treated as present\n * @param producesIndex - Maps file paths to the skill ID that produces them, enabling \"produced by\" hints in the report\n * @returns `RequirementsReport` with per-check results and an overall `satisfied` flag\n *\n * @docLink packages/resolver/api-reference#validate-requirements\n */\nexport async function validateRequirements(\n skillId: string,\n requirements: SkillRequirements,\n projectDir: string,\n overrides?: NodeOverrides,\n producesIndex?: Map<string, string>,\n): Promise<RequirementsReport> {\n const skipSet = new Set(overrides?.skip_checks ?? []);\n\n // Check files. Serial on purpose: `projectDir` may be one network mount, and\n // fanning every probe out concurrently multiplies the queue depth on exactly\n // the resource that is already the bottleneck.\n const files: FileCheck[] = [];\n for (const req of requirements.files) {\n if (skipSet.has(req.path)) {\n files.push({ path: req.path, gate: req.gate, exists: true, description: req.description });\n continue;\n }\n\n const fullPath = path.join(projectDir, req.path);\n const check: FileCheck = {\n path: req.path,\n gate: req.gate,\n exists: false,\n description: req.description,\n producedBy: producesIndex?.get(req.path),\n };\n\n if (req.min_entries != null) {\n const counted = await checkDirectoryMinEntries(fullPath, req.min_entries);\n check.exists = counted.satisfied;\n if (counted.truncated) check.truncated = true;\n } else {\n check.exists = await pathExists(fullPath);\n }\n\n files.push(check);\n }\n\n // Check inputs — look for _concept/_grounding/{skillId}/input.json\n const inputFile = path.join(projectDir, \"_concept\", \"_grounding\", skillId, \"input.json\");\n let collectedValues: Record<string, any> = {};\n try {\n const raw = await withFsDeadline(`readFile ${inputFile}`, () => readFile(inputFile, \"utf-8\"));\n const parsed = JSON.parse(raw) as SkillInputFile;\n collectedValues = parsed.values ?? {};\n } catch {\n // No input file — all inputs are missing\n }\n\n const allInputs = [\n ...requirements.inputs_required.map((f) => ({ field: f, required: true })),\n ...requirements.inputs_optional.map((f) => ({ field: f, required: false })),\n ];\n\n const inputs: InputCheck[] = allInputs.map(({ field, required }) => ({\n id: field.id,\n required,\n present: field.id in collectedValues,\n field,\n }));\n\n // Check reads (informational only)\n const reads: ReadCheck[] = [];\n for (const r of requirements.reads) {\n reads.push({\n path: r.path,\n exists: await pathExists(path.join(projectDir, r.path)),\n description: r.description,\n });\n }\n\n // Check resources (validated at a higher level if a ResourceManager is available;\n // here we just record them in the report with unknown status)\n const resources: ResourceCheck[] = (requirements.resources ?? []).map((r) => ({\n id: r.id,\n available: true, // Actual availability checked by runner with ResourceManager\n missingOps: [],\n optional: r.optional ?? false,\n }));\n\n // Satisfaction: all hard file gates pass AND all required inputs present\n const hardFilesSatisfied = files.filter((f) => f.gate === \"hard\").every((f) => f.exists);\n\n const requiredInputsSatisfied = inputs.filter((i) => i.required).every((i) => i.present);\n\n const requiredResourcesSatisfied = resources.filter((r) => !r.optional).every((r) => r.available);\n\n return {\n skillId,\n satisfied: hardFilesSatisfied && requiredInputsSatisfied && requiredResourcesSatisfied,\n files,\n inputs,\n reads,\n resources,\n };\n}\n\n/**\n * A warning produced by `validateConnectorRequirements` when a skill's declared\n * connector requirement is not satisfied by the connectors in skaile.yaml.\n * Each warning covers either a missing driver or an insufficient access level.\n *\n * @docLink packages/resolver/api-reference#connector-validation-warning\n */\nexport interface ConnectorValidationWarning {\n /** Driver name that triggered the warning. */\n driver: string;\n /** Human-readable explanation of the gap, including a remediation command where applicable. */\n message: string;\n}\n\n/** Minimal structural type accepted by validateConnectorRequirements. Compatible with both\n * ConnectorDeclaration shapes in @skaile/workspaces/core and @skaile/workspaces/connectors. */\ninterface AvailableConnector {\n driver: string;\n access?: \"read-only\" | \"read-write\";\n}\n\n/**\n * Check that all connector requirements declared in a skill's SKILL.md are\n * satisfied by the connectors declared in skaile.yaml.\n *\n * Returns one warning per gap — either a missing driver or an insufficient\n * access level. This is a pre-flight advisory; no runtime enforcement is done.\n *\n * @param requirements - Connector requirements from `parseSkillRequirements().connectors`\n * @param available - Connector declarations from `skaile.yaml` (via `loadConnectorDeclarations`)\n * @returns Array of warnings — one per gap. Empty array when all requirements are satisfied.\n *\n * @docLink packages/resolver/api-reference#validate-connector-requirements\n */\nexport function validateConnectorRequirements(\n requirements: ConnectorRequirement[],\n available: AvailableConnector[],\n): ConnectorValidationWarning[] {\n const warnings: ConnectorValidationWarning[] = [];\n\n for (const req of requirements) {\n const matches = available.filter((a) => a.driver === req.driver);\n\n if (matches.length === 0) {\n warnings.push({\n driver: req.driver,\n message:\n `Skill requires connector driver \"${req.driver}\" but none is declared in skaile.yaml. ` +\n `Run: skaile connector add ${req.driver}`,\n });\n continue;\n }\n\n if (req.access === \"read-write\") {\n const hasReadWrite = matches.some((m) => (m.access ?? \"read-only\") === \"read-write\");\n if (!hasReadWrite) {\n warnings.push({\n driver: req.driver,\n message:\n `Skill requires \"${req.driver}\" with read-write access, but all declared instances ` +\n `are read-only. Update access in skaile.yaml.`,\n });\n }\n }\n }\n\n return warnings;\n}\n\n/**\n * Does `dirPath` hold at least `minEntries` files, counted recursively?\n *\n * `truncated` is set when a walk bound was hit *and* the count still fell\n * short: the number is then a floor, not the truth, so `satisfied: false` is\n * \"we could not prove it\" rather than \"there are not enough files\". Reaching\n * `minEntries` short-circuits the walk, so the common case never pays for the\n * whole tree and a bound hit after that point is irrelevant.\n */\nasync function checkDirectoryMinEntries(\n dirPath: string,\n minEntries: number,\n): Promise<{ satisfied: boolean; truncated: boolean }> {\n const st = await tryWithFsDeadline(`stat ${dirPath}`, () => stat(dirPath), null);\n if (!st?.isDirectory()) return { satisfied: false, truncated: false };\n\n const { count, truncation } = await countFilesRecursive(dirPath, minEntries);\n const satisfied = count >= minEntries;\n if (!satisfied && truncation) {\n log().warn(\"min_entries count truncated — result is a lower bound, not the file count\", {\n dirPath,\n minEntries,\n count,\n ...truncation,\n });\n }\n return { satisfied, truncated: !satisfied && truncation !== undefined };\n}\n\n/**\n * Count files under `dirPath`, stopping at `limit`.\n *\n * Delegates to core's {@link walkDir} rather than recursing here: `dirPath` is\n * agent-supplied and can be a network mount, so the walk needs the deadline per\n * `opendir`, the depth / entry / wall-clock bounds, and the visited-inode cycle\n * guard that walker already owns. The pre-#454 `readdirSync` recursion had none\n * of them and recursed forever on `a/link -> a`.\n *\n * Inheriting `walkDir` also inherits its skip list: `.git` and `node_modules`\n * no longer count toward `min_entries`, which is what a prerequisite like\n * \"at least 3 feature files\" meant in the first place.\n */\nasync function countFilesRecursive(\n dirPath: string,\n limit: number,\n): Promise<{ count: number; truncation?: WalkTruncation }> {\n let count = 0;\n let truncation: WalkTruncation | undefined;\n for await (const _entry of walkDir(dirPath, {\n onTruncate: (info) => {\n truncation ??= info;\n },\n })) {\n count++;\n // Enough is enough — no reason to keep walking a large tree (or a wedged\n // mount) once the requirement is already met.\n if (count >= limit) return { count };\n }\n return { count, truncation };\n}\n","import { satisfies, valid, validRange } from \"semver\";\n\n/**\n * Result of a single flow-node version pin check.\n * Returned in the array produced by `validateFlowVersions()` for every\n * node that declares a `requestedVersion`.\n *\n * @docLink packages/resolver/api-reference#version-check\n */\nexport interface VersionCheck {\n /** Flow node identifier. */\n nodeId: string;\n /** Canonical skill identifier. */\n skillId: string;\n /** Semver range from the flow node (e.g. \"^1.0.0\") */\n requested: string;\n /** Version from the skill's frontmatter */\n actual: string;\n /** Whether `actual` satisfies the `requested` semver range. */\n satisfied: boolean;\n}\n\n/**\n * Minimal descriptor for a flow node that optionally pins a skill version.\n * Passed as input to `validateFlowVersions()`. Nodes without `requestedVersion`\n * are skipped during version checking.\n *\n * @docLink packages/resolver/api-reference#flow-version-node\n */\nexport interface FlowVersionNode {\n /** Flow node identifier. */\n nodeId: string;\n /** Canonical skill identifier referenced by this node. */\n skillId: string;\n /** Optional semver range the node requires (e.g. `\"^1.2.0\"`). Omit to skip version checking. */\n requestedVersion?: string;\n}\n\n/**\n * Validate flow node version pins against discovered skill versions.\n *\n * Only checks nodes that declare a `requestedVersion`. Nodes without a\n * version pin are skipped entirely (no entry is produced for those nodes).\n * A check is marked `satisfied: false` when the range is invalid, the actual\n * version string is not valid semver, or the version does not satisfy the range.\n *\n * @param nodes - Flow nodes to check; only those with `requestedVersion` are evaluated\n * @param skillVersions - Map from skill ID to the semver version string in its frontmatter\n * @returns Array of `VersionCheck` results, one per node that declared a version pin\n *\n * @docLink packages/resolver/api-reference#validate-flow-versions\n */\nexport function validateFlowVersions(\n nodes: FlowVersionNode[],\n skillVersions: Map<string, string>,\n): VersionCheck[] {\n const checks: VersionCheck[] = [];\n\n for (const node of nodes) {\n if (!node.requestedVersion) continue;\n\n const actual = skillVersions.get(node.skillId) ?? \"\";\n const requested = node.requestedVersion;\n\n // Invalid range or missing/invalid actual version → not satisfied\n const rangeValid = validRange(requested) !== null;\n const actualValid = actual !== \"\" && valid(actual) !== null;\n const isSatisfied = rangeValid && actualValid && satisfies(actual, requested);\n\n checks.push({\n nodeId: node.nodeId,\n skillId: node.skillId,\n requested,\n actual,\n satisfied: isSatisfied,\n });\n }\n\n return checks;\n}\n"]}
1
+ {"version":3,"sources":["../resolver/src/parser.ts","../resolver/src/preamble.ts","../resolver/src/validator.ts","../resolver/src/version.ts"],"names":["parseYaml"],"mappings":";;;;;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5B,IAAA,MAAM,MAAA,GAAS,aAAA,CAAc,GAAA,CAAI,IAAA,CAAK,OAAO,CAAA,IAAK,EAAA;AAClD,IAAA,MAAM,YAAY,IAAA,CAAK,gBAAA;AAGvB,IAAA,MAAM,UAAA,GAAa,UAAA,CAAW,SAAS,CAAA,KAAM,IAAA;AAC7C,IAAA,MAAM,WAAA,GAAc,MAAA,KAAW,EAAA,IAAM,KAAA,CAAM,MAAM,CAAA,KAAM,IAAA;AACvD,IAAA,MAAM,WAAA,GAAc,UAAA,IAAc,WAAA,IAAe,SAAA,CAAU,QAAQ,SAAS,CAAA;AAE5E,IAAA,MAAA,CAAO,IAAA,CAAK;AAAA,MACV,QAAQ,IAAA,CAAK,MAAA;AAAA,MACb,SAAS,IAAA,CAAK,OAAA;AAAA,MACd,SAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA,EAAW;AAAA,KACZ,CAAA;AAAA,EACH;AAEA,EAAA,OAAO,MAAA;AACT","file":"chunk-T3YUSWVK.js","sourcesContent":["import { parse as parseYaml } from \"yaml\";\nimport type { ConnectorRequirement, InputField, SkillRequirements } from \"./types.js\";\n\n/**\n * Extract YAML frontmatter from a SKILL.md string.\n *\n * Frontmatter is delimited by leading `---` fences. Returns the parsed object,\n * or an empty object `{}` if no frontmatter block is found or if the YAML is malformed.\n * Errors are silently swallowed — callers should treat an empty result as \"no requirements\".\n *\n * @param content - Raw SKILL.md file content (full string, including `---` fences)\n * @returns Parsed frontmatter object, or `{}` on absence or parse failure\n *\n * @docLink packages/resolver/api-reference#parseskill-frontmatter\n */\nexport function parseSkillFrontmatter(content: string): Record<string, any> {\n const match = content.match(/^---\\n([\\s\\S]*?)\\n---/);\n if (!match) return {};\n try {\n return parseYaml(match[1]!) ?? {};\n } catch {\n return {};\n }\n}\n\n/**\n * Parse skill requirements from raw SKILL.md content into a `SkillRequirements` object.\n *\n * Supports two frontmatter formats:\n * 1. **New format** — `metadata.prerequisites` with explicit\n * `files`, `inputs_required`, `inputs_optional`, `reads`, `produces`, and `resources` arrays.\n * 2. **Legacy format** — `metadata.user_inputs.dialog[]` array, automatically promoted to\n * `inputs_required` / `inputs_optional` based on each entry's `required` flag.\n *\n * Returns empty requirements `{ files: [], inputs_required: [], inputs_optional: [], reads: [], produces: [], resources: [] }`\n * when no recognisable prerequisites section is found.\n *\n * @param content - Raw SKILL.md file content (full string, including `---` fences)\n * @returns Structured `SkillRequirements` (never throws)\n *\n * @docLink packages/resolver/api-reference#parseskill-requirements\n */\nexport function parseSkillRequirements(content: string): SkillRequirements {\n const fm = parseSkillFrontmatter(content);\n const meta = fm.metadata ?? {};\n const prerequisites = meta.prerequisites ?? {};\n\n const empty: SkillRequirements = {\n files: [],\n inputs_required: [],\n inputs_optional: [],\n reads: [],\n produces: [],\n resources: [],\n connectors: [],\n };\n\n // New format: metadata.prerequisites\n if (\n prerequisites.files ||\n prerequisites.inputs_required ||\n prerequisites.inputs_optional ||\n prerequisites.reads ||\n prerequisites.produces ||\n prerequisites.resources ||\n prerequisites.connectors\n ) {\n return {\n files: (prerequisites.files ?? []).map((f: any) => ({\n path: f.path,\n gate: f.gate ?? \"hard\",\n description: f.description ?? \"\",\n ...(f.min_entries != null ? { min_entries: f.min_entries } : {}),\n })),\n inputs_required: (prerequisites.inputs_required ?? []).map(normalizeInputField(true)),\n inputs_optional: (prerequisites.inputs_optional ?? []).map(normalizeInputField(false)),\n reads: (prerequisites.reads ?? []).map((r: any) => ({\n path: r.path,\n description: r.description ?? \"\",\n })),\n produces: (prerequisites.produces ?? []).map((p: any) => ({\n path: p.path,\n description: p.description ?? \"\",\n })),\n resources: (prerequisites.resources ?? []).map((r: any) => ({\n id: r.id,\n ...(r.operations ? { operations: r.operations } : {}),\n optional: r.optional ?? false,\n ...(r.description ? { description: r.description } : {}),\n })),\n connectors: parseConnectorRequirements(prerequisites.connectors),\n };\n }\n\n // Legacy format: metadata.user_inputs.dialog[]\n const dialog = meta.user_inputs?.dialog;\n if (Array.isArray(dialog)) {\n const required: InputField[] = [];\n const optional: InputField[] = [];\n for (const d of dialog) {\n const field = normalizeInputField(d.required ?? false)(d);\n if (d.required) required.push(field);\n else optional.push(field);\n }\n return { ...empty, inputs_required: required, inputs_optional: optional, resources: [] };\n }\n\n return empty;\n}\n\n/**\n * Extract compaction directives from a SKILL.md markdown body.\n *\n * Scans the markdown body (not frontmatter) for a `## Compaction Directives` section\n * and returns each bullet point as a trimmed string. Compaction directives are hints\n * the agent uses to summarise context when the conversation history grows long.\n * Returns an empty array when the section is absent.\n *\n * @param content - Raw SKILL.md file content (full string including frontmatter and body)\n * @returns Array of directive strings extracted from the bullet list, or `[]` if none found\n *\n * @docLink packages/resolver/api-reference#parse-compaction-directives\n */\nexport function parseCompactionDirectives(content: string): string[] {\n const headerIdx = content.search(/^## Compaction Directives/m);\n if (headerIdx === -1) return [];\n\n // Header on the last line (no trailing newline) → no body to scan.\n const newlineIdx = content.indexOf(\"\\n\", headerIdx);\n if (newlineIdx === -1) return [];\n const bodyStart = newlineIdx + 1;\n const rest = content.slice(bodyStart);\n const nextSection = rest.search(/^##\\s/m);\n const sectionBody = nextSection === -1 ? rest : rest.slice(0, nextSection);\n\n const bullets: string[] = [];\n for (const line of sectionBody.split(\"\\n\")) {\n const match = line.match(/^\\s*[-*]\\s+(.+)/);\n if (match) bullets.push(match[1].trim());\n }\n return bullets;\n}\n\nfunction normalizeInputField(defaultRequired: boolean) {\n return (d: any): InputField => ({\n // UserInputSchema permits `key` or `id`; `prompt` is the legacy label alias.\n id: d.id ?? d.key,\n label: d.label ?? d.prompt ?? d.id ?? d.key,\n type: d.type ?? \"text\",\n required: d.required ?? defaultRequired,\n ...(d.options ? { options: d.options } : {}),\n ...(d.default != null ? { default: d.default } : {}),\n ...(d.hint ? { hint: d.hint } : {}),\n ...(d.schema ? { schema: d.schema } : {}),\n });\n}\n\nfunction parseConnectorRequirements(raw: unknown): ConnectorRequirement[] {\n if (!Array.isArray(raw)) return [];\n return raw\n .filter((c): c is Record<string, unknown> => typeof c === \"object\" && c !== null)\n .map((c) => ({\n driver: String(c.driver ?? \"\"),\n ...(c.access === \"read-write\"\n ? { access: \"read-write\" as const }\n : { access: \"read-only\" as const }),\n }))\n .filter((c) => c.driver.length > 0);\n}\n","import type { SkillRequirements } from \"./types.js\";\n\n/**\n * Generate a DSL-format preamble from skill requirements.\n *\n * The preamble is prepended to the skill prompt when the skill runs standalone\n * (without an orchestrator), giving the agent an explicit checklist of what to\n * verify before starting work. Each section maps to a requirement category:\n *\n * - `REQUIRES` — file/directory gates (`hard:` or `soft:` prefix)\n * - `INPUT` — user input fields, with a pointer to `input.json` if `skillId` is provided\n * - `READS` — informational read sources (not gated)\n * - `WRITES` — files the skill will produce\n * - `RESOURCE` — runtime resource dependencies\n *\n * Sections with no entries are omitted. Returns an empty string when all\n * requirement arrays are empty.\n *\n * @param requirements - Parsed requirements (output of `parseSkillRequirements`)\n * @param skillId - Optional skill identifier; when provided, the INPUT section includes\n * the canonical `input.json` path so the agent knows where to read collected values\n * @returns Multi-section DSL string, or `\"\"` if there are no requirements to list\n *\n * @example\n * ```ts\n * const preamble = buildRequiresPreamble(requirements, \"cf_overview\");\n * const fullPrompt = preamble ? `${preamble}\\n\\n${skillBody}` : skillBody;\n * ```\n *\n * @docLink packages/resolver/api-reference#build-requires-preamble\n */\nexport function buildRequiresPreamble(requirements: SkillRequirements, skillId?: string): string {\n const sections: string[] = [];\n\n pushSection(sections, buildRequiresSection(requirements));\n pushSection(sections, buildInputSection(requirements, skillId));\n pushSection(sections, buildReadsSection(requirements));\n pushSection(sections, buildWritesSection(requirements));\n pushSection(sections, buildResourceSection(requirements));\n\n return sections.join(\"\\n\\n\");\n}\n\n/** Append a section to the list when it produced output. */\nfunction pushSection(sections: string[], section: string | null): void {\n if (section !== null) sections.push(section);\n}\n\n/** REQUIRES section (file gates). Returns `null` when there are no file gates. */\nfunction buildRequiresSection(requirements: SkillRequirements): string | null {\n if (requirements.files.length === 0) return null;\n const lines = [\"REQUIRES\"];\n for (const f of requirements.files) {\n const prefix = f.gate === \"hard\" ? \"hard\" : \"soft\";\n lines.push(` ${prefix}: ${f.path} — ${f.description}`);\n }\n return lines.join(\"\\n\");\n}\n\n/** INPUT section (user inputs). Returns `null` when there are no inputs. */\nfunction buildInputSection(requirements: SkillRequirements, skillId?: string): string | null {\n const allInputs = [...requirements.inputs_required, ...requirements.inputs_optional];\n if (allInputs.length === 0) return null;\n const lines = [\"INPUT\"];\n if (skillId) {\n lines.push(` Read from: _concept/_grounding/${skillId}/input.json`);\n lines.push(\n ` If input.json is missing, ask the user for the following values and write the file:`,\n );\n }\n for (const input of allInputs) {\n const req = input.required ? \"(required)\" : \"(optional)\";\n const opts = input.options ? ` [${input.options.join(\" | \")}]` : \"\";\n const def = input.default != null ? ` default: ${input.default}` : \"\";\n lines.push(` - ${input.id}: ${input.label} ${req}${opts}${def}`);\n if (input.hint) lines.push(` hint: ${input.hint}`);\n }\n return lines.join(\"\\n\");\n}\n\n/** READS section. Returns `null` when there are no read sources. */\nfunction buildReadsSection(requirements: SkillRequirements): string | null {\n if (requirements.reads.length === 0) return null;\n const lines = [\"READS\"];\n for (const r of requirements.reads) {\n lines.push(` ? ${r.path} — ${r.description}`);\n }\n return lines.join(\"\\n\");\n}\n\n/** WRITES section (produces). Returns `null` when there is nothing produced. */\nfunction buildWritesSection(requirements: SkillRequirements): string | null {\n if (requirements.produces.length === 0) return null;\n const lines = [\"WRITES\"];\n for (const p of requirements.produces) {\n lines.push(` ${p.path} — ${p.description}`);\n }\n return lines.join(\"\\n\");\n}\n\n/** RESOURCE section. Returns `null` when there are no resources. */\nfunction buildResourceSection(requirements: SkillRequirements): string | null {\n if (!requirements.resources || requirements.resources.length === 0) return null;\n const lines = [\"RESOURCE\"];\n for (const r of requirements.resources) {\n const req = r.optional ? \"(optional)\" : \"(required)\";\n const ops = r.operations ? ` ops: [${r.operations.join(\", \")}]` : \"\";\n lines.push(` ${r.id} ${req}${ops}`);\n if (r.description) lines.push(` — ${r.description}`);\n }\n return lines.join(\"\\n\");\n}\n","import { readFile, stat } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport {\n tryWithFsDeadline,\n walkDir,\n type WalkTruncation,\n withFsDeadline,\n} from \"@skaile/workspaces/core\";\nimport { createLogger } from \"@skaile/workspaces/core/logging\";\nimport type {\n ConnectorRequirement,\n FileCheck,\n InputCheck,\n NodeOverrides,\n ReadCheck,\n RequirementsReport,\n ResourceCheck,\n SkillInputFile,\n SkillRequirements,\n} from \"./types.js\";\n\nlet validatorLogger: ReturnType<typeof createLogger> | undefined;\n\nfunction log(): ReturnType<typeof createLogger> {\n validatorLogger ??= createLogger({ kind: \"runner\", subkind: \"skill-requirements\" });\n return validatorLogger;\n}\n\n/** Best-effort existence probe. A missing path, an unreadable one, and an\n * unresponsive mount are all \"not usable here\" for a requirement check. */\nasync function pathExists(target: string): Promise<boolean> {\n return tryWithFsDeadline(\n `stat ${target}`,\n async () => {\n await stat(target);\n return true;\n },\n false,\n );\n}\n\n/**\n * Validate skill requirements against the filesystem and collected inputs.\n *\n * File checks resolve paths relative to `projectDir`. Hard-gate files that are absent\n * set `satisfied: false` on the returned report; soft-gate misses are recorded but do not block.\n * Input checks read `_concept/_grounding/{skillId}/input.json`; missing files are treated as\n * no inputs collected. Resource checks are always recorded as `available: true` — actual\n * availability must be confirmed by the runner's `ResourceManager`.\n *\n * **Async and bounded since #454.** `projectDir` reaches this function straight\n * from the agent — `workspace_check_skill_requirements` takes `target_dir` as a\n * tool argument — so it can be `/skaile/workspace`, the rclone FUSE mount. Every\n * probe is now awaited and deadline-bounded, and the `min_entries` count walks\n * through the bounded {@link walkDir}, so a wedged mount or a symlink cycle\n * costs one failed tool call instead of the whole `skaile serve` event loop.\n *\n * @param skillId - Canonical skill identifier, used to locate `input.json`\n * @param requirements - Parsed requirements from SKILL.md (`parseSkillRequirements` output)\n * @param projectDir - Absolute path to the project root directory\n * @param overrides - Optional flow-level overrides; paths in `skip_checks` are treated as present\n * @param producesIndex - Maps file paths to the skill ID that produces them, enabling \"produced by\" hints in the report\n * @returns `RequirementsReport` with per-check results and an overall `satisfied` flag\n *\n * @docLink packages/resolver/api-reference#validate-requirements\n */\nexport async function validateRequirements(\n skillId: string,\n requirements: SkillRequirements,\n projectDir: string,\n overrides?: NodeOverrides,\n producesIndex?: Map<string, string>,\n): Promise<RequirementsReport> {\n const skipSet = new Set(overrides?.skip_checks ?? []);\n\n // Check files. Serial on purpose: `projectDir` may be one network mount, and\n // fanning every probe out concurrently multiplies the queue depth on exactly\n // the resource that is already the bottleneck.\n const files: FileCheck[] = [];\n for (const req of requirements.files) {\n if (skipSet.has(req.path)) {\n files.push({ path: req.path, gate: req.gate, exists: true, description: req.description });\n continue;\n }\n\n const fullPath = path.join(projectDir, req.path);\n const check: FileCheck = {\n path: req.path,\n gate: req.gate,\n exists: false,\n description: req.description,\n producedBy: producesIndex?.get(req.path),\n };\n\n if (req.min_entries != null) {\n const counted = await checkDirectoryMinEntries(fullPath, req.min_entries);\n check.exists = counted.satisfied;\n if (counted.truncated) check.truncated = true;\n } else {\n check.exists = await pathExists(fullPath);\n }\n\n files.push(check);\n }\n\n // Check inputs — look for _concept/_grounding/{skillId}/input.json\n const inputFile = path.join(projectDir, \"_concept\", \"_grounding\", skillId, \"input.json\");\n let collectedValues: Record<string, any> = {};\n try {\n const raw = await withFsDeadline(`readFile ${inputFile}`, () => readFile(inputFile, \"utf-8\"));\n const parsed = JSON.parse(raw) as SkillInputFile;\n collectedValues = parsed.values ?? {};\n } catch {\n // No input file — all inputs are missing\n }\n\n const allInputs = [\n ...requirements.inputs_required.map((f) => ({ field: f, required: true })),\n ...requirements.inputs_optional.map((f) => ({ field: f, required: false })),\n ];\n\n const inputs: InputCheck[] = allInputs.map(({ field, required }) => ({\n id: field.id,\n required,\n present: field.id in collectedValues,\n field,\n }));\n\n // Check reads (informational only)\n const reads: ReadCheck[] = [];\n for (const r of requirements.reads) {\n reads.push({\n path: r.path,\n exists: await pathExists(path.join(projectDir, r.path)),\n description: r.description,\n });\n }\n\n // Check resources (validated at a higher level if a ResourceManager is available;\n // here we just record them in the report with unknown status)\n const resources: ResourceCheck[] = (requirements.resources ?? []).map((r) => ({\n id: r.id,\n available: true, // Actual availability checked by runner with ResourceManager\n missingOps: [],\n optional: r.optional ?? false,\n }));\n\n // Satisfaction: all hard file gates pass AND all required inputs present\n const hardFilesSatisfied = files.filter((f) => f.gate === \"hard\").every((f) => f.exists);\n\n const requiredInputsSatisfied = inputs.filter((i) => i.required).every((i) => i.present);\n\n const requiredResourcesSatisfied = resources.filter((r) => !r.optional).every((r) => r.available);\n\n return {\n skillId,\n satisfied: hardFilesSatisfied && requiredInputsSatisfied && requiredResourcesSatisfied,\n files,\n inputs,\n reads,\n resources,\n };\n}\n\n/**\n * A warning produced by `validateConnectorRequirements` when a skill's declared\n * connector requirement is not satisfied by the connectors in skaile.yaml.\n * Each warning covers either a missing driver or an insufficient access level.\n *\n * @docLink packages/resolver/api-reference#connector-validation-warning\n */\nexport interface ConnectorValidationWarning {\n /** Driver name that triggered the warning. */\n driver: string;\n /** Human-readable explanation of the gap, including a remediation command where applicable. */\n message: string;\n}\n\n/** Minimal structural type accepted by validateConnectorRequirements. Compatible with both\n * ConnectorDeclaration shapes in @skaile/workspaces/core and @skaile/workspaces/connectors. */\ninterface AvailableConnector {\n driver: string;\n access?: \"read-only\" | \"read-write\";\n}\n\n/**\n * Check that all connector requirements declared in a skill's SKILL.md are\n * satisfied by the connectors declared in skaile.yaml.\n *\n * Returns one warning per gap — either a missing driver or an insufficient\n * access level. This is a pre-flight advisory; no runtime enforcement is done.\n *\n * @param requirements - Connector requirements from `parseSkillRequirements().connectors`\n * @param available - Connector declarations from `skaile.yaml` (via `loadConnectorDeclarations`)\n * @returns Array of warnings — one per gap. Empty array when all requirements are satisfied.\n *\n * @docLink packages/resolver/api-reference#validate-connector-requirements\n */\nexport function validateConnectorRequirements(\n requirements: ConnectorRequirement[],\n available: AvailableConnector[],\n): ConnectorValidationWarning[] {\n const warnings: ConnectorValidationWarning[] = [];\n\n for (const req of requirements) {\n const matches = available.filter((a) => a.driver === req.driver);\n\n if (matches.length === 0) {\n warnings.push({\n driver: req.driver,\n message:\n `Skill requires connector driver \"${req.driver}\" but none is declared in skaile.yaml. ` +\n `Run: skaile connector add ${req.driver}`,\n });\n continue;\n }\n\n if (req.access === \"read-write\") {\n const hasReadWrite = matches.some((m) => (m.access ?? \"read-only\") === \"read-write\");\n if (!hasReadWrite) {\n warnings.push({\n driver: req.driver,\n message:\n `Skill requires \"${req.driver}\" with read-write access, but all declared instances ` +\n `are read-only. Update access in skaile.yaml.`,\n });\n }\n }\n }\n\n return warnings;\n}\n\n/**\n * Does `dirPath` hold at least `minEntries` files, counted recursively?\n *\n * `truncated` is set when a walk bound was hit *and* the count still fell\n * short: the number is then a floor, not the truth, so `satisfied: false` is\n * \"we could not prove it\" rather than \"there are not enough files\". Reaching\n * `minEntries` short-circuits the walk, so the common case never pays for the\n * whole tree and a bound hit after that point is irrelevant.\n */\nasync function checkDirectoryMinEntries(\n dirPath: string,\n minEntries: number,\n): Promise<{ satisfied: boolean; truncated: boolean }> {\n const st = await tryWithFsDeadline(`stat ${dirPath}`, () => stat(dirPath), null);\n if (!st?.isDirectory()) return { satisfied: false, truncated: false };\n\n const { count, truncation } = await countFilesRecursive(dirPath, minEntries);\n const satisfied = count >= minEntries;\n if (!satisfied && truncation) {\n log().warn(\"min_entries count truncated — result is a lower bound, not the file count\", {\n dirPath,\n minEntries,\n count,\n ...truncation,\n });\n }\n return { satisfied, truncated: !satisfied && truncation !== undefined };\n}\n\n/**\n * Count files under `dirPath`, stopping at `limit`.\n *\n * Delegates to core's {@link walkDir} rather than recursing here: `dirPath` is\n * agent-supplied and can be a network mount, so the walk needs the deadline per\n * `opendir`, the depth / entry / wall-clock bounds, and the visited-inode cycle\n * guard that walker already owns. The pre-#454 `readdirSync` recursion had none\n * of them and recursed forever on `a/link -> a`.\n *\n * Inheriting `walkDir` also inherits its skip list: `.git` and `node_modules`\n * no longer count toward `min_entries`, which is what a prerequisite like\n * \"at least 3 feature files\" meant in the first place.\n */\nasync function countFilesRecursive(\n dirPath: string,\n limit: number,\n): Promise<{ count: number; truncation?: WalkTruncation }> {\n let count = 0;\n let truncation: WalkTruncation | undefined;\n for await (const _entry of walkDir(dirPath, {\n onTruncate: (info) => {\n truncation ??= info;\n },\n })) {\n count++;\n // Enough is enough — no reason to keep walking a large tree (or a wedged\n // mount) once the requirement is already met.\n if (count >= limit) return { count };\n }\n return { count, truncation };\n}\n","import { satisfies, valid, validRange } from \"semver\";\n\n/**\n * Result of a single flow-node version pin check.\n * Returned in the array produced by `validateFlowVersions()` for every\n * node that declares a `requestedVersion`.\n *\n * @docLink packages/resolver/api-reference#version-check\n */\nexport interface VersionCheck {\n /** Flow node identifier. */\n nodeId: string;\n /** Canonical skill identifier. */\n skillId: string;\n /** Semver range from the flow node (e.g. \"^1.0.0\") */\n requested: string;\n /** Version from the skill's frontmatter */\n actual: string;\n /** Whether `actual` satisfies the `requested` semver range. */\n satisfied: boolean;\n}\n\n/**\n * Minimal descriptor for a flow node that optionally pins a skill version.\n * Passed as input to `validateFlowVersions()`. Nodes without `requestedVersion`\n * are skipped during version checking.\n *\n * @docLink packages/resolver/api-reference#flow-version-node\n */\nexport interface FlowVersionNode {\n /** Flow node identifier. */\n nodeId: string;\n /** Canonical skill identifier referenced by this node. */\n skillId: string;\n /** Optional semver range the node requires (e.g. `\"^1.2.0\"`). Omit to skip version checking. */\n requestedVersion?: string;\n}\n\n/**\n * Validate flow node version pins against discovered skill versions.\n *\n * Only checks nodes that declare a `requestedVersion`. Nodes without a\n * version pin are skipped entirely (no entry is produced for those nodes).\n * A check is marked `satisfied: false` when the range is invalid, the actual\n * version string is not valid semver, or the version does not satisfy the range.\n *\n * @param nodes - Flow nodes to check; only those with `requestedVersion` are evaluated\n * @param skillVersions - Map from skill ID to the semver version string in its frontmatter\n * @returns Array of `VersionCheck` results, one per node that declared a version pin\n *\n * @docLink packages/resolver/api-reference#validate-flow-versions\n */\nexport function validateFlowVersions(\n nodes: FlowVersionNode[],\n skillVersions: Map<string, string>,\n): VersionCheck[] {\n const checks: VersionCheck[] = [];\n\n for (const node of nodes) {\n if (!node.requestedVersion) continue;\n\n const actual = skillVersions.get(node.skillId) ?? \"\";\n const requested = node.requestedVersion;\n\n // Invalid range or missing/invalid actual version → not satisfied\n const rangeValid = validRange(requested) !== null;\n const actualValid = actual !== \"\" && valid(actual) !== null;\n const isSatisfied = rangeValid && actualValid && satisfies(actual, requested);\n\n checks.push({\n nodeId: node.nodeId,\n skillId: node.skillId,\n requested,\n actual,\n satisfied: isSatisfied,\n });\n }\n\n return checks;\n}\n"]}
@@ -1,6 +1,7 @@
1
- import { SubprocessCliDriver, extractText, extractCost, extractTokens, resolveEnvDriverSession, bindSingleProviderEntry, resolveRegistryBinding } from './chunk-IECQMSQ5.js';
2
- import { getStaticModels, fetchProviderModels } from './chunk-BXV6RLF4.js';
3
- import { getProviderPreset, BUILTIN_DRIVER_CATALOG, getBridgeLogger, entryCredentialValue, registryDriverConfig } from './chunk-3T5DRUNZ.js';
1
+ import { SubprocessCliDriver, extractText, extractCost, extractTokens } from './chunk-UE4AKJNQ.js';
2
+ import { resolveEnvDriverSession, bindSingleProviderEntry, resolveRegistryBinding } from './chunk-DMJ4FUEO.js';
3
+ import { getStaticModels, fetchProviderModels } from './chunk-4G6HFU27.js';
4
+ import { getProviderPreset, BUILTIN_DRIVER_CATALOG, getBridgeLogger, entryCredentialValue, registryDriverConfig } from './chunk-RQRWMKST.js';
4
5
  import * as z from 'zod';
5
6
 
6
7
  var GOOGLE_DEFAULT_BASE_URL = getProviderPreset("google")?.base_url;
@@ -183,5 +184,5 @@ var geminiDriverTarget = {
183
184
  };
184
185
 
185
186
  export { GeminiDriver, GeminiFamilyDriver, geminiDriverTarget };
186
- //# sourceMappingURL=chunk-6XKQEDF7.js.map
187
- //# sourceMappingURL=chunk-6XKQEDF7.js.map
187
+ //# sourceMappingURL=ch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IAAI,CAAA;AAAA,EAC9C,QAAQ,OAAO,MAAA,EAAQ,IAAA,KAAS,IAAI,aAAa,MAAM,CAAA;AAAA,EACvD,UAAA,EAAY,OAAO,QAAA,EAAU,OAAA,KAC3B,IAAI,YAAA,CAAa;AAAA,IACf,GAAA,EAAK,QAAQ,GAAA,EAAI;AAAA,IACjB,SAAA,EAAW,YAAA;AAAA,IACX,GAAG,oBAAA,CAAqB,QAAA,EAAU,OAAO;AAAA,GAC1C,EAAE,UAAA;AACP","file":"chunk-TMOS6KL5.js","sourcesContent":["import type { DriverTarget } from \"@skaile/workspaces/plugin-registry\";\nimport type { Logger } from \"@skaile/workspaces/types\";\nimport * as z from \"zod\";\nimport { getBridgeLogger } from \"../logger.js\";\nimport { fetchProviderModels, getStaticModels, type ModelEntry } from \"../models.js\";\nimport { getProviderPreset } from \"../provider-catalog.js\";\nimport { entryCredentialValue } from \"../provider-materialize/credential-env.js\";\nimport {\n bindSingleProviderEntry,\n type EnvDriverSession,\n type RegistryModelBinding,\n resolveEnvDriverSession,\n resolveRegistryBinding,\n} from \"../provider-materialize/env-drivers.js\";\nimport { registryDriverConfig } from \"../provider-registry-derive.js\";\nimport { BUILTIN_DRIVER_CATALOG } from \"../registry.js\";\nimport type { AgentConfig, DriverInfo } from \"../types.js\";\nimport { extractCost, extractText, extractTokens, SubprocessCliDriver } from \"./_subprocess-cli.js\";\n\n/**\n * The Gemini API host the CLI talks to unless told otherwise — the catalog's\n * `google` preset, so the two can never drift apart.\n */\nconst GOOGLE_DEFAULT_BASE_URL = getProviderPreset(\"google\")?.base_url;\n\n/**\n * Shared base for the Gemini-CLI event family. Gemini CLI and Qwen Code (a fork\n * of Gemini CLI) emit the same `stream-json` event shape, so both dispatch the\n * same {@link handleJson}: `init`/`system` → session capture, `message`/\n * `assistant` → streamed assistant text, `tool_use` / `tool_result` → tool\n * events, `result` → tokens + cost.\n *\n * @docLink packages/bridge/drivers#gemini-driver\n */\nexport abstract class GeminiFamilyDriver extends SubprocessCliDriver {\n protected handleJson(json: any): void {\n switch (json?.type) {\n case \"init\":\n case \"system\":\n this.captureSession(json.sessionId ?? json.session_id ?? json.id);\n break;\n\n case \"message\":\n case \"assistant\": {\n const role = json.role ?? json.message?.role ?? \"assistant\";\n if (role !== \"assistant\") break;\n const text = extractText(json);\n if (json.done === true || json.final === true || json.finished === true) {\n this.pushAssistantEnd(text);\n } else {\n this.pushAssistantDelta(text);\n }\n break;\n }\n\n case \"tool_use\":\n case \"tool_call\":\n this.pushToolCall(json.name ?? json.tool ?? \"tool\", json.input ?? json.args ?? {});\n break;\n\n case \"tool_result\":\n this.pushToolResult(\n json.name ?? json.tool ?? \"tool\",\n json.result ?? json.output ?? json.content,\n Boolean(json.is_error ?? json.isError ?? json.error),\n );\n break;\n\n case \"error\":\n this.pushError(this.classifyMessage(String(json.message ?? json.error ?? \"error\")));\n break;\n\n case \"result\":\n this.captureSession(json.sessionId ?? json.session_id);\n this.pushResult({\n tokens: extractTokens(json),\n costUsd: extractCost(json),\n summary: extractText(json) || \"Task completed\",\n });\n break;\n }\n }\n\n // ── Registry binding ──────────────────────────────────────────────────────\n\n private providers?: EnvDriverSession;\n private boundEntry?: RegistryModelBinding;\n private bindingResolved = false;\n\n /** This session's AI providers, resolved once from the config. */\n protected providerSession(): EnvDriverSession {\n this.providers ??= resolveEnvDriverSession(this.config);\n return this.providers;\n }\n\n /**\n * The AI provider entry this session's model selector names, memoized until\n * the model changes.\n *\n * Gemini CLI and Qwen Code are `single`-plurality backends (§2.3): they\n * address one endpoint, so the bound entry supplies both the credential and\n * the base URL. Resolving through {@link bindSingleProviderEntry} is what\n * puts the surface check — which throws — on the start path.\n */\n protected registryBinding(): RegistryModelBinding | undefined {\n if (this.bindingResolved) return this.boundEntry;\n const binding = bindSingleProviderEntry(\n this.driverInfo.id,\n this.productName,\n this.providerSession(),\n );\n for (const warning of binding?.warnings ?? []) this.log.warn(warning);\n this.boundEntry = binding;\n this.bindingResolved = true;\n return binding;\n }\n\n /**\n * Fail before the first spawn when the bound entry speaks a surface this\n * backend cannot — the error names the surface.\n */\n override async start(): Promise<void> {\n this.registryBinding();\n await super.start();\n }\n\n override reconfigure(patch: Partial<Pick<AgentConfig, \"model\" | \"thinking\" | \"effort\">>): void {\n super.reconfigure(patch);\n if (patch.model !== undefined) {\n this.providers = undefined;\n this.bindingResolved = false;\n }\n }\n\n /** The provider-side model id the backend is actually run with. */\n override getModel(): string | undefined {\n return resolveRegistryBinding(this.providerSession())?.providerModelId ?? this.config.model;\n }\n}\n\n/**\n * Agent driver for the Google **Gemini CLI** (`gemini`).\n *\n * Spawns `gemini -p \"<prompt>\" --output-format stream-json` per turn and maps\n * the stream-json events to the unified {@link AgentEvent} stream. Google\n * models only (`surface: google-generative-ai`): the AI provider entry the\n * session's model selector names supplies `GEMINI_API_KEY`, the `-m` model id\n * and — for a non-default endpoint — `GOOGLE_GEMINI_BASE_URL`.\n *\n * @remarks\n * - **Requires Gemini CLI ≥ v0.6.1** — earlier versions reject\n * `--output-format`. A too-old CLI surfaces as a `process`-category exit error.\n * - **Session resume is not available in headless (`-p`) mode** — the CLI errors\n * if asked to resume non-interactively, so this driver runs single-turn per\n * process and logs a warning when a resume id is present.\n * - Exit codes: `42` → input/validation error, `53` → turn-limit (treated as a\n * completed turn).\n *\n * @see https://github.com/google-gemini/gemini-cli\n * @docLink packages/bridge/drivers#gemini-driver\n */\nexport class GeminiDriver extends GeminiFamilyDriver {\n readonly driverInfo: DriverInfo = {\n id: \"gemini\",\n name: \"Gemini CLI\",\n modelAgnostic: false,\n supportsInBandAbort: false,\n };\n\n protected readonly log: Logger = getBridgeLogger(\"gemini\");\n protected readonly defaultBin = \"gemini\";\n protected readonly productName = \"Gemini CLI\";\n protected readonly envPrefix = \"GEMINI\";\n\n protected buildArgs(message: string, resumeId: string | undefined): string[] {\n if (resumeId) {\n this.log.warn(\"Gemini CLI cannot resume in headless mode; starting a fresh turn\", {\n resumeId,\n });\n }\n const args = [\"-p\", message, \"--output-format\", \"stream-json\"];\n const model = this.registryBinding()?.providerModelId ?? this.config.model;\n if (model) args.push(\"-m\", model);\n return args;\n }\n\n protected buildEnv(): Record<string, string> {\n const env = this.baseEnv([\"GEMINI_API_KEY\", \"GOOGLE_API_KEY\", \"GOOGLE_GEMINI_BASE_URL\"]);\n const binding = this.registryBinding();\n if (!binding) return env;\n\n // The entry is the authority: inherited Google carriers are dropped so an\n // ambient key cannot authenticate a session pointed somewhere else.\n delete env.GEMINI_API_KEY;\n delete env.GOOGLE_API_KEY;\n delete env.GOOGLE_GEMINI_BASE_URL;\n const key = entryCredentialValue(binding.providerId, binding.entry, {\n env: this.providerSession().lookupEnv,\n });\n if (key) env.GEMINI_API_KEY = key;\n // Only a non-default endpoint is worth naming: Gemini CLI reads\n // GOOGLE_GEMINI_BASE_URL as an override of its own default host.\n if (binding.baseUrl && binding.baseUrl !== GOOGLE_DEFAULT_BASE_URL) {\n env.GOOGLE_GEMINI_BASE_URL = binding.baseUrl;\n }\n return env;\n }\n\n protected installHint(): string {\n return \"Gemini CLI is not installed or not on your PATH. Install it with `npm i -g @google/gemini-cli` (≥ v0.6.1).\";\n }\n\n protected override classifyExit(code: number | null, signal: NodeJS.Signals | null) {\n if (code === 42) {\n return {\n message: \"Gemini CLI reported an input error (exit 42)\",\n category: \"validation\" as const,\n retryable: false,\n hint: \"The prompt or flags were rejected by Gemini CLI. Check the model name and arguments.\",\n };\n }\n if (code === 53) return null; // turn-limit — the result was already emitted.\n return super.classifyExit(code, signal);\n }\n\n /**\n * Discovery runs against the bound entry: its credential and, for a\n * non-default endpoint, its base URL. Without an entry the ambient\n * `GEMINI_API_KEY` is the last resort, and an unreachable API falls back to\n * the static Google catalog.\n */\n override async listModels(): Promise<ModelEntry[]> {\n const session = this.providerSession();\n const binding = resolveRegistryBinding(session);\n const key = binding\n ? entryCredentialValue(binding.providerId, binding.entry, { env: session.lookupEnv })\n : session.lookupEnv.GEMINI_API_KEY;\n if (!key) return getStaticModels(\"google\");\n const result = await fetchProviderModels(\n \"google\",\n key,\n binding?.baseUrl && binding.baseUrl !== GOOGLE_DEFAULT_BASE_URL\n ? { baseUrl: binding.baseUrl }\n : {},\n );\n return result.ok && result.models.length > 0 ? result.models : getStaticModels(\"google\");\n }\n}\n\n/**\n * `DriverTarget` wrapper for the gemini driver. Registered into the plugin\n * registry by `registerBuiltinDrivers()`.\n */\nexport const geminiDriverTarget: DriverTarget<AgentConfig> = {\n id: \"gemini\",\n displayName: BUILTIN_DRIVER_CATALOG.gemini?.name ?? \"Gemini CLI\",\n apiVersion: 1,\n configSchema: z.custom<AgentConfig>(() => true),\n create: async (config, _ctx) => new GeminiDriver(config),\n listModels: async (registry, options) =>\n new GeminiDriver({\n cwd: process.cwd(),\n sessionId: \"model-list\",\n ...registryDriverConfig(registry, options),\n }).listModels(),\n};\n"]}
@@ -1,4 +1,4 @@
1
- import { createLogger } from './chunk-W4IPN3DD.js';
1
+ import { createLogger } from './chunk-BOFL7GIF.js';
2
2
  import { readFileSync } from 'fs';
3
3
  import { dirname, join } from 'path';
4
4
  import { readFile, mkdir, writeFile } from 'fs/promises';
@@ -298,5 +298,5 @@ function resolveProjectDir(additionalEnvVars) {
298
298
  }
299
299
 
300
300
  export { PluginStore, WorkspacePlugin, buildClaudePluginFiles, resolveProjectDir };
301
- //# sourceMappingURL=chunk-7SNYWCQS.js.map
302
- //# sourceMappingURL=chunk-7SNYWCQS.js.map
301
+ //# sourceMappingURL=chunk-TVQPJZSO.js.map
302
+ //# sourceMappingURL=chunk-TVQPJZSO.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../workspace-plugin/src/adapters/claude-code.ts","../workspace-plugin/src/store.ts","../workspace-plugin/src/plugin.ts","../workspace-plugin/src/utils/project-dir.ts"],"names":["err"],"mappings":";;;;;;AAeA,IAAM,WAAA,GAAc;AAAA,EAClB,IAAA,EAAM,QAAA;AAAA,EACN,OAAA,EAAS,OAAA;AAAA,EACT,WAAA,EAAa,yEAAA;AAAA,EACb,MAAA,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EAAI;AACrB","file":"chunk-7SNYWCQS.js","sourcesContent":["// ── Claude Code plugin-directory generator (STATELESS) ──────────────────────\n// Generates the contents of a Claude Code plugin directory\n// (`.claude/plugins/skaile/`) as an in-memory file map. No plugin instance or\n// boot() is required — safe to call from install commands.\n//\n// The previous standalone `@skaile/workspace-plugin-claude` package shipped\n// these as static files plus loose `.mjs` hook scripts; they are now\n// CLI-owned templates. Hooks invoke the `skaile` binary directly\n// (`skaile plugin hook <event>`) and MCP runs via `skaile mcp-server` — no\n// generated script files, no shebang, no runtime assumption.\n\n/**\n * The Claude Code plugin manifest. `name` is `skaile`; `hooks` and\n * `mcpServers` point at sibling files in the generated directory.\n */\nconst PLUGIN_JSON = {\n name: \"skaile\",\n version: \"0.1.0\",\n description: \"Skaile workspace — connectors, mounts, skills, flows, shared state\",\n author: { name: \"skaile-ai\", url: \"https://github.com/skaile-ai\" },\n repository: \"https://github.com/skaile-ai/workspaces\",\n keywords: [\"skaile\", \"connectors\", \"workspace\", \"ai-assets\"],\n hooks: \"./hooks/hooks.json\",\n mcpServers: \"./.mcp.json\",\n userConfig: {\n skaile_yaml_path: {\n type: \"string\",\n title: \"skaile.yaml path\",\n description: \"Override path to skaile.yaml (default: auto-detect from project root)\",\n },\n },\n};\n\n/**\n * Hook wiring. Each lifecycle event invokes the `skaile` binary directly —\n * no loose `.mjs` scripts. `skaile plugin hook <event>` resolves the project\n * directory itself (`CLAUDE_PROJECT_DIR` / cwd) and always exits 0.\n */\nconst HOOKS_JSON = {\n hooks: {\n SessionStart: [{ hooks: [{ type: \"command\", command: \"skaile plugin hook session-start\" }] }],\n SessionEnd: [{ hooks: [{ type: \"command\", command: \"skaile plugin hook session-end\" }] }],\n UserPromptSubmit: [\n { hooks: [{ type: \"command\", command: \"skaile plugin hook user-prompt-submit\" }] },\n ],\n },\n};\n\n/**\n * MCP server wiring. Spawns `skaile mcp-server` — a stdio MCP subprocess that\n * runs on plain Node (no Claude Agent SDK).\n */\nconst MCP_JSON = {\n mcpServers: {\n \"skaile-workspace\": {\n command: \"skaile\",\n args: [\"mcp-server\"],\n env: {},\n },\n },\n};\n\n/**\n * Build the Claude Code plugin directory as an in-memory file map.\n *\n * Returns `{ relativePath: contents }` for every file the installer must\n * write under `<projectDir>/.claude/plugins/skaile/`. The installer is also\n * responsible for populating `skills/` from the project's `.skaile/skills/`.\n *\n * Stateless — no plugin instance, no `boot()`. The generated artifacts carry\n * no project-specific paths: hooks and the MCP server resolve the project\n * directory themselves at runtime.\n *\n * @returns A map of plugin-relative file paths to their string contents.\n *\n * @docLink packages/workspace-plugin/concepts#adapters\n */\nexport function buildClaudePluginFiles(): Record<string, string> {\n return {\n \".claude-plugin/plugin.json\": `${JSON.stringify(PLUGIN_JSON, null, 2)}\\n`,\n \"hooks/hooks.json\": `${JSON.stringify(HOOKS_JSON, null, 2)}\\n`,\n \".mcp.json\": `${JSON.stringify(MCP_JSON, null, 2)}\\n`,\n \"skills/.gitkeep\": \"\",\n };\n}\n","import { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\n\ninterface Subscriber {\n regex: RegExp;\n handler: (key: string, value: unknown) => void;\n}\n\n/**\n * Disk-backed reactive key-value store for plugin state.\n *\n * Keeps an in-memory map that can be flushed to / loaded from a JSON file.\n * Supports glob-style subscriptions (`connector:*`, `*`).\n *\n * State is persisted to `<projectDir>/.skaile/plugin-state.json`.\n * The instance is available on {@link WorkspacePlugin} as the public `store`\n * field after `boot()` resolves.\n *\n * @docLink packages/workspace-plugin/concepts#plugin-store\n */\nexport class PluginStore {\n private readonly statePath: string;\n private data: Map<string, unknown> = new Map();\n private subscribers: Subscriber[] = [];\n\n constructor(statePath: string) {\n this.statePath = statePath;\n }\n\n /** Synchronous read from in-memory map. */\n get<T>(key: string): T | undefined {\n return this.data.get(key) as T | undefined;\n }\n\n /** Write to in-memory map and notify matching subscribers. */\n set<T>(key: string, value: T): void {\n this.data.set(key, value);\n this.notify(key, value);\n }\n\n /** Remove key and notify matching subscribers. */\n delete(key: string): void {\n this.data.delete(key);\n this.notify(key, undefined);\n }\n\n /**\n * Subscribe to changes matching a glob-style pattern.\n * `*` matches any sequence of characters.\n * Returns an unsubscribe function.\n */\n subscribe(pattern: string, handler: (key: string, value: unknown) => void): () => void {\n const escaped = pattern.replace(/[.+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const regexStr = `^${escaped.replace(/\\*/g, \".*\")}$`;\n const sub: Subscriber = { regex: new RegExp(regexStr), handler };\n this.subscribers.push(sub);\n\n return () => {\n const idx = this.subscribers.indexOf(sub);\n if (idx !== -1) this.subscribers.splice(idx, 1);\n };\n }\n\n /** Rehydrate from disk JSON. Missing file = empty store (no throw). */\n async load(): Promise<void> {\n try {\n const raw = await readFile(this.statePath, \"utf-8\");\n const parsed = JSON.parse(raw);\n if (parsed && typeof parsed === \"object\" && !Array.isArray(parsed)) {\n this.data = new Map(Object.entries(parsed));\n }\n } catch (e: unknown) {\n // Missing file or invalid JSON — start with empty store\n }\n }\n\n /** Write entire store to disk as JSON. Creates parent dirs if needed. */\n async flush(): Promise<void> {\n const obj = Object.fromEntries(this.data);\n const json = JSON.stringify(obj, null, 2);\n await mkdir(dirname(this.statePath), { recursive: true });\n await writeFile(this.statePath, json, \"utf-8\");\n }\n\n private notify(key: string, value: unknown): void {\n for (const sub of this.subscribers) {\n if (sub.regex.test(key)) {\n sub.handler(key, value);\n }\n }\n }\n}\n","import { readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { ConnectorManager } from \"@skaile/workspaces/connectors\";\nimport { createLogger } from \"@skaile/workspaces/core/logging\";\nimport type { Logger } from \"@skaile/workspaces/types\";\nimport { PluginStore } from \"./store.js\";\n\n/**\n * Construction options for {@link WorkspacePlugin}.\n *\n * At minimum `projectDir` must be supplied. All other fields are optional\n * and are pre-resolved by the caller when available (e.g. the runner already\n * knows `driver`/`model` from its own settings resolution).\n *\n * @docLink packages/workspace-plugin/concepts#workspaceplugin-lifecycle\n */\nexport interface WorkspacePluginOpts {\n projectDir: string;\n /**\n * Active connector manager. The unified `ConnectorManager` owns both\n * filesystem-face (mountable) and tool-face connectors.\n */\n connectorManager?: ConnectorManager;\n bootOwned?: boolean;\n onLog?: (msg: string) => void;\n /** Pre-resolved driver type (avoids needing boot() to read settings). */\n driver?: string;\n /** Pre-resolved model. */\n model?: string;\n}\n\n/**\n * Shared runtime core for the skaile workspace plugin.\n *\n * Manages the full lifecycle (`boot` → tools available → `shutdown`) and\n * surfaces workspace capabilities — mounts, connectors, flows, skills,\n * sessions, and config validation — through two adapter backends:\n *\n * - **MCP, in-process** (runner): call {@link buildWorkspaceMcpServer} for the\n * Claude Agent SDK server the runner embeds into its `query()` call.\n * - **MCP, stdio** (`skaile mcp-server`): call {@link runMcpServerStdio} for a\n * raw `@modelcontextprotocol/sdk` server — no Claude Agent SDK.\n * - **OMP**: call {@link buildOmpToolSet} for the 13-tool native subset and\n * {@link buildOmpExtensionSource} for the generated extension file.\n *\n * Two boot modes are supported via {@link WorkspacePluginOpts.bootOwned}:\n * - `bootOwned: false` (default) — managers injected externally by the runner.\n * - `bootOwned: true` — plugin owns the full manager lifecycle (standalone MCP\n * subprocess or OMP extension).\n *\n * @docLink packages/workspace-plugin/concepts#workspaceplugin-lifecycle\n */\nexport class WorkspacePlugin {\n readonly projectDir: string;\n connectorManager: ConnectorManager | null;\n readonly store: PluginStore;\n\n private readonly bootOwned: boolean;\n private readonly onLog: (msg: string) => void;\n private readonly log: Logger = createLogger({\n kind: \"mcp\",\n subkind: \"skaile-workspace\",\n });\n driver?: string;\n model?: string;\n\n constructor(opts: WorkspacePluginOpts) {\n this.projectDir = opts.projectDir;\n this.connectorManager = opts.connectorManager ?? null;\n this.store = new PluginStore(join(opts.projectDir, \".skaile\", \"plugin-state.json\"));\n this.bootOwned = opts.bootOwned ?? false;\n if (opts.driver) this.driver = opts.driver;\n if (opts.model) this.model = opts.model;\n this.onLog = opts.onLog ?? (() => {});\n this.log.debug(\"plugin constructed\", {\n driver: opts.driver,\n hasConnectors: !!opts.connectorManager,\n model: opts.model,\n bootOwned: this.bootOwned,\n });\n }\n\n async boot(): Promise<void> {\n if (!this.bootOwned) {\n // Managers were injected externally — resolve settings only (non-fatal)\n try {\n const { resolveSettings } = await import(\"@skaile/workspaces/core\");\n const settings = await resolveSettings(this.projectDir);\n this.driver = settings.driver ?? \"omp\";\n this.model = settings.model;\n } catch {\n /* non-fatal */\n }\n await this.store.load();\n return;\n }\n\n // bootOwned: we own the managers lifecycle\n try {\n const { resolveSettings } = await import(\"@skaile/workspaces/core\");\n const settings = await resolveSettings(this.projectDir);\n this.driver = settings.driver ?? \"omp\";\n this.model = settings.model;\n } catch {\n /* non-fatal */\n }\n\n try {\n const {\n ConnectorManager,\n loadConnectorDeclarations,\n registerBuiltinConnectors,\n createCliSecretProviderChain,\n } = await import(\"@skaile/workspaces/connectors\");\n\n registerBuiltinConnectors();\n\n const secrets = createCliSecretProviderChain();\n\n const connectorDecls = await loadConnectorDeclarations(this.projectDir);\n const cm = new ConnectorManager(this.projectDir, { secrets });\n await cm.connectAll(connectorDecls);\n this.connectorManager = cm;\n\n this.log.info(\"workspace plugin booted\", {\n connectors: connectorDecls.length,\n });\n this.onLog(`WorkspacePlugin booted: ${connectorDecls.length} connectors`);\n } catch (err) {\n this.log.warn(\"workspace plugin boot warning\", {\n error: err instanceof Error ? err.message : String(err),\n });\n this.onLog(`WorkspacePlugin boot warning: ${err}`);\n }\n\n await this.store.load();\n }\n\n async reload(): Promise<void> {\n if (!this.bootOwned) return;\n await this.shutdown();\n await this.boot();\n }\n\n async shutdown(): Promise<void> {\n this.log.info(\"workspace plugin shutdown\");\n await this.store.flush();\n if (!this.bootOwned) return;\n try {\n await (this.connectorManager as any)?.disconnectAll?.();\n } catch {\n /* best-effort */\n }\n this.connectorManager = null;\n }\n\n buildSystemPromptSection(driver?: string): string {\n const d = driver ?? this.driver ?? \"unknown\";\n // The unified ConnectorManager owns both mountable (filesystem-face) and\n // tool-face connectors. Filesystem-face connectors expose a `mountPath`.\n const all = (this.connectorManager as any)?.listConnectors?.() ?? [];\n const mounts = (all as any[]).filter((c) => typeof c.mountPath === \"string\");\n const connectors = (all as any[]).filter((c) => typeof c.mountPath !== \"string\");\n const lines = [\"## Workspace (skaile)\", \"\", `Driver: ${d}`, `Project: ${this.projectDir}`];\n if (mounts.length > 0) {\n lines.push(\"\", \"Mounts:\");\n for (const v of mounts) {\n lines.push(` · ${v.id} (${v.driver}) → ${v.mountPath ?? \"(unmounted)\"}`);\n }\n }\n if (connectors.length > 0) {\n lines.push(\"\", \"Connectors:\");\n for (const c of connectors) {\n lines.push(` · ${c.id} (${c.driver})`);\n }\n }\n lines.push(\"\", \"Use workspace_info for full details. Use workspace_validate to check health.\");\n\n for (const name of [\"SOUL.md\", \"RULES.md\"]) {\n const skaileOverride = join(this.projectDir, \".skaile\", name);\n const rootFile = join(this.projectDir, name);\n for (const candidate of [skaileOverride, rootFile]) {\n try {\n const content = readFileSync(candidate, \"utf-8\").trim();\n if (content) {\n lines.push(\"\", `## ${name.replace(\".md\", \"\")}`, \"\", content);\n break;\n }\n } catch {\n // file not found, try next\n }\n }\n }\n\n return lines.join(\"\\n\");\n }\n\n /**\n * Build the in-process Claude Agent SDK MCP server (runner embedding).\n * Returns `null` when `@anthropic-ai/claude-agent-sdk` is unavailable.\n */\n async buildWorkspaceMcpServer(): Promise<unknown | null> {\n this.log.info(\"building workspace MCP server\");\n try {\n const { buildWorkspaceMcpServer } = await import(\"./adapters/mcp.js\");\n const server = await buildWorkspaceMcpServer(this);\n if (server) this.log.info(\"workspace MCP server ready\");\n else this.log.debug(\"workspace MCP server skipped (no tools)\");\n return server;\n } catch (err) {\n this.log.error(\"workspace MCP server build failed\", err);\n throw err;\n }\n }\n\n /**\n * Build the raw `@modelcontextprotocol/sdk` stdio MCP server — no Claude\n * Agent SDK. Used by the `skaile mcp-server` subprocess. The returned\n * server is not yet connected to a transport.\n */\n async buildWorkspaceMcpStdioServer(): Promise<unknown> {\n this.log.info(\"building workspace stdio MCP server\");\n const { buildWorkspaceMcpStdioServer } = await import(\"./adapters/mcp.js\");\n return buildWorkspaceMcpStdioServer(this);\n }\n\n /**\n * Build and run the stdio MCP server: builds the raw\n * `@modelcontextprotocol/sdk` server and connects a `StdioServerTransport`.\n * Used by the `skaile mcp-server` subprocess.\n */\n async runMcpServerStdio(): Promise<void> {\n this.log.info(\"starting workspace stdio MCP server\");\n const { runMcpServerStdio } = await import(\"./adapters/mcp.js\");\n await runMcpServerStdio(this);\n }\n\n async buildOmpToolSet(): Promise<unknown[]> {\n const { buildOmpToolSet } = await import(\"./adapters/omp.js\");\n return buildOmpToolSet(this);\n }\n\n async buildOmpExtensionSource(): Promise<string> {\n const { buildOmpExtensionSource } = await import(\"./adapters/omp.js\");\n return buildOmpExtensionSource(this.projectDir);\n }\n\n async handleSlashCommand(group: string, args: string[]): Promise<string> {\n const { handleSlashCommand } = await import(\"./adapters/omp.js\");\n return handleSlashCommand(this, group, args);\n }\n}\n","// utils/project-dir.ts\n// Centralised project-directory resolution used by all plugin entry points.\n\n/**\n * Resolve the skaile project directory from environment variables.\n *\n * Resolution order:\n * 1. `SKAILE_PROJECT_DIR` (always checked first)\n * 2. Any additional env var keys supplied by the caller (in order)\n * 3. `process.cwd()` as final fallback\n *\n * @param additionalEnvVars - Optional list of extra environment variable names\n * to check before falling back to `process.cwd()`.\n * @returns Absolute path to the resolved project directory.\n *\n * @example\n * // Claude Code — also checks CLAUDE_PROJECT_DIR\n * const projectDir = resolveProjectDir([\"CLAUDE_PROJECT_DIR\"]);\n *\n * // OMP / standalone — SKAILE_PROJECT_DIR or cwd only\n * const projectDir = resolveProjectDir();\n *\n * @docLink packages/workspace-plugin/concepts#workspaceplugin-lifecycle\n */\nexport function resolveProjectDir(additionalEnvVars?: string[]): string {\n if (process.env.SKAILE_PROJECT_DIR) return process.env.SKAILE_PROJECT_DIR;\n for (const key of additionalEnvVars ?? []) {\n const val = process.env[key];\n if (val) return val;\n }\n return process.cwd();\n}\n"]}
1
+ {"version":3,"sources":["../workspace-plugin/src/adapters/claude-code.ts","../workspace-plugin/src/store.ts","../workspace-plugin/src/plugin.ts","../workspace-plugin/src/utils/project-dir.ts"],"names":["err"],"mappings":";;;;;;AAeA,IAAM,WAAA,GAAc;AAAA,EAClB,IAAA,EAAM,QAAA;AAAA,EACN,OAAA,EAAS,OAAA;AAAA,EACT,WAAA,EAAa,yEAAA;AAAA,EACb,MAAA,EAAQ,EAAE,IAAA,EAAM,WAAA,EAAa,KAAK,8BAAA,EAA+B;AAAA,EACjE,UAAA,EAAY,yCAAA;AAAA,EACZ,QAAA,EAAU,CAAC,QAAA,EAAU,YAAA,EAAc,aAAa,WAAW,CAAA;AAAA,EAC3D,KAAA,EAAO,oBAAA;AAAA,EACP,UAAA,EAAY,aAAA;AAAA,EACZ,UAAA,EAAY;AAAA,IACV,gBAAA,EAAkB;AAAA,MAChB,IAAA,EAAM,QAAA;AAAA,MACN,KAAA,EAAO,kBAAA;AAAA,MACP,WAAA,EAAa;AAAA;AACf;AAEJ,CAAA;AAOA,IAAM,UAAA,GAAa;AAAA,EACjB,KAAA,EAAO;AAAA,IACL,YAAA,EAAc,CAAC,EAAE,KAAA,EAAO,CAAC,EAAE,IAAA,EAAM,SAAA,EAAW,OAAA,EAAS,kCAAA,EAAoC,CAAA,EAAG,CAAA;AAAA,IAC5F,UAAA,EAAY,CAAC,EAAE,KAAA,EAAO,CAAC,EAAE,IAAA,EAAM,SAAA,EAAW,OAAA,EAAS,gCAAA,EAAkC,CAAA,EAAG,CAAA;AAAA,IACxF,gBAAA,EAAkB;AAAA,MAChB,EAAE,OAAO,CAAC,EAAE,MAAM,SAAA,EAAW,OAAA,EAAS,uCAAA,EAAyC,CAAA;AAAE;AACnF;AAEJ,CAAA;AAMA,IAAM,QAAA,GAAW;AAAA,EACf,UAAA,EAAY;AAAA,IACV,kBAAA,EAAoB;AAAA,MAClB,OAAA,EAAS,QAAA;AAAA,MACT,IAAA,EAA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AAI,OAAA,CAAQ,GAAA,CAAI,kBAAA,EAAoB,OAAO,QAAQ,GAAA,CAAI,kBAAA;AACvD,EAAA,KAAA,MAAW,GAAA,IAAO,iBAAA,IAAqB,EAAC,EAAG;AACzC,IAAA,MAAM,GAAA,GAAM,OAAA,CAAQ,GAAA,CAAI,GAAG,CAAA;AAC3B,IAAA,IAAI,KAAK,OAAO,GAAA;AAAA,EAClB;AACA,EAAA,OAAO,QAAQ,GAAA,EAAI;AACrB","file":"chunk-TVQPJZSO.js","sourcesContent":["// ── Claude Code plugin-directory generator (STATELESS) ──────────────────────\n// Generates the contents of a Claude Code plugin directory\n// (`.claude/plugins/skaile/`) as an in-memory file map. No plugin instance or\n// boot() is required — safe to call from install commands.\n//\n// The previous standalone `@skaile/workspace-plugin-claude` package shipped\n// these as static files plus loose `.mjs` hook scripts; they are now\n// CLI-owned templates. Hooks invoke the `skaile` binary directly\n// (`skaile plugin hook <event>`) and MCP runs via `skaile mcp-server` — no\n// generated script files, no shebang, no runtime assumption.\n\n/**\n * The Claude Code plugin manifest. `name` is `skaile`; `hooks` and\n * `mcpServers` point at sibling files in the generated directory.\n */\nconst PLUGIN_JSON = {\n name: \"skaile\",\n version: \"0.1.0\",\n description: \"Skaile workspace — connectors, mounts, skills, flows, shared state\",\n author: { name: \"skaile-ai\", url: \"https://github.com/skaile-ai\" },\n repository: \"https://github.com/skaile-ai/workspaces\",\n keywords: [\"skaile\", \"connectors\", \"workspace\", \"ai-assets\"],\n hooks: \"./hooks/hooks.json\",\n mcpServers: \"./.mcp.json\",\n userConfig: {\n skaile_yaml_path: {\n type: \"string\",\n title: \"skaile.yaml path\",\n description: \"Override path to skaile.yaml (default: auto-detect from project root)\",\n },\n },\n};\n\n/**\n * Hook wiring. Each lifecycle event invokes the `skaile` binary directly —\n * no loose `.mjs` scripts. `skaile plugin hook <event>` resolves the project\n * directory itself (`CLAUDE_PROJECT_DIR` / cwd) and always exits 0.\n */\nconst HOOKS_JSON = {\n hooks: {\n SessionStart: [{ hooks: [{ type: \"command\", command: \"skaile plugin hook session-start\" }] }],\n SessionEnd: [{ hooks: [{ type: \"command\", command: \"skaile plugin hook session-end\" }] }],\n UserPromptSubmit: [\n { hooks: [{ type: \"command\", command: \"skaile plugin hook user-prompt-submit\" }] },\n ],\n },\n};\n\n/**\n * MCP server wiring. Spawns `skaile mcp-server` — a stdio MCP subprocess that\n * runs on plain Node (no Claude Agent SDK).\n */\nconst MCP_JSON = {\n mcpServers: {\n \"skaile-workspace\": {\n command: \"skaile\",\n args: [\"mcp-server\"],\n env: {},\n },\n },\n};\n\n/**\n * Build the Claude Code plugin directory as an in-memory file map.\n *\n * Returns `{ relativePath: contents }` for every file the installer must\n * write under `<projectDir>/.claude/plugins/skaile/`. The installer is also\n * responsible for populating `skills/` from the project's `.skaile/skills/`.\n *\n * Stateless — no plugin instance, no `boot()`. The generated artifacts carry\n * no project-specific paths: hooks and the MCP server resolve the project\n * directory themselves at runtime.\n *\n * @returns A map of plugin-relative file paths to their string contents.\n *\n * @docLink packages/workspace-plugin/concepts#adapters\n */\nexport function buildClaudePluginFiles(): Record<string, string> {\n return {\n \".claude-plugin/plugin.json\": `${JSON.stringify(PLUGIN_JSON, null, 2)}\\n`,\n \"hooks/hooks.json\": `${JSON.stringify(HOOKS_JSON, null, 2)}\\n`,\n \".mcp.json\": `${JSON.stringify(MCP_JSON, null, 2)}\\n`,\n \"skills/.gitkeep\": \"\",\n };\n}\n","import { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\n\ninterface Subscriber {\n regex: RegExp;\n handler: (key: string, value: unknown) => void;\n}\n\n/**\n * Disk-backed reactive key-value store for plugin state.\n *\n * Keeps an in-memory map that can be flushed to / loaded from a JSON file.\n * Supports glob-style subscriptions (`connector:*`, `*`).\n *\n * State is persisted to `<projectDir>/.skaile/plugin-state.json`.\n * The instance is available on {@link WorkspacePlugin} as the public `store`\n * field after `boot()` resolves.\n *\n * @docLink packages/workspace-plugin/concepts#plugin-store\n */\nexport class PluginStore {\n private readonly statePath: string;\n private data: Map<string, unknown> = new Map();\n private subscribers: Subscriber[] = [];\n\n constructor(statePath: string) {\n this.statePath = statePath;\n }\n\n /** Synchronous read from in-memory map. */\n get<T>(key: string): T | undefined {\n return this.data.get(key) as T | undefined;\n }\n\n /** Write to in-memory map and notify matching subscribers. */\n set<T>(key: string, value: T): void {\n this.data.set(key, value);\n this.notify(key, value);\n }\n\n /** Remove key and notify matching subscribers. */\n delete(key: string): void {\n this.data.delete(key);\n this.notify(key, undefined);\n }\n\n /**\n * Subscribe to changes matching a glob-style pattern.\n * `*` matches any sequence of characters.\n * Returns an unsubscribe function.\n */\n subscribe(pattern: string, handler: (key: string, value: unknown) => void): () => void {\n const escaped = pattern.replace(/[.+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const regexStr = `^${escaped.replace(/\\*/g, \".*\")}$`;\n const sub: Subscriber = { regex: new RegExp(regexStr), handler };\n this.subscribers.push(sub);\n\n return () => {\n const idx = this.subscribers.indexOf(sub);\n if (idx !== -1) this.subscribers.splice(idx, 1);\n };\n }\n\n /** Rehydrate from disk JSON. Missing file = empty store (no throw). */\n async load(): Promise<void> {\n try {\n const raw = await readFile(this.statePath, \"utf-8\");\n const parsed = JSON.parse(raw);\n if (parsed && typeof parsed === \"object\" && !Array.isArray(parsed)) {\n this.data = new Map(Object.entries(parsed));\n }\n } catch (e: unknown) {\n // Missing file or invalid JSON — start with empty store\n }\n }\n\n /** Write entire store to disk as JSON. Creates parent dirs if needed. */\n async flush(): Promise<void> {\n const obj = Object.fromEntries(this.data);\n const json = JSON.stringify(obj, null, 2);\n await mkdir(dirname(this.statePath), { recursive: true });\n await writeFile(this.statePath, json, \"utf-8\");\n }\n\n private notify(key: string, value: unknown): void {\n for (const sub of this.subscribers) {\n if (sub.regex.test(key)) {\n sub.handler(key, value);\n }\n }\n }\n}\n","import { readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { ConnectorManager } from \"@skaile/workspaces/connectors\";\nimport { createLogger } from \"@skaile/workspaces/core/logging\";\nimport type { Logger } from \"@skaile/workspaces/types\";\nimport { PluginStore } from \"./store.js\";\n\n/**\n * Construction options for {@link WorkspacePlugin}.\n *\n * At minimum `projectDir` must be supplied. All other fields are optional\n * and are pre-resolved by the caller when available (e.g. the runner already\n * knows `driver`/`model` from its own settings resolution).\n *\n * @docLink packages/workspace-plugin/concepts#workspaceplugin-lifecycle\n */\nexport interface WorkspacePluginOpts {\n projectDir: string;\n /**\n * Active connector manager. The unified `ConnectorManager` owns both\n * filesystem-face (mountable) and tool-face connectors.\n */\n connectorManager?: ConnectorManager;\n bootOwned?: boolean;\n onLog?: (msg: string) => void;\n /** Pre-resolved driver type (avoids needing boot() to read settings). */\n driver?: string;\n /** Pre-resolved model. */\n model?: string;\n}\n\n/**\n * Shared runtime core for the skaile workspace plugin.\n *\n * Manages the full lifecycle (`boot` → tools available → `shutdown`) and\n * surfaces workspace capabilities — mounts, connectors, flows, skills,\n * sessions, and config validation — through two adapter backends:\n *\n * - **MCP, in-process** (runner): call {@link buildWorkspaceMcpServer} for the\n * Claude Agent SDK server the runner embeds into its `query()` call.\n * - **MCP, stdio** (`skaile mcp-server`): call {@link runMcpServerStdio} for a\n * raw `@modelcontextprotocol/sdk` server — no Claude Agent SDK.\n * - **OMP**: call {@link buildOmpToolSet} for the 13-tool native subset and\n * {@link buildOmpExtensionSource} for the generated extension file.\n *\n * Two boot modes are supported via {@link WorkspacePluginOpts.bootOwned}:\n * - `bootOwned: false` (default) — managers injected externally by the runner.\n * - `bootOwned: true` — plugin owns the full manager lifecycle (standalone MCP\n * subprocess or OMP extension).\n *\n * @docLink packages/workspace-plugin/concepts#workspaceplugin-lifecycle\n */\nexport class WorkspacePlugin {\n readonly projectDir: string;\n connectorManager: ConnectorManager | null;\n readonly store: PluginStore;\n\n private readonly bootOwned: boolean;\n private readonly onLog: (msg: string) => void;\n private readonly log: Logger = createLogger({\n kind: \"mcp\",\n subkind: \"skaile-workspace\",\n });\n driver?: string;\n model?: string;\n\n constructor(opts: WorkspacePluginOpts) {\n this.projectDir = opts.projectDir;\n this.connectorManager = opts.connectorManager ?? null;\n this.store = new PluginStore(join(opts.projectDir, \".skaile\", \"plugin-state.json\"));\n this.bootOwned = opts.bootOwned ?? false;\n if (opts.driver) this.driver = opts.driver;\n if (opts.model) this.model = opts.model;\n this.onLog = opts.onLog ?? (() => {});\n this.log.debug(\"plugin constructed\", {\n driver: opts.driver,\n hasConnectors: !!opts.connectorManager,\n model: opts.model,\n bootOwned: this.bootOwned,\n });\n }\n\n async boot(): Promise<void> {\n if (!this.bootOwned) {\n // Managers were injected externally — resolve settings only (non-fatal)\n try {\n const { resolveSettings } = await import(\"@skaile/workspaces/core\");\n const settings = await resolveSettings(this.projectDir);\n this.driver = settings.driver ?? \"omp\";\n this.model = settings.model;\n } catch {\n /* non-fatal */\n }\n await this.store.load();\n return;\n }\n\n // bootOwned: we own the managers lifecycle\n try {\n const { resolveSettings } = await import(\"@skaile/workspaces/core\");\n const settings = await resolveSettings(this.projectDir);\n this.driver = settings.driver ?? \"omp\";\n this.model = settings.model;\n } catch {\n /* non-fatal */\n }\n\n try {\n const {\n ConnectorManager,\n loadConnectorDeclarations,\n registerBuiltinConnectors,\n createCliSecretProviderChain,\n } = await import(\"@skaile/workspaces/connectors\");\n\n registerBuiltinConnectors();\n\n const secrets = createCliSecretProviderChain();\n\n const connectorDecls = await loadConnectorDeclarations(this.projectDir);\n const cm = new ConnectorManager(this.projectDir, { secrets });\n await cm.connectAll(connectorDecls);\n this.connectorManager = cm;\n\n this.log.info(\"workspace plugin booted\", {\n connectors: connectorDecls.length,\n });\n this.onLog(`WorkspacePlugin booted: ${connectorDecls.length} connectors`);\n } catch (err) {\n this.log.warn(\"workspace plugin boot warning\", {\n error: err instanceof Error ? err.message : String(err),\n });\n this.onLog(`WorkspacePlugin boot warning: ${err}`);\n }\n\n await this.store.load();\n }\n\n async reload(): Promise<void> {\n if (!this.bootOwned) return;\n await this.shutdown();\n await this.boot();\n }\n\n async shutdown(): Promise<void> {\n this.log.info(\"workspace plugin shutdown\");\n await this.store.flush();\n if (!this.bootOwned) return;\n try {\n await (this.connectorManager as any)?.disconnectAll?.();\n } catch {\n /* best-effort */\n }\n this.connectorManager = null;\n }\n\n buildSystemPromptSection(driver?: string): string {\n const d = driver ?? this.driver ?? \"unknown\";\n // The unified ConnectorManager owns both mountable (filesystem-face) and\n // tool-face connectors. Filesystem-face connectors expose a `mountPath`.\n const all = (this.connectorManager as any)?.listConnectors?.() ?? [];\n const mounts = (all as any[]).filter((c) => typeof c.mountPath === \"string\");\n const connectors = (all as any[]).filter((c) => typeof c.mountPath !== \"string\");\n const lines = [\"## Workspace (skaile)\", \"\", `Driver: ${d}`, `Project: ${this.projectDir}`];\n if (mounts.length > 0) {\n lines.push(\"\", \"Mounts:\");\n for (const v of mounts) {\n lines.push(` · ${v.id} (${v.driver}) → ${v.mountPath ?? \"(unmounted)\"}`);\n }\n }\n if (connectors.length > 0) {\n lines.push(\"\", \"Connectors:\");\n for (const c of connectors) {\n lines.push(` · ${c.id} (${c.driver})`);\n }\n }\n lines.push(\"\", \"Use workspace_info for full details. Use workspace_validate to check health.\");\n\n for (const name of [\"SOUL.md\", \"RULES.md\"]) {\n const skaileOverride = join(this.projectDir, \".skaile\", name);\n const rootFile = join(this.projectDir, name);\n for (const candidate of [skaileOverride, rootFile]) {\n try {\n const content = readFileSync(candidate, \"utf-8\").trim();\n if (content) {\n lines.push(\"\", `## ${name.replace(\".md\", \"\")}`, \"\", content);\n break;\n }\n } catch {\n // file not found, try next\n }\n }\n }\n\n return lines.join(\"\\n\");\n }\n\n /**\n * Build the in-process Claude Agent SDK MCP server (runner embedding).\n * Returns `null` when `@anthropic-ai/claude-agent-sdk` is unavailable.\n */\n async buildWorkspaceMcpServer(): Promise<unknown | null> {\n this.log.info(\"building workspace MCP server\");\n try {\n const { buildWorkspaceMcpServer } = await import(\"./adapters/mcp.js\");\n const server = await buildWorkspaceMcpServer(this);\n if (server) this.log.info(\"workspace MCP server ready\");\n else this.log.debug(\"workspace MCP server skipped (no tools)\");\n return server;\n } catch (err) {\n this.log.error(\"workspace MCP server build failed\", err);\n throw err;\n }\n }\n\n /**\n * Build the raw `@modelcontextprotocol/sdk` stdio MCP server — no Claude\n * Agent SDK. Used by the `skaile mcp-server` subprocess. The returned\n * server is not yet connected to a transport.\n */\n async buildWorkspaceMcpStdioServer(): Promise<unknown> {\n this.log.info(\"building workspace stdio MCP server\");\n const { buildWorkspaceMcpStdioServer } = await import(\"./adapters/mcp.js\");\n return buildWorkspaceMcpStdioServer(this);\n }\n\n /**\n * Build and run the stdio MCP server: builds the raw\n * `@modelcontextprotocol/sdk` server and connects a `StdioServerTransport`.\n * Used by the `skaile mcp-server` subprocess.\n */\n async runMcpServerStdio(): Promise<void> {\n this.log.info(\"starting workspace stdio MCP server\");\n const { runMcpServerStdio } = await import(\"./adapters/mcp.js\");\n await runMcpServerStdio(this);\n }\n\n async buildOmpToolSet(): Promise<unknown[]> {\n const { buildOmpToolSet } = await import(\"./adapters/omp.js\");\n return buildOmpToolSet(this);\n }\n\n async buildOmpExtensionSource(): Promise<string> {\n const { buildOmpExtensionSource } = await import(\"./adapters/omp.js\");\n return buildOmpExtensionSource(this.projectDir);\n }\n\n async handleSlashCommand(group: string, args: string[]): Promise<string> {\n const { handleSlashCommand } = await import(\"./adapters/omp.js\");\n return handleSlashCommand(this, group, args);\n }\n}\n","// utils/project-dir.ts\n// Centralised project-directory resolution used by all plugin entry points.\n\n/**\n * Resolve the skaile project directory from environment variables.\n *\n * Resolution order:\n * 1. `SKAILE_PROJECT_DIR` (always checked first)\n * 2. Any additional env var keys supplied by the caller (in order)\n * 3. `process.cwd()` as final fallback\n *\n * @param additionalEnvVars - Optional list of extra environment variable names\n * to check before falling back to `process.cwd()`.\n * @returns Absolute path to the resolved project directory.\n *\n * @example\n * // Claude Code — also checks CLAUDE_PROJECT_DIR\n * const projectDir = resolveProjectDir([\"CLAUDE_PROJECT_DIR\"]);\n *\n * // OMP / standalone — SKAILE_PROJECT_DIR or cwd only\n * const projectDir = resolveProjectDir();\n *\n * @docLink packages/workspace-plugin/concepts#workspaceplugin-lifecycle\n */\nexport function resolveProjectDir(additionalEnvVars?: string[]): string {\n if (process.env.SKAILE_PROJECT_DIR) return process.env.SKAILE_PROJECT_DIR;\n for (const key of additionalEnvVars ?? []) {\n const val = process.env[key];\n if (val) return val;\n }\n return process.cwd();\n}\n"]}