@t0ken.ai/memoryx-openclaw-plugin 2.2.10 → 2.2.12
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 +15 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +79 -7
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -63,6 +63,21 @@ declare class MemoryXPlugin {
|
|
|
63
63
|
initialized: boolean;
|
|
64
64
|
quota?: any;
|
|
65
65
|
}>;
|
|
66
|
+
getQueueStatus(): Promise<{
|
|
67
|
+
success: boolean;
|
|
68
|
+
data?: {
|
|
69
|
+
agent_id: string;
|
|
70
|
+
tier: string;
|
|
71
|
+
queue_name: string;
|
|
72
|
+
queue_length: number;
|
|
73
|
+
memory_free_queue: number;
|
|
74
|
+
memory_pro_queue: number;
|
|
75
|
+
estimated_wait_time: string;
|
|
76
|
+
status: string;
|
|
77
|
+
message: string;
|
|
78
|
+
};
|
|
79
|
+
error?: string;
|
|
80
|
+
}>;
|
|
66
81
|
}
|
|
67
82
|
declare const _default: {
|
|
68
83
|
id: string;
|
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,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,K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M,GAAG,IAAI,CAAC;QACzB,WAAW,EAAE,OAAO,CAAC;QACrB,KAAK,CAAC,EAAE,GAAG,CAAC;KACf,CAAC;IAwBW,cAAc,IAAI,OAAO,CAAC;QACnC,OAAO,EAAE,OAAO,CAAC;QACjB,IAAI,CAAC,EAAE;YACH,QAAQ,EAAE,MAAM,CAAC;YACjB,IAAI,EAAE,MAAM,CAAC;YACb,UAAU,EAAE,MAAM,CAAC;YACnB,YAAY,EAAE,MAAM,CAAC;YACrB,iBAAiB,EAAE,MAAM,CAAC;YAC1B,gBAAgB,EAAE,MAAM,CAAC;YACzB,mBAAmB,EAAE,MAAM,CAAC;YAC5B,MAAM,EAAE,MAAM,CAAC;YACf,OAAO,EAAE,MAAM,CAAC;SACnB,CAAC;QACF,KAAK,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CAcL;;;;;;kBAUiB,GAAG,iBAAiB,YAAY,GAAG,IAAI;;AANzD,wBAqdE;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -242,6 +242,20 @@ class MemoryXPlugin {
|
|
|
242
242
|
};
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
|
+
async getQueueStatus() {
|
|
246
|
+
await this.init();
|
|
247
|
+
try {
|
|
248
|
+
const sdk = await getSDK(this.pluginConfig);
|
|
249
|
+
return await sdk.getQueueStatus();
|
|
250
|
+
}
|
|
251
|
+
catch (e) {
|
|
252
|
+
log(`GetQueueStatus failed: ${e}`);
|
|
253
|
+
return {
|
|
254
|
+
success: false,
|
|
255
|
+
error: String(e)
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
}
|
|
245
259
|
}
|
|
246
260
|
let plugin;
|
|
247
261
|
export default {
|
|
@@ -532,6 +546,63 @@ export default {
|
|
|
532
546
|
}
|
|
533
547
|
}
|
|
534
548
|
}, { name: "memoryx_account_info" });
|
|
549
|
+
api.registerTool({
|
|
550
|
+
name: "memoryx_queue_status",
|
|
551
|
+
label: "MemoryX Queue Status",
|
|
552
|
+
description: "获取 Celery 队列状态,显示当前积压任务数量和预计等待时间。用于诊断记忆处理延迟问题。当用户问为什么记忆还没处理、记忆处理状态、队列状态时使用。",
|
|
553
|
+
parameters: {
|
|
554
|
+
type: "object",
|
|
555
|
+
properties: {}
|
|
556
|
+
},
|
|
557
|
+
async execute(_toolCallId, params) {
|
|
558
|
+
if (!plugin) {
|
|
559
|
+
return {
|
|
560
|
+
content: [{ type: "text", text: "MemoryX plugin not initialized." }],
|
|
561
|
+
details: { error: "not_initialized" }
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
try {
|
|
565
|
+
const result = await plugin.getQueueStatus();
|
|
566
|
+
if (!result.success) {
|
|
567
|
+
return {
|
|
568
|
+
content: [{ type: "text", text: `获取队列状态失败: ${result.error || '未知错误'}` }],
|
|
569
|
+
details: { error: result.error }
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
const data = result.data;
|
|
573
|
+
const statusEmoji = {
|
|
574
|
+
"normal": "✅",
|
|
575
|
+
"backlogged": "⚠️",
|
|
576
|
+
"severely_backlogged": "🔴"
|
|
577
|
+
}[data.status] || "❓";
|
|
578
|
+
const lines = [
|
|
579
|
+
`${statusEmoji} MemoryX 队列状态:`,
|
|
580
|
+
`队列名称: ${data.queue_name}`,
|
|
581
|
+
`当前层级: ${data.tier}`,
|
|
582
|
+
`积压任务: ${data.queue_length} 个`,
|
|
583
|
+
`Free 队列: ${data.memory_free_queue} 个`,
|
|
584
|
+
`Pro 队列: ${data.memory_pro_queue} 个`,
|
|
585
|
+
`预计等待: ${data.estimated_wait_time}`,
|
|
586
|
+
`状态: ${data.message}`
|
|
587
|
+
];
|
|
588
|
+
return {
|
|
589
|
+
content: [{ type: "text", text: lines.join("\n") }],
|
|
590
|
+
details: {
|
|
591
|
+
queue_name: data.queue_name,
|
|
592
|
+
queue_length: data.queue_length,
|
|
593
|
+
status: data.status,
|
|
594
|
+
estimated_wait_time: data.estimated_wait_time
|
|
595
|
+
}
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
catch (error) {
|
|
599
|
+
return {
|
|
600
|
+
content: [{ type: "text", text: `获取队列状态失败: ${error.message}` }],
|
|
601
|
+
details: { error: error.message }
|
|
602
|
+
};
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
}, { name: "memoryx_queue_status" });
|
|
535
606
|
api.on("message_received", async (event, ctx) => {
|
|
536
607
|
const { content } = event;
|
|
537
608
|
if (content && plugin) {
|
|
@@ -553,24 +624,25 @@ export default {
|
|
|
553
624
|
if (result.isLimited) {
|
|
554
625
|
api.logger.warn(`[MemoryX] ${result.upgradeHint}`);
|
|
555
626
|
return {
|
|
556
|
-
|
|
627
|
+
systemPrompt: `[MemoryX] ${result.upgradeHint}`
|
|
557
628
|
};
|
|
558
629
|
}
|
|
559
630
|
if (result.memories.length === 0 && result.relatedMemories.length === 0)
|
|
560
631
|
return;
|
|
561
|
-
|
|
632
|
+
// 使用 systemPrompt 而不是 prependContext
|
|
633
|
+
// systemPrompt 不会显示在用户聊天内容中
|
|
634
|
+
let context = "[MemoryX] Relevant memories from past conversations:\n";
|
|
562
635
|
if (result.memories.length > 0) {
|
|
563
|
-
context += "\n[Direct Memories]\n";
|
|
564
636
|
context += result.memories.map(m => `- ${m.content}`).join("\n");
|
|
565
637
|
}
|
|
566
638
|
if (result.relatedMemories.length > 0) {
|
|
567
|
-
|
|
639
|
+
if (result.memories.length > 0)
|
|
640
|
+
context += "\n";
|
|
568
641
|
context += result.relatedMemories.map(m => `- ${m.content}`).join("\n");
|
|
569
642
|
}
|
|
570
|
-
|
|
571
|
-
api.logger.info(`[MemoryX] Recalled ${result.memories.length} direct + ${result.relatedMemories.length} related memories`);
|
|
643
|
+
api.logger.info(`[MemoryX] Injected ${result.memories.length} direct + ${result.relatedMemories.length} related memories into system prompt`);
|
|
572
644
|
return {
|
|
573
|
-
|
|
645
|
+
systemPrompt: context
|
|
574
646
|
};
|
|
575
647
|
}
|
|
576
648
|
catch (error) {
|
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.12",
|
|
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.4.
|
|
38
|
+
"@t0ken.ai/memoryx-sdk": "^1.4.2"
|
|
39
39
|
}
|
|
40
40
|
}
|