@openclaw/llama-cpp-provider 2026.7.1 → 2026.7.2-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/index.js +21 -9
- package/npm-shrinkwrap.json +2 -2
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { pathToFileURL } from "node:url";
|
|
|
6
6
|
import { createLocalEmbeddingProvider } from "openclaw/plugin-sdk/memory-core-host-engine-embeddings";
|
|
7
7
|
//#region extensions/llama-cpp/src/embedding-provider.ts
|
|
8
8
|
const LLAMA_CPP_EMBEDDING_PROVIDER_ID = "local";
|
|
9
|
+
const LOCAL_EMBEDDING_RUNTIME_FACTS = Symbol.for("openclaw.localEmbeddingRuntimeFacts");
|
|
9
10
|
const DEFAULT_LLAMA_CPP_EMBEDDING_MODEL = "hf:ggml-org/embeddinggemma-300m-qat-q8_0-GGUF/embeddinggemma-300m-qat-Q8_0.gguf";
|
|
10
11
|
const DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_CACHE_FILE_NAME = "hf_ggml-org_embeddinggemma-300m-qat-Q8_0.gguf";
|
|
11
12
|
function normalizeOptionalString(value) {
|
|
@@ -25,13 +26,13 @@ function resolveLlamaCppModelIdentity(local, modelPath, outputDimensionality) {
|
|
|
25
26
|
const modelCacheDir = normalizeOptionalString(local.modelCacheDir) ?? path.join(os.homedir(), ".node-llama-cpp", "models");
|
|
26
27
|
const resolvedDefaultModelPath = path.resolve(modelCacheDir, DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_CACHE_FILE_NAME);
|
|
27
28
|
const resolvedModelPath = /^(?:hf:|https?:\/\/)/i.test(modelPath) ? void 0 : path.resolve(modelCacheDir, modelPath);
|
|
28
|
-
if (modelPath !==
|
|
29
|
+
if (modelPath !== DEFAULT_LLAMA_CPP_EMBEDDING_MODEL && resolvedModelPath !== resolvedDefaultModelPath) return {
|
|
29
30
|
model: modelPath,
|
|
30
31
|
cacheKeyData: createLlamaCppCacheKeyData(modelPath, outputDimensionality),
|
|
31
32
|
aliases: []
|
|
32
33
|
};
|
|
33
34
|
const aliasModels = /* @__PURE__ */ new Set([resolvedDefaultModelPath, DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_CACHE_FILE_NAME]);
|
|
34
|
-
if (modelPath !==
|
|
35
|
+
if (modelPath !== DEFAULT_LLAMA_CPP_EMBEDDING_MODEL) aliasModels.add(modelPath);
|
|
35
36
|
return {
|
|
36
37
|
model: DEFAULT_LLAMA_CPP_EMBEDDING_MODEL,
|
|
37
38
|
cacheKeyData: createLlamaCppCacheKeyData(DEFAULT_LLAMA_CPP_EMBEDDING_MODEL, outputDimensionality),
|
|
@@ -73,8 +74,15 @@ const requireFromPlugin = createRequire(import.meta.url);
|
|
|
73
74
|
function resolveNodeLlamaCppImportUrl() {
|
|
74
75
|
return pathToFileURL(requireFromPlugin.resolve("node-llama-cpp")).href;
|
|
75
76
|
}
|
|
77
|
+
function copyLocalRuntimeFacts(source, target) {
|
|
78
|
+
const getRuntimeFacts = Reflect.get(source, LOCAL_EMBEDDING_RUNTIME_FACTS);
|
|
79
|
+
if (typeof getRuntimeFacts === "function") Object.defineProperty(target, LOCAL_EMBEDDING_RUNTIME_FACTS, {
|
|
80
|
+
enumerable: false,
|
|
81
|
+
value: getRuntimeFacts
|
|
82
|
+
});
|
|
83
|
+
}
|
|
76
84
|
function adaptMemoryEmbeddingProvider(provider) {
|
|
77
|
-
|
|
85
|
+
const adapted = {
|
|
78
86
|
id: LLAMA_CPP_EMBEDDING_PROVIDER_ID,
|
|
79
87
|
model: provider.model,
|
|
80
88
|
maxInputTokens: provider.maxInputTokens,
|
|
@@ -85,17 +93,21 @@ function adaptMemoryEmbeddingProvider(provider) {
|
|
|
85
93
|
},
|
|
86
94
|
close: provider.close
|
|
87
95
|
};
|
|
96
|
+
copyLocalRuntimeFacts(provider, adapted);
|
|
97
|
+
return adapted;
|
|
88
98
|
}
|
|
89
99
|
async function createLlamaCppMemoryEmbeddingProvider(options, runtimeOptions = {}) {
|
|
90
100
|
const createOptions = buildMemoryCreateOptions(options, options.outputDimensionality);
|
|
91
101
|
const local = readLocalOptions(createOptions);
|
|
92
102
|
const provider = await createLocalEmbeddingProvider(createOptions, { nodeLlamaCppImportUrl: runtimeOptions.nodeLlamaCppImportUrl ?? resolveNodeLlamaCppImportUrl() });
|
|
93
103
|
const identity = resolveLlamaCppModelIdentity(local, provider.model, createOptions.outputDimensionality);
|
|
104
|
+
const identifiedProvider = identity.model === provider.model ? provider : {
|
|
105
|
+
...provider,
|
|
106
|
+
model: identity.model
|
|
107
|
+
};
|
|
108
|
+
if (identifiedProvider !== provider) copyLocalRuntimeFacts(provider, identifiedProvider);
|
|
94
109
|
return {
|
|
95
|
-
provider:
|
|
96
|
-
...provider,
|
|
97
|
-
model: identity.model
|
|
98
|
-
},
|
|
110
|
+
provider: identifiedProvider,
|
|
99
111
|
runtime: createLlamaCppEmbeddingProviderRuntime(identity)
|
|
100
112
|
};
|
|
101
113
|
}
|
|
@@ -108,7 +120,7 @@ async function createLlamaCppEmbeddingProviderResult(options, runtimeOptions = {
|
|
|
108
120
|
}
|
|
109
121
|
function buildMemoryCreateOptions(options, outputDimensionality) {
|
|
110
122
|
const local = readLocalOptions(options);
|
|
111
|
-
const modelPath = normalizeOptionalString(local.modelPath) ||
|
|
123
|
+
const modelPath = normalizeOptionalString(local.modelPath) || DEFAULT_LLAMA_CPP_EMBEDDING_MODEL;
|
|
112
124
|
return {
|
|
113
125
|
config: options.config,
|
|
114
126
|
agentDir: options.agentDir,
|
|
@@ -143,7 +155,7 @@ const llamaCppEmbeddingProviderAdapter = {
|
|
|
143
155
|
resolveIndexIdentity: (options) => {
|
|
144
156
|
const createOptions = buildMemoryCreateOptions(options, options.dimensions);
|
|
145
157
|
const local = readLocalOptions(createOptions);
|
|
146
|
-
return resolveLlamaCppModelIdentity(local, normalizeOptionalString(local.modelPath) ??
|
|
158
|
+
return resolveLlamaCppModelIdentity(local, normalizeOptionalString(local.modelPath) ?? DEFAULT_LLAMA_CPP_EMBEDDING_MODEL, createOptions.outputDimensionality);
|
|
147
159
|
},
|
|
148
160
|
create: async (options) => await createLlamaCppEmbeddingProviderResult(options)
|
|
149
161
|
};
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/llama-cpp-provider",
|
|
3
|
-
"version": "2026.7.
|
|
3
|
+
"version": "2026.7.2-beta.2",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@openclaw/llama-cpp-provider",
|
|
9
|
-
"version": "2026.7.
|
|
9
|
+
"version": "2026.7.2-beta.2",
|
|
10
10
|
"optionalDependencies": {
|
|
11
11
|
"node-llama-cpp": "3.19.0"
|
|
12
12
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/llama-cpp-provider",
|
|
3
|
-
"version": "2026.7.
|
|
3
|
+
"version": "2026.7.2-beta.2",
|
|
4
4
|
"description": "OpenClaw llama.cpp embedding provider plugin",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"minHostVersion": ">=2026.6.2"
|
|
24
24
|
},
|
|
25
25
|
"compat": {
|
|
26
|
-
"pluginApi": ">=2026.7.
|
|
26
|
+
"pluginApi": ">=2026.7.2-beta.2"
|
|
27
27
|
},
|
|
28
28
|
"build": {
|
|
29
|
-
"openclawVersion": "2026.7.
|
|
29
|
+
"openclawVersion": "2026.7.2-beta.2"
|
|
30
30
|
},
|
|
31
31
|
"release": {
|
|
32
32
|
"bundleRuntimeDependencies": false,
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"README.md"
|
|
45
45
|
],
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"openclaw": ">=2026.7.
|
|
47
|
+
"openclaw": ">=2026.7.2-beta.2"
|
|
48
48
|
},
|
|
49
49
|
"peerDependenciesMeta": {
|
|
50
50
|
"openclaw": {
|