@ynhcj/xiaoyi-channel 0.0.44-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.
@@ -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();
@@ -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.
@@ -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
- // Extract result with safe navigation
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
- // Extract result with safe navigation
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(response),
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] - latitude: ${latitude}`);
93
- logger.log(`[LOCATION_TOOL] - longitude: ${longitude}`);
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
- // Extract result with safe navigation
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(response),
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
- // Return the result directly as requested
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(result),
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
- const { result, code } = event.outputs;
110
- logger.log(`Note created: title=${result?.title}, id=${result?.entityId}`);
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。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ynhcj/xiaoyi-channel",
3
- "version": "0.0.44-beta",
3
+ "version": "0.0.45-beta",
4
4
  "description": "OpenClaw Xiaoyi Channel plugin - Xiaoyi A2A protocol integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",