@joshuaswarren/openclaw-engram 9.1.5 → 9.1.6
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/package.json +4 -2
- package/scripts/rebuild-native.mjs +72 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@joshuaswarren/openclaw-engram",
|
|
3
|
-
"version": "9.1.
|
|
3
|
+
"version": "9.1.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Local-first memory plugin for OpenClaw. LLM-powered extraction, markdown storage, hybrid search via QMD.",
|
|
6
6
|
"keywords": [
|
|
@@ -49,7 +49,8 @@
|
|
|
49
49
|
"files": [
|
|
50
50
|
"dist",
|
|
51
51
|
"bin/engram-access.js",
|
|
52
|
-
"openclaw.plugin.json"
|
|
52
|
+
"openclaw.plugin.json",
|
|
53
|
+
"scripts/rebuild-native.mjs"
|
|
53
54
|
],
|
|
54
55
|
"dependencies": {
|
|
55
56
|
"@honcho-ai/sdk": "^2.0.0",
|
|
@@ -91,6 +92,7 @@
|
|
|
91
92
|
"review:cursor": "bash scripts/cursor-prepush-review.sh",
|
|
92
93
|
"hooks:install": "bash scripts/install-git-hooks.sh",
|
|
93
94
|
"migrate": "tsx scripts/migrate.ts",
|
|
95
|
+
"postinstall": "node scripts/rebuild-native.mjs",
|
|
94
96
|
"prepack": "npm run build"
|
|
95
97
|
},
|
|
96
98
|
"publishConfig": {
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* postinstall: rebuild better-sqlite3 native addon if missing or incompatible.
|
|
4
|
+
*
|
|
5
|
+
* When Engram is installed as an OpenClaw plugin (npm install or gateway
|
|
6
|
+
* plugin copy), the pre-built native binary for better-sqlite3 may not
|
|
7
|
+
* match the target platform/Node version or may be absent entirely.
|
|
8
|
+
* This script detects that and runs `npm rebuild better-sqlite3` to
|
|
9
|
+
* compile it.
|
|
10
|
+
*
|
|
11
|
+
* Runs silently on success; logs only on rebuild or error.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { existsSync } from "node:fs";
|
|
15
|
+
import { execSync } from "node:child_process";
|
|
16
|
+
import { createRequire } from "node:module";
|
|
17
|
+
import { join, dirname } from "node:path";
|
|
18
|
+
import { fileURLToPath } from "node:url";
|
|
19
|
+
|
|
20
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
21
|
+
const root = join(__dirname, "..");
|
|
22
|
+
|
|
23
|
+
// Check if better-sqlite3 is even installed (it may be hoisted or absent
|
|
24
|
+
// in workspace setups).
|
|
25
|
+
const bsqlDir = join(root, "node_modules", "better-sqlite3");
|
|
26
|
+
if (!existsSync(bsqlDir)) {
|
|
27
|
+
// Not installed locally — skip (the gateway's top-level node_modules
|
|
28
|
+
// may provide it).
|
|
29
|
+
process.exit(0);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Try to load the native addon. This catches both "file missing" and
|
|
33
|
+
// "binary compiled for a different Node ABI version" cases.
|
|
34
|
+
let needsRebuild = false;
|
|
35
|
+
try {
|
|
36
|
+
const require = createRequire(join(root, "package.json"));
|
|
37
|
+
require("better-sqlite3");
|
|
38
|
+
} catch {
|
|
39
|
+
needsRebuild = true;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (!needsRebuild) {
|
|
43
|
+
// Addon loads fine — nothing to do.
|
|
44
|
+
process.exit(0);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
console.log("[engram] better-sqlite3 native addon missing or incompatible — rebuilding...");
|
|
48
|
+
try {
|
|
49
|
+
execSync("npm rebuild better-sqlite3", {
|
|
50
|
+
cwd: root,
|
|
51
|
+
stdio: "inherit",
|
|
52
|
+
timeout: 120_000,
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// Verify the rebuild worked
|
|
56
|
+
try {
|
|
57
|
+
const require = createRequire(join(root, "package.json"));
|
|
58
|
+
require("better-sqlite3");
|
|
59
|
+
console.log("[engram] better-sqlite3 rebuilt successfully.");
|
|
60
|
+
} catch {
|
|
61
|
+
console.warn(
|
|
62
|
+
"[engram] WARNING: npm rebuild completed but addon still fails to load.",
|
|
63
|
+
);
|
|
64
|
+
console.warn(
|
|
65
|
+
"[engram] Engram will fall back to non-SQLite storage paths.",
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
} catch (err) {
|
|
69
|
+
// Don't fail the install — Engram can degrade gracefully without SQLite.
|
|
70
|
+
console.warn("[engram] WARNING: failed to rebuild better-sqlite3:", err.message);
|
|
71
|
+
console.warn("[engram] Engram will fall back to non-SQLite storage paths.");
|
|
72
|
+
}
|