From 9408190fc4e2f74220df6deada5f09361359fa4c Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Tue, 19 May 2026 22:15:12 +0100 Subject: [PATCH] Serialize core result surfaces --- epiphany-core/src/surfaces/role_result.rs | 29 +++++++++++++++------- notes/fresh-workspace-handoff.md | 1 + state/ledgers.msgpack | Bin 134702 -> 134956 bytes state/map.yaml | 7 +++--- 4 files changed, 25 insertions(+), 12 deletions(-) diff --git a/epiphany-core/src/surfaces/role_result.rs b/epiphany-core/src/surfaces/role_result.rs index 7163fde1..4ccb2a3b 100644 --- a/epiphany-core/src/surfaces/role_result.rs +++ b/epiphany-core/src/surfaces/role_result.rs @@ -1,4 +1,7 @@ -#[derive(Debug, Clone, Copy, PartialEq, Eq)] +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub enum EpiphanyRoleResultRoleId { Implementation, Imagination, @@ -7,14 +10,16 @@ pub enum EpiphanyRoleResultRoleId { Reorientation, } -#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub enum EpiphanyRoleSelfPersistenceStatus { Missing, Accepted, Rejected, } -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub struct EpiphanyRoleSelfPersistenceReview { pub status: EpiphanyRoleSelfPersistenceStatus, pub target_agent_id: Option, @@ -22,7 +27,8 @@ pub struct EpiphanyRoleSelfPersistenceReview { pub reasons: Vec, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub struct EpiphanyRoleFindingInterpretation { pub verdict: Option, pub summary: Option, @@ -45,7 +51,8 @@ pub struct EpiphanyRoleFindingInterpretation { pub item_error: Option, } -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub struct EpiphanyRoleAcceptanceFinding { pub role_id: EpiphanyRoleResultRoleId, pub verdict: Option, @@ -57,7 +64,8 @@ pub struct EpiphanyRoleAcceptanceFinding { pub projected_fields: Vec, } -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub struct EpiphanyReorientAcceptanceFinding { pub mode: Option, pub summary: Option, @@ -68,7 +76,8 @@ pub struct EpiphanyReorientAcceptanceFinding { pub runtime_job_id: Option, } -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub struct EpiphanyReorientFindingInterpretation { pub mode: Option, pub summary: Option, @@ -84,7 +93,8 @@ pub struct EpiphanyReorientFindingInterpretation { pub item_error: Option, } -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub struct EpiphanyAcceptanceBundle { pub accepted_receipt_id: String, pub accepted_observation_id: String, @@ -94,7 +104,8 @@ pub struct EpiphanyAcceptanceBundle { pub receipt: EpiphanyAcceptanceReceipt, } -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub struct EpiphanyReorientAcceptanceBundle { pub accepted_receipt_id: String, pub accepted_observation_id: String, diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 85da1c25..600146bd 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -49,6 +49,7 @@ remembers doctrine; the branch remembers the blade. - `epiphany-codex-bridge` also no longer depends on `codex-protocol`. Bridge durable-state imports point at `epiphany-state-model`, token pressure takes native `EpiphanyTokenUsageSnapshot`, app-server maps Codex token telemetry at the host wall, Codex token usage rollout replay lives in `codex_message_processor/token_usage_replay.rs`, and bridge errors are `EpiphanyBridgeError`. The only remaining vendored bridge dependencies are app-server protocol DTOs and absolute path validation. - The first bridge JSON-RPC starvation cuts are landed. Freshness now returns a serializable `EpiphanyFreshnessSurface`, job launch/interrupt mutation results carry typed `EpiphanyJobView` plus separate host-edge launcher/backend ids, reorient/pre-compaction decisions consume typed `EpiphanyPressure`, reorient policy consumes typed freshness directly, and reorient launch documents/results use typed core reorient decisions/status before app-server projects them into legacy JSON-RPC DTOs. Continue by cutting the full view/coordinator board into typed surfaces, not by inventing adapters with nicer uniforms. - Coordinator/reorient decision/status is less contaminated now: `epiphany-codex-bridge` stores reorient decisions, coordinator decisions, source signals, CRRC recommendations, and role-board lanes as core-shaped types, core CRRC/coordinator/role-board surfaces serialize natively, and `ThreadEpiphany*` projection happens at the legacy view emission boundary. Keep cutting remaining result inputs until Aquarium/CultNet can read coordinator surfaces without JSON-RPC DTO authority. +- Core role/reorient finding interpretations and acceptance bundles now serialize natively too. Use those typed result surfaces as the next authority target; do not let `ThreadEpiphanyRoleFinding` or `ThreadEpiphanyReorientFinding` remain the bridge's internal result truth just because legacy view/accept responses still expose them. - 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 27775faaa8746b9a61971831177bd6611efbcca9..a55acec15f8c91de2fccd8c035d591ccd7ae1adc 100644 GIT binary patch delta 269 zcmZXPu}T9$6h)a-Da1-FQauqnSF?)|vb`Umq_TUNdC3lJX2&;g2x}v1VXH*gM*IQ^ z1O)Lb{FhXguEEas9?s?7u9UjHZ`4Dh)JLN_cUwEppIJXUP5Of* z9geazPfzl}V)fM9`?{bIOG!fH32Fk*