From ed883506427ec659a4f8429018cf7c2218cccbc7 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 13 May 2026 11:04:39 +0100 Subject: [PATCH] Move Epiphany state model out of Codex protocol --- epiphany-core/Cargo.toml | 1 + epiphany-core/src/distillation.rs | 6 +- epiphany-core/src/promotion.rs | 24 +- epiphany-core/src/prompt.rs | 56 +- epiphany-core/src/proposal.rs | 24 +- epiphany-core/src/retrieval.rs | 6 +- epiphany-core/src/rollout.rs | 6 +- epiphany-core/src/runtime_spine.rs | 8 +- epiphany-core/src/state_update.rs | 34 +- epiphany-core/src/surfaces/freshness.rs | 16 +- epiphany-core/src/surfaces/graph_context.rs | 24 +- epiphany-core/src/surfaces/jobs.rs | 16 +- epiphany-core/src/surfaces/planning.rs | 8 +- epiphany-core/src/surfaces/reorient.rs | 6 +- epiphany-core/src/surfaces/role_result.rs | 14 +- epiphany-core/src/surfaces/scene.rs | 14 +- epiphany-core/src/surfaces/state_patch.rs | 30 +- epiphany-core/src/surfaces/worker_launch.rs | 24 +- epiphany-state-model/Cargo.toml | 19 + epiphany-state-model/src/lib.rs | 719 +++++++++++++++++ notes/fresh-workspace-handoff.md | 12 +- state/ledgers.msgpack | Bin 91481 -> 91852 bytes state/map.yaml | 6 +- vendor/codex/codex-rs/Cargo.lock | 11 + vendor/codex/codex-rs/protocol/Cargo.toml | 1 + .../codex/codex-rs/protocol/src/protocol.rs | 737 +----------------- 26 files changed, 959 insertions(+), 863 deletions(-) create mode 100644 epiphany-state-model/Cargo.toml create mode 100644 epiphany-state-model/src/lib.rs diff --git a/epiphany-core/Cargo.toml b/epiphany-core/Cargo.toml index 18394474..ad727b08 100644 --- a/epiphany-core/Cargo.toml +++ b/epiphany-core/Cargo.toml @@ -18,6 +18,7 @@ codex-protocol = { path = "../vendor/codex/codex-rs/protocol" } cultcache-rs = { path = "../vendor/cultcache-rs" } cultnet-rs = { path = "../vendor/cultnet-rs" } epiphany-openai-adapter = { path = "../epiphany-openai-adapter" } +epiphany-state-model = { path = "../epiphany-state-model" } ignore = "0.4.23" postgres = "0.19" reqwest = { version = "0.12", features = ["blocking", "json"] } diff --git a/epiphany-core/src/distillation.rs b/epiphany-core/src/distillation.rs index 351e094a..0ca7347c 100644 --- a/epiphany-core/src/distillation.rs +++ b/epiphany-core/src/distillation.rs @@ -1,8 +1,8 @@ use anyhow::Result; use anyhow::anyhow; -use codex_protocol::protocol::EpiphanyCodeRef; -use codex_protocol::protocol::EpiphanyEvidenceRecord; -use codex_protocol::protocol::EpiphanyObservation; +use epiphany_state_model::EpiphanyCodeRef; +use epiphany_state_model::EpiphanyEvidenceRecord; +use epiphany_state_model::EpiphanyObservation; use sha1::Digest; use sha1::Sha1; diff --git a/epiphany-core/src/promotion.rs b/epiphany-core/src/promotion.rs index 1f8f6915..48885a9d 100644 --- a/epiphany-core/src/promotion.rs +++ b/epiphany-core/src/promotion.rs @@ -1,13 +1,13 @@ -use codex_protocol::protocol::EpiphanyChurnState; -use codex_protocol::protocol::EpiphanyEvidenceRecord; -use codex_protocol::protocol::EpiphanyGraph; -use codex_protocol::protocol::EpiphanyGraphCheckpoint; -use codex_protocol::protocol::EpiphanyGraphFrontier; -use codex_protocol::protocol::EpiphanyGraphs; -use codex_protocol::protocol::EpiphanyInvariant; -use codex_protocol::protocol::EpiphanyInvestigationCheckpoint; -use codex_protocol::protocol::EpiphanyObservation; -use codex_protocol::protocol::EpiphanySubgoal; +use epiphany_state_model::EpiphanyChurnState; +use epiphany_state_model::EpiphanyEvidenceRecord; +use epiphany_state_model::EpiphanyGraph; +use epiphany_state_model::EpiphanyGraphCheckpoint; +use epiphany_state_model::EpiphanyGraphFrontier; +use epiphany_state_model::EpiphanyGraphs; +use epiphany_state_model::EpiphanyInvariant; +use epiphany_state_model::EpiphanyInvestigationCheckpoint; +use epiphany_state_model::EpiphanyObservation; +use epiphany_state_model::EpiphanySubgoal; use std::collections::HashSet; #[derive(Debug, Clone)] @@ -606,8 +606,8 @@ fn is_strong_verifier_kind(kind: &str) -> bool { #[cfg(test)] mod tests { use super::*; - use codex_protocol::protocol::EpiphanyGraphEdge; - use codex_protocol::protocol::EpiphanyGraphNode; + use epiphany_state_model::EpiphanyGraphEdge; + use epiphany_state_model::EpiphanyGraphNode; fn verifier(status: &str) -> EpiphanyEvidenceRecord { EpiphanyEvidenceRecord { diff --git a/epiphany-core/src/prompt.rs b/epiphany-core/src/prompt.rs index fdbec5b0..cc420dc9 100644 --- a/epiphany-core/src/prompt.rs +++ b/epiphany-core/src/prompt.rs @@ -1,19 +1,19 @@ -use codex_protocol::protocol::EpiphanyChurnState; -use codex_protocol::protocol::EpiphanyCodeRef; -use codex_protocol::protocol::EpiphanyEvidenceRecord; -use codex_protocol::protocol::EpiphanyGraph; -use codex_protocol::protocol::EpiphanyGraphCheckpoint; -use codex_protocol::protocol::EpiphanyGraphEdge; -use codex_protocol::protocol::EpiphanyGraphFrontier; -use codex_protocol::protocol::EpiphanyGraphLink; -use codex_protocol::protocol::EpiphanyGraphNode; -use codex_protocol::protocol::EpiphanyInvestigationCheckpoint; -use codex_protocol::protocol::EpiphanyInvestigationDisposition; -use codex_protocol::protocol::EpiphanyModeState; -use codex_protocol::protocol::EpiphanyObservation; -use codex_protocol::protocol::EpiphanyPlanningState; -use codex_protocol::protocol::EpiphanyScratchPad; -use codex_protocol::protocol::EpiphanyThreadState; +use epiphany_state_model::EpiphanyChurnState; +use epiphany_state_model::EpiphanyCodeRef; +use epiphany_state_model::EpiphanyEvidenceRecord; +use epiphany_state_model::EpiphanyGraph; +use epiphany_state_model::EpiphanyGraphCheckpoint; +use epiphany_state_model::EpiphanyGraphEdge; +use epiphany_state_model::EpiphanyGraphFrontier; +use epiphany_state_model::EpiphanyGraphLink; +use epiphany_state_model::EpiphanyGraphNode; +use epiphany_state_model::EpiphanyInvestigationCheckpoint; +use epiphany_state_model::EpiphanyInvestigationDisposition; +use epiphany_state_model::EpiphanyModeState; +use epiphany_state_model::EpiphanyObservation; +use epiphany_state_model::EpiphanyPlanningState; +use epiphany_state_model::EpiphanyScratchPad; +use epiphany_state_model::EpiphanyThreadState; use std::collections::HashSet; use std::path::Path; @@ -799,18 +799,18 @@ fn push_omitted_count(lines: &mut Vec, total: usize, shown: usize, label mod tests { use super::render_epiphany_state; use codex_protocol::config_types::ModeKind; - use codex_protocol::protocol::EpiphanyChurnState; - use codex_protocol::protocol::EpiphanyCodeRef; - use codex_protocol::protocol::EpiphanyGraph; - use codex_protocol::protocol::EpiphanyGraphCheckpoint; - use codex_protocol::protocol::EpiphanyGraphEdge; - use codex_protocol::protocol::EpiphanyGraphFrontier; - use codex_protocol::protocol::EpiphanyGraphNode; - use codex_protocol::protocol::EpiphanyGraphs; - use codex_protocol::protocol::EpiphanyInvestigationCheckpoint; - use codex_protocol::protocol::EpiphanyInvestigationDisposition; - use codex_protocol::protocol::EpiphanyModeState; - use codex_protocol::protocol::EpiphanyThreadState; + use epiphany_state_model::EpiphanyChurnState; + use epiphany_state_model::EpiphanyCodeRef; + use epiphany_state_model::EpiphanyGraph; + use epiphany_state_model::EpiphanyGraphCheckpoint; + use epiphany_state_model::EpiphanyGraphEdge; + use epiphany_state_model::EpiphanyGraphFrontier; + use epiphany_state_model::EpiphanyGraphNode; + use epiphany_state_model::EpiphanyGraphs; + use epiphany_state_model::EpiphanyInvestigationCheckpoint; + use epiphany_state_model::EpiphanyInvestigationDisposition; + use epiphany_state_model::EpiphanyModeState; + use epiphany_state_model::EpiphanyThreadState; use std::path::PathBuf; #[test] diff --git a/epiphany-core/src/proposal.rs b/epiphany-core/src/proposal.rs index ad8ee045..41920c69 100644 --- a/epiphany-core/src/proposal.rs +++ b/epiphany-core/src/proposal.rs @@ -1,14 +1,14 @@ use anyhow::Result; use anyhow::anyhow; -use codex_protocol::protocol::EpiphanyChurnState; -use codex_protocol::protocol::EpiphanyCodeRef; -use codex_protocol::protocol::EpiphanyEvidenceRecord; -use codex_protocol::protocol::EpiphanyGraphEdge; -use codex_protocol::protocol::EpiphanyGraphFrontier; -use codex_protocol::protocol::EpiphanyGraphNode; -use codex_protocol::protocol::EpiphanyGraphs; -use codex_protocol::protocol::EpiphanyObservation; -use codex_protocol::protocol::EpiphanyThreadState; +use epiphany_state_model::EpiphanyChurnState; +use epiphany_state_model::EpiphanyCodeRef; +use epiphany_state_model::EpiphanyEvidenceRecord; +use epiphany_state_model::EpiphanyGraphEdge; +use epiphany_state_model::EpiphanyGraphFrontier; +use epiphany_state_model::EpiphanyGraphNode; +use epiphany_state_model::EpiphanyGraphs; +use epiphany_state_model::EpiphanyObservation; +use epiphany_state_model::EpiphanyThreadState; use sha1::Digest; use sha1::Sha1; use std::collections::HashSet; @@ -1121,9 +1121,9 @@ mod tests { use super::*; use crate::promotion::EpiphanyPromotionInput; use crate::promotion::evaluate_promotion; - use codex_protocol::protocol::EpiphanyGraph; - use codex_protocol::protocol::EpiphanyGraphEdge; - use codex_protocol::protocol::EpiphanyGraphLink; + use epiphany_state_model::EpiphanyGraph; + use epiphany_state_model::EpiphanyGraphEdge; + use epiphany_state_model::EpiphanyGraphLink; fn code_ref(path: &str) -> EpiphanyCodeRef { EpiphanyCodeRef { diff --git a/epiphany-core/src/retrieval.rs b/epiphany-core/src/retrieval.rs index 4f10b12a..cb57d5a3 100644 --- a/epiphany-core/src/retrieval.rs +++ b/epiphany-core/src/retrieval.rs @@ -4,9 +4,9 @@ use bm25::Document; use bm25::Language; use bm25::SearchEngineBuilder; use codex_file_search as file_search; -use codex_protocol::protocol::EpiphanyRetrievalShardSummary; -use codex_protocol::protocol::EpiphanyRetrievalState; -use codex_protocol::protocol::EpiphanyRetrievalStatus; +use epiphany_state_model::EpiphanyRetrievalShardSummary; +use epiphany_state_model::EpiphanyRetrievalState; +use epiphany_state_model::EpiphanyRetrievalStatus; use ignore::WalkBuilder; use reqwest::StatusCode; use reqwest::blocking::Client; diff --git a/epiphany-core/src/rollout.rs b/epiphany-core/src/rollout.rs index dd4e2331..05f0c3e0 100644 --- a/epiphany-core/src/rollout.rs +++ b/epiphany-core/src/rollout.rs @@ -1,7 +1,7 @@ use codex_protocol::models::ResponseItem; -use codex_protocol::protocol::EpiphanyThreadState; use codex_protocol::protocol::EventMsg; use codex_protocol::protocol::RolloutItem; +use epiphany_state_model::EpiphanyThreadState; #[derive(Debug, Default)] struct ActiveEpiphanyReplaySegment { @@ -159,14 +159,14 @@ mod tests { use codex_protocol::models::ContentItem; use codex_protocol::models::ResponseItem; use codex_protocol::protocol::CompactedItem; - use codex_protocol::protocol::EpiphanyStateItem; - use codex_protocol::protocol::EpiphanyThreadState; use codex_protocol::protocol::EventMsg; use codex_protocol::protocol::RolloutItem; use codex_protocol::protocol::ThreadRolledBackEvent; use codex_protocol::protocol::TurnCompleteEvent; use codex_protocol::protocol::TurnStartedEvent; use codex_protocol::protocol::UserMessageEvent; + use epiphany_state_model::EpiphanyStateItem; + use epiphany_state_model::EpiphanyThreadState; fn simple_is_user_turn_boundary(item: &ResponseItem) -> bool { matches!( diff --git a/epiphany-core/src/runtime_spine.rs b/epiphany-core/src/runtime_spine.rs index 07d05c51..6aaa513f 100644 --- a/epiphany-core/src/runtime_spine.rs +++ b/epiphany-core/src/runtime_spine.rs @@ -7,10 +7,6 @@ use crate::state_ledger::STATE_LEDGER_STORE_TYPE; use anyhow::Context; use anyhow::Result; use anyhow::anyhow; -use codex_protocol::protocol::EpiphanyJobBinding; -use codex_protocol::protocol::EpiphanyJobKind; -use codex_protocol::protocol::EpiphanyRuntimeLink; -use codex_protocol::protocol::EpiphanyThreadState; use cultcache_rs::CultCache; use cultcache_rs::DatabaseEntry; use cultcache_rs::SingleFileMessagePackBackingStore; @@ -29,6 +25,10 @@ use epiphany_openai_adapter::EpiphanyOpenAiAdapterStatus; use epiphany_openai_adapter::EpiphanyOpenAiModelReceipt; use epiphany_openai_adapter::EpiphanyOpenAiModelRequest; use epiphany_openai_adapter::EpiphanyOpenAiStreamEvent; +use epiphany_state_model::EpiphanyJobBinding; +use epiphany_state_model::EpiphanyJobKind; +use epiphany_state_model::EpiphanyRuntimeLink; +use epiphany_state_model::EpiphanyThreadState; use serde::Deserialize; use serde::Serialize; use std::collections::BTreeMap; diff --git a/epiphany-core/src/state_update.rs b/epiphany-core/src/state_update.rs index 0a7ac639..7f4e7f13 100644 --- a/epiphany-core/src/state_update.rs +++ b/epiphany-core/src/state_update.rs @@ -1,22 +1,22 @@ use crate::EpiphanyStateReplacementValidationInput; use crate::validate_state_replacement_patch; -use codex_protocol::protocol::EpiphanyAcceptanceReceipt; -use codex_protocol::protocol::EpiphanyChurnState; -use codex_protocol::protocol::EpiphanyEvidenceRecord; -use codex_protocol::protocol::EpiphanyGraphCheckpoint; -use codex_protocol::protocol::EpiphanyGraphFrontier; -use codex_protocol::protocol::EpiphanyGraphs; -use codex_protocol::protocol::EpiphanyInvariant; -use codex_protocol::protocol::EpiphanyInvestigationCheckpoint; -use codex_protocol::protocol::EpiphanyJobBinding; -use codex_protocol::protocol::EpiphanyModeState; -use codex_protocol::protocol::EpiphanyObservation; -use codex_protocol::protocol::EpiphanyPlanningState; -use codex_protocol::protocol::EpiphanyPlanningSourceRef; -use codex_protocol::protocol::EpiphanyRuntimeLink; -use codex_protocol::protocol::EpiphanyScratchPad; -use codex_protocol::protocol::EpiphanySubgoal; -use codex_protocol::protocol::EpiphanyThreadState; +use epiphany_state_model::EpiphanyAcceptanceReceipt; +use epiphany_state_model::EpiphanyChurnState; +use epiphany_state_model::EpiphanyEvidenceRecord; +use epiphany_state_model::EpiphanyGraphCheckpoint; +use epiphany_state_model::EpiphanyGraphFrontier; +use epiphany_state_model::EpiphanyGraphs; +use epiphany_state_model::EpiphanyInvariant; +use epiphany_state_model::EpiphanyInvestigationCheckpoint; +use epiphany_state_model::EpiphanyJobBinding; +use epiphany_state_model::EpiphanyModeState; +use epiphany_state_model::EpiphanyObservation; +use epiphany_state_model::EpiphanyPlanningSourceRef; +use epiphany_state_model::EpiphanyPlanningState; +use epiphany_state_model::EpiphanyRuntimeLink; +use epiphany_state_model::EpiphanyScratchPad; +use epiphany_state_model::EpiphanySubgoal; +use epiphany_state_model::EpiphanyThreadState; use std::collections::HashSet; #[derive(Debug, Clone, Default)] diff --git a/epiphany-core/src/surfaces/freshness.rs b/epiphany-core/src/surfaces/freshness.rs index f22b52e9..c1e003ff 100644 --- a/epiphany-core/src/surfaces/freshness.rs +++ b/epiphany-core/src/surfaces/freshness.rs @@ -1,6 +1,6 @@ -use codex_protocol::protocol::EpiphanyRetrievalState; -use codex_protocol::protocol::EpiphanyRetrievalStatus; -use codex_protocol::protocol::EpiphanyThreadState; +use epiphany_state_model::EpiphanyRetrievalState; +use epiphany_state_model::EpiphanyRetrievalStatus; +use epiphany_state_model::EpiphanyThreadState; use std::collections::HashSet; use std::path::Path; use std::path::PathBuf; @@ -374,10 +374,10 @@ fn epiphany_path_key(path: &Path) -> String { #[cfg(test)] mod tests { use super::*; - use codex_protocol::protocol::EpiphanyCodeRef; - use codex_protocol::protocol::EpiphanyGraphFrontier; - use codex_protocol::protocol::EpiphanyGraphNode; - use codex_protocol::protocol::EpiphanyGraphs; + use epiphany_state_model::EpiphanyCodeRef; + use epiphany_state_model::EpiphanyGraphFrontier; + use epiphany_state_model::EpiphanyGraphNode; + use epiphany_state_model::EpiphanyGraphs; #[test] fn missing_state_reports_missing_freshness() { @@ -440,7 +440,7 @@ mod tests { ..Default::default() }), graphs: EpiphanyGraphs { - architecture: codex_protocol::protocol::EpiphanyGraph { + architecture: epiphany_state_model::EpiphanyGraph { nodes: vec![EpiphanyGraphNode { id: "node-1".to_string(), title: "node".to_string(), diff --git a/epiphany-core/src/surfaces/graph_context.rs b/epiphany-core/src/surfaces/graph_context.rs index 13235a5e..d6cca172 100644 --- a/epiphany-core/src/surfaces/graph_context.rs +++ b/epiphany-core/src/surfaces/graph_context.rs @@ -1,13 +1,13 @@ -use codex_protocol::protocol::EpiphanyCodeRef; -use codex_protocol::protocol::EpiphanyEvidenceRecord; -use codex_protocol::protocol::EpiphanyGraphCheckpoint; -use codex_protocol::protocol::EpiphanyGraphEdge; -use codex_protocol::protocol::EpiphanyGraphFrontier; -use codex_protocol::protocol::EpiphanyGraphLink; -use codex_protocol::protocol::EpiphanyGraphNode; -use codex_protocol::protocol::EpiphanyInvestigationCheckpoint; -use codex_protocol::protocol::EpiphanyObservation; -use codex_protocol::protocol::EpiphanyThreadState; +use epiphany_state_model::EpiphanyCodeRef; +use epiphany_state_model::EpiphanyEvidenceRecord; +use epiphany_state_model::EpiphanyGraphCheckpoint; +use epiphany_state_model::EpiphanyGraphEdge; +use epiphany_state_model::EpiphanyGraphFrontier; +use epiphany_state_model::EpiphanyGraphLink; +use epiphany_state_model::EpiphanyGraphNode; +use epiphany_state_model::EpiphanyInvestigationCheckpoint; +use epiphany_state_model::EpiphanyObservation; +use epiphany_state_model::EpiphanyThreadState; use std::collections::HashSet; use std::path::PathBuf; @@ -648,8 +648,8 @@ mod tests { fn graph_state() -> EpiphanyThreadState { EpiphanyThreadState { revision: 9, - graphs: codex_protocol::protocol::EpiphanyGraphs { - architecture: codex_protocol::protocol::EpiphanyGraph { + graphs: epiphany_state_model::EpiphanyGraphs { + architecture: epiphany_state_model::EpiphanyGraph { nodes: vec![ EpiphanyGraphNode { id: "a".to_string(), diff --git a/epiphany-core/src/surfaces/jobs.rs b/epiphany-core/src/surfaces/jobs.rs index ab46d1f4..ea0828af 100644 --- a/epiphany-core/src/surfaces/jobs.rs +++ b/epiphany-core/src/surfaces/jobs.rs @@ -1,9 +1,9 @@ -use codex_protocol::protocol::EpiphanyJobBinding; -use codex_protocol::protocol::EpiphanyJobKind; -use codex_protocol::protocol::EpiphanyRetrievalState; -use codex_protocol::protocol::EpiphanyRetrievalStatus; -use codex_protocol::protocol::EpiphanyRuntimeLink; -use codex_protocol::protocol::EpiphanyThreadState; +use epiphany_state_model::EpiphanyJobBinding; +use epiphany_state_model::EpiphanyJobKind; +use epiphany_state_model::EpiphanyRetrievalState; +use epiphany_state_model::EpiphanyRetrievalStatus; +use epiphany_state_model::EpiphanyRuntimeLink; +use epiphany_state_model::EpiphanyThreadState; #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum EpiphanyJobStatus { @@ -375,8 +375,8 @@ fn latest_runtime_link_for_binding<'a>( #[cfg(test)] mod tests { use super::*; - use codex_protocol::protocol::EpiphanyGraphFrontier; - use codex_protocol::protocol::EpiphanyInvariant; + use epiphany_state_model::EpiphanyGraphFrontier; + use epiphany_state_model::EpiphanyInvariant; use std::path::PathBuf; #[test] diff --git a/epiphany-core/src/surfaces/planning.rs b/epiphany-core/src/surfaces/planning.rs index b85105e9..703bcd49 100644 --- a/epiphany-core/src/surfaces/planning.rs +++ b/epiphany-core/src/surfaces/planning.rs @@ -1,5 +1,5 @@ -use codex_protocol::protocol::EpiphanyPlanningState; -use codex_protocol::protocol::EpiphanyThreadState; +use epiphany_state_model::EpiphanyPlanningState; +use epiphany_state_model::EpiphanyThreadState; #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum EpiphanyPlanningStateStatus { @@ -100,8 +100,8 @@ pub fn derive_planning_view(state: Option<&EpiphanyThreadState>) -> EpiphanyPlan #[cfg(test)] mod tests { use super::*; - use codex_protocol::protocol::EpiphanyPlanningCapture; - use codex_protocol::protocol::EpiphanyPlanningSourceRef; + use epiphany_state_model::EpiphanyPlanningCapture; + use epiphany_state_model::EpiphanyPlanningSourceRef; #[test] fn missing_state_returns_empty_planning() { diff --git a/epiphany-core/src/surfaces/reorient.rs b/epiphany-core/src/surfaces/reorient.rs index 59a33761..462e1d42 100644 --- a/epiphany-core/src/surfaces/reorient.rs +++ b/epiphany-core/src/surfaces/reorient.rs @@ -1,5 +1,5 @@ -use codex_protocol::protocol::EpiphanyInvestigationCheckpoint; -use codex_protocol::protocol::EpiphanyInvestigationDisposition; +use epiphany_state_model::EpiphanyInvestigationCheckpoint; +use epiphany_state_model::EpiphanyInvestigationDisposition; use std::collections::HashSet; use std::path::Path; use std::path::PathBuf; @@ -336,7 +336,7 @@ fn epiphany_path_key(path: &Path) -> String { #[cfg(test)] mod tests { use super::*; - use codex_protocol::protocol::EpiphanyCodeRef; + use epiphany_state_model::EpiphanyCodeRef; fn checkpoint() -> EpiphanyInvestigationCheckpoint { EpiphanyInvestigationCheckpoint { diff --git a/epiphany-core/src/surfaces/role_result.rs b/epiphany-core/src/surfaces/role_result.rs index cdb62f19..a14dbaf0 100644 --- a/epiphany-core/src/surfaces/role_result.rs +++ b/epiphany-core/src/surfaces/role_result.rs @@ -1228,11 +1228,11 @@ use crate::agent_memory::AgentSelfPatch; use crate::agent_memory::decode_agent_self_patch; use crate::agent_memory::review_agent_self_patch_contract; use crate::runtime_spine::EpiphanyRuntimeJobResult; -use codex_protocol::protocol::EpiphanyAcceptanceReceipt; -use codex_protocol::protocol::EpiphanyCodeRef; -use codex_protocol::protocol::EpiphanyEvidenceRecord; -use codex_protocol::protocol::EpiphanyInvestigationCheckpoint; -use codex_protocol::protocol::EpiphanyInvestigationDisposition; -use codex_protocol::protocol::EpiphanyObservation; -use codex_protocol::protocol::EpiphanyScratchPad; +use epiphany_state_model::EpiphanyAcceptanceReceipt; +use epiphany_state_model::EpiphanyCodeRef; +use epiphany_state_model::EpiphanyEvidenceRecord; +use epiphany_state_model::EpiphanyInvestigationCheckpoint; +use epiphany_state_model::EpiphanyInvestigationDisposition; +use epiphany_state_model::EpiphanyObservation; +use epiphany_state_model::EpiphanyScratchPad; use std::path::PathBuf; diff --git a/epiphany-core/src/surfaces/scene.rs b/epiphany-core/src/surfaces/scene.rs index b91bc228..224ce508 100644 --- a/epiphany-core/src/surfaces/scene.rs +++ b/epiphany-core/src/surfaces/scene.rs @@ -1,6 +1,6 @@ -use codex_protocol::protocol::EpiphanyInvestigationDisposition; -use codex_protocol::protocol::EpiphanyRetrievalStatus; -use codex_protocol::protocol::EpiphanyThreadState; +use epiphany_state_model::EpiphanyInvestigationDisposition; +use epiphany_state_model::EpiphanyRetrievalStatus; +use epiphany_state_model::EpiphanyThreadState; use std::collections::BTreeMap; use std::path::PathBuf; @@ -376,10 +376,10 @@ fn status_counts<'a>(statuses: impl Iterator) -> Vec, + pub state: EpiphanyThreadState, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] +pub struct EpiphanyThreadState { + pub revision: u64, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub objective: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub active_subgoal_id: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub subgoals: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub invariants: Vec, + #[serde(default, skip_serializing_if = "EpiphanyGraphs::is_empty")] + #[ts(type = "EpiphanyGraphs")] + pub graphs: EpiphanyGraphs, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "EpiphanyGraphFrontier | null")] + pub graph_frontier: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "EpiphanyGraphCheckpoint | null")] + pub graph_checkpoint: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "EpiphanyRetrievalState | null")] + pub retrieval: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "EpiphanyScratchPad | null")] + pub scratch: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "EpiphanyInvestigationCheckpoint | null")] + pub investigation_checkpoint: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub job_bindings: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub acceptance_receipts: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub runtime_links: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub observations: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub recent_evidence: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "EpiphanyChurnState | null")] + pub churn: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "EpiphanyModeState | null")] + pub mode: Option, + #[serde(default, skip_serializing_if = "EpiphanyPlanningState::is_empty")] + #[ts(type = "EpiphanyPlanningState")] + pub planning: EpiphanyPlanningState, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub last_updated_turn_id: Option, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] +pub struct EpiphanyAcceptanceReceipt { + pub id: String, + pub result_id: String, + pub job_id: String, + pub binding_id: String, + pub surface: String, + pub role_id: String, + pub status: String, + pub accepted_at: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub accepted_observation_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub accepted_evidence_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub summary: Option, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] +pub struct EpiphanyRuntimeLink { + pub id: String, + pub binding_id: String, + pub surface: String, + pub role_id: String, + pub authority_scope: String, + pub runtime_job_id: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub runtime_result_id: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub linked_subgoal_ids: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub linked_graph_node_ids: Vec, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] +pub struct EpiphanySubgoal { + pub id: String, + pub title: String, + pub status: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub summary: Option, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] +pub struct EpiphanyInvariant { + pub id: String, + pub description: String, + pub status: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub rationale: Option, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] +pub struct EpiphanyGraphs { + #[serde(default, skip_serializing_if = "EpiphanyGraph::is_empty")] + pub architecture: EpiphanyGraph, + #[serde(default, skip_serializing_if = "EpiphanyGraph::is_empty")] + pub dataflow: EpiphanyGraph, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub links: Vec, +} + +impl EpiphanyGraphs { + pub fn is_empty(&self) -> bool { + self.architecture.is_empty() && self.dataflow.is_empty() && self.links.is_empty() + } +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] +pub struct EpiphanyGraph { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub nodes: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub edges: Vec, +} + +impl EpiphanyGraph { + pub fn is_empty(&self) -> bool { + self.nodes.is_empty() && self.edges.is_empty() + } +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] +pub struct EpiphanyGraphNode { + pub id: String, + pub title: String, + pub purpose: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub mechanism: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub metaphor: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub status: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub code_refs: Vec, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] +pub struct EpiphanyGraphEdge { + pub source_id: String, + pub target_id: String, + pub kind: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub label: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub mechanism: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub code_refs: Vec, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] +pub struct EpiphanyGraphLink { + pub dataflow_node_id: String, + pub architecture_node_id: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub relationship: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub code_refs: Vec, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] +pub struct EpiphanyCodeRef { + pub path: PathBuf, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "number | null")] + pub start_line: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "number | null")] + pub end_line: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub symbol: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub note: Option, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] +pub struct EpiphanyGraphFrontier { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub active_node_ids: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub active_edge_ids: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub open_question_ids: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub open_gap_ids: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub dirty_paths: Vec, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] +pub struct EpiphanyGraphCheckpoint { + pub checkpoint_id: String, + pub graph_revision: u64, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub summary: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub frontier_node_ids: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub open_question_ids: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub open_gap_ids: Vec, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] +pub struct EpiphanyRetrievalState { + pub workspace_root: PathBuf, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub index_revision: Option, + #[serde(default)] + pub status: EpiphanyRetrievalStatus, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + #[ts(type = "boolean")] + pub semantic_available: bool, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "bigint | null")] + pub last_indexed_at_unix_seconds: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "number | null")] + pub indexed_file_count: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "number | null")] + pub indexed_chunk_count: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub shards: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub dirty_paths: Vec, +} + +#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialEq, Eq, JsonSchema, TS, Default)] +#[serde(rename_all = "snake_case")] +#[ts(rename_all = "snake_case")] +pub enum EpiphanyRetrievalStatus { + #[default] + Unavailable, + Ready, + Stale, + Indexing, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] +pub struct EpiphanyRetrievalShardSummary { + pub shard_id: String, + pub path_prefix: PathBuf, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "number | null")] + pub indexed_file_count: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "number | null")] + pub indexed_chunk_count: Option, + #[serde(default)] + pub status: EpiphanyRetrievalStatus, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + #[ts(type = "boolean")] + pub exact_available: bool, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + #[ts(type = "boolean")] + pub semantic_available: bool, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] +pub struct EpiphanyScratchPad { + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub summary: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub hypothesis: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub next_probe: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub notes: Vec, +} + +#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialEq, Eq, JsonSchema, TS, Default)] +#[serde(rename_all = "snake_case")] +#[ts(rename_all = "snake_case")] +pub enum EpiphanyInvestigationDisposition { + #[default] + ResumeReady, + RegatherRequired, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] +pub struct EpiphanyInvestigationCheckpoint { + pub checkpoint_id: String, + pub kind: String, + pub disposition: EpiphanyInvestigationDisposition, + pub focus: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub summary: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub next_action: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub captured_at_turn_id: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub open_questions: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub code_refs: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub evidence_ids: Vec, +} + +#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialEq, Eq, JsonSchema, TS)] +#[serde(rename_all = "snake_case")] +#[ts(rename_all = "snake_case")] +pub enum EpiphanyJobKind { + Indexing, + Remap, + Verification, + Specialist, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS)] +pub struct EpiphanyJobBinding { + pub id: String, + pub kind: EpiphanyJobKind, + pub scope: String, + pub owner_role: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub authority_scope: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub linked_subgoal_ids: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub linked_graph_node_ids: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub blocking_reason: Option, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] +pub struct EpiphanyObservation { + pub id: String, + pub summary: String, + pub source_kind: String, + pub status: String, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub code_refs: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub evidence_ids: Vec, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] +pub struct EpiphanyEvidenceRecord { + pub id: String, + pub kind: String, + pub status: String, + pub summary: String, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub code_refs: Vec, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] +pub struct EpiphanyChurnState { + pub understanding_status: String, + pub diff_pressure: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub graph_freshness: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub warning: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "number | null")] + pub unexplained_writes: Option, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] +pub struct EpiphanyModeState { + pub name: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "ModeKind | null")] + pub kind: Option, +} + +#[derive( + Serialize, Deserialize, Clone, Copy, Debug, PartialEq, Eq, Hash, JsonSchema, TS, Default, +)] +#[serde(rename_all = "snake_case")] +pub enum EpiphanyModeKind { + Plan, + #[default] + #[serde( + alias = "code", + alias = "pair_programming", + alias = "execute", + alias = "custom" + )] + Default, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] +pub struct EpiphanyPlanningState { + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub workspace_root: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub captures: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub backlog_items: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub roadmap_streams: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub objective_drafts: Vec, +} + +impl EpiphanyPlanningState { + pub fn is_empty(&self) -> bool { + self.workspace_root.is_none() + && self.captures.is_empty() + && self.backlog_items.is_empty() + && self.roadmap_streams.is_empty() + && self.objective_drafts.is_empty() + } +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] +pub struct EpiphanyPlanningCapture { + pub id: String, + pub title: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub body: Option, + pub confidence: String, + pub status: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub speaker: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub tags: Vec, + pub source: EpiphanyPlanningSourceRef, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub created_at: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub updated_at: Option, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] +pub struct EpiphanyPlanningSourceRef { + pub kind: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub provider: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub uri: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub external_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub repo: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "number | null")] + pub issue_number: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub node_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "bigint | null")] + pub database_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub url: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub state: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub labels: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub milestone: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub assignees: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub author: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub created_at: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub updated_at: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub closed_at: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "boolean | null")] + pub is_pull_request: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub imported_at: Option, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] +pub struct EpiphanyBacklogItem { + pub id: String, + pub title: String, + pub kind: String, + pub summary: String, + pub status: String, + pub horizon: String, + pub priority: EpiphanyPlanningPriority, + pub confidence: String, + pub product_area: String, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub lane_hints: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub dependencies: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub blockers: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub acceptance_sketch: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub evidence_refs: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub source_refs: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub duplicate_of: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub updated_at: Option, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] +pub struct EpiphanyPlanningPriority { + pub value: String, + pub rationale: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub impact: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub urgency: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub confidence: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub effort: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub unblocks: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub blocks: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub reason: Option, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] +pub struct EpiphanyRoadmapStream { + pub id: String, + pub title: String, + pub purpose: String, + pub status: String, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub item_ids: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub near_term_focus: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub blocked_by: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub review_cadence: Option, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] +pub struct EpiphanyObjectiveDraft { + pub id: String, + pub title: String, + pub summary: String, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub source_item_ids: Vec, + pub scope: EpiphanyObjectiveDraftScope, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub acceptance_criteria: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub evidence_required: Vec, + pub lane_plan: EpiphanyObjectiveDraftLanePlan, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub dependencies: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub risks: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub review_gates: Vec, + pub status: String, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] +pub struct EpiphanyObjectiveDraftScope { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub includes: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[ts(type = "Array")] + pub excludes: Vec, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] +pub struct EpiphanyObjectiveDraftLanePlan { + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub imagination: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub eyes: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub body: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub hands: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub soul: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub life: Option, +} diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 5857ef06..5cb9938e 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -36,6 +36,7 @@ remembers doctrine; the branch remembers the blade. - 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/CultNet runtime. Codex is a compatibility reliquary for OpenAI subscription auth and model transport, not the host brain. - `notes/codex-auth-spine-inventory.md` is the source-grounded keeper list for that reliquary: retain `codex-login` credential storage/refresh, `codex-model-provider` auth resolution, the model-transport subset of `codex-core::client`, and the narrow model-catalog subset of `models-manager`; do not treat Codex app-server, apps, skills, marketplace, plugin UX, MCP OAuth handlers, or collaboration-mode surfaces as auth-spine machinery. - Edge JSON is allowed for schema description, hostile ingress before immediate typed parsing, sealed forensic artifacts, or named quarantine experiments. When both subsystems are ours, runtime data must remain typed CultCache documents and move over CultNet typed contracts. Generic `serde_json::Value` in worker launch/result/selfPatch/runtime flow is contamination until classified and replaced. +- Durable Epiphany state types now live in root crate `epiphany-state-model`. `codex-protocol` re-exports them only so old rollout/API callers keep compiling; do not add new durable `Epiphany*` state structs under `vendor/codex`. `epiphany-core` imports the native model directly. The remaining `epiphany-core` dependency on `codex-protocol` is now limited to Codex rollout/event reconstruction and token-pressure input, and that is the next wound to cut. - The May 2026 foundation migration in `notes/epiphany-ideal-architecture-rebuild-plan.md` is complete enough to defend. Read `notes/epiphany-architectural-teardown.md` before touching Epiphany control-plane code, but do not treat it as an open-ended excuse to keep shaving the altar. The rebuild moved scene projection, freshness derivation, pressure policy, targeted context shards, bounded graph traversal, job/progress view derivation, planning view derivation, reorientation resume/regather verdict policy, pure CRRC recommendation policy, fixed-lane coordinator decision policy, role-board projection policy, role/reorient result interpretation, role self-persistence review policy, and role/reorient acceptance bundle policy into `epiphany-core`; typed acceptance receipts replaced summary-string identity for live accept paths, runtime links are dual-written on launch, and result read-back now prefers runtime links. - Read `notes/epiphany-ideal-architecture-rebuild-plan.md` immediately after the teardown. It defines the smallest coherent replacement architecture: durable `EpiphanyState`, runtime-spine-owned `RuntimeState`, separate role memory/heartbeat state, `epiphany-core` as policy owner, app-server as adapter, Aquarium as reflector, typed acceptance receipts, and derived view lenses instead of a protocol verb zoo. - Do not continue Aquarium UI, bridge, Face, or dogfood expansion until the teardown has a source-grounded cleanup slice plan. Epiphany is the foundation; patches on patches are not a purification rite, they are how the altar becomes load-bearing garbage. @@ -736,13 +737,14 @@ Also: MCP itself is allowed to be JSON. The target is not "replace MCP JSON"; the target is an Epiphany-owned boundary that speaks typed Epiphany intent/result/receipt documents internally and normal MCP JSON-RPC externally. -Continue with the actual whale-carcass cut: make an Epiphany-native runtime -surface call the typed OpenAI adapter/spine directly, then starve the old model +Continue with the actual whale-carcass cut: remove the remaining +`epiphany-core` dependency on `codex-protocol` by extracting or relocating the +Codex rollout adapter and token-pressure input, then keep starving the old model turn path out of `thread/epiphany/*` JSON-RPC and `codex_message_processor.rs`. Success is Epiphany calling the model adapter from its own CultCache/CultNet -runtime boundary rather than living inside the Codex host brain. Do not resume -Rider, Unity, Aquarium, Face, dogfood, planning, app, skill, marketplace, or -bridge expansion until this organ is being cut cleanly. +runtime boundary while Codex survives only as subscription auth/model routing. +Do not resume Rider, Unity, Aquarium, Face, dogfood, planning, app, skill, +marketplace, or bridge expansion until this organ is being cut cleanly. The Phase 6 freshness slice is landed. It exposes read-only `thread/epiphany/freshness` from live retrieval summaries plus graph diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index c8e73679d5615e7698aa1c5a544ab63396ccc395..9e984b45b5fac7c98fc4e96a235c4b21569799fe 100644 GIT binary patch delta 359 zcmZ9IJxW7C5XV`;8`#+lh@CHaNiblnL{eA?B39`(yOU&b-^{XaUhq{43btZlO2Hcl zf(SW*=m9*1S8!uQ!De9K_y3srcwK#aU%lB_8Qnf^-YNBYIakkfrLN7|)q|8T?Y!O1 z^6jkEIcep+e0Hx?bI?5GDO#{q)I*QZ4=zkJ)liBSOfyzSN^m3$ky!wLfb1K{3byFM z!~{3Mq~$CNk%bNW*-l@rpD%$CNANh-rcN&2b0y8aqk|+Uf)+P)-buX$n(Uvy;fUah zz%k{^1c4GcMOYeI7tx5XcOhb-9XT2&x1`u#bO4J1$s(EK8eI9CiBlv=3d6L#%rQam cRSMu!q*NWtvRdR)sHAc6^zUVzUaLF!0@1vJvH$=8 delta 49 zcmX?emi6W-)(Of?sq!0Dr!g|VYu>}SeGemJd$L%=79#^AGhG8yT|?s#14}DoQ!7)G FC;-kK5DowU diff --git a/state/map.yaml b/state/map.yaml index 1274bd22..d7cd0815 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -98,7 +98,7 @@ accepted_design: - `notes/epiphany-architectural-teardown.md` is the current foundation-cleanup directive. Its suspicion pass supersedes outward Phase 6 expansion as the active priority until the control-plane ownership problems are resolved. - `notes/epiphany-ideal-architecture-rebuild-plan.md` is the replacement blueprint: the smallest coherent architecture is durable `EpiphanyState`, runtime-spine-owned `RuntimeState`, separate role memory/heartbeat state, `epiphany-core` as policy owner, app-server as adapter, Aquarium as reflector, typed result acceptance receipts, and derived view lenses instead of a protocol verb zoo. - Epiphany is a fork-level modeling architecture, not merely a Codex collaboration mode. - - Authoritative Epiphany state lives in Codex protocol/core session and rollout state. + - Durable Epiphany state types live in the root `epiphany-state-model` crate. Codex protocol re-exports those types only for legacy rollout/API compatibility; it must not regain ownership of their meaning. - The prompt reads typed state through a bounded `` developer fragment. - Clients read typed state through `Thread.epiphanyState`, read-only `thread/epiphany/view` lenses for scene/jobs/roles/planning/pressure/reorient/CRRC/coordinator, freshness through `thread/epiphany/freshness`, targeted state shards through `thread/epiphany/context`, bounded graph traversal through `thread/epiphany/graphQuery`, and reviewable role output through `thread/epiphany/roleResult`. The scene, jobs, roles, planning, pressure, reorient, CRRC, and coordinator read projections now live only as view lenses, not standalone protocol verbs. - Durable typed state writes route through `thread/epiphany/update`, accepted `thread/epiphany/promote`, `thread/epiphany/reorientAccept`, `thread/epiphany/roleAccept`, or the bounded `thread/epiphany/jobLaunch`, `thread/epiphany/jobInterrupt`, `thread/epiphany/reorientLaunch`, and `thread/epiphany/roleLaunch` authority surfaces when they mutate state or `job_bindings`. @@ -279,5 +279,5 @@ rejected_paths: reason: making Epiphany cleaner inside Codex still preserves the wrong organ; Codex must be starved down to OpenAI subscription auth/model transport, while Epiphany data and subsystem communication move to typed CultCache/CultNet. current_status: - summary: The Codex starvation pass has five typing receipts, twenty-three processor cuts, a real physical extraction in `epiphany-codex-bridge`, a source-grounded Codex auth spine inventory, the native `epiphany-openai-adapter` document boundary, a buildable Codex auth/model wrapper in `epiphany-openai-codex-spine`, the first native runtime caller in `epiphany-openai-runtime`, native heartbeat launch planning/job opening in `epiphany-core`, native state-update contract/validation/application in `epiphany-core`, and the route-facing mutation/view/coordinator projection services in `epiphany-codex-bridge`. The bridge owns Codex-facing Epiphany adapters for scene, jobs, context/planning/graph query, retrieval/indexing projection, result projection, runtime-spine result adaptation, launch/prompt doctrine, mutation document mechanics, mutation service update/promote/role-accept/reorient-accept/role-launch/reorient-launch/job-launch/job-interrupt application, live-state projection, pressure/pre-compaction rendering, freshness/reorientation projection, CRRC/coordinator/role-board projection, full `thread/epiphany/view` response construction, freshness/context/graph-query response construction, role/reorient result response construction, distill/propose patch-response construction, coordinator status/view construction, and acceptance/evidence signal helpers. Vendored app-server now retains only `epiphany_invalidation.rs` as a root Epiphany module because watcher lifecycle is still app-server machinery; `codex_message_processor.rs` still contains route dispatch, JSON-RPC response shaping, watcher registration/snapshotting, and notification emission, but its root no longer imports the evacuated Epiphany policy/protocol registry. `epiphany_read_routes.rs` is about 579 lines after the full view and read-response extractions; `epiphany_mutation_routes.rs` is about 691 lines after the route-load/notification helper cut and index projection move; `epiphany_state_helpers.rs` is down to a 19-line rollout-state loader; and `codex_thread.rs` is about 1,425 lines after state-update law moved native. `epiphany-openai-adapter` defines CultCache `DatabaseEntry` request/event/receipt/auth-status documents with no Codex app-server or generic JSON dependency. `epiphany-openai-codex-spine` owns all direct Codex auth/model-transport imports for the native OpenAI path: it exposes `default_codex_home` and `auth_manager`, projects `AuthManager` / `CodexAuth` into typed `EpiphanyOpenAiAdapterStatus`, maps typed `EpiphanyOpenAiModelRequest` into Codex API `ResponsesApiRequest`, resolves auth/provider through keeper Codex crates, opens HTTP Responses streams through `codex-api`, maps deltas / completion into typed stream events and receipts, and no longer directly depends on `codex-app-server-protocol` just to name auth mode. `epiphany-openai-runtime` no longer depends directly on `codex-login`; it writes OpenAI status/request/stream-event/receipt records plus runtime sessions/jobs/results/events into `epiphany-core::runtime_spine_cache`, can emit the assistant text artifact for legacy result consumers, is now the default executor for startup-only repo birth specialists, and now has `run-worker` to load a durable `EpiphanyRuntimeWorkerLaunchRequest`, call the typed OpenAI runtime through the spine, persist typed `EpiphanyRuntimeRoleWorkerResult` / `EpiphanyRuntimeReorientWorkerResult` documents, and complete the original heartbeat/specialist runtime job without Codex worker execution; `codex exec` survives only as explicit fallback in repo-birth startup. `epiphany-mvp-coordinator` now invokes `epiphany-openai-runtime run-worker` for launched runtime job ids and no longer creates a second coordinator-owned shadow runtime job/result as a compensator. `epiphany-core::plan_runtime_spine_heartbeat_launch` validates launch contracts/conflicts and projects durable job bindings/runtime links; `epiphany-core::open_runtime_spine_heartbeat_job` owns the initialize-runtime/ensure-session/create-job sequence and now persists `EpiphanyRuntimeWorkerLaunchRequest` CultCache records keyed by runtime job id, with indexed kind/contract fields plus MessagePack-encoded typed launch documents instead of discarding work intent after queue receipt creation; `roleResult` and `reorientResult` now prefer typed worker result documents and fall back only to generic job summaries for older receipts; `epiphany-core::EpiphanyStateUpdate`, `epiphany_state_update_validation_errors`, and `apply_epiphany_state_update` own state-update document shape and mutation law while `codex-core` calls them for compatibility. Vendored `CodexThread::epiphany_launch_job` is now mostly revision check, persistence validation, launch request handoff, and rollout/session writeback for the compatibility route. Vendored `codex-core` no longer has `epiphany_distillation`, `epiphany_promotion`, `epiphany_proposal`, `epiphany_retrieval`, or `epiphany_rollout` husk modules; it re-exports native surfaces from `epiphany-core` directly, and the only rollout adapter left is the real host seam that supplies Codex's turn-boundary predicate. `epiphany-runtime-spine` advertises OpenAI adapter status/model-request/stream-event/receipt CultNet schemas and mutation contracts, so the native caller now has a real storage route instead of only JSON-RPC. MCP itself is correctly JSON at its protocol edge; the target is typed Epiphany intent/result/receipt wrappers around MCP, not replacing MCP JSON. The current OpenAI spine still pulls `codex-api` and a large transport dependency stack, so its next cut is dependency starvation after richer live callers move. - next_action: Move remaining coordinator/runtime execution and operator surfaces off app-server JSON-RPC where possible, then shrink the surviving Codex dependency surface to credential refresh, provider/model routing, and the smallest OpenAI Responses call required for Codex subscription compatibility. + summary: The Codex starvation pass has five typing receipts, twenty-four processor/foundation cuts, a real physical extraction in `epiphany-codex-bridge`, a root `epiphany-state-model` crate for durable Epiphany state, a source-grounded Codex auth spine inventory, the native `epiphany-openai-adapter` document boundary, a buildable Codex auth/model wrapper in `epiphany-openai-codex-spine`, the first native runtime caller in `epiphany-openai-runtime`, native heartbeat launch planning/job opening in `epiphany-core`, native state-update contract/validation/application in `epiphany-core`, and the route-facing mutation/view/coordinator projection services in `epiphany-codex-bridge`. `codex-protocol` no longer defines the durable `Epiphany*` state structs; it re-exports the native model for legacy rollout/API compatibility while `epiphany-core` imports the native model directly. The bridge owns Codex-facing Epiphany adapters for scene, jobs, context/planning/graph query, retrieval/indexing projection, result projection, runtime-spine result adaptation, launch/prompt doctrine, mutation document mechanics, mutation service update/promote/role-accept/reorient-accept/role-launch/reorient-launch/job-launch/job-interrupt application, live-state projection, pressure/pre-compaction rendering, freshness/reorientation projection, CRRC/coordinator/role-board projection, full `thread/epiphany/view` response construction, freshness/context/graph-query response construction, role/reorient result response construction, distill/propose patch-response construction, coordinator status/view construction, and acceptance/evidence signal helpers. Vendored app-server now retains only `epiphany_invalidation.rs` as a root Epiphany module because watcher lifecycle is still app-server machinery; `codex_message_processor.rs` still contains route dispatch, JSON-RPC response shaping, watcher registration/snapshotting, and notification emission, but its root no longer imports the evacuated Epiphany policy/protocol registry. `epiphany_read_routes.rs` is about 579 lines after the full view and read-response extractions; `epiphany_mutation_routes.rs` is about 691 lines after the route-load/notification helper cut and index projection move; `epiphany_state_helpers.rs` is down to a 19-line rollout-state loader; and `codex_thread.rs` is about 1,425 lines after state-update law moved native. `epiphany-openai-adapter` defines CultCache `DatabaseEntry` request/event/receipt/auth-status documents with no Codex app-server or generic JSON dependency. `epiphany-openai-codex-spine` owns all direct Codex auth/model-transport imports for the native OpenAI path: it exposes `default_codex_home` and `auth_manager`, projects `AuthManager` / `CodexAuth` into typed `EpiphanyOpenAiAdapterStatus`, maps typed `EpiphanyOpenAiModelRequest` into Codex API `ResponsesApiRequest`, resolves auth/provider through keeper Codex crates, opens HTTP Responses streams through `codex-api`, maps deltas / completion into typed stream events and receipts, and no longer directly depends on `codex-app-server-protocol` just to name auth mode. `epiphany-openai-runtime` no longer depends directly on `codex-login`; it writes OpenAI status/request/stream-event/receipt records plus runtime sessions/jobs/results/events into `epiphany-core::runtime_spine_cache`, can emit the assistant text artifact for legacy result consumers, is now the default executor for startup-only repo birth specialists, and now has `run-worker` to load a durable `EpiphanyRuntimeWorkerLaunchRequest`, call the typed OpenAI runtime through the spine, persist typed `EpiphanyRuntimeRoleWorkerResult` / `EpiphanyRuntimeReorientWorkerResult` documents, and complete the original heartbeat/specialist runtime job without Codex worker execution; `codex exec` survives only as explicit fallback in repo-birth startup. `epiphany-mvp-coordinator` now invokes `epiphany-openai-runtime run-worker` for launched runtime job ids and no longer creates a second coordinator-owned shadow runtime job/result as a compensator. `epiphany-core::plan_runtime_spine_heartbeat_launch` validates launch contracts/conflicts and projects durable job bindings/runtime links; `epiphany-core::open_runtime_spine_heartbeat_job` owns the initialize-runtime/ensure-session/create-job sequence and now persists `EpiphanyRuntimeWorkerLaunchRequest` CultCache records keyed by runtime job id, with indexed kind/contract fields plus MessagePack-encoded typed launch documents instead of discarding work intent after queue receipt creation; `roleResult` and `reorientResult` now prefer typed worker result documents and fall back only to generic job summaries for older receipts; `epiphany-core::EpiphanyStateUpdate`, `epiphany_state_update_validation_errors`, and `apply_epiphany_state_update` own state-update document shape and mutation law while `codex-core` calls them for compatibility. Vendored `CodexThread::epiphany_launch_job` is now mostly revision check, persistence validation, launch request handoff, and rollout/session writeback for the compatibility route. Vendored `codex-core` no longer has `epiphany_distillation`, `epiphany_promotion`, `epiphany_proposal`, `epiphany_retrieval`, or `epiphany_rollout` husk modules; it re-exports native surfaces from `epiphany-core` directly, and the only rollout adapter left is the real host seam that supplies Codex's turn-boundary predicate. `epiphany-core` still depends on `codex-protocol` for Codex rollout/event reconstruction and `TokenUsageInfo` pressure input; those are the next ownership wounds. `epiphany-runtime-spine` advertises OpenAI adapter status/model-request/stream-event/receipt CultNet schemas and mutation contracts, so the native caller now has a real storage route instead of only JSON-RPC. MCP itself is correctly JSON at its protocol edge; the target is typed Epiphany intent/result/receipt wrappers around MCP, not replacing MCP JSON. The current OpenAI spine still pulls `codex-api` and a large transport dependency stack, so its next cut is dependency starvation after richer live callers move. + next_action: Cut the remaining `epiphany-core` dependency on `codex-protocol` by extracting or relocating the Codex rollout adapter and token-pressure input, then continue moving coordinator/runtime execution and operator surfaces off app-server JSON-RPC. diff --git a/vendor/codex/codex-rs/Cargo.lock b/vendor/codex/codex-rs/Cargo.lock index 82e72e85..8a891e00 100644 --- a/vendor/codex/codex-rs/Cargo.lock +++ b/vendor/codex/codex-rs/Cargo.lock @@ -3120,6 +3120,7 @@ dependencies = [ "codex-utils-string", "codex-utils-template", "encoding_rs", + "epiphany-state-model", "globset", "http 1.4.0", "icu_decimal", @@ -5248,6 +5249,7 @@ dependencies = [ "cultcache-rs", "cultnet-rs", "epiphany-openai-adapter", + "epiphany-state-model", "ignore", "postgres", "reqwest", @@ -5284,6 +5286,15 @@ dependencies = [ "tokio", ] +[[package]] +name = "epiphany-state-model" +version = "0.1.0" +dependencies = [ + "schemars 0.8.22", + "serde", + "ts-rs", +] + [[package]] name = "equivalent" version = "1.0.2" diff --git a/vendor/codex/codex-rs/protocol/Cargo.toml b/vendor/codex/codex-rs/protocol/Cargo.toml index 2bd46d7d..e058452b 100644 --- a/vendor/codex/codex-rs/protocol/Cargo.toml +++ b/vendor/codex/codex-rs/protocol/Cargo.toml @@ -22,6 +22,7 @@ codex-utils-image = { workspace = true } codex-utils-string = { workspace = true } codex-utils-template = { workspace = true } encoding_rs = { workspace = true } +epiphany-state-model = { path = "../../../../epiphany-state-model" } globset = { workspace = true } icu_decimal = { workspace = true } icu_locale_core = { workspace = true } diff --git a/vendor/codex/codex-rs/protocol/src/protocol.rs b/vendor/codex/codex-rs/protocol/src/protocol.rs index d51ea120..e1505484 100644 --- a/vendor/codex/codex-rs/protocol/src/protocol.rs +++ b/vendor/codex/codex-rs/protocol/src/protocol.rs @@ -2980,702 +2980,42 @@ pub enum RolloutItem { EventMsg(EventMsg), } -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS)] -pub struct EpiphanyStateItem { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub turn_id: Option, - pub state: EpiphanyThreadState, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] -pub struct EpiphanyThreadState { - pub revision: u64, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub objective: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub active_subgoal_id: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub subgoals: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub invariants: Vec, - #[serde(default, skip_serializing_if = "EpiphanyGraphs::is_empty")] - #[ts(type = "EpiphanyGraphs")] - pub graphs: EpiphanyGraphs, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "EpiphanyGraphFrontier | null")] - pub graph_frontier: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "EpiphanyGraphCheckpoint | null")] - pub graph_checkpoint: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "EpiphanyRetrievalState | null")] - pub retrieval: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "EpiphanyScratchPad | null")] - pub scratch: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "EpiphanyInvestigationCheckpoint | null")] - pub investigation_checkpoint: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub job_bindings: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub acceptance_receipts: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub runtime_links: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub observations: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub recent_evidence: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "EpiphanyChurnState | null")] - pub churn: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "EpiphanyModeState | null")] - pub mode: Option, - #[serde(default, skip_serializing_if = "EpiphanyPlanningState::is_empty")] - #[ts(type = "EpiphanyPlanningState")] - pub planning: EpiphanyPlanningState, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub last_updated_turn_id: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] -pub struct EpiphanyAcceptanceReceipt { - pub id: String, - pub result_id: String, - pub job_id: String, - pub binding_id: String, - pub surface: String, - pub role_id: String, - pub status: String, - pub accepted_at: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub accepted_observation_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub accepted_evidence_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub summary: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] -pub struct EpiphanyRuntimeLink { - pub id: String, - pub binding_id: String, - pub surface: String, - pub role_id: String, - pub authority_scope: String, - pub runtime_job_id: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub runtime_result_id: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub linked_subgoal_ids: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub linked_graph_node_ids: Vec, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] -pub struct EpiphanySubgoal { - pub id: String, - pub title: String, - pub status: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub summary: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] -pub struct EpiphanyInvariant { - pub id: String, - pub description: String, - pub status: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub rationale: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] -pub struct EpiphanyGraphs { - #[serde(default, skip_serializing_if = "EpiphanyGraph::is_empty")] - pub architecture: EpiphanyGraph, - #[serde(default, skip_serializing_if = "EpiphanyGraph::is_empty")] - pub dataflow: EpiphanyGraph, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub links: Vec, -} - -impl EpiphanyGraphs { - pub fn is_empty(&self) -> bool { - self.architecture.is_empty() && self.dataflow.is_empty() && self.links.is_empty() - } -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] -pub struct EpiphanyGraph { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub nodes: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub edges: Vec, -} - -impl EpiphanyGraph { - pub fn is_empty(&self) -> bool { - self.nodes.is_empty() && self.edges.is_empty() - } -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] -pub struct EpiphanyGraphNode { - pub id: String, - pub title: String, - pub purpose: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub mechanism: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub metaphor: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub status: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub code_refs: Vec, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] -pub struct EpiphanyGraphEdge { - pub source_id: String, - pub target_id: String, - pub kind: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub label: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub mechanism: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub code_refs: Vec, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] -pub struct EpiphanyGraphLink { - pub dataflow_node_id: String, - pub architecture_node_id: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub relationship: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub code_refs: Vec, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] -pub struct EpiphanyCodeRef { - pub path: PathBuf, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "number | null")] - pub start_line: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "number | null")] - pub end_line: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub symbol: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub note: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] -pub struct EpiphanyGraphFrontier { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub active_node_ids: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub active_edge_ids: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub open_question_ids: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub open_gap_ids: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub dirty_paths: Vec, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] -pub struct EpiphanyGraphCheckpoint { - pub checkpoint_id: String, - pub graph_revision: u64, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub summary: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub frontier_node_ids: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub open_question_ids: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub open_gap_ids: Vec, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] -pub struct EpiphanyRetrievalState { - pub workspace_root: PathBuf, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub index_revision: Option, - #[serde(default)] - pub status: EpiphanyRetrievalStatus, - #[serde(default, skip_serializing_if = "std::ops::Not::not")] - #[ts(type = "boolean")] - pub semantic_available: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "bigint | null")] - pub last_indexed_at_unix_seconds: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "number | null")] - pub indexed_file_count: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "number | null")] - pub indexed_chunk_count: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub shards: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub dirty_paths: Vec, -} - -#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialEq, Eq, JsonSchema, TS, Default)] -#[serde(rename_all = "snake_case")] -#[ts(rename_all = "snake_case")] -pub enum EpiphanyRetrievalStatus { - #[default] - Unavailable, - Ready, - Stale, - Indexing, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] -pub struct EpiphanyRetrievalShardSummary { - pub shard_id: String, - pub path_prefix: PathBuf, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "number | null")] - pub indexed_file_count: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "number | null")] - pub indexed_chunk_count: Option, - #[serde(default)] - pub status: EpiphanyRetrievalStatus, - #[serde(default, skip_serializing_if = "std::ops::Not::not")] - #[ts(type = "boolean")] - pub exact_available: bool, - #[serde(default, skip_serializing_if = "std::ops::Not::not")] - #[ts(type = "boolean")] - pub semantic_available: bool, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] -pub struct EpiphanyScratchPad { - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub summary: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub hypothesis: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub next_probe: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub notes: Vec, -} - -#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialEq, Eq, JsonSchema, TS, Default)] -#[serde(rename_all = "snake_case")] -#[ts(rename_all = "snake_case")] -pub enum EpiphanyInvestigationDisposition { - #[default] - ResumeReady, - RegatherRequired, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] -pub struct EpiphanyInvestigationCheckpoint { - pub checkpoint_id: String, - pub kind: String, - pub disposition: EpiphanyInvestigationDisposition, - pub focus: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub summary: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub next_action: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub captured_at_turn_id: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub open_questions: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub code_refs: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub evidence_ids: Vec, -} - -#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialEq, Eq, JsonSchema, TS)] -#[serde(rename_all = "snake_case")] -#[ts(rename_all = "snake_case")] -pub enum EpiphanyJobKind { - Indexing, - Remap, - Verification, - Specialist, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS)] -pub struct EpiphanyJobBinding { - pub id: String, - pub kind: EpiphanyJobKind, - pub scope: String, - pub owner_role: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub authority_scope: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub linked_subgoal_ids: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub linked_graph_node_ids: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub blocking_reason: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] -pub struct EpiphanyObservation { - pub id: String, - pub summary: String, - pub source_kind: String, - pub status: String, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub code_refs: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub evidence_ids: Vec, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] -pub struct EpiphanyEvidenceRecord { - pub id: String, - pub kind: String, - pub status: String, - pub summary: String, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub code_refs: Vec, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] -pub struct EpiphanyChurnState { - pub understanding_status: String, - pub diff_pressure: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub graph_freshness: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub warning: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "number | null")] - pub unexplained_writes: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] -pub struct EpiphanyModeState { - pub name: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "ModeKind | null")] - pub kind: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] -pub struct EpiphanyPlanningState { - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub workspace_root: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub captures: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub backlog_items: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub roadmap_streams: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub objective_drafts: Vec, -} - -impl EpiphanyPlanningState { - pub fn is_empty(&self) -> bool { - self.workspace_root.is_none() - && self.captures.is_empty() - && self.backlog_items.is_empty() - && self.roadmap_streams.is_empty() - && self.objective_drafts.is_empty() - } -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] -pub struct EpiphanyPlanningCapture { - pub id: String, - pub title: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub body: Option, - pub confidence: String, - pub status: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub speaker: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub tags: Vec, - pub source: EpiphanyPlanningSourceRef, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub created_at: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub updated_at: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] -pub struct EpiphanyPlanningSourceRef { - pub kind: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub provider: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub uri: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub external_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub repo: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "number | null")] - pub issue_number: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub node_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "bigint | null")] - pub database_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub url: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub state: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub labels: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub milestone: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub assignees: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub author: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub created_at: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub updated_at: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub closed_at: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "boolean | null")] - pub is_pull_request: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub imported_at: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] -pub struct EpiphanyBacklogItem { - pub id: String, - pub title: String, - pub kind: String, - pub summary: String, - pub status: String, - pub horizon: String, - pub priority: EpiphanyPlanningPriority, - pub confidence: String, - pub product_area: String, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub lane_hints: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub dependencies: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub blockers: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub acceptance_sketch: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub evidence_refs: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub source_refs: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub duplicate_of: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub updated_at: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] -pub struct EpiphanyPlanningPriority { - pub value: String, - pub rationale: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub impact: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub urgency: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub confidence: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub effort: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub unblocks: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub blocks: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub reason: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] -pub struct EpiphanyRoadmapStream { - pub id: String, - pub title: String, - pub purpose: String, - pub status: String, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub item_ids: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub near_term_focus: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub blocked_by: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub review_cadence: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] -pub struct EpiphanyObjectiveDraft { - pub id: String, - pub title: String, - pub summary: String, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub source_item_ids: Vec, - pub scope: EpiphanyObjectiveDraftScope, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub acceptance_criteria: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub evidence_required: Vec, - pub lane_plan: EpiphanyObjectiveDraftLanePlan, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub dependencies: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub risks: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub review_gates: Vec, - pub status: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] -pub struct EpiphanyObjectiveDraftScope { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub includes: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[ts(type = "Array")] - pub excludes: Vec, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)] -pub struct EpiphanyObjectiveDraftLanePlan { - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub imagination: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub eyes: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub body: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub hands: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub soul: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(type = "string | null")] - pub life: Option, -} +pub use epiphany_state_model::EpiphanyAcceptanceReceipt; +pub use epiphany_state_model::EpiphanyBacklogItem; +pub use epiphany_state_model::EpiphanyChurnState; +pub use epiphany_state_model::EpiphanyCodeRef; +pub use epiphany_state_model::EpiphanyEvidenceRecord; +pub use epiphany_state_model::EpiphanyGraph; +pub use epiphany_state_model::EpiphanyGraphCheckpoint; +pub use epiphany_state_model::EpiphanyGraphEdge; +pub use epiphany_state_model::EpiphanyGraphFrontier; +pub use epiphany_state_model::EpiphanyGraphLink; +pub use epiphany_state_model::EpiphanyGraphNode; +pub use epiphany_state_model::EpiphanyGraphs; +pub use epiphany_state_model::EpiphanyInvariant; +pub use epiphany_state_model::EpiphanyInvestigationCheckpoint; +pub use epiphany_state_model::EpiphanyInvestigationDisposition; +pub use epiphany_state_model::EpiphanyJobBinding; +pub use epiphany_state_model::EpiphanyJobKind; +pub use epiphany_state_model::EpiphanyModeKind; +pub use epiphany_state_model::EpiphanyModeState; +pub use epiphany_state_model::EpiphanyObjectiveDraft; +pub use epiphany_state_model::EpiphanyObjectiveDraftLanePlan; +pub use epiphany_state_model::EpiphanyObjectiveDraftScope; +pub use epiphany_state_model::EpiphanyObservation; +pub use epiphany_state_model::EpiphanyPlanningCapture; +pub use epiphany_state_model::EpiphanyPlanningPriority; +pub use epiphany_state_model::EpiphanyPlanningSourceRef; +pub use epiphany_state_model::EpiphanyPlanningState; +pub use epiphany_state_model::EpiphanyRetrievalShardSummary; +pub use epiphany_state_model::EpiphanyRetrievalState; +pub use epiphany_state_model::EpiphanyRetrievalStatus; +pub use epiphany_state_model::EpiphanyRoadmapStream; +pub use epiphany_state_model::EpiphanyRuntimeLink; +pub use epiphany_state_model::EpiphanyScratchPad; +pub use epiphany_state_model::EpiphanyStateItem; +pub use epiphany_state_model::EpiphanySubgoal; +pub use epiphany_state_model::EpiphanyThreadState; #[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, TS)] pub struct CompactedItem { @@ -6079,6 +5419,8 @@ mod tests { notes: vec!["Do not touch prompts yet".to_string()], }), job_bindings: Vec::new(), + acceptance_receipts: Vec::new(), + runtime_links: Vec::new(), observations: vec![EpiphanyObservation { id: "obs-1".to_string(), summary: "TurnContext already gives us the persistence seam".to_string(), @@ -6104,8 +5446,9 @@ mod tests { }), mode: Some(EpiphanyModeState { name: "epiphany".to_string(), - kind: Some(ModeKind::Default), + kind: Some(EpiphanyModeKind::Default), }), + planning: EpiphanyPlanningState::default(), last_updated_turn_id: Some("turn-123".to_string()), } }