Conflicts: ledger-cli main.rs (kept P11a's is_bare_launch; dropped the "comes with P11" stubs), ledger-mcp local.rs (main's Linux gate on the no-other-end test), docs/testing.md (both sections kept). `update` and `rollback` are cfg(unix) in ledger-host (a running program's file cannot be replaced on Windows), so main.rs says so on Windows (P11a step 5). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HS8WZziDnyxunC23MUxrLp
38 lines
1.3 KiB
Rust
38 lines
1.3 KiB
Rust
//! The books open while something holds them (plan 3.9, D-21, D-23).
|
|
//!
|
|
//! Nothing runs in the background: the first holder (the app, an agent's
|
|
//! bridge, `wanderbooks serve`, or a command that needs the books) starts
|
|
//! the **host**, which 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`), and the owner's commands in [`commands`] (`serve`, `close`,
|
|
//! `books`, `token`, `connect`, `doctor`, `passphrase`, and what the
|
|
//! viewer's Books menu does). Agents' tokens are kept in files under the data root
|
|
//! ([`tokens`]).
|
|
|
|
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 {}
|