feat(matrix mcp): add resolve_invite tool to accept or reject pending invites

This commit is contained in:
damocles 2026-06-05 21:55:04 +02:00
commit 86f0de751f
6 changed files with 121 additions and 19 deletions

View file

@ -77,12 +77,13 @@ pub fn install_message_handler(client: &Client, hyperhive_socket: PathBuf) {
}
/// Install a handler that wakes the agent when a room invite arrives.
/// The agent decides whether to accept by calling `join_room`.
/// The agent decides whether to accept or reject by calling
/// `resolve_invite`.
///
/// When the daemon receives an `m.room.member` state event with
/// `membership: invite` for the agent's own user ID during sync, it
/// fires a hyperhive wake so the agent can inspect the invite via
/// `list_invites` and act on it with `join_room`.
/// `list_invites` and act on it with `resolve_invite`.
///
/// This closes the gap where invites accumulated in `invited_rooms()`
/// forever without the agent being notified — the daemon's message
@ -113,7 +114,7 @@ pub fn install_invite_handler(client: &Client, hyperhive_socket: PathBuf) {
handlers::refresh_invite_loose_ends(&client).await;
let body = format!(
"[matrix] invited to {label} ({room_id}) — \
use list_invites to see pending invites, join_room to accept"
use list_invites to see pending invites, resolve_invite to accept or reject"
);
if let Err(e) = wake::send_wake(&socket, &body).await {
tracing::warn!(