@ynhcj/xiaoyi-channel 0.0.91-next → 0.0.92-next

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.
package/dist/src/bot.js CHANGED
@@ -90,6 +90,7 @@ export async function handleXYMessage(params) {
90
90
  text: pushDataItem.dataDetail,
91
91
  append: false,
92
92
  final: true,
93
+ runtime,
93
94
  });
94
95
  log(`[BOT] ✅ Trigger response sent successfully, exiting early`);
95
96
  return; // 提前返回,不继续处理
@@ -17,6 +17,7 @@ export interface SendA2AResponseParams {
17
17
  }>;
18
18
  errorCode?: number | string;
19
19
  errorMessage?: string;
20
+ runtime?: any;
20
21
  }
21
22
  /**
22
23
  * Send an A2A artifact update response.
@@ -6,7 +6,8 @@ import { logger } from "./utils/logger.js";
6
6
  * Send an A2A artifact update response.
7
7
  */
8
8
  export async function sendA2AResponse(params) {
9
- const { config, sessionId, taskId, messageId, text, append, final, files, errorCode, errorMessage } = params;
9
+ const { config, sessionId, taskId, messageId, text, append, final, files, errorCode, errorMessage, runtime } = params;
10
+ const log = runtime?.log ?? console.log;
10
11
  // Build artifact update event
11
12
  const artifact = {
12
13
  taskId,
@@ -45,7 +46,7 @@ export async function sendA2AResponse(params) {
45
46
  code: errorCode,
46
47
  message: errorMessage ?? "任务执行异常,请重试",
47
48
  };
48
- logger.log(`[A2A_RESPONSE] ⚠️ Including error code: ${errorCode}`);
49
+ log(`[A2A_RESPONSE] ⚠️ Including error code: ${errorCode}`);
49
50
  }
50
51
  // Send via WebSocket
51
52
  const wsManager = getXYWebSocketManager(config);
@@ -57,13 +58,13 @@ export async function sendA2AResponse(params) {
57
58
  msgDetail: JSON.stringify(jsonRpcResponse),
58
59
  };
59
60
  // 📋 Log complete response body
60
- logger.log(`[A2A_RESPONSE] 📤 Sending A2A artifact-update response: taskId: ${taskId}`);
61
- logger.log(`[A2A_RESPONSE] - append: ${append}`);
62
- logger.log(`[A2A_RESPONSE] - final: ${final}`);
63
- logger.log(`[A2A_RESPONSE] - text: ${text.length <= 10 ? text : text.slice(0, 5) + '***' + text.slice(-5)}`);
64
- logger.log(`[A2A_RESPONSE] - files count: ${files?.length ?? 0}`);
61
+ log(`[A2A_RESPONSE] 📤 Sending A2A artifact-update response: taskId: ${taskId}`);
62
+ log(`[A2A_RESPONSE] - append: ${append}`);
63
+ log(`[A2A_RESPONSE] - final: ${final}`);
64
+ log(`[A2A_RESPONSE] - text: ${text.length <= 10 ? text : text.slice(0, 5) + '***' + text.slice(-5)}`);
65
+ log(`[A2A_RESPONSE] - files count: ${files?.length ?? 0}`);
65
66
  await wsManager.sendMessage(sessionId, outboundMessage);
66
- logger.log(`[A2A_RESPONSE] ✅ Message sent successfully`);
67
+ log(`[A2A_RESPONSE] ✅ Message sent successfully`);
67
68
  }
68
69
  /**
69
70
  * Send an A2A artifact-update with reasoningText part.
@@ -227,6 +227,7 @@ export async function monitorXYProvider(opts = {}) {
227
227
  text: notificationText,
228
228
  append: false,
229
229
  final: true,
230
+ runtime,
230
231
  }).catch(err => {
231
232
  error(`[MONITOR] Failed to send restart notification to session ${binding.sessionId}: ${String(err)}`);
232
233
  }));
@@ -210,6 +210,7 @@ export function createXYReplyDispatcher(params) {
210
210
  text: accumulatedText,
211
211
  append: false,
212
212
  final: true,
213
+ runtime,
213
214
  });
214
215
  finalSent = true;
215
216
  log(`[ON_IDLE] ✅ Sent final response with taskId=${currentTaskId}`);
@@ -242,6 +243,7 @@ export function createXYReplyDispatcher(params) {
242
243
  final: true,
243
244
  errorCode: 99921111,
244
245
  errorMessage: "任务执行异常,请重试",
246
+ runtime,
245
247
  });
246
248
  finalSent = true;
247
249
  log(`[ON_IDLE] ✅ Sent error response with code: 99921111`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ynhcj/xiaoyi-channel",
3
- "version": "0.0.91-next",
3
+ "version": "0.0.92-next",
4
4
  "description": "OpenClaw Xiaoyi Channel plugin - Xiaoyi A2A protocol integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",