import { Message, MessageChunk, Skill, CreateSkillRequest } from '@axiom-lattice/protocols';

/**
 * Core types for the Axiom Lattice Client SDK
 */

/**
 * Transport method for client-server communication
 * Note: Currently only "ws" is used for tool registration
 */
type Transport = "sse" | "ws";
/**
 * Configuration options for the Client
 */
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
 */
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
 */
interface CreateThreadOptions {
    /**
     * Optional metadata for the thread
     */
    metadata?: Record<string, any>;
}
/**
 * Thread information
 */
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
 */
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
 */
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
 */
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
 */
interface ChatResponse {
    /**
     * Response messages
     */
    messages: Message[];
    /**
     * Trace ID for debugging
     */
    traceId?: string;
}
/**
 * Tool registration options
 */
interface RegisterToolOptions {
    /**
     * Tool name
     */
    name: string;
    /**
     * Tool parameter schema
     */
    schema: object;
    /**
     * Tool handler function
     */
    handler: (params: any) => Promise<any>;
}
/**
 * Get messages options
 */
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
 */
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
 */
interface ListThreadsOptions {
    /**
     * Maximum number of threads to return
     */
    limit?: number;
    /**
     * Offset for pagination
     */
    offset?: number;
}
/**
 * Run options
 */
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
 */
interface AgentState {
    createdAt?: string;
    values: {
        messages: Message[];
        [key: string]: any;
    };
    tasks: Array<{
        interrupts: Array<{
            value: any;
            id: string;
        }>;
    }>;
}
/**
 * Assistant information
 */
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
 */
interface CreateAssistantOptions {
    /**
     * Assistant name
     */
    name: string;
    /**
     * Assistant description (optional)
     */
    description?: string;
    /**
     * Graph definition for the assistant
     */
    graphDefinition: any;
}
/**
 * Update assistant request options
 */
interface UpdateAssistantOptions {
    /**
     * Assistant name (optional)
     */
    name?: string;
    /**
     * Assistant description (optional)
     */
    description?: string;
    /**
     * Graph definition for the assistant (optional)
     */
    graphDefinition?: any;
}
/**
 * Assistant list response
 */
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
 */
interface AssistantResponse {
    /**
     * Whether the operation was successful
     */
    success: boolean;
    /**
     * Response message
     */
    message: string;
    /**
     * Assistant data (optional)
     */
    data?: Assistant;
}
/**
 * Thread list response
 */
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
 */
interface ThreadResponse {
    /**
     * Whether the operation was successful
     */
    success: boolean;
    /**
     * Response message
     */
    message: string;
    /**
     * Thread data (optional)
     */
    data?: Thread;
}
/**
 * Update thread request options
 */
interface UpdateThreadOptions {
    /**
     * Thread metadata (optional)
     */
    metadata?: Record<string, any>;
}
/**
 * Custom error classes
 */
declare class ApiError extends Error {
    statusCode: number;
    responseBody?: any | undefined;
    constructor(message: string, statusCode: number, responseBody?: any | undefined);
}
declare class NetworkError extends Error {
    constructor(message: string);
}
declare class AuthenticationError extends Error {
    constructor(message: string);
}
/**
 * Schedule execution type
 */
declare enum ScheduleExecutionType {
    ONCE = "once",
    CRON = "cron"
}
/**
 * Scheduled task status
 */
declare enum ScheduledTaskStatus {
    PENDING = "pending",
    RUNNING = "running",
    COMPLETED = "completed",
    FAILED = "failed",
    CANCELLED = "cancelled",
    PAUSED = "paused"
}
/**
 * Scheduled task definition
 */
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
 */
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
 */
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
 */
type StorageType = "sandbox" | "filesystem";
/**
 * Workspace information
 */
interface Workspace {
    id: string;
    tenantId: string;
    name: string;
    description?: string;
    storageType: StorageType;
    createdAt: Date | string;
    updatedAt: Date | string;
}
/**
 * Create workspace request
 */
interface CreateWorkspaceRequest {
    name: string;
    description?: string;
    storageType: StorageType;
}
/**
 * Update workspace request
 */
interface UpdateWorkspaceRequest {
    name?: string;
    description?: string;
    storageType?: StorageType;
}
/**
 * Project information
 */
interface Project {
    id: string;
    tenantId: string;
    workspaceId: string;
    name: string;
    description?: string;
    createdAt: Date | string;
    updatedAt: Date | string;
}
/**
 * Create project request
 */
interface CreateProjectRequest {
    name: string;
    description?: string;
}
/**
 * Update project request
 */
