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

771 B
Raw Blame
export class StepExecutionPath {
    public path: readonly [string, number][] = []

    constructor(path: readonly [string, number][]) {
        this.path = [...path]
    }

    loopIteration({ loopName, iteration }: { loopName: string, iteration: number }): StepExecutionPath {
        return new StepExecutionPath([...this.path, [loopName, iteration]])
    }

    static empty(): StepExecutionPath {
        return new StepExecutionPath([])
    }

    waitpointKeyFor({ stepName }: { stepName: string }): string {
        return [...this.path.map(([loopName, iteration]) => `${loopName}:${iteration}`), stepName].join('/')
    }

    removeLast(): StepExecutionPath {
        const newPath = this.path.slice(0, -1)
        return new StepExecutionPath(newPath)
    }
}