import type { Delegation, DelegationStatus } from "./types.js"; import type { FailureCheckpointResult } from "./types.js"; import type { SemanticCompletionResult } from "./completion-detector.js"; export interface MonitorOptions { getStatus: (delegationId: string) => DelegationStatus | string; getDelegationRecord: (delegationId: string) => Delegation | undefined; getActionCount?: (delegationId: string) => number; inject: (parentSessionId: string, line: string, delegationId?: string) => void; injectUrgent?: (parentSessionId: string, line: string, delegationId?: string) => void; onComplete?: (delegationId: string, result?: SemanticCompletionResult) => void; onFailure?: (delegationId: string, result: FailureCheckpointResult) => void; onFirstActionDeadline?: (delegationId: string, elapsedSeconds: number) => void; onAutoAbort?: (delegationId: string, elapsedSeconds: number) => void; pollingCadence?: readonly number[]; } /** * Owns progressive polling, failure checkpoint detection, and completion * monitoring for a single delegated session. * * Polls at 30→45→60→90→120→180 seconds, injecting thin-line status updates. * At failure checkpoints (60/120/180/300), compares action counts between * checkpoints. No change = failure at that level. Injection stops after * level 4 (300s). */ export declare class DelegationMonitor { private readonly getStatus; private readonly getDelegationRecord; private readonly getActionCount; private readonly inject; private readonly injectUrgent; private readonly onComplete; private readonly onFailure; private readonly onFirstActionDeadline; private readonly onAutoAbort; private readonly pollingCadence; private readonly states; constructor(options: MonitorOptions); /** Start progressive polling and failure checkpoint tracking. */ start(delegationId: string, parentSessionId: string): void; /** Stop all timers and tracking for a delegation. */ stop(delegationId?: string): void; /** Mark the delegation completed and stop all monitoring. */ onCompletion(delegationId: string, result?: SemanticCompletionResult): void; /** Check semantic completion and trigger completion or continue. */ checkCompletion(delegationId: string, messages: unknown[]): void; /** Retrieve the current failure escalation level for a delegation. */ getEscalationLevel(delegationId: string): string | null; private isTerminal; private handleFailure; private stopState; } //# sourceMappingURL=monitor.d.ts.map