From f236e1cddae9ccbe3b7580f2608f5f669e27753f Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 23 Aug 2026 06:52:48 +0200 Subject: [PATCH] Derive CultMesh contracts from CultNet owners --- epiphany-core/src/cultmesh_integration.rs | 690 ++-------------------- epiphany-core/src/lib.rs | 31 - 2 files changed, 57 insertions(+), 664 deletions(-) diff --git a/epiphany-core/src/cultmesh_integration.rs b/epiphany-core/src/cultmesh_integration.rs index e4256362..69829ff9 100644 --- a/epiphany-core/src/cultmesh_integration.rs +++ b/epiphany-core/src/cultmesh_integration.rs @@ -203,26 +203,6 @@ pub const EPIPHANY_CULTMESH_DAEMON_TOOL_INVOCATION_RECEIPT_SCHEMA_VERSION: &str "epiphany.cultmesh.daemon_tool_invocation_receipt.v0"; pub const EPIPHANY_CULTMESH_DAEMON_TOOL_INVOCATION_RECEIPT_LATEST_KEY: &str = "epiphany-local/daemon-tool-invocation-receipt/latest"; -pub const EPIPHANY_CULTMESH_MIND_CONTRACT_TYPE: &str = "epiphany.cultmesh.mind_contract"; -pub const EPIPHANY_CULTMESH_MIND_CONTRACT_SCHEMA_VERSION: &str = - "epiphany.cultmesh.mind_contract.v0"; -pub const EPIPHANY_CULTMESH_SUBSTRATE_GATE_CONTRACT_TYPE: &str = - "epiphany.cultmesh.substrate_gate_contract"; -pub const EPIPHANY_CULTMESH_SUBSTRATE_GATE_CONTRACT_SCHEMA_VERSION: &str = - "epiphany.cultmesh.substrate_gate_contract.v0"; -pub const EPIPHANY_CULTMESH_EYES_CONTRACT_TYPE: &str = "epiphany.cultmesh.eyes_contract"; -pub const EPIPHANY_CULTMESH_EYES_CONTRACT_SCHEMA_VERSION: &str = - "epiphany.cultmesh.eyes_contract.v0"; -pub const EPIPHANY_CULTMESH_HANDS_CONTRACT_TYPE: &str = "epiphany.cultmesh.hands_contract"; -pub const EPIPHANY_CULTMESH_HANDS_CONTRACT_SCHEMA_VERSION: &str = - "epiphany.cultmesh.hands_contract.v0"; -pub const EPIPHANY_CULTMESH_SOUL_CONTRACT_TYPE: &str = "epiphany.cultmesh.soul_contract"; -pub const EPIPHANY_CULTMESH_SOUL_CONTRACT_SCHEMA_VERSION: &str = - "epiphany.cultmesh.soul_contract.v0"; -pub const EPIPHANY_CULTMESH_CONTINUITY_CONTRACT_TYPE: &str = - "epiphany.cultmesh.continuity_contract"; -pub const EPIPHANY_CULTMESH_CONTINUITY_CONTRACT_SCHEMA_VERSION: &str = - "epiphany.cultmesh.continuity_contract.v0"; pub const EPIPHANY_CULTMESH_BIFROST_CONTRACT_TYPE: &str = "epiphany.cultmesh.bifrost_contract"; pub const EPIPHANY_CULTMESH_BIFROST_CONTRACT_SCHEMA_VERSION: &str = "epiphany.cultmesh.bifrost_contract.v0"; @@ -1855,174 +1835,6 @@ pub struct EpiphanyCultMeshDaemonToolInvocationReceiptEntry { pub notes: Vec, } -#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)] -#[cultcache( - type = "epiphany.cultmesh.mind_contract", - schema = "EpiphanyCultMeshMindContractEntry" -)] -pub struct EpiphanyCultMeshMindContractEntry { - #[cultcache(key = 0)] - pub schema_version: String, - #[cultcache(key = 1)] - pub contract_id: String, - #[cultcache(key = 2)] - pub verse_id: String, - #[cultcache(key = 3)] - pub document_type: String, - #[cultcache(key = 4)] - pub payload_schema_version: String, - #[cultcache(key = 5)] - pub authority: String, - #[cultcache(key = 6)] - pub operations: Vec, - #[cultcache(key = 7)] - pub intent_document_types: Vec, - #[cultcache(key = 8)] - pub receipt_document_types: Vec, - #[cultcache(key = 9)] - pub notes: Vec, -} - -#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)] -#[cultcache( - type = "epiphany.cultmesh.substrate_gate_contract", - schema = "EpiphanyCultMeshSubstrateGateContractEntry" -)] -pub struct EpiphanyCultMeshSubstrateGateContractEntry { - #[cultcache(key = 0)] - pub schema_version: String, - #[cultcache(key = 1)] - pub contract_id: String, - #[cultcache(key = 2)] - pub verse_id: String, - #[cultcache(key = 3)] - pub document_type: String, - #[cultcache(key = 4)] - pub payload_schema_version: String, - #[cultcache(key = 5)] - pub authority: String, - #[cultcache(key = 6)] - pub operations: Vec, - #[cultcache(key = 7)] - pub intent_document_types: Vec, - #[cultcache(key = 8)] - pub receipt_document_types: Vec, - #[cultcache(key = 9)] - pub notes: Vec, -} - -#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)] -#[cultcache( - type = "epiphany.cultmesh.eyes_contract", - schema = "EpiphanyCultMeshEyesContractEntry" -)] -pub struct EpiphanyCultMeshEyesContractEntry { - #[cultcache(key = 0)] - pub schema_version: String, - #[cultcache(key = 1)] - pub contract_id: String, - #[cultcache(key = 2)] - pub verse_id: String, - #[cultcache(key = 3)] - pub document_type: String, - #[cultcache(key = 4)] - pub payload_schema_version: String, - #[cultcache(key = 5)] - pub authority: String, - #[cultcache(key = 6)] - pub operations: Vec, - #[cultcache(key = 7)] - pub intent_document_types: Vec, - #[cultcache(key = 8)] - pub receipt_document_types: Vec, - #[cultcache(key = 9)] - pub notes: Vec, -} - -#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)] -#[cultcache( - type = "epiphany.cultmesh.hands_contract", - schema = "EpiphanyCultMeshHandsContractEntry" -)] -pub struct EpiphanyCultMeshHandsContractEntry { - #[cultcache(key = 0)] - pub schema_version: String, - #[cultcache(key = 1)] - pub contract_id: String, - #[cultcache(key = 2)] - pub verse_id: String, - #[cultcache(key = 3)] - pub document_type: String, - #[cultcache(key = 4)] - pub payload_schema_version: String, - #[cultcache(key = 5)] - pub authority: String, - #[cultcache(key = 6)] - pub operations: Vec, - #[cultcache(key = 7)] - pub intent_document_types: Vec, - #[cultcache(key = 8)] - pub receipt_document_types: Vec, - #[cultcache(key = 9)] - pub notes: Vec, -} - -#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)] -#[cultcache( - type = "epiphany.cultmesh.soul_contract", - schema = "EpiphanyCultMeshSoulContractEntry" -)] -pub struct EpiphanyCultMeshSoulContractEntry { - #[cultcache(key = 0)] - pub schema_version: String, - #[cultcache(key = 1)] - pub contract_id: String, - #[cultcache(key = 2)] - pub verse_id: String, - #[cultcache(key = 3)] - pub document_type: String, - #[cultcache(key = 4)] - pub payload_schema_version: String, - #[cultcache(key = 5)] - pub authority: String, - #[cultcache(key = 6)] - pub operations: Vec, - #[cultcache(key = 7)] - pub intent_document_types: Vec, - #[cultcache(key = 8)] - pub receipt_document_types: Vec, - #[cultcache(key = 9)] - pub notes: Vec, -} - -#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)] -#[cultcache( - type = "epiphany.cultmesh.continuity_contract", - schema = "EpiphanyCultMeshContinuityContractEntry" -)] -pub struct EpiphanyCultMeshContinuityContractEntry { - #[cultcache(key = 0)] - pub schema_version: String, - #[cultcache(key = 1)] - pub contract_id: String, - #[cultcache(key = 2)] - pub verse_id: String, - #[cultcache(key = 3)] - pub document_type: String, - #[cultcache(key = 4)] - pub payload_schema_version: String, - #[cultcache(key = 5)] - pub authority: String, - #[cultcache(key = 6)] - pub operations: Vec, - #[cultcache(key = 7)] - pub intent_document_types: Vec, - #[cultcache(key = 8)] - pub receipt_document_types: Vec, - #[cultcache(key = 9)] - pub notes: Vec, -} - #[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)] #[cultcache( type = "epiphany.cultmesh.bifrost_contract", @@ -2425,12 +2237,6 @@ cultmesh_documents!(EpiphanyCultMeshDocuments { EpiphanyCultMeshDaemonToolCapabilityEntry => EPIPHANY_CULTMESH_DAEMON_TOOL_CAPABILITY_SCHEMA_VERSION, EpiphanyCultMeshDaemonToolInvocationIntentEntry => EPIPHANY_CULTMESH_DAEMON_TOOL_INVOCATION_INTENT_SCHEMA_VERSION, EpiphanyCultMeshDaemonToolInvocationReceiptEntry => EPIPHANY_CULTMESH_DAEMON_TOOL_INVOCATION_RECEIPT_SCHEMA_VERSION, - EpiphanyCultMeshMindContractEntry => EPIPHANY_CULTMESH_MIND_CONTRACT_SCHEMA_VERSION, - EpiphanyCultMeshSubstrateGateContractEntry => EPIPHANY_CULTMESH_SUBSTRATE_GATE_CONTRACT_SCHEMA_VERSION, - EpiphanyCultMeshEyesContractEntry => EPIPHANY_CULTMESH_EYES_CONTRACT_SCHEMA_VERSION, - EpiphanyCultMeshHandsContractEntry => EPIPHANY_CULTMESH_HANDS_CONTRACT_SCHEMA_VERSION, - EpiphanyCultMeshSoulContractEntry => EPIPHANY_CULTMESH_SOUL_CONTRACT_SCHEMA_VERSION, - EpiphanyCultMeshContinuityContractEntry => EPIPHANY_CULTMESH_CONTINUITY_CONTRACT_SCHEMA_VERSION, EpiphanyCultMeshBifrostContractEntry => EPIPHANY_CULTMESH_BIFROST_CONTRACT_SCHEMA_VERSION, EpiphanyCultMeshBifrostBodyChangePublicationIntentEntry => EPIPHANY_CULTMESH_BIFROST_BODY_CHANGE_PUBLICATION_INTENT_SCHEMA_VERSION, EpiphanyCultMeshBifrostBodyChangePublicationReceiptEntry => EPIPHANY_CULTMESH_BIFROST_BODY_CHANGE_PUBLICATION_RECEIPT_SCHEMA_VERSION, @@ -5985,12 +5791,6 @@ pub fn seed_epiphany_local_verse_context( )?; } } - write_epiphany_cultmesh_mind_contracts(store_path, runtime_id.clone())?; - write_epiphany_cultmesh_substrate_gate_contracts(store_path, runtime_id.clone())?; - write_epiphany_cultmesh_eyes_contracts(store_path, runtime_id.clone())?; - write_epiphany_cultmesh_hands_contracts(store_path, runtime_id.clone())?; - write_epiphany_cultmesh_soul_contracts(store_path, runtime_id.clone())?; - write_epiphany_cultmesh_continuity_contracts(store_path, runtime_id.clone())?; write_epiphany_cultmesh_bifrost_contracts(store_path, runtime_id.clone())?; Ok(()) } @@ -6052,41 +5852,43 @@ pub fn query_epiphany_local_verse_context( let daemon_tool_capabilities = Vec::new(); let mut contract_summaries = Vec::new(); - collect_contract_summaries( - &node, - epiphany_cultmesh_mind_contracts(), - &mut contract_summaries, - )?; - collect_contract_summaries( - &node, - epiphany_cultmesh_substrate_gate_contracts(), - &mut contract_summaries, - )?; - collect_contract_summaries( - &node, - epiphany_cultmesh_eyes_contracts(), - &mut contract_summaries, - )?; - collect_contract_summaries( - &node, - epiphany_cultmesh_hands_contracts(), - &mut contract_summaries, - )?; - collect_contract_summaries( - &node, - epiphany_cultmesh_soul_contracts(), - &mut contract_summaries, - )?; - collect_contract_summaries( - &node, - epiphany_cultmesh_continuity_contracts(), - &mut contract_summaries, - )?; - collect_contract_summaries( - &node, - epiphany_cultmesh_bifrost_contracts(), - &mut contract_summaries, - )?; + contract_summaries.extend( + default_mind_cultnet_contracts() + .into_iter() + .map(IntoLocalVerseContractSummary::into_local_verse_summary), + ); + contract_summaries.extend( + default_substrate_gate_cultnet_contracts() + .into_iter() + .map(IntoLocalVerseContractSummary::into_local_verse_summary), + ); + contract_summaries.extend( + default_eyes_cultnet_contracts() + .into_iter() + .map(IntoLocalVerseContractSummary::into_local_verse_summary), + ); + contract_summaries.extend( + default_hands_cultnet_contracts() + .into_iter() + .map(IntoLocalVerseContractSummary::into_local_verse_summary), + ); + contract_summaries.extend( + default_soul_cultnet_contracts() + .into_iter() + .map(IntoLocalVerseContractSummary::into_local_verse_summary), + ); + contract_summaries.extend( + default_continuity_cultnet_contracts() + .into_iter() + .map(IntoLocalVerseContractSummary::into_local_verse_summary), + ); + for contract in epiphany_cultmesh_bifrost_contracts() { + if let Some(loaded) = + node.get::(&contract.contract_id)? + { + contract_summaries.push(loaded.into_local_verse_summary()); + } + } Ok(EpiphanyLocalVerseContext { schema_version: "epiphany.local_verse_context.v0".to_string(), @@ -6235,75 +6037,34 @@ pub fn load_epiphany_cultmesh_daemon_tool_directory( Ok(Vec::new()) } -pub trait EpiphanyCultMeshContractSummarySource: DatabaseEntry { - fn contract_id(&self) -> &str; - fn verse_id(&self) -> &str; - fn authority(&self) -> &str; - fn document_type(&self) -> &str; - fn operations(&self) -> &[String]; - fn receipt_document_types(&self) -> &[String]; +trait IntoLocalVerseContractSummary { + fn into_local_verse_summary(self) -> EpiphanyLocalVerseContractSummary; } -macro_rules! impl_contract_summary_source { +macro_rules! impl_local_verse_contract_summary { ($ty:ty) => { - impl EpiphanyCultMeshContractSummarySource for $ty { - fn contract_id(&self) -> &str { - &self.contract_id - } - - fn verse_id(&self) -> &str { - &self.verse_id - } - - fn authority(&self) -> &str { - &self.authority - } - - fn document_type(&self) -> &str { - &self.document_type - } - - fn operations(&self) -> &[String] { - &self.operations - } - - fn receipt_document_types(&self) -> &[String] { - &self.receipt_document_types + impl IntoLocalVerseContractSummary for $ty { + fn into_local_verse_summary(self) -> EpiphanyLocalVerseContractSummary { + EpiphanyLocalVerseContractSummary { + contract_id: self.contract_id, + verse_id: self.verse_id, + authority: self.authority, + document_type: self.document_type, + operations: self.operations, + receipt_document_types: self.receipt_document_types, + } } } }; } -impl_contract_summary_source!(EpiphanyCultMeshMindContractEntry); -impl_contract_summary_source!(EpiphanyCultMeshSubstrateGateContractEntry); -impl_contract_summary_source!(EpiphanyCultMeshEyesContractEntry); -impl_contract_summary_source!(EpiphanyCultMeshHandsContractEntry); -impl_contract_summary_source!(EpiphanyCultMeshSoulContractEntry); -impl_contract_summary_source!(EpiphanyCultMeshContinuityContractEntry); -impl_contract_summary_source!(EpiphanyCultMeshBifrostContractEntry); - -fn collect_contract_summaries( - node: &CultMeshNode, - contracts: Vec, - out: &mut Vec, -) -> Result<()> -where - T: EpiphanyCultMeshContractSummarySource, -{ - for contract in contracts { - if let Some(loaded) = node.get::(contract.contract_id())? { - out.push(EpiphanyLocalVerseContractSummary { - contract_id: loaded.contract_id().to_string(), - verse_id: loaded.verse_id().to_string(), - authority: loaded.authority().to_string(), - document_type: loaded.document_type().to_string(), - operations: loaded.operations().to_vec(), - receipt_document_types: loaded.receipt_document_types().to_vec(), - }); - } - } - Ok(()) -} +impl_local_verse_contract_summary!(crate::MindCultNetContract); +impl_local_verse_contract_summary!(crate::SubstrateGateCultNetContract); +impl_local_verse_contract_summary!(crate::EyesCultNetContract); +impl_local_verse_contract_summary!(crate::HandsCultNetContract); +impl_local_verse_contract_summary!(crate::SoulCultNetContract); +impl_local_verse_contract_summary!(crate::ContinuityCultNetContract); +impl_local_verse_contract_summary!(EpiphanyCultMeshBifrostContractEntry); fn epiphany_cultmesh_operator_snapshot_key(snapshot_id: &str) -> String { format!("epiphany-local/operator-snapshot/{snapshot_id}") @@ -7037,193 +6798,6 @@ pub(crate) fn write_legacy_provider_fixture( Ok(()) } -pub fn epiphany_cultmesh_mind_contracts() -> Vec { - default_mind_cultnet_contracts() - .into_iter() - .map(|contract| EpiphanyCultMeshMindContractEntry { - schema_version: EPIPHANY_CULTMESH_MIND_CONTRACT_SCHEMA_VERSION.to_string(), - contract_id: contract.contract_id, - verse_id: contract.verse_id, - document_type: contract.document_type, - payload_schema_version: contract.payload_schema_version, - authority: contract.authority, - operations: contract.operations, - intent_document_types: contract.intent_document_types, - receipt_document_types: contract.receipt_document_types, - notes: contract.notes, - }) - .collect() -} - -pub fn write_epiphany_cultmesh_mind_contracts( - store_path: impl AsRef, - runtime_id: impl Into, -) -> Result> { - let mut node = open_epiphany_cultmesh_node(store_path, runtime_id)?; - let mut written = Vec::new(); - for contract in epiphany_cultmesh_mind_contracts() { - written.push(node.put(contract.contract_id.clone(), &contract)?); - } - node.flush()?; - Ok(written) -} - -pub fn epiphany_cultmesh_substrate_gate_contracts() --> Vec { - default_substrate_gate_cultnet_contracts() - .into_iter() - .map(|contract| EpiphanyCultMeshSubstrateGateContractEntry { - schema_version: EPIPHANY_CULTMESH_SUBSTRATE_GATE_CONTRACT_SCHEMA_VERSION.to_string(), - contract_id: contract.contract_id, - verse_id: contract.verse_id, - document_type: contract.document_type, - payload_schema_version: contract.payload_schema_version, - authority: contract.authority, - operations: contract.operations, - intent_document_types: contract.intent_document_types, - receipt_document_types: contract.receipt_document_types, - notes: contract.notes, - }) - .collect() -} - -pub fn write_epiphany_cultmesh_substrate_gate_contracts( - store_path: impl AsRef, - runtime_id: impl Into, -) -> Result> { - let mut node = open_epiphany_cultmesh_node(store_path, runtime_id)?; - let mut written = Vec::new(); - for contract in epiphany_cultmesh_substrate_gate_contracts() { - written.push(node.put(contract.contract_id.clone(), &contract)?); - } - node.flush()?; - Ok(written) -} - -pub fn epiphany_cultmesh_eyes_contracts() -> Vec { - default_eyes_cultnet_contracts() - .into_iter() - .map(|contract| EpiphanyCultMeshEyesContractEntry { - schema_version: EPIPHANY_CULTMESH_EYES_CONTRACT_SCHEMA_VERSION.to_string(), - contract_id: contract.contract_id, - verse_id: contract.verse_id, - document_type: contract.document_type, - payload_schema_version: contract.payload_schema_version, - authority: contract.authority, - operations: contract.operations, - intent_document_types: contract.intent_document_types, - receipt_document_types: contract.receipt_document_types, - notes: contract.notes, - }) - .collect() -} - -pub fn write_epiphany_cultmesh_eyes_contracts( - store_path: impl AsRef, - runtime_id: impl Into, -) -> Result> { - let mut node = open_epiphany_cultmesh_node(store_path, runtime_id)?; - let mut written = Vec::new(); - for contract in epiphany_cultmesh_eyes_contracts() { - written.push(node.put(contract.contract_id.clone(), &contract)?); - } - node.flush()?; - Ok(written) -} - -pub fn epiphany_cultmesh_hands_contracts() -> Vec { - default_hands_cultnet_contracts() - .into_iter() - .map(|contract| EpiphanyCultMeshHandsContractEntry { - schema_version: EPIPHANY_CULTMESH_HANDS_CONTRACT_SCHEMA_VERSION.to_string(), - contract_id: contract.contract_id, - verse_id: contract.verse_id, - document_type: contract.document_type, - payload_schema_version: contract.payload_schema_version, - authority: contract.authority, - operations: contract.operations, - intent_document_types: contract.intent_document_types, - receipt_document_types: contract.receipt_document_types, - notes: contract.notes, - }) - .collect() -} - -pub fn write_epiphany_cultmesh_hands_contracts( - store_path: impl AsRef, - runtime_id: impl Into, -) -> Result> { - let mut node = open_epiphany_cultmesh_node(store_path, runtime_id)?; - let mut written = Vec::new(); - for contract in epiphany_cultmesh_hands_contracts() { - written.push(node.put(contract.contract_id.clone(), &contract)?); - } - node.flush()?; - Ok(written) -} - -pub fn epiphany_cultmesh_soul_contracts() -> Vec { - default_soul_cultnet_contracts() - .into_iter() - .map(|contract| EpiphanyCultMeshSoulContractEntry { - schema_version: EPIPHANY_CULTMESH_SOUL_CONTRACT_SCHEMA_VERSION.to_string(), - contract_id: contract.contract_id, - verse_id: contract.verse_id, - document_type: contract.document_type, - payload_schema_version: contract.payload_schema_version, - authority: contract.authority, - operations: contract.operations, - intent_document_types: contract.intent_document_types, - receipt_document_types: contract.receipt_document_types, - notes: contract.notes, - }) - .collect() -} - -pub fn write_epiphany_cultmesh_soul_contracts( - store_path: impl AsRef, - runtime_id: impl Into, -) -> Result> { - let mut node = open_epiphany_cultmesh_node(store_path, runtime_id)?; - let mut written = Vec::new(); - for contract in epiphany_cultmesh_soul_contracts() { - written.push(node.put(contract.contract_id.clone(), &contract)?); - } - node.flush()?; - Ok(written) -} - -pub fn epiphany_cultmesh_continuity_contracts() -> Vec { - default_continuity_cultnet_contracts() - .into_iter() - .map(|contract| EpiphanyCultMeshContinuityContractEntry { - schema_version: EPIPHANY_CULTMESH_CONTINUITY_CONTRACT_SCHEMA_VERSION.to_string(), - contract_id: contract.contract_id, - verse_id: contract.verse_id, - document_type: contract.document_type, - payload_schema_version: contract.payload_schema_version, - authority: contract.authority, - operations: contract.operations, - intent_document_types: contract.intent_document_types, - receipt_document_types: contract.receipt_document_types, - notes: contract.notes, - }) - .collect() -} - -pub fn write_epiphany_cultmesh_continuity_contracts( - store_path: impl AsRef, - runtime_id: impl Into, -) -> Result> { - let mut node = open_epiphany_cultmesh_node(store_path, runtime_id)?; - let mut written = Vec::new(); - for contract in epiphany_cultmesh_continuity_contracts() { - written.push(node.put(contract.contract_id.clone(), &contract)?); - } - node.flush()?; - Ok(written) -} - pub fn epiphany_cultmesh_bifrost_contracts() -> Vec { vec![ EpiphanyCultMeshBifrostContractEntry { @@ -10232,156 +9806,6 @@ mod tests { Ok(()) } - #[test] - fn mind_contracts_use_verses_to_keep_state_guarded() -> Result<()> { - let temp = tempfile::tempdir()?; - let store = temp.path().join("epiphany-mind-contracts.ccmp"); - let written = write_epiphany_cultmesh_mind_contracts(&store, "epiphany-test")?; - assert_eq!(written.len(), 3); - - let node = open_epiphany_cultmesh_node(&store, "epiphany-test")?; - let decision_context = node.get_required::( - "epiphany.mind.decision_context.snapshot", - )?; - let commit_receipt = node.get_required::( - "epiphany.mind.commit_receipt.snapshot", - )?; - - assert_eq!( - decision_context.verse_id, - EPIPHANY_CULTMESH_INTERNAL_VERSE_ID - ); - assert_eq!(decision_context.authority, "readOnly"); - assert!( - decision_context - .notes - .iter() - .any(|note| note.contains("terminal native request")) - ); - assert!( - commit_receipt - .notes - .iter() - .any(|note| note.contains("concrete invariant owner")) - ); - Ok(()) - } - - #[test] - fn substrate_gate_contracts_use_verses_to_keep_repo_access_guarded() -> Result<()> { - let temp = tempfile::tempdir()?; - let store = temp.path().join("epiphany-substrate-gate-contracts.ccmp"); - let written = write_epiphany_cultmesh_substrate_gate_contracts(&store, "epiphany-test")?; - assert!(written.len() >= 4); - - let node = open_epiphany_cultmesh_node(&store, "epiphany-test")?; - let repo_access = node.get_required::( - "epiphany.substrate_gate.repo_access.review", - )?; - - assert_eq!(repo_access.verse_id, EPIPHANY_CULTMESH_INTERNAL_VERSE_ID); - assert_eq!(repo_access.authority, "substrateGate"); - assert!( - repo_access - .notes - .iter() - .any(|note| note.contains("repo access protocol")) - ); - Ok(()) - } - - #[test] - fn eyes_contracts_use_verses_to_keep_evidence_guarded() -> Result<()> { - let temp = tempfile::tempdir()?; - let store = temp.path().join("epiphany-eyes-contracts.ccmp"); - let written = write_epiphany_cultmesh_eyes_contracts(&store, "epiphany-test")?; - assert!(written.len() >= 4); - - let node = open_epiphany_cultmesh_node(&store, "epiphany-test")?; - let evidence = node - .get_required::("epiphany.eyes.evidence.review")?; - - assert_eq!(evidence.verse_id, EPIPHANY_CULTMESH_INTERNAL_VERSE_ID); - assert_eq!(evidence.authority, "eyes"); - assert!( - evidence - .notes - .iter() - .any(|note| note.contains("evidence ingress guardian")) - ); - Ok(()) - } - - #[test] - fn hands_contracts_use_verses_to_keep_action_guarded() -> Result<()> { - let temp = tempfile::tempdir()?; - let store = temp.path().join("epiphany-hands-contracts.ccmp"); - let written = write_epiphany_cultmesh_hands_contracts(&store, "epiphany-test")?; - assert!(written.len() >= 5); - - let node = open_epiphany_cultmesh_node(&store, "epiphany-test")?; - let action = node - .get_required::("epiphany.hands.action.review")?; - - assert_eq!(action.verse_id, EPIPHANY_CULTMESH_INTERNAL_VERSE_ID); - assert_eq!(action.authority, "hands"); - assert!( - action - .notes - .iter() - .any(|note| note.contains("action organ")) - ); - Ok(()) - } - - #[test] - fn soul_contracts_use_verses_to_keep_verification_guarded() -> Result<()> { - let temp = tempfile::tempdir()?; - let store = temp.path().join("epiphany-soul-contracts.ccmp"); - let written = write_epiphany_cultmesh_soul_contracts(&store, "epiphany-test")?; - assert!(written.len() >= 5); - - let node = open_epiphany_cultmesh_node(&store, "epiphany-test")?; - let verification = node.get_required::( - "epiphany.soul.verification.review", - )?; - - assert_eq!(verification.verse_id, EPIPHANY_CULTMESH_INTERNAL_VERSE_ID); - assert_eq!(verification.authority, "soul"); - assert!( - verification - .notes - .iter() - .any(|note| note.contains("verification organ")) - ); - Ok(()) - } - - #[test] - fn continuity_contracts_use_verses_to_keep_continuity_guarded() -> Result<()> { - let temp = tempfile::tempdir()?; - let store = temp.path().join("epiphany-continuity-contracts.ccmp"); - let written = write_epiphany_cultmesh_continuity_contracts(&store, "epiphany-test")?; - assert!(written.iter().all(|contract| { - contract.document_type != "epiphany.continuity.sleep_distillation" - })); - - let node = open_epiphany_cultmesh_node(&store, "epiphany-test")?; - let continuity = node.get_required::( - "epiphany.continuity.review", - )?; - - assert_eq!(continuity.verse_id, EPIPHANY_CULTMESH_INTERNAL_VERSE_ID); - assert_eq!(continuity.authority, "continuity"); - assert!( - continuity - .notes - .iter() - .any(|note| note.contains("deterministic protocol surface")) - ); - Ok(()) - } - #[test] fn bifrost_contracts_expose_publication_without_feedback_admission_substitution() -> Result<()> { diff --git a/epiphany-core/src/lib.rs b/epiphany-core/src/lib.rs index 623aa26a..1fdec8e6 100644 --- a/epiphany-core/src/lib.rs +++ b/epiphany-core/src/lib.rs @@ -149,8 +149,6 @@ pub use cultmesh_integration::EPIPHANY_CULTMESH_BIFROST_GITHUB_PUBLICATION_RECEI pub use cultmesh_integration::EPIPHANY_CULTMESH_BIFROST_METRICS_RECEIPT_ARRIVAL_LATEST_KEY; pub use cultmesh_integration::EPIPHANY_CULTMESH_BIFROST_METRICS_RECEIPT_SCHEMA_VERSION; pub use cultmesh_integration::EPIPHANY_CULTMESH_BIFROST_METRICS_RECEIPT_TYPE; -pub use cultmesh_integration::EPIPHANY_CULTMESH_CONTINUITY_CONTRACT_SCHEMA_VERSION; -pub use cultmesh_integration::EPIPHANY_CULTMESH_CONTINUITY_CONTRACT_TYPE; pub use cultmesh_integration::EPIPHANY_CULTMESH_COORDINATOR_RUN_RECEIPT_LATEST_KEY; pub use cultmesh_integration::EPIPHANY_CULTMESH_COORDINATOR_RUN_RECEIPT_SCHEMA_VERSION; pub use cultmesh_integration::EPIPHANY_CULTMESH_COORDINATOR_RUN_RECEIPT_TYPE; @@ -182,8 +180,6 @@ pub use cultmesh_integration::EPIPHANY_CULTMESH_DAEMON_TOOL_INVOCATION_RECEIPT_S pub use cultmesh_integration::EPIPHANY_CULTMESH_DAEMON_TOOL_INVOCATION_RECEIPT_TYPE; pub use cultmesh_integration::EPIPHANY_CULTMESH_EVE_SURFACE_STATE_SCHEMA_VERSION; pub use cultmesh_integration::EPIPHANY_CULTMESH_EVE_SURFACE_STATE_TYPE; -pub use cultmesh_integration::EPIPHANY_CULTMESH_EYES_CONTRACT_SCHEMA_VERSION; -pub use cultmesh_integration::EPIPHANY_CULTMESH_EYES_CONTRACT_TYPE; pub use cultmesh_integration::EPIPHANY_CULTMESH_GLOBAL_ROOM_POLICY_SCHEMA_VERSION; pub use cultmesh_integration::EPIPHANY_CULTMESH_GLOBAL_ROOM_POLICY_TYPE; pub use cultmesh_integration::EPIPHANY_CULTMESH_GLOBAL_TIER; @@ -191,16 +187,12 @@ pub use cultmesh_integration::EPIPHANY_CULTMESH_GLOBAL_VERSE_ID; pub use cultmesh_integration::EPIPHANY_CULTMESH_HANDS_ACTION_GATE_LATEST_KEY; pub use cultmesh_integration::EPIPHANY_CULTMESH_HANDS_ACTION_GATE_SCHEMA_VERSION; pub use cultmesh_integration::EPIPHANY_CULTMESH_HANDS_ACTION_GATE_TYPE; -pub use cultmesh_integration::EPIPHANY_CULTMESH_HANDS_CONTRACT_SCHEMA_VERSION; -pub use cultmesh_integration::EPIPHANY_CULTMESH_HANDS_CONTRACT_TYPE; pub use cultmesh_integration::EPIPHANY_CULTMESH_INTERNAL_TIER; pub use cultmesh_integration::EPIPHANY_CULTMESH_INTERNAL_VERSE_ID; pub use cultmesh_integration::EPIPHANY_CULTMESH_LOCAL_AREA_TIER; pub use cultmesh_integration::EPIPHANY_CULTMESH_LOCAL_AREA_VERSE_ID; pub use cultmesh_integration::EPIPHANY_CULTMESH_MANAGED_SERVICE_POLICY_SCHEMA_VERSION; pub use cultmesh_integration::EPIPHANY_CULTMESH_MANAGED_SERVICE_POLICY_TYPE; -pub use cultmesh_integration::EPIPHANY_CULTMESH_MIND_CONTRACT_SCHEMA_VERSION; -pub use cultmesh_integration::EPIPHANY_CULTMESH_MIND_CONTRACT_TYPE; pub use cultmesh_integration::EPIPHANY_CULTMESH_OPERATOR_RUN_INTENT_LATEST_KEY; pub use cultmesh_integration::EPIPHANY_CULTMESH_OPERATOR_RUN_INTENT_SCHEMA_VERSION; pub use cultmesh_integration::EPIPHANY_CULTMESH_OPERATOR_RUN_INTENT_TYPE; @@ -230,13 +222,9 @@ pub use cultmesh_integration::EPIPHANY_CULTMESH_ROLE_REVIEW_EVENT_SCHEMA_VERSION pub use cultmesh_integration::EPIPHANY_CULTMESH_ROLE_REVIEW_EVENT_TYPE; pub use cultmesh_integration::EPIPHANY_CULTMESH_SEMANTIC_PROJECTION_HEALTH_SCHEMA_VERSION; pub use cultmesh_integration::EPIPHANY_CULTMESH_SEMANTIC_PROJECTION_HEALTH_TYPE; -pub use cultmesh_integration::EPIPHANY_CULTMESH_SOUL_CONTRACT_SCHEMA_VERSION; -pub use cultmesh_integration::EPIPHANY_CULTMESH_SOUL_CONTRACT_TYPE; pub use cultmesh_integration::EPIPHANY_CULTMESH_STATUS_KEY; pub use cultmesh_integration::EPIPHANY_CULTMESH_STATUS_SCHEMA_VERSION; pub use cultmesh_integration::EPIPHANY_CULTMESH_STATUS_TYPE; -pub use cultmesh_integration::EPIPHANY_CULTMESH_SUBSTRATE_GATE_CONTRACT_SCHEMA_VERSION; -pub use cultmesh_integration::EPIPHANY_CULTMESH_SUBSTRATE_GATE_CONTRACT_TYPE; pub use cultmesh_integration::EPIPHANY_CULTMESH_SWARM_BRAKE_KEY; pub use cultmesh_integration::EPIPHANY_CULTMESH_SWARM_BRAKE_SCHEMA_VERSION; pub use cultmesh_integration::EPIPHANY_CULTMESH_SWARM_BRAKE_TYPE; @@ -258,7 +246,6 @@ pub use cultmesh_integration::EpiphanyCultMeshBifrostGithubPublicationReceiptEnt pub use cultmesh_integration::EpiphanyCultMeshBifrostMetricsReceiptEntry; pub use cultmesh_integration::EpiphanyCultMeshBifrostPublicProofPublicationReceiptEntry; pub use cultmesh_integration::EpiphanyCultMeshClusterTopologyEntry; -pub use cultmesh_integration::EpiphanyCultMeshContinuityContractEntry; pub use cultmesh_integration::EpiphanyCultMeshCoordinatorRunReceiptEntry; pub use cultmesh_integration::EpiphanyCultMeshDaemonHeartbeatEventEntry; pub use cultmesh_integration::EpiphanyCultMeshDaemonPokeIntentEntry; @@ -272,14 +259,11 @@ pub use cultmesh_integration::EpiphanyCultMeshDaemonToolInvocationIntentEntry; pub use cultmesh_integration::EpiphanyCultMeshDaemonToolInvocationReceiptEntry; pub use cultmesh_integration::EpiphanyCultMeshDocuments; pub use cultmesh_integration::EpiphanyCultMeshEveSurfaceStateEntry; -pub use cultmesh_integration::EpiphanyCultMeshEyesContractEntry; pub use cultmesh_integration::EpiphanyCultMeshGlobalRoomPolicyEntry; pub use cultmesh_integration::EpiphanyCultMeshHandsActionGateEntry; -pub use cultmesh_integration::EpiphanyCultMeshHandsContractEntry; pub use cultmesh_integration::EpiphanyCultMeshIdunnAftercareAuditReceiptEntry; pub use cultmesh_integration::EpiphanyCultMeshIdunnDeploymentReceiptEntry; pub use cultmesh_integration::EpiphanyCultMeshManagedServicePolicyEntry; -pub use cultmesh_integration::EpiphanyCultMeshMindContractEntry; pub use cultmesh_integration::EpiphanyCultMeshOdinAdvertisementEntry; pub use cultmesh_integration::EpiphanyCultMeshOperatorRunIntentEntry; pub use cultmesh_integration::EpiphanyCultMeshOperatorRunReceiptEntry; @@ -291,9 +275,7 @@ pub use cultmesh_integration::EpiphanyCultMeshRepoWorkPublicProofEntry; pub use cultmesh_integration::EpiphanyCultMeshRepoWorkReadinessEntry; pub use cultmesh_integration::EpiphanyCultMeshRoleReviewEventEntry; pub use cultmesh_integration::EpiphanyCultMeshSemanticProjectionHealthEntry; -pub use cultmesh_integration::EpiphanyCultMeshSoulContractEntry; pub use cultmesh_integration::EpiphanyCultMeshStatusEntry; -pub use cultmesh_integration::EpiphanyCultMeshSubstrateGateContractEntry; pub use cultmesh_integration::EpiphanyCultMeshSwarmBrakeEntry; pub use cultmesh_integration::EpiphanyCultMeshVersePolicyEntry; pub use cultmesh_integration::EpiphanyCultMeshWeksaLoweringReceiptEntry; @@ -320,7 +302,6 @@ pub use cultmesh_integration::epiphany_cultmesh_bifrost_github_publication_recei pub use cultmesh_integration::epiphany_cultmesh_bifrost_metrics_receipt_for_map_entry; #[cfg(test)] pub use cultmesh_integration::epiphany_cultmesh_bifrost_public_proof_publication_receipt_for_proof; -pub use cultmesh_integration::epiphany_cultmesh_continuity_contracts; pub use cultmesh_integration::epiphany_cultmesh_coordinator_run_receipt_from_summary_json; pub use cultmesh_integration::epiphany_cultmesh_daemon_poke_intent_from_status; pub use cultmesh_integration::epiphany_cultmesh_daemon_poke_receipt_for_intent; @@ -329,16 +310,10 @@ pub use cultmesh_integration::epiphany_cultmesh_daemon_tool_invocation_from_stat pub use cultmesh_integration::epiphany_cultmesh_daemon_tool_invocation_intent_from_capability; #[cfg(test)] pub use cultmesh_integration::epiphany_cultmesh_daemon_tool_invocation_receipt_for_intent; -pub use cultmesh_integration::epiphany_cultmesh_eyes_contracts; pub use cultmesh_integration::epiphany_cultmesh_global_room_policies; pub use cultmesh_integration::epiphany_cultmesh_hands_action_gate_from_summary_json; -pub use cultmesh_integration::epiphany_cultmesh_hands_contracts; -#[cfg(test)] -pub use cultmesh_integration::epiphany_cultmesh_mind_contracts; pub use cultmesh_integration::epiphany_cultmesh_operator_snapshot_from_status_json; pub use cultmesh_integration::epiphany_cultmesh_role_review_event_from_summary_json; -pub use cultmesh_integration::epiphany_cultmesh_soul_contracts; -pub use cultmesh_integration::epiphany_cultmesh_substrate_gate_contracts; pub use cultmesh_integration::epiphany_cultmesh_verse_policies; pub use cultmesh_integration::epiphany_local_verse_work_loop_summary; pub use cultmesh_integration::epiphany_service_execution_audit_report; @@ -418,7 +393,6 @@ pub use cultmesh_integration::write_epiphany_cultmesh_bifrost_github_publication pub use cultmesh_integration::write_epiphany_cultmesh_bifrost_metrics_receipt; #[cfg(test)] pub use cultmesh_integration::write_epiphany_cultmesh_bifrost_public_proof_publication_receipt; -pub use cultmesh_integration::write_epiphany_cultmesh_continuity_contracts; pub use cultmesh_integration::write_epiphany_cultmesh_coordinator_run_receipt; pub use cultmesh_integration::write_epiphany_cultmesh_daemon_heartbeat_event; pub use cultmesh_integration::write_epiphany_cultmesh_daemon_poke_intent; @@ -430,22 +404,17 @@ pub use cultmesh_integration::write_epiphany_cultmesh_daemon_status; pub use cultmesh_integration::write_epiphany_cultmesh_daemon_tool_invocation_intent; #[cfg(test)] pub use cultmesh_integration::write_epiphany_cultmesh_daemon_tool_invocation_receipt; -pub use cultmesh_integration::write_epiphany_cultmesh_eyes_contracts; pub use cultmesh_integration::write_epiphany_cultmesh_global_room_policies; pub use cultmesh_integration::write_epiphany_cultmesh_hands_action_gate; -pub use cultmesh_integration::write_epiphany_cultmesh_hands_contracts; #[cfg(test)] pub use cultmesh_integration::write_epiphany_cultmesh_managed_service_policy; -pub use cultmesh_integration::write_epiphany_cultmesh_mind_contracts; pub use cultmesh_integration::write_epiphany_cultmesh_operator_run_intent; pub use cultmesh_integration::write_epiphany_cultmesh_operator_run_receipt; pub use cultmesh_integration::write_epiphany_cultmesh_operator_snapshot; pub use cultmesh_integration::write_epiphany_cultmesh_persona_speech_audit; pub use cultmesh_integration::write_epiphany_cultmesh_role_review_event; pub use cultmesh_integration::write_epiphany_cultmesh_semantic_projector_service_policy; -pub use cultmesh_integration::write_epiphany_cultmesh_soul_contracts; pub use cultmesh_integration::write_epiphany_cultmesh_status; -pub use cultmesh_integration::write_epiphany_cultmesh_substrate_gate_contracts; pub use cultmesh_integration::write_epiphany_cultmesh_swarm_brake; pub use cultmesh_integration::write_epiphany_cultmesh_verse_policies; pub use cultmesh_integration::write_epiphany_cultmesh_weksa_lowering_receipt;