/**
 * Task Runtime — CC framework.ts parity.
 *
 * Manages task lifecycle: creation, state updates, completion, cleanup.
 * All task types (local_bash, local_agent, dream, etc.) use this framework.
 *
 * CC equivalent: src/utils/task/framework.ts + src/Task.ts
 *
 * Architecture note: CC uses React-style setAppState(prev => next). We use
 * a simple Map-based store since we're in a subprocess (no React).
 */
import type { TaskState, TaskType, TaskLifecycle } from "../tasks/task-types.js";
import type { HookRegistry } from "../../contracts/hooks.js";
/** Grace period for terminal tasks before eviction (ms) */
export declare const PANEL_GRACE_MS = 30000;
export declare function generateTaskId(type: TaskType): string;
/**
 * In-memory task store — replaces CC's AppState.tasks.
 *
 * Thread-safe for single-process use. All mutations go through
 * updateTaskState / registerTask for consistency.
 */
export declare class TaskStore {
    private tasks;
    private listeners;
    private hooks;
    private sessionId;
    /** Attach a hook registry to fire task.created / task.completed hooks. */
    setHooks(hooks: HookRegistry, sessionId: string): void;
    /**
     * Register a listener for task state changes.
     * @returns Unregister function
     */
    onTaskChange(listener: (taskId: string, task: TaskState | null) => void): () => void;
    private notify;
    /**
     * Register a new task.
     */
    registerTask(task: TaskState): void;
    /**
     * Update a task's state via an updater function.
     * CC equivalent: updateTaskState()
     */
    updateTask<T extends TaskState>(taskId: string, updater: (task: T) => T): void;
    /**
     * Get a task by ID.
     */
    getTask(taskId: string): TaskState | undefined;
    /**
     * Get all running tasks.
     */
    getRunningTasks(): TaskState[];
    /**
     * Get all tasks.
     */
    getAllTasks(): TaskState[];
    /**
     * Evict a terminal task from the store.
     */
    evictTask(taskId: string): void;
    /**
     * Evict all terminal tasks that have passed their grace period.
     */
    evictStaleTasks(graceMs?: number): void;
}
export declare function isTerminalLifecycle(lifecycle: TaskLifecycle): boolean;
/**
 * Build a task notification message in CC's XML format.
 * This is injected into the conversation as context for the model.
 */
export declare function buildTaskNotification(task: TaskState, summary: string): string;
