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

Function intent_attestation_sources

libatomic/src/daemon/services_agent.rs:912–948  ·  view source on GitHub ↗

The RAW intent attestation sources (the bridge's dual-read inputs): the tracked vault entry (frontmatter + body bytes) and the legacy sidecar candidate's text — the first EXISTING candidate (the normalized-id path, then the raw-arg path a pre-upgrade build wrote). Both ride the wire when both exist; the client's classification keeps the bridge's precedence (tracked first, sidecar fallback).

(repo: &Repository, id: &str)

Source from the content-addressed store, hash-verified

910/// Both ride the wire when both exist; the client's classification keeps
911/// the bridge's precedence (tracked first, sidecar fallback).
912fn intent_attestation_sources(repo: &Repository, id: &str) -> Value {
913 let vpath = format!(
914 "attestations/{}/attested.md",
915 sanitize_id(&normalized_id(repo, id))
916 );
917 let tracked = repo.vault_retrieve(&vpath).ok().flatten().map(|entry| {
918 serde_json::json!({
919 "path": vpath,
920 "frontmatter_json": entry.frontmatter_json,
921 "content": entry.content_bytes,
922 })
923 });
924 let normalized = repo
925 .dot_dir()
926 .join("canonical")
927 .join("intents")
928 .join(sanitize_id(&normalized_id(repo, id)))
929 .join("attested.jsonld");
930 let raw = repo
931 .dot_dir()
932 .join("canonical")
933 .join("intents")
934 .join(sanitize_id(id))
935 .join("attested.jsonld");
936 let sidecar = [normalized, raw]
937 .into_iter()
938 .find(|candidate| candidate.exists())
939 .and_then(|candidate| {
940 std::fs::read_to_string(&candidate).ok().map(|text| {
941 serde_json::json!({
942 "path": candidate.display().to_string(),
943 "text": text,
944 })
945 })
946 });
947 serde_json::json!({ "tracked": tracked, "sidecar": sidecar })
948}
949
950/// The RAW memory attestation sources: the tracked
951/// `attestations/memory/<id>/attested.md` entry and the single legacy

Callers 1

vault_entry_bundleFunction · 0.85

Calls 7

vault_retrieveMethod · 0.80
sanitize_idFunction · 0.70
normalized_idFunction · 0.70
okMethod · 0.45
dot_dirMethod · 0.45
into_iterMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected