diff --git a/Cargo.lock b/Cargo.lock index 0c98d6cb..09c159be 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1769,6 +1769,7 @@ dependencies = [ "chrono", "ed25519-dalek 2.2.0", "ensemble", + "governor", "hex", "hum-identity", "hum-mcp", @@ -1783,7 +1784,6 @@ dependencies = [ "tempfile", "thehum", "thrum-core", - "thrumd", "tokio", "tracing", "tracing-subscriber", @@ -4145,7 +4145,6 @@ dependencies = [ "parking_lot", "serde_json", "thrum-core", - "thrumd", "tokio", "tracing", "tracing-subscriber", @@ -4489,23 +4488,6 @@ dependencies = [ "thiserror 1.0.69", ] -[[package]] -name = "thrumd" -version = "0.32.0" -dependencies = [ - "anyhow", - "async-trait", - "governor", - "hum-identity", - "hum-paths", - "parking_lot", - "serde", - "serde_json", - "thrum-core", - "tokio", - "tracing", -] - [[package]] name = "time" version = "0.3.47" diff --git a/Cargo.toml b/Cargo.toml index 1a1f85a0..1e632b36 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,6 @@ exclude = [ ] members = [ "thrum-core", - "thrumd", "hum-paths", "hum-identity", "hum-thrum", diff --git a/ensemble/src/lib.rs b/ensemble/src/lib.rs index 0ba38131..115f7e42 100644 --- a/ensemble/src/lib.rs +++ b/ensemble/src/lib.rs @@ -80,7 +80,7 @@ const HANDSHAKE_DOMAIN: &str = "hum-ensemble-handshake-v1"; /// Tolerance window for `signed_at` skew, both directions. const HANDSHAKE_SKEW_MS: i64 = 60_000; -/// Tones flow through the ensemble as loose JSON — same shape thrumd +/// Tones flow through the ensemble as loose JSON — same shape humd's thrum module /// uses on the wire. Strict typing lives in `thrum_core::Tone` for /// callers that need it; here we stay loose so any new chi flows /// through without a type bump. diff --git a/ensemble/src/tcp.rs b/ensemble/src/tcp.rs index 0a9dde88..e9e6610e 100644 --- a/ensemble/src/tcp.rs +++ b/ensemble/src/tcp.rs @@ -2,7 +2,7 @@ //! //! NDJSON over `tokio::net::TcpStream`. One framing rule: each tone is //! a single JSON value followed by `\n`. Mirrors the unix-socket shape -//! thrumd uses (`thrumd/src/conn.rs`) — same parser, different socket. +//! humd's thrum module uses (`humd/src/thrumd/conn.rs`) — same parser, different socket. //! //! Auth lives one layer up: the ensemble's signed `chi:"hello"` exchange //! authenticates the peer once a connection is installed. This module diff --git a/humd/Cargo.toml b/humd/Cargo.toml index 6bda20bd..d0a044eb 100644 --- a/humd/Cargo.toml +++ b/humd/Cargo.toml @@ -22,7 +22,6 @@ anyhow = { workspace = true } # Path deps on every workspace crate. thrum-core = { path = "../thrum-core" } -thrumd = { path = "../thrumd" } hum-mcp = { path = "../hum-mcp" } hum-identity = { path = "../hum-identity" } thehum = { path = "../thehum" } @@ -37,6 +36,7 @@ ed25519-dalek = { version = "2", features = ["rand_core"] } metrics = "0.23" metrics-exporter-prometheus = { version = "0.15", default-features = false, features = ["http-listener"] } chrono = { workspace = true } +governor = "0.6" [dev-dependencies] tokio = { workspace = true } diff --git a/humd/README.md b/humd/README.md index e9078420..bdc7ae46 100644 --- a/humd/README.md +++ b/humd/README.md @@ -130,7 +130,7 @@ binary runs. - [`hum-paths`](../hum-paths): the XDG layout humd's filesystem state hangs from. - [`ensemble`](../ensemble): the mesh humd plugs into. Transports, signed hello, peer registry, gossip, kad. -- [`thrumd`](../thrumd): the unix socket server humd hosts for local bees. +- `thrumd` (in `src/thrumd.rs`): the unix socket server humd hosts for local bees. - [`thehum`](../thehum): the signed append-only chi log humd writes every tone into. - [`sim`](../sim): the in-process multi-humd simulator, calls `humd::run` with overrides. - [`hum`](../hum): the user-facing CLI that inspects and configures humd. diff --git a/humd/src/lib.rs b/humd/src/lib.rs index 2aa7572d..c7fcdcc5 100644 --- a/humd/src/lib.rs +++ b/humd/src/lib.rs @@ -27,6 +27,7 @@ mod identity; mod peer_transport; mod peers; mod penny; +pub mod thrumd; pub use identity::{key_path, load_or_mint_key, read_key}; pub use peers::{peers_path, PeerConfig}; diff --git a/thrumd/src/lib.rs b/humd/src/thrumd.rs similarity index 100% rename from thrumd/src/lib.rs rename to humd/src/thrumd.rs diff --git a/thrumd/src/conn.rs b/humd/src/thrumd/conn.rs similarity index 97% rename from thrumd/src/conn.rs rename to humd/src/thrumd/conn.rs index aaf82615..c1e93f73 100644 --- a/thrumd/src/conn.rs +++ b/humd/src/thrumd/conn.rs @@ -10,8 +10,8 @@ use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader}; use tokio::net::UnixStream; use tokio::sync::mpsc; use tracing::{info, trace, warn}; -use crate::registry::Reach; -use crate::{ +use super::registry::Reach; +use super::{ breath_tone, chi_of, echo_tone, rid_of, short, tone_is_dusk, validate_envelope, Thrum, }; @@ -193,11 +193,11 @@ async fn write_loop( impl Thrum { pub(crate) fn inner_clients_write( &self, - ) -> parking_lot::RwLockWriteGuard<'_, crate::registry::Registry> { + ) -> parking_lot::RwLockWriteGuard<'_, super::registry::Registry> { self.inner.clients.write() } - pub(crate) fn inner_sink(&self) -> Option> { + pub(crate) fn inner_sink(&self) -> Option> { self.inner.sink.read().clone() } } diff --git a/thrumd/src/registry.rs b/humd/src/thrumd/registry.rs similarity index 100% rename from thrumd/src/registry.rs rename to humd/src/thrumd/registry.rs diff --git a/thrumd/tests/accept_rate_limit.rs b/humd/tests/thrum_accept_rate_limit.rs similarity index 100% rename from thrumd/tests/accept_rate_limit.rs rename to humd/tests/thrum_accept_rate_limit.rs diff --git a/sim/Cargo.toml b/sim/Cargo.toml index 07dd7147..28d8481d 100644 --- a/sim/Cargo.toml +++ b/sim/Cargo.toml @@ -9,7 +9,6 @@ description = "hum ensemble simulator — spin up N humds in-process, wire them, ensemble = { path = "../ensemble" } humd = { path = "../humd" } thrum-core = { path = "../thrum-core" } -thrumd = { path = "../thrumd" } hum-identity = { path = "../hum-identity" } hum-paths = { path = "../hum-paths" } tokio = { workspace = true } diff --git a/sim/src/lib.rs b/sim/src/lib.rs index c3cfef32..7e6ce235 100644 --- a/sim/src/lib.rs +++ b/sim/src/lib.rs @@ -22,7 +22,7 @@ use ensemble::{hello_tone, Ensemble, Hid, HumdKey, InMemoryEndpoint, PeerCapabil use parking_lot::{Mutex, RwLock}; use serde_json::Value; use thrum_core::WaneTracker; -use thrumd::Thrum; +use humd::thrumd::Thrum; use tokio::sync::{mpsc, oneshot}; /// Sentinel meaning "unlimited capacity" — round-trips through diff --git a/thrumd/Cargo.toml b/thrumd/Cargo.toml deleted file mode 100644 index cdfce8db..00000000 --- a/thrumd/Cargo.toml +++ /dev/null @@ -1,22 +0,0 @@ -[package] -name = "thrumd" -version.workspace = true -edition.workspace = true -license.workspace = true -description = "NDJSON unix-socket thrum server — listens, dispatches, broadcasts." - -[dependencies] -hum-paths = { path = "../hum-paths" } -thrum-core = { path = "../thrum-core" } -hum-identity = { path = "../hum-identity" } -tokio = { workspace = true } -serde = { workspace = true } -serde_json = { workspace = true } -tracing = { workspace = true } -async-trait = { workspace = true } -anyhow = { workspace = true } -parking_lot = { workspace = true } -governor = "0.6" - -[dev-dependencies] -tokio = { workspace = true }