Build organizational Persona feedback cognition

This commit is contained in:
Meta Vens 2026-07-18 20:31:57 +01:00
commit e20a9c019e
28 changed files with 2633 additions and 2590 deletions

View file

@ -89,6 +89,7 @@ struct Args {
supersede_failed_results: bool,
auto_tools: bool,
proposal_modeling_request_id: Option<String>,
imagination_consideration_request_id: Option<String>,
resident_binding: BTreeMap<String, String>,
resident_state_store: Option<PathBuf>,
resident_preparation_id: Option<String>,
@ -126,6 +127,7 @@ impl Args {
supersede_failed_results: false,
auto_tools: true,
proposal_modeling_request_id: None,
imagination_consideration_request_id: None,
resident_binding: BTreeMap::new(),
resident_state_store: None,
resident_preparation_id: None,
@ -154,6 +156,12 @@ impl Args {
parsed.proposal_modeling_request_id =
Some(take_string(&mut args, "--proposal-modeling-request-id")?);
}
"--imagination-consideration-request-id" => {
parsed.imagination_consideration_request_id = Some(take_string(
&mut args,
"--imagination-consideration-request-id",
)?);
}
flag @ ("--resident-grant-id"
| "--resident-launch-digest"
| "--resident-policy-digest"
@ -343,6 +351,62 @@ fn run_coordinator(args: &Args) -> Result<Value> {
"changed": intake.changed,
}));
}
if let Some(request_id) = args.imagination_consideration_request_id.as_deref() {
if args.objective.is_some() {
return Err(anyhow!(
"typed consideration cannot share operator objective intake"
));
}
let service = epiphany_core::EpiphanyCoordinatorService::new(&runtime_store);
let state = service
.state()?
.ok_or_else(|| anyhow!("consideration launch requires coordinator state"))?;
let request = epiphany_core::build_epiphany_imagination_consideration_launch_request(
&thread_id,
Some(state.revision),
Some(args.max_runtime_seconds),
&state,
request_id.to_string(),
)
.map_err(anyhow::Error::msg)?;
let launched = service.launch_job(
&thread_id,
&state,
&request,
format!("epiphany-resident-consideration-launch-{}", Uuid::new_v4()),
Uuid::new_v4().to_string(),
now(),
)?;
let worker_job_id = launched.backend_job_id.clone();
let operator_launch = json!({
"bindingId": launched.binding_id,
"launcherJobId": launched.launcher_job_id,
"backendJobId": launched.backend_job_id,
"stateRevision": launched.epiphany_state.revision,
});
let worker_run = launch_worker_runtime_detached(
&model_runtime_bin,
&tool_adapter_bin,
&args.model_provider,
&runtime_store,
&codex_home,
&cwd,
&worker_job_id,
"imagination",
0,
&artifact_dir,
args.max_runtime_seconds,
args.auto_tools,
)?;
startup_events.push(json!({
"type": "imaginationConsiderationLaunch",
"requestId": request_id,
"runtimeJobId": worker_job_id,
"launch": status_cli::sanitize_for_operator(operator_launch),
"worker": worker_run,
"authority": "proposal-only"
}));
}
for index in 0..args.max_steps {
let status = collect_coordinator_status(&runtime_store, &thread_id)?;

View file

@ -0,0 +1,254 @@
use anyhow::{Context, Result, bail};
use epiphany_core::*;
use epiphany_state_model::{
EpiphanyMemoryDomain, EpiphanyMemoryLifecycle, EpiphanyMemoryNode, EpiphanyMemoryNodeKind,
EpiphanyMemoryProfile, EpiphanyThreadState, RepoModelPatchPurpose,
};
use std::{
collections::{BTreeMap, BTreeSet},
env, fs,
path::{Path, PathBuf},
};
const AT: &str = "2026-07-18T00:00:00Z";
fn main() -> Result<()> {
let args = arguments()?;
let feedback_store = path(&args, "--persona-feedback-store")?;
let runtime_store = path(&args, "--runtime-store")?;
let resident_store = path(&args, "--resident-store")?;
let forbidden = [
"--mind-store",
"--release-store",
"--local-verse-store",
"--public-store",
]
.map(|flag| path(&args, flag))
.into_iter()
.collect::<Result<Vec<_>>>()?;
let before = forbidden
.iter()
.map(|p| Ok((p.clone(), bytes(p)?)))
.collect::<Result<Vec<_>>>()?;
seed_fixture_runtime(&runtime_store)?;
let admitted = admitted_persona_feedback(&feedback_store, "epiphany-yggdrasil")?;
let classes = admitted
.iter()
.map(|f| (f.source_visibility.as_str(), f.data_classification.as_str()))
.collect::<BTreeSet<_>>();
let expected = BTreeSet::from([
("public", "public_feedback"),
("organization", "organization_feedback"),
("private", "private_feedback"),
]);
if classes != expected {
bail!("fixture requires exact public, organization, and private feedback classes");
}
let inserted = ingest_resident_self_domain_pressure(
&resident_store,
&runtime_store,
&feedback_store,
"epiphany-yggdrasil",
1_752_796_800_000,
)?;
if inserted < admitted.len() {
bail!("resident Self did not ingest every admitted feedback item");
}
for feedback in admitted {
let request = commit_imagination_consideration_request(
&runtime_store,
&feedback_store,
&feedback.feedback_id,
"GameCult/Epiphany",
"epiphany",
"resident-feedback-consideration-v0",
AT,
)?;
if request.source_visibility != feedback.source_visibility
|| request.data_classification != feedback.data_classification
|| request.source_room_id != feedback.source_room_id
{
bail!("consideration lost classified source provenance");
}
let mut runtime = runtime_spine_cache(&runtime_store)?;
runtime.pull_all_backing_stores()?;
let state = runtime
.get::<EpiphanyThreadStateEntry>(THREAD_STATE_KEY)?
.context("fixture runtime lost its current thread state")?
.state()?;
let launch = build_epiphany_imagination_consideration_launch_request(
"fixture-thread",
Some(state.revision),
Some(30),
&state,
request.request_id.clone(),
)
.map_err(anyhow::Error::msg)?;
let job = format!("fixture-imagination-{}", feedback.feedback_id);
let plan = plan_coordinator_job_launch(
&state,
&launch,
&runtime_store,
format!("launcher-{job}"),
job.clone(),
)?;
let committed = commit_coordinator_job_launch(
&runtime_store,
"fixture-thread",
&state,
&launch,
&plan,
AT.into(),
)?;
let candidate = ImaginationConsiderationCandidate {
schema_version: IMAGINATION_CONSIDERATION_CANDIDATE_SCHEMA_VERSION.into(),
candidate_id: imagination_consideration_candidate_id_for_launch(
&request.request_id,
&committed.backend_job_id,
),
request_id: request.request_id.clone(),
feedback_id: request.feedback_id.clone(),
feedback_packet_sha256: request.feedback_packet_sha256.clone(),
source_room_id: request.source_room_id.clone(),
source_visibility: request.source_visibility.clone(),
data_classification: request.data_classification.clone(),
model_revision: request.model_revision,
model_hash: request.model_hash.clone(),
disposition: ImaginationConsiderationDisposition::Suggest,
title: "Fixture proposal".into(),
summary: "Reviewable option only".into(),
rationale: "Compared exact admitted feedback with the current Modeling map.".into(),
option_drafts: vec![ImaginationOptionDraft {
title: "Review".into(),
summary: "Ask Modeling to review; do not mutate state.".into(),
}],
uncertainties: Vec::new(),
evidence_refs: request.quoted_evidence.source_discussion_refs.clone(),
recommended_review_route: ImaginationConsiderationReviewRoute::ModelingReview,
proposed_at: AT.into(),
contract: IMAGINATION_CONSIDERATION_CANDIDATE_CONTRACT.into(),
};
validate_imagination_consideration_candidate(&request, &candidate)?;
let mut runtime = runtime_spine_cache(&runtime_store)?;
runtime.pull_all_backing_stores()?;
let current = runtime
.get::<EpiphanyThreadStateEntry>(THREAD_STATE_KEY)?
.context("fixture runtime lost launched thread state")?
.state()?;
EpiphanyCoordinatorService::new(&runtime_store).interrupt_job(
"fixture-thread",
&current,
EpiphanyJobInterruptRequest {
expected_revision: Some(current.revision),
binding_id: committed.binding_id,
reason: Some("fixture advances to the next classified feedback".into()),
},
)?;
}
for (path, original) in before {
if bytes(&path)? != original {
bail!("fixture mutated forbidden store {}", path.display());
}
}
println!(
"{{\"schemaVersion\":\"epiphany.persona_feedback_causal_smoke.v0\",\"status\":\"passed\",\"privateStateExposed\":false}}"
);
Ok(())
}
fn seed_fixture_runtime(store: &Path) -> Result<()> {
initialize_runtime_spine(
store,
RuntimeSpineInitOptions {
runtime_id: "epiphany-yggdrasil".into(),
display_name: "fixture".into(),
created_at: AT.into(),
},
)?;
let state = EpiphanyThreadState::default();
let mut cache = runtime_spine_cache(store)?;
cache.put(
THREAD_STATE_KEY,
&EpiphanyThreadStateEntry::from_state("fixture-thread", &state)?,
)?;
let mut model = EpiphanyMemoryGraphSnapshot {
schema_version: Some(MEMORY_GRAPH_SCHEMA_VERSION.into()),
graph_id: "fixture-model".into(),
model_revision: 1,
domains: vec![EpiphanyMemoryDomain {
id: "repo".into(),
profile: EpiphanyMemoryProfile::RepoArchitecture,
title: "Repository".into(),
lifecycle: EpiphanyMemoryLifecycle::Accepted,
..Default::default()
}],
nodes: vec![EpiphanyMemoryNode {
id: "fixture-claim".into(),
domain_id: "repo".into(),
profile: EpiphanyMemoryProfile::RepoArchitecture,
kind: EpiphanyMemoryNodeKind::RuntimeContract,
title: "Feedback path".into(),
claim: "Persona feedback is pressure, never authority.".into(),
question: "Which proposal fits the Body?".into(),
action_implication: "Review only.".into(),
lifecycle: EpiphanyMemoryLifecycle::Accepted,
..Default::default()
}],
..Default::default()
};
model.model_hash = memory_graph_model_hash(&model)?;
cache.put(
MEMORY_GRAPH_KEY,
&EpiphanyMemoryGraphEntry::from_snapshot(&model)?,
)?;
cache.put(
"fixture-model-admission",
&RepoModelAdmissionReceipt {
schema_version: REPO_MODEL_ADMISSION_RECEIPT_SCHEMA_VERSION.into(),
receipt_id: "fixture-model-admission".into(),
review_id: "fixture-review".into(),
result_id: "fixture-result".into(),
patch_id: "fixture-patch".into(),
patch_sha256: "sha256-fixture".into(),
previous_revision: 0,
previous_hash: "none".into(),
admitted_revision: 1,
admitted_hash: model.model_hash,
admitted_at: AT.into(),
contract: REPO_MODEL_ADMISSION_CONTRACT.into(),
purpose: RepoModelPatchPurpose::Evolution,
frontier_route_id: String::new(),
verification_request_id: String::new(),
soul_verdict_receipt_id: String::new(),
frontier_modeling_request_id: String::new(),
proposal_modeling_request_id: String::new(),
claim_repair_request_id: String::new(),
frontier_plan_decision_id: String::new(),
repository_body_observation_basis: None,
},
)?;
Ok(())
}
fn arguments() -> Result<BTreeMap<String, String>> {
let mut map = BTreeMap::new();
let mut args = env::args().skip(1);
while let Some(k) = args.next() {
map.insert(k, args.next().context("missing argument value")?);
}
Ok(map)
}
fn path(args: &BTreeMap<String, String>, key: &str) -> Result<PathBuf> {
Ok(PathBuf::from(
args.get(key).with_context(|| format!("missing {key}"))?,
))
}
fn bytes(path: &Path) -> Result<Vec<u8>> {
Ok(if path.exists() {
fs::read(path)?
} else {
Vec::new()
})
}

View file

@ -0,0 +1,88 @@
use anyhow::{Result, anyhow};
use epiphany_core::{
import_bifrost_persona_feedback_deliveries, validate_bifrost_persona_feedback_source,
validate_persona_feedback_store_separation,
};
use serde_json::json;
use std::collections::BTreeMap;
use std::env;
use std::path::PathBuf;
fn main() -> Result<()> {
let mut args = env::args().skip(1);
let command = args.next().ok_or_else(|| anyhow!("use status or import"))?;
let mut values = BTreeMap::new();
while let Some(flag) = args.next() {
let value = args
.next()
.ok_or_else(|| anyhow!("missing value for {flag}"))?;
values.insert(flag, value);
}
let required = |name: &str| -> Result<String> {
values
.get(name)
.cloned()
.ok_or_else(|| anyhow!("missing {name}"))
};
let source_store = PathBuf::from(required("--source-store")?);
let trust_anchor = PathBuf::from(required("--trust-anchor")?);
let runtime_id = required("--runtime-id")?;
let repository = required("--repository")?;
let persona_id = required("--persona-id")?;
let (status, delivery_count, admitted_count) = match command.as_str() {
"status" => (
"ready",
validate_bifrost_persona_feedback_source(
&source_store,
&trust_anchor,
&runtime_id,
&repository,
&persona_id,
)?,
0,
),
"import" => {
let feedback_store = PathBuf::from(required("--persona-feedback-store")?);
let resident_store = PathBuf::from(required("--resident-store")?);
let runtime_store = PathBuf::from(required("--runtime-store")?);
let mind_store = PathBuf::from(required("--mind-store")?);
let release_store = PathBuf::from(required("--release-store")?);
validate_persona_feedback_store_separation(
&source_store,
&feedback_store,
&[
&trust_anchor,
&resident_store,
&runtime_store,
&mind_store,
&release_store,
],
)?;
let admitted = import_bifrost_persona_feedback_deliveries(
&source_store,
&feedback_store,
&trust_anchor,
&runtime_id,
&repository,
&persona_id,
)?;
("admitted", admitted.len(), admitted.len())
}
_ => return Err(anyhow!("unknown command {command:?}; use status or import")),
};
println!(
"{}",
serde_json::to_string_pretty(&json!({
"schemaVersion": "epiphany.persona_feedback.ingress_projection.v0",
"status": status,
"runtimeId": runtime_id,
"repository": repository,
"personaId": persona_id,
"deliveryCount": delivery_count,
"admittedCount": admitted_count,
"authority": "resident-pressure-only",
"privateStateExposed": false,
}))?
);
Ok(())
}

View file

@ -1,400 +0,0 @@
use anyhow::Context;
use anyhow::Result;
use anyhow::anyhow;
use chrono::Utc;
use serde_json::Value;
use serde_json::json;
use std::env;
use std::fs;
use std::path::Path;
use std::path::PathBuf;
use std::process::Command;
fn main() -> Result<()> {
let args = Args::parse()?;
let result = run_smoke(args)?;
println!("{}", serde_json::to_string_pretty(&result)?);
Ok(())
}
#[derive(Clone, Debug)]
struct Args {
root: PathBuf,
}
impl Args {
fn parse() -> Result<Self> {
let mut root = env::current_dir().context("failed to resolve current directory")?;
let mut args = env::args().skip(1).peekable();
while let Some(arg) = args.next() {
match arg.as_str() {
"--root" => root = take_path(&mut args, "--root")?,
other => return Err(anyhow!("unexpected argument {other:?}")),
}
}
Ok(Self { root })
}
}
fn run_smoke(args: Args) -> Result<Value> {
let root = args
.root
.canonicalize()
.with_context(|| format!("failed to resolve {}", args.root.display()))?;
let smoke_root = root.join(".epiphany-smoke");
let manifest = root.join("epiphany-core").join("Cargo.toml");
if !manifest.exists() {
return Err(anyhow!(
"could not find epiphany-core manifest at {}",
manifest.display()
));
}
fs::create_dir_all(&smoke_root)
.with_context(|| format!("failed to create {}", smoke_root.display()))?;
let stamp = Utc::now().format("%Y%m%d-%H%M%S").to_string();
let smoke_dir = smoke_root.join(format!("repo-collaboration-policy-family-{stamp}"));
fs::create_dir(&smoke_dir)
.with_context(|| format!("failed to claim fresh smoke dir {}", smoke_dir.display()))?;
let repo = smoke_dir.join("repo-body");
fs::create_dir_all(&repo).with_context(|| format!("failed to create {}", repo.display()))?;
git(["init"], &repo)?;
git(
["config", "user.email", "epiphany-smoke@example.invalid"],
&repo,
)?;
git(["config", "user.name", "Epiphany Smoke"], &repo)?;
fs::write(
repo.join("README.md"),
"# Repo Collaboration Policy Smoke\n\nThis repository proves branch-local collaboration policy contracts.\n",
)
.with_context(|| format!("failed to seed {}", repo.join("README.md").display()))?;
git(["add", "README.md"], &repo)?;
git(
["commit", "-m", "Seed repo collaboration policy smoke body"],
&repo,
)?;
git(
["switch", "-c", "epiphany/repo-collaboration-policy-family"],
&repo,
)?;
let item = "repo-collaboration-policy-family";
let target_path = ".epiphany/collaboration-policy.toml";
let local_verse = repo.join(".epiphany").join("local-verse.ccmp");
cargo_json(
&manifest,
"epiphany-repo",
&[
"init",
"--workspace",
path_str(&repo)?,
"--epiphany-root",
path_str(&root)?,
"--swarm-id",
"repo-collaboration-policy-family-smoke",
"--topic",
"repo-collaboration-policy-family",
],
&root,
)?;
cargo_json(
&manifest,
"epiphany-swarm",
&[
"online",
"--workspace",
path_str(&repo)?,
"--epiphany-root",
path_str(&root)?,
"--runtime-id",
"repo-collaboration-policy-family-smoke",
"--local-verse-store",
path_str(&local_verse)?,
],
&root,
)?;
cargo_json(
&manifest,
"epiphany-work",
&[
"accept",
"--workspace",
path_str(&repo)?,
"--from",
"persona",
"--item",
item,
"--summary",
"Define the repo collaboration policy for Odin discovery, Eve connection, Persona discussion, and Imagination feedback routing.",
"--candidate-action-ref",
"candidate-action://repo-collaboration-policy-family/policy",
"--public-discussion-ref",
"epiphany-global/persona-collaboration/repo-collaboration-policy-family",
],
&root,
)?;
let plan = cargo_json(
&manifest,
"epiphany-work",
&[
"derive-plan",
"--workspace",
path_str(&repo)?,
"--item",
item,
"--action-family",
"repo-collaboration-policy",
"--model-ref",
"repo-collaboration-policy-family-smoke-imagination-v1",
"--model-authored",
],
&root,
)?;
for _ in 0..4 {
cargo_json(
&manifest,
"epiphany-work",
&[
"tick",
"--workspace",
path_str(&repo)?,
"--epiphany-root",
path_str(&root)?,
"--item",
item,
"--cooldown-seconds",
"0",
],
&root,
)?;
}
let close = read_json(
&repo
.join(".epiphany")
.join("work")
.join(format!("work-close-{item}.json")),
)?;
let policy_text = fs::read_to_string(repo.join(target_path))
.with_context(|| format!("failed to read {}", repo.join(target_path).display()))?;
require_eq(
&plan,
&["derivation", "safeActionFamily"],
"repo.collaboration_policy",
)?;
require_eq(&close, &["status"], "closed")?;
require_eq(&close, &["soul", "verdict"], "passed")?;
require_eq(
&close,
&["closureReview", "familyAssertions", "status"],
"passed",
)?;
require_bool(
&close,
&["closureReview", "sourceGrounding", "pathScopeMatched"],
true,
)?;
require_bool(&close, &["privateStateExposed"], false)?;
require_text(
&policy_text,
"schema_version = \"epiphany.repo_collaboration_policy.v0\"",
)?;
require_text(
&policy_text,
"safe_action_family = \"repo.collaboration_policy\"",
)?;
require_text(&policy_text, "[body]")?;
require_text(&policy_text, "provider_owns_truth = true")?;
require_text(&policy_text, "renderer_owns_truth = false")?;
require_text(&policy_text, "[verses]")?;
require_text(&policy_text, "private = \"epiphany-internal\"")?;
require_text(&policy_text, "local = \"gamecult-local\"")?;
require_text(&policy_text, "public = \"epiphany-global\"")?;
require_text(&policy_text, "private_state_may_leave_repo = false")?;
require_text(&policy_text, "odin_discoverable = true")?;
require_text(&policy_text, "[eve]")?;
require_text(&policy_text, "surface = \"eve://epiphany/repo/")?;
require_text(&policy_text, "compact_tui_required = true")?;
require_text(&policy_text, "connection_receipt_required = true")?;
require_text(&policy_text, "\"submit-feedback\"")?;
require_text(&policy_text, "[persona]")?;
require_text(&policy_text, "public_discussion_allowed = true")?;
require_text(&policy_text, "human_discussion_allowed = true")?;
require_text(&policy_text, "peer_persona_discussion_allowed = true")?;
require_text(&policy_text, "speech_audit_required = true")?;
require_text(&policy_text, "feedback_must_route_to_imagination = true")?;
require_text(&policy_text, "[imagination]")?;
require_text(&policy_text, "feedback_route = \"imagination://repo/")?;
require_text(&policy_text, "consensus_required_before_adoption = true")?;
require_text(&policy_text, "candidate_actions_non_authoritative = true")?;
require_text(&policy_text, "mind_adoption_required = true")?;
require_text(&policy_text, "bifrost_publication_required = true")?;
require_text(&policy_text, "[authority]")?;
require_text(&policy_text, "direct_hands_authority = false")?;
require_text(&policy_text, "direct_mind_state_commit = false")?;
require_text(&policy_text, "direct_publication_authority = false")?;
require_text(&policy_text, "direct_merge_authority = false")?;
require_text(&policy_text, "service_lifecycle_authority = false")?;
require_text(&policy_text, "cross_body_mutation_authority = false")?;
require_text(&policy_text, "private_verse_rummaging = false")?;
require_text(&policy_text, "requires_cultmesh_receipts = true")?;
require_text(&policy_text, "private_state_exposed = false")?;
Ok(json!({
"schemaVersion": "epiphany.repo_collaboration_policy_family_smoke.v0",
"status": "ok",
"smokeDir": smoke_dir,
"repo": repo,
"branch": git_output(["branch", "--show-current"], &repo)?,
"item": item,
"safeActionFamily": "repo.collaboration_policy",
"targetPath": target_path,
"closeStatus": "closed",
"soulVerdict": "passed",
"familyAssertionsStatus": "passed",
"pathScopeMatched": true,
"hasVerseBoundaries": true,
"odinDiscoverable": true,
"hasEveConnectionContract": true,
"personaDiscussionAllowed": true,
"feedbackRoutesToImagination": true,
"candidateActionsNonAuthoritative": true,
"directHandsAuthority": false,
"directMindStateCommit": false,
"directPublicationAuthority": false,
"directMergeAuthority": false,
"serviceLifecycleAuthority": false,
"crossBodyMutationAuthority": false,
"privateVerseRummaging": false,
"privateStateExposed": false
}))
}
fn cargo_json(manifest_path: &Path, bin_name: &str, args: &[&str], cwd: &Path) -> Result<Value> {
let output = Command::new("cargo")
.arg("run")
.arg("--quiet")
.arg("--manifest-path")
.arg(manifest_path)
.arg("--bin")
.arg(bin_name)
.arg("--")
.args(args)
.current_dir(cwd)
.output()
.with_context(|| format!("failed to spawn cargo run --bin {bin_name}"))?;
if !output.status.success() {
return Err(anyhow!(
"cargo run --bin {bin_name} failed:\n{}",
String::from_utf8_lossy(&output.stderr)
));
}
serde_json::from_slice(&output.stdout)
.with_context(|| format!("{bin_name} returned invalid JSON"))
}
fn git<const N: usize>(args: [&str; N], cwd: &Path) -> Result<()> {
let output = Command::new("git")
.args(args)
.current_dir(cwd)
.output()
.with_context(|| format!("failed to spawn git in {}", cwd.display()))?;
if output.status.success() {
Ok(())
} else {
Err(anyhow!(
"git failed in {}:\n{}",
cwd.display(),
String::from_utf8_lossy(&output.stderr)
))
}
}
fn git_output<const N: usize>(args: [&str; N], cwd: &Path) -> Result<String> {
let output = Command::new("git")
.args(args)
.current_dir(cwd)
.output()
.with_context(|| format!("failed to spawn git in {}", cwd.display()))?;
if !output.status.success() {
return Err(anyhow!(
"git failed in {}:\n{}",
cwd.display(),
String::from_utf8_lossy(&output.stderr)
));
}
Ok(String::from_utf8_lossy(&output.stdout).trim().to_string())
}
fn read_json(path: &Path) -> Result<Value> {
let raw =
fs::read_to_string(path).with_context(|| format!("failed to read {}", path.display()))?;
serde_json::from_str(&raw).with_context(|| format!("failed to decode {}", path.display()))
}
fn require_eq(value: &Value, path: &[&str], expected: &str) -> Result<()> {
let actual = value_at_path(value, path)
.and_then(Value::as_str)
.ok_or_else(|| anyhow!("missing string at {}", path.join(".")))?;
if actual == expected {
Ok(())
} else {
Err(anyhow!(
"expected {} to be {:?}, got {:?}",
path.join("."),
expected,
actual
))
}
}
fn require_bool(value: &Value, path: &[&str], expected: bool) -> Result<()> {
let actual = value_at_path(value, path)
.and_then(Value::as_bool)
.ok_or_else(|| anyhow!("missing bool at {}", path.join(".")))?;
if actual == expected {
Ok(())
} else {
Err(anyhow!(
"expected {} to be {}, got {}",
path.join("."),
expected,
actual
))
}
}
fn require_text(haystack: &str, needle: &str) -> Result<()> {
if haystack.contains(needle) {
Ok(())
} else {
Err(anyhow!("expected text to contain {:?}", needle))
}
}
fn value_at_path<'a>(value: &'a Value, path: &[&str]) -> Option<&'a Value> {
let mut cursor = value;
for segment in path {
if let Ok(index) = segment.parse::<usize>() {
cursor = cursor.as_array()?.get(index)?;
} else {
cursor = cursor.get(*segment)?;
}
}
Some(cursor)
}
fn path_str(path: &Path) -> Result<&str> {
path.to_str()
.ok_or_else(|| anyhow!("path is not valid UTF-8: {}", path.display()))
}
fn take_path(args: &mut impl Iterator<Item = String>, name: &str) -> Result<PathBuf> {
Ok(PathBuf::from(
args.next()
.ok_or_else(|| anyhow!("missing value for {name}"))?,
))
}

