@skaile/workspaces 5.10.0 → 5.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (255) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +12 -0
  3. package/dist/{asset-feeds-ELEBTNUS.js → asset-feeds-CXGQIDFR.js} +18 -18
  4. package/dist/{asset-feeds-ELEBTNUS.js.map → asset-feeds-CXGQIDFR.js.map} +1 -1
  5. package/dist/asset-manager/catalog-deployer.js +7 -7
  6. package/dist/asset-manager/index.js +13 -13
  7. package/dist/asset-manager/installer.js +9 -9
  8. package/dist/asset-manager/renderers.js +8 -8
  9. package/dist/asset-manager/src/index.d.ts +103 -2
  10. package/dist/asset-manager/src/index.d.ts.map +1 -1
  11. package/dist/asset-manager/src/install-instances.d.ts.map +1 -1
  12. package/dist/asset-manager/src/installer.d.ts +23 -3
  13. package/dist/asset-manager/src/installer.d.ts.map +1 -1
  14. package/dist/bridge/drivers/claude-sdk.js +10 -10
  15. package/dist/bridge/drivers/codex.js +9 -9
  16. package/dist/bridge/drivers/continue.js +9 -9
  17. package/dist/bridge/drivers/echo.js +1 -1
  18. package/dist/bridge/drivers/gemini.js +6 -6
  19. package/dist/bridge/drivers/goose.js +9 -9
  20. package/dist/bridge/drivers/omp.js +18 -2
  21. package/dist/bridge/drivers/omp.js.map +1 -1
  22. package/dist/bridge/drivers/opencode.js +9 -9
  23. package/dist/bridge/drivers/qwen.js +6 -6
  24. package/dist/bridge/index.js +11 -11
  25. package/dist/bridge/src/drivers/omp.d.ts.map +1 -1
  26. package/dist/{chunk-3BEY4WK3.js → chunk-2F5AWQX5.js} +77 -11
  27. package/dist/chunk-2F5AWQX5.js.map +1 -0
  28. package/dist/{chunk-IJHH4DSW.js → chunk-3SM2DL2T.js} +8 -8
  29. package/dist/{chunk-IJHH4DSW.js.map → chunk-3SM2DL2T.js.map} +1 -1
  30. package/dist/{chunk-HJ5MCB3L.js → chunk-47U4GZ4M.js} +2 -2
  31. package/dist/{chunk-HJ5MCB3L.js.map → chunk-47U4GZ4M.js.map} +1 -1
  32. package/dist/{chunk-7CR6HT2X.js → chunk-4A4OD24G.js} +9 -9
  33. package/dist/{chunk-7CR6HT2X.js.map → chunk-4A4OD24G.js.map} +1 -1
  34. package/dist/{chunk-5QI2JYJC.js → chunk-6O2X3GPW.js} +2 -2
  35. package/dist/{chunk-5QI2JYJC.js.map → chunk-6O2X3GPW.js.map} +1 -1
  36. package/dist/{chunk-JZCSNEHK.js → chunk-ALEYHUC5.js} +42 -20
  37. package/dist/chunk-ALEYHUC5.js.map +1 -0
  38. package/dist/{chunk-4OV5DSBB.js → chunk-BNMZVPYA.js} +5 -5
  39. package/dist/chunk-BNMZVPYA.js.map +1 -0
  40. package/dist/{chunk-SBFW3CJH.js → chunk-CAHB6MHA.js} +5 -5
  41. package/dist/{chunk-SBFW3CJH.js.map → chunk-CAHB6MHA.js.map} +1 -1
  42. package/dist/{chunk-4P3KTUZH.js → chunk-CJERAGFY.js} +24 -13
  43. package/dist/chunk-CJERAGFY.js.map +1 -0
  44. package/dist/{chunk-MVQ3Q2HM.js → chunk-COH6FQAG.js} +4 -4
  45. package/dist/{chunk-MVQ3Q2HM.js.map → chunk-COH6FQAG.js.map} +1 -1
  46. package/dist/{chunk-ZGQTS3Y4.js → chunk-CPWLNZGJ.js} +3 -3
  47. package/dist/{chunk-ZGQTS3Y4.js.map → chunk-CPWLNZGJ.js.map} +1 -1
  48. package/dist/{chunk-MGGFBZWA.js → chunk-D3B36CYC.js} +4 -3
  49. package/dist/chunk-D3B36CYC.js.map +1 -0
  50. package/dist/{chunk-2JMLDZLP.js → chunk-DZMNFCWB.js} +416 -55
  51. package/dist/chunk-DZMNFCWB.js.map +1 -0
  52. package/dist/{chunk-GFCXNFTW.js → chunk-EDYHEMJA.js} +4 -4
  53. package/dist/{chunk-GFCXNFTW.js.map → chunk-EDYHEMJA.js.map} +1 -1
  54. package/dist/{chunk-PE36IF2D.js → chunk-FH7W6TJ4.js} +65 -31
  55. package/dist/chunk-FH7W6TJ4.js.map +1 -0
  56. package/dist/{chunk-G54USEUP.js → chunk-G4FFOV3N.js} +4 -4
  57. package/dist/{chunk-G54USEUP.js.map → chunk-G4FFOV3N.js.map} +1 -1
  58. package/dist/{chunk-HOHUEKES.js → chunk-GCHPUTA3.js} +3 -3
  59. package/dist/{chunk-HOHUEKES.js.map → chunk-GCHPUTA3.js.map} +1 -1
  60. package/dist/{chunk-TRSQP3JD.js → chunk-GV4DZ6MT.js} +20 -4
  61. package/dist/chunk-GV4DZ6MT.js.map +1 -0
  62. package/dist/{chunk-QG3HOJEK.js → chunk-HCEVNYSH.js} +3 -3
  63. package/dist/{chunk-QG3HOJEK.js.map → chunk-HCEVNYSH.js.map} +1 -1
  64. package/dist/{chunk-6HHE63CO.js → chunk-HZXUXHIV.js} +4 -4
  65. package/dist/{chunk-6HHE63CO.js.map → chunk-HZXUXHIV.js.map} +1 -1
  66. package/dist/{chunk-FRPBSUFH.js → chunk-IER3KIPH.js} +5 -5
  67. package/dist/{chunk-FRPBSUFH.js.map → chunk-IER3KIPH.js.map} +1 -1
  68. package/dist/{chunk-GEWAIQZ5.js → chunk-J4RBUFGM.js} +10 -12
  69. package/dist/chunk-J4RBUFGM.js.map +1 -0
  70. package/dist/{chunk-OOWHXOK6.js → chunk-M3B6EIJD.js} +4 -4
  71. package/dist/{chunk-OOWHXOK6.js.map → chunk-M3B6EIJD.js.map} +1 -1
  72. package/dist/{chunk-VLXDXRRX.js → chunk-MZG34MBZ.js} +3 -3
  73. package/dist/{chunk-VLXDXRRX.js.map → chunk-MZG34MBZ.js.map} +1 -1
  74. package/dist/{chunk-2FMEGSBN.js → chunk-PBBPZYVG.js} +31 -9
  75. package/dist/chunk-PBBPZYVG.js.map +1 -0
  76. package/dist/{chunk-CLTHEKHR.js → chunk-PQFHMQHQ.js} +4 -4
  77. package/dist/{chunk-CLTHEKHR.js.map → chunk-PQFHMQHQ.js.map} +1 -1
  78. package/dist/{chunk-SX5U422E.js → chunk-QVFAS5IO.js} +3 -3
  79. package/dist/{chunk-SX5U422E.js.map → chunk-QVFAS5IO.js.map} +1 -1
  80. package/dist/{chunk-JFXQEVLF.js → chunk-QZNJOHN6.js} +3 -3
  81. package/dist/{chunk-JFXQEVLF.js.map → chunk-QZNJOHN6.js.map} +1 -1
  82. package/dist/{chunk-V5TZH4GF.js → chunk-R7NHYEJF.js} +4 -4
  83. package/dist/{chunk-V5TZH4GF.js.map → chunk-R7NHYEJF.js.map} +1 -1
  84. package/dist/{chunk-V7PQZOBR.js → chunk-RYYLMBA2.js} +5 -5
  85. package/dist/{chunk-V7PQZOBR.js.map → chunk-RYYLMBA2.js.map} +1 -1
  86. package/dist/{chunk-WBYDAL6X.js → chunk-S3O3GKB7.js} +4 -4
  87. package/dist/{chunk-WBYDAL6X.js.map → chunk-S3O3GKB7.js.map} +1 -1
  88. package/dist/{chunk-Y34MSWEZ.js → chunk-SBSA3IQA.js} +3 -3
  89. package/dist/{chunk-Y34MSWEZ.js.map → chunk-SBSA3IQA.js.map} +1 -1
  90. package/dist/{chunk-Y63UQZ7P.js → chunk-T42WRQ4O.js} +3 -3
  91. package/dist/{chunk-Y63UQZ7P.js.map → chunk-T42WRQ4O.js.map} +1 -1
  92. package/dist/{chunk-OBVJ7RPW.js → chunk-T7CTHHG7.js} +3 -3
  93. package/dist/{chunk-OBVJ7RPW.js.map → chunk-T7CTHHG7.js.map} +1 -1
  94. package/dist/{chunk-7I5VRVDP.js → chunk-TCHRMVTO.js} +4 -4
  95. package/dist/{chunk-7I5VRVDP.js.map → chunk-TCHRMVTO.js.map} +1 -1
  96. package/dist/{chunk-NRDSGLCQ.js → chunk-VLTQGE2E.js} +65 -22
  97. package/dist/chunk-VLTQGE2E.js.map +1 -0
  98. package/dist/{chunk-Z2K6BGUR.js → chunk-WSBKB4CJ.js} +13 -13
  99. package/dist/{chunk-Z2K6BGUR.js.map → chunk-WSBKB4CJ.js.map} +1 -1
  100. package/dist/{chunk-3MKPZZRE.js → chunk-X77SUM4P.js} +3 -3
  101. package/dist/{chunk-3MKPZZRE.js.map → chunk-X77SUM4P.js.map} +1 -1
  102. package/dist/{chunk-XCNK4UE5.js → chunk-XDKH7XSA.js} +5 -5
  103. package/dist/{chunk-XCNK4UE5.js.map → chunk-XDKH7XSA.js.map} +1 -1
  104. package/dist/{chunk-TH4CTXHX.js → chunk-XUSALIEI.js} +6 -6
  105. package/dist/{chunk-TH4CTXHX.js.map → chunk-XUSALIEI.js.map} +1 -1
  106. package/dist/{chunk-3KHYGOEY.js → chunk-Y3HTGHJC.js} +3 -3
  107. package/dist/{chunk-3KHYGOEY.js.map → chunk-Y3HTGHJC.js.map} +1 -1
  108. package/dist/{chunk-YBQONMH2.js → chunk-YOH2L76X.js} +90 -50
  109. package/dist/chunk-YOH2L76X.js.map +1 -0
  110. package/dist/{chunk-32XKCNCL.js → chunk-ZCAJZ4B2.js} +3 -3
  111. package/dist/chunk-ZCAJZ4B2.js.map +1 -0
  112. package/dist/{chunk-IXWODEED.js → chunk-ZPWTOUTK.js} +43 -7
  113. package/dist/chunk-ZPWTOUTK.js.map +1 -0
  114. package/dist/cli/index.js +210 -163
  115. package/dist/cli/index.js.map +1 -1
  116. package/dist/cli/src/commands/catalog.d.ts.map +1 -1
  117. package/dist/cli/src/commands/diff.d.ts +1 -1
  118. package/dist/cli/src/commands/diff.d.ts.map +1 -1
  119. package/dist/cli/src/commands/library-cmd.d.ts.map +1 -1
  120. package/dist/cli/src/commands/library-publish.d.ts.map +1 -1
  121. package/dist/cli/src/commands/manage.d.ts +6 -0
  122. package/dist/cli/src/commands/manage.d.ts.map +1 -1
  123. package/dist/cli/src/commands/outdated.d.ts.map +1 -1
  124. package/dist/cli/src/commands/project.d.ts +3 -1
  125. package/dist/cli/src/commands/project.d.ts.map +1 -1
  126. package/dist/cli/src/commands/run.d.ts.map +1 -1
  127. package/dist/cli/src/commands/update.d.ts.map +1 -1
  128. package/dist/cli/src/commands/validate.d.ts.map +1 -1
  129. package/dist/cli/src/commands/why.d.ts +1 -0
  130. package/dist/cli/src/commands/why.d.ts.map +1 -1
  131. package/dist/cli/src/helpers.d.ts +12 -0
  132. package/dist/cli/src/helpers.d.ts.map +1 -1
  133. package/dist/cli/src/skill-checks.d.ts +14 -6
  134. package/dist/cli/src/skill-checks.d.ts.map +1 -1
  135. package/dist/connectors/config.js +5 -5
  136. package/dist/connectors/index.js +15 -15
  137. package/dist/{connectors-OXP2JBGI.js → connectors-4QWAKPHB.js} +18 -18
  138. package/dist/{connectors-OXP2JBGI.js.map → connectors-4QWAKPHB.js.map} +1 -1
  139. package/dist/core/index.js +6 -6
  140. package/dist/core/manifest.js +2 -2
  141. package/dist/core/models.js +1 -1
  142. package/dist/core/publish-manifest.js +2 -2
  143. package/dist/core/ref.js +1 -1
  144. package/dist/core/runtime-assets.js +5 -5
  145. package/dist/core/src/lock.d.ts +4 -3
  146. package/dist/core/src/lock.d.ts.map +1 -1
  147. package/dist/core/src/models.d.ts +1 -1
  148. package/dist/core/src/models.d.ts.map +1 -1
  149. package/dist/core/src/publish-manifest.d.ts +11 -1
  150. package/dist/core/src/publish-manifest.d.ts.map +1 -1
  151. package/dist/core/src/workspace-config.d.ts +4 -1
  152. package/dist/core/src/workspace-config.d.ts.map +1 -1
  153. package/dist/core/workspace-config.js +4 -4
  154. package/dist/deploy/index.js +6 -6
  155. package/dist/discovery/index.js +5 -5
  156. package/dist/discovery/src/source-config.d.ts.map +1 -1
  157. package/dist/{ensure-sources-5ISVIA4T.js → ensure-sources-2RONZKCU.js} +16 -16
  158. package/dist/{ensure-sources-5ISVIA4T.js.map → ensure-sources-2RONZKCU.js.map} +1 -1
  159. package/dist/factory-assets/connectors/box.js +15 -15
  160. package/dist/factory-assets/connectors/deploy.js +15 -15
  161. package/dist/factory-assets/connectors/devserver.js +15 -15
  162. package/dist/factory-assets/connectors/flow/adapter.js +15 -15
  163. package/dist/factory-assets/connectors/flow/contract/normalize.d.ts.map +1 -1
  164. package/dist/factory-assets/connectors/flow/contract.js +1 -1
  165. package/dist/factory-assets/connectors/flow/engine.js +8 -8
  166. package/dist/factory-assets/connectors/flow/run-flow.js +17 -17
  167. package/dist/factory-assets/connectors/flow.js +15 -15
  168. package/dist/factory-assets/connectors/git.js +15 -15
  169. package/dist/factory-assets/connectors/gmail.js +15 -15
  170. package/dist/factory-assets/connectors/googledrive.js +15 -15
  171. package/dist/factory-assets/connectors/local.js +15 -15
  172. package/dist/factory-assets/connectors/mattermost.js +15 -15
  173. package/dist/factory-assets/connectors/memory.js +15 -15
  174. package/dist/factory-assets/connectors/minio.js +15 -15
  175. package/dist/factory-assets/connectors/postgres.js +15 -15
  176. package/dist/factory-assets/connectors/s3.js +15 -15
  177. package/dist/factory-assets/connectors/sharepoint.js +15 -15
  178. package/dist/factory-assets/connectors/sqlite.js +15 -15
  179. package/dist/factory-assets/connectors/static-server.js +15 -15
  180. package/dist/factory-assets/connectors/tunnel.js +15 -15
  181. package/dist/factory-assets/connectors/webdav.js +15 -15
  182. package/dist/factory-assets/connectors/xstate-store.js +15 -15
  183. package/dist/factory-assets/connectors/xstate.js +15 -15
  184. package/dist/factory-assets/skills/authoring-skaile-manifests/references/dependency-standard.md +4 -2
  185. package/dist/{flows-HMSE76PO.js → flows-EQF2CH4U.js} +11 -11
  186. package/dist/{flows-HMSE76PO.js.map → flows-EQF2CH4U.js.map} +1 -1
  187. package/dist/{helpers-X6URBGSF.js → helpers-CFK6YP6R.js} +16 -16
  188. package/dist/{helpers-X6URBGSF.js.map → helpers-CFK6YP6R.js.map} +1 -1
  189. package/dist/library/index.js +10 -10
  190. package/dist/library/install.js +3 -3
  191. package/dist/library/src/index.d.ts +1 -1
  192. package/dist/library/src/index.d.ts.map +1 -1
  193. package/dist/library/src/local/library-dir.d.ts +26 -0
  194. package/dist/library/src/local/library-dir.d.ts.map +1 -1
  195. package/dist/library/src/local/library-manager.d.ts.map +1 -1
  196. package/dist/library/src/sync/git-driver.d.ts +2 -0
  197. package/dist/library/src/sync/git-driver.d.ts.map +1 -1
  198. package/dist/{library-publish-OS3JDW4S.js → library-publish-53UTB3MB.js} +51 -24
  199. package/dist/library-publish-53UTB3MB.js.map +1 -0
  200. package/dist/open-library-BOSPJVID.js +40 -0
  201. package/dist/{open-library-4QSUORI6.js.map → open-library-BOSPJVID.js.map} +1 -1
  202. package/dist/open-registry-4FI7HKET.js +32 -0
  203. package/dist/{open-registry-VCKS3MP5.js.map → open-registry-4FI7HKET.js.map} +1 -1
  204. package/dist/{paths-BVO56A25.js → paths-SUS4S4YT.js} +9 -9
  205. package/dist/{paths-BVO56A25.js.map → paths-SUS4S4YT.js.map} +1 -1
  206. package/dist/{plugin-store-X7GPWGBG.js → plugin-store-AGQDMING.js} +8 -8
  207. package/dist/{plugin-store-X7GPWGBG.js.map → plugin-store-AGQDMING.js.map} +1 -1
  208. package/dist/{project-PAXP46RD.js → project-I55A4O2T.js} +20 -20
  209. package/dist/{project-PAXP46RD.js.map → project-I55A4O2T.js.map} +1 -1
  210. package/dist/resolver/index.js +7 -7
  211. package/dist/runner/index.js +28 -28
  212. package/dist/runner/src/serve.d.ts.map +1 -1
  213. package/dist/runner/src/usage-limit-turn-hold.d.ts +51 -0
  214. package/dist/runner/src/usage-limit-turn-hold.d.ts.map +1 -0
  215. package/dist/sdk/asset-manager.js +13 -13
  216. package/dist/sdk/bridge.js +11 -11
  217. package/dist/sdk/core.js +6 -6
  218. package/dist/sdk/flow.js +8 -8
  219. package/dist/sdk/index.js +28 -28
  220. package/dist/sdk/resolver.js +7 -7
  221. package/dist/sdk/runner.js +28 -28
  222. package/dist/{setup-BV55VHWC.js → setup-7DQJKHUI.js} +21 -21
  223. package/dist/{setup-BV55VHWC.js.map → setup-7DQJKHUI.js.map} +1 -1
  224. package/dist/{skills-EDFUCJPX.js → skills-NUEN5NDX.js} +12 -12
  225. package/dist/{skills-EDFUCJPX.js.map → skills-NUEN5NDX.js.map} +1 -1
  226. package/dist/{source-E4VAT5RZ.js → source-G2LV5LVD.js} +21 -21
  227. package/dist/{source-E4VAT5RZ.js.map → source-G2LV5LVD.js.map} +1 -1
  228. package/dist/{source-manifest-publish-CLEE6TNH.js → source-manifest-publish-6RM7SWLZ.js} +23 -23
  229. package/dist/{source-manifest-publish-CLEE6TNH.js.map → source-manifest-publish-6RM7SWLZ.js.map} +1 -1
  230. package/dist/tui/index.js +59 -39
  231. package/dist/tui/index.js.map +1 -1
  232. package/dist/tui/src/repl.d.ts.map +1 -1
  233. package/dist/types/manifests.js +1 -1
  234. package/dist/types/src/manifests/preset.d.ts +1 -1
  235. package/dist/workspace-plugin/adapters/mcp.js +22 -22
  236. package/dist/workspace-plugin/adapters/omp.js +14 -14
  237. package/dist/workspace-plugin/index.js +1 -1
  238. package/package.json +1 -1
  239. package/dist/chunk-2FMEGSBN.js.map +0 -1
  240. package/dist/chunk-2JMLDZLP.js.map +0 -1
  241. package/dist/chunk-32XKCNCL.js.map +0 -1
  242. package/dist/chunk-3BEY4WK3.js.map +0 -1
  243. package/dist/chunk-4OV5DSBB.js.map +0 -1
  244. package/dist/chunk-4P3KTUZH.js.map +0 -1
  245. package/dist/chunk-GEWAIQZ5.js.map +0 -1
  246. package/dist/chunk-IXWODEED.js.map +0 -1
  247. package/dist/chunk-JZCSNEHK.js.map +0 -1
  248. package/dist/chunk-MGGFBZWA.js.map +0 -1
  249. package/dist/chunk-NRDSGLCQ.js.map +0 -1
  250. package/dist/chunk-PE36IF2D.js.map +0 -1
  251. package/dist/chunk-TRSQP3JD.js.map +0 -1
  252. package/dist/chunk-YBQONMH2.js.map +0 -1
  253. package/dist/library-publish-OS3JDW4S.js.map +0 -1
  254. package/dist/open-library-4QSUORI6.js +0 -40
  255. package/dist/open-registry-VCKS3MP5.js +0 -32
