import type { Logger } from 'pino';
import { type AutopilotProfile, type ToolApprovalRequest, type ToolApprovalUserDecision } from '../../../../core/approvals/index.js';
import type { ConversationEngineConfig, UpdateConversationSessionSettingsInput } from '../../../../core/chat/engine/types.js';
import type { ChatSessionLeaseOwner } from '../../../../core/chat/engine/sessions/leases/index.js';
import type { ChatSession } from '../../../../core/chat/types.js';
import type { ChatSessionDetail, ChatSessionView, ChatTurnReview, ControlPlaneAcceptedSessionRun, ControlPlaneSessionEventEnvelope, ControlPlaneSessionLiveEvent, ControlPlaneSessionsEventEnvelope } from '../../../../server/control-plane-types.js';
type ControlPlaneSessionReadArgs = Omit<ConversationEngineConfig, 'model' | 'workspaceId'> & {
    model?: string;
    sessionStoragePath: string;
    workspaceId: string;
    autopilot?: AutopilotProfile;
};
type CreateControlPlaneChatSessionArgs = ControlPlaneSessionReadArgs & {
    suggestedName?: string;
    retention?: ChatSession['retention'];
};
type UpdateControlPlaneChatSessionSettingsArgs = ControlPlaneSessionReadArgs & {
    sessionId: string;
    settings: UpdateConversationSessionSettingsInput;
};
type RenameControlPlaneChatSessionArgs = ControlPlaneSessionReadArgs & {
    sessionId: string;
    name: string;
};
type UpdatePinnedControlPlaneChatSessionArgs = ControlPlaneSessionReadArgs & {
    sessionId: string;
    pinned: boolean;
};
type UpdateArchivedControlPlaneChatSessionArgs = ControlPlaneSessionReadArgs & {
    sessionId: string;
    archived: boolean;
};
type DeleteControlPlaneChatSessionArgs = ControlPlaneSessionReadArgs & ControlPlaneSessionAddress & {
    leaseOwner: ChatSessionLeaseOwner;
};
type ResetControlPlaneChatSessionArgs = ControlPlaneSessionReadArgs & ControlPlaneSessionAddress & {
    leaseOwner: ChatSessionLeaseOwner;
};
type CompactControlPlaneChatSessionArgs = ControlPlaneSessionReadArgs & ControlPlaneSessionAddress & {
    force?: boolean;
    leaseOwner: ChatSessionLeaseOwner;
};
type SubmitChatPromptArgs = ControlPlaneSessionReadArgs & {
    sessionId: string;
    prompt: string;
    maxSteps?: number;
    searchIgnoreDirs?: string[];
    includePlanTool?: boolean;
    leaseOwner: ChatSessionLeaseOwner;
    logger?: Pick<Logger, 'debug'>;
};
type ContinueChatPromptArgs = Omit<SubmitChatPromptArgs, 'prompt'>;
type SubmitDirectShellArgs = ControlPlaneSessionReadArgs & ControlPlaneSessionAddress & {
    command: string;
    riskAccepted?: boolean;
    systemContext?: string;
    apiKey?: string;
    preferApiKey?: boolean;
    leaseOwner: ChatSessionLeaseOwner;
    logger?: Pick<Logger, 'debug'>;
};
type UpdateQueuedChatPromptArgs = ControlPlaneSessionReadArgs & ControlPlaneSessionAddress & {
    queueItemId: string;
    prompt: string;
};
type DeleteQueuedChatPromptArgs = ControlPlaneSessionReadArgs & ControlPlaneSessionAddress & {
    queueItemId: string;
};
export declare class ControlPlaneChatSessionsController {
    private readonly sessionEventBus;
    private readonly runService;
    createSession(args: CreateControlPlaneChatSessionArgs): ChatSessionDetail;
    updateSettings(args: UpdateControlPlaneChatSessionSettingsArgs): ChatSessionDetail;
    renameSession(args: RenameControlPlaneChatSessionArgs): ChatSessionDetail;
    updatePinned(args: UpdatePinnedControlPlaneChatSessionArgs): ChatSessionDetail;
    updateArchived(args: UpdateArchivedControlPlaneChatSessionArgs): ChatSessionDetail;
    deleteSession(args: DeleteControlPlaneChatSessionArgs): {
        deleted: boolean;
    };
    resetSession(args: ResetControlPlaneChatSessionArgs): ChatSessionDetail;
    compactSession(args: CompactControlPlaneChatSessionArgs): Promise<ChatSessionDetail>;
    readRunState(sessionAddress: ControlPlaneSessionAddress): {
        running: boolean;
        pendingApproval: ToolApprovalRequest | null;
    };
    submitPrompt(args: SubmitChatPromptArgs): Promise<{
        outcome: string;
        summary: string;
        session: ChatSessionDetail;
    }>;
    submitPromptAsync(args: SubmitChatPromptArgs): ControlPlaneAcceptedSessionRun;
    submitDirectShellAsync(args: SubmitDirectShellArgs): ControlPlaneAcceptedSessionRun;
    preflightDirectShell(command: string): import("../../../../core/chat/engine/direct-shell/index.js").ConversationDirectShellPreflight;
    updateQueuedPrompt(args: UpdateQueuedChatPromptArgs): ChatSessionDetail;
    deleteQueuedPrompt(args: DeleteQueuedChatPromptArgs): ChatSessionDetail;
    continuePrompt(args: ContinueChatPromptArgs): Promise<{
        outcome: string;
        summary: string;
        session: ChatSessionDetail;
    }>;
    subscribeToEvents(sessionAddress: ControlPlaneSessionAddress, listener: (event: ControlPlaneSessionLiveEvent | Extract<ControlPlaneSessionEventEnvelope, {
        type: 'session.approval.updated';
    }>) => void): () => void;
    subscribeLiveEvents(args: {
        workspaceId: string;
        stateRoot: string;
        sessionId: string;
        signal?: AbortSignal;
    }): AsyncGenerator<ControlPlaneSessionEventEnvelope>;
    subscribeSessionListEvents(args: {
        stateRoot: string;
        signal?: AbortSignal;
    }): AsyncGenerator<ControlPlaneSessionsEventEnvelope>;
    getPendingApproval(sessionAddress: ControlPlaneSessionAddress): ToolApprovalRequest | undefined;
    isRunning(sessionAddress: ControlPlaneSessionAddress): boolean;
    cancelRun(sessionAddress: ControlPlaneSessionAddress): boolean;
    resolvePendingApproval(sessionAddress: ControlPlaneSessionAddress, decision: ToolApprovalUserDecision): boolean;
    readViews(args: ControlPlaneSessionReadArgs): ChatSessionView[];
    readDetail(args: ControlPlaneSessionReadArgs, id: string): ChatSessionDetail | undefined;
    readTurnReview(args: ControlPlaneSessionReadArgs, sessionId: string, turnId: string): ChatTurnReview | undefined;
    resolveFilePath(stateRoot: string, sessionId: string): string;
    private startPromptRun;
    private enqueuePrompt;
    private hasQueuedPrompts;
    private startNextQueuedPrompt;
    private publishQueueUpdated;
    private buildSubmitPromptRun;
    private buildContinuePromptRun;
    private buildDirectShellRun;
    private runEngineTurn;
    private persistRunFailureMessage;
    private scheduleAutoRenameAfterFirstUserMessage;
    private createSessionTitleLlm;
    private createEngine;
    private createApprovalPolicies;
    private createEngineHost;
    private createApprovalService;
    private applyPendingApprovalProfileDecision;
    private assertNoActiveRun;
    private assertNoLeaseConflict;
    private runFakeBrowserIntegrationSessionPrompt;
    private emitBrowserIntegrationStreamPreview;
    private resolveSessionCreationModel;
    private firstNonEmpty;
    static sessionAddressKey(address: ControlPlaneSessionAddress): string;
}
type ControlPlaneSessionAddress = {
    workspaceId: string;
    sessionId: string;
};
export declare const controlPlaneChatSessionsController: ControlPlaneChatSessionsController;
export {};
//# sourceMappingURL=chat-sessions-controller.d.ts.map