robot-resources 1.7.3 → 1.7.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/lib/tool-config.js +3 -3
- package/lib/wizard.js +18 -17
- package/package.json +1 -1
package/lib/tool-config.js
CHANGED
|
@@ -223,16 +223,16 @@ export function configureToolRouting() {
|
|
|
223
223
|
|
|
224
224
|
/**
|
|
225
225
|
* Restart the OpenClaw gateway so it picks up new plugin + config.
|
|
226
|
-
* Spawns a detached process that waits
|
|
226
|
+
* Spawns a detached process that waits 5s then restarts — lets the wizard
|
|
227
227
|
* finish and return output to OC before the gateway dies.
|
|
228
228
|
*
|
|
229
229
|
* If called from inside an OC agent session (exec: npx robot-resources),
|
|
230
230
|
* a synchronous restart kills the session before output is captured.
|
|
231
231
|
* The deferred approach avoids this: wizard exits → OC captures output →
|
|
232
|
-
*
|
|
232
|
+
* 5s later gateway restarts → next conversation has all tools loaded.
|
|
233
233
|
*/
|
|
234
234
|
async function restartOpenClawGateway() {
|
|
235
|
-
spawn('sh', ['-c', 'sleep
|
|
235
|
+
spawn('sh', ['-c', 'sleep 5 && openclaw gateway restart'], {
|
|
236
236
|
stdio: 'ignore',
|
|
237
237
|
detached: true,
|
|
238
238
|
}).unref();
|
package/lib/wizard.js
CHANGED
|
@@ -339,23 +339,6 @@ export async function runWizard({ nonInteractive = false } = {}) {
|
|
|
339
339
|
blank();
|
|
340
340
|
}
|
|
341
341
|
|
|
342
|
-
// ── Best-effort: Single gateway restart ────────────────────────────────
|
|
343
|
-
//
|
|
344
|
-
// Merged from two previous restarts (after plugin install + after scraper
|
|
345
|
-
// registration). Everything is already installed and registered above.
|
|
346
|
-
// If the session dies during this restart, the gateway picks up changes
|
|
347
|
-
// on its next natural restart.
|
|
348
|
-
|
|
349
|
-
if (isOpenClawInstalled() && (results.tools?.some(r => r.action === 'installed') || scraperRegistered)) {
|
|
350
|
-
try {
|
|
351
|
-
await restartOpenClawGateway();
|
|
352
|
-
success('Gateway restart scheduled — tools available in next conversation');
|
|
353
|
-
} catch {
|
|
354
|
-
warn('Gateway restart failed — tools may not be available until OpenClaw restarts.');
|
|
355
|
-
warn('Run manually: openclaw gateway restart');
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
|
|
359
342
|
// ── Post-install health check ──────────────────────────────────────────
|
|
360
343
|
|
|
361
344
|
let healthReport = null;
|
|
@@ -398,4 +381,22 @@ export async function runWizard({ nonInteractive = false } = {}) {
|
|
|
398
381
|
// Non-fatal — status file is a convenience, not required
|
|
399
382
|
}
|
|
400
383
|
}
|
|
384
|
+
|
|
385
|
+
// ── Best-effort: Deferred gateway restart (MUST be last) ───────────────
|
|
386
|
+
//
|
|
387
|
+
// Gateway restart loads the newly installed plugin + scraper MCP.
|
|
388
|
+
// Without it, tools aren't available until the next natural gateway restart.
|
|
389
|
+
//
|
|
390
|
+
// MUST be the last thing in the wizard. The deferred spawn lets the wizard
|
|
391
|
+
// exit and return output to OC before the gateway dies. Silent catch —
|
|
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
|
+
}
|
|
401
402
|
}
|