pub struct MetadataContextAttributionResultContextAttribution {
pub buffer_tokens: i64,
pub categories: MetadataContextAttributionResultContextAttributionCategories,
pub compactions: MetadataContextAttributionResultContextAttributionCompactions,
pub compaction_threshold: i64,
pub entries: Vec<MetadataContextAttributionResultContextAttributionEntriesItem>,
pub limit: i64,
pub model_id: String,
pub model_source: String,
pub prompt_token_limit: i64,
pub total_tokens: i64,
}Expand description
Per-source token attribution snapshot for the current context window. The heaviest individual messages are available separately via metadata.getContextHeaviestMessages.
Fields§
§buffer_tokens: i64Output reserve plus the tokens past the buffer-exhaustion blocking threshold. Mirrors SessionContextInfo.bufferTokens.
categories: MetadataContextAttributionResultContextAttributionCategoriesThe six normalized /context header buckets, computed from the same tokenization as entries so the two never disagree. Convenience rollups: freeSpace and buffer describe window capacity rather than occupied context, so the values do not sum to totalTokens.
compactions: MetadataContextAttributionResultContextAttributionCompactionsSuccessful compaction history for the session.
compaction_threshold: i64Token count at which background compaction starts. Mirrors SessionContextInfo.compactionThreshold.
entries: Vec<MetadataContextAttributionResultContextAttributionEntriesItem>Flat list of per-source attribution entries. Group by kind and render unrecognized kinds generically. Nesting and rollups are expressed via parentId.
limit: i64Prompt limit plus the model’s output reserve: the full context window categories.freeSpace and categories.buffer are measured against. Mirrors SessionContextInfo.limit.
model_id: StringThe concrete model id the entire breakdown was tokenized against (feeds the per-model token multiplier). Under Auto (Free/Student) this is the resolved model, not the literal auto sentinel, so totals are not undercounted. A single-model approximation of a potentially multi-model Auto session.
model_source: StringHow modelId was chosen. Not a closed set — tolerate unknown values. Known values today: autoResolved (the model Auto resolved to), selected (the user’s explicitly selected model), default (a fallback before any model is known).
prompt_token_limit: i64Maximum prompt tokens the resolved model accepts — the denominator for a ##k/###k context-usage display. Mirrors SessionContextInfo.promptTokenLimit.
total_tokens: i64Total token count of the current context window the entries are measured against (system message + conversation messages + tool definitions — the same total reported by /context). Divide an entry’s tokens by this to derive its share.
Trait Implementations§
Source§impl Clone for MetadataContextAttributionResultContextAttribution
impl Clone for MetadataContextAttributionResultContextAttribution
Source§fn clone(&self) -> MetadataContextAttributionResultContextAttribution
fn clone(&self) -> MetadataContextAttributionResultContextAttribution
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more