@openclaw/llama-cpp-provider 2026.9.7 → 2026.9.9
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/index.js +253 -36
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -35,6 +35,47 @@ const CUDA_ARCHIVE_LIMITS = {
|
|
|
35
35
|
maxExtractedBytes: 600 * MEBIBYTE$1,
|
|
36
36
|
maxEntryBytes: 521 * MEBIBYTE$1
|
|
37
37
|
};
|
|
38
|
+
const WINDOWS_X64_VC_RUNTIME = {
|
|
39
|
+
archive: "vc-redist",
|
|
40
|
+
name: "VC_redist.x64.exe",
|
|
41
|
+
url: "https://download.visualstudio.microsoft.com/download/pr/ebdab8e5-1d7b-4d9f-a11b-cbb1720c3b12/843068991DAAA1F73AD9F6239BCE4D0F6A07A51F18C37EA2A867E9BECA71295C/VC_redist.x64.exe",
|
|
42
|
+
sha256: "843068991daaa1f73ad9f6239bce4d0f6a07a51f18c37ea2a867e9beca71295c",
|
|
43
|
+
size: 18731856,
|
|
44
|
+
containerOffset: 63e4,
|
|
45
|
+
containerSize: 18091661,
|
|
46
|
+
nestedCabinet: "a4",
|
|
47
|
+
files: [
|
|
48
|
+
{
|
|
49
|
+
source: "msvcp140.dll_amd64",
|
|
50
|
+
target: "msvcp140.dll"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
source: "vcruntime140.dll_amd64",
|
|
54
|
+
target: "vcruntime140.dll"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
source: "vcruntime140_1.dll_amd64",
|
|
58
|
+
target: "vcruntime140_1.dll"
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
};
|
|
62
|
+
const WINDOWS_ARM64_VC_RUNTIME = {
|
|
63
|
+
archive: "vc-redist",
|
|
64
|
+
name: "VC_redist.arm64.exe",
|
|
65
|
+
url: "https://download.visualstudio.microsoft.com/download/pr/ece44298-3977-4f73-ab91-c13fe79cfea8/B70EF586669A620A0A30A1156969C05C6A3831DC8F8BC992DA75779D2A92F944/VC_redist.arm64.exe",
|
|
66
|
+
sha256: "b70ef586669a620a0a30a1156969c05c6a3831dc8f8bc992da75779d2a92f944",
|
|
67
|
+
size: 11870816,
|
|
68
|
+
containerOffset: 684112,
|
|
69
|
+
containerSize: 11176508,
|
|
70
|
+
nestedCabinet: "a1",
|
|
71
|
+
files: [{
|
|
72
|
+
source: "msvcp140.dll_arm64",
|
|
73
|
+
target: "msvcp140.dll"
|
|
74
|
+
}, {
|
|
75
|
+
source: "vcruntime140.dll_arm64",
|
|
76
|
+
target: "vcruntime140.dll"
|
|
77
|
+
}]
|
|
78
|
+
};
|
|
38
79
|
const MACOS_ALIASES = [
|
|
39
80
|
["libggml-rpc.0.23.0.dylib", ["libggml-rpc.0.dylib", "libggml-rpc.dylib"]],
|
|
40
81
|
["libllama.0.4.0.dylib", ["libllama.0.dylib", "libllama.dylib"]],
|
|
@@ -124,7 +165,7 @@ const LLAMA_SERVER_ASSETS = [
|
|
|
124
165
|
...CUDA_ARCHIVE_LIMITS,
|
|
125
166
|
maxEntries: 3
|
|
126
167
|
}
|
|
127
|
-
}]
|
|
168
|
+
}, WINDOWS_X64_VC_RUNTIME]
|
|
128
169
|
},
|
|
129
170
|
{
|
|
130
171
|
platform: "win32",
|
|
@@ -135,7 +176,8 @@ const LLAMA_SERVER_ASSETS = [
|
|
|
135
176
|
name: `llama-${LLAMA_SERVER_RELEASE}-bin-win-cpu-arm64.zip`,
|
|
136
177
|
sha256: "c1058fe5764a687275c8d20d6bbc1454e787cdbb8ebb8c37a2f959f2b144dc77",
|
|
137
178
|
executable: "llama-server.exe",
|
|
138
|
-
regularFileAliases: []
|
|
179
|
+
regularFileAliases: [],
|
|
180
|
+
dependencies: [WINDOWS_ARM64_VC_RUNTIME]
|
|
139
181
|
},
|
|
140
182
|
{
|
|
141
183
|
platform: "win32",
|
|
@@ -146,7 +188,8 @@ const LLAMA_SERVER_ASSETS = [
|
|
|
146
188
|
name: `llama-${LLAMA_SERVER_RELEASE}-bin-win-cpu-x64.zip`,
|
|
147
189
|
sha256: "9df3158ed228a641a4b127942d7f459f24c9e13f04682659d05c00c80099b6b5",
|
|
148
190
|
executable: "llama-server.exe",
|
|
149
|
-
regularFileAliases: []
|
|
191
|
+
regularFileAliases: [],
|
|
192
|
+
dependencies: [WINDOWS_X64_VC_RUNTIME]
|
|
150
193
|
}
|
|
151
194
|
];
|
|
152
195
|
function selectLlamaServerAsset(platform = process.platform, arch = process.arch, acceleration) {
|
|
@@ -181,7 +224,7 @@ const LLAMA_ARCHIVE_LIMITS = {
|
|
|
181
224
|
maxMetaEntryBytes: MEBIBYTE
|
|
182
225
|
};
|
|
183
226
|
const MAX_ALIAS_BYTES = 512 * MEBIBYTE;
|
|
184
|
-
function assertManifestBasename(filename) {
|
|
227
|
+
function assertManifestBasename$1(filename) {
|
|
185
228
|
if (!filename || filename === "." || filename === ".." || /[\\/]/u.test(filename) || path.basename(filename) !== filename) throw new Error(`invalid llama-server archive manifest filename: ${filename}`);
|
|
186
229
|
return filename;
|
|
187
230
|
}
|
|
@@ -192,23 +235,23 @@ function resolveArchiveRoot(destDir, archiveRoot) {
|
|
|
192
235
|
if (parts.some((part) => !part || part === "." || part === "..")) throw new Error(`invalid llama-server archive root: ${archiveRoot}`);
|
|
193
236
|
return path.join(destDir, ...parts);
|
|
194
237
|
}
|
|
195
|
-
async function assertRegularFile(filePath, label) {
|
|
238
|
+
async function assertRegularFile$1(filePath, label) {
|
|
196
239
|
const stat = await fs.lstat(filePath).catch(() => void 0);
|
|
197
240
|
if (!stat?.isFile() || stat.nlink > 1) throw new Error(`llama-server archive does not contain regular ${label}`);
|
|
198
241
|
return stat;
|
|
199
242
|
}
|
|
200
243
|
async function materializeAssetAliases(params) {
|
|
201
|
-
const claimedNames = new Set(params.requiredFiles.map(assertManifestBasename));
|
|
202
|
-
for (const file of claimedNames) await assertRegularFile(path.join(params.rootDir, file), `file ${file}`);
|
|
244
|
+
const claimedNames = new Set(params.requiredFiles.map(assertManifestBasename$1));
|
|
245
|
+
for (const file of claimedNames) await assertRegularFile$1(path.join(params.rootDir, file), `file ${file}`);
|
|
203
246
|
let copiedBytes = 0;
|
|
204
247
|
for (const [rawSource, rawAliases] of params.asset.regularFileAliases) {
|
|
205
|
-
const source = assertManifestBasename(rawSource);
|
|
248
|
+
const source = assertManifestBasename$1(rawSource);
|
|
206
249
|
if (claimedNames.has(source)) throw new Error(`duplicate llama-server archive manifest filename: ${source}`);
|
|
207
250
|
claimedNames.add(source);
|
|
208
251
|
const sourcePath = path.join(params.rootDir, source);
|
|
209
|
-
const sourceStat = await assertRegularFile(sourcePath, `alias source ${source}`);
|
|
252
|
+
const sourceStat = await assertRegularFile$1(sourcePath, `alias source ${source}`);
|
|
210
253
|
for (const rawAlias of rawAliases) {
|
|
211
|
-
const alias = assertManifestBasename(rawAlias);
|
|
254
|
+
const alias = assertManifestBasename$1(rawAlias);
|
|
212
255
|
if (claimedNames.has(alias)) throw new Error(`duplicate llama-server archive manifest filename: ${alias}`);
|
|
213
256
|
claimedNames.add(alias);
|
|
214
257
|
copiedBytes += sourceStat.size;
|
|
@@ -216,7 +259,7 @@ async function materializeAssetAliases(params) {
|
|
|
216
259
|
const aliasPath = path.join(params.rootDir, alias);
|
|
217
260
|
await fs.copyFile(sourcePath, aliasPath, constants.COPYFILE_EXCL);
|
|
218
261
|
await fs.chmod(aliasPath, sourceStat.mode & 511);
|
|
219
|
-
if ((await assertRegularFile(aliasPath, `alias ${alias}`)).size !== sourceStat.size) throw new Error(`llama-server archive alias copy is incomplete: ${alias}`);
|
|
262
|
+
if ((await assertRegularFile$1(aliasPath, `alias ${alias}`)).size !== sourceStat.size) throw new Error(`llama-server archive alias copy is incomplete: ${alias}`);
|
|
220
263
|
}
|
|
221
264
|
}
|
|
222
265
|
}
|
|
@@ -264,6 +307,118 @@ async function extractLlamaServerDependencyArchive(params) {
|
|
|
264
307
|
});
|
|
265
308
|
}
|
|
266
309
|
//#endregion
|
|
310
|
+
//#region extensions/llama-cpp/src/llama-server-vc-runtime.ts
|
|
311
|
+
const CAB_HEADER_SIZE = 12;
|
|
312
|
+
const COPY_BUFFER_SIZE = 1048576;
|
|
313
|
+
const EXPAND_TIMEOUT_MS = 6e4;
|
|
314
|
+
function assertManifestBasename(filename) {
|
|
315
|
+
if (!filename || filename === "." || filename === ".." || /[\\/]/u.test(filename) || path.basename(filename) !== filename) throw new Error(`invalid Visual C++ runtime manifest filename: ${filename}`);
|
|
316
|
+
return filename;
|
|
317
|
+
}
|
|
318
|
+
async function writeFully(handle, buffer, length) {
|
|
319
|
+
let offset = 0;
|
|
320
|
+
while (offset < length) {
|
|
321
|
+
const result = await handle.write(buffer, offset, length - offset);
|
|
322
|
+
if (result.bytesWritten <= 0) throw new Error("Visual C++ runtime container copy made no progress");
|
|
323
|
+
offset += result.bytesWritten;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
async function extractPinnedContainer(params) {
|
|
327
|
+
const source = await fs.open(params.bundlePath, "r");
|
|
328
|
+
try {
|
|
329
|
+
const stat = await source.stat();
|
|
330
|
+
if (!stat.isFile() || stat.size !== params.asset.size) throw new Error(`Visual C++ runtime bundle size mismatch: expected ${params.asset.size}, got ${stat.size}`);
|
|
331
|
+
if (params.asset.containerOffset < 0 || params.asset.containerSize < CAB_HEADER_SIZE || params.asset.containerOffset + params.asset.containerSize > stat.size) throw new Error("invalid Visual C++ runtime container bounds");
|
|
332
|
+
const header = Buffer.alloc(CAB_HEADER_SIZE);
|
|
333
|
+
if ((await source.read(header, 0, header.length, params.asset.containerOffset)).bytesRead !== header.length || header.subarray(0, 4).toString("ascii") !== "MSCF" || header.readUInt32LE(8) !== params.asset.containerSize) throw new Error("Visual C++ runtime bundle does not contain the pinned cabinet");
|
|
334
|
+
const target = await fs.open(params.containerPath, "wx", 384);
|
|
335
|
+
try {
|
|
336
|
+
const buffer = Buffer.allocUnsafe(Math.min(COPY_BUFFER_SIZE, params.asset.containerSize));
|
|
337
|
+
let copied = 0;
|
|
338
|
+
while (copied < params.asset.containerSize) {
|
|
339
|
+
params.signal?.throwIfAborted();
|
|
340
|
+
const requested = Math.min(buffer.length, params.asset.containerSize - copied);
|
|
341
|
+
const result = await source.read(buffer, 0, requested, params.asset.containerOffset + copied);
|
|
342
|
+
if (result.bytesRead <= 0) throw new Error("Visual C++ runtime container ended before its pinned size");
|
|
343
|
+
await writeFully(target, buffer, result.bytesRead);
|
|
344
|
+
copied += result.bytesRead;
|
|
345
|
+
}
|
|
346
|
+
} finally {
|
|
347
|
+
await target.close();
|
|
348
|
+
}
|
|
349
|
+
} finally {
|
|
350
|
+
await source.close();
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
function resolveExpandCommand() {
|
|
354
|
+
const systemRoot = process.env.SystemRoot;
|
|
355
|
+
if (!systemRoot || !path.win32.isAbsolute(systemRoot)) throw new Error("SystemRoot is unavailable; cannot extract the Visual C++ runtime");
|
|
356
|
+
return path.win32.join(systemRoot, "System32", "expand.exe");
|
|
357
|
+
}
|
|
358
|
+
async function runExpand(command, args, signal) {
|
|
359
|
+
await new Promise((resolve, reject) => {
|
|
360
|
+
execFile(command, args, {
|
|
361
|
+
timeout: EXPAND_TIMEOUT_MS,
|
|
362
|
+
signal,
|
|
363
|
+
windowsHide: true
|
|
364
|
+
}, (error, _stdout, stderr) => {
|
|
365
|
+
if (error) {
|
|
366
|
+
const detail = stderr.trim();
|
|
367
|
+
reject(new Error(`Failed to extract the Visual C++ runtime${detail ? `: ${detail}` : ""}`, { cause: error }));
|
|
368
|
+
} else resolve();
|
|
369
|
+
});
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
async function assertRegularFile(filePath, label) {
|
|
373
|
+
const stat = await fs.lstat(filePath).catch(() => void 0);
|
|
374
|
+
if (!stat?.isFile() || stat.nlink > 1) throw new Error(`Visual C++ runtime does not contain regular file ${label}`);
|
|
375
|
+
}
|
|
376
|
+
/** Extracts the pinned Microsoft redistributable DLLs without installing machine-wide state. */
|
|
377
|
+
async function extractWindowsVcRuntime(params) {
|
|
378
|
+
const nestedCabinet = assertManifestBasename(params.asset.nestedCabinet);
|
|
379
|
+
const files = params.asset.files.map(({ source, target }) => ({
|
|
380
|
+
source: assertManifestBasename(source),
|
|
381
|
+
target: assertManifestBasename(target)
|
|
382
|
+
}));
|
|
383
|
+
if (new Set(files.map((file) => file.target)).size !== files.length) throw new Error("duplicate Visual C++ runtime target filename");
|
|
384
|
+
const expandCommand = resolveExpandCommand();
|
|
385
|
+
const containerPath = path.join(params.destDir, "bundle.cab");
|
|
386
|
+
const nestedDir = path.join(params.destDir, "nested");
|
|
387
|
+
const filesDir = path.join(params.destDir, "files");
|
|
388
|
+
await Promise.all([
|
|
389
|
+
fs.mkdir(params.destDir, { recursive: true }),
|
|
390
|
+
fs.mkdir(nestedDir, { recursive: true }),
|
|
391
|
+
fs.mkdir(filesDir, { recursive: true })
|
|
392
|
+
]);
|
|
393
|
+
await extractPinnedContainer({
|
|
394
|
+
asset: params.asset,
|
|
395
|
+
bundlePath: params.bundlePath,
|
|
396
|
+
containerPath,
|
|
397
|
+
signal: params.signal
|
|
398
|
+
});
|
|
399
|
+
await runExpand(expandCommand, [
|
|
400
|
+
`-F:${nestedCabinet}`,
|
|
401
|
+
containerPath,
|
|
402
|
+
nestedDir
|
|
403
|
+
], params.signal);
|
|
404
|
+
const nestedPath = path.join(nestedDir, nestedCabinet);
|
|
405
|
+
await assertRegularFile(nestedPath, nestedCabinet);
|
|
406
|
+
for (const file of files) {
|
|
407
|
+
params.signal?.throwIfAborted();
|
|
408
|
+
await runExpand(expandCommand, [
|
|
409
|
+
`-F:${file.source}`,
|
|
410
|
+
nestedPath,
|
|
411
|
+
filesDir
|
|
412
|
+
], params.signal);
|
|
413
|
+
const sourcePath = path.join(filesDir, file.source);
|
|
414
|
+
await assertRegularFile(sourcePath, file.source);
|
|
415
|
+
const targetPath = path.join(params.destDir, file.target);
|
|
416
|
+
await fs.copyFile(sourcePath, targetPath, constants.COPYFILE_EXCL);
|
|
417
|
+
await assertRegularFile(targetPath, file.target);
|
|
418
|
+
}
|
|
419
|
+
return params.destDir;
|
|
420
|
+
}
|
|
421
|
+
//#endregion
|
|
267
422
|
//#region extensions/llama-cpp/src/llama-server-install.ts
|
|
268
423
|
const DOWNLOAD_TIMEOUT_MS = 18e5;
|
|
269
424
|
const VERSION_TIMEOUT_MS = 15e3;
|
|
@@ -287,7 +442,7 @@ function assertSupportedLinuxRuntime(asset) {
|
|
|
287
442
|
if (compareVersion(glibc, minimum) < 0) throw new Error(`The verified llama-server build requires glibc ${minimum}+ on Linux ${asset.arch}; this host has ${glibc}. Install a compatible llama-server manually and configure its absolute path.`);
|
|
288
443
|
}
|
|
289
444
|
function assetUrl(asset) {
|
|
290
|
-
return `https://github.com/ggml-org/llama.cpp/releases/download/${
|
|
445
|
+
return asset.url ?? `https://github.com/ggml-org/llama.cpp/releases/download/b10809/${asset.name}`;
|
|
291
446
|
}
|
|
292
447
|
const verifiedFiles = /* @__PURE__ */ new Map();
|
|
293
448
|
const VERIFIED_FILE_LIMIT = 16;
|
|
@@ -413,26 +568,64 @@ async function runServerCommand(command, args, signal, timeoutMs = VERSION_TIMEO
|
|
|
413
568
|
function formatRuntimeDependencyError(error) {
|
|
414
569
|
const detail = error instanceof Error ? error.message : String(error);
|
|
415
570
|
if (process.platform === "linux") return new Error(`The verified llama-server build could not start. Install the OpenMP runtime (for example libgomp1 on Debian/Ubuntu or libgomp on Fedora), then rerun llama.cpp setup. Detail: ${detail}`, { cause: error });
|
|
416
|
-
if (process.platform === "win32") return new Error(`The verified llama-server build could not start
|
|
571
|
+
if (process.platform === "win32") return new Error(`The verified llama-server build could not start with its app-local Visual C++ runtime. Rerun llama.cpp setup to reinstall it, or configure a compatible llama-server manually. Detail: ${detail}`, { cause: error });
|
|
417
572
|
return new Error(`The verified llama-server build could not start: ${detail}`, { cause: error });
|
|
418
573
|
}
|
|
419
|
-
async function
|
|
420
|
-
let version;
|
|
574
|
+
async function queryServerVersion(command, signal, versionTimeoutMs = VERSION_TIMEOUT_MS) {
|
|
421
575
|
try {
|
|
422
|
-
|
|
576
|
+
return await runServerCommand(command, ["--version"], signal, versionTimeoutMs);
|
|
423
577
|
} catch (error) {
|
|
424
578
|
signal?.throwIfAborted();
|
|
425
579
|
throw formatRuntimeDependencyError(error);
|
|
426
580
|
}
|
|
581
|
+
}
|
|
582
|
+
function validateServerVersionOutput(command, version) {
|
|
427
583
|
const match = (version.split(/\r?\n/u, 1)[0]?.trim() ?? "").match(/^version: .+ \(build (\d+), commit ([a-f\d]{9})\)$/u);
|
|
428
584
|
const build = match?.[1] ? Number(match[1]) : void 0;
|
|
429
585
|
const commit = match?.[2];
|
|
430
586
|
if (build !== 10809 || commit !== "5266f24da75dc449bd56cbed7addb9c8e4a6a73e".slice(0, 9)) throw new Error(`Unexpected llama-server build at ${command}: expected ${LLAMA_SERVER_RELEASE} (${LLAMA_SERVER_COMMIT.slice(0, 9)}), got ${version || "no version output"}`);
|
|
587
|
+
}
|
|
588
|
+
async function validateCudaServer(command, asset, signal) {
|
|
431
589
|
if (asset.backend === "cuda") {
|
|
432
590
|
const devices = await runServerCommand(command, ["--list-devices"], signal);
|
|
433
591
|
if (!/^\s*CUDA\d+: .+\(\d+ MiB, \d+ MiB free\)$/mu.test(devices)) throw new Error("The verified llama-server could not initialize an NVIDIA CUDA device. Update the NVIDIA driver and rerun setup, or configure a compatible llama-server manually. CPU fallback was not activated.");
|
|
434
592
|
}
|
|
435
593
|
}
|
|
594
|
+
async function validateInstalledServer(command, asset, signal, versionTimeoutMs = VERSION_TIMEOUT_MS) {
|
|
595
|
+
validateServerVersionOutput(command, await queryServerVersion(command, signal, versionTimeoutMs));
|
|
596
|
+
await validateCudaServer(command, asset, signal);
|
|
597
|
+
}
|
|
598
|
+
async function stageLlamaServerDependency(params) {
|
|
599
|
+
const { dependency, extractDir, extractedRoot, index, options } = params;
|
|
600
|
+
options.signal?.throwIfAborted();
|
|
601
|
+
const dependencyArchive = path.join(extractDir, dependency.name);
|
|
602
|
+
await downloadVerifiedFile({
|
|
603
|
+
url: assetUrl(dependency),
|
|
604
|
+
destination: dependencyArchive,
|
|
605
|
+
expectedSha256: dependency.sha256,
|
|
606
|
+
expectedSize: dependency.archive === "vc-redist" ? dependency.size : void 0,
|
|
607
|
+
signal: options.signal,
|
|
608
|
+
onProgress: options.onProgress
|
|
609
|
+
});
|
|
610
|
+
const dependencyExtractDir = path.join(extractDir, `dependency-${index}`);
|
|
611
|
+
await fs.mkdir(dependencyExtractDir);
|
|
612
|
+
const dependencyRoot = dependency.archive === "vc-redist" ? await extractWindowsVcRuntime({
|
|
613
|
+
bundlePath: dependencyArchive,
|
|
614
|
+
destDir: dependencyExtractDir,
|
|
615
|
+
asset: dependency,
|
|
616
|
+
signal: options.signal
|
|
617
|
+
}) : await extractLlamaServerDependencyArchive({
|
|
618
|
+
archivePath: dependencyArchive,
|
|
619
|
+
destDir: dependencyExtractDir,
|
|
620
|
+
asset: dependency
|
|
621
|
+
});
|
|
622
|
+
for (const file of dependencyFiles(dependency)) await fs.copyFile(path.join(dependencyRoot, file), path.join(extractedRoot, file), fs$1.constants.COPYFILE_EXCL);
|
|
623
|
+
}
|
|
624
|
+
function formatVcRuntimeFallbackError(startupError, fallbackError) {
|
|
625
|
+
const startupDetail = startupError instanceof Error ? startupError.message : String(startupError);
|
|
626
|
+
const fallbackDetail = fallbackError instanceof Error ? fallbackError.message : String(fallbackError);
|
|
627
|
+
return new Error(`The extracted llama-server could not start with the installed Windows runtime, and its app-local Visual C++ runtime fallback did not restore it. Initial startup detail: ${startupDetail} Fallback detail: ${fallbackDetail}`, { cause: fallbackError });
|
|
628
|
+
}
|
|
436
629
|
async function installLlamaServer(asset, options) {
|
|
437
630
|
options.signal?.throwIfAborted();
|
|
438
631
|
assertSupportedLinuxRuntime(asset);
|
|
@@ -461,28 +654,49 @@ async function installLlamaServer(asset, options) {
|
|
|
461
654
|
asset
|
|
462
655
|
});
|
|
463
656
|
const extractedRoot = path.dirname(extractedCommand);
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
archivePath: dependencyArchive,
|
|
478
|
-
destDir: dependencyExtractDir,
|
|
479
|
-
asset: dependency
|
|
480
|
-
});
|
|
481
|
-
for (const file of dependency.files) await fs.copyFile(path.join(dependencyRoot, file), path.join(extractedRoot, file), fs$1.constants.COPYFILE_EXCL);
|
|
482
|
-
}
|
|
657
|
+
const dependencies = asset.dependencies ?? [];
|
|
658
|
+
const windowsRuntimeDependencies = [];
|
|
659
|
+
for (const [index, dependency] of dependencies.entries()) if (dependency.archive === "vc-redist") windowsRuntimeDependencies.push({
|
|
660
|
+
dependency,
|
|
661
|
+
index
|
|
662
|
+
});
|
|
663
|
+
else await stageLlamaServerDependency({
|
|
664
|
+
dependency,
|
|
665
|
+
index,
|
|
666
|
+
extractDir,
|
|
667
|
+
extractedRoot,
|
|
668
|
+
options
|
|
669
|
+
});
|
|
483
670
|
options.signal?.throwIfAborted();
|
|
484
671
|
await fs.chmod(extractedCommand, 493);
|
|
485
|
-
|
|
672
|
+
if (windowsRuntimeDependencies.length > 0) {
|
|
673
|
+
let version;
|
|
674
|
+
try {
|
|
675
|
+
version = await queryServerVersion(extractedCommand, options.signal, FRESH_VERSION_TIMEOUT_MS);
|
|
676
|
+
} catch (startupError) {
|
|
677
|
+
options.signal?.throwIfAborted();
|
|
678
|
+
try {
|
|
679
|
+
for (const { dependency, index } of windowsRuntimeDependencies) await stageLlamaServerDependency({
|
|
680
|
+
dependency,
|
|
681
|
+
index,
|
|
682
|
+
extractDir,
|
|
683
|
+
extractedRoot,
|
|
684
|
+
options
|
|
685
|
+
});
|
|
686
|
+
} catch (stagingError) {
|
|
687
|
+
options.signal?.throwIfAborted();
|
|
688
|
+
throw formatVcRuntimeFallbackError(startupError, stagingError);
|
|
689
|
+
}
|
|
690
|
+
try {
|
|
691
|
+
version = await queryServerVersion(extractedCommand, options.signal, FRESH_VERSION_TIMEOUT_MS);
|
|
692
|
+
} catch (retryError) {
|
|
693
|
+
options.signal?.throwIfAborted();
|
|
694
|
+
throw formatVcRuntimeFallbackError(startupError, retryError);
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
validateServerVersionOutput(extractedCommand, version);
|
|
698
|
+
await validateCudaServer(extractedCommand, asset, options.signal);
|
|
699
|
+
} else await validateInstalledServer(extractedCommand, asset, options.signal, FRESH_VERSION_TIMEOUT_MS);
|
|
486
700
|
await fs.mkdir(path.dirname(installDir), { recursive: true });
|
|
487
701
|
options.signal?.throwIfAborted();
|
|
488
702
|
await fs.rm(installDir, {
|
|
@@ -499,6 +713,9 @@ async function installLlamaServer(asset, options) {
|
|
|
499
713
|
})]);
|
|
500
714
|
}
|
|
501
715
|
}
|
|
716
|
+
function dependencyFiles(dependency) {
|
|
717
|
+
return dependency.archive === "vc-redist" ? dependency.files.map((file) => file.target) : dependency.files;
|
|
718
|
+
}
|
|
502
719
|
async function ensureLlamaServerInstalled(options = {}) {
|
|
503
720
|
options.signal?.throwIfAborted();
|
|
504
721
|
const asset = options.asset ?? selectLlamaServerAsset();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/llama-cpp-provider",
|
|
3
|
-
"version": "2026.9.
|
|
3
|
+
"version": "2026.9.9",
|
|
4
4
|
"description": "OpenClaw provider for managed and external llama.cpp servers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"minHostVersion": ">=2026.6.2"
|
|
22
22
|
},
|
|
23
23
|
"compat": {
|
|
24
|
-
"pluginApi": ">=2026.9.
|
|
24
|
+
"pluginApi": ">=2026.9.9"
|
|
25
25
|
},
|
|
26
26
|
"build": {
|
|
27
|
-
"openclawVersion": "2026.9.
|
|
27
|
+
"openclawVersion": "2026.9.9"
|
|
28
28
|
},
|
|
29
29
|
"release": {
|
|
30
30
|
"bundleRuntimeDependencies": false,
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"assets/activity.svg"
|
|
47
47
|
],
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"openclaw": ">=2026.9.
|
|
49
|
+
"openclaw": ">=2026.9.9"
|
|
50
50
|
},
|
|
51
51
|
"peerDependenciesMeta": {
|
|
52
52
|
"openclaw": {
|