()
| 4091 | } |
| 4092 | |
| 4093 | async function restoreAutoRunTimerIfNeeded() { |
| 4094 | const state = await getState(); |
| 4095 | const plan = getPendingAutoRunTimerPlan(state); |
| 4096 | if (!plan) { |
| 4097 | if (state.autoRunPhase === 'scheduled' || state.autoRunPhase === 'waiting_interval') { |
| 4098 | await clearAutoRunTimerAlarm(); |
| 4099 | await broadcastAutoRunStatus('idle', { |
| 4100 | currentRun: 0, |
| 4101 | totalRuns: 1, |
| 4102 | attemptRun: 0, |
| 4103 | }, { |
| 4104 | autoRunRoundSummaries: [], |
| 4105 | autoRunTimerPlan: null, |
| 4106 | scheduledAutoRunPlan: null, |
| 4107 | }); |
| 4108 | } |
| 4109 | return; |
| 4110 | } |
| 4111 | |
| 4112 | if (plan.fireAt <= Date.now()) { |
| 4113 | await launchAutoRunTimerPlan('restore'); |
| 4114 | return; |
| 4115 | } |
| 4116 | |
| 4117 | const statusPayload = getAutoRunTimerStatusPayload(plan); |
| 4118 | await broadcastAutoRunStatus( |
| 4119 | statusPayload.phase, |
| 4120 | statusPayload, |
| 4121 | { |
| 4122 | autoRunSkipFailures: plan.autoRunSkipFailures, |
| 4123 | autoRunRoundSummaries: serializeAutoRunRoundSummaries(plan.totalRuns, plan.roundSummaries), |
| 4124 | autoRunTimerPlan: plan, |
| 4125 | scheduledAutoRunPlan: null, |
| 4126 | } |
| 4127 | ); |
| 4128 | await ensureAutoRunTimerAlarm(plan.fireAt); |
| 4129 | } |
| 4130 | |
| 4131 | async function ensureManualInteractionAllowed(actionLabel) { |
| 4132 | const state = await getState(); |
no test coverage detected