proper Matrix threading + concise tool call formatting

agent_ux: uses Relation::Thread (not Reply) for tool call details.
format_tool_call extracts key params instead of dumping raw JSON.
format_tool_result truncated to 200 chars.

matrix_utils: added make_thread_reply() for threaded responses.
sync.rs routes ThreadReply engagement to threaded messages.
This commit is contained in:
2026-03-23 01:42:08 +00:00
parent 3b62d86c45
commit 7324c10d25
2 changed files with 87 additions and 30 deletions

View File

@@ -56,6 +56,19 @@ pub fn make_reply_content(body: &str, reply_to_event_id: OwnedEventId) -> RoomMe
content
}
/// Build a threaded reply — shows up in Matrix threads UI.
/// The thread root is the event being replied to (creates the thread on first use).
pub fn make_thread_reply(
body: &str,
thread_root_id: OwnedEventId,
) -> RoomMessageEventContent {
use ruma::events::relation::Thread;
let mut content = RoomMessageEventContent::text_markdown(body);
let thread = Thread::plain(thread_root_id.clone(), thread_root_id);
content.relates_to = Some(Relation::Thread(thread));
content
}
/// Send an emoji reaction to a message.
pub async fn send_reaction(
room: &Room,