(params: {
flowId: string
stepId: string
stepIndex: number
runId: string
rootDir?: string
nowMs?: number
})
| 563 | } |
| 564 | |
| 565 | export async function queueManagedAutonomyFlowStepRun(params: { |
| 566 | flowId: string |
| 567 | stepId: string |
| 568 | stepIndex: number |
| 569 | runId: string |
| 570 | rootDir?: string |
| 571 | nowMs?: number |
| 572 | }): Promise<AutonomyFlowRecord | null> { |
| 573 | const rootDir = resolve(params.rootDir ?? getProjectRoot()) |
| 574 | return updateAutonomyFlowById( |
| 575 | params.flowId, |
| 576 | current => { |
| 577 | const state = cloneManagedState(current.stateJson) |
| 578 | const step = state?.steps[params.stepIndex] |
| 579 | if (!state || !step || step.stepId !== params.stepId) { |
| 580 | return current |
| 581 | } |
| 582 | step.status = 'queued' |
| 583 | step.runId = params.runId |
| 584 | step.startedAt = undefined |
| 585 | step.endedAt = undefined |
| 586 | step.error = undefined |
| 587 | state.currentStepIndex = params.stepIndex |
| 588 | return { |
| 589 | ...current, |
| 590 | revision: current.revision + 1, |
| 591 | status: 'queued', |
| 592 | currentStep: step.name, |
| 593 | latestRunId: params.runId, |
| 594 | runCount: current.runCount + 1, |
| 595 | updatedAt: params.nowMs ?? Date.now(), |
| 596 | endedAt: undefined, |
| 597 | blockedRunId: undefined, |
| 598 | blockedSummary: undefined, |
| 599 | waitJson: undefined, |
| 600 | stateJson: state, |
| 601 | lastError: undefined, |
| 602 | } |
| 603 | }, |
| 604 | rootDir, |
| 605 | ) |
| 606 | } |
| 607 | |
| 608 | export async function markManagedAutonomyFlowStepRunning(params: { |
| 609 | flowId: string |
no test coverage detected