import type { BackgroundJobStore } from './background-job-store'; import { type TaskOutputState } from './task'; export interface ContextFile { path: string; lineCount: number; lineNumbers?: number[]; lastReadAt: number; } export type BackgroundJobState = TaskOutputState | 'reconciled'; export interface BackgroundJobRecord { taskID: string; parentSessionID: string; agent: string; description: string; objective?: string; state: BackgroundJobState; timedOut: boolean; recoverableAfterLiveBusy: boolean; statusUncertain: boolean; cancellationRequested: boolean; terminalUnreconciled: boolean; launchedAt: number; lastLaunchedAt: number; updatedAt: number; lastLiveBusyAt?: number; completedAt?: number; resultSummary?: string; lastStatusError?: string; alias: string; lastUsedAt: number; terminalState?: TaskOutputState; contextFiles: ContextFile[]; totalErrors?: number; timeoutCount?: number; lastErrorAt?: number; } export interface BackgroundJobBoardOptions { maxReusablePerAgent?: number; readContextMinLines?: number; readContextMaxFiles?: number; } export interface BackgroundJobLaunchInput { taskID: string; parentSessionID: string; agent: string; description?: string; objective?: string; now?: number; } export interface BackgroundJobStatusInput { taskID: string; state: TaskOutputState; timedOut?: boolean; statusUncertain?: boolean; resultSummary?: string; lastStatusError?: string; now?: number; } type TerminalStateListener = (taskID: string) => void; export declare class BackgroundJobBoard implements BackgroundJobStore { private readonly jobs; private readonly counters; private terminalStateListeners; private readonly maxReusablePerAgent; private readonly readContextMinLines; private readonly readContextMaxFiles; constructor(options?: BackgroundJobBoardOptions); addTerminalStateListener(listener: TerminalStateListener): void; removeTerminalStateListener(listener: TerminalStateListener): void; setTerminalStateListener(listener?: TerminalStateListener): void; private notifyTerminalStateListeners; registerLaunch(input: BackgroundJobLaunchInput): BackgroundJobRecord; updateStatus(input: BackgroundJobStatusInput): BackgroundJobRecord | undefined; updateFromStatusOutput(output: string): BackgroundJobRecord | undefined; markRunningFromLiveSession(taskID: string, now?: number): BackgroundJobRecord | undefined; markReconciled(taskID: string, now?: number): BackgroundJobRecord | undefined; markCancelled(taskID: string, reason?: string, now?: number, options?: { force?: boolean; }): BackgroundJobRecord | undefined; get(taskID: string): BackgroundJobRecord | undefined; field(taskID: string, key: K): BackgroundJobRecord[K] | undefined; isRunning(taskID: string): boolean; isTerminalUnreconciled(taskID: string): boolean; getResultSummary(taskID: string): string | undefined; getLastLiveBusyAt(taskID: string): number | undefined; getParentSessionID(taskID: string): string | undefined; getState(taskID: string): BackgroundJobState | undefined; resolve(parentSessionID: string, taskIDOrAlias: string): BackgroundJobRecord | undefined; resolveReusable(parentSessionID: string, taskIDOrAlias: string, agent?: string): BackgroundJobRecord | undefined; resolveRecoverable(parentSessionID: string, taskIDOrAlias: string, agent?: string): BackgroundJobRecord | undefined; markUsed(parentSessionID: string, key: string, now?: number): void; taskIDs(): Set; addContext(taskID: string, files: ContextFile[]): void; list(parentSessionID?: string): BackgroundJobRecord[]; hasRunning(parentSessionID: string): boolean; hasTerminalUnreconciled(parentSessionID: string): boolean; hasConvergenceSignals(taskID: string, threshold?: number): boolean; formatForPrompt(parentSessionID: string, _now?: number): string | undefined; clearParent(parentSessionID: string): void; drop(taskID: string): void; deferIfRunning(_sessionId: string): boolean; retryDeferredClose(_sessionId: string): boolean; clearDeferredClose(_sessionId: string): void; private trimReusable; private formatReusableJob; private nextAlias; } export declare function deriveTaskSessionLabel(input: { description?: string; prompt?: string; agentType: string; }): string; export {};