interface UpdateProjectRequest {
    name?: string;
    description?: string;
}
/**
 * File item in workspace
 */
interface FileItem {
    path: string;
    name?: string;
    is_dir?: boolean;
    size?: number;
    modified_at?: string;
}

/**
 * Abstract client class for interacting with the Axiom Lattice Agent Service API
 * Provides common functionality for different client implementations
 */
declare abstract class AbstractClient {
    protected config: ClientConfig;
    assistantId: string;
    tenantId: string;
    protected registeredTools: Map<string, RegisterToolOptions>;
    /**
     * Creates a new AbstractClient instance
     * @param config - Configuration options for the client
     */
    constructor(config: ClientConfig);
    /**
     * Set tenant ID for multi-tenant environments
     * @param tenantId - Tenant identifier
     */
    abstract setTenantId(tenantId: string): void;
    /**
     * Set assistant ID for the client
     * @param assistantId - Assistant identifier
     */
    setAssistantId(assistantId: string): void;
    /**
     * Creates a new instance of the client with the given configuration
     * @param config - Configuration options for the client
     * @returns A new instance of the client
     */
    protected abstract createInstance(config: ClientConfig): AbstractClient;
    /**
     * Creates a clone of the current client instance
     * @param overrides - Optional configuration overrides for the cloned client
     * @returns A new client instance with the same configuration and state
     */
    clone(overrides?: Partial<ClientConfig>): AbstractClient;
    /**
     * Abstract method for making API requests
     * To be implemented by concrete client classes
     */
    protected abstract makeRequest<T>(url: string, options?: {
        method?: string;
        body?: any;
        headers?: Record<string, string>;
    }): Promise<T>;
    /**
     * Abstract method for streaming API requests
     * To be implemented by concrete client classes
     */
    /**
     * Helper method to build stream request parameters
     * @param options - Options for running the agent
     * @returns The formatted request parameters
     */
    protected buildStreamRequestParams(options: RunOptions): {
        url: string;
        method: string;
        body: any;
    };
    protected abstract streamRequest(options: RunOptions, onEvent: (event: MessageChunk) => void, onComplete?: (state?: AgentState) => void, onError?: (error: Error) => void): () => void;
    /**
     * Creates a new thread
     * @deprecated Use threads.create() instead
     * @param options - Options for creating a thread
     * @returns A promise that resolves to the thread ID
     */
    createThread(options: CreateThreadOptions): Promise<string>;
    /**
     * Retrieves thread information
     * @deprecated Use threads.get() instead
     * @param threadId - Thread identifier
     * @returns A promise that resolves to the thread information
     */
    getThread(threadId: string): Promise<Thread>;
    /**
     * Lists all threads
     * @deprecated Use threads.list() instead
     * @param options - Options for listing threads
     * @returns A promise that resolves to an array of threads
     */
    listThreads(options?: ListThreadsOptions): Promise<Thread[]>;
    /**
     * Deletes a thread
     * @deprecated Use threads.delete() instead
     * @param threadId - Thread identifier
     * @returns A promise that resolves when the thread is deleted
     */
    deleteThread(threadId: string): Promise<void>;
    /**
     * Retrieves messages from a thread
     * @param options - Options for retrieving messages
     * @returns A promise that resolves to an array of messages
     */
    getMessages(options: GetMessagesOptions): Promise<Message[]>;
    /**
     * Retrieves agent state
     * @param threadId - Thread identifier
     * @returns A promise that resolves to the agent state
     */
    getAgentState(threadId: string): Promise<AgentState>;
    /**
     * Gets agent graph visualization
     * @returns A promise that resolves to the graph visualization data
     */
    getAgentGraph(): Promise<string>;
    /**
     * Run agent with options
     * @param options - Options for running the agent
     * @returns A promise that resolves to the run result
     */
    run(options: RunOptions): Promise<ChatResponse>;
    /**
     * Chat namespace for sending messages and streaming responses
     */
    chat: {
        /**
         * Sends a message to a thread and receives a response
         * @param options - Options for sending a message
         * @returns A promise that resolves to the chat response
         */
        send: (options: ChatSendOptions) => Promise<ChatResponse>;
        /**
         * Sends a message to a thread and streams the response
         * @param options - Options for streaming a message
         * @param onEvent - Callback function that receives stream events
         * @param onComplete - Optional callback function called when streaming completes
         * @param onError - Optional callback function called when an error occurs
         * @returns A function that can be called to stop the stream
         */
        stream: (options: ChatStreamOptions, onEvent: (event: MessageChunk) => void, onComplete?: (state?: AgentState) => void, onError?: (error: Error) => void) => (() => void);
    };
    /**
     * Resume streaming from a known position
     * @param options - Options for resuming the stream
     * @param onEvent - Callback function that receives stream events
     * @param onComplete - Optional callback function called when streaming completes
     * @param onError - Optional callback function called when an error occurs
     * @returns A function that can be called to stop the stream
     */
    abstract resumeStream(options: ResumeStreamOptions, onEvent: (event: MessageChunk) => void, onComplete?: () => void, onError?: (error: Error) => void): () => void;
    /**
     * Tools namespace for registering and unregistering client-side tools
     */
    tools: {
        /**
         * Registers a client-side tool
         * @param options - Options for registering a tool
         */
        register: (options: RegisterToolOptions) => void;
        /**
         * Unregisters a client-side tool
         * @param name - Tool name
         */
        unregister: (name: string) => void;
    };
    /**
     * Assistants namespace for managing assistants
     */
    assistants: {
        /**
         * Lists all available assistants
         * Returns both code-configured and stored assistants
         * @returns A promise that resolves to the list of assistants
         */
        list: () => Promise<Assistant[]>;
        /**
         * Retrieves a single assistant by ID
         * Checks both code-configured and stored assistants
         * @param id - Assistant identifier
         * @returns A promise that resolves to the assistant information
         */
        get: (id: string) => Promise<Assistant>;
        /**
         * Creates a new assistant
         * Only creates stored assistants (code-configured assistants cannot be created via API)
         * @param options - Options for creating an assistant
         * @returns A promise that resolves to the created assistant
         */
        create: (options: CreateAssistantOptions) => Promise<Assistant>;
        /**
         * Updates an existing assistant by ID
         * Only works on stored assistants (code-configured assistants cannot be updated)
         * @param id - Assistant identifier
         * @param options - Options for updating an assistant
         * @returns A promise that resolves to the updated assistant
         */
        update: (id: string, options: UpdateAssistantOptions) => Promise<Assistant>;
        /**
         * Deletes an assistant by ID
         * Only works on stored assistants (code-configured assistants cannot be deleted)
         * @param id - Assistant identifier
         * @returns A promise that resolves when the assistant is deleted
         */
        delete: (id: string) => Promise<void>;
    };
    /**
     * Skills namespace for managing skills
     */
    skills: {
        /**
         * Lists all available skills
         * @returns A promise that resolves to the list of skills
         */
        list: () => Promise<Skill[]>;
        /**
         * Retrieves a single skill by ID
         * @param id - Skill identifier
         * @returns A promise that resolves to the skill information
         */
        get: (id: string) => Promise<Skill>;
        /**
         * Creates a new skill
         * @param options - Options for creating a skill
         * @returns A promise that resolves to the created skill
         */
        create: (options: CreateSkillRequest) => Promise<Skill>;
        /**
         * Updates an existing skill by ID
         * @param id - Skill identifier
         * @param options - Options for updating a skill
         * @returns A promise that resolves to the updated skill
         */
        update: (id: string, options: Partial<CreateSkillRequest>) => Promise<Skill>;
        /**
         * Deletes a skill by ID
         * @param id - Skill identifier
         * @returns A promise that resolves when the skill is deleted
         */
        delete: (id: string) => Promise<void>;
    };
    /**
     * Threads namespace for managing threads for the current assistant
     */
    threads: {
        /**
         * Lists all threads for the current assistant
         * @returns A promise that resolves to the list of threads
         */
        list: () => Promise<Thread[]>;
        /**
         * Retrieves a single thread by ID for the current assistant
         * @param threadId - Thread identifier
         * @returns A promise that resolves to the thread information
         */
        get: (threadId: string) => Promise<Thread>;
        /**
         * Creates a new thread for the current assistant
         * @param options - Options for creating a thread
         * @returns A promise that resolves to the created thread
         */
        create: (options: CreateThreadOptions) => Promise<Thread>;
        /**
         * Updates an existing thread by ID for the current assistant
         * @param threadId - Thread identifier
         * @param options - Options for updating a thread
         * @returns A promise that resolves to the updated thread
         */
        update: (threadId: string, options: UpdateThreadOptions) => Promise<Thread>;
        /**
         * Deletes a thread by ID for the current assistant
         * @param threadId - Thread identifier
         * @returns A promise that resolves when the thread is deleted
         */
        delete: (threadId: string) => Promise<void>;
    };
    /**
     * Schedules namespace for managing scheduled tasks
     */
    schedules: {
        /**
         * Gets scheduled tasks for a specific thread
         * @param options - Options for getting scheduled tasks
         * @returns A promise that resolves to the list of scheduled tasks
         */
        getByThread: (options: GetScheduledTasksOptions) => Promise<ScheduledTask[]>;
        /**
         * Gets a single scheduled task by ID
         * @param taskId - Task identifier
         * @returns A promise that resolves to the scheduled task or null
         */
        get: (taskId: string) => Promise<ScheduledTask | null>;
        /**
         * Cancels a scheduled task
         * @param taskId - Task identifier
         * @returns A promise that resolves when the task is cancelled
         */
        cancel: (taskId: string) => Promise<boolean>;
        /**
         * Pauses a scheduled cron task
         * @param taskId - Task identifier
         * @returns A promise that resolves when the task is paused
         */
        pause: (taskId: string) => Promise<boolean>;
        /**
         * Resumes a paused cron task
         * @param taskId - Task identifier
         * @returns A promise that resolves when the task is resumed
         */
        resume: (taskId: string) => Promise<boolean>;
    };
}