View file

@ -1,395 +0,0 @@
use anyhow::Context;
use anyhow::Result;
use anyhow::anyhow;
use chrono::Utc;
use serde_json::Value;
use serde_json::json;
use std::env;
use std::fs;
use std::path::Path;
use std::path::PathBuf;
use std::process::Command;
fn main() -> Result<()> {
let args = Args::parse()?;
let result = run_smoke(args)?;
println!("{}", serde_json::to_string_pretty(&result)?);
Ok(())
}
#[derive(Clone, Debug)]
struct Args {
root: PathBuf,
}
impl Args {
fn parse() -> Result<Self> {
let mut root = env::current_dir().context("failed to resolve current directory")?;
let mut args = env::args().skip(1).peekable();
while let Some(arg) = args.next() {
match arg.as_str() {
"--root" => root = take_path(&mut args, "--root")?,
other => return Err(anyhow!("unexpected argument {other:?}")),
}
}
Ok(Self { root })
}
}
fn run_smoke(args: Args) -> Result<Value> {
let root = args
.root
.canonicalize()
.with_context(|| format!("failed to resolve {}", args.root.display()))?;
let smoke_root = root.join(".epiphany-smoke");
let manifest = root.join("epiphany-core").join("Cargo.toml");
if !manifest.exists() {
return Err(anyhow!(
"could not find epiphany-core manifest at {}",
manifest.display()
));
}
fs::create_dir_all(&smoke_root)
.with_context(|| format!("failed to create {}", smoke_root.display()))?;
let stamp = Utc::now().format("%Y%m%d-%H%M%S").to_string();
let smoke_dir = smoke_root.join(format!("repo-collaboration-topic-family-{stamp}"));
fs::create_dir(&smoke_dir)
.with_context(|| format!("failed to claim fresh smoke dir {}", smoke_dir.display()))?;
let repo = smoke_dir.join("repo-body");
fs::create_dir_all(&repo).with_context(|| format!("failed to create {}", repo.display()))?;
git(["init"], &repo)?;
git(
["config", "user.email", "epiphany-smoke@example.invalid"],
&repo,
)?;
git(["config", "user.name", "Epiphany Smoke"], &repo)?;
fs::write(
repo.join("README.md"),
"# Repo Collaboration Topic Family Smoke\n\nThis repository proves branch-local Epiphany collaboration topics.\n",
)
.with_context(|| format!("failed to seed {}", repo.join("README.md").display()))?;
git(["add", "README.md"], &repo)?;
git(
["commit", "-m", "Seed repo collaboration topic smoke body"],
&repo,
)?;
git(
["switch", "-c", "epiphany/repo-collaboration-topic-family"],
&repo,
)?;
let item = "repo-collaboration-topic-family";
let target_path = ".epiphany/collaboration-topics/repo-collaboration-topic-family.toml";
let local_verse = repo.join(".epiphany").join("local-verse.ccmp");
cargo_json(
&manifest,
"epiphany-repo",
&[
"init",
"--workspace",
path_str(&repo)?,
"--epiphany-root",
path_str(&root)?,
"--swarm-id",
"repo-collaboration-topic-family-smoke",
"--topic",
"repo-collaboration-topic-family",
],
&root,
)?;
cargo_json(
&manifest,
"epiphany-swarm",
&[
"online",
"--workspace",
path_str(&repo)?,
"--epiphany-root",
path_str(&root)?,
"--runtime-id",
"repo-collaboration-topic-family-smoke",
"--local-verse-store",
path_str(&local_verse)?,
],
&root,
)?;
cargo_json(
&manifest,
"epiphany-work",
&[
"accept",
"--workspace",
path_str(&repo)?,
"--from",
"persona",
"--item",
item,
"--summary",
"Open a public Eve collaboration topic that routes Persona and human feedback to Imagination consensus before any repo action.",
"--candidate-action-ref",
"candidate-action://repo-collaboration-topic-family/eve-topic",
"--candidate-action-ref",
"candidate-action://repo-collaboration-topic-family/imagination-consensus",
"--public-discussion-ref",
"eve://epiphany/persona/repo-collaboration-topic-family",
],
&root,
)?;
let plan = cargo_json(
&manifest,
"epiphany-work",
&[
"derive-plan",
"--workspace",
path_str(&repo)?,
"--item",
item,
"--action-family",
"repo-collaboration-topic",
"--model-ref",
"repo-collaboration-topic-family-smoke-imagination-v1",
"--model-authored",
],
&root,
)?;
for _ in 0..4 {
cargo_json(
&manifest,
"epiphany-work",
&[
"tick",
"--workspace",
path_str(&repo)?,
"--epiphany-root",
path_str(&root)?,
"--item",
item,
"--cooldown-seconds",
"0",
],
&root,
)?;
}
let close_path = repo
.join(".epiphany")
.join("work")
.join(format!("work-close-{item}.json"));
let close = read_json(&close_path)?;
let topic_text = fs::read_to_string(repo.join(target_path))
.with_context(|| format!("failed to read {}", repo.join(target_path).display()))?;
require_eq(
&plan,
&["derivation", "safeActionFamily"],
"repo.collaboration_topic",
)?;
require_eq(&close, &["status"], "closed")?;
require_eq(&close, &["soul", "verdict"], "passed")?;
require_eq(
&close,
&["closureReview", "familyAssertions", "status"],
"passed",
)?;
require_bool(
&close,
&["closureReview", "sourceGrounding", "pathScopeMatched"],
true,
)?;
require_bool(&close, &["privateStateExposed"], false)?;
require_text(
&topic_text,
"schema_version = \"epiphany.repo_collaboration_topic.v0\"",
)?;
require_text(
&topic_text,
"safe_action_family = \"repo.collaboration_topic\"",
)?;
require_text(&topic_text, "[topic]")?;
require_text(
&topic_text,
"requested_public_room = \"epiphany-global/persona-collaboration/repo-collaboration-topic-family\"",
)?;
require_text(
&topic_text,
"requested_eve_surface = \"eve://epiphany/repo/repo-collaboration-topic-family/collaboration\"",
)?;
require_text(&topic_text, "persona_discussion_allowed = true")?;
require_text(&topic_text, "human_discussion_allowed = true")?;
require_text(&topic_text, "[imagination]")?;
require_text(
&topic_text,
"consensus_route = \"imagination://repo/repo-collaboration-topic-family/consensus-discovery\"",
)?;
require_text(&topic_text, "consensus_required_before_action = true")?;
require_text(
&topic_text,
"candidate_actions_are_non_authoritative = true",
)?;
require_text(&topic_text, "mind_adoption_required = true")?;
require_text(&topic_text, "bifrost_publication_required = true")?;
require_text(&topic_text, "adoption_authorized = false")?;
require_text(&topic_text, "hands_action_authorized = false")?;
require_text(&topic_text, "cross_body_mutation_authorized = false")?;
require_text(&topic_text, "private_verse_rummaging = false")?;
require_text(&topic_text, "private_state_exposed = false")?;
let summary = json!({
"schemaVersion": "epiphany.repo_work_collaboration_topic_family_smoke.v0",
"status": "ok",
"smokeDir": smoke_dir,
"repo": repo,
"branch": git_output(["branch", "--show-current"], &repo)?,
"item": item,
"safeActionFamily": plan["derivation"]["safeActionFamily"],
"targetPath": target_path,
"closeStatus": close["status"],
"soulVerdict": close["soul"]["verdict"],
"familyAssertionsStatus": close["closureReview"]["familyAssertions"]["status"],
"pathScopeMatched": close["closureReview"]["sourceGrounding"]["pathScopeMatched"],
"topicHasPublicRoom": true,
"topicHasEveSurface": true,
"topicHasImaginationRoute": true,
"candidateActionsNonAuthoritative": true,
"privateStateExposed": false,
});
write_json(&smoke_dir.join("summary.json"), &summary)?;
Ok(summary)
}
fn cargo_json(manifest: &Path, bin: &str, args: &[&str], cwd: &Path) -> Result<Value> {
let output = Command::new("cargo")
.arg("run")
.arg("--quiet")
.arg("--manifest-path")
.arg(manifest)
.arg("--bin")
.arg(bin)
.arg("--")
.args(args)
.current_dir(cwd)
.output()
.with_context(|| format!("failed to run cargo bin {bin}"))?;
if !output.status.success() {
return Err(anyhow!(
"{bin} failed with status {:?}\nstdout:\n{}\nstderr:\n{}",
output.status.code(),
String::from_utf8_lossy(&output.stdout),
String::from_utf8_lossy(&output.stderr)
));
}
serde_json::from_slice(&output.stdout).with_context(|| {
format!(
"{bin} did not emit JSON on stdout:\n{}",
String::from_utf8_lossy(&output.stdout)
)
})
}
fn git<const N: usize>(args: [&str; N], cwd: &Path) -> Result<()> {
let output = Command::new("git")
.args(args)
.current_dir(cwd)
.output()
.with_context(|| format!("failed to run git in {}", cwd.display()))?;
if output.status.success() {
Ok(())
} else {
Err(anyhow!(
"git failed in {} with status {:?}\nstdout:\n{}\nstderr:\n{}",
cwd.display(),
output.status.code(),
String::from_utf8_lossy(&output.stdout),
String::from_utf8_lossy(&output.stderr)
))
}
}
fn git_output<const N: usize>(args: [&str; N], cwd: &Path) -> Result<String> {
let output = Command::new("git")
.args(args)
.current_dir(cwd)
.output()
.with_context(|| format!("failed to run git in {}", cwd.display()))?;
if output.status.success() {
Ok(String::from_utf8_lossy(&output.stdout).trim().to_string())
} else {
Err(anyhow!(
"git failed in {} with status {:?}\nstdout:\n{}\nstderr:\n{}",
cwd.display(),
output.status.code(),
String::from_utf8_lossy(&output.stdout),
String::from_utf8_lossy(&output.stderr)
))
}
}
fn read_json(path: &Path) -> Result<Value> {
let bytes = fs::read(path).with_context(|| format!("failed to read {}", path.display()))?;
serde_json::from_slice(&bytes).with_context(|| format!("failed to parse {}", path.display()))
}
fn write_json(path: &Path, value: &Value) -> Result<()> {
if let Some(parent) = path.parent() {
fs::create_dir_all(parent)
.with_context(|| format!("failed to create {}", parent.display()))?;
}
fs::write(path, serde_json::to_vec_pretty(value)?)
.with_context(|| format!("failed to write {}", path.display()))
}
fn require_eq(value: &Value, path: &[&str], expected: &str) -> Result<()> {
let actual = path
.iter()
.try_fold(value, |current, key| current.get(*key))
.and_then(Value::as_str)
.unwrap_or("<missing>");
if actual == expected {
Ok(())
} else {
Err(anyhow!(
"expected {} to be {expected:?}, got {actual:?}",
path.join(".")
))
}
}
fn require_bool(value: &Value, path: &[&str], expected: bool) -> Result<()> {
let actual = path
.iter()
.try_fold(value, |current, key| current.get(*key))
.and_then(Value::as_bool);
if actual == Some(expected) {
Ok(())
} else {
Err(anyhow!(
"expected {} to be {expected}, got {:?}",
path.join("."),
actual
))
}
}
fn require_text(haystack: &str, needle: &str) -> Result<()> {
if haystack.contains(needle) {
Ok(())
} else {
Err(anyhow!(
"expected collaboration topic text to contain {needle:?}"
))
}
}
fn take_path(
args: &mut std::iter::Peekable<impl Iterator<Item = String>>,
flag: &str,
) -> Result<PathBuf> {
args.next()
.map(PathBuf::from)
.with_context(|| format!("missing value for {flag}"))
}
fn path_str(path: &Path) -> Result<&str> {
path.to_str()
.ok_or_else(|| anyhow!("path is not valid UTF-8: {}", path.display()))
}

