/** * Background Task Types * * Type definitions for background task execution. * Enables non-blocking agent invocations and pipeline steps. */ /** * Background task status. */ export type BackgroundTaskStatus = 'pending' | 'running' | 'completed' | 'failed' | 'cancelled'; /** * Type of background task. */ export type BackgroundTaskType = 'agent_invocation' | 'pipeline_step' | 'custom'; /** * Background task definition. */ export interface BackgroundTask { /** Unique task ID */ id: string; /** Task type */ type: BackgroundTaskType; /** Current status */ status: BackgroundTaskStatus; /** Role being invoked (for agent tasks) */ role?: string; /** Provider being used */ provider?: string; /** Model being used */ model?: string; /** Task description/prompt */ prompt: string; /** When task was created */ createdAt: Date; /** When task started running */ startedAt?: Date; /** When task completed/failed */ completedAt?: Date; /** Result if completed */ result?: unknown; /** Error if failed */ error?: Error; /** Progress percentage (0-100) */ progress?: number; /** Progress message */ progressMessage?: string; /** Associated worktree ID */ worktreeId?: string; /** Parent task ID (for pipeline steps) */ parentTaskId?: string; /** Abort controller for cancellation */ abortController?: AbortController; } /** * Notification type for background task events. */ export type TaskNotificationType = 'started' | 'progress' | 'completed' | 'failed'; /** * Notification for background task events. */ export interface TaskNotification { /** ID of the task this notification is for */ taskId: string; /** Type of notification */ type: TaskNotificationType; /** When the event occurred */ timestamp: Date; /** Human-readable message */ message: string; /** Result data (for completed notifications) */ result?: unknown; /** Error message (for failed notifications) */ error?: string; } /** * Background task runner configuration. */ export interface BackgroundTaskConfig { /** Maximum concurrent background tasks (default: 5) */ maxConcurrent: number; /** Default timeout for background tasks in ms (default: 300000 = 5 minutes) */ defaultTimeout: number; /** Enable task notifications (default: true) */ enableNotifications: boolean; /** Notification callback */ onNotification?: (notification: TaskNotification) => void; } /** * Events emitted by the BackgroundTaskRunner. */ export interface BackgroundTaskEvents { 'task:submitted': (task: BackgroundTask) => void; 'task:started': (task: BackgroundTask) => void; 'task:progress': (task: BackgroundTask, progress: number, message?: string) => void; 'task:completed': (task: BackgroundTask) => void; 'task:failed': (task: BackgroundTask, error: Error) => void; 'task:cancelled': (task: BackgroundTask) => void; } /** * Options for submitting a background task. */ export interface SubmitTaskOptions { /** Role being invoked (for agent tasks) */ role?: string; /** Provider being used */ provider?: string; /** Model being used */ model?: string; /** Timeout in ms (overrides default) */ timeout?: number; /** Associated worktree ID */ worktreeId?: string; /** Parent task ID (for pipeline steps) */ parentTaskId?: string; } /** * Serialized background task for persistence. */ export interface SerializedBackgroundTask { id: string; type: BackgroundTaskType; status: BackgroundTaskStatus; role?: string; provider?: string; model?: string; prompt: string; createdAt: number; startedAt?: number; completedAt?: number; progress?: number; progressMessage?: string; worktreeId?: string; parentTaskId?: string; } //# sourceMappingURL=types.d.ts.map