@skaile/workspaces 6.3.0 → 6.5.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 (399) hide show
  1. package/CHANGELOG.md +72 -1
  2. package/README.md +4 -0
  3. package/dist/ai-sdk.js +74 -32
  4. package/dist/ai-sdk.js.map +1 -1
  5. package/dist/app-sdk/index.js +1 -1
  6. package/dist/{asset-feeds-3YO2352Y.js → asset-feeds-4I6Z4OI3.js} +21 -21
  7. package/dist/{asset-feeds-3YO2352Y.js.map → asset-feeds-4I6Z4OI3.js.map} +1 -1
  8. package/dist/asset-manager/catalog-deployer.js +7 -7
  9. package/dist/asset-manager/index.js +13 -13
  10. package/dist/asset-manager/installer.js +9 -9
  11. package/dist/asset-manager/renderers.js +8 -8
  12. package/dist/asset-manager/src/index.d.ts +156 -27
  13. package/dist/asset-manager/src/index.d.ts.map +1 -1
  14. package/dist/asset-manager/src/install-instances.d.ts +2 -0
  15. package/dist/asset-manager/src/install-instances.d.ts.map +1 -1
  16. package/dist/asset-manager/src/installer.d.ts +6 -0
  17. package/dist/asset-manager/src/installer.d.ts.map +1 -1
  18. package/dist/bridge/harnesses/claude-sdk.js +23 -18
  19. package/dist/bridge/harnesses/claude-sdk.js.map +1 -1
  20. package/dist/bridge/harnesses/codex.js +36 -34
  21. package/dist/bridge/harnesses/codex.js.map +1 -1
  22. package/dist/bridge/harnesses/continue.js +11 -12
  23. package/dist/bridge/harnesses/continue.js.map +1 -1
  24. package/dist/bridge/harnesses/echo.js +4 -5
  25. package/dist/bridge/harnesses/echo.js.map +1 -1
  26. package/dist/bridge/harnesses/gemini.js +8 -9
  27. package/dist/bridge/harnesses/goose.js +11 -12
  28. package/dist/bridge/harnesses/goose.js.map +1 -1
  29. package/dist/bridge/harnesses/omp.js +16 -11
  30. package/dist/bridge/harnesses/omp.js.map +1 -1
  31. package/dist/bridge/harnesses/opencode.js +11 -12
  32. package/dist/bridge/harnesses/opencode.js.map +1 -1
  33. package/dist/bridge/harnesses/qwen.js +8 -9
  34. package/dist/bridge/harnesses/qwen.js.map +1 -1
  35. package/dist/bridge/index.js +19 -20
  36. package/dist/bridge/src/ai-sdk.d.ts +5 -2
  37. package/dist/bridge/src/ai-sdk.d.ts.map +1 -1
  38. package/dist/bridge/src/codex/login-fallback.d.ts +39 -0
  39. package/dist/bridge/src/codex/login-fallback.d.ts.map +1 -0
  40. package/dist/bridge/src/error-classifier.d.ts +6 -0
  41. package/dist/bridge/src/error-classifier.d.ts.map +1 -1
  42. package/dist/bridge/src/harness-model-check.d.ts +11 -7
  43. package/dist/bridge/src/harness-model-check.d.ts.map +1 -1
  44. package/dist/bridge/src/harnesses/claude-sdk.d.ts.map +1 -1
  45. package/dist/bridge/src/harnesses/codex.d.ts +0 -6
  46. package/dist/bridge/src/harnesses/codex.d.ts.map +1 -1
  47. package/dist/bridge/src/harnesses/omp.d.ts.map +1 -1
  48. package/dist/bridge/src/index.d.ts +1 -0
  49. package/dist/bridge/src/index.d.ts.map +1 -1
  50. package/dist/{chunk-XEVFSDIF.js → chunk-22ZX33H6.js} +6 -6
  51. package/dist/{chunk-XEVFSDIF.js.map → chunk-22ZX33H6.js.map} +1 -1
  52. package/dist/{chunk-KPKGWXUJ.js → chunk-23SG4JRV.js} +4 -4
  53. package/dist/{chunk-KPKGWXUJ.js.map → chunk-23SG4JRV.js.map} +1 -1
  54. package/dist/{chunk-MYXFR27L.js → chunk-2HS357RA.js} +77 -37
  55. package/dist/chunk-2HS357RA.js.map +1 -0
  56. package/dist/{chunk-7TSNR5H5.js → chunk-2IAWVUW3.js} +4 -4
  57. package/dist/{chunk-7TSNR5H5.js.map → chunk-2IAWVUW3.js.map} +1 -1
  58. package/dist/{chunk-6GWSDPBP.js → chunk-2M3VLKT2.js} +3 -3
  59. package/dist/{chunk-6GWSDPBP.js.map → chunk-2M3VLKT2.js.map} +1 -1
  60. package/dist/{chunk-PNUM7GUY.js → chunk-3DA74PLW.js} +3 -3
  61. package/dist/{chunk-PNUM7GUY.js.map → chunk-3DA74PLW.js.map} +1 -1
  62. package/dist/{chunk-7RH6E332.js → chunk-3KSLUVKB.js} +7 -7
  63. package/dist/{chunk-7RH6E332.js.map → chunk-3KSLUVKB.js.map} +1 -1
  64. package/dist/{chunk-6OHZUUR7.js → chunk-5DE3DGVR.js} +11 -5
  65. package/dist/chunk-5DE3DGVR.js.map +1 -0
  66. package/dist/{chunk-32FYVSSW.js → chunk-6EKQENAP.js} +6 -6
  67. package/dist/{chunk-32FYVSSW.js.map → chunk-6EKQENAP.js.map} +1 -1
  68. package/dist/{chunk-QK7AG5AV.js → chunk-6Y3SC7O4.js} +4 -4
  69. package/dist/{chunk-QK7AG5AV.js.map → chunk-6Y3SC7O4.js.map} +1 -1
  70. package/dist/{chunk-ROVZCGTN.js → chunk-7EMS2GZO.js} +40 -37
  71. package/dist/chunk-7EMS2GZO.js.map +1 -0
  72. package/dist/{chunk-COUJOTAJ.js → chunk-7H4GTP7V.js} +3 -3
  73. package/dist/{chunk-COUJOTAJ.js.map → chunk-7H4GTP7V.js.map} +1 -1
  74. package/dist/{chunk-VUWRGMT6.js → chunk-AFTZNR2W.js} +3 -3
  75. package/dist/{chunk-VUWRGMT6.js.map → chunk-AFTZNR2W.js.map} +1 -1
  76. package/dist/{chunk-JMIKGAUA.js → chunk-AVFRFGM2.js} +16 -6
  77. package/dist/chunk-AVFRFGM2.js.map +1 -0
  78. package/dist/{chunk-7MV3NHPT.js → chunk-B436SG5P.js} +42 -25
  79. package/dist/chunk-B436SG5P.js.map +1 -0
  80. package/dist/{chunk-ZEH4WFEG.js → chunk-B4BLJUYN.js} +69 -26
  81. package/dist/chunk-B4BLJUYN.js.map +1 -0
  82. package/dist/{chunk-LEJQAX7G.js → chunk-DNXPXJ3X.js} +82 -50
  83. package/dist/chunk-DNXPXJ3X.js.map +1 -0
  84. package/dist/{chunk-HDVLBEEX.js → chunk-E6UWI3TP.js} +3 -3
  85. package/dist/{chunk-HDVLBEEX.js.map → chunk-E6UWI3TP.js.map} +1 -1
  86. package/dist/{chunk-2TFKXSB5.js → chunk-EN5REMWV.js} +4 -4
  87. package/dist/{chunk-2TFKXSB5.js.map → chunk-EN5REMWV.js.map} +1 -1
  88. package/dist/{chunk-QFFMFZIR.js → chunk-EO7KGX6P.js} +4 -4
  89. package/dist/{chunk-QFFMFZIR.js.map → chunk-EO7KGX6P.js.map} +1 -1
  90. package/dist/{chunk-KIPCBIFJ.js → chunk-ETF6Q3R3.js} +23 -80
  91. package/dist/chunk-ETF6Q3R3.js.map +1 -0
  92. package/dist/{chunk-6WH2WE4B.js → chunk-G4NCSYWR.js} +9 -8
  93. package/dist/chunk-G4NCSYWR.js.map +1 -0
  94. package/dist/{chunk-JCPD4QRM.js → chunk-G5SYFFMD.js} +2 -2
  95. package/dist/{chunk-JCPD4QRM.js.map → chunk-G5SYFFMD.js.map} +1 -1
  96. package/dist/{chunk-Q7CU5GQO.js → chunk-HPA3RP5E.js} +4 -4
  97. package/dist/{chunk-Q7CU5GQO.js.map → chunk-HPA3RP5E.js.map} +1 -1
  98. package/dist/{chunk-KGHYXXXV.js → chunk-IS3NIZBX.js} +588 -133
  99. package/dist/chunk-IS3NIZBX.js.map +1 -0
  100. package/dist/{chunk-XBQTXGY4.js → chunk-IWKKTCXY.js} +98 -17
  101. package/dist/chunk-IWKKTCXY.js.map +1 -0
  102. package/dist/{chunk-HH2H2ZV7.js → chunk-J5JWLKLB.js} +35 -20
  103. package/dist/chunk-J5JWLKLB.js.map +1 -0
  104. package/dist/chunk-J6YPKMMY.js +83 -0
  105. package/dist/chunk-J6YPKMMY.js.map +1 -0
  106. package/dist/{chunk-TGV2EWGL.js → chunk-K4DHYTUM.js} +4 -4
  107. package/dist/{chunk-TGV2EWGL.js.map → chunk-K4DHYTUM.js.map} +1 -1
  108. package/dist/{chunk-72NT2TJU.js → chunk-KA2GLAPS.js} +7 -8
  109. package/dist/chunk-KA2GLAPS.js.map +1 -0
  110. package/dist/{chunk-VUJXZDCY.js → chunk-KSH5CFQS.js} +3 -3
  111. package/dist/{chunk-VUJXZDCY.js.map → chunk-KSH5CFQS.js.map} +1 -1
  112. package/dist/{chunk-BIRW3HOG.js → chunk-KSUT5KAE.js} +3 -3
  113. package/dist/{chunk-BIRW3HOG.js.map → chunk-KSUT5KAE.js.map} +1 -1
  114. package/dist/{chunk-AMJ6KEV7.js → chunk-KUADKMNX.js} +4 -4
  115. package/dist/{chunk-AMJ6KEV7.js.map → chunk-KUADKMNX.js.map} +1 -1
  116. package/dist/{chunk-TSTRH4SM.js → chunk-KYNCY3F3.js} +3 -3
  117. package/dist/{chunk-TSTRH4SM.js.map → chunk-KYNCY3F3.js.map} +1 -1
  118. package/dist/{chunk-V5BPDB4J.js → chunk-LE6QS4PG.js} +3 -3
  119. package/dist/{chunk-V5BPDB4J.js.map → chunk-LE6QS4PG.js.map} +1 -1
  120. package/dist/{chunk-6UP2EDFN.js → chunk-NSIOBKDX.js} +313 -4
  121. package/dist/chunk-NSIOBKDX.js.map +1 -0
  122. package/dist/{chunk-MD3FUZS3.js → chunk-OBZ5WQ32.js} +3 -3
  123. package/dist/{chunk-MD3FUZS3.js.map → chunk-OBZ5WQ32.js.map} +1 -1
  124. package/dist/{chunk-ELSGFI3I.js → chunk-OLHHN3NO.js} +31 -7
  125. package/dist/chunk-OLHHN3NO.js.map +1 -0
  126. package/dist/{chunk-JGH7NB47.js → chunk-S7DVT2BV.js} +4 -4
  127. package/dist/{chunk-JGH7NB47.js.map → chunk-S7DVT2BV.js.map} +1 -1
  128. package/dist/{chunk-PHAMYCZH.js → chunk-SN663FCA.js} +5 -5
  129. package/dist/{chunk-PHAMYCZH.js.map → chunk-SN663FCA.js.map} +1 -1
  130. package/dist/{serve-preflight-H2AYMGJ6.js → chunk-SRTWKZP2.js} +30 -61
  131. package/dist/chunk-SRTWKZP2.js.map +1 -0
  132. package/dist/{chunk-H622YULS.js → chunk-SZTHSPRC.js} +3 -4
  133. package/dist/chunk-SZTHSPRC.js.map +1 -0
  134. package/dist/{chunk-LD6O6QKU.js → chunk-T7HGEMNB.js} +4 -4
  135. package/dist/{chunk-LD6O6QKU.js.map → chunk-T7HGEMNB.js.map} +1 -1
  136. package/dist/{chunk-4QRJBY2P.js → chunk-TDPQOR3C.js} +2 -2
  137. package/dist/{chunk-4QRJBY2P.js.map → chunk-TDPQOR3C.js.map} +1 -1
  138. package/dist/{chunk-Y3I4KGLX.js → chunk-TGUMN5G7.js} +310 -175
  139. package/dist/chunk-TGUMN5G7.js.map +1 -0
  140. package/dist/{chunk-TO5SSMRI.js → chunk-THX5EE3K.js} +67 -19
  141. package/dist/chunk-THX5EE3K.js.map +1 -0
  142. package/dist/{chunk-QTLUZUF2.js → chunk-TNQLDEM6.js} +86 -34
  143. package/dist/chunk-TNQLDEM6.js.map +1 -0
  144. package/dist/{chunk-EQNIBBB6.js → chunk-TROEC2Z2.js} +34 -20
  145. package/dist/chunk-TROEC2Z2.js.map +1 -0
  146. package/dist/{chunk-E5NQRHEB.js → chunk-U6KRTCNA.js} +4 -4
  147. package/dist/{chunk-E5NQRHEB.js.map → chunk-U6KRTCNA.js.map} +1 -1
  148. package/dist/{chunk-J5JRGBKK.js → chunk-UMLCKKIA.js} +64 -32
  149. package/dist/chunk-UMLCKKIA.js.map +1 -0
  150. package/dist/{chunk-DU26AVK2.js → chunk-USVUS4DJ.js} +8 -8
  151. package/dist/{chunk-DU26AVK2.js.map → chunk-USVUS4DJ.js.map} +1 -1
  152. package/dist/{chunk-HGOJEVHY.js → chunk-UZET67SO.js} +4 -4
  153. package/dist/{chunk-HGOJEVHY.js.map → chunk-UZET67SO.js.map} +1 -1
  154. package/dist/{chunk-IZQOO6MN.js → chunk-V5KG6CCV.js} +2 -2
  155. package/dist/{chunk-IZQOO6MN.js.map → chunk-V5KG6CCV.js.map} +1 -1
  156. package/dist/{chunk-76FLBODK.js → chunk-VT6G5AJV.js} +10 -7
  157. package/dist/chunk-VT6G5AJV.js.map +1 -0
  158. package/dist/{chunk-URCJIV7T.js → chunk-W5KCAWGN.js} +3 -3
  159. package/dist/{chunk-URCJIV7T.js.map → chunk-W5KCAWGN.js.map} +1 -1
  160. package/dist/{chunk-YW4ASEUP.js → chunk-WFLQMAR5.js} +5 -5
  161. package/dist/{chunk-YW4ASEUP.js.map → chunk-WFLQMAR5.js.map} +1 -1
  162. package/dist/{chunk-RFQONXET.js → chunk-X44XKBZX.js} +3 -3
  163. package/dist/{chunk-RFQONXET.js.map → chunk-X44XKBZX.js.map} +1 -1
  164. package/dist/{chunk-BPTWWKGF.js → chunk-YBEJCQE5.js} +3 -3
  165. package/dist/{chunk-BPTWWKGF.js.map → chunk-YBEJCQE5.js.map} +1 -1
  166. package/dist/{chunk-PL52CI4U.js → chunk-YRC2EFOU.js} +4 -4
  167. package/dist/{chunk-PL52CI4U.js.map → chunk-YRC2EFOU.js.map} +1 -1
  168. package/dist/{chunk-7QG2WRSN.js → chunk-Z2X7UZEZ.js} +25 -8
  169. package/dist/chunk-Z2X7UZEZ.js.map +1 -0
  170. package/dist/{chunk-U3SXCVR7.js → chunk-ZUU2PLA3.js} +4 -4
  171. package/dist/{chunk-U3SXCVR7.js.map → chunk-ZUU2PLA3.js.map} +1 -1
  172. package/dist/{claude-code-EUKDGOOO.js → claude-code-JY6CYEG7.js} +4 -4
  173. package/dist/{claude-code-EUKDGOOO.js.map → claude-code-JY6CYEG7.js.map} +1 -1
  174. package/dist/cli/index.js +322 -162
  175. package/dist/cli/index.js.map +1 -1
  176. package/dist/cli/src/commands/cache.d.ts.map +1 -1
  177. package/dist/cli/src/commands/catalog.d.ts.map +1 -1
  178. package/dist/cli/src/commands/config.d.ts.map +1 -1
  179. package/dist/cli/src/commands/connector.d.ts.map +1 -1
  180. package/dist/cli/src/commands/deploy.d.ts.map +1 -1
  181. package/dist/cli/src/commands/harness.d.ts +5 -4
  182. package/dist/cli/src/commands/harness.d.ts.map +1 -1
  183. package/dist/cli/src/commands/integration.d.ts.map +1 -1
  184. package/dist/cli/src/commands/library-cmd.d.ts.map +1 -1
  185. package/dist/cli/src/commands/library-index.d.ts +6 -0
  186. package/dist/cli/src/commands/library-index.d.ts.map +1 -1
  187. package/dist/cli/src/commands/migrate-files.d.ts +3 -6
  188. package/dist/cli/src/commands/migrate-files.d.ts.map +1 -1
  189. package/dist/cli/src/commands/migrate-harness.d.ts +4 -3
  190. package/dist/cli/src/commands/migrate-harness.d.ts.map +1 -1
  191. package/dist/cli/src/commands/migrate.d.ts +2 -2
  192. package/dist/cli/src/commands/outdated.d.ts.map +1 -1
  193. package/dist/cli/src/commands/plugin-registry-cmd.d.ts.map +1 -1
  194. package/dist/cli/src/commands/preset-cmd.d.ts.map +1 -1
  195. package/dist/cli/src/commands/project.d.ts +7 -1
  196. package/dist/cli/src/commands/project.d.ts.map +1 -1
  197. package/dist/cli/src/commands/run.d.ts.map +1 -1
  198. package/dist/cli/src/commands/serve-preflight.d.ts +21 -0
  199. package/dist/cli/src/commands/serve-preflight.d.ts.map +1 -1
  200. package/dist/cli/src/commands/serve.d.ts.map +1 -1
  201. package/dist/cli/src/commands/source-manifest.d.ts.map +1 -1
  202. package/dist/cli/src/commands/source.d.ts +8 -0
  203. package/dist/cli/src/commands/source.d.ts.map +1 -1
  204. package/dist/cli/src/commands/update.d.ts.map +1 -1
  205. package/dist/cli/src/commands/validate-instances.d.ts +6 -0
  206. package/dist/cli/src/commands/validate-instances.d.ts.map +1 -1
  207. package/dist/cli/src/commands/validate.d.ts.map +1 -1
  208. package/dist/cli/src/commands/verify.d.ts.map +1 -1
  209. package/dist/cli/src/config-checks.d.ts +8 -0
  210. package/dist/cli/src/config-checks.d.ts.map +1 -1
  211. package/dist/cli/src/ensure-sources.d.ts.map +1 -1
  212. package/dist/cli/src/helpers.d.ts +13 -4
  213. package/dist/cli/src/helpers.d.ts.map +1 -1
  214. package/dist/cli/src/plugin-store/index.d.ts +1 -1
  215. package/dist/cli/src/plugin-store/index.d.ts.map +1 -1
  216. package/dist/cli/src/plugin-store/reconcile.d.ts.map +1 -1
  217. package/dist/cli/src/plugin-store/spec.d.ts +20 -14
  218. package/dist/cli/src/plugin-store/spec.d.ts.map +1 -1
  219. package/dist/cli/src/setup.d.ts.map +1 -1
  220. package/dist/cli/src/skill-checks.d.ts +2 -0
  221. package/dist/cli/src/skill-checks.d.ts.map +1 -1
  222. package/dist/connectors/config.js +5 -5
  223. package/dist/connectors/index.js +23 -24
  224. package/dist/connectors/src/index.d.ts +2 -2
  225. package/dist/connectors/src/index.d.ts.map +1 -1
  226. package/dist/connectors/src/managed-gitconfig.d.ts +22 -0
  227. package/dist/connectors/src/managed-gitconfig.d.ts.map +1 -1
  228. package/dist/connectors/src/npm-installer.d.ts +11 -3
  229. package/dist/connectors/src/npm-installer.d.ts.map +1 -1
  230. package/dist/connectors-VLFOQNS6.js +49 -0
  231. package/dist/{connectors-XYPE2DCQ.js.map → connectors-VLFOQNS6.js.map} +1 -1
  232. package/dist/connectors-shared/index.js +2 -2
  233. package/dist/core/index.js +6 -6
  234. package/dist/core/manifest.js +2 -2
  235. package/dist/core/models.js +1 -1
  236. package/dist/core/publish-manifest.js +3 -3
  237. package/dist/core/ref.js +1 -1
  238. package/dist/core/runtime-assets.js +5 -5
  239. package/dist/core/src/agent-instances.d.ts +6 -0
  240. package/dist/core/src/agent-instances.d.ts.map +1 -1
  241. package/dist/core/src/config-key-diagnostics.d.ts +2 -1
  242. package/dist/core/src/config-key-diagnostics.d.ts.map +1 -1
  243. package/dist/core/src/index.d.ts +5 -5
  244. package/dist/core/src/index.d.ts.map +1 -1
  245. package/dist/core/src/lock.d.ts +20 -1
  246. package/dist/core/src/lock.d.ts.map +1 -1
  247. package/dist/core/src/manifest-yaml-editor.d.ts +4 -1
  248. package/dist/core/src/manifest-yaml-editor.d.ts.map +1 -1
  249. package/dist/core/src/manifest.d.ts +9 -3
  250. package/dist/core/src/manifest.d.ts.map +1 -1
  251. package/dist/core/src/models.d.ts +10 -0
  252. package/dist/core/src/models.d.ts.map +1 -1
  253. package/dist/core/src/repo-manager.d.ts +11 -0
  254. package/dist/core/src/repo-manager.d.ts.map +1 -1
  255. package/dist/core/src/runtime-assets.d.ts +12 -1
  256. package/dist/core/src/runtime-assets.d.ts.map +1 -1
  257. package/dist/core/src/walker.d.ts +3 -0
  258. package/dist/core/src/walker.d.ts.map +1 -1
  259. package/dist/core/src/workspace-config.d.ts +19 -2
  260. package/dist/core/src/workspace-config.d.ts.map +1 -1
  261. package/dist/core/src/workspace-yaml-editor.d.ts.map +1 -1
  262. package/dist/core/workspace-config.js +4 -4
  263. package/dist/deploy/index.js +6 -6
  264. package/dist/discovery/index.js +5 -5
  265. package/dist/{ensure-sources-IN3VKHUA.js → ensure-sources-6O54DUQB.js} +31 -31
  266. package/dist/ensure-sources-6O54DUQB.js.map +1 -0
  267. package/dist/factory-assets/connectors/box.js +23 -24
  268. package/dist/factory-assets/connectors/deploy.js +23 -24
  269. package/dist/factory-assets/connectors/devserver.js +23 -24
  270. package/dist/factory-assets/connectors/flow/adapter.js +23 -24
  271. package/dist/factory-assets/connectors/flow/engine.js +7 -7
  272. package/dist/factory-assets/connectors/flow/run-flow.js +25 -26
  273. package/dist/factory-assets/connectors/flow.js +23 -24
  274. package/dist/factory-assets/connectors/git.js +23 -24
  275. package/dist/factory-assets/connectors/gmail.js +23 -24
  276. package/dist/factory-assets/connectors/googledrive.js +23 -24
  277. package/dist/factory-assets/connectors/local.js +23 -24
  278. package/dist/factory-assets/connectors/mattermost.js +23 -24
  279. package/dist/factory-assets/connectors/memory.js +23 -24
  280. package/dist/factory-assets/connectors/minio.js +23 -24
  281. package/dist/factory-assets/connectors/postgres.js +23 -24
  282. package/dist/factory-assets/connectors/s3.js +23 -24
  283. package/dist/factory-assets/connectors/sharepoint.js +23 -24
  284. package/dist/factory-assets/connectors/sqlite.js +23 -24
  285. package/dist/factory-assets/connectors/static-server.js +23 -24
  286. package/dist/factory-assets/connectors/tunnel.js +23 -24
  287. package/dist/factory-assets/connectors/webdav.js +23 -24
  288. package/dist/factory-assets/connectors/xstate-store.js +23 -24
  289. package/dist/factory-assets/connectors/xstate.js +23 -24
  290. package/dist/factory-assets/skills/authoring-skaile-assets/SKILL.md +2 -1
  291. package/dist/{flows-QAO63TDV.js → flows-CIUPK7SB.js} +11 -11
  292. package/dist/{flows-QAO63TDV.js.map → flows-CIUPK7SB.js.map} +1 -1
  293. package/dist/{helpers-HDVGCF3M.js → helpers-YHDQHQEQ.js} +28 -29
  294. package/dist/{helpers-HDVGCF3M.js.map → helpers-YHDQHQEQ.js.map} +1 -1
  295. package/dist/library/index.js +10 -10
  296. package/dist/library/install.js +4 -4
  297. package/dist/library/src/manifest-writer.d.ts +9 -0
  298. package/dist/library/src/manifest-writer.d.ts.map +1 -1
  299. package/dist/library/src/remote/remote-catalog-source.d.ts +9 -0
  300. package/dist/library/src/remote/remote-catalog-source.d.ts.map +1 -1
  301. package/dist/library/src/remote/rest-catalog-source.d.ts +1 -0
  302. package/dist/library/src/remote/rest-catalog-source.d.ts.map +1 -1
  303. package/dist/{library-publish-62OWCNB5.js → library-publish-MUGUST43.js} +53 -53
  304. package/dist/{library-publish-62OWCNB5.js.map → library-publish-MUGUST43.js.map} +1 -1
  305. package/dist/model-endpoint/index.js +9 -10
  306. package/dist/open-library-BVQCB37E.js +57 -0
  307. package/dist/{open-library-TZ7OSDEJ.js.map → open-library-BVQCB37E.js.map} +1 -1
  308. package/dist/{open-registry-RLZKTJG3.js → open-registry-JCSIAKEC.js} +14 -14
  309. package/dist/{open-registry-RLZKTJG3.js.map → open-registry-JCSIAKEC.js.map} +1 -1
  310. package/dist/{paths-D6LBQETQ.js → paths-XLKCAFRZ.js} +9 -9
  311. package/dist/{paths-D6LBQETQ.js.map → paths-XLKCAFRZ.js.map} +1 -1
  312. package/dist/{plugin-store-A5J4TLCH.js → plugin-store-NGRUTCJI.js} +9 -9
  313. package/dist/{plugin-store-A5J4TLCH.js.map → plugin-store-NGRUTCJI.js.map} +1 -1
  314. package/dist/project-BGYMLAS6.js +88 -0
  315. package/dist/{project-4AVRES3M.js.map → project-BGYMLAS6.js.map} +1 -1
  316. package/dist/resolver/index.js +7 -7
  317. package/dist/runner/index.js +38 -39
  318. package/dist/runner/src/capability-roundtrip.d.ts +4 -1
  319. package/dist/runner/src/capability-roundtrip.d.ts.map +1 -1
  320. package/dist/runner/src/composition/resolve-instance.d.ts.map +1 -1
  321. package/dist/runner/src/composition/resolve.d.ts +6 -0
  322. package/dist/runner/src/composition/resolve.d.ts.map +1 -1
  323. package/dist/runner/src/credential-notice.d.ts +3 -2
  324. package/dist/runner/src/credential-notice.d.ts.map +1 -1
  325. package/dist/runner/src/resources.d.ts.map +1 -1
  326. package/dist/runner/src/serve.d.ts.map +1 -1
  327. package/dist/sdk/asset-manager.js +13 -13
  328. package/dist/sdk/bridge.js +19 -20
  329. package/dist/sdk/core.js +6 -6
  330. package/dist/sdk/flow.js +7 -7
  331. package/dist/sdk/index.js +38 -39
  332. package/dist/sdk/index.js.map +1 -1
  333. package/dist/sdk/resolver.js +7 -7
  334. package/dist/sdk/runner.js +38 -39
  335. package/dist/sdk/session.js +2 -2
  336. package/dist/sdk/transport/ws/server.js +7 -7
  337. package/dist/sdk/transport/ws.js +7 -7
  338. package/dist/sdk/transport.js +7 -7
  339. package/dist/sdk/types.js +1 -1
  340. package/dist/serve-preflight-GQY5DZX6.js +56 -0
  341. package/dist/serve-preflight-GQY5DZX6.js.map +1 -0
  342. package/dist/session/index.js +2 -2
  343. package/dist/{setup-NSPQD4V4.js → setup-2NWSKSCO.js} +34 -32
  344. package/dist/setup-2NWSKSCO.js.map +1 -0
  345. package/dist/{skills-B533SRVZ.js → skills-PXZOL2FZ.js} +12 -12
  346. package/dist/{skills-B533SRVZ.js.map → skills-PXZOL2FZ.js.map} +1 -1
  347. package/dist/source-XA3L4H6I.js +86 -0
  348. package/dist/{source-VTECABUO.js.map → source-XA3L4H6I.js.map} +1 -1
  349. package/dist/{source-manifest-publish-YORI42MN.js → source-manifest-publish-QEGMTS33.js} +50 -51
  350. package/dist/source-manifest-publish-QEGMTS33.js.map +1 -0
  351. package/dist/transport/index.js +7 -7
  352. package/dist/transport/ws/server.js +7 -7
  353. package/dist/transport/ws.js +7 -7
  354. package/dist/tui/index.js +38 -39
  355. package/dist/tui/index.js.map +1 -1
  356. package/dist/types/index.js +1 -1
  357. package/dist/types/manifests.js +1 -1
  358. package/dist/types/src/capabilities.d.ts +9 -1
  359. package/dist/types/src/capabilities.d.ts.map +1 -1
  360. package/dist/types/src/manifests/agent.d.ts +2 -2
  361. package/dist/types/src/manifests/agent.d.ts.map +1 -1
  362. package/dist/types/src/version.d.ts +8 -8
  363. package/dist/workspace-plugin/adapters/mcp.js +30 -31
  364. package/dist/workspace-plugin/adapters/omp.js +14 -14
  365. package/dist/workspace-plugin/index.js +1 -1
  366. package/package.json +1 -1
  367. package/dist/chunk-6OHZUUR7.js.map +0 -1
  368. package/dist/chunk-6UP2EDFN.js.map +0 -1
  369. package/dist/chunk-6WH2WE4B.js.map +0 -1
  370. package/dist/chunk-72NT2TJU.js.map +0 -1
  371. package/dist/chunk-76FLBODK.js.map +0 -1
  372. package/dist/chunk-7MV3NHPT.js.map +0 -1
  373. package/dist/chunk-7QG2WRSN.js.map +0 -1
  374. package/dist/chunk-ELSGFI3I.js.map +0 -1
  375. package/dist/chunk-EQNIBBB6.js.map +0 -1
  376. package/dist/chunk-H622YULS.js.map +0 -1
  377. package/dist/chunk-HH2H2ZV7.js.map +0 -1
  378. package/dist/chunk-J5JRGBKK.js.map +0 -1
  379. package/dist/chunk-JMIKGAUA.js.map +0 -1
  380. package/dist/chunk-KGHYXXXV.js.map +0 -1
  381. package/dist/chunk-KIPCBIFJ.js.map +0 -1
  382. package/dist/chunk-LEJQAX7G.js.map +0 -1
  383. package/dist/chunk-MYXFR27L.js.map +0 -1
  384. package/dist/chunk-QTLUZUF2.js.map +0 -1
  385. package/dist/chunk-ROVZCGTN.js.map +0 -1
  386. package/dist/chunk-S6KZHPR4.js +0 -315
  387. package/dist/chunk-S6KZHPR4.js.map +0 -1
  388. package/dist/chunk-TO5SSMRI.js.map +0 -1
  389. package/dist/chunk-XBQTXGY4.js.map +0 -1
  390. package/dist/chunk-Y3I4KGLX.js.map +0 -1
  391. package/dist/chunk-ZEH4WFEG.js.map +0 -1
  392. package/dist/connectors-XYPE2DCQ.js +0 -50
  393. package/dist/ensure-sources-IN3VKHUA.js.map +0 -1
  394. package/dist/open-library-TZ7OSDEJ.js +0 -58
  395. package/dist/project-4AVRES3M.js +0 -88
  396. package/dist/serve-preflight-H2AYMGJ6.js.map +0 -1
  397. package/dist/setup-NSPQD4V4.js.map +0 -1
  398. package/dist/source-VTECABUO.js +0 -87
  399. package/dist/source-manifest-publish-YORI42MN.js.map +0 -1
