feat: surface pending matrix invites in get_loose_ends
Write mcp-loose-ends/matrix.json on invite arrival (before wake) and after join_room clears an invite. The harness scans mcp-loose-ends/ generically in get_loose_ends, so pending invites are visible there without any harness-side changes. - paths: add mcp_loose_ends_dir() (mirrors hive-bash-mcp pattern) - handlers: add refresh_invite_loose_ends() — atomic tmp+rename write - handlers: join_room calls refresh after successful join to clear entry - timeline: install_invite_handler refreshes loose-ends before wake
This commit is contained in:
parent
06b4745d76
commit
4fbe9e4927
3 changed files with 75 additions and 5 deletions
|
|
@ -91,7 +91,7 @@ pub fn install_invite_handler(client: &Client, hyperhive_socket: PathBuf) {
|
|||
let socket = Arc::new(hyperhive_socket);
|
||||
let own_user = client.user_id().map(std::borrow::ToOwned::to_owned);
|
||||
client.add_event_handler({
|
||||
move |event: StrippedRoomMemberEvent, room: Room, _client: Client| {
|
||||
move |event: StrippedRoomMemberEvent, room: Room, client: Client| {
|
||||
let socket = socket.clone();
|
||||
let own_user = own_user.clone();
|
||||
async move {
|
||||
|
|
@ -108,6 +108,9 @@ pub fn install_invite_handler(client: &Client, hyperhive_socket: PathBuf) {
|
|||
let room_id = room.room_id().to_owned();
|
||||
let label = room.name().unwrap_or_else(|| room_id.to_string());
|
||||
tracing::info!(%room_id, "matrix: received room invite, waking agent");
|
||||
// Refresh loose-ends BEFORE waking so the invite is
|
||||
// visible in get_loose_ends during the agent's turn.
|
||||
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"
|
||||
|
|
|
|||
Loading…
Reference in a new issue