SIGN IN SIGN UP

Refactor agent_runner: extract methods from send() and _build_options()

Break down two ~100-line methods into focused, single-responsibility
helpers while preserving the public API contract.

send() (was ~100 lines, now ~40):
- _process_assistant_message(): text collection + rate limit detection
- _apply_result_message(): cost/token extraction + event publishing
- _read_tool_state(): ToolState consumption with reset semantics
- _build_success_result(): output assembly + PR URL extraction

_build_options() (was ~100 lines, now ~58):
- _build_mcp_servers(): MCP server dict construction
- _build_allowed_tools(): conditional tool list assembly
- _BASE_ALLOWED_TOOLS, _WORKSPACE_TOOLS, _COMM_TOOLS as Final tuples

Adds 5 characterization tests covering previously untested contracts:
- mailbox/comm branch in _build_options()
- tool_state.needs_info_requested consumption/reset in send()
- tool_state.proposals consumption/reset in send()
- AGENT_OUTPUT event publishing per TextBlock

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
N
Nikita Samoylov committed
74b3d4f9d78ce633d391c63c998aada6b16ec498
Parent: 50fbf0d