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)
| 671 | /// `turn_count + 1` at creation, so subtract one for the ledger's 0-indexed |
| 672 | /// turn number — mirrors the vault's own resolution). |
| 673 | fn 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). |
no test coverage detected