@efengx/openclaw-channel-dragon 0.5.8 → 0.5.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.
|
@@ -51,6 +51,7 @@ export class ChannelComponent {
|
|
|
51
51
|
sessionId,
|
|
52
52
|
tool_calls: payload?.tool_calls,
|
|
53
53
|
reasoning_content: payload?.reasoning_content,
|
|
54
|
+
source: "telemetry_deliver",
|
|
54
55
|
});
|
|
55
56
|
}
|
|
56
57
|
}
|
|
@@ -60,7 +61,7 @@ export class ChannelComponent {
|
|
|
60
61
|
const text = ctx?.text || "";
|
|
61
62
|
const { logger } = this.options;
|
|
62
63
|
logger?.info?.(`[Dragon Plugin] Outbound Text (Action): "${text.substring(0, 50)}${text.length > 50 ? '...' : ''}"`);
|
|
63
|
-
await this.telemetry.reportReply({ content: text, sessionId: ctx?.peer?.id ||
|
|
64
|
+
await this.telemetry.reportReply({ content: text, sessionId: ctx?.peer?.id || "default", source: "channel_outbound" });
|
|
64
65
|
return { ok: true, messageId: Date.now().toString() };
|
|
65
66
|
};
|
|
66
67
|
handleAgentEvent = async (evt) => {
|
|
@@ -4,6 +4,8 @@ export declare class TelemetryComponent implements IComponent {
|
|
|
4
4
|
private http;
|
|
5
5
|
private agentId;
|
|
6
6
|
constructor(http: HttpComponent, agentId: string);
|
|
7
|
+
private lastReportedContent;
|
|
8
|
+
private lastReportedTime;
|
|
7
9
|
start(): Promise<void>;
|
|
8
10
|
stop(): Promise<void>;
|
|
9
11
|
reportReply(payload: {
|
|
@@ -11,6 +13,7 @@ export declare class TelemetryComponent implements IComponent {
|
|
|
11
13
|
sessionId: string;
|
|
12
14
|
tool_calls?: any[];
|
|
13
15
|
reasoning_content?: string;
|
|
16
|
+
source?: string;
|
|
14
17
|
}): Promise<void>;
|
|
15
18
|
reportEvent(stream: string, data: any, ts: number): Promise<void>;
|
|
16
19
|
}
|
|
@@ -5,10 +5,20 @@ export class TelemetryComponent {
|
|
|
5
5
|
this.http = http;
|
|
6
6
|
this.agentId = agentId;
|
|
7
7
|
}
|
|
8
|
+
lastReportedContent = "";
|
|
9
|
+
lastReportedTime = 0;
|
|
8
10
|
async start() { }
|
|
9
11
|
async stop() { }
|
|
10
12
|
async reportReply(payload) {
|
|
11
13
|
try {
|
|
14
|
+
const now = Date.now();
|
|
15
|
+
const content = payload.content || "";
|
|
16
|
+
// Deduplicate identical replies sent within 3 seconds
|
|
17
|
+
if (content && content === this.lastReportedContent && now - this.lastReportedTime < 3000) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
this.lastReportedContent = content;
|
|
21
|
+
this.lastReportedTime = now;
|
|
12
22
|
const msgId = crypto.randomUUID();
|
|
13
23
|
await this.http.fetch(`/api/agents/${this.agentId}/messages/reply`, {
|
|
14
24
|
method: "POST",
|
|
@@ -24,13 +34,14 @@ export class TelemetryComponent {
|
|
|
24
34
|
try {
|
|
25
35
|
let telemetryPayload = null;
|
|
26
36
|
if (stream === "thinking") {
|
|
27
|
-
telemetryPayload = { content: "", ts, metadata: { isTelemetry: true, reasoning_content: data, stream: "thinking" } };
|
|
37
|
+
telemetryPayload = { content: "", ts, source: "telemetry_stream", metadata: { isTelemetry: true, reasoning_content: data, stream: "thinking" } };
|
|
28
38
|
}
|
|
29
39
|
else if (stream === "tool" || stream === "item") {
|
|
30
40
|
const toolName = data?.name || data?.title || "unknown tool";
|
|
31
41
|
telemetryPayload = {
|
|
32
42
|
content: data?.output ? `[Tool Result] ${toolName}` : `[Tool Call] ${toolName}...`,
|
|
33
43
|
ts,
|
|
44
|
+
source: "telemetry_stream",
|
|
34
45
|
metadata: {
|
|
35
46
|
isTelemetry: true,
|
|
36
47
|
toolName,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@efengx/openclaw-channel-dragon",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.9",
|
|
4
4
|
"description": "Dragon workbench channel for OpenClaw",
|
|
5
5
|
"author": "feng xiang <ofengx@gmail.com>",
|
|
6
6
|
"type": "module",
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
"openclaw.plugin.json",
|
|
12
12
|
"README.md"
|
|
13
13
|
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc -p tsconfig.json",
|
|
16
|
+
"lint": "echo \"(skip)\""
|
|
17
|
+
},
|
|
14
18
|
"dependencies": {
|
|
15
19
|
"openclaw": "^2026.4.12"
|
|
16
20
|
},
|
|
@@ -32,9 +36,5 @@
|
|
|
32
36
|
},
|
|
33
37
|
"publishConfig": {
|
|
34
38
|
"access": "public"
|
|
35
|
-
},
|
|
36
|
-
"scripts": {
|
|
37
|
-
"build": "tsc -p tsconfig.json",
|
|
38
|
-
"lint": "echo \"(skip)\""
|
|
39
39
|
}
|
|
40
|
-
}
|
|
40
|
+
}
|