import { TaskService } from './service.js';
import { CoordinationService } from '../coordination/service.js';
import type { Task, TaskWithRelations } from './types.js';
import type { WorkAnnouncement, WorkOverlap, CollaborationSuggestion } from '../types/coordination.js';
export interface TaskCoordinationConfig {
    taskService: TaskService;
    coordinationService: CoordinationService;
    agentId: string;
    agentName: string;
    worktreeBranch?: string;
}
export interface ClaimResult {
    task: TaskWithRelations;
    announcement: WorkAnnouncement;
    overlaps: WorkOverlap[];
    suggestions: CollaborationSuggestion[];
    worktreeBranch?: string;
    routing?: {
        suggestedDroid?: string;
        capabilities: string[];
        confidence: number;
    };
    patterns?: {
        matched: string[];
        enforcementChecklist: string[];
    };
}
export interface ReleaseResult {
    task: Task;
    completedAnnouncements: number;
    /** Task IDs that became unblocked as a result of this completion */
    unblockedTasks: string[];
}
/**
 * Coordinates task operations with the agent coordination system.
 * Handles claiming/releasing tasks, overlap detection, and multi-agent awareness.
 *
 * Supports auto-execution of unblocked tasks via TaskEventBus:
 *   coordinator.enableAutoExecute(handler)
 */
export declare class TaskCoordinator {
    private taskService;
    private coordService;
    private agentId;
    private worktreeBranch?;
    private eventBus;
    private autoExecuteUnsub?;
    constructor(config: TaskCoordinationConfig);
    /**
     * Enable auto-execution of tasks that become unblocked.
     *
     * When a task completes and unblocks dependents, the handler is called
     * for each newly-ready task. The handler decides whether to claim and
     * execute the task.
     *
     * @param handler - Called with each unblocked task ID. Return true to claim it.
     * @returns Unsubscribe function
     */
    enableAutoExecute(handler: (taskId: string, task: TaskWithRelations) => Promise<boolean>): () => void;
    /**
     * Claim a task for this agent.
     * - Assigns the task to this agent
     * - Creates worktree branch if needed
     * - Announces work to coordination system
     * - Detects overlaps with other agents
     */
    claim(taskId: string, worktreeBranch?: string): Promise<ClaimResult | null>;
    /**
     * Release a task (mark complete, announce completion).
     */
    release(taskId: string, reason?: string): Promise<ReleaseResult | null>;
    /**
     * Check for overlaps before working on a task.
     */
    checkOverlaps(taskId: string): WorkOverlap[];
    /**
     * Find tasks that other agents are working on in the same area.
     */
    findRelatedActiveWork(taskId: string): Array<{
        task: Task;
        agent: string;
        overlap: WorkOverlap;
    }>;
    /**
     * Suggest optimal task assignment based on current work distribution.
     */
    suggestNextTask(): TaskWithRelations | null;
    /**
     * Get merge order suggestions for tasks with overlapping work.
     */
    getMergeOrderSuggestion(taskIds: string[]): string[];
    /**
     * Convert a task to a resource identifier for the coordination system.
     */
    private taskToResource;
    /**
     * Estimate time to complete a task based on type and complexity.
     */
    private estimateMinutes;
}
//# sourceMappingURL=coordination.d.ts.map