@skaile/workspaces 1.6.0 → 1.7.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 (156) hide show
  1. package/CHANGELOG.md +118 -0
  2. package/dist/app-sdk/index.js +22 -7
  3. package/dist/app-sdk/index.js.map +1 -1
  4. package/dist/app-sdk/src/connection-params.d.ts +7 -0
  5. package/dist/app-sdk/src/connection-params.d.ts.map +1 -1
  6. package/dist/{asset-feeds-T35ELX2O.js → asset-feeds-Y66NCOQZ.js} +11 -11
  7. package/dist/asset-feeds-Y66NCOQZ.js.map +1 -0
  8. package/dist/asset-manager/index.js +6 -6
  9. package/dist/asset-manager/installer.js +4 -4
  10. package/dist/asset-manager/src/index.d.ts +18 -0
  11. package/dist/asset-manager/src/index.d.ts.map +1 -1
  12. package/dist/{chunk-HY33RMEA.js → chunk-5NZ56R63.js} +3 -3
  13. package/dist/{chunk-HY33RMEA.js.map → chunk-5NZ56R63.js.map} +1 -1
  14. package/dist/{chunk-ZBZQC5R7.js → chunk-7J7LQP6T.js} +3 -3
  15. package/dist/{chunk-ZBZQC5R7.js.map → chunk-7J7LQP6T.js.map} +1 -1
  16. package/dist/{chunk-WYGXYGJH.js → chunk-7VGRRH2L.js} +9 -9
  17. package/dist/{chunk-WYGXYGJH.js.map → chunk-7VGRRH2L.js.map} +1 -1
  18. package/dist/{chunk-RDYOU6N6.js → chunk-BSXBOKL6.js} +2 -2
  19. package/dist/{chunk-RDYOU6N6.js.map → chunk-BSXBOKL6.js.map} +1 -1
  20. package/dist/{chunk-UQKYT4V6.js → chunk-ISA7R7PK.js} +3 -3
  21. package/dist/{chunk-UQKYT4V6.js.map → chunk-ISA7R7PK.js.map} +1 -1
  22. package/dist/{chunk-J5TI55E7.js → chunk-MB6563TL.js} +37 -8
  23. package/dist/chunk-MB6563TL.js.map +1 -0
  24. package/dist/{chunk-FDE7XRQA.js → chunk-MWE7DEGC.js} +3 -3
  25. package/dist/{chunk-FDE7XRQA.js.map → chunk-MWE7DEGC.js.map} +1 -1
  26. package/dist/{chunk-KMY7HVQ6.js → chunk-O3D4KYFG.js} +3 -3
  27. package/dist/{chunk-KMY7HVQ6.js.map → chunk-O3D4KYFG.js.map} +1 -1
  28. package/dist/{chunk-JIDKX7GC.js → chunk-PP2LOT4W.js} +43 -7
  29. package/dist/chunk-PP2LOT4W.js.map +1 -0
  30. package/dist/{chunk-2DWXGUZA.js → chunk-QHU6TM7D.js} +2 -2
  31. package/dist/{chunk-2DWXGUZA.js.map → chunk-QHU6TM7D.js.map} +1 -1
  32. package/dist/{chunk-6NR2BEIY.js → chunk-STQOPWPS.js} +4 -4
  33. package/dist/{chunk-6NR2BEIY.js.map → chunk-STQOPWPS.js.map} +1 -1
  34. package/dist/{chunk-BEO6KN7P.js → chunk-SZY7X4M2.js} +5 -5
  35. package/dist/{chunk-BEO6KN7P.js.map → chunk-SZY7X4M2.js.map} +1 -1
  36. package/dist/{chunk-CBA2XIBF.js → chunk-TC3GLA5D.js} +31 -16
  37. package/dist/chunk-TC3GLA5D.js.map +1 -0
  38. package/dist/{chunk-RSYV7XEN.js → chunk-TITPPC54.js} +4 -4
  39. package/dist/{chunk-RSYV7XEN.js.map → chunk-TITPPC54.js.map} +1 -1
  40. package/dist/{chunk-DMG6NJH7.js → chunk-VBRXFLIP.js} +4 -4
  41. package/dist/{chunk-DMG6NJH7.js.map → chunk-VBRXFLIP.js.map} +1 -1
  42. package/dist/{chunk-2ZMO4CFG.js → chunk-VK24PIAB.js} +5 -4
  43. package/dist/chunk-VK24PIAB.js.map +1 -0
  44. package/dist/{chunk-3CHARYD4.js → chunk-Y3UCU4ZK.js} +99 -28
  45. package/dist/chunk-Y3UCU4ZK.js.map +1 -0
  46. package/dist/{chunk-KEQ4GLVM.js → chunk-Y6FV73IH.js} +58 -4
  47. package/dist/chunk-Y6FV73IH.js.map +1 -0
  48. package/dist/cli/index.js +589 -194
  49. package/dist/cli/index.js.map +1 -1
  50. package/dist/cli/src/asset-feeds.d.ts.map +1 -1
  51. package/dist/cli/src/commands/asset-cmd.d.ts.map +1 -1
  52. package/dist/cli/src/commands/library-cmd.d.ts.map +1 -1
  53. package/dist/cli/src/commands/library-index.d.ts +59 -0
  54. package/dist/cli/src/commands/library-index.d.ts.map +1 -0
  55. package/dist/cli/src/commands/library-publish.d.ts.map +1 -1
  56. package/dist/cli/src/commands/manage.d.ts +22 -1
  57. package/dist/cli/src/commands/manage.d.ts.map +1 -1
  58. package/dist/cli/src/commands/publish-core.d.ts +24 -0
  59. package/dist/cli/src/commands/publish-core.d.ts.map +1 -1
  60. package/dist/cli/src/commands/session-logs/remote-query.d.ts.map +1 -1
  61. package/dist/cli/src/commands/session-logs/remote-tail.d.ts.map +1 -1
  62. package/dist/cli/src/commands/session-logs/superjson-transformer.d.ts +12 -0
  63. package/dist/cli/src/commands/session-logs/superjson-transformer.d.ts.map +1 -0
  64. package/dist/cli/src/commands/source-manifest-publish.d.ts.map +1 -1
  65. package/dist/cli/src/commands/store.d.ts.map +1 -1
  66. package/dist/cli/src/paths.d.ts.map +1 -1
  67. package/dist/cli/src/store-auth.d.ts +11 -0
  68. package/dist/cli/src/store-auth.d.ts.map +1 -1
  69. package/dist/cli/src/store-client.d.ts.map +1 -1
  70. package/dist/cli/src/store-publisher.d.ts +24 -1
  71. package/dist/cli/src/store-publisher.d.ts.map +1 -1
  72. package/dist/connectors/config.js +4 -4
  73. package/dist/connectors/index.js +5 -5
  74. package/dist/connectors/src/config.d.ts +21 -0
  75. package/dist/connectors/src/config.d.ts.map +1 -1
  76. package/dist/connectors/src/index.d.ts +1 -1
  77. package/dist/connectors/src/index.d.ts.map +1 -1
  78. package/dist/core/index.js +3 -3
  79. package/dist/core/runtime-assets.js +2 -2
  80. package/dist/core/src/index.d.ts +1 -1
  81. package/dist/core/src/index.d.ts.map +1 -1
  82. package/dist/core/src/repo-manager.d.ts +4 -0
  83. package/dist/core/src/repo-manager.d.ts.map +1 -1
  84. package/dist/core/workspace-config.js +1 -1
  85. package/dist/deploy/index.js +3 -3
  86. package/dist/{ensure-sources-QDVFUIUP.js → ensure-sources-NXBYK5GP.js} +9 -9
  87. package/dist/{ensure-sources-QDVFUIUP.js.map → ensure-sources-NXBYK5GP.js.map} +1 -1
  88. package/dist/factory-assets/connectors/box.js +5 -5
  89. package/dist/factory-assets/connectors/deploy.js +5 -5
  90. package/dist/factory-assets/connectors/devserver.js +5 -5
  91. package/dist/factory-assets/connectors/flow/adapter.js +5 -5
  92. package/dist/factory-assets/connectors/flow/engine.js +3 -3
  93. package/dist/factory-assets/connectors/flow/run-flow.js +6 -6
  94. package/dist/factory-assets/connectors/flow.js +5 -5
  95. package/dist/factory-assets/connectors/git.js +5 -5
  96. package/dist/factory-assets/connectors/gmail.js +5 -5
  97. package/dist/factory-assets/connectors/googledrive.js +5 -5
  98. package/dist/factory-assets/connectors/local.js +5 -5
  99. package/dist/factory-assets/connectors/mattermost.js +5 -5
  100. package/dist/factory-assets/connectors/memory.js +5 -5
  101. package/dist/factory-assets/connectors/minio.js +5 -5
  102. package/dist/factory-assets/connectors/postgres.js +5 -5
  103. package/dist/factory-assets/connectors/s3.js +5 -5
  104. package/dist/factory-assets/connectors/sharepoint.js +5 -5
  105. package/dist/factory-assets/connectors/sqlite.js +5 -5
  106. package/dist/factory-assets/connectors/static-server.js +5 -5
  107. package/dist/factory-assets/connectors/tunnel.js +5 -5
  108. package/dist/factory-assets/connectors/webdav.js +5 -5
  109. package/dist/factory-assets/connectors/xstate-store.js +5 -5
  110. package/dist/factory-assets/connectors/xstate.js +5 -5
  111. package/dist/{flows-MRVXTYWC.js → flows-RR6R3WBL.js} +3 -3
  112. package/dist/{flows-MRVXTYWC.js.map → flows-RR6R3WBL.js.map} +1 -1
  113. package/dist/{helpers-TF7GCBRQ.js → helpers-DN4MWOHB.js} +9 -9
  114. package/dist/{helpers-TF7GCBRQ.js.map → helpers-DN4MWOHB.js.map} +1 -1
  115. package/dist/library/index.js +4 -4
  116. package/dist/library/install.js +3 -3
  117. package/dist/{library-publish-K5IBE44D.js → library-publish-TPWFSO3Q.js} +44 -20
  118. package/dist/library-publish-TPWFSO3Q.js.map +1 -0
  119. package/dist/{open-library-4HMIDK3N.js → open-library-ST2VFQTK.js} +10 -10
  120. package/dist/{open-library-4HMIDK3N.js.map → open-library-ST2VFQTK.js.map} +1 -1
  121. package/dist/paths-KOKCMBL5.js +21 -0
  122. package/dist/{paths-P3DWFUPS.js.map → paths-KOKCMBL5.js.map} +1 -1
  123. package/dist/{plugin-store-S7OMGI7N.js → plugin-store-QMJ2B3VM.js} +5 -5
  124. package/dist/{plugin-store-S7OMGI7N.js.map → plugin-store-QMJ2B3VM.js.map} +1 -1
  125. package/dist/runner/index.js +7 -7
  126. package/dist/runner/src/resources.d.ts +8 -2
  127. package/dist/runner/src/resources.d.ts.map +1 -1
  128. package/dist/runner/src/serve.d.ts.map +1 -1
  129. package/dist/runner/src/session-builder.d.ts +10 -0
  130. package/dist/runner/src/session-builder.d.ts.map +1 -1
  131. package/dist/sdk/asset-manager.js +6 -6
  132. package/dist/sdk/core.js +3 -3
  133. package/dist/sdk/flow.js +3 -3
  134. package/dist/sdk/index.js +7 -7
  135. package/dist/sdk/runner.js +7 -7
  136. package/dist/{setup-2CCS63L6.js → setup-ETGRXSZG.js} +5 -5
  137. package/dist/{setup-2CCS63L6.js.map → setup-ETGRXSZG.js.map} +1 -1
  138. package/dist/{source-LOAM7IIQ.js → source-R4TWF424.js} +11 -11
  139. package/dist/{source-LOAM7IIQ.js.map → source-R4TWF424.js.map} +1 -1
  140. package/dist/{source-manifest-publish-TGVZ6KMC.js → source-manifest-publish-FXDK2BCI.js} +17 -15
  141. package/dist/source-manifest-publish-FXDK2BCI.js.map +1 -0
  142. package/dist/tui/index.js +7 -7
  143. package/dist/workspace-plugin/adapters/mcp.js +1 -1
  144. package/dist/workspace-plugin/adapters/omp.js +3 -3
  145. package/dist/workspace-plugin/index.js +1 -1
  146. package/package.json +1 -1
  147. package/dist/asset-feeds-T35ELX2O.js.map +0 -1
  148. package/dist/chunk-2ZMO4CFG.js.map +0 -1
  149. package/dist/chunk-3CHARYD4.js.map +0 -1
  150. package/dist/chunk-CBA2XIBF.js.map +0 -1
  151. package/dist/chunk-J5TI55E7.js.map +0 -1
  152. package/dist/chunk-JIDKX7GC.js.map +0 -1
  153. package/dist/chunk-KEQ4GLVM.js.map +0 -1
  154. package/dist/library-publish-K5IBE44D.js.map +0 -1
  155. package/dist/paths-P3DWFUPS.js +0 -15
  156. package/dist/source-manifest-publish-TGVZ6KMC.js.map +0 -1