/**
 * Web client class for interacting with the Axiom Lattice Agent Service API
 */
declare class Client extends AbstractClient {
    private headers;
    /**
     * Creates a new Client instance
     * @param config - Configuration options for the client
     */
    constructor(config: ClientConfig);
    /**
     * Helper method to handle fetch responses and errors
     * @private
     */
    private handleResponse;
    /**
     * Helper method to make fetch requests
     * @private
     */
    private fetchWithTimeout;
    private static workspaceHeaders;
    /**
     * Set tenant ID for multi-tenant environments
     * @param tenantId - Tenant identifier
     */
    setTenantId(tenantId: string): void;
    /**
     * Set workspace and project headers for API requests (static)
     * @param workspaceId - Workspace identifier
     * @param projectId - Project identifier
     */
    static setWorkspaceContext(workspaceId?: string, projectId?: string): void;
    /**
     * Get current workspace headers
     */
    static getWorkspaceHeaders(): Record<string, string>;
    /**
     * Creates a new instance of the client with the given configuration
     * @param config - Configuration options for the client
     * @returns A new Client instance
     */
    protected createInstance(config: ClientConfig): AbstractClient;
    /**
     * Implementation of the abstract makeRequest method for web clients
     * @param url - The URL to make the request to
     * @param options - Request options
     * @returns A promise that resolves to the response data
     */
    protected makeRequest<T>(url: string, options?: {
        method?: string;
        body?: any;
        headers?: Record<string, string>;
    }): Promise<T>;
    /**
     * Implementation of the abstract streamRequest method for web clients
     */
    protected streamRequest(options: RunOptions, onEvent: (event: MessageChunk) => void, onComplete?: (state?: AgentState) => void, onError?: (error: Error) => void): () => void;
    /**
     * Resume streaming from a known position
     * @param options - Options for resuming the stream
     * @param onEvent - Callback function that receives stream events
     * @param onComplete - Optional callback function called when streaming completes
     * @param onError - Optional callback function called when an error occurs
     * @returns A function that can be called to stop the stream
     */
    resumeStream(options: ResumeStreamOptions, onEvent: (event: MessageChunk) => void, onComplete?: () => void, onError?: (error: Error) => void): () => void;
    /**
     * Stream run results
     * @param options - Options for streaming run results
     * @param onEvent - Callback function that receives stream events
     * @param onComplete - Optional callback function called when streaming completes
     * @param onError - Optional callback function called when an error occurs
     * @returns A function that can be called to stop the stream
     */
    /**
     * Get all headers including workspace context
     * @private
     */
    protected getAllHeaders(): Record<string, string>;
    private streamRun;
}

