diff --git a/epiphany-codex-bridge/src/mutation_service.rs b/epiphany-codex-bridge/src/mutation_service.rs index d29a5b03..fe4a1b33 100644 --- a/epiphany-codex-bridge/src/mutation_service.rs +++ b/epiphany-codex-bridge/src/mutation_service.rs @@ -2,6 +2,7 @@ use chrono::SecondsFormat; use chrono::Utc; use codex_app_server_protocol::ThreadEpiphanyJob; use codex_app_server_protocol::ThreadEpiphanyJobKind; +use codex_app_server_protocol::ThreadEpiphanyJobLaunchParams; use codex_app_server_protocol::ThreadEpiphanyReorientDecision; use codex_app_server_protocol::ThreadEpiphanyReorientFinding; use codex_app_server_protocol::ThreadEpiphanyReorientSource; @@ -46,6 +47,7 @@ use crate::launch::EPIPHANY_REORIENT_LAUNCH_BINDING_ID; use crate::launch::build_epiphany_reorient_launch_request; use crate::launch::build_epiphany_role_launch_request; use crate::launch::epiphany_role_label; +use crate::launch::map_core_worker_launch_document; use crate::mutation::build_reorient_acceptance_update; use crate::mutation::build_role_acceptance_update; use crate::mutation::epiphany_job_launch_changed_fields; @@ -510,6 +512,48 @@ pub async fn launch_thread_epiphany_job( }) } +pub async fn launch_thread_epiphany_job_from_route_params( + thread: &CodexThread, + params: ThreadEpiphanyJobLaunchParams, +) -> Result { + let ThreadEpiphanyJobLaunchParams { + thread_id: _, + expected_revision, + binding_id, + kind, + scope, + owner_role, + authority_scope, + linked_subgoal_ids, + linked_graph_node_ids, + instruction, + launch_document, + output_contract_id, + max_runtime_seconds, + } = params; + let launch_document = map_core_worker_launch_document(launch_document); + launch_thread_epiphany_job( + thread, + EpiphanyJobLaunchRequest { + expected_revision, + binding_id, + kind, + scope, + owner_role, + authority_scope, + linked_subgoal_ids, + linked_graph_node_ids, + instruction, + launch_document, + output_contract_id, + max_runtime_seconds, + }, + kind, + "missing launched job projection", + ) + .await +} + fn open_epiphany_runtime_spine_job( store_path: &std::path::Path, state: &EpiphanyThreadState, diff --git a/epiphany-codex-bridge/src/retrieve.rs b/epiphany-codex-bridge/src/retrieve.rs index 049d85a5..c9da7a4c 100644 --- a/epiphany-codex-bridge/src/retrieve.rs +++ b/epiphany-codex-bridge/src/retrieve.rs @@ -11,6 +11,15 @@ use epiphany_core::EpiphanyRetrieveQuery; use epiphany_core::EpiphanyRetrieveResponse as CoreEpiphanyRetrieveResponse; use epiphany_core::EpiphanyRetrieveResult as CoreEpiphanyRetrieveResult; use epiphany_core::EpiphanyRetrieveResultKind as CoreEpiphanyRetrieveResultKind; +use std::path::PathBuf; + +pub fn normalize_thread_epiphany_retrieve_query( + query: String, + limit: Option, + path_prefixes: Vec, +) -> std::result::Result { + epiphany_core::normalize_epiphany_retrieve_query(query, limit, path_prefixes) +} pub async fn thread_epiphany_retrieval_state(thread: &CodexThread) -> EpiphanyRetrievalState { let config = thread.config_snapshot().await; diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index a7549a53..138c89c1 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -62,6 +62,7 @@ remembers doctrine; the branch remembers the blade. - Epiphany memory graph loading and runtime-spine path derivation now belong to `epiphany-codex-bridge::state`. Vendored app-server read routes may decide whether a loaded thread exists, but they no longer own memory graph or runtime-spine store path/load mechanics. - Epiphany job launch/interrupt policy and state-update application now belong to `epiphany-codex-bridge::mutation_service`: heartbeat launch planning, runtime-spine job opening, binding/runtime-link mutation, interrupt binding cleanup, and typed patch apply are out of vendored `CodexThread`. `CodexThread` now exposes only the narrow Codex-session host seam for reading current Epiphany state/reference turn and persisting an already-mutated snapshot into rollout/session storage. - Epiphany retrieval status, indexing, and retrieval execution now belong to `epiphany-codex-bridge::retrieve`; vendored `CodexThread` only exposes cwd/codex-home host facts for that path. +- Vendored app-server no longer imports `epiphany_core` directly. Retrieval query normalization and raw route job-launch DTO construction are bridge-owned adapters; the remaining direct native render call is in Codex core's model-context prompt fragment host seam. - Heartbeat durable document/schema types now live in `epiphany-core/src/heartbeat_state/heartbeat_documents.rs`, role/default construction lives in `epiphany-core/src/heartbeat_state/heartbeat_roles.rs`, persistence/validation lives in `epiphany-core/src/heartbeat_state/heartbeat_store.rs`, and status/artifact JSON projection lives in `epiphany-core/src/heartbeat_state/heartbeat_projection.rs`. The root `heartbeat_state.rs` keeps scheduling and Void cognition orchestration for the next cuts. Focused heartbeat tests and `epiphany-core` check pass after the splits. - Heartbeat role/default and store seams now have module-local unit tests: fixed lane catalog, Ghostlight scene role projection, and typed state/cognition CultCache round-trip. Keep future heartbeat cuts aligned to those seam tests instead of growing root integration-only coverage. - Heartbeat adaptive pacing now lives in `epiphany-core/src/heartbeat_state/heartbeat_pacing.rs`, including running-turn count and effective cooldown multipliers. It has a module-local unit test for pending-turn counting; root scheduling calls the pacing seam instead of owning pressure/concurrency math directly. diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 8179361b..fd48d6a5 100644 Binary files a/state/ledgers.msgpack and b/state/ledgers.msgpack differ diff --git a/state/map.yaml b/state/map.yaml index 0c4fc46a..4e37eb3e 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -34,6 +34,9 @@ objective: Retrieval status, indexing, and retrieval execution now live in `epiphany-codex-bridge::retrieve`; vendored Codex supplies cwd/codex-home host facts rather than owning Epiphany retrieval behavior. + Vendored app-server no longer imports `epiphany_core` directly; retrieval + query normalization and route job-launch DTO construction are bridge-owned + adapters. constraints: - No frontier-scale training tithe. diff --git a/vendor/codex/codex-rs/app-server/src/codex_message_processor/epiphany_mutation_routes.rs b/vendor/codex/codex-rs/app-server/src/codex_message_processor/epiphany_mutation_routes.rs index 6bccbffc..29a23775 100644 --- a/vendor/codex/codex-rs/app-server/src/codex_message_processor/epiphany_mutation_routes.rs +++ b/vendor/codex/codex-rs/app-server/src/codex_message_processor/epiphany_mutation_routes.rs @@ -6,7 +6,6 @@ use codex_protocol::protocol::EpiphanyThreadState; use epiphany_codex_bridge::invalidation::epiphany_freshness_watcher_snapshot; use epiphany_codex_bridge::launch::EPIPHANY_REORIENT_LAUNCH_BINDING_ID; use epiphany_codex_bridge::launch::epiphany_role_binding_id; -use epiphany_codex_bridge::launch::map_core_worker_launch_document; use epiphany_codex_bridge::mutation::epiphany_state_updated_notification; use epiphany_codex_bridge::mutation_service::EpiphanyThreadPromoteApplied; use epiphany_codex_bridge::mutation_service::apply_thread_epiphany_promote; @@ -14,12 +13,11 @@ use epiphany_codex_bridge::mutation_service::apply_thread_epiphany_reorient_acce use epiphany_codex_bridge::mutation_service::apply_thread_epiphany_role_accept; use epiphany_codex_bridge::mutation_service::apply_thread_epiphany_update; use epiphany_codex_bridge::mutation_service::interrupt_thread_epiphany_job; -use epiphany_codex_bridge::mutation_service::launch_thread_epiphany_job; +use epiphany_codex_bridge::mutation_service::launch_thread_epiphany_job_from_route_params; use epiphany_codex_bridge::mutation_service::launch_thread_epiphany_reorient; use epiphany_codex_bridge::mutation_service::launch_thread_epiphany_role; use epiphany_codex_bridge::retrieve::index_thread_epiphany_retrieval; use epiphany_codex_bridge::retrieve::thread_epiphany_retrieval_state; -use epiphany_core::EpiphanyJobLaunchRequest; use std::sync::Arc; use super::CodexMessageProcessor; @@ -550,63 +548,29 @@ impl CodexMessageProcessor { request_id: ConnectionRequestId, params: ThreadEpiphanyJobLaunchParams, ) { - let ThreadEpiphanyJobLaunchParams { - thread_id, - expected_revision, - binding_id, - kind, - scope, - owner_role, - authority_scope, - linked_subgoal_ids, - linked_graph_node_ids, - instruction, - launch_document, - output_contract_id, - max_runtime_seconds, - } = params; + let thread_id = params.thread_id.clone(); let (thread_uuid, thread) = match self.load_epiphany_thread(&request_id, &thread_id).await { Some(thread) => thread, None => return, }; - let launch_document = map_core_worker_launch_document(launch_document); - let applied = match launch_thread_epiphany_job( - thread.as_ref(), - EpiphanyJobLaunchRequest { - expected_revision, - binding_id: binding_id.clone(), - kind, - scope, - owner_role, - authority_scope, - linked_subgoal_ids, - linked_graph_node_ids, - instruction, - launch_document, - output_contract_id, - max_runtime_seconds, - }, - kind, - "missing launched job projection", - ) - .await - { - Ok(applied) => applied, - Err(CodexErr::InvalidRequest(message)) => { - self.send_invalid_request_error(request_id, message).await; - return; - } - Err(err) => { - self.send_internal_error( - request_id, - format!("failed to launch Epiphany job for {thread_uuid}: {err}"), - ) - .await; - return; - } - }; + let applied = + match launch_thread_epiphany_job_from_route_params(thread.as_ref(), params).await { + Ok(applied) => applied, + Err(CodexErr::InvalidRequest(message)) => { + self.send_invalid_request_error(request_id, message).await; + return; + } + Err(err) => { + self.send_internal_error( + request_id, + format!("failed to launch Epiphany job for {thread_uuid}: {err}"), + ) + .await; + return; + } + }; let changed_fields = applied.changed_fields; let epiphany_state = applied.epiphany_state; 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 694537b3..44af2a68 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 @@ -4,6 +4,7 @@ use epiphany_codex_bridge::invalidation::epiphany_freshness_watcher_snapshot; use epiphany_codex_bridge::launch::EPIPHANY_REORIENT_LAUNCH_BINDING_ID; use epiphany_codex_bridge::launch::epiphany_role_binding_id; use epiphany_codex_bridge::retrieve::map_epiphany_retrieve_response; +use epiphany_codex_bridge::retrieve::normalize_thread_epiphany_retrieve_query; use epiphany_codex_bridge::retrieve::retrieve_thread_epiphany; use epiphany_codex_bridge::retrieve::thread_epiphany_retrieval_state; use epiphany_codex_bridge::state::load_optional_thread_memory_graph_snapshot; @@ -25,7 +26,6 @@ use epiphany_codex_bridge::view::map_epiphany_propose_response; use epiphany_codex_bridge::view::map_epiphany_reorient_result_response; use epiphany_codex_bridge::view::map_epiphany_role_result_response; use epiphany_codex_bridge::view::map_epiphany_view_response; -use epiphany_core::normalize_epiphany_retrieve_query; use super::CodexMessageProcessor; use super::ConnectionRequestId; @@ -463,7 +463,7 @@ impl CodexMessageProcessor { } }; - let query = match normalize_epiphany_retrieve_query(query, limit, path_prefixes) { + let query = match normalize_thread_epiphany_retrieve_query(query, limit, path_prefixes) { Ok(query) => query, Err(message) => { self.send_invalid_request_error(request_id, message.to_string())