import { type ToolOutputImage } from '@openai/agents-core'; import { Manifest, type SandboxClient, type SandboxClientCreateArgs, type SandboxClientOptions, type SandboxClientResumeOptions, type SandboxPreservedSessionReuseOptions, type SandboxArchiveLimits, type SandboxConcurrencyLimits, type ExposedPortEndpoint, type ExecCommandArgs, type MaterializeEntryArgs, type ReadFileArgs, type SandboxSession, type SandboxSessionState, type ViewImageArgs, type WriteStdinArgs, type WorkspaceArchiveData, type WorkspaceArchiveOptions } from '@openai/agents-core/sandbox'; import { RemoteSandboxEditor, type RemoteSandboxPathOptions } from '../shared'; type ModalCloudBucketMountLike = { toProto?(mountPath: string): unknown; }; type ModalSecretLike = unknown; type ModalSandboxFilesystemLike = { readBytes(path: string): Promise; writeBytes(data: Uint8Array | ArrayBuffer | Buffer, path: string): Promise; }; type ModalClientLike = { apps: { fromName(name: string, params?: { createIfMissing?: boolean; environment?: string; }): Promise; }; images: { fromRegistry(tag: string): ModalImageLike; fromId?(id: string): ModalImageLike | Promise; delete?(id: string): Promise; }; sandboxes: { create(app: ModalAppLike, image: ModalImageLike, params?: Record): Promise; fromId(id: string): Promise; }; cloudBucketMounts: { create(bucketName: string, params?: Record): ModalCloudBucketMountLike; }; secrets: { fromName(name: string, params?: { environment?: string; }): ModalSecretLike | Promise; fromObject(entries: Record, params?: Record): ModalSecretLike | Promise; }; imageBuilderVersion?(version?: string): string; }; type ModalAppLike = { appId?: string; }; type ModalImageLike = { imageId?: string; objectId?: string; cmd?(command: string[]): ModalImageLike; }; type ModalSandboxSelectorLike = { sandboxId: string; objectId?: string; [key: string]: unknown; }; type ModalSandboxLike = { sandboxId: string; objectId?: string; filesystem: ModalSandboxFilesystemLike; exec(command: string[], params?: Record): Promise; terminate(params?: { wait?: boolean; }): Promise; poll(): Promise; tunnels?(timeoutMs?: number): Promise>; snapshotFilesystem?(timeoutMs?: number): Promise; snapshotDirectory?(path: string): Promise; mountImage?(path: string, image?: ModalImageLike): Promise; }; type ModalTunnelLike = { host?: string; port?: number; }; type ModalContainerProcessLike = { stdin?: { writeText?(text: string): Promise; close?(): Promise; }; stdout: ReadableStream; stderr: ReadableStream; wait(): Promise; }; type ModalCloudBucketMountsProvider = () => Promise | undefined>; export type ModalWorkspacePersistence = 'tar' | 'snapshot_filesystem' | 'snapshot_directory'; export type ModalImageSelectorKind = 'image' | 'id' | 'tag'; export declare class ModalImageSelector { readonly kind: ModalImageSelectorKind; readonly value: ModalImageLike | string; private constructor(); static fromImage(image: ModalImageLike): ModalImageSelector; static fromId(imageId: string): ModalImageSelector; static fromTag(imageTag: string): ModalImageSelector; } export type ModalSandboxSelectorKind = 'sandbox' | 'id'; export declare class ModalSandboxSelector { readonly kind: ModalSandboxSelectorKind; readonly value: ModalSandboxSelectorLike | string; private constructor(); static fromSandbox(sandbox: ModalSandboxSelectorLike): ModalSandboxSelector; static fromId(sandboxId: string): ModalSandboxSelector; } export interface ModalSandboxClientOptions extends SandboxClientOptions { appName: string; image?: ModalImageSelector; sandbox?: ModalSandboxSelector; imageTag?: string; sandboxCreateTimeoutS?: number; workspacePersistence?: ModalWorkspacePersistence; snapshotFilesystemTimeoutMs?: number; snapshotFilesystemRestoreTimeoutMs?: number; env?: Record; timeoutMs?: number; idleTimeoutMs?: number; cpu?: number; cpuLimit?: number; memoryMiB?: number; memoryLimitMiB?: number; gpu?: string; exposedPorts?: number[]; environment?: string; endpoint?: string; tokenId?: string; tokenSecret?: string; imageBuilderVersion?: string; nativeCloudBucketSecretName?: string; useSleepCmd?: boolean; archiveLimits?: SandboxArchiveLimits | null; } export interface ModalSandboxSessionState extends SandboxSessionState { sandboxId?: string; ownsSandbox?: boolean; appName: string; imageId?: string; imageTag: string; sandboxCreateTimeoutS?: number; workspacePersistence: ModalWorkspacePersistence; snapshotFilesystemTimeoutMs?: number; snapshotFilesystemRestoreTimeoutMs?: number; environment: Record; timeoutMs?: number; idleTimeoutMs?: number; cpu?: number; cpuLimit?: number; memoryMiB?: number; memoryLimitMiB?: number; gpu?: string; configuredExposedPorts?: number[]; modalEnvironment?: string; endpoint?: string; imageBuilderVersion?: string; nativeCloudBucketSecretName?: string; useSleepCmd: boolean; } export declare class ModalSandboxSession implements SandboxSession { readonly state: ModalSandboxSessionState; private readonly modal; private readonly app; private readonly cloudBucketMountsProvider?; private cloudBucketMounts?; private cloudBucketMountsResolved; private sandbox; private ownsSandbox; private closed; private closePromise?; private readonly activeProcesses; private readonly remotePathResolver; private readonly concurrencyLimits?; private archiveLimits?; private nextProcessId; constructor(args: { state: ModalSandboxSessionState; modal: ModalClientLike; app: ModalAppLike; sandbox: ModalSandboxLike; ownsSandbox?: boolean; cloudBucketMounts?: Record; cloudBucketMountsProvider?: ModalCloudBucketMountsProvider; concurrencyLimits?: SandboxConcurrencyLimits; archiveLimits?: SandboxArchiveLimits | null; }); setArchiveLimits(limits?: SandboxArchiveLimits | null): void; createEditor(runAs?: string): RemoteSandboxEditor; supportsPty(): boolean; execCommand(args: ExecCommandArgs): Promise; writeStdin(args: WriteStdinArgs): Promise; viewImage(args: ViewImageArgs): Promise; readFile(args: ReadFileArgs): Promise; pathExists(path: string, runAs?: string): Promise; directoryExists(path: string, runAs?: string): Promise; running(): Promise; resolveExposedPort(port: number): Promise; materializeEntry(args: MaterializeEntryArgs): Promise; applyManifest(manifest: Manifest, runAs?: string): Promise; persistWorkspace(): Promise; hydrateWorkspace(data: WorkspaceArchiveData, options?: WorkspaceArchiveOptions): Promise; private persistSnapshotFilesystem; private persistSnapshotDirectory; private nativeSnapshotRequiresTarFallback; private assertExpectedSnapshotPersistence; private restoreSnapshotFilesystem; private restoreSnapshotDirectory; private deleteSnapshotDirectoryImage; private modalImageFromId; private sandboxCreateParams; private resolveCloudBucketMounts; close(): Promise; private closeOnce; private resetActiveProcesses; private manifestMaterializationOptions; private invalidateCloudBucketMounts; shutdown(): Promise; delete(): Promise; private registerActiveProcess; private deleteActiveProcess; resolveAbsolutePath(path?: string): string; resolveRemotePath(path?: string, options?: RemoteSandboxPathOptions): Promise; resolveWorkdir(path?: string): string; ensureDirectory(path: string): Promise; writeSandboxFile(path: string, content: string | Uint8Array): Promise; readSandboxFile(path: string): Promise; removeSandboxPath(path: string): Promise; private runAsCommandRunner; private writer; private archiveIo; private runDirectCommand; } /** * @see {@link https://modal.com/docs/guide/sandboxes | Sandboxes guide}. * @see {@link https://modal.com/docs/guide/sdk-javascript-go | JavaScript and Go SDK guide}. * @see {@link https://modal.com/docs/reference/modal.Sandbox | Sandbox reference}. */ export declare class ModalSandboxClient implements SandboxClient { readonly backendId = "modal"; readonly preservedOwnedSessionReuseRejectionRequiresFreshCreation = true; private readonly options; constructor(options?: Partial); create(args?: SandboxClientCreateArgs | Manifest, manifestOptions?: SandboxClientOptions): Promise; serializeSessionState(state: ModalSandboxSessionState): Promise>; canPersistOwnedSessionState(): boolean; serializedSessionStateRequiresFreshCreationForOptions(state: ModalSandboxSessionState, options?: SandboxClientResumeOptions): boolean; canReusePreservedOwnedSession(state: ModalSandboxSessionState, options?: SandboxPreservedSessionReuseOptions): Promise; rebindPreservedOwnedSessionState(state: ModalSandboxSessionState, options?: SandboxPreservedSessionReuseOptions): void; deserializeSessionState(state: Record): Promise; resume(state: ModalSandboxSessionState, options?: SandboxClientResumeOptions): Promise; } export {};