diff --git a/epiphany-codex-bridge/src/view.rs b/epiphany-codex-bridge/src/view.rs index 8c727009..cb589f9d 100644 --- a/epiphany-codex-bridge/src/view.rs +++ b/epiphany-codex-bridge/src/view.rs @@ -450,7 +450,7 @@ pub async fn map_epiphany_view_response( pub struct EpiphanyRoleResultResponseInput<'a> { pub thread_id: String, pub role_id: EpiphanyRoleResultRoleId, - pub source: ThreadEpiphanyRolesSource, + pub source: EpiphanySurfaceSource, pub binding_id: String, pub state: Option<&'a EpiphanyThreadState>, pub runtime_store_path: Option<&'a Path>, @@ -468,11 +468,12 @@ pub async fn map_epiphany_role_result_response( runtime_store_path, } = input; let protocol_role_id = map_protocol_role_result_role_id(role_id); + let protocol_source = map_protocol_roles_source(source); let Some(state) = state else { return ThreadEpiphanyRoleResultResponse { thread_id, role_id: protocol_role_id, - source, + source: protocol_source, state_status: ThreadEpiphanyReorientStateStatus::Missing, state_revision: None, binding_id, @@ -494,7 +495,7 @@ pub async fn map_epiphany_role_result_response( ThreadEpiphanyRoleResultResponse { thread_id, role_id: protocol_role_id, - source, + source: protocol_source, state_status: ThreadEpiphanyReorientStateStatus::Ready, state_revision: Some(state.revision), binding_id, @@ -509,7 +510,7 @@ pub async fn map_epiphany_role_result_response( pub struct EpiphanyReorientResultResponseInput<'a> { pub thread_id: String, - pub source: ThreadEpiphanyReorientSource, + pub source: EpiphanySurfaceSource, pub binding_id: String, pub state: Option<&'a EpiphanyThreadState>, pub runtime_store_path: Option<&'a Path>, @@ -525,10 +526,11 @@ pub async fn map_epiphany_reorient_result_response( state, runtime_store_path, } = input; + let protocol_source = map_protocol_reorient_result_source(source); let Some(state) = state else { return ThreadEpiphanyReorientResultResponse { thread_id, - source, + source: protocol_source, state_status: ThreadEpiphanyReorientStateStatus::Missing, state_revision: None, binding_id, @@ -549,7 +551,7 @@ pub async fn map_epiphany_reorient_result_response( ThreadEpiphanyReorientResultResponse { thread_id, - source, + source: protocol_source, state_status: ThreadEpiphanyReorientStateStatus::Ready, state_revision: Some(state.revision), binding_id, @@ -560,6 +562,22 @@ pub async fn map_epiphany_reorient_result_response( } } +fn map_protocol_roles_source(source: EpiphanySurfaceSource) -> ThreadEpiphanyRolesSource { + match source { + EpiphanySurfaceSource::Live => ThreadEpiphanyRolesSource::Live, + EpiphanySurfaceSource::Stored => ThreadEpiphanyRolesSource::Stored, + } +} + +fn map_protocol_reorient_result_source( + source: EpiphanySurfaceSource, +) -> ThreadEpiphanyReorientSource { + match source { + EpiphanySurfaceSource::Live => ThreadEpiphanyReorientSource::Live, + EpiphanySurfaceSource::Stored => ThreadEpiphanyReorientSource::Stored, + } +} + pub fn map_epiphany_distill_response( expected_revision: u64, input: EpiphanyDistillInput, diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 34fb781c..8f2a50fb 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -69,6 +69,7 @@ remembers doctrine; the branch remembers the blade. - Context and graph-query response builders now take core `EpiphanyContextParams` / `EpiphanyGraphQuery` documents. App-server read routes convert `ThreadEpiphanyContextParams` / `ThreadEpiphanyGraphQuery` at the JSON-RPC wall before invoking bridge derivation. - Role-result response assembly now takes core `EpiphanyRoleResultRoleId`; `ThreadEpiphanyRoleId` is reconstructed only for the legacy response payload and finding projection. - Distill response assembly now consumes core `EpiphanyDistillInput`; `ThreadEpiphanyDistillParams` is converted before bridge policy invocation. +- Role/reorient result response inputs now use core `EpiphanySurfaceSource`; `ThreadEpiphanyRolesSource` / `ThreadEpiphanyReorientSource` are response projection only. - MCP remains JSON because MCP is a JSON protocol. The latest processor cut only moved MCP refresh/OAuth/status/resource/tool-call route handling into `codex_message_processor/mcp_routes.rs`, reducing the root processor to about 8,977 lines; it did not claim MCP payloads are CultNet or make MCP an Epiphany-owned runtime contract. - Codex account auth route handling remains in vendored Codex but now lives in `codex_message_processor/auth_routes.rs`: API-key login, ChatGPT browser/device-code/external-token login, logout, auth status, account, rate limits, and add-credits nudge handling. This preserves Codex ownership of subscription auth while cutting the root processor to about 8,094 lines. - One-off command execution and command stream write/resize/terminate route handling now live in `codex_message_processor/command_routes.rs`; `CommandExecManager` remains the lifecycle owner, while the root processor is about 7,800 lines. diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 71c42283..c559f691 100644 Binary files a/state/ledgers.msgpack and b/state/ledgers.msgpack differ diff --git a/state/map.yaml b/state/map.yaml index fd326320..de8155df 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -359,7 +359,9 @@ current_status: `EpiphanyRoleResultRoleId` and maps back to `ThreadEpiphanyRoleId` only while shaping the legacy JSON-RPC response. Distill response assembly now consumes core `EpiphanyDistillInput`; the JSON-RPC distill params are - converted before policy invocation. + converted before policy invocation. Role/reorient result response inputs + now use core `EpiphanySurfaceSource`; role-specific legacy source enums are + created only during response projection. The bridge still depends on vendored Codex for app-server protocol DTOs and absolute path validation, so the purification is not done. next_action: Continue Codex starvation and CultNet liberation by cutting bridge-internal `ThreadEpiphany*` authority. Prioritize role-result/reorient-result DTO coupling next: derive typed CultNet surfaces first, push JSON-RPC projection into app-server, and keep MCP/OpenAI JSON only at their true protocol/text edges. Do not add compatibility adapters unless they protect a named ownership invariant. 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 b23fb015..5d0da264 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 @@ -196,9 +196,9 @@ impl CodexMessageProcessor { } }; let source = if loaded_thread.is_some() { - ThreadEpiphanyRolesSource::Live + EpiphanySurfaceSource::Live } else { - ThreadEpiphanyRolesSource::Stored + EpiphanySurfaceSource::Stored }; if let Err(message) = epiphany_role_binding_id(core_role_id) { @@ -394,9 +394,9 @@ impl CodexMessageProcessor { }; let source = if loaded_thread.is_some() { - ThreadEpiphanyReorientSource::Live + EpiphanySurfaceSource::Live } else { - ThreadEpiphanyReorientSource::Stored + EpiphanySurfaceSource::Stored }; let runtime_store_path = if let Some(loaded_thread) = loaded_thread.as_ref() { Some(loaded_thread.epiphany_runtime_spine_store_path().await)