@@ -1,26 +1,28 @@
1
- import { readManifestSourceConfig, discoverAssetsInTree, barePublisher, createDefaultKindRegistry, sharesItsFolder, SEMVER_RE, invalidSemverMessage, parseManifestFile } from './chunk-XEVFSDIF.js';
2
- import { installFromManifest, assertSafeManifestPath } from './chunk-E5NQRHEB.js';
3
- import { PresetManifestSchema } from './chunk-76FLBODK.js';
4
- import { defaultLibraryDir, resolveLibraryDir, GLOBAL_INSTALL_DIR_NAME, readLock, buildLibraryLockEntries, writeLock, mergeLockFile, buildLockFile, ManifestYamlEditor } from './chunk-J5JRGBKK.js';
5
- import { getGlobalCacheDir, storeManifestSlug, priorStoreManifestSlugs, resolveSourcePublisher } from './chunk-XBQTXGY4.js';
1
+ import { readManifestSourceConfig, discoverAssetsInTree, barePublisher, createDefaultKindRegistry, sharesItsFolder, SEMVER_RE, invalidSemverMessage, parseManifestFile } from './chunk-22ZX33H6.js';
2
+ import { installFromManifest, assertSafeManifestPath } from './chunk-U6KRTCNA.js';
3
+ import { PresetManifestSchema } from './chunk-VT6G5AJV.js';
4
+ import { defaultLibraryDir, resolveLibraryDir, GLOBAL_INSTALL_DIR_NAME, readLock, buildLibraryLockEntries, writeLock, mergeLockFile, buildLockFile, ManifestYamlEditor } from './chunk-UMLCKKIA.js';
5
+ import { getGlobalCacheDir, storeManifestSlug, priorStoreManifestSlugs, resolveSourcePublisher } from './chunk-IWKKTCXY.js';
6
6
  import { userConfigPath, globalSkaileDir, mergeLegacyEntriesInto, migrateLegacyDir, globalCacheRoot } from './chunk-L5VSIPQD.js';
