robot-resources 1.7.4 → 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 -20
- 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,23 +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 5s then restarts — lets the wizard
|
|
227
|
-
* finish and return output to OC before the gateway dies.
|
|
228
|
-
*
|
|
229
|
-
* If called from inside an OC agent session (exec: npx robot-resources),
|
|
230
|
-
* a synchronous restart kills the session before output is captured.
|
|
231
|
-
* The deferred approach avoids this: wizard exits → OC captures output →
|
|
232
|
-
* 5s later gateway restarts → next conversation has all tools loaded.
|
|
233
|
-
*/
|
|
234
|
-
async function restartOpenClawGateway() {
|
|
235
|
-
spawn('sh', ['-c', 'sleep 5 && openclaw gateway restart'], {
|
|
236
|
-
stdio: 'ignore',
|
|
237
|
-
detached: true,
|
|
238
|
-
}).unref();
|
|
239
|
-
process.stdout.write(' Restarting gateway...\n');
|
|
240
|
-
}
|
|
241
|
-
|
|
242
223
|
// Exported for testing and direct use
|
|
243
|
-
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
|
}
|