K19: the conversation on screen (map 16.20.3)
- On a chat turn `heard` is what she would see on screen: "Earlier in
{room}:" with the turn room's lines before the new ones (her own by her name,
how long ago, the words verbatim; newest kept in what heard_bytes leaves),
then "Just now:" with the new messages, whole, as before. With no earlier
line it is as it was.
- heard_bytes 1500 -> 2500. addressed_bytes and the echo check's bodies (the
new messages only) are unchanged.
- The Persona reads it after the stream and the Interpreter in her lived
moment; the Projector never (I16.7).
Verification: a fixture with Meta's question 12 minutes earlier shows it under
"Earlier in" in the Persona's and the Interpreter's prompts and nowhere in the
Projector's; bodies holds only the new message; a room with no earlier line is
unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
22ee30282b
commit
0cfc386f27
3 changed files with 61 additions and 6 deletions
|
|
@ -867,10 +867,42 @@ fn chat_stimulus(inputs: &Inputs, tuning: &Tuning) -> (String, String, Overflow)
|
||||||
}
|
}
|
||||||
heard_text.push_str(&line);
|
heard_text.push_str(&line);
|
||||||
}
|
}
|
||||||
|
// The conversation as it is on screen (map 16.20.3): the room's lines before the new ones, verbatim, newest kept in
|
||||||
|
// what `heard_bytes` leaves, then the new ones as above. The Persona's and the Interpreter's, never the Projector's
|
||||||
|
// (I16.7); the echo check's bodies stay the new messages.
|
||||||
|
let earlier = earlier_lines(inputs);
|
||||||
|
if !earlier.is_empty() {
|
||||||
|
let (room, just) = (turn_room(inputs).unwrap_or_default(), "Just now:");
|
||||||
|
let heading = format!("Earlier in {room}:");
|
||||||
|
let left = tuning.select.heard_bytes.saturating_sub(heard_text.len() + just.len() + heading.len() + 3);
|
||||||
|
let (kept, _) = newest_that_fit(&earlier, left);
|
||||||
|
if !kept.is_empty() {
|
||||||
|
heard_text = format!("{heading}\n{}\n{just}\n{heard_text}", kept.join("\n"));
|
||||||
|
}
|
||||||
|
}
|
||||||
let overflow = Overflow { stimulus: stimulus.len().saturating_sub(tuning.select.stimulus_bytes), heard: heard_text.len().saturating_sub(tuning.select.heard_bytes), said_to_her_not_shown: left_out, clipped_bytes: clipped };
|
let overflow = Overflow { stimulus: stimulus.len().saturating_sub(tuning.select.stimulus_bytes), heard: heard_text.len().saturating_sub(tuning.select.heard_bytes), said_to_her_not_shown: left_out, clipped_bytes: clipped };
|
||||||
(stimulus, heard_text, overflow)
|
(stimulus, heard_text, overflow)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The turn room's lines before this turn's new messages, oldest first, as the Persona reads them: who (her own lines by
|
||||||
|
/// her name), how long ago, and the words verbatim.
|
||||||
|
fn earlier_lines(inputs: &Inputs) -> Vec<String> {
|
||||||
|
let messages = &inputs.room.messages;
|
||||||
|
let Some(newest) = messages.iter().map(|line| line.at_ms).max() else {
|
||||||
|
return Vec::new();
|
||||||
|
};
|
||||||
|
let new = |line: &RoomLine| messages.iter().any(|message| message.sender == line.sender && message.at_ms == line.at_ms && message.text == line.text);
|
||||||
|
let own = text(inputs.state, &["publicName"]);
|
||||||
|
recent_lines(inputs)
|
||||||
|
.into_iter()
|
||||||
|
.filter(|line| !new(line) && line.at_ms <= newest)
|
||||||
|
.map(|line| {
|
||||||
|
let name = if line.sender == inputs.people.own_sender && !own.is_empty() { clip(&one_line(own), NAME_BYTES) } else { name_of(line, inputs) };
|
||||||
|
format!("{name}, {} min ago: {}", minutes(inputs.now, line.at_ms), spoken(&line.text))
|
||||||
|
})
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
||||||
/// Whole lines, newest kept, that fit `budget` bytes with their newlines, and how many older ones did not.
|
/// Whole lines, newest kept, that fit `budget` bytes with their newlines, and how many older ones did not.
|
||||||
fn newest_that_fit(lines: &[String], budget: usize) -> (Vec<String>, usize) {
|
fn newest_that_fit(lines: &[String], budget: usize) -> (Vec<String>, usize) {
|
||||||
let mut kept: Vec<String> = Vec::new();
|
let mut kept: Vec<String> = Vec::new();
|
||||||
|
|
|
||||||
|
|
@ -530,13 +530,13 @@ fn a_short_message_to_her_survives_long_chatter_after_it() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn a_message_to_her_over_the_cap_goes_in_whole_and_the_overflow_is_recorded() {
|
fn a_message_to_her_over_the_cap_goes_in_whole_and_the_overflow_is_recorded() {
|
||||||
let big = format!("Eureka, {}", "please read this whole thing ".repeat(70));
|
let big = format!("Eureka, {}", "please read this whole thing ".repeat(100));
|
||||||
assert_eq!(big.len(), 2038);
|
assert_eq!(big.len(), 2908);
|
||||||
let room = Room { messages: vec![message("#swarm:gamecult.org", "@libby:gamecult.org", "Libby", &big, 1, true)], tail: vec![], here: None, ..Room::default() };
|
let room = Room { messages: vec![message("#swarm:gamecult.org", "@libby:gamecult.org", "Libby", &big, 1, true)], tail: vec![], here: None, ..Room::default() };
|
||||||
let packet = packet_of(TurnKind::Chat, &state(), &room, &History::default(), 1);
|
let packet = packet_of(TurnKind::Chat, &state(), &room, &History::default(), 1);
|
||||||
assert_eq!(packet.heard, format!("Libby, in #swarm:gamecult.org: \"{big}\""));
|
assert_eq!(packet.heard, format!("Libby, in #swarm:gamecult.org: \"{big}\""));
|
||||||
assert!(packet.stimulus.contains(big.trim_end()) && !packet.stimulus.contains("not shown"), "no note claims messages that do not exist: {}", &packet.stimulus[..80]);
|
assert!(packet.stimulus.contains(big.trim_end()) && !packet.stimulus.contains("not shown"), "no note claims messages that do not exist: {}", &packet.stimulus[..80]);
|
||||||
assert_eq!(packet.overflow, Overflow { stimulus: packet.stimulus.len() - 1500, heard: packet.heard.len() - 1500, said_to_her_not_shown: 0, clipped_bytes: 0 });
|
assert_eq!(packet.overflow, Overflow { stimulus: packet.stimulus.len() - 1500, heard: packet.heard.len() - 2500, said_to_her_not_shown: 0, clipped_bytes: 0 });
|
||||||
assert!(packet.overflow.stimulus > 0 && packet.overflow.heard > 0);
|
assert!(packet.overflow.stimulus > 0 && packet.overflow.heard > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -604,7 +604,7 @@ fn budgets_hold_under_adversarial_sizes() {
|
||||||
let packet = packet_of(kind, &big, &room, &History::default(), seed);
|
let packet = packet_of(kind, &big, &room, &History::default(), seed);
|
||||||
within_guards(&packet, &tuning);
|
within_guards(&packet, &tuning);
|
||||||
assert!(packet.clipped.first().is_some_and(|first| first == "(identity)") && packet.selected.iter().filter(|pick| pick.id[1..].parse::<u32>().is_ok()).all(|pick| packet.clipped.contains(&pick.id)), "every clip is reported: {:?}", packet.clipped);
|
assert!(packet.clipped.first().is_some_and(|first| first == "(identity)") && packet.selected.iter().filter(|pick| pick.id[1..].parse::<u32>().is_ok()).all(|pick| packet.clipped.contains(&pick.id)), "every clip is reported: {:?}", packet.clipped);
|
||||||
assert!(packet.stimulus.len() <= 1500 && packet.heard.len() <= 1500, "{kind:?}: stimulus {} heard {}", packet.stimulus.len(), packet.heard.len());
|
assert!(packet.stimulus.len() <= 1500 && packet.heard.len() <= 2500, "{kind:?}: stimulus {} heard {}", packet.stimulus.len(), packet.heard.len());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let packet = packet_of(TurnKind::Chat, &big, &room, &History::default(), 1);
|
let packet = packet_of(TurnKind::Chat, &big, &room, &History::default(), 1);
|
||||||
|
|
@ -2072,6 +2072,28 @@ fn k15_the_speaking_cues_reach_the_persona_and_the_interpreter_and_never_the_pro
|
||||||
assert!(quiet.speaking.is_empty() && !quiet.context.contains("- the conversation"), "{}", quiet.context);
|
assert!(quiet.speaking.is_empty() && !quiet.context.contains("- the conversation"), "{}", quiet.context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn k19_the_conversation_on_screen_reaches_the_persona_and_the_interpreter_and_never_the_projector() {
|
||||||
|
const QUESTION: &str = "Eureka, WALNUT-QUESTION: how is the door fix going?";
|
||||||
|
let room = Room {
|
||||||
|
messages: vec![message("#swarm:gamecult.org", "@libby:gamecult.org", "Libby", "Eureka, back yet?", 1, true)],
|
||||||
|
tail: vec![message("#swarm:gamecult.org", OPERATOR, "Meta", QUESTION, 12, true), message("#swarm:gamecult.org", OWN, "", "In a minute.", 11, false), message("#swarm:gamecult.org", "@libby:gamecult.org", "Libby", "Eureka, back yet?", 1, true)],
|
||||||
|
here: Some("#swarm:gamecult.org".into()),
|
||||||
|
..Room::default()
|
||||||
|
};
|
||||||
|
let packet = packet_of(TurnKind::Chat, &state(), &room, &History::default(), 1);
|
||||||
|
let escaped = serde_json::to_string(QUESTION).unwrap();
|
||||||
|
assert_eq!(packet.heard, format!("Earlier in #swarm:gamecult.org:\nMeta, the operator, 12 min ago: {escaped}\nEureka, 11 min ago: \"In a minute.\"\nJust now:\nLibby, in #swarm:gamecult.org: \"Eureka, back yet?\""), "the new message once, under Just now");
|
||||||
|
assert_eq!(packet.bodies, ["Eureka, back yet?"], "an echo is measured against the new messages only");
|
||||||
|
let tuning = Tuning::default();
|
||||||
|
let persona = narrate::persona_prompt(&packet, "The room is warm.", &tuning);
|
||||||
|
let speech = interpret::speech_prompt(&packet, "The room is warm.", "y", &tuning);
|
||||||
|
assert!(persona.contains(&format!("Earlier in #swarm:gamecult.org:\nMeta, the operator, 12 min ago: {escaped}")) && speech.contains(&format!("Earlier in #swarm:gamecult.org:\nMeta, the operator, 12 min ago: {escaped}")), "{persona}\n{speech}");
|
||||||
|
assert!(!narrate::projector_prompt(&packet, &tuning).contains("WALNUT-QUESTION"), "the Projector never sees the words");
|
||||||
|
// With no earlier line, what she reads is as it was.
|
||||||
|
assert_eq!(packet_of(TurnKind::Chat, &state(), &chat_room(), &History::default(), 1).heard, "Libby, in #swarm:gamecult.org: \"Eureka, did you see the door fix?\"\nKiko, in #swarm:gamecult.org: \"She saw it. She hated it.\"");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn the_frame_says_once_what_the_outcome_is_in_her_own_pronouns() {
|
fn the_frame_says_once_what_the_outcome_is_in_her_own_pronouns() {
|
||||||
for (pronouns, sentence) in [("she/her", "What came of her last turn is what came of what she last meant to do, which she is only now finding out"), ("he/him", "What came of his last turn is what came of what he last meant to do, which he is only now finding out"), ("any", "which they are only now finding out: whenever something they meant did not happen, the stream begins from it, as they notice it, never as a list")] {
|
for (pronouns, sentence) in [("she/her", "What came of her last turn is what came of what she last meant to do, which she is only now finding out"), ("he/him", "What came of his last turn is what came of what he last meant to do, which he is only now finding out"), ("any", "which they are only now finding out: whenever something they meant did not happen, the stream begins from it, as they notice it, never as a list")] {
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,8 @@ pub struct SelectTuning {
|
||||||
/// What came of her last turn, in bytes, heading included: taken first, under its own guard (map 16.16).
|
/// What came of her last turn, in bytes, heading included: taken first, under its own guard (map 16.16).
|
||||||
pub outcome_bytes: usize,
|
pub outcome_bytes: usize,
|
||||||
pub stimulus_bytes: usize,
|
pub stimulus_bytes: usize,
|
||||||
/// What was said to her, verbatim, for the Persona stage.
|
/// What was said to her, verbatim, for the Persona stage: on a chat turn, the room's earlier lines too, before the new
|
||||||
|
/// ones (map 16.20.3).
|
||||||
pub heard_bytes: usize,
|
pub heard_bytes: usize,
|
||||||
/// The ceiling of the messages to her, in the stimulus and in the heard lines alike: they pass the stimulus and heard
|
/// The ceiling of the messages to her, in the stimulus and in the heard lines alike: they pass the stimulus and heard
|
||||||
/// caps whole, newest first, up to this, and the older ones are counted.
|
/// caps whole, newest first, up to this, and the older ones are counted.
|
||||||
|
|
@ -228,7 +229,7 @@ impl Default for SelectTuning {
|
||||||
here_bytes: 768,
|
here_bytes: 768,
|
||||||
outcome_bytes: 1200,
|
outcome_bytes: 1200,
|
||||||
stimulus_bytes: 1500,
|
stimulus_bytes: 1500,
|
||||||
heard_bytes: 1500,
|
heard_bytes: 2500,
|
||||||
addressed_bytes: 8 * 1024,
|
addressed_bytes: 8 * 1024,
|
||||||
identity_bytes: 700,
|
identity_bytes: 700,
|
||||||
bond_summary_bytes: 600,
|
bond_summary_bytes: 600,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue