/**
 * Plugin Registry Module
 *
 * This module manages registrations and execution of post-processors and validators
 * for document extraction pipelines.
 *
 * # Thread Safety
 * All registrations are stored in Maps and are single-threaded safe for WASM environments.
 *
 * # Global Callback Functions
 * The WASM module can invoke processing via global callback functions:
 * - `__kreuzberg_execute_post_processor`: Execute a registered post-processor
 * - `__kreuzberg_execute_validator`: Execute a registered validator
 */
import type { ExtractionResult } from "./types.d.ts";
/**
 * Post-processor plugin interface
 *
 * A post-processor modifies extraction results after extraction completes.
 */
export interface PostProcessor {
    /**
     * Get the processor name (must be non-empty string)
     */
    name(): string;
    /**
     * Get the processing stage (optional, defaults to "middle")
     * - "early": Process early in the pipeline
     * - "middle": Process in the middle of the pipeline
     * - "late": Process late in the pipeline
     */
    stage?(): "early" | "middle" | "late";
    /**
     * Process an extraction result
     * Can be sync or async
     */
    process(result: ExtractionResult): ExtractionResult | Promise<ExtractionResult>;
    /**
     * Shutdown the processor (optional)
     */
    shutdown?(): void | Promise<void>;
}
/**
 * Validator plugin interface
 *
 * A validator checks extraction results for correctness
 */
export interface Validator {
    /**
     * Get the validator name (must be non-empty string)
     */
    name(): string;
    /**
     * Get the validation priority (optional, defaults to 50)
     * Higher numbers = higher priority (execute first)
     */
    priority?(): number;
    /**
     * Validate an extraction result
     * Can be sync or async
     */
    validate(result: ExtractionResult): {
        valid: boolean;
        errors: string[];
    } | Promise<{
        valid: boolean;
        errors: string[];
    }>;
    /**
     * Shutdown the validator (optional)
     */
    shutdown?(): void | Promise<void>;
}
/**
 * Register a post-processor plugin
 *
 * @param processor - The post-processor to register
 * @throws {Error} If the processor is invalid or missing required methods
 *
 * @example
 * ```typescript
 * const processor = {
 *   name: () => "my-processor",
 *   stage: () => "middle",
 *   process: async (result) => {
 *     result.content = result.content.toUpperCase();
 *     return result;
 *   }
 * };
 * registerPostProcessor(processor);
 * ```
 */
export declare function registerPostProcessor(processor: PostProcessor): void;
/**
 * Get a registered post-processor by name
 *
 * @param name - The processor name
 * @returns The processor, or undefined if not found
 *
 * @example
 * ```typescript
 * const processor = getPostProcessor("my-processor");
 * if (processor) {
 *   console.log("Found processor:", processor.name());
 * }
 * ```
 */
export declare function getPostProcessor(name: string): PostProcessor | undefined;
/**
 * List all registered post-processor names
 *
 * @returns Array of processor names
 *
 * @example
 * ```typescript
 * const names = listPostProcessors();
 * console.log("Registered processors:", names);
 * ```
 */
export declare function listPostProcessors(): string[];
/**
 * Unregister a post-processor and call its shutdown method
 *
 * @param name - The processor name
 * @throws {Error} If the processor is not registered
 *
 * @example
 * ```typescript
 * await unregisterPostProcessor("my-processor");
 * ```
 */
export declare function unregisterPostProcessor(name: string): Promise<void>;
/**
 * Clear all registered post-processors
 *
 * Calls shutdown on all processors before clearing.
 *
 * @example
 * ```typescript
 * await clearPostProcessors();
 * ```
 */
export declare function clearPostProcessors(): Promise<void>;
/**
 * Register a validator plugin
 *
 * @param validator - The validator to register
 * @throws {Error} If the validator is invalid or missing required methods
 *
 * @example
 * ```typescript
 * const validator = {
 *   name: () => "my-validator",
 *   priority: () => 50,
 *   validate: async (result) => {
 *     if (!result.content) {
 *       return { valid: false, errors: ["Content is empty"] };
 *     }
 *     return { valid: true, errors: [] };
 *   }
 * };
 * registerValidator(validator);
 * ```
 */
export declare function registerValidator(validator: Validator): void;
/**
 * Get a registered validator by name
 *
 * @param name - The validator name
 * @returns The validator, or undefined if not found
 *
 * @example
 * ```typescript
 * const validator = getValidator("my-validator");
 * if (validator) {
 *   console.log("Found validator:", validator.name());
 * }
 * ```
 */
export declare function getValidator(name: string): Validator | undefined;
/**
 * List all registered validator names
 *
 * @returns Array of validator names
 *
 * @example
 * ```typescript
 * const names = listValidators();
 * console.log("Registered validators:", names);
 * ```
 */
export declare function listValidators(): string[];
/**
 * Unregister a validator and call its shutdown method
 *
 * @param name - The validator name
 * @throws {Error} If the validator is not registered
 *
 * @example
 * ```typescript
 * await unregisterValidator("my-validator");
 * ```
 */
export declare function unregisterValidator(name: string): Promise<void>;
/**
 * Clear all registered validators
 *
 * Calls shutdown on all validators before clearing.
 *
 * @example
 * ```typescript
 * await clearValidators();
 * ```
 */
export declare function clearValidators(): Promise<void>;
/**
 * Global callback for executing a post-processor from WASM
 *
 * Called by the WASM module to execute a registered post-processor.
 * Makes the callback available to WASM via the global scope.
 *
 * @internal
 */
export declare function executePostProcessor(name: string, result: ExtractionResult): Promise<ExtractionResult>;
/**
 * Global callback for executing a validator from WASM
 *
 * Called by the WASM module to execute a registered validator.
 * Makes the callback available to WASM via the global scope.
 *
 * @internal
 */
export declare function executeValidator(name: string, result: ExtractionResult): Promise<{
    valid: boolean;
    errors: string[];
}>;
/**
 * Expose global callback functions for WASM module
 *
 * This makes the plugin execution functions available as global callbacks
 * that the WASM module can invoke via JavaScript.
 *
 * @internal
 */
export declare function setupGlobalCallbacks(): void;
//# sourceMappingURL=plugin-registry.d.ts.map