@@ -262,6 +262,47 @@ export interface TokenUsageSummary {
262262 byModel : Record < string , TokenUsageTotals > ;
263263}
264264
265+ // ---------------------------------------------------------------------------
266+ // Serialized Agent State (for persistence across sidepanel context loss)
267+ // ---------------------------------------------------------------------------
268+
269+ export interface SerializedLoopState {
270+ stepOutcomes : StepOutcome [ ] ;
271+ currentUrl : string ;
272+ success : boolean ;
273+ error : string | undefined ;
274+ fallbackUsed : boolean ;
275+ replansUsed : number ;
276+ queuedRepairSteps : Array < Record < string , unknown > > ;
277+ repairHistory : RepairHistoryEntry [ ] ;
278+ }
279+
280+ export interface SerializedRecoveryState {
281+ checkpoints : Array < {
282+ url : string ;
283+ stepIndex : number ;
284+ snapshotDigest : string ;
285+ timestamp : string ;
286+ predicatesPassed : string [ ] ;
287+ verificationPredicates ?: PredicateSpec [ ] ;
288+ } > ;
289+ recoveryAttemptsUsed : number ;
290+ maxRecoveryAttempts : number ;
291+ currentRecoveryTarget ?: string | null ;
292+ maxCheckpoints : number ;
293+ }
294+
295+ export interface SerializedAgentState {
296+ runId : string | null ;
297+ actionHistory : ActionRecord [ ] ;
298+ currentStepIndex : number ;
299+ currentStep : { action : string ; intent ?: string } | null ;
300+ currentTaskCategory : string | null ;
301+ loopState : SerializedLoopState ;
302+ recoveryState : SerializedRecoveryState | null ;
303+ tokenUsage : TokenUsageSummary | undefined ;
304+ }
305+
265306// ---------------------------------------------------------------------------
266307// Snapshot Types
267308// ---------------------------------------------------------------------------
0 commit comments