Delete false runtime catalog authority

This commit is contained in:
Meta Vens 2026-08-23 16:24:53 +02:00
commit 03140a47db
9 changed files with 34 additions and 1542 deletions

View file

@ -109,10 +109,6 @@ path = "epiphany-core/src/bin/epiphany-host-identity.rs"
name = "epiphany-swarm"
path = "epiphany-core/src/bin/epiphany-swarm.rs"
[[bin]]
name = "epiphany-runtime-spine"
path = "epiphany-core/src/bin/epiphany-runtime-spine.rs"
[[bin]]
name = "epiphany-persona-feedback-ingress"
path = "epiphany-core/src/bin/epiphany-persona-feedback-ingress.rs"

View file

@ -1,649 +0,0 @@
use anyhow::Context;
use anyhow::Result;
use anyhow::anyhow;
use chrono::SecondsFormat;
use epiphany_core::EpiphanyCoordinatorRunReceipt;
use epiphany_core::EpiphanyRuntimeJob;
use epiphany_core::EpiphanyRuntimeJobResult;
use epiphany_core::EpiphanyRuntimeRoleWorkerResult;
use epiphany_core::EpiphanyRuntimeSession;
use epiphany_core::RuntimeSpineInitOptions;
use epiphany_core::RuntimeSpineJobOptions;
use epiphany_core::RuntimeSpineJobResultOptions;
use epiphany_core::RuntimeSpineSessionClosureOptions;
use epiphany_core::RuntimeSpineSessionOptions;
use epiphany_core::close_runtime_session;
use epiphany_core::complete_runtime_job;
use epiphany_core::create_runtime_job;
use epiphany_core::create_runtime_session;
use epiphany_core::initialize_runtime_spine;
use epiphany_core::runtime_has_actionable_eyes_frontier;
use epiphany_core::runtime_has_actionable_hands_frontier;
use epiphany_core::runtime_spine_cache;
use epiphany_core::runtime_spine_status;
use epiphany_core::write_runtime_hello_frame;
use epiphany_core::write_runtime_schema_catalog_json;
use epiphany_model_adapter::EpiphanyModelInputItem;
use epiphany_model_adapter::EpiphanyModelRequest;
use std::env;
use std::path::PathBuf;
use uuid::Uuid;
const DEFAULT_STORE: &str = "state/runtime-spine.msgpack";
fn main() -> Result<()> {
let args = Args::parse()?;
match args.command {
Command::Init {
runtime_id,
display_name,
} => {
let identity = initialize_runtime_spine(
&args.store,
RuntimeSpineInitOptions {
runtime_id,
display_name,
created_at: now(),
},
)?;
println!("runtime spine initialized");
println!("store: {}", args.store.display());
println!("runtime: {}", identity.runtime_id);
println!(
"documents: {}",
epiphany_core::runtime_registered_document_types().join(", ")
);
}
Command::Status => {
let status = runtime_spine_status(&args.store)?;
println!("runtime spine status");
println!("store: {}", status.store);
println!("present: {}", status.present);
println!(
"runtime: {}",
status.runtime_id.unwrap_or_else(|| "missing".to_string())
);
println!(
"display: {}",
status.display_name.unwrap_or_else(|| "missing".to_string())
);
println!(
"sessions: {} active: {}",
status.sessions, status.active_sessions
);
println!("jobs: {} open: {}", status.jobs, status.open_jobs);
println!("job results: {}", status.job_results);
println!(
"actionable frontiers: Hands={} Eyes={}",
runtime_has_actionable_hands_frontier(&args.store)?,
runtime_has_actionable_eyes_frontier(&args.store)?
);
println!(
"tool invocations: {} pending: {} receipts: {}",
status.tool_invocation_intents,
status.pending_tool_invocations,
status.tool_invocation_receipts
);
if !status.supported_document_types.is_empty() {
println!("documents: {}", status.supported_document_types.join(", "));
}
}
Command::ListJobs => {
let mut cache = runtime_spine_cache(&args.store)?;
cache.pull_all_backing_stores()?;
let mut jobs = cache.get_all::<EpiphanyRuntimeJob>()?;
let results = cache.get_all::<EpiphanyRuntimeJobResult>()?;
jobs.sort_by(|left, right| left.created_at.cmp(&right.created_at));
println!("runtime jobs");
for job in jobs {
let result = results.iter().find(|result| result.job_id == job.job_id);
println!(
"{}\t{:?}\t{}\t{}\t{}",
job.job_id,
job.status,
job.role,
result
.map(|result| result.result_id.as_str())
.unwrap_or("no-result"),
job.summary.replace(['\r', '\n', '\t'], " ")
);
}
}
Command::ListSessions => {
let mut cache = runtime_spine_cache(&args.store)?;
cache.pull_all_backing_stores()?;
let mut sessions = cache.get_all::<EpiphanyRuntimeSession>()?;
sessions.sort_by(|left, right| left.created_at.cmp(&right.created_at));
println!("runtime sessions");
for session in sessions {
println!(
"{}\t{:?}\t{}",
session.session_id,
session.status,
session.objective.replace(['\r', '\n', '\t'], " ")
);
}
}
Command::ListModelRequests => {
let mut cache = runtime_spine_cache(&args.store)?;
cache.pull_all_backing_stores()?;
let mut requests = cache.get_all::<EpiphanyModelRequest>()?;
requests.sort_by(|left, right| left.request_id.cmp(&right.request_id));
println!("model requests");
for request in requests {
let input_chars = request
.input
.iter()
.map(model_input_item_chars)
.sum::<usize>();
let tool_names = request
.tools
.iter()
.map(|tool| tool.name.as_str())
.collect::<Vec<_>>()
.join(",");
println!(
"{}\t{}\t{}\tinstructions={}\tinputItems={}\tinputChars={}\ttools={}\ttoolNames={}\tcontract={}",
request.request_id,
request.provider,
request.model,
request.instructions.chars().count(),
request.input.len(),
input_chars,
request.tools.len(),
if tool_names.is_empty() {
"none"
} else {
tool_names.as_str()
},
request.output_contract_id.as_deref().unwrap_or("none")
);
}
}
Command::ListCoordinatorRuns => {
let mut cache = runtime_spine_cache(&args.store)?;
cache.pull_all_backing_stores()?;
let mut receipts = cache.get_all::<EpiphanyCoordinatorRunReceipt>()?;
receipts.sort_by(|left, right| {
left.created_at
.cmp(&right.created_at)
.then_with(|| left.receipt_id.cmp(&right.receipt_id))
});
println!("coordinator runs");
for receipt in receipts {
println!(
"{}\t{}\t{}\t{}\t{}\t{}",
receipt.created_at,
receipt.receipt_id,
receipt.thread_id,
receipt.status,
receipt.final_action,
receipt
.final_reason
.as_deref()
.unwrap_or("no-reason")
.replace(['\r', '\n', '\t'], " ")
);
}
}
Command::ListRepoModelProposals => {
let mut cache = runtime_spine_cache(&args.store)?;
cache.pull_all_backing_stores()?;
let mut results = cache.get_all::<EpiphanyRuntimeRoleWorkerResult>()?;
results.sort_by(|left, right| left.job_id.cmp(&right.job_id));
println!("RepoModel mutation proposals");
for result in results {
let Some(proposal) = result.repo_model_mutation_proposal()? else {
continue;
};
let operations = proposal.operations()?;
println!(
"{}\t{}\t{}\t{}",
result.job_id,
proposal.proposal_id,
result.decision_context_id,
serde_json::to_string(&operations)?
);
}
}
Command::OpenSession {
session_id,
objective,
coordinator_note,
} => {
let session = create_runtime_session(
&args.store,
RuntimeSpineSessionOptions {
session_id,
objective,
created_at: now(),
coordinator_note,
},
)?;
println!("runtime session opened");
println!("session: {}", session.session_id);
println!("objective: {}", session.objective);
}
Command::CloseSession {
session_id,
summary,
} => {
let session = close_runtime_session(
&args.store,
RuntimeSpineSessionClosureOptions {
session_id,
completed_at: now(),
summary,
},
)?;
println!("runtime session completed");
println!("session: {}", session.session_id);
}
Command::OpenJob {
job_id,
session_id,
role,
summary,
artifact_refs,
} => {
let job = create_runtime_job(
&args.store,
RuntimeSpineJobOptions {
job_id,
session_id,
role,
created_at: now(),
summary,
artifact_refs,
},
)?;
println!("runtime job opened");
println!("job: {}", job.job_id);
println!("session: {}", job.session_id);
println!("role: {}", job.role);
}
Command::CompleteJob {
result_id,
job_id,
verdict,
summary,
next_safe_move,
evidence_refs,
artifact_refs,
} => {
let result = complete_runtime_job(
&args.store,
RuntimeSpineJobResultOptions {
result_id,
job_id,
completed_at: now(),
verdict,
summary,
next_safe_move,
evidence_refs,
artifact_refs,
decision_context_id: None,
},
)?;
println!("runtime job completed");
println!("result: {}", result.result_id);
println!("job: {}", result.job_id);
println!("verdict: {}", result.verdict);
}
Command::HelloFrame { output } => {
let bytes = write_runtime_hello_frame(&args.store, &output)?;
println!("cultnet hello frame written");
println!("path: {}", output.display());
println!("bytes: {bytes}");
}
Command::SchemaCatalog {
output,
include_schema_json,
} => {
let bytes = write_runtime_schema_catalog_json(&output, include_schema_json)?;
println!("cultnet schema catalog written");
println!("path: {}", output.display());
println!("bytes: {bytes}");
}
}
Ok(())
}
#[derive(Debug)]
struct Args {
store: PathBuf,
command: Command,
}
#[derive(Debug)]
enum Command {
Init {
runtime_id: String,
display_name: String,
},
Status,
ListJobs,
ListSessions,
ListModelRequests,
ListCoordinatorRuns,
ListRepoModelProposals,
OpenSession {
session_id: String,
objective: String,
coordinator_note: String,
},
CloseSession {
session_id: String,
summary: String,
},
OpenJob {
job_id: String,
session_id: String,
role: String,
summary: String,
artifact_refs: Vec<String>,
},
CompleteJob {
result_id: String,
job_id: String,
verdict: String,
summary: String,
next_safe_move: String,
evidence_refs: Vec<String>,
artifact_refs: Vec<String>,
},
HelloFrame {
output: PathBuf,
},
SchemaCatalog {
output: PathBuf,
include_schema_json: bool,
},
}
impl Args {
fn parse() -> Result<Self> {
let mut store = PathBuf::from(DEFAULT_STORE);
let mut positional = Vec::new();
let mut args = env::args().skip(1);
while let Some(arg) = args.next() {
match arg.as_str() {
"--store" => store = take_path(&mut args, "--store")?,
_ => positional.push(arg),
}
}
let command = parse_command(positional)?;
Ok(Self { store, command })
}
}
fn parse_command(mut args: Vec<String>) -> Result<Command> {
if args.is_empty() {
return Err(anyhow!(usage()));
}
let command = args.remove(0);
match command.as_str() {
"init" => {
let mut runtime_id = "epiphany-local".to_string();
let mut display_name = "Epiphany Local".to_string();
parse_options(args, |name, value| match name {
"--runtime-id" => {
runtime_id = value;
Ok(())
}
"--display-name" => {
display_name = value;
Ok(())
}
_ => Err(anyhow!("unknown init argument: {name}")),
})?;
Ok(Command::Init {
runtime_id,
display_name,
})
}
"status" => Ok(Command::Status),
"list-jobs" => Ok(Command::ListJobs),
"list-sessions" => Ok(Command::ListSessions),
"list-model-requests" => Ok(Command::ListModelRequests),
"list-coordinator-runs" => Ok(Command::ListCoordinatorRuns),
"list-repo-model-proposals" => Ok(Command::ListRepoModelProposals),
"open-session" => {
let mut session_id = format!("session-{}", Uuid::new_v4());
let mut objective = String::new();
let mut coordinator_note = String::new();
parse_options(args, |name, value| match name {
"--session-id" => {
session_id = value;
Ok(())
}
"--objective" => {
objective = value;
Ok(())
}
"--coordinator-note" => {
coordinator_note = value;
Ok(())
}
_ => Err(anyhow!("unknown open-session argument: {name}")),
})?;
if objective.trim().is_empty() {
return Err(anyhow!("open-session requires --objective"));
}
Ok(Command::OpenSession {
session_id,
objective,
coordinator_note,
})
}
"open-job" => {
let mut job_id = format!("job-{}", Uuid::new_v4());
let mut session_id = String::new();
let mut role = String::new();
let mut summary = String::new();
let mut artifact_refs = Vec::new();
parse_options(args, |name, value| match name {
"--job-id" => {
job_id = value;
Ok(())
}
"--session-id" => {
session_id = value;
Ok(())
}
"--role" => {
role = value;
Ok(())
}
"--summary" => {
summary = value;
Ok(())
}
"--artifact-ref" => {
artifact_refs.push(value);
Ok(())
}
_ => Err(anyhow!("unknown open-job argument: {name}")),
})?;
if session_id.trim().is_empty() {
return Err(anyhow!("open-job requires --session-id"));
}
if role.trim().is_empty() {
return Err(anyhow!("open-job requires --role"));
}
Ok(Command::OpenJob {
job_id,
session_id,
role,
summary,
artifact_refs,
})
}
"close-session" => {
let mut session_id = String::new();
let mut summary = String::new();
parse_options(args, |name, value| match name {
"--session-id" => {
session_id = value;
Ok(())
}
"--summary" => {
summary = value;
Ok(())
}
_ => Err(anyhow!("unknown close-session argument: {name}")),
})?;
if session_id.trim().is_empty() {
return Err(anyhow!("close-session requires --session-id"));
}
if summary.trim().is_empty() {
return Err(anyhow!("close-session requires --summary"));
}
Ok(Command::CloseSession {
session_id,
summary,
})
}
"complete-job" => {
let mut result_id = format!("result-{}", Uuid::new_v4());
let mut job_id = String::new();
let mut verdict = String::new();
let mut summary = String::new();
let mut next_safe_move = String::new();
let mut evidence_refs = Vec::new();
let mut artifact_refs = Vec::new();
parse_options(args, |name, value| match name {
"--result-id" => {
result_id = value;
Ok(())
}
"--job-id" => {
job_id = value;
Ok(())
}
"--verdict" => {
verdict = value;
Ok(())
}
"--summary" => {
summary = value;
Ok(())
}
"--next-safe-move" => {
next_safe_move = value;
Ok(())
}
"--evidence-ref" => {
evidence_refs.push(value);
Ok(())
}
"--artifact-ref" => {
artifact_refs.push(value);
Ok(())
}
_ => Err(anyhow!("unknown complete-job argument: {name}")),
})?;
if job_id.trim().is_empty() {
return Err(anyhow!("complete-job requires --job-id"));
}
if verdict.trim().is_empty() {
return Err(anyhow!("complete-job requires --verdict"));
}
if summary.trim().is_empty() {
return Err(anyhow!("complete-job requires --summary"));
}
Ok(Command::CompleteJob {
result_id,
job_id,
verdict,
summary,
next_safe_move,
evidence_refs,
artifact_refs,
})
}
"hello-frame" => {
let mut output = PathBuf::from(".epiphany-dogfood/runtime-spine/hello.cultnet");
parse_options(args, |name, value| match name {
"--output" => {
output = PathBuf::from(value);
Ok(())
}
_ => Err(anyhow!("unknown hello-frame argument: {name}")),
})?;
Ok(Command::HelloFrame { output })
}
"schema-catalog" => {
let mut output = PathBuf::from(".epiphany-dogfood/runtime-spine/schema-catalog.json");
let mut include_schema_json = false;
parse_options(args, |name, value| match name {
"--output" => {
output = PathBuf::from(value);
Ok(())
}
"--include-schema-json" => {
include_schema_json = parse_bool_flag(&value, "--include-schema-json")?;
Ok(())
}
_ => Err(anyhow!("unknown schema-catalog argument: {name}")),
})?;
Ok(Command::SchemaCatalog {
output,
include_schema_json,
})
}
_ => Err(anyhow!(usage())),
}
}
fn parse_options(
args: Vec<String>,
mut on_option: impl FnMut(&str, String) -> Result<()>,
) -> Result<()> {
let mut args = args.into_iter();
while let Some(name) = args.next() {
if !name.starts_with("--") {
return Err(anyhow!("unexpected positional argument: {name}"));
}
let value = args
.next()
.with_context(|| format!("{name} requires a value"))?;
on_option(&name, value)?;
}
Ok(())
}
fn take_path(args: &mut impl Iterator<Item = String>, name: &str) -> Result<PathBuf> {
args.next()
.map(PathBuf::from)
.ok_or_else(|| anyhow!("{name} requires a value"))
}
fn parse_bool_flag(value: &str, name: &str) -> Result<bool> {
match value {
"true" | "1" | "yes" => Ok(true),
"false" | "0" | "no" => Ok(false),
_ => Err(anyhow!("{name} must be true/false")),
}
}
fn now() -> String {
chrono::Utc::now().to_rfc3339_opts(SecondsFormat::Secs, true)
}
fn usage() -> &'static str {
"usage: epiphany-runtime-spine [--store path] <init|status|list-jobs|list-sessions|list-model-requests|list-coordinator-runs|list-repo-model-proposals|open-session|close-session|open-job|complete-job|hello-frame|schema-catalog>"
}
fn model_input_item_chars(item: &EpiphanyModelInputItem) -> usize {
match item {
EpiphanyModelInputItem::UserText { text }
| EpiphanyModelInputItem::AssistantText { text } => text.chars().count(),
EpiphanyModelInputItem::ToolCall {
call_id,
name,
arguments,
} => call_id.chars().count() + name.chars().count() + arguments.chars().count(),
EpiphanyModelInputItem::ToolResult { output, .. } => output.chars().count(),
}
}

