Extract Epiphany planning view into core
This commit is contained in:
parent
9d01a7df3e
commit
b61507f280
8 changed files with 217 additions and 67 deletions
|
|
@ -160,6 +160,9 @@ pub use surfaces::EpiphanyInvalidationStatus;
|
|||
pub use surfaces::EpiphanyJobStatus;
|
||||
pub use surfaces::EpiphanyJobView;
|
||||
pub use surfaces::EpiphanyJobsInput;
|
||||
pub use surfaces::EpiphanyPlanningStateStatus;
|
||||
pub use surfaces::EpiphanyPlanningSummary;
|
||||
pub use surfaces::EpiphanyPlanningView;
|
||||
pub use surfaces::EpiphanyPressure;
|
||||
pub use surfaces::EpiphanyPressureBasis;
|
||||
pub use surfaces::EpiphanyPressureLevel;
|
||||
|
|
@ -196,6 +199,7 @@ pub use surfaces::coordinator_automation_action;
|
|||
pub use surfaces::crrc_scene_action_to_coordinator_scene_action;
|
||||
pub use surfaces::derive_freshness;
|
||||
pub use surfaces::derive_jobs;
|
||||
pub use surfaces::derive_planning_view;
|
||||
pub use surfaces::derive_pressure_view;
|
||||
pub use surfaces::derive_role_board;
|
||||
pub use surfaces::imagination_role_state_patch_policy_errors;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ mod coordinator;
|
|||
mod crrc;
|
||||
mod freshness;
|
||||
mod jobs;
|
||||
mod planning;
|
||||
mod pressure;
|
||||
mod reorient;
|
||||
mod role_board;
|
||||
|
|
@ -44,6 +45,10 @@ pub use jobs::EpiphanyJobStatus;
|
|||
pub use jobs::EpiphanyJobView;
|
||||
pub use jobs::EpiphanyJobsInput;
|
||||
pub use jobs::derive_jobs;
|
||||
pub use planning::EpiphanyPlanningStateStatus;
|
||||
pub use planning::EpiphanyPlanningSummary;
|
||||
pub use planning::EpiphanyPlanningView;
|
||||
pub use planning::derive_planning_view;
|
||||
pub use pressure::EpiphanyPressure;
|
||||
pub use pressure::EpiphanyPressureBasis;
|
||||
pub use pressure::EpiphanyPressureLevel;
|
||||
|
|
|
|||
164
epiphany-core/src/surfaces/planning.rs
Normal file
164
epiphany-core/src/surfaces/planning.rs
Normal file
|
|
@ -0,0 +1,164 @@
|
|||
use codex_protocol::protocol::EpiphanyPlanningState;
|
||||
use codex_protocol::protocol::EpiphanyThreadState;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum EpiphanyPlanningStateStatus {
|
||||
Missing,
|
||||
Ready,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct EpiphanyPlanningSummary {
|
||||
pub capture_count: u32,
|
||||
pub pending_capture_count: u32,
|
||||
pub github_issue_capture_count: u32,
|
||||
pub backlog_item_count: u32,
|
||||
pub ready_backlog_item_count: u32,
|
||||
pub roadmap_stream_count: u32,
|
||||
pub objective_draft_count: u32,
|
||||
pub draft_objective_count: u32,
|
||||
pub active_objective: Option<String>,
|
||||
pub note: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct EpiphanyPlanningView {
|
||||
pub state_status: EpiphanyPlanningStateStatus,
|
||||
pub state_revision: Option<u64>,
|
||||
pub planning: EpiphanyPlanningState,
|
||||
pub summary: EpiphanyPlanningSummary,
|
||||
}
|
||||
|
||||
pub fn derive_planning_view(state: Option<&EpiphanyThreadState>) -> EpiphanyPlanningView {
|
||||
let Some(state) = state else {
|
||||
return EpiphanyPlanningView {
|
||||
state_status: EpiphanyPlanningStateStatus::Missing,
|
||||
state_revision: None,
|
||||
planning: EpiphanyPlanningState::default(),
|
||||
summary: EpiphanyPlanningSummary {
|
||||
capture_count: 0,
|
||||
pending_capture_count: 0,
|
||||
github_issue_capture_count: 0,
|
||||
backlog_item_count: 0,
|
||||
ready_backlog_item_count: 0,
|
||||
roadmap_stream_count: 0,
|
||||
objective_draft_count: 0,
|
||||
draft_objective_count: 0,
|
||||
active_objective: None,
|
||||
note: "No authoritative Epiphany state exists for this thread.".to_string(),
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
let planning = state.planning.clone();
|
||||
let pending_capture_count = planning
|
||||
.captures
|
||||
.iter()
|
||||
.filter(|capture| capture.status == "new" || capture.status == "inbox")
|
||||
.count() as u32;
|
||||
let github_issue_capture_count = planning
|
||||
.captures
|
||||
.iter()
|
||||
.filter(|capture| capture.source.kind == "github_issue")
|
||||
.count() as u32;
|
||||
let ready_backlog_item_count = planning
|
||||
.backlog_items
|
||||
.iter()
|
||||
.filter(|item| item.status == "ready")
|
||||
.count() as u32;
|
||||
let draft_objective_count = planning
|
||||
.objective_drafts
|
||||
.iter()
|
||||
.filter(|draft| draft.status == "draft")
|
||||
.count() as u32;
|
||||
let note = if planning.is_empty() {
|
||||
"Planning substrate is present but empty; captures, backlog, roadmap streams, and objective drafts have not been written yet."
|
||||
} else {
|
||||
"Planning substrate is available. These records are planning state only until a human explicitly adopts an objective."
|
||||
}
|
||||
.to_string();
|
||||
|
||||
EpiphanyPlanningView {
|
||||
state_status: EpiphanyPlanningStateStatus::Ready,
|
||||
state_revision: Some(state.revision),
|
||||
planning: planning.clone(),
|
||||
summary: EpiphanyPlanningSummary {
|
||||
capture_count: planning.captures.len() as u32,
|
||||
pending_capture_count,
|
||||
github_issue_capture_count,
|
||||
backlog_item_count: planning.backlog_items.len() as u32,
|
||||
ready_backlog_item_count,
|
||||
roadmap_stream_count: planning.roadmap_streams.len() as u32,
|
||||
objective_draft_count: planning.objective_drafts.len() as u32,
|
||||
draft_objective_count,
|
||||
active_objective: state.objective.clone(),
|
||||
note,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use codex_protocol::protocol::EpiphanyPlanningCapture;
|
||||
use codex_protocol::protocol::EpiphanyPlanningSourceRef;
|
||||
|
||||
#[test]
|
||||
fn missing_state_returns_empty_planning() {
|
||||
let view = derive_planning_view(None);
|
||||
|
||||
assert_eq!(view.state_status, EpiphanyPlanningStateStatus::Missing);
|
||||
assert_eq!(view.state_revision, None);
|
||||
assert_eq!(view.summary.capture_count, 0);
|
||||
assert!(view.planning.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn summarizes_planning_counts_without_adopting_objective() {
|
||||
let state = EpiphanyThreadState {
|
||||
revision: 3,
|
||||
objective: Some("active objective".to_string()),
|
||||
planning: EpiphanyPlanningState {
|
||||
captures: vec![
|
||||
EpiphanyPlanningCapture {
|
||||
id: "cap-1".to_string(),
|
||||
title: "capture one".to_string(),
|
||||
confidence: "high".to_string(),
|
||||
status: "new".to_string(),
|
||||
source: EpiphanyPlanningSourceRef {
|
||||
kind: "github_issue".to_string(),
|
||||
issue_number: Some(1),
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
},
|
||||
EpiphanyPlanningCapture {
|
||||
id: "cap-2".to_string(),
|
||||
title: "capture two".to_string(),
|
||||
confidence: "medium".to_string(),
|
||||
status: "accepted".to_string(),
|
||||
source: EpiphanyPlanningSourceRef {
|
||||
kind: "conversation".to_string(),
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
},
|
||||
],
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let view = derive_planning_view(Some(&state));
|
||||
|
||||
assert_eq!(view.state_status, EpiphanyPlanningStateStatus::Ready);
|
||||
assert_eq!(view.state_revision, Some(3));
|
||||
assert_eq!(view.summary.capture_count, 2);
|
||||
assert_eq!(view.summary.pending_capture_count, 1);
|
||||
assert_eq!(view.summary.github_issue_capture_count, 1);
|
||||
assert_eq!(
|
||||
view.summary.active_objective.as_deref(),
|
||||
Some("active objective")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -29,7 +29,7 @@ The spine exists in more than twenty-five live paths:
|
|||
- freshness reflection: app-server declares experimental read-only `thread/epiphany/freshness`, reads the same live/stored thread view used by the view lenses and context, fills live retrieval state for loaded threads, then adapts those inputs into core freshness policy. `epiphany-core` derives the bounded retrieval/graph freshness lens plus watcher-backed invalidation inputs with watched root, changed paths, mapped graph-node hits, active-frontier hits, and revision/source identity; app-server maps the core result to protocol without mutating, scheduling, notifying, or performing automatic semantic invalidation in [freshness.rs](E:/Projects/EpiphanyAgent/epiphany-core/src/surfaces/freshness.rs:1), [common.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/common.rs:350), [v2.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs:4167), [v2.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs:4259), [epiphany_invalidation.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/epiphany_invalidation.rs:19), [epiphany_invalidation.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/epiphany_invalidation.rs:67), and [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:14910).
|
||||
- targeted context reflection: app-server declares experimental read-only `thread/epiphany/context`, reads the same live/stored Epiphany state view used by the view lenses, and derives a bounded state shard containing selected graph nodes/edges, links, active frontier, checkpoint, the full durable investigation-checkpoint packet, observations, direct evidence, linked evidence, and missing requested ids without retrieval, proposal, promotion, notification, mutation, or persistence in [common.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/common.rs:355), [v2.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs:4253), [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4261), and [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:11152).
|
||||
- graph traversal reflection: app-server declares experimental read-only `thread/epiphany/graphQuery`, reads the same live Epiphany state view used by context, and derives explicit node/edge lookup, path/symbol matches, bounded neighbors, edge-kind matches, and frontier neighborhoods with architecture/dataflow links plus frontier/checkpoint identity, matched selectors, and missing ids without retrieval, proposal, promotion, indexing, notification, mutation, or scheduling in [common.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/common.rs:379), [v2.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs:4720), [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:5060), and [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:15201).
|
||||
- planning reflection: the `planning` view lens reads the same live/stored Epiphany state view and returns typed captures, backlog items, roadmap streams, Objective Drafts, GitHub source refs, count summaries, and the separate active objective without adopting drafts, launching work, notifying, mutating, or scheduling.
|
||||
- planning reflection: the `planning` view lens reads the same live/stored Epiphany state view and adapts the core planning projection. `epiphany-core` returns typed captures, backlog items, roadmap streams, Objective Drafts, GitHub source refs, count summaries, and the separate active objective without adopting drafts, launching work, notifying, mutating, or scheduling in [planning.rs](E:/Projects/EpiphanyAgent/epiphany-core/src/surfaces/planning.rs:1).
|
||||
- canonical view lens reflection: app-server declares experimental read-only `thread/epiphany/view` with selectable lenses and uses it as the canonical operator read surface for pressure, reorient, CRRC, and coordinator projections. Those projections no longer have standalone protocol verbs; the separate `reorientLaunch`, `reorientResult`, and `reorientAccept` surfaces remain because they carry authority, result read-back, and review acceptance rather than mere reflection.
|
||||
- context-pressure reflection: core token telemetry carries `model_auto_compact_token_limit` beside total/last usage and `model_context_window`; the `pressure` view lens reads live token usage or the latest stored rollout `TokenCount`, derives current context pressure from `last_token_usage` rather than cumulative thread spend, treats cumulative-only telemetry as unknown, and raises `shouldPrepareCompaction` at 80% of the active auto-compact/context limit without mutating Epiphany state or scheduling compaction in [protocol.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/protocol/src/protocol.rs:2237), [turn_context.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/core/src/session/turn_context.rs:103), [session/mod.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/core/src/session/mod.rs:2716), [common.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/common.rs:360), [v2.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs:4361), [token_usage_replay.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor/token_usage_replay.rs:75), [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4306), and [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:11028).
|
||||
- pre-compaction checkpoint intervention: app-server `TokenCount` handling now checks the same pressure mapper, and for loaded Epiphany threads crossing `shouldPrepareCompaction` it steers the active turn once with a bounded CRRC checkpoint directive to bank working context before compaction/reorientation. The per-turn dedupe bit and the pending compact handoff live in listener `ThreadState`; successful steering marks the active turn for a forced compact action at clean turn completion, while aborted turns clear the handoff. The intervention uses existing turn steering and turn-boundary automation rather than a new scheduler in [bespoke_event_handling.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/bespoke_event_handling.rs:1467), [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:15405), and [thread_state.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/thread_state.rs:144).
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ remembers doctrine; the branch remembers the blade.
|
|||
## Current Orientation
|
||||
|
||||
- Do not copy exact branch or HEAD from this note. Run `git status --short --branch` and `git log --oneline -5`.
|
||||
- Top priority is still foundation cleanup, not outward feature work. Read `notes/epiphany-architectural-teardown.md` before touching Epiphany control-plane code. The May 2026 suspicion pass found that the app-server Epiphany control plane had become architectural Jenga: too much policy, projection, lifecycle glue, prompt packet assembly, coordinator sequencing, and test authority lives in `vendor/codex/codex-rs/app-server/src/codex_message_processor.rs`. The rebuild has begun: freshness derivation, pressure policy, job/progress view derivation, reorientation resume/regather verdict policy, pure CRRC recommendation policy, fixed-lane coordinator decision policy, role-board projection policy, role-result interpretation/self-persistence review policy, and role/reorient acceptance bundle policy moved into `epiphany-core`, typed acceptance receipts replaced summary-string identity for live accept paths, runtime links are dual-written on launch, and result read-back now prefers runtime links.
|
||||
- Top priority is still foundation cleanup, not outward feature work. Read `notes/epiphany-architectural-teardown.md` before touching Epiphany control-plane code. The May 2026 suspicion pass found that the app-server Epiphany control plane had become architectural Jenga: too much policy, projection, lifecycle glue, prompt packet assembly, coordinator sequencing, and test authority lives in `vendor/codex/codex-rs/app-server/src/codex_message_processor.rs`. The rebuild has begun: freshness derivation, pressure policy, job/progress view derivation, planning view derivation, reorientation resume/regather verdict policy, pure CRRC recommendation policy, fixed-lane coordinator decision policy, role-board projection policy, role-result interpretation/self-persistence review policy, and role/reorient acceptance bundle policy moved into `epiphany-core`, typed acceptance receipts replaced summary-string identity for live accept paths, runtime links are dual-written on launch, and result read-back now prefers runtime links.
|
||||
- Read `notes/epiphany-ideal-architecture-rebuild-plan.md` immediately after the teardown. It defines the smallest coherent replacement architecture: durable `EpiphanyState`, runtime-spine-owned `RuntimeState`, separate role memory/heartbeat state, `epiphany-core` as policy owner, app-server as adapter, Aquarium as reflector, typed acceptance receipts, and derived view lenses instead of a protocol verb zoo.
|
||||
- Do not continue Aquarium UI, bridge, Face, or dogfood expansion until the teardown has a source-grounded cleanup slice plan. Epiphany is the foundation; patches on patches are not a purification rite, they are how the altar becomes load-bearing garbage.
|
||||
- Phase 1 through Phase 5 are complete enough.
|
||||
|
|
@ -369,7 +369,7 @@ Phase 6 bridge/UI trail. Landed rebuild cuts: `epiphany-core/src/surfaces/`
|
|||
exists, pressure view derivation/tests, pure CRRC recommendation policy/tests,
|
||||
fixed-lane coordinator decision policy/tests, role-board projection policy/tests,
|
||||
role-result interpretation/self-persistence review policy/tests, and role/reorient
|
||||
acceptance bundle policy/tests, freshness derivation/tests, reorientation resume/regather verdict policy/tests, and job/progress view derivation/tests live in core, live acceptance writes typed receipts keyed by runtime result id,
|
||||
acceptance bundle policy/tests, freshness derivation/tests, planning view derivation/tests, reorientation resume/regather verdict policy/tests, and job/progress view derivation/tests live in core, live acceptance writes typed receipts keyed by runtime result id,
|
||||
summary-string acceptance identity is gone for live paths, launches dual-write
|
||||
runtime links, result read-back prefers those runtime links, normal public
|
||||
`raw_result` is sealed, MVP consumers use `thread/epiphany/view`, heartbeat
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -100,7 +100,7 @@ accepted_design:
|
|||
- `thread/epiphany/retrieve`, `thread/epiphany/distill`, `thread/epiphany/propose`, `thread/epiphany/freshness`, `thread/epiphany/context`, `thread/epiphany/graphQuery`, and `thread/epiphany/view` stay read-only.
|
||||
- `thread/epiphany/index` writes the retrieval catalog, not durable Epiphany understanding; catalog is auspex output, not doctrine.
|
||||
- Qdrant is the preferred persistent semantic backend; BM25 remains the bootstrap/fallback/control path.
|
||||
- `epiphany-core` owns prompt rendering, rollout replay helpers, retrieval/indexing, distillation, proposal, promotion policy, freshness derivation, pressure derivation, job/progress view derivation, reorientation resume/regather verdict policy, pure CRRC recommendation policy, fixed-lane coordinator decision policy, role-board projection policy, and role-result interpretation/self-persistence review policy where possible.
|
||||
- `epiphany-core` owns prompt rendering, rollout replay helpers, retrieval/indexing, distillation, proposal, promotion policy, freshness derivation, pressure derivation, job/progress view derivation, planning view derivation, reorientation resume/regather verdict policy, pure CRRC recommendation policy, fixed-lane coordinator decision policy, role-board projection policy, and role-result interpretation/self-persistence review policy where possible.
|
||||
- Vendored Codex keeps the thin typed host seam: protocol types, thread bridges, app-server protocol, request routing, and rollout integration.
|
||||
- The current algorithmic map is the source-grounded description of live control flow.
|
||||
- Compact-Rehydrate-Reorient-Continue is an architecture primitive; automatic runtime coordination is not landed yet.
|
||||
|
|
@ -272,5 +272,5 @@ rejected_paths:
|
|||
reason: persistent state that accumulates every local truth becomes memory cruft and weakens rehydration
|
||||
|
||||
current_status:
|
||||
summary: Phase 1 durable state through Phase 6 coordinator/specialist/CRRC/backend organs are landed, and the May 2026 rebuild has started cutting the app-server control-plane tumor. Freshness derivation, pressure, job/progress view derivation, reorientation resume/regather verdicts, CRRC, coordinator, role-board, role-result interpretation/self-persistence review, and role/reorient acceptance bundle policy now live in `epiphany-core`; live duplicate-acceptance checks use runtime result receipt identity instead of summary strings; launch writes durable `runtime_links`; role/reorient result read-back follows runtime links; and `jobBindings` no longer store launcher/backend/progress lifecycle fields.
|
||||
next_action: Continue the teardown/rebuild migration from `notes/epiphany-ideal-architecture-rebuild-plan.md`. Landed cuts now shrink `jobBindings`, remove normal public `raw_result`, add the canonical `thread/epiphany/view` lens wrapper, migrate MVP consumers, quarantine heartbeat cognition blobs, delete the old scene/jobs/roles/planning/pressure/reorient/CRRC/coordinator read wrappers, and move freshness derivation, pure CRRC, fixed-lane coordinator decision policy, job/progress view derivation, reorientation resume/regather verdict policy, role-board projection policy, role-result interpretation/self-persistence review policy, and role/reorient acceptance bundle policy into `epiphany-core`. The next pass is to audit the plan's remaining success criteria and cut whatever still makes app-server more than routing/adaptation. Do not resume outward Aquarium/bridge/Face/dogfood expansion until this foundation cleanup is complete enough to defend.
|
||||
summary: Phase 1 durable state through Phase 6 coordinator/specialist/CRRC/backend organs are landed, and the May 2026 rebuild has started cutting the app-server control-plane tumor. Freshness derivation, pressure, job/progress view derivation, planning view derivation, reorientation resume/regather verdicts, CRRC, coordinator, role-board, role-result interpretation/self-persistence review, and role/reorient acceptance bundle policy now live in `epiphany-core`; live duplicate-acceptance checks use runtime result receipt identity instead of summary strings; launch writes durable `runtime_links`; role/reorient result read-back follows runtime links; and `jobBindings` no longer store launcher/backend/progress lifecycle fields.
|
||||
next_action: Continue the teardown/rebuild migration from `notes/epiphany-ideal-architecture-rebuild-plan.md`. Landed cuts now shrink `jobBindings`, remove normal public `raw_result`, add the canonical `thread/epiphany/view` lens wrapper, migrate MVP consumers, quarantine heartbeat cognition blobs, delete the old scene/jobs/roles/planning/pressure/reorient/CRRC/coordinator read wrappers, and move freshness derivation, pure CRRC, fixed-lane coordinator decision policy, job/progress view derivation, planning view derivation, reorientation resume/regather verdict policy, role-board projection policy, role-result interpretation/self-persistence review policy, and role/reorient acceptance bundle policy into `epiphany-core`. The next pass is to audit the plan's remaining success criteria and cut whatever still makes app-server more than routing/adaptation. Do not resume outward Aquarium/bridge/Face/dogfood expansion until this foundation cleanup is complete enough to defend.
|
||||
|
|
|
|||
|
|
@ -521,6 +521,9 @@ use epiphany_core::EpiphanyInvalidationStatus as CoreEpiphanyInvalidationStatus;
|
|||
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;
|
||||
|
|
@ -554,6 +557,7 @@ use epiphany_core::build_role_acceptance_bundle;
|
|||
use epiphany_core::coordinator_automation_action;
|
||||
use epiphany_core::derive_freshness;
|
||||
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::imagination_role_state_patch_policy_errors;
|
||||
|
|
@ -15543,73 +15547,46 @@ fn map_epiphany_planning(
|
|||
EpiphanyPlanningState,
|
||||
ThreadEpiphanyPlanningSummary,
|
||||
) {
|
||||
let Some(state) = state else {
|
||||
return (
|
||||
ThreadEpiphanyContextStateStatus::Missing,
|
||||
None,
|
||||
EpiphanyPlanningState::default(),
|
||||
ThreadEpiphanyPlanningSummary {
|
||||
capture_count: 0,
|
||||
pending_capture_count: 0,
|
||||
github_issue_capture_count: 0,
|
||||
backlog_item_count: 0,
|
||||
ready_backlog_item_count: 0,
|
||||
roadmap_stream_count: 0,
|
||||
objective_draft_count: 0,
|
||||
draft_objective_count: 0,
|
||||
active_objective: None,
|
||||
note: "No authoritative Epiphany state exists for this thread.".to_string(),
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
let planning = state.planning.clone();
|
||||
let pending_capture_count = planning
|
||||
.captures
|
||||
.iter()
|
||||
.filter(|capture| capture.status == "new" || capture.status == "inbox")
|
||||
.count() as u32;
|
||||
let github_issue_capture_count = planning
|
||||
.captures
|
||||
.iter()
|
||||
.filter(|capture| capture.source.kind == "github_issue")
|
||||
.count() as u32;
|
||||
let ready_backlog_item_count = planning
|
||||
.backlog_items
|
||||
.iter()
|
||||
.filter(|item| item.status == "ready")
|
||||
.count() as u32;
|
||||
let draft_objective_count = planning
|
||||
.objective_drafts
|
||||
.iter()
|
||||
.filter(|draft| draft.status == "draft")
|
||||
.count() as u32;
|
||||
let note = if planning.is_empty() {
|
||||
"Planning substrate is present but empty; captures, backlog, roadmap streams, and objective drafts have not been written yet."
|
||||
} else {
|
||||
"Planning substrate is available. These records are planning state only until a human explicitly adopts an objective."
|
||||
}
|
||||
.to_string();
|
||||
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,
|
||||
) {
|
||||
(
|
||||
ThreadEpiphanyContextStateStatus::Ready,
|
||||
Some(state.revision),
|
||||
planning.clone(),
|
||||
ThreadEpiphanyPlanningSummary {
|
||||
capture_count: planning.captures.len() as u32,
|
||||
pending_capture_count,
|
||||
github_issue_capture_count,
|
||||
backlog_item_count: planning.backlog_items.len() as u32,
|
||||
ready_backlog_item_count,
|
||||
roadmap_stream_count: planning.roadmap_streams.len() as u32,
|
||||
objective_draft_count: planning.objective_drafts.len() as u32,
|
||||
draft_objective_count,
|
||||
active_objective: state.objective.clone(),
|
||||
note,
|
||||
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,
|
||||
|
|
|
|||
Reference in a new issue