cua-sdk
The Rust host API: the Cua object and everything the language bindings export, plus the Rust-only items.
The Rust host API: the Cua object and everything the language bindings export, plus the Rust-only items.
Public API of the cua-sdk crate (cua_sdk). Summaries and declarations only (cargo doc -p cua-sdk --open in libs/cua has the full comments); see Rust crates for stability.
The cua SDK: the only #[uniffi::export] crate of libs/cua.
These are the objects, records, enums and functions the language bindings export, documented once in the Cua SDK reference, whose Rust tabs show each signature. Objects are Arc<T> handles whose methods are async fn returning Result<_, CuaError>, records are structs with public fields, and names are snake_case.
agent_event_category, agent_harnesses, AgentActionReport, AgentArtifact, AgentDelivery, AgentEvent, AgentEventPage, AgentFile, AgentInfo, AgentMcpServer, AgentPauseReport, AgentResumeReport, AgentRun, AgentRunInfo, AgentRunMcpServer, AgentRunOptions, AgentRunResult, AgentRunStatus, Agents, AgentSetup, AgentSetupChange, AgentSetupOutcome, AgentSetupTarget, AgentStartReport, AgentTranscript, AgentTranscriptItem, ambiguous_sandbox_candidates, AudioPacket, AudioSink, Auth, AuthIdentity, AuthStatus, BuildFile, BundledSkill, canonical_image, canonical_image_tier, check_placement, CloudCheck, CloudConnected, CloudCredentials, CloudDisconnected, CloudKind, CloudOptions, CloudProvider, CloudResource, CloudStatus, CloudSweepItem, CloudSweepReport, CloudTarget, CloudTestReport, ComputerGrant, config_get, config_list, config_path, config_set, config_unset, ConfigEntry, Container, contrib_providers_built, Cua, CuaConfig, CuaInfo, CuaMode, CursorArt, DeviceEnrollment, Devices, DevicesSnapshot, DoctorReport, DriveAccessRequest, DriveAudit, DriveAuditEvent, DriveCacheStats, DriveConflict, DriveDevice, DriveEntry, DriveFile, DriveFileSync, DriveGrant, DriveListing, DriveMountStatus, DriveObject, DrivePendingUpload, DriveS3Settings, DriveSpaceVolume, DriveStorage, DriveStorageCheck, DriveStorageUpdate, DriveSyncEvent, DriveSyncEvents, DriveSyncStatus, DriveVersion, DriveView, Fleet, fleet_check_runtime, fleet_generate_claim_token, fleet_image_variant, fleet_resolve_runtime, fleet_size_limits, FleetBillingCard, FleetBillingCredit, FleetBillingStatus, FleetClaim, FleetClaimOptions, FleetGcReport, FleetManagedPool, FleetPool, FleetPoolExport, FleetPools, FleetPoolSpec, FleetSandbox, FleetSettings, FleetSignedUrl, FleetSizeLimits, FleetUsagePricing, FrameSink, GpuOption, GpuSupport, GuestDisplay, HomeTransfer, Host, HostAccessRecord, HostPermission, HostProvidedSpace, HostSettingsChange, HostSetupOptions, HostSpacesAuditRecord, HostStatus, HttpHeader, HttpResponse, image_alias, ImageBuild, ImageInfo, ImageLayer, Local, LocalImage, LocalStorage, LocationInfo, locations, LoginAttempt, LoginMethod, may_have_fleet_session, mcp_connect, mcp_connect_url, McpClient, McpConfig, MediaBridge, MediaEvent, MediaSession, MediaStats, normalize_image, NotificationInfo, omarchy_image, Overlay, OverlayResult, parse_sandbox_ref, PersistentAgentInfo, PersistentAgentOptions, PoolOptions, PortForward, presence_color, presence_conformance_json, presence_cursor_art, presence_cursor_art_all, presence_cursor_art_svg, presence_now_ms, presence_text_color, PresenceCursor, PresenceDrawable, PresenceEvent, PresenceIdentity, PresenceMember, PresenceParticipant, PresencePoint, PresenceView, PublicUrl, qualify_sandbox_ref, ReadinessProbe, RegistrySecret, Relay, RelayAuditEvent, RelayClientInfo, RelayDevice, RelayMachine, ReplayMode, resolve_image, resolve_image_with_secret, ResolvedImage, RoutineInfo, RuntimeCheck, RuntimeCheckStatus, Sandbox, sandbox_locations, SandboxCreateOptions, Sandboxes, SandboxInfo, SandboxListing, SandboxPhase, SandboxRefParts, SandboxSpec, SandboxStatus, Service, ServiceEndpoint, SetupStep, SiteLoginOptions, SiteLoginReport, Space, SpaceAgentOptions, SpaceAppIcon, SpaceAppIconRequest, SpaceBashResult, SpaceCancelOutcome, SpaceCreateListener, SpaceCreateOptions, SpaceCreateProgress, SpaceCreateResult, SpaceDisplay, SpaceHotspotStatus, SpaceInfo, SpacePowerReport, SpacePresence, SpaceRelayRegistration, Spaces, spaces_tool_methods, SpacesdClient, SpacesdHttpHeader, SpacesdHttpRequest, SpacesdHttpResponse, SpacesdProcess, SpaceSendFileOptions, SpaceSendFileReport, SpaceSentFile, SpaceShareEntry, SpaceShares, SpacesHost, SpacesHostLimit, SpacesToolMethod, SpaceStreamOptions, SpaceStreamSession, SpaceStreamStats, SpaceStreamTicket, SpaceToolInfo, SpaceToolResult, SpaceTransferReport, SpaceUsage, SpaceWindow, SpaceWriteReport, StorageVolume, StreamStatsReport, telemetry_acknowledge_notice, telemetry_flush, telemetry_notice_text, telemetry_record_bench_run, telemetry_record_feature, telemetry_record_onboarding_step, telemetry_record_stream_stats, telemetry_reset_id, telemetry_schema_json, telemetry_set_enabled, telemetry_set_surface, telemetry_show_last, telemetry_status, telemetry_use_app_notice, TelemetryStatus, TeleportApprover, TeleportDecision, TeleportItem, TeleportManifest, TeleportReceipt, VideoFrame, ViewerLink, ViewerOptions.
CuaError#Every error the SDK raises.
pub enum CuaError {
InvalidArgument(String),
InvalidPlacement(String),
NotFound(String),
ProviderNotConfigured(String),
Unsupported(String),
SpacesdNotAvailable(String),
Timeout(String),
Fleet(String),
FleetAdmissionDenied(String),
CloudCreditExhausted(String),
Runtime(String),
Env(String),
Http(String),
Unauthenticated(String),
PermissionDenied(String),
Transport(String),
DaemonNotRunning(String),
Closed(String),
CapabilityMissing(String),
HostCapabilityMissing(String),
TeleportRefused(String),
PoolSpecMismatch(String),
ClaimSecretsNotDelivered(String),
Internal(String),
AmbiguousSandbox(String),
InsufficientDisk(String),
ImageNotPublished(String),
Cancelled(String),
Cloud(String),
}
impl CuaError {
fn variant(&self) -> &'static str;
fn doc_url(&self) -> String;
}ExitInfo#How a process ended.
pub struct ExitInfo {
pub code: Option<i32>,
pub signal: Option<String>,
pub timed_out: bool,
pub error: Option<String>,
pub success: bool,
}FileEntry#A file or directory in the guest.
pub struct FileEntry {
pub name: String,
pub path: String,
pub kind: String,
pub size: u64,
pub mode: u32,
pub modified_ms: Option<i64>,
pub symlink_target: Option<String>,
}ImageFormat#Screenshot encoding.
pub enum ImageFormat {
Png,
Jpeg,
Webp,
}MediaOpenOptions#Media session options.
pub struct MediaOpenOptions {
pub display: Option<String>,
pub window_handle: Option<String>,
pub max_fps: u32,
pub max_dimension: u32,
pub audio: bool,
pub disable_video: bool,
pub request_json: Option<String>,
}Point#A point.
pub struct Point {
pub x: f64,
pub y: f64,
}ProcessEvent#One output chunk or the exit.
pub struct ProcessEvent {
pub kind: ProcessEventKind,
pub offset: u64,
pub data: Vec<u8>,
pub exit: Option<ExitInfo>,
}ProcessEventKind#Kind of a process event.
pub enum ProcessEventKind {
Stdout,
Stderr,
Pty,
Exit,
}ProcessOutput#Collected output of a finished process.
pub struct ProcessOutput {
pub exit: ExitInfo,
pub stdout: Vec<u8>,
pub stderr: Vec<u8>,
pub pty: Vec<u8>,
}PtySize#A PTY size.
pub struct PtySize {
pub cols: u32,
pub rows: u32,
}Screenshot#A captured screenshot.
pub struct Screenshot {
pub image: Vec<u8>,
pub format: ImageFormat,
pub width: u32,
pub height: u32,
pub scale: f64,
pub screenshot_id: String,
}ScreenshotOptions#Screenshot options.
pub struct ScreenshotOptions {
pub display: Option<String>,
pub format: Option<ImageFormat>,
pub quality: Option<u32>,
pub max_dimension: Option<u32>,
pub include_cursor: bool,
}SpacesdCapabilities#SystemService.GetCapabilities, summarized.
pub struct SpacesdCapabilities {
pub version: String,
pub protocol_version: u32,
pub protocol_revision: u32,
pub os_family: String,
pub os_name: String,
pub os_version: String,
pub arch: String,
pub hostname: String,
pub initialized: bool,
pub features: Vec<SpacesdFeature>,
pub json: String,
}SpacesdCommand#A command to run in the guest.
pub struct SpacesdCommand {
pub program: String,
pub args: Vec<String>,
pub env: HashMap<String, String>,
pub cwd: Option<String>,
pub user: Option<String>,
pub timeout_ms: Option<u32>,
pub tag: Option<String>,
pub stdin: bool,
pub pty: Option<PtySize>,
}SpacesdFeature#One capability flag.
pub struct SpacesdFeature {
pub name: String,
pub supported: bool,
pub limitation: Option<String>,
pub attributes: HashMap<String, String>,
}SpaceThumbnail#A Space's latest thumbnail, from the cache every client ...
pub struct SpaceThumbnail {
pub image: Vec<u8>,
pub format: ImageFormat,
pub width: u32,
pub height: u32,
pub captured_at_ms: u64,
}TransferResult#Result of an upload or download.
pub struct TransferResult {
pub size: u64,
pub sha256: String,
pub resumes: u32,
}UploadOptions#Upload options.
pub struct UploadOptions {
pub create_new: bool,
pub append: bool,
pub permissions: u32,
pub create_parents: bool,
}/// Version of the SDK library.
pub fn cua_sdk_version() -> String
/// A link to the errors-reference entry of ...
pub fn error_doc_url(variant: String) -> String/// The errors reference.
pub const ERRORS_DOC_URL: &str = "https://cua.ai/docs/cua-sdk/reference/errors";
/// Server-streaming RPCs reachable through ...
pub const JSON_STREAM_METHODS: &[&str] = _;
/// Unary RPCs reachable through ...
pub const JSON_UNARY_METHODS: &[&str] = _;
/// Where overlay records live in the guest.
pub const OVERLAY_RECORD_DIR: &str = "/var/lib/cua/overlays";
/// SDK methods that have no contract tool ...
pub const SPACES_SDK_ONLY_METHODS: &[&str] = _;
/// Every Spaces contract tool and the SDK ...
pub const SPACES_TOOL_METHODS: &[(&str, &str)] = _;
/// RPCs exposed only through typed methods ...
pub const TYPED_ONLY_METHODS: &[&str] = _;
/// The released cua SDK version ...
pub const VERSION: &str = "0.4.1";/// Result alias.
pub type Result<T, E = CuaError> = Result<T, E>;