@ynhcj/xiaoyi-channel 0.0.113-beta → 0.0.115-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.
- package/dist/src/channel.js +1 -5
- package/dist/src/skill-retriever/tool-search.js +12 -2
- package/dist/src/skill-retriever/types.d.ts +2 -0
- package/dist/src/tools/login-token-tool.d.ts +1 -1
- package/dist/src/tools/login-token-tool.js +2 -2
- package/dist/src/tools/save-self-evolution-skill-tool.js +1 -1
- package/package.json +1 -1
package/dist/src/channel.js
CHANGED
|
@@ -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,
|
|
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(", ")})`);
|
|
@@ -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
|
-
|
|
128
|
-
|
|
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[];
|
|
@@ -10,11 +10,11 @@ const POLL_INTERVAL_MS = 5000; // 5 seconds
|
|
|
10
10
|
const TIMEOUT_MS = 60000; // 1 minute
|
|
11
11
|
const TOKEN_VALIDITY_MS = 5 * 60 * 1000; // 5 minutes
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* huawei_id_tool 工具
|
|
14
14
|
* 当 skill 依赖用户获取鉴权信息时,此工具协助用户快速获取鉴权信息。
|
|
15
15
|
*/
|
|
16
16
|
export const loginTokenTool = {
|
|
17
|
-
name: "
|
|
17
|
+
name: "huawei_id_tool",
|
|
18
18
|
label: "Get Login Token",
|
|
19
19
|
description: "获取用户授权信息。当skill需要用户鉴权时调用此工具,工具会向用户端发送授权请求,等待用户完成授权后返回结果。请勿重复调用此工具。",
|
|
20
20
|
parameters: {
|
|
@@ -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/.
|
|
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
|