add list_accounts daemon op to hive-matrix-mcp
This commit is contained in:
parent
2efd95d0f5
commit
68b0894f5b
3 changed files with 90 additions and 1 deletions
|
|
@ -65,6 +65,12 @@ async fn dispatch(req: DaemonRequest, registry: &Registry) -> DaemonResponse {
|
|||
if matches!(req.op, DaemonOp::Ping) {
|
||||
return DaemonResponse::ok(&serde_json::json!({"ok": true}));
|
||||
}
|
||||
// ListAccounts is registry-wide, not per-account — answer before
|
||||
// resolving a single client (the `account` field is meaningless for
|
||||
// it, and it must work even if the primary failed to restore).
|
||||
if matches!(req.op, DaemonOp::ListAccounts) {
|
||||
return DaemonResponse::ok(®istry.list());
|
||||
}
|
||||
let client = match registry.resolve(req.account.as_deref()) {
|
||||
Ok(c) => c,
|
||||
Err(msg) => return DaemonResponse::error(msg),
|
||||
|
|
@ -78,6 +84,12 @@ async fn dispatch_op(op: DaemonOp, client: &Client) -> DaemonResponse {
|
|||
// a client (so a health probe works before any account restores).
|
||||
// Kept for an exhaustive match.
|
||||
DaemonOp::Ping => DaemonResponse::ok(&serde_json::json!({"ok": true})),
|
||||
// Unreachable in practice: `dispatch` handles ListAccounts before
|
||||
// resolving a client (it is registry-wide, not per-account). Kept
|
||||
// for an exhaustive match — there is no client-scoped meaning.
|
||||
DaemonOp::ListAccounts => DaemonResponse::error(
|
||||
"list_accounts is registry-wide; handled before client resolution",
|
||||
),
|
||||
DaemonOp::SendMessage { room, body } => handlers::send_message(client, &room, &body).await,
|
||||
DaemonOp::SendDm { user_id, body } => handlers::send_dm(client, &user_id, &body).await,
|
||||
DaemonOp::SendFile {
|
||||
|
|
|
|||
Loading…
Reference in a new issue