@openclaw/memory-lancedb 2026.5.7 → 2026.5.9-beta.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/index.js +20 -6
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -3,9 +3,6 @@ import { DEFAULT_RECALL_MAX_CHARS, MEMORY_CATEGORIES, memoryConfigSchema, vector
|
|
|
3
3
|
import { loadLanceDbModule } from "./lancedb-runtime.js";
|
|
4
4
|
import { Buffer } from "node:buffer";
|
|
5
5
|
import { randomUUID } from "node:crypto";
|
|
6
|
-
import OpenAI from "openai";
|
|
7
|
-
import { getMemoryEmbeddingProvider } from "openclaw/plugin-sdk/memory-core-host-engine-embeddings";
|
|
8
|
-
import { resolveDefaultAgentId } from "openclaw/plugin-sdk/memory-host-core";
|
|
9
6
|
import { resolveLivePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
10
7
|
import { ensureGlobalUndiciEnvProxyDispatcher } from "openclaw/plugin-sdk/runtime-env";
|
|
11
8
|
import { normalizeLowercaseStringOrEmpty, truncateUtf16Safe } from "openclaw/plugin-sdk/text-runtime";
|
|
@@ -18,6 +15,21 @@ import { Type } from "typebox";
|
|
|
18
15
|
* Uses LanceDB for storage and OpenAI for embeddings.
|
|
19
16
|
* Provides seamless auto-recall and auto-capture via lifecycle hooks.
|
|
20
17
|
*/
|
|
18
|
+
let openAiModulePromise;
|
|
19
|
+
function loadOpenAiModule() {
|
|
20
|
+
openAiModulePromise ??= import("openai");
|
|
21
|
+
return openAiModulePromise;
|
|
22
|
+
}
|
|
23
|
+
let memoryEmbeddingProviderModulePromise;
|
|
24
|
+
function loadMemoryEmbeddingProviderModule() {
|
|
25
|
+
memoryEmbeddingProviderModulePromise ??= import("openclaw/plugin-sdk/memory-core-host-engine-embeddings");
|
|
26
|
+
return memoryEmbeddingProviderModulePromise;
|
|
27
|
+
}
|
|
28
|
+
let memoryHostCoreModulePromise;
|
|
29
|
+
function loadMemoryHostCoreModule() {
|
|
30
|
+
memoryHostCoreModulePromise ??= import("openclaw/plugin-sdk/memory-host-core");
|
|
31
|
+
return memoryHostCoreModulePromise;
|
|
32
|
+
}
|
|
21
33
|
function asRecord(value) {
|
|
22
34
|
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
23
35
|
}
|
|
@@ -175,10 +187,10 @@ var OpenAiCompatibleEmbeddings = class {
|
|
|
175
187
|
constructor(apiKey, model, baseUrl, dimensions) {
|
|
176
188
|
this.model = model;
|
|
177
189
|
this.dimensions = dimensions;
|
|
178
|
-
this.
|
|
190
|
+
this.clientPromise = loadOpenAiModule().then(({ default: OpenAI }) => new OpenAI({
|
|
179
191
|
apiKey,
|
|
180
192
|
baseURL: baseUrl
|
|
181
|
-
});
|
|
193
|
+
}));
|
|
182
194
|
}
|
|
183
195
|
async embed(text, options) {
|
|
184
196
|
const params = {
|
|
@@ -187,7 +199,7 @@ var OpenAiCompatibleEmbeddings = class {
|
|
|
187
199
|
};
|
|
188
200
|
if (this.dimensions) params.dimensions = this.dimensions;
|
|
189
201
|
ensureGlobalUndiciEnvProxyDispatcher();
|
|
190
|
-
return normalizeEmbeddingVector((await this.
|
|
202
|
+
return normalizeEmbeddingVector((await (await this.clientPromise).post("/embeddings", {
|
|
191
203
|
body: params,
|
|
192
204
|
...options?.timeoutMs ? {
|
|
193
205
|
timeout: options.timeoutMs,
|
|
@@ -211,8 +223,10 @@ var ProviderAdapterEmbeddings = class {
|
|
|
211
223
|
async createProvider() {
|
|
212
224
|
const cfg = this.api.runtime.config?.current?.() ?? this.api.config;
|
|
213
225
|
const providerId = this.embedding.provider;
|
|
226
|
+
const { getMemoryEmbeddingProvider } = await loadMemoryEmbeddingProviderModule();
|
|
214
227
|
const adapter = getMemoryEmbeddingProvider(providerId, cfg);
|
|
215
228
|
if (!adapter) throw new Error(`Unknown memory embedding provider: ${providerId}`);
|
|
229
|
+
const { resolveDefaultAgentId } = await loadMemoryHostCoreModule();
|
|
216
230
|
const defaultAgentId = resolveDefaultAgentId(cfg);
|
|
217
231
|
const agentDir = this.api.runtime.agent.resolveAgentDir(cfg, defaultAgentId);
|
|
218
232
|
const remote = this.embedding.apiKey || this.embedding.baseUrl ? {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/memory-lancedb",
|
|
3
|
-
"version": "2026.5.
|
|
3
|
+
"version": "2026.5.9-beta.1",
|
|
4
4
|
"description": "OpenClaw LanceDB-backed long-term memory plugin with auto-recall/capture",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"@lancedb/lancedb": "^0.27.2",
|
|
12
12
|
"apache-arrow": "18.1.0",
|
|
13
13
|
"openai": "^6.36.0",
|
|
14
|
-
"typebox": "1.1.
|
|
14
|
+
"typebox": "1.1.38"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@openclaw/plugin-sdk": "workspace:*"
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"minHostVersion": ">=2026.4.10"
|
|
27
27
|
},
|
|
28
28
|
"compat": {
|
|
29
|
-
"pluginApi": ">=2026.5.
|
|
29
|
+
"pluginApi": ">=2026.5.9-beta.1"
|
|
30
30
|
},
|
|
31
31
|
"build": {
|
|
32
|
-
"openclawVersion": "2026.5.
|
|
32
|
+
"openclawVersion": "2026.5.9-beta.1"
|
|
33
33
|
},
|
|
34
34
|
"release": {
|
|
35
35
|
"publishToClawHub": true,
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"openclaw.plugin.json"
|
|
45
45
|
],
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"openclaw": ">=2026.5.
|
|
47
|
+
"openclaw": ">=2026.5.9-beta.1"
|
|
48
48
|
},
|
|
49
49
|
"peerDependenciesMeta": {
|
|
50
50
|
"openclaw": {
|