( params: CreateAutonomyRunParams, skipIfActiveSource: boolean, )
| 482 | } |
| 483 | |
| 484 | async function createAutonomyRunCore( |
| 485 | params: CreateAutonomyRunParams, |
| 486 | skipIfActiveSource: boolean, |
| 487 | ): Promise<AutonomyRunRecord | null> { |
| 488 | const rootDir = resolve(params.rootDir ?? getProjectRoot()) |
| 489 | const currentDir = resolve(params.currentDir ?? rootDir) |
| 490 | const record = buildAutonomyRunRecord(params, rootDir, currentDir) |
| 491 | |
| 492 | const { created, recoveredStaleRuns } = await persistAutonomyRunRecord( |
| 493 | record, |
| 494 | rootDir, |
| 495 | skipIfActiveSource, |
| 496 | ) |
| 497 | for (const recovered of recoveredStaleRuns) { |
| 498 | await syncFailedManagedFlowForRun(recovered, rootDir) |
| 499 | } |
| 500 | if (!created) { |
| 501 | return null |
| 502 | } |
| 503 | await queueManagedFlowStepRunForRecord(record, rootDir) |
| 504 | return record |
| 505 | } |
| 506 | |
| 507 | export async function createAutonomyRun( |
| 508 | params: CreateAutonomyRunParams, |
no test coverage detected