@openclaw/llama-cpp-provider 2026.9.1-beta.1 → 2026.9.2
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,18 +1,18 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
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";
|
|
7
8
|
const LLAMA_CPP_LOCAL_AUTH_MARKER = "llama-cpp-local";
|
|
8
9
|
const LLAMA_CPP_DEFAULT_PORT = 19432;
|
|
9
10
|
const LLAMA_CPP_READY_TIMEOUT_MS = 3e4;
|
|
10
|
-
const LLAMA_CPP_IDLE_STOP_MS =
|
|
11
|
+
const LLAMA_CPP_IDLE_STOP_MS = 6e5;
|
|
11
12
|
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";
|
|
@@ -25,10 +25,6 @@ const DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_ID = "embeddinggemma-300m-qat-q8_0";
|
|
|
25
25
|
const DEFAULT_LLAMA_CPP_EMBEDDING_CACHE_FILE = "hf_ggml-org_embeddinggemma-300m-qat-Q8_0.gguf";
|
|
26
26
|
const DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_SIZE_BYTES = 328577056;
|
|
27
27
|
const DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_SHA256 = "6fa0c02a9c302be6f977521d399b4de3a46310a4f2621ee0063747881b673f67";
|
|
28
|
-
const LLAMA_CPP_DEFAULT_MODEL_RAM_FLOOR_BYTES = 16 * 1024 ** 3;
|
|
29
|
-
function meetsLlamaCppDefaultModelRamFloor(totalmemBytes = os.totalmem()) {
|
|
30
|
-
return totalmemBytes >= LLAMA_CPP_DEFAULT_MODEL_RAM_FLOOR_BYTES;
|
|
31
|
-
}
|
|
32
28
|
function resolveLlamaCppDataDir() {
|
|
33
29
|
return path.join(resolveStateDir(), "tools", "llama.cpp");
|
|
34
30
|
}
|
|
@@ -39,6 +35,16 @@ function resolveLlamaCppModelCacheDir(provider) {
|
|
|
39
35
|
function resolveLegacyLlamaCppModelCacheDir() {
|
|
40
36
|
return path.join(os.homedir(), ".node-llama-cpp", "models");
|
|
41
37
|
}
|
|
38
|
+
function resolveLlamaCppEmbeddingModel(local = {}) {
|
|
39
|
+
const source = normalizeOptionalString(local.modelPath) ?? "hf:ggml-org/embeddinggemma-300m-qat-q8_0-GGUF/embeddinggemma-300m-qat-Q8_0.gguf";
|
|
40
|
+
const cacheDir = normalizeOptionalString(local.modelCacheDir) ?? resolveLlamaCppModelCacheDir();
|
|
41
|
+
const resolvedPath = /^(?:hf:|https?:\/\/)/iu.test(source) ? void 0 : path.resolve(cacheDir, source);
|
|
42
|
+
return {
|
|
43
|
+
source,
|
|
44
|
+
cacheDir,
|
|
45
|
+
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")
|
|
46
|
+
};
|
|
47
|
+
}
|
|
42
48
|
function resolveHomePath(value) {
|
|
43
49
|
if (value === "~") return os.homedir();
|
|
44
50
|
if (value.startsWith("~/")) return path.join(os.homedir(), value.slice(2));
|
|
@@ -83,10 +89,11 @@ function buildDefaultLlamaCppModel() {
|
|
|
83
89
|
}
|
|
84
90
|
};
|
|
85
91
|
}
|
|
86
|
-
function buildLlamaCppProviderConfig(
|
|
92
|
+
function buildLlamaCppProviderConfig(params = {}) {
|
|
93
|
+
const { existing, managed, modelInventory } = params;
|
|
87
94
|
const defaultModel = buildDefaultLlamaCppModel();
|
|
88
95
|
const configuredModels = existing?.models ?? [];
|
|
89
|
-
const models = configuredModels.some((model) => model.id === defaultModel.id) ? configuredModels : [...configuredModels, defaultModel];
|
|
96
|
+
const models = modelInventory ?? (configuredModels.some((model) => model.id === defaultModel.id) ? configuredModels : [...configuredModels, defaultModel]);
|
|
90
97
|
return {
|
|
91
98
|
...existing,
|
|
92
99
|
baseUrl: managed?.baseUrl ?? existing?.baseUrl ?? `http://127.0.0.1:19432/v1`,
|
|
@@ -112,4 +119,4 @@ function resolveManagedLlamaCppProviderConfig(config) {
|
|
|
112
119
|
return provider;
|
|
113
120
|
}
|
|
114
121
|
//#endregion
|
|
115
|
-
export {
|
|
122
|
+
export { resolveLlamaCppDataDir as C, resolveLlamaCppSyntheticApiKey as D, resolveLlamaCppModelSource as E, resolveLegacyLlamaCppModelCacheDir as S, resolveLlamaCppModelCacheDir as T, LLAMA_CPP_PROVIDER_ID as _, DEFAULT_LLAMA_CPP_EMBEDDING_MODEL as a, resolveCachedLlamaCppModelPath 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, resolveLlamaCppEmbeddingModel as w, resolveHomePath as x, buildLlamaCppProviderConfig as y };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as resolveManagedLlamaCppProviderConfig, t as MANAGED_LLAMA_CPP_CONFIG_REQUIRED_MESSAGE } from "./managed-provider-config-
|
|
1
|
+
import { n as resolveManagedLlamaCppProviderConfig, t as MANAGED_LLAMA_CPP_CONFIG_REQUIRED_MESSAGE } from "./managed-provider-config-D9X1wNEo.js";
|
|
2
2
|
//#region extensions/llama-cpp/provider-policy-api.ts
|
|
3
3
|
function inspectEmbeddingProviderSetup(params) {
|
|
4
4
|
if (params.provider !== "local") return null;
|
package/openclaw.plugin.json
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"appGuidedDiscovery": true,
|
|
49
49
|
"appGuidedActionLabel": "Set up model",
|
|
50
50
|
"choiceLabel": "Managed local server",
|
|
51
|
-
"choiceHint": "
|
|
51
|
+
"choiceHint": "Choose a Qwen, Gemma, or Muse model for this Gateway's hardware and install llama.cpp",
|
|
52
52
|
"groupId": "llama-cpp",
|
|
53
53
|
"groupLabel": "Local llama.cpp",
|
|
54
54
|
"groupHint": "Managed or external llama.cpp server"
|
package/package.json
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/llama-cpp-provider",
|
|
3
|
-
"version": "2026.9.
|
|
3
|
+
"version": "2026.9.2",
|
|
4
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"
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
|
-
"dependencies": {
|
|
11
|
-
"jszip": "3.10.1",
|
|
12
|
-
"tar": "7.5.22"
|
|
13
|
-
},
|
|
14
10
|
"devDependencies": {
|
|
15
11
|
"@openclaw/plugin-sdk": "workspace:*"
|
|
16
12
|
},
|
|
@@ -24,10 +20,10 @@
|
|
|
24
20
|
"minHostVersion": ">=2026.6.2"
|
|
25
21
|
},
|
|
26
22
|
"compat": {
|
|
27
|
-
"pluginApi": ">=2026.9.
|
|
23
|
+
"pluginApi": ">=2026.9.2"
|
|
28
24
|
},
|
|
29
25
|
"build": {
|
|
30
|
-
"openclawVersion": "2026.9.
|
|
26
|
+
"openclawVersion": "2026.9.2"
|
|
31
27
|
},
|
|
32
28
|
"release": {
|
|
33
29
|
"bundleRuntimeDependencies": false,
|
|
@@ -44,7 +40,7 @@
|
|
|
44
40
|
"README.md"
|
|
45
41
|
],
|
|
46
42
|
"peerDependencies": {
|
|
47
|
-
"openclaw": ">=2026.9.
|
|
43
|
+
"openclaw": ">=2026.9.2"
|
|
48
44
|
},
|
|
49
45
|
"peerDependenciesMeta": {
|
|
50
46
|
"openclaw": {
|