import type { JsonValue, PluginCommandContribution, PluginJobContribution, PluginJobRunContext, PluginJobsApi, PluginWorkspaceApi, SandboxedPagePluginApiV1 } from "@thortiq/plugin-api";
export interface SandboxClientHandle {
    readonly destroyed: boolean;
    destroy(): Promise<void>;
    unsubscribe(): Promise<void>;
}
type SandboxCommonApiV1 = Omit<SandboxedPagePluginApiV1, "commands" | "jobs" | "workspace"> & {
    readonly workspace: Omit<PluginWorkspaceApi, "setViewTitle" | "pushViewState">;
    readonly jobs: Omit<PluginJobsApi, "register">;
};
export interface SandboxControllerApiV1 extends SandboxCommonApiV1 {
    readonly commands: {
        register(declaration: PluginCommandContribution, run: (input: JsonValue | null, context: {
            readonly signal: AbortSignal;
        }) => void | Promise<void>): Promise<SandboxClientHandle>;
    };
    readonly jobs: SandboxCommonApiV1["jobs"] & {
        register(declaration: PluginJobContribution, run: (context: PluginJobRunContext) => void | Promise<void>): Promise<SandboxClientHandle>;
    };
}
export interface SandboxViewApiV1 extends SandboxCommonApiV1 {
    readonly commands?: never;
    readonly workspace: SandboxCommonApiV1["workspace"] & {
        setViewTitle(title: string): Promise<void>;
        pushViewState(state: JsonValue): Promise<void>;
    };
}
export type SandboxBootstrapCallbackContext = {
    readonly kind: "controller";
    readonly api: SandboxControllerApiV1;
    readonly signal: AbortSignal;
} | {
    readonly kind: "view";
    readonly api: SandboxViewApiV1;
    readonly initialState: JsonValue | null;
    readonly resources: Readonly<Record<string, string>>;
    readonly signal: AbortSignal;
};
export interface SandboxSdkSession {
    readonly signal: AbortSignal;
    readonly closed: boolean;
    close(): Promise<void>;
}
export type SandboxBootstrapCleanup = void | (() => void | Promise<void>) | {
    destroy(): void | Promise<void>;
};
export type SandboxBootstrap = (bootstrap: unknown, activate: (context: SandboxBootstrapCallbackContext) => SandboxBootstrapCleanup | Promise<SandboxBootstrapCleanup>) => Promise<SandboxSdkSession>;
export {};
