Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

838 B
Raw Blame
import { BaseEngineOperation, CodeAction, PieceAction, StepOutput } from '@activepieces/shared'
import { EngineConstants } from './context/engine-constants'
import { FlowExecutorContext } from './context/flow-execution-context'
import { flowExecutor } from './flow-executor'

export const actionRunStepRunner = {
    async run({ step, operation }: ActionRunStepParams): Promise<StepOutput> {
        const executionState = await flowExecutor.getExecutorForAction(step.type).handle({
            action: step,
            executionState: FlowExecutorContext.empty(),
            constants: EngineConstants.fromExecuteActionInput(operation),
        })
        return executionState.steps[step.name]
    },
}

type ActionRunStepParams = {
    step: PieceAction | CodeAction
    operation: BaseEngineOperation & { flowVersionId?: string }
}