feat: add AI-powered idle check for respawn controller

Replace the "Worked for Xm Xs" pattern as the sole primary idle
detection signal with a final AI-powered check. When pre-filter
conditions are met (output silence, no working patterns, tokens
stable), a fresh Claude CLI session is spawned in a screen to
analyze terminal output and provide a definitive IDLE/WORKING
verdict before proceeding with the respawn cycle.

New state in state machine: `ai_checking` (between pre-filter
confirmation and `sending_update`). WORKING verdict triggers a
3-minute cooldown. Errors auto-disable after 3 consecutive
failures, falling back to the existing noOutputTimeoutMs safety net.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
arkon
2026-01-24 18:48:37 +01:00
co-authored by Claude Opus 4.5
parent de8033fed5
commit 0e56e590f3
8 changed files with 1602 additions and 17 deletions
+20
View File
@@ -211,6 +211,16 @@ export interface RespawnConfig {
autoAcceptPrompts?: boolean;
/** Delay before auto-accepting plan mode prompts when no output and no completion message (ms) */
autoAcceptDelayMs?: number;
/** Whether AI idle check is enabled */
aiIdleCheckEnabled?: boolean;
/** Model to use for AI idle check */
aiIdleCheckModel?: string;
/** Maximum characters of terminal buffer for AI check */
aiIdleCheckMaxContext?: number;
/** Timeout for AI check in ms */
aiIdleCheckTimeoutMs?: number;
/** Cooldown after WORKING verdict in ms */
aiIdleCheckCooldownMs?: number;
}
/**
@@ -515,6 +525,16 @@ export interface PersistedRespawnConfig {
autoAcceptPrompts?: boolean;
/** Delay before auto-accepting prompts (ms) */
autoAcceptDelayMs?: number;
/** Whether AI idle check is enabled */
aiIdleCheckEnabled?: boolean;
/** Model to use for AI idle check */
aiIdleCheckModel?: string;
/** Maximum characters of terminal buffer for AI check */
aiIdleCheckMaxContext?: number;
/** Timeout for AI check in ms */
aiIdleCheckTimeoutMs?: number;
/** Cooldown after WORKING verdict in ms */
aiIdleCheckCooldownMs?: number;
/** Duration in minutes if timed respawn was set */
durationMinutes?: number;
}