Build a map from session_id → vec of unique intent human keys, read from the vault manifest's per-intent `session` provenance field.
(repo: &Repository)
| 401 | /// Build a map from session_id → vec of unique intent human keys, read from the |
| 402 | /// vault manifest's per-intent `session` provenance field. |
| 403 | fn build_session_intent_map(repo: &Repository) -> HashMap<String, Vec<String>> { |
| 404 | let mut map: HashMap<String, Vec<String>> = HashMap::new(); |
| 405 | let manifest = match repo.vault_manifest() { |
| 406 | Ok(m) => m, |
| 407 | Err(_) => return map, |
| 408 | }; |
| 409 | for (key, summary) in &manifest.intents { |
| 410 | if let Some(session_id) = &summary.session { |
| 411 | let label = if summary.human_key.is_empty() { |
| 412 | key.clone() |
| 413 | } else { |
| 414 | summary.human_key.clone() |
| 415 | }; |
| 416 | let ids = map.entry(session_id.clone()).or_default(); |
| 417 | if !ids.contains(&label) { |
| 418 | ids.push(label); |
| 419 | } |
| 420 | } |
| 421 | } |
| 422 | // Sort intent keys within each session for stable display. |
| 423 | for ids in map.values_mut() { |
| 424 | ids.sort(); |
| 425 | } |
| 426 | map |
| 427 | } |
| 428 | |
| 429 | /// Build a map from session turn_number → intent human key for a specific |
| 430 | /// session, read from the manifest's `session`/`turn` provenance fields. |