import type { ToolApprovalRequest, ToolApprovalUserDecision } from '../../../core/approvals/index.js';
import type { ControlPlaneAcceptedSessionRun } from '../../../server/control-plane-types.js';
export type ControlPlaneSessionRunAddress = {
    workspaceId: string;
    sessionId: string;
};
export type PendingControlPlaneApproval = {
    approval: ToolApprovalRequest;
    resolve: (decision: ToolApprovalUserDecision) => void;
};
export type ControlPlaneSessionRunContext = {
    runId: string;
    acceptedAt: string;
    controller: AbortController;
};
type StartControlPlaneSessionRunInput<Result> = {
    address: ControlPlaneSessionRunAddress;
    onAccepted?: (run: ControlPlaneSessionRunContext) => void;
    onHeartbeat?: (run: ControlPlaneSessionRunContext) => void | Promise<void>;
    execute: (run: ControlPlaneSessionRunContext) => Promise<Result>;
    onError?: (error: unknown, run: ControlPlaneSessionRunContext) => void | Promise<void>;
    onSettled?: (run: ControlPlaneSessionRunContext) => void | Promise<void>;
};
/**
 * Owns control-plane run coordination for session-scoped long-running work.
 *
 * Core chat services own persisted conversation semantics. This service owns
 * process-local runtime coordination: in-flight runs, abort controllers,
 * approval resolvers, and the async-start vs wait-for-result split.
 */
export declare class ControlPlaneSessionRunService {
    private readonly pendingApprovals;
    private readonly inFlightRuns;
    start<Result>(input: StartControlPlaneSessionRunInput<Result>): ControlPlaneAcceptedSessionRun;
    startAndWait<Result>(input: StartControlPlaneSessionRunInput<Result>): Promise<Result>;
    isRunning(address: ControlPlaneSessionRunAddress): boolean;
    cancelRun(address: ControlPlaneSessionRunAddress): boolean;
    getPendingApproval(address: ControlPlaneSessionRunAddress): ToolApprovalRequest | undefined;
    storePendingApproval(address: ControlPlaneSessionRunAddress, pending: PendingControlPlaneApproval): void;
    clearPendingApproval(address: ControlPlaneSessionRunAddress): void;
    resolvePendingApproval(address: ControlPlaneSessionRunAddress, decision: ToolApprovalUserDecision): boolean;
    private requireRun;
    private static addressKey;
    private startHeartbeat;
}
export {};
//# sourceMappingURL=session-run-service.d.ts.map