MCPcopy Index your code
hub / github.com/github/copilot-sdk / HistoryCompactContextWindow

Class HistoryCompactContextWindow

python/copilot/generated/rpc.py:2039–2082  ·  view source on GitHub ↗

Post-compaction context window usage breakdown

Source from the content-addressed store, hash-verified

2037# Experimental: this type is part of an experimental API and may change or be removed.
2038@dataclass
2039class HistoryCompactContextWindow:
2040 """Post-compaction context window usage breakdown"""
2041
2042 current_tokens: int
2043 """Current total tokens in the context window (system + conversation + tool definitions)"""
2044
2045 messages_length: int
2046 """Current number of messages in the conversation"""
2047
2048 token_limit: int
2049 """Maximum token count for the model's context window"""
2050
2051 conversation_tokens: int | None = None
2052 """Token count from non-system messages (user, assistant, tool)"""
2053
2054 system_tokens: int | None = None
2055 """Token count from system message(s)"""
2056
2057 tool_definitions_tokens: int | None = None
2058 """Token count from tool definitions"""
2059
2060 @staticmethod
2061 def from_dict(obj: Any) -> 'HistoryCompactContextWindow':
2062 assert isinstance(obj, dict)
2063 current_tokens = from_int(obj.get("currentTokens"))
2064 messages_length = from_int(obj.get("messagesLength"))
2065 token_limit = from_int(obj.get("tokenLimit"))
2066 conversation_tokens = from_union([from_int, from_none], obj.get("conversationTokens"))
2067 system_tokens = from_union([from_int, from_none], obj.get("systemTokens"))
2068 tool_definitions_tokens = from_union([from_int, from_none], obj.get("toolDefinitionsTokens"))
2069 return HistoryCompactContextWindow(current_tokens, messages_length, token_limit, conversation_tokens, system_tokens, tool_definitions_tokens)
2070
2071 def to_dict(self) -> dict:
2072 result: dict = {}
2073 result["currentTokens"] = from_int(self.current_tokens)
2074 result["messagesLength"] = from_int(self.messages_length)
2075 result["tokenLimit"] = from_int(self.token_limit)
2076 if self.conversation_tokens is not None:
2077 result["conversationTokens"] = from_union([from_int, from_none], self.conversation_tokens)
2078 if self.system_tokens is not None:
2079 result["systemTokens"] = from_union([from_int, from_none], self.system_tokens)
2080 if self.tool_definitions_tokens is not None:
2081 result["toolDefinitionsTokens"] = from_union([from_int, from_none], self.tool_definitions_tokens)
2082 return result
2083
2084# Experimental: this type is part of an experimental API and may change or be removed.
2085@dataclass

Callers 1

from_dictMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…