View file

@ -366,7 +366,6 @@ pub use runtime_spine::runtime_has_actionable_eyes_frontier;
pub use runtime_spine::runtime_has_actionable_hands_frontier;
pub use runtime_spine::runtime_has_actionable_imagination_frontier;
pub use runtime_spine::runtime_has_uncovered_actionable_eyes_frontier;
pub use runtime_spine::runtime_hello_frame;
pub use runtime_spine::runtime_job_snapshot;
pub use runtime_spine::runtime_latest_hands_receipt_chain_after;
pub use runtime_spine::runtime_latest_repo_frontier_relinquishment;
@ -382,7 +381,6 @@ pub use runtime_spine::runtime_repo_frontier_verification_request;
pub use runtime_spine::runtime_repo_frontier_work_proposal;
pub use runtime_spine::runtime_requested_public_source_refs_for_worker;
pub use runtime_spine::runtime_role_worker_result;
pub use runtime_spine::runtime_schema_catalog_response;
pub use runtime_spine::runtime_soul_verdict_receipt;
pub use runtime_spine::runtime_spine_cache;
pub use runtime_spine::runtime_spine_status;
@ -401,8 +399,6 @@ pub use runtime_spine::select_and_commit_repo_frontier_route;
pub use runtime_spine::select_repo_frontier_work_proposal_for_modeling;
pub use runtime_spine::terminalize_model_pass_failure_session;
pub use runtime_spine::validate_hands_action_authority;
pub use runtime_spine::write_runtime_hello_frame;
pub use runtime_spine::write_runtime_schema_catalog_json;
pub use runtime_worker_attempt::{RuntimeTypedRequestRef, WorkerProcessStatus};
pub use soul_gateway::*;
pub use state_ledger::EpiphanyBranchRecord;

