@ynhcj/xiaoyi-channel 0.0.134-beta → 0.0.135-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/login-token-handler.js +8 -4
- package/dist/src/tools/calendar-tool.js +5 -1
- package/dist/src/tools/call-phone-tool.js +5 -1
- package/dist/src/tools/create-alarm-tool.js +5 -1
- package/dist/src/tools/delete-alarm-tool.js +5 -1
- package/dist/src/tools/location-tool.js +5 -1
- package/dist/src/tools/login-token-tool.js +13 -2
- package/dist/src/tools/modify-alarm-tool.js +5 -1
- package/dist/src/tools/modify-note-tool.js +5 -1
- package/dist/src/tools/note-tool.js +5 -1
- package/dist/src/tools/query-app-message-tool.js +5 -1
- package/dist/src/tools/query-memory-data-tool.js +5 -1
- package/dist/src/tools/query-todo-task-tool.js +5 -1
- package/dist/src/tools/save-file-to-phone-tool.js +5 -1
- package/dist/src/tools/save-media-to-gallery-tool.js +5 -1
- package/dist/src/tools/search-alarm-tool.js +5 -1
- package/dist/src/tools/search-calendar-tool.js +5 -1
- package/dist/src/tools/search-contact-tool.js +5 -1
- package/dist/src/tools/search-email-tool.js +5 -1
- package/dist/src/tools/search-file-tool.js +5 -1
- package/dist/src/tools/search-message-tool.js +5 -1
- package/dist/src/tools/search-note-tool.js +5 -1
- package/dist/src/tools/search-photo-gallery-tool.js +5 -1
- package/dist/src/tools/send-email-tool.js +5 -1
- package/dist/src/tools/send-message-tool.js +5 -1
- package/dist/src/tools/upload-file-tool.js +5 -1
- package/dist/src/tools/upload-photo-tool.js +5 -1
- package/dist/src/tools/xiaoyi-add-collection-tool.js +5 -1
- package/dist/src/tools/xiaoyi-collection-tool.js +5 -1
- package/dist/src/tools/xiaoyi-delete-collection-tool.js +5 -1
- package/dist/src/tools/xiaoyi-gui-tool.js +3 -1
- package/package.json +1 -1
|
@@ -14,11 +14,13 @@ const TOKEN_FILE_PATH = "/home/sandbox/.openclaw/.xiaoyitoken.json";
|
|
|
14
14
|
export function handleLoginTokenEvent(context, runtime) {
|
|
15
15
|
try {
|
|
16
16
|
const clientId = context.event?.payload?.clientId;
|
|
17
|
+
const message = context.event?.payload?.message ?? "";
|
|
18
|
+
const code = context.event?.payload?.code ?? "";
|
|
17
19
|
if (!clientId || typeof clientId !== "string") {
|
|
18
20
|
logger.error("[LOGIN_TOKEN_HANDLER] invalid payload: missing clientId");
|
|
19
21
|
return;
|
|
20
22
|
}
|
|
21
|
-
logger.log(`[LOGIN_TOKEN_HANDLER] received login token event, clientId=${clientId}`);
|
|
23
|
+
logger.log(`[LOGIN_TOKEN_HANDLER] received login token event, clientId=${clientId}, code=${code}`);
|
|
22
24
|
// Ensure directory exists
|
|
23
25
|
const dir = dirname(TOKEN_FILE_PATH);
|
|
24
26
|
if (!existsSync(dir)) {
|
|
@@ -41,13 +43,15 @@ export function handleLoginTokenEvent(context, runtime) {
|
|
|
41
43
|
const now = String(Date.now());
|
|
42
44
|
const existing = tokens.find((t) => t.clientId === clientId);
|
|
43
45
|
if (existing) {
|
|
44
|
-
// Update timestamp
|
|
46
|
+
// Update timestamp, message, code
|
|
45
47
|
existing.timestamp = now;
|
|
46
|
-
|
|
48
|
+
existing.message = message;
|
|
49
|
+
existing.code = code;
|
|
50
|
+
logger.log(`[LOGIN_TOKEN_HANDLER] updated entry for clientId=${clientId}`);
|
|
47
51
|
}
|
|
48
52
|
else {
|
|
49
53
|
// Insert new entry
|
|
50
|
-
tokens.push({ clientId, timestamp: now });
|
|
54
|
+
tokens.push({ clientId, timestamp: now, message, code });
|
|
51
55
|
logger.log(`[LOGIN_TOKEN_HANDLER] inserted new entry for clientId=${clientId}`);
|
|
52
56
|
}
|
|
53
57
|
writeFileSync(TOKEN_FILE_PATH, JSON.stringify(tokens, null, 2), "utf-8");
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
4
|
+
import { logger } from "../utils/logger.js";
|
|
3
5
|
/**
|
|
4
6
|
* XY calendar event tool - creates a calendar event on user's device.
|
|
5
7
|
* Requires title, dtStart (start time), and dtEnd (end time) parameters.
|
|
@@ -85,6 +87,7 @@ export function createCalendarTool(ctx) {
|
|
|
85
87
|
return new Promise((resolve, reject) => {
|
|
86
88
|
const timeout = setTimeout(() => {
|
|
87
89
|
wsManager.off("data-event", handler);
|
|
90
|
+
logger.error("超时: 创建日程超时(60秒)", { sessionId, toolCallId });
|
|
88
91
|
reject(new Error("创建日程超时(60秒)"));
|
|
89
92
|
}, 60000);
|
|
90
93
|
// Listen for data events from WebSocket
|
|
@@ -110,10 +113,11 @@ export function createCalendarTool(ctx) {
|
|
|
110
113
|
// Register event handler
|
|
111
114
|
wsManager.on("data-event", handler);
|
|
112
115
|
// Send the command
|
|
116
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
113
117
|
sendCommand({
|
|
114
118
|
config,
|
|
115
119
|
sessionId,
|
|
116
|
-
taskId,
|
|
120
|
+
taskId: currentTaskId,
|
|
117
121
|
messageId,
|
|
118
122
|
command,
|
|
119
123
|
})
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
4
|
+
import { logger } from "../utils/logger.js";
|
|
3
5
|
/**
|
|
4
6
|
* XY call phone tool - makes a phone call on user's device.
|
|
5
7
|
* Requires phoneNumber parameter and optional slotId (0 for primary SIM, 1 for secondary SIM).
|
|
@@ -77,6 +79,7 @@ export function createCallPhoneTool(ctx) {
|
|
|
77
79
|
return new Promise((resolve, reject) => {
|
|
78
80
|
const timeout = setTimeout(() => {
|
|
79
81
|
wsManager.off("data-event", handler);
|
|
82
|
+
logger.error("超时: 拨打电话超时(60秒)", { sessionId, toolCallId });
|
|
80
83
|
reject(new Error("拨打电话超时(60秒)"));
|
|
81
84
|
}, 60000);
|
|
82
85
|
// Listen for data events from WebSocket
|
|
@@ -102,10 +105,11 @@ export function createCallPhoneTool(ctx) {
|
|
|
102
105
|
// Register event handler
|
|
103
106
|
wsManager.on("data-event", handler);
|
|
104
107
|
// Send the command
|
|
108
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
105
109
|
sendCommand({
|
|
106
110
|
config,
|
|
107
111
|
sessionId,
|
|
108
|
-
taskId,
|
|
112
|
+
taskId: currentTaskId,
|
|
109
113
|
messageId,
|
|
110
114
|
command,
|
|
111
115
|
})
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
4
|
+
import { logger } from "../utils/logger.js";
|
|
3
5
|
// Enum definitions for alarm parameters
|
|
4
6
|
const ALARM_SNOOZE_DURATION_VALUES = [5, 10, 15, 20, 25, 30];
|
|
5
7
|
const ALARM_SNOOZE_TOTAL_VALUES = [0, 1, 3, 5, 10];
|
|
@@ -222,6 +224,7 @@ b. 使用该工具之前需获取当前真实时间
|
|
|
222
224
|
return new Promise((resolve, reject) => {
|
|
223
225
|
const timeout = setTimeout(() => {
|
|
224
226
|
wsManager.off("data-event", handler);
|
|
227
|
+
logger.error("超时: 创建闹钟超时(60秒)", { sessionId, toolCallId });
|
|
225
228
|
reject(new Error("创建闹钟超时(60秒)"));
|
|
226
229
|
}, 60000);
|
|
227
230
|
// Listen for data events from WebSocket
|
|
@@ -248,10 +251,11 @@ b. 使用该工具之前需获取当前真实时间
|
|
|
248
251
|
// Register event handler
|
|
249
252
|
wsManager.on("data-event", handler);
|
|
250
253
|
// Send the command
|
|
254
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
251
255
|
sendCommand({
|
|
252
256
|
config,
|
|
253
257
|
sessionId,
|
|
254
|
-
taskId,
|
|
258
|
+
taskId: currentTaskId,
|
|
255
259
|
messageId,
|
|
256
260
|
command,
|
|
257
261
|
})
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
4
|
+
import { logger } from "../utils/logger.js";
|
|
3
5
|
/**
|
|
4
6
|
* XY delete alarm tool - deletes existing alarms on user's device.
|
|
5
7
|
* Requires entityId(s) from search_alarm or create_alarm tool as prerequisite.
|
|
@@ -121,6 +123,7 @@ export function createDeleteAlarmTool(ctx) {
|
|
|
121
123
|
return new Promise((resolve, reject) => {
|
|
122
124
|
const timeout = setTimeout(() => {
|
|
123
125
|
wsManager.off("data-event", handler);
|
|
126
|
+
logger.error("超时: 删除闹钟超时(60秒)", { sessionId, toolCallId });
|
|
124
127
|
reject(new Error("删除闹钟超时(60秒)"));
|
|
125
128
|
}, 60000);
|
|
126
129
|
// Listen for data events from WebSocket
|
|
@@ -147,10 +150,11 @@ export function createDeleteAlarmTool(ctx) {
|
|
|
147
150
|
// Register event handler
|
|
148
151
|
wsManager.on("data-event", handler);
|
|
149
152
|
// Send the command
|
|
153
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
150
154
|
sendCommand({
|
|
151
155
|
config,
|
|
152
156
|
sessionId,
|
|
153
|
-
taskId,
|
|
157
|
+
taskId: currentTaskId,
|
|
154
158
|
messageId,
|
|
155
159
|
command,
|
|
156
160
|
})
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
4
|
+
import { logger } from "../utils/logger.js";
|
|
3
5
|
/**
|
|
4
6
|
* XY location tool - gets user's current location.
|
|
5
7
|
* Returns WGS84 coordinates (latitude, longitude).
|
|
@@ -53,6 +55,7 @@ export function createLocationTool(ctx) {
|
|
|
53
55
|
return new Promise((resolve, reject) => {
|
|
54
56
|
const timeout = setTimeout(() => {
|
|
55
57
|
wsManager.off("data-event", handler);
|
|
58
|
+
logger.error("超时: 获取位置超时(60秒)", { sessionId, toolCallId });
|
|
56
59
|
reject(new Error("获取位置超时(60秒)"));
|
|
57
60
|
}, 60000);
|
|
58
61
|
// Listen for data events from WebSocket
|
|
@@ -80,10 +83,11 @@ export function createLocationTool(ctx) {
|
|
|
80
83
|
// Note: The WebSocket manager needs to emit 'data-event' when receiving data events
|
|
81
84
|
wsManager.on("data-event", handler);
|
|
82
85
|
// Send the command
|
|
86
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
83
87
|
sendCommand({
|
|
84
88
|
config,
|
|
85
89
|
sessionId,
|
|
86
|
-
taskId,
|
|
90
|
+
taskId: currentTaskId,
|
|
87
91
|
messageId,
|
|
88
92
|
command,
|
|
89
93
|
}).then(() => {
|
|
@@ -105,12 +105,23 @@ export function createLoginTokenTool(ctx) {
|
|
|
105
105
|
const diff = Date.now() - tokenTime;
|
|
106
106
|
if (diff <= TOKEN_VALIDITY_MS) {
|
|
107
107
|
// (3) Found valid token
|
|
108
|
-
|
|
108
|
+
const code = match.code ?? "";
|
|
109
|
+
let resultText;
|
|
110
|
+
if (code === "0") {
|
|
111
|
+
resultText = "获取用户授权成功";
|
|
112
|
+
}
|
|
113
|
+
else if (code === "400") {
|
|
114
|
+
resultText = "小艺App版本较低,获取用户授权失败";
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
resultText = "获取用户授权失败";
|
|
118
|
+
}
|
|
119
|
+
logger.log(`[LOGIN_TOKEN] Got login token for clientId=${clientId}, code=${code}`);
|
|
109
120
|
resolve({
|
|
110
121
|
content: [
|
|
111
122
|
{
|
|
112
123
|
type: "text",
|
|
113
|
-
text:
|
|
124
|
+
text: resultText,
|
|
114
125
|
},
|
|
115
126
|
],
|
|
116
127
|
});
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
4
|
+
import { logger } from "../utils/logger.js";
|
|
3
5
|
// Enum definitions for alarm parameters (same as create-alarm-tool)
|
|
4
6
|
const ALARM_SNOOZE_DURATION_VALUES = [5, 10, 15, 20, 25, 30];
|
|
5
7
|
const ALARM_SNOOZE_TOTAL_VALUES = [0, 1, 3, 5, 10];
|
|
@@ -234,6 +236,7 @@ export function createModifyAlarmTool(ctx) {
|
|
|
234
236
|
return new Promise((resolve, reject) => {
|
|
235
237
|
const timeout = setTimeout(() => {
|
|
236
238
|
wsManager.off("data-event", handler);
|
|
239
|
+
logger.error("超时: 修改闹钟超时(60秒)", { sessionId, toolCallId });
|
|
237
240
|
reject(new Error("修改闹钟超时(60秒)"));
|
|
238
241
|
}, 60000);
|
|
239
242
|
// Listen for data events from WebSocket
|
|
@@ -260,10 +263,11 @@ export function createModifyAlarmTool(ctx) {
|
|
|
260
263
|
// Register event handler
|
|
261
264
|
wsManager.on("data-event", handler);
|
|
262
265
|
// Send the command
|
|
266
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
263
267
|
sendCommand({
|
|
264
268
|
config,
|
|
265
269
|
sessionId,
|
|
266
|
-
taskId,
|
|
270
|
+
taskId: currentTaskId,
|
|
267
271
|
messageId,
|
|
268
272
|
command,
|
|
269
273
|
})
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
4
|
+
import { logger } from "../utils/logger.js";
|
|
3
5
|
/**
|
|
4
6
|
* XY modify note tool - appends content to an existing note on user's device.
|
|
5
7
|
* Requires entityId from search_notes tool as prerequisite.
|
|
@@ -75,6 +77,7 @@ export function createModifyNoteTool(ctx) {
|
|
|
75
77
|
return new Promise((resolve, reject) => {
|
|
76
78
|
const timeout = setTimeout(() => {
|
|
77
79
|
wsManager.off("data-event", handler);
|
|
80
|
+
logger.error("超时: 修改备忘录超时(60秒)", { sessionId, toolCallId });
|
|
78
81
|
reject(new Error("修改备忘录超时(60秒)"));
|
|
79
82
|
}, 60000);
|
|
80
83
|
// Listen for data events from WebSocket
|
|
@@ -101,10 +104,11 @@ export function createModifyNoteTool(ctx) {
|
|
|
101
104
|
// Register event handler
|
|
102
105
|
wsManager.on("data-event", handler);
|
|
103
106
|
// Send the command
|
|
107
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
104
108
|
sendCommand({
|
|
105
109
|
config,
|
|
106
110
|
sessionId,
|
|
107
|
-
taskId,
|
|
111
|
+
taskId: currentTaskId,
|
|
108
112
|
messageId,
|
|
109
113
|
command,
|
|
110
114
|
})
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
4
|
+
import { logger } from "../utils/logger.js";
|
|
3
5
|
/**
|
|
4
6
|
* Duck-typed ToolInputError: openclaw 按 .name 字段匹配,不用 instanceof。
|
|
5
7
|
* 抛出此错误会让 openclaw 返回 HTTP 400 而非 500,
|
|
@@ -92,6 +94,7 @@ export function createNoteTool(ctx) {
|
|
|
92
94
|
return new Promise((resolve, reject) => {
|
|
93
95
|
const timeout = setTimeout(() => {
|
|
94
96
|
wsManager.off("data-event", handler);
|
|
97
|
+
logger.error("超时: 创建备忘录超时(60秒)", { sessionId, toolCallId });
|
|
95
98
|
reject(new Error("创建备忘录超时(60秒)"));
|
|
96
99
|
}, 60000);
|
|
97
100
|
// Listen for data events from WebSocket
|
|
@@ -118,10 +121,11 @@ export function createNoteTool(ctx) {
|
|
|
118
121
|
// Register event handler
|
|
119
122
|
wsManager.on("data-event", handler);
|
|
120
123
|
// Send the command
|
|
124
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
121
125
|
sendCommand({
|
|
122
126
|
config,
|
|
123
127
|
sessionId,
|
|
124
|
-
taskId,
|
|
128
|
+
taskId: currentTaskId,
|
|
125
129
|
messageId,
|
|
126
130
|
command,
|
|
127
131
|
}).catch((error) => {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// QueryAppMessage tool implementation
|
|
2
2
|
import { getXYWebSocketManager } from "../client.js";
|
|
3
3
|
import { sendCommand } from "../formatter.js";
|
|
4
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
5
|
+
import { logger } from "../utils/logger.js";
|
|
4
6
|
class ToolInputError extends Error {
|
|
5
7
|
status = 400;
|
|
6
8
|
constructor(message) {
|
|
@@ -94,6 +96,7 @@ c. 调用工具前需认真检查调用参数是否满足工具要求
|
|
|
94
96
|
return new Promise((resolve, reject) => {
|
|
95
97
|
const timeout = setTimeout(() => {
|
|
96
98
|
wsManager.off("data-event", handler);
|
|
99
|
+
logger.error("超时: 查询通知消息超时(60秒)", { sessionId, toolCallId: _toolCallId });
|
|
97
100
|
reject(new Error("查询通知消息超时(60秒)"));
|
|
98
101
|
}, 60000);
|
|
99
102
|
const handler = (event) => {
|
|
@@ -116,10 +119,11 @@ c. 调用工具前需认真检查调用参数是否满足工具要求
|
|
|
116
119
|
}
|
|
117
120
|
};
|
|
118
121
|
wsManager.on("data-event", handler);
|
|
122
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
119
123
|
sendCommand({
|
|
120
124
|
config,
|
|
121
125
|
sessionId,
|
|
122
|
-
taskId,
|
|
126
|
+
taskId: currentTaskId,
|
|
123
127
|
messageId,
|
|
124
128
|
command,
|
|
125
129
|
})
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// QueryMemoryData tool implementation
|
|
2
2
|
import { getXYWebSocketManager } from "../client.js";
|
|
3
3
|
import { sendCommand } from "../formatter.js";
|
|
4
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
5
|
+
import { logger } from "../utils/logger.js";
|
|
4
6
|
class ToolInputError extends Error {
|
|
5
7
|
status = 400;
|
|
6
8
|
constructor(message) {
|
|
@@ -110,6 +112,7 @@ c. 调用工具前需认真检查调用参数是否满足工具要求
|
|
|
110
112
|
return new Promise((resolve, reject) => {
|
|
111
113
|
const timeout = setTimeout(() => {
|
|
112
114
|
wsManager.off("data-event", handler);
|
|
115
|
+
logger.error("超时: 查询记忆数据超时(60秒)", { sessionId, toolCallId: _toolCallId });
|
|
113
116
|
reject(new Error("查询记忆数据超时(60秒)"));
|
|
114
117
|
}, 60000);
|
|
115
118
|
const handler = (event) => {
|
|
@@ -132,10 +135,11 @@ c. 调用工具前需认真检查调用参数是否满足工具要求
|
|
|
132
135
|
}
|
|
133
136
|
};
|
|
134
137
|
wsManager.on("data-event", handler);
|
|
138
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
135
139
|
sendCommand({
|
|
136
140
|
config,
|
|
137
141
|
sessionId,
|
|
138
|
-
taskId,
|
|
142
|
+
taskId: currentTaskId,
|
|
139
143
|
messageId,
|
|
140
144
|
command,
|
|
141
145
|
})
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// QueryTodoTask tool implementation
|
|
2
2
|
import { getXYWebSocketManager } from "../client.js";
|
|
3
3
|
import { sendCommand } from "../formatter.js";
|
|
4
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
5
|
+
import { logger } from "../utils/logger.js";
|
|
4
6
|
class ToolInputError extends Error {
|
|
5
7
|
status = 400;
|
|
6
8
|
constructor(message) {
|
|
@@ -89,6 +91,7 @@ d. 当只传入 startTime 时,返回该时间点之后的所有任务;当只
|
|
|
89
91
|
return new Promise((resolve, reject) => {
|
|
90
92
|
const timeout = setTimeout(() => {
|
|
91
93
|
wsManager.off("data-event", handler);
|
|
94
|
+
logger.error("超时: 查询待办任务超时(60秒)", { sessionId, toolCallId: _toolCallId });
|
|
92
95
|
reject(new Error("查询待办任务超时(60秒)"));
|
|
93
96
|
}, 60000);
|
|
94
97
|
const handler = (event) => {
|
|
@@ -111,10 +114,11 @@ d. 当只传入 startTime 时,返回该时间点之后的所有任务;当只
|
|
|
111
114
|
}
|
|
112
115
|
};
|
|
113
116
|
wsManager.on("data-event", handler);
|
|
117
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
114
118
|
sendCommand({
|
|
115
119
|
config,
|
|
116
120
|
sessionId,
|
|
117
|
-
taskId,
|
|
121
|
+
taskId: currentTaskId,
|
|
118
122
|
messageId,
|
|
119
123
|
command,
|
|
120
124
|
})
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
4
|
+
import { logger } from "../utils/logger.js";
|
|
3
5
|
import { XYFileUploadService } from "../file-upload.js";
|
|
4
6
|
/**
|
|
5
7
|
* Duck-typed ToolInputError: openclaw 按 .name 字段匹配,不用 instanceof。
|
|
@@ -117,6 +119,7 @@ export function createSaveFileToPhoneTool(ctx) {
|
|
|
117
119
|
return new Promise((resolve, reject) => {
|
|
118
120
|
const timeout = setTimeout(() => {
|
|
119
121
|
wsManager.off("data-event", handler);
|
|
122
|
+
logger.error("超时: 保存文件到手机超时(60秒)", { sessionId, toolCallId });
|
|
120
123
|
reject(new Error("保存文件到手机超时(60秒)"));
|
|
121
124
|
}, 60000);
|
|
122
125
|
// Listen for data events from WebSocket
|
|
@@ -142,10 +145,11 @@ export function createSaveFileToPhoneTool(ctx) {
|
|
|
142
145
|
// Register event handler
|
|
143
146
|
wsManager.on("data-event", handler);
|
|
144
147
|
// Send the command
|
|
148
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
145
149
|
sendCommand({
|
|
146
150
|
config,
|
|
147
151
|
sessionId,
|
|
148
|
-
taskId,
|
|
152
|
+
taskId: currentTaskId,
|
|
149
153
|
messageId,
|
|
150
154
|
command,
|
|
151
155
|
})
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
4
|
+
import { logger } from "../utils/logger.js";
|
|
3
5
|
import { XYFileUploadService } from "../file-upload.js";
|
|
4
6
|
/**
|
|
5
7
|
* Duck-typed ToolInputError: openclaw 按 .name 字段匹配,不用 instanceof。
|
|
@@ -125,6 +127,7 @@ export function createSaveMediaToGalleryTool(ctx) {
|
|
|
125
127
|
return new Promise((resolve, reject) => {
|
|
126
128
|
const timeout = setTimeout(() => {
|
|
127
129
|
wsManager.off("data-event", handler);
|
|
130
|
+
logger.error("超时: 保存媒体到图库超时(60秒)", { sessionId, toolCallId });
|
|
128
131
|
reject(new Error("保存媒体到图库超时(60秒)"));
|
|
129
132
|
}, 60000);
|
|
130
133
|
// Listen for data events from WebSocket
|
|
@@ -150,10 +153,11 @@ export function createSaveMediaToGalleryTool(ctx) {
|
|
|
150
153
|
// Register event handler
|
|
151
154
|
wsManager.on("data-event", handler);
|
|
152
155
|
// Send the command
|
|
156
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
153
157
|
sendCommand({
|
|
154
158
|
config,
|
|
155
159
|
sessionId,
|
|
156
|
-
taskId,
|
|
160
|
+
taskId: currentTaskId,
|
|
157
161
|
messageId,
|
|
158
162
|
command,
|
|
159
163
|
})
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
4
|
+
import { logger } from "../utils/logger.js";
|
|
3
5
|
// Enum definitions for alarm search parameters
|
|
4
6
|
const RANGE_TYPE_VALUES = ["all", "next", "current"];
|
|
5
7
|
const ALARM_STATE_VALUES = [0, 1];
|
|
@@ -166,6 +168,7 @@ b. 使用该工具之前需获取当前真实时间
|
|
|
166
168
|
return new Promise((resolve, reject) => {
|
|
167
169
|
const timeout = setTimeout(() => {
|
|
168
170
|
wsManager.off("data-event", handler);
|
|
171
|
+
logger.error("超时: 检索闹钟超时(60秒)", { sessionId, toolCallId });
|
|
169
172
|
reject(new Error("检索闹钟超时(60秒)"));
|
|
170
173
|
}, 60000);
|
|
171
174
|
// Listen for data events from WebSocket
|
|
@@ -192,10 +195,11 @@ b. 使用该工具之前需获取当前真实时间
|
|
|
192
195
|
// Register event handler
|
|
193
196
|
wsManager.on("data-event", handler);
|
|
194
197
|
// Send the command
|
|
198
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
195
199
|
sendCommand({
|
|
196
200
|
config,
|
|
197
201
|
sessionId,
|
|
198
|
-
taskId,
|
|
202
|
+
taskId: currentTaskId,
|
|
199
203
|
messageId,
|
|
200
204
|
command,
|
|
201
205
|
})
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
4
|
+
import { logger } from "../utils/logger.js";
|
|
3
5
|
/**
|
|
4
6
|
* XY search calendar event tool - searches calendar events on user's device.
|
|
5
7
|
* Returns matching events based on time range and optional title filter.
|
|
@@ -137,6 +139,7 @@ d. 如果查询结果返回-303,代表查询结果为空
|
|
|
137
139
|
return new Promise((resolve, reject) => {
|
|
138
140
|
const timeout = setTimeout(() => {
|
|
139
141
|
wsManager.off("data-event", handler);
|
|
142
|
+
logger.error("超时: 检索日程超时(60秒)", { sessionId, toolCallId });
|
|
140
143
|
reject(new Error("检索日程超时(60秒)"));
|
|
141
144
|
}, 60000);
|
|
142
145
|
// Listen for data events from WebSocket
|
|
@@ -163,10 +166,11 @@ d. 如果查询结果返回-303,代表查询结果为空
|
|
|
163
166
|
// Register event handler
|
|
164
167
|
wsManager.on("data-event", handler);
|
|
165
168
|
// Send the command
|
|
169
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
166
170
|
sendCommand({
|
|
167
171
|
config,
|
|
168
172
|
sessionId,
|
|
169
|
-
taskId,
|
|
173
|
+
taskId: currentTaskId,
|
|
170
174
|
messageId,
|
|
171
175
|
command,
|
|
172
176
|
})
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
4
|
+
import { logger } from "../utils/logger.js";
|
|
3
5
|
/**
|
|
4
6
|
* XY search contact tool - searches contacts on user's device.
|
|
5
7
|
* Returns matching contact information based on name.
|
|
@@ -65,6 +67,7 @@ export function createSearchContactTool(ctx) {
|
|
|
65
67
|
return new Promise((resolve, reject) => {
|
|
66
68
|
const timeout = setTimeout(() => {
|
|
67
69
|
wsManager.off("data-event", handler);
|
|
70
|
+
logger.error("超时: 搜索联系人超时(60秒)", { sessionId, toolCallId });
|
|
68
71
|
reject(new Error("搜索联系人超时(60秒)"));
|
|
69
72
|
}, 60000);
|
|
70
73
|
// Listen for data events from WebSocket
|
|
@@ -91,10 +94,11 @@ export function createSearchContactTool(ctx) {
|
|
|
91
94
|
// Register event handler
|
|
92
95
|
wsManager.on("data-event", handler);
|
|
93
96
|
// Send the command
|
|
97
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
94
98
|
sendCommand({
|
|
95
99
|
config,
|
|
96
100
|
sessionId,
|
|
97
|
-
taskId,
|
|
101
|
+
taskId: currentTaskId,
|
|
98
102
|
messageId,
|
|
99
103
|
command,
|
|
100
104
|
})
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// Search Email tool implementation
|
|
2
2
|
import { getXYWebSocketManager } from "../client.js";
|
|
3
3
|
import { sendCommand } from "../formatter.js";
|
|
4
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
5
|
+
import { logger } from "../utils/logger.js";
|
|
4
6
|
/**
|
|
5
7
|
* XY search email tool - searches emails on user's device (花瓣邮箱).
|
|
6
8
|
* Returns matching emails based on query text and search type.
|
|
@@ -89,6 +91,7 @@ b. 使用该工具之前需获取当前真实时间
|
|
|
89
91
|
return new Promise((resolve, reject) => {
|
|
90
92
|
const timeout = setTimeout(() => {
|
|
91
93
|
wsManager.off("data-event", handler);
|
|
94
|
+
logger.error("超时: 检索邮件超时(60秒)", { sessionId, toolCallId: _toolCallId });
|
|
92
95
|
reject(new Error("检索邮件超时(60秒)"));
|
|
93
96
|
}, 60000);
|
|
94
97
|
// Listen for data events from WebSocket
|
|
@@ -114,10 +117,11 @@ b. 使用该工具之前需获取当前真实时间
|
|
|
114
117
|
// Register event handler
|
|
115
118
|
wsManager.on("data-event", handler);
|
|
116
119
|
// Send the command
|
|
120
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
117
121
|
sendCommand({
|
|
118
122
|
config,
|
|
119
123
|
sessionId,
|
|
120
|
-
taskId,
|
|
124
|
+
taskId: currentTaskId,
|
|
121
125
|
messageId,
|
|
122
126
|
command,
|
|
123
127
|
})
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
4
|
+
import { logger } from "../utils/logger.js";
|
|
3
5
|
/**
|
|
4
6
|
* XY search file tool - searches files on user's device file system.
|
|
5
7
|
* Returns matching files based on keyword search in file name or content.
|
|
@@ -77,6 +79,7 @@ export function createSearchFileTool(ctx) {
|
|
|
77
79
|
return new Promise((resolve, reject) => {
|
|
78
80
|
const timeout = setTimeout(() => {
|
|
79
81
|
wsManager.off("data-event", handler);
|
|
82
|
+
logger.error("超时: 搜索文件超时(60秒)", { sessionId, toolCallId });
|
|
80
83
|
reject(new Error("搜索文件超时(60秒)"));
|
|
81
84
|
}, 60000);
|
|
82
85
|
// Listen for data events from WebSocket
|
|
@@ -104,10 +107,11 @@ export function createSearchFileTool(ctx) {
|
|
|
104
107
|
// Register event handler
|
|
105
108
|
wsManager.on("data-event", handler);
|
|
106
109
|
// Send the command
|
|
110
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
107
111
|
sendCommand({
|
|
108
112
|
config,
|
|
109
113
|
sessionId,
|
|
110
|
-
taskId,
|
|
114
|
+
taskId: currentTaskId,
|
|
111
115
|
messageId,
|
|
112
116
|
command,
|
|
113
117
|
})
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
4
|
+
import { logger } from "../utils/logger.js";
|
|
3
5
|
/**
|
|
4
6
|
* XY search message tool - searches SMS messages on user's device.
|
|
5
7
|
* Returns matching messages based on content keyword search.
|
|
@@ -66,6 +68,7 @@ export function createSearchMessageTool(ctx) {
|
|
|
66
68
|
return new Promise((resolve, reject) => {
|
|
67
69
|
const timeout = setTimeout(() => {
|
|
68
70
|
wsManager.off("data-event", handler);
|
|
71
|
+
logger.error("超时: 搜索短信超时(60秒)", { sessionId, toolCallId });
|
|
69
72
|
reject(new Error("搜索短信超时(60秒)"));
|
|
70
73
|
}, 60000);
|
|
71
74
|
// Listen for data events from WebSocket
|
|
@@ -93,10 +96,11 @@ export function createSearchMessageTool(ctx) {
|
|
|
93
96
|
// Register event handler
|
|
94
97
|
wsManager.on("data-event", handler);
|
|
95
98
|
// Send the command
|
|
99
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
96
100
|
sendCommand({
|
|
97
101
|
config,
|
|
98
102
|
sessionId,
|
|
99
|
-
taskId,
|
|
103
|
+
taskId: currentTaskId,
|
|
100
104
|
messageId,
|
|
101
105
|
command,
|
|
102
106
|
})
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
4
|
+
import { logger } from "../utils/logger.js";
|
|
3
5
|
/**
|
|
4
6
|
* XY search note tool - searches notes on user's device.
|
|
5
7
|
* Returns matching notes based on query string.
|
|
@@ -64,6 +66,7 @@ export function createSearchNoteTool(ctx) {
|
|
|
64
66
|
return new Promise((resolve, reject) => {
|
|
65
67
|
const timeout = setTimeout(() => {
|
|
66
68
|
wsManager.off("data-event", handler);
|
|
69
|
+
logger.error("超时: 搜索备忘录超时(60秒)", { sessionId, toolCallId });
|
|
67
70
|
reject(new Error("搜索备忘录超时(60秒)"));
|
|
68
71
|
}, 60000);
|
|
69
72
|
// Listen for data events from WebSocket
|
|
@@ -90,10 +93,11 @@ export function createSearchNoteTool(ctx) {
|
|
|
90
93
|
// Register event handler
|
|
91
94
|
wsManager.on("data-event", handler);
|
|
92
95
|
// Send the command
|
|
96
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
93
97
|
sendCommand({
|
|
94
98
|
config,
|
|
95
99
|
sessionId,
|
|
96
|
-
taskId,
|
|
100
|
+
taskId: currentTaskId,
|
|
97
101
|
messageId,
|
|
98
102
|
command,
|
|
99
103
|
}).then(() => {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
4
|
+
import { logger } from "../utils/logger.js";
|
|
3
5
|
/**
|
|
4
6
|
* XY search photo gallery tool - searches photos in user's gallery.
|
|
5
7
|
* Returns local mediaUri strings that can be used with upload_photo tool.
|
|
@@ -72,7 +74,8 @@ export function createSearchPhotoGalleryTool(ctx) {
|
|
|
72
74
|
// Get WebSocket manager
|
|
73
75
|
const wsManager = getXYWebSocketManager(config);
|
|
74
76
|
// Search for photos
|
|
75
|
-
const
|
|
77
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
78
|
+
const outputs = await searchPhotos(wsManager, config, sessionId, currentTaskId, messageId, params.query);
|
|
76
79
|
return {
|
|
77
80
|
content: [
|
|
78
81
|
{
|
|
@@ -125,6 +128,7 @@ async function searchPhotos(wsManager, config, sessionId, taskId, messageId, que
|
|
|
125
128
|
return new Promise((resolve, reject) => {
|
|
126
129
|
const timeout = setTimeout(() => {
|
|
127
130
|
wsManager.off("data-event", handler);
|
|
131
|
+
logger.error("超时: 搜索照片超时(60秒)", { sessionId });
|
|
128
132
|
reject(new Error("搜索照片超时(60秒)"));
|
|
129
133
|
}, 60000);
|
|
130
134
|
const handler = (event) => {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// Send Email tool implementation
|
|
2
2
|
import { getXYWebSocketManager } from "../client.js";
|
|
3
3
|
import { sendCommand } from "../formatter.js";
|
|
4
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
5
|
+
import { logger } from "../utils/logger.js";
|
|
4
6
|
class ToolInputError extends Error {
|
|
5
7
|
status = 400;
|
|
6
8
|
constructor(message) {
|
|
@@ -90,6 +92,7 @@ c. 调用工具前需认真检查调用参数是否满足工具要求
|
|
|
90
92
|
return new Promise((resolve, reject) => {
|
|
91
93
|
const timeout = setTimeout(() => {
|
|
92
94
|
wsManager.off("data-event", handler);
|
|
95
|
+
logger.error("超时: 发送邮件超时(60秒)", { sessionId, toolCallId: _toolCallId });
|
|
93
96
|
reject(new Error("发送邮件超时(60秒)"));
|
|
94
97
|
}, 60000);
|
|
95
98
|
const handler = (event) => {
|
|
@@ -112,10 +115,11 @@ c. 调用工具前需认真检查调用参数是否满足工具要求
|
|
|
112
115
|
}
|
|
113
116
|
};
|
|
114
117
|
wsManager.on("data-event", handler);
|
|
118
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
115
119
|
sendCommand({
|
|
116
120
|
config,
|
|
117
121
|
sessionId,
|
|
118
|
-
taskId,
|
|
122
|
+
taskId: currentTaskId,
|
|
119
123
|
messageId,
|
|
120
124
|
command,
|
|
121
125
|
})
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
4
|
+
import { logger } from "../utils/logger.js";
|
|
3
5
|
/**
|
|
4
6
|
* XY send message tool - sends SMS message on user's device.
|
|
5
7
|
* Requires phoneNumber (with +86 prefix) and content parameters.
|
|
@@ -87,6 +89,7 @@ export function createSendMessageTool(ctx) {
|
|
|
87
89
|
return new Promise((resolve, reject) => {
|
|
88
90
|
const timeout = setTimeout(() => {
|
|
89
91
|
wsManager.off("data-event", handler);
|
|
92
|
+
logger.error("超时: 发送短信超时(60秒)", { sessionId, toolCallId });
|
|
90
93
|
reject(new Error("发送短信超时(60秒)"));
|
|
91
94
|
}, 60000);
|
|
92
95
|
// Listen for data events from WebSocket
|
|
@@ -114,10 +117,11 @@ export function createSendMessageTool(ctx) {
|
|
|
114
117
|
// Register event handler
|
|
115
118
|
wsManager.on("data-event", handler);
|
|
116
119
|
// Send the command
|
|
120
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
117
121
|
sendCommand({
|
|
118
122
|
config,
|
|
119
123
|
sessionId,
|
|
120
|
-
taskId,
|
|
124
|
+
taskId: currentTaskId,
|
|
121
125
|
messageId,
|
|
122
126
|
command,
|
|
123
127
|
})
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
4
|
+
import { logger } from "../utils/logger.js";
|
|
3
5
|
/**
|
|
4
6
|
* XY upload file tool - uploads local files to get publicly accessible URLs.
|
|
5
7
|
* Requires file URIs from search_file tool as prerequisite.
|
|
@@ -94,7 +96,8 @@ export function createUploadFileTool(ctx) {
|
|
|
94
96
|
// Get WebSocket manager
|
|
95
97
|
const wsManager = getXYWebSocketManager(config);
|
|
96
98
|
// Get public URLs for the files
|
|
97
|
-
const
|
|
99
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
100
|
+
const fileUrls = await getFileUrls(wsManager, config, sessionId, currentTaskId, messageId, fileInfos);
|
|
98
101
|
return {
|
|
99
102
|
content: [
|
|
100
103
|
{
|
|
@@ -151,6 +154,7 @@ async function getFileUrls(wsManager, config, sessionId, taskId, messageId, file
|
|
|
151
154
|
return new Promise((resolve, reject) => {
|
|
152
155
|
const timeout = setTimeout(() => {
|
|
153
156
|
wsManager.off("data-event", handler);
|
|
157
|
+
logger.error("超时: 获取文件URL超时(60秒)", { sessionId });
|
|
154
158
|
reject(new Error("获取文件URL超时(60秒)"));
|
|
155
159
|
}, 60000);
|
|
156
160
|
const handler = (event) => {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
4
|
+
import { logger } from "../utils/logger.js";
|
|
3
5
|
/**
|
|
4
6
|
* XY upload photo tool - uploads local photos to get publicly accessible URLs.
|
|
5
7
|
* Requires mediaUris from search_photo_gallery tool as prerequisite.
|
|
@@ -75,7 +77,8 @@ export function createUploadPhotoTool(ctx) {
|
|
|
75
77
|
// Get WebSocket manager
|
|
76
78
|
const wsManager = getXYWebSocketManager(config);
|
|
77
79
|
// Get public URLs for the photos
|
|
78
|
-
const
|
|
80
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
81
|
+
const imageUrls = await getPhotoUrls(wsManager, config, sessionId, currentTaskId, messageId, mediaUris);
|
|
79
82
|
return {
|
|
80
83
|
content: [
|
|
81
84
|
{
|
|
@@ -134,6 +137,7 @@ async function getPhotoUrls(wsManager, config, sessionId, taskId, messageId, med
|
|
|
134
137
|
return new Promise((resolve, reject) => {
|
|
135
138
|
const timeout = setTimeout(() => {
|
|
136
139
|
wsManager.off("data-event", handler);
|
|
140
|
+
logger.error("超时: 获取照片URL超时(60秒)", { sessionId });
|
|
137
141
|
reject(new Error("获取照片URL超时(60秒)"));
|
|
138
142
|
}, 60000);
|
|
139
143
|
const handler = (event) => {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
4
|
+
import { logger } from "../utils/logger.js";
|
|
3
5
|
import { XYFileUploadService } from "../file-upload.js";
|
|
4
6
|
/**
|
|
5
7
|
* Duck-typed ToolInputError: openclaw 按 .name 字段匹配,不用 instanceof。
|
|
@@ -143,6 +145,7 @@ export function createXiaoyiAddCollectionTool(ctx) {
|
|
|
143
145
|
return new Promise((resolve, reject) => {
|
|
144
146
|
const timeout = setTimeout(() => {
|
|
145
147
|
wsManager.off("data-event", handler);
|
|
148
|
+
logger.error("超时: 添加小艺收藏超时(60秒)", { sessionId, toolCallId });
|
|
146
149
|
reject(new Error("添加小艺收藏超时(60秒)"));
|
|
147
150
|
}, 60000);
|
|
148
151
|
// Listen for data events from WebSocket
|
|
@@ -168,10 +171,11 @@ export function createXiaoyiAddCollectionTool(ctx) {
|
|
|
168
171
|
// Register event handler
|
|
169
172
|
wsManager.on("data-event", handler);
|
|
170
173
|
// Send the command
|
|
174
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
171
175
|
sendCommand({
|
|
172
176
|
config,
|
|
173
177
|
sessionId,
|
|
174
|
-
taskId,
|
|
178
|
+
taskId: currentTaskId,
|
|
175
179
|
messageId,
|
|
176
180
|
command,
|
|
177
181
|
})
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
4
|
+
import { logger } from "../utils/logger.js";
|
|
3
5
|
/**
|
|
4
6
|
* Duck-typed ToolInputError: openclaw 按 .name 字段匹配,不用 instanceof。
|
|
5
7
|
* 抛出此错误会让 openclaw 返回 HTTP 400 而非 500,
|
|
@@ -98,6 +100,7 @@ export function createXiaoyiCollectionTool(ctx) {
|
|
|
98
100
|
return new Promise((resolve, reject) => {
|
|
99
101
|
const timeout = setTimeout(() => {
|
|
100
102
|
wsManager.off("data-event", handler);
|
|
103
|
+
logger.error("超时: 查询小艺收藏超时(60秒)", { sessionId, toolCallId });
|
|
101
104
|
reject(new Error("查询小艺收藏超时(60秒)"));
|
|
102
105
|
}, 60000);
|
|
103
106
|
// Listen for data events from WebSocket
|
|
@@ -124,10 +127,11 @@ export function createXiaoyiCollectionTool(ctx) {
|
|
|
124
127
|
// Register event handler
|
|
125
128
|
wsManager.on("data-event", handler);
|
|
126
129
|
// Send the command
|
|
130
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
127
131
|
sendCommand({
|
|
128
132
|
config,
|
|
129
133
|
sessionId,
|
|
130
|
-
taskId,
|
|
134
|
+
taskId: currentTaskId,
|
|
131
135
|
messageId,
|
|
132
136
|
command,
|
|
133
137
|
})
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
4
|
+
import { logger } from "../utils/logger.js";
|
|
3
5
|
/**
|
|
4
6
|
* Duck-typed ToolInputError: openclaw 按 .name 字段匹配,不用 instanceof。
|
|
5
7
|
* 抛出此错误会让 openclaw 返回 HTTP 400 而非 500,
|
|
@@ -114,6 +116,7 @@ export function createXiaoyiDeleteCollectionTool(ctx) {
|
|
|
114
116
|
return new Promise((resolve, reject) => {
|
|
115
117
|
const timeout = setTimeout(() => {
|
|
116
118
|
wsManager.off("data-event", handler);
|
|
119
|
+
logger.error("超时: 删除小艺收藏超时(60秒)", { sessionId, toolCallId });
|
|
117
120
|
reject(new Error("删除小艺收藏超时(60秒)"));
|
|
118
121
|
}, 60000);
|
|
119
122
|
// Listen for data events from WebSocket
|
|
@@ -139,10 +142,11 @@ export function createXiaoyiDeleteCollectionTool(ctx) {
|
|
|
139
142
|
// Register event handler
|
|
140
143
|
wsManager.on("data-event", handler);
|
|
141
144
|
// Send the command
|
|
145
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
142
146
|
sendCommand({
|
|
143
147
|
config,
|
|
144
148
|
sessionId,
|
|
145
|
-
taskId,
|
|
149
|
+
taskId: currentTaskId,
|
|
146
150
|
messageId,
|
|
147
151
|
command,
|
|
148
152
|
})
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { getXYWebSocketManager } from "../client.js";
|
|
3
3
|
import { sendCommand } from "../formatter.js";
|
|
4
4
|
import { getCurrentTaskId } from "../task-manager.js";
|
|
5
|
+
import { logger } from "../utils/logger.js";
|
|
5
6
|
/**
|
|
6
7
|
* XiaoYi GUI tool - executes phone app interactions through GUI agent.
|
|
7
8
|
* Simulates user interactions on phone screen (click, swipe, input, navigation, etc.)
|
|
@@ -63,6 +64,7 @@ export function createXiaoyiGuiTool(ctx) {
|
|
|
63
64
|
return new Promise((resolve, reject) => {
|
|
64
65
|
const timeout = setTimeout(() => {
|
|
65
66
|
wsManager.off("gui-agent-response", handler);
|
|
67
|
+
logger.error("超时: XiaoYi GUI Agent 操作超时(5分钟)", { sessionId, toolCallId });
|
|
66
68
|
reject(new Error("XiaoYi GUI Agent 操作超时(5分钟)"));
|
|
67
69
|
}, 180000); // 5 minutes timeout
|
|
68
70
|
// Listen for GUI agent response events
|
|
@@ -101,7 +103,7 @@ export function createXiaoyiGuiTool(ctx) {
|
|
|
101
103
|
sendCommand({
|
|
102
104
|
config,
|
|
103
105
|
sessionId,
|
|
104
|
-
taskId,
|
|
106
|
+
taskId: currentTaskId,
|
|
105
107
|
messageId,
|
|
106
108
|
command,
|
|
107
109
|
}).then(() => {
|