@luxorai/sandbox
Version:
TypeScript SDK for Luxor Sandbox: cloud sandboxes (microVMs) for AI agents on Luxor Agent Cloud
51 lines (50 loc) • 2.24 kB
TypeScript
import type { Client } from "@connectrpc/connect";
import { SandboxService, type PreviewUrl as ProtoPreviewUrl } from "./internal/proto/tenki/sandbox/v1/sandbox_pb.js";
import { type WildcardStatus } from "./session.js";
export interface PreviewUrl {
id: string;
workspaceId: string;
ownerId: string;
slug: string;
token: string;
previewUrl: string;
sessionId?: string;
port?: number;
createdAt?: Date;
updatedAt?: Date;
lastAccessedAt?: Date;
/** Whether subdomain support is enabled for this preview URL. */
wildcard?: boolean;
/** Readiness of the wildcard subdomain provisioning; meaningful only when wildcard is true. */
wildcardStatus?: WildcardStatus;
/** Actionable reason when wildcardStatus is "FAILED"; empty otherwise. */
wildcardStatusReason?: string;
/** Deadline after which the URL stops serving; undefined means it does not expire. */
expiresAt?: Date;
}
export interface PreviewUrlOptions {
/** Explicit workspace scope for service-token callers. Workspace API keys infer this server-side. */
workspaceId?: string;
sessionId?: string;
port?: number;
/** Deadline after which the URL stops serving. */
expiresAt?: Date;
}
export interface PreviewUrlListOptions {
/** Explicit workspace scope for service-token callers. Workspace API keys infer this server-side. */
workspaceId?: string;
/** Restrict the result to the preview URLs bound to one session. */
sessionId?: string;
}
export declare function previewUrlFromProto(proto: ProtoPreviewUrl | undefined): PreviewUrl | undefined;
export declare class PreviewUrlClient {
private readonly rpcClient;
constructor(rpcClient: Client<typeof SandboxService>);
/** Create a preview URL. `slug` is required and must be unique within the workspace. */
create(slug: string, options?: PreviewUrlOptions): Promise<PreviewUrl>;
delete(previewUrlId: string): Promise<void>;
bind(previewUrlId: string, sessionId: string, port: number, expiresAt?: Date): Promise<PreviewUrl>;
unbind(previewUrlId: string): Promise<PreviewUrl>;
list(options?: PreviewUrlListOptions): Promise<PreviewUrl[]>;
get(previewUrlId: string): Promise<PreviewUrl>;
}