cuttlefish_host/lib.rs
1//! The wasmtime host: drives proc-blocks and enforces what they may reach.
2//!
3//! This crate is where the project's security boundary actually lives. The
4//! compile-time capability check in `cuttlefish-core` exists to give spec
5//! authors good error messages; the checks in [`caps`] are what a malicious or
6//! malfunctioning block actually runs into, and they fail closed.
7//!
8//! Three pieces, in the order a job meets them:
9//!
10//! - [`caps`] — what a job may reach. Deny-by-default, and canonicalizing to
11//! defeat traversal and symlink escapes.
12//! - [`handles`] — files held open on the guest's behalf, served as bounded
13//! windows so that bulk data never enters guest memory.
14//! - [`runner`] — the reactor loop: the host drives the guest one command at a
15//! time, which is what makes cancellation free and every iteration
16//! observable.
17//!
18//! Inference reaches the runner only through [`infer::InferBackend`], so the
19//! whole loop is testable with no model present. Which implementation a job gets
20//! is decided by [`backend::Registry`], so adding a provider — an
21//! OpenAI-compatible endpoint, an embedded llama.cpp — is additive rather than a
22//! change to the runner, the parser, or the daemon. [`ollama`] is the first real
23//! one.
24
25#![forbid(unsafe_code)]
26#![warn(missing_docs)]
27
28pub mod backend;
29pub mod caps;
30pub mod documents;
31pub mod handles;
32pub mod infer;
33#[cfg(feature = "llamacpp")]
34pub mod llamacpp;
35pub mod ollama;
36/// Rendering PDF pages out-of-process, so a renderer crash cannot take the
37/// daemon with it.
38#[cfg(feature = "pdf-render")]
39pub mod render_worker;
40pub mod runner;