diff --git a/crates/mind-body/src/projection/select.rs b/crates/mind-body/src/projection/select.rs index ea0837b..dbf4ff1 100644 --- a/crates/mind-body/src/projection/select.rs +++ b/crates/mind-body/src/projection/select.rs @@ -165,24 +165,15 @@ impl RoomKind { } } -/// One thing she said, from the trace. -#[derive(Clone, Debug, PartialEq, Eq)] -pub(crate) struct Said { - pub id: String, - pub room: String, - pub text: String, - pub at: DateTime, -} - -/// What earlier turns left: the ids each of the last projections selected, oldest first, what she said, her state at her -/// last turn (movement is measured against it), and what came of her last turn (`outcome`, from its record). The commit's +/// What earlier turns left: the ids each of the last projections selected, oldest first, her state at her last turn +/// (movement is measured against it), and what came of her last turn (`outcome`, from its record). Her past lines are +/// not here: in this conversation they reach her through the exchange block of her view, and never the Projector, since +/// a line of hers can carry someone else's words (map 16.30.10, Soul's finding 9). The commit's /// trace v2 (C3c) is its source; until then only what a caller carried: the simulation's earlier turns, a harness /// fixture's record. #[derive(Clone, Debug, Default, PartialEq)] pub(crate) struct History { pub recent: Vec>, - /// Each line's `id` is the event its receipt named, the one the outcome's `posted` carries. - pub said: Vec, pub previous: Option, pub last: Option, } @@ -266,7 +257,6 @@ pub(crate) enum Pool { Incubation, Stance, Value, - Said, } /// One selected item: its id goes to the trace, never to the narration. @@ -370,8 +360,7 @@ pub(crate) struct Packet { pub unshown: Vec, } -/// A line of hers she may add to (map 16.17): one her last turn posted, or a `Said` line this packet shows, in the turn's -/// room only. The Interpreter cites it by `id` (`a1`, `a2`); `event` is the actuator's handle on it, never shown to a model. +/// A line of hers she may add to (map 16.17): one her last turn posted, in the turn's room only. The Interpreter cites it by `id` (`a1`, `a2`); `event` is the actuator's handle on it, never shown to a model. #[derive(Clone, Debug, PartialEq, Eq, Serialize)] pub(crate) struct Amendable { pub id: String, @@ -782,16 +771,6 @@ fn candidates(inputs: &Inputs, tuning: &Tuning, present: &BTreeSet, touc let relevance = relevance_log(&format!("{} {}", text(value, &["label"]), text(value, &["summary"])), touching); push(id, Pool::Value, Scope::Plain, &one_line(text(value, &["summary"])), &line, number(value, &["priority"]).unwrap_or(SALIENCE_UNSTATED), relevance, TOUCH_ELSE, 1.0); } - - // Her last turn's lines are the outcome's to show, not this pool's. - let last_posted = |said: &&Said| inputs.history.last.as_ref().is_none_or(|last| !last.posted.iter().any(|posted| posted.event == said.id)); - for said in inputs.history.said.iter().filter(last_posted) { - let touch = if Some(said.room.as_str()) == here { TOUCH_ROOM } else { TOUCH_ELSE }; - // What she said in a direct message is private about its partner: shown only there, still only the two of them. - let partner = direct(inputs, &said.room).then(|| Concerns::Partner(said.room.clone())); - let line = |words: &str| format!("- {} said [{}] in {}: {}", her.subj, said.id, said.room, spoken(words)); - push(&said.id, Pool::Said, scope(inputs, partner.as_ref(), present), &said.text, &line, SALIENCE_UNSTATED, recency_log(Some(said.at), inputs.now, tuning.select.memory_tau_h), touch, 1.0); - } out } @@ -823,7 +802,6 @@ fn cap_of(pool: Pool, tuning: &Tuning) -> usize { Pool::Incubation => caps.incubation, Pool::Stance => caps.stance, Pool::Value => caps.value, - Pool::Said => caps.said, } } @@ -2347,15 +2325,13 @@ pub(crate) fn select(inputs: &Inputs, tuning: &Tuning) -> Packet { ids.extend(taken.iter().map(|candidate| candidate.id.clone())); private.extend(taken.iter().filter_map(|candidate| candidate.private.clone())); clipped.extend(taken.iter().filter(|candidate| candidate.clipped).map(|candidate| candidate.id.clone())); - // What she may add to: her last turn's lines, then the Said lines this packet shows, in the turn's room only. + // What she may add to: her last turn's lines, in the turn's room only. let here = turn_room(inputs); - let last_lines = inputs.history.last.iter().flat_map(|last| &last.posted).map(|posted| (&posted.event, &posted.room, &posted.text)); - let shown_said = taken.iter().filter(|candidate| candidate.pool == Pool::Said).filter_map(|candidate| inputs.history.said.iter().find(|said| said.id == candidate.id)).map(|said| (&said.id, &said.room, &said.text)); - let amendable = last_lines - .chain(shown_said) - .filter(|(_, room, _)| Some(room.as_str()) == here) + let amendable = inputs.history.last.iter() + .flat_map(|last| &last.posted) + .filter(|posted| Some(posted.room.as_str()) == here) .enumerate() - .map(|(at, (event, room, text))| Amendable { id: format!("a{}", at + 1), event: event.clone(), room: room.clone(), text: text.clone() }) + .map(|(at, posted)| Amendable { id: format!("a{}", at + 1), event: posted.event.clone(), room: posted.room.clone(), text: posted.text.clone() }) .collect(); let selected = taken.into_iter().map(|candidate| Pick { id: candidate.id, pool: candidate.pool, log_score: candidate.log_score }).collect(); // Her view (map 16.23.1, 16.29.10): what came of her last turn, then her promises, then her domain; the room follows diff --git a/crates/mind-body/src/projection/tests.rs b/crates/mind-body/src/projection/tests.rs index 23c431c..f7dcaad 100644 --- a/crates/mind-body/src/projection/tests.rs +++ b/crates/mind-body/src/projection/tests.rs @@ -1528,7 +1528,7 @@ fn every_range_is_validated_on_its_own() { refused(&|t| t.select.temperature = 11.0, "select.temperature"); refused(&|t| t.select.addressed_bytes = 512, "select.addressed_bytes"); refused(&|t| t.select.addressed_bytes = 300 * 1024, "select.addressed_bytes"); - refused(&|t| t.select.caps = tuning::PoolCaps { memories_about_present: 0, other_memories: 0, needs: 0, incubation: 0, stance: 0, value: 0, said: 0 }, "select.caps"); + refused(&|t| t.select.caps = tuning::PoolCaps { memories_about_present: 0, other_memories: 0, needs: 0, incubation: 0, stance: 0, value: 0 }, "select.caps"); let mut edge = Tuning::default(); // Each guard at its floor, and no guard measured against another's: a large identity beside small sections is fine. edge.select.body_bytes = tuning::BODY_ROOM_MIN; @@ -2006,18 +2006,6 @@ fn soul_q5c_a_direct_message_with_a_third_person_is_not_a_direct_message_with_he assert!(packet_of(TurnKind::Chat, &marked, &alone, &History::default(), 1).context.contains("Libby holds the sounds"), "plain with Libby alone"); } -#[test] -fn what_she_said_in_a_direct_message_stays_in_it() { - let said = |room: &str| super::select::Said { id: "said-dm".into(), room: room.into(), text: "SAIDDM I'm tired of the pipeline.".into(), at: now() - chrono::Duration::minutes(5) }; - let history = History { said: vec![said(DM_DERU)], ..History::default() }; - let shown = |room: &Room| (1..=60).any(|seed| packet_of(TurnKind::Chat, &state(), room, &history, seed).context.contains("SAIDDM")); - assert!(!shown(&chat_room()), "never in a public packet"); - let with_deru = Room { messages: vec![message(DM_DERU, DERU, "Deru", "and?", 2, true)], here: Some(DM_DERU.into()), direct: vec![DM_DERU.into()], ..Room::default() }; - assert!(shown(&with_deru), "in its own direct message"); - let public = History { said: vec![said("#swarm:gamecult.org")], ..History::default() }; - assert!((1..=60).any(|seed| packet_of(TurnKind::Chat, &state(), &chat_room(), &public, seed).context.contains("SAIDDM")), "a public line is shared"); -} - /// A record of her last turn: one line that went out in #swarm, and a reach for what her body cannot do. fn last_turn(said: &str) -> Value { json!({ @@ -2083,24 +2071,16 @@ fn a_chosen_silence_opens_no_section_and_no_record_none() { } #[test] -fn her_last_turns_line_is_the_outcomes_and_not_the_said_pools() { - let said = super::select::Said { id: "said-last".into(), room: "#swarm:gamecult.org".into(), text: "SAIDLAST the file is coming.".into(), at: now() - chrono::Duration::minutes(5) }; - let pooled = |history: &History| (1..=60).any(|seed| packet_of(TurnKind::Chat, &state(), &chat_room(), history, seed).selected.iter().any(|pick| pick.id == "said-last")); - assert!(pooled(&History { said: vec![said.clone()], ..History::default() }), "a line of hers is in the pool"); - assert!(!pooled(&History { said: vec![said], ..with_last(&last_turn("SAIDLAST the file is coming.")) }), "her last turn's line is the outcome's to show"); -} - -#[test] -fn what_she_may_add_to_is_her_last_turns_lines_and_the_said_lines_shown_in_this_room_only() { +/// Map 16.30.10: her past lines are no pool of the Projector's, so what she may add to is her last turn's lines alone, +/// in this room. +fn what_she_may_add_to_is_her_last_turns_lines_in_this_room_only() { let record = json!({ "interpreter": { "heard": [], "room": "#swarm:gamecult.org", "said": [], "refused": [], "gaps": [] }, "posted": [ { "event": "ev-here", "room": "#swarm:gamecult.org", "text": "I'll send it." }, { "event": "ev-there", "room": "#elsewhere:gamecult.org", "text": "Elsewhere line." }, ] }); - let said = super::select::Said { id: "said-older".into(), room: "#swarm:gamecult.org".into(), text: "SAIDOLDER the pipeline is fine.".into(), at: now() - chrono::Duration::minutes(50) }; - let history = History { said: vec![said], ..with_last(&record) }; - let packet = (1..=60).map(|seed| packet_of(TurnKind::Chat, &state(), &chat_room(), &history, seed)).find(|packet| packet.selected.iter().any(|pick| pick.id == "said-older")).expect("the Said line is drawn on some seed"); + let packet = packet_of(TurnKind::Chat, &state(), &chat_room(), &with_last(&record), 1); let amendable = |id: &str, event: &str, text: &str| super::select::Amendable { id: id.into(), event: event.into(), room: "#swarm:gamecult.org".into(), text: text.into() }; - assert_eq!(packet.amendable, [amendable("a1", "ev-here", "I'll send it."), amendable("a2", "said-older", "SAIDOLDER the pipeline is fine.")]); + assert_eq!(packet.amendable, [amendable("a1", "ev-here", "I'll send it.")]); assert!(!narrate::projector_prompt(&packet, &Tuning::default()).contains("- a1 "), "the Projector never sees the ids"); assert_eq!(packet_of(TurnKind::Chat, &state(), &chat_room(), &History::default(), 1).amendable, []); } diff --git a/crates/mind-body/src/projection/tuning.rs b/crates/mind-body/src/projection/tuning.rs index fec7084..dfe99b0 100644 --- a/crates/mind-body/src/projection/tuning.rs +++ b/crates/mind-body/src/projection/tuning.rs @@ -191,7 +191,6 @@ pub struct PoolCaps { pub incubation: usize, pub stance: usize, pub value: usize, - pub said: usize, } /// The weighted draw of the lens a turn begins from. @@ -274,7 +273,7 @@ impl Default for SelectTuning { impl Default for PoolCaps { fn default() -> Self { - Self { memories_about_present: 2, other_memories: 2, needs: 1, incubation: 1, stance: 1, value: 1, said: 1 } + Self { memories_about_present: 2, other_memories: 2, needs: 1, incubation: 1, stance: 1, value: 1 } } } @@ -305,7 +304,7 @@ impl Tuning { bail!("select.addressed_bytes must be from {} to {}, not {}", ADDRESSED_RANGE.start(), ADDRESSED_RANGE.end(), select.addressed_bytes); } let caps = &select.caps; - if [caps.memories_about_present, caps.other_memories, caps.needs, caps.incubation, caps.stance, caps.value, caps.said].iter().all(|cap| *cap == 0) { + if [caps.memories_about_present, caps.other_memories, caps.needs, caps.incubation, caps.stance, caps.value].iter().all(|cap| *cap == 0) { bail!("select.caps are all 0: a packet could hold nothing of her"); } positive("select.inclusion_score", select.inclusion_score)?;