UNPKG

@luxorai/sandbox

Version:

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

44 lines (43 loc) • 1.91 kB
import { type Client } from "@connectrpc/connect"; import { DataPlaneRouteStatus, SandboxSessionDataPlaneService, type SessionCredential } from "./internal/proto/tenki/sandbox/v1/sandbox_pb.js"; import type { Session } from "./session.js"; export declare const dataPlaneCredentialHeader = "x-tenki-session-cert"; export interface DataPlaneConfig { endpoint?: string; credential?: SessionCredential; routeStatus?: DataPlaneRouteStatus; } export declare class DataPlaneEndpointHints { private endpoint; private resolving?; current(): string; remember(endpoint: string): void; clear(): void; resolve(resolveEndpoint: () => Promise<string>): Promise<string>; } export declare class DataPlaneCredentialManager { #private; private readonly session; private expiresAt?; private timer?; private stopped; constructor(session: Session, initial?: SessionCredential, endpoint?: string); current(): string; /** The credential, but only for the endpoint it was minted for. */ currentFor(endpoint: string): { credential: string; bound: true; } | { bound: false; }; /** Bind an unbound credential to the first endpoint the session resolves to. */ adoptEndpoint(endpoint: string): void; set(credential?: SessionCredential, endpoint?: string): void; stop(): void; private schedule; private renewLoop; } export declare function createDataPlaneClient(endpoint: string, credentials: DataPlaneCredentialManager, sessionId: string, lane: number): Client<typeof SandboxSessionDataPlaneService>; export declare function warmDataPlaneConnection(client: Client<typeof SandboxSessionDataPlaneService>): Promise<void>; export declare function warmDataPlaneEndpoints(endpoints: readonly string[]): void; export declare function closeDataPlaneConnection(client?: Client<typeof SandboxSessionDataPlaneService>): void;