Consume the core stack from CultLib instead of forking it

Epiphany carried three vendored copies: CultCache and CultNet as submodules on
their own branches of the retiring standalone repos, and a 491-line in-tree
CultMesh, a third Rust CultMesh lineage after CultLib's and Odin's.

None of it was load-bearing. Against CultLib the CultCache fork held nothing
unique, CultNet held one function that CultLib had all along but kept private,
and CultMesh held two thin delegations to CultCache. All three are now exposed
in CultLib, so this repoint needed no code changes at all: the workspace
compiles and its 16 test binaries pass against the pinned revision unchanged.

The submodule working tree also carried an uncommitted change, which turned out
to be a rustfmt reflow of one test expression. Nothing was lost with it.

Only the manifests move here. The in-flight epiphany-core work is left
uncommitted and untouched.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-04 04:21:52 +02:00
commit 68939b2c1f
13 changed files with 14 additions and 1787 deletions

6
.gitmodules vendored
View file

@ -1,6 +0,0 @@
[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

31
Cargo.lock generated
View file

@ -364,6 +364,7 @@ dependencies = [
[[package]]
name = "cultcache-rs"
version = "0.1.0"
source = "git+https://github.com/GameCult/CultLib.git?rev=e171eca32329baa928f4a1d810401a8b4c857029#e171eca32329baa928f4a1d810401a8b4c857029"
dependencies = [
"anyhow",
"chrono",
@ -381,6 +382,7 @@ dependencies = [
[[package]]
name = "cultcache-rs-derive"
version = "0.1.0"
source = "git+https://github.com/GameCult/CultLib.git?rev=e171eca32329baa928f4a1d810401a8b4c857029#e171eca32329baa928f4a1d810401a8b4c857029"
dependencies = [
"proc-macro2",
"quote",
@ -390,18 +392,18 @@ dependencies = [
[[package]]
name = "cultmesh-rs"
version = "0.1.0"
source = "git+https://github.com/GameCult/CultLib.git?rev=e171eca32329baa928f4a1d810401a8b4c857029#e171eca32329baa928f4a1d810401a8b4c857029"
dependencies = [
"anyhow",
"cultcache-rs",
"cultnet-rs",
"pretty_assertions",
"serde",
"tempfile",
]
[[package]]
name = "cultnet-rs"
version = "0.1.0"
source = "git+https://github.com/GameCult/CultLib.git?rev=e171eca32329baa928f4a1d810401a8b4c857029#e171eca32329baa928f4a1d810401a8b4c857029"
dependencies = [
"aes-gcm",
"anyhow",
@ -410,7 +412,6 @@ dependencies = [
"cultcache-rs",
"ed25519-dalek",
"hmac",
"pretty_assertions",
"rand 0.9.5",
"rmp-serde",
"rmpv",
@ -419,9 +420,9 @@ dependencies = [
"serde_json",
"sha2",
"socket2 0.5.10",
"tempfile",
"uuid",
"windows-sys 0.61.2",
"zeroize",
]
[[package]]
@ -461,12 +462,6 @@ dependencies = [
"zeroize",
]
[[package]]
name = "diff"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8"
[[package]]
name = "digest"
version = "0.10.7"
@ -1388,16 +1383,6 @@ dependencies = [
"zerocopy",
]
[[package]]
name = "pretty_assertions"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ae130e2f271fbc2ac3a40fb1d07180839cdbbe443c7a27e1e3c13c5cac0116d"
dependencies = [
"diff",
"yansi",
]
[[package]]
name = "proc-macro2"
version = "1.0.107"
@ -2823,12 +2808,6 @@ version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4"
[[package]]
name = "yansi"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049"
[[package]]
name = "yoke"
version = "0.8.3"

View file

@ -6,7 +6,6 @@ members = [
"epiphany-tool-adapter",
"epiphany-tool-mcp-runtime",
]
exclude = ["vendor/cultcache-rs"]
resolver = "3"
[package]
@ -21,8 +20,8 @@ license-file = "LICENSE"
anyhow = "1"
chrono = "0.4.44"
ctrlc = { version = "3.5.1", features = ["termination"] }
cultcache-rs = { path = "vendor/cultcache-rs" }
cultnet-rs = { path = "vendor/cultnet-rs" }
cultcache-rs = { git = "https://github.com/GameCult/CultLib.git", rev = "e171eca32329baa928f4a1d810401a8b4c857029", package = "cultcache-rs" }
cultnet-rs = { git = "https://github.com/GameCult/CultLib.git", rev = "e171eca32329baa928f4a1d810401a8b4c857029", package = "cultnet-rs" }
epiphany-core = { path = "epiphany-core" }
epiphany-model-adapter = { path = "epiphany-model-adapter" }
epiphany-openai-runtime = { path = "epiphany-openai-runtime", optional = true }

View file

@ -14,9 +14,9 @@ path = "src/lib.rs"
anyhow = "1"
chrono = "0.4.44"
ctrlc = { version = "3.5.1", features = ["termination"] }
cultcache-rs = { path = "../vendor/cultcache-rs" }
cultmesh-rs = { path = "../vendor/cultmesh-rs" }
cultnet-rs = { path = "../vendor/cultnet-rs" }
cultcache-rs = { git = "https://github.com/GameCult/CultLib.git", rev = "e171eca32329baa928f4a1d810401a8b4c857029", package = "cultcache-rs" }
cultmesh-rs = { git = "https://github.com/GameCult/CultLib.git", rev = "e171eca32329baa928f4a1d810401a8b4c857029", package = "cultmesh-rs" }
cultnet-rs = { git = "https://github.com/GameCult/CultLib.git", rev = "e171eca32329baa928f4a1d810401a8b4c857029", package = "cultnet-rs" }
epiphany-model-adapter = { path = "../epiphany-model-adapter" }
epiphany-tool-adapter = { path = "../epiphany-tool-adapter" }
fs2 = "0.4"

View file

@ -12,7 +12,7 @@ path = "src/lib.rs"
[dependencies]
anyhow = "1"
codex-connector = { git = "https://github.com/GameCult/CodexConnector", rev = "be1776ab455fd79bd74b393518ab07211dc9c1f0", default-features = false }
cultcache-rs = { path = "../vendor/cultcache-rs" }
cultcache-rs = { git = "https://github.com/GameCult/CultLib.git", rev = "e171eca32329baa928f4a1d810401a8b4c857029", package = "cultcache-rs" }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
sha2 = "0.10"

View file

@ -13,7 +13,7 @@ path = "src/lib.rs"
[dependencies]
anyhow = "1"
chrono = "0.4.44"
cultcache-rs = { path = "../vendor/cultcache-rs" }
cultcache-rs = { git = "https://github.com/GameCult/CultLib.git", rev = "e171eca32329baa928f4a1d810401a8b4c857029", package = "cultcache-rs" }
epiphany-core = { path = "../epiphany-core" }
epiphany-model-adapter = { path = "../epiphany-model-adapter" }
epiphany-tool-adapter = { path = "../epiphany-tool-adapter" }

View file

@ -8,6 +8,6 @@ name = "epiphany_tool_adapter"
path = "src/lib.rs"
[dependencies]
cultcache-rs = { path = "../vendor/cultcache-rs" }
cultcache-rs = { git = "https://github.com/GameCult/CultLib.git", rev = "e171eca32329baa928f4a1d810401a8b4c857029", package = "cultcache-rs" }
serde = { version = "1", features = ["derive"] }
serde_json = "1"

View file

@ -11,7 +11,7 @@ anyhow = "1"
chrono = "0.4.44"
epiphany-tool-adapter = { path = "../epiphany-tool-adapter" }
epiphany-core = { path = "../epiphany-core" }
cultcache-rs = { path = "../vendor/cultcache-rs" }
cultcache-rs = { git = "https://github.com/GameCult/CultLib.git", rev = "e171eca32329baa928f4a1d810401a8b4c857029", package = "cultcache-rs" }
http = "1"
reqwest = { version = "0.13.2", default-features = false, features = ["json", "rustls"] }
sha2 = "0.10"

1
vendor/cultcache-rs vendored

@ -1 +0,0 @@
Subproject commit fdbf3bf0a4b3f6b617c224d7439feb8e69d4474c

1232
vendor/cultmesh-rs/Cargo.lock generated vendored

File diff suppressed because it is too large Load diff

View file

@ -1,19 +0,0 @@
[package]
name = "cultmesh-rs"
version = "0.1.0"
edition = "2024"
publish = false
[lib]
name = "cultmesh_rs"
path = "src/lib.rs"
[dependencies]
anyhow = "1"
cultcache-rs = { path = "../cultcache-rs" }
cultnet-rs = { path = "../cultnet-rs" }
serde = { version = "1", features = ["derive"] }
[dev-dependencies]
pretty_assertions = "1.4.1"
tempfile = "3"

View file

@ -1,492 +0,0 @@
use anyhow::Result;
use cultcache_rs::CultCache;
use cultcache_rs::CultSoaTable;
use cultcache_rs::DatabaseEntry;
use cultcache_rs::SingleFileMessagePackBackingStore;
use cultcache_rs::SoaDocument;
use cultnet_rs::CultNetDocumentPutOptions;
use cultnet_rs::CultNetDocumentRegistry;
use cultnet_rs::CultNetRudpSocketTransportConnection;
use cultnet_rs::CultNetRudpSocketTransportOptions;
use cultnet_rs::CultNetWireContract;
use cultnet_rs::encode_cultnet_message_to_vec;
use serde::Serialize;
use std::net::SocketAddr;
use std::net::UdpSocket;
use std::path::Path;
use std::thread;
use std::time::Duration;
use std::time::Instant;
pub const CULTMESH_RUDP_DOCUMENT_CATALOG_CONNECTION_ID: u32 = 0x0d1d_0002;
pub trait CultMeshDocumentSet: Clone + Send + Sync + 'static {
fn register_cache(&self, cache: &mut CultCache) -> Result<()>;
fn register_documents(&self, registry: &mut CultNetDocumentRegistry) -> Result<()>;
}
#[macro_export]
macro_rules! cultmesh_documents {
($name:ident { $($entry:ty => $schema_version:expr),* $(,)? }) => {
#[derive(Clone, Copy, Debug, Default)]
pub struct $name;
impl $crate::CultMeshDocumentSet for $name {
fn register_cache(
&self,
cache: &mut cultcache_rs::CultCache,
) -> ::anyhow::Result<()> {
$(
cache.register_entry_type::<$entry>()?;
)*
Ok(())
}
fn register_documents(
&self,
registry: &mut cultnet_rs::CultNetDocumentRegistry,
) -> ::anyhow::Result<()> {
$(
registry.register(
cultnet_rs::CultNetDocumentBinding::for_entry_with_schema_id::<$entry>(
$schema_version.to_string(),
$schema_version.to_string(),
),
);
)*
Ok(())
}
}
};
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct CultMeshNodeOptions {
pub runtime_id: String,
pub pull_on_start: bool,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct CultMeshRudpDocumentPublishOptions {
pub target: SocketAddr,
pub runtime_id: String,
pub connection_id: u32,
pub connect_timeout: Duration,
pub flush_timeout: Duration,
pub poll_interval: Duration,
pub resend_delay_ms: u64,
pub source_agent_id: Option<String>,
pub source_role: Option<String>,
pub tags: Vec<String>,
}
impl CultMeshRudpDocumentPublishOptions {
pub fn odin(target: SocketAddr, runtime_id: impl Into<String>) -> Self {
Self {
target,
runtime_id: runtime_id.into(),
..Self::default()
}
}
}
impl Default for CultMeshRudpDocumentPublishOptions {
fn default() -> Self {
Self {
target: SocketAddr::from(([127, 0, 0, 1], 17871)),
runtime_id: "cultmesh-rudp-document-publisher".to_string(),
connection_id: CULTMESH_RUDP_DOCUMENT_CATALOG_CONNECTION_ID,
connect_timeout: Duration::from_secs(1),
flush_timeout: Duration::from_millis(150),
poll_interval: Duration::from_millis(5),
resend_delay_ms: 100,
source_agent_id: None,
source_role: None,
tags: Vec::new(),
}
}
}
impl Default for CultMeshNodeOptions {
fn default() -> Self {
Self {
runtime_id: "cultmesh-local".to_string(),
pull_on_start: true,
}
}
}
pub struct CultMeshNode {
runtime_id: String,
cache: CultCache,
documents: CultNetDocumentRegistry,
}
impl CultMeshNode {
pub fn runtime_id(&self) -> &str {
&self.runtime_id
}
pub fn cache(&self) -> &CultCache {
&self.cache
}
pub fn documents(&self) -> &CultNetDocumentRegistry {
&self.documents
}
pub fn get<T: DatabaseEntry>(&self, key: &str) -> Result<Option<T>> {
self.cache.get::<T>(key)
}
pub fn get_required<T: DatabaseEntry>(&self, key: &str) -> Result<T> {
self.cache.get_required::<T>(key)
}
pub fn get_all_with_keys<T: DatabaseEntry>(&self) -> Result<Vec<(String, T)>> {
self.cache.get_all_with_keys::<T>()
}
pub fn soa<T: SoaDocument>(&self) -> Result<CultSoaTable<T>> {
self.cache.soa::<T>()
}
pub fn put<T: DatabaseEntry>(&mut self, key: impl Into<String>, value: &T) -> Result<T> {
self.cache.put(key, value)
}
pub fn delete<T: DatabaseEntry>(&mut self, key: &str) -> Result<bool> {
self.cache.delete::<T>(key)
}
pub fn flush(&mut self) -> Result<()> {
Ok(())
}
pub fn publish_document_to_rudp_catalog<T>(
&self,
key: impl Into<String>,
value: &T,
options: CultMeshRudpDocumentPublishOptions,
) -> Result<()>
where
T: DatabaseEntry + Serialize,
{
let key = key.into();
let message = self.documents.create_raw_document_put_message(
format!("{}:{}:{}", options.runtime_id, T::TYPE, key),
key,
value,
CultNetDocumentPutOptions {
source_runtime_id: Some(options.runtime_id.clone()),
source_agent_id: options.source_agent_id.clone(),
source_role: options.source_role.clone(),
tags: if options.tags.is_empty() {
None
} else {
Some(options.tags.clone())
},
..CultNetDocumentPutOptions::default()
},
)?;
publish_cultnet_message_to_rudp_catalog(&message, options)
}
}
fn publish_cultnet_message_to_rudp_catalog(
message: &cultnet_rs::CultNetMessage,
options: CultMeshRudpDocumentPublishOptions,
) -> Result<()> {
if options.runtime_id.trim().is_empty() {
anyhow::bail!("runtime_id must be non-empty");
}
let bind_addr = if options.target.is_ipv4() {
SocketAddr::from(([0, 0, 0, 0], 0))
} else {
SocketAddr::from(([0, 0, 0, 0, 0, 0, 0, 0], 0))
};
let socket = UdpSocket::bind(bind_addr)?;
socket.set_read_timeout(Some(options.poll_interval))?;
let mut client = CultNetRudpSocketTransportConnection::new(
CultNetRudpSocketTransportOptions {
runtime_id: options.runtime_id.clone(),
socket,
mode: cultnet_rs::CultNetRudpSocketMode::Client,
remote_addr: Some(options.target),
connection_id: options.connection_id,
initial_sequence: 1,
resend_delay_ms: options.resend_delay_ms,
transport_id: Some("cultmesh-rudp-document-publisher".to_string()),
max_payload_bytes: None,
max_fragment_bytes: Some(1200),
max_pending_reliable_packets: Some(64),
media_reliable_expire_after_ms: None,
},
)?;
client.connect(Vec::new())?;
let connect_deadline = Instant::now() + options.connect_timeout;
while !client.connected() && Instant::now() < connect_deadline {
let _ = client.receive_once()?;
client.poll_resends()?;
thread::sleep(options.poll_interval);
}
if !client.connected() {
anyhow::bail!(
"Timed out connecting CultMesh RUDP document publisher {} to {}",
options.runtime_id,
options.target
);
}
let payload = encode_cultnet_message_to_vec(message, CultNetWireContract::CultNetSchemaV0)?;
client.send("schema", payload)?;
let flush_deadline = Instant::now() + options.flush_timeout;
while Instant::now() < flush_deadline {
let _ = client.receive_once()?;
client.poll_resends()?;
thread::sleep(options.poll_interval);
}
Ok(())
}
#[derive(Clone, Copy, Debug, Default)]
pub struct CultMesh;
impl CultMesh {
pub fn create_node<D>(
store_path: impl AsRef<Path>,
documents: D,
options: CultMeshNodeOptions,
) -> Result<CultMeshNode>
where
D: CultMeshDocumentSet,
{
let mut cache = CultCache::new();
documents.register_cache(&mut cache)?;
cache
.add_generic_backing_store(SingleFileMessagePackBackingStore::new(store_path.as_ref()));
if options.pull_on_start {
cache.pull_all_backing_stores()?;
}
let mut registry = CultNetDocumentRegistry::new();
documents.register_documents(&mut registry)?;
Ok(CultMeshNode {
runtime_id: options.runtime_id,
cache,
documents: registry,
})
}
pub fn start_node<D>(
store_path: impl AsRef<Path>,
documents: D,
options: CultMeshNodeOptions,
) -> Result<CultMeshNode>
where
D: CultMeshDocumentSet,
{
Self::create_node(store_path, documents, options)
}
}
pub fn create_node<D>(
store_path: impl AsRef<Path>,
documents: D,
options: CultMeshNodeOptions,
) -> Result<CultMeshNode>
where
D: CultMeshDocumentSet,
{
CultMesh::create_node(store_path, documents, options)
}
pub fn start_node<D>(
store_path: impl AsRef<Path>,
documents: D,
options: CultMeshNodeOptions,
) -> Result<CultMeshNode>
where
D: CultMeshDocumentSet,
{
CultMesh::start_node(store_path, documents, options)
}
#[cfg(test)]
mod tests {
use super::*;
use pretty_assertions::assert_eq;
use std::collections::BTreeMap;
use std::net::UdpSocket;
use std::thread;
use std::time::Duration;
use std::time::Instant;
#[derive(Clone, Debug, PartialEq, Eq, cultcache_rs::DatabaseEntry)]
#[cultcache(type = "cultmesh.test.note", schema = "CultMeshTestNote")]
struct Note {
#[cultcache(key = 0)]
body: String,
#[cultcache(key = 1, default)]
owner: String,
}
impl cultcache_rs::SoaDocument for Note {
fn soa_columns(rows: &[Self]) -> BTreeMap<&'static str, cultcache_rs::CultSoaColumnValues> {
let mut columns = BTreeMap::new();
columns.insert(
"body",
cultcache_rs::CultSoaColumnValues::new(
rows.iter().map(|row| row.body.clone()).collect::<Vec<_>>(),
),
);
columns.insert(
"owner",
cultcache_rs::CultSoaColumnValues::new(
rows.iter().map(|row| row.owner.clone()).collect::<Vec<_>>(),
),
);
columns
}
}
cultmesh_documents!(TestDocuments {
Note => "cultmesh.test.note.v0",
});
#[test]
fn node_round_trips_registered_documents() -> Result<()> {
let temp = tempfile::tempdir()?;
let store_path = temp.path().join("cultmesh.ccmp");
let note = Note {
body: "blessed circuit".to_string(),
owner: "self".to_string(),
};
let mut node = CultMesh::create_node(
&store_path,
TestDocuments,
CultMeshNodeOptions {
runtime_id: "test-runtime".to_string(),
..CultMeshNodeOptions::default()
},
)?;
assert_eq!(node.runtime_id(), "test-runtime");
node.put("note", &note)?;
node.flush()?;
let reloaded = CultMesh::create_node(&store_path, TestDocuments, Default::default())?;
assert_eq!(reloaded.get_required::<Note>("note")?, note);
assert!(
reloaded
.documents()
.binding_by_schema_id("cultmesh.test.note.v0")
.is_some()
);
Ok(())
}
#[test]
fn node_publishes_registered_document_to_rudp_catalog() -> Result<()> {
let temp = tempfile::tempdir()?;
let store_path = temp.path().join("cultmesh.ccmp");
let note = Note {
body: "respect odin once".to_string(),
owner: "self".to_string(),
};
let node = CultMesh::create_node(
&store_path,
TestDocuments,
CultMeshNodeOptions {
runtime_id: "epiphany-test".to_string(),
..CultMeshNodeOptions::default()
},
)?;
let socket = UdpSocket::bind("127.0.0.1:0")?;
socket.set_read_timeout(Some(Duration::from_millis(10)))?;
let target = socket.local_addr()?;
let (sender, receiver) = std::sync::mpsc::channel();
let server = thread::spawn(move || -> Result<()> {
let mut server = cultnet_rs::CultNetRudpSocketTransportConnection::new(
cultnet_rs::CultNetRudpSocketTransportOptions::server(
"odin-test-catalog",
socket,
CULTMESH_RUDP_DOCUMENT_CATALOG_CONNECTION_ID,
),
)?;
let deadline = Instant::now() + Duration::from_secs(2);
while Instant::now() < deadline {
if let Some(frame) = server.receive_once()? {
let message = cultnet_rs::decode_cultnet_message_from_slice(
&frame.payload,
cultnet_rs::CultNetWireContract::CultNetSchemaV0,
)?;
if let cultnet_rs::CultNetMessage::DocumentPutRaw { document, .. } = message {
sender
.send((
document.schema_id,
document.record_key,
document.source_runtime_id,
))
.ok();
return Ok(());
}
}
server.poll_resends()?;
}
anyhow::bail!("timed out waiting for RUDP document put")
});
node.publish_document_to_rudp_catalog(
"note",
&note,
CultMeshRudpDocumentPublishOptions::odin(target, "epiphany-test"),
)?;
let received = receiver.recv_timeout(Duration::from_secs(2))?;
server.join().expect("server thread should not panic")?;
assert_eq!(received.0, "cultmesh.test.note.v0");
assert_eq!(received.1, "note");
assert_eq!(received.2.as_deref(), Some("epiphany-test"));
Ok(())
}
#[test]
fn node_projects_soa_tables_for_registered_documents() -> Result<()> {
let temp = tempfile::tempdir()?;
let store_path = temp.path().join("cultmesh-soa.ccmp");
let mut node = CultMesh::create_node(&store_path, TestDocuments, Default::default())?;
node.put(
"note/self",
&Note {
body: "private verse".to_string(),
owner: "self".to_string(),
},
)?;
node.put(
"note/hands",
&Note {
body: "repo action".to_string(),
owner: "hands".to_string(),
},
)?;
node.flush()?;
let table = node.soa::<Note>()?;
assert_eq!(table.len(), 2);
let owners = table.column::<String>("owner")?.values().to_vec();
let bodies = table.column::<String>("body")?.values().to_vec();
let mut rows = owners.into_iter().zip(bodies).collect::<Vec<_>>();
rows.sort();
assert_eq!(
rows,
vec![
("hands".to_string(), "repo action".to_string()),
("self".to_string(), "private verse".to_string()),
]
);
Ok(())
}
}

1
vendor/cultnet-rs vendored

@ -1 +0,0 @@
Subproject commit 69f2498daa5a2e3fe9bb9c532c95b75a5f0f61bb