forge_server/lib.rs
1//! The server: what a client reads of the core, and no view of its own.
2//!
3//! Holds the view surface - the reads a client makes and the commands it
4//! sends -, the peer envelope parsing, forge's own slash commands, the
5//! transcript fold that says where a conversation's turns sit and the task
6//! endings it carries, a Monitor's watched-command tail, and the socket
7//! that carries all of it to whatever is drawing.
8//!
9//! Nothing here draws. What a glyph, a colour or a weight is belongs to the
10//! client, and the test is whether removing a thing changes what the data
11//! IS or only how it is DRAWN.
12//!
13//! The reducers that derive a client's session records live in that
14//! client.
15
16pub mod boot;
17pub mod cli;
18pub mod commands;
19pub mod composer;
20pub mod delivery;
21pub mod envelope;
22pub mod error;
23pub mod file_index;
24#[cfg(test)]
25mod fixtures;
26pub mod live;
27pub mod logging;
28mod perf_log;
29pub mod startup;
30pub mod surface;
31#[cfg(test)]
32mod test_support;
33#[cfg(feature = "testing")]
34pub mod testing;
35pub mod transcript;
36pub mod transport;
37pub mod unseen;
38pub mod work;
39
40// The build's own stamp, which states WHICH forge commit is running rather
41// than which crate is drawing. It lives here because the crate that renders a
42// header is not the crate the header is about: a client reads these off the
43// wire - so the stamp lives on the wire rather than being compiled into a
44// view.
45
46/// Full version string, on the greeting and in the boot log.
47///
48/// Always carries the short SHA so a screenshot is enough to identify the
49/// running build. On `main` (and detached HEAD) the stamp adds ` · <sha>`;
50/// on any other branch the stamp adds ` · <sha> (<branch>)`.
51pub const FORGE_VERSION: &str = concat!(env!("CARGO_PKG_VERSION"), env!("FORGE_BUILD_SUFFIX_FULL"));
52
53/// Short version string, for tight slots a view draws. Always carries the
54/// short SHA as `+<sha>` so the running build is identifiable from a
55/// screenshot.
56pub const FORGE_VERSION_SHORT: &str =
57 concat!(env!("CARGO_PKG_VERSION"), env!("FORGE_BUILD_SUFFIX_SHORT"));
58
59/// How this build was made - the marker `scripts/install.sh` sets, or empty
60/// for anything else. Surfaced at startup by `startup::report_build_provenance`.
61pub const FORGE_BUILD_PROVENANCE: &str = env!("FORGE_BUILD_PROVENANCE");
62
63/// Digest of the `Cargo.lock` this build saw, not of forge's single-instance
64/// lock. FNV-1a, not a SHA, so `shasum` will not reproduce it. Meaningful only
65/// compared against the digest a build of the released tag reports.
66pub const FORGE_CARGO_LOCK_DIGEST: &str = env!("FORGE_CARGO_LOCK_DIGEST");
67
68/// The core's update protocol, as a view reads it. It is the same type the
69/// same call hands a view, so nothing here wraps or renames it.
70pub use surface::SeatUpdate;
71pub use surface::SessionUpdate;
72
73/// The core's write protocol, re-exported for the same reason the update
74/// is: a view acts by dispatching the core's own command rather than a
75/// second vocabulary this crate would have to keep in step.
76pub use forge_workspace::Command;
77
78/// Why a command did not reach a session, so a view can say which of the
79/// three it was rather than only that something failed.
80pub use forge_workspace::DispatchError;
81
82/// The plumbing a view reaches the core's reads through, re-exported so a
83/// view depends on this crate and `forge-primitives` and no further.
84///
85/// The chain under these is longer than the one above them: the workspace
86/// re-exports the agent's git plumbing and wire parsers wholesale, so
87/// `git_diff::current_branch` and `translate::state_parsing` are agent
88/// code reached through two wildcard facades. The view names this crate,
89/// which is the discipline that matters here; it is not a claim that the
90/// code beneath is the workspace's own.
91pub use forge_workspace::env::git_diff;
92pub use forge_workspace::env::timezone;
93pub use forge_workspace::output_tail;
94pub use forge_workspace::translate;