import { UserInfo } from '@memberjunction/core';
import { PubSubEngine } from 'type-graphql';
import { UserPayload } from '../types.js';
/**
 * Task definition from LLM response
 */
export interface TaskDefinition {
    tempId: string;
    name: string;
    description: string;
    agentName: string;
    dependsOn: string[];
    inputPayload?: any;
}
/**
 * Task graph response from Conversation Manager
 */
export interface TaskGraphResponse {
    workflowName: string;
    tasks: TaskDefinition[];
    reasoning?: string;
}
/**
 * Task execution result
 */
export interface TaskExecutionResult {
    taskId: string;
    success: boolean;
    output?: any;
    error?: string;
}
/**
 * TaskOrchestrator handles multi-step task execution with dependencies
 */
export declare class TaskOrchestrator {
    private contextUser;
    private pubSub?;
    private sessionId?;
    private userPayload?;
    private createNotifications;
    private conversationDetailId?;
    private readonly JSON_ARTIFACT_TYPE_ID;
    private taskTypeId;
    constructor(contextUser: UserInfo, pubSub?: PubSubEngine, sessionId?: string, userPayload?: UserPayload, createNotifications?: boolean, conversationDetailId?: string);
    /**
     * Initialize the orchestrator by finding/creating the AI Agent Task type
     */
    private ensureTaskType;
    /**
     * Create tasks from LLM task graph response
     * @param taskGraph Task graph from Conversation Manager
     * @param conversationDetailId ID of the conversation detail that triggered this
     * @param environmentId Environment ID
     * @returns Object with parentTaskId and map of tempId -> actual TaskEntity ID
     */
    createTasksFromGraph(taskGraph: TaskGraphResponse, conversationDetailId: string, environmentId: string): Promise<{
        parentTaskId: string;
        taskIdMap: Map<string, string>;
    }>;
    /**
     * Publish task progress update via PubSub
     */
    private publishTaskProgress;
    /**
     * Publish agent progress update (nested within task)
     */
    private publishAgentProgress;
    /**
     * Find agent by name
     */
    private findAgentByName;
    /**
     * Execute all pending tasks for a parent task, respecting dependencies
     * @param parentTaskId Parent task ID
     * @returns Array of execution results
     */
    executeTasksForParent(parentTaskId: string): Promise<TaskExecutionResult[]>;
    /**
     * Find tasks that are ready to execute (pending with no incomplete dependencies)
     */
    private findEligibleTasks;
    /**
     * Update parent task progress based on child task completion
     */
    private updateParentTaskProgress;
    /**
     * Mark parent task as complete when all children are done
     */
    private completeParentTask;
    /**
     * Check if a task has incomplete dependencies
     */
    private hasIncompleteDependencies;
    /**
     * Load a task by ID
     */
    private loadTask;
    /**
     * Execute a single task
     */
    private executeTask;
    /**
     * Extract input payload from task metadata
     */
    private extractInputPayload;
    /**
     * Get outputs from tasks that this task depends on
     */
    private getDependentTaskOutputs;
    /**
     * Build conversation messages with task input and dependent outputs formatted as markdown
     */
    private buildConversationMessages;
    /**
     * Extract agent output - check both message and payload
     */
    private extractAgentOutput;
    /**
     * Create artifact from task output (handles both message and payload types)
     */
    private createArtifactFromOutput;
    /**
     * Create user notification for task graph completion
     * Notifies user that their multi-step workflow has completed
     */
    private createTaskGraphCompletionNotification;
}
//# sourceMappingURL=TaskOrchestrator.d.ts.map