surface message edit history (no edit_message tool - shard commits to its words)

This commit is contained in:
Damocles 2026-05-01 13:45:23 +02:00
parent 9d490f5ca8
commit bc3a4782cc
4 changed files with 75 additions and 5 deletions

View file

@ -6,6 +6,14 @@ use matrix_sdk::{
};
use serde::{Deserialize, Serialize};
/// One prior version of an edited message.
#[derive(Debug, Clone, Serialize)]
pub struct EditRecord {
pub body: String,
pub ts: i64,
pub ts_human: String,
}
/// Serializable shape for one timeline event, used both in matrix_turn JSON
/// (input to the shard) and tool response JSON (get_room_history,
/// fetch_event).
@ -22,6 +30,9 @@ pub enum WireEvent {
body: String,
in_reply_to: Option<String>,
read_by: Vec<String>,
/// Prior versions of this message, oldest first. Empty when the
/// message has never been edited.
edit_history: Vec<EditRecord>,
},
Reaction {
sender: String,
@ -94,11 +105,16 @@ pub enum TimelineItem {
Message {
event_id: OwnedEventId,
sender: OwnedUserId,
/// Latest version of the message body. If the user edited this message,
/// this is the most recent edit's content.
body: String,
is_self: bool,
/// Unix seconds. 0 if unknown.
ts: i64,
in_reply_to: Option<OwnedEventId>,
/// Prior versions of this message (oldest first), excluding the
/// current `body`. Empty when the message has never been edited.
edit_history: Vec<EditRecord>,
},
Reaction {
sender: OwnedUserId,