diff --git a/epiphany-codex-bridge/src/context.rs b/epiphany-codex-bridge/src/context.rs index 0f7bf74f..e7eb8405 100644 --- a/epiphany-codex-bridge/src/context.rs +++ b/epiphany-codex-bridge/src/context.rs @@ -34,24 +34,27 @@ use epiphany_state_model::EpiphanyThreadState; pub fn map_epiphany_context( state: Option<&EpiphanyThreadState>, - params: &ThreadEpiphanyContextParams, + params: &CoreEpiphanyContextParams, ) -> ( ThreadEpiphanyContextStateStatus, Option, ThreadEpiphanyContext, ThreadEpiphanyContextMissing, ) { - map_core_epiphany_context_view(derive_context( - state, - &CoreEpiphanyContextParams { - graph_node_ids: params.graph_node_ids.clone(), - graph_edge_ids: params.graph_edge_ids.clone(), - observation_ids: params.observation_ids.clone(), - evidence_ids: params.evidence_ids.clone(), - include_active_frontier: params.include_active_frontier, - include_linked_evidence: params.include_linked_evidence, - }, - )) + map_core_epiphany_context_view(derive_context(state, params)) +} + +pub fn map_core_epiphany_context_params( + params: &ThreadEpiphanyContextParams, +) -> CoreEpiphanyContextParams { + CoreEpiphanyContextParams { + graph_node_ids: params.graph_node_ids.clone(), + graph_edge_ids: params.graph_edge_ids.clone(), + observation_ids: params.observation_ids.clone(), + evidence_ids: params.evidence_ids.clone(), + include_active_frontier: params.include_active_frontier, + include_linked_evidence: params.include_linked_evidence, + } } fn map_core_epiphany_context_view( @@ -161,7 +164,7 @@ fn map_core_epiphany_planning_summary( pub fn map_epiphany_graph_query( state: Option<&EpiphanyThreadState>, - query: &ThreadEpiphanyGraphQuery, + query: &CoreEpiphanyGraphQuery, ) -> ( ThreadEpiphanyContextStateStatus, Option, @@ -171,13 +174,10 @@ pub fn map_epiphany_graph_query( ThreadEpiphanyGraphQueryMatched, ThreadEpiphanyGraphQueryMissing, ) { - map_core_epiphany_graph_query_view(derive_graph_query( - state, - &map_core_epiphany_graph_query(query), - )) + map_core_epiphany_graph_query_view(derive_graph_query(state, query)) } -fn map_core_epiphany_graph_query(query: &ThreadEpiphanyGraphQuery) -> CoreEpiphanyGraphQuery { +pub fn map_core_epiphany_graph_query(query: &ThreadEpiphanyGraphQuery) -> CoreEpiphanyGraphQuery { CoreEpiphanyGraphQuery { kind: map_core_epiphany_graph_query_kind(query.kind), node_ids: query.node_ids.clone(), diff --git a/epiphany-codex-bridge/src/view.rs b/epiphany-codex-bridge/src/view.rs index cc895274..f432020f 100644 --- a/epiphany-codex-bridge/src/view.rs +++ b/epiphany-codex-bridge/src/view.rs @@ -11,6 +11,8 @@ use epiphany_core::propose_map_update; use epiphany_state_model::EpiphanyRetrievalState; use epiphany_state_model::EpiphanyThreadState; +use crate::context::map_core_epiphany_context_params; +use crate::context::map_core_epiphany_graph_query; use crate::context::map_epiphany_context; use crate::context::map_epiphany_graph_query; use crate::context::map_epiphany_planning; @@ -116,7 +118,9 @@ pub fn map_epiphany_context_response( state: Option<&EpiphanyThreadState>, params: &ThreadEpiphanyContextParams, ) -> ThreadEpiphanyContextResponse { - let (state_status, state_revision, context, missing) = map_epiphany_context(state, params); + let core_params = map_core_epiphany_context_params(params); + let (state_status, state_revision, context, missing) = + map_epiphany_context(state, &core_params); ThreadEpiphanyContextResponse { thread_id, source: if loaded { @@ -137,8 +141,9 @@ pub fn map_epiphany_graph_query_response( state: Option<&EpiphanyThreadState>, query: &ThreadEpiphanyGraphQuery, ) -> ThreadEpiphanyGraphQueryResponse { + let core_query = map_core_epiphany_graph_query(query); let (state_status, state_revision, graph, frontier, checkpoint, matched, missing) = - map_epiphany_graph_query(state, query); + map_epiphany_graph_query(state, &core_query); ThreadEpiphanyGraphQueryResponse { thread_id, source: if loaded { diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index d98da21f..87394f4b 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -58,6 +58,7 @@ remembers doctrine; the branch remembers the blade. - Role acceptance now applies core `EpiphanyStateUpdate` from typed findings; `ThreadEpiphanyUpdatePatch` survives in that path only as legacy accept-response projection. - Role-board derivation consumes core `EpiphanyPressure` directly now; `ThreadEpiphanyPressure` is only response projection. - Job reflection is now core-shaped inside the bridge. `map_epiphany_jobs` returns typed `EpiphanyJobView`, role-board/view/result assembly consumes that typed job surface, and `ThreadEpiphanyJob` is projected only when building legacy JSON-RPC response structs. +- Context and graph-query derivation now receive core `EpiphanyContextParams` / `EpiphanyGraphQuery` documents. The bridge converts `ThreadEpiphanyContextParams` / `ThreadEpiphanyGraphQuery` before invoking core policy, so Codex JSON-RPC request DTOs no longer define the internal graph question. - 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 01650bd2..1f179bf1 100644 Binary files a/state/ledgers.msgpack and b/state/ledgers.msgpack differ diff --git a/state/map.yaml b/state/map.yaml index 594e058d..baea67ba 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -331,7 +331,10 @@ current_status: pressure directly instead of `ThreadEpiphanyPressure`. Job reflection now stays core-shaped inside the bridge as `EpiphanyJobView`; role-board and view assembly consume those typed job documents, and `ThreadEpiphanyJob` is - projected only at legacy response edges. The bridge still depends on - vendored Codex for app-server protocol DTOs and absolute path validation, - so the purification is not done. + projected only at legacy response edges. Context and graph-query derivation + now receive core `EpiphanyContextParams` / `EpiphanyGraphQuery` documents; + Codex `ThreadEpiphany*` request DTOs are converted before the core graph + policy is invoked. 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.