@skaile/workspaces 5.2.0 → 5.3.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 (252) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +1 -1
  3. package/dist/{asset-feeds-WDIB3E6H.js → asset-feeds-VIZXYDAO.js} +12 -12
  4. package/dist/{asset-feeds-WDIB3E6H.js.map → asset-feeds-VIZXYDAO.js.map} +1 -1
  5. package/dist/asset-manager/catalog-deployer.js +9 -9
  6. package/dist/asset-manager/index.js +13 -13
  7. package/dist/asset-manager/installer.js +9 -9
  8. package/dist/asset-manager/src/index.d.ts +12 -3
  9. package/dist/asset-manager/src/index.d.ts.map +1 -1
  10. package/dist/asset-manager/src/installer.d.ts +2 -1
  11. package/dist/asset-manager/src/installer.d.ts.map +1 -1
  12. package/dist/bridge/drivers/claude-sdk.js +11 -11
  13. package/dist/bridge/drivers/codex.js +10 -10
  14. package/dist/bridge/drivers/continue.js +12 -12
  15. package/dist/bridge/drivers/echo.js +1 -1
  16. package/dist/bridge/drivers/gemini.js +5 -5
  17. package/dist/bridge/drivers/goose.js +12 -12
  18. package/dist/bridge/drivers/omp.js +2 -2
  19. package/dist/bridge/drivers/opencode.js +12 -12
  20. package/dist/bridge/drivers/qwen.js +5 -5
  21. package/dist/bridge/index.js +12 -12
  22. package/dist/{chunk-B4J4RGNY.js → chunk-3ZVSINEV.js} +28 -16
  23. package/dist/chunk-3ZVSINEV.js.map +1 -0
  24. package/dist/{chunk-IOUIC2ZD.js → chunk-4257Q2LH.js} +8 -8
  25. package/dist/{chunk-IOUIC2ZD.js.map → chunk-4257Q2LH.js.map} +1 -1
  26. package/dist/{chunk-PU5VY7KF.js → chunk-4SSKKFDF.js} +4 -4
  27. package/dist/{chunk-PU5VY7KF.js.map → chunk-4SSKKFDF.js.map} +1 -1
  28. package/dist/{chunk-BIMEKYOE.js → chunk-6GBQND2F.js} +15 -18
  29. package/dist/chunk-6GBQND2F.js.map +1 -0
  30. package/dist/{chunk-OFNXRI4L.js → chunk-7L4WFH3Y.js} +3 -3
  31. package/dist/{chunk-OFNXRI4L.js.map → chunk-7L4WFH3Y.js.map} +1 -1
  32. package/dist/{chunk-6ZCVROWW.js → chunk-A223FDDC.js} +6 -6
  33. package/dist/{chunk-6ZCVROWW.js.map → chunk-A223FDDC.js.map} +1 -1
  34. package/dist/{chunk-BWOLP6KQ.js → chunk-AWGQVAC5.js} +3 -3
  35. package/dist/{chunk-BWOLP6KQ.js.map → chunk-AWGQVAC5.js.map} +1 -1
  36. package/dist/{chunk-FJTC5YFO.js → chunk-BUZ3K2PT.js} +3 -3
  37. package/dist/{chunk-FJTC5YFO.js.map → chunk-BUZ3K2PT.js.map} +1 -1
  38. package/dist/{chunk-UDBN3LZU.js → chunk-CZ35I4RK.js} +4 -4
  39. package/dist/{chunk-UDBN3LZU.js.map → chunk-CZ35I4RK.js.map} +1 -1
  40. package/dist/{chunk-ZSFTCMZL.js → chunk-D63AJVBW.js} +19 -19
  41. package/dist/{chunk-ZSFTCMZL.js.map → chunk-D63AJVBW.js.map} +1 -1
  42. package/dist/{chunk-6OWIEFZ2.js → chunk-DECPI7DN.js} +5 -5
  43. package/dist/{chunk-6OWIEFZ2.js.map → chunk-DECPI7DN.js.map} +1 -1
  44. package/dist/{chunk-BUNBKRJZ.js → chunk-ERCSHLTF.js} +3 -3
  45. package/dist/{chunk-BUNBKRJZ.js.map → chunk-ERCSHLTF.js.map} +1 -1
  46. package/dist/{chunk-3E2TIPBZ.js → chunk-FTYM4VRZ.js} +2 -2
  47. package/dist/{chunk-3E2TIPBZ.js.map → chunk-FTYM4VRZ.js.map} +1 -1
  48. package/dist/{chunk-PHKFFJ4I.js → chunk-FXN4PLRO.js} +3 -3
  49. package/dist/{chunk-PHKFFJ4I.js.map → chunk-FXN4PLRO.js.map} +1 -1
  50. package/dist/{chunk-XIYXBHLN.js → chunk-FZGL7Z52.js} +2 -2
  51. package/dist/{chunk-XIYXBHLN.js.map → chunk-FZGL7Z52.js.map} +1 -1
  52. package/dist/{chunk-BJQUSAGB.js → chunk-GCYD4EGY.js} +4 -4
  53. package/dist/{chunk-BJQUSAGB.js.map → chunk-GCYD4EGY.js.map} +1 -1
  54. package/dist/{chunk-EB6OPURC.js → chunk-HTKZ4AOW.js} +3 -3
  55. package/dist/{chunk-EB6OPURC.js.map → chunk-HTKZ4AOW.js.map} +1 -1
  56. package/dist/{chunk-ANWHAGM7.js → chunk-JAJG4G5E.js} +3 -3
  57. package/dist/{chunk-ANWHAGM7.js.map → chunk-JAJG4G5E.js.map} +1 -1
  58. package/dist/{chunk-7Y43UXKA.js → chunk-JELTQ4H7.js} +3 -3
  59. package/dist/{chunk-7Y43UXKA.js.map → chunk-JELTQ4H7.js.map} +1 -1
  60. package/dist/{chunk-XOTJVCJB.js → chunk-JKWU6ULI.js} +3 -3
  61. package/dist/{chunk-XOTJVCJB.js.map → chunk-JKWU6ULI.js.map} +1 -1
  62. package/dist/{chunk-KGGT6MUM.js → chunk-K2JVODQD.js} +18 -6
  63. package/dist/chunk-K2JVODQD.js.map +1 -0
  64. package/dist/{chunk-P2EM6FNQ.js → chunk-KBAE7PU7.js} +18 -33
  65. package/dist/chunk-KBAE7PU7.js.map +1 -0
  66. package/dist/{chunk-ARUJBGAH.js → chunk-KXTO7HON.js} +3 -3
  67. package/dist/{chunk-ARUJBGAH.js.map → chunk-KXTO7HON.js.map} +1 -1
  68. package/dist/{chunk-2QZG5VJQ.js → chunk-LAI7X6I2.js} +3 -3
  69. package/dist/{chunk-2QZG5VJQ.js.map → chunk-LAI7X6I2.js.map} +1 -1
  70. package/dist/{chunk-YANDJSMN.js → chunk-LFMX2UEF.js} +3 -3
  71. package/dist/{chunk-YANDJSMN.js.map → chunk-LFMX2UEF.js.map} +1 -1
  72. package/dist/{chunk-RXPC4KBW.js → chunk-LM5XEFNS.js} +3 -3
  73. package/dist/{chunk-RXPC4KBW.js.map → chunk-LM5XEFNS.js.map} +1 -1
  74. package/dist/{chunk-TLKM4M47.js → chunk-MFHKHXDE.js} +6 -3
  75. package/dist/chunk-MFHKHXDE.js.map +1 -0
  76. package/dist/{chunk-WMEPS6S4.js → chunk-OMD4TAJX.js} +3 -3
  77. package/dist/{chunk-WMEPS6S4.js.map → chunk-OMD4TAJX.js.map} +1 -1
  78. package/dist/{chunk-MGHUSFYQ.js → chunk-OOKFZW6H.js} +8 -8
  79. package/dist/{chunk-MGHUSFYQ.js.map → chunk-OOKFZW6H.js.map} +1 -1
  80. package/dist/{chunk-2MEMXBLC.js → chunk-QHIMMBJO.js} +5 -5
  81. package/dist/{chunk-2MEMXBLC.js.map → chunk-QHIMMBJO.js.map} +1 -1
  82. package/dist/{chunk-YRF5CYHR.js → chunk-SR4RFKHM.js} +36 -5
  83. package/dist/chunk-SR4RFKHM.js.map +1 -0
  84. package/dist/{chunk-R3QW7CA5.js → chunk-TR7KFBIO.js} +7 -7
  85. package/dist/chunk-TR7KFBIO.js.map +1 -0
  86. package/dist/{chunk-JPR7EPIM.js → chunk-TVFSA5IQ.js} +4 -4
  87. package/dist/{chunk-JPR7EPIM.js.map → chunk-TVFSA5IQ.js.map} +1 -1
  88. package/dist/{chunk-4YE7OYTB.js → chunk-VKSA2CDJ.js} +5 -6
  89. package/dist/chunk-VKSA2CDJ.js.map +1 -0
  90. package/dist/{chunk-TVJBJLXR.js → chunk-VLEWVR44.js} +13 -13
  91. package/dist/{chunk-TVJBJLXR.js.map → chunk-VLEWVR44.js.map} +1 -1
  92. package/dist/{chunk-77GKEZ2R.js → chunk-WGN7Z36G.js} +3 -3
  93. package/dist/{chunk-77GKEZ2R.js.map → chunk-WGN7Z36G.js.map} +1 -1
  94. package/dist/{chunk-L257BENF.js → chunk-WGNFDLHT.js} +73 -21
  95. package/dist/chunk-WGNFDLHT.js.map +1 -0
  96. package/dist/{chunk-OABIGSUY.js → chunk-WX74MVNA.js} +2 -2
  97. package/dist/chunk-WX74MVNA.js.map +1 -0
  98. package/dist/{chunk-U6K3I3AX.js → chunk-XGIS325V.js} +3 -3
  99. package/dist/{chunk-U6K3I3AX.js.map → chunk-XGIS325V.js.map} +1 -1
  100. package/dist/{chunk-LZ5RH6LD.js → chunk-Y7UBRRKG.js} +89 -128
  101. package/dist/chunk-Y7UBRRKG.js.map +1 -0
  102. package/dist/{chunk-DD3OZLRD.js → chunk-YTJZQ4HY.js} +3 -3
  103. package/dist/{chunk-DD3OZLRD.js.map → chunk-YTJZQ4HY.js.map} +1 -1
  104. package/dist/{chunk-S6KNDUAU.js → chunk-YXNYBUQY.js} +5 -5
  105. package/dist/{chunk-S6KNDUAU.js.map → chunk-YXNYBUQY.js.map} +1 -1
  106. package/dist/chunk-ZCSFGGLG.js +15 -0
  107. package/dist/{chunk-BZXR6SW5.js.map → chunk-ZCSFGGLG.js.map} +1 -1
  108. package/dist/{chunk-EOGNW74K.js → chunk-ZDMGMWK6.js} +12 -11
  109. package/dist/chunk-ZDMGMWK6.js.map +1 -0
  110. package/dist/cli/index.js +555 -483
  111. package/dist/cli/index.js.map +1 -1
  112. package/dist/cli/src/commands/asset-cmd.d.ts.map +1 -1
  113. package/dist/cli/src/commands/catalog-cmd.d.ts.map +1 -1
  114. package/dist/cli/src/commands/catalog.d.ts.map +1 -1
  115. package/dist/cli/src/commands/library-cmd.d.ts.map +1 -1
  116. package/dist/cli/src/commands/library-index.d.ts +43 -1
  117. package/dist/cli/src/commands/library-index.d.ts.map +1 -1
  118. package/dist/cli/src/commands/library-publish.d.ts.map +1 -1
  119. package/dist/cli/src/commands/outdated.d.ts +3 -1
  120. package/dist/cli/src/commands/outdated.d.ts.map +1 -1
  121. package/dist/cli/src/commands/project.d.ts.map +1 -1
  122. package/dist/cli/src/commands/skailify-lib.d.ts +3 -2
  123. package/dist/cli/src/commands/skailify-lib.d.ts.map +1 -1
  124. package/dist/cli/src/commands/validate.d.ts.map +1 -1
  125. package/dist/connectors/config.js +6 -6
  126. package/dist/connectors/index.js +15 -15
  127. package/dist/{connectors-GUN4MRWR.js → connectors-Z2FUGAJU.js} +18 -18
  128. package/dist/{connectors-GUN4MRWR.js.map → connectors-Z2FUGAJU.js.map} +1 -1
  129. package/dist/core/index.js +8 -8
  130. package/dist/core/manifest.js +2 -2
  131. package/dist/core/models.js +1 -1
  132. package/dist/core/publish-manifest.js +2 -2
  133. package/dist/core/ref.js +1 -1
  134. package/dist/core/runtime-assets.js +6 -6
  135. package/dist/core/src/asset-roots.d.ts +8 -0
  136. package/dist/core/src/asset-roots.d.ts.map +1 -1
  137. package/dist/core/src/cache-paths.d.ts +6 -0
  138. package/dist/core/src/cache-paths.d.ts.map +1 -1
  139. package/dist/core/src/index.d.ts +2 -2
  140. package/dist/core/src/index.d.ts.map +1 -1
  141. package/dist/core/src/lock.d.ts.map +1 -1
  142. package/dist/core/src/models.d.ts +7 -0
  143. package/dist/core/src/models.d.ts.map +1 -1
  144. package/dist/core/src/publish-manifest.d.ts +26 -2
  145. package/dist/core/src/publish-manifest.d.ts.map +1 -1
  146. package/dist/core/src/walker.d.ts.map +1 -1
  147. package/dist/core/store.js +2 -2
  148. package/dist/core/workspace-config.js +5 -5
  149. package/dist/deploy/index.js +8 -8
  150. package/dist/discovery/index.js +4 -4
  151. package/dist/discovery/src/discover-manifest.d.ts.map +1 -1
  152. package/dist/discovery/src/discover.d.ts.map +1 -1
  153. package/dist/discovery/src/hash.d.ts +45 -23
  154. package/dist/discovery/src/hash.d.ts.map +1 -1
  155. package/dist/discovery/src/index.d.ts +2 -0
  156. package/dist/discovery/src/index.d.ts.map +1 -1
  157. package/dist/discovery/src/parse-manifest.d.ts +27 -0
  158. package/dist/discovery/src/parse-manifest.d.ts.map +1 -0
  159. package/dist/discovery/src/tree-entries.d.ts.map +1 -1
  160. package/dist/{ensure-sources-VCPA762L.js → ensure-sources-3IH5XHAP.js} +16 -16
  161. package/dist/{ensure-sources-VCPA762L.js.map → ensure-sources-3IH5XHAP.js.map} +1 -1
  162. package/dist/factory-assets/connectors/box.js +15 -15
  163. package/dist/factory-assets/connectors/deploy.js +15 -15
  164. package/dist/factory-assets/connectors/devserver.js +15 -15
  165. package/dist/factory-assets/connectors/flow/adapter.js +15 -15
  166. package/dist/factory-assets/connectors/flow/engine.js +9 -9
  167. package/dist/factory-assets/connectors/flow/run-flow.js +17 -17
  168. package/dist/factory-assets/connectors/flow.js +15 -15
  169. package/dist/factory-assets/connectors/git.js +15 -15
  170. package/dist/factory-assets/connectors/gmail.js +15 -15
  171. package/dist/factory-assets/connectors/googledrive.js +15 -15
  172. package/dist/factory-assets/connectors/local.js +15 -15
  173. package/dist/factory-assets/connectors/mattermost.js +15 -15
  174. package/dist/factory-assets/connectors/memory.js +15 -15
  175. package/dist/factory-assets/connectors/minio.js +15 -15
  176. package/dist/factory-assets/connectors/postgres.js +15 -15
  177. package/dist/factory-assets/connectors/s3.js +15 -15
  178. package/dist/factory-assets/connectors/sharepoint.js +15 -15
  179. package/dist/factory-assets/connectors/sqlite.js +15 -15
  180. package/dist/factory-assets/connectors/static-server.js +15 -15
  181. package/dist/factory-assets/connectors/tunnel.js +15 -15
  182. package/dist/factory-assets/connectors/webdav.js +15 -15
  183. package/dist/factory-assets/connectors/xstate-store.js +15 -15
  184. package/dist/factory-assets/connectors/xstate.js +15 -15
  185. package/dist/{flows-BOB5YA5R.js → flows-64OAOYLP.js} +13 -13
  186. package/dist/{flows-BOB5YA5R.js.map → flows-64OAOYLP.js.map} +1 -1
  187. package/dist/{helpers-ZGK4R5MZ.js → helpers-HV5Y57CY.js} +16 -16
  188. package/dist/{helpers-ZGK4R5MZ.js.map → helpers-HV5Y57CY.js.map} +1 -1
  189. package/dist/library/index.js +11 -11
  190. package/dist/library/install.js +3 -2
  191. package/dist/library/src/config.d.ts +5 -4
  192. package/dist/library/src/config.d.ts.map +1 -1
  193. package/dist/library/src/index.d.ts +1 -1
  194. package/dist/library/src/index.d.ts.map +1 -1
  195. package/dist/library/src/install/install-from-manifest.d.ts.map +1 -1
  196. package/dist/library/src/local/library.d.ts.map +1 -1
  197. package/dist/library/src/manifest-writer.d.ts +6 -0
  198. package/dist/library/src/manifest-writer.d.ts.map +1 -1
  199. package/dist/library/src/sync/git-driver.d.ts +8 -0
  200. package/dist/library/src/sync/git-driver.d.ts.map +1 -1
  201. package/dist/{library-publish-RIP6NBYA.js → library-publish-TVS3WQ4C.js} +26 -23
  202. package/dist/library-publish-TVS3WQ4C.js.map +1 -0
  203. package/dist/{open-library-4IJTBVTR.js → open-library-AT6RYQ5M.js} +19 -19
  204. package/dist/{open-library-4IJTBVTR.js.map → open-library-AT6RYQ5M.js.map} +1 -1
  205. package/dist/open-registry-F2Z4OLXJ.js +32 -0
  206. package/dist/{open-registry-G5DI4RPU.js.map → open-registry-F2Z4OLXJ.js.map} +1 -1
  207. package/dist/paths-P7ZXMDCX.js +22 -0
  208. package/dist/{paths-L5XLUC3D.js.map → paths-P7ZXMDCX.js.map} +1 -1
  209. package/dist/{plugin-store-QENDYZ63.js → plugin-store-27KGLW4S.js} +10 -10
  210. package/dist/{plugin-store-QENDYZ63.js.map → plugin-store-27KGLW4S.js.map} +1 -1
  211. package/dist/{project-4INCIIZI.js → project-J2EROMBW.js} +17 -17
  212. package/dist/{project-4INCIIZI.js.map → project-J2EROMBW.js.map} +1 -1
  213. package/dist/resolver/index.js +9 -9
  214. package/dist/runner/index.js +25 -25
  215. package/dist/sdk/asset-manager.js +13 -13
  216. package/dist/sdk/bridge.js +12 -12
  217. package/dist/sdk/core.js +8 -8
  218. package/dist/sdk/flow.js +9 -9
  219. package/dist/sdk/index.js +25 -25
  220. package/dist/sdk/resolver.js +9 -9
  221. package/dist/sdk/runner.js +25 -25
  222. package/dist/secrets/index.js +2 -2
  223. package/dist/{setup-RG4PJJUW.js → setup-IFGA4NQA.js} +21 -21
  224. package/dist/{setup-RG4PJJUW.js.map → setup-IFGA4NQA.js.map} +1 -1
  225. package/dist/skills-3T55L4YT.js +26 -0
  226. package/dist/{skills-CL45F7AG.js.map → skills-3T55L4YT.js.map} +1 -1
  227. package/dist/{source-LJOI5AXU.js → source-HEAE43IL.js} +20 -20
  228. package/dist/{source-LJOI5AXU.js.map → source-HEAE43IL.js.map} +1 -1
  229. package/dist/{source-manifest-publish-QEJML4VS.js → source-manifest-publish-SCAHAYSQ.js} +22 -22
  230. package/dist/{source-manifest-publish-QEJML4VS.js.map → source-manifest-publish-SCAHAYSQ.js.map} +1 -1
  231. package/dist/tui/index.js +25 -25
  232. package/dist/workspace-plugin/adapters/mcp.js +22 -22
  233. package/dist/workspace-plugin/adapters/omp.js +14 -14
  234. package/dist/workspace-plugin/index.js +1 -1
  235. package/package.json +1 -1
  236. package/dist/chunk-4YE7OYTB.js.map +0 -1
  237. package/dist/chunk-B4J4RGNY.js.map +0 -1
  238. package/dist/chunk-BIMEKYOE.js.map +0 -1
  239. package/dist/chunk-BZXR6SW5.js +0 -15
  240. package/dist/chunk-EOGNW74K.js.map +0 -1
  241. package/dist/chunk-KGGT6MUM.js.map +0 -1
  242. package/dist/chunk-L257BENF.js.map +0 -1
  243. package/dist/chunk-LZ5RH6LD.js.map +0 -1
  244. package/dist/chunk-OABIGSUY.js.map +0 -1
  245. package/dist/chunk-P2EM6FNQ.js.map +0 -1
  246. package/dist/chunk-R3QW7CA5.js.map +0 -1
  247. package/dist/chunk-TLKM4M47.js.map +0 -1
  248. package/dist/chunk-YRF5CYHR.js.map +0 -1
  249. package/dist/library-publish-RIP6NBYA.js.map +0 -1
  250. package/dist/open-registry-G5DI4RPU.js +0 -32
  251. package/dist/paths-L5XLUC3D.js +0 -22
  252. package/dist/skills-CL45F7AG.js +0 -26
