@ynhcj/xiaoyi-channel 0.0.22-beta → 0.0.22-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/index.js +42 -0
- package/dist/src/bot.js +123 -41
- package/dist/src/channel.js +17 -5
- package/dist/src/client.js +11 -24
- package/dist/src/config.js +2 -2
- package/dist/src/cspl/call-api.d.ts +3 -0
- package/dist/src/cspl/call-api.js +79 -0
- package/dist/src/cspl/config.d.ts +19 -0
- package/dist/src/cspl/config.js +50 -0
- package/dist/src/cspl/constants.d.ts +43 -0
- package/dist/src/cspl/constants.js +22 -0
- package/dist/src/cspl/utils.d.ts +10 -0
- package/dist/src/cspl/utils.js +57 -0
- package/dist/src/file-upload.d.ts +5 -0
- package/dist/src/file-upload.js +92 -0
- package/dist/src/formatter.d.ts +14 -0
- package/dist/src/formatter.js +46 -2
- package/dist/src/monitor.js +47 -5
- package/dist/src/outbound.js +52 -6
- package/dist/src/parser.d.ts +7 -0
- package/dist/src/parser.js +22 -0
- package/dist/src/push.d.ts +8 -1
- package/dist/src/push.js +30 -22
- package/dist/src/reply-dispatcher.d.ts +1 -0
- package/dist/src/reply-dispatcher.js +116 -101
- package/dist/src/steer-injector.d.ts +16 -0
- package/dist/src/steer-injector.js +74 -0
- package/dist/src/task-manager.d.ts +55 -0
- package/dist/src/task-manager.js +136 -0
- package/dist/src/tools/calendar-tool.js +5 -3
- package/dist/src/tools/call-phone-tool.d.ts +5 -0
- package/dist/src/tools/call-phone-tool.js +183 -0
- package/dist/src/tools/create-alarm-tool.d.ts +7 -0
- package/dist/src/tools/create-alarm-tool.js +420 -0
- package/dist/src/tools/delete-alarm-tool.d.ts +11 -0
- package/dist/src/tools/delete-alarm-tool.js +216 -0
- package/dist/src/tools/image-reading-tool.d.ts +5 -0
- package/dist/src/tools/image-reading-tool.js +375 -0
- package/dist/src/tools/location-tool.js +8 -11
- package/dist/src/tools/modify-alarm-tool.d.ts +9 -0
- package/dist/src/tools/modify-alarm-tool.js +439 -0
- package/dist/src/tools/modify-note-tool.js +4 -9
- package/dist/src/tools/note-tool.js +32 -21
- package/dist/src/tools/search-alarm-tool.d.ts +8 -0
- package/dist/src/tools/search-alarm-tool.js +343 -0
- package/dist/src/tools/search-calendar-tool.js +9 -46
- package/dist/src/tools/search-contact-tool.js +4 -27
- package/dist/src/tools/search-file-tool.d.ts +5 -0
- package/dist/src/tools/search-file-tool.js +161 -0
- package/dist/src/tools/search-message-tool.d.ts +5 -0
- package/dist/src/tools/search-message-tool.js +149 -0
- package/dist/src/tools/search-note-tool.js +29 -22
- package/dist/src/tools/search-photo-gallery-tool.js +51 -34
- package/dist/src/tools/send-file-to-user-tool.d.ts +5 -0
- package/dist/src/tools/send-file-to-user-tool.js +318 -0
- package/dist/src/tools/send-message-tool.d.ts +5 -0
- package/dist/src/tools/send-message-tool.js +176 -0
- package/dist/src/tools/session-manager.d.ts +15 -0
- package/dist/src/tools/session-manager.js +99 -18
- package/dist/src/tools/upload-file-tool.d.ts +13 -0
- package/dist/src/tools/upload-file-tool.js +265 -0
- package/dist/src/tools/upload-photo-tool.js +14 -4
- package/dist/src/tools/view-push-result-tool.d.ts +5 -0
- package/dist/src/tools/view-push-result-tool.js +118 -0
- package/dist/src/tools/xiaoyi-collection-tool.d.ts +5 -0
- package/dist/src/tools/xiaoyi-collection-tool.js +190 -0
- package/dist/src/tools/xiaoyi-gui-tool.js +8 -8
- package/dist/src/trigger-handler.d.ts +22 -0
- package/dist/src/trigger-handler.js +59 -0
- package/dist/src/types.d.ts +1 -8
- package/dist/src/types.js +4 -0
- package/dist/src/utils/pushdata-manager.d.ts +28 -0
- package/dist/src/utils/pushdata-manager.js +171 -0
- package/dist/src/utils/pushid-manager.d.ts +12 -0
- package/dist/src/utils/pushid-manager.js +105 -0
- package/dist/src/websocket.d.ts +25 -31
- package/dist/src/websocket.js +218 -270
- package/package.json +1 -1
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
import { getXYWebSocketManager } from "../client.js";
|
|
2
|
+
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentSessionContext } from "./session-manager.js";
|
|
4
|
+
import { logger } from "../utils/logger.js";
|
|
5
|
+
// Enum definitions for alarm search parameters
|
|
6
|
+
const RANGE_TYPE_VALUES = ["all", "next", "current"];
|
|
7
|
+
const ALARM_STATE_VALUES = [0, 1];
|
|
8
|
+
const DAYS_OF_WAKE_TYPE_VALUES = [0, 1, 2, 3, 4];
|
|
9
|
+
/**
|
|
10
|
+
* XY search alarm tool - searches alarms on user's device.
|
|
11
|
+
* Returns matching alarms based on various filter criteria.
|
|
12
|
+
*
|
|
13
|
+
* At least one search criterion must be provided.
|
|
14
|
+
* Multiple criteria can be combined.
|
|
15
|
+
*/
|
|
16
|
+
export const searchAlarmTool = {
|
|
17
|
+
name: "search_alarm",
|
|
18
|
+
label: "Search Alarm",
|
|
19
|
+
description: `检索用户设备上的闹钟。支持多种检索条件,至少需要提供一个检索条件,多个条件可以组合使用。
|
|
20
|
+
|
|
21
|
+
检索条件(至少提供一个):
|
|
22
|
+
- rangeType: 查询范围,枚举值:all=查询所有闹钟,next=查找下一个响铃闹钟,current=一小时内最近一次增查改的闹钟
|
|
23
|
+
- alarmState: 闹钟开启状态,0=关闭,1=开启
|
|
24
|
+
- daysOfWakeType: 闹钟响铃类型,0=单次响铃,1=法定节假日,2=每天,3=自定义时间,4=法定工作日
|
|
25
|
+
- startTime: 时间间隔开始,格式 YYYYMMDD hhmmss(例如:20240315 000000),需要与 endTime 一起使用
|
|
26
|
+
- endTime: 时间间隔结束,格式 YYYYMMDD hhmmss(例如:20240315 235959),需要与 startTime 一起使用
|
|
27
|
+
|
|
28
|
+
使用示例:
|
|
29
|
+
- 查询所有闹钟:{"rangeType": "all"}
|
|
30
|
+
- 查询已开启的闹钟:{"alarmState": 1}
|
|
31
|
+
- 查询每天响铃的闹钟:{"daysOfWakeType": 2}
|
|
32
|
+
- 查询某个时间段的闹钟:{"startTime": "20240315 000000", "endTime": "20240315 235959"}
|
|
33
|
+
|
|
34
|
+
注意:
|
|
35
|
+
a. 操作超时时间为60秒,请勿重复调用此工具,如果超时或失败,最多重试一次。
|
|
36
|
+
b. 使用该工具之前需获取当前真实时间`,
|
|
37
|
+
parameters: {
|
|
38
|
+
type: "object",
|
|
39
|
+
properties: {
|
|
40
|
+
rangeType: {
|
|
41
|
+
type: "string",
|
|
42
|
+
enum: ["all", "next", "current"],
|
|
43
|
+
description: "查询范围:all=所有闹钟,next=下一个响铃闹钟,current=一小时内最近修改的闹钟",
|
|
44
|
+
},
|
|
45
|
+
alarmState: {
|
|
46
|
+
type: "number",
|
|
47
|
+
enum: [0, 1],
|
|
48
|
+
description: "闹钟开启状态:0=关闭,1=开启",
|
|
49
|
+
},
|
|
50
|
+
daysOfWakeType: {
|
|
51
|
+
type: "number",
|
|
52
|
+
enum: [0, 1, 2, 3, 4],
|
|
53
|
+
description: "闹钟响铃类型:0=单次,1=法定节假日,2=每天,3=自定义,4=法定工作日",
|
|
54
|
+
},
|
|
55
|
+
startTime: {
|
|
56
|
+
type: "string",
|
|
57
|
+
description: "时间间隔开始,格式 YYYYMMDD hhmmss(例如:20240315 000000),必须与 endTime 一起使用",
|
|
58
|
+
},
|
|
59
|
+
endTime: {
|
|
60
|
+
type: "string",
|
|
61
|
+
description: "时间间隔结束,格式 YYYYMMDD hhmmss(例如:20240315 235959),必须与 startTime 一起使用",
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
async execute(toolCallId, params) {
|
|
66
|
+
logger.log(`[SEARCH_ALARM_TOOL] 🚀 Starting execution`);
|
|
67
|
+
logger.log(`[SEARCH_ALARM_TOOL] - toolCallId: ${toolCallId}`);
|
|
68
|
+
logger.log(`[SEARCH_ALARM_TOOL] - params:`, JSON.stringify(params));
|
|
69
|
+
logger.log(`[SEARCH_ALARM_TOOL] - timestamp: ${new Date().toISOString()}`);
|
|
70
|
+
// ===== Validate at least one search criterion is provided =====
|
|
71
|
+
const hasRangeType = params.rangeType !== undefined && params.rangeType !== null;
|
|
72
|
+
const hasAlarmState = params.alarmState !== undefined && params.alarmState !== null;
|
|
73
|
+
const hasDaysOfWakeType = params.daysOfWakeType !== undefined && params.daysOfWakeType !== null;
|
|
74
|
+
const hasStartTime = params.startTime !== undefined && params.startTime !== null;
|
|
75
|
+
const hasEndTime = params.endTime !== undefined && params.endTime !== null;
|
|
76
|
+
if (!hasRangeType && !hasAlarmState && !hasDaysOfWakeType && !hasStartTime && !hasEndTime) {
|
|
77
|
+
logger.error(`[SEARCH_ALARM_TOOL] ❌ No search criteria provided`);
|
|
78
|
+
throw new Error("至少需要提供一个检索条件:rangeType、alarmState、daysOfWakeType 或时间范围(startTime + endTime)");
|
|
79
|
+
}
|
|
80
|
+
// ===== Validate rangeType =====
|
|
81
|
+
if (hasRangeType) {
|
|
82
|
+
if (typeof params.rangeType !== "string") {
|
|
83
|
+
logger.error(`[SEARCH_ALARM_TOOL] ❌ Invalid rangeType type`);
|
|
84
|
+
throw new Error("rangeType must be a string");
|
|
85
|
+
}
|
|
86
|
+
if (!RANGE_TYPE_VALUES.includes(params.rangeType)) {
|
|
87
|
+
logger.error(`[SEARCH_ALARM_TOOL] ❌ Invalid rangeType value: ${params.rangeType}`);
|
|
88
|
+
throw new Error(`rangeType must be one of: ${RANGE_TYPE_VALUES.join(", ")}`);
|
|
89
|
+
}
|
|
90
|
+
logger.log(`[SEARCH_ALARM_TOOL] - rangeType: ${params.rangeType}`);
|
|
91
|
+
}
|
|
92
|
+
// ===== Validate alarmState =====
|
|
93
|
+
if (hasAlarmState) {
|
|
94
|
+
if (typeof params.alarmState !== "number") {
|
|
95
|
+
logger.error(`[SEARCH_ALARM_TOOL] ❌ Invalid alarmState type`);
|
|
96
|
+
throw new Error("alarmState must be a number");
|
|
97
|
+
}
|
|
98
|
+
if (!ALARM_STATE_VALUES.includes(params.alarmState)) {
|
|
99
|
+
logger.error(`[SEARCH_ALARM_TOOL] ❌ Invalid alarmState value: ${params.alarmState}`);
|
|
100
|
+
throw new Error(`alarmState must be one of: ${ALARM_STATE_VALUES.join(", ")}`);
|
|
101
|
+
}
|
|
102
|
+
logger.log(`[SEARCH_ALARM_TOOL] - alarmState: ${params.alarmState}`);
|
|
103
|
+
}
|
|
104
|
+
// ===== Validate daysOfWakeType =====
|
|
105
|
+
if (hasDaysOfWakeType) {
|
|
106
|
+
if (typeof params.daysOfWakeType !== "number") {
|
|
107
|
+
logger.error(`[SEARCH_ALARM_TOOL] ❌ Invalid daysOfWakeType type`);
|
|
108
|
+
throw new Error("daysOfWakeType must be a number");
|
|
109
|
+
}
|
|
110
|
+
if (!DAYS_OF_WAKE_TYPE_VALUES.includes(params.daysOfWakeType)) {
|
|
111
|
+
logger.error(`[SEARCH_ALARM_TOOL] ❌ Invalid daysOfWakeType value: ${params.daysOfWakeType}`);
|
|
112
|
+
throw new Error(`daysOfWakeType must be one of: ${DAYS_OF_WAKE_TYPE_VALUES.join(", ")}`);
|
|
113
|
+
}
|
|
114
|
+
logger.log(`[SEARCH_ALARM_TOOL] - daysOfWakeType: ${params.daysOfWakeType}`);
|
|
115
|
+
}
|
|
116
|
+
// ===== Validate time interval (startTime and endTime must be provided together) =====
|
|
117
|
+
if (hasStartTime !== hasEndTime) {
|
|
118
|
+
logger.error(`[SEARCH_ALARM_TOOL] ❌ startTime and endTime must be provided together`);
|
|
119
|
+
throw new Error("startTime 和 endTime 必须一起提供");
|
|
120
|
+
}
|
|
121
|
+
let timeInterval = null;
|
|
122
|
+
if (hasStartTime && hasEndTime) {
|
|
123
|
+
// Parse and convert startTime and endTime to timestamps
|
|
124
|
+
logger.log(`[SEARCH_ALARM_TOOL] 🕒 Parsing time interval...`);
|
|
125
|
+
logger.log(`[SEARCH_ALARM_TOOL] - startTime input: ${params.startTime}`);
|
|
126
|
+
logger.log(`[SEARCH_ALARM_TOOL] - endTime input: ${params.endTime}`);
|
|
127
|
+
const startTimeMs = parseAlarmTimeToTimestamp(params.startTime);
|
|
128
|
+
const endTimeMs = parseAlarmTimeToTimestamp(params.endTime);
|
|
129
|
+
if (startTimeMs === null) {
|
|
130
|
+
logger.error(`[SEARCH_ALARM_TOOL] ❌ Invalid startTime format`);
|
|
131
|
+
throw new Error("Invalid startTime format. Required format: YYYYMMDD hhmmss (e.g., 20240315 000000)");
|
|
132
|
+
}
|
|
133
|
+
if (endTimeMs === null) {
|
|
134
|
+
logger.error(`[SEARCH_ALARM_TOOL] ❌ Invalid endTime format`);
|
|
135
|
+
throw new Error("Invalid endTime format. Required format: YYYYMMDD hhmmss (e.g., 20240315 235959)");
|
|
136
|
+
}
|
|
137
|
+
if (startTimeMs >= endTimeMs) {
|
|
138
|
+
logger.error(`[SEARCH_ALARM_TOOL] ❌ startTime must be before endTime`);
|
|
139
|
+
throw new Error("startTime 必须早于 endTime");
|
|
140
|
+
}
|
|
141
|
+
timeInterval = [startTimeMs, endTimeMs];
|
|
142
|
+
logger.log(`[SEARCH_ALARM_TOOL] ✅ Time interval parsed: [${startTimeMs}, ${endTimeMs}]`);
|
|
143
|
+
}
|
|
144
|
+
// Get session context
|
|
145
|
+
logger.log(`[SEARCH_ALARM_TOOL] 🔍 Attempting to get session context...`);
|
|
146
|
+
const sessionContext = getCurrentSessionContext();
|
|
147
|
+
if (!sessionContext) {
|
|
148
|
+
logger.error(`[SEARCH_ALARM_TOOL] ❌ FAILED: No active session found!`);
|
|
149
|
+
logger.error(`[SEARCH_ALARM_TOOL] - toolCallId: ${toolCallId}`);
|
|
150
|
+
throw new Error("No active XY session found. Search alarm tool can only be used during an active conversation.");
|
|
151
|
+
}
|
|
152
|
+
logger.log(`[SEARCH_ALARM_TOOL] ✅ Session context found`);
|
|
153
|
+
logger.log(`[SEARCH_ALARM_TOOL] - sessionId: ${sessionContext.sessionId}`);
|
|
154
|
+
logger.log(`[SEARCH_ALARM_TOOL] - taskId: ${sessionContext.taskId}`);
|
|
155
|
+
logger.log(`[SEARCH_ALARM_TOOL] - messageId: ${sessionContext.messageId}`);
|
|
156
|
+
const { config, sessionId, taskId, messageId } = sessionContext;
|
|
157
|
+
// Get WebSocket manager
|
|
158
|
+
logger.log(`[SEARCH_ALARM_TOOL] 🔌 Getting WebSocket manager...`);
|
|
159
|
+
const wsManager = getXYWebSocketManager(config);
|
|
160
|
+
logger.log(`[SEARCH_ALARM_TOOL] ✅ WebSocket manager obtained`);
|
|
161
|
+
// Build SearchAlarm command
|
|
162
|
+
logger.log(`[SEARCH_ALARM_TOOL] 📦 Building SearchAlarm command...`);
|
|
163
|
+
// Build intentParam with provided search criteria
|
|
164
|
+
const intentParam = {};
|
|
165
|
+
if (hasRangeType) {
|
|
166
|
+
intentParam.rangeType = params.rangeType;
|
|
167
|
+
}
|
|
168
|
+
if (hasAlarmState) {
|
|
169
|
+
intentParam.alarmState = params.alarmState;
|
|
170
|
+
}
|
|
171
|
+
if (hasDaysOfWakeType) {
|
|
172
|
+
intentParam.daysOfWakeType = params.daysOfWakeType;
|
|
173
|
+
}
|
|
174
|
+
if (timeInterval) {
|
|
175
|
+
intentParam.timeInterval = timeInterval;
|
|
176
|
+
}
|
|
177
|
+
const command = {
|
|
178
|
+
header: {
|
|
179
|
+
namespace: "Common",
|
|
180
|
+
name: "Action",
|
|
181
|
+
},
|
|
182
|
+
payload: {
|
|
183
|
+
cardParam: {},
|
|
184
|
+
executeParam: {
|
|
185
|
+
executeMode: "background",
|
|
186
|
+
intentName: "SearchAlarm",
|
|
187
|
+
bundleName: "com.huawei.hmos.clock",
|
|
188
|
+
needUnlock: true,
|
|
189
|
+
actionResponse: true,
|
|
190
|
+
appType: "OHOS_APP",
|
|
191
|
+
timeOut: 5,
|
|
192
|
+
intentParam,
|
|
193
|
+
permissionId: [],
|
|
194
|
+
achieveType: "INTENT",
|
|
195
|
+
},
|
|
196
|
+
responses: [
|
|
197
|
+
{
|
|
198
|
+
resultCode: "",
|
|
199
|
+
displayText: "",
|
|
200
|
+
ttsText: "",
|
|
201
|
+
},
|
|
202
|
+
],
|
|
203
|
+
needUploadResult: true,
|
|
204
|
+
noHalfPage: false,
|
|
205
|
+
pageControlRelated: false,
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
// Send command and wait for response (60 second timeout)
|
|
209
|
+
logger.log(`[SEARCH_ALARM_TOOL] ⏳ Setting up promise to wait for alarm search response...`);
|
|
210
|
+
logger.log(`[SEARCH_ALARM_TOOL] - Timeout: 60 seconds`);
|
|
211
|
+
return new Promise((resolve, reject) => {
|
|
212
|
+
const timeout = setTimeout(() => {
|
|
213
|
+
logger.error(`[SEARCH_ALARM_TOOL] ⏰ Timeout: No response received within 60 seconds`);
|
|
214
|
+
wsManager.off("data-event", handler);
|
|
215
|
+
reject(new Error("检索闹钟超时(60秒)"));
|
|
216
|
+
}, 60000);
|
|
217
|
+
// Listen for data events from WebSocket
|
|
218
|
+
const handler = (event) => {
|
|
219
|
+
logger.log(`[SEARCH_ALARM_TOOL] 📨 Received data event:`, JSON.stringify(event));
|
|
220
|
+
if (event.intentName === "SearchAlarm") {
|
|
221
|
+
logger.log(`[SEARCH_ALARM_TOOL] 🎯 SearchAlarm event received`);
|
|
222
|
+
logger.log(`[SEARCH_ALARM_TOOL] - status: ${event.status}`);
|
|
223
|
+
clearTimeout(timeout);
|
|
224
|
+
wsManager.off("data-event", handler);
|
|
225
|
+
if (event.status === "success" && event.outputs) {
|
|
226
|
+
logger.log(`[SEARCH_ALARM_TOOL] ✅ Alarm search completed successfully`);
|
|
227
|
+
logger.log(`[SEARCH_ALARM_TOOL] - outputs:`, JSON.stringify(event.outputs));
|
|
228
|
+
// 成功,直接返回完整的 event.outputs JSON 字符串
|
|
229
|
+
resolve({
|
|
230
|
+
content: [
|
|
231
|
+
{
|
|
232
|
+
type: "text",
|
|
233
|
+
text: JSON.stringify(event.outputs),
|
|
234
|
+
},
|
|
235
|
+
],
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
logger.error(`[SEARCH_ALARM_TOOL] ❌ Alarm search failed`);
|
|
240
|
+
logger.error(`[SEARCH_ALARM_TOOL] - status: ${event.status}`);
|
|
241
|
+
logger.error(`[SEARCH_ALARM_TOOL] - outputs:`, JSON.stringify(event.outputs || {}));
|
|
242
|
+
reject(new Error(`检索闹钟失败: ${event.status}`));
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
// Register event handler
|
|
247
|
+
logger.log(`[SEARCH_ALARM_TOOL] 📡 Registering data-event handler on WebSocket manager`);
|
|
248
|
+
wsManager.on("data-event", handler);
|
|
249
|
+
// Send the command
|
|
250
|
+
logger.log(`[SEARCH_ALARM_TOOL] 📤 Sending SearchAlarm command...`);
|
|
251
|
+
sendCommand({
|
|
252
|
+
config,
|
|
253
|
+
sessionId,
|
|
254
|
+
taskId,
|
|
255
|
+
messageId,
|
|
256
|
+
command,
|
|
257
|
+
})
|
|
258
|
+
.then(() => {
|
|
259
|
+
logger.log(`[SEARCH_ALARM_TOOL] ✅ Command sent successfully, waiting for response...`);
|
|
260
|
+
})
|
|
261
|
+
.catch((error) => {
|
|
262
|
+
logger.error(`[SEARCH_ALARM_TOOL] ❌ Failed to send command:`, error);
|
|
263
|
+
clearTimeout(timeout);
|
|
264
|
+
wsManager.off("data-event", handler);
|
|
265
|
+
reject(error);
|
|
266
|
+
});
|
|
267
|
+
});
|
|
268
|
+
},
|
|
269
|
+
};
|
|
270
|
+
/**
|
|
271
|
+
* Parse alarmTime string (YYYYMMDD hhmmss) to timestamp in milliseconds
|
|
272
|
+
* @param alarmTime - Time string in format "YYYYMMDD hhmmss" (e.g., "20240315 143000")
|
|
273
|
+
* @returns Timestamp in milliseconds, or null if parsing fails
|
|
274
|
+
*/
|
|
275
|
+
function parseAlarmTimeToTimestamp(alarmTime) {
|
|
276
|
+
try {
|
|
277
|
+
// Expected format: YYYYMMDD hhmmss
|
|
278
|
+
// Example: 20240315 143000
|
|
279
|
+
const trimmed = alarmTime.trim();
|
|
280
|
+
// Check basic format (should have at least 13 characters: YYYYMMDD hhmmss)
|
|
281
|
+
if (trimmed.length < 13) {
|
|
282
|
+
logger.error(`[SEARCH_ALARM_TOOL] ❌ alarmTime too short: ${trimmed}`);
|
|
283
|
+
return null;
|
|
284
|
+
}
|
|
285
|
+
// Extract date and time parts
|
|
286
|
+
// Format: YYYYMMDD hhmmss
|
|
287
|
+
const datePart = trimmed.substring(0, 8); // YYYYMMDD
|
|
288
|
+
const timePart = trimmed.substring(8).trim(); // hhmmss (may have leading space)
|
|
289
|
+
logger.log(`[SEARCH_ALARM_TOOL] - datePart: ${datePart}, timePart: ${timePart}`);
|
|
290
|
+
// Validate lengths
|
|
291
|
+
if (datePart.length !== 8 || timePart.length !== 6) {
|
|
292
|
+
logger.error(`[SEARCH_ALARM_TOOL] ❌ Invalid part lengths: datePart=${datePart.length}, timePart=${timePart.length}`);
|
|
293
|
+
return null;
|
|
294
|
+
}
|
|
295
|
+
// Parse components
|
|
296
|
+
const year = parseInt(datePart.substring(0, 4), 10);
|
|
297
|
+
const month = parseInt(datePart.substring(4, 6), 10);
|
|
298
|
+
const day = parseInt(datePart.substring(6, 8), 10);
|
|
299
|
+
const hour = parseInt(timePart.substring(0, 2), 10);
|
|
300
|
+
const minute = parseInt(timePart.substring(2, 4), 10);
|
|
301
|
+
const second = parseInt(timePart.substring(4, 6), 10);
|
|
302
|
+
logger.log(`[SEARCH_ALARM_TOOL] - Parsed: ${year}-${month}-${day} ${hour}:${minute}:${second}`);
|
|
303
|
+
// Validate values
|
|
304
|
+
if (isNaN(year) || isNaN(month) || isNaN(day) ||
|
|
305
|
+
isNaN(hour) || isNaN(minute) || isNaN(second)) {
|
|
306
|
+
logger.error(`[SEARCH_ALARM_TOOL] ❌ NaN detected in parsed values`);
|
|
307
|
+
return null;
|
|
308
|
+
}
|
|
309
|
+
// Validate ranges
|
|
310
|
+
if (month < 1 || month > 12) {
|
|
311
|
+
logger.error(`[SEARCH_ALARM_TOOL] ❌ Invalid month: ${month}`);
|
|
312
|
+
return null;
|
|
313
|
+
}
|
|
314
|
+
if (day < 1 || day > 31) {
|
|
315
|
+
logger.error(`[SEARCH_ALARM_TOOL] ❌ Invalid day: ${day}`);
|
|
316
|
+
return null;
|
|
317
|
+
}
|
|
318
|
+
if (hour < 0 || hour > 23) {
|
|
319
|
+
logger.error(`[SEARCH_ALARM_TOOL] ❌ Invalid hour: ${hour}`);
|
|
320
|
+
return null;
|
|
321
|
+
}
|
|
322
|
+
if (minute < 0 || minute > 59) {
|
|
323
|
+
logger.error(`[SEARCH_ALARM_TOOL] ❌ Invalid minute: ${minute}`);
|
|
324
|
+
return null;
|
|
325
|
+
}
|
|
326
|
+
if (second < 0 || second > 59) {
|
|
327
|
+
logger.error(`[SEARCH_ALARM_TOOL] ❌ Invalid second: ${second}`);
|
|
328
|
+
return null;
|
|
329
|
+
}
|
|
330
|
+
// Create Date object and get timestamp
|
|
331
|
+
const date = new Date(year, month - 1, day, hour, minute, second);
|
|
332
|
+
const timestamp = date.getTime();
|
|
333
|
+
if (isNaN(timestamp)) {
|
|
334
|
+
logger.error(`[SEARCH_ALARM_TOOL] ❌ Generated timestamp is NaN`);
|
|
335
|
+
return null;
|
|
336
|
+
}
|
|
337
|
+
return timestamp;
|
|
338
|
+
}
|
|
339
|
+
catch (error) {
|
|
340
|
+
logger.error(`[SEARCH_ALARM_TOOL] ❌ Exception in parseAlarmTimeToTimestamp:`, error);
|
|
341
|
+
return null;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
-
import {
|
|
3
|
+
import { getCurrentSessionContext } from "./session-manager.js";
|
|
4
4
|
import { logger } from "../utils/logger.js";
|
|
5
5
|
/**
|
|
6
6
|
* XY search calendar event tool - searches calendar events on user's device.
|
|
@@ -25,7 +25,10 @@ export const searchCalendarTool = {
|
|
|
25
25
|
- 查询晚上的日程:使用 18:00:00 到 23:59:59
|
|
26
26
|
- 查询某个时刻附近的日程:使用该时刻前后1小时的区间(例如:查询3点左右的日程,使用 14:00:00 到 16:00:00)
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
注意:
|
|
29
|
+
a. 该工具执行时间较长(最多60秒),请勿重复调用,超时或失败时最多重试一次。
|
|
30
|
+
b. 使用该工具之前需获取当前真实时间
|
|
31
|
+
`,
|
|
29
32
|
parameters: {
|
|
30
33
|
type: "object",
|
|
31
34
|
properties: {
|
|
@@ -80,17 +83,6 @@ export const searchCalendarTool = {
|
|
|
80
83
|
const date = new Date(year, month, day, hours, minutes, seconds);
|
|
81
84
|
return date.getTime();
|
|
82
85
|
};
|
|
83
|
-
// Helper function to convert timestamp to YYYYMMDD hhmmss format
|
|
84
|
-
const formatTimestamp = (timestamp) => {
|
|
85
|
-
const date = new Date(timestamp);
|
|
86
|
-
const year = date.getFullYear();
|
|
87
|
-
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
88
|
-
const day = String(date.getDate()).padStart(2, '0');
|
|
89
|
-
const hours = String(date.getHours()).padStart(2, '0');
|
|
90
|
-
const minutes = String(date.getMinutes()).padStart(2, '0');
|
|
91
|
-
const seconds = String(date.getSeconds()).padStart(2, '0');
|
|
92
|
-
return `${year}${month}${day} ${hours}${minutes}${seconds}`;
|
|
93
|
-
};
|
|
94
86
|
let startTimeMs;
|
|
95
87
|
let endTimeMs;
|
|
96
88
|
try {
|
|
@@ -110,7 +102,7 @@ export const searchCalendarTool = {
|
|
|
110
102
|
logger.log(`[SEARCH_CALENDAR_TOOL] - endTime timestamp: ${endTimeMs}`);
|
|
111
103
|
// Get session context
|
|
112
104
|
logger.log(`[SEARCH_CALENDAR_TOOL] 🔍 Attempting to get session context...`);
|
|
113
|
-
const sessionContext =
|
|
105
|
+
const sessionContext = getCurrentSessionContext();
|
|
114
106
|
if (!sessionContext) {
|
|
115
107
|
logger.error(`[SEARCH_CALENDAR_TOOL] ❌ FAILED: No active session found!`);
|
|
116
108
|
logger.error(`[SEARCH_CALENDAR_TOOL] - toolCallId: ${toolCallId}`);
|
|
@@ -185,43 +177,14 @@ export const searchCalendarTool = {
|
|
|
185
177
|
clearTimeout(timeout);
|
|
186
178
|
wsManager.off("data-event", handler);
|
|
187
179
|
if (event.status === "success" && event.outputs) {
|
|
188
|
-
logger.log(`[SEARCH_CALENDAR_TOOL] ✅ Calendar events
|
|
180
|
+
logger.log(`[SEARCH_CALENDAR_TOOL] ✅ Calendar events retrieved successfully`);
|
|
189
181
|
logger.log(`[SEARCH_CALENDAR_TOOL] - outputs:`, JSON.stringify(event.outputs));
|
|
190
|
-
//
|
|
191
|
-
if (event.outputs.retErrCode && event.outputs.retErrCode !== "0") {
|
|
192
|
-
logger.error(`[SEARCH_CALENDAR_TOOL] ❌ Device returned error`);
|
|
193
|
-
logger.error(`[SEARCH_CALENDAR_TOOL] - retErrCode: ${event.outputs.retErrCode}`);
|
|
194
|
-
logger.error(`[SEARCH_CALENDAR_TOOL] - errMsg: ${event.outputs.errMsg || "Unknown error"}`);
|
|
195
|
-
reject(new Error(`检索日程失败: ${event.outputs.errMsg || "未知错误"} (错误代码: ${event.outputs.retErrCode})`));
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
// Return the result directly as requested
|
|
199
|
-
const result = event.outputs.result;
|
|
200
|
-
// Ensure result is not undefined
|
|
201
|
-
if (result === undefined) {
|
|
202
|
-
logger.warn(`[SEARCH_CALENDAR_TOOL] ⚠️ Result is undefined, returning empty result`);
|
|
203
|
-
}
|
|
204
|
-
// Convert dtStart and dtEnd from timestamps to YYYYMMDD hhmmss format
|
|
205
|
-
if (result && result.items && Array.isArray(result.items)) {
|
|
206
|
-
logger.log(`[SEARCH_CALENDAR_TOOL] 🔄 Converting timestamps to formatted dates...`);
|
|
207
|
-
result.items = result.items.map((item) => {
|
|
208
|
-
const formattedItem = { ...item };
|
|
209
|
-
if (item.dtStart) {
|
|
210
|
-
formattedItem.dtStart = formatTimestamp(item.dtStart);
|
|
211
|
-
logger.log(`[SEARCH_CALENDAR_TOOL] - dtStart: ${item.dtStart} -> ${formattedItem.dtStart}`);
|
|
212
|
-
}
|
|
213
|
-
if (item.dtEnd) {
|
|
214
|
-
formattedItem.dtEnd = formatTimestamp(item.dtEnd);
|
|
215
|
-
logger.log(`[SEARCH_CALENDAR_TOOL] - dtEnd: ${item.dtEnd} -> ${formattedItem.dtEnd}`);
|
|
216
|
-
}
|
|
217
|
-
return formattedItem;
|
|
218
|
-
});
|
|
219
|
-
}
|
|
182
|
+
// 成功,直接返回完整的 event.outputs JSON 字符串
|
|
220
183
|
resolve({
|
|
221
184
|
content: [
|
|
222
185
|
{
|
|
223
186
|
type: "text",
|
|
224
|
-
text:
|
|
187
|
+
text: JSON.stringify(event.outputs),
|
|
225
188
|
},
|
|
226
189
|
],
|
|
227
190
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
-
import {
|
|
3
|
+
import { getCurrentSessionContext } from "./session-manager.js";
|
|
4
4
|
import { logger } from "../utils/logger.js";
|
|
5
5
|
/**
|
|
6
6
|
* XY search contact tool - searches contacts on user's device.
|
|
@@ -32,7 +32,7 @@ export const searchContactTool = {
|
|
|
32
32
|
}
|
|
33
33
|
// Get session context
|
|
34
34
|
logger.log(`[SEARCH_CONTACT_TOOL] 🔍 Attempting to get session context...`);
|
|
35
|
-
const sessionContext =
|
|
35
|
+
const sessionContext = getCurrentSessionContext();
|
|
36
36
|
if (!sessionContext) {
|
|
37
37
|
logger.error(`[SEARCH_CONTACT_TOOL] ❌ FAILED: No active session found!`);
|
|
38
38
|
logger.error(`[SEARCH_CONTACT_TOOL] - toolCallId: ${toolCallId}`);
|
|
@@ -102,35 +102,12 @@ export const searchContactTool = {
|
|
|
102
102
|
if (event.status === "success" && event.outputs) {
|
|
103
103
|
logger.log(`[SEARCH_CONTACT_TOOL] ✅ Contact search completed successfully`);
|
|
104
104
|
logger.log(`[SEARCH_CONTACT_TOOL] - outputs:`, JSON.stringify(event.outputs));
|
|
105
|
-
//
|
|
106
|
-
if (event.outputs.retErrCode && event.outputs.retErrCode !== "0") {
|
|
107
|
-
logger.error(`[SEARCH_CONTACT_TOOL] ❌ Search failed with error code: ${event.outputs.retErrCode}`);
|
|
108
|
-
logger.error(`[SEARCH_CONTACT_TOOL] - errMsg: ${event.outputs.errMsg}`);
|
|
109
|
-
reject(new Error(`搜索联系人失败: ${event.outputs.errMsg || '未知错误'} (错误码: ${event.outputs.retErrCode})`));
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
// Get the result
|
|
113
|
-
const result = event.outputs.result;
|
|
114
|
-
// Check if result exists
|
|
115
|
-
if (!result) {
|
|
116
|
-
logger.warn(`[SEARCH_CONTACT_TOOL] ⚠️ No result found for name "${params.name}"`);
|
|
117
|
-
resolve({
|
|
118
|
-
content: [
|
|
119
|
-
{
|
|
120
|
-
type: "text",
|
|
121
|
-
text: JSON.stringify({ items: [], message: "未找到匹配的联系人" }),
|
|
122
|
-
},
|
|
123
|
-
],
|
|
124
|
-
});
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
logger.log(`[SEARCH_CONTACT_TOOL] 📊 Contacts found: ${result?.items?.length || 0} results for name "${params.name}"`);
|
|
128
|
-
// Return the result with valid string content
|
|
105
|
+
// 成功,直接返回完整的 event.outputs JSON 字符串
|
|
129
106
|
resolve({
|
|
130
107
|
content: [
|
|
131
108
|
{
|
|
132
109
|
type: "text",
|
|
133
|
-
text: JSON.stringify(
|
|
110
|
+
text: JSON.stringify(event.outputs),
|
|
134
111
|
},
|
|
135
112
|
],
|
|
136
113
|
});
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { getXYWebSocketManager } from "../client.js";
|
|
2
|
+
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentSessionContext } from "./session-manager.js";
|
|
4
|
+
import { logger } from "../utils/logger.js";
|
|
5
|
+
/**
|
|
6
|
+
* XY search file tool - searches files on user's device file system.
|
|
7
|
+
* Returns matching files based on keyword search in file name or content.
|
|
8
|
+
*/
|
|
9
|
+
export const searchFileTool = {
|
|
10
|
+
name: "search_file",
|
|
11
|
+
label: "Search File",
|
|
12
|
+
description: `搜索手机文件系统的文件。
|
|
13
|
+
|
|
14
|
+
【重要】使用约束:此工具仅在用户显著说明要从手机搜索时才执行,例如:
|
|
15
|
+
- "从我手机里面搜索xxxx"
|
|
16
|
+
- "从手机文件系统找一下xxxx"
|
|
17
|
+
- "在手机上查找文件xxxx"
|
|
18
|
+
- "搜索手机里的文件"
|
|
19
|
+
|
|
20
|
+
如果用户没有明确说明从手机搜索(如仅说"搜索文件"、"找一下xxxx"),应默认从 openclaw 本地的文件系统查询,不要调用此工具。
|
|
21
|
+
|
|
22
|
+
功能说明:根据关键词搜索文件名称或内容,返回匹配的文件列表(包括文件名、路径、大小、修改时间等信息)。
|
|
23
|
+
|
|
24
|
+
注意事项:操作超时时间为60秒,请勿重复调用此工具,如果超时或失败,最多重试一次。`,
|
|
25
|
+
parameters: {
|
|
26
|
+
type: "object",
|
|
27
|
+
properties: {
|
|
28
|
+
query: {
|
|
29
|
+
type: "string",
|
|
30
|
+
description: "搜索关键词,用于匹配文件名称、后缀名或文件内容",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
required: ["query"],
|
|
34
|
+
},
|
|
35
|
+
async execute(toolCallId, params) {
|
|
36
|
+
logger.log(`[SEARCH_FILE_TOOL] 🚀 Starting execution`);
|
|
37
|
+
logger.log(`[SEARCH_FILE_TOOL] - toolCallId: ${toolCallId}`);
|
|
38
|
+
logger.log(`[SEARCH_FILE_TOOL] - params:`, JSON.stringify(params));
|
|
39
|
+
logger.log(`[SEARCH_FILE_TOOL] - timestamp: ${new Date().toISOString()}`);
|
|
40
|
+
// Validate query parameter
|
|
41
|
+
if (!params.query || typeof params.query !== "string" || params.query.trim() === "") {
|
|
42
|
+
logger.error(`[SEARCH_FILE_TOOL] ❌ Missing or invalid query parameter`);
|
|
43
|
+
throw new Error("Missing required parameter: query must be a non-empty string");
|
|
44
|
+
}
|
|
45
|
+
logger.log(`[SEARCH_FILE_TOOL] 🔍 Searching for files with keyword: ${params.query}`);
|
|
46
|
+
// Get session context
|
|
47
|
+
logger.log(`[SEARCH_FILE_TOOL] 🔍 Attempting to get session context...`);
|
|
48
|
+
const sessionContext = getCurrentSessionContext();
|
|
49
|
+
if (!sessionContext) {
|
|
50
|
+
logger.error(`[SEARCH_FILE_TOOL] ❌ FAILED: No active session found!`);
|
|
51
|
+
logger.error(`[SEARCH_FILE_TOOL] - toolCallId: ${toolCallId}`);
|
|
52
|
+
throw new Error("No active XY session found. Search file tool can only be used during an active conversation.");
|
|
53
|
+
}
|
|
54
|
+
logger.log(`[SEARCH_FILE_TOOL] ✅ Session context found`);
|
|
55
|
+
logger.log(`[SEARCH_FILE_TOOL] - sessionId: ${sessionContext.sessionId}`);
|
|
56
|
+
logger.log(`[SEARCH_FILE_TOOL] - taskId: ${sessionContext.taskId}`);
|
|
57
|
+
logger.log(`[SEARCH_FILE_TOOL] - messageId: ${sessionContext.messageId}`);
|
|
58
|
+
const { config, sessionId, taskId, messageId } = sessionContext;
|
|
59
|
+
// Get WebSocket manager
|
|
60
|
+
logger.log(`[SEARCH_FILE_TOOL] 🔌 Getting WebSocket manager...`);
|
|
61
|
+
const wsManager = getXYWebSocketManager(config);
|
|
62
|
+
logger.log(`[SEARCH_FILE_TOOL] ✅ WebSocket manager obtained`);
|
|
63
|
+
// Build SearchFile command
|
|
64
|
+
logger.log(`[SEARCH_FILE_TOOL] 📦 Building SearchFile command...`);
|
|
65
|
+
const command = {
|
|
66
|
+
header: {
|
|
67
|
+
namespace: "Common",
|
|
68
|
+
name: "Action",
|
|
69
|
+
},
|
|
70
|
+
payload: {
|
|
71
|
+
cardParam: {},
|
|
72
|
+
executeParam: {
|
|
73
|
+
executeMode: "background",
|
|
74
|
+
intentName: "SearchFile",
|
|
75
|
+
bundleName: "com.huawei.hmos.aidispatchservice",
|
|
76
|
+
needUnlock: true,
|
|
77
|
+
actionResponse: true,
|
|
78
|
+
appType: "OHOS_APP",
|
|
79
|
+
timeOut: 5,
|
|
80
|
+
intentParam: {
|
|
81
|
+
query: params.query.trim(),
|
|
82
|
+
},
|
|
83
|
+
permissionId: [],
|
|
84
|
+
achieveType: "INTENT",
|
|
85
|
+
},
|
|
86
|
+
responses: [
|
|
87
|
+
{
|
|
88
|
+
resultCode: "",
|
|
89
|
+
displayText: "",
|
|
90
|
+
ttsText: "",
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
needUploadResult: true,
|
|
94
|
+
noHalfPage: false,
|
|
95
|
+
pageControlRelated: false,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
logger.log(`[SEARCH_FILE_TOOL] 📋 Command details:`, JSON.stringify(command, null, 2));
|
|
99
|
+
// Send command and wait for response (60 second timeout)
|
|
100
|
+
logger.log(`[SEARCH_FILE_TOOL] ⏳ Setting up promise to wait for file search response...`);
|
|
101
|
+
logger.log(`[SEARCH_FILE_TOOL] - Timeout: 60 seconds`);
|
|
102
|
+
return new Promise((resolve, reject) => {
|
|
103
|
+
const timeout = setTimeout(() => {
|
|
104
|
+
logger.error(`[SEARCH_FILE_TOOL] ⏰ Timeout: No response received within 60 seconds`);
|
|
105
|
+
wsManager.off("data-event", handler);
|
|
106
|
+
reject(new Error("搜索文件超时(60秒)"));
|
|
107
|
+
}, 60000);
|
|
108
|
+
// Listen for data events from WebSocket
|
|
109
|
+
const handler = (event) => {
|
|
110
|
+
logger.log(`[SEARCH_FILE_TOOL] 📨 Received data event:`, JSON.stringify(event));
|
|
111
|
+
if (event.intentName === "SearchFile") {
|
|
112
|
+
logger.log(`[SEARCH_FILE_TOOL] 🎯 SearchFile event received`);
|
|
113
|
+
logger.log(`[SEARCH_FILE_TOOL] - status: ${event.status}`);
|
|
114
|
+
clearTimeout(timeout);
|
|
115
|
+
wsManager.off("data-event", handler);
|
|
116
|
+
if (event.status === "success" && event.outputs) {
|
|
117
|
+
logger.log(`[SEARCH_FILE_TOOL] ✅ File search completed successfully`);
|
|
118
|
+
logger.log(`[SEARCH_FILE_TOOL] - outputs:`, JSON.stringify(event.outputs));
|
|
119
|
+
// 成功,直接返回完整的 event.outputs JSON 字符串
|
|
120
|
+
resolve({
|
|
121
|
+
content: [
|
|
122
|
+
{
|
|
123
|
+
type: "text",
|
|
124
|
+
text: JSON.stringify(event.outputs),
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
logger.error(`[SEARCH_FILE_TOOL] ❌ File search failed`);
|
|
131
|
+
logger.error(`[SEARCH_FILE_TOOL] - status: ${event.status}`);
|
|
132
|
+
logger.error(`[SEARCH_FILE_TOOL] - outputs:`, JSON.stringify(event.outputs || {}));
|
|
133
|
+
const errorDetail = event.outputs ? JSON.stringify(event.outputs) : event.status;
|
|
134
|
+
reject(new Error(`搜索文件失败: ${errorDetail}`));
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
// Register event handler
|
|
139
|
+
logger.log(`[SEARCH_FILE_TOOL] 📡 Registering data-event handler on WebSocket manager`);
|
|
140
|
+
wsManager.on("data-event", handler);
|
|
141
|
+
// Send the command
|
|
142
|
+
logger.log(`[SEARCH_FILE_TOOL] 📤 Sending SearchFile command...`);
|
|
143
|
+
sendCommand({
|
|
144
|
+
config,
|
|
145
|
+
sessionId,
|
|
146
|
+
taskId,
|
|
147
|
+
messageId,
|
|
148
|
+
command,
|
|
149
|
+
})
|
|
150
|
+
.then(() => {
|
|
151
|
+
logger.log(`[SEARCH_FILE_TOOL] ✅ Command sent successfully, waiting for response...`);
|
|
152
|
+
})
|
|
153
|
+
.catch((error) => {
|
|
154
|
+
logger.error(`[SEARCH_FILE_TOOL] ❌ Failed to send command:`, error);
|
|
155
|
+
clearTimeout(timeout);
|
|
156
|
+
wsManager.off("data-event", handler);
|
|
157
|
+
reject(error);
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
},
|
|
161
|
+
};
|