From 2438b25dab0525043b60d1a6417daa2b7088072c Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 27 May 2026 21:32:29 +0100 Subject: [PATCH] Add native MVP status source --- epiphany-core/src/bin/epiphany-mvp-status.rs | 420 +++++++++++++++++-- epiphany-core/src/surfaces/coordinator.rs | 3 +- epiphany-core/src/surfaces/planning.rs | 11 +- epiphany-core/src/surfaces/scene.rs | 38 +- notes/fresh-workspace-handoff.md | 3 +- state/ledgers.msgpack | Bin 155241 -> 155566 bytes state/map.yaml | 11 +- tools/epiphany_local_run.ps1 | 44 +- 8 files changed, 468 insertions(+), 62 deletions(-) diff --git a/epiphany-core/src/bin/epiphany-mvp-status.rs b/epiphany-core/src/bin/epiphany-mvp-status.rs index 8c3235a7..49ef51c0 100644 --- a/epiphany-core/src/bin/epiphany-mvp-status.rs +++ b/epiphany-core/src/bin/epiphany-mvp-status.rs @@ -1,6 +1,34 @@ use anyhow::Context; use anyhow::Result; use anyhow::anyhow; +use epiphany_core::EpiphanyCoordinatorRoleResultStatus; +use epiphany_core::EpiphanyCoordinatorStatusInput; +use epiphany_core::EpiphanyCrrcInput; +use epiphany_core::EpiphanyCrrcReorientAction; +use epiphany_core::EpiphanyCrrcResultStatus; +use epiphany_core::EpiphanyCrrcStateStatus; +use epiphany_core::EpiphanyJobsInput; +use epiphany_core::EpiphanyReorientAction; +use epiphany_core::EpiphanyReorientFreshnessStatus; +use epiphany_core::EpiphanyReorientInput; +use epiphany_core::EpiphanyReorientPressureLevel; +use epiphany_core::EpiphanyRoleBoardCheckpointSummary; +use epiphany_core::EpiphanyRoleBoardInput; +use epiphany_core::EpiphanyRoleBoardJob; +use epiphany_core::EpiphanyRoleBoardJobStatus; +use epiphany_core::EpiphanyRoleBoardPlanningSummary; +use epiphany_core::EpiphanySceneInput; +use epiphany_core::EpiphanyTokenUsageSnapshot; +use epiphany_core::derive_coordinator_finding_signals; +use epiphany_core::derive_coordinator_status; +use epiphany_core::derive_jobs; +use epiphany_core::derive_planning_view; +use epiphany_core::derive_pressure_view; +use epiphany_core::derive_role_board; +use epiphany_core::derive_scene; +use epiphany_core::load_thread_state_entry; +use epiphany_core::recommend_crrc_action; +use epiphany_core::recommend_reorientation; use serde_json::Value; use serde_json::json; use std::env; @@ -19,6 +47,11 @@ use std::time::{Duration, Instant}; const DEFAULT_APP_SERVER: &str = r"C:\Users\Meta\.cargo-target-codex\debug\codex-app-server.exe"; const DEFAULT_CARGO_TARGET_DIR: &str = r"C:\Users\Meta\.cargo-target-codex"; +const DEFAULT_THREAD_STATE_STORE: &str = "state/thread-state.msgpack"; +const REORIENT_BINDING_ID: &str = "reorient-worker"; +const IMAGINATION_BINDING_ID: &str = "imagination-synthesis-worker"; +const MODELING_BINDING_ID: &str = "modeling-checkpoint-worker"; +const VERIFICATION_BINDING_ID: &str = "verification-review-worker"; const SEALED_DIRECT_THOUGHT_KEYS: &[&str] = &[ "rawResult", "turns", @@ -42,12 +75,16 @@ fn main() -> Result<()> { format!("{}\n", serde_json::to_string_pretty(&status)?), ) .with_context(|| format!("failed to write {}", result.display()))?; - write_transcript_telemetry(&args.transcript, &result.with_extension("telemetry.json"))?; + if args.source == StatusSource::Codex { + write_transcript_telemetry(&args.transcript, &result.with_extension("telemetry.json"))?; + } + } + if args.source == StatusSource::Codex { + write_transcript_telemetry( + &args.transcript, + &args.transcript.with_extension("telemetry.json"), + )?; } - write_transcript_telemetry( - &args.transcript, - &args.transcript.with_extension("telemetry.json"), - )?; if args.json { println!("{}", serde_json::to_string_pretty(&status)?); } else { @@ -56,12 +93,20 @@ fn main() -> Result<()> { Ok(()) } +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +enum StatusSource { + Native, + Codex, +} + #[derive(Debug)] struct Args { + source: StatusSource, app_server: PathBuf, codex_home: PathBuf, thread_id: Option, cwd: PathBuf, + thread_state_store: PathBuf, ephemeral: bool, json: bool, result: Option, @@ -74,12 +119,14 @@ impl Args { let root = env::current_dir().context("failed to resolve current directory")?; let mut args = env::args().skip(1); let mut parsed = Args { + source: StatusSource::Codex, app_server: PathBuf::from(DEFAULT_APP_SERVER), codex_home: env::var_os("CODEX_HOME") .map(PathBuf::from) .unwrap_or_else(|| home_dir().join(".codex")), thread_id: None, cwd: root.clone(), + thread_state_store: PathBuf::from(DEFAULT_THREAD_STATE_STORE), ephemeral: true, json: false, result: None, @@ -92,10 +139,16 @@ impl Args { }; while let Some(arg) = args.next() { match arg.as_str() { + "--source" => parsed.source = take_source(&mut args, "--source")?, + "--native" => parsed.source = StatusSource::Native, + "--codex" => parsed.source = StatusSource::Codex, "--app-server" => parsed.app_server = take_path(&mut args, "--app-server")?, "--codex-home" => parsed.codex_home = take_path(&mut args, "--codex-home")?, "--thread-id" => parsed.thread_id = Some(take_string(&mut args, "--thread-id")?), "--cwd" => parsed.cwd = take_path(&mut args, "--cwd")?, + "--thread-state-store" => { + parsed.thread_state_store = take_path(&mut args, "--thread-state-store")? + } "--ephemeral" => parsed.ephemeral = true, "--no-ephemeral" => parsed.ephemeral = false, "--json" => parsed.json = true, @@ -110,6 +163,255 @@ impl Args { } fn run_status(args: &Args) -> Result { + match args.source { + StatusSource::Native => run_native_status(args), + StatusSource::Codex => run_codex_status(args), + } +} + +fn run_native_status(args: &Args) -> Result { + let cwd = absolute_path(&args.cwd)?; + let store_path = absolute_path(&args.thread_state_store)?; + let state_entry = if store_path.exists() { + load_thread_state_entry(&store_path) + .with_context(|| format!("failed to load {}", store_path.display()))? + } else { + None + }; + let thread_id = args + .thread_id + .clone() + .or_else(|| state_entry.as_ref().map(|entry| entry.thread_id.clone())) + .unwrap_or_else(|| "native-local".to_string()); + let state = state_entry + .as_ref() + .map(|entry| entry.state()) + .transpose() + .context("failed to decode native Epiphany thread state")?; + let state_ref = state.as_ref(); + let loaded = state_ref.is_some(); + + let scene = derive_scene(EpiphanySceneInput { + state: state_ref, + loaded, + reorient_binding_id: REORIENT_BINDING_ID, + }); + let pressure = derive_pressure_view(None::<&EpiphanyTokenUsageSnapshot>); + let reorient_pressure_level = match pressure.level { + epiphany_core::EpiphanyPressureLevel::Unknown => EpiphanyReorientPressureLevel::Unknown, + epiphany_core::EpiphanyPressureLevel::Low => EpiphanyReorientPressureLevel::Low, + epiphany_core::EpiphanyPressureLevel::Elevated => EpiphanyReorientPressureLevel::Medium, + epiphany_core::EpiphanyPressureLevel::High => EpiphanyReorientPressureLevel::High, + epiphany_core::EpiphanyPressureLevel::Critical => EpiphanyReorientPressureLevel::Critical, + }; + let (reorient_state_status, reorient_decision) = + recommend_reorientation(EpiphanyReorientInput { + checkpoint: state_ref.and_then(|state| state.investigation_checkpoint.as_ref()), + state_present: state_ref.is_some(), + pressure_level: reorient_pressure_level, + retrieval_status: EpiphanyReorientFreshnessStatus::Unknown, + retrieval_dirty_paths: Vec::new(), + graph_status: EpiphanyReorientFreshnessStatus::Unknown, + graph_dirty_paths: Vec::new(), + watcher_status: EpiphanyReorientFreshnessStatus::Unknown, + watcher_changed_paths: Vec::new(), + watcher_graph_node_ids: Vec::new(), + active_frontier_node_ids: state_ref + .and_then(|state| state.graph_frontier.as_ref()) + .map(|frontier| frontier.active_node_ids.clone()) + .unwrap_or_default(), + watched_root: Some(cwd.clone()), + }); + let planning = derive_planning_view(state_ref); + let jobs = derive_jobs(EpiphanyJobsInput { + state: state_ref, + retrieval_override: None, + }); + let state_status = if state_ref.is_some() { + EpiphanyCrrcStateStatus::Ready + } else { + EpiphanyCrrcStateStatus::Missing + }; + let reorient_action = match reorient_decision.action { + EpiphanyReorientAction::Resume => EpiphanyCrrcReorientAction::Resume, + EpiphanyReorientAction::Regather => EpiphanyCrrcReorientAction::Regather, + }; + let result_status = EpiphanyCrrcResultStatus::BackendMissing; + let recommendation = recommend_crrc_action(EpiphanyCrrcInput { + loaded, + state_status, + should_prepare_compaction: pressure.should_prepare_compaction, + reorient_action, + result_status, + checkpoint_present: state_ref + .and_then(|state| state.investigation_checkpoint.as_ref()) + .is_some(), + finding_present: false, + finding_accepted: false, + }); + let role_jobs = jobs + .iter() + .map(|job| EpiphanyRoleBoardJob { + id: job.id.clone(), + owner_role: job.owner_role.clone(), + status: role_job_status(job.status), + progress_note: job.progress_note.clone(), + blocking_reason: job.blocking_reason.clone(), + }) + .collect::>(); + let roles = derive_role_board(EpiphanyRoleBoardInput { + state_present: state_ref.is_some(), + planning: EpiphanyRoleBoardPlanningSummary { + capture_count: planning.summary.capture_count as usize, + backlog_item_count: planning.summary.backlog_item_count as usize, + roadmap_stream_count: planning.summary.roadmap_stream_count as usize, + objective_draft_count: planning.summary.objective_draft_count as usize, + }, + checkpoint: state_ref.and_then(|state| { + state.investigation_checkpoint.as_ref().map(|checkpoint| { + EpiphanyRoleBoardCheckpointSummary { + disposition: Some(format!("{:?}", checkpoint.disposition)), + next_action: checkpoint.next_action.clone(), + } + }) + }), + reorient_next_action: reorient_decision.next_action.clone(), + jobs: role_jobs.clone(), + crrc_action: recommendation.action, + crrc_recommended_scene_action: recommendation + .recommended_scene_action + .map(epiphany_core::crrc_scene_action_to_coordinator_scene_action), + crrc_reason: recommendation.reason.clone(), + reorient_decision_action: format!("{:?}", reorient_decision.action), + pressure_level: format!("{:?}", pressure.level), + reorient_result_status: result_status, + reorient_job: role_jobs + .iter() + .find(|job| job.id == REORIENT_BINDING_ID) + .cloned(), + imagination_binding_id: IMAGINATION_BINDING_ID.to_string(), + modeling_binding_id: MODELING_BINDING_ID.to_string(), + verification_binding_id: VERIFICATION_BINDING_ID.to_string(), + reorient_owner_role: "epiphany-reorienter".to_string(), + imagination_owner_role: "epiphany-imagination".to_string(), + }); + let finding_signals = derive_coordinator_finding_signals(state_ref, None, None, None); + let coordinator = derive_coordinator_status(EpiphanyCoordinatorStatusInput { + state_status, + checkpoint_present: state_ref + .and_then(|state| state.investigation_checkpoint.as_ref()) + .is_some(), + pressure: pressure.clone(), + recommendation: recommendation.clone(), + roles: roles.clone(), + reorient_action: reorient_decision.action, + modeling_result_status: EpiphanyCoordinatorRoleResultStatus::BackendMissing, + verification_result_status: EpiphanyCoordinatorRoleResultStatus::BackendMissing, + reorient_result_status: result_status, + modeling_result_accepted: finding_signals.modeling_result_accepted, + modeling_result_reviewable: finding_signals.modeling_result_reviewable, + modeling_result_accepted_after_verification: finding_signals + .modeling_result_accepted_after_verification, + implementation_evidence_after_verification: finding_signals + .implementation_evidence_after_verification, + verification_result_cites_implementation_evidence: finding_signals + .verification_result_cites_implementation_evidence, + verification_result_covers_current_modeling: finding_signals + .verification_result_covers_current_modeling, + verification_result_accepted: finding_signals.verification_result_accepted, + verification_result_allows_implementation: finding_signals + .verification_result_allows_implementation, + verification_result_needs_evidence: finding_signals.verification_result_needs_evidence, + reorient_finding_accepted: finding_signals.reorient_finding_accepted, + }); + let coordinator_json = coordinator_status_json(&coordinator)?; + + let root = env::current_dir().context("failed to resolve current directory")?; + let native_aux = native_auxiliary_status(&root)?; + let status = json!({ + "threadId": thread_id, + "read": { + "source": "native", + "threadStateStore": store_path, + "statePresent": state_ref.is_some(), + }, + "view": { + "source": "native", + "scene": scene, + "pressure": pressure, + "jobs": jobs, + "roles": { + "threadId": thread_id, + "source": "native", + "stateStatus": crrc_state_status_text(state_status), + "roles": roles, + }, + "planning": planning, + "reorient": { + "threadId": thread_id, + "source": "native", + "stateStatus": reorient_state_status, + "decision": reorient_decision, + }, + "crrc": { + "threadId": thread_id, + "source": "native", + "recommendation": recommendation, + }, + "coordinator": coordinator_json, + }, + "scene": { + "threadId": thread_id, + "scene": scene, + }, + "pressure": { + "threadId": thread_id, + "source": "native", + "pressure": pressure, + }, + "reorient": { + "threadId": thread_id, + "source": "native", + "stateStatus": reorient_state_status, + "decision": reorient_decision, + }, + "jobs": { + "threadId": thread_id, + "source": "native", + "jobs": jobs, + }, + "roles": { + "threadId": thread_id, + "source": "native", + "stateStatus": crrc_state_status_text(state_status), + "roles": roles, + }, + "planning": planning, + "roleResults": { + "imagination": native_role_result(IMAGINATION_BINDING_ID), + "modeling": native_role_result(MODELING_BINDING_ID), + "verification": native_role_result(VERIFICATION_BINDING_ID), + }, + "reorientResult": { + "source": "native", + "status": "backendMissing", + "bindingId": REORIENT_BINDING_ID, + "note": "Native status is provider-neutral and does not query model-worker runtime results yet.", + }, + "crrc": { + "threadId": thread_id, + "source": "native", + "recommendation": recommendation, + }, + "coordinator": coordinator_json, + "heartbeat": native_aux.heartbeat, + "face": native_aux.face, + "voidMemory": native_aux.void_memory, + }); + Ok(sanitize_for_operator(status)) +} + +fn run_codex_status(args: &Args) -> Result { let app_server = absolute_path(&args.app_server)?; let codex_home = absolute_path(&args.codex_home)?; let cwd = absolute_path(&args.cwd)?; @@ -199,6 +501,35 @@ fn run_status(args: &Args) -> Result { .cloned() .unwrap_or_else(|| json!(null)); let root = env::current_dir().context("failed to resolve current directory")?; + let native_aux = native_auxiliary_status(&root)?; + let status = json!({ + "threadId": thread_id, + "read": read, + "view": view, + "scene": scene, + "pressure": pressure, + "reorient": reorient, + "jobs": jobs, + "roles": roles, + "planning": planning, + "roleResults": role_results, + "reorientResult": reorient_result, + "crrc": crrc, + "coordinator": coordinator, + "heartbeat": native_aux.heartbeat, + "face": native_aux.face, + "voidMemory": native_aux.void_memory, + }); + Ok(sanitize_for_operator(status)) +} + +struct NativeAuxiliaryStatus { + heartbeat: Value, + face: Value, + void_memory: Value, +} + +fn native_auxiliary_status(root: &Path) -> Result { let heartbeat_dir = root.join(".epiphany-heartbeats"); let face_dir = root.join(".epiphany-face"); let heartbeat = native_json( @@ -237,25 +568,56 @@ fn run_status(args: &Args) -> Result { &["status", "--config", "state/void-memory.toml"], ) .unwrap_or_else(|error| json!({"ok": false, "error": error.to_string()})); - let status = json!({ - "threadId": thread_id, - "read": read, - "view": view, - "scene": scene, - "pressure": pressure, - "reorient": reorient, - "jobs": jobs, - "roles": roles, - "planning": planning, - "roleResults": role_results, - "reorientResult": reorient_result, - "crrc": crrc, - "coordinator": coordinator, - "heartbeat": heartbeat, - "face": face, - "voidMemory": void_memory, - }); - Ok(sanitize_for_operator(status)) + + Ok(NativeAuxiliaryStatus { + heartbeat, + face, + void_memory, + }) +} + +fn native_role_result(binding_id: &str) -> Value { + json!({ + "source": "native", + "status": "backendMissing", + "bindingId": binding_id, + "note": "Native status is provider-neutral and does not query model-worker runtime results yet.", + }) +} + +fn coordinator_status_json(status: &epiphany_core::EpiphanyCoordinatorStatus) -> Result { + let mut value = serde_json::to_value(status).context("failed to encode coordinator status")?; + let decision = value + .get("decision") + .cloned() + .ok_or_else(|| anyhow!("coordinator status encoded without decision"))?; + if let (Value::Object(root), Value::Object(decision)) = (&mut value, decision) { + for (key, item) in decision { + root.entry(key).or_insert(item); + } + } + Ok(value) +} + +fn crrc_state_status_text(status: EpiphanyCrrcStateStatus) -> &'static str { + match status { + EpiphanyCrrcStateStatus::Missing => "missing", + EpiphanyCrrcStateStatus::Ready => "ready", + } +} + +fn role_job_status(status: epiphany_core::EpiphanyJobStatus) -> EpiphanyRoleBoardJobStatus { + match status { + epiphany_core::EpiphanyJobStatus::Idle => EpiphanyRoleBoardJobStatus::Idle, + epiphany_core::EpiphanyJobStatus::Needed => EpiphanyRoleBoardJobStatus::Needed, + epiphany_core::EpiphanyJobStatus::Pending => EpiphanyRoleBoardJobStatus::Pending, + epiphany_core::EpiphanyJobStatus::Running => EpiphanyRoleBoardJobStatus::Running, + epiphany_core::EpiphanyJobStatus::Completed => EpiphanyRoleBoardJobStatus::Completed, + epiphany_core::EpiphanyJobStatus::Failed => EpiphanyRoleBoardJobStatus::Failed, + epiphany_core::EpiphanyJobStatus::Cancelled => EpiphanyRoleBoardJobStatus::Cancelled, + epiphany_core::EpiphanyJobStatus::Blocked => EpiphanyRoleBoardJobStatus::Blocked, + epiphany_core::EpiphanyJobStatus::Unavailable => EpiphanyRoleBoardJobStatus::Unavailable, + } } pub struct AppServerClient { @@ -807,6 +1169,16 @@ fn take_path(args: &mut impl Iterator, name: &str) -> Result, name: &str) -> Result { + match take_string(args, name)?.as_str() { + "native" => Ok(StatusSource::Native), + "codex" => Ok(StatusSource::Codex), + other => Err(anyhow!( + "{name} must be 'native' or 'codex', received {other:?}" + )), + } +} + fn home_dir() -> PathBuf { env::var_os("USERPROFILE") .or_else(|| env::var_os("HOME")) diff --git a/epiphany-core/src/surfaces/coordinator.rs b/epiphany-core/src/surfaces/coordinator.rs index 7e27e1eb..799c0fdb 100644 --- a/epiphany-core/src/surfaces/coordinator.rs +++ b/epiphany-core/src/surfaces/coordinator.rs @@ -172,7 +172,8 @@ pub struct EpiphanyCoordinatorStatusInput { pub reorient_finding_accepted: bool, } -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub struct EpiphanyCoordinatorStatus { pub decision: EpiphanyCoordinatorDecision, pub source_signals: EpiphanyCoordinatorSourceSignals, diff --git a/epiphany-core/src/surfaces/planning.rs b/epiphany-core/src/surfaces/planning.rs index 703bcd49..c123f95c 100644 --- a/epiphany-core/src/surfaces/planning.rs +++ b/epiphany-core/src/surfaces/planning.rs @@ -1,13 +1,17 @@ use epiphany_state_model::EpiphanyPlanningState; use epiphany_state_model::EpiphanyThreadState; +use serde::Deserialize; +use serde::Serialize; -#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub enum EpiphanyPlanningStateStatus { Missing, Ready, } -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub struct EpiphanyPlanningSummary { pub capture_count: u32, pub pending_capture_count: u32, @@ -21,7 +25,8 @@ pub struct EpiphanyPlanningSummary { pub note: String, } -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub struct EpiphanyPlanningView { pub state_status: EpiphanyPlanningStateStatus, pub state_revision: Option, diff --git a/epiphany-core/src/surfaces/scene.rs b/epiphany-core/src/surfaces/scene.rs index 224ce508..fb63fa23 100644 --- a/epiphany-core/src/surfaces/scene.rs +++ b/epiphany-core/src/surfaces/scene.rs @@ -1,24 +1,29 @@ use epiphany_state_model::EpiphanyInvestigationDisposition; use epiphany_state_model::EpiphanyRetrievalStatus; use epiphany_state_model::EpiphanyThreadState; +use serde::Deserialize; +use serde::Serialize; use std::collections::BTreeMap; use std::path::PathBuf; pub const EPIPHANY_SCENE_RECORD_LIMIT: usize = 5; -#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub enum EpiphanySceneStateStatus { Missing, Ready, } -#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub enum EpiphanySceneSource { Stored, Live, } -#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub enum EpiphanySceneAction { Index, Retrieve, @@ -46,7 +51,8 @@ pub enum EpiphanySceneAction { Update, } -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub struct EpiphanySceneSubgoal { pub id: String, pub title: String, @@ -55,13 +61,15 @@ pub struct EpiphanySceneSubgoal { pub active: bool, } -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub struct EpiphanySceneStatusCount { pub status: String, pub count: u32, } -#[derive(Debug, Clone, PartialEq, Eq, Default)] +#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub struct EpiphanySceneGraph { pub architecture_node_count: u32, pub architecture_edge_count: u32, @@ -77,7 +85,8 @@ pub struct EpiphanySceneGraph { pub checkpoint_summary: Option, } -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub struct EpiphanySceneRetrieval { pub workspace_root: PathBuf, pub status: EpiphanyRetrievalStatus, @@ -89,7 +98,8 @@ pub struct EpiphanySceneRetrieval { pub dirty_path_count: u32, } -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub struct EpiphanySceneInvestigationCheckpoint { pub checkpoint_id: String, pub kind: String, @@ -103,13 +113,15 @@ pub struct EpiphanySceneInvestigationCheckpoint { pub evidence_count: u32, } -#[derive(Debug, Clone, PartialEq, Eq, Default)] +#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub struct EpiphanySceneRecords { pub total_count: u32, pub latest: Vec, } -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub struct EpiphanySceneRecord { pub id: String, pub kind: String, @@ -118,7 +130,8 @@ pub struct EpiphanySceneRecord { pub code_ref_count: u32, } -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub struct EpiphanySceneChurn { pub understanding_status: String, pub diff_pressure: String, @@ -127,7 +140,8 @@ pub struct EpiphanySceneChurn { pub unexplained_writes: Option, } -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub struct EpiphanyScene { pub state_status: EpiphanySceneStateStatus, pub source: EpiphanySceneSource, diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index a22f7245..7cbe4fef 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -33,9 +33,10 @@ remembers doctrine; the branch remembers the blade. ## Current Orientation - Do not copy exact branch or HEAD from this note. Run `git status --short --branch` and `git log --oneline -5`. -- The repo now has a one-command local operator path: `.\tools\epiphany_local_run.ps1`. Default mode is `smoke`; it builds the retained Codex app-server compatibility edge, builds native Epiphany operator binaries, runs the coordinator smoke, and writes launcher artifacts under `.epiphany-run/` plus coordinator artifacts under `.epiphany-dogfood/`. Use `-Mode status`, `-Mode plan`, or `-Mode run -MaxSteps 4` for the other current entrypoints; add `-ThreadId ` and `-Workspace ` to inspect or continue an existing thread. `status`, `plan`, and `smoke` do not spend model calls; `run` builds and uses `epiphany-openai-runtime`. +- The repo now has a one-command local operator path: `.\tools\epiphany_local_run.ps1`. Default mode is `smoke`; it builds the retained Codex app-server compatibility edge, builds native Epiphany operator binaries, runs the coordinator smoke, and writes launcher artifacts under `.epiphany-run/` plus coordinator artifacts under `.epiphany-dogfood/`. `-Mode status` is now Epiphany-native: it builds only Epiphany operator binaries, reads `state/thread-state.msgpack` when present, derives status through `epiphany-core`, and does not start or require `codex-app-server`. Use `-Mode plan` or `-Mode run -MaxSteps 4` for the bridge-equipped coordinator entrypoints; add `-ThreadId ` and `-Workspace ` to inspect or continue an existing thread. `status`, `plan`, and `smoke` do not spend model calls; `run` builds and uses `epiphany-openai-runtime`. - Local operator runs now write typed CultMesh intent/receipt documents to `.epiphany-run/cultmesh/operator-runs.ccmp` through `epiphany-operator-run`. The wrapper writes intent before acting and a completion receipt after success; this is the local consent/trace rail, not a hidden scheduler queue. - Status-mode local runs now also write a native CultMesh operator snapshot to `.epiphany-run/cultmesh/operator-snapshots.ccmp` through `epiphany-operator-snapshot`. That snapshot distills the operator-safe MVP status artifact into typed fields such as thread id, state status, coordinator action, CRRC action, reorient action, available actions, and artifact refs; it does not preserve the raw JSON status blob as internal state. +- `epiphany-mvp-status --source native` is the current provider-neutral status boundary. It projects scene, pressure, jobs, roles, planning, reorient, CRRC, and coordinator status from native core surfaces and returns provider/runtime worker results as `backendMissing` placeholders instead of asking Codex for model-worker state. Keep future pluggable model-provider work behind launch/result/runtime documents; do not let provider choice leak into status, prompt authority, scheduler policy, or durable `EpiphanyThreadState`. - The active foundation directive is now `notes/codex-starvation-and-cultnet-liberation-plan.md`. The previous Codex app-server control-plane rebuild made Epiphany less rotten inside Codex, but that is not the destination. Epiphany must become a native CultCache/CultMesh/CultNet runtime while remaining an honest modified Codex-derived backend for subscription auth/model use. Codex should remain relatively vanilla and keep doing Codex things, including useful app-server and streaming bridge affordances, but it must not own Epiphany state, processes, prompts, scheduler decisions, or policy. The bridge handles interop; Codex and Epiphany do not get to rummage around in each other's organs. - `notes/epiphany-cultmesh-dreaming-roadmap.md` is the new concrete design for distributed Epiphany dreaming. The invariant is hard: private state stays local; public dreams are separately authored typed documents distributed through CultMesh/CultNet; foreign dreams are thought weather until a reviewed local adoption receipt digests them. The first code slice should be dream schemas plus a local CultMesh-backed store, not public fanout. - CultMesh is now the preferred Rust abstraction for that local store work. The compile-time Rust substrate is repo-contained: `vendor/cultcache-rs`, `vendor/cultnet-rs`, and `vendor/cultmesh-rs`. The old `E:\Projects\CultLib\crates\*` dependency body is dead in this checkout and must not be revived by accident. Vendored CultCache reads/writes `cultcache.store.v1`, so `state/ledgers.msgpack` and `epiphany-state status` are aligned again. The first integrations are deliberately small: status, Verse policy, global room policy, organ contract policy, native operator status, native operator snapshots, and local operator run intent/receipt round-trip through CultMesh. Use `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-cultmesh-smoke`, `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-cultmesh-status -- smoke --store .\.epiphany-smoke\cultmesh\operator-status.ccmp --runtime-id epiphany-cultmesh-status-smoke`, `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-operator-snapshot -- smoke --store .\.epiphany-smoke\cultmesh\operator-snapshots.ccmp --runtime-id epiphany-operator-snapshot-smoke --snapshot-id smoke-status`, and `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-operator-run -- smoke --store .\.epiphany-smoke\cultmesh\operator-runs.ccmp --runtime-id epiphany-operator-run-smoke --run-id smoke-run` for the focused proofs. Future local dream/status/Verse work should start from CultMesh, not raw CultNet, unless the task is polishing the CultMesh internals themselves. Preserve the three Verse tiers: `epiphany-internal` for private sub-agent typed state, `gamecult-local` for trusted LAN/Yggdrasil-tunnel GameCult sharing, and `epiphany-global` for untrusted public dreams plus topic-specific threaded public rooms for Face posts. diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 7837ef426a32ef9f973742d996d50323e9088f99..cfb856e24885b7c9cedb2f4c59257162e687d7c3 100644 GIT binary patch delta 310 zcmXwzKTE_g7{*N&Iow1=(BYMvBfTD{PzMKbR2)P^K}g&8Y%on?nqIx>1_uX6Ew}pt zL~#&7a1-2}{08EeFk)|g{`{Wj`?Yod)_PbZGu=+q3y$8W=*jg{o17E!aaq%=nv&<5 z($C}B+m|p1*I3YF;rf0UMBUE#ae*$izsUS9cVd9BbFc@6(ap-; z+$J#AsOmqSqV=r;v_Z?Awv%q(>KxDrlW{d