@t0ken.ai/memoryx-openclaw-plugin 2.2.19 → 2.2.21
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 +23 -5
- package/package.json +1 -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;;;;;;;;;;;;;;;;;;;;;;;GAuBG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAkDH,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,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;AAqDD,cAAM,aAAa;IACf,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,WAAW,CAAkB;IACrC,OAAO,CAAC,aAAa,CAAkB;gBAE3B,YAAY,CAAC,EAAE,YAAY;IAIjC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAad,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAUpC,SAAS,CAAC,IAAI,EAAE,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AC"}
|
package/dist/index.js
CHANGED
|
@@ -26,7 +26,7 @@ import * as fs from "fs";
|
|
|
26
26
|
import * as path from "path";
|
|
27
27
|
import * as os from "os";
|
|
28
28
|
// 插件版本号 - 由 prebuild 脚本自动从 package.json 同步
|
|
29
|
-
const PLUGIN_VERSION = "2.2.
|
|
29
|
+
const PLUGIN_VERSION = "2.2.21";
|
|
30
30
|
const DEFAULT_API_BASE = "https://t0ken.ai/api";
|
|
31
31
|
const PLUGIN_DIR = path.join(os.homedir(), ".openclaw", "extensions", "memoryx-openclaw-plugin");
|
|
32
32
|
let logStream = null;
|
|
@@ -36,8 +36,19 @@ function ensureDir() {
|
|
|
36
36
|
fs.mkdirSync(PLUGIN_DIR, { recursive: true });
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
/**
|
|
40
|
+
* 分层日志系统
|
|
41
|
+
* - 所有日志都写入文件
|
|
42
|
+
* - console=true 时同时写入控制台(用于重要/引导性信息)
|
|
43
|
+
* - console=false 时只写文件(用于调试信息)
|
|
44
|
+
*/
|
|
45
|
+
function log(message, options = {}) {
|
|
46
|
+
const { console: toConsole = false } = options;
|
|
47
|
+
// 写入控制台(如果需要)
|
|
48
|
+
if (toConsole) {
|
|
49
|
+
console.log(`[MemoryX] ${message}`);
|
|
50
|
+
}
|
|
51
|
+
// 所有日志都写入文件
|
|
41
52
|
setImmediate(() => {
|
|
42
53
|
try {
|
|
43
54
|
if (!logStreamReady) {
|
|
@@ -55,6 +66,8 @@ function log(message) {
|
|
|
55
66
|
// Lazy-loaded SDK instance
|
|
56
67
|
let sdkInstance = null;
|
|
57
68
|
let sdkInitPromise = null;
|
|
69
|
+
// SDK 版本号(延迟加载)
|
|
70
|
+
let sdkVersion = null;
|
|
58
71
|
async function getSDK(pluginConfig) {
|
|
59
72
|
if (sdkInstance)
|
|
60
73
|
return sdkInstance;
|
|
@@ -62,7 +75,8 @@ async function getSDK(pluginConfig) {
|
|
|
62
75
|
return sdkInitPromise;
|
|
63
76
|
sdkInitPromise = (async () => {
|
|
64
77
|
// Dynamic import SDK
|
|
65
|
-
const { MemoryXSDK } = await import("@t0ken.ai/memoryx-sdk");
|
|
78
|
+
const { MemoryXSDK, VERSION } = await import("@t0ken.ai/memoryx-sdk");
|
|
79
|
+
sdkVersion = VERSION;
|
|
66
80
|
// Agent name 使用主机名,保证重安装时 agent_id 不变
|
|
67
81
|
// 服务端重安装检测: agent_name + agent_type + machine_fingerprint
|
|
68
82
|
const agentName = os.hostname();
|
|
@@ -85,7 +99,7 @@ async function getSDK(pluginConfig) {
|
|
|
85
99
|
setDebug(true);
|
|
86
100
|
// 注意:不在这里启动定时器!
|
|
87
101
|
// 定时器在 onMessage 第一次收到消息时启动,避免阻塞 openclaw status 命令
|
|
88
|
-
log(
|
|
102
|
+
log(`SDK v${sdkVersion} initialized with conversation preset (30k tokens / 5min idle)`, { console: true });
|
|
89
103
|
return sdkInstance;
|
|
90
104
|
})();
|
|
91
105
|
return sdkInitPromise;
|
|
@@ -632,11 +646,15 @@ export default {
|
|
|
632
646
|
// But they do NOT trigger memory search - only user messages do that
|
|
633
647
|
api.on("llm_output", async (event, ctx) => {
|
|
634
648
|
const { assistantTexts } = event;
|
|
649
|
+
log(`llm_output event received`, { console: true });
|
|
650
|
+
log(`assistantTexts: ${JSON.stringify(assistantTexts)}`);
|
|
635
651
|
if (assistantTexts && Array.isArray(assistantTexts) && plugin) {
|
|
636
652
|
// Join all assistant text segments
|
|
637
653
|
const fullContent = assistantTexts.join("\n");
|
|
654
|
+
log(`Full assistant content length: ${fullContent.length}`);
|
|
638
655
|
if (fullContent && fullContent.length >= 2) {
|
|
639
656
|
await plugin.onMessage("assistant", fullContent);
|
|
657
|
+
log(`Assistant message saved`, { console: true });
|
|
640
658
|
}
|
|
641
659
|
}
|
|
642
660
|
});
|
package/package.json
CHANGED