7
- import { encodeSkaileManifest, expandManifestFiles, SKAILE_MANIFEST_FILENAME, librarySymlinkMessage, loadSkPublishManifest } from './chunk-KPKGWXUJ.js';
8
- import { scanDirectory } from './chunk-JMIKGAUA.js';
9
- import { parseAssetRef, assetRefToStr, isValidAssetName } from './chunk-IZQOO6MN.js';
7
+ import { encodeSkaileManifest, expandManifestFiles, SKAILE_MANIFEST_FILENAME, librarySymlinkMessage, loadSkPublishManifest } from './chunk-23SG4JRV.js';
8
+ import { scanDirectory } from './chunk-AVFRFGM2.js';
9
+ import { parseAssetRef, assetRefToStr, isValidAssetName } from './chunk-V5KG6CCV.js';
10
10
  import { __export } from './chunk-NSBPE2FW.js';
11
- import * as fs12 from 'fs';
11
+ import * as fs14 from 'fs';
12
12
  import { existsSync, mkdirSync, symlinkSync, copyFileSync, cpSync } from 'fs';
13
13
  import * as path16 from 'path';
14
14
  import { resolve, relative, sep, join, dirname } from 'path';
15
15
  import { stringify, parse, parseDocument } from 'yaml';
16
16
  import * as z3 from 'zod';
