feat(#1671): reject matrix send when room has unread messages

This commit is contained in:
damocles 2026-06-15 10:16:16 +02:00 committed by mara
commit f6e1651dff
2 changed files with 43 additions and 3 deletions

View file

@ -168,7 +168,9 @@ impl MatrixBridge {
#[tool(
description = "Post a plain-text or markdown message to a matrix room. \
`room` is either a room id (!abc:server) or alias (#name:server). \
Returns the new event id."
Returns the new event id. Rejected with a hint if the room still has \
unread messages read_room then mark_read the latest event first so \
you don't talk over messages you haven't seen."
)]
async fn send_message(&self, Parameters(args): Parameters<SendMessageArgs>) -> String {
render(
@ -181,7 +183,9 @@ impl MatrixBridge {
}
#[tool(description = "Open (or reuse) a direct message room with `user_id` \
(@user:server) and post `body` to it.")]
(@user:server) and post `body` to it. If the DM room already exists \
and has unread messages, the send is rejected with a hint read_room \
then mark_read the latest event first.")]
async fn send_dm(&self, Parameters(args): Parameters<SendDmArgs>) -> String {
render(
round_trip(DaemonRequest::SendDm {
@ -209,7 +213,9 @@ impl MatrixBridge {
}
#[tool(description = "Reply to a specific matrix event in a room, threaded \
via m.in_reply_to. Returns the reply's event id.")]
via m.in_reply_to. Returns the reply's event id. Rejected with a hint \
if the room still has unread messages read_room then mark_read the \
latest event first.")]
async fn send_reply(&self, Parameters(args): Parameters<SendReplyArgs>) -> String {
render(
round_trip(DaemonRequest::SendReply {