Delete duplicate coordinator status binary
This commit is contained in:
parent
bfeda461af
commit
500125d571
6 changed files with 44 additions and 139 deletions
|
|
@ -134,10 +134,6 @@ path = "epiphany-core/src/bin/epiphany-persona-discord-permit-identity.rs"
|
|||
name = "epiphany-mvp-coordinator"
|
||||
path = "epiphany-core/src/bin/epiphany-mvp-coordinator.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "epiphany-mvp-status"
|
||||
path = "epiphany-core/src/bin/epiphany-mvp-status.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "epiphany-frontier-proposal"
|
||||
path = "epiphany-core/src/bin/epiphany-frontier-proposal.rs"
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ use epiphany_core::substrate_gate_coordinator_implementation_grant;
|
|||
use epiphany_core::{
|
||||
LaunchedCoordinator, capture_process_instance, claim_resident_self_preparation_as_child,
|
||||
};
|
||||
use epiphany_core::coordinator_status as status_projection;
|
||||
use serde_json::Value;
|
||||
use serde_json::json;
|
||||
use sha2::{Digest, Sha256};
|
||||
|
|
@ -51,10 +52,6 @@ const CREATE_NO_WINDOW: u32 = 0x0800_0000;
|
|||
#[cfg(windows)]
|
||||
const DETACHED_PROCESS: u32 = 0x0000_0008;
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[path = "epiphany-mvp-status.rs"]
|
||||
mod status_cli;
|
||||
|
||||
const DEFAULT_MODEL_RUNTIME_BIN: &str = "epiphany-model-runtime";
|
||||
const DEFAULT_TOOL_ADAPTER_BIN: &str = "epiphany-tool-mcp-runtime";
|
||||
const WORKER_AUTO_TOOL_MAX_ROUNDS: usize = 24;
|
||||
|
|
@ -282,19 +279,19 @@ fn run_coordinator(args: &Args) -> Result<Value> {
|
|||
));
|
||||
}
|
||||
};
|
||||
let local_verse_store = status_cli::absolute_path(&args.local_verse_store)?;
|
||||
let local_verse_store = status_projection::absolute_path(&args.local_verse_store)?;
|
||||
assert_local_verse_brake_released(
|
||||
&local_verse_store,
|
||||
args.runtime_id.as_deref().expect("validated runtime id"),
|
||||
"epiphany-mvp-coordinator",
|
||||
)?;
|
||||
let cwd = status_cli::absolute_path(&args.cwd)?;
|
||||
let cwd = status_projection::absolute_path(&args.cwd)?;
|
||||
let model_runtime_bin = resolve_model_runtime_bin(&root, &args.model_runtime_bin)?;
|
||||
let tool_adapter_bin = resolve_model_runtime_bin(&root, &args.tool_adapter_bin)?;
|
||||
let codex_home = status_cli::absolute_path(&args.codex_home)?;
|
||||
let mcp_config = status_cli::absolute_path(&args.mcp_config)?;
|
||||
let artifact_dir = status_cli::absolute_path(&args.artifact_dir)?;
|
||||
let runtime_store = status_cli::absolute_path(&args.runtime_store)?;
|
||||
let codex_home = status_projection::absolute_path(&args.codex_home)?;
|
||||
let mcp_config = status_projection::absolute_path(&args.mcp_config)?;
|
||||
let artifact_dir = status_projection::absolute_path(&args.artifact_dir)?;
|
||||
let runtime_store = status_projection::absolute_path(&args.runtime_store)?;
|
||||
reset_artifact_dir(&artifact_dir)?;
|
||||
fs::create_dir_all(&codex_home)?;
|
||||
|
||||
|
|
@ -429,7 +426,7 @@ fn run_coordinator(args: &Args) -> Result<Value> {
|
|||
"type": "imaginationConsiderationLaunch",
|
||||
"requestId": request_id,
|
||||
"runtimeJobId": worker_job_id,
|
||||
"launch": status_cli::sanitize_for_operator(operator_launch),
|
||||
"launch": status_projection::sanitize_for_operator(operator_launch),
|
||||
"worker": worker_run,
|
||||
"authority": "proposal-only"
|
||||
}));
|
||||
|
|
@ -560,7 +557,7 @@ fn run_coordinator(args: &Args) -> Result<Value> {
|
|||
let snapshot_name = format!("step-{index:02}-{action}.txt");
|
||||
fs::write(
|
||||
artifact_dir.join(&snapshot_name),
|
||||
status_cli::render_status(&status_cli::sanitize_for_operator(status.clone())),
|
||||
status_projection::render_status(&status_projection::sanitize_for_operator(status.clone())),
|
||||
)?;
|
||||
snapshots.push(snapshot_name);
|
||||
let mut step = json!({
|
||||
|
|
@ -636,7 +633,7 @@ fn run_coordinator(args: &Args) -> Result<Value> {
|
|||
)?;
|
||||
push_event(
|
||||
&mut step,
|
||||
json!({"type": "frontierPlanningFailureReview", "review": status_cli::sanitize_for_operator(serde_json::to_value(reviewed)?)}),
|
||||
json!({"type": "frontierPlanningFailureReview", "review": status_projection::sanitize_for_operator(serde_json::to_value(reviewed)?)}),
|
||||
);
|
||||
final_status = collect_coordinator_status(&runtime_store, &thread_id)?;
|
||||
}
|
||||
|
|
@ -953,7 +950,7 @@ fn run_coordinator(args: &Args) -> Result<Value> {
|
|||
let result = read_reorient_result(&runtime_store, &thread_id)?;
|
||||
push_event(
|
||||
&mut step,
|
||||
json!({"type": "reorientResult", "result": status_cli::sanitize_for_operator(result.clone())}),
|
||||
json!({"type": "reorientResult", "result": status_projection::sanitize_for_operator(result.clone())}),
|
||||
);
|
||||
if !matches!(
|
||||
result["status"].as_str(),
|
||||
|
|
@ -969,7 +966,7 @@ fn run_coordinator(args: &Args) -> Result<Value> {
|
|||
let recorded = accept_reorient(&runtime_store)?;
|
||||
push_event(
|
||||
&mut step,
|
||||
json!({"type": "reorientFailureRecorded", "recorded": status_cli::sanitize_for_operator(recorded)}),
|
||||
json!({"type": "reorientFailureRecorded", "recorded": status_projection::sanitize_for_operator(recorded)}),
|
||||
);
|
||||
final_status = collect_coordinator_status(&runtime_store, &thread_id)?;
|
||||
append_operator_step_jsonl(&steps_path, &step)?;
|
||||
|
|
@ -981,7 +978,7 @@ fn run_coordinator(args: &Args) -> Result<Value> {
|
|||
let accepted = accept_reorient(&runtime_store)?;
|
||||
push_event(
|
||||
&mut step,
|
||||
json!({"type": "reorientAccept", "accepted": status_cli::sanitize_for_operator(accepted)}),
|
||||
json!({"type": "reorientAccept", "accepted": status_projection::sanitize_for_operator(accepted)}),
|
||||
);
|
||||
final_status = collect_coordinator_status(&runtime_store, &thread_id)?;
|
||||
append_operator_step_jsonl(&steps_path, &step)?;
|
||||
|
|
@ -1197,7 +1194,7 @@ fn run_coordinator(args: &Args) -> Result<Value> {
|
|||
let worker_job_id = worker_job_id_from_launch(&launch)?;
|
||||
push_event(
|
||||
&mut step,
|
||||
json!({"type": "roleLaunch", "roleId": role_id, "launch": status_cli::sanitize_for_operator(launch.clone()), "runtimeJobId": worker_job_id}),
|
||||
json!({"type": "roleLaunch", "roleId": role_id, "launch": status_projection::sanitize_for_operator(launch.clone()), "runtimeJobId": worker_job_id}),
|
||||
);
|
||||
let worker_run = launch_worker_runtime_detached(
|
||||
&model_runtime_bin,
|
||||
|
|
@ -1236,7 +1233,7 @@ fn run_coordinator(args: &Args) -> Result<Value> {
|
|||
};
|
||||
push_event(
|
||||
&mut step,
|
||||
json!({"type": "roleResult", "roleId": role_id, "result": status_cli::sanitize_for_operator(result.clone())}),
|
||||
json!({"type": "roleResult", "roleId": role_id, "result": status_projection::sanitize_for_operator(result.clone())}),
|
||||
);
|
||||
final_status = collect_coordinator_status(&runtime_store, &thread_id)?;
|
||||
if !matches!(
|
||||
|
|
@ -1268,7 +1265,7 @@ fn run_coordinator(args: &Args) -> Result<Value> {
|
|||
let worker_job_id = worker_job_id_from_launch(&launch)?;
|
||||
push_event(
|
||||
&mut step,
|
||||
json!({"type": "reorientLaunch", "launch": status_cli::sanitize_for_operator(launch.clone()), "runtimeJobId": worker_job_id}),
|
||||
json!({"type": "reorientLaunch", "launch": status_projection::sanitize_for_operator(launch.clone()), "runtimeJobId": worker_job_id}),
|
||||
);
|
||||
let worker_run = launch_worker_runtime_detached(
|
||||
&model_runtime_bin,
|
||||
|
|
@ -1295,7 +1292,7 @@ fn run_coordinator(args: &Args) -> Result<Value> {
|
|||
let result = read_reorient_result(&runtime_store, &thread_id)?;
|
||||
push_event(
|
||||
&mut step,
|
||||
json!({"type": "reorientResult", "result": status_cli::sanitize_for_operator(result.clone())}),
|
||||
json!({"type": "reorientResult", "result": status_projection::sanitize_for_operator(result.clone())}),
|
||||
);
|
||||
final_status = collect_coordinator_status(&runtime_store, &thread_id)?;
|
||||
if !matches!(
|
||||
|
|
@ -1322,9 +1319,9 @@ fn run_coordinator(args: &Args) -> Result<Value> {
|
|||
steps.push(step);
|
||||
}
|
||||
|
||||
let operator_final_status = status_cli::sanitize_for_operator(final_status);
|
||||
let final_rendered = status_cli::render_status(&operator_final_status);
|
||||
let operator_steps = status_cli::sanitize_for_operator(Value::Array(steps));
|
||||
let operator_final_status = status_projection::sanitize_for_operator(final_status);
|
||||
let final_rendered = status_projection::render_status(&operator_final_status);
|
||||
let operator_steps = status_projection::sanitize_for_operator(Value::Array(steps));
|
||||
let artifact_manifest = vec![
|
||||
"coordinator-summary.json".to_string(),
|
||||
"coordinator-steps.jsonl".to_string(),
|
||||
|
|
@ -1405,7 +1402,7 @@ fn run_coordinator(args: &Args) -> Result<Value> {
|
|||
"startupEvents": startup_events,
|
||||
"steps": operator_steps,
|
||||
"snapshots": snapshots,
|
||||
"finalAction": status_cli::sanitize_for_operator(final_action),
|
||||
"finalAction": status_projection::sanitize_for_operator(final_action),
|
||||
"finalStatus": operator_final_status,
|
||||
"coordinatorRunReceipt": {
|
||||
"documentType": COORDINATOR_RUN_RECEIPT_TYPE,
|
||||
|
|
@ -1557,12 +1554,12 @@ fn assert_local_verse_brake_released(
|
|||
}
|
||||
|
||||
fn collect_coordinator_status(runtime_store: &Path, thread_id: &str) -> Result<Value> {
|
||||
status_cli::native_coordinator_json(runtime_store, thread_id)
|
||||
status_projection::native_coordinator_json(runtime_store, thread_id)
|
||||
}
|
||||
|
||||
fn resolve_model_runtime_bin(root: &Path, configured: &Path) -> Result<PathBuf> {
|
||||
if configured.components().count() != 1 {
|
||||
return status_cli::absolute_path(configured);
|
||||
return status_projection::absolute_path(configured);
|
||||
}
|
||||
let exe_name = format!("{}.exe", configured.display());
|
||||
let cargo_target_candidate = env::var_os("CARGO_TARGET_DIR")
|
||||
|
|
@ -2188,7 +2185,7 @@ fn append_jsonl(path: &Path, value: &Value) -> Result<()> {
|
|||
}
|
||||
|
||||
fn append_operator_step_jsonl(path: &Path, step: &Value) -> Result<()> {
|
||||
append_jsonl(path, &status_cli::sanitize_for_operator(step.clone()))
|
||||
append_jsonl(path, &status_projection::sanitize_for_operator(step.clone()))
|
||||
}
|
||||
|
||||
fn take_string(args: &mut impl Iterator<Item = String>, name: &str) -> Result<String> {
|
||||
|
|
|
|||
|
|
@ -1,16 +1,15 @@
|
|||
use anyhow::{Context, Result, anyhow};
|
||||
use epiphany_core::{
|
||||
use anyhow::{Context, Result};
|
||||
use crate::{
|
||||
EpiphanyCoordinatorInput, EpiphanyCrrcAction, EpiphanyCurrentWorkProjection,
|
||||
EpiphanyRoleBoardInput, RepoFrontierPlanningLifecycle, RepoFrontierPlanningLifecycleStage,
|
||||
RepoFrontierResearchLifecycle, RepoFrontierResearchLifecycleStage, derive_role_board,
|
||||
};
|
||||
use serde_json::{Value, json};
|
||||
use std::{
|
||||
env, fs,
|
||||
env,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
const DEFAULT_COORDINATOR_STORE: &str = "state/runtime-spine.msgpack";
|
||||
const SEALED_DIRECT_THOUGHT_KEYS: &[&str] = &[
|
||||
"rawResult",
|
||||
"turns",
|
||||
|
|
@ -21,83 +20,12 @@ const SEALED_DIRECT_THOUGHT_KEYS: &[&str] = &[
|
|||
const SEALED_LONG_TEXT_KEYS: &[&str] = &["note"];
|
||||
const MAX_OPERATOR_TEXT_CHARS: usize = 1200;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let args = Args::parse()?;
|
||||
let status = run_status(&args)?;
|
||||
if let Some(result) = &args.result {
|
||||
if let Some(parent) = result.parent() {
|
||||
fs::create_dir_all(parent)
|
||||
.with_context(|| format!("failed to create {}", parent.display()))?;
|
||||
}
|
||||
fs::write(
|
||||
result,
|
||||
format!("{}\n", serde_json::to_string_pretty(&status)?),
|
||||
)
|
||||
.with_context(|| format!("failed to write {}", result.display()))?;
|
||||
}
|
||||
if args.json {
|
||||
println!("{}", serde_json::to_string_pretty(&status)?);
|
||||
} else {
|
||||
print!("{}", render_status(&status));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Args {
|
||||
thread_id: Option<String>,
|
||||
store: PathBuf,
|
||||
json: bool,
|
||||
result: Option<PathBuf>,
|
||||
}
|
||||
|
||||
impl Args {
|
||||
fn parse() -> Result<Self> {
|
||||
let mut args = env::args().skip(1);
|
||||
let mut parsed = Self {
|
||||
thread_id: None,
|
||||
store: PathBuf::from(DEFAULT_COORDINATOR_STORE),
|
||||
json: false,
|
||||
result: None,
|
||||
};
|
||||
while let Some(arg) = args.next() {
|
||||
match arg.as_str() {
|
||||
"--thread-id" => parsed.thread_id = Some(take_string(&mut args, "--thread-id")?),
|
||||
"--store" => parsed.store = take_path(&mut args, "--store")?,
|
||||
"--json" => parsed.json = true,
|
||||
"--result" => parsed.result = Some(take_path(&mut args, "--result")?),
|
||||
_ => return Err(anyhow!("unknown argument: {arg}")),
|
||||
}
|
||||
}
|
||||
Ok(parsed)
|
||||
}
|
||||
}
|
||||
|
||||
fn run_status(args: &Args) -> Result<Value> {
|
||||
run_native_status(args)
|
||||
}
|
||||
|
||||
pub fn native_coordinator_json(runtime_store: &Path, thread_id: &str) -> Result<Value> {
|
||||
run_native_status(
|
||||
&Args {
|
||||
thread_id: Some(thread_id.to_string()),
|
||||
store: runtime_store.to_path_buf(),
|
||||
json: true,
|
||||
result: None,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
fn run_native_status(args: &Args) -> Result<Value> {
|
||||
let store_path = absolute_path(&args.store)?;
|
||||
let thread_id = args
|
||||
.thread_id
|
||||
.clone()
|
||||
.unwrap_or_else(|| "native-local".to_string());
|
||||
let store_path = absolute_path(runtime_store)?;
|
||||
|
||||
let mind = if store_path.exists() {
|
||||
Some(
|
||||
epiphany_core::assemble_mind_view(&store_path).with_context(|| {
|
||||
crate::assemble_mind_view(&store_path).with_context(|| {
|
||||
format!("failed to assemble keyed Mind {}", store_path.display())
|
||||
})?,
|
||||
)
|
||||
|
|
@ -105,7 +33,7 @@ fn run_native_status(args: &Args) -> Result<Value> {
|
|||
None
|
||||
};
|
||||
let current_work = if mind.is_some() {
|
||||
epiphany_core::project_current_work(&store_path)
|
||||
crate::project_current_work(&store_path)
|
||||
.context("failed to derive current work from keyed Mind and runtime receipts")?
|
||||
} else {
|
||||
empty_current_work()
|
||||
|
|
@ -113,19 +41,18 @@ fn run_native_status(args: &Args) -> Result<Value> {
|
|||
let latest_reorientation_decision = mind
|
||||
.as_ref()
|
||||
.and_then(|mind| mind.reorientation_decisions.last());
|
||||
let crrc_action = if latest_reorientation_decision
|
||||
.is_some_and(|decision| decision.mode == "regather")
|
||||
{
|
||||
EpiphanyCrrcAction::RegatherManually
|
||||
} else {
|
||||
EpiphanyCrrcAction::Continue
|
||||
};
|
||||
let crrc_action =
|
||||
if latest_reorientation_decision.is_some_and(|decision| decision.mode == "regather") {
|
||||
EpiphanyCrrcAction::RegatherManually
|
||||
} else {
|
||||
EpiphanyCrrcAction::Continue
|
||||
};
|
||||
|
||||
let roles = derive_role_board(EpiphanyRoleBoardInput {
|
||||
mind_present: mind.is_some(),
|
||||
current_work: current_work.clone(),
|
||||
});
|
||||
let coordinator = epiphany_core::recommend_coordinator_action(EpiphanyCoordinatorInput {
|
||||
let coordinator = crate::recommend_coordinator_action(EpiphanyCoordinatorInput {
|
||||
mind_present: mind.is_some(),
|
||||
crrc_action,
|
||||
current_work: current_work.clone(),
|
||||
|
|
@ -256,15 +183,6 @@ fn maybe(value: &Value, fallback: &str) -> String {
|
|||
.unwrap_or_else(|| fallback.to_string())
|
||||
}
|
||||
|
||||
fn take_string(args: &mut impl Iterator<Item = String>, flag: &str) -> Result<String> {
|
||||
args.next()
|
||||
.ok_or_else(|| anyhow!("{flag} requires a value"))
|
||||
}
|
||||
|
||||
fn take_path(args: &mut impl Iterator<Item = String>, flag: &str) -> Result<PathBuf> {
|
||||
Ok(PathBuf::from(take_string(args, flag)?))
|
||||
}
|
||||
|
||||
pub fn absolute_path(path: &Path) -> Result<PathBuf> {
|
||||
if path.is_absolute() {
|
||||
return Ok(path.to_path_buf());
|
||||
|
|
@ -287,5 +205,4 @@ mod tests {
|
|||
assert!(sanitized.get("rawResult").is_none());
|
||||
assert_eq!(sanitized["decision"]["action"], "continue");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ mod causal_work_identity;
|
|||
mod continuity_gateway;
|
||||
mod coordinator_objective_intake;
|
||||
mod coordinator_results;
|
||||
pub mod coordinator_status;
|
||||
mod cultmesh_integration;
|
||||
mod current_work;
|
||||
mod eyes_gateway;
|
||||
|
|
|
|||
|
|
@ -12,18 +12,17 @@
|
|||
//! or holds the candidate through `RepoFrontierPlanDecisionReceipt`.
|
||||
//! 4. Only an adopted decision may be embedded in `RepoFrontierRoute` by
|
||||
//! `runtime_spine::select_and_commit_repo_frontier_route`. Route selection
|
||||
//! binds the current admitted model revision, admission receipt, frontier
|
||||
//! hash, and repository scope in one compare-and-swap operation.
|
||||
//! binds the exact keyed frontier and decision documents in one atomic
|
||||
//! compare-and-swap operation.
|
||||
//! 5. Hands remains powerless until the coordinator pairs that route with a
|
||||
//! reviewed Hands intent, Substrate Gate receipt, and
|
||||
//! `RepoFrontierHandsAuthority`. Hands receipts describe consequences; they
|
||||
//! do not admit durable Mind state.
|
||||
//! 6. Soul verifies the exact route and consequence. Coordinator acceptance
|
||||
//! applies reviewed state effects through the atomic coordinator state
|
||||
//! transaction; no worker, Hands receipt, or status projection is a second
|
||||
//! admission owner.
|
||||
//! 6. Soul verifies the exact route and consequence. The concrete family
|
||||
//! admission owner commits its keyed documents and receipt through Mind CAS;
|
||||
//! no worker, Hands receipt, coordinator display, or event is a second owner.
|
||||
//! 7. Hands refusal terminates in `RepoFrontierRelinquishmentReceipt`, while
|
||||
//! Continuity receipts preserve recovery facts. `epiphany-mvp-status` and
|
||||
//! Continuity receipts preserve recovery facts. Coordinator status and
|
||||
//! CultMesh surfaces only project these admitted outcomes.
|
||||
//!
|
||||
//! If a required identity or authority is absent at any step, the chain stops.
|
||||
|
|
|
|||
|
|
@ -114,7 +114,6 @@ pub fn required_packaged_release_binaries(target_triple: &str) -> Vec<(&'static
|
|||
file_name("epiphany-persona-discord-permit-identity"),
|
||||
),
|
||||
("coordinator", file_name("epiphany-mvp-coordinator")),
|
||||
("coordinator-status", file_name("epiphany-mvp-status")),
|
||||
("frontier-proposal", file_name("epiphany-frontier-proposal")),
|
||||
("hands-action", file_name("epiphany-hands-action")),
|
||||
("model-runtime", file_name("epiphany-model-runtime")),
|
||||
|
|
@ -1176,10 +1175,6 @@ mod tests {
|
|||
args.windows(2)
|
||||
.any(|pair| pair == ["--bin", "epiphany-mvp-coordinator"])
|
||||
);
|
||||
assert!(
|
||||
args.windows(2)
|
||||
.any(|pair| pair == ["--bin", "epiphany-mvp-status"])
|
||||
);
|
||||
assert!(
|
||||
args.windows(2)
|
||||
.any(|pair| pair == ["--bin", "epiphany-state"])
|
||||
|
|
|
|||
Reference in a new issue