import type { Agent, AgentOutputType } from '../../agent';
import type { RunState } from '../../runState';
import type { AgentInputItem } from '../../types';
import type { Span, Trace } from '../../tracing';
import { Manifest } from '../manifest';
import type { SandboxSessionLike, SandboxSessionState } from '../session';
import type { Memory } from '../capabilities/memory';
import { type MemoryRolloutIdentity } from './rollouts';
export type SandboxMemoryAgentRunner = (agent: Agent<any, any>, input: string, options: {
    sandbox: {
        session: SandboxSessionLike<SandboxSessionState>;
        manifest?: Manifest;
    };
    maxTurns?: number;
}) => Promise<{
    finalOutput: unknown;
}>;
export declare function getOrCreateSandboxMemoryGenerationManager(args: {
    session: SandboxSessionLike<SandboxSessionState>;
    memory: Memory;
    runAs?: string;
    runAgent: SandboxMemoryAgentRunner;
    tracingParent?: Span<any> | Trace;
}): SandboxMemoryGenerationManager;
export declare class SandboxMemoryGenerationManager {
    private readonly session;
    private readonly memory;
    private runAs?;
    private runAgent;
    private tracingParent?;
    private readonly storage;
    private readonly pendingRolloutIds;
    private flushPromise?;
    private stopped;
    private unregisterPreStopHook?;
    constructor(args: {
        session: SandboxSessionLike<SandboxSessionState>;
        memory: Memory;
        runAs?: string;
        runAgent: SandboxMemoryAgentRunner;
        tracingParent?: Span<any> | Trace;
    });
    isStopped(): boolean;
    updateRuntimeContext(args: {
        runAs?: string;
        runAgent: SandboxMemoryAgentRunner;
        tracingParent?: Span<any> | Trace;
    }): void;
    enqueueState<TContext>(state: RunState<TContext, Agent<TContext, AgentOutputType>>, args: {
        exception?: unknown;
        inputOverride?: string | AgentInputItem[];
        rolloutIdentity: Omit<MemoryRolloutIdentity, 'fallbackId'>;
    }): Promise<void>;
    flush(): Promise<void>;
    private flushOnce;
    private runPhaseOne;
    private persistPhaseOneArtifacts;
    private runPhaseTwo;
    private currentManifest;
    private unregister;
}
