Skip to main content

Crate solari

Crate solari 

Source
Expand description

§solari-sdk

Rust binding for the Solari sandbox SDK (core surface). Talks the same wire protocol as the reference @solarisdk/core TypeScript package:

  • REST to the gateway for session lifecycle (create/connect/get/kill) and the one-shot /exec fast path.
  • Control WebSocket (newline-delimited JSON-RPC) for everything a live session does: commands, files, code.run, and the client-side git namespace.
use solari::{Client, ClientOptions, CreateOptions, RunOptions};

let client = Client::new(ClientOptions::with_api_key("slr_live_…"))?;
let sbx = client.create(CreateOptions { template: Some("base".into()), ..Default::default() }).await?;
let out = sbx.commands().run("echo", RunOptions::new().args(["hello"])).await?;
println!("exit={} stdout={}", out.exit_code, out.stdout);
let status = sbx.git().status(Some("/repo")).await?;
println!("branch={} clean={}", status.branch, status.clean);

Structs§

AsyncFrame
A v2 async STREAM frame delivered to a registered handler.
Chart
Structured representation of a matplotlib figure. elements is kept as raw JSON so new chart types don’t require an SDK bump.
ChartAxis
One axis of a 2D chart.
Client
Talks the SDK ⇆ Gateway /sandboxes REST API and hands back Sandboxes.
ClientOptions
Options for constructing a Client.
Code
The ergonomic code accessor returned by Sandbox::code().
CodeResultItem
One rich result object from code.run.
CommandHandle
A started command handle (commands.start).
CommandIo
A cloneable handle on a running command’s input side: write or close stdin and send signals while another task is blocked in CommandHandle::wait (which consumes the handle). Get one with CommandHandle::io.
CommandResult
Terminal result of commands.run (also the /exec fast-path response).
Commands
The ergonomic commands accessor returned by Sandbox::commands().
ControlChannel
The shared control-WS transport. Construct one per live session handle.
CreateOptions
Options accepted by POST /sandboxes (headless sandbox flavour).
CreateSandboxRequest
Wire body for POST /sandboxes. Null/unset fields are omitted.
CreateSandboxResponse
201 response from POST /sandboxes.
Files
The ergonomic files accessor returned by Sandbox::files().
FsEntry
One directory entry (fs.list). Matches the reference types.ts FsEntry: the wire field is dir (bool), NOT isDir; there is no path/mode/modTime.
FsStat
File metadata (fs.stat). Matches the reference types.ts FsStat: fields dir (bool), mode (int), and modTimeMs (unix-millis).
GatewayErrorBody
Shape gateway error bodies may take.
Git
The ergonomic git accessor returned by Sandbox::git().
GitBranch
One branch entry (git.branches).
GitCloneOptions
Options for git.clone.
GitCommit
One commit record (git.log).
GitCommitOptions
Options for git.commit.
GitLogOptions
Options for git.log.
GitRemoteOptions
Options for git.push / git.pull.
GitStatus
Working-tree status (git.status).
HttpOptions
Options for constructing an HttpTransport.
HttpTransport
Lifecycle
Idle lifecycle policy (pause/kill on timeout; optional auto-resume).
ResumeResponse
POST /sandboxes/:id/resume reply. The gateway may hand back a fresh controlUrl (the session lands on a new slot, so the old one is stale); Client::resume derives one when it does not.
RunCodeOptions
Options for code.run.
RunCodeResult
Result of code.run, with the client-side charts convenience view.
RunOptions
Options for commands.run / commands.start.
Sandbox
A live sandbox handle. Exposes the core namespaces.
SandboxView
GET /sandboxes/:id response (subset used by connect).
StartResponse
POST /sandboxes/:id/start reply. control_url is a fresh URL (the sandbox was cold-booted); already_running is set when it was already running.
VolumeAttachment
One attach-at-create instruction: a persistent volume and the absolute in-guest path to mount it at. The mount happens host-side before the guest starts, and survives pause/resume and recreate.

Enums§

ChartType
Kind of a structured chart extracted from a matplotlib figure.
SolariError
Every error raised by the SDK. Corresponds to the SolariError hierarchy in the TypeScript reference (AuthError / PlanError / ConcurrencyLimitError / NoCapacityError / GatewayError / ActionError / TimeoutError / ConnectionError).

Constants§

DEFAULT_BASE_URL
The hosted Solari API, used when ClientOptions::base_url is empty.

Traits§

GitRunner
The seam the git namespace runs commands through. Sandbox implements it by delegating to commands.run("git", …); tests implement a recording stub.

Functions§

new_idempotency_key
A fresh idempotency key. Not a real UUID (no uuid dep) but unique + opaque, which is all the gateway requires. Format resembles a v4 UUID.

Type Aliases§

OutputCallback
A streamed-output callback (stdout/stderr). Fn(&str).