@inceptionstack/roundhouse 0.3.28 → 0.3.29
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 +1 -1
- package/src/commands.ts +1 -0
- package/src/gateway.ts +42 -0
package/package.json
CHANGED
package/src/commands.ts
CHANGED
|
@@ -16,6 +16,7 @@ export const BOT_COMMANDS: BotCommand[] = [
|
|
|
16
16
|
{ command: "verbose", description: "Toggle verbose tool output" },
|
|
17
17
|
{ command: "stop", description: "Stop the current agent run" },
|
|
18
18
|
{ command: "restart", description: "Restart agent process" },
|
|
19
|
+
{ command: "update", description: "Update roundhouse and restart" },
|
|
19
20
|
{ command: "status", description: "Show system status" },
|
|
20
21
|
{ command: "doctor", description: "Run diagnostics" },
|
|
21
22
|
{ command: "crons", description: "List scheduled cron jobs" },
|
package/src/gateway.ts
CHANGED
|
@@ -478,6 +478,48 @@ export class Gateway {
|
|
|
478
478
|
return;
|
|
479
479
|
}
|
|
480
480
|
|
|
481
|
+
// Handle /update command — update roundhouse then restart
|
|
482
|
+
if (isCommand(userText.trim(), "/update")) {
|
|
483
|
+
if (allowedUsers.length === 0 && allowedUserIds.length === 0) {
|
|
484
|
+
await thread.post("⚠️ /update requires an allowlist to be configured.");
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
console.log(`[roundhouse] /update requested by @${authorName} in thread=${thread.id}`);
|
|
488
|
+
const progress = await createProgressMessage(thread, "📦 Checking for updates...");
|
|
489
|
+
try {
|
|
490
|
+
const { execSync } = await import("child_process");
|
|
491
|
+
// Get current version
|
|
492
|
+
const pkg = await import("../package.json", { with: { type: "json" } });
|
|
493
|
+
const currentVersion = pkg.default?.version ?? "unknown";
|
|
494
|
+
// Check latest version on npm
|
|
495
|
+
const latestVersion = execSync("npm view @inceptionstack/roundhouse version 2>/dev/null", {
|
|
496
|
+
timeout: 30_000,
|
|
497
|
+
encoding: "utf8",
|
|
498
|
+
}).trim();
|
|
499
|
+
if (latestVersion === currentVersion) {
|
|
500
|
+
await progress.update(`✅ Already on latest (v${currentVersion})`);
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
await progress.update(`📦 Updating v${currentVersion} → v${latestVersion}...`);
|
|
504
|
+
execSync("npm install -g @inceptionstack/roundhouse@latest 2>&1", {
|
|
505
|
+
timeout: 120_000,
|
|
506
|
+
encoding: "utf8",
|
|
507
|
+
});
|
|
508
|
+
await progress.update(`✅ Updated v${currentVersion} → v${latestVersion}. Restarting...`);
|
|
509
|
+
console.log(`[roundhouse] updated ${currentVersion} -> ${latestVersion}, restarting`);
|
|
510
|
+
// Exit so systemd restarts with new code
|
|
511
|
+
setTimeout(async () => {
|
|
512
|
+
try { await this.stop(); } catch (e) { console.error("[roundhouse] stop error:", e); }
|
|
513
|
+
process.exit(75);
|
|
514
|
+
}, 1500);
|
|
515
|
+
} catch (err) {
|
|
516
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
517
|
+
await progress.update(`⚠️ Update failed: ${msg.slice(0, 200)}`);
|
|
518
|
+
console.error(`[roundhouse] /update failed:`, msg);
|
|
519
|
+
}
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
522
|
+
|
|
481
523
|
// Handle /compact command — flush memory then compact session context
|
|
482
524
|
// Routed through the per-thread lock to prevent concurrent agent access
|
|
483
525
|
if (isCommand(userText.trim(), "/compact")) {
|