@ynhcj/xiaoyi-channel 0.0.50-beta → 0.0.52-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/index.js +42 -0
- package/dist/src/bot.js +3 -16
- package/dist/src/client.js +0 -3
- 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/formatter.js +3 -23
- package/dist/src/heartbeat.js +0 -4
- package/dist/src/reply-dispatcher.js +32 -0
- package/dist/src/steer-injector.d.ts +16 -0
- package/dist/src/steer-injector.js +74 -0
- package/dist/src/tools/calendar-tool.js +2 -37
- package/dist/src/tools/call-phone-tool.js +1 -42
- package/dist/src/tools/create-alarm-tool.js +3 -74
- package/dist/src/tools/delete-alarm-tool.js +3 -45
- package/dist/src/tools/image-reading-tool.js +0 -47
- package/dist/src/tools/location-tool.js +1 -32
- package/dist/src/tools/modify-alarm-tool.js +3 -77
- package/dist/src/tools/modify-note-tool.js +1 -34
- package/dist/src/tools/note-tool.js +2 -4
- package/dist/src/tools/search-alarm-tool.js +3 -61
- package/dist/src/tools/search-calendar-tool.js +2 -39
- package/dist/src/tools/search-contact-tool.js +0 -30
- package/dist/src/tools/search-file-tool.js +0 -33
- package/dist/src/tools/search-message-tool.js +0 -33
- package/dist/src/tools/search-note-tool.js +1 -26
- package/dist/src/tools/search-photo-gallery-tool.js +2 -31
- package/dist/src/tools/send-file-to-user-tool.js +0 -39
- package/dist/src/tools/send-message-tool.js +1 -39
- package/dist/src/tools/session-manager.js +0 -45
- package/dist/src/tools/upload-file-tool.js +0 -49
- package/dist/src/tools/upload-photo-tool.js +0 -42
- package/dist/src/tools/view-push-result-tool.js +0 -11
- package/dist/src/tools/xiaoyi-collection-tool.js +4 -82
- package/dist/src/tools/xiaoyi-gui-tool.js +0 -34
- package/dist/src/websocket.js +24 -10
- package/package.json +1 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
3
|
import { getCurrentSessionContext } from "./session-manager.js";
|
|
4
|
-
import { logger } from "../utils/logger.js";
|
|
5
4
|
/**
|
|
6
5
|
* XY search message tool - searches SMS messages on user's device.
|
|
7
6
|
* Returns matching messages based on content keyword search.
|
|
@@ -21,35 +20,19 @@ export const searchMessageTool = {
|
|
|
21
20
|
required: ["content"],
|
|
22
21
|
},
|
|
23
22
|
async execute(toolCallId, params) {
|
|
24
|
-
logger.log(`[SEARCH_MESSAGE_TOOL] 🚀 Starting execution`);
|
|
25
|
-
logger.log(`[SEARCH_MESSAGE_TOOL] - toolCallId: ${toolCallId}`);
|
|
26
|
-
logger.log(`[SEARCH_MESSAGE_TOOL] - params:`, JSON.stringify(params));
|
|
27
|
-
logger.log(`[SEARCH_MESSAGE_TOOL] - timestamp: ${new Date().toISOString()}`);
|
|
28
23
|
// Validate content parameter
|
|
29
24
|
if (!params.content || typeof params.content !== "string" || params.content.trim() === "") {
|
|
30
|
-
logger.error(`[SEARCH_MESSAGE_TOOL] ❌ Missing or invalid content parameter`);
|
|
31
25
|
throw new Error("Missing required parameter: content must be a non-empty string");
|
|
32
26
|
}
|
|
33
|
-
logger.log(`[SEARCH_MESSAGE_TOOL] 🔍 Searching for messages with keyword: ${params.content}`);
|
|
34
27
|
// Get session context
|
|
35
|
-
logger.log(`[SEARCH_MESSAGE_TOOL] 🔍 Attempting to get session context...`);
|
|
36
28
|
const sessionContext = getCurrentSessionContext();
|
|
37
29
|
if (!sessionContext) {
|
|
38
|
-
logger.error(`[SEARCH_MESSAGE_TOOL] ❌ FAILED: No active session found!`);
|
|
39
|
-
logger.error(`[SEARCH_MESSAGE_TOOL] - toolCallId: ${toolCallId}`);
|
|
40
30
|
throw new Error("No active XY session found. Search message tool can only be used during an active conversation.");
|
|
41
31
|
}
|
|
42
|
-
logger.log(`[SEARCH_MESSAGE_TOOL] ✅ Session context found`);
|
|
43
|
-
logger.log(`[SEARCH_MESSAGE_TOOL] - sessionId: ${sessionContext.sessionId}`);
|
|
44
|
-
logger.log(`[SEARCH_MESSAGE_TOOL] - taskId: ${sessionContext.taskId}`);
|
|
45
|
-
logger.log(`[SEARCH_MESSAGE_TOOL] - messageId: ${sessionContext.messageId}`);
|
|
46
32
|
const { config, sessionId, taskId, messageId } = sessionContext;
|
|
47
33
|
// Get WebSocket manager
|
|
48
|
-
logger.log(`[SEARCH_MESSAGE_TOOL] 🔌 Getting WebSocket manager...`);
|
|
49
34
|
const wsManager = getXYWebSocketManager(config);
|
|
50
|
-
logger.log(`[SEARCH_MESSAGE_TOOL] ✅ WebSocket manager obtained`);
|
|
51
35
|
// Build SearchMessage command
|
|
52
|
-
logger.log(`[SEARCH_MESSAGE_TOOL] 📦 Building SearchMessage command...`);
|
|
53
36
|
const command = {
|
|
54
37
|
header: {
|
|
55
38
|
namespace: "Common",
|
|
@@ -83,27 +66,18 @@ export const searchMessageTool = {
|
|
|
83
66
|
pageControlRelated: false,
|
|
84
67
|
},
|
|
85
68
|
};
|
|
86
|
-
logger.log(`[SEARCH_MESSAGE_TOOL] 📋 Command details:`, JSON.stringify(command, null, 2));
|
|
87
69
|
// Send command and wait for response (60 second timeout)
|
|
88
|
-
logger.log(`[SEARCH_MESSAGE_TOOL] ⏳ Setting up promise to wait for message search response...`);
|
|
89
|
-
logger.log(`[SEARCH_MESSAGE_TOOL] - Timeout: 60 seconds`);
|
|
90
70
|
return new Promise((resolve, reject) => {
|
|
91
71
|
const timeout = setTimeout(() => {
|
|
92
|
-
logger.error(`[SEARCH_MESSAGE_TOOL] ⏰ Timeout: No response received within 60 seconds`);
|
|
93
72
|
wsManager.off("data-event", handler);
|
|
94
73
|
reject(new Error("搜索短信超时(60秒)"));
|
|
95
74
|
}, 60000);
|
|
96
75
|
// Listen for data events from WebSocket
|
|
97
76
|
const handler = (event) => {
|
|
98
|
-
logger.log(`[SEARCH_MESSAGE_TOOL] 📨 Received data event:`, JSON.stringify(event));
|
|
99
77
|
if (event.intentName === "SearchMessage") {
|
|
100
|
-
logger.log(`[SEARCH_MESSAGE_TOOL] 🎯 SearchMessage event received`);
|
|
101
|
-
logger.log(`[SEARCH_MESSAGE_TOOL] - status: ${event.status}`);
|
|
102
78
|
clearTimeout(timeout);
|
|
103
79
|
wsManager.off("data-event", handler);
|
|
104
80
|
if (event.status === "success" && event.outputs) {
|
|
105
|
-
logger.log(`[SEARCH_MESSAGE_TOOL] ✅ Message search completed successfully`);
|
|
106
|
-
logger.log(`[SEARCH_MESSAGE_TOOL] - outputs:`, JSON.stringify(event.outputs));
|
|
107
81
|
// 成功,直接返回完整的 event.outputs JSON 字符串
|
|
108
82
|
resolve({
|
|
109
83
|
content: [
|
|
@@ -115,19 +89,14 @@ export const searchMessageTool = {
|
|
|
115
89
|
});
|
|
116
90
|
}
|
|
117
91
|
else {
|
|
118
|
-
logger.error(`[SEARCH_MESSAGE_TOOL] ❌ Message search failed`);
|
|
119
|
-
logger.error(`[SEARCH_MESSAGE_TOOL] - status: ${event.status}`);
|
|
120
|
-
logger.error(`[SEARCH_MESSAGE_TOOL] - outputs:`, JSON.stringify(event.outputs || {}));
|
|
121
92
|
const errorDetail = event.outputs ? JSON.stringify(event.outputs) : event.status;
|
|
122
93
|
reject(new Error(`搜索短信失败: ${errorDetail}`));
|
|
123
94
|
}
|
|
124
95
|
}
|
|
125
96
|
};
|
|
126
97
|
// Register event handler
|
|
127
|
-
logger.log(`[SEARCH_MESSAGE_TOOL] 📡 Registering data-event handler on WebSocket manager`);
|
|
128
98
|
wsManager.on("data-event", handler);
|
|
129
99
|
// Send the command
|
|
130
|
-
logger.log(`[SEARCH_MESSAGE_TOOL] 📤 Sending SearchMessage command...`);
|
|
131
100
|
sendCommand({
|
|
132
101
|
config,
|
|
133
102
|
sessionId,
|
|
@@ -136,10 +105,8 @@ export const searchMessageTool = {
|
|
|
136
105
|
command,
|
|
137
106
|
})
|
|
138
107
|
.then(() => {
|
|
139
|
-
logger.log(`[SEARCH_MESSAGE_TOOL] ✅ Command sent successfully, waiting for response...`);
|
|
140
108
|
})
|
|
141
109
|
.catch((error) => {
|
|
142
|
-
logger.error(`[SEARCH_MESSAGE_TOOL] ❌ Failed to send command:`, error);
|
|
143
110
|
clearTimeout(timeout);
|
|
144
111
|
wsManager.off("data-event", handler);
|
|
145
112
|
reject(error);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
3
|
import { getCurrentSessionContext } from "./session-manager.js";
|
|
4
|
-
import { logger } from "../utils/logger.js";
|
|
5
4
|
/**
|
|
6
5
|
* XY search note tool - searches notes on user's device.
|
|
7
6
|
* Returns matching notes based on query string.
|
|
@@ -9,7 +8,7 @@ import { logger } from "../utils/logger.js";
|
|
|
9
8
|
export const searchNoteTool = {
|
|
10
9
|
name: "search_notes",
|
|
11
10
|
label: "Search Notes",
|
|
12
|
-
description: "搜索用户设备上的备忘录内容。根据关键词在备忘录的标题、内容和附件名称中进行检索。注意:操作超时时间为60
|
|
11
|
+
description: "搜索用户设备上的备忘录内容。根据关键词在备忘录的标题、内容和附件名称中进行检索。注意:操作超时时间为60秒,请勿重复调用此工具,如果超时或失败,最多重试一次。回复约束:如果工具返回没有授权或者其他报错,只需要完整描述没有授权或者其他报错内容即可,不需要主动给用户提供解决方案,例如告诉用户如何授权,如何解决报错等都是不需要的,请严格遵守。",
|
|
13
12
|
parameters: {
|
|
14
13
|
type: "object",
|
|
15
14
|
properties: {
|
|
@@ -21,28 +20,18 @@ export const searchNoteTool = {
|
|
|
21
20
|
required: ["query"],
|
|
22
21
|
},
|
|
23
22
|
async execute(toolCallId, params) {
|
|
24
|
-
logger.log(`[SEARCH_NOTE_TOOL] 🚀 Starting execution`);
|
|
25
|
-
logger.log(`[SEARCH_NOTE_TOOL] - toolCallId: ${toolCallId}`);
|
|
26
|
-
logger.log(`[SEARCH_NOTE_TOOL] - params:`, JSON.stringify(params));
|
|
27
|
-
logger.log(`[SEARCH_NOTE_TOOL] - timestamp: ${new Date().toISOString()}`);
|
|
28
23
|
// Validate parameters
|
|
29
24
|
if (!params.query) {
|
|
30
|
-
logger.error(`[SEARCH_NOTE_TOOL] ❌ Missing required parameter: query`);
|
|
31
25
|
throw new Error("Missing required parameter: query is required");
|
|
32
26
|
}
|
|
33
27
|
// Get session context
|
|
34
|
-
logger.log(`[SEARCH_NOTE_TOOL] 🔍 Attempting to get session context...`);
|
|
35
28
|
const sessionContext = getCurrentSessionContext();
|
|
36
29
|
if (!sessionContext) {
|
|
37
|
-
logger.error(`[SEARCH_NOTE_TOOL] ❌ FAILED: No active session found!`);
|
|
38
30
|
throw new Error("No active XY session found. Search note tool can only be used during an active conversation.");
|
|
39
31
|
}
|
|
40
|
-
logger.log(`[SEARCH_NOTE_TOOL] ✅ Session context found`);
|
|
41
32
|
const { config, sessionId, taskId, messageId } = sessionContext;
|
|
42
33
|
// Get WebSocket manager
|
|
43
|
-
logger.log(`[SEARCH_NOTE_TOOL] 🔌 Getting WebSocket manager...`);
|
|
44
34
|
const wsManager = getXYWebSocketManager(config);
|
|
45
|
-
logger.log(`[SEARCH_NOTE_TOOL] ✅ WebSocket manager obtained`);
|
|
46
35
|
// Build SearchNote command
|
|
47
36
|
const command = {
|
|
48
37
|
header: {
|
|
@@ -77,25 +66,17 @@ export const searchNoteTool = {
|
|
|
77
66
|
},
|
|
78
67
|
};
|
|
79
68
|
// Send command and wait for response (60 second timeout)
|
|
80
|
-
logger.log(`[SEARCH_NOTE_TOOL] ⏳ Setting up promise to wait for note search response...`);
|
|
81
|
-
logger.log(`[SEARCH_NOTE_TOOL] - Timeout: 60 seconds`);
|
|
82
69
|
return new Promise((resolve, reject) => {
|
|
83
70
|
const timeout = setTimeout(() => {
|
|
84
|
-
logger.error(`[SEARCH_NOTE_TOOL] ⏰ Timeout: No response received within 60 seconds`);
|
|
85
71
|
wsManager.off("data-event", handler);
|
|
86
72
|
reject(new Error("搜索备忘录超时(60秒)"));
|
|
87
73
|
}, 60000);
|
|
88
74
|
// Listen for data events from WebSocket
|
|
89
75
|
const handler = (event) => {
|
|
90
|
-
logger.log(`[SEARCH_NOTE_TOOL] 📨 Received data event:`, JSON.stringify(event));
|
|
91
76
|
if (event.intentName === "SearchNote") {
|
|
92
|
-
logger.log(`[SEARCH_NOTE_TOOL] 🎯 SearchNote event received`);
|
|
93
|
-
logger.log(`[SEARCH_NOTE_TOOL] - status: ${event.status}`);
|
|
94
77
|
clearTimeout(timeout);
|
|
95
78
|
wsManager.off("data-event", handler);
|
|
96
79
|
if (event.status === "success" && event.outputs) {
|
|
97
|
-
logger.log(`[SEARCH_NOTE_TOOL] ✅ Note search completed successfully`);
|
|
98
|
-
logger.log(`[SEARCH_NOTE_TOOL] - outputs:`, JSON.stringify(event.outputs));
|
|
99
80
|
// 成功,直接返回完整的 event.outputs JSON 字符串
|
|
100
81
|
resolve({
|
|
101
82
|
content: [
|
|
@@ -107,17 +88,13 @@ export const searchNoteTool = {
|
|
|
107
88
|
});
|
|
108
89
|
}
|
|
109
90
|
else {
|
|
110
|
-
logger.error(`[SEARCH_NOTE_TOOL] ❌ Note search failed`);
|
|
111
|
-
logger.error(`[SEARCH_NOTE_TOOL] - status: ${event.status}`);
|
|
112
91
|
reject(new Error(`搜索备忘录失败: ${event.status}`));
|
|
113
92
|
}
|
|
114
93
|
}
|
|
115
94
|
};
|
|
116
95
|
// Register event handler
|
|
117
|
-
logger.log(`[SEARCH_NOTE_TOOL] 📡 Registering data-event handler on WebSocket manager`);
|
|
118
96
|
wsManager.on("data-event", handler);
|
|
119
97
|
// Send the command
|
|
120
|
-
logger.log(`[SEARCH_NOTE_TOOL] 📤 Sending SearchNote command...`);
|
|
121
98
|
sendCommand({
|
|
122
99
|
config,
|
|
123
100
|
sessionId,
|
|
@@ -125,9 +102,7 @@ export const searchNoteTool = {
|
|
|
125
102
|
messageId,
|
|
126
103
|
command,
|
|
127
104
|
}).then(() => {
|
|
128
|
-
logger.log(`[SEARCH_NOTE_TOOL] ✅ Command sent successfully, waiting for response...`);
|
|
129
105
|
}).catch((error) => {
|
|
130
|
-
logger.error(`[SEARCH_NOTE_TOOL] ❌ Failed to send command:`, error);
|
|
131
106
|
clearTimeout(timeout);
|
|
132
107
|
wsManager.off("data-event", handler);
|
|
133
108
|
reject(error);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
3
|
import { getCurrentSessionContext } from "./session-manager.js";
|
|
4
|
-
import { logger } from "../utils/logger.js";
|
|
5
4
|
/**
|
|
6
5
|
* XY search photo gallery tool - searches photos in user's gallery.
|
|
7
6
|
* Returns local mediaUri strings that can be used with upload_photo tool.
|
|
@@ -43,6 +42,8 @@ export const searchPhotoGalleryTool = {
|
|
|
43
42
|
a. 只有当用户明确表达从手机相册搜索或者从图库搜索时才执行此工具,如果用户仅表达要搜索xxx图片,并没有说明搜索数据源,则不要贸然调用此插件,可以优先尝试websearch或者询问用户是否要从手机图库中搜索。
|
|
44
43
|
b. 操作超时时间为60秒,请勿重复调用此工具,如果超时或失败,最多重试一次。
|
|
45
44
|
c. 如果用户请求包含多个实体或时间范围,需要主动拆分成多次查询并告知用户。
|
|
45
|
+
|
|
46
|
+
回复约束:如果工具返回没有授权或者其他报错,只需要完整描述没有授权或者其他报错内容即可,不需要主动给用户提供解决方案,例如告诉用户如何授权,如何解决报错等都是不需要的,请严格遵守。
|
|
46
47
|
`,
|
|
47
48
|
parameters: {
|
|
48
49
|
type: "object",
|
|
@@ -63,37 +64,20 @@ export const searchPhotoGalleryTool = {
|
|
|
63
64
|
required: ["query"],
|
|
64
65
|
},
|
|
65
66
|
async execute(toolCallId, params) {
|
|
66
|
-
logger.log(`[SEARCH_PHOTO_GALLERY_TOOL] 🚀 Starting execution`);
|
|
67
|
-
logger.log(`[SEARCH_PHOTO_GALLERY_TOOL] - toolCallId: ${toolCallId}`);
|
|
68
|
-
logger.log(`[SEARCH_PHOTO_GALLERY_TOOL] - params:`, JSON.stringify(params));
|
|
69
|
-
logger.log(`[SEARCH_PHOTO_GALLERY_TOOL] - timestamp: ${new Date().toISOString()}`);
|
|
70
67
|
// Validate parameters
|
|
71
68
|
if (!params.query) {
|
|
72
|
-
logger.error(`[SEARCH_PHOTO_GALLERY_TOOL] ❌ Missing required parameter: query`);
|
|
73
69
|
throw new Error("Missing required parameter: query is required");
|
|
74
70
|
}
|
|
75
71
|
// Get session context
|
|
76
|
-
logger.log(`[SEARCH_PHOTO_GALLERY_TOOL] 🔍 Attempting to get session context...`);
|
|
77
72
|
const sessionContext = getCurrentSessionContext();
|
|
78
73
|
if (!sessionContext) {
|
|
79
|
-
logger.error(`[SEARCH_PHOTO_GALLERY_TOOL] ❌ FAILED: No active session found!`);
|
|
80
|
-
logger.error(`[SEARCH_PHOTO_GALLERY_TOOL] - toolCallId: ${toolCallId}`);
|
|
81
74
|
throw new Error("No active XY session found. Search photo gallery tool can only be used during an active conversation.");
|
|
82
75
|
}
|
|
83
|
-
logger.log(`[SEARCH_PHOTO_GALLERY_TOOL] ✅ Session context found`);
|
|
84
|
-
logger.log(`[SEARCH_PHOTO_GALLERY_TOOL] - sessionId: ${sessionContext.sessionId}`);
|
|
85
|
-
logger.log(`[SEARCH_PHOTO_GALLERY_TOOL] - taskId: ${sessionContext.taskId}`);
|
|
86
|
-
logger.log(`[SEARCH_PHOTO_GALLERY_TOOL] - messageId: ${sessionContext.messageId}`);
|
|
87
76
|
const { config, sessionId, taskId, messageId } = sessionContext;
|
|
88
77
|
// Get WebSocket manager
|
|
89
|
-
logger.log(`[SEARCH_PHOTO_GALLERY_TOOL] 🔌 Getting WebSocket manager...`);
|
|
90
78
|
const wsManager = getXYWebSocketManager(config);
|
|
91
|
-
logger.log(`[SEARCH_PHOTO_GALLERY_TOOL] ✅ WebSocket manager obtained`);
|
|
92
79
|
// Search for photos
|
|
93
|
-
logger.log(`[SEARCH_PHOTO_GALLERY_TOOL] 📸 Searching for photos...`);
|
|
94
80
|
const outputs = await searchPhotos(wsManager, config, sessionId, taskId, messageId, params.query);
|
|
95
|
-
logger.log(`[SEARCH_PHOTO_GALLERY_TOOL] ✅ Photo search completed successfully`);
|
|
96
|
-
logger.log(`[SEARCH_PHOTO_GALLERY_TOOL] - outputs:`, JSON.stringify(outputs));
|
|
97
81
|
return {
|
|
98
82
|
content: [
|
|
99
83
|
{
|
|
@@ -109,7 +93,6 @@ export const searchPhotoGalleryTool = {
|
|
|
109
93
|
* Returns complete event.outputs object
|
|
110
94
|
*/
|
|
111
95
|
async function searchPhotos(wsManager, config, sessionId, taskId, messageId, query) {
|
|
112
|
-
logger.log(`[SEARCH_PHOTO_GALLERY_TOOL] 📦 Building SearchPhotoVideo command...`);
|
|
113
96
|
const command = {
|
|
114
97
|
header: {
|
|
115
98
|
namespace: "Common",
|
|
@@ -145,33 +128,23 @@ async function searchPhotos(wsManager, config, sessionId, taskId, messageId, que
|
|
|
145
128
|
};
|
|
146
129
|
return new Promise((resolve, reject) => {
|
|
147
130
|
const timeout = setTimeout(() => {
|
|
148
|
-
logger.error(`[SEARCH_PHOTO_GALLERY_TOOL] ⏰ Timeout: No response for SearchPhotoVideo within 60 seconds`);
|
|
149
131
|
wsManager.off("data-event", handler);
|
|
150
132
|
reject(new Error("搜索照片超时(60秒)"));
|
|
151
133
|
}, 60000);
|
|
152
134
|
const handler = (event) => {
|
|
153
|
-
logger.log(`[SEARCH_PHOTO_GALLERY_TOOL] 📨 Received data event:`, JSON.stringify(event));
|
|
154
135
|
if (event.intentName === "SearchPhotoVideo") {
|
|
155
|
-
logger.log(`[SEARCH_PHOTO_GALLERY_TOOL] 🎯 SearchPhotoVideo event received`);
|
|
156
|
-
logger.log(`[SEARCH_PHOTO_GALLERY_TOOL] - status: ${event.status}`);
|
|
157
136
|
clearTimeout(timeout);
|
|
158
137
|
wsManager.off("data-event", handler);
|
|
159
138
|
if (event.status === "success" && event.outputs) {
|
|
160
|
-
logger.log(`[SEARCH_PHOTO_GALLERY_TOOL] ✅ Photo search completed successfully`);
|
|
161
|
-
logger.log(`[SEARCH_PHOTO_GALLERY_TOOL] - outputs:`, JSON.stringify(event.outputs));
|
|
162
139
|
// 成功,直接返回完整的 event.outputs
|
|
163
140
|
resolve(event.outputs);
|
|
164
141
|
}
|
|
165
142
|
else {
|
|
166
|
-
logger.error(`[SEARCH_PHOTO_GALLERY_TOOL] ❌ Photo search failed`);
|
|
167
|
-
logger.error(`[SEARCH_PHOTO_GALLERY_TOOL] - status: ${event.status}`);
|
|
168
143
|
reject(new Error(`搜索照片失败: ${event.status}`));
|
|
169
144
|
}
|
|
170
145
|
}
|
|
171
146
|
};
|
|
172
|
-
logger.log(`[SEARCH_PHOTO_GALLERY_TOOL] 📡 Registering data-event handler for SearchPhotoVideo`);
|
|
173
147
|
wsManager.on("data-event", handler);
|
|
174
|
-
logger.log(`[SEARCH_PHOTO_GALLERY_TOOL] 📤 Sending SearchPhotoVideo command...`);
|
|
175
148
|
sendCommand({
|
|
176
149
|
config,
|
|
177
150
|
sessionId,
|
|
@@ -180,10 +153,8 @@ async function searchPhotos(wsManager, config, sessionId, taskId, messageId, que
|
|
|
180
153
|
command,
|
|
181
154
|
})
|
|
182
155
|
.then(() => {
|
|
183
|
-
logger.log(`[SEARCH_PHOTO_GALLERY_TOOL] ✅ SearchPhotoVideo command sent successfully`);
|
|
184
156
|
})
|
|
185
157
|
.catch((error) => {
|
|
186
|
-
logger.error(`[SEARCH_PHOTO_GALLERY_TOOL] ❌ Failed to send SearchPhotoVideo command:`, error);
|
|
187
158
|
clearTimeout(timeout);
|
|
188
159
|
wsManager.off("data-event", handler);
|
|
189
160
|
reject(error);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { XYFileUploadService } from "../file-upload.js";
|
|
3
3
|
import { getCurrentSessionContext } from "./session-manager.js";
|
|
4
|
-
import { logger } from "../utils/logger.js";
|
|
5
4
|
import fetch from "node-fetch";
|
|
6
5
|
import fs from "fs/promises";
|
|
7
6
|
import path from "path";
|
|
@@ -65,7 +64,6 @@ function normalizeToArray(param) {
|
|
|
65
64
|
* Download remote file to local temp directory
|
|
66
65
|
*/
|
|
67
66
|
async function downloadRemoteFile(url) {
|
|
68
|
-
logger.log(`[SEND_FILE_TO_USER_TOOL] 📥 Downloading remote file: ${url}`);
|
|
69
67
|
try {
|
|
70
68
|
const response = await fetch(url);
|
|
71
69
|
if (!response.ok) {
|
|
@@ -88,11 +86,9 @@ async function downloadRemoteFile(url) {
|
|
|
88
86
|
const arrayBuffer = await response.arrayBuffer();
|
|
89
87
|
const buffer = Buffer.from(arrayBuffer);
|
|
90
88
|
await fs.writeFile(localPath, buffer);
|
|
91
|
-
logger.log(`[SEND_FILE_TO_USER_TOOL] ✅ File downloaded to: ${localPath}`);
|
|
92
89
|
return localPath;
|
|
93
90
|
}
|
|
94
91
|
catch (error) {
|
|
95
|
-
logger.error(`[SEND_FILE_TO_USER_TOOL] ❌ Failed to download file from ${url}:`, error);
|
|
96
92
|
throw new Error(`Failed to download remote file: ${error instanceof Error ? error.message : String(error)}`);
|
|
97
93
|
}
|
|
98
94
|
}
|
|
@@ -136,54 +132,34 @@ b. 操作超时时间为2分钟(120秒),请勿重复调用此工具,如
|
|
|
136
132
|
});
|
|
137
133
|
// Create the main execution promise
|
|
138
134
|
const executionPromise = (async () => {
|
|
139
|
-
logger.log(`[SEND_FILE_TO_USER_TOOL] 🚀 Starting execution`);
|
|
140
|
-
logger.log(`[SEND_FILE_TO_USER_TOOL] - toolCallId: ${toolCallId}`);
|
|
141
|
-
logger.log(`[SEND_FILE_TO_USER_TOOL] - params (raw):`, JSON.stringify(params));
|
|
142
|
-
logger.log(`[SEND_FILE_TO_USER_TOOL] - timestamp: ${new Date().toISOString()}`);
|
|
143
135
|
// Validate that at least one parameter is provided
|
|
144
136
|
if (!params.fileLocalUrls && !params.fileRemoteUrls) {
|
|
145
|
-
logger.error(`[SEND_FILE_TO_USER_TOOL] ❌ Missing both fileLocalUrls and fileRemoteUrls parameters`);
|
|
146
137
|
throw new Error("At least one of fileLocalUrls or fileRemoteUrls must be provided");
|
|
147
138
|
}
|
|
148
139
|
// Normalize fileLocalUrls parameter
|
|
149
140
|
let fileLocalUrls = [];
|
|
150
141
|
if (params.fileLocalUrls) {
|
|
151
|
-
logger.log(`[SEND_FILE_TO_USER_TOOL] 🔄 Normalizing fileLocalUrls parameter...`);
|
|
152
142
|
fileLocalUrls = normalizeToArray(params.fileLocalUrls);
|
|
153
143
|
if (fileLocalUrls.length === 0) {
|
|
154
|
-
logger.error(`[SEND_FILE_TO_USER_TOOL] ❌ fileLocalUrls array is empty`);
|
|
155
144
|
throw new Error("fileLocalUrls array cannot be empty");
|
|
156
145
|
}
|
|
157
|
-
logger.log(`[SEND_FILE_TO_USER_TOOL] ✅ Normalized fileLocalUrls:`, JSON.stringify(fileLocalUrls));
|
|
158
146
|
}
|
|
159
147
|
// Normalize fileRemoteUrls parameter
|
|
160
148
|
let fileRemoteUrls = [];
|
|
161
149
|
if (params.fileRemoteUrls) {
|
|
162
|
-
logger.log(`[SEND_FILE_TO_USER_TOOL] 🔄 Normalizing fileRemoteUrls parameter...`);
|
|
163
150
|
fileRemoteUrls = normalizeToArray(params.fileRemoteUrls);
|
|
164
151
|
if (fileRemoteUrls.length === 0) {
|
|
165
|
-
logger.error(`[SEND_FILE_TO_USER_TOOL] ❌ fileRemoteUrls array is empty`);
|
|
166
152
|
throw new Error("fileRemoteUrls array cannot be empty");
|
|
167
153
|
}
|
|
168
|
-
logger.log(`[SEND_FILE_TO_USER_TOOL] ✅ Normalized fileRemoteUrls:`, JSON.stringify(fileRemoteUrls));
|
|
169
154
|
}
|
|
170
155
|
// Get session context
|
|
171
|
-
logger.log(`[SEND_FILE_TO_USER_TOOL] 🔍 Attempting to get session context...`);
|
|
172
156
|
const sessionContext = getCurrentSessionContext();
|
|
173
157
|
if (!sessionContext) {
|
|
174
|
-
logger.error(`[SEND_FILE_TO_USER_TOOL] ❌ FAILED: No active session found!`);
|
|
175
|
-
logger.error(`[SEND_FILE_TO_USER_TOOL] - toolCallId: ${toolCallId}`);
|
|
176
158
|
throw new Error("No active XY session found. Send file to user tool can only be used during an active conversation.");
|
|
177
159
|
}
|
|
178
|
-
logger.log(`[SEND_FILE_TO_USER_TOOL] ✅ Session context found`);
|
|
179
|
-
logger.log(`[SEND_FILE_TO_USER_TOOL] - sessionId: ${sessionContext.sessionId}`);
|
|
180
|
-
logger.log(`[SEND_FILE_TO_USER_TOOL] - taskId: ${sessionContext.taskId}`);
|
|
181
|
-
logger.log(`[SEND_FILE_TO_USER_TOOL] - messageId: ${sessionContext.messageId}`);
|
|
182
160
|
const { config, sessionId, taskId, messageId } = sessionContext;
|
|
183
161
|
// Get WebSocket manager
|
|
184
|
-
logger.log(`[SEND_FILE_TO_USER_TOOL] 🔌 Getting WebSocket manager...`);
|
|
185
162
|
const wsManager = getXYWebSocketManager(config);
|
|
186
|
-
logger.log(`[SEND_FILE_TO_USER_TOOL] ✅ WebSocket manager obtained`);
|
|
187
163
|
// Create upload service
|
|
188
164
|
const uploadService = new XYFileUploadService(config.fileUploadUrl, config.apiKey, config.uid);
|
|
189
165
|
// Collect all local file paths to upload
|
|
@@ -191,61 +167,48 @@ b. 操作超时时间为2分钟(120秒),请勿重复调用此工具,如
|
|
|
191
167
|
const downloadedFiles = [];
|
|
192
168
|
// Download remote files to local temp directory
|
|
193
169
|
if (fileRemoteUrls.length > 0) {
|
|
194
|
-
logger.log(`[SEND_FILE_TO_USER_TOOL] 📥 Downloading ${fileRemoteUrls.length} remote files...`);
|
|
195
170
|
for (let i = 0; i < fileRemoteUrls.length; i++) {
|
|
196
171
|
const remoteUrl = fileRemoteUrls[i];
|
|
197
|
-
logger.log(`[SEND_FILE_TO_USER_TOOL] 📥 Downloading remote file ${i + 1}/${fileRemoteUrls.length}: ${remoteUrl}`);
|
|
198
172
|
try {
|
|
199
173
|
const localPath = await downloadRemoteFile(remoteUrl);
|
|
200
174
|
allLocalPaths.push(localPath);
|
|
201
175
|
downloadedFiles.push(localPath);
|
|
202
176
|
}
|
|
203
177
|
catch (error) {
|
|
204
|
-
logger.error(`[SEND_FILE_TO_USER_TOOL] ❌ Failed to download file ${i + 1}:`, error);
|
|
205
178
|
throw new Error(`Failed to download remote file ${remoteUrl}: ${error instanceof Error ? error.message : String(error)}`);
|
|
206
179
|
}
|
|
207
180
|
}
|
|
208
|
-
logger.log(`[SEND_FILE_TO_USER_TOOL] ✅ Downloaded ${downloadedFiles.length} remote files`);
|
|
209
181
|
}
|
|
210
182
|
// Upload all local files and get fileIds
|
|
211
|
-
logger.log(`[SEND_FILE_TO_USER_TOOL] 📤 Uploading ${allLocalPaths.length} files...`);
|
|
212
183
|
const uploadedFiles = [];
|
|
213
184
|
for (let i = 0; i < allLocalPaths.length; i++) {
|
|
214
185
|
const localPath = allLocalPaths[i];
|
|
215
|
-
logger.log(`[SEND_FILE_TO_USER_TOOL] 📤 Uploading file ${i + 1}/${allLocalPaths.length}: ${localPath}`);
|
|
216
186
|
try {
|
|
217
187
|
// Upload file using three-phase upload
|
|
218
188
|
const fileId = await uploadService.uploadFile(localPath);
|
|
219
189
|
if (!fileId) {
|
|
220
|
-
logger.error(`[SEND_FILE_TO_USER_TOOL] ❌ Failed to upload file: ${localPath} (fileId is empty)`);
|
|
221
190
|
throw new Error(`Failed to upload file: ${localPath}`);
|
|
222
191
|
}
|
|
223
192
|
// Get filename and mime type
|
|
224
193
|
const fileName = localPath.split("/").pop() || "unknown";
|
|
225
194
|
const mimeType = getMimeTypeFromFilename(fileName);
|
|
226
195
|
uploadedFiles.push({ fileName, fileId, mimeType });
|
|
227
|
-
logger.log(`[SEND_FILE_TO_USER_TOOL] ✅ File uploaded successfully: ${fileName} -> ${fileId}`);
|
|
228
196
|
}
|
|
229
197
|
catch (error) {
|
|
230
|
-
logger.error(`[SEND_FILE_TO_USER_TOOL] ❌ Failed to upload file ${i + 1}:`, error);
|
|
231
198
|
throw new Error(`Failed to upload file ${localPath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
232
199
|
}
|
|
233
200
|
}
|
|
234
201
|
// Clean up downloaded files
|
|
235
202
|
if (downloadedFiles.length > 0) {
|
|
236
|
-
logger.log(`[SEND_FILE_TO_USER_TOOL] 🧹 Cleaning up ${downloadedFiles.length} downloaded files...`);
|
|
237
203
|
for (const downloadedFile of downloadedFiles) {
|
|
238
204
|
try {
|
|
239
205
|
await fs.unlink(downloadedFile);
|
|
240
|
-
logger.log(`[SEND_FILE_TO_USER_TOOL] ✅ Cleaned up: ${downloadedFile}`);
|
|
241
206
|
}
|
|
242
207
|
catch (error) {
|
|
243
|
-
logger.warn(`[SEND_FILE_TO_USER_TOOL] ⚠️ Failed to clean up file ${downloadedFile}:`, error);
|
|
244
208
|
}
|
|
245
209
|
}
|
|
246
210
|
}
|
|
247
211
|
// Build and send agent_response messages for each file
|
|
248
|
-
logger.log(`[SEND_FILE_TO_USER_TOOL] 📦 Building and sending agent_response messages...`);
|
|
249
212
|
const sentFiles = [];
|
|
250
213
|
for (const uploadedFile of uploadedFiles) {
|
|
251
214
|
const { fileName, fileId, mimeType } = uploadedFile;
|
|
@@ -282,9 +245,7 @@ b. 操作超时时间为2分钟(120秒),请勿重复调用此工具,如
|
|
|
282
245
|
// Send WebSocket message
|
|
283
246
|
await wsManager.sendMessage(sessionId, agentResponse);
|
|
284
247
|
sentFiles.push({ fileName, fileId });
|
|
285
|
-
logger.log(`[SEND_FILE_TO_USER_TOOL] ✅ Sent file to user: ${fileName} (fileId: ${fileId})`);
|
|
286
248
|
}
|
|
287
|
-
logger.log(`[SEND_FILE_TO_USER_TOOL] 🎉 Successfully sent ${sentFiles.length} files to user`);
|
|
288
249
|
return {
|
|
289
250
|
content: [
|
|
290
251
|
{
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
3
|
import { getCurrentSessionContext } from "./session-manager.js";
|
|
4
|
-
import { logger } from "../utils/logger.js";
|
|
5
4
|
/**
|
|
6
5
|
* XY send message tool - sends SMS message on user's device.
|
|
7
6
|
* Requires phoneNumber (with +86 prefix) and content parameters.
|
|
@@ -9,7 +8,7 @@ import { logger } from "../utils/logger.js";
|
|
|
9
8
|
export const sendMessageTool = {
|
|
10
9
|
name: "send_message",
|
|
11
10
|
label: "Send Message",
|
|
12
|
-
description: "通过手机发送短信。需要提供接收方手机号码和短信内容。手机号码会自动添加+86前缀(如果没有的话)。注意:操作超时时间为60
|
|
11
|
+
description: "通过手机发送短信。需要提供接收方手机号码和短信内容。手机号码会自动添加+86前缀(如果没有的话)。注意:操作超时时间为60秒,请勿重复调用此工具,如果超时或失败,最多重试一次。回复约束:如果工具返回没有授权或者其他报错,只需要完整描述没有授权或者其他报错内容即可,不需要主动给用户提供解决方案,例如告诉用户如何授权,如何解决报错等都是不需要的,请严格遵守。",
|
|
13
12
|
parameters: {
|
|
14
13
|
type: "object",
|
|
15
14
|
properties: {
|
|
@@ -25,18 +24,12 @@ export const sendMessageTool = {
|
|
|
25
24
|
required: ["phoneNumber", "content"],
|
|
26
25
|
},
|
|
27
26
|
async execute(toolCallId, params) {
|
|
28
|
-
logger.log(`[SEND_MESSAGE_TOOL] 🚀 Starting execution`);
|
|
29
|
-
logger.log(`[SEND_MESSAGE_TOOL] - toolCallId: ${toolCallId}`);
|
|
30
|
-
logger.log(`[SEND_MESSAGE_TOOL] - params:`, JSON.stringify(params));
|
|
31
|
-
logger.log(`[SEND_MESSAGE_TOOL] - timestamp: ${new Date().toISOString()}`);
|
|
32
27
|
// Validate phoneNumber parameter
|
|
33
28
|
if (!params.phoneNumber || typeof params.phoneNumber !== "string" || params.phoneNumber.trim() === "") {
|
|
34
|
-
logger.error(`[SEND_MESSAGE_TOOL] ❌ Missing or invalid phoneNumber parameter`);
|
|
35
29
|
throw new Error("Missing required parameter: phoneNumber must be a non-empty string");
|
|
36
30
|
}
|
|
37
31
|
// Validate content parameter
|
|
38
32
|
if (!params.content || typeof params.content !== "string" || params.content.trim() === "") {
|
|
39
|
-
logger.error(`[SEND_MESSAGE_TOOL] ❌ Missing or invalid content parameter`);
|
|
40
33
|
throw new Error("Missing required parameter: content must be a non-empty string");
|
|
41
34
|
}
|
|
42
35
|
// Normalize phone number: add +86 prefix if not present
|
|
@@ -51,30 +44,16 @@ export const sendMessageTool = {
|
|
|
51
44
|
phoneNumber = phoneNumber.substring(2);
|
|
52
45
|
}
|
|
53
46
|
phoneNumber = `+86${phoneNumber}`;
|
|
54
|
-
logger.log(`[SEND_MESSAGE_TOOL] 📞 Normalized phone number: ${params.phoneNumber} -> ${phoneNumber}`);
|
|
55
47
|
}
|
|
56
|
-
logger.log(`[SEND_MESSAGE_TOOL] 📤 Preparing to send message`);
|
|
57
|
-
logger.log(`[SEND_MESSAGE_TOOL] - phoneNumber: ${phoneNumber}`);
|
|
58
|
-
logger.log(`[SEND_MESSAGE_TOOL] - content length: ${params.content.length} characters`);
|
|
59
48
|
// Get session context
|
|
60
|
-
logger.log(`[SEND_MESSAGE_TOOL] 🔍 Attempting to get session context...`);
|
|
61
49
|
const sessionContext = getCurrentSessionContext();
|
|
62
50
|
if (!sessionContext) {
|
|
63
|
-
logger.error(`[SEND_MESSAGE_TOOL] ❌ FAILED: No active session found!`);
|
|
64
|
-
logger.error(`[SEND_MESSAGE_TOOL] - toolCallId: ${toolCallId}`);
|
|
65
51
|
throw new Error("No active XY session found. Send message tool can only be used during an active conversation.");
|
|
66
52
|
}
|
|
67
|
-
logger.log(`[SEND_MESSAGE_TOOL] ✅ Session context found`);
|
|
68
|
-
logger.log(`[SEND_MESSAGE_TOOL] - sessionId: ${sessionContext.sessionId}`);
|
|
69
|
-
logger.log(`[SEND_MESSAGE_TOOL] - taskId: ${sessionContext.taskId}`);
|
|
70
|
-
logger.log(`[SEND_MESSAGE_TOOL] - messageId: ${sessionContext.messageId}`);
|
|
71
53
|
const { config, sessionId, taskId, messageId } = sessionContext;
|
|
72
54
|
// Get WebSocket manager
|
|
73
|
-
logger.log(`[SEND_MESSAGE_TOOL] 🔌 Getting WebSocket manager...`);
|
|
74
55
|
const wsManager = getXYWebSocketManager(config);
|
|
75
|
-
logger.log(`[SEND_MESSAGE_TOOL] ✅ WebSocket manager obtained`);
|
|
76
56
|
// Build SendShortMessage command
|
|
77
|
-
logger.log(`[SEND_MESSAGE_TOOL] 📦 Building SendShortMessage command...`);
|
|
78
57
|
const command = {
|
|
79
58
|
header: {
|
|
80
59
|
namespace: "Common",
|
|
@@ -109,28 +88,18 @@ export const sendMessageTool = {
|
|
|
109
88
|
pageControlRelated: false,
|
|
110
89
|
},
|
|
111
90
|
};
|
|
112
|
-
logger.log(`[SEND_MESSAGE_TOOL] 📋 Command details:`, JSON.stringify(command, null, 2));
|
|
113
91
|
// Send command and wait for response (60 second timeout)
|
|
114
|
-
logger.log(`[SEND_MESSAGE_TOOL] ⏳ Setting up promise to wait for send message response...`);
|
|
115
|
-
logger.log(`[SEND_MESSAGE_TOOL] - Timeout: 60 seconds`);
|
|
116
92
|
return new Promise((resolve, reject) => {
|
|
117
93
|
const timeout = setTimeout(() => {
|
|
118
|
-
logger.error(`[SEND_MESSAGE_TOOL] ⏰ Timeout: No response received within 60 seconds`);
|
|
119
94
|
wsManager.off("data-event", handler);
|
|
120
95
|
reject(new Error("发送短信超时(60秒)"));
|
|
121
96
|
}, 60000);
|
|
122
97
|
// Listen for data events from WebSocket
|
|
123
98
|
const handler = (event) => {
|
|
124
|
-
logger.log(`[SEND_MESSAGE_TOOL] 📨 Received data event:`, JSON.stringify(event));
|
|
125
99
|
if (event.intentName === "SendShortMessage") {
|
|
126
|
-
logger.log(`[SEND_MESSAGE_TOOL] 🎯 SendShortMessage event received`);
|
|
127
|
-
logger.log(`[SEND_MESSAGE_TOOL] - status: ${event.status}`);
|
|
128
100
|
clearTimeout(timeout);
|
|
129
101
|
wsManager.off("data-event", handler);
|
|
130
102
|
if (event.status === "success" && event.outputs) {
|
|
131
|
-
logger.log(`[SEND_MESSAGE_TOOL] ✅ Message sent successfully`);
|
|
132
|
-
logger.log(`[SEND_MESSAGE_TOOL] - phoneNumber: ${phoneNumber}`);
|
|
133
|
-
logger.log(`[SEND_MESSAGE_TOOL] - outputs:`, JSON.stringify(event.outputs));
|
|
134
103
|
// 成功,直接返回完整的 event.outputs JSON 字符串
|
|
135
104
|
resolve({
|
|
136
105
|
content: [
|
|
@@ -142,19 +111,14 @@ export const sendMessageTool = {
|
|
|
142
111
|
});
|
|
143
112
|
}
|
|
144
113
|
else {
|
|
145
|
-
logger.error(`[SEND_MESSAGE_TOOL] ❌ Send message failed`);
|
|
146
|
-
logger.error(`[SEND_MESSAGE_TOOL] - status: ${event.status}`);
|
|
147
|
-
logger.error(`[SEND_MESSAGE_TOOL] - outputs:`, JSON.stringify(event.outputs || {}));
|
|
148
114
|
const errorDetail = event.outputs ? JSON.stringify(event.outputs) : event.status;
|
|
149
115
|
reject(new Error(`发送短信失败: ${errorDetail}`));
|
|
150
116
|
}
|
|
151
117
|
}
|
|
152
118
|
};
|
|
153
119
|
// Register event handler
|
|
154
|
-
logger.log(`[SEND_MESSAGE_TOOL] 📡 Registering data-event handler on WebSocket manager`);
|
|
155
120
|
wsManager.on("data-event", handler);
|
|
156
121
|
// Send the command
|
|
157
|
-
logger.log(`[SEND_MESSAGE_TOOL] 📤 Sending SendShortMessage command...`);
|
|
158
122
|
sendCommand({
|
|
159
123
|
config,
|
|
160
124
|
sessionId,
|
|
@@ -163,10 +127,8 @@ export const sendMessageTool = {
|
|
|
163
127
|
command,
|
|
164
128
|
})
|
|
165
129
|
.then(() => {
|
|
166
|
-
logger.log(`[SEND_MESSAGE_TOOL] ✅ Command sent successfully, waiting for response...`);
|
|
167
130
|
})
|
|
168
131
|
.catch((error) => {
|
|
169
|
-
logger.error(`[SEND_MESSAGE_TOOL] ❌ Failed to send command:`, error);
|
|
170
132
|
clearTimeout(timeout);
|
|
171
133
|
wsManager.off("data-event", handler);
|
|
172
134
|
reject(error);
|