import type { Agent } from '@midscene/core/agent';
import type { MidsceneRecorderEvent, MidsceneRecorderEventType, MidsceneRecorderSourceKind } from '@midscene/shared/recorder';
import type { LaunchPlaygroundOptions } from './launcher';
import type { AgentFactory } from './types';
export type PlaygroundPreviewKind = 'none' | 'screenshot' | 'mjpeg' | 'scrcpy' | 'custom';
export interface PlaygroundPreviewCapability {
    kind: PlaygroundPreviewKind;
    label?: string;
    live?: boolean;
}
export interface PlaygroundPreviewDescriptor {
    kind: PlaygroundPreviewKind;
    title?: string;
    capabilities?: PlaygroundPreviewCapability[];
    screenshotPath?: string;
    mjpegPath?: string;
    custom?: Record<string, unknown>;
}
export interface PlaygroundSessionTarget {
    id: string;
    label: string;
    description?: string;
    status?: string;
    isDefault?: boolean;
    metadata?: Record<string, unknown>;
}
export interface PlaygroundSessionFieldOption {
    label: string;
    value: string | number | boolean;
    description?: string;
}
export interface PlaygroundPlatformRegistration {
    id: string;
    label: string;
    description?: string;
    unavailableReason?: string;
    supportsStandalone?: boolean;
    metadata?: Record<string, unknown>;
}
export interface PlaygroundPlatformSelectorConfig {
    fieldKey: string;
    variant?: 'cards' | 'select';
}
export interface PlaygroundSessionField {
    key: string;
    label: string;
    type: 'text' | 'number' | 'select';
    required?: boolean;
    defaultValue?: string | number | boolean;
    options?: PlaygroundSessionFieldOption[];
    placeholder?: string;
    description?: string;
}
export interface PlaygroundSessionNotice {
    type: 'info' | 'warning' | 'error';
    message: string;
    description?: string;
}
export interface PlaygroundSessionSetup {
    title?: string;
    description?: string;
    primaryActionLabel?: string;
    autoSubmitWhenReady?: boolean;
    fields: PlaygroundSessionField[];
    targets?: PlaygroundSessionTarget[];
    platformRegistry?: PlaygroundPlatformRegistration[];
    platformSelector?: PlaygroundPlatformSelectorConfig;
    notice?: PlaygroundSessionNotice;
}
export interface PlaygroundExecutionHooks {
    beforeExecute?: () => void | Promise<void>;
    afterExecute?: () => void | Promise<void>;
}
export interface PlaygroundSidecar {
    id: string;
    start(): void | Promise<void>;
    stop?(): void | Promise<void>;
}
export type PlaygroundRecorderSourceKind = MidsceneRecorderSourceKind;
export type PlaygroundRecorderEventType = MidsceneRecorderEventType;
export type PlaygroundRecorderEvent = MidsceneRecorderEvent;
export interface PlaygroundRecorderCapabilitiesResult {
    supported: boolean;
    source: PlaygroundRecorderSourceKind;
    platformId?: string;
    error?: string;
}
export interface PlaygroundRecorderStartResult {
    ok: boolean;
    supported?: boolean;
    source?: PlaygroundRecorderSourceKind;
    platformId?: string;
    error?: string;
}
export interface PlaygroundRecorderEventsResult {
    events: PlaygroundRecorderEvent[];
    nextIndex: number;
}
export interface PlaygroundSessionState {
    connected: boolean;
    displayName?: string;
    metadata?: Record<string, unknown>;
    setupState?: 'required' | 'ready' | 'blocked';
    setupBlockingReason?: string;
}
export interface PlaygroundCreatedSession {
    agent?: Agent;
    agentFactory?: AgentFactory;
    preview?: PlaygroundPreviewDescriptor;
    metadata?: Record<string, unknown>;
    displayName?: string;
    platformId?: string;
    title?: string;
    platformDescription?: string;
    executionHooks?: PlaygroundExecutionHooks;
    sidecars?: PlaygroundSidecar[];
}
export interface PlaygroundSessionManager {
    getSetupSchema?(input?: Record<string, unknown>): Promise<PlaygroundSessionSetup>;
    listTargets?(): Promise<PlaygroundSessionTarget[]>;
    createSession(input?: Record<string, unknown>): Promise<PlaygroundCreatedSession>;
    destroySession?(session?: PlaygroundSessionState): Promise<void>;
}
export interface PreparedPlaygroundPlatform {
    platformId: string;
    title: string;
    description?: string;
    agent?: Agent;
    agentFactory?: AgentFactory;
    sessionManager?: PlaygroundSessionManager;
    executionHooks?: PlaygroundExecutionHooks;
    launchOptions?: LaunchPlaygroundOptions;
    preview?: PlaygroundPreviewDescriptor;
    metadata?: Record<string, unknown>;
    sidecars?: PlaygroundSidecar[];
}
export interface PlaygroundPlatformDescriptor<TOptions = void> {
    id: string;
    title: string;
    description?: string;
    prepare(options: TOptions): Promise<PreparedPlaygroundPlatform>;
}
export declare function definePlaygroundPlatform<TOptions>(descriptor: PlaygroundPlatformDescriptor<TOptions>): PlaygroundPlatformDescriptor<TOptions>;
export declare function createScreenshotPreviewDescriptor(overrides?: Partial<PlaygroundPreviewDescriptor>): PlaygroundPreviewDescriptor;
export declare function createMjpegPreviewDescriptor(overrides?: Partial<PlaygroundPreviewDescriptor>): PlaygroundPreviewDescriptor;
export declare function createScrcpyPreviewDescriptor(custom?: Record<string, unknown>, overrides?: Partial<PlaygroundPreviewDescriptor>): PlaygroundPreviewDescriptor;
export declare function resolvePreparedLaunchOptions(prepared: PreparedPlaygroundPlatform, overrides?: LaunchPlaygroundOptions): LaunchPlaygroundOptions;
