Skip to main content

sail/
lib.rs

1//! `sail-core`: 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 the
5//! per-sailbox worker proxy). Bindings (the Python extension, the CLI) are thin
6//! layers over it.
7//!
8//! As a library, `sail-core` 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 sailbox;
24pub mod worker;
25
26mod channels;
27pub(crate) mod credentials;
28pub(crate) mod http;
29pub(crate) mod imagebuilder;
30pub(crate) mod retry;
31pub(crate) mod runtime;
32
33pub use client::{Client, ClientBuilder};
34pub use runtime::block_on;
35
36/// Generated protobuf/gRPC code for the sailbox services. The proto files are
37/// the source of truth for these types, so the generated members carry no
38/// hand-written docs and are exempt from our lint policy (the server stubs,
39/// emitted only under `test-fakes`, are pure codegen we never hand-edit).
40#[allow(missing_docs, clippy::all, clippy::pedantic)]
41pub(crate) mod pb {
42    pub mod workerproxy {
43        pub mod v1 {
44            tonic::include_proto!("workerproxy.v1");
45        }
46    }
47    pub mod imagebuilder {
48        pub mod v1 {
49            tonic::include_proto!("imagebuilder.v1");
50        }
51    }
52    pub mod image {
53        pub mod v1 {
54            tonic::include_proto!("image.v1");
55        }
56    }
57}
58
59/// Unstable, binding-only surface shared with the first-party CLI and Python
60/// bindings (and this crate's own integration tests): the raw transport, the
61/// credential store, and the generated protobuf code. Not part of the public
62/// API and not covered by semantic versioning; do not depend on it from outside
63/// this workspace.
64#[doc(hidden)]
65pub mod internal {
66    pub mod credentials {
67        pub use crate::credentials::*;
68    }
69    pub mod http {
70        pub use crate::http::*;
71    }
72    pub mod imagebuilder {
73        pub use crate::imagebuilder::*;
74    }
75    pub mod pb {
76        pub use crate::pb::*;
77    }
78    pub mod retry {
79        pub use crate::retry::*;
80    }
81
82    pub use crate::exec::ExecParams;
83    pub use crate::runtime::runtime;
84    pub use crate::sailbox::api::SailboxApi;
85    pub use crate::worker::WorkerProxy;
86}