Type player knowledge as readable findings
This commit is contained in:
parent
b565a2b9f7
commit
31f923f71d
4 changed files with 29 additions and 2 deletions
|
|
@ -81,7 +81,7 @@ impl ActionAssessor {
|
|||
"maximum":10
|
||||
});
|
||||
let base_prompt = format!(
|
||||
"OUTPUT JSON SCHEMA (follow exactly):\n{}\n\nAssess an attempted effect, not whether words can be spoken. Impossible actions are inadmissible and receive bargains, not a roll. Choose DC only from 5,10,15,20,25,30. Every modifier reference must be copied exactly from ALLOWED REFERENCES. Modifier total is capped at +/-10. Never grant capability, custody, access, knowledge, or spatial reach absent from state. State concrete success, mixed, and failure consequences and a bounded effect ceiling. Outcome deltas may only name actor IDs copied exactly from PRESENT ACTORS, change their conditions or relationships, move only the acting actor along an existing route, advance existing clocks, or change existing institution posture. When an outcome directly reveals information to the acting actor, actor_knowledge_additions must contain the specific observed finding, not a vague claim that a reading or clue exists. Strong and ordinary success share one visible stake, so give them identical knowledge additions. The runtime binds each exact finding into the player-visible stake; do not spend prose repeating it solely for formatting. Findings become provisional branch facts on commit, so do not invent remote events, hidden actors, unsupported proper nouns, or conclusions beyond the effect ceiling. Keep a delta empty only when the outcome truly has no canonical state change.\nINTENT:\n{}\nACTOR:\n{}\nLOCATION:\n{}\nPRESENT ACTORS:\n{}\nVISIBLE INSTITUTIONS:\n{}\nALLOWED REFERENCES:\n{}",
|
||||
"OUTPUT JSON SCHEMA (follow exactly):\n{}\n\nAssess an attempted effect, not whether words can be spoken. Impossible actions are inadmissible and receive bargains, not a roll. Choose DC only from 5,10,15,20,25,30. Every modifier reference must be copied exactly from ALLOWED REFERENCES. Modifier total is capped at +/-10. Never grant capability, custody, access, knowledge, or spatial reach absent from state. State concrete success, mixed, and failure consequences and a bounded effect ceiling. Outcome deltas may only name actor IDs copied exactly from PRESENT ACTORS, change their conditions or relationships, move only the acting actor along an existing route, advance existing clocks, or change existing institution posture. When an outcome directly reveals information to the acting actor, actor_knowledge_additions must contain the specific observed finding as a player-readable natural-language declarative statement, never a fact ID, key, slug, or label. Strong and ordinary success share one visible stake, so give them identical knowledge additions. The runtime binds each exact finding into the player-visible stake; do not spend prose repeating it solely for formatting. Findings become provisional branch facts on commit, so do not invent remote events, hidden actors, unsupported proper nouns, or conclusions beyond the effect ceiling. Keep a delta empty only when the outcome truly has no canonical state change.\nINTENT:\n{}\nACTOR:\n{}\nLOCATION:\n{}\nPRESENT ACTORS:\n{}\nVISIBLE INSTITUTIONS:\n{}\nALLOWED REFERENCES:\n{}",
|
||||
serde_json::to_string(&schema)?,
|
||||
serde_json::to_string(&intent)?,
|
||||
serde_json::to_string(actor)?,
|
||||
|
|
@ -285,12 +285,13 @@ pub(crate) fn validate_effect(
|
|||
|| additions.iter().any(|finding| {
|
||||
finding.trim().is_empty()
|
||||
|| finding.chars().count() > 500
|
||||
|| looks_like_identifier(finding)
|
||||
|| acting_actor.knowledge.contains(finding)
|
||||
|| !stake.contains(finding)
|
||||
})
|
||||
{
|
||||
return Err(anyhow!(
|
||||
"outcome knowledge must be new, bounded, directly observed by the acting actor, and visible verbatim in its stake"
|
||||
"outcome knowledge must be a new bounded natural-language finding, directly observed by the acting actor and visible verbatim in its stake"
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
@ -324,6 +325,15 @@ pub(crate) fn validate_effect(
|
|||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn looks_like_identifier(value: &str) -> bool {
|
||||
let value = value.trim();
|
||||
!value.chars().any(char::is_whitespace)
|
||||
&& (value.contains('_')
|
||||
|| value.contains("::")
|
||||
|| value.starts_with("fact:")
|
||||
|| value.starts_with("fact-"))
|
||||
}
|
||||
pub fn assessment_digest(assessment: &ActionAssessment) -> Result<String> {
|
||||
let mut value = assessment.clone();
|
||||
value.digest.clear();
|
||||
|
|
@ -390,4 +400,12 @@ mod tests {
|
|||
assert!(value.success_stake.contains(&finding));
|
||||
assert_eq!(value.success_stake.matches(&finding).count(), 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fact_identifier_cannot_masquerade_as_character_knowledge() {
|
||||
assert!(looks_like_identifier("fact_distress_relay_antenna_damaged"));
|
||||
assert!(!looks_like_identifier(
|
||||
"The distress relay's antenna array is damaged."
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -830,6 +830,8 @@ pub struct ConditionDelta {
|
|||
#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Default)]
|
||||
pub struct WorldEffectDelta {
|
||||
pub actor_conditions: BTreeMap<String, ConditionDelta>,
|
||||
/// Exact player-readable natural-language findings learned by each actor.
|
||||
/// Values are declarative statements, never fact IDs, labels, or keys.
|
||||
#[serde(default)]
|
||||
pub actor_knowledge_additions: BTreeMap<String, BTreeSet<String>>,
|
||||
pub actor_relationship_updates: BTreeMap<String, BTreeMap<String, String>>,
|
||||
|
|
|
|||
|
|
@ -590,6 +590,8 @@ outcome, and an unstated hidden finding cannot appear after the roll.
|
|||
The assessor normalizes each bounded typed finding into its visible stake before
|
||||
validation and digesting. Exact visibility is therefore deterministic; a model
|
||||
retry is reserved for semantic or authority failure, not punctuation mismatch.
|
||||
The schema names these values as player-readable declarative statements, and a
|
||||
fact ID, key, or slug cannot enter the character ledger as knowledge.
|
||||
|
||||
### Actor and world action loop
|
||||
|
||||
|
|
|
|||
|
|
@ -385,6 +385,11 @@ bounded typed finding to the corresponding visible stake before validation and
|
|||
digesting. Semantic or authority errors may retry; punctuation no longer gets a
|
||||
second provider call.
|
||||
|
||||
The next replay exposed that an unannotated string set invited an ID-shaped
|
||||
finding (`fact_distress_relay_antenna_damaged`). The schema now describes
|
||||
knowledge additions as player-readable declarative statements, and the local
|
||||
boundary rejects unambiguous fact-ID/key syntax before it can become memory.
|
||||
|
||||
Next: commit and build this repaired candidate, replay the same authenticated
|
||||
Huygens campaign in an isolated runtime, inspect both the visible surface and
|
||||
the literal HTTP response, then prove away catch-up/concurrency/persistence/
|
||||
|
|
|
|||
Loading…
Reference in a new issue