@coclaw/openclaw-coclaw 0.7.0 → 0.7.1
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/package.json
CHANGED
|
@@ -23,7 +23,7 @@ const CMD_TIMEOUT_MS = 30_000;
|
|
|
23
23
|
* @param {Function} [opts.execFileFn]
|
|
24
24
|
* @returns {Promise<string>}
|
|
25
25
|
*/
|
|
26
|
-
function
|
|
26
|
+
function runCmd(cmd, args, opts) {
|
|
27
27
|
const doExecFile = opts?.execFileFn ?? nodeExecFile;
|
|
28
28
|
return new Promise((resolve, reject) => {
|
|
29
29
|
doExecFile(cmd, args, { timeout: CMD_TIMEOUT_MS, shell: true }, (err, stdout) => {
|
|
@@ -44,7 +44,7 @@ function exec(cmd, args, opts) {
|
|
|
44
44
|
export async function waitForGateway(opts) {
|
|
45
45
|
// 主动触发重启,不依赖 OpenClaw 的文件变更自动重启策略
|
|
46
46
|
try {
|
|
47
|
-
await
|
|
47
|
+
await runCmd('openclaw', ['gateway', 'restart'], opts);
|
|
48
48
|
}
|
|
49
49
|
catch {
|
|
50
50
|
// restart 命令失败不阻断流程,仍尝试等待
|
|
@@ -56,7 +56,7 @@ export async function waitForGateway(opts) {
|
|
|
56
56
|
|
|
57
57
|
while (Date.now() - start < timeout) {
|
|
58
58
|
try {
|
|
59
|
-
const output = await
|
|
59
|
+
const output = await runCmd('openclaw', ['gateway', 'status'], opts);
|
|
60
60
|
if (output.includes('running')) return;
|
|
61
61
|
}
|
|
62
62
|
catch {
|
|
@@ -76,7 +76,7 @@ export async function waitForGateway(opts) {
|
|
|
76
76
|
* @returns {Promise<void>}
|
|
77
77
|
*/
|
|
78
78
|
export async function verifyPluginLoaded(pluginId, opts) {
|
|
79
|
-
const output = await
|
|
79
|
+
const output = await runCmd('openclaw', ['plugins', 'list'], opts);
|
|
80
80
|
if (!output.includes(pluginId)) {
|
|
81
81
|
throw new Error(`Plugin ${pluginId} not found in plugins list`);
|
|
82
82
|
}
|
|
@@ -89,7 +89,7 @@ export async function verifyPluginLoaded(pluginId, opts) {
|
|
|
89
89
|
* @returns {Promise<string>} 返回版本号
|
|
90
90
|
*/
|
|
91
91
|
export async function verifyUpgradeHealth(opts) {
|
|
92
|
-
const output = await
|
|
92
|
+
const output = await runCmd(
|
|
93
93
|
'openclaw',
|
|
94
94
|
['gateway', 'call', 'coclaw.upgradeHealth', '--json'],
|
|
95
95
|
opts,
|