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