Publish repo work proof rows to CultMesh

This commit is contained in:
Meta Vens 2026-06-20 03:43:26 +01:00
commit 462869ed75
8 changed files with 488 additions and 5 deletions

View file

@ -21,6 +21,7 @@ use epiphany_core::EpiphanyCultMeshEveSurfaceStateEntry;
use epiphany_core::EpiphanyCultMeshImaginationConsensusReceiptEntry;
use epiphany_core::EpiphanyCultMeshOdinAdvertisementEntry;
use epiphany_core::EpiphanyCultMeshRepoWorkOverviewEntry;
use epiphany_core::EpiphanyCultMeshRepoWorkPublicProofEntry;
use epiphany_core::EpiphanyCultMeshSwarmBrakeEntry;
use epiphany_core::EpiphanyCultMeshWorkLoopTelemetryEntry;
use epiphany_core::EpiphanyLocalVerseContext;
@ -48,6 +49,7 @@ use epiphany_core::load_epiphany_cultmesh_daemon_service_lifecycle_receipts;
use epiphany_core::load_epiphany_cultmesh_daemon_tool_directory;
use epiphany_core::load_epiphany_cultmesh_eve_surface_directory;
use epiphany_core::load_epiphany_cultmesh_repo_work_overviews;
use epiphany_core::load_epiphany_cultmesh_repo_work_public_proofs;
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_bifrost_body_change_publication_intent;
@ -61,6 +63,7 @@ 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_imagination_consensus_receipt;
use epiphany_core::load_latest_epiphany_cultmesh_repo_work_overview;
use epiphany_core::load_latest_epiphany_cultmesh_repo_work_public_proof;
use epiphany_core::open_epiphany_cultmesh_node;
use epiphany_core::query_epiphany_local_verse_context;
use epiphany_core::seed_epiphany_local_verse_context;
@ -3442,6 +3445,7 @@ fn run_cli() -> Result<()> {
&[],
&[missing_artifact_action],
&[],
&[],
);
if !missing_artifact_rows.iter().any(|row| {
row.priority == 50
@ -3491,6 +3495,7 @@ fn run_cli() -> Result<()> {
&[],
&[synthetic_runbook_action],
&[],
&[],
);
if !synthetic_artifact_rows.iter().any(|row| {
row.priority == 50
@ -3945,10 +3950,13 @@ struct SwarmOverviewReport {
service_execution_failed_check_tui_rows: Vec<String>,
repo_work_overview_rows: Vec<RepoWorkOverviewRow>,
repo_work_overview_tui_rows: Vec<String>,
repo_work_public_proof_rows: Vec<RepoWorkPublicProofRow>,
repo_work_public_proof_tui_rows: Vec<String>,
latest_repo_work_overview_id: Option<String>,
latest_repo_work_gate: Option<String>,
latest_repo_work_blocker: Option<String>,
latest_repo_work_next_safe_move: Option<String>,
latest_repo_work_public_proof: Option<String>,
topology_report: ClusterTopologyReport,
daemon_report: DaemonLivenessReport,
surface_report: EveSurfaceReport,
@ -3976,6 +3984,27 @@ struct RepoWorkOverviewRow {
private_state_exposed: bool,
}
#[derive(Clone, Serialize)]
#[serde(rename_all = "camelCase")]
struct RepoWorkPublicProofRow {
public_proof_id: String,
workspace: String,
item: String,
branch: String,
current_gate: String,
blocker: String,
next_safe_move: String,
changed_path_count: usize,
commit_sha: String,
soul_verdict: String,
upstream_main_synced: bool,
artifact_row_count: u32,
publication_row_count: u32,
public_proof_ref: String,
public_proof_sha256: String,
private_state_exposed: bool,
}
#[derive(Clone, Serialize)]
#[serde(rename_all = "camelCase")]
struct SwarmActionRow {
@ -4060,10 +4089,14 @@ struct SwarmOverviewOutput {
repo_work_overview_count: usize,
repo_work_overview_rows: Vec<RepoWorkOverviewRow>,
repo_work_overview_tui_rows: Vec<String>,
repo_work_public_proof_count: usize,
repo_work_public_proof_rows: Vec<RepoWorkPublicProofRow>,
repo_work_public_proof_tui_rows: Vec<String>,
latest_repo_work_overview: Option<String>,
latest_repo_work_gate: Option<String>,
latest_repo_work_blocker: Option<String>,
latest_repo_work_next_safe_move: Option<String>,
latest_repo_work_public_proof: Option<String>,
policy_covered_count: usize,
policy_enabled_count: usize,
policy_disabled_count: usize,
@ -4127,10 +4160,14 @@ impl SwarmOverviewOutput {
repo_work_overview_count: report.repo_work_overview_rows.len(),
repo_work_overview_rows: report.repo_work_overview_rows,
repo_work_overview_tui_rows: report.repo_work_overview_tui_rows,
repo_work_public_proof_count: report.repo_work_public_proof_rows.len(),
repo_work_public_proof_rows: report.repo_work_public_proof_rows,
repo_work_public_proof_tui_rows: report.repo_work_public_proof_tui_rows,
latest_repo_work_overview: report.latest_repo_work_overview_id,
latest_repo_work_gate: report.latest_repo_work_gate,
latest_repo_work_blocker: report.latest_repo_work_blocker,
latest_repo_work_next_safe_move: report.latest_repo_work_next_safe_move,
latest_repo_work_public_proof: report.latest_repo_work_public_proof,
policy_covered_count: report.policy_report.covered_count,
policy_enabled_count: report.policy_report.enabled_count,
policy_disabled_count: report.policy_report.disabled_count,
@ -4186,10 +4223,14 @@ struct SwarmTriageOutput {
repo_work_overview_count: usize,
repo_work_overview_rows: Vec<RepoWorkOverviewRow>,
repo_work_overview_tui_rows: Vec<String>,
repo_work_public_proof_count: usize,
repo_work_public_proof_rows: Vec<RepoWorkPublicProofRow>,
repo_work_public_proof_tui_rows: Vec<String>,
latest_repo_work_overview: Option<String>,
latest_repo_work_gate: Option<String>,
latest_repo_work_blocker: Option<String>,
latest_repo_work_next_safe_move: Option<String>,
latest_repo_work_public_proof: Option<String>,
poked_daemon_count: usize,
pokes: Vec<serde_json::Value>,
commands: serde_json::Value,
@ -4248,10 +4289,14 @@ impl SwarmTriageOutput {
repo_work_overview_count: report.repo_work_overview_rows.len(),
repo_work_overview_rows: report.repo_work_overview_rows,
repo_work_overview_tui_rows: report.repo_work_overview_tui_rows,
repo_work_public_proof_count: report.repo_work_public_proof_rows.len(),
repo_work_public_proof_rows: report.repo_work_public_proof_rows,
repo_work_public_proof_tui_rows: report.repo_work_public_proof_tui_rows,
latest_repo_work_overview: report.latest_repo_work_overview_id,
latest_repo_work_gate: report.latest_repo_work_gate,
latest_repo_work_blocker: report.latest_repo_work_blocker,
latest_repo_work_next_safe_move: report.latest_repo_work_next_safe_move,
latest_repo_work_public_proof: report.latest_repo_work_public_proof,
poked_daemon_count,
pokes,
commands: json!({
@ -4451,6 +4496,7 @@ fn swarm_action_rows(
service_execution_failed_check_rows: &[EpiphanyServiceExecutionAuditCheck],
service_execution_runbook_actions: &[ServiceExecutionRunbookAction],
repo_work_overviews: &[EpiphanyCultMeshRepoWorkOverviewEntry],
repo_work_public_proofs: &[EpiphanyCultMeshRepoWorkPublicProofEntry],
) -> (Vec<SwarmActionRow>, Vec<String>) {
let mut rows = Vec::new();
let mut service_execution_check_counts = BTreeMap::<String, (usize, usize)>::new();
@ -4698,6 +4744,12 @@ fn swarm_action_rows(
private_state_exposed: runbook_action.private_state_exposed,
});
}
for (index, public_proof) in repo_work_public_proofs.iter().take(5).enumerate() {
rows.push(repo_work_public_proof_action_row(
public_proof,
60 + index as u32,
));
}
if rows.is_empty() {
rows.push(SwarmActionRow {
priority: 100,
@ -4801,6 +4853,59 @@ fn repo_work_peer_tui_rows(rows: &[RepoWorkOverviewRow]) -> Vec<String> {
.collect()
}
fn repo_work_public_proof_rows(
public_proofs: &[EpiphanyCultMeshRepoWorkPublicProofEntry],
) -> (Vec<RepoWorkPublicProofRow>, Vec<String>) {
let rows = public_proofs
.iter()
.map(repo_work_public_proof_row)
.collect::<Vec<_>>();
let tui_rows = rows
.iter()
.map(repo_work_public_proof_tui_row)
.collect::<Vec<_>>();
(rows, tui_rows)
}
fn repo_work_public_proof_row(
proof: &EpiphanyCultMeshRepoWorkPublicProofEntry,
) -> RepoWorkPublicProofRow {
RepoWorkPublicProofRow {
public_proof_id: proof.public_proof_id.clone(),
workspace: proof.workspace.clone(),
item: proof.item.clone(),
branch: proof.branch.clone(),
current_gate: proof.current_gate.clone(),
blocker: proof.blocker.clone(),
next_safe_move: proof.next_safe_move.clone(),
changed_path_count: proof.changed_paths.len(),
commit_sha: proof.commit_sha.clone(),
soul_verdict: proof.soul_verdict.clone(),
upstream_main_synced: proof.upstream_main_synced,
artifact_row_count: proof.artifact_row_count,
publication_row_count: proof.publication_row_count,
public_proof_ref: proof.public_proof_ref.clone(),
public_proof_sha256: proof.public_proof_sha256.clone(),
private_state_exposed: proof.private_state_exposed,
}
}
fn repo_work_public_proof_tui_row(row: &RepoWorkPublicProofRow) -> String {
format!(
"REPO-WORK-PUBLIC-PROOF | item={} | gate={} | branch={} | commit={} | artifacts={} | publicationRows={} | upstreamMainSynced={} | proof={} | sha256={} | private={}",
row.item,
row.current_gate,
row.branch,
row.commit_sha,
row.artifact_row_count,
row.publication_row_count,
row.upstream_main_synced,
row.public_proof_ref,
row.public_proof_sha256,
row.private_state_exposed
)
}
fn repo_work_overview_action_row(
overview: &EpiphanyCultMeshRepoWorkOverviewEntry,
priority: u32,
@ -4849,6 +4954,55 @@ fn repo_work_overview_action_row(
}
}
fn repo_work_public_proof_action_row(
proof: &EpiphanyCultMeshRepoWorkPublicProofEntry,
priority: u32,
) -> SwarmActionRow {
SwarmActionRow {
priority,
family: "repo-work-public-proof".to_string(),
status: proof.current_gate.clone(),
lifecycle_owner: "Gjallar".to_string(),
hosted_body: "repo-work".to_string(),
action: format!(
"Read redacted public proof {} for item {}; Bifrost owns any public publication or credit consequence.",
proof.public_proof_id, proof.item
),
wrapper_mode: "repo-work-public-proof".to_string(),
wrapper_command: format!(
"epiphany-work export-proof --workspace \"{}\" --item \"{}\" --local-verse-store <store>",
proof.workspace, proof.item
),
operator_artifact_ref: proof.public_proof_ref.clone(),
operator_artifact_status: if proof.public_proof_ref == "none" {
"none".to_string()
} else {
"external-ref".to_string()
},
operator_artifact_sha256: proof.public_proof_sha256.clone(),
operator_artifact_execution_command: "none".to_string(),
operator_aftercare_command: "none".to_string(),
completion_audit_wrapper_mode: "bifrost-ledger".to_string(),
completion_audit_wrapper_command: WRAPPER_BIFROST_LEDGER_COMMAND.to_string(),
authority_gate: "repo.work.public_proof_readback".to_string(),
effect_class: "repo-work-public-proof-readback".to_string(),
mutates_state: false,
requires_elevated_authority: false,
service_execution_failed_check_count: 0,
service_execution_missing_check_count: 0,
service_id: "none".to_string(),
service_route: "none".to_string(),
reason: format!(
"Redacted proof has artifacts={} publicationRows={} upstreamMainSynced={} sha256={}",
proof.artifact_row_count,
proof.publication_row_count,
proof.upstream_main_synced,
proof.public_proof_sha256
),
private_state_exposed: proof.private_state_exposed,
}
}
fn swarm_action_tui_row(row: &SwarmActionRow) -> String {
format!(
"{:03} | {} | {} | {} | {} | owner={} | hostedBody={} | service={} | route={} | command={} | mutates={} | elevated={} | failedChecks={} | missingChecks={} | artifact={} | sha256={} | exec={} | audit={} | aftercare={}",
@ -5230,12 +5384,40 @@ fn load_repo_work_overview_queue(
Ok((latest_repo_work_overview, repo_work_overviews))
}
fn load_repo_work_public_proofs(
args: &Args,
) -> Result<(
Option<EpiphanyCultMeshRepoWorkPublicProofEntry>,
Vec<EpiphanyCultMeshRepoWorkPublicProofEntry>,
)> {
let latest_public_proof =
load_latest_epiphany_cultmesh_repo_work_public_proof(&args.store, args.runtime_id.clone())?;
let mut public_proofs =
load_epiphany_cultmesh_repo_work_public_proofs(&args.store, args.runtime_id.clone())?;
if let Some(latest) = latest_public_proof.as_ref() {
if !public_proofs
.iter()
.any(|proof| proof.public_proof_id == latest.public_proof_id)
{
public_proofs.push(latest.clone());
public_proofs.sort_by(|a, b| {
b.generated_at
.cmp(&a.generated_at)
.then_with(|| a.public_proof_id.cmp(&b.public_proof_id))
});
}
}
Ok((latest_public_proof, public_proofs))
}
fn load_swarm_overview_report(args: &Args) -> Result<SwarmOverviewReport> {
let topology = load_epiphany_cultmesh_cluster_topology(&args.store, args.runtime_id.clone())?;
let topology_report = cluster_topology_report(&topology);
let liveness = load_epiphany_cultmesh_daemon_liveness(&args.store, args.runtime_id.clone())?;
let daemon_report = daemon_liveness_report(&liveness);
let (latest_repo_work_overview, repo_work_overviews) = load_repo_work_overview_queue(args)?;
let (latest_repo_work_public_proof, repo_work_public_proofs) =
load_repo_work_public_proofs(args)?;
let directory =
load_epiphany_cultmesh_eve_surface_directory(&args.store, args.runtime_id.clone())?;
let surface_report = eve_surface_report(&directory, &repo_work_overviews);
@ -5448,6 +5630,8 @@ fn load_swarm_overview_report(args: &Args) -> Result<SwarmOverviewReport> {
.collect::<Vec<_>>();
let (repo_work_overview_rows, repo_work_overview_tui_rows) =
repo_work_overview_rows(&repo_work_overviews);
let (repo_work_public_proof_rows, repo_work_public_proof_tui_rows) =
repo_work_public_proof_rows(&repo_work_public_proofs);
let (swarm_action_rows, swarm_action_tui_rows) = swarm_action_rows(
&liveness_status,
&tool_host_attention_rows,
@ -5456,6 +5640,7 @@ fn load_swarm_overview_report(args: &Args) -> Result<SwarmOverviewReport> {
&service_execution_failed_check_rows,
&service_execution_runbook_actions,
&repo_work_overviews,
&repo_work_public_proofs,
);
let private_state_exposed = daemon_report
.rows
@ -5466,6 +5651,9 @@ fn load_swarm_overview_report(args: &Args) -> Result<SwarmOverviewReport> {
|| repo_work_overviews
.iter()
.any(|overview| overview.private_state_exposed)
|| repo_work_public_proofs
.iter()
.any(|proof| proof.private_state_exposed)
|| service_execution_private_state_exposed
|| service_lifecycle_rows
.iter()
@ -5482,6 +5670,9 @@ fn load_swarm_overview_report(args: &Args) -> Result<SwarmOverviewReport> {
let latest_repo_work_next_safe_move = latest_repo_work_overview
.as_ref()
.map(|overview| overview.next_safe_move.clone());
let latest_repo_work_public_proof = latest_repo_work_public_proof
.as_ref()
.map(|proof| proof.public_proof_id.clone());
Ok(SwarmOverviewReport {
status,
liveness_status,
@ -5506,10 +5697,13 @@ fn load_swarm_overview_report(args: &Args) -> Result<SwarmOverviewReport> {
service_execution_failed_check_tui_rows,
repo_work_overview_rows,
repo_work_overview_tui_rows,
repo_work_public_proof_rows,
repo_work_public_proof_tui_rows,
latest_repo_work_overview_id,
latest_repo_work_gate,
latest_repo_work_blocker,
latest_repo_work_next_safe_move,
latest_repo_work_public_proof,
topology_report,
daemon_report,
surface_report,

View file

@ -5,7 +5,9 @@ use chrono::DateTime;
use chrono::Utc;
use epiphany_core::EPIPHANY_CULTMESH_LOCAL_AREA_VERSE_ID;
use epiphany_core::EPIPHANY_CULTMESH_REPO_WORK_OVERVIEW_SCHEMA_VERSION;
use epiphany_core::EPIPHANY_CULTMESH_REPO_WORK_PUBLIC_PROOF_SCHEMA_VERSION;
use epiphany_core::EpiphanyCultMeshRepoWorkOverviewEntry;
use epiphany_core::EpiphanyCultMeshRepoWorkPublicProofEntry;
use epiphany_core::HANDS_ACTION_INTENT_SCHEMA_VERSION;
use epiphany_core::HANDS_COMMAND_RECEIPT_TYPE;
use epiphany_core::HANDS_COMMIT_RECEIPT_TYPE;
@ -45,6 +47,7 @@ use epiphany_core::runtime_hands_action_review;
use epiphany_core::runtime_hands_commit_receipt;
use epiphany_core::runtime_latest_hands_receipt_chain_after;
use epiphany_core::write_epiphany_cultmesh_repo_work_overview;
use epiphany_core::write_epiphany_cultmesh_repo_work_public_proof;
use serde_json::Value;
use serde_json::json;
use sha2::Digest;
@ -272,6 +275,8 @@ struct ExportProofArgs {
accept_receipt: Option<PathBuf>,
artifact_dir: Option<PathBuf>,
output: Option<PathBuf>,
local_verse_store: Option<PathBuf>,
runtime_id: String,
}
#[derive(Clone, Debug)]
@ -978,6 +983,8 @@ fn parse_export_proof_args(args: impl Iterator<Item = String>) -> Result<ExportP
let mut accept_receipt = None;
let mut artifact_dir = None;
let mut output = None;
let mut local_verse_store = None;
let mut runtime_id = "repo-swarm-local".to_string();
let mut args = args.peekable();
while let Some(arg) = args.next() {
@ -987,6 +994,10 @@ fn parse_export_proof_args(args: impl Iterator<Item = String>) -> Result<ExportP
"--accept-receipt" => accept_receipt = Some(take_path(&mut args, "--accept-receipt")?),
"--artifact-dir" => artifact_dir = Some(take_path(&mut args, "--artifact-dir")?),
"--output" | "--export-path" => output = Some(take_path(&mut args, "--output")?),
"--local-verse-store" | "--store" => {
local_verse_store = Some(take_path(&mut args, "--local-verse-store")?);
}
"--runtime-id" => runtime_id = take_string(&mut args, "--runtime-id")?,
other => return Err(anyhow!("unexpected export-proof argument {other:?}")),
}
}
@ -996,6 +1007,8 @@ fn parse_export_proof_args(args: impl Iterator<Item = String>) -> Result<ExportP
accept_receipt,
artifact_dir,
output,
local_verse_store,
runtime_id,
})
}
@ -3557,14 +3570,92 @@ fn run_export_proof(args: ExportProofArgs) -> Result<Value> {
});
let public_bundle = repo_work_public_proof_bundle(&overview)?;
write_json(&output, &public_bundle)?;
let public_proof_sha256 = file_sha256(&output)?;
let local_verse_store = args
.local_verse_store
.unwrap_or_else(|| workspace.join(".epiphany").join("local-verse.ccmp"));
let artifact_row_count = public_bundle
.get("artifactRows")
.and_then(Value::as_array)
.map(|rows| rows.len())
.unwrap_or(0);
let publication_row_count = public_bundle
.get("publicationRows")
.and_then(Value::as_array)
.map(|rows| rows.len())
.unwrap_or(0);
let public_proof_tui_rows = repo_work_public_proof_tui_rows(
&public_bundle,
&output,
&public_proof_sha256,
artifact_row_count,
publication_row_count,
);
let entry = EpiphanyCultMeshRepoWorkPublicProofEntry {
schema_version: EPIPHANY_CULTMESH_REPO_WORK_PUBLIC_PROOF_SCHEMA_VERSION.to_string(),
runtime_id: args.runtime_id.clone(),
verse_id: EPIPHANY_CULTMESH_LOCAL_AREA_VERSE_ID.to_string(),
public_proof_id: format!("repo-work-public-proof-{item_slug}"),
generated_at: string_from_json(&public_bundle, &["generatedAt"])
.unwrap_or_else(|| Utc::now().to_rfc3339_opts(chrono::SecondsFormat::Secs, true)),
workspace: workspace.display().to_string(),
item: item.clone(),
branch: string_from_json(&public_bundle, &["branch"]).unwrap_or_else(|| "unknown".to_string()),
current_gate: string_from_json(&public_bundle, &["currentGate"])
.unwrap_or_else(|| "unknown".to_string()),
blocker: string_from_json(&public_bundle, &["blocker"]).unwrap_or_else(|| "none".to_string()),
next_safe_move: string_from_json(&public_bundle, &["nextSafeMove"])
.unwrap_or_else(|| "none".to_string()),
changed_paths: public_bundle
.get("changedPaths")
.and_then(Value::as_array)
.map(|paths| {
paths
.iter()
.filter_map(Value::as_str)
.map(ToString::to_string)
.collect::<Vec<_>>()
})
.unwrap_or_default(),
commit_sha: string_from_json(&public_bundle, &["commitSha"]).unwrap_or_else(|| "none".to_string()),
soul_verdict: string_from_json(&public_bundle, &["soulVerdict"]).unwrap_or_else(|| "none".to_string()),
upstream_main_synced: public_bundle
.get("upstreamMainSynced")
.and_then(Value::as_bool)
.unwrap_or(false),
artifact_row_count: artifact_row_count as u32,
publication_row_count: publication_row_count as u32,
public_proof_ref: output.display().to_string(),
public_proof_sha256: public_proof_sha256.clone(),
tui_rows: public_proof_tui_rows,
private_state_exposed: false,
notes: vec![
"Repo work public proof is a redacted local Verse index for public/Bifrost transport; raw receipt bodies, local receipt paths, worker thought, and private Verse contents remain sealed.".to_string(),
"Gjallar/Odin may discover this proof, but Bifrost still owns publication, labor ledger, credit, and public consequence.".to_string(),
],
};
let written_public_proof =
write_epiphany_cultmesh_repo_work_public_proof(&local_verse_store, entry)?;
let verse_projection = json!({
"localVerseStore": local_verse_store,
"documentType": "epiphany.cultmesh.repo_work_public_proof",
"publicProofId": written_public_proof.public_proof_id,
"latestKey": "gamecult-local/repo-work-public-proof/latest",
"publicProofRef": written_public_proof.public_proof_ref,
"publicProofSha256": written_public_proof.public_proof_sha256,
"tuiRows": written_public_proof.tui_rows,
"privateStateExposed": written_public_proof.private_state_exposed
});
Ok(json!({
"schemaVersion": "epiphany.repo_work_public_proof_export.v0",
"status": "public-proof-exported",
"workspace": workspace,
"item": item,
"outputPath": output,
"outputSha256": public_proof_sha256,
"sourceOverviewReceiptPath": overview["receiptPath"],
"publicProofBundle": public_bundle,
"verseProjection": verse_projection,
"privateStateExposed": false,
"nextSafeMove": "Share the public proof bundle with maintainers or Bifrost; keep raw worker thoughts and local receipt bodies sealed."
}))
@ -4748,6 +4839,30 @@ fn repo_work_public_artifact_row(row: &Value) -> Value {
})
}
fn repo_work_public_proof_tui_rows(
bundle: &Value,
output: &Path,
sha256: &str,
artifact_row_count: usize,
publication_row_count: usize,
) -> Vec<String> {
vec![format!(
"PUBLIC-PROOF | item={} | gate={} | branch={} | commit={} | artifacts={} | publicationRows={} | upstreamMainSynced={} | proof={} | sha256={} | private=false",
string_from_json(bundle, &["item"]).unwrap_or_else(|| "unknown".to_string()),
string_from_json(bundle, &["currentGate"]).unwrap_or_else(|| "unknown".to_string()),
string_from_json(bundle, &["branch"]).unwrap_or_else(|| "unknown".to_string()),
string_from_json(bundle, &["commitSha"]).unwrap_or_else(|| "none".to_string()),
artifact_row_count,
publication_row_count,
bundle
.get("upstreamMainSynced")
.and_then(Value::as_bool)
.unwrap_or(false),
output.display(),
sha256
)]
}
fn sync_receipt_upstream_main_synced(receipt: &Value) -> Option<bool> {
receipt
.get("upstreamMainSynced")
@ -5358,7 +5473,7 @@ fn print_usage() {
publish --workspace <repo> [--item <id>] --change-summary <text> --justification <text> --verification-receipt <ref> --review-receipt <ref> --ledger-entry-id <id> --pull-request-url <url> --pull-request-title <text>\n\
sync --workspace <repo> [--item <id>] [--publish-receipt <path>] [--upstream-ref origin/main] --merge-receipt <ref>\n\
overview --workspace <repo> [--item <id>] [--accept-receipt <path>] [--no-write]\n\
export-proof --workspace <repo> [--item <id>] [--accept-receipt <path>] [--output <path>]\n\
export-proof --workspace <repo> [--item <id>] [--accept-receipt <path>] [--output <path>] [--local-verse-store <path>] [--runtime-id repo-swarm-local]\n\
tick --workspace <repo> [--item <id>] [--local-verse-store <path>] [--runtime-store <path>] [--dry-run]\n\
queue-run --workspace <repo> [--local-verse-store <path>] [--runtime-id repo-swarm-local] [--max-items 1] [--dry-run]"
);

View file

@ -76,6 +76,12 @@ pub const EPIPHANY_CULTMESH_REPO_WORK_OVERVIEW_SCHEMA_VERSION: &str =
"epiphany.cultmesh.repo_work_overview.v0";
pub const EPIPHANY_CULTMESH_REPO_WORK_OVERVIEW_LATEST_KEY: &str =
"gamecult-local/repo-work-overview/latest";
pub const EPIPHANY_CULTMESH_REPO_WORK_PUBLIC_PROOF_TYPE: &str =
"epiphany.cultmesh.repo_work_public_proof";
pub const EPIPHANY_CULTMESH_REPO_WORK_PUBLIC_PROOF_SCHEMA_VERSION: &str =
"epiphany.cultmesh.repo_work_public_proof.v0";
pub const EPIPHANY_CULTMESH_REPO_WORK_PUBLIC_PROOF_LATEST_KEY: &str =
"gamecult-local/repo-work-public-proof/latest";
pub const EPIPHANY_CULTMESH_VERSE_POLICY_TYPE: &str = "epiphany.cultmesh.verse_policy";
pub const EPIPHANY_CULTMESH_VERSE_POLICY_SCHEMA_VERSION: &str = "epiphany.cultmesh.verse_policy.v0";
pub const EPIPHANY_CULTMESH_GLOBAL_ROOM_POLICY_TYPE: &str = "epiphany.cultmesh.global_room_policy";
@ -740,6 +746,58 @@ pub struct EpiphanyCultMeshRepoWorkOverviewEntry {
pub notes: Vec<String>,
}
#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)]
#[cultcache(
type = "epiphany.cultmesh.repo_work_public_proof",
schema = "EpiphanyCultMeshRepoWorkPublicProofEntry"
)]
pub struct EpiphanyCultMeshRepoWorkPublicProofEntry {
#[cultcache(key = 0)]
pub schema_version: String,
#[cultcache(key = 1)]
pub runtime_id: String,
#[cultcache(key = 2)]
pub verse_id: String,
#[cultcache(key = 3)]
pub public_proof_id: String,
#[cultcache(key = 4)]
pub generated_at: String,
#[cultcache(key = 5)]
pub workspace: String,
#[cultcache(key = 6)]
pub item: String,
#[cultcache(key = 7)]
pub branch: String,
#[cultcache(key = 8)]
pub current_gate: String,
#[cultcache(key = 9)]
pub blocker: String,
#[cultcache(key = 10)]
pub next_safe_move: String,
#[cultcache(key = 11)]
pub changed_paths: Vec<String>,
#[cultcache(key = 12)]
pub commit_sha: String,
#[cultcache(key = 13)]
pub soul_verdict: String,
#[cultcache(key = 14)]
pub upstream_main_synced: bool,
#[cultcache(key = 15)]
pub artifact_row_count: u32,
#[cultcache(key = 16)]
pub publication_row_count: u32,
#[cultcache(key = 17)]
pub public_proof_ref: String,
#[cultcache(key = 18)]
pub public_proof_sha256: String,
#[cultcache(key = 19)]
pub tui_rows: Vec<String>,
#[cultcache(key = 20)]
pub private_state_exposed: bool,
#[cultcache(key = 21)]
pub notes: Vec<String>,
}
#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)]
#[cultcache(
type = "epiphany.cultmesh.verse_policy",
@ -2034,6 +2092,7 @@ cultmesh_documents!(EpiphanyCultMeshDocuments {
EpiphanyCultMeshWorkLoopTelemetryEntry => EPIPHANY_CULTMESH_WORK_LOOP_TELEMETRY_SCHEMA_VERSION,
EpiphanyCultMeshAgentStateSoaSummaryEntry => EPIPHANY_CULTMESH_AGENT_STATE_SOA_SUMMARY_SCHEMA_VERSION,
EpiphanyCultMeshRepoWorkOverviewEntry => EPIPHANY_CULTMESH_REPO_WORK_OVERVIEW_SCHEMA_VERSION,
EpiphanyCultMeshRepoWorkPublicProofEntry => EPIPHANY_CULTMESH_REPO_WORK_PUBLIC_PROOF_SCHEMA_VERSION,
EpiphanyCultMeshVersePolicyEntry => EPIPHANY_CULTMESH_VERSE_POLICY_SCHEMA_VERSION,
EpiphanyCultMeshGlobalRoomPolicyEntry => EPIPHANY_CULTMESH_GLOBAL_ROOM_POLICY_SCHEMA_VERSION,
EpiphanyCultMeshClusterTopologyEntry => EPIPHANY_CULTMESH_CLUSTER_TOPOLOGY_SCHEMA_VERSION,
@ -4181,6 +4240,48 @@ pub fn load_epiphany_cultmesh_repo_work_overviews(
Ok(overviews)
}
pub fn write_epiphany_cultmesh_repo_work_public_proof(
store_path: impl AsRef<Path>,
proof: EpiphanyCultMeshRepoWorkPublicProofEntry,
) -> Result<EpiphanyCultMeshRepoWorkPublicProofEntry> {
validate_repo_work_public_proof(&proof)?;
let mut node = open_epiphany_cultmesh_node(&store_path, proof.runtime_id.clone())?;
let written = node.put(proof.public_proof_id.clone(), &proof)?;
node.put(
EPIPHANY_CULTMESH_REPO_WORK_PUBLIC_PROOF_LATEST_KEY,
&written,
)?;
node.flush()?;
Ok(written)
}
pub fn load_latest_epiphany_cultmesh_repo_work_public_proof(
store_path: impl AsRef<Path>,
runtime_id: impl Into<String>,
) -> Result<Option<EpiphanyCultMeshRepoWorkPublicProofEntry>> {
let node = open_epiphany_cultmesh_node(store_path, runtime_id)?;
node.get(EPIPHANY_CULTMESH_REPO_WORK_PUBLIC_PROOF_LATEST_KEY)
}
pub fn load_epiphany_cultmesh_repo_work_public_proofs(
store_path: impl AsRef<Path>,
runtime_id: impl Into<String>,
) -> Result<Vec<EpiphanyCultMeshRepoWorkPublicProofEntry>> {
let node = open_epiphany_cultmesh_node(store_path, runtime_id)?;
let mut proofs = node
.get_all_with_keys::<EpiphanyCultMeshRepoWorkPublicProofEntry>()?
.into_iter()
.filter(|(key, _)| key != EPIPHANY_CULTMESH_REPO_WORK_PUBLIC_PROOF_LATEST_KEY)
.map(|(_, proof)| proof)
.collect::<Vec<_>>();
proofs.sort_by(|a, b| {
b.generated_at
.cmp(&a.generated_at)
.then_with(|| a.public_proof_id.cmp(&b.public_proof_id))
});
Ok(proofs)
}
fn validate_repo_work_overview(overview: &EpiphanyCultMeshRepoWorkOverviewEntry) -> Result<()> {
if overview.private_state_exposed {
return Err(anyhow!("repo work overview must not expose private state"));
@ -4215,6 +4316,48 @@ fn validate_repo_work_overview(overview: &EpiphanyCultMeshRepoWorkOverviewEntry)
Ok(())
}
fn validate_repo_work_public_proof(proof: &EpiphanyCultMeshRepoWorkPublicProofEntry) -> Result<()> {
if proof.private_state_exposed {
return Err(anyhow!(
"repo work public proof must not expose private state"
));
}
if proof.schema_version != EPIPHANY_CULTMESH_REPO_WORK_PUBLIC_PROOF_SCHEMA_VERSION {
return Err(anyhow!(
"repo work public proof schema_version must be {:?}",
EPIPHANY_CULTMESH_REPO_WORK_PUBLIC_PROOF_SCHEMA_VERSION
));
}
if proof.verse_id != EPIPHANY_CULTMESH_LOCAL_AREA_VERSE_ID {
return Err(anyhow!(
"repo work public proof belongs in local-area Verse {:?}",
EPIPHANY_CULTMESH_LOCAL_AREA_VERSE_ID
));
}
if proof.public_proof_id.trim().is_empty() || proof.item.trim().is_empty() {
return Err(anyhow!(
"repo work public proof requires public_proof_id and item"
));
}
if proof.public_proof_ref.trim().is_empty() || proof.public_proof_sha256.trim().is_empty() {
return Err(anyhow!(
"repo work public proof requires artifact ref and sha256"
));
}
if proof.tui_rows.is_empty() {
return Err(anyhow!("repo work public proof requires compact TUI rows"));
}
if proof.tui_rows.iter().any(|row| {
let lower = row.to_ascii_lowercase();
lower.contains("rawresult") || lower.contains("receipt body") || lower.contains("thought")
}) {
return Err(anyhow!(
"repo work public proof rows must not expose raw worker payload names"
));
}
Ok(())
}
pub fn seed_epiphany_local_verse_context(
store_path: impl AsRef<Path>,
runtime_id: impl Into<String>,

View file

@ -206,6 +206,9 @@ pub use cultmesh_integration::EPIPHANY_CULTMESH_PERSONA_SPEECH_AUDIT_TYPE;
pub use cultmesh_integration::EPIPHANY_CULTMESH_REPO_WORK_OVERVIEW_LATEST_KEY;
pub use cultmesh_integration::EPIPHANY_CULTMESH_REPO_WORK_OVERVIEW_SCHEMA_VERSION;
pub use cultmesh_integration::EPIPHANY_CULTMESH_REPO_WORK_OVERVIEW_TYPE;
pub use cultmesh_integration::EPIPHANY_CULTMESH_REPO_WORK_PUBLIC_PROOF_LATEST_KEY;
pub use cultmesh_integration::EPIPHANY_CULTMESH_REPO_WORK_PUBLIC_PROOF_SCHEMA_VERSION;
pub use cultmesh_integration::EPIPHANY_CULTMESH_REPO_WORK_PUBLIC_PROOF_TYPE;
pub use cultmesh_integration::EPIPHANY_CULTMESH_ROLE_REVIEW_EVENT_LATEST_KEY;
pub use cultmesh_integration::EPIPHANY_CULTMESH_ROLE_REVIEW_EVENT_SCHEMA_VERSION;
pub use cultmesh_integration::EPIPHANY_CULTMESH_ROLE_REVIEW_EVENT_TYPE;
@ -259,6 +262,7 @@ pub use cultmesh_integration::EpiphanyCultMeshOperatorSnapshotEntry;
pub use cultmesh_integration::EpiphanyCultMeshOperatorStatusEntry;
pub use cultmesh_integration::EpiphanyCultMeshPersonaSpeechAuditEntry;
pub use cultmesh_integration::EpiphanyCultMeshRepoWorkOverviewEntry;
pub use cultmesh_integration::EpiphanyCultMeshRepoWorkPublicProofEntry;
pub use cultmesh_integration::EpiphanyCultMeshRoleReviewEventEntry;
pub use cultmesh_integration::EpiphanyCultMeshSoulContractEntry;
pub use cultmesh_integration::EpiphanyCultMeshStatusEntry;
@ -315,6 +319,7 @@ pub use cultmesh_integration::load_epiphany_cultmesh_eve_surface_directory;
pub use cultmesh_integration::load_epiphany_cultmesh_operator_snapshot;
pub use cultmesh_integration::load_epiphany_cultmesh_operator_status;
pub use cultmesh_integration::load_epiphany_cultmesh_repo_work_overviews;
pub use cultmesh_integration::load_epiphany_cultmesh_repo_work_public_proofs;
pub use cultmesh_integration::load_epiphany_cultmesh_status;
pub use cultmesh_integration::load_epiphany_cultmesh_swarm_brake;
pub use cultmesh_integration::load_latest_epiphany_cultmesh_agent_state_soa_summary;
@ -338,6 +343,7 @@ pub use cultmesh_integration::load_latest_epiphany_cultmesh_operator_run_receipt
pub use cultmesh_integration::load_latest_epiphany_cultmesh_operator_snapshot;
pub use cultmesh_integration::load_latest_epiphany_cultmesh_persona_speech_audit;
pub use cultmesh_integration::load_latest_epiphany_cultmesh_repo_work_overview;
pub use cultmesh_integration::load_latest_epiphany_cultmesh_repo_work_public_proof;
pub use cultmesh_integration::load_latest_epiphany_cultmesh_role_review_event;
pub use cultmesh_integration::load_latest_epiphany_cultmesh_work_loop_telemetry;
pub use cultmesh_integration::open_epiphany_cultmesh_node;
@ -376,6 +382,7 @@ pub use cultmesh_integration::write_epiphany_cultmesh_operator_snapshot;
pub use cultmesh_integration::write_epiphany_cultmesh_operator_status;
pub use cultmesh_integration::write_epiphany_cultmesh_persona_speech_audit;
pub use cultmesh_integration::write_epiphany_cultmesh_repo_work_overview;
pub use cultmesh_integration::write_epiphany_cultmesh_repo_work_public_proof;
pub use cultmesh_integration::write_epiphany_cultmesh_role_review_event;
pub use cultmesh_integration::write_epiphany_cultmesh_soul_contracts;
pub use cultmesh_integration::write_epiphany_cultmesh_status;