@honor-claw/yoyo 2026.7.1-alpha.3 → 2026.7.1-alpha.4
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/capabilities/admin/impl.mjs +19 -0
- package/dist/capabilities/routing/index.mjs +1 -0
- package/dist/capabilities/routing/restart.mjs +17 -0
- package/dist/gateway/client/admin.mjs +3 -0
- package/dist/modules/configs/plugin-init.mjs +2 -1
- package/dist/tools/index.mjs +5 -3
- package/dist/tools/plugin-restart/index.mjs +1 -0
- package/dist/tools/plugin-restart/tool.mjs +44 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/skills/yoyo-update/SKILL.md +36 -11
|
@@ -82,6 +82,25 @@ var r = t("capabilities"), i = null, a = class {
|
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
+
async restart(t) {
|
|
86
|
+
let n = this.manager.getClient();
|
|
87
|
+
if (!n) return {
|
|
88
|
+
ok: !1,
|
|
89
|
+
error: "Admin gateway client not ready"
|
|
90
|
+
};
|
|
91
|
+
try {
|
|
92
|
+
return await n.restartGateway(t), r.info("plugin restart command dispatched via admin RPC", { reason: t }), {
|
|
93
|
+
ok: !0,
|
|
94
|
+
data: { dispatched: !0 }
|
|
95
|
+
};
|
|
96
|
+
} catch (t) {
|
|
97
|
+
let n = e(t);
|
|
98
|
+
return r.error("gateway restart RPC failed", t), {
|
|
99
|
+
ok: !1,
|
|
100
|
+
error: `gateway restart failed: ${n}`
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
}
|
|
85
104
|
};
|
|
86
105
|
function o() {
|
|
87
106
|
return i === null && (i = new a()), i;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { clawLogger as e } from "../../utils/claw-logger.mjs";
|
|
2
|
+
import { useAdminCapability as t } from "../admin/impl.mjs";
|
|
3
|
+
import "../admin/index.mjs";
|
|
4
|
+
//#region src/capabilities/routing/restart.ts
|
|
5
|
+
var n = e("routing");
|
|
6
|
+
async function r(e) {
|
|
7
|
+
let r = await t().restart(e);
|
|
8
|
+
return n.info("plugin restart command dispatched", {
|
|
9
|
+
ok: r.ok,
|
|
10
|
+
reason: e
|
|
11
|
+
}), r.ok ? { ok: !0 } : {
|
|
12
|
+
ok: !1,
|
|
13
|
+
error: r.error
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { r as restartGateway };
|
|
@@ -37,6 +37,9 @@ var r = {
|
|
|
37
37
|
async devicePairApprove(e) {
|
|
38
38
|
return this.sendRequest("device.pair.approve", { requestId: e });
|
|
39
39
|
}
|
|
40
|
+
async restartGateway(e) {
|
|
41
|
+
return this.sendRequest("gateway.restart.request", { reason: e });
|
|
42
|
+
}
|
|
40
43
|
};
|
|
41
44
|
//#endregion
|
|
42
45
|
export { i as default };
|
package/dist/tools/index.mjs
CHANGED
|
@@ -4,9 +4,11 @@ import { nodeInvokeTool as t } from "./node-invoke/tool.mjs";
|
|
|
4
4
|
import "./node-invoke/index.mjs";
|
|
5
5
|
import { nodesStatusTool as n } from "./nodes-status/tool.mjs";
|
|
6
6
|
import "./nodes-status/index.mjs";
|
|
7
|
+
import { pluginRestartTool as r } from "./plugin-restart/tool.mjs";
|
|
8
|
+
import "./plugin-restart/index.mjs";
|
|
7
9
|
//#region src/tools/index.ts
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
+
function i(i) {
|
|
11
|
+
i.registerTool(n), i.registerTool(t), i.registerTool(e), i.registerTool(r);
|
|
10
12
|
}
|
|
11
13
|
//#endregion
|
|
12
|
-
export {
|
|
14
|
+
export { i as registerTools };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./tool.mjs";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { toErrorMessage as e } from "../../utils/error.mjs";
|
|
2
|
+
import { clawLogger as t } from "../../utils/claw-logger.mjs";
|
|
3
|
+
import { restartGateway as n } from "../../capabilities/routing/restart.mjs";
|
|
4
|
+
import "../../capabilities/routing/index.mjs";
|
|
5
|
+
import { Type as r } from "typebox";
|
|
6
|
+
//#region src/tools/plugin-restart/tool.ts
|
|
7
|
+
var i = t("tool"), a = {
|
|
8
|
+
name: "yoyo_plugin_restart",
|
|
9
|
+
label: "YOYO Plugin Restart",
|
|
10
|
+
description: "重启 openclaw 网关。插件升级场景下使用:调用后网关会断连重启。",
|
|
11
|
+
parameters: r.Object({ reason: r.Optional(r.String({ description: "重启原因" })) }),
|
|
12
|
+
async execute(e, t) {
|
|
13
|
+
let n = await o(e, t);
|
|
14
|
+
return {
|
|
15
|
+
content: [{
|
|
16
|
+
type: "text",
|
|
17
|
+
text: JSON.stringify(n)
|
|
18
|
+
}],
|
|
19
|
+
details: n
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
async function o(t, r) {
|
|
24
|
+
try {
|
|
25
|
+
let e = await n(r.reason);
|
|
26
|
+
return e.ok ? {
|
|
27
|
+
ok: !0,
|
|
28
|
+
result: { message: "restart command dispatched." }
|
|
29
|
+
} : (i.warn("plugin restart command failed", {
|
|
30
|
+
toolCallId: t,
|
|
31
|
+
error: e.error
|
|
32
|
+
}), {
|
|
33
|
+
ok: !1,
|
|
34
|
+
errorMessage: e.error ?? "plugin restart command failed; please manually restart the gateway"
|
|
35
|
+
});
|
|
36
|
+
} catch (n) {
|
|
37
|
+
return i.error("plugin restart command threw unexpectedly", n, { toolCallId: t }), {
|
|
38
|
+
ok: !1,
|
|
39
|
+
errorMessage: e(n)
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { a as pluginRestartTool };
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -55,10 +55,10 @@ metadata: { "openclaw": { "emoji": "🔄", "always": true } }
|
|
|
55
55
|
|
|
56
56
|
正在执行升级流程:
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
正在下载插件
|
|
59
59
|
状态:正在下载插件,请耐心等待...
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
正在更新插件
|
|
62
62
|
状态:正在安装并配置新版本插件,请勿中断操作
|
|
63
63
|
|
|
64
64
|
## 步骤 4:执行更新
|
|
@@ -90,19 +90,44 @@ metadata: { "openclaw": { "emoji": "🔄", "always": true } }
|
|
|
90
90
|
|
|
91
91
|
说明:本次实际升级到 v{实际版本},高于预检查获取的目标版本 v{目标版本}。
|
|
92
92
|
|
|
93
|
-
## 步骤 6
|
|
93
|
+
## 步骤 6:根据网关运行模式重启
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
插件更新完成后,需要重启网关让插件生效(安装插件不再自动触发网关重启)。重启方式取决于当前网关的运行模式,必须先探测再分流。
|
|
96
96
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
### 6.1 探测网关运行模式
|
|
98
|
+
|
|
99
|
+
执行 `openclaw gateway status --json`,解析输出判断网关是 daemon 托管还是前台手动运行:
|
|
100
|
+
|
|
101
|
+
- daemon(计划任务/schtasks 托管)的判定信号,二者需同时满足:
|
|
102
|
+
1. `port.listeners[].commandLine` 中被加载的脚本是 `dist/index.js`。
|
|
103
|
+
2. `service.runtime.detail` 不含 "even though schtasks did not report a running task" 或类似的 schtasks 没生效的说明。
|
|
104
|
+
- 前台手动运行的判定信号,满足其一即可:
|
|
105
|
+
1. `port.listeners[].commandLine` 中被加载的脚本是 `openclaw.mjs`,命令为 `gateway` 或 `gateway run`(无 `--port`)。
|
|
106
|
+
2. `service.runtime.detail` 含 "even though schtasks did not report a running task" 或类似的 schtasks 没生效的说明。
|
|
107
|
+
- 注意:不要用外层 `node.exe` 的路径区分(daemon 和前台都可能是同一 node 路径),要以被加载脚本(`dist/index.js` vs `openclaw.mjs`)和是否带 `--port` 为准。
|
|
108
|
+
- `openclaw gateway status --json` 命令失败或无法解析运行模式时,按前台运行处理(走 6.3 提示手动重启),不要尝试任何自动重启方式。
|
|
109
|
+
|
|
110
|
+
### 6.2 daemon 网关:调用 yoyo_plugin_restart 工具重启
|
|
111
|
+
|
|
112
|
+
- 直接调用 `yoyo_plugin_restart` 工具触发网关重启。
|
|
113
|
+
- **不得向用户输出任何关于网关运行模式(如“当前是 daemon 模式”之类)的内部判断信息**,6.1 的探测结果仅供本步骤分流使用,对用户不可见。直接调用工具并进入步骤 7。
|
|
114
|
+
- 不得执行 `openclaw gateway restart/stop/start` 或任何其它重启命令。
|
|
115
|
+
- 重启是“下发即结束”:工具返回即视为重启已触发,**不要轮询网关状态、不要等待网关重新就绪、不要探测重连结果**。调用后直接进入步骤 7。
|
|
116
|
+
- 工具返回 `ok: true`:直接进入步骤 7。
|
|
117
|
+
- 工具返回 `ok: false`:不要改用其它重启方式,输出 `插件已更新完成,但网关重启失败,请在 OpenClaw 设备上手动重启网关生效新版本插件`,停止。不得向用户输出工具返回的原始 `errorMessage` 或内部判断信息。
|
|
118
|
+
|
|
119
|
+
### 6.3 前台运行的网关:提示手动重启
|
|
120
|
+
|
|
121
|
+
前台网关由用户自己起的进程托管,无法通过工具或命令自动重启。输出以下文案并停止(不输出步骤 7 的完成文案):
|
|
122
|
+
|
|
123
|
+
插件已更新完成,请手动重启 OpenClaw 网关让新版本插件生效。
|
|
124
|
+
|
|
125
|
+
(前台运行的网关无法控制自动重启,请在启动网关的终端停止当前网关并重新启动。)
|
|
101
126
|
|
|
102
127
|
## 步骤 7:输出完成结果
|
|
103
128
|
|
|
104
|
-
|
|
129
|
+
输出完成文案:
|
|
105
130
|
|
|
106
|
-
|
|
131
|
+
插件更新完成
|
|
107
132
|
Claw 插件更新已完成
|
|
108
|
-
|
|
133
|
+
网关重启已下发,连接即将断开,断开后稍等片刻后会恢复...
|