@openclaw/memory-lancedb 2026.8.1-beta.3 → 2026.8.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/doctor-contract-api.js +4 -3
- package/dist/embeddings.js +6 -3
- package/dist/index.js +12 -7
- package/dist/memory-cli.js +1 -2
- package/dist/memory-policy.js +1 -0
- package/package.json +7 -7
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { MEMORY_AGENT_ID_COLUMN, MEMORY_TABLE_NAME, hasAgentScopeColumn, memoryAgentPredicate, quoteLanceSqlString } from "./lancedb-schema.js";
|
|
2
|
+
import { resolveDefaultAgentId } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
2
3
|
import { normalizeAgentId } from "openclaw/plugin-sdk/routing";
|
|
3
4
|
import { asOptionalRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
5
|
import path from "node:path";
|
|
5
6
|
import os from "node:os";
|
|
6
7
|
import fs from "node:fs";
|
|
7
8
|
import { fileURLToPath } from "node:url";
|
|
8
|
-
import { resolveDefaultAgentId } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
9
9
|
//#region extensions/memory-lancedb/doctor-contract-api.ts
|
|
10
10
|
const LEGACY_ENVELOPE_DELETE_BATCH_SIZE = 500;
|
|
11
11
|
function resolveLegacyMemoryOwner(config) {
|
|
@@ -57,11 +57,12 @@ function resolveConfiguredDbPath(config, env, pluginRoot) {
|
|
|
57
57
|
const configured = typeof pluginConfig?.dbPath === "string" ? pluginConfig.dbPath.trim() : "";
|
|
58
58
|
if (!configured) return path.join(resolveHome(env), ".openclaw", "memory", "lancedb");
|
|
59
59
|
if (configured.includes("://")) return configured;
|
|
60
|
-
if (configured.startsWith("~")) return path.resolve(configured.replace(/^~(?=$|[\\/])/, resolveHome(env)));
|
|
60
|
+
if (configured.startsWith("~")) return path.resolve(configured.replace(/^~(?=$|[\\/])/, () => resolveHome(env)));
|
|
61
61
|
return path.resolve(pluginRoot, configured);
|
|
62
62
|
}
|
|
63
63
|
function resolveStorageOptions(config, env) {
|
|
64
|
-
const
|
|
64
|
+
const pluginConfig = asOptionalRecord(config.plugins?.entries?.["memory-lancedb"]?.config);
|
|
65
|
+
const rawOptions = asOptionalRecord(pluginConfig?.storageOptions);
|
|
65
66
|
if (!rawOptions) return;
|
|
66
67
|
return Object.fromEntries(Object.entries(rawOptions).map(([key, value]) => {
|
|
67
68
|
if (typeof value !== "string") throw new Error(`memory-lancedb storageOptions.${key} must be a string`);
|
package/dist/embeddings.js
CHANGED
|
@@ -200,7 +200,7 @@ var ProviderAdapterEmbeddings = class {
|
|
|
200
200
|
fallback: "none",
|
|
201
201
|
model: embedding.model,
|
|
202
202
|
...remote ? { remote } : {},
|
|
203
|
-
...typeof embedding.dimensions === "number" ? {
|
|
203
|
+
...typeof embedding.dimensions === "number" ? { dimensions: embedding.dimensions } : {}
|
|
204
204
|
});
|
|
205
205
|
if (!result.provider) throw new Error(`Memory embedding provider ${providerId} is unavailable.`);
|
|
206
206
|
return result.provider;
|
|
@@ -214,13 +214,16 @@ var ProviderAdapterEmbeddings = class {
|
|
|
214
214
|
entry.activeUses += 1;
|
|
215
215
|
try {
|
|
216
216
|
const provider = await entry.promise;
|
|
217
|
-
if (!timeoutMs) return await provider.
|
|
217
|
+
if (!timeoutMs) return await provider.embed(text, { inputType: "query" });
|
|
218
218
|
const controller = new AbortController();
|
|
219
219
|
let timer;
|
|
220
220
|
try {
|
|
221
221
|
timer = setTimeout(() => controller.abort(/* @__PURE__ */ new Error("memory-lancedb embedding timed out")), resolveTimerTimeoutMs(timeoutMs, 1));
|
|
222
222
|
timer.unref?.();
|
|
223
|
-
return await provider.
|
|
223
|
+
return await provider.embed(text, {
|
|
224
|
+
signal: controller.signal,
|
|
225
|
+
inputType: "query"
|
|
226
|
+
});
|
|
224
227
|
} finally {
|
|
225
228
|
if (timer) clearTimeout(timer);
|
|
226
229
|
}
|
package/dist/index.js
CHANGED
|
@@ -6,8 +6,7 @@ import { cleanMemorySearchResults, detectCategory, escapeMemoryForPrompt, extrac
|
|
|
6
6
|
import { createAutoRecallHook } from "./auto-recall.js";
|
|
7
7
|
import { MemoryDB } from "./lancedb-store.js";
|
|
8
8
|
import { parseMemoryCliFilter, registerMemoryCli } from "./memory-cli.js";
|
|
9
|
-
import { resolveAgentConfig, resolveDefaultAgentId } from "openclaw/plugin-sdk/agent-runtime";
|
|
10
|
-
import { optionalFiniteNumberSchema, optionalPositiveIntegerSchema } from "openclaw/plugin-sdk/channel-actions";
|
|
9
|
+
import { resolveAgentConfig, resolveDefaultAgentId } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
11
10
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
12
11
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
13
12
|
import { readFiniteNumberParam, readPositiveIntegerParam } from "openclaw/plugin-sdk/param-readers";
|
|
@@ -78,7 +77,8 @@ var memory_lancedb_default = definePluginEntry({
|
|
|
78
77
|
autoCapture: false,
|
|
79
78
|
autoRecall: false
|
|
80
79
|
};
|
|
81
|
-
const
|
|
80
|
+
const vectorDim = dimensions ?? vectorDimsForModel(model);
|
|
81
|
+
const db = new MemoryDB(resolvedDbPath, vectorDim, cfg.storageOptions);
|
|
82
82
|
const autoCaptureCursors = /* @__PURE__ */ new Map();
|
|
83
83
|
const memoryRecallCooldowns = /* @__PURE__ */ new Map();
|
|
84
84
|
const resolveRuntimeConfig = () => api.runtime.config?.current?.() ?? api.config;
|
|
@@ -157,7 +157,10 @@ var memory_lancedb_default = definePluginEntry({
|
|
|
157
157
|
description: "Search through long-term memories. Use when you need context about user preferences, past decisions, or previously discussed topics.",
|
|
158
158
|
parameters: Type.Object({
|
|
159
159
|
query: Type.String({ description: "Search query" }),
|
|
160
|
-
limit:
|
|
160
|
+
limit: Type.Optional(Type.Integer({
|
|
161
|
+
description: "Max results (default: 5)",
|
|
162
|
+
minimum: 1
|
|
163
|
+
}))
|
|
161
164
|
}),
|
|
162
165
|
async execute(_toolCallId, params) {
|
|
163
166
|
assertRetainedToolEnabled(agentId, ctx.getRuntimeConfig);
|
|
@@ -238,11 +241,11 @@ var memory_lancedb_default = definePluginEntry({
|
|
|
238
241
|
description: "Save important information in long-term memory. Text over the configured capture limit is rejected. Success means the exact text already exists or the database commit completed; it does not guarantee semantic recall.",
|
|
239
242
|
parameters: Type.Object({
|
|
240
243
|
text: Type.String({ description: "Information to remember" }),
|
|
241
|
-
importance:
|
|
244
|
+
importance: Type.Optional(Type.Number({
|
|
242
245
|
description: "Importance 0-1 (default: 0.7)",
|
|
243
246
|
minimum: 0,
|
|
244
247
|
maximum: 1
|
|
245
|
-
}),
|
|
248
|
+
})),
|
|
246
249
|
category: Type.Optional(Type.Enum(MEMORY_CATEGORIES, { type: "string" }))
|
|
247
250
|
}),
|
|
248
251
|
async execute(_toolCallId, params) {
|
|
@@ -414,6 +417,8 @@ var memory_lancedb_default = definePluginEntry({
|
|
|
414
417
|
let capturableSeen = 0;
|
|
415
418
|
for (let index = startIndex; index < event.messages.length; index++) {
|
|
416
419
|
const message = event.messages[index];
|
|
420
|
+
const fingerprint = messageFingerprint(message);
|
|
421
|
+
if (fingerprint === void 0) continue;
|
|
417
422
|
let messageProcessed = false;
|
|
418
423
|
try {
|
|
419
424
|
for (const text of extractUserTextContent(message)) {
|
|
@@ -439,7 +444,7 @@ var memory_lancedb_default = definePluginEntry({
|
|
|
439
444
|
} finally {
|
|
440
445
|
if (messageProcessed && cursorKey) autoCaptureCursors.set(cursorKey, {
|
|
441
446
|
nextIndex: index + 1,
|
|
442
|
-
lastMessageFingerprint:
|
|
447
|
+
lastMessageFingerprint: fingerprint
|
|
443
448
|
});
|
|
444
449
|
}
|
|
445
450
|
}
|
package/dist/memory-cli.js
CHANGED
|
@@ -112,9 +112,8 @@ function registerMemoryCli(api, db, embeddings, resolveCliAgentId, resolveConfig
|
|
|
112
112
|
return 0;
|
|
113
113
|
});
|
|
114
114
|
rows = rows.slice(0, limit);
|
|
115
|
-
if (!outputColumns.includes(order.column)) for (const row of rows) delete row[order.column];
|
|
116
115
|
}
|
|
117
|
-
defaultRuntime.writeJson(rows);
|
|
116
|
+
defaultRuntime.writeJson(rows.map((row) => Object.fromEntries(outputColumns.map((column) => [column, row[column]]))));
|
|
118
117
|
});
|
|
119
118
|
memory.command("stats").description("Show memory statistics").option("--agent <id>", "Agent id (default: configured default agent)").action(async (opts) => {
|
|
120
119
|
const agentId = resolveCliAgentId(opts.agent);
|
package/dist/memory-policy.js
CHANGED
|
@@ -32,6 +32,7 @@ function normalizeMaxChars(value, fallback) {
|
|
|
32
32
|
}
|
|
33
33
|
function messageFingerprint(message) {
|
|
34
34
|
const msgObj = asOptionalRecord(message);
|
|
35
|
+
if (msgObj?.excludeFromContext === true) return;
|
|
35
36
|
if (!msgObj) return `${typeof message}:${String(message)}`;
|
|
36
37
|
try {
|
|
37
38
|
return JSON.stringify({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/memory-lancedb",
|
|
3
|
-
"version": "2026.8.
|
|
3
|
+
"version": "2026.8.2",
|
|
4
4
|
"description": "OpenClaw LanceDB-backed long-term memory plugin with auto-recall, auto-capture, and vector search.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@lancedb/lancedb": "0.
|
|
11
|
+
"@lancedb/lancedb": "0.37.1",
|
|
12
12
|
"apache-arrow": "18.1.0",
|
|
13
|
-
"openai": "
|
|
14
|
-
"typebox": "1.3.
|
|
13
|
+
"openai": "7.5.0",
|
|
14
|
+
"typebox": "1.3.17"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@openclaw/plugin-sdk": "workspace:*"
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"minHostVersion": ">=2026.5.31"
|
|
27
27
|
},
|
|
28
28
|
"compat": {
|
|
29
|
-
"pluginApi": ">=2026.8.
|
|
29
|
+
"pluginApi": ">=2026.8.2"
|
|
30
30
|
},
|
|
31
31
|
"build": {
|
|
32
|
-
"openclawVersion": "2026.8.
|
|
32
|
+
"openclawVersion": "2026.8.2"
|
|
33
33
|
},
|
|
34
34
|
"release": {
|
|
35
35
|
"bundleRuntimeDependencies": false,
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"README.md"
|
|
47
47
|
],
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"openclaw": ">=2026.8.
|
|
49
|
+
"openclaw": ">=2026.8.2"
|
|
50
50
|
},
|
|
51
51
|
"peerDependenciesMeta": {
|
|
52
52
|
"openclaw": {
|