MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / ProgressTracker

Class ProgressTracker

src/tasks/progress.py:84–102  ·  view source on GitHub ↗

Mutable accumulator that watches assistant messages stream by. Token semantics (chapter §"Progress Tracking", line for line): * ``latest_input_tokens`` — kept as the latest value because the API returns input cumulatively per call. Includes ``cache_creation_input_tokens`` and ``

Source from the content-addressed store, hash-verified

82
83@dataclass
84class ProgressTracker:
85 """Mutable accumulator that watches assistant messages stream by.
86
87 Token semantics (chapter §"Progress Tracking", line for line):
88 * ``latest_input_tokens`` — kept as the latest value because the API
89 returns input cumulatively per call. Includes ``cache_creation_input_tokens``
90 and ``cache_read_input_tokens`` (TS does the same: Anthropic's
91 response shape splits them out and the chapter sums them into the
92 "latest" value).
93 * ``cumulative_output_tokens`` — summed because output is per-turn.
94
95 ``recent_activities`` is bounded at ``MAX_RECENT_ACTIVITIES``;
96 ``update_progress_from_message`` drops the oldest entry on overflow.
97 """
98
99 tool_use_count: int = 0
100 latest_input_tokens: int = 0
101 cumulative_output_tokens: int = 0
102 recent_activities: list[ToolActivity] = field(default_factory=list)
103
104
105def total_tokens_from_tracker(tracker: ProgressTracker) -> int:

Calls

no outgoing calls