Persona live organ: one-turn, drain, wake-humans-pace, turn memory (squash of hands/persona-live-drain) #83

Merged
eureka merged 287 commits from hands/persona-live-drain into main 2026-11-28 07:05:45 +00:00
2 changed files with 16 additions and 3 deletions
Showing only changes of commit de720eacef - Show all commits

Persona wake: the open floor has one form gate and one speaker gate, and its once-per-line and tagged-line cases are pinned

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Meta Vens 2026-11-27 21:54:35 +01:00

View file

@ -542,7 +542,7 @@ pub(crate) fn wakes(who: &Addressee, delivery: &ChatDelivery, speaker: Speaker,
}
let addressed = is_for(who, delivery);
if speaker.human() {
let wakes = addressed || facts.own_room || facts.in_exchange || (speaker == Speaker::Member && facts.open_floor);
let wakes = addressed || facts.own_room || facts.in_exchange || facts.open_floor;
return wakes.then_some(if addressed { WakeCause::AddressedByHuman } else { WakeCause::Human });
}
let explicit = delivery.mentions.iter().any(|id| id == who.matrix_id()) || matches!(delivery.basis, Some(Basis::Tag | Basis::Reply));
@ -563,9 +563,8 @@ pub(crate) struct Hearer<'a> {
/// (`tempo::pick`) among the hearers whose floor is open, so the poll and the simulator choose the same one. None when the
/// line is not open or no hearer is eligible.
pub(crate) fn floor_to(hearers: &[Hearer], speaker: Speaker, beat_s: u32) -> Option<usize> {
let line = &hearers.first()?.delivery;
hearers.first()?;
let open = speaker == Speaker::Member
&& line.form == Form::Message
&& !hearers.iter().any(|hearer| hearer.delivery.is_direct || !hearer.delivery.mentions.is_empty() || is_for(hearer.addressee, &hearer.delivery));
if !open {
return None;

View file

@ -880,6 +880,20 @@ mod wake_rule {
assert_eq!(rig.poll(), Outcome::Polled { launched: vec![Slug("bob".into())] }, "unless the line addresses her");
}
#[test]
fn every_open_line_a_mind_took_in_one_wake_is_taken_and_a_line_tagging_anyone_is_not_open() {
let rig = quiet_rig();
said_in_general(&rig, general(1, "@newcomer:chat", "hello everyone!"));
said_in_general(&rig, general(2, "@other:chat", "hello, I am new too"));
assert_eq!(rig.poll(), Outcome::Polled { launched: vec![Slug("ann".into())] });
rig.end_unit(ANN);
rig.advance(1);
assert_eq!(rig.poll(), Outcome::Polled { launched: vec![] }, "her one turn took both lines: Bob is not picked for the second");
let rig = quiet_rig();
said_in_general(&rig, ChatDelivery { mentions: vec!["@alice:chat".into()], ..general(3, "@newcomer:chat", "hello alice") });
assert_eq!(rig.poll(), Outcome::Polled { launched: vec![] }, "a line that tags a person is not the floor's");
}
#[test]
fn a_minds_own_line_a_notice_an_edit_a_tag_or_an_operator_opens_no_floor() {
for (line, why) in [