json input format + required room_id on all room-scoped tools

This commit is contained in:
Damocles 2026-05-01 12:46:15 +02:00
parent ef461797ad
commit cc3451eef3
5 changed files with 260 additions and 241 deletions

View file

@ -6,6 +6,53 @@ use matrix_sdk::{
};
use serde::{Deserialize, Serialize};
/// 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).
#[derive(Debug, Serialize)]
#[serde(tag = "kind", rename_all = "lowercase")]
pub enum WireEvent {
Message {
event_id: String,
event_id_short: String,
sender: String,
is_self: bool,
ts: i64,
ts_human: String,
body: String,
in_reply_to: Option<String>,
read_by: Vec<String>,
},
Reaction {
sender: String,
is_self: bool,
ts: i64,
ts_human: String,
target_event_id: String,
target_event_id_short: String,
key: String,
},
}
#[derive(Debug, Serialize)]
pub struct RoomInfo {
pub room_id: String,
pub name: String,
}
#[derive(Debug, Serialize)]
pub struct MemberInfo {
pub user_id: String,
pub display_name: String,
}
#[derive(Debug, Serialize)]
pub struct FetchEventResult {
pub event: Option<WireEvent>,
pub context_before: Vec<WireEvent>,
pub earlier_handle: Option<String>,
}
pub const DEFAULT_MODEL: &str = "claude-sonnet-4-6";
pub const DEFAULT_MAX_HISTORY: usize = 20;
pub const DEFAULT_RATE_LIMIT_PER_MIN: u32 = 1;