import type { ApplyPatchOperation, ToolOutputImage } from '@openai/agents-core'; import type { Entry, ExecCommandArgs, ExposedPortEndpoint, ListDirectoryArgs, ReadFileArgs, SandboxArchiveLimits, SandboxConcurrencyLimits, SandboxGroup, SandboxPathGrant, SandboxSessionLifecycleOptions, SandboxSessionSerializationOptions, SandboxSessionState, SandboxUser, SerializedEnvValueReference, Snapshot, SnapshotSpec, ViewImageArgs, WriteStdinArgs } from '@openai/agents-core/sandbox'; import { Manifest } from '@openai/agents-core/sandbox'; export declare const SANDBOX_CLIENT_CREATE_SUFFIX = "-sandbox-client-create"; export declare const SANDBOX_CLIENT_RESUME_SUFFIX = "-sandbox-client-resume"; export declare const SANDBOX_CLIENT_DELETE_SUFFIX = "-sandbox-client-delete"; export declare const SANDBOX_CLIENT_SERIALIZE_SESSION_STATE_SUFFIX = "-sandbox-client-serialize-session-state"; export declare const SANDBOX_SESSION_START_SUFFIX = "-sandbox-session-start"; export declare const SANDBOX_SESSION_RUNNING_SUFFIX = "-sandbox-session-running"; export declare const SANDBOX_SESSION_STOP_SUFFIX = "-sandbox-session-stop"; export declare const SANDBOX_SESSION_SHUTDOWN_SUFFIX = "-sandbox-session-shutdown"; export declare const SANDBOX_SESSION_DELETE_SUFFIX = "-sandbox-session-delete"; export declare const SANDBOX_SESSION_EXEC_SUFFIX = "-sandbox-session-exec"; export declare const SANDBOX_SESSION_EXEC_COMMAND_SUFFIX = "-sandbox-session-exec-command"; export declare const SANDBOX_SESSION_WRITE_STDIN_SUFFIX = "-sandbox-session-write-stdin"; export declare const SANDBOX_SESSION_VIEW_IMAGE_SUFFIX = "-sandbox-session-view-image"; export declare const SANDBOX_SESSION_READ_FILE_SUFFIX = "-sandbox-session-read-file"; export declare const SANDBOX_SESSION_LIST_DIR_SUFFIX = "-sandbox-session-list-dir"; export declare const SANDBOX_SESSION_PATH_EXISTS_SUFFIX = "-sandbox-session-path-exists"; export declare const SANDBOX_SESSION_MATERIALIZE_ENTRY_SUFFIX = "-sandbox-session-materialize-entry"; export declare const SANDBOX_SESSION_APPLY_MANIFEST_SUFFIX = "-sandbox-session-apply-manifest"; export declare const SANDBOX_SESSION_PERSIST_WORKSPACE_SUFFIX = "-sandbox-session-persist-workspace"; export declare const SANDBOX_SESSION_HYDRATE_WORKSPACE_SUFFIX = "-sandbox-session-hydrate-workspace"; export declare const SANDBOX_SESSION_RESOLVE_EXPOSED_PORT_SUFFIX = "-sandbox-session-resolve-exposed-port"; export declare const SANDBOX_EDITOR_CREATE_FILE_SUFFIX = "-sandbox-editor-create-file"; export declare const SANDBOX_EDITOR_UPDATE_FILE_SUFFIX = "-sandbox-editor-update-file"; export declare const SANDBOX_EDITOR_DELETE_FILE_SUFFIX = "-sandbox-editor-delete-file"; /** Span label for a sandbox Activity, e.g. `-sandbox-session-exec` -> `sandbox:session-exec`. */ export declare function sandboxSpanName(activitySuffix: string): string; /** * Binary file contents are base64-encoded as `{ type: 'base64', data }`. Ephemeral * entries and environment values are preserved, so they reach the backend and appear in history. * An environment value built by `workerEnvValue` travels as the reference itself, never its value. */ export interface EncodedManifest { version: number; root: string; entries: Record; environment: Record; users: SandboxUser[]; groups: SandboxGroup[]; extraPathGrants: SandboxPathGrant[]; remoteMountCommandAllowlist: string[]; } export interface EncodedEnvValue { value: string; ephemeral?: boolean; description?: string; } /** * The serializable sandbox-session handle that crosses the Workflow/Activity * boundary. Holds only identifiers, the encoded manifest, and the real client's * own serialized state — never workspace bytes. */ export interface SerializedSandboxSessionState { /** Worker-side session-cache key, assigned when the session is created. */ sessionId: string; manifest: EncodedManifest; snapshot?: Snapshot | null; snapshotFingerprint?: string | null; snapshotFingerprintVersion?: string | null; workspaceReady?: boolean; exposedPorts?: Record; /** Output of the real client's `serializeSessionState`. */ providerState: Record; } /** Workflow-side session state: the serialized handle with a live `Manifest`. */ export interface TemporalSandboxSessionState extends SandboxSessionState { sessionId: string; providerState: Record; } export interface SandboxSessionResult { state: SerializedSandboxSessionState; supportsPty: boolean; } export interface SandboxCreateSessionInput { manifest?: EncodedManifest; snapshot?: SnapshotSpec; options?: Record; concurrencyLimits?: SandboxConcurrencyLimits; archiveLimits?: SandboxArchiveLimits | null; } export interface SandboxResumeSessionInput { state: SerializedSandboxSessionState; archiveLimits?: SandboxArchiveLimits | null; } export interface SandboxSessionStateInput { state: SerializedSandboxSessionState; } export interface SandboxSerializeSessionStateInput extends SandboxSessionStateInput { options?: SandboxSessionSerializationOptions; } export interface SandboxLifecycleInput extends SandboxSessionStateInput { options?: SandboxSessionLifecycleOptions; } export interface SandboxExecInput extends SandboxSessionStateInput { args: ExecCommandArgs; } export interface SandboxWriteStdinInput extends SandboxSessionStateInput { args: WriteStdinArgs; } export interface SandboxViewImageInput extends SandboxSessionStateInput { args: ViewImageArgs; } export interface SandboxReadFileInput extends SandboxSessionStateInput { args: ReadFileArgs; } export interface SandboxListDirInput extends SandboxSessionStateInput { args: ListDirectoryArgs; } export interface SandboxPathExistsInput extends SandboxSessionStateInput { path: string; runAs?: string; } export interface SandboxMaterializeEntryInput extends SandboxSessionStateInput { path: string; entry: unknown; runAs?: string; } export interface SandboxApplyManifestInput extends SandboxSessionStateInput { manifest: EncodedManifest; runAs?: string; } export interface SandboxPersistWorkspaceInput extends SandboxSessionStateInput { archiveLimits?: SandboxArchiveLimits | null; } /** Archive bytes travel as a separate top-level Activity argument. */ export interface SandboxHydrateWorkspaceInput extends SandboxSessionStateInput { archiveLimits?: SandboxArchiveLimits | null; } export interface SandboxResolveExposedPortInput extends SandboxSessionStateInput { port: number; } export interface SandboxEditorInput extends SandboxSessionStateInput { operation: ApplyPatchOperation; runAs?: string; } export interface SerializedToolOutputImage { output: ToolOutputImage; /** Set when the original `image.data` was binary and base64-encoded for transport. */ imageDataBase64?: boolean; } export declare function bytesToBase64(bytes: Uint8Array): string; export declare function base64ToBytes(value: string): Uint8Array; export declare function encodeEntry(entry: Entry): unknown; export declare function decodeEntry(entry: unknown): Entry; /** * Used instead of the SDK's own serializer because the SDK's * `@openai/agents-core/sandbox/internal` barrel imports Node built-ins and * cannot be bundled into the Workflow isolate. */ export declare function encodeManifest(manifest: Manifest): EncodedManifest; export declare function decodeManifest(encoded: EncodedManifest, resolvableWorkerEnvVars?: readonly string[]): Manifest; /** Builds the transported session handle, with the manifest encoded via {@link encodeManifest}. */ export declare function serializeSessionEnvelope(sessionId: string, state: SandboxSessionState, providerState: Record, defaultWorkspaceReady?: boolean): SerializedSandboxSessionState; /** Revives the Workflow-side session state, with a live `Manifest` for the run loop. */ export declare function reviveWorkflowSessionState(payload: SerializedSandboxSessionState): TemporalSandboxSessionState; /** * Builds the record a real client's `deserializeSessionState`/`resume` expects: * the provider state merged under the SDK envelope fields, matching the SDK's * own resume path. */ export declare function toSdkStateRecord(payload: SerializedSandboxSessionState): Record; export declare function encodeToolOutputImage(output: ToolOutputImage): SerializedToolOutputImage; export declare function decodeToolOutputImage(serialized: SerializedToolOutputImage): ToolOutputImage;