@atomic-chat/core 0.17.0 → 0.18.4

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 (189) hide show
  1. package/dist/app-daemon.js +7 -0
  2. package/dist/app-daemon.js.map +1 -1
  3. package/dist/backend/advisor/advisor.d.ts +6 -1
  4. package/dist/backend/advisor/advisor.js +69 -7
  5. package/dist/backend/advisor/advisor.js.map +1 -1
  6. package/dist/backend/catalog/prism-manifest.d.ts +2 -0
  7. package/dist/backend/catalog/prism-manifest.js +3 -2
  8. package/dist/backend/catalog/prism-manifest.js.map +1 -1
  9. package/dist/cli/main.d.ts +1 -1
  10. package/dist/cli/main.js +5 -0
  11. package/dist/cli/main.js.map +1 -1
  12. package/dist/client/control-client.d.ts +10 -1
  13. package/dist/client/control-client.js +15 -0
  14. package/dist/client/control-client.js.map +1 -1
  15. package/dist/cloud/registry.js +1 -0
  16. package/dist/cloud/registry.js.map +1 -1
  17. package/dist/config/paths.d.ts +4 -0
  18. package/dist/config/paths.js +11 -0
  19. package/dist/config/paths.js.map +1 -1
  20. package/dist/contracts/backend-advisor.d.ts +12 -0
  21. package/dist/contracts/engine-builds.d.ts +1 -1
  22. package/dist/contracts/engine-builds.js +1 -1
  23. package/dist/contracts/engine-builds.js.map +1 -1
  24. package/dist/contracts/engines.d.ts +1 -1
  25. package/dist/contracts/engines.js +2 -0
  26. package/dist/contracts/engines.js.map +1 -1
  27. package/dist/contracts/errors.d.ts +13 -2
  28. package/dist/contracts/errors.js.map +1 -1
  29. package/dist/contracts/events.d.ts +7 -0
  30. package/dist/contracts/foundry-local.d.ts +77 -0
  31. package/dist/contracts/foundry-local.js +17 -0
  32. package/dist/contracts/foundry-local.js.map +1 -0
  33. package/dist/contracts/index.d.ts +1 -0
  34. package/dist/contracts/index.js +1 -0
  35. package/dist/contracts/index.js.map +1 -1
  36. package/dist/contracts/model-yml.d.ts +28 -0
  37. package/dist/contracts/model-yml.js +11 -0
  38. package/dist/contracts/model-yml.js.map +1 -1
  39. package/dist/contracts/session.d.ts +5 -1
  40. package/dist/contracts/session.js.map +1 -1
  41. package/dist/contracts/settings.d.ts +5 -1
  42. package/dist/contracts/settings.js.map +1 -1
  43. package/dist/core/atomic-core.d.ts +1 -1
  44. package/dist/core/create.js +106 -5
  45. package/dist/core/create.js.map +1 -1
  46. package/dist/core/types.d.ts +9 -0
  47. package/dist/core/types.js.map +1 -1
  48. package/dist/diffusion/install.d.ts +0 -4
  49. package/dist/diffusion/install.js +5 -2
  50. package/dist/diffusion/install.js.map +1 -1
  51. package/dist/diffusion/server-process.d.ts +5 -2
  52. package/dist/diffusion/server-process.js +10 -2
  53. package/dist/diffusion/server-process.js.map +1 -1
  54. package/dist/downloads/archive.d.ts +1 -1
  55. package/dist/downloads/archive.js +2 -2
  56. package/dist/downloads/archive.js.map +1 -1
  57. package/dist/engine-builds/engines.d.ts +83 -0
  58. package/dist/engine-builds/engines.js +144 -0
  59. package/dist/engine-builds/engines.js.map +1 -0
  60. package/dist/engine-builds/foundry-local.d.ts +22 -0
  61. package/dist/engine-builds/foundry-local.js +100 -0
  62. package/dist/engine-builds/foundry-local.js.map +1 -0
  63. package/dist/engine-builds/manifest.d.ts +57 -6
  64. package/dist/engine-builds/manifest.js +109 -4
  65. package/dist/engine-builds/manifest.js.map +1 -1
  66. package/dist/engine-builds/order.d.ts +2 -1
  67. package/dist/engine-builds/order.js +11 -4
  68. package/dist/engine-builds/order.js.map +1 -1
  69. package/dist/engine-builds/select.d.ts +27 -0
  70. package/dist/engine-builds/select.js +45 -0
  71. package/dist/engine-builds/select.js.map +1 -1
  72. package/dist/engine-builds/service.d.ts +14 -15
  73. package/dist/engine-builds/service.js +68 -126
  74. package/dist/engine-builds/service.js.map +1 -1
  75. package/dist/engines/service.d.ts +6 -3
  76. package/dist/engines/service.js +6 -3
  77. package/dist/engines/service.js.map +1 -1
  78. package/dist/hardware/index.d.ts +1 -0
  79. package/dist/hardware/index.js +1 -0
  80. package/dist/hardware/index.js.map +1 -1
  81. package/dist/hardware/npu.d.ts +14 -0
  82. package/dist/hardware/npu.js +29 -0
  83. package/dist/hardware/npu.js.map +1 -0
  84. package/dist/host/recipes/executor-io-windows.d.ts +11 -0
  85. package/dist/host/recipes/executor-io-windows.js +23 -5
  86. package/dist/host/recipes/executor-io-windows.js.map +1 -1
  87. package/dist/integrations/detect.d.ts +2 -0
  88. package/dist/integrations/detect.js +4 -3
  89. package/dist/integrations/detect.js.map +1 -1
  90. package/dist/lock/instance-lock.js +5 -2
  91. package/dist/lock/instance-lock.js.map +1 -1
  92. package/dist/lock/process-identity.d.ts +9 -3
  93. package/dist/lock/process-identity.js +75 -9
  94. package/dist/lock/process-identity.js.map +1 -1
  95. package/dist/router/resolve.d.ts +2 -2
  96. package/dist/router/resolve.js +2 -1
  97. package/dist/router/resolve.js.map +1 -1
  98. package/dist/runtime/foundry-local/accelerators.d.ts +42 -0
  99. package/dist/runtime/foundry-local/accelerators.js +153 -0
  100. package/dist/runtime/foundry-local/accelerators.js.map +1 -0
  101. package/dist/runtime/foundry-local/check.d.ts +19 -0
  102. package/dist/runtime/foundry-local/check.js +69 -0
  103. package/dist/runtime/foundry-local/check.js.map +1 -0
  104. package/dist/runtime/foundry-local/foundry-host.d.ts +18 -0
  105. package/dist/runtime/foundry-local/foundry-host.js +23 -0
  106. package/dist/runtime/foundry-local/foundry-host.js.map +1 -0
  107. package/dist/runtime/foundry-local/host/args.d.ts +44 -0
  108. package/dist/runtime/foundry-local/host/args.js +109 -0
  109. package/dist/runtime/foundry-local/host/args.js.map +1 -0
  110. package/dist/runtime/foundry-local/host/execution-providers.d.ts +27 -0
  111. package/dist/runtime/foundry-local/host/execution-providers.js +43 -0
  112. package/dist/runtime/foundry-local/host/execution-providers.js.map +1 -0
  113. package/dist/runtime/foundry-local/host/ffi-bun.d.ts +17 -0
  114. package/dist/runtime/foundry-local/host/ffi-bun.js +256 -0
  115. package/dist/runtime/foundry-local/host/ffi-bun.js.map +1 -0
  116. package/dist/runtime/foundry-local/host/library.d.ts +61 -0
  117. package/dist/runtime/foundry-local/host/library.js +17 -0
  118. package/dist/runtime/foundry-local/host/library.js.map +1 -0
  119. package/dist/runtime/foundry-local/host/run.d.ts +54 -0
  120. package/dist/runtime/foundry-local/host/run.js +316 -0
  121. package/dist/runtime/foundry-local/host/run.js.map +1 -0
  122. package/dist/runtime/foundry-local/host-process.d.ts +81 -0
  123. package/dist/runtime/foundry-local/host-process.js +185 -0
  124. package/dist/runtime/foundry-local/host-process.js.map +1 -0
  125. package/dist/runtime/foundry-local/index.d.ts +10 -0
  126. package/dist/runtime/foundry-local/index.js +10 -0
  127. package/dist/runtime/foundry-local/index.js.map +1 -0
  128. package/dist/runtime/foundry-local/model-yml.d.ts +8 -0
  129. package/dist/runtime/foundry-local/model-yml.js +63 -0
  130. package/dist/runtime/foundry-local/model-yml.js.map +1 -0
  131. package/dist/runtime/foundry-local/runtime.d.ts +88 -0
  132. package/dist/runtime/foundry-local/runtime.js +321 -0
  133. package/dist/runtime/foundry-local/runtime.js.map +1 -0
  134. package/dist/runtime/llamacpp/args.d.ts +5 -0
  135. package/dist/runtime/llamacpp/args.js +7 -1
  136. package/dist/runtime/llamacpp/args.js.map +1 -1
  137. package/dist/runtime/llamacpp/errors.d.ts +1 -0
  138. package/dist/runtime/llamacpp/errors.js +10 -0
  139. package/dist/runtime/llamacpp/errors.js.map +1 -1
  140. package/dist/runtime/llamacpp/load-plan.d.ts +5 -0
  141. package/dist/runtime/llamacpp/load-plan.js +8 -0
  142. package/dist/runtime/llamacpp/load-plan.js.map +1 -1
  143. package/dist/runtime/llamacpp/runtime-device.d.ts +8 -0
  144. package/dist/runtime/llamacpp/runtime-device.js +9 -3
  145. package/dist/runtime/llamacpp/runtime-device.js.map +1 -1
  146. package/dist/runtime/llamacpp/runtime.d.ts +6 -1
  147. package/dist/runtime/llamacpp/runtime.js +19 -3
  148. package/dist/runtime/llamacpp/runtime.js.map +1 -1
  149. package/dist/runtime/managed-text/gateway.d.ts +2 -0
  150. package/dist/runtime/managed-text/gateway.js +1 -1
  151. package/dist/runtime/managed-text/gateway.js.map +1 -1
  152. package/dist/runtime/shared/external-sessions.js +1 -0
  153. package/dist/runtime/shared/external-sessions.js.map +1 -1
  154. package/dist/runtime/shared/process.d.ts +13 -1
  155. package/dist/runtime/shared/process.js +21 -12
  156. package/dist/runtime/shared/process.js.map +1 -1
  157. package/dist/server/control/router.js +2 -0
  158. package/dist/server/control/router.js.map +1 -1
  159. package/dist/server/control/routes/foundry-local.d.ts +10 -0
  160. package/dist/server/control/routes/foundry-local.js +42 -0
  161. package/dist/server/control/routes/foundry-local.js.map +1 -0
  162. package/dist/server/control/routes/models.js +6 -3
  163. package/dist/server/control/routes/models.js.map +1 -1
  164. package/dist/server/control/types.d.ts +17 -1
  165. package/dist/server/control/types.js.map +1 -1
  166. package/dist/server/http.js +45 -7
  167. package/dist/server/http.js.map +1 -1
  168. package/dist/server/public/errors.d.ts +1 -0
  169. package/dist/server/public/errors.js +18 -0
  170. package/dist/server/public/errors.js.map +1 -1
  171. package/dist/server/public/listing.js +1 -0
  172. package/dist/server/public/listing.js.map +1 -1
  173. package/dist/settings/public.d.ts +7 -0
  174. package/dist/settings/public.js +8 -0
  175. package/dist/settings/public.js.map +1 -0
  176. package/dist/settings/schema/foundry-local.json +14 -0
  177. package/dist/settings/schema.js +8 -0
  178. package/dist/settings/schema.js.map +1 -1
  179. package/dist/version.d.ts +1 -1
  180. package/dist/version.js +1 -1
  181. package/package.json +11 -3
  182. package/src/settings/schema/atomic-prism.json +0 -433
  183. package/src/settings/schema/foundation-models.json +0 -1
  184. package/src/settings/schema/llamacpp-upstream.json +0 -498
  185. package/src/settings/schema/llamacpp.json +0 -475
  186. package/src/settings/schema/mlx.json +0 -136
  187. package/src/settings/schema/sglang.json +0 -251
  188. package/src/settings/schema/tensorrt-llm.json +0 -253
  189. package/src/settings/schema/vllm.json +0 -273
