Extract Epiphany context projection
This commit is contained in:
parent
51c42135f2
commit
1aa70f9890
7 changed files with 274 additions and 259 deletions
|
|
@ -416,18 +416,20 @@ The fourth cut moved scene projection into
|
|||
`vendor/codex/codex-rs/app-server/src/epiphany_scene.rs`, taking the processor
|
||||
to about 20,059 lines. The fifth cut moved freshness/reorientation input
|
||||
mapping into `vendor/codex/codex-rs/app-server/src/epiphany_reorient.rs`,
|
||||
taking the processor to about 19,708 lines. This is progress, not absolution:
|
||||
handlers, context/planning/graph/jobs/roles/coordinator mappers, route
|
||||
orchestration, accept policy plumbing, and tests still keep too much Epiphany
|
||||
inside Codex.
|
||||
taking the processor to about 19,708 lines. The sixth cut moved
|
||||
context/planning/graph-query projection into
|
||||
`vendor/codex/codex-rs/app-server/src/epiphany_context.rs`, taking the processor
|
||||
to about 19,462 lines. This is progress, not absolution: handlers,
|
||||
jobs/roles/coordinator mappers, route orchestration, accept policy plumbing, and
|
||||
tests still keep too much Epiphany inside Codex.
|
||||
|
||||
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.
|
||||
|
||||
Continue with the actual whale-carcass cut: extract Epiphany route handlers,
|
||||
result/projection mappers, coordinator glue, and remaining policy-shaped code
|
||||
out of `codex_message_processor.rs` into Epiphany-owned app-server modules,
|
||||
Continue with the actual whale-carcass cut: extract Epiphany jobs/roles/
|
||||
coordinator projection mappers, route handlers, and remaining policy-shaped
|
||||
code out of `codex_message_processor.rs` into Epiphany-owned app-server modules,
|
||||
moving logic further into `epiphany-core` whenever it owns real policy. Success
|
||||
is a visibly smaller `codex_message_processor.rs`, not merely nicer payload
|
||||
names. Do not resume Rider, Unity, Aquarium, Face, dogfood, planning, app,
|
||||
|
|
|
|||
|
|
@ -62,6 +62,6 @@ Rule: JSON is allowed at external schema/wire boundaries. Inside Epiphany, live
|
|||
3. Done: replace role `statePatch` JSON with typed map/planning/graph patch documents. `EpiphanyRoleFindingInterpretation` now carries `EpiphanyRoleStatePatchDocument`; app-server maps it to the legacy protocol patch without JSON round-tripping.
|
||||
4. Done: replace runtime job result JSON projections. Runtime-spine results now project through typed role/reorient interpreters instead of `runtime_job_result_to_role_json` and `runtime_job_result_to_reorient_json`.
|
||||
5. Done: replace app-server launch protocol `input_json` / `output_schema_json` with typed launch documents and `output_contract_id`.
|
||||
6. Continue the whale-carcass cut: the first cuts moved Epiphany launch doctrine and protocol-to-core launch document mapping into `epiphany_launch.rs`, role/reorient result projection into `epiphany_results.rs`, scene projection into `epiphany_scene.rs`, and freshness/reorientation mapping into `epiphany_reorient.rs`, reducing `codex_message_processor.rs` from about 21,263 to 19,708 lines. Next move route handlers, remaining view projection mappers, coordinator glue, and policy-shaped code out of the processor; success means the processor keeps shrinking and ownership gets clearer, not merely better typed.
|
||||
6. Continue the whale-carcass cut: the first cuts moved Epiphany launch doctrine and protocol-to-core launch document mapping into `epiphany_launch.rs`, role/reorient result projection into `epiphany_results.rs`, scene projection into `epiphany_scene.rs`, freshness/reorientation mapping into `epiphany_reorient.rs`, and context/planning/graph-query projection into `epiphany_context.rs`, reducing `codex_message_processor.rs` from about 21,263 to 19,462 lines. Next move jobs/roles/coordinator projection mappers, route handlers, and policy-shaped code out of the processor; success means the processor keeps shrinking and ownership gets clearer, not merely better typed.
|
||||
7. Seal MCP payloads behind an Epiphany boundary that speaks typed Epiphany documents internally and MCP JSON externally.
|
||||
8. Audit heartbeat cognition values and either type them or explicitly expire them.
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -278,5 +278,5 @@ rejected_paths:
|
|||
reason: making Epiphany cleaner inside Codex still preserves the wrong organ; Codex must be starved down to OpenAI subscription auth/model transport, while Epiphany data and subsystem communication move to typed CultCache/CultNet.
|
||||
|
||||
current_status:
|
||||
summary: The Codex starvation pass has five typing receipts plus five real carcass cuts: Epiphany launch doctrine/prompt/builders and protocol-to-core launch document mapping moved into `vendor/codex/codex-rs/app-server/src/epiphany_launch.rs`, role/reorient result projection/note rendering moved into `vendor/codex/codex-rs/app-server/src/epiphany_results.rs`, scene projection moved into `vendor/codex/codex-rs/app-server/src/epiphany_scene.rs`, and freshness/reorientation input mapping moved into `vendor/codex/codex-rs/app-server/src/epiphany_reorient.rs`. The processor is down from about 21,263 lines to 19,708 lines. This is progress, not absolution: route handlers, context/planning/graph/jobs/roles/coordinator mappers, accept policy plumbing, and tests still keep too much Epiphany inside Codex. MCP itself is correctly JSON at its protocol edge; the target is typed Epiphany intent/result/receipt wrappers around MCP, not replacing MCP JSON.
|
||||
next_action: Continue the actual whale-carcass cut: extract Epiphany route handlers, scene/view projection mappers, coordinator glue, and remaining policy-shaped code out of `codex_message_processor.rs` into Epiphany-owned app-server modules, moving logic further into `epiphany-core` whenever it owns real policy. Success metric remains a visibly smaller processor and clearer ownership, not merely typed payloads.
|
||||
summary: The Codex starvation pass has five typing receipts plus six real carcass cuts: Epiphany launch doctrine/prompt/builders and protocol-to-core launch document mapping moved into `vendor/codex/codex-rs/app-server/src/epiphany_launch.rs`, role/reorient result projection/note rendering moved into `vendor/codex/codex-rs/app-server/src/epiphany_results.rs`, scene projection moved into `vendor/codex/codex-rs/app-server/src/epiphany_scene.rs`, freshness/reorientation input mapping moved into `vendor/codex/codex-rs/app-server/src/epiphany_reorient.rs`, and context/planning/graph-query projection moved into `vendor/codex/codex-rs/app-server/src/epiphany_context.rs`. The processor is down from about 21,263 lines to 19,462 lines. This is progress, not absolution: route handlers, jobs/roles/coordinator mappers, accept policy plumbing, and tests still keep too much Epiphany inside Codex. MCP itself is correctly JSON at its protocol edge; the target is typed Epiphany intent/result/receipt wrappers around MCP, not replacing MCP JSON.
|
||||
next_action: Continue the actual whale-carcass cut: extract Epiphany jobs/roles/coordinator projection mappers and then route handlers out of `codex_message_processor.rs` into Epiphany-owned app-server modules, moving logic further into `epiphany-core` whenever it owns real policy. Success metric remains a visibly smaller processor and clearer ownership, not merely typed payloads.
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@ use crate::bespoke_event_handling::maybe_emit_hook_prompt_item_completed;
|
|||
use crate::command_exec::CommandExecManager;
|
||||
use crate::command_exec::StartCommandExecParams;
|
||||
use crate::config_manager::ConfigManager;
|
||||
use crate::epiphany_context::map_epiphany_context;
|
||||
use crate::epiphany_context::map_epiphany_graph_query;
|
||||
use crate::epiphany_context::map_epiphany_planning;
|
||||
use crate::epiphany_invalidation::EpiphanyInvalidationManager;
|
||||
use crate::epiphany_invalidation::EpiphanyInvalidationSnapshot;
|
||||
use crate::epiphany_launch::EPIPHANY_IMAGINATION_OWNER_ROLE;
|
||||
|
|
@ -180,7 +183,6 @@ use codex_app_server_protocol::ThreadCompactStartResponse;
|
|||
use codex_app_server_protocol::ThreadDecrementElicitationParams;
|
||||
use codex_app_server_protocol::ThreadDecrementElicitationResponse;
|
||||
use codex_app_server_protocol::ThreadEpiphanyContext;
|
||||
use codex_app_server_protocol::ThreadEpiphanyContextMissing;
|
||||
use codex_app_server_protocol::ThreadEpiphanyContextParams;
|
||||
use codex_app_server_protocol::ThreadEpiphanyContextResponse;
|
||||
use codex_app_server_protocol::ThreadEpiphanyContextSource;
|
||||
|
|
@ -194,14 +196,11 @@ use codex_app_server_protocol::ThreadEpiphanyDistillResponse;
|
|||
use codex_app_server_protocol::ThreadEpiphanyFreshnessParams;
|
||||
use codex_app_server_protocol::ThreadEpiphanyFreshnessResponse;
|
||||
use codex_app_server_protocol::ThreadEpiphanyFreshnessSource;
|
||||
use codex_app_server_protocol::ThreadEpiphanyGraphContext;
|
||||
use codex_app_server_protocol::ThreadEpiphanyGraphFreshness;
|
||||
use codex_app_server_protocol::ThreadEpiphanyGraphFreshnessStatus;
|
||||
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::ThreadEpiphanyGraphQueryParams;
|
||||
use codex_app_server_protocol::ThreadEpiphanyGraphQueryResponse;
|
||||
use codex_app_server_protocol::ThreadEpiphanyIndexParams;
|
||||
|
|
@ -215,7 +214,6 @@ use codex_app_server_protocol::ThreadEpiphanyJobKind;
|
|||
use codex_app_server_protocol::ThreadEpiphanyJobLaunchParams;
|
||||
use codex_app_server_protocol::ThreadEpiphanyJobLaunchResponse;
|
||||
use codex_app_server_protocol::ThreadEpiphanyJobStatus;
|
||||
use codex_app_server_protocol::ThreadEpiphanyPlanningSummary;
|
||||
use codex_app_server_protocol::ThreadEpiphanyPressure;
|
||||
use codex_app_server_protocol::ThreadEpiphanyPressureBasis;
|
||||
use codex_app_server_protocol::ThreadEpiphanyPressureLevel;
|
||||
|
|
@ -468,7 +466,6 @@ use codex_protocol::protocol::EpiphanyEvidenceRecord;
|
|||
use codex_protocol::protocol::EpiphanyInvestigationCheckpoint;
|
||||
use codex_protocol::protocol::EpiphanyInvestigationDisposition;
|
||||
use codex_protocol::protocol::EpiphanyJobKind as CoreEpiphanyJobKind;
|
||||
use codex_protocol::protocol::EpiphanyPlanningState;
|
||||
use codex_protocol::protocol::EpiphanyRetrievalState;
|
||||
use codex_protocol::protocol::EpiphanyRetrievalStatus;
|
||||
use codex_protocol::protocol::EpiphanyRuntimeLink;
|
||||
|
|
@ -516,11 +513,6 @@ use codex_thread_store::ThreadStoreError;
|
|||
use codex_thread_store::UpdateThreadMetadataParams as StoreUpdateThreadMetadataParams;
|
||||
use codex_utils_absolute_path::AbsolutePathBuf;
|
||||
use codex_utils_pty::DEFAULT_OUTPUT_BYTES_CAP;
|
||||
use epiphany_core::EpiphanyContext as CoreEpiphanyContext;
|
||||
use epiphany_core::EpiphanyContextMissing as CoreEpiphanyContextMissing;
|
||||
use epiphany_core::EpiphanyContextParams as CoreEpiphanyContextParams;
|
||||
use epiphany_core::EpiphanyContextStateStatus as CoreEpiphanyContextStateStatus;
|
||||
use epiphany_core::EpiphanyContextView;
|
||||
use epiphany_core::EpiphanyCoordinatorAction as CoreEpiphanyCoordinatorAction;
|
||||
use epiphany_core::EpiphanyCoordinatorAutomationAction as CoreEpiphanyCoordinatorAutomationAction;
|
||||
use epiphany_core::EpiphanyCoordinatorCrrcRecommendation;
|
||||
|
|
@ -539,19 +531,9 @@ use epiphany_core::EpiphanyCrrcReorientAction as CoreEpiphanyCrrcReorientAction;
|
|||
use epiphany_core::EpiphanyCrrcResultStatus as CoreEpiphanyCrrcResultStatus;
|
||||
use epiphany_core::EpiphanyCrrcSceneAction as CoreEpiphanyCrrcSceneAction;
|
||||
use epiphany_core::EpiphanyCrrcStateStatus as CoreEpiphanyCrrcStateStatus;
|
||||
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;
|
||||
use epiphany_core::EpiphanyJobStatus as CoreEpiphanyJobStatus;
|
||||
use epiphany_core::EpiphanyJobView;
|
||||
use epiphany_core::EpiphanyJobsInput;
|
||||
use epiphany_core::EpiphanyPlanningStateStatus as CoreEpiphanyPlanningStateStatus;
|
||||
use epiphany_core::EpiphanyPlanningSummary as CoreEpiphanyPlanningSummary;
|
||||
use epiphany_core::EpiphanyPlanningView;
|
||||
use epiphany_core::EpiphanyPressure;
|
||||
use epiphany_core::EpiphanyPressureBasis as CoreEpiphanyPressureBasis;
|
||||
use epiphany_core::EpiphanyPressureLevel as CoreEpiphanyPressureLevel;
|
||||
|
|
@ -572,10 +554,7 @@ use epiphany_core::EpiphanyWorkerLaunchDocument;
|
|||
use epiphany_core::build_reorient_acceptance_bundle;
|
||||
use epiphany_core::build_role_acceptance_bundle;
|
||||
use epiphany_core::coordinator_automation_action;
|
||||
use epiphany_core::derive_context;
|
||||
use epiphany_core::derive_graph_query;
|
||||
use epiphany_core::derive_jobs;
|
||||
use epiphany_core::derive_planning_view;
|
||||
use epiphany_core::derive_pressure_view;
|
||||
use epiphany_core::derive_role_board;
|
||||
use epiphany_core::derive_scene;
|
||||
|
|
@ -13914,231 +13893,6 @@ fn render_epiphany_pre_compaction_checkpoint_intervention(
|
|||
.replace("{usage}", &usage)
|
||||
}
|
||||
|
||||
fn map_epiphany_context(
|
||||
state: Option<&EpiphanyThreadState>,
|
||||
params: &ThreadEpiphanyContextParams,
|
||||
) -> (
|
||||
ThreadEpiphanyContextStateStatus,
|
||||
Option<u64>,
|
||||
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,
|
||||
},
|
||||
))
|
||||
}
|
||||
|
||||
fn map_core_epiphany_context_view(
|
||||
view: EpiphanyContextView,
|
||||
) -> (
|
||||
ThreadEpiphanyContextStateStatus,
|
||||
Option<u64>,
|
||||
ThreadEpiphanyContext,
|
||||
ThreadEpiphanyContextMissing,
|
||||
) {
|
||||
(
|
||||
map_core_epiphany_context_state_status(view.state_status),
|
||||
view.state_revision,
|
||||
map_core_epiphany_context(view.context),
|
||||
map_core_epiphany_context_missing(view.missing),
|
||||
)
|
||||
}
|
||||
|
||||
fn map_core_epiphany_context_state_status(
|
||||
status: CoreEpiphanyContextStateStatus,
|
||||
) -> ThreadEpiphanyContextStateStatus {
|
||||
match status {
|
||||
CoreEpiphanyContextStateStatus::Missing => ThreadEpiphanyContextStateStatus::Missing,
|
||||
CoreEpiphanyContextStateStatus::Ready => ThreadEpiphanyContextStateStatus::Ready,
|
||||
}
|
||||
}
|
||||
|
||||
fn map_core_epiphany_context(context: CoreEpiphanyContext) -> ThreadEpiphanyContext {
|
||||
ThreadEpiphanyContext {
|
||||
graph: map_core_epiphany_graph_context(context.graph),
|
||||
frontier: context.frontier,
|
||||
checkpoint: context.checkpoint,
|
||||
investigation_checkpoint: context.investigation_checkpoint,
|
||||
observations: context.observations,
|
||||
evidence: context.evidence,
|
||||
}
|
||||
}
|
||||
|
||||
fn map_core_epiphany_graph_context(graph: CoreEpiphanyGraphContext) -> ThreadEpiphanyGraphContext {
|
||||
ThreadEpiphanyGraphContext {
|
||||
architecture_nodes: graph.architecture_nodes,
|
||||
architecture_edges: graph.architecture_edges,
|
||||
dataflow_nodes: graph.dataflow_nodes,
|
||||
dataflow_edges: graph.dataflow_edges,
|
||||
links: graph.links,
|
||||
}
|
||||
}
|
||||
|
||||
fn map_core_epiphany_context_missing(
|
||||
missing: CoreEpiphanyContextMissing,
|
||||
) -> ThreadEpiphanyContextMissing {
|
||||
ThreadEpiphanyContextMissing {
|
||||
graph_node_ids: missing.graph_node_ids,
|
||||
graph_edge_ids: missing.graph_edge_ids,
|
||||
observation_ids: missing.observation_ids,
|
||||
evidence_ids: missing.evidence_ids,
|
||||
}
|
||||
}
|
||||
|
||||
fn map_epiphany_planning(
|
||||
state: Option<&EpiphanyThreadState>,
|
||||
) -> (
|
||||
ThreadEpiphanyContextStateStatus,
|
||||
Option<u64>,
|
||||
EpiphanyPlanningState,
|
||||
ThreadEpiphanyPlanningSummary,
|
||||
) {
|
||||
let view = derive_planning_view(state);
|
||||
map_core_epiphany_planning_view(view)
|
||||
}
|
||||
|
||||
fn map_core_epiphany_planning_view(
|
||||
view: EpiphanyPlanningView,
|
||||
) -> (
|
||||
ThreadEpiphanyContextStateStatus,
|
||||
Option<u64>,
|
||||
EpiphanyPlanningState,
|
||||
ThreadEpiphanyPlanningSummary,
|
||||
) {
|
||||
(
|
||||
match view.state_status {
|
||||
CoreEpiphanyPlanningStateStatus::Missing => ThreadEpiphanyContextStateStatus::Missing,
|
||||
CoreEpiphanyPlanningStateStatus::Ready => ThreadEpiphanyContextStateStatus::Ready,
|
||||
},
|
||||
view.state_revision,
|
||||
view.planning,
|
||||
map_core_epiphany_planning_summary(view.summary),
|
||||
)
|
||||
}
|
||||
|
||||
fn map_core_epiphany_planning_summary(
|
||||
summary: CoreEpiphanyPlanningSummary,
|
||||
) -> ThreadEpiphanyPlanningSummary {
|
||||
ThreadEpiphanyPlanningSummary {
|
||||
capture_count: summary.capture_count,
|
||||
pending_capture_count: summary.pending_capture_count,
|
||||
github_issue_capture_count: summary.github_issue_capture_count,
|
||||
backlog_item_count: summary.backlog_item_count,
|
||||
ready_backlog_item_count: summary.ready_backlog_item_count,
|
||||
roadmap_stream_count: summary.roadmap_stream_count,
|
||||
objective_draft_count: summary.objective_draft_count,
|
||||
draft_objective_count: summary.draft_objective_count,
|
||||
active_objective: summary.active_objective,
|
||||
note: summary.note,
|
||||
}
|
||||
}
|
||||
|
||||
fn map_epiphany_graph_query(
|
||||
state: Option<&EpiphanyThreadState>,
|
||||
query: &ThreadEpiphanyGraphQuery,
|
||||
) -> (
|
||||
ThreadEpiphanyContextStateStatus,
|
||||
Option<u64>,
|
||||
ThreadEpiphanyGraphContext,
|
||||
Option<codex_protocol::protocol::EpiphanyGraphFrontier>,
|
||||
Option<codex_protocol::protocol::EpiphanyGraphCheckpoint>,
|
||||
ThreadEpiphanyGraphQueryMatched,
|
||||
ThreadEpiphanyGraphQueryMissing,
|
||||
) {
|
||||
map_core_epiphany_graph_query_view(derive_graph_query(
|
||||
state,
|
||||
&map_core_epiphany_graph_query(query),
|
||||
))
|
||||
}
|
||||
|
||||
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,
|
||||
) -> (
|
||||
ThreadEpiphanyContextStateStatus,
|
||||
Option<u64>,
|
||||
ThreadEpiphanyGraphContext,
|
||||
Option<codex_protocol::protocol::EpiphanyGraphFrontier>,
|
||||
Option<codex_protocol::protocol::EpiphanyGraphCheckpoint>,
|
||||
ThreadEpiphanyGraphQueryMatched,
|
||||
ThreadEpiphanyGraphQueryMissing,
|
||||
) {
|
||||
(
|
||||
map_core_epiphany_context_state_status(view.state_status),
|
||||
view.state_revision,
|
||||
map_core_epiphany_graph_context(view.graph),
|
||||
view.frontier,
|
||||
view.checkpoint,
|
||||
map_core_epiphany_graph_query_matched(view.matched),
|
||||
map_core_epiphany_graph_query_missing(view.missing),
|
||||
)
|
||||
}
|
||||
|
||||
fn map_core_epiphany_graph_query_matched(
|
||||
matched: CoreEpiphanyGraphQueryMatched,
|
||||
) -> ThreadEpiphanyGraphQueryMatched {
|
||||
ThreadEpiphanyGraphQueryMatched {
|
||||
node_ids: matched.node_ids,
|
||||
edge_ids: matched.edge_ids,
|
||||
paths: matched.paths,
|
||||
symbols: matched.symbols,
|
||||
edge_kinds: matched.edge_kinds,
|
||||
}
|
||||
}
|
||||
|
||||
fn map_core_epiphany_graph_query_missing(
|
||||
missing: CoreEpiphanyGraphQueryMissing,
|
||||
) -> ThreadEpiphanyGraphQueryMissing {
|
||||
ThreadEpiphanyGraphQueryMissing {
|
||||
node_ids: missing.node_ids,
|
||||
edge_ids: missing.edge_ids,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) async fn maybe_run_epiphany_coordinator_automation_for_turn_boundary(
|
||||
thread_id: ThreadId,
|
||||
thread: Arc<CodexThread>,
|
||||
|
|
|
|||
258
vendor/codex/codex-rs/app-server/src/epiphany_context.rs
vendored
Normal file
258
vendor/codex/codex-rs/app-server/src/epiphany_context.rs
vendored
Normal file
|
|
@ -0,0 +1,258 @@
|
|||
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;
|
||||
use codex_protocol::protocol::EpiphanyGraphCheckpoint;
|
||||
use codex_protocol::protocol::EpiphanyGraphFrontier;
|
||||
use codex_protocol::protocol::EpiphanyPlanningState;
|
||||
use codex_protocol::protocol::EpiphanyThreadState;
|
||||
use epiphany_core::EpiphanyContext as CoreEpiphanyContext;
|
||||
use epiphany_core::EpiphanyContextMissing as CoreEpiphanyContextMissing;
|
||||
use epiphany_core::EpiphanyContextParams as CoreEpiphanyContextParams;
|
||||
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;
|
||||
use epiphany_core::EpiphanyPlanningStateStatus as CoreEpiphanyPlanningStateStatus;
|
||||
use epiphany_core::EpiphanyPlanningSummary as CoreEpiphanyPlanningSummary;
|
||||
use epiphany_core::EpiphanyPlanningView;
|
||||
use epiphany_core::derive_context;
|
||||
use epiphany_core::derive_graph_query;
|
||||
use epiphany_core::derive_planning_view;
|
||||
|
||||
pub(super) fn map_epiphany_context(
|
||||
state: Option<&EpiphanyThreadState>,
|
||||
params: &ThreadEpiphanyContextParams,
|
||||
) -> (
|
||||
ThreadEpiphanyContextStateStatus,
|
||||
Option<u64>,
|
||||
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,
|
||||
},
|
||||
))
|
||||
}
|
||||
|
||||
fn map_core_epiphany_context_view(
|
||||
view: EpiphanyContextView,
|
||||
) -> (
|
||||
ThreadEpiphanyContextStateStatus,
|
||||
Option<u64>,
|
||||
ThreadEpiphanyContext,
|
||||
ThreadEpiphanyContextMissing,
|
||||
) {
|
||||
(
|
||||
map_core_epiphany_context_state_status(view.state_status),
|
||||
view.state_revision,
|
||||
map_core_epiphany_context(view.context),
|
||||
map_core_epiphany_context_missing(view.missing),
|
||||
)
|
||||
}
|
||||
|
||||
fn map_core_epiphany_context_state_status(
|
||||
status: CoreEpiphanyContextStateStatus,
|
||||
) -> ThreadEpiphanyContextStateStatus {
|
||||
match status {
|
||||
CoreEpiphanyContextStateStatus::Missing => ThreadEpiphanyContextStateStatus::Missing,
|
||||
CoreEpiphanyContextStateStatus::Ready => ThreadEpiphanyContextStateStatus::Ready,
|
||||
}
|
||||
}
|
||||
|
||||
fn map_core_epiphany_context(context: CoreEpiphanyContext) -> ThreadEpiphanyContext {
|
||||
ThreadEpiphanyContext {
|
||||
graph: map_core_epiphany_graph_context(context.graph),
|
||||
frontier: context.frontier,
|
||||
checkpoint: context.checkpoint,
|
||||
investigation_checkpoint: context.investigation_checkpoint,
|
||||
observations: context.observations,
|
||||
evidence: context.evidence,
|
||||
}
|
||||
}
|
||||
|
||||
fn map_core_epiphany_graph_context(graph: CoreEpiphanyGraphContext) -> ThreadEpiphanyGraphContext {
|
||||
ThreadEpiphanyGraphContext {
|
||||
architecture_nodes: graph.architecture_nodes,
|
||||
architecture_edges: graph.architecture_edges,
|
||||
dataflow_nodes: graph.dataflow_nodes,
|
||||
dataflow_edges: graph.dataflow_edges,
|
||||
links: graph.links,
|
||||
}
|
||||
}
|
||||
|
||||
fn map_core_epiphany_context_missing(
|
||||
missing: CoreEpiphanyContextMissing,
|
||||
) -> ThreadEpiphanyContextMissing {
|
||||
ThreadEpiphanyContextMissing {
|
||||
graph_node_ids: missing.graph_node_ids,
|
||||
graph_edge_ids: missing.graph_edge_ids,
|
||||
observation_ids: missing.observation_ids,
|
||||
evidence_ids: missing.evidence_ids,
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn map_epiphany_planning(
|
||||
state: Option<&EpiphanyThreadState>,
|
||||
) -> (
|
||||
ThreadEpiphanyContextStateStatus,
|
||||
Option<u64>,
|
||||
EpiphanyPlanningState,
|
||||
ThreadEpiphanyPlanningSummary,
|
||||
) {
|
||||
let view = derive_planning_view(state);
|
||||
map_core_epiphany_planning_view(view)
|
||||
}
|
||||
|
||||
fn map_core_epiphany_planning_view(
|
||||
view: EpiphanyPlanningView,
|
||||
) -> (
|
||||
ThreadEpiphanyContextStateStatus,
|
||||
Option<u64>,
|
||||
EpiphanyPlanningState,
|
||||
ThreadEpiphanyPlanningSummary,
|
||||
) {
|
||||
(
|
||||
match view.state_status {
|
||||
CoreEpiphanyPlanningStateStatus::Missing => ThreadEpiphanyContextStateStatus::Missing,
|
||||
CoreEpiphanyPlanningStateStatus::Ready => ThreadEpiphanyContextStateStatus::Ready,
|
||||
},
|
||||
view.state_revision,
|
||||
view.planning,
|
||||
map_core_epiphany_planning_summary(view.summary),
|
||||
)
|
||||
}
|
||||
|
||||
fn map_core_epiphany_planning_summary(
|
||||
summary: CoreEpiphanyPlanningSummary,
|
||||
) -> ThreadEpiphanyPlanningSummary {
|
||||
ThreadEpiphanyPlanningSummary {
|
||||
capture_count: summary.capture_count,
|
||||
pending_capture_count: summary.pending_capture_count,
|
||||
github_issue_capture_count: summary.github_issue_capture_count,
|
||||
backlog_item_count: summary.backlog_item_count,
|
||||
ready_backlog_item_count: summary.ready_backlog_item_count,
|
||||
roadmap_stream_count: summary.roadmap_stream_count,
|
||||
objective_draft_count: summary.objective_draft_count,
|
||||
draft_objective_count: summary.draft_objective_count,
|
||||
active_objective: summary.active_objective,
|
||||
note: summary.note,
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn map_epiphany_graph_query(
|
||||
state: Option<&EpiphanyThreadState>,
|
||||
query: &ThreadEpiphanyGraphQuery,
|
||||
) -> (
|
||||
ThreadEpiphanyContextStateStatus,
|
||||
Option<u64>,
|
||||
ThreadEpiphanyGraphContext,
|
||||
Option<EpiphanyGraphFrontier>,
|
||||
Option<EpiphanyGraphCheckpoint>,
|
||||
ThreadEpiphanyGraphQueryMatched,
|
||||
ThreadEpiphanyGraphQueryMissing,
|
||||
) {
|
||||
map_core_epiphany_graph_query_view(derive_graph_query(
|
||||
state,
|
||||
&map_core_epiphany_graph_query(query),
|
||||
))
|
||||
}
|
||||
|
||||
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,
|
||||
) -> (
|
||||
ThreadEpiphanyContextStateStatus,
|
||||
Option<u64>,
|
||||
ThreadEpiphanyGraphContext,
|
||||
Option<EpiphanyGraphFrontier>,
|
||||
Option<EpiphanyGraphCheckpoint>,
|
||||
ThreadEpiphanyGraphQueryMatched,
|
||||
ThreadEpiphanyGraphQueryMissing,
|
||||
) {
|
||||
(
|
||||
map_core_epiphany_context_state_status(view.state_status),
|
||||
view.state_revision,
|
||||
map_core_epiphany_graph_context(view.graph),
|
||||
view.frontier,
|
||||
view.checkpoint,
|
||||
map_core_epiphany_graph_query_matched(view.matched),
|
||||
map_core_epiphany_graph_query_missing(view.missing),
|
||||
)
|
||||
}
|
||||
|
||||
fn map_core_epiphany_graph_query_matched(
|
||||
matched: CoreEpiphanyGraphQueryMatched,
|
||||
) -> ThreadEpiphanyGraphQueryMatched {
|
||||
ThreadEpiphanyGraphQueryMatched {
|
||||
node_ids: matched.node_ids,
|
||||
edge_ids: matched.edge_ids,
|
||||
paths: matched.paths,
|
||||
symbols: matched.symbols,
|
||||
edge_kinds: matched.edge_kinds,
|
||||
}
|
||||
}
|
||||
|
||||
fn map_core_epiphany_graph_query_missing(
|
||||
missing: CoreEpiphanyGraphQueryMissing,
|
||||
) -> ThreadEpiphanyGraphQueryMissing {
|
||||
ThreadEpiphanyGraphQueryMissing {
|
||||
node_ids: missing.node_ids,
|
||||
edge_ids: missing.edge_ids,
|
||||
}
|
||||
}
|
||||
1
vendor/codex/codex-rs/app-server/src/lib.rs
vendored
1
vendor/codex/codex-rs/app-server/src/lib.rs
vendored
|
|
@ -75,6 +75,7 @@ mod config_manager;
|
|||
mod config_manager_service;
|
||||
mod device_key_api;
|
||||
mod dynamic_tools;
|
||||
mod epiphany_context;
|
||||
mod epiphany_invalidation;
|
||||
mod epiphany_launch;
|
||||
mod epiphany_reorient;
|
||||
|
|
|
|||
Reference in a new issue