@otto-code/brain 0.7.6 → 0.8.1
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/dist/bench/context-corpus.js +3 -3
- package/dist/bench/corpus.js +2 -2
- package/dist/bench/curated-repos.js +3 -3
- package/dist/bench/health.d.ts +1 -1
- package/dist/bench/health.js +2 -2
- package/dist/bench/tasks.js +2 -2
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/bench.d.ts +1 -1
- package/dist/commands/bench.js +27 -4
- package/dist/commands/calibrate.d.ts +1 -1
- package/dist/commands/calibrate.js +5 -2
- package/dist/commands/catalog.d.ts +1 -1
- package/dist/commands/config.d.ts +1 -1
- package/dist/commands/lifecycle.js +1 -1
- package/dist/commands/pull.d.ts +1 -1
- package/dist/commands/pull.js +9 -4
- package/dist/commands/report.d.ts +1 -1
- package/dist/commands/rescore.d.ts +1 -1
- package/dist/commands/rescore.js +1 -1
- package/dist/commands/runtime.d.ts +2 -1
- package/dist/commands/runtime.js +32 -3
- package/dist/commands/scan.d.ts +1 -1
- package/dist/commands/scan.js +6 -1
- package/dist/commands/search.d.ts +1 -1
- package/dist/commands/share.js +2 -2
- package/dist/commands/sweep.d.ts +2 -2
- package/dist/commands/sweep.js +22 -8
- package/dist/commands/ui.d.ts +1 -1
- package/dist/config/index.d.ts +2 -1
- package/dist/config/index.js +2 -1
- package/dist/config/otto-home.js +1 -1
- package/dist/config/paths.d.ts +1 -0
- package/dist/config/paths.js +4 -0
- package/dist/config/profile-edit.d.ts +94 -0
- package/dist/config/profile-edit.js +269 -0
- package/dist/config/profiles.d.ts +2 -2
- package/dist/config/profiles.js +1 -1
- package/dist/config/schema.d.ts +4 -4
- package/dist/config/schema.js +6 -6
- package/dist/config/store.d.ts +1 -1
- package/dist/config/store.js +1 -1
- package/dist/models/download.js +1 -1
- package/dist/models/enrich.d.ts +2 -2
- package/dist/models/index.d.ts +1 -1
- package/dist/models/index.js +1 -1
- package/dist/models/pick.d.ts +9 -0
- package/dist/models/pick.js +24 -1
- package/dist/ops/report.js +28 -28
- package/dist/ops/results.d.ts +128 -9
- package/dist/ops/results.js +77 -5
- package/dist/output/render.js +1 -1
- package/dist/output/types.d.ts +1 -1
- package/dist/runtime/args.d.ts +17 -4
- package/dist/runtime/args.js +20 -14
- package/dist/runtime/index.d.ts +9 -3
- package/dist/runtime/index.js +21 -3
- package/dist/runtime/lmstudio.d.ts +2 -2
- package/dist/runtime/lmstudio.js +115 -28
- package/dist/runtime/managed.d.ts +72 -8
- package/dist/runtime/managed.js +404 -38
- package/dist/service/activity.d.ts +83 -0
- package/dist/service/activity.js +216 -0
- package/dist/service/host-api.d.ts +132 -0
- package/dist/service/host-api.js +397 -0
- package/dist/service/http-util.d.ts +27 -0
- package/dist/service/http-util.js +72 -0
- package/dist/service/model-selector.d.ts +2 -2
- package/dist/service/model-selector.js +6 -6
- package/dist/service/router.d.ts +28 -4
- package/dist/service/router.js +128 -94
- package/dist/service/scheduler.d.ts +2 -2
- package/dist/service/scheduler.js +1 -1
- package/dist/service/serve.d.ts +2 -2
- package/dist/service/serve.js +51 -8
- package/dist/service/supervisor.d.ts +6 -0
- package/dist/service/supervisor.js +2 -0
- package/dist/service/tailscale.js +1 -1
- package/dist/service/tls.d.ts +4 -4
- package/dist/service/tls.js +3 -3
- package/dist/sysmon.d.ts +20 -4
- package/dist/sysmon.js +42 -18
- package/dist/tui/app.d.ts +12 -2
- package/dist/tui/app.js +46 -22
- package/dist/vram.d.ts +8 -1
- package/dist/vram.js +6 -3
- package/package.json +1 -1
package/dist/runtime/index.js
CHANGED
|
@@ -4,18 +4,32 @@
|
|
|
4
4
|
* path) and `lmstudio` (discovered from an existing LM Studio install, a
|
|
5
5
|
* zero-download fast path). Selection follows config: an explicit path override
|
|
6
6
|
* wins; otherwise `auto` prefers a managed runtime and falls back to LM Studio.
|
|
7
|
+
*
|
|
8
|
+
* Both providers are cross-platform. Which accelerator a managed install picks
|
|
9
|
+
* is decided in `managed.resolveRuntimeVariant` from the platform, the arch and
|
|
10
|
+
* whether an NVIDIA GPU answered - `probeNvidiaGpu` below is the one place that
|
|
11
|
+
* asks, so the download layer stays free of process spawning.
|
|
7
12
|
*/
|
|
13
|
+
import { query as queryGpu } from "../gpu.js";
|
|
8
14
|
import { resolveBrainPaths } from "../config/paths.js";
|
|
9
15
|
import { listRuntimes as listLmStudioRuntimes, resolveOverride } from "./lmstudio.js";
|
|
10
16
|
import { defaultRuntimeSpec, installManagedRuntime, listManagedRuntimes, } from "./managed.js";
|
|
11
17
|
export { BACKENDS_DIR, LMSTUDIO_ROOT, listRuntimes as listLmStudioRuntimes } from "./lmstudio.js";
|
|
12
18
|
export { buildArgs, buildEnv, formatCommand } from "./args.js";
|
|
13
|
-
export { installManagedRuntime, listManagedRuntimes, defaultRuntimeSpec, DEFAULT_LLAMA_BUILD, } from "./managed.js";
|
|
19
|
+
export { installManagedRuntime, listManagedRuntimes, listRuntimeDevices, verifyRuntimeExecutable, defaultRuntimeSpec, extractArchive, resolveRuntimeVariant, serverExeName, supportedVariants, DEFAULT_LLAMA_BUILD, } from "./managed.js";
|
|
14
20
|
/** Every runtime available on this machine, managed first then LM Studio. */
|
|
15
21
|
export function listAllRuntimes(env = process.env) {
|
|
16
22
|
const paths = resolveBrainPaths(env);
|
|
17
23
|
return [...listManagedRuntimes(paths.runtimesDir), ...listLmStudioRuntimes()];
|
|
18
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Whether this machine has an NVIDIA GPU, for picking a managed build. Returns
|
|
27
|
+
* false rather than throwing when nvidia-smi is absent, which is the normal
|
|
28
|
+
* case on macOS and on AMD/Intel machines.
|
|
29
|
+
*/
|
|
30
|
+
export async function probeNvidiaGpu() {
|
|
31
|
+
return (await queryGpu()) !== null;
|
|
32
|
+
}
|
|
19
33
|
/** The runtime to use given config, or null when none is available. */
|
|
20
34
|
export function resolveRuntime(config, env = process.env) {
|
|
21
35
|
const rc = config.runtime;
|
|
@@ -31,11 +45,15 @@ export function resolveRuntime(config, env = process.env) {
|
|
|
31
45
|
return managed[0] ?? lmstudio[0] ?? null; // auto
|
|
32
46
|
}
|
|
33
47
|
/** Ensure a runtime exists, downloading the default managed build if none does. */
|
|
34
|
-
export async function ensureRuntime(config, env = process.env, onProgress) {
|
|
48
|
+
export async function ensureRuntime(config, env = process.env, onProgress, target = {}) {
|
|
35
49
|
const existing = resolveRuntime(config, env);
|
|
36
50
|
if (existing)
|
|
37
51
|
return existing;
|
|
38
52
|
const paths = resolveBrainPaths(env);
|
|
39
|
-
|
|
53
|
+
const resolved = {
|
|
54
|
+
...target,
|
|
55
|
+
hasNvidiaGpu: target.hasNvidiaGpu ?? (await probeNvidiaGpu()),
|
|
56
|
+
};
|
|
57
|
+
return installManagedRuntime(defaultRuntimeSpec(null, resolved), paths.runtimesDir, onProgress);
|
|
40
58
|
}
|
|
41
59
|
//# sourceMappingURL=index.js.map
|
|
@@ -4,7 +4,7 @@ export declare const BACKENDS_DIR: string;
|
|
|
4
4
|
export declare function extractVersion(dirName: string): string;
|
|
5
5
|
/** Compare dotted version strings numerically, descending. */
|
|
6
6
|
export declare function compareVersionsDesc(a: string, b: string): number;
|
|
7
|
-
export declare function listRuntimes(backendsDir?: string): Runtime[];
|
|
7
|
+
export declare function listRuntimes(backendsDir?: string, platform?: NodeJS.Platform): Runtime[];
|
|
8
8
|
/** Resolve an explicit runtime directory or exe override into a Runtime. */
|
|
9
|
-
export declare function resolveOverride(override: string): Runtime;
|
|
9
|
+
export declare function resolveOverride(override: string, platform?: NodeJS.Platform): Runtime;
|
|
10
10
|
//# sourceMappingURL=lmstudio.d.ts.map
|
package/dist/runtime/lmstudio.js
CHANGED
|
@@ -1,33 +1,73 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Locates the llama-server binary shipped inside LM Studio
|
|
2
|
+
* Locates the llama-server binary shipped inside LM Studio, on all three
|
|
3
|
+
* desktop platforms. LM Studio keeps its backends under `~/.lmstudio` on
|
|
4
|
+
* Windows, macOS and Linux alike, so only the directory naming and the binary
|
|
5
|
+
* name differ per platform.
|
|
3
6
|
*
|
|
4
|
-
* Important gotcha: that executable is a ~20KB stub. Launching it
|
|
5
|
-
* matching `backends/vendor/...` directory on PATH fails with
|
|
7
|
+
* Important gotcha (Windows): that executable is a ~20KB stub. Launching it
|
|
8
|
+
* without the matching `backends/vendor/...` directory on PATH fails with
|
|
6
9
|
* STATUS_DLL_NOT_FOUND (0xC0000135) and prints absolutely nothing, so we always
|
|
7
|
-
* pair a runtime with its vendor directory
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
+
* pair a runtime with its vendor directory, and a Windows runtime whose vendor
|
|
11
|
+
* dir is missing is skipped rather than offered. macOS and Linux builds are
|
|
12
|
+
* self-contained and fail loudly through the dynamic loader when they are not,
|
|
13
|
+
* which is why the name-shape fallback below is enabled only there.
|
|
14
|
+
*
|
|
15
|
+
* This is one of two runtime sources (the other being the self-contained
|
|
16
|
+
* `managed` runtime); it stays as a zero-download fast path when LM Studio is
|
|
17
|
+
* already installed.
|
|
10
18
|
*/
|
|
11
19
|
import fs from "node:fs";
|
|
12
20
|
import os from "node:os";
|
|
13
21
|
import path from "node:path";
|
|
22
|
+
import { serverExeName } from "./managed.js";
|
|
14
23
|
export const LMSTUDIO_ROOT = path.join(os.homedir(), ".lmstudio");
|
|
15
24
|
export const BACKENDS_DIR = path.join(LMSTUDIO_ROOT, "extensions", "backends");
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Most preferred first, per platform. Each entry maps a runtime directory
|
|
27
|
+
* prefix to its vendor dir.
|
|
28
|
+
*
|
|
29
|
+
* Prefix (not substring) matching is deliberate: a CUDA directory is named
|
|
30
|
+
* `llama.cpp-win-x86_64-nvidia-cuda12-avx2-<version>`, so a substring rule for
|
|
31
|
+
* the AVX2 entry would match it a second time and offer the same runtime twice
|
|
32
|
+
* under the wrong label.
|
|
33
|
+
*
|
|
34
|
+
* The Windows rows are verified against a real install. The macOS and Linux
|
|
35
|
+
* rows follow LM Studio's documented naming but have not been read off a live
|
|
36
|
+
* install here - the shape fallback in `listRuntimes` is what makes discovery
|
|
37
|
+
* correct on those platforms regardless.
|
|
38
|
+
*/
|
|
39
|
+
const PREFERENCES = {
|
|
40
|
+
win32: [
|
|
41
|
+
{
|
|
42
|
+
prefix: "llama.cpp-win-x86_64-nvidia-cuda12-",
|
|
43
|
+
vendor: "win-llama-cuda12-vendor-v2",
|
|
44
|
+
label: "CUDA 12",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
prefix: "llama.cpp-win-x86_64-nvidia-cuda-",
|
|
48
|
+
vendor: "win-llama-cuda-vendor-v2",
|
|
49
|
+
label: "CUDA 11",
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
prefix: "llama.cpp-win-x86_64-vulkan-",
|
|
53
|
+
vendor: "win-llama-vulkan-vendor-v2",
|
|
54
|
+
label: "Vulkan",
|
|
55
|
+
},
|
|
56
|
+
{ prefix: "llama.cpp-win-x86_64-avx2-", vendor: null, label: "CPU (AVX2)" },
|
|
57
|
+
],
|
|
58
|
+
darwin: [
|
|
59
|
+
{ prefix: "llama.cpp-mac-arm64-apple-metal-", vendor: null, label: "Metal" },
|
|
60
|
+
{ prefix: "llama.cpp-mac-arm64-", vendor: null, label: "CPU (arm64)" },
|
|
61
|
+
{ prefix: "llama.cpp-mac-x86_64-", vendor: null, label: "CPU (x86_64)" },
|
|
62
|
+
],
|
|
63
|
+
linux: [
|
|
64
|
+
{ prefix: "llama.cpp-linux-x86_64-nvidia-cuda12-", vendor: null, label: "CUDA 12" },
|
|
65
|
+
{ prefix: "llama.cpp-linux-x86_64-nvidia-cuda-", vendor: null, label: "CUDA 11" },
|
|
66
|
+
{ prefix: "llama.cpp-linux-x86_64-vulkan-", vendor: null, label: "Vulkan" },
|
|
67
|
+
{ prefix: "llama.cpp-linux-x86_64-avx2-", vendor: null, label: "CPU (AVX2)" },
|
|
68
|
+
{ prefix: "llama.cpp-linux-aarch64-", vendor: null, label: "CPU (aarch64)" },
|
|
69
|
+
],
|
|
70
|
+
};
|
|
31
71
|
// Directory names carry an instruction-set segment before the version
|
|
32
72
|
// (…-cuda12-avx2-2.24.0), so take the trailing dotted number, not the remainder.
|
|
33
73
|
const VERSION_SUFFIX = /(\d+(?:\.\d+)+)$/;
|
|
@@ -46,40 +86,87 @@ export function compareVersionsDesc(a, b) {
|
|
|
46
86
|
}
|
|
47
87
|
return 0;
|
|
48
88
|
}
|
|
49
|
-
|
|
89
|
+
/** A readable label for a directory discovered outside the preference table. */
|
|
90
|
+
function labelFromDirName(dirName) {
|
|
91
|
+
const lower = dirName.toLowerCase();
|
|
92
|
+
if (lower.includes("cuda12"))
|
|
93
|
+
return "CUDA 12";
|
|
94
|
+
if (lower.includes("cuda"))
|
|
95
|
+
return "CUDA";
|
|
96
|
+
if (lower.includes("metal"))
|
|
97
|
+
return "Metal";
|
|
98
|
+
if (lower.includes("vulkan"))
|
|
99
|
+
return "Vulkan";
|
|
100
|
+
if (lower.includes("rocm") || lower.includes("hip"))
|
|
101
|
+
return "ROCm";
|
|
102
|
+
if (lower.includes("avx2"))
|
|
103
|
+
return "CPU (AVX2)";
|
|
104
|
+
return "LM Studio runtime";
|
|
105
|
+
}
|
|
106
|
+
export function listRuntimes(backendsDir = BACKENDS_DIR, platform = process.platform) {
|
|
50
107
|
if (!fs.existsSync(backendsDir))
|
|
51
108
|
return [];
|
|
109
|
+
const exeName = serverExeName(platform);
|
|
52
110
|
const entries = fs
|
|
53
111
|
.readdirSync(backendsDir, { withFileTypes: true })
|
|
54
112
|
.filter((e) => e.isDirectory())
|
|
55
113
|
.map((e) => e.name);
|
|
56
114
|
const found = [];
|
|
57
|
-
|
|
115
|
+
const claimed = new Set();
|
|
116
|
+
for (const pref of PREFERENCES[platform] ?? []) {
|
|
58
117
|
const matches = entries
|
|
59
|
-
.filter((name) => name.startsWith(pref.prefix))
|
|
118
|
+
.filter((name) => name.startsWith(pref.prefix) && !claimed.has(name))
|
|
60
119
|
.map((name) => ({ name, version: extractVersion(name) }))
|
|
61
|
-
.filter(({ name }) => fs.existsSync(path.join(backendsDir, name,
|
|
120
|
+
.filter(({ name }) => fs.existsSync(path.join(backendsDir, name, exeName)))
|
|
62
121
|
.sort((a, b) => compareVersionsDesc(a.version, b.version));
|
|
63
122
|
for (const match of matches) {
|
|
64
123
|
const vendorDir = pref.vendor ? path.join(backendsDir, "vendor", pref.vendor) : null;
|
|
65
124
|
// A runtime whose vendor DLLs are missing cannot launch; skip it.
|
|
66
125
|
if (vendorDir && !fs.existsSync(vendorDir))
|
|
67
126
|
continue;
|
|
127
|
+
claimed.add(match.name);
|
|
68
128
|
found.push({
|
|
69
129
|
label: pref.label,
|
|
70
130
|
version: match.version,
|
|
71
131
|
dir: path.join(backendsDir, match.name),
|
|
72
|
-
exe: path.join(backendsDir, match.name,
|
|
132
|
+
exe: path.join(backendsDir, match.name, exeName),
|
|
73
133
|
vendorDir,
|
|
74
134
|
source: "lmstudio",
|
|
75
135
|
});
|
|
76
136
|
}
|
|
77
137
|
}
|
|
138
|
+
// Shape fallback: anything that holds a llama-server binary is usable on the
|
|
139
|
+
// self-contained platforms, whatever LM Studio decided to call the directory.
|
|
140
|
+
// Not applied on Windows, where an unpaired stub launches and dies silently.
|
|
141
|
+
if (platform !== "win32") {
|
|
142
|
+
const extra = entries
|
|
143
|
+
.filter((name) => !claimed.has(name) && name !== "vendor")
|
|
144
|
+
.filter((name) => fs.existsSync(path.join(backendsDir, name, exeName)))
|
|
145
|
+
.map((name) => ({ name, version: extractVersion(name) }))
|
|
146
|
+
.sort((a, b) => compareVersionsDesc(a.version, b.version));
|
|
147
|
+
for (const match of extra) {
|
|
148
|
+
found.push({
|
|
149
|
+
label: labelFromDirName(match.name),
|
|
150
|
+
version: match.version,
|
|
151
|
+
dir: path.join(backendsDir, match.name),
|
|
152
|
+
exe: path.join(backendsDir, match.name, exeName),
|
|
153
|
+
vendorDir: null,
|
|
154
|
+
source: "lmstudio",
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}
|
|
78
158
|
return found;
|
|
79
159
|
}
|
|
80
160
|
/** Resolve an explicit runtime directory or exe override into a Runtime. */
|
|
81
|
-
export function resolveOverride(override) {
|
|
82
|
-
const
|
|
161
|
+
export function resolveOverride(override, platform = process.platform) {
|
|
162
|
+
const exeName = serverExeName(platform);
|
|
163
|
+
// An override may name the binary directly or the directory holding it. On
|
|
164
|
+
// non-Windows the binary has no extension, so "is it a file?" is the only
|
|
165
|
+
// reliable test - a bare `.../llama-server` path looks exactly like a dir.
|
|
166
|
+
const looksLikeExe = path.basename(override).toLowerCase() === exeName.toLowerCase() ||
|
|
167
|
+
(platform === "win32" && override.toLowerCase().endsWith(".exe")) ||
|
|
168
|
+
(fs.existsSync(override) && fs.statSync(override).isFile());
|
|
169
|
+
const exe = looksLikeExe ? override : path.join(override, exeName);
|
|
83
170
|
if (!fs.existsSync(exe))
|
|
84
171
|
throw new Error(`llama-server not found at ${exe}`);
|
|
85
172
|
const dir = path.dirname(exe);
|
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
import type { Runtime } from "../types.js";
|
|
2
|
+
/** The accelerator a managed runtime is built against. */
|
|
3
|
+
export type RuntimeVariant = "cuda" | "metal" | "vulkan" | "cpu";
|
|
2
4
|
export interface RuntimeSpec {
|
|
3
5
|
label: string;
|
|
4
6
|
version: string;
|
|
5
7
|
/** One or more archive URLs, extracted in order into the same target dir. */
|
|
6
8
|
assets: string[];
|
|
9
|
+
/** Platform the assets are built for; drives exe name and extraction. */
|
|
10
|
+
platform: NodeJS.Platform;
|
|
11
|
+
variant: RuntimeVariant;
|
|
12
|
+
}
|
|
13
|
+
/** What to install for. Any field left out is read from the current process. */
|
|
14
|
+
export interface RuntimeTarget {
|
|
15
|
+
platform?: NodeJS.Platform;
|
|
16
|
+
arch?: string;
|
|
17
|
+
/** Explicit accelerator, or "auto" to pick from platform + GPU presence. */
|
|
18
|
+
variant?: RuntimeVariant | "auto";
|
|
19
|
+
/** Whether an NVIDIA GPU was detected; only consulted by "auto". */
|
|
20
|
+
hasNvidiaGpu?: boolean;
|
|
7
21
|
}
|
|
8
22
|
export interface InstallProgress {
|
|
9
23
|
phase: "downloading" | "extracting" | "done";
|
|
@@ -12,15 +26,65 @@ export interface InstallProgress {
|
|
|
12
26
|
totalBytes?: number;
|
|
13
27
|
}
|
|
14
28
|
/**
|
|
15
|
-
* The default runtime build.
|
|
16
|
-
*
|
|
17
|
-
|
|
29
|
+
* The default runtime build. Bumping this requires re-reading the tag's asset
|
|
30
|
+
* names (see the module header) - the naming scheme is not stable across tags.
|
|
31
|
+
*/
|
|
32
|
+
export declare const DEFAULT_LLAMA_BUILD = "b10265";
|
|
33
|
+
/** The binary name llama.cpp ships for a platform. */
|
|
34
|
+
export declare function serverExeName(platform?: NodeJS.Platform): string;
|
|
35
|
+
/**
|
|
36
|
+
* Pick the accelerator for a target. Deliberately conservative: it never
|
|
37
|
+
* chooses an accelerator whose asset does not exist for that platform/arch.
|
|
38
|
+
*/
|
|
39
|
+
export declare function resolveRuntimeVariant(target?: RuntimeTarget): RuntimeVariant;
|
|
40
|
+
/**
|
|
41
|
+
* Build the runtime spec for a target. Throws when upstream publishes nothing
|
|
42
|
+
* for the combination, naming what it tried so the message is actionable.
|
|
43
|
+
*/
|
|
44
|
+
export declare function defaultRuntimeSpec(build?: string | null | undefined, target?: RuntimeTarget): RuntimeSpec;
|
|
45
|
+
/** Variants with a published asset for a platform/arch, best first. */
|
|
46
|
+
export declare function supportedVariants(platform?: NodeJS.Platform, arch?: string): RuntimeVariant[];
|
|
47
|
+
/**
|
|
48
|
+
* A managed runtime is any dir under runtimesDir that contains llama-server,
|
|
49
|
+
* best accelerator first and newest build first within an accelerator.
|
|
50
|
+
*/
|
|
51
|
+
export declare function listManagedRuntimes(runtimesDir: string, platform?: NodeJS.Platform): Runtime[];
|
|
52
|
+
/**
|
|
53
|
+
* The actionable message for a dynamic-loader failure, or null when the output
|
|
54
|
+
* is not one. Pure, so the classification is testable without spawning.
|
|
55
|
+
*
|
|
56
|
+
* Returning null for an unrecognised failure is deliberate: a future llama.cpp
|
|
57
|
+
* that exits non-zero from `--version` must not turn a perfectly usable install
|
|
58
|
+
* into a hard failure. Only a positively identified missing library throws.
|
|
59
|
+
*/
|
|
60
|
+
export declare function missingLibraryFrom(stderr: string): string | null;
|
|
61
|
+
export declare function describeLoaderFailure(stderr: string, runtimeDir: string, platform?: NodeJS.Platform): string | null;
|
|
62
|
+
/**
|
|
63
|
+
* Run the freshly installed binary once, so a missing *system* library surfaces
|
|
64
|
+
* at install time naming the library, instead of hours later as an opaque
|
|
65
|
+
* supervisor crash.
|
|
66
|
+
*
|
|
67
|
+
* This is not hypothetical: no upstream Linux asset ships `libgomp.so.1`, which
|
|
68
|
+
* `llama-server` hard-links, so on a host without `libgomp1` the download and
|
|
69
|
+
* extract both succeed and the binary then dies with exit 127. `buildEnv` cannot
|
|
70
|
+
* fix that - the library is not in the runtime dir LD_LIBRARY_PATH points at.
|
|
71
|
+
*/
|
|
72
|
+
export declare function verifyRuntimeExecutable(runtime: Runtime, platform?: NodeJS.Platform, arch?: string): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* Device lines out of `--list-devices` stdout, which is a header followed by one
|
|
75
|
+
* indented line per device, or the literal `(none)`. Pure half of
|
|
76
|
+
* `listRuntimeDevices`.
|
|
77
|
+
*/
|
|
78
|
+
export declare function parseDeviceList(stdout: string): string[];
|
|
79
|
+
/**
|
|
80
|
+
* Devices the runtime's backends actually found, one line each. Empty means the
|
|
81
|
+
* accelerator resolved to nothing and inference would silently fall back to CPU,
|
|
82
|
+
* which is a real configuration: on WSL2 there is no NVIDIA Vulkan ICD, so a
|
|
83
|
+
* Vulkan runtime on an NVIDIA machine reports no device and runs ~41x slower at
|
|
84
|
+
* prefill without saying so. Never throws; a probe failure reads as "unknown".
|
|
18
85
|
*/
|
|
19
|
-
export declare
|
|
20
|
-
|
|
21
|
-
export declare function defaultRuntimeSpec(build?: string): RuntimeSpec;
|
|
22
|
-
/** A managed runtime is any dir under runtimesDir that contains llama-server.exe. */
|
|
23
|
-
export declare function listManagedRuntimes(runtimesDir: string): Runtime[];
|
|
86
|
+
export declare function listRuntimeDevices(runtime: Runtime, platform?: NodeJS.Platform): Promise<string[]>;
|
|
87
|
+
export declare function extractArchive(archivePath: string, destDir: string, platform?: NodeJS.Platform): Promise<void>;
|
|
24
88
|
/** Download + extract a runtime spec into runtimesDir and return the Runtime. */
|
|
25
89
|
export declare function installManagedRuntime(spec: RuntimeSpec, runtimesDir: string, onProgress?: (progress: InstallProgress) => void): Promise<Runtime>;
|
|
26
90
|
//# sourceMappingURL=managed.d.ts.map
|