/**
 * Pipeline Compositor (Lobster-inspired)
 *
 * Composes skills and tools into pipelines using pipe syntax.
 * Each step receives the output of the previous step as input.
 *
 * Syntax:
 * ```
 * search "query" | summarize | save-to-file output.md
 * ```
 *
 * Features:
 * - Pipe operator (|) chains steps
 * - Each step can be a tool, skill, or function
 * - Steps receive previous output as context
 * - Conditional branching with ? operator
 * - Parallel execution with & operator
 * - Error handling with || (fallback) operator
 *
 * Usage:
 * ```typescript
 * const pipeline = getPipelineCompositor();
 *
 * // Parse and run a pipeline
 * const result = await pipeline.run('search "node.js" | summarize | save output.md');
 *
 * // Programmatic pipeline
 * const result = await pipeline.execute([
 *   { tool: 'web_search', args: { query: 'node.js' } },
 *   { tool: 'summarize', args: {} },
 *   { tool: 'write_file', args: { path: 'output.md' } },
 * ]);
 * ```
 */
import { EventEmitter } from 'events';
/**
 * A single step in a pipeline
 */
export interface PipelineStep {
    /** Step type */
    type: 'tool' | 'skill' | 'function' | 'transform';
    /** Tool or skill name */
    name: string;
    /** Arguments */
    args: Record<string, unknown>;
    /** Raw argument string */
    rawArgs?: string;
    /** Step label */
    label?: string;
    /** Timeout in ms */
    timeout?: number;
    /** Fallback step if this one fails */
    fallback?: PipelineStep;
}
/**
 * Pipeline operators
 */
export type PipelineOperator = '|' | '||' | '&&' | '&';
/**
 * A parsed pipeline token
 */
export interface PipelineToken {
    type: 'step' | 'operator';
    step?: PipelineStep;
    operator?: PipelineOperator;
}
/**
 * Result of a pipeline step
 */
export interface StepResult {
    /** Step that was executed */
    step: PipelineStep;
    /** Whether the step succeeded */
    success: boolean;
    /** Output data */
    output: string;
    /** Error message if failed */
    error?: string;
    /** Duration in ms */
    durationMs: number;
    /** Step index in pipeline */
    index: number;
}
/**
 * Result of a full pipeline execution
 */
export interface PipelineResult {
    /** Whether the pipeline completed successfully */
    success: boolean;
    /** Final output */
    output: string;
    /** Results for each step */
    steps: StepResult[];
    /** Total duration in ms */
    totalDurationMs: number;
    /** Error if pipeline failed */
    error?: string;
}
/**
 * Tool executor function type
 */
export type ToolExecutor = (toolName: string, args: Record<string, unknown>, input?: string) => Promise<{
    success: boolean;
    output: string;
    error?: string;
}>;
/**
 * Pipeline compositor configuration
 */
export interface PipelineConfig {
    /** Default step timeout in ms */
    defaultTimeout: number;
    /** Maximum steps in a pipeline */
    maxSteps: number;
    /** Maximum total pipeline duration in ms */
    maxDurationMs: number;
    /** Tool executor function */
    toolExecutor?: ToolExecutor;
}
export declare class PipelineCompositor extends EventEmitter {
    private config;
    constructor(config?: Partial<PipelineConfig>);
    /**
     * Parse a pipeline string into steps
     *
     * Syntax: `step1 args | step2 args | step3 args`
     * Fallback: `step1 args || fallback-step args`
     * Sequential: `step1 args && step2 args`
     */
    parse(pipelineString: string): PipelineToken[];
    /**
     * Tokenize pipeline string, respecting quotes
     */
    private tokenize;
    /**
     * Parse a single step string
     */
    private parseStep;
    /**
     * Parse arguments from a string
     */
    private parseArgs;
    /**
     * Run a pipeline from a string
     */
    run(pipelineString: string): Promise<PipelineResult>;
    /**
     * Execute a pipeline from step definitions
     */
    execute(steps: PipelineStep[]): Promise<PipelineResult>;
    /**
     * Execute pipeline from tokens
     */
    private executeTokens;
    /**
     * Execute a single step
     */
    private executeStep;
    /**
     * Run a step based on its type
     */
    private runStep;
    /**
     * Run a built-in transform
     */
    private runTransform;
    /**
     * Run a tool step using the configured executor
     */
    private runTool;
    /**
     * Set the tool executor
     */
    setToolExecutor(executor: ToolExecutor): void;
    /**
     * Register a custom transform
     */
    registerTransform(name: string, fn: (input: string, args: Record<string, unknown>) => string): void;
    /**
     * List available transforms
     */
    listTransforms(): string[];
    /**
     * Load a pipeline definition from a JSON or YAML file.
     * Returns parsed PipelineStep array ready for execution.
     */
    loadFromFile(filePath: string): Promise<{
        name: string;
        description?: string;
        steps: PipelineStep[];
    }>;
    /**
     * Validate a pipeline definition (steps array).
     * Returns a list of error/warning messages.
     */
    validateDefinition(steps: PipelineStep[]): {
        valid: boolean;
        errors: string[];
        warnings: string[];
    };
    dispose(): void;
}
export declare function getPipelineCompositor(config?: Partial<PipelineConfig>): PipelineCompositor;
export declare function resetPipelineCompositor(): void;
