import type { AgentRelayOptions } from '../relay.js';
import type { AgentCli, DryRunReport, IdleNudgeConfig, RelayYamlConfig, SwarmPattern, VerificationCheck, WorkflowRunRow } from './types.js';
import { type WorkflowEventListener, type VariableContext, type StepExecutor } from './runner.js';
export interface AgentOptions {
    cli: AgentCli;
    role?: string;
    task?: string;
    channels?: string[];
    model?: string;
    maxTokens?: number;
    timeoutMs?: number;
    retries?: number;
    /** Seconds of silence before considering the agent idle (for idle nudging). */
    idleThresholdSecs?: number;
    /** When false, the agent runs as a non-interactive subprocess (no PTY, no relay messaging).
     *  Default: true. */
    interactive?: boolean;
}
export interface StepOptions {
    agent: string;
    task: string;
    dependsOn?: string[];
    verification?: VerificationCheck;
    timeoutMs?: number;
    retries?: number;
}
export interface ErrorOptions {
    maxRetries?: number;
    retryDelayMs?: number;
    notifyChannel?: string;
}
export interface WorkflowRunOptions {
    /** Run a specific workflow by name (default: first). */
    workflow?: string;
    /** Template variable substitutions. */
    vars?: VariableContext;
    /** Working directory (default: process.cwd()). */
    cwd?: string;
    /** AgentRelay options (all optional). */
    relay?: AgentRelayOptions;
    /** Progress callback. */
    onEvent?: WorkflowEventListener;
    /** Validate and print execution plan without spawning agents. */
    dryRun?: boolean;
    /** External step executor (e.g. Daytona sandbox backend). */
    executor?: StepExecutor;
}
/**
 * Fluent builder for constructing workflow configurations programmatically.
 *
 * @example
 * ```typescript
 * import { workflow } from "@agent-relay/sdk/workflows";
 *
 * const result = await workflow("my-workflow")
 *   .pattern("dag")
 *   .agent("worker", { cli: "claude", role: "Backend engineer" })
 *   .step("build", { agent: "worker", task: "Build the project" })
 *   .step("test", { agent: "worker", task: "Run tests", dependsOn: ["build"] })
 *   .run();
 * ```
 */
export declare class WorkflowBuilder {
    private _name;
    private _description?;
    private _pattern;
    private _maxConcurrency?;
    private _timeoutMs?;
    private _channel?;
    private _idleNudge?;
    private _agents;
    private _steps;
    private _errorHandling?;
    constructor(name: string);
    /** Set workflow description. */
    description(desc: string): this;
    /** Set swarm pattern (default: "dag"). */
    pattern(p: SwarmPattern): this;
    /** Set maximum concurrent agents. */
    maxConcurrency(n: number): this;
    /** Set global timeout in milliseconds. */
    timeout(ms: number): this;
    /** Set the relay channel for agent communication. */
    channel(ch: string): this;
    /** Configure idle agent detection and nudging for interactive agents. */
    idleNudge(config: IdleNudgeConfig): this;
    /** Add an agent definition. */
    agent(name: string, options: AgentOptions): this;
    /** Add a workflow step. */
    step(name: string, options: StepOptions): this;
    /** Set error handling strategy. */
    onError(strategy: 'fail-fast' | 'continue' | 'retry', options?: ErrorOptions): this;
    /** Build and return the RelayYamlConfig object. */
    toConfig(): RelayYamlConfig;
    /** Serialize the config to a YAML string. */
    toYaml(): string;
    /** Build the config and execute it with the WorkflowRunner. */
    run(options: WorkflowRunOptions & {
        dryRun: true;
    }): Promise<DryRunReport>;
    run(options?: WorkflowRunOptions): Promise<WorkflowRunRow>;
}
/**
 * Create a new workflow builder.
 *
 * @example
 * ```typescript
 * const result = await workflow("my-task")
 *   .pattern("fan-out")
 *   .agent("worker", { cli: "claude" })
 *   .step("do-work", { agent: "worker", task: "Build the feature" })
 *   .run();
 * ```
 */
export declare function workflow(name: string): WorkflowBuilder;
//# sourceMappingURL=builder.d.ts.map