@ynhcj/xiaoyi-channel 0.0.90-next → 0.0.91-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
@@ -172,6 +172,7 @@ export async function handleXYMessage(params) {
172
172
  messageId: parsed.messageId,
173
173
  text: isSecondMessage ? "新消息已接收,正在处理..." : "任务正在处理中,请稍候~",
174
174
  state: "working",
175
+ runtime,
175
176
  }).catch((err) => {
176
177
  error(`Failed to send initial status update:`, err);
177
178
  });
@@ -49,6 +49,7 @@ export interface SendStatusUpdateParams {
49
49
  messageId: string;
50
50
  text: string;
51
51
  state: "submitted" | "working" | "input-required" | "completed" | "canceled" | "failed" | "unknown";
52
+ runtime?: any;
52
53
  }
53
54
  /**
54
55
  * Send an A2A task status update.
@@ -108,7 +108,8 @@ export async function sendReasoningTextUpdate(params) {
108
108
  * Follows A2A protocol standard format with nested status object.
109
109
  */
110
110
  export async function sendStatusUpdate(params) {
111
- const { config, sessionId, taskId, messageId, text, state } = params;
111
+ const { config, sessionId, taskId, messageId, text, state, runtime } = params;
112
+ const log = runtime?.log ?? console.log;
112
113
  // Build status update event following A2A protocol standard
113
114
  const statusUpdate = {
114
115
  taskId,
@@ -143,9 +144,9 @@ export async function sendStatusUpdate(params) {
143
144
  msgDetail: JSON.stringify(jsonRpcResponse),
144
145
  };
145
146
  // 📋 Log complete response body
146
- logger.log(`[A2A_STATUS] 📤 Sending A2A status-update:`);
147
- logger.log(`[A2A_STATUS] - taskId: ${taskId}`);
148
- logger.log(`[A2A_STATUS] - text: "${text}"`);
147
+ log(`[A2A_STATUS] 📤 Sending A2A status-update:`);
148
+ log(`[A2A_STATUS] - taskId: ${taskId}`);
149
+ log(`[A2A_STATUS] - text: "${text}"`);
149
150
  await wsManager.sendMessage(sessionId, outboundMessage);
150
151
  }
151
152
  /**
@@ -95,6 +95,7 @@ export function createXYReplyDispatcher(params) {
95
95
  messageId: currentMessageId, // 🔑 动态messageId
96
96
  text: "任务正在处理中,请稍候~",
97
97
  state: "working",
98
+ runtime,
98
99
  }).catch((err) => {
99
100
  error(`Failed to send status update:`, err);
100
101
  });
@@ -161,6 +162,7 @@ export function createXYReplyDispatcher(params) {
161
162
  messageId: currentMessageId,
162
163
  text: "处理失败,请稍后重试",
163
164
  state: "failed",
165
+ runtime,
164
166
  });
165
167
  }
166
168
  catch (statusError) {
@@ -196,6 +198,7 @@ export function createXYReplyDispatcher(params) {
196
198
  messageId: currentMessageId,
197
199
  text: "任务处理已完成~",
198
200
  state: "completed",
201
+ runtime,
199
202
  });
200
203
  log(`[ON_IDLE] ✅ Sent completion status update`);
201
204
  // 🔑 使用动态taskId发送最终响应
@@ -226,6 +229,7 @@ export function createXYReplyDispatcher(params) {
226
229
  messageId: currentMessageId,
227
230
  text: "任务处理中断了~",
228
231
  state: "failed",
232
+ runtime,
229
233
  });
230
234
  log(`[ON_IDLE] ✅ Sent failure status update`);
231
235
  await sendA2AResponse({
@@ -282,6 +286,7 @@ export function createXYReplyDispatcher(params) {
282
286
  messageId: currentMessageId,
283
287
  text: `正在使用工具: ${toolName}...`,
284
288
  state: "working",
289
+ runtime,
285
290
  });
286
291
  log(`[TOOL START] ✅ Sent status update for tool start: ${toolName}`);
287
292
  }
@@ -310,6 +315,7 @@ export function createXYReplyDispatcher(params) {
310
315
  messageId: currentMessageId,
311
316
  text: resultText,
312
317
  state: "working",
318
+ runtime,
313
319
  });
314
320
  log(`[TOOL RESULT] ✅ Sent tool result as status update`);
315
321
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ynhcj/xiaoyi-channel",
3
- "version": "0.0.90-next",
3
+ "version": "0.0.91-next",
4
4
  "description": "OpenClaw Xiaoyi Channel plugin - Xiaoyi A2A protocol integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",