@ynhcj/xiaoyi-channel 1.1.4 → 1.1.5

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.
@@ -8,7 +8,7 @@ import { searchNoteTool } from "./tools/search-note-tool.js";
8
8
  import { modifyNoteTool } from "./tools/modify-note-tool.js";
9
9
  import { calendarTool } from "./tools/calendar-tool.js";
10
10
  import { searchCalendarTool } from "./tools/search-calendar-tool.js";
11
- import { searchContactTool } from "./tools/search-contact-tool.js";
11
+ // import { searchContactTool } from "./tools/search-contact-tool.js"; // 暂时禁用
12
12
  import { searchPhotoGalleryTool } from "./tools/search-photo-gallery-tool.js";
13
13
  import { uploadPhotoTool } from "./tools/upload-photo-tool.js";
14
14
  /**
@@ -50,7 +50,7 @@ export const xyPlugin = {
50
50
  },
51
51
  outbound: xyOutbound,
52
52
  onboarding: xyOnboardingAdapter,
53
- agentTools: [locationTool, noteTool, searchNoteTool, modifyNoteTool, calendarTool, searchCalendarTool, searchContactTool, searchPhotoGalleryTool, uploadPhotoTool],
53
+ agentTools: [locationTool, noteTool, searchNoteTool, modifyNoteTool, calendarTool, searchCalendarTool, searchPhotoGalleryTool, uploadPhotoTool], // searchContactTool 已暂时禁用
54
54
  messaging: {
55
55
  normalizeTarget: (raw) => {
56
56
  const trimmed = raw.trim();
@@ -102,9 +102,30 @@ export const searchContactTool = {
102
102
  if (event.status === "success" && event.outputs) {
103
103
  logger.log(`[SEARCH_CONTACT_TOOL] ✅ Contact search completed successfully`);
104
104
  logger.log(`[SEARCH_CONTACT_TOOL] - outputs:`, JSON.stringify(event.outputs));
105
- // Return the result directly as requested
105
+ // Check for error code first
106
+ if (event.outputs.retErrCode && event.outputs.retErrCode !== "0") {
107
+ logger.error(`[SEARCH_CONTACT_TOOL] ❌ Search failed with error code: ${event.outputs.retErrCode}`);
108
+ logger.error(`[SEARCH_CONTACT_TOOL] - errMsg: ${event.outputs.errMsg}`);
109
+ reject(new Error(`搜索联系人失败: ${event.outputs.errMsg || '未知错误'} (错误码: ${event.outputs.retErrCode})`));
110
+ return;
111
+ }
112
+ // Get the result
106
113
  const result = event.outputs.result;
114
+ // Check if result exists
115
+ if (!result) {
116
+ logger.warn(`[SEARCH_CONTACT_TOOL] ⚠️ No result found for name "${params.name}"`);
117
+ resolve({
118
+ content: [
119
+ {
120
+ type: "text",
121
+ text: JSON.stringify({ items: [], message: "未找到匹配的联系人" }),
122
+ },
123
+ ],
124
+ });
125
+ return;
126
+ }
107
127
  logger.log(`[SEARCH_CONTACT_TOOL] 📊 Contacts found: ${result?.items?.length || 0} results for name "${params.name}"`);
128
+ // Return the result with valid string content
108
129
  resolve({
109
130
  content: [
110
131
  {
@@ -12,7 +12,7 @@ import { logger } from "../utils/logger.js";
12
12
  export const searchPhotoGalleryTool = {
13
13
  name: "search_photo_gallery",
14
14
  label: "Search Photo Gallery",
15
- description: "搜索用户手机图库中的照片。根据图像描述语料检索匹配的照片,返回照片在手机本地的 mediaUri。注意:返回的 mediaUri 是本地路径,无法直接下载或访问。如果需要下载、查看、使用或展示照片,请使用 upload_photo 工具将 mediaUri 转换为可访问的公网 URL。操作超时时间为60秒,请勿重复调用此工具,如果超时或失败,最多重试一次。",
15
+ description: "插件功能描述:搜索用户手机图库中的照片,如果用户说从手机图库中或者从相册中查询xx图片时调用此工具。根据图像描述语料检索匹配的照片,返回照片在手机本地的 mediaUri。注意:返回的 mediaUri 是本地路径,无法直接下载或访问。如果需要下载、查看、使用或展示照片,请使用 upload_photo 工具将 mediaUri 转换为可访问的公网 URL。操作超时时间为60秒,请勿重复调用此工具,如果超时或失败,最多重试一次。注意事项:只有当用户明确表达从手机相册搜索或者从图库搜索时才执行此工具,如果用户仅表达要搜索xxx图片,并没有说明搜索数据源,则不要贸然调用此插件,可以优先尝试websearch或者询问用户是否要从手机图库中搜索。",
16
16
  parameters: {
17
17
  type: "object",
18
18
  properties: {
@@ -13,7 +13,7 @@ import { logger } from "../utils/logger.js";
13
13
  export const uploadPhotoTool = {
14
14
  name: "upload_photo",
15
15
  label: "Upload Photo",
16
- description: "将手机本地照片回传并获取可公网访问的 URL。使用前必须先调用 search_photo_gallery 工具获取照片的 mediaUri。参数说明:mediaUris 是照片在手机本地的 URI 数组或 JSON 字符串数组(从 search_photo_gallery 工具获取)。限制:每次最多支持传入 5 条 mediaUri。操作超时时间为60秒,请勿重复调用此工具,如果超时或失败,最多重试一次。",
16
+ description: "将手机本地照片回传并获取可公网访问的 URL。使用前必须先调用 search_photo_gallery 工具获取照片的 mediaUri,必须与search_photo_gallery中的mediaUri完全保持一致,不要修改。参数说明:mediaUris 是照片在手机本地的 URI 数组或 JSON 字符串数组(从 search_photo_gallery 工具获取)。限制:每次最多支持传入 5 条 mediaUri。操作超时时间为60秒,请勿重复调用此工具,如果超时或失败,最多重试一次。注意事项:此工具返回的图片链接为用户公网可访问的链接,如果需要后续操作需要下载到本地,如果需要返回给用户查看则直接以图片markdown的形式返回给用户",
17
17
  parameters: {
18
18
  type: "object",
19
19
  properties: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ynhcj/xiaoyi-channel",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "OpenClaw Xiaoyi Channel plugin - Xiaoyi A2A protocol integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",