diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index e198e958..7b609088 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -486,6 +486,11 @@ The twentieth cut removed `use super::*` from `epiphany_automation.rs` and made the coordinator/pre-compaction automation dependencies explicit. The processor is about 10,429 lines. Remaining Epiphany child modules with parent wildcard visibility are `epiphany_read_routes.rs` and `epiphany_mutation_routes.rs`. +The twenty-first cut removed `use super::*` from `epiphany_read_routes.rs` and +made its read/proposal dependencies explicit. The processor is about 10,388 +lines. The remaining Epiphany wildcard route module is +`epiphany_mutation_routes.rs`; it owns the dangerous launch/accept/update/ +promote/interrupt path and should be the next incision. 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 diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 2d2ecf12..fb32a9ce 100644 Binary files a/state/ledgers.msgpack and b/state/ledgers.msgpack differ diff --git a/state/map.yaml b/state/map.yaml index 67301d4d..d09f6868 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -278,5 +278,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, seventeen processor cuts, and now a real physical extraction: `epiphany-codex-bridge` lives outside `vendor/codex` and owns the Codex-facing Epiphany adapters for scene, jobs, context/planning/graph query, retrieval, result projection, runtime-spine result adaptation, launch/prompt doctrine, pressure/pre-compaction rendering, freshness/reorientation projection, CRRC/coordinator/role-board projection, 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, mutation orchestration, and state hydration. The processor is about 10,429 lines after moving runtime result adaptation and making state/automation helpers explicit, but vendored Codex lost roughly 3.6k lines of Epiphany adapter/prompt/runtime-result ownership across the bridge extraction. This is progress, not absolution: the bridge is still Codex-facing compatibility, not the final CultNet runtime, and read/mutation routes still have parent wildcard visibility inside the Codex processor. MCP itself is correctly JSON at its protocol edge; the target is typed Epiphany intent/result/receipt wrappers around MCP, not replacing MCP JSON. - next_action: Continue Codex starvation by turning the remaining Epiphany route modules (`epiphany_read_routes`, `epiphany_mutation_routes`) into explicit service/bridge calls without `use super::*`, then move route-independent state helpers out of the processor. The next measurable wound is parent-internal wildcard visibility and mutation orchestration inside the Codex processor, not app/skill/marketplace expansion. + summary: The Codex starvation pass has five typing receipts, seventeen processor cuts, and now a real physical extraction: `epiphany-codex-bridge` lives outside `vendor/codex` and owns the Codex-facing Epiphany adapters for scene, jobs, context/planning/graph query, retrieval, result projection, runtime-spine result adaptation, launch/prompt doctrine, pressure/pre-compaction rendering, freshness/reorientation projection, CRRC/coordinator/role-board projection, 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, mutation orchestration, and state hydration. The processor is about 10,388 lines after moving runtime result adaptation and making state/automation/read-route dependencies explicit, but vendored Codex lost roughly 3.6k lines of Epiphany adapter/prompt/runtime-result ownership across the bridge extraction. This is progress, not absolution: the bridge is still Codex-facing compatibility, not the final CultNet runtime, and mutation routes still have parent wildcard visibility inside the Codex processor. MCP itself is correctly JSON at its protocol edge; the target is typed Epiphany intent/result/receipt wrappers around MCP, not replacing MCP JSON. + next_action: Continue Codex starvation by turning `epiphany_mutation_routes` into explicit service/bridge calls without `use super::*`, then move route-independent state helpers out of the processor. The next measurable wound is parent-internal wildcard visibility and mutation orchestration inside the Codex processor, not app/skill/marketplace expansion. diff --git a/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs b/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs index 657bdfa7..90b82906 100644 --- a/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs +++ b/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs @@ -169,25 +169,16 @@ use codex_app_server_protocol::ThreadDecrementElicitationParams; use codex_app_server_protocol::ThreadDecrementElicitationResponse; use codex_app_server_protocol::ThreadEpiphanyContext; use codex_app_server_protocol::ThreadEpiphanyContextParams; -use codex_app_server_protocol::ThreadEpiphanyContextResponse; -use codex_app_server_protocol::ThreadEpiphanyContextSource; use codex_app_server_protocol::ThreadEpiphanyContextStateStatus; use codex_app_server_protocol::ThreadEpiphanyCoordinatorAction; use codex_app_server_protocol::ThreadEpiphanyCoordinatorSignals; use codex_app_server_protocol::ThreadEpiphanyCrrcAction; use codex_app_server_protocol::ThreadEpiphanyCrrcRecommendation; -use codex_app_server_protocol::ThreadEpiphanyDistillParams; -use codex_app_server_protocol::ThreadEpiphanyDistillResponse; -use codex_app_server_protocol::ThreadEpiphanyFreshnessParams; -use codex_app_server_protocol::ThreadEpiphanyFreshnessResponse; -use codex_app_server_protocol::ThreadEpiphanyFreshnessSource; use codex_app_server_protocol::ThreadEpiphanyGraphFreshness; use codex_app_server_protocol::ThreadEpiphanyGraphFreshnessStatus; use codex_app_server_protocol::ThreadEpiphanyGraphQuery; use codex_app_server_protocol::ThreadEpiphanyGraphQueryDirection; use codex_app_server_protocol::ThreadEpiphanyGraphQueryKind; -use codex_app_server_protocol::ThreadEpiphanyGraphQueryParams; -use codex_app_server_protocol::ThreadEpiphanyGraphQueryResponse; use codex_app_server_protocol::ThreadEpiphanyIndexParams; use codex_app_server_protocol::ThreadEpiphanyIndexResponse; use codex_app_server_protocol::ThreadEpiphanyInvalidationInput; @@ -203,8 +194,6 @@ use codex_app_server_protocol::ThreadEpiphanyPressure; use codex_app_server_protocol::ThreadEpiphanyPressureLevel; use codex_app_server_protocol::ThreadEpiphanyPromoteParams; use codex_app_server_protocol::ThreadEpiphanyPromoteResponse; -use codex_app_server_protocol::ThreadEpiphanyProposeParams; -use codex_app_server_protocol::ThreadEpiphanyProposeResponse; use codex_app_server_protocol::ThreadEpiphanyReorientAcceptParams; use codex_app_server_protocol::ThreadEpiphanyReorientAcceptResponse; use codex_app_server_protocol::ThreadEpiphanyReorientAction; @@ -214,14 +203,11 @@ use codex_app_server_protocol::ThreadEpiphanyReorientFinding; use codex_app_server_protocol::ThreadEpiphanyReorientLaunchParams; use codex_app_server_protocol::ThreadEpiphanyReorientLaunchResponse; use codex_app_server_protocol::ThreadEpiphanyReorientReason; -use codex_app_server_protocol::ThreadEpiphanyReorientResultParams; -use codex_app_server_protocol::ThreadEpiphanyReorientResultResponse; use codex_app_server_protocol::ThreadEpiphanyReorientResultStatus; use codex_app_server_protocol::ThreadEpiphanyReorientSource; use codex_app_server_protocol::ThreadEpiphanyReorientStateStatus; use codex_app_server_protocol::ThreadEpiphanyRetrievalFreshness; use codex_app_server_protocol::ThreadEpiphanyRetrievalFreshnessStatus; -use codex_app_server_protocol::ThreadEpiphanyRetrieveParams; #[cfg(test)] use codex_app_server_protocol::ThreadEpiphanyRetrieveResultKind; use codex_app_server_protocol::ThreadEpiphanyRoleAcceptParams; @@ -231,12 +217,9 @@ use codex_app_server_protocol::ThreadEpiphanyRoleId; use codex_app_server_protocol::ThreadEpiphanyRoleLane; use codex_app_server_protocol::ThreadEpiphanyRoleLaunchParams; use codex_app_server_protocol::ThreadEpiphanyRoleLaunchResponse; -use codex_app_server_protocol::ThreadEpiphanyRoleResultParams; -use codex_app_server_protocol::ThreadEpiphanyRoleResultResponse; use codex_app_server_protocol::ThreadEpiphanyRoleResultStatus; use codex_app_server_protocol::ThreadEpiphanyRoleSelfPersistenceStatus; use codex_app_server_protocol::ThreadEpiphanyRoleStatus; -use codex_app_server_protocol::ThreadEpiphanyRolesSource; use codex_app_server_protocol::ThreadEpiphanySceneAction; use codex_app_server_protocol::ThreadEpiphanySceneGraph; use codex_app_server_protocol::ThreadEpiphanySceneSource; @@ -248,14 +231,6 @@ use codex_app_server_protocol::ThreadEpiphanyStateUpdatedSource; use codex_app_server_protocol::ThreadEpiphanyUpdateParams; use codex_app_server_protocol::ThreadEpiphanyUpdatePatch; use codex_app_server_protocol::ThreadEpiphanyUpdateResponse; -use codex_app_server_protocol::ThreadEpiphanyViewCoordinator; -use codex_app_server_protocol::ThreadEpiphanyViewCrrc; -use codex_app_server_protocol::ThreadEpiphanyViewLens; -use codex_app_server_protocol::ThreadEpiphanyViewParams; -use codex_app_server_protocol::ThreadEpiphanyViewPlanning; -use codex_app_server_protocol::ThreadEpiphanyViewReorient; -use codex_app_server_protocol::ThreadEpiphanyViewResponse; -use codex_app_server_protocol::ThreadEpiphanyViewRoles; use codex_app_server_protocol::ThreadForkParams; use codex_app_server_protocol::ThreadForkResponse; use codex_app_server_protocol::ThreadIncrementElicitationParams; @@ -330,14 +305,9 @@ use codex_chatgpt::connectors; use codex_config::types::McpServerTransportConfig; use codex_core::CodexThread; use codex_core::CodexThreadTurnContextOverrides; -use codex_core::EPIPHANY_RETRIEVAL_DEFAULT_LIMIT; -use codex_core::EPIPHANY_RETRIEVAL_MAX_LIMIT; -use codex_core::EpiphanyDistillInput; use codex_core::EpiphanyJobInterruptRequest; use codex_core::EpiphanyJobLaunchRequest; -use codex_core::EpiphanyMapProposalInput; use codex_core::EpiphanyPromotionInput; -use codex_core::EpiphanyRetrieveQuery; use codex_core::EpiphanyStateUpdate; use codex_core::ForkSnapshot; use codex_core::NewThread; @@ -355,7 +325,6 @@ use codex_core::config::edit::ConfigEditsBuilder; use codex_core::config_loader::CloudRequirementsLoadError; use codex_core::config_loader::CloudRequirementsLoadErrorCode; use codex_core::config_loader::project_trust_key; -use codex_core::distill_observation; use codex_core::evaluate_promotion; use codex_core::exec::ExecCapturePolicy; use codex_core::exec::ExecExpiration; @@ -492,19 +461,14 @@ use epiphany_codex_bridge::context::map_epiphany_graph_query; use epiphany_codex_bridge::context::map_epiphany_planning; use epiphany_codex_bridge::coordinator::EpiphanyCoordinatorAutomationAction; use epiphany_codex_bridge::coordinator::EpiphanyCoordinatorDecision; -use epiphany_codex_bridge::coordinator::epiphany_reorient_finding_already_accepted; use epiphany_codex_bridge::coordinator::epiphany_role_finding_accepted_evidence_id; use epiphany_codex_bridge::coordinator::epiphany_role_finding_already_accepted; -use epiphany_codex_bridge::coordinator::epiphany_role_finding_cites_implementation_evidence; -use epiphany_codex_bridge::coordinator::epiphany_verification_finding_allows_implementation; use epiphany_codex_bridge::coordinator::epiphany_verification_finding_covers_current_modeling; -use epiphany_codex_bridge::coordinator::epiphany_verification_finding_needs_evidence; use epiphany_codex_bridge::coordinator::implementation_evidence_after_role_finding; use epiphany_codex_bridge::coordinator::map_epiphany_coordinator; use epiphany_codex_bridge::coordinator::map_epiphany_coordinator_automation_action; use epiphany_codex_bridge::coordinator::map_epiphany_crrc_recommendation; use epiphany_codex_bridge::coordinator::map_epiphany_roles; -use epiphany_codex_bridge::coordinator::render_epiphany_roles_note; use epiphany_codex_bridge::coordinator::role_finding_accepted_after; use epiphany_codex_bridge::coordinator::select_epiphany_coordinator_automation_action; use epiphany_codex_bridge::jobs::epiphany_blocked_state_job; @@ -541,22 +505,17 @@ use epiphany_codex_bridge::retrieve::map_epiphany_retrieve_index_summary; use epiphany_codex_bridge::retrieve::map_epiphany_retrieve_response; use epiphany_codex_bridge::runtime_results::latest_epiphany_runtime_link_for_binding; use epiphany_codex_bridge::runtime_results::load_epiphany_reorient_result_from_runtime_spine_job; -use epiphany_codex_bridge::runtime_results::load_epiphany_reorient_result_snapshot; use epiphany_codex_bridge::runtime_results::load_epiphany_role_result_from_runtime_spine_job; -use epiphany_codex_bridge::runtime_results::load_epiphany_role_result_snapshot; use epiphany_codex_bridge::runtime_results::reorient_finding_runtime_job_id; use epiphany_codex_bridge::runtime_results::reorient_finding_runtime_result_id; use epiphany_codex_bridge::runtime_results::role_finding_runtime_job_id; use epiphany_codex_bridge::runtime_results::role_finding_runtime_result_id; -use epiphany_codex_bridge::scene::map_core_epiphany_scene_action; use epiphany_codex_bridge::scene::map_epiphany_scene; use epiphany_core::EpiphanyReorientAcceptanceFinding; use epiphany_core::EpiphanyRoleAcceptanceFinding; -use epiphany_core::EpiphanySceneInput; use epiphany_core::EpiphanyWorkerLaunchDocument; use epiphany_core::build_reorient_acceptance_bundle; use epiphany_core::build_role_acceptance_bundle; -use epiphany_core::derive_scene; use epiphany_core::imagination_role_state_patch_policy_errors; use epiphany_core::modeling_role_state_patch_policy_errors; use std::collections::HashMap; diff --git a/vendor/codex/codex-rs/app-server/src/codex_message_processor/epiphany_read_routes.rs b/vendor/codex/codex-rs/app-server/src/codex_message_processor/epiphany_read_routes.rs index 1d042de3..580b02c9 100644 --- a/vendor/codex/codex-rs/app-server/src/codex_message_processor/epiphany_read_routes.rs +++ b/vendor/codex/codex-rs/app-server/src/codex_message_processor/epiphany_read_routes.rs @@ -1,4 +1,49 @@ -use super::*; +use codex_app_server_protocol::*; +use codex_core::EPIPHANY_RETRIEVAL_DEFAULT_LIMIT; +use codex_core::EPIPHANY_RETRIEVAL_MAX_LIMIT; +use codex_core::EpiphanyDistillInput; +use codex_core::EpiphanyMapProposalInput; +use codex_core::EpiphanyRetrieveQuery; +use codex_core::distill_observation; +use codex_protocol::ThreadId; +use epiphany_codex_bridge::context::map_epiphany_context; +use epiphany_codex_bridge::context::map_epiphany_graph_query; +use epiphany_codex_bridge::context::map_epiphany_planning; +use epiphany_codex_bridge::coordinator::epiphany_reorient_finding_already_accepted; +use epiphany_codex_bridge::coordinator::epiphany_role_finding_already_accepted; +use epiphany_codex_bridge::coordinator::epiphany_role_finding_cites_implementation_evidence; +use epiphany_codex_bridge::coordinator::epiphany_verification_finding_allows_implementation; +use epiphany_codex_bridge::coordinator::epiphany_verification_finding_covers_current_modeling; +use epiphany_codex_bridge::coordinator::epiphany_verification_finding_needs_evidence; +use epiphany_codex_bridge::coordinator::implementation_evidence_after_role_finding; +use epiphany_codex_bridge::coordinator::map_epiphany_coordinator; +use epiphany_codex_bridge::coordinator::map_epiphany_crrc_recommendation; +use epiphany_codex_bridge::coordinator::map_epiphany_roles; +use epiphany_codex_bridge::coordinator::render_epiphany_roles_note; +use epiphany_codex_bridge::coordinator::role_finding_accepted_after; +use epiphany_codex_bridge::jobs::map_epiphany_jobs; +use epiphany_codex_bridge::launch::EPIPHANY_MODELING_ROLE_BINDING_ID; +use epiphany_codex_bridge::launch::EPIPHANY_REORIENT_LAUNCH_BINDING_ID; +use epiphany_codex_bridge::launch::EPIPHANY_VERIFICATION_ROLE_BINDING_ID; +use epiphany_codex_bridge::launch::epiphany_role_binding_id; +use epiphany_codex_bridge::launch::render_epiphany_coordinator_note; +use epiphany_codex_bridge::pressure::map_epiphany_pressure; +use epiphany_codex_bridge::reorient::map_epiphany_freshness; +use epiphany_codex_bridge::reorient::map_epiphany_reorient; +use epiphany_codex_bridge::retrieve::map_epiphany_retrieve_response; +use epiphany_codex_bridge::runtime_results::load_epiphany_reorient_result_snapshot; +use epiphany_codex_bridge::runtime_results::load_epiphany_role_result_snapshot; +use epiphany_codex_bridge::scene::map_core_epiphany_scene_action; +use epiphany_codex_bridge::scene::map_epiphany_scene; +use epiphany_core::EpiphanySceneInput; +use epiphany_core::derive_scene; + +use super::CodexMessageProcessor; +use super::ConnectionRequestId; +use super::ThreadReadViewError; +use super::epiphany_freshness_watcher_snapshot; +use super::epiphany_state_helpers::epiphany_modeling_finding_has_reviewable_state_patch; +use super::latest_token_usage_info_from_rollout_path; impl CodexMessageProcessor { pub(super) async fn thread_epiphany_view(