import { Manifest, type SandboxClient, type SandboxClientCreateArgs, type SandboxClientOptions, type SandboxPreservedSessionReuseOptions, type SandboxArchiveLimits, type SandboxConcurrencyLimits, type ExposedPortEndpoint, type ExecCommandArgs, type Mount, type SandboxSessionLifecycleOptions, type SandboxSessionState, type TypedMount, type WriteStdinArgs, type WorkspaceArchiveData, type WorkspaceArchiveOptions } from '@openai/agents-core/sandbox'; import { RemoteSandboxSessionBase, type RemoteSandboxCommandOptions, type RemoteSandboxCommandResult, type ManifestMountMaterializationContext } from '../shared'; import { validateRcloneMountEnvironmentCredentialExposure } from '../shared/inContainerMounts'; type E2BSandboxInstance = { sandboxId: string; files: E2BFilesystemApi; commands: E2BCommandsApi; pty?: E2BPtyApi; getHost?(port: number): string | Promise; createSnapshot?(): Promise<{ snapshotId?: string; }>; kill(): Promise; pause?(): Promise; }; type E2BFilesystemApi = { write(path: string | { path: string; data: string | Uint8Array; }[], data?: string | Uint8Array): Promise; read?(path: string, opts?: { format?: 'text' | 'bytes'; }): Promise; remove?(path: string): Promise; makeDir?(path: string): Promise; }; type E2BCommandResult = { stdout?: string; stderr?: string; exitCode?: number | null; error?: string; }; type E2BCommandHandle = E2BCommandResult & { pid: number; wait?(): Promise; kill?(): Promise; disconnect?(): Promise; }; type E2BCommandsApi = { run(command: string, opts?: { background?: boolean; cwd?: string; envs?: Record; user?: string; timeoutMs?: number; onStdout?: (data: string) => void | Promise; onStderr?: (data: string) => void | Promise; stdin?: boolean; }): Promise; }; type E2BPtyApi = { create(opts: { cols?: number; rows?: number; size?: { cols: number; rows: number; }; cwd?: string; envs?: Record; timeoutMs?: number; onData?: (data: Uint8Array) => void | Promise; }): Promise; sendInput?(pid: number, data: Uint8Array, opts?: Record): Promise; kill?(pid: number, opts?: Record): Promise; }; export type E2BSandboxType = 'e2b' | 'e2b_code_interpreter'; export type E2BWorkspacePersistence = true | 'tar' | 'snapshot'; export type E2BTimeoutAction = 'pause' | 'kill'; export interface E2BSandboxClientOptions extends SandboxClientOptions { sandboxType?: E2BSandboxType; template?: string; timeout?: number; commandTimeoutMs?: number; requestTimeoutMs?: number; connectionTimeoutMs?: number; onTimeout?: E2BTimeoutAction; timeoutAction?: E2BTimeoutAction; autoResume?: boolean; metadata?: Record; secure?: boolean; allowInternetAccess?: boolean; exposedPorts?: number[]; workspacePersistence?: E2BWorkspacePersistence; archiveLimits?: SandboxArchiveLimits | null; mcp?: Record; pauseOnExit?: boolean; env?: Record; } export interface E2BSandboxSessionState extends SandboxSessionState { sandboxId: string; template?: string; sandboxType: E2BSandboxType; timeout?: number; commandTimeoutMs?: number; requestTimeoutMs?: number; connectionTimeoutMs?: number; onTimeout?: E2BTimeoutAction; timeoutAction?: E2BTimeoutAction; autoResume?: boolean; metadata?: Record; secure?: boolean; allowInternetAccess?: boolean; configuredExposedPorts?: number[]; workspacePersistence?: E2BWorkspacePersistence; mcp?: Record; pauseOnExit: boolean; pauseOnExitSupported?: boolean; environment: Record; } export declare class E2BSandboxSession extends RemoteSandboxSessionBase { private sandbox; private readonly ptyProcesses; private readonly activeMountPaths; constructor(args: { state: E2BSandboxSessionState; sandbox: E2BSandboxInstance; concurrencyLimits?: SandboxConcurrencyLimits; archiveLimits?: SandboxArchiveLimits | null; }); supportsPty(): boolean; writeStdin(args: WriteStdinArgs): Promise; protected execPtyCommand(args: ExecCommandArgs): Promise; protected exposedPortSource(): string; protected resolveRemoteExposedPort(requestedPort: number): Promise; prepareWorkspaceRoot(): Promise; persistWorkspace(): Promise; hydrateWorkspace(data: WorkspaceArchiveData, options?: WorkspaceArchiveOptions): Promise; private persistWorkspaceViaNativeSnapshot; private nativeSnapshotRequiresTarFallback; private replaceSandboxFromSnapshot; close(): Promise; shutdown(options?: SandboxSessionLifecycleOptions): Promise; delete(options?: SandboxSessionLifecycleOptions): Promise; private shouldPauseOnCleanup; private pauseOrKillAfterPauseFailure; protected assertExecRunAs(_runAs?: string): void; protected assertFilesystemRunAs(_runAs?: string): void; protected manifestMetadataSupport(): import("../shared").SandboxManifestMetadataSupport; protected manifestMaterializationOptions(): { materializeMount: (absolutePath: string, entry: Mount | TypedMount, context: ManifestMountMaterializationContext) => Promise; validateManifest: typeof validateRcloneMountEnvironmentCredentialExposure; }; protected forceTerminateAfterFailedPrivilegedManifestTransition(): Promise; protected afterManifestMutationCommitted(materializedManifest: Manifest): void; protected runRemoteCommand(command: string, options: RemoteSandboxCommandOptions): Promise; protected mkdirRemote(path: string): Promise; protected readRemoteText(path: string): Promise; protected readRemoteFile(path: string): Promise; protected writeRemoteFile(path: string, content: string | Uint8Array): Promise; protected deleteRemotePath(path: string): Promise; private ensureDirectory; private removeSandboxPath; private materializeMountEntry; private unmountActiveMounts; private mountCommandRunner; private runCommandForStatus; private commandTimeoutMs; } /** * @see {@link https://e2b.dev/docs | E2B docs}. * @see {@link https://e2b.dev/docs/sdk-reference/js-sdk/v2.8.0/sandbox | JavaScript SDK Sandbox reference}. * @see {@link https://e2b.dev/docs/sdk-reference/code-interpreter-js-sdk/v2.3.2/sandbox | Code Interpreter JavaScript SDK Sandbox reference}. */ export declare class E2BSandboxClient implements SandboxClient { readonly backendId = "e2b"; private readonly options; constructor(options?: E2BSandboxClientOptions); create(args?: SandboxClientCreateArgs | Manifest, manifestOptions?: E2BSandboxClientOptions): Promise; serializeSessionState(state: E2BSandboxSessionState): Promise>; canPersistOwnedSessionState(state: E2BSandboxSessionState): boolean; canReusePreservedOwnedSession(state: E2BSandboxSessionState, options?: SandboxPreservedSessionReuseOptions): Promise; deserializeSessionState(state: Record): Promise; resume(state: E2BSandboxSessionState): Promise; } export {};