/**
 * Plugin registry — typed extension points for AILF evaluation capabilities.
 *
 * Three-tier architecture:
 * - **Mode bases** define evaluation methodology (rubrics, scoring, prompts)
 * - **Domain presets** target a mode base and add domain config (sources,
 *   features, doc fetcher)
 * - **Framework assertions** are generic evaluation primitives available to
 *   all modes
 *
 * @see docs/design-docs/architecture-overhaul/extensibility-plugins.md
 */
import type { PromptTemplate } from "../ports/mode-handler.js";
import type { DocFetcher } from "../ports/doc-fetcher.js";
import type { SourceEntry } from "../config-helpers.js";
import type { FeatureRegistry } from "../schemas/pipeline.js";
/**
 * A named variant within an evaluation mode.
 *
 * Modes can declare variants to represent different evaluation strategies
 * that share the same methodology. For example, the literacy mode has
 * "baseline", "observed", and "agentic-*" variants.
 *
 * Models opt into specific variants via `ModelEntry.variants`. When a model
 * enrolls in a mode without specifying variants, all defined variants are
 * included by default.
 */
export interface ModeVariantDefinition {
    /** Variant identifier (e.g., "baseline", "agentic-naive") */
    id: string;
    /** Human-readable label (e.g., "Standard (baseline)") */
    label: string;
    /** Optional description for docs/CLI help */
    description?: string;
}
/** A registered evaluation mode handler */
export interface ModeRegistration {
    /** Unique mode identifier (e.g., "api-contract") */
    id: string;
    /** Human-readable label */
    label: string;
    /** Valid provider pattern regexes */
    validProviderPatterns: string[];
    /** Rubric template IDs available for this mode */
    rubricTemplateIds: string[];
    /** Compile function module path (loaded at runtime) */
    handlerModule: string;
    /**
     * Variants this mode supports. Omit or empty for modes without variants.
     *
     * When defined, models can selectively opt into specific variants via
     * `ModelEntry.variants`. Models that enroll in the mode without specifying
     * variants participate in all defined variants.
     */
    variants?: ModeVariantDefinition[];
}
/** A registered assertion type */
export interface AssertionRegistration {
    /** Assertion type name (e.g., "api-contract-match") */
    type: string;
    /** Human-readable label */
    label: string;
    /**
     * Which modes this assertion is compatible with.
     * When omitted, the assertion is compatible with all modes.
     * When specified, acts as a whitelist of mode IDs.
     */
    compatibleModes?: string[];
    /** Assertion handler module path */
    handlerModule: string;
}
/** A registered rubric template */
export interface RubricTemplateRegistration {
    /** Template ID (e.g., "api-accuracy") */
    id: string;
    /** Scoring dimension this template contributes to */
    dimension: string;
    /** Scale header text */
    header: string;
    /** Scale entries */
    scale: string[];
    /** Criteria label */
    criteriaLabel?: string;
}
/** A registered fixture resolver */
export interface FixtureResolverRegistration {
    /** URI scheme this resolver handles (e.g., "graphql://") */
    scheme: string;
    /** Resolver module path */
    handlerModule: string;
}
/** A registered report sink */
export interface ReportSinkRegistration {
    /** Sink identifier (e.g., "bigquery", "slack") */
    id: string;
    /** Sink module path */
    handlerModule: string;
}
/**
 * ModeBase — shared evaluation methodology for a mode.
 *
 * Defines HOW you evaluate (rubrics, scoring, prompts) independently of
 * WHAT you're evaluating (sources, features, docs). Multiple domain presets
 * can target the same mode base and inherit its defaults.
 *
 * Example: the "literacy" mode base defines rubric templates for
 * task-completion, code-correctness, and doc-coverage. Both a Sanity docs
 * preset and an external docs preset can target "literacy" and inherit
 * these rubrics without redefining them.
 */
export interface ModeBase {
    /** The mode registration (handler, provider patterns, rubric template IDs) */
    mode: ModeRegistration;
    /** Default rubric templates for this mode */
    rubricTemplates?: RubricTemplateRegistration[];
    /** Default scoring profiles for this mode (profile name → dimension weights) */
    scoringProfiles?: Record<string, Record<string, number>>;
    /** Default prompt templates for this mode (template name → template) */
    promptTemplates?: Record<string, PromptTemplate>;
    /** Mode-specific assertion types (beyond framework builtins) */
    assertions?: AssertionRegistration[];
}
/** Plugin manifest describing a single plugin */
export interface PluginManifest {
    /** Plugin name (npm package style) */
    name: string;
    /** Semver version */
    version: string;
    /** Human-readable description */
    description?: string;
    /** Plugin API version this plugin targets */
    pluginApiVersion: number;
    /** Minimum AILF version required */
    minAILFVersion?: string;
    /** Dependencies on other plugins */
    requires?: string[];
}
/**
 * A domain preset targets a mode base and adds domain-specific configuration.
 *
 * The preset inherits evaluation methodology (rubrics, scoring, prompts) from
 * its mode base. It can optionally override any inherited values.
 */
