import type { IMatrixContext } from '../engine/core/IMatrixContext';
import { FlowContext, type IFlowContextData } from './FlowContext';
import type { IFlowPlan } from './FlowPlan';
import type { IMatrixComponent } from './IMatrixComponent';
/**
 * Fluent builder for distributed flows over Matrix.
 *
 * Example:
 *
 *   const result = await FlowBuilder
 *     .start<string>(context)
 *     .fromValue("SELECT * FROM Items")
 *     .viaRemote("domain.db", "Query")
 *     .mapLocal(rows => rows.filter(x => x.score > 0.9))
 *     .toRemoteSink("domain.ui", "Render")
 *     .run();
 */
export declare class FlowBuilder<TIn, TCurrent> {
    private readonly context;
    private readonly ctx;
    private readonly id;
    private readonly stages;
    private readonly seedValue?;
    private constructor();
    /**
     * Entry point: create a builder tied to a context.
     */
    static start<TIn = any>(context: IMatrixContext, ctxSeed?: FlowContext | Partial<IFlowContextData>): FlowBuilder<TIn, TIn>;
    /**
     * Attach an initial value to the flow (similar to a LINQ source).
     */
    fromValue(value: TIn): FlowBuilder<TIn, TCurrent>;
    /**
     * Local synchronous/async projection.
     */
    mapLocal<TNext>(fn: (input: TCurrent) => TNext | Promise<TNext>): FlowBuilder<TIn, TNext>;
    /**
     * Local synchronous/async gate (whole-value filter).
     */
    filterLocal(predicate: (input: TCurrent) => boolean | Promise<boolean>): FlowBuilder<TIn, TCurrent>;
    /**
     * Remote request/response invocation as a pipeline stage.
     */
    viaRemote<TRes = any>(mount: string, op: string, timeoutMs?: number): FlowBuilder<TIn, TRes>;
    /**
     * Remote sink: RR side-effect that must succeed; value flows through unchanged.
     */
    toRemoteSink(mount: string, op: string, timeoutMs?: number): FlowBuilder<TIn, TCurrent>;
    /**
     * Materialize a IFlowPlan for inspection or deferred execution.
     */
    build(): IFlowPlan<TIn, TCurrent>;
    /**
     * Execute the flow immediately via FlowEngine.
     */
    run(input?: TIn): Promise<TCurrent>;
    /**
     * Execute the flow and wrap the result as IMatrixComponent.
     *
     * This is the strongly-typed way to get a component from a flow.
     * The return type tells you it's a component - no attribute checking needed.
     * Like LINQ returns IEnumerable<T>, this returns IMatrixComponent.
     *
     * If the result doesn't have shell info, it looks up the ShellRegistry
     * by componentClass to find rendering info.
     *
     * @example
     * const tree: IMatrixComponent = await flow()
     *   .fromValue({})
     *   .viaRemote("app.tree", "introspect")
     *   .runAsComponent();
     *
     * // Now you have strongly-typed component access
     * const child = await tree.child("root-1");
     * await child.send("setLabel", { label: "New" });
     * await child.render(container);
     */
    runAsComponent(input?: TIn): Promise<IMatrixComponent>;
    /**
     * Transform the current value into an IMatrixComponent.
     *
     * Use this when you want to continue the flow but need component access.
     * The returned builder has IMatrixComponent as its current type.
     *
     * @example
     * const flow = FlowBuilder
     *   .start(context)
     *   .fromValue({})
     *   .viaRemote("app.tree", "introspect")
     *   .asComponent()  // TCurrent is now IMatrixComponent
     *   .mapLocal(comp => comp.child("root-1"));  // Returns Promise<IMatrixComponent>
     */
    asComponent(): FlowBuilder<TIn, IMatrixComponent>;
}
//# sourceMappingURL=FlowBuilder.d.ts.map