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

Method get_session_phases

atomic-core/src/pristine/txn/read.rs:768–792  ·  view source on GitHub ↗

Get phase timing breakdown for a provenance graph. Returns timing data for each phase in the turn. Populated from the per-phase token breakdown that Sherpa graphs carry; empty for agents that do not emit phase timing.

(
        &self,
        provenance_id: u64,
    )

Source from the content-addressed store, hash-verified

766 /// per-phase token breakdown that Sherpa graphs carry; empty for agents
767 /// that do not emit phase timing.
768 pub fn get_session_phases(
769 &self,
770 provenance_id: u64,
771 ) -> PristineResult<Vec<crate::change::session::PhaseTimingEntry>> {
772 use crate::change::session::{encode_session_prefix, PhaseTimingEntry};
773
774 let table = self.txn.open_table(SESSION_PHASES)?;
775 let mut phases = Vec::new();
776
777 // Bounded prefix scan: all phase keys for this provenance_id lie in
778 // [prefix(id), prefix(id+1)).
779 let start = encode_session_prefix(provenance_id);
780 let end = encode_session_prefix(provenance_id.saturating_add(1));
781 for result in table.range::<&[u8; 16]>(&start..&end)? {
782 let (_key, value) = result?;
783 match PhaseTimingEntry::from_bytes(value.value()) {
784 Ok(entry) => phases.push(entry),
785 Err(e) => {
786 log::warn!("Failed to deserialize phase timing entry: {}", e);
787 }
788 }
789 }
790
791 Ok(phases)
792 }
793
794 /// Get intent metadata for a provenance graph.
795 ///

Callers

nothing calls this directly

Calls 2

encode_session_prefixFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected