import type { ExecutionService } from '../../runtime/execution-service.js';
import type { McpResourceAddress } from '../protocol/uris.js';
import type { McpExecutionCapture, McpOperationExecutor, McpOperationInput, McpOperationKind } from './types.js';
/** Controller-owned bounded operation service, independent of SDK request lifetime. */
export declare function createMcpOperations<T>(options: {
    /** Synchronous captured authority; no target validation until after dedup. */
    capture: () => McpExecutionCapture<T>;
    /** Same lane supplied to server-triggered UI fallback tests. */
    execution?: ExecutionService;
    /** Adapter owns lane lifetime by default; project SDK supplies shared ownership. */
    ownsExecution?: boolean;
    /** Injectable retention clock. */
    now?: () => number;
    /** Captured opaque transport identity, never the authenticated principal. */
    clientIdForPrincipal?: (principal: string) => string;
}): {
    execution: {
        readonly available: boolean;
        readonly pendingCount: number;
        enqueue<T_1>(task: import("../../runtime/execution-types.js").ExecutionTask<T_1>): import("../../runtime/execution-types.js").ExecutionHandle<T_1>;
        cancelAll: () => Promise<void>;
        quarantine(): void;
        close(): Promise<void>;
    };
    /** Safe bounded UI activity history independent of MCP result retention. */
    snapshot: () => import("@histoire/shared").UiMcpOperationInfo[];
    /** Observe lifecycle without obtaining records or result capabilities. */
    onOperationChange: (listener: (operation: import("@histoire/shared").UiMcpOperationInfo) => void) => () => void;
    /** Execution stays unavailable after unconfirmed cleanup until process restart. */
    readonly available: boolean;
    /** Discovery reflects implemented executor registration, not package availability. */
    hasExecutor(kind: McpOperationKind): boolean;
    /** Install concrete screenshot/test callbacks without duplicating admission logic. */
    registerExecutor(kind: McpOperationKind, executor: McpOperationExecutor<T>): void;
    /** Atomic admission and retry reconciliation happen before any await/resources. */
    admit(principal: string, kind: McpOperationKind, input: McpOperationInput): {
        operationId: string;
        projectId: string;
        epoch: string;
        revision: string;
        kind: "inspect-accessibility" | "inspect-dom" | "inspect-variant" | "runtime-diagnostics" | "screenshot" | "tests";
        state: "cancelled" | "cancelling" | "completed" | "failed" | "queued" | "running";
        createdAt: string;
        startedAt?: string;
        finishedAt?: string;
        result?: {
            storyId: string;
            variantId: string;
            viewport: {
                width: number;
                height: number;
            };
            truncated: boolean;
            inspection: "variant";
            state: Record<string, import("zod").JSONType>;
            propsAvailable: boolean;
            components: {
                name: string;
                index: number;
                props: {
                    name: string;
                    types?: string[];
                    required?: boolean;
                    default?: import("zod").JSONType;
                    value?: import("zod").JSONType;
                    values?: import("zod").JSONType[];
                }[];
            }[];
            omittedValues: number;
        } | {
            storyId: string;
            variantId: string;
            viewport: {
                width: number;
                height: number;
            };
            truncated: boolean;
            inspection: "dom";
            matched: boolean;
            nodes: {
                index: number;
                parentIndex?: number;
                tag: string;
                attributes: Record<string, string>;
                text: string;
                rect: {
                    x: number;
                    y: number;
                    width: number;
                    height: number;
                };
                styles: Record<string, string>;
            }[];
        } | {
            storyId: string;
            variantId: string;
            viewport: {
                width: number;
                height: number;
            };
            truncated: boolean;
            inspection: "accessibility";
            matched: boolean;
            snapshot: string;
            totalCharacters: number;
        } | {
            storyId: string;
            variantId: string;
            viewport: {
                width: number;
                height: number;
            };
            truncated: boolean;
            inspection: "diagnostics";
            previewReady: boolean;
            readinessError?: string;
            entries: {
                kind: "console" | "http-error" | "page-error" | "request-failed";
                level?: string;
                message: string;
                url?: string;
                status?: number;
            }[];
            droppedCount: number;
        } | {
            storyId: string;
            variantId: string;
            width: number;
            height: number;
            mimeType: "image/png";
            bytes: number;
            sha256: string;
            artifactUri: string;
        } | {
            storyId: string;
            variantId?: string;
            engine: "built-preview" | "project-vitest";
            summary: import("@histoire/protocol").HistoireTestRunSummary;
            truncated: boolean;
        };
        error?: {
            code: "ARTIFACT_NOT_FOUND" | "BROWSER_UNAVAILABLE" | "CANCELLED" | "CAPABILITY_UNAVAILABLE" | "COLLECTION_FAILED" | "CURSOR_EXPIRED" | "DEPENDENCY_MISSING" | "DOCS_NOT_FOUND" | "INTERNAL_ERROR" | "INVALID_CURSOR" | "INVALID_SELECTOR" | "OPERATION_NOT_FOUND" | "PATH_OUTSIDE_ROOT" | "PREVIEW_NOT_READY" | "PROJECT_CLOSED" | "PROJECT_RESTARTING" | "PROJECT_STARTING" | "QUEUE_FULL" | "REQUEST_KEY_CONFLICT" | "RESULT_TOO_LARGE" | "SOURCE_UNAVAILABLE" | "STALE_REVISION" | "STORY_AMBIGUOUS" | "STORY_NOT_FOUND" | "TIMEOUT" | "VARIANT_NOT_FOUND";
            message: string;
            retryable: boolean;
            details?: Record<string, import("zod").JSONType>;
        };
    };
    /** Poll one exact random owned handle; tests are explicitly paged when needed. */
    get(principal: string, operationId: string): {
        operationId: string;
        projectId: string;
        epoch: string;
        revision: string;
        kind: "inspect-accessibility" | "inspect-dom" | "inspect-variant" | "runtime-diagnostics" | "screenshot" | "tests";
        state: "cancelled" | "cancelling" | "completed" | "failed" | "queued" | "running";
        createdAt: string;
        startedAt?: string;
        finishedAt?: string;
        result?: {
            storyId: string;
            variantId: string;
            viewport: {
                width: number;
                height: number;
            };
            truncated: boolean;
            inspection: "variant";
            state: Record<string, import("zod").JSONType>;
            propsAvailable: boolean;
            components: {
                name: string;
                index: number;
                props: {
                    name: string;
                    types?: string[];
                    required?: boolean;
                    default?: import("zod").JSONType;
                    value?: import("zod").JSONType;
                    values?: import("zod").JSONType[];
                }[];
            }[];
            omittedValues: number;
        } | {
            storyId: string;
            variantId: string;
            viewport: {
                width: number;
                height: number;
            };
            truncated: boolean;
            inspection: "dom";
            matched: boolean;
            nodes: {
                index: number;
                parentIndex?: number;
                tag: string;
                attributes: Record<string, string>;
                text: string;
                rect: {
                    x: number;
                    y: number;
                    width: number;
                    height: number;
                };
                styles: Record<string, string>;
            }[];
        } | {
            storyId: string;
            variantId: string;
            viewport: {
                width: number;
                height: number;
            };
            truncated: boolean;
            inspection: "accessibility";
            matched: boolean;
            snapshot: string;
            totalCharacters: number;
        } | {
            storyId: string;
            variantId: string;
            viewport: {
                width: number;
                height: number;
            };
            truncated: boolean;
            inspection: "diagnostics";
            previewReady: boolean;
            readinessError?: string;
            entries: {
                kind: "console" | "http-error" | "page-error" | "request-failed";
                level?: string;
                message: string;
                url?: string;
                status?: number;
            }[];
            droppedCount: number;
        } | {
            storyId: string;
            variantId: string;
            width: number;
            height: number;
            mimeType: "image/png";
            bytes: number;
            sha256: string;
            artifactUri: string;
        } | {
            storyId: string;
            variantId?: string;
            engine: "built-preview" | "project-vitest";
            summary: import("@histoire/protocol").HistoireTestRunSummary;
            truncated: boolean;
        };
        error?: {
            code: "ARTIFACT_NOT_FOUND" | "BROWSER_UNAVAILABLE" | "CANCELLED" | "CAPABILITY_UNAVAILABLE" | "COLLECTION_FAILED" | "CURSOR_EXPIRED" | "DEPENDENCY_MISSING" | "DOCS_NOT_FOUND" | "INTERNAL_ERROR" | "INVALID_CURSOR" | "INVALID_SELECTOR" | "OPERATION_NOT_FOUND" | "PATH_OUTSIDE_ROOT" | "PREVIEW_NOT_READY" | "PROJECT_CLOSED" | "PROJECT_RESTARTING" | "PROJECT_STARTING" | "QUEUE_FULL" | "REQUEST_KEY_CONFLICT" | "RESULT_TOO_LARGE" | "SOURCE_UNAVAILABLE" | "STALE_REVISION" | "STORY_AMBIGUOUS" | "STORY_NOT_FOUND" | "TIMEOUT" | "VARIANT_NOT_FOUND";
            message: string;
            retryable: boolean;
            details?: Record<string, import("zod").JSONType>;
        };
    };
    /** Queued cancellation removes work; active cancellation retains lane until cleanup. */
    cancel: (principal: string, operationId: string) => {
        operationId: string;
        projectId: string;
        epoch: string;
        revision: string;
        kind: "inspect-accessibility" | "inspect-dom" | "inspect-variant" | "runtime-diagnostics" | "screenshot" | "tests";
        state: "cancelled" | "cancelling" | "completed" | "failed" | "queued" | "running";
        createdAt: string;
        startedAt?: string;
        finishedAt?: string;
        result?: {
            storyId: string;
            variantId: string;
            viewport: {
                width: number;
                height: number;
            };
            truncated: boolean;
            inspection: "variant";
            state: Record<string, import("zod").JSONType>;
            propsAvailable: boolean;
            components: {
                name: string;
                index: number;
                props: {
                    name: string;
                    types?: string[];
                    required?: boolean;
                    default?: import("zod").JSONType;
                    value?: import("zod").JSONType;
                    values?: import("zod").JSONType[];
                }[];
            }[];
            omittedValues: number;
        } | {
            storyId: string;
            variantId: string;
            viewport: {
                width: number;
                height: number;
            };
            truncated: boolean;
            inspection: "dom";
            matched: boolean;
            nodes: {
                index: number;
                parentIndex?: number;
                tag: string;
                attributes: Record<string, string>;
                text: string;
                rect: {
                    x: number;
                    y: number;
                    width: number;
                    height: number;
                };
                styles: Record<string, string>;
            }[];
        } | {
            storyId: string;
            variantId: string;
            viewport: {
                width: number;
                height: number;
            };
            truncated: boolean;
            inspection: "accessibility";
            matched: boolean;
            snapshot: string;
            totalCharacters: number;
        } | {
            storyId: string;
            variantId: string;
            viewport: {
                width: number;
                height: number;
            };
            truncated: boolean;
            inspection: "diagnostics";
            previewReady: boolean;
            readinessError?: string;
            entries: {
                kind: "console" | "http-error" | "page-error" | "request-failed";
                level?: string;
                message: string;
                url?: string;
                status?: number;
            }[];
            droppedCount: number;
        } | {
            storyId: string;
            variantId: string;
            width: number;
            height: number;
            mimeType: "image/png";
            bytes: number;
            sha256: string;
            artifactUri: string;
        } | {
            storyId: string;
            variantId?: string;
            engine: "built-preview" | "project-vitest";
            summary: import("@histoire/protocol").HistoireTestRunSummary;
            truncated: boolean;
        };
        error?: {
            code: "ARTIFACT_NOT_FOUND" | "BROWSER_UNAVAILABLE" | "CANCELLED" | "CAPABILITY_UNAVAILABLE" | "COLLECTION_FAILED" | "CURSOR_EXPIRED" | "DEPENDENCY_MISSING" | "DOCS_NOT_FOUND" | "INTERNAL_ERROR" | "INVALID_CURSOR" | "INVALID_SELECTOR" | "OPERATION_NOT_FOUND" | "PATH_OUTSIDE_ROOT" | "PREVIEW_NOT_READY" | "PROJECT_CLOSED" | "PROJECT_RESTARTING" | "PROJECT_STARTING" | "QUEUE_FULL" | "REQUEST_KEY_CONFLICT" | "RESULT_TOO_LARGE" | "SOURCE_UNAVAILABLE" | "STALE_REVISION" | "STORY_AMBIGUOUS" | "STORY_NOT_FOUND" | "TIMEOUT" | "VARIANT_NOT_FOUND";
            message: string;
            retryable: boolean;
            details?: Record<string, import("zod").JSONType>;
        };
    };
    /** Trusted dev UI reuses exact current operation ownership and cancellation. */
    cancelFromUi(operationId: string): void;
    /** Canonically decoded operation/artifact addresses, never global inventory. */
    readResource(address: McpResourceAddress, uri: string, principal: string): {
        contents: {
            uri: string;
            mimeType: string;
            text: string;
        }[];
    } | {
        contents: {
            uri: string;
            mimeType: string;
            blob: string;
        }[];
    };
    /** Invalidate captured authority before aborting; stale completions cannot publish. */
    invalidate(epoch?: string): Promise<void>;
    /** Stop admission immediately, then confirm shared lane teardown. */
    close(): Promise<void>;
};
/** Shared controller-owned service consumed by SDK registration and executors. */
export type McpOperations<T = unknown> = ReturnType<typeof createMcpOperations<T>>;
//# sourceMappingURL=store.d.ts.map