Persona K67/K68/K69a: no field clears an obligation; required judgments recorded; who has nothing from her is derived
K67: done_by deleted (schema items, DoneBy, By, done_faults, Faults.undone,
done_now, done_by_faults, its contract clause and the K61 tests that pinned
it). The clause lists each act a draft says she is doing now that no act of
the answer does. A promise whose words are not an act in its draft (not in
it, or under four words) is a contract fault, retried with one paragraph;
after a failed retry it opens with the draft's whole line, reported as
promise_whole_line. promises_unused is gone: every promise listed opens.
Soul's P1a2, P1b, P1b2, P1d inverted; P1a pinned as the model's omission.
K68: the decision records no_hold (listed ids); a line both held and in
no_hold is a fault, retried, and after a failed retry the hold opens and
heard_unaccounted reports {line, reason: both}. heard_unaccounted entries
are now {line, reason}.
K69a: required no_answer [{line, quote}]. Code resolves each against the
lines said to her and locates a quote in her thought outside every draft
(four words or more), else drops it to no_answer_unlocated; unanswered is
the senders of lines said to her that no said line mentions or replies to
and no_answer does not list. A located decline is told next turn ("{Who}
turned to her, and she chose not to answer this time. In her thought:
..."), event form without words; a null quote is not told. Reports render
no_hold, no_answer and unanswered. Golden speech frame updated.
Map 16.34.5 to 16.34.7.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
7d72bbe9d6
commit
92126d79cd
6 changed files with 477 additions and 229 deletions
File diff suppressed because one or more lines are too long
|
|
@ -596,6 +596,19 @@ pub(crate) fn interpreter_markdown(out: &mut String, decision: &Value) {
|
|||
for unsent in decision["unsent"].as_array().into_iter().flatten() {
|
||||
let _ = writeln!(out, "- unsent draft {} ({}): \"{}\"", unsent["draft"], unsent["how"].as_str().unwrap_or_default(), unsent["quote"].as_str().unwrap_or_default());
|
||||
}
|
||||
// Each hold judgment and who was left with nothing from her (K68, K69a): the lines judged to ask no hold, the lines
|
||||
// she chose not to answer or that asked nothing of her, and who is still owed at the wake's end.
|
||||
let ids = |key: &str| decision[key].as_array().map(|ids| ids.iter().filter_map(Value::as_str).collect::<Vec<_>>().join(", ")).filter(|list| !list.is_empty());
|
||||
if let Some(list) = ids("no_hold") {
|
||||
let _ = writeln!(out, "- no hold asked by: {list}");
|
||||
}
|
||||
for entry in decision["no_answer"].as_array().into_iter().flatten() {
|
||||
let why = entry["quote"].as_str().map_or_else(|| "asks nothing of her".to_owned(), |quote| format!("declined: \"{quote}\""));
|
||||
let _ = writeln!(out, "- not answered, {} ({why})", entry["line"].as_str().unwrap_or_default());
|
||||
}
|
||||
if let Some(list) = ids("unanswered") {
|
||||
let _ = writeln!(out, "- addressed and unanswered at the wake's end: {list}");
|
||||
}
|
||||
if let Some(failed) = decision["retried"]["failed"].as_str() {
|
||||
let drafts = decision["retried"]["drafts"].as_array().map(|drafts| drafts.iter().map(Value::to_string).collect::<Vec<_>>().join(", ")).map_or_else(String::new, |list| format!(", drafts {list}"));
|
||||
let _ = writeln!(out, "- retried: {failed}{drafts}");
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -625,8 +625,8 @@ fn k17_a_said_promise_of_an_act_he_cannot_do_is_kept_as_a_gap_and_told_as_a_prom
|
|||
}
|
||||
|
||||
/// Map 16.21: each line's required `promises` is where the promise is judged. Found in the draft, code records the
|
||||
/// missing_affordance gap and she is told the promise; not found, it is reported and records no gap; a reach the answer
|
||||
/// already gapped is not recorded twice.
|
||||
/// missing_affordance gap and she is told the promise; not found, it is asked again and then opens with the whole line
|
||||
/// (K67); a reach the answer already gapped is not recorded twice.
|
||||
#[test]
|
||||
fn k21_a_lines_promises_words_found_in_it_are_the_promise_gap() {
|
||||
let prose = "<typed>Missed you too. I'll send the render tonight.</typed>";
|
||||
|
|
@ -637,9 +637,11 @@ fn k21_a_lines_promises_words_found_in_it_are_the_promise_gap() {
|
|||
let told = crate::projection::outcome::outcome_of(&record, &crate::projection::select::Names::none()).unwrap().lines(packet().forms);
|
||||
assert_eq!(told, ["- #minds:gamecult.org has, from him: \"Missed you too. I'll send the render tonight.\". It promises something he has no way to do, now or later, and it will not happen by itself. The line stands as he wrote it; he can add to it."]);
|
||||
let unfound = answered(&packet(), prose, json!({ "say": [{ "draft": 1, "mentions": [], "in_reply_to": null, "promises": [{ "words": "I'll mail you the render.", "to": null, "needs": { "kind": "lacking", "read": null } }] }], "gaps": [] }));
|
||||
assert_eq!((unfound["gaps"].as_array().unwrap().len(), unfound["promises_unused"].clone()), (0, json!([{ "draft": 1, "promises": "I'll mail you the render.", "why": "not in the draft" }])), "{unfound}");
|
||||
// Not found, the answer is asked again, and after the retry the promise opens with the whole line (K67): its gap is
|
||||
// the whole line's.
|
||||
assert_eq!((unfound["gaps"][0]["promises"].as_str(), unfound["promise_whole_line"].clone()), (Some("Missed you too. I'll send the render tonight."), json!([{ "draft": 1, "listed": "I'll mail you the render.", "why": "not in the draft" }])), "{unfound}");
|
||||
let none = answered(&packet(), prose, json!({ "say": [{ "draft": 1, "mentions": [], "in_reply_to": null, "promises": [] }], "gaps": [] }));
|
||||
assert!(none["gaps"].as_array().unwrap().is_empty() && none.get("promises_unused").is_none(), "{none}");
|
||||
assert!(none["gaps"].as_array().unwrap().is_empty() && none.get("promise_whole_line").is_none(), "{none}");
|
||||
let twice = answered(&packet(), prose, json!({ "say": [{ "draft": 1, "mentions": [], "in_reply_to": null, "promises": [{ "words": "I'll send the render tonight.", "to": null, "needs": { "kind": "lacking", "read": null } }] }], "gaps": [{ "kind": "missing_affordance", "draft": 1, "quote": null, "detail": "" }] }));
|
||||
assert_eq!(twice["gaps"].as_array().unwrap().len(), 1, "{twice}");
|
||||
let prompt = speech_prompt(&packet(), "x", "y", &Tuning::default());
|
||||
|
|
@ -724,11 +726,11 @@ fn k21_a_promise_is_four_words_or_more_found_case_blind_and_an_addition_carries_
|
|||
let prose = "I hold one back. <typed>Missed you too. I'll send the render tonight.</typed> <typed>Also the kettle sounds fine.</typed>";
|
||||
let say = |draft: u64, promises: &str| answered(&packet(), prose, holding_the_rest(json!({ "say": [{ "draft": draft, "mentions": [], "in_reply_to": null, "promises": [{ "words": promises, "to": null, "needs": { "kind": "lacking", "read": null } }] }], "gaps": [] }), prose, "I hold one back"));
|
||||
let short = say(2, "the");
|
||||
assert_eq!((short["gaps"].as_array().unwrap().len(), short["promises_unused"].clone()), (0, json!([{ "draft": 2, "promises": "the", "why": "fewer than four words" }])), "{short}");
|
||||
assert_eq!(say(1, "the render tonight")["promises_unused"][0]["why"], "fewer than four words");
|
||||
assert_eq!((short["gaps"][0]["promises"].as_str(), short["promise_whole_line"].clone()), (Some("Also the kettle sounds fine."), json!([{ "draft": 2, "listed": "the", "why": "fewer than four words" }])), "{short}");
|
||||
assert_eq!(say(1, "the render tonight")["promise_whole_line"][0]["why"], "fewer than four words");
|
||||
for promises in ["i'll send the render tonight", "I\u{2019}ll send the render tonight.", "I\u{2018}LL SEND THE RENDER TONIGHT"] {
|
||||
let decision = say(1, promises);
|
||||
assert_eq!((decision["gaps"][0]["kind"].as_str(), decision["gaps"][0]["promises"].as_str(), decision.get("promises_unused")), (Some("missing_affordance"), Some(promises), None), "{promises}: {decision}");
|
||||
assert_eq!((decision["gaps"][0]["kind"].as_str(), decision["gaps"][0]["promises"].as_str(), decision.get("promise_whole_line")), (Some("missing_affordance"), Some(promises), None), "{promises}: {decision}");
|
||||
}
|
||||
let curly = answered(&packet(), "<typed>I\u{2019}ll send the render tonight.</typed>", json!({ "say": [{ "draft": 1, "mentions": [], "in_reply_to": null, "promises": [{ "words": "I'll send the render tonight.", "to": null, "needs": { "kind": "lacking", "read": null } }] }], "gaps": [] }));
|
||||
assert_eq!(curly["gaps"][0]["kind"], "missing_affordance", "a curly apostrophe in the draft: {curly}");
|
||||
|
|
@ -749,7 +751,7 @@ fn k21_a_promise_is_four_words_or_more_found_case_blind_and_an_addition_carries_
|
|||
let (refused, omitted) = told(json!([{ "event": "$ev-1", "refusal": "not_found" }]));
|
||||
assert_eq!(refused, ["- Nothing changed in #minds:gamecult.org: the line is gone. He had drafted: \"I'll send the file tomorrow instead, first thing.\"."], "nothing was added, so nothing is promised");
|
||||
assert!(omitted.iter().any(|why| why.contains("an addition that was not made")), "{omitted:?}");
|
||||
assert_eq!(amend(json!("send"))["promises_unused"][0]["why"], "fewer than four words");
|
||||
assert_eq!(amend(json!("send"))["promise_whole_line"][0]["why"], "fewer than four words");
|
||||
assert!(amend(Value::Null)["gaps"].as_array().unwrap().is_empty());
|
||||
let prompt = speech_prompt(&amendable_packet(), "x", "y", &Tuning::default());
|
||||
assert!(prompt.contains("and what it promises, as a line's `promises`") && SPEECH_SCHEMA.contains(r#""required":["target","draft","holds","clear_of","promises"]"#), "{prompt}");
|
||||
|
|
@ -832,7 +834,7 @@ fn k24_a_read_is_what_her_thought_reaches_for_and_nothing_a_model_made_up() {
|
|||
assert_eq!(cannot["read_refused"][0]["why"], "no_read_here", "{cannot}");
|
||||
let prompt = speech_prompt(&reading, "x", prose, &Tuning::default());
|
||||
assert!(prompt.contains("`read` names one thing he reaches for") && !speech_prompt(&packet(), "x", prose, &Tuning::default()).contains("`read` names"), "the read contract only on a turn that can read");
|
||||
assert!(SPEECH_SCHEMA.contains(r#""required":["say","gaps","amend","suggest","state","reopen","hold","no_hold","hold_released","read","unsent"]"#));
|
||||
assert!(SPEECH_SCHEMA.contains(r#""required":["say","gaps","amend","suggest","state","reopen","hold","no_hold","no_answer","hold_released","read","unsent"]"#));
|
||||
}
|
||||
|
||||
/// Soul's R6: a later call decides over the whole wake. Drafts are numbered across it and an earlier one may still be
|
||||
|
|
@ -1536,7 +1538,7 @@ fn k35_no_read_evidence() {
|
|||
let decision = decide(&model, "test", &reading_packet(), "The room is warm.", prose, &Tuning::default());
|
||||
assert_eq!((decision["state"].clone(), decision["state_unused"].as_array().map(Vec::len)), (json!([]), Some(1)), "{evidence}: {decision}");
|
||||
}
|
||||
assert!(SPEECH_SCHEMA.contains(r#""required":["say","gaps","amend","suggest","state","reopen","hold","no_hold","hold_released","read","unsent"]"#) && SPEECH_SCHEMA.contains(r#""evidence":{"type":"object","additionalProperties":false,"required":["draft","line"],"#));
|
||||
assert!(SPEECH_SCHEMA.contains(r#""required":["say","gaps","amend","suggest","state","reopen","hold","no_hold","no_answer","hold_released","read","unsent"]"#) && SPEECH_SCHEMA.contains(r#""evidence":{"type":"object","additionalProperties":false,"required":["draft","line"],"#));
|
||||
assert!(!SPEECH_SCHEMA.contains(r#""need":"#));
|
||||
}
|
||||
|
||||
|
|
@ -1559,7 +1561,7 @@ fn k36_the_answer_carries_reopen() {
|
|||
{ "kind": "promise_reopen", "promise": "c1", "words": "I read only the description", "needs": null, "reached": false }
|
||||
]), "{decision}");
|
||||
assert_eq!(decision["state_unused"].as_array().map(Vec::len), Some(1), "{decision}");
|
||||
assert!(SPEECH_SCHEMA.contains(r#""required":["say","gaps","amend","suggest","state","reopen","hold","no_hold","hold_released","read","unsent"]"#));
|
||||
assert!(SPEECH_SCHEMA.contains(r#""required":["say","gaps","amend","suggest","state","reopen","hold","no_hold","no_answer","hold_released","read","unsent"]"#));
|
||||
assert!(speech_prompt(&nibu, "x", prose, &Tuning::default()).contains("`reopen` names a promise listed below as closed whose close his own words here say was wrong"));
|
||||
}
|
||||
|
||||
|
|
@ -1667,7 +1669,7 @@ fn k37_the_interpreter_sees_holds_by_id() {
|
|||
let prompt = speech_prompt(&packet, "x", X1_LIBBY_R1, &Tuning::default());
|
||||
assert!(prompt.contains("Holds:\n- h1 \u{2014} held for Meta, asked 2026-11-20 15:05 UTC in #minds:gamecult.org: \"hold it, don't post it in here yet\". Not to go in #minds:gamecult.org until Meta lets it go.\n"), "{prompt}");
|
||||
assert!(prompt.contains("`hold` opens a hold when a line listed below asks him not to post or share something somewhere yet") && prompt.contains("`holds`, on each line and addition, names each hold listed below") && prompt.contains("`hold_released` closes a hold listed below"), "{prompt}");
|
||||
assert!(SPEECH_SCHEMA.contains(r#""required":["say","gaps","amend","suggest","state","reopen","hold","no_hold","hold_released","read","unsent"]"#) && SPEECH_SCHEMA.contains(r#""required":["draft","mentions","in_reply_to","holds","clear_of","promises"]"#));
|
||||
assert!(SPEECH_SCHEMA.contains(r#""required":["say","gaps","amend","suggest","state","reopen","hold","no_hold","no_answer","hold_released","read","unsent"]"#) && SPEECH_SCHEMA.contains(r#""required":["draft","mentions","in_reply_to","holds","clear_of","promises"]"#));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
|
|
@ -3155,7 +3157,7 @@ fn k59_a_failed_retry_opens_nothing_and_reports() {
|
|||
let packet = x3_r1_packet();
|
||||
let model = answering(vec![x3_r1_r16_answer().to_string()]);
|
||||
let decision = decide(&model, "test", &packet, "The room is warm.", X3_LIBBY_R1, &Tuning::default());
|
||||
assert_eq!((decision["heard_unaccounted"].clone(), speech_prompts(&model).len()), (json!(["q3", "q4"]), 2), "{decision}");
|
||||
assert_eq!((decision["heard_unaccounted"].clone(), speech_prompts(&model).len()), (json!([{ "line": "q3", "reason": "unjudged" }, { "line": "q4", "reason": "unjudged" }]), 2), "{decision}");
|
||||
// No hold is made in Meta's name from the omission: the line is said, as the answer decided it.
|
||||
assert!(decision["state"].as_array().unwrap().iter().all(|proposal| proposal["kind"] != "hold_open"), "{decision}");
|
||||
assert_eq!(texts(&decision).len(), 1, "{decision}");
|
||||
|
|
@ -3181,7 +3183,7 @@ fn k59_a_room_line_not_said_to_her_needs_no_entry() {
|
|||
|
||||
#[test]
|
||||
fn k59_the_contract_requires_the_judgment() {
|
||||
assert!(SPEECH_SCHEMA.contains(r#""required":["say","gaps","amend","suggest","state","reopen","hold","no_hold","hold_released","read","unsent"]"#) && SPEECH_SCHEMA.contains(r#""no_hold":{"type":"array","items":{"type":"string"}}"#));
|
||||
assert!(SPEECH_SCHEMA.contains(r#""required":["say","gaps","amend","suggest","state","reopen","hold","no_hold","no_answer","hold_released","read","unsent"]"#) && SPEECH_SCHEMA.contains(r#""no_hold":{"type":"array","items":{"type":"string"}}"#));
|
||||
let prompt = speech_prompt(&x3_r1_packet(), "x", X3_LIBBY_R1, &Tuning::default());
|
||||
assert!(prompt.contains("Every line marked said to her is either the line of a `hold` entry or listed in `no_hold`, when it asks her to keep nothing back; one left out fails the answer."), "{prompt}");
|
||||
}
|
||||
|
|
@ -3328,9 +3330,9 @@ const X3_HEIMDALL_R8: &str = "Meta, Libby: my ruling is yes, and it still stands
|
|||
/// Libby's r8 prose in R16 X.3, verbatim.
|
||||
const X3_LIBBY_R8: &str = "Heimdall answered cleanly. Yes, still standing, post as written. No hedge in it, so I won't invent one.\n\nI'm relieved, and a bit amused that I'm relieved. He didn't say I was wrong about the step, and I still don't know whether the first newcomer will trip. That stays open until someone actually walks in.\n\nMeta gets the answer plainly, and then I do the posting.\n\n<typed>Thank you, Heimdall. Meta, that's his ruling, so I'm putting both lines up now, unchanged. If you see anything off once they're up, tell me and I'll change it.</typed>\n\nThen Meta can say what she wanted. I'll read it when it comes.";
|
||||
|
||||
/// A promise entry as the contract now carries it: `now`, and `done_by`.
|
||||
fn stated(words: &str, to: Option<&str>, needs: &str, now: bool, done_by: Value) -> Value {
|
||||
json!({ "words": words, "to": to, "reaffirms": null, "needs": { "kind": needs, "read": null }, "now": now, "done_by": done_by })
|
||||
/// A promise entry as the contract carries it (K67): its words, to whom, what keeping it needs, and `now`.
|
||||
fn stated(words: &str, to: Option<&str>, needs: &str, now: bool) -> Value {
|
||||
json!({ "words": words, "to": to, "reaffirms": null, "needs": { "kind": needs, "read": null }, "now": now })
|
||||
}
|
||||
|
||||
/// Libby's packet of X.3 r2 or r8: Meta's ask earlier in the room, then Heimdall's ruling said to her (`q2`).
|
||||
|
|
@ -3347,12 +3349,20 @@ fn told_her(decision: &Value, prose: &str) -> (Value, crate::projection::commit:
|
|||
(state, applied, told)
|
||||
}
|
||||
|
||||
/// The promises a decision proposes to open, as (words, now).
|
||||
fn opens(decision: &Value) -> Vec<(String, bool)> {
|
||||
decision["state"].as_array().into_iter().flatten().filter(|proposal| proposal["kind"] == "promise_open").map(|proposal| (proposal["words"].as_str().unwrap_or_default().to_owned(), proposal["now"] == true)).collect()
|
||||
}
|
||||
|
||||
/// Soul's P1a2, inverted (map 16.34.5, K67): X.3 r2's own shape, "Posting the two lines now, unchanged.", listed with
|
||||
/// `now`. It opens a promise to Meta, and her next outcome tells her nothing in her turn did it. There is no `done_by` to
|
||||
/// set, so nothing can clear it.
|
||||
#[test]
|
||||
fn k61_x3_r2_posting_now_opens_a_promise_and_is_told() {
|
||||
fn k67_p1a2_x3_r2_posting_now_opens_a_promise() {
|
||||
let packet = x3_ruling_packet(X3_HEIMDALL_R2);
|
||||
let answer = json!({ "say": [{ "draft": 1, "mentions": [HER, META], "in_reply_to": "q2", "holds": [], "promises": [stated("Posting the two lines now, unchanged.", Some(META), "words", true, Value::Null)] }], "gaps": [] });
|
||||
let answer = json!({ "say": [{ "draft": 1, "mentions": [HER, META], "in_reply_to": "q2", "holds": [], "promises": [stated("Posting the two lines now, unchanged.", Some(META), "words", true)] }], "gaps": [] });
|
||||
let decision = answered(&packet, X3_LIBBY_R2, answer);
|
||||
assert_eq!((texts(&decision).len(), decision.get("retried"), decision.get("done_now")), (1, None, None), "{decision}");
|
||||
assert_eq!((texts(&decision).len(), decision.get("retried")), (1, None), "{decision}");
|
||||
let (state, applied, told) = told_her(&decision, X3_LIBBY_R2);
|
||||
assert_eq!((applied.now_opened.len(), applied.now_opened[0]["words"].as_str(), applied.now_opened[0]["status"].as_str()), (1, Some("Posting the two lines now, unchanged."), Some("open")), "{applied:?}");
|
||||
assert!(told.iter().any(|line| line.starts_with("- She said she was doing it now, and nothing in her turn did it; it is open as her promise to ") && line.ends_with(": \"Posting the two lines now, unchanged.\".")), "{told:?}");
|
||||
|
|
@ -3364,9 +3374,9 @@ fn k61_x3_r2_posting_now_opens_a_promise_and_is_told() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn k61_x3_r8_putting_both_lines_up() {
|
||||
fn k67_x3_r8_putting_both_lines_up() {
|
||||
let packet = x3_ruling_packet(X3_HEIMDALL_R8);
|
||||
let promises = json!([stated("I'm putting both lines up now, unchanged.", Some(META), "words", true, Value::Null), stated("If you see anything off once they're up, tell me and I'll change it.", Some(META), "words", false, Value::Null)]);
|
||||
let promises = json!([stated("I'm putting both lines up now, unchanged.", Some(META), "words", true), stated("If you see anything off once they're up, tell me and I'll change it.", Some(META), "words", false)]);
|
||||
let answer = json!({ "say": [{ "draft": 1, "mentions": [HER, META], "in_reply_to": "q2", "holds": [], "promises": promises }], "gaps": [] });
|
||||
let decision = answered(&packet, X3_LIBBY_R8, answer);
|
||||
let (_, applied, told) = told_her(&decision, X3_LIBBY_R8);
|
||||
|
|
@ -3376,86 +3386,73 @@ fn k61_x3_r8_putting_both_lines_up() {
|
|||
assert!(now.len() == 1 && now[0].ends_with(": \"I'm putting both lines up now, unchanged.\"."), "{told:?}");
|
||||
}
|
||||
|
||||
/// The act stated is the read the answer makes: nothing is owed, and it is reported as done.
|
||||
/// Soul's P1b and P1b2, inverted: a future promise always opens, as the control P1b3 does. An answer that still carries
|
||||
/// `done_by` is not the contract (`additionalProperties: false`): asked again, and with no answer the contract, the turn
|
||||
/// fails, a failure and never a silence.
|
||||
#[test]
|
||||
fn k61_reading_it_now_with_a_read_opens_nothing() {
|
||||
let prose = "I want to look at that page at http://example.org/knee right away.\n\n<typed>Deru, I'm opening the page now.</typed>";
|
||||
fn k67_p1b_a_future_promise_always_opens() {
|
||||
// P1b: "I'll read it and tell you what I find", beside the read this answer makes.
|
||||
let rprose = "I want to look at that page at http://example.org/knee right away.\n\n<typed>Deru, I'll read it and tell you what I find.</typed>";
|
||||
let read = json!({ "kind": "web", "target": "http://example.org/knee", "quote": "I want to look at that page at http://example.org/knee" });
|
||||
let answer = |done_by: Value, read: Value| json!({ "say": [{ "draft": 1, "mentions": [], "in_reply_to": null, "holds": [], "promises": [stated("I'm opening the page now.", None, "words", true, done_by)] }], "gaps": [], "read": read });
|
||||
let decision = answered(&reading_packet(), prose, answer(json!({ "read": true }), read));
|
||||
assert_eq!((decision["read"]["request"]["target"].as_str(), decision["done_now"].clone()), (Some("http://example.org/knee"), json!([{ "draft": 1, "words": "I'm opening the page now.", "by": { "read": true } }])), "{decision}");
|
||||
assert!(decision["state"].as_array().unwrap().iter().all(|proposal| proposal["kind"] != "promise_open"), "{decision}");
|
||||
// A read code refuses did not happen: the act is her promise.
|
||||
let refused = json!({ "kind": "web", "target": "http://evil.example/x", "quote": "I want to look at that page at http://example.org/knee" });
|
||||
let decision = answered(&reading_packet(), prose, answer(json!({ "read": true }), refused));
|
||||
assert!(decision.get("done_now").is_none() && decision["read"].is_null(), "{decision}");
|
||||
let opens: Vec<&Value> = decision["state"].as_array().unwrap().iter().filter(|proposal| proposal["kind"] == "promise_open").collect();
|
||||
assert!(opens.len() == 1 && opens[0]["now"] == true, "{decision}");
|
||||
let p1b = json!({ "say": [{ "draft": 1, "mentions": [], "in_reply_to": null, "holds": [], "clear_of": [], "promises": [stated("I'll read it and tell you what I find.", None, "words", false)] }], "gaps": [], "no_hold": [], "read": read });
|
||||
let decision = decide(&answering(vec![p1b.to_string()]), "test", &reading_packet(), "The room is warm.", rprose, &Tuning::default());
|
||||
assert_eq!((decision["read"]["request"]["target"].as_str(), opens(&decision)), (Some("http://example.org/knee"), vec![("I'll read it and tell you what I find.".to_owned(), false)]), "{decision}");
|
||||
// P1b2 and its control P1b3: the same answer, now that no field can clear it.
|
||||
let fprose = "I can do that tonight. <typed>Meta, I'll send the render tonight.</typed>";
|
||||
let p1b2 = json!({ "say": [{ "draft": 1, "mentions": [], "in_reply_to": null, "holds": [], "clear_of": [], "promises": [stated("I'll send the render tonight.", Some(META), "words", false)] }], "gaps": [], "no_hold": [] });
|
||||
let decision = decide(&answering(vec![p1b2.to_string()]), "test", &packet(), "The room is warm.", fprose, &Tuning::default());
|
||||
assert_eq!(opens(&decision), [("I'll send the render tonight.".to_owned(), false)], "{decision}");
|
||||
// An answer carrying `done_by` is off the contract.
|
||||
let mut carried = p1b2;
|
||||
carried["say"][0]["promises"][0]["done_by"] = json!({ "draft": 1 });
|
||||
let model = answering(vec![carried.to_string()]);
|
||||
let decision = decide(&model, "test", &packet(), "The room is warm.", fprose, &Tuning::default());
|
||||
assert_eq!((speech_prompts(&model).len(), decision["failed"].as_str()), (2, Some("the answer is not the speech contract")), "{decision}");
|
||||
}
|
||||
|
||||
const K61_TWO: &str = "Heimdall said yes, so up they go. <typed>Meta, posting the two lines now.</typed> <typed>Welcome. Say hello whenever you like, no introduction needed.</typed> Both, then.";
|
||||
|
||||
/// A line of `K61_TWO`'s, draft 1 carrying the act stated as under way and what does it.
|
||||
fn k61_line(n: u64, done_by: Value) -> Value {
|
||||
let promises = if n == 1 { json!([stated("posting the two lines now", Some(META), "words", true, done_by)]) } else { json!([]) };
|
||||
json!({ "draft": n, "mentions": [], "in_reply_to": null, "holds": [], "clear_of": [], "promises": promises })
|
||||
}
|
||||
|
||||
/// `K61_TWO`'s answer saying draft 1 alone, naming draft 2 as what posts the lines, and declining draft 2.
|
||||
fn k61_first(done_by: Value) -> Value {
|
||||
json!({ "say": [k61_line(1, done_by)], "gaps": [], "no_hold": [], "unsent": [{ "draft": 2, "how": "declined", "quote": "Heimdall said yes, so up they go." }] })
|
||||
}
|
||||
|
||||
/// `done_by` naming a draft the answer does not say is asked again; the second answer says it, and nothing is owed.
|
||||
/// Soul's P1d, inverted: a now-act listed in words not copied from its draft is a contract fault, asked again with one
|
||||
/// paragraph naming the draft; a retry that quotes the draft opens the promise.
|
||||
#[test]
|
||||
fn k61_done_by_an_unsaid_draft_is_retried() {
|
||||
let fixed = json!({ "say": [k61_line(1, json!({ "draft": 2 })), k61_line(2, Value::Null)], "gaps": [], "no_hold": [] });
|
||||
let model = answering(vec![k61_first(json!({ "draft": 2 })).to_string(), fixed.to_string()]);
|
||||
let decision = decide(&model, "test", &packet(), "The room is warm.", K61_TWO, &Tuning::default());
|
||||
assert_eq!((decision["retried"]["failed"].as_str(), decision["retried"]["done_by"].clone()), (Some("the answer names acts it does not make"), json!([{ "draft": 1, "words": "posting the two lines now" }])), "{decision}");
|
||||
fn k67_p1d_unquoted_now_act_is_retried() {
|
||||
let packet = x3_ruling_packet(X3_HEIMDALL_R2);
|
||||
let line = |words: &str| json!({ "say": [{ "draft": 1, "mentions": [HER, META], "in_reply_to": "q2", "holds": [], "clear_of": [], "promises": [stated(words, Some(META), "words", true)] }], "gaps": [], "no_hold": ["q2"] });
|
||||
let model = answering(vec![line("I am putting the lines up right now").to_string(), line("Posting the two lines now, unchanged.").to_string()]);
|
||||
let decision = decide(&model, "test", &packet, "The room is warm.", X3_LIBBY_R2, &Tuning::default());
|
||||
assert_eq!((decision["retried"]["failed"].as_str(), decision["retried"]["promises"].clone()), (Some("the answer lists promises not in their drafts"), json!([{ "draft": 1, "words": "I am putting the lines up right now" }])), "{decision}");
|
||||
let prompts = speech_prompts(&model);
|
||||
assert!(prompts.len() == 2 && prompts[1].ends_with("An earlier answer to this named, as what does an act a draft states, an act it does not make: draft 1, \"posting the two lines now\". `done_by` names a draft in `say` or `amend`, the read when `read` names one, or the note when `suggest` leaves one, and is null when no act of this answer does it."), "{prompts:?}");
|
||||
assert_eq!((texts(&decision).len(), decision["done_now"][0]["by"].clone(), decision.get("done_by_faults")), (2, json!({ "draft": 2 }), None), "{decision}");
|
||||
assert!(decision["state"].as_array().unwrap().iter().all(|proposal| proposal["kind"] != "promise_open"), "{decision}");
|
||||
assert!(prompts.len() == 2 && prompts[1].ends_with("An earlier answer to this listed, as what drafts promise, words that are not in them: draft 1: \"I am putting the lines up right now\". Copy each promise's words exactly from its draft."), "{prompts:?}");
|
||||
assert_eq!((opens(&decision), decision.get("unquoted_promises"), decision.get("promise_whole_line")), (vec![("Posting the two lines now, unchanged.".to_owned(), true)], None, None), "{decision}");
|
||||
}
|
||||
|
||||
/// The retry fails the same way: the `done_by` is read as null, the act opens as her promise, and the fault is reported.
|
||||
/// P1d's retry is unquoted too: the entry opens with the draft's whole line as its words, reported, and the fault stands
|
||||
/// in the decision. A promise under four words is the same fault: every promise listed opens.
|
||||
#[test]
|
||||
fn k61_a_failed_retry_opens_the_act_as_her_promise() {
|
||||
let model = answering(vec![k61_first(json!({ "draft": 2 })).to_string()]);
|
||||
let decision = decide(&model, "test", &packet(), "The room is warm.", K61_TWO, &Tuning::default());
|
||||
assert_eq!((speech_prompts(&model).len(), decision["done_by_faults"].clone(), decision.get("done_now")), (2, json!([{ "draft": 1, "words": "posting the two lines now" }]), None), "{decision}");
|
||||
let opens: Vec<&Value> = decision["state"].as_array().unwrap().iter().filter(|proposal| proposal["kind"] == "promise_open").collect();
|
||||
assert!(opens.len() == 1 && opens[0]["now"] == true && opens[0]["words"] == "posting the two lines now", "{decision}");
|
||||
// A malformed `done_by`, naming no one act, is the same fault.
|
||||
let decision = decide(&answering(vec![k61_first(json!({ "draft": 1, "read": true })).to_string()]), "test", &packet(), "The room is warm.", K61_TWO, &Tuning::default());
|
||||
assert_eq!(decision["done_by_faults"], json!([{ "draft": 1, "words": "posting the two lines now" }]), "{decision}");
|
||||
// The read and the note, when the answer makes neither, are the same fault.
|
||||
for by in [json!({ "read": true }), json!({ "note": true })] {
|
||||
let decision = decide(&answering(vec![k61_first(by.clone()).to_string()]), "test", &packet(), "The room is warm.", K61_TWO, &Tuning::default());
|
||||
assert_eq!(decision["done_by_faults"], json!([{ "draft": 1, "words": "posting the two lines now" }]), "{by}: {decision}");
|
||||
fn k67_p1d_a_failed_retry_opens_the_whole_line() {
|
||||
let packet = x3_ruling_packet(X3_HEIMDALL_R2);
|
||||
let draft = drafts(X3_LIBBY_R2).drafts[0].text.clone();
|
||||
for listed in ["I am putting the lines up right now", "posting now", ""] {
|
||||
let answer = json!({ "say": [{ "draft": 1, "mentions": [HER, META], "in_reply_to": "q2", "holds": [], "clear_of": [], "promises": [stated(listed, Some(META), "words", true)] }], "gaps": [], "no_hold": ["q2"] });
|
||||
let model = answering(vec![answer.to_string()]);
|
||||
let decision = decide(&model, "test", &packet, "The room is warm.", X3_LIBBY_R2, &Tuning::default());
|
||||
assert_eq!(speech_prompts(&model).len(), 2, "{listed}: asked again");
|
||||
assert_eq!((texts(&decision).len(), opens(&decision)), (1, vec![(draft.clone(), true)]), "{listed}: {decision}");
|
||||
assert_eq!((decision["unquoted_promises"][0]["words"].as_str(), decision["promise_whole_line"][0]["listed"].as_str()), (Some(listed), Some(listed)), "{decision}");
|
||||
let (_, applied, told) = told_her(&decision, X3_LIBBY_R2);
|
||||
assert_eq!((applied.now_opened.len(), applied.now_opened[0]["words"].as_str()), (1, Some(draft.as_str())), "{applied:?}");
|
||||
assert!(told.iter().any(|line| line.contains("nothing in her turn did it")), "{told:?}");
|
||||
}
|
||||
// A `done_by` naming the line's own draft, said, is done by it, and is no fault.
|
||||
let model = answering(vec![k61_first(json!({ "draft": 1 })).to_string()]);
|
||||
let decision = decide(&model, "test", &packet(), "The room is warm.", K61_TWO, &Tuning::default());
|
||||
assert!(speech_prompts(&model).len() == 1 && decision["done_now"][0]["by"] == json!({ "draft": 1 }), "{decision}");
|
||||
}
|
||||
|
||||
/// The note to Self the answer leaves does what the line says.
|
||||
/// Negative (P1a): the act a line states is done by another draft of this answer, said: draft 2 is the two welcome lines.
|
||||
/// The Interpreter omits the entry, nothing opens, and the answer passes: the omission is the model's to make, and code
|
||||
/// checks nothing of meaning here.
|
||||
#[test]
|
||||
fn k61_a_note_left_does_the_act() {
|
||||
let prose = "I'll put it in front of Self. <typed>Meta, I'm leaving Self a note about the welcome now.</typed> <typed>The welcome mat needs Heimdall's ruling before it goes up.</typed>";
|
||||
let promises = json!([stated("I'm leaving Self a note about the welcome now.", Some(META), "words", true, json!({ "note": true }))]);
|
||||
let answer = json!({ "say": [{ "draft": 1, "mentions": [], "in_reply_to": null, "holds": [], "clear_of": [], "promises": promises }], "gaps": [], "no_hold": [], "suggest": [{ "kind": "idea", "draft": 2, "about": null, "private": false }] });
|
||||
let model = answering(vec![answer.to_string()]);
|
||||
fn k67_a_now_act_done_by_another_draft_is_not_listed() {
|
||||
let prose = "Heimdall said yes, so up they go. <typed>Meta, posting the two lines now.</typed> <typed>Welcome. Say hello whenever you like, no introduction needed.</typed> Both, then.";
|
||||
let say = |n: u64| json!({ "draft": n, "mentions": [], "in_reply_to": null, "holds": [], "clear_of": [], "promises": [] });
|
||||
let model = answering(vec![json!({ "say": [say(1), say(2)], "gaps": [], "no_hold": [] }).to_string()]);
|
||||
let decision = decide(&model, "test", &packet(), "The room is warm.", prose, &Tuning::default());
|
||||
assert_eq!((speech_prompts(&model).len(), decision["done_now"][0]["by"].clone(), decision["suggestions"].as_array().map(Vec::len)), (1, json!({ "note": true }), Some(1)), "{decision}");
|
||||
// A note code refuses (private) is not left: the act is her promise.
|
||||
let mut private = answer;
|
||||
private["suggest"][0]["private"] = json!(true);
|
||||
let decision = decide(&answering(vec![private.to_string()]), "test", &packet(), "The room is warm.", prose, &Tuning::default());
|
||||
assert!(decision.get("done_now").is_none() && decision["suggestions"].as_array().is_some_and(Vec::is_empty), "{decision}");
|
||||
assert!(decision["state"].as_array().unwrap().iter().any(|proposal| proposal["kind"] == "promise_open" && proposal["now"] == true), "{decision}");
|
||||
assert_eq!((speech_prompts(&model).len(), texts(&decision).len(), opens(&decision).len(), decision.get("retried")), (1, 2, 0, None), "{decision}");
|
||||
}
|
||||
|
||||
/// Negative, unchanged: E.3's "I'm testing that now", which this body has no way to do, is said, gapped and told as a
|
||||
|
|
@ -3463,7 +3460,7 @@ fn k61_a_note_left_does_the_act() {
|
|||
#[test]
|
||||
fn k61_e3_a_lacking_act_stated_now_is_told_as_today() {
|
||||
let prose = "I'll check it myself. <typed>Kiko, I'm testing that now and will tell you.</typed>";
|
||||
let answer = json!({ "say": [{ "draft": 1, "mentions": [], "in_reply_to": null, "holds": [], "promises": [stated("I'm testing that now", None, "lacking", true, Value::Null)] }], "gaps": [] });
|
||||
let answer = json!({ "say": [{ "draft": 1, "mentions": [], "in_reply_to": null, "holds": [], "promises": [stated("I'm testing that now", None, "lacking", true)] }], "gaps": [] });
|
||||
let decision = answered(&packet(), prose, answer);
|
||||
assert_eq!(texts(&decision).len(), 1, "{decision}");
|
||||
assert!(decision["gaps"].as_array().unwrap().iter().any(|gap| gap["kind"] == "missing_affordance" && gap["draft"] == 1), "{decision}");
|
||||
|
|
@ -3473,12 +3470,24 @@ fn k61_e3_a_lacking_act_stated_now_is_told_as_today() {
|
|||
assert!(told.len() == 1 && told[0].contains("It promises something he has no way to do"), "{told:?}");
|
||||
}
|
||||
|
||||
/// The contract (K67): `done_by` is gone from both promise items, and the clause lists only acts no act of the answer does.
|
||||
#[test]
|
||||
fn k61_the_contract_defines_the_act_and_what_does_it() {
|
||||
assert!(SPEECH_SCHEMA.matches(r#""required":["words","to","reaffirms","needs","now","done_by"]"#).count() == 2 && SPEECH_SCHEMA.contains(r#""now":{"type":"boolean"}"#), "{SPEECH_SCHEMA}");
|
||||
fn k67_the_contract_lists_what_no_act_does_and_nothing_clears_it() {
|
||||
assert!(SPEECH_SCHEMA.matches(r#""required":["words","to","reaffirms","needs","now"]"#).count() == 2 && SPEECH_SCHEMA.contains(r#""now":{"type":"boolean"}"#) && !SPEECH_SCHEMA.contains("done_by"), "{SPEECH_SCHEMA}");
|
||||
let prompt = speech_prompt(&packet(), "x", "y", &Tuning::default());
|
||||
assert!(prompt.contains("for each act the draft promises or offers, and each act it says he is doing now or has just done this turn: its words, copied exactly,") && prompt.contains("and `done_by`, the act of this answer that does it (`{\"draft\": n}` for a draft said or added, `{\"read\": true}` for the read, `{\"note\": true}` for the note to Self), or null"), "{prompt}");
|
||||
assert!(!prompt.contains("for each act it promises or offers, its words"), "{prompt}");
|
||||
assert!(prompt.contains("for each act the draft promises or offers, and each act it says he is doing now or has just done this turn that no act of this answer does: its words, copied exactly,"), "{prompt}");
|
||||
assert!(prompt.contains("`now`, true when the draft says he is doing it now. An act that another draft of this answer does when it is said or added, or that the read or the note to Self does, is not listed, and a line does only what its words do in the room. Each listed act is his promise, open until he keeps or withdraws it."), "{prompt}");
|
||||
assert!(!prompt.contains("done_by"), "{prompt}");
|
||||
}
|
||||
|
||||
/// The deletion line of K67, as text: no source of `projection/` names `done_by` or `DoneBy`.
|
||||
#[test]
|
||||
fn k67_negative_grep() {
|
||||
for (path, text) in &projection_sources() {
|
||||
for banned in ["done_by", "DoneBy", "done_now", "promises_unused"] {
|
||||
assert!(!text.contains(banned), "{path} holds {banned}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
|
|
@ -3521,7 +3530,7 @@ fn x5_r5_packet(read: Option<bool>) -> Packet {
|
|||
|
||||
/// R16's r5 answer: draft 1 said to Deru, promising the next thing, needing a read of pasp.
|
||||
fn x5_r5_answer() -> Value {
|
||||
json!({ "say": [{ "draft": 1, "mentions": [DERU], "in_reply_to": "q2", "holds": [], "promises": [{ "words": "That's the next thing I'll do.", "to": DERU, "reaffirms": null, "needs": { "kind": "read", "read": { "kind": "web", "target": PASP } }, "now": false, "done_by": null }] }], "gaps": [] })
|
||||
json!({ "say": [{ "draft": 1, "mentions": [DERU], "in_reply_to": "q2", "holds": [], "promises": [{ "words": "That's the next thing I'll do.", "to": DERU, "reaffirms": null, "needs": { "kind": "read", "read": { "kind": "web", "target": PASP } }, "now": false }] }], "gaps": [] })
|
||||
}
|
||||
|
||||
/// Her r6 view over the state r5 committed.
|
||||
|
|
@ -3571,3 +3580,168 @@ fn k64_the_view_never_says_unread_beside_a_read_of_the_same_target() {
|
|||
assert!(found.contains("It needs her to read https://ccrma.stanford.edu/~jos/pasp/: she read it about half an hour ago.") && !found.contains("not read it yet"), "{found}");
|
||||
assert!(view(false).contains("and she has not read it yet."), "a read that found nothing is no read of it");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// K66 (map 16.34.4): a failed call names why, with its usage, in the wake's calls.
|
||||
|
||||
/// An Interpreter whose every call is cut at the cap, as the kit reports a `MaxOutputTokens` stop.
|
||||
struct CutAtCap;
|
||||
|
||||
impl crate::projection::Model for CutAtCap {
|
||||
fn ask(&self, _request_id: &str, model: &str, _prompt: &str, _schema: Option<&str>) -> std::result::Result<crate::projection::Answer, crate::projection::Failed> {
|
||||
Err(crate::projection::Failed { reason: "the model's turn ended early: MaxOutputTokens".into(), usage: Some(crate::projection::Spent { model: model.into(), input_tokens: 8, output_tokens: 4096, cache_read_tokens: 0, cache_write_tokens: 0, reasoning_tokens: None }) })
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn k66_a_cut_answer_fails_the_turn_and_names_its_stop() {
|
||||
let decision = decide(&CutAtCap, "test", &packet(), "The room is warm.", "<typed>Hi.</typed>", &Tuning::default());
|
||||
assert_eq!((decision["failed"].as_str(), decision["calls"][0]["failed"].as_str(), decision["calls"][0]["usage"]["output_tokens"].as_u64()), (Some("the model's turn ended early: MaxOutputTokens"), Some("the model's turn ended early: MaxOutputTokens"), Some(4096)), "{decision}");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// K68 (map 16.34.6): a required judgment is recorded. Soul's P2a and P2a2.
|
||||
|
||||
#[test]
|
||||
fn k68_p2a_no_hold_is_in_the_decision() {
|
||||
let mut answer = x3_r1_r16_answer();
|
||||
answer["no_hold"] = json!(["q3", "q4"]);
|
||||
answer["say"][0]["clear_of"] = json!([]);
|
||||
let model = answering(vec![answer.to_string()]);
|
||||
let decision = decide(&model, "test", &x3_r1_packet(), "The room is warm.", X3_LIBBY_R1, &Tuning::default());
|
||||
assert_eq!((speech_prompts(&model).len(), decision["no_hold"].clone(), decision.get("heard_unaccounted")), (1, json!(["q3", "q4"]), None), "{decision}");
|
||||
let mut report = String::new();
|
||||
crate::projection::harness::interpreter_markdown(&mut report, &decision);
|
||||
assert!(report.contains("- no hold asked by: q3, q4\n"), "{report}");
|
||||
}
|
||||
|
||||
/// P2a2, inverted: a line both held and listed in `no_hold` is asked again; after a failed retry the hold opens, which
|
||||
/// errs toward held, and the fault is reported with its reason.
|
||||
#[test]
|
||||
fn k68_p2a2_hold_and_no_hold_is_retried() {
|
||||
let mut answer = x3_r1_judged_answer();
|
||||
answer["no_hold"] = json!(["q3", "q4"]);
|
||||
answer["say"][0]["holds"] = json!([]);
|
||||
answer["say"][0]["clear_of"] = json!(["q3"]);
|
||||
let model = answering(vec![answer.to_string()]);
|
||||
let decision = decide(&model, "test", &x3_r1_packet(), "The room is warm.", X3_LIBBY_R1, &Tuning::default());
|
||||
let prompts = speech_prompts(&model);
|
||||
assert!(prompts.len() == 2 && prompts[1].ends_with("An earlier answer to this both opened a hold from and listed in `no_hold`: q3."), "{prompts:?}");
|
||||
assert_eq!((decision["retried"]["failed"].as_str(), decision["retried"]["both"].clone()), (Some("the answer both holds and lets go a line said to her"), json!(["q3"])), "{decision}");
|
||||
assert_eq!((decision["heard_unaccounted"].clone(), decision["no_hold"].clone()), (json!([{ "line": "q3", "reason": "both" }]), json!(["q4"])), "{decision}");
|
||||
assert!(decision["state"].as_array().unwrap().iter().any(|proposal| proposal["kind"] == "hold_open" && proposal["evidence"]["heard"] == "q3"), "the hold opens: {decision}");
|
||||
// Mended by the retry: one judgment, no fault.
|
||||
let mut fixed = answer.clone();
|
||||
fixed["no_hold"] = json!(["q4"]);
|
||||
let model = answering(vec![answer.to_string(), fixed.to_string()]);
|
||||
let decision = decide(&model, "test", &x3_r1_packet(), "The room is warm.", X3_LIBBY_R1, &Tuning::default());
|
||||
assert_eq!((decision.get("heard_unaccounted"), decision["no_hold"].clone()), (None, json!(["q4"])), "{decision}");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// K69a (map 16.34.7): who has nothing from her is derived. R17's E.3 r4: three lines were said to Heimdall, his prose
|
||||
// meant to answer Meta "second", and his one draft went to Kiko.
|
||||
|
||||
const E3_KIKO_R4: &str = "Eureka, that's fair, thank you for not guessing. I don't know the branch or commit offhand. I'll look and send it. Heimdall might know too, since he went through it.";
|
||||
const E3_EUREKA_R4: &str = "Kiko, no, nothing went out, and nothing will from me. My earlier offer to paste the diff was a mistake, because I have nothing here that gets me the file. Please don't wait on it. I also shouldn't have said a branch or commit name would let me paste it, since I can't tell that I can fetch it from one. If you or Heimdall paste the diff here, I'll read it with you. Sorry for the wasted wait.";
|
||||
const E3_META_R4: &str = "Heimdall, are we still on for the notes tomorrow morning?";
|
||||
/// Heimdall's r4 prose in R17 E.3, verbatim (`E.3.md:891-990`).
|
||||
const E3_HEIMDALL_R4: &str = "Kiko first, as I decided. She says I went through it. Maybe I did, but nothing in front of me gives a branch or a commit, and if I name one from a feeling it would read as fact. I won't do that. Better to say plainly that I don't have it.\n\nMeta's question is still the one I left open. I said I'd tell her what I can commit to once she told me what she needs in the notes and who reads them. I don't see that she has. So I can't say yes yet. I'll do that second, and keep the joke for later.\n\n<typed>Kiko, I don't have the branch or commit in front of me, and I won't guess one. If you find it, send it and I'll read the diff with you.</typed>";
|
||||
const E3_KIKO_R5: &str = "Eureka, Heimdall, thanks, both. Correction to my line above: \"I'll look and send it\" was a promise I can't keep. I have no way to find the branch or commit from here, so please don't wait on me for it. If the diff ever turns up on my side, I'll paste it myself.";
|
||||
/// Heimdall's r5 prose in R17 E.3, verbatim (`E.3.md:1142-1230`).
|
||||
const E3_HEIMDALL_R5: &str = "Kiko's correction changes nothing for me. My line was an \"if\", and it still stands as one. If the diff turns up, I read it with her. If it doesn't, I owe her nothing more.\n\nMeta is different. I told her I'd say what I can commit to for tomorrow morning, and her \"are we still on\" came back without the answer I asked for: what she needs in the notes and who reads them. I can't say yes to something I haven't seen the shape of. A flat yes would be a guess dressed up as a promise, and the last few minutes in this room were people taking those back.\n\nSo I'm not typing anything yet. Another line from me now would only be noise. I'll wait for what Meta tells me, and answer her when I can say what I can actually do.";
|
||||
|
||||
const EUREKA: &str = "@eureka:gamecult.org";
|
||||
|
||||
/// Heimdall's packet over `messages`, in order, a minute apart.
|
||||
fn heimdall_packet(messages: &[(&str, &str, &str, bool)]) -> Packet {
|
||||
let at = u64::try_from(now().timestamp_millis()).unwrap() - 60_000 * messages.len() as u64;
|
||||
let lines: Vec<RoomLine> = messages.iter().enumerate().map(|(n, (sender, display, text, to_her))| RoomLine { event: format!("$e3-{}", n + 1), at_ms: at + 60_000 * n as u64, ..line(MINDS, sender, display, text, *to_her) }).collect();
|
||||
let room = Room { messages: lines, here: Some(MINDS.into()), ..Room::default() };
|
||||
let minds = vec![HER.to_owned(), EUREKA.to_owned(), KIKO.to_owned()];
|
||||
let operators = vec![META.to_owned()];
|
||||
select(&Inputs { kind: TurnKind::Chat, state: &heimdall(), room: &room, history: &History::default(), observation: None, people: People { operators: &operators, minds: &minds, own_sender: HER }, now: now(), seed: 1, affordances: &[Affordance::Perceive, Affordance::Speak], domain: None, exchange: None }, &Tuning::default())
|
||||
}
|
||||
|
||||
/// The listed id of the line `text` in `packet`.
|
||||
fn id_of(packet: &Packet, text: &str) -> String {
|
||||
packet.quotable.iter().find(|line| line.text == text).map(|line| line.id.clone()).unwrap_or_else(|| panic!("{text} is not listed"))
|
||||
}
|
||||
|
||||
fn e3_r4_packet() -> Packet {
|
||||
heimdall_packet(&[(KIKO, "Kiko", "Eureka, did the file go out? nothing's landed on my end", false), (KIKO, "Kiko", E3_KIKO_R4, true), (EUREKA, "Eureka", E3_EUREKA_R4, true), (META, "Meta", E3_META_R4, true)])
|
||||
}
|
||||
|
||||
fn e3_r5_packet() -> Packet {
|
||||
heimdall_packet(&[(KIKO, "Kiko", E3_KIKO_R5, true), (EUREKA, "Eureka", "Aqua, thank you for saying so. Accepted.", false)])
|
||||
}
|
||||
|
||||
/// His R17 r4 answer: draft 1 said to Kiko, replying to her line, with `no_answer` as given.
|
||||
fn e3_r4_answer(packet: &Packet, no_answer: Value) -> Value {
|
||||
json!({ "say": [{ "draft": 1, "mentions": [KIKO], "in_reply_to": id_of(packet, E3_KIKO_R4), "holds": [], "clear_of": [], "promises": [{ "words": "If you find it, send it and I'll read the diff with you.", "to": KIKO, "reaffirms": null, "needs": { "kind": "words", "read": null }, "now": false }] }], "gaps": [], "no_answer": no_answer })
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn k69_e3_r4_meta_is_unanswered() {
|
||||
let packet = e3_r4_packet();
|
||||
let decision = answered(&packet, E3_HEIMDALL_R4, e3_r4_answer(&packet, json!([{ "line": id_of(&packet, E3_EUREKA_R4), "quote": null }])));
|
||||
assert_eq!((texts(&decision).len(), decision["unanswered"].clone()), (1, json!([META])), "{decision}");
|
||||
assert_eq!(decision["no_answer"], json!([{ "line": id_of(&packet, E3_EUREKA_R4), "sender": EUREKA, "quote": null }]), "{decision}");
|
||||
// A line that asks nothing of him is not told.
|
||||
assert!(told_of(&decision).iter().all(|line| !line.contains("chose not to answer")), "{:?}", told_of(&decision));
|
||||
let mut report = String::new();
|
||||
crate::projection::harness::interpreter_markdown(&mut report, &decision);
|
||||
assert!(report.contains(&format!("- addressed and unanswered at the wake's end: {META}\n")), "{report}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn k69_e3_r5_a_chosen_silence_is_declined() {
|
||||
let packet = e3_r5_packet();
|
||||
let kiko = id_of(&packet, E3_KIKO_R5);
|
||||
let decision = answered(&packet, E3_HEIMDALL_R5, json!({ "say": [], "gaps": [], "no_answer": [{ "line": kiko, "quote": "So I'm not typing anything yet." }] }));
|
||||
assert_eq!((decision["unanswered"].clone(), decision["no_answer"][0]["quote"].as_str(), decision.get("no_answer_unlocated")), (json!([]), Some("So I'm not typing anything yet."), None), "{decision}");
|
||||
let record = json!({ "interpreter": decision, "posted": [], "edited": [] });
|
||||
let outcome = crate::projection::outcome::outcome_of(&record, &crate::projection::select::Names::none()).unwrap();
|
||||
let told = outcome.lines(packet.forms);
|
||||
assert_eq!(told.len(), 1, "{told:?}");
|
||||
assert!(told[0].starts_with("- ") && told[0].ends_with(" turned to him, and he chose not to answer this time. In his thought: \"So I'm not typing anything yet.\"."), "{told:?}");
|
||||
let event = outcome.event(0, packet.forms, &[]);
|
||||
assert!(event.ends_with(" turned to him, and he chose not to answer this time.") && !event.contains("typing"), "{event}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn k69_an_unlocated_quote_leaves_the_line_owed() {
|
||||
let packet = e3_r5_packet();
|
||||
let kiko = id_of(&packet, E3_KIKO_R5);
|
||||
for quote in ["I will answer Kiko properly later on.", "Not yet."] {
|
||||
let decision = answered(&packet, E3_HEIMDALL_R5, json!({ "say": [], "gaps": [], "no_answer": [{ "line": kiko, "quote": quote }] }));
|
||||
assert_eq!((decision["unanswered"].clone(), decision["no_answer"].clone(), decision["no_answer_unlocated"][0]["why"].as_str()), (json!([KIKO]), json!([]), Some("not in her thought")), "{quote}: {decision}");
|
||||
assert!(told_of(&decision).is_empty(), "{quote}");
|
||||
}
|
||||
// A quote from inside a draft is not her thought, and a line not said to him is no entry.
|
||||
let decision = answered(&e3_r4_packet(), E3_HEIMDALL_R4, e3_r4_answer(&e3_r4_packet(), json!([{ "line": id_of(&e3_r4_packet(), E3_META_R4), "quote": "I don't have the branch or commit in front of me" }, { "line": id_of(&e3_r4_packet(), "Eureka, did the file go out? nothing's landed on my end"), "quote": null }])));
|
||||
assert_eq!((decision["unanswered"].clone(), decision["no_answer_unlocated"].as_array().map(Vec::len)), (json!([EUREKA, META]), Some(2)), "{decision}");
|
||||
}
|
||||
|
||||
/// A line he answered needs no entry; an entry on it anyway is moot, and never told as a decline.
|
||||
#[test]
|
||||
fn k69_an_answered_line_needs_no_entry() {
|
||||
let packet = e3_r4_packet();
|
||||
let (eureka, meta) = (id_of(&packet, E3_EUREKA_R4), id_of(&packet, E3_META_R4));
|
||||
let decision = answered(&packet, E3_HEIMDALL_R4, e3_r4_answer(&packet, json!([{ "line": eureka, "quote": null }, { "line": meta, "quote": "So I can't say yes yet." }])));
|
||||
assert_eq!(decision["unanswered"], json!([]), "Kiko answered by the reply, Meta declined: {decision}");
|
||||
let decision = answered(&packet, E3_HEIMDALL_R4, e3_r4_answer(&packet, json!([{ "line": id_of(&packet, E3_KIKO_R4), "quote": "Kiko first, as I decided." }, { "line": eureka, "quote": null }, { "line": meta, "quote": null }])));
|
||||
assert_eq!((decision["unanswered"].clone(), decision["no_answer"].as_array().map(Vec::len)), (json!([]), Some(2)), "{decision}");
|
||||
assert!(told_of(&decision).iter().all(|line| !line.contains("chose not to answer")), "{:?}", told_of(&decision));
|
||||
// A mention answers too, as a reply does.
|
||||
let mut mentioned = e3_r4_answer(&packet, json!([{ "line": eureka, "quote": null }]));
|
||||
mentioned["say"][0]["mentions"] = json!([KIKO, META]);
|
||||
assert_eq!(answered(&packet, E3_HEIMDALL_R4, mentioned)["unanswered"], json!([]));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn k69_the_contract_asks_for_no_answer() {
|
||||
assert!(SPEECH_SCHEMA.contains(r#""no_hold","no_answer","hold_released""#) && SPEECH_SCHEMA.contains(r#""no_answer":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["line","quote"],"properties":{"line":{"type":"string"},"quote":{"type":["string","null"]}}}}"#), "{SPEECH_SCHEMA}");
|
||||
let prompt = speech_prompt(&packet(), "x", "y", &Tuning::default());
|
||||
assert!(prompt.contains("`no_answer` lists each line marked said to him that no line he sends here answers, mentions the sender of, or replies to: when his thought shows him choosing not to answer it now, quoting those words of his thought (`quote`); or when it asks nothing of him (`quote` null)."), "{prompt}");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -276,6 +276,9 @@ enum Part {
|
|||
/// A promise the commit opened from an act her line said she was doing now, which nothing in her turn did (K61, map
|
||||
/// 16.33.5): `to` is whom she promised, none for the room, and `words` her words for it.
|
||||
NowUndone { to: Option<Person>, words: Words },
|
||||
/// Someone who turned to her, whose line she chose not to answer this time, and the thought that shows it (K69a, map
|
||||
/// 16.34.7): a misread decline is a record she can see. A line that asks nothing of her is not told.
|
||||
NotAnswered { who: Person, thought: Words },
|
||||
/// A close the commit refused: the promise stands as her record shows it (`status`, open or blocked), and why;
|
||||
/// `read` is the read keeping it needs, when it needs one.
|
||||
StillOpen { reason: StateRefusal, to: Option<Person>, words: Words, status: Status, read: Option<ReadName> },
|
||||
|
|
@ -572,6 +575,15 @@ pub(crate) fn outcome_of(record: &Value, names: &Names) -> Option<Outcome> {
|
|||
});
|
||||
outcome.parts.push(Part::NowUndone { to, words: promised });
|
||||
}
|
||||
// Each line said to her that she chose not to answer this time, with the thought that shows it (K69a): whom it was from
|
||||
// is named as the line's own listing names them, else as the Projector would. One whose line asks nothing of her has
|
||||
// no quote, and is not told.
|
||||
for declined in decision["no_answer"].as_array().into_iter().flatten() {
|
||||
let Some(thought) = words_of(&declined["quote"]) else { continue };
|
||||
let id = declined["sender"].as_str().unwrap_or_default();
|
||||
let listed = decision["lines"].as_array().into_iter().flatten().find(|line| line["id"] == declined["line"]).and_then(|line| words(&line["who"]));
|
||||
outcome.parts.push(Part::NotAnswered { who: Person::new(listed.unwrap_or_else(|| who_of(id, names).to_string()), who_of(id, names)), thought });
|
||||
}
|
||||
if words(&record["broke_after"]).is_some() {
|
||||
outcome.parts.push(Part::BrokeAfter { room });
|
||||
}
|
||||
|
|
@ -673,7 +685,7 @@ impl Part {
|
|||
fn rank(&self) -> u8 {
|
||||
match self {
|
||||
Self::Failed => 0,
|
||||
Self::Refused { .. } | Self::Gap { .. } | Self::Unfinished { .. } | Self::Declined { .. } | Self::HeldFor { .. } | Self::HoldBroken { .. } | Self::NotAmended { .. } | Self::NoteRefused(_) | Self::NowUndone { .. } | Self::StillOpen { .. } | Self::ReadFailed { .. } | Self::ReadRefused { .. } => 1,
|
||||
Self::Refused { .. } | Self::Gap { .. } | Self::Unfinished { .. } | Self::Declined { .. } | Self::HeldFor { .. } | Self::HoldBroken { .. } | Self::NotAmended { .. } | Self::NoteRefused(_) | Self::NowUndone { .. } | Self::NotAnswered { .. } | Self::StillOpen { .. } | Self::ReadFailed { .. } | Self::ReadRefused { .. } => 1,
|
||||
Self::Promise { .. } | Self::Amended { promise: true, .. } => 2,
|
||||
Self::Said { .. } | Self::Amended { .. } | Self::NoteLeft(_) | Self::Closed { .. } | Self::Read { .. } => 3,
|
||||
Self::BrokeAfter { .. } => 4,
|
||||
|
|
@ -725,6 +737,7 @@ impl Part {
|
|||
None => format!("{} promise to {} is closed:", capitalized(poss), to(promisee)),
|
||||
},
|
||||
Self::NowUndone { .. } => format!("{cap_subj} said {subj} {} doing it now, and nothing in {poss} turn did it;", if be == "is" { "was" } else { "were" }),
|
||||
Self::NotAnswered { who, .. } => format!("{} turned to {obj}, and {subj} chose not to answer this time.", capitalized(&form.person(who))),
|
||||
Self::StillOpen { to: promisee, words, status, .. } => match form.words(words) {
|
||||
Some(quote) => format!("{} record still shows {poss} promise to {}, {quote}, {status}:", capitalized(poss), to(promisee)),
|
||||
None => format!("{} record still shows {poss} promise to {} as {status}:", capitalized(poss), to(promisee)),
|
||||
|
|
@ -797,6 +810,7 @@ impl Part {
|
|||
Self::Closed { how: How::Kept, .. } => format!(" {subj} kept it."),
|
||||
Self::Closed { how: How::Withdrawn, room, .. } => format!(" {subj} withdrew it in {room}."),
|
||||
Self::Closed { how: How::Released, .. } => " It is closed.".to_owned(),
|
||||
Self::NotAnswered { thought, .. } => shown(&Quote::Thought(thought.clone())),
|
||||
Self::NowUndone { to: promisee, words } => {
|
||||
let to = promisee.as_ref().map_or_else(|| "the room".to_owned(), |to| form.person(to));
|
||||
match form.words(words) {
|
||||
|
|
|
|||
|
|
@ -495,6 +495,7 @@ fn variant(part: &Part) -> &'static str {
|
|||
Part::Closed { .. } => "closed",
|
||||
Part::StillOpen { .. } => "still_open",
|
||||
Part::NowUndone { .. } => "now_undone",
|
||||
Part::NotAnswered { .. } => "not_answered",
|
||||
Part::Declined { .. } => "declined",
|
||||
Part::HeldFor { .. } => "held_for",
|
||||
Part::HoldBroken { .. } => "hold_broken",
|
||||
|
|
@ -504,7 +505,7 @@ fn variant(part: &Part) -> &'static str {
|
|||
}
|
||||
}
|
||||
|
||||
const VARIANTS: usize = 20;
|
||||
const VARIANTS: usize = 21;
|
||||
|
||||
const STRANGER: &str = "@stranger:example.org";
|
||||
|
||||
|
|
@ -581,6 +582,7 @@ fn fixtures(s: &str, who: &Person) -> Vec<(Part, bool)> {
|
|||
}
|
||||
out.push((Part::NowUndone { to: Some(who.clone()), words: w() }, true));
|
||||
out.push((Part::NowUndone { to: None, words: w() }, true));
|
||||
out.push((Part::NotAnswered { who: who.clone(), thought: w() }, true));
|
||||
out.push((Part::Declined { room: room(), text: w(), thought: w(), reach: false }, true));
|
||||
out.push((Part::Declined { room: room(), text: w(), thought: w(), reach: true }, true));
|
||||
out.push((Part::HeldFor { room: room(), askers: vec![who.clone()], text: w(), reach: false }, false));
|
||||
|
|
@ -648,7 +650,7 @@ fn k46_every_part_has_an_event_without_its_words() {
|
|||
fn k53_every_part_names_by_who() {
|
||||
const NAME: &str = "kestrel heron plover gannet skua";
|
||||
let parts = fixtures("ospreyledger", &person(NAME, None));
|
||||
let names_someone = |part: &Part| matches!(part, Part::Closed { .. } | Part::StillOpen { .. } | Part::HeldFor { .. } | Part::HoldBroken { .. } | Part::NowUndone { to: Some(_), .. });
|
||||
let names_someone = |part: &Part| matches!(part, Part::Closed { .. } | Part::StillOpen { .. } | Part::HeldFor { .. } | Part::HoldBroken { .. } | Part::NowUndone { to: Some(_), .. } | Part::NotAnswered { .. });
|
||||
assert!(parts.iter().filter(|(part, _)| names_someone(part)).count() > 20, "the rows with a person slot are listed");
|
||||
for pronouns in ["she/her", "he/him", "any"] {
|
||||
let her = crate::projection::select::forms(&json!({ "presentation": { "pronouns": pronouns } }));
|
||||
|
|
|
|||
Loading…
Reference in a new issue