/**
 * Multi-toolchain layer factory + merge helper.
 *
 * Some verification stages (install, typecheck, build, lint) run the
 * SAME logical layer across multiple parallel adapters — pnpm AND npm
 * AND cargo AND forge for a polyglot scaffold. The verifier presents
 * one row per stage; the toolchain breakdown lives in `findings.detail`.
 *
 * This module provides the merge: take N independent `LayerResult`s
 * (one per adapter) and reduce them to a single `LayerResult` whose
 * status is the worst of the parts and whose findings cite the adapter
 * that produced each one. Plus a {@link multiToolchainLayer} factory
 * that runs the adapter calls in parallel + applies the reducer.
 *
 * Pure utility — composes with {@link MultiLayerVerifier}.{run}.
 */
import type { Layer, LayerResult, VerifyContext } from './multi-layer-verifier';
export interface AdapterRun {
    /** Identifier for the adapter (e.g. 'pnpm', 'npm', 'cargo', 'forge'). */
    adapter: string;
    result: LayerResult;
}
export interface MergeOptions {
    /**
     * How to combine per-adapter `durationMs`. Default `'max'` (parallel
     * wall-clock). Set `'sum'` when reporting total work done across
     * adapters rather than wall time.
     */
    mergeDuration?: 'max' | 'sum';
    /**
     * Prefix finding messages with a per-adapter tag (e.g. `[pnpm] typecheck failed`).
     * Default: no prefix (renderers read `detail.adapter` instead).
     */
    messagePrefixer?: (adapter: string) => string;
    /**
     * How to reduce per-adapter `LayerResult.diagnostics` into the merged
     * result's diagnostics. `'max'` (default) — for each key, merged =
     * max across adapters where value is non-null (matches "if ANY adapter
     * saw N errors, merged saw N"). `'sum'` — sum non-null values.
     */
    mergeDiagnostics?: 'max' | 'sum';
}
/**
 * Reduce N adapter runs to a single `LayerResult` for a logical layer.
 *
 *   - status: worst of the parts (pass < skipped < fail < timeout < error)
 *   - score: weighted mean of numeric scores (skip = no contribution)
 *   - findings: union, each tagged with `detail.adapter`
 *   - durationMs: `mergeDuration` option (default 'max' for parallel wall-clock)
 *   - diagnostics: `mergeDiagnostics` option (default 'max' per key)
 *   - reason: " · "-joined `name: status` per adapter
 */
export declare function mergeLayerResults(name: string, perAdapter: AdapterRun[], options?: MergeOptions): LayerResult;
export interface MultiToolchainLayerConfig<Env, Adapter> {
    name: string;
    adapters: ReadonlyArray<Adapter>;
    /** Adapter identifier — used in findings + reason. */
    adapterName: (a: Adapter) => string;
    /** Run a single adapter against the verify context. */
    run: (a: Adapter, ctx: VerifyContext<Env>) => Promise<LayerResult> | LayerResult;
    dependsOn?: string[];
    weight?: number;
    failContributesToScore?: boolean;
    capMs?: number;
    /**
     * Per-adapter parallel cap. Defaults to 8 — defense in depth against a
     * caller passing 50 adapters and fanning out 50 simultaneous subprocesses.
     * Adapters that need higher concurrency raise this explicitly.
     */
    maxParallel?: number;
}
/**
 * Build a {@link Layer} that fans the same logical stage across N adapters
 * in parallel and merges via {@link mergeLayerResults}.
 *
 * Per-adapter throws are caught + converted to `status: 'error'` results
 * so one bad adapter doesn't poison the whole layer.
 */
export declare function multiToolchainLayer<Env, Adapter>(config: MultiToolchainLayerConfig<Env, Adapter>): Layer<Env>;
//# sourceMappingURL=multi-toolchain-layer.d.ts.map