View file

@ -1,504 +0,0 @@
use anyhow::Context;
use anyhow::Result;
use anyhow::anyhow;
use chrono::Utc;
use serde_json::Value;
use serde_json::json;
use std::env;
use std::fs;
use std::path::Path;
use std::path::PathBuf;
use std::process::Command;
fn main() -> Result<()> {
let args = Args::parse()?;
let result = run_smoke(args)?;
println!("{}", serde_json::to_string_pretty(&result)?);
Ok(())
}
#[derive(Clone, Debug)]
struct Args {
root: PathBuf,
}
impl Args {
fn parse() -> Result<Self> {
let mut root = env::current_dir().context("failed to resolve current directory")?;
let mut args = env::args().skip(1).peekable();
while let Some(arg) = args.next() {
match arg.as_str() {
"--root" => root = take_path(&mut args, "--root")?,
other => return Err(anyhow!("unexpected argument {other:?}")),
}
}
Ok(Self { root })
}
}
fn run_smoke(args: Args) -> Result<Value> {
let root = args
.root
.canonicalize()
.with_context(|| format!("failed to resolve {}", args.root.display()))?;
let smoke_root = root.join(".epiphany-smoke");
let manifest = root.join("epiphany-core").join("Cargo.toml");
if !manifest.exists() {
return Err(anyhow!(
"could not find epiphany-core manifest at {}",
manifest.display()
));
}
fs::create_dir_all(&smoke_root)
.with_context(|| format!("failed to create {}", smoke_root.display()))?;
let stamp = Utc::now().format("%Y%m%d-%H%M%S").to_string();
let smoke_dir = smoke_root.join(format!("repo-consensus-brief-family-{stamp}"));
fs::create_dir(&smoke_dir)
.with_context(|| format!("failed to claim fresh smoke dir {}", smoke_dir.display()))?;
let repo = smoke_dir.join("repo-body");
fs::create_dir_all(&repo).with_context(|| format!("failed to create {}", repo.display()))?;
git(["init"], &repo)?;
git(
["config", "user.email", "epiphany-smoke@example.invalid"],
&repo,
)?;
git(["config", "user.name", "Epiphany Smoke"], &repo)?;
fs::write(
repo.join("README.md"),
"# Repo Consensus Brief Family Smoke\n\nThis repository proves branch-local Imagination consensus briefs.\n",
)
.with_context(|| format!("failed to seed {}", repo.join("README.md").display()))?;
git(["add", "README.md"], &repo)?;
git(
["commit", "-m", "Seed repo consensus brief smoke body"],
&repo,
)?;
git(
["switch", "-c", "epiphany/repo-consensus-brief-family"],
&repo,
)?;
let item = "repo-consensus-brief-family";
let target_path = ".epiphany/consensus-briefs/repo-consensus-brief-family.toml";
let local_verse = repo.join(".epiphany").join("local-verse.ccmp");
cargo_json(
&manifest,
"epiphany-repo",
&[
"init",
"--workspace",
path_str(&repo)?,
"--epiphany-root",
path_str(&root)?,
"--swarm-id",
"repo-consensus-brief-family-smoke",
"--topic",
"repo-consensus-brief-family",
],
&root,
)?;
cargo_json(
&manifest,
"epiphany-swarm",
&[
"online",
"--workspace",
path_str(&repo)?,
"--epiphany-root",
path_str(&root)?,
"--runtime-id",
"repo-consensus-brief-family-smoke",
"--local-verse-store",
path_str(&local_verse)?,
],
&root,
)?;
cargo_json(
&manifest,
"epiphany-work",
&[
"accept",
"--workspace",
path_str(&repo)?,
"--from",
"persona",
"--item",
item,
"--summary",
"Summarize public Persona collaboration into an Imagination consensus brief before any candidate action is adopted.",
"--candidate-action-ref",
"candidate-action://repo-consensus-brief-family/draft-task-card",
"--candidate-action-ref",
"candidate-action://repo-consensus-brief-family/request-review",
"--public-discussion-ref",
"epiphany-global/persona-collaboration/repo-consensus-brief-family",
],
&root,
)?;
let plan = cargo_json(
&manifest,
"epiphany-work",
&[
"derive-plan",
"--workspace",
path_str(&repo)?,
"--item",
item,
"--action-family",
"repo-consensus-brief",
"--model-ref",
"repo-consensus-brief-family-smoke-imagination-v1",
"--model-authored",
],
&root,
)?;
for _ in 0..4 {
cargo_json(
&manifest,
"epiphany-work",
&[
"tick",
"--workspace",
path_str(&repo)?,
"--epiphany-root",
path_str(&root)?,
"--item",
item,
"--cooldown-seconds",
"0",
],
&root,
)?;
}
let close_path = repo
.join(".epiphany")
.join("work")
.join(format!("work-close-{item}.json"));
let close = read_json(&close_path)?;
let overview = cargo_json(
&manifest,
"epiphany-work",
&["overview", "--workspace", path_str(&repo)?, "--item", item],
&root,
)?;
let brief_text = fs::read_to_string(repo.join(target_path))
.with_context(|| format!("failed to read {}", repo.join(target_path).display()))?;
require_eq(
&plan,
&["derivation", "safeActionFamily"],
"repo.consensus_brief",
)?;
require_eq(&close, &["status"], "closed")?;
require_eq(&close, &["soul", "verdict"], "passed")?;
require_eq(
&close,
&["closureReview", "familyAssertions", "status"],
"passed",
)?;
require_bool(
&close,
&["closureReview", "sourceGrounding", "pathScopeMatched"],
true,
)?;
require_bool(&close, &["privateStateExposed"], false)?;
require_text(
&brief_text,
"schema_version = \"epiphany.repo_consensus_brief.v0\"",
)?;
require_text(&brief_text, "safe_action_family = \"repo.consensus_brief\"")?;
require_text(&brief_text, "[consensus]")?;
require_text(&brief_text, "status = \"draft\"")?;
require_text(&brief_text, "converged = false")?;
require_text(&brief_text, "conflicts_remaining = true")?;
require_text(&brief_text, "requires_additional_public_feedback = true")?;
require_text(
&brief_text,
"recommended_next_safe_family = \"repo.task_card\"",
)?;
require_text(&brief_text, "[imagination]")?;
require_text(&brief_text, "role = \"consensus-discovery\"")?;
require_text(&brief_text, "candidate_actions_non_authoritative = true")?;
require_text(&brief_text, "may_emit_action_items_receipt = true")?;
require_text(&brief_text, "must_not_read_private_verses = true")?;
require_text(&brief_text, "[inputs]")?;
require_text(
&brief_text,
"epiphany-global/persona-collaboration/repo-consensus-brief-family",
)?;
require_text(
&brief_text,
"candidate-action://repo-consensus-brief-family/draft-task-card",
)?;
require_text(&brief_text, "objective_adoption_authorized = false")?;
require_text(&brief_text, "hands_action_authorized = false")?;
require_text(&brief_text, "cross_body_mutation_authorized = false")?;
require_text(&brief_text, "mind_adoption_required = true")?;
require_text(&brief_text, "bifrost_publication_required = true")?;
require_text(&brief_text, "private_state_exposed = false")?;
require_eq(
&overview,
&["intakeConsensus", "schemaVersion"],
"epiphany.repo_work_intake_consensus_readback.v0",
)?;
require_eq(&overview, &["intakeConsensus", "owner"], "Self")?;
require_eq(
&overview,
&["intakeConsensus", "handoffRoute"],
"Persona->Imagination",
)?;
require_eq(
&overview,
&["intakeConsensus", "requestedConsensusRoute"],
"imagination.consensus_discovery",
)?;
require_eq(
&overview,
&["intakeConsensus", "planSafeActionFamily"],
"repo.consensus_brief",
)?;
require_bool(&overview, &["intakeConsensus", "planModelAuthored"], true)?;
require_bool(
&overview,
&["intakeConsensus", "handsAuthorityGranted"],
false,
)?;
require_bool(
&overview,
&["intakeConsensus", "durableStateAdmitted"],
false,
)?;
require_bool(
&overview,
&["intakeConsensus", "publicationAuthorized"],
false,
)?;
require_bool(
&overview,
&["intakeConsensus", "privateStateExposed"],
false,
)?;
require_u64(
&overview,
&["intakeConsensus", "publicDiscussionRefCount"],
1,
)?;
require_u64(
&overview,
&["intakeConsensus", "candidateActionRefCount"],
2,
)?;
require_eq(
&overview,
&["proofBundle", "intakeConsensus", "planSafeActionFamily"],
"repo.consensus_brief",
)?;
require_array_text_contains(&overview, &["verseProjection", "tuiRows"], "CONSENSUS |")?;
require_array_text_contains(
&overview,
&["verseProjection", "tuiRows"],
"route=imagination.consensus_discovery",
)?;
let summary = json!({
"schemaVersion": "epiphany.repo_work_consensus_brief_family_smoke.v0",
"status": "ok",
"smokeDir": smoke_dir,
"repo": repo,
"branch": git_output(["branch", "--show-current"], &repo)?,
"item": item,
"safeActionFamily": plan["derivation"]["safeActionFamily"],
"targetPath": target_path,
"closeStatus": close["status"],
"soulVerdict": close["soul"]["verdict"],
"familyAssertionsStatus": close["closureReview"]["familyAssertions"]["status"],
"pathScopeMatched": close["closureReview"]["sourceGrounding"]["pathScopeMatched"],
"briefIsDraft": true,
"intakeConsensusSchema": overview["intakeConsensus"]["schemaVersion"],
"intakeConsensusRoute": overview["intakeConsensus"]["requestedConsensusRoute"],
"intakeConsensusCandidateActionRefCount": overview["intakeConsensus"]["candidateActionRefCount"],
"intakeConsensusPlanSafeActionFamily": overview["intakeConsensus"]["planSafeActionFamily"],
"candidateActionsNonAuthoritative": true,
"mindAdoptionRequired": true,
"bifrostPublicationRequired": true,
"privateStateExposed": false,
});
write_json(&smoke_dir.join("summary.json"), &summary)?;
Ok(summary)
}
fn cargo_json(manifest: &Path, bin: &str, args: &[&str], cwd: &Path) -> Result<Value> {
let output = Command::new("cargo")
.arg("run")
.arg("--quiet")
.arg("--manifest-path")
.arg(manifest)
.arg("--bin")
.arg(bin)
.arg("--")
.args(args)
.current_dir(cwd)
.output()
.with_context(|| format!("failed to run cargo bin {bin}"))?;
if !output.status.success() {
return Err(anyhow!(
"{bin} failed with status {:?}\nstdout:\n{}\nstderr:\n{}",
output.status.code(),
String::from_utf8_lossy(&output.stdout),
String::from_utf8_lossy(&output.stderr)
));
}
serde_json::from_slice(&output.stdout).with_context(|| {
format!(
"{bin} did not emit JSON on stdout:\n{}",
String::from_utf8_lossy(&output.stdout)
)
})
}
fn git<const N: usize>(args: [&str; N], cwd: &Path) -> Result<()> {
let output = Command::new("git")
.args(args)
.current_dir(cwd)
.output()
.with_context(|| format!("failed to run git in {}", cwd.display()))?;
if output.status.success() {
Ok(())
} else {
Err(anyhow!(
"git failed in {} with status {:?}\nstdout:\n{}\nstderr:\n{}",
cwd.display(),
output.status.code(),
String::from_utf8_lossy(&output.stdout),
String::from_utf8_lossy(&output.stderr)
))
}
}
fn git_output<const N: usize>(args: [&str; N], cwd: &Path) -> Result<String> {
let output = Command::new("git")
.args(args)
.current_dir(cwd)
.output()
.with_context(|| format!("failed to run git in {}", cwd.display()))?;
if output.status.success() {
Ok(String::from_utf8_lossy(&output.stdout).trim().to_string())
} else {
Err(anyhow!(
"git failed in {} with status {:?}\nstdout:\n{}\nstderr:\n{}",
cwd.display(),
output.status.code(),
String::from_utf8_lossy(&output.stdout),
String::from_utf8_lossy(&output.stderr)
))
}
}
fn read_json(path: &Path) -> Result<Value> {
let bytes = fs::read(path).with_context(|| format!("failed to read {}", path.display()))?;
serde_json::from_slice(&bytes).with_context(|| format!("failed to parse {}", path.display()))
}
fn write_json(path: &Path, value: &Value) -> Result<()> {
if let Some(parent) = path.parent() {
fs::create_dir_all(parent)
.with_context(|| format!("failed to create {}", parent.display()))?;
}
fs::write(path, serde_json::to_vec_pretty(value)?)
.with_context(|| format!("failed to write {}", path.display()))
}
fn require_eq(value: &Value, path: &[&str], expected: &str) -> Result<()> {
let actual = path
.iter()
.try_fold(value, |current, key| current.get(*key))
.and_then(Value::as_str)
.unwrap_or("<missing>");
if actual == expected {
Ok(())
} else {
Err(anyhow!(
"expected {} to be {expected:?}, got {actual:?}",
path.join(".")
))
}
}
fn require_bool(value: &Value, path: &[&str], expected: bool) -> Result<()> {
let actual = path
.iter()
.try_fold(value, |current, key| current.get(*key))
.and_then(Value::as_bool);
if actual == Some(expected) {
Ok(())
} else {
Err(anyhow!(
"expected {} to be {expected}, got {:?}",
path.join("."),
actual
))
}
}
fn require_u64(value: &Value, path: &[&str], expected: u64) -> Result<()> {
let actual = path
.iter()
.try_fold(value, |current, key| current.get(*key))
.and_then(Value::as_u64);
if actual == Some(expected) {
Ok(())
} else {
Err(anyhow!(
"expected {} to be {expected}, got {:?}",
path.join("."),
actual
))
}
}
fn require_array_text_contains(value: &Value, path: &[&str], needle: &str) -> Result<()> {
let values = path
.iter()
.try_fold(value, |current, key| current.get(*key))
.and_then(Value::as_array)
.cloned()
.unwrap_or_default();
if values
.iter()
.filter_map(Value::as_str)
.any(|row| row.contains(needle))
{
Ok(())
} else {
Err(anyhow!(
"expected {} to contain {needle:?}, got {:?}",
path.join("."),
values
))
}
}
fn require_text(haystack: &str, needle: &str) -> Result<()> {
if haystack.contains(needle) {
Ok(())
} else {
Err(anyhow!(
"expected consensus brief text to contain {needle:?}"
))
}
}
fn take_path(
args: &mut std::iter::Peekable<impl Iterator<Item = String>>,
flag: &str,
) -> Result<PathBuf> {
args.next()
.map(PathBuf::from)
.with_context(|| format!("missing value for {flag}"))
}
fn path_str(path: &Path) -> Result<&str> {
path.to_str()
.ok_or_else(|| anyhow!("path is not valid UTF-8: {}", path.display()))
}

