MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / agent_attest

Function agent_attest

atomic-cli/src/commands/rpc.rs:1898–2038  ·  view source on GitHub ↗

`atomic agent attest` over ListAttestations — every form. The listing rides the view filter as before; `--hash ` resolves ONE attestation server-side (the hash names an attestation, which the change-oriented Log cannot resolve) and returns the domain payload plus the per-view coverage as versioned-opaque bytes; `--summary` / `--pending ` return the AI provenance summary the same wa

(args: &super::agent::attest::Attest)

Source from the content-addressed store, hash-verified

1896/// `--pending <parent>` return the AI provenance summary the same way.
1897/// The CLI renders with the SAME code the local bodies run.
1898pub fn agent_attest(args: &super::agent::attest::Attest) -> CliResult<bool> {
1899 let Some(session) = Service::open()? else {
1900 return Ok(false);
1901 };
1902 // The provenance-summary modes: `--pending <parent>` requires --view
1903 // (validated client-side, the local body's exact error).
1904 if args.summary || args.pending.is_some() {
1905 if args.pending.is_some() && args.view.is_none() {
1906 return Err(CliError::InvalidArgument {
1907 message:
1908 "--pending <parent_view> requires --view <agent_view> (the forked view to summarize)"
1909 .to_string(),
1910 });
1911 }
1912 // The summary's view defaults to the current view — resolved
1913 // client-side from the working-copy marker (the same default the
1914 // local body applies).
1915 let summary_view = args
1916 .view
1917 .clone()
1918 .unwrap_or_else(|| current_view_name().unwrap_or_default());
1919 let request = pb::ListAttestationsRequest {
1920 repository: Some(session.reference.clone()),
1921 filter: None,
1922 cursor: None,
1923 budget: None,
1924 view: None,
1925 hash_prefix: None,
1926 summary_view: Some(summary_view),
1927 pending_parent: args.pending.clone(),
1928 };
1929 let response = session.list_attestations(request)?;
1930 let Some(bundle) = response.summary_bundle.as_ref() else {
1931 return Err(CliError::Internal(anyhow::anyhow!(
1932 "the service returned no summary bundle (summary_view required)"
1933 )));
1934 };
1935 if bundle.schema != "atomic.provenance.summary.v1" {
1936 return Err(CliError::Internal(anyhow::anyhow!(
1937 "unknown summary bundle schema '{}'",
1938 bundle.schema
1939 )));
1940 }
1941 #[derive(serde::Deserialize)]
1942 struct SummaryBundle {
1943 summary: atomic_repository::ProvenanceSummary,
1944 parent: Option<String>,
1945 }
1946 let parsed: SummaryBundle = serde_json::from_slice(&bundle.payload)
1947 .map_err(|error| CliError::Internal(anyhow::anyhow!("summary bundle: {error}")))?;
1948 super::agent::attest::Attest::render_summary(
1949 &parsed.summary,
1950 &args
1951 .view
1952 .clone()
1953 .unwrap_or_else(|| current_view_name().unwrap_or_default()),
1954 args.pending.as_deref(),
1955 parsed.parent.as_deref(),

Callers 1

runMethod · 0.85

Calls 10

current_view_nameFunction · 0.85
is_noneMethod · 0.80
as_refMethod · 0.80
openFunction · 0.50
GraphStatsClass · 0.50
cloneMethod · 0.45
list_attestationsMethod · 0.45
as_bytesMethod · 0.45
iterMethod · 0.45
is_emptyMethod · 0.45

Tested by 1

runMethod · 0.68