memory-braid 0.8.0 → 0.8.3

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/README.md CHANGED
@@ -129,13 +129,13 @@ openclaw plugins install memory-braid@0.8.0
129
129
 
130
130
  ```bash
131
131
  cd ~/.openclaw/extensions/memory-braid
132
- npm rebuild sqlite3 sharp
132
+ npm rebuild better-sqlite3 sharp
133
133
  ```
134
134
 
135
135
  Why this step exists:
136
136
  - OpenClaw plugin installs run `npm install --omit=dev --ignore-scripts` for safety.
137
137
  - This behavior is currently not user-overridable from `openclaw plugins install`.
138
- - `memory-braid` needs native artifacts for `sqlite3` (required by Mem0 OSS) and `sharp` (used by `@xenova/transformers`).
138
+ - `memory-braid` needs native artifacts for `better-sqlite3` (required by Mem0 OSS) and `sharp` (used by `@xenova/transformers`).
139
139
 
140
140
  3. Enable and set as active memory slot:
141
141
 
@@ -172,7 +172,7 @@ openclaw gateway restart
172
172
 
173
173
  If you install from npm and see native module errors like:
174
174
 
175
- - `Could not locate the bindings file` (sqlite3)
175
+ - `Could not locate the bindings file` (`better-sqlite3`)
176
176
  - `.../node_modules/jiti/.../node_sqlite3.node` in the stack/error text
177
177
  - `Cannot find module ... sharp-*.node`
178
178
 
@@ -180,13 +180,13 @@ run:
180
180
 
181
181
  ```bash
182
182
  cd ~/.openclaw/extensions/memory-braid
183
- npm rebuild sqlite3 sharp
183
+ npm rebuild better-sqlite3 sharp
184
184
  openclaw gateway restart
185
185
  ```
186
186
 
187
187
  Note:
188
188
  - The `jiti/.../node_sqlite3.node` error is still a sqlite native artifact/runtime loading issue.
189
- - `memory-braid` now preloads sqlite via native `require` to avoid that path, but you still need `npm rebuild sqlite3 sharp` after `--ignore-scripts` installs.
189
+ - `memory-braid` now preloads sqlite via native `require` to avoid that path, but you still need `npm rebuild better-sqlite3 sharp` after `--ignore-scripts` installs.
190
190
  - When this happens, startup logs now include `memory_braid.mem0.error` with:
191
191
  - `sqliteBindingsError: true`
192
192
  - `fixCommand` (copy/paste command for that machine)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "memory-braid",
3
- "version": "0.8.0",
3
+ "version": "0.8.3",
4
4
  "description": "OpenClaw memory plugin that augments local memory with Mem0 capture and recall.",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
package/src/index.ts CHANGED
@@ -1672,11 +1672,8 @@ const memoryBraidPlugin = {
1672
1672
  register(api: OpenClawPluginApi) {
1673
1673
  const cfg = parseConfig(api.pluginConfig);
1674
1674
  const log = new MemoryBraidLogger(api.logger, cfg.debug);
1675
- const initialStateDir = api.runtime.state.resolveStateDir();
1676
- const mem0 = new Mem0Adapter(cfg, log, { stateDir: initialStateDir });
1677
- const entityExtraction = new EntityExtractionManager(cfg.entityExtraction, log, {
1678
- stateDir: initialStateDir,
1679
- });
1675
+ const mem0 = new Mem0Adapter(cfg, log);
1676
+ const entityExtraction = new EntityExtractionManager(cfg.entityExtraction, log);
1680
1677
  const recallSeenByScope = new Map<string, string>();
1681
1678
  const captureSeenByScope = new Map<string, string>();
1682
1679
  const pendingInboundTurns = new Map<string, PendingInboundTurn>();
@@ -53,12 +53,25 @@ export function resolveLocalTools(api: OpenClawPluginApi, ctx: ToolContext): {
53
53
  searchTool: AnyTool | null;
54
54
  getTool: AnyTool | null;
55
55
  } {
56
- const searchTool = api.runtime.tools.createMemorySearchTool({
56
+ const runtimeTools = api.runtime?.tools as
57
+ | {
58
+ createMemorySearchTool?: (params: {
59
+ config: never;
60
+ agentSessionKey?: string;
61
+ }) => unknown;
62
+ createMemoryGetTool?: (params: {
63
+ config: never;
64
+ agentSessionKey?: string;
65
+ }) => unknown;
66
+ }
67
+ | undefined;
68
+
69
+ const searchTool = runtimeTools?.createMemorySearchTool?.({
57
70
  config: ctx.config as never,
58
71
  agentSessionKey: ctx.sessionKey,
59
72
  }) as unknown as AnyTool | null;
60
73
 
61
- const getTool = api.runtime.tools.createMemoryGetTool({
74
+ const getTool = runtimeTools?.createMemoryGetTool?.({
62
75
  config: ctx.config as never,
63
76
  agentSessionKey: ctx.sessionKey,
64
77
  }) as unknown as AnyTool | null;
@@ -677,14 +677,15 @@ export class Mem0Adapter {
677
677
  if (this.pluginDir) {
678
678
  return {
679
679
  pluginDir: this.pluginDir,
680
- fixCommand: `cd "${this.pluginDir}" && npm rebuild sqlite3 sharp && openclaw gateway restart`,
681
- why: "OpenClaw plugin installs use --ignore-scripts, so sqlite3/sharp native artifacts may be missing after install/update.",
680
+ fixCommand: `cd "${this.pluginDir}" && npm rebuild better-sqlite3 sharp && openclaw gateway restart`,
681
+ why: "OpenClaw plugin installs use --ignore-scripts, so better-sqlite3/sharp native artifacts may be missing after install/update.",
682
682
  };
683
683
  }
684
684
 
685
685
  return {
686
- fixCommand: "cd ~/.openclaw/extensions/memory-braid && npm rebuild sqlite3 sharp && openclaw gateway restart",
687
- why: "OpenClaw plugin installs use --ignore-scripts, so sqlite3/sharp native artifacts may be missing after install/update.",
686
+ fixCommand:
687
+ "cd ~/.openclaw/extensions/memory-braid && npm rebuild better-sqlite3 sharp && openclaw gateway restart",
688
+ why: "OpenClaw plugin installs use --ignore-scripts, so better-sqlite3/sharp native artifacts may be missing after install/update.",
688
689
  };
689
690
  }
690
691