/**
 * OperationSpecRegistry:
 * - Registers ContractSpecs (unique by name+version)
 * - Binds runtime handlers to specs
 * - Provides lookup, iteration, and a safe execute() with validation/policy/enforcement
 *
 * Includes a minimal OpRegistry shim for backward-compat (deprecated).
 */
import type { AnySchemaModel } from '@contractspec/lib.schema';
import type { HandlerForOperationSpecWithResult } from '../install';
import { SpecContractRegistry } from '../registry';
import type { ResourceRefDescriptor } from '../resources';
import { type ContractResult } from '../results';
import type { HandlerCtx } from '../types';
import { type AnyOperationSpec, type OperationSpec } from './operation';
export type OperationKey = `${string}.v${string}`;
export declare function opKey(key: string, version: string): OperationKey;
type AnyOperationHandler = (args: unknown, ctx: HandlerCtx) => Promise<unknown>;
/**
 * In-memory registry for ContractSpecs and their bound handlers.
 * Provides validation, policy enforcement, and guarded event emission at execute time.
 */
export declare class OperationSpecRegistry extends SpecContractRegistry<'operation', AnyOperationSpec> {
    private handlers;
    constructor(items?: AnyOperationSpec[]);
    /**
     * Binds a runtime handler implementation to a previously registered spec.
     *
     * @param spec - The spec to bind to.
     * @param handler - The async function implementing the business logic.
     * @returns The registry instance for chaining.
     * @throws If the spec is not found or a handler is already bound.
     */
    bind<I extends AnySchemaModel, O extends AnySchemaModel | ResourceRefDescriptor<boolean>>(spec: OperationSpec<I, O>, handler: HandlerForOperationSpecWithResult<OperationSpec<I, O>>): this;
    /**
     * Retrieves the bound handler for a spec.
     */
    getHandler(key: string, version?: string): AnyOperationHandler | undefined;
    /** Iterate all bound operations (spec+handler). */
    listBound(): {
        spec: AnyOperationSpec;
        handler: AnyOperationHandler;
    }[];
    /**
     * Execute an operation by name/version with full runtime protections:
     * 1. Validates input against Zod schema.
     * 2. Enforces policy (Auth, RBAC, Rate Limits) via PDP.
     * 3. Guards event emission to ensure only declared events are sent.
     * 4. Validates output against Zod schema (if applicable).
     * 5. Tracks telemetry (success/failure).
     *
     * @param key - Operation key.
     * @param version - Operation version (optional, defaults to latest).
     * @param rawInput - The raw input payload (e.g. from JSON body).
     * @param ctx - The runtime context (actor, tenant, etc.).
     */
    execute(key: string, version: string | undefined, rawInput: unknown, ctx: HandlerCtx): Promise<unknown>;
    /**
     * Execute an operation and return a canonical ContractResult envelope.
     *
     * Existing adapters may keep using execute() for raw data compatibility.
     * New adapters should use this method to preserve success metadata and
     * typed failures across transport boundaries.
     */
    executeResult(key: string, version: string | undefined, rawInput: unknown, ctx: HandlerCtx): Promise<ContractResult<unknown, string, string>>;
    private executeRaw;
}
export {};
