@t0ken.ai/memoryx-openclaw-plugin 2.2.5 → 2.2.7
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 +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -5
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
* // async registration is ignored
|
|
10
10
|
* }
|
|
11
11
|
*
|
|
12
|
-
* Any sync I/O (fs.existsSync, fs.mkdirSync, fs.readFileSync,
|
|
12
|
+
* Any sync I/O (fs.existsSync, fs.mkdirSync, fs.readFileSync, etc.)
|
|
13
13
|
* will BLOCK the Node.js event loop and cause gateway restart to hang.
|
|
14
14
|
*
|
|
15
15
|
* SOLUTION:
|
|
16
16
|
* 1. register() must return immediately without any I/O
|
|
17
17
|
* 2. All initialization (DB, config loading, etc.) must be lazy-loaded
|
|
18
|
-
* 3. SDK uses
|
|
18
|
+
* 3. SDK uses sql.js (async) internally - no blocking issues
|
|
19
19
|
* 4. Use setImmediate() for deferred operations
|
|
20
20
|
*
|
|
21
21
|
* This version uses @t0ken.ai/memoryx-sdk with conversation preset:
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AA4CH,UAAU,YAAY;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;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,eAAe,EAAE,KAAK,CAAC;QACnB,EAAE,EAAE,MAAM,CAAC;QACX,OAAO,EAAE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,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAc1C,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAcvE,IAAI,CAAC,KAAK,GAAE,MAAW,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAiBxC,cAAc,IAAI,OAAO,CAAC;QACnC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QACtB,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QACtB,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,OAAO,CAAC;QACrB,KAAK,CAAC,EAAE,GAAG,CAAC;KACf,CAAC;CAwBL;;;;;;kBAUiB,GAAG,iBAAiB,YAAY,GAAG,IAAI;;AANzD,wBA6YE;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
* // async registration is ignored
|
|
10
10
|
* }
|
|
11
11
|
*
|
|
12
|
-
* Any sync I/O (fs.existsSync, fs.mkdirSync, fs.readFileSync,
|
|
12
|
+
* Any sync I/O (fs.existsSync, fs.mkdirSync, fs.readFileSync, etc.)
|
|
13
13
|
* will BLOCK the Node.js event loop and cause gateway restart to hang.
|
|
14
14
|
*
|
|
15
15
|
* SOLUTION:
|
|
16
16
|
* 1. register() must return immediately without any I/O
|
|
17
17
|
* 2. All initialization (DB, config loading, etc.) must be lazy-loaded
|
|
18
|
-
* 3. SDK uses
|
|
18
|
+
* 3. SDK uses sql.js (async) internally - no blocking issues
|
|
19
19
|
* 4. Use setImmediate() for deferred operations
|
|
20
20
|
*
|
|
21
21
|
* This version uses @t0ken.ai/memoryx-sdk with conversation preset:
|
|
@@ -71,12 +71,16 @@ async function getSDK(pluginConfig) {
|
|
|
71
71
|
sdkInitPromise = (async () => {
|
|
72
72
|
// Dynamic import SDK
|
|
73
73
|
const { MemoryXSDK } = await import("@t0ken.ai/memoryx-sdk");
|
|
74
|
+
// Agent name 使用主机名,保证重安装时 agent_id 不变
|
|
75
|
+
// 服务端重安装检测: agent_name + agent_type + machine_fingerprint
|
|
76
|
+
const agentName = os.hostname();
|
|
74
77
|
// Use conversation preset: maxTokens: 30000, intervalMs: 300000 (5 min)
|
|
75
78
|
sdkInstance = new MemoryXSDK({
|
|
76
79
|
preset: 'conversation',
|
|
77
80
|
apiUrl: pluginConfig?.apiBaseUrl || DEFAULT_API_BASE,
|
|
78
81
|
autoRegister: true,
|
|
79
|
-
agentType: 'openclaw'
|
|
82
|
+
agentType: 'openclaw',
|
|
83
|
+
agentName: agentName // 使用主机名作为 agent_name,保证重安装稳定
|
|
80
84
|
// 不设置 storageDir,使用 SDK 默认目录 ~/.memoryx/sdk/
|
|
81
85
|
// 这样可以读取到之前保存的配置
|
|
82
86
|
});
|
|
@@ -490,13 +494,18 @@ export default {
|
|
|
490
494
|
};
|
|
491
495
|
}
|
|
492
496
|
const lines = [
|
|
493
|
-
"MemoryX Account Information:",
|
|
497
|
+
"📊 MemoryX Account Information:",
|
|
494
498
|
`API Key: ${accountInfo.apiKey || 'Not set'}`,
|
|
495
499
|
`Project ID: ${accountInfo.projectId || 'default'}`,
|
|
496
500
|
`User ID: ${accountInfo.userId || 'Not set'}`,
|
|
497
501
|
`API Base URL: ${accountInfo.apiBaseUrl || DEFAULT_API_BASE}`,
|
|
498
502
|
`Initialized: ${accountInfo.initialized ? 'Yes' : 'No'}`
|
|
499
503
|
];
|
|
504
|
+
if (accountInfo.apiKey) {
|
|
505
|
+
lines.push("");
|
|
506
|
+
lines.push("💡 Visit the portal to claim your agent and manage memories:");
|
|
507
|
+
lines.push(` https://t0ken.ai/portal?api_key=${accountInfo.apiKey}`);
|
|
508
|
+
}
|
|
500
509
|
return {
|
|
501
510
|
content: [{ type: "text", text: lines.join("\n") }],
|
|
502
511
|
details: {
|
|
@@ -565,7 +574,20 @@ export default {
|
|
|
565
574
|
await plugin.endConversation();
|
|
566
575
|
}
|
|
567
576
|
});
|
|
568
|
-
api.logger.info(`[MemoryX] Plugin
|
|
577
|
+
api.logger.info(`[MemoryX] ✅ Plugin v${VERSION} ready! Your conversations will be remembered automatically.`);
|
|
578
|
+
// Async check and show portal link after SDK initializes
|
|
579
|
+
setImmediate(async () => {
|
|
580
|
+
try {
|
|
581
|
+
await plugin.init();
|
|
582
|
+
const info = await plugin.getAccountInfo();
|
|
583
|
+
if (info.apiKey) {
|
|
584
|
+
api.logger.info(`[MemoryX] 💡 Manage your memories: https://t0ken.ai/portal?api_key=${info.apiKey}`);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
catch (e) {
|
|
588
|
+
// ignore
|
|
589
|
+
}
|
|
590
|
+
});
|
|
569
591
|
}
|
|
570
592
|
};
|
|
571
593
|
export { MemoryXPlugin };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t0ken.ai/memoryx-openclaw-plugin",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.7",
|
|
4
4
|
"description": "MemoryX real-time memory capture and recall plugin for OpenClaw (powered by @t0ken.ai/memoryx-sdk)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "MemoryX Team",
|
|
@@ -35,6 +35,6 @@
|
|
|
35
35
|
"typescript": "^5.0.0"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@t0ken.ai/memoryx-sdk": "^1.
|
|
38
|
+
"@t0ken.ai/memoryx-sdk": "^1.3.1"
|
|
39
39
|
}
|
|
40
40
|
}
|