Files
wanderbooks/crates/ledger-host/src/lib.rs
T
swaitsandClaude Fable 5.2 d81f6d5c83 feat(host): a command that names a company opens it in its own server; a bridge says a server is still opening
A command with nothing running opens in its own server the one company it
names (token create, check, revoke, back-up, upgrade, extract), so the owner
is still told of a format upgrade that company waits for and the work that
needs the company open can run. A bridge facing a server that holds the books
but has no socket yet (the app opening large companies, or finishing a last
backup) says it is still opening, not that Wanderbooks isn't running. The
lib and commands spec blocks follow (WB-app-5).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 11:29:34 -07:00

44 lines
1.6 KiB
Rust

//! The books open while something holds them (plan 3.9, D-21, D-23; plan
//! P15 3.1, D-77, D-84).
//!
//! On the desktop the app is the host: [`app_server`] starts the books
//! server as the window's child and closes it by closing its input.
//! Nothing else on the desktop starts a detached host. The headless
//! `wanderbooks serve` keeps one, as before: its host starts the books
//! server and holds it open while any lease on its socket lasts, and
//! closes it 10 s after the last one ends. Each part is a mode of the one
//! `wanderbooks` executable: [`host::run`] (`wanderbooks host`),
//! [`bridge::run`] (`wanderbooks mcp`, a line to whatever runs, in words
//! when nothing does), and the owner's commands in [`commands`] (`serve`,
//! `close`, `books`, `token`, `connect`, `doctor`, `passphrase`, and what
//! the viewer's Books menu does), which talk to the running app's (or
//! host's) server, or with nothing running run a server of their own for
//! the length of the work, or say "Start Wanderbooks first". Agents'
//! tokens are kept in files under the data root ([`tokens`]).
pub mod app_server;
pub mod bridge;
pub mod channel;
pub mod commands;
pub mod host;
pub mod knobs;
pub mod lease;
pub mod opener;
mod start;
pub mod tokens;
#[cfg(unix)]
pub mod update;
/// How a mode stops when it can't go on: the reason is already printed,
/// and the number is the process's exit code.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Exit(pub i32);
impl std::fmt::Display for Exit {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "exit code {}", self.0)
}
}
impl std::error::Error for Exit {}