Expand description
Rust SDK for the Heyo cloud sandbox API.
Mirrors sdk-ts/ (@heyocomputer/sdk). The public surface is centered
on three handles:
Sandbox— VM lifecycle, with.commands()and.files()sub-clients and an interactive WebSocketShellSession.Database— cloud sqlite databases with exec, connection tokens, and checkout/checkin for offline editing.HeyoClient— the underlying HTTP transport. Built fromHeyoClientOptions(or constructed implicitly by the high-levelcreate/connecthelpers).
use heyo_sdk::{Sandbox, SandboxCreateOptions, HeyoClientOptions};
let sandbox = Sandbox::create(
SandboxCreateOptions { image: Some("ubuntu:24.04".into()), ..Default::default() },
HeyoClientOptions::default(),
).await?;
let out = sandbox.commands().run("echo hi", Default::default()).await?;
assert_eq!(out.stdout.trim(), "hi");
sandbox.kill().await?;Structs§
- Archive
DirOptions - Archive
Result - Batch
Result - Bound
Url - Checkin
Options - Checkin
Result - Checkout
Result - Command
Result - Command
RunOptions - Commands
- Command-execution surface, obtained via
crate::Sandbox::commands. - Connection
Token - Connection
Token Info - Connection
Token Options - Daemon
Info - A daemon the authenticated user has registered with the cloud.
- Daemons
- Static API for managing the caller’s registered daemons.
- Database
- Database
Create Options - Database
Info - Exec
Options - Exec
Result - File
Options - Options for
Files::read/Files::write. - Files
- File-system surface, obtained via
crate::Sandbox::files. - Heyo
Client - Heyo
Client Options - Construction options for
HeyoClient. MirrorsHeyoClientOptionsinsdk-ts/src/client.ts. - Network
- Network
Create Options - Network
Info - Network
Member - Network
Member Registration - Network
Service - A private service route registered in a network — a
name:portaddress other members can reach. Whenconnection_urlis set the service has a live iroh proxy route; otherwise it’sagent_proxy_pendinguntil someone runsheyvm network expose-service. - Network
Update Options - P2pTunnel
- A live P2P tunnel: a local TCP listener forwarding to a remote peer’s TCP
service over iroh. The background forwarding task is aborted on
Drop, which closes the local listener — hold this value for as long as the tunnel is needed. - Public
Image - Request
Options - Optional per-request knobs.
- Sandbox
- Sandbox
Create Options - Options accepted by
Sandbox::create. All fields exceptimage/regionmay be left unset; the server applies defaults. - Sandbox
Info - Service
Route - Result of dialing a service: a live route to it.
connection_urlis aheyo://ticket consumable byP2pTunnel::connect. - Shell
Options - Options for
crate::Sandbox::shell. - Shell
Reconnect Options - Reconnect tuning.
- Shell
Session - A live shell session. Use
output()for stdout chunks,events()for lifecycle events, andwrite()/resize()/close()to drive it. - SqlStatement
Enums§
- Connection
Scope - Daemon
Status - Status the cloud reports for a registered daemon. Derived from the cloud’s
stale-host watcher:
Onlinemeans a fresh heartbeat within ~3 minutes,Stalemeans missed heartbeats,Offlinemeans the cloud has flipped the row away fromavailable. - File
Content - Discriminated content for
Files::write.Stringis encoded as UTF-8;Bytesis written verbatim. - Heyo
Error - Every fallible call in the SDK returns
Result<T, HeyoError>. Variants mirror the TypeScript SDK’s error classes so the same recovery patterns translate across languages. - Network
Member Kind - Sandbox
Driver - Sandbox
Region USorEU. The wire field is uppercase; we preserve that.- Sandbox
Size - Sandbox
Status - Lifecycle states the cloud reports.
- Shell
Event - Lifecycle events emitted on the session’s event stream.
- SqlTransaction
Mode - SqlValue
- SQL bind values. The cloud only accepts these scalars.
Constants§
- DEFAULT_
LOCAL_ BASE_ URL - Default base URL for a local heyvm API (the
heyvmddaemon’s--api-port). Used byHeyoClient::localso desktop apps can drive a same-machine sandbox without the cloud in the data path.
Functions§
- archive_
dir - Tar+gzip
local_pathand upload it as a sandbox archive.