sail/lib.rs
1//! `sail-rs`: the canonical, typed Sail SDK.
2//!
3//! [`Client`] is the entry point: a cheap-to-clone async handle that owns
4//! configuration and transport (HTTP for lifecycle/app, gRPC for per-sailbox
5//! exec and file streams). Bindings (the Python extension, the TypeScript
6//! napi addon, and the CLI) are thin layers over it.
7//!
8//! As a library, this crate documents its whole public API and never writes to
9//! the process streams or exits: callers decide how to surface output and
10//! errors.
11//!
12//! The transport plumbing the bindings reach into lives under the hidden
13//! [`internal`] module; it is not part of the public API and carries no
14//! stability guarantee.
15#![deny(missing_docs)]
16#![deny(clippy::print_stdout, clippy::print_stderr, clippy::exit)]
17
18pub mod app;
19pub mod client;
20pub mod config;
21pub mod error;
22pub mod exec;
23pub mod guest;
24pub mod image;
25pub mod imagebuild;
26pub mod sailbox;
27pub mod shell;
28
29pub use worker::{
30 FileReader, FileWriter, Listener, WriteAbortHandle, WriteOptions, FILE_WRITE_CHUNK_BYTES,
31};
32// Hidden as a module: users hold its types via the re-exports above; the
33// module itself is the workerproxy client, which is not a user surface.
34#[doc(hidden)]
35pub mod worker;
36
37mod channels;
38pub(crate) mod credentials;
39pub(crate) mod http;
40pub(crate) mod imagebuilder;
41pub(crate) mod retry;
42pub(crate) mod runtime;
43
44pub use client::{Client, ClientBuilder};
45pub use runtime::block_on;
46pub use sailbox::object::Sailbox;
47
48/// Re-export of the [`time`] crate, whose [`OffsetDateTime`](time::OffsetDateTime)
49/// appears in public types (sailbox/volume timestamps). Re-exported so callers
50/// name the same version the SDK was built against.
51pub use time;
52
53/// Generated protobuf/gRPC code for the sailbox services. The proto files are
54/// the source of truth for these types, so the generated members carry no
55/// hand-written docs and are exempt from our lint policy (the server stubs,
56/// emitted only under `test-fakes`, are pure codegen we never hand-edit).
57#[allow(missing_docs, clippy::all, clippy::pedantic)]
58pub(crate) mod pb {
59 pub mod workerproxy {
60 pub mod v1 {
61 tonic::include_proto!("workerproxy.v1");
62 }
63 }
64 pub mod imagebuilder {
65 pub mod v1 {
66 tonic::include_proto!("imagebuilder.v1");
67 }
68 }
69 pub mod image {
70 pub mod v1 {
71 tonic::include_proto!("image.v1");
72 }
73 }
74}
75
76/// Unstable, binding-only surface shared with the first-party CLI, Python, and
77/// TypeScript (napi) bindings (and this crate's own integration tests): the raw
78/// transport, the
79/// credential store, and the generated protobuf code. Not part of the public
80/// API and not covered by semantic versioning; do not depend on it from outside
81/// this workspace.
82#[doc(hidden)]
83pub mod internal {
84 pub mod credentials {
85 pub use crate::credentials::*;
86 }
87 pub mod http {
88 pub use crate::http::*;
89 }
90 pub mod pb {
91 pub use crate::pb::*;
92 }
93 pub mod retry {
94 pub use crate::retry::*;
95 }
96
97 pub use crate::runtime::runtime;
98 pub use crate::sailbox::api::SailboxApi;
99}