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

Function vault_turn_intent

libatomic/src/daemon/services_query.rs:673–688  ·  view source on GitHub ↗

The vault-manifest turn→intent map for one session (the stored `turn` is `turn_count + 1` at creation, so subtract one for the ledger's 0-indexed turn number — mirrors the vault's own resolution).

(repo: &Repository, session_id: &str, turn_number: u32)

Source from the content-addressed store, hash-verified

671/// `turn_count + 1` at creation, so subtract one for the ledger's 0-indexed
672/// turn number — mirrors the vault's own resolution).
673fn vault_turn_intent(repo: &Repository, session_id: &str, turn_number: u32) -> Option<String> {
674 let manifest = repo.vault_manifest().ok()?;
675 for (key, summary) in &manifest.intents {
676 if summary.session.as_deref() != Some(session_id) {
677 continue;
678 }
679 if summary.turn.and_then(|t| t.checked_sub(1)) == Some(turn_number) {
680 return Some(if summary.human_key.is_empty() {
681 key.clone()
682 } else {
683 summary.human_key.clone()
684 });
685 }
686 }
687 None
688}
689
690/// Map a stored session turn to the wire shape (the fields the ledger owns:
691/// turn number, provenance hash, and the turn timestamp).

Callers 1

get_session_implFunction · 0.85

Calls 4

vault_manifestMethod · 0.80
okMethod · 0.45
is_emptyMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected