diff --git a/epiphany-core/Cargo.toml b/epiphany-core/Cargo.toml index efcecabc..1cc721d0 100644 --- a/epiphany-core/Cargo.toml +++ b/epiphany-core/Cargo.toml @@ -210,10 +210,6 @@ path = "src/bin/epiphany-repo-livefire-closure-smoke.rs" name = "epiphany-repo-maintainer-review-request-family-smoke" path = "src/bin/epiphany-repo-maintainer-review-request-family-smoke.rs" -[[bin]] -name = "epiphany-repo-model-bootstrap" -path = "src/bin/epiphany-repo-model-bootstrap.rs" - [[bin]] name = "epiphany-repo-objective-draft-family-smoke" path = "src/bin/epiphany-repo-objective-draft-family-smoke.rs" diff --git a/epiphany-core/src/bin/epiphany-repo-model-bootstrap.rs b/epiphany-core/src/bin/epiphany-repo-model-bootstrap.rs deleted file mode 100644 index 1e3bb6b3..00000000 --- a/epiphany-core/src/bin/epiphany-repo-model-bootstrap.rs +++ /dev/null @@ -1,83 +0,0 @@ -use anyhow::{Context, Result, anyhow}; -use chrono::{SecondsFormat, Utc}; -use epiphany_core::{ - bind_runtime_to_agent_memory_swarm, ensure_runtime_repo_model, load_thread_state, - memory_graph_from_epiphany_graphs, migrate_legacy_repo_model_projection_obligation, -}; -use std::env; -use std::path::{Path, PathBuf}; - -fn main() -> Result<()> { - let mut args = env::args().skip(1); - let runtime_store = required_path(&mut args, "--runtime-store")?; - let thread_state_store = required_path(&mut args, "--thread-state-store")?; - let agent_store = required_path(&mut args, "--agent-store")?; - if args.next().is_some() { - return Err(usage("unexpected trailing arguments")); - } - let state = load_thread_state(&thread_state_store)?.ok_or_else(|| { - anyhow!( - "thread-state store {} is missing canonical state", - thread_state_store.display() - ) - })?; - let repo_root = thread_state_store - .parent() - .and_then(Path::parent) - .unwrap_or_else(|| Path::new(".")); - let source_identity = thread_state_store - .canonicalize() - .unwrap_or_else(|_| thread_state_store.clone()) - .to_string_lossy() - .into_owned(); - let bootstrap = memory_graph_from_epiphany_graphs( - format!("repo-model-bootstrap-rev-{}", state.revision), - &state.graphs, - source_identity, - state.revision, - repo_root, - )?; - // The runtime-spine owner performs the one-time atomic admission and - // migration receipt. A deliberately absent legacy path prevents a stale - // sibling graph from impersonating the typed thread-state bootstrap. - let absent_legacy = runtime_store.with_extension("no-legacy-memory-graph"); - let at = Utc::now().to_rfc3339_opts(SecondsFormat::Millis, true); - let binding = bind_runtime_to_agent_memory_swarm(&runtime_store, &agent_store, &at)?; - migrate_legacy_repo_model_projection_obligation(&runtime_store)?; - let (snapshot, receipt) = - ensure_runtime_repo_model(&runtime_store, absent_legacy, &bootstrap, &at)?; - println!( - "{}", - serde_json::to_string_pretty(&serde_json::json!({ - "status": "ready", - "runtimeStore": runtime_store, - "threadStateStore": thread_state_store, - "graphId": snapshot.graph_id, - "modelRevision": snapshot.model_revision, - "modelHash": snapshot.model_hash, - "migrationReceiptId": receipt.receipt_id, - "migrationSource": receipt.source_store, - "swarmId": binding.swarm_id, - "runtimeSwarmBindingId": binding.binding_id, - }))? - ); - Ok(()) -} - -fn required_path(args: &mut impl Iterator, flag: &str) -> Result { - let actual = args - .next() - .ok_or_else(|| usage(&format!("missing {flag}")))?; - if actual != flag { - return Err(usage(&format!("expected {flag}, got {actual:?}"))); - } - args.next() - .map(PathBuf::from) - .with_context(|| format!("missing value for {flag}")) -} - -fn usage(message: &str) -> anyhow::Error { - anyhow!( - "{message}\nusage: epiphany-repo-model-bootstrap --runtime-store --thread-state-store --agent-store " - ) -}