@t0ken.ai/memoryx-openclaw-plugin 1.1.8 → 1.1.9
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 +22 -54
- package/package.json +2 -5
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;AA+CH,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;AA0BD,cAAM,kBAAkB;IACpB,OAAO,CAAC,QAAQ,CAAiB;IACjC,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;IAE5C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAK;IACrC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAkB;;IAM7C,OAAO,CAAC,UAA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AI;;AANzD,wBA0EE;AAEF,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -13,10 +13,10 @@ import * as fs from "fs";
|
|
|
13
13
|
import * as path from "path";
|
|
14
14
|
import * as os from "os";
|
|
15
15
|
import * as crypto from "crypto";
|
|
16
|
-
import Database from "better-sqlite3";
|
|
17
16
|
const DEFAULT_API_BASE = "https://t0ken.ai/api";
|
|
18
17
|
let logPath = "";
|
|
19
18
|
let logStream = null;
|
|
19
|
+
let configPath = "";
|
|
20
20
|
function getLogPath() {
|
|
21
21
|
if (logPath)
|
|
22
22
|
return logPath;
|
|
@@ -27,6 +27,16 @@ function getLogPath() {
|
|
|
27
27
|
}
|
|
28
28
|
return logPath;
|
|
29
29
|
}
|
|
30
|
+
function getConfigPath() {
|
|
31
|
+
if (configPath)
|
|
32
|
+
return configPath;
|
|
33
|
+
configPath = path.join(os.homedir(), ".openclaw", "extensions", "memoryx-openclaw-plugin", "config.json");
|
|
34
|
+
const dir = path.dirname(configPath);
|
|
35
|
+
if (!fs.existsSync(dir)) {
|
|
36
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
37
|
+
}
|
|
38
|
+
return configPath;
|
|
39
|
+
}
|
|
30
40
|
function log(message) {
|
|
31
41
|
const timestamp = new Date().toISOString();
|
|
32
42
|
const line = `[${timestamp}] ${message}\n`;
|
|
@@ -41,53 +51,13 @@ function log(message) {
|
|
|
41
51
|
}
|
|
42
52
|
console.log(`[MemoryX] ${message}`);
|
|
43
53
|
}
|
|
44
|
-
|
|
45
|
-
let dbPath = "";
|
|
46
|
-
function getDbPath() {
|
|
47
|
-
if (dbPath)
|
|
48
|
-
return dbPath;
|
|
49
|
-
const possiblePaths = [
|
|
50
|
-
path.join(process.cwd(), "memoryx.sqlite"),
|
|
51
|
-
path.join(os.homedir(), ".openclaw", "extensions", "memoryx-openclaw-plugin", "memoryx.sqlite"),
|
|
52
|
-
path.join(os.homedir(), ".t0ken", "memoryx.sqlite")
|
|
53
|
-
];
|
|
54
|
-
for (const p of possiblePaths) {
|
|
55
|
-
if (fs.existsSync(p)) {
|
|
56
|
-
dbPath = p;
|
|
57
|
-
return dbPath;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
dbPath = path.join(os.homedir(), ".openclaw", "extensions", "memoryx-openclaw-plugin", "memoryx.sqlite");
|
|
61
|
-
const dir = path.dirname(dbPath);
|
|
62
|
-
if (!fs.existsSync(dir)) {
|
|
63
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
64
|
-
}
|
|
65
|
-
return dbPath;
|
|
66
|
-
}
|
|
67
|
-
function initDb() {
|
|
68
|
-
const dbFile = getDbPath();
|
|
69
|
-
const database = new Database(dbFile);
|
|
70
|
-
database.exec(`
|
|
71
|
-
CREATE TABLE IF NOT EXISTS config (
|
|
72
|
-
key TEXT PRIMARY KEY,
|
|
73
|
-
value TEXT
|
|
74
|
-
)
|
|
75
|
-
`);
|
|
76
|
-
return database;
|
|
77
|
-
}
|
|
78
|
-
function getDb() {
|
|
79
|
-
if (!db) {
|
|
80
|
-
db = initDb();
|
|
81
|
-
}
|
|
82
|
-
return db;
|
|
83
|
-
}
|
|
84
|
-
class SQLiteStorage {
|
|
54
|
+
class JsonStorage {
|
|
85
55
|
static load() {
|
|
86
56
|
try {
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
return JSON.parse(
|
|
57
|
+
const filePath = getConfigPath();
|
|
58
|
+
if (fs.existsSync(filePath)) {
|
|
59
|
+
const data = fs.readFileSync(filePath, "utf-8");
|
|
60
|
+
return JSON.parse(data);
|
|
91
61
|
}
|
|
92
62
|
}
|
|
93
63
|
catch (e) {
|
|
@@ -97,10 +67,8 @@ class SQLiteStorage {
|
|
|
97
67
|
}
|
|
98
68
|
static save(config) {
|
|
99
69
|
try {
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
INSERT OR REPLACE INTO config (key, value) VALUES ('config', ?)
|
|
103
|
-
`).run(JSON.stringify(config));
|
|
70
|
+
const filePath = getConfigPath();
|
|
71
|
+
fs.writeFileSync(filePath, JSON.stringify(config, null, 2), "utf-8");
|
|
104
72
|
}
|
|
105
73
|
catch (e) {
|
|
106
74
|
console.warn("[MemoryX] Failed to save config:", e);
|
|
@@ -221,7 +189,7 @@ class MemoryXPlugin {
|
|
|
221
189
|
return this.config.apiBaseUrl || DEFAULT_API_BASE;
|
|
222
190
|
}
|
|
223
191
|
loadConfig() {
|
|
224
|
-
const stored =
|
|
192
|
+
const stored = JsonStorage.load();
|
|
225
193
|
if (stored) {
|
|
226
194
|
this.config = {
|
|
227
195
|
...this.config,
|
|
@@ -231,7 +199,7 @@ class MemoryXPlugin {
|
|
|
231
199
|
}
|
|
232
200
|
}
|
|
233
201
|
saveConfig() {
|
|
234
|
-
|
|
202
|
+
JsonStorage.save(this.config);
|
|
235
203
|
}
|
|
236
204
|
async autoRegister() {
|
|
237
205
|
try {
|
|
@@ -403,8 +371,8 @@ export default {
|
|
|
403
371
|
if (pluginConfig?.apiBaseUrl) {
|
|
404
372
|
api.logger.info(`[MemoryX] API Base: \`${pluginConfig.apiBaseUrl}\``);
|
|
405
373
|
}
|
|
406
|
-
api.logger.info(`[MemoryX]
|
|
407
|
-
log(`
|
|
374
|
+
api.logger.info(`[MemoryX] Config: ${getConfigPath()}`);
|
|
375
|
+
log(`Config path: ${getConfigPath()}`);
|
|
408
376
|
log(`Log file: ${getLogPath()}`);
|
|
409
377
|
log("Creating plugin instance");
|
|
410
378
|
plugin = new MemoryXPlugin(pluginConfig);
|
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.9",
|
|
4
4
|
"description": "MemoryX real-time memory capture and recall plugin for OpenClaw",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "MemoryX Team",
|
|
@@ -31,11 +31,8 @@
|
|
|
31
31
|
]
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@types/better-sqlite3": "^7.6.0",
|
|
35
34
|
"@types/node": "^20.0.0",
|
|
36
35
|
"typescript": "^5.0.0"
|
|
37
36
|
},
|
|
38
|
-
"dependencies": {
|
|
39
|
-
"better-sqlite3": "^11.0.0"
|
|
40
|
-
}
|
|
37
|
+
"dependencies": {}
|
|
41
38
|
}
|