From f0570a2370376d9d497ac6006dd6870a7576fd5d Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 13 May 2026 00:48:04 +0100 Subject: [PATCH] Extract Epiphany scene projection --- notes/fresh-workspace-handoff.md | 8 +- notes/json-contamination-ledger.md | 2 +- state/ledgers.msgpack | Bin 71258 -> 71564 bytes state/map.yaml | 2 +- .../app-server/src/codex_message_processor.rs | 200 +--------------- .../codex-rs/app-server/src/epiphany_scene.rs | 213 ++++++++++++++++++ vendor/codex/codex-rs/app-server/src/lib.rs | 1 + 7 files changed, 223 insertions(+), 203 deletions(-) create mode 100644 vendor/codex/codex-rs/app-server/src/epiphany_scene.rs diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index fac84c45..bef18104 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -412,9 +412,11 @@ result projection and note rendering into `vendor/codex/codex-rs/app-server/src/epiphany_results.rs`, taking the processor to about 20,331 lines. The third cut moved protocol-to-core launch document mapping into `epiphany_launch.rs`, taking the processor to about 20,255 lines. -This is progress, not absolution: handlers, scene/view -mappers, route orchestration, coordinator glue, accept policy plumbing, and -tests still keep too much Epiphany inside Codex. +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. This is progress, not absolution: handlers, remaining +view mappers, route orchestration, coordinator glue, 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 diff --git a/notes/json-contamination-ledger.md b/notes/json-contamination-ledger.md index 91330f3f..81b22b9a 100644 --- a/notes/json-contamination-ledger.md +++ b/notes/json-contamination-ledger.md @@ -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`, and role/reorient result projection into `epiphany_results.rs`, reducing `codex_message_processor.rs` from about 21,263 to 20,255 lines. Next move route handlers, scene/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`, and scene projection into `epiphany_scene.rs`, reducing `codex_message_processor.rs` from about 21,263 to 20,059 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. 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. diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index d1c83c028fada9bc0b7a00e1bcbddb4c1405a5ab..6275c92a69bb76ede59abf8508d585638bfffcf2 100644 GIT binary patch delta 141 zcmcb$hNWjc%LHX6@t}>W(-;}IH}7HGzK4;qLu9gkDev@t0Y)|^6Z7eYqKvxi@7?lC zi%K%43yLtx%efY07GxymRVoxGr{<+96cpuWr6!kT=I1G-73Jqn=M!X(_O?E1zF9lOwFSJ!)Gg! delta 38 ucmeBK&vI)G%LHX6F@=q)(-;}IHSb~EzK4;qLu7iHIHTZn15rj6#wY*;feV}f diff --git a/state/map.yaml b/state/map.yaml index 2202e386..6a8151f1 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -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 three 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`, and role/reorient result projection/note rendering moved into `vendor/codex/codex-rs/app-server/src/epiphany_results.rs`. The processor is down from about 21,263 lines to 20,255 lines. This is progress, not absolution: route handlers, scene/view mappers, coordinator glue, 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. + summary: The Codex starvation pass has five typing receipts plus four 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`, and scene projection moved into `vendor/codex/codex-rs/app-server/src/epiphany_scene.rs`. The processor is down from about 21,263 lines to 20,059 lines. This is progress, not absolution: route handlers, remaining view mappers, coordinator glue, 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. diff --git a/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs b/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs index be1c4672..22bd618f 100644 --- a/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs +++ b/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs @@ -32,6 +32,8 @@ use crate::epiphany_results::map_protocol_reorient_finding; use crate::epiphany_results::map_protocol_role_finding; use crate::epiphany_results::render_epiphany_reorient_result_note; use crate::epiphany_results::render_epiphany_role_result_note; +use crate::epiphany_scene::map_core_epiphany_scene_action; +use crate::epiphany_scene::map_epiphany_scene; use crate::error_code::INPUT_TOO_LARGE_ERROR_CODE; use crate::error_code::INTERNAL_ERROR_CODE; use crate::error_code::INVALID_PARAMS_ERROR_CODE; @@ -255,18 +257,11 @@ use codex_app_server_protocol::ThreadEpiphanyRoleResultStatus; use codex_app_server_protocol::ThreadEpiphanyRoleSelfPersistenceStatus; use codex_app_server_protocol::ThreadEpiphanyRoleStatus; use codex_app_server_protocol::ThreadEpiphanyRolesSource; -use codex_app_server_protocol::ThreadEpiphanyScene; use codex_app_server_protocol::ThreadEpiphanySceneAction; -use codex_app_server_protocol::ThreadEpiphanySceneChurn; use codex_app_server_protocol::ThreadEpiphanySceneGraph; -use codex_app_server_protocol::ThreadEpiphanySceneInvestigationCheckpoint; -use codex_app_server_protocol::ThreadEpiphanySceneRecord; -use codex_app_server_protocol::ThreadEpiphanySceneRecords; -use codex_app_server_protocol::ThreadEpiphanySceneRetrieval; use codex_app_server_protocol::ThreadEpiphanySceneSource; use codex_app_server_protocol::ThreadEpiphanySceneStateStatus; use codex_app_server_protocol::ThreadEpiphanySceneStatusCount; -use codex_app_server_protocol::ThreadEpiphanySceneSubgoal; use codex_app_server_protocol::ThreadEpiphanyStateUpdatedField; use codex_app_server_protocol::ThreadEpiphanyStateUpdatedNotification; use codex_app_server_protocol::ThreadEpiphanyStateUpdatedSource; @@ -586,19 +581,7 @@ use epiphany_core::EpiphanyRoleBoardPlanningSummary; use epiphany_core::EpiphanyRoleStatePatchDocument; use epiphany_core::EpiphanyRuntimeJobSnapshot; use epiphany_core::EpiphanyRuntimeJobStatus; -use epiphany_core::EpiphanyScene as CoreEpiphanyScene; -use epiphany_core::EpiphanySceneAction as CoreEpiphanySceneAction; -use epiphany_core::EpiphanySceneChurn as CoreEpiphanySceneChurn; -use epiphany_core::EpiphanySceneGraph as CoreEpiphanySceneGraph; use epiphany_core::EpiphanySceneInput; -use epiphany_core::EpiphanySceneInvestigationCheckpoint as CoreEpiphanySceneInvestigationCheckpoint; -use epiphany_core::EpiphanySceneRecord as CoreEpiphanySceneRecord; -use epiphany_core::EpiphanySceneRecords as CoreEpiphanySceneRecords; -use epiphany_core::EpiphanySceneRetrieval as CoreEpiphanySceneRetrieval; -use epiphany_core::EpiphanySceneSource as CoreEpiphanySceneSource; -use epiphany_core::EpiphanySceneStateStatus as CoreEpiphanySceneStateStatus; -use epiphany_core::EpiphanySceneStatusCount as CoreEpiphanySceneStatusCount; -use epiphany_core::EpiphanySceneSubgoal as CoreEpiphanySceneSubgoal; use epiphany_core::EpiphanyWorkerLaunchDocument; use epiphany_core::build_reorient_acceptance_bundle; use epiphany_core::build_role_acceptance_bundle; @@ -12548,185 +12531,6 @@ async fn client_visible_live_thread_epiphany_state( live_thread_epiphany_state(thread).await.unwrap_or(fallback) } -fn map_epiphany_scene(state: Option<&EpiphanyThreadState>, loaded: bool) -> ThreadEpiphanyScene { - map_core_epiphany_scene(derive_scene(EpiphanySceneInput { - state, - loaded, - reorient_binding_id: EPIPHANY_REORIENT_LAUNCH_BINDING_ID, - })) -} - -fn map_core_epiphany_scene(scene: CoreEpiphanyScene) -> ThreadEpiphanyScene { - ThreadEpiphanyScene { - state_status: match scene.state_status { - CoreEpiphanySceneStateStatus::Missing => ThreadEpiphanySceneStateStatus::Missing, - CoreEpiphanySceneStateStatus::Ready => ThreadEpiphanySceneStateStatus::Ready, - }, - source: match scene.source { - CoreEpiphanySceneSource::Stored => ThreadEpiphanySceneSource::Stored, - CoreEpiphanySceneSource::Live => ThreadEpiphanySceneSource::Live, - }, - revision: scene.revision, - objective: scene.objective, - active_subgoal: scene.active_subgoal.map(map_core_epiphany_scene_subgoal), - subgoals: scene - .subgoals - .into_iter() - .map(map_core_epiphany_scene_subgoal) - .collect(), - invariant_status_counts: scene - .invariant_status_counts - .into_iter() - .map(map_core_epiphany_scene_status_count) - .collect(), - graph: map_core_epiphany_scene_graph(scene.graph), - retrieval: scene.retrieval.map(map_core_epiphany_scene_retrieval), - investigation_checkpoint: scene - .investigation_checkpoint - .map(map_core_epiphany_scene_investigation_checkpoint), - observations: map_core_epiphany_scene_records(scene.observations), - evidence: map_core_epiphany_scene_records(scene.evidence), - churn: scene.churn.map(map_core_epiphany_scene_churn), - available_actions: scene - .available_actions - .into_iter() - .map(map_core_epiphany_scene_action) - .collect(), - } -} - -fn map_core_epiphany_scene_action(action: CoreEpiphanySceneAction) -> ThreadEpiphanySceneAction { - match action { - CoreEpiphanySceneAction::Index => ThreadEpiphanySceneAction::Index, - CoreEpiphanySceneAction::Retrieve => ThreadEpiphanySceneAction::Retrieve, - CoreEpiphanySceneAction::Distill => ThreadEpiphanySceneAction::Distill, - CoreEpiphanySceneAction::Context => ThreadEpiphanySceneAction::Context, - CoreEpiphanySceneAction::Planning => ThreadEpiphanySceneAction::Planning, - CoreEpiphanySceneAction::GraphQuery => ThreadEpiphanySceneAction::GraphQuery, - CoreEpiphanySceneAction::Jobs => ThreadEpiphanySceneAction::Jobs, - CoreEpiphanySceneAction::Roles => ThreadEpiphanySceneAction::Roles, - CoreEpiphanySceneAction::Coordinator => ThreadEpiphanySceneAction::Coordinator, - CoreEpiphanySceneAction::RoleLaunch => ThreadEpiphanySceneAction::RoleLaunch, - CoreEpiphanySceneAction::RoleResult => ThreadEpiphanySceneAction::RoleResult, - CoreEpiphanySceneAction::RoleAccept => ThreadEpiphanySceneAction::RoleAccept, - CoreEpiphanySceneAction::JobLaunch => ThreadEpiphanySceneAction::JobLaunch, - CoreEpiphanySceneAction::JobInterrupt => ThreadEpiphanySceneAction::JobInterrupt, - CoreEpiphanySceneAction::Freshness => ThreadEpiphanySceneAction::Freshness, - CoreEpiphanySceneAction::Pressure => ThreadEpiphanySceneAction::Pressure, - CoreEpiphanySceneAction::Reorient => ThreadEpiphanySceneAction::Reorient, - CoreEpiphanySceneAction::Crrc => ThreadEpiphanySceneAction::Crrc, - CoreEpiphanySceneAction::ReorientLaunch => ThreadEpiphanySceneAction::ReorientLaunch, - CoreEpiphanySceneAction::ReorientResult => ThreadEpiphanySceneAction::ReorientResult, - CoreEpiphanySceneAction::ReorientAccept => ThreadEpiphanySceneAction::ReorientAccept, - CoreEpiphanySceneAction::Propose => ThreadEpiphanySceneAction::Propose, - CoreEpiphanySceneAction::Promote => ThreadEpiphanySceneAction::Promote, - CoreEpiphanySceneAction::Update => ThreadEpiphanySceneAction::Update, - } -} - -fn map_core_epiphany_scene_subgoal( - subgoal: CoreEpiphanySceneSubgoal, -) -> ThreadEpiphanySceneSubgoal { - ThreadEpiphanySceneSubgoal { - id: subgoal.id, - title: subgoal.title, - status: subgoal.status, - summary: subgoal.summary, - active: subgoal.active, - } -} - -fn map_core_epiphany_scene_status_count( - count: CoreEpiphanySceneStatusCount, -) -> ThreadEpiphanySceneStatusCount { - ThreadEpiphanySceneStatusCount { - status: count.status, - count: count.count, - } -} - -fn map_core_epiphany_scene_graph(graph: CoreEpiphanySceneGraph) -> ThreadEpiphanySceneGraph { - ThreadEpiphanySceneGraph { - architecture_node_count: graph.architecture_node_count, - architecture_edge_count: graph.architecture_edge_count, - dataflow_node_count: graph.dataflow_node_count, - dataflow_edge_count: graph.dataflow_edge_count, - link_count: graph.link_count, - active_node_ids: graph.active_node_ids, - active_edge_ids: graph.active_edge_ids, - open_question_count: graph.open_question_count, - open_gap_count: graph.open_gap_count, - dirty_paths: graph.dirty_paths, - checkpoint_id: graph.checkpoint_id, - checkpoint_summary: graph.checkpoint_summary, - } -} - -fn map_core_epiphany_scene_retrieval( - retrieval: CoreEpiphanySceneRetrieval, -) -> ThreadEpiphanySceneRetrieval { - ThreadEpiphanySceneRetrieval { - workspace_root: retrieval.workspace_root, - status: retrieval.status, - semantic_available: retrieval.semantic_available, - index_revision: retrieval.index_revision, - indexed_file_count: retrieval.indexed_file_count, - indexed_chunk_count: retrieval.indexed_chunk_count, - shard_count: retrieval.shard_count, - dirty_path_count: retrieval.dirty_path_count, - } -} - -fn map_core_epiphany_scene_investigation_checkpoint( - checkpoint: CoreEpiphanySceneInvestigationCheckpoint, -) -> ThreadEpiphanySceneInvestigationCheckpoint { - ThreadEpiphanySceneInvestigationCheckpoint { - checkpoint_id: checkpoint.checkpoint_id, - kind: checkpoint.kind, - disposition: checkpoint.disposition, - focus: checkpoint.focus, - summary: checkpoint.summary, - next_action: checkpoint.next_action, - captured_at_turn_id: checkpoint.captured_at_turn_id, - open_question_count: checkpoint.open_question_count, - code_ref_count: checkpoint.code_ref_count, - evidence_count: checkpoint.evidence_count, - } -} - -fn map_core_epiphany_scene_records( - records: CoreEpiphanySceneRecords, -) -> ThreadEpiphanySceneRecords { - ThreadEpiphanySceneRecords { - total_count: records.total_count, - latest: records - .latest - .into_iter() - .map(map_core_epiphany_scene_record) - .collect(), - } -} - -fn map_core_epiphany_scene_record(record: CoreEpiphanySceneRecord) -> ThreadEpiphanySceneRecord { - ThreadEpiphanySceneRecord { - id: record.id, - kind: record.kind, - status: record.status, - summary: record.summary, - code_ref_count: record.code_ref_count, - } -} - -fn map_core_epiphany_scene_churn(churn: CoreEpiphanySceneChurn) -> ThreadEpiphanySceneChurn { - ThreadEpiphanySceneChurn { - understanding_status: churn.understanding_status, - diff_pressure: churn.diff_pressure, - graph_freshness: churn.graph_freshness, - warning: churn.warning, - unexplained_writes: churn.unexplained_writes, - } -} - fn core_state_patch_from_protocol( patch: &ThreadEpiphanyUpdatePatch, ) -> EpiphanyRoleStatePatchDocument { diff --git a/vendor/codex/codex-rs/app-server/src/epiphany_scene.rs b/vendor/codex/codex-rs/app-server/src/epiphany_scene.rs new file mode 100644 index 00000000..3a7411a4 --- /dev/null +++ b/vendor/codex/codex-rs/app-server/src/epiphany_scene.rs @@ -0,0 +1,213 @@ +use codex_app_server_protocol::ThreadEpiphanyScene; +use codex_app_server_protocol::ThreadEpiphanySceneAction; +use codex_app_server_protocol::ThreadEpiphanySceneChurn; +use codex_app_server_protocol::ThreadEpiphanySceneGraph; +use codex_app_server_protocol::ThreadEpiphanySceneInvestigationCheckpoint; +use codex_app_server_protocol::ThreadEpiphanySceneRecord; +use codex_app_server_protocol::ThreadEpiphanySceneRecords; +use codex_app_server_protocol::ThreadEpiphanySceneRetrieval; +use codex_app_server_protocol::ThreadEpiphanySceneSource; +use codex_app_server_protocol::ThreadEpiphanySceneStateStatus; +use codex_app_server_protocol::ThreadEpiphanySceneStatusCount; +use codex_app_server_protocol::ThreadEpiphanySceneSubgoal; +use codex_protocol::protocol::EpiphanyThreadState; +use epiphany_core::EpiphanyScene as CoreEpiphanyScene; +use epiphany_core::EpiphanySceneAction as CoreEpiphanySceneAction; +use epiphany_core::EpiphanySceneChurn as CoreEpiphanySceneChurn; +use epiphany_core::EpiphanySceneGraph as CoreEpiphanySceneGraph; +use epiphany_core::EpiphanySceneInput; +use epiphany_core::EpiphanySceneInvestigationCheckpoint as CoreEpiphanySceneInvestigationCheckpoint; +use epiphany_core::EpiphanySceneRecord as CoreEpiphanySceneRecord; +use epiphany_core::EpiphanySceneRecords as CoreEpiphanySceneRecords; +use epiphany_core::EpiphanySceneRetrieval as CoreEpiphanySceneRetrieval; +use epiphany_core::EpiphanySceneSource as CoreEpiphanySceneSource; +use epiphany_core::EpiphanySceneStateStatus as CoreEpiphanySceneStateStatus; +use epiphany_core::EpiphanySceneStatusCount as CoreEpiphanySceneStatusCount; +use epiphany_core::EpiphanySceneSubgoal as CoreEpiphanySceneSubgoal; +use epiphany_core::derive_scene; + +use crate::epiphany_launch::EPIPHANY_REORIENT_LAUNCH_BINDING_ID; + +pub(super) fn map_epiphany_scene( + state: Option<&EpiphanyThreadState>, + loaded: bool, +) -> ThreadEpiphanyScene { + map_core_epiphany_scene(derive_scene(EpiphanySceneInput { + state, + loaded, + reorient_binding_id: EPIPHANY_REORIENT_LAUNCH_BINDING_ID, + })) +} + +fn map_core_epiphany_scene(scene: CoreEpiphanyScene) -> ThreadEpiphanyScene { + ThreadEpiphanyScene { + state_status: match scene.state_status { + CoreEpiphanySceneStateStatus::Missing => ThreadEpiphanySceneStateStatus::Missing, + CoreEpiphanySceneStateStatus::Ready => ThreadEpiphanySceneStateStatus::Ready, + }, + source: match scene.source { + CoreEpiphanySceneSource::Stored => ThreadEpiphanySceneSource::Stored, + CoreEpiphanySceneSource::Live => ThreadEpiphanySceneSource::Live, + }, + revision: scene.revision, + objective: scene.objective, + active_subgoal: scene.active_subgoal.map(map_core_epiphany_scene_subgoal), + subgoals: scene + .subgoals + .into_iter() + .map(map_core_epiphany_scene_subgoal) + .collect(), + invariant_status_counts: scene + .invariant_status_counts + .into_iter() + .map(map_core_epiphany_scene_status_count) + .collect(), + graph: map_core_epiphany_scene_graph(scene.graph), + retrieval: scene.retrieval.map(map_core_epiphany_scene_retrieval), + investigation_checkpoint: scene + .investigation_checkpoint + .map(map_core_epiphany_scene_investigation_checkpoint), + observations: map_core_epiphany_scene_records(scene.observations), + evidence: map_core_epiphany_scene_records(scene.evidence), + churn: scene.churn.map(map_core_epiphany_scene_churn), + available_actions: scene + .available_actions + .into_iter() + .map(map_core_epiphany_scene_action) + .collect(), + } +} + +pub(super) fn map_core_epiphany_scene_action( + action: CoreEpiphanySceneAction, +) -> ThreadEpiphanySceneAction { + match action { + CoreEpiphanySceneAction::Index => ThreadEpiphanySceneAction::Index, + CoreEpiphanySceneAction::Retrieve => ThreadEpiphanySceneAction::Retrieve, + CoreEpiphanySceneAction::Distill => ThreadEpiphanySceneAction::Distill, + CoreEpiphanySceneAction::Context => ThreadEpiphanySceneAction::Context, + CoreEpiphanySceneAction::Planning => ThreadEpiphanySceneAction::Planning, + CoreEpiphanySceneAction::GraphQuery => ThreadEpiphanySceneAction::GraphQuery, + CoreEpiphanySceneAction::Jobs => ThreadEpiphanySceneAction::Jobs, + CoreEpiphanySceneAction::Roles => ThreadEpiphanySceneAction::Roles, + CoreEpiphanySceneAction::Coordinator => ThreadEpiphanySceneAction::Coordinator, + CoreEpiphanySceneAction::RoleLaunch => ThreadEpiphanySceneAction::RoleLaunch, + CoreEpiphanySceneAction::RoleResult => ThreadEpiphanySceneAction::RoleResult, + CoreEpiphanySceneAction::RoleAccept => ThreadEpiphanySceneAction::RoleAccept, + CoreEpiphanySceneAction::JobLaunch => ThreadEpiphanySceneAction::JobLaunch, + CoreEpiphanySceneAction::JobInterrupt => ThreadEpiphanySceneAction::JobInterrupt, + CoreEpiphanySceneAction::Freshness => ThreadEpiphanySceneAction::Freshness, + CoreEpiphanySceneAction::Pressure => ThreadEpiphanySceneAction::Pressure, + CoreEpiphanySceneAction::Reorient => ThreadEpiphanySceneAction::Reorient, + CoreEpiphanySceneAction::Crrc => ThreadEpiphanySceneAction::Crrc, + CoreEpiphanySceneAction::ReorientLaunch => ThreadEpiphanySceneAction::ReorientLaunch, + CoreEpiphanySceneAction::ReorientResult => ThreadEpiphanySceneAction::ReorientResult, + CoreEpiphanySceneAction::ReorientAccept => ThreadEpiphanySceneAction::ReorientAccept, + CoreEpiphanySceneAction::Propose => ThreadEpiphanySceneAction::Propose, + CoreEpiphanySceneAction::Promote => ThreadEpiphanySceneAction::Promote, + CoreEpiphanySceneAction::Update => ThreadEpiphanySceneAction::Update, + } +} + +fn map_core_epiphany_scene_subgoal( + subgoal: CoreEpiphanySceneSubgoal, +) -> ThreadEpiphanySceneSubgoal { + ThreadEpiphanySceneSubgoal { + id: subgoal.id, + title: subgoal.title, + status: subgoal.status, + summary: subgoal.summary, + active: subgoal.active, + } +} + +fn map_core_epiphany_scene_status_count( + count: CoreEpiphanySceneStatusCount, +) -> ThreadEpiphanySceneStatusCount { + ThreadEpiphanySceneStatusCount { + status: count.status, + count: count.count, + } +} + +fn map_core_epiphany_scene_graph(graph: CoreEpiphanySceneGraph) -> ThreadEpiphanySceneGraph { + ThreadEpiphanySceneGraph { + architecture_node_count: graph.architecture_node_count, + architecture_edge_count: graph.architecture_edge_count, + dataflow_node_count: graph.dataflow_node_count, + dataflow_edge_count: graph.dataflow_edge_count, + link_count: graph.link_count, + active_node_ids: graph.active_node_ids, + active_edge_ids: graph.active_edge_ids, + open_question_count: graph.open_question_count, + open_gap_count: graph.open_gap_count, + dirty_paths: graph.dirty_paths, + checkpoint_id: graph.checkpoint_id, + checkpoint_summary: graph.checkpoint_summary, + } +} + +fn map_core_epiphany_scene_retrieval( + retrieval: CoreEpiphanySceneRetrieval, +) -> ThreadEpiphanySceneRetrieval { + ThreadEpiphanySceneRetrieval { + workspace_root: retrieval.workspace_root, + status: retrieval.status, + semantic_available: retrieval.semantic_available, + index_revision: retrieval.index_revision, + indexed_file_count: retrieval.indexed_file_count, + indexed_chunk_count: retrieval.indexed_chunk_count, + shard_count: retrieval.shard_count, + dirty_path_count: retrieval.dirty_path_count, + } +} + +fn map_core_epiphany_scene_investigation_checkpoint( + checkpoint: CoreEpiphanySceneInvestigationCheckpoint, +) -> ThreadEpiphanySceneInvestigationCheckpoint { + ThreadEpiphanySceneInvestigationCheckpoint { + checkpoint_id: checkpoint.checkpoint_id, + kind: checkpoint.kind, + disposition: checkpoint.disposition, + focus: checkpoint.focus, + summary: checkpoint.summary, + next_action: checkpoint.next_action, + captured_at_turn_id: checkpoint.captured_at_turn_id, + open_question_count: checkpoint.open_question_count, + code_ref_count: checkpoint.code_ref_count, + evidence_count: checkpoint.evidence_count, + } +} + +fn map_core_epiphany_scene_records( + records: CoreEpiphanySceneRecords, +) -> ThreadEpiphanySceneRecords { + ThreadEpiphanySceneRecords { + total_count: records.total_count, + latest: records + .latest + .into_iter() + .map(map_core_epiphany_scene_record) + .collect(), + } +} + +fn map_core_epiphany_scene_record(record: CoreEpiphanySceneRecord) -> ThreadEpiphanySceneRecord { + ThreadEpiphanySceneRecord { + id: record.id, + kind: record.kind, + status: record.status, + summary: record.summary, + code_ref_count: record.code_ref_count, + } +} + +fn map_core_epiphany_scene_churn(churn: CoreEpiphanySceneChurn) -> ThreadEpiphanySceneChurn { + ThreadEpiphanySceneChurn { + understanding_status: churn.understanding_status, + diff_pressure: churn.diff_pressure, + graph_freshness: churn.graph_freshness, + warning: churn.warning, + unexplained_writes: churn.unexplained_writes, + } +} diff --git a/vendor/codex/codex-rs/app-server/src/lib.rs b/vendor/codex/codex-rs/app-server/src/lib.rs index 12c9136c..97c6f45e 100644 --- a/vendor/codex/codex-rs/app-server/src/lib.rs +++ b/vendor/codex/codex-rs/app-server/src/lib.rs @@ -78,6 +78,7 @@ mod dynamic_tools; mod epiphany_invalidation; mod epiphany_launch; mod epiphany_results; +mod epiphany_scene; mod error_code; mod external_agent_config_api; mod filters;