@@ -2,7 +2,7 @@
2
2
  * Archive extraction and backend-pack layout normalisation. Port of `decompress` and
3
3
  * `normalize_backend_layout` in `src-tauri/src/core/filesystem/commands.rs`.
4
4
  *
5
- * Only `.tar.gz` and `.zip` are supported (same error text as the app). Zip entries are guarded
5
+ * Only `.tar.gz` (also named `.tgz`) and `.zip` are supported (same error text as the app). Zip entries are guarded
6
6
  * against zip-slip, directory entries are created, and the unix mode bits are applied.
7
7
  */
8
8
  import { createWriteStream } from 'node:fs';
@@ -14,7 +14,7 @@ import yauzl from 'yauzl';
14
14
  export const UNSUPPORTED_ARCHIVE_MESSAGE = 'Unsupported file format. Only .tar.gz and .zip are supported.';
15
15
  export async function extractArchive(archivePath, outputDir) {
16
16
  await mkdir(outputDir, { recursive: true });
17
- if (archivePath.endsWith('.tar.gz')) {
17
+ if (archivePath.endsWith('.tar.gz') || archivePath.endsWith('.tgz')) {
18
18
  await tarExtract({ file: archivePath, cwd: outputDir });
19
19
  return;
20
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"archive.js","sourceRoot":"","sources":["../../src/downloads/archive.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAC3C,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAC1E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,CAAC,IAAI,UAAU,EAAE,MAAM,KAAK,CAAA;AACrC,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,MAAM,CAAC,MAAM,2BAA2B,GAAG,+DAA+D,CAAA;AAE1G,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,WAAmB,EAAE,SAAiB;IACzE,MAAM,KAAK,CAAC,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AAI,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAA;QAClD,CAAC;QACD,OAAM;IACR,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,MAAM,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QAC5C,MAAM,CAAC,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;QAC/B,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAC9B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,EACtB,GAAG,EAAE,CAAC,KAAK,CACZ,CAAA;QACD,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;YAAE,SAAQ;QACvF,MAAM,KAAK,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;QAC1C,KAAK,MAAM,KAAK,IAAI,MAAM,OAAO,CAAC,CAAC,CAAC;YAAE,MAAM,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,QAAQ,CAAC,CAAA;QAC/E,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;QAC7C,MAAK;IACP,CAAC;IAED,IAAI,CAAC,CAAC,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,yBAAyB,OAAO,mCAAmC,QAAQ,EAAE,CAAC,CAAA;IAChG,CAAC;AACH,CAAC"}
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Everything that differs between the engines `EngineBuildsService` installs, as one table (openspec
3
+ * change `add-foundry-local`, task 4.1): which release a manifest offers, which build fits this host,
4
+ * which archives make it, how it is probed and recorded, what is on disk and which build is active.
5
+ * The service only orders the steps; a new engine is a new row here, not another branch there.
6
+ */
7
+ import type { EngineBuildId, EngineBuildRef } from '../contracts/index.js';
8
+ import type { HardwareFacts } from '../hardware/index.js';
9
+ import type { BuildArchive } from './install.js';
10
+ import type { ManifestOf } from './manifest.js';
11
+ import type { FoundryLocalHostPlatform } from './select.js';
12
+ /** One build on disk as the service sees it. */
13
+ export interface Build extends EngineBuildRef {
14
+ /** For a bundled MLX build, `resources-dir`; otherwise the build's own directory. */
15
+ dir: string;
16
+ installed_at_ms: number | null;
17
+ published_at: string | null;
18
+ /** Foundry Local: the C API version recorded at install; `null` when unknown. */
19
+ c_api_version?: number | null;
20
+ }
21
+ /** What a row may read from the service's dependencies. */
22
+ export interface EngineContext {
23
+ /** This engine's `<data>/…/backends`. */
24
+ root: string;
25
+ failedBackendsFile: string;
26
+ resourcesDir?: string | undefined;
27
+ platform: NodeJS.Platform;
28
+ hardware: () => Promise<Pick<HardwareFacts, 'osType' | 'arch' | 'cpuExtensions' | 'gpus'>>;
29
+ log?: ((level: 'info' | 'warn', message: string) => void) | undefined;
30
+ /** Which Foundry Local archive this host runs (`foundryLocalHostPlatform`), or why none. */
31
+ foundryLocalHost: FoundryLocalHostPlatform;
32
+ /** `foundry-host probe --lib <dir>` of this core; throws `ENGINE_INSTALL_FAILED` with what it printed. */
33
+ foundryHostProbe?: ((libDir: string) => Promise<void>) | undefined;
34
+ }
35
+ export interface HostChoice {
36
+ /** What this host would install, best first. */
37
+ ladder: string[];
38
+ backend_id: string | null;
39
+ /** Why `backend_id` is `null`. */
40
+ reason: string | null;
41
+ }
42
+ /** An archive of a build; `sha256` and `size` are absent when the manifest does not pin them. */
43
+ export type ArchiveRef = Omit<BuildArchive, 'sha256' | 'size'> & {
44
+ sha256?: string;
45
+ size?: number;
46
+ };
47
+ export interface BuildRecordInfo {
48
+ tag: string;
49
+ backendId: string;
50
+ sha256: string | null;
51
+ installedAtMs: number;
52
+ publishedAt: string | null;
53
+ /** Foundry Local: the release's C API version. */
54
+ cApiVersion: number | null;
55
+ }
56
+ export interface EngineDescriptor<M> {
57
+ /** The release an install takes from the manifest, and the order key it carries. */
58
+ release(manifest: M): {
59
+ tag: string;
60
+ published_at: string | null;
61
+ c_api_version?: number;
62
+ };
63
+ hostChoice(ctx: EngineContext, manifest: M | null): Promise<HostChoice>;
64
+ /** The build's archive first, companions after; all unpack into one directory. */
65
+ archives(manifest: M, backendId: string): ArchiveRef[];
66
+ /** Fix the unpacked tree up before the probe; runs even when a test replaces the probe. */
67
+ prepare?(staging: string, ctx: EngineContext): Promise<void>;
68
+ /** Make the unpacked tree runnable and prove it runs here; throws `ENGINE_INSTALL_FAILED`. */
69
+ probe(staging: string, ctx: EngineContext): Promise<void>;
70
+ /** The ownership marker and `install.json`. */
71
+ record(staging: string, info: BuildRecordInfo): Promise<void>;
72
+ builds(ctx: EngineContext): Promise<Build[]>;
73
+ /** The build the next load uses. */
74
+ active(builds: Build[]): Build | undefined;
75
+ /**
76
+ * Present when a build that fails its probe sends the install down the host's ladder (sd.cpp,
77
+ * design D7 of `move-sdcpp-mlx-install-to-core`): remember the failed rung for this tag.
78
+ */
79
+ rememberFailedRung?(ctx: EngineContext, tag: string, backendId: string): Promise<void>;
80
+ }
81
+ export declare const ENGINE_DESCRIPTORS: {
82
+ [K in EngineBuildId]: EngineDescriptor<ManifestOf[K]>;
83
+ };
@@ -0,0 +1,144 @@
1
+ /**
2
+ * Everything that differs between the engines `EngineBuildsService` installs, as one table (openspec
3
+ * change `add-foundry-local`, task 4.1): which release a manifest offers, which build fits this host,
4
+ * which archives make it, how it is probed and recorded, what is on disk and which build is active.
5
+ * The service only orders the steps; a new engine is a new row here, not another branch there.
6
+ */
7
+ import { AtomicCoreError } from '../contracts/index.js';
8
+ import { listInstalledBackends, prepareSdcppTree, writeInstallRecord } from '../diffusion/install.js';
9
+ import { listDownloadedMlx, probeMlxServer, readBundledMlx, writeMlxInstallRecord } from './builds.js';
10
+ import { listFoundryLocalBuilds, prepareFoundryLocalTree, writeFoundryLocalInstallRecord, } from './foundry-local.js';
11
+ import { FOUNDRY_LOCAL_C_API_VERSIONS, foundryLocalAssetUrl, mlxAssetUrl, sdcppAssetUrl } from './manifest.js';
12
+ import { compareBuilds } from './order.js';
13
+ import { backendKindOf, companionFor, foundryLocalHostChoice, mlxHostChoice, readFailedBackends, rememberFailedBackend, sdcppHostChoice, sdcppHostOf, } from './select.js';
14
+ const pin = (asset) => ({
15
+ ...(asset.sha256 !== undefined ? { sha256: asset.sha256 } : {}),
16
+ ...(asset.size !== undefined ? { size: asset.size } : {}),
17
+ });
18
+ /** The newest of `builds` by the engine's order; the first one wins a tie. */
19
+ function newest(engine, builds) {
20
+ let best;
21
+ for (const build of builds)
22
+ if (!best || compareBuilds(engine, build, best) > 0)
23
+ best = build;
24
+ return best;
25
+ }
26
+ const sdcpp = {
27
+ release: (manifest) => ({ tag: manifest.tag_name, published_at: null }),
28
+ async hostChoice(ctx, manifest) {
29
+ const host = sdcppHostOf(await ctx.hardware());
30
+ if (!manifest)
31
+ return { ladder: [], backend_id: null, reason: 'The sd.cpp manifest is unavailable.' };
32
+ return sdcppHostChoice(host, manifest, await readFailedBackends(ctx.failedBackendsFile));
33
+ },
34
+ archives(manifest, backendId) {
35
+ const ids = [backendId, companionFor(backendId)];
36
+ return ids.flatMap((id) => {
37
+ const asset = manifest.assets.find((candidate) => candidate.backend === id);
38
+ return asset ? [{ ...pin(asset), url: sdcppAssetUrl(manifest, asset), name: asset.name }] : [];
39
+ });
40
+ },
41
+ probe: (staging, ctx) => prepareSdcppTree(staging, { platform: ctx.platform, ...(ctx.log ? { log: ctx.log } : {}) }),
42
+ record: (staging, info) => writeInstallRecord(staging, {
43
+ tag: info.tag,
44
+ backendId: info.backendId,
45
+ backend: backendKindOf(info.backendId),
46
+ engine: 'sd-cpp',
47
+ sha256: info.sha256,
48
+ installedAtMs: info.installedAtMs,
49
+ dir: staging,
50
+ }),
51
+ async builds(ctx) {
52
+ return (await listInstalledBackends(ctx.root, ctx.platform))
53
+ .filter((record) => record.engine === 'sd-cpp')
54
+ .map((record) => ({
55
+ tag: record.tag,
56
+ backend_id: record.backendId,
57
+ origin: 'downloaded',
58
+ dir: record.dir,
59
+ installed_at_ms: record.installedAtMs,
60
+ published_at: null,
61
+ }));
62
+ },
63
+ /** The newest install, which `selectModelInstall` hands the next load. */
64
+ active: (builds) => builds[0],
65
+ rememberFailedRung: (ctx, tag, backendId) => rememberFailedBackend(ctx.failedBackendsFile, tag, backendId),
66
+ };
67
+ const mlx = {
68
+ release: (manifest) => ({ tag: manifest.tag_name, published_at: manifest.published_at }),
69
+ async hostChoice(ctx, manifest) {
70
+ const choice = mlxHostChoice(sdcppHostOf(await ctx.hardware()), manifest);
71
+ return { ...choice, ladder: choice.backend_id ? [choice.backend_id] : [] };
72
+ },
73
+ archives: (manifest, backendId) => manifest.assets
74
+ .filter((asset) => asset.backend === backendId)
75
+ .map((asset) => ({ ...pin(asset), url: mlxAssetUrl(manifest, asset), name: asset.name })),
76
+ probe: (staging, ctx) => probeMlxServer(staging, { platform: ctx.platform }),
77
+ record: (staging, { cApiVersion: _cApiVersion, ...info }) => writeMlxInstallRecord(staging, info),
78
+ async builds(ctx) {
79
+ const out = (await listDownloadedMlx(ctx.root)).map((record) => ({
80
+ tag: record.tag,
81
+ backend_id: record.backendId,
82
+ origin: 'downloaded',
83
+ dir: record.dir,
84
+ installed_at_ms: record.installedAtMs,
85
+ published_at: record.publishedAt,
86
+ }));
87
+ const bundled = await readBundledMlx(ctx.resourcesDir);
88
+ if (bundled)
89
+ out.unshift(bundledMlxBuild(bundled, ctx.resourcesDir));
90
+ return out;
91
+ },
92
+ /** The newest build by `published_at`, the bundled one on a tie (spec "Две точки происхождения mlx-server"). */
93
+ active: (builds) => newest('mlx', builds),
94
+ };
95
+ function bundledMlxBuild(bundled, resourcesDir) {
96
+ return {
97
+ tag: bundled.tag ?? 'bundled',
98
+ backend_id: 'macos-arm64',
99
+ origin: 'bundled',
100
+ dir: resourcesDir,
101
+ installed_at_ms: null,
102
+ published_at: bundled.published_at,
103
+ };
104
+ }
105
+ const foundryLocal = {
106
+ release: (manifest) => {
107
+ const newest = manifest.releases[0];
108
+ return { tag: newest.tag, published_at: newest.published_at, c_api_version: newest.c_api_version };
109
+ },
110
+ hostChoice: async (ctx, manifest) => foundryLocalHostChoice(ctx.foundryLocalHost, manifest?.releases[0] ?? null),
111
+ archives(manifest, backendId) {
112
+ const release = manifest.releases[0];
113
+ const asset = release?.assets.find((candidate) => candidate.platform === backendId);
114
+ return release && asset
115
+ ? [{ ...pin(asset), url: foundryLocalAssetUrl(manifest, release, asset), name: asset.name }]
116
+ : [];
117
+ },
118
+ prepare: (staging, ctx) => prepareFoundryLocalTree(staging, ctx.platform),
119
+ async probe(staging, ctx) {
120
+ if (!ctx.foundryHostProbe)
121
+ throw new AtomicCoreError('ENGINE_INSTALL_FAILED', 'This core has no Foundry Local host to check the build with.');
122
+ await ctx.foundryHostProbe(staging);
123
+ },
124
+ record: (staging, info) => writeFoundryLocalInstallRecord(staging, info),
125
+ async builds(ctx) {
126
+ return (await listFoundryLocalBuilds(ctx.root)).map((record) => ({
127
+ tag: record.tag,
128
+ backend_id: record.backendId,
129
+ origin: 'downloaded',
130
+ dir: record.dir,
131
+ installed_at_ms: record.installedAtMs,
132
+ published_at: record.publishedAt,
133
+ c_api_version: record.cApiVersion,
134
+ }));
135
+ },
136
+ /** The newest by `published_at` among the builds whose C API this core's host binds (design D2). */
137
+ active: (builds) => newest('foundry-local', builds.filter((build) => build.c_api_version != null && FOUNDRY_LOCAL_C_API_VERSIONS.includes(build.c_api_version))),
138
+ };
139
+ export const ENGINE_DESCRIPTORS = {
140
+ 'sd-cpp': sdcpp,
141
+ 'mlx': mlx,
142
+ 'foundry-local': foundryLocal,
143
+ };
144
+ //# sourceMappingURL=engines.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engines.js","sourceRoot":"","sources":["../../src/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UAAU,EAAE,MAAM,CAAC,SAAS;YAC5B,MAAM,EAAE,YAAY;YACpB,GAAG,EAAE,MAAM,CAAC,GAAG;YACf,eAAe,EAAE,MAAM,CAAC,aAAa;YACrC,YAAY,EAAE,MAAM,CAAC,WAAW;YAChC,aAAa,EAAE,MAAM,CAAC,WAAW;SAClC,CAAC,CAAC,CAAA;IACL,CAAC;IACD,oGAAoG;IACpG,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CACjB,MAAM,CACJ,eAAe,EACf,MAAM,CAAC,MAAM,CACX,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,aAAa,IAAI,IAAI,IAAI,4BAA4B,CAAC,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,CACrG,CACF;CACJ,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAA8D;IAC3F,QAAQ,EAAE,KAAK;IACf,KAAK,EAAE,GAAG;IACV,eAAe,EAAE,YAAY;CAC9B,CAAA"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * What is particular to Foundry Local builds (openspec change `add-foundry-local`, design D2): the
3
+ * tree a release archive unpacks to is made runnable before the probe — Microsoft's debug symbols
4
+ * go (`*.pdb` 129 MB, `*.so.dbg` 165 MB, `*.dSYM` 52 MB; integrity was already checked on the
5
+ * archive's sha256) and on Linux the ONNX Runtime soname the library asks for is added — and each
6
+ * build records the C API version it was published with, which decides whether this core can run it.
7
+ */
8
+ /** Debug symbols out; on Linux, `lib/libonnxruntime.so.1` → `libonnxruntime.so` unless it is there. */
9
+ export declare function prepareFoundryLocalTree(staging: string, platform: NodeJS.Platform): Promise<void>;
10
+ export interface FoundryLocalInstallRecord {
11
+ tag: string;
12
+ backendId: string;
13
+ sha256: string | null;
14
+ installedAtMs: number;
15
+ publishedAt: string | null;
16
+ cApiVersion: number | null;
17
+ dir: string;
18
+ }
19
+ /** The marker, then `install.json` without `dir`. */
20
+ export declare function writeFoundryLocalInstallRecord(dir: string, record: Omit<FoundryLocalInstallRecord, 'dir'>): Promise<void>;
21
+ /** Every marked `<root>/<tag>/<platform>/` with a record and its library, newest install first. */
22
+ export declare function listFoundryLocalBuilds(root: string): Promise<FoundryLocalInstallRecord[]>;
@@ -0,0 +1,100 @@
1
+ /**
2
+ * What is particular to Foundry Local builds (openspec change `add-foundry-local`, design D2): the
3
+ * tree a release archive unpacks to is made runnable before the probe — Microsoft's debug symbols
4
+ * go (`*.pdb` 129 MB, `*.so.dbg` 165 MB, `*.dSYM` 52 MB; integrity was already checked on the
5
+ * archive's sha256) and on Linux the ONNX Runtime soname the library asks for is added — and each
6
+ * build records the C API version it was published with, which decides whether this core can run it.
7
+ */
8
+ import { lstat, readdir, readFile, rm, stat, symlink, writeFile } from 'node:fs/promises';
9
+ import { join } from 'node:path';
10
+ import { INSTALL_RECORD, OWNER_MARKER } from '../diffusion/install.js';
11
+ import { isDateTime } from './manifest.js';
12
+ /** Names that are debug symbols only, on any of the three systems. */
13
+ const DEBUG_SYMBOLS_RE = /\.(pdb|so\.dbg|dSYM)$/;
14
+ /** `libfoundry_local.so` needs this name; the archive ships `libonnxruntime.so` alone (spike, ruling S1). */
15
+ const ORT_SONAME = 'libonnxruntime.so.1';
16
+ const ORT_LIBRARY = 'libonnxruntime.so';
17
+ const exists = (path) => stat(path).then(() => true, () => false);
18
+ /** The name itself, a dangling symlink included. */
19
+ const named = (path) => lstat(path).then(() => true, () => false);
20
+ /** Delete debug symbols anywhere under `dir`; a `.dSYM` bundle is a directory. */
21
+ async function removeDebugSymbols(dir) {
22
+ for (const entry of await readdir(dir, { withFileTypes: true })) {
23
+ const path = join(dir, entry.name);
24
+ if (DEBUG_SYMBOLS_RE.test(entry.name))
25
+ await rm(path, { recursive: true, force: true });
26
+ else if (entry.isDirectory())
27
+ await removeDebugSymbols(path);
28
+ }
29
+ }
30
+ /** Debug symbols out; on Linux, `lib/libonnxruntime.so.1` → `libonnxruntime.so` unless it is there. */
31
+ export async function prepareFoundryLocalTree(staging, platform) {
32
+ await removeDebugSymbols(staging);
33
+ if (platform !== 'linux')
34
+ return;
35
+ const lib = join(staging, 'lib');
36
+ if ((await exists(join(lib, ORT_LIBRARY))) && !(await named(join(lib, ORT_SONAME))))
37
+ await symlink(ORT_LIBRARY, join(lib, ORT_SONAME));
38
+ }
39
+ /** The marker, then `install.json` without `dir`. */
40
+ export async function writeFoundryLocalInstallRecord(dir, record) {
41
+ await writeFile(join(dir, OWNER_MARKER), 'atomic-chat\n');
42
+ const file = {
43
+ tag: record.tag,
44
+ backendId: record.backendId,
45
+ sha256: record.sha256,
46
+ installedAtMs: record.installedAtMs,
47
+ publishedAt: record.publishedAt,
48
+ cApiVersion: record.cApiVersion,
49
+ };
50
+ await writeFile(join(dir, INSTALL_RECORD), JSON.stringify(file, null, 2));
51
+ }
52
+ async function readFoundryLocalInstallRecord(dir) {
53
+ let raw;
54
+ try {
55
+ raw = JSON.parse(await readFile(join(dir, INSTALL_RECORD), 'utf8'));
56
+ }
57
+ catch {
58
+ return undefined;
59
+ }
60
+ if (raw === null || typeof raw !== 'object' || Array.isArray(raw))
61
+ return undefined;
62
+ const { tag, backendId, sha256, installedAtMs, publishedAt, cApiVersion } = raw;
63
+ if (typeof tag !== 'string' ||
64
+ typeof backendId !== 'string' ||
65
+ typeof installedAtMs !== 'number' ||
66
+ !Number.isSafeInteger(installedAtMs))
67
+ return undefined;
68
+ return {
69
+ tag,
70
+ backendId,
71
+ sha256: typeof sha256 === 'string' ? sha256 : null,
72
+ installedAtMs,
73
+ publishedAt: isDateTime(publishedAt) ? publishedAt : null,
74
+ cApiVersion: typeof cApiVersion === 'number' && Number.isSafeInteger(cApiVersion) ? cApiVersion : null,
75
+ dir,
76
+ };
77
+ }
78
+ /** The Foundry Local library under `lib/`, by each system's name for it. */
79
+ const LIBRARY_NAMES = ['libfoundry_local.dylib', 'libfoundry_local.so', 'foundry_local.dll'];
80
+ async function hasLibrary(dir) {
81
+ for (const name of LIBRARY_NAMES)
82
+ if (await exists(join(dir, 'lib', name)))
83
+ return true;
84
+ return false;
85
+ }
86
+ /** Every marked `<root>/<tag>/<platform>/` with a record and its library, newest install first. */
87
+ export async function listFoundryLocalBuilds(root) {
88
+ const out = [];
89
+ for (const tag of await readdir(root).catch(() => []))
90
+ for (const backend of await readdir(join(root, tag)).catch(() => [])) {
91
+ const dir = join(root, tag, backend);
92
+ if (!(await exists(join(dir, OWNER_MARKER))))
93
+ continue;
94
+ const record = await readFoundryLocalInstallRecord(dir);
95
+ if (record && (await hasLibrary(dir)))
96
+ out.push(record);
97
+ }
98
+ return out.sort((a, b) => b.installedAtMs - a.installedAtMs);
99
+ }
100
+ //# sourceMappingURL=foundry-local.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"foundry-local.js","sourceRoot":"","sources":["../../src/engine-builds/foundry-local.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACzF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1C,sEAAsE;AACtE,MAAM,gBAAgB,GAAG,uBAAuB,CAAA;AAChD,6GAA6G;AAC7G,MAAM,UAAU,GAAG,qBAAqB,CAAA;AACxC,MAAM,WAAW,GAAG,mBAAmB,CAAA;AAEvC,MAAM,MAAM,GAAG,CAAC,IAAY,EAAoB,EAAE,CAChD,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CACb,GAAG,EAAE,CAAC,IAAI,EACV,GAAG,EAAE,CAAC,KAAK,CACZ,CAAA;AACH,oDAAoD;AACpD,MAAM,KAAK,GAAG,CAAC,IAAY,EAAoB,EAAE,CAC/C,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CACd,G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AAE,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACzD,CAAC;IACH,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,GAAG,CAAC,CAAC,aAAa,CAAC,CAAA;AAC9D,CAAC"}
@@ -1,7 +1,9 @@
1
1
  /**
2
- * The two conf manifests the engine-builds module installs from: `backends/sdcpp-manifest.json`
2
+ * The conf manifests the engine-builds module installs from: `backends/sdcpp-manifest.json`
3
3
  * (stable-diffusion.cpp, which the desktop used to read itself) and `backends/mlx-manifest.json`
4
- * (the mlx-vlm fork's `mlx-server`). Openspec change `move-sdcpp-mlx-install-to-core`, design D6.
4
+ * (the mlx-vlm fork's `mlx-server`), openspec change `move-sdcpp-mlx-install-to-core` design D6;
5
+ * `backends/foundry-local-manifest.json` (Microsoft Foundry Local releases), change
6
+ * `add-foundry-local` design D2.
5
7
  *
6
8
  * The source follows the house pattern of `PrismCatalogService` and `cached-document.ts`: conf main
7
9
  * over `fetch` with an 8 s budget and the request's proxy, an `ATOMIC_*_MANIFEST_URL` override that
@@ -15,9 +17,15 @@
15
17
  * kept — the catalog shows it — but `assetInstallable` says no: nothing unverified is executed.
16
18
  */
17
19
  import type { DataLayout } from '../config/index.js';
18
- import type { ProxyConfig } from '../contracts/index.js';
20
+ import type { EngineBuildId, ProxyConfig } from '../contracts/index.js';
21
+ /**
22
+ * The `FOUNDRY_LOCAL_API_VERSION`s this core's `foundry-host` binds (design D1). A release built
23
+ * against another one is not offered.
24
+ */
25
+ export declare const FOUNDRY_LOCAL_C_API_VERSIONS: readonly number[];
19
26
  export declare const SDCPP_MANIFEST_URL = "https://raw.githubusercontent.com/AtomicBot-ai/atomic-chat-conf/main/backends/sdcpp-manifest.json";
20
27
  export declare const MLX_MANIFEST_URL = "https://raw.githubusercontent.com/AtomicBot-ai/atomic-chat-conf/main/backends/mlx-manifest.json";
28
+ export declare const FOUNDRY_LOCAL_MANIFEST_URL = "https://raw.githubusercontent.com/AtomicBot-ai/atomic-chat-conf/main/backends/foundry-local-manifest.json";
21
29
  export declare const ENGINE_MANIFEST_TIMEOUT_MS = 8000;
22
30
  /** A fetched manifest is reused for this long unless the caller forces a re-read. */
23
31
  export declare const ENGINE_MANIFEST_TTL_MS: number;
@@ -52,12 +60,49 @@ export interface MlxManifest {
52
60
  published_at: string;
53
61
  assets: MlxAsset[];
54
62
  }
63
+ export declare const FOUNDRY_LOCAL_PLATFORMS: readonly ["win-x64", "win-arm64", "macos-arm64", "linux-x64", "linux-arm64"];
64
+ export type FoundryLocalPlatform = (typeof FOUNDRY_LOCAL_PLATFORMS)[number];
65
+ export interface FoundryLocalAsset {
66
+ platform: FoundryLocalPlatform;
67
+ name: string;
68
+ size: number;
69
+ sha256: string;
70
+ }
71
+ export interface FoundryLocalRelease {
72
+ /** The `microsoft/foundry-local` release tag, `v<major>.<minor>.<patch>`. */
73
+ tag: string;
74
+ /** The order builds of this engine have. */
75
+ published_at: string;
76
+ min_core_version: string;
77
+ /** `FOUNDRY_LOCAL_API_VERSION` of the release's `foundry_local_c.h`. */
78
+ c_api_version: number;
79
+ notes_url?: string;
80
+ assets: FoundryLocalAsset[];
81
+ }
82
+ /** The releases this core can install, newest first; never empty. */
83
+ export interface FoundryLocalManifest {
84
+ upstream_repo: string;
85
+ releases: FoundryLocalRelease[];
86
+ }
87
+ /** What decides which releases a core accepts. */
88
+ export interface FoundryLocalAcceptance {
89
+ coreVersion: string;
90
+ /** The C API versions this core's `foundry-host` speaks. */
91
+ cApiVersions: readonly number[];
92
+ }
55
93
  /** A conf date-time this core can order by: RFC 3339 shape and a real calendar date. */
56
94
  export declare function isDateTime(value: unknown): value is string;
57
95
  /** `backends/sdcpp-manifest.json`, or throw why it is not one. */
58
96
  export declare function parseSdcppManifest(data: unknown): SdcppManifest;
59
97
  /** `backends/mlx-manifest.json`, or throw why it is not one. */
60
98
  export declare function parseMlxManifest(data: unknown): MlxManifest;
99
+ /**
100
+ * `backends/foundry-local-manifest.json`: strict per field, lenient per record — a release or asset
101
+ * that does not parse is skipped, as is a release for a newer core or a C API `accept` does not
102
+ * speak (spec `foundry-local-runtime`, "Релизы рантайма публикуются в conf"). Throws for another
103
+ * schema version, a document without a valid repository, or no release left to install.
104
+ */
105
+ export declare function parseFoundryLocalManifest(data: unknown, accept: FoundryLocalAcceptance): FoundryLocalManifest;
61
106
  /** An asset core may download and run: pinned by both `sha256` and `size`. */
62
107
  export declare function assetInstallable(asset: {
63
108
  sha256?: string;
@@ -66,7 +111,8 @@ export declare function assetInstallable(asset: {
66
111
  /** The mirror when the manifest names one, else the upstream release (which never carries `-a<sha>`). */
67
112
  export declare function sdcppAssetUrl(manifest: SdcppManifest, asset: SdcppAsset): string;
68
113
  export declare function mlxAssetUrl(manifest: MlxManifest, asset: MlxAsset): string;
69
- /** Which manifest: everything that differs between the two engines. */
114
+ export declare function foundryLocalAssetUrl(manifest: FoundryLocalManifest, release: FoundryLocalRelease, asset: FoundryLocalAsset): string;
115
+ /** Which manifest: everything that differs between the engines. */
70
116
  export interface ManifestKind<T> {
71
117
  label: string;
72
118
  url: string;
@@ -74,9 +120,14 @@ export interface ManifestKind<T> {
74
120
  parse(data: unknown): T;
75
121
  cacheFile: string;
76
122
  }
123
+ /** The manifest document of each engine. */
124
+ export interface ManifestOf {
125
+ 'sd-cpp': SdcppManifest;
126
+ 'mlx': MlxManifest;
127
+ 'foundry-local': FoundryLocalManifest;
128
+ }
77
129
  export declare function manifestKinds(layout: DataLayout): {
78
- 'sd-cpp': ManifestKind<SdcppManifest>;
79
- 'mlx': ManifestKind<MlxManifest>;
130
+ [K in EngineBuildId]: ManifestKind<ManifestOf[K]>;
80
131
  };
81
132
  /** What a read found. `source` is `null` exactly when `manifest` is. */
82
133
  export interface ManifestRead<T> {