@honor-claw/yoyo 1.4.0-beta.1 → 1.4.0-beta.3

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.
@@ -3,11 +3,11 @@ import a from "node:path";
3
3
  import o from "node:fs/promises";
4
4
  //#region src/modules/device-toolset/skill-inject.ts
5
5
  async function s(e, t) {
6
- let n = a.join(e, r), i = await o.readFile(n, "utf8"), s = l(t, await c(e)), f = d(i, u(s));
7
- return f !== i && await o.writeFile(n, f, "utf8"), {
6
+ let n = a.join(e, r), i = await o.readFile(n, "utf8"), s = l(t, await c(e)), p = f(i, u(s));
7
+ return p !== i && await o.writeFile(n, p, "utf8"), {
8
8
  skillPath: n,
9
- rowCount: Object.keys(s).length,
10
- updated: f !== i
9
+ rowCount: d(s).length,
10
+ updated: p !== i
11
11
  };
12
12
  }
13
13
  async function c(e) {
@@ -15,7 +15,7 @@ async function c(e) {
15
15
  try {
16
16
  n = await o.readFile(t, "utf8");
17
17
  } catch (e) {
18
- if (m(e) && e.code === "ENOENT") return /* @__PURE__ */ new Set();
18
+ if (h(e) && e.code === "ENOENT") return /* @__PURE__ */ new Set();
19
19
  throw e;
20
20
  }
21
21
  let r = JSON.parse(n);
@@ -28,23 +28,33 @@ function l(e, t) {
28
28
  function u(t) {
29
29
  return [
30
30
  n,
31
- ...Object.values(t).toSorted((e, t) => e.name.localeCompare(t.name)).map((e) => `| ${f(e.name)} | ${f(e.description)} | ${f(e.supportedNodeIds.join(", "))} |`),
31
+ ...d(t).map((e) => `| ${p(e.name)} | ${p(e.description)} | ${p(e.nodeId)} |`),
32
32
  e
33
33
  ].join("\n");
34
34
  }
35
- function d(r, i) {
36
- let a = RegExp(`${p(n)}[\\s\\S]*?${p(e)}`);
35
+ function d(e) {
36
+ return Object.values(e).flatMap((e) => e.supportedNodeIds.map((t) => ({
37
+ name: e.name,
38
+ description: e.description,
39
+ nodeId: t
40
+ }))).toSorted((e, t) => {
41
+ let n = e.name.localeCompare(t.name);
42
+ return n === 0 ? e.nodeId.localeCompare(t.nodeId) : n;
43
+ });
44
+ }
45
+ function f(r, i) {
46
+ let a = RegExp(`${m(n)}[\\s\\S]*?${m(e)}`);
37
47
  if (a.test(r)) return r.replace(a, i);
38
48
  if (r.includes("{{full-mcp-tool-list}}")) return r.replace(t, i);
39
49
  throw Error("Unable to find MCP tools placeholder or generated block in yoyo-control skill");
40
50
  }
41
- function f(e) {
51
+ function p(e) {
42
52
  return e.replaceAll("|", "\\|").replace(/\r?\n/g, " ");
43
53
  }
44
- function p(e) {
54
+ function m(e) {
45
55
  return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
46
56
  }
47
- function m(e) {
57
+ function h(e) {
48
58
  return e instanceof Error && "code" in e;
49
59
  }
50
60
  //#endregion
@@ -1,7 +1,7 @@
1
1
  //#region src/utils/version.ts
2
2
  var e = null;
3
3
  function t() {
4
- return e === null && (e = "1.4.0-beta.1".includes("beta") || "1.4.0-beta.1".includes("alpha")), !!e;
4
+ return e === null && (e = "1.4.0-beta.3".includes("beta") || "1.4.0-beta.3".includes("alpha")), !!e;
5
5
  }
6
6
  //#endregion
7
7
  export { t as isBetaVersion };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@honor-claw/yoyo",
3
- "version": "1.4.0-beta.1",
3
+ "version": "1.4.0-beta.3",
4
4
  "description": "OpenClaw Honor Yoyo connection plugin",
5
5
  "keywords": [
6
6
  "ai",
@@ -143,16 +143,18 @@ metadata: { "openclaw": { "emoji": "📱", "always": true } }
143
143
 
144
144
  > **触发条件**:上方 Sub-Skill 工具表中没有匹配项。
145
145
 
146
- | 工具名称 | 工具说明 | 支持的设备ID列表 (nodeID, 逗号分隔) |
146
+ | 工具名称 | 工具说明 | 支持的设备ID |
147
147
  | ------- | ------- | --------------- |
148
148
  {{full-mcp-tool-list}}
149
149
 
150
- **当工具支持的设备ID列表中包含当前设备ID时,该工具才可被调用。**
150
+ **每行只对应一个设备ID。只有当该行的支持设备ID等于当前设备ID时,该工具才可被调用。**
151
151
 
152
152
  [MANDATORY] **必须强制执行**:
153
- 1. 在执行工具调用之前,**必须**严格匹配当前 nodeID 是否在 `支持的设备ID列表` 中,如果不在则告诉用户。
154
- 2. 如果当前 nodeID `支持的设备ID列表` 中,则**必须**从`mcptools/<tool_name>.json`中读取详细的工具定义。
155
- 3. 如果当前 nodeID 不在 `支持的设备ID列表` 中,则**必须**严格回复 "无工具可用"。
153
+ 1. 在执行工具调用之前,**必须**严格匹配当前 nodeID 是否等于某一行的 `支持的设备ID`,如果不等于则告诉用户。
154
+ 2. 如果当前 nodeID 等于某一行的 `支持的设备ID`,则**必须**从`mcptools/<tool_name>.json`中读取详细的工具定义。
155
+ 3. 如果当前 nodeID 不等于任意匹配工具行的 `支持的设备ID`,则**必须**严格回复 "无工具可用"。
156
+
157
+ **读取工具定义**:使用`read`工具读取`mcptools/<tool_name>.json`文件。
156
158
 
157
159
  ## 步骤 3:特殊场景处理
158
160
 
@@ -185,7 +187,7 @@ metadata: { "openclaw": { "emoji": "📱", "always": true } }
185
187
  按顺序完成以下校验,任一失败则停止执行:
186
188
 
187
189
  1. **节点标识** — 从 `nodes status` 输出中提取 IP 或 ID
188
- 2. **工具是否支持** — 如果是 `MCP工具`,必须严格校验 `支持的设备ID列表` 中是否包含当前节点标识 node 或 nodeID
190
+ 2. **工具是否支持** — 如果是 `MCP工具`,必须严格校验某一行的 `支持的设备ID` 是否等于当前节点标识 node 或 nodeID
189
191
  3. **工具文档** — 确认已读取对应的 `references/*.md` 或 `mcptools/*.json`
190
192
  4. **命令名称** — 从文档中精确提取 command
191
193
  5. **必填参数** — 从文档中提取并校验所有必填字段