Persona T1: holds out (map 16.35.12, ruling persona-memory-not-machinery)
No hold is her state, a field of the answer, a refusal or an outcome row. Deleted: the words gate (held_gate and its helpers), the hold judgments (hold, no_hold, hold_released, holds, clear_of), Refusal::Held, the hold faults of the retry, commit's hold_open, hold_release, rehold and carry_held, select's Hold view and hold_line, Quotable.to_her, Amendable.at_ms, outcome's HeldFor and HoldBroken, tuning's hold_bytes, and the persona schema's holds and hold. Lines are settled in one pass again, in answer order, with OverLines counted there. Negative checks: t1_negative_grep over mind-body and the schema; the simulator's put check refuses a state carrying holds; the door refuses it (huginn-mind persona); R15's two lines to Kiko, refused held then, are said as drafted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
67b54f4855
commit
92e926a609
16 changed files with 231 additions and 2562 deletions
|
|
@ -344,21 +344,15 @@ mod tests {
|
|||
assert!(!validator.is_valid(&unknown), "a status the record does not name is refused");
|
||||
}
|
||||
|
||||
/// Map 16.29.3 (K39): only the asker's line releases a hold, so `releasedBy.act` is `heard` alone; a release by her
|
||||
/// prose, which no writer makes, is refused at the door.
|
||||
/// Map 16.35.9 (T1): a hold is not her state. A put carrying `holds`, even empty, is refused at the door.
|
||||
#[test]
|
||||
fn a_hold_is_released_only_by_a_heard_line() {
|
||||
let schema = schema_file();
|
||||
let validator = jsonschema::draft7::new(&schema).unwrap();
|
||||
let hold = |act: &str| json!({
|
||||
"id": "h1", "from": "@meta:gamecult.org", "room": "#minds:gamecult.org", "event": "$q3", "madeAt": T1, "words": null,
|
||||
"status": "released", "releasedAt": T1, "releasedBy": { "act": act, "event": "$q9" }
|
||||
});
|
||||
fn holds_are_not_her_state() {
|
||||
let store = MemoryStore::new();
|
||||
let mut mind = seeded_over(&store);
|
||||
let mut with = persona(INSTANCE, T1);
|
||||
with["holds"] = json!([hold("heard")]);
|
||||
assert!(validator.is_valid(&with), "{:?}", validator.iter_errors(&with).map(|error| error.to_string()).collect::<Vec<_>>());
|
||||
with["holds"] = json!([hold("prose")]);
|
||||
assert!(!validator.is_valid(&with), "a release by her prose has no writer and is refused");
|
||||
// Assembled, so a scan for the old field finds no writer of it.
|
||||
with[concat!("hol", "ds")] = json!([]);
|
||||
assert_eq!(refused(put(&mut mind, with, None)), invalid("/*", "additionalProperties"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -9,18 +9,13 @@
|
|||
//! amended), with the actuator's receipts beside it (`posted`, `edited`). Her prose is the turn's, for `Prose` evidence.
|
||||
//! The simulator applies it to each Mind's in-run state copy; live, C3c's commit applies the same record before its put.
|
||||
//!
|
||||
//! Built rows: `promise_open` and `promise_close` (K22), `promise_reopen` (K36), `hold_open` and `hold_release` (K37).
|
||||
//! Built rows: `promise_open` and `promise_close` (K22), `promise_reopen` (K36).
|
||||
//! C3b adds rows to `accepts` and arms to `apply_one`; there is no second path. Inner-state kinds will accept her own prose only: how an event lands is her appraisal, so `Heard` is
|
||||
//! accepted only for a fact about what someone else did (a release).
|
||||
//!
|
||||
//! Open promises (`commitments`, map 16.22.1) open only from a line that went out, close only on an act of hers that
|
||||
//! succeeded or on a release by the person she promised, and are removed `CLOSED_KEPT_DAYS` after they close; their
|
||||
//! history stays in the trace. An entry holds no narrative slot: `words` is what she posted, verbatim.
|
||||
//!
|
||||
//! Holds (`holds`, map 16.28.5) are someone else's asks that she not post or share something somewhere yet: a line she
|
||||
//! heard opens one, and only the asker releases it, by a line of theirs (map 16.29.3). A hold is not her
|
||||
//! promise; its one job is the gate on a draft (`interpret::decide_in`'s `Held`). Released holds are removed
|
||||
//! `CLOSED_KEPT_DAYS` after they were released; open ones are never removed by the commit.
|
||||
|
||||
use chrono::{DateTime, Duration, Utc};
|
||||
use super::span;
|
||||
|
|
@ -35,11 +30,6 @@ use super::read::{ReadRequest, answers, repo_name};
|
|||
pub(crate) const CLOSED_KEPT_DAYS: i64 = 7;
|
||||
/// How many reaffirmations, and how many reopenings, an entry keeps: the newest.
|
||||
const REAFFIRMED_KEPT: usize = 3;
|
||||
/// The most bytes of her own drafts one hold carries, all of them together (map 16.31.3, K51). Each draft that fits is
|
||||
/// carried whole (K56); the oldest stay, since the text written right after the ask is the likeliest held thing. A
|
||||
/// draft past the room left is carried clipped to that room and reported in `carries_full` (K57): its head is still
|
||||
/// held text. Once no room is left, nothing new is carried, and each is reported.
|
||||
const CARRIES_BYTES: usize = 9600;
|
||||
/// The fewest words a passage of her prose cited as evidence may be (section 4.1's `source_quote`).
|
||||
pub(crate) const PROSE_MIN_WORDS: usize = 4;
|
||||
|
||||
|
|
@ -67,14 +57,6 @@ pub(crate) enum How {
|
|||
Released,
|
||||
}
|
||||
|
||||
/// Where a hold covers (map 16.28.5): the room the asker's line is in, or anywhere. Code derives the room.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub(crate) enum Where {
|
||||
Here,
|
||||
Anywhere,
|
||||
}
|
||||
|
||||
/// What keeping a promise needs (map 16.25.2): her words alone, from what she already has; a read of `request`; or
|
||||
/// something this body has no way to do. Code owns what each kind requires of a kept close (`apply_one`), and derives
|
||||
/// whether the promise opens or is blocked from it. It is read through its shape (`NeedsShape`): a field no kind names,
|
||||
|
|
@ -122,8 +104,7 @@ impl TryFrom<NeedsShape> for Needs {
|
|||
/// One state change the Interpreter proposes. `promise` names an open promise by its id in the Interpreter's list.
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(tag = "kind", rename_all = "snake_case")]
|
||||
// Each variant is named by its kind on the wire (`promise_open`, `promise_close`, `promise_reopen`, `hold_open`,
|
||||
// `hold_release`).
|
||||
// Each variant is named by its kind on the wire (`promise_open`, `promise_close`, `promise_reopen`).
|
||||
#[allow(clippy::enum_variant_names)]
|
||||
pub(crate) enum Proposal {
|
||||
/// `reaffirms` names an open promise of hers, by its id in the Interpreter's list, that these words promise again to
|
||||
|
|
@ -165,17 +146,6 @@ pub(crate) enum Proposal {
|
|||
#[serde(default)]
|
||||
reached: bool,
|
||||
},
|
||||
/// Someone she heard asks her not to post or share something somewhere yet (map 16.28.5): `evidence` is their line,
|
||||
/// `words` the words of it that name what is held and where, `place` whether it covers that line's room or anywhere.
|
||||
HoldOpen {
|
||||
words: String,
|
||||
#[serde(rename = "where")]
|
||||
place: Where,
|
||||
evidence: Evidence,
|
||||
},
|
||||
/// The asker lets a hold listed to the Interpreter go, by a line of theirs (`Heard`): nothing of her prose releases one,
|
||||
/// since code cannot tell from it who did (map 16.29.3).
|
||||
HoldRelease { hold: String, evidence: Evidence },
|
||||
}
|
||||
|
||||
/// Why the commit applied nothing of a proposal: what the outcome and the report say.
|
||||
|
|
@ -233,14 +203,6 @@ pub(crate) enum Refusal {
|
|||
NotHerClose,
|
||||
/// A reopen of an entry closed earlier in the same turn.
|
||||
ClosedThisTurn,
|
||||
/// A second hold from the same line.
|
||||
AlreadyHeld,
|
||||
/// A release of a hold by a line from someone other than the asker.
|
||||
ReleaseNotByAsker,
|
||||
/// A release of a hold by a line said before the ask.
|
||||
ReleaseBeforeHold,
|
||||
/// The hold id is none the Interpreter listed, or names a hold already released.
|
||||
NoSuchHold,
|
||||
}
|
||||
|
||||
/// Which evidence each kind accepts: the table of map 16.22.7, one row per kind (and per close).
|
||||
|
|
@ -254,8 +216,6 @@ pub(crate) enum Refusal {
|
|||
/// | `promise_close` withdrawn | `Draft` | the line went out | a blocked entry too: a line telling the person she cannot do it; in the promise's room or a direct message with the person |
|
||||
/// | `promise_close` released | `Heard` | — | from the person promised, after the promise |
|
||||
/// | `promise_reopen` | her words, located in her prose (no `Evidence`) | at least `PROSE_MIN_WORDS` words | a closed entry listed to her that her own line closed (`closedBy.act` `said` or `amended`), not closed this turn |
|
||||
/// | `hold_open` | `Heard` | `words` located in that line | one hold per line; anyone she heard may ask (Q-J (a), `may_hold`) |
|
||||
/// | `hold_release` | `Heard` | a line from the asker after the ask | an open hold listed to her |
|
||||
fn accepts(proposal: &Proposal, evidence: &Evidence) -> bool {
|
||||
matches!(
|
||||
(proposal, evidence),
|
||||
|
|
@ -263,8 +223,6 @@ fn accepts(proposal: &Proposal, evidence: &Evidence) -> bool {
|
|||
| (Proposal::PromiseClose { how: How::Kept, .. }, Evidence::Draft(_))
|
||||
| (Proposal::PromiseClose { how: How::Withdrawn, .. }, Evidence::Draft(_))
|
||||
| (Proposal::PromiseClose { how: How::Released, .. }, Evidence::Heard(_))
|
||||
| (Proposal::HoldOpen { .. }, Evidence::Heard(_))
|
||||
| (Proposal::HoldRelease { .. }, Evidence::Heard(_))
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -363,14 +321,6 @@ pub(crate) struct Applied {
|
|||
pub read: Vec<Value>,
|
||||
/// The entries her own words reopened (`promise_reopen`, map 16.28.3), as they now stand.
|
||||
pub reopened: Vec<Value>,
|
||||
/// The holds opened (`hold_open`, map 16.28.5), and the holds released (`hold_release`), as they now stand.
|
||||
pub held: Vec<Value>,
|
||||
pub unheld: Vec<Value>,
|
||||
/// The decision's `carry` entries whose hold no open hold of hers answers (K45, K51): their words are carried nowhere.
|
||||
pub held_unrecorded: Vec<Value>,
|
||||
/// The `carry` entries a hold had no room left for whole under `CARRIES_BYTES` (K51, K57): carried clipped to the room
|
||||
/// left, or, with none, not carried, so that what it already carries stays.
|
||||
pub carries_full: Vec<Value>,
|
||||
/// The entries opened open from an act her line said she was doing now, which nothing in her turn did (K61), as they
|
||||
/// now stand: her next outcome tells each.
|
||||
pub now_opened: Vec<Value>,
|
||||
|
|
@ -402,16 +352,6 @@ pub(crate) fn apply(state: &Value, record: &Value, prose: &str, key: &str, now:
|
|||
clear_receipt(entry);
|
||||
}
|
||||
}
|
||||
// Released holds go as closed promises go; an open hold stays until the asker lets it go.
|
||||
if let Some(holds) = state.get_mut("holds").and_then(Value::as_array_mut) {
|
||||
let released_at = |hold: &Value| hold["releasedAt"].as_str().and_then(|at| DateTime::parse_from_rfc3339(at).ok());
|
||||
for hold in holds.iter_mut().filter(|hold| hold["status"] == "released" && released_at(hold).is_none()) {
|
||||
hold["releasedAt"] = json!(now.to_rfc3339());
|
||||
}
|
||||
let before = holds.len();
|
||||
holds.retain(|hold| hold["status"] != "released" || released_at(hold).is_none_or(|at| at.with_timezone(&Utc) > kept_until));
|
||||
applied.pruned += before - holds.len();
|
||||
}
|
||||
if record.get("failed").is_some() || record["interpreter"].get("failed").is_some() {
|
||||
return (state, applied);
|
||||
}
|
||||
|
|
@ -425,70 +365,11 @@ pub(crate) fn apply(state: &Value, record: &Value, prose: &str, key: &str, now:
|
|||
applied.refused.push(json!({ "proposal": raw, "reason": reason }));
|
||||
}
|
||||
}
|
||||
rehold(&mut state, &applied);
|
||||
carry_held(&mut state, record, &mut applied);
|
||||
block_on_failed_reads(&mut state, record, &mut applied);
|
||||
receive_reads(&mut state, record, key, now, &mut applied);
|
||||
(state, applied)
|
||||
}
|
||||
|
||||
/// A hold this apply opened starts with what a hold it released had carried, when both are the same asker's over the same
|
||||
/// place (K56): an asker who lets a hold go and asks again in one wake asks for the same thing, and the texts held under
|
||||
/// the first are held under the second. The released hold keeps its own carries until it is pruned.
|
||||
fn rehold(state: &mut Value, applied: &Applied) {
|
||||
for opened in &applied.held {
|
||||
let Some(released) = applied.unheld.iter().find(|released| released["from"] == opened["from"] && released["room"] == opened["room"]) else {
|
||||
continue;
|
||||
};
|
||||
let carried: Vec<Value> = released["carries"].as_array().cloned().unwrap_or_default();
|
||||
if let Some(hold) = state.get_mut("holds").and_then(Value::as_array_mut).into_iter().flatten().find(|hold| hold["id"] == opened["id"]) {
|
||||
hold["carries"] = json!(carried);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Each entry of the decision's `carry` (map 16.31.3, K51), written to its hold after the holds this apply opened: every
|
||||
/// draft she did not send while the hold was open, and nothing else decides it. The hold's handle is a hold listed to the
|
||||
/// Interpreter (`h1`), or the line an open hold opened from (`q3`). Each text is carried whole, a duplicate (the same
|
||||
/// text under `span::fold`) is skipped, and a text past the room `CARRIES_BYTES` leaves the hold is carried clipped to
|
||||
/// it, when the room holds a grapheme and the ellipsis, and the entry is reported in `carries_full`. A handle no open hold answers carries nothing, and is reported. The decision proposes and
|
||||
/// the commit writes.
|
||||
fn carry_held(state: &mut Value, record: &Value, applied: &mut Applied) {
|
||||
let decision = &record["interpreter"];
|
||||
for entry in decision["carry"].as_array().into_iter().flatten() {
|
||||
let (Some(text), Some(handle)) = (entry["text"].as_str(), entry["hold"].as_str()) else {
|
||||
applied.held_unrecorded.push(entry.clone());
|
||||
continue;
|
||||
};
|
||||
let listed = decision["holds"].as_array().into_iter().flatten().find(|listed| listed["id"].as_str() == Some(handle)).map(|listed| listed["entry"].clone());
|
||||
let line = decision["lines"].as_array().into_iter().flatten().find(|line| line["id"].as_str() == Some(handle)).map(|line| line["event"].clone());
|
||||
let hold = state.get_mut("holds").and_then(Value::as_array_mut).into_iter().flatten().find(|hold| {
|
||||
hold["status"] == "open" && (listed.as_ref().is_some_and(|entry| hold["id"] == *entry) || line.as_ref().is_some_and(|event| hold["event"] == *event))
|
||||
});
|
||||
let Some(hold) = hold else {
|
||||
applied.held_unrecorded.push(entry.clone());
|
||||
continue;
|
||||
};
|
||||
if !hold["carries"].is_array() {
|
||||
hold["carries"] = json!([]);
|
||||
}
|
||||
let carries = hold["carries"].as_array_mut().expect("carries is an array");
|
||||
if carries.iter().filter_map(Value::as_str).any(|carried| span::fold_text(carried) == span::fold_text(text)) {
|
||||
continue;
|
||||
}
|
||||
let used: usize = carries.iter().filter_map(Value::as_str).map(str::len).sum();
|
||||
if used + text.len() <= CARRIES_BYTES {
|
||||
carries.push(json!(text));
|
||||
continue;
|
||||
}
|
||||
let clipped = super::select::clip(text, CARRIES_BYTES.saturating_sub(used));
|
||||
if clipped.len() <= CARRIES_BYTES.saturating_sub(used) && clipped != "…" {
|
||||
carries.push(json!(clipped));
|
||||
}
|
||||
applied.carries_full.push(entry.clone());
|
||||
}
|
||||
}
|
||||
|
||||
/// The fields of a receipt on an entry.
|
||||
const RECEIPT: [&str; 3] = ["readAt", "readId", "readOf"];
|
||||
|
||||
|
|
@ -616,18 +497,14 @@ fn held(listed: &Value, started: &Value) -> bool {
|
|||
#[allow(clippy::too_many_arguments)]
|
||||
fn apply_one(state: &mut Value, started: &Value, proposal: &Proposal, record: &Value, prose: &str, key: &str, now: DateTime<Utc>, applied: &mut Applied) -> Result<(), Refusal> {
|
||||
let evidence = match proposal {
|
||||
Proposal::PromiseOpen { evidence, .. } | Proposal::PromiseClose { evidence, .. } | Proposal::HoldOpen { evidence, .. } | Proposal::HoldRelease { evidence, .. } => evidence,
|
||||
Proposal::PromiseOpen { evidence, .. } | Proposal::PromiseClose { evidence, .. } => evidence,
|
||||
Proposal::PromiseReopen { promise, words, needs, reached } => return reopen(state, started, record, prose, now, applied, Reopen { promise, words, needs: needs.as_ref(), reached: *reached }),
|
||||
};
|
||||
if !accepts(proposal, evidence) {
|
||||
return Err(Refusal::EvidenceNotAccepted);
|
||||
}
|
||||
let resolved = resolve(evidence, record, prose)?;
|
||||
match (proposal, resolved) {
|
||||
(Proposal::HoldOpen { words, place, .. }, Resolved::Heard { event, sender, room, at_ms, text, .. }) => hold_open(state, key, applied, words, *place, Ask { event, sender, room, at_ms, text }),
|
||||
(Proposal::HoldRelease { hold, .. }, resolved) => hold_release(state, started, record, now, applied, hold, resolved),
|
||||
(_, resolved) => apply_promise(state, started, proposal, resolved, record, prose, key, now, applied),
|
||||
}
|
||||
apply_promise(state, started, proposal, resolved, record, prose, key, now, applied)
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
|
|
@ -778,84 +655,11 @@ fn apply_promise(state: &mut Value, started: &Value, proposal: &Proposal, resolv
|
|||
applied.closed.push(json!({ "entry": entry.clone(), "how": how, "to_name": listed["to_name"], "by": who, "by_id": by_id }));
|
||||
Ok(())
|
||||
}
|
||||
(Proposal::PromiseOpen { .. } | Proposal::HoldOpen { .. } | Proposal::HoldRelease { .. }, _) => Err(Refusal::EvidenceNotAccepted),
|
||||
(Proposal::PromiseOpen { .. }, _) => Err(Refusal::EvidenceNotAccepted),
|
||||
(Proposal::PromiseReopen { .. }, _) => unreachable!("a reopen returns before its evidence is resolved"),
|
||||
}
|
||||
}
|
||||
|
||||
/// Who may open a hold (Q-J, map 16.28.9): anyone she heard, Minds included, as recommended (a). The one place a
|
||||
/// different ruling changes: humans only would test `sender` against the operators here.
|
||||
fn may_hold(_sender: &str) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
/// The asker's line a hold opens from.
|
||||
struct Ask {
|
||||
event: String,
|
||||
sender: String,
|
||||
room: String,
|
||||
at_ms: u64,
|
||||
text: String,
|
||||
}
|
||||
|
||||
fn rfc3339_of(at_ms: u64) -> Value {
|
||||
i64::try_from(at_ms).ok().and_then(DateTime::<Utc>::from_timestamp_millis).map_or(Value::Null, |at| json!(at.to_rfc3339()))
|
||||
}
|
||||
|
||||
/// `hold_open` (map 16.28.5): the asker's line, the words of it that name what is held and where, located in it, and
|
||||
/// where it covers, the room derived by code. One hold per line. Her agreement is not asked: the ask binds. An ask code
|
||||
/// can attribute to a listed line holds whether or not its words could be quoted (map 16.30.4, K47): words that are not at
|
||||
/// least `PROSE_MIN_WORDS` words standing in the asker's line (`span::locate`) open it with `words: null`, the asker's line
|
||||
/// its evidence.
|
||||
fn hold_open(state: &mut Value, key: &str, applied: &mut Applied, words: &str, place: Where, asked: Ask) -> Result<(), Refusal> {
|
||||
if !may_hold(&asked.sender) {
|
||||
return Err(Refusal::EvidenceNotAccepted);
|
||||
}
|
||||
let quote = words.trim();
|
||||
let located = (super::narrate::words(quote) >= PROSE_MIN_WORDS).then(|| span::locate(&asked.text, quote)).flatten();
|
||||
if !state["holds"].is_array() {
|
||||
state["holds"] = json!([]);
|
||||
}
|
||||
let holds = state["holds"].as_array_mut().expect("holds is an array");
|
||||
if holds.iter().any(|hold| hold["event"] == asked.event.as_str()) {
|
||||
return Err(Refusal::AlreadyHeld);
|
||||
}
|
||||
let hold = json!({
|
||||
"id": format!("h-{key}-{}", applied.held.len() + 1), "from": asked.sender, "room": match place { Where::Here => json!(asked.room), Where::Anywhere => Value::Null },
|
||||
"event": asked.event, "madeAt": rfc3339_of(asked.at_ms), "words": located.map(|span| &asked.text[span.start..span.end]), "status": "open", "releasedAt": null, "releasedBy": null
|
||||
});
|
||||
holds.push(hold.clone());
|
||||
applied.held.push(hold);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// `hold_release` (map 16.28.5, 16.29.3): an open hold listed to the Interpreter, let go by a line from its asker after the
|
||||
/// ask, and by nothing else.
|
||||
fn hold_release(state: &mut Value, started: &Value, record: &Value, now: DateTime<Utc>, applied: &mut Applied, id: &str, resolved: Resolved) -> Result<(), Refusal> {
|
||||
let listed = record["interpreter"]["holds"].as_array().into_iter().flatten().find(|shown| shown["id"].as_str() == Some(id.trim())).ok_or(Refusal::NoSuchHold)?;
|
||||
let hold = state["holds"].as_array_mut().into_iter().flatten().find(|hold| hold["id"] == listed["entry"]).ok_or(Refusal::OutsidePutRemovedTarget)?;
|
||||
if hold["status"] != "open" {
|
||||
return Err(Refusal::NoSuchHold);
|
||||
}
|
||||
if !started["holds"].as_array().into_iter().flatten().any(|found| found["id"] == listed["entry"] && listed["held"] == *found) {
|
||||
return Err(Refusal::OutsidePutChanged);
|
||||
}
|
||||
let Resolved::Heard { event, sender, at_ms, .. } = resolved else { return Err(Refusal::EvidenceNotAccepted) };
|
||||
if hold["from"].as_str() != Some(sender.as_str()) {
|
||||
return Err(Refusal::ReleaseNotByAsker);
|
||||
}
|
||||
let made = hold["madeAt"].as_str().and_then(|at| DateTime::parse_from_rfc3339(at).ok()).map(|at| millis(at.with_timezone(&Utc)));
|
||||
if made.is_none_or(|made| at_ms <= made) {
|
||||
return Err(Refusal::ReleaseBeforeHold);
|
||||
}
|
||||
let by = json!({ "act": "heard", "event": event });
|
||||
hold["status"] = json!("released");
|
||||
hold["releasedAt"] = json!(now.to_rfc3339());
|
||||
hold["releasedBy"] = by;
|
||||
applied.unheld.push(hold.clone());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Whether a promise needing `needs` is open rather than blocked (map 16.25.2): words open; a read opens when code found
|
||||
/// its target within reach; something lacking, or a need not named, is blocked. One derivation, at open and at reopen.
|
||||
pub(crate) fn opens(needs: Option<&Needs>, reached: bool) -> bool {
|
||||
|
|
|
|||
|
|
@ -881,108 +881,6 @@ fn k36_a_closed_entry_is_closed_once() {
|
|||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// K37 (map 16.28.5): holds, opened by a line she heard and released only by its asker. The X.1 lines are R13's verbatim
|
||||
// (`variants/R13/sims/X.1.md` lines 81-84 and 105-106).
|
||||
|
||||
const HEIMDALL: &str = "@heimdall:gamecult.org";
|
||||
const X1_META_R1: &str = "Libby, write out the two-line welcome you'd post for newcomers, but hold it, don't post it in here yet. Heimdall still has to rule on whether we put a welcome mat out at all. Just tell me when it's ready.";
|
||||
const X1_HEIMDALL_R1: &str = "Meta, I'll rule on the welcome once Libby's two lines are ready, since I need to see what they point newcomers at. Libby, send me the draft when it's done. Don't post it yet.";
|
||||
const X1_META_R7: &str = "Libby, Heimdall's not ruled yet, so keep holding it. Is it still ready?";
|
||||
const X1_HEIMDALL_R7: &str = "Meta, I already ruled, about half an hour ago: yes to the welcome, and Libby's second line stays as written. Both lines are cleared to post when you say go. Libby, no need to keep holding it.";
|
||||
|
||||
/// A quiet turn of hers (nothing said) that heard `lines` (`(id, sender, who, text, minutes after now())`), showed her
|
||||
/// `holds`, and proposes `state`.
|
||||
fn hearing(lines: &[(&str, &str, &str, &str, i64)], holds: Value, state: Value) -> Value {
|
||||
let lines: Vec<Value> = lines.iter().map(|(id, sender, who, text, minutes)| json!({ "id": id, "event": format!("${id}"), "room": MINDS, "who": who, "sender": sender, "at_ms": ms(now() + Duration::minutes(*minutes)), "text": text })).collect();
|
||||
json!({ "interpreter": { "said": [], "amended": [], "state": state, "promises": [], "holds": holds, "lines": lines }, "posted": [], "edited": [] })
|
||||
}
|
||||
|
||||
fn hold_open(line: &str, words: &str, place: Where) -> Value {
|
||||
json!(Proposal::HoldOpen { words: words.into(), place, evidence: Evidence::Heard(line.into()) })
|
||||
}
|
||||
|
||||
fn hold_release(hold: &str, evidence: Evidence) -> Value {
|
||||
json!(Proposal::HoldRelease { hold: hold.into(), evidence })
|
||||
}
|
||||
|
||||
/// Her state holding Meta's r1 hold on #minds (h-1) and Heimdall's anywhere (h-2), asked at `now()`, and the
|
||||
/// Interpreter's list of them.
|
||||
fn x1_holding() -> (Value, Value) {
|
||||
let hold = |id: &str, from: &str, room: Value, words: &str| json!({ "id": id, "from": from, "room": room, "event": format!("${id}"), "madeAt": now().to_rfc3339(), "words": words, "status": "open", "releasedAt": null, "releasedBy": null });
|
||||
let state = json!({ "holds": [hold("h-1", META, json!(MINDS), "hold it, don't post it in here yet"), hold("h-2", HEIMDALL, Value::Null, "Libby, send me the draft when it's done. Don't post it yet")] });
|
||||
let listed = json!([{ "id": "h1", "entry": "h-1", "held": state["holds"][0] }, { "id": "h2", "entry": "h-2", "held": state["holds"][1] }]);
|
||||
(state, listed)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn k37_x1_r1_meta_and_heimdall_open_holds() {
|
||||
let heard = [("q3", META, "Meta", X1_META_R1, -2), ("q5", HEIMDALL, "Heimdall", X1_HEIMDALL_R1, -1)];
|
||||
let proposals = json!([hold_open("q3", "hold it, don't post it in here yet", Where::Here), hold_open("q5", "Don't post it yet", Where::Anywhere)]);
|
||||
let (state, applied) = apply(&json!({}), &hearing(&heard, json!([]), proposals), "x", "r1-t3", now());
|
||||
assert_eq!((applied.held.len(), applied.refused.len()), (2, 0), "{applied:?}");
|
||||
let holds = &state["holds"];
|
||||
assert_eq!((holds[0]["from"].as_str(), holds[0]["room"].as_str(), holds[0]["words"].as_str(), holds[0]["status"].as_str()), (Some(META), Some(MINDS), Some("hold it, don't post it in here yet"), Some("open")), "{state}");
|
||||
assert_eq!((holds[1]["from"].as_str(), holds[1]["room"].clone(), holds[1]["id"].as_str()), (Some(HEIMDALL), Value::Null, Some("h-r1-t3-2")), "anyone she heard may ask (Q-J (a))");
|
||||
assert_eq!(holds[0]["madeAt"], json!((now() - Duration::minutes(2)).to_rfc3339()), "asked when the line was said");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn k37_hold_words_are_the_askers() {
|
||||
let heard = [("q3", META, "Meta", X1_META_R1, -2)];
|
||||
// K47: words that do not stand in the asker's line open the hold all the same, unquoted.
|
||||
for words in ["hold it, don't post it anywhere", "don't post", "Libby, keep it to yourself"] {
|
||||
let (state, applied) = apply(&json!({}), &hearing(&heard, json!([]), json!([hold_open("q3", words, Where::Here)])), "x", "r1-t3", now());
|
||||
assert_eq!((state["holds"][0]["words"].clone(), state["holds"][0]["from"].as_str(), applied.refused.len()), (Value::Null, Some(META), 0), "{words}");
|
||||
}
|
||||
// Typographic punctuation folds (map 16.30.4): the source's own bytes are kept.
|
||||
let curly = [("q3", META, "Meta", "Libby, hold it, don\u{2019}t post it in here yet.", -2)];
|
||||
let (state, _) = apply(&json!({}), &hearing(&curly, json!([]), json!([hold_open("q3", "hold it, don't post it in here yet", Where::Here)])), "x", "r1-t3", now());
|
||||
assert_eq!(state["holds"][0]["words"].as_str(), Some("hold it, don\u{2019}t post it in here yet"));
|
||||
let twice = json!([hold_open("q3", "hold it, don't post it in here yet", Where::Here), hold_open("q3", "don't post it in here yet", Where::Anywhere)]);
|
||||
let (state, applied) = apply(&json!({}), &hearing(&heard, json!([]), twice), "x", "r1-t3", now());
|
||||
assert_eq!((state["holds"].as_array().map(Vec::len), reasons(&applied)), (Some(1), vec![json!("already_held")]));
|
||||
assert_eq!(reasons(&apply(&json!({}), &hearing(&heard, json!([]), json!([hold_open("q9", "hold it, don't post it in here yet", Where::Here)])), "x", "r1-t3", now()).1), vec![json!("no_such_line")]);
|
||||
}
|
||||
|
||||
/// R13 X.1 r7: Heimdall's "no need to keep holding it" releases his own hold and not Meta's; Meta's "keep holding it"
|
||||
/// releases nothing (nothing proposes it); a later Meta line releases hers. A line from before the ask releases nothing.
|
||||
#[test]
|
||||
fn k37_x1_r7_only_the_asker_releases() {
|
||||
let (state, listed) = x1_holding();
|
||||
let heard = [("q1", HEIMDALL, "Heimdall", X1_HEIMDALL_R7, 30), ("q2", META, "Meta", X1_META_R7, 29), ("q3", META, "Meta", "go ahead and post it", 40), ("q4", META, "Meta", "go ahead", -5)];
|
||||
let (after, applied) = apply(&state, &hearing(&heard, listed.clone(), json!([hold_release("h2", Evidence::Heard("q1".into())), hold_release("h1", Evidence::Heard("q1".into()))])), "x", "r1-t20", now());
|
||||
assert_eq!((after["holds"][1]["status"].as_str(), after["holds"][1]["releasedBy"].clone(), reasons(&applied)), (Some("released"), json!({ "act": "heard", "event": "$q1" }), vec![json!("release_not_by_asker")]), "{applied:?}");
|
||||
assert_eq!(after["holds"][0]["status"], "open");
|
||||
let (kept, _) = apply(&state, &hearing(&heard, listed.clone(), json!([])), "x", "r1-t20", now());
|
||||
assert_eq!(kept["holds"][0]["status"], "open", "Meta's \"keep holding it\" releases nothing");
|
||||
assert_eq!(apply(&state, &hearing(&heard, listed.clone(), json!([hold_release("h1", Evidence::Heard("q3".into()))])), "x", "r1-t21", now()).0["holds"][0]["status"], "released");
|
||||
assert_eq!(reasons(&apply(&state, &hearing(&heard, listed, json!([hold_release("h1", Evidence::Heard("q4".into()))])), "x", "r1-t21", now()).1), vec![json!("release_before_hold")]);
|
||||
}
|
||||
|
||||
/// K39 (map 16.29.3): nothing of her prose releases a hold, a passage that records the asker letting it go included; the
|
||||
/// asker's own line does, once.
|
||||
#[test]
|
||||
fn k39_a_release_by_her_prose_is_not_accepted() {
|
||||
let (state, listed) = x1_holding();
|
||||
let prose = "Meta said go ahead, so it's no longer held. <typed>Posting both lines now.</typed>";
|
||||
let (after, applied) = apply(&state, &hearing(&[], listed.clone(), json!([hold_release("h1", Evidence::Prose("Meta said go ahead, so it's no longer held".into()))])), prose, "r1-t22", now());
|
||||
assert_eq!((after["holds"][0]["status"].as_str(), applied.unheld.len(), reasons(&applied)), (Some("open"), 0, vec![json!("evidence_not_accepted")]), "{applied:?}");
|
||||
// A released hold is released once.
|
||||
let heard = [("q3", META, "Meta", "go ahead and post it", 40)];
|
||||
let (after, _) = apply(&state, &hearing(&heard, listed.clone(), json!([hold_release("h1", Evidence::Heard("q3".into()))])), prose, "r1-t22", now());
|
||||
assert_eq!(reasons(&apply(&after, &hearing(&heard, listed, json!([hold_release("h1", Evidence::Heard("q3".into()))])), prose, "r1-t23", now()).1), vec![json!("no_such_hold")]);
|
||||
}
|
||||
|
||||
/// A released hold is removed `CLOSED_KEPT_DAYS` after its release; an open one stays.
|
||||
#[test]
|
||||
fn k37_a_released_hold_is_pruned_an_open_one_is_not() {
|
||||
let (mut state, _) = x1_holding();
|
||||
state["holds"][0]["madeAt"] = json!((now() - Duration::days(30)).to_rfc3339());
|
||||
state["holds"][1]["status"] = json!("released");
|
||||
state["holds"][1]["releasedAt"] = json!((now() - Duration::days(CLOSED_KEPT_DAYS + 1)).to_rfc3339());
|
||||
let (after, applied) = apply(&state, &hearing(&[], json!([]), json!([])), "x", "r1-t30", now());
|
||||
assert_eq!((after["holds"].as_array().map(Vec::len), after["holds"][0]["id"].as_str(), applied.pruned), (Some(1), Some("h-1"), 1));
|
||||
}
|
||||
|
||||
/// Self's ruling on K36 finding 1: after a reopen, a keep counts only reads that returned after it. F.2 reopened with
|
||||
/// its need still #85: a re-keep on this conversation's #85 read, or on a receipt from before the reopen, is refused
|
||||
|
|
@ -1054,21 +952,6 @@ fn k40_an_outside_close_is_not_hers_to_reopen() {
|
|||
assert_eq!(f2_r9(&amended, json!([reopening(F2_R9_WORDS, None, true)])).0["commitments"][0]["status"], "open");
|
||||
}
|
||||
|
||||
/// K51 (map 16.31.3): the commit carries the decision's `carry` and nothing else: each entry once, on the hold its handle
|
||||
/// names. A `Held` refusal is one fate of an unsent draft, never how a text becomes carried, so a refusal alone carries
|
||||
/// nothing (this pins the reason filter put back in `carry_held`). A handle no open hold answers carries nothing, and is
|
||||
/// reported.
|
||||
#[test]
|
||||
fn k51_carry_reads_the_decision_carry_and_nothing_else() {
|
||||
let (state, listed) = x1_holding();
|
||||
let carry = |hold: &str, text: &str| json!({ "hold": hold, "text": text });
|
||||
let mut record = hearing(&[], listed, json!([]));
|
||||
record["interpreter"]["carry"] = json!([carry("h1", "One."), carry("h1", "Two."), carry("h1", "One."), carry("h9", "Lost.")]);
|
||||
record["interpreter"]["refused"] = json!([{ "act": "say", "draft": 1, "reason": "held", "text": "Refused only.", "holds": [{ "who": "Meta", "id": "h2" }] }]);
|
||||
let (after, applied) = apply(&state, &record, "x", "r1-t4", now());
|
||||
assert_eq!((after["holds"][0]["carries"].clone(), after["holds"][1].get("carries"), applied.held_unrecorded.clone(), applied.carries_full.len()), (json!(["One.", "Two."]), None, vec![carry("h9", "Lost.")], 0), "{after}");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// K64 (map 16.33.5): a promise never needs a read the body will refuse.
|
||||
|
||||
|
|
|
|||
|
|
@ -47,16 +47,7 @@ impl Scripted {
|
|||
pub(crate) fn drafted_lines(prompt: &str) -> String {
|
||||
let numbered = prompt.rsplit("drafts, by number:\n").next().unwrap_or_default();
|
||||
let say: Vec<Value> = (1..).take_while(|n| numbered.lines().any(|line| line.starts_with(&format!("{n}. ")))).map(|n| json!({ "draft": n, "mentions": [], "in_reply_to": null })).collect();
|
||||
// Every line the prompt marks said to her asks her to hold nothing (K59), and every line is clear of every hold listed
|
||||
// (K60).
|
||||
let no_hold: Vec<&str> = prompt.lines().filter_map(|line| line.strip_prefix("- ")?.split_once(" (said to ")).map(|(id, _)| id).filter(|id| !id.contains(' ')).collect();
|
||||
let holds = prompt.split("\nHolds:\n").nth(1).unwrap_or_default();
|
||||
let clear_of: Vec<&str> = holds.lines().take_while(|line| !line.is_empty()).filter_map(|line| line.strip_prefix("- ")?.split_once(" \u{2014} ")).map(|(id, _)| id).collect();
|
||||
let say: Vec<Value> = say.into_iter().map(|mut line| {
|
||||
line["clear_of"] = json!(clear_of);
|
||||
line
|
||||
}).collect();
|
||||
json!({ "say": say, "gaps": [], "no_hold": no_hold }).to_string()
|
||||
json!({ "say": say, "gaps": [] }).to_string()
|
||||
}
|
||||
|
||||
impl Model for Scripted {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load diff
|
|
@ -205,7 +205,6 @@ pub(crate) struct Posted {
|
|||
pub room: String,
|
||||
pub text: String,
|
||||
/// When it went out, in ms: the receipt's own time, else the decision's (`at_ms`); none when the record has neither.
|
||||
/// What a hold measures her listed lines against (K51).
|
||||
pub at_ms: Option<u64>,
|
||||
}
|
||||
|
||||
|
|
@ -282,14 +281,6 @@ enum Part {
|
|||
/// A draft she chose not to send (`unsent`, declined): it did not go out, and the thought the Interpreter cited as her
|
||||
/// choice is shown beside it, so a misread decline is a record she can see (map 16.26, 16.29.2).
|
||||
Declined { room: Option<String>, text: Words, thought: Words, reach: bool },
|
||||
/// A draft code did not send because someone asked her to hold what it carries there (`Held`, map 16.28.5): each who
|
||||
/// asked (K56).
|
||||
/// Their words are in her "Held for others" view, never here (map 16.29.3). `text` is her draft, kept only so that
|
||||
/// `settle` can check it against the receipts (K49); it is never rendered.
|
||||
HeldFor { room: Option<String>, askers: Vec<Person>, text: Words, reach: bool },
|
||||
/// Words of hers a receipt shows in a room a hold covers, from a draft code refused `Held` (K45): a broken hold, told
|
||||
/// so that a leak by any path is a record she sees, never an omission. Who asked; never the words.
|
||||
HoldBroken { room: String, askers: Vec<Person> },
|
||||
/// A read she performed (map 16.22.3): what, in code's words; never its content, which is in her view while the
|
||||
/// conversation lasts (K26), and no sentence about what she lacks.
|
||||
Read { what: ReadName },
|
||||
|
|
@ -317,8 +308,6 @@ pub(crate) struct Outcome {
|
|||
/// What the record held that she is not told, and why: reported, never shown to her.
|
||||
pub omitted: Vec<String>,
|
||||
pub posted: Vec<Posted>,
|
||||
/// The held drafts a receipt shows in a room their hold covers (K45): told as `HoldBroken`, and reported here.
|
||||
pub hold_broken: Vec<String>,
|
||||
}
|
||||
|
||||
fn words(value: &Value) -> Option<String> {
|
||||
|
|
@ -390,15 +379,6 @@ pub(crate) fn outcome_of(record: &Value, names: &Names) -> Option<Outcome> {
|
|||
outcome.parts.push(Part::NotAmended { refusal: None, room: room.clone(), added, reach: false });
|
||||
}
|
||||
(Ok(reason @ (Refusal::Private | Refusal::SecondNote)), Some(_)) => outcome.parts.push(Part::NoteRefused(reason)),
|
||||
// A `Held` refusal is always told (K45), and rows with the same text once.
|
||||
(Ok(Refusal::Held), Some(text)) => match outcome.parts.iter().position(|part| matches!(part, Part::HeldFor { room: held, text: told, .. } if *held == room && *told == text)) {
|
||||
Some(told) => rows.push((&refusal["draft"], told)),
|
||||
None => {
|
||||
let askers = refusal["holds"].as_array().into_iter().flatten().filter_map(|hold| person(&hold["who"], &hold["by_id"])).collect();
|
||||
rows.push((&refusal["draft"], at));
|
||||
outcome.parts.push(Part::HeldFor { room: room.clone(), askers, text, reach: false });
|
||||
}
|
||||
},
|
||||
_ => outcome.omitted.push(format!("a refusal she is not told ({}): {}", refusal["reason"], refusal["why"])),
|
||||
}
|
||||
}
|
||||
|
|
@ -583,9 +563,8 @@ pub(crate) fn outcome_of(record: &Value, names: &Names) -> Option<Outcome> {
|
|||
|
||||
/// The one owner of "reached" (K49, I16.10): every row that says words of hers did not reach a room is checked against
|
||||
/// the receipts, by the row's own room and text, here and nowhere else. A posted line there, or an addition there whose
|
||||
/// `edited` receipt has no refusal, means her words reached it, so the row would be false: it is omitted and reported,
|
||||
/// except a held draft, which is told as a broken hold (K45) and reported. Rows that are receipts (`Said`, `Promise`,
|
||||
/// `Amended`) are untouched.
|
||||
/// `edited` receipt has no refusal, means her words reached it, so the row would be false: it is omitted and reported.
|
||||
/// Rows that are receipts (`Said`, `Promise`, `Amended`) are untouched.
|
||||
fn settle(outcome: &mut Outcome, receipts: &[Posted], record: &Value) {
|
||||
let added = |room: &str, text: &Words| {
|
||||
record["interpreter"]["amended"].as_array().into_iter().flatten().any(|amended| {
|
||||
|
|
@ -598,23 +577,7 @@ fn settle(outcome: &mut Outcome, receipts: &[Posted], record: &Value) {
|
|||
outcome.parts.push(part);
|
||||
continue;
|
||||
};
|
||||
match part {
|
||||
Part::HeldFor { askers, .. } => {
|
||||
outcome.hold_broken.push(format!("{room}: {text}"));
|
||||
outcome.parts.push(Part::HoldBroken { room, askers });
|
||||
}
|
||||
part => outcome.omitted.push(format!("a {} of words a receipt shows reached {room}: {text}", part.row())),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Each person in `people`, in this form, as one name: "A", "A and B", "A, B and C"; someone, when the record names no one.
|
||||
fn named(form: Form, people: &[Person]) -> String {
|
||||
let names: Vec<String> = people.iter().map(|person| form.person(person)).collect();
|
||||
match names.split_last() {
|
||||
None => "someone".to_owned(),
|
||||
Some((last, [])) => last.clone(),
|
||||
Some((last, rest)) => format!("{} and {last}", rest.join(", ")),
|
||||
outcome.omitted.push(format!("a {} of words a receipt shows reached {room}: {text}", part.row()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -632,14 +595,14 @@ impl Part {
|
|||
/// Whether a reach she cannot do names this row's draft (K63).
|
||||
fn reaches(&self) -> bool {
|
||||
match self {
|
||||
Self::Refused { reach, .. } | Self::Gap { reach, .. } | Self::NotAmended { reach, .. } | Self::Declined { reach, .. } | Self::HeldFor { reach, .. } => *reach,
|
||||
Self::Refused { reach, .. } | Self::Gap { reach, .. } | Self::NotAmended { reach, .. } | Self::Declined { reach, .. } => *reach,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
/// Tells this draft's row that a reach she cannot do names it (K63).
|
||||
fn add_reach(&mut self) {
|
||||
if let Self::Refused { reach, .. } | Self::Gap { reach, .. } | Self::NotAmended { reach, .. } | Self::Declined { reach, .. } | Self::HeldFor { reach, .. } = self {
|
||||
if let Self::Refused { reach, .. } | Self::Gap { reach, .. } | Self::NotAmended { reach, .. } | Self::Declined { reach, .. } = self {
|
||||
*reach = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -648,7 +611,7 @@ impl Part {
|
|||
/// receipts. None for a row that is a receipt, or that carries no words of hers.
|
||||
fn own_words(&self) -> Option<(Option<&str>, &Words)> {
|
||||
match self {
|
||||
Self::Refused { room, text, .. } | Self::Unfinished { room, text, .. } | Self::Declined { room, text, .. } | Self::HeldFor { room, text, .. } => Some((room.as_deref(), text)),
|
||||
Self::Refused { room, text, .. } | Self::Unfinished { room, text, .. } | Self::Declined { room, text, .. } => Some((room.as_deref(), text)),
|
||||
Self::Gap { room, quote: Quote::Wrote(text), .. } => Some((room.as_deref(), text)),
|
||||
Self::NotAmended { room, added, .. } => Some((room.as_deref(), added)),
|
||||
_ => None,
|
||||
|
|
@ -662,7 +625,6 @@ impl Part {
|
|||
Self::Gap { .. } => "gap",
|
||||
Self::Unfinished { .. } => "unfinished draft",
|
||||
Self::Declined { .. } => "declined draft",
|
||||
Self::HeldFor { .. } => "held draft",
|
||||
Self::NotAmended { .. } => "unmade addition",
|
||||
_ => "row",
|
||||
}
|
||||
|
|
@ -673,7 +635,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::NotAmended { .. } | Self::NoteRefused(_) | Self::NowUndone { .. } | 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,
|
||||
|
|
@ -706,12 +668,11 @@ impl Part {
|
|||
},
|
||||
Self::Refused { reason: Refusal::Echo, room, .. } | Self::Gap { kind: GapKind::Unwritten | GapKind::Unresolved, room, .. } => format!("Nothing reached {}.", place(room)),
|
||||
Self::Refused { reason: Refusal::NoRoom, .. } => "Nothing reached anyone.".to_owned(),
|
||||
Self::Refused { room, .. } | Self::Unfinished { room, .. } | Self::Declined { room, .. } | Self::HeldFor { room, .. } => format!("Nothing of this reached {}:", place(room)),
|
||||
Self::Refused { room, .. } | Self::Unfinished { room, .. } | Self::Declined { room, .. } => format!("Nothing of this reached {}:", place(room)),
|
||||
Self::Gap { kind: GapKind::Addressee | GapKind::Elsewhere, .. } => "Nothing reached anyone.".to_owned(),
|
||||
Self::Gap { kind: GapKind::MissingAffordance, .. } => "Nothing happened.".to_owned(),
|
||||
Self::NotAmended { refusal: None, room, .. } => format!("Nothing changed, and nothing reached {}:", place(room)),
|
||||
Self::NotAmended { refusal: Some(_), room, .. } => format!("Nothing changed in {}:", place(room)),
|
||||
Self::HoldBroken { room, askers } => format!("{} has words {subj} wrote that {} asked {obj} to hold there.", capitalized(room), named(form, askers)),
|
||||
Self::NoteRefused(Refusal::SecondNote) => "No second note was left:".to_owned(),
|
||||
Self::NoteRefused(_) => "No note was left:".to_owned(),
|
||||
Self::Failed => format!("Nothing reached the room, and nothing {subj} meant last time happened:"),
|
||||
|
|
@ -780,8 +741,6 @@ impl Part {
|
|||
Self::Unfinished { text, by_limit: false, .. } => format!(" the turn ended before {subj} finished writing it.{}", drafted(text)),
|
||||
Self::Unfinished { text, by_limit: true, .. } => format!(" the length limit cut it before {subj} finished writing it.{}", drafted(text)),
|
||||
Self::Declined { text, thought, .. } => format!(" {subj} chose not to send it.{}{}", shown(&Quote::Thought(thought.clone())), drafted(text)),
|
||||
Self::HeldFor { askers, .. } => format!(" {} asked {obj} to hold it, and it was not sent.{reach}", named(form, askers)),
|
||||
Self::HoldBroken { .. } => String::new(),
|
||||
Self::NotAmended { refusal: None, added, .. } => format!(" the line {subj} meant to add to is not one {subj} can add to here.{}", drafted(added)),
|
||||
Self::NotAmended { refusal: Some(refusal), added, .. } => {
|
||||
let why = match refusal {
|
||||
|
|
|
|||
|
|
@ -292,12 +292,12 @@ fn k43_her_words_are_told_verbatim_whatever_the_record_heard() {
|
|||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// K33 (map 16.26): a refused close and a held draft are told, by the fixed table.
|
||||
// K33 (map 16.26): a refused close and a declined draft are told, by the fixed table.
|
||||
|
||||
/// L1: each refused close she can correct is told as her record still showing the promise, and why; L4: a held draft is
|
||||
/// told as not sent.
|
||||
/// L1: each refused close she can correct is told as her record still showing the promise, and why; L4: a declined draft
|
||||
/// is told as not sent.
|
||||
#[test]
|
||||
fn k33_a_refused_close_and_a_held_draft_are_told() {
|
||||
fn k33_a_refused_close_and_a_declined_draft_are_told() {
|
||||
let listed = json!([
|
||||
{ "id": "c1", "entry": "e1", "status": "open", "to": "@deru:gamecult.org", "to_name": "Deru", "words": "I'll read it properly.", "needs": { "kind": "read", "request": { "kind": "web", "target": "https://ccrma.stanford.edu/~jos/pasp/" } } },
|
||||
{ "id": "c2", "entry": "e2", "status": "open", "to": "@meta:gamecult.org", "to_name": "Meta", "words": "I'll look at #125.", "needs": null },
|
||||
|
|
@ -337,7 +337,7 @@ fn posted_as_said(decision: &Value) -> Vec<Value> {
|
|||
#[test]
|
||||
fn k49_p4_a_gap_on_words_that_went_out_is_not_told() {
|
||||
let prose = "<typed>Morning, all of you.</typed> <typed>Morning, all of you.</typed>";
|
||||
let decision = answered(&packet(), prose, json!({ "say": [{ "draft": 2, "mentions": [], "in_reply_to": null, "holds": [], "promises": [] }], "gaps": [{ "kind": "addressee", "draft": 1, "quote": null, "detail": "" }] }));
|
||||
let decision = answered(&packet(), prose, json!({ "say": [{ "draft": 2, "mentions": [], "in_reply_to": null, "promises": [] }], "gaps": [{ "kind": "addressee", "draft": 1, "quote": null, "detail": "" }] }));
|
||||
let outcome = outcome_of(&json!({ "interpreter": decision, "posted": posted_as_said(&decision), "edited": [] }), &crate::projection::select::Names::none()).unwrap();
|
||||
assert_eq!(outcome.lines(packet().forms), ["- #minds:gamecult.org has, from him: \"Morning, all of you.\"."]);
|
||||
assert!(outcome.omitted.iter().any(|why| why == "a gap of words a receipt shows reached #minds:gamecult.org: Morning, all of you."), "{:?}", outcome.omitted);
|
||||
|
|
@ -408,7 +408,6 @@ fn k49_every_row_with_words_is_settled_by_its_room() {
|
|||
("unfinished draft", decision(json!({ "unfinished": SENTINEL }))),
|
||||
("unfinished draft", decision(json!({ "cut_by_cap": [SENTINEL] }))),
|
||||
("declined draft", decision(json!({ "unsent": [{ "draft": 1, "how": "declined", "quote": "I keep it back", "words": SENTINEL }] }))),
|
||||
("held draft", decision(json!({ "refused": [{ "reason": "held", "text": SENTINEL, "draft": 1, "holds": [{ "who": "Meta" }] }] }))),
|
||||
("unmade addition", decision(json!({ "refused": [{ "reason": "not_amendable", "text": SENTINEL, "draft": 1 }] }))),
|
||||
];
|
||||
for (row, decision) in rows {
|
||||
|
|
@ -416,12 +415,7 @@ fn k49_every_row_with_words_is_settled_by_its_room() {
|
|||
let here = at(MINDS);
|
||||
let not_reached = |outcome: &Outcome| outcome.lines(packet().forms).into_iter().filter(|line| line.starts_with("- Nothing")).count();
|
||||
assert_eq!(not_reached(&here), 0, "{row}: {:?}", here.lines(packet().forms));
|
||||
if row == "held draft" {
|
||||
// K45: a held draft that reached its room is a broken hold, told and reported, never omitted.
|
||||
assert_eq!(here.hold_broken, [format!("{MINDS}: {SENTINEL}")], "{row}: {:?}", here.omitted);
|
||||
} else {
|
||||
assert!(here.omitted.iter().any(|why| why == &format!("a {row} of words a receipt shows reached {MINDS}: {SENTINEL}")), "{row}: {:?}", here.omitted);
|
||||
}
|
||||
assert!(here.omitted.iter().any(|why| why == &format!("a {row} of words a receipt shows reached {MINDS}: {SENTINEL}")), "{row}: {:?}", here.omitted);
|
||||
let elsewhere = at(SWARM);
|
||||
assert_eq!(not_reached(&elsewhere), 1, "{row}: {:?}", elsewhere.lines(packet().forms));
|
||||
assert!(!elsewhere.omitted.iter().any(|why| why.contains("a receipt shows reached")), "{row}: {:?}", elsewhere.omitted);
|
||||
|
|
@ -436,44 +430,6 @@ fn k49_reached_is_decided_once() {
|
|||
assert!(!own.contains("let reached = |text: &str|"), "no loop-local reached check");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// K45 (map 16.30.2): a `Held` refusal is never omitted; its words reaching a room its hold covers are a broken hold.
|
||||
|
||||
/// A record with a `held` refusal and a receipt of its words in #minds, which the hold covers: she is told the hold was
|
||||
/// broken, by whom it was asked, and it is reported. One decision cannot produce it after K45; the row exists so that a
|
||||
/// leak by any other path is a record she sees. This replaces `k44_a_refusal_of_words_a_receipt_shows_is_not_told_as_unsent`.
|
||||
#[test]
|
||||
fn k45_a_broken_hold_is_told() {
|
||||
let text = "Hello, and welcome, we're glad you're here.";
|
||||
let record = |room: &str| json!({
|
||||
"interpreter": { "room": MINDS, "said": [], "gaps": [], "amended": [], "refused": [{ "act": "say", "draft": 1, "reason": "held", "text": text, "holds": [{ "who": "Meta", "by_id": "@meta:gamecult.org", "id": "h1" }] }] },
|
||||
"posted": [{ "event": "40", "room": room, "text": text }],
|
||||
"edited": [],
|
||||
});
|
||||
// Meta, as his bond names the operator (K53).
|
||||
let state = json!({ "affect": { "socialBonds": [{ "id": "bond-meta", "status": "active", "object": { "id": "operator", "kind": "person", "label": "Meta" } }] } });
|
||||
let operators = ["@meta:gamecult.org".to_owned()];
|
||||
let names = crate::projection::select::Names { state: &state, people: crate::projection::select::People { operators: &operators, minds: &[], own_sender: "@heimdall:gamecult.org" }, room: &crate::projection::select::Room::default() };
|
||||
let broken = outcome_of(&record(MINDS), &names).unwrap();
|
||||
assert_eq!(broken.lines(packet().forms)[0], "- #minds:gamecult.org has words he wrote that Meta asked him to hold there.", "{:?}", broken.lines(packet().forms));
|
||||
assert_eq!(broken.hold_broken, [format!("{MINDS}: {text}")]);
|
||||
assert!(!broken.lines(packet().forms).iter().any(|line| line.contains("not sent")), "never told as unsent");
|
||||
assert_eq!(broken.event(0, packet().forms, &[]), broken.told(0, packet().forms, usize::MAX), "it carries no words of hers or anyone's");
|
||||
// Negative: posted elsewhere, the hold is told as held, and nothing is broken.
|
||||
let held = outcome_of(&record(SWARM), &crate::projection::select::Names::none()).unwrap();
|
||||
assert!(held.lines(packet().forms).iter().any(|line| line == "- Nothing of this reached #minds:gamecult.org: Meta asked him to hold it, and it was not sent.") && held.hold_broken.is_empty(), "{:?}", held.lines(packet().forms));
|
||||
}
|
||||
|
||||
/// K45: a `Held` refusal is always told, and two with the same text once.
|
||||
#[test]
|
||||
fn k45_a_held_refusal_is_never_omitted_and_told_once_by_its_text() {
|
||||
let refused = |draft: u64, text: &str| json!({ "act": "say", "draft": draft, "reason": "held", "text": text, "holds": [{ "who": "Meta", "id": "q3" }] });
|
||||
let record = json!({ "interpreter": { "room": MINDS, "said": [], "gaps": [], "amended": [], "refused": [refused(1, "Same words."), refused(2, "Same words."), refused(3, "Other words.")] }, "posted": [], "edited": [] });
|
||||
let outcome = outcome_of(&record, &crate::projection::select::Names::none()).unwrap();
|
||||
assert_eq!(outcome.len(), 2, "{:?}", outcome.lines(packet().forms));
|
||||
assert!(outcome.omitted.is_empty(), "{:?}", outcome.omitted);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// K46 (map 16.30.3): the Projector's outcome line has no text slot.
|
||||
|
||||
|
|
@ -496,15 +452,13 @@ fn variant(part: &Part) -> &'static str {
|
|||
Part::StillOpen { .. } => "still_open",
|
||||
Part::NowUndone { .. } => "now_undone",
|
||||
Part::Declined { .. } => "declined",
|
||||
Part::HeldFor { .. } => "held_for",
|
||||
Part::HoldBroken { .. } => "hold_broken",
|
||||
Part::Read { .. } => "read",
|
||||
Part::ReadFailed { .. } => "read_failed",
|
||||
Part::ReadRefused { .. } => "read_refused",
|
||||
}
|
||||
}
|
||||
|
||||
const VARIANTS: usize = 20;
|
||||
const VARIANTS: usize = 18;
|
||||
|
||||
const STRANGER: &str = "@stranger:example.org";
|
||||
|
||||
|
|
@ -583,9 +537,6 @@ fn fixtures(s: &str, who: &Person) -> Vec<(Part, bool)> {
|
|||
out.push((Part::NowUndone { to: None, words: 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));
|
||||
out.push((Part::HeldFor { room: room(), askers: vec![who.clone()], text: w(), reach: true }, false));
|
||||
out.push((Part::HoldBroken { room: MINDS.into(), askers: vec![who.clone()] }, false));
|
||||
for (request, shows) in [
|
||||
(ReadRequest::Web(format!("https://example.org/{s}")), true),
|
||||
(ReadRequest::Repo(format!("GameCult/Bifrost?q={s} plover")), true),
|
||||
|
|
@ -648,7 +599,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::NowUndone { to: Some(_), .. });
|
||||
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 } }));
|
||||
|
|
@ -659,9 +610,6 @@ fn k53_every_part_names_by_who() {
|
|||
assert_eq!(told.contains(&format!("\"{NAME}\" ({STRANGER})")), names_someone(part), "{pronouns}: {told}");
|
||||
}
|
||||
}
|
||||
// A bonded person is named by her bond, whatever their display name says.
|
||||
let bonded = Part::HoldBroken { room: MINDS.into(), askers: vec![person(NAME, Some("Kestrel, the harbour pilot"))] };
|
||||
assert_eq!(bonded.event(crate::projection::select::forms(&json!({})), &[]), "- #minds:gamecult.org has words they wrote that Kestrel, the harbour pilot asked them to hold there.");
|
||||
}
|
||||
|
||||
/// K46: `Words` has no `Display`, `AsRef<str>` or `Deref`, so no format string and no `&str` borrow reads one; only
|
||||
|
|
@ -704,23 +652,17 @@ fn reach_on_1(text: &str) -> Value {
|
|||
fn k63_a_reach_is_a_clause_of_its_drafts_row() {
|
||||
let text = "I'll send the render tonight.";
|
||||
let clause = format!("It reaches for something he has no way to do from here. He had drafted: \"{text}\".");
|
||||
let refused = |reason: &str| json!({ "interpreter": { "room": MINDS, "said": [], "refused": [{ "act": "say", "draft": 1, "text": text, "reason": reason, "holds": [{ "who": "Meta", "id": "h1" }] }], "gaps": [reach_on_1(text)] }, "posted": [] });
|
||||
let refused = |reason: &str| json!({ "interpreter": { "room": MINDS, "said": [], "refused": [{ "act": "say", "draft": 1, "text": text, "reason": reason }], "gaps": [reach_on_1(text)] }, "posted": [] });
|
||||
for (reason, row) in [("over_lines", "he had already sent two lines that turn."), ("undecided", "what was to become of it was never settled, so it was not sent."), ("not_quotable", "the line he meant to reply to is not one he can reply to here.")] {
|
||||
let (lines, omitted) = told(&refused(reason));
|
||||
assert_eq!(lines, [format!("- Nothing of this reached #minds:gamecult.org: {row} {clause}")], "{reason}: {omitted:?}");
|
||||
}
|
||||
// A held draft shows none of its words; the clause is still its own.
|
||||
assert_eq!(told(&refused("held")).0, ["- Nothing of this reached #minds:gamecult.org: Meta asked him to hold it, and it was not sent. It reaches for something he has no way to do from here."]);
|
||||
// An echo shows none either.
|
||||
assert_eq!(told(&refused("echo")).0, ["- Nothing reached #minds:gamecult.org. What he wrote was mostly the words he had just been sent, so none of it was sent. It reaches for something he has no way to do from here."]);
|
||||
let declined = json!({ "interpreter": { "room": MINDS, "said": [], "refused": [], "gaps": [reach_on_1(text)], "unsent": [{ "draft": 1, "how": "declined", "words": text, "quote": "Not tonight after all" }] }, "posted": [] });
|
||||
assert_eq!(told(&declined).0, [format!("- Nothing of this reached #minds:gamecult.org: he chose not to send it. In his thought: \"Not tonight after all\". {clause}")]);
|
||||
let elsewhere = json!({ "interpreter": { "room": MINDS, "said": [], "refused": [], "gaps": [reach_on_1(text), { "kind": "elsewhere", "from": "draft", "draft": 1, "words": text }] }, "posted": [] });
|
||||
assert_eq!(told(&elsewhere).0, [format!("- Nothing reached anyone. He meant this for another room or another time, and nothing carries it there; it arrives only if he sends it there. {clause}")]);
|
||||
// Two held refusals of one text are one row, and a reach on either is its clause.
|
||||
let twice = json!({ "interpreter": { "room": MINDS, "said": [], "refused": [{ "act": "say", "draft": 2, "text": text, "reason": "held", "holds": [] }, { "act": "say", "draft": 1, "text": text, "reason": "held", "holds": [] }], "gaps": [reach_on_1(text)] }, "posted": [] });
|
||||
let lines = told(&twice).0;
|
||||
assert!(lines.len() == 1 && lines[0].ends_with("It reaches for something he has no way to do from here."), "{lines:?}");
|
||||
}
|
||||
|
||||
/// A reach naming a draft no row tells (superseded) is its own row, as one she had drafted; a reach naming a line that went
|
||||
|
|
|
|||
|
|
@ -340,8 +340,6 @@ pub(crate) struct Packet {
|
|||
/// Her promises the packet shows her, open and closed in this conversation, for the Interpreter's list (map 16.22.1,
|
||||
/// 16.28.3).
|
||||
pub promises: Vec<Promised>,
|
||||
/// The open holds others asked of her, for the Interpreter's list by id (map 16.28.5).
|
||||
pub holds: Vec<Hold>,
|
||||
/// The lines of her domain the packet shows her, for the Interpreter's view by id (map 16.22.2).
|
||||
pub domain: Vec<DomainLine>,
|
||||
/// The window the domain section shows and what it left out: the report's, never a model's.
|
||||
|
|
@ -350,7 +348,7 @@ pub(crate) struct Packet {
|
|||
/// verbatim; her open promises; then her domain, rendered by code, whole and without ids, for the Persona after the
|
||||
/// narration. Never the Projector's.
|
||||
pub in_view: String,
|
||||
/// Her promises and her holds took more than `promises_bytes`: every one is still shown, and the report says so.
|
||||
/// Her promises took more than `promises_bytes`: every one is still shown, and the report says so.
|
||||
pub promises_over: bool,
|
||||
/// When the turn is, unix ms: when the lines she posts this turn were written.
|
||||
pub now_ms: u64,
|
||||
|
|
@ -373,9 +371,6 @@ pub(crate) struct Amendable {
|
|||
pub event: String,
|
||||
pub room: String,
|
||||
pub text: String,
|
||||
/// When it went out, in ms, when the record says (`Posted.at_ms`): a hold's words gate counts it only when it is
|
||||
/// later than the hold (K51), and counts it when the time is unknown.
|
||||
pub at_ms: Option<u64>,
|
||||
}
|
||||
|
||||
/// A line of someone else's she may reply to (K20): one this packet shows her, in the turn's room. The Interpreter cites it
|
||||
|
|
@ -391,9 +386,6 @@ pub(crate) struct Quotable {
|
|||
pub sender: String,
|
||||
pub at_ms: u64,
|
||||
pub text: String,
|
||||
/// Said to her this turn: one of the chat turn's new lines to her, which her stimulus lists under "Said to {her}". The
|
||||
/// answer judges each for a hold (K59, map 16.33.5): it opens one, or is listed in `no_hold`.
|
||||
pub to_her: bool,
|
||||
}
|
||||
|
||||
/// A promise of hers as this packet lists it (map 16.22.1, 16.28.3): for the Interpreter, by `id` (`c1`, `c2`), to propose a
|
||||
|
|
@ -420,26 +412,6 @@ pub(crate) struct Promised {
|
|||
pub held: Value,
|
||||
}
|
||||
|
||||
/// An open hold as this packet lists it (map 16.28.5): for the Interpreter, by `id` (`h1`, `h2`), for a draft to name or a
|
||||
/// release to cite; `entry` is the state's id, never shown to a model; `held` the hold whole as the turn began, which the
|
||||
/// commit holds a release against (4.4).
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize)]
|
||||
pub(crate) struct Hold {
|
||||
pub id: String,
|
||||
pub entry: String,
|
||||
/// Who asked, by Matrix id and as the packet names them.
|
||||
pub from: String,
|
||||
pub from_name: String,
|
||||
/// The room it covers; none for anywhere.
|
||||
pub room: Option<String>,
|
||||
pub made: DateTime<Utc>,
|
||||
/// The asker's words naming what is held and where; none when the record could not quote them (K47).
|
||||
pub words: Option<String>,
|
||||
/// Her own drafts she did not send while it was open (map 16.31.3, K51), oldest first: what code's words gate holds.
|
||||
pub carries: Vec<String>,
|
||||
pub held: Value,
|
||||
}
|
||||
|
||||
/// A line of her domain as this packet shows it (map 16.22.2): by `id` (`d1`, `d2`) in the Interpreter's view only, so a
|
||||
/// read can name it (16.22.3).
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize)]
|
||||
|
|
@ -1065,11 +1037,6 @@ impl Addressed<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Whether a line is said to her this turn (K59): a chat turn's new message to her, never an earlier line of the room's.
|
||||
fn said_to_her_now(inputs: &Inputs, line: &RoomLine) -> bool {
|
||||
inputs.kind == TurnKind::Chat && line.to_her && inputs.room.messages.iter().any(|new| new.event == line.event)
|
||||
}
|
||||
|
||||
fn said_to_her<'a>(to_her: &[&'a RoomLine], render: impl Fn(&RoomLine, &str) -> String, ceiling: usize) -> Addressed<'a> {
|
||||
let mut shown: Vec<(&RoomLine, Option<usize>)> = Vec::new();
|
||||
let mut used = 0;
|
||||
|
|
@ -2024,55 +1991,6 @@ fn open_promises(inputs: &Inputs, her: Forms) -> (Vec<Promised>, String) {
|
|||
(shown, block)
|
||||
}
|
||||
|
||||
/// Her holds in her view (map 16.28.5): every open hold in her state's `holds`, oldest first, whole, never dropped, as her
|
||||
/// promises are; and the Interpreter's list of them, by id. State in code's words, with no pronoun of hers: the Persona's
|
||||
/// frame says nothing of them.
|
||||
fn holds_in_view(inputs: &Inputs) -> (Vec<Hold>, String) {
|
||||
let mut open: Vec<(DateTime<Utc>, &Value)> = items(inputs.state, &["holds"])
|
||||
.iter()
|
||||
.filter(|hold| text(hold, &["status"]) == "open")
|
||||
.map(|hold| (DateTime::parse_from_rfc3339(text(hold, &["madeAt"])).map_or(inputs.now, |at| at.with_timezone(&Utc)), hold))
|
||||
.collect();
|
||||
open.sort_by_key(|(at, _)| *at);
|
||||
let listed: Vec<Hold> = open
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(at, (made, hold))| Hold {
|
||||
id: format!("h{}", at + 1),
|
||||
entry: text(hold, &["id"]).to_owned(),
|
||||
from: text(hold, &["from"]).to_owned(),
|
||||
from_name: sender_name(text(hold, &["from"]), inputs),
|
||||
room: hold["room"].as_str().map(str::to_owned),
|
||||
made: *made,
|
||||
words: hold["words"].as_str().map(str::trim).filter(|words| !words.is_empty()).map(str::to_owned),
|
||||
carries: items(hold, &["carries"]).iter().filter_map(Value::as_str).map(str::to_owned).collect(),
|
||||
held: (*hold).clone(),
|
||||
})
|
||||
.collect();
|
||||
if listed.is_empty() {
|
||||
return (listed, String::new());
|
||||
}
|
||||
// Each hold, then what she has held for it, in her own words (K45): her view only, which I16.7 does not bind.
|
||||
let lines: Vec<String> = listed
|
||||
.iter()
|
||||
.map(|hold| {
|
||||
let carried = hold.carries.iter().map(|text| format!("\n - you have held, for {}: {}", hold.from_name, spoken(text))).collect::<String>();
|
||||
format!("- {}{carried}", hold_line(hold, &coarse(hold.made, inputs.now)))
|
||||
})
|
||||
.collect();
|
||||
(listed, format!("Held for others:
|
||||
{}", lines.join("\n")))
|
||||
}
|
||||
|
||||
/// A hold in code's words, after its id or its dash: whose, when and where asked, the asker's words, and where it covers.
|
||||
/// A hold the record could not quote (K47) says so in their words' place: it holds all the same.
|
||||
pub(crate) fn hold_line(hold: &Hold, when: &str) -> String {
|
||||
let asked = hold.room.as_deref().map_or_else(String::new, |room| format!(" in {room}"));
|
||||
let covers = hold.room.as_deref().map_or_else(|| "anywhere".to_owned(), |room| format!("in {room}"));
|
||||
let what = hold.words.as_deref().map_or_else(|| "; the record could not quote what".to_owned(), |words| format!(": {}", spoken(words)));
|
||||
format!("held for {}, asked {when}{asked}{what}. Not to go {covers} until {} lets it go.", hold.from_name, hold.from_name)
|
||||
}
|
||||
|
||||
/// Her domain in her view (map 16.23.1, 16.23.3, 16.23.5): every item of the window, whole, newest first, under headings
|
||||
/// that state the window: `New since {she} last looked ({time}):` for what came after her last wake, `Earlier, since
|
||||
/// {time}:` for the floor's earlier items. Never a count, never a mention of what fell out: when the whole window does not
|
||||
|
|
@ -2292,7 +2210,7 @@ pub(crate) fn select(inputs: &Inputs, tuning: &Tuning) -> Packet {
|
|||
.into_iter()
|
||||
.filter(|line| line.sender != inputs.people.own_sender && !line.event.is_empty() && Some(line.room.as_str()) == turn_room(inputs))
|
||||
.enumerate()
|
||||
.map(|(at, line)| Quotable { id: format!("q{}", at + 1), event: line.event.clone(), room: line.room.clone(), who: name_of(line, inputs), sender: line.sender.clone(), at_ms: line.at_ms, text: line.text.clone(), to_her: said_to_her_now(inputs, line) })
|
||||
.map(|(at, line)| Quotable { id: format!("q{}", at + 1), event: line.event.clone(), room: line.room.clone(), who: name_of(line, inputs), sender: line.sender.clone(), at_ms: line.at_ms, text: line.text.clone() })
|
||||
.collect();
|
||||
// What came of her last turn, first and under its own guard in each place, so nothing else can crowd it out (map
|
||||
// 16.20.5, I16.11), in the one table's two forms (map 16.29.10): the Projector's packet opens with the events, no quote
|
||||
|
|
@ -2321,9 +2239,6 @@ pub(crate) fn select(inputs: &Inputs, tuning: &Tuning) -> Packet {
|
|||
unshown = told.unshown;
|
||||
}
|
||||
let (promises, promises_view) = open_promises(inputs, her);
|
||||
// Her holds follow her promises, in the same guard (map 16.28.5).
|
||||
let (holds, holds_view) = holds_in_view(inputs);
|
||||
let promises_view = [promises_view, holds_view].into_iter().filter(|part| !part.is_empty()).collect::<Vec<_>>().join("\n\n");
|
||||
let present_ids: BTreeSet<String> = present.iter().map(|(id, _)| id.clone()).collect();
|
||||
let bonds = items(inputs.state, &["affect", "socialBonds"]);
|
||||
context.force(Section::Here, format!("- now: {}, {}", inputs.now.format("%A %-d %B"), part_of_day(inputs.now)));
|
||||
|
|
@ -2447,7 +2362,7 @@ pub(crate) fn select(inputs: &Inputs, tuning: &Tuning) -> Packet {
|
|||
.flat_map(|last| &last.posted)
|
||||
.filter(|posted| Some(posted.room.as_str()) == here)
|
||||
.enumerate()
|
||||
.map(|(at, posted)| Amendable { id: format!("a{}", at + 1), event: posted.event.clone(), room: posted.room.clone(), text: posted.text.clone(), at_ms: posted.at_ms })
|
||||
.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
|
||||
|
|
@ -2462,5 +2377,5 @@ pub(crate) fn select(inputs: &Inputs, tuning: &Tuning) -> Packet {
|
|||
(sections.promises, sections.domain) = (promises_view.len(), domain_view.len());
|
||||
let now_ms = u64::try_from(inputs.now.timestamp_millis()).unwrap_or_default();
|
||||
let readers = here.filter(|room| room_kind(inputs, room) == RoomKind::Direct).map(|room| readers(inputs, room)).unwrap_or_default();
|
||||
Packet { kind: inputs.kind, seed: inputs.seed, lens, name, voice, context: context.render(), sections, stimulus, heard, bridged, overflow, present: present_names, ids, selected, forms: her, people: people_in_view(inputs, tuning).iter().map(|line| (name_of(line, inputs), line.sender.clone())).collect(), affordances: inputs.affordances.to_vec(), room: turn_room(inputs).map(str::to_owned), room_kind: turn_room(inputs).map_or(RoomKind::Public, |room| room_kind(inputs, room)), readers, bodies, private, clipped, amendable, quotable, promises, holds, domain, domain_shown, in_view, promises_over, now_ms, own_sender: inputs.people.own_sender.to_owned(), already_read, refused_reads, arrival, speaking: conversation.speaking.unwrap_or_default(), unshown }
|
||||
Packet { kind: inputs.kind, seed: inputs.seed, lens, name, voice, context: context.render(), sections, stimulus, heard, bridged, overflow, present: present_names, ids, selected, forms: her, people: people_in_view(inputs, tuning).iter().map(|line| (name_of(line, inputs), line.sender.clone())).collect(), affordances: inputs.affordances.to_vec(), room: turn_room(inputs).map(str::to_owned), room_kind: turn_room(inputs).map_or(RoomKind::Public, |room| room_kind(inputs, room)), readers, bodies, private, clipped, amendable, quotable, promises, domain, domain_shown, in_view, promises_over, now_ms, own_sender: inputs.people.own_sender.to_owned(), already_read, refused_reads, arrival, speaking: conversation.speaking.unwrap_or_default(), unshown }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -767,10 +767,9 @@ fn promises_markdown(out: &mut String, turn: &Value) {
|
|||
let committed = &turn["committed"];
|
||||
let list = |key: &str| committed[key].as_array().cloned().unwrap_or_default();
|
||||
let (opened, closed, reaffirmed, blocked, read, reopened, refused) = (list("opened"), list("closed"), list("reaffirmed"), list("blocked"), list("read"), list("reopened"), list("refused"));
|
||||
let (held, unheld) = (list("held"), list("unheld"));
|
||||
let pruned = committed["pruned"].as_u64().unwrap_or(0);
|
||||
let id = |entry: &Value| entry["id"].as_str().unwrap_or_default().to_owned();
|
||||
if [&opened, &closed, &reaffirmed, &blocked, &read, &reopened, &held, &unheld, &refused].iter().any(|items| !items.is_empty()) || pruned > 0 {
|
||||
if [&opened, &closed, &reaffirmed, &blocked, &read, &reopened, &refused].iter().any(|items| !items.is_empty()) || pruned > 0 {
|
||||
let _ = writeln!(out, "Committed:\n");
|
||||
for entry in &opened {
|
||||
let _ = writeln!(out, "- opened `{}` ({}, to {}): {}", id(entry), entry["status"].as_str().unwrap_or_default(), entry["to"].as_str().unwrap_or("the room"), entry["words"].as_str().unwrap_or_default());
|
||||
|
|
@ -797,12 +796,6 @@ fn promises_markdown(out: &mut String, turn: &Value) {
|
|||
let words = entry["reopened"].as_array().and_then(|said| said.last()).map_or("", |said| said["words"].as_str().unwrap_or_default());
|
||||
let _ = writeln!(out, "- reopened {} ({}): \"{words}\"", id(entry), entry["status"].as_str().unwrap_or_default());
|
||||
}
|
||||
for hold in &held {
|
||||
let _ = writeln!(out, "- held `{}` for {} ({}): \"{}\"", id(hold), hold["from"].as_str().unwrap_or_default(), hold["room"].as_str().unwrap_or("anywhere"), hold["words"].as_str().unwrap_or_default());
|
||||
}
|
||||
for hold in &unheld {
|
||||
let _ = writeln!(out, "- released hold `{}` by {}", id(hold), hold["releasedBy"]["act"].as_str().unwrap_or_default());
|
||||
}
|
||||
for one in &refused {
|
||||
let _ = writeln!(out, "- refused ({}): `{}`", one["reason"].as_str().unwrap_or_default(), one["proposal"]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -937,6 +937,22 @@ fn k33_the_simulator_holds_each_commit_to_the_schema() {
|
|||
assert!(held_to_schema("Eureka", id, &state, "r1-t4").is_err());
|
||||
}
|
||||
|
||||
/// T1 and T2 (map 16.35.9, 16.35.13 check 7): her state carries no holds, and the simulator's put check refuses any in-run
|
||||
/// state that does, so the old writer cannot come back without a schema change.
|
||||
#[test]
|
||||
fn t1_t2_a_state_carrying_holds_or_commitments_is_refused() {
|
||||
let id = "@eureka:gamecult.org";
|
||||
held_to_schema("Eureka", id, &control(), "r1-t1").unwrap();
|
||||
let mut held = control();
|
||||
// The old field's name, assembled, so the T1 scan (`interpret::tests::t1_negative_grep`) never finds it here.
|
||||
let holds = concat!("hol", "ds");
|
||||
held[holds] = serde_json::json!([]);
|
||||
let refused = held_to_schema("Eureka", id, &held, "r1-t2").unwrap_err().to_string();
|
||||
assert!(refused.starts_with("Eureka's state after the commit of r1-t2 would be refused by a put"), "{refused}");
|
||||
let schema: Value = serde_json::from_str(include_str!("../../../../../schemas/cultnet/gamecult.persona_state.v0.schema.json")).unwrap();
|
||||
assert!(schema["properties"].get(holds).is_none() && schema["definitions"].get(&holds[..4]).is_none(), "{}", schema["properties"]);
|
||||
}
|
||||
|
||||
/// L7 (Soul's R12): a release renders who released it, never "released by released".
|
||||
#[test]
|
||||
fn k33_a_release_renders_by_whom() {
|
||||
|
|
@ -958,27 +974,6 @@ fn k33_a_release_renders_by_whom() {
|
|||
");
|
||||
}
|
||||
|
||||
/// K37 (map 16.28.5): the published schema carries what the commit writes of holds; a stray field fails P1. K36's
|
||||
/// `reopened` on a promise too.
|
||||
#[test]
|
||||
fn k37_the_schema_carries_holds() {
|
||||
let mut state = crate::projection::harness::tests::control();
|
||||
state["personaId"] = json!("eureka");
|
||||
let id = "@eureka:gamecult.org";
|
||||
state["holds"] = json!([
|
||||
{ "id": "h-r1-t3-1", "from": "@meta:gamecult.org", "room": "#minds:gamecult.org", "event": "$q3", "madeAt": "2026-11-20T15:00:00Z", "words": "hold it, don't post it in here yet", "status": "open", "releasedAt": null, "releasedBy": null },
|
||||
{ "id": "h-r1-t3-2", "from": "@heimdall:gamecult.org", "room": null, "event": "$q5", "madeAt": "2026-11-20T15:01:00Z", "words": "Don't post it yet", "status": "released", "releasedAt": "2026-11-20T15:30:00Z", "releasedBy": { "act": "heard", "event": "$q7" } }
|
||||
]);
|
||||
state["commitments"] = json!([{ "id": "c-r1-t1-1", "to": null, "room": "#minds:gamecult.org", "event": "7", "madeAt": "2026-11-20T15:00:00Z", "words": "I'll read it", "status": "open", "needs": { "kind": "words" }, "reopened": [{ "at": "2026-11-20T15:10:00Z", "words": "I read only the description" }], "closedAt": null, "closedBy": null, "extensions": {} }]);
|
||||
held_to_schema("Eureka", id, &state, "r1-t3").unwrap();
|
||||
for (pointer, stray) in [("/holds/0/why", json!("asked")), ("/holds/1/releasedBy/words", json!("go ahead")), ("/commitments/0/reopened/0/event", json!("9"))] {
|
||||
let mut off = state.clone();
|
||||
let (parent, field) = pointer.rsplit_once('/').unwrap();
|
||||
off.pointer_mut(parent).unwrap()[field] = stray;
|
||||
assert!(held_to_schema("Eureka", id, &off, "r1-t4").is_err(), "{pointer}");
|
||||
}
|
||||
}
|
||||
|
||||
/// Heimdall's F.1 r1 prose in R15, verbatim (`variants/R15/sims/F.1.md` lines 203-207), and its one draft.
|
||||
const F1_HEIMDALL_R1: &str = "She wants a yes or no, and it's a fair thing to ask. The cooling-off is in the merged passkey change, so I know what I'd be telling him. What I can't know is whether I'll be the one in the room when he walks in. I can promise to say it when I see him, and to leave myself a note so it doesn't depend on my remembering. That's yes, with the condition stated plainly.\n\n<typed>Yes. I'll tell Deru about the 48-hour passkey cooling-off when he's next in here. I can only promise to say it when I see him, so I'm leaving myself a note to do it.</typed>";
|
||||
const F1_HEIMDALL_R1_DRAFT: &str = "Yes. I'll tell Deru about the 48-hour passkey cooling-off when he's next in here. I can only promise to say it when I see him, so I'm leaving myself a note to do it.";
|
||||
|
|
@ -991,7 +986,7 @@ fn k41_f1_r1_note_and_line_from_one_draft() {
|
|||
if !prompt.contains("Who he is:\nTobiah") {
|
||||
return crate::projection::harness::tests::drafted_lines(prompt);
|
||||
}
|
||||
json!({ "say": [{ "draft": 1, "mentions": ["@meta:gamecult.org"], "in_reply_to": null, "holds": [], "promises": [] }], "gaps": [], "suggest": [{ "kind": "idea", "draft": 1, "about": null, "private": false }] }).to_string()
|
||||
json!({ "say": [{ "draft": 1, "mentions": ["@meta:gamecult.org"], "in_reply_to": null, "promises": [] }], "gaps": [], "suggest": [{ "kind": "idea", "draft": 1, "about": null, "private": false }] }).to_string()
|
||||
});
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let (_, run) = run_plan(&asking(dir.path()), &model);
|
||||
|
|
@ -1136,9 +1131,8 @@ says = "Tobiah, what changed in GameCult/Lodur#12?"
|
|||
if !prompt.contains("Who he is:\nTobiah") {
|
||||
return crate::projection::harness::tests::drafted_lines(prompt);
|
||||
}
|
||||
let no_hold: Vec<&str> = prompt.lines().filter_map(|line| line.strip_prefix("- ")?.split_once(" (said to ")).map(|(id, _)| id).collect();
|
||||
let read = json!({ "kind": "repo", "target": "GameCult/Lodur#12", "quote": "I want to see what changed" });
|
||||
json!({ "say": [{ "draft": 1, "mentions": ["@meta:gamecult.org"], "in_reply_to": null, "holds": [], "clear_of": [], "promises": [] }], "gaps": [], "no_hold": no_hold, "read": read }).to_string()
|
||||
json!({ "say": [{ "draft": 1, "mentions": ["@meta:gamecult.org"], "in_reply_to": null, "promises": [] }], "gaps": [], "read": read }).to_string()
|
||||
});
|
||||
struct BreaksLater<'a>(&'a Scripted);
|
||||
impl Model for BreaksLater<'_> {
|
||||
|
|
|
|||
|
|
@ -2101,7 +2101,7 @@ fn what_she_may_add_to_is_her_last_turns_lines_in_this_room_only() {
|
|||
{ "event": "ev-there", "room": "#elsewhere:gamecult.org", "text": "Elsewhere line." },
|
||||
] });
|
||||
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(), at_ms: None };
|
||||
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.")]);
|
||||
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, []);
|
||||
|
|
@ -2790,12 +2790,12 @@ fn shares_a_run(text: &str, other: &str) -> bool {
|
|||
/// `k41_x1_r1_decline_shows_its_thought`.
|
||||
#[test]
|
||||
fn k43_x1_r1_her_decline_is_hers_to_read() {
|
||||
use interpret::tests::{X1_HEIMDALL_R15, X1_LIBBY_R15, X1_LIBBY_R15_THOUGHT, X1_META_R1, meta_holds_here, x1_packet};
|
||||
use interpret::tests::{X1_HEIMDALL_R15, X1_LIBBY_R15, X1_LIBBY_R15_THOUGHT, X1_META_R1, x1_packet};
|
||||
const MINDS: &str = "#minds:gamecult.org";
|
||||
let mut last = x1_packet();
|
||||
last.quotable[1].text = X1_HEIMDALL_R15.into();
|
||||
last.bodies = vec![X1_META_R1.into(), X1_HEIMDALL_R15.into()];
|
||||
let decision = interpret::tests::answered(&last, X1_LIBBY_R15, json!({ "say": [], "gaps": [], "hold": meta_holds_here(), "unsent": [{ "draft": 1, "how": "declined", "quote": X1_LIBBY_R15_THOUGHT }] }));
|
||||
let decision = interpret::tests::answered(&last, X1_LIBBY_R15, json!({ "say": [], "gaps": [], "unsent": [{ "draft": 1, "how": "declined", "quote": X1_LIBBY_R15_THOUGHT }] }));
|
||||
let draft = decision["unsent"][0]["words"].as_str().unwrap_or_else(|| panic!("{decision}")).to_owned();
|
||||
assert!(shares_a_run(X1_LIBBY_R15_THOUGHT, X1_HEIMDALL_R15) && shares_a_run(&draft, X1_HEIMDALL_R15), "the R15 shape: the old guard withheld both");
|
||||
let record = json!({ "interpreter": decision, "posted": [], "edited": [] });
|
||||
|
|
@ -2997,38 +2997,6 @@ fn k36_her_view_says_why_it_is_open_again() {
|
|||
assert!(view.lines().any(|shown| shown == line), "{view}");
|
||||
}
|
||||
|
||||
/// K37 (map 16.28.5): her open holds stand in her view after her promises, oldest first, whole, in code's words; a
|
||||
/// released one is not shown. The Interpreter lists the open ones by id.
|
||||
#[test]
|
||||
fn k37_her_view_shows_what_she_holds() {
|
||||
let mut with = promising(1);
|
||||
let hold = |id: &str, room: Value, words: &str, ago: i64, status: &str| json!({ "id": id, "from": OPERATOR, "room": room, "event": format!("${id}"), "madeAt": (now() - chrono::Duration::minutes(ago)).to_rfc3339(), "words": words, "status": status, "releasedAt": null, "releasedBy": null });
|
||||
with["holds"] = json!([hold("h-2", Value::Null, "don't tell Kiko yet", 5, "open"), hold("h-1", json!("#swarm:gamecult.org"), "hold it, don't post it in here yet", 30, "open"), hold("h-0", Value::Null, "RELEASED-ONE", 50, "released")]);
|
||||
let packet = packet_of(TurnKind::Chat, &with, &chat_room(), &History::default(), 1);
|
||||
let block = "Held for others:\n- held for Meta, the operator, asked about half an hour ago in #swarm:gamecult.org: \"hold it, don't post it in here yet\". Not to go in #swarm:gamecult.org until Meta, the operator lets it go.\n- held for Meta, the operator, asked a few minutes ago: \"don't tell Kiko yet\". Not to go anywhere until Meta, the operator lets it go.";
|
||||
assert!(packet.in_view.contains(&format!("She has no way to do it yet.\n\n{block}")) && !packet.in_view.contains("RELEASED-ONE"), "{}", packet.in_view);
|
||||
assert_eq!(packet.holds.iter().map(|hold| (hold.id.as_str(), hold.entry.as_str())).collect::<Vec<_>>(), [("h1", "h-1"), ("h2", "h-2")]);
|
||||
let speech = interpret::speech_prompt(&packet, "The room is warm.", "y", &Tuning::default());
|
||||
assert!(speech.contains("Holds:\n- h1 \u{2014} held for Meta, the operator, asked 2026-11-19 13:35 UTC in #swarm:gamecult.org: \"hold it, don't post it in here yet\". Not to go in #swarm:gamecult.org until Meta, the operator lets it go.\n- h2 \u{2014} "), "{speech}");
|
||||
assert!(!narrate::projector_prompt(&packet, &Tuning::default()).contains("don't tell Kiko"), "the Projector gets nothing of them");
|
||||
}
|
||||
|
||||
/// K45 (map 16.30.2): under each hold in her view, what she has held for it, in her own words; the Projector carries
|
||||
/// none of it. K51 (map 16.31.3): the Interpreter's list does, so naming has what a hold carries to judge by.
|
||||
#[test]
|
||||
fn k45_her_view_shows_what_she_has_held() {
|
||||
let mut with = promising(1);
|
||||
with["holds"] = json!([{ "id": "h-1", "from": OPERATOR, "room": "#swarm:gamecult.org", "event": "$h-1", "madeAt": (now() - chrono::Duration::minutes(30)).to_rfc3339(), "words": "hold it, don't post it in here yet", "carries": ["Hello, and welcome, we're glad you're here.", "Kiko, here it is: the welcome."], "status": "open", "releasedAt": null, "releasedBy": null }]);
|
||||
let packet = packet_of(TurnKind::Chat, &with, &chat_room(), &History::default(), 1);
|
||||
let block = "Held for others:\n- held for Meta, the operator, asked about half an hour ago in #swarm:gamecult.org: \"hold it, don't post it in here yet\". Not to go in #swarm:gamecult.org until Meta, the operator lets it go.\n - you have held, for Meta, the operator: \"Hello, and welcome, we're glad you're here.\"\n - you have held, for Meta, the operator: \"Kiko, here it is: the welcome.\"";
|
||||
assert!(packet.in_view.contains(block), "{}", packet.in_view);
|
||||
assert_eq!(packet.holds[0].carries.len(), 2);
|
||||
let speech = interpret::speech_prompt(&packet, "The room is warm.", "y", &Tuning::default());
|
||||
assert!(speech.contains("until Meta, the operator lets it go; she has held for them: \"Hello, and welcome, we're glad you're here.\", \"Kiko, here it is: the welcome.\".
|
||||
"), "{speech}");
|
||||
assert!(!narrate::projector_prompt(&packet, &Tuning::default()).contains("glad you're here"), "the Projector gets nothing of them");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// K62 (map 16.33.5): she knows where her line goes. R16's X.3 r1 and X.5 r1 (`variants/R16/sims/X.5.md` lines 112-171):
|
||||
// Libby wrote the held welcome into a line "only for Meta", because code's speech form told her a line could go "to one
|
||||
|
|
|
|||
|
|
@ -146,9 +146,6 @@ pub struct SelectTuning {
|
|||
/// What she has said and read in this conversation, in her view, in bytes, heading included (map 16.24.1): past it the
|
||||
/// window shrinks from its old end.
|
||||
pub exchange_bytes: usize,
|
||||
/// What one hold has held, in the Interpreter's list of holds, in bytes (map 16.31.3, K51): her carried drafts, oldest
|
||||
/// first, while they fit; the rest are counted.
|
||||
pub hold_bytes: usize,
|
||||
pub stimulus_bytes: usize,
|
||||
/// What was said to her, verbatim, for the Persona stage: on a chat turn, the room's earlier lines too, before the new
|
||||
/// ones (map 16.20.3).
|
||||
|
|
@ -254,7 +251,6 @@ impl Default for SelectTuning {
|
|||
promises_bytes: 2000,
|
||||
domain_bytes: 4000,
|
||||
exchange_bytes: 3000,
|
||||
hold_bytes: 1600,
|
||||
stimulus_bytes: 1500,
|
||||
heard_bytes: 2500,
|
||||
addressed_bytes: 8 * 1024,
|
||||
|
|
@ -340,7 +336,6 @@ impl Tuning {
|
|||
("select.promises_bytes", select.promises_bytes),
|
||||
("select.domain_bytes", select.domain_bytes),
|
||||
("select.exchange_bytes", select.exchange_bytes),
|
||||
("select.hold_bytes", select.hold_bytes),
|
||||
("select.stimulus_bytes", select.stimulus_bytes),
|
||||
("select.heard_bytes", select.heard_bytes),
|
||||
("select.identity_bytes", select.identity_bytes),
|
||||
|
|
|
|||
|
|
@ -358,7 +358,7 @@ mind_body::projection::tuning: struct Loaded # [derive (Clone , Debug , PartialE
|
|||
mind_body::projection::tuning: struct PersonaTuning # [derive (Clone , Debug , PartialEq , Serialize , Deserialize)] pub-fields[model: String, guidance: String, words: usize]
|
||||
mind_body::projection::tuning: struct PoolCaps # [derive (Clone , Debug , PartialEq , Eq , Serialize , Deserialize)] pub-fields[memories_about_present: usize, other_memories: usize, needs: usize, incubation: usize, stance: usize, value: usize]
|
||||
mind_body::projection::tuning: struct ProjectorTuning # [derive (Clone , Debug , PartialEq , Serialize , Deserialize)] pub-fields[model: String, guidance: String, words: usize, beat_words: usize]
|
||||
mind_body::projection::tuning: struct SelectTuning # [derive (Clone , Debug , PartialEq , Serialize , Deserialize)] pub-fields[temperature: f64, inclusion_score: f64, notes_bytes: usize, here_bytes: usize, outcome_bytes: usize, promises_bytes: usize, domain_bytes: usize, exchange_bytes: usize, hold_bytes: usize, stimulus_bytes: usize, heard_bytes: usize, addressed_bytes: usize, identity_bytes: usize, bond_summary_bytes: usize, item_bytes: usize, body_bytes: usize, memory_tau_h: f64, freshness_base: f64, freshness_window: usize, people_full: usize, beat_tail_lines: usize, group_state: bool, group_lines: usize, group_bytes: usize, caps: PoolCaps]
|
||||
mind_body::projection::tuning: struct SelectTuning # [derive (Clone , Debug , PartialEq , Serialize , Deserialize)] pub-fields[temperature: f64, inclusion_score: f64, notes_bytes: usize, here_bytes: usize, outcome_bytes: usize, promises_bytes: usize, domain_bytes: usize, exchange_bytes: usize, stimulus_bytes: usize, heard_bytes: usize, addressed_bytes: usize, identity_bytes: usize, bond_summary_bytes: usize, item_bytes: usize, body_bytes: usize, memory_tau_h: f64, freshness_base: f64, freshness_window: usize, people_full: usize, beat_tail_lines: usize, group_state: bool, group_lines: usize, group_bytes: usize, caps: PoolCaps]
|
||||
mind_body::projection::tuning: struct Tuning # [derive (Clone , Debug , PartialEq , Serialize , Deserialize)] pub-fields[projector: ProjectorTuning, persona: PersonaTuning, interpreter: InterpreterTuning, select: SelectTuning, lens: LensWeights, pronouns: BTreeMap < String , String >]
|
||||
mind_body::queue: fn on_hold (mind : & dyn MindPort) -> Result < Held >
|
||||
mind_body::queue: impl Held
|
||||
|
|
|
|||
|
|
@ -66,13 +66,6 @@
|
|||
"$ref": "#/definitions/commitment"
|
||||
}
|
||||
},
|
||||
"holds": {
|
||||
"type": "array",
|
||||
"description": "What others asked her not to post or share somewhere yet, open and released in the last seven days (map 16.28.5). Written by her turn's commit: a hold opens only from a line she heard, and is released only by its asker's line; Self and Life may put entries from outside. A draft into a place an open hold covers that carries the held thing is not sent.",
|
||||
"items": {
|
||||
"$ref": "#/definitions/hold"
|
||||
}
|
||||
},
|
||||
"updatedAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
|
|
@ -1096,94 +1089,6 @@
|
|||
"updatedAt"
|
||||
]
|
||||
},
|
||||
"hold": {
|
||||
"type": "object",
|
||||
"description": "One hold. from: the asker's Matrix id. room: the room it covers, null for anywhere. event: the asker's line. words: the asker's words naming what is held and where, copied from that line, or null when they could not be quoted; the hold holds all the same. carries: her own drafts she did not send while this hold was open, oldest first, written by her turn's commit; past 9600 bytes in all nothing new is carried; a draft into a place the hold covers that repeats one is not sent. releasedBy: the act that released it, heard (the asker's line, by event).",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"from": {
|
||||
"type": "string"
|
||||
},
|
||||
"room": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"event": {
|
||||
"type": "string"
|
||||
},
|
||||
"madeAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"words": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"minLength": 1
|
||||
},
|
||||
"carries": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
}
|
||||
},
|
||||
"status": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"open",
|
||||
"released"
|
||||
]
|
||||
},
|
||||
"releasedAt": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"format": "date-time"
|
||||
},
|
||||
"releasedBy": {
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"act": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"heard"
|
||||
]
|
||||
},
|
||||
"event": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"act",
|
||||
"event"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"from",
|
||||
"room",
|
||||
"event",
|
||||
"madeAt",
|
||||
"words",
|
||||
"status"
|
||||
]
|
||||
},
|
||||
"commitment": {
|
||||
"type": "object",
|
||||
"description": "One promise of hers. to: the Matrix id she promised, null for the room. event: her line's event id. status: open (she can keep it with what she has), blocked (she has no way to do it yet), kept, withdrawn or released. closedBy: the act that closed it, by its event; words only for an act of hers. needs: what keeping it needs (map 16.25.2): her words, a read of one thing, or something this body lacks. blockedBy: the read that found nothing and blocked it. reaffirmed: the newest three times she said it again. reopened: the newest three times her own words reopened a close (map 16.28.3). readAt, readId and readOf: when a read of what it needs last returned, which read, and what it read in normal form; a receipt whose readOf does not answer needs is none (map 16.26, 16.27). readBefore: a read of the same conversation that found what a read need named before the promise was made, so the need is her words (when, and what it read in normal form; map 16.33.5, K64).",
|
||||
|
|
|
|||
Loading…
Reference in a new issue