Bind autonomous proposals to organizational Mind
This commit is contained in:
parent
36f687eaa3
commit
fc7336759d
13 changed files with 1198 additions and 43 deletions
|
|
@ -211,6 +211,10 @@ pub fn validate_result(
|
|||
request: &AdmittedModelDirectionConsiderationRequest,
|
||||
result: &AdmittedModelDirectionConsiderationResult,
|
||||
) -> Result<()> {
|
||||
let requested_at = chrono::DateTime::parse_from_rfc3339(&request.requested_at)
|
||||
.map_err(|_| anyhow!("model direction request timestamp must be RFC3339"))?;
|
||||
let proposed_at = chrono::DateTime::parse_from_rfc3339(&result.proposed_at)
|
||||
.map_err(|_| anyhow!("model direction result timestamp must be RFC3339"))?;
|
||||
if result.schema_version != RESULT_SCHEMA
|
||||
|| result.contract != RESULT_CONTRACT
|
||||
|| !result.proposal_only
|
||||
|
|
@ -223,7 +227,7 @@ pub fn validate_result(
|
|||
|| result.model_admission_receipt_id != request.model_admission_receipt_id
|
||||
|| result.result_id.trim().is_empty()
|
||||
|| result.summary.trim().is_empty()
|
||||
|| chrono::DateTime::parse_from_rfc3339(&result.proposed_at).is_err()
|
||||
|| proposed_at < requested_at
|
||||
{
|
||||
bail!("model direction result substituted causal identity");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,11 +46,14 @@ fn main() -> Result<()> {
|
|||
bail!("fixture requires exact public, organization, and private feedback classes");
|
||||
}
|
||||
|
||||
bind_runtime_repository_domain(&runtime_store, "GameCult/Epiphany", "2026-07-18T00:00:00Z")?;
|
||||
let inserted = ingest_resident_self_domain_pressure(
|
||||
&resident_store,
|
||||
&runtime_store,
|
||||
&feedback_store,
|
||||
"epiphany-yggdrasil",
|
||||
"GameCult/Epiphany",
|
||||
runtime_store.parent().unwrap().to_str().unwrap(),
|
||||
1_752_796_800_000,
|
||||
)?;
|
||||
if inserted < admitted.len() {
|
||||
|
|
|
|||
|
|
@ -5,11 +5,12 @@ use epiphany_core::{
|
|||
ProcessInstanceObservation, ResidentProviderReadiness, ResidentReadinessRequest,
|
||||
ResidentSelfOutcome, ResidentSelfPolicy, ResidentSelfPorts, ResidentSelfPressure,
|
||||
ResidentSelfState, acknowledge_resident_self_launch, authenticate_resident_self_policy,
|
||||
cancel_resident_self_turn, capture_process_instance, complete_resident_self_turn,
|
||||
coordinator_run_receipts, derive_resident_cognition_readiness, enqueue_resident_self_pressure,
|
||||
import_bifrost_persona_feedback_deliveries, ingest_resident_self_domain_pressure,
|
||||
load_epiphany_cultmesh_swarm_brake, load_resident_self_state, observe_process_instance,
|
||||
prepare_resident_self_launch, publish_resident_provider_readiness, resident_self_child_claim,
|
||||
bind_runtime_repository_domain, cancel_resident_self_turn, capture_process_instance,
|
||||
complete_resident_self_turn, coordinator_run_receipts, derive_resident_cognition_readiness,
|
||||
enqueue_resident_self_pressure, import_bifrost_persona_feedback_deliveries,
|
||||
ingest_resident_self_domain_pressure, load_epiphany_cultmesh_swarm_brake,
|
||||
load_resident_self_state, observe_process_instance, prepare_resident_self_launch,
|
||||
publish_resident_provider_readiness, resident_self_child_claim,
|
||||
resident_self_local_provider_status, terminate_process_instance,
|
||||
validate_bifrost_persona_feedback_source, validate_persona_feedback_store_separation,
|
||||
validate_resident_self_store_separation,
|
||||
|
|
@ -152,11 +153,18 @@ fn cycle(
|
|||
&args.feedback_target_repository,
|
||||
&args.feedback_target_persona,
|
||||
)?;
|
||||
bind_runtime_repository_domain(
|
||||
&args.policy.runtime_store,
|
||||
&args.feedback_target_repository,
|
||||
&Utc::now().to_rfc3339(),
|
||||
)?;
|
||||
ingest_resident_self_domain_pressure(
|
||||
&args.state_store,
|
||||
&args.policy.runtime_store,
|
||||
&args.persona_feedback_store,
|
||||
&args.policy.release_runtime_id,
|
||||
&args.feedback_target_repository,
|
||||
&args.policy.workspace.display().to_string(),
|
||||
now,
|
||||
)?;
|
||||
*state = load_resident_self_state(&args.state_store)?;
|
||||
|
|
|
|||
|
|
@ -965,6 +965,9 @@ fn validate_proposal_modeling_launch(
|
|||
.get::<RepoFrontierWorkProposal>(&selection.proposal_id)?
|
||||
.ok_or_else(|| anyhow!("proposal Modeling selection references a missing proposal"))?;
|
||||
crate::runtime_spine::validate_repo_frontier_work_proposal(&proposal)?;
|
||||
if proposal.source_kind == crate::RepoFrontierProposalSourceKind::Imagination {
|
||||
crate::runtime_spine::validate_autonomous_proposal_binding(cache, &proposal)?;
|
||||
}
|
||||
if cache
|
||||
.get_all::<RepoFrontierProposalModelingLaunchBinding>()?
|
||||
.iter()
|
||||
|
|
|
|||
|
|
@ -937,6 +937,7 @@ pub use runtime_spine::RuntimeSpineJobOptions;
|
|||
pub use runtime_spine::RuntimeSpineJobResultOptions;
|
||||
pub use runtime_spine::RuntimeSpineSessionOptions;
|
||||
pub use runtime_spine::append_runtime_event;
|
||||
pub use runtime_spine::bind_runtime_repository_domain;
|
||||
pub use runtime_spine::bind_runtime_to_agent_memory_swarm;
|
||||
pub use runtime_spine::canonical_repo_frontier_plan_candidate_id;
|
||||
pub use runtime_spine::clear_epiphany_job_binding_backend;
|
||||
|
|
@ -959,6 +960,7 @@ pub use runtime_spine::migrate_legacy_repo_model_projection_obligation;
|
|||
pub use runtime_spine::open_runtime_spine_heartbeat_job;
|
||||
pub use runtime_spine::plan_runtime_spine_heartbeat_launch;
|
||||
pub use runtime_spine::prepare_runtime_spine_heartbeat_job;
|
||||
pub use runtime_spine::promote_autonomous_direction_options_for_modeling;
|
||||
pub use runtime_spine::put_continuity_recovery_receipt;
|
||||
pub use runtime_spine::put_coordinator_run_receipt;
|
||||
pub use runtime_spine::put_eyes_evidence_packet;
|
||||
|
|
|
|||
|
|
@ -39,6 +39,14 @@ pub const REPO_FRONTIER_PLAN_DECISION_CONTRACT: &str = "epiphany.repo_frontier_p
|
|||
pub const REPO_FRONTIER_PLANNING_CONTRACT: &str = "epiphany.repo_frontier_planning.v1";
|
||||
pub const REPO_FRONTIER_WORK_PROPOSAL_CONTRACT: &str =
|
||||
"epiphany.repo_frontier_work_proposal.inert.v0";
|
||||
pub const REPO_FRONTIER_AUTONOMOUS_PROPOSAL_BINDING_SCHEMA_VERSION: &str =
|
||||
"epiphany.self.repo_frontier_autonomous_proposal_binding.v0";
|
||||
pub const REPO_FRONTIER_AUTONOMOUS_PROPOSAL_BINDING_CONTRACT: &str =
|
||||
"epiphany.repo_frontier_autonomous_proposal_binding.v0";
|
||||
pub const RUNTIME_REPOSITORY_DOMAIN_BINDING_KEY: &str = "runtime-repository-domain-binding";
|
||||
pub const RUNTIME_REPOSITORY_DOMAIN_BINDING_SCHEMA_VERSION: &str =
|
||||
"epiphany.runtime.repository_domain_binding.v0";
|
||||
pub const RUNTIME_REPOSITORY_DOMAIN_BINDING_CONTRACT: &str = "deployment configuration binds one organizational repository name to one exact authenticated repository Body; Self may consume but not relabel it";
|
||||
pub const REPO_FRONTIER_PROPOSAL_MODELING_REQUEST_SCHEMA_VERSION: &str =
|
||||
"epiphany.coordinator.repo_frontier_proposal_modeling_request.v0";
|
||||
pub const REPO_FRONTIER_PROPOSAL_MODELING_REQUEST_CONTRACT: &str =
|
||||
|
|
@ -213,6 +221,7 @@ pub enum RepoFrontierProposalSourceKind {
|
|||
User,
|
||||
Persona,
|
||||
Bifrost,
|
||||
Imagination,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
|
@ -280,6 +289,84 @@ pub struct RepoFrontierWorkProposal {
|
|||
pub contract: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, DatabaseEntry)]
|
||||
#[cultcache(
|
||||
type = "epiphany.self.repo_frontier_autonomous_proposal_binding",
|
||||
schema = "RepoFrontierAutonomousProposalBinding"
|
||||
)]
|
||||
pub struct RepoFrontierAutonomousProposalBinding {
|
||||
#[cultcache(key = 0)]
|
||||
pub schema_version: String,
|
||||
#[cultcache(key = 1)]
|
||||
pub binding_id: String,
|
||||
#[cultcache(key = 2)]
|
||||
pub proposal_id: String,
|
||||
#[cultcache(key = 3)]
|
||||
pub proposal_payload_sha256: String,
|
||||
#[cultcache(key = 4)]
|
||||
pub direction_request_id: String,
|
||||
#[cultcache(key = 5)]
|
||||
pub direction_result_id: String,
|
||||
#[cultcache(key = 6)]
|
||||
pub direction_result_sha256: String,
|
||||
#[cultcache(key = 7)]
|
||||
pub model_revision: u64,
|
||||
#[cultcache(key = 8)]
|
||||
pub model_hash: String,
|
||||
#[cultcache(key = 9)]
|
||||
pub model_admission_receipt_id: String,
|
||||
#[cultcache(key = 10)]
|
||||
pub option_ordinal: u32,
|
||||
#[cultcache(key = 11)]
|
||||
pub option_sha256: String,
|
||||
#[cultcache(key = 12)]
|
||||
pub runtime_id: String,
|
||||
#[cultcache(key = 13)]
|
||||
pub thread_id: String,
|
||||
#[cultcache(key = 14)]
|
||||
pub workspace_id: String,
|
||||
#[cultcache(key = 15)]
|
||||
pub body_binding_sha256: String,
|
||||
#[cultcache(key = 16)]
|
||||
pub created_at: String,
|
||||
#[cultcache(key = 17)]
|
||||
pub contract: String,
|
||||
#[cultcache(key = 18)]
|
||||
pub direction_worker_job_id: String,
|
||||
#[cultcache(key = 19)]
|
||||
pub direction_worker_result_id: String,
|
||||
#[cultcache(key = 20)]
|
||||
pub direction_worker_result_sha256: String,
|
||||
#[cultcache(key = 21)]
|
||||
pub direction_worker_launch_sha256: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, DatabaseEntry)]
|
||||
#[cultcache(
|
||||
type = "epiphany.runtime.repository_domain_binding",
|
||||
schema = "RuntimeRepositoryDomainBinding"
|
||||
)]
|
||||
pub struct RuntimeRepositoryDomainBinding {
|
||||
#[cultcache(key = 0)]
|
||||
pub schema_version: String,
|
||||
#[cultcache(key = 1)]
|
||||
pub binding_id: String,
|
||||
#[cultcache(key = 2)]
|
||||
pub repository_full_name: String,
|
||||
#[cultcache(key = 3)]
|
||||
pub runtime_id: String,
|
||||
#[cultcache(key = 4)]
|
||||
pub swarm_id: String,
|
||||
#[cultcache(key = 5)]
|
||||
pub workspace_id: String,
|
||||
#[cultcache(key = 6)]
|
||||
pub body_binding_sha256: String,
|
||||
#[cultcache(key = 7)]
|
||||
pub bound_at: String,
|
||||
#[cultcache(key = 8)]
|
||||
pub contract: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, DatabaseEntry)]
|
||||
#[cultcache(
|
||||
type = "epiphany.coordinator.repo_frontier_proposal_modeling_request",
|
||||
|
|
|
|||
|
|
@ -1329,7 +1329,7 @@ fn validate_runtime_body_store_binding(
|
|||
}
|
||||
Ok(())
|
||||
}
|
||||
fn body_binding_sha256(binding: &RepositoryBodyBinding) -> Result<String> {
|
||||
pub(crate) fn body_binding_sha256(binding: &RepositoryBodyBinding) -> Result<String> {
|
||||
Ok(format!(
|
||||
"{:x}",
|
||||
Sha256::digest(rmp_serde::to_vec_named(binding)?)
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ impl ResidentSelfPressure {
|
|||
| "persona-feedback"
|
||||
| "imagination-consideration"
|
||||
| "imagination-proposal"
|
||||
| "repo-frontier-proposal-modeling"
|
||||
)
|
||||
|| self.pressure_id.trim().is_empty()
|
||||
|| self.provenance_ref.trim().is_empty()
|
||||
|
|
@ -811,6 +812,8 @@ pub fn ingest_resident_self_domain_pressure(
|
|||
runtime_store: &Path,
|
||||
persona_feedback_store: &Path,
|
||||
runtime_id: &str,
|
||||
repository: &str,
|
||||
workspace: &str,
|
||||
now_millis: u64,
|
||||
) -> Result<usize> {
|
||||
let mut inserted = 0;
|
||||
|
|
@ -829,6 +832,30 @@ pub fn ingest_resident_self_domain_pressure(
|
|||
created_at_millis: now_millis, status: "pending".into(), consumed_by_grant_id: None, private_state_exposed: false,
|
||||
})?);
|
||||
}
|
||||
for selection in crate::promote_autonomous_direction_options_for_modeling(
|
||||
runtime_store,
|
||||
repository,
|
||||
workspace,
|
||||
&requested_at,
|
||||
)? {
|
||||
inserted += usize::from(enqueue_resident_self_pressure_idempotent(
|
||||
resident_store,
|
||||
&ResidentSelfPressure {
|
||||
schema_version: RESIDENT_SELF_PRESSURE_SCHEMA_VERSION.into(),
|
||||
pressure_id: format!("repo-frontier-proposal-modeling-{}", selection.request_id),
|
||||
kind: "repo-frontier-proposal-modeling".into(),
|
||||
provenance_ref: format!(
|
||||
"cultcache://repo-frontier-proposal-modeling/{}",
|
||||
selection.request_id
|
||||
),
|
||||
objective: "Launch the exact autonomous proposal Modeling review; do not admit, adopt, act, release, or deploy.".into(),
|
||||
created_at_millis: now_millis,
|
||||
status: "pending".into(),
|
||||
consumed_by_grant_id: None,
|
||||
private_state_exposed: false,
|
||||
},
|
||||
)?);
|
||||
}
|
||||
for feedback in crate::admitted_persona_feedback(persona_feedback_store, runtime_id)? {
|
||||
if feedback.target_runtime_id != runtime_id {
|
||||
return Err(anyhow!(
|
||||
|
|
@ -1009,18 +1036,23 @@ pub fn prepare_resident_self_launch(
|
|||
let mut argv = coordinator_argv(policy, &turn_id, &wake);
|
||||
if matches!(
|
||||
grant.pressure_kind.as_str(),
|
||||
"imagination-consideration" | "admitted-model-direction-consideration"
|
||||
"imagination-consideration"
|
||||
| "admitted-model-direction-consideration"
|
||||
| "repo-frontier-proposal-modeling"
|
||||
) {
|
||||
let (prefix, request_flag) = if grant.pressure_kind == "imagination-consideration" {
|
||||
(
|
||||
let (prefix, request_flag) = match grant.pressure_kind.as_str() {
|
||||
"imagination-consideration" => (
|
||||
"cultcache://imagination-consideration/",
|
||||
"--imagination-consideration-request-id",
|
||||
)
|
||||
} else {
|
||||
(
|
||||
),
|
||||
"admitted-model-direction-consideration" => (
|
||||
"cultcache://admitted-model-direction-consideration/",
|
||||
"--admitted-model-direction-consideration-request-id",
|
||||
)
|
||||
),
|
||||
_ => (
|
||||
"cultcache://repo-frontier-proposal-modeling/",
|
||||
"--proposal-modeling-request-id",
|
||||
),
|
||||
};
|
||||
let request_id = grant
|
||||
.provenance_ref
|
||||
|
|
@ -1751,6 +1783,43 @@ mod tests {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn autonomous_frontier_pressure_launches_exact_modeling_selection_without_objective()
|
||||
-> Result<()> {
|
||||
let temp = tempfile::tempdir()?;
|
||||
let store = temp.path().join("resident-autonomous.cc");
|
||||
let coordinator = temp.path().join("epiphany-mvp-coordinator");
|
||||
std::fs::write(&coordinator, b"witnessed executable")?;
|
||||
let mut policy = policy();
|
||||
policy.coordinator_bin = coordinator;
|
||||
enqueue_resident_self_pressure(
|
||||
&store,
|
||||
&ResidentSelfPressure {
|
||||
schema_version: RESIDENT_SELF_PRESSURE_SCHEMA_VERSION.into(),
|
||||
pressure_id: "pressure-autonomous-modeling-1".into(),
|
||||
kind: "repo-frontier-proposal-modeling".into(),
|
||||
provenance_ref: "cultcache://repo-frontier-proposal-modeling/selection-1".into(),
|
||||
objective: "Launch exact autonomous proposal Modeling review.".into(),
|
||||
created_at_millis: 1,
|
||||
status: "pending".into(),
|
||||
consumed_by_grant_id: None,
|
||||
private_state_exposed: false,
|
||||
},
|
||||
)?;
|
||||
heartbeat_issue_resident_self_grant(&store, "heartbeat-autonomous", "action-1", 2)?
|
||||
.expect("autonomous grant");
|
||||
let prepared = prepare_resident_self_launch(&store, &policy, 3)?
|
||||
.expect("autonomous Modeling preparation");
|
||||
assert!(!prepared.argv.iter().any(|arg| arg == "--objective"));
|
||||
assert!(
|
||||
prepared
|
||||
.argv
|
||||
.windows(2)
|
||||
.any(|pair| { pair == ["--proposal-modeling-request-id", "selection-1"] })
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn standard_heartbeat_owns_self_grant_selection() -> Result<()> {
|
||||
let temp = tempfile::tempdir()?;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Reference in a new issue