Let a person be seen: nonverbal display by quote
An invocation may carry a display, the actor's own visible sentence, beside
or instead of its utterance. The kernel lowers it as speech's twin: an
AssertClaim and a Display whose room is re-derived at apply, landing
Seen { by } on everyone standing in the actor's place and on nobody else,
never over a channel. A speech-carrying entry given a display alone is an
address, not SpeechRequired; an empty display is EmptyDisplay; a placeless
actor has no room. The Interpreter gains a display tool quoting the visible
clause alone; the narrative capture carries both spans; the fold allows one
of each. Overheard rows and Projector knowledge rows say how a thing was
perceived: said by, seen doing, or known. The journal's event-shape rule
counts both lowerings. Kernel-only lowering: no patch tool, catalog stays
thirty. Schemas: world_state.consumer.v4, world_commit.consumer.v4,
controller_work.v14. Six tests pin the room, the silence, the refusals,
replay, the fold, and the interruption block.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
29ecae7613
commit
0582321e2c
11 changed files with 850 additions and 187 deletions
|
|
@ -1239,7 +1239,11 @@ fn controller_narrative_result(run: NarrativeRun) -> ControllerHttpResult {
|
|||
"personaSourceDigest":turn.source_digest(),
|
||||
"personaReceiptDigest":turn.receipt_digest(),
|
||||
"interpretation":{
|
||||
"proposal":capture.proposal.as_ref().map(|source| json!({
|
||||
"speech":capture.speech.as_ref().map(|source| json!({
|
||||
"startByte":source.start_byte,
|
||||
"endByte":source.end_byte,
|
||||
})),
|
||||
"display":capture.display.as_ref().map(|source| json!({
|
||||
"startByte":source.start_byte,
|
||||
"endByte":source.end_byte,
|
||||
})),
|
||||
|
|
@ -1505,6 +1509,7 @@ async fn execute_world(
|
|||
speech: Some(Statement::new(payload.text).ok_or_else(|| {
|
||||
RuntimeCommandError::Payload("spoken text is not canonical".into())
|
||||
})?),
|
||||
display: None,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
@ -3356,6 +3361,7 @@ mod tests {
|
|||
bindings: Vec::new(),
|
||||
proposed: Vec::new(),
|
||||
speech: Some(Statement::new(text.to_string()).unwrap()),
|
||||
display: None,
|
||||
},
|
||||
)
|
||||
.await
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ pub(crate) enum ActionMismatch {
|
|||
SpeechRequired,
|
||||
SpeechNotCarried,
|
||||
EmptySpeech,
|
||||
EmptyDisplay,
|
||||
/// The acting subject's effective authority covers no such target under
|
||||
/// this kind. A target that walked out of the jurisdiction while the
|
||||
/// proposal was in flight arrives here, not as a rebind: what the actor is
|
||||
|
|
@ -210,6 +211,33 @@ pub(super) fn exercise(
|
|||
}
|
||||
_ => None,
|
||||
};
|
||||
// The display lowering: the same standing as speech, from the same
|
||||
// allocation site under the second discriminator. It needs no entry
|
||||
// field and reads no audience precondition: a body is visible to the room
|
||||
// whatever the entry addresses, so `proclaim` down a horn still shrugs at
|
||||
// whoever stands beside the speaker.
|
||||
let display = invocation.display.as_ref().map(|statement| {
|
||||
let fact = EntityId(patch::derive_id(
|
||||
patch::ENTITY_NAMESPACE,
|
||||
state.world_id,
|
||||
command_id,
|
||||
&patch::DraftHandle::new(SPEECH_HANDLE),
|
||||
Some(DISPLAY_INDEX),
|
||||
));
|
||||
let at = usize::from(speech.is_some()) * 2;
|
||||
effects.splice(
|
||||
at..at,
|
||||
[
|
||||
patch::ResolvedOp::AssertClaim {
|
||||
fact,
|
||||
statement: statement.clone(),
|
||||
by: actor,
|
||||
},
|
||||
patch::ResolvedOp::Display { actor, fact },
|
||||
],
|
||||
);
|
||||
fact
|
||||
});
|
||||
|
||||
let revision = state
|
||||
.revision
|
||||
|
|
@ -222,6 +250,7 @@ pub(super) fn exercise(
|
|||
controller_id: current.controller_id,
|
||||
affordance: granted.id,
|
||||
speech,
|
||||
display,
|
||||
band,
|
||||
effects,
|
||||
})
|
||||
|
|
@ -233,10 +262,14 @@ pub(super) fn exercise(
|
|||
const SPEECH_HANDLE: &str = "ghostlight.speech";
|
||||
|
||||
/// The speech index, passed as `derive_id`'s discriminator. It is `0` for every
|
||||
/// invocation because one invocation carries one utterance; it exists so a later
|
||||
/// multi-utterance turn needs no second allocation idiom.
|
||||
/// invocation because one invocation carries one utterance; it exists so a
|
||||
/// second minted claim needs no second allocation idiom.
|
||||
const SPEECH_INDEX: &str = "0";
|
||||
|
||||
/// The display index: the second claim one invocation may mint, under the
|
||||
/// same handle and allocation site as speech.
|
||||
const DISPLAY_INDEX: &str = "1";
|
||||
|
||||
/// The audience a speech-carrying entry names. The declaration validator already
|
||||
/// refused an entry with none (`SpeechWithoutAudience`) or two
|
||||
/// (`AmbiguousSpeechAudience`), so anything else here is a corrupt catalog.
|
||||
|
|
@ -719,13 +752,24 @@ fn check_proposals(
|
|||
// deserialization rather than through the constructor is re-checked here
|
||||
// rather than trusted.
|
||||
match (&invocation.speech, entry.carries_speech) {
|
||||
(None, true) => rejections.push(ActionMismatch::SpeechRequired),
|
||||
// A speech-carrying entry addresses someone; a silent turn that only
|
||||
// displays still addresses the room, so it is not `SpeechRequired`.
|
||||
(None, true) if invocation.display.is_none() => {
|
||||
rejections.push(ActionMismatch::SpeechRequired);
|
||||
}
|
||||
(Some(_), false) => rejections.push(ActionMismatch::SpeechNotCarried),
|
||||
(Some(speech), true) if !patch::is_canonical_text(speech.as_str()) => {
|
||||
rejections.push(ActionMismatch::EmptySpeech);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
if invocation
|
||||
.display
|
||||
.as_ref()
|
||||
.is_some_and(|display| !patch::is_canonical_text(display.as_str()))
|
||||
{
|
||||
rejections.push(ActionMismatch::EmptyDisplay);
|
||||
}
|
||||
}
|
||||
|
||||
/// The only entropy in the kernel: one digest, one modulo, one cumulative walk.
|
||||
|
|
@ -1057,6 +1101,7 @@ mod tests {
|
|||
magnitude: Magnitude::Quantity(Quantity(qty)),
|
||||
}],
|
||||
speech: None,
|
||||
display: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1356,6 +1401,7 @@ mod tests {
|
|||
bindings: Vec::new(),
|
||||
proposed: Vec::new(),
|
||||
speech: None,
|
||||
display: None,
|
||||
};
|
||||
assert_eq!(
|
||||
bench.rejections(&silent_speak),
|
||||
|
|
@ -1492,6 +1538,7 @@ mod tests {
|
|||
},
|
||||
],
|
||||
speech: None,
|
||||
display: None,
|
||||
};
|
||||
let mut seen: BTreeSet<usize> = BTreeSet::new();
|
||||
|
||||
|
|
@ -1693,6 +1740,7 @@ mod tests {
|
|||
bindings: Vec::new(),
|
||||
proposed: Vec::new(),
|
||||
speech: Some(Statement::new("I open the door.").unwrap()),
|
||||
display: None,
|
||||
},
|
||||
},
|
||||
),
|
||||
|
|
@ -1749,6 +1797,7 @@ mod tests {
|
|||
bindings,
|
||||
proposed,
|
||||
speech,
|
||||
display: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2691,6 +2740,7 @@ mod tests {
|
|||
magnitude: Magnitude::None,
|
||||
}],
|
||||
speech: None,
|
||||
display: None,
|
||||
};
|
||||
let lowered = lower(
|
||||
&entry,
|
||||
|
|
|
|||
|
|
@ -1803,6 +1803,7 @@ mod tests {
|
|||
bindings: Vec::new(),
|
||||
proposed: Vec::new(),
|
||||
speech: Some(Statement::new("The hold is counted.").unwrap()),
|
||||
display: None,
|
||||
},
|
||||
},
|
||||
)
|
||||
|
|
@ -2123,6 +2124,7 @@ mod tests {
|
|||
bindings: Vec::new(),
|
||||
proposed: Vec::new(),
|
||||
speech: Some(Statement::new("The hold is counted.").unwrap()),
|
||||
display: None,
|
||||
},
|
||||
},
|
||||
),
|
||||
|
|
@ -2230,7 +2232,7 @@ mod tests {
|
|||
assert!(super::super::journal::verify_state_shape(&previous).is_err());
|
||||
assert_eq!(
|
||||
super::super::STATE_SCHEMA,
|
||||
"ghostlight.world_state.consumer.v3"
|
||||
"ghostlight.world_state.consumer.v4"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -72,13 +72,14 @@ pub(super) const CELL_TOOL_STEP_BUDGET: usize = 2;
|
|||
/// carried by tool identity, never by a model-written argument.
|
||||
const HANDLE_SEPARATOR: &str = "__";
|
||||
const PERSONA_WORD_BUDGET: usize = 180;
|
||||
const CONTROLLER_WORK_ROW: &str = "controller_work.v13";
|
||||
const CONTROLLER_WORK_SCHEMA: &str = "ghostlight.controller_work.v13";
|
||||
const CONTROLLER_WORK_ROW: &str = "controller_work.v14";
|
||||
const CONTROLLER_WORK_SCHEMA: &str = "ghostlight.controller_work.v14";
|
||||
|
||||
/// The Interpreter's byte-span capture tool. It is not the generated `speak`
|
||||
/// affordance tool: one captures an utterance out of preserved prose, the other
|
||||
/// is a projection of a catalog entry.
|
||||
const INTERPRETER_SPEAK_TOOL: &str = "speak";
|
||||
const INTERPRETER_DISPLAY_TOOL: &str = "display";
|
||||
|
||||
/// The kind name the narrative lane looks for among its granted entries. The
|
||||
/// kernel carries the name and branches on it nowhere; matching on it here is a
|
||||
|
|
@ -972,7 +973,7 @@ impl NarrativeCheckpoint {
|
|||
&& opportunity.controller_mode == ControllerMode::NarrativePersona
|
||||
&& granted_matches_opportunity(granted, opportunity)
|
||||
&& derive_narrative_capture(turn, interpreter_prompt, completed)
|
||||
.is_ok_and(|capture| capture.proposal.is_some())
|
||||
.is_ok_and(|capture| capture.addresses())
|
||||
}
|
||||
Self::NoProposal {
|
||||
turn,
|
||||
|
|
@ -986,7 +987,7 @@ impl NarrativeCheckpoint {
|
|||
&& interruption_matches_turn(interruption, turn)
|
||||
&& opportunity.controller_mode == ControllerMode::NarrativePersona
|
||||
&& derive_narrative_capture(turn, interpreter_prompt, completed)
|
||||
.is_ok_and(|capture| capture.proposal.is_none())
|
||||
.is_ok_and(|capture| !capture.addresses())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1161,27 +1162,48 @@ fn cell_constituents_are_valid(constituents: &[ConstituentWork]) -> bool {
|
|||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub(crate) struct NarrativeCapture {
|
||||
pub(crate) proposal: Option<SourceRange>,
|
||||
/// The spoken words, bound to where they sit in the prose.
|
||||
pub(crate) speech: Option<SourceRange>,
|
||||
/// The visible act, bound the same way. Either, both, or neither.
|
||||
pub(crate) display: Option<SourceRange>,
|
||||
pub(crate) gaps: Vec<TranslationGapSummary>,
|
||||
pub(crate) finalization: InterpretationFinalization,
|
||||
pub(crate) inference_receipts: Vec<String>,
|
||||
}
|
||||
|
||||
/// One thing said to this subject after its turn was formed. Speech is the only
|
||||
/// interruption a subject may perceive as having an author, and only through a
|
||||
/// `Told { by }` row for a fact `fan_out` actually gave it. The label is
|
||||
/// resolved here because the snapshot that resolves it is gone by the time the
|
||||
/// row is re-read, and it is resolved by `speaker_label` and nothing else.
|
||||
impl NarrativeCapture {
|
||||
/// Whether the turn addressed the room at all: spoke, displayed, or both.
|
||||
pub(crate) fn addresses(&self) -> bool {
|
||||
self.speech.is_some() || self.display.is_some()
|
||||
}
|
||||
}
|
||||
|
||||
/// One thing said or shown to this subject after its turn was formed. Speech
|
||||
/// and display are the only interruptions a subject may perceive as having an
|
||||
/// author, and only through a `Told { by }` or `Seen { by }` row for a fact
|
||||
/// `fan_out` actually gave it. The label is resolved here because the snapshot
|
||||
/// that resolves it is gone by the time the row is re-read, and it is resolved
|
||||
/// by `perceived_from` and nothing else.
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub(crate) struct Overheard {
|
||||
/// `None` for a fact this subject holds without having been told it. It
|
||||
/// knows the thing, not the telling.
|
||||
pub(crate) speaker: Option<String>,
|
||||
pub(crate) from: Perceived,
|
||||
pub(crate) statement: Statement,
|
||||
pub(crate) confidence: Confidence,
|
||||
}
|
||||
|
||||
/// How a subject came by one row of its own knowledge, as it perceives it:
|
||||
/// told by a labelled speaker, seen done by a labelled actor, or simply held.
|
||||
/// `Known` is a fact this subject holds without a telling or a showing; it
|
||||
/// knows the thing, not the act.
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case", deny_unknown_fields)]
|
||||
pub(crate) enum Perceived {
|
||||
Said { by: String },
|
||||
Seen { by: String },
|
||||
Known,
|
||||
}
|
||||
|
||||
/// What the runner showed the Interpreter when it re-lowered, and the
|
||||
/// conversation it replaced. Persisted so a resumed row rebuilds the same
|
||||
/// request byte for byte without a snapshot.
|
||||
|
|
@ -1191,7 +1213,7 @@ pub(crate) struct Interruption {
|
|||
/// The subject's own components at re-lowering. The "after"; the
|
||||
/// checkpoint's `components` is the "before".
|
||||
pub(crate) components: ScopeComponents,
|
||||
/// Rows whose `spoken_at` is later than the turn's bound revision, in the
|
||||
/// Rows whose `minted_at` is later than the turn's bound revision, in the
|
||||
/// snapshot's order.
|
||||
pub(crate) overheard: Vec<Overheard>,
|
||||
/// The first lowering's evidence. Nothing is discarded merely because the
|
||||
|
|
@ -2306,15 +2328,12 @@ impl From<ControllerWorkStoreError> for ControllerOpenError {
|
|||
}
|
||||
}
|
||||
|
||||
/// What the narrative lane captures from one Persona turn: the spoken words,
|
||||
/// the visible act, each at most once, each in the person's own words.
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize)]
|
||||
pub(crate) struct SpeakProposal {
|
||||
text: String,
|
||||
}
|
||||
|
||||
impl SpeakProposal {
|
||||
pub(crate) fn text(&self) -> &str {
|
||||
&self.text
|
||||
}
|
||||
pub(crate) enum NarrativeProposal {
|
||||
Speak { text: String },
|
||||
Display { text: String },
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
|
|
@ -3643,7 +3662,7 @@ impl ControllerRunner {
|
|||
completed.push(output);
|
||||
match evaluate_interpreter_loop(&turn, &interpreter_prompt, &completed) {
|
||||
Ok(InterpreterLoopEvaluation::Complete { capture }) => {
|
||||
let next = if capture.proposal.is_some() {
|
||||
let next = if capture.addresses() {
|
||||
NarrativeCheckpoint::ReadyToSubmit {
|
||||
command_id,
|
||||
turn,
|
||||
|
|
@ -4518,18 +4537,25 @@ impl SelectedDecision {
|
|||
}
|
||||
|
||||
/// The acting subject's own knowledge, and nothing else. A subject perceives
|
||||
/// a speech act if and only if it holds `Knowledge` of that act's fact, so
|
||||
/// this is a renderer over one kernel-derived field rather than a walk that
|
||||
/// decides reach a second time. Confidence reaches the Projector as prose
|
||||
/// uncertainty, which makes the prompt's instruction a description of the
|
||||
/// surface instead of its enforcement.
|
||||
/// a speech act or a visible act if and only if it holds `Knowledge` of that
|
||||
/// act's fact, so this is a renderer over one kernel-derived field rather
|
||||
/// than a walk that decides reach a second time. Confidence reaches the
|
||||
/// Projector as prose uncertainty, which makes the prompt's instruction a
|
||||
/// description of the surface instead of its enforcement. A seen row is the
|
||||
/// actor's own sentence; the reading of it is this subject's to make.
|
||||
fn projector_knowledge(&self) -> Vec<Value> {
|
||||
self.subject
|
||||
.knowledge
|
||||
.iter()
|
||||
.map(|entry| {
|
||||
let (how, by) = match self.perceived_from(entry) {
|
||||
Perceived::Said { by } => ("said", Value::String(by)),
|
||||
Perceived::Seen { by } => ("seen_doing", Value::String(by)),
|
||||
Perceived::Known => ("known", Value::Null),
|
||||
};
|
||||
json!({
|
||||
"speaker": self.speaker_label(entry).map_or(Value::Null, Value::String),
|
||||
"how": how,
|
||||
"by": by,
|
||||
"certainty": entry.confidence,
|
||||
"text": entry.statement.as_str(),
|
||||
})
|
||||
|
|
@ -4537,33 +4563,37 @@ impl SelectedDecision {
|
|||
.collect()
|
||||
}
|
||||
|
||||
/// Attribution comes from the listener's own knowledge, never from an event
|
||||
/// scope: a subject that holds a fact it was never told sees the statement
|
||||
/// with no speaker, because it knows the thing and not the telling. A label
|
||||
/// is resolved only for a subject that spoke to this one.
|
||||
fn speaker_label(&self, entry: &KnowledgeSnapshot) -> Option<String> {
|
||||
match entry.source {
|
||||
KnowledgeSource::Told { by, .. } => self
|
||||
.snapshot
|
||||
/// Attribution comes from the perceiver's own knowledge, never from an
|
||||
/// event scope: a subject that holds a fact it was never told or shown sees
|
||||
/// the statement with no author, because it knows the thing and not the
|
||||
/// act. A label is resolved only for a subject that spoke to, or was seen
|
||||
/// by, this one.
|
||||
fn perceived_from(&self, entry: &KnowledgeSnapshot) -> Perceived {
|
||||
let label = |id: SubjectId| {
|
||||
self.snapshot
|
||||
.subjects
|
||||
.iter()
|
||||
.find(|subject| subject.id == by)
|
||||
.map(|subject| subject.label.clone()),
|
||||
KnowledgeSource::Witnessed | KnowledgeSource::Evidenced => None,
|
||||
.find(|subject| subject.id == id)
|
||||
.map(|subject| subject.label.clone())
|
||||
};
|
||||
match entry.source {
|
||||
KnowledgeSource::Told { by, .. } => label(by).map_or(Perceived::Known, |by| Perceived::Said { by }),
|
||||
KnowledgeSource::Seen { by } => label(by).map_or(Perceived::Known, |by| Perceived::Seen { by }),
|
||||
KnowledgeSource::Witnessed | KnowledgeSource::Evidenced => Perceived::Known,
|
||||
}
|
||||
}
|
||||
|
||||
/// Everything said to *this* subject since the turn's bound revision. Read
|
||||
/// from `self.subject` and never from `self.snapshot.subjects`: a delta
|
||||
/// rendered from the snapshot's subject list would leak a neighbour's state
|
||||
/// and no type would stop it.
|
||||
/// Everything said or shown to *this* subject since the turn's bound
|
||||
/// revision. Read from `self.subject` and never from
|
||||
/// `self.snapshot.subjects`: a delta rendered from the snapshot's subject
|
||||
/// list would leak a neighbour's state and no type would stop it.
|
||||
fn overheard_since(&self, revision: u64) -> Vec<Overheard> {
|
||||
self.subject
|
||||
.knowledge
|
||||
.iter()
|
||||
.filter(|row| row.spoken_at.is_some_and(|at| at > revision))
|
||||
.filter(|row| row.minted_at.is_some_and(|at| at > revision))
|
||||
.map(|row| Overheard {
|
||||
speaker: self.speaker_label(row),
|
||||
from: self.perceived_from(row),
|
||||
statement: row.statement.clone(),
|
||||
confidence: row.confidence,
|
||||
})
|
||||
|
|
@ -4586,7 +4616,7 @@ impl SelectedDecision {
|
|||
},
|
||||
"confidence": entry.confidence,
|
||||
"source": entry.source,
|
||||
"spoken_at": entry.spoken_at,
|
||||
"minted_at": entry.minted_at,
|
||||
})
|
||||
})
|
||||
.collect()
|
||||
|
|
@ -4683,14 +4713,18 @@ fn interruption_section(
|
|||
section.push_str("- something in this person's reach changed that it cannot name\n");
|
||||
}
|
||||
if !interruption.overheard.is_empty() {
|
||||
section.push_str("\nWhat was said to this person since:\n");
|
||||
section.push_str("\nWhat was said or done before this person since:\n");
|
||||
for row in &interruption.overheard {
|
||||
let confidence = confidence_name(row.confidence);
|
||||
let statement = row.statement.as_str();
|
||||
match &row.speaker {
|
||||
Some(speaker) => section
|
||||
.push_str(&format!("- {speaker} said: \"{statement}\" ({confidence})\n")),
|
||||
None => section.push_str(&format!(
|
||||
match &row.from {
|
||||
Perceived::Said { by } => {
|
||||
section.push_str(&format!("- {by} said: \"{statement}\" ({confidence})\n"));
|
||||
}
|
||||
Perceived::Seen { by } => section.push_str(&format!(
|
||||
"- {by}, seen doing: \"{statement}\" ({confidence})\n"
|
||||
)),
|
||||
Perceived::Known => section.push_str(&format!(
|
||||
"- this person came to know, without being told: \"{statement}\" ({confidence})\n"
|
||||
)),
|
||||
}
|
||||
|
|
@ -4708,24 +4742,30 @@ fn confidence_name(confidence: Confidence) -> String {
|
|||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
/// The narrative lane speaks and does nothing else, so it finds its entry by
|
||||
/// kind name among the entries the kernel granted this opportunity.
|
||||
/// The narrative lane addresses the room and does nothing else, so it finds
|
||||
/// its entry by kind name among the entries the kernel granted this
|
||||
/// opportunity. A turn that only displays invokes the same entry with no
|
||||
/// utterance: a silent act before the room is still an address.
|
||||
fn speak_invocation(
|
||||
granted: &[AffordanceSnapshot],
|
||||
text: String,
|
||||
speech: Option<String>,
|
||||
display: Option<String>,
|
||||
) -> Result<DecisionInvocation, ControllerError> {
|
||||
let entry = granted
|
||||
.iter()
|
||||
.find(|entry| entry.entry.kind.0 == SPEAK_KIND)
|
||||
.ok_or(ControllerError::SpeakUnavailable)?;
|
||||
let speech = Statement::new(text).ok_or_else(|| {
|
||||
ControllerError::Serialization("Persona proposal is not canonical utterance text".into())
|
||||
})?;
|
||||
let canonical = |text: String, what: &str| {
|
||||
Statement::new(text).ok_or_else(|| {
|
||||
ControllerError::Serialization(format!("Persona {what} is not canonical text"))
|
||||
})
|
||||
};
|
||||
Ok(DecisionInvocation {
|
||||
affordance: entry.id,
|
||||
bindings: Vec::new(),
|
||||
proposed: Vec::new(),
|
||||
speech: Some(speech),
|
||||
speech: speech.map(|text| canonical(text, "utterance")).transpose()?,
|
||||
display: display.map(|text| canonical(text, "display")).transpose()?,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -4744,17 +4784,24 @@ fn narrative_invocation(
|
|||
"Persona work is not ready to submit".into(),
|
||||
));
|
||||
};
|
||||
let span = derive_narrative_capture(turn, interpreter_prompt, completed)?
|
||||
.proposal
|
||||
.ok_or_else(|| {
|
||||
ControllerError::Serialization("Persona work has no exact proposal span".into())
|
||||
})?;
|
||||
let text = turn
|
||||
.source_prose()
|
||||
.get(span.start_byte..span.end_byte)
|
||||
.ok_or_else(|| ControllerError::Serialization("Persona proposal span is not exact".into()))?
|
||||
.to_owned();
|
||||
speak_invocation(granted, text)
|
||||
let capture = derive_narrative_capture(turn, interpreter_prompt, completed)?;
|
||||
if !capture.addresses() {
|
||||
return Err(ControllerError::Serialization(
|
||||
"Persona work has no exact proposal span".into(),
|
||||
));
|
||||
}
|
||||
let quoted = |span: Option<SourceRange>| {
|
||||
span.map(|span| {
|
||||
turn.source_prose()
|
||||
.get(span.start_byte..span.end_byte)
|
||||
.map(str::to_owned)
|
||||
.ok_or_else(|| {
|
||||
ControllerError::Serialization("Persona proposal span is not exact".into())
|
||||
})
|
||||
})
|
||||
.transpose()
|
||||
};
|
||||
speak_invocation(granted, quoted(capture.speech)?, quoted(capture.display)?)
|
||||
}
|
||||
|
||||
fn operational_invocation(
|
||||
|
|
@ -4779,14 +4826,22 @@ fn operational_invocation(
|
|||
}
|
||||
|
||||
fn narrative_capture(
|
||||
report: &InterpretationReport<SpeakProposal>,
|
||||
report: &InterpretationReport<NarrativeProposal>,
|
||||
inference_receipts: Vec<String>,
|
||||
) -> NarrativeCapture {
|
||||
let range = |want: fn(&NarrativeProposal) -> bool| {
|
||||
report
|
||||
.proposals()
|
||||
.iter()
|
||||
.find(|proposal| want(proposal.proposal()))
|
||||
.map(|proposal| SourceRange {
|
||||
start_byte: proposal.source().start_byte(),
|
||||
end_byte: proposal.source().end_byte(),
|
||||
})
|
||||
};
|
||||
NarrativeCapture {
|
||||
proposal: report.proposals().first().map(|proposal| SourceRange {
|
||||
start_byte: proposal.source().start_byte(),
|
||||
end_byte: proposal.source().end_byte(),
|
||||
}),
|
||||
speech: range(|proposal| matches!(proposal, NarrativeProposal::Speak { .. })),
|
||||
display: range(|proposal| matches!(proposal, NarrativeProposal::Display { .. })),
|
||||
gaps: report
|
||||
.gaps()
|
||||
.iter()
|
||||
|
|
@ -4866,10 +4921,12 @@ fn overtaken(
|
|||
));
|
||||
}
|
||||
};
|
||||
// The gap points at the proposal span the interpretation captured, or at
|
||||
// the whole prose when it captured none.
|
||||
let source = derive_narrative_capture(turn, interpreter_prompt, completed)?
|
||||
.proposal
|
||||
// The gap points at the span the interpretation captured, the spoken
|
||||
// words first, or at the whole prose when it captured none.
|
||||
let capture = derive_narrative_capture(turn, interpreter_prompt, completed)?;
|
||||
let source = capture
|
||||
.speech
|
||||
.or(capture.display)
|
||||
.unwrap_or(SourceRange {
|
||||
start_byte: 0,
|
||||
end_byte: turn.source_prose().len(),
|
||||
|
|
@ -4954,8 +5011,12 @@ enum InterpreterLoopEvaluation {
|
|||
/// that sets it is the same call that names it; it is read by the evaluator's
|
||||
/// terminality check and never by a result string.
|
||||
pub(super) struct InterpreterFold {
|
||||
accumulator: InterpretationAccumulator<SpeakProposal>,
|
||||
accumulator: InterpretationAccumulator<NarrativeProposal>,
|
||||
/// One utterance and one visible act per turn: this runner permits one
|
||||
/// decision invocation per opportunity, and an invocation carries one of
|
||||
/// each.
|
||||
captured_speech: bool,
|
||||
captured_display: bool,
|
||||
finished: bool,
|
||||
}
|
||||
|
||||
|
|
@ -4964,11 +5025,54 @@ impl InterpreterFold {
|
|||
Self {
|
||||
accumulator: InterpretationAccumulator::new(source),
|
||||
captured_speech: false,
|
||||
captured_display: false,
|
||||
finished: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// One quoted address, spoken or shown, folded into `fold`. The quoted words
|
||||
/// must be canonical text before they are captured: a quote the kernel would
|
||||
/// refuse is a translation gap here, not an infrastructure fault at
|
||||
/// invocation. A second capture of the same kind is an ambiguity gap.
|
||||
fn capture_address(fold: &mut InterpreterFold, name: &str, source_quote: String) -> String {
|
||||
let (captured, proposal, what) = if name == INTERPRETER_SPEAK_TOOL {
|
||||
(
|
||||
&mut fold.captured_speech,
|
||||
NarrativeProposal::Speak {
|
||||
text: source_quote.clone(),
|
||||
},
|
||||
"speech",
|
||||
)
|
||||
} else {
|
||||
(
|
||||
&mut fold.captured_display,
|
||||
NarrativeProposal::Display {
|
||||
text: source_quote.clone(),
|
||||
},
|
||||
"display",
|
||||
)
|
||||
};
|
||||
let feedback = if *captured {
|
||||
fold.accumulator.record_gap(RecordGapToolCall {
|
||||
kind: TranslationGapKind::Ambiguity,
|
||||
source_quote,
|
||||
detail: format!("More than one {what} proposal was offered; this runner permits one decision invocation per opportunity."),
|
||||
})
|
||||
} else if !super::patch::is_canonical_text(&source_quote) {
|
||||
fold.accumulator.record_gap(RecordGapToolCall {
|
||||
kind: TranslationGapKind::Unresolved,
|
||||
source_quote,
|
||||
detail: format!("The quoted {what} is not canonical text (it is empty, padded, or spans lines), so it was not captured."),
|
||||
})
|
||||
} else {
|
||||
let feedback = fold.accumulator.capture_proposal(proposal, &source_quote);
|
||||
*captured = feedback == CaptureToolFeedback::Accepted;
|
||||
feedback
|
||||
};
|
||||
format!("{feedback:?}")
|
||||
}
|
||||
|
||||
/// One interpreter tool call folded into `fold`, returning exactly the string
|
||||
/// the model is owed for it.
|
||||
pub(super) fn interpreter_tool_result(
|
||||
|
|
@ -4977,42 +5081,16 @@ pub(super) fn interpreter_tool_result(
|
|||
arguments: &str,
|
||||
) -> String {
|
||||
match name {
|
||||
INTERPRETER_SPEAK_TOOL => match serde_json::from_str::<InterpreterSpeakCall>(arguments) {
|
||||
// The quoted words must be canonical utterance text before they
|
||||
// are captured: a quote the kernel would refuse as speech is a
|
||||
// translation gap here, not an infrastructure fault at invocation.
|
||||
Ok(call) if !fold.captured_speech && !super::patch::is_canonical_text(&call.source_quote) => {
|
||||
let feedback = fold.accumulator.record_gap(RecordGapToolCall {
|
||||
kind: TranslationGapKind::Unresolved,
|
||||
source_quote: call.source_quote,
|
||||
detail: "The quoted speech is not canonical utterance text (it is empty, padded, or spans lines), so it was not captured.".into(),
|
||||
});
|
||||
format!("{feedback:?}")
|
||||
INTERPRETER_SPEAK_TOOL | INTERPRETER_DISPLAY_TOOL => {
|
||||
match serde_json::from_str::<InterpreterSpeakCall>(arguments) {
|
||||
Ok(call) => capture_address(fold, name, call.source_quote),
|
||||
Err(error) => format!(
|
||||
"{:?}",
|
||||
fold.accumulator
|
||||
.record_tool_decode_failure(name, arguments, &error.to_string())
|
||||
),
|
||||
}
|
||||
Ok(call) if !fold.captured_speech => {
|
||||
let feedback = fold.accumulator.capture_proposal(
|
||||
SpeakProposal {
|
||||
text: call.source_quote.clone(),
|
||||
},
|
||||
&call.source_quote,
|
||||
);
|
||||
fold.captured_speech = feedback == CaptureToolFeedback::Accepted;
|
||||
format!("{feedback:?}")
|
||||
}
|
||||
Ok(call) => {
|
||||
let feedback = fold.accumulator.record_gap(RecordGapToolCall {
|
||||
kind: TranslationGapKind::Ambiguity,
|
||||
source_quote: call.source_quote,
|
||||
detail: "More than one speech proposal was offered; this runner permits one decision invocation per opportunity.".into(),
|
||||
});
|
||||
format!("{feedback:?}")
|
||||
}
|
||||
Err(error) => format!(
|
||||
"{:?}",
|
||||
fold.accumulator
|
||||
.record_tool_decode_failure(name, arguments, &error.to_string())
|
||||
),
|
||||
},
|
||||
}
|
||||
INTERPRETER_RECORD_GAP_TOOL => match serde_json::from_str::<RecordGapToolCall>(arguments) {
|
||||
Ok(call) => format!("{:?}", fold.accumulator.record_gap(call)),
|
||||
Err(error) => format!(
|
||||
|
|
@ -5743,10 +5821,11 @@ fn evaluate_operational_loop(
|
|||
Ok(OperationalLoopEvaluation::Continue { conversation })
|
||||
}
|
||||
|
||||
/// The one argument shape of `speak` and `display`: the words, quoted verbatim
|
||||
/// from the Persona prose.
|
||||
#[derive(Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
struct InterpreterSpeakCall {
|
||||
/// The spoken words, quoted verbatim from the Persona prose.
|
||||
source_quote: String,
|
||||
}
|
||||
|
||||
|
|
@ -5932,6 +6011,16 @@ fn interpreter_tools() -> Vec<CodexToolDefinition> {
|
|||
),
|
||||
)]),
|
||||
),
|
||||
tool_schema::tool(
|
||||
INTERPRETER_DISPLAY_TOOL,
|
||||
"Capture one exact visible act from the preserved Persona prose: a gesture, a posture, a look, a movement, a silence held, anything another person in the same place could see. Quote the visible clause alone, verbatim; what the person hoped, meant, or felt while doing it is not visible and is not part of the quote. The harness locates the quote in the prose and records a gap instead if it is not there word for word.",
|
||||
tool_schema::object(vec![(
|
||||
"source_quote".into(),
|
||||
tool_schema::canonical_string(
|
||||
"the visible act exactly as it appears in the Persona prose",
|
||||
),
|
||||
)]),
|
||||
),
|
||||
tool_schema::tool(
|
||||
INTERPRETER_RECORD_GAP_TOOL,
|
||||
"Preserve meaningful source prose that has no safe current typed translation.",
|
||||
|
|
@ -6181,6 +6270,7 @@ fn decode_catalog_call(
|
|||
bindings,
|
||||
proposed,
|
||||
speech,
|
||||
display: None,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -6490,17 +6580,29 @@ mod tests {
|
|||
offices_held: Vec::new(),
|
||||
offices_granted: Vec::new(),
|
||||
redress: Vec::new(),
|
||||
knowledge: vec![KnowledgeSnapshot {
|
||||
fact: heard,
|
||||
statement: Statement::new("The lower hinge is flooding.").unwrap(),
|
||||
standing: FactStandingView::Claimed { by: speaker_id },
|
||||
confidence: Confidence::Believed,
|
||||
source: KnowledgeSource::Told {
|
||||
by: speaker_id,
|
||||
via: None,
|
||||
knowledge: vec![
|
||||
KnowledgeSnapshot {
|
||||
fact: heard,
|
||||
statement: Statement::new("The lower hinge is flooding.").unwrap(),
|
||||
standing: FactStandingView::Claimed { by: speaker_id },
|
||||
confidence: Confidence::Believed,
|
||||
source: KnowledgeSource::Told {
|
||||
by: speaker_id,
|
||||
via: None,
|
||||
},
|
||||
minted_at: Some(40),
|
||||
},
|
||||
spoken_at: Some(40),
|
||||
}],
|
||||
// Mara also saw Iris do something. The row is Iris's own
|
||||
// sentence, marked as seen and never as said.
|
||||
KnowledgeSnapshot {
|
||||
fact: EntityId::issue(),
|
||||
statement: Statement::new("I set the ledger face down.").unwrap(),
|
||||
standing: FactStandingView::Claimed { by: speaker_id },
|
||||
confidence: Confidence::Believed,
|
||||
source: KnowledgeSource::Seen { by: speaker_id },
|
||||
minted_at: Some(41),
|
||||
},
|
||||
],
|
||||
commitments: Vec::new(),
|
||||
pressures: Vec::new(),
|
||||
qualified: false,
|
||||
|
|
@ -6525,7 +6627,7 @@ mod tests {
|
|||
standing: FactStandingView::Canonical,
|
||||
confidence: Confidence::Certain,
|
||||
source: KnowledgeSource::Witnessed,
|
||||
spoken_at: None,
|
||||
minted_at: None,
|
||||
}],
|
||||
commitments: Vec::new(),
|
||||
pressures: Vec::new(),
|
||||
|
|
@ -6585,6 +6687,12 @@ mod tests {
|
|||
assert!(projector_surface.contains("Iris in the tollhouse"));
|
||||
assert!(projector_surface.contains("The lower hinge is flooding."));
|
||||
assert!(!projector_surface.contains("The tollhouse ledger is short."));
|
||||
let rows: Vec<Value> = serde_json::from_str(&stimulus).unwrap();
|
||||
assert_eq!(rows[0]["how"], "said");
|
||||
assert_eq!(rows[0]["by"], "Iris in the tollhouse");
|
||||
assert_eq!(rows[1]["how"], "seen_doing");
|
||||
assert_eq!(rows[1]["by"], "Iris in the tollhouse");
|
||||
assert_eq!(rows[1]["text"], "I set the ledger face down.");
|
||||
|
||||
let operational_surface = selected.typed_view().unwrap();
|
||||
assert!(operational_surface.contains("state_digest"));
|
||||
|
|
@ -6634,6 +6742,7 @@ mod tests {
|
|||
}],
|
||||
proposed: Vec::new(),
|
||||
speech: Some(Statement::new(utterance).unwrap()),
|
||||
display: None,
|
||||
},
|
||||
},
|
||||
),
|
||||
|
|
@ -7488,6 +7597,77 @@ mod tests {
|
|||
/// A quote the kernel would refuse as speech is a translation gap at
|
||||
/// capture, never an infrastructure fault at invocation: on the second SDK
|
||||
/// road run a mis-spanned utterance failed the canonical-text rule inside
|
||||
|
||||
/// The display tool is `speak`'s twin: a padded quote is a gap and not a
|
||||
/// capture, a second display is an ambiguity gap, and speech plus display
|
||||
/// in one turn is one capture of each, bound to its own span and lowered
|
||||
/// into one invocation carrying both.
|
||||
#[test]
|
||||
fn a_display_is_captured_beside_speech_and_at_most_once() {
|
||||
let opportunity = fixture_opportunity(ControllerMode::NarrativePersona);
|
||||
let source = "I fold my arms. \"The rain has teeth tonight,\" I say, and I don't look up.";
|
||||
let turn = fixture_persona_turn(&opportunity, source);
|
||||
let quote = |words: &str| json!({ "source_quote": words }).to_string();
|
||||
|
||||
let mut fold = InterpreterFold::new(turn.clone());
|
||||
assert_eq!(
|
||||
interpreter_tool_result(&mut fold, INTERPRETER_DISPLAY_TOOL, "e("I fold my arms.")),
|
||||
"Accepted"
|
||||
);
|
||||
assert_eq!(
|
||||
interpreter_tool_result(
|
||||
&mut fold,
|
||||
INTERPRETER_SPEAK_TOOL,
|
||||
"e("The rain has teeth tonight,")
|
||||
),
|
||||
"Accepted"
|
||||
);
|
||||
interpreter_tool_result(&mut fold, INTERPRETER_DISPLAY_TOOL, "e("I don't look up."));
|
||||
assert!(fold.captured_display && fold.captured_speech);
|
||||
let report = fold
|
||||
.accumulator
|
||||
.finalize(InterpretationFinalization::InterpreterFinished);
|
||||
assert_eq!(report.proposals().len(), 2);
|
||||
assert_eq!(report.gaps().len(), 1);
|
||||
assert_eq!(report.gaps()[0].kind(), TranslationGapKind::Ambiguity);
|
||||
assert!(report.spans_are_exact());
|
||||
|
||||
let capture = narrative_capture(&report, Vec::new());
|
||||
let words = |range: Option<SourceRange>| {
|
||||
range.map(|range| &source[range.start_byte..range.end_byte])
|
||||
};
|
||||
assert_eq!(words(capture.speech), Some("The rain has teeth tonight,"));
|
||||
assert_eq!(words(capture.display), Some("I fold my arms."));
|
||||
let granted = [speak_snapshot(opportunity.affordance_ids[0])];
|
||||
let invocation = speak_invocation(
|
||||
&granted,
|
||||
words(capture.speech).map(str::to_owned),
|
||||
words(capture.display).map(str::to_owned),
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
invocation.speech.as_ref().map(Statement::as_str),
|
||||
Some("The rain has teeth tonight,")
|
||||
);
|
||||
assert_eq!(
|
||||
invocation.display.as_ref().map(Statement::as_str),
|
||||
Some("I fold my arms.")
|
||||
);
|
||||
// A silent turn lowers to the same entry with no utterance.
|
||||
let silent = speak_invocation(&granted, None, Some("I fold my arms.".into())).unwrap();
|
||||
assert!(silent.speech.is_none() && silent.display.is_some());
|
||||
|
||||
// A padded display quote is a gap bound to its span, not a capture.
|
||||
let mut fold = InterpreterFold::new(turn.clone());
|
||||
interpreter_tool_result(&mut fold, INTERPRETER_DISPLAY_TOOL, "e(" I fold my arms."));
|
||||
assert!(!fold.captured_display);
|
||||
let report = fold
|
||||
.accumulator
|
||||
.finalize(InterpretationFinalization::InterpreterFinished);
|
||||
assert!(report.proposals().is_empty());
|
||||
assert_eq!(report.gaps().len(), 1);
|
||||
}
|
||||
|
||||
/// `speak_invocation` and quarantined the whole cell.
|
||||
#[test]
|
||||
fn a_non_canonical_or_absent_quote_is_a_gap_not_a_quarantine() {
|
||||
|
|
@ -8325,7 +8505,7 @@ mod tests {
|
|||
panic!("turn remained pending")
|
||||
};
|
||||
assert_eq!(
|
||||
decision.capture.proposal,
|
||||
decision.capture.speech,
|
||||
Some(SourceRange {
|
||||
start_byte: start,
|
||||
end_byte: start + speech.len(),
|
||||
|
|
@ -8482,7 +8662,7 @@ mod tests {
|
|||
else {
|
||||
panic!("narrative decline remained pending")
|
||||
};
|
||||
assert!(decision.capture.proposal.is_none());
|
||||
assert!(!decision.capture.addresses());
|
||||
assert_eq!(decision.capture.gaps.len(), 1);
|
||||
let applied = match decision.submission {
|
||||
SubmissionDisposition::NoProposal(SubmitReceipt::Applied(receipt)) => receipt,
|
||||
|
|
@ -8714,7 +8894,7 @@ mod tests {
|
|||
assert!(replay_port.seen.load(Ordering::SeqCst));
|
||||
assert_eq!(decision.turn.source_prose(), source);
|
||||
assert_eq!(
|
||||
decision.capture.proposal,
|
||||
decision.capture.speech,
|
||||
Some(SourceRange {
|
||||
start_byte: start,
|
||||
end_byte: start + speech.len(),
|
||||
|
|
@ -8916,6 +9096,7 @@ mod tests {
|
|||
bindings: Vec::new(),
|
||||
proposed: Vec::new(),
|
||||
speech: Some(Statement::new(seed).unwrap()),
|
||||
display: None,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -9005,7 +9186,7 @@ mod tests {
|
|||
assert!(!persona_prose.trim().is_empty());
|
||||
assert!(persona_prose.len() <= 65_536);
|
||||
assert!(!narrative_decision.capture().inference_receipts.is_empty());
|
||||
let narrative_span = narrative_decision.capture().proposal.unwrap();
|
||||
let narrative_span = narrative_decision.capture().speech.unwrap();
|
||||
let narrative_speech = persona_prose
|
||||
.get(narrative_span.start_byte..narrative_span.end_byte)
|
||||
.unwrap()
|
||||
|
|
@ -12232,6 +12413,10 @@ mod tests {
|
|||
/// A co-located neighbour speaks. `fan_out` gives the fact to the actor,
|
||||
/// so its `knows` grows and its digest moves.
|
||||
Speech { speaker: SubjectId, text: String },
|
||||
/// A co-located neighbour does something visible and says nothing.
|
||||
/// The same fan-out, a `Seen { by }` row, and an overheard row that
|
||||
/// names the actor as seen and never as heard.
|
||||
Display { actor: SubjectId, text: String },
|
||||
/// An owner patch creates a commitment on the actor. Its `commitments`
|
||||
/// move and nothing names a mover anywhere in the components.
|
||||
Commitment { subject: SubjectId },
|
||||
|
|
@ -12241,7 +12426,7 @@ mod tests {
|
|||
/// from under it, a commitment that names a counterparty.
|
||||
Ops(Vec<crate::world::patch::ComponentOp>),
|
||||
/// An owner patch witnessing a pre-declared fact over `place`. Unlike a
|
||||
/// neighbour's speech, this names no speaker and writes no `spoken_at`
|
||||
/// neighbour's speech, this names no speaker and writes no `minted_at`
|
||||
/// row: `KnowledgeSource::Witnessed` is not `Told`, so
|
||||
/// `overheard_since` finds nothing and the section renders only the
|
||||
/// anonymous `knows` line.
|
||||
|
|
@ -12275,11 +12460,42 @@ mod tests {
|
|||
bindings: Vec::new(),
|
||||
proposed: Vec::new(),
|
||||
speech: Some(Statement::new(text.clone()).unwrap()),
|
||||
display: None,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.expect("the mid-turn speech committed");
|
||||
}
|
||||
MidTurnCommit::Display { actor, text } => {
|
||||
let opportunity = snapshot
|
||||
.opportunities
|
||||
.iter()
|
||||
.find(|entry| entry.scope.subject_id == *actor)
|
||||
.expect("the actor has a live opportunity")
|
||||
.clone();
|
||||
let entry = snapshot
|
||||
.affordances
|
||||
.iter()
|
||||
.find(|entry| {
|
||||
entry.entry.kind.0 == SPEAK_KIND
|
||||
&& opportunity.affordance_ids.contains(&entry.id)
|
||||
})
|
||||
.expect("the actor was granted speech");
|
||||
mailbox
|
||||
.submit_controller(
|
||||
CommandId::new(),
|
||||
&opportunity,
|
||||
DecisionInvocation {
|
||||
affordance: entry.id,
|
||||
bindings: Vec::new(),
|
||||
proposed: Vec::new(),
|
||||
speech: None,
|
||||
display: Some(Statement::new(text.clone()).unwrap()),
|
||||
},
|
||||
)
|
||||
.await
|
||||
.expect("the mid-turn display committed");
|
||||
}
|
||||
MidTurnCommit::Commitment { subject } => {
|
||||
let owner = PrincipalId::new("owner");
|
||||
let authenticated =
|
||||
|
|
@ -12541,6 +12757,65 @@ mod tests {
|
|||
(subject, opportunity)
|
||||
}
|
||||
|
||||
/// A co-located neighbour does something visible, silently, between the
|
||||
/// turn and its submit. The re-lowering's section reports it as seen, by
|
||||
/// the actor's label, and never as something said.
|
||||
#[tokio::test]
|
||||
async fn a_neighbours_display_between_the_turn_and_submit_is_reported_as_seen() {
|
||||
let (_directory, mailbox, task) = active_cell_mailbox(vec![
|
||||
NewController::NarrativePersona,
|
||||
NewController::OperationalAgent,
|
||||
])
|
||||
.await;
|
||||
let (actor, opportunity) = narrative_opportunity(&mailbox).await;
|
||||
let neighbour = mailbox
|
||||
.snapshot()
|
||||
.await
|
||||
.unwrap()
|
||||
.subjects
|
||||
.iter()
|
||||
.find(|subject| subject.id != actor)
|
||||
.expect("a neighbour")
|
||||
.id;
|
||||
let source = "I say, \"The western brace is giving way.\"";
|
||||
let turn = interrupted_turn(
|
||||
&mailbox,
|
||||
source,
|
||||
"The western brace is giving way.",
|
||||
2,
|
||||
vec![(
|
||||
2,
|
||||
MidTurnCommit::Display {
|
||||
actor: neighbour,
|
||||
text: "I set the ledger face down.".into(),
|
||||
},
|
||||
)],
|
||||
);
|
||||
let run = turn
|
||||
.runner
|
||||
.run_narrative(CommandId::new(), &opportunity)
|
||||
.await
|
||||
.unwrap();
|
||||
assert!(matches!(run, NarrativeRun::Completed(_)));
|
||||
let seen = turn.seen.lock().unwrap();
|
||||
assert_eq!(seen.len(), 4);
|
||||
let section = interruption_section_of(&seen[3]).expect("the re-lowered prompt has no section");
|
||||
for expected in [
|
||||
"- what this person knows changed",
|
||||
"What was said or done before this person since:",
|
||||
"Subject 1, seen doing:",
|
||||
"I set the ledger face down.",
|
||||
] {
|
||||
assert!(
|
||||
section.contains(expected),
|
||||
"the interruption section dropped `{expected}`: {section}"
|
||||
);
|
||||
}
|
||||
assert!(!section.contains("said:"), "a display was reported as speech: {section}");
|
||||
drop(seen);
|
||||
task.abort();
|
||||
}
|
||||
|
||||
/// Tests 1 and 4. A co-located speaker commits after the Persona turn is
|
||||
/// recorded and before the subject's submit. The prose is lowered exactly
|
||||
/// once more, the section names the speaker and the statement, the renewed
|
||||
|
|
@ -12636,7 +12911,7 @@ mod tests {
|
|||
.expect("the re-lowered prompt has no section");
|
||||
for expected in [
|
||||
"- what this person knows changed",
|
||||
"What was said to this person since:",
|
||||
"What was said or done before this person since:",
|
||||
"Subject 1 said:",
|
||||
"The tollhouse ledger is short.",
|
||||
] {
|
||||
|
|
@ -12645,8 +12920,8 @@ mod tests {
|
|||
"the interruption section dropped `{expected}`: {section}"
|
||||
);
|
||||
}
|
||||
// No fact id, no revision, no digest, and no `spoken_at`.
|
||||
for leaked in ["spoken_at", "sha256:", "revision", "scope_digest"] {
|
||||
// No fact id, no revision, no digest, and no `minted_at`.
|
||||
for leaked in ["minted_at", "sha256:", "revision", "scope_digest"] {
|
||||
assert!(
|
||||
!section.contains(leaked),
|
||||
"the interruption section leaked `{leaked}`"
|
||||
|
|
@ -12660,7 +12935,7 @@ mod tests {
|
|||
|
||||
/// Tests 2 and 3. A patch landing mid-turn moves a component that names no
|
||||
/// actor anywhere. The section carries the anonymous line for the moved
|
||||
/// field and no `What was said to this person since:` block at all.
|
||||
/// field and no `What was said or done before this person since:` block at all.
|
||||
#[tokio::test]
|
||||
async fn a_change_with_no_author_is_re_lowered_with_no_overheard_block() {
|
||||
let (_directory, mailbox, task) = active_cell_mailbox(vec![
|
||||
|
|
@ -12694,7 +12969,7 @@ mod tests {
|
|||
.expect("the re-lowered prompt has no section");
|
||||
assert!(section.contains("- what this person owes changed"));
|
||||
assert!(
|
||||
!section.contains("What was said to this person since:"),
|
||||
!section.contains("What was said or done before this person since:"),
|
||||
"an anonymous change produced an overheard block: {section}"
|
||||
);
|
||||
for leaked in ["Subject 1", " said:", "came to know"] {
|
||||
|
|
@ -12874,7 +13149,7 @@ mod tests {
|
|||
/// every other un-authored cause, over the same anonymous `knows` line as
|
||||
/// `every_un_authored_cause_is_re_lowered_with_no_actor_and_no_value`'s own
|
||||
/// `AcquireKnowledge`-shaped causes. Unlike a neighbour's speech, the row a
|
||||
/// witness writes carries no `spoken_at` (`KnowledgeSource::Witnessed` is
|
||||
/// witness writes carries no `minted_at` (`KnowledgeSource::Witnessed` is
|
||||
/// not `Told`), so `overheard_since` finds nothing this turn's binding
|
||||
/// postdates, and the section must carry no `Overheard` block at all — not
|
||||
/// even an empty one.
|
||||
|
|
@ -12920,7 +13195,7 @@ mod tests {
|
|||
"the witness cause did not report the anonymous knows line: {section}"
|
||||
);
|
||||
assert!(
|
||||
!section.contains("What was said to this person since:"),
|
||||
!section.contains("What was said or done before this person since:"),
|
||||
"a witness produced an overheard block: {section}"
|
||||
);
|
||||
for leaked in [
|
||||
|
|
@ -12928,7 +13203,7 @@ mod tests {
|
|||
"Subject 1",
|
||||
" said:",
|
||||
"came to know",
|
||||
"spoken_at",
|
||||
"minted_at",
|
||||
] {
|
||||
assert!(
|
||||
!section.contains(leaked),
|
||||
|
|
@ -13152,7 +13427,7 @@ mod tests {
|
|||
let section = interruption_section_of(&second_interpreter)
|
||||
.expect("the re-lowered prompt has no section");
|
||||
assert!(section.contains("- what this person owes changed"));
|
||||
assert!(!section.contains("What was said to this person since:"));
|
||||
assert!(!section.contains("What was said or done before this person since:"));
|
||||
for leaked in [
|
||||
"The vault seal is broken.",
|
||||
"Subject 1",
|
||||
|
|
@ -13519,7 +13794,7 @@ mod tests {
|
|||
"{name} did not report `{expected_line}`: {section}"
|
||||
);
|
||||
assert!(
|
||||
!section.contains("What was said to this person since:"),
|
||||
!section.contains("What was said or done before this person since:"),
|
||||
"{name} produced an overheard block: {section}"
|
||||
);
|
||||
// Nothing that could name a mover, a value, or a thing: the section
|
||||
|
|
|
|||
|
|
@ -636,6 +636,7 @@ pub(super) fn verify_state_shape(state: &WorldState) -> Result<(), JournalError>
|
|||
state.subjects.contains_key(&by)
|
||||
&& via.is_none_or(|channel| state.channels.contains_key(&channel))
|
||||
}
|
||||
super::KnowledgeSource::Seen { by } => state.subjects.contains_key(&by),
|
||||
super::KnowledgeSource::Witnessed | super::KnowledgeSource::Evidenced => true,
|
||||
};
|
||||
if !state.subjects.contains_key(subject_id)
|
||||
|
|
@ -889,17 +890,21 @@ pub(super) fn verify_state_shape(state: &WorldState) -> Result<(), JournalError>
|
|||
.affordance_catalog
|
||||
.get(&event.affordance)
|
||||
.ok_or_else(|| JournalError::Corrupt("event uses an unknown affordance".into()))?;
|
||||
// A speech event names the claim it minted, and that claim is asserted
|
||||
// by the acting subject and by no other event.
|
||||
let speech_is_canonical = event.speech.is_none_or(|fact| {
|
||||
claimed.insert(fact)
|
||||
&& state.facts.get(&fact).is_some_and(|record| {
|
||||
record.standing
|
||||
== super::FactStanding::Claimed {
|
||||
by: event.scope.subject_id,
|
||||
}
|
||||
})
|
||||
});
|
||||
// A speech or display event names the claim it minted, and that claim
|
||||
// is asserted by the acting subject and by no other event.
|
||||
let mut minted_is_canonical = |fact: Option<super::EntityId>| {
|
||||
fact.is_none_or(|fact| {
|
||||
claimed.insert(fact)
|
||||
&& state.facts.get(&fact).is_some_and(|record| {
|
||||
record.standing
|
||||
== super::FactStanding::Claimed {
|
||||
by: event.scope.subject_id,
|
||||
}
|
||||
})
|
||||
})
|
||||
};
|
||||
let speech_is_canonical = minted_is_canonical(event.speech);
|
||||
let display_is_canonical = minted_is_canonical(event.display);
|
||||
if !event_ids.insert(event.id)
|
||||
|| event.revision == 0
|
||||
|| event.revision > state.revision
|
||||
|
|
@ -912,13 +917,19 @@ pub(super) fn verify_state_shape(state: &WorldState) -> Result<(), JournalError>
|
|||
.get(&event.scope)
|
||||
.is_some_and(|granted| granted.contains(&event.affordance))
|
||||
|| event.band >= entry.outcome_bands.len()
|
||||
|| event.speech.is_some() != entry.carries_speech
|
||||
// Speech rides only a speech-carrying entry; such an entry always
|
||||
// addresses someone, by words or by a visible act; a display may
|
||||
// accompany any entry.
|
||||
|| (event.speech.is_some() && !entry.carries_speech)
|
||||
|| (entry.carries_speech && event.speech.is_none() && event.display.is_none())
|
||||
// One lowered operation per band effect, plus the two the speech
|
||||
// lowering prepends.
|
||||
// lowering prepends and the two the display lowering adds.
|
||||
|| entry.outcome_bands[event.band].effects.len()
|
||||
+ if event.speech.is_some() { 2 } else { 0 }
|
||||
+ if event.display.is_some() { 2 } else { 0 }
|
||||
!= event.effects.len()
|
||||
|| !speech_is_canonical
|
||||
|| !display_is_canonical
|
||||
{
|
||||
return Err(JournalError::Corrupt(
|
||||
"decision event is noncanonical or violates controller scope".into(),
|
||||
|
|
@ -1426,6 +1437,7 @@ mod tests {
|
|||
magnitude: Magnitude::Quantity(Quantity(2)),
|
||||
}],
|
||||
speech: None,
|
||||
display: None,
|
||||
},
|
||||
},
|
||||
),
|
||||
|
|
@ -1706,6 +1718,7 @@ mod tests {
|
|||
magnitude: Magnitude::Quantity(Quantity(3)),
|
||||
}],
|
||||
speech: None,
|
||||
display: None,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
|
@ -2091,6 +2104,7 @@ mod custody_tests {
|
|||
magnitude: Magnitude::Quantity(Quantity(2)),
|
||||
}],
|
||||
speech: None,
|
||||
display: None,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1407,6 +1407,7 @@ mod tests {
|
|||
bindings: Vec::new(),
|
||||
proposed: Vec::new(),
|
||||
speech: Some(crate::world::Statement::new(text).unwrap()),
|
||||
display: None,
|
||||
};
|
||||
mailbox
|
||||
.submit_controller(
|
||||
|
|
@ -1474,6 +1475,7 @@ mod tests {
|
|||
bindings: Vec::new(),
|
||||
proposed: Vec::new(),
|
||||
speech: Some(crate::world::Statement::new("Let me in.").unwrap()),
|
||||
display: None,
|
||||
},
|
||||
)
|
||||
.await;
|
||||
|
|
|
|||
|
|
@ -81,8 +81,8 @@ use std::path::Path;
|
|||
use thiserror::Error;
|
||||
use uuid::Uuid;
|
||||
|
||||
pub(crate) const STATE_SCHEMA: &str = "ghostlight.world_state.consumer.v3";
|
||||
pub(crate) const COMMIT_SCHEMA: &str = "ghostlight.world_commit.consumer.v3";
|
||||
pub(crate) const STATE_SCHEMA: &str = "ghostlight.world_state.consumer.v4";
|
||||
pub(crate) const COMMIT_SCHEMA: &str = "ghostlight.world_commit.consumer.v4";
|
||||
|
||||
/// Compatibility tag derived from [`STATE_SCHEMA`]: the trailing
|
||||
/// `<family>-<version>` pair (e.g. `foundation-v1`). Callers that publish a
|
||||
|
|
@ -554,6 +554,10 @@ pub(crate) struct DecisionInvocation {
|
|||
/// Command input, and the only place an utterance's text enters the kernel.
|
||||
/// The committed home of those bytes is `facts[fact].statement`.
|
||||
pub(crate) speech: Option<Statement>,
|
||||
/// A visible act in the actor's own words, and the only place it enters
|
||||
/// the kernel. It accompanies any invocation: a body is visible whatever
|
||||
/// it is doing. Its audience is the actor's place, never the entry's.
|
||||
pub(crate) display: Option<Statement>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
|
|
@ -695,6 +699,8 @@ pub(crate) struct DecisionEvent {
|
|||
/// event is the world's record and every reader reads it, so it carries the
|
||||
/// fact id and the statement lives in `facts` alone.
|
||||
pub(crate) speech: Option<EntityId>,
|
||||
/// The claim this act displayed, if it carried a visible act. Same rule.
|
||||
pub(crate) display: Option<EntityId>,
|
||||
/// Index into the entry's `outcome_bands`. Re-derived and compared at apply
|
||||
/// and at replay, never trusted.
|
||||
pub(crate) band: usize,
|
||||
|
|
@ -895,7 +901,7 @@ pub(crate) struct SubjectSnapshot {
|
|||
pub(crate) redress: Vec<ForumSnapshot>,
|
||||
/// Every fact this subject holds, with the statement resolved. The sole
|
||||
/// perception surface: a subject perceives a speech act if and only if it
|
||||
/// holds `Knowledge` of that act's fact. Ordered by `spoken_at` then `fact`.
|
||||
/// holds `Knowledge` of that act's fact. Ordered by `minted_at` then `fact`.
|
||||
pub(crate) knowledge: Vec<KnowledgeSnapshot>,
|
||||
/// Digest-bound, lowered from the one `scope_components` call `snapshot`
|
||||
/// already makes, so view and digest cannot drift. Carries `past_due`,
|
||||
|
|
@ -948,9 +954,9 @@ pub(crate) struct KnowledgeSnapshot {
|
|||
/// was never told sees the statement with no speaker, which is correct: it
|
||||
/// knows the thing, not the telling.
|
||||
pub(crate) source: KnowledgeSource,
|
||||
/// The revision of the speech act that minted this claim, when some
|
||||
/// committed event asserted it.
|
||||
pub(crate) spoken_at: Option<u64>,
|
||||
/// The revision of the act that minted this claim, spoken or displayed,
|
||||
/// when some committed event asserted it.
|
||||
pub(crate) minted_at: Option<u64>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
|
|
@ -1050,6 +1056,7 @@ pub(crate) struct OperatorEvent {
|
|||
pub(crate) speaker: SubjectId,
|
||||
pub(crate) speaker_label: String,
|
||||
pub(crate) speech: Option<Statement>,
|
||||
pub(crate) display: Option<Statement>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
|
|
@ -2583,6 +2590,34 @@ fn apply_operation(
|
|||
);
|
||||
}
|
||||
}
|
||||
ResolvedOp::Display { actor, fact } => {
|
||||
if !state.subjects.contains_key(actor) || !state.facts.contains_key(fact) {
|
||||
return Err(KernelError::Invariant(
|
||||
"a display names no live actor or fact".into(),
|
||||
));
|
||||
}
|
||||
// The room is the audience, re-derived here: the same derivation
|
||||
// co-located speech uses, so a body and a voice cannot disagree
|
||||
// about who is in the room. A placeless actor is refused as a
|
||||
// placeless speaker is; an empty room is a legal no-op, as
|
||||
// speaking alone is. `Believed` is fixed by the kernel: a
|
||||
// displayer cannot choose how much a viewer believes its body.
|
||||
let room = Audience::Colocated;
|
||||
if !can_broadcast(state, *actor, &room) {
|
||||
return Err(KernelError::Invariant(
|
||||
"an actor displays from no place".into(),
|
||||
));
|
||||
}
|
||||
for viewer in fan_out(state, *actor, *fact, &room) {
|
||||
state.knowledge.entry(viewer).or_default().insert(
|
||||
*fact,
|
||||
Knowledge {
|
||||
confidence: Confidence::Believed,
|
||||
source: KnowledgeSource::Seen { by: *actor },
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
ResolvedOp::Witness {
|
||||
fact,
|
||||
place,
|
||||
|
|
@ -3248,6 +3283,10 @@ fn operator_log(state: &WorldState) -> Result<Vec<OperatorEvent>, KernelError> {
|
|||
.speech
|
||||
.and_then(|fact| state.facts.get(&fact))
|
||||
.map(|record| record.statement.clone()),
|
||||
display: event
|
||||
.display
|
||||
.and_then(|fact| state.facts.get(&fact))
|
||||
.map(|record| record.statement.clone()),
|
||||
})
|
||||
})
|
||||
.collect()
|
||||
|
|
@ -3411,10 +3450,16 @@ fn agency_graph(state: &WorldState) -> AgencyGraph {
|
|||
fn snapshot(state: &WorldState) -> Result<WorldSnapshot, KernelError> {
|
||||
// One pass over the causal record so each subject's own knowledge map can be
|
||||
// stamped with the revision that minted each claim it holds.
|
||||
let spoken_at: BTreeMap<EntityId, u64> = state
|
||||
let minted_at: BTreeMap<EntityId, u64> = state
|
||||
.events
|
||||
.iter()
|
||||
.filter_map(|event| event.speech.map(|fact| (fact, event.revision)))
|
||||
.flat_map(|event| {
|
||||
event
|
||||
.speech
|
||||
.into_iter()
|
||||
.chain(event.display)
|
||||
.map(move |fact| (fact, event.revision))
|
||||
})
|
||||
.collect();
|
||||
let subjects = state
|
||||
.subjects
|
||||
|
|
@ -3495,11 +3540,11 @@ fn snapshot(state: &WorldState) -> Result<WorldSnapshot, KernelError> {
|
|||
},
|
||||
confidence: held.confidence,
|
||||
source: held.source,
|
||||
spoken_at: spoken_at.get(fact).copied(),
|
||||
minted_at: minted_at.get(fact).copied(),
|
||||
})
|
||||
})
|
||||
.collect::<Result<Vec<_>, KernelError>>()?;
|
||||
knowledge.sort_by_key(|entry| (entry.spoken_at, entry.fact));
|
||||
knowledge.sort_by_key(|entry| (entry.minted_at, entry.fact));
|
||||
Ok(SubjectSnapshot {
|
||||
id: *subject_id,
|
||||
label: subject.label.clone(),
|
||||
|
|
@ -4471,7 +4516,9 @@ fn operation_ground(
|
|||
ResolvedOp::AcquireKnowledge { subject, .. } | ResolvedOp::Forget { subject, .. } => {
|
||||
(vec![*subject], Vec::new(), Vec::new())
|
||||
}
|
||||
ResolvedOp::Communicate { speaker, .. } => (vec![*speaker], Vec::new(), Vec::new()),
|
||||
ResolvedOp::Communicate { speaker, .. } | ResolvedOp::Display { actor: speaker, .. } => {
|
||||
(vec![*speaker], Vec::new(), Vec::new())
|
||||
}
|
||||
// The place is the whole ground. Confining by it is not weaker than
|
||||
// confining by the recipients: `covers_place` is transitive, so every
|
||||
// subject the fan-out selects stands under the place, and a place
|
||||
|
|
@ -6187,6 +6234,7 @@ mod tests {
|
|||
bindings: Vec::new(),
|
||||
proposed: Vec::new(),
|
||||
speech: Some(Statement::new(text).unwrap()),
|
||||
display: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -6600,6 +6648,7 @@ mod tests {
|
|||
bindings: Vec::new(),
|
||||
proposed: Vec::new(),
|
||||
speech: Some(Statement::new("No grant").unwrap()),
|
||||
display: None,
|
||||
};
|
||||
assert!(matches!(
|
||||
kernel.submit(
|
||||
|
|
@ -6633,6 +6682,7 @@ mod tests {
|
|||
bindings: Vec::new(),
|
||||
proposed: Vec::new(),
|
||||
speech: Some(Statement::new("Forged").unwrap()),
|
||||
display: None,
|
||||
},
|
||||
opportunity: tampered,
|
||||
},
|
||||
|
|
@ -7344,6 +7394,7 @@ mod tests {
|
|||
bindings: Vec::new(),
|
||||
proposed: Vec::new(),
|
||||
speech: Some(Statement::new("Not my grant.").unwrap()),
|
||||
display: None,
|
||||
},
|
||||
},
|
||||
),
|
||||
|
|
@ -7409,6 +7460,7 @@ mod tests {
|
|||
bindings: Vec::new(),
|
||||
proposed: Vec::new(),
|
||||
speech: Some(Statement::new("The council convenes.").unwrap()),
|
||||
display: None,
|
||||
},
|
||||
},
|
||||
),
|
||||
|
|
@ -7503,6 +7555,7 @@ mod tests {
|
|||
bindings: Vec::new(),
|
||||
proposed: Vec::new(),
|
||||
speech: Some(Statement::new("Still here.").unwrap()),
|
||||
display: None,
|
||||
},
|
||||
},
|
||||
),
|
||||
|
|
@ -7607,6 +7660,7 @@ mod tests {
|
|||
magnitude: Magnitude::Quantity(Quantity(3)),
|
||||
}],
|
||||
speech: None,
|
||||
display: None,
|
||||
},
|
||||
},
|
||||
),
|
||||
|
|
@ -8616,6 +8670,7 @@ mod custody_tests {
|
|||
bindings: Vec::new(),
|
||||
proposed: Vec::new(),
|
||||
speech: Some(Statement::new("The tithe is short.").unwrap()),
|
||||
display: None,
|
||||
},
|
||||
},
|
||||
),
|
||||
|
|
@ -8903,6 +8958,7 @@ mod custody_tests {
|
|||
bindings: Vec::new(),
|
||||
proposed: Vec::new(),
|
||||
speech: Some(Statement::new("Counted before the tithe arrived.").unwrap()),
|
||||
display: None,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -8944,6 +9000,7 @@ mod custody_tests {
|
|||
mod knowledge_tests {
|
||||
use super::patch::{RefName, Site};
|
||||
use super::tests::{
|
||||
affordance_named,
|
||||
FLOOD_EVIDENCE, FLOOD_STATEMENT, Speech, auth_principal, command, creation, operations,
|
||||
opportunity_for, owner, reject_owner, speech_world, spoken, submit_owner,
|
||||
};
|
||||
|
|
@ -8990,6 +9047,7 @@ mod knowledge_tests {
|
|||
bindings,
|
||||
proposed: Vec::new(),
|
||||
speech: Some(Statement::new(text).unwrap()),
|
||||
display: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -9370,6 +9428,214 @@ mod knowledge_tests {
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
fn show(
|
||||
affordance: AffordanceId,
|
||||
bindings: Vec<RoleBinding>,
|
||||
speech: Option<&str>,
|
||||
display: &str,
|
||||
) -> DecisionInvocation {
|
||||
DecisionInvocation {
|
||||
affordance,
|
||||
bindings,
|
||||
proposed: Vec::new(),
|
||||
speech: speech.map(|text| Statement::new(text).unwrap()),
|
||||
display: Some(Statement::new(display).unwrap()),
|
||||
}
|
||||
}
|
||||
|
||||
/// A visible act is the room's to see and nobody else's: everyone standing
|
||||
/// in the actor's place holds it as `Seen { by }`; the actor, the yard
|
||||
/// below, and the placeless hold nothing. The entry's own audience is not
|
||||
/// consulted: a proclamation down the horn carries its words to the yard
|
||||
/// and still folds its arms only before the hall.
|
||||
#[test]
|
||||
fn a_display_is_seen_by_the_room_and_by_no_one_else() {
|
||||
let directory = tempfile::tempdir().unwrap();
|
||||
let (mut kernel, speech, active) = speech_kernel(directory.path(), "Display");
|
||||
utter(
|
||||
&mut kernel,
|
||||
&active,
|
||||
speech.speaker,
|
||||
show(
|
||||
speech.proclaim,
|
||||
vec![binding("channel", Target::Entity(speech.horn))],
|
||||
Some("The horn carries."),
|
||||
"I fold my arms.",
|
||||
),
|
||||
)
|
||||
.expect("the proclamation with a display commits");
|
||||
|
||||
let event = kernel.state.events.last().expect("the committed event");
|
||||
let said = event.speech.expect("the utterance names its claim");
|
||||
let seen = event.display.expect("the display names its claim");
|
||||
assert_ne!(said, seen);
|
||||
assert_eq!(kernel.state.facts[&seen].statement.as_str(), "I fold my arms.");
|
||||
assert_eq!(
|
||||
kernel.state.facts[&seen].standing,
|
||||
FactStanding::Claimed { by: speech.speaker }
|
||||
);
|
||||
assert!(knows(&kernel, speech.bystander, said).is_some());
|
||||
assert_eq!(
|
||||
knows(&kernel, speech.listener, seen),
|
||||
Some(Knowledge {
|
||||
confidence: Confidence::Believed,
|
||||
source: KnowledgeSource::Seen { by: speech.speaker },
|
||||
})
|
||||
);
|
||||
for blind in [speech.bystander, speech.stranger, speech.speaker] {
|
||||
assert_eq!(knows(&kernel, blind, seen), None);
|
||||
}
|
||||
// One act minted both claims, so the listener's snapshot stamps both
|
||||
// rows with the one revision, and the operator's feed carries both.
|
||||
let snapshot = kernel.snapshot().unwrap();
|
||||
let listener = snapshot
|
||||
.subjects
|
||||
.iter()
|
||||
.find(|subject| subject.id == speech.listener)
|
||||
.unwrap();
|
||||
let stamps: BTreeSet<Option<u64>> = listener
|
||||
.knowledge
|
||||
.iter()
|
||||
.filter(|row| row.fact == said || row.fact == seen)
|
||||
.map(|row| row.minted_at)
|
||||
.collect();
|
||||
assert_eq!(stamps, BTreeSet::from([Some(event.revision)]));
|
||||
let log = kernel.operator_log().unwrap();
|
||||
assert_eq!(log.last().unwrap().speech.as_ref().unwrap().as_str(), "The horn carries.");
|
||||
assert_eq!(log.last().unwrap().display.as_ref().unwrap().as_str(), "I fold my arms.");
|
||||
}
|
||||
|
||||
/// A silent turn: the kernel `speak` entry invoked with no utterance and a
|
||||
/// display is an address, not `SpeechRequired`. The act lands, no speech
|
||||
/// claim is minted, and alone in the yard the same act commits its claim
|
||||
/// and lands nothing, as speaking alone does.
|
||||
#[test]
|
||||
fn a_silent_display_addresses_the_room_through_the_speak_entry() {
|
||||
let directory = tempfile::tempdir().unwrap();
|
||||
let (mut kernel, speech, active) = speech_kernel(directory.path(), "Silent");
|
||||
let speak = affordance_named(&active, "speak");
|
||||
utter(
|
||||
&mut kernel,
|
||||
&active,
|
||||
speech.speaker,
|
||||
show(speak, Vec::new(), None, "I nod toward the stair."),
|
||||
)
|
||||
.expect("a silent act commits");
|
||||
let event = kernel.state.events.last().unwrap();
|
||||
assert!(event.speech.is_none());
|
||||
let seen = event.display.expect("the display names its claim");
|
||||
assert_eq!(
|
||||
knows(&kernel, speech.listener, seen).map(|held| held.source),
|
||||
Some(KnowledgeSource::Seen { by: speech.speaker })
|
||||
);
|
||||
assert_eq!(claimed(&kernel), 1);
|
||||
|
||||
let active = kernel.snapshot().unwrap();
|
||||
let knowledge_before = kernel.state.knowledge.clone();
|
||||
utter(
|
||||
&mut kernel,
|
||||
&active,
|
||||
speech.bystander,
|
||||
show(speak, Vec::new(), None, "I sit on the step."),
|
||||
)
|
||||
.expect("a display into an empty room commits");
|
||||
assert_eq!(kernel.state.knowledge, knowledge_before);
|
||||
assert_eq!(kernel.state.events.len(), 2);
|
||||
assert_eq!(claimed(&kernel), 2);
|
||||
}
|
||||
|
||||
/// The refusals, each at its own layer: a padded act is `EmptyDisplay` at
|
||||
/// the check; a speech-carrying entry given neither words nor act is
|
||||
/// `SpeechRequired`; the placeless stranger has no room to be seen in and
|
||||
/// fails the entry's own `NoAudience`. None of them mints anything.
|
||||
#[test]
|
||||
fn a_display_is_refused_when_empty_placeless_or_when_nothing_is_addressed() {
|
||||
let directory = tempfile::tempdir().unwrap();
|
||||
let (mut kernel, speech, active) = speech_kernel(directory.path(), "Refused");
|
||||
let speak = affordance_named(&active, "speak");
|
||||
let mut padded = show(speak, Vec::new(), None, "placeholder");
|
||||
padded.display = Some(serde_json::from_str::<Statement>("\" \"").unwrap());
|
||||
assert_eq!(
|
||||
rejected(utter(&mut kernel, &active, speech.speaker, padded)),
|
||||
vec![ActionMismatch::EmptyDisplay]
|
||||
);
|
||||
let mute = DecisionInvocation {
|
||||
affordance: speech.whisper,
|
||||
bindings: vec![binding("target", Target::Subject(speech.listener))],
|
||||
proposed: Vec::new(),
|
||||
speech: None,
|
||||
display: None,
|
||||
};
|
||||
assert_eq!(
|
||||
rejected(utter(&mut kernel, &active, speech.speaker, mute)),
|
||||
vec![ActionMismatch::SpeechRequired]
|
||||
);
|
||||
assert_eq!(
|
||||
rejected(utter(
|
||||
&mut kernel,
|
||||
&active,
|
||||
speech.stranger,
|
||||
show(speak, Vec::new(), None, "I shrug."),
|
||||
)),
|
||||
vec![ActionMismatch::NoAudience { precondition: 0 }]
|
||||
);
|
||||
assert!(kernel.state.events.is_empty());
|
||||
assert_eq!(claimed(&kernel), 0);
|
||||
}
|
||||
|
||||
/// The claims a display minted, its `Seen` rows, and its event replay from
|
||||
/// the journal exactly, through the same path as speech.
|
||||
#[test]
|
||||
fn restart_replay_after_a_display_is_exact() {
|
||||
let directory = tempfile::tempdir().unwrap();
|
||||
let path = directory.path().join("world.cc");
|
||||
let (speech, world_id, expected) = {
|
||||
let mut kernel = WorldKernel::create(
|
||||
&path,
|
||||
creation(CommandId::new(), "ReplayDisplay"),
|
||||
&auth_principal(owner()),
|
||||
)
|
||||
.expect("a created world")
|
||||
.0;
|
||||
let (speech, active) = speech_world(&mut kernel);
|
||||
let speak = affordance_named(&active, "speak");
|
||||
utter(
|
||||
&mut kernel,
|
||||
&active,
|
||||
speech.speaker,
|
||||
show(speak, Vec::new(), Some("One."), "I raise one finger."),
|
||||
)
|
||||
.expect("the act commits");
|
||||
let active = kernel.snapshot().unwrap();
|
||||
utter(
|
||||
&mut kernel,
|
||||
&active,
|
||||
speech.listener,
|
||||
show(speak, Vec::new(), None, "I look away."),
|
||||
)
|
||||
.expect("the silent act commits");
|
||||
(speech, kernel.state.world_id, kernel.state.clone())
|
||||
};
|
||||
let reopened = WorldKernel::open(&path, world_id).expect("the store replays");
|
||||
assert_eq!(reopened.state, expected);
|
||||
assert!(reopened.state.knowledge[&speech.listener]
|
||||
.values()
|
||||
.any(|held| held.source == KnowledgeSource::Seen { by: speech.speaker }));
|
||||
assert!(reopened.state.knowledge[&speech.speaker]
|
||||
.values()
|
||||
.any(|held| held.source == KnowledgeSource::Seen { by: speech.listener }));
|
||||
}
|
||||
|
||||
fn claimed(kernel: &WorldKernel) -> usize {
|
||||
kernel
|
||||
.state
|
||||
.facts
|
||||
.values()
|
||||
.filter(|record| matches!(record.standing, FactStanding::Claimed { .. }))
|
||||
.count()
|
||||
}
|
||||
|
||||
/// The horn belongs to the temple: its controller may speak on it whether
|
||||
/// or not it stands inside its reach, and removing the controller flips the
|
||||
/// same invocation to exactly one named failure.
|
||||
|
|
@ -9464,6 +9730,7 @@ mod knowledge_tests {
|
|||
magnitude: Magnitude::None,
|
||||
}],
|
||||
speech: None,
|
||||
display: None,
|
||||
};
|
||||
assert_eq!(
|
||||
rejected(utter(&mut kernel, &active, speech.listener, recant())),
|
||||
|
|
@ -9967,6 +10234,7 @@ mod soul_knowledge_tests {
|
|||
bindings,
|
||||
proposed: Vec::new(),
|
||||
speech: Some(Statement::new(text).unwrap()),
|
||||
display: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -10142,6 +10410,7 @@ mod soul_knowledge_tests {
|
|||
bindings: vec![binding("fact", Target::Entity(speech.flood))],
|
||||
proposed: Vec::new(),
|
||||
speech: None,
|
||||
display: None,
|
||||
},
|
||||
vec![
|
||||
ActionMismatch::SlotNotProposed { slot: 0 },
|
||||
|
|
@ -10570,6 +10839,7 @@ mod soul_knowledge_tests {
|
|||
speaker: speech.bystander,
|
||||
speaker_label: "The Yard Bystander".into(),
|
||||
speech: Some(Statement::new(text).unwrap()),
|
||||
display: None,
|
||||
}]
|
||||
);
|
||||
// And no subject snapshot carries it.
|
||||
|
|
@ -11255,6 +11525,7 @@ mod witness_tests {
|
|||
bindings: Vec::new(),
|
||||
proposed: Vec::new(),
|
||||
speech: Some(Statement::new("The sky moved.").unwrap()),
|
||||
display: None,
|
||||
},
|
||||
opportunity: opportunity.clone(),
|
||||
},
|
||||
|
|
@ -11296,7 +11567,7 @@ mod witness_tests {
|
|||
.expect("the learner's snapshot carries the fact");
|
||||
assert_eq!(held.source, KnowledgeSource::Witnessed);
|
||||
assert!(
|
||||
held.spoken_at.is_none(),
|
||||
held.minted_at.is_none(),
|
||||
"a witnessed row named a speech act"
|
||||
);
|
||||
}
|
||||
|
|
@ -11344,6 +11615,7 @@ mod witness_tests {
|
|||
magnitude: Magnitude::None,
|
||||
}],
|
||||
speech: None,
|
||||
display: None,
|
||||
},
|
||||
opportunity: opportunity.clone(),
|
||||
},
|
||||
|
|
@ -11878,7 +12150,7 @@ mod witness_tests {
|
|||
/// rows and nothing else, so both of its inputs are pinned here rather than
|
||||
/// in the lane that owns the prose: exactly one component moved, `knows`,
|
||||
/// which is the anonymous line and names no author; and the row the witness
|
||||
/// wrote carries no `spoken_at`, which is the sole gate on an `Overheard`
|
||||
/// wrote carries no `minted_at`, which is the sole gate on an `Overheard`
|
||||
/// row, so no attributable line can be built from it.
|
||||
#[test]
|
||||
fn soul_a_witness_moves_only_knows_and_writes_no_spoken_row() {
|
||||
|
|
@ -11915,7 +12187,7 @@ mod witness_tests {
|
|||
held.knowledge
|
||||
.iter()
|
||||
.filter(|row| row.fact == world.asteroid)
|
||||
.all(|row| row.spoken_at.is_none() && row.source == KnowledgeSource::Witnessed),
|
||||
.all(|row| row.minted_at.is_none() && row.source == KnowledgeSource::Witnessed),
|
||||
"a witnessed row carried a speech act"
|
||||
);
|
||||
}
|
||||
|
|
@ -12244,6 +12516,7 @@ mod clock_tests {
|
|||
magnitude: Magnitude::None,
|
||||
}],
|
||||
speech: None,
|
||||
display: None,
|
||||
},
|
||||
},
|
||||
),
|
||||
|
|
@ -12519,6 +12792,7 @@ mod clock_tests {
|
|||
magnitude: Magnitude::None,
|
||||
}],
|
||||
speech: None,
|
||||
display: None,
|
||||
},
|
||||
},
|
||||
operations(vec![ComponentOp::CloseRoute {
|
||||
|
|
@ -13646,6 +13920,7 @@ mod clock_tests {
|
|||
magnitude: Magnitude::None,
|
||||
}],
|
||||
speech: None,
|
||||
display: None,
|
||||
},
|
||||
},
|
||||
),
|
||||
|
|
@ -14807,6 +15082,7 @@ mod clock_tests {
|
|||
bindings: Vec::new(),
|
||||
proposed: Vec::new(),
|
||||
speech: None,
|
||||
display: None,
|
||||
},
|
||||
},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -399,6 +399,11 @@ pub(crate) enum KnowledgeSource {
|
|||
by: SubjectId,
|
||||
via: Option<EntityId>,
|
||||
},
|
||||
/// A visible act of `by`, perceived in the same place. Written only by
|
||||
/// `ResolvedOp::Display`, which the kernel alone lowers.
|
||||
Seen {
|
||||
by: SubjectId,
|
||||
},
|
||||
Evidenced,
|
||||
}
|
||||
|
||||
|
|
@ -1773,6 +1778,17 @@ pub(crate) enum ResolvedOp {
|
|||
fact: EntityId,
|
||||
to: Audience,
|
||||
},
|
||||
/// A visible act: the actor's own sentence, seen by everyone standing in
|
||||
/// the actor's place. Lowered only by the kernel's speech path beside
|
||||
/// `AssertClaim`, never by a patch, so no seed or elaborator can move a
|
||||
/// person's body from outside the person. There is no audience field: a
|
||||
/// display cannot go down a channel, and the room is re-derived from live
|
||||
/// `positions` at apply, so a forged effect cannot assert a landing the
|
||||
/// world does not have.
|
||||
Display {
|
||||
actor: SubjectId,
|
||||
fact: EntityId,
|
||||
},
|
||||
/// Stores the place, never the recipients. `apply_operation` re-derives the
|
||||
/// subtree from live `positions`, so a forged effect cannot assert a
|
||||
/// landing the world does not have. There is no speaker field, so this
|
||||
|
|
@ -2110,6 +2126,9 @@ enum KnowledgeSourceKey {
|
|||
by: Key<SubjectId>,
|
||||
via: Option<Key<EntityId>>,
|
||||
},
|
||||
Seen {
|
||||
by: Key<SubjectId>,
|
||||
},
|
||||
Evidenced,
|
||||
}
|
||||
|
||||
|
|
@ -3218,6 +3237,9 @@ pub(super) fn resolve_patch(
|
|||
by: Key::Existing(by),
|
||||
via: via.map(Key::Existing),
|
||||
},
|
||||
KnowledgeSource::Seen { by } => KnowledgeSourceKey::Seen {
|
||||
by: Key::Existing(by),
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ pub struct OperationalAgentPrompt<'a> {
|
|||
|
||||
pub fn build_projector_prompt(input: &ProjectorPrompt<'_>) -> String {
|
||||
format!(
|
||||
"<!-- membrane:{MEMBRANE_SCHEMA}:projector -->\nYou are a private Projector. Render only what the permitted typed context and visible stimulus establish, as one plain lived stream in this person's own present: where they are, what they hold and owe and to whom, what they know and were told and by whom, what presses on them, and what they may do. Anything absent from the context is unavailable: render suspicion or speculation as uncertainty, never as remembered or perceived fact. This person has no temperament, history, mood, fears, wants, or inner voice beyond what the context carries; if it carries none, render none, and say plainly what is unknown rather than filling it. Do not choose actions, emit schemas, expose field names, or claim world effects. No metaphor, no atmosphere, no recap. Say only what changes the decision.\n\nDomain guidance:\n{guidance}\n\nIdentity:\n{identity}\n\nPermitted typed context:\n{context}\n\nVisible stimulus:\n{stimulus}\n\nUse at most {word_budget} words; fewer is better, and a thin moment gets a thin stream. Return only the lived stream.",
|
||||
"<!-- membrane:{MEMBRANE_SCHEMA}:projector -->\nYou are a private Projector. Render only what the permitted typed context and visible stimulus establish, as one plain lived stream in this person's own present: where they are, what they hold and owe and to whom, what they know and were told and by whom and saw others do, what presses on them, and what they may do. Anything absent from the context is unavailable: render suspicion or speculation as uncertainty, never as remembered or perceived fact. This person has no temperament, history, mood, fears, wants, or inner voice beyond what the context carries; if it carries none, render none, and say plainly what is unknown rather than filling it. Do not choose actions, emit schemas, expose field names, or claim world effects. No metaphor, no atmosphere, no recap. Say only what changes the decision.\n\nDomain guidance:\n{guidance}\n\nIdentity:\n{identity}\n\nPermitted typed context:\n{context}\n\nVisible stimulus:\n{stimulus}\n\nUse at most {word_budget} words; fewer is better, and a thin moment gets a thin stream. Return only the lived stream.",
|
||||
identity = input.identity,
|
||||
guidance = input.domain_guidance,
|
||||
context = input.typed_context,
|
||||
|
|
@ -110,7 +110,7 @@ pub fn build_interpreter_prompt(input: &InterpreterPrompt<'_>) -> String {
|
|||
None => "The harness supplies the current legal typed proposal tools immediately before each step. Use only those current contracts; never reuse a contract remembered from an earlier step.".into(),
|
||||
};
|
||||
format!(
|
||||
"<!-- membrane:{MEMBRANE_SCHEMA}:interpreter -->\nYou are a private Interpreter. Translate a natural Persona turn into zero or more typed candidate proposals supported by the prose and permissioned context. The owning runtime validates and commits proposals; you never claim that a proposed consequence already happened. Do not invent knowledge, capability, custody, perception, identifiers, or state references.\n\nInterpretation is total: this turn cannot fail because some prose has no available translation. The harness has already preserved the Persona turn verbatim as noncanonical source prose. Capture every translation you can justify, quoting the exact words of that source verbatim in `source_quote`; the harness locates the quote in the preserved prose and binds the capture to it, so a quote that is not in the prose word for word is recorded as a gap. Spoken words become a typed speech proposal; wondering, deciding, attempting, and narration are not automatically speech. If a meaningful passage cannot be represented safely, call `{gap_tool}` instead of guessing. A report containing only source prose, or source prose plus gaps, is valid. If the step budget ends, the harness completes the report and records the unresolved source instead of failing.\n\nThe always-available gap tool is:\n{gap_contract}\nUse `ambiguity` when several translations remain live, `missing_reference` when the prose lacks an exact world reference, `missing_affordance` when the subject lacks a permitted way to attempt it, `missing_primitive` when the ontology has no suitable proposal vocabulary, and `unresolved` only when no narrower account fits.\n\nIf a section headed `Interrupted:` follows the Persona turn, the world moved after that prose was written and before it could take effect. The prose is not re-written and not re-authored; translate it again against what that section reports. You may capture a shorter or different span of the same prose, a different permitted action the prose supports, or call `{gap_tool}` with `unresolved` when the intent the prose carried has been overtaken. The reported change is not something this person said, did, or caused.\n\n{proposal_contract}\n\nDomain guidance and exact permissions:\n{guidance}\n\nIdentity:\n{identity}\n\nPermissioned typed context:\n{context}\n\nLived stream:\n{stream}\n\nPersona turn (already preserved verbatim as source evidence):\n{output}",
|
||||
"<!-- membrane:{MEMBRANE_SCHEMA}:interpreter -->\nYou are a private Interpreter. Translate a natural Persona turn into zero or more typed candidate proposals supported by the prose and permissioned context. The owning runtime validates and commits proposals; you never claim that a proposed consequence already happened. Do not invent knowledge, capability, custody, perception, identifiers, or state references.\n\nInterpretation is total: this turn cannot fail because some prose has no available translation. The harness has already preserved the Persona turn verbatim as noncanonical source prose. Capture every translation you can justify, quoting the exact words of that source verbatim in `source_quote`; the harness locates the quote in the preserved prose and binds the capture to it, so a quote that is not in the prose word for word is recorded as a gap. Spoken words become a typed speech proposal. A visible act another person in the same place could see (a gesture, a posture, a look, a movement, a silence held) becomes a typed display proposal, quoted as the visible clause alone; what the person hoped, meant, or felt while doing it is not visible and is not part of that quote. Wondering, deciding, attempting, and narration are neither. If a meaningful passage cannot be represented safely, call `{gap_tool}` instead of guessing. A report containing only source prose, or source prose plus gaps, is valid. If the step budget ends, the harness completes the report and records the unresolved source instead of failing.\n\nThe always-available gap tool is:\n{gap_contract}\nUse `ambiguity` when several translations remain live, `missing_reference` when the prose lacks an exact world reference, `missing_affordance` when the subject lacks a permitted way to attempt it, `missing_primitive` when the ontology has no suitable proposal vocabulary, and `unresolved` only when no narrower account fits.\n\nIf a section headed `Interrupted:` follows the Persona turn, the world moved after that prose was written and before it could take effect. The prose is not re-written and not re-authored; translate it again against what that section reports. You may capture a shorter or different span of the same prose, a different permitted action the prose supports, or call `{gap_tool}` with `unresolved` when the intent the prose carried has been overtaken. The reported change is not something this person said, did, or caused.\n\n{proposal_contract}\n\nDomain guidance and exact permissions:\n{guidance}\n\nIdentity:\n{identity}\n\nPermissioned typed context:\n{context}\n\nLived stream:\n{stream}\n\nPersona turn (already preserved verbatim as source evidence):\n{output}",
|
||||
identity = input.identity,
|
||||
guidance = input.domain_guidance,
|
||||
context = input.typed_context,
|
||||
|
|
|
|||
|
|
@ -179,8 +179,8 @@ enters a log, a receipt, or the journal.
|
|||
|
||||
The consumer capability's tag is part of the commit digest and the
|
||||
externally controlled assignment is part of the state shape, so both bump the
|
||||
schema: state schema `ghostlight.world_state.consumer.v3` (state-schema
|
||||
generation `world-v3`), commit schema `ghostlight.world_commit.consumer.v3`.
|
||||
schema: state schema `ghostlight.world_state.consumer.v4` (state-schema
|
||||
generation `world-v3`), commit schema `ghostlight.world_commit.consumer.v4`.
|
||||
A store written under an earlier schema is refused, not migrated.
|
||||
|
||||
## Not in this pass
|
||||
|
|
|
|||
|
|
@ -102,8 +102,8 @@ target, otherwise `ActionMismatch::DelegationNotMonotone`.
|
|||
|
||||
A `Fact` is an entity with a `Statement` and a `FactStanding`: `Canonical`
|
||||
with evidence, or `Claimed { by }`. `Knowledge` is subject-keyed per fact with
|
||||
a `Confidence` and a `KnowledgeSource { Witnessed, Told { by, via }, Evidenced }`;
|
||||
a telling never overwrites a holder. `Witnessed` is minted by an authored
|
||||
a `Confidence` and a `KnowledgeSource { Witnessed, Told { by, via }, Seen { by },
|
||||
Evidenced }`; a telling or a showing never overwrites a holder. `Witnessed` is minted by an authored
|
||||
patch's `AcquireKnowledge` and, with no author at all, by `Witness` (below). A
|
||||
`Channel` is an entity with a
|
||||
`Reach { Subjects, Place }` and a controller. Speech is an affordance whose
|
||||
|
|
@ -116,7 +116,20 @@ from outside it (`can_broadcast`) but receives nothing unless inside it.
|
|||
Preconditions `Knows`, `CanBroadcast`, and `CanReach` gate at `exercise` with
|
||||
`ActionMismatch::{FactUnknown, NoAudience, CannotReach}`. The statement lives
|
||||
in `facts[fact].statement`; the copy inside the committed `AssertClaim` is
|
||||
the replay witness and nothing reads it. `WorldSnapshot` carries no event
|
||||
the replay witness and nothing reads it. A visible act is speech's twin with
|
||||
a different sense: an invocation may carry a `display`, the actor's own
|
||||
visible sentence, beside or instead of its utterance, and the kernel lowers
|
||||
it the same way, an `AssertClaim` and a `Display { actor, fact }` whose
|
||||
recipients are re-derived at apply as everyone standing in the actor's place
|
||||
(`Audience::Colocated`, the derivation co-located speech uses), landing
|
||||
`Seen { by }` at `Believed`. The entry's audience is not consulted: a body is
|
||||
visible to the room whatever the voice addresses, and a display cannot go
|
||||
down a channel. A speech-carrying entry invoked with a display alone is an
|
||||
address, not `SpeechRequired`. `Display` is lowered by the kernel only and is
|
||||
in no patch tool: no seed or elaborator moves a person's body from outside
|
||||
the person, and no field on the operation, the fact, or the knowledge row
|
||||
carries what the actor meant by it; the reading is the perceiver's own.
|
||||
`WorldSnapshot` carries no event
|
||||
log; the story feed is `operator_log`, an owner-only projection that the
|
||||
controller lane cannot name because `ControllerRunner` holds a
|
||||
`ControllerPort`, not the mailbox. `WorldMailbox::create` declares the genesis
|
||||
|
|
@ -289,8 +302,8 @@ is the typed component diff against the fresh components plus the
|
|||
knowledge row, and never another subject's snapshot. The re-lowering's
|
||||
provider request is a distinct round (`interpreter_round`) with its own
|
||||
content-addressed request id, so it cannot collide with the first lowering's
|
||||
request. State schema is `ghostlight.world_state.consumer.v3`, commit schema
|
||||
`ghostlight.world_commit.consumer.v3`, controller work `controller_work.v13`,
|
||||
request. State schema is `ghostlight.world_state.consumer.v4`, commit schema
|
||||
`ghostlight.world_commit.consumer.v4`, controller work `controller_work.v14`,
|
||||
Persona turn receipt `ghostlight.persona_turn_receipt.v3`; earlier stores and
|
||||
earlier rows are refused. Ghostlight owns a conserved narrative ledger;
|
||||
Delvehold owns the economy (`delvehold-forced-ontology-integration.md`).
|
||||
|
|
@ -456,7 +469,7 @@ Retirement retire(referent, reason)
|
|||
Time advance(minutes)
|
||||
```
|
||||
|
||||
Twenty-nine operations. Adding one is a design change to this document and a
|
||||
Thirty operations. Adding one is a design change to this document and a
|
||||
code change to the reducer; it is never a runtime patch.
|
||||
|
||||
## Patch construction
|
||||
|
|
@ -771,9 +784,12 @@ that are structural rather than promissory:
|
|||
- **Affordances are data.** A world declares its own action vocabulary over the
|
||||
closed operation set. Genre lives in the catalog, not in the kernel.
|
||||
- **Persona prose is free.** A `NarrativePersona` may say, attempt, or feel
|
||||
anything; the Interpreter lowers what the vocabulary can carry and records
|
||||
exact gaps for the rest. Unrepresentable meaning is preserved as evidence,
|
||||
never rejected or invented.
|
||||
anything; the Interpreter lowers what the vocabulary can carry (spoken
|
||||
words by `speak`, a visible act by `display`, each quoted verbatim as the
|
||||
audible or visible clause alone) and records exact gaps for the rest,
|
||||
which is where what the person hoped, meant, or felt stays.
|
||||
Unrepresentable meaning is preserved as evidence, never rejected or
|
||||
invented.
|
||||
- **Structure is sparse; liveness is authored.** A world activates with enough
|
||||
components for its current horizon, and grows toward the scale it was given.
|
||||
Ordinary life is a recurring `Commitment`; a rite is a `Channel` with a
|
||||
|
|
|
|||
Loading…
Reference in a new issue