@ynhcj/xiaoyi-channel 0.0.43-beta → 0.0.45-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/channel.js +2 -1
- package/dist/src/formatter.js +0 -2
- package/dist/src/outbound.js +2 -2
- package/dist/src/push.d.ts +2 -1
- package/dist/src/push.js +9 -16
- package/dist/src/reply-dispatcher.js +0 -2
- package/dist/src/tools/create-alarm-tool.js +2 -18
- package/dist/src/tools/delete-alarm-tool.js +2 -13
- package/dist/src/tools/location-tool.js +6 -9
- package/dist/src/tools/modify-alarm-tool.js +2 -20
- package/dist/src/tools/modify-note-tool.js +2 -7
- package/dist/src/tools/note-tool.js +3 -13
- package/dist/src/tools/search-photo-gallery-tool.js +1 -1
- package/package.json +1 -1
package/dist/src/channel.js
CHANGED
|
@@ -14,6 +14,7 @@ import { uploadPhotoTool } from "./tools/upload-photo-tool.js";
|
|
|
14
14
|
import { xiaoyiGuiTool } from "./tools/xiaoyi-gui-tool.js";
|
|
15
15
|
import { callPhoneTool } from "./tools/call-phone-tool.js";
|
|
16
16
|
import { searchMessageTool } from "./tools/search-message-tool.js";
|
|
17
|
+
import { sendMessageTool } from "./tools/send-message-tool.js";
|
|
17
18
|
import { searchFileTool } from "./tools/search-file-tool.js";
|
|
18
19
|
import { uploadFileTool } from "./tools/upload-file-tool.js";
|
|
19
20
|
import { createAlarmTool } from "./tools/create-alarm-tool.js";
|
|
@@ -62,7 +63,7 @@ export const xyPlugin = {
|
|
|
62
63
|
},
|
|
63
64
|
outbound: xyOutbound,
|
|
64
65
|
onboarding: xyOnboardingAdapter,
|
|
65
|
-
agentTools: [locationTool, noteTool, searchNoteTool, modifyNoteTool, calendarTool, searchCalendarTool, searchContactTool, searchPhotoGalleryTool, uploadPhotoTool, xiaoyiGuiTool, callPhoneTool, searchMessageTool, searchFileTool, uploadFileTool, createAlarmTool, searchAlarmTool, modifyAlarmTool, deleteAlarmTool, sendFileToUserTool, xiaoyiCollectionTool, viewPushResultTool],
|
|
66
|
+
agentTools: [locationTool, noteTool, searchNoteTool, modifyNoteTool, calendarTool, searchCalendarTool, searchContactTool, searchPhotoGalleryTool, uploadPhotoTool, xiaoyiGuiTool, callPhoneTool, searchMessageTool, sendMessageTool, searchFileTool, uploadFileTool, createAlarmTool, searchAlarmTool, modifyAlarmTool, deleteAlarmTool, sendFileToUserTool, xiaoyiCollectionTool, viewPushResultTool],
|
|
66
67
|
messaging: {
|
|
67
68
|
normalizeTarget: (raw) => {
|
|
68
69
|
const trimmed = raw.trim();
|
package/dist/src/formatter.js
CHANGED
|
@@ -106,9 +106,7 @@ export async function sendReasoningTextUpdate(params) {
|
|
|
106
106
|
taskId,
|
|
107
107
|
msgDetail: JSON.stringify(jsonRpcResponse),
|
|
108
108
|
};
|
|
109
|
-
log(`[REASONING_TEXT] 📤 Sending reasoningText update: sessionId=${sessionId}, taskId=${taskId}, text.length=${text.length}`);
|
|
110
109
|
await wsManager.sendMessage(sessionId, outboundMessage);
|
|
111
|
-
log(`[REASONING_TEXT] ✅ Sent successfully`);
|
|
112
110
|
}
|
|
113
111
|
/**
|
|
114
112
|
* Send an A2A task status update.
|
package/dist/src/outbound.js
CHANGED
|
@@ -147,8 +147,8 @@ export const xyOutbound = {
|
|
|
147
147
|
for (const pushId of pushIdList) {
|
|
148
148
|
try {
|
|
149
149
|
console.log(`[xyOutbound.sendText] Sending to pushId: ${pushId.substring(0, 20)}...`);
|
|
150
|
-
// 传入 pushDataId,使用 kind="data" 格式
|
|
151
|
-
await pushService.sendPush(pushText, title, undefined, actualTo, pushDataId);
|
|
150
|
+
// 传入 pushId 和 pushDataId,使用 kind="data" 格式
|
|
151
|
+
await pushService.sendPush(pushText, title, undefined, actualTo, pushDataId, pushId);
|
|
152
152
|
successCount++;
|
|
153
153
|
console.log(`[xyOutbound.sendText] ✅ Sent successfully to pushId: ${pushId.substring(0, 20)}...`);
|
|
154
154
|
}
|
package/dist/src/push.d.ts
CHANGED
|
@@ -20,8 +20,9 @@ export declare class XYPushService {
|
|
|
20
20
|
* @param data - Optional additional data
|
|
21
21
|
* @param sessionId - Optional session ID
|
|
22
22
|
* @param pushDataId - Optional pushDataId for kind="data" format
|
|
23
|
+
* @param pushId - Push ID to use (required)
|
|
23
24
|
*/
|
|
24
|
-
sendPush(content: string, title: string, data?: Record<string, any>, sessionId?: string, pushDataId?: string): Promise<void>;
|
|
25
|
+
sendPush(content: string, title: string, data?: Record<string, any>, sessionId?: string, pushDataId?: string, pushId?: string): Promise<void>;
|
|
25
26
|
/**
|
|
26
27
|
* Send a push message with file attachments.
|
|
27
28
|
*/
|
package/dist/src/push.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Push message service for scheduled tasks
|
|
2
2
|
import fetch from "node-fetch";
|
|
3
3
|
import { randomUUID } from "crypto";
|
|
4
|
-
import { configManager } from "./utils/config-manager.js";
|
|
5
4
|
/**
|
|
6
5
|
* Service for sending push messages to users.
|
|
7
6
|
* Used for outbound messages and scheduled tasks.
|
|
@@ -27,27 +26,21 @@ export class XYPushService {
|
|
|
27
26
|
* @param data - Optional additional data
|
|
28
27
|
* @param sessionId - Optional session ID
|
|
29
28
|
* @param pushDataId - Optional pushDataId for kind="data" format
|
|
29
|
+
* @param pushId - Push ID to use (required)
|
|
30
30
|
*/
|
|
31
|
-
async sendPush(content, title, data, sessionId, pushDataId) {
|
|
31
|
+
async sendPush(content, title, data, sessionId, pushDataId, pushId) {
|
|
32
32
|
const pushUrl = this.config.pushUrl || this.DEFAULT_PUSH_URL;
|
|
33
33
|
const traceId = this.generateTraceId();
|
|
34
|
-
//
|
|
35
|
-
const
|
|
36
|
-
const pushId = dynamicPushId || this.config.pushId;
|
|
34
|
+
// Use provided pushId or fall back to config pushId
|
|
35
|
+
const actualPushId = pushId || this.config.pushId;
|
|
37
36
|
console.log(`[PUSH] 📤 Preparing to send push message`);
|
|
38
37
|
console.log(`[PUSH] - Title: "${title}"`);
|
|
39
38
|
console.log(`[PUSH] - Content length: ${content.length} chars`);
|
|
40
39
|
console.log(`[PUSH] - Session ID: ${sessionId || 'none'}`);
|
|
41
40
|
console.log(`[PUSH] - Trace ID: ${traceId}`);
|
|
42
41
|
console.log(`[PUSH] - Push URL: ${pushUrl}`);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
console.log(`[PUSH] - Full dynamic pushId: ${pushId}`);
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
console.log(`[PUSH] - Using config pushId (fallback): ${pushId.substring(0, 20)}...`);
|
|
49
|
-
console.log(`[PUSH] - Full config pushId: ${pushId}`);
|
|
50
|
-
}
|
|
42
|
+
console.log(`[PUSH] - Using pushId: ${actualPushId.substring(0, 20)}...`);
|
|
43
|
+
console.log(`[PUSH] - Full pushId: ${actualPushId}`);
|
|
51
44
|
console.log(`[PUSH] - API ID: ${this.config.apiId}`);
|
|
52
45
|
console.log(`[PUSH] - UID: ${this.config.uid}`);
|
|
53
46
|
try {
|
|
@@ -57,7 +50,7 @@ export class XYPushService {
|
|
|
57
50
|
result: {
|
|
58
51
|
id: randomUUID(),
|
|
59
52
|
apiId: this.config.apiId,
|
|
60
|
-
pushId:
|
|
53
|
+
pushId: actualPushId,
|
|
61
54
|
pushText: title,
|
|
62
55
|
kind: "task",
|
|
63
56
|
artifacts: [
|
|
@@ -129,14 +122,14 @@ export class XYPushService {
|
|
|
129
122
|
console.log(`[PUSH] ✅ Push message sent successfully`);
|
|
130
123
|
console.log(`[PUSH] - Title: "${title}"`);
|
|
131
124
|
console.log(`[PUSH] - Trace ID: ${traceId}`);
|
|
132
|
-
console.log(`[PUSH] - Used pushId: ${
|
|
125
|
+
console.log(`[PUSH] - Used pushId: ${actualPushId.substring(0, 20)}...`);
|
|
133
126
|
console.log(`[PUSH] - Response:`, result);
|
|
134
127
|
}
|
|
135
128
|
catch (error) {
|
|
136
129
|
console.log(`[PUSH] ❌ Failed to send push message`);
|
|
137
130
|
console.log(`[PUSH] - Trace ID: ${traceId}`);
|
|
138
131
|
console.log(`[PUSH] - Target URL: ${pushUrl}`);
|
|
139
|
-
console.log(`[PUSH] - Push ID: ${
|
|
132
|
+
console.log(`[PUSH] - Push ID: ${actualPushId.substring(0, 20)}...`);
|
|
140
133
|
if (error instanceof Error) {
|
|
141
134
|
console.log(`[PUSH] - Error name: ${error.name}`);
|
|
142
135
|
console.log(`[PUSH] - Error message: ${error.message}`);
|
|
@@ -289,7 +289,6 @@ export function createXYReplyDispatcher(params) {
|
|
|
289
289
|
const currentTaskId = getActiveTaskId();
|
|
290
290
|
const currentMessageId = getActiveMessageId();
|
|
291
291
|
const text = payload.text ?? "";
|
|
292
|
-
log(`[PARTIAL REPLY] Partial reply chunk received, taskId: ${currentTaskId}`);
|
|
293
292
|
try {
|
|
294
293
|
if (text.length > 0) {
|
|
295
294
|
await sendReasoningTextUpdate({
|
|
@@ -300,7 +299,6 @@ export function createXYReplyDispatcher(params) {
|
|
|
300
299
|
text,
|
|
301
300
|
append: false,
|
|
302
301
|
});
|
|
303
|
-
log(`[PARTIAL REPLY] ✅ Sent partial reply as reasoningText update`);
|
|
304
302
|
}
|
|
305
303
|
}
|
|
306
304
|
catch (err) {
|
|
@@ -312,28 +312,12 @@ b. 使用该工具之前需获取当前真实时间`,
|
|
|
312
312
|
reject(new Error(`创建闹钟失败: ${errorMsg} (错误代码: ${code})`));
|
|
313
313
|
return;
|
|
314
314
|
}
|
|
315
|
-
//
|
|
316
|
-
const result = event.outputs.result || {};
|
|
317
|
-
logger.log(`[CREATE_ALARM_TOOL] 📋 Alarm result:`, JSON.stringify(result));
|
|
315
|
+
// 成功,直接返回完整的 event.outputs JSON 字符串
|
|
318
316
|
resolve({
|
|
319
317
|
content: [
|
|
320
318
|
{
|
|
321
319
|
type: "text",
|
|
322
|
-
text: JSON.stringify(
|
|
323
|
-
success: true,
|
|
324
|
-
alarm: {
|
|
325
|
-
entityId: result.entityId,
|
|
326
|
-
entityName: result.entityName,
|
|
327
|
-
alarmTitle: result.alarmTitle,
|
|
328
|
-
alarmTime: result.alarmTime,
|
|
329
|
-
alarmState: result.alarmState,
|
|
330
|
-
alarmRingDuration: result.alarmRingDuration,
|
|
331
|
-
alarmSnoozeDuration: result.alarmSnoozeDuration,
|
|
332
|
-
alarmSnoozeTotal: result.alarmSnoozeTotal,
|
|
333
|
-
daysOfWakeType: result.daysOfWakeType,
|
|
334
|
-
},
|
|
335
|
-
code,
|
|
336
|
-
}),
|
|
320
|
+
text: JSON.stringify(event.outputs),
|
|
337
321
|
},
|
|
338
322
|
],
|
|
339
323
|
});
|
|
@@ -182,24 +182,13 @@ export const deleteAlarmTool = {
|
|
|
182
182
|
reject(new Error(`删除闹钟失败: ${errorMsg} (错误代码: ${code})`));
|
|
183
183
|
return;
|
|
184
184
|
}
|
|
185
|
-
//
|
|
186
|
-
const result = event.outputs.result || {};
|
|
187
|
-
logger.log(`[DELETE_ALARM_TOOL] 📋 Deletion result:`, JSON.stringify(result));
|
|
188
|
-
// Build response with safe navigation
|
|
189
|
-
const response = {
|
|
190
|
-
success: true,
|
|
191
|
-
entityName: result.entityName || "Alarm",
|
|
192
|
-
message: result.message || "Alarm deleted successfully",
|
|
193
|
-
deletedCount: items.length,
|
|
194
|
-
};
|
|
195
|
-
// Add entityIds from request for reference
|
|
196
|
-
response.deletedIds = items.map(item => item.entityId);
|
|
185
|
+
// 成功,直接返回完整的 event.outputs JSON 字符串
|
|
197
186
|
logger.log(`[DELETE_ALARM_TOOL] 🎉 Successfully deleted ${items.length} alarm(s)`);
|
|
198
187
|
resolve({
|
|
199
188
|
content: [
|
|
200
189
|
{
|
|
201
190
|
type: "text",
|
|
202
|
-
text: JSON.stringify(
|
|
191
|
+
text: JSON.stringify(event.outputs),
|
|
203
192
|
},
|
|
204
193
|
],
|
|
205
194
|
});
|
|
@@ -55,7 +55,9 @@ export const locationTool = {
|
|
|
55
55
|
dimension: "",
|
|
56
56
|
executeMode: "background",
|
|
57
57
|
intentName: "GetCurrentLocation",
|
|
58
|
-
intentParam: {
|
|
58
|
+
intentParam: {
|
|
59
|
+
isNeedGeoAddress: true,
|
|
60
|
+
},
|
|
59
61
|
needUnlock: true,
|
|
60
62
|
permissionId: [],
|
|
61
63
|
timeOut: 5,
|
|
@@ -87,19 +89,14 @@ export const locationTool = {
|
|
|
87
89
|
clearTimeout(timeout);
|
|
88
90
|
wsManager.off("data-event", handler);
|
|
89
91
|
if (event.status === "success" && event.outputs) {
|
|
90
|
-
const { latitude, longitude } = event.outputs;
|
|
91
92
|
logger.log(`[LOCATION_TOOL] ✅ Location retrieved successfully`);
|
|
92
|
-
logger.log(`[LOCATION_TOOL] -
|
|
93
|
-
|
|
93
|
+
logger.log(`[LOCATION_TOOL] - outputs:`, JSON.stringify(event.outputs));
|
|
94
|
+
// 成功,直接返回完整的 event.outputs JSON 字符串
|
|
94
95
|
resolve({
|
|
95
96
|
content: [
|
|
96
97
|
{
|
|
97
98
|
type: "text",
|
|
98
|
-
text: JSON.stringify(
|
|
99
|
-
latitude,
|
|
100
|
-
longitude,
|
|
101
|
-
coordinateSystem: "WGS84",
|
|
102
|
-
})
|
|
99
|
+
text: JSON.stringify(event.outputs),
|
|
103
100
|
}
|
|
104
101
|
]
|
|
105
102
|
});
|
|
@@ -329,30 +329,12 @@ export const modifyAlarmTool = {
|
|
|
329
329
|
reject(new Error(`修改闹钟失败: ${errorMsg} (错误代码: ${code})`));
|
|
330
330
|
return;
|
|
331
331
|
}
|
|
332
|
-
//
|
|
333
|
-
const result = event.outputs.result || {};
|
|
334
|
-
logger.log(`[MODIFY_ALARM_TOOL] 📋 Alarm result:`, JSON.stringify(result));
|
|
335
|
-
// Build response with safe navigation
|
|
336
|
-
const response = {
|
|
337
|
-
success: true,
|
|
338
|
-
alarm: {
|
|
339
|
-
entityId: result.entityId || params.entityId,
|
|
340
|
-
entityType: result.entityType || result.entityName,
|
|
341
|
-
alarmTitle: result.alarmTitle,
|
|
342
|
-
alarmTime: result.alarmTime,
|
|
343
|
-
alarmState: result.alarmState,
|
|
344
|
-
alarmRingDuration: result.alarmRingDuration,
|
|
345
|
-
alarmSnoozeDuration: result.alarmSnoozeDuration,
|
|
346
|
-
alarmSnoozeTotal: result.alarmSnoozeTotal,
|
|
347
|
-
daysOfWakeType: result.daysOfWakeType,
|
|
348
|
-
},
|
|
349
|
-
code,
|
|
350
|
-
};
|
|
332
|
+
// 成功,直接返回完整的 event.outputs JSON 字符串
|
|
351
333
|
resolve({
|
|
352
334
|
content: [
|
|
353
335
|
{
|
|
354
336
|
type: "text",
|
|
355
|
-
text: JSON.stringify(
|
|
337
|
+
text: JSON.stringify(event.outputs),
|
|
356
338
|
},
|
|
357
339
|
],
|
|
358
340
|
});
|
|
@@ -115,17 +115,12 @@ export const modifyNoteTool = {
|
|
|
115
115
|
if (event.status === "success" && event.outputs) {
|
|
116
116
|
logger.log(`[MODIFY_NOTE_TOOL] ✅ Note modified successfully`);
|
|
117
117
|
logger.log(`[MODIFY_NOTE_TOOL] - outputs:`, JSON.stringify(event.outputs));
|
|
118
|
-
//
|
|
119
|
-
const result = event.outputs.result;
|
|
120
|
-
logger.log(`[MODIFY_NOTE_TOOL] 📝 Note updated:`);
|
|
121
|
-
logger.log(`[MODIFY_NOTE_TOOL] - entityId: ${result?.entityId}`);
|
|
122
|
-
logger.log(`[MODIFY_NOTE_TOOL] - title: ${result?.title}`);
|
|
123
|
-
logger.log(`[MODIFY_NOTE_TOOL] - modifiedDate: ${result?.modifiedDate}`);
|
|
118
|
+
// 成功,直接返回完整的 event.outputs JSON 字符串
|
|
124
119
|
resolve({
|
|
125
120
|
content: [
|
|
126
121
|
{
|
|
127
122
|
type: "text",
|
|
128
|
-
text: JSON.stringify(
|
|
123
|
+
text: JSON.stringify(event.outputs),
|
|
129
124
|
},
|
|
130
125
|
],
|
|
131
126
|
});
|
|
@@ -106,23 +106,13 @@ export const noteTool = {
|
|
|
106
106
|
clearTimeout(timeout);
|
|
107
107
|
wsManager.off("data-event", handler);
|
|
108
108
|
if (event.status === "success" && event.outputs) {
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
logger.log(`Note created successfully, outputs:`, JSON.stringify(event.outputs));
|
|
110
|
+
// 成功,直接返回完整的 event.outputs JSON 字符串
|
|
111
111
|
resolve({
|
|
112
112
|
content: [
|
|
113
113
|
{
|
|
114
114
|
type: "text",
|
|
115
|
-
text: JSON.stringify(
|
|
116
|
-
success: true,
|
|
117
|
-
note: {
|
|
118
|
-
entityId: result?.entityId,
|
|
119
|
-
title: result?.title,
|
|
120
|
-
content: result?.content,
|
|
121
|
-
entityName: result?.entityName,
|
|
122
|
-
modifiedDate: result?.modifiedDate,
|
|
123
|
-
},
|
|
124
|
-
code,
|
|
125
|
-
}),
|
|
115
|
+
text: JSON.stringify(event.outputs),
|
|
126
116
|
},
|
|
127
117
|
],
|
|
128
118
|
});
|
|
@@ -14,7 +14,7 @@ export const searchPhotoGalleryTool = {
|
|
|
14
14
|
label: "Search Photo Gallery",
|
|
15
15
|
description: `插件功能描述:搜索用户手机图库中的照片
|
|
16
16
|
|
|
17
|
-
工具使用约束:如果用户说从手机图库中或者从相册中查询xx
|
|
17
|
+
工具使用约束:如果用户说从手机图库中或者从相册中查询xx图片时调用此工具,注意此工具仅支持从本地图库检索,不支持云空间相册检索。
|
|
18
18
|
|
|
19
19
|
工具输入输出简介:
|
|
20
20
|
a. 根据图像描述语料检索匹配的照片,返回照片在手机本地的 mediaUri以及thumbnailUri。
|