Expose typed runtime result snapshots
This commit is contained in:
parent
9408190fc4
commit
21e0af2de6
5 changed files with 328 additions and 92 deletions
|
|
@ -6,6 +6,8 @@ use codex_app_server_protocol::ThreadEpiphanyRoleResultStatus;
|
|||
use codex_app_server_protocol::ThreadEpiphanyRoleSelfPersistenceReview;
|
||||
use codex_app_server_protocol::ThreadEpiphanyRoleSelfPersistenceStatus;
|
||||
use codex_app_server_protocol::ThreadEpiphanyUpdatePatch;
|
||||
use epiphany_core::EpiphanyCoordinatorRoleResultStatus as CoreEpiphanyCoordinatorRoleResultStatus;
|
||||
use epiphany_core::EpiphanyCrrcResultStatus as CoreEpiphanyCrrcResultStatus;
|
||||
use epiphany_core::EpiphanyReorientFindingInterpretation;
|
||||
use epiphany_core::EpiphanyRoleFindingInterpretation;
|
||||
use epiphany_core::EpiphanyRoleResultRoleId;
|
||||
|
|
@ -184,6 +186,95 @@ pub fn render_epiphany_role_result_note(
|
|||
}
|
||||
}
|
||||
|
||||
pub fn render_core_role_result_note(
|
||||
role_id: EpiphanyRoleResultRoleId,
|
||||
status: CoreEpiphanyCoordinatorRoleResultStatus,
|
||||
finding: Option<&EpiphanyRoleFindingInterpretation>,
|
||||
item_error: Option<&str>,
|
||||
) -> String {
|
||||
match status {
|
||||
CoreEpiphanyCoordinatorRoleResultStatus::Completed => {
|
||||
if let Some(finding) = finding {
|
||||
let next = finding.next_safe_move.as_deref().unwrap_or("not supplied");
|
||||
let self_note =
|
||||
render_core_self_persistence_note(finding.self_persistence.as_ref())
|
||||
.map(|note| format!(" {note}"))
|
||||
.unwrap_or_default();
|
||||
if let Some(item_error) = finding.item_error.as_deref().or(item_error) {
|
||||
format!(
|
||||
"{:?} role specialist completed, but the finding needs repair: {item_error}. Next safe move: {next}.{self_note}",
|
||||
role_id
|
||||
)
|
||||
} else {
|
||||
format!(
|
||||
"{:?} role specialist completed. Next safe move: {next}.{self_note}",
|
||||
role_id
|
||||
)
|
||||
}
|
||||
} else {
|
||||
format!(
|
||||
"{:?} role specialist completed, but no structured result was recorded.",
|
||||
role_id
|
||||
)
|
||||
}
|
||||
}
|
||||
CoreEpiphanyCoordinatorRoleResultStatus::Failed => item_error
|
||||
.map(|error| format!("{:?} role specialist failed: {error}", role_id))
|
||||
.unwrap_or_else(|| format!("{:?} role specialist failed.", role_id)),
|
||||
CoreEpiphanyCoordinatorRoleResultStatus::Cancelled => {
|
||||
format!(
|
||||
"{:?} role specialist was cancelled before producing a result.",
|
||||
role_id
|
||||
)
|
||||
}
|
||||
CoreEpiphanyCoordinatorRoleResultStatus::Running => {
|
||||
format!("{:?} role specialist is still running.", role_id)
|
||||
}
|
||||
CoreEpiphanyCoordinatorRoleResultStatus::Pending => {
|
||||
format!(
|
||||
"{:?} role specialist has not produced a result yet.",
|
||||
role_id
|
||||
)
|
||||
}
|
||||
CoreEpiphanyCoordinatorRoleResultStatus::MissingState => {
|
||||
"No authoritative Epiphany state exists for this thread.".to_string()
|
||||
}
|
||||
CoreEpiphanyCoordinatorRoleResultStatus::MissingBinding => {
|
||||
"No matching Epiphany role specialist binding exists.".to_string()
|
||||
}
|
||||
CoreEpiphanyCoordinatorRoleResultStatus::BackendUnavailable => {
|
||||
"The bound runtime backend is unavailable.".to_string()
|
||||
}
|
||||
CoreEpiphanyCoordinatorRoleResultStatus::BackendMissing => {
|
||||
"The bound runtime backend job or item is missing.".to_string()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn render_core_self_persistence_note(
|
||||
review: Option<&CoreEpiphanyRoleSelfPersistenceReview>,
|
||||
) -> Option<String> {
|
||||
let review = review?;
|
||||
match review.status {
|
||||
CoreEpiphanyRoleSelfPersistenceStatus::Missing => None,
|
||||
CoreEpiphanyRoleSelfPersistenceStatus::Accepted => Some(format!(
|
||||
"Self persistence request is acceptable for {}.",
|
||||
review
|
||||
.target_agent_id
|
||||
.as_deref()
|
||||
.unwrap_or("the role memory file")
|
||||
)),
|
||||
CoreEpiphanyRoleSelfPersistenceStatus::Rejected => {
|
||||
let reasons = if review.reasons.is_empty() {
|
||||
"no reason recorded".to_string()
|
||||
} else {
|
||||
review.reasons.join("; ")
|
||||
};
|
||||
Some(format!("Self persistence request was refused: {reasons}."))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn render_epiphany_self_persistence_note(
|
||||
review: Option<&ThreadEpiphanyRoleSelfPersistenceReview>,
|
||||
) -> Option<String> {
|
||||
|
|
@ -248,3 +339,44 @@ pub fn render_epiphany_reorient_result_note(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn render_core_reorient_result_note(
|
||||
status: CoreEpiphanyCrrcResultStatus,
|
||||
finding: Option<&EpiphanyReorientFindingInterpretation>,
|
||||
item_error: Option<&str>,
|
||||
) -> String {
|
||||
match status {
|
||||
CoreEpiphanyCrrcResultStatus::Completed => {
|
||||
if let Some(finding) = finding {
|
||||
let next = finding.next_safe_move.as_deref().unwrap_or("not supplied");
|
||||
format!("Reorientation worker completed. Next safe move: {next}")
|
||||
} else {
|
||||
"Reorientation worker completed, but no structured result was recorded.".to_string()
|
||||
}
|
||||
}
|
||||
CoreEpiphanyCrrcResultStatus::Failed => item_error
|
||||
.map(|error| format!("Reorientation worker failed: {error}"))
|
||||
.unwrap_or_else(|| "Reorientation worker failed.".to_string()),
|
||||
CoreEpiphanyCrrcResultStatus::Cancelled => {
|
||||
"Reorientation worker was cancelled before producing a result.".to_string()
|
||||
}
|
||||
CoreEpiphanyCrrcResultStatus::Running => {
|
||||
"Reorientation worker is still running.".to_string()
|
||||
}
|
||||
CoreEpiphanyCrrcResultStatus::Pending => {
|
||||
"Reorientation worker has not produced a result yet.".to_string()
|
||||
}
|
||||
CoreEpiphanyCrrcResultStatus::MissingState => {
|
||||
"No authoritative Epiphany state exists for this thread.".to_string()
|
||||
}
|
||||
CoreEpiphanyCrrcResultStatus::MissingBinding => {
|
||||
"No matching Epiphany reorientation worker binding exists.".to_string()
|
||||
}
|
||||
CoreEpiphanyCrrcResultStatus::BackendUnavailable => {
|
||||
"The bound runtime backend is unavailable.".to_string()
|
||||
}
|
||||
CoreEpiphanyCrrcResultStatus::BackendMissing => {
|
||||
"The bound runtime backend job or item is missing.".to_string()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,10 @@ use codex_app_server_protocol::ThreadEpiphanyReorientResultStatus;
|
|||
use codex_app_server_protocol::ThreadEpiphanyRoleFinding;
|
||||
use codex_app_server_protocol::ThreadEpiphanyRoleId;
|
||||
use codex_app_server_protocol::ThreadEpiphanyRoleResultStatus;
|
||||
use epiphany_core::EpiphanyCoordinatorRoleResultStatus as CoreEpiphanyCoordinatorRoleResultStatus;
|
||||
use epiphany_core::EpiphanyCrrcResultStatus as CoreEpiphanyCrrcResultStatus;
|
||||
use epiphany_core::EpiphanyReorientFindingInterpretation;
|
||||
use epiphany_core::EpiphanyRoleFindingInterpretation;
|
||||
use epiphany_core::EpiphanyRuntimeJobSnapshot;
|
||||
use epiphany_core::EpiphanyRuntimeJobStatus;
|
||||
use epiphany_core::interpret_runtime_reorient_worker_result;
|
||||
|
|
@ -20,8 +24,8 @@ use crate::error::Result as BridgeResult;
|
|||
use crate::results::map_core_role_result_role_id;
|
||||
use crate::results::map_protocol_reorient_finding;
|
||||
use crate::results::map_protocol_role_finding;
|
||||
use crate::results::render_epiphany_reorient_result_note;
|
||||
use crate::results::render_epiphany_role_result_note;
|
||||
use crate::results::render_core_reorient_result_note;
|
||||
use crate::results::render_core_role_result_note;
|
||||
|
||||
pub fn role_finding_runtime_result_id(finding: &ThreadEpiphanyRoleFinding) -> Option<String> {
|
||||
finding.runtime_result_id.clone()
|
||||
|
|
@ -41,6 +45,93 @@ pub fn reorient_finding_runtime_job_id(finding: &ThreadEpiphanyReorientFinding)
|
|||
finding.runtime_job_id.clone()
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct EpiphanyRoleResultSnapshot {
|
||||
pub status: CoreEpiphanyCoordinatorRoleResultStatus,
|
||||
pub finding: Option<EpiphanyRoleFindingInterpretation>,
|
||||
pub note: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct EpiphanyReorientResultSnapshot {
|
||||
pub status: CoreEpiphanyCrrcResultStatus,
|
||||
pub finding: Option<EpiphanyReorientFindingInterpretation>,
|
||||
pub note: String,
|
||||
}
|
||||
|
||||
pub fn load_core_epiphany_role_result_from_runtime_spine_job(
|
||||
job_id: &str,
|
||||
runtime_store_path: Option<&Path>,
|
||||
role_id: ThreadEpiphanyRoleId,
|
||||
) -> EpiphanyRoleResultSnapshot {
|
||||
let core_role_id = map_core_role_result_role_id(role_id);
|
||||
let Some(runtime_store_path) = runtime_store_path else {
|
||||
return EpiphanyRoleResultSnapshot {
|
||||
status: CoreEpiphanyCoordinatorRoleResultStatus::Pending,
|
||||
finding: None,
|
||||
note: "Heartbeat activation owns this role specialist; no loaded runtime-spine store is available yet."
|
||||
.to_string(),
|
||||
};
|
||||
};
|
||||
let snapshot = match runtime_job_snapshot(runtime_store_path, job_id) {
|
||||
Ok(Some(snapshot)) => snapshot,
|
||||
Ok(None) => {
|
||||
return EpiphanyRoleResultSnapshot {
|
||||
status: CoreEpiphanyCoordinatorRoleResultStatus::Pending,
|
||||
finding: None,
|
||||
note: format!(
|
||||
"Heartbeat runtime job {:?} has not reported typed state yet.",
|
||||
job_id
|
||||
),
|
||||
};
|
||||
}
|
||||
Err(err) => {
|
||||
return EpiphanyRoleResultSnapshot {
|
||||
status: CoreEpiphanyCoordinatorRoleResultStatus::BackendUnavailable,
|
||||
finding: None,
|
||||
note: format!(
|
||||
"Failed to read heartbeat runtime-spine job {:?}: {err}",
|
||||
job_id
|
||||
),
|
||||
};
|
||||
}
|
||||
};
|
||||
let status = map_runtime_role_result_status(&snapshot);
|
||||
let finding = if status == CoreEpiphanyCoordinatorRoleResultStatus::Completed {
|
||||
match runtime_role_worker_result(runtime_store_path, job_id) {
|
||||
Ok(Some(result)) => Some(interpret_runtime_role_worker_result(core_role_id, &result)),
|
||||
Ok(None) => {
|
||||
return EpiphanyRoleResultSnapshot {
|
||||
status: CoreEpiphanyCoordinatorRoleResultStatus::BackendUnavailable,
|
||||
finding: None,
|
||||
note: format!(
|
||||
"Heartbeat runtime job {:?} completed without an EpiphanyRuntimeRoleWorkerResult typed document; generic lifecycle receipts are not reviewable findings.",
|
||||
job_id
|
||||
),
|
||||
};
|
||||
}
|
||||
Err(err) => {
|
||||
return EpiphanyRoleResultSnapshot {
|
||||
status: CoreEpiphanyCoordinatorRoleResultStatus::BackendUnavailable,
|
||||
finding: None,
|
||||
note: format!(
|
||||
"Failed to read typed role worker result for heartbeat runtime job {:?}: {err}",
|
||||
job_id
|
||||
),
|
||||
};
|
||||
}
|
||||
}
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let note = render_core_role_result_note(core_role_id, status, finding.as_ref(), None);
|
||||
EpiphanyRoleResultSnapshot {
|
||||
status,
|
||||
finding,
|
||||
note,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn load_epiphany_role_result_from_runtime_spine_job(
|
||||
job_id: &str,
|
||||
runtime_store_path: Option<&Path>,
|
||||
|
|
@ -50,73 +141,86 @@ pub fn load_epiphany_role_result_from_runtime_spine_job(
|
|||
Option<ThreadEpiphanyRoleFinding>,
|
||||
String,
|
||||
) {
|
||||
let snapshot =
|
||||
load_core_epiphany_role_result_from_runtime_spine_job(job_id, runtime_store_path, role_id);
|
||||
(
|
||||
map_protocol_role_result_status(snapshot.status),
|
||||
snapshot
|
||||
.finding
|
||||
.map(|finding| map_protocol_role_finding(role_id, finding)),
|
||||
snapshot.note,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn load_core_epiphany_reorient_result_from_runtime_spine_job(
|
||||
job_id: &str,
|
||||
runtime_store_path: Option<&Path>,
|
||||
) -> EpiphanyReorientResultSnapshot {
|
||||
let Some(runtime_store_path) = runtime_store_path else {
|
||||
return (
|
||||
ThreadEpiphanyRoleResultStatus::Pending,
|
||||
None,
|
||||
"Heartbeat activation owns this role specialist; no loaded runtime-spine store is available yet."
|
||||
return EpiphanyReorientResultSnapshot {
|
||||
status: CoreEpiphanyCrrcResultStatus::Pending,
|
||||
finding: None,
|
||||
note: "Heartbeat activation owns this reorientation worker; no loaded runtime-spine store is available yet."
|
||||
.to_string(),
|
||||
);
|
||||
};
|
||||
};
|
||||
let snapshot = match runtime_job_snapshot(runtime_store_path, job_id) {
|
||||
Ok(Some(snapshot)) => snapshot,
|
||||
Ok(None) => {
|
||||
return (
|
||||
ThreadEpiphanyRoleResultStatus::Pending,
|
||||
None,
|
||||
format!(
|
||||
return EpiphanyReorientResultSnapshot {
|
||||
status: CoreEpiphanyCrrcResultStatus::Pending,
|
||||
finding: None,
|
||||
note: format!(
|
||||
"Heartbeat runtime job {:?} has not reported typed state yet.",
|
||||
job_id
|
||||
),
|
||||
);
|
||||
};
|
||||
}
|
||||
Err(err) => {
|
||||
return (
|
||||
ThreadEpiphanyRoleResultStatus::BackendUnavailable,
|
||||
None,
|
||||
format!(
|
||||
return EpiphanyReorientResultSnapshot {
|
||||
status: CoreEpiphanyCrrcResultStatus::BackendUnavailable,
|
||||
finding: None,
|
||||
note: format!(
|
||||
"Failed to read heartbeat runtime-spine job {:?}: {err}",
|
||||
job_id
|
||||
),
|
||||
);
|
||||
};
|
||||
}
|
||||
};
|
||||
let status = map_runtime_role_result_status(&snapshot);
|
||||
let finding = if status == ThreadEpiphanyRoleResultStatus::Completed {
|
||||
match runtime_role_worker_result(runtime_store_path, job_id) {
|
||||
Ok(Some(result)) => Some(map_protocol_role_finding(
|
||||
role_id,
|
||||
interpret_runtime_role_worker_result(
|
||||
map_core_role_result_role_id(role_id),
|
||||
&result,
|
||||
),
|
||||
)),
|
||||
let status = map_runtime_reorient_result_status(&snapshot);
|
||||
let finding = if status == CoreEpiphanyCrrcResultStatus::Completed {
|
||||
match runtime_reorient_worker_result(runtime_store_path, job_id) {
|
||||
Ok(Some(result)) => Some(interpret_runtime_reorient_worker_result(&result)),
|
||||
Ok(None) => {
|
||||
return (
|
||||
ThreadEpiphanyRoleResultStatus::BackendUnavailable,
|
||||
None,
|
||||
format!(
|
||||
"Heartbeat runtime job {:?} completed without an EpiphanyRuntimeRoleWorkerResult typed document; generic lifecycle receipts are not reviewable findings.",
|
||||
return EpiphanyReorientResultSnapshot {
|
||||
status: CoreEpiphanyCrrcResultStatus::BackendUnavailable,
|
||||
finding: None,
|
||||
note: format!(
|
||||
"Heartbeat runtime job {:?} completed without an EpiphanyRuntimeReorientWorkerResult typed document; generic lifecycle receipts are not reviewable findings.",
|
||||
job_id
|
||||
),
|
||||
);
|
||||
};
|
||||
}
|
||||
Err(err) => {
|
||||
return (
|
||||
ThreadEpiphanyRoleResultStatus::BackendUnavailable,
|
||||
None,
|
||||
format!(
|
||||
"Failed to read typed role worker result for heartbeat runtime job {:?}: {err}",
|
||||
return EpiphanyReorientResultSnapshot {
|
||||
status: CoreEpiphanyCrrcResultStatus::BackendUnavailable,
|
||||
finding: None,
|
||||
note: format!(
|
||||
"Failed to read typed reorientation worker result for heartbeat runtime job {:?}: {err}",
|
||||
job_id
|
||||
),
|
||||
);
|
||||
};
|
||||
}
|
||||
}
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let note = render_epiphany_role_result_note(role_id, status, finding.as_ref(), None);
|
||||
(status, finding, note)
|
||||
let note = render_core_reorient_result_note(status, finding.as_ref(), None);
|
||||
EpiphanyReorientResultSnapshot {
|
||||
status,
|
||||
finding,
|
||||
note,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn load_epiphany_reorient_result_from_runtime_spine_job(
|
||||
|
|
@ -127,108 +231,104 @@ pub fn load_epiphany_reorient_result_from_runtime_spine_job(
|
|||
Option<ThreadEpiphanyReorientFinding>,
|
||||
String,
|
||||
) {
|
||||
let Some(runtime_store_path) = runtime_store_path else {
|
||||
return (
|
||||
ThreadEpiphanyReorientResultStatus::Pending,
|
||||
None,
|
||||
"Heartbeat activation owns this reorientation worker; no loaded runtime-spine store is available yet."
|
||||
.to_string(),
|
||||
);
|
||||
};
|
||||
let snapshot = match runtime_job_snapshot(runtime_store_path, job_id) {
|
||||
Ok(Some(snapshot)) => snapshot,
|
||||
Ok(None) => {
|
||||
return (
|
||||
ThreadEpiphanyReorientResultStatus::Pending,
|
||||
None,
|
||||
format!(
|
||||
"Heartbeat runtime job {:?} has not reported typed state yet.",
|
||||
job_id
|
||||
),
|
||||
);
|
||||
}
|
||||
Err(err) => {
|
||||
return (
|
||||
ThreadEpiphanyReorientResultStatus::BackendUnavailable,
|
||||
None,
|
||||
format!(
|
||||
"Failed to read heartbeat runtime-spine job {:?}: {err}",
|
||||
job_id
|
||||
),
|
||||
);
|
||||
}
|
||||
};
|
||||
let status = map_runtime_reorient_result_status(&snapshot);
|
||||
let finding = if status == ThreadEpiphanyReorientResultStatus::Completed {
|
||||
match runtime_reorient_worker_result(runtime_store_path, job_id) {
|
||||
Ok(Some(result)) => Some(map_protocol_reorient_finding(
|
||||
interpret_runtime_reorient_worker_result(&result),
|
||||
)),
|
||||
Ok(None) => {
|
||||
return (
|
||||
ThreadEpiphanyReorientResultStatus::BackendUnavailable,
|
||||
None,
|
||||
format!(
|
||||
"Heartbeat runtime job {:?} completed without an EpiphanyRuntimeReorientWorkerResult typed document; generic lifecycle receipts are not reviewable findings.",
|
||||
job_id
|
||||
),
|
||||
);
|
||||
}
|
||||
Err(err) => {
|
||||
return (
|
||||
ThreadEpiphanyReorientResultStatus::BackendUnavailable,
|
||||
None,
|
||||
format!(
|
||||
"Failed to read typed reorientation worker result for heartbeat runtime job {:?}: {err}",
|
||||
job_id
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let note = render_epiphany_reorient_result_note(status, finding.as_ref(), None);
|
||||
(status, finding, note)
|
||||
let snapshot =
|
||||
load_core_epiphany_reorient_result_from_runtime_spine_job(job_id, runtime_store_path);
|
||||
(
|
||||
map_protocol_reorient_result_status(snapshot.status),
|
||||
snapshot.finding.map(map_protocol_reorient_finding),
|
||||
snapshot.note,
|
||||
)
|
||||
}
|
||||
|
||||
fn map_runtime_role_result_status(
|
||||
snapshot: &EpiphanyRuntimeJobSnapshot,
|
||||
) -> ThreadEpiphanyRoleResultStatus {
|
||||
) -> CoreEpiphanyCoordinatorRoleResultStatus {
|
||||
match snapshot.job.status {
|
||||
EpiphanyRuntimeJobStatus::Queued => ThreadEpiphanyRoleResultStatus::Pending,
|
||||
EpiphanyRuntimeJobStatus::Queued => CoreEpiphanyCoordinatorRoleResultStatus::Pending,
|
||||
EpiphanyRuntimeJobStatus::Running | EpiphanyRuntimeJobStatus::WaitingForReview => {
|
||||
ThreadEpiphanyRoleResultStatus::Running
|
||||
CoreEpiphanyCoordinatorRoleResultStatus::Running
|
||||
}
|
||||
EpiphanyRuntimeJobStatus::Completed => {
|
||||
if snapshot.result.is_some() {
|
||||
ThreadEpiphanyRoleResultStatus::Completed
|
||||
CoreEpiphanyCoordinatorRoleResultStatus::Completed
|
||||
} else {
|
||||
ThreadEpiphanyRoleResultStatus::Pending
|
||||
CoreEpiphanyCoordinatorRoleResultStatus::Pending
|
||||
}
|
||||
}
|
||||
EpiphanyRuntimeJobStatus::Failed => ThreadEpiphanyRoleResultStatus::Failed,
|
||||
EpiphanyRuntimeJobStatus::Cancelled => ThreadEpiphanyRoleResultStatus::Cancelled,
|
||||
EpiphanyRuntimeJobStatus::Failed => CoreEpiphanyCoordinatorRoleResultStatus::Failed,
|
||||
EpiphanyRuntimeJobStatus::Cancelled => CoreEpiphanyCoordinatorRoleResultStatus::Cancelled,
|
||||
}
|
||||
}
|
||||
|
||||
fn map_runtime_reorient_result_status(
|
||||
snapshot: &EpiphanyRuntimeJobSnapshot,
|
||||
) -> ThreadEpiphanyReorientResultStatus {
|
||||
) -> CoreEpiphanyCrrcResultStatus {
|
||||
match snapshot.job.status {
|
||||
EpiphanyRuntimeJobStatus::Queued => ThreadEpiphanyReorientResultStatus::Pending,
|
||||
EpiphanyRuntimeJobStatus::Queued => CoreEpiphanyCrrcResultStatus::Pending,
|
||||
EpiphanyRuntimeJobStatus::Running | EpiphanyRuntimeJobStatus::WaitingForReview => {
|
||||
ThreadEpiphanyReorientResultStatus::Running
|
||||
CoreEpiphanyCrrcResultStatus::Running
|
||||
}
|
||||
EpiphanyRuntimeJobStatus::Completed => {
|
||||
if snapshot.result.is_some() {
|
||||
ThreadEpiphanyReorientResultStatus::Completed
|
||||
CoreEpiphanyCrrcResultStatus::Completed
|
||||
} else {
|
||||
ThreadEpiphanyReorientResultStatus::Pending
|
||||
CoreEpiphanyCrrcResultStatus::Pending
|
||||
}
|
||||
}
|
||||
EpiphanyRuntimeJobStatus::Failed => ThreadEpiphanyReorientResultStatus::Failed,
|
||||
EpiphanyRuntimeJobStatus::Cancelled => ThreadEpiphanyReorientResultStatus::Cancelled,
|
||||
EpiphanyRuntimeJobStatus::Failed => CoreEpiphanyCrrcResultStatus::Failed,
|
||||
EpiphanyRuntimeJobStatus::Cancelled => CoreEpiphanyCrrcResultStatus::Cancelled,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn map_protocol_role_result_status(
|
||||
status: CoreEpiphanyCoordinatorRoleResultStatus,
|
||||
) -> ThreadEpiphanyRoleResultStatus {
|
||||
match status {
|
||||
CoreEpiphanyCoordinatorRoleResultStatus::MissingState => {
|
||||
ThreadEpiphanyRoleResultStatus::MissingState
|
||||
}
|
||||
CoreEpiphanyCoordinatorRoleResultStatus::MissingBinding => {
|
||||
ThreadEpiphanyRoleResultStatus::MissingBinding
|
||||
}
|
||||
CoreEpiphanyCoordinatorRoleResultStatus::BackendUnavailable => {
|
||||
ThreadEpiphanyRoleResultStatus::BackendUnavailable
|
||||
}
|
||||
CoreEpiphanyCoordinatorRoleResultStatus::BackendMissing => {
|
||||
ThreadEpiphanyRoleResultStatus::BackendMissing
|
||||
}
|
||||
CoreEpiphanyCoordinatorRoleResultStatus::Pending => ThreadEpiphanyRoleResultStatus::Pending,
|
||||
CoreEpiphanyCoordinatorRoleResultStatus::Running => ThreadEpiphanyRoleResultStatus::Running,
|
||||
CoreEpiphanyCoordinatorRoleResultStatus::Completed => {
|
||||
ThreadEpiphanyRoleResultStatus::Completed
|
||||
}
|
||||
CoreEpiphanyCoordinatorRoleResultStatus::Failed => ThreadEpiphanyRoleResultStatus::Failed,
|
||||
CoreEpiphanyCoordinatorRoleResultStatus::Cancelled => {
|
||||
ThreadEpiphanyRoleResultStatus::Cancelled
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn map_protocol_reorient_result_status(
|
||||
status: CoreEpiphanyCrrcResultStatus,
|
||||
) -> ThreadEpiphanyReorientResultStatus {
|
||||
match status {
|
||||
CoreEpiphanyCrrcResultStatus::MissingState => {
|
||||
ThreadEpiphanyReorientResultStatus::MissingState
|
||||
}
|
||||
CoreEpiphanyCrrcResultStatus::MissingBinding => {
|
||||
ThreadEpiphanyReorientResultStatus::MissingBinding
|
||||
}
|
||||
CoreEpiphanyCrrcResultStatus::BackendUnavailable => {
|
||||
ThreadEpiphanyReorientResultStatus::BackendUnavailable
|
||||
}
|
||||
CoreEpiphanyCrrcResultStatus::BackendMissing => {
|
||||
ThreadEpiphanyReorientResultStatus::BackendMissing
|
||||
}
|
||||
CoreEpiphanyCrrcResultStatus::Pending => ThreadEpiphanyReorientResultStatus::Pending,
|
||||
CoreEpiphanyCrrcResultStatus::Running => ThreadEpiphanyReorientResultStatus::Running,
|
||||
CoreEpiphanyCrrcResultStatus::Completed => ThreadEpiphanyReorientResultStatus::Completed,
|
||||
CoreEpiphanyCrrcResultStatus::Failed => ThreadEpiphanyReorientResultStatus::Failed,
|
||||
CoreEpiphanyCrrcResultStatus::Cancelled => ThreadEpiphanyReorientResultStatus::Cancelled,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ remembers doctrine; the branch remembers the blade.
|
|||
- 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.
|
||||
- Runtime-result loading now has core typed snapshot APIs for role and reorient worker results, with legacy protocol tuple wrappers layered over them. This intentionally creates temporary duplicate note rendering; the next cut should move coordinator and acceptance consumers to typed snapshots, then delete protocol-shaped result rendering instead of preserving both.
|
||||
- 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.
|
|
@ -315,7 +315,10 @@ current_status:
|
|||
recommendations, role-board lanes, and core role/reorient result
|
||||
interpretations now remain serializable typed surfaces; app-server still
|
||||
projects those typed surfaces into `ThreadEpiphany*` responses at the legacy
|
||||
JSON-RPC edge. The bridge still
|
||||
JSON-RPC edge. Runtime-result loading now has core typed snapshot APIs, with
|
||||
protocol finding tuples retained only as legacy wrappers; delete the
|
||||
duplicate protocol-shaped result rendering once coordinator and acceptance
|
||||
consume the typed snapshots directly. The bridge still
|
||||
depends on vendored Codex for app-server protocol DTOs and absolute path
|
||||
validation, so the purification is not done.
|
||||
next_action: Continue Codex starvation and CultNet liberation by cutting bridge-internal `ThreadEpiphany*` authority. Prioritize role-result/reorient-result DTO coupling next: derive typed CultNet surfaces first, push JSON-RPC projection into app-server, and keep MCP/OpenAI JSON only at their true protocol/text edges. Do not add compatibility adapters unless they protect a named ownership invariant.
|
||||
|
|
|
|||
Reference in a new issue