/**
 * WeChat Mini Program client for interacting with the Axiom Lattice Agent Service API
 */
declare class WeChatClient extends AbstractClient {
    /**
     * Creates a new WeChatClient instance
     * @param config - Configuration options for the client
     */
    constructor(config: ClientConfig);
    /**
     * Set tenant ID for multi-tenant environments
     * @param tenantId - Tenant identifier
     */
    setTenantId(tenantId: string): void;
    /**
     * Creates a new instance of the client with the given configuration
     * @param config - Configuration options for the client
     * @returns A new WeChatClient instance
     */
    protected createInstance(config: ClientConfig): AbstractClient;
    /**
     * Implementation of the abstract makeRequest method for WeChat clients
     * @param url - The URL to make the request to
     * @param options - Request options
     * @returns A promise that resolves to the response data
     */
    protected makeRequest<T>(url: string, options?: {
        method?: string;
        body?: any;
        headers?: Record<string, string>;
    }): Promise<T>;
    /**
     * Implementation of the abstract streamRequest method for WeChat clients
     */
    protected streamRequest(options: RunOptions, onEvent: (event: MessageChunk) => void, onComplete?: (state?: AgentState) => void, onError?: (error: Error) => void): () => void;
    /**
     * Resume streaming from a known position
     * @param options - Options for resuming the stream
     * @param onEvent - Callback function that receives stream events
     * @param onComplete - Optional callback function called when streaming completes
     * @param onError - Optional callback function called when an error occurs
     * @returns A function that can be called to stop the stream
     */
    resumeStream(options: ResumeStreamOptions, onEvent: (event: MessageChunk) => void, onComplete?: () => void, onError?: (error: Error) => void): () => void;
    /**
     * Helper method to make WeChat HTTP requests
     * @private
     */
    private request;
    /**
     * Stream run results using WeChat's downloadFile API
     * @param options - Options for streaming run results
     * @param onEvent - Callback function that receives stream events
     * @param onComplete - Optional callback function called when streaming completes
     * @param onError - Optional callback function called when an error occurs
     * @returns A function that can be called to stop the stream
     */
    private streamRun;
    decodeUint8Array(uint8Array: ArrayBuffer): any;
    buf2hex(arrayBuffer: ArrayBuffer): string;
    /**
     * Convert hexadecimal string to text (supports Chinese characters)
     * @param {String} hex - Hexadecimal string
     * @return {String} Decoded string including Chinese characters
     */
    hexToStr(hex: string): any;
}

