@openclaw/llama-cpp-provider 2026.11.3 → 2026.11.5-beta.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.
- package/dist/.setup/{auth-config-Dx2WDi-G.mjs → auth-config-BJOlAPuO.mjs} +1 -1
- package/dist/.setup/{discovery-osk0TXQN.mjs → discovery-CghcMQy6.mjs} +4 -6
- package/dist/.setup/{embedding-provider.runtime-djNMas6G.mjs → embedding-provider.runtime-Bb0UVBwq.mjs} +46 -37
- package/dist/.setup/{managed-provider-config-BuFqNTx1.mjs → managed-provider-config-Dn-MKZjS.mjs} +1 -1
- package/dist/.setup/{managed-server-Bjr1c5yX.mjs → managed-server-CZGhj7j8.mjs} +396 -295
- package/dist/.setup/{media-catalog-BwFQGYtY.mjs → media-catalog-DgRc3mpW.mjs} +7 -212
- package/dist/.setup/{media-provider.runtime-MqV-UJ1m.mjs → media-provider.runtime-Cd4dOeAN.mjs} +2 -2
- package/dist/.setup/{media-setup-BQ6-EW_y.mjs → media-setup-CYVQ5us2.mjs} +9 -9
- package/dist/.setup/{provider-DVEnxK8Q.mjs → provider-CwnlpLK5.mjs} +4 -6
- package/dist/.setup/{provider-discovery-SxEYhgMV.mjs → provider-discovery-D3_7fprf.mjs} +2 -2
- package/dist/.setup/{setup-DmjzzdfH.mjs → setup-Cd7vqUzv.mjs} +123 -132
- package/dist/.setup/{setup-D9_0z5GM.mjs → setup-DDuIGmUb.mjs} +8 -10
- package/dist/.setup/{stream-CSBkXmdm.mjs → stream-lxVe6M15.mjs} +39 -11
- package/dist/.source-module-urls/2a292bf2cc9d15ab4011c4fb7ee888280524a76675c662fb0329d5dc914f3fba.json +1 -0
- package/dist/index.js +113 -118
- package/dist/provider-discovery.js +1 -2
- package/dist/provider-policy-api.js +1 -1
- package/package.json +5 -5
- package/dist/.setup/{defaults-DX4XN2j1.mjs → defaults-CZr5jpH7.mjs} +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as LLAMA_CPP_PROVIDER_ID } from "./defaults-
|
|
1
|
+
import { _ as LLAMA_CPP_PROVIDER_ID } from "./defaults-CZr5jpH7.mjs";
|
|
2
2
|
//#region extensions/llama-cpp/src/auth-config.ts
|
|
3
3
|
const LLAMA_CPP_DEFAULT_PROFILE_ID = `${LLAMA_CPP_PROVIDER_ID}:default`;
|
|
4
4
|
function buildLlamaCppAuthProfileRemovalPatch(config) {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { _ as LLAMA_CPP_PROVIDER_ID } from "./defaults-
|
|
2
|
-
import { n as normalizeLlamaServerProviderConfig, o as LLAMA_SERVER_DISCOVERY_TIMEOUT_MS, r as resolveLlamaServerEndpoint } from "./provider-discovery-
|
|
1
|
+
import { _ as LLAMA_CPP_PROVIDER_ID } from "./defaults-CZr5jpH7.mjs";
|
|
2
|
+
import { n as normalizeLlamaServerProviderConfig, o as LLAMA_SERVER_DISCOVERY_TIMEOUT_MS, r as resolveLlamaServerEndpoint } from "./provider-discovery-D3_7fprf.mjs";
|
|
3
3
|
import { asOptionalRecord, asPositiveSafeInteger } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { isNonSecretApiKeyMarker } from "openclaw/plugin-sdk/provider-auth";
|
|
5
5
|
import { resolveApiKeyForProvider } from "openclaw/plugin-sdk/provider-auth-runtime";
|
|
6
6
|
import { resolveConfiguredSecretInputString } from "openclaw/plugin-sdk/secret-input-runtime";
|
|
7
|
-
import { SELF_HOSTED_DEFAULT_CONTEXT_WINDOW, SELF_HOSTED_DEFAULT_COST, discoverOpenAICompatibleLocalModels } from "openclaw/plugin-sdk/provider-setup";
|
|
8
|
-
import { resolveDefaultModelMaxTokens } from "openclaw/plugin-sdk/provider-model-shared";
|
|
7
|
+
import { SELF_HOSTED_DEFAULT_CONTEXT_WINDOW, SELF_HOSTED_DEFAULT_COST, SELF_HOSTED_DEFAULT_MAX_TOKENS, discoverOpenAICompatibleLocalModels } from "openclaw/plugin-sdk/provider-setup";
|
|
9
8
|
//#region extensions/llama-cpp/src/external-server/auth.ts
|
|
10
9
|
async function resolveLlamaServerProviderHeaders(params) {
|
|
11
10
|
const headers = asOptionalRecord(params.headers);
|
|
@@ -54,7 +53,7 @@ function normalizeStatus(value) {
|
|
|
54
53
|
function resolveMaxTokens(props, contextWindow) {
|
|
55
54
|
const params = props?.default_generation_settings?.params;
|
|
56
55
|
const advertised = asPositiveSafeInteger(params?.max_tokens) ?? asPositiveSafeInteger(params?.n_predict);
|
|
57
|
-
return Math.min(advertised ??
|
|
56
|
+
return Math.min(advertised ?? SELF_HOSTED_DEFAULT_MAX_TOKENS, contextWindow);
|
|
58
57
|
}
|
|
59
58
|
function resolveInput(row, props) {
|
|
60
59
|
const advertised = row.architecture?.input_modalities;
|
|
@@ -75,7 +74,6 @@ function buildCompat(props, useRuntimeDefaults) {
|
|
|
75
74
|
maxTokensField: "max_tokens"
|
|
76
75
|
};
|
|
77
76
|
}
|
|
78
|
-
/** Maps one llama-server model row plus optional runtime properties into OpenClaw config. */
|
|
79
77
|
function mapLlamaServerModel(row, props, useRuntimeDefaults = true) {
|
|
80
78
|
const id = typeof row.id === "string" ? row.id.trim() : "";
|
|
81
79
|
if (!id || row.object !== void 0 && row.object !== "model") return null;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { E as resolveLlamaCppModelCacheDir, _ as LLAMA_CPP_PROVIDER_ID, a as DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_ID } from "./defaults-
|
|
1
|
+
import { E as resolveLlamaCppModelCacheDir, _ as LLAMA_CPP_PROVIDER_ID, a as DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_ID } from "./defaults-CZr5jpH7.mjs";
|
|
2
2
|
import { o as resolveLlamaCppMediaModels } from "./media-config-CZ7CluNV.mjs";
|
|
3
|
-
import { n as resolveManagedLlamaCppProviderConfig } from "./managed-provider-config-
|
|
4
|
-
import { ensureLlamaCppModel, prepareManagedLlamaServer, reconcileManagedLlamaServer } from "./managed-server-
|
|
3
|
+
import { n as resolveManagedLlamaCppProviderConfig } from "./managed-provider-config-Dn-MKZjS.mjs";
|
|
4
|
+
import { ensureLlamaCppModel, i as formatLlamaServerRuntimeError, prepareManagedLlamaServer, reconcileManagedLlamaServer } from "./managed-server-CZGhj7j8.mjs";
|
|
5
5
|
import { asOptionalRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { getEmbeddingProvider } from "openclaw/plugin-sdk/embedding-providers";
|
|
7
|
+
import { sanitizeAndNormalizeEmbedding } from "openclaw/plugin-sdk/memory-core-host-engine-embeddings";
|
|
7
8
|
import { readProviderJsonResponse, readProviderTextResponse } from "openclaw/plugin-sdk/provider-http";
|
|
8
9
|
import { ssrfPolicyFromHttpBaseUrlAllowedOrigin } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
9
10
|
import { fetchConfiguredLocalOriginWithSsrFGuard } from "openclaw/plugin-sdk/ssrf-runtime-internal";
|
|
@@ -48,7 +49,7 @@ async function inspectLlamaServerRuntime(params) {
|
|
|
48
49
|
return {
|
|
49
50
|
engine: "llama.cpp",
|
|
50
51
|
state: health.ok && models.ok && props.ok && !params.loadError ? "ready" : "failed",
|
|
51
|
-
backend:
|
|
52
|
+
backend: void 0,
|
|
52
53
|
buildInfo: typeof propsRecord?.build_info === "string" ? propsRecord.build_info : void 0,
|
|
53
54
|
model: {
|
|
54
55
|
id: params.modelId,
|
|
@@ -94,11 +95,40 @@ async function prepareEmbeddingServer(options, embeddingSource) {
|
|
|
94
95
|
localService: provider.localService
|
|
95
96
|
});
|
|
96
97
|
}
|
|
97
|
-
function
|
|
98
|
+
async function createLlamaCppEmbeddingProvider(options, embeddingSource, identity) {
|
|
99
|
+
if (options.dimensions !== void 0 && (!Number.isInteger(options.dimensions) || options.dimensions <= 0)) throw new Error("Local embeddings dimensions must be a positive integer.");
|
|
100
|
+
await prepareEmbeddingServer(options, embeddingSource);
|
|
101
|
+
const genericAdapter = getEmbeddingProvider("openai-compatible", options.config);
|
|
102
|
+
if (!genericAdapter) throw new Error("OpenAI-compatible embedding transport is unavailable.");
|
|
103
|
+
const acquireLocalService = options.acquireLocalService;
|
|
104
|
+
const result = await genericAdapter.create({
|
|
105
|
+
...options,
|
|
106
|
+
provider: LLAMA_CPP_PROVIDER_ID,
|
|
107
|
+
model: DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_ID,
|
|
108
|
+
remote: void 0,
|
|
109
|
+
dimensions: void 0,
|
|
110
|
+
...acquireLocalService ? { acquireLocalService: (...[target, signal]) => acquireLocalService({
|
|
111
|
+
...target,
|
|
112
|
+
reconcile: reconcileManagedLlamaServer
|
|
113
|
+
}, signal) } : {}
|
|
114
|
+
});
|
|
115
|
+
if (!result.provider) return result;
|
|
116
|
+
const provider = result.provider;
|
|
117
|
+
const canonicalModel = identity.model;
|
|
118
|
+
const baseUrl = resolveManagedLlamaCppProviderConfig(options.config).baseUrl ?? "";
|
|
119
|
+
const dimensions = options.dimensions;
|
|
120
|
+
const normalize = (vector) => {
|
|
121
|
+
if (dimensions !== void 0 && vector.length < dimensions) throw Object.assign(/* @__PURE__ */ new Error(`Local embeddings expected ${dimensions} dimensions, got ${vector.length}; reduce or remove memory.search.outputDimensionality or request dimensions.`), {
|
|
122
|
+
code: "INVALID_EMBEDDING_RESPONSE",
|
|
123
|
+
expectedDimensions: dimensions,
|
|
124
|
+
actualDimensions: vector.length
|
|
125
|
+
});
|
|
126
|
+
return sanitizeAndNormalizeEmbedding(dimensions === void 0 ? vector : vector.slice(0, dimensions));
|
|
127
|
+
};
|
|
98
128
|
let runtimeFacts;
|
|
99
129
|
const refreshFacts = async (loadError) => {
|
|
100
130
|
runtimeFacts = await inspectLlamaServerRuntime({
|
|
101
|
-
baseUrl
|
|
131
|
+
baseUrl,
|
|
102
132
|
modelId: DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_ID,
|
|
103
133
|
loadError
|
|
104
134
|
});
|
|
@@ -109,47 +139,26 @@ function wrapProvider(params) {
|
|
|
109
139
|
await refreshFacts();
|
|
110
140
|
return value;
|
|
111
141
|
} catch (error) {
|
|
112
|
-
|
|
113
|
-
|
|
142
|
+
const failure = formatLlamaServerRuntimeError(error);
|
|
143
|
+
await refreshFacts(failure.message);
|
|
144
|
+
throw failure;
|
|
114
145
|
}
|
|
115
146
|
};
|
|
116
147
|
const wrapped = {
|
|
117
148
|
id: "local",
|
|
118
|
-
model:
|
|
119
|
-
dimensions
|
|
120
|
-
maxInputTokens:
|
|
121
|
-
embed: (input, callOptions) => withFacts(() =>
|
|
122
|
-
embedBatch: (inputs, callOptions) => withFacts(() =>
|
|
123
|
-
close:
|
|
149
|
+
model: canonicalModel,
|
|
150
|
+
dimensions,
|
|
151
|
+
maxInputTokens: provider.maxInputTokens ?? 2044,
|
|
152
|
+
embed: (input, callOptions) => withFacts(async () => normalize(await provider.embed(input, callOptions))),
|
|
153
|
+
embedBatch: (inputs, callOptions) => withFacts(async () => (await provider.embedBatch(inputs, callOptions)).map(normalize)),
|
|
154
|
+
close: provider.close
|
|
124
155
|
};
|
|
125
156
|
Object.defineProperty(wrapped, LOCAL_EMBEDDING_RUNTIME_FACTS, {
|
|
126
157
|
enumerable: false,
|
|
127
158
|
value: () => runtimeFacts
|
|
128
159
|
});
|
|
129
|
-
return wrapped;
|
|
130
|
-
}
|
|
131
|
-
async function createLlamaCppEmbeddingProvider(options, embeddingSource, identity) {
|
|
132
|
-
await prepareEmbeddingServer(options, embeddingSource);
|
|
133
|
-
const genericAdapter = getEmbeddingProvider("openai-compatible", options.config);
|
|
134
|
-
if (!genericAdapter) throw new Error("OpenAI-compatible embedding transport is unavailable.");
|
|
135
|
-
const acquireLocalService = options.acquireLocalService;
|
|
136
|
-
const result = await genericAdapter.create({
|
|
137
|
-
...options,
|
|
138
|
-
provider: LLAMA_CPP_PROVIDER_ID,
|
|
139
|
-
model: DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_ID,
|
|
140
|
-
remote: void 0,
|
|
141
|
-
...acquireLocalService ? { acquireLocalService: (...[target, signal]) => acquireLocalService({
|
|
142
|
-
...target,
|
|
143
|
-
reconcile: reconcileManagedLlamaServer
|
|
144
|
-
}, signal) } : {}
|
|
145
|
-
});
|
|
146
|
-
if (!result.provider) return result;
|
|
147
160
|
return {
|
|
148
|
-
provider:
|
|
149
|
-
provider: result.provider,
|
|
150
|
-
canonicalModel: identity.model,
|
|
151
|
-
baseUrl: resolveManagedLlamaCppProviderConfig(options.config).baseUrl ?? ""
|
|
152
|
-
}),
|
|
161
|
+
provider: wrapped,
|
|
153
162
|
runtime: {
|
|
154
163
|
id: "local",
|
|
155
164
|
inlineQueryTimeoutMs: 3e5,
|
package/dist/.setup/{managed-provider-config-BuFqNTx1.mjs → managed-provider-config-Dn-MKZjS.mjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as LLAMA_CPP_PROVIDER_ID } from "./defaults-
|
|
1
|
+
import { _ as LLAMA_CPP_PROVIDER_ID } from "./defaults-CZr5jpH7.mjs";
|
|
2
2
|
//#region extensions/llama-cpp/src/managed-provider-config.ts
|
|
3
3
|
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`.";
|
|
4
4
|
function resolveManagedLlamaCppProviderConfig(config) {
|