@@ -1,18 +1,18 @@
1
- import { unregisteredLibraryNames, scanUnlistedAssets, getStoreManifestsDir, missingLibraryDirMessage } from './chunk-3BEY4WK3.js';
2
- import { readManifestSourceConfig, isManifestMode, discoverAssetsInTree } from './chunk-GEWAIQZ5.js';
3
- import { installTargetOf, canonicalEntryRef, deployAll, removeAsset, diffDeployedAgent, createScaffold, installAgent } from './chunk-PE36IF2D.js';
1
+ import { unregisteredLibraryNames, renamedLibraryName, scanUnlistedAssets, getStoreManifestsDir, missingLibraryDirMessage } from './chunk-2F5AWQX5.js';
2
+ import { readManifestSourceConfig, isManifestMode, discoverAssetsInTree } from './chunk-J4RBUFGM.js';
3
+ import { installTargetOf, canonicalEntryRef, deployAll, removeAsset, diffDeployedAgent, deployedAssetDrift, createScaffold, installAgent } from './chunk-FH7W6TJ4.js';
4
4
  import { appendHistory, getRecentHistory, clearHistory } from './chunk-KTBKW2FI.js';
5
5
  import { commitChanges } from './chunk-UQ6LFBPZ.js';
6
- import { driverTargetSupportsAgents, CODEX_IDENTITY_DIR } from './chunk-6HHE63CO.js';
7
- import { resolveConfiguredDriverTarget, GLOBAL_INSTALL_DIR_NAME, resolveLibraryDir, buildLibraryLockEntries, buildLockFile, writeLock, readLock, verifyLock, mergeLockFile, extractForPatch, generatePatch, savePatch, applyPatch } from './chunk-2FMEGSBN.js';
8
- import { resolveRuntimeAssets, factoryAssetRoots } from './chunk-GFCXNFTW.js';
6
+ import { driverTargetSupportsAgents, CODEX_IDENTITY_DIR } from './chunk-HZXUXHIV.js';
7
+ import { resolveConfiguredDriverTarget, GLOBAL_INSTALL_DIR_NAME, resolveLibraryDir, buildLibraryLockEntries, buildLockFile, writeLock, readLock, verifyLock, mergeLockFile, extractForPatch, generatePatch, savePatch, applyPatch, computeHash } from './chunk-PBBPZYVG.js';
8
+ import { resolveRuntimeAssets, factoryAssetRoots } from './chunk-EDYHEMJA.js';
9
9
  import { deployedBase, deployedDir, isDeployed, deployedPaths } from './chunk-PMECEZK3.js';
