@openclaw/llama-cpp-provider 2026.10.10-beta.5 → 2026.11.5-beta.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/.setup/{auth-config-Dx2WDi-G.mjs → auth-config-GFuvSOHY.mjs} +2 -3
- package/dist/.setup/{defaults-DX4XN2j1.mjs → defaults-B-3wLNsP.mjs} +2 -3
- package/dist/.setup/{discovery-DdCiAOWU.mjs → discovery-BzqfGNU5.mjs} +5 -9
- package/dist/.setup/{embedding-provider.runtime-djNMas6G.mjs → embedding-provider.runtime-D5WYHk8V.mjs} +49 -42
- package/dist/.setup/{managed-provider-config-BuFqNTx1.mjs → managed-provider-config-XhvrVUR1.mjs} +2 -3
- package/dist/.setup/{managed-server-Bjr1c5yX.mjs → managed-server-CTer5Rq4.mjs} +395 -299
- package/dist/.setup/{media-catalog-BwFQGYtY.mjs → media-catalog-D-CRqGbe.mjs} +10 -218
- package/dist/.setup/{media-config-CZ7CluNV.mjs → media-config-92b6iCHm.mjs} +1 -2
- package/dist/.setup/{media-provider.runtime-MqV-UJ1m.mjs → media-provider.runtime-CW2ZQBg4.mjs} +4 -5
- package/dist/.setup/{media-setup-BQ6-EW_y.mjs → media-setup-DIZRVYUM.mjs} +12 -14
- package/dist/.setup/{provider-tg85QOYU.mjs → provider-abJEzh8u.mjs} +5 -8
- package/dist/.setup/{provider-discovery-CWtKWZkY.mjs → provider-discovery-6Hy2SktE.mjs} +6 -10
- package/dist/.setup/{setup-DmjzzdfH.mjs → setup-4lK0M-lf.mjs} +125 -135
- package/dist/.setup/{setup-CDJ2D5mu.mjs → setup-BnmsVffD.mjs} +8 -11
- package/dist/.setup/{stream-CSBkXmdm.mjs → stream-PxiV675a.mjs} +40 -13
- package/dist/.source-module-urls/2a292bf2cc9d15ab4011c4fb7ee888280524a76675c662fb0329d5dc914f3fba.json +1 -1
- package/dist/index.js +118 -127
- package/dist/provider-discovery.js +1 -1
- package/dist/provider-policy-api.js +2 -3
- package/package.json +5 -5
|
@@ -1,209 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as DEFAULT_LLAMA_CPP_MODEL_REVISION, f as DEFAULT_LLAMA_CPP_MODEL_SHA256, l as DEFAULT_LLAMA_CPP_MODEL_CACHE_FILE, m as DEFAULT_LLAMA_CPP_MODEL_URI, p as DEFAULT_LLAMA_CPP_MODEL_SIZE_BYTES, u as DEFAULT_LLAMA_CPP_MODEL_ID, w as resolveLlamaCppDataDir, y as buildLlamaCppModel } from "./defaults-B-3wLNsP.mjs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import os from "node:os";
|
|
4
|
-
import
|
|
4
|
+
import fsp from "node:fs/promises";
|
|
5
5
|
import { execFile } from "node:child_process";
|
|
6
|
-
|
|
7
|
-
const LLAMA_SERVER_RELEASE = "b10809";
|
|
8
|
-
const LLAMA_SERVER_BUILD = 10809;
|
|
9
|
-
const LLAMA_SERVER_COMMIT = "5266f24da75dc449bd56cbed7addb9c8e4a6a73e";
|
|
10
|
-
const MEBIBYTE = 1048576;
|
|
11
|
-
const CUDA_ARCHIVE_LIMITS = {
|
|
12
|
-
maxArchiveBytes: 400 * MEBIBYTE,
|
|
13
|
-
maxExtractedBytes: 600 * MEBIBYTE,
|
|
14
|
-
maxEntryBytes: 521 * MEBIBYTE
|
|
15
|
-
};
|
|
16
|
-
const WINDOWS_X64_VC_RUNTIME = {
|
|
17
|
-
archive: "vc-redist",
|
|
18
|
-
name: "VC_redist.x64.exe",
|
|
19
|
-
url: "https://download.visualstudio.microsoft.com/download/pr/ebdab8e5-1d7b-4d9f-a11b-cbb1720c3b12/843068991DAAA1F73AD9F6239BCE4D0F6A07A51F18C37EA2A867E9BECA71295C/VC_redist.x64.exe",
|
|
20
|
-
sha256: "843068991daaa1f73ad9f6239bce4d0f6a07a51f18c37ea2a867e9beca71295c",
|
|
21
|
-
size: 18731856,
|
|
22
|
-
containerOffset: 63e4,
|
|
23
|
-
containerSize: 18091661,
|
|
24
|
-
nestedCabinet: "a4",
|
|
25
|
-
files: [
|
|
26
|
-
{
|
|
27
|
-
source: "msvcp140.dll_amd64",
|
|
28
|
-
target: "msvcp140.dll"
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
source: "vcruntime140.dll_amd64",
|
|
32
|
-
target: "vcruntime140.dll"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
source: "vcruntime140_1.dll_amd64",
|
|
36
|
-
target: "vcruntime140_1.dll"
|
|
37
|
-
}
|
|
38
|
-
]
|
|
39
|
-
};
|
|
40
|
-
const WINDOWS_ARM64_VC_RUNTIME = {
|
|
41
|
-
archive: "vc-redist",
|
|
42
|
-
name: "VC_redist.arm64.exe",
|
|
43
|
-
url: "https://download.visualstudio.microsoft.com/download/pr/ece44298-3977-4f73-ab91-c13fe79cfea8/B70EF586669A620A0A30A1156969C05C6A3831DC8F8BC992DA75779D2A92F944/VC_redist.arm64.exe",
|
|
44
|
-
sha256: "b70ef586669a620a0a30a1156969c05c6a3831dc8f8bc992da75779d2a92f944",
|
|
45
|
-
size: 11870816,
|
|
46
|
-
containerOffset: 684112,
|
|
47
|
-
containerSize: 11176508,
|
|
48
|
-
nestedCabinet: "a1",
|
|
49
|
-
files: [{
|
|
50
|
-
source: "msvcp140.dll_arm64",
|
|
51
|
-
target: "msvcp140.dll"
|
|
52
|
-
}, {
|
|
53
|
-
source: "vcruntime140.dll_arm64",
|
|
54
|
-
target: "vcruntime140.dll"
|
|
55
|
-
}]
|
|
56
|
-
};
|
|
57
|
-
const MACOS_ALIASES = [
|
|
58
|
-
["libggml-rpc.0.23.0.dylib", ["libggml-rpc.0.dylib", "libggml-rpc.dylib"]],
|
|
59
|
-
["libllama.0.4.0.dylib", ["libllama.0.dylib", "libllama.dylib"]],
|
|
60
|
-
["libmtmd.0.4.0.dylib", ["libmtmd.0.dylib", "libmtmd.dylib"]],
|
|
61
|
-
["libggml.0.23.0.dylib", ["libggml.0.dylib", "libggml.dylib"]],
|
|
62
|
-
["libggml-base.0.23.0.dylib", ["libggml-base.0.dylib", "libggml-base.dylib"]],
|
|
63
|
-
["libggml-blas.0.23.0.dylib", ["libggml-blas.0.dylib", "libggml-blas.dylib"]],
|
|
64
|
-
["libllama-common.0.4.0.dylib", ["libllama-common.0.dylib", "libllama-common.dylib"]],
|
|
65
|
-
["libggml-cpu.0.23.0.dylib", ["libggml-cpu.0.dylib", "libggml-cpu.dylib"]]
|
|
66
|
-
];
|
|
67
|
-
const MACOS_METAL_ALIASES = [...MACOS_ALIASES, ["libggml-metal.0.23.0.dylib", ["libggml-metal.0.dylib", "libggml-metal.dylib"]]];
|
|
68
|
-
const LINUX_ALIASES = [
|
|
69
|
-
["libllama.so.0.4.0", ["libllama.so.0", "libllama.so"]],
|
|
70
|
-
["libggml.so.0.23.0", ["libggml.so.0", "libggml.so"]],
|
|
71
|
-
["libmtmd.so.0.4.0", ["libmtmd.so.0", "libmtmd.so"]],
|
|
72
|
-
["libggml-base.so.0.23.0", ["libggml-base.so.0", "libggml-base.so"]],
|
|
73
|
-
["libllama-common.so.0.4.0", ["libllama-common.so.0", "libllama-common.so"]]
|
|
74
|
-
];
|
|
75
|
-
const LLAMA_SERVER_ASSETS = [
|
|
76
|
-
{
|
|
77
|
-
platform: "darwin",
|
|
78
|
-
arch: "arm64",
|
|
79
|
-
backend: "metal",
|
|
80
|
-
archive: "tar.gz",
|
|
81
|
-
archiveRoot: `llama-${LLAMA_SERVER_RELEASE}`,
|
|
82
|
-
name: `llama-${LLAMA_SERVER_RELEASE}-bin-macos-arm64.tar.gz`,
|
|
83
|
-
sha256: "7d692df9e1e386e62f1c12b843903218041e6cd74c9415aa39a7ed3176f9eaa2",
|
|
84
|
-
sizeBytes: 11123196,
|
|
85
|
-
executable: "llama-server",
|
|
86
|
-
regularFileAliases: MACOS_METAL_ALIASES
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
platform: "darwin",
|
|
90
|
-
arch: "x64",
|
|
91
|
-
backend: "cpu",
|
|
92
|
-
archive: "tar.gz",
|
|
93
|
-
archiveRoot: `llama-${LLAMA_SERVER_RELEASE}`,
|
|
94
|
-
name: `llama-${LLAMA_SERVER_RELEASE}-bin-macos-x64.tar.gz`,
|
|
95
|
-
sha256: "13b34aa8a5d87341a21065a83f54a8167e1aaa6fe0d66065de01632a1ed64be6",
|
|
96
|
-
sizeBytes: 11175330,
|
|
97
|
-
executable: "llama-server",
|
|
98
|
-
regularFileAliases: MACOS_ALIASES
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
platform: "linux",
|
|
102
|
-
arch: "arm64",
|
|
103
|
-
backend: "cpu",
|
|
104
|
-
archive: "tar.gz",
|
|
105
|
-
archiveRoot: `llama-${LLAMA_SERVER_RELEASE}`,
|
|
106
|
-
name: `llama-${LLAMA_SERVER_RELEASE}-bin-ubuntu-arm64.tar.gz`,
|
|
107
|
-
sha256: "f2b7333971e1b7b42e9268bfdbfa30f5f56e2897156084d2251385df94aec358",
|
|
108
|
-
sizeBytes: 13380118,
|
|
109
|
-
executable: "llama-server",
|
|
110
|
-
regularFileAliases: LINUX_ALIASES
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
platform: "linux",
|
|
114
|
-
arch: "x64",
|
|
115
|
-
backend: "cpu",
|
|
116
|
-
archive: "tar.gz",
|
|
117
|
-
archiveRoot: `llama-${LLAMA_SERVER_RELEASE}`,
|
|
118
|
-
name: `llama-${LLAMA_SERVER_RELEASE}-bin-ubuntu-x64.tar.gz`,
|
|
119
|
-
sha256: "5e34434ddc6d03cd1584f403201aff0d4bd1a5793a72ff7e286532dfd1e4b941",
|
|
120
|
-
sizeBytes: 16734586,
|
|
121
|
-
executable: "llama-server",
|
|
122
|
-
regularFileAliases: LINUX_ALIASES
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
platform: "win32",
|
|
126
|
-
arch: "x64",
|
|
127
|
-
backend: "cuda",
|
|
128
|
-
archive: "zip",
|
|
129
|
-
archiveRoot: ".",
|
|
130
|
-
name: `llama-${LLAMA_SERVER_RELEASE}-bin-win-cuda-12.4-x64.zip`,
|
|
131
|
-
sha256: "c77bfcd9ed8d91e8721a2d6a290b907fddd4fa5412a47b21c6fa1709116b85f9",
|
|
132
|
-
sizeBytes: 253938543,
|
|
133
|
-
executable: "llama-server.exe",
|
|
134
|
-
regularFileAliases: [],
|
|
135
|
-
limits: CUDA_ARCHIVE_LIMITS,
|
|
136
|
-
dependencies: [{
|
|
137
|
-
archive: "zip",
|
|
138
|
-
archiveRoot: ".",
|
|
139
|
-
name: "cudart-llama-bin-win-cuda-12.4-x64.zip",
|
|
140
|
-
sha256: "8c79a9b226de4b3cacfd1f83d24f962d0773be79f1e7b75c6af4ded7e32ae1d6",
|
|
141
|
-
sizeBytes: 391443627,
|
|
142
|
-
regularFileAliases: [],
|
|
143
|
-
files: [
|
|
144
|
-
"cublas64_12.dll",
|
|
145
|
-
"cublasLt64_12.dll",
|
|
146
|
-
"cudart64_12.dll"
|
|
147
|
-
],
|
|
148
|
-
limits: {
|
|
149
|
-
...CUDA_ARCHIVE_LIMITS,
|
|
150
|
-
maxEntries: 3
|
|
151
|
-
}
|
|
152
|
-
}, WINDOWS_X64_VC_RUNTIME]
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
platform: "win32",
|
|
156
|
-
arch: "arm64",
|
|
157
|
-
backend: "cpu",
|
|
158
|
-
archive: "zip",
|
|
159
|
-
archiveRoot: ".",
|
|
160
|
-
name: `llama-${LLAMA_SERVER_RELEASE}-bin-win-cpu-arm64.zip`,
|
|
161
|
-
sha256: "c1058fe5764a687275c8d20d6bbc1454e787cdbb8ebb8c37a2f959f2b144dc77",
|
|
162
|
-
sizeBytes: 11974499,
|
|
163
|
-
executable: "llama-server.exe",
|
|
164
|
-
regularFileAliases: [],
|
|
165
|
-
dependencies: [WINDOWS_ARM64_VC_RUNTIME]
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
platform: "win32",
|
|
169
|
-
arch: "x64",
|
|
170
|
-
backend: "cpu",
|
|
171
|
-
archive: "zip",
|
|
172
|
-
archiveRoot: ".",
|
|
173
|
-
name: `llama-${LLAMA_SERVER_RELEASE}-bin-win-cpu-x64.zip`,
|
|
174
|
-
sha256: "9df3158ed228a641a4b127942d7f459f24c9e13f04682659d05c00c80099b6b5",
|
|
175
|
-
sizeBytes: 18407457,
|
|
176
|
-
executable: "llama-server.exe",
|
|
177
|
-
regularFileAliases: [],
|
|
178
|
-
dependencies: [WINDOWS_X64_VC_RUNTIME]
|
|
179
|
-
}
|
|
180
|
-
];
|
|
181
|
-
function selectLlamaServerAsset(platform = process.platform, arch = process.arch, acceleration) {
|
|
182
|
-
const backend = acceleration?.kind ?? (platform === "darwin" && arch === "arm64" ? "metal" : "cpu");
|
|
183
|
-
if (backend === "cuda" && acceleration?.kind === "cuda") {
|
|
184
|
-
if (platform !== "win32" || arch !== "x64") throw new Error(`No verified CUDA llama-server ${LLAMA_SERVER_RELEASE} build is available for ${platform}/${arch}. Install a CUDA-enabled llama-server manually and configure its absolute path, or explicitly choose CPU setup.`);
|
|
185
|
-
if (!(acceleration.devices.length > 0 && acceleration.devices.every((device) => {
|
|
186
|
-
const version = /^(\d+)\.(\d+)(?:\.\d+)?$/u.exec(device.driverVersion);
|
|
187
|
-
return version && (Number(version[1]) > 551 || Number(version[1]) === 551 && Number(version[2]) >= 78) && (device.computeCapability === void 0 || device.computeCapability >= 5);
|
|
188
|
-
}))) throw new Error("The verified CUDA 12.4 build requires NVIDIA driver 551.78 or newer and compute capability 5.0 or newer. Update the NVIDIA driver, configure a compatible llama-server manually, or explicitly choose CPU setup.");
|
|
189
|
-
}
|
|
190
|
-
const asset = LLAMA_SERVER_ASSETS.find((candidate) => candidate.platform === platform && candidate.arch === arch && candidate.backend === backend);
|
|
191
|
-
if (!asset) throw new Error(`No verified llama-server ${LLAMA_SERVER_RELEASE} build is available for ${platform}/${arch}. Install a compatible llama-server manually, then rerun llama.cpp setup with its absolute path.`);
|
|
192
|
-
return asset;
|
|
193
|
-
}
|
|
194
|
-
function resolveManagedLlamaServerPaths(asset = selectLlamaServerAsset()) {
|
|
195
|
-
const installDir = path.join(resolveLlamaCppDataDir(), LLAMA_SERVER_RELEASE, `${asset.platform}-${asset.arch}${asset.backend === "cuda" ? "-cuda-12.4" : ""}`);
|
|
196
|
-
return {
|
|
197
|
-
installDir,
|
|
198
|
-
command: path.join(installDir, asset.executable),
|
|
199
|
-
presetPath: path.join(resolveLlamaCppDataDir(), "models.ini")
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
function findManagedLlamaServerAsset(command, platform = process.platform, arch = process.arch) {
|
|
203
|
-
return LLAMA_SERVER_ASSETS.find((asset) => asset.platform === platform && asset.arch === arch && resolveManagedLlamaServerPaths(asset).command === command);
|
|
204
|
-
}
|
|
205
|
-
//#endregion
|
|
206
|
-
//#region extensions/llama-cpp/src/hardware.ts
|
|
6
|
+
// extensions/llama-cpp/src/hardware.ts
|
|
207
7
|
const GIB$2 = 1024 ** 3;
|
|
208
8
|
const MIB = 1024 ** 2;
|
|
209
9
|
async function runHardwareProbe(command, args, signal) {
|
|
@@ -223,7 +23,7 @@ async function runHardwareProbe(command, args, signal) {
|
|
|
223
23
|
}
|
|
224
24
|
async function readAvailableMemory(platform, signal) {
|
|
225
25
|
if (platform === "linux") {
|
|
226
|
-
const meminfo = await
|
|
26
|
+
const meminfo = await fsp.readFile("/proc/meminfo", "utf8").catch(() => "");
|
|
227
27
|
const available = /^MemAvailable:\s+(\d+)\s+kB$/mu.exec(meminfo)?.[1];
|
|
228
28
|
if (available) return Number(available) * 1024;
|
|
229
29
|
}
|
|
@@ -239,7 +39,7 @@ async function readAvailableMemory(platform, signal) {
|
|
|
239
39
|
async function readAvailableDisk(cacheDir, platform, signal) {
|
|
240
40
|
let directory = path.resolve(cacheDir);
|
|
241
41
|
while (true) try {
|
|
242
|
-
const [capacity, stat] = await Promise.all([
|
|
42
|
+
const [capacity, stat] = await Promise.all([fsp.statfs(directory), fsp.stat(directory)]);
|
|
243
43
|
let capacityGroup = `device:${stat.dev}`;
|
|
244
44
|
if (platform === "linux" && ![
|
|
245
45
|
61267,
|
|
@@ -329,8 +129,7 @@ async function detectLlamaCppHardware(params) {
|
|
|
329
129
|
function formatLlamaCppMemory(bytes) {
|
|
330
130
|
return `${(bytes / GIB$2).toFixed(1).replace(/\.0$/u, "")} GiB`;
|
|
331
131
|
}
|
|
332
|
-
|
|
333
|
-
//#region extensions/llama-cpp/src/model-catalog.ts
|
|
132
|
+
// extensions/llama-cpp/src/model-catalog.ts
|
|
334
133
|
const GIB$1 = 1024 ** 3;
|
|
335
134
|
function modelRecipe(params) {
|
|
336
135
|
const source = params.source ?? `hf:${params.repository}/${params.file}#${params.revision}`;
|
|
@@ -491,17 +290,14 @@ function resolveLlamaCppDiskBudget(hardware, backend, runtimeCached = false) {
|
|
|
491
290
|
function recommendLlamaCppModel(hardware, backend, cached = {}) {
|
|
492
291
|
const disk = resolveLlamaCppDiskBudget(hardware, backend, cached.runtime);
|
|
493
292
|
if (disk.kind === "unavailable") return disk;
|
|
494
|
-
const { modelDiskBudget
|
|
293
|
+
const { modelDiskBudget } = disk;
|
|
495
294
|
const { recipes: candidates, memoryBudgetBytes } = resolveLlamaCppModelCandidates(hardware, backend);
|
|
496
295
|
for (const recipe of candidates) {
|
|
497
|
-
|
|
498
|
-
if (modelDiskBudget < modelDiskBytes) continue;
|
|
296
|
+
if (modelDiskBudget < (cached.modelIds?.has(recipe.model.id) ? 0 : recipe.sizeBytes) + (cached.embedding ? 0 : 328577056)) continue;
|
|
499
297
|
const placement = backend === "metal" ? "Metal unified memory" : backend === "cuda" ? "NVIDIA GPU memory" : "CPU memory";
|
|
500
298
|
return {
|
|
501
299
|
kind: "recommended",
|
|
502
300
|
recipe,
|
|
503
|
-
memoryBudgetBytes,
|
|
504
|
-
requiredDiskBytes: modelDiskBytes + runtimeDiskBytes,
|
|
505
301
|
reason: `${recipe.model.name} fits the ${formatLlamaCppMemory(memoryBudgetBytes)} ${placement} budget with a 64K context. Runtime verification checks the actual model before activation.`
|
|
506
302
|
};
|
|
507
303
|
}
|
|
@@ -510,13 +306,10 @@ function recommendLlamaCppModel(hardware, backend, cached = {}) {
|
|
|
510
306
|
reason: candidates.length > 0 ? "There is not enough free disk space for a recommended model, embeddings, and the runtime. Free space in the model cache and retry setup." : `No recommended model fits the current ${formatLlamaCppMemory(Math.max(0, memoryBudgetBytes))} memory budget. Close other applications and retry, or configure an existing GGUF or external server. For local memory search without a chat model, an embedding-only local server (about 0.3 GB for the default embedding model) can fit instead. Set memory.search.provider to "local" with openclaw config set memory.search.provider local, then re-run openclaw models auth login --provider llama-cpp --method local using the same profile for both commands.`
|
|
511
307
|
};
|
|
512
308
|
}
|
|
513
|
-
|
|
514
|
-
//#region extensions/llama-cpp/src/media-catalog.ts
|
|
309
|
+
// extensions/llama-cpp/src/media-catalog.ts
|
|
515
310
|
const GIB = 1024 ** 3;
|
|
516
311
|
function artifact(repository, revision, filename, expectedSize, expectedSha256) {
|
|
517
312
|
return {
|
|
518
|
-
repository,
|
|
519
|
-
revision,
|
|
520
313
|
filename,
|
|
521
314
|
source: `hf:${repository}/${filename}#${revision}`,
|
|
522
315
|
fileName: `hf_${repository.replaceAll("/", "_")}_${revision}_${filename}`,
|
|
@@ -593,5 +386,4 @@ function recommendLlamaCppMedia(hardware, cached = {}) {
|
|
|
593
386
|
reason: `${ocr.name} (OCR, ${formatLlamaCppMemory(ocr.memoryBytes)}) and ${vision.name} (vision, ${formatLlamaCppMemory(vision.memoryBytes)}) fit the ${formatLlamaCppMemory(memoryBudgetBytes)} CPU memory budget. Load one model at a time, preserving the chat and embedding inventory. Images stay local; runtime verification must pass before activation.`
|
|
594
387
|
};
|
|
595
388
|
}
|
|
596
|
-
|
|
597
|
-
export { resolveLlamaCppCatalogArtifact as a, formatLlamaCppMemory as c, LLAMA_SERVER_RELEASE as d, findManagedLlamaServerAsset as f, recommendLlamaCppModel as i, LLAMA_SERVER_BUILD as l, selectLlamaServerAsset as m, recommendLlamaCppMedia as n, resolveLlamaCppModelCandidates as o, resolveManagedLlamaServerPaths as p, resolveLlamaCppMediaArtifact as r, detectLlamaCppHardware as s, LLAMA_CPP_MEDIA_RECIPES as t, LLAMA_SERVER_COMMIT as u };
|
|
389
|
+
export { resolveLlamaCppCatalogArtifact as a, formatLlamaCppMemory as c, recommendLlamaCppModel as i, recommendLlamaCppMedia as n, resolveLlamaCppModelCandidates as o, resolveLlamaCppMediaArtifact as r, detectLlamaCppHardware as s, LLAMA_CPP_MEDIA_RECIPES as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
2
|
import { shouldUseEnvHttpProxyForUrl } from "openclaw/plugin-sdk/fetch-runtime";
|
|
3
|
-
|
|
3
|
+
// extensions/llama-cpp/src/media-config.ts
|
|
4
4
|
const LLAMA_CPP_MEDIA_MAX_BYTES = 10485760;
|
|
5
5
|
const LLAMA_CPP_MEDIA_MAX_TOKENS = 2048;
|
|
6
6
|
const LLAMA_CPP_MEDIA_MAX_CHARS = 12e3;
|
|
@@ -26,5 +26,4 @@ function resolveLlamaCppMediaModels(provider) {
|
|
|
26
26
|
vision
|
|
27
27
|
} : void 0;
|
|
28
28
|
}
|
|
29
|
-
//#endregion
|
|
30
29
|
export { isManagedLlamaCppMediaProvider as a, LLAMA_CPP_MEDIA_TIMEOUT_MS as i, LLAMA_CPP_MEDIA_MAX_CHARS as n, resolveLlamaCppMediaModels as o, LLAMA_CPP_MEDIA_MAX_TOKENS as r, LLAMA_CPP_MEDIA_MAX_BYTES as t };
|
package/dist/.setup/{media-provider.runtime-MqV-UJ1m.mjs → media-provider.runtime-CW2ZQBg4.mjs}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { _ as LLAMA_CPP_PROVIDER_ID } from "./defaults-
|
|
2
|
-
import { a as isManagedLlamaCppMediaProvider, n as LLAMA_CPP_MEDIA_MAX_CHARS, o as resolveLlamaCppMediaModels, r as LLAMA_CPP_MEDIA_MAX_TOKENS } from "./media-config-
|
|
3
|
-
import { t as LLAMA_CPP_MEDIA_RECIPES } from "./media-catalog-
|
|
1
|
+
import { _ as LLAMA_CPP_PROVIDER_ID } from "./defaults-B-3wLNsP.mjs";
|
|
2
|
+
import { a as isManagedLlamaCppMediaProvider, n as LLAMA_CPP_MEDIA_MAX_CHARS, o as resolveLlamaCppMediaModels, r as LLAMA_CPP_MEDIA_MAX_TOKENS } from "./media-config-92b6iCHm.mjs";
|
|
3
|
+
import { t as LLAMA_CPP_MEDIA_RECIPES } from "./media-catalog-D-CRqGbe.mjs";
|
|
4
4
|
import { asOptionalRecord, truncateUtf16Safe } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { describeImageWithModel, describeImagesWithModel, describeImagesWithModelPayloadTransform } from "openclaw/plugin-sdk/media-understanding";
|
|
6
|
-
|
|
6
|
+
// extensions/llama-cpp/src/media-provider.runtime.ts
|
|
7
7
|
async function describeLlamaCppImages(req) {
|
|
8
8
|
const provider = req.cfg.models?.providers?.[LLAMA_CPP_PROVIDER_ID];
|
|
9
9
|
const routes = resolveLlamaCppMediaModels(provider);
|
|
@@ -68,5 +68,4 @@ async function describeLlamaCppImage(req) {
|
|
|
68
68
|
}]
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
|
-
//#endregion
|
|
72
71
|
export { describeLlamaCppImage, describeLlamaCppImages };
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { E as resolveLlamaCppModelCacheDir, _ as LLAMA_CPP_PROVIDER_ID, b as buildLlamaCppProviderConfig, w as resolveLlamaCppDataDir } from "./defaults-
|
|
2
|
-
import { a as isManagedLlamaCppMediaProvider, i as LLAMA_CPP_MEDIA_TIMEOUT_MS } from "./media-config-
|
|
3
|
-
import { c as formatLlamaCppMemory,
|
|
4
|
-
import { ensureLlamaCppModel, prepareManagedLlamaServer, r as ensureLlamaServerInstalled, resolveLlamaCppPresetPath, t as assertMediaPresetLimits } from "./managed-server-
|
|
1
|
+
import { E as resolveLlamaCppModelCacheDir, _ as LLAMA_CPP_PROVIDER_ID, b as buildLlamaCppProviderConfig, w as resolveLlamaCppDataDir } from "./defaults-B-3wLNsP.mjs";
|
|
2
|
+
import { a as isManagedLlamaCppMediaProvider, i as LLAMA_CPP_MEDIA_TIMEOUT_MS } from "./media-config-92b6iCHm.mjs";
|
|
3
|
+
import { c as formatLlamaCppMemory, n as recommendLlamaCppMedia, s as detectLlamaCppHardware, t as LLAMA_CPP_MEDIA_RECIPES } from "./media-catalog-D-CRqGbe.mjs";
|
|
4
|
+
import { a as resolveManagedLlamaServerPaths, ensureLlamaCppModel, o as selectLlamaServerAsset, prepareManagedLlamaServer, r as ensureLlamaServerInstalled, resolveLlamaCppPresetPath, t as assertMediaPresetLimits } from "./managed-server-CTer5Rq4.mjs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import os from "node:os";
|
|
7
|
-
import
|
|
8
|
-
|
|
7
|
+
import fsp from "node:fs/promises";
|
|
8
|
+
// extensions/llama-cpp/src/media-verification-fixtures.ts
|
|
9
9
|
const LLAMA_CPP_OCR_FIXTURE = Buffer.from("iVBORw0KGgoAAAANSUhEUgAAA+gAAADcAQAAAADL27ZvAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAd2KE6QAAAAHdElNRQfqCQ4IFRcssbVtAAAFjElEQVR42u3Zy27mJhQAYFyk8S7uMqvxa3QxqtX3qoLdvJiz6muw69a7skCm5wIYHP+piUbqSD2RJhfzm4+bjw+MCv/llxJddNFFF1100UUXXXTRRRdddNFFF1100UUXXXTRRRdddNFFF1100UUXXXTRRRdddNFF/7H1XZmry/PwoBKvHpSvI16e2vRN9SFY1cHtSimqQ4fg4MKu010zfGIKnkCr8AeVKzXGHnTYKroNKpsV1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2L9A9wKX5mE7qUT6ml4upjfVE2FPg5Rnp3CRnIy3ROHNizINZpHGuQ1yBLNMop2c6HXOpxji4xsE0izXGrCzzsJZrhJnRZkIv2ad0XveyCWHR5n90zUl6idioJ+nA7vEkvUBs2LynRpsIvXyf05H9wef04rAF870b6A5ghS/pzu70Jb00bMVc52WZhdVinlNTTUPtMce9gfYANjlN5/YPp+klYavmdjvQDcA289ocaAtgnzl9B/r+azSf34F+/3Way7Ww699W87gf6P5frzk8E/H8o9mX9M6EA89/y2V3Z9l/RfJ2jNsvJHfp23/PrZPMu3KfTtIfnLlIvC/s/V++u9j21fCB+Qf8ZLubE2w+4Fe725sf+Mb8NX5jW8+GPfvl93a2Mcn8o/nP3Gl30+eJ7Pvvyx/dbPJUrw92HnCv400l+MH5gzzIzSZOuD53+hsPtrs3cX57fvvxKDvX7yer7/21K18e79XVJPldufJgVe/WvS2z/9aXH2t5e7ZyfWfqYwoXl49/Tvzm0n4XJvTq9fnhA9s7PH/tZx8bcHJ8evbnjYMHZ6fHJ+k/k2Xb2X3y9Nne/vODFy9vvxMPX744eL6/9+zpk12/+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB+8F914nYCHOlTpgAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyNi0wOS0xNFQwODoxNzo0MCswMDowMA6iP0UAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjYtMDktMTRUMDg6MTc6NDArMDA6MDB//4f5AAAAAElFTkSuQmCC", "base64");
|
|
11
|
-
|
|
12
|
-
//#region extensions/llama-cpp/src/media-setup.ts
|
|
11
|
+
// extensions/llama-cpp/src/media-setup.ts
|
|
13
12
|
function modelDefinition(recipe, device, baseUrl) {
|
|
14
13
|
return {
|
|
15
14
|
id: recipe.id,
|
|
@@ -71,7 +70,7 @@ async function runLlamaCppMediaSetup(ctx, mediaProvider) {
|
|
|
71
70
|
});
|
|
72
71
|
if (file) cached.set(artifact.expectedSha256, file);
|
|
73
72
|
}
|
|
74
|
-
const runtimeCached = await
|
|
73
|
+
const runtimeCached = await fsp.stat(resolveManagedLlamaServerPaths(asset).command).then((stat) => stat.isFile()).catch(() => false);
|
|
75
74
|
const recommendation = recommendLlamaCppMedia(hardware, {
|
|
76
75
|
artifactSha256: new Set(cached.keys()),
|
|
77
76
|
runtime: runtimeCached
|
|
@@ -209,8 +208,8 @@ async function runLlamaCppMediaSetup(ctx, mediaProvider) {
|
|
|
209
208
|
}
|
|
210
209
|
}
|
|
211
210
|
};
|
|
212
|
-
await
|
|
213
|
-
verificationDir = await
|
|
211
|
+
await fsp.mkdir(resolveLlamaCppDataDir(), { recursive: true });
|
|
212
|
+
verificationDir = await fsp.mkdtemp(path.join(resolveLlamaCppDataDir(), ".media-verify-"));
|
|
214
213
|
const candidateProvider = {
|
|
215
214
|
...provider,
|
|
216
215
|
localService: {
|
|
@@ -263,12 +262,11 @@ async function runLlamaCppMediaSetup(ctx, mediaProvider) {
|
|
|
263
262
|
progress.stop("Local media setup failed; previous configuration retained");
|
|
264
263
|
throw error;
|
|
265
264
|
} finally {
|
|
266
|
-
if (!verified && presetPath) await
|
|
267
|
-
if (verificationDir) await
|
|
265
|
+
if (!verified && presetPath) await fsp.rm(presetPath, { force: true });
|
|
266
|
+
if (verificationDir) await fsp.rm(verificationDir, {
|
|
268
267
|
recursive: true,
|
|
269
268
|
force: true
|
|
270
269
|
});
|
|
271
270
|
}
|
|
272
271
|
}
|
|
273
|
-
//#endregion
|
|
274
272
|
export { runLlamaCppMediaSetup };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { _ as LLAMA_CPP_PROVIDER_ID } from "./defaults-
|
|
2
|
-
import { r as resolveLlamaServerEndpoint, s as hasLlamaServerAuthorizationHeader } from "./provider-discovery-
|
|
3
|
-
import { i as resolveLlamaServerRuntimeApiKey, n as buildLlamaServerProviderConfig, r as resolveLlamaServerProviderHeaders, t as discoverLlamaServer } from "./discovery-
|
|
1
|
+
import { _ as LLAMA_CPP_PROVIDER_ID } from "./defaults-B-3wLNsP.mjs";
|
|
2
|
+
import { r as resolveLlamaServerEndpoint, s as hasLlamaServerAuthorizationHeader } from "./provider-discovery-6Hy2SktE.mjs";
|
|
3
|
+
import { i as resolveLlamaServerRuntimeApiKey, n as buildLlamaServerProviderConfig, r as resolveLlamaServerProviderHeaders, t as discoverLlamaServer } from "./discovery-BzqfGNU5.mjs";
|
|
4
4
|
import { isNonSecretApiKeyMarker } from "openclaw/plugin-sdk/provider-auth";
|
|
5
5
|
import { LiveModelCatalogHttpError, runLiveProviderCatalog } from "openclaw/plugin-sdk/provider-catalog-live-runtime";
|
|
6
|
-
|
|
7
|
-
/** Discovers external llama-server models for provider runtime resolution. */
|
|
6
|
+
// extensions/llama-cpp/src/external-server/provider.ts
|
|
8
7
|
async function discoverLlamaServerProvider(ctx) {
|
|
9
8
|
const configured = ctx.config.models?.providers?.[LLAMA_CPP_PROVIDER_ID];
|
|
10
9
|
const auth = ctx.resolveProviderApiKey(LLAMA_CPP_PROVIDER_ID);
|
|
@@ -59,9 +58,7 @@ async function prepareLlamaServerDynamicModel(ctx) {
|
|
|
59
58
|
...model.config,
|
|
60
59
|
provider: LLAMA_CPP_PROVIDER_ID,
|
|
61
60
|
api: ctx.providerConfig?.api ?? "openai-completions",
|
|
62
|
-
baseUrl: resolveLlamaServerEndpoint(ctx.providerConfig?.baseUrl).inferenceBaseUrl
|
|
63
|
-
input: model.config.input.filter((entry) => entry === "text" || entry === "image")
|
|
61
|
+
baseUrl: resolveLlamaServerEndpoint(ctx.providerConfig?.baseUrl).inferenceBaseUrl
|
|
64
62
|
};
|
|
65
63
|
}
|
|
66
|
-
//#endregion
|
|
67
64
|
export { discoverLlamaServerProvider, prepareLlamaServerDynamicModel };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { _ as LLAMA_CPP_PROVIDER_ID, b as buildLlamaCppProviderConfig, g as LLAMA_CPP_LOCAL_AUTH_MARKER, v as LLAMA_CPP_PROVIDER_LABEL } from "./defaults-
|
|
1
|
+
import { _ as LLAMA_CPP_PROVIDER_ID, b as buildLlamaCppProviderConfig, g as LLAMA_CPP_LOCAL_AUTH_MARKER, v as LLAMA_CPP_PROVIDER_LABEL } from "./defaults-B-3wLNsP.mjs";
|
|
2
2
|
import { asOptionalRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import { CUSTOM_LOCAL_AUTH_MARKER, hasConfiguredSecretInput, normalizeOptionalSecretInput } from "openclaw/plugin-sdk/provider-auth";
|
|
4
|
-
|
|
4
|
+
// extensions/llama-cpp/src/external-server/auth-policy.ts
|
|
5
5
|
function hasLlamaServerAuthorizationHeader(headers) {
|
|
6
6
|
const record = asOptionalRecord(headers);
|
|
7
7
|
if (!record) return false;
|
|
@@ -11,13 +11,11 @@ function shouldUseLlamaServerSyntheticAuth(providerConfig) {
|
|
|
11
11
|
const apiKey = normalizeOptionalSecretInput(providerConfig?.apiKey)?.trim();
|
|
12
12
|
return !(hasConfiguredSecretInput(providerConfig?.apiKey) && apiKey !== "llama-cpp-local" && apiKey !== CUSTOM_LOCAL_AUTH_MARKER);
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
//#region extensions/llama-cpp/src/external-server/defaults.ts
|
|
14
|
+
// extensions/llama-cpp/src/external-server/defaults.ts
|
|
16
15
|
const LLAMA_SERVER_DEFAULT_ORIGIN = "http://127.0.0.1:8080";
|
|
17
16
|
const LLAMA_SERVER_DEFAULT_API_KEY_ENV_VAR = "LLAMA_SERVER_API_KEY";
|
|
18
17
|
const LLAMA_SERVER_DISCOVERY_TIMEOUT_MS = 5e3;
|
|
19
|
-
|
|
20
|
-
//#region extensions/llama-cpp/src/external-server/endpoint.ts
|
|
18
|
+
// extensions/llama-cpp/src/external-server/endpoint.ts
|
|
21
19
|
/** Resolves the server origin and its OpenAI-compatible `/v1` inference base. */
|
|
22
20
|
function resolveLlamaServerEndpoint(configuredBaseUrl) {
|
|
23
21
|
const configured = configuredBaseUrl?.trim() || "http://127.0.0.1:8080";
|
|
@@ -48,8 +46,7 @@ function normalizeLlamaServerProviderConfig(provider) {
|
|
|
48
46
|
request: normalizedRequest
|
|
49
47
|
};
|
|
50
48
|
}
|
|
51
|
-
|
|
52
|
-
//#region extensions/llama-cpp/provider-discovery.ts
|
|
49
|
+
// extensions/llama-cpp/provider-discovery.ts
|
|
53
50
|
var provider_discovery_default = {
|
|
54
51
|
id: LLAMA_CPP_PROVIDER_ID,
|
|
55
52
|
label: LLAMA_CPP_PROVIDER_LABEL,
|
|
@@ -64,7 +61,7 @@ var provider_discovery_default = {
|
|
|
64
61
|
existing: configured,
|
|
65
62
|
modelInventory: configured.models
|
|
66
63
|
}) };
|
|
67
|
-
const { discoverLlamaServerProvider } = await import("./provider-
|
|
64
|
+
const { discoverLlamaServerProvider } = await import("./provider-abJEzh8u.mjs");
|
|
68
65
|
return await discoverLlamaServerProvider(ctx);
|
|
69
66
|
}
|
|
70
67
|
},
|
|
@@ -80,5 +77,4 @@ var provider_discovery_default = {
|
|
|
80
77
|
shouldDeferSyntheticProfileAuth: ({ resolvedApiKey }) => resolvedApiKey?.trim() === "llama-cpp-local" || resolvedApiKey?.trim() === CUSTOM_LOCAL_AUTH_MARKER,
|
|
81
78
|
normalizeConfig: ({ providerConfig }) => providerConfig.localService ? providerConfig : normalizeLlamaServerProviderConfig(providerConfig)
|
|
82
79
|
};
|
|
83
|
-
//#endregion
|
|
84
80
|
export { LLAMA_SERVER_DEFAULT_ORIGIN as a, LLAMA_SERVER_DEFAULT_API_KEY_ENV_VAR as i, normalizeLlamaServerProviderConfig as n, LLAMA_SERVER_DISCOVERY_TIMEOUT_MS as o, resolveLlamaServerEndpoint as r, hasLlamaServerAuthorizationHeader as s, provider_discovery_default as t };
|