MCPcopy Create free account
hub / github.com/claude-code-best/claude-code / queueManagedAutonomyFlowStepRun

Function queueManagedAutonomyFlowStepRun

src/utils/autonomyFlows.ts:565–606  ·  view source on GitHub ↗
(params: {
  flowId: string
  stepId: string
  stepIndex: number
  runId: string
  rootDir?: string
  nowMs?: number
})

Source from the content-addressed store, hash-verified

563}
564
565export 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
608export async function markManagedAutonomyFlowStepRunning(params: {
609 flowId: string

Callers 2

Calls 5

getProjectRootFunction · 0.85
updateAutonomyFlowByIdFunction · 0.85
cloneManagedStateFunction · 0.85
nowMethod · 0.80
resolveFunction · 0.70

Tested by

no test coverage detected