export interface PresetDefinition {
    /** Preset name (unique identifier) */
    name: string;
    /** Plugin manifest */
    manifest: PluginManifest;
    /**
     * Lifecycle status — mirrors task status semantics.
     *   active:   registered and used in evaluations (default)
     *   draft:    registered but skipped unless explicitly targeted
     *   paused:   registered but skipped (can be resumed)
     *   archived: not registered
     */
    status?: "active" | "archived" | "draft" | "paused";
    /**
     * Which mode this preset targets (by mode ID).
     * Links to a registered ModeBase. The preset inherits rubrics,
     * scoring profiles, and prompt templates from the base.
     */
    mode: string;
    /** Fixture resolvers */
    fixtureResolvers?: FixtureResolverRegistration[];
    /** Report sinks */
    reportSinks?: ReportSinkRegistration[];
    /** Factory function that creates a DocFetcher instance */
    docFetcher?: () => DocFetcher;
    /** Documentation source definitions (production, branch, local, etc.) */
    sourceDefs?: SourceEntry[];
    /** Product feature registry for coverage tracking */
    featureDefs?: FeatureRegistry;
    /** Override rubric templates (merged by ID with mode base) */
    rubricTemplates?: RubricTemplateRegistration[];
    /** Override scoring profiles (merged by name with mode base) */
    scoringProfiles?: Record<string, Record<string, number>>;
    /** Override prompt templates (merged by name with mode base) */
    promptTemplates?: Record<string, PromptTemplate>;
    /** Additional mode-specific assertions */
    assertions?: AssertionRegistration[];
}
/**
 * PluginRegistry — central registry for all AILF extensions.
 *
 * Plugins register their capabilities here. The pipeline queries the
 * registry to discover available modes, assertions, templates, etc.
 */
export interface PluginRegistry {
    /** Register a complete preset (bundles multiple extensions) */
    registerPreset(preset: PresetDefinition): void;
    /** Register a single evaluation mode */
    registerMode(mode: ModeRegistration): void;
    /** Register a single assertion type */
    registerAssertion(assertion: AssertionRegistration): void;
    /** Register a rubric template */
    registerRubricTemplate(template: RubricTemplateRegistration): void;
    /** Register a fixture resolver */
    registerFixtureResolver(resolver: FixtureResolverRegistration): void;
    /** Register a report sink */
    registerReportSink(sink: ReportSinkRegistration): void;
    /** Get all registered modes */
    getModes(): ModeRegistration[];
    /** Get a mode by ID */
    getMode(id: string): ModeRegistration | undefined;
    /** Get all registered assertion types */
    getAssertions(): AssertionRegistration[];
    /** Get all registered rubric templates */
    getRubricTemplates(): RubricTemplateRegistration[];
    /** Get all registered fixture resolvers */
    getFixtureResolvers(): FixtureResolverRegistration[];
    /** Get all registered report sinks */
    getReportSinks(): ReportSinkRegistration[];
    /** Register prompt templates (merged with existing) */
    registerPromptTemplates(templates: Record<string, PromptTemplate>): void;
    /** Get all registered prompt templates */
    getPromptTemplates(): Record<string, PromptTemplate>;
    /** Register scoring profiles (merged with existing) */
    registerScoringProfiles(profiles: Record<string, Record<string, number>>): void;
    /** Get all registered scoring profiles */
    getScoringProfiles(): Record<string, Record<string, number>>;
    /** Register a doc fetcher factory (last-write-wins) */
    registerDocFetcherFactory(factory: () => DocFetcher): void;
    /** Get the registered doc fetcher factory, if any */
    getDocFetcherFactory(): (() => DocFetcher) | undefined;
    /** Register source definitions (concatenated with existing) */
    registerSourceDefs(sources: SourceEntry[]): void;
    /** Get all registered source definitions */
    getSourceDefs(): SourceEntry[];
    /** Register a feature registry (merged by feature ID with existing) */
    registerFeatureDefs(features: FeatureRegistry): void;
    /** Get the registered feature registry, if any */
    getFeatureDefs(): FeatureRegistry | undefined;
    /** Register a mode base (evaluation methodology) */
    registerModeBase(base: ModeBase): void;
    /** Get a mode base by mode ID */
    getModeBase(modeId: string): ModeBase | undefined;
    /** Get all registered mode bases */
    getModeBases(): ModeBase[];
    /** Get all registered presets */
    getPresets(): PresetDefinition[];
}
/**
 * In-memory plugin registry implementation.
 */
export declare class InMemoryPluginRegistry implements PluginRegistry {
    private readonly modes;
    private readonly assertions_;
    private readonly rubricTemplates_;
    private readonly fixtureResolvers_;
    private readonly reportSinks_;
    private readonly modeBases_;
    private readonly presets_;
    private promptTemplates_;
    private scoringProfiles_;
    private docFetcherFactory_;
    private sourceDefs_;
    private featureDefs_;
    registerPreset(preset: PresetDefinition): void;
    registerMode(mode: ModeRegistration): void;
    registerAssertion(assertion: AssertionRegistration): void;
    registerRubricTemplate(template: RubricTemplateRegistration): void;
    registerFixtureResolver(resolver: FixtureResolverRegistration): void;
    registerReportSink(sink: ReportSinkRegistration): void;
    getModes(): ModeRegistration[];
    getMode(id: string): ModeRegistration | undefined;
    getAssertions(): AssertionRegistration[];
    getRubricTemplates(): RubricTemplateRegistration[];
    getFixtureResolvers(): FixtureResolverRegistration[];
    getReportSinks(): ReportSinkRegistration[];
    getPresets(): PresetDefinition[];
    registerPromptTemplates(templates: Record<string, PromptTemplate>): void;
    getPromptTemplates(): Record<string, PromptTemplate>;
    registerScoringProfiles(profiles: Record<string, Record<string, number>>): void;
    getScoringProfiles(): Record<string, Record<string, number>>;
    registerDocFetcherFactory(factory: () => DocFetcher): void;
    getDocFetcherFactory(): (() => DocFetcher) | undefined;
    registerSourceDefs(sources: SourceEntry[]): void;
    getSourceDefs(): SourceEntry[];
    registerFeatureDefs(features: FeatureRegistry): void;
    getFeatureDefs(): FeatureRegistry | undefined;
    registerModeBase(base: ModeBase): void;
    getModeBase(modeId: string): ModeBase | undefined;
    getModeBases(): ModeBase[];
}
