Name exact strategic activity targets
This commit is contained in:
parent
29bacfb50d
commit
63c17af165
2 changed files with 74 additions and 1 deletions
|
|
@ -68,6 +68,7 @@ pub struct CellConstituentSlice {
|
|||
pub reachable_destination_ids: BTreeSet<String>,
|
||||
pub migration_destinations: BTreeMap<String, String>,
|
||||
pub activity_target_ids: BTreeSet<String>,
|
||||
pub activity_target_names: BTreeMap<String, String>,
|
||||
pub goals: Vec<String>,
|
||||
pub relationships: BTreeMap<String, String>,
|
||||
pub memories: Vec<String>,
|
||||
|
|
@ -89,6 +90,7 @@ pub struct CellMemberSlice {
|
|||
pub permitted_state_references: BTreeSet<String>,
|
||||
pub migration_destinations: BTreeMap<String, String>,
|
||||
pub activity_target_ids: BTreeSet<String>,
|
||||
pub activity_target_names: BTreeMap<String, String>,
|
||||
pub goals: Vec<String>,
|
||||
pub pressures: Vec<String>,
|
||||
pub relationships: BTreeMap<String, String>,
|
||||
|
|
@ -451,6 +453,7 @@ fn cell_projector_context(slice: &PermittedCellSlice) -> serde_json::Value {
|
|||
"reachable_destination_ids": subject.reachable_destination_ids,
|
||||
"migration_destinations": subject.migration_destinations,
|
||||
"activity_target_ids": subject.activity_target_ids,
|
||||
"activity_target_names": subject.activity_target_names,
|
||||
"goals": subject.goals,
|
||||
"relationships": subject.relationships,
|
||||
"memories": subject.memories,
|
||||
|
|
@ -468,6 +471,7 @@ fn cell_projector_context(slice: &PermittedCellSlice) -> serde_json::Value {
|
|||
"resources": member.resources,
|
||||
"migration_destinations": member.migration_destinations,
|
||||
"activity_target_ids": member.activity_target_ids,
|
||||
"activity_target_names": member.activity_target_names,
|
||||
"goals": member.goals,
|
||||
"pressures": member.pressures,
|
||||
"relationships": member.relationships,
|
||||
|
|
@ -504,6 +508,7 @@ fn cell_interpreter_context(
|
|||
"reachable_destination_ids": subject.reachable_destination_ids,
|
||||
"migration_destinations": subject.migration_destinations,
|
||||
"activity_target_ids": subject.activity_target_ids,
|
||||
"activity_target_names": subject.activity_target_names,
|
||||
"already_committed_posture": subject.current_posture,
|
||||
"current_pressures": subject.pressures,
|
||||
})).collect::<Vec<_>>(),
|
||||
|
|
@ -517,6 +522,7 @@ fn cell_interpreter_context(
|
|||
"permitted_state_references": member.permitted_state_references,
|
||||
"migration_destinations": member.migration_destinations,
|
||||
"activity_target_ids": member.activity_target_ids,
|
||||
"activity_target_names": member.activity_target_names,
|
||||
})).collect::<Vec<_>>(),
|
||||
})
|
||||
}
|
||||
|
|
@ -904,7 +910,7 @@ impl CellProjectionEngine {
|
|||
"Emit at most {} exact constituent- or named-member-attributed attempts. Priority is an urgency score from 0 to 100 where higher numbers resolve first. ",
|
||||
"Copy each subject's exact allowed_effect_types. A lane absent from that list is structurally unavailable: do not emit it and do not invent a destination. ",
|
||||
"Use gestalt_activity or member_activity for a concrete attempt that does not itself change pressure. Map attempts narrowly: communicate means speak, send, offer, ask, or notify; coordinate means arrange a joint attempt; prepare means the subject's own concrete work; investigate means seek information; recruit means invite; trade means offer an exchange; obstruct means attempt interference. Cite the smallest exact set of state_references that materially supports each attempt; the permission list is an upper bound, not a checklist to echo. ",
|
||||
"target_subject_ids and location_ids must come from that exact subject's permissions. Every activity has at most four unique target_subject_ids; choose the four most causally relevant when more permitted subjects are involved. A member_activity uses exactly the member's source_location_id. Internal work is prepare with no targets. A local investigate may have no target and use the exact current location to seek information from the environment or an unnamed ordinary role; asking an unnamed clerk or dock master for facts maps here and records only the inquiry, never a reply or discovery. A local communicate may likewise have no target at the exact current location when the Persona speaks, sends, offers, asks permission, or notifies an unnamed ordinary role; it records only the source's outgoing attempt, never a listener, reply, acceptance, or outcome. Communication with a canonical subject requires that exact target ID. Never substitute a containing population, related institution, or merely permitted ID for an unnamed role. ",
|
||||
"target_subject_ids and location_ids must come from that exact subject's permissions. activity_target_names is the exact ID-to-name map for canonical targets: use an ID only when the Persona addresses that named target, never merely because the ID is permitted. If an addressed person or role has no matching activity_target_names entry, it is not a canonical target in this slice. Every activity has at most four unique target_subject_ids; choose the four most causally relevant when more permitted subjects are involved. A member_activity uses exactly the member's source_location_id. Internal work is prepare with no targets. A local investigate may have no target and use the exact current location to seek information from the environment or an unnamed ordinary role; asking an unnamed clerk or dock master for facts maps here and records only the inquiry, never a reply or discovery. A local communicate may likewise have no target at the exact current location when the Persona speaks, sends, offers, asks permission, or notifies an unnamed ordinary role; it records only the source's outgoing attempt, never a listener, reply, acceptance, or outcome. Communication with a canonical subject requires that exact target ID. Never substitute a containing population, related institution, or merely permitted ID for an unnamed role. ",
|
||||
"Write intended_effect as the attempted act, never its hoped-for outcome or target response. Merely waiting, watching, staying, holding position, or remaining ready is attributed inaction, not prepare. prepare requires concrete work on a bounded arrangement, repair, resource, or capability-backed readiness change. Institution posture must be a specific materially new commitment or withholding of at most 240 characters. already_committed_posture is state already in force: maintaining, continuing, or restating it is inaction and must not emit an institution action. Gestalt pressure_resolutions copy exact current_pressures; additions are new unresolved constraints, never completed actions. Use only permitted state references and public channels. ",
|
||||
"A population that chooses to board, depart, or relocate together to one supplied migration_destinations key emits gestalt_migration; do not reduce it to prepare. It relocates only that exact population leaf and never implies a named member traveled. A named member who chooses to board, depart, travel, or join a supplied destination emits member_migration; use prepare only while departure remains unchosen. ",
|
||||
"A population or arena cannot migrate a person. Runtime binds identity and effect owner IDs from subject_id. Do not emit institution_id, gestalt_id, actor_id, or member_id inside effect. An inaction means that exact subject takes no strategic action in this horizon. Record only a subject that explicitly holds, waits without making another attempt, or merely continues already_committed_posture in the Persona turn as an inaction, using its exact subject_id and a concrete reason of at most 160 characters. Waiting for the result of an action, withholding a different possible action, or declining one option after choosing another does not make the chosen action an inaction. Never invent an inaction for an unvoiced subject or use absence of a Persona decision as a reason. Inactions share the same count limit stated for actions. A subject cannot appear in both actions and inactions. When nobody acts, actions is empty and inactions must still contain at least one exact attributed decision from the Persona turn."
|
||||
|
|
@ -2209,6 +2215,7 @@ mod tests {
|
|||
reachable_destination_ids: BTreeSet::new(),
|
||||
migration_destinations: BTreeMap::new(),
|
||||
activity_target_ids: BTreeSet::new(),
|
||||
activity_target_names: BTreeMap::new(),
|
||||
goals: vec!["publish a position".into()],
|
||||
relationships: BTreeMap::new(),
|
||||
memories: vec![],
|
||||
|
|
@ -2826,6 +2833,7 @@ mod tests {
|
|||
permitted_state_references: BTreeSet::from(["member:mira".into()]),
|
||||
migration_destinations: BTreeMap::new(),
|
||||
activity_target_ids: BTreeSet::from(["refugees".into()]),
|
||||
activity_target_names: BTreeMap::from([("refugees".into(), "Refugee Convoy".into())]),
|
||||
goals: vec![],
|
||||
pressures: vec![],
|
||||
relationships: BTreeMap::new(),
|
||||
|
|
@ -3177,6 +3185,7 @@ mod tests {
|
|||
permitted_state_references: BTreeSet::from(["member:mira".into()]),
|
||||
migration_destinations: BTreeMap::new(),
|
||||
activity_target_ids: BTreeSet::new(),
|
||||
activity_target_names: BTreeMap::new(),
|
||||
goals: vec!["choose whether to leave".into()],
|
||||
pressures: vec!["the final ferry is boarding".into()],
|
||||
relationships: BTreeMap::new(),
|
||||
|
|
|
|||
|
|
@ -465,11 +465,15 @@ fn cell_slice(campaign: &Campaign, cell: &SimulationCell) -> Result<PermittedCel
|
|||
subject.activity_target_ids.retain(|target| {
|
||||
!target.starts_with("member:") || selected_member_ids.contains(target)
|
||||
});
|
||||
subject.activity_target_names =
|
||||
activity_target_names(campaign, &subject.activity_target_ids)?;
|
||||
}
|
||||
for member in &mut member_exceptions {
|
||||
member.activity_target_ids.retain(|target| {
|
||||
!target.starts_with("member:") || selected_member_ids.contains(target)
|
||||
});
|
||||
member.activity_target_names =
|
||||
activity_target_names(campaign, &member.activity_target_ids)?;
|
||||
}
|
||||
let shared_knowledge = intersection(
|
||||
constituents
|
||||
|
|
@ -683,6 +687,7 @@ fn member_exceptions(campaign: &Campaign, cell: &SimulationCell) -> Result<Vec<C
|
|||
permitted_state_references,
|
||||
migration_destinations: destinations,
|
||||
activity_target_ids,
|
||||
activity_target_names: BTreeMap::new(),
|
||||
goals,
|
||||
pressures: member
|
||||
.conditions
|
||||
|
|
@ -729,6 +734,7 @@ fn constituent_slice(campaign: &Campaign, id: &str) -> Result<CellConstituentSli
|
|||
reachable_destination_ids: BTreeSet::new(),
|
||||
migration_destinations: BTreeMap::new(),
|
||||
activity_target_ids: crate::resolution::strategic_activity_targets(campaign, id),
|
||||
activity_target_names: BTreeMap::new(),
|
||||
goals: vec![],
|
||||
relationships: BTreeMap::new(),
|
||||
memories: vec![],
|
||||
|
|
@ -799,6 +805,42 @@ fn constituent_slice(campaign: &Campaign, id: &str) -> Result<CellConstituentSli
|
|||
Ok(value)
|
||||
}
|
||||
|
||||
fn activity_target_names(
|
||||
campaign: &Campaign,
|
||||
target_ids: &BTreeSet<String>,
|
||||
) -> Result<BTreeMap<String, String>> {
|
||||
target_ids
|
||||
.iter()
|
||||
.map(|target_id| {
|
||||
let name = if let Some(member_id) = target_id.strip_prefix("member:") {
|
||||
campaign
|
||||
.gestalt_members
|
||||
.get(member_id)
|
||||
.map(|member| member.name.clone())
|
||||
} else {
|
||||
campaign
|
||||
.actors
|
||||
.get(target_id)
|
||||
.map(|actor| actor.name.clone())
|
||||
.or_else(|| {
|
||||
campaign
|
||||
.institutions
|
||||
.get(target_id)
|
||||
.map(|institution| institution.name.clone())
|
||||
})
|
||||
.or_else(|| {
|
||||
campaign
|
||||
.gestalts
|
||||
.get(target_id)
|
||||
.map(|gestalt| gestalt.name.clone())
|
||||
})
|
||||
}
|
||||
.ok_or_else(|| anyhow!("activity target {target_id} has no canonical named subject"))?;
|
||||
Ok((target_id.clone(), name))
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn intersection(sets: Vec<&BTreeSet<String>>) -> BTreeSet<String> {
|
||||
let Some(first) = sets.first() else {
|
||||
return BTreeSet::new();
|
||||
|
|
@ -1104,6 +1146,13 @@ mod tests {
|
|||
.activity_target_ids
|
||||
.contains("refugees")
|
||||
);
|
||||
assert_eq!(
|
||||
slice.member_exceptions[0]
|
||||
.activity_target_names
|
||||
.get("refugees")
|
||||
.map(String::as_str),
|
||||
Some("Refugees")
|
||||
);
|
||||
let selected_member_ids = slice
|
||||
.member_exceptions
|
||||
.iter()
|
||||
|
|
@ -1124,6 +1173,20 @@ mod tests {
|
|||
.filter(|target| target.starts_with("member:"))
|
||||
.all(|target| selected_member_ids.contains(target))
|
||||
}));
|
||||
assert!(slice.constituents.iter().all(|constituent| {
|
||||
constituent
|
||||
.activity_target_names
|
||||
.keys()
|
||||
.collect::<BTreeSet<_>>()
|
||||
== constituent
|
||||
.activity_target_ids
|
||||
.iter()
|
||||
.collect::<BTreeSet<_>>()
|
||||
}));
|
||||
assert!(slice.member_exceptions.iter().all(|member| {
|
||||
member.activity_target_names.keys().collect::<BTreeSet<_>>()
|
||||
== member.activity_target_ids.iter().collect::<BTreeSet<_>>()
|
||||
}));
|
||||
assert!(
|
||||
!serde_json::to_string(&slice)
|
||||
.unwrap()
|
||||
|
|
@ -1239,6 +1302,7 @@ mod tests {
|
|||
permitted_state_references: BTreeSet::new(),
|
||||
migration_destinations: BTreeMap::new(),
|
||||
activity_target_ids: BTreeSet::new(),
|
||||
activity_target_names: BTreeMap::new(),
|
||||
goals: vec![],
|
||||
pressures: vec![],
|
||||
relationships: BTreeMap::new(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue