bxcore: a turn's speaker, SessionUpdated's turn, the session-state messages

Co-Authored-By: ornith-1.5-35b-a3b <agent@wntrmute.dev>
This commit is contained in:
2026-09-28 10:27:28 -07:00
co-authored by ornith-1.5-35b-a3b
parent 027146f359
commit c798714af1
31 changed files with 238 additions and 13 deletions
+40
View File
@@ -235,6 +235,7 @@ fn session_log_records() {
LogRecord::User {
time: ts("2026-09-17T08:05:01.000Z"),
content: "What is in /etc/hosts?".to_string(),
speaker: None,
},
LogRecord::Assistant {
time: ts("2026-09-17T08:05:03.000Z"),
@@ -275,6 +276,45 @@ fn session_log_records() {
check("session.jsonl", &want);
}
/// A user record holds its turn's speaker when the turn had one, written last; a record without
/// one has the bytes it had before M5c, so a log written earlier reads as it is and is never
/// rewritten (M5c spec, section 11).
#[test]
fn user_records_with_and_without_a_speaker() {
let want = [
LogRecord::SessionStart {
time: ts("2026-09-27T09:00:00.000Z"),
session: sid("mm-r0000000000000000000000001"),
epoch: Epoch(0),
slot: 2,
baseline: Hash32::from_hex(SEQ_HEX).unwrap(),
},
LogRecord::User {
time: ts("2026-09-27T09:00:01.000Z"),
content: "When is the launch?".to_string(),
speaker: Some("kyle".to_string()),
},
LogRecord::Assistant {
time: ts("2026-09-27T09:00:04.000Z"),
content: Some("On Thursday.".to_string()),
reasoning_content: None,
tool_calls: vec![],
},
LogRecord::User {
time: ts("2026-09-27T09:01:00.000Z"),
content: "And the review?".to_string(),
speaker: None,
},
LogRecord::Assistant {
time: ts("2026-09-27T09:01:03.000Z"),
content: Some("On Friday.".to_string()),
reasoning_content: None,
tool_calls: vec![],
},
];
check("session_speaker.jsonl", &want);
}
#[test]
fn unknown_fields_and_types_are_rejected() {
let user = r#"{"type":"user","time":"2026-09-17T08:05:01.000Z","content":"hi"}"#;