feat(agent): AgentRuntime with confusion counter, token budget, and failure thresholds
Implement the agentic loop (LLM call -> tool execution -> repeat) with:
- Confusion counter: tracks consecutive tool failures, signals Blocked at threshold
- Token budget tracking: cumulative token usage across turns
- Token budget warning: injects 'wrap up' message at warning threshold (default 80%)
- Token budget exhausted: returns TokenBudgetExhausted outcome when budget exceeded
- LLM failure threshold: signals Blocked after N consecutive LLM errors
- Turn limit: stops after max_turns with partial completion
- Configurable error handling: tool errors returned to LLM for self-correction
Verification:
- All 6 agent runtime tests pass
- All existing tests still pass (118 total tests passing)
- No lint warnings
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>