@ynhcj/xiaoyi-channel 0.0.15-beta → 0.0.17-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.
@@ -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
  {
@@ -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秒,请勿重复调用此工具,如果超时或失败,最多重试一次。",
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": "0.0.15-beta",
3
+ "version": "0.0.17-beta",
4
4
  "description": "OpenClaw Xiaoyi Channel plugin - Xiaoyi A2A protocol integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",