import { default as default_2 } from 'react';
import { JSX } from 'react/jsx-runtime';
import { UIMessage } from '@cloudbase/agent-ui-web';

declare interface AgentConfig {
    serverUrl: string;
    agentPath: string;
}

export declare function AgentSelector({ agentConfigs, onAgentSelect, title, description }: AgentSelectorProps): JSX.Element;

declare interface AgentSelectorProps {
    agentConfigs: Record<string, AgentConfig>;
    onAgentSelect?: (agent: string) => void;
    title?: string;
    description?: string;
}

export declare const AgKitChat: default_2.ForwardRefExoticComponent<AgKitChatProps & default_2.RefAttributes<HTMLDivElement>>;

export declare interface AgKitChatProps {
    className?: string;
    title?: string;
    suggestions?: ChatSuggestion[];
    status?: "idle" | "submitted" | "streaming" | "error";
    onMessageSend?: (message: string) => unknown;
    onSuggestionSelect?: (suggestion: ChatSuggestion) => void;
    placeholder?: string;
    welcomeMessage?: string;
    uiMessages: UIMessage[];
    error?: unknown;
    showFooter?: boolean;
    enableSessionSharing?: boolean;
    onSessionLoad?: (messages: UIMessage[]) => void;
    onSessionExport?: (session: ChatSession) => void;
    onUIMessagesChange?: (messages: UIMessage[]) => void;
}

/**
 * Session format for sharing conversations
 * This format is designed to be serializable and shareable
 */
export declare interface ChatSession {
    version: string;
    metadata: {
        title?: string;
        createdAt: string;
        exportedAt: string;
        messageCount: number;
    };
    messages: SerializableUIMessage[];
}

export declare interface ChatSuggestion {
    id: string;
    text: string;
    category?: string;
}

/**
 * Download session as JSON file
 */
export declare function downloadSession(session: ChatSession, filename?: string): void;

/**
 * Export current chat session to a serializable format
 */
export declare function exportSession(messages: UIMessage[], metadata?: {
    title?: string;
}): ChatSession;

/**
 * Generate a shareable link from session (base64 encoded)
 * Note: This is suitable for small sessions. For large sessions, consider using a URL shortener service.
 * Preserves existing query parameters from the current URL.
 *
 * @throws Error if session is too large for URL sharing
 */
export declare function generateShareableLink(session: ChatSession): string;

/**
 * Get estimated session size in characters (base64 encoded)
 */
export declare function getSessionSize(session: ChatSession): number;

/**
 * Import session from serializable format
 * Note: render functions are not restored, as they are not serializable
 */
export declare function importSession(session: ChatSession): UIMessage[];

/**
 * Check if session is suitable for sharing via URL
 * Returns true if the session is small enough to be shared via URL without causing 431 errors
 */
export declare function isSessionSuitableForUrlShare(session: ChatSession): boolean;

/**
 * Load session from URL parameter
 */
export declare function loadSessionFromURL(): ChatSession | null;

/**
 * Read session from uploaded file
 */
export declare function readSessionFromFile(file: File): Promise<ChatSession>;

/**
 * Serializable version of UIMessage
 * Removes render functions and other non-serializable properties
 */
export declare type SerializableUIMessage = {
    role: "user";
    parts: Array<{
        type: "text";
        text: string;
    }>;
} | {
    role: "assistant";
    parts: Array<{
        type: "text";
        text: string;
    } | {
        type: "tool-call";
        id: string;
        name: string;
        arguments: string;
        result?: string;
        state?: "input-streaming" | "input-available" | "output-available" | "output-error";
        errorText?: string;
    } | {
        type: "interrupt";
        interrupt: {
            id: string;
            reason: string;
            payload: unknown;
        };
    }>;
};

export { }
