@efengx/openclaw-channel-dragon 0.5.42 → 0.5.43
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.
|
@@ -163,8 +163,10 @@ export class ChannelComponent {
|
|
|
163
163
|
return typeof event?.result === 'string' ? event.result.trim() : '';
|
|
164
164
|
}
|
|
165
165
|
deliverToOpenClaw = async (content, sessionId = 'default', modelId, attachments, messageId) => {
|
|
166
|
-
const replyMsgId = messageId
|
|
167
|
-
|
|
166
|
+
const replyMsgId = messageId
|
|
167
|
+
? (String(messageId).startsWith('dragon_msg_') ? String(messageId) : `dragon_msg_${messageId}`)
|
|
168
|
+
: `dragon_msg_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
|
|
169
|
+
const isNewCmd = content?.trim() === '/new';
|
|
168
170
|
if (!isNewCmd && messageId && this.processedMessageIds.has(messageId))
|
|
169
171
|
return;
|
|
170
172
|
if (!isNewCmd && messageId) {
|
|
@@ -215,6 +217,15 @@ export class ChannelComponent {
|
|
|
215
217
|
const archivedAttachments = await this.mediaRegistry.archiveStructuredMedia(payload);
|
|
216
218
|
if (!text && !payload?.tool_calls?.length && archivedAttachments.length === 0)
|
|
217
219
|
return;
|
|
220
|
+
const stream = payload?.stream || payload?.kind || payload?.type;
|
|
221
|
+
const isToolTelemetry = stream === 'tool' ||
|
|
222
|
+
stream === 'tool_result' ||
|
|
223
|
+
stream === 'tool_call' ||
|
|
224
|
+
payload?.isTool === true ||
|
|
225
|
+
payload?.tool === true ||
|
|
226
|
+
payload?.toolName ||
|
|
227
|
+
payload?.name && (payload?.input || payload?.output || payload?.args) ||
|
|
228
|
+
payload?.tool_calls?.length;
|
|
218
229
|
await this.telemetry.reportReply({
|
|
219
230
|
content: text,
|
|
220
231
|
sessionId,
|
|
@@ -223,6 +234,14 @@ export class ChannelComponent {
|
|
|
223
234
|
attachments: archivedAttachments.length > 0 ? archivedAttachments : payload?.attachments,
|
|
224
235
|
source: "telemetry_deliver",
|
|
225
236
|
msgId: replyMsgId,
|
|
237
|
+
metadata: isToolTelemetry ? {
|
|
238
|
+
isTelemetry: true,
|
|
239
|
+
stream: 'tool',
|
|
240
|
+
toolName: payload?.toolName || payload?.name || payload?.title,
|
|
241
|
+
toolInput: payload?.input || payload?.args,
|
|
242
|
+
toolOutput: payload?.output || payload?.text || payload?.summary,
|
|
243
|
+
status: 'completed',
|
|
244
|
+
} : undefined,
|
|
226
245
|
});
|
|
227
246
|
}
|
|
228
247
|
},
|
|
@@ -266,15 +285,20 @@ export class ChannelComponent {
|
|
|
266
285
|
});
|
|
267
286
|
},
|
|
268
287
|
onToolResult: async (payload) => {
|
|
288
|
+
const isFailed = payload?.status === 'failed' || payload?.status === 'error' || !!payload?.error;
|
|
269
289
|
const archivedAttachments = await this.mediaRegistry.archiveStructuredMedia(payload);
|
|
270
290
|
await progress({
|
|
271
291
|
kind: archivedAttachments.length > 0 ? 'media' : 'tool',
|
|
272
292
|
phase: 'end',
|
|
273
|
-
status: 'completed',
|
|
274
|
-
title:
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
293
|
+
status: isFailed ? 'failed' : 'completed',
|
|
294
|
+
title: isFailed
|
|
295
|
+
? `工具执行失败:${payload?.tool || payload?.name || payload?.toolName || ''}`
|
|
296
|
+
: (archivedAttachments.length > 0 ? '媒体文件已生成' : '工具执行完成'),
|
|
297
|
+
detail: isFailed
|
|
298
|
+
? (payload?.error || payload?.message || this.stringifyProgressDetail(payload?.text || payload))
|
|
299
|
+
: (archivedAttachments.length > 0
|
|
300
|
+
? archivedAttachments.map((item) => item.name).join(', ')
|
|
301
|
+
: this.stringifyProgressDetail(payload?.text || payload)),
|
|
278
302
|
data: archivedAttachments.length > 0 ? { ...payload, attachments: archivedAttachments } : payload,
|
|
279
303
|
});
|
|
280
304
|
},
|
|
@@ -465,8 +489,9 @@ export class ChannelComponent {
|
|
|
465
489
|
});
|
|
466
490
|
};
|
|
467
491
|
handleAgentEvent = async (evt) => {
|
|
468
|
-
const sessionId = evt?.
|
|
469
|
-
|
|
492
|
+
const sessionId = this.resolveWorkbenchSessionIdFromOpenClawSessionKey(evt?.sessionKey) ||
|
|
493
|
+
evt?.sessionId ||
|
|
494
|
+
'default';
|
|
470
495
|
await this.telemetry.reportEvent(evt.stream, evt.data, evt.ts, sessionId);
|
|
471
496
|
const taskCompletion = this.findTaskCompletionEvent(evt?.data);
|
|
472
497
|
if (!taskCompletion)
|
|
@@ -16,6 +16,7 @@ export declare class TelemetryComponent implements IComponent {
|
|
|
16
16
|
attachments?: any[];
|
|
17
17
|
source?: string;
|
|
18
18
|
msgId?: string;
|
|
19
|
+
metadata?: any;
|
|
19
20
|
}): Promise<void>;
|
|
20
21
|
reportEvent(stream: string, data: any, ts: number, sessionId?: string): Promise<void>;
|
|
21
22
|
reportProgress(payload: {
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const dragonChannelPluginVersion = "0.5.
|
|
1
|
+
export declare const dragonChannelPluginVersion = "0.5.43";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const dragonChannelPluginVersion = "0.5.
|
|
1
|
+
export const dragonChannelPluginVersion = "0.5.43";
|