@ynhcj/xiaoyi-channel 0.0.114-beta → 0.0.116-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.
@@ -8,7 +8,6 @@ import { viewPushResultTool } from "./tools/view-push-result-tool.js";
8
8
  import { imageReadingTool } from "./tools/image-reading-tool.js";
9
9
  import { timestampToUtc8Tool } from "./tools/timestamp-to-utc8-tool.js";
10
10
  import { saveSelfEvolutionSkillTool } from "./tools/save-self-evolution-skill-tool.js";
11
- import { getEmailToolSchemaTool } from "./tools/get-email-tool-schema.js";
12
11
  import { callDeviceTool } from "./tools/call-device-tool.js";
13
12
  import { getNoteToolSchemaTool } from "./tools/get-note-tool-schema.js";
14
13
  import { getCalendarToolSchemaTool } from "./tools/get-calendar-tool-schema.js";
@@ -17,9 +16,6 @@ import { getPhotoToolSchemaTool } from "./tools/get-photo-tool-schema.js";
17
16
  import { getDeviceFileToolSchemaTool } from "./tools/get-device-file-tool-schema.js";
18
17
  import { getAlarmToolSchemaTool } from "./tools/get-alarm-tool-schema.js";
19
18
  import { getCollectionToolSchemaTool } from "./tools/get-collection-tool-schema.js";
20
- import { queryAppMessageTool } from "./tools/query-app-message-tool.js";
21
- import { queryMemoryDataTool } from "./tools/query-memory-data-tool.js";
22
- import { queryTodoTaskTool } from "./tools/query-todo-task-tool.js";
23
19
  import { loginTokenTool } from "./tools/login-token-tool.js";
24
20
  import { filterToolsByDevice } from "./tools/device-tool-map.js";
25
21
  import { getCurrentSessionContext } from "./tools/session-manager.js";
@@ -63,7 +59,7 @@ export const xyPlugin = {
63
59
  },
64
60
  outbound: xyOutbound,
65
61
  agentTools: () => {
66
- const allTools = [locationTool, callDeviceTool, getNoteToolSchemaTool, getCalendarToolSchemaTool, getContactToolSchemaTool, getPhotoToolSchemaTool, xiaoyiGuiTool, getDeviceFileToolSchemaTool, getAlarmToolSchemaTool, getCollectionToolSchemaTool, sendFileToUserTool, viewPushResultTool, imageReadingTool, timestampToUtc8Tool, saveSelfEvolutionSkillTool, getEmailToolSchemaTool, queryAppMessageTool, queryMemoryDataTool, queryTodoTaskTool, loginTokenTool];
62
+ const allTools = [locationTool, callDeviceTool, getNoteToolSchemaTool, getCalendarToolSchemaTool, getContactToolSchemaTool, getPhotoToolSchemaTool, xiaoyiGuiTool, getDeviceFileToolSchemaTool, getAlarmToolSchemaTool, getCollectionToolSchemaTool, sendFileToUserTool, viewPushResultTool, imageReadingTool, timestampToUtc8Tool, saveSelfEvolutionSkillTool, loginTokenTool];
67
63
  const ctx = getCurrentSessionContext();
68
64
  const filtered = filterToolsByDevice(allTools, ctx?.deviceType);
69
65
  logger.log(`[DEVICE-FILTER] deviceType=${ctx?.deviceType ?? "(none)"}, tools: ${allTools.length} → ${filtered.length} (${filtered.map(t => t.name).join(", ")})`);
@@ -158,14 +158,13 @@ function createRetryingStream(createStream, cronJob) {
158
158
  }
159
159
  if (event.type === "error") {
160
160
  console.log(`[xiaoyiprovider] stream error after content: ${event.error?.errorMessage}`);
161
- resultResolve(event.error);
162
- yield event;
163
- return;
161
+ errorResult = event.error;
162
+ break; // break inner loop, proceed to retry decision
164
163
  }
165
164
  yield event;
166
165
  }
167
166
  }
