Dhanji R. Prasanna
5104bd53b6
refactor(g3-core): improve stream_completion_with_tools readability
Extract and simplify the streaming completion function:
- Extract ensure_context_capacity() helper for pre-loop context management
(thinning + compaction logic now in dedicated async method)
- Simplify compact_summary generation block: flatten nested if/match,
remove redundant comments, reorder branches for clarity
- Remove dead code: unused _last_error variable and modified_tool_call
- Streamline duplicate detection block: reduce verbose logging
- Clean up text content display block: remove redundant comments,
tighten variable declarations
- Remove redundant is_todo_tool redefinition inside block expression
Net reduction: 79 lines (-187/+108)
Behavior unchanged, all unit tests pass.
Agent: carmack