Registry-side primitives for the daemon↔registry conversation. No client-facing HTTP yet (that's NAP-215). - `state::Registry`: in-memory store of connected daemons + a session catalog keyed by (daemon_id, session_id). Tracks pending CreateSession / KillSession RPCs so a single daemon connection can multiplex them. - `handler::handle_socket`: per-connection loop that authenticates the Hello, applies snapshot/diff/heartbeat frames, and resolves matching *Result frames. Heartbeat watchdog is a `tokio::time::timeout` around the read side — no separate janitor task. - `server::router_with_timeout`: axum router mounting `WS /daemon`. The timeout knob lets tests verify the 30s drop path in milliseconds. - `token::ensure_token`: first-run bootstrap that generates a 256-bit hex token, prints it once to stderr, and persists it to `~/.config/maestro/registry.toml`. - Outbound `create_session` / `kill_session` exposed as the internal API NAP-215's HTTP handlers will call. Integration tests use a real axum server bound to `:0` and drive it via `tokio-tungstenite`, covering: bad-token reject, snapshot accept, diff apply (add/update/remove), heartbeat timeout dropping the daemon, re-registration replacing the catalog, and a full CreateSession RPC round-trip. Closes NAP-213.
This commit is contained in:
@@ -10,12 +10,20 @@ repository = "https://git.naps.pt/naps62/maestro"
|
||||
publish = false
|
||||
|
||||
[workspace.dependencies]
|
||||
axum = { version = "0.7", features = ["ws"] }
|
||||
chrono = { version = "0.4", default-features = false, features = ["clock", "serde"] }
|
||||
dirs = "5"
|
||||
futures-util = { version = "0.3", default-features = false, features = ["sink", "std"] }
|
||||
maestro-protocol = { path = "crates/maestro-protocol" }
|
||||
rand = "0.8"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
tempfile = "3"
|
||||
thiserror = "1"
|
||||
tokio = { version = "1", features = ["macros", "rt-multi-thread", "sync", "time", "net", "io-util"] }
|
||||
tokio-tungstenite = "0.21"
|
||||
toml = "0.8"
|
||||
tracing = "0.1"
|
||||
uuid = { version = "1", features = ["v4", "serde"] }
|
||||
|
||||
[profile.release]
|
||||
|
||||
Reference in New Issue
Block a user