/**
 * Pipeline action — resolves CLI options and orchestrates pipeline steps.
 *
 * This file is the thin CLI-to-orchestrator bridge. The bulk of execution
 * logic lives in packages/eval/src/orchestration/.
 *
 * Responsibilities:
 * - Resolve CLI flags into typed ResolvedOptions
 * - Delegate to the PipelineOrchestrator for step execution
 *
 * @see packages/eval/src/orchestration/ for the step-based pipeline
 */
import { type ImpactSummary } from "../pipeline/reverse-mapping.js";
import type { DebugOptions, EvalMode } from "../pipeline/types.js";
import { type Diagnosis, type GeneralizedDocRef, type RepoProvenanceConfig, type ReportStorePort, type SynthesisCostTelemetry } from "../_vendor/ailf-core/index.d.ts";
import { type RepoConfig } from "../adapters/task-sources/repo-schemas.js";
import { type UserConfig } from "../adapters/config-sources/user-config.js";
import type { PipelineCliOptions } from "./run.js";
export interface ResolvedOptions {
    allowedOriginArgs: string[];
    areaOption?: string;
    beforeOption?: string;
    changedDocsOption?: string;
    compareBaseline?: string;
    compareEnabled: boolean;
    compareThreshold?: number;
    concurrency?: number;
    baseUrlOverride?: string;
    datasetOverride?: string;
    debug?: DebugOptions;
    dryRun: boolean;
    gapAnalysisEnabled: boolean;
    graderReplications?: number;
    /**
     * Replications per borderline judgment for the GRAD-04 intra-grader
     * consensus pass. Sourced from `.ailf/config.yaml`'s
     * `execution.borderlineReplications`.
     */
    borderlineReplications?: number;
    /** Grader context policy from `.ailf/config.yaml` `grader.context` */
    graderContext?: "rubric-only" | "with-docs";
    headerArgs: string[];
    impactSummary?: ImpactSummary;
    mode: EvalMode;
    /** Literacy variant — set when the user passes a legacy mode name */
    variant?: string;
    noAutoScope: boolean;
    noCache: boolean;
    noRemoteCache: boolean;
    /** Base directory for user-facing pipeline output artifacts (always resolved). */
    outputDir: string;
    outputPath?: string;
    perspectiveOverride?: string;
    projectIdOverride?: string;
    promptfooUrl?: string;
    publishEnabled: boolean;
    /** True when --publish or --no-publish was explicitly passed by the user. */
    publishExplicit: boolean;
    /** True when a report-store token is present (AILF_REPORT_SANITY_API_TOKEN
     * or SANITY_API_TOKEN). Mirrors the gate's `reportStore != null` so the
     * interactive resolver can detect "this run will publish" without re-reading
     * process.env. */
    reportStoreConfigured: boolean;
    publishTag?: string;
    reportDataset?: string;
    reportProjectId?: string;
    sanityDocumentArgs: string[];
    /**
     * `--inject-doc` flag refs (D0090), resolved against the active source as
     * bare `GeneralizedDocRef`s. Flows to `ResolvedConfig.injectContextDocs`,
     * merged with any config-file `injectContextDocs`. Undefined when no
     * `--inject-doc` flag was passed.
     */
    injectContextDocsOption?: GeneralizedDocRef[];
    searchMode: string;
    skipEval: boolean;
    skipFetch: boolean;
    source?: string;
    studioOriginOverride?: string;
    remote: boolean;
    repoTasksPath?: string;
    /** Phase 6 / DIAG-06: post-run diagnosis summary policy. Precedence
     * resolution (CLI flag > env > config > auto) lives in
     * shouldRunPostSummary() — this field carries only the config-file
     * signal so the helper has a single typed input.
     */
    summaryOnRun?: "auto" | "always" | "never";
    taskOption?: string;
    tagOption?: string[];
    taskSourceType?: "content-lake" | "repo";
    urlArgs: string[];
    apiUrl: string;
    apiKey?: string;
    /** D0033 / W0049 — unified artifact surface (W0050 wires it into writer). */
    artifactsDisabled: boolean;
    artifactsDir?: string;
    artifactsDryRun: boolean;
    artifactsExclude?: readonly string[];
    /** D0037 / W0069 caller envelope — surfaces only on --remote today. */
    classificationOption?: string;
    ownerTeamOption?: string;
    ownerIndividualOption?: string;
    purposeOption?: string;
    labelOptions: string[];
    /**
     * Project-level provenance policy from `.ailf/config.yaml` (strengthen-only).
     * Threaded to `ResolvedConfig.provenance` for the T2 pre-publish gate.
     */
    provenanceOption?: RepoProvenanceConfig;
}
/**
 * Pure option resolution — computes ResolvedOptions from CLI flags without
 * any side effects. Safe to call from --explain without mutating process.env.
 *
 * Exported so the plan builder can call it independently.
 */
export declare function computeResolvedOptions(opts: PipelineCliOptions, repoConfig?: RepoConfig | null, userConfig?: UserConfig | null): ResolvedOptions;
/**
 * Determine whether the post-run diagnosis summary hook should fire.
 *
 * 4-level precedence chain (D0054):
 *   Level 1 — CLI flag (absolute): if `cliOpts.summary` is boolean, use it.
 *   Level 2 — AILF_INTERPRET_ON_RUN env var (absolute): strict "1"/"0" parse;
 *             anything else falls through (T-06-11 spoofing mitigation).
 *   Level 3 — config `summary.onRun` (absolute): "always" → true; "never" → false;
 *             "auto" or absent falls through to level 4.
 *   Level 4 — default always-on: diagnosis is a first-class output produced
 *             for every pipeline run unless explicitly opted out at levels 1–3.
 */
