@ynhcj/xiaoyi-channel 0.0.57-beta → 0.0.59-beta
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/formatter.d.ts
CHANGED
package/dist/src/formatter.js
CHANGED
|
@@ -6,10 +6,10 @@ import { getXYRuntime } from "./runtime.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 } = params;
|
|
9
|
+
const { config, sessionId, taskId, messageId, text, append, final, files, errorCode, errorMessage } = params;
|
|
10
10
|
const runtime = getXYRuntime();
|
|
11
11
|
const log = runtime?.log ?? console.log;
|
|
12
|
-
const
|
|
12
|
+
const errorFn = runtime?.error ?? console.error;
|
|
13
13
|
// Build artifact update event
|
|
14
14
|
const artifact = {
|
|
15
15
|
taskId,
|
|
@@ -42,6 +42,14 @@ export async function sendA2AResponse(params) {
|
|
|
42
42
|
id: messageId,
|
|
43
43
|
result: artifact,
|
|
44
44
|
};
|
|
45
|
+
// 🔑 添加 error 字段(仅当提供 errorCode 时)
|
|
46
|
+
if (errorCode !== undefined) {
|
|
47
|
+
jsonRpcResponse.error = {
|
|
48
|
+
code: errorCode,
|
|
49
|
+
message: errorMessage ?? "任务执行异常,请重试",
|
|
50
|
+
};
|
|
51
|
+
log(`[A2A_RESPONSE] ⚠️ Including error code: ${errorCode}`);
|
|
52
|
+
}
|
|
45
53
|
// Send via WebSocket
|
|
46
54
|
const wsManager = getXYWebSocketManager(config);
|
|
47
55
|
const outboundMessage = {
|
package/dist/src/monitor.js
CHANGED
|
@@ -202,8 +202,8 @@ export async function monitorXYProvider(opts = {}) {
|
|
|
202
202
|
wsManager.on("disconnected", disconnectedHandler);
|
|
203
203
|
wsManager.on("error", errorHandler);
|
|
204
204
|
wsManager.on("trigger-event", triggerEventHandler);
|
|
205
|
-
// Start periodic health check (every
|
|
206
|
-
console.log("🏥 Starting periodic health check (every
|
|
205
|
+
// Start periodic health check (every 6 hours)
|
|
206
|
+
console.log("🏥 Starting periodic health check (every 6 hours)...");
|
|
207
207
|
healthCheckInterval = setInterval(() => {
|
|
208
208
|
console.log("🏥 [HEALTH CHECK] Periodic WebSocket diagnostics...");
|
|
209
209
|
diagnoseAllManagers();
|
|
@@ -214,7 +214,7 @@ export async function monitorXYProvider(opts = {}) {
|
|
|
214
214
|
}
|
|
215
215
|
// Cleanup stale temp files (older than 24 hours)
|
|
216
216
|
void cleanupStaleTempFiles();
|
|
217
|
-
},
|
|
217
|
+
}, 6 * 60 * 60 * 1000); // 6 hours
|
|
218
218
|
// Connect to WebSocket servers
|
|
219
219
|
wsManager.connect()
|
|
220
220
|
.then(() => {
|
package/dist/src/push.d.ts
CHANGED
package/dist/src/push.js
CHANGED
|
@@ -7,6 +7,7 @@ import { randomUUID } from "crypto";
|
|
|
7
7
|
*/
|
|
8
8
|
export class XYPushService {
|
|
9
9
|
config;
|
|
10
|
+
DEFAULT_PUSH_URL = "https://hag.cloud.huawei.com/open-ability-agent/v1/agent-webhook";
|
|
10
11
|
REQUEST_FROM = "openclaw";
|
|
11
12
|
constructor(config) {
|
|
12
13
|
this.config = config;
|
|
@@ -28,7 +29,7 @@ export class XYPushService {
|
|
|
28
29
|
* @param pushId - Push ID to use (required)
|
|
29
30
|
*/
|
|
30
31
|
async sendPush(content, title, data, sessionId, pushDataId, pushId) {
|
|
31
|
-
const pushUrl =
|
|
32
|
+
const pushUrl = this.config.pushUrl || this.DEFAULT_PUSH_URL;
|
|
32
33
|
const traceId = this.generateTraceId();
|
|
33
34
|
// Use provided pushId or fall back to config pushId
|
|
34
35
|
const actualPushId = pushId || this.config.pushId;
|
|
@@ -9,7 +9,7 @@ export interface CreateXYReplyDispatcherParams {
|
|
|
9
9
|
isSteerFollower?: boolean;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
* 清理 /tmp/xy_channel 目录中超过
|
|
12
|
+
* 清理 /tmp/xy_channel 目录中超过 24 小时的旧文件
|
|
13
13
|
*/
|
|
14
14
|
export declare function cleanupStaleTempFiles(tempDir?: string): Promise<void>;
|
|
15
15
|
/**
|
|
@@ -4,9 +4,9 @@ import { resolveXYConfig } from "./config.js";
|
|
|
4
4
|
import { getCurrentTaskId, getCurrentMessageId } from "./task-manager.js";
|
|
5
5
|
import fs from "fs/promises";
|
|
6
6
|
import path from "path";
|
|
7
|
-
const TEMP_FILE_TTL_MS = 60 * 1000; //
|
|
7
|
+
const TEMP_FILE_TTL_MS = 24 * 60 * 60 * 1000; // 24 hours
|
|
8
8
|
/**
|
|
9
|
-
* 清理 /tmp/xy_channel 目录中超过
|
|
9
|
+
* 清理 /tmp/xy_channel 目录中超过 24 小时的旧文件
|
|
10
10
|
*/
|
|
11
11
|
export async function cleanupStaleTempFiles(tempDir = "/tmp/xy_channel") {
|
|
12
12
|
try {
|
|
@@ -31,7 +31,7 @@ export async function cleanupStaleTempFiles(tempDir = "/tmp/xy_channel") {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
if (cleanedCount > 0) {
|
|
34
|
-
console.log(`[CLEANUP] 🧹 Cleaned ${cleanedCount} stale files (>${TEMP_FILE_TTL_MS / 1000}
|
|
34
|
+
console.log(`[CLEANUP] 🧹 Cleaned ${cleanedCount} stale files (>${TEMP_FILE_TTL_MS / 1000 / 3600}h) from ${tempDir}`);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
catch (err) {
|
|
@@ -235,9 +235,11 @@ export function createXYReplyDispatcher(params) {
|
|
|
235
235
|
text: "任务执行异常,请重试~",
|
|
236
236
|
append: false,
|
|
237
237
|
final: true,
|
|
238
|
+
errorCode: 99921111,
|
|
239
|
+
errorMessage: "任务执行异常,请重试",
|
|
238
240
|
});
|
|
239
241
|
finalSent = true;
|
|
240
|
-
log(`[ON_IDLE] ✅ Sent error response`);
|
|
242
|
+
log(`[ON_IDLE] ✅ Sent error response with code: 99921111`);
|
|
241
243
|
}
|
|
242
244
|
catch (err) {
|
|
243
245
|
error(`[ON_IDLE] Failed to send error response:`, err);
|