/**
 * Loop Task Manager
 * CCW Loop System - JSONL task persistence layer for v2 loops
 * Reference: .workflow/.scratchpad/loop-system-complete-design-20260121.md section 4.2
 *
 * Storage format: .workflow/.loop/{loopId}/tasks.jsonl
 * JSONL format: one JSON object per line for efficient append-only operations
 */
/**
 * Loop Task - simplified task definition for v2 loops
 */
export interface LoopTask {
    /** Unique task identifier */
    task_id: string;
    /** Task description (what to do) */
    description: string;
    /**
     * CLI tool to use
     *
     * Should be one of the enabled tools from cli-tools.json:
     * - 'bash' (always available)
     * - Builtin tools: 'gemini', 'qwen', 'codex', 'claude', 'opencode'
     * - CLI wrappers: 'doubao', etc. (if enabled)
     * - API endpoints: custom tools (if enabled)
     *
     * Note: Validation is performed at the API layer (loop-v2-routes.ts)
     * to ensure tool is enabled before saving.
     */
    tool: string;
    /** Execution mode */
    mode: 'analysis' | 'write' | 'review';
    /** Prompt template with variable replacement */
    prompt_template: string;
    /** Display order (for drag-drop reordering) */
    order: number;
    /** Creation timestamp */
    created_at: string;
    /** Last update timestamp */
    updated_at: string;
    /** Optional: custom bash command */
    command?: string;
    /** Optional: step failure behavior */
    on_error?: 'continue' | 'pause' | 'fail_fast';
}
/**
 * Task create request
 */
export interface TaskCreateRequest {
    description: string;
    tool: LoopTask['tool'];
    mode: LoopTask['mode'];
    prompt_template: string;
    command?: string;
    on_error?: LoopTask['on_error'];
}
/**
 * Task update request
 */
export interface TaskUpdateRequest {
    description?: string;
    tool?: LoopTask['tool'];
    mode?: LoopTask['mode'];
    prompt_template?: string;
    command?: string;
    on_error?: LoopTask['on_error'];
}
/**
 * Task reorder request
 */
export interface TaskReorderRequest {
    ordered_task_ids: string[];
}
/**
 * Task Storage Manager
 * Handles JSONL persistence for loop tasks
 */
export declare class TaskStorageManager {
    private baseDir;
    constructor(workflowDir: string);
    /**
     * Add a new task to the loop
     */
    addTask(loopId: string, request: TaskCreateRequest): Promise<LoopTask>;
    /**
     * Get all tasks for a loop
     */
    getTasks(loopId: string): Promise<LoopTask[]>;
    /**
     * Get single task by ID
     */
    getTask(loopId: string, taskId: string): Promise<LoopTask | null>;
    /**
     * Update existing task
     */
    updateTask(loopId: string, taskId: string, updates: TaskUpdateRequest): Promise<LoopTask | null>;
    /**
     * Delete task and reorder remaining tasks
     */
    deleteTask(loopId: string, taskId: string): Promise<boolean>;
    /**
     * Reorder tasks based on provided task ID sequence
     */
    reorderTasks(loopId: string, request: TaskReorderRequest): Promise<LoopTask[]>;
    /**
     * Delete all tasks for a loop
     */
    deleteAllTasks(loopId: string): Promise<void>;
    /**
     * Read tasks with recovery from backup
     */
    readTasksWithRecovery(loopId: string): Promise<LoopTask[]>;
    /**
     * Get tasks file path
     */
    getTasksPath(loopId: string): string;
    /**
     * Read tasks from JSONL file
     */
    private readTasks;
    /**
     * Parse JSONL content into tasks array
     */
    private parseTasksJsonl;
    /**
     * Write tasks array to JSONL file
     */
    private writeTasks;
    /**
     * Append single task to JSONL file
     */
    private appendTask;
    /**
     * Ensure loop directory exists
     */
    private ensureLoopDir;
    /**
     * Generate unique task ID
     */
    private generateTaskId;
    /**
     * Sanitize loop ID for filesystem usage
     */
    private sanitizeLoopId;
    /**
     * Reorder tasks array by updating order indices sequentially
     */
    private reorderTasksByOrder;
}
//# sourceMappingURL=loop-task-manager.d.ts.map