10
- import { resolveSkWorkspaceConfig, effectiveAgentInstances, loadMcpServerDeclarations, resolveGlobalHarnesses, resolveGlobalSkWorkspaceConfig, getGlobalCacheDir, sourceCacheKey, getRepoCommit, matchPin, buildProvenanceIndex, coerceVersion, sourceShortName, resolveAll, ensureRepo, scanRepo, SKAILE_YAML_DEFAULT, checkRepoStatus, resolveAsset, readLinks, MAX_PRESET_DEPTH, PresetDepthError, DEFAULT_AGENT_INSTANCE_ID, resolveAgentDefinitionDir, storeManifestSlug } from './chunk-JZCSNEHK.js';
10
+ import { resolveSkWorkspaceConfig, effectiveAgentInstances, loadMcpServerDeclarations, resolveGlobalHarnesses, resolveGlobalSkWorkspaceConfig, getGlobalCacheDir, sourceCacheKey, getRepoCommit, matchPin, buildProvenanceIndex, coerceVersion, sourceShortName, resolveAll, ensureRepo, scanRepo, SKAILE_YAML_DEFAULT, checkRepoStatus, resolveAsset, readLinks, MAX_PRESET_DEPTH, PresetDepthError, DEFAULT_AGENT_INSTANCE_ID, resolveAgentDefinitionDir, storeManifestSlug } from './chunk-ALEYHUC5.js';
11
11
  import { globalSkaileDir, globalCacheRoot, migrateLegacyDir } from './chunk-L5VSIPQD.js';
12
12
  import { DRIVER_TARGETS } from './chunk-CPSIPIX7.js';
13
- import { loadSkPublishManifest } from './chunk-IXWODEED.js';
14
- import { scanDirectory, parseRequires, dedupeRequirements } from './chunk-Y34MSWEZ.js';
15
- import { parseAssetRef, parseAssetRefLoose, assetRefToStr, slugifyAssetName, depToStr } from './chunk-4OV5DSBB.js';
13
+ import { loadSkPublishManifest } from './chunk-ZPWTOUTK.js';
14
+ import { scanDirectory, parseRequires, dedupeRequirements } from './chunk-SBSA3IQA.js';
15
+ import { parseAssetRef, parseAssetRefLoose, assetRefToStr, slugifyAssetName, depToStr } from './chunk-BNMZVPYA.js';
16
16
  import { spawnSync } from 'child_process';
17
17
  import { existsSync, rmSync, readdirSync, lstatSync, unlinkSync, mkdirSync, writeFileSync, readFileSync } from 'fs';
18
18
  import path, { resolve, dirname, sep, join, relative, posix } from 'path';
@@ -40,13 +40,10 @@ function writeLedger(projectDir, ledger) {
40
40
  function bindInstance(projectDir, id, instance) {
41
41
  const errors = [];
42
42
  let srcDir;
43
- const addHint = instance.ref.startsWith("agent:") ? ` \u2014 add the agent first: run skaile add ${instance.ref}` : "";
44
43
  try {
45
44
  srcDir = resolveAgentDefinitionDir(projectDir, instance.ref);
46
45
  } catch (err) {
47
- errors.push(
48
- `agent instance "${id}": ${err instanceof Error ? err.message : String(err)}${addHint}`
49
- );
46
+ errors.push(`agent instance "${id}": ${err instanceof Error ? err.message : String(err)}`);
50
47
  }
51
48
  if (srcDir !== void 0 && !existsSync(join(srcDir, "agent.yaml"))) {
52
49
  errors.push(
@@ -674,10 +671,39 @@ function relockedRefs(prev, next) {
674
671
  }
675
672
  return out;
676
673
  }
674
+ function libraryMoves(prev, next) {
675
+ if (!prev) return [];
676
+ const out = [];
677
+ for (const [key, entry] of Object.entries(next)) {
678
+ const to = entry.library;
679
+ if (!to || to.installed) continue;
680
+ const id = parseCanonicalLockKey(key);
681
+ for (const [prevKey, before] of Object.entries(prev.assets)) {
682
+ const o = parseCanonicalLockKey(prevKey);
683
+ if (o.kind !== id.kind || o.name !== id.name || o.publisher !== id.publisher) continue;
684
+ const from = before.library;
685
+ if (!from || from.installed || from.name === to.name) continue;
686
+ out.push({ ref: `${id.kind}:@${id.publisher}/${id.name}`, from: from.name, to: to.name });
687
+ break;
688
+ }
689
+ }
690
+ return out;
691
+ }
677
692
  function unregisteredLibraryFix(origin, ref) {
678
693
  const register = origin.url ? `\`skaile library init ${origin.name} --git ${origin.url}\` (no registered library has the remote ${origin.url} either)` : `\`skaile library init ${origin.name} --path <dir>\``;
679
694
  return `register library "${origin.name}" again with ${register}, or drop the dependency with \`skaile remove ${ref}\``;
680
695
  }
696
+ function declaredNoHolderReason(ref) {
697
+ return `is declared but no library or source holds it \u2014 register the library that holds it with \`skaile library init <name> --path <dir>\`, or drop it with \`skaile remove ${ref.split("#")[0]}\``;
698
+ }
699
+ var REGISTER_HOLDER = "register the library that holds it with `skaile library init <name> --path <dir>`";
700
+ function requirementNoHolderFix(asset) {
701
+ return `${REGISTER_HOLDER}, or drop ${asset} with \`skaile remove ${asset}\``;
702
+ }
703
+ function sameAsset(ref, want) {
704
+ const p = parseRefTolerant(ref);
705
+ return p !== null && p.kind === want.kind && p.name === want.name && (!want.publisher || !p.publisher || p.publisher === want.publisher);
706
+ }
681
707
  function lockedLibraryProblem(lookup, origin, ref) {
682
708
  return lookup.state === "dir-missing" ? missingLibraryDirMessage({ name: origin.name, path: lookup.path }) : `library "${origin.name}" is not registered \u2014 renamed or removed? ${unregisteredLibraryFix(origin, ref)}`;
683
709
  }
@@ -841,14 +867,15 @@ var AssetManager = class {
841
867
  }
842
868
  /** Deploy options for one harness. In global mode, `driverTarget` is the
843
869
  * fan-out target (not the constructor's `driverTarget`, which is project-only). */
844
- deployOptsFor(target, link, onSkippedSymlink) {
870
+ deployOptsFor(target, link, onSkippedSymlink, onEnvFile) {
845
871
  return {
846
872
  registry: this.registry,
847
873
  driverTarget: target,
848
874
  global: this.global,
849
875
  cwd: this.projectDir,
850
876
  link: link === true,
851
- ...onSkippedSymlink ? { onSkippedSymlink: (entry, p) => onSkippedSymlink(canonicalEntryRef(entry), p) } : {}
877
+ ...onSkippedSymlink ? { onSkippedSymlink: (entry, p) => onSkippedSymlink(canonicalEntryRef(entry), p) } : {},
878
+ ...onEnvFile ? { onEnvFile: (entry, p) => onEnvFile(canonicalEntryRef(entry), p) } : {}
852
879
  };
853
880
  }
854
881
  /**
@@ -878,13 +905,18 @@ var AssetManager = class {
878
905
  * skills resolve. Project scope only. An instance whose `ref` resolves to no agent is
879
906
  * reported in `agentInstanceErrors`; any other render error is warned and swallowed.
880
907
  */
881
- renderAgentInstances() {
908
+ async renderAgentInstances() {
882
909
  if (this.global) return {};
883
910
  try {
884
911
  const result = installAgentInstances({
885
912
  projectDir: this.projectDir,
886
913
  driverTarget: this.driverTarget
887
914
  });
915
+ for (const u of unboundAgentInstances(this.projectDir, this.driverTarget)) {
916
+ if (!u.ref.startsWith("agent:")) continue;
917
+ const at = result.errors.findIndex((e) => e.startsWith(`agent instance "${u.id}":`));
918
+ if (at >= 0) result.errors[at] += ` \u2014 ${(await this.unboundAgentAdvice(u.ref)).advice}`;
919
+ }
888
920
  for (const w of [...result.warnings, ...result.errors]) console.warn(`skaile: ${w}`);
889
921
  return {
890
922
  agentInstances: result.instances,
@@ -1024,6 +1056,9 @@ var AssetManager = class {
1024
1056
  * builds an error hint must not warn).
1025
1057
  * @param opts.library - Resolve only from this library (the one a lock entry names), not
1026
1058
  * from every registered one. Never warns: no choice is made between libraries.
1059
+ * @param opts.lockedLibraries - `kind:publisher/name` → the library its lock entry names
1060
+ * ({@link AssetManager.lockedLibraryNames}). A ref listed here resolves from that library
1061
+ * when it holds a match, whatever the default library is.
1027
1062
  * @returns the matched deploy entries, the set of `missing` refs covered, and
1028
1063
  * each entry's originating library name.
1029
1064
  */
@@ -1044,10 +1079,40 @@ var AssetManager = class {
1044
1079
  const hash = ref.indexOf("#");
1045
1080
  const pin = parsed.pin ?? (hash >= 0 ? ref.slice(hash + 1) : void 0);
1046
1081
  const key = parsed.publisher ? `${parsed.kind}:@${parsed.publisher}/${parsed.name}` : void 0;
1047
- const pool = (key ? byKey.get(key) ?? [] : allCandidates.filter(
1082
+ const scanned = (key ? byKey.get(key) ?? [] : allCandidates.filter(
1048
1083
  (c) => c.entry.kind === parsed.kind && c.entry.name === parsed.name
1049
1084
  )).filter((c) => !opts.library || c.library === opts.library);
1050
- const candidates = pool.filter((c) => !pin || matchPin(pin, c.entry.version ?? ""));
1085
+ const pool = [];
1086
+ for (const c of scanned) {
1087
+ if (c.entry.version) {
1088
+ pool.push(c);
1089
+ continue;
1090
+ }
1091
+ if (snap === void 0) snap = await this.loadLibraryIndex();
1092
+ const def = newestLibraryDef(snap, c.library, {
1093
+ kind: c.entry.kind,
1094
+ publisher: c.entry.publisher ?? "",
1095
+ name: c.entry.name
1096
+ });
1097
+ pool.push(def?.version ? { ...c, entry: { ...c.entry, version: def.version } } : c);
1098
+ }
1099
+ let candidates = pool.filter((c) => !pin || matchPin(pin, c.entry.version ?? ""));
1100
+ let lockedLibrary;
1101
+ if (parsed.publisher) {
1102
+ lockedLibrary = opts.lockedLibraries?.get(
1103
+ `${parsed.kind}:${parsed.publisher.replace(/^@/, "")}/${parsed.name}`
1104
+ );
1105
+ } else {
1106
+ const same = [...opts.lockedLibraries ?? []].filter(([k]) => {
1107
+ const slash = k.indexOf("/");
1108
+ return k.startsWith(`${parsed.kind}:`) && k.slice(slash + 1) === parsed.name;
1109
+ });
1110
+ if (same.length === 1) lockedLibrary = same[0][1];
1111
+ }
1112
+ if (lockedLibrary) {
1113
+ const inLocked = candidates.filter((c) => c.library === lockedLibrary);
1114
+ if (inLocked.length > 0) candidates = inLocked;
1115
+ }
1051
1116
  if (candidates.length === 0) continue;
1052
1117
  candidates.sort(libraryPreference(isDefaultLib));
1053
1118
  const hit = candidates[0];
@@ -1058,16 +1123,7 @@ var AssetManager = class {
1058
1123
  hit
1059
1124
  );
1060
1125
  }
1061
- let entry = hit.entry;
1062
- if (!entry.version) {
1063
- if (snap === void 0) snap = await this.loadLibraryIndex();
1064
- const def = newestLibraryDef(snap, hit.library, {
1065
- kind: entry.kind,
1066
- publisher: entry.publisher ?? "",
1067
- name: entry.name
1068
- });
1069
- if (def?.version) entry = { ...entry, version: def.version };
1070
- }
1126
+ const entry = hit.entry;
1071
1127
  withLibraryFiles(entry, libraryDir.get(hit.library), fileSets, this.registry);
1072
1128
  entries.push(entry);
1073
1129
  libraryOf.set(entry, hit.library);
@@ -1697,6 +1753,11 @@ var AssetManager = class {
1697
1753
  } catch {
1698
1754
  }
1699
1755
  }
1756
+ if (byName.state === "unregistered") {
1757
+ const renamed = renamedLibraryName(name);
1758
+ const now = renamed ? snap?.libraries.find((l) => l.name === renamed) : void 0;
1759
+ if (now && existsSync(now.path)) return { state: "ok", path: now.path, name: now.name };
1760
+ }
1700
1761
  if (byName.state === "ok" || !origin.url) return byName;
1701
1762
  const wanted = normalizeRepoUrl(origin.url);
1702
1763
  const byUrl = snap?.libraries.find((l) => {
@@ -1875,7 +1936,8 @@ var AssetManager = class {
1875
1936
  })
1876
1937
  );
1877
1938
  const hit = await this.resolveLibraryEntries([...libraryTried], {
1878
- quiet: !opts.warnCollisions
1939
+ quiet: !opts.warnCollisions,
1940
+ lockedLibraries: opts.lockedLibraries
1879
1941
  });
1880
1942
  const next = absorb(hit);
1881
1943
  const rest = fresh.filter((ref) => !hit.resolved.has(ref));
@@ -1892,7 +1954,7 @@ var AssetManager = class {
1892
1954
  presets.push(...r.presets);
1893
1955
  const hit2 = await this.resolveLibraryEntries(
1894
1956
  r.missing.filter((m) => !libraryTried.has(m)),
1895
- { quiet: !opts.warnCollisions }
1957
+ { quiet: !opts.warnCollisions, lockedLibraries: opts.lockedLibraries }
1896
1958
  );
1897
1959
  next.push(...absorb(hit2));
1898
1960
  for (const m of r.missing) if (!hit2.resolved.has(m)) missing.add(m);
@@ -2065,6 +2127,9 @@ var AssetManager = class {
2065
2127
  * @param opts.link - When `true`, symlink local-path assets instead of copying them
2066
2128
  * (the author dev-loop). Machine-local / not for committing; a no-op for
2067
2129
  * store/factory sources. Defaults to copy.
2130
+ * @param opts.moveLibraries - When `true` (`skaile update`), a locked library asset is
2131
+ * re-resolved from every library and may move to another one; {@link InstallResult.moved}
2132
+ * lists the moves. Without it a locked asset stays on the library its lock entry names.
2068
2133
  * @returns {@link InstallResult} summarising what was deployed, what was missing, and any collisions.
2069
2134
  */
2070
2135
  async install(opts) {
@@ -2094,7 +2159,15 @@ var AssetManager = class {
2094
2159
  });
2095
2160
  const { resolved, missing, overridesApplied, lib, presets } = await this.resolveLibraryFirst(
2096
2161
  dependencies,
2097
- { provenanceIndex, overrides, stores, declaredRefs: dependencies }
2162
+ {
2163
+ provenanceIndex,
2164
+ overrides,
2165
+ stores,
2166
+ declaredRefs: dependencies,
2167
+ // `install` restores what the lock recorded: a changed default library or a second
2168
+ // library holding the same ref does not move a locked asset. `update` re-resolves.
2169
+ ...opts?.moveLibraries ? {} : { lockedLibraries: await this.lockedLibraryNames() }
2170
+ }
2098
2171
  );
2099
2172
  this.assertNoFolderCollision([...resolved, ...lib.entries.map((e) => this.entryIdentity(e))]);
2100
2173
  const stillMissing = missing.filter((m) => !lib.resolved.has(m));
@@ -2122,6 +2195,7 @@ var AssetManager = class {
2122
2195
  /* @__PURE__ */ new Set([...Object.keys(libraryLock), ...Object.keys(kept.assets)])
2123
2196
  );
2124
2197
  const entries = [...await this.buildCatalogEntries(resolved, repositories), ...lib.entries];
2198
+ const copyDrift = await this.lockedCopyDrift();
2125
2199
  const deployed = [
2126
2200
  ...new Set(
2127
2201
  this.targetHarnesses().flatMap(
@@ -2129,25 +2203,31 @@ var AssetManager = class {
2129
2203
  )
2130
2204
  )
2131
2205
  ];
2206
+ const restored = this.restoredCopies(copyDrift, deployed);
2132
2207
  await this.renderDriverMcpConfig();
2133
- const agentRender = this.renderAgentInstances();
2208
+ const agentRender = await this.renderAgentInstances();
2134
2209
  const lockWanted = resolved.length > 0 || lib.entries.length > 0 || existsSync(this.lockPath);
2135
2210
  let lockWritten = false;
2136
2211
  let relocked = [];
2212
+ let moved = [];
2137
2213
  if (lockWanted) {
2138
2214
  const lockData = withKeptLockEntries(freshLock, kept);
2139
2215
  relocked = relockedRefs(prevLock, lockData);
2216
+ moved = libraryMoves(prevLock, libraryLock);
2140
2217
  lockWritten = writeLock(this.lockPath, lockData);
2141
2218
  }
2142
2219
  this.recordInstallHistory(deployed, removed);
2143
2220
  const { npmInstalled, npmFailed } = await this.installRuntimeAssetDeps();
2221
+ await this.adviseMissing(stillMissing, missingHints);
2144
2222
  return {
2145
2223
  deployed,
2146
2224
  removed,
2147
2225
  missing: stillMissing,
2148
2226
  ...Object.keys(missingHints).length > 0 ? { missingHints } : {},
2149
2227
  ...relocked.length > 0 ? { relocked } : {},
2228
+ ...moved.length > 0 ? { moved } : {},
2150
2229
  ...replaced.length > 0 ? { replaced } : {},
2230
+ ...restored.length > 0 ? { restored } : {},
2151
2231
  lockWritten,
2152
2232
  npmInstalled,
2153
2233
  npmFailed,
@@ -2404,9 +2484,39 @@ var AssetManager = class {
2404
2484
  }
2405
2485
  return { npmInstalled, npmFailed };
2406
2486
  }
2487
+ /**
2488
+ * Give every ref `install` could not resolve, and that has no hint yet, the fix the shared
2489
+ * {@link AssetManager.projectState} names for it (a declared ref no library or source holds,
2490
+ * a requirement nothing holds). Runs after the deploy, so a requirer is known by then.
2491
+ * Mutates `hints`: ` <reason>` follows the ref in the `Missing:` line.
2492
+ */
2493
+ async adviseMissing(refs, hints) {
2494
+ const open = refs.filter((r) => !hints[r]);
2495
+ if (open.length === 0) return;
2496
+ const { gaps } = await this.projectState();
2497
+ for (const ref of open) {
2498
+ const want = parseRefTolerant(ref.split(" ")[0] ?? ref);
2499
+ if (!want) continue;
2500
+ const gap = gaps.find(
2501
+ (g) => (g.type === "declared" || g.type === "requires") && g.manualFix && sameAsset(g.ref, want)
2502
+ );
2503
+ if (gap) hints[ref] = ` ${gap.reason}`;
2504
+ }
2505
+ }
2407
2506
  async installLocked(repositories, patches, dependencies) {
2408
2507
  const lock = this.tryReadLock();
2409
2508
  if (!lock) {
2509
+ const gaps2 = (await this.projectState()).gaps.filter((g) => g.type !== "agent");
2510
+ if (gaps2.some((g) => g.manualFix)) {
2511
+ return {
2512
+ deployed: [],
2513
+ removed: [],
2514
+ missing: gaps2.map((g) => g.message),
2515
+ lockWritten: false,
2516
+ npmInstalled: [],
2517
+ npmFailed: []
2518
+ };
2519
+ }
2410
2520
  throw new Error("No lock file found. Run `skaile install` first.");
2411
2521
  }
2412
2522
  this.assertNoFolderCollision(Object.keys(lock.assets).map(parseCanonicalLockKey));
@@ -2468,6 +2578,7 @@ var AssetManager = class {
2468
2578
  if (!repositories[slug]) repositories[slug] = { url: entry.source.url, path: cloneDir };
2469
2579
  }
2470
2580
  const library = await this.restoreLibraryLockEntries(lock);
2581
+ const copyDrift = await this.lockedCopyDrift();
2471
2582
  const deployed = [
2472
2583
  ...new Set(
2473
2584
  this.targetHarnesses().flatMap(
@@ -2480,8 +2591,9 @@ var AssetManager = class {
2480
2591
  )
2481
2592
  )
2482
2593
  ];
2594
+ const restored = this.restoredCopies(copyDrift, deployed);
2483
2595
  await this.renderDriverMcpConfig();
2484
- const agentRender = this.renderAgentInstances();
2596
+ const agentRender = await this.renderAgentInstances();
2485
2597
  const alreadyMissing = new Set(
2486
2598
  library.missing.map((m) => {
2487
2599
  const p = parseRefTolerant(m.split(" ")[0] ?? m);
@@ -2498,6 +2610,7 @@ var AssetManager = class {
2498
2610
  removed: [],
2499
2611
  missing: [...library.missing, ...gaps],
2500
2612
  lockWritten: false,
2613
+ ...restored.length > 0 ? { restored } : {},
2501
2614
  ...agentRender
2502
2615
  };
2503
2616
  }
@@ -2572,6 +2685,8 @@ var AssetManager = class {
2572
2685
  * store/factory sources. Defaults to copy.
2573
2686
  * @param opts.onLibraryOrigin - Called once per deployed library-origin asset with its
2574
2687
  * canonical ref and the name of the library it was resolved from.
2688
+ * @param opts.onLibraryMoved - Called once per asset whose lock entry named another library
2689
+ * than the one this add resolved it from.
2575
2690
  * @param opts.onPresets - Called once with the presets expanded into this add (the
2576
2691
  * added preset and any it nests); a library-held preset names its library.
2577
2692
  * @returns Array of asset refs that were deployed in this call.
@@ -2635,8 +2750,8 @@ var AssetManager = class {
2635
2750
  ]
2636
2751
  );
2637
2752
  if (missing.length > 0) {
2638
- console.warn(
2639
- `skaile: ${ref} was added without unresolved dependencies: ${missing.join(", ")}`
2753
+ throw new Error(
2754
+ `${ref.split("#")[0]} requires ${missing.join(", ")} (not found \u2014 ${REGISTER_HOLDER}, or remove the requirement from the asset's manifest) \u2014 nothing was added`
2640
2755
  );
2641
2756
  }
2642
2757
  const entries = [...await this.buildCatalogEntries(resolved, repositories), ...lib.entries];
@@ -2647,7 +2762,7 @@ var AssetManager = class {
2647
2762
  entries,
2648
2763
  repositories,
2649
2764
  patches,
2650
- this.deployOptsFor(t, opts?.link, opts?.onSkippedSymlink)
2765
+ this.deployOptsFor(t, opts?.link, opts?.onSkippedSymlink, opts?.onEnvFile)
2651
2766
  )
2652
2767
  )
2653
2768
  )
@@ -2662,13 +2777,18 @@ var AssetManager = class {
2662
2777
  if (presets.length > 0) opts?.onPresets?.(presets);
2663
2778
  this.addDependencyToConfig(ref);
2664
2779
  await this.renderDriverMcpConfig();
2665
- this.renderAgentInstances();
2780
+ await this.renderAgentInstances();
2666
2781
  if (resolved.length > 0 || lib.entries.length > 0) {
2782
+ const libraryLock = await this.libraryLockEntries(lib);
2667
2783
  const fresh = {
2668
- ...buildLockFile(resolved, overridesApplied, await this.libraryLockEntries(lib)),
2784
+ ...buildLockFile(resolved, overridesApplied, libraryLock),
2669
2785
  ...presetsLockSlice(presets)
2670
2786
  };
2671
- writeLock(this.lockPath, mergeLockFile(this.tryReadLock(), fresh));
2787
+ const prevLock = this.tryReadLock();
2788
+ if (opts?.onLibraryMoved) {
2789
+ for (const m of libraryMoves(prevLock, libraryLock)) opts.onLibraryMoved(m);
2790
+ }
2791
+ writeLock(this.lockPath, mergeLockFile(prevLock, fresh));
2672
2792
  }
2673
2793
  for (const d of deployed) {
2674
2794
  appendHistory(this.projectDir, {
@@ -2726,16 +2846,16 @@ var AssetManager = class {
2726
2846
  const target = memberIdentity(ref);
2727
2847
  if (!target || target.kind === "preset") return [];
2728
2848
  try {
2729
- const sameAsset = (id, want) => !!id && id.kind === want.kind && id.name === want.name && (!id.publisher || !want.publisher || id.publisher === want.publisher);
2849
+ const sameAsset2 = (id, want) => !!id && id.kind === want.kind && id.name === want.name && (!id.publisher || !want.publisher || id.publisher === want.publisher);
2730
2850
  const declared = this.loadConfig().dependencies.map(memberIdentity);
2731
2851
  const out = [];
2732
2852
  const seen = /* @__PURE__ */ new Set();
2733
2853
  for (const p of await this.search(void 0, "preset")) {
2734
2854
  const members = [...p.dependencies, ...p.requires.map(depToStr)];
2735
- if (!members.some((m) => sameAsset(memberIdentity(m), target))) continue;
2855
+ if (!members.some((m) => sameAsset2(memberIdentity(m), target))) continue;
2736
2856
  const publisher = p.publisher?.replace(/^@/, "");
2737
2857
  const presetId = { kind: "preset", name: p.name, publisher };
2738
- if (declared.some((d) => sameAsset(d, presetId))) continue;
2858
+ if (declared.some((d) => sameAsset2(d, presetId))) continue;
2739
2859
  const presetRef = publisher ? assetRefToStr({ kind: "preset", name: p.name, publisher }) : `preset:${p.name}`;
2740
2860
  if (seen.has(presetRef)) continue;
2741
2861
  seen.add(presetRef);
@@ -3057,11 +3177,35 @@ var AssetManager = class {
3057
3177
  const requiredBy = [...requires].filter(([node, deps]) => node !== targetKey && deps.includes(targetKey)).map(([node]) => display(node));
3058
3178
  return requiredBy.length > 0 ? { ref: display(targetKey), requiredBy } : null;
3059
3179
  }
3180
+ /**
3181
+ * Publishers under which the lock or `skaile.yaml` track `kind:name`. A deployed dir carries
3182
+ * no publisher, so this is what says whose copy it is. `undefined` stands for a
3183
+ * publisher-less declaration.
3184
+ */
3185
+ trackedPublishers(kind, name) {
3186
+ const found = /* @__PURE__ */ new Set();
3187
+ const note = (id) => {
3188
+ if (id?.kind === kind && id.name === name) found.add(id.publisher?.replace(/^@/, ""));
3189
+ };
3190
+ for (const key of Object.keys(this.tryReadLock()?.assets ?? {})) {
3191
+ note(parseCanonicalLockKey(key));
3192
+ }
3193
+ try {
3194
+ for (const dep of this.loadConfig().dependencies) note(memberIdentity(dep));
3195
+ } catch {
3196
+ }
3197
+ return found;
3198
+ }
3060
3199
  /** Undeploy `parsed` from every target harness and drop its declaration and lock entry. */
3061
3200
  removeResolved(parsed) {
3201
+ const wantPub = parsed.publisher?.replace(/^@/, "");
3202
+ const tracked = this.trackedPublishers(parsed.kind, parsed.name);
3203
+ const someoneElses = wantPub !== void 0 && tracked.size > 0 && !tracked.has(wantPub) && !tracked.has(void 0);
3062
3204
  let undeployed = false;
3063
- for (const t of this.targetHarnesses()) {
3064
- if (removeAsset(parsed.kind, parsed.name, this.deployOptsFor(t))) undeployed = true;
3205
+ if (!someoneElses) {
3206
+ for (const t of this.targetHarnesses()) {
3207
+ if (removeAsset(parsed.kind, parsed.name, this.deployOptsFor(t))) undeployed = true;
3208
+ }
3065
3209
  }
3066
3210
  const undeclared = this.removeDependencyFromConfig(parsed);
3067
3211
  const unbound = this.removeAgentBindings(parsed);
@@ -3647,7 +3791,7 @@ var AssetManager = class {
3647
3791
  return locked.kind === asked.kind && locked.name === asked.name;
3648
3792
  };
3649
3793
  const key = lock.assets[ref] ? ref : Object.keys(lock.assets).find(matchesIdentity);
3650
- if (!key) return [];
3794
+ if (!key) return asked?.kind === "preset" ? this.whyPreset(lock, asked) : [];
3651
3795
  const { requires, roots } = await this.lockedGraph(lock);
3652
3796
  if (roots.includes(key)) return [key, "direct (skaile.yaml)"];
3653
3797
  const requirers = /* @__PURE__ */ new Map();
@@ -3672,6 +3816,52 @@ var AssetManager = class {
3672
3816
  }
3673
3817
  return [key, "not required by a declared dependency"];
3674
3818
  }
3819
+ /**
3820
+ * The {@link AssetManager.why} chain of a preset. A preset is never a lock asset: its record
3821
+ * is the lock's `presets` slice. Declared in `skaile.yaml` it is `direct`; one only a declared
3822
+ * preset nests is traced through the presets that list it.
3823
+ *
3824
+ * @returns `[]` when the lock does not record the preset.
3825
+ */
3826
+ async whyPreset(lock, asked) {
3827
+ const wanted = memberIdentity(assetRefToStr(asked));
3828
+ const same = (ref) => {
3829
+ const id = memberIdentity(ref);
3830
+ return id !== null && wanted !== null && id.kind === "preset" && id.name === wanted.name && (!id.publisher || !wanted.publisher || id.publisher === wanted.publisher);
3831
+ };
3832
+ const recorded = (lock.presets ?? []).find(same);
3833
+ if (!recorded) return [];
3834
+ let declared = [];
3835
+ try {
3836
+ declared = this.loadConfig().dependencies;
3837
+ } catch {
3838
+ }
3839
+ const roots = declared.filter((d) => memberIdentity(d)?.kind === "preset");
3840
+ if (roots.some(same)) return [recorded, "direct (skaile.yaml)"];
3841
+ const parent = /* @__PURE__ */ new Map();
3842
+ const seen = new Set(roots);
3843
+ const queue = [...roots];
3844
+ for (let node = queue.shift(); node !== void 0; node = queue.shift()) {
3845
+ let items = [];
3846
+ try {
3847
+ const entry = await this.info(node);
3848
+ items = entry ? libraryEntryDepRefs(entry) : [];
3849
+ } catch {
3850
+ }
3851
+ for (const item of items) {
3852
+ if (memberIdentity(item)?.kind !== "preset" || seen.has(item)) continue;
3853
+ seen.add(item);
3854
+ parent.set(item, node);
3855
+ if (same(item)) {
3856
+ const chain = [];
3857
+ for (let c = item; c !== void 0; c = parent.get(c)) chain.push(c);
3858
+ return [...chain, "direct (skaile.yaml)"];
3859
+ }
3860
+ queue.push(item);
3861
+ }
3862
+ }
3863
+ return [recorded, "not required by a declared dependency"];
3864
+ }
3675
3865
  /**
3676
3866
  * List installed assets that have a newer upstream available.
3677
3867
  *
@@ -3848,6 +4038,7 @@ var AssetManager = class {
3848
4038
  const entry = await this.lockedLibraryEntry(parsed) ?? await this.info(ref);
3849
4039
  if (!entry || !existsSync(entry.source)) return { status: "not-found" };
3850
4040
  const component = this.installTarget(parsed.kind);
4041
+ if (parsed.kind === "preset" && this.presetRecorded(parsed)) return { status: "no-files" };
3851
4042
  if (!component) return { status: "not-deployed" };
3852
4043
  if (component === "agent") {
3853
4044
  const diff = diffDeployedAgent(entry, this.deployOptsFor(this.driverTarget));
@@ -4113,7 +4304,11 @@ var AssetManager = class {
4113
4304
  const lock = this.tryReadLock();
4114
4305
  const lockedIds = Object.keys(lock?.assets ?? {}).map(parseCanonicalLockKey);
4115
4306
  const requirements = await this.doctor();
4116
- const gaps = [];
4307
+ let gaps = [];
4308
+ const lockIdentity = (kind, name) => {
4309
+ const publisher = lockedIds.find((id) => id.kind === kind && id.name === name)?.publisher;
4310
+ return publisher ? `${kind}:@${publisher}/${name}` : `${kind}:${name}`;
4311
+ };
4117
4312
  for (const i of requirements) {
4118
4313
  if (i.unresolved) {
4119
4314
  const publisher = lockedIds.find(
@@ -4130,7 +4325,7 @@ var AssetManager = class {
4130
4325
  });
4131
4326
  continue;
4132
4327
  }
4133
- const asset = `${i.assetKind}:${i.assetName}`;
4328
+ const asset = lockIdentity(i.assetKind, i.assetName);
4134
4329
  const dep = `${i.depKind}:${i.depName}`;
4135
4330
  if (i.inRepos) {
4136
4331
  gaps.push({
@@ -4141,7 +4336,7 @@ var AssetManager = class {
4141
4336
  message: `${asset} requires ${dep} (fixable)`
4142
4337
  });
4143
4338
  } else {
4144
- const fix = `register the library that holds it with \`skaile library init <name> --path <dir>\`, or drop ${asset} with \`skaile remove ${asset}\``;
4339
+ const fix = requirementNoHolderFix(asset);
4145
4340
  gaps.push({
4146
4341
  type: "requires",
4147
4342
  ref: dep,
@@ -4159,17 +4354,32 @@ var AssetManager = class {
4159
4354
  gaps.push(gap);
4160
4355
  named.add(gapIdentity(gap.ref));
4161
4356
  }
4357
+ const libraryHeld = (dep) => {
4358
+ const want = parseRefTolerant(dep);
4359
+ return want !== null && gaps.some((g) => g.type === "library" && sameAsset(g.ref, want));
4360
+ };
4361
+ gaps = gaps.filter((g) => !(g.type === "requires" && libraryHeld(g.ref)));
4162
4362
  for (const gap of this.undeployedLockGaps(lock, named)) {
4163
4363
  gaps.push(gap);
4164
4364
  named.add(gapIdentity(gap.ref));
4165
4365
  }
4366
+ for (const d of await this.lockedCopyDrift()) {
4367
+ if (named.has(gapIdentity(d.ref))) continue;
4368
+ const parts = [
4369
+ ...d.modified.map((f) => `${f} was edited`),
4370
+ ...d.extra.map((f) => `${f} is not part of the asset`)
4371
+ ];
4372
+ const reason = `is locked, but its deployed copy differs from the lock (${parts.join("; ")}) \u2014 run \`skaile install --locked\` to restore it`;
4373
+ gaps.push({ type: "modified", ref: d.ref, reason, message: `${d.ref} ${reason}` });
4374
+ named.add(gapIdentity(d.ref));
4375
+ }
4166
4376
  gaps.push(...await this.declaredGaps(requirements, named));
4167
4377
  for (const d of await this.incompleteDeploys()) {
4168
4378
  const reason = `is deployed without ${d.missing.join(", ")} \u2014 run \`skaile install\` to restore it`;
4169
4379
  gaps.push({ type: "incomplete", ref: d.ref, reason, message: `${d.ref} ${reason}` });
4170
4380
  }
4171
4381
  for (const u of unboundAgentInstances(this.projectDir, this.driverTarget)) {
4172
- const reason = u.ref.startsWith("agent:") ? `is bound by agent instance "${u.id}" but no agent was added for it \u2014 run \`skaile add ${u.ref}\` first, or drop the binding from skaile.yaml` : `is bound by agent instance "${u.id}" but resolves to no agent.yaml \u2014 fix the path, or drop the binding from skaile.yaml`;
4382
+ const reason = u.ref.startsWith("agent:") ? await this.unboundAgentReason(u.id, u.ref) : `is bound by agent instance "${u.id}" but resolves to no agent.yaml \u2014 fix the path, or drop the binding from skaile.yaml`;
4173
4383
  gaps.push({
4174
4384
  type: "agent",
4175
4385
  ref: u.ref,
@@ -4178,7 +4388,54 @@ var AssetManager = class {
4178
4388
  manualFix: true
4179
4389
  });
4180
4390
  }
4181
- return { gaps, requirements };
4391
+ return {
4392
+ gaps,
4393
+ requirements: requirements.filter(
4394
+ (i) => i.unresolved || !libraryHeld(`${i.depKind}:${i.depName}`)
4395
+ )
4396
+ };
4397
+ }
4398
+ /**
4399
+ * Why the `agent:` ref of agent instance `id` binds to nothing, as the phrase that follows
4400
+ * the ref in a {@link LockGap}; see {@link AssetManager.unboundAgentAdvice}.
4401
+ */
4402
+ async unboundAgentReason(id, ref) {
4403
+ const { lead, advice } = await this.unboundAgentAdvice(ref);
4404
+ return `is bound by agent instance "${id}" but ${lead} \u2014 ${advice}`;
4405
+ }
4406
+ /**
4407
+ * What is wrong with an `agent:` ref bound by an agent instance and what to do (`lead`, then
4408
+ * `advice`). `skaile add` is named only when a registered library or source holds the agent
4409
+ * and `add` takes the ref (it needs a publisher); otherwise the user registers the library
4410
+ * that holds it, writes the publisher, or drops the binding.
4411
+ */
4412
+ async unboundAgentAdvice(ref) {
4413
+ const drop = "or drop the binding from skaile.yaml";
4414
+ const publisher = parseRefTolerant(ref)?.publisher;
4415
+ if (publisher && await this.info(ref) !== null) {
4416
+ return {
4417
+ lead: "no agent was added for it",
4418
+ advice: `run \`skaile add ${ref}\` first, ${drop}`
4419
+ };
4420
+ }
4421
+ if (!publisher) {
4422
+ return {
4423
+ lead: "names no publisher",
4424
+ advice: `write it as agent:@<publisher>/<name> (\`skaile add\` needs the publisher), ${drop}`
4425
+ };
4426
+ }
4427
+ const fix = (await this.unresolvedFixes([ref])).get(ref);
4428
+ if (fix) {
4429
+ const register = fix.replace(/, or drop the dependency with `skaile remove [^`]*`$/, "");
4430
+ return {
4431
+ lead: "no agent was added for it, and `skaile add` cannot resolve it",
4432
+ advice: `${register}, ${drop}`
4433
+ };
4434
+ }
4435
+ return {
4436
+ lead: "no registered library or source holds it",
4437
+ advice: `register the library that holds it with \`skaile library init <name> --path <dir>\`, ${drop}`
4438
+ };
4182
4439
  }
4183
4440
  /** @deprecated Use `(await projectState()).gaps`; removed in the next major. */
4184
4441
  async lockGaps() {
@@ -4266,6 +4523,110 @@ var AssetManager = class {
4266
4523
  }
4267
4524
  return gaps;
4268
4525
  }
4526
+ /**
4527
+ * The {@link RestoredAsset} rows for the drifted copies (see {@link lockedCopyDrift}) a
4528
+ * deploy just wrote again: those whose ref is among the `deployed` canonical refs.
4529
+ */
4530
+ restoredCopies(drifts, deployed) {
4531
+ const rewritten = new Set(deployed.map((d) => d.split("#")[0]));
4532
+ const out = [];
4533
+ for (const d of drifts) {
4534
+ if (!rewritten.has(d.ref)) continue;
4535
+ const { kind, name } = parseCanonicalLockKey(d.key);
4536
+ const component = kind ? this.installTarget(kind) : void 0;
4537
+ if (!kind || !name || !component) continue;
4538
+ const dir = relative(
4539
+ this.projectDir,
4540
+ deployedDir(component, name, this.driverTarget, this.global, this.projectDir)
4541
+ ).split(sep).join("/");
4542
+ out.push({
4543
+ ref: d.key,
4544
+ restored: d.modified.map((f) => `${dir}/${f}`),
4545
+ removed: d.extra.map((f) => `${dir}/${f}`)
4546
+ });
4547
+ }
4548
+ return out;
4549
+ }
4550
+ /**
4551
+ * Locked assets whose deployed copy differs from the bytes the lock covers: a file edited by
4552
+ * hand, or a file the asset does not ship. One row per asset, `ref` being `kind:@publisher/name`
4553
+ * and `key` its lock key. The one comparison behind the `modified` gap and the `Restored` lines
4554
+ * of `install`.
4555
+ *
4556
+ * - A library-origin asset is compared with its library's files, but only while those equal the
4557
+ * locked hash (changed library content is the `content` gap's business), both modified and
4558
+ * extra files.
4559
+ * - A source asset is compared with the per-file hashes the lock records (modified files only:
4560
+ * the lock lists what the source covers, not what the deploy copies).
4561
+ *
4562
+ * An agent (rendered, not copied), a `--link` deploy, an asset with a configured patch, and a
4563
+ * copy that is missing are not compared: other gaps cover them. Project mode only.
4564
+ */
4565
+ async lockedCopyDrift() {
4566
+ if (this.global) return [];
4567
+ const lock = this.tryReadLock();
4568
+ if (!lock) return [];
4569
+ const { patches } = this.loadConfig();
4570
+ const out = [];
4571
+ const deployOpts = {
4572
+ registry: this.registry,
4573
+ driverTarget: this.driverTarget,
4574
+ global: this.global,
4575
+ cwd: this.projectDir
4576
+ };
4577
+ const refOf = (key) => {
4578
+ const { kind, publisher, name } = parseCanonicalLockKey(key);
4579
+ return publisher ? `${kind}:@${publisher}/${name}` : `${kind}:${name}`;
4580
+ };
4581
+ const keyOf = /* @__PURE__ */ new Map();
4582
+ for (const key of Object.keys(lock.assets)) keyOf.set(refOf(key), key);
4583
+ const { entries } = await this.restoreLibraryLockEntries(lock);
4584
+ for (const e of entries) {
4585
+ if (patches[`${e.kind}:${e.name}`]) continue;
4586
+ const drift = deployedAssetDrift(e, deployOpts);
4587
+ if (!drift || drift.modified.length === 0 && drift.extra.length === 0) continue;
4588
+ const ref = `${e.kind}:@${(e.publisher ?? "").replace(/^@/, "")}/${e.name}`;
4589
+ out.push({ ref, key: keyOf.get(ref) ?? ref, ...drift, library: true });
4590
+ }
4591
+ for (const [key, entry] of Object.entries(lock.assets)) {
4592
+ if (!entry.source || entry.files.length === 0) continue;
4593
+ const { kind, name } = parseCanonicalLockKey(key);
4594
+ const component = kind ? this.installTarget(kind) : void 0;
4595
+ if (!kind || !name || !component || component === "agent") continue;
4596
+ if (patches[`${kind}:${name}`]) continue;
4597
+ const dest = deployedDir(component, name, this.driverTarget, this.global, this.projectDir);
4598
+ try {
4599
+ const deployed = lstatSync(dest);
4600
+ if (deployed.isSymbolicLink() || !deployed.isDirectory()) continue;
4601
+ } catch {
4602
+ continue;
4603
+ }
4604
+ const dirs = entry.files.map(
4605
+ (f) => posix.dirname(f.path).split("/").filter((s) => s !== ".")
4606
+ );
4607
+ let common = dirs[0] ?? [];
4608
+ for (const d of dirs.slice(1)) {
4609
+ let i = 0;
4610
+ while (i < common.length && i < d.length && common[i] === d[i]) i++;
4611
+ common = common.slice(0, i);
4612
+ }
4613
+ const prefix = common.length > 0 ? `${common.join("/")}/` : "";
4614
+ const modified = [];
4615
+ for (const f of entry.files) {
4616
+ const rel = f.path.startsWith(prefix) ? f.path.slice(prefix.length) : f.path;
4617
+ const deployedFile = join(dest, rel);
4618
+ if (!existsSync(deployedFile)) continue;
4619
+ try {
4620
+ if (computeHash(deployedFile) !== f.sha256) modified.push(rel);
4621
+ } catch {
4622
+ modified.push(rel);
4623
+ }
4624
+ }
4625
+ if (modified.length > 0)
4626
+ out.push({ ref: refOf(key), key, modified, extra: [], library: false });
4627
+ }
4628
+ return out;
4629
+ }
4269
4630
  /**
4270
4631
  * Locked assets (declared or required by one) whose deployed copy is gone: `skaile install`
4271
4632
  * restores them. Same deployability rule as {@link AssetManager.listDeclared}'s `drift`.
@@ -4336,7 +4697,7 @@ var AssetManager = class {
4336
4697
  } else {
4337
4698
  gap = {
4338
4699
  type: "declared",
4339
- reason: `is declared but no library or source holds it \u2014 register the library that holds it with \`skaile library init <name> --path <dir>\`, or drop it with \`skaile remove ${d.ref.split("#")[0]}\``,
4700
+ reason: declaredNoHolderReason(d.ref),
4340
4701
  manualFix: true
4341
4702
  };
4342
4703
  }
@@ -4346,7 +4707,7 @@ var AssetManager = class {
4346
4707
  if (this.presetRecorded(want) || await this.info(d.ref) !== null) continue;
4347
4708
  gap = await this.declaredRefResolvable(d.ref) ? { type: "declared", reason: "is declared but not locked \u2014 run `skaile install`" } : {
4348
4709
  type: "declared",
4349
- reason: `is declared but no library or source holds it \u2014 register the library that holds it with \`skaile library init <name> --path <dir>\`, or drop it with \`skaile remove ${d.ref.split("#")[0]}\``,
4710
+ reason: declaredNoHolderReason(d.ref),
4350
4711
  manualFix: true
4351
4712
  };
4352
4713
  gaps.push({ ...gap, ref: d.ref, message: `${d.ref} ${gap.reason}` });
@@ -4715,5 +5076,5 @@ var AssetManager = class {
4715
5076
  };
4716
5077
 
4717
5078
  export { AssetManager, FACTORY_SOURCE_URL, MissingManifestError, installAgentInstances, normalizeRepoUrl, parseCanonicalLockKey, parseRefTolerant, renderMcpServerConfig, softDepName };
4718
- //# sourceMappingURL=chunk-2JMLDZLP.js.map
4719
- //# sourceMappingURL=chunk-2JMLDZLP.js.map
5079
+ //# sourceMappingURL=chunk-DZMNFCWB.js.map
5080
+ //# sourceMappingURL=chunk-DZMNFCWB.js.map