Move Epiphany job DTOs to core
This commit is contained in:
parent
b95b95c11d
commit
e6528b2e52
11 changed files with 92 additions and 89 deletions
|
|
@ -19,7 +19,6 @@ use codex_app_server_protocol::ThreadEpiphanyRoleStatus;
|
|||
use codex_app_server_protocol::ThreadEpiphanyRolesSource;
|
||||
use codex_app_server_protocol::ThreadEpiphanySceneAction;
|
||||
use codex_app_server_protocol::ThreadEpiphanyViewCoordinator;
|
||||
use codex_core::EpiphanyJobLaunchRequest;
|
||||
use codex_protocol::protocol::EpiphanyAcceptanceReceipt;
|
||||
use codex_protocol::protocol::EpiphanyRetrievalState;
|
||||
use codex_protocol::protocol::EpiphanyThreadState;
|
||||
|
|
@ -42,6 +41,7 @@ use epiphany_core::EpiphanyCrrcReorientAction as CoreEpiphanyCrrcReorientAction;
|
|||
use epiphany_core::EpiphanyCrrcResultStatus as CoreEpiphanyCrrcResultStatus;
|
||||
use epiphany_core::EpiphanyCrrcSceneAction as CoreEpiphanyCrrcSceneAction;
|
||||
use epiphany_core::EpiphanyCrrcStateStatus as CoreEpiphanyCrrcStateStatus;
|
||||
use epiphany_core::EpiphanyJobLaunchRequest;
|
||||
use epiphany_core::EpiphanyRoleBoardCheckpointSummary;
|
||||
use epiphany_core::EpiphanyRoleBoardInput;
|
||||
use epiphany_core::EpiphanyRoleBoardJob;
|
||||
|
|
|
|||
|
|
@ -12,11 +12,11 @@ use codex_app_server_protocol::ThreadEpiphanyRetrievalFreshnessStatus;
|
|||
use codex_app_server_protocol::ThreadEpiphanyRoleId;
|
||||
use codex_app_server_protocol::ThreadEpiphanyRoleWorkerLaunchDocument;
|
||||
use codex_app_server_protocol::ThreadEpiphanyWorkerLaunchDocument;
|
||||
use codex_core::EpiphanyJobLaunchRequest;
|
||||
use codex_protocol::protocol::EpiphanyInvestigationCheckpoint;
|
||||
use codex_protocol::protocol::EpiphanyInvestigationDisposition;
|
||||
use codex_protocol::protocol::EpiphanyJobKind as CoreEpiphanyJobKind;
|
||||
use codex_protocol::protocol::EpiphanyThreadState;
|
||||
use epiphany_core::EpiphanyJobLaunchRequest;
|
||||
use epiphany_core::EpiphanyReorientWorkerLaunchDocument;
|
||||
use epiphany_core::EpiphanyRoleWorkerLaunchDocument;
|
||||
use epiphany_core::EpiphanyWorkerLaunchDocument;
|
||||
|
|
@ -30,9 +30,7 @@ pub const EPIPHANY_VERIFICATION_OWNER_ROLE: &str = "epiphany-verifier";
|
|||
pub const EPIPHANY_REORIENT_LAUNCH_BINDING_ID: &str = "reorient-worker";
|
||||
pub const EPIPHANY_REORIENT_OWNER_ROLE: &str = "epiphany-reorient";
|
||||
|
||||
pub fn epiphany_role_binding_id(
|
||||
role_id: ThreadEpiphanyRoleId,
|
||||
) -> Result<&'static str, String> {
|
||||
pub fn epiphany_role_binding_id(role_id: ThreadEpiphanyRoleId) -> Result<&'static str, String> {
|
||||
match role_id {
|
||||
ThreadEpiphanyRoleId::Imagination => Ok(EPIPHANY_IMAGINATION_ROLE_BINDING_ID),
|
||||
ThreadEpiphanyRoleId::Modeling => Ok(EPIPHANY_MODELING_ROLE_BINDING_ID),
|
||||
|
|
@ -69,9 +67,7 @@ pub fn epiphany_role_label(role_id: ThreadEpiphanyRoleId) -> &'static str {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn epiphany_role_launch_output_schema(
|
||||
role_id: ThreadEpiphanyRoleId,
|
||||
) -> serde_json::Value {
|
||||
pub fn epiphany_role_launch_output_schema(role_id: ThreadEpiphanyRoleId) -> serde_json::Value {
|
||||
let verdict_enum = match role_id {
|
||||
ThreadEpiphanyRoleId::Imagination => {
|
||||
vec!["draft-ready", "planning-update-needed", "blocked"]
|
||||
|
|
@ -570,9 +566,7 @@ pub fn build_epiphany_reorient_launch_request(
|
|||
}
|
||||
}
|
||||
|
||||
pub fn build_epiphany_reorient_launch_instruction(
|
||||
action: ThreadEpiphanyReorientAction,
|
||||
) -> String {
|
||||
pub fn build_epiphany_reorient_launch_instruction(action: ThreadEpiphanyReorientAction) -> String {
|
||||
let prompts = &epiphany_specialist_prompt_config().reorientation;
|
||||
let body = match action {
|
||||
ThreadEpiphanyReorientAction::Resume => prompts.resume.as_str(),
|
||||
|
|
|
|||
|
|
@ -11,14 +11,14 @@ use codex_app_server_protocol::ThreadEpiphanyRoleId;
|
|||
use codex_app_server_protocol::ThreadEpiphanyStateUpdatedField;
|
||||
use codex_app_server_protocol::ThreadEpiphanyUpdatePatch;
|
||||
use codex_core::CodexThread;
|
||||
use codex_core::EpiphanyJobInterruptRequest;
|
||||
use codex_core::EpiphanyJobLaunchRequest;
|
||||
use codex_protocol::error::CodexErr;
|
||||
use codex_protocol::protocol::EpiphanyEvidenceRecord;
|
||||
use codex_protocol::protocol::EpiphanyJobKind as CoreEpiphanyJobKind;
|
||||
use codex_protocol::protocol::EpiphanyRetrievalState;
|
||||
use codex_protocol::protocol::EpiphanyThreadState;
|
||||
use codex_protocol::protocol::TokenUsageInfo as CoreTokenUsageInfo;
|
||||
use epiphany_core::EpiphanyJobInterruptRequest;
|
||||
use epiphany_core::EpiphanyJobLaunchRequest;
|
||||
use epiphany_core::EpiphanyPromotionInput;
|
||||
use epiphany_core::evaluate_promotion;
|
||||
|
||||
|
|
|
|||
|
|
@ -91,6 +91,10 @@ pub use retrieval::index_workspace;
|
|||
pub use retrieval::normalize_epiphany_retrieve_query;
|
||||
pub use retrieval::retrieval_state_for_workspace;
|
||||
pub use retrieval::retrieve_workspace;
|
||||
pub use runtime_spine::EpiphanyJobInterruptRequest;
|
||||
pub use runtime_spine::EpiphanyJobInterruptResult;
|
||||
pub use runtime_spine::EpiphanyJobLaunchRequest;
|
||||
pub use runtime_spine::EpiphanyJobLaunchResult;
|
||||
pub use runtime_spine::EpiphanyRuntimeEvent;
|
||||
pub use runtime_spine::EpiphanyRuntimeIdentity;
|
||||
pub use runtime_spine::EpiphanyRuntimeJob;
|
||||
|
|
@ -125,6 +129,7 @@ pub use runtime_spine::RuntimeSpineJobOptions;
|
|||
pub use runtime_spine::RuntimeSpineJobResultOptions;
|
||||
pub use runtime_spine::RuntimeSpineSessionOptions;
|
||||
pub use runtime_spine::append_runtime_event;
|
||||
pub use runtime_spine::clear_epiphany_job_binding_backend;
|
||||
pub use runtime_spine::complete_runtime_job;
|
||||
pub use runtime_spine::create_runtime_job;
|
||||
pub use runtime_spine::create_runtime_session;
|
||||
|
|
@ -134,6 +139,7 @@ pub use runtime_spine::open_runtime_spine_heartbeat_job;
|
|||
pub use runtime_spine::plan_runtime_spine_heartbeat_launch;
|
||||
pub use runtime_spine::put_runtime_reorient_worker_result;
|
||||
pub use runtime_spine::put_runtime_role_worker_result;
|
||||
pub use runtime_spine::replace_or_append_epiphany_job_binding;
|
||||
pub use runtime_spine::runtime_hello_frame;
|
||||
pub use runtime_spine::runtime_job_snapshot;
|
||||
pub use runtime_spine::runtime_reorient_worker_result;
|
||||
|
|
|
|||
|
|
@ -516,6 +516,45 @@ pub struct RuntimeSpineHeartbeatLaunchPlan {
|
|||
pub runtime_link: EpiphanyRuntimeLink,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct EpiphanyJobLaunchRequest {
|
||||
pub expected_revision: Option<u64>,
|
||||
pub binding_id: String,
|
||||
pub kind: EpiphanyJobKind,
|
||||
pub scope: String,
|
||||
pub owner_role: String,
|
||||
pub authority_scope: String,
|
||||
pub linked_subgoal_ids: Vec<String>,
|
||||
pub linked_graph_node_ids: Vec<String>,
|
||||
pub instruction: String,
|
||||
pub launch_document: EpiphanyWorkerLaunchDocument,
|
||||
pub output_contract_id: String,
|
||||
pub max_runtime_seconds: Option<u64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct EpiphanyJobLaunchResult {
|
||||
pub epiphany_state: EpiphanyThreadState,
|
||||
pub binding_id: String,
|
||||
pub launcher_job_id: String,
|
||||
pub backend_job_id: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct EpiphanyJobInterruptRequest {
|
||||
pub expected_revision: Option<u64>,
|
||||
pub binding_id: String,
|
||||
pub reason: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct EpiphanyJobInterruptResult {
|
||||
pub epiphany_state: EpiphanyThreadState,
|
||||
pub binding_id: String,
|
||||
pub cancel_requested: bool,
|
||||
pub interrupted_thread_ids: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct EpiphanyRuntimeJobSnapshot {
|
||||
pub job: EpiphanyRuntimeJob,
|
||||
|
|
@ -728,6 +767,31 @@ pub fn plan_runtime_spine_heartbeat_launch(
|
|||
})
|
||||
}
|
||||
|
||||
pub fn replace_or_append_epiphany_job_binding(
|
||||
mut bindings: Vec<EpiphanyJobBinding>,
|
||||
replacement: EpiphanyJobBinding,
|
||||
) -> Vec<EpiphanyJobBinding> {
|
||||
if let Some(existing) = bindings
|
||||
.iter_mut()
|
||||
.find(|binding| binding.id == replacement.id)
|
||||
{
|
||||
*existing = replacement;
|
||||
return bindings;
|
||||
}
|
||||
bindings.push(replacement);
|
||||
bindings
|
||||
}
|
||||
|
||||
pub fn clear_epiphany_job_binding_backend(
|
||||
mut bindings: Vec<EpiphanyJobBinding>,
|
||||
binding_index: usize,
|
||||
blocking_reason: &str,
|
||||
) -> Vec<EpiphanyJobBinding> {
|
||||
let binding = &mut bindings[binding_index];
|
||||
binding.blocking_reason = Some(blocking_reason.to_string());
|
||||
bindings
|
||||
}
|
||||
|
||||
pub fn open_runtime_spine_heartbeat_job(
|
||||
store_path: impl AsRef<Path>,
|
||||
options: RuntimeSpineHeartbeatJobOptions,
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ remembers doctrine; the branch remembers the blade.
|
|||
- Agent self-memory review/application now has typed `AgentSelfPatch` core APIs. JSON-value selfPatch functions are compatibility wrappers for CLI/artifact ingress; native callers should parse once at the edge and then call `review_agent_self_patch_document` / `apply_agent_self_patch_document`.
|
||||
- `epiphany-openai-codex-spine` no longer uses Codex's Responses client, model-provider layer, `codex-api`, `codex-model-provider`, `codex-model-provider-info`, or `codex-protocol` for outbound model requests. It reaches `codex-login` only through `epiphany-openai-auth-spine` so credential loading/refresh stays Codex-compatible while request/status/event/runtime surfaces stay typed Epiphany documents.
|
||||
- Durable Epiphany state types now live in root crate `epiphany-state-model`. `codex-protocol` re-exports them only so old rollout/API callers keep compiling; do not add new durable `Epiphany*` state structs under `vendor/codex`. `epiphany-core` imports the native model directly and no longer depends on `codex-protocol`. Pressure derives from native `EpiphanyTokenUsageSnapshot`; Codex token telemetry is mapped at the bridge. Codex rollout/event reconstruction now lives in `codex-core::epiphany_rollout`, where the Codex `RolloutItem` / `EventMsg` types belong. Exact retrieval path matching is native to `epiphany-core`, so `epiphany-core` has no direct vendored Codex crate dependency.
|
||||
- State-update contract proof now lives in native `epiphany-core`. The old giant `codex_thread.rs` Epiphany state-update test fixture was cut; vendored `CodexThread` may call the native mutation law for compatibility, but it must not regain ownership of state-update semantics or heartbeat launch-plan policy.
|
||||
- State-update contract proof and job launch/interrupt DTO ownership now live in native `epiphany-core`. The old giant `codex_thread.rs` Epiphany state-update test fixture was cut, and `epiphany-codex-bridge` no longer imports Epiphany job launch request types from `codex_core`; vendored `CodexThread` may call the native mutation/launch law for compatibility, but it must not regain ownership of state-update semantics, heartbeat launch-plan policy, or Epiphany DTOs.
|
||||
- The May 2026 foundation migration in `notes/epiphany-ideal-architecture-rebuild-plan.md` is complete enough to defend. Read `notes/epiphany-architectural-teardown.md` before touching Epiphany control-plane code, but do not treat it as an open-ended excuse to keep shaving the altar. The rebuild moved scene projection, freshness derivation, pressure policy, targeted context shards, bounded graph traversal, 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/reorient result interpretation, role self-persistence review policy, and role/reorient acceptance bundle policy 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.
|
||||
|
|
|
|||
Binary file not shown.
File diff suppressed because one or more lines are too long
|
|
@ -1,6 +1,5 @@
|
|||
use codex_app_server_protocol::*;
|
||||
use codex_core::CodexThread;
|
||||
use codex_core::EpiphanyJobLaunchRequest;
|
||||
use codex_protocol::ThreadId;
|
||||
use codex_protocol::error::CodexErr;
|
||||
use codex_protocol::protocol::EpiphanyThreadState;
|
||||
|
|
@ -19,6 +18,7 @@ use epiphany_codex_bridge::mutation_service::launch_thread_epiphany_job;
|
|||
use epiphany_codex_bridge::mutation_service::launch_thread_epiphany_reorient;
|
||||
use epiphany_codex_bridge::mutation_service::launch_thread_epiphany_role;
|
||||
use epiphany_codex_bridge::retrieve::index_thread_epiphany_retrieval;
|
||||
use epiphany_core::EpiphanyJobLaunchRequest;
|
||||
use std::sync::Arc;
|
||||
|
||||
use super::CodexMessageProcessor;
|
||||
|
|
|
|||
73
vendor/codex/codex-rs/core/src/codex_thread.rs
vendored
73
vendor/codex/codex-rs/core/src/codex_thread.rs
vendored
|
|
@ -20,8 +20,6 @@ use codex_protocol::models::ResponseInputItem;
|
|||
use codex_protocol::models::ResponseItem;
|
||||
use codex_protocol::openai_models::ReasoningEffort;
|
||||
use codex_protocol::protocol::AskForApproval;
|
||||
use codex_protocol::protocol::EpiphanyJobBinding;
|
||||
use codex_protocol::protocol::EpiphanyJobKind;
|
||||
use codex_protocol::protocol::EpiphanyRetrievalState;
|
||||
use codex_protocol::protocol::EpiphanyStateItem;
|
||||
use codex_protocol::protocol::EpiphanyThreadState;
|
||||
|
|
@ -37,16 +35,21 @@ use codex_protocol::protocol::TokenUsageInfo;
|
|||
use codex_protocol::protocol::W3cTraceContext;
|
||||
use codex_protocol::user_input::UserInput;
|
||||
use codex_utils_absolute_path::AbsolutePathBuf;
|
||||
use epiphany_core::EpiphanyJobInterruptRequest;
|
||||
use epiphany_core::EpiphanyJobInterruptResult;
|
||||
use epiphany_core::EpiphanyJobLaunchRequest;
|
||||
use epiphany_core::EpiphanyJobLaunchResult;
|
||||
use epiphany_core::EpiphanyRetrieveQuery;
|
||||
use epiphany_core::EpiphanyRetrieveResponse;
|
||||
use epiphany_core::EpiphanyStateUpdate;
|
||||
use epiphany_core::EpiphanyWorkerLaunchDocument;
|
||||
use epiphany_core::RuntimeSpineHeartbeatJobOptions;
|
||||
use epiphany_core::RuntimeSpineHeartbeatLaunchPlanOptions;
|
||||
use epiphany_core::apply_epiphany_state_update;
|
||||
use epiphany_core::clear_epiphany_job_binding_backend;
|
||||
use epiphany_core::epiphany_state_update_validation_errors;
|
||||
use epiphany_core::open_runtime_spine_heartbeat_job;
|
||||
use epiphany_core::plan_runtime_spine_heartbeat_launch;
|
||||
use epiphany_core::replace_or_append_epiphany_job_binding;
|
||||
use rmcp::model::ReadResourceRequestParams;
|
||||
use std::collections::HashMap;
|
||||
use std::path::PathBuf;
|
||||
|
|
@ -96,45 +99,6 @@ pub struct CodexThread {
|
|||
_watch_registration: WatchRegistration,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct EpiphanyJobLaunchRequest {
|
||||
pub expected_revision: Option<u64>,
|
||||
pub binding_id: String,
|
||||
pub kind: EpiphanyJobKind,
|
||||
pub scope: String,
|
||||
pub owner_role: String,
|
||||
pub authority_scope: String,
|
||||
pub linked_subgoal_ids: Vec<String>,
|
||||
pub linked_graph_node_ids: Vec<String>,
|
||||
pub instruction: String,
|
||||
pub launch_document: EpiphanyWorkerLaunchDocument,
|
||||
pub output_contract_id: String,
|
||||
pub max_runtime_seconds: Option<u64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct EpiphanyJobLaunchResult {
|
||||
pub epiphany_state: EpiphanyThreadState,
|
||||
pub binding_id: String,
|
||||
pub launcher_job_id: String,
|
||||
pub backend_job_id: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct EpiphanyJobInterruptRequest {
|
||||
pub expected_revision: Option<u64>,
|
||||
pub binding_id: String,
|
||||
pub reason: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct EpiphanyJobInterruptResult {
|
||||
pub epiphany_state: EpiphanyThreadState,
|
||||
pub binding_id: String,
|
||||
pub cancel_requested: bool,
|
||||
pub interrupted_thread_ids: Vec<String>,
|
||||
}
|
||||
|
||||
/// Conduit for the bidirectional stream of messages that compose a thread
|
||||
/// (formerly called a conversation) in Codex.
|
||||
impl CodexThread {
|
||||
|
|
@ -743,31 +707,6 @@ fn open_epiphany_runtime_spine_job(
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn replace_or_append_epiphany_job_binding(
|
||||
mut bindings: Vec<EpiphanyJobBinding>,
|
||||
replacement: EpiphanyJobBinding,
|
||||
) -> Vec<EpiphanyJobBinding> {
|
||||
if let Some(existing) = bindings
|
||||
.iter_mut()
|
||||
.find(|binding| binding.id == replacement.id)
|
||||
{
|
||||
*existing = replacement;
|
||||
return bindings;
|
||||
}
|
||||
bindings.push(replacement);
|
||||
bindings
|
||||
}
|
||||
|
||||
fn clear_epiphany_job_binding_backend(
|
||||
mut bindings: Vec<EpiphanyJobBinding>,
|
||||
binding_index: usize,
|
||||
blocking_reason: &str,
|
||||
) -> Vec<EpiphanyJobBinding> {
|
||||
let binding = &mut bindings[binding_index];
|
||||
binding.blocking_reason = Some(blocking_reason.to_string());
|
||||
bindings
|
||||
}
|
||||
|
||||
fn pending_message_input_item(message: &ResponseItem) -> CodexResult<ResponseInputItem> {
|
||||
match message {
|
||||
ResponseItem::Message { role, content, .. } => Ok(ResponseInputItem::Message {
|
||||
|
|
|
|||
2
vendor/codex/codex-rs/core/src/lib.rs
vendored
2
vendor/codex/codex-rs/core/src/lib.rs
vendored
|
|
@ -18,8 +18,6 @@ mod codex_thread;
|
|||
mod compact_remote;
|
||||
pub use codex_thread::CodexThread;
|
||||
pub use codex_thread::CodexThreadTurnContextOverrides;
|
||||
pub use codex_thread::EpiphanyJobInterruptRequest;
|
||||
pub use codex_thread::EpiphanyJobLaunchRequest;
|
||||
pub use codex_thread::ThreadConfigSnapshot;
|
||||
mod epiphany_rollout;
|
||||
pub use epiphany_rollout::latest_epiphany_state_from_codex_rollout_items as latest_epiphany_state_from_rollout_items;
|
||||
|
|
|
|||
Reference in a new issue