diff --git a/epiphany-codex-bridge/src/view_protocol.rs b/epiphany-codex-bridge/src/view_protocol.rs index 88d0858b..f8cddf8a 100644 --- a/epiphany-codex-bridge/src/view_protocol.rs +++ b/epiphany-codex-bridge/src/view_protocol.rs @@ -39,7 +39,9 @@ use crate::error::EpiphanyBridgeError; use crate::error::Result as BridgeResult; use crate::jobs::map_epiphany_jobs; use crate::pressure::derive_epiphany_pressure; +use crate::protocol_edge::protocol_context_params_to_core; use crate::protocol_edge::protocol_distill_params_to_core; +use crate::protocol_edge::protocol_graph_query_to_core; use crate::protocol_edge::protocol_job_from_surface; use crate::protocol_edge::protocol_pressure_from_core; use crate::protocol_edge::protocol_reorient_decision; @@ -113,6 +115,16 @@ pub fn map_epiphany_context_response( } } +pub fn map_thread_epiphany_context_response( + params: ThreadEpiphanyContextParams, + loaded: bool, + state: Option<&EpiphanyThreadState>, +) -> ThreadEpiphanyContextResponse { + let thread_id = params.thread_id.clone(); + let core_params = protocol_context_params_to_core(¶ms); + map_epiphany_context_response(thread_id, loaded, state, &core_params) +} + pub fn map_epiphany_graph_query_response( thread_id: String, loaded: bool, @@ -138,6 +150,16 @@ pub fn map_epiphany_graph_query_response( } } +pub fn map_thread_epiphany_graph_query_response( + params: ThreadEpiphanyGraphQueryParams, + loaded: bool, + state: Option<&EpiphanyThreadState>, +) -> ThreadEpiphanyGraphQueryResponse { + let thread_id = params.thread_id.clone(); + let core_query = protocol_graph_query_to_core(¶ms.query); + map_epiphany_graph_query_response(thread_id, loaded, state, &core_query) +} + pub struct EpiphanyViewResponseInput<'a> { pub thread_id: String, pub lenses: Vec, diff --git a/notes/epiphany-current-algorithmic-map.md b/notes/epiphany-current-algorithmic-map.md index 426937bc..33f21bcf 100644 --- a/notes/epiphany-current-algorithmic-map.md +++ b/notes/epiphany-current-algorithmic-map.md @@ -1197,10 +1197,15 @@ The app-server handler: 1. parses the thread id. 2. checks whether the thread is loaded so the response can report live/stored source. 3. calls `read_thread_view(..., include_turns: false)` to reuse the live/stored Epiphany projection path. -4. maps protocol selectors into `epiphany-core::EpiphanyContextParams`. -5. calls `epiphany-core::derive_context`. -6. maps the core context view back into the protocol response. -7. returns the derived context shard and missing-id lists. +4. delegates protocol-to-core selector conversion and response projection to + `epiphany-codex-bridge::view_protocol::map_thread_epiphany_context_response`. +5. returns the derived context shard and missing-id lists. + +`map_thread_epiphany_context_response`: + +1. maps protocol selectors into `epiphany-core::EpiphanyContextParams`. +2. calls `epiphany-core::derive_context`. +3. maps the core context view back into the protocol response. `epiphany-core::derive_context`: @@ -1273,10 +1278,15 @@ The app-server handler: 1. parses the thread id. 2. requires a loaded thread. 3. calls `read_thread_view(..., include_turns: false)` to reuse the live Epiphany projection path. -4. maps the protocol query into `epiphany-core::EpiphanyGraphQuery`. -5. calls `epiphany-core::derive_graph_query`. -6. maps the core graph query view back into the protocol response. -7. returns the selected graph records, current frontier/checkpoint, matched selectors, and missing explicit ids. +4. delegates protocol-to-core query conversion and response projection to + `epiphany-codex-bridge::view_protocol::map_thread_epiphany_graph_query_response`. +5. returns the selected graph records, current frontier/checkpoint, matched selectors, and missing explicit ids. + +`map_thread_epiphany_graph_query_response`: + +1. maps the protocol query into `epiphany-core::EpiphanyGraphQuery`. +2. calls `epiphany-core::derive_graph_query`. +3. maps the core graph query view back into the protocol response. `epiphany-core::derive_graph_query`: diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index ed89ca96..8cafaba8 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -856,6 +856,13 @@ missing-state rejection, protocol-to-core input conversion, candidate patch construction, and invalid-request text. App-server supplies the loaded thread state as a host fact and maps bridge errors to JSON-RPC responses. +Context and graph-query route-level conversion followed. App-server still +parses thread ids, loads live/stored thread views, and emits JSON-RPC +responses, but `map_thread_epiphany_context_response` and +`map_thread_epiphany_graph_query_response` now own protocol-to-core selector +conversion plus response projection. `epiphany_read_routes.rs` is about 561 +lines after this cut. + 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 intent/result/receipt documents internally and normal MCP JSON-RPC externally. diff --git a/state/ledgers.cc b/state/ledgers.cc index e3460e78..9dfa15b8 100644 Binary files a/state/ledgers.cc and b/state/ledgers.cc differ diff --git a/state/map.yaml b/state/map.yaml index b39fed78..53633eac 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -82,7 +82,7 @@ active_subgoals: - Use `notes/epiphany-investor-readiness-roadmap.md` as this Codex operator's investor-scale todo rail and as the optional Epiphany Imagination sub-agent planning rail. Angel capital is fuel for compute, review capacity, legal diligence, infrastructure, and public proof, not a governance throne. The operator roadmap is now: make the local Mom MVP a repeatable proof bundle; build the Bifrost-first external-work bridge; add model-spend/review-load/accepted-artifact accounting; prove fresh-repo operation without supervisor contamination; and keep public/operator-safe exports sealed against private worker/operator/agent context. Imagination should translate world-scale Colossus pressure into Bifrost-first Objective Drafts with consent, maintainer review, receipts/ledger evidence, compute/output metrics, public/private export safety, and bounded proof artifacts. - The May 2026 teardown/rebuild migration is archived under `notes/archive/epiphany-ideal-architecture-rebuild-plan.md` unless a concrete regression reopens it. Preserve the new foundation: Epiphany view/coordinator policy lives in `epiphany-core`, runtime-spine owns job/result lifecycle identity through `runtime_links`, duplicate acceptance is receipt-keyed, public findings stay typed/sealed, view expansion requires a core contract, and app-server remains routing/adaptation rather than a second policy throne. - Treat Phase 5 update/distill/propose/promote/read/notification as complete enough unless a concrete regression appears; distill/propose route-level response construction now lives in the bridge, with app-server supplying loaded-thread state as host fact and mapping bridge errors to JSON-RPC. - - Preserve read-only boundaries for retrieve, distill, propose, freshness, context, graphQuery, roleResult, reorientResult, and the canonical view lenses for scene, jobs, roles, planning, pressure, reorient, crrc, and coordinator. + - Preserve read-only boundaries for retrieve, distill, propose, freshness, context, graphQuery, roleResult, reorientResult, and the canonical view lenses for scene, jobs, roles, planning, pressure, reorient, crrc, and coordinator; context/graphQuery route-level DTO-to-core conversion now lives in bridge view protocol mappers rather than app-server read routes. - Use `notes/epiphany-memory-graph-unified-plan.md` as the source-grounded memory architecture direction. The repo fractal dataflow graph and agent memory are one `EpiphanyMemoryGraph` substrate with repo, role, short-term, incubation, agency, candidate-intervention, and evidence profiles. Qdrant stores rebuildable semantic embeddings for typed graph documents; it is never canonical memory. The first live skeleton now exists in `epiphany-state-model` plus `epiphany-core::memory_graph`: typed graph documents, stable ids, profile/lifecycle validation, freshness propagation, context cuts, a CultCache store seam, and the native `epiphany-memory-graph` status/validate/context/smoke CLI. Do not add repo scanners, sleep runners, Qdrant cache plumbing, CultNet advertisement, or prompt integration before routing them through this shared substrate. - Keep the landed Phase 6 coordinator, limited safe-boundary CRRC automation, and pre-compaction checkpoint intervention ready for the next bridge-equipped dogfood run. - Preserve the Ghostlight-derived heartbeat initiative seam: every lane, including coordinator/Self and Persona, has a organ-state record and competes for heartbeat slots through readiness/reaction timing; initiative heat can raise or cool global, group, arena, role, and agent tempo through typed heartbeat policy; active thinking freezes initiative until completion, so heat never queues a lane already mid-turn; idle winners ruminate instead of inventing project work, and sleep windows distill the accumulated thought pressure into reviewed self-memory or doctrine. 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 022b69fa..09166ddf 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 @@ -12,9 +12,7 @@ use epiphany_codex_bridge::protocol_edge::core_epiphany_view_needs_pressure; use epiphany_codex_bridge::protocol_edge::core_epiphany_view_needs_reorientation_inputs; use epiphany_codex_bridge::protocol_edge::core_epiphany_view_needs_runtime_store; use epiphany_codex_bridge::protocol_edge::default_core_epiphany_view_lenses; -use epiphany_codex_bridge::protocol_edge::protocol_context_params_to_core; use epiphany_codex_bridge::protocol_edge::protocol_freshness_response_from_surface; -use epiphany_codex_bridge::protocol_edge::protocol_graph_query_to_core; use epiphany_codex_bridge::protocol_edge::protocol_role_id_to_core; use epiphany_codex_bridge::protocol_edge::protocol_view_lenses_to_core; use epiphany_codex_bridge::retrieve::epiphany_retrieval_state_for_paths; @@ -24,12 +22,12 @@ use epiphany_codex_bridge::view_protocol::EpiphanyReorientResultResponseInput; use epiphany_codex_bridge::view_protocol::EpiphanyRoleResultResponseInput; use epiphany_codex_bridge::view_protocol::EpiphanyViewResponseInput; use epiphany_codex_bridge::view_protocol::derive_epiphany_freshness_surface; -use epiphany_codex_bridge::view_protocol::map_epiphany_context_response; -use epiphany_codex_bridge::view_protocol::map_epiphany_graph_query_response; use epiphany_codex_bridge::view_protocol::map_epiphany_reorient_result_response; use epiphany_codex_bridge::view_protocol::map_epiphany_role_result_response; use epiphany_codex_bridge::view_protocol::map_epiphany_view_response; +use epiphany_codex_bridge::view_protocol::map_thread_epiphany_context_response; use epiphany_codex_bridge::view_protocol::map_thread_epiphany_distill_response; +use epiphany_codex_bridge::view_protocol::map_thread_epiphany_graph_query_response; use epiphany_codex_bridge::view_protocol::map_thread_epiphany_propose_response; use super::CodexMessageProcessor; @@ -308,13 +306,8 @@ impl CodexMessageProcessor { } }; - let core_params = protocol_context_params_to_core(¶ms); - let response = map_epiphany_context_response( - thread_id, - loaded, - thread.epiphany_state.as_ref(), - &core_params, - ); + let response = + map_thread_epiphany_context_response(params, loaded, thread.epiphany_state.as_ref()); self.outgoing.send_response(request_id, response).await; } @@ -346,12 +339,10 @@ impl CodexMessageProcessor { } }; - let core_query = protocol_graph_query_to_core(¶ms.query); - let response = map_epiphany_graph_query_response( - thread_id, + let response = map_thread_epiphany_graph_query_response( + params, loaded, thread.epiphany_state.as_ref(), - &core_query, ); self.outgoing.send_response(request_id, response).await; }