include current wall clock in matrix_turn envelope

This commit is contained in:
Damocles 2026-05-01 12:59:07 +02:00
parent cc3451eef3
commit f4f11b78ad

View file

@ -103,6 +103,10 @@ The room_id and other fields are explicit - use them in your tool calls.";
struct MatrixTurn {
#[serde(rename = "type")]
kind: &'static str,
/// Current wall clock at turn-build time (unix seconds).
now: i64,
/// Current wall clock formatted YYYY-MM-DD HH:MM UTC.
now_human: String,
room_id: String,
room_name: String,
room_notes_path: String,
@ -137,8 +141,15 @@ fn build_turn(
.map(|i| wire_event_from(i, read_markers))
.collect();
let now = std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.map(|d| d.as_secs() as i64)
.unwrap_or(0);
MatrixTurn {
kind: "matrix_turn",
now,
now_human: format!("{} UTC", format_ts(now)),
room_id: source_room.as_str().to_owned(),
room_name: room_name.to_owned(),
room_notes_path: format!("../rooms/{source_room}/notes.md"),