@openclaw/llama-cpp-provider 2026.10.1-beta.2 → 2026.10.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/{managed-provider-config-B99gmBnE.mjs → managed-provider-config-D0abOkC_.mjs}
RENAMED
|
@@ -19,6 +19,7 @@ const DEFAULT_LLAMA_CPP_CONTEXT_SIZE = 65536;
|
|
|
19
19
|
const DEFAULT_LLAMA_CPP_EMBEDDING_MODEL = "hf:ggml-org/embeddinggemma-300m-qat-q8_0-GGUF/embeddinggemma-300m-qat-Q8_0.gguf";
|
|
20
20
|
const DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_REVISION = "66f974f8cd48cc3b9c41c516b95508e75b4bee64";
|
|
21
21
|
const DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_ID = "embeddinggemma-300m-qat-q8_0";
|
|
22
|
+
const DEFAULT_LLAMA_CPP_EMBEDDING_CONTEXT_SIZE = 2048;
|
|
22
23
|
const DEFAULT_LLAMA_CPP_EMBEDDING_CACHE_FILE = "hf_ggml-org_embeddinggemma-300m-qat-Q8_0.gguf";
|
|
23
24
|
const DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_SIZE_BYTES = 328577056;
|
|
24
25
|
const DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_SHA256 = "6fa0c02a9c302be6f977521d399b4de3a46310a4f2621ee0063747881b673f67";
|
|
@@ -120,4 +121,4 @@ function resolveManagedLlamaCppProviderConfig(config) {
|
|
|
120
121
|
return provider;
|
|
121
122
|
}
|
|
122
123
|
//#endregion
|
|
123
|
-
export {
|
|
124
|
+
export { resolveCachedLlamaCppModelPath as C, resolveLlamaCppEmbeddingModel as D, resolveLlamaCppDataDir as E, resolveLlamaCppModelCacheDir as O, buildLlamaCppProviderConfig as S, resolveLegacyLlamaCppModelCacheDir as T, LLAMA_CPP_DEFAULT_PORT as _, DEFAULT_LLAMA_CPP_EMBEDDING_CONTEXT_SIZE as a, LLAMA_CPP_PROVIDER_LABEL as b, DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_REVISION as c, DEFAULT_LLAMA_CPP_MODEL_CACHE_FILE as d, DEFAULT_LLAMA_CPP_MODEL_ID as f, DEFAULT_LLAMA_CPP_MODEL_URI as g, DEFAULT_LLAMA_CPP_MODEL_SIZE_BYTES as h, DEFAULT_LLAMA_CPP_EMBEDDING_CACHE_FILE as i, resolveLlamaCppModelSource as k, DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_SHA256 as l, DEFAULT_LLAMA_CPP_MODEL_SHA256 as m, resolveManagedLlamaCppProviderConfig as n, DEFAULT_LLAMA_CPP_EMBEDDING_MODEL as o, DEFAULT_LLAMA_CPP_MODEL_REVISION as p, DEFAULT_LLAMA_CPP_CONTEXT_SIZE as r, DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_ID as s, MANAGED_LLAMA_CPP_CONFIG_REQUIRED_MESSAGE as t, DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_SIZE_BYTES as u, LLAMA_CPP_LOCAL_AUTH_MARKER as v, resolveHomePath as w, buildLlamaCppModel as x, LLAMA_CPP_PROVIDER_ID as y };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { C as resolveCachedLlamaCppModelPath, D as resolveLlamaCppEmbeddingModel, E as resolveLlamaCppDataDir, O as resolveLlamaCppModelCacheDir, S as buildLlamaCppProviderConfig, T as resolveLegacyLlamaCppModelCacheDir, _ as LLAMA_CPP_DEFAULT_PORT, a as DEFAULT_LLAMA_CPP_EMBEDDING_CONTEXT_SIZE, b as LLAMA_CPP_PROVIDER_LABEL, c as DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_REVISION, d as DEFAULT_LLAMA_CPP_MODEL_CACHE_FILE, f as DEFAULT_LLAMA_CPP_MODEL_ID, g as DEFAULT_LLAMA_CPP_MODEL_URI, h as DEFAULT_LLAMA_CPP_MODEL_SIZE_BYTES, i as DEFAULT_LLAMA_CPP_EMBEDDING_CACHE_FILE, k as resolveLlamaCppModelSource, l as DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_SHA256, m as DEFAULT_LLAMA_CPP_MODEL_SHA256, n as resolveManagedLlamaCppProviderConfig, o as DEFAULT_LLAMA_CPP_EMBEDDING_MODEL, p as DEFAULT_LLAMA_CPP_MODEL_REVISION, s as DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_ID, u as DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_SIZE_BYTES, v as LLAMA_CPP_LOCAL_AUTH_MARKER, w as resolveHomePath, x as buildLlamaCppModel, y as LLAMA_CPP_PROVIDER_ID } from "./.setup/managed-provider-config-D0abOkC_.mjs";
|
|
2
2
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { getEmbeddingProvider } from "openclaw/plugin-sdk/embedding-providers";
|
|
@@ -739,7 +739,6 @@ async function ensureLlamaServerInstalled(options = {}) {
|
|
|
739
739
|
}
|
|
740
740
|
//#endregion
|
|
741
741
|
//#region extensions/llama-cpp/src/llama-server-preset.ts
|
|
742
|
-
const LLAMA_CPP_EMBEDDING_UBATCH_SIZE = 2048;
|
|
743
742
|
function assertIniValue(value, label) {
|
|
744
743
|
if (/\r|\n/u.test(value)) throw new Error(`${label} cannot contain a newline`);
|
|
745
744
|
return value;
|
|
@@ -771,14 +770,26 @@ const PRESET_KEY_ALIASES = {
|
|
|
771
770
|
ub: "ubatch-size",
|
|
772
771
|
LLAMA_ARG_UBATCH: "ubatch-size",
|
|
773
772
|
embeddings: "embedding",
|
|
774
|
-
LLAMA_ARG_EMBEDDINGS: "embedding"
|
|
773
|
+
LLAMA_ARG_EMBEDDINGS: "embedding",
|
|
774
|
+
np: "parallel",
|
|
775
|
+
LLAMA_ARG_N_PARALLEL: "parallel",
|
|
776
|
+
LLAMA_ARG_KV_UNIFIED_PER_SLOT: "kv-unified-per-slot"
|
|
775
777
|
};
|
|
778
|
+
const PRESET_SETTING_PATTERN = /(?<![^\r\n])([a-zA-Z_][a-zA-Z0-9_.-]*)([ \t]*=[ \t]*)([^\r\n]*?)([ \t]*(?:[;#][^\r\n]*)?)(\r\n|\n|\r|(?![\s\S]))/g;
|
|
779
|
+
function readSettingKeys(section) {
|
|
780
|
+
return new Set([...(section ?? "").matchAll(PRESET_SETTING_PATTERN)].map(([, key = ""]) => PRESET_KEY_ALIASES[key] ?? key));
|
|
781
|
+
}
|
|
782
|
+
function readServiceSettingKeys(service) {
|
|
783
|
+
const caseInsensitiveEnv = process.platform === "win32";
|
|
784
|
+
const keys = [...Object.entries(service?.env ?? {}).filter(([, value]) => value !== void 0).map(([key]) => caseInsensitiveEnv ? key.toUpperCase() : key).filter((key) => key.startsWith("LLAMA_ARG_")), ...(service?.args ?? []).filter((arg) => arg.startsWith("-")).map((arg) => arg.startsWith("--") ? arg.slice(2).replaceAll("_", "-") : arg.slice(1))];
|
|
785
|
+
return new Set(keys.map((key) => PRESET_KEY_ALIASES[key] ?? key));
|
|
786
|
+
}
|
|
776
787
|
function updateModelSection(sections, id, values, newline) {
|
|
777
788
|
assertIniValue(id, "llama.cpp model id");
|
|
778
789
|
if (id.includes("]")) throw new Error("llama.cpp model ids cannot contain ]");
|
|
779
790
|
const name = [...sections.keys()].filter((candidate) => normalizePresetName(candidate) === normalizePresetName(id)).toSorted((left, right) => Buffer.compare(Buffer.from(left), Buffer.from(right))).at(-1) ?? id;
|
|
780
791
|
const pending = new Set(Object.keys(values));
|
|
781
|
-
let contents = (sections.get(name) ?? `[${id}]${newline}`).replace(
|
|
792
|
+
let contents = (sections.get(name) ?? `[${id}]${newline}`).replace(PRESET_SETTING_PATTERN, (line, key, separator, _value, comment, ending) => {
|
|
782
793
|
const canonical = PRESET_KEY_ALIASES[key] ?? key;
|
|
783
794
|
if (!Object.hasOwn(values, canonical)) return line;
|
|
784
795
|
pending.delete(canonical);
|
|
@@ -800,11 +811,22 @@ function buildLlamaServerPreset(existing, params) {
|
|
|
800
811
|
}, newline);
|
|
801
812
|
const embeddingPath = params.embeddingModelPath ?? (!sections.has("embeddinggemma-300m-qat-q8_0") ? params.defaultEmbeddingModelPath : void 0);
|
|
802
813
|
if (embeddingPath) {
|
|
803
|
-
const
|
|
814
|
+
const configured = /* @__PURE__ */ new Set([
|
|
815
|
+
...readSettingKeys(sections.get(DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_ID)),
|
|
816
|
+
...readSettingKeys(sections.get("*")),
|
|
817
|
+
...readServiceSettingKeys(params.serviceSettings)
|
|
818
|
+
]);
|
|
819
|
+
const defaults = {
|
|
820
|
+
parallel: "1",
|
|
821
|
+
"ctx-size": String(DEFAULT_LLAMA_CPP_EMBEDDING_CONTEXT_SIZE),
|
|
822
|
+
"ubatch-size": String(DEFAULT_LLAMA_CPP_EMBEDDING_CONTEXT_SIZE)
|
|
823
|
+
};
|
|
824
|
+
if (configured.has("parallel") || configured.has("kv-unified-per-slot")) delete defaults["ctx-size"];
|
|
825
|
+
for (const key of configured) delete defaults[key];
|
|
804
826
|
updateModelSection(sections, DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_ID, {
|
|
805
827
|
model: assertIniValue(embeddingPath, "llama.cpp embedding model path"),
|
|
806
|
-
|
|
807
|
-
|
|
828
|
+
embedding: "true",
|
|
829
|
+
...defaults
|
|
808
830
|
}, newline);
|
|
809
831
|
}
|
|
810
832
|
const embeddingSection = sections.get(DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_ID);
|
|
@@ -1364,9 +1386,15 @@ async function prepareManagedLlamaServer(params) {
|
|
|
1364
1386
|
await updatePreset(presetPath, {
|
|
1365
1387
|
chatModel: params.chatModel,
|
|
1366
1388
|
configuredChatModelIds: params.configuredChatModelIds,
|
|
1367
|
-
embeddingModelIsDefault: params.embeddingModelIsDefault,
|
|
1368
1389
|
embeddingModelPath: params.embeddingModelPath,
|
|
1369
1390
|
defaultEmbeddingModelPath: params.defaultEmbeddingModelPath,
|
|
1391
|
+
serviceSettings: params.isolated ? { env: process.env } : {
|
|
1392
|
+
args: params.localService?.args,
|
|
1393
|
+
env: {
|
|
1394
|
+
...process.env,
|
|
1395
|
+
...params.localService?.env
|
|
1396
|
+
}
|
|
1397
|
+
},
|
|
1370
1398
|
reconcileOrigin: params.isolated ? void 0 : reconcileOrigin
|
|
1371
1399
|
});
|
|
1372
1400
|
params.signal?.throwIfAborted();
|
|
@@ -1520,7 +1548,7 @@ function resolveProviderPort(provider) {
|
|
|
1520
1548
|
if (!Number.isInteger(port) || port <= 0) throw new Error("Managed llama.cpp provider baseUrl must include a loopback port.");
|
|
1521
1549
|
return port;
|
|
1522
1550
|
}
|
|
1523
|
-
async function prepareEmbeddingServer(options, embeddingSource
|
|
1551
|
+
async function prepareEmbeddingServer(options, embeddingSource) {
|
|
1524
1552
|
const provider = resolveManagedLlamaCppProviderConfig(options.config);
|
|
1525
1553
|
const embeddingModelPath = await ensureLlamaCppModel({
|
|
1526
1554
|
source: embeddingSource,
|
|
@@ -1530,7 +1558,6 @@ async function prepareEmbeddingServer(options, embeddingSource, embeddingModelIs
|
|
|
1530
1558
|
await prepareManagedLlamaServer({
|
|
1531
1559
|
chatModel: { mode: "preserve" },
|
|
1532
1560
|
configuredChatModelIds: provider.models.map((model) => model.id),
|
|
1533
|
-
embeddingModelIsDefault,
|
|
1534
1561
|
embeddingModelPath,
|
|
1535
1562
|
port: resolveProviderPort(provider),
|
|
1536
1563
|
reconcileBaseUrl: provider.baseUrl,
|
|
@@ -1560,7 +1587,7 @@ function wrapProvider(params) {
|
|
|
1560
1587
|
id: "local",
|
|
1561
1588
|
model: params.canonicalModel,
|
|
1562
1589
|
dimensions: params.provider.dimensions,
|
|
1563
|
-
maxInputTokens: params.provider.maxInputTokens,
|
|
1590
|
+
maxInputTokens: params.provider.maxInputTokens ?? 2044,
|
|
1564
1591
|
embed: async (input, callOptions) => await withFacts(async () => await params.provider.embed(input, callOptions)),
|
|
1565
1592
|
embedBatch: async (inputs, callOptions) => await withFacts(async () => await params.provider.embedBatch(inputs, callOptions)),
|
|
1566
1593
|
close: params.provider.close
|
|
@@ -1583,7 +1610,7 @@ const llamaCppEmbeddingProviderAdapter = {
|
|
|
1583
1610
|
const local = readIdentityLocalOptions(options);
|
|
1584
1611
|
const embeddingModel = resolveLlamaCppEmbeddingModel(local);
|
|
1585
1612
|
const identity = resolveModelIdentity(local, options.dimensions);
|
|
1586
|
-
await prepareEmbeddingServer(options, embeddingModel.source
|
|
1613
|
+
await prepareEmbeddingServer(options, embeddingModel.source);
|
|
1587
1614
|
const genericAdapter = getEmbeddingProvider("openai-compatible", options.config);
|
|
1588
1615
|
if (!genericAdapter) throw new Error("OpenAI-compatible embedding transport is unavailable.");
|
|
1589
1616
|
const acquireLocalService = options.acquireLocalService;
|
|
@@ -2514,7 +2541,6 @@ async function runLlamaCppSetup(ctx) {
|
|
|
2514
2541
|
const managed = await prepareManagedLlamaServer({
|
|
2515
2542
|
chatModel,
|
|
2516
2543
|
configuredChatModelIds: plan.kind === "chat" ? plan.candidate.provider.models.map((model) => model.id) : [],
|
|
2517
|
-
embeddingModelIsDefault: embeddingModel.isDefault,
|
|
2518
2544
|
embeddingModelPath,
|
|
2519
2545
|
asset,
|
|
2520
2546
|
isolated: true,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as resolveManagedLlamaCppProviderConfig, t as MANAGED_LLAMA_CPP_CONFIG_REQUIRED_MESSAGE } from "./.setup/managed-provider-config-
|
|
1
|
+
import { n as resolveManagedLlamaCppProviderConfig, t as MANAGED_LLAMA_CPP_CONFIG_REQUIRED_MESSAGE } from "./.setup/managed-provider-config-D0abOkC_.mjs";
|
|
2
2
|
//#region extensions/llama-cpp/provider-policy-api.ts
|
|
3
3
|
function inspectEmbeddingProviderSetup(params) {
|
|
4
4
|
if (params.provider !== "local") return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/llama-cpp-provider",
|
|
3
|
-
"version": "2026.10.1
|
|
3
|
+
"version": "2026.10.1",
|
|
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.10.1
|
|
24
|
+
"pluginApi": ">=2026.10.1"
|
|
25
25
|
},
|
|
26
26
|
"build": {
|
|
27
|
-
"openclawVersion": "2026.10.1
|
|
27
|
+
"openclawVersion": "2026.10.1"
|
|
28
28
|
},
|
|
29
29
|
"release": {
|
|
30
30
|
"bundleRuntimeDependencies": false,
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
]
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@openclaw/fs-safe": "0.
|
|
39
|
+
"@openclaw/fs-safe": "0.24.2"
|
|
40
40
|
},
|
|
41
41
|
"files": [
|
|
42
42
|
"dist/**",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"assets/activity.svg"
|
|
47
47
|
],
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"openclaw": ">=2026.10.1
|
|
49
|
+
"openclaw": ">=2026.10.1"
|
|
50
50
|
},
|
|
51
51
|
"peerDependenciesMeta": {
|
|
52
52
|
"openclaw": {
|