feat: add CPU limiting and Ralph Loop wizard plan generation

CPU Limiting:
- Add CpuLimitConfig type and settings in App Settings
- Use nice command for process priority (-20 to 19)
- Optional cpulimit integration for hard CPU limits (if installed)
- Applied to new sessions via screen-manager and session modules

Ralph Loop Wizard:
- 3-step wizard: Describe → Plan → Launch
- New /api/generate-plan endpoint generates implementation steps via Claude
- Plan editor with checkboxes, priorities (P0/P1/P2), reordering
- Skip plan option for manual workflows
- Compact wizard modal layout

UI Updates:
- Form section headers for grouped settings
- CPU limit status indicator (cpulimit availability)
- Wizard modal wider layout and inline fields

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
arkon
2026-01-27 01:58:14 +01:00
co-authored by Claude Opus 4.5
parent 7cb7bc96e9
commit 59b406f73f
7 changed files with 1074 additions and 52 deletions
+35
View File
@@ -86,6 +86,12 @@ export interface SessionState {
parentAgentId?: string;
/** Child agent IDs spawned by this session */
childAgentIds?: string[];
/** CPU limiting enabled */
cpuLimitEnabled?: boolean;
/** Nice value for CPU priority (-20 to 19) */
cpuLimitNiceValue?: number;
/** CPU limit percentage (1-100) */
cpuLimitPercent?: number;
}
// ========== Global Stats Types ==========
@@ -233,6 +239,35 @@ export interface AppState {
tokenStats?: TokenStats;
}
// ========== CPU Limiting Types ==========
/**
* Configuration for CPU limiting of Claude sessions.
*
* Uses `nice` (always available) to lower process priority and
* optionally `cpulimit` (if installed) for hard CPU usage limits.
*/
export interface CpuLimitConfig {
/** Whether CPU limiting is enabled */
enabled: boolean;
/** Nice value (-20 to 19, default: 10 = lower priority) */
niceValue: number;
/** CPU limit percentage (1-100, default: 80) */
cpuLimitPercent: number;
/** Whether to use cpulimit if available (default: true) */
useCpulimitIfAvailable: boolean;
}
/**
* Default CPU limit configuration
*/
export const DEFAULT_CPU_LIMIT_CONFIG: CpuLimitConfig = {
enabled: false,
niceValue: 10,
cpuLimitPercent: 80,
useCpulimitIfAvailable: true,
};
// ========== Respawn Controller Types ==========
/**