@@ -1 +1 @@
1
- {"version":3,"sources":["../secrets/src/lifecycle.ts","../secrets/src/providers/env.ts","../secrets/src/providers/local.ts","../secrets/src/router.ts","../secrets/src/index.ts"],"names":["provider"],"mappings":";;;;;;;;AAuCO,IAAM,6BAAN,MAAiC;AAAA,EAC9B,MAAA;AAAA;AAAA;AAAA;AAAA,EAKR,WAAA,CAAY,QAAuB,OAAA,EAA8C;AAC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,OAAO,EAAE,EAAA,EAAI,KAAA,EAAO,KAAA,EAAO,CAAA,UAAA,EAAa,EAAE,CAAA,gBAAA,CAAA,EAAmB;AAAA,IAC/D;AACA,IAAA,OAAO,SAAS,cAAA,EAAe;AAAA,EACjC;AACF;;;ACvNO,IAAM,OAAA,GAAU","file":"chunk-EB6OPURC.js","sourcesContent":["/**\n * CredentialLifecycleService — manages OAuth token refresh outside the SecretsRouter.\n *\n * Works with opaque token blobs stored via the {@link SecretsRouter}; providers remain\n * OAuth-unaware. Phase 1 ships non-OAuth paths (always returns `not_applicable`).\n * Full proactive OAuth refresh with expiry checking ships in Phase 3.4.\n *\n * @docLink packages/secrets/concepts#credential-lifecycle\n */\n\nimport type { SecretsRouter } from \"./router.js\";\n\n/**\n * Configuration for {@link CredentialLifecycleService}.\n *\n * Controls how aggressively the service proactively refreshes credentials before they expire.\n * The default lead time is 300 seconds (5 minutes).\n *\n * @docLink packages/secrets/concepts#credential-lifecycle\n */\nexport interface CredentialLifecycleConfig {\n /** How far before expiry to trigger a proactive refresh (seconds). */\n refreshLeadTimeSec: number;\n}\n\n/**\n * Result returned by {@link CredentialLifecycleService.refreshIfNeeded}.\n *\n * The `reason` discriminant indicates why a refresh did or did not occur.\n * An `error` string is present only when `reason` is `refresh_failed`.\n *\n * @docLink packages/secrets/concepts#credential-lifecycle\n */\nexport interface RefreshResult {\n refreshed: boolean;\n reason: \"not_applicable\" | \"still_valid\" | \"refreshed\" | \"refresh_failed\";\n error?: string;\n}\n\nexport class CredentialLifecycleService {\n private router: SecretsRouter;\n\n // `_config` is accepted for signature stability but not stored yet: Phase 1\n // ships no OAuth refresh, so there is nothing to configure. Phase 3.4 will\n // store and read `refreshLeadTimeSec` when proactive refresh lands.\n constructor(router: SecretsRouter, _config?: Partial<CredentialLifecycleConfig>) {\n this.router = router;\n }\n\n /**\n * Attempt to refresh a credential if needed.\n * Phase 1: always returns not_applicable (no OAuth support yet).\n */\n async refreshIfNeeded(credentialRef: string): Promise<RefreshResult> {\n // Phase 1: no OAuth refresh implemented.\n // The credential exists and is valid as-is (static secrets, env vars, etc.)\n try {\n await this.router.getMetadata(credentialRef);\n return { refreshed: false, reason: \"not_applicable\" };\n } catch {\n return { refreshed: false, reason: \"refresh_failed\", error: \"Credential not found\" };\n }\n }\n\n /**\n * Check if a credential is still valid (not expired).\n * Phase 1: always returns true for non-OAuth credentials.\n */\n async isValid(credentialRef: string): Promise<boolean> {\n try {\n await this.router.getSecret(credentialRef);\n return true;\n } catch {\n return false;\n }\n }\n}\n","/**\n * EnvSecretsProvider — read-only provider that resolves secrets from environment variables.\n *\n * Refs are expected to be plain env var names (e.g. `DATABASE_URL`). The provider is\n * always available with zero configuration and requires no encryption or keychain access.\n * `setSecret` and `deleteSecret` always throw `SecretAccessDeniedError` because\n * environment variables are managed externally to the running process.\n *\n * @docLink packages/secrets/concepts#env-secrets-provider\n */\n\nimport type {\n ISecretsProvider,\n ListFilter,\n ProviderCapabilities,\n SecretMetadata,\n SetSecretOptions,\n} from \"@skaile/workspaces/plugins\";\nimport { SecretAccessDeniedError, SecretNotFoundError } from \"@skaile/workspaces/plugins\";\n\n/**\n * Sentinel timestamp for env secrets, which have no real created/updated time.\n * The Unix epoch is unambiguously not \"now\", so consumers can recognise it as\n * \"unknown\" rather than treating it as a genuine recent timestamp.\n */\nconst ENV_UNKNOWN_TIMESTAMP = new Date(0);\n\nexport class EnvSecretsProvider implements ISecretsProvider {\n readonly id = \"env\";\n\n async getSecret(ref: string): Promise<Uint8Array> {\n const value = process.env[ref];\n if (value === undefined) {\n throw new SecretNotFoundError(ref);\n }\n return new TextEncoder().encode(value);\n }\n\n async setSecret(_ref: string, _value: Uint8Array, _opts?: SetSecretOptions): Promise<void> {\n throw new SecretAccessDeniedError(\"EnvSecretsProvider is read-only\");\n }\n\n async deleteSecret(_ref: string): Promise<void> {\n throw new SecretAccessDeniedError(\"EnvSecretsProvider is read-only\");\n }\n\n async listSecrets(filter?: ListFilter): Promise<string[]> {\n let keys = Object.keys(process.env);\n if (filter?.prefix) {\n keys = keys.filter((k) => k.startsWith(filter.prefix!));\n }\n if (filter?.limit) {\n keys = keys.slice(0, filter.limit);\n }\n return keys;\n }\n\n async testConnection(): Promise<{ ok: boolean; latencyMs?: number; error?: string }> {\n return { ok: true, latencyMs: 0 };\n }\n\n async getMetadata(ref: string): Promise<SecretMetadata> {\n const value = process.env[ref];\n if (value === undefined) {\n throw new SecretNotFoundError(ref);\n }\n // Env vars carry no creation/modification time. `SecretMetadata` requires\n // both fields, so use the Unix epoch as a documented \"unknown\" sentinel\n // rather than `new Date()`, which would falsely imply the secret was just\n // created/updated. The read-only scope summary already signals the source.\n return {\n ref,\n createdAt: ENV_UNKNOWN_TIMESTAMP,\n updatedAt: ENV_UNKNOWN_TIMESTAMP,\n scopeSummary: \"environment variable (read-only)\",\n };\n }\n\n getCapabilities(): ProviderCapabilities {\n return {\n supportsRotation: false,\n supportsExpiry: false,\n supportsBatch: false,\n scopeModel: \"flat\",\n };\n }\n}\n","/**\n * LocalSecretsProvider — AES-256-GCM encrypted file-blob storage at `~/.skaile/secrets/`.\n *\n * Each secret is stored as a separate `.enc` file named by the SHA-256 hash of the ref\n * (collision-free, filesystem-safe). A companion `.meta.json` stores the original ref,\n * timestamps, and optional user metadata. The master key is derived via PBKDF2-SHA-512\n * from one of three {@link KeyStrategy} sources: OS keychain (keytar), a passphrase from\n * `SKAILE_SECRETS_PASSPHRASE`, or a machine-derived passphrase as last resort.\n * Switching strategies re-encrypts all existing secrets with the new key.\n *\n * @docLink packages/secrets/concepts#local-secrets-provider\n */\n\nimport * as crypto from \"node:crypto\";\nimport * as fs from \"node:fs\";\nimport * as os from \"node:os\";\nimport * as path from \"node:path\";\n\n// The narrow module, not the `core` barrel: the barrel's chunks use `import.meta`,\n// which CommonJS-transpiling consumers (ts-jest) cannot load.\nimport { globalSkaileDir } from \"../../../core/src/cache-paths.js\";\nimport type {\n ISecretsProvider,\n ListFilter,\n ProviderCapabilities,\n SecretMetadata,\n SetSecretOptions,\n} from \"@skaile/workspaces/plugins\";\nimport {\n ProviderUnavailableError,\n SecretNotFoundError,\n SecretsError,\n} from \"@skaile/workspaces/plugins\";\n\n// ---------------------------------------------------------------------------\n// Constants\n// ---------------------------------------------------------------------------\n\nconst ALGORITHM = \"aes-256-gcm\";\nconst IV_LENGTH = 12;\nconst AUTH_TAG_LENGTH = 16;\nconst SALT_LENGTH = 32;\nconst KEY_LENGTH = 32;\nconst PBKDF2_ITERATIONS = 100_000;\nconst PBKDF2_DIGEST = \"sha512\";\n\nconst KEYCHAIN_SERVICE = \"skaile-secrets\";\nconst KEYCHAIN_ACCOUNT = \"master-key\";\n\n/** Env var that provides the passphrase at runtime (never stored on disk). */\nconst PASSPHRASE_ENV = \"SKAILE_SECRETS_PASSPHRASE\";\n\n/**\n * Master key derivation strategy used by {@link LocalSecretsProvider}.\n *\n * - `keychain` — OS keychain (via keytar); most secure, requires keytar to be installed.\n * - `passphrase` — PBKDF2 from `SKAILE_SECRETS_PASSPHRASE` env var; portable across machines.\n * - `machine` — deterministic from hostname + username; least secure, last-resort fallback.\n *\n * The active strategy is persisted in `~/.skaile/secrets/.key-strategy`. Switching strategies\n * re-encrypts all existing secrets with the new key.\n *\n * @docLink packages/secrets/concepts#local-secrets-provider\n */\nexport type KeyStrategy = \"keychain\" | \"passphrase\" | \"machine\";\n\n// ---------------------------------------------------------------------------\n// Key derivation\n// ---------------------------------------------------------------------------\n\nfunction deriveMasterKey(passphrase: string, salt: Buffer): Buffer {\n return crypto.pbkdf2Sync(passphrase, salt, PBKDF2_ITERATIONS, KEY_LENGTH, PBKDF2_DIGEST);\n}\n\nfunction getMachinePassphrase(): string {\n // Deterministic but not secret -- last resort only.\n return `skaile:${os.hostname()}:${os.userInfo().username}`;\n}\n\n/** Hash a passphrase for verification (stored in .master). */\nfunction hashPassphrase(passphrase: string): string {\n return crypto.createHash(\"sha256\").update(passphrase).digest(\"hex\");\n}\n\n// ---------------------------------------------------------------------------\n// Filename hashing (injective: sha256 of ref)\n// ---------------------------------------------------------------------------\n\nfunction refToHash(ref: string): string {\n return crypto.createHash(\"sha256\").update(ref).digest(\"hex\").slice(0, 40);\n}\n\n// ---------------------------------------------------------------------------\n// Encryption / decryption\n// ---------------------------------------------------------------------------\n\nfunction encrypt(data: Uint8Array, key: Buffer): Buffer {\n const iv = crypto.randomBytes(IV_LENGTH);\n const cipher = crypto.createCipheriv(ALGORITHM, key, iv, { authTagLength: AUTH_TAG_LENGTH });\n const encrypted = Buffer.concat([cipher.update(data), cipher.final()]);\n const authTag = cipher.getAuthTag();\n // Format: [iv (12)] [authTag (16)] [ciphertext (...)]\n return Buffer.concat([iv, authTag, encrypted]);\n}\n\nfunction decrypt(blob: Buffer, key: Buffer): Buffer {\n const iv = blob.subarray(0, IV_LENGTH);\n const authTag = blob.subarray(IV_LENGTH, IV_LENGTH + AUTH_TAG_LENGTH);\n const ciphertext = blob.subarray(IV_LENGTH + AUTH_TAG_LENGTH);\n const decipher = crypto.createDecipheriv(ALGORITHM, key, iv, { authTagLength: AUTH_TAG_LENGTH });\n decipher.setAuthTag(authTag);\n return Buffer.concat([decipher.update(ciphertext), decipher.final()]);\n}\n\n// ---------------------------------------------------------------------------\n// Provider\n// ---------------------------------------------------------------------------\n\nexport class LocalSecretsProvider implements ISecretsProvider {\n readonly id = \"local\";\n private secretsDir: string;\n private masterKey: Buffer | null = null;\n private salt: Buffer | null = null;\n private strategy: KeyStrategy = \"machine\";\n\n constructor(secretsDir?: string) {\n this.secretsDir = secretsDir ?? path.join(globalSkaileDir(), \"secrets\");\n }\n\n // -- Initialization --------------------------------------------------------\n\n private ensureDir(): void {\n if (!fs.existsSync(this.secretsDir)) {\n fs.mkdirSync(this.secretsDir, { recursive: true, mode: 0o700 });\n }\n }\n\n private loadOrCreateSalt(): Buffer {\n const saltPath = path.join(this.secretsDir, \".salt\");\n if (fs.existsSync(saltPath)) {\n return fs.readFileSync(saltPath);\n }\n const salt = crypto.randomBytes(SALT_LENGTH);\n fs.writeFileSync(saltPath, salt, { mode: 0o600 });\n return salt;\n }\n\n private async ensureKey(): Promise<void> {\n if (this.masterKey) return;\n\n this.ensureDir();\n this.salt = this.loadOrCreateSalt();\n\n // Determine strategy\n const strategyPath = path.join(this.secretsDir, \".key-strategy\");\n if (fs.existsSync(strategyPath)) {\n this.strategy = fs.readFileSync(strategyPath, \"utf-8\").trim() as KeyStrategy;\n } else {\n // Auto-detect: try keychain, fall back to machine\n this.strategy = (await this.tryKeychainStrategy()) ? \"keychain\" : \"machine\";\n fs.writeFileSync(strategyPath, this.strategy, { mode: 0o600 });\n }\n\n // Derive key from strategy\n const passphrase = await this.getPassphraseForStrategy(this.strategy);\n this.masterKey = deriveMasterKey(passphrase, this.salt);\n }\n\n private async tryKeychainStrategy(): Promise<boolean> {\n try {\n // `keytar` is an optional OS-keychain native module the user installs\n // themselves; the `as string` specifier keeps it out of tsc resolution.\n const keytar = await import(\"keytar\" as string);\n let stored = await keytar.getPassword(KEYCHAIN_SERVICE, KEYCHAIN_ACCOUNT);\n if (!stored) {\n stored = crypto.randomBytes(32).toString(\"base64\");\n await keytar.setPassword(KEYCHAIN_SERVICE, KEYCHAIN_ACCOUNT, stored);\n }\n return true;\n } catch {\n return false;\n }\n }\n\n private async getPassphraseForStrategy(strategy: KeyStrategy): Promise<string> {\n switch (strategy) {\n case \"keychain\": {\n try {\n // `keytar` is an optional OS-keychain native module the user installs\n // themselves; the `as string` specifier keeps it out of tsc resolution.\n const keytar = await import(\"keytar\" as string);\n const stored = await keytar.getPassword(KEYCHAIN_SERVICE, KEYCHAIN_ACCOUNT);\n if (stored) return stored;\n } catch {\n // Keychain failed; fall through to machine\n }\n return getMachinePassphrase();\n }\n case \"passphrase\": {\n const envPassphrase = process.env[PASSPHRASE_ENV];\n if (envPassphrase) {\n // Verify against stored hash if it exists\n const masterPath = path.join(this.secretsDir, \".master\");\n if (fs.existsSync(masterPath)) {\n const storedHash = fs.readFileSync(masterPath, \"utf-8\").trim();\n if (hashPassphrase(envPassphrase) !== storedHash) {\n throw new SecretsError(\n `Passphrase from ${PASSPHRASE_ENV} does not match stored hash. ` +\n \"Use skaile auth set-key-strategy passphrase to reset.\",\n \"PASSPHRASE_MISMATCH\",\n );\n }\n }\n return envPassphrase;\n }\n // No env var -- hard error. Silent fallback to machine would\n // produce a different key, causing AES-GCM auth-tag failures\n // on secrets encrypted with the real passphrase.\n throw new SecretsError(\n `Strategy is \"passphrase\" but ${PASSPHRASE_ENV} is not set. ` +\n `Export it before running: export ${PASSPHRASE_ENV}='...'`,\n \"PASSPHRASE_REQUIRED\",\n );\n }\n case \"machine\":\n return getMachinePassphrase();\n default:\n return getMachinePassphrase();\n }\n }\n\n // -- Strategy management ---------------------------------------------------\n\n /**\n * Set the key strategy explicitly. Called by `skaile auth set-key-strategy`.\n *\n * When existing secrets are present, they are re-encrypted with the new key\n * to prevent data loss from key mismatch.\n */\n async setKeyStrategy(strategy: KeyStrategy, passphrase?: string): Promise<void> {\n this.ensureDir();\n\n // --- 1. Validate new strategy prerequisites -------------------------\n\n const effectivePassphrase = passphrase ?? process.env[PASSPHRASE_ENV];\n\n if (strategy === \"passphrase\") {\n if (!effectivePassphrase) {\n throw new SecretsError(\n `Passphrase required. Pass it as an argument or set ${PASSPHRASE_ENV}.`,\n \"PASSPHRASE_REQUIRED\",\n );\n }\n }\n\n if (strategy === \"keychain\") {\n const success = await this.tryKeychainStrategy();\n if (!success) {\n throw new ProviderUnavailableError(\"local\", \"OS keychain not available\");\n }\n }\n\n // --- 2. Load the OLD key under the current strategy -----------------\n // ensureKey() reads the current strategy file and derives the key\n // that was used to encrypt existing secrets. This is critical for\n // cross-process scenarios where masterKey starts as null.\n\n const encFiles = this.listEncFiles();\n if (encFiles.length > 0) {\n await this.ensureKey();\n const oldKey = this.masterKey!;\n\n // Derive the new key\n const salt = this.salt!;\n const newPassphrase =\n strategy === \"passphrase\"\n ? effectivePassphrase!\n : strategy === \"keychain\"\n ? await this.getPassphraseForStrategy(\"keychain\")\n : getMachinePassphrase();\n const newKey = deriveMasterKey(newPassphrase, salt);\n\n // Re-encrypt each secret with the new key. A single failure must abort the\n // whole switch: committing the new strategy while a secret is still under\n // the old key orphans that secret (the registry advertises a key that no\n // longer decrypts it). Collect failures and throw before the commit below,\n // leaving `.key-strategy`/`.master` — and every secret — on the old key.\n const failed: string[] = [];\n for (const encFile of encFiles) {\n const filePath = path.join(this.secretsDir, encFile);\n const blob = fs.readFileSync(filePath);\n try {\n const plaintext = decrypt(blob, oldKey);\n const reEncrypted = encrypt(plaintext, newKey);\n fs.writeFileSync(filePath, reEncrypted, { mode: 0o600 });\n } catch {\n failed.push(encFile);\n }\n }\n if (failed.length > 0) {\n throw new Error(\n `[skaile/secrets] Key-strategy switch aborted: could not re-encrypt ` +\n `${failed.length} secret(s) (${failed.join(\", \")}). The previous strategy ` +\n \"is unchanged; resolve the failing secrets before retrying.\",\n );\n }\n }\n\n // --- 3. Commit the new strategy (last write -- failure above leaves\n // the old strategy intact) ------------------------------------\n\n if (strategy === \"passphrase\") {\n const masterPath = path.join(this.secretsDir, \".master\");\n fs.writeFileSync(masterPath, hashPassphrase(effectivePassphrase!), { mode: 0o600 });\n }\n\n const strategyPath = path.join(this.secretsDir, \".key-strategy\");\n fs.writeFileSync(strategyPath, strategy, { mode: 0o600 });\n this.masterKey = null;\n this.strategy = strategy;\n }\n\n getKeyStrategy(): KeyStrategy {\n const strategyPath = path.join(this.secretsDir, \".key-strategy\");\n if (fs.existsSync(strategyPath)) {\n return fs.readFileSync(strategyPath, \"utf-8\").trim() as KeyStrategy;\n }\n return \"machine\";\n }\n\n // -- File helpers ----------------------------------------------------------\n\n private encFilename(ref: string): string {\n return `${refToHash(ref)}.enc`;\n }\n\n private metaFilename(ref: string): string {\n return `${refToHash(ref)}.meta.json`;\n }\n\n private metaPath(ref: string): string {\n return path.join(this.secretsDir, this.metaFilename(ref));\n }\n\n private listEncFiles(): string[] {\n if (!fs.existsSync(this.secretsDir)) return [];\n return fs.readdirSync(this.secretsDir).filter((f) => f.endsWith(\".enc\"));\n }\n\n // -- ISecretsProvider implementation ----------------------------------------\n\n async getSecret(ref: string): Promise<Uint8Array> {\n await this.ensureKey();\n const filePath = path.join(this.secretsDir, this.encFilename(ref));\n if (!fs.existsSync(filePath)) {\n throw new SecretNotFoundError(ref);\n }\n const blob = fs.readFileSync(filePath);\n const decrypted = decrypt(blob, this.masterKey!);\n\n // Update lastAccessedAt\n const metaFile = this.metaPath(ref);\n if (fs.existsSync(metaFile)) {\n try {\n const meta = JSON.parse(fs.readFileSync(metaFile, \"utf-8\"));\n meta.lastAccessedAt = new Date().toISOString();\n fs.writeFileSync(metaFile, JSON.stringify(meta), { mode: 0o600 });\n } catch {\n // Non-fatal\n }\n }\n\n return new Uint8Array(decrypted);\n }\n\n async setSecret(ref: string, value: Uint8Array, opts?: SetSecretOptions): Promise<void> {\n await this.ensureKey();\n this.ensureDir();\n const filePath = path.join(this.secretsDir, this.encFilename(ref));\n const encrypted = encrypt(value, this.masterKey!);\n fs.writeFileSync(filePath, encrypted, { mode: 0o600 });\n\n // Write metadata (stores the original ref for reverse lookup)\n const now = new Date().toISOString();\n const metaFile = this.metaPath(ref);\n let existing: Record<string, unknown> = {};\n if (fs.existsSync(metaFile)) {\n try {\n existing = JSON.parse(fs.readFileSync(metaFile, \"utf-8\"));\n } catch {\n // Overwrite corrupt meta\n }\n }\n const meta = {\n ref,\n createdAt: existing.createdAt ?? now,\n updatedAt: now,\n lastAccessedAt: now,\n ...(opts?.metadata ? { userMeta: opts.metadata } : {}),\n ...(opts?.ttlSeconds\n ? { expiresAt: new Date(Date.now() + opts.ttlSeconds * 1000).toISOString() }\n : {}),\n };\n fs.writeFileSync(metaFile, JSON.stringify(meta, null, 2), { mode: 0o600 });\n }\n\n async deleteSecret(ref: string): Promise<void> {\n const filePath = path.join(this.secretsDir, this.encFilename(ref));\n const metaFile = this.metaPath(ref);\n if (!fs.existsSync(filePath)) {\n throw new SecretNotFoundError(ref);\n }\n fs.unlinkSync(filePath);\n if (fs.existsSync(metaFile)) {\n fs.unlinkSync(metaFile);\n }\n }\n\n async listSecrets(filter?: ListFilter): Promise<string[]> {\n this.ensureDir();\n // Read refs from meta files (the .enc filenames are hashes, not refs)\n const metaFiles = fs.readdirSync(this.secretsDir).filter((f) => f.endsWith(\".meta.json\"));\n let refs: string[] = [];\n for (const mf of metaFiles) {\n try {\n const meta = JSON.parse(fs.readFileSync(path.join(this.secretsDir, mf), \"utf-8\"));\n if (meta.ref) refs.push(meta.ref);\n } catch {\n // Skip corrupt meta files\n }\n }\n if (filter?.prefix) {\n refs = refs.filter((r) => r.startsWith(filter.prefix!));\n }\n if (filter?.limit) {\n refs = refs.slice(0, filter.limit);\n }\n return refs;\n }\n\n async testConnection(): Promise<{ ok: boolean; latencyMs?: number; error?: string }> {\n const start = Date.now();\n try {\n await this.ensureKey();\n // Write + read + delete a test secret\n const testRef = `__test_${crypto.randomBytes(4).toString(\"hex\")}`;\n const testValue = new TextEncoder().encode(\"test\");\n await this.setSecret(testRef, testValue);\n const read = await this.getSecret(testRef);\n await this.deleteSecret(testRef);\n if (new TextDecoder().decode(read) !== \"test\") {\n return { ok: false, error: \"Round-trip mismatch\" };\n }\n return { ok: true, latencyMs: Date.now() - start };\n } catch (e) {\n return {\n ok: false,\n latencyMs: Date.now() - start,\n error: e instanceof Error ? e.message : String(e),\n };\n }\n }\n\n async getMetadata(ref: string): Promise<SecretMetadata> {\n const metaFile = this.metaPath(ref);\n const filePath = path.join(this.secretsDir, this.encFilename(ref));\n if (!fs.existsSync(filePath)) {\n throw new SecretNotFoundError(ref);\n }\n if (fs.existsSync(metaFile)) {\n const raw = JSON.parse(fs.readFileSync(metaFile, \"utf-8\"));\n return {\n ref: raw.ref ?? ref,\n createdAt: new Date(raw.createdAt),\n updatedAt: new Date(raw.updatedAt),\n lastAccessedAt: raw.lastAccessedAt ? new Date(raw.lastAccessedAt) : undefined,\n owner: raw.owner,\n scopeSummary: \"local encrypted file\",\n };\n }\n // Fallback: derive from file stat\n const stat = fs.statSync(filePath);\n return {\n ref,\n createdAt: stat.birthtime,\n updatedAt: stat.mtime,\n scopeSummary: \"local encrypted file\",\n };\n }\n\n getCapabilities(): ProviderCapabilities {\n return {\n supportsRotation: false,\n supportsExpiry: false,\n supportsBatch: false,\n scopeModel: \"flat\",\n };\n }\n}\n","/**\n * SecretsRouter — audit chokepoint for all secret operations.\n *\n * Registers {@link ISecretsProvider} implementations by id, routes credential refs by\n * prefix or via routing config, and emits {@link CredentialAccessed} events for every\n * get, set, delete, list, and metadata operation. Routing rules are evaluated top-to-bottom;\n * the first matching prefix wins and falls back to the configured default provider.\n *\n * @docLink packages/secrets/concepts#secrets-router\n */\n\nimport type {\n ISecretsProvider,\n ListFilter,\n ProviderCapabilities,\n SecretMetadata,\n SetSecretOptions,\n} from \"@skaile/workspaces/plugins\";\nimport { ProviderUnavailableError } from \"@skaile/workspaces/plugins\";\n\n// ---------------------------------------------------------------------------\n// Audit event\n// ---------------------------------------------------------------------------\n\n/**\n * Audit event emitted by {@link SecretsRouter} after every secret operation.\n *\n * Delivered synchronously to all registered {@link AuditSink} functions. Errors thrown\n * by sinks are swallowed to ensure they never break the underlying secret operation.\n *\n * @docLink packages/secrets/concepts#secrets-router\n */\nexport interface CredentialAccessed {\n credential_ref: string;\n operation: \"get\" | \"set\" | \"delete\" | \"list\" | \"metadata\";\n provider_id: string;\n caller_session_id?: string;\n caller_tool_call?: string;\n timestamp: Date;\n}\n\n/**\n * Callback function that receives {@link CredentialAccessed} audit events from {@link SecretsRouter}.\n *\n * Register sinks via `SecretsRouter.addSink()`. Sinks run synchronously after each operation;\n * exceptions are caught and suppressed so they cannot interrupt credential resolution.\n *\n * @docLink packages/secrets/concepts#secrets-router\n */\nexport type AuditSink = (event: CredentialAccessed) => void;\n\n// ---------------------------------------------------------------------------\n// Routing config\n// ---------------------------------------------------------------------------\n\n/**\n * A single routing rule that maps a credential ref prefix to a provider.\n *\n * Rules in {@link SecretsRouterConfig.rules} are evaluated top-to-bottom;\n * the first rule whose `prefix` matches the start of the credential ref wins.\n *\n * @docLink packages/secrets/concepts#secrets-router\n */\nexport interface RoutingRule {\n /** Prefix match on credential_ref. First match wins. */\n prefix: string;\n /** Provider id to route to. */\n provider_id: string;\n}\n\n/**\n * Configuration object for {@link SecretsRouter}.\n *\n * Specifies the default provider id used when no routing rule matches, and an optional\n * ordered list of {@link RoutingRule} entries for prefix-based routing.\n *\n * @docLink packages/secrets/concepts#secrets-router\n */\nexport interface SecretsRouterConfig {\n /** Default provider id when no routing rule matches. */\n default_provider: string;\n /** Ordered routing rules. Evaluated top-to-bottom; first prefix match wins. */\n rules?: RoutingRule[];\n}\n\n// ---------------------------------------------------------------------------\n// Router\n// ---------------------------------------------------------------------------\n\nexport class SecretsRouter {\n private providers = new Map<string, ISecretsProvider>();\n private config: SecretsRouterConfig;\n private sinks: AuditSink[] = [];\n\n /** Caller context for audit events (set per-request by the runner). */\n callerSessionId?: string;\n callerToolCall?: string;\n\n constructor(config: SecretsRouterConfig) {\n this.config = config;\n }\n\n // -- Provider registration ------------------------------------------------\n\n register(provider: ISecretsProvider): void {\n this.providers.set(provider.id, provider);\n }\n\n unregister(id: string): void {\n this.providers.delete(id);\n }\n\n listProviders(): string[] {\n return [...this.providers.keys()];\n }\n\n // -- Audit sinks -----------------------------------------------------------\n\n addSink(sink: AuditSink): void {\n this.sinks.push(sink);\n }\n\n private emit(ref: string, operation: CredentialAccessed[\"operation\"], providerId: string): void {\n const event: CredentialAccessed = {\n credential_ref: ref,\n operation,\n provider_id: providerId,\n caller_session_id: this.callerSessionId,\n caller_tool_call: this.callerToolCall,\n timestamp: new Date(),\n };\n for (const sink of this.sinks) {\n try {\n sink(event);\n } catch {\n // Audit sink errors must not break the secret operation.\n }\n }\n }\n\n // -- Routing ---------------------------------------------------------------\n\n private resolve(ref: string): ISecretsProvider {\n // Check routing rules first\n if (this.config.rules) {\n for (const rule of this.config.rules) {\n if (ref.startsWith(rule.prefix)) {\n const provider = this.providers.get(rule.provider_id);\n if (provider) return provider;\n }\n }\n }\n\n // Fall back to default\n const provider = this.providers.get(this.config.default_provider);\n if (!provider) {\n throw new ProviderUnavailableError(\n this.config.default_provider,\n `No provider registered for default id \"${this.config.default_provider}\"`,\n );\n }\n return provider;\n }\n\n // -- Delegated operations --------------------------------------------------\n\n async getSecret(ref: string): Promise<Uint8Array> {\n const provider = this.resolve(ref);\n this.emit(ref, \"get\", provider.id);\n return provider.getSecret(ref);\n }\n\n async setSecret(ref: string, value: Uint8Array, opts?: SetSecretOptions): Promise<void> {\n const provider = this.resolve(ref);\n this.emit(ref, \"set\", provider.id);\n return provider.setSecret(ref, value, opts);\n }\n\n async deleteSecret(ref: string): Promise<void> {\n const provider = this.resolve(ref);\n this.emit(ref, \"delete\", provider.id);\n return provider.deleteSecret(ref);\n }\n\n async listSecrets(filter?: ListFilter): Promise<string[]> {\n // List aggregates from the default provider only (per-provider listing\n // would require iterating all providers; deferred to Phase 3 with\n // federated catalogs).\n const provider = this.providers.get(this.config.default_provider);\n if (!provider) return [];\n this.emit(\"*\", \"list\", provider.id);\n return provider.listSecrets(filter);\n }\n\n async getMetadata(ref: string): Promise<SecretMetadata> {\n const provider = this.resolve(ref);\n this.emit(ref, \"metadata\", provider.id);\n return provider.getMetadata(ref);\n }\n\n getCapabilities(providerId?: string): ProviderCapabilities | null {\n const id = providerId ?? this.config.default_provider;\n const provider = this.providers.get(id);\n return provider?.getCapabilities() ?? null;\n }\n\n async testConnection(\n providerId?: string,\n ): Promise<{ ok: boolean; latencyMs?: number; error?: string }> {\n const id = providerId ?? this.config.default_provider;\n const provider = this.providers.get(id);\n if (!provider) {\n return { ok: false, error: `Provider \"${id}\" not registered` };\n }\n return provider.testConnection();\n }\n}\n","/** Package version of `@skaile/secrets`. */\nexport const VERSION = \"0.0.0\";\n\n// Re-export interface + errors from plugins (convenience for consumers)\nexport type {\n ISecretsProvider,\n ListFilter,\n ProviderCapabilities,\n SecretMetadata,\n SetSecretOptions,\n} from \"@skaile/workspaces/plugins\";\nexport {\n ProviderUnavailableError,\n SecretAccessDeniedError,\n SecretExpiredError,\n SecretNotFoundError,\n SecretsError,\n} from \"@skaile/workspaces/plugins\";\nexport type { CredentialLifecycleConfig, RefreshResult } from \"./lifecycle.js\";\n// Lifecycle\nexport { CredentialLifecycleService } from \"./lifecycle.js\";\nexport { EnvSecretsProvider } from \"./providers/env.js\";\nexport type { KeyStrategy } from \"./providers/local.js\";\n// Built-in providers\nexport { LocalSecretsProvider } from \"./providers/local.js\";\nexport type { AuditSink, CredentialAccessed, RoutingRule, SecretsRouterConfig } from \"./router.js\";\n// Router\nexport { SecretsRouter } from \"./router.js\";\n"]}
1
+ {"version":3,"sources":["../secrets/src/lifecycle.ts","../secrets/src/providers/env.ts","../secrets/src/providers/local.ts","../secrets/src/router.ts","../secrets/src/index.ts"],"names":["provider"],"mappings":";;;;;;;;AAuCO,IAAM,6BAAN,MAAiC;AAAA,EAC9B,MAAA;AAAA;AAAA;AAAA;AAAA,EAKR,WAAA,CAAY,QAAuB,OAAA,EAA8C;AAC/E,IAAA,IAAA,CAAK,MAAA,GAAS,MAAA;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,gBAAgB,aAAA,EAA+C;AAGnE,IAAA,IAAI;AACF,MAAA,MAAM,IAAA,CAAK,MAAA,CAAO,WAAA,CAAY,aAAa,CAAA;AAC3C,MAAA,OAAO,EAAE,SAAA,EAAW,KAAA,EAAO,MAAA,EAAQ,gBAAA,EAAiB;AAAA,IACtD,CAAA,CAAA,MAAQ;AACN,MAAA,OAAO,EAAE,SAAA,EAAW,KAAA,EAAO,MAAA,EAAQ,gBAAA,EAAkB,OAAO,sBAAA,EAAuB;AAAA,IACrF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,QAAQ,aAAA,EAAyC;AACrD,IAAA,IAAI;AACF,MAAA,MAAM,IAAA,CAAK,MAAA,CAAO,SAAA,C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QAAA,GAAW,IAAA,CAAK,OAAA,CAAQ,GAAG,CAAA;AACjC,IAAA,IAAA,CAAK,IAAA,CAAK,GAAA,EAAK,UAAA,EAAY,QAAA,CAAS,EAAE,CAAA;AACtC,IAAA,OAAO,QAAA,CAAS,YAAY,GAAG,CAAA;AAAA,EACjC;AAAA,EAEA,gBAAgB,UAAA,EAAkD;AAChE,IAAA,MAAM,EAAA,GAAK,UAAA,IAAc,IAAA,CAAK,MAAA,CAAO,gBAAA;AACrC,IAAA,MAAM,QAAA,GAAW,IAAA,CAAK,SAAA,CAAU,GAAA,CAAI,EAAE,CAAA;AACtC,IAAA,OAAO,QAAA,EAAU,iBAAgB,IAAK,IAAA;AAAA,EACxC;AAAA,EAEA,MAAM,eACJ,UAAA,EAC8D;AAC9D,IAAA,MAAM,EAAA,GAAK,UAAA,IAAc,IAAA,CAAK,MAAA,CAAO,gBAAA;AACrC,IAAA,MAAM,QAAA,GAAW,IAAA,CAAK,SAAA,CAAU,GAAA,CAAI,EAAE,CAAA;AACtC,IAAA,IAAI,CAAC,QAAA,EAAU;AACb,MAAA,OAAO,EAAE,EAAA,EAAI,KAAA,EAAO,KAAA,EAAO,CAAA,UAAA,EAAa,EAAE,CAAA,gBAAA,CAAA,EAAmB;AAAA,IAC/D;AACA,IAAA,OAAO,SAAS,cAAA,EAAe;AAAA,EACjC;AACF;;;ACvNO,IAAM,OAAA,GAAU","file":"chunk-HTKZ4AOW.js","sourcesContent":["/**\n * CredentialLifecycleService — manages OAuth token refresh outside the SecretsRouter.\n *\n * Works with opaque token blobs stored via the {@link SecretsRouter}; providers remain\n * OAuth-unaware. Phase 1 ships non-OAuth paths (always returns `not_applicable`).\n * Full proactive OAuth refresh with expiry checking ships in Phase 3.4.\n *\n * @docLink packages/secrets/concepts#credential-lifecycle\n */\n\nimport type { SecretsRouter } from \"./router.js\";\n\n/**\n * Configuration for {@link CredentialLifecycleService}.\n *\n * Controls how aggressively the service proactively refreshes credentials before they expire.\n * The default lead time is 300 seconds (5 minutes).\n *\n * @docLink packages/secrets/concepts#credential-lifecycle\n */\nexport interface CredentialLifecycleConfig {\n /** How far before expiry to trigger a proactive refresh (seconds). */\n refreshLeadTimeSec: number;\n}\n\n/**\n * Result returned by {@link CredentialLifecycleService.refreshIfNeeded}.\n *\n * The `reason` discriminant indicates why a refresh did or did not occur.\n * An `error` string is present only when `reason` is `refresh_failed`.\n *\n * @docLink packages/secrets/concepts#credential-lifecycle\n */\nexport interface RefreshResult {\n refreshed: boolean;\n reason: \"not_applicable\" | \"still_valid\" | \"refreshed\" | \"refresh_failed\";\n error?: string;\n}\n\nexport class CredentialLifecycleService {\n private router: SecretsRouter;\n\n // `_config` is accepted for signature stability but not stored yet: Phase 1\n // ships no OAuth refresh, so there is nothing to configure. Phase 3.4 will\n // store and read `refreshLeadTimeSec` when proactive refresh lands.\n constructor(router: SecretsRouter, _config?: Partial<CredentialLifecycleConfig>) {\n this.router = router;\n }\n\n /**\n * Attempt to refresh a credential if needed.\n * Phase 1: always returns not_applicable (no OAuth support yet).\n */\n async refreshIfNeeded(credentialRef: string): Promise<RefreshResult> {\n // Phase 1: no OAuth refresh implemented.\n // The credential exists and is valid as-is (static secrets, env vars, etc.)\n try {\n await this.router.getMetadata(credentialRef);\n return { refreshed: false, reason: \"not_applicable\" };\n } catch {\n return { refreshed: false, reason: \"refresh_failed\", error: \"Credential not found\" };\n }\n }\n\n /**\n * Check if a credential is still valid (not expired).\n * Phase 1: always returns true for non-OAuth credentials.\n */\n async isValid(credentialRef: string): Promise<boolean> {\n try {\n await this.router.getSecret(credentialRef);\n return true;\n } catch {\n return false;\n }\n }\n}\n","/**\n * EnvSecretsProvider — read-only provider that resolves secrets from environment variables.\n *\n * Refs are expected to be plain env var names (e.g. `DATABASE_URL`). The provider is\n * always available with zero configuration and requires no encryption or keychain access.\n * `setSecret` and `deleteSecret` always throw `SecretAccessDeniedError` because\n * environment variables are managed externally to the running process.\n *\n * @docLink packages/secrets/concepts#env-secrets-provider\n */\n\nimport type {\n ISecretsProvider,\n ListFilter,\n ProviderCapabilities,\n SecretMetadata,\n SetSecretOptions,\n} from \"@skaile/workspaces/plugins\";\nimport { SecretAccessDeniedError, SecretNotFoundError } from \"@skaile/workspaces/plugins\";\n\n/**\n * Sentinel timestamp for env secrets, which have no real created/updated time.\n * The Unix epoch is unambiguously not \"now\", so consumers can recognise it as\n * \"unknown\" rather than treating it as a genuine recent timestamp.\n */\nconst ENV_UNKNOWN_TIMESTAMP = new Date(0);\n\nexport class EnvSecretsProvider implements ISecretsProvider {\n readonly id = \"env\";\n\n async getSecret(ref: string): Promise<Uint8Array> {\n const value = process.env[ref];\n if (value === undefined) {\n throw new SecretNotFoundError(ref);\n }\n return new TextEncoder().encode(value);\n }\n\n async setSecret(_ref: string, _value: Uint8Array, _opts?: SetSecretOptions): Promise<void> {\n throw new SecretAccessDeniedError(\"EnvSecretsProvider is read-only\");\n }\n\n async deleteSecret(_ref: string): Promise<void> {\n throw new SecretAccessDeniedError(\"EnvSecretsProvider is read-only\");\n }\n\n async listSecrets(filter?: ListFilter): Promise<string[]> {\n let keys = Object.keys(process.env);\n if (filter?.prefix) {\n keys = keys.filter((k) => k.startsWith(filter.prefix!));\n }\n if (filter?.limit) {\n keys = keys.slice(0, filter.limit);\n }\n return keys;\n }\n\n async testConnection(): Promise<{ ok: boolean; latencyMs?: number; error?: string }> {\n return { ok: true, latencyMs: 0 };\n }\n\n async getMetadata(ref: string): Promise<SecretMetadata> {\n const value = process.env[ref];\n if (value === undefined) {\n throw new SecretNotFoundError(ref);\n }\n // Env vars carry no creation/modification time. `SecretMetadata` requires\n // both fields, so use the Unix epoch as a documented \"unknown\" sentinel\n // rather than `new Date()`, which would falsely imply the secret was just\n // created/updated. The read-only scope summary already signals the source.\n return {\n ref,\n createdAt: ENV_UNKNOWN_TIMESTAMP,\n updatedAt: ENV_UNKNOWN_TIMESTAMP,\n scopeSummary: \"environment variable (read-only)\",\n };\n }\n\n getCapabilities(): ProviderCapabilities {\n return {\n supportsRotation: false,\n supportsExpiry: false,\n supportsBatch: false,\n scopeModel: \"flat\",\n };\n }\n}\n","/**\n * LocalSecretsProvider — AES-256-GCM encrypted file-blob storage at `~/.skaile/secrets/`.\n *\n * Each secret is stored as a separate `.enc` file named by the SHA-256 hash of the ref\n * (collision-free, filesystem-safe). A companion `.meta.json` stores the original ref,\n * timestamps, and optional user metadata. The master key is derived via PBKDF2-SHA-512\n * from one of three {@link KeyStrategy} sources: OS keychain (keytar), a passphrase from\n * `SKAILE_SECRETS_PASSPHRASE`, or a machine-derived passphrase as last resort.\n * Switching strategies re-encrypts all existing secrets with the new key.\n *\n * @docLink packages/secrets/concepts#local-secrets-provider\n */\n\nimport * as crypto from \"node:crypto\";\nimport * as fs from \"node:fs\";\nimport * as os from \"node:os\";\nimport * as path from \"node:path\";\n\n// The narrow module, not the `core` barrel: the barrel's chunks use `import.meta`,\n// which CommonJS-transpiling consumers (ts-jest) cannot load.\nimport { globalSkaileDir } from \"../../../core/src/cache-paths.js\";\nimport type {\n ISecretsProvider,\n ListFilter,\n ProviderCapabilities,\n SecretMetadata,\n SetSecretOptions,\n} from \"@skaile/workspaces/plugins\";\nimport {\n ProviderUnavailableError,\n SecretNotFoundError,\n SecretsError,\n} from \"@skaile/workspaces/plugins\";\n\n// ---------------------------------------------------------------------------\n// Constants\n// ---------------------------------------------------------------------------\n\nconst ALGORITHM = \"aes-256-gcm\";\nconst IV_LENGTH = 12;\nconst AUTH_TAG_LENGTH = 16;\nconst SALT_LENGTH = 32;\nconst KEY_LENGTH = 32;\nconst PBKDF2_ITERATIONS = 100_000;\nconst PBKDF2_DIGEST = \"sha512\";\n\nconst KEYCHAIN_SERVICE = \"skaile-secrets\";\nconst KEYCHAIN_ACCOUNT = \"master-key\";\n\n/** Env var that provides the passphrase at runtime (never stored on disk). */\nconst PASSPHRASE_ENV = \"SKAILE_SECRETS_PASSPHRASE\";\n\n/**\n * Master key derivation strategy used by {@link LocalSecretsProvider}.\n *\n * - `keychain` — OS keychain (via keytar); most secure, requires keytar to be installed.\n * - `passphrase` — PBKDF2 from `SKAILE_SECRETS_PASSPHRASE` env var; portable across machines.\n * - `machine` — deterministic from hostname + username; least secure, last-resort fallback.\n *\n * The active strategy is persisted in `~/.skaile/secrets/.key-strategy`. Switching strategies\n * re-encrypts all existing secrets with the new key.\n *\n * @docLink packages/secrets/concepts#local-secrets-provider\n */\nexport type KeyStrategy = \"keychain\" | \"passphrase\" | \"machine\";\n\n// ---------------------------------------------------------------------------\n// Key derivation\n// ---------------------------------------------------------------------------\n\nfunction deriveMasterKey(passphrase: string, salt: Buffer): Buffer {\n return crypto.pbkdf2Sync(passphrase, salt, PBKDF2_ITERATIONS, KEY_LENGTH, PBKDF2_DIGEST);\n}\n\nfunction getMachinePassphrase(): string {\n // Deterministic but not secret -- last resort only.\n return `skaile:${os.hostname()}:${os.userInfo().username}`;\n}\n\n/** Hash a passphrase for verification (stored in .master). */\nfunction hashPassphrase(passphrase: string): string {\n return crypto.createHash(\"sha256\").update(passphrase).digest(\"hex\");\n}\n\n// ---------------------------------------------------------------------------\n// Filename hashing (injective: sha256 of ref)\n// ---------------------------------------------------------------------------\n\nfunction refToHash(ref: string): string {\n return crypto.createHash(\"sha256\").update(ref).digest(\"hex\").slice(0, 40);\n}\n\n// ---------------------------------------------------------------------------\n// Encryption / decryption\n// ---------------------------------------------------------------------------\n\nfunction encrypt(data: Uint8Array, key: Buffer): Buffer {\n const iv = crypto.randomBytes(IV_LENGTH);\n const cipher = crypto.createCipheriv(ALGORITHM, key, iv, { authTagLength: AUTH_TAG_LENGTH });\n const encrypted = Buffer.concat([cipher.update(data), cipher.final()]);\n const authTag = cipher.getAuthTag();\n // Format: [iv (12)] [authTag (16)] [ciphertext (...)]\n return Buffer.concat([iv, authTag, encrypted]);\n}\n\nfunction decrypt(blob: Buffer, key: Buffer): Buffer {\n const iv = blob.subarray(0, IV_LENGTH);\n const authTag = blob.subarray(IV_LENGTH, IV_LENGTH + AUTH_TAG_LENGTH);\n const ciphertext = blob.subarray(IV_LENGTH + AUTH_TAG_LENGTH);\n const decipher = crypto.createDecipheriv(ALGORITHM, key, iv, { authTagLength: AUTH_TAG_LENGTH });\n decipher.setAuthTag(authTag);\n return Buffer.concat([decipher.update(ciphertext), decipher.final()]);\n}\n\n// ---------------------------------------------------------------------------\n// Provider\n// ---------------------------------------------------------------------------\n\nexport class LocalSecretsProvider implements ISecretsProvider {\n readonly id = \"local\";\n private secretsDir: string;\n private masterKey: Buffer | null = null;\n private salt: Buffer | null = null;\n private strategy: KeyStrategy = \"machine\";\n\n constructor(secretsDir?: string) {\n this.secretsDir = secretsDir ?? path.join(globalSkaileDir(), \"secrets\");\n }\n\n // -- Initialization --------------------------------------------------------\n\n private ensureDir(): void {\n if (!fs.existsSync(this.secretsDir)) {\n fs.mkdirSync(this.secretsDir, { recursive: true, mode: 0o700 });\n }\n }\n\n private loadOrCreateSalt(): Buffer {\n const saltPath = path.join(this.secretsDir, \".salt\");\n if (fs.existsSync(saltPath)) {\n return fs.readFileSync(saltPath);\n }\n const salt = crypto.randomBytes(SALT_LENGTH);\n fs.writeFileSync(saltPath, salt, { mode: 0o600 });\n return salt;\n }\n\n private async ensureKey(): Promise<void> {\n if (this.masterKey) return;\n\n this.ensureDir();\n this.salt = this.loadOrCreateSalt();\n\n // Determine strategy\n const strategyPath = path.join(this.secretsDir, \".key-strategy\");\n if (fs.existsSync(strategyPath)) {\n this.strategy = fs.readFileSync(strategyPath, \"utf-8\").trim() as KeyStrategy;\n } else {\n // Auto-detect: try keychain, fall back to machine\n this.strategy = (await this.tryKeychainStrategy()) ? \"keychain\" : \"machine\";\n fs.writeFileSync(strategyPath, this.strategy, { mode: 0o600 });\n }\n\n // Derive key from strategy\n const passphrase = await this.getPassphraseForStrategy(this.strategy);\n this.masterKey = deriveMasterKey(passphrase, this.salt);\n }\n\n private async tryKeychainStrategy(): Promise<boolean> {\n try {\n // `keytar` is an optional OS-keychain native module the user installs\n // themselves; the `as string` specifier keeps it out of tsc resolution.\n const keytar = await import(\"keytar\" as string);\n let stored = await keytar.getPassword(KEYCHAIN_SERVICE, KEYCHAIN_ACCOUNT);\n if (!stored) {\n stored = crypto.randomBytes(32).toString(\"base64\");\n await keytar.setPassword(KEYCHAIN_SERVICE, KEYCHAIN_ACCOUNT, stored);\n }\n return true;\n } catch {\n return false;\n }\n }\n\n private async getPassphraseForStrategy(strategy: KeyStrategy): Promise<string> {\n switch (strategy) {\n case \"keychain\": {\n try {\n // `keytar` is an optional OS-keychain native module the user installs\n // themselves; the `as string` specifier keeps it out of tsc resolution.\n const keytar = await import(\"keytar\" as string);\n const stored = await keytar.getPassword(KEYCHAIN_SERVICE, KEYCHAIN_ACCOUNT);\n if (stored) return stored;\n } catch {\n // Keychain failed; fall through to machine\n }\n return getMachinePassphrase();\n }\n case \"passphrase\": {\n const envPassphrase = process.env[PASSPHRASE_ENV];\n if (envPassphrase) {\n // Verify against stored hash if it exists\n const masterPath = path.join(this.secretsDir, \".master\");\n if (fs.existsSync(masterPath)) {\n const storedHash = fs.readFileSync(masterPath, \"utf-8\").trim();\n if (hashPassphrase(envPassphrase) !== storedHash) {\n throw new SecretsError(\n `Passphrase from ${PASSPHRASE_ENV} does not match stored hash. ` +\n \"Use skaile auth set-key-strategy passphrase to reset.\",\n \"PASSPHRASE_MISMATCH\",\n );\n }\n }\n return envPassphrase;\n }\n // No env var -- hard error. Silent fallback to machine would\n // produce a different key, causing AES-GCM auth-tag failures\n // on secrets encrypted with the real passphrase.\n throw new SecretsError(\n `Strategy is \"passphrase\" but ${PASSPHRASE_ENV} is not set. ` +\n `Export it before running: export ${PASSPHRASE_ENV}='...'`,\n \"PASSPHRASE_REQUIRED\",\n );\n }\n case \"machine\":\n return getMachinePassphrase();\n default:\n return getMachinePassphrase();\n }\n }\n\n // -- Strategy management ---------------------------------------------------\n\n /**\n * Set the key strategy explicitly. Called by `skaile auth set-key-strategy`.\n *\n * When existing secrets are present, they are re-encrypted with the new key\n * to prevent data loss from key mismatch.\n */\n async setKeyStrategy(strategy: KeyStrategy, passphrase?: string): Promise<void> {\n this.ensureDir();\n\n // --- 1. Validate new strategy prerequisites -------------------------\n\n const effectivePassphrase = passphrase ?? process.env[PASSPHRASE_ENV];\n\n if (strategy === \"passphrase\") {\n if (!effectivePassphrase) {\n throw new SecretsError(\n `Passphrase required. Pass it as an argument or set ${PASSPHRASE_ENV}.`,\n \"PASSPHRASE_REQUIRED\",\n );\n }\n }\n\n if (strategy === \"keychain\") {\n const success = await this.tryKeychainStrategy();\n if (!success) {\n throw new ProviderUnavailableError(\"local\", \"OS keychain not available\");\n }\n }\n\n // --- 2. Load the OLD key under the current strategy -----------------\n // ensureKey() reads the current strategy file and derives the key\n // that was used to encrypt existing secrets. This is critical for\n // cross-process scenarios where masterKey starts as null.\n\n const encFiles = this.listEncFiles();\n if (encFiles.length > 0) {\n await this.ensureKey();\n const oldKey = this.masterKey!;\n\n // Derive the new key\n const salt = this.salt!;\n const newPassphrase =\n strategy === \"passphrase\"\n ? effectivePassphrase!\n : strategy === \"keychain\"\n ? await this.getPassphraseForStrategy(\"keychain\")\n : getMachinePassphrase();\n const newKey = deriveMasterKey(newPassphrase, salt);\n\n // Re-encrypt each secret with the new key. A single failure must abort the\n // whole switch: committing the new strategy while a secret is still under\n // the old key orphans that secret (the registry advertises a key that no\n // longer decrypts it). Collect failures and throw before the commit below,\n // leaving `.key-strategy`/`.master` — and every secret — on the old key.\n const failed: string[] = [];\n for (const encFile of encFiles) {\n const filePath = path.join(this.secretsDir, encFile);\n const blob = fs.readFileSync(filePath);\n try {\n const plaintext = decrypt(blob, oldKey);\n const reEncrypted = encrypt(plaintext, newKey);\n fs.writeFileSync(filePath, reEncrypted, { mode: 0o600 });\n } catch {\n failed.push(encFile);\n }\n }\n if (failed.length > 0) {\n throw new Error(\n `[skaile/secrets] Key-strategy switch aborted: could not re-encrypt ` +\n `${failed.length} secret(s) (${failed.join(\", \")}). The previous strategy ` +\n \"is unchanged; resolve the failing secrets before retrying.\",\n );\n }\n }\n\n // --- 3. Commit the new strategy (last write -- failure above leaves\n // the old strategy intact) ------------------------------------\n\n if (strategy === \"passphrase\") {\n const masterPath = path.join(this.secretsDir, \".master\");\n fs.writeFileSync(masterPath, hashPassphrase(effectivePassphrase!), { mode: 0o600 });\n }\n\n const strategyPath = path.join(this.secretsDir, \".key-strategy\");\n fs.writeFileSync(strategyPath, strategy, { mode: 0o600 });\n this.masterKey = null;\n this.strategy = strategy;\n }\n\n getKeyStrategy(): KeyStrategy {\n const strategyPath = path.join(this.secretsDir, \".key-strategy\");\n if (fs.existsSync(strategyPath)) {\n return fs.readFileSync(strategyPath, \"utf-8\").trim() as KeyStrategy;\n }\n return \"machine\";\n }\n\n // -- File helpers ----------------------------------------------------------\n\n private encFilename(ref: string): string {\n return `${refToHash(ref)}.enc`;\n }\n\n private metaFilename(ref: string): string {\n return `${refToHash(ref)}.meta.json`;\n }\n\n private metaPath(ref: string): string {\n return path.join(this.secretsDir, this.metaFilename(ref));\n }\n\n private listEncFiles(): string[] {\n if (!fs.existsSync(this.secretsDir)) return [];\n return fs.readdirSync(this.secretsDir).filter((f) => f.endsWith(\".enc\"));\n }\n\n // -- ISecretsProvider implementation ----------------------------------------\n\n async getSecret(ref: string): Promise<Uint8Array> {\n await this.ensureKey();\n const filePath = path.join(this.secretsDir, this.encFilename(ref));\n if (!fs.existsSync(filePath)) {\n throw new SecretNotFoundError(ref);\n }\n const blob = fs.readFileSync(filePath);\n const decrypted = decrypt(blob, this.masterKey!);\n\n // Update lastAccessedAt\n const metaFile = this.metaPath(ref);\n if (fs.existsSync(metaFile)) {\n try {\n const meta = JSON.parse(fs.readFileSync(metaFile, \"utf-8\"));\n meta.lastAccessedAt = new Date().toISOString();\n fs.writeFileSync(metaFile, JSON.stringify(meta), { mode: 0o600 });\n } catch {\n // Non-fatal\n }\n }\n\n return new Uint8Array(decrypted);\n }\n\n async setSecret(ref: string, value: Uint8Array, opts?: SetSecretOptions): Promise<void> {\n await this.ensureKey();\n this.ensureDir();\n const filePath = path.join(this.secretsDir, this.encFilename(ref));\n const encrypted = encrypt(value, this.masterKey!);\n fs.writeFileSync(filePath, encrypted, { mode: 0o600 });\n\n // Write metadata (stores the original ref for reverse lookup)\n const now = new Date().toISOString();\n const metaFile = this.metaPath(ref);\n let existing: Record<string, unknown> = {};\n if (fs.existsSync(metaFile)) {\n try {\n existing = JSON.parse(fs.readFileSync(metaFile, \"utf-8\"));\n } catch {\n // Overwrite corrupt meta\n }\n }\n const meta = {\n ref,\n createdAt: existing.createdAt ?? now,\n updatedAt: now,\n lastAccessedAt: now,\n ...(opts?.metadata ? { userMeta: opts.metadata } : {}),\n ...(opts?.ttlSeconds\n ? { expiresAt: new Date(Date.now() + opts.ttlSeconds * 1000).toISOString() }\n : {}),\n };\n fs.writeFileSync(metaFile, JSON.stringify(meta, null, 2), { mode: 0o600 });\n }\n\n async deleteSecret(ref: string): Promise<void> {\n const filePath = path.join(this.secretsDir, this.encFilename(ref));\n const metaFile = this.metaPath(ref);\n if (!fs.existsSync(filePath)) {\n throw new SecretNotFoundError(ref);\n }\n fs.unlinkSync(filePath);\n if (fs.existsSync(metaFile)) {\n fs.unlinkSync(metaFile);\n }\n }\n\n async listSecrets(filter?: ListFilter): Promise<string[]> {\n this.ensureDir();\n // Read refs from meta files (the .enc filenames are hashes, not refs)\n const metaFiles = fs.readdirSync(this.secretsDir).filter((f) => f.endsWith(\".meta.json\"));\n let refs: string[] = [];\n for (const mf of metaFiles) {\n try {\n const meta = JSON.parse(fs.readFileSync(path.join(this.secretsDir, mf), \"utf-8\"));\n if (meta.ref) refs.push(meta.ref);\n } catch {\n // Skip corrupt meta files\n }\n }\n if (filter?.prefix) {\n refs = refs.filter((r) => r.startsWith(filter.prefix!));\n }\n if (filter?.limit) {\n refs = refs.slice(0, filter.limit);\n }\n return refs;\n }\n\n async testConnection(): Promise<{ ok: boolean; latencyMs?: number; error?: string }> {\n const start = Date.now();\n try {\n await this.ensureKey();\n // Write + read + delete a test secret\n const testRef = `__test_${crypto.randomBytes(4).toString(\"hex\")}`;\n const testValue = new TextEncoder().encode(\"test\");\n await this.setSecret(testRef, testValue);\n const read = await this.getSecret(testRef);\n await this.deleteSecret(testRef);\n if (new TextDecoder().decode(read) !== \"test\") {\n return { ok: false, error: \"Round-trip mismatch\" };\n }\n return { ok: true, latencyMs: Date.now() - start };\n } catch (e) {\n return {\n ok: false,\n latencyMs: Date.now() - start,\n error: e instanceof Error ? e.message : String(e),\n };\n }\n }\n\n async getMetadata(ref: string): Promise<SecretMetadata> {\n const metaFile = this.metaPath(ref);\n const filePath = path.join(this.secretsDir, this.encFilename(ref));\n if (!fs.existsSync(filePath)) {\n throw new SecretNotFoundError(ref);\n }\n if (fs.existsSync(metaFile)) {\n const raw = JSON.parse(fs.readFileSync(metaFile, \"utf-8\"));\n return {\n ref: raw.ref ?? ref,\n createdAt: new Date(raw.createdAt),\n updatedAt: new Date(raw.updatedAt),\n lastAccessedAt: raw.lastAccessedAt ? new Date(raw.lastAccessedAt) : undefined,\n owner: raw.owner,\n scopeSummary: \"local encrypted file\",\n };\n }\n // Fallback: derive from file stat\n const stat = fs.statSync(filePath);\n return {\n ref,\n createdAt: stat.birthtime,\n updatedAt: stat.mtime,\n scopeSummary: \"local encrypted file\",\n };\n }\n\n getCapabilities(): ProviderCapabilities {\n return {\n supportsRotation: false,\n supportsExpiry: false,\n supportsBatch: false,\n scopeModel: \"flat\",\n };\n }\n}\n","/**\n * SecretsRouter — audit chokepoint for all secret operations.\n *\n * Registers {@link ISecretsProvider} implementations by id, routes credential refs by\n * prefix or via routing config, and emits {@link CredentialAccessed} events for every\n * get, set, delete, list, and metadata operation. Routing rules are evaluated top-to-bottom;\n * the first matching prefix wins and falls back to the configured default provider.\n *\n * @docLink packages/secrets/concepts#secrets-router\n */\n\nimport type {\n ISecretsProvider,\n ListFilter,\n ProviderCapabilities,\n SecretMetadata,\n SetSecretOptions,\n} from \"@skaile/workspaces/plugins\";\nimport { ProviderUnavailableError } from \"@skaile/workspaces/plugins\";\n\n// ---------------------------------------------------------------------------\n// Audit event\n// ---------------------------------------------------------------------------\n\n/**\n * Audit event emitted by {@link SecretsRouter} after every secret operation.\n *\n * Delivered synchronously to all registered {@link AuditSink} functions. Errors thrown\n * by sinks are swallowed to ensure they never break the underlying secret operation.\n *\n * @docLink packages/secrets/concepts#secrets-router\n */\nexport interface CredentialAccessed {\n credential_ref: string;\n operation: \"get\" | \"set\" | \"delete\" | \"list\" | \"metadata\";\n provider_id: string;\n caller_session_id?: string;\n caller_tool_call?: string;\n timestamp: Date;\n}\n\n/**\n * Callback function that receives {@link CredentialAccessed} audit events from {@link SecretsRouter}.\n *\n * Register sinks via `SecretsRouter.addSink()`. Sinks run synchronously after each operation;\n * exceptions are caught and suppressed so they cannot interrupt credential resolution.\n *\n * @docLink packages/secrets/concepts#secrets-router\n */\nexport type AuditSink = (event: CredentialAccessed) => void;\n\n// ---------------------------------------------------------------------------\n// Routing config\n// ---------------------------------------------------------------------------\n\n/**\n * A single routing rule that maps a credential ref prefix to a provider.\n *\n * Rules in {@link SecretsRouterConfig.rules} are evaluated top-to-bottom;\n * the first rule whose `prefix` matches the start of the credential ref wins.\n *\n * @docLink packages/secrets/concepts#secrets-router\n */\nexport interface RoutingRule {\n /** Prefix match on credential_ref. First match wins. */\n prefix: string;\n /** Provider id to route to. */\n provider_id: string;\n}\n\n/**\n * Configuration object for {@link SecretsRouter}.\n *\n * Specifies the default provider id used when no routing rule matches, and an optional\n * ordered list of {@link RoutingRule} entries for prefix-based routing.\n *\n * @docLink packages/secrets/concepts#secrets-router\n */\nexport interface SecretsRouterConfig {\n /** Default provider id when no routing rule matches. */\n default_provider: string;\n /** Ordered routing rules. Evaluated top-to-bottom; first prefix match wins. */\n rules?: RoutingRule[];\n}\n\n// ---------------------------------------------------------------------------\n// Router\n// ---------------------------------------------------------------------------\n\nexport class SecretsRouter {\n private providers = new Map<string, ISecretsProvider>();\n private config: SecretsRouterConfig;\n private sinks: AuditSink[] = [];\n\n /** Caller context for audit events (set per-request by the runner). */\n callerSessionId?: string;\n callerToolCall?: string;\n\n constructor(config: SecretsRouterConfig) {\n this.config = config;\n }\n\n // -- Provider registration ------------------------------------------------\n\n register(provider: ISecretsProvider): void {\n this.providers.set(provider.id, provider);\n }\n\n unregister(id: string): void {\n this.providers.delete(id);\n }\n\n listProviders(): string[] {\n return [...this.providers.keys()];\n }\n\n // -- Audit sinks -----------------------------------------------------------\n\n addSink(sink: AuditSink): void {\n this.sinks.push(sink);\n }\n\n private emit(ref: string, operation: CredentialAccessed[\"operation\"], providerId: string): void {\n const event: CredentialAccessed = {\n credential_ref: ref,\n operation,\n provider_id: providerId,\n caller_session_id: this.callerSessionId,\n caller_tool_call: this.callerToolCall,\n timestamp: new Date(),\n };\n for (const sink of this.sinks) {\n try {\n sink(event);\n } catch {\n // Audit sink errors must not break the secret operation.\n }\n }\n }\n\n // -- Routing ---------------------------------------------------------------\n\n private resolve(ref: string): ISecretsProvider {\n // Check routing rules first\n if (this.config.rules) {\n for (const rule of this.config.rules) {\n if (ref.startsWith(rule.prefix)) {\n const provider = this.providers.get(rule.provider_id);\n if (provider) return provider;\n }\n }\n }\n\n // Fall back to default\n const provider = this.providers.get(this.config.default_provider);\n if (!provider) {\n throw new ProviderUnavailableError(\n this.config.default_provider,\n `No provider registered for default id \"${this.config.default_provider}\"`,\n );\n }\n return provider;\n }\n\n // -- Delegated operations --------------------------------------------------\n\n async getSecret(ref: string): Promise<Uint8Array> {\n const provider = this.resolve(ref);\n this.emit(ref, \"get\", provider.id);\n return provider.getSecret(ref);\n }\n\n async setSecret(ref: string, value: Uint8Array, opts?: SetSecretOptions): Promise<void> {\n const provider = this.resolve(ref);\n this.emit(ref, \"set\", provider.id);\n return provider.setSecret(ref, value, opts);\n }\n\n async deleteSecret(ref: string): Promise<void> {\n const provider = this.resolve(ref);\n this.emit(ref, \"delete\", provider.id);\n return provider.deleteSecret(ref);\n }\n\n async listSecrets(filter?: ListFilter): Promise<string[]> {\n // List aggregates from the default provider only (per-provider listing\n // would require iterating all providers; deferred to Phase 3 with\n // federated catalogs).\n const provider = this.providers.get(this.config.default_provider);\n if (!provider) return [];\n this.emit(\"*\", \"list\", provider.id);\n return provider.listSecrets(filter);\n }\n\n async getMetadata(ref: string): Promise<SecretMetadata> {\n const provider = this.resolve(ref);\n this.emit(ref, \"metadata\", provider.id);\n return provider.getMetadata(ref);\n }\n\n getCapabilities(providerId?: string): ProviderCapabilities | null {\n const id = providerId ?? this.config.default_provider;\n const provider = this.providers.get(id);\n return provider?.getCapabilities() ?? null;\n }\n\n async testConnection(\n providerId?: string,\n ): Promise<{ ok: boolean; latencyMs?: number; error?: string }> {\n const id = providerId ?? this.config.default_provider;\n const provider = this.providers.get(id);\n if (!provider) {\n return { ok: false, error: `Provider \"${id}\" not registered` };\n }\n return provider.testConnection();\n }\n}\n","/** Package version of `@skaile/secrets`. */\nexport const VERSION = \"0.0.0\";\n\n// Re-export interface + errors from plugins (convenience for consumers)\nexport type {\n ISecretsProvider,\n ListFilter,\n ProviderCapabilities,\n SecretMetadata,\n SetSecretOptions,\n} from \"@skaile/workspaces/plugins\";\nexport {\n ProviderUnavailableError,\n SecretAccessDeniedError,\n SecretExpiredError,\n SecretNotFoundError,\n SecretsError,\n} from \"@skaile/workspaces/plugins\";\nexport type { CredentialLifecycleConfig, RefreshResult } from \"./lifecycle.js\";\n// Lifecycle\nexport { CredentialLifecycleService } from \"./lifecycle.js\";\nexport { EnvSecretsProvider } from \"./providers/env.js\";\nexport type { KeyStrategy } from \"./providers/local.js\";\n// Built-in providers\nexport { LocalSecretsProvider } from \"./providers/local.js\";\nexport type { AuditSink, CredentialAccessed, RoutingRule, SecretsRouterConfig } from \"./router.js\";\n// Router\nexport { SecretsRouter } from \"./router.js\";\n"]}
@@ -1,4 +1,4 @@
1
- import { withFsDeadline, tryWithFsDeadline, walkDir } from './chunk-YANDJSMN.js';
1
+ import { withFsDeadline, tryWithFsDeadline, walkDir } from './chunk-LFMX2UEF.js';
2
2
  import { createLogger } from './chunk-BOFL7GIF.js';
