cua-spaces: registry and primitives
The Spaces registry and primitives (files, exec, streams, presence, services, teleport, hotspot, relay).
The Spaces registry and primitives (files, exec, streams, presence, services, teleport, hotspot, relay).
Public API of the cua-spaces crate (cua_spaces). Summaries and declarations only (cargo doc -p cua-spaces --open in libs/cua has the full comments); see Rust crates for stability.
Cua Spaces: interactive sandboxes on any image, and everything a person or an agent does with one. cua-spacesd, when the image runs it, adds the desktop, shell, files, streaming and teleport primitives.
More of this crate: client, agents and MCP.
app_icon: App icons for a Space's windows, as the guest's own ...audit: A hash-chained audit log (the share audit).cloud: Spaces in your own cloud account: a cloud sandbox ...creating: Creates in flight: cancelling one, and finishing what a ...error: One error type for every Spaces call, with a stable ...exec: Shell and literal-file primitives over the spacesd's ...extension: Extension points for the capabilities that ship with ...files: Moving files between this host and a Space.fleet_runtime: The Fleet runtime ↔ image pairing for Spaces.groups: Group chats: one human and two to six Bots in one ...host_spaces: Spaces on your machines: a machine set up with cua ...hotspot: Hotspot: a Space borrows this machine's network.id: Space ids: the unified sandbox ref scheme (a Space is a ...install_cache: Pinned install archives, fetched once on this machine ...operator: Presenting a Space to the human: picture-in-picture ...presence: Presence: who is looking at a Space and where their ...presence::art: The shared presence cursor art (ass ...presence::view: The presence netcode model every client draws from ...registry: The persisted Spaces registry.relay: relay:<machine-id>: machines of the signed-in cua.ai ...routines: Routines: recurring tasks a Bot runs on a schedule.routines::iso: ISO 8601 in UTC with whole seconds, the portable form ...routines::iso::optionservices: Tools inside a Space, from two kinds of MCP service:share: Sharing a Space with other accounts, to watch or to ...site_login: The Keyvault seam and the whole request_site_login ...stream: Streams: targets, media tickets, and a Rust media ...teleport_broker: The Keyvault broker seam the teleport_app MCP tool ...volume: A volume mounted in a Space's guest, served from this ...walk: Host-side folder walks for transfers, optionally ...app_icon::IconPlatform#Which lookup a guest gets.
pub enum IconPlatform {
Macos,
Linux,
}
impl IconPlatform {
fn of(os: OsFamily) -> Option<IconPlatform>;
}AppIcon#An app icon, normalized by the icon cache.
pub struct AppIcon {
pub bytes: Vec<u8>,
pub bytes_1x: Vec<u8>,
pub content_type: &'static str,
}audit::AuditLog#An append-only, hash-chained log file.
pub struct AuditLog { /* private fields */ }
impl AuditLog {
fn new(path: impl Into<PathBuf>) -> AuditLog;
fn path(&self) -> &Path;
fn append(&self, principal: &str, action: &str, path: &str, detail: &str) -> Result<()>;
fn tail(&self, limit: usize) -> Result<(Vec<Event>, Result<(), String>)>;
fn verify(&self) -> Result<()>;
}audit::Event#The hashed part of a line (field order is the canonical ...
pub struct Event {
pub seq: u64,
pub ts_ms: u64,
pub principal: String,
pub action: String,
pub path: String,
pub detail: String,
pub prev: String,
}CancelOutcome#The result of Spaces::cancel_create.
pub struct CancelOutcome {
pub id: String,
pub state: CancelState,
pub message: String,
}CancelState#What Spaces::cancel_create found and did.
pub enum CancelState {
Cancelled,
NotCreating,
AlreadyCreated,
}
impl CancelState {
fn as_str(&self) -> &'static str;
}creating::Made#One thing a create made, recorded as soon as it exists.
pub enum Made {
LocalSandbox { name: String, fresh: bool },
FleetClaim { namespace: String, name: String },
RelayMachine { id: String },
HostSpace { host: String, machine: String },
}Error#Spaces errors.
pub enum Error {
InvalidArgument(String),
NotFound(String),
SpacesdNotAvailable { space: String, reason: String },
CapabilityMissing { space: String, feature: String, limitation: String },
HostCapabilityMissing { what: String, why: String },
WrongProvider { op: String, provider: String },
Transfer(String),
TeleportRefused(String),
LoginRefused(String),
Agent(String),
Timeout(String),
Stream(String),
Env(Error),
Fleet(Error),
Sandbox(Error),
Io(Error),
Json(Error),
Relay(Error),
Mcp(String),
LimitExceeded(String),
AmbiguousHost { query: String, choices: Vec<String>, message: String },
Extension { kind: &'static str, message: String },
Cancelled(String),
}
impl Error {
fn tag(&self) -> &'static str;
fn extension(kind: &str, message: impl Into<String>) -> Self;
fn needs_cua_spaces(what: &str) -> Self;
fn invalid(msg: impl Into<String>) -> Self;
fn host(what: &str, why: impl Into<String>) -> Self;
}exec::BashOutput#The result of Space::bash.
pub struct BashOutput {
pub stdout: String,
pub stderr: String,
pub exit_code: Option<i32>,
pub signal: Option<String>,
pub timed_out: bool,
pub error: Option<String>,
}
impl BashOutput {
fn success(&self) -> bool;
fn render(&self) -> String;
}exec::WriteReport#The result of Space::write.
pub struct WriteReport {
pub path: String,
pub bytes: u64,
pub sha256: String,
}extension::SpacesExtension#A capability served outside this crate.
pub trait SpacesExtension: Send + Sync + 'static {
fn name(&self) -> &str;
fn serves(&self, tool: &str) -> bool;
fn call_tool<'a>(&'a self, call: ToolCall<'a>) -> BoxFuture<'a, Result<ToolOutcome>>;
fn space_connected(&self, spaces: &Spaces, space: &str);
fn space_dropped<'a>(&'a self, spaces: &'a Spaces, space: &'a str) -> BoxFuture<'a, ()>;
fn as_any(&self) -> &dyn Any;
}extension::ToolCall#One tool call routed to an extension.
pub struct ToolCall<'a> {
pub spaces: &'a Spaces,
pub tool: &'a str,
pub args: Value,
pub broker: Option<&'a Arc<dyn SessionBroker>>,
pub pinned: Option<&'a Space>,
}files::Conflict#What happens when a sent file already exists in the ...
pub enum Conflict {
Overwrite,
Rename,
Skip,
}files::DownloadReport#The result of Space::download.
pub struct DownloadReport {
pub source: String,
pub dest: String,
pub kind: &'static str,
pub files: usize,
pub bytes: u64,
pub sha256: Option<String>,
pub verified: bool,
}files::SendFileOptions#Options for Space::send_file.
pub struct SendFileOptions {
pub subdir: String,
pub respect_ignore_files: bool,
pub conflict: Conflict,
}files::SendFileReport#The result of Space::send_file.
pub struct SendFileReport {
pub source: String,
pub destination: String,
pub dest: String,
pub kind: &'static str,
pub files: Vec<SentFile>,
pub bytes: u64,
pub respect_ignorefiles: bool,
pub skipped_by_ignorefiles: Vec<String>,
pub skipped_count: usize,
pub skipped_by_guest: Vec<String>,
pub verified: bool,
}files::SentFile#One file placed by Space::send_file.
pub struct SentFile {
pub path: String,
pub size: u64,
pub sha256: String,
}files::UploadReport#The result of Space::upload.
pub struct UploadReport {
pub source: String,
pub dest: String,
pub kind: &'static str,
pub files: usize,
pub directories: usize,
pub bytes: u64,
pub sha256: Option<String>,
pub verified: bool,
}groups::GroupChat#A group chat.
pub struct GroupChat {
pub id: String,
pub title: String,
pub created_at: DateTime<Utc>,
pub messages: Vec<GroupMessage>,
}
impl GroupChat {
fn new(title: &str, members: &[String]) -> Result<Self, GroupChatError>;
fn member_ids(&self) -> &[String];
fn is_full(&self) -> bool;
fn is_at_floor(&self) -> bool;
fn membership_label(&self) -> String;
fn remaining_seats(&self) -> usize;
fn add(&mut self, bot_id: &str) -> Result<(), GroupChatError>;
fn remove(&mut self, bot_id: &str) -> Result<(), GroupChatError>;
}groups::GroupChatError#A membership rule was broken.
pub enum GroupChatError {
TooFewBots(usize),
TooManyBots(usize),
Full,
AtFloor,
AlreadyAMember(String),
NotAMember(String),
UnknownChat(String),
}groups::GroupChatStore#Group chats: membership, fan-out, and the merged ...
pub struct GroupChatStore {
pub chats: Vec<GroupChat>,
pub last_error: Option<String>,
pub working: HashMap<String, BTreeSet<String>>,
}
impl GroupChatStore {
fn new() -> Self;
fn attach(&mut self, messenger: Arc<dyn GroupMessenger>);
fn chat(&self, id: &str) -> Option<&GroupChat>;
fn create(&mut self, title: &str, members: &[String]) -> Result<GroupChat, GroupChatError>;
fn delete(&mut self, id: &str);
async fn add(&mut self, bot_id: &str, chat_id: &str) -> Result<(), GroupChatError>;
async fn remove(&mut self, bot_id: &str, chat_id: &str) -> Result<(), GroupChatError>;
async fn send(&mut self, text: &str, chat_id: &str) -> Vec<GroupDelivery>;
async fn collect_replies(&mut self, chat_id: &str) -> Vec<GroupMessage>;
fn react(&mut self, emoji: &str, chat_id: &str);
async fn refresh_working(&mut self, chat_id: &str);
fn working_bots(&self, chat_id: &str) -> Vec<String>;
}groups::GroupDelivery#The result of fanning one message out to one member.
pub struct GroupDelivery {
pub bot_id: String,
pub accepted: bool,
pub reason: String,
}groups::GroupMessage#One line of a group transcript.
pub struct GroupMessage {
pub id: String,
pub speaker: GroupSpeaker,
pub text: String,
pub at: DateTime<Utc>,
pub undelivered: bool,
pub reaction: Option<String>,
}groups::GroupMessenger#How a group reaches its Bots.
pub trait GroupMessenger: Send + Sync {
async fn deliver(&self, text: &str, bot_id: &str) -> GroupDelivery;
async fn latest_reply(&self, bot_id: &str) -> Option<String>;
async fn is_working(&self, bot_id: &str) -> bool;
async fn display_name(&self, bot_id: &str) -> String;
}groups::GroupSpeaker#Who said a line: the human, a Bot, or the group itself.
pub enum GroupSpeaker {
Human,
Bot { bot_id: String },
System,
}host_spaces::HostCaller#Who asked the host for a Space.
pub struct HostCaller {
pub account: String,
pub email: Option<String>,
pub name: Option<String>,
pub role: String,
pub via: String,
}
impl HostCaller {
fn local() -> Self;
fn from_metadata(value: Option<&str>) -> Result<Self>;
fn label(&self) -> String;
fn is_owner(&self) -> bool;
fn may_create(&self) -> bool;
}host_spaces::HostLimit#One limit of a host and how much of it is used ...
pub struct HostLimit {
pub resource: String,
pub used: u32,
pub limit: u32,
pub reason: String,
}host_spaces::HostOffer#One of your machines that provides Spaces, as ...
pub struct HostOffer {
pub id: String,
pub name: String,
pub via: String,
pub online: bool,
pub os: String,
pub limits: Vec<HostLimit>,
}host_spaces::HostSpacesServer#The host half: what this machine's cua daemon does for ...
pub struct HostSpacesServer { /* private fields */ }
impl HostSpacesServer {
fn new(spaces: Spaces) -> Arc<Self>;
async fn restore_direct_forwards(&self);
async fn get(&self, caller: &HostCaller) -> Result<GetHostSpacesResponse>;
async fn create(&self, caller: &HostCaller, req: CreateHostSpaceRequest) -> Result<HostSpace>;
async fn cancel(&self, caller: &HostCaller, space: &str) -> Result<String>;
async fn delete_cloud(&self, caller: &HostCaller, space: &str) -> Result<String>;
async fn delete(&self, caller: &HostCaller, space: &str) -> Result<String>;
async fn set_power(&self, caller: &HostCaller, space: &str, on: bool) -> Result<SetHostSpacePowerResponse>;
}host_spaces::ResolvedHost#A machine that provides Spaces, as ...
pub enum ResolvedHost {
Relay(RelayMachine),
Direct(DirectHost),
}
impl ResolvedHost {
fn via(&self) -> &'static str;
fn name(&self) -> String;
}hotspot::Hotspot#A running hotspot.
pub struct Hotspot { /* private fields */ }
impl Hotspot {
fn id(&self) -> &str;
fn socks_address(&self) -> &str;
fn space(&self) -> &Space;
fn is_running(&self) -> bool;
async fn status(&self) -> Result<HotspotStatus>;
async fn stop(self) -> Result<()>;
}hotspot::HotspotOptions#Options for Space::start_hotspot.
pub struct HotspotOptions {
pub socks_port: u32,
pub set_system_proxy: bool,
pub bypass: Vec<String>,
pub dialer: Dialer,
}hotspot::HotspotStatus#Hotspot state as reported by the Space.
pub struct HotspotStatus {
pub space: String,
pub state: String,
pub hotspot_id: String,
pub socks_address: String,
pub active_connections: u32,
pub bytes_out: u64,
pub bytes_in: u64,
pub served_here: bool,
}IconRequest#One app to look up: a window's app as the window list ...
pub struct IconRequest {
pub app_name: String,
pub app_id: String,
pub pid: u32,
}install_cache::StageEvent#One staging report line, with bytes.
pub struct StageEvent {
pub detail: String,
pub done: u64,
pub total: u64,
}operator::ControlServerDisplay#The Cua Spaces app's loopback control server.
pub struct ControlServerDisplay { /* private fields */ }
impl ControlServerDisplay {
fn new(config: impl Into<PathBuf>) -> Self;
}operator::NoDisplay#No display: every call reports host ...
pub struct NoDisplay;operator::OperatorDisplay#Something that can present Spaces on the operator's ...
pub trait OperatorDisplay: Send + Sync {
async fn stream_window(&self, request: WindowStreamRequest) -> Result<()>;
async fn pin_pip(&self, space_id: &str) -> Result<()>;
async fn unpin_pip(&self, space_id: &str) -> Result<()>;
async fn open_viewer(&self, space_id: &str) -> Result<()>;
}operator::WindowStreamRequest#A request to draw one Space window on the operator's ...
pub struct WindowStreamRequest {
pub space_id: String,
pub window_id: String,
pub app_name: String,
pub title: String,
pub media_url: String,
pub media_session_id: String,
}PendingSpace#A Space Spaces::create started with wait = false.
pub struct PendingSpace {
pub id: String,
pub phase: &'static str,
}presence::art::CursorArt#One shape's art.
pub struct CursorArt {
pub shape: CursorShape,
pub path_d: String,
pub hotspot_x: f64,
pub hotspot_y: f64,
pub canvas: f64,
pub outline_color: String,
pub outline_width: f64,
}presence::Cursor#A cursor position, normalized to [0, 1] within the ...
pub struct Cursor {
pub display_id: String,
pub window_id: Option<String>,
pub x: f64,
pub y: f64,
pub visible: bool,
pub pressed: bool,
pub shape: CursorShape,
pub shape_source: ShapeSource,
pub at_ms: f64,
pub received_ms: f64,
}
impl Cursor {
fn at(x: f64, y: f64) -> Self;
fn hidden(self) -> Self;
}presence::CursorSender#Publishes the caller's cursor at most every ...
pub struct CursorSender { /* private fields */ }
impl CursorSender {
fn uses_datagrams(&self) -> bool;
async fn update(&self, cursor: &Cursor) -> Result<()>;
}presence::CursorShape#A pointer shape, the portable vocabulary of ...
pub enum CursorShape {
Arrow,
Text,
Pointer,
ResizeNs,
ResizeEw,
ResizeNesw,
ResizeNwse,
Wait,
Progress,
NotAllowed,
Crosshair,
Grab,
Grabbing,
Move,
}
impl CursorShape {
const ALL: [CursorShape; 14] = _;;
fn from_wire(v: i32) -> Self;
fn to_wire(self) -> i32;
fn as_str(self) -> &'static str;
fn parse(name: &str) -> Self;
}presence::CursorUplink#Where outgoing cursors go: the datagram channel when ...
pub trait CursorUplink: Send + Sync {
async fn send(&self, cursor: &Cursor) -> Result<bool>;
}presence::Drawable#One cursor to draw.
pub struct Drawable {
pub participant_id: String,
pub display_name: String,
pub color: String,
pub is_me: bool,
pub is_agent: bool,
pub x: f64,
pub y: f64,
pub shape: CursorShape,
pub shape_source: ShapeSource,
pub alpha: f64,
pub display_id: String,
pub window_id: Option<String>,
}presence::Identity#Who is joining.
pub struct Identity {
pub id: String,
pub display_name: String,
pub color: String,
pub agent: bool,
}
impl Identity {
fn agent(id: &str, display_name: &str) -> Self;
}presence::Participant#A participant as seen in the roster.
pub struct Participant {
pub participant_id: String,
pub principal_id: String,
pub display_name: String,
pub color: String,
pub kind: String,
}presence::PresenceDatagrams#The presence datagram channel (cua-presence/1 over ...
pub trait PresenceDatagrams: Send + Sync + 'static {
fn connect<'a>(&'a self, space: &'a Space, info: &'a PresenceDatagrams, timeout: Duration) -> BoxFuture<'a, Result<DatagramChannel>>;
}presence::PresenceEvent#One presence event.
pub enum PresenceEvent {
Joined { participant: Participant },
Left { participant_id: String, reason: String },
CursorMoved { participant_id: String, cursor: Cursor },
ShapeChanged { participant_id: String, shape: CursorShape, source: ShapeSource },
Heartbeat { participant_ids: Vec<String> },
KeepAlive,
}presence::PresenceSession#A joined presence session.
pub struct PresenceSession { /* private fields */ }
impl PresenceSession {
fn me(&self) -> &Participant;
fn roster(&self) -> &[(Participant, Option<Cursor>)];
fn uses_datagrams(&self) -> bool;
fn view(&self) -> PresenceView;
fn sender(&self) -> CursorSender;
async fn update_cursor(&self, cursor: &Cursor) -> Result<()>;
async fn next_event(&mut self, timeout: Duration) -> Result<Option<PresenceEvent>>;
async fn wait_for(&mut self, timeout: Duration, max_events: usize, pred: impl FnMut(&PresenceEvent) -> bool) -> Result<PresenceEvent>;
async fn leave(self) -> Result<()>;
}presence::PresenceView#Who is present and what to draw for each, folded from ...
pub struct PresenceView { /* private fields */ }
impl PresenceView {
fn new(me: &str, delay_ms: f64) -> Self;
fn me(&self) -> &str;
fn set_heartbeat_interval_ms(&mut self, ms: f64);
fn upsert(&mut self, participant: Participant);
fn participant_ids(&self) -> Vec<String>;
fn participant(&self, id: &str) -> Option<&Participant>;
fn shape_of(&self, id: &str) -> Option<(CursorShape, ShapeSource)>;
fn apply(&mut self, event: &PresenceEvent, local_ms: f64) -> bool;
fn expire(&mut self, local_ms: f64) -> Vec<String>;
fn drawables(&mut self, local_ms: f64, local_pointer: Option<(f64, f64)>) -> Vec<Drawable>;
}presence::Roster#Who is present and where their cursors are, folded from ...
pub struct Roster {
pub me: String,
pub entries: Vec<(Participant, Option<Cursor>)>,
}
impl Roster {
fn from_session(session: &PresenceSession) -> Self;
fn get(&self, participant_id: &str) -> Option<&(Participant, Option<Cursor>)>;
fn color_of(&self, principal_id: &str) -> String;
fn others(&self) -> impl Iterator<Item = &(Participant, Option<Cursor>)>;
fn apply(&mut self, e: &PresenceEvent) -> bool;
}presence::ShapeSource#How a shape was determined (cua.env ...
pub enum ShapeSource {
Unspecified,
HitTest,
System,
Probe,
}
impl ShapeSource {
fn from_wire(v: i32) -> Self;
fn to_wire(self) -> i32;
fn as_str(self) -> &'static str;
fn parse(name: &str) -> Self;
}presence::view::CursorSmoother#One remote cursor's interpolation buffer.
pub struct CursorSmoother { /* private fields */ }
impl CursorSmoother {
fn new(delay_ms: f64) -> Self;
fn push(&mut self, server_ms: f64, local_ms: f64, x: f64, y: f64, target: &str);
fn reset(&mut self);
fn position(&self, local_ms: f64) -> Option<(f64, f64)>;
fn alpha(&self, local_ms: f64) -> f64;
}ProgressSink#Where SpaceCreate::progress reports go.
pub struct ProgressSink(pub Sink);
impl ProgressSink {
fn new(f: impl Fn(&CreateProgress) + Send + Sync + 'static) -> Self;
}Provider#Which provider backs a Space: the location vocabulary.
pub enum Provider {
Cloud,
Local,
Direct,
Relay,
}
impl Provider {
fn as_str(self) -> &'static str;
fn parse(s: &str) -> Option<Self>;
}RecoveredCreate#container:ghcr.io/x:1 -> ghcr.io/x:1 (the local ...
pub struct RecoveredCreate {
pub id: String,
pub outcome: RecoveryOutcome,
}RecoveryOutcome#The fate of an interrupted create.
pub enum RecoveryOutcome {
Registered,
Deleted(String),
Failed(String),
AlreadyRegistered,
NothingLeft,
}registry::Credential#How to reach a Space again: its URL and spacesd token.
pub struct Credential {
pub url: Option<String>,
pub token: Option<String>,
pub service_urls: BTreeMap<String, String>,
pub namespace: Option<String>,
}registry::DirectHost#A machine that provides Spaces over its direct listener ...
pub struct DirectHost {
pub name: String,
pub space: String,
pub spaces: BTreeMap<String, String>,
}registry::Registry#The registry on disk.
pub struct Registry { /* private fields */ }
impl Registry {
fn new(dir: impl Into<PathBuf>) -> Self;
fn dir(&self) -> &Path;
fn spaces_path(&self) -> PathBuf;
fn credentials_path(&self) -> PathBuf;
fn list(&self) -> Result<Vec<Space>>;
fn get(&self, id: &str) -> Result<Option<Space>>;
fn credential(&self, id: &str) -> Result<Option<Credential>>;
fn lock_path(&self) -> PathBuf;
fn direct_hosts_path(&self) -> PathBuf;
fn direct_hosts(&self) -> Result<Vec<DirectHost>>;
fn direct_host_of(&self, id: &str) -> Result<Option<(DirectHost, String)>>;
fn update_direct_hosts(&self, change: impl FnOnce(&mut Vec<DirectHost>)) -> Result<()>;
fn upsert_direct_host(&self, name: &str, space: &str) -> Result<()>;
fn forget_direct(&self, id: &str) -> Result<bool>;
fn upsert(&self, space: Space, credential: Credential) -> Result<()>;
fn remove(&self, id: &str) -> Result<bool>;
}RelayAccount#The relay and the account Spaces lists machines for.
pub struct RelayAccount {
pub url: String,
pub tokens: Arc<dyn AccountTokens>,
pub device: Option<Arc<DeviceAuth>>,
}
impl RelayAccount {
fn new(url: impl Into<String>, tokens: Arc<dyn AccountTokens>) -> Self;
fn with_device(self, device: Arc<DeviceAuth>) -> Self;
async fn device_session(&self) -> Option<String>;
async fn client(&self) -> Result<RelayClient>;
}routines::FileStorage#A JSON file (written atomically).
pub struct FileStorage(pub PathBuf);routines::FiringRecord#One line of the scheduler's log, newest first.
pub struct FiringRecord {
pub routine_id: String,
pub title: String,
pub at: DateTime<Utc>,
pub firing: RoutineFiring,
}routines::MemoryStorage#In memory.
pub struct MemoryStorage(pub Mutex<Option<String>>);routines::Routine#One routine.
pub struct Routine {
pub id: String,
pub bot_id: String,
pub title: String,
pub prompt: String,
pub schedule: Schedule,
pub is_enabled: bool,
pub created_at: DateTime<Utc>,
pub last_fired_at: Option<DateTime<Utc>>,
pub last_run_id: Option<String>,
pub last_outcome: Option<String>,
}
impl Routine {
fn next_fire(&self, reference: DateTime<Utc>) -> Option<DateTime<Utc>>;
fn is_due(&self, now: DateTime<Utc>) -> bool;
fn turn_text(&self) -> String;
}routines::RoutineFiring#What happened when a routine fired.
pub enum RoutineFiring {
Started { run_id: String },
Refused { reason: String },
Failed { reason: String },
}
impl RoutineFiring {
fn summary(&self) -> String;
fn run_id(&self) -> Option<&str>;
}routines::RoutineRunner#Gives a Bot its routine turn.
pub trait RoutineRunner: Send + Sync {
async fn fire(&self, routine: &Routine) -> RoutineFiring;
}routines::RoutineStorage#Where the routine list lives.
pub trait RoutineStorage: Send + Sync {
fn load(&self) -> Result<Option<String>>;
fn save(&self, json: &str) -> Result<()>;
}routines::RoutineStore#Routines: storage, editing, and the clock that fires ...
pub struct RoutineStore {
pub routines: Vec<Routine>,
pub log: Vec<FiringRecord>,
}
impl RoutineStore {
fn new(storage: Box<dyn RoutineStorage>) -> Self;
fn attach(&mut self, runner: Arc<dyn RoutineRunner>);
fn runner(&self) -> Option<Arc<dyn RoutineRunner>>;
fn load(&mut self);
fn save(&mut self) -> bool;
fn routines_for(&self, bot_id: &str) -> Vec<Routine>;
fn routine(&self, id: &str) -> Option<&Routine>;
fn create(&mut self, bot_id: &str, title: &str, prompt: &str, schedule: Schedule, enabled: bool, now: DateTime<Utc>) -> Routine;
fn update(&mut self, routine: Routine);
fn delete(&mut self, id: &str);
fn set_enabled(&mut self, id: &str, enabled: bool);
fn due(&self, now: DateTime<Utc>) -> Vec<Routine>;
fn record(&mut self, routine: &Routine, firing: RoutineFiring, now: DateTime<Utc>) -> FiringRecord;
async fn fire(&mut self, routine: &Routine, now: DateTime<Utc>) -> FiringRecord;
async fn tick(&mut self, now: DateTime<Utc>) -> Vec<FiringRecord>;
}routines::Schedule#The three recurrence shapes.
pub enum Schedule {
EveryMinutes { minutes: i64 },
DailyAt { hour: u32, minute: u32 },
WeeklyOn { weekday: u32, hour: u32, minute: u32 },
}
impl Schedule {
fn next_fire(&self, reference: DateTime<Utc>) -> Option<DateTime<Utc>>;
fn label(&self) -> String;
}services::ServiceRoute#Where a service argument leads.
pub enum ServiceRoute {
Driver,
Mcp(String),
}
impl ServiceRoute {
fn name(&self) -> &str;
}services::ToolInfo#A tool description.
pub struct ToolInfo {
pub name: String,
pub description: String,
pub input_schema: Value,
pub output_schema: Option<Value>,
pub read_only: bool,
pub destructive: bool,
}services::ToolResult#A tool call's result, as MCP content parts.
pub struct ToolResult {
pub content: Vec<Value>,
pub structured: Option<Value>,
pub is_error: bool,
pub meta: Option<Value>,
}
impl ToolResult {
fn from_mcp(raw: Value) -> Self;
}ServiceSource#How a declared service is reached.
pub enum ServiceSource {
Sandbox(Service),
Fleet { fleet: FleetClient, bound: BoundSandbox, service: String },
Url(ServiceEndpoint),
}share::RelayRegistration#A Space published on the relay.
pub struct RelayRegistration {
pub space: String,
pub relay_space: String,
pub machine: String,
pub url: String,
pub online: bool,
}share::ShareAudit#One owner-side audit line (newest first in listings).
pub struct ShareAudit {
pub ts_ms: u64,
pub action: String,
pub space: String,
pub detail: String,
}share::ShareConsent#The user's confirmation before a Space is shared ...
pub trait ShareConsent: Send + Sync {
fn confirm(&self, reason: &str) -> Result<(), String>;
}share::ShareEntry#One person a Space is shared with.
pub struct ShareEntry {
pub who: String,
pub role: ShareRole,
pub connected: bool,
}share::ShareRole#What a person may do in a shared Space.
pub enum ShareRole {
Viewer,
Editor,
}
impl ShareRole {
fn parse(s: &str) -> Result<ShareRole>;
fn as_str(self) -> &'static str;
}share::SpaceShares#A Space's shares.
pub struct SpaceShares {
pub space: String,
pub machine: String,
pub invitee_space: String,
pub url: String,
pub online: bool,
pub shares: Vec<ShareEntry>,
}site_login::BrowserTab#The browser tab to sign in (cua-driver ids, all ...
pub struct BrowserTab {
pub session: Option<String>,
pub target_id: Option<String>,
pub tab_id: Option<String>,
}site_login::SiteLoginAsk#One sign-in request.
pub struct SiteLoginAsk {
pub target: String,
pub url: String,
pub username: Option<String>,
pub agent: Option<String>,
pub browser: BrowserTab,
pub relay_plaintext_ack: bool,
}site_login::SiteLoginBroker#The Keyvault operations request_site_login uses.
pub trait SiteLoginBroker: Send + Sync {
async fn request_login(&self, ask: &SiteLoginAsk) -> Result<String, SiteLoginError>;
async fn await_and_fill(&self, request_id: &str, ask: &SiteLoginAsk, timeout: Duration) -> Result<SiteLoginOutcome, SiteLoginError>;
}site_login::SiteLoginError#A Keyvault failure, surfaced with its code (denied ...
pub struct SiteLoginError {
pub code: String,
pub message: String,
}site_login::SiteLoginFilled#What a sign-in did.
pub struct SiteLoginFilled {
pub site: String,
pub origin: String,
pub username_hint: String,
pub submitted: bool,
pub page_url: String,
pub browser: BrowserTab,
}site_login::SiteLoginOutcome#The outcome of awaiting a decision and (when granted) ...
pub enum SiteLoginOutcome {
Pending,
Denied(String),
Filled(SiteLoginFilled),
}Space#A connected Space.
pub struct Space { /* private fields */ }
impl Space {
async fn app_icon(&self, app_name: &str, app_id: &str, pid: u32) -> Result<Option<AppIcon>>;
async fn app_icons(&self, requests: &[IconRequest]) -> Result<Vec<Option<AppIcon>>>;
fn shell_command(&self, line: &str) -> Command;
async fn bash(&self, command: &str, timeout: Duration) -> Result<BashOutput>;
async fn write(&self, path: &str, content: impl Into<Bytes>) -> Result<WriteReport>;
async fn home(&self) -> Result<String>;
fn services(&self) -> Vec<String>;
fn resolve_service(&self, service: Option<&str>) -> Result<ServiceRoute>;
async fn mcp(&self, service: &str) -> Result<Arc<McpClient>>;
async fn list_tools(&self, service: Option<&str>) -> Result<(Vec<ToolInfo>, String)>;
async fn call_tool(&self, service: Option<&str>, tool: &str, arguments: Map<String, Value>, timeout: Option<Duration>) -> Result<ToolResult>;
fn generic(id: SpaceId, name: impl Into<String>, services: BTreeMap<String, SpaceService>) -> Self;
fn attach(id: SpaceId, name: impl Into<String>, env: SpacesdClient, caps: GetCapabilitiesResponse, ws_headers: Vec<(String, String)>) -> Self;
fn with_services(self, services: BTreeMap<String, SpaceService>) -> Self;
fn image(&self) -> Option<(&str, &str)>;
fn platform(&self) -> (String, String);
fn id(&self) -> &SpaceId;
fn name(&self) -> &str;
fn provider(&self) -> Provider;
fn spacesd(&self) -> Result<&SpacesdClient>;
fn has_spacesd(&self) -> bool;
fn capabilities(&self) -> &GetCapabilitiesResponse;
fn declared_services(&self) -> &BTreeMap<String, SpaceService>;
fn env_token(&self) -> Option<&str>;
fn feature(&self, name: &str) -> Option<&Feature>;
fn supports(&self, name: &str) -> bool;
fn require(&self, name: &str) -> Result<()>;
fn require_any(&self, names: &[&str]) -> Result<()>;
fn os_family(&self) -> OsFamily;
fn is_windows(&self) -> bool;
async fn websocket_headers(&self) -> Result<Vec<(String, String)>>;
fn websocket_url(&self, ws_path: &str) -> Result<String>;
async fn agents(&self) -> Result<Agents>;
async fn send_file(&self, local: &Path, options: SendFileOptions) -> Result<SendFileReport>;
async fn upload(&self, local: &Path, dest: Option<&str>) -> Result<UploadReport>;
async fn download(&self, remote: &str, dest_dir: &Path) -> Result<DownloadReport>;
async fn start_hotspot(&self, options: HotspotOptions) -> Result<Hotspot>;
async fn hotspot_status(&self) -> Result<HotspotStatus>;
async fn stage_install_archives(&self, ids: &[&str], arch: &str, home: &str, events: UnboundedSender<StageEvent>) -> Result<Vec<String>>;
fn presence_participant(&self) -> Option<String>;
async fn join_presence(&self, identity: Identity, timeout: Duration) -> Result<PresenceSession>;
async fn join_presence_with(&self, identity: Identity, timeout: Duration, datagrams: bool) -> Result<PresenceSession>;
async fn set_presence_settings(&self, cursor_probe: Option<bool>) -> Result<()>;
async fn displays(&self) -> Result<Vec<DisplayInfo>>;
async fn window_thumbnail(&self, window_id: &str, epoch: u64, max_dimension: u32) -> Result<Option<Vec<u8>>>;
async fn usage(&self) -> Result<Usage>;
async fn stream_targets(&self, include_windows: bool) -> Result<ListTargetsResponse>;
async fn windows(&self, app: Option<&str>) -> Result<Vec<WindowTarget>>;
async fn all_windows(&self, app: Option<&str>) -> Result<Vec<WindowTarget>>;
async fn find_window(&self, app: &str) -> Result<WindowTarget>;
async fn open_stream(&self, target: StreamTarget, options: StreamOptions) -> Result<StreamTicket>;
async fn close_stream(&self, media_session_id: &str) -> Result<()>;
async fn stream_session(&self, target: StreamTarget, options: StreamOptions, frames: Arc<dyn FrameSink>, audio: Option<Arc<dyn AudioSink>>) -> Result<StreamSession>;
async fn attach_volume<D, F>(&self, dial: D, mount_path: Option<String>) -> Result<VolumeAttachment> where D: Fn(String, u16) -> F + Send + Sync + 'static, F: Future<Output = Result<TcpStream>> + Send + 'static;
fn volume_backend(&self) -> Option<String>;
async fn volume_status(&self) -> Result<VolumeGuestStatus>;
}SpaceCreate#Options for Spaces::create: the same location / kind ...
pub struct SpaceCreate {
pub image: Option<String>,
pub on: Option<On>,
pub kind: Kind,
pub runtime: Runtime,
pub name: Option<String>,
pub cpus: Option<u32>,
pub memory_mb: Option<u64>,
pub disk_gb: Option<u32>,
pub timeout: Option<Duration>,
pub wait: Option<bool>,
pub reuse: bool,
pub command: Option<Vec<String>>,
pub env: BTreeMap<String, String>,
pub services: BTreeMap<String, u16>,
pub spacesd: Option<bool>,
pub env_token: Option<String>,
pub progress: Option<ProgressSink>,
pub create_id: Option<String>,
pub gpu: Option<String>,
}SpaceCreated#What Spaces::create returns.
pub enum SpaceCreated {
Ready { info: SpaceInfo, reused: bool },
Starting(PendingSpace),
}
impl SpaceCreated {
fn ready(self) -> Result<SpaceInfo, PendingSpace>;
fn reused(&self) -> bool;
}SpaceId#A parsed Space id.
pub enum SpaceId {
Cloud { name: String, namespace: Option<String> },
Local { name: String },
Direct { authority: String },
Relay { machine_id: String },
}
impl SpaceId {
fn parse(input: &str) -> Result<Self>;
fn from_ref(r: SandboxRef) -> Option<Self>;
fn to_ref(&self) -> SandboxRef;
fn provider(&self) -> Provider;
fn short_name(&self) -> &str;
}SpaceInfo#A registered Space as listed, whether or not it is ...
pub struct SpaceInfo {
pub id: String,
pub name: String,
pub provider: Provider,
pub spacesd_version: String,
pub features: Vec<String>,
pub os: String,
pub os_name: String,
pub os_pretty_name: String,
pub image: String,
pub image_digest: String,
pub kind: String,
pub arch: String,
pub services: Vec<String>,
pub added_at: Option<String>,
pub host: String,
pub host_name: String,
pub power: String,
pub power_state: String,
pub cloud: String,
pub cloud_place: String,
pub cloud_delete: String,
}SpacePower#What crate::Spaces::stop or crate::Spaces::start ...
pub struct SpacePower {
pub space: String,
pub state: String,
pub power: String,
pub message: String,
}
impl SpacePower {
fn new(space: &str, control: PowerControl, state: PowerState) -> Self;
}Spaces#The Spaces runtime: a registry of spacesd sandboxes and ...
pub struct Spaces { /* private fields */ }
impl Spaces {
fn cloud_sandbox_of(&self, space: &str) -> Result<Option<String>>;
async fn cancel_create(&self, key: &str) -> Result<CancelOutcome>;
async fn hosts(&self) -> Result<Vec<HostOffer>>;
async fn resolve_host(&self, query: &str) -> Result<ResolvedHost>;
async fn add_direct_host(&self, url: &str, token: Option<String>, name: Option<String>) -> Result<SpaceInfo>;
async fn host_spaces(&self, host: &str) -> Result<GetHostSpacesResponse>;
fn builder() -> SpacesBuilder;
fn home_dir(&self) -> &Path;
fn registry(&self) -> &Registry;
fn fleet(&self) -> Option<&FleetClient>;
fn sandboxes(&self) -> &Sandboxes;
fn operator_display(&self) -> &Arc<dyn OperatorDisplay>;
fn fleet_namespace(&self) -> &str;
fn list(&self) -> Result<Vec<SpaceInfo>>;
async fn list_all(&self) -> Result<Vec<SpaceInfo>>;
fn relay_account(&self) -> Option<RelayAccount>;
fn set_site_login_broker(&self, broker: Option<Arc<dyn SiteLoginBroker>>);
fn site_login_broker(&self) -> Option<Arc<dyn SiteLoginBroker>>;
fn set_share_consent(&self, consent: Option<Arc<dyn ShareConsent>>);
fn has_share_consent(&self) -> bool;
fn set_relay(&self, relay: Option<RelayAccount>);
async fn relay_machines(&self) -> Result<Vec<RelayMachine>>;
fn resolve(&self, space: &str) -> Result<SpaceId>;
async fn add(&self, url: &str, token: Option<String>, name: Option<String>) -> Result<SpaceInfo>;
async fn add_with_service(&self, url: &str, token: Option<String>, name: Option<String>, service: Option<String>) -> Result<SpaceInfo>;
async fn remove(&self, space: &str) -> Result<SpaceInfo>;
async fn space(&self, space: &str) -> Result<Space>;
async fn forget_connection(&self, space: &str) -> Result<()>;
async fn create(&self, opts: SpaceCreate) -> Result<SpaceCreated>;
async fn gpu_support(&self, on: &On) -> Vec<GpuSupport>;
fn fleet_pool_name(&self, runtime: FleetRuntime, image: &str) -> String;
async fn recover_interrupted_creates(&self, budget: Duration) -> Vec<RecoveredCreate>;
async fn delete(&self, space: &str) -> Result<String>;
fn power_of(&self, id: &str) -> (String, String);
async fn stop(&self, space: &str) -> Result<SpacePower>;
async fn start(&self, space: &str) -> Result<SpacePower>;
fn download_dir(&self) -> &Path;
fn extensions(&self) -> &[Arc<dyn SpacesExtension>];
fn extension<T: SpacesExtension>(&self) -> Option<&T>;
fn extension_for(&self, tool: &str) -> Option<&Arc<dyn SpacesExtension>>;
async fn call_extension(&self, what: &str, op: &str, args: Value) -> Result<Value>;
async fn hotspot_start(&self, space: &str, options: HotspotOptions) -> Result<HotspotStatus>;
async fn hotspot_stop(&self, space: Option<&str>) -> Result<Vec<String>>;
async fn hotspot_statuses(&self, space: Option<&str>) -> Result<Vec<HotspotStatus>>;
fn share_audit(&self, space: Option<&str>, limit: usize) -> Result<Vec<ShareAudit>>;
async fn share_space(&self, space: &str, who: &str, role: ShareRole) -> Result<SpaceShares>;
async fn unshare_space(&self, space: &str, who: Option<&str>) -> Result<SpaceShares>;
async fn relay_register(&self, space: &str) -> Result<RelayRegistration>;
async fn relay_unregister(&self, space: &str) -> Result<bool>;
async fn space_shares(&self, space: &str) -> Result<SpaceShares>;
}SpacesBuilder#Builder for Spaces.
pub struct SpacesBuilder { /* private fields */ }
impl SpacesBuilder {
fn share_consent(self, consent: Arc<dyn ShareConsent>) -> Self;
fn extension(self, extension: Arc<dyn SpacesExtension>) -> Self;
fn relay(self, relay: RelayAccount) -> Self;
fn home(self, dir: impl Into<PathBuf>) -> Self;
fn fleet(self, fleet: FleetClient) -> Self;
fn local_runtime(self, runtime: Arc<dyn LocalRuntime>) -> Self;
fn sandboxes(self, sandboxes: Sandboxes) -> Self;
fn fleet_namespace(self, ns: impl Into<String>) -> Self;
fn operator_display(self, display: Arc<dyn OperatorDisplay>) -> Self;
fn probe_timeout(self, timeout: Duration) -> Self;
fn download_dir(self, dir: impl Into<PathBuf>) -> Self;
fn build(self) -> Spaces;
}SpaceService#A service a Space declares (an MCP server, a web app ...
pub struct SpaceService {
pub source: ServiceSource,
pub mcp_path: String,
}
impl SpaceService {
async fn endpoint(&self) -> Result<ServiceEndpoint>;
async fn mcp_config(&self) -> Result<McpConfig>;
}stream::AudioPacket#One audio packet of a negotiated track.
pub struct AudioPacket {
pub track_id: u16,
pub sequence: u32,
pub pts_us: u64,
pub frame_samples: u16,
pub lost: u32,
pub dtx: bool,
pub data: Vec<u8>,
}stream::AudioSink#Receives audio packets on the session's delivery thread.
pub trait AudioSink: Send + Sync {
fn on_audio(&self, packet: AudioPacket);
}stream::DisplayInfo#One of the Space's displays (Comput ...
pub struct DisplayInfo {
pub id: String,
pub name: String,
pub primary: bool,
pub width_px: u32,
pub height_px: u32,
pub scale_factor: f64,
}stream::FrameSink#Receives video frames and control events.
pub trait FrameSink: Send + Sync {
fn on_frame(&self, frame: VideoFrame);
fn on_event(&self, _event: StreamEvent);
}stream::StreamClient#The streaming client behind StreamSession: it ...
pub trait StreamClient: Send + Sync + 'static {
fn attach<'a>(&'a self, ticket: &'a StreamTicket, headers: &'a [(String, String)], frames: Arc<dyn FrameSink>, audio: Option<Arc<dyn AudioSink>>) -> BoxFuture<'a, Result<Box<dyn StreamConnection>>>;
}stream::StreamConnection#One attached media socket (see StreamClient).
pub trait StreamConnection: Send + Sync {
fn media_session_id(&self) -> &str;
fn codec(&self) -> &str;
fn is_closed(&self) -> bool;
fn is_open(&self) -> bool;
fn stats(&self) -> StreamStats;
fn request_keyframe(&self) -> Result<()>;
fn send_input(&self, events: Vec<Value>) -> Result<()>;
fn send_text(&self, json: String) -> Result<()>;
fn close(&mut self, wait: Duration) -> BoxFuture<'_, ()>;
}stream::StreamEvent#A control event.
pub enum StreamEvent {
Opened(Value),
AudioConfigured(Value),
Lifecycle(Value),
Stats(Value),
Message(Value),
Closed { code: u16, reason: String },
}stream::StreamOptions#Options for Space::open_stream.
pub struct StreamOptions {
pub codecs: Vec<MediaCodec>,
pub max_fps: u32,
pub max_dimension: u32,
pub audio: bool,
pub ticket_ttl: Option<Duration>,
pub policy: Option<SessionPolicy>,
}stream::StreamSession#A live media session.
pub struct StreamSession { /* private fields */ }
impl StreamSession {
async fn attach(ticket: &StreamTicket, headers: &[(String, String)], frames: Arc<dyn FrameSink>, audio: Option<Arc<dyn AudioSink>>) -> Result<StreamSession>;
fn media_session_id(&self) -> &str;
fn codec(&self) -> &str;
fn is_closed(&self) -> bool;
fn is_open(&self) -> bool;
fn stats(&self) -> StreamStats;
fn request_keyframe(&self) -> Result<()>;
fn send_input<E: Serialize>(&self, events: Vec<E>) -> Result<()>;
fn send_text(&self, json: String) -> Result<()>;
async fn close(self) -> Result<StreamStats>;
}stream::StreamStats#Delivery counters.
pub struct StreamStats {
pub frames: u64,
pub keyframes: u64,
pub frames_dropped: u64,
pub frames_gated: u64,
pub keyframe_requests: u64,
pub audio_packets: u64,
pub audio_lost: u64,
pub events: u64,
pub malformed: u64,
}stream::StreamTarget#Which surface to stream.
pub enum StreamTarget {
Display(Option<String>),
Window(String),
}stream::StreamTicket#A minted media session: everything a client needs to ...
pub struct StreamTicket {
pub space: String,
pub media_session_id: String,
pub ws_url: String,
pub ticket: String,
pub ticket_expires_at: Option<String>,
pub codec: String,
pub wire_version: u32,
pub frame_size: [u32; 2],
pub needs_gateway_headers: bool,
pub raw: OpenMediaResponse,
}stream::Usage#Memory and storage use (SystemService.Metrics).
pub struct Usage {
pub memory_used: u64,
pub memory_total: u64,
pub memory_limited: bool,
pub disk_used: u64,
pub disk_total: u64,
pub disk_limited: bool,
}stream::VideoFrame#One encoded video access unit, keyframe-gated by the ...
pub struct VideoFrame {
pub sequence: u64,
pub codec: String,
pub keyframe: bool,
pub width: u32,
pub height: u32,
pub capture_timestamp_us: u64,
pub codec_epoch: u64,
pub geometry_epoch: u64,
pub data: Vec<u8>,
}stream::WindowTarget#A window target as listed.
pub struct WindowTarget {
pub window_id: String,
pub epoch: u64,
pub title: String,
pub app_name: String,
pub app_id: String,
pub pid: u32,
pub bounds: [f64; 4],
pub on_screen: bool,
pub focused: bool,
pub available: bool,
pub limitation: String,
}
impl WindowTarget {
fn is_streamable(&self) -> bool;
}teleport_broker::SessionBroker#The Keyvault operations teleport_app uses.
pub trait SessionBroker: Send + Sync {
async fn request_access(&self, app: &str, target: &str, duration_secs: u64, reason: &str) -> Result<String, SessionBrokerError>;
async fn await_and_deliver(&self, app: &str, target: &str, request_id: &str, timeout: Duration) -> Result<SessionDelivery, SessionBrokerError>;
}teleport_broker::SessionBrokerError#A Keyvault failure, surfaced to the tool with its code.
pub struct SessionBrokerError {
pub code: String,
pub message: String,
}teleport_broker::SessionDelivery#The outcome of awaiting and (when granted) performing a ...
pub enum SessionDelivery {
Pending,
Denied(String),
Delivered { app: String, target: String, items: Vec<String>, imported: Vec<String>, import_ids: Vec<String>, expires_ms: u64 },
}volume::VolumeAttachment#A mounted volume in a Space.
pub struct VolumeAttachment { /* private fields */ }
impl VolumeAttachment {
fn volume_id(&self) -> &str;
fn mount_path(&self) -> &str;
fn backend(&self) -> &str;
fn is_live(&self) -> bool;
async fn wait_mounted(&self, timeout: Duration) -> Result<VolumeGuestStatus>;
async fn detach(self) -> Result<()>;
}volume::VolumeGuestStatus#The guest's view of its mount.
pub struct VolumeGuestStatus {
pub state: String,
pub mount_path: String,
pub backend: String,
pub detail: String,
pub bytes_in: u64,
pub bytes_out: u64,
}walk::Walk#The result of walk.
pub struct Walk {
pub entries: Vec<WalkEntry>,
pub skipped: Vec<String>,
}walk::WalkEntry#One file or directory to transfer.
pub struct WalkEntry {
pub path: PathBuf,
pub rel: String,
pub is_dir: bool,
pub size: u64,
pub mode: u32,
pub modified: Option<SystemTime>,
}/// Whether `image` is expected to run ...
pub fn expects_spacesd(image: Option<&str>, explicit: Option<bool>) -> bool
/// The key a Fleet pool is named after ...
pub fn pool_key(image: &str, command: Option<&[String]>, env: &BTreeMap<String, String>, services: &BTreeMap<String, u16>) -> String
/// Lowercase DNS label: `[a-z0-9-]` ...
pub fn sanitize_label(value: &str) -> String
/// `pool_key` plus the size ...
pub fn sized_pool_key(image: &str, command: Option<&[String]>, env: &BTreeMap<String, String>, services: &BTreeMap<String, u16>, cpus: Option<u32>, memory_mb: Option<u32>) -> String
// mod app_icon
/// The guest script for a batch: looks ...
pub fn batch_script(p: IconPlatform, requests: &[IconRequest], bundle: &str) -> String
/// What the bytes are: a PNG or an SVG ...
pub fn content_type(bytes: &[u8]) -> Option<&'static str>
/// The app's stable identity in the icon ...
pub fn icon_identity(app_name: &str, app_id: &str) -> String
/// The guest script: prints the path of ...
pub fn icon_script(p: IconPlatform, app_name: &str, app_id: &str, pid: u32, out: &str) -> String
/// The files in a bundle `batch_script` ...
pub fn parse_bundle(bytes: &[u8]) -> Vec<(usize, Vec<u8>)>
/// The path the script printed: its last ...
pub fn printed_path(stdout: &str) -> Option<&str>
/// A name safe to splice into the script ...
pub fn shell_word(s: &str) -> String
// mod cloud
/// Whether a relay machine is a Space in ...
pub fn is_cloud_machine(m: &RelayMachine) -> bool
// mod exec
/// The tail of `text`, with a marker when ...
pub fn cap_output(text: &str) -> String
// mod extension
/// The JSON a `ToolOutcome` carries (its ...
pub fn outcome_json(out: ToolOutcome) -> Result<Value>
// mod files
/// Normalizes a `send_file` target to a ...
pub fn downloads_subdir(target: Option<&str>, home: Option<&str>) -> Result<String>
// mod fleet_runtime
/// `resolve` with the image evidence ...
pub fn check(runtime: Option<FleetRuntime>, image: &str, evidence: &ImageEvidence) -> Result<RuntimeKind>
/// The default Space image: the canonical ...
pub fn default_image(_runtime: FleetRuntime) -> String
/// The guest OS (`linux`, `windows` ...
pub fn guest_os(image: &str, resolved_os: Option<&str>) -> String
/// `guest_os` with the catalog lookup ...
pub fn guest_os_with(image: &str, catalog_os: Option<String>, resolved_os: Option<&str>) -> String
/// The tag of an image reference (see ...
pub fn image_tag(image: &str) -> Option<&str>
/// Parses the wire spelling of a runtime ...
pub fn parse_runtime(value: &str) -> Result<FleetRuntime>
/// Validates the runtime/image pairing ...
pub async fn resolve(runtime: Option<FleetRuntime>, image: &str) -> Result<RuntimeKind>
/// `resolve` returning the whole ...
pub async fn resolve_image(runtime: Option<FleetRuntime>, image: &str) -> Result<FleetImage>
// mod groups
/// Whether a Create button should be ...
pub fn can_create(members: &[String]) -> bool
/// The framing each member receives: the ...
pub fn frame_message(text: &str, title: &str, others: &[String]) -> String
// mod host_spaces
/// The relay URL a Space on this host ...
pub fn guest_relay_url(relay_url: &str, kind: &str) -> String
/// A `tonic::Status` carrying a ...
pub fn to_status(e: &Error) -> Status
// mod hotspot
/// The default dialer: plain TCP from this ...
pub fn direct_dialer() -> Dialer
// mod id
/// Canonicalizes a stored id (legacy ...
pub fn canonical_id(id: &str) -> String
// mod install_cache
/// The host cache directory.
pub fn cache_dir() -> PathBuf
/// `a` in the host cache under `dir` ...
pub async fn fetch(dir: &Path, a: &StagedArchive, progress: &mut dyn FnMut(u64, u64) + Send) -> Result<PathBuf>
/// Whether to stage through the host for a ...
pub fn wanted(url: &Url) -> bool
// mod presence
/// The stable presence color of an agent ...
pub fn color_for(id: &str) -> &'static str
/// Local Unix time in milliseconds, the ...
pub fn now_ms() -> f64
/// Registers the presence datagram channel ...
pub fn register_presence_datagrams(channel: Arc<dyn PresenceDatagrams>)
/// Black or white, whichever reads better ...
pub fn text_color_on(background: &str) -> &'static str
// mod presence::art
/// The art for every shape, in wire order.
pub fn all_cursor_art() -> &'static [CursorArt]
/// The art for `shape`.
pub fn cursor_art(shape: CursorShape) -> &'static CursorArt
/// A standalone SVG of `shape` filled with ...
pub fn cursor_art_svg(shape: CursorShape, color: &str, size: f64) -> String
// mod presence::view
/// Opacity of a cursor idle for `idle_ms`.
pub fn idle_alpha(idle_ms: f64) -> f64
// mod registry
/// The cua home: `$CUA_HOME`, else ...
pub fn cua_home() -> PathBuf
// mod routines
/// `8:05 AM`.
pub fn clock_label(hour: u32, minute: u32) -> String
/// A fresh id (UUID v4 form, upper case ...
pub fn new_id() -> String
/// The background loop: one for every ...
pub fn spawn_scheduler(store: Arc<Mutex<RoutineStore>>, every: Duration) -> JoinHandle<()>
/// One tick against a shared store ...
pub async fn tick_shared(store: &Mutex<RoutineStore>, now: DateTime<Utc>) -> Vec<FiringRecord>
// mod routines::iso
pub fn deserialize<'de, D: Deserializer<'de>>(d: D) -> Result<DateTime<Utc>, D::Error>
pub fn format(d: &DateTime<Utc>) -> String
pub fn parse(s: &str) -> Result<DateTime<Utc>, ParseError>
pub fn serialize<S: Serializer>(d: &DateTime<Utc>, s: S) -> Result<S::Ok, S::Error>
// mod routines::iso::option
pub fn deserialize<'de, D: Deserializer<'de>>(d: D) -> Result<Option<DateTime<Utc>>, D::Error>
pub fn serialize<S: Serializer>(d: &Option<DateTime<Utc>>, s: S) -> Result<S::Ok, S::Error>
// mod services
/// Converts a `CallToolResponse` into MCP ...
pub fn tool_result(resp: CallToolResponse) -> ToolResult
// mod share
/// Moves `who` onto the list for `role` ...
pub fn apply_share(allow: &mut Vec<String>, viewers: &mut Vec<String>, who: &str, role: Option<ShareRole>)
/// Normalizes an invitee: an email ...
pub fn normalize_who(who: &str) -> Result<String>
// mod site_login
/// The `request_site_login` tool: files a ...
pub async fn request_site_login(spaces: &Spaces, a: RequestSiteLogin, agent: Option<String>) -> Result<Value>
// mod stream
/// Whether a streaming client is ...
pub fn has_stream_client() -> bool
/// The words a person sees for input the ...
pub fn input_refusal_text(message: &str) -> Option<&'static str>
/// Registers the streaming client for this ...
pub fn register_stream_client(client: Arc<dyn StreamClient>)
// mod walk
/// A single file as a walk entry named ...
pub fn single(path: &Path, name: &str) -> Result<WalkEntry>
/// Enumerates everything under `root` (not ...
pub fn walk(root: &Path, respect_ignore_files: bool) -> Result<Walk>/// Default time allowed for the ...
pub const DEFAULT_PROBE_TIMEOUT: Duration = _;
/// The spacesd pseudo-feature every ...
pub const SPACESD_FEATURE: &str = "spacesd";
// mod app_icon
/// How long the guest script may run.
pub const ICON_SCRIPT_TIMEOUT: Duration = _;
/// Largest icon file accepted.
pub const MAX_ICON_BYTES: usize = _;
// mod audit
/// The chain's first `prev`.
pub const GENESIS: &str = /* ... */;
// mod cloud
/// `SpaceInfo::cloud_delete`: only the ...
pub const DELETE_ELSEWHERE: &str = "elsewhere";
/// `SpaceInfo::cloud_delete`: this home ...
pub const DELETE_HERE: &str = "here";
// mod exec
/// Default `space_bash` timeout.
pub const DEFAULT_BASH_TIMEOUT: Duration = _;
/// Characters of each output stream kept ...
pub const MAX_OUTPUT_CHARS: usize = 16_000;
// mod files
/// Chunk used when the driver does not say.
pub const DEFAULT_SEND_CHUNK: usize = _;
/// Largest chunk sent to ...
pub const MAX_SEND_CHUNK: usize = _;
// mod groups
pub const MAX_BOTS: usize = 6;
/// The product bound: a group of one is a ...
pub const MIN_BOTS: usize = 2;
// mod host_spaces
/// Metadata carrying the relay-verified ...
pub const CALLER_METADATA: &str = "x-cua-host-caller";
/// The spacesd feature a host reports ...
pub const HOST_SPACES_FEATURE: &str = "host_spaces";
// mod presence
/// Roster heartbeat interval the SDK asks ...
pub const HEARTBEAT_INTERVAL: Duration = _;
/// The cursor palette, in the server's ...
pub const PALETTE: &[&str] = _;
/// Shortest interval between two cursor ...
pub const SEND_INTERVAL: Duration = _;
// mod presence::art
/// The art JSON, verbatim.
pub const CURSOR_ART_JSON: &str = /* ... */;
// mod presence::view
/// The conformance vectors every ...
pub const CONFORMANCE_JSON: &str = /* ... */;
/// Render delay on the 30 Hz datagram ...
pub const DATAGRAM_DELAY_MS: f64 = 66.0;
/// Longest extrapolation past the newest ...
pub const EXTRAPOLATE_MS: f64 = 100.0;
/// Heartbeat interval the SDKs ask for.
pub const HEARTBEAT_INTERVAL_MS: f64 = 5_000.0;
/// Missed heartbeats before everyone else ...
pub const HEARTBEAT_MISSES: f64 = 3.0;
/// A cursor idle this long starts fading.
pub const IDLE_FADE_AFTER_MS: f64 = 5_000.0;
/// Fade duration.
pub const IDLE_FADE_MS: f64 = 300.0;
/// A jump longer than this (normalized ...
pub const SNAP_DISTANCE: f64 = 0.25;
/// Render delay on the 20 Hz `Join` stream.
pub const STREAM_DELAY_MS: f64 = 100.0;
// mod registry
/// File name of the 0600 credential store.
pub const CREDENTIALS_FILE: &str = "spaces-credentials.json";
/// File name of the direct-host list.
pub const DIRECT_HOSTS_FILE: &str = "direct-hosts.json";
/// Advisory lock file serializing writers ...
pub const LOCK_FILE: &str = "spaces.lock";
/// File name of the registry.
pub const SPACES_FILE: &str = "spaces.json";
// mod routines
/// Marks a routine-originated turn in a ...
pub const ROUTINE_PREFIX: &str = "[routine]";
// mod services
/// Names that mean "the Space's own ...
pub const DRIVER_ALIASES: [&str; 5] = _;
/// The service name of the spacesd's own ...
pub const DRIVER_SERVICE: &str = "driver";
// mod share
/// The spacesd feature a Space needs to be ...
pub const RELAY_ATTACH_FEATURE: &str = "relay_attach";
// mod site_login
/// Default and maximum wait for the user's ...
pub const DEFAULT_WAIT_SECS: u32 = 20;
/// See `DEFAULT_WAIT_SECS`.
pub const MAX_WAIT_SECS: u32 = 120;
// mod stream
/// Bound of the delivery queue.
pub const DELIVERY_QUEUE: usize = 256;
/// A window narrower or shorter than this ...
pub const MIN_STREAMABLE_SIDE: f64 = 40.0;
// mod volume
/// The guest feature.
pub const VOLUME_FEATURE: &str = "volume.mount";
// mod walk
/// Directories always skipped when ignore ...
pub const ALWAYS_IGNORED_DIRS: [&str; 1] = _;
/// Upper bound on entries in one transfer ...
pub const MAX_ENTRIES: usize = 200_000;
/// Ignore files honored in every directory.
pub const NESTED_IGNORE_FILES: [&str; 2] = _;
/// Ignore files honored at the transfer ...
pub const ROOT_ONLY_IGNORE_FILES: [&str; 1] = _;/// A machine row of the relay directory.
pub type RelayMachine = Machine;
/// Result alias.
pub type Result<T, E = Error> = Result<T, E>;
// mod extension
/// A boxed, `Send` future (the extension ...
pub type BoxFuture<'a, T> = Pin<Box<dyn Future<Output = T> + Send + 'a>>;
// mod hotspot
/// How this machine dials the guest's ...
pub type Dialer = Arc<dyn Fn(String, u16) -> Pin<Box<dyn Future<Output = Result<TcpStream>> + Send>> + Send + Sync>;
// mod presence
/// An open presence datagram channel: the ...
pub type DatagramChannel = (Arc<dyn CursorUplink>, Receiver<PresenceEvent>);cua_sandbox_core::byoc::CloudCheck, cua_sandbox_core::byoc::CloudConnected, cua_sandbox_core::byoc::CloudCredentials, cua_sandbox_core::byoc::CloudDisconnected, cua_sandbox_core::byoc::CloudKind, cua_sandbox_core::byoc::CloudProvider, cua_sandbox_core::byoc::CloudResource, cua_sandbox_core::byoc::CloudStatusReport, cua_sandbox_core::byoc::CloudSweepItem, cua_sandbox_core::byoc::CloudSweepReport, cua_sandbox_core::byoc::CloudTarget, cua_sandbox_core::byoc::CloudTestReport, cua_spaces_contract, spaces::CreatePhase, spaces::CreateProgress, cua_spacesd_client, cua_host::relay::AccountTokens, cua_host::ConnectedClient, cua_host::DEFAULT_RELAY_URL, cua_host::DeviceAuth, cua_host::Identity, cua_host::relay::NoAccount, cua_host::relay_url_from_env, cua_host::relay::StaticToken.