export declare function shouldRunPostSummary(cliOpts: PipelineCliOptions, resolvedOnRun: "auto" | "always" | "never" | undefined): boolean;
export declare function buildSynthesisTelemetry(diagnosis: Diagnosis): SynthesisCostTelemetry;
/**
 * Run post-pipeline hooks after the pipeline completes.
 *
 * Fires after orchestratePipeline() + writePipelineResult() (D6-02).
 * Hook failure prints to stderr but does NOT change exit code (D6-03).
 * Fires whenever shouldRunPostSummary returns true (D0054 — default on).
 *
 * @param ctx - App context (composition root wiring)
 * @param result - Pipeline result (includes reportId when published)
 * @param args - Hook options (cliOpts, summaryOnRun from config, optional runnerFactory for tests)
 */
export declare function runPostPipelineHooks(ctx: {
    reportStore?: ReportStorePort;
}, result: {
    success: boolean;
    reportId?: string;
}, args: {
    cliOpts: PipelineCliOptions;
    summaryOnRun?: "auto" | "always" | "never";
    /** Override runner factory for tests — avoids vi.mock of composition root */
    runnerFactory?: (ctx: unknown) => {
        run(opts: unknown): Promise<Diagnosis>;
    };
}): Promise<void>;
/**
 * True when `<callerCwd>/.ailf/tasks/` exists and holds at least one runnable
 * task file — the same file shapes `RepoTaskSource` loads (`*.task.ts`,
 * `*.task.js`, `*.yaml`, `*.yml`; dotfiles ignored). Mirrors the source
 * adapter's discovery so "present" means "would actually evaluate something".
 */
export declare function hasRunnableRepoTasks(callerCwd: string): boolean;
/**
 * D0064 — decide whether a local `ailf run` should auto-promote to the repo's
 * own `.ailf/tasks/` (repo-only) when the user has not chosen a task source.
 *
 * Promotes only when ALL hold:
 * - `configuredType` is unset (the RAW `taskSource.type`, NOT the
 *   `resolveTaskSourceType` output — that collapses `"content-lake"` to
 *   `undefined`, and an explicit `"content-lake"` must stay the opt-out).
 * - the run is local (`--remote` already inlines `.ailf/tasks/`).
 * - a populated `<callerCwd>/.ailf/tasks/` exists.
 */
export declare function shouldAutoPromoteRepoTasks(args: {
    configuredType: string | undefined;
    callerCwd: string;
    remote: boolean;
}): boolean;
/**
 * Render a failed `--config` load as a clean CLI diagnostic instead of an
 * uncaught ZodError stack trace. Mirrors the first-5-issues style of the
 * Content Lake gates, and appends a cross-schema hint when the file smells
 * like a `.ailf/ailf.config.ts` (`RepoConfig`) rather than an `EvalConfig`.
 */
export declare function formatConfigFileError(err: unknown, filePath: string): string;
/**
 * Execute the evaluation pipeline.
 *
 * 1. Resolve CLI options into typed ResolvedOptions
 * 2. Build AppContext (composition root wires adapters)
 * 3. Build step sequence from context
 * 4. Delegate to the PipelineOrchestrator
 */
export declare function executePipeline(cliOpts: PipelineCliOptions): Promise<void>;
/**
 * D0090: one-time stderr notice that `--sanity-document` is soft-deprecated.
 *
 * The flag keeps working (its replace/append fetch-override semantics and its
 * `--remote` forwarding are both intact) for at least one minor cycle. The
 * notice steers users at `--inject-doc` / the `--config` payload and is
 * precise about the semantic difference the two mechanisms have:
 *
 * - `--inject-doc` (and config `injectContextDocs`) ADD a document's context to
 *   every in-scope task — additive, never replaces anything.
 * - `--sanity-document` REPLACES the canonical doc when slugs match (otherwise
 *   appends) in the fetched doc set — a fetch-time source-set override.
 *
 * Stderr (not stdout) so it never contaminates piped report output. Exported
 * for the deprecation-notice contract test.
 */
export declare const SANITY_DOCUMENT_DEPRECATION_NOTICE: string;
export declare function warnSanityDocumentDeprecated(): void;
/**
 * Resolve CLI options into typed ResolvedOptions, loading the repo config
 * from `<cwd>/.ailf/` first. This is the single async entry point; the pure
 * `computeResolvedOptions` does the option mapping once the config is loaded.
 */
export declare function resolveOptions(opts: PipelineCliOptions): Promise<ResolvedOptions>;
/**
 * Load the repo config from `<cwd>/.ailf/`. Probes TS/JS/YAML/JSON in a
 * fixed precedence order (see `REPO_CONFIG_CANDIDATES`) and returns the
 * first match, validated against `RepoConfigSchema`. Returns null when no
 * config file is present, or when the matched file fails to load/parse (a
 * warning is emitted and the run falls back to defaults + env vars).
 *
 * Auto-loads regardless of `--task-source`: the same config file is the
 * per-environment configuration home for every run (W0077 Phase 6a).
 * Environment variables still win over file values — that cascade lives in
 * `computeResolvedOptions`, which receives the parsed config from here.
 */
export declare function loadRepoConfig(cwd?: string): Promise<RepoConfig | null>;
