@efengx/openclaw-channel-dragon 0.5.11 → 0.5.13

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.
@@ -10,6 +10,7 @@ export class ChannelComponent {
10
10
  async start() { }
11
11
  async stop() { }
12
12
  deliverToOpenClaw = async (content, sessionId = 'default', modelId, attachments, messageId) => {
13
+ const replyMsgId = messageId ? `dragon_msg_${messageId}` : `dragon_msg_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
13
14
  if (messageId && this.processedMessageIds.has(messageId))
14
15
  return;
15
16
  if (messageId) {
@@ -52,6 +53,7 @@ export class ChannelComponent {
52
53
  tool_calls: payload?.tool_calls,
53
54
  reasoning_content: payload?.reasoning_content,
54
55
  source: "telemetry_deliver",
56
+ msgId: replyMsgId,
55
57
  });
56
58
  }
57
59
  }
@@ -6,12 +6,14 @@ export declare class TelemetryComponent implements IComponent {
6
6
  constructor(http: HttpComponent, agentId: string);
7
7
  start(): Promise<void>;
8
8
  stop(): Promise<void>;
9
+ private lastReplies;
9
10
  reportReply(payload: {
10
11
  content: string;
11
12
  sessionId: string;
12
13
  tool_calls?: any[];
13
14
  reasoning_content?: string;
14
15
  source?: string;
16
+ msgId?: string;
15
17
  }): Promise<void>;
16
18
  reportEvent(stream: string, data: any, ts: number): Promise<void>;
17
19
  }
@@ -7,9 +7,24 @@ export class TelemetryComponent {
7
7
  }
8
8
  async start() { }
9
9
  async stop() { }
10
+ lastReplies = new Map();
10
11
  async reportReply(payload) {
11
12
  try {
12
- const msgId = crypto.randomUUID();
13
+ const source = payload.source || "unknown";
14
+ const sessionId = payload.sessionId || "default";
15
+ const content = payload.content || "";
16
+ const normalized = content.replace(/\s+/g, "");
17
+ if (normalized) {
18
+ const key = `${source}_${sessionId}`;
19
+ const last = this.lastReplies.get(key);
20
+ const now = Date.now();
21
+ if (last && last.normalized === normalized && now - last.timestamp < 5000) {
22
+ // Skip identical duplicate reply from the same source in the same session within 5 seconds
23
+ return;
24
+ }
25
+ this.lastReplies.set(key, { normalized, timestamp: now });
26
+ }
27
+ const msgId = payload.msgId || crypto.randomUUID();
13
28
  await this.http.fetch(`/api/agents/${this.agentId}/messages/reply`, {
14
29
  method: "POST",
15
30
  headers: { "Content-Type": "application/json" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@efengx/openclaw-channel-dragon",
3
- "version": "0.5.11",
3
+ "version": "0.5.13",
4
4
  "description": "Dragon workbench channel for OpenClaw",
5
5
  "author": "feng xiang <ofengx@gmail.com>",
6
6
  "type": "module",