@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
package/dist/src/formatter.d.ts
CHANGED
package/dist/src/formatter.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
-
|
|
67
|
+
log(`[A2A_RESPONSE] ✅ Message sent successfully`);
|
|
67
68
|
}
|
|
68
69
|
/**
|
|
69
70
|
* Send an A2A artifact-update with reasoningText part.
|
package/dist/src/monitor.js
CHANGED
|
@@ -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`);
|