@openclaw/llama-cpp-provider 2026.9.3 → 2026.9.5
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/assets/activity.svg +30 -0
- package/assets/icon.png +0 -0
- package/dist/{managed-provider-config-D9X1wNEo.js → .setup/managed-provider-config-BYvyYdAs.mjs} +1 -1
- package/dist/index.js +23 -22
- package/dist/provider-policy-api.js +1 -1
- package/openclaw.plugin.json +1 -0
- package/package.json +8 -5
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 250 250">
|
|
2
|
+
<!--
|
|
3
|
+
Adapted from OpenClaw ui/public/provider-icons/ProviderIcon-llamacpp.svg.
|
|
4
|
+
Source: https://github.com/ggml-org/llama.cpp/blob/2cfef4d117d67ab1dec002915b48a15d11ee1973/media/llama1-icon-transparent.svg
|
|
5
|
+
|
|
6
|
+
MIT License
|
|
7
|
+
Copyright (c) 2023-2026 The ggml authors
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
SOFTWARE.
|
|
26
|
+
|
|
27
|
+
Names and marks remain the property of their respective owners.
|
|
28
|
+
-->
|
|
29
|
+
<path fill="currentColor" stroke="none" transform="translate(-995.51066 -129.70875)" d="M0 0 m1163.3 226.8-13.5 24c-17.8-13.7-44.2-15.7-62-1-28.7 23.7-26.7 78.5 18 78.8 12.5 0 23.1-5.9 34.5-9.8l6 23.9c-10.1 4.7-20.4 9.5-31.5 11-101.2 13.8-95.4-132.3-3.9-139.9 19.2-1.6 36.1 3.4 52.5 13z M1093.4 203.8c-15.4 4.6-29.7 13.1-40.5 25-2-24.2 3.4-73.1 30.3-82.7 4-1.4 17.7-4.9 17.3 2.2-.4 7.1-9.9 19.3-12.2 25.9-4 11.6-.3 19.6 5.2 29.7z M1131.4 307.8h-15v-17h-17v-14h15.5l1.5-1.5v-16.5h15v18h16v14h-16zm55 0h-15v-17h-16v-14h15.5l1.5-1.5v-16.5h15v16.5l1.5 1.5h15.5v14h-17z M1142.3 156.9c2 3-9.3 15.9-11.1 19.2-5.2 9.8-1.7 15.4 2.2 24.7-11.3-1.7-21.8-.3-33 1 2.5-21.5 14.6-52.8 41.9-44.9z" />
|
|
30
|
+
</svg>
|
package/assets/icon.png
ADDED
|
Binary file
|
package/dist/{managed-provider-config-D9X1wNEo.js → .setup/managed-provider-config-BYvyYdAs.mjs}
RENAMED
|
@@ -112,7 +112,7 @@ function buildLlamaCppProviderConfig(params = {}) {
|
|
|
112
112
|
}
|
|
113
113
|
//#endregion
|
|
114
114
|
//#region extensions/llama-cpp/src/managed-provider-config.ts
|
|
115
|
-
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`.";
|
|
115
|
+
const MANAGED_LLAMA_CPP_CONFIG_REQUIRED_MESSAGE = "Local embeddings need the managed llama.cpp server config (llama-server). The in-process node-llama-cpp runtime was removed; semantic memory recall is degraded until setup. Run `openclaw configure`, choose llama.cpp once, then retry `openclaw memory status --deep`.";
|
|
116
116
|
function resolveManagedLlamaCppProviderConfig(config) {
|
|
117
117
|
const provider = config.models?.providers?.[LLAMA_CPP_PROVIDER_ID];
|
|
118
118
|
if (!provider?.localService || !provider.baseUrl) throw new Error(MANAGED_LLAMA_CPP_CONFIG_REQUIRED_MESSAGE);
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as resolveLlamaCppDataDir, D as resolveLlamaCppSyntheticApiKey, E as resolveLlamaCppModelSource, S as resolveLegacyLlamaCppModelCacheDir, T as resolveLlamaCppModelCacheDir, _ as LLAMA_CPP_PROVIDER_ID, a as DEFAULT_LLAMA_CPP_EMBEDDING_MODEL, b as resolveCachedLlamaCppModelPath, c as DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_SHA256, d as DEFAULT_LLAMA_CPP_MODEL_ID, f as DEFAULT_LLAMA_CPP_MODEL_REVISION, g as LLAMA_CPP_DEFAULT_PORT, h as DEFAULT_LLAMA_CPP_MODEL_URI, i as DEFAULT_LLAMA_CPP_EMBEDDING_CACHE_FILE, l as DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_SIZE_BYTES, m as DEFAULT_LLAMA_CPP_MODEL_SIZE_BYTES, n as resolveManagedLlamaCppProviderConfig, o as DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_ID, p as DEFAULT_LLAMA_CPP_MODEL_SHA256, r as DEFAULT_LLAMA_CPP_CONTEXT_SIZE, s as DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_REVISION, u as DEFAULT_LLAMA_CPP_MODEL_CACHE_FILE, v as LLAMA_CPP_PROVIDER_LABEL, w as resolveLlamaCppEmbeddingModel, x as resolveHomePath, y as buildLlamaCppProviderConfig } from "
|
|
1
|
+
import { C as resolveLlamaCppDataDir, D as resolveLlamaCppSyntheticApiKey, E as resolveLlamaCppModelSource, S as resolveLegacyLlamaCppModelCacheDir, T as resolveLlamaCppModelCacheDir, _ as LLAMA_CPP_PROVIDER_ID, a as DEFAULT_LLAMA_CPP_EMBEDDING_MODEL, b as resolveCachedLlamaCppModelPath, c as DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_SHA256, d as DEFAULT_LLAMA_CPP_MODEL_ID, f as DEFAULT_LLAMA_CPP_MODEL_REVISION, g as LLAMA_CPP_DEFAULT_PORT, h as DEFAULT_LLAMA_CPP_MODEL_URI, i as DEFAULT_LLAMA_CPP_EMBEDDING_CACHE_FILE, l as DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_SIZE_BYTES, m as DEFAULT_LLAMA_CPP_MODEL_SIZE_BYTES, n as resolveManagedLlamaCppProviderConfig, o as DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_ID, p as DEFAULT_LLAMA_CPP_MODEL_SHA256, r as DEFAULT_LLAMA_CPP_CONTEXT_SIZE, s as DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_REVISION, u as DEFAULT_LLAMA_CPP_MODEL_CACHE_FILE, v as LLAMA_CPP_PROVIDER_LABEL, w as resolveLlamaCppEmbeddingModel, x as resolveHomePath, y as buildLlamaCppProviderConfig } from "./.setup/managed-provider-config-BYvyYdAs.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";
|
|
@@ -377,9 +377,9 @@ async function downloadVerifiedFile(params) {
|
|
|
377
377
|
if (now > previousAt) {
|
|
378
378
|
const currentRate = (downloadedSize - previousSize) * 1e3 / (now - previousAt);
|
|
379
379
|
rollingBytesPerSecond = rollingBytesPerSecond === 0 ? currentRate : rollingBytesPerSecond * .75 + currentRate * .25;
|
|
380
|
+
previousSize = downloadedSize;
|
|
381
|
+
previousAt = now;
|
|
380
382
|
}
|
|
381
|
-
previousSize = downloadedSize;
|
|
382
|
-
previousAt = now;
|
|
383
383
|
params.onProgress?.({
|
|
384
384
|
downloadedSize,
|
|
385
385
|
totalSize,
|
|
@@ -1460,7 +1460,7 @@ async function resolveLlamaServerProviderHeaders(params) {
|
|
|
1460
1460
|
if (typeof value === "string" && value.trim()) resolved[name] = value.trim();
|
|
1461
1461
|
continue;
|
|
1462
1462
|
}
|
|
1463
|
-
const path = `models.providers.${LLAMA_CPP_PROVIDER_ID}.headers
|
|
1463
|
+
const path = `models.providers.${LLAMA_CPP_PROVIDER_ID}.headers[${JSON.stringify(name)}]`;
|
|
1464
1464
|
const header = await resolveConfiguredSecretInputString({
|
|
1465
1465
|
config: params.config,
|
|
1466
1466
|
env: params.env ?? process.env,
|
|
@@ -1549,16 +1549,18 @@ function resolveInput(row, props) {
|
|
|
1549
1549
|
}
|
|
1550
1550
|
function buildCompat(props) {
|
|
1551
1551
|
const caps = props?.chat_template_caps;
|
|
1552
|
+
const supportsTools = asBoolean(caps?.supports_tool_calls) === true;
|
|
1553
|
+
const supportsTypedContent = asBoolean(caps?.supports_typed_content) === true;
|
|
1552
1554
|
return {
|
|
1553
1555
|
supportsStore: false,
|
|
1554
1556
|
supportsDeveloperRole: false,
|
|
1555
|
-
supportsReasoningEffort:
|
|
1557
|
+
supportsReasoningEffort: asBoolean(caps?.supports_reasoning_effort) === true,
|
|
1556
1558
|
supportsTemperature: true,
|
|
1557
1559
|
supportsUsageInStreaming: true,
|
|
1558
|
-
supportsTools
|
|
1560
|
+
supportsTools,
|
|
1559
1561
|
supportsStrictMode: false,
|
|
1560
1562
|
supportsJsonSchemaResponseFormat: true,
|
|
1561
|
-
requiresStringContent: !
|
|
1563
|
+
requiresStringContent: !supportsTypedContent,
|
|
1562
1564
|
maxTokensField: "max_tokens"
|
|
1563
1565
|
};
|
|
1564
1566
|
}
|
|
@@ -1567,17 +1569,18 @@ function mapLlamaServerModel(row, props) {
|
|
|
1567
1569
|
const id = typeof row.id === "string" ? row.id.trim() : "";
|
|
1568
1570
|
if (!id || row.object !== void 0 && row.object !== "model") return null;
|
|
1569
1571
|
const contextWindow = resolveContextWindow(props);
|
|
1572
|
+
const compat = buildCompat(props);
|
|
1570
1573
|
return {
|
|
1571
1574
|
config: {
|
|
1572
1575
|
id,
|
|
1573
1576
|
name: id,
|
|
1574
|
-
reasoning:
|
|
1577
|
+
reasoning: compat.supportsReasoningEffort === true,
|
|
1575
1578
|
input: resolveInput(row, props),
|
|
1576
1579
|
cost: { ...SELF_HOSTED_DEFAULT_COST },
|
|
1577
1580
|
contextWindow,
|
|
1578
1581
|
contextTokens: contextWindow,
|
|
1579
1582
|
maxTokens: resolveMaxTokens(props, contextWindow),
|
|
1580
|
-
compat
|
|
1583
|
+
compat
|
|
1581
1584
|
},
|
|
1582
1585
|
status: normalizeStatus(row.status?.value),
|
|
1583
1586
|
failed: row.status?.failed === true
|
|
@@ -1851,8 +1854,9 @@ function buildSetupResult$1(params) {
|
|
|
1851
1854
|
}
|
|
1852
1855
|
};
|
|
1853
1856
|
}
|
|
1854
|
-
async function removeDefaultAuthProfile(agentDir) {
|
|
1857
|
+
async function removeDefaultAuthProfile(config, agentDir) {
|
|
1855
1858
|
if (!await removeProviderAuthProfilesWithLock({
|
|
1859
|
+
cfg: config,
|
|
1856
1860
|
agentDir,
|
|
1857
1861
|
provider: "llama-cpp",
|
|
1858
1862
|
profileIds: [LLAMA_CPP_DEFAULT_PROFILE_ID]
|
|
@@ -1982,7 +1986,7 @@ async function runLlamaServerSetup(ctx) {
|
|
|
1982
1986
|
if (discovery.kind !== "success") throw new Error(describeDiscoveryFailure(discovery));
|
|
1983
1987
|
const modelId = selectSetupModelId(discovery);
|
|
1984
1988
|
if (!modelId) throw new Error(`No llama-server text models were found at ${discovery.endpoint.origin}.`);
|
|
1985
|
-
if (persistence.kind === "remove") await removeDefaultAuthProfile(ctx.agentDir);
|
|
1989
|
+
if (persistence.kind === "remove") await removeDefaultAuthProfile(ctx.config, ctx.agentDir);
|
|
1986
1990
|
return buildSetupResult$1({
|
|
1987
1991
|
config: ctx.config,
|
|
1988
1992
|
discovery,
|
|
@@ -2099,7 +2103,7 @@ async function configureLlamaServerNonInteractive(ctx) {
|
|
|
2099
2103
|
mode: "api_key"
|
|
2100
2104
|
});
|
|
2101
2105
|
} else if (validated.persistence.kind === "remove") {
|
|
2102
|
-
await removeDefaultAuthProfile(ctx.agentDir);
|
|
2106
|
+
await removeDefaultAuthProfile(ctx.config, ctx.agentDir);
|
|
2103
2107
|
config = removeAuthProfileConfig(config, LLAMA_CPP_DEFAULT_PROFILE_ID);
|
|
2104
2108
|
}
|
|
2105
2109
|
ctx.runtime.log(`Default ${LLAMA_CPP_PROVIDER_LABEL} model: ${validated.modelId}`);
|
|
@@ -2128,7 +2132,7 @@ function wrapLlamaServerStream(ctx) {
|
|
|
2128
2132
|
onPayload: async (payload, requestModel) => {
|
|
2129
2133
|
const customized = await onPayload?.(payload, requestModel) ?? payload;
|
|
2130
2134
|
if (isRecord(customized)) {
|
|
2131
|
-
if (ctx.thinkingLevel === "off") setQwenChatTemplateThinking(customized, false);
|
|
2135
|
+
if ((options?.reasoning ?? ctx.thinkingLevel) === "off") setQwenChatTemplateThinking(customized, false);
|
|
2132
2136
|
normalizeLlamaServerResponseFormat(customized, options?.responseFormat);
|
|
2133
2137
|
}
|
|
2134
2138
|
return customized;
|
|
@@ -2407,12 +2411,12 @@ async function runLlamaCppSetup(ctx) {
|
|
|
2407
2411
|
}
|
|
2408
2412
|
//#endregion
|
|
2409
2413
|
//#region extensions/llama-cpp/src/managed-provider.ts
|
|
2410
|
-
function
|
|
2414
|
+
function wrapLlamaCppStream(ctx) {
|
|
2415
|
+
const inner = wrapLlamaServerStream(ctx);
|
|
2411
2416
|
const providerConfig = ctx.config?.models?.providers?.[LLAMA_CPP_PROVIDER_ID];
|
|
2412
|
-
if (!providerConfig?.localService) return;
|
|
2413
|
-
const inner = streamFn;
|
|
2417
|
+
if (!providerConfig?.localService) return inner;
|
|
2414
2418
|
const selectedModel = ctx.model;
|
|
2415
|
-
if (!
|
|
2419
|
+
if (!selectedModel) return;
|
|
2416
2420
|
return async (...args) => {
|
|
2417
2421
|
await ensureManagedLlamaServerForChat({
|
|
2418
2422
|
provider: providerConfig,
|
|
@@ -2491,11 +2495,8 @@ function registerLlamaCppProvider(api) {
|
|
|
2491
2495
|
normalizeConfig: ({ providerConfig }) => providerConfig.localService ? providerConfig : normalizeLlamaServerProviderConfig(providerConfig),
|
|
2492
2496
|
prepareDynamicModel: async (ctx) => ctx.config?.models?.providers?.["llama-cpp"]?.localService ? void 0 : await prepareLlamaServerDynamicModel(ctx),
|
|
2493
2497
|
reconcileLocalService: reconcileManagedLlamaServer,
|
|
2494
|
-
wrapSimpleCompletionStreamFn:
|
|
2495
|
-
wrapStreamFn:
|
|
2496
|
-
const streamFn = wrapLlamaServerStream(ctx);
|
|
2497
|
-
return ctx.config?.models?.providers?.["llama-cpp"]?.localService ? wrapManagedLlamaCppStream(ctx, streamFn) : streamFn;
|
|
2498
|
-
},
|
|
2498
|
+
wrapSimpleCompletionStreamFn: wrapLlamaCppStream,
|
|
2499
|
+
wrapStreamFn: wrapLlamaCppStream,
|
|
2499
2500
|
...buildProviderToolCompatFamilyHooks("llamacpp-gbnf"),
|
|
2500
2501
|
wizard: { modelPicker: {
|
|
2501
2502
|
label: "llama.cpp",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as resolveManagedLlamaCppProviderConfig, t as MANAGED_LLAMA_CPP_CONFIG_REQUIRED_MESSAGE } from "
|
|
1
|
+
import { n as resolveManagedLlamaCppProviderConfig, t as MANAGED_LLAMA_CPP_CONFIG_REQUIRED_MESSAGE } from "./.setup/managed-provider-config-BYvyYdAs.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/openclaw.plugin.json
CHANGED
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.5",
|
|
4
4
|
"description": "OpenClaw provider for managed and external llama.cpp servers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -15,15 +15,16 @@
|
|
|
15
15
|
"./index.ts"
|
|
16
16
|
],
|
|
17
17
|
"install": {
|
|
18
|
+
"clawhubSpec": "clawhub:@openclaw/llama-cpp-provider",
|
|
18
19
|
"npmSpec": "@openclaw/llama-cpp-provider",
|
|
19
20
|
"defaultChoice": "npm",
|
|
20
21
|
"minHostVersion": ">=2026.6.2"
|
|
21
22
|
},
|
|
22
23
|
"compat": {
|
|
23
|
-
"pluginApi": ">=2026.9.
|
|
24
|
+
"pluginApi": ">=2026.9.5"
|
|
24
25
|
},
|
|
25
26
|
"build": {
|
|
26
|
-
"openclawVersion": "2026.9.
|
|
27
|
+
"openclawVersion": "2026.9.5"
|
|
27
28
|
},
|
|
28
29
|
"release": {
|
|
29
30
|
"bundleRuntimeDependencies": false,
|
|
@@ -37,10 +38,12 @@
|
|
|
37
38
|
"files": [
|
|
38
39
|
"dist/**",
|
|
39
40
|
"openclaw.plugin.json",
|
|
40
|
-
"README.md"
|
|
41
|
+
"README.md",
|
|
42
|
+
"assets/icon.png",
|
|
43
|
+
"assets/activity.svg"
|
|
41
44
|
],
|
|
42
45
|
"peerDependencies": {
|
|
43
|
-
"openclaw": ">=2026.9.
|
|
46
|
+
"openclaw": ">=2026.9.5"
|
|
44
47
|
},
|
|
45
48
|
"peerDependenciesMeta": {
|
|
46
49
|
"openclaw": {
|