@openclaw/llama-cpp-provider 2026.8.1-beta.2 → 2026.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.
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import os from "node:os";
|
|
2
1
|
import path from "node:path";
|
|
2
|
+
import os from "node:os";
|
|
3
3
|
import { resolveStateDir } from "openclaw/plugin-sdk/state-paths";
|
|
4
|
+
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
5
|
//#region extensions/llama-cpp/src/defaults.ts
|
|
5
6
|
const LLAMA_CPP_PROVIDER_ID = "llama-cpp";
|
|
6
7
|
const LLAMA_CPP_PROVIDER_LABEL = "llama.cpp";
|
|
@@ -12,7 +13,6 @@ function resolveLlamaCppSyntheticApiKey() {
|
|
|
12
13
|
return LLAMA_CPP_LOCAL_AUTH_MARKER;
|
|
13
14
|
}
|
|
14
15
|
const DEFAULT_LLAMA_CPP_MODEL_ID = "gemma-4-e4b-it-q4_k_m";
|
|
15
|
-
const DEFAULT_LLAMA_CPP_MODEL_REF = `${LLAMA_CPP_PROVIDER_ID}/${DEFAULT_LLAMA_CPP_MODEL_ID}`;
|
|
16
16
|
const DEFAULT_LLAMA_CPP_MODEL_URI = "hf:unsloth/gemma-4-E4B-it-GGUF/gemma-4-E4B-it-Q4_K_M.gguf";
|
|
17
17
|
const DEFAULT_LLAMA_CPP_MODEL_REVISION = "bfc15c382204943c3a8fff0c750b94ae2364d7a3";
|
|
18
18
|
const DEFAULT_LLAMA_CPP_MODEL_CACHE_FILE = "hf_unsloth_gemma-4-E4B-it-GGUF_gemma-4-E4B-it-Q4_K_M.gguf";
|
|
@@ -39,6 +39,16 @@ function resolveLlamaCppModelCacheDir(provider) {
|
|
|
39
39
|
function resolveLegacyLlamaCppModelCacheDir() {
|
|
40
40
|
return path.join(os.homedir(), ".node-llama-cpp", "models");
|
|
41
41
|
}
|
|
42
|
+
function resolveLlamaCppEmbeddingModel(local = {}) {
|
|
43
|
+
const source = normalizeOptionalString(local.modelPath) ?? "hf:ggml-org/embeddinggemma-300m-qat-q8_0-GGUF/embeddinggemma-300m-qat-Q8_0.gguf";
|
|
44
|
+
const cacheDir = normalizeOptionalString(local.modelCacheDir) ?? resolveLlamaCppModelCacheDir();
|
|
45
|
+
const resolvedPath = /^(?:hf:|https?:\/\/)/iu.test(source) ? void 0 : path.resolve(cacheDir, source);
|
|
46
|
+
return {
|
|
47
|
+
source,
|
|
48
|
+
cacheDir,
|
|
49
|
+
isDefault: source === "hf:ggml-org/embeddinggemma-300m-qat-q8_0-GGUF/embeddinggemma-300m-qat-Q8_0.gguf" || resolvedPath === path.resolve(cacheDir, "hf_ggml-org_embeddinggemma-300m-qat-Q8_0.gguf") || resolvedPath === path.resolve(resolveLegacyLlamaCppModelCacheDir(), "hf_ggml-org_embeddinggemma-300m-qat-Q8_0.gguf")
|
|
50
|
+
};
|
|
51
|
+
}
|
|
42
52
|
function resolveHomePath(value) {
|
|
43
53
|
if (value === "~") return os.homedir();
|
|
44
54
|
if (value.startsWith("~/")) return path.join(os.homedir(), value.slice(2));
|
|
@@ -83,10 +93,11 @@ function buildDefaultLlamaCppModel() {
|
|
|
83
93
|
}
|
|
84
94
|
};
|
|
85
95
|
}
|
|
86
|
-
function buildLlamaCppProviderConfig(
|
|
96
|
+
function buildLlamaCppProviderConfig(params = {}) {
|
|
97
|
+
const { existing, managed, modelInventory } = params;
|
|
87
98
|
const defaultModel = buildDefaultLlamaCppModel();
|
|
88
99
|
const configuredModels = existing?.models ?? [];
|
|
89
|
-
const models = configuredModels.some((model) => model.id === defaultModel.id) ? configuredModels : [...configuredModels, defaultModel];
|
|
100
|
+
const models = modelInventory ?? (configuredModels.some((model) => model.id === defaultModel.id) ? configuredModels : [...configuredModels, defaultModel]);
|
|
90
101
|
return {
|
|
91
102
|
...existing,
|
|
92
103
|
baseUrl: managed?.baseUrl ?? existing?.baseUrl ?? `http://127.0.0.1:19432/v1`,
|
|
@@ -104,78 +115,12 @@ function buildLlamaCppProviderConfig(existing, managed) {
|
|
|
104
115
|
};
|
|
105
116
|
}
|
|
106
117
|
//#endregion
|
|
107
|
-
//#region extensions/llama-cpp/src/
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
platform: "darwin",
|
|
114
|
-
arch: "arm64",
|
|
115
|
-
backend: "metal",
|
|
116
|
-
archive: "tar.gz",
|
|
117
|
-
name: `llama-${LLAMA_SERVER_RELEASE}-bin-macos-arm64.tar.gz`,
|
|
118
|
-
sha256: "7f464a2d473d53ebb9c1d7d16db1258ec98c371569816491850686e6a4334c52",
|
|
119
|
-
executable: "llama-server"
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
platform: "darwin",
|
|
123
|
-
arch: "x64",
|
|
124
|
-
backend: "cpu",
|
|
125
|
-
archive: "tar.gz",
|
|
126
|
-
name: `llama-${LLAMA_SERVER_RELEASE}-bin-macos-x64.tar.gz`,
|
|
127
|
-
sha256: "8282cf6b30bfab87080044e98b7b78f2896bfc60414926fae6039a89c0fb6ec2",
|
|
128
|
-
executable: "llama-server"
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
platform: "linux",
|
|
132
|
-
arch: "arm64",
|
|
133
|
-
backend: "cpu",
|
|
134
|
-
archive: "tar.gz",
|
|
135
|
-
name: `llama-${LLAMA_SERVER_RELEASE}-bin-ubuntu-arm64.tar.gz`,
|
|
136
|
-
sha256: "0653b6aa14de35920824045bca7e48f98f629f41943d0fefab1e317bbe8e22a8",
|
|
137
|
-
executable: "llama-server"
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
platform: "linux",
|
|
141
|
-
arch: "x64",
|
|
142
|
-
backend: "cpu",
|
|
143
|
-
archive: "tar.gz",
|
|
144
|
-
name: `llama-${LLAMA_SERVER_RELEASE}-bin-ubuntu-x64.tar.gz`,
|
|
145
|
-
sha256: "6b0ba012036e6d727521100158bfcaa73b460fbb31acab2931c9485f347bd16b",
|
|
146
|
-
executable: "llama-server"
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
platform: "win32",
|
|
150
|
-
arch: "arm64",
|
|
151
|
-
backend: "cpu",
|
|
152
|
-
archive: "zip",
|
|
153
|
-
name: `llama-${LLAMA_SERVER_RELEASE}-bin-win-cpu-arm64.zip`,
|
|
154
|
-
sha256: "a0d73be8d3151d9401fa193f1b83c6d7401191b41786e75f0a60184058333e86",
|
|
155
|
-
executable: "llama-server.exe"
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
platform: "win32",
|
|
159
|
-
arch: "x64",
|
|
160
|
-
backend: "cpu",
|
|
161
|
-
archive: "zip",
|
|
162
|
-
name: `llama-${LLAMA_SERVER_RELEASE}-bin-win-cpu-x64.zip`,
|
|
163
|
-
sha256: "6c64cc7db679980fcb34bbbe96b2b1df6127e90ccdad2bd6fbe39532fee2fc4e",
|
|
164
|
-
executable: "llama-server.exe"
|
|
165
|
-
}
|
|
166
|
-
];
|
|
167
|
-
function selectLlamaServerAsset(platform = process.platform, arch = process.arch) {
|
|
168
|
-
const asset = LLAMA_SERVER_ASSETS.find((candidate) => candidate.platform === platform && candidate.arch === arch);
|
|
169
|
-
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.`);
|
|
170
|
-
return asset;
|
|
171
|
-
}
|
|
172
|
-
function resolveManagedLlamaServerPaths(asset = selectLlamaServerAsset()) {
|
|
173
|
-
const installDir = path.join(resolveLlamaCppDataDir(), LLAMA_SERVER_RELEASE, `${asset.platform}-${asset.arch}`);
|
|
174
|
-
return {
|
|
175
|
-
installDir,
|
|
176
|
-
command: path.join(installDir, asset.executable),
|
|
177
|
-
presetPath: path.join(resolveLlamaCppDataDir(), "models.ini")
|
|
178
|
-
};
|
|
118
|
+
//#region extensions/llama-cpp/src/managed-provider-config.ts
|
|
119
|
+
const MANAGED_LLAMA_CPP_CONFIG_REQUIRED_MESSAGE = "Local embeddings need the managed llama.cpp server config. Run `openclaw configure`, choose llama.cpp once, then retry `openclaw memory status --deep`.";
|
|
120
|
+
function resolveManagedLlamaCppProviderConfig(config) {
|
|
121
|
+
const provider = config.models?.providers?.[LLAMA_CPP_PROVIDER_ID];
|
|
122
|
+
if (!provider?.localService || !provider.baseUrl) throw new Error(MANAGED_LLAMA_CPP_CONFIG_REQUIRED_MESSAGE);
|
|
123
|
+
return provider;
|
|
179
124
|
}
|
|
180
125
|
//#endregion
|
|
181
|
-
export {
|
|
126
|
+
export { resolveLegacyLlamaCppModelCacheDir as C, resolveLlamaCppModelSource as D, resolveLlamaCppModelCacheDir as E, resolveLlamaCppSyntheticApiKey as O, resolveHomePath as S, resolveLlamaCppEmbeddingModel as T, LLAMA_CPP_PROVIDER_ID as _, DEFAULT_LLAMA_CPP_EMBEDDING_MODEL as a, meetsLlamaCppDefaultModelRamFloor as b, DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_SHA256 as c, DEFAULT_LLAMA_CPP_MODEL_ID as d, DEFAULT_LLAMA_CPP_MODEL_REVISION as f, LLAMA_CPP_DEFAULT_PORT as g, DEFAULT_LLAMA_CPP_MODEL_URI as h, DEFAULT_LLAMA_CPP_EMBEDDING_CACHE_FILE as i, DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_SIZE_BYTES as l, DEFAULT_LLAMA_CPP_MODEL_SIZE_BYTES as m, resolveManagedLlamaCppProviderConfig as n, DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_ID as o, DEFAULT_LLAMA_CPP_MODEL_SHA256 as p, DEFAULT_LLAMA_CPP_CONTEXT_SIZE as r, DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_REVISION as s, MANAGED_LLAMA_CPP_CONFIG_REQUIRED_MESSAGE as t, DEFAULT_LLAMA_CPP_MODEL_CACHE_FILE as u, LLAMA_CPP_PROVIDER_LABEL as v, resolveLlamaCppDataDir as w, resolveCachedLlamaCppModelPath as x, buildLlamaCppProviderConfig as y };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { n as resolveManagedLlamaCppProviderConfig, t as MANAGED_LLAMA_CPP_CONFIG_REQUIRED_MESSAGE } from "./managed-provider-config-C9_YC5Rd.js";
|
|
2
|
+
//#region extensions/llama-cpp/provider-policy-api.ts
|
|
3
|
+
function inspectEmbeddingProviderSetup(params) {
|
|
4
|
+
if (params.provider !== "local") return null;
|
|
5
|
+
const fixHint = `Run \`openclaw models --agent ${params.agentId} auth login --provider llama-cpp --method local\` in an interactive terminal, then rerun this check.`;
|
|
6
|
+
try {
|
|
7
|
+
resolveManagedLlamaCppProviderConfig(params.config);
|
|
8
|
+
} catch {
|
|
9
|
+
return {
|
|
10
|
+
provider: params.provider,
|
|
11
|
+
reason: MANAGED_LLAMA_CPP_CONFIG_REQUIRED_MESSAGE,
|
|
12
|
+
requirement: "managed-llama-cpp-setup",
|
|
13
|
+
fixHint
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { inspectEmbeddingProviderSetup };
|
package/openclaw.plugin.json
CHANGED
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "llama-cpp",
|
|
3
3
|
"name": "llama.cpp Provider",
|
|
4
|
-
"description": "Managed
|
|
5
|
-
"doctorContract": {
|
|
6
|
-
"configRepair": true
|
|
7
|
-
},
|
|
4
|
+
"description": "Managed and external llama.cpp servers for GGUF chat and embeddings.",
|
|
8
5
|
"activation": {
|
|
9
6
|
"onStartup": false
|
|
10
7
|
},
|
|
11
8
|
"enabledByDefault": true,
|
|
9
|
+
"autoEnableWhenConfiguredProviders": ["llama-cpp"],
|
|
12
10
|
"providers": ["llama-cpp"],
|
|
11
|
+
"modelCatalog": {
|
|
12
|
+
"discovery": {
|
|
13
|
+
"llama-cpp": "refreshable"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
13
16
|
"providerRequest": {
|
|
14
17
|
"providers": {
|
|
15
18
|
"llama-cpp": {
|
|
16
|
-
"family": "llama-cpp"
|
|
19
|
+
"family": "llama-cpp",
|
|
20
|
+
"openAICompletions": {
|
|
21
|
+
"supportsStreamingUsage": true
|
|
22
|
+
}
|
|
17
23
|
}
|
|
18
24
|
}
|
|
19
25
|
},
|
|
@@ -26,6 +32,14 @@
|
|
|
26
32
|
},
|
|
27
33
|
"syntheticAuthRefs": ["llama-cpp"],
|
|
28
34
|
"nonSecretAuthMarkers": ["llama-cpp-local"],
|
|
35
|
+
"setup": {
|
|
36
|
+
"providers": [
|
|
37
|
+
{
|
|
38
|
+
"id": "llama-cpp",
|
|
39
|
+
"envVars": ["LLAMA_SERVER_API_KEY"]
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
},
|
|
29
43
|
"providerAuthChoices": [
|
|
30
44
|
{
|
|
31
45
|
"provider": "llama-cpp",
|
|
@@ -33,11 +47,27 @@
|
|
|
33
47
|
"choiceId": "llama-cpp",
|
|
34
48
|
"appGuidedDiscovery": true,
|
|
35
49
|
"appGuidedActionLabel": "Set up model",
|
|
36
|
-
"choiceLabel": "
|
|
50
|
+
"choiceLabel": "Managed local server",
|
|
37
51
|
"choiceHint": "Install a verified llama.cpp server and run a private GGUF model managed by OpenClaw",
|
|
38
52
|
"groupId": "llama-cpp",
|
|
39
53
|
"groupLabel": "Local llama.cpp",
|
|
40
|
-
"groupHint": "
|
|
54
|
+
"groupHint": "Managed or external llama.cpp server"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"provider": "llama-cpp",
|
|
58
|
+
"method": "existing-server",
|
|
59
|
+
"choiceId": "llama-cpp-existing-server",
|
|
60
|
+
"appGuidedDiscovery": true,
|
|
61
|
+
"appGuidedSecret": true,
|
|
62
|
+
"choiceLabel": "Existing llama-server",
|
|
63
|
+
"choiceHint": "Connect to a llama.cpp server managed outside OpenClaw",
|
|
64
|
+
"groupId": "llama-cpp",
|
|
65
|
+
"groupLabel": "Local llama.cpp",
|
|
66
|
+
"groupHint": "Managed or external llama.cpp server",
|
|
67
|
+
"optionKey": "llamaServerApiKey",
|
|
68
|
+
"cliFlag": "--llama-server-api-key",
|
|
69
|
+
"cliOption": "--llama-server-api-key <key>",
|
|
70
|
+
"cliDescription": "llama-server API key"
|
|
41
71
|
}
|
|
42
72
|
],
|
|
43
73
|
"contracts": {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/llama-cpp-provider",
|
|
3
|
-
"version": "2026.8.1
|
|
4
|
-
"description": "OpenClaw managed llama.cpp
|
|
3
|
+
"version": "2026.8.1",
|
|
4
|
+
"description": "OpenClaw provider for managed and external llama.cpp servers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/openclaw/openclaw"
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"minHostVersion": ">=2026.6.2"
|
|
25
25
|
},
|
|
26
26
|
"compat": {
|
|
27
|
-
"pluginApi": ">=2026.8.1
|
|
27
|
+
"pluginApi": ">=2026.8.1"
|
|
28
28
|
},
|
|
29
29
|
"build": {
|
|
30
|
-
"openclawVersion": "2026.8.1
|
|
30
|
+
"openclawVersion": "2026.8.1"
|
|
31
31
|
},
|
|
32
32
|
"release": {
|
|
33
33
|
"bundleRuntimeDependencies": false,
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"README.md"
|
|
45
45
|
],
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"openclaw": ">=2026.8.1
|
|
47
|
+
"openclaw": ">=2026.8.1"
|
|
48
48
|
},
|
|
49
49
|
"peerDependenciesMeta": {
|
|
50
50
|
"openclaw": {
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { C as buildLlamaCppProviderConfig, a as selectLlamaServerAsset, b as LLAMA_CPP_DEFAULT_PORT, i as resolveManagedLlamaServerPaths, x as LLAMA_CPP_PROVIDER_ID } from "./llama-server-assets-BEF3s_UC.js";
|
|
2
|
-
//#region extensions/llama-cpp/doctor-contract-api.ts
|
|
3
|
-
const LEGACY_BASE_URL = "local://llama-cpp";
|
|
4
|
-
const PROVIDER_PATH = "models.providers.llama-cpp";
|
|
5
|
-
const legacyConfigRules = [{
|
|
6
|
-
path: [
|
|
7
|
-
"models",
|
|
8
|
-
"providers",
|
|
9
|
-
LLAMA_CPP_PROVIDER_ID,
|
|
10
|
-
"baseUrl"
|
|
11
|
-
],
|
|
12
|
-
message: `${PROVIDER_PATH}.baseUrl uses the retired in-process runtime. Run "openclaw doctor --fix", then rerun interactive llama.cpp setup.`,
|
|
13
|
-
match: (value) => value === LEGACY_BASE_URL
|
|
14
|
-
}];
|
|
15
|
-
function normalizeCompatibilityConfig({ cfg }) {
|
|
16
|
-
const provider = cfg.models?.providers?.[LLAMA_CPP_PROVIDER_ID];
|
|
17
|
-
if (provider?.baseUrl !== LEGACY_BASE_URL) return {
|
|
18
|
-
config: cfg,
|
|
19
|
-
changes: []
|
|
20
|
-
};
|
|
21
|
-
const { command, presetPath } = resolveManagedLlamaServerPaths(selectLlamaServerAsset());
|
|
22
|
-
const rootUrl = `http://127.0.0.1:${LLAMA_CPP_DEFAULT_PORT}`;
|
|
23
|
-
const managed = {
|
|
24
|
-
command,
|
|
25
|
-
baseUrl: `${rootUrl}/v1`,
|
|
26
|
-
healthUrl: `${rootUrl}/health`,
|
|
27
|
-
args: [
|
|
28
|
-
"--host",
|
|
29
|
-
"127.0.0.1",
|
|
30
|
-
"--port",
|
|
31
|
-
String(LLAMA_CPP_DEFAULT_PORT),
|
|
32
|
-
"--models-preset",
|
|
33
|
-
presetPath,
|
|
34
|
-
"--models-max",
|
|
35
|
-
"2",
|
|
36
|
-
"--metrics",
|
|
37
|
-
"--no-ui"
|
|
38
|
-
]
|
|
39
|
-
};
|
|
40
|
-
return {
|
|
41
|
-
config: {
|
|
42
|
-
...cfg,
|
|
43
|
-
models: {
|
|
44
|
-
...cfg.models,
|
|
45
|
-
providers: {
|
|
46
|
-
...cfg.models?.providers,
|
|
47
|
-
[LLAMA_CPP_PROVIDER_ID]: buildLlamaCppProviderConfig(provider, managed)
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
changes: [`${PROVIDER_PATH}: migrated from the retired in-process runtime to managed llama-server; rerun interactive llama.cpp setup to verify/install runtime artifacts`]
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
//#endregion
|
|
55
|
-
export { legacyConfigRules, normalizeCompatibilityConfig };
|