@koed-labs/server 0.10.3 → 1.0.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.
- package/README.md +3 -3
- package/bin/koed.js +1 -1
- package/package.json +2 -2
- package/vendor/chunk-273NMYXE.js +605 -0
- package/vendor/{chunk-VPC5NLZG.js → chunk-4DHYSJJT.js} +1 -1
- package/vendor/{chunk-HK2H3MVE.js → chunk-53ZFCDHP.js} +4 -0
- package/vendor/{chunk-YCDEMYY6.js → chunk-54UL4U2E.js} +261 -110
- package/vendor/{chunk-X6M525ZJ.js → chunk-64AST7WZ.js} +5 -5
- package/vendor/{chunk-JKOG52PE.js → chunk-7FSHVVTZ.js} +1 -1
- package/vendor/chunk-7HLNJ2BI.js +1669 -0
- package/vendor/chunk-ALJUSOF7.js +175 -0
- package/vendor/{chunk-A6WMU2GG.js → chunk-AOZ3LMTF.js} +5 -4
- package/vendor/{chunk-KUIWH33N.js → chunk-AVQCUFYQ.js} +1 -1
- package/vendor/{chunk-JJNLH5GA.js → chunk-BYN6KXNP.js} +21 -19
- package/vendor/{chunk-PY5LYLV7.js → chunk-DWWMBGHX.js} +26 -21
- package/vendor/chunk-E6YVGIEW.js +12518 -0
- package/vendor/{chunk-C3N4N5HR.js → chunk-EEBIYWTE.js} +26 -21
- package/vendor/{chunk-YOFI4PCH.js → chunk-F77ZTTNS.js} +7 -1
- package/vendor/{chunk-RVYJKKWA.js → chunk-F7AMEDDU.js} +5 -4
- package/vendor/{chunk-473OA62O.js → chunk-FSNLU46W.js} +218 -12497
- package/vendor/{chunk-2S3OGPUC.js → chunk-GY5GATZL.js} +2 -2
- package/vendor/chunk-ILQVLZ2I.js +50 -0
- package/vendor/{chunk-QIIKMG3M.js → chunk-IY2HRXOZ.js} +1 -5
- package/vendor/{chunk-ZUGNCQZE.js → chunk-JYK6UL6D.js} +22 -8
- package/vendor/chunk-KG3RANR4.js +75 -0
- package/vendor/{chunk-YJ6XUZT6.js → chunk-KRBZZ6GS.js} +23 -16
- package/vendor/{chunk-AFLKCQHF.js → chunk-L4RD3TAZ.js} +2 -2
- package/vendor/{chunk-XNFVSVBS.js → chunk-LHUMBHG7.js} +1 -1
- package/vendor/{chunk-J2L726BC.js → chunk-NGV45YWB.js} +3 -3
- package/vendor/{chunk-A4NKL2PK.js → chunk-OG7G6DIR.js} +1 -1
- package/vendor/{chunk-DXTAWHY3.js → chunk-OZU6JFB4.js} +8 -7
- package/vendor/chunk-QV3WPU7A.js +8 -0
- package/vendor/{chunk-ZXX4ZNJY.js → chunk-S6HD3MDU.js} +3 -2
- package/vendor/{chunk-NEWIOOM6.js → chunk-SQZ2OSP6.js} +3 -2
- package/vendor/{chunk-G4IIVVJO.js → chunk-T6UB5PNX.js} +70 -2
- package/vendor/{chunk-SKVYP7NY.js → chunk-T7OGE5E5.js} +8 -8
- package/vendor/{chunk-GELDEJJ2.js → chunk-TIBYKMRW.js} +173 -51
- package/vendor/{chunk-HFM6ROJL.js → chunk-TISYUUEJ.js} +1 -1
- package/vendor/{chunk-K2EIFEQF.js → chunk-TSAYTRX3.js} +1 -1
- package/vendor/{chunk-PT3AUPGE.js → chunk-UB6JCVQ3.js} +3 -1
- package/vendor/{chunk-NM5NXCVM.js → chunk-UCOHFZ77.js} +626 -996
- package/vendor/{chunk-2BWTLF7A.js → chunk-UIMUUIH7.js} +45 -21
- package/vendor/{chunk-HZJK5RWC.js → chunk-USHFSJT7.js} +695 -280
- package/vendor/chunk-VGL5AZN5.js +152 -0
- package/vendor/{chunk-TSRPHKAC.js → chunk-VLP72QWX.js} +16 -42
- package/vendor/chunk-W6632NOX.js +14 -0
- package/vendor/{chunk-YJWREXN6.js → chunk-WBMO7YCO.js} +1 -1
- package/vendor/chunk-XCO3RV3Z.js +11 -0
- package/vendor/chunk-XKXSC6YS.js +373 -0
- package/vendor/{chunk-YK4F4VY2.js → chunk-Y6GE52OP.js} +51 -30
- package/vendor/{chunk-UI5RLBKQ.js → chunk-YZLQZU5E.js} +17 -1
- package/vendor/chunk-ZKKWLLPU.js +18 -0
- package/vendor/cli.js +1 -1
- package/vendor/component-manifest-catalog.js +2 -1
- package/vendor/control-plane.js +11 -6
- package/vendor/chunk-2DA7EFZV.js +0 -924
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Looking for the desktop client? Visit the [Koed GitHub repository](https://githu
|
|
|
9
9
|
For a local Personal setup, install Node.js 24 and Homebrew first. Then install the Koed command-line tool:
|
|
10
10
|
|
|
11
11
|
```sh
|
|
12
|
-
npm install --global @koed-labs/server@0.
|
|
12
|
+
npm install --global @koed-labs/server@1.0.0
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## 2. Set up your services
|
|
@@ -19,13 +19,13 @@ Install the Base component for your platform using the matching release URLs:
|
|
|
19
19
|
**linux-x64**
|
|
20
20
|
|
|
21
21
|
```sh
|
|
22
|
-
koed components install --component base --archive-url https://github.com/koed-labs/koed/releases/download/
|
|
22
|
+
koed components install --component base --archive-url https://github.com/koed-labs/koed/releases/download/v1.0.0/koed-base-1.0.0-linux-x64.tar.gz --manifest-url https://github.com/koed-labs/koed/releases/download/v1.0.0/koed-base-1.0.0-linux-x64.tar.gz.manifest.json --json
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
**macos-arm64**
|
|
26
26
|
|
|
27
27
|
```sh
|
|
28
|
-
koed components install --component base --archive-url https://github.com/koed-labs/koed/releases/download/
|
|
28
|
+
koed components install --component base --archive-url https://github.com/koed-labs/koed/releases/download/v1.0.0/koed-base-1.0.0-macos-arm64.tar.gz --manifest-url https://github.com/koed-labs/koed/releases/download/v1.0.0/koed-base-1.0.0-macos-arm64.tar.gz.manifest.json --json
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
Then install the runtime and embedding model:
|
package/bin/koed.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
if (Number(process.versions.node.split(".")[0])
|
|
2
|
+
if (Number(process.versions.node.split(".")[0]) < 24 || Number(process.versions.node.split(".")[0]) >= 27) { console.error(`@koed-labs/server requires Node.js >=24 <27; found ${process.versions.node}.`); process.exit(1); }
|
|
3
3
|
const { runKoedServerCli, shouldExitPackagedSupervisor } = await import("../vendor/control-plane.js");
|
|
4
4
|
const args = process.argv.slice(2);
|
|
5
5
|
const exitCode = await runKoedServerCli(args);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koed-labs/server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Koed Self-Hosted control plane",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"koed": "bin/koed.js"
|
|
14
14
|
},
|
|
15
15
|
"engines": {
|
|
16
|
-
"node": ">=24 <
|
|
16
|
+
"node": ">=24 <27"
|
|
17
17
|
},
|
|
18
18
|
"publishConfig": {
|
|
19
19
|
"access": "public"
|
|
@@ -0,0 +1,605 @@
|
|
|
1
|
+
import { createRequire as createKoedRequire } from "node:module"; const require = createKoedRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
checkCudaHost,
|
|
4
|
+
nativeCommand,
|
|
5
|
+
validateStagedCuda
|
|
6
|
+
} from "./chunk-XKXSC6YS.js";
|
|
7
|
+
import "./chunk-JYK6UL6D.js";
|
|
8
|
+
import {
|
|
9
|
+
resolveKoedServerConfig
|
|
10
|
+
} from "./chunk-ALJUSOF7.js";
|
|
11
|
+
import {
|
|
12
|
+
resolveKoedRuntimeOwner
|
|
13
|
+
} from "./chunk-OG7G6DIR.js";
|
|
14
|
+
import {
|
|
15
|
+
assertDirectoryChain,
|
|
16
|
+
fetchBounded,
|
|
17
|
+
renameAtomically,
|
|
18
|
+
resolveDesktopRuntimeOwner,
|
|
19
|
+
withStoppedRuntime
|
|
20
|
+
} from "./chunk-UCOHFZ77.js";
|
|
21
|
+
import "./chunk-T6UB5PNX.js";
|
|
22
|
+
import "./chunk-7NXKPDF3.js";
|
|
23
|
+
import "./chunk-XCO3RV3Z.js";
|
|
24
|
+
import {
|
|
25
|
+
canonicalArtifactJson,
|
|
26
|
+
extractNativeArchive,
|
|
27
|
+
nativeDigest,
|
|
28
|
+
nativeFileDigest,
|
|
29
|
+
nativeJsonObject,
|
|
30
|
+
readNativeMetadata,
|
|
31
|
+
syncNativeDirectory,
|
|
32
|
+
verifyNativePayload
|
|
33
|
+
} from "./chunk-7HLNJ2BI.js";
|
|
34
|
+
import {
|
|
35
|
+
compareNativeVersions,
|
|
36
|
+
compatibleCuda,
|
|
37
|
+
getNativeRuntimeCatalog,
|
|
38
|
+
nativeKind,
|
|
39
|
+
selectNativeRuntimeCatalog,
|
|
40
|
+
validateNativeRuntimeCatalog
|
|
41
|
+
} from "./chunk-VGL5AZN5.js";
|
|
42
|
+
import "./chunk-QV3WPU7A.js";
|
|
43
|
+
import "./chunk-IY2HRXOZ.js";
|
|
44
|
+
import "./chunk-FSNLU46W.js";
|
|
45
|
+
import "./chunk-BTS4ZTF3.js";
|
|
46
|
+
|
|
47
|
+
// packages/koed-server/dist/runtime-release.js
|
|
48
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
49
|
+
import { mkdirSync as mkdirSync2, mkdtempSync, renameSync as renameSync2, rmSync as rmSync2, statfsSync, writeFileSync as writeFileSync2, lstatSync as lstatSync2, readlinkSync as readlinkSync2 } from "node:fs";
|
|
50
|
+
import { dirname as dirname2, resolve as resolve3 } from "node:path";
|
|
51
|
+
import { release as kernelRelease } from "node:os";
|
|
52
|
+
|
|
53
|
+
// packages/koed-server/dist/native-selection.js
|
|
54
|
+
import { lstatSync, mkdirSync, readlinkSync, readdirSync, rmSync, renameSync, symlinkSync, writeFileSync } from "node:fs";
|
|
55
|
+
import { dirname, relative, resolve } from "node:path";
|
|
56
|
+
import { randomUUID } from "node:crypto";
|
|
57
|
+
var releaseInstallCommand = "koed runtime install --provider release --dependency-mode bundled-local";
|
|
58
|
+
var nativeStore = (paths) => resolve(paths.koedHome, "runtime/native");
|
|
59
|
+
var nativePathExists = (path) => lstatSync(path, { throwIfNoEntry: false }) !== void 0;
|
|
60
|
+
var payloadRoot = (paths, pin) => resolve(nativeStore(paths), nativeKind(pin), pin.recipeId);
|
|
61
|
+
var coreLinks = (pin) => [
|
|
62
|
+
"postgres",
|
|
63
|
+
`llama.cpp/${pin.target.platform === "macos" ? "metal" : "cpu"}`,
|
|
64
|
+
"llama.cpp/llama-server"
|
|
65
|
+
];
|
|
66
|
+
var entryNames = ["postgres", "llama.cpp"];
|
|
67
|
+
var document = (pin, cuda) => ({
|
|
68
|
+
schemaVersion: 1,
|
|
69
|
+
core: pin,
|
|
70
|
+
cuda
|
|
71
|
+
});
|
|
72
|
+
function conflictsWithPin(installed, current) {
|
|
73
|
+
return current?.recipeId === installed.recipeId && canonicalArtifactJson({ ...installed, url: current.url }) !== canonicalArtifactJson(current);
|
|
74
|
+
}
|
|
75
|
+
function checkLink(path, target) {
|
|
76
|
+
if (!lstatSync(path).isSymbolicLink() || readlinkSync(path) !== target)
|
|
77
|
+
throw new Error(`Unexpected native runtime link: ${path}`);
|
|
78
|
+
}
|
|
79
|
+
function checkEntryPaths(paths, requireLinks) {
|
|
80
|
+
const runtime = dirname(nativeStore(paths));
|
|
81
|
+
assertDirectoryChain(paths.koedHome, runtime);
|
|
82
|
+
assertDirectoryChain(paths.koedHome, paths.cacheDir);
|
|
83
|
+
const store = nativeStore(paths);
|
|
84
|
+
if (nativePathExists(store) && readdirSync(store).some((name) => !["core", "selections", "cuda", "current"].includes(name) && !/^\.stage-[A-Za-z0-9]{6}$/.test(name) && !/^\.current-[a-f0-9-]{36}$/.test(name)))
|
|
85
|
+
throw new Error("Unrecognized native store contents. Inspect the existing runtime or use a fresh KOED_HOME.");
|
|
86
|
+
for (const name of ["runtime-homebrew.json", "runtime-packaged.json"]) {
|
|
87
|
+
if (nativePathExists(resolve(paths.cacheDir, name)))
|
|
88
|
+
throw new Error("An existing native provider owns this installation. Keep using that provider or use a fresh KOED_HOME.");
|
|
89
|
+
}
|
|
90
|
+
for (const name of entryNames) {
|
|
91
|
+
const path = resolve(runtime, name);
|
|
92
|
+
if (!requireLinks && !nativePathExists(path))
|
|
93
|
+
continue;
|
|
94
|
+
if (!lstatSync(path).isSymbolicLink() || readlinkSync(path) !== `native/current/${name}`)
|
|
95
|
+
throw new Error(`Unrecognized native entry ${path}. Keep using its current provider or choose a fresh KOED_HOME.`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function currentNativeId(paths) {
|
|
99
|
+
const store = nativeStore(paths), pointer = resolve(store, "current");
|
|
100
|
+
assertDirectoryChain(paths.koedHome, store);
|
|
101
|
+
if (!nativePathExists(pointer))
|
|
102
|
+
return null;
|
|
103
|
+
const match = /^selections\/([a-f0-9]{64})$/.exec(readlinkSync(pointer));
|
|
104
|
+
if (!match)
|
|
105
|
+
throw new Error("Invalid native selection pointer.");
|
|
106
|
+
return match[1];
|
|
107
|
+
}
|
|
108
|
+
function loadSelection(paths, id, catalog) {
|
|
109
|
+
const root = resolve(nativeStore(paths), "selections", id);
|
|
110
|
+
assertDirectoryChain(paths.koedHome, resolve(root, "llama.cpp"));
|
|
111
|
+
for (const path of [
|
|
112
|
+
nativeStore(paths),
|
|
113
|
+
dirname(root),
|
|
114
|
+
root,
|
|
115
|
+
resolve(root, "selection.json")
|
|
116
|
+
]) {
|
|
117
|
+
const stat = lstatSync(path);
|
|
118
|
+
if (stat.uid !== process.getuid?.() || (stat.mode & 18) !== 0)
|
|
119
|
+
throw new Error("Native selection ownership or permissions changed.");
|
|
120
|
+
}
|
|
121
|
+
const raw = readNativeMetadata(resolve(root, "selection.json"), 16 * 1024);
|
|
122
|
+
if (nativeDigest(raw) !== id)
|
|
123
|
+
throw new Error("Native selection metadata changed.");
|
|
124
|
+
const record = nativeJsonObject(raw);
|
|
125
|
+
const core = record.core;
|
|
126
|
+
if (typeof core === "object" && core !== null && "target" in core && typeof core.target === "object" && core.target !== null && "platform" in core.target && (core.target.platform === "linux" || core.target.platform === "macos") && core.target.platform !== catalog.core.target.platform)
|
|
127
|
+
throw new NativeSelectionTargetError();
|
|
128
|
+
const receipt = {
|
|
129
|
+
schemaVersion: 1,
|
|
130
|
+
minimumCoreVersion: "0.0.0",
|
|
131
|
+
core: record.core,
|
|
132
|
+
cuda: record.cuda
|
|
133
|
+
};
|
|
134
|
+
let pin, cuda;
|
|
135
|
+
try {
|
|
136
|
+
({ core: pin, cuda } = catalog.core.target.platform === "linux" ? validateNativeRuntimeCatalog(receipt) : selectNativeRuntimeCatalog({ schemaVersion: 2, linux: null, macos: receipt }, "darwin", "arm64"));
|
|
137
|
+
} catch (cause) {
|
|
138
|
+
throw new Error("Native selection target or receipt is incompatible with the reviewed host catalog.", { cause });
|
|
139
|
+
}
|
|
140
|
+
if (canonicalArtifactJson(document(pin, cuda)) !== raw.toString("utf8") || cuda && conflictsWithPin(cuda, catalog.cuda) || conflictsWithPin(pin, catalog.core))
|
|
141
|
+
throw new Error("Native selection conflicts with the reviewed identity.");
|
|
142
|
+
if (canonicalArtifactJson(readdirSync(root).sort()) !== canonicalArtifactJson(["llama.cpp", "postgres", "selection.json"]) || canonicalArtifactJson(readdirSync(resolve(root, "llama.cpp")).sort()) !== canonicalArtifactJson(pin.target.platform === "macos" ? ["llama-server", "metal"] : cuda ? ["cpu", "cuda", "llama-server"] : ["cpu", "llama-server"]))
|
|
143
|
+
throw new Error("Unexpected native selection contents.");
|
|
144
|
+
const payload = payloadRoot(paths, pin);
|
|
145
|
+
assertDirectoryChain(paths.koedHome, payload);
|
|
146
|
+
for (const name of coreLinks(pin)) {
|
|
147
|
+
const path = resolve(root, name);
|
|
148
|
+
checkLink(path, relative(dirname(path), resolve(payload, name)));
|
|
149
|
+
}
|
|
150
|
+
verifyNativePayload(payload, pin);
|
|
151
|
+
if (cuda) {
|
|
152
|
+
const cudaRoot = payloadRoot(paths, cuda), name = "llama.cpp/cuda";
|
|
153
|
+
assertDirectoryChain(paths.koedHome, cudaRoot);
|
|
154
|
+
checkLink(resolve(root, name), relative(resolve(root, "llama.cpp"), resolve(cudaRoot, name)));
|
|
155
|
+
verifyNativePayload(cudaRoot, cuda);
|
|
156
|
+
}
|
|
157
|
+
return { id, root, pin, cuda };
|
|
158
|
+
}
|
|
159
|
+
var NativeSelectionTargetError = class extends Error {
|
|
160
|
+
constructor() {
|
|
161
|
+
super("Native selection target differs from this host. Stop Koed, preserve the existing native store, and use a fresh KOED_HOME before installing the runtime. The new KOED_HOME does not include the existing database or other data.");
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
function readNativeSelection(paths, catalog) {
|
|
165
|
+
const id = currentNativeId(paths);
|
|
166
|
+
checkEntryPaths(paths, id !== null);
|
|
167
|
+
if (!id)
|
|
168
|
+
return null;
|
|
169
|
+
try {
|
|
170
|
+
return loadSelection(paths, id, catalog);
|
|
171
|
+
} catch (cause) {
|
|
172
|
+
if (cause instanceof NativeSelectionTargetError)
|
|
173
|
+
throw cause;
|
|
174
|
+
const detail = (cause instanceof Error ? cause.message : String(cause)).replace(/\.$/, "");
|
|
175
|
+
throw new Error(`Cannot admit the installed native selection: ${detail}. Stop Koed, preserve the damaged native store for recovery, then run ${releaseInstallCommand}.`, { cause });
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
function coreStartBlocker(pin, catalog) {
|
|
179
|
+
if (compareNativeVersions(pin.runtimeVersion, catalog.minimumCoreVersion) < 0)
|
|
180
|
+
return `Native core ${pin.runtimeVersion} is below the required ${catalog.minimumCoreVersion}`;
|
|
181
|
+
if (canonicalArtifactJson(pin.contracts) !== canonicalArtifactJson(catalog.core.contracts))
|
|
182
|
+
return `Native core ${pin.runtimeVersion} implements contracts ${canonicalArtifactJson(pin.contracts)}, but this Control Plane requires ${canonicalArtifactJson(catalog.core.contracts)}`;
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
function assertStartableCore(pin, catalog) {
|
|
186
|
+
const blocker = coreStartBlocker(pin, catalog);
|
|
187
|
+
if (blocker)
|
|
188
|
+
throw new Error(`${blocker}. Stop Koed and run ${releaseInstallCommand}.`);
|
|
189
|
+
}
|
|
190
|
+
function composeNativeSelection(paths, pin, staging, catalog, cuda = null) {
|
|
191
|
+
const bytes = canonicalArtifactJson(document(pin, cuda)), id = nativeDigest(bytes);
|
|
192
|
+
const root = resolve(nativeStore(paths), "selections", id);
|
|
193
|
+
assertDirectoryChain(paths.koedHome, root);
|
|
194
|
+
if (!nativePathExists(root)) {
|
|
195
|
+
const fresh = resolve(staging, "selection");
|
|
196
|
+
mkdirSync(resolve(fresh, "llama.cpp"), { recursive: true, mode: 448 });
|
|
197
|
+
writeFileSync(resolve(fresh, "selection.json"), bytes, {
|
|
198
|
+
flag: "wx",
|
|
199
|
+
mode: 384,
|
|
200
|
+
flush: true
|
|
201
|
+
});
|
|
202
|
+
for (const name of coreLinks(pin)) {
|
|
203
|
+
const target = relative(dirname(resolve(root, name)), resolve(payloadRoot(paths, pin), name));
|
|
204
|
+
symlinkSync(target, resolve(fresh, name));
|
|
205
|
+
}
|
|
206
|
+
if (cuda) {
|
|
207
|
+
const name = "llama.cpp/cuda";
|
|
208
|
+
symlinkSync(relative(resolve(root, "llama.cpp"), resolve(payloadRoot(paths, cuda), name)), resolve(fresh, name));
|
|
209
|
+
}
|
|
210
|
+
syncNativeDirectory(resolve(fresh, "llama.cpp"));
|
|
211
|
+
syncNativeDirectory(fresh);
|
|
212
|
+
renameSync(fresh, root);
|
|
213
|
+
syncNativeDirectory(dirname(root));
|
|
214
|
+
}
|
|
215
|
+
return loadSelection(paths, id, catalog);
|
|
216
|
+
}
|
|
217
|
+
function activateNativeSelection(paths, id) {
|
|
218
|
+
const store = nativeStore(paths), runtime = dirname(store);
|
|
219
|
+
for (const name of entryNames) {
|
|
220
|
+
const path = resolve(runtime, name), target = `native/current/${name}`;
|
|
221
|
+
if (nativePathExists(path))
|
|
222
|
+
checkLink(path, target);
|
|
223
|
+
else
|
|
224
|
+
symlinkSync(target, path);
|
|
225
|
+
}
|
|
226
|
+
syncNativeDirectory(runtime);
|
|
227
|
+
syncNativeDirectory(paths.koedHome);
|
|
228
|
+
const tmp = resolve(store, `.current-${randomUUID()}`);
|
|
229
|
+
symlinkSync(`selections/${id}`, tmp);
|
|
230
|
+
try {
|
|
231
|
+
renameAtomically(tmp, resolve(store, "current"));
|
|
232
|
+
syncNativeDirectory(store);
|
|
233
|
+
} finally {
|
|
234
|
+
rmSync(tmp, { force: true });
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// packages/koed-server/dist/runtime-release-assets.js
|
|
239
|
+
import { resolve as resolve2 } from "node:path";
|
|
240
|
+
function embeddingPolicy(paths, environment) {
|
|
241
|
+
const policy = environment.KOED_EMBEDDING_ACCELERATION?.trim().toLowerCase() || resolveKoedServerConfig(paths, environment).hardwareAcceleration;
|
|
242
|
+
if (!["auto", "cpu", "cuda", "metal"].includes(policy))
|
|
243
|
+
throw new Error("KOED_EMBEDDING_ACCELERATION must be auto, cpu, metal, or cuda.");
|
|
244
|
+
return policy;
|
|
245
|
+
}
|
|
246
|
+
function chooseCuda(catalog, installed, choice, policy) {
|
|
247
|
+
if (choice === "with") {
|
|
248
|
+
if (!catalog.cuda)
|
|
249
|
+
throw new Error("This release has no reviewed CUDA add-on pin. Use a trusted release with a qualified CUDA add-on.");
|
|
250
|
+
return catalog.cuda;
|
|
251
|
+
}
|
|
252
|
+
if (choice === "without") {
|
|
253
|
+
if (policy !== "auto" && policy !== "cpu")
|
|
254
|
+
throw new Error("Select auto or cpu embedding acceleration before removing the CUDA add-on.");
|
|
255
|
+
return null;
|
|
256
|
+
}
|
|
257
|
+
if (!installed || compatibleCuda(catalog.core, installed))
|
|
258
|
+
return installed;
|
|
259
|
+
if (policy !== "cpu" && policy !== "auto")
|
|
260
|
+
throw new Error(`This core update would remove the selected CUDA add-on under forced ${policy} policy. Stop Koed and run ${releaseInstallCommand} --with-cuda.`);
|
|
261
|
+
return null;
|
|
262
|
+
}
|
|
263
|
+
function preservedCudaFailure(error, choice, policy) {
|
|
264
|
+
if (choice === "preserve" && (policy === "auto" || policy === "cpu") && error instanceof Error)
|
|
265
|
+
error.message += ` The installed CUDA add-on is kept by default. To update the CPU core without it, run ${releaseInstallCommand} --without-cuda.`;
|
|
266
|
+
return error;
|
|
267
|
+
}
|
|
268
|
+
async function stageNativeAsset(pin, staging, signal, progress) {
|
|
269
|
+
const kind = nativeKind(pin), archive = resolve2(staging, kind + ".tar.gz"), unpack = resolve2(staging, kind);
|
|
270
|
+
try {
|
|
271
|
+
await fetchBounded(pin.url, archive, pin.archiveBytes, signal, progress, false);
|
|
272
|
+
if (nativeFileDigest(archive, pin.archiveBytes) !== pin.sha256)
|
|
273
|
+
throw new Error("Native archive digest mismatch.");
|
|
274
|
+
} catch (cause) {
|
|
275
|
+
throw new Error(`Could not acquire the pinned native ${kind}: ${cause instanceof Error ? cause.message : String(cause)}. Check connectivity and free space, then retry ${releaseInstallCommand}${kind === "cuda" ? " --with-cuda" : ""}.`, { cause });
|
|
276
|
+
}
|
|
277
|
+
await extractNativeArchive(kind, archive, unpack, pin.expandedBytes, signal, pin.target.platform);
|
|
278
|
+
const root = resolve2(unpack, "koed-runtime");
|
|
279
|
+
verifyNativePayload(root, pin, true);
|
|
280
|
+
return root;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// packages/koed-server/dist/runtime-release.js
|
|
284
|
+
var reserve = 128 * 1024 * 1024;
|
|
285
|
+
var MacCudaPolicyError = class extends Error {
|
|
286
|
+
constructor() {
|
|
287
|
+
super("CUDA is not supported by the macOS release runtime. Set KOED_EMBEDDING_ACCELERATION to auto or metal before installing or starting.");
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
function assertMacPolicy(platform, policy) {
|
|
291
|
+
if (platform === "macos" && policy === "cuda")
|
|
292
|
+
throw new MacCudaPolicyError();
|
|
293
|
+
}
|
|
294
|
+
function assertReleaseHost(host = {
|
|
295
|
+
platform: process.platform,
|
|
296
|
+
arch: process.arch,
|
|
297
|
+
kernel: kernelRelease(),
|
|
298
|
+
libc: process.report.getReport().header?.glibcVersionRuntime ?? ""
|
|
299
|
+
}) {
|
|
300
|
+
if (host.platform === "darwin" && host.arch === "arm64") {
|
|
301
|
+
if (!/^\d+\.\d+\.\d+$/.test(host.kernel) || Number(host.kernel.split(".")[0]) < 23)
|
|
302
|
+
throw new Error("The release provider requires macOS 14 or later on arm64. Upgrade macOS before installing the release runtime.");
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
const libc = host.libc;
|
|
306
|
+
const [major, minor] = libc.split(".").map(Number);
|
|
307
|
+
if (host.platform !== "linux" || host.arch !== "x64" || !/^\d+\.\d+(\.\d+)?$/.test(libc) || !(major > 2 || major === 2 && minor >= 35))
|
|
308
|
+
throw new Error("The release provider requires Linux x64 and glibc 2.35 or later. On a host supported by Homebrew, install Homebrew and its host prerequisites, then run koed runtime install --provider homebrew --dependency-mode bundled-local.");
|
|
309
|
+
}
|
|
310
|
+
function collectReleaseRuntimeStatus(paths, environment = process.env) {
|
|
311
|
+
assertReleaseHost();
|
|
312
|
+
const policy = embeddingPolicy(paths, environment);
|
|
313
|
+
const catalog = getNativeRuntimeCatalog();
|
|
314
|
+
const selected = readNativeSelection(paths, catalog);
|
|
315
|
+
if (!selected)
|
|
316
|
+
return {
|
|
317
|
+
ok: false,
|
|
318
|
+
provider: "release",
|
|
319
|
+
state: "missing",
|
|
320
|
+
pinnedCoreId: catalog.core.recipeId,
|
|
321
|
+
installedCudaId: null,
|
|
322
|
+
pinnedCudaId: catalog.cuda?.recipeId ?? null,
|
|
323
|
+
executionPolicy: policy,
|
|
324
|
+
message: `Install the ${catalog.core.target.platform === "macos" ? "Metal" : "CPU"} runtime with ${releaseInstallCommand}.`
|
|
325
|
+
};
|
|
326
|
+
const blocker = coreStartBlocker(selected.pin, catalog);
|
|
327
|
+
if (blocker)
|
|
328
|
+
return {
|
|
329
|
+
ok: false,
|
|
330
|
+
provider: "release",
|
|
331
|
+
state: "incompatible",
|
|
332
|
+
selectionId: selected.id,
|
|
333
|
+
installedCoreId: selected.pin.recipeId,
|
|
334
|
+
pinnedCoreId: catalog.core.recipeId,
|
|
335
|
+
installedCudaId: selected.cuda?.recipeId ?? null,
|
|
336
|
+
pinnedCudaId: catalog.cuda?.recipeId ?? null,
|
|
337
|
+
executionPolicy: policy,
|
|
338
|
+
runtimeVersion: selected.pin.runtimeVersion,
|
|
339
|
+
message: `${blocker}. Stop Koed and run ${releaseInstallCommand}.`
|
|
340
|
+
};
|
|
341
|
+
const coreOutdated = selected.pin.recipeId !== catalog.core.recipeId;
|
|
342
|
+
const cudaOutdated = !!(selected.cuda && catalog.cuda && selected.cuda.recipeId !== catalog.cuda.recipeId);
|
|
343
|
+
const outdated = coreOutdated || cudaOutdated;
|
|
344
|
+
return {
|
|
345
|
+
ok: true,
|
|
346
|
+
provider: "release",
|
|
347
|
+
state: outdated ? "outdated" : "installed",
|
|
348
|
+
selectionId: selected.id,
|
|
349
|
+
installedCoreId: selected.pin.recipeId,
|
|
350
|
+
pinnedCoreId: catalog.core.recipeId,
|
|
351
|
+
installedCudaId: selected.cuda?.recipeId ?? null,
|
|
352
|
+
pinnedCudaId: catalog.cuda?.recipeId ?? null,
|
|
353
|
+
executionPolicy: policy,
|
|
354
|
+
runtimeVersion: selected.pin.runtimeVersion,
|
|
355
|
+
message: cudaOutdated ? `A CUDA add-on update is available. Stop Koed and run ${releaseInstallCommand} --with-cuda.` : coreOutdated ? `A native core update is available. Stop Koed and run ${releaseInstallCommand}.` : selected.cuda ? "The selected CPU core and CUDA add-on are installed." : `The selected ${catalog.core.target.platform === "macos" ? "Metal" : "CPU"} runtime is installed.`
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
async function probeCore(root, signal, platform) {
|
|
359
|
+
for (const binary of [
|
|
360
|
+
"postgres/bin/postgres",
|
|
361
|
+
"postgres/bin/psql",
|
|
362
|
+
"llama.cpp/llama-server"
|
|
363
|
+
]) {
|
|
364
|
+
try {
|
|
365
|
+
await nativeCommand(resolve3(root, binary), ["--version"], {
|
|
366
|
+
cwd: root,
|
|
367
|
+
signal,
|
|
368
|
+
env: {
|
|
369
|
+
PATH: "/usr/bin:/bin",
|
|
370
|
+
LANG: "C",
|
|
371
|
+
LC_ALL: "C",
|
|
372
|
+
KOED_LLAMA_SERVER_BACKEND: platform === "macos" ? "metal" : "cpu"
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
} catch (error) {
|
|
376
|
+
throw new Error(`Staged native probe failed: ${binary}. ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
if (platform === "macos") {
|
|
380
|
+
try {
|
|
381
|
+
const devices = await nativeCommand(resolve3(root, "llama.cpp/llama-server"), ["--list-devices"], {
|
|
382
|
+
cwd: root,
|
|
383
|
+
signal,
|
|
384
|
+
env: {
|
|
385
|
+
PATH: "/usr/bin:/bin",
|
|
386
|
+
LANG: "C",
|
|
387
|
+
LC_ALL: "C",
|
|
388
|
+
KOED_LLAMA_SERVER_BACKEND: "metal",
|
|
389
|
+
LLAMA_ARG_UI: "false"
|
|
390
|
+
}
|
|
391
|
+
});
|
|
392
|
+
if (!/^[ \t]*(?:MTL[0-9]+|Metal[0-9]*):[ \t]+\S/im.test(devices))
|
|
393
|
+
throw new Error("No Metal device was reported.");
|
|
394
|
+
} catch (cause) {
|
|
395
|
+
throw new Error(`Staged Metal device discovery failed: ${cause instanceof Error ? cause.message : String(cause)}. Check Metal support and the native runtime, then retry.`, { cause });
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
function recordStatus(paths, id) {
|
|
400
|
+
const cache = resolve3(paths.cacheDir, "runtime-release.json");
|
|
401
|
+
const temp = `${cache}.${randomUUID2()}.tmp`;
|
|
402
|
+
try {
|
|
403
|
+
assertDirectoryChain(paths.koedHome, paths.cacheDir);
|
|
404
|
+
mkdirSync2(paths.cacheDir, { recursive: true, mode: 448 });
|
|
405
|
+
const bytes = JSON.stringify({ schemaVersion: 1, selectionId: id });
|
|
406
|
+
if (lstatSync2(cache, { throwIfNoEntry: false })?.isFile() && readNativeMetadata(cache, 16 * 1024).toString("utf8") === bytes)
|
|
407
|
+
return;
|
|
408
|
+
writeFileSync2(temp, bytes, {
|
|
409
|
+
flag: "wx",
|
|
410
|
+
mode: 384,
|
|
411
|
+
flush: true
|
|
412
|
+
});
|
|
413
|
+
renameSync2(temp, cache);
|
|
414
|
+
syncNativeDirectory(paths.cacheDir);
|
|
415
|
+
} catch (error) {
|
|
416
|
+
return `The selection is active. Could not refresh derived status: ${error instanceof Error ? error.message : String(error)}`;
|
|
417
|
+
} finally {
|
|
418
|
+
try {
|
|
419
|
+
rmSync2(temp, { force: true });
|
|
420
|
+
} catch {
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
return void 0;
|
|
424
|
+
}
|
|
425
|
+
async function installReleaseRuntime(paths, options = {}) {
|
|
426
|
+
assertReleaseHost();
|
|
427
|
+
if (process.platform === "darwin" && options.cuda && options.cuda !== "preserve")
|
|
428
|
+
throw new Error("--with-cuda and --without-cuda are not supported on macOS.");
|
|
429
|
+
const catalog = getNativeRuntimeCatalog(), pin = catalog.core, store = nativeStore(paths), owner = options.desktopRuntimeCapability ? resolveDesktopRuntimeOwner(options.desktopRuntimeCapability, paths.koedHome) : resolveKoedRuntimeOwner();
|
|
430
|
+
const choice = options.cuda ?? "preserve", environment = options.environment ?? process.env;
|
|
431
|
+
const signal = options.signal ?? new AbortController().signal;
|
|
432
|
+
const plan = () => {
|
|
433
|
+
signal.throwIfAborted();
|
|
434
|
+
const policy = embeddingPolicy(paths, environment);
|
|
435
|
+
assertMacPolicy(pin.target.platform, policy);
|
|
436
|
+
const selected = readNativeSelection(paths, catalog);
|
|
437
|
+
const cuda = chooseCuda(catalog, selected?.cuda ?? null, choice, policy);
|
|
438
|
+
if (selected && selected.pin.recipeId !== pin.recipeId && compareNativeVersions(pin.runtimeVersion, selected.pin.runtimeVersion) <= 0)
|
|
439
|
+
throw new Error("Refusing a native core downgrade or replacement at the same runtime version.");
|
|
440
|
+
assertPostgresDataVersion(paths, pin.components.postgres.major);
|
|
441
|
+
return { selected, cuda, policy };
|
|
442
|
+
};
|
|
443
|
+
const before = await withStoppedRuntime(paths, owner, async () => {
|
|
444
|
+
await options.assertConfiguration?.();
|
|
445
|
+
options.phase?.("checking");
|
|
446
|
+
const { selected, cuda, policy } = plan();
|
|
447
|
+
for (const name of ["core", "selections", ...cuda ? ["cuda"] : []]) {
|
|
448
|
+
const dir = resolve3(store, name);
|
|
449
|
+
assertDirectoryChain(paths.koedHome, dir);
|
|
450
|
+
mkdirSync2(dir, { recursive: true, mode: 448 });
|
|
451
|
+
}
|
|
452
|
+
if (selected?.pin.recipeId === pin.recipeId && selected.cuda?.recipeId === cuda?.recipeId) {
|
|
453
|
+
if (choice === "with")
|
|
454
|
+
options.phase?.("inference");
|
|
455
|
+
const validation = choice === "with" ? await validateStagedCuda(paths, selected.root, environment, {
|
|
456
|
+
signal,
|
|
457
|
+
requireModel: options.requireModel
|
|
458
|
+
}) : void 0;
|
|
459
|
+
const warning = recordStatus(paths, selected.id);
|
|
460
|
+
return {
|
|
461
|
+
unchanged: true,
|
|
462
|
+
result: {
|
|
463
|
+
ok: true,
|
|
464
|
+
provider: "release",
|
|
465
|
+
state: "installed",
|
|
466
|
+
changed: false,
|
|
467
|
+
selectionId: selected.id,
|
|
468
|
+
coreId: pin.recipeId,
|
|
469
|
+
cudaId: cuda?.recipeId ?? null,
|
|
470
|
+
executionPolicy: policy,
|
|
471
|
+
validation,
|
|
472
|
+
downloadedBytes: 0,
|
|
473
|
+
warning,
|
|
474
|
+
message: warning ?? "The selected native runtime is intact. Run koed start when ready."
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
if (cuda)
|
|
479
|
+
await checkCudaHost(signal).catch((error) => {
|
|
480
|
+
if (signal.aborted)
|
|
481
|
+
throw error;
|
|
482
|
+
throw preservedCudaFailure(error, choice, policy);
|
|
483
|
+
});
|
|
484
|
+
return {
|
|
485
|
+
unchanged: false,
|
|
486
|
+
previousId: selected?.id ?? null,
|
|
487
|
+
cuda
|
|
488
|
+
};
|
|
489
|
+
});
|
|
490
|
+
if (before.unchanged)
|
|
491
|
+
return before.result;
|
|
492
|
+
const assets = before.cuda ? [pin, before.cuda] : [pin];
|
|
493
|
+
const missing = assets.filter((asset) => !nativePathExists(payloadRoot(paths, asset)));
|
|
494
|
+
if (missing.some((asset) => nativeKind(asset) === "cuda" && (choice !== "with" || asset !== catalog.cuda)))
|
|
495
|
+
throw new Error("The retained CUDA add-on is missing. Inspect the native store before retrying.");
|
|
496
|
+
const downloadBytes = missing.reduce((n, a) => n + a.archiveBytes, 0);
|
|
497
|
+
const required = missing.reduce((n, a) => n + a.expandedBytes, reserve + downloadBytes);
|
|
498
|
+
const disk = statfsSync(store, { bigint: true });
|
|
499
|
+
if (disk.bavail * disk.bsize < BigInt(required))
|
|
500
|
+
throw new Error(`Insufficient free space. The install requires ${required} available bytes, including a ${reserve}-byte reserve. Retained payloads are already counted as used space.`);
|
|
501
|
+
const staging = mkdtempSync(resolve3(store, ".stage-"));
|
|
502
|
+
try {
|
|
503
|
+
const staged = /* @__PURE__ */ new Map();
|
|
504
|
+
let downloaded = 0;
|
|
505
|
+
for (const asset of missing) {
|
|
506
|
+
staged.set(asset, await stageNativeAsset(asset, staging, signal, (event) => options.progress?.({
|
|
507
|
+
...event,
|
|
508
|
+
transferredBytes: downloaded + event.transferredBytes,
|
|
509
|
+
totalBytes: downloadBytes
|
|
510
|
+
})));
|
|
511
|
+
downloaded += asset.archiveBytes;
|
|
512
|
+
}
|
|
513
|
+
return await withStoppedRuntime(paths, owner, async () => {
|
|
514
|
+
await options.assertConfiguration?.();
|
|
515
|
+
const { selected, cuda, policy } = plan();
|
|
516
|
+
if ((selected?.id ?? null) !== before.previousId || before.cuda?.recipeId !== cuda?.recipeId)
|
|
517
|
+
throw new Error("Another installer changed the selection. Inspect runtime status and retry.");
|
|
518
|
+
for (const [asset, source] of staged) {
|
|
519
|
+
const dest = payloadRoot(paths, asset);
|
|
520
|
+
assertDirectoryChain(paths.koedHome, dest);
|
|
521
|
+
if (!nativePathExists(dest)) {
|
|
522
|
+
renameSync2(source, dest);
|
|
523
|
+
syncNativeDirectory(dirname2(dest));
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
const next = composeNativeSelection(paths, pin, staging, catalog, cuda);
|
|
527
|
+
options.phase?.("verifying");
|
|
528
|
+
await probeCore(next.root, signal, pin.target.platform);
|
|
529
|
+
if (cuda)
|
|
530
|
+
options.phase?.("inference");
|
|
531
|
+
const validation = cuda ? await validateStagedCuda(paths, next.root, environment, {
|
|
532
|
+
signal,
|
|
533
|
+
requireModel: options.requireModel
|
|
534
|
+
}).catch((error) => {
|
|
535
|
+
if (signal.aborted)
|
|
536
|
+
throw error;
|
|
537
|
+
throw preservedCudaFailure(error, choice, policy);
|
|
538
|
+
}) : void 0;
|
|
539
|
+
signal.throwIfAborted();
|
|
540
|
+
options.phase?.("activating");
|
|
541
|
+
signal.throwIfAborted();
|
|
542
|
+
activateNativeSelection(paths, next.id);
|
|
543
|
+
const warning = recordStatus(paths, next.id);
|
|
544
|
+
const dropped = choice === "preserve" && selected?.cuda && !cuda;
|
|
545
|
+
const message = dropped ? `CPU runtime selected. The prior CUDA add-on is incompatible; run ${releaseInstallCommand} --with-cuda for a compatible pair. Run koed start when ready.` : `${cuda ? "CPU core and CUDA add-on" : pin.target.platform === "macos" ? "Metal runtime" : "CPU runtime"} installed. Run koed start when ready.`;
|
|
546
|
+
return {
|
|
547
|
+
ok: true,
|
|
548
|
+
provider: "release",
|
|
549
|
+
state: "installed",
|
|
550
|
+
changed: true,
|
|
551
|
+
selectionId: next.id,
|
|
552
|
+
coreId: pin.recipeId,
|
|
553
|
+
cudaId: cuda?.recipeId ?? null,
|
|
554
|
+
executionPolicy: policy,
|
|
555
|
+
validation,
|
|
556
|
+
downloadedBytes: downloadBytes,
|
|
557
|
+
expandedBytes: assets.reduce((n, a) => n + a.expandedBytes, 0),
|
|
558
|
+
requiredFreeBytes: required,
|
|
559
|
+
warning,
|
|
560
|
+
message: warning ?? message
|
|
561
|
+
};
|
|
562
|
+
});
|
|
563
|
+
} finally {
|
|
564
|
+
rmSync2(staging, { recursive: true, force: true });
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
function assertPostgresDataVersion(paths, major) {
|
|
568
|
+
const file = resolve3(paths.postgresDataDir, "PG_VERSION");
|
|
569
|
+
if (nativePathExists(file) && readNativeMetadata(file, 32).toString("utf8").trim() !== String(major)) {
|
|
570
|
+
throw new Error("Postgres data requires another major version. Database upgrades are outside runtime installation.");
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
function resolveSelectedCoreForStart(paths, environment = process.env, useSelectedLlama = true) {
|
|
574
|
+
try {
|
|
575
|
+
const id = currentNativeId(paths);
|
|
576
|
+
if (!id) {
|
|
577
|
+
for (const name of ["postgres", "llama.cpp"]) {
|
|
578
|
+
const entry = resolve3(paths.koedHome, "runtime", name);
|
|
579
|
+
if (lstatSync2(entry, { throwIfNoEntry: false })?.isSymbolicLink() && readlinkSync2(entry) === `native/current/${name}`)
|
|
580
|
+
throw new Error("Incomplete native selection.");
|
|
581
|
+
}
|
|
582
|
+
return void 0;
|
|
583
|
+
}
|
|
584
|
+
assertReleaseHost();
|
|
585
|
+
const catalog = getNativeRuntimeCatalog(), selected = readNativeSelection(paths, catalog);
|
|
586
|
+
assertStartableCore(selected.pin, catalog);
|
|
587
|
+
const policy = useSelectedLlama ? embeddingPolicy(paths, environment) : null;
|
|
588
|
+
if (policy)
|
|
589
|
+
assertMacPolicy(catalog.core.target.platform, policy);
|
|
590
|
+
if (useSelectedLlama && policy === "cuda" && !selected.cuda)
|
|
591
|
+
throw new Error("The forced CUDA policy requires a selected CUDA add-on.");
|
|
592
|
+
return selected.root;
|
|
593
|
+
} catch (cause) {
|
|
594
|
+
if (cause instanceof MacCudaPolicyError || cause instanceof NativeSelectionTargetError)
|
|
595
|
+
throw cause;
|
|
596
|
+
const command = environment.KOED_EMBEDDING_ACCELERATION?.trim().toLowerCase() === "cuda" ? releaseInstallCommand + " --with-cuda" : releaseInstallCommand;
|
|
597
|
+
throw new Error(`Cannot start the release-managed native runtime: ${cause instanceof Error ? cause.message : String(cause)}. Stop Koed, inspect runtime status, and run ${command}.`, { cause });
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
export {
|
|
601
|
+
assertReleaseHost,
|
|
602
|
+
collectReleaseRuntimeStatus,
|
|
603
|
+
installReleaseRuntime,
|
|
604
|
+
resolveSelectedCoreForStart
|
|
605
|
+
};
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
PINNED_PRIVACY_MODEL_FILES,
|
|
4
4
|
PINNED_PRIVACY_MODEL_ID,
|
|
5
5
|
PINNED_PRIVACY_MODEL_REVISION
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-E6YVGIEW.js";
|
|
7
7
|
|
|
8
8
|
// packages/koed-server/dist/privacy-model-runtime.js
|
|
9
9
|
import { createHash, randomUUID } from "node:crypto";
|