import { Agent, type AgentConfig, type AgentResult, type ToolApprovalRequest, type ToolApprovalResult } from "@clinebot/agents";
import type { LlmsProviders } from "@clinebot/llms";
import { type ITelemetryService } from "@clinebot/shared";
import type { RuntimeBuilder } from "../runtime/session-runtime";
import { ProviderSettingsManager } from "../storage/provider-settings-manager";
import { type ToolExecutors } from "../tools";
import type { CoreSessionEvent } from "../types/events";
import type { SessionRecord } from "../types/sessions";
import type { FileSessionService } from "./file-session-service";
import type { RpcCoreSessionService } from "./rpc-session-service";
import { RuntimeOAuthTokenManager } from "./runtime-oauth-token-manager";
import type { SendSessionInput, SessionAccumulatedUsage, SessionManager, StartSessionInput, StartSessionResult } from "./session-manager";
import type { CoreSessionService } from "./session-service";
type SessionBackend = CoreSessionService | RpcCoreSessionService | FileSessionService;
export interface DefaultSessionManagerOptions {
    distinctId: string;
    sessionService: SessionBackend;
    runtimeBuilder?: RuntimeBuilder;
    createAgent?: (config: AgentConfig) => Agent;
    defaultToolExecutors?: Partial<ToolExecutors>;
    toolPolicies?: AgentConfig["toolPolicies"];
    providerSettingsManager?: ProviderSettingsManager;
    oauthTokenManager?: RuntimeOAuthTokenManager;
    telemetry?: ITelemetryService;
    requestToolApproval?: (request: ToolApprovalRequest) => Promise<ToolApprovalResult>;
}
export declare class DefaultSessionManager implements SessionManager {
    private readonly sessionService;
    private readonly runtimeBuilder;
    private readonly createAgentInstance;
    private readonly defaultToolExecutors?;
    private readonly defaultToolPolicies?;
    private readonly providerSettingsManager;
    private readonly oauthTokenManager;
    private readonly defaultTelemetry?;
    private readonly defaultRequestToolApproval?;
    private readonly listeners;
    private readonly sessions;
    private readonly usageBySession;
    private readonly subAgentStarts;
    constructor(options: DefaultSessionManagerOptions);
    start(input: StartSessionInput): Promise<StartSessionResult>;
    send(input: SendSessionInput): Promise<AgentResult | undefined>;
    getAccumulatedUsage(sessionId: string): Promise<SessionAccumulatedUsage | undefined>;
    abort(sessionId: string, reason?: unknown): Promise<void>;
    stop(sessionId: string): Promise<void>;
    dispose(reason?: string): Promise<void>;
    get(sessionId: string): Promise<SessionRecord | undefined>;
    list(limit?: number): Promise<SessionRecord[]>;
    delete(sessionId: string): Promise<boolean>;
    readTranscript(sessionId: string, maxChars?: number): Promise<string>;
    readMessages(sessionId: string): Promise<LlmsProviders.Message[]>;
    readHooks(sessionId: string, limit?: number): Promise<unknown[]>;
    subscribe(listener: (event: CoreSessionEvent) => void): () => void;
    updateSessionModel(sessionId: string, modelId: string): Promise<void>;
    private runTurn;
    private executeAgentTurn;
    private prepareTurnInput;
    private ensureSessionPersisted;
    private finalizeSingleRun;
    private failSession;
    private shutdownSession;
    private updateStatus;
    private handlePluginEvent;
    private enqueuePendingPrompt;
    private drainPendingPrompts;
    private onAgentEvent;
    private emitPendingPrompts;
    private emitPendingPromptSubmitted;
    private createSpawnTool;
    private handleTeamEvent;
    private runWithAuthRetry;
    private syncOAuthCredentials;
    private getSessionOrThrow;
    private resolveAbsoluteFilePaths;
    private updateAgentConnection;
    private emitStatus;
    private emit;
    private listRows;
    private getRow;
    private invoke;
    private invokeOptional;
    private invokeOptionalValue;
}
export {};
