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

Function agent_attest

atomic-cli/src/commands/rpc.rs:1897–2037  ·  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

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

Callers 1

runMethod · 0.85

Calls 10

openFunction · 0.85
current_view_nameFunction · 0.85
is_noneMethod · 0.80
as_refMethod · 0.80
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