()
| 1110 | } |
| 1111 | |
| 1112 | async function loadRuntimeQueueState() { |
| 1113 | await ensureDirs() |
| 1114 | if (!(await fileExists(runtimeStatePath))) { |
| 1115 | return |
| 1116 | } |
| 1117 | |
| 1118 | try { |
| 1119 | const payload = JSON.parse(await readFile(runtimeStatePath, 'utf8')) |
| 1120 | const queue = Array.isArray(payload?.queue) |
| 1121 | ? payload.queue.map(hydrateRunRequest).filter(Boolean) |
| 1122 | : [] |
| 1123 | const pendingApproval = hydrateRunRequest(payload?.pendingApproval) |
| 1124 | |
| 1125 | runQueue.splice(0, runQueue.length, ...queue) |
| 1126 | pendingApprovalRequest = pendingApproval |
| 1127 | syncQueuedState() |
| 1128 | } catch (error) { |
| 1129 | pushLog( |
| 1130 | 'ui', |
| 1131 | `Failed to load runtime queue state: ${error instanceof Error ? error.message : String(error)}`, |
| 1132 | 'warn', |
| 1133 | ) |
| 1134 | } |
| 1135 | } |
| 1136 | |
| 1137 | async function repairInterruptedRuns() { |
| 1138 | const records = await readAppSessionsStore() |
no test coverage detected