| 92 | |
| 93 | @dataclass |
| 94 | class QueryState: |
| 95 | messages: list[Message] |
| 96 | tool_use_context: ToolUseContext |
| 97 | auto_compact_tracking: Any | None = None |
| 98 | max_output_tokens_recovery_count: int = 0 |
| 99 | has_attempted_reactive_compact: bool = False |
| 100 | max_output_tokens_override: int | None = None |
| 101 | stop_hook_active: bool | None = None |
| 102 | turn_count: int = 1 |
| 103 | # Promise from previous turn's Haiku summary, resolved during current streaming. |
| 104 | # Mirrors TS State.pendingToolUseSummary at query.ts:212. Currently unused in |
| 105 | # Python (tool-use summary is out-of-scope for ch5) but reserved so callers |
| 106 | # can plumb a future Haiku promise through state without a struct change. |
| 107 | pending_tool_use_summary: Any | None = None |
| 108 | # Count of consecutive continuation nudges within the current turn. |
| 109 | # Capped at MAX_CONTINUATION_NUDGES to prevent infinite nudge loops |
| 110 | # when the model keeps matching continuation signals without tool calls. |
| 111 | # Mirrors TS State.continuationNudgeCount at query.ts:218. |
| 112 | continuation_nudge_count: int = 0 |
| 113 | transition: Transition | None = None |
no outgoing calls