import { TaskStore, type TaskState, type PersistedTask } from "./task-store.js";
export declare class TaskManager {
    private store;
    constructor(taskStore: TaskStore);
    /**
     * Create a new task under a goal.
     * Validates sub-task depth (max 1 level: sub-tasks cannot have sub-tasks).
     */
    createTask(goalId: string, title: string, type: string, opts?: {
        parentTaskId?: string;
        spec?: string;
        dependsOn?: string[];
        workflowGateId?: string;
        inputGateIds?: string[];
    }): PersistedTask;
    getTask(id: string): PersistedTask | undefined;
    /** Get all tasks (including sub-tasks) for a goal. */
    getTasksForGoal(goalId: string): PersistedTask[];
    /** Get all tasks assigned to a session. */
    getTasksForSession(sessionId: string): PersistedTask[];
    /**
     * Update a task's mutable fields.
     * Validates state transitions and prevents circular dependencies.
     */
    updateTask(id: string, updates: {
        title?: string;
        spec?: string;
        state?: TaskState;
        assignedSessionId?: string;
        dependsOn?: string[];
        workflowGateId?: string;
        inputGateIds?: string[];
        headSha?: string;
        baseSha?: string;
        branch?: string;
        resultSummary?: string;
    }): boolean;
    /**
     * Delete a task. Cascades to delete sub-tasks if the task is a parent.
     */
    deleteTask(id: string): boolean;
    /**
     * Assign a task to a session. Auto-transitions to in-progress.
     * If the task is a sub-task, also auto-transitions the parent to in-progress.
     */
    assignTask(taskId: string, sessionId: string): boolean;
    /**
     * Complete a task. Validates all sub-tasks are complete or skipped first.
     */
    completeTask(taskId: string): boolean;
    /**
     * Transition a task to a new state with validation.
     */
    transitionTask(taskId: string, newState: TaskState): boolean;
    /** Delete all tasks for a goal (for cascade from goal deletion). */
    deleteTasksForGoal(goalId: string): void;
    private isValidTransition;
    /**
     * Detect circular dependencies by walking the dependency graph.
     * Throws if adding `newDeps` to `taskId` would create a cycle.
     */
    private detectCycle;
}
/**
 * Mark test/review tasks as stale when a new commit lands on the goal branch.
 * Tasks completed at a different headSha than the current HEAD are stale.
 */
export declare function markStaleTasks(store: TaskStore, goalId: string, currentHeadSha: string): PersistedTask[];
/**
 * Get the current HEAD commit SHA for a goal's branch.
 */
export declare function getGoalBranchHead(cwd: string): string | null;
//# sourceMappingURL=task-manager.d.ts.map