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

Function build_session_intent_map

atomic-cli/src/commands/session.rs:347–371  ·  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

345/// Build a map from session_id → vec of unique intent human keys, read from the
346/// vault manifest's per-intent `session` provenance field.
347fn build_session_intent_map(repo: &Repository) -> HashMap<String, Vec<String>> {
348 let mut map: HashMap<String, Vec<String>> = HashMap::new();
349 let manifest = match repo.vault_manifest() {
350 Ok(m) => m,
351 Err(_) => return map,
352 };
353 for (key, summary) in &manifest.intents {
354 if let Some(session_id) = &summary.session {
355 let label = if summary.human_key.is_empty() {
356 key.clone()
357 } else {
358 summary.human_key.clone()
359 };
360 let ids = map.entry(session_id.clone()).or_default();
361 if !ids.contains(&label) {
362 ids.push(label);
363 }
364 }
365 }
366 // Sort intent keys within each session for stable display.
367 for ids in map.values_mut() {
368 ids.sort();
369 }
370 map
371}
372
373/// Build a map from session turn_number → intent human key for a specific
374/// 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