{"version":3,"file":"index.mjs","names":[],"sources":["../src/core/types.ts"],"sourcesContent":["export const providerNames = [\n  \"local\",\n  \"e2b\",\n  \"daytona\",\n  \"vercel\",\n  \"upstash\",\n  \"box\",\n  \"railway\",\n] as const;\nexport type ProviderName = (typeof providerNames)[number];\n\nexport const capabilityNames = [\n  \"files.read\",\n  \"files.write\",\n  \"files.list\",\n  \"files.remove\",\n  \"process.run\",\n  \"process.stream\",\n  \"process.background\",\n  \"process.stdin\",\n  \"process.cancel\",\n  \"ports.expose\",\n  \"ports.authenticatedRequest\",\n  \"snapshot.create\",\n  \"snapshot.delete\",\n  \"snapshot.restore\",\n  \"sandbox.resume\",\n  \"filesystem.persistent\",\n  \"image.custom\",\n  \"network.policy\",\n  \"process.pty\",\n  \"compute.gpu\",\n] as const;\n\nexport type Capability = (typeof capabilityNames)[number];\nexport type CapabilityMode =\n  | \"filesystem\"\n  | \"memory\"\n  | \"template\"\n  | \"fork\"\n  | \"public\"\n  | \"authenticated\"\n  | \"combined-stream\"\n  | \"separate-streams\"\n  | \"ephemeral\"\n  | \"persistent\"\n  | \"localhost\"\n  | \"in-process\"\n  | \"full\"\n  | \"native\";\n\nexport type CapabilityMap = Readonly<Record<Capability, false | CapabilityMode>>;\n\nexport type CommandInput = string | { command: string; args?: readonly string[] };\n\nexport interface RunOptions {\n  cwd?: string;\n  env?: Readonly<Record<string, string>>;\n  timeout?: number;\n  signal?: AbortSignal;\n}\n\nexport interface CommandResult {\n  stdout: string;\n  stderr: string;\n  exitCode: number;\n  success: boolean;\n  signal?: string;\n  durationMs?: number;\n}\n\nexport type FileValue = string | Uint8Array | ArrayBuffer | Blob | ReadableStream<Uint8Array>;\n\nexport interface SandboxDirectoryEntry {\n  name: string;\n  path: string;\n  type: \"file\" | \"directory\" | \"symlink\" | \"unknown\";\n  size?: number;\n}\n\nexport interface SandboxFiles {\n  write(path: string, value: FileValue): Promise<void>;\n  read(path: string): Promise<Uint8Array>;\n  text(path: string): Promise<string>;\n  list(path?: string): Promise<SandboxDirectoryEntry[]>;\n  mkdir(path: string): Promise<void>;\n  remove(path: string): Promise<void>;\n  exists(path: string): Promise<boolean>;\n}\n\nexport interface ProcessOutputEvent {\n  stream: \"stdout\" | \"stderr\";\n  data: string | Uint8Array;\n  timestamp?: Date;\n}\n\nexport type ProcessStatus = \"starting\" | \"running\" | \"exited\" | \"killed\" | \"unknown\";\n\nexport interface SandboxProcess {\n  readonly id: string;\n  status(): Promise<ProcessStatus>;\n  output(): AsyncIterable<ProcessOutputEvent>;\n  write(value: string | Uint8Array): Promise<void>;\n  wait(): Promise<{ exitCode: number }>;\n  kill(signal?: string): Promise<void>;\n}\n\nexport interface SandboxProcesses {\n  start(command: CommandInput, options?: RunOptions): Promise<SandboxProcess>;\n}\n\nexport interface ExposedPort {\n  readonly port: number;\n  readonly url: string;\n  readonly public: boolean;\n  readonly authenticated: boolean;\n  request?(path?: string, init?: RequestInit): Promise<Response>;\n  toJSON(): Omit<ExposedPort, \"request\" | \"toJSON\">;\n}\n\nexport interface SandboxPorts {\n  expose(port: number): Promise<ExposedPort>;\n}\n\nexport interface SandboxSnapshot {\n  readonly id: string;\n  readonly name?: string;\n  readonly mode: CapabilityMode;\n  readonly createdAt?: Date;\n}\n\nexport interface SandboxSnapshots {\n  create(options?: { name?: string }): Promise<SandboxSnapshot>;\n  delete(snapshot: SandboxSnapshot | string): Promise<void>;\n  restore(snapshot: SandboxSnapshot | string): Promise<void>;\n}\n\nexport interface Sandbox<TRaw = unknown> {\n  readonly id: string;\n  readonly provider: ProviderName;\n  readonly cwd: string;\n  readonly capabilities: CapabilityMap;\n  readonly raw: TRaw;\n  readonly files: SandboxFiles;\n  readonly processes: SandboxProcesses;\n  readonly ports: SandboxPorts;\n  readonly snapshots: SandboxSnapshots;\n  run(command: CommandInput, options?: RunOptions): Promise<CommandResult>;\n  /** Stops the provider runtime. Repeated calls share the same cleanup operation. */\n  stop(): Promise<void>;\n  /** Stops the sandbox when an `await using` scope exits. */\n  [Symbol.asyncDispose](): Promise<void>;\n}\n"],"mappings":";;;;;AAAA,MAAa,gBAAgB;CAC3B;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAGD,MAAa,kBAAkB;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}