View file

@ -7,10 +7,11 @@ use epiphany_core::{
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,
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,
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,
};
use serde_json::json;
@ -26,11 +27,30 @@ fn main() -> Result<()> {
authenticate_resident_self_policy(&mut args.policy)?;
args.policy.validate()?;
validate_resident_self_store_separation(&args.state_store, &args.policy)?;
validate_persona_feedback_store_separation(
&args.persona_feedback_source_store,
&args.persona_feedback_store,
&[
&args.bifrost_feedback_trust_anchor,
&args.state_store,
&args.policy.runtime_store,
&args.policy.local_verse_store,
&args.policy.agent_memory_store,
&args.policy.release_store,
],
)?;
if args.heartbeat_store == args.state_store {
return Err(anyhow!(
"heartbeat and resident Self stores must be physically separate"
));
}
validate_bifrost_persona_feedback_source(
&args.persona_feedback_source_store,
&args.bifrost_feedback_trust_anchor,
&args.policy.release_runtime_id,
&args.feedback_target_repository,
&args.feedback_target_persona,
)?;
if matches!(args.command, CommandKind::Status) {
let now = Utc::now().timestamp_millis().max(0) as u64;
let projection = derive_resident_cognition_readiness(ResidentReadinessRequest {
@ -106,10 +126,18 @@ fn cycle(
ports: &mut NativePorts,
) -> Result<ResidentSelfOutcome> {
let now = Utc::now().timestamp_millis().max(0) as u64;
import_bifrost_persona_feedback_deliveries(
&args.persona_feedback_source_store,
&args.persona_feedback_store,
&args.bifrost_feedback_trust_anchor,
&args.policy.release_runtime_id,
&args.feedback_target_repository,
&args.feedback_target_persona,
)?;
ingest_resident_self_domain_pressure(
&args.state_store,
&args.policy.runtime_store,
&args.policy.local_verse_store,
&args.persona_feedback_store,
&args.policy.release_runtime_id,
now,
)?;
@ -278,6 +306,11 @@ struct Args {
state_store: PathBuf,
heartbeat_store: PathBuf,
provider_freshness_seconds: u64,
persona_feedback_source_store: PathBuf,
persona_feedback_store: PathBuf,
bifrost_feedback_trust_anchor: PathBuf,
feedback_target_repository: String,
feedback_target_persona: String,
policy: ResidentSelfPolicy,
pressure: Option<ResidentSelfPressure>,
}
@ -372,6 +405,17 @@ impl Args {
state_store: path("--state-store")?,
heartbeat_store: path("--heartbeat-store")?,
provider_freshness_seconds: u64v("--provider-freshness-seconds", 180)?,
persona_feedback_source_store: path("--persona-feedback-source-store")?,
persona_feedback_store: path("--persona-feedback-store")?,
bifrost_feedback_trust_anchor: path("--bifrost-feedback-trust-anchor")?,
feedback_target_repository: value
.get("--feedback-target-repository")
.cloned()
.ok_or_else(|| anyhow!("missing --feedback-target-repository"))?,
feedback_target_persona: value
.get("--feedback-target-persona")
.cloned()
.ok_or_else(|| anyhow!("missing --feedback-target-persona"))?,
policy,
pressure,
})

View file

@ -32,15 +32,12 @@ use epiphany_core::default_epiphany_cultmesh_swarm_brake;
use epiphany_core::epiphany_cluster_service_execution_audit_report;
use epiphany_core::epiphany_cultmesh_agent_state_soa_summary_from_entry;
use epiphany_core::epiphany_cultmesh_bifrost_body_change_publication_intent;
use epiphany_core::epiphany_cultmesh_bifrost_collaboration_feedback;
use epiphany_core::epiphany_cultmesh_daemon_poke_intent_from_status;
use epiphany_core::epiphany_cultmesh_daemon_poke_receipt_for_intent;
use epiphany_core::epiphany_cultmesh_daemon_tool_invocation_intent_from_capability;
use epiphany_core::epiphany_cultmesh_eve_connection_intent_from_advertisement;
use epiphany_core::epiphany_service_execution_audit_report;
use epiphany_core::load_agent_state_soa_entry;
use epiphany_core::load_arrival_latest_epiphany_cultmesh_bifrost_body_change_publication_intent;
use epiphany_core::load_arrival_latest_epiphany_cultmesh_bifrost_collaboration_feedback;
use epiphany_core::load_epiphany_cultmesh_cluster_topology;
use epiphany_core::load_epiphany_cultmesh_daemon_liveness;
use epiphany_core::load_epiphany_cultmesh_daemon_restart_policy_directory;
@ -58,8 +55,6 @@ use epiphany_core::load_epiphany_cultmesh_swarm_brake;
use epiphany_core::load_latest_epiphany_cultmesh_agent_state_soa_summary;
use epiphany_core::load_latest_epiphany_cultmesh_daemon_service_lifecycle_receipt;
use epiphany_core::load_latest_epiphany_cultmesh_daemon_tool_invocation_intent;
use epiphany_core::load_latest_epiphany_cultmesh_eve_connection_intent;
use epiphany_core::load_latest_epiphany_cultmesh_eve_connection_receipt;
use epiphany_core::load_latest_epiphany_cultmesh_idunn_aftercare_audit_receipt;
use epiphany_core::load_latest_epiphany_cultmesh_idunn_deployment_receipt;
use epiphany_core::load_latest_epiphany_cultmesh_repo_work_map_entry;
@ -73,13 +68,11 @@ use epiphany_core::query_epiphany_local_verse_context;
use epiphany_core::seed_epiphany_local_verse_context;
use epiphany_core::write_epiphany_cultmesh_agent_state_soa_summary;
use epiphany_core::write_epiphany_cultmesh_bifrost_body_change_publication_intent;
use epiphany_core::write_epiphany_cultmesh_bifrost_collaboration_feedback;
use epiphany_core::write_epiphany_cultmesh_daemon_poke_intent;
use epiphany_core::write_epiphany_cultmesh_daemon_poke_receipt;
use epiphany_core::write_epiphany_cultmesh_daemon_restart_policy;
use epiphany_core::write_epiphany_cultmesh_daemon_status;
use epiphany_core::write_epiphany_cultmesh_daemon_tool_invocation_intent;
use epiphany_core::write_epiphany_cultmesh_eve_connection_intent;
use epiphany_core::write_epiphany_cultmesh_swarm_brake;
use epiphany_core::write_epiphany_cultmesh_work_loop_telemetry;
use serde::Serialize;
@ -96,8 +89,6 @@ const DIRECT_MANAGED_SERVICE_SIGHT_COMMAND: &str = "epiphany-verse-query managed
const WRAPPER_SWARM_ONLINE_RUNBOOK_COMMAND: &str =
"tools/epiphany_local_run.ps1 -Mode swarm-online-runbook";
const WRAPPER_POKE_NON_READY_COMMAND: &str = "tools/epiphany_local_run.ps1 -Mode swarm-poke-down";
const WRAPPER_COLLABORATION_FEEDBACK_COMMAND: &str =
"tools/epiphany_local_run.ps1 -Mode collaboration-feedback";
const WRAPPER_BIFROST_PUBLICATION_COMMAND: &str =
"tools/epiphany_local_run.ps1 -Mode bifrost-publication";
const WRAPPER_RECEIPT_DIRECTORY_COMMAND: &str =
@ -1024,215 +1015,8 @@ fn run_cli() -> Result<()> {
anyhow::bail!("historical-only: canonical frontier workflow required")
}
"collaboration-feedback" | "persona-feedback" => {
if args.receipt_id.is_some()
|| args.receipt_status.is_some()
|| args.imagination_agent_ids.is_some()
|| args.consensus_packet_ref.is_some()
{
anyhow::bail!(
"collaboration-feedback accepts Persona feedback fields only; Imagination owns consensus receipt, participants, packet, status, and adoption gate"
);
}
require_query_bootstrap(&args)?;
let feedback_id = args
.feedback_id
.clone()
.unwrap_or_else(|| "collaboration-feedback".to_string());
let source_persona_id = args
.source_persona_id
.clone()
.unwrap_or_else(|| "epiphany.Persona".to_string());
let source_cluster_id = args
.source_cluster_id
.clone()
.unwrap_or_else(|| "epiphany.cluster.persona".to_string());
let public_room_id = args
.public_room_id
.clone()
.unwrap_or_else(|| "epiphany-global/collaboration".to_string());
let eve_connection_receipt_id = args
.eve_connection_receipt_id
.clone()
.context("collaboration-feedback requires --eve-connection-receipt-id")?;
let provider_connection_receipt =
load_latest_epiphany_cultmesh_eve_connection_receipt(
&args.store,
args.runtime_id.clone(),
)?
.filter(|receipt| receipt.receipt_id == eve_connection_receipt_id)
.with_context(|| {
format!(
"collaboration-feedback requires a persisted Eve provider receipt {eve_connection_receipt_id:?}; a consumer intent is not acceptance"
)
})?;
if provider_connection_receipt.status.trim().is_empty() {
anyhow::bail!("persisted Eve provider receipt has no status");
}
let collaboration_topic = args
.collaboration_topic
.clone()
.context("collaboration-feedback requires --collaboration-topic")?;
let feedback_summary = args
.feedback_summary
.clone()
.context("collaboration-feedback requires --feedback-summary")?;
let public_discussion_refs = required_list(
&args.public_discussion_refs,
"collaboration-feedback requires --public-discussion-ref",
)?;
let candidate_action_refs = args.candidate_action_refs.clone().unwrap_or_default();
let feedback = epiphany_cultmesh_bifrost_collaboration_feedback(
feedback_id,
source_persona_id,
source_cluster_id,
public_room_id,
eve_connection_receipt_id,
collaboration_topic,
feedback_summary,
public_discussion_refs,
candidate_action_refs,
);
let written_feedback = write_epiphany_cultmesh_bifrost_collaboration_feedback(
&args.store,
args.runtime_id.clone(),
feedback.clone(),
)?;
let arrival_latest_feedback =
load_arrival_latest_epiphany_cultmesh_bifrost_collaboration_feedback(
&args.store,
args.runtime_id.clone(),
)?;
if arrival_latest_feedback
.as_ref()
.map(|feedback| feedback.feedback_id.as_str())
!= Some(written_feedback.feedback_id.as_str())
{
anyhow::bail!("local Verse query lost collaboration feedback after write");
}
println!(
"{}",
serde_json::to_string_pretty(&json!({
"status": "pending-imagination",
"store": args.store,
"runtimeId": args.runtime_id,
"feedbackId": written_feedback.feedback_id,
"consensusReceiptId": null,
"requestedConsensusRoute": written_feedback.requested_consensus_route,
"consensusPacketRef": null,
"adoptionGate": null,
"responseOwner": "Imagination",
"commands": {
"bifrostPublication": DIRECT_BIFROST_PUBLICATION_COMMAND,
"wrapperBifrostPublication": WRAPPER_BIFROST_PUBLICATION_COMMAND,
"wrapperCollaborationFeedback": WRAPPER_COLLABORATION_FEEDBACK_COMMAND
},
"publicDiscussionRefs": written_feedback.public_discussion_refs,
"candidateActionRefs": written_feedback.candidate_action_refs,
"tuiRows": [format!("FEEDBACK | {} | owner={} | status=pending-imagination | route={} | publicRefs={} | candidateActions={} | private=false", written_feedback.collaboration_topic, written_feedback.source_persona_id, written_feedback.requested_consensus_route, written_feedback.public_discussion_refs.len(), written_feedback.candidate_action_refs.len())],
"privateStateIncluded": written_feedback.private_state_included,
"privateStateExposed": false,
}))?
);
}
"connect-eve" | "eve-connection" => {
if args.receipt_id.is_some() || args.receipt_status.is_some() {
anyhow::bail!(
"connect-eve accepts consumer intent fields only; the advertised Eve provider owns connection receipt id and status"
);
}
require_query_bootstrap(&args)?;
let directory =
load_epiphany_cultmesh_eve_surface_directory(&args.store, args.runtime_id.clone())?;
let (_target_cluster, target, _target_surface) = if let Some(advertisement_id) =
args.advertisement_id.as_deref()
{
directory
.into_iter()
.find(|(_cluster, advertisement, _surface)| {
advertisement.advertisement_id == advertisement_id
})
.with_context(|| {
format!("connect-eve unavailable: no provenance-bearing Odin advertisement {advertisement_id:?}")
})?
} else {
let target_cluster_id = args
.target_cluster_id
.as_deref()
.context("connect-eve requires --advertisement-id or --target-cluster-id")?;
directory
.into_iter()
.find(|(_cluster, advertisement, _surface)| {
advertisement.cluster_id == target_cluster_id
})
.with_context(|| {
format!(
"connect-eve unavailable: no provenance-bearing Odin advertisement for cluster {target_cluster_id:?}"
)
})?
};
let intent_id = args
.intent_id
.clone()
.unwrap_or_else(|| "eve-connection-intent".to_string());
let requesting_cluster_id = args
.source_cluster_id
.clone()
.unwrap_or_else(|| "epiphany.cluster.self".to_string());
let reason = args.reason.clone().unwrap_or_else(|| {
format!(
"Request compact Eve collaboration with {} through Odin advertisement {}.",
target.cluster_id, target.advertisement_id
)
});
let requested_action = args
.requested_action
.clone()
.unwrap_or_else(|| "requestDiscussion".to_string());
let intent = epiphany_cultmesh_eve_connection_intent_from_advertisement(
intent_id,
requesting_cluster_id,
&target,
reason,
requested_action,
);
let written_intent = write_epiphany_cultmesh_eve_connection_intent(
&args.store,
args.runtime_id.clone(),
intent.clone(),
)?;
let latest_intent = load_latest_epiphany_cultmesh_eve_connection_intent(
&args.store,
args.runtime_id.clone(),
)?;
if latest_intent
.as_ref()
.map(|intent| intent.intent_id.as_str())
!= Some(written_intent.intent_id.as_str())
{
anyhow::bail!("local Verse query lost Eve connection intent after write");
}
println!(
"{}",
serde_json::to_string_pretty(&json!({
"status": "pending-provider",
"store": args.store,
"runtimeId": args.runtime_id,
"intentId": written_intent.intent_id,
"receiptId": null,
"receiptStatus": null,
"responseOwner": written_intent.target_cluster_id,
"targetAdvertisementId": written_intent.target_advertisement_id,
"targetClusterId": written_intent.target_cluster_id,
"targetEveSurfaceId": written_intent.target_eve_surface_id,
"requestedAction": written_intent.requested_action,
"feedbackRoute": written_intent.feedback_route,
"privateStateRequested": written_intent.private_state_requested,
"privateStateExposed": false,
}))?
anyhow::bail!(
"collaboration-feedback cannot author Bifrost admission locally; submit feedback to Bifrost and ingest its authenticated, target-bound admission receipt"
);
}
"smoke" => {
@ -1717,27 +1501,7 @@ fn run_cli() -> Result<()> {
args.runtime_id.clone(),
bifrost_intent.clone(),
)?;
let feedback = epiphany_cultmesh_bifrost_collaboration_feedback(
"collaboration-feedback-smoke",
"epiphany.Persona",
"epiphany.persona",
"epiphany-global/collaboration",
"eve-receipt-smoke",
"Persona requests cross-body collaboration over an advertised Eve surface.",
"Persona discussion asks Imagination to compare collaboration options before work adoption.",
vec![
"https://gamecult.org/Blog/purge-the-heretek-from-our-daemonic-swarm"
.to_string(),
],
vec!["candidate-action:open-collaboration-thread".to_string()],
);
write_epiphany_cultmesh_bifrost_collaboration_feedback(
&args.store,
args.runtime_id.clone(),
feedback,
)?;
if !WRAPPER_COLLABORATION_FEEDBACK_COMMAND.contains("-Mode collaboration-feedback")
|| !WRAPPER_BIFROST_PUBLICATION_COMMAND.contains("-Mode bifrost-publication")
if !WRAPPER_BIFROST_PUBLICATION_COMMAND.contains("-Mode bifrost-publication")
|| !DIRECT_BIFROST_PUBLICATION_COMMAND.contains("bifrost-publication")
|| !DIRECT_BIFROST_PUBLICATION_COMMAND.contains("--changed-path <path>")
{
@ -1869,10 +1633,6 @@ fn run_cli() -> Result<()> {
|| context
.arrival_latest_bifrost_github_publication_receipt
.is_some()
|| context
.arrival_latest_bifrost_collaboration_feedback
.is_none()
|| context.latest_imagination_consensus_receipt.is_some()
|| context.latest_work_loop_summary.is_none()
|| context.latest_agent_state_soa_summary.is_none()
{
@ -1951,12 +1711,6 @@ fn run_cli() -> Result<()> {
&& row.latest_id == "missing"
&& row.follow_up_command == "none"
})
|| !receipt_directory.rows.iter().any(|row| {
row.family == "eve-connection"
&& !row.present
&& row.latest_id == "missing"
&& row.follow_up_command == "none"
})
|| !receipt_directory.rows.iter().any(|row| {
row.family == "bifrost-publication"
&& !row.present
@ -2184,8 +1938,6 @@ fn run_cli() -> Result<()> {
"daemonStatuses": context.daemon_statuses.len(),
"swarmBrake": context.swarm_brake.as_ref().map(|brake| brake.status.clone()),
"daemonTools": context.daemon_tool_capabilities.len(),
"latestEveIntent": context.latest_eve_connection_intent.as_ref().map(|intent| intent.intent_id.clone()),
"latestEveReceipt": context.latest_eve_connection_receipt.as_ref().map(|receipt| receipt.receipt_id.clone()),
"latestToolInvocationIntent": context.latest_daemon_tool_invocation_intent.as_ref().map(|intent| intent.intent_id.clone()),
"latestToolInvocationReceipt": context.latest_daemon_tool_invocation_receipt.as_ref().map(|receipt| receipt.receipt_id.clone()),
"latestDaemonPokeIntent": context.latest_daemon_poke_intent.as_ref().map(|intent| intent.intent_id.clone()),
@ -2193,8 +1945,6 @@ fn run_cli() -> Result<()> {
"arrivalLatestBifrostPublicationIntent": context.arrival_latest_bifrost_body_change_publication_intent.as_ref().map(|intent| intent.intent_id.clone()),
"arrivalLatestBifrostPublicationReceipt": context.arrival_latest_bifrost_body_change_publication_receipt.as_ref().map(|receipt| receipt.receipt_id.clone()),
"arrivalLatestBifrostGithubReceipt": context.arrival_latest_bifrost_github_publication_receipt.as_ref().map(|receipt| receipt.receipt_id.clone()),
"arrivalLatestBifrostCollaborationFeedback": context.arrival_latest_bifrost_collaboration_feedback.as_ref().map(|feedback| feedback.feedback_id.clone()),
"latestImaginationConsensusReceipt": context.latest_imagination_consensus_receipt.as_ref().map(|receipt| receipt.receipt_id.clone()),
"latestWorkLoopTelemetry": context.latest_work_loop_summary.as_ref().map(|summary| summary.telemetry_id.clone()),
"latestAgentStateSoaSummary": context.latest_agent_state_soa_summary.as_ref().map(|summary| summary.summary_id.clone()),
"latestRepoWorkOverview": latest_repo_work_overview.as_ref().map(|overview| overview.overview_id.clone()),
@ -6019,46 +5769,6 @@ fn receipt_directory_report(
.unwrap_or(false),
},
);
push_receipt_directory_row(
&mut rows,
&mut tui_rows,
ReceiptDirectoryRow {
family: "eve-connection".to_string(),
owner: context
.latest_eve_connection_receipt
.as_ref()
.map(|receipt| receipt.target_cluster_id.clone())
.unwrap_or_else(|| "target-provider".to_string()),
document_kind: "epiphany.cultmesh.eve_connection_receipt.v0".to_string(),
latest_id: context
.latest_eve_connection_receipt
.as_ref()
.map(|receipt| receipt.receipt_id.clone())
.unwrap_or_else(|| "missing".to_string()),
status: context
.latest_eve_connection_receipt
.as_ref()
.map(|receipt| receipt.status.clone())
.unwrap_or_else(|| "missing".to_string()),
route: context
.latest_eve_connection_receipt
.as_ref()
.map(|receipt| receipt.target_eve_surface_id.clone())
.unwrap_or_else(|| "none".to_string()),
service_id: "none".to_string(),
service_route: "none".to_string(),
follow_up_command: "none".to_string(),
artifact_ref: "none".to_string(),
artifact_status: "none".to_string(),
artifact_sha256: "none".to_string(),
present: context.latest_eve_connection_receipt.is_some(),
private_state_exposed: context
.latest_eve_connection_receipt
.as_ref()
.map(|receipt| receipt.private_state_exposed)
.unwrap_or(false),
},
);
push_receipt_directory_row(
&mut rows,
&mut tui_rows,
@ -6153,42 +5863,6 @@ fn receipt_directory_report(
.unwrap_or(false),
},
);
push_receipt_directory_row(
&mut rows,
&mut tui_rows,
ReceiptDirectoryRow {
family: "imagination-consensus".to_string(),
owner: "Imagination".to_string(),
document_kind: "epiphany.cultmesh.imagination_consensus_receipt.v0".to_string(),
latest_id: context
.latest_imagination_consensus_receipt
.as_ref()
.map(|receipt| receipt.receipt_id.clone())
.unwrap_or_else(|| "missing".to_string()),
status: context
.latest_imagination_consensus_receipt
.as_ref()
.map(|receipt| receipt.status.clone())
.unwrap_or_else(|| "missing".to_string()),
route: context
.latest_imagination_consensus_receipt
.as_ref()
.map(|receipt| receipt.adoption_gate.clone())
.unwrap_or_else(|| "none".to_string()),
service_id: "none".to_string(),
service_route: "none".to_string(),
follow_up_command: WRAPPER_COLLABORATION_FEEDBACK_COMMAND.to_string(),
artifact_ref: "none".to_string(),
artifact_status: "none".to_string(),
artifact_sha256: "none".to_string(),
present: context.latest_imagination_consensus_receipt.is_some(),
private_state_exposed: context
.latest_imagination_consensus_receipt
.as_ref()
.map(|receipt| receipt.private_state_exposed)
.unwrap_or(false),
},
);
push_receipt_directory_row(
&mut rows,
&mut tui_rows,
@ -7325,19 +6999,7 @@ struct Args {
source_cluster_id: Option<String>,
source_agent_id: Option<String>,
body_domain: Option<String>,
feedback_id: Option<String>,
source_persona_id: Option<String>,
public_room_id: Option<String>,
eve_connection_receipt_id: Option<String>,
collaboration_topic: Option<String>,
feedback_summary: Option<String>,
public_discussion_refs: Option<Vec<String>>,
candidate_action_refs: Option<Vec<String>>,
imagination_agent_ids: Option<Vec<String>>,
consensus_packet_ref: Option<String>,
advertisement_id: Option<String>,
target_cluster_id: Option<String>,
requested_action: Option<String>,
affected_clusters: Option<Vec<String>>,
protected_surfaces: Option<Vec<String>>,
}
@ -7383,19 +7045,7 @@ impl Args {
let mut source_cluster_id = None;
let mut source_agent_id = None;
let mut body_domain = None;
let mut feedback_id = None;
let mut source_persona_id = None;
let mut public_room_id = None;
let mut eve_connection_receipt_id = None;
let mut collaboration_topic = None;
let mut feedback_summary = None;
let mut public_discussion_refs = Vec::new();
let mut candidate_action_refs = Vec::new();
let mut imagination_agent_ids = Vec::new();
let mut consensus_packet_ref = None;
let mut advertisement_id = None;
let mut target_cluster_id = None;
let mut requested_action = None;
let mut affected_clusters = Vec::new();
let mut protected_surfaces = Vec::new();
@ -7560,77 +7210,9 @@ impl Args {
"--body-domain" => {
body_domain = Some(values.next().context("missing --body-domain value")?);
}
"--feedback-id" => {
feedback_id = Some(values.next().context("missing --feedback-id value")?);
}
"--source-persona-id" => {
source_persona_id =
Some(values.next().context("missing --source-persona-id value")?);
}
"--public-room-id" => {
public_room_id = Some(values.next().context("missing --public-room-id value")?);
}
"--eve-connection-receipt-id" => {
eve_connection_receipt_id = Some(
values
.next()
.context("missing --eve-connection-receipt-id value")?,
);
}
"--collaboration-topic" => {
collaboration_topic = Some(
values
.next()
.context("missing --collaboration-topic value")?,
);
}
"--feedback-summary" => {
feedback_summary =
Some(values.next().context("missing --feedback-summary value")?);
}
"--public-discussion-ref" | "--public-discussion-refs" => {
extend_list(
&mut public_discussion_refs,
values
.next()
.context("missing --public-discussion-ref value")?,
);
}
"--candidate-action-ref" | "--candidate-action-refs" => {
extend_list(
&mut candidate_action_refs,
values
.next()
.context("missing --candidate-action-ref value")?,
);
}
"--imagination-agent-id" | "--imagination-agent-ids" => {
extend_list(
&mut imagination_agent_ids,
values
.next()
.context("missing --imagination-agent-id value")?,
);
}
"--consensus-packet-ref" => {
consensus_packet_ref = Some(
values
.next()
.context("missing --consensus-packet-ref value")?,
);
}
"--advertisement-id" => {
advertisement_id =
Some(values.next().context("missing --advertisement-id value")?);
}
"--target-cluster-id" => {
target_cluster_id =
Some(values.next().context("missing --target-cluster-id value")?);
}
"--requested-action" => {
requested_action =
Some(values.next().context("missing --requested-action value")?);
}
_ => anyhow::bail!("unknown argument {arg:?}"),
}
}
@ -7681,19 +7263,7 @@ impl Args {
source_cluster_id,
source_agent_id,
body_domain,
feedback_id,
source_persona_id,
public_room_id,
eve_connection_receipt_id,
collaboration_topic,
feedback_summary,
public_discussion_refs: some_if_not_empty(public_discussion_refs),
candidate_action_refs: some_if_not_empty(candidate_action_refs),
imagination_agent_ids: some_if_not_empty(imagination_agent_ids),
consensus_packet_ref,
advertisement_id,
target_cluster_id,
requested_action,
affected_clusters: some_if_not_empty(affected_clusters),
protected_surfaces: some_if_not_empty(protected_surfaces),
})