@memtensor/memos-local-openclaw-plugin 0.3.4 → 0.3.5
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 +3 -2
- package/scripts/postinstall.cjs +76 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memtensor/memos-local-openclaw-plugin",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "MemOS Local memory plugin for OpenClaw — full-write, hybrid-recall, progressive retrieval",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.ts",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"src",
|
|
11
11
|
"dist",
|
|
12
12
|
"skill",
|
|
13
|
+
"scripts/postinstall.cjs",
|
|
13
14
|
"openclaw.plugin.json",
|
|
14
15
|
"README.md",
|
|
15
16
|
".env.example"
|
|
@@ -27,7 +28,7 @@
|
|
|
27
28
|
"lint": "eslint src --ext .ts",
|
|
28
29
|
"test": "vitest run",
|
|
29
30
|
"test:watch": "vitest",
|
|
30
|
-
"postinstall": "node
|
|
31
|
+
"postinstall": "node scripts/postinstall.cjs",
|
|
31
32
|
"prepublishOnly": "npm run build"
|
|
32
33
|
},
|
|
33
34
|
"keywords": [
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const { spawnSync } = require("child_process");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
|
|
7
|
+
const RESET = "\x1b[0m";
|
|
8
|
+
const GREEN = "\x1b[32m";
|
|
9
|
+
const YELLOW = "\x1b[33m";
|
|
10
|
+
const RED = "\x1b[31m";
|
|
11
|
+
const CYAN = "\x1b[36m";
|
|
12
|
+
const BOLD = "\x1b[1m";
|
|
13
|
+
|
|
14
|
+
function log(msg) { console.log(`${CYAN}[memos-local]${RESET} ${msg}`); }
|
|
15
|
+
function warn(msg) { console.log(`${YELLOW}[memos-local]${RESET} ${msg}`); }
|
|
16
|
+
function ok(msg) { console.log(`${GREEN}[memos-local]${RESET} ${msg}`); }
|
|
17
|
+
function fail(msg) { console.log(`${RED}[memos-local]${RESET} ${msg}`); }
|
|
18
|
+
|
|
19
|
+
log("Checking better-sqlite3 native module...");
|
|
20
|
+
|
|
21
|
+
try {
|
|
22
|
+
require("better-sqlite3");
|
|
23
|
+
ok("better-sqlite3 is ready.");
|
|
24
|
+
process.exit(0);
|
|
25
|
+
} catch (_) {
|
|
26
|
+
warn("better-sqlite3 native bindings not found, attempting rebuild...");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
log(`Node: ${process.version} Platform: ${process.platform}-${process.arch}`);
|
|
30
|
+
log("Running: npm rebuild better-sqlite3 (this may take 30-60 seconds)...");
|
|
31
|
+
|
|
32
|
+
const startMs = Date.now();
|
|
33
|
+
|
|
34
|
+
const result = spawnSync("npm", ["rebuild", "better-sqlite3"], {
|
|
35
|
+
cwd: path.resolve(__dirname, ".."),
|
|
36
|
+
stdio: "inherit",
|
|
37
|
+
shell: true,
|
|
38
|
+
timeout: 180_000,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const elapsed = ((Date.now() - startMs) / 1000).toFixed(1);
|
|
42
|
+
|
|
43
|
+
if (result.status === 0) {
|
|
44
|
+
try {
|
|
45
|
+
delete require.cache[require.resolve("better-sqlite3")];
|
|
46
|
+
require("better-sqlite3");
|
|
47
|
+
ok(`better-sqlite3 rebuilt successfully (${elapsed}s).`);
|
|
48
|
+
process.exit(0);
|
|
49
|
+
} catch (_) {
|
|
50
|
+
fail(`Rebuild completed but module still cannot load (${elapsed}s).`);
|
|
51
|
+
}
|
|
52
|
+
} else {
|
|
53
|
+
fail(`Rebuild failed with exit code ${result.status} (${elapsed}s).`);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const pluginDir = path.resolve(__dirname, "..");
|
|
57
|
+
console.log(`
|
|
58
|
+
${YELLOW}${BOLD}╔══════════════════════════════════════════════════════════════╗
|
|
59
|
+
║ better-sqlite3 native module build failed ║
|
|
60
|
+
╠══════════════════════════════════════════════════════════════╣${RESET}
|
|
61
|
+
${YELLOW}║${RESET} This plugin requires C/C++ build tools to compile ${YELLOW}║${RESET}
|
|
62
|
+
${YELLOW}║${RESET} the SQLite native module on first install. ${YELLOW}║${RESET}
|
|
63
|
+
${YELLOW}║${RESET} ${YELLOW}║${RESET}
|
|
64
|
+
${YELLOW}║${RESET} ${BOLD}Fix:${RESET} ${YELLOW}║${RESET}
|
|
65
|
+
${YELLOW}║${RESET} ${YELLOW}║${RESET}
|
|
66
|
+
${YELLOW}║${RESET} ${CYAN}macOS:${RESET} xcode-select --install ${YELLOW}║${RESET}
|
|
67
|
+
${YELLOW}║${RESET} ${CYAN}Ubuntu:${RESET} sudo apt install build-essential python3 ${YELLOW}║${RESET}
|
|
68
|
+
${YELLOW}║${RESET} ${CYAN}Windows:${RESET} npm install -g windows-build-tools ${YELLOW}║${RESET}
|
|
69
|
+
${YELLOW}║${RESET} ${YELLOW}║${RESET}
|
|
70
|
+
${YELLOW}║${RESET} Then retry: ${YELLOW}║${RESET}
|
|
71
|
+
${YELLOW}║${RESET} ${GREEN}cd ${pluginDir}${RESET}
|
|
72
|
+
${YELLOW}║${RESET} ${GREEN}npm rebuild better-sqlite3${RESET} ${YELLOW}║${RESET}
|
|
73
|
+
${YELLOW}${BOLD}╚══════════════════════════════════════════════════════════════╝${RESET}
|
|
74
|
+
`);
|
|
75
|
+
|
|
76
|
+
process.exit(0);
|