diff --git a/epiphany-codex-bridge/src/view.rs b/epiphany-codex-bridge/src/view.rs index 07ed7f9d..daa264cc 100644 --- a/epiphany-codex-bridge/src/view.rs +++ b/epiphany-codex-bridge/src/view.rs @@ -8,8 +8,12 @@ use epiphany_core::EpiphanyMapProposalInput; use epiphany_core::EpiphanyRoleResultRoleId; use epiphany_core::EpiphanySceneInput; use epiphany_core::EpiphanyTokenUsageSnapshot; +use epiphany_core::EpiphanyViewLens; use epiphany_core::derive_scene; use epiphany_core::distill_observation; +use epiphany_core::epiphany_view_needs_jobs; +use epiphany_core::epiphany_view_needs_pressure; +use epiphany_core::epiphany_view_needs_reorientation_inputs; use epiphany_core::propose_map_update; use epiphany_core::reorient_finding_already_accepted; use epiphany_state_model::EpiphanyRetrievalState; @@ -46,31 +50,6 @@ use crate::runtime_results::map_protocol_role_result_status; use crate::scene::map_core_epiphany_scene_action; use crate::scene::map_epiphany_scene; -#[derive(Clone, Copy, Debug, PartialEq, Eq)] -pub enum EpiphanyViewLens { - Scene, - Jobs, - Roles, - Planning, - Pressure, - Reorient, - Crrc, - Coordinator, -} - -pub fn default_epiphany_view_lenses() -> Vec { - vec![ - EpiphanyViewLens::Scene, - EpiphanyViewLens::Jobs, - EpiphanyViewLens::Roles, - EpiphanyViewLens::Planning, - EpiphanyViewLens::Pressure, - EpiphanyViewLens::Reorient, - EpiphanyViewLens::Crrc, - EpiphanyViewLens::Coordinator, - ] -} - pub fn map_core_epiphany_view_lenses(lenses: Vec) -> Vec { lenses .into_iter() @@ -104,30 +83,6 @@ fn map_protocol_epiphany_view_lens(lens: EpiphanyViewLens) -> ThreadEpiphanyView } } -pub fn epiphany_view_needs_jobs(lenses: &[EpiphanyViewLens]) -> bool { - lenses.contains(&EpiphanyViewLens::Jobs) - || lenses.contains(&EpiphanyViewLens::Roles) - || lenses.contains(&EpiphanyViewLens::Crrc) - || lenses.contains(&EpiphanyViewLens::Coordinator) -} - -pub fn epiphany_view_needs_reorientation_inputs(lenses: &[EpiphanyViewLens]) -> bool { - lenses.contains(&EpiphanyViewLens::Roles) - || lenses.contains(&EpiphanyViewLens::Reorient) - || lenses.contains(&EpiphanyViewLens::Crrc) - || lenses.contains(&EpiphanyViewLens::Coordinator) -} - -pub fn epiphany_view_needs_pressure(lenses: &[EpiphanyViewLens]) -> bool { - lenses.contains(&EpiphanyViewLens::Pressure) || epiphany_view_needs_reorientation_inputs(lenses) -} - -pub fn epiphany_view_needs_runtime_store(lenses: &[EpiphanyViewLens]) -> bool { - lenses.contains(&EpiphanyViewLens::Roles) - || lenses.contains(&EpiphanyViewLens::Crrc) - || lenses.contains(&EpiphanyViewLens::Coordinator) -} - pub struct EpiphanyFreshnessResponseInput<'a> { pub thread_id: String, pub loaded: bool, diff --git a/epiphany-core/src/lib.rs b/epiphany-core/src/lib.rs index 10af7adc..892ad48e 100644 --- a/epiphany-core/src/lib.rs +++ b/epiphany-core/src/lib.rs @@ -313,6 +313,7 @@ pub use surfaces::EpiphanySceneStateStatus; pub use surfaces::EpiphanySceneStatusCount; pub use surfaces::EpiphanySceneSubgoal; pub use surfaces::EpiphanyTokenUsageSnapshot; +pub use surfaces::EpiphanyViewLens; pub use surfaces::EpiphanyWorkerLaunchDocument; pub use surfaces::REORIENT_WORKER_OUTPUT_CONTRACT_ID; pub use surfaces::ROLE_WORKER_OUTPUT_CONTRACT_ID; @@ -321,6 +322,7 @@ pub use surfaces::build_reorient_job_launch_request; pub use surfaces::build_role_acceptance_bundle; pub use surfaces::coordinator_automation_action; pub use surfaces::crrc_scene_action_to_coordinator_scene_action; +pub use surfaces::default_epiphany_view_lenses; pub use surfaces::derive_context; pub use surfaces::derive_coordinator_finding_signals; pub use surfaces::derive_coordinator_status; @@ -331,6 +333,10 @@ pub use surfaces::derive_planning_view; pub use surfaces::derive_pressure_view; pub use surfaces::derive_role_board; pub use surfaces::derive_scene; +pub use surfaces::epiphany_view_needs_jobs; +pub use surfaces::epiphany_view_needs_pressure; +pub use surfaces::epiphany_view_needs_reorientation_inputs; +pub use surfaces::epiphany_view_needs_runtime_store; pub use surfaces::imagination_role_state_patch_policy_errors; pub use surfaces::interpret_runtime_reorient_worker_result; pub use surfaces::interpret_runtime_role_worker_result; diff --git a/epiphany-core/src/surfaces/mod.rs b/epiphany-core/src/surfaces/mod.rs index 03c6a071..a23f4e8c 100644 --- a/epiphany-core/src/surfaces/mod.rs +++ b/epiphany-core/src/surfaces/mod.rs @@ -10,6 +10,7 @@ mod role_board; mod role_result; mod scene; mod state_patch; +mod view; mod worker_launch; pub use coordinator::EpiphanyCoordinatorAction; @@ -131,6 +132,12 @@ pub use scene::EpiphanySceneStatusCount; pub use scene::EpiphanySceneSubgoal; pub use scene::derive_scene; pub use state_patch::EpiphanyRoleStatePatchDocument; +pub use view::EpiphanyViewLens; +pub use view::default_epiphany_view_lenses; +pub use view::epiphany_view_needs_jobs; +pub use view::epiphany_view_needs_pressure; +pub use view::epiphany_view_needs_reorientation_inputs; +pub use view::epiphany_view_needs_runtime_store; pub use worker_launch::EpiphanyReorientLaunchRequestInput; pub use worker_launch::EpiphanyReorientWorkerLaunchDocument; pub use worker_launch::EpiphanyRoleWorkerLaunchDocument; diff --git a/epiphany-core/src/surfaces/view.rs b/epiphany-core/src/surfaces/view.rs new file mode 100644 index 00000000..fa35811e --- /dev/null +++ b/epiphany-core/src/surfaces/view.rs @@ -0,0 +1,52 @@ +use serde::Deserialize; +use serde::Serialize; + +#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub enum EpiphanyViewLens { + Scene, + Jobs, + Roles, + Planning, + Pressure, + Reorient, + Crrc, + Coordinator, +} + +pub fn default_epiphany_view_lenses() -> Vec { + vec![ + EpiphanyViewLens::Scene, + EpiphanyViewLens::Jobs, + EpiphanyViewLens::Roles, + EpiphanyViewLens::Planning, + EpiphanyViewLens::Pressure, + EpiphanyViewLens::Reorient, + EpiphanyViewLens::Crrc, + EpiphanyViewLens::Coordinator, + ] +} + +pub fn epiphany_view_needs_jobs(lenses: &[EpiphanyViewLens]) -> bool { + lenses.contains(&EpiphanyViewLens::Jobs) + || lenses.contains(&EpiphanyViewLens::Roles) + || lenses.contains(&EpiphanyViewLens::Crrc) + || lenses.contains(&EpiphanyViewLens::Coordinator) +} + +pub fn epiphany_view_needs_reorientation_inputs(lenses: &[EpiphanyViewLens]) -> bool { + lenses.contains(&EpiphanyViewLens::Roles) + || lenses.contains(&EpiphanyViewLens::Reorient) + || lenses.contains(&EpiphanyViewLens::Crrc) + || lenses.contains(&EpiphanyViewLens::Coordinator) +} + +pub fn epiphany_view_needs_pressure(lenses: &[EpiphanyViewLens]) -> bool { + lenses.contains(&EpiphanyViewLens::Pressure) || epiphany_view_needs_reorientation_inputs(lenses) +} + +pub fn epiphany_view_needs_runtime_store(lenses: &[EpiphanyViewLens]) -> bool { + lenses.contains(&EpiphanyViewLens::Roles) + || lenses.contains(&EpiphanyViewLens::Crrc) + || lenses.contains(&EpiphanyViewLens::Coordinator) +} diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index c3b7d51a..133e904a 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -76,6 +76,7 @@ remembers doctrine; the branch remembers the blade. - Coordinator view response assembly now receives core reorient state and role-board status; `ThreadEpiphanyReorientStateStatus` / `ThreadEpiphanyRoleLane` are projected inside the response builder. - 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. - 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 810b880c..6e79a0de 100644 Binary files a/state/ledgers.msgpack and b/state/ledgers.msgpack differ diff --git a/state/map.yaml b/state/map.yaml index 1108af8e..634db3d8 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -378,7 +378,10 @@ current_status: coordinator decision assembly. Coordinator finding signals now derive in core from typed modeling/verification/reorient findings plus `EpiphanyThreadState`, so accepted/reviewable/coverage/verdict/evidence - sequencing facts are no longer bridge helper law. Reorient worker launch-request/document + 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 composition also moved behind a typed core seam (`EpiphanyReorientLaunchRequestInput` -> `EpiphanyJobLaunchRequest`); bridge supplies only the prompt instruction and retained compatibility diff --git a/vendor/codex/codex-rs/Cargo.lock b/vendor/codex/codex-rs/Cargo.lock index d3bfae8c..a79365fa 100644 --- a/vendor/codex/codex-rs/Cargo.lock +++ b/vendor/codex/codex-rs/Cargo.lock @@ -1913,6 +1913,7 @@ dependencies = [ "constant_time_eq 0.3.1", "core_test_support", "epiphany-codex-bridge", + "epiphany-core", "futures", "gethostname", "hmac 0.12.1", diff --git a/vendor/codex/codex-rs/app-server/Cargo.toml b/vendor/codex/codex-rs/app-server/Cargo.toml index 5d7b6021..21403d7c 100644 --- a/vendor/codex/codex-rs/app-server/Cargo.toml +++ b/vendor/codex/codex-rs/app-server/Cargo.toml @@ -61,6 +61,7 @@ codex-utils-json-to-toml = { workspace = true } codex-utils-rustls-provider = { workspace = true } chrono = { workspace = true } epiphany-codex-bridge = { path = "../../../../epiphany-codex-bridge" } +epiphany-core = { path = "../../../../epiphany-core" } clap = { workspace = true, features = ["derive"] } constant_time_eq = { workspace = true } futures = { workspace = true } 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 ea2a408d..955411f1 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 @@ -21,12 +21,7 @@ use epiphany_codex_bridge::view::EpiphanyFreshnessResponseInput; use epiphany_codex_bridge::view::EpiphanyReorientResultResponseInput; use epiphany_codex_bridge::view::EpiphanyRoleResultResponseInput; use epiphany_codex_bridge::view::EpiphanyViewResponseInput; -use epiphany_codex_bridge::view::default_epiphany_view_lenses; use epiphany_codex_bridge::view::derive_epiphany_freshness_surface; -use epiphany_codex_bridge::view::epiphany_view_needs_jobs; -use epiphany_codex_bridge::view::epiphany_view_needs_pressure; -use epiphany_codex_bridge::view::epiphany_view_needs_reorientation_inputs; -use epiphany_codex_bridge::view::epiphany_view_needs_runtime_store; use epiphany_codex_bridge::view::map_core_epiphany_distill_input; use epiphany_codex_bridge::view::map_core_epiphany_view_lenses; use epiphany_codex_bridge::view::map_epiphany_context_response; @@ -36,6 +31,11 @@ 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::default_epiphany_view_lenses; +use epiphany_core::epiphany_view_needs_jobs; +use epiphany_core::epiphany_view_needs_pressure; +use epiphany_core::epiphany_view_needs_reorientation_inputs; +use epiphany_core::epiphany_view_needs_runtime_store; use super::CodexMessageProcessor; use super::ConnectionRequestId;