View file

@ -6,11 +6,8 @@ use crate::agent_launch::{
EPIPHANY_MODELING_ROLE_BINDING_ID,
};
use crate::continuity_gateway::ContinuityRecoveryReceipt;
use crate::continuity_gateway::*;
use crate::eyes_gateway::EYES_EVIDENCE_PACKET_SCHEMA_VERSION;
use crate::eyes_gateway::EYES_EVIDENCE_PACKET_TYPE;
use crate::eyes_gateway::EYES_SOURCE_LOOKUP_RECEIPT_SCHEMA_VERSION;
use crate::eyes_gateway::EYES_SOURCE_LOOKUP_RECEIPT_TYPE;
use crate::eyes_gateway::EyesEvidencePacket;
use crate::eyes_gateway::EyesSourceLookupReceipt;
use crate::hands_gateway::*;
@ -54,15 +51,8 @@ use crate::runtime_store_backend::{
};
use crate::soul_gateway::SoulVerdictReceipt;
use crate::soul_gateway::*;
use crate::state_ledger::STATE_LEDGER_SCHEMA_VERSION;
use crate::state_ledger::STATE_LEDGER_STORE_TYPE;
use crate::substrate_gate::SUBSTRATE_GATE_REPO_ACCESS_GRANT_RECEIPT_SCHEMA_VERSION;
use crate::substrate_gate::SUBSTRATE_GATE_REPO_ACCESS_GRANT_RECEIPT_TYPE;
use crate::substrate_gate::SubstrateGateRepoAccessGrantReceipt;
use crate::{
DECISION_CONTEXT_SCHEMA_VERSION, DECISION_CONTEXT_TYPE, MIND_COMMIT_RECEIPT_SCHEMA_VERSION,
MIND_COMMIT_RECEIPT_TYPE, REASONING_BASIS_SCHEMA_VERSION, REASONING_BASIS_TYPE,
};
use crate::{RuntimeTypedRequestRef, WorkerProcessStatus};
use anyhow::Context;
use anyhow::Result;
@ -71,17 +61,6 @@ use cultcache_rs::CacheBackingStore;
use cultcache_rs::CultCache;
use cultcache_rs::CultCacheEnvelope;
use cultcache_rs::DatabaseEntry;
use cultnet_rs::CultNetDocumentMutationContract;
use cultnet_rs::CultNetDocumentOperation;
use cultnet_rs::CultNetMessage;
use cultnet_rs::CultNetMutationAuthority;
use cultnet_rs::CultNetSchemaKind;
use cultnet_rs::CultNetSchemaRegistration;
use cultnet_rs::CultNetSchemaRegistry;
use cultnet_rs::CultNetWireContract;
use cultnet_rs::builtin_schema_registry;
use cultnet_rs::encode_cultnet_message_to_vec;
use cultnet_rs::encode_frame;
use epiphany_model_adapter::EpiphanyModelAdapterStatus;
use epiphany_model_adapter::EpiphanyModelReceipt;
use epiphany_model_adapter::EpiphanyModelRequest;
@ -104,7 +83,6 @@ use sha2::Digest;
use sha2::Sha256;
use std::collections::BTreeMap;
use std::collections::BTreeSet;
use std::fs;
use std::path::Path;
use std::path::PathBuf;
@ -122,16 +100,6 @@ pub const RUNTIME_ROLE_WORKER_RESULT_TYPE: &str = "epiphany.runtime.role_worker_
pub const RUNTIME_REORIENT_WORKER_RESULT_TYPE: &str = "epiphany.runtime.reorient_worker_result";
pub const RUNTIME_JOB_RESULT_TYPE: &str = "epiphany.runtime.job_result";
pub const COORDINATOR_RUN_RECEIPT_TYPE: &str = "epiphany.coordinator_run_receipt.v0";
pub const OPENAI_ADAPTER_STATUS_TYPE: &str = "epiphany.openai_adapter_status.v0";
pub const OPENAI_MODEL_REQUEST_TYPE: &str = "epiphany.openai_model_request.v1";
pub const OPENAI_MODEL_STREAM_EVENT_TYPE: &str = "epiphany.openai_model_stream_event.v0";
pub const OPENAI_MODEL_RECEIPT_TYPE: &str = "epiphany.openai_model_receipt.v0";
pub const MODEL_ADAPTER_STATUS_TYPE: &str = "epiphany.model_adapter_status.v0";
pub const MODEL_REQUEST_TYPE: &str = "epiphany.model_request.v0";
pub const MODEL_STREAM_EVENT_TYPE: &str = "epiphany.model_stream_event.v0";
pub const MODEL_RECEIPT_TYPE: &str = "epiphany.model_receipt.v0";
pub const TOOL_INVOCATION_INTENT_TYPE: &str = "epiphany.tool_invocation_intent.v0";
pub const TOOL_INVOCATION_RECEIPT_TYPE: &str = "epiphany.tool_invocation_receipt.v0";
pub const RUNTIME_IDENTITY_KEY: &str = "self";
pub const RUNTIME_SWARM_BINDING_KEY: &str = "runtime-swarm-binding";
pub const RUNTIME_SWARM_BINDING_SCHEMA_VERSION: &str = "epiphany.runtime.swarm_binding.v1";
@ -153,40 +121,6 @@ pub const RUNTIME_ROLE_WORKER_RESULT_SCHEMA_VERSION: &str =
pub const RUNTIME_REORIENT_WORKER_RESULT_SCHEMA_VERSION: &str =
"epiphany.runtime.reorient_worker_result.v0";
pub const COORDINATOR_RUN_RECEIPT_SCHEMA_VERSION: &str = "epiphany.coordinator_run_receipt.v0";
pub const OPENAI_ADAPTER_STATUS_SCHEMA_VERSION: &str = "epiphany.openai_adapter_status.v0";
pub const OPENAI_MODEL_REQUEST_SCHEMA_VERSION: &str = "epiphany.openai_model_request.v1";
pub const OPENAI_MODEL_STREAM_EVENT_SCHEMA_VERSION: &str = "epiphany.openai_model_stream_event.v0";
pub const OPENAI_MODEL_RECEIPT_SCHEMA_VERSION: &str = "epiphany.openai_model_receipt.v0";
pub const MODEL_ADAPTER_STATUS_SCHEMA_VERSION: &str = "epiphany.model_adapter_status.v0";
pub const MODEL_REQUEST_SCHEMA_VERSION: &str = "epiphany.model_request.v0";
pub const MODEL_STREAM_EVENT_SCHEMA_VERSION: &str = "epiphany.model_stream_event.v0";
pub const MODEL_RECEIPT_SCHEMA_VERSION: &str = "epiphany.model_receipt.v0";
pub const TOOL_INVOCATION_INTENT_SCHEMA_VERSION: &str = "epiphany.tool_invocation_intent.v0";
pub const TOOL_INVOCATION_RECEIPT_SCHEMA_VERSION: &str = "epiphany.tool_invocation_receipt.v0";
pub const CULTNET_SCHEMA_INDEX_RELATIVE: &str = "schemas/cultnet/index.json";
#[derive(Clone, Debug, PartialEq, Eq, Deserialize)]
#[serde(rename_all = "camelCase")]
struct EpiphanyCultNetSchemaIndex {
schema_version: String,
schemas: Vec<EpiphanyCultNetSchemaIndexEntry>,
}
#[derive(Clone, Debug, PartialEq, Eq, Deserialize)]
#[serde(rename_all = "camelCase")]
struct EpiphanyCultNetSchemaIndexEntry {
schema_id: String,
kind: CultNetSchemaKind,
wire_contracts: Vec<CultNetWireContract>,
#[serde(default)]
schema_version: Option<String>,
#[serde(default)]
document_type: Option<String>,
#[serde(default)]
title: Option<String>,
path: String,
}
#[derive(Clone, Debug, PartialEq, DatabaseEntry)]
#[cultcache(type = "epiphany.runtime.identity", schema = "EpiphanyRuntimeIdentity")]
pub struct EpiphanyRuntimeIdentity {
@ -972,6 +906,12 @@ pub fn runtime_spine_cache(store_path: impl AsRef<Path>) -> Result<CultCache> {
let store_path = store_path.as_ref();
let backing_store = runtime_spine_backing_store(store_path)?;
validate_runtime_store_epoch(&backing_store.pull_all()?)?;
let mut cache = runtime_spine_schema_cache()?;
cache.add_generic_backing_store(backing_store);
Ok(cache)
}
fn runtime_spine_schema_cache() -> Result<CultCache> {
let mut cache = CultCache::new();
crate::mind_documents::register_mind_document_types(&mut cache)?;
cache.register_entry_type::<crate::UserObjectiveIntake>()?;
@ -1054,7 +994,6 @@ pub fn runtime_spine_cache(store_path: impl AsRef<Path>) -> Result<CultCache> {
cache.register_entry_type::<crate::PersonaConversationStoreRetirementReceipt>()?;
cache.register_entry_type::<EpiphanyToolInvocationIntent>()?;
cache.register_entry_type::<EpiphanyToolInvocationReceipt>()?;
cache.add_generic_backing_store(backing_store);
Ok(cache)
}
@ -11441,6 +11380,11 @@ pub fn runtime_spine_status(store_path: impl AsRef<Path>) -> Result<EpiphanyRunt
)
})
.count();
let supported_document_types = if identity.is_some() {
runtime_registered_document_types()?
} else {
Vec::new()
};
Ok(EpiphanyRuntimeSpineStatus {
store: store_path.display().to_string(),
present: identity.is_some(),
@ -11457,10 +11401,7 @@ pub fn runtime_spine_status(store_path: impl AsRef<Path>) -> Result<EpiphanyRunt
.iter()
.filter(|intent| !receipt_intent_ids.contains(intent.intent_id.as_str()))
.count(),
supported_document_types: identity
.is_some()
.then(runtime_registered_document_types)
.unwrap_or_default(),
supported_document_types,
})
}
@ -11513,125 +11454,8 @@ pub fn runtime_tool_invocation_statuses(
Ok(statuses)
}
pub fn runtime_hello_frame(store_path: impl AsRef<Path>) -> Result<Vec<u8>> {
let mut cache = runtime_spine_cache(store_path.as_ref())?;
cache.pull_all_backing_stores()?;
let identity = require_identity(&cache)?;
let message = CultNetMessage::Hello {
runtime_id: identity.runtime_id,
runtime_kind: "epiphany.native".to_string(),
agent_id: Some("self".to_string()),
role: Some("coordinator".to_string()),
display_name: Some(identity.display_name),
supported_document_types: Some(runtime_registered_document_types()),
supported_mutation_contracts: Some(epiphany_mutation_contracts()),
supported_message_versions: Some(vec![
"cultnet.hello.v0".to_string(),
"cultnet.document_put.v0".to_string(),
"cultnet.snapshot_request.v0".to_string(),
"cultnet.snapshot_response.v0".to_string(),
"cultnet.schema_catalog_request.v0".to_string(),
"cultnet.schema_catalog_response.v0".to_string(),
]),
transport_profiles: None,
supports_schema_catalog: Some(true),
};
let payload = encode_cultnet_message_to_vec(&message, CultNetWireContract::CultNetSchemaV0)?;
encode_frame(&payload)
}
pub fn write_runtime_hello_frame(
store_path: impl AsRef<Path>,
output_path: impl AsRef<Path>,
) -> Result<usize> {
let output_path = output_path.as_ref();
if let Some(parent) = output_path.parent() {
fs::create_dir_all(parent)
.with_context(|| format!("failed to create {}", parent.display()))?;
}
let frame = runtime_hello_frame(store_path)?;
fs::write(output_path, &frame)
.with_context(|| format!("failed to write {}", output_path.display()))?;
Ok(frame.len())
}
pub fn epiphany_schema_registry() -> Result<CultNetSchemaRegistry> {
let mut registry = builtin_schema_registry()?;
let schema_root = epiphany_schema_root();
let index_path = schema_root.join("index.json");
let raw_index = fs::read_to_string(&index_path)
.with_context(|| format!("failed to read {}", index_path.display()))?;
let index: EpiphanyCultNetSchemaIndex = serde_json::from_str(&raw_index)
.with_context(|| format!("failed to parse {}", index_path.display()))?;
if index.schema_version.trim().is_empty() {
return Err(anyhow!(
"CultNet schema index at {} is missing schemaVersion",
index_path.display()
));
}
for entry in index.schemas {
let schema_path = schema_root.join(&entry.path);
let schema_json = fs::read_to_string(&schema_path)
.with_context(|| format!("failed to read {}", schema_path.display()))?;
registry.register(CultNetSchemaRegistration {
schema_id: entry.schema_id,
kind: entry.kind,
wire_contracts: entry.wire_contracts,
schema_version: entry.schema_version,
document_type: entry.document_type,
title: entry.title,
schema_json: Some(schema_json),
})?;
}
Ok(registry)
}
pub fn runtime_schema_catalog_response(
message_id: impl Into<String>,
include_schema_json: bool,
schema_ids: Option<Vec<String>>,
kinds: Option<Vec<CultNetSchemaKind>>,
) -> Result<CultNetMessage> {
let registry = epiphany_schema_registry()?;
registry.create_catalog_response(&CultNetMessage::SchemaCatalogRequest {
message_id: message_id.into(),
include_schema_json: Some(include_schema_json),
schema_ids,
kinds,
})
}
pub fn write_runtime_schema_catalog_json(
output_path: impl AsRef<Path>,
include_schema_json: bool,
) -> Result<usize> {
let output_path = output_path.as_ref();
if let Some(parent) = output_path.parent() {
fs::create_dir_all(parent)
.with_context(|| format!("failed to create {}", parent.display()))?;
}
let response = runtime_schema_catalog_response(
"runtime-spine-schema-catalog".to_string(),
include_schema_json,
None,
None,
)?;
let body = serde_json::to_vec_pretty(&response)?;
fs::write(output_path, &body)
.with_context(|| format!("failed to write {}", output_path.display()))?;
Ok(body.len())
}
fn epiphany_schema_root() -> PathBuf {
Path::new(env!("CARGO_MANIFEST_DIR"))
.parent()
.expect("epiphany-core has no parent repo root")
.join(CULTNET_SCHEMA_INDEX_RELATIVE)
.parent()
.expect("cultnet schema index has no parent directory")
.to_path_buf()
pub fn runtime_registered_document_types() -> Result<Vec<String>> {
Ok(runtime_spine_schema_cache()?.registered_entry_types())
}
fn require_identity(cache: &CultCache) -> Result<EpiphanyRuntimeIdentity> {
@ -11667,651 +11491,6 @@ fn require_runtime_identity_not_archived(
Ok(())
}
pub fn runtime_registered_document_types() -> Vec<String> {
let mut document_types = Vec::new();
for contract in epiphany_mutation_contracts() {
if !document_types.contains(&contract.document_type) {
document_types.push(contract.document_type);
}
}
document_types
}
fn mutation_contract(
document_type: impl Into<String>,
payload_schema_version: impl Into<String>,
operations: Vec<CultNetDocumentOperation>,
authority: CultNetMutationAuthority,
intent_document_types: Vec<&str>,
receipt_document_types: Vec<&str>,
notes: Vec<&str>,
) -> CultNetDocumentMutationContract {
CultNetDocumentMutationContract {
document_type: document_type.into(),
payload_schema_version: Some(payload_schema_version.into()),
operations,
authority,
intent_document_types: (!intent_document_types.is_empty()).then(|| {
intent_document_types
.into_iter()
.map(str::to_string)
.collect()
}),
receipt_document_types: (!receipt_document_types.is_empty()).then(|| {
receipt_document_types
.into_iter()
.map(str::to_string)
.collect()
}),
notes: (!notes.is_empty()).then(|| notes.into_iter().map(str::to_string).collect()),
}
}
fn epiphany_mutation_contracts() -> Vec<CultNetDocumentMutationContract> {
vec![
mutation_contract(
crate::EpiphanyRepoModelIdentityDocument::TYPE,
crate::EpiphanyRepoModelIdentityDocument::SCHEMA_NAME,
vec![CultNetDocumentOperation::Snapshot],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![crate::EpiphanyMindCommitReceipt::TYPE],
vec!["Keyed RepoModel identity is written only by the local Mind commit path."],
),
mutation_contract(
crate::EpiphanyRepoModelDomainDocument::TYPE,
crate::EpiphanyRepoModelDomainDocument::SCHEMA_NAME,
vec![CultNetDocumentOperation::Snapshot],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![crate::EpiphanyMindCommitReceipt::TYPE],
vec!["Keyed RepoModel domains are written only by the local Mind commit path."],
),
mutation_contract(
crate::EpiphanyRepoModelNodeDocument::TYPE,
crate::EpiphanyRepoModelNodeDocument::SCHEMA_NAME,
vec![CultNetDocumentOperation::Snapshot],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![crate::EpiphanyMindCommitReceipt::TYPE],
vec!["Keyed RepoModel nodes are written only by the local Mind commit path."],
),
mutation_contract(
crate::EpiphanyRepoModelEdgeDocument::TYPE,
crate::EpiphanyRepoModelEdgeDocument::SCHEMA_NAME,
vec![CultNetDocumentOperation::Snapshot],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![crate::EpiphanyMindCommitReceipt::TYPE],
vec!["Keyed RepoModel edges are written only by the local Mind commit path."],
),
mutation_contract(
crate::EpiphanyRepoModelFrontierDocument::TYPE,
crate::EpiphanyRepoModelFrontierDocument::SCHEMA_NAME,
vec![CultNetDocumentOperation::Snapshot],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![crate::EpiphanyMindCommitReceipt::TYPE],
vec!["Keyed RepoModel frontier items are written only by the local Mind commit path."],
),
mutation_contract(
crate::EpiphanyRepoModelClaimObligationsDocument::TYPE,
crate::EpiphanyRepoModelClaimObligationsDocument::SCHEMA_NAME,
vec![CultNetDocumentOperation::Snapshot],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![crate::EpiphanyMindCommitReceipt::TYPE],
vec!["Keyed RepoModel claim obligations are derived and committed by local Mind."],
),
mutation_contract(
crate::AtlasSurfaceOffer::TYPE,
crate::AtlasSurfaceOffer::SCHEMA_NAME,
vec![CultNetDocumentOperation::Snapshot],
CultNetMutationAuthority::ReadOnly,
vec![crate::ATLAS_SURFACE_OFFER_WRITE_INTENT_SCHEMA],
vec![crate::EpiphanyMindCommitReceipt::TYPE],
vec![
"Provider Modeling owns local surface offers through typed Atlas planners and Mind CAS.",
],
),
mutation_contract(
crate::AtlasDependencyClaim::TYPE,
crate::AtlasDependencyClaim::SCHEMA_NAME,
vec![CultNetDocumentOperation::Snapshot],
CultNetMutationAuthority::ReadOnly,
vec![crate::ATLAS_DEPENDENCY_CLAIM_WRITE_INTENT_SCHEMA],
vec![crate::EpiphanyMindCommitReceipt::TYPE],
vec![
"Consumer Modeling owns local dependency claims through typed Atlas planners and Mind CAS.",
],
),
mutation_contract(
crate::AtlasDependencyVerification::TYPE,
crate::AtlasDependencyVerification::SCHEMA_NAME,
vec![CultNetDocumentOperation::Snapshot],
CultNetMutationAuthority::ReadOnly,
vec![crate::ATLAS_DEPENDENCY_VERIFICATION_WRITE_INTENT_SCHEMA],
vec![crate::EpiphanyMindCommitReceipt::TYPE],
vec![
"Soul owns exact local claim/offer verification through its dedicated Atlas planner.",
],
),
mutation_contract(
crate::AtlasDependencyImpact::TYPE,
crate::AtlasDependencyImpact::SCHEMA_NAME,
vec![CultNetDocumentOperation::Snapshot],
CultNetMutationAuthority::ReadOnly,
vec![crate::ATLAS_DEPENDENCY_IMPACT_WRITE_INTENT_SCHEMA],
vec![crate::EpiphanyMindCommitReceipt::TYPE],
vec![
"Consumer Self owns local dependency impacts through its dedicated Atlas planner.",
],
),
mutation_contract(
crate::USER_OBJECTIVE_INTAKE_TYPE,
crate::USER_OBJECTIVE_INTAKE_SCHEMA_VERSION,
vec![
CultNetDocumentOperation::Snapshot,
CultNetDocumentOperation::IntentSubmit,
],
CultNetMutationAuthority::Coordinator,
vec![crate::USER_OBJECTIVE_INTAKE_TYPE],
vec![crate::EpiphanyMindCommitReceipt::TYPE],
vec![
"The human owns the initial objective assertion; Self atomically records it with the keyed Mind objective and a typed operator-provenance commit receipt.",
"Thread identity is provenance and does not own objective causality.",
"Objective replacement requires a separate reviewed adoption flow.",
],
),
mutation_contract(
RUNTIME_IDENTITY_TYPE,
RUNTIME_SPINE_SCHEMA_VERSION,
vec![CultNetDocumentOperation::Snapshot],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec!["Runtime identity is advertised by the coordinator, not remotely mutated."],
),
mutation_contract(
RUNTIME_SESSION_TYPE,
RUNTIME_SPINE_SCHEMA_VERSION,
vec![CultNetDocumentOperation::Snapshot],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec![
"Runtime sessions are lifecycle state opened and closed by exact local runtime owners.",
],
),
mutation_contract(
RUNTIME_JOB_TYPE,
RUNTIME_SPINE_SCHEMA_VERSION,
vec![
CultNetDocumentOperation::Snapshot,
CultNetDocumentOperation::ReceiptWatch,
],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec![
"Runtime jobs are lifecycle receipts derived from admitted worker-launch requests.",
],
),
mutation_contract(
RUNTIME_WORKER_LAUNCH_REQUEST_TYPE,
RUNTIME_WORKER_LAUNCH_REQUEST_SCHEMA_VERSION,
vec![
CultNetDocumentOperation::Snapshot,
CultNetDocumentOperation::IntentSubmit,
CultNetDocumentOperation::ReceiptWatch,
],
CultNetMutationAuthority::Coordinator,
vec![RUNTIME_WORKER_LAUNCH_REQUEST_TYPE],
vec![RUNTIME_JOB_TYPE],
vec![
"Worker launch requests are typed task-intent documents; runtime jobs are lifecycle receipts, not the source of work intent.",
"Core/coordinator policy owns the launch yes/no; the Epiphany-Codex bridge translates between CultNet-shaped intent and Codex JSON only.",
"Codex-hosted executors may gather host facts and perform side effects after the verdict, with readable receipts.",
],
),
mutation_contract(
RUNTIME_ROLE_WORKER_RESULT_TYPE,
RUNTIME_ROLE_WORKER_RESULT_SCHEMA_VERSION,
vec![CultNetDocumentOperation::Snapshot],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec![
"Role worker results preserve the typed finding payload; generic runtime job results are lifecycle receipts.",
],
),
mutation_contract(
RUNTIME_WORKER_PROCESS_CLAIM_TYPE,
RUNTIME_WORKER_PROCESS_CLAIM_SCHEMA_VERSION,
vec![CultNetDocumentOperation::Snapshot],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec![
"The worker claims its native process before model/tool work; the spawning coordinator alone presents the one-use activation preimage.",
"Terminal result and exact process death replace the same claim; absence and age are not terminal authority.",
],
),
mutation_contract(
ARCHIVED_RUNTIME_WORKER_ATTEMPT_TYPE,
ARCHIVED_RUNTIME_WORKER_ATTEMPT_SCHEMA_VERSION,
vec![CultNetDocumentOperation::Snapshot],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec![
"Runtime spine atomically replaces one exact terminal typed worker family with this per-attempt tombstone only after resident liveness clears.",
"A terminal-result tombstone preserves authenticated fulfillment identity; it does not own producer semantic companions or Mind admission.",
],
),
mutation_contract(
RUNTIME_REORIENT_WORKER_RESULT_TYPE,
RUNTIME_REORIENT_WORKER_RESULT_SCHEMA_VERSION,
vec![CultNetDocumentOperation::Snapshot],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec![
"Reorient worker results preserve continuity findings separately from generic runtime lifecycle receipts.",
],
),
mutation_contract(
RUNTIME_JOB_RESULT_TYPE,
RUNTIME_SPINE_SCHEMA_VERSION,
vec![CultNetDocumentOperation::Snapshot],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec![
"Job results are evidence records; review and acceptance are separate typed flows.",
],
),
mutation_contract(
REASONING_BASIS_TYPE,
REASONING_BASIS_SCHEMA_VERSION,
vec![
CultNetDocumentOperation::Snapshot,
CultNetDocumentOperation::ReceiptWatch,
],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec![
"A sealed reasoning basis preserves the exact typed Mind documents and closed projection supplied to one model pass.",
"It is immutable decision evidence, not a generic state mutation intent.",
],
),
mutation_contract(
DECISION_CONTEXT_TYPE,
DECISION_CONTEXT_SCHEMA_VERSION,
vec![
CultNetDocumentOperation::Snapshot,
CultNetDocumentOperation::ReceiptWatch,
],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec![
"A sealed decision context binds the reasoning basis to the exact terminal native request, internally derived provider request, and governed tool observations supplied.",
"It is audit evidence; concrete invariant owners decide which exact documents a structured outcome may mutate.",
],
),
mutation_contract(
MIND_COMMIT_RECEIPT_TYPE,
MIND_COMMIT_RECEIPT_SCHEMA_VERSION,
vec![
CultNetDocumentOperation::Snapshot,
CultNetDocumentOperation::ReceiptWatch,
],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec![
"A Mind commit receipt proves that one named invariant owner atomically checked exact strong reads and wrote exact typed documents.",
"CultNet exposes the receipt read-only and cannot impersonate the commit owner.",
],
),
mutation_contract(
SUBSTRATE_GATE_REPO_ACCESS_GRANT_RECEIPT_TYPE,
SUBSTRATE_GATE_REPO_ACCESS_GRANT_RECEIPT_SCHEMA_VERSION,
vec![
CultNetDocumentOperation::Snapshot,
CultNetDocumentOperation::ReceiptWatch,
],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec!["A Substrate Gate grant receipt scopes a permitted repo touch."],
),
mutation_contract(
EYES_SOURCE_LOOKUP_RECEIPT_TYPE,
EYES_SOURCE_LOOKUP_RECEIPT_SCHEMA_VERSION,
vec![
CultNetDocumentOperation::Snapshot,
CultNetDocumentOperation::ReceiptWatch,
],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec![
"Source lookup receipts prove what was searched or inspected under a Substrate Gate grant.",
],
),
mutation_contract(
EYES_EVIDENCE_PACKET_TYPE,
EYES_EVIDENCE_PACKET_SCHEMA_VERSION,
vec![
CultNetDocumentOperation::Snapshot,
CultNetDocumentOperation::ReceiptWatch,
],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec![
"Evidence packets carry provenance, uncertainty, and source refs for the other organs.",
],
),
mutation_contract(
HANDS_ACTION_INTENT_TYPE,
HANDS_ACTION_INTENT_SCHEMA_VERSION,
vec![
CultNetDocumentOperation::Snapshot,
CultNetDocumentOperation::IntentSubmit,
CultNetDocumentOperation::ReceiptWatch,
],
CultNetMutationAuthority::Coordinator,
vec![HANDS_ACTION_INTENT_TYPE],
vec![
HANDS_ACTION_REVIEW_TYPE,
HANDS_COMMAND_RECEIPT_TYPE,
HANDS_PATCH_RECEIPT_TYPE,
HANDS_COMMIT_RECEIPT_TYPE,
HANDS_ACTION_REFUSAL_RECEIPT_TYPE,
],
vec![
"Hands is the action organ: commands, patches, commits, and rollbacks enter as bounded action intents.",
"Substrate Gate grants substrate access before Hands mutates; Soul verifies consequences after.",
],
),
mutation_contract(
HANDS_ACTION_REVIEW_TYPE,
HANDS_ACTION_REVIEW_SCHEMA_VERSION,
vec![
CultNetDocumentOperation::Snapshot,
CultNetDocumentOperation::ReceiptWatch,
],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec!["Hands reviews explain allowed, refused, sequenced, or delegated action."],
),
mutation_contract(
HANDS_COMMAND_RECEIPT_TYPE,
HANDS_COMMAND_RECEIPT_SCHEMA_VERSION,
vec![
CultNetDocumentOperation::Snapshot,
CultNetDocumentOperation::ReceiptWatch,
],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec!["Command receipts prove what command ran and under which Substrate Gate grant."],
),
mutation_contract(
HANDS_PATCH_RECEIPT_TYPE,
HANDS_PATCH_RECEIPT_SCHEMA_VERSION,
vec![
CultNetDocumentOperation::Snapshot,
CultNetDocumentOperation::ReceiptWatch,
],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec!["Patch receipts prove file mutations and the scoped grant that permitted them."],
),
mutation_contract(
HANDS_COMMIT_RECEIPT_TYPE,
HANDS_COMMIT_RECEIPT_SCHEMA_VERSION,
vec![
CultNetDocumentOperation::Snapshot,
CultNetDocumentOperation::ReceiptWatch,
],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec!["Commit receipts preserve repository consequences after verification."],
),
mutation_contract(
HANDS_ACTION_REFUSAL_RECEIPT_TYPE,
HANDS_ACTION_REFUSAL_RECEIPT_SCHEMA_VERSION,
vec![
CultNetDocumentOperation::Snapshot,
CultNetDocumentOperation::ReceiptWatch,
],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec!["Hands refusal receipts preserve why an action intent was denied."],
),
mutation_contract(
crate::REPO_FRONTIER_RELINQUISHMENT_RECEIPT_TYPE,
crate::REPO_FRONTIER_RELINQUISHMENT_RECEIPT_SCHEMA_VERSION,
vec![
CultNetDocumentOperation::Snapshot,
CultNetDocumentOperation::ReceiptWatch,
],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec![
"Mind relinquishment receipts prove that an exact Hands refusal retired route authority without a repository consequence.",
],
),
mutation_contract(
SOUL_VERDICT_RECEIPT_TYPE,
SOUL_VERDICT_RECEIPT_SCHEMA_VERSION,
vec![
CultNetDocumentOperation::Snapshot,
CultNetDocumentOperation::ReceiptWatch,
],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec!["Verdict receipts are proof of sanctity or proof of failure."],
),
mutation_contract(
CONTINUITY_RECOVERY_RECEIPT_TYPE,
CONTINUITY_RECOVERY_RECEIPT_SCHEMA_VERSION,
vec![
CultNetDocumentOperation::Snapshot,
CultNetDocumentOperation::ReceiptWatch,
],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec!["Recovery receipts explain what survived and what must be regathered."],
),
mutation_contract(
COORDINATOR_RUN_RECEIPT_TYPE,
COORDINATOR_RUN_RECEIPT_SCHEMA_VERSION,
vec![CultNetDocumentOperation::ReceiptWatch],
CultNetMutationAuthority::Coordinator,
vec![],
vec![],
vec![
"Coordinator run receipts are typed summaries of local plan/run decisions; artifact JSON is display evidence, not the only durable account.",
],
),
mutation_contract(
RUNTIME_MODEL_EXECUTION_BINDING_TYPE,
RUNTIME_MODEL_EXECUTION_BINDING_SCHEMA_VERSION,
vec![CultNetDocumentOperation::Snapshot],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec![
"Runtime spine atomically binds one native/provider model request pair to its owning session and job before transport begins.",
"Retention must reject unbound model rows rather than infer ownership from request names or conversation ids.",
],
),
mutation_contract(
RUNTIME_TOOL_EXECUTION_BINDING_TYPE,
RUNTIME_TOOL_EXECUTION_BINDING_SCHEMA_VERSION,
vec![CultNetDocumentOperation::Snapshot],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec![
"Runtime spine atomically binds a tool intent to its session and job before the tool runtime may execute it.",
"Model-derived tool intents must inherit the exact owning model execution; direct intents require explicit runtime ownership.",
],
),
mutation_contract(
ARCHIVED_RUNTIME_SESSION_TYPE,
ARCHIVED_RUNTIME_SESSION_SCHEMA_VERSION,
vec![CultNetDocumentOperation::Snapshot],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec![
"Runtime spine alone archives an exact completed model-session generation under a full snapshot fence.",
"The tombstone preserves retired identities and digest evidence, blocks ID reuse, and cannot satisfy execution authority.",
],
),
mutation_contract(
MODEL_ADAPTER_STATUS_TYPE,
MODEL_ADAPTER_STATUS_SCHEMA_VERSION,
vec![CultNetDocumentOperation::Snapshot],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec![
"Model adapter status is provider-neutral; OpenAI/Codex is one current provider behind this boundary.",
],
),
mutation_contract(
MODEL_REQUEST_TYPE,
MODEL_REQUEST_SCHEMA_VERSION,
vec![
CultNetDocumentOperation::IntentSubmit,
CultNetDocumentOperation::ReceiptWatch,
],
CultNetMutationAuthority::Coordinator,
vec![MODEL_REQUEST_TYPE],
vec![MODEL_STREAM_EVENT_TYPE, MODEL_RECEIPT_TYPE],
vec![
"Model turns enter through typed provider-neutral Epiphany request documents and return typed stream events/receipts.",
"Provider adapters may authenticate and transport; they must not own Epiphany state, prompt authority, or scheduling.",
],
),
mutation_contract(
MODEL_STREAM_EVENT_TYPE,
MODEL_STREAM_EVENT_SCHEMA_VERSION,
vec![CultNetDocumentOperation::ReceiptWatch],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec!["Model stream events are receipts from a typed model request."],
),
mutation_contract(
MODEL_RECEIPT_TYPE,
MODEL_RECEIPT_SCHEMA_VERSION,
vec![CultNetDocumentOperation::ReceiptWatch],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec![
"Terminal model receipts carry provider response id, usage, and transport evidence.",
],
),
mutation_contract(
TOOL_INVOCATION_INTENT_TYPE,
TOOL_INVOCATION_INTENT_SCHEMA_VERSION,
vec![
CultNetDocumentOperation::IntentSubmit,
CultNetDocumentOperation::ReceiptWatch,
],
CultNetMutationAuthority::Coordinator,
vec![TOOL_INVOCATION_INTENT_TYPE],
vec![TOOL_INVOCATION_RECEIPT_TYPE],
vec![
"Tool calls enter Epiphany as typed invocation intents; MCP JSON remains protocol-edge cargo.",
],
),
mutation_contract(
TOOL_INVOCATION_RECEIPT_TYPE,
TOOL_INVOCATION_RECEIPT_SCHEMA_VERSION,
vec![CultNetDocumentOperation::ReceiptWatch],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec![
"Tool invocation receipts seal parsed results, errors, and raw-result artifact refs before scheduler or state admission.",
],
),
mutation_contract(
OPENAI_ADAPTER_STATUS_TYPE,
OPENAI_ADAPTER_STATUS_SCHEMA_VERSION,
vec![CultNetDocumentOperation::Snapshot],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec![
"OpenAI adapter status is provider-specific evidence behind the model adapter boundary.",
],
),
mutation_contract(
OPENAI_MODEL_REQUEST_TYPE,
OPENAI_MODEL_REQUEST_SCHEMA_VERSION,
vec![CultNetDocumentOperation::Snapshot],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![OPENAI_MODEL_STREAM_EVENT_TYPE, OPENAI_MODEL_RECEIPT_TYPE],
vec![
"OpenAI model requests are adapter projection evidence, not the provider-neutral request authority.",
],
),
mutation_contract(
OPENAI_MODEL_STREAM_EVENT_TYPE,
OPENAI_MODEL_STREAM_EVENT_SCHEMA_VERSION,
vec![CultNetDocumentOperation::ReceiptWatch],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec![
"OpenAI stream events are provider-specific receipts mirrored from model stream events.",
],
),
mutation_contract(
OPENAI_MODEL_RECEIPT_TYPE,
OPENAI_MODEL_RECEIPT_SCHEMA_VERSION,
vec![CultNetDocumentOperation::ReceiptWatch],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec![
"OpenAI terminal receipts are provider-specific evidence behind the model receipt.",
],
),
mutation_contract(
STATE_LEDGER_STORE_TYPE,
STATE_LEDGER_SCHEMA_VERSION,
vec![CultNetDocumentOperation::Snapshot],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec![
"The ledger is inspected as durable memory; writes are mediated by role-specific state flows.",
],
),
]
}
fn validate_non_empty(value: &str, field: &str) -> Result<()> {
if value.trim().is_empty() {
return Err(anyhow!("{field} must be non-empty"));
@ -12398,27 +11577,6 @@ pub(crate) mod tests {
Ok(())
}
#[test]
fn runtime_registry_has_no_aggregate_repo_model_authority() -> Result<()> {
let registered = runtime_registered_document_types();
assert!(
!registered
.iter()
.any(|kind| kind == "epiphany.memory_graph")
);
assert!(
!registered
.iter()
.any(|kind| kind.contains("repo_model_admission"))
);
assert!(
registered
.iter()
.any(|kind| kind == crate::EpiphanyRepoModelIdentityDocument::TYPE)
);
Ok(())
}
#[test]
fn current_runtime_refuses_old_writable_epoch_without_mutation() -> Result<()> {
let temp = tempfile::tempdir()?;

View file

@ -78,7 +78,7 @@ async fn main() -> Result<()> {
if !status.present {
return Err(anyhow!("runtime spine is absent at {}", store.display()));
}
let registered_document_types = epiphany_core::runtime_registered_document_types();
let registered_document_types = epiphany_core::runtime_registered_document_types()?;
let missing: Vec<String> = required_document_types
.iter()
.filter(|required| !registered_document_types.contains(required))

View file

@ -96,7 +96,6 @@ pub fn required_packaged_release_binaries(target_triple: &str) -> Vec<(&'static
("repository-body", file_name("epiphany-repository-body")),
("host-identity", file_name("epiphany-host-identity")),
("swarm", file_name("epiphany-swarm")),
("runtime-spine", file_name("epiphany-runtime-spine")),
(
"persona-feedback-ingress",
file_name("epiphany-persona-feedback-ingress"),

View file

@ -153,12 +153,11 @@ longer imports Codex `ResponsesApiRequest`, `ResponsesClient`,
workflow. Its narrow direct imports preserve Codex-compatible auth identity
without letting Codex own Epiphany request/state shape.
The CultNet paperwork is now public too. `schemas/cultnet/` contains typed
schemas for OpenAI adapter status, model request, stream event, and terminal
receipt; `epiphany-runtime-spine` advertises those document types and mutation
contracts in its hello/schema catalog. This is the contract bridge the native
runtime should consume next. Do not add another JSON-RPC model endpoint and call
it progress.
`schemas/cultnet/` contains publication schemas for OpenAI adapter status,
model request, stream event, and terminal receipt. Live providers own their
CultMesh/CultNet catalogs. The native runtime accepts the document types
registered by the actual CultCache runtime schema; there is no standalone
hello/catalog CLI or hand-maintained mutation-contract mirror.
The native runtime route is the operator and daemon edge.
`epiphany-openai-adapter` documents
@ -171,11 +170,10 @@ Codex-backed transport through the typed spine; its `smoke` command proves the
CultCache route without touching the network. This is the first native caller
for the advertised OpenAI CultNet contract.
The heartbeat/specialist runtime job opener has been moved to
`epiphany-core::open_runtime_spine_heartbeat_job`. Vendored Codex may still
call it while the app-server compatibility route survives, but the
initialize-runtime, ensure-session, and create-job sequence is now native
runtime-spine machinery rather than Codex thread machinery.
Heartbeat/specialist launches use the atomic
`epiphany-core::prepare_runtime_spine_heartbeat_job` path. Initialization,
session admission, job creation, and launch receipts are one prepared CultCache
mutation rather than a caller-visible sequence.
The heartbeat launch plan is native as well:
`epiphany-core::plan_runtime_spine_heartbeat_launch` validates the launch

View file

@ -1,9 +1,8 @@
# CultNet Schemas
This folder is Epiphany's published CultNet contract surface for Aquarium and
other swarm-side observers. It contains the runtime state, operator-facing
surface projections, control intents, and receipt/artifact payloads that the
runtime-spine advertises over `cultnet.schema.v0`.
This folder contains Epiphany's JSON Schema publication artifacts for typed
CultNet boundaries. Typed Rust documents registered in CultCache remain the
runtime authority; these files help foreign consumers inspect the wire shape.
The product direction is project-native agency: clients should speak to a
project or one of its Personas/Personas, then watch typed scheduling, memory, evidence, and
@ -14,8 +13,7 @@ verbs.
## What Lives Here
- `index.json`: local registration manifest loaded by
`epiphany-runtime-spine` when answering schema-catalog requests.
- `index.json`: publication manifest for providers that expose these contracts.
- `*.schema.json`: top-level JSON Schema receipts for payload/document shapes.
The payload receipts are deliberately practical rather than religiously
@ -40,12 +38,8 @@ inspection and actuation; a future Rider daemon will own Rider integration.
## Publication Path
Generate a schema-catalog response with inline schema bodies:
```powershell
cargo run -p epiphany-release-bundle --bin epiphany-runtime-spine -- schema-catalog --output .epiphany-dogfood\runtime-spine\schema-catalog.json --include-schema-json true
```
The runtime-spine merges the builtin CultNet schema registry with this local
index before answering the request, so consumers can discover both canonical
wire contracts and Epiphany-local payload contracts from one place.
The provider that owns a live CultMesh/CultNet surface owns its schema-catalog
response. This directory supplies publication artifacts; it is not a second
runtime registry and no standalone Epiphany catalog command impersonates a
service. The native model preflight derives its accepted document types from
the same CultCache registrations used to open the runtime Mind store.

2
vendor/cultcache-rs vendored

@ -1 +1 @@
Subproject commit ba6a4874fc61c69605dd0dc0b004f340e8a76368
Subproject commit fdbf3bf0a4b3f6b617c224d7439feb8e69d4474c