Collapse semantic state contracts into core
This commit is contained in:
parent
3421af57a4
commit
07529fb521
20 changed files with 99 additions and 300 deletions
|
|
@ -3406,7 +3406,7 @@ fn resolve_body_modeling_work(
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use epiphany_state_model::{
|
||||
use crate::state_model::{
|
||||
EpiphanyMemoryDomain, EpiphanyMemoryLifecycle, EpiphanyMemoryNode, EpiphanyMemoryNodeKind,
|
||||
RepoFrontierItem, RepoFrontierStatus,
|
||||
};
|
||||
|
|
@ -5792,12 +5792,12 @@ mod tests {
|
|||
research_cache.put(&research_context.context_id, &research_context)?;
|
||||
let stale_research_store = temp.path().join("stale-research-output.cc");
|
||||
std::fs::copy(&store, &stale_research_store)?;
|
||||
let evidence = epiphany_state_model::EpiphanyEvidenceRecord {
|
||||
let evidence = crate::EpiphanyEvidenceRecord {
|
||||
id: "research-evidence-1".into(),
|
||||
kind: "external-source".into(),
|
||||
status: "ok".into(),
|
||||
summary: "The bounded external claim is supported.".into(),
|
||||
code_refs: vec![epiphany_state_model::EpiphanyCodeRef {
|
||||
code_refs: vec![crate::EpiphanyCodeRef {
|
||||
path: "epiphany-core/src/current_work.rs".into(),
|
||||
start_line: Some(1),
|
||||
end_line: None,
|
||||
|
|
@ -5805,7 +5805,7 @@ mod tests {
|
|||
note: None,
|
||||
}],
|
||||
};
|
||||
let observation = epiphany_state_model::EpiphanyObservation {
|
||||
let observation = crate::EpiphanyObservation {
|
||||
id: "research-observation-1".into(),
|
||||
summary: "External evidence answers the exact frontier question.".into(),
|
||||
source_kind: "research".into(),
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ mod runtime_spine;
|
|||
mod runtime_store_backend;
|
||||
mod runtime_worker_attempt;
|
||||
mod soul_gateway;
|
||||
mod state_model;
|
||||
mod state_ledger;
|
||||
mod substrate_gate;
|
||||
mod surfaces;
|
||||
|
|
@ -99,11 +100,6 @@ pub use cultmesh_integration::{
|
|||
};
|
||||
|
||||
pub use current_work::*;
|
||||
pub use epiphany_state_model::EpiphanyMemoryAnchor;
|
||||
pub use epiphany_state_model::EpiphanyMemoryDomain;
|
||||
pub use epiphany_state_model::EpiphanyMemoryEdge;
|
||||
pub use epiphany_state_model::EpiphanyMemoryLifecycle;
|
||||
pub use epiphany_state_model::EpiphanyMemoryNode;
|
||||
pub use hands_gateway::*;
|
||||
pub use idunn_provider_health::{
|
||||
EPIPHANY_IDUNN_PROVIDER_HEALTH_ADMISSION_SCHEMA, EPIPHANY_IDUNN_PROVIDER_HEALTH_ADMISSION_TYPE,
|
||||
|
|
@ -133,13 +129,7 @@ pub use imagination_consideration::{
|
|||
validate_candidate as validate_imagination_consideration_candidate,
|
||||
validate_current_request as validate_current_imagination_consideration_request,
|
||||
};
|
||||
pub use memory_graph::EpiphanyMemoryEdgeKind;
|
||||
pub use memory_graph::EpiphanyMemoryGraphSnapshot;
|
||||
pub use memory_graph::EpiphanyMemoryGraphValidationError;
|
||||
pub use memory_graph::EpiphanyMemoryNodeKind;
|
||||
pub use memory_graph::RepoFrontierAdoptedPlan;
|
||||
pub use memory_graph::RepoFrontierItem;
|
||||
pub use memory_graph::RepoFrontierStatus;
|
||||
pub use memory_graph::validate_memory_graph_snapshot;
|
||||
pub use mind_documents::*;
|
||||
pub use packaged_release::{
|
||||
|
|
@ -301,6 +291,7 @@ pub use runtime_spine::select_and_commit_repo_frontier_route;
|
|||
pub use runtime_spine::terminalize_model_pass_failure_session;
|
||||
pub(crate) use runtime_worker_attempt::{RuntimeTypedRequestRef, WorkerProcessStatus};
|
||||
pub use soul_gateway::*;
|
||||
pub use state_model::*;
|
||||
pub use state_ledger::EpiphanyBranchRecord;
|
||||
pub use state_ledger::EpiphanyLedgerEvidenceRecord;
|
||||
pub use state_ledger::EpiphanyStateLedgerEntry;
|
||||
|
|
|
|||
|
|
@ -1,16 +1,5 @@
|
|||
pub mod validation;
|
||||
|
||||
pub use epiphany_state_model::EpiphanyMemoryDomain;
|
||||
pub use epiphany_state_model::EpiphanyMemoryEdge;
|
||||
pub use epiphany_state_model::EpiphanyMemoryEdgeKind;
|
||||
pub use epiphany_state_model::EpiphanyMemoryGraphSnapshot;
|
||||
pub use epiphany_state_model::EpiphanyMemoryLifecycle;
|
||||
pub use epiphany_state_model::EpiphanyMemoryNode;
|
||||
pub use epiphany_state_model::EpiphanyMemoryNodeKind;
|
||||
pub use epiphany_state_model::RepoFrontierAdoptedPlan;
|
||||
pub use epiphany_state_model::RepoFrontierItem;
|
||||
pub use epiphany_state_model::RepoFrontierStatus;
|
||||
|
||||
pub use validation::EpiphanyMemoryGraphValidationError;
|
||||
pub(crate) use validation::frontier_item_has_routeable_repository_scope;
|
||||
pub(crate) use validation::repo_paths_are_canonical_and_safe;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use super::EpiphanyMemoryDomain;
|
||||
use super::EpiphanyMemoryEdge;
|
||||
use super::EpiphanyMemoryGraphSnapshot;
|
||||
use super::EpiphanyMemoryLifecycle;
|
||||
use super::EpiphanyMemoryNode;
|
||||
use super::RepoFrontierStatus;
|
||||
use crate::EpiphanyMemoryDomain;
|
||||
use crate::EpiphanyMemoryEdge;
|
||||
use crate::EpiphanyMemoryGraphSnapshot;
|
||||
use crate::EpiphanyMemoryLifecycle;
|
||||
use crate::EpiphanyMemoryNode;
|
||||
use crate::RepoFrontierStatus;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
pub(crate) fn repo_paths_are_canonical_and_safe(paths: &[String]) -> bool {
|
||||
|
|
@ -23,7 +23,7 @@ pub(crate) fn repo_paths_are_canonical_and_safe(paths: &[String]) -> bool {
|
|||
}
|
||||
|
||||
pub(crate) fn frontier_item_has_routeable_repository_scope(
|
||||
item: &epiphany_state_model::RepoFrontierItem,
|
||||
item: &crate::RepoFrontierItem,
|
||||
) -> bool {
|
||||
!item.repository_scope.is_empty() && repo_paths_are_canonical_and_safe(&item.repository_scope)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use std::path::Path;
|
|||
|
||||
use anyhow::{Result, anyhow};
|
||||
use cultcache_rs::{CultCache, CultCacheEnvelope, DatabaseEntry};
|
||||
use epiphany_state_model::{
|
||||
use crate::state_model::{
|
||||
EpiphanyEvidenceRecord, EpiphanyInvariant, EpiphanyInvestigationCheckpoint,
|
||||
EpiphanyModeState, EpiphanyObservation, EpiphanySubgoal,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -68,10 +68,10 @@ impl From<EpiphanyRoleWorkerLaunchDocument> for EpiphanyRolePassAuthorityProject
|
|||
pub struct EpiphanyRepoModelPromptProjection {
|
||||
pub identity: crate::EpiphanyRepoModelIdentityDocument,
|
||||
pub projection_digest: String,
|
||||
pub domains: Vec<epiphany_state_model::EpiphanyMemoryDomain>,
|
||||
pub nodes: Vec<epiphany_state_model::EpiphanyMemoryNode>,
|
||||
pub edges: Vec<epiphany_state_model::EpiphanyMemoryEdge>,
|
||||
pub frontier: Vec<epiphany_state_model::RepoFrontierItem>,
|
||||
pub domains: Vec<crate::EpiphanyMemoryDomain>,
|
||||
pub nodes: Vec<crate::EpiphanyMemoryNode>,
|
||||
pub edges: Vec<crate::EpiphanyMemoryEdge>,
|
||||
pub frontier: Vec<crate::RepoFrontierItem>,
|
||||
pub claim_obligations: Vec<crate::EpiphanyRepoModelClaimObligationsDocument>,
|
||||
pub surface_offers: Vec<crate::AtlasSurfaceOffer>,
|
||||
pub dependency_claims: Vec<crate::AtlasDependencyClaim>,
|
||||
|
|
@ -104,16 +104,16 @@ pub struct EpiphanyMindPromptProjection {
|
|||
pub projection_digest: String,
|
||||
pub objective: Option<String>,
|
||||
pub active_subgoal_id: Option<String>,
|
||||
pub subgoals: Vec<epiphany_state_model::EpiphanySubgoal>,
|
||||
pub invariants: Vec<epiphany_state_model::EpiphanyInvariant>,
|
||||
pub observations: Vec<epiphany_state_model::EpiphanyObservation>,
|
||||
pub evidence: Vec<epiphany_state_model::EpiphanyEvidenceRecord>,
|
||||
pub subgoals: Vec<crate::EpiphanySubgoal>,
|
||||
pub invariants: Vec<crate::EpiphanyInvariant>,
|
||||
pub observations: Vec<crate::EpiphanyObservation>,
|
||||
pub evidence: Vec<crate::EpiphanyEvidenceRecord>,
|
||||
pub verification_audits: Vec<crate::EpiphanyMindVerificationAuditDocument>,
|
||||
pub reorientation_decisions: Vec<crate::EpiphanyMindReorientationDecisionDocument>,
|
||||
pub reorientation_failures: Vec<crate::EpiphanyMindReorientationPassFailureDocument>,
|
||||
pub agent_pass_admission_refusals: Vec<crate::EpiphanyAgentPassAdmissionRefusal>,
|
||||
pub investigation_checkpoint: Option<epiphany_state_model::EpiphanyInvestigationCheckpoint>,
|
||||
pub mode: Option<epiphany_state_model::EpiphanyModeState>,
|
||||
pub investigation_checkpoint: Option<crate::EpiphanyInvestigationCheckpoint>,
|
||||
pub mode: Option<crate::EpiphanyModeState>,
|
||||
pub repository_body_observation: Option<crate::RepositoryBodyObservationBasis>,
|
||||
pub repo_model: Option<EpiphanyRepoModelPromptProjection>,
|
||||
}
|
||||
|
|
@ -2627,7 +2627,7 @@ mod tests {
|
|||
let make = |key: &str, summary: &str| -> Result<CultCacheEnvelope> {
|
||||
let cache = runtime_spine_cache(&store)?;
|
||||
let document = crate::EpiphanyMindObservationDocument {
|
||||
value: epiphany_state_model::EpiphanyObservation {
|
||||
value: crate::EpiphanyObservation {
|
||||
id: key.into(),
|
||||
summary: summary.into(),
|
||||
source_kind: "test".into(),
|
||||
|
|
|
|||
|
|
@ -19,10 +19,10 @@ pub struct EpiphanyReorientationStateProjection {
|
|||
pub runtime_id: String,
|
||||
pub objective: Option<String>,
|
||||
pub active_subgoal_id: Option<String>,
|
||||
pub investigation_checkpoint: Option<epiphany_state_model::EpiphanyInvestigationCheckpoint>,
|
||||
pub mode: Option<epiphany_state_model::EpiphanyModeState>,
|
||||
pub investigation_checkpoint: Option<crate::EpiphanyInvestigationCheckpoint>,
|
||||
pub mode: Option<crate::EpiphanyModeState>,
|
||||
pub repository_body_observation: Option<crate::RepositoryBodyObservationBasis>,
|
||||
pub frontier: Vec<epiphany_state_model::RepoFrontierItem>,
|
||||
pub frontier: Vec<crate::RepoFrontierItem>,
|
||||
pub projection_digest: String,
|
||||
}
|
||||
|
||||
|
|
@ -1060,7 +1060,7 @@ mod tests {
|
|||
cache.put(
|
||||
"unrelated-observation",
|
||||
&crate::EpiphanyMindObservationDocument {
|
||||
value: epiphany_state_model::EpiphanyObservation {
|
||||
value: crate::EpiphanyObservation {
|
||||
id: "unrelated-observation".into(),
|
||||
summary: "Persona observed an unrelated social fact.".into(),
|
||||
..Default::default()
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use std::path::Path;
|
|||
|
||||
use anyhow::{Result, anyhow};
|
||||
use cultcache_rs::{CultCache, CultCacheEnvelope, DatabaseEntry};
|
||||
use epiphany_state_model::{
|
||||
use crate::state_model::{
|
||||
EpiphanyMemoryDomain, EpiphanyMemoryEdge, EpiphanyMemoryGraphSnapshot, EpiphanyMemoryNode,
|
||||
RepoFrontierItem,
|
||||
};
|
||||
|
|
@ -835,7 +835,7 @@ pub fn plan_repo_model_mutation(
|
|||
{
|
||||
insert_strong_envelope(&mut strong, existing)?;
|
||||
}
|
||||
node.lifecycle = epiphany_state_model::EpiphanyMemoryLifecycle::Retired;
|
||||
node.lifecycle = crate::EpiphanyMemoryLifecycle::Retired;
|
||||
nodes.insert(node_id.clone(), node.clone());
|
||||
insert_envelope(
|
||||
&mut writes,
|
||||
|
|
@ -879,7 +879,7 @@ pub fn plan_repo_model_mutation(
|
|||
.get_envelope::<EpiphanyRepoModelEdgeDocument>(edge_id)?
|
||||
.ok_or_else(|| anyhow!("RepoModel edge lost its envelope"))?;
|
||||
insert_strong_envelope(&mut strong, existing)?;
|
||||
edge.lifecycle = epiphany_state_model::EpiphanyMemoryLifecycle::Retired;
|
||||
edge.lifecycle = crate::EpiphanyMemoryLifecycle::Retired;
|
||||
edges.insert(edge_id.clone(), edge.clone());
|
||||
insert_envelope(
|
||||
&mut writes,
|
||||
|
|
@ -1319,9 +1319,9 @@ fn require_semantic_id(value: &str, label: &str) -> Result<()> {
|
|||
fn frontier_is_unresolved(item: &RepoFrontierItem) -> bool {
|
||||
matches!(
|
||||
item.status,
|
||||
epiphany_state_model::RepoFrontierStatus::Proposed
|
||||
| epiphany_state_model::RepoFrontierStatus::Active
|
||||
| epiphany_state_model::RepoFrontierStatus::Blocked
|
||||
crate::RepoFrontierStatus::Proposed
|
||||
| crate::RepoFrontierStatus::Active
|
||||
| crate::RepoFrontierStatus::Blocked
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -1509,9 +1509,9 @@ fn validate_claim_obligations(
|
|||
if !item.target_claim_ids.contains(&obligation.node_id)
|
||||
|| !matches!(
|
||||
item.status,
|
||||
epiphany_state_model::RepoFrontierStatus::Proposed
|
||||
| epiphany_state_model::RepoFrontierStatus::Active
|
||||
| epiphany_state_model::RepoFrontierStatus::Blocked
|
||||
crate::RepoFrontierStatus::Proposed
|
||||
| crate::RepoFrontierStatus::Active
|
||||
| crate::RepoFrontierStatus::Blocked
|
||||
)
|
||||
{
|
||||
return Err(anyhow!("RepoModel claim obligation is not live"));
|
||||
|
|
@ -1521,9 +1521,9 @@ fn validate_claim_obligations(
|
|||
for item in frontier.iter().filter(|item| {
|
||||
matches!(
|
||||
item.status,
|
||||
epiphany_state_model::RepoFrontierStatus::Proposed
|
||||
| epiphany_state_model::RepoFrontierStatus::Active
|
||||
| epiphany_state_model::RepoFrontierStatus::Blocked
|
||||
crate::RepoFrontierStatus::Proposed
|
||||
| crate::RepoFrontierStatus::Active
|
||||
| crate::RepoFrontierStatus::Blocked
|
||||
)
|
||||
}) {
|
||||
for node_id in &item.target_claim_ids {
|
||||
|
|
@ -1542,7 +1542,7 @@ fn validate_claim_obligations(
|
|||
mod tests {
|
||||
use super::*;
|
||||
use crate::{RuntimeSpineInitOptions, initialize_runtime_spine};
|
||||
use epiphany_state_model::{
|
||||
use crate::state_model::{
|
||||
EpiphanyMemoryEdgeKind, EpiphanyMemoryLifecycle, EpiphanyMemoryNodeKind, RepoFrontierStatus,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -418,7 +418,7 @@ pub struct RepoFrontierRoute {
|
|||
#[cultcache(key = 11)]
|
||||
pub authorized_paths: Vec<String>,
|
||||
#[cultcache(key = 12, default)]
|
||||
pub adopted_plan: Option<epiphany_state_model::RepoFrontierAdoptedPlan>,
|
||||
pub adopted_plan: Option<crate::RepoFrontierAdoptedPlan>,
|
||||
#[cultcache(key = 13)]
|
||||
pub selected_at: String,
|
||||
}
|
||||
|
|
|
|||
320
epiphany-core/src/state_model.rs
Normal file
320
epiphany-core/src/state_model.rs
Normal file
|
|
@ -0,0 +1,320 @@
|
|||
//! Core-owned semantic state contracts.
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Default)]
|
||||
pub struct EpiphanySubgoal {
|
||||
pub id: String,
|
||||
pub title: String,
|
||||
pub status: String,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub summary: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Default)]
|
||||
pub struct EpiphanyInvariant {
|
||||
pub id: String,
|
||||
pub description: String,
|
||||
pub status: String,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub rationale: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Default)]
|
||||
pub struct EpiphanyCodeRef {
|
||||
pub path: PathBuf,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub start_line: Option<u32>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub end_line: Option<u32>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub symbol: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub note: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialEq, Eq, Default)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum EpiphanyInvestigationDisposition {
|
||||
#[default]
|
||||
ResumeReady,
|
||||
RegatherRequired,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Default)]
|
||||
pub struct EpiphanyInvestigationCheckpoint {
|
||||
pub checkpoint_id: String,
|
||||
pub kind: String,
|
||||
pub disposition: EpiphanyInvestigationDisposition,
|
||||
pub focus: String,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub summary: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub next_action: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub captured_at_turn_id: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub open_questions: Vec<String>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub code_refs: Vec<EpiphanyCodeRef>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub evidence_ids: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Default)]
|
||||
pub struct EpiphanyObservation {
|
||||
pub id: String,
|
||||
pub summary: String,
|
||||
pub source_kind: String,
|
||||
pub status: String,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub code_refs: Vec<EpiphanyCodeRef>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub evidence_ids: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Default)]
|
||||
pub struct EpiphanyEvidenceRecord {
|
||||
pub id: String,
|
||||
pub kind: String,
|
||||
pub status: String,
|
||||
pub summary: String,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub code_refs: Vec<EpiphanyCodeRef>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Default)]
|
||||
pub struct EpiphanyModeState {
|
||||
pub name: String,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub kind: Option<EpiphanyModeKind>,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Serialize, Deserialize, Clone, Copy, Debug, PartialEq, Eq, Hash, Default,
|
||||
)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum EpiphanyModeKind {
|
||||
Plan,
|
||||
#[default]
|
||||
#[serde(
|
||||
alias = "code",
|
||||
alias = "pair_programming",
|
||||
alias = "execute",
|
||||
alias = "custom"
|
||||
)]
|
||||
Default,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Default)]
|
||||
pub struct EpiphanyMemoryGraphSnapshot {
|
||||
pub graph_id: String,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub domains: Vec<EpiphanyMemoryDomain>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub nodes: Vec<EpiphanyMemoryNode>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub edges: Vec<EpiphanyMemoryEdge>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub frontier: Vec<RepoFrontierItem>,
|
||||
}
|
||||
|
||||
/// A durable piece of unfinished repository anatomy. This is Modeling-owned state,
|
||||
/// not a scheduler job or a presentation card.
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Default)]
|
||||
pub struct RepoFrontierItem {
|
||||
pub id: String,
|
||||
pub migration_body: String,
|
||||
pub question: String,
|
||||
pub gap: String,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub target_claim_ids: Vec<String>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
/// Canonical repository-relative path ceiling for this wound. This is the
|
||||
/// scope that downstream Planning may narrow and Hands may eventually
|
||||
/// change; inspected files and evidence provenance belong elsewhere.
|
||||
pub repository_scope: Vec<String>,
|
||||
pub recommended_next_organ: String,
|
||||
/// The exact plan admitted by Mind for this frontier item. Imagination may
|
||||
/// propose this payload, but only the dedicated model transition may make
|
||||
/// it part of Modeling-owned truth.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub adopted_plan: Option<RepoFrontierAdoptedPlan>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub dependency_item_ids: Vec<String>,
|
||||
#[serde(default)]
|
||||
pub status: RepoFrontierStatus,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub evidence_refs: Vec<String>,
|
||||
/// Exact immutable public sources selected upstream for Eyes. These are
|
||||
/// causal retrieval inputs, not evidence produced by Modeling.
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub public_source_refs: Vec<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub created_at: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub updated_at: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub retired_at: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub superseded_by: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Default)]
|
||||
pub struct RepoFrontierAdoptedPlan {
|
||||
pub planning_request_id: String,
|
||||
pub result_id: String,
|
||||
pub job_id: String,
|
||||
pub candidate_id: String,
|
||||
pub candidate_sha256: String,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub safe_paths: Vec<String>,
|
||||
pub action: String,
|
||||
pub command: String,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub checks: Vec<String>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub stop_conditions: Vec<String>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub rollback_steps: Vec<String>,
|
||||
pub commit_message: String,
|
||||
}
|
||||
|
||||
impl RepoFrontierAdoptedPlan {
|
||||
pub fn effective_action(&self) -> &str {
|
||||
self.action.as_str()
|
||||
}
|
||||
|
||||
pub fn effective_command(&self) -> &str {
|
||||
self.command.as_str()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialEq, Eq, Default)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum RepoFrontierStatus {
|
||||
#[default]
|
||||
Proposed,
|
||||
Active,
|
||||
Blocked,
|
||||
Resolved,
|
||||
Retired,
|
||||
Superseded,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Default)]
|
||||
pub struct EpiphanyMemoryDomain {
|
||||
pub id: String,
|
||||
pub title: String,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub description: Option<String>,
|
||||
#[serde(default)]
|
||||
pub lifecycle: EpiphanyMemoryLifecycle,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Serialize, Deserialize, Clone, Copy, Debug, PartialEq, Eq, Hash, Default,
|
||||
)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum EpiphanyMemoryLifecycle {
|
||||
#[default]
|
||||
Observed,
|
||||
Proposed,
|
||||
Accepted,
|
||||
Retired,
|
||||
Stale,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Serialize, Deserialize, Clone, Copy, Debug, PartialEq, Eq, Hash, Default,
|
||||
)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum EpiphanyMemoryNodeKind {
|
||||
#[default]
|
||||
Domain,
|
||||
Module,
|
||||
Crate,
|
||||
Binary,
|
||||
Schema,
|
||||
RuntimeContract,
|
||||
Adapter,
|
||||
TestSeam,
|
||||
StateStore,
|
||||
Summary,
|
||||
Other,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Default)]
|
||||
pub struct EpiphanyMemoryNode {
|
||||
pub id: String,
|
||||
pub domain_id: String,
|
||||
pub kind: EpiphanyMemoryNodeKind,
|
||||
pub title: String,
|
||||
pub claim: String,
|
||||
pub question: String,
|
||||
pub tension: String,
|
||||
pub action_implication: String,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub anchors: Vec<EpiphanyMemoryAnchor>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub source_hashes: Vec<String>,
|
||||
#[serde(default)]
|
||||
pub lifecycle: EpiphanyMemoryLifecycle,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub created_at: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub updated_at: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Serialize, Deserialize, Clone, Copy, Debug, PartialEq, Eq, Hash, Default,
|
||||
)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum EpiphanyMemoryEdgeKind {
|
||||
#[default]
|
||||
Owns,
|
||||
Reads,
|
||||
Writes,
|
||||
Derives,
|
||||
Adapts,
|
||||
Persists,
|
||||
Launches,
|
||||
Verifies,
|
||||
Supports,
|
||||
Contradicts,
|
||||
Grounds,
|
||||
Triggers,
|
||||
DependsOn,
|
||||
Other,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Default)]
|
||||
pub struct EpiphanyMemoryEdge {
|
||||
pub id: String,
|
||||
pub source_id: String,
|
||||
pub target_id: String,
|
||||
pub kind: EpiphanyMemoryEdgeKind,
|
||||
pub claim: String,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub anchors: Vec<EpiphanyMemoryAnchor>,
|
||||
#[serde(default)]
|
||||
pub lifecycle: EpiphanyMemoryLifecycle,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Default)]
|
||||
pub struct EpiphanyMemoryAnchor {
|
||||
pub id: String,
|
||||
pub kind: String,
|
||||
pub target: String,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub code_ref: Option<EpiphanyCodeRef>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub evidence_id: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub source_hash: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub note: Option<String>,
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
use anyhow::{Result, anyhow};
|
||||
use epiphany_state_model::EpiphanyEvidenceRecord;
|
||||
use epiphany_state_model::EpiphanyInvestigationCheckpoint;
|
||||
use epiphany_state_model::EpiphanyObservation;
|
||||
use crate::state_model::EpiphanyEvidenceRecord;
|
||||
use crate::state_model::EpiphanyInvestigationCheckpoint;
|
||||
use crate::state_model::EpiphanyObservation;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::BTreeSet;
|
||||
|
||||
|
|
|
|||
Reference in a new issue