/**
 * WorkspaceClient
 *
 * Client for workspace and project management API
 */

declare class WorkspaceClient {
    private baseURL;
    private headers;
    constructor(config: ClientConfig, tenantId?: string);
    private request;
    listWorkspaces(): Promise<Workspace[]>;
    createWorkspace(data: CreateWorkspaceRequest): Promise<Workspace>;
    getWorkspace(workspaceId: string): Promise<Workspace>;
    updateWorkspace(workspaceId: string, updates: UpdateWorkspaceRequest): Promise<Workspace>;
    deleteWorkspace(workspaceId: string): Promise<void>;
    listProjects(workspaceId: string): Promise<Project[]>;
    createProject(workspaceId: string, data: CreateProjectRequest): Promise<Project>;
    getProject(workspaceId: string, projectId: string): Promise<Project>;
    updateProject(workspaceId: string, projectId: string, updates: UpdateProjectRequest): Promise<Project>;
    deleteProject(workspaceId: string, projectId: string): Promise<void>;
    listPath(workspaceId: string, projectId: string, path?: string): Promise<FileItem[]>;
    readFile(workspaceId: string, projectId: string, path: string, offset?: number, limit?: number): Promise<{
        content: string;
        offset: number;
        limit: number;
    }>;
    /**
     * Upload a file to the workspace project storage.
     *
     * Uses multipart/form-data against:
     * POST /api/workspaces/:workspaceId/projects/:projectId/uploadfile
     */
    uploadFile(workspaceId: string, projectId: string, file: File | Blob, path?: string): Promise<FileItem>;
    getFileDownloadUrl(workspaceId: string, projectId: string, filePath: string): string;
}

/**
 * ChunkMessageMerger
 *
 * A utility for handling streaming message chunks and merging them into complete messages.
 */

/**
 * Creates a simple message merger for handling streaming message chunks
 * @returns An object with methods to push chunks and retrieve merged messages
 */
declare function createSimpleMessageMerger(): {
    push: (chunk: MessageChunk) => void;
    initialMessages: (msgs: any[]) => void;
    getMessages: () => any[];
    getMessagesWithoutToolCalls: () => any[];
    removeMessageById: (messageId: string) => boolean;
    reset: () => void;
};

export { AbstractClient, AgentState, ApiError, Assistant, AssistantListResponse, AssistantResponse, AuthenticationError, ChatResponse, ChatSendOptions, ChatStreamOptions, Client, ClientConfig, CreateAssistantOptions, CreateProjectRequest, CreateThreadOptions, CreateWorkspaceRequest, FileItem, GetMessagesOptions, GetScheduledTasksOptions, ListThreadsOptions, NetworkError, Project, RegisterToolOptions, ResumeStreamOptions, RetryConfig, RunOptions, ScheduleExecutionType, ScheduledTask, ScheduledTaskStatus, ScheduledTasksListResponse, StorageType, StreamCallbacks, Thread, ThreadListResponse, ThreadResponse, Transport, UpdateAssistantOptions, UpdateProjectRequest, UpdateThreadOptions, UpdateWorkspaceRequest, WeChatClient, Workspace, WorkspaceClient, createSimpleMessageMerger };
