import { PubSubEngine } from 'type-graphql';
import { AppContext } from '../types.js';
import { ResolverBase } from '../generic/ResolverBase.js';
export declare class AIAgentRunResult {
    success: boolean;
    errorMessage?: string;
    executionTimeMs?: number;
    result: string;
}
export declare class AgentExecutionProgress {
    currentStep: string;
    percentage?: number;
    message: string;
    agentName?: string;
    agentType?: string;
    stepCount?: number;
    hierarchicalStep?: string;
}
export declare class AgentStreamingContent {
    content: string;
    isPartial: boolean;
    stepName?: string;
    agentName?: string;
}
export declare class AgentExecutionStepSummary {
    stepId: string;
    stepName: string;
    agentName?: string;
    agentType?: string;
    startTime: Date;
    endTime?: Date;
    status: string;
    result?: string;
}
export declare class AgentPartialResult {
    currentStep: string;
    partialOutput?: string;
}
export declare class AgentExecutionStreamMessage {
    sessionId: string;
    agentRunId: string;
    type: 'progress' | 'streaming' | 'partial_result' | 'complete';
    progress?: AgentExecutionProgress;
    streaming?: AgentStreamingContent;
    partialResult?: AgentPartialResult;
    timestamp: Date;
    agentRun?: any;
    conversationDetailId?: string;
}
export declare class RunAIAgentResolver extends ResolverBase {
    /**
     * Sanitize ExecuteAgentResult for JSON serialization
     * Removes circular references and non-serializable objects
     */
    private sanitizeAgentResult;
    /**
     * Parse and validate JSON input
     */
    private parseJsonInput;
    /**
     * Extract the user message from the messages array
     * Looks for the last user message in the conversation
     */
    private extractUserMessage;
    /**
     * Validate the agent entity
     */
    private validateAgent;
    /**
     * Create streaming progress callback
     */
    private createProgressCallback;
    private PublishProgressUpdate;
    private PublishStreamingUpdate;
    /**
     * Create streaming content callback
     */
    private createStreamingCallback;
    /**
     * Internal method that handles the core AI agent execution logic.
     * This method is called by both the regular and system user resolvers.
     * @private
     */
    private executeAIAgent;
    /**
     * Publish final streaming events (partial result and completion).
     * The completion event includes the full result JSON so clients using
     * fire-and-forget mode can receive the result via WebSocket.
     */
    private publishFinalEvents;
    /**
     * Public mutation for regular users to run AI agents with authentication.
     * Supports fire-and-forget mode to avoid Azure proxy timeouts on long-running agent executions.
     */
    RunAIAgent(agentId: string, { userPayload, providers, dataSource }: AppContext, messagesJson: string, sessionId: string, pubSub: PubSubEngine, data?: string, payload?: string, templateData?: string, lastRunId?: string, autoPopulateLastRunPayload?: boolean, configurationId?: string, conversationDetailId?: string, createArtifacts?: boolean, createNotification?: boolean, sourceArtifactId?: string, sourceArtifactVersionId?: string, fireAndForget?: boolean): Promise<AIAgentRunResult>;
    /**
     * System user query for running AI agents with elevated privileges.
     * Requires the @RequireSystemUser decorator to ensure only system users can access.
     */
    RunAIAgentSystemUser(agentId: string, { userPayload, providers, dataSource }: AppContext, messagesJson: string, sessionId: string, pubSub: PubSubEngine, data?: string, payload?: string, templateData?: string, lastRunId?: string, autoPopulateLastRunPayload?: boolean, configurationId?: string, conversationDetailId?: string, createArtifacts?: boolean, createNotification?: boolean, sourceArtifactId?: string, sourceArtifactVersionId?: string): Promise<AIAgentRunResult>;
    /**
     * Create a user notification for agent completion with artifact
     * Notification includes navigation link back to the conversation
     */
    private createCompletionNotification;
    /**
     * When a continuation run completes (lastRunId was provided), sync the corresponding
     * AIAgentRequest by marking it as responded. This keeps the dashboard accurate when
     * users respond to Chat steps via the conversation UI.
     *
     * Called server-side in the resolver so the conversation UI doesn't need any changes.
     */
    private syncFeedbackRequestFromConversation;
    /**
     * Sends a notification when an agent creates a feedback request (Chat step).
     * Called after execution completes if the result contains a feedbackRequestId.
     */
    private sendFeedbackRequestNotification;
    /**
     * Optimized mutation that loads conversation history server-side.
     * This avoids sending large attachment data from client to server.
     *
     * @param conversationDetailId - The conversation detail ID (user's message already saved)
     * @param agentId - The agent to execute
     * @param maxHistoryMessages - Maximum number of history messages to include (default: 20)
     */
    RunAIAgentFromConversationDetail(conversationDetailId: string, agentId: string, { userPayload, providers, dataSource }: AppContext, sessionId: string, pubSub: PubSubEngine, maxHistoryMessages?: number, data?: string, payload?: string, lastRunId?: string, autoPopulateLastRunPayload?: boolean, configurationId?: string, createArtifacts?: boolean, createNotification?: boolean, sourceArtifactId?: string, sourceArtifactVersionId?: string, fireAndForget?: boolean): Promise<AIAgentRunResult>;
    /**
     * Respond to a pending AIAgentRequest from the dashboard or API.
     * Updates the request record with the response and optionally spawns a
     * new agent run to resume execution with the human's input.
     */
    RespondToAgentRequest(requestId: string, status: string, { userPayload, providers, dataSource }: AppContext, response?: string, responseData?: string, resumeAgent?: boolean): Promise<AIAgentRunResult>;
    /**
     * Reassign an agent request to a different user.
     * Updates RequestForUserID and sends a notification to the new assignee.
     */
    ReassignAgentRequest(requestId: string, newUserID: string, { userPayload }: AppContext, note?: string): Promise<AIAgentRunResult>;
    /**
     * Execute agent in background (fire-and-forget).
     * Handles errors by publishing error completion events via PubSub,
     * so the client receives them via WebSocket even though the HTTP response
     * has already been sent.
     */
    private executeAgentInBackground;
    /**
     * Load conversation history with attachments from database.
     * Builds ChatMessage[] with multimodal content blocks for attachments.
     */
    private loadConversationHistoryWithAttachments;
    /**
     * Map ConversationDetail Role to ChatMessage role
     */
    private mapDetailRoleToMessageRole;
}
//# sourceMappingURL=RunAIAgentResolver.d.ts.map