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 forward;
24pub mod guest;
25pub mod image;
26pub mod imagebuild;
27pub mod sailbox;
28pub mod shell;
29
30pub use worker::{
31 FileReader, FileWriter, Listener, WriteAbortHandle, WriteOptions, FILE_WRITE_CHUNK_BYTES,
32};
33// Hidden as a module: users hold its types via the re-exports above; the
34// module itself is the workerproxy client, which is not a user surface.
35#[doc(hidden)]
36pub mod worker;
37
38mod channels;
39pub(crate) mod credentials;
40pub(crate) mod http;
41pub(crate) mod imagebuilder;
42pub(crate) mod retry;
43pub(crate) mod runtime;
44
45pub use client::{Client, ClientBuilder};
46pub use runtime::block_on;
47pub use sailbox::object::{Sailbox, SailboxFs};
48pub use sailbox::{DirEntry, EntryType};
49
50/// Re-export of the [`time`] crate, whose [`OffsetDateTime`](time::OffsetDateTime)
51/// appears in public types (sailbox/volume timestamps). Re-exported so callers
52/// name the same version the SDK was built against.
53pub use time;
54
55/// Generated protobuf/gRPC code for the sailbox services. The proto files are
56/// the source of truth for these types, so the generated members carry no
57/// hand-written docs and are exempt from our lint policy (the server stubs,
58/// emitted only under `test-fakes`, are pure codegen we never hand-edit).
59#[allow(missing_docs, clippy::all, clippy::pedantic)]
60pub(crate) mod pb {
61 pub mod workerproxy {
62 pub mod v1 {
63 tonic::include_proto!("workerproxy.v1");
64 }
65 }
66 pub mod imagebuilder {
67 pub mod v1 {
68 tonic::include_proto!("imagebuilder.v1");
69 }
70 }
71 pub mod image {
72 pub mod v1 {
73 tonic::include_proto!("image.v1");
74 }
75 }
76}
77
78/// Unstable, binding-only surface shared with the first-party CLI, Python, and
79/// TypeScript (napi) bindings (and this crate's own integration tests): the raw
80/// transport, the
81/// credential store, and the generated protobuf code. Not part of the public
82/// API and not covered by semantic versioning; do not depend on it from outside
83/// this workspace.
84#[doc(hidden)]
85pub mod internal {
86 pub mod credentials {
87 pub use crate::credentials::*;
88 }
89 pub mod http {
90 pub use crate::http::*;
91 }
92 pub mod pb {
93 pub use crate::pb::*;
94 }
95 pub mod retry {
96 pub use crate::retry::*;
97 }
98
99 pub use crate::runtime::runtime;
100 pub use crate::sailbox::api::SailboxApi;
101}