@efengx/openclaw-channel-dragon 0.5.7 → 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 || 'default' });
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/dist/index.js CHANGED
@@ -57,10 +57,10 @@ const base = createChannelPluginBase({
57
57
  },
58
58
  config: {
59
59
  listAccountIds: (cfg) => {
60
- return Object.keys(cfg.channels?.[channelId]?.accounts || { "default": {} });
60
+ return Object.keys(cfg?.channels?.[channelId]?.accounts || { "default": {} });
61
61
  },
62
62
  resolveAccount: (cfg, accountId = "default") => {
63
- const accountConfig = cfg.channels?.[channelId]?.accounts?.[accountId] || {};
63
+ const accountConfig = cfg?.channels?.[channelId]?.accounts?.[accountId] || {};
64
64
  return {
65
65
  accountId,
66
66
  agentId: accountConfig.agentId || accountId,
@@ -113,11 +113,11 @@ const entry = defineChannelPluginEntry({
113
113
  if (!sessionKey || !sessionKey.startsWith(`${channelId}:`))
114
114
  return;
115
115
  const accountId = sessionKey.split(':')[2] || "default";
116
- const account = base.config.resolveAccount(api.runtime.cfg, accountId);
116
+ const account = base.config.resolveAccount(api?.runtime?.cfg, accountId);
117
117
  const container = await getOrCreateContainer(account, {
118
- cfg: api.runtime.cfg,
118
+ cfg: api?.runtime?.cfg,
119
119
  abortSignal: new AbortController().signal,
120
- channelRuntime: api.runtime.channelRuntime // Ensure runtime is passed
120
+ channelRuntime: api?.runtime?.channelRuntime // Ensure runtime is passed
121
121
  });
122
122
  const channel = container.get('channel');
123
123
  await channel.handleAgentEvent(evt);
@@ -2,7 +2,7 @@
2
2
  "id": "dragon",
3
3
  "name": "Dragon Workbench Channel",
4
4
  "description": "Connect OpenClaw to the Dragon agent-client workbench chat.",
5
- "version": "0.5.7",
5
+ "version": "0.5.8",
6
6
  "enabledByDefault": true,
7
7
  "activation": {
8
8
  "onCapabilities": ["hook"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@efengx/openclaw-channel-dragon",
3
- "version": "0.5.7",
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",