17
17
  import * as crypto from 'crypto';
18
+ import { randomBytes, createHash } from 'crypto';
18
19
  import { eq, and, like } from 'drizzle-orm';
19
20
  import { createClient } from '@libsql/client';
20
21
  import { drizzle } from 'drizzle-orm/libsql';
21
22
  import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core';
22
23
  import { spawnSync } from 'child_process';
23
24
  import { valid, gt } from 'semver';
25
+ import * as os from 'os';
24
26
  import { isDeepStrictEqual } from 'util';
25
27
 
26
28
  // library/src/library.ts
@@ -121,9 +123,9 @@ function projectConfigPath(projectDir) {
121
123
  return path16.join(projectDir, ".skaile", CONFIG_FILENAME);
122
124
  }
123
125
  function loadConfigFile(filePath) {
124
- if (!fs12.existsSync(filePath)) return null;
126
+ if (!fs14.existsSync(filePath)) return null;
125
127
  try {
126
- const content = fs12.readFileSync(filePath, "utf-8");
128
+ const content = fs14.readFileSync(filePath, "utf-8");
127
129
  const raw = parse(content);
128
130
  if (!raw || typeof raw !== "object") return null;
129
131
  return SkaileConfigSchema.partial().parse(raw);
@@ -172,10 +174,10 @@ function resolveConfig(opts) {
172
174
  }
173
175
  function saveConfig(filePath, config) {
174
176
  const dir = path16.dirname(filePath);
175
- if (!fs12.existsSync(dir)) {
176
- fs12.mkdirSync(dir, { recursive: true });
177
+ if (!fs14.existsSync(dir)) {
178
+ fs14.mkdirSync(dir, { recursive: true });
177
179
  }
178
- fs12.writeFileSync(filePath, stringify(config, { indent: 2 }), "utf-8");
180
+ fs14.writeFileSync(filePath, stringify(config, { indent: 2 }), "utf-8");
179
181
  }
180
182
  var KnowledgeManifestSchema = z3.looseObject({
181
183
  name: z3.string().optional(),
@@ -202,9 +204,9 @@ function validateKnowledge(data) {
202
204
  // library/src/knowledge/knowledge-kind-provider.ts
203
205
  function collectDirRecursive(baseDir, relativeDir) {
204
206
  const full = path16.join(baseDir, relativeDir);
205
- if (!fs12.existsSync(full) || !fs12.statSync(full).isDirectory()) return [];
207
+ if (!fs14.existsSync(full) || !fs14.statSync(full).isDirectory()) return [];
206
208
  const results = [];
207
- for (const entry of fs12.readdirSync(full, { withFileTypes: true })) {
209
+ for (const entry of fs14.readdirSync(full, { withFileTypes: true })) {
208
210
  const rel = path16.posix.join(relativeDir, entry.name);
209
211
  if (entry.isDirectory()) {
210
212
  results.push(...collectDirRecursive(baseDir, rel));
@@ -312,7 +314,7 @@ var assignments = sqliteTable("assignments", {
312
314
  assignedAt: text("assigned_at").notNull()
313
315
  });
314
316
  function isClone(dir) {
315
- return fs12.existsSync(path16.join(dir, ".git"));
317
+ return fs14.existsSync(path16.join(dir, ".git"));
316
318
  }
317
319
  function getSidecarRoot() {
318
320
  const home = globalSkaileDir();
@@ -346,9 +348,9 @@ function deriveSlug(sourceConfig, sourcePath, existingSlugs) {
346
348
  }
347
349
  function listSidecarSlugsOnDisk() {
348
350
  const root = getSidecarRoot();
349
- if (!fs12.existsSync(root)) return [];
351
+ if (!fs14.existsSync(root)) return [];
350
352
  const out = [];
351
- for (const entry of fs12.readdirSync(root, { withFileTypes: true })) {
353
+ for (const entry of fs14.readdirSync(root, { withFileTypes: true })) {
352
354
  if (!entry.isDirectory()) continue;
353
355
  if (entry.name.startsWith(".")) continue;
354
356
  out.push(entry.name);
@@ -369,16 +371,16 @@ function getStoreManifestsDir() {
369
371
  function storeManifestFile(sourceUrl) {
370
372
  const dir = getStoreManifestsDir();
371
373
  const current = path16.join(dir, `${storeManifestSlug(sourceUrl)}.yaml`);
372
- if (fs12.existsSync(current)) return current;
374
+ if (fs14.existsSync(current)) return current;
373
375
  for (const slug of priorStoreManifestSlugs(sourceUrl)) {
374
376
  const old = path16.join(dir, `${slug}.yaml`);
375
- if (fs12.existsSync(old)) return old;
377
+ if (fs14.existsSync(old)) return old;
376
378
  }
377
379
  return current;
378
380
  }
379
381
  function curatedManifestOverlay(sourceUrl) {
380
382
  const file = storeManifestFile(sourceUrl);
381
- return fs12.existsSync(file) ? file : void 0;
383
+ return fs14.existsSync(file) ? file : void 0;
382
384
  }
383
385
  function commitStoreManifest(file, message) {
384
386
  const root = getStoreRoot();
@@ -410,14 +412,14 @@ function migratedMarkerPath() {
410
412
  }
411
413
  function collectSidecarMigrationCandidates(sidecarRoot) {
412
414
  const candidates = [];
413
- if (fs12.existsSync(sidecarRoot)) {
414
- for (const entry of fs12.readdirSync(sidecarRoot, { withFileTypes: true })) {
415
+ if (fs14.existsSync(sidecarRoot)) {
416
+ for (const entry of fs14.readdirSync(sidecarRoot, { withFileTypes: true })) {
415
417
  if (!entry.isDirectory()) continue;
416
418
  if (entry.name.startsWith(".")) continue;
417
419
  const sidecarDir = path16.join(sidecarRoot, entry.name);
418
420
  const current = path16.join(sidecarDir, "skaile.manifest.yaml");
419
421
  const legacy = path16.join(sidecarDir, ".skaile-source.yaml");
420
- const src = fs12.existsSync(current) ? current : fs12.existsSync(legacy) ? legacy : void 0;
422
+ const src = fs14.existsSync(current) ? current : fs14.existsSync(legacy) ? legacy : void 0;
421
423
  if (src) candidates.push({ src, slug: entry.name });
422
424
  }
423
425
  }
@@ -427,9 +429,9 @@ function moveSidecarManifests(candidates, manifestsDir) {
427
429
  let migrated = 0;
428
430
  for (const { src, slug } of candidates) {
429
431
  const dest = path16.join(manifestsDir, `${slug}.yaml`);
430
- if (fs12.existsSync(dest)) continue;
432
+ if (fs14.existsSync(dest)) continue;
431
433
  try {
432
- fs12.renameSync(src, dest);
434
+ fs14.renameSync(src, dest);
433
435
  migrated++;
434
436
  } catch (err) {
435
437
  process.stderr.write(
@@ -441,10 +443,10 @@ function moveSidecarManifests(candidates, manifestsDir) {
441
443
  return migrated;
442
444
  }
443
445
  function initStoreGitRepo(storeRoot) {
444
- if (fs12.existsSync(path16.join(storeRoot, ".git"))) return;
446
+ if (fs14.existsSync(path16.join(storeRoot, ".git"))) return;
445
447
  try {
446
448
  spawnSync("git", ["init", "--quiet"], { cwd: storeRoot, stdio: "ignore" });
447
- fs12.writeFileSync(
449
+ fs14.writeFileSync(
448
450
  path16.join(storeRoot, ".gitignore"),
449
451
  "# Remote-store cache \u2014 local to this machine.\nremote-cache/\n",
450
452
  "utf8"
@@ -455,14 +457,14 @@ function initStoreGitRepo(storeRoot) {
455
457
  function migrateSidecarsToStoreIfNeeded() {
456
458
  const storeRoot = getStoreRoot();
457
459
  const marker = migratedMarkerPath();
458
- if (fs12.existsSync(marker)) return { migrated: 0, storeRoot };
460
+ if (fs14.existsSync(marker)) return { migrated: 0, storeRoot };
459
461
  const sidecarRoot = getSidecarRoot();
460
462
  const manifestsDir = getStoreManifestsDir();
461
463
  const candidates = collectSidecarMigrationCandidates(sidecarRoot);
462
- fs12.mkdirSync(manifestsDir, { recursive: true });
464
+ fs14.mkdirSync(manifestsDir, { recursive: true });
463
465
  const migrated = moveSidecarManifests(candidates, manifestsDir);
464
466
  initStoreGitRepo(storeRoot);
465
- fs12.writeFileSync(marker, (/* @__PURE__ */ new Date()).toISOString(), "utf8");
467
+ fs14.writeFileSync(marker, (/* @__PURE__ */ new Date()).toISOString(), "utf8");
466
468
  return { migrated, storeRoot };
467
469
  }
468
470
 
@@ -707,7 +709,7 @@ async function purgeOrphanedAssetDefinitions(client) {
707
709
  await client.execute(`PRAGMA user_version = ${ORPHAN_PURGE_VERSION}`);
708
710
  }
709
711
  function assertNoLegacyLibDb(newDbPath) {
710
- if (fs12.existsSync(newDbPath)) return;
712
+ if (fs14.existsSync(newDbPath)) return;
711
713
  const parent = path16.dirname(newDbPath);
712
714
  const skaileHome = globalSkaileDir();
713
715
  const defaultIndexPath2 = path16.join(skaileHome, "index.db");
@@ -723,7 +725,7 @@ function assertNoLegacyLibDb(newDbPath) {
723
725
  candidates.push(path16.join(path16.dirname(parent), "library", "lib.db"));
724
726
  }
725
727
  for (const legacy of candidates) {
726
- if (!fs12.existsSync(legacy)) continue;
728
+ if (!fs14.existsSync(legacy)) continue;
727
729
  throw new Error(
728
730
  `Found legacy index database at ${legacy}. The lib.db \u2192 index.db relocation ran for one release and has been removed. Move the file manually to ${newDbPath} (and any -wal / -shm siblings), then retry.`
729
731
  );
@@ -898,12 +900,12 @@ var LocalIndex = class {
898
900
  dbPath = resolveIndexPath();
899
901
  this._kindRegistry = optionsOrDir?.kindRegistry;
900
902
  }
901
- if (!fs12.existsSync(dir)) {
902
- fs12.mkdirSync(dir, { recursive: true });
903
+ if (!fs14.existsSync(dir)) {
904
+ fs14.mkdirSync(dir, { recursive: true });
903
905
  }
904
906
  const dbParent = path16.dirname(dbPath);
905
- if (!fs12.existsSync(dbParent)) {
906
- fs12.mkdirSync(dbParent, { recursive: true });
907
+ if (!fs14.existsSync(dbParent)) {
908
+ fs14.mkdirSync(dbParent, { recursive: true });
907
909
  }
908
910
  this.libraryDir = dir;
909
911
  this.dbPath = dbPath;
@@ -1250,7 +1252,7 @@ var LocalIndex = class {
1250
1252
  var UNREGISTERED_FILE = ".unregistered-libraries";
1251
1253
  function libraryDirMissing(lib) {
1252
1254
  try {
1253
- return !fs12.statSync(lib.path).isDirectory();
1255
+ return !fs14.statSync(lib.path).isDirectory();
1254
1256
  } catch {
1255
1257
  return true;
1256
1258
  }
@@ -1263,7 +1265,7 @@ function missingLibraryDirMessage(lib) {
1263
1265
  }
1264
1266
  function realDir(dir) {
1265
1267
  try {
1266
- return fs12.realpathSync(dir);
1268
+ return fs14.realpathSync(dir);
1267
1269
  } catch {
1268
1270
  return path16.resolve(dir);
1269
1271
  }
@@ -1271,7 +1273,7 @@ function realDir(dir) {
1271
1273
  function unregisteredLibraryNames() {
1272
1274
  try {
1273
1275
  return new Set(
1274
- fs12.readFileSync(path16.join(resolveLibraryDir(), UNREGISTERED_FILE), "utf8").split("\n").map((l) => l.trim()).filter(Boolean)
1276
+ fs14.readFileSync(path16.join(resolveLibraryDir(), UNREGISTERED_FILE), "utf8").split("\n").map((l) => l.trim()).filter(Boolean)
1275
1277
  );
1276
1278
  } catch {
1277
1279
  return /* @__PURE__ */ new Set();
@@ -1282,8 +1284,8 @@ function markLibraryUnregistered(lib) {
1282
1284
  const known = unregisteredLibraryNames();
1283
1285
  const add = [.../* @__PURE__ */ new Set([lib.name, path16.basename(lib.path)])].filter((n) => !known.has(n));
1284
1286
  if (add.length === 0) return;
1285
- fs12.mkdirSync(resolveLibraryDir(), { recursive: true });
1286
- fs12.appendFileSync(
1287
+ fs14.mkdirSync(resolveLibraryDir(), { recursive: true });
1288
+ fs14.appendFileSync(
1287
1289
  path16.join(resolveLibraryDir(), UNREGISTERED_FILE),
1288
1290
  `${add.join("\n")}
1289
1291
  `,
@@ -1300,15 +1302,15 @@ function clearLibraryUnregistered(lib) {
1300
1302
  const keep = [...known].filter((n) => !drop.has(n));
1301
1303
  if (keep.length === known.size) return;
1302
1304
  const file = path16.join(resolveLibraryDir(), UNREGISTERED_FILE);
1303
- if (keep.length === 0) fs12.rmSync(file, { force: true });
1304
- else fs12.writeFileSync(file, `${keep.join("\n")}
1305
+ if (keep.length === 0) fs14.rmSync(file, { force: true });
1306
+ else fs14.writeFileSync(file, `${keep.join("\n")}
1305
1307
  `, "utf8");
1306
1308
  }
1307
1309
  var RENAMED_FILE = ".renamed-libraries";
1308
1310
  function readAllRenames() {
1309
1311
  const out = /* @__PURE__ */ new Map();
1310
1312
  try {
1311
- for (const line of fs12.readFileSync(path16.join(resolveLibraryDir(), RENAMED_FILE), "utf8").split("\n")) {
1313
+ for (const line of fs14.readFileSync(path16.join(resolveLibraryDir(), RENAMED_FILE), "utf8").split("\n")) {
1312
1314
  const [from, to, flag] = line.split(" ").map((s) => s.trim());
1313
1315
  if (from && to && from !== to) out.set(from, { to, gone: flag === "gone" });
1314
1316
  }
@@ -1319,11 +1321,11 @@ function readAllRenames() {
1319
1321
  function writeAllRenames(renames) {
1320
1322
  const file = path16.join(resolveLibraryDir(), RENAMED_FILE);
1321
1323
  if (renames.size === 0) {
1322
- fs12.rmSync(file, { force: true });
1324
+ fs14.rmSync(file, { force: true });
1323
1325
  return;
1324
1326
  }
1325
- fs12.mkdirSync(resolveLibraryDir(), { recursive: true });
1326
- fs12.writeFileSync(
1327
+ fs14.mkdirSync(resolveLibraryDir(), { recursive: true });
1328
+ fs14.writeFileSync(
1327
1329
  file,
1328
1330
  `${[...renames].map(([from, r]) => `${from} ${r.to}${r.gone ? " gone" : ""}`).join("\n")}
1329
1331
  `,
@@ -1907,8 +1909,8 @@ var LibraryManager = class {
1907
1909
  async removeLibrary(nameOrId, opts = {}) {
1908
1910
  const lib = await this.requireLibrary(nameOrId);
1909
1911
  await this.lib.removeSource(lib.id);
1910
- if (opts.purge && fs12.existsSync(lib.path)) {
1911
- fs12.rmSync(lib.path, { recursive: true, force: true });
1912
+ if (opts.purge && fs14.existsSync(lib.path)) {
1913
+ fs14.rmSync(lib.path, { recursive: true, force: true });
1912
1914
  }
1913
1915
  dropLibraryRenamesTo(lib.name);
1914
1916
  if (!opts.purge) markLibraryUnregistered(lib);
@@ -1927,7 +1929,7 @@ var LibraryManager = class {
1927
1929
  );
1928
1930
  if (writableDefault) return { library: writableDefault, created: false };
1929
1931
  const personalPath = path16.join(librariesDir, "personal");
1930
- fs12.mkdirSync(personalPath, { recursive: true });
1932
+ fs14.mkdirSync(personalPath, { recursive: true });
1931
1933
  const lib = await this.addLibrary({
1932
1934
  name: "personal",
1933
1935
  path: personalPath,
@@ -2118,7 +2120,7 @@ var LocalCatalogSource = class {
2118
2120
  };
2119
2121
  function isReadableDirectory(dir) {
2120
2122
  try {
2121
- fs12.readdirSync(dir);
2123
+ fs14.readdirSync(dir);
2122
2124
  return true;
2123
2125
  } catch {
2124
2126
  return false;
@@ -2260,11 +2262,11 @@ var SidecarGit = class {
2260
2262
  * @docLink packages/library/concepts#sidecar-git
2261
2263
  */
2262
2264
  async ensureInitialized() {
2263
- if (!fs12.existsSync(this.rootDir)) {
2264
- fs12.mkdirSync(this.rootDir, { recursive: true });
2265
+ if (!fs14.existsSync(this.rootDir)) {
2266
+ fs14.mkdirSync(this.rootDir, { recursive: true });
2265
2267
  }
2266
2268
  const gitDir = path16.join(this.rootDir, ".git");
2267
- const freshRepo = !fs12.existsSync(gitDir);
2269
+ const freshRepo = !fs14.existsSync(gitDir);
2268
2270
  if (freshRepo) {
2269
2271
  const init = this.spawn(["init", "-b", "main"]);
2270
2272
  if (init.exitCode !== 0) {
@@ -2272,9 +2274,9 @@ var SidecarGit = class {
2272
2274
  }
2273
2275
  }
2274
2276
  const attrsPath = path16.join(this.rootDir, ".gitattributes");
2275
- if (!fs12.existsSync(attrsPath)) fs12.writeFileSync(attrsPath, GITATTRIBUTES, "utf-8");
2277
+ if (!fs14.existsSync(attrsPath)) fs14.writeFileSync(attrsPath, GITATTRIBUTES, "utf-8");
2276
2278
  const readmePath = path16.join(this.rootDir, "README.md");
2277
- if (!fs12.existsSync(readmePath)) fs12.writeFileSync(readmePath, ROOT_README, "utf-8");
2279
+ if (!fs14.existsSync(readmePath)) fs14.writeFileSync(readmePath, ROOT_README, "utf-8");
2278
2280
  if (!this.hasGlobalGitConfig("user.name")) {
2279
2281
  this.spawn(["config", "user.name", FALLBACK_USER_NAME]);
2280
2282
  }
@@ -2300,7 +2302,7 @@ var SidecarGit = class {
2300
2302
  async commit(slug, message, opts) {
2301
2303
  if (opts?.skip) return;
2302
2304
  const slugDir = path16.join(this.rootDir, slug);
2303
- if (fs12.existsSync(slugDir)) {
2305
+ if (fs14.existsSync(slugDir)) {
2304
2306
  this.spawn(["add", "--", slug]);
2305
2307
  } else {
2306
2308
  this.spawn(["add", "-A"]);
@@ -2361,10 +2363,10 @@ ${result.stderr}`;
2361
2363
  function migrateWorkspaceConfig(dir, opts) {
2362
2364
  const filename = opts?.filename ?? "skaile.yaml";
2363
2365
  const filePath = path16.join(dir, filename);
2364
- if (!fs12.existsSync(filePath)) {
2366
+ if (!fs14.existsSync(filePath)) {
2365
2367
  return { migrated: false, version: 1, warnings: ["No skaile.yaml found"] };
2366
2368
  }
2367
- const content = fs12.readFileSync(filePath, "utf-8");
2369
+ const content = fs14.readFileSync(filePath, "utf-8");
2368
2370
  const raw = parse(content);
2369
2371
  if (!raw || typeof raw !== "object") {
2370
2372
  return { migrated: false, version: 1, warnings: ["Invalid YAML content"] };
@@ -2396,7 +2398,7 @@ function migrateWorkspaceConfig(dir, opts) {
2396
2398
  } else {
2397
2399
  doc.set("version", 2);
2398
2400
  }
2399
- fs12.writeFileSync(filePath, doc.toString(), "utf-8");
2401
+ fs14.writeFileSync(filePath, doc.toString(), "utf-8");
2400
2402
  }
2401
2403
  return {
2402
2404
  migrated: !opts?.dryRun,
@@ -3290,17 +3292,17 @@ var CatalogCache = class {
3290
3292
  /** Read a cached tarball from disk if present, otherwise `null`. */
3291
3293
  readTarball(sha256) {
3292
3294
  const p = this.tarballPath(sha256);
3293
- if (!fs12.existsSync(p)) return null;
3294
- return fs12.readFileSync(p);
3295
+ if (!fs14.existsSync(p)) return null;
3296
+ return fs14.readFileSync(p);
3295
3297
  }
3296
3298
  /** Persist a tarball blob to disk (atomic write). */
3297
3299
  writeTarball(sha256, bytes) {
3298
3300
  const dir = path16.join(this.dir, TARBALL_DIR);
3299
- if (!fs12.existsSync(dir)) fs12.mkdirSync(dir, { recursive: true });
3301
+ if (!fs14.existsSync(dir)) fs14.mkdirSync(dir, { recursive: true });
3300
3302
  const finalPath = this.tarballPath(sha256);
3301
3303
  const tmpPath = `${finalPath}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;
3302
- fs12.writeFileSync(tmpPath, bytes);
3303
- fs12.renameSync(tmpPath, finalPath);
3304
+ fs14.writeFileSync(tmpPath, bytes);
3305
+ fs14.renameSync(tmpPath, finalPath);
3304
3306
  }
3305
3307
  // ── public: invalidation ────────────────────────────────────────────────
3306
3308
  /**
@@ -3320,8 +3322,8 @@ var CatalogCache = class {
3320
3322
  invalidateEverything() {
3321
3323
  this.invalidateAll();
3322
3324
  const tarballDir = path16.join(this.dir, TARBALL_DIR);
3323
- if (fs12.existsSync(tarballDir)) {
3324
- fs12.rmSync(tarballDir, { recursive: true, force: true });
3325
+ if (fs14.existsSync(tarballDir)) {
3326
+ fs14.rmSync(tarballDir, { recursive: true, force: true });
3325
3327
  }
3326
3328
  }
3327
3329
  /** Return whether `ttlMs` is zero (air-gapped mode). */
@@ -3330,9 +3332,9 @@ var CatalogCache = class {
3330
3332
  }
3331
3333
  // ── private ─────────────────────────────────────────────────────────────
3332
3334
  ensureDir() {
3333
- if (!fs12.existsSync(this.dir)) fs12.mkdirSync(this.dir, { recursive: true });
3335
+ if (!fs14.existsSync(this.dir)) fs14.mkdirSync(this.dir, { recursive: true });
3334
3336
  const tarballDir = path16.join(this.dir, TARBALL_DIR);
3335
- if (!fs12.existsSync(tarballDir)) fs12.mkdirSync(tarballDir, { recursive: true });
3337
+ if (!fs14.existsSync(tarballDir)) fs14.mkdirSync(tarballDir, { recursive: true });
3336
3338
  }
3337
3339
  indexPath() {
3338
3340
  return path16.join(this.dir, INDEX_FILE);
@@ -3340,12 +3342,12 @@ var CatalogCache = class {
3340
3342
  loadIndex() {
3341
3343
  if (this.index) return this.index;
3342
3344
  const p = this.indexPath();
3343
- if (!fs12.existsSync(p)) {
3345
+ if (!fs14.existsSync(p)) {
3344
3346
  this.index = { version: 1, resolve: {}, list: {} };
3345
3347
  return this.index;
3346
3348
  }
3347
3349
  try {
3348
- const raw = JSON.parse(fs12.readFileSync(p, "utf-8"));
3350
+ const raw = JSON.parse(fs14.readFileSync(p, "utf-8"));
3349
3351
  if (raw && typeof raw === "object" && raw.version === 1) {
3350
3352
  this.index = {
3351
3353
  version: 1,
@@ -3363,8 +3365,8 @@ var CatalogCache = class {
3363
3365
  this.index = idx;
3364
3366
  const p = this.indexPath();
3365
3367
  const tmp = `${p}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;
3366
- fs12.writeFileSync(tmp, JSON.stringify(idx, null, 2), "utf-8");
3367
- fs12.renameSync(tmp, p);
3368
+ fs14.writeFileSync(tmp, JSON.stringify(idx, null, 2), "utf-8");
3369
+ fs14.renameSync(tmp, p);
3368
3370
  }
3369
3371
  };
3370
3372
  function filterKey(filter) {
@@ -3424,6 +3426,14 @@ function describeCatalogError(err, baseUrl) {
3424
3426
  const why = cause?.code ?? cause?.message ?? e?.message ?? String(err);
3425
3427
  return `cannot reach ${baseUrl} (${why})`;
3426
3428
  }
3429
+ var staleNoticed = /* @__PURE__ */ new Set();
3430
+ function staleCatalogNotice(baseUrl, err, ageMs) {
3431
+ if (staleNoticed.has(baseUrl)) return null;
3432
+ staleNoticed.add(baseUrl);
3433
+ const s = Math.max(0, Math.round(ageMs / 1e3));
3434
+ const age = s < 60 ? `${s} s` : s < 3600 ? `${Math.round(s / 60)} min` : s < 86400 ? `${Math.round(s / 3600)} h` : `${Math.round(s / 86400)} d`;
3435
+ return `The store is not reachable (${describeCatalogError(err, baseUrl)}). This answer comes from the cache and is ${age} old.`;
3436
+ }
3427
3437
  var DEFAULT_TTL_MS = 864e5;
3428
3438
  var RemoteCatalogSource = class {
3429
3439
  id;
@@ -3432,6 +3442,7 @@ var RemoteCatalogSource = class {
3432
3442
  cacheTtlMs;
3433
3443
  httpClient;
3434
3444
  silentBackgroundErrors;
3445
+ now;
3435
3446
  /** Tracks in-flight background revalidations so callers can `await` them in tests. */
3436
3447
  inFlight = /* @__PURE__ */ new Map();
3437
3448
  constructor(opts) {
@@ -3440,6 +3451,7 @@ var RemoteCatalogSource = class {
3440
3451
  this.cacheTtlMs = opts.cacheTtlMs ?? DEFAULT_TTL_MS;
3441
3452
  this.httpClient = opts.httpClient ?? defaultFetch;
3442
3453
  this.silentBackgroundErrors = opts.silentBackgroundErrors ?? false;
3454
+ this.now = opts.now ?? Date.now;
3443
3455
  this.cache = opts.cache ?? new CatalogCache({
3444
3456
  dir: opts.cacheDir,
3445
3457
  ttlMs: this.cacheTtlMs,
@@ -3473,7 +3485,11 @@ var RemoteCatalogSource = class {
3473
3485
  }
3474
3486
  const stale = this.cache.getResolveStale(ref);
3475
3487
  if (stale && (stale.value === null || stale.value.requires !== void 0)) {
3476
- this.scheduleBackground(`resolve:${ref}`, () => this.fetchAndStoreResolve(ref));
3488
+ this.scheduleBackground(
3489
+ `resolve:${ref}`,
3490
+ () => this.fetchAndStoreResolve(ref),
3491
+ stale.fetchedAt
3492
+ );
3477
3493
  return cachedAsset(stale.value);
3478
3494
  }
3479
3495
  try {
@@ -3565,7 +3581,11 @@ var RemoteCatalogSource = class {
3565
3581
  const stale = this.cache.getListStale(filter);
3566
3582
  if (stale) {
3567
3583
  const filterKey2 = JSON.stringify(filter ?? null);
3568
- this.scheduleBackground(`list:${filterKey2}`, () => this.fetchAndStoreList(filter));
3584
+ this.scheduleBackground(
3585
+ `list:${filterKey2}`,
3586
+ () => this.fetchAndStoreList(filter),
3587
+ stale.fetchedAt
3588
+ );
3569
3589
  return stale.items.map(cachedAsset);
3570
3590
  }
3571
3591
  try {
@@ -3774,17 +3794,16 @@ var RemoteCatalogSource = class {
3774
3794
  await Promise.allSettled(promises);
3775
3795
  }
3776
3796
  // ── private ─────────────────────────────────────────────────────────────
3777
- scheduleBackground(key, fn) {
3797
+ scheduleBackground(key, fn, servedFetchedAt) {
3778
3798
  if (this.inFlight.has(key)) return;
3779
3799
  const p = (async () => {
3780
3800
  try {
3781
3801
  await fn();
3782
3802
  } catch (err) {
3783
3803
  if (!this.silentBackgroundErrors) {
3784
- process.stderr.write(
3785
- `[skaile/catalog] Background refresh failed for ${key}: ${err instanceof Error ? err.message : String(err)}
3786
- `
3787
- );
3804
+ const line = staleCatalogNotice(this.baseUrl, err, this.now() - servedFetchedAt);
3805
+ if (line) process.stderr.write(`${line}
3806
+ `);
3788
3807
  }
3789
3808
  } finally {
3790
3809
  this.inFlight.delete(key);
@@ -3986,6 +4005,7 @@ var RestCatalogSource = class {
3986
4005
  cacheTtlMs;
3987
4006
  httpClient;
3988
4007
  silentBackgroundErrors;
4008
+ now;
3989
4009
  /** Tracks in-flight background revalidations so callers can `await` them in tests. */
3990
4010
  inFlight = /* @__PURE__ */ new Map();
3991
4011
  constructor(opts) {
@@ -3994,6 +4014,7 @@ var RestCatalogSource = class {
3994
4014
  this.cacheTtlMs = opts.cacheTtlMs ?? DEFAULT_TTL_MS2;
3995
4015
  this.httpClient = opts.httpClient ?? defaultFetch2;
3996
4016
  this.silentBackgroundErrors = opts.silentBackgroundErrors ?? false;
4017
+ this.now = opts.now ?? Date.now;
3997
4018
  this.cache = opts.cache ?? new CatalogCache({
3998
4019
  dir: opts.cacheDir,
3999
4020
  ttlMs: this.cacheTtlMs,
@@ -4020,7 +4041,11 @@ var RestCatalogSource = class {
4020
4041
  }
4021
4042
  const stale = this.cache.getResolveStale(ref);
4022
4043
  if (stale) {
4023
- this.scheduleBackground(`resolve:${ref}`, () => this.fetchAndStoreResolve(ref));
4044
+ this.scheduleBackground(
4045
+ `resolve:${ref}`,
4046
+ () => this.fetchAndStoreResolve(ref),
4047
+ stale.fetchedAt
4048
+ );
4024
4049
  return stale.value;
4025
4050
  }
4026
4051
  return this.fetchAndStoreResolve(ref);
@@ -4046,7 +4071,11 @@ var RestCatalogSource = class {
4046
4071
  const stale = this.cache.getListStale(filter);
4047
4072
  if (stale) {
4048
4073
  const filterKey2 = JSON.stringify(filter ?? null);
4049
- this.scheduleBackground(`list:${filterKey2}`, () => this.fetchAndStoreList(filter));
4074
+ this.scheduleBackground(
4075
+ `list:${filterKey2}`,
4076
+ () => this.fetchAndStoreList(filter),
4077
+ stale.fetchedAt
4078
+ );
4050
4079
  return stale.items;
4051
4080
  }
4052
4081
  return this.fetchAndStoreList(filter);
@@ -4186,17 +4215,16 @@ var RestCatalogSource = class {
4186
4215
  await Promise.allSettled(promises);
4187
4216
  }
4188
4217
  // ── private ─────────────────────────────────────────────────────────────
4189
- scheduleBackground(key, fn) {
4218
+ scheduleBackground(key, fn, servedFetchedAt) {
4190
4219
  if (this.inFlight.has(key)) return;
4191
4220
  const p = (async () => {
4192
4221
  try {
4193
4222
  await fn();
4194
4223
  } catch (err) {
4195
4224
  if (!this.silentBackgroundErrors) {
4196
- process.stderr.write(
4197
- `[skaile/catalog] Background refresh failed for ${key}: ${err instanceof Error ? err.message : String(err)}
4198
- `
4199
- );
4225
+ const line = staleCatalogNotice(this.baseUrl, err, this.now() - servedFetchedAt);
4226
+ if (line) process.stderr.write(`${line}
4227
+ `);
4200
4228
  }
4201
4229
  } finally {
4202
4230
  this.inFlight.delete(key);
@@ -4359,15 +4387,15 @@ function discoveredToAssetEntry(asset, repoPublisher, inheritPublisher) {
4359
4387
  }
4360
4388
  function writeCuratedManifest(input) {
4361
4389
  const manifestPath = input.manifestFile;
4362
- if (fs12.existsSync(manifestPath) && !input.force) {
4390
+ if (fs14.existsSync(manifestPath) && !input.force) {
4363
4391
  return { wrote: false, manifestPath, assetCount: 0 };
4364
4392
  }
4365
4393
  const publisher = input.publisher.startsWith("@") ? input.publisher.slice(1) : input.publisher;
4366
4394
  const inheritPublisher = input.inheritPublisher ?? false;
4367
4395
  const assets = input.assets.map((a) => discoveredToAssetEntry(a, publisher, inheritPublisher)).sort((a, b) => `${a.kind}:${a.name}`.localeCompare(`${b.kind}:${b.name}`));
4368
4396
  const manifest = { publisher, assets };
4369
- fs12.mkdirSync(path16.dirname(manifestPath), { recursive: true });
4370
- fs12.writeFileSync(manifestPath, encodeSkaileManifest(manifest), "utf-8");
4397
+ fs14.mkdirSync(path16.dirname(manifestPath), { recursive: true });
4398
+ fs14.writeFileSync(manifestPath, encodeSkaileManifest(manifest), "utf-8");
4371
4399
  return { wrote: true, manifestPath, assetCount: assets.length };
4372
4400
  }
4373
4401
  function filesEntryPaths(libraryPath, entry) {
@@ -4378,11 +4406,104 @@ function filesEntryPaths(libraryPath, entry) {
4378
4406
  return expandManifestFiles(libraryPath, patterns).files;
4379
4407
  }
4380
4408
  var DEFAULT_ASSET_VERSION = "0.1.0";
4409
+ var MANIFEST_LOCK_WAIT_MS = 2e4;
4410
+ var MANIFEST_LOCK_STALE_MS = 1e4;
4411
+ function sleepSync(ms) {
4412
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
4413
+ }
4414
+ function manifestLockFile(libraryPath) {
4415
+ const dir = path16.resolve(libraryPath);
4416
+ fs14.mkdirSync(dir, { recursive: true });
4417
+ const id = createHash("sha256").update(fs14.realpathSync(dir)).digest("hex").slice(0, 24);
4418
+ const lockDir = path16.join(os.tmpdir(), "skaile-manifest-locks");
4419
+ fs14.mkdirSync(lockDir, { recursive: true });
4420
+ return path16.join(lockDir, `${id}.lock`);
4421
+ }
4422
+ function manifestLockIsStale(lockFile) {
4423
+ try {
4424
+ const stat = fs14.statSync(lockFile);
4425
+ if (Date.now() - stat.mtimeMs > MANIFEST_LOCK_STALE_MS) return true;
4426
+ const pid = Number.parseInt(fs14.readFileSync(lockFile, "utf8"), 10);
4427
+ if (!Number.isInteger(pid) || pid <= 0) return false;
4428
+ try {
4429
+ process.kill(pid, 0);
4430
+ } catch (err) {
4431
+ return err.code === "ESRCH";
4432
+ }
4433
+ return false;
4434
+ } catch {
4435
+ return false;
4436
+ }
4437
+ }
4438
+ function takeOverStaleLock(lockFile) {
4439
+ let seen;
4440
+ try {
4441
+ seen = fs14.readFileSync(lockFile, "utf8");
4442
+ } catch {
4443
+ return false;
4444
+ }
4445
+ if (!manifestLockIsStale(lockFile)) return false;
4446
+ const moved = `${lockFile}.stale.${process.pid}.${randomBytes(6).toString("hex")}`;
4447
+ try {
4448
+ fs14.renameSync(lockFile, moved);
4449
+ } catch {
4450
+ return false;
4451
+ }
4452
+ let held;
4453
+ try {
4454
+ held = fs14.readFileSync(moved, "utf8");
4455
+ } catch {
4456
+ return false;
4457
+ }
4458
+ if (held === seen) {
4459
+ fs14.rmSync(moved, { force: true });
4460
+ return true;
4461
+ }
4462
+ try {
4463
+ fs14.linkSync(moved, lockFile);
4464
+ } catch {
4465
+ }
4466
+ fs14.rmSync(moved, { force: true });
4467
+ return false;
4468
+ }
4469
+ function withManifestLock(libraryPath, fn) {
4470
+ const lockFile = manifestLockFile(libraryPath);
4471
+ const token = `${process.pid}:${randomBytes(8).toString("hex")}`;
4472
+ const deadline = Date.now() + MANIFEST_LOCK_WAIT_MS;
4473
+ for (; ; ) {
4474
+ try {
4475
+ const fd = fs14.openSync(lockFile, "wx");
4476
+ try {
4477
+ fs14.writeSync(fd, token);
4478
+ } finally {
4479
+ fs14.closeSync(fd);
4480
+ }
4481
+ break;
4482
+ } catch (err) {
4483
+ if (err.code !== "EEXIST") throw err;
4484
+ if (takeOverStaleLock(lockFile)) continue;
4485
+ if (Date.now() > deadline) {
4486
+ throw new Error(
4487
+ `${SKAILE_MANIFEST_FILENAME} of ${path16.resolve(libraryPath)} is being written by another skaile process; retry in a moment.`
4488
+ );
4489
+ }
4490
+ sleepSync(5 + Math.floor(Math.random() * 20));
4491
+ }
4492
+ }
4493
+ try {
4494
+ return fn();
4495
+ } finally {
4496
+ try {
4497
+ if (fs14.readFileSync(lockFile, "utf8") === token) fs14.rmSync(lockFile, { force: true });
4498
+ } catch {
4499
+ }
4500
+ }
4501
+ }
4381
4502
  function openManifest(libraryPath) {
4382
4503
  const dir = path16.resolve(libraryPath);
4383
4504
  const file = path16.join(dir, SKAILE_MANIFEST_FILENAME);
4384
- if (!fs12.existsSync(file)) {
4385
- fs12.mkdirSync(dir, { recursive: true });
4505
+ if (!fs14.existsSync(file)) {
4506
+ fs14.mkdirSync(dir, { recursive: true });
4386
4507
  return { editor: ManifestYamlEditor.create(file), created: true };
4387
4508
  }
4388
4509
  const editor = ManifestYamlEditor.load(file);
@@ -4392,14 +4513,14 @@ function openManifest(libraryPath) {
4392
4513
  }
4393
4514
  function assertManifestEditable(libraryPath) {
4394
4515
  const file = path16.join(path16.resolve(libraryPath), SKAILE_MANIFEST_FILENAME);
4395
- if (!fs12.existsSync(file)) return;
4516
+ if (!fs14.existsSync(file)) return;
4396
4517
  openManifest(libraryPath);
4397
4518
  }
4398
4519
  function assetRootProblem(libraryPath, root) {
4399
4520
  const libDir = path16.resolve(libraryPath);
4400
4521
  let realLib;
4401
4522
  try {
4402
- realLib = fs12.realpathSync(libDir);
4523
+ realLib = fs14.realpathSync(libDir);
4403
4524
  } catch {
4404
4525
  return void 0;
4405
4526
  }
@@ -4418,12 +4539,12 @@ function assetRootProblem(libraryPath, root) {
4418
4539
  walked.push(part);
4419
4540
  let stat;
4420
4541
  try {
4421
- stat = fs12.lstatSync(current);
4542
+ stat = fs14.lstatSync(current);
4422
4543
  } catch {
4423
4544
  return void 0;
4424
4545
  }
4425
4546
  if (stat.isSymbolicLink()) {
4426
- return librarySymlinkMessage({ path: walked.join("/"), target: fs12.readlinkSync(current) });
4547
+ return librarySymlinkMessage({ path: walked.join("/"), target: fs14.readlinkSync(current) });
4427
4548
  }
4428
4549
  }
4429
4550
  return void 0;
@@ -4438,80 +4559,92 @@ function existingRootConflict(libraryPath, existing, root) {
4438
4559
  if (!existing?.root || existing.source) return void 0;
4439
4560
  const existingAbs = path16.resolve(libraryPath, existing.root);
4440
4561
  if (existingAbs === path16.resolve(libraryPath, root)) return void 0;
4441
- const stat = fs12.statSync(existingAbs, { throwIfNoEntry: false });
4562
+ const stat = fs14.statSync(existingAbs, { throwIfNoEntry: false });
4442
4563
  return stat?.isDirectory() ? existing.root : void 0;
4443
4564
  }
4444
4565
  function upsertManifestAsset(libraryPath, input) {
4445
4566
  if (input.root.split(/[\\/]+/).includes("..")) {
4446
4567
  throw new Error(`Asset root "${input.root}" must stay inside the library (no "..").`);
4447
4568
  }
4448
- const { editor } = openManifest(libraryPath);
4449
- const declared = editor.getPublisher();
4450
- const topLevel = declared === void 0 ? void 0 : barePublisher(declared);
4451
- const overridesTopLevel = !!input.publisher && input.publisher !== topLevel;
4452
- const entry = { kind: input.kind, name: input.name, root: input.root };
4453
- if (input.version) entry.version = input.version;
4454
- if (overridesTopLevel) entry.publisher = input.publisher;
4455
- if (input.description) entry.description = input.description;
4456
- if (input.keywords && input.keywords.length > 0) entry.keywords = input.keywords;
4457
- const existing = editor.getAssets().find((a) => a.kind === input.kind && a.name === input.name);
4458
- const conflict = existingRootConflict(libraryPath, existing, input.root);
4459
- if (conflict) {
4460
- throw new Error(
4461
- `${input.kind}:${input.name} is already registered at "${conflict}" \u2014 "${input.root}" would re-point it and orphan the first asset. Remove or rename one of them.`
4462
- );
4463
- }
4464
- const next = existing ? { ...existing, ...entry } : entry;
4465
- if (existing?.files && !existing.root && !existing.source) delete next.root;
4466
- if (existing && input.publisher && !overridesTopLevel) delete next.publisher;
4467
- if (!existing || !isDeepStrictEqual(existing, next)) {
4468
- editor.setAsset(next);
4469
- editor.save();
4470
- }
4471
- return { manifestPath: editor.path, added: !existing };
4569
+ return withManifestLock(libraryPath, () => {
4570
+ const { editor } = openManifest(libraryPath);
4571
+ const declared = editor.getPublisher();
4572
+ const topLevel = declared === void 0 ? void 0 : barePublisher(declared);
4573
+ const overridesTopLevel = !!input.publisher && input.publisher !== topLevel;
4574
+ const entry = { kind: input.kind, name: input.name, root: input.root };
4575
+ if (input.version) entry.version = input.version;
4576
+ if (overridesTopLevel) entry.publisher = input.publisher;
4577
+ if (input.description) entry.description = input.description;
4578
+ if (input.keywords && input.keywords.length > 0) entry.keywords = input.keywords;
4579
+ const existing = editor.getAssets().find((a) => a.kind === input.kind && a.name === input.name);
4580
+ const conflict = existingRootConflict(libraryPath, existing, input.root);
4581
+ if (conflict) {
4582
+ throw new Error(
4583
+ `${input.kind}:${input.name} is already registered at "${conflict}" \u2014 "${input.root}" would re-point it and orphan the first asset. Remove or rename one of them.`
4584
+ );
4585
+ }
4586
+ const next = existing ? { ...existing, ...entry } : entry;
4587
+ if (existing?.files && !existing.root && !existing.source) delete next.root;
4588
+ if (existing && input.publisher && !overridesTopLevel) delete next.publisher;
4589
+ if (!existing || !isDeepStrictEqual(existing, next)) {
4590
+ editor.setAsset(next);
4591
+ editor.save();
4592
+ }
4593
+ return { manifestPath: editor.path, added: !existing };
4594
+ });
4472
4595
  }
4473
4596
  function missingRootAssets(libraryPath, manifest) {
4474
4597
  return (manifest.assets ?? []).filter((a) => {
4475
4598
  if (a.source || manifest.source || !a.root) return false;
4476
4599
  const dir = path16.resolve(libraryPath, a.root);
4477
- return !(fs12.existsSync(dir) && fs12.statSync(dir).isDirectory());
4600
+ return !(fs14.existsSync(dir) && fs14.statSync(dir).isDirectory());
4478
4601
  });
4479
4602
  }
4480
4603
  function pruneMissingRootAssets(libraryPath) {
4481
4604
  const manifest = loadSkPublishManifest(libraryPath);
4482
- if (!manifest) return [];
4483
- const missing = missingRootAssets(libraryPath, manifest);
4484
- if (missing.length === 0) return [];
4485
- const { editor } = openManifest(libraryPath);
4486
- const removed = missing.filter((a) => editor.removeAsset(a.kind, a.name));
4487
- if (removed.length > 0) editor.save();
4488
- return removed;
4605
+ if (!manifest || missingRootAssets(libraryPath, manifest).length === 0) return [];
4606
+ return withManifestLock(libraryPath, () => {
4607
+ const current = loadSkPublishManifest(libraryPath);
4608
+ const missing = current ? missingRootAssets(libraryPath, current) : [];
4609
+ if (missing.length === 0) return [];
4610
+ const { editor } = openManifest(libraryPath);
4611
+ const removed = missing.filter((a) => editor.removeAsset(a.kind, a.name));
4612
+ if (removed.length > 0) editor.save();
4613
+ return removed;
4614
+ });
4489
4615
  }
4490
4616
  function pruneUnknownKindAssets(libraryPath, knownKinds) {
4617
+ const unknownOf = (manifest2) => (manifest2.assets ?? []).filter((a) => !knownKinds.has(a.kind));
4491
4618
  const manifest = loadSkPublishManifest(libraryPath);
4492
- if (!manifest) return [];
4493
- const unknown = (manifest.assets ?? []).filter((a) => !knownKinds.has(a.kind));
4494
- if (unknown.length === 0) return [];
4495
- const { editor } = openManifest(libraryPath);
4496
- const removed = unknown.filter((a) => editor.removeAsset(a.kind, a.name));
4497
- if (removed.length > 0) editor.save();
4498
- return removed;
4619
+ if (!manifest || unknownOf(manifest).length === 0) return [];
4620
+ return withManifestLock(libraryPath, () => {
4621
+ const unknown = unknownOf(loadSkPublishManifest(libraryPath) ?? {});
4622
+ if (unknown.length === 0) return [];
4623
+ const { editor } = openManifest(libraryPath);
4624
+ const removed = unknown.filter((a) => editor.removeAsset(a.kind, a.name));
4625
+ if (removed.length > 0) editor.save();
4626
+ return removed;
4627
+ });
4499
4628
  }
4500
4629
  function stampManifestPublisher(libraryPath, publisher) {
4501
- const { editor, created } = openManifest(libraryPath);
4502
- if (editor.getPublisher()) return false;
4503
- editor.setPublisher(publisher);
4504
- if (created) editor.ensureAssets();
4505
- editor.save();
4506
- return true;
4630
+ return withManifestLock(libraryPath, () => {
4631
+ const { editor, created } = openManifest(libraryPath);
4632
+ if (editor.getPublisher()) return false;
4633
+ editor.setPublisher(publisher);
4634
+ if (created) editor.ensureAssets();
4635
+ editor.save();
4636
+ return true;
4637
+ });
4507
4638
  }
4508
4639
  function setManifestPublisher(libraryPath, publisher) {
4509
- const { editor, created } = openManifest(libraryPath);
4510
- if (editor.getPublisher() === publisher) return false;
4511
- editor.setPublisher(publisher);
4512
- if (created) editor.ensureAssets();
4513
- editor.save();
4514
- return true;
4640
+ return withManifestLock(libraryPath, () => {
4641
+ const { editor, created } = openManifest(libraryPath);
4642
+ if (editor.getPublisher() === publisher) return false;
4643
+ editor.setPublisher(publisher);
4644
+ if (created) editor.ensureAssets();
4645
+ editor.save();
4646
+ return true;
4647
+ });
4515
4648
  }
4516
4649
  function reconcileEntryNames(libraryPath, scanned, refused) {
4517
4650
  const renamed = [];
@@ -4536,7 +4669,7 @@ function reconcileEntryNames(libraryPath, scanned, refused) {
4536
4669
  );
4537
4670
  if (renamedAway) {
4538
4671
  superseded.push(entry);
4539
- edits.push((editor2) => editor2.removeAsset(entry.kind, entry.name));
4672
+ edits.push((editor) => editor.removeAsset(entry.kind, entry.name));
4540
4673
  }
4541
4674
  continue;
4542
4675
  }
@@ -4545,16 +4678,18 @@ function reconcileEntryNames(libraryPath, scanned, refused) {
4545
4678
  if (target) {
4546
4679
  listed.add(`${target.kind}:${target.name}`);
4547
4680
  renamed.push({ from: entry, to: target.name });
4548
- edits.push((editor2) => editor2.renameAsset(entry.kind, entry.name, target.name));
4681
+ edits.push((editor) => editor.renameAsset(entry.kind, entry.name, target.name));
4549
4682
  } else if (free.length === 0) {
4550
4683
  superseded.push(entry);
4551
- edits.push((editor2) => editor2.removeAsset(entry.kind, entry.name));
4684
+ edits.push((editor) => editor.removeAsset(entry.kind, entry.name));
4552
4685
  }
4553
4686
  }
4554
4687
  if (edits.length === 0) return { renamed, superseded };
4555
- const { editor } = openManifest(libraryPath);
4556
- for (const edit of edits) edit(editor);
4557
- editor.save();
4688
+ withManifestLock(libraryPath, () => {
4689
+ const { editor } = openManifest(libraryPath);
4690
+ for (const edit of edits) edit(editor);
4691
+ editor.save();
4692
+ });
4558
4693
  return { renamed, superseded };
4559
4694
  }
4560
4695
  async function syncManifestWithDisk(libraryPath, defaultPublisher, registry, opts = {}) {
@@ -4719,14 +4854,14 @@ async function unparsableAssetFiles(libraryPath, registry) {
4719
4854
  }
4720
4855
  function isParsable(file) {
4721
4856
  try {
4722
- return parseManifestFile(file, fs12.readFileSync(file, "utf-8")).ok;
4857
+ return parseManifestFile(file, fs14.readFileSync(file, "utf-8")).ok;
4723
4858
  } catch {
4724
4859
  return false;
4725
4860
  }
4726
4861
  }
4727
4862
  function parseFailureOf(file) {
4728
4863
  try {
4729
- const res = parseManifestFile(file, fs12.readFileSync(file, "utf-8"));
4864
+ const res = parseManifestFile(file, fs14.readFileSync(file, "utf-8"));
4730
4865
  return res.ok ? void 0 : res.reason;
4731
4866
  } catch (err) {
4732
4867
  return err instanceof Error ? err.message : String(err);
@@ -4734,7 +4869,7 @@ function parseFailureOf(file) {
4734
4869
  }
4735
4870
  function declaresInvalidName(file, kind) {
4736
4871
  try {
4737
- const res = parseManifestFile(file, fs12.readFileSync(file, "utf-8"));
4872
+ const res = parseManifestFile(file, fs14.readFileSync(file, "utf-8"));
4738
4873
  if (!res.ok) return false;
4739
4874
  const declared = kind === "flow" ? res.data.id : res.data.name;
4740
4875
  if (declared === void 0 || declared === null || declared === "") return false;
@@ -4796,8 +4931,8 @@ function parseWorkspaceV2(raw) {
4796
4931
  }
4797
4932
  function loadWorkspaceV2(dir, filename = "skaile.yaml") {
4798
4933
  const filePath = path16.join(dir, filename);
4799
- if (!fs12.existsSync(filePath)) return null;
4800
- const content = fs12.readFileSync(filePath, "utf-8");
4934
+ if (!fs14.existsSync(filePath)) return null;
4935
+ const content = fs14.readFileSync(filePath, "utf-8");
4801
4936
  const raw = parse(content);
4802
4937
  if (!raw || typeof raw !== "object") return null;
4803
4938
  return parseWorkspaceV2(raw);
@@ -4805,23 +4940,23 @@ function loadWorkspaceV2(dir, filename = "skaile.yaml") {
4805
4940
  function saveWorkspaceV2(dir, v2, filename = "skaile.yaml") {
4806
4941
  const filePath = path16.join(dir, filename);
4807
4942
  let existing = {};
4808
- if (fs12.existsSync(filePath)) {
4809
- const content = fs12.readFileSync(filePath, "utf-8");
4943
+ if (fs14.existsSync(filePath)) {
4944
+ const content = fs14.readFileSync(filePath, "utf-8");
4810
4945
  existing = parse(content) ?? {};
4811
4946
  }
4812
4947
  existing.version = 2;
4813
4948
  if (v2.library !== void 0) existing.library = v2.library;
4814
4949
  if (v2.presets_applied !== void 0) existing.presets_applied = v2.presets_applied;
4815
- if (!fs12.existsSync(dir)) {
4816
- fs12.mkdirSync(dir, { recursive: true });
4950
+ if (!fs14.existsSync(dir)) {
4951
+ fs14.mkdirSync(dir, { recursive: true });
4817
4952
  }
4818
- fs12.writeFileSync(filePath, stringify(existing, { indent: 2 }), "utf-8");
4953
+ fs14.writeFileSync(filePath, stringify(existing, { indent: 2 }), "utf-8");
4819
4954
  }
4820
4955
  var LOCK_FILENAME = "skaile.lock.yaml";
4821
4956
  function loadLockFile(dir) {
4822
4957
  const filePath = path16.join(dir, LOCK_FILENAME);
4823
- if (!fs12.existsSync(filePath)) return null;
4824
- const content = fs12.readFileSync(filePath, "utf-8");
4958
+ if (!fs14.existsSync(filePath)) return null;
4959
+ const content = fs14.readFileSync(filePath, "utf-8");
4825
4960
  const raw = parse(content);
4826
4961
  if (raw !== null && !("assignments" in raw) && "subscriptions" in raw) {
4827
4962
  const legacySubs = raw.subscriptions;
@@ -4838,10 +4973,10 @@ function loadLockFile(dir) {
4838
4973
  }
4839
4974
  function saveLockFile(dir, lock) {
4840
4975
  const filePath = path16.join(dir, LOCK_FILENAME);
4841
- if (!fs12.existsSync(dir)) {
4842
- fs12.mkdirSync(dir, { recursive: true });
4976
+ if (!fs14.existsSync(dir)) {
4977
+ fs14.mkdirSync(dir, { recursive: true });
4843
4978
  }
4844
- fs12.writeFileSync(
4979
+ fs14.writeFileSync(
4845
4980
  filePath,
4846
4981
  `# Auto-generated by skaile. Do not edit manually.
4847
4982
  ${stringify(lock, { indent: 2 })}`,
@@ -4859,13 +4994,13 @@ function createEmptyLockFile() {
4859
4994
  }
4860
4995
  function detectWorkspaceVersion(dir, filename = "skaile.yaml") {
4861
4996
  const filePath = path16.join(dir, filename);
4862
- if (!fs12.existsSync(filePath)) return null;
4863
- const content = fs12.readFileSync(filePath, "utf-8");
4997
+ if (!fs14.existsSync(filePath)) return null;
4998
+ const content = fs14.readFileSync(filePath, "utf-8");
4864
4999
  const raw = parse(content);
4865
5000
  if (!raw || typeof raw !== "object") return null;
4866
5001
  return raw.version === 2 ? 2 : 1;
4867
5002
  }
4868
5003
 
4869
5004
  export { AssignmentNotFoundError, CatalogCache, CatalogConfigSchema, CatalogHttpError, DuplicateAssignmentError, DuplicateLibraryNameError, GitSyncDriver, InstanceHasConsumersError, InstanceNotFoundError, InterpolationError, KnowledgeManifestSchema, LIBRARY_BACKENDS, LIBRARY_OWNERSHIPS, LOCAL_CATALOG_URL, LibraryConfigSchema, LibraryError, LibraryInstanceRefSchema, LibraryManager, LibrarySectionSchema, LibrarySyncError, LocalCatalogSource, LocalIndex, LocalSyncDriver, LockAssignmentSchema, LockFileSchema, OfflineError, OperationNotPermittedError, PIN_POLICIES, PinPolicySchema, PresetAppliedSchema, PresetExpandedSchema, RemoteCatalogSource, RequiresEdgeSchema, RestCatalogSource, SidecarGit, SkaileConfigSchema, SourceNotFoundError, TarballHashMismatchError, UNLISTED_SCAN_SKIP_DIRS, UserLibraryNotFoundError, WorkspaceConfigV2Schema, applyNonStructuralUpgrade, applyPreset, applyPresetFromData, assertManifestEditable, assertValidLibraryName, assetRootProblem, classifyRef, cloneOrInitGitRepo, commitStoreManifest, conflictingAssetRoot, createEmptyLockFile, curatedManifestOverlay, deriveSlug, describeCatalogError, detectChanges, detectNestedPresetRefs, detectWorkspaceVersion, ensureGitRepo, evaluateUpgrade, extractLibraryInstanceId, extractReferencedKeys, filesEntryPaths, filterKey, getConfigDefaults, getDefaultValue, getSidecarRoot, getStoreManifestsDir, getStoreRoot, hasInterpolationTokens, installLibraryAsset, interpolate, isGitRepo, isLocalCatalogUrl, isSecretPlaceholder, knowledgeKindProvider, lastLibraryName, libraryDirMissing, listSidecarSlugsOnDisk, loadLockFile, loadWorkspaceV2, markLibraryUnregistered, migrateSidecarsToStoreIfNeeded, migrateWorkspaceConfig, missingLibraryDirMessage, missingRootAssets, parsePreset, parsePresetYaml, parseWorkspaceV2, projectConfigPath, pruneMissingRootAssets, queryInstancePickerChoices, recordLibraryRename, renamedLibraryName, resolveAllItems, resolveConfig, resolveIndexPath, resolveItem, resolvePin, resolveSidecarPaths, saveConfig, saveLockFile, saveWorkspaceV2, scanAuthoringLibraries, scanLibraryRoot, scanUnlistedAssets, setManifestPublisher, setOriginUrl, sha256Hex, stampManifestPublisher, storeManifestFile, storeSecrets, syncManifestWithDisk, trackOriginBranch, trpcGetUrl, unparsableAssetFiles, unregisteredLibraryNames, upsertManifestAsset, validateAllPlaceholders, validateKnowledge, validateNestingDepth, validatePlaceholder, writeCuratedManifest };
4870
- //# sourceMappingURL=chunk-Y3I4KGLX.js.map
4871
- //# sourceMappingURL=chunk-Y3I4KGLX.js.map
5005
+ //# sourceMappingURL=chunk-TGUMN5G7.js.map
5006
+ //# sourceMappingURL=chunk-TGUMN5G7.js.map