robot-resources 1.7.3 → 1.7.5
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 +13 -8
- package/lib/wizard.js +18 -17
- package/package.json +1 -1
package/lib/tool-config.js
CHANGED
|
@@ -223,20 +223,25 @@ 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
|
|
227
|
-
*
|
|
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.
|
|
228
229
|
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
*
|
|
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.
|
|
233
238
|
*/
|
|
234
239
|
async function restartOpenClawGateway() {
|
|
235
|
-
spawn('sh', ['-c', 'sleep
|
|
240
|
+
spawn('sh', ['-c', 'sleep 30 && openclaw gateway restart'], {
|
|
236
241
|
stdio: 'ignore',
|
|
237
242
|
detached: true,
|
|
238
243
|
}).unref();
|
|
239
|
-
process.stdout.write('
|
|
244
|
+
process.stdout.write(' Gateway restart scheduled (30s)...\n');
|
|
240
245
|
}
|
|
241
246
|
|
|
242
247
|
// Exported for testing and direct use
|
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
|
}
|