import { AgentProcessSummary, AgentArtifact, SendMessagePayload, StreamChunk, MessagesPage, DataWithCursor, Activity, ActivitySummary, ActivitySummaryParams, SortOrder } from '../types';
import { AgentChat, AgentConfiguration, AgentMessage, AgentToolCallStatus, MultiUserMessagePayload, MultiUserMessageResponse, ModelOption } from '@multiplayer-app/ai-agent-types';

export interface GetMessagesOptions {
    limit?: number;
    before?: string;
}
export interface StreamMessageOptions {
    /**
     * Stable key used to identify/cancel a specific in-flight stream.
     * Typically the chat id. For unsaved/new chats you may use a placeholder key.
     */
    streamKey?: string;
}
export type ActivityTreeNode = Activity & {
    children: ActivityTreeNode[];
};
export interface UpsertAgentPreferencesRequest {
    tools: Record<string, boolean>;
}
export type UpsertAgentPreferencesResponse = {
    id: string;
    userId: string;
    agentName: string;
    tools: Record<string, boolean>;
    createdAt: string;
    updatedAt: string;
};
export interface UpsertAgentPreferencesBatchRequest {
    preferences: Array<{
        agentName: string;
        tools: Record<string, boolean>;
    }>;
}
export interface UpsertAgentPreferencesBatchResponse {
    preferences: UpsertAgentPreferencesResponse[];
}
export interface AgentTransport {
    sendMessage(payload: SendMessagePayload): Promise<AgentChat>;
    streamMessage(payload: SendMessagePayload, onChunk: (chunk: StreamChunk) => void, options?: StreamMessageOptions): Promise<{
        id: string;
        messages: AgentMessage[];
    } | void>;
    sendMultiUserMessage?(payload: MultiUserMessagePayload): Promise<MultiUserMessageResponse>;
    /**
     * Cancels a specific stream if `streamKey` is provided; otherwise cancels all active streams.
     */
    cancelStream?(streamKey?: string): void;
    listChats(params?: {
        contextKey?: string;
        skip?: number;
        limit?: number;
        userId?: string;
        multiUser?: boolean;
        sortField?: string;
        sortOrder?: 'asc' | 'desc';
    }): Promise<DataWithCursor<AgentChat>>;
    getChat(chatId: string): Promise<AgentChat>;
    getMessages?(chatId: string, options?: GetMessagesOptions): Promise<MessagesPage>;
    deleteChat(chatId: string): Promise<void>;
    listAgents(): Promise<AgentProcessSummary[]>;
    controlAgent(options: {
        id: string;
        action: 'stop' | 'resume' | 'retry';
    }): Promise<AgentProcessSummary>;
    listArtifacts(chatId: string): Promise<AgentArtifact[]>;
    listActivities?(params?: {
        groupId?: string;
        parentId?: string;
        sourceType?: string;
        skip?: number;
        limit?: number;
        sort?: {
            field: string;
            order: SortOrder;
        };
        from?: string;
        to?: string;
        tenant?: Record<string, string> | {
            all?: boolean;
        };
        ownerId?: string;
    }): Promise<DataWithCursor<Activity>>;
    listActivitySourceTypes?(params?: {
        groupId?: string;
        parentId?: string;
        from?: string;
        to?: string;
        tenant?: Record<string, string> | {
            all?: boolean;
        };
        ownerId?: string;
    }): Promise<string[]>;
    getActivity?(activityId: string): Promise<Activity | null>;
    getActivitySummary?(params?: ActivitySummaryParams): Promise<ActivitySummary[]>;
    /**
     * Update fields on a specific tool call in a specific message.
     * Only supported by ProxyTransport (server-backed). DirectTransport may omit it.
     */
    updateToolCall?(input: {
        chatId: string;
        messageId: string;
        toolCallId: string;
        input?: Record<string, unknown>;
        output?: Record<string, unknown>;
        status?: AgentToolCallStatus;
    }, options?: {
        excludeSocketId?: boolean;
    }): Promise<AgentMessage>;
    /**
   * Persist a tool-call action (generic mechanism used by tool renderers).
   * Only supported by ProxyTransport (server-backed). DirectTransport may omit it.
   */
    recordToolCallAction?(chatId: string, input: {
        toolCallId: string;
        action: string;
        data?: Record<string, unknown>;
        systemMessage?: string;
    }, options?: {
        excludeSocketId?: boolean;
    }): Promise<Record<string, unknown> | void>;
    /**
     * Fetch available models from the backend.
     * Returns empty array for DirectTransport (models come from config).
     */
    listModels?(): Promise<ModelOption[]>;
    /**
     * Fetch agent configurations for the current user.
     * Optional contextKey narrows the result set.
     */
    listAgentConfigurations?(contextKey?: string): Promise<AgentConfiguration[]>;
    /**
     * Persist preferences for a single agent.
     * Only supported by ProxyTransport (server-backed). DirectTransport may omit it.
     */
    upsertAgentPreferences?(agentName: string, input: UpsertAgentPreferencesRequest): Promise<UpsertAgentPreferencesResponse>;
    /**
     * Persist preferences for multiple agents in one request.
     * Only supported by ProxyTransport (server-backed). DirectTransport may omit it.
     */
    upsertAgentPreferencesBatch?(input: UpsertAgentPreferencesBatchRequest): Promise<UpsertAgentPreferencesBatchResponse>;
    /**
     * Optionally generate a human-friendly title for a new chat based on the first user message.
     * Implementations may call an LLM, a backend service, or use local heuristics.
     */
    generateTitle?(input: {
        content: string;
        contextKey: string;
        userId?: string;
        strategy?: 'local' | 'llm';
    }): Promise<string>;
}
//# sourceMappingURL=AgentTransport.d.ts.map