mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-07 07:59:42 +02:00
feat: persist respawn config and inner loop state across server restarts
- Add PersistedRespawnConfig type and respawnConfig field to ScreenSession - Add innerLoopEnabled field to ScreenSession for Ralph Wiggum tracking - Add updateRespawnConfig, clearRespawnConfig, updateInnerLoopEnabled methods to ScreenManager - Save respawn config when enabled/updated via API endpoints - Save inner loop enabled state when changed via API - Restore respawn controllers and inner loop state on server startup This ensures respawn continues working after claudeman restarts. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+28
-1
@@ -19,7 +19,7 @@ import { spawn, execSync } from 'node:child_process';
|
||||
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
||||
import { dirname, join } from 'node:path';
|
||||
import { homedir } from 'node:os';
|
||||
import { ScreenSession, ProcessStats, ScreenSessionWithStats, getErrorMessage } from './types.js';
|
||||
import { ScreenSession, ProcessStats, ScreenSessionWithStats, PersistedRespawnConfig, getErrorMessage } from './types.js';
|
||||
|
||||
/** Path to persisted screen session metadata */
|
||||
const SCREENS_FILE = join(homedir(), '.claudeman', 'screens.json');
|
||||
@@ -570,6 +570,33 @@ export class ScreenManager extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
// Update respawn config for a screen session (persisted across restarts)
|
||||
updateRespawnConfig(sessionId: string, config: PersistedRespawnConfig | undefined): void {
|
||||
const screen = this.screens.get(sessionId);
|
||||
if (screen) {
|
||||
screen.respawnConfig = config;
|
||||
this.saveScreens();
|
||||
}
|
||||
}
|
||||
|
||||
// Clear respawn config when respawn is stopped
|
||||
clearRespawnConfig(sessionId: string): void {
|
||||
const screen = this.screens.get(sessionId);
|
||||
if (screen && screen.respawnConfig) {
|
||||
delete screen.respawnConfig;
|
||||
this.saveScreens();
|
||||
}
|
||||
}
|
||||
|
||||
// Update inner loop (Ralph Wiggum) enabled state
|
||||
updateInnerLoopEnabled(sessionId: string, enabled: boolean): void {
|
||||
const screen = this.screens.get(sessionId);
|
||||
if (screen) {
|
||||
screen.innerLoopEnabled = enabled;
|
||||
this.saveScreens();
|
||||
}
|
||||
}
|
||||
|
||||
// Check if screen is available on the system
|
||||
static isScreenAvailable(): boolean {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user