# Specification: AI Interaction Call Graph (ai_interaction_call_graph_20260507)

## Overview
A low-level technical trace of the AI interaction loop. The goal is to map every single function call and data hand-off from the moment a user message is sent to the final terminal execution of a PowerShell script or tool result.

## Scope
- **Entry Point:** `src/gui_2.py:App._render_discussion_panel` (Send button action).
- **Subsystems:** `ai_client.py`, `mcp_client.py`, `shell_runner.py`, `app_controller.py`.

## Functional Requirements
1. **Call Graph Generation:**
   - Document the sequence of synchronous and asynchronous calls.
   - Identify thread boundaries (GUI thread vs. Background worker thread).
2. **Data Transformation Trace:**
   - Track the transformation of a message: raw text -> GenerateRequest -> AI History -> Provider Prompt -> AI Response -> Tool Call -> PS Script.
3. **Error & Retry Paths:**
   - Map how exceptions are caught, classified, and bubbled back to the UI.

## Acceptance Criteria
- [ ] Detailed call graph in Mermaid format.
- [ ] List of all internal private methods involved in the loop.
- [ ] Identification of any blocking calls in the async pipeline.
