diff --git a/crates/ghostlight-dungeon/src/main.rs b/crates/ghostlight-dungeon/src/main.rs index ac5e471..86dc450 100644 --- a/crates/ghostlight-dungeon/src/main.rs +++ b/crates/ghostlight-dungeon/src/main.rs @@ -1916,7 +1916,7 @@ async fn populate_opening_suggestions( proposed_character_patch: None, evidence_receipt_ids: opening.evidence_receipt_ids.clone(), pending_counter: None, - material: true, + material: false, resolved: false, }, ) @@ -2047,7 +2047,7 @@ async fn populate_role_suggestions( ), evidence_receipt_ids: role.evidence_receipt_ids.clone(), pending_counter: None, - material: true, + material: false, resolved: false, }, ) diff --git a/crates/ghostlight-dungeon/src/session_zero.rs b/crates/ghostlight-dungeon/src/session_zero.rs index 5907750..2f3b9bf 100644 --- a/crates/ghostlight-dungeon/src/session_zero.rs +++ b/crates/ghostlight-dungeon/src/session_zero.rs @@ -811,6 +811,13 @@ impl SessionZeroState { { return Err(anyhow!("material decisions remain unresolved")); } + let gaps = self.compilation_gaps(); + if !gaps.is_empty() { + return Err(anyhow!( + "Session Zero draft is incomplete: {}", + gaps.join("; ") + )); + } let shared_digest = self.shared_digest()?; let active = self .members @@ -839,6 +846,68 @@ impl SessionZeroState { character_digests, }) } + + fn compilation_gaps(&self) -> Vec { + let mut gaps = Vec::new(); + for (label, value) in [ + ("campaign premise", self.contract.premise.as_str()), + ("canon horizon", self.contract.canon_horizon.as_str()), + ("starting location", self.contract.starting_where.as_str()), + ("starting time", self.contract.starting_when.as_str()), + ( + "starting pressure", + self.contract.starting_pressure.as_str(), + ), + ("desired goal", self.contract.desired_goal.as_str()), + ("pacing", self.contract.pacing.as_str()), + ( + "consequence style", + self.contract.consequence_style.as_str(), + ), + ("narrative focus", self.contract.narrative_focus.as_str()), + ("DM style", self.contract.dm_style.as_str()), + ] { + if value.trim().is_empty() { + gaps.push(label.to_string()); + } + } + if self.contract.tone.is_empty() { + gaps.push("tone".into()); + } + let active_members = self + .members + .values() + .filter(|member| member.active) + .collect::>(); + if active_members.len() > 1 && self.contract.party_bonds.is_empty() { + gaps.push("party bonds".into()); + } + for member in active_members { + let Some(character) = self.character_drafts.get(&member.id) else { + gaps.push(format!("{} character draft", member.display_name)); + continue; + }; + if character.name.trim().is_empty() { + gaps.push(format!("{} character name", member.display_name)); + } + if character.public_premise.trim().is_empty() { + gaps.push(format!("{} public character premise", member.display_name)); + } + if character.capabilities.is_empty() { + gaps.push(format!("{} capabilities", member.display_name)); + } + if character.goals.is_empty() { + gaps.push(format!("{} goals", member.display_name)); + } + if character.obligations.is_empty() && character.vulnerabilities.is_empty() { + gaps.push(format!( + "{} obligation or vulnerability", + member.display_name + )); + } + } + gaps + } } #[derive(Clone, Debug)] @@ -2044,12 +2113,12 @@ fn execute( return Err(anyhow!("countered decision channel owner mismatch")); } if !delta.decisions.iter().any(|replacement| { - replacement.material - && !replacement.resolved + !replacement.resolved && replacement.owner_member_id.as_deref() == member_id.as_deref() + && (!countered.material || replacement.material) }) { return Err(anyhow!( - "counter response must contain a fresh material decision" + "counter response must contain a fresh decision with the required materiality" )); } } @@ -3051,6 +3120,76 @@ mod tests { assert_eq!(state.pooled_cell_allowance(), OPERATOR_CELL_CEILING); } + #[test] + fn blank_conversation_only_draft_cannot_enter_world_compilation() { + let mut draft = state(); + draft.roster_locked = true; + let error = draft.compilation_brief().unwrap_err().to_string(); + assert!(error.contains("Session Zero draft is incomplete")); + assert!(error.contains("starting location")); + assert!(error.contains("public character premise")); + assert!(error.contains("capabilities")); + } + + #[test] + fn optional_opening_or_role_suggestions_do_not_block_custom_compilation() { + let mut draft = state(); + draft.roster_locked = true; + draft.contract.premise = "Keep a refugee clinic supplied during a political crisis.".into(); + draft.contract.canon_horizon = "After Burden of Proof".into(); + draft.contract.starting_where = "Hellas, Mars".into(); + draft.contract.starting_when = "Zhestokost administration".into(); + draft.contract.starting_pressure = "A ration strike and refugee convoy".into(); + draft.contract.desired_goal = "Protect the clinic without becoming an informant.".into(); + draft.contract.tone = vec!["serious political drama".into()]; + draft.contract.pacing = "deliberate pressure with sharp turns".into(); + draft.contract.consequence_style = "durable, low arbitrary lethality".into(); + draft.contract.narrative_focus = "institutional leverage and human solidarity".into(); + draft.contract.dm_style = "candid, challenging, and humane".into(); + let character = draft + .character_drafts + .get_mut(&draft.host_member_id) + .unwrap(); + character.public_premise = + "A Corvid logistics mediator caught between institutions.".into(); + character.capabilities = vec!["Route planning".into()]; + character.goals = vec!["Get the convoy through".into()]; + character.obligations = vec!["A life-debt to the quartermaster".into()]; + draft.decisions.insert( + "opening:optional".into(), + SessionZeroDecision { + schema: "ghostlight.session_zero_decision.v1".into(), + id: "opening:optional".into(), + owner_member_id: None, + prompt: "Use this generated opening?".into(), + proposed_resolution: "A generated frame the player may ignore.".into(), + proposed_extraordinary_permission: None, + proposed_contract_patch: Some(CampaignContractPatch { + starting_where: Some("Somewhere else".into()), + ..Default::default() + }), + proposed_character_patch: None, + evidence_receipt_ids: vec![], + pending_counter: None, + material: false, + resolved: false, + }, + ); + assert!(draft.compilation_brief().is_ok()); + draft + .decisions + .get_mut("opening:optional") + .unwrap() + .material = true; + assert!( + draft + .compilation_brief() + .unwrap_err() + .to_string() + .contains("material decisions") + ); + } + #[tokio::test] async fn actor_filtered_surface_never_projects_other_private_state_or_account_hashes() { let dir = tempdir().unwrap(); @@ -3491,7 +3630,7 @@ mod tests { assert!( rejected_replacement .to_string() - .contains("fresh material decision") + .contains("required materiality") ); assert_eq!( store diff --git a/docs/architecture/ghostlight-dungeon-session-zero.md b/docs/architecture/ghostlight-dungeon-session-zero.md index d262ab1..b015634 100644 --- a/docs/architecture/ghostlight-dungeon-session-zero.md +++ b/docs/architecture/ghostlight-dungeon-session-zero.md @@ -67,7 +67,9 @@ the kernel may append a fixed local DM notice to the conversation while leaving contract, characters, decisions, boundaries, approvals, and model receipts unchanged. -Material decisions preserve the distinction between discussion and consent. +Generated opening and role suggestions are non-material decisions: the player +may accept, counter, discuss, or ignore them without blocking a fully custom +draft. Material decisions preserve the distinction between discussion and consent. Accept applies only the exact typed payload currently stored in the decision. Counter atomically removes that payload, records the player's text in the decision's durable channel, marks the unresolved decision as awaiting a DM @@ -81,7 +83,12 @@ counter unresolved and compilation blocked. ## Approval and publication The host locks the roster before compilation. Material unresolved decisions -block compilation. The compiler receives an `approved_campaign_brief.v1`, not +block compilation. The kernel also refuses a conversation-only draft: the +typed contract must identify premise, canon horizon, start, pressure, goal, +tone, pacing, consequences, narrative focus, and DM style; every active +character must have a public premise, capability, goal, and at least one +obligation or vulnerability. Group drafts additionally require a party bond. +The compiler receives an `approved_campaign_brief.v1`, not the transcript. Private character history and secrets are withheld from world generation; after the grounded seed validates, Ghostlight locally replaces the provisional compiler player with the exact approved actors at one shared start. diff --git a/notes/ghostlight-current-system-map.md b/notes/ghostlight-current-system-map.md index d74b7c6..8a7c311 100644 --- a/notes/ghostlight-current-system-map.md +++ b/notes/ghostlight-current-system-map.md @@ -524,15 +524,22 @@ promoted into Worldbuilding before they become reusable campaign canon. Session Zero compilation, expansion, and fission follow the same projection rule. Review projections expose topology, pressures, source-use coverage, gaps, assumptions, public party cards, and only the current viewer's private ledger. -Generated openings are shared typed decisions; accepting one amends the draft -for discussion and triggers three grounded role decisions in each private DM -channel. Custom starts and characters use the same draft. The browser returns +Generated openings are optional shared typed decisions; accepting one amends +the draft for discussion and triggers three optional grounded role decisions in +each private DM channel. Ignoring them cannot block a custom start or character. +Custom starts and characters use the same draft. The browser returns only decision commands and cannot echo a rewritten candidate into compilation. Candidate IDs, text, list sizes, and evidence references receive local validation. Suggestion retrieval and model receipts remain in the Session Zero store; publication compiles the unanimously approved brief, never the conversation transcript. +Roster lock is not readiness. Before world compilation the kernel checks the +typed contract's core play frame and each active character's minimum actionable +shape. Transcript-only detail, blank contract fields, or a character with no +public premise, capability, goal, and stake return explicit missing inputs and +cannot spend a world-compiler call. + Campaign publication has a separate discoverability boundary. Session Zero publication and solo lifecycle operations initialize a new `.cc` store under a non-UUID `.creating-*` directory. The CreateCampaign command validates the