@openclaw/memory-lancedb 2026.5.7 → 2026.5.10-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 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.client = new OpenAI({
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.client.post("/embeddings", {
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 ? {
@@ -2299,14 +2299,6 @@ function afterEach(fn, timeout) {
2299
2299
  };
2300
2300
  return getCurrentSuite().on("afterEach", withTimeout(wrapper, timeout ?? getDefaultHookTimeout(), true, /* @__PURE__ */ new Error("STACK_TRACE_ERROR"), abortIfTimeout));
2301
2301
  }
2302
- createTestHook("onTestFailed", (test, handler, timeout) => {
2303
- test.onFailed ||= [];
2304
- test.onFailed.push(withTimeout(handler, timeout ?? getDefaultHookTimeout(), true, /* @__PURE__ */ new Error("STACK_TRACE_ERROR"), abortIfTimeout));
2305
- });
2306
- createTestHook("onTestFinished", (test, handler, timeout) => {
2307
- test.onFinished ||= [];
2308
- test.onFinished.push(withTimeout(handler, timeout ?? getDefaultHookTimeout(), true, /* @__PURE__ */ new Error("STACK_TRACE_ERROR"), abortIfTimeout));
2309
- });
2310
2302
  /**
2311
2303
  * Registers a callback function that wraps around all tests within the current suite.
2312
2304
  * The callback receives a `runSuite` function that must be called to run the suite's tests.
@@ -2406,14 +2398,6 @@ function withSuiteFixtures(suiteHook, fn, context, stackTraceError, contextIndex
2406
2398
  })();
2407
2399
  };
2408
2400
  }
2409
- function createTestHook(name, handler) {
2410
- return (fn, timeout) => {
2411
- assertTypes(fn, `"${name}" callback`, ["function"]);
2412
- const current = getCurrentTest();
2413
- if (!current) throw new Error(`Hook ${name}() can only be called inside a test`);
2414
- return handler(current, fn, timeout);
2415
- };
2416
- }
2417
2401
  function findTestFileStackTrace(testFilePath, error) {
2418
2402
  const lines = error.split("\n").slice(1);
2419
2403
  for (const line of lines) {
@@ -3049,7 +3033,7 @@ function makeTimeoutError(isHook, timeout, stackTraceError) {
3049
3033
  }
3050
3034
  globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
3051
3035
  globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
3052
- const unixNow = Date.now;
3036
+ Date.now;
3053
3037
  const { clearTimeout, setTimeout: setTimeout$1 } = getSafeTimers();
3054
3038
  const packs = /* @__PURE__ */ new Map();
3055
3039
  const eventsPacks = [];
@@ -3076,21 +3060,6 @@ async function finishSendTasksUpdate(runner) {
3076
3060
  sendTasksUpdate(runner);
3077
3061
  await Promise.all(pendingTasksUpdates);
3078
3062
  }
3079
- function throttle(fn, ms) {
3080
- let last = 0;
3081
- let pendingCall;
3082
- return function call(...args) {
3083
- const now = unixNow();
3084
- if (now - last > ms) {
3085
- last = now;
3086
- clearTimeout(pendingCall);
3087
- pendingCall = void 0;
3088
- return fn.apply(this, args);
3089
- }
3090
- pendingCall ??= setTimeout$1(() => call.bind(this)(...args), ms);
3091
- };
3092
- }
3093
- throttle(sendTasksUpdate, 100);
3094
3063
  /**
3095
3064
  * @experimental
3096
3065
  * @advanced
@@ -1,7 +1,9 @@
1
1
  {
2
2
  "id": "memory-lancedb",
3
+ "commandAliases": [{ "name": "ltm" }],
3
4
  "activation": {
4
- "onStartup": false
5
+ "onStartup": false,
6
+ "onCommands": ["ltm"]
5
7
  },
6
8
  "kind": "memory",
7
9
  "contracts": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/memory-lancedb",
3
- "version": "2026.5.7",
3
+ "version": "2026.5.10-beta.1",
4
4
  "description": "OpenClaw LanceDB-backed long-term memory plugin with auto-recall/capture",
5
5
  "repository": {
6
6
  "type": "git",
@@ -10,8 +10,8 @@
10
10
  "dependencies": {
11
11
  "@lancedb/lancedb": "^0.27.2",
12
12
  "apache-arrow": "18.1.0",
13
- "openai": "^6.36.0",
14
- "typebox": "1.1.37"
13
+ "openai": "^6.37.0",
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.7"
29
+ "pluginApi": ">=2026.5.10-beta.1"
30
30
  },
31
31
  "build": {
32
- "openclawVersion": "2026.5.7"
32
+ "openclawVersion": "2026.5.10-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.7"
47
+ "openclaw": ">=2026.5.10-beta.1"
48
48
  },
49
49
  "peerDependenciesMeta": {
50
50
  "openclaw": {