Delete aggregate runtime status projection
This commit is contained in:
parent
abf1d51350
commit
3eca33949a
6 changed files with 11 additions and 107 deletions
|
|
@ -23,7 +23,6 @@ use epiphany_core::put_hands_action_intent;
|
|||
use epiphany_core::put_hands_action_review;
|
||||
use epiphany_core::put_repo_frontier_hands_authority;
|
||||
use epiphany_core::put_substrate_gate_repo_access_grant_receipt;
|
||||
use epiphany_core::runtime_spine_status;
|
||||
use epiphany_core::select_and_commit_repo_frontier_route;
|
||||
use epiphany_core::substrate_gate_coordinator_implementation_grant;
|
||||
use epiphany_core::{
|
||||
|
|
@ -1331,7 +1330,6 @@ fn run_coordinator(args: &Args) -> Result<Value> {
|
|||
"coordinator-final-status.txt".to_string(),
|
||||
"coordinator-final-action.txt".to_string(),
|
||||
"agent-function-telemetry.json".to_string(),
|
||||
"runtime-spine-status.json".to_string(),
|
||||
];
|
||||
let sealed_artifact_manifest = Vec::new();
|
||||
let receipt_created_at = now();
|
||||
|
|
@ -1386,7 +1384,6 @@ fn run_coordinator(args: &Args) -> Result<Value> {
|
|||
final_runtime_job_id: final_action["runtimeJobId"].as_str().map(str::to_string),
|
||||
};
|
||||
finalize_coordinator_run(&runtime_store, &coordinator_run_receipt)?;
|
||||
let runtime_status = runtime_spine_status(&runtime_store)?;
|
||||
let summary = json!({
|
||||
"objective": "Coordinate the Epiphany MVP lanes through native typed state and runtime organs.",
|
||||
"artifactDir": artifact_dir,
|
||||
|
|
@ -1397,7 +1394,6 @@ fn run_coordinator(args: &Args) -> Result<Value> {
|
|||
"codexHome": codex_home,
|
||||
"mcpConfig": mcp_config,
|
||||
"runtimeStore": runtime_store,
|
||||
"runtimeSpine": runtime_status,
|
||||
"workspace": cwd,
|
||||
"threadId": operator_final_status["threadId"],
|
||||
"mode": args.mode,
|
||||
|
|
@ -1419,10 +1415,6 @@ fn run_coordinator(args: &Args) -> Result<Value> {
|
|||
&artifact_dir.join("coordinator-final-status.json"),
|
||||
&summary["finalStatus"],
|
||||
)?;
|
||||
write_json(
|
||||
&artifact_dir.join("runtime-spine-status.json"),
|
||||
&summary["runtimeSpine"],
|
||||
)?;
|
||||
fs::write(
|
||||
artifact_dir.join("coordinator-final-status.txt"),
|
||||
final_rendered,
|
||||
|
|
|
|||
|
|
@ -248,7 +248,6 @@ pub use runtime_spine::EpiphanyRuntimeReorientWorkerResult;
|
|||
pub use runtime_spine::EpiphanyRuntimeRoleWorkerResult;
|
||||
pub use runtime_spine::EpiphanyRuntimeSession;
|
||||
pub use runtime_spine::EpiphanyRuntimeSessionStatus;
|
||||
pub use runtime_spine::EpiphanyRuntimeSpineStatus;
|
||||
pub use runtime_spine::EpiphanyRuntimeSwarmBinding;
|
||||
pub use runtime_spine::EpiphanyRuntimeToolExecutionBinding;
|
||||
pub use runtime_spine::EpiphanyRuntimeWorkerLaunchRequest;
|
||||
|
|
@ -332,6 +331,7 @@ pub use runtime_spine::runtime_hands_commit_receipt;
|
|||
pub use runtime_spine::runtime_hands_patch_receipt;
|
||||
pub use runtime_spine::runtime_has_actionable_hands_frontier;
|
||||
pub use runtime_spine::runtime_job_snapshot;
|
||||
pub use runtime_spine::runtime_identity;
|
||||
pub use runtime_spine::runtime_registered_document_types;
|
||||
pub use runtime_spine::runtime_reorient_worker_result;
|
||||
pub use runtime_spine::runtime_repo_frontier_planning_lifecycle;
|
||||
|
|
@ -339,7 +339,6 @@ pub use runtime_spine::runtime_repo_frontier_research_lifecycle;
|
|||
pub use runtime_spine::runtime_requested_public_source_refs_for_worker;
|
||||
pub use runtime_spine::runtime_role_worker_result;
|
||||
pub use runtime_spine::runtime_spine_cache;
|
||||
pub use runtime_spine::runtime_spine_status;
|
||||
pub use runtime_spine::runtime_typed_request_attempt_exists;
|
||||
pub use runtime_spine::runtime_typed_request_fulfillment;
|
||||
pub use runtime_spine::runtime_worker_launch_request;
|
||||
|
|
|
|||
|
|
@ -773,23 +773,6 @@ pub enum EpiphanyRuntimeJobStatus {
|
|||
Cancelled,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct EpiphanyRuntimeSpineStatus {
|
||||
pub store: String,
|
||||
pub present: bool,
|
||||
pub runtime_id: Option<String>,
|
||||
pub display_name: Option<String>,
|
||||
pub sessions: usize,
|
||||
pub active_sessions: usize,
|
||||
pub jobs: usize,
|
||||
pub open_jobs: usize,
|
||||
pub job_results: usize,
|
||||
pub tool_invocation_intents: usize,
|
||||
pub tool_invocation_receipts: usize,
|
||||
pub pending_tool_invocations: usize,
|
||||
pub supported_document_types: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct RuntimeSpineInitOptions {
|
||||
pub runtime_id: String,
|
||||
|
|
@ -9917,83 +9900,16 @@ pub fn complete_runtime_job(
|
|||
Ok(result)
|
||||
}
|
||||
|
||||
pub fn runtime_spine_status(store_path: impl AsRef<Path>) -> Result<EpiphanyRuntimeSpineStatus> {
|
||||
pub fn runtime_identity(store_path: impl AsRef<Path>) -> Result<Option<EpiphanyRuntimeIdentity>> {
|
||||
let store_path = store_path.as_ref();
|
||||
if !store_path.exists() {
|
||||
return Ok(EpiphanyRuntimeSpineStatus {
|
||||
store: store_path.display().to_string(),
|
||||
present: false,
|
||||
runtime_id: None,
|
||||
display_name: None,
|
||||
sessions: 0,
|
||||
active_sessions: 0,
|
||||
jobs: 0,
|
||||
open_jobs: 0,
|
||||
job_results: 0,
|
||||
tool_invocation_intents: 0,
|
||||
tool_invocation_receipts: 0,
|
||||
pending_tool_invocations: 0,
|
||||
supported_document_types: Vec::new(),
|
||||
});
|
||||
return Ok(None);
|
||||
}
|
||||
let mut cache = runtime_spine_cache(store_path)?;
|
||||
cache
|
||||
.pull_all_backing_stores()
|
||||
.with_context(|| format!("failed to read runtime spine {}", store_path.display()))?;
|
||||
let identity = cache.get::<EpiphanyRuntimeIdentity>(RUNTIME_IDENTITY_KEY)?;
|
||||
let sessions = cache.get_all::<EpiphanyRuntimeSession>()?;
|
||||
let jobs = cache.get_all::<EpiphanyRuntimeJob>()?;
|
||||
let job_results = cache.get_all::<EpiphanyRuntimeJobResult>()?;
|
||||
let tool_intents = cache.get_all::<EpiphanyToolInvocationIntent>()?;
|
||||
let tool_receipts = cache.get_all::<EpiphanyToolInvocationReceipt>()?;
|
||||
let receipt_intent_ids = tool_receipts
|
||||
.iter()
|
||||
.map(|receipt| receipt.intent_id.as_str())
|
||||
.collect::<BTreeSet<_>>();
|
||||
let active_sessions = sessions
|
||||
.iter()
|
||||
.filter(|session| {
|
||||
matches!(
|
||||
session.status,
|
||||
EpiphanyRuntimeSessionStatus::Active
|
||||
| EpiphanyRuntimeSessionStatus::WaitingForReview
|
||||
)
|
||||
})
|
||||
.count();
|
||||
let open_jobs = jobs
|
||||
.iter()
|
||||
.filter(|job| {
|
||||
matches!(
|
||||
job.status,
|
||||
EpiphanyRuntimeJobStatus::Queued
|
||||
| EpiphanyRuntimeJobStatus::Running
|
||||
| EpiphanyRuntimeJobStatus::WaitingForReview
|
||||
)
|
||||
})
|
||||
.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(),
|
||||
runtime_id: identity.as_ref().map(|item| item.runtime_id.clone()),
|
||||
display_name: identity.as_ref().map(|item| item.display_name.clone()),
|
||||
sessions: sessions.len(),
|
||||
active_sessions,
|
||||
jobs: jobs.len(),
|
||||
open_jobs,
|
||||
job_results: job_results.len(),
|
||||
tool_invocation_intents: tool_intents.len(),
|
||||
tool_invocation_receipts: tool_receipts.len(),
|
||||
pending_tool_invocations: tool_intents
|
||||
.iter()
|
||||
.filter(|intent| !receipt_intent_ids.contains(intent.intent_id.as_str()))
|
||||
.count(),
|
||||
supported_document_types,
|
||||
})
|
||||
cache.get::<EpiphanyRuntimeIdentity>(RUNTIME_IDENTITY_KEY)
|
||||
}
|
||||
|
||||
pub fn runtime_registered_document_types() -> Result<Vec<String>> {
|
||||
|
|
|
|||
|
|
@ -76,10 +76,8 @@ async fn main() -> Result<()> {
|
|||
other => return Err(anyhow!("unknown preflight argument: {other}")),
|
||||
}
|
||||
}
|
||||
let status = epiphany_core::runtime_spine_status(&store)?;
|
||||
if !status.present {
|
||||
return Err(anyhow!("runtime spine is absent at {}", store.display()));
|
||||
}
|
||||
let identity = epiphany_core::runtime_identity(&store)?
|
||||
.ok_or_else(|| anyhow!("runtime spine is absent at {}", store.display()))?;
|
||||
let registered_document_types = epiphany_core::runtime_registered_document_types()?;
|
||||
let missing: Vec<String> = required_document_types
|
||||
.iter()
|
||||
|
|
@ -111,7 +109,7 @@ async fn main() -> Result<()> {
|
|||
"schemaCatalogSha256": schema_catalog_sha256,
|
||||
"preflightWitnessId": preflight_witness_id,
|
||||
"runtimeStore": store,
|
||||
"runtimeId": status.runtime_id,
|
||||
"runtimeId": identity.runtime_id,
|
||||
"requiredDocumentTypes": required_document_types,
|
||||
"registeredDocumentTypes": registered_document_types,
|
||||
"schemaPreflightPassed": true,
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ use epiphany_core::open_runtime_model_execution;
|
|||
use epiphany_core::put_runtime_reorient_worker_result;
|
||||
use epiphany_core::put_runtime_role_worker_result;
|
||||
use epiphany_core::put_runtime_tool_execution_intent;
|
||||
use epiphany_core::runtime_identity;
|
||||
use epiphany_core::runtime_spine_cache;
|
||||
use epiphany_core::runtime_spine_status;
|
||||
use epiphany_model_adapter::EpiphanyModelInputItem;
|
||||
use epiphany_model_adapter::EpiphanyModelReceipt;
|
||||
use epiphany_model_adapter::EpiphanyModelRequest;
|
||||
|
|
@ -876,8 +876,7 @@ pub fn fail_model_backed_worker_job(
|
|||
}
|
||||
|
||||
pub fn ensure_openai_runtime_ready(options: &EpiphanyOpenAiRuntimeOptions) -> Result<()> {
|
||||
let status = runtime_spine_status(&options.store_path)?;
|
||||
if status.present {
|
||||
if runtime_identity(&options.store_path)?.is_some() {
|
||||
return Ok(());
|
||||
}
|
||||
initialize_runtime_spine(
|
||||
|
|
|
|||
|
|
@ -680,7 +680,7 @@ mod tests {
|
|||
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'a>> {
|
||||
self.calls.push(stage.to_string());
|
||||
Box::pin(async move {
|
||||
if !epiphany_core::runtime_spine_status(store_path)?.present {
|
||||
if epiphany_core::runtime_identity(store_path)?.is_none() {
|
||||
epiphany_core::initialize_runtime_spine(
|
||||
store_path,
|
||||
epiphany_core::RuntimeSpineInitOptions {
|
||||
|
|
@ -752,7 +752,7 @@ mod tests {
|
|||
cultmesh_store: PathBuf,
|
||||
allowed_channel_ids: Vec<String>,
|
||||
) -> Result<PersonaModelExecutionPlan> {
|
||||
if !epiphany_core::runtime_spine_status(store)?.present {
|
||||
if epiphany_core::runtime_identity(store)?.is_none() {
|
||||
epiphany_core::initialize_runtime_spine(
|
||||
store,
|
||||
epiphany_core::RuntimeSpineInitOptions {
|
||||
|
|
|
|||
Reference in a new issue