import { runByFilter, type RunOptions } from "./runner.js";
import type { Result, Run, TestingWorkflow, WorkflowSandboxCleanup, WorkflowSandboxSyncStrategy } from "../types/index.js";
export interface WorkflowRunOptions {
    url: string;
    model?: string;
    headed?: boolean;
    parallel?: number;
    timeout?: number;
    dryRun?: boolean;
}
export interface WorkflowSandboxPlan {
    provider?: string;
    image?: string;
    name: string;
    remoteDir: string;
    stateRemoteDir: string;
    command: string;
    cleanup: WorkflowSandboxCleanup;
    syncStrategy: WorkflowSandboxSyncStrategy;
    timeoutMs?: number;
    env?: Record<string, string>;
}
export interface WorkflowRunPlan {
    workflow: TestingWorkflow;
    runOptions: RunOptions & {
        tags?: string[];
        priority?: string;
        scenarioIds?: string[];
    };
    sandbox: WorkflowSandboxPlan | null;
}
export interface WorkflowDatabaseBundle {
    localDir: string;
    remoteDir: string;
    cleanup?: () => void;
}
export interface WorkflowSandboxExecutionResult {
    sandboxId: string;
    sessionId: string;
    exitCode: number;
    stdout: string;
    stderr: string;
    cleanup: string;
}
interface SandboxCommandResult {
    sandbox: {
        id: string;
    };
    session: {
        id: string;
    };
    result: {
        exit_code?: number;
        exitCode?: number;
        stdout?: string;
        stderr?: string;
    };
    cleanup: string;
}
export interface WorkflowSandboxesRuntime {
    runCommandInSandbox(input: {
        command: string;
        provider?: string;
        name?: string;
        image?: string;
        sandboxTimeout?: number;
        commandTimeoutMs?: number;
        projectId?: string;
        config?: Record<string, unknown>;
        sandboxEnvVars?: Record<string, string>;
        cwd?: string;
        upload: {
            localDir: string;
            remoteDir: string;
            syncStrategy?: WorkflowSandboxSyncStrategy;
        };
        cleanup?: WorkflowSandboxCleanup;
        onStdout?: (data: string) => void;
        onStderr?: (data: string) => void;
    }): Promise<SandboxCommandResult>;
}
export interface WorkflowRunnerDependencies {
    runByFilter?: typeof runByFilter;
    sandboxes?: WorkflowSandboxesRuntime;
    createSandboxesSDK?: () => WorkflowSandboxesRuntime | Promise<WorkflowSandboxesRuntime>;
    createDatabaseBundle?: (workflow: TestingWorkflow, plan: WorkflowRunPlan) => WorkflowDatabaseBundle;
}
export declare function buildWorkflowRunPlan(workflow: TestingWorkflow, options: WorkflowRunOptions): WorkflowRunPlan;
export declare function runTestingWorkflow(workflowId: string, options: WorkflowRunOptions, dependencies?: WorkflowRunnerDependencies): Promise<{
    run: Run | null;
    results: Result[];
    plan: WorkflowRunPlan;
    sandboxResult?: WorkflowSandboxExecutionResult;
}>;
export declare function createWorkflowDatabaseBundle(workflow: TestingWorkflow, plan: WorkflowRunPlan): WorkflowDatabaseBundle;
export {};
//# sourceMappingURL=workflow-runner.d.ts.map