Move view lens planning into core

This commit is contained in:
Meta Vens 2026-05-20 09:54:23 +01:00
commit fc6976687f
10 changed files with 81 additions and 55 deletions

View file

@ -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<EpiphanyViewLens> {
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<ThreadEpiphanyViewLens>) -> Vec<EpiphanyViewLens> {
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,

View file

@ -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;

View file

@ -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;

View file

@ -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<EpiphanyViewLens> {
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)
}

View file

@ -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.

Binary file not shown.

View file

@ -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

1
vendor/codex/codex-rs/Cargo.lock generated vendored
View file

@ -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",

View file

@ -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 }

View file

@ -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;