# State Inventory: App & AppController This document lists all identified state fields and threading locks within the core Manual Slop classes. ## 1. Threading Locks (AppController) | Lock Name | Purpose | Usage Pattern | | :--- | :--- | :--- | | `_send_thread_lock` | Protects AI request thread spawning | Prevents multiple concurrent sends in some contexts. | | `_disc_entries_lock` | Protects discussion history | Guards `disc_entries` during AI responses and user input. | | `_pending_comms_lock` | Protects communication logs | Guards `_comms_log` and `_pending_comms`. | | `_pending_tool_calls_lock` | Protects tool execution state | Guards `_pending_tool_calls` and `_tool_log`. | | `_pending_history_adds_lock` | Protects deferred history updates | Guards `_pending_history_adds`. | | `_pending_gui_tasks_lock` | Primary Background-to-Foreground gate | Guards `_pending_gui_tasks`. Extremely high frequency. | | `_pending_dialog_lock` | Protects modal state (HITL) | Guards `_pending_dialog` and `_pending_actions`. | | `_api_event_queue_lock` | Guards the FastAPI event bus | Protects `_api_event_queue` for external clients. | ## 2. Core State Fields ### 2.1 AppController (Master State) - **Active Context:** `config`, `project`, `active_project_path`, `project_paths`. - **Discussion:** `active_discussion`, `disc_entries`, `disc_roles`. - **Resources:** `files`, `screenshots`. - **Async Infra:** `event_queue`, `_loop_thread`. - **MMA / Conductor:** `tracks`, `active_track`, `engines`, `mma_streams`, `_worker_status`, `mma_status`. - **Metrics/Logs:** `_tool_log`, `_tool_stats`, `_token_history`, `session_usage`, `mma_tier_usage`. - **HITL/Modals:** `_pending_dialog`, `_pending_gui_tasks`, `_pending_mma_approvals`. - **AI Settings:** `_current_provider`, `_current_model`, `temperature`, `top_p`, `max_tokens`. - **Status:** `ai_status`, `rag_status`. ### 2.2 App (UI-Specific & Delegated) - **Delegated to Controller:** `ai_status`, `mma_status`, `ui_ai_input`, `disc_entries`, etc. (See `__getattr__` logic). - **Undo/Redo:** `history` (HistoryManager), `_last_ui_snapshot`. - **Layout/UI State:** `show_windows`, `show_preset_manager_window`, `ui_multi_viewport`, `shader_uniforms`. - **Performance:** `perf_history`, `_token_stats`. - **Theme FX:** `_nerv_crt`, `_nerv_alert`, `_nerv_flicker`.