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

Function vault_turn_intent

libatomic/src/daemon/services_query.rs:676–691  ·  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

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