@efengx/openclaw-channel-dragon 0.5.43 → 0.5.45

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.
@@ -26,6 +26,7 @@ export declare class ChannelComponent implements IComponent {
26
26
  private buildOpenClawSessionKey;
27
27
  private resolveWorkbenchSessionIdFromOpenClawSessionKey;
28
28
  private stringifyProgressDetail;
29
+ private extractToolCallId;
29
30
  private summarizeOutboundContext;
30
31
  private findTaskCompletionEvent;
31
32
  private formatTaskCompletionReply;
@@ -115,6 +115,14 @@ export class ChannelComponent {
115
115
  return String(value).slice(0, maxLength);
116
116
  }
117
117
  }
118
+ extractToolCallId(payload) {
119
+ let toolCallId = payload?.toolCallId || payload?.tool_call_id || payload?.tool;
120
+ const itemId = payload?.itemId || payload?.data?.itemId;
121
+ if (!toolCallId && typeof itemId === 'string' && itemId.startsWith('tool:')) {
122
+ toolCallId = itemId.slice(5);
123
+ }
124
+ return toolCallId;
125
+ }
118
126
  summarizeOutboundContext(ctx) {
119
127
  const summarizeValue = (value) => {
120
128
  if (Array.isArray(value))
@@ -275,40 +283,46 @@ export class ChannelComponent {
275
283
  await progress({ kind: 'reasoning', phase: 'end', status: 'completed', title: '推理完成' });
276
284
  },
277
285
  onToolStart: async (payload) => {
286
+ const toolCallId = this.extractToolCallId(payload);
278
287
  await progress({
279
288
  kind: 'tool',
280
289
  phase: payload?.phase || 'start',
281
290
  status: 'running',
282
291
  title: payload?.name ? `调用工具:${payload.name}` : '调用工具',
283
292
  detail: this.stringifyProgressDetail(payload?.args),
293
+ toolCallId,
284
294
  data: payload,
285
295
  });
286
296
  },
287
297
  onToolResult: async (payload) => {
288
298
  const isFailed = payload?.status === 'failed' || payload?.status === 'error' || !!payload?.error;
289
299
  const archivedAttachments = await this.mediaRegistry.archiveStructuredMedia(payload);
300
+ const toolCallId = this.extractToolCallId(payload);
290
301
  await progress({
291
302
  kind: archivedAttachments.length > 0 ? 'media' : 'tool',
292
303
  phase: 'end',
293
304
  status: isFailed ? 'failed' : 'completed',
294
305
  title: isFailed
295
306
  ? `工具执行失败:${payload?.tool || payload?.name || payload?.toolName || ''}`
296
- : (archivedAttachments.length > 0 ? '媒体文件已生成' : '工具执行完成'),
307
+ : (archivedAttachments.length > 0 ? '媒体文件已生成' : `工具执行完成:${payload?.tool || payload?.name || payload?.toolName || ''}`),
297
308
  detail: isFailed
298
309
  ? (payload?.error || payload?.message || this.stringifyProgressDetail(payload?.text || payload))
299
310
  : (archivedAttachments.length > 0
300
311
  ? archivedAttachments.map((item) => item.name).join(', ')
301
312
  : this.stringifyProgressDetail(payload?.text || payload)),
313
+ toolCallId,
302
314
  data: archivedAttachments.length > 0 ? { ...payload, attachments: archivedAttachments } : payload,
303
315
  });
304
316
  },
305
317
  onItemEvent: async (payload) => {
318
+ const toolCallId = this.extractToolCallId(payload);
306
319
  await progress({
307
320
  kind: payload?.kind || 'item',
308
321
  phase: payload?.phase,
309
322
  status: payload?.status,
310
323
  title: payload?.title || payload?.name || '任务步骤更新',
311
324
  detail: this.stringifyProgressDetail(payload?.progressText || payload?.summary || payload?.meta),
325
+ toolCallId,
312
326
  data: payload,
313
327
  });
314
328
  },
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const dragonChannelPluginVersion = "0.5.43";
1
+ export declare const dragonChannelPluginVersion = "0.5.45";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const dragonChannelPluginVersion = "0.5.43";
1
+ export const dragonChannelPluginVersion = "0.5.45";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@efengx/openclaw-channel-dragon",
3
- "version": "0.5.43",
3
+ "version": "0.5.45",
4
4
  "description": "Dragon workbench channel for OpenClaw",
5
5
  "author": "feng xiang <ofengx@gmail.com>",
6
6
  "type": "module",