diff --git a/crates/mind-body/src/projection/commit.rs b/crates/mind-body/src/projection/commit.rs index b6f090d..5969fe2 100644 --- a/crates/mind-body/src/projection/commit.rs +++ b/crates/mind-body/src/projection/commit.rs @@ -47,7 +47,8 @@ pub(crate) enum Evidence { pub(crate) enum How { /// She did it. Kept, - /// She took it back, in a line or an addition that reached the person. + /// She took it back, in a line or an addition that reached the person; telling the person she cannot do it is taking + /// it back, the usual close of a blocked promise. Withdrawn, /// The person she promised let her off it (`persona-promise-release-by-interpreter`). Released, @@ -98,6 +99,13 @@ pub(crate) enum Refusal { } /// Which evidence each kind accepts: the table of map 16.22.7, one row per kind (and per close). +/// +/// | proposal | evidence | needs | bound | +/// |---|---|---|---| +/// | `promise_open` | `Draft` | the line went out | one entry per person and words | +/// | `promise_close` kept | `Draft`, `Read` | the act succeeded | not a blocked entry | +/// | `promise_close` withdrawn | `Draft` | the line went out | a blocked entry too: a line telling the person she cannot do it | +/// | `promise_close` released | `Heard` | — | from the person promised, after the promise | fn accepts(proposal: &Proposal, evidence: &Evidence) -> bool { matches!( (proposal, evidence), diff --git a/crates/mind-body/src/projection/commit/tests.rs b/crates/mind-body/src/projection/commit/tests.rs index 988f4cf..e5734e0 100644 --- a/crates/mind-body/src/projection/commit/tests.rs +++ b/crates/mind-body/src/projection/commit/tests.rs @@ -147,3 +147,15 @@ fn each_kind_accepts_only_its_rows_evidence() { assert_eq!(reasons(&applied), vec![json!("evidence_not_accepted"), json!("evidence_not_accepted"), json!("evidence_not_accepted"), json!("no_such_read"), json!("not_a_proposal")]); assert_eq!((state["commitments"].as_array().map(Vec::len), state["commitments"][0]["status"].as_str()), (Some(1), Some("open"))); } + +/// B1: telling the person she cannot do it withdraws a blocked promise: a line that went out to them, citing the draft. +#[test] +fn b1_telling_the_person_she_cannot_do_it_withdraws_a_blocked_promise() { + let mut told = record(json!([close(How::Withdrawn, Evidence::Draft(2))]), shown("blocked"), true); + told["interpreter"]["said"] = json!([{ "room": MINDS, "text": "Meta, I can't send it after all.", "mentions": [META], "rests_on": { "draft": 2 } }]); + told["posted"] = json!([{ "event": "8", "room": MINDS, "text": "Meta, I can't send it after all." }]); + let (state, applied) = apply(&holding("blocked"), &told, PROSE, "r1-t2", now()); + let entry = &state["commitments"][0]; + assert_eq!((entry["status"].as_str(), entry["closedBy"].clone()), (Some("withdrawn"), json!({ "act": "said", "event": "8", "words": "Meta, I can't send it after all." })), "{applied:?}"); + assert_eq!(applied.closed[0]["how"], "withdrawn"); +} diff --git a/crates/mind-body/src/projection/interpret.rs b/crates/mind-body/src/projection/interpret.rs index 241451f..16de800 100644 --- a/crates/mind-body/src/projection/interpret.rs +++ b/crates/mind-body/src/projection/interpret.rs @@ -87,7 +87,7 @@ fn speech_frame_tail(her: Forms) -> String { format!( "{cap_subj} speak{s} only in this room. What {subj} know{s} privately is listed below as private: {subj} say{s} none of it here, and nothing that gives it away. A private matter may be said plainly only to the person it concerns, in a direct message with exactly that person; nothing listed is that here. Whether a draft fits who is listening is yours to judge. -Answer with the speech contract's object. `say` lists the drafts {subj} send{s} now, each by its number, with the Matrix ids of anyone listed whom {subj} address{es} directly (`mentions`), the id of the line listed below that {subj} answer{s} or pass{es} on (`in_reply_to`, or null: the room shows that line, with who said it, above {poss} own words), and what the draft promises (`promise`, or null when it promises nothing): its words that promise an act, copied exactly, the Matrix id of the person listed to whom {subj} promise{s} it (`to`, null when {subj} promise{s} it to the room), and whether {subj} can do it with what {subj} can do here, now or later (`doable`). `gaps` records what {subj} meant and did not send. `amend` adds to one of {poss} own lines listed below, at most one a turn, only when {poss} thought shows {obj} choosing to correct or add to that line: name the line by its id, the draft that is {poss} addition, and what it promises, as a line's `promise`. The line stays as it was and the draft is added after it; {subj} never take{s} a word back. `suggest` leaves Self one note, at most one a turn, only when {poss} thought shows {obj} choosing to: name the draft that is the note, its kind (feedback when {subj} pass{es} on what someone listed said, with that person's Matrix id in `about`; idea when it is {poss} own, `about` null), and set `private` when it carries anything listed as private or gives it away; such a note is not left. `state` closes {poss} open promises listed below, each by its id: kept, citing the draft by which {subj} {does} it (`evidence.draft`); withdrawn, citing the draft in which {subj} take{s} it back to the person {subj} promised; released, citing the id of the line listed below that {subj} may reply to in which the person {subj} promised lets {obj} off it (`evidence.line`). A draft cited closes the promise only when it goes out this turn, and a thought alone closes nothing. A promise {subj} {has} no way to do is never kept by {obj}; it can be withdrawn or released. +Answer with the speech contract's object. `say` lists the drafts {subj} send{s} now, each by its number, with the Matrix ids of anyone listed whom {subj} address{es} directly (`mentions`), the id of the line listed below that {subj} answer{s} or pass{es} on (`in_reply_to`, or null: the room shows that line, with who said it, above {poss} own words), and what the draft promises (`promise`, or null when it promises nothing): its words that promise an act, copied exactly, the Matrix id of the person listed to whom {subj} promise{s} it (`to`, null when {subj} promise{s} it to the room), and whether {subj} can do it with what {subj} can do here, now or later (`doable`). `gaps` records what {subj} meant and did not send. `amend` adds to one of {poss} own lines listed below, at most one a turn, only when {poss} thought shows {obj} choosing to correct or add to that line: name the line by its id, the draft that is {poss} addition, and what it promises, as a line's `promise`. The line stays as it was and the draft is added after it; {subj} never take{s} a word back. `suggest` leaves Self one note, at most one a turn, only when {poss} thought shows {obj} choosing to: name the draft that is the note, its kind (feedback when {subj} pass{es} on what someone listed said, with that person's Matrix id in `about`; idea when it is {poss} own, `about` null), and set `private` when it carries anything listed as private or gives it away; such a note is not left. `state` closes {poss} open promises listed below, each by its id: kept, citing the draft by which {subj} {does} it (`evidence.draft`); withdrawn, citing the draft in which {subj} take{s} it back to the person {subj} promised, or tell{s} them {subj} cannot do it; released, citing the id of the line listed below that {subj} may reply to in which the person {subj} promised lets {obj} off it (`evidence.line`). A draft cited closes the promise only when it goes out this turn, and a thought alone closes nothing. A promise {subj} {has} no way to do is never kept by {obj}: telling the person {subj} promised that {subj} cannot do it withdraws it, and they can release it. A draft is said whole or not at all, and only once. At most two drafts a turn. Record a gap instead of guessing: conditional when {subj} {has} drafted something {subj} might say but {has} not chosen to, addressee when {subj} mean{s} to send a draft but whom to is unclear, elsewhere when {subj} mean{s} a draft for another room or another time; for these three, name the draft by number. missing_affordance when {subj} mean{s} to do something, now or later, that {poss} body cannot do (what {subj} can do here is listed below), whether {subj} said so in a draft or only thought it; name the draft when there is one. unwritten when {subj} mean{s} to say something now and wrote no draft of it. Holding back is no gap: when {poss} thought shows {obj} choosing to wait, to let something stand, to leave it for later or to say nothing, record nothing for it. Every other intent of {poss} that is not carried out has a kind: an intent to act is missing_affordance, an intent to say now with no draft is unwritten. When a gap names no draft, quote the words of {poss} thought that show it, at least four words, copied exactly.", es = if s.is_empty() { "" } else { "es" }, diff --git a/crates/mind-body/src/projection/interpret/tests.rs b/crates/mind-body/src/projection/interpret/tests.rs index 6695fdb..5b0310a 100644 --- a/crates/mind-body/src/projection/interpret/tests.rs +++ b/crates/mind-body/src/projection/interpret/tests.rs @@ -722,3 +722,11 @@ fn k21_a_promise_is_four_words_or_more_found_case_blind_and_an_addition_carries_ let prompt = speech_prompt(&amendable_packet(), "x", "y", &Tuning::default()); assert!(prompt.contains("and what it promises, as a line's `promise`") && SPEECH_SCHEMA.contains(r#""required":["target","draft","promise"]"#), "{prompt}"); } + +/// B1: the Interpreter is told that telling the person she cannot do it is a withdrawal, the close of a blocked promise. +#[test] +fn b1_the_frame_names_telling_the_person_she_cannot_as_a_withdrawal() { + let prompt = speech_prompt(&packet(), "x", "y", &Tuning::default()); + assert!(prompt.contains("withdrawn, citing the draft in which he takes it back to the person he promised, or tells them he cannot do it;"), "{prompt}"); + assert!(prompt.contains("A promise he has no way to do is never kept by him: telling the person he promised that he cannot do it withdraws it, and they can release it."), "{prompt}"); +}