feat: add GNU screen wrapping with process monitor

Add screen session management infrastructure:
- ScreenManager class to create, track, and kill GNU screen sessions
- Persistence of screen sessions to ~/.claudeman/screens.json
- Process stats collection (memory, CPU, child count)
- Reconciliation to detect dead/orphan screens

New API endpoints:
- GET /api/screens - list screens with stats
- DELETE /api/screens/:sessionId - kill screen
- POST /api/screens/reconcile - find dead screens
- POST /api/screens/stats/start|stop - control stats polling

New Process Monitor panel:
- Slide-up panel with real-time stats (2s updates)
- Shows memory, CPU, child processes per screen
- Kill button for each screen session
- Reconcile button to clean up dead screens

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
arkon
2026-01-19 02:18:51 +01:00
co-authored by Claude Opus 4.5
parent b30657a36f
commit 56c9f670e6
6 changed files with 606 additions and 0 deletions
+22
View File
@@ -205,6 +205,28 @@ export interface CaseInfo {
hasClaudeMd?: boolean;
}
// Screen session types for GNU screen wrapping
export interface ScreenSession {
sessionId: string; // Claudeman session ID
screenName: string; // GNU screen session name
pid: number; // Screen process PID
createdAt: number;
workingDir: string;
mode: 'claude' | 'shell';
attached: boolean; // Whether webserver is attached
}
export interface ProcessStats {
memoryMB: number; // Memory usage in MB
cpuPercent: number; // CPU usage percentage
childCount: number; // Number of child processes
updatedAt: number;
}
export interface ScreenSessionWithStats extends ScreenSession {
stats?: ProcessStats;
}
export const DEFAULT_CONFIG: AppConfig = {
pollIntervalMs: 1000,
defaultTimeoutMs: 300000, // 5 minutes