import type { SandboxFsBridge } from "./fs-bridge.types.js"; export type SandboxBackendId = string; export type SandboxBackendExecSpec = { argv: string[]; env: NodeJS.ProcessEnv; stdinMode: "pipe-open" | "pipe-closed"; finalizeToken?: unknown; }; export type SandboxBackendCommandParams = { script: string; args?: string[]; stdin?: Buffer | string; allowFailure?: boolean; signal?: AbortSignal; }; export type SandboxBackendCommandResult = { stdout: Buffer; stderr: Buffer; code: number; }; export type SandboxFsBridgeContext = { workspaceDir: string; agentWorkspaceDir: string; workspaceAccess: "none" | "ro" | "rw"; containerName: string; containerWorkdir: string; docker: { binds?: string[]; }; backend?: { runShellCommand(params: SandboxBackendCommandParams): Promise; }; }; export type SandboxBackendHandle = { id: SandboxBackendId; runtimeId: string; runtimeLabel: string; workdir: string; env?: Record; configLabel?: string; configLabelKind?: string; capabilities?: { browser?: boolean; }; buildExecSpec(params: { command: string; workdir?: string; env: Record; usePty: boolean; }): Promise; finalizeExec?: (params: { status: "completed" | "failed"; exitCode: number | null; timedOut: boolean; token?: unknown; }) => Promise; runShellCommand(params: SandboxBackendCommandParams): Promise; createFsBridge?: (params: { sandbox: SandboxFsBridgeContext; }) => SandboxFsBridge; };