@ynhcj/xiaoyi-channel 0.0.65-beta → 0.0.65-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.
Files changed (86) hide show
  1. package/dist/index.js +7 -4
  2. package/dist/src/bot.js +1 -0
  3. package/dist/src/channel.js +14 -19
  4. package/dist/src/cspl/call-api.js +14 -11
  5. package/dist/src/cspl/config.js +3 -3
  6. package/dist/src/cspl/constants.d.ts +2 -0
  7. package/dist/src/cspl/constants.js +12 -0
  8. package/dist/src/cspl/utils.js +4 -2
  9. package/dist/src/file-download.js +3 -6
  10. package/dist/src/file-upload.js +52 -5
  11. package/dist/src/login-token-handler.d.ts +8 -0
  12. package/dist/src/login-token-handler.js +60 -0
  13. package/dist/src/monitor.js +15 -0
  14. package/dist/src/outbound.js +2 -7
  15. package/dist/src/provider.d.ts +2 -0
  16. package/dist/src/provider.js +368 -0
  17. package/dist/src/reply-dispatcher.js +6 -0
  18. package/dist/src/self-evolution-handler.d.ts +1 -0
  19. package/dist/src/self-evolution-handler.js +47 -0
  20. package/dist/src/skill-retriever/config.d.ts +4 -0
  21. package/dist/src/skill-retriever/config.js +23 -0
  22. package/dist/src/skill-retriever/hooks.d.ts +3 -0
  23. package/dist/src/skill-retriever/hooks.js +97 -0
  24. package/dist/src/skill-retriever/tool-search.d.ts +16 -0
  25. package/dist/src/skill-retriever/tool-search.js +166 -0
  26. package/dist/src/skill-retriever/types.d.ts +34 -0
  27. package/dist/src/skill-retriever/types.js +1 -0
  28. package/dist/src/tools/call-device-tool.d.ts +5 -0
  29. package/dist/src/tools/call-device-tool.js +130 -0
  30. package/dist/src/tools/create-alarm-tool.js +5 -16
  31. package/dist/src/tools/delete-alarm-tool.js +1 -4
  32. package/dist/src/tools/device-tool-map.js +6 -0
  33. package/dist/src/tools/find-pc-devices-tool.d.ts +5 -0
  34. package/dist/src/tools/find-pc-devices-tool.js +98 -0
  35. package/dist/src/tools/get-alarm-tool-schema.d.ts +16 -0
  36. package/dist/src/tools/get-alarm-tool-schema.js +11 -0
  37. package/dist/src/tools/get-calendar-tool-schema.d.ts +16 -0
  38. package/dist/src/tools/get-calendar-tool-schema.js +9 -0
  39. package/dist/src/tools/get-collection-tool-schema.d.ts +16 -0
  40. package/dist/src/tools/get-collection-tool-schema.js +10 -0
  41. package/dist/src/tools/get-contact-tool-schema.d.ts +16 -0
  42. package/dist/src/tools/get-contact-tool-schema.js +11 -0
  43. package/dist/src/tools/get-device-file-tool-schema.d.ts +16 -0
  44. package/dist/src/tools/get-device-file-tool-schema.js +10 -0
  45. package/dist/src/tools/get-email-tool-schema.d.ts +16 -0
  46. package/dist/src/tools/get-email-tool-schema.js +9 -0
  47. package/dist/src/tools/get-note-tool-schema.d.ts +16 -0
  48. package/dist/src/tools/get-note-tool-schema.js +10 -0
  49. package/dist/src/tools/get-photo-tool-schema.d.ts +16 -0
  50. package/dist/src/tools/get-photo-tool-schema.js +10 -0
  51. package/dist/src/tools/image-reading-tool.js +4 -7
  52. package/dist/src/tools/login-token-tool.d.ts +5 -0
  53. package/dist/src/tools/login-token-tool.js +136 -0
  54. package/dist/src/tools/modify-alarm-tool.js +10 -23
  55. package/dist/src/tools/query-app-message-tool.d.ts +4 -0
  56. package/dist/src/tools/query-app-message-tool.js +138 -0
  57. package/dist/src/tools/query-memory-data-tool.d.ts +4 -0
  58. package/dist/src/tools/query-memory-data-tool.js +154 -0
  59. package/dist/src/tools/query-todo-task-tool.d.ts +4 -0
  60. package/dist/src/tools/query-todo-task-tool.js +133 -0
  61. package/dist/src/tools/save-file-to-phone-tool.d.ts +5 -0
  62. package/dist/src/tools/save-file-to-phone-tool.js +166 -0
  63. package/dist/src/tools/save-media-to-gallery-tool.d.ts +5 -0
  64. package/dist/src/tools/save-media-to-gallery-tool.js +174 -0
  65. package/dist/src/tools/schema-tool-factory.d.ts +27 -0
  66. package/dist/src/tools/schema-tool-factory.js +32 -0
  67. package/dist/src/tools/search-alarm-tool.js +6 -13
  68. package/dist/src/tools/search-calendar-tool.js +2 -0
  69. package/dist/src/tools/search-email-tool.d.ts +5 -0
  70. package/dist/src/tools/search-email-tool.js +137 -0
  71. package/dist/src/tools/search-file-tool.js +4 -4
  72. package/dist/src/tools/search-message-tool.js +1 -0
  73. package/dist/src/tools/search-photo-gallery-tool.js +2 -2
  74. package/dist/src/tools/send-email-tool.d.ts +4 -0
  75. package/dist/src/tools/send-email-tool.js +134 -0
  76. package/dist/src/tools/send-file-to-user-tool.js +2 -4
  77. package/dist/src/tools/upload-file-tool.js +4 -4
  78. package/dist/src/tools/upload-photo-tool.js +2 -2
  79. package/dist/src/tools/xiaoyi-add-collection-tool.d.ts +4 -0
  80. package/dist/src/tools/xiaoyi-add-collection-tool.js +192 -0
  81. package/dist/src/tools/xiaoyi-collection-tool.js +43 -7
  82. package/dist/src/tools/xiaoyi-delete-collection-tool.d.ts +4 -0
  83. package/dist/src/tools/xiaoyi-delete-collection-tool.js +163 -0
  84. package/dist/src/websocket.js +19 -0
  85. package/openclaw.plugin.json +1 -0
  86. package/package.json +1 -1
