@ynhcj/xiaoyi-channel 0.0.15-beta → 0.0.16-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
  {
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.16-beta",
4
4
  "description": "OpenClaw Xiaoyi Channel plugin - Xiaoyi A2A protocol integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",