From b3829e1689261465a2069cbcf1f3ffa496af5818 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 20 May 2026 02:21:43 +0100 Subject: [PATCH] Keep context queries core-shaped --- epiphany-codex-bridge/src/context.rs | 36 +++++++++++++-------------- epiphany-codex-bridge/src/view.rs | 9 +++++-- notes/fresh-workspace-handoff.md | 1 + state/ledgers.msgpack | Bin 136882 -> 137142 bytes state/map.yaml | 9 ++++--- 5 files changed, 32 insertions(+), 23 deletions(-) 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 01650bd201caa72f3a9b215afc01257996477ac4..1f179bf17f2874415c25364fb189ce62230520b8 100644 GIT binary patch delta 290 zcmdnAmSfv`jtR<4;x!vp3mF-^nx`|iPiJJ@KAn+?O;l*gP9p;&GhG8yT_b}K14An# z!^s<`%hX?W&d)1Jtte3_EKMz{R7fr@u~JAX%1lX5RY-=)B<7_kq!%R?WavWFq@)&Q zmL-;C=I1Ho<(DgzBxZxu7Nsh<7GxG=B<58@jSNUEO3W=*0BMKGxPy!d1lyF7pIn-o znv+*jY^~s&pORXk5Ry@pnwSDps!)^)w63^B!6n2WXb8}FpnJ+vi%L>c6p~WYK=x(k emE~t==A}by2Rl)rAU`KFxl(Tnx@WD74Wa