( runId: string, updater: (current: AutonomyRunRecord) => AutonomyRunRecord | null, rootDir: string = getProjectRoot(), )
| 233 | } |
| 234 | |
| 235 | async function updateAutonomyRun( |
| 236 | runId: string, |
| 237 | updater: (current: AutonomyRunRecord) => AutonomyRunRecord | null, |
| 238 | rootDir: string = getProjectRoot(), |
| 239 | ): Promise<AutonomyRunRecord | null> { |
| 240 | return withAutonomyPersistenceLock(rootDir, async () => { |
| 241 | const runs = await listAutonomyRuns(rootDir) |
| 242 | const index = runs.findIndex(run => run.runId === runId) |
| 243 | if (index === -1) { |
| 244 | return null |
| 245 | } |
| 246 | const next = updater(cloneRunRecord(runs[index]!)) |
| 247 | if (!next) { |
| 248 | return null |
| 249 | } |
| 250 | const updated = cloneRunRecord(next) |
| 251 | runs[index] = updated |
| 252 | await writeAutonomyRuns(runs, rootDir) |
| 253 | return updated |
| 254 | }) |
| 255 | } |
| 256 | |
| 257 | export async function getAutonomyRunById( |
| 258 | runId: string, |
no test coverage detected