UNPKG

@luxorai/sandbox

Version:

TypeScript SDK for Luxor Sandbox: cloud sandboxes (microVMs) for AI agents on Luxor Agent Cloud

33 lines (32 loc) • 1.37 kB
import type { Session } from "./session.js"; import { type HostPortTunnel, type HostPortTunnelEndpoint, type HostPortTunnelOptions, type HostPortTunnelTermination } from "./tunnel.js"; export type ResilientHostPortTunnelState = "open" | "reconnecting" | "closed"; export type ResilientHostPortTunnelStateEvent = { state: "connecting"; } | { state: "open"; tunnel: HostPortTunnel; } | { state: "reconnecting"; reason: HostPortTunnelTermination; attempt: number; delayMs: number; } | { state: "port-changed"; previousPort: number; sandboxPort: number; } | { state: "closed"; reason: HostPortTunnelTermination; }; export interface ResilientHostPortTunnelOptions extends HostPortTunnelOptions { initialBackoffMs?: number; maxBackoffMs?: number; } export interface ResilientHostPortTunnel extends HostPortTunnel { readonly state: ResilientHostPortTunnelState; endpoint(): HostPortTunnelEndpoint; onStateChange(cb: (event: ResilientHostPortTunnelStateEvent) => void): void; } export declare function exposeHostPortResilient(session: Session, hostAddr: string, options?: ResilientHostPortTunnelOptions): Promise<ResilientHostPortTunnel>; export declare function resilientHostPortTunnel(session: Session, host: string, port: number, options?: ResilientHostPortTunnelOptions): Promise<ResilientHostPortTunnel>;