@@ -0,0 +1,4 @@
1
+ /**
2
+ * 获取指定时间范围内的全局待办任务列表。
3
+ */
4
+ export declare const queryTodoTaskTool: any;
@@ -0,0 +1,133 @@
1
+ // QueryTodoTask tool implementation
2
+ import { getXYWebSocketManager } from "../client.js";
3
+ import { sendCommand } from "../formatter.js";
4
+ import { getCurrentSessionContext } from "./session-manager.js";
5
+ class ToolInputError extends Error {
6
+ status = 400;
7
+ constructor(message) {
8
+ super(message);
9
+ this.name = "ToolInputError";
10
+ }
11
+ }
12
+ /**
13
+ * 获取指定时间范围内的全局待办任务列表。
14
+ */
15
+ export const queryTodoTaskTool = {
16
+ name: "query_todo_task",
17
+ label: "Query Todo Task",
18
+ description: `获取指定时间范围内的全局待办任务列表。适用于需要查询历史任务、按完成状态筛选、或仅查看待处理任务的场景。支持按时间范围、任务状态进行过滤。
19
+ 注意:
20
+ a. 操作超时时间为60秒,请勿重复调用此工具
21
+ b. 如果遇到各类调用失败场景,最多只能重试一次,不可以重复调用多次。
22
+ c. 调用工具前需认真检查调用参数是否满足工具要求
23
+ d. 当只传入 startTime 时,返回该时间点之后的所有任务;当只传入 endTime 时,返回该时间点之前的所有任务;两者都不传则返回所有时间段的任务。
24
+
25
+ 回复约束:如果工具返回没有授权或者其他报错,只需要完整描述没有授权或者其他报错内容即可,不需要主动给用户提供解决方案,例如告诉用户如何授权,如何解决报错等都是不需要的,请严格遵守。`,
26
+ parameters: {
27
+ type: "object",
28
+ properties: {
29
+ startTime: {
30
+ type: "string",
31
+ description: "查询创建时间大于此值的任务(ISO 8601 字符串,如 2024-01-01T00:00:00Z)。",
32
+ },
33
+ endTime: {
34
+ type: "string",
35
+ description: "查询创建时间小于此值的任务(ISO 8601 字符串,如 2024-01-31T23:59:59Z)。",
36
+ },
37
+ status: {
38
+ type: "string",
39
+ description: '任务完成状态过滤。可选值为 "all"、"completed"、"pending"。默认为 "all"。',
40
+ },
41
+ },
42
+ required: [],
43
+ },
44
+ async execute(_toolCallId, params) {
45
+ const { status } = params;
46
+ if (status && !["all", "completed", "pending"].includes(status)) {
47
+ throw new ToolInputError('status 参数只能为 "all"、"completed" 或 "pending"');
48
+ }
49
+ const sessionContext = getCurrentSessionContext();
50
+ if (!sessionContext) {
51
+ throw new Error("No active XY session found.");
52
+ }
53
+ const { config, sessionId, taskId, messageId } = sessionContext;
54
+ const wsManager = getXYWebSocketManager(config);
55
+ const intentParam = {};
56
+ if (params.startTime !== undefined)
57
+ intentParam.startTime = params.startTime;
58
+ if (params.endTime !== undefined)
59
+ intentParam.endTime = params.endTime;
60
+ if (status !== undefined)
61
+ intentParam.status = status;
62
+ const command = {
63
+ header: {
64
+ namespace: "Common",
65
+ name: "Action",
66
+ },
67
+ payload: {
68
+ cardParam: {},
69
+ executeParam: {
70
+ executeMode: "background",
71
+ intentName: "QueryTodoTask",
72
+ bundleName: "com.huawei.hmos.vassistant",
73
+ needUnlock: true,
74
+ actionResponse: true,
75
+ appType: "OHOS_APP",
76
+ timeOut: 5,
77
+ intentParam,
78
+ permissionId: [],
79
+ achieveType: "INTENT",
80
+ },
81
+ responses: [
82
+ {
83
+ resultCode: "",
84
+ displayText: "",
85
+ ttsText: "",
86
+ },
87
+ ],
88
+ needUploadResult: true,
89
+ noHalfPage: false,
90
+ pageControlRelated: false,
91
+ },
92
+ };
93
+ return new Promise((resolve, reject) => {
94
+ const timeout = setTimeout(() => {
95
+ wsManager.off("data-event", handler);
96
+ reject(new Error("查询待办任务超时(60秒)"));
97
+ }, 60000);
98
+ const handler = (event) => {
99
+ if (event.intentName === "QueryTodoTask") {
100
+ clearTimeout(timeout);
101
+ wsManager.off("data-event", handler);
102
+ if (event.status === "success" && event.outputs) {
103
+ resolve({
104
+ content: [
105
+ {
106
+ type: "text",
107
+ text: JSON.stringify(event.outputs),
108
+ },
109
+ ],
110
+ });
111
+ }
112
+ else {
113
+ reject(new Error(`查询待办任务失败: ${event.status}`));
114
+ }
115
+ }
116
+ };
117
+ wsManager.on("data-event", handler);
118
+ sendCommand({
119
+ config,
120
+ sessionId,
121
+ taskId,
122
+ messageId,
123
+ command,
124
+ })
125
+ .then(() => { })
126
+ .catch((error) => {
127
+ clearTimeout(timeout);
128
+ wsManager.off("data-event", handler);
129
+ reject(error);
130
+ });
131
+ });
132
+ },
133
+ };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * XY save file to phone tool - saves files to user's device file manager.
3
+ * Supports local file paths (auto-uploaded to get public URL) and public URLs.
4
+ */
5
+ export declare const saveFileToPhoneTool: any;
@@ -0,0 +1,166 @@
1
+ import { getXYWebSocketManager } from "../client.js";
2
+ import { sendCommand } from "../formatter.js";
3
+ import { getCurrentSessionContext } from "./session-manager.js";
4
+ import { XYFileUploadService } from "../file-upload.js";
5
+ /**
6
+ * Duck-typed ToolInputError: openclaw 按 .name 字段匹配,不用 instanceof。
7
+ * 抛出此错误会让 openclaw 返回 HTTP 400 而非 500,
8
+ * LLM 会将其识别为参数错误而非瞬时故障,不会触发重试。
9
+ */
10
+ class ToolInputError extends Error {
11
+ status = 400;
12
+ constructor(message) {
13
+ super(message);
14
+ this.name = "ToolInputError";
15
+ }
16
+ }
17
+ /**
18
+ * XY save file to phone tool - saves files to user's device file manager.
19
+ * Supports local file paths (auto-uploaded to get public URL) and public URLs.
20
+ */
21
+ export const saveFileToPhoneTool = {
22
+ name: "save_file_to_file_manager",
23
+ label: "Save File to Phone",
24
+ description: `将文件保存到手机文件管理器。
25
+
26
+ 注意:
27
+ a. 操作超时时间为60秒,请勿重复调用此工具
28
+ b. 如果遇到各类调用失败场景,不可以重试,直接返回错误。
29
+ c. 调用工具前需认真检查调用参数是否满足工具要求
30
+
31
+ 回复约束:如果工具返回没有授权或者其他报错,只需要完整描述没有授权或者其他报错内容即可,不需要主动给用户提供解决方案,例如告诉用户如何授权,如何解决报错等都是不需要的,请严格遵守。
32
+ `,
33
+ parameters: {
34
+ type: "object",
35
+ properties: {
36
+ fileName: {
37
+ type: "string",
38
+ description: "必填,文件名称。",
39
+ },
40
+ url: {
41
+ type: "string",
42
+ description: "必填,支持本地路径或者公网url路径。如果是本地路径会先上传获取公网url。",
43
+ },
44
+ suffix: {
45
+ type: "string",
46
+ description: "必填,文件后缀,例如 ppt、doc、pdf 等。",
47
+ },
48
+ },
49
+ required: ["fileName", "url", "suffix"],
50
+ },
51
+ async execute(toolCallId, params) {
52
+ // Validate parameters
53
+ const { fileName, url, suffix } = params;
54
+ if (!url || typeof url !== "string") {
55
+ throw new ToolInputError("缺少必填参数: url");
56
+ }
57
+ if (!fileName || typeof fileName !== "string") {
58
+ throw new ToolInputError("缺少必填参数: fileName");
59
+ }
60
+ if (!suffix || typeof suffix !== "string") {
61
+ throw new ToolInputError("缺少必填参数: suffix");
62
+ }
63
+ // Get session context
64
+ const sessionContext = getCurrentSessionContext();
65
+ if (!sessionContext) {
66
+ throw new Error("No active XY session found. SaveFileToFileManager tool can only be used during an active conversation.");
67
+ }
68
+ const { config, sessionId, taskId, messageId } = sessionContext;
69
+ // Get WebSocket manager
70
+ const wsManager = getXYWebSocketManager(config);
71
+ // Determine the URL: if it's a local path, upload first to get public URL
72
+ let publicUrl = url;
73
+ if (!url.startsWith("http://") && !url.startsWith("https://")) {
74
+ // Local file path - upload to get public URL
75
+ const uploadService = new XYFileUploadService(config.fileUploadUrl, config.apiKey, config.uid);
76
+ publicUrl = await uploadService.uploadFileAndGetUrl(url);
77
+ if (!publicUrl) {
78
+ throw new Error("本地文件上传失败,无法获取公网URL");
79
+ }
80
+ }
81
+ // Build intentParam
82
+ const intentParam = {
83
+ fileName: fileName,
84
+ url: publicUrl,
85
+ suffix: suffix,
86
+ };
87
+ // Build SaveFileToFileManager command
88
+ const command = {
89
+ header: {
90
+ namespace: "Common",
91
+ name: "Action",
92
+ },
93
+ payload: {
94
+ cardParam: {},
95
+ executeParam: {
96
+ executeMode: "background",
97
+ intentName: "SaveFileToFileManager",
98
+ bundleName: "com.huawei.hmos.vassistant",
99
+ dimension: "",
100
+ needUnlock: true,
101
+ actionResponse: true,
102
+ appType: "OHOS_APP",
103
+ timeOut: 5,
104
+ timeout: 55000,
105
+ intentParam,
106
+ permissionId: ["ohos.permission.WRITE_IMAGEVIDEO"],
107
+ achieveType: "INTENT",
108
+ },
109
+ responses: [
110
+ {
111
+ resultCode: "",
112
+ displayText: "",
113
+ ttsText: "",
114
+ },
115
+ ],
116
+ needUploadResult: true,
117
+ noHalfPage: false,
118
+ pageControlRelated: false,
119
+ },
120
+ };
121
+ // Send command and wait for response (60 second timeout)
122
+ return new Promise((resolve, reject) => {
123
+ const timeout = setTimeout(() => {
124
+ wsManager.off("data-event", handler);
125
+ reject(new Error("保存文件到手机超时(60秒)"));
126
+ }, 60000);
127
+ // Listen for data events from WebSocket
128
+ const handler = (event) => {
129
+ if (event.intentName === "SaveFileToFileManager") {
130
+ clearTimeout(timeout);
131
+ wsManager.off("data-event", handler);
132
+ if (event.status === "success" && event.outputs) {
133
+ resolve({
134
+ content: [
135
+ {
136
+ type: "text",
137
+ text: JSON.stringify(event.outputs),
138
+ }
139
+ ]
140
+ });
141
+ }
142
+ else {
143
+ reject(new Error(`保存文件到手机失败: ${event.status}`));
144
+ }
145
+ }
146
+ };
147
+ // Register event handler
148
+ wsManager.on("data-event", handler);
149
+ // Send the command
150
+ sendCommand({
151
+ config,
152
+ sessionId,
153
+ taskId,
154
+ messageId,
155
+ command,
156
+ })
157
+ .then(() => {
158
+ })
159
+ .catch((error) => {
160
+ clearTimeout(timeout);
161
+ wsManager.off("data-event", handler);
162
+ reject(error);
163
+ });
164
+ });
165
+ },
166
+ };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * XY save media to gallery tool - saves image or video files to user's device gallery.
3
+ * Supports local file paths (auto-uploaded to get public URL) and public URLs.
4
+ */
5
+ export declare const saveMediaToGalleryTool: any;
@@ -0,0 +1,174 @@
1
+ import { getXYWebSocketManager } from "../client.js";
2
+ import { sendCommand } from "../formatter.js";
3
+ import { getCurrentSessionContext } from "./session-manager.js";
4
+ import { XYFileUploadService } from "../file-upload.js";
5
+ /**
6
+ * Duck-typed ToolInputError: openclaw 按 .name 字段匹配,不用 instanceof。
7
+ * 抛出此错误会让 openclaw 返回 HTTP 400 而非 500,
8
+ * LLM 会将其识别为参数错误而非瞬时故障,不会触发重试。
9
+ */
10
+ class ToolInputError extends Error {
11
+ status = 400;
12
+ constructor(message) {
13
+ super(message);
14
+ this.name = "ToolInputError";
15
+ }
16
+ }
17
+ /**
18
+ * XY save media to gallery tool - saves image or video files to user's device gallery.
19
+ * Supports local file paths (auto-uploaded to get public URL) and public URLs.
20
+ */
21
+ export const saveMediaToGalleryTool = {
22
+ name: "save_media_to_gallery",
23
+ label: "Save Media to Gallery",
24
+ description: `将图片文件或者视频文件保存到设备图库。
25
+
26
+ 注意:
27
+ a. 操作超时时间为60秒,请勿重复调用此工具
28
+ b. 如果遇到各类调用失败场景,最多只能重试一次,不可以重复调用多次。
29
+ c. 调用工具前需认真检查调用参数是否满足工具要求
30
+
31
+ 回复约束:如果工具返回没有授权或者其他报错,只需要完整描述没有授权或者其他报错内容即可,不需要主动给用户提供解决方案,例如告诉用户如何授权,如何解决报错等都是不需要的,请严格遵守。
32
+ `,
33
+ parameters: {
34
+ type: "object",
35
+ properties: {
36
+ mediaType: {
37
+ type: "string",
38
+ description: "非必填,不传默认为pic。支持 pic(图片) 或 video(视频)。",
39
+ },
40
+ fileName: {
41
+ type: "string",
42
+ description: "非必填,文件名称,不传手机侧默认生成随机uuid。",
43
+ },
44
+ url: {
45
+ type: "string",
46
+ description: "必填,支持本地路径或者公网url路径。如果是本地路径,会先上传获取公网url再保存到图库",
47
+ },
48
+ },
49
+ required: ["url"],
50
+ },
51
+ async execute(toolCallId, params) {
52
+ // Validate parameters
53
+ const { mediaType, fileName, url } = params;
54
+ if (!url || typeof url !== "string") {
55
+ throw new ToolInputError("缺少必填参数: url");
56
+ }
57
+ if (mediaType && !["pic", "video"].includes(mediaType)) {
58
+ throw new ToolInputError(`mediaType只支持 pic 或 video,当前值: ${mediaType}`);
59
+ }
60
+ // Strip file extension from fileName if present
61
+ let sanitizedFileName = fileName;
62
+ if (sanitizedFileName && typeof sanitizedFileName === "string") {
63
+ const lastDot = sanitizedFileName.lastIndexOf(".");
64
+ if (lastDot > 0) {
65
+ sanitizedFileName = sanitizedFileName.substring(0, lastDot);
66
+ }
67
+ }
68
+ // Get session context
69
+ const sessionContext = getCurrentSessionContext();
70
+ if (!sessionContext) {
71
+ throw new Error("No active XY session found. SaveMediaToGallery tool can only be used during an active conversation.");
72
+ }
73
+ const { config, sessionId, taskId, messageId } = sessionContext;
74
+ // Get WebSocket manager
75
+ const wsManager = getXYWebSocketManager(config);
76
+ // Determine the URL: if it's a local path, upload first to get public URL
77
+ let publicUrl = url;
78
+ if (!url.startsWith("http://") && !url.startsWith("https://")) {
79
+ // Local file path - upload to get public URL
80
+ const uploadService = new XYFileUploadService(config.fileUploadUrl, config.apiKey, config.uid);
81
+ publicUrl = await uploadService.uploadFileAndGetUrl(url);
82
+ if (!publicUrl) {
83
+ throw new Error("本地文件上传失败,无法获取公网URL");
84
+ }
85
+ }
86
+ // Build intentParam
87
+ const intentParam = {
88
+ url: publicUrl,
89
+ };
90
+ if (mediaType) {
91
+ intentParam.mediaType = mediaType;
92
+ }
93
+ if (sanitizedFileName) {
94
+ intentParam.fileName = sanitizedFileName;
95
+ }
96
+ // Build SaveMediaToGallery command
97
+ const command = {
98
+ header: {
99
+ namespace: "Common",
100
+ name: "Action",
101
+ },
102
+ payload: {
103
+ cardParam: {},
104
+ executeParam: {
105
+ executeMode: "background",
106
+ intentName: "SaveMediaToGallery",
107
+ bundleName: "com.huawei.hmos.vassistant",
108
+ dimension: "",
109
+ needUnlock: true,
110
+ actionResponse: true,
111
+ appType: "OHOS_APP",
112
+ timeOut: 5,
113
+ intentParam,
114
+ permissionId: ["ohos.permission.WRITE_IMAGEVIDEO"],
115
+ achieveType: "INTENT",
116
+ },
117
+ responses: [
118
+ {
119
+ resultCode: "",
120
+ displayText: "",
121
+ ttsText: "",
122
+ },
123
+ ],
124
+ needUploadResult: true,
125
+ noHalfPage: false,
126
+ pageControlRelated: false,
127
+ },
128
+ };
129
+ // Send command and wait for response (60 second timeout)
130
+ return new Promise((resolve, reject) => {
131
+ const timeout = setTimeout(() => {
132
+ wsManager.off("data-event", handler);
133
+ reject(new Error("保存媒体到图库超时(60秒)"));
134
+ }, 60000);
135
+ // Listen for data events from WebSocket
136
+ const handler = (event) => {
137
+ if (event.intentName === "SaveMediaToGallery") {
138
+ clearTimeout(timeout);
139
+ wsManager.off("data-event", handler);
140
+ if (event.status === "success" && event.outputs) {
141
+ resolve({
142
+ content: [
143
+ {
144
+ type: "text",
145
+ text: JSON.stringify(event.outputs),
146
+ }
147
+ ]
148
+ });
149
+ }
150
+ else {
151
+ reject(new Error(`保存媒体到图库失败: ${event.status}`));
152
+ }
153
+ }
154
+ };
155
+ // Register event handler
156
+ wsManager.on("data-event", handler);
157
+ // Send the command
158
+ sendCommand({
159
+ config,
160
+ sessionId,
161
+ taskId,
162
+ messageId,
163
+ command,
164
+ })
165
+ .then(() => {
166
+ })
167
+ .catch((error) => {
168
+ clearTimeout(timeout);
169
+ wsManager.off("data-event", handler);
170
+ reject(error);
171
+ });
172
+ });
173
+ },
174
+ };
@@ -0,0 +1,27 @@
1
+ /**
2
+ * schema-tool-factory: 创建 get_xxx_tool_schema 工具。
3
+ * 每个工具在被 LLM 调用时,返回其所包含的子工具的 name / description / parameters schema。
4
+ */
5
+ interface SchemaToolOptions {
6
+ name: string;
7
+ label: string;
8
+ description: string;
9
+ tools: any[];
10
+ }
11
+ export declare function createSchemaTool(options: SchemaToolOptions): {
12
+ name: string;
13
+ label: string;
14
+ description: string;
15
+ parameters: {
16
+ type: "object";
17
+ properties: {};
18
+ required: string[];
19
+ };
20
+ execute(_toolCallId: string, _params: any): Promise<{
21
+ content: {
22
+ type: "text";
23
+ text: string;
24
+ }[];
25
+ }>;
26
+ };
27
+ export {};
@@ -0,0 +1,32 @@
1
+ /**
2
+ * schema-tool-factory: 创建 get_xxx_tool_schema 工具。
3
+ * 每个工具在被 LLM 调用时,返回其所包含的子工具的 name / description / parameters schema。
4
+ */
5
+ export function createSchemaTool(options) {
6
+ const { name, label, description, tools } = options;
7
+ return {
8
+ name,
9
+ label,
10
+ description,
11
+ parameters: {
12
+ type: "object",
13
+ properties: {},
14
+ required: [],
15
+ },
16
+ async execute(_toolCallId, _params) {
17
+ const schemas = tools.map((t) => ({
18
+ name: t.name,
19
+ description: t.description,
20
+ parameters: t.parameters,
21
+ }));
22
+ return {
23
+ content: [
24
+ {
25
+ type: "text",
26
+ text: JSON.stringify(schemas, null, 2),
27
+ },
28
+ ],
29
+ };
30
+ },
31
+ };
32
+ }
@@ -15,14 +15,7 @@ const DAYS_OF_WAKE_TYPE_VALUES = [0, 1, 2, 3, 4];
15
15
  export const searchAlarmTool = {
16
16
  name: "search_alarm",
17
17
  label: "Search Alarm",
18
- description: `检索用户设备上的闹钟。支持多种检索条件,至少需要提供一个检索条件,多个条件可以组合使用。
19
-
20
- 检索条件(至少提供一个):
21
- - rangeType: 查询范围,枚举值:all=查询所有闹钟,next=查找下一个响铃闹钟,current=一小时内最近一次增查改的闹钟
22
- - alarmState: 闹钟开启状态,0=关闭,1=开启
23
- - daysOfWakeType: 闹钟响铃类型,0=单次响铃,1=法定节假日,2=每天,3=自定义时间,4=法定工作日
24
- - startTime: 时间间隔开始,格式 YYYYMMDD hhmmss(例如:20240315 000000),需要与 endTime 一起使用
25
- - endTime: 时间间隔结束,格式 YYYYMMDD hhmmss(例如:20240315 235959),需要与 startTime 一起使用
18
+ description: `检索用户设备上的闹钟。至少需要提供一个检索条件,多个条件可以组合使用。
26
19
 
27
20
  使用示例:
28
21
  - 查询所有闹钟:{"rangeType": "all"}
@@ -41,25 +34,25 @@ b. 使用该工具之前需获取当前真实时间
41
34
  rangeType: {
42
35
  type: "string",
43
36
  enum: ["all", "next", "current"],
44
- description: "查询范围:all=所有闹钟,next=下一个响铃闹钟,current=一小时内最近修改的闹钟",
37
+ description: "(检索条件之一)查询范围,枚举值:all=查询所有闹钟,next=查找下一个响铃闹钟,current=一小时内最近一次增查改的闹钟",
45
38
  },
46
39
  alarmState: {
47
40
  type: "number",
48
41
  enum: [0, 1],
49
- description: "闹钟开启状态:0=关闭,1=开启",
42
+ description: "(检索条件之一)闹钟开启状态,枚举值:0=关闭,1=开启",
50
43
  },
51
44
  daysOfWakeType: {
52
45
  type: "number",
53
46
  enum: [0, 1, 2, 3, 4],
54
- description: "闹钟响铃类型:0=单次,1=法定节假日,2=每天,3=自定义,4=法定工作日",
47
+ description: "(检索条件之一)闹钟响铃类型,枚举值:0=单次响铃,1=法定节假日,2=每天,3=自定义时间,4=法定工作日",
55
48
  },
56
49
  startTime: {
57
50
  type: "string",
58
- description: "时间间隔开始,格式 YYYYMMDD hhmmss(例如:20240315 000000),必须与 endTime 一起使用",
51
+ description: "(检索条件之一)时间间隔开始,格式 YYYYMMDD hhmmss(例如:20240315 000000),必须与 endTime 一起使用",
59
52
  },
60
53
  endTime: {
61
54
  type: "string",
62
- description: "时间间隔结束,格式 YYYYMMDD hhmmss(例如:20240315 235959),必须与 startTime 一起使用",
55
+ description: "(检索条件之一)时间间隔结束,格式 YYYYMMDD hhmmss(例如:20240315 235959),必须与 startTime 一起使用",
63
56
  },
64
57
  },
65
58
  },
@@ -27,6 +27,8 @@ export const searchCalendarTool = {
27
27
  注意:
28
28
  a. 该工具执行时间较长(最多60秒),请勿重复调用,超时或失败时最多重试一次。
29
29
  b. 使用该工具之前需获取当前真实时间
30
+ c. 该工具仅支持不超过28天时间范围的日程查询,如果时间区间大于该窗口需要拆分多个时间窗口进行多次查询
31
+ d. 如果查询结果返回-303,代表查询结果为空
30
32
 
31
33
  回复约束:如果工具返回没有授权或者其他报错,只需要完整描述没有授权或者其他报错内容即可,不需要主动给用户提供解决方案,例如告诉用户如何授权,如何解决报错等都是不需要的,请严格遵守。
32
34
  `,
@@ -0,0 +1,5 @@
1
+ /**
2
+ * XY search email tool - searches emails on user's device (花瓣邮箱).
3
+ * Returns matching emails based on query text and search type.
4
+ */
5
+ export declare const searchEmailTool: any;