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

Function attestation

atomic-cli/src/commands/change/tree.rs:334–378  ·  view source on GitHub ↗
(prov: &Provenance)

Source from the content-addressed store, hash-verified

332}
333
334fn attestation(prov: &Provenance) -> Tree {
335 let mut section = Tree::new("Attestation");
336 section.push(format!("Vendor: {:?}", prov.vendor));
337 section.push(format!("Model: {}", prov.model));
338 if let Some(version) = &prov.model_version {
339 section.push(format!("Version: {version}"));
340 }
341 section.push(format!("Tool: {:?}", prov.tool));
342 section.push(format!("Type: {:?}", prov.suggestion_type));
343 if !prov.tokens.is_empty() {
344 let mut tokens = Tree::new("Tokens");
345 tokens.push(format!("Input: {}", prov.tokens.input_tokens));
346 tokens.push(format!("Output: {}", prov.tokens.output_tokens));
347 tokens.push(format!("Total: {}", prov.tokens.total_tokens));
348 section.section(tokens);
349 }
350 if !prov.cost.is_zero() {
351 section.push(format!("Cost: ${:.6} USD", prov.cost.usd));
352 }
353 if let Some(temp) = prov.temperature {
354 section.push(format!("Temp: {:.2}", temp as f64 / 1000.0));
355 }
356 if let Some(id) = &prov.request_id {
357 section.push(format!("Request: {id}"));
358 }
359 if let Some(id) = &prov.session_id {
360 section.push(format!("Session: {id}"));
361 }
362 let mut metadata = Tree::new("Metadata");
363 for (key, value) in &prov.metadata {
364 let value = if key == "turn_number" {
365 value
366 .parse::<u32>()
367 .ok()
368 .and_then(|n| n.checked_sub(1))
369 .map(|n| n.to_string())
370 .unwrap_or_else(|| value.clone())
371 } else {
372 value.clone()
373 };
374 metadata.push(format!("{key}: {value}"));
375 }
376 section.section(metadata);
377 section
378}
379
380fn ledger(graph: &ProvenanceGraph) -> Tree {
381 let mut section = Tree::new("Change Ledger");

Callers 1

renderFunction · 0.70

Calls 6

sectionMethod · 0.80
pushMethod · 0.45
is_emptyMethod · 0.45
is_zeroMethod · 0.45
okMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected