# Simulation Architecture

The extended GUI simulation suite follows a modular architecture to ensure comprehensive coverage and maintainability.

## 1. Components

### 1.1 `simulation/sim_base.py`
Provides `BaseSimulation`, a base class for all specific simulations.
- Initializes `ApiHookClient` and `WorkflowSimulator`.
- Provides common utility methods (resetting, waiting, asserting state).
- Supports both standalone execution and pytest integration.

### 1.2 Modular Simulation Scripts
Each script focuses on a specific GUI area:
- `simulation/sim_context.py`: Context & Discussion panels, history, aggregation.
- `simulation/sim_ai_settings.py`: AI model configuration, provider switching.
- `simulation/sim_tools.py`: File exploration, MCP tools, web search.
- `simulation/sim_execution.py`: AI-generated scripts, confirmation modals, execution.

## 2. Execution Model

### 2.1 Standalone
Scripts can be run directly (e.g., `python simulation/sim_context.py`) provided the GUI is running with `--enable-test-hooks`.

### 2.2 Automated (pytest)
A thin wrapper in `tests/test_extended_sims.py` will discover and run these simulations using the `live_gui` fixture, ensuring they are part of the CI/CD pipeline.

## 3. Data Management
Simulations will use isolated temporary project files (`tests/temp_sim_*.toml`) to avoid interfering with user configuration or other tests.
