robot-resources 1.7.5 → 1.7.6
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/lib/tool-config.js +1 -25
- package/lib/wizard.js +8 -18
- package/package.json +1 -1
package/lib/tool-config.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { spawn } from 'node:child_process';
|
|
2
1
|
import { createRequire } from 'node:module';
|
|
3
2
|
import { readFileSync, writeFileSync, copyFileSync, mkdirSync, existsSync } from 'node:fs';
|
|
4
3
|
import { homedir } from 'node:os';
|
|
@@ -221,28 +220,5 @@ export function configureToolRouting() {
|
|
|
221
220
|
return results;
|
|
222
221
|
}
|
|
223
222
|
|
|
224
|
-
/**
|
|
225
|
-
* Restart the OpenClaw gateway so it picks up new plugin + config.
|
|
226
|
-
* Spawns a detached process that waits 30s then restarts — lets the wizard
|
|
227
|
-
* exit and the OC agent deliver the install report + answer at least one
|
|
228
|
-
* follow-up before the gateway dies.
|
|
229
|
-
*
|
|
230
|
-
* Why deferred: a synchronous restart kills the OC session before the
|
|
231
|
-
* install report is captured. The 30s window gives the agent time to
|
|
232
|
-
* respond and handle a follow-up message. After the restart, the next
|
|
233
|
-
* conversation loads the plugin and routing is active.
|
|
234
|
-
*
|
|
235
|
-
* History: PR #89 used synchronous await (worked but required user to
|
|
236
|
-
* ask for updates). Session #26 used 5s delay (too short — killed
|
|
237
|
-
* session mid-conversation). 30s balances report delivery with restart.
|
|
238
|
-
*/
|
|
239
|
-
async function restartOpenClawGateway() {
|
|
240
|
-
spawn('sh', ['-c', 'sleep 30 && openclaw gateway restart'], {
|
|
241
|
-
stdio: 'ignore',
|
|
242
|
-
detached: true,
|
|
243
|
-
}).unref();
|
|
244
|
-
process.stdout.write(' Gateway restart scheduled (30s)...\n');
|
|
245
|
-
}
|
|
246
|
-
|
|
247
223
|
// Exported for testing and direct use
|
|
248
|
-
export { stripJson5, configureOpenClaw, registerScraperMcp
|
|
224
|
+
export { stripJson5, configureOpenClaw, registerScraperMcp };
|
package/lib/wizard.js
CHANGED
|
@@ -2,11 +2,11 @@ import { readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { homedir, hostname } from 'node:os';
|
|
4
4
|
import { readConfig, writeConfig } from '@robot-resources/cli-core/config.mjs';
|
|
5
|
-
import { findPython, isPortAvailable, isHeadless
|
|
5
|
+
import { findPython, isPortAvailable, isHeadless } from './detect.js';
|
|
6
6
|
import { getOrCreateMachineId } from './machine-id.js';
|
|
7
7
|
import { setupRouter, isRouterInstalled, getVenvPythonPath } from './python-bridge.js';
|
|
8
8
|
import { installService, isServiceRunning, isServiceInstalled } from './service.js';
|
|
9
|
-
import { configureToolRouting, registerScraperMcp
|
|
9
|
+
import { configureToolRouting, registerScraperMcp } from './tool-config.js';
|
|
10
10
|
import { checkHealth } from './health-report.js';
|
|
11
11
|
import { header, step, success, warn, error, info, blank, summary } from './ui.js';
|
|
12
12
|
/**
|
|
@@ -382,21 +382,11 @@ export async function runWizard({ nonInteractive = false } = {}) {
|
|
|
382
382
|
}
|
|
383
383
|
}
|
|
384
384
|
|
|
385
|
-
// ──
|
|
385
|
+
// ── Gateway restart: NOT needed ─────────────────────────────────────────
|
|
386
386
|
//
|
|
387
|
-
//
|
|
388
|
-
//
|
|
389
|
-
//
|
|
390
|
-
//
|
|
391
|
-
//
|
|
392
|
-
// the plugin's install message already tells the user to start a new
|
|
393
|
-
// conversation. No warn/success needed.
|
|
394
|
-
//
|
|
395
|
-
// History: PR #89 (Manuel) had this right — restart last, silent catch.
|
|
396
|
-
// Session #25 moved it earlier with 3x retries, which killed OC Telegram
|
|
397
|
-
// sessions. Reverted to deferred spawn, positioned last.
|
|
398
|
-
|
|
399
|
-
if (isOpenClawInstalled() && (results.tools?.some(r => r.action === 'installed') || scraperRegistered)) {
|
|
400
|
-
try { await restartOpenClawGateway(); } catch { /* silent — best effort */ }
|
|
401
|
-
}
|
|
387
|
+
// OC has a built-in config watcher. When openclaw.json changes (plugin
|
|
388
|
+
// entry, scraper MCP, plugins.allow), the gateway detects the change,
|
|
389
|
+
// waits for active operations to complete, then restarts gracefully.
|
|
390
|
+
// No manual restart needed — the wizard just writes config and OC
|
|
391
|
+
// handles the rest.
|
|
402
392
|
}
|