3
3
  import { parse } from 'yaml';
4
4
  import { readFile, stat } from 'fs/promises';
@@ -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-ANWHAGM7.js.map
333
- //# sourceMappingURL=chunk-ANWHAGM7.js.map
332
+ //# sourceMappingURL=chunk-JAJG4G5E.js.map
333
+ //# sourceMappingURL=chunk-JAJG4G5E.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,MAAM,KAAA,GAA2B;AAAA,IAC/B,OAAO,EAAC;AAAA,IACR,iBAAiB,EAAC;AAAA,IAClB,iBAAiB,EAAC;AAAA,IAClB,OAAO,EAAC;AAAA,IACR,UAAU,EAAC;AAAA,IACX,WAAW,EAAC;AA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A,IAAI,KAAA,GAAQ,CAAA;AACZ,EAAA,IAAI,UAAA;AACJ,EAAA,WAAA,MAAiB,MAAA,IAAU,QAAQ,OAAA,EAAS;AAAA,IAC1C,UAAA,EAAY,CAAC,IAAA,KAAS;AACpB,MAAA,UAAA,KAAe,IAAA;AAAA,IACjB;AAAA,GACD,CAAA,EAAG;AACF,IAAA,KAAA,EAAA;AAGA,IAAA,IAAI,KAAA,IAAS,KAAA,EAAO,OAAO,EAAE,KAAA,EAAM;AAAA,EACrC;AACA,EAAA,OAAO,EAAE,OAAO,UAAA,EAAW;AAC7B;AChPO,SAAS,oBAAA,CACd,OACA,aAAA,EACgB;AAChB,EAAA,MAAM,SAAyB,EAAC;AAEhC,EAAA,KAAA,MAAW,QAAQ,KAAA,EAAO;AACxB,IAAA,IAAI,CAAC,KAAK,gBAAA,EAAkB;AAE5B,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-ANWHAGM7.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":";;;;;;;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,EAA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A,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-JAJG4G5E.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,4 +1,4 @@
1
- import { findAiAssetsRoot } from './chunk-XOTJVCJB.js';
1
+ import { findAiAssetsRoot } from './chunk-JKWU6ULI.js';
2
2
 
