import type { Agent, AgentOutputType } from '../../agent';
import type { RunState } from '../../runState';
import type { AgentInputItem } from '../../types';
import type { Span, Trace } from '../../tracing';
import type { SandboxRunConfig } from '../client';
import { type SandboxMemoryAgentRunner } from '../memory/generation';
import { type SandboxRuntimeModel } from './agentPreparation';
type SandboxPreparedAgent<TContext> = {
    executionAgent: Agent<TContext, AgentOutputType>;
    turnInput: AgentInputItem[];
};
export declare class SandboxRuntimeManager<TContext> {
    private readonly sandboxConfig?;
    private readonly workspaceScope;
    private readonly runState?;
    private readonly agentKeys;
    private readonly agentsByKey;
    private readonly acquiredAgents;
    private readonly sessionsByAgent;
    private readonly sessionsByAgentKey;
    private readonly sessionAgentNamesByKey;
    private readonly preparedAgents;
    private readonly preparedSessions;
    private readonly preparedManifestSignatures;
    private readonly ownedSessionAgentKeys;
    private readonly sessionStartPromises;
    private activeMemory?;
    private currentAgentId?;
    constructor(args: {
        startingAgent: Agent<TContext, AgentOutputType>;
        sandboxConfig?: SandboxRunConfig;
        runState?: RunState<TContext, Agent<TContext, AgentOutputType>>;
    });
    prepareAgent(args: {
        currentAgent: Agent<TContext, AgentOutputType>;
        turnInput: AgentInputItem[];
        runConfigModel?: SandboxRuntimeModel;
        tracingParent?: Span<any> | Trace;
    }): Promise<SandboxPreparedAgent<TContext>>;
    cleanup(state: RunState<TContext, Agent<TContext, AgentOutputType>>, options?: {
        preserveOwnedSessions?: boolean;
        tracingParent?: Span<any> | Trace;
    }): Promise<void>;
    private planCleanup;
    private planCleanupForActiveSessions;
    private planCleanupForSerializedStateOnly;
    private executeCleanupPlan;
    private closeLivePreservedOwnedSessions;
    private runPreStopHooksBeforeRelease;
    enqueueMemoryGeneration(state: RunState<TContext, Agent<TContext, AgentOutputType>>, args: {
        exception?: unknown;
        groupId?: string;
        inputOverride?: string | AgentInputItem[];
        sdkSessionId?: () => Promise<string | undefined>;
        runAgent: SandboxMemoryAgentRunner;
        tracingParent?: Span<any> | Trace;
    }): Promise<void>;
    adoptPreservedOwnedSessions(tracingParent?: Span<any> | Trace): Promise<boolean>;
    private acquireAgent;
    private ensureSession;
    private applyArchiveLimits;
    private registerSessionForAgent;
    private ensureSessionStarted;
    private getPreparedAgent;
    private ensureWorkspaceScopeAccessible;
    private resumeSessionForAgent;
    private prepareExplicitSessionStateForResume;
    private inspectLivePreservedOwnedSessionReuse;
    private discardLiveSessionWithChangedMountAuthority;
    private detachSessionAliases;
    private invalidateSerializedSession;
    private markSerializedSessionsRequireFreshCreation;
    private invalidateSerializedSessions;
    private prepareRejectedLiveSessionReplacement;
    private replaceRejectedLiveSession;
    private serializeState;
    private requireClient;
    private resolveSnapshotSpec;
    private agentKey;
    private allocateRuntimeAgentKey;
    private resolveConfiguredManifest;
    private resolveTrustedManifestForAgentKey;
    private closeOwnedSessions;
    private releaseAgents;
}
export {};
