Move context request mapping to app server
This commit is contained in:
parent
fc6976687f
commit
157f1f0864
5 changed files with 63 additions and 61 deletions
|
|
@ -1,11 +1,7 @@
|
|||
use codex_app_server_protocol::ThreadEpiphanyContext;
|
||||
use codex_app_server_protocol::ThreadEpiphanyContextMissing;
|
||||
use codex_app_server_protocol::ThreadEpiphanyContextParams;
|
||||
use codex_app_server_protocol::ThreadEpiphanyContextStateStatus;
|
||||
use codex_app_server_protocol::ThreadEpiphanyGraphContext;
|
||||
use codex_app_server_protocol::ThreadEpiphanyGraphQuery;
|
||||
use codex_app_server_protocol::ThreadEpiphanyGraphQueryDirection;
|
||||
use codex_app_server_protocol::ThreadEpiphanyGraphQueryKind;
|
||||
use codex_app_server_protocol::ThreadEpiphanyGraphQueryMatched;
|
||||
use codex_app_server_protocol::ThreadEpiphanyGraphQueryMissing;
|
||||
use codex_app_server_protocol::ThreadEpiphanyPlanningSummary;
|
||||
|
|
@ -16,8 +12,6 @@ use epiphany_core::EpiphanyContextStateStatus as CoreEpiphanyContextStateStatus;
|
|||
use epiphany_core::EpiphanyContextView;
|
||||
use epiphany_core::EpiphanyGraphContext as CoreEpiphanyGraphContext;
|
||||
use epiphany_core::EpiphanyGraphQuery as CoreEpiphanyGraphQuery;
|
||||
use epiphany_core::EpiphanyGraphQueryDirection as CoreEpiphanyGraphQueryDirection;
|
||||
use epiphany_core::EpiphanyGraphQueryKind as CoreEpiphanyGraphQueryKind;
|
||||
use epiphany_core::EpiphanyGraphQueryMatched as CoreEpiphanyGraphQueryMatched;
|
||||
use epiphany_core::EpiphanyGraphQueryMissing as CoreEpiphanyGraphQueryMissing;
|
||||
use epiphany_core::EpiphanyGraphQueryView;
|
||||
|
|
@ -44,19 +38,6 @@ pub fn map_epiphany_context(
|
|||
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(
|
||||
view: EpiphanyContextView,
|
||||
) -> (
|
||||
|
|
@ -177,43 +158,6 @@ pub fn map_epiphany_graph_query(
|
|||
map_core_epiphany_graph_query_view(derive_graph_query(state, query))
|
||||
}
|
||||
|
||||
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(),
|
||||
edge_ids: query.edge_ids.clone(),
|
||||
paths: query.paths.clone(),
|
||||
symbols: query.symbols.clone(),
|
||||
edge_kinds: query.edge_kinds.clone(),
|
||||
direction: query.direction.map(map_core_epiphany_graph_query_direction),
|
||||
depth: query.depth,
|
||||
include_links: query.include_links,
|
||||
}
|
||||
}
|
||||
|
||||
fn map_core_epiphany_graph_query_kind(
|
||||
kind: ThreadEpiphanyGraphQueryKind,
|
||||
) -> CoreEpiphanyGraphQueryKind {
|
||||
match kind {
|
||||
ThreadEpiphanyGraphQueryKind::Node => CoreEpiphanyGraphQueryKind::Node,
|
||||
ThreadEpiphanyGraphQueryKind::Path => CoreEpiphanyGraphQueryKind::Path,
|
||||
ThreadEpiphanyGraphQueryKind::FrontierNeighborhood => {
|
||||
CoreEpiphanyGraphQueryKind::FrontierNeighborhood
|
||||
}
|
||||
ThreadEpiphanyGraphQueryKind::Neighbors => CoreEpiphanyGraphQueryKind::Neighbors,
|
||||
}
|
||||
}
|
||||
|
||||
fn map_core_epiphany_graph_query_direction(
|
||||
direction: ThreadEpiphanyGraphQueryDirection,
|
||||
) -> CoreEpiphanyGraphQueryDirection {
|
||||
match direction {
|
||||
ThreadEpiphanyGraphQueryDirection::Incoming => CoreEpiphanyGraphQueryDirection::Incoming,
|
||||
ThreadEpiphanyGraphQueryDirection::Outgoing => CoreEpiphanyGraphQueryDirection::Outgoing,
|
||||
ThreadEpiphanyGraphQueryDirection::Both => CoreEpiphanyGraphQueryDirection::Both,
|
||||
}
|
||||
}
|
||||
|
||||
fn map_core_epiphany_graph_query_view(
|
||||
view: EpiphanyGraphQueryView,
|
||||
) -> (
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ remembers doctrine; the branch remembers the blade.
|
|||
- Coordinator judgment is no longer bridge-owned. `epiphany-core` now exposes `EpiphanyCoordinatorStatusInput` -> `EpiphanyCoordinatorStatus`; the bridge gathers runtime snapshots and accepted-finding facts, then core derives source signals and the coordinator decision. Reorient worker launch composition is also core-owned through `EpiphanyReorientLaunchRequestInput` -> `EpiphanyJobLaunchRequest`; bridge supplies the prompt instruction plus retained compatibility binding/owner constants and performs the host launch side effect.
|
||||
- Coordinator finding signals are also core-owned. `derive_coordinator_finding_signals` derives modeling/verification/reorient accepted, reviewable, coverage, verdict, and evidence sequencing facts from typed findings plus `EpiphanyThreadState`; the bridge now loads snapshots/state and projects legacy JSON-RPC responses instead of keeping a duplicate acceptance tribunal.
|
||||
- View lens selector semantics are core-owned now. `EpiphanyViewLens`, default view lenses, and lens dependency planning live in `epiphany-core`; app-server converts JSON-RPC lens params to core selectors and asks core which jobs/pressure/runtime/reorientation facts must be loaded.
|
||||
- Context and graph-query request conversion now belongs to the app-server JSON-RPC wall. `epiphany-codex-bridge::context` receives core `EpiphanyContextParams` / `EpiphanyGraphQuery` and only projects core context/query views back into legacy response DTOs.
|
||||
- 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.
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -381,7 +381,10 @@ current_status:
|
|||
sequencing facts are no longer bridge helper law. View lens selector
|
||||
semantics also moved into core: `EpiphanyViewLens`, default lens selection,
|
||||
and lens dependency planning now decide which host facts app-server/bridge
|
||||
need to load before legacy response projection. Reorient worker launch-request/document
|
||||
need to load before legacy response projection. Context and graph-query
|
||||
request DTO conversion moved to the app-server JSON-RPC wall, so the bridge
|
||||
receives core `EpiphanyContextParams` / `EpiphanyGraphQuery` documents
|
||||
instead of owning request-side protocol mapping. Reorient worker launch-request/document
|
||||
composition also moved behind a typed core seam
|
||||
(`EpiphanyReorientLaunchRequestInput` -> `EpiphanyJobLaunchRequest`);
|
||||
bridge supplies only the prompt instruction and retained compatibility
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@ use codex_app_server_protocol::*;
|
|||
use codex_core::CodexThread;
|
||||
use codex_protocol::ThreadId;
|
||||
use codex_protocol::protocol::EpiphanyRetrievalState;
|
||||
use epiphany_codex_bridge::context::map_core_epiphany_context_params;
|
||||
use epiphany_codex_bridge::context::map_core_epiphany_graph_query;
|
||||
use epiphany_codex_bridge::cultnet::EpiphanyFreshnessSurface;
|
||||
use epiphany_codex_bridge::cultnet::EpiphanyGraphFreshnessStatus;
|
||||
use epiphany_codex_bridge::cultnet::EpiphanyInvalidationStatus;
|
||||
|
|
@ -31,6 +29,10 @@ 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::EpiphanyContextParams;
|
||||
use epiphany_core::EpiphanyGraphQuery;
|
||||
use epiphany_core::EpiphanyGraphQueryDirection;
|
||||
use epiphany_core::EpiphanyGraphQueryKind;
|
||||
use epiphany_core::default_epiphany_view_lenses;
|
||||
use epiphany_core::epiphany_view_needs_jobs;
|
||||
use epiphany_core::epiphany_view_needs_pressure;
|
||||
|
|
@ -313,7 +315,7 @@ impl CodexMessageProcessor {
|
|||
}
|
||||
};
|
||||
|
||||
let core_params = map_core_epiphany_context_params(¶ms);
|
||||
let core_params = thread_epiphany_context_params_to_core(¶ms);
|
||||
let response = map_epiphany_context_response(
|
||||
thread_id,
|
||||
loaded,
|
||||
|
|
@ -351,7 +353,7 @@ impl CodexMessageProcessor {
|
|||
}
|
||||
};
|
||||
|
||||
let core_query = map_core_epiphany_graph_query(¶ms.query);
|
||||
let core_query = thread_epiphany_graph_query_to_core(¶ms.query);
|
||||
let response = map_epiphany_graph_query_response(
|
||||
thread_id,
|
||||
loaded,
|
||||
|
|
@ -584,6 +586,58 @@ impl CodexMessageProcessor {
|
|||
}
|
||||
}
|
||||
|
||||
fn thread_epiphany_context_params_to_core(
|
||||
params: &ThreadEpiphanyContextParams,
|
||||
) -> EpiphanyContextParams {
|
||||
EpiphanyContextParams {
|
||||
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 thread_epiphany_graph_query_to_core(query: &ThreadEpiphanyGraphQuery) -> EpiphanyGraphQuery {
|
||||
EpiphanyGraphQuery {
|
||||
kind: thread_epiphany_graph_query_kind_to_core(query.kind),
|
||||
node_ids: query.node_ids.clone(),
|
||||
edge_ids: query.edge_ids.clone(),
|
||||
paths: query.paths.clone(),
|
||||
symbols: query.symbols.clone(),
|
||||
edge_kinds: query.edge_kinds.clone(),
|
||||
direction: query
|
||||
.direction
|
||||
.map(thread_epiphany_graph_query_direction_to_core),
|
||||
depth: query.depth,
|
||||
include_links: query.include_links,
|
||||
}
|
||||
}
|
||||
|
||||
fn thread_epiphany_graph_query_kind_to_core(
|
||||
kind: ThreadEpiphanyGraphQueryKind,
|
||||
) -> EpiphanyGraphQueryKind {
|
||||
match kind {
|
||||
ThreadEpiphanyGraphQueryKind::Node => EpiphanyGraphQueryKind::Node,
|
||||
ThreadEpiphanyGraphQueryKind::Path => EpiphanyGraphQueryKind::Path,
|
||||
ThreadEpiphanyGraphQueryKind::FrontierNeighborhood => {
|
||||
EpiphanyGraphQueryKind::FrontierNeighborhood
|
||||
}
|
||||
ThreadEpiphanyGraphQueryKind::Neighbors => EpiphanyGraphQueryKind::Neighbors,
|
||||
}
|
||||
}
|
||||
|
||||
fn thread_epiphany_graph_query_direction_to_core(
|
||||
direction: ThreadEpiphanyGraphQueryDirection,
|
||||
) -> EpiphanyGraphQueryDirection {
|
||||
match direction {
|
||||
ThreadEpiphanyGraphQueryDirection::Incoming => EpiphanyGraphQueryDirection::Incoming,
|
||||
ThreadEpiphanyGraphQueryDirection::Outgoing => EpiphanyGraphQueryDirection::Outgoing,
|
||||
ThreadEpiphanyGraphQueryDirection::Both => EpiphanyGraphQueryDirection::Both,
|
||||
}
|
||||
}
|
||||
|
||||
fn thread_epiphany_freshness_response_from_surface(
|
||||
surface: EpiphanyFreshnessSurface,
|
||||
) -> ThreadEpiphanyFreshnessResponse {
|
||||
|
|
|
|||
Reference in a new issue