3
3
  // workspace-plugin/src/utils/ai-assets.ts
4
4
  function findAiAssetsRoot2(startDir) {
@@ -6,5 +6,5 @@ function findAiAssetsRoot2(startDir) {
6
6
  }
7
7
 
8
8
  export { findAiAssetsRoot2 as findAiAssetsRoot };
9
- //# sourceMappingURL=chunk-7Y43UXKA.js.map
10
- //# sourceMappingURL=chunk-7Y43UXKA.js.map
9
+ //# sourceMappingURL=chunk-JELTQ4H7.js.map
10
+ //# sourceMappingURL=chunk-JELTQ4H7.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../workspace-plugin/src/utils/ai-assets.ts"],"names":["findAiAssetsRoot"],"mappings":";;;AA+BO,SAASA,kBAAiB,QAAA,EAA0C;AACzE,EAAA,OAAO,iBAAuB,QAAQ,CAAA;AACxC","file":"chunk-7Y43UXKA.js","sourcesContent":["// utils/ai-assets.ts\n// Shared utility for locating the ai-assets root directory.\n//\n// This is NOT a startup path (an earlier comment here claimed it was). Every\n// caller is an agent-invokable tool in `tools/flows.ts` / `tools/skills.ts`, so\n// the walk runs on a request path inside the long-lived `skaile serve` process,\n// once per tool invocation. With `projectDir = /skaile` the upward walk passes\n// directly beside the rclone FUSE workspace mount, so a synchronous `statSync`\n// here parks the whole event loop when that mount wedges — the failure mode\n// behind the 2026-08-07 outages. See issue #454.\nimport { findAiAssetsRoot as findAiAssetsRootShared } from \"@skaile/workspaces/asset-manager/catalog-deployer\";\n\n/**\n * Walk up from `startDir` looking for an `ai-assets/` directory.\n *\n * Delegates to the shared implementation in `asset-manager/catalog-deployer`,\n * which is async, deadline-bounded, level-capped, and refuses a candidate that\n * resolves at or under a workspace mount (continuing upward so a legitimate\n * parent still wins).\n *\n * @param startDir - Absolute path to begin the upward search from (typically\n * the skaile `projectDir`).\n * Note the upward walk is now level-capped rather than running to the\n * filesystem root. Six levels covers every real layout and stops an\n * unbounded climb across mount boundaries.\n *\n * @returns Absolute path to the first usable `ai-assets/` directory found, or\n * `null` if no match exists within the cap.\n *\n * @docLink packages/workspace-plugin/concepts#workspaceplugin-lifecycle\n */\nexport function findAiAssetsRoot(startDir: string): Promise<string | null> {\n return findAiAssetsRootShared(startDir);\n}\n"]}
1
+ {"version":3,"sources":["../workspace-plugin/src/utils/ai-assets.ts"],"names":["findAiAssetsRoot"],"mappings":";;;AA+BO,SAASA,kBAAiB,QAAA,EAA0C;AACzE,EAAA,OAAO,iBAAuB,QAAQ,CAAA;AACxC","file":"chunk-JELTQ4H7.js","sourcesContent":["// utils/ai-assets.ts\n// Shared utility for locating the ai-assets root directory.\n//\n// This is NOT a startup path (an earlier comment here claimed it was). Every\n// caller is an agent-invokable tool in `tools/flows.ts` / `tools/skills.ts`, so\n// the walk runs on a request path inside the long-lived `skaile serve` process,\n// once per tool invocation. With `projectDir = /skaile` the upward walk passes\n// directly beside the rclone FUSE workspace mount, so a synchronous `statSync`\n// here parks the whole event loop when that mount wedges — the failure mode\n// behind the 2026-08-07 outages. See issue #454.\nimport { findAiAssetsRoot as findAiAssetsRootShared } from \"@skaile/workspaces/asset-manager/catalog-deployer\";\n\n/**\n * Walk up from `startDir` looking for an `ai-assets/` directory.\n *\n * Delegates to the shared implementation in `asset-manager/catalog-deployer`,\n * which is async, deadline-bounded, level-capped, and refuses a candidate that\n * resolves at or under a workspace mount (continuing upward so a legitimate\n * parent still wins).\n *\n * @param startDir - Absolute path to begin the upward search from (typically\n * the skaile `projectDir`).\n * Note the upward walk is now level-capped rather than running to the\n * filesystem root. Six levels covers every real layout and stops an\n * unbounded climb across mount boundaries.\n *\n * @returns Absolute path to the first usable `ai-assets/` directory found, or\n * `null` if no match exists within the cap.\n *\n * @docLink packages/workspace-plugin/concepts#workspaceplugin-lifecycle\n */\nexport function findAiAssetsRoot(startDir: string): Promise<string | null> {\n return findAiAssetsRootShared(startDir);\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { tryWithFsDeadline, withFsDeadline, fsDeadlineMs } from './chunk-YANDJSMN.js';
1
+ import { tryWithFsDeadline, withFsDeadline, fsDeadlineMs } from './chunk-LFMX2UEF.js';
2
2
  import { createLogger } from './chunk-BOFL7GIF.js';
3
3
  import { stat, mkdir, cp, writeFile, rm } from 'fs/promises';
4
4
  import { resolve, sep, join } from 'path';
@@ -155,5 +155,5 @@ function resolveFlowSkills(flow, allEntries) {
155
155
  }
156
156
 
157
157
  export { WORKSPACE_MOUNT_ENV_VAR, deployAll, deployCatalogEntry, findAiAssetsRoot, isUnderWorkspaceMount, resolveFlowSkills, undeployCatalogEntry, workspaceMountDirs };
158
- //# sourceMappingURL=chunk-XOTJVCJB.js.map
159
- //# sourceMappingURL=chunk-XOTJVCJB.js.map
158
+ //# sourceMappingURL=chunk-JKWU6ULI.js.map
159
+ //# sourceMappingURL=chunk-JKWU6ULI.js.map