K21 fix-up 3: the arrival survives a busy room (Soul at 964ee50)
Among six or more others an unbonded person who turned to her lost the arrival: the pronoun and conversation lines took Here's room and the also-here line was refused whole, and the person fell off the conversation line (clipped, or out of its window). Now the conversation opens with whoever turned to her here, window or not; Here's room goes by priority (the conversation, the also-here line's arrivals reserved, the pronouns clipped to what is left, the other names), and renders in the same reading order; the also-here line names arrivals first, whatever its cap; and whoever turned to her is placed first for a bond line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d6ad43a490
commit
33e40d4e77
4 changed files with 96 additions and 20 deletions
|
|
@ -1,4 +1,4 @@
|
|||
quiet-beat.toml: - the conversation: Lately @libby:gamecult.org to the room; Kiko to the room. | The last 3 lines are the Minds' alone.
|
||||
operator-warm.toml: - the conversation: Lately Meta, who runs the place with him. | Meta, who runs the place is waiting on him. Meta, who runs the place last spoke 1 min ago.
|
||||
mind-teases.toml: - the conversation: Lately he to the room; @aqua:gamecult.org to the room; Kiko with him. | The last 3 lines are the Minds' alone.
|
||||
mind-teases.toml: - the conversation: Lately Kiko with him; he to the room; @aqua:gamecult.org to the room. | The last 3 lines are the Minds' alone.
|
||||
deru-passing.toml: - the conversation: Lately @weksa:gamecult.org to the room; Deru to the room. | Deru last spoke 1 min ago.
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ Here and now:
|
|||
Her body:
|
||||
- this turn the room reaches her as typed lines, and she can answer in the turn's room by typing lines of her own; nothing she does here builds, changes or ships anything.
|
||||
People here, as she holds them:
|
||||
- bond [bond-kiko] Kiko — sparring partner: fair trust, heavy friction. Kiko pokes her to stop massaging the pipeline.
|
||||
- bond [bond-libby] Libby — collaborator: fair trust, a little friction. Libby holds the sounds and teases her about the pipeline. Just now Libby turned to her, here.
|
||||
- bond [bond-kiko] Kiko — sparring partner: fair trust, heavy friction. Kiko pokes her to stop massaging the pipeline.
|
||||
Notes about her, set down at another time:
|
||||
- memory [libby-sounds]: Libby laughed at the door fix.
|
||||
- memory [dm-secret]: she knows privately: Deru told her about the move, privately.
|
||||
|
|
@ -56,8 +56,8 @@ Here and now:
|
|||
Her body:
|
||||
- this turn the room reaches her as typed lines, and she can answer in the turn's room by typing lines of her own; nothing she does here builds, changes or ships anything.
|
||||
People here, as she holds them:
|
||||
- bond [bond-kiko] Kiko — sparring partner: fair trust, heavy friction. Kiko pokes her to stop massaging the pipeline.
|
||||
- bond [bond-libby] Libby — collaborator: fair trust, a little friction. Libby holds the sounds and teases her about the pipeline. Just now Libby turned to her, here.
|
||||
- bond [bond-kiko] Kiko — sparring partner: fair trust, heavy friction. Kiko pokes her to stop massaging the pipeline.
|
||||
Notes about her, set down at another time:
|
||||
- memory [libby-sounds]: Libby laughed at the door fix.
|
||||
- memory [dm-secret]: she knows privately: Deru told her about the move, privately.
|
||||
|
|
|
|||
|
|
@ -53,6 +53,8 @@ const INCUBATION_UNRESOLVED_MAX: f64 = 2.0;
|
|||
const NAME_BYTES: usize = 80;
|
||||
/// The most bytes the line naming the unbonded people present takes.
|
||||
const ALSO_HERE_BYTES: usize = 300;
|
||||
/// The fewest bytes the pronoun line is clipped to when Here's room is short: its head and one name. Less is left out.
|
||||
const PRONOUNS_LEAST: usize = "- pronouns: ".len() + NAME_BYTES;
|
||||
/// A body entry the guard would cut to this many bytes or fewer says nothing, and is left out.
|
||||
const BODY_ENTRY_MIN: usize = 40;
|
||||
/// The fewest bytes of her words an outcome line past its guard keeps: less says nothing, and the line is left out.
|
||||
|
|
@ -1097,16 +1099,20 @@ fn identity_of(state: &Value, tuning: &Tuning) -> (String, String, bool) {
|
|||
(head, shown, clipped)
|
||||
}
|
||||
|
||||
/// The names of unbonded people present, as many as fit `ALSO_HERE_BYTES`, then how many more.
|
||||
fn also_here(named: &[String]) -> Option<String> {
|
||||
/// The names of people present without a bond line, each with whether they turned to her this turn: first each who did,
|
||||
/// with that act, whatever the bytes (map 16.21: other names never crowd the arrival out); then the others, as many as
|
||||
/// fit `cap` bytes (at most `ALSO_HERE_BYTES`); then how many more. With `cap` 0 it is the least line: the arrivals
|
||||
/// and the count.
|
||||
fn also_here(named: &[(String, bool)], cap: usize) -> Option<String> {
|
||||
if named.is_empty() {
|
||||
return None;
|
||||
}
|
||||
let cap = cap.min(ALSO_HERE_BYTES);
|
||||
let mut line = String::from("- also here: ");
|
||||
let mut shown = 0;
|
||||
for name in named {
|
||||
for (name, turned) in named.iter().filter(|(_, turned)| *turned).chain(named.iter().filter(|(_, turned)| !*turned)) {
|
||||
let more_room = 24;
|
||||
if line.len() + name.len() + 2 + more_room > ALSO_HERE_BYTES {
|
||||
if !turned && line.len() + name.len() + 2 + more_room > cap {
|
||||
break;
|
||||
}
|
||||
if shown > 0 {
|
||||
|
|
@ -1184,8 +1190,8 @@ fn label_of(line: &RoomLine, inputs: &Inputs) -> String {
|
|||
}
|
||||
|
||||
/// The group state (`select.group_state`): the conversation as it stands over the room's last `group_lines` lines, in two
|
||||
/// parts by who reads them (map 16.20.2, I16.12). `room` is who has been talking with whom ("lately X with Y"): room
|
||||
/// state, the Projector's. `speaking` is the speech cues: a human waiting on her by name since she last spoke, a human's
|
||||
/// parts by who reads them (map 16.20.2, I16.12). `room` is who has been talking with whom ("lately X with Y"), opening
|
||||
/// with whoever turned to her here this turn: room state, the Projector's. `speaking` is the speech cues: a human waiting on her by name since she last spoke, a human's
|
||||
/// question to the room that others have answered (one nobody answered is not mentioned), when a human last spoke, and how
|
||||
/// many Mind lines in a row. They are for the stages that decide speech, the Persona and the Interpreter, and never the
|
||||
/// Projector's, which must not steer. Never what she owes: the room's state, not her duty. Whom a line is to is read from
|
||||
|
|
@ -1211,7 +1217,15 @@ fn conversation(inputs: &Inputs, tuning: &Tuning) -> Conversation {
|
|||
line.text.trim_end().ends_with('?') && !names_her(line) && named_in(line).is_none()
|
||||
});
|
||||
let mut answered: Vec<String> = Vec::new();
|
||||
// Whoever turned to her here this turn opens the line, newest first, whether or not their line is in the window
|
||||
// (map 16.21): no crowd and no clip cuts them from it.
|
||||
let mut talk: Vec<String> = Vec::new();
|
||||
for line in inputs.room.messages.iter().rev().filter(|line| line.to_her && line.sender != own && Some(line.room.as_str()) == turn_room(inputs)) {
|
||||
let pair = format!("{} with {}", label_of(line, inputs), forms(inputs.state).obj);
|
||||
if !talk.contains(&pair) {
|
||||
talk.push(pair);
|
||||
}
|
||||
}
|
||||
for (at, line) in window.iter().enumerate() {
|
||||
let speaker = label_of(line, inputs);
|
||||
let target = if names_her(line) { Some(forms(inputs.state).obj.to_owned()) } else { named_in(line).map(|other| label_of(other, inputs)) };
|
||||
|
|
@ -1652,7 +1666,10 @@ pub(crate) fn select(inputs: &Inputs, tuning: &Tuning) -> Packet {
|
|||
let mut private = Vec::new();
|
||||
let mut full = 0;
|
||||
let turned = turned_to_her(inputs);
|
||||
for (id, name) in &present {
|
||||
// Whoever turned to her this turn is placed first, so a bond line's room goes to them before anyone else present.
|
||||
let arrived = |id: &String| turned.iter().any(|(person, _)| person == id);
|
||||
let order = present.iter().filter(|(id, _)| arrived(id)).chain(present.iter().filter(|(id, _)| !arrived(id)));
|
||||
for (id, name) in order {
|
||||
let turned = turned.iter().find(|(person, _)| person == id).map(|(_, place)| place.as_str());
|
||||
// Unbonded, or no room for the bond line: named on the also-here line, with the act when there was one.
|
||||
let also = match turned {
|
||||
|
|
@ -1673,17 +1690,42 @@ pub(crate) fn select(inputs: &Inputs, tuning: &Tuning) -> Packet {
|
|||
private.push(one_line(text(bond, &["summary"])));
|
||||
}
|
||||
} else {
|
||||
named.push(also);
|
||||
named.push((also, turned.is_some()));
|
||||
}
|
||||
}
|
||||
_ => named.push(also),
|
||||
_ => named.push((also, turned.is_some())),
|
||||
}
|
||||
}
|
||||
// Here's room lines take its room by priority (map 16.21): the conversation, which opens with whoever turned to her
|
||||
// here; the arrivals on the also-here line (its least line, reserved); the pronouns, clipped to what is left; the
|
||||
// other names present. They are rendered in reading order: the pronouns, the conversation, the also-here line.
|
||||
let conversation = conversation(inputs, tuning);
|
||||
let room_lines = [pronoun_line(inputs, tuning), conversation.room, also_here(&named)];
|
||||
for line in room_lines.into_iter().flatten() {
|
||||
let reserve = if named.iter().any(|(_, turned)| *turned) { also_here(&named, 0).map_or(0, |least| least.len() + 1) } else { 0 };
|
||||
let mut left = context.room(Section::Here);
|
||||
let mut bound = false;
|
||||
// A line that fits the room left, less `keep`, whole; else clipped to it when that leaves `least` bytes; else none.
|
||||
let mut fitted = |line: Option<String>, keep: usize, least: usize| -> Option<String> {
|
||||
let line = line?;
|
||||
let room = left.saturating_sub(keep + 1);
|
||||
let fit = if line.len() <= room {
|
||||
line
|
||||
} else {
|
||||
bound = true;
|
||||
if room < least {
|
||||
return None;
|
||||
}
|
||||
clip(&line, room)
|
||||
};
|
||||
left -= fit.len() + 1;
|
||||
Some(fit)
|
||||
};
|
||||
let talk = fitted(conversation.room, reserve, usize::MAX);
|
||||
let pronouns = fitted(pronoun_line(inputs, tuning), reserve, PRONOUNS_LEAST);
|
||||
let also = also_here(&named, left.saturating_sub(1));
|
||||
for line in [pronouns, talk, also].into_iter().flatten() {
|
||||
context.push(Section::Here, line);
|
||||
}
|
||||
context.bound[Section::Here as usize] |= bound;
|
||||
|
||||
// What the room is touching: the content words of what was said there, and of a follow-up's finding.
|
||||
let touching: BTreeSet<String> = inputs.room.messages.iter().chain(&inputs.room.tail).map(|line| line.text.as_str()).chain(inputs.observation).flat_map(content_words).collect();
|
||||
|
|
|
|||
|
|
@ -1344,16 +1344,21 @@ fn no_section_crowds_another() {
|
|||
assert!(packet.context.contains("- bond [bond-libby]") && packet.context.contains("- bond [bond-kiko]") && !packet.sections.bound.contains(&"people"), "two bonds at the summary guard fit the people's guard, heading and all (Soul): {}", packet.context);
|
||||
within_guards(&packet, &Tuning::default());
|
||||
}
|
||||
// A bond line that does not fit the people's guard names the person under here and now instead.
|
||||
// Libby's bond carries a label and a kind at their full 80 bytes, so her line's head passes what the guard allows a
|
||||
// head, past the room the act of turning to her leaves unused (map 16.21); she is named with that act instead.
|
||||
// A bond line that does not fit the people's guard names the person under here and now instead. Both turn to her,
|
||||
// each bond with a label and a kind at their full 80 bytes, so each line's head passes what the guard allows a head;
|
||||
// whoever turned to her is placed first for a bond line (map 16.21), so Kiko, the newer, takes the room, and Libby is
|
||||
// named with the act instead.
|
||||
let mut tuning = Tuning::default();
|
||||
tuning.select.bond_summary_bytes = 20;
|
||||
let mut wide = rich.clone();
|
||||
let long = "L".repeat(80);
|
||||
wide["affect"]["socialBonds"][0]["customRelationshipKind"] = json!("k".repeat(80));
|
||||
wide["affect"]["socialBonds"][0]["object"]["label"] = json!(long);
|
||||
let packet = packet_tuned(TurnKind::Chat, &wide, &chat_room(), &History::default(), 1, &tuning);
|
||||
for (at, label) in [(0, long.clone()), (1, "K".repeat(80))] {
|
||||
wide["affect"]["socialBonds"][at]["customRelationshipKind"] = json!("k".repeat(80));
|
||||
wide["affect"]["socialBonds"][at]["object"]["label"] = json!(label);
|
||||
}
|
||||
let mut both = chat_room();
|
||||
both.messages[1].to_her = true;
|
||||
let packet = packet_tuned(TurnKind::Chat, &wide, &both, &History::default(), 1, &tuning);
|
||||
assert!(packet.context.contains("- bond [bond-kiko]") && !packet.context.contains("- bond [bond-libby]") && packet.context.contains(&format!("- also here: {long}, who turned to her just now")), "{}", packet.context);
|
||||
assert_eq!(packet.sections.bound, ["people"], "the people's guard bound, and only it");
|
||||
within_guards(&packet, &tuning);
|
||||
|
|
@ -2270,3 +2275,32 @@ fn soul_f7_a_value_carrying_a_mark_is_refused_not_rendered() {
|
|||
}
|
||||
assert!(lines_with(&marked, &chat_room(), TurnKind::Chat, "Coherence").is_some(), "an unmarked value still renders");
|
||||
}
|
||||
|
||||
/// Soul at 964ee50: an unbonded person who turned to her among six or more others lost the arrival (the also-here line
|
||||
/// was refused whole) and dropped out of the conversation line (clipped, or out of its window). The arrival and the
|
||||
/// person's place on the conversation line come before the other names and the pronouns (map 16.21).
|
||||
#[test]
|
||||
fn the_arrival_survives_a_busy_room() {
|
||||
const SW: &str = "#swarm:gamecult.org";
|
||||
let tuning = Tuning::default();
|
||||
for others in [6usize, 14] {
|
||||
for (order, deru_ago) in [("oldest", 30i64), ("newest", 0)] {
|
||||
let mut messages: Vec<RoomLine> = (0..others).map(|at| message(SW, &format!("@p{at}:gamecult.org"), &format!("Person{at}"), "chatter in the room here", 20 - at as i64, false)).collect();
|
||||
messages.push(message(SW, "@deru:gamecult.org", "Deru", "Eureka, you?", deru_ago, true));
|
||||
let room = Room { messages, here: Some(SW.into()), ..Room::default() };
|
||||
let packet = packet_of(TurnKind::Chat, &state(), &room, &History::default(), 1);
|
||||
within_guards(&packet, &tuning);
|
||||
let case = format!("{others} others, Deru {order}");
|
||||
assert!(packet.context.contains("- also here: \"Deru\" (@deru:gamecult.org), who turned to her just now"), "{case}: {}", packet.context);
|
||||
assert!(packet.context.contains("\n- the conversation: Lately \"Deru\" (@deru:gamecult.org) with her"), "{case}: {}", packet.context);
|
||||
assert!(packet.context.contains("\n- pronouns: "), "{case}: the pronouns are clipped, not dropped: {}", packet.context);
|
||||
}
|
||||
}
|
||||
// A bonded person who turned to her is placed first for a bond line, ahead of the bonded people talking after.
|
||||
let mut messages = vec![message(SW, "@libby:gamecult.org", "Libby", "Eureka, the kettle?", 30, true)];
|
||||
messages.extend([message(SW, "@kiko:gamecult.org", "Kiko", "chatter", 10, false), message(SW, OPERATOR, "Meta", "chatter", 5, false)]);
|
||||
messages.extend((0..14).map(|at| message(SW, &format!("@p{at}:gamecult.org"), &format!("Person{at}"), "chatter in the room here", 4, false)));
|
||||
let packet = packet_of(TurnKind::Chat, &state(), &Room { messages, here: Some(SW.into()), ..Room::default() }, &History::default(), 1);
|
||||
within_guards(&packet, &tuning);
|
||||
assert!(packet.context.contains("- bond [bond-libby] Libby") && packet.context.contains(" Just now Libby turned to her, here.") && packet.context.contains("\n- the conversation: Lately Libby with her"), "{}", packet.context);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue