UNPKG

@luxorai/sandbox

Version:

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

68 lines (67 loc) • 3.36 kB
import { type Client, type Code } from "@connectrpc/connect"; import type * as secretsPb from "./internal/proto/tenki/cloud/workspace/v1beta1/secrets_pb.js"; import * as pb from "./internal/proto/tenki/cloud/workspace/v1beta1/variables_pb.js"; import { type SecretRepositoryPageOptions } from "./workspace-secrets.js"; /** A failed variable RPC, with the server's message and status. */ export declare class WorkspaceVariableError extends Error { readonly code: Code; constructor(message: string, code: Code, options?: ErrorOptions); } /** Where a variable applies: every CI job and sandbox in the workspace, or CI jobs in one repository. */ export type VariableAvailability = "workspace" | "repository"; export interface WorkspaceVariable { id: string; workspaceId: string; name: string; value: string; /** Repository (owner/name) whose CI jobs get the variable; undefined for a workspace variable. */ repository?: string; /** One-line note for the people who manage the variable; undefined when there is none. */ description?: string; createdAt?: Date; updatedAt?: Date; } export interface CreateVariableOptions { /** Gives the variable only to CI jobs in this connected repository (owner/name); omit for a workspace variable. */ repository?: string; description?: string; } /** Changes only what is set, at least one field. The name cannot change. */ export interface UpdateVariableOptions { /** An empty string sets an empty value. */ value?: string; /** An empty string clears the description. */ description?: string; /** Omitted keeps the availability unless `repository` is set; "repository", or `repository` alone, moves the variable there. */ availability?: VariableAvailability; repository?: string; } export interface ListVariablesOptions { pageSize?: number; cursor?: string; /** Omitted lists workspace and repository variables; `repository`, with or without "repository", narrows to one repository. */ availability?: VariableAvailability; repository?: string; } /** Access through WorkspaceClient.variables. Values are plain text and come back with every variable a method returns. */ export declare class Variables { private readonly workspaceId; private readonly rpc; private readonly secrets; constructor(workspaceId: string, rpc: Client<typeof pb.WorkspaceVariablesService>, secrets: Client<typeof secretsPb.WorkspaceSecretsService>); /** With `repository`, only CI jobs in that connected repository get it, in place of a workspace variable with the same name. */ create(name: string, value: string, options?: CreateVariableOptions): Promise<WorkspaceVariable>; update(variableId: string, options: UpdateVariableOptions): Promise<WorkspaceVariable>; get(variableId: string): Promise<WorkspaceVariable>; /** Returns the variable as it was; it cannot be restored. */ delete(variableId: string): Promise<WorkspaceVariable>; list(options?: ListVariablesOptions): Promise<{ variables: WorkspaceVariable[]; nextCursor: string; }>; /** Lists the connected repositories (owner/name) a variable can be limited to, ordered by name. */ listRepositories(options?: SecretRepositoryPageOptions): Promise<{ repositories: string[]; nextCursor: string; }>; }