import { Manifest, type SandboxClient, type SandboxClientCreateArgs, type SandboxClientOptions, type SandboxClientResumeOptions, type SandboxArchiveLimits, type SandboxConcurrencyLimits, type MaterializeEntryArgs, type SandboxSessionSerializationOptions, type SandboxPreservedSessionReuseOptions, type SandboxSessionState, type WorkspaceArchiveData, type WorkspaceArchiveOptions } from '@openai/agents-core/sandbox'; import { RemoteSandboxSessionBase, type RemoteSandboxCommandOptions, type RemoteSandboxCommandResult } from '../shared'; type VercelSandboxRunCommandParams = Record & { cmd: string; args?: string[]; cwd?: string; env?: Record; sudo?: boolean; detached?: boolean; signal?: AbortSignal; }; type VercelSandboxInstance = { sandboxId: string; runCommand(params: VercelSandboxRunCommandParams): Promise; runDetachedCommand(params: VercelSandboxRunCommandParams): Promise; mkDir(path: string): Promise; readFileToBuffer(file: { path: string; cwd?: string; }): Promise; writeFiles(files: { path: string; content: string | Uint8Array; mode?: number; }[]): Promise; domain?(port: number): string; stop?(): Promise; snapshot?(params?: { expiration?: number; }): Promise<{ snapshotId?: string; }>; }; type VercelCommandFinishedLike = { exitCode: number | null; output(stream?: 'stdout' | 'stderr' | 'both', options?: { signal?: AbortSignal; }): Promise; }; type VercelCommandLike = { wait(options?: { signal?: AbortSignal; }): Promise; kill(signal?: 'SIGKILL'): Promise; }; export type VercelWorkspacePersistence = 'tar' | 'snapshot'; export interface VercelSandboxClientOptions extends SandboxClientOptions { /** * Vercel project ID. Per-create or per-resume options override constructor options, which * override `VERCEL_PROJECT_ID`. Credentials are forwarded only when the * resolved `projectId`, `teamId`, and `token` are all non-empty. */ projectId?: string; /** * Vercel team ID. Per-create or per-resume options override constructor options, which * override `VERCEL_TEAM_ID`. Credentials are forwarded only when the * resolved `projectId`, `teamId`, and `token` are all non-empty. */ teamId?: string; /** * Vercel access token. Per-create or per-resume options override constructor options, * which override `VERCEL_TOKEN`. Credentials are forwarded only when the * resolved `projectId`, `teamId`, and `token` are all non-empty; otherwise * authentication is delegated to `@vercel/sandbox`. Create-time tokens are * included in serialized session state; current restoration credentials * remain runtime-only. */ token?: string; runtime?: string; resources?: Record; exposedPorts?: number[]; interactive?: boolean; networkPolicy?: Record; timeoutMs?: number; workspacePersistence?: VercelWorkspacePersistence; archiveLimits?: SandboxArchiveLimits | null; snapshotExpirationMs?: number; env?: Record; /** * @deprecated Use Manifest.withInContainerMountCredentialExposureAcknowledged() * with each exact Vercel mount path instead. */ allowS3CredentialExposure?: boolean; } export interface VercelSandboxSessionState extends SandboxSessionState { sandboxId: string; /** * Whether authentication is explicitly configured or delegated to the SDK. * Missing values identify session state created before this field existed. */ authenticationMode?: 'explicit' | 'sdk'; projectId?: string; teamId?: string; token?: string; runtime?: string; resources?: Record; configuredExposedPorts?: number[]; interactive?: boolean; networkPolicy?: Record; timeoutMs?: number; workspacePersistence: VercelWorkspacePersistence; snapshotExpirationMs?: number; environment: Record; snapshotId?: string; snapshotSandboxId?: string; snapshotSupported?: boolean; } export declare class VercelSandboxSession extends RemoteSandboxSessionBase { #private; private sandbox; private readonly knownDirs; private readonly pendingDirCreates; private closePromise?; private closeCompleted; private mountFailure?; private readonly mountOperationMutex; /** * This provider applies the remote mount simplicity boundary by fixing the * mount set at creation and keeping it only in memory. * * Keep the lifecycle limited to create, tar detach/remount, and close. Do not * add dynamic mutation, persisted mount reconstruction, credential refresh, * or best-effort reconciliation without a trusted provider primitive that * makes those transitions unambiguous. */ private readonly activeMounts; private readonly credentials; constructor(args: { state: VercelSandboxSessionState; sandbox: VercelSandboxInstance; credentials?: Pick; concurrencyLimits?: SandboxConcurrencyLimits; archiveLimits?: SandboxArchiveLimits | null; }); supportsPty(): boolean; protected assertExecRunAs(runAs?: string): void; protected assertFilesystemRunAs(runAs?: string): void; protected resolveManifestForApply(manifest: Manifest): Manifest; protected manifestMetadataSupport(): import("../shared").SandboxManifestMetadataSupport; protected beforeFilesystemMutation(): Promise; protected beforeExecCommand(): Promise; protected beforeMaterializeEntry(args: MaterializeEntryArgs): Promise; protected beforeApplyManifest(manifest: Manifest): Promise; protected runningWorkdir(): string; protected exposedPortSource(): string; protected resolveRemoteExposedPort(requestedPort: number): Promise; materializeInitialManifest(manifest: Manifest): Promise; prepareWorkspaceRoot(): Promise; persistWorkspace(): Promise; hydrateWorkspace(data: WorkspaceArchiveData, options?: WorkspaceArchiveOptions): Promise; close(): Promise; private closeOnce; private closeMountedSandbox; shutdown(): Promise; delete(): Promise; private mountInitialEntry; private assertCanonicalMountPath; private assertCanonicalMountPathDuringTransition; private assertResolvedMountPath; private rollbackInitialMounts; private assertMountSessionUsable; protected assertSessionUsable(): void; private markMountSessionUnusable; private invalidateAfterFailedInitialMount; /** * Runs tar persistence while external bucket files are outside the workspace. * * A failed detach or remount stops the sandbox. This fail-closed boundary is * deliberate: recovery logic must not guess whether a privileged remote * operation completed. */ private withMountsDetached; private withMountsDetachedLocked; private unmountAll; private remountAll; private prepareMountCandidates; private stopAfterMountTransitionFailure; private readonly mountCommand; private mountTransitionArchiveIo; private resolveRemotePathDirect; private resolveRemoteCredentialPathDirect; private runWorkspaceOperation; private runRemoteCommandDirect; private readRemoteFileDirect; private writeRemoteFileDirect; private execShell; private replaceSandboxFromSnapshot; private recoverSandboxAfterSnapshotRestoreFailure; private resolveSnapshotCredentials; private createAndPrepareSandboxFromSnapshot; private createSandboxFromSnapshot; private bindRestoredSandbox; private resetKnownDirs; private markWorkspaceMutated; private clearExposedPortCache; private ensureDir; 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; protected forceTerminateAfterFailedPrivilegedManifestTransition(): Promise; } /** * @see {@link https://vercel.com/docs/vercel-sandbox | Vercel Sandbox overview}. * @see {@link https://vercel.com/docs/vercel-sandbox/sdk-reference | Sandbox SDK reference}. * @see {@link https://vercel.com/docs/vercel-sandbox/working-with-sandbox | Working with Sandbox examples}. */ export declare class VercelSandboxClient implements SandboxClient { readonly backendId = "vercel"; private readonly options; constructor(options?: VercelSandboxClientOptions); resolveTrustedManifestForResume(manifest: Manifest, options?: VercelSandboxClientOptions): Manifest; create(args?: SandboxClientCreateArgs | Manifest, manifestOptions?: VercelSandboxClientOptions): Promise; serializeSessionState(state: VercelSandboxSessionState, options?: SandboxSessionSerializationOptions): Promise>; canPersistOwnedSessionState(state: VercelSandboxSessionState): boolean; canReusePreservedOwnedSession(state: VercelSandboxSessionState, options?: SandboxPreservedSessionReuseOptions): Promise | boolean; private canReuseMountedSession; deserializeSessionState(state: Record): Promise; resume(inputState: VercelSandboxSessionState, options?: SandboxClientResumeOptions): Promise; private resolveSessionCredentials; } export {};