| Filename | Latest commit message | Latest commit date |
|---|---|---|
The retry loop's body was only reachable through bring_up_account, which needs a live homeserver, so nothing exercised what happens when a down secondary comes up or fails, or that the Registry's new RwLock is never held across the network call. The unit tests covered the pure decision (DownAccounts, retry_delay) only. retry_down now delegates to retry_loop / retry_once, which take the bring-up step and the snapshot path as parameters; retry_down passes bring_up_account and the real path, so behaviour is unchanged. Tests use offline matrix-sdk clients and fake bring-ups to show that: - a secondary that comes up is inserted, leaves the down set, has its sync loop sent on and is published in the snapshot, while the primary and the other accounts stay the same clients; - one that fails (error or no token) stays down, is not published, and waits twice as long next time; one that is not yet due is not tried; - readers are not blocked while a bring-up is pending; - inserts under four busy reader threads neither deadlock nor lose an account; - the loop, under paused time, retries at 2, 6, 14 and 30 minutes. tokio's test-util feature is added as a dev-dependency for the last. |
||
| .. | ||
| src | ||
| Cargo.toml | ||
| README.md | ||
hive-matrix-mcp
Per-agent matrix integration: a long-running daemon
(hive-matrix-daemon) that holds a matrix-sdk Client + sync loop per
configured account and serves the matrix tool surface (send_message,
send_dm, list_rooms, read_room, …) directly over streamable-http.
No stdio bridge, no per-turn respawn — claude reconnects to the same
stable URL every turn.
When to use it
Look here when changing matrix tool behaviour, multi-account handling,
or the incoming-event → todo/wake path. The daemon owns the whole
lifecycle: per-account bring-up (accounts.rs, client.rs), the sync
loop that sweeps invites/unread rooms into the harness's in-agent todo
socket (timeline.rs, wake.rs), and the MCP tool router itself
(mcp.rs).
Shape
One bin (hive-matrix-daemon, src/main.rs) built from the crate's
own lib (src/lib.rs):
accounts.rs— multi-account config + the account→Clientdispatch registry (mainis always the hive-internal primary; extras come fromHIVE_MATRIX_ACCOUNTS).client.rs— session restore, stale-token recovery, avatar sync, cross-signing bootstrap.timeline.rs/wake.rs— per-sync-callback invite/unread sweeps that push todos ontoHIVE_AGENT_SOCKET.handlers.rs— per-tool dispatch, returnsprotocol::DaemonResponse.mcp.rs— thermcptool router +serve_http, resolving each call's optionalaccountarg against the registry before calling intohandlers.paths.rs— per-agent path resolution (token file, matrix-sdk state dir, homeserver URL, accounts snapshot).