MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / take

Method take

src/sessions/codex.rs:903–929  ·  view source on GitHub ↗

The summed counters as a dashboard-shaped usage object, resetting the turn sums (the cumulative-total dedup guard survives across turns).

(&mut self)

Source from the content-addressed store, hash-verified

901 /// The summed counters as a dashboard-shaped usage object, resetting the
902 /// turn sums (the cumulative-total dedup guard survives across turns).
903 pub(crate) fn take(&mut self) -> Option<Value> {
904 if !self.seen {
905 return None;
906 }
907 let mut usage = serde_json::Map::new();
908 usage.insert("input_tokens".to_string(), Value::from(self.input));
909 usage.insert("output_tokens".to_string(), Value::from(self.output));
910 if self.cache_read > 0 {
911 usage.insert(
912 "cache_read_input_tokens".to_string(),
913 Value::from(self.cache_read),
914 );
915 }
916 if self.reasoning > 0 {
917 usage.insert("reasoning_tokens".to_string(), Value::from(self.reasoning));
918 }
919 if self.total > 0 {
920 usage.insert("total_tokens".to_string(), Value::from(self.total));
921 }
922 self.input = 0;
923 self.output = 0;
924 self.cache_read = 0;
925 self.reasoning = 0;
926 self.total = 0;
927 self.seen = false;
928 Some(Value::Object(usage))
929 }
930}
931
932/// Add `add`'s numeric counters field-wise into `existing` (both are usage

Callers 15

run_npmFunction · 0.45
dropMethod · 0.45
stopMethod · 0.45
dropMethod · 0.45
spawn_workerFunction · 0.45
short_branch_hashFunction · 0.45
truncate_displayFunction · 0.45
handle_migrate_actionFunction · 0.45
check_stale_storesFunction · 0.45
short_hexFunction · 0.45
installed_binary_versionFunction · 0.45

Calls 1

insertMethod · 0.80

Tested by 15

truncate_titleFunction · 0.36
dropMethod · 0.36
child_outputFunction · 0.36
dropMethod · 0.36
run_replayFunction · 0.36
dropMethod · 0.36
keepMethod · 0.36
closeMethod · 0.36