@@ -1,4 +1,5 @@
1
- import { factoryAssetRoots } from './chunk-ZBZQC5R7.js';
1
+ import { resolveLibraryDir } from './chunk-MWE7DEGC.js';
2
+ import { factoryAssetRoots } from './chunk-7J7LQP6T.js';
2
3
  import fs from 'fs';
3
4
  import os from 'os';
4
5
  import path from 'path';
@@ -19,10 +20,10 @@ var MONOREPO_ROOT = findMonorepoRoot(__ownDir);
19
20
  var AI_RESOURCES = factoryAssetRoots()[0] ?? path.join(os.homedir(), ".skaile", "libraries");
20
21
  function aiResourceRoots() {
21
22
  const roots = [...factoryAssetRoots()];
22
- roots.push(path.join(os.homedir(), ".skaile", "libraries"));
23
+ roots.push(resolveLibraryDir());
23
24
  return [...new Set(roots)].filter((r) => fs.existsSync(r));
24
25
  }
25
26
 
26
27
  export { AI_RESOURCES, MONOREPO_ROOT, aiResourceRoots };
27
- //# sourceMappingURL=chunk-2ZMO4CFG.js.map
28
- //# sourceMappingURL=chunk-2ZMO4CFG.js.map
28
+ //# sourceMappingURL=chunk-VK24PIAB.js.map
29
+ //# sourceMappingURL=chunk-VK24PIAB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../cli/src/paths.ts"],"names":[],"mappings":";;;;;;;AAOA,IAAM,WAAW,IAAA,CAAK,OAAA,CAAQ,aAAA,CAAc,MAAA,CAAA,IAAA,CAAY,GAAG,CAAC,CAAA;AAW5D,SAAS,iBAAiB,IAAA,EAA6B;AACrD,EAAA,IAAI,GAAA,GAAM,IAAA;AACV,EAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,CAAA,EAAG,CAAA,EAAA,EAAK;AAC1B,IAAA,IAAI,EAAA,CAAG,WAAW,IAAA,CAAK,IAAA,CAAK,KAAK,YAAY,CAAC,GAAG,OAAO,GAAA;AACxD,IAAA,MAAM,MAAA,GAAS,IAAA,CAAK,OAAA,CAAQ,GAAG,CAAA;AAC/B,IAAA,IAAI,WAAW,GAAA,EAAK;AACpB,IAAA,GAAA,GAAM,MAAA;AAAA,EACR;AACA,EAAA,OAAO,IAAA;AACT;AAYO,IAAM,aAAA,GAA+B,iBAAiB,QAAQ;AAc9D,IAAM,YAAA,GACX,iBAAA,EAAkB,CAAE,CAAC,CAAA,IAAK,IAAA,CAAK,IAAA,CAAK,EAAA,CAAG,OAAA,EAAQ,EAAG,SAAA,EAAW,WAAW;AAoBnE,SAAS,eAAA,GAA4B;AAC1C,EAAA,MAAM,KAAA,GAAkB,CAAC,GAAG,iBAAA,EAAmB,CAAA;AAG/C,EAAA,KAAA,CAAM,IAAA,CAAK,mBAAmB,CAAA;AAC9B,EAAA,OAAO,CAAC,GAAG,IAAI,GAAA,CAAI,KAAK,CAAC,CAAA,CAAE,MAAA,CAAO,CAAC,CAAA,KAAM,EAAA,CAAG,UAAA,CAAW,CAAC,CAAC,CAAA;AAC3D","file":"chunk-VK24PIAB.js","sourcesContent":["import fs from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { factoryAssetRoots } from \"@skaile/workspaces/core\";\nimport { resolveLibraryDir } from \"@skaile/workspaces/library\";\n\nconst __ownDir = path.dirname(fileURLToPath(import.meta.url));\n\n/**\n * Walk up from `from` looking for the monorepo marker (`biome.json`, the\n * repo-root shared tooling config). Returns the matching directory or `null`\n * when none is found within eight levels — the latter is the typical case when\n * `@skaile/workspaces` has been installed via `npm i` without a skaile-dev\n * workspace context. Used only to gate dev-only commands (e.g.\n * `serve --compile-test`); first-party content is located via\n * {@link aiResourceRoots}, not this.\n */\nfunction findMonorepoRoot(from: string): string | null {\n let dir = from;\n for (let i = 0; i < 8; i++) {\n if (fs.existsSync(path.join(dir, \"biome.json\"))) return dir;\n const parent = path.dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n return null;\n}\n\n/**\n * Absolute path to the monorepo root, or `null` when the CLI is running\n * outside the skaile-dev workspace (typical for `npm i -g` installs).\n *\n * Consumers that only make sense inside the workspace (e.g.\n * `skaile serve --compile-test`) MUST check for `null` and report a\n * \"monorepo-only feature\" error before proceeding.\n *\n * @docLink cli/dev-guide#paths\n */\nexport const MONOREPO_ROOT: string | null = findMonorepoRoot(__ownDir);\n\n/**\n * Default content root used by path display and the `validate` command.\n *\n * The primary first-party `factory-assets/` root resolved through the shared\n * `factoryAssetRoots()` helper — the `SKAILE_FACTORY_ASSETS_DIR` override when\n * set, else the in-repo source during dev / bundled `dist/factory-assets/` after\n * `npm i`. Falls back to `~/.skaile/libraries/` — the user-library directory\n * managed by `skaile library add` — when the package cannot be located.\n * Consumers `fs.existsSync` first and degrade to \"no skills / flows discovered\".\n *\n * @docLink cli/dev-guide#paths\n */\nexport const AI_RESOURCES: string =\n factoryAssetRoots()[0] ?? path.join(os.homedir(), \".skaile\", \"libraries\");\n\n/**\n * All content roots that skill / flow discovery should walk, in priority order,\n * filtered to those that exist on disk and de-duplicated.\n *\n * - The first-party `factory-assets/` roots from the shared `factoryAssetRoots()`\n * helper — the `SKAILE_FACTORY_ASSETS_DIR` override layer (when set) ahead of\n * the bundled tree (in-repo source in dev, `dist/factory-assets/` after\n * install). No monorepo special-case.\n * - The user-library dir `~/.skaile/libraries/`.\n *\n * Order is significant: `findSkills` / flow discovery dedupe first-root-wins, so\n * the env override shadows the bundled tree on a name clash.\n *\n * This is the discovery surface used by `findSkills`, flow discovery, and the\n * completion resolvers.\n *\n * @docLink cli/dev-guide#paths\n */\nexport function aiResourceRoots(): string[] {\n const roots: string[] = [...factoryAssetRoots()];\n // resolveLibraryDir honors SKAILE_LIBRARIES_DIR (the authoring side does too),\n // so a custom-dir library is visible to discovery instead of being missed.\n roots.push(resolveLibraryDir());\n return [...new Set(roots)].filter((r) => fs.existsSync(r));\n}\n"]}
@@ -1,16 +1,17 @@
1
- import { getStoreManifestsDir } from './chunk-FDE7XRQA.js';
2
- import { deployAll, removeAsset, createScaffold } from './chunk-6NR2BEIY.js';
3
- import { writeLock, buildLockFile, readLock, verifyLock, extractForPatch, generatePatch, savePatch, applyPatch } from './chunk-HY33RMEA.js';
4
- import { resolveRuntimeAssets, factoryAssetRoots } from './chunk-ZBZQC5R7.js';
5
- import { globalSkaileDir, resolveGlobalBackends, globalCacheRoot, migrateLegacyDir, resolveGlobalSkWorkspaceConfig, resolveSkWorkspaceConfig, getGlobalCacheDir, sourceCacheKey, getRepoCommit, resolveAll, buildProvenanceIndex, ensureRepo, sourceShortName, scanRepo, SKAILE_YAML_DEFAULT, checkRepoStatus, resolveAsset, readLinks, storeManifestSlug } from './chunk-UQKYT4V6.js';
6
- import { parseRequires } from './chunk-BQCGFPHW.js';
7
- import { parseAssetRef, assetRefToStr } from './chunk-GEEW6SY2.js';
1
+ import { resolveLibraryDir, getStoreManifestsDir } from './chunk-MWE7DEGC.js';
2
+ import { deployAll, removeAsset, createScaffold } from './chunk-STQOPWPS.js';
3
+ import { writeLock, buildLockFile, readLock, verifyLock, extractForPatch, generatePatch, savePatch, applyPatch } from './chunk-5NZ56R63.js';
4
+ import { resolveRuntimeAssets, factoryAssetRoots } from './chunk-7J7LQP6T.js';
5
+ import { globalSkaileDir, resolveGlobalBackends, globalCacheRoot, migrateLegacyDir, resolveGlobalSkWorkspaceConfig, resolveSkWorkspaceConfig, getGlobalCacheDir, sourceCacheKey, getRepoCommit, coerceVersion, matchPin, resolveAll, buildProvenanceIndex, ensureRepo, sourceShortName, scanRepo, SKAILE_YAML_DEFAULT, checkRepoStatus, resolveAsset, readLinks, storeManifestSlug } from './chunk-ISA7R7PK.js';
6
+ import { scanDirectory, parseRequires } from './chunk-BQCGFPHW.js';
7
+ import { parseAssetRef, slugifyAssetName, assetRefToStr } from './chunk-GEEW6SY2.js';
8
8
  import { deployedBase, isDeployed, deployedDir } from './chunk-F3HNW354.js';
9
9
  import { appendHistory, getRecentHistory, clearHistory } from './chunk-KTBKW2FI.js';
10
10
  import { commitChanges } from './chunk-UQ6LFBPZ.js';
11
11
  import { spawnSync } from 'child_process';
12
12
  import { existsSync, readdirSync, rmSync, lstatSync, unlinkSync, mkdirSync, writeFileSync, readFileSync } from 'fs';
13
13
  import { resolve, join, sep, dirname } from 'path';
14
+ import { gt } from 'semver';
14
15
  import { stringify, parse } from 'yaml';
15
16
 
16
17
  function normalizeRepoUrl(url) {
@@ -372,6 +373,64 @@ var AssetManager = class {
372
373
  if (c.homepage != null) entry.homepage = c.homepage;
373
374
  return entry;
374
375
  }
376
+ /**
377
+ * Resolve refs the source/store pass could not against the user's registered
378
+ * **libraries** (local authoring places). Each library dir is scanned on disk
379
+ * under its declared publisher (its root `skaile.manifest.yaml`, falling back
380
+ * to the kebab-cased library name); a matching asset becomes a deployable
381
+ * {@link CatalogEntry} whose `source` points at the on-disk manifest. This is
382
+ * the consume side of `library create` — a freshly authored asset is
383
+ * deployable with `skaile add <kind>:@<publisher>/<name>` without publishing.
384
+ *
385
+ * Pure local read (no index, no network) and mirrors how `findSkills`
386
+ * discovers library content. Library assets are deliberately NOT written to
387
+ * the lock (a local authoring place is not a reproducible source); they are
388
+ * re-discovered on every `add`/`install`, so reconcile never treats them as
389
+ * stale.
390
+ *
391
+ * @returns the matched deploy entries plus the set of `missing` refs covered.
392
+ */
393
+ resolveLibraryEntries(missing) {
394
+ const resolved = /* @__PURE__ */ new Set();
395
+ if (missing.length === 0) return { entries: [], resolved };
396
+ let librariesRoot;
397
+ try {
398
+ librariesRoot = resolveLibraryDir();
399
+ } catch {
400
+ return { entries: [], resolved };
401
+ }
402
+ if (!existsSync(librariesRoot)) return { entries: [], resolved };
403
+ const byKey = /* @__PURE__ */ new Map();
404
+ for (const dirent of readdirSync(librariesRoot, { withFileTypes: true })) {
405
+ if (!dirent.isDirectory()) continue;
406
+ const libPath = join(librariesRoot, dirent.name);
407
+ const publisher = readDeclaredPublisher(libPath) ?? slugifyAssetName(dirent.name);
408
+ for (const entry of scanDirectory(libPath, publisher)) {
409
+ const key = `${entry.kind}:@${entry.publisher}/${entry.name}`;
410
+ const prev = byKey.get(key);
411
+ if (!prev || gt(coerceVersion(entry.version ?? ""), coerceVersion(prev.version ?? ""))) {
412
+ byKey.set(key, entry);
413
+ }
414
+ }
415
+ }
416
+ if (byKey.size === 0) return { entries: [], resolved };
417
+ const entries = [];
418
+ for (const ref of missing) {
419
+ let parsed;
420
+ try {
421
+ parsed = parseAssetRef(ref);
422
+ } catch {
423
+ continue;
424
+ }
425
+ if (!parsed.publisher) continue;
426
+ const entry = byKey.get(`${parsed.kind}:@${parsed.publisher}/${parsed.name}`);
427
+ if (!entry) continue;
428
+ if (parsed.pin && !matchPin(parsed.pin, entry.version ?? "")) continue;
429
+ entries.push(entry);
430
+ resolved.add(ref);
431
+ }
432
+ return { entries, resolved };
433
+ }
375
434
  // ── Store fetch-then-deploy ────────────────────────────────────────────
376
435
  /** A candidate's stable identity key (`<publisher>/<kind>:<name>@<version>`). */
377
436
  candidateKey(c) {
@@ -580,8 +639,9 @@ var AssetManager = class {
580
639
  overrides,
581
640
  stores
582
641
  });
642
+ const lib = this.resolveLibraryEntries(missing);
583
643
  const removed = this.reconcileRemovedAssets(resolved);
584
- const entries = await this.buildCatalogEntries(resolved, repositories);
644
+ const entries = [...await this.buildCatalogEntries(resolved, repositories), ...lib.entries];
585
645
  const deployed = [
586
646
  ...new Set(
587
647
  this.targetBackends().flatMap(
@@ -589,10 +649,14 @@ var AssetManager = class {
589
649
  )
590
650
  )
591
651
  ];
592
- writeLock(this.lockPath, buildLockFile(resolved, overridesApplied));
652
+ const lockWritten = resolved.length > 0 || existsSync(this.lockPath);
653
+ if (lockWritten) {
654
+ writeLock(this.lockPath, buildLockFile(resolved, overridesApplied));
655
+ }
593
656
  this.recordInstallHistory(deployed, removed);
594
657
  const { npmInstalled, npmFailed } = await this.installRuntimeAssetDeps();
595
- return { deployed, removed, missing, lockWritten: true, npmInstalled, npmFailed };
658
+ const stillMissing = missing.filter((m) => !lib.resolved.has(m));
659
+ return { deployed, removed, missing: stillMissing, lockWritten, npmInstalled, npmFailed };
596
660
  }
597
661
  /**
598
662
  * Ensure all source clones are present/up to date. Returns an early
@@ -734,12 +798,16 @@ var AssetManager = class {
734
798
  throw new Error("No lock file found. Run `skaile install` first.");
735
799
  }
736
800
  const declBySlug = new Map(Object.entries(repositories));
801
+ const factoryUrl = normalizeRepoUrl(FACTORY_SOURCE_URL);
802
+ const factoryDir = Object.values(repositories).find((d) => d.factory)?.path ?? null;
737
803
  for (const src of lock.sources) {
804
+ if (factoryDir && normalizeRepoUrl(src.url) === factoryUrl) continue;
738
805
  const slug = sourceCacheKey(src.url);
739
806
  const decl = declBySlug.get(slug) ?? { url: src.url };
740
807
  ensureRepo(decl, slug, this.reposDir, { projectDir: this.projectDir, pin: src.commit });
741
808
  }
742
809
  const resolveCloneDir = (sourceUrl) => {
810
+ if (factoryDir && normalizeRepoUrl(sourceUrl) === factoryUrl) return factoryDir;
743
811
  const slug = sourceCacheKey(sourceUrl);
744
812
  const decl = declBySlug.get(slug) ?? { url: sourceUrl };
745
813
  return this.resolveRepoDir(decl, slug);
@@ -813,12 +881,13 @@ var AssetManager = class {
813
881
  overrides,
814
882
  stores
815
883
  });
816
- if (resolved.length === 0) {
884
+ const lib = this.resolveLibraryEntries(missing);
885
+ if (resolved.length === 0 && lib.entries.length === 0) {
817
886
  throw new Error(
818
887
  `Asset not found: ${ref}${missing.length ? ` (missing: ${missing.join(", ")})` : ""}`
819
888
  );
820
889
  }
821
- const entries = await this.buildCatalogEntries(resolved, repositories);
890
+ const entries = [...await this.buildCatalogEntries(resolved, repositories), ...lib.entries];
822
891
  const deployed = [
823
892
  ...new Set(
824
893
  this.targetBackends().flatMap(
@@ -827,20 +896,22 @@ var AssetManager = class {
827
896
  )
828
897
  ];
829
898
  this.addDependencyToConfig(ref);
830
- const fresh = buildLockFile(resolved, overridesApplied);
831
- const prev = this.tryReadLock();
832
- if (prev) {
833
- const sources = new Map(prev.sources.map((s) => [s.url, s]));
834
- for (const s of fresh.sources) sources.set(s.url, s);
835
- writeLock(this.lockPath, {
836
- ...fresh,
837
- assets: { ...prev.assets, ...fresh.assets },
838
- sources: [...sources.values()].sort((a, b) => a.url.localeCompare(b.url)),
839
- // buildLockFile never emits a plugins slice — preserve the reconciler's.
840
- plugins: prev.plugins
841
- });
842
- } else {
843
- writeLock(this.lockPath, fresh);
899
+ if (resolved.length > 0) {
900
+ const fresh = buildLockFile(resolved, overridesApplied);
901
+ const prev = this.tryReadLock();
902
+ if (prev) {
903
+ const sources = new Map(prev.sources.map((s) => [s.url, s]));
904
+ for (const s of fresh.sources) sources.set(s.url, s);
905
+ writeLock(this.lockPath, {
906
+ ...fresh,
907
+ assets: { ...prev.assets, ...fresh.assets },
908
+ sources: [...sources.values()].sort((a, b) => a.url.localeCompare(b.url)),
909
+ // buildLockFile never emits a plugins slice — preserve the reconciler's.
910
+ plugins: prev.plugins
911
+ });
912
+ } else {
913
+ writeLock(this.lockPath, fresh);
914
+ }
844
915
  }
845
916
  for (const d of deployed) {
846
917
  appendHistory(this.projectDir, {
@@ -1780,5 +1851,5 @@ var AssetManager = class {
1780
1851
  };
1781
1852
 
1782
1853
  export { AssetManager, FACTORY_SOURCE_URL, MissingManifestError, NON_DEPLOYABLE_KINDS, normalizeRepoUrl, parseCanonicalLockKey, parseRefTolerant, softDepName };
1783
- //# sourceMappingURL=chunk-3CHARYD4.js.map
1784
- //# sourceMappingURL=chunk-3CHARYD4.js.map
1854
+ //# sourceMappingURL=chunk-Y3UCU4ZK.js.map
1855
+ //# sourceMappingURL=chunk-Y3UCU4ZK.js.map