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

Function build_session_intent_map

atomic-cli/src/commands/session.rs:403–427  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
403fn 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.

Calls 6

vault_manifestMethod · 0.80
sortMethod · 0.80
is_emptyMethod · 0.45
cloneMethod · 0.45
containsMethod · 0.45
pushMethod · 0.45