168
- // Stream ended during buffer phase — decide whether to retry
167
+ // Stream ended (buffer or streaming phase) — decide whether to retry
169
168
  if (errorResult?.stopReason === "error" && isRetryableProviderError(errorResult.errorMessage)) {
170
169
  if (attempt < MAX_RETRY_ATTEMPTS - 1) {
171
170
  const delayMs = getRetryDelayMs(attempt + 1, cronJob);
@@ -192,6 +191,7 @@ function createRetryingStream(createStream, cronJob) {
192
191
  }
193
192
  if (errorResult && buffer.every(b => b.type !== "done" && b.type !== "error")) {
194
193
  resultResolve(errorResult);
194
+ yield { type: "error", reason: "error", error: errorResult };
195
195
  }
196
196
  return;
197
197
  }
@@ -73,6 +73,7 @@ function formatSkillData(rawSkills, installedSkills) {
73
73
  skillDesc: skill.skillDesc,
74
74
  downloadPath: skill.packUrl,
75
75
  status: isInstalled ? "已安装" : "未安装",
76
+ rrfScore: skill.rrfScore,
76
77
  });
77
78
  }
78
79
  return formattedSkills;
@@ -124,8 +125,17 @@ export async function searchTools(options) {
124
125
  console.log(`${PLUGIN_LOG_PREFIX} [DEBUG] All top 2 skills are installed, returning null`);
125
126
  return null;
126
127
  }
127
- let filteredTools = topTools.filter((tool) => tool.status === "未安装");
128
- console.log(`${PLUGIN_LOG_PREFIX} [DEBUG] After filtering uninstalled: ${filteredTools.length}, ids: ${filteredTools.map((t) => t.skillId).join(", ")}`);
128
+ const hasInstalledWithHighScore = topTools.some((tool) => tool.status === "已安装" && (tool.rrfScore ?? 0) >= 0.016);
129
+ if (hasInstalledWithHighScore) {
130
+ console.log(`${PLUGIN_LOG_PREFIX} [DEBUG] Top 2 has installed skill with rrfScore >= 0.016, returning null`);
131
+ return null;
132
+ }
133
+ let filteredTools = topTools.filter((tool) => tool.status === "未安装" && (tool.rrfScore ?? 0) >= 0.016);
134
+ console.log(`${PLUGIN_LOG_PREFIX} [DEBUG] After filtering uninstalled with rrfScore >= 0.016: ${filteredTools.length}, details: ${filteredTools.map((t) => `${t.skillId}(rrfScore=${t.rrfScore})`).join(", ")}`);
135
+ if (filteredTools.length === 0) {
136
+ console.log(`${PLUGIN_LOG_PREFIX} [DEBUG] No uninstalled skills with rrfScore >= 0.016, returning null`);
137
+ return null;
138
+ }
129
139
  return {
130
140
  tools: filteredTools,
131
141
  query,
@@ -13,6 +13,7 @@ export interface RawSkill {
13
13
  skillName: string;
14
14
  skillDesc: string;
15
15
  packUrl: string;
16
+ rrfScore?: number;
16
17
  }
17
18
  export interface FormattedSkill {
18
19
  skillId: string;
@@ -20,6 +21,7 @@ export interface FormattedSkill {
20
21
  skillDesc: string;
21
22
  downloadPath: string;
22
23
  status: "已安装" | "未安装";
24
+ rrfScore?: number;
23
25
  }
24
26
  export interface ToolSearchResult {
25
27
  tools: FormattedSkill[];
@@ -3,7 +3,7 @@ import fs from "node:fs/promises";
3
3
  import path from "node:path";
4
4
  import { getCurrentSessionContext } from "./session-manager.js";
5
5
  import { selfEvolutionManager } from "../utils/self-evolution-manager.js";
6
- const SELF_EVOLVED_SKILL_ROOT = "/home/sandbox/.openclaw/.agents/skills";
6
+ const SELF_EVOLVED_SKILL_ROOT = "/home/sandbox/.agents/skills";
7
7
  const ISO_DATE_PATTERN = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z$/u;
8
8
  function slugifyTitle(title) {
9
9
  return title
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ynhcj/xiaoyi-channel",
3
- "version": "0.0.114-beta",
3
+ "version": "0.0.116-beta",
4
4
  "description": "OpenClaw Xiaoyi Channel plugin - Xiaoyi A2A protocol integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",