Attach Epiphany to CultNet Rust
This commit is contained in:
parent
c5f513aa5c
commit
2607cb1aea
5 changed files with 55 additions and 0 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"] }
|
||||
|
|
|
|||
50
epiphany-core/tests/cultnet_backend.rs
Normal file
50
epiphany-core/tests/cultnet_backend.rs
Normal file
|
|
@ -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::<EpiphanyAgentMemoryEntry>()?;
|
||||
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::<EpiphanyAgentMemoryEntry>(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::<EpiphanyAgentMemoryEntry>()?;
|
||||
target_cache.add_generic_backing_store(SingleFileMessagePackBackingStore::new(&target_store));
|
||||
target_cache.pull_all_backing_stores()?;
|
||||
let applied = registry
|
||||
.apply_snapshot_response::<EpiphanyAgentMemoryEntry>(&mut target_cache, &snapshot)?;
|
||||
assert_eq!(applied.len(), 8);
|
||||
assert!(
|
||||
target_cache
|
||||
.get::<EpiphanyAgentMemoryEntry>("coordinator")?
|
||||
.is_some()
|
||||
);
|
||||
|
||||
let status = agent_memory_status(&target_store)?;
|
||||
assert_eq!(status["ok"], true);
|
||||
Ok(())
|
||||
}
|
||||
Binary file not shown.
1
vendor/cultnet-rs
vendored
Submodule
1
vendor/cultnet-rs
vendored
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 38e796fb04ac3374f57d0b2d30017f1f56f04fce
|
||||
Reference in a new issue