import { SharedSessionBroker } from '../control-plane/index.js';
import type { SharedSessionRecord, SharedSessionSubmission } from '../control-plane/index.js';
import type { RouteBindingManager } from '../channels/index.js';
import type { AutomationJob } from './jobs.js';
import type { AutomationRouteBinding } from './routes.js';
import type { AutomationRun, AutomationRunContinuationMode } from './runs.js';
import type { AutomationSessionTarget } from './session-targets.js';
import type { AutomationRunTrigger } from './types.js';
import type { ConfigManager } from '../config/manager.js';
export interface AutomationManagerExecutionContext {
    readonly configManager: ConfigManager;
    readonly routeBindings: RouteBindingManager;
    readonly sessionBroker: SharedSessionBroker;
    readonly defaultSurfaceKind?: AutomationSessionTarget['surfaceKind'] | undefined;
    readonly defaultSurfaceId?: string | undefined;
    readonly spawnTask: (input: {
        readonly prompt: string;
        readonly modelId?: string | undefined;
        readonly modelProvider?: string | undefined;
        readonly fallbackModels?: readonly string[] | undefined;
        readonly routing?: AutomationRun['execution']['routing'] | undefined;
        readonly executionIntent?: AutomationRun['execution']['executionIntent'] | undefined;
        readonly template?: string | undefined;
        readonly reasoningEffort?: AutomationRun['execution']['reasoningEffort'] | undefined;
        readonly toolAllowlist?: readonly string[] | undefined;
        readonly context?: string | undefined;
    }) => string;
    readonly saveJobs: () => Promise<void>;
    readonly saveRuns: () => Promise<void>;
    readonly pruneRunHistory: (jobId?: string) => void;
    readonly activeRunCount: () => number;
    readonly maxConcurrentRuns: () => number;
    readonly syncExecutionRoute: (job: AutomationJob, run: AutomationRun) => Promise<void>;
    readonly syncRunToRuntime: (run: AutomationRun, source: string) => void;
    readonly syncJobToRuntime: (job: AutomationJob, source: string) => void;
    readonly emitRunQueued: (job: AutomationJob, run: AutomationRun) => void;
    readonly emitRunStarted: (job: AutomationJob, run: AutomationRun) => void;
    readonly emitRunCompleted: (job: AutomationJob, run: AutomationRun, outcome: 'success' | 'partial' | 'failed' | 'cancelled') => void;
    readonly emitRunFailed: (job: AutomationJob, run: AutomationRun, error: string, retryable: boolean) => void;
    readonly maybeDeliverRun: (job: AutomationJob, run: AutomationRun) => void;
    readonly scheduleFailureFollowUp: (job: AutomationJob, run: AutomationRun) => void;
    readonly applyFailureToJob: (job: AutomationJob, timestamp: number, countRun?: boolean) => AutomationJob;
    readonly jobs: Map<string, AutomationJob>;
    readonly runs: Map<string, AutomationRun>;
}
interface ResolvedAutomationExecution {
    readonly task: string;
    readonly continuationMode: AutomationRunContinuationMode;
    readonly session?: SharedSessionRecord | undefined;
    readonly route?: AutomationRouteBinding | undefined;
    readonly agentId?: string | undefined;
    readonly target: AutomationSessionTarget;
    readonly executionIntent: AutomationRun['executionIntent'];
    readonly updatedJob?: AutomationJob | undefined;
}
export declare function executeAutomationJob(context: AutomationManagerExecutionContext, job: AutomationJob, trigger: AutomationRunTrigger, dueRun: boolean, attempt?: number): Promise<AutomationRun>;
export declare function resolveAutomationExecution(context: AutomationManagerExecutionContext, job: AutomationJob, prompt: string, trigger: AutomationRunTrigger): Promise<ResolvedAutomationExecution>;
export declare function resolveSharedSessionExecution(context: AutomationManagerExecutionContext, job: AutomationJob, prompt: string, trigger: AutomationRunTrigger, input: {
    readonly sessionId?: string | undefined;
    readonly routeId?: string | undefined;
    readonly target: AutomationSessionTarget;
    readonly updatedJob?: AutomationJob | undefined;
}): Promise<ResolvedAutomationExecution>;
export declare function toResolvedExecution(job: AutomationJob, target: AutomationSessionTarget, submission: SharedSessionSubmission, updatedJob?: AutomationJob): ResolvedAutomationExecution;
export declare function resolveRouteForTarget(context: AutomationManagerExecutionContext, target: AutomationSessionTarget, job: AutomationJob): AutomationRouteBinding | undefined;
export declare function syncExecutionRoute(context: AutomationManagerExecutionContext, job: AutomationJob, run: AutomationRun): Promise<void>;
export declare function applyFailureToJob(job: AutomationJob, timestamp: number, countRun?: boolean): AutomationJob;
export {};
//# sourceMappingURL=manager-runtime-execution.d.ts.map