@ynhcj/xiaoyi-channel 0.0.115-next → 0.0.116-next
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/skill-retriever/hooks.js +0 -1
- package/dist/src/skill-retriever/tool-search.js +7 -12
- package/dist/src/tools/calendar-tool.js +3 -1
- package/dist/src/tools/call-phone-tool.js +3 -1
- package/dist/src/tools/create-alarm-tool.js +3 -1
- package/dist/src/tools/delete-alarm-tool.js +3 -1
- package/dist/src/tools/location-tool.js +3 -1
- package/dist/src/tools/modify-alarm-tool.js +3 -1
- package/dist/src/tools/modify-note-tool.js +3 -1
- package/dist/src/tools/note-tool.js +3 -1
- package/dist/src/tools/query-app-message-tool.js +3 -1
- package/dist/src/tools/query-memory-data-tool.js +3 -1
- package/dist/src/tools/query-todo-task-tool.js +3 -1
- package/dist/src/tools/save-file-to-phone-tool.js +3 -1
- package/dist/src/tools/save-media-to-gallery-tool.js +3 -1
- package/dist/src/tools/search-alarm-tool.js +3 -1
- package/dist/src/tools/search-calendar-tool.js +3 -1
- package/dist/src/tools/search-contact-tool.js +3 -1
- package/dist/src/tools/search-email-tool.js +3 -1
- package/dist/src/tools/search-file-tool.js +3 -1
- package/dist/src/tools/search-message-tool.js +3 -1
- package/dist/src/tools/search-note-tool.js +3 -1
- package/dist/src/tools/search-photo-gallery-tool.js +3 -1
- package/dist/src/tools/send-email-tool.js +3 -1
- package/dist/src/tools/send-message-tool.js +3 -1
- package/dist/src/tools/upload-file-tool.js +3 -1
- package/dist/src/tools/upload-photo-tool.js +3 -1
- package/dist/src/tools/xiaoyi-add-collection-tool.js +3 -1
- package/dist/src/tools/xiaoyi-collection-tool.js +3 -1
- package/dist/src/tools/xiaoyi-delete-collection-tool.js +3 -1
- package/dist/src/tools/xiaoyi-gui-tool.js +1 -1
- package/package.json +1 -1
|
@@ -5,7 +5,6 @@ const TOOL_RETRIEVER_HEADER = `[系统消息,非用户发言]
|
|
|
5
5
|
`;
|
|
6
6
|
const TOOL_RETRIEVER_FOOTER = `
|
|
7
7
|
以上是检索到的、与当前用户请求相关但用户尚未安装的skill,请按照TOOLS.md中find-skills中的[隐式推荐触发规则]来判断是否要给用户推荐。
|
|
8
|
-
---以下是用户原始请求---
|
|
9
8
|
`;
|
|
10
9
|
const PLUGIN_LOG_PREFIX = "[skill-retriever]";
|
|
11
10
|
const SKIP_KEYWORDS = ["安装", "装一下", "下载", "查询", "查找", "install", "卸载", "删除", "重载", "定时任务", "重装", "进化"];
|
|
@@ -123,21 +123,16 @@ export async function searchTools(options) {
|
|
|
123
123
|
const rawSkills = responseData.content.skills;
|
|
124
124
|
const installedSkills = getInstalledSkills();
|
|
125
125
|
const formattedData = formatSkillData(rawSkills, installedSkills);
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
const candidateTools = formattedData.filter((tool) => (tool.rrfScore ?? 0) >= 0.016);
|
|
127
|
+
logger.log(`${PLUGIN_LOG_PREFIX} [DEBUG] Candidates with rrfScore >= 0.016: ${candidateTools.length}, details: ${candidateTools.map((t) => `${t.skillId}(rrfScore=${t.rrfScore}, status=${t.status})`).join(", ")}`);
|
|
128
|
+
const hasInstalledInCandidates = candidateTools.some((tool) => tool.status === "已安装");
|
|
129
|
+
if (hasInstalledInCandidates) {
|
|
130
|
+
logger.log(`${PLUGIN_LOG_PREFIX} [DEBUG] Candidates contain installed skill, returning null`);
|
|
130
131
|
return null;
|
|
131
132
|
}
|
|
132
|
-
const
|
|
133
|
-
if (hasInstalledWithHighScore) {
|
|
134
|
-
logger.log(`${PLUGIN_LOG_PREFIX} [DEBUG] Top 2 has installed skill with rrfScore >= 0.016, returning null`);
|
|
135
|
-
return null;
|
|
136
|
-
}
|
|
137
|
-
let filteredTools = topTools.filter((tool) => tool.status === "未安装" && (tool.rrfScore ?? 0) >= 0.016);
|
|
138
|
-
logger.log(`${PLUGIN_LOG_PREFIX} [DEBUG] After filtering uninstalled with rrfScore >= 0.016: ${filteredTools.length}, details: ${filteredTools.map((t) => `${t.skillId}(rrfScore=${t.rrfScore})`).join(", ")}`);
|
|
133
|
+
const filteredTools = candidateTools.slice(0, 2);
|
|
139
134
|
if (filteredTools.length === 0) {
|
|
140
|
-
logger.log(`${PLUGIN_LOG_PREFIX} [DEBUG] No
|
|
135
|
+
logger.log(`${PLUGIN_LOG_PREFIX} [DEBUG] No candidates with rrfScore >= 0.016, returning null`);
|
|
141
136
|
return null;
|
|
142
137
|
}
|
|
143
138
|
return {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
3
4
|
/**
|
|
4
5
|
* XY calendar event tool - creates a calendar event on user's device.
|
|
5
6
|
* Requires title, dtStart (start time), and dtEnd (end time) parameters.
|
|
@@ -110,10 +111,11 @@ export function createCalendarTool(ctx) {
|
|
|
110
111
|
// Register event handler
|
|
111
112
|
wsManager.on("data-event", handler);
|
|
112
113
|
// Send the command
|
|
114
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
113
115
|
sendCommand({
|
|
114
116
|
config,
|
|
115
117
|
sessionId,
|
|
116
|
-
taskId,
|
|
118
|
+
taskId: currentTaskId,
|
|
117
119
|
messageId,
|
|
118
120
|
command,
|
|
119
121
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
3
4
|
/**
|
|
4
5
|
* XY call phone tool - makes a phone call on user's device.
|
|
5
6
|
* Requires phoneNumber parameter and optional slotId (0 for primary SIM, 1 for secondary SIM).
|
|
@@ -102,10 +103,11 @@ export function createCallPhoneTool(ctx) {
|
|
|
102
103
|
// Register event handler
|
|
103
104
|
wsManager.on("data-event", handler);
|
|
104
105
|
// Send the command
|
|
106
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
105
107
|
sendCommand({
|
|
106
108
|
config,
|
|
107
109
|
sessionId,
|
|
108
|
-
taskId,
|
|
110
|
+
taskId: currentTaskId,
|
|
109
111
|
messageId,
|
|
110
112
|
command,
|
|
111
113
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
3
4
|
// Enum definitions for alarm parameters
|
|
4
5
|
const ALARM_SNOOZE_DURATION_VALUES = [5, 10, 15, 20, 25, 30];
|
|
5
6
|
const ALARM_SNOOZE_TOTAL_VALUES = [0, 1, 3, 5, 10];
|
|
@@ -248,10 +249,11 @@ b. 使用该工具之前需获取当前真实时间
|
|
|
248
249
|
// Register event handler
|
|
249
250
|
wsManager.on("data-event", handler);
|
|
250
251
|
// Send the command
|
|
252
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
251
253
|
sendCommand({
|
|
252
254
|
config,
|
|
253
255
|
sessionId,
|
|
254
|
-
taskId,
|
|
256
|
+
taskId: currentTaskId,
|
|
255
257
|
messageId,
|
|
256
258
|
command,
|
|
257
259
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
3
4
|
/**
|
|
4
5
|
* XY delete alarm tool - deletes existing alarms on user's device.
|
|
5
6
|
* Requires entityId(s) from search_alarm or create_alarm tool as prerequisite.
|
|
@@ -147,10 +148,11 @@ export function createDeleteAlarmTool(ctx) {
|
|
|
147
148
|
// Register event handler
|
|
148
149
|
wsManager.on("data-event", handler);
|
|
149
150
|
// Send the command
|
|
151
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
150
152
|
sendCommand({
|
|
151
153
|
config,
|
|
152
154
|
sessionId,
|
|
153
|
-
taskId,
|
|
155
|
+
taskId: currentTaskId,
|
|
154
156
|
messageId,
|
|
155
157
|
command,
|
|
156
158
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
3
4
|
/**
|
|
4
5
|
* XY location tool - gets user's current location.
|
|
5
6
|
* Returns WGS84 coordinates (latitude, longitude).
|
|
@@ -80,10 +81,11 @@ export function createLocationTool(ctx) {
|
|
|
80
81
|
// Note: The WebSocket manager needs to emit 'data-event' when receiving data events
|
|
81
82
|
wsManager.on("data-event", handler);
|
|
82
83
|
// Send the command
|
|
84
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
83
85
|
sendCommand({
|
|
84
86
|
config,
|
|
85
87
|
sessionId,
|
|
86
|
-
taskId,
|
|
88
|
+
taskId: currentTaskId,
|
|
87
89
|
messageId,
|
|
88
90
|
command,
|
|
89
91
|
}).then(() => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
3
4
|
// Enum definitions for alarm parameters (same as create-alarm-tool)
|
|
4
5
|
const ALARM_SNOOZE_DURATION_VALUES = [5, 10, 15, 20, 25, 30];
|
|
5
6
|
const ALARM_SNOOZE_TOTAL_VALUES = [0, 1, 3, 5, 10];
|
|
@@ -260,10 +261,11 @@ export function createModifyAlarmTool(ctx) {
|
|
|
260
261
|
// Register event handler
|
|
261
262
|
wsManager.on("data-event", handler);
|
|
262
263
|
// Send the command
|
|
264
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
263
265
|
sendCommand({
|
|
264
266
|
config,
|
|
265
267
|
sessionId,
|
|
266
|
-
taskId,
|
|
268
|
+
taskId: currentTaskId,
|
|
267
269
|
messageId,
|
|
268
270
|
command,
|
|
269
271
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
3
4
|
/**
|
|
4
5
|
* XY modify note tool - appends content to an existing note on user's device.
|
|
5
6
|
* Requires entityId from search_notes tool as prerequisite.
|
|
@@ -101,10 +102,11 @@ export function createModifyNoteTool(ctx) {
|
|
|
101
102
|
// Register event handler
|
|
102
103
|
wsManager.on("data-event", handler);
|
|
103
104
|
// Send the command
|
|
105
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
104
106
|
sendCommand({
|
|
105
107
|
config,
|
|
106
108
|
sessionId,
|
|
107
|
-
taskId,
|
|
109
|
+
taskId: currentTaskId,
|
|
108
110
|
messageId,
|
|
109
111
|
command,
|
|
110
112
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
3
4
|
/**
|
|
4
5
|
* Duck-typed ToolInputError: openclaw 按 .name 字段匹配,不用 instanceof。
|
|
5
6
|
* 抛出此错误会让 openclaw 返回 HTTP 400 而非 500,
|
|
@@ -118,10 +119,11 @@ export function createNoteTool(ctx) {
|
|
|
118
119
|
// Register event handler
|
|
119
120
|
wsManager.on("data-event", handler);
|
|
120
121
|
// Send the command
|
|
122
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
121
123
|
sendCommand({
|
|
122
124
|
config,
|
|
123
125
|
sessionId,
|
|
124
|
-
taskId,
|
|
126
|
+
taskId: currentTaskId,
|
|
125
127
|
messageId,
|
|
126
128
|
command,
|
|
127
129
|
}).catch((error) => {
|
|
@@ -1,6 +1,7 @@
|
|
|
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";
|
|
4
5
|
class ToolInputError extends Error {
|
|
5
6
|
status = 400;
|
|
6
7
|
constructor(message) {
|
|
@@ -116,10 +117,11 @@ c. 调用工具前需认真检查调用参数是否满足工具要求
|
|
|
116
117
|
}
|
|
117
118
|
};
|
|
118
119
|
wsManager.on("data-event", handler);
|
|
120
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
119
121
|
sendCommand({
|
|
120
122
|
config,
|
|
121
123
|
sessionId,
|
|
122
|
-
taskId,
|
|
124
|
+
taskId: currentTaskId,
|
|
123
125
|
messageId,
|
|
124
126
|
command,
|
|
125
127
|
})
|
|
@@ -1,6 +1,7 @@
|
|
|
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";
|
|
4
5
|
class ToolInputError extends Error {
|
|
5
6
|
status = 400;
|
|
6
7
|
constructor(message) {
|
|
@@ -132,10 +133,11 @@ c. 调用工具前需认真检查调用参数是否满足工具要求
|
|
|
132
133
|
}
|
|
133
134
|
};
|
|
134
135
|
wsManager.on("data-event", handler);
|
|
136
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
135
137
|
sendCommand({
|
|
136
138
|
config,
|
|
137
139
|
sessionId,
|
|
138
|
-
taskId,
|
|
140
|
+
taskId: currentTaskId,
|
|
139
141
|
messageId,
|
|
140
142
|
command,
|
|
141
143
|
})
|
|
@@ -1,6 +1,7 @@
|
|
|
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";
|
|
4
5
|
class ToolInputError extends Error {
|
|
5
6
|
status = 400;
|
|
6
7
|
constructor(message) {
|
|
@@ -111,10 +112,11 @@ d. 当只传入 startTime 时,返回该时间点之后的所有任务;当只
|
|
|
111
112
|
}
|
|
112
113
|
};
|
|
113
114
|
wsManager.on("data-event", handler);
|
|
115
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
114
116
|
sendCommand({
|
|
115
117
|
config,
|
|
116
118
|
sessionId,
|
|
117
|
-
taskId,
|
|
119
|
+
taskId: currentTaskId,
|
|
118
120
|
messageId,
|
|
119
121
|
command,
|
|
120
122
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
3
4
|
import { XYFileUploadService } from "../file-upload.js";
|
|
4
5
|
/**
|
|
5
6
|
* Duck-typed ToolInputError: openclaw 按 .name 字段匹配,不用 instanceof。
|
|
@@ -142,10 +143,11 @@ export function createSaveFileToPhoneTool(ctx) {
|
|
|
142
143
|
// Register event handler
|
|
143
144
|
wsManager.on("data-event", handler);
|
|
144
145
|
// Send the command
|
|
146
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
145
147
|
sendCommand({
|
|
146
148
|
config,
|
|
147
149
|
sessionId,
|
|
148
|
-
taskId,
|
|
150
|
+
taskId: currentTaskId,
|
|
149
151
|
messageId,
|
|
150
152
|
command,
|
|
151
153
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
3
4
|
import { XYFileUploadService } from "../file-upload.js";
|
|
4
5
|
/**
|
|
5
6
|
* Duck-typed ToolInputError: openclaw 按 .name 字段匹配,不用 instanceof。
|
|
@@ -150,10 +151,11 @@ export function createSaveMediaToGalleryTool(ctx) {
|
|
|
150
151
|
// Register event handler
|
|
151
152
|
wsManager.on("data-event", handler);
|
|
152
153
|
// Send the command
|
|
154
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
153
155
|
sendCommand({
|
|
154
156
|
config,
|
|
155
157
|
sessionId,
|
|
156
|
-
taskId,
|
|
158
|
+
taskId: currentTaskId,
|
|
157
159
|
messageId,
|
|
158
160
|
command,
|
|
159
161
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
3
4
|
// Enum definitions for alarm search parameters
|
|
4
5
|
const RANGE_TYPE_VALUES = ["all", "next", "current"];
|
|
5
6
|
const ALARM_STATE_VALUES = [0, 1];
|
|
@@ -192,10 +193,11 @@ b. 使用该工具之前需获取当前真实时间
|
|
|
192
193
|
// Register event handler
|
|
193
194
|
wsManager.on("data-event", handler);
|
|
194
195
|
// Send the command
|
|
196
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
195
197
|
sendCommand({
|
|
196
198
|
config,
|
|
197
199
|
sessionId,
|
|
198
|
-
taskId,
|
|
200
|
+
taskId: currentTaskId,
|
|
199
201
|
messageId,
|
|
200
202
|
command,
|
|
201
203
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
3
4
|
/**
|
|
4
5
|
* XY search calendar event tool - searches calendar events on user's device.
|
|
5
6
|
* Returns matching events based on time range and optional title filter.
|
|
@@ -163,10 +164,11 @@ d. 如果查询结果返回-303,代表查询结果为空
|
|
|
163
164
|
// Register event handler
|
|
164
165
|
wsManager.on("data-event", handler);
|
|
165
166
|
// Send the command
|
|
167
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
166
168
|
sendCommand({
|
|
167
169
|
config,
|
|
168
170
|
sessionId,
|
|
169
|
-
taskId,
|
|
171
|
+
taskId: currentTaskId,
|
|
170
172
|
messageId,
|
|
171
173
|
command,
|
|
172
174
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
3
4
|
/**
|
|
4
5
|
* XY search contact tool - searches contacts on user's device.
|
|
5
6
|
* Returns matching contact information based on name.
|
|
@@ -91,10 +92,11 @@ export function createSearchContactTool(ctx) {
|
|
|
91
92
|
// Register event handler
|
|
92
93
|
wsManager.on("data-event", handler);
|
|
93
94
|
// Send the command
|
|
95
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
94
96
|
sendCommand({
|
|
95
97
|
config,
|
|
96
98
|
sessionId,
|
|
97
|
-
taskId,
|
|
99
|
+
taskId: currentTaskId,
|
|
98
100
|
messageId,
|
|
99
101
|
command,
|
|
100
102
|
})
|
|
@@ -1,6 +1,7 @@
|
|
|
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";
|
|
4
5
|
/**
|
|
5
6
|
* XY search email tool - searches emails on user's device (花瓣邮箱).
|
|
6
7
|
* Returns matching emails based on query text and search type.
|
|
@@ -114,10 +115,11 @@ b. 使用该工具之前需获取当前真实时间
|
|
|
114
115
|
// Register event handler
|
|
115
116
|
wsManager.on("data-event", handler);
|
|
116
117
|
// Send the command
|
|
118
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
117
119
|
sendCommand({
|
|
118
120
|
config,
|
|
119
121
|
sessionId,
|
|
120
|
-
taskId,
|
|
122
|
+
taskId: currentTaskId,
|
|
121
123
|
messageId,
|
|
122
124
|
command,
|
|
123
125
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
3
4
|
/**
|
|
4
5
|
* XY search file tool - searches files on user's device file system.
|
|
5
6
|
* Returns matching files based on keyword search in file name or content.
|
|
@@ -104,10 +105,11 @@ export function createSearchFileTool(ctx) {
|
|
|
104
105
|
// Register event handler
|
|
105
106
|
wsManager.on("data-event", handler);
|
|
106
107
|
// Send the command
|
|
108
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
107
109
|
sendCommand({
|
|
108
110
|
config,
|
|
109
111
|
sessionId,
|
|
110
|
-
taskId,
|
|
112
|
+
taskId: currentTaskId,
|
|
111
113
|
messageId,
|
|
112
114
|
command,
|
|
113
115
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
3
4
|
/**
|
|
4
5
|
* XY search message tool - searches SMS messages on user's device.
|
|
5
6
|
* Returns matching messages based on content keyword search.
|
|
@@ -93,10 +94,11 @@ export function createSearchMessageTool(ctx) {
|
|
|
93
94
|
// Register event handler
|
|
94
95
|
wsManager.on("data-event", handler);
|
|
95
96
|
// Send the command
|
|
97
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
96
98
|
sendCommand({
|
|
97
99
|
config,
|
|
98
100
|
sessionId,
|
|
99
|
-
taskId,
|
|
101
|
+
taskId: currentTaskId,
|
|
100
102
|
messageId,
|
|
101
103
|
command,
|
|
102
104
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
3
4
|
/**
|
|
4
5
|
* XY search note tool - searches notes on user's device.
|
|
5
6
|
* Returns matching notes based on query string.
|
|
@@ -90,10 +91,11 @@ export function createSearchNoteTool(ctx) {
|
|
|
90
91
|
// Register event handler
|
|
91
92
|
wsManager.on("data-event", handler);
|
|
92
93
|
// Send the command
|
|
94
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
93
95
|
sendCommand({
|
|
94
96
|
config,
|
|
95
97
|
sessionId,
|
|
96
|
-
taskId,
|
|
98
|
+
taskId: currentTaskId,
|
|
97
99
|
messageId,
|
|
98
100
|
command,
|
|
99
101
|
}).then(() => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
3
4
|
/**
|
|
4
5
|
* XY search photo gallery tool - searches photos in user's gallery.
|
|
5
6
|
* Returns local mediaUri strings that can be used with upload_photo tool.
|
|
@@ -72,7 +73,8 @@ export function createSearchPhotoGalleryTool(ctx) {
|
|
|
72
73
|
// Get WebSocket manager
|
|
73
74
|
const wsManager = getXYWebSocketManager(config);
|
|
74
75
|
// Search for photos
|
|
75
|
-
const
|
|
76
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
77
|
+
const outputs = await searchPhotos(wsManager, config, sessionId, currentTaskId, messageId, params.query);
|
|
76
78
|
return {
|
|
77
79
|
content: [
|
|
78
80
|
{
|
|
@@ -1,6 +1,7 @@
|
|
|
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";
|
|
4
5
|
class ToolInputError extends Error {
|
|
5
6
|
status = 400;
|
|
6
7
|
constructor(message) {
|
|
@@ -112,10 +113,11 @@ c. 调用工具前需认真检查调用参数是否满足工具要求
|
|
|
112
113
|
}
|
|
113
114
|
};
|
|
114
115
|
wsManager.on("data-event", handler);
|
|
116
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
115
117
|
sendCommand({
|
|
116
118
|
config,
|
|
117
119
|
sessionId,
|
|
118
|
-
taskId,
|
|
120
|
+
taskId: currentTaskId,
|
|
119
121
|
messageId,
|
|
120
122
|
command,
|
|
121
123
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
3
4
|
/**
|
|
4
5
|
* XY send message tool - sends SMS message on user's device.
|
|
5
6
|
* Requires phoneNumber (with +86 prefix) and content parameters.
|
|
@@ -114,10 +115,11 @@ export function createSendMessageTool(ctx) {
|
|
|
114
115
|
// Register event handler
|
|
115
116
|
wsManager.on("data-event", handler);
|
|
116
117
|
// Send the command
|
|
118
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
117
119
|
sendCommand({
|
|
118
120
|
config,
|
|
119
121
|
sessionId,
|
|
120
|
-
taskId,
|
|
122
|
+
taskId: currentTaskId,
|
|
121
123
|
messageId,
|
|
122
124
|
command,
|
|
123
125
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
3
4
|
/**
|
|
4
5
|
* XY upload file tool - uploads local files to get publicly accessible URLs.
|
|
5
6
|
* Requires file URIs from search_file tool as prerequisite.
|
|
@@ -94,7 +95,8 @@ export function createUploadFileTool(ctx) {
|
|
|
94
95
|
// Get WebSocket manager
|
|
95
96
|
const wsManager = getXYWebSocketManager(config);
|
|
96
97
|
// Get public URLs for the files
|
|
97
|
-
const
|
|
98
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
99
|
+
const fileUrls = await getFileUrls(wsManager, config, sessionId, currentTaskId, messageId, fileInfos);
|
|
98
100
|
return {
|
|
99
101
|
content: [
|
|
100
102
|
{
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
3
4
|
/**
|
|
4
5
|
* XY upload photo tool - uploads local photos to get publicly accessible URLs.
|
|
5
6
|
* Requires mediaUris from search_photo_gallery tool as prerequisite.
|
|
@@ -75,7 +76,8 @@ export function createUploadPhotoTool(ctx) {
|
|
|
75
76
|
// Get WebSocket manager
|
|
76
77
|
const wsManager = getXYWebSocketManager(config);
|
|
77
78
|
// Get public URLs for the photos
|
|
78
|
-
const
|
|
79
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
80
|
+
const imageUrls = await getPhotoUrls(wsManager, config, sessionId, currentTaskId, messageId, mediaUris);
|
|
79
81
|
return {
|
|
80
82
|
content: [
|
|
81
83
|
{
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
3
4
|
import { XYFileUploadService } from "../file-upload.js";
|
|
4
5
|
/**
|
|
5
6
|
* Duck-typed ToolInputError: openclaw 按 .name 字段匹配,不用 instanceof。
|
|
@@ -168,10 +169,11 @@ export function createXiaoyiAddCollectionTool(ctx) {
|
|
|
168
169
|
// Register event handler
|
|
169
170
|
wsManager.on("data-event", handler);
|
|
170
171
|
// Send the command
|
|
172
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
171
173
|
sendCommand({
|
|
172
174
|
config,
|
|
173
175
|
sessionId,
|
|
174
|
-
taskId,
|
|
176
|
+
taskId: currentTaskId,
|
|
175
177
|
messageId,
|
|
176
178
|
command,
|
|
177
179
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
3
4
|
/**
|
|
4
5
|
* Duck-typed ToolInputError: openclaw 按 .name 字段匹配,不用 instanceof。
|
|
5
6
|
* 抛出此错误会让 openclaw 返回 HTTP 400 而非 500,
|
|
@@ -124,10 +125,11 @@ export function createXiaoyiCollectionTool(ctx) {
|
|
|
124
125
|
// Register event handler
|
|
125
126
|
wsManager.on("data-event", handler);
|
|
126
127
|
// Send the command
|
|
128
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
127
129
|
sendCommand({
|
|
128
130
|
config,
|
|
129
131
|
sessionId,
|
|
130
|
-
taskId,
|
|
132
|
+
taskId: currentTaskId,
|
|
131
133
|
messageId,
|
|
132
134
|
command,
|
|
133
135
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getXYWebSocketManager } from "../client.js";
|
|
2
2
|
import { sendCommand } from "../formatter.js";
|
|
3
|
+
import { getCurrentTaskId } from "../task-manager.js";
|
|
3
4
|
/**
|
|
4
5
|
* Duck-typed ToolInputError: openclaw 按 .name 字段匹配,不用 instanceof。
|
|
5
6
|
* 抛出此错误会让 openclaw 返回 HTTP 400 而非 500,
|
|
@@ -139,10 +140,11 @@ export function createXiaoyiDeleteCollectionTool(ctx) {
|
|
|
139
140
|
// Register event handler
|
|
140
141
|
wsManager.on("data-event", handler);
|
|
141
142
|
// Send the command
|
|
143
|
+
const currentTaskId = getCurrentTaskId(sessionId) ?? taskId;
|
|
142
144
|
sendCommand({
|
|
143
145
|
config,
|
|
144
146
|
sessionId,
|
|
145
|
-
taskId,
|
|
147
|
+
taskId: currentTaskId,
|
|
146
148
|
messageId,
|
|
147
149
|
command,
|
|
148
150
|
})
|