/**
 * Core types for the Axiom Lattice Client SDK
 */
import { Message, MessageChunk } from "@axiom-lattice/protocols";
/**
 * Transport method for client-server communication
 * Note: Currently only "ws" is used for tool registration
 */
export type Transport = "sse" | "ws";
/**
 * Configuration options for the Client
 */
export interface ClientConfig {
    /**
     * Base URL for the API
     */
    baseURL: string;
    /**
     * API key for authentication
     */
    apiKey: string;
    /**
     * Assistant identifier
     */
    assistantId: string;
    /**
     * Transport method (Server-Sent Events or WebSocket)
     */
    transport: Transport;
    /**
     * Request timeout in milliseconds (optional, defaults to 30000)
     */
    timeout?: number;
    /**
     * Additional headers to include in requests (optional)
     */
    headers?: Record<string, string>;
    /**
     * Configuration for retry behavior (optional)
     */
    retry?: RetryConfig;
}
/**
 * Configuration for retry behavior
 */
export interface RetryConfig {
    /**
     * Maximum number of retry attempts
     */
    maxRetries: number;
    /**
     * Initial delay between retries in milliseconds
     */
    initialDelayMs: number;
    /**
     * Maximum delay between retries in milliseconds
     */
    maxDelayMs: number;
    /**
     * Factor to multiply delay by after each retry attempt
     */
    backoffFactor: number;
}
/**
 * Thread creation options
 */
export interface CreateThreadOptions {
    /**
     * Optional metadata for the thread
     */
    metadata?: Record<string, any>;
}
/**
 * Thread information
 */
export interface Thread {
    /**
     * Thread identifier
     */
    id: string;
    /**
     * Assistant identifier this thread belongs to
     */
    assistantId: string;
    /**
     * Thread metadata
     */
    metadata?: Record<string, any>;
    /**
     * Thread creation timestamp
     */
    createdAt: Date | string;
    /**
     * Thread last update timestamp
     */
    updatedAt: Date | string;
}
/**
 * Chat send options
 */
export interface ChatSendOptions {
    /**
     * Assistant identifier
     */
    assistantId?: string;
    /**
     * Thread identifier
     */
    threadId: string;
    /**
     * Messages to send
     */
    messages: Message[];
    /**
     * Files to attach (optional)
     */
    files?: any[];
    /**
     * Command to execute (optional)
     */
    command?: {
        resume?: {
            action: string;
            data: Record<string, any> & {
                config?: {
                    thread_id?: string;
                    work_log_id?: string;
                };
            };
            message: string;
        };
        update?: any;
        send?: {
            node: string;
            input: any;
        };
    };
    [key: string]: any;
}
/**
 * Chat stream options
 */
export interface ChatStreamOptions extends ChatSendOptions {
    /**
     * Whether to run in background (optional)
     */
    background?: boolean;
    /**
     * Whether to return agent state when stream completes (optional)
     */
    enableReturnStateWhenSteamCompleted?: boolean;
}
/**
 * Stream callbacks interface
 */
export interface StreamCallbacks {
    /**
     * Called when a stream event is received
     */
    onEvent: (event: MessageChunk) => void;
    /**
     * Called when the stream completes, with optional agent state
     */
    onComplete?: (state?: AgentState) => void;
    /**
     * Called when an error occurs
     */
    onError?: (error: Error) => void;
}
/**
 * Chat response
 */
export interface ChatResponse {
    /**
     * Response messages
     */
    messages: Message[];
    /**
     * Trace ID for debugging
     */
    traceId?: string;
}
/**
 * Tool registration options
 */
export interface RegisterToolOptions {
    /**
     * Tool name
     */
    name: string;
    /**
     * Tool parameter schema
     */
    schema: object;
    /**
     * Tool handler function
     */
    handler: (params: any) => Promise<any>;
}
/**
 * Get messages options
 */
export interface GetMessagesOptions {
    /**
     * Thread identifier
     */
    threadId: string;
    /**
     * Maximum number of messages to return
     */
    limit?: number;
    /**
     * Message ID to start from (for pagination)
     */
    after?: string;
    /**
     * Whether to return messages in reverse chronological order
     */
    reverse?: boolean;
}
/**
 * Resume stream options
 */
export interface ResumeStreamOptions {
    /**
     * Thread identifier
     */
    threadId: string;
    /**
     * Message identifier (usually run_id)
     */
    messageId: string;
    /**
     * Content already received (used to find resume position)
     */
    knownContent: string;
    /**
     * Polling interval in milliseconds (default: 100ms)
     */
    pollInterval?: number;
}
/**
 * Thread list options
 */
export interface ListThreadsOptions {
    /**
     * Maximum number of threads to return
     */
    limit?: number;
    /**
     * Offset for pagination
     */
    offset?: number;
}
/**
 * Run options
 */
export type RunOptions = {
    /**
     * Thread identifier
     */
    threadId: string;
    /**
     * Message to send
     */
    message: string;
    /**
     * Files to attach (optional)
     */
    files?: any[];
    /**
     * Command to execute (optional)
     */
    command?: any;
    /**
     * Whether to stream the response (optional)
     */
    streaming?: boolean;
    /**
     * Whether to run in background (optional)
     */
    background?: boolean;
    /**
     * Whether to return agent state when stream completes (optional)
     */
    enableReturnStateWhenSteamCompleted?: boolean;
    /**
     * Custom runtime configuration to override or extend agent's runConfig
     */
    custom_run_config?: Record<string, any>;
} & Record<string, any>;
/**
 * Agent state
 */
export interface AgentState {
    createdAt?: string;
    values: {
        messages: Message[];
        [key: string]: any;
    };
    tasks: Array<{
        interrupts: Array<{
            value: any;
            id: string;
        }>;
    }>;
}
/**
 * Assistant information
 */
export interface Assistant {
    /**
     * Assistant identifier
     */
    id: string;
    /**
     * Assistant name
     */
    name: string;
    /**
     * Assistant description (optional)
     */
    description?: string;
    /**
     * Graph definition for the assistant
     */
    graphDefinition: any;
    /**
     * Creation timestamp
     */
    createdAt: Date | string;
    /**
     * Last update timestamp
     */
    updatedAt: Date | string;
}
/**
 * Create assistant request options
 */
export interface CreateAssistantOptions {
    /**
     * Assistant name
     */
    name: string;
    /**
     * Assistant description (optional)
     */
    description?: string;
    /**
     * Graph definition for the assistant
     */
    graphDefinition: any;
}
/**
 * Update assistant request options
 */
export interface UpdateAssistantOptions {
    /**
     * Assistant name (optional)
     */
    name?: string;
    /**
     * Assistant description (optional)
     */
    description?: string;
    /**
     * Graph definition for the assistant (optional)
     */
    graphDefinition?: any;
}
/**
 * Assistant list response
 */
export interface AssistantListResponse {
    /**
     * Whether the operation was successful
     */
    success: boolean;
    /**
     * Response message
     */
    message: string;
    /**
     * Response data
     */
    data: {
        /**
         * List of assistants
         */
        records: Assistant[];
        /**
         * Total number of assistants
         */
        total: number;
    };
}
/**
 * Assistant response
 */
export interface AssistantResponse {
    /**
     * Whether the operation was successful
     */
    success: boolean;
    /**
     * Response message
     */
    message: string;
    /**
     * Assistant data (optional)
     */
    data?: Assistant;
}
/**
 * Thread list response
 */
export interface ThreadListResponse {
    /**
     * Whether the operation was successful
     */
    success: boolean;
    /**
     * Response message
     */
    message: string;
    /**
     * Response data
     */
    data: {
        /**
         * List of threads
         */
        records: Thread[];
        /**
         * Total number of threads
         */
        total: number;
    };
}
/**
 * Thread response
 */
export interface ThreadResponse {
    /**
     * Whether the operation was successful
     */
    success: boolean;
    /**
     * Response message
     */
    message: string;
    /**
     * Thread data (optional)
     */
    data?: Thread;
}
/**
 * Update thread request options
 */
export interface UpdateThreadOptions {
    /**
     * Thread metadata (optional)
     */
    metadata?: Record<string, any>;
}
/**
 * Custom error classes
 */
export declare class ApiError extends Error {
    statusCode: number;
    responseBody?: any | undefined;
    constructor(message: string, statusCode: number, responseBody?: any | undefined);
}
export declare class NetworkError extends Error {
    constructor(message: string);
}
export declare class AuthenticationError extends Error {
    constructor(message: string);
}
/**
 * Schedule execution type
 */
export declare enum ScheduleExecutionType {
    ONCE = "once",
    CRON = "cron"
}
/**
 * Scheduled task status
 */
export declare enum ScheduledTaskStatus {
    PENDING = "pending",
    RUNNING = "running",
    COMPLETED = "completed",
    FAILED = "failed",
    CANCELLED = "cancelled",
    PAUSED = "paused"
}
/**
 * Scheduled task definition
 */
export interface ScheduledTask {
    /**
     * Unique task identifier
     */
    taskId: string;
    /**
     * Type of the task (maps to registered handler)
     */
    taskType: string;
    /**
     * Task payload data
     */
    payload: Record<string, any>;
    /**
     * Assistant ID that owns this task
     */
    assistantId?: string;
    /**
     * Thread ID this task belongs to
     */
    threadId?: string;
    /**
     * Execution type (once or cron)
     */
    executionType: ScheduleExecutionType;
    /**
     * Timestamp when to execute (for ONCE type)
     */
    executeAt?: number;
    /**
     * Delay in milliseconds (for reference)
     */
    delayMs?: number;
    /**
     * Cron expression (for CRON type)
     */
    cronExpression?: string;
    /**
     * Timezone for cron execution
     */
    timezone?: string;
    /**
     * Next scheduled run time
     */
    nextRunAt?: number;
    /**
     * Last execution time
     */
    lastRunAt?: number;
    /**
     * Current task status
     */
    status: ScheduledTaskStatus;
    /**
     * Number of times executed
     */
    runCount: number;
    /**
     * Maximum executions allowed
     */
    maxRuns?: number;
    /**
     * Current retry count
     */
    retryCount: number;
    /**
     * Maximum retry attempts
     */
    maxRetries: number;
    /**
     * Last error message
     */
    lastError?: string;
    /**
     * Creation timestamp
     */
    createdAt: number;
    /**
     * Last update timestamp
     */
    updatedAt: number;
    /**
     * Expiration timestamp
     */
    expiresAt?: number;
    /**
     * Additional metadata
     */
    metadata?: Record<string, any>;
}
/**
 * Options for getting scheduled tasks
 */
export interface GetScheduledTasksOptions {
    /**
     * Thread identifier
     */
    threadId: string;
    /**
     * Filter by status (optional)
     */
    status?: ScheduledTaskStatus;
    /**
     * Maximum number of tasks to return (optional)
     */
    limit?: number;
    /**
     * Offset for pagination (optional)
     */
    offset?: number;
}
/**
 * Scheduled tasks list response
 */
export interface ScheduledTasksListResponse {
    /**
     * Whether the operation was successful
     */
    success: boolean;
    /**
     * Response message
     */
    message: string;
    /**
     * Response data
     */
    data: {
        /**
         * List of scheduled tasks
         */
        records: ScheduledTask[];
        /**
         * Total count
         */
        total: number;
    };
}
/**
 * Storage type for workspace
 */
export type StorageType = "sandbox" | "filesystem";
/**
 * Workspace information
 */
export interface Workspace {
    id: string;
    tenantId: string;
    name: string;
    description?: string;
    storageType: StorageType;
    createdAt: Date | string;
    updatedAt: Date | string;
}
/**
 * Create workspace request
 */
export interface CreateWorkspaceRequest {
    name: string;
    description?: string;
    storageType: StorageType;
}
/**
 * Update workspace request
 */
export interface UpdateWorkspaceRequest {
    name?: string;
    description?: string;
    storageType?: StorageType;
}
/**
 * Project information
 */
export interface Project {
    id: string;
    tenantId: string;
    workspaceId: string;
    name: string;
    description?: string;
    createdAt: Date | string;
    updatedAt: Date | string;
}
/**
 * Create project request
 */
export interface CreateProjectRequest {
    name: string;
    description?: string;
}
/**
 * Update project request
 */
export interface UpdateProjectRequest {
    name?: string;
    description?: string;
}
/**
 * File item in workspace
 */
export interface FileItem {
    path: string;
    name?: string;
    is_dir?: boolean;
    size?: number;
    modified_at?: string;
}
//# sourceMappingURL=types.d.ts.map