@openclaw/memory-lancedb 2026.7.2-beta.5 → 2026.7.2-beta.7

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.
@@ -247,6 +247,18 @@ async function runWithTimeout(params) {
247
247
  function formatMemoryRecallError(error) {
248
248
  return error instanceof Error ? error.message : String(error);
249
249
  }
250
+ function isMemoryRecallTimeoutError(error) {
251
+ let current = error;
252
+ for (let depth = 0; depth < 3 && current !== void 0; depth += 1) {
253
+ const record = asOptionalRecord(current);
254
+ const name = current instanceof Error ? current.name : typeof record?.name === "string" ? record.name : "";
255
+ const message = current instanceof Error ? current.message : typeof record?.message === "string" ? record.message : "";
256
+ const code = typeof record?.code === "string" ? record.code : "";
257
+ if (name === "APIConnectionTimeoutError" || name === "TimeoutError" || code === "ETIMEDOUT" || /^UND_ERR_.*_TIMEOUT$/.test(code) || /\btimed out\b/i.test(message)) return true;
258
+ current = record?.cause;
259
+ }
260
+ return false;
261
+ }
250
262
  function buildMemoryRecallUnavailableResult(error) {
251
263
  return {
252
264
  content: [{
@@ -270,6 +282,7 @@ var MemoryRecallEmbeddingError = class extends Error {
270
282
  };
271
283
  const testing = {
272
284
  isEmbeddingDimensionsRejectedError,
285
+ isMemoryRecallTimeoutError,
273
286
  runWithTimeout,
274
287
  truncateEmbeddingVector
275
288
  };
@@ -296,4 +309,4 @@ function normalizeEmbeddingVector(value) {
296
309
  throw new Error("Embedding response is missing a vector");
297
310
  }
298
311
  //#endregion
299
- export { MemoryRecallEmbeddingError, buildMemoryRecallUnavailableResult, createEmbeddings, formatMemoryRecallError, normalizeEmbeddingVector, runWithTimeout, testing };
312
+ export { MemoryRecallEmbeddingError, buildMemoryRecallUnavailableResult, createEmbeddings, formatMemoryRecallError, isMemoryRecallTimeoutError, normalizeEmbeddingVector, runWithTimeout, testing };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { definePluginEntry } from "./api.js";
2
2
  import { MEMORY_CATEGORIES, memoryConfigSchema, vectorDimsForModel } from "./config.js";
3
- import { MemoryRecallEmbeddingError, buildMemoryRecallUnavailableResult, createEmbeddings, formatMemoryRecallError, normalizeEmbeddingVector, runWithTimeout, testing } from "./embeddings.js";
3
+ import { MemoryRecallEmbeddingError, buildMemoryRecallUnavailableResult, createEmbeddings, formatMemoryRecallError, isMemoryRecallTimeoutError, normalizeEmbeddingVector, runWithTimeout, testing } from "./embeddings.js";
4
4
  import { MemoryDB } from "./lancedb-store.js";
5
5
  import { dropMediaNoteLines, looksLikeEnvelopeSludge, sanitizeForMemoryCapture } from "./memory-capture-sanitization.js";
6
6
  import { cleanMemorySearchResults, detectCategory, escapeMemoryForPrompt, extractLatestUserText, extractUserTextContent, findCleanDuplicateMemory, formatRelevantMemoriesContext, looksLikePromptInjection, messageFingerprint, normalizeRecallQuery, resolveAutoCaptureStartIndex, shouldCapture } from "./memory-policy.js";
@@ -18,7 +18,7 @@ import { Type } from "typebox";
18
18
  const loadMemoryHostCoreModule = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/memory-host-core"));
19
19
  const DEFAULT_AUTO_RECALL_TIMEOUT_MS = 15e3;
20
20
  const DEFAULT_TOOL_RECALL_TIMEOUT_MS = 15e3;
21
- const DEFAULT_TOOL_RECALL_COOLDOWN_MS = 6e4;
21
+ const DEFAULT_RECALL_COOLDOWN_MS = 6e4;
22
22
  const DEFAULT_TOOL_RECALL_OVERFETCH_EXTRA = 10;
23
23
  const DEFAULT_AUTO_RECALL_OVERFETCH_LIMIT = 10;
24
24
  const DEFAULT_AUTO_RECALL_RESULT_CAP = 3;
@@ -97,7 +97,7 @@ var memory_lancedb_default = definePluginEntry({
97
97
  };
98
98
  const recordMemoryRecallCooldown = (agentId, error) => {
99
99
  memoryRecallCooldowns.set(agentId, {
100
- until: Date.now() + DEFAULT_TOOL_RECALL_COOLDOWN_MS,
100
+ until: Date.now() + DEFAULT_RECALL_COOLDOWN_MS,
101
101
  error
102
102
  });
103
103
  };
@@ -124,6 +124,7 @@ var memory_lancedb_default = definePluginEntry({
124
124
  const currentCfg = resolveCurrentHookConfig();
125
125
  const cooldown = readMemoryRecallCooldown(agentId);
126
126
  if (cooldown) return buildMemoryRecallUnavailableResult(cooldown.error);
127
+ let recallPhase = "embedding";
127
128
  let recall;
128
129
  try {
129
130
  recall = await runWithTimeout({
@@ -135,19 +136,20 @@ var memory_lancedb_default = definePluginEntry({
135
136
  } catch (error) {
136
137
  throw new MemoryRecallEmbeddingError(error);
137
138
  }
139
+ recallPhase = "search";
138
140
  return await db.search(agentId, vector, limit + DEFAULT_TOOL_RECALL_OVERFETCH_EXTRA, .1);
139
141
  }
140
142
  });
141
143
  } catch (error) {
142
144
  if (!(error instanceof MemoryRecallEmbeddingError)) throw error;
143
145
  const message = formatMemoryRecallError(error.originalError);
144
- recordMemoryRecallCooldown(agentId, message);
146
+ if (isMemoryRecallTimeoutError(error.originalError)) recordMemoryRecallCooldown(agentId, message);
145
147
  api.logger.warn?.(`memory-lancedb: memory_recall failed: ${message}; returning unavailable memory result`);
146
148
  return buildMemoryRecallUnavailableResult(message);
147
149
  }
148
150
  if (recall.status === "timeout") {
149
151
  const message = `memory_recall timed out after ${Math.round(DEFAULT_TOOL_RECALL_TIMEOUT_MS / 1e3)}s`;
150
- recordMemoryRecallCooldown(agentId, message);
152
+ if (recallPhase === "embedding") recordMemoryRecallCooldown(agentId, message);
151
153
  api.logger.warn?.(`memory-lancedb: memory_recall timed out after ${DEFAULT_TOOL_RECALL_TIMEOUT_MS}ms; returning unavailable memory result`);
152
154
  return buildMemoryRecallUnavailableResult(message);
153
155
  }
@@ -352,17 +354,30 @@ var memory_lancedb_default = definePluginEntry({
352
354
  const agentId = resolveEnabledAgentId(ctx.agentId);
353
355
  if (!agentId) return;
354
356
  if (!event.prompt || event.prompt.length < 5) return;
357
+ const cooldown = readMemoryRecallCooldown(agentId);
358
+ if (cooldown) {
359
+ api.logger.debug?.(`memory-lancedb: auto-recall skipped during recall cooldown: ${cooldown.error}`);
360
+ return;
361
+ }
355
362
  try {
356
363
  const recallQuery = normalizeRecallQuery(dropMediaNoteLines(extractLatestUserText(Array.isArray(event.messages) ? event.messages : []) ?? event.prompt), currentCfg.recallMaxChars);
357
364
  if (!recallQuery) return;
365
+ let recallPhase = "embedding";
358
366
  const recall = await runWithTimeout({
359
367
  timeoutMs: DEFAULT_AUTO_RECALL_TIMEOUT_MS,
360
368
  task: async () => {
361
- const vector = await embeddings.embed(recallQuery, { timeoutMs: DEFAULT_AUTO_RECALL_TIMEOUT_MS });
369
+ let vector;
370
+ try {
371
+ vector = await embeddings.embed(recallQuery, { timeoutMs: DEFAULT_AUTO_RECALL_TIMEOUT_MS });
372
+ } catch (error) {
373
+ throw new MemoryRecallEmbeddingError(error);
374
+ }
375
+ recallPhase = "search";
362
376
  return await db.search(agentId, vector, DEFAULT_AUTO_RECALL_OVERFETCH_LIMIT, .3);
363
377
  }
364
378
  });
365
379
  if (recall.status === "timeout") {
380
+ if (recallPhase === "embedding") recordMemoryRecallCooldown(agentId, `auto-recall timed out after ${Math.round(DEFAULT_AUTO_RECALL_TIMEOUT_MS / 1e3)}s`);
366
381
  api.logger.warn?.(`memory-lancedb: auto-recall timed out after ${DEFAULT_AUTO_RECALL_TIMEOUT_MS}ms; skipping memory injection to avoid stalling agent startup`);
367
382
  return;
368
383
  }
@@ -376,6 +391,7 @@ var memory_lancedb_default = definePluginEntry({
376
391
  if (!context) return;
377
392
  return { prependContext: context };
378
393
  } catch (err) {
394
+ if (err instanceof MemoryRecallEmbeddingError && isMemoryRecallTimeoutError(err.originalError)) recordMemoryRecallCooldown(agentId, formatMemoryRecallError(err.originalError));
379
395
  api.logger.warn(`memory-lancedb: recall failed: ${String(err)}`);
380
396
  }
381
397
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/memory-lancedb",
3
- "version": "2026.7.2-beta.5",
3
+ "version": "2026.7.2-beta.7",
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,9 +8,9 @@
8
8
  },
9
9
  "type": "module",
10
10
  "dependencies": {
11
- "@lancedb/lancedb": "0.30.0",
11
+ "@lancedb/lancedb": "0.31.0",
12
12
  "apache-arrow": "18.1.0",
13
- "openai": "6.48.0",
13
+ "openai": "6.49.0",
14
14
  "typebox": "1.3.6"
15
15
  },
16
16
  "devDependencies": {
@@ -26,10 +26,10 @@
26
26
  "minHostVersion": ">=2026.5.31"
27
27
  },
28
28
  "compat": {
29
- "pluginApi": ">=2026.7.2-beta.5"
29
+ "pluginApi": ">=2026.7.2-beta.7"
30
30
  },
31
31
  "build": {
32
- "openclawVersion": "2026.7.2-beta.5"
32
+ "openclawVersion": "2026.7.2-beta.7"
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.7.2-beta.5"
49
+ "openclaw": ">=2026.7.2-beta.7"
50
50
  },
51
51
  "peerDependenciesMeta": {
52
52
  "openclaw": {