Split native coordinator result organ
This commit is contained in:
parent
f387a2ca7e
commit
61187f7a22
6 changed files with 483 additions and 475 deletions
461
epiphany-core/src/coordinator_results.rs
Normal file
461
epiphany-core/src/coordinator_results.rs
Normal file
|
|
@ -0,0 +1,461 @@
|
|||
use crate::*;
|
||||
use epiphany_state_model::EpiphanyRuntimeLink;
|
||||
use epiphany_state_model::EpiphanyThreadState;
|
||||
use std::path::Path;
|
||||
|
||||
pub(crate) fn latest_runtime_link<'a>(
|
||||
state: &'a EpiphanyThreadState,
|
||||
binding_id: &str,
|
||||
) -> Option<&'a EpiphanyRuntimeLink> {
|
||||
state
|
||||
.runtime_links
|
||||
.iter()
|
||||
.find(|link| link.binding_id == binding_id && !link.runtime_job_id.trim().is_empty())
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct EpiphanyCoordinatorRoleResultSnapshot {
|
||||
pub status: EpiphanyCoordinatorRoleResultStatus,
|
||||
pub finding: Option<EpiphanyRoleFindingInterpretation>,
|
||||
pub note: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct EpiphanyCoordinatorReorientResultSnapshot {
|
||||
pub status: EpiphanyCrrcResultStatus,
|
||||
pub finding: Option<EpiphanyReorientFindingInterpretation>,
|
||||
pub note: String,
|
||||
}
|
||||
pub fn read_role_result_snapshot(
|
||||
state: Option<&EpiphanyThreadState>,
|
||||
runtime_store_path: Option<&Path>,
|
||||
role_id: EpiphanyRoleResultRoleId,
|
||||
binding_id: &str,
|
||||
) -> EpiphanyCoordinatorRoleResultSnapshot {
|
||||
let Some(state) = state else {
|
||||
return role_snapshot(
|
||||
role_id,
|
||||
EpiphanyCoordinatorRoleResultStatus::MissingState,
|
||||
None,
|
||||
None,
|
||||
);
|
||||
};
|
||||
if let Some(link) = latest_runtime_link(state, binding_id) {
|
||||
return read_runtime_role_result(runtime_store_path, &link.runtime_job_id, role_id);
|
||||
}
|
||||
if state
|
||||
.job_bindings
|
||||
.iter()
|
||||
.any(|binding| binding.id == binding_id)
|
||||
{
|
||||
role_snapshot(
|
||||
role_id,
|
||||
EpiphanyCoordinatorRoleResultStatus::BackendUnavailable,
|
||||
None,
|
||||
Some(
|
||||
"Role binding has no runtime-spine job id; launch a runtime-linked role worker for typed results.",
|
||||
),
|
||||
)
|
||||
} else {
|
||||
role_snapshot(
|
||||
role_id,
|
||||
EpiphanyCoordinatorRoleResultStatus::MissingBinding,
|
||||
None,
|
||||
None,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn read_reorient_result_snapshot(
|
||||
state: Option<&EpiphanyThreadState>,
|
||||
runtime_store_path: Option<&Path>,
|
||||
binding_id: &str,
|
||||
) -> EpiphanyCoordinatorReorientResultSnapshot {
|
||||
let Some(state) = state else {
|
||||
return reorient_snapshot(EpiphanyCrrcResultStatus::MissingState, None, None);
|
||||
};
|
||||
if let Some(link) = latest_runtime_link(state, binding_id) {
|
||||
return read_runtime_reorient_result(runtime_store_path, &link.runtime_job_id);
|
||||
}
|
||||
if state
|
||||
.job_bindings
|
||||
.iter()
|
||||
.any(|binding| binding.id == binding_id)
|
||||
{
|
||||
reorient_snapshot(
|
||||
EpiphanyCrrcResultStatus::BackendUnavailable,
|
||||
None,
|
||||
Some(
|
||||
"Reorientation binding has no runtime-spine job id; launch a runtime-linked reorient worker for typed results.",
|
||||
),
|
||||
)
|
||||
} else {
|
||||
reorient_snapshot(EpiphanyCrrcResultStatus::MissingBinding, None, None)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn read_runtime_role_result(
|
||||
runtime_store_path: Option<&Path>,
|
||||
job_id: &str,
|
||||
role_id: EpiphanyRoleResultRoleId,
|
||||
) -> EpiphanyCoordinatorRoleResultSnapshot {
|
||||
let Some(runtime_store_path) = runtime_store_path else {
|
||||
return role_snapshot(
|
||||
role_id,
|
||||
EpiphanyCoordinatorRoleResultStatus::Pending,
|
||||
None,
|
||||
Some(
|
||||
"Heartbeat activation owns this role specialist; no loaded runtime-spine store is available yet.",
|
||||
),
|
||||
);
|
||||
};
|
||||
let snapshot = match runtime_job_snapshot(runtime_store_path, job_id) {
|
||||
Ok(Some(snapshot)) => snapshot,
|
||||
Ok(None) => {
|
||||
return role_snapshot(
|
||||
role_id,
|
||||
EpiphanyCoordinatorRoleResultStatus::Pending,
|
||||
None,
|
||||
Some(&format!(
|
||||
"Heartbeat runtime job {job_id:?} has not reported typed state yet."
|
||||
)),
|
||||
);
|
||||
}
|
||||
Err(error) => {
|
||||
return role_snapshot(
|
||||
role_id,
|
||||
EpiphanyCoordinatorRoleResultStatus::BackendUnavailable,
|
||||
None,
|
||||
Some(&format!(
|
||||
"Failed to read heartbeat runtime-spine job {job_id:?}: {error}"
|
||||
)),
|
||||
);
|
||||
}
|
||||
};
|
||||
let status = role_result_status(&snapshot);
|
||||
let finding = match status {
|
||||
EpiphanyCoordinatorRoleResultStatus::Completed => {
|
||||
match runtime_role_worker_result(runtime_store_path, job_id) {
|
||||
Ok(Some(result)) => Some(interpret_runtime_role_worker_result(role_id, &result)),
|
||||
Ok(None) => {
|
||||
return role_snapshot(
|
||||
role_id,
|
||||
EpiphanyCoordinatorRoleResultStatus::BackendUnavailable,
|
||||
None,
|
||||
Some(&format!(
|
||||
"Heartbeat runtime job {job_id:?} completed without an EpiphanyRuntimeRoleWorkerResult typed document; generic lifecycle receipts are not reviewable findings."
|
||||
)),
|
||||
);
|
||||
}
|
||||
Err(error) => {
|
||||
return role_snapshot(
|
||||
role_id,
|
||||
EpiphanyCoordinatorRoleResultStatus::BackendUnavailable,
|
||||
None,
|
||||
Some(&format!(
|
||||
"Failed to read typed role worker result for heartbeat runtime job {job_id:?}: {error}"
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
EpiphanyCoordinatorRoleResultStatus::Failed
|
||||
| EpiphanyCoordinatorRoleResultStatus::Cancelled => snapshot
|
||||
.result
|
||||
.as_ref()
|
||||
.map(interpret_role_lifecycle_failure),
|
||||
_ => None,
|
||||
};
|
||||
role_snapshot(role_id, status, finding, None)
|
||||
}
|
||||
|
||||
pub fn read_runtime_reorient_result(
|
||||
runtime_store_path: Option<&Path>,
|
||||
job_id: &str,
|
||||
) -> EpiphanyCoordinatorReorientResultSnapshot {
|
||||
let Some(runtime_store_path) = runtime_store_path else {
|
||||
return reorient_snapshot(
|
||||
EpiphanyCrrcResultStatus::Pending,
|
||||
None,
|
||||
Some(
|
||||
"Heartbeat activation owns this reorientation worker; no loaded runtime-spine store is available yet.",
|
||||
),
|
||||
);
|
||||
};
|
||||
let snapshot = match runtime_job_snapshot(runtime_store_path, job_id) {
|
||||
Ok(Some(snapshot)) => snapshot,
|
||||
Ok(None) => {
|
||||
return reorient_snapshot(
|
||||
EpiphanyCrrcResultStatus::Pending,
|
||||
None,
|
||||
Some(&format!(
|
||||
"Heartbeat runtime job {job_id:?} has not reported typed state yet."
|
||||
)),
|
||||
);
|
||||
}
|
||||
Err(error) => {
|
||||
return reorient_snapshot(
|
||||
EpiphanyCrrcResultStatus::BackendUnavailable,
|
||||
None,
|
||||
Some(&format!(
|
||||
"Failed to read heartbeat runtime-spine job {job_id:?}: {error}"
|
||||
)),
|
||||
);
|
||||
}
|
||||
};
|
||||
let status = reorient_result_status(&snapshot);
|
||||
let finding = match status {
|
||||
EpiphanyCrrcResultStatus::Completed => {
|
||||
match runtime_reorient_worker_result(runtime_store_path, job_id) {
|
||||
Ok(Some(result)) => Some(interpret_runtime_reorient_worker_result(&result)),
|
||||
Ok(None) => {
|
||||
return reorient_snapshot(
|
||||
EpiphanyCrrcResultStatus::BackendUnavailable,
|
||||
None,
|
||||
Some(&format!(
|
||||
"Heartbeat runtime job {job_id:?} completed without an EpiphanyRuntimeReorientWorkerResult typed document; generic lifecycle receipts are not reviewable findings."
|
||||
)),
|
||||
);
|
||||
}
|
||||
Err(error) => {
|
||||
return reorient_snapshot(
|
||||
EpiphanyCrrcResultStatus::BackendUnavailable,
|
||||
None,
|
||||
Some(&format!(
|
||||
"Failed to read typed reorientation worker result for heartbeat runtime job {job_id:?}: {error}"
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
EpiphanyCrrcResultStatus::Failed | EpiphanyCrrcResultStatus::Cancelled => snapshot
|
||||
.result
|
||||
.as_ref()
|
||||
.map(interpret_reorient_lifecycle_failure),
|
||||
_ => None,
|
||||
};
|
||||
reorient_snapshot(status, finding, None)
|
||||
}
|
||||
|
||||
fn role_snapshot(
|
||||
role_id: EpiphanyRoleResultRoleId,
|
||||
status: EpiphanyCoordinatorRoleResultStatus,
|
||||
finding: Option<EpiphanyRoleFindingInterpretation>,
|
||||
note_override: Option<&str>,
|
||||
) -> EpiphanyCoordinatorRoleResultSnapshot {
|
||||
let note = note_override.map(str::to_string).unwrap_or_else(|| {
|
||||
render_role_result_note(
|
||||
role_id,
|
||||
status,
|
||||
finding.as_ref(),
|
||||
finding
|
||||
.as_ref()
|
||||
.and_then(|finding| finding.job_error.as_deref()),
|
||||
)
|
||||
});
|
||||
EpiphanyCoordinatorRoleResultSnapshot {
|
||||
status,
|
||||
finding,
|
||||
note,
|
||||
}
|
||||
}
|
||||
|
||||
fn reorient_snapshot(
|
||||
status: EpiphanyCrrcResultStatus,
|
||||
finding: Option<EpiphanyReorientFindingInterpretation>,
|
||||
note_override: Option<&str>,
|
||||
) -> EpiphanyCoordinatorReorientResultSnapshot {
|
||||
let note = note_override.map(str::to_string).unwrap_or_else(|| {
|
||||
render_reorient_result_note(
|
||||
status,
|
||||
finding.as_ref(),
|
||||
finding
|
||||
.as_ref()
|
||||
.and_then(|finding| finding.job_error.as_deref()),
|
||||
)
|
||||
});
|
||||
EpiphanyCoordinatorReorientResultSnapshot {
|
||||
status,
|
||||
finding,
|
||||
note,
|
||||
}
|
||||
}
|
||||
|
||||
fn interpret_role_lifecycle_failure(
|
||||
result: &EpiphanyRuntimeJobResult,
|
||||
) -> EpiphanyRoleFindingInterpretation {
|
||||
EpiphanyRoleFindingInterpretation {
|
||||
verdict: Some(result.verdict.clone()),
|
||||
summary: Some(result.summary.clone()),
|
||||
next_safe_move: nonempty(&result.next_safe_move),
|
||||
checkpoint_summary: None,
|
||||
scratch_summary: None,
|
||||
files_inspected: Vec::new(),
|
||||
frontier_node_ids: Vec::new(),
|
||||
evidence_ids: result.evidence_refs.clone(),
|
||||
artifact_refs: result.artifact_refs.clone(),
|
||||
runtime_result_id: Some(result.result_id.clone()),
|
||||
runtime_job_id: Some(result.job_id.clone()),
|
||||
open_questions: Vec::new(),
|
||||
evidence_gaps: Vec::new(),
|
||||
risks: Vec::new(),
|
||||
state_patch: None,
|
||||
self_patch: None,
|
||||
self_persistence: None,
|
||||
job_error: Some(result.summary.clone()),
|
||||
item_error: None,
|
||||
}
|
||||
}
|
||||
|
||||
fn interpret_reorient_lifecycle_failure(
|
||||
result: &EpiphanyRuntimeJobResult,
|
||||
) -> EpiphanyReorientFindingInterpretation {
|
||||
EpiphanyReorientFindingInterpretation {
|
||||
mode: None,
|
||||
summary: Some(result.summary.clone()),
|
||||
next_safe_move: nonempty(&result.next_safe_move),
|
||||
checkpoint_still_valid: None,
|
||||
files_inspected: Vec::new(),
|
||||
frontier_node_ids: Vec::new(),
|
||||
evidence_ids: result.evidence_refs.clone(),
|
||||
artifact_refs: result.artifact_refs.clone(),
|
||||
runtime_result_id: Some(result.result_id.clone()),
|
||||
runtime_job_id: Some(result.job_id.clone()),
|
||||
job_error: Some(result.summary.clone()),
|
||||
item_error: None,
|
||||
}
|
||||
}
|
||||
|
||||
fn role_result_status(
|
||||
snapshot: &EpiphanyRuntimeJobSnapshot,
|
||||
) -> EpiphanyCoordinatorRoleResultStatus {
|
||||
match snapshot.job.status {
|
||||
EpiphanyRuntimeJobStatus::Queued => EpiphanyCoordinatorRoleResultStatus::Pending,
|
||||
EpiphanyRuntimeJobStatus::Running | EpiphanyRuntimeJobStatus::WaitingForReview => {
|
||||
EpiphanyCoordinatorRoleResultStatus::Running
|
||||
}
|
||||
EpiphanyRuntimeJobStatus::Completed if snapshot.result.is_some() => {
|
||||
EpiphanyCoordinatorRoleResultStatus::Completed
|
||||
}
|
||||
EpiphanyRuntimeJobStatus::Completed => EpiphanyCoordinatorRoleResultStatus::Pending,
|
||||
EpiphanyRuntimeJobStatus::Failed => EpiphanyCoordinatorRoleResultStatus::Failed,
|
||||
EpiphanyRuntimeJobStatus::Cancelled => EpiphanyCoordinatorRoleResultStatus::Cancelled,
|
||||
}
|
||||
}
|
||||
|
||||
fn reorient_result_status(snapshot: &EpiphanyRuntimeJobSnapshot) -> EpiphanyCrrcResultStatus {
|
||||
match snapshot.job.status {
|
||||
EpiphanyRuntimeJobStatus::Queued => EpiphanyCrrcResultStatus::Pending,
|
||||
EpiphanyRuntimeJobStatus::Running | EpiphanyRuntimeJobStatus::WaitingForReview => {
|
||||
EpiphanyCrrcResultStatus::Running
|
||||
}
|
||||
EpiphanyRuntimeJobStatus::Completed if snapshot.result.is_some() => {
|
||||
EpiphanyCrrcResultStatus::Completed
|
||||
}
|
||||
EpiphanyRuntimeJobStatus::Completed => EpiphanyCrrcResultStatus::Pending,
|
||||
EpiphanyRuntimeJobStatus::Failed => EpiphanyCrrcResultStatus::Failed,
|
||||
EpiphanyRuntimeJobStatus::Cancelled => EpiphanyCrrcResultStatus::Cancelled,
|
||||
}
|
||||
}
|
||||
|
||||
fn render_role_result_note(
|
||||
role_id: EpiphanyRoleResultRoleId,
|
||||
status: EpiphanyCoordinatorRoleResultStatus,
|
||||
finding: Option<&EpiphanyRoleFindingInterpretation>,
|
||||
item_error: Option<&str>,
|
||||
) -> String {
|
||||
match status {
|
||||
EpiphanyCoordinatorRoleResultStatus::Completed => finding.map_or_else(
|
||||
|| format!("{role_id:?} role specialist completed, but no structured result was recorded."),
|
||||
|finding| {
|
||||
let next = finding.next_safe_move.as_deref().unwrap_or("not supplied");
|
||||
let self_note = render_self_persistence_note(finding.self_persistence.as_ref())
|
||||
.map(|note| format!(" {note}"))
|
||||
.unwrap_or_default();
|
||||
if let Some(error) = finding.item_error.as_deref().or(item_error) {
|
||||
format!("{role_id:?} role specialist completed, but the finding needs repair: {error}. Next safe move: {next}.{self_note}")
|
||||
} else {
|
||||
format!("{role_id:?} role specialist completed. Next safe move: {next}.{self_note}")
|
||||
}
|
||||
},
|
||||
),
|
||||
EpiphanyCoordinatorRoleResultStatus::Failed => item_error
|
||||
.map(|error| format!("{role_id:?} role specialist failed: {error}"))
|
||||
.unwrap_or_else(|| format!("{role_id:?} role specialist failed.")),
|
||||
EpiphanyCoordinatorRoleResultStatus::Cancelled => format!("{role_id:?} role specialist was cancelled before producing a result."),
|
||||
EpiphanyCoordinatorRoleResultStatus::Running => format!("{role_id:?} role specialist is still running."),
|
||||
EpiphanyCoordinatorRoleResultStatus::Pending => format!("{role_id:?} role specialist has not produced a result yet."),
|
||||
EpiphanyCoordinatorRoleResultStatus::MissingState => "No authoritative Epiphany state exists for this thread.".to_string(),
|
||||
EpiphanyCoordinatorRoleResultStatus::MissingBinding => "No matching Epiphany role specialist binding exists.".to_string(),
|
||||
EpiphanyCoordinatorRoleResultStatus::BackendUnavailable => "The bound runtime backend is unavailable.".to_string(),
|
||||
EpiphanyCoordinatorRoleResultStatus::BackendMissing => "The bound runtime backend job or item is missing.".to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
fn render_self_persistence_note(
|
||||
review: Option<&EpiphanyRoleSelfPersistenceReview>,
|
||||
) -> Option<String> {
|
||||
let review = review?;
|
||||
match review.status {
|
||||
EpiphanyRoleSelfPersistenceStatus::Missing => None,
|
||||
EpiphanyRoleSelfPersistenceStatus::Accepted => Some(format!(
|
||||
"Self persistence request is acceptable for {}.",
|
||||
review
|
||||
.target_agent_id
|
||||
.as_deref()
|
||||
.unwrap_or("the role memory file")
|
||||
)),
|
||||
EpiphanyRoleSelfPersistenceStatus::Rejected => Some(format!(
|
||||
"Self persistence request was refused: {}.",
|
||||
if review.reasons.is_empty() {
|
||||
"no reason recorded".to_string()
|
||||
} else {
|
||||
review.reasons.join("; ")
|
||||
}
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
||||
fn render_reorient_result_note(
|
||||
status: EpiphanyCrrcResultStatus,
|
||||
finding: Option<&EpiphanyReorientFindingInterpretation>,
|
||||
item_error: Option<&str>,
|
||||
) -> String {
|
||||
match status {
|
||||
EpiphanyCrrcResultStatus::Completed => finding.map_or_else(
|
||||
|| "Reorientation worker completed, but no structured result was recorded.".to_string(),
|
||||
|finding| {
|
||||
format!(
|
||||
"Reorientation worker completed. Next safe move: {}",
|
||||
finding.next_safe_move.as_deref().unwrap_or("not supplied")
|
||||
)
|
||||
},
|
||||
),
|
||||
EpiphanyCrrcResultStatus::Failed => item_error
|
||||
.map(|error| format!("Reorientation worker failed: {error}"))
|
||||
.unwrap_or_else(|| "Reorientation worker failed.".to_string()),
|
||||
EpiphanyCrrcResultStatus::Cancelled => {
|
||||
"Reorientation worker was cancelled before producing a result.".to_string()
|
||||
}
|
||||
EpiphanyCrrcResultStatus::Running => "Reorientation worker is still running.".to_string(),
|
||||
EpiphanyCrrcResultStatus::Pending => {
|
||||
"Reorientation worker has not produced a result yet.".to_string()
|
||||
}
|
||||
EpiphanyCrrcResultStatus::MissingState => {
|
||||
"No authoritative Epiphany state exists for this thread.".to_string()
|
||||
}
|
||||
EpiphanyCrrcResultStatus::MissingBinding => {
|
||||
"No matching Epiphany reorientation worker binding exists.".to_string()
|
||||
}
|
||||
EpiphanyCrrcResultStatus::BackendUnavailable => {
|
||||
"The bound runtime backend is unavailable.".to_string()
|
||||
}
|
||||
EpiphanyCrrcResultStatus::BackendMissing => {
|
||||
"The bound runtime backend job or item is missing.".to_string()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn nonempty(value: &str) -> Option<String> {
|
||||
(!value.trim().is_empty()).then(|| value.to_string())
|
||||
}
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
use crate::EpiphanyCoordinatorReorientResultSnapshot;
|
||||
use crate::EpiphanyCoordinatorRoleResultSnapshot;
|
||||
use crate::EpiphanyCoordinatorRoleResultStatus;
|
||||
use crate::EpiphanyCrrcResultStatus;
|
||||
use crate::EpiphanyLaunchOrganContract;
|
||||
|
|
@ -7,12 +9,7 @@ use crate::EpiphanyReorientFindingInterpretation;
|
|||
use crate::EpiphanyRoleAcceptanceFinding;
|
||||
use crate::EpiphanyRoleFindingInterpretation;
|
||||
use crate::EpiphanyRoleResultRoleId;
|
||||
use crate::EpiphanyRoleSelfPersistenceReview;
|
||||
use crate::EpiphanyRoleSelfPersistenceStatus;
|
||||
use crate::EpiphanyRoleStatePatchDocument;
|
||||
use crate::EpiphanyRuntimeJobResult;
|
||||
use crate::EpiphanyRuntimeJobSnapshot;
|
||||
use crate::EpiphanyRuntimeJobStatus;
|
||||
use crate::EpiphanyStateUpdate;
|
||||
use crate::EpiphanyStateUpdatedField;
|
||||
use crate::MIND_GATEWAY_REVIEW_TYPE;
|
||||
|
|
@ -20,19 +17,19 @@ use crate::MindGatewayReview;
|
|||
use crate::apply_epiphany_state_update;
|
||||
use crate::build_reorient_acceptance_bundle;
|
||||
use crate::build_role_acceptance_bundle;
|
||||
use crate::coordinator_results::latest_runtime_link;
|
||||
use crate::epiphany_state_update_validation_errors;
|
||||
use crate::imagination_role_state_patch_policy_errors;
|
||||
use crate::interpret_runtime_reorient_worker_result;
|
||||
use crate::interpret_runtime_role_worker_result;
|
||||
use crate::load_thread_state;
|
||||
use crate::mind_review_allows_state;
|
||||
use crate::mind_review_reorient_acceptance;
|
||||
use crate::mind_review_role_acceptance;
|
||||
use crate::modeling_role_state_patch_policy_errors;
|
||||
use crate::read_reorient_result_snapshot;
|
||||
use crate::read_role_result_snapshot;
|
||||
use crate::read_runtime_reorient_result;
|
||||
use crate::read_runtime_role_result;
|
||||
use crate::research_role_state_patch_policy_errors;
|
||||
use crate::runtime_job_snapshot;
|
||||
use crate::runtime_reorient_worker_result;
|
||||
use crate::runtime_role_worker_result;
|
||||
use crate::runtime_worker_launch_request;
|
||||
use crate::write_thread_state;
|
||||
use anyhow::Result;
|
||||
|
|
@ -94,20 +91,6 @@ pub struct EpiphanyReorientAcceptanceUpdate {
|
|||
pub mind_review: MindGatewayReview,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct EpiphanyCoordinatorRoleResultSnapshot {
|
||||
pub status: EpiphanyCoordinatorRoleResultStatus,
|
||||
pub finding: Option<EpiphanyRoleFindingInterpretation>,
|
||||
pub note: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct EpiphanyCoordinatorReorientResultSnapshot {
|
||||
pub status: EpiphanyCrrcResultStatus,
|
||||
pub finding: Option<EpiphanyReorientFindingInterpretation>,
|
||||
pub note: String,
|
||||
}
|
||||
|
||||
impl EpiphanyCoordinatorService {
|
||||
pub fn new(
|
||||
thread_state_store: impl Into<PathBuf>,
|
||||
|
|
@ -178,74 +161,6 @@ impl EpiphanyCoordinatorService {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn read_role_result_snapshot(
|
||||
state: Option<&EpiphanyThreadState>,
|
||||
runtime_store_path: Option<&Path>,
|
||||
role_id: EpiphanyRoleResultRoleId,
|
||||
binding_id: &str,
|
||||
) -> EpiphanyCoordinatorRoleResultSnapshot {
|
||||
let Some(state) = state else {
|
||||
return role_snapshot(
|
||||
role_id,
|
||||
EpiphanyCoordinatorRoleResultStatus::MissingState,
|
||||
None,
|
||||
None,
|
||||
);
|
||||
};
|
||||
if let Some(link) = latest_runtime_link(state, binding_id) {
|
||||
return read_runtime_role_result(runtime_store_path, &link.runtime_job_id, role_id);
|
||||
}
|
||||
if state
|
||||
.job_bindings
|
||||
.iter()
|
||||
.any(|binding| binding.id == binding_id)
|
||||
{
|
||||
role_snapshot(
|
||||
role_id,
|
||||
EpiphanyCoordinatorRoleResultStatus::BackendUnavailable,
|
||||
None,
|
||||
Some(
|
||||
"Role binding has no runtime-spine job id; launch a runtime-linked role worker for typed results.",
|
||||
),
|
||||
)
|
||||
} else {
|
||||
role_snapshot(
|
||||
role_id,
|
||||
EpiphanyCoordinatorRoleResultStatus::MissingBinding,
|
||||
None,
|
||||
None,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn read_reorient_result_snapshot(
|
||||
state: Option<&EpiphanyThreadState>,
|
||||
runtime_store_path: Option<&Path>,
|
||||
binding_id: &str,
|
||||
) -> EpiphanyCoordinatorReorientResultSnapshot {
|
||||
let Some(state) = state else {
|
||||
return reorient_snapshot(EpiphanyCrrcResultStatus::MissingState, None, None);
|
||||
};
|
||||
if let Some(link) = latest_runtime_link(state, binding_id) {
|
||||
return read_runtime_reorient_result(runtime_store_path, &link.runtime_job_id);
|
||||
}
|
||||
if state
|
||||
.job_bindings
|
||||
.iter()
|
||||
.any(|binding| binding.id == binding_id)
|
||||
{
|
||||
reorient_snapshot(
|
||||
EpiphanyCrrcResultStatus::BackendUnavailable,
|
||||
None,
|
||||
Some(
|
||||
"Reorientation binding has no runtime-spine job id; launch a runtime-linked reorient worker for typed results.",
|
||||
),
|
||||
)
|
||||
} else {
|
||||
reorient_snapshot(EpiphanyCrrcResultStatus::MissingBinding, None, None)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn completed_role_finding(
|
||||
runtime_store_path: Option<&Path>,
|
||||
state: &EpiphanyThreadState,
|
||||
|
|
@ -568,382 +483,6 @@ fn role_label_lower(role_id: EpiphanyRoleResultRoleId) -> &'static str {
|
|||
}
|
||||
}
|
||||
|
||||
fn latest_runtime_link<'a>(
|
||||
state: &'a EpiphanyThreadState,
|
||||
binding_id: &str,
|
||||
) -> Option<&'a epiphany_state_model::EpiphanyRuntimeLink> {
|
||||
state
|
||||
.runtime_links
|
||||
.iter()
|
||||
.find(|link| link.binding_id == binding_id && !link.runtime_job_id.trim().is_empty())
|
||||
}
|
||||
|
||||
pub fn read_runtime_role_result(
|
||||
runtime_store_path: Option<&Path>,
|
||||
job_id: &str,
|
||||
role_id: EpiphanyRoleResultRoleId,
|
||||
) -> EpiphanyCoordinatorRoleResultSnapshot {
|
||||
let Some(runtime_store_path) = runtime_store_path else {
|
||||
return role_snapshot(
|
||||
role_id,
|
||||
EpiphanyCoordinatorRoleResultStatus::Pending,
|
||||
None,
|
||||
Some(
|
||||
"Heartbeat activation owns this role specialist; no loaded runtime-spine store is available yet.",
|
||||
),
|
||||
);
|
||||
};
|
||||
let snapshot = match runtime_job_snapshot(runtime_store_path, job_id) {
|
||||
Ok(Some(snapshot)) => snapshot,
|
||||
Ok(None) => {
|
||||
return role_snapshot(
|
||||
role_id,
|
||||
EpiphanyCoordinatorRoleResultStatus::Pending,
|
||||
None,
|
||||
Some(&format!(
|
||||
"Heartbeat runtime job {job_id:?} has not reported typed state yet."
|
||||
)),
|
||||
);
|
||||
}
|
||||
Err(error) => {
|
||||
return role_snapshot(
|
||||
role_id,
|
||||
EpiphanyCoordinatorRoleResultStatus::BackendUnavailable,
|
||||
None,
|
||||
Some(&format!(
|
||||
"Failed to read heartbeat runtime-spine job {job_id:?}: {error}"
|
||||
)),
|
||||
);
|
||||
}
|
||||
};
|
||||
let status = role_result_status(&snapshot);
|
||||
let finding = match status {
|
||||
EpiphanyCoordinatorRoleResultStatus::Completed => {
|
||||
match runtime_role_worker_result(runtime_store_path, job_id) {
|
||||
Ok(Some(result)) => Some(interpret_runtime_role_worker_result(role_id, &result)),
|
||||
Ok(None) => {
|
||||
return role_snapshot(
|
||||
role_id,
|
||||
EpiphanyCoordinatorRoleResultStatus::BackendUnavailable,
|
||||
None,
|
||||
Some(&format!(
|
||||
"Heartbeat runtime job {job_id:?} completed without an EpiphanyRuntimeRoleWorkerResult typed document; generic lifecycle receipts are not reviewable findings."
|
||||
)),
|
||||
);
|
||||
}
|
||||
Err(error) => {
|
||||
return role_snapshot(
|
||||
role_id,
|
||||
EpiphanyCoordinatorRoleResultStatus::BackendUnavailable,
|
||||
None,
|
||||
Some(&format!(
|
||||
"Failed to read typed role worker result for heartbeat runtime job {job_id:?}: {error}"
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
EpiphanyCoordinatorRoleResultStatus::Failed
|
||||
| EpiphanyCoordinatorRoleResultStatus::Cancelled => snapshot
|
||||
.result
|
||||
.as_ref()
|
||||
.map(interpret_role_lifecycle_failure),
|
||||
_ => None,
|
||||
};
|
||||
role_snapshot(role_id, status, finding, None)
|
||||
}
|
||||
|
||||
pub fn read_runtime_reorient_result(
|
||||
runtime_store_path: Option<&Path>,
|
||||
job_id: &str,
|
||||
) -> EpiphanyCoordinatorReorientResultSnapshot {
|
||||
let Some(runtime_store_path) = runtime_store_path else {
|
||||
return reorient_snapshot(
|
||||
EpiphanyCrrcResultStatus::Pending,
|
||||
None,
|
||||
Some(
|
||||
"Heartbeat activation owns this reorientation worker; no loaded runtime-spine store is available yet.",
|
||||
),
|
||||
);
|
||||
};
|
||||
let snapshot = match runtime_job_snapshot(runtime_store_path, job_id) {
|
||||
Ok(Some(snapshot)) => snapshot,
|
||||
Ok(None) => {
|
||||
return reorient_snapshot(
|
||||
EpiphanyCrrcResultStatus::Pending,
|
||||
None,
|
||||
Some(&format!(
|
||||
"Heartbeat runtime job {job_id:?} has not reported typed state yet."
|
||||
)),
|
||||
);
|
||||
}
|
||||
Err(error) => {
|
||||
return reorient_snapshot(
|
||||
EpiphanyCrrcResultStatus::BackendUnavailable,
|
||||
None,
|
||||
Some(&format!(
|
||||
"Failed to read heartbeat runtime-spine job {job_id:?}: {error}"
|
||||
)),
|
||||
);
|
||||
}
|
||||
};
|
||||
let status = reorient_result_status(&snapshot);
|
||||
let finding = match status {
|
||||
EpiphanyCrrcResultStatus::Completed => {
|
||||
match runtime_reorient_worker_result(runtime_store_path, job_id) {
|
||||
Ok(Some(result)) => Some(interpret_runtime_reorient_worker_result(&result)),
|
||||
Ok(None) => {
|
||||
return reorient_snapshot(
|
||||
EpiphanyCrrcResultStatus::BackendUnavailable,
|
||||
None,
|
||||
Some(&format!(
|
||||
"Heartbeat runtime job {job_id:?} completed without an EpiphanyRuntimeReorientWorkerResult typed document; generic lifecycle receipts are not reviewable findings."
|
||||
)),
|
||||
);
|
||||
}
|
||||
Err(error) => {
|
||||
return reorient_snapshot(
|
||||
EpiphanyCrrcResultStatus::BackendUnavailable,
|
||||
None,
|
||||
Some(&format!(
|
||||
"Failed to read typed reorientation worker result for heartbeat runtime job {job_id:?}: {error}"
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
EpiphanyCrrcResultStatus::Failed | EpiphanyCrrcResultStatus::Cancelled => snapshot
|
||||
.result
|
||||
.as_ref()
|
||||
.map(interpret_reorient_lifecycle_failure),
|
||||
_ => None,
|
||||
};
|
||||
reorient_snapshot(status, finding, None)
|
||||
}
|
||||
|
||||
fn role_snapshot(
|
||||
role_id: EpiphanyRoleResultRoleId,
|
||||
status: EpiphanyCoordinatorRoleResultStatus,
|
||||
finding: Option<EpiphanyRoleFindingInterpretation>,
|
||||
note_override: Option<&str>,
|
||||
) -> EpiphanyCoordinatorRoleResultSnapshot {
|
||||
let note = note_override.map(str::to_string).unwrap_or_else(|| {
|
||||
render_role_result_note(
|
||||
role_id,
|
||||
status,
|
||||
finding.as_ref(),
|
||||
finding
|
||||
.as_ref()
|
||||
.and_then(|finding| finding.job_error.as_deref()),
|
||||
)
|
||||
});
|
||||
EpiphanyCoordinatorRoleResultSnapshot {
|
||||
status,
|
||||
finding,
|
||||
note,
|
||||
}
|
||||
}
|
||||
|
||||
fn reorient_snapshot(
|
||||
status: EpiphanyCrrcResultStatus,
|
||||
finding: Option<EpiphanyReorientFindingInterpretation>,
|
||||
note_override: Option<&str>,
|
||||
) -> EpiphanyCoordinatorReorientResultSnapshot {
|
||||
let note = note_override.map(str::to_string).unwrap_or_else(|| {
|
||||
render_reorient_result_note(
|
||||
status,
|
||||
finding.as_ref(),
|
||||
finding
|
||||
.as_ref()
|
||||
.and_then(|finding| finding.job_error.as_deref()),
|
||||
)
|
||||
});
|
||||
EpiphanyCoordinatorReorientResultSnapshot {
|
||||
status,
|
||||
finding,
|
||||
note,
|
||||
}
|
||||
}
|
||||
|
||||
fn interpret_role_lifecycle_failure(
|
||||
result: &EpiphanyRuntimeJobResult,
|
||||
) -> EpiphanyRoleFindingInterpretation {
|
||||
EpiphanyRoleFindingInterpretation {
|
||||
verdict: Some(result.verdict.clone()),
|
||||
summary: Some(result.summary.clone()),
|
||||
next_safe_move: nonempty(&result.next_safe_move),
|
||||
checkpoint_summary: None,
|
||||
scratch_summary: None,
|
||||
files_inspected: Vec::new(),
|
||||
frontier_node_ids: Vec::new(),
|
||||
evidence_ids: result.evidence_refs.clone(),
|
||||
artifact_refs: result.artifact_refs.clone(),
|
||||
runtime_result_id: Some(result.result_id.clone()),
|
||||
runtime_job_id: Some(result.job_id.clone()),
|
||||
open_questions: Vec::new(),
|
||||
evidence_gaps: Vec::new(),
|
||||
risks: Vec::new(),
|
||||
state_patch: None,
|
||||
self_patch: None,
|
||||
self_persistence: None,
|
||||
job_error: Some(result.summary.clone()),
|
||||
item_error: None,
|
||||
}
|
||||
}
|
||||
|
||||
fn interpret_reorient_lifecycle_failure(
|
||||
result: &EpiphanyRuntimeJobResult,
|
||||
) -> EpiphanyReorientFindingInterpretation {
|
||||
EpiphanyReorientFindingInterpretation {
|
||||
mode: None,
|
||||
summary: Some(result.summary.clone()),
|
||||
next_safe_move: nonempty(&result.next_safe_move),
|
||||
checkpoint_still_valid: None,
|
||||
files_inspected: Vec::new(),
|
||||
frontier_node_ids: Vec::new(),
|
||||
evidence_ids: result.evidence_refs.clone(),
|
||||
artifact_refs: result.artifact_refs.clone(),
|
||||
runtime_result_id: Some(result.result_id.clone()),
|
||||
runtime_job_id: Some(result.job_id.clone()),
|
||||
job_error: Some(result.summary.clone()),
|
||||
item_error: None,
|
||||
}
|
||||
}
|
||||
|
||||
fn role_result_status(
|
||||
snapshot: &EpiphanyRuntimeJobSnapshot,
|
||||
) -> EpiphanyCoordinatorRoleResultStatus {
|
||||
match snapshot.job.status {
|
||||
EpiphanyRuntimeJobStatus::Queued => EpiphanyCoordinatorRoleResultStatus::Pending,
|
||||
EpiphanyRuntimeJobStatus::Running | EpiphanyRuntimeJobStatus::WaitingForReview => {
|
||||
EpiphanyCoordinatorRoleResultStatus::Running
|
||||
}
|
||||
EpiphanyRuntimeJobStatus::Completed if snapshot.result.is_some() => {
|
||||
EpiphanyCoordinatorRoleResultStatus::Completed
|
||||
}
|
||||
EpiphanyRuntimeJobStatus::Completed => EpiphanyCoordinatorRoleResultStatus::Pending,
|
||||
EpiphanyRuntimeJobStatus::Failed => EpiphanyCoordinatorRoleResultStatus::Failed,
|
||||
EpiphanyRuntimeJobStatus::Cancelled => EpiphanyCoordinatorRoleResultStatus::Cancelled,
|
||||
}
|
||||
}
|
||||
|
||||
fn reorient_result_status(snapshot: &EpiphanyRuntimeJobSnapshot) -> EpiphanyCrrcResultStatus {
|
||||
match snapshot.job.status {
|
||||
EpiphanyRuntimeJobStatus::Queued => EpiphanyCrrcResultStatus::Pending,
|
||||
EpiphanyRuntimeJobStatus::Running | EpiphanyRuntimeJobStatus::WaitingForReview => {
|
||||
EpiphanyCrrcResultStatus::Running
|
||||
}
|
||||
EpiphanyRuntimeJobStatus::Completed if snapshot.result.is_some() => {
|
||||
EpiphanyCrrcResultStatus::Completed
|
||||
}
|
||||
EpiphanyRuntimeJobStatus::Completed => EpiphanyCrrcResultStatus::Pending,
|
||||
EpiphanyRuntimeJobStatus::Failed => EpiphanyCrrcResultStatus::Failed,
|
||||
EpiphanyRuntimeJobStatus::Cancelled => EpiphanyCrrcResultStatus::Cancelled,
|
||||
}
|
||||
}
|
||||
|
||||
fn render_role_result_note(
|
||||
role_id: EpiphanyRoleResultRoleId,
|
||||
status: EpiphanyCoordinatorRoleResultStatus,
|
||||
finding: Option<&EpiphanyRoleFindingInterpretation>,
|
||||
item_error: Option<&str>,
|
||||
) -> String {
|
||||
match status {
|
||||
EpiphanyCoordinatorRoleResultStatus::Completed => finding.map_or_else(
|
||||
|| format!("{role_id:?} role specialist completed, but no structured result was recorded."),
|
||||
|finding| {
|
||||
let next = finding.next_safe_move.as_deref().unwrap_or("not supplied");
|
||||
let self_note = render_self_persistence_note(finding.self_persistence.as_ref())
|
||||
.map(|note| format!(" {note}"))
|
||||
.unwrap_or_default();
|
||||
if let Some(error) = finding.item_error.as_deref().or(item_error) {
|
||||
format!("{role_id:?} role specialist completed, but the finding needs repair: {error}. Next safe move: {next}.{self_note}")
|
||||
} else {
|
||||
format!("{role_id:?} role specialist completed. Next safe move: {next}.{self_note}")
|
||||
}
|
||||
},
|
||||
),
|
||||
EpiphanyCoordinatorRoleResultStatus::Failed => item_error
|
||||
.map(|error| format!("{role_id:?} role specialist failed: {error}"))
|
||||
.unwrap_or_else(|| format!("{role_id:?} role specialist failed.")),
|
||||
EpiphanyCoordinatorRoleResultStatus::Cancelled => format!("{role_id:?} role specialist was cancelled before producing a result."),
|
||||
EpiphanyCoordinatorRoleResultStatus::Running => format!("{role_id:?} role specialist is still running."),
|
||||
EpiphanyCoordinatorRoleResultStatus::Pending => format!("{role_id:?} role specialist has not produced a result yet."),
|
||||
EpiphanyCoordinatorRoleResultStatus::MissingState => "No authoritative Epiphany state exists for this thread.".to_string(),
|
||||
EpiphanyCoordinatorRoleResultStatus::MissingBinding => "No matching Epiphany role specialist binding exists.".to_string(),
|
||||
EpiphanyCoordinatorRoleResultStatus::BackendUnavailable => "The bound runtime backend is unavailable.".to_string(),
|
||||
EpiphanyCoordinatorRoleResultStatus::BackendMissing => "The bound runtime backend job or item is missing.".to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
fn render_self_persistence_note(
|
||||
review: Option<&EpiphanyRoleSelfPersistenceReview>,
|
||||
) -> Option<String> {
|
||||
let review = review?;
|
||||
match review.status {
|
||||
EpiphanyRoleSelfPersistenceStatus::Missing => None,
|
||||
EpiphanyRoleSelfPersistenceStatus::Accepted => Some(format!(
|
||||
"Self persistence request is acceptable for {}.",
|
||||
review
|
||||
.target_agent_id
|
||||
.as_deref()
|
||||
.unwrap_or("the role memory file")
|
||||
)),
|
||||
EpiphanyRoleSelfPersistenceStatus::Rejected => Some(format!(
|
||||
"Self persistence request was refused: {}.",
|
||||
if review.reasons.is_empty() {
|
||||
"no reason recorded".to_string()
|
||||
} else {
|
||||
review.reasons.join("; ")
|
||||
}
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
||||
fn render_reorient_result_note(
|
||||
status: EpiphanyCrrcResultStatus,
|
||||
finding: Option<&EpiphanyReorientFindingInterpretation>,
|
||||
item_error: Option<&str>,
|
||||
) -> String {
|
||||
match status {
|
||||
EpiphanyCrrcResultStatus::Completed => finding.map_or_else(
|
||||
|| "Reorientation worker completed, but no structured result was recorded.".to_string(),
|
||||
|finding| {
|
||||
format!(
|
||||
"Reorientation worker completed. Next safe move: {}",
|
||||
finding.next_safe_move.as_deref().unwrap_or("not supplied")
|
||||
)
|
||||
},
|
||||
),
|
||||
EpiphanyCrrcResultStatus::Failed => item_error
|
||||
.map(|error| format!("Reorientation worker failed: {error}"))
|
||||
.unwrap_or_else(|| "Reorientation worker failed.".to_string()),
|
||||
EpiphanyCrrcResultStatus::Cancelled => {
|
||||
"Reorientation worker was cancelled before producing a result.".to_string()
|
||||
}
|
||||
EpiphanyCrrcResultStatus::Running => "Reorientation worker is still running.".to_string(),
|
||||
EpiphanyCrrcResultStatus::Pending => {
|
||||
"Reorientation worker has not produced a result yet.".to_string()
|
||||
}
|
||||
EpiphanyCrrcResultStatus::MissingState => {
|
||||
"No authoritative Epiphany state exists for this thread.".to_string()
|
||||
}
|
||||
EpiphanyCrrcResultStatus::MissingBinding => {
|
||||
"No matching Epiphany reorientation worker binding exists.".to_string()
|
||||
}
|
||||
EpiphanyCrrcResultStatus::BackendUnavailable => {
|
||||
"The bound runtime backend is unavailable.".to_string()
|
||||
}
|
||||
EpiphanyCrrcResultStatus::BackendMissing => {
|
||||
"The bound runtime backend job or item is missing.".to_string()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn nonempty(value: &str) -> Option<String> {
|
||||
(!value.trim().is_empty()).then(|| value.to_string())
|
||||
}
|
||||
|
||||
pub fn apply_coordinator_state_update_to_state(
|
||||
current_state: &EpiphanyThreadState,
|
||||
update: EpiphanyStateUpdate,
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ mod agent_launch;
|
|||
mod agent_memory;
|
||||
mod agent_utterance_state;
|
||||
mod continuity_gateway;
|
||||
mod coordinator_results;
|
||||
mod coordinator_service;
|
||||
mod cultmesh_integration;
|
||||
mod distillation;
|
||||
|
|
@ -119,9 +120,13 @@ pub use agent_utterance_state::AgentUtteranceValue;
|
|||
pub use agent_utterance_state::WEKSA_UTTERANCE_HANDOFF_SCHEMA_VERSION;
|
||||
pub use agent_utterance_state::derive_agent_utterance_state;
|
||||
pub use continuity_gateway::*;
|
||||
pub use coordinator_results::EpiphanyCoordinatorReorientResultSnapshot;
|
||||
pub use coordinator_results::EpiphanyCoordinatorRoleResultSnapshot;
|
||||
pub use coordinator_results::read_reorient_result_snapshot;
|
||||
pub use coordinator_results::read_role_result_snapshot;
|
||||
pub use coordinator_results::read_runtime_reorient_result;
|
||||
pub use coordinator_results::read_runtime_role_result;
|
||||
pub use coordinator_service::EpiphanyCoordinatorAdmissionError;
|
||||
pub use coordinator_service::EpiphanyCoordinatorReorientResultSnapshot;
|
||||
pub use coordinator_service::EpiphanyCoordinatorRoleResultSnapshot;
|
||||
pub use coordinator_service::EpiphanyCoordinatorService;
|
||||
pub use coordinator_service::EpiphanyCoordinatorStateApplied;
|
||||
pub use coordinator_service::EpiphanyReorientAcceptanceUpdate;
|
||||
|
|
@ -132,10 +137,6 @@ pub use coordinator_service::build_native_role_acceptance_update;
|
|||
pub use coordinator_service::completed_reorient_finding;
|
||||
pub use coordinator_service::completed_role_finding;
|
||||
pub use coordinator_service::load_launch_organ_contract;
|
||||
pub use coordinator_service::read_reorient_result_snapshot;
|
||||
pub use coordinator_service::read_role_result_snapshot;
|
||||
pub use coordinator_service::read_runtime_reorient_result;
|
||||
pub use coordinator_service::read_runtime_role_result;
|
||||
pub use cultcache_rs::CacheBackingStore;
|
||||
pub use cultcache_rs::CultCache;
|
||||
pub use cultcache_rs::CultCacheEnvelope;
|
||||
|
|
|
|||
|
|
@ -685,6 +685,13 @@ facade as specified in `notes/native-coordinator-liberation-map.md`. Preserve
|
|||
the landed authority moves, but delete the newborn monolithic shape. A smaller
|
||||
crate address does not make a giant mixed-authority file pure.
|
||||
|
||||
The first corrective split is landed: typed role/reorientation result
|
||||
selection, runtime-spine decoding, lifecycle failure interpretation, and note
|
||||
rendering now live in `epiphany-core/src/coordinator_results.rs`. The mixed
|
||||
service fell from 1,122 to 661 lines; the result organ is 461 lines and remains
|
||||
read-only. Sixteen coordinator-related core tests and all eight bridge tests
|
||||
pass. Split acceptance and state next before resuming authority extraction.
|
||||
|
||||
Bridge identity correction from 2026-06-22: Epiphany owns swarm execution,
|
||||
repo Body work, branch-local lanes, memory, evidence, and Persona cognition.
|
||||
Bifrost owns GameCult identity, governed crossings into GitHub/Discord/Reddit
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -659,4 +659,4 @@ current_status:
|
|||
- Service lifecycle receipt history is now event-only: `load_epiphany_cultmesh_daemon_service_lifecycle_receipts` filters out the `epiphany-local/daemon-service-lifecycle-receipt/latest` mirror, while `load_latest_epiphany_cultmesh_daemon_service_lifecycle_receipt` remains the latest-state reader. Focused unit test `service_lifecycle_receipt_history_excludes_latest_mirror` proves two per-receipt writes return exactly two history records and latest points at the second. Fresh smoke `verse-query-lifecycle-history-filter-smoke` and live overview/triage `local-20260618-145632-497-efac6f0d` / `local-20260618-145632-321-867947af` prove compact swarm sights still expose service lifecycle attention plus the present elevated runbook artifact without daemon pokes or service mutation. Do not use a broad unscoped cargo test filter for this check on Windows; it fans out across bin harnesses and hit a broken pipe during this pass.
|
||||
- `epiphany-verse-query seed-compact` is the compact seed receipt for wrappers and read-only rites. The older `seed` command still prints the full local Verse context for explicit debugging, but compact wrapper modes now avoid full `seed`/final `query` readback after the combined overview proof exposed Windows debug stack overflow from full-context serialization pressure.
|
||||
last_completed_repo_swarm_cut: Huginn live-fire has crossed the first real repo Body from Persona pressure to branch-local Hands commit and Soul/Mind closure, and now has repeatable closure and redacted-public-proof mouths. On `E:\Projects\Huginn` branch `epiphany/huginn/first-awakening`, `tools/epiphany_local_run.ps1 -Mode repo-persona-intake` accepted item `huginn-inspection-readback-livefire`, Weksa/Persona intake remained sealed, and `epiphany-work derive-plan` lowered it to model-authored safe family `repo.status_section` for `README.md` only. `tools/epiphany_local_run.ps1 -Mode repo-swarm-run` advanced four bounded pulses: run-from-plan, adopt-from-plan, execute-from-plan, and close-from-execute. Huginn commit `e9b07c38fceabbdc89ea35c2156326c80c0393a2` updated only `README.md`; closure receipt `.epiphany\work\work-close-huginn-inspection-readback-livefire.json` records status `closed`, Soul verdict `passed`, Mind state commit `repo-work-close-huginn-inspection-readback-livefire-mind-commit`, safe family `repo.status_section`, path scope `README.md`, Bifrost publication gate, and `privateStateExposed=false`. Verification also ran Huginn's TypeScript compiler through concrete Node path: `C:\Program Files\nodejs\node.exe E:\Projects\Huginn\node_modules\typescript\bin\tsc -p tsconfig.json` passed. Native verifier `epiphany-repo-livefire-closure-smoke --workspace E:\Projects\Huginn --item huginn-inspection-readback-livefire --expected-path README.md --expected-family repo.status_section --expected-gate awaiting-publication --expected-blocker bifrost-publication-missing` checks closure receipt, Mind map entry, overview gate/blocker, authority seals, and `git show` changed paths, returning `status=ok`, `soulVerdict=passed`, `publicationGate=Bifrost`, and `privateStateExposed=false`. Wrapper `tools/epiphany_local_run.ps1 -Mode repo-livefire-closure -Workspace E:\Projects\Huginn -RepoWorkItem huginn-inspection-readback-livefire -SkipBuild` exposes the same read-only proof through the local operator mouth; artifact `local-20260621-190156-803-2f85ba15` printed commit, path, gate, blocker, Soul verdict, Mind commit receipt, and `privateStateExposed=False` without push, merge, publication, or target mutation. New wrapper `tools/epiphany_local_run.ps1 -Mode repo-work-public-proof -Workspace E:\Projects\Huginn -RepoWorkItem huginn-inspection-readback-livefire -SkipBuild` exports the redacted proof bundle and repo-local Verse index without publishing; artifact `local-20260621-190645-345-4555b1dc` wrote `.epiphany\public\proof-bundles\repo-work-public-proof-huginn-inspection-readback-livefire.json`, proof id `repo-work-public-proof-huginn-inspection-readback-livefire`, SHA-256 `857545b199f3e37eb06c2e757e5cfc201958e46667bb1f8403fd333a22620f63`, nine artifact rows, zero publication rows, and `privateStateExposed=False`. Gjallar readback `local-20260621-190701-140-b9519ec6` sees the `REPO-WORK-PUBLIC-PROOF` row and action row from Huginn's repo-local Verse with the same SHA-256 while Bifrost publication remains missing. Launcher compact modes are now named compact operator-context modes instead of read-only modes, and `bifrost-public-proof` summaries print item, target public Verse, room, proof SHA-256, review receipts, and credit receipts so publication receipts are auditable without claiming upstream sync.
|
||||
next_action: Split the 1,122-line `epiphany-core/src/coordinator_service.rs` into narrow state, result, acceptance, launch, and projection organs behind a policy-free coordinator facade, following `notes/native-coordinator-liberation-map.md`. Preserve the landed native authority and bridge delegation, but do not move more bridge logic into the monolith. After the split is verified, resume receipt persistence/proof enforcement extraction, rewire `epiphany-mvp-coordinator`, and demote `thread/epiphany/*` JSON-RPC to compatibility wrappers.
|
||||
next_action: Continue the native coordinator anatomy split defined in `notes/native-coordinator-liberation-map.md`. Result readback now lives in `coordinator_results.rs` and the mixed service fell from 1,122 to 661 lines. Extract acceptance and state into narrow organs, leave a policy-free facade, then resume receipt persistence/proof enforcement extraction and remove `thread/epiphany/*` JSON-RPC from `epiphany-mvp-coordinator`.
|
||||
|
|
|
|||
Reference in a new issue