From 2607cb1aea308f3db276befe03f87c000209e77d Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 6 May 2026 06:58:25 +0100 Subject: [PATCH] Attach Epiphany to CultNet Rust --- .gitmodules | 3 ++ epiphany-core/Cargo.toml | 1 + epiphany-core/tests/cultnet_backend.rs | 50 +++++++++++++++++++++++++ state/ledgers.msgpack | Bin 39421 -> 39793 bytes vendor/cultnet-rs | 1 + 5 files changed, 55 insertions(+) create mode 100644 epiphany-core/tests/cultnet_backend.rs create mode 160000 vendor/cultnet-rs diff --git a/.gitmodules b/.gitmodules index 6b0fc3b4..156588d7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "vendor/cultcache-rs"] path = vendor/cultcache-rs url = https://github.com/GameCult/cultcache-rs.git +[submodule "vendor/cultnet-rs"] + path = vendor/cultnet-rs + url = https://github.com/GameCult/cultnet-rs.git diff --git a/epiphany-core/Cargo.toml b/epiphany-core/Cargo.toml index f90265f4..7dc289f0 100644 --- a/epiphany-core/Cargo.toml +++ b/epiphany-core/Cargo.toml @@ -16,6 +16,7 @@ chrono = "0.4.44" codex-file-search = { path = "../vendor/codex/codex-rs/file-search" } codex-protocol = { path = "../vendor/codex/codex-rs/protocol" } cultcache-rs = { path = "../vendor/cultcache-rs" } +cultnet-rs = { path = "../vendor/cultnet-rs" } ignore = "0.4.23" reqwest = { version = "0.12", features = ["blocking", "json"] } serde = { version = "1", features = ["derive"] } diff --git a/epiphany-core/tests/cultnet_backend.rs b/epiphany-core/tests/cultnet_backend.rs new file mode 100644 index 00000000..3482a32d --- /dev/null +++ b/epiphany-core/tests/cultnet_backend.rs @@ -0,0 +1,50 @@ +use anyhow::Result; +use cultcache_rs::CultCache; +use cultcache_rs::SingleFileMessagePackBackingStore; +use cultnet_rs::CultNetDocumentBinding; +use cultnet_rs::CultNetDocumentRegistry; +use epiphany_core::EpiphanyAgentMemoryEntry; +use epiphany_core::agent_memory_status; + +#[test] +fn epiphany_agent_memory_can_move_over_cultnet_documents() -> Result<()> { + let temp = tempfile::tempdir()?; + let source_store = temp.path().join("source-agents.msgpack"); + let target_store = temp.path().join("target-agents.msgpack"); + std::fs::copy("../state/agents.msgpack", &source_store)?; + + let mut source_cache = CultCache::new(); + source_cache.register_entry_type::()?; + source_cache.add_generic_backing_store(SingleFileMessagePackBackingStore::new(&source_store)); + source_cache.pull_all_backing_stores()?; + + let mut registry = CultNetDocumentRegistry::new(); + registry.register( + CultNetDocumentBinding::for_entry::(Some( + "ghostlight.agent_state.v0".to_string(), + )), + ); + let snapshot = registry.create_snapshot_response( + &source_cache, + "epiphany-agent-memory-snapshot", + None, + None, + )?; + + let mut target_cache = CultCache::new(); + target_cache.register_entry_type::()?; + target_cache.add_generic_backing_store(SingleFileMessagePackBackingStore::new(&target_store)); + target_cache.pull_all_backing_stores()?; + let applied = registry + .apply_snapshot_response::(&mut target_cache, &snapshot)?; + assert_eq!(applied.len(), 8); + assert!( + target_cache + .get::("coordinator")? + .is_some() + ); + + let status = agent_memory_status(&target_store)?; + assert_eq!(status["ok"], true); + Ok(()) +} diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 816d953e8d789d4c8a9faf5e2a53debe65516fc3..b97f0c40389363b9292c075334cce19c34c0fcd3 100644 GIT binary patch delta 381 zcmZvY!Ab)`42Ef+!ehjvZo3rQVy{KSiwE%}g2dg}8Qh&2CfSue)q@XE5LEEy8%Raa zxAFl5)5>}fFCmaW`Tjp&%kJk}cd^-h+I!i$?{vW%T9x_7pQiASU{1X5f!q4HQCQNpBb`e@vt95+531QU1?M B4)g#3 diff --git a/vendor/cultnet-rs b/vendor/cultnet-rs new file mode 160000 index 00000000..38e796fb --- /dev/null +++ b/vendor/cultnet-rs @@ -0,0 +1 @@ +Subproject commit 38e796fb04ac3374f57d0b2d30017f1f56f04fce