@t0ken.ai/memoryx-openclaw-plugin 1.1.0 → 1.1.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.d.ts.map +1 -1
- package/dist/index.js +54 -14
- package/openclaw.plugin.json +1 -1
- package/package.json +3 -1
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAWH,UAAU,YAAY;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAUD,UAAU,OAAO;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,YAAY;IAClB,QAAQ,EAAE,KAAK,CAAC;QACZ,EAAE,EAAE,MAAM,CAAC;QACX,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;KACjB,CAAC,CAAC;IACH,SAAS,EAAE,OAAO,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AA6ED,cAAM,kBAAkB;IACpB,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,QAAQ,CAAc;IAC9B,OAAO,CAAC,cAAc,CAAc;IACpC,OAAO,CAAC,SAAS,CAAsB;IACvC,OAAO,CAAC,cAAc,CAAsB;IAC5C,OAAO,CAAC,OAAO,CAAW;IAE1B,OAAO,CAAC,QAAQ,CA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Ae,IAAI,OAAO,CAAC,IAAI,CAAC;IAKtC,SAAS,IAAI;QAChB,WAAW,EAAE,OAAO,CAAC;QACrB,SAAS,EAAE,OAAO,CAAC;QACnB,YAAY,EAAE;YAAE,YAAY,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAA;SAAE,CAAA;KAC7D;CAOJ;;;;;;kBAUiB,GAAG,iBAAiB,YAAY,GAAG,IAAI;;AANzD,wBAqEE;AAEF,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -14,15 +14,55 @@ import * as fs from "fs";
|
|
|
14
14
|
import * as path from "path";
|
|
15
15
|
import * as os from "os";
|
|
16
16
|
import * as crypto from "crypto";
|
|
17
|
+
import Database from "better-sqlite3";
|
|
17
18
|
const DEFAULT_API_BASE = "https://t0ken.ai/api";
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
let db = null;
|
|
20
|
+
let dbPath = "";
|
|
21
|
+
function getDbPath() {
|
|
22
|
+
if (dbPath)
|
|
23
|
+
return dbPath;
|
|
24
|
+
const possiblePaths = [
|
|
25
|
+
path.join(process.cwd(), "memoryx.sqlite"),
|
|
26
|
+
path.join(os.homedir(), ".openclaw", "extensions", "memoryx-openclaw-plugin", "memoryx.sqlite"),
|
|
27
|
+
path.join(os.homedir(), ".t0ken", "memoryx.sqlite")
|
|
28
|
+
];
|
|
29
|
+
for (const p of possiblePaths) {
|
|
30
|
+
if (fs.existsSync(p)) {
|
|
31
|
+
dbPath = p;
|
|
32
|
+
return dbPath;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
dbPath = path.join(os.homedir(), ".openclaw", "extensions", "memoryx-openclaw-plugin", "memoryx.sqlite");
|
|
36
|
+
const dir = path.dirname(dbPath);
|
|
37
|
+
if (!fs.existsSync(dir)) {
|
|
38
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
39
|
+
}
|
|
40
|
+
return dbPath;
|
|
41
|
+
}
|
|
42
|
+
function initDb() {
|
|
43
|
+
const dbFile = getDbPath();
|
|
44
|
+
const database = new Database(dbFile);
|
|
45
|
+
database.exec(`
|
|
46
|
+
CREATE TABLE IF NOT EXISTS config (
|
|
47
|
+
key TEXT PRIMARY KEY,
|
|
48
|
+
value TEXT
|
|
49
|
+
)
|
|
50
|
+
`);
|
|
51
|
+
return database;
|
|
52
|
+
}
|
|
53
|
+
function getDb() {
|
|
54
|
+
if (!db) {
|
|
55
|
+
db = initDb();
|
|
56
|
+
}
|
|
57
|
+
return db;
|
|
58
|
+
}
|
|
59
|
+
class SQLiteStorage {
|
|
21
60
|
static load() {
|
|
22
61
|
try {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
62
|
+
const database = getDb();
|
|
63
|
+
const row = database.prepare("SELECT value FROM config WHERE key = 'config'").get();
|
|
64
|
+
if (row) {
|
|
65
|
+
return JSON.parse(row.value);
|
|
26
66
|
}
|
|
27
67
|
}
|
|
28
68
|
catch (e) {
|
|
@@ -32,10 +72,10 @@ class FileStorage {
|
|
|
32
72
|
}
|
|
33
73
|
static save(config) {
|
|
34
74
|
try {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
75
|
+
const database = getDb();
|
|
76
|
+
database.prepare(`
|
|
77
|
+
INSERT OR REPLACE INTO config (key, value) VALUES ('config', ?)
|
|
78
|
+
`).run(JSON.stringify(config));
|
|
39
79
|
}
|
|
40
80
|
catch (e) {
|
|
41
81
|
console.warn("[MemoryX] Failed to save config:", e);
|
|
@@ -160,7 +200,7 @@ class MemoryXPlugin {
|
|
|
160
200
|
this.config.initialized = true;
|
|
161
201
|
}
|
|
162
202
|
loadConfig() {
|
|
163
|
-
const stored =
|
|
203
|
+
const stored = SQLiteStorage.load();
|
|
164
204
|
if (stored) {
|
|
165
205
|
this.config = {
|
|
166
206
|
...this.config,
|
|
@@ -170,7 +210,7 @@ class MemoryXPlugin {
|
|
|
170
210
|
}
|
|
171
211
|
}
|
|
172
212
|
saveConfig() {
|
|
173
|
-
|
|
213
|
+
SQLiteStorage.save(this.config);
|
|
174
214
|
}
|
|
175
215
|
async autoRegister() {
|
|
176
216
|
try {
|
|
@@ -334,14 +374,14 @@ let plugin;
|
|
|
334
374
|
export default {
|
|
335
375
|
id: "memoryx-openclaw-plugin",
|
|
336
376
|
name: "MemoryX Real-time Plugin",
|
|
337
|
-
version: "1.1.
|
|
377
|
+
version: "1.1.1",
|
|
338
378
|
description: "Real-time memory capture and recall for OpenClaw",
|
|
339
379
|
register(api, pluginConfig) {
|
|
340
380
|
api.logger.info("[MemoryX] Plugin registering...");
|
|
341
381
|
if (pluginConfig?.apiBaseUrl) {
|
|
342
382
|
api.logger.info(`[MemoryX] API Base: \`${pluginConfig.apiBaseUrl}\``);
|
|
343
383
|
}
|
|
344
|
-
api.logger.info(`[MemoryX]
|
|
384
|
+
api.logger.info(`[MemoryX] Database: ${getDbPath()}`);
|
|
345
385
|
plugin = new MemoryXPlugin(pluginConfig);
|
|
346
386
|
api.on("message_received", async (event, ctx) => {
|
|
347
387
|
const { content, from, timestamp } = event;
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t0ken.ai/memoryx-openclaw-plugin",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "MemoryX real-time memory capture and recall plugin for OpenClaw",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "MemoryX Team",
|
|
@@ -29,11 +29,13 @@
|
|
|
29
29
|
"extensions": ["./dist/index.js"]
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
+
"@types/better-sqlite3": "^7.6.0",
|
|
32
33
|
"@types/node": "^20.0.0",
|
|
33
34
|
"typescript": "^5.0.0"
|
|
34
35
|
},
|
|
35
36
|
"dependencies": {
|
|
36
37
|
"@huggingface/transformers": "^3.8.1",
|
|
38
|
+
"better-sqlite3": "^11.0.0",
|
|
37
39
|
"js-tiktoken": "^1.0.21",
|
|
38
40
|
"onnxruntime-node": "^1.24.1",
|
|
39
41
|
"onnxruntime-web": "^1.24.1"
|