71 Commits

Author SHA1 Message Date
ed 273fcf29f1 fix: Disable frosted glass - imgui-bundle cannot sample OpenGL textures
The imgui-bundle backend cannot sample from our OpenGL FBO textures.
This is a fundamental incompatibility. Frosted glass feature
disabled to allow app to run.
2026-03-13 21:45:51 -04:00
ed 1eed009b12 fix(shader): Use custom_background callback to render blurred texture
- Add _render_custom_background method as hello_imgui callback
- Render blurred FBO texture as ImGui background
- Use ctypes.cast to convert OpenGL texture ID to ImTextureRef
2026-03-13 21:44:55 -04:00
ed aed461ef28 fix(shader): Add proper VAO setup for OpenGL 3.3 core profile
- Create _create_quad_vao() method that creates VAO with vertex buffer
- Use explicit vertex attributes (a_position, a_texcoord) in shaders
- Bind VAO before glDrawArrays calls
- Use ctypes for proper buffer sizing
2026-03-13 21:35:23 -04:00
ed 1d36357c64 fix(shader): Disable frosted glass - OpenGL 3.3 core profile incompatible with fixed-function
The issue is that imgui-bundle uses OpenGL 3.3 core profile which doesn't
support glBegin/glEnd. The shaders require VAO setup which is failing.
This needs proper OpenGL debugging in the imgui-bundle context.
2026-03-13 21:28:39 -04:00
ed 3113e4137b fix(shader): Disable frosted glass - OpenGL context issues
The frosted glass effect crashes with GLError 1282 'invalid operation'
when calling glDrawArrays. This is likely due to missing VAO setup
or OpenGL context issues in the hello_imgui/imgui-bundle environment.

DISABLED the effect by default to allow the app to run.
Feature needs proper OpenGL VAO setup to work.
2026-03-13 21:24:14 -04:00
ed cf5eac8c43 fix(gui): Guard against invalid display_size in blur pipeline init
- Remove _init_blur_pipeline call from _post_init (display_size invalid at startup)
- Add validation for ws.x > 0 and ws.y > 0 before FBO creation
- Add validation for fb_scale > 0 with default fallback to 1.0
- Make _init_blur_pipeline return bool for success/failure
- Update plan.md to reflect current progress

Fixes crash: GLError(err=1281, description=b'invalid value')
2026-03-13 21:08:13 -04:00
ed db00fba836 fix(gui): Guard against invalid display_size in blur pipeline init
- Remove _init_blur_pipeline call from _post_init (display_size not valid yet)
- Add dimension validation in _init_blur_pipeline (ws.x > 0 and ws.y > 0)
- Add fb_scale validation (default to 1.0 if <= 0)
- Lazy init only happens when frosted glass is enabled and dimensions are valid
- Fixes GLError 1281 'invalid value' crash on startup
2026-03-13 21:07:09 -04:00
ed a862119922 feat(gui): Add frosted glass tests
- Add test_frosted_glass_disabled (basic test)
- Add test_frosted_glass_enabled (mock-based test)
Task: Phase 3, Task 1-2 complete
2026-03-13 20:56:50 -04:00
ed e6a57cddc2 conductor(plan): Mark Phase 3 Task 1 complete, begin Tasks 2-3 2026-03-13 20:46:59 -04:00
ed 928318fd06 feat(gui): Integrate BlurPipeline with GUI for frosted glass
- Add BlurPipeline import and instance in App class
- Add _pre_new_frame callback to call prepare_global_blur before
- Add ui_frosted_glass_enabled toggle in Shader Editor
- Add _render_frosted_background with screen-space UV sampling
- Add _draw_blurred_rect using ImGui DrawList add_image_quad
- All 12 BlurPipeline tests pass

Task: Phase 3, Task 1 of frosted_glass_20260313 track
2026-03-13 20:46:36 -04:00
ed 5416546207 conductor(plan): Mark Phase 2 complete, begin Phase 3 2026-03-13 20:39:20 -04:00
ed 9c2078ad78 feat(shader): Add prepare_global_blur and high-DPI scaling support
- Add prepare_global_blur() method combining Deep Sea render + blur
- Add fb_scale parameter to setup_fbos() for high-DPI display support
- FBOs now created at scaled resolution (width * fb_scale, height * fb_scale)
- prepare_global_blur() auto-initializes FBOs if scale changes
- Add test_blur_pipeline_prepare_global_blur
- Add test_blur_pipeline_high_dpi_scaling

Task: Phase 2, Tasks 1-2 of frosted_glass_20260313 track
2026-03-13 20:38:03 -04:00
ed ab44102bad conductor(plan): Mark task 'Wide tap Gaussian blur' as complete 2026-03-13 20:28:42 -04:00
ed c8b7fca368 feat(shader): Expand Gaussian blur to 13-tap wide distribution
- Update horizontal and vertical blur shaders from 9-tap to 13-tap kernel
- Use Gaussian weights with sigma=3.5 for creamier 'milky' blur effect
- Add test_blur_pipeline_wide_tap_distribution to verify >= 11 texture samples
- Weights: [0.0152, 0.0300, 0.0525, 0.0812, 0.1110, 0.1342, 0.1432] (symmetric)

Task: Phase 1, Task 3 of frosted_glass_20260313 track
2026-03-13 20:28:12 -04:00
ed b3e6590cb4 conductor(plan): Mark task 'Deep Sea background shader' as complete 2026-03-13 20:25:57 -04:00
ed d85dc3a1b3 feat(shader): Add Deep Sea background shader for BlurPipeline
- Add compile_deepsea_shader() with animated underwater-like GLSL shader
- Add render_deepsea_to_fbo() to render background to scene FBO
- Deep Sea shader features: FBM noise, animated blobs, caustic lines, vignette
- Add deepsea_program to cleanup() for proper resource management
- Add 2 new tests for Deep Sea shader compilation and FBO rendering

Task: Phase 1, Task 2 of frosted_glass_20260313 track
2026-03-13 20:25:26 -04:00
ed 2947948ac6 conductor(plan): Mark task 'BlurPipeline FBO setup' as complete 2026-03-13 20:22:43 -04:00
ed d9148acb0c feat(shader): Add BlurPipeline class for frosted glass FBO setup
- Add BlurPipeline class with downsampled FBO support (scene, blur_a, blur_b)
- Implement 2-pass Gaussian blur shaders (horizontal + vertical)
- Add setup_fbos(), compile_blur_shaders(), prepare_blur(), cleanup() methods
- Add tests for BlurPipeline initialization, FBO setup, shader compilation, blur execution, and cleanup

Task: Phase 1, Task 1 of frosted_glass_20260313 track
2026-03-13 20:22:16 -04:00
ed 2c39f1dcf4 sigh 2026-03-13 20:13:51 -04:00
ed 1a8efa880a tired 2026-03-13 20:12:56 -04:00
ed 11eb69449d dumb ai 2026-03-13 19:46:23 -04:00
ed 3a0d388502 adjust tracks.md 2026-03-13 14:41:08 -04:00
ed 879e0991c9 chore(conductor): Add new track 'Frosted Glass Background Effect' 2026-03-13 14:40:43 -04:00
ed d96adca67c update track ordering 2026-03-13 14:40:37 -04:00
ed 4b0ebe44ff chore(conductor): Add new track 'Advanced Text Viewer with Syntax Highlighting' 2026-03-13 14:28:32 -04:00
ed 6b8151235f adjust track loc 2026-03-13 13:59:43 -04:00
ed 69107a75d3 chore(conductor): Add new track 'Rich Thinking Trace Handling' 2026-03-13 13:54:13 -04:00
ed 89c9f62f0c use maple mono. 2026-03-13 13:49:27 -04:00
ed 87e6b5c665 more win32 wrap 2026-03-13 13:39:42 -04:00
ed 9f8dd48a2e wrap win32 usage in conditionals 2026-03-13 13:29:13 -04:00
ed 87bd2ae11c fixed. 2026-03-13 13:23:31 -04:00
ed a57a3c78d4 fixes 2026-03-13 13:15:58 -04:00
ed ca01397885 checkpoint: fixing ux with window frame bar 2026-03-13 13:13:35 -04:00
ed c76aba64e4 docs(conductor): Synchronize docs for track 'Custom Shader and Window Frame Support' 2026-03-13 12:45:58 -04:00
ed 96de21b2b2 chore(conductor): Mark track 'Custom Shader and Window Frame Support' as complete 2026-03-13 12:45:13 -04:00
ed 25d7d97455 conductor(plan): Mark Phase 5 as complete 2026-03-13 12:45:03 -04:00
ed da478191e9 conductor(checkpoint): Checkpoint end of Phase 5 2026-03-13 12:44:37 -04:00
ed 9b79044caa conductor(plan): Mark Phase 5 implementations as complete 2026-03-13 12:44:19 -04:00
ed 229fbe2b3f feat(gui): Implement live shader editor panel 2026-03-13 12:43:54 -04:00
ed d69434e85f feat(config): Implement parsing for shader and window frame configurations 2026-03-13 12:41:24 -04:00
ed 830bd7b1fb conductor(plan): Mark Phase 4 as complete 2026-03-13 12:38:05 -04:00
ed 50f98deb74 conductor(checkpoint): Checkpoint end of Phase 4 2026-03-13 12:37:45 -04:00
ed 67ed51056e conductor(plan): Mark Phase 4 implementations as complete 2026-03-13 12:36:05 -04:00
ed 905ac00e3f feat(shaders): Implement CRT post-process shader logic 2026-03-13 12:35:43 -04:00
ed 836168a2a8 feat(shaders): Implement dynamic background shader 2026-03-13 12:33:27 -04:00
ed 2dbd570d59 conductor(plan): Mark Phase 3 as complete 2026-03-13 12:31:02 -04:00
ed 5ebce894bb conductor(checkpoint): Checkpoint end of Phase 3 2026-03-13 12:30:41 -04:00
ed 6c4c567ed0 conductor(plan): Mark Phase 3 as complete 2026-03-13 12:29:34 -04:00
ed 09383960be feat(shaders): Implement uniform data passing for ShaderManager 2026-03-13 12:29:10 -04:00
ed ac4f63b76e feat(shaders): Create ShaderManager with basic compilation 2026-03-13 12:27:01 -04:00
ed 356d5f3618 conductor(plan): Mark Phase 2 as complete 2026-03-13 12:24:03 -04:00
ed b9ca69fbae conductor(checkpoint): Checkpoint end of Phase 2 2026-03-13 12:23:40 -04:00
ed 3f4ae21708 conductor(plan): Mark Phase 2 implementation as complete 2026-03-13 12:20:59 -04:00
ed 59d7368bd7 feat(gui): Implement custom title bar and window controls 2026-03-13 12:20:37 -04:00
ed 02fca1f8ba test(gui): Verify borderless window mode is configured 2026-03-13 12:05:49 -04:00
ed 841e54aa47 conductor(plan): Mark Phase 1 as complete 2026-03-13 11:58:43 -04:00
ed 815ee55981 conductor(checkpoint): Checkpoint end of Phase 1 2026-03-13 11:58:16 -04:00
ed 4e5ec31876 conductor(plan): Mark Phase 1 investigation tasks as complete 2026-03-13 11:57:46 -04:00
ed 5f4da366f1 docs(architecture): Add custom shaders and window frame architecture document 2026-03-13 11:57:22 -04:00
ed 82722999a8 ai put it in the wrong spot 2026-03-12 21:47:57 -04:00
ed ad93a294fb chore(conductor): Add new track 'Optimization pass for Data-Oriented Python heuristics' 2026-03-12 21:47:16 -04:00
ed b677228a96 get prior session history properly working. 2026-03-12 21:38:19 -04:00
ed f2c5ae43d7 add resize splitter to dicussion hub message/response section 2026-03-12 21:14:41 -04:00
ed cf5ee6c0f1 make sure you can't send another rquest prompt when one is still being processed 2026-03-12 21:04:14 -04:00
ed 123bcdcb58 config 2026-03-12 20:58:36 -04:00
ed c8eb340afe fixes 2026-03-12 20:58:28 -04:00
ed 414379da4f more fixes 2026-03-12 20:54:47 -04:00
ed 63015e9523 set theme back to nord dark 2026-03-12 20:28:19 -04:00
ed 36b3c33dcc update settings 2026-03-12 20:27:08 -04:00
ed 727274728f archived didn't delete from tracks... 2026-03-12 20:26:56 -04:00
ed befb480285 feat(conductor): Archive External MCP, Project-Specific Conductor, and GUI Path Config tracks 2026-03-12 20:10:05 -04:00
58 changed files with 2537 additions and 175 deletions
+4 -5
View File
@@ -1,7 +1,6 @@
---
description: Tier 2 Tech Lead for architectural design and track execution with persistent memory
mode: primary
model: MiniMax-M2.5
temperature: 0.4
permission:
edit: ask
@@ -14,9 +13,9 @@ ONLY output the requested text. No pleasantries.
## Context Management
**MANUAL COMPACTION ONLY** Never rely on automatic context summarization.
**MANUAL COMPACTION ONLY** Never rely on automatic context summarization.
Use `/compact` command explicitly when context needs reduction.
You maintain PERSISTENT MEMORY throughout track execution do NOT apply Context Amnesia to your own session.
You maintain PERSISTENT MEMORY throughout track execution do NOT apply Context Amnesia to your own session.
## CRITICAL: MCP Tools Only (Native Tools Banned)
@@ -134,14 +133,14 @@ Before implementing:
- Zero-assertion ban: Tests MUST have meaningful assertions
- Delegate test creation to Tier 3 Worker via Task tool
- Run tests and confirm they FAIL as expected
- **CONFIRM FAILURE** this is the Red phase
- **CONFIRM FAILURE** this is the Red phase
### 3. Green Phase: Implement to Pass
- **Pre-delegation checkpoint**: Stage current progress (`git add .`)
- Delegate implementation to Tier 3 Worker via Task tool
- Run tests and confirm they PASS
- **CONFIRM PASS** this is the Green phase
- **CONFIRM PASS** this is the Green phase
### 4. Refactor Phase (Optional)
+9
View File
@@ -0,0 +1,9 @@
import sys
import os
try:
from imgui_bundle import hello_imgui
rp = hello_imgui.RunnerParams()
print(f"Default borderless: {rp.app_window_params.borderless}")
except Exception as e:
print(f"Error: {e}")
+1 -1
View File
@@ -49,7 +49,7 @@ For deep implementation details when planning or implementing tracks, consult `d
- **Multi-Server Lifecycle Management:** Orchestrates multiple concurrent MCP server sessions (Stdio for local subprocesses and SSE for remote servers).
- **Flexible Configuration:** Supports global (`config.toml`) and project-specific (`manual_slop.toml`) paths for `mcp_config.json` (standard MCP configuration format).
- **Auto-Start & Discovery:** Automatically initializes configured servers on project load and dynamically aggregates their tools into the agent's capability declarations.
- **Dedicated Operations UI:** Features a new **External Tools** section within the Operations Hub for monitoring server status (idle, starting, running, error) and browsing discovered tool schemas.
- **Dedicated Operations UI:** Features a new **External Tools** section within the Operations Hub for monitoring server status (idle, starting, running, error) and browsing discovered tool schemas. Supports **Pop-Out Panel functionality**, allowing the External Tools interface to be detached into a standalone window for optimized multi-monitor workflows.
- **Strict HITL Safety:** All external tool calls are intercepted and require explicit human-in-the-loop approval via the standard confirmation dialog before execution.
- **High-Fidelity Selectable UI:** Most read-only labels and logs across the interface (including discussion history, comms payloads, tool outputs, and telemetry metrics) are now implemented as selectable text fields. This enables standard OS-level text selection and copying (Ctrl+C) while maintaining a high-density, non-editable aesthetic.
- **High-Fidelity UI Rendering:** Employs advanced 3x font oversampling and sub-pixel positioning to ensure crisp, high-clarity text rendering across all resolutions, enhancing readability for dense logs and complex code fragments.
+3 -1
View File
@@ -52,6 +52,8 @@
- **LogRegistry & LogPruner:** Custom components for session metadata persistence and automated filesystem cleanup within the `logs/sessions/` taxonomy.
- **psutil:** For system and process monitoring (CPU/Memory telemetry).
- **uv:** An extremely fast Python package and project manager.
- **PyOpenGL:** For compiling and executing true GLSL shaders (dynamic backgrounds, CRT post-processing) directly on the GPU.
- **pywin32:** For custom OS window frame manipulation on Windows (e.g., minimizing, maximizing, closing, and dragging the borderless ImGui window).
- **pytest:** For unit and integration testing, leveraging custom fixtures for live GUI verification.
- **Taxonomy & Artifacts:** Enforces a clean root by organizing core implementation into a `src/` directory, and redirecting session logs and artifacts to configurable directories (defaulting to `logs/sessions/` and `scripts/generated/`). Temporary test data and test logs are siloed in `tests/artifacts/` and `tests/logs/`.
- **ApiHookClient:** A dedicated IPC client for automated GUI interaction and state inspection.
@@ -68,6 +70,6 @@
- **Synchronous IPC Approval Flow:** A specialized bridge mechanism that allows headless AI providers (like Gemini CLI) to synchronously request and receive human approval for tool calls via the GUI's REST API hooks.
- **High-Fidelity Selectable Labels:** Implements a pattern for making read-only UI text selectable by wrapping `imgui.input_text` with `imgui.InputTextFlags_.read_only`. Includes a specialized `_render_selectable_label` helper that resets frame backgrounds, borders, and padding to mimic standard labels while enabling OS-level clipboard support (Ctrl+C).
- **Hybrid Markdown Rendering:** Employs a custom `MarkdownRenderer` that orchestrates `imgui_markdown` for standard text and headers while intercepting code blocks to render them via cached `ImGuiColorTextEdit` instances. This ensures high-performance rich text rendering with robust syntax highlighting and stateful text selection.
- **Faux-Shader Visual Effects:** Utilizes an optimized `ImDrawList`-based batching technique to simulate advanced visual effects such as soft shadows, acrylic glass overlays, and **CRT scanline overlays** without the overhead of heavy GPU-resident shaders or external OpenGL dependencies. Includes support for **dynamic status flickering** and **alert pulsing** integrated into the NERV theme.
- **Hybrid Shader Pipeline:** Utilizes an optimized `ImDrawList`-based batching technique to simulate UI effects such as soft shadows and acrylic glass overlays without the overhead of heavy GPU-resident shaders. Supplemented by a true GPU shader pipeline using `PyOpenGL` and Framebuffer Objects (FBOs) for complex post-processing (CRT scanlines, bloom) and dynamic backgrounds.
- **Interface-Driven Development (IDD):** Enforces a "Stub-and-Resolve" pattern where cross-module dependencies are resolved by generating signatures/contracts before implementation.
+23 -23
View File
@@ -10,32 +10,34 @@ This file tracks all major tracks for the project. Each track has its own detail
### Architecture & Backend
1. [x] **Track: External MCP Server Support**
*Link: [./tracks/external_mcp_support_20260308/](./tracks/external_mcp_support_20260308/)*
*Goal: Add support for external MCP servers (Local Stdio and Remote SSE/WS) with flexible configuration and lifecycle management (including auto-start on project load).*
2. [ ] **Track: RAG Support**
1. [ ] **Track: RAG Support**
*Link: [./tracks/rag_support_20260308/](./tracks/rag_support_20260308/)*
*Goal: Add support for RAG (Retrieval-Augmented Generation) using local vector stores (Chroma/Qdrant), native vendor retrieval, and external RAG APIs. Implement indexing pipeline and retrieval UI.*
3. [x] **Track: Agent Tool Preference & Bias Tuning**
2. [x] **Track: Agent Tool Preference & Bias Tuning**
*Link: [./tracks/tool_bias_tuning_20260308/](./tracks/tool_bias_tuning_20260308/)*
*Goal: Influence agent tool selection via a weighting system. Implement semantic nudges in tool descriptions and a dynamic "Tooling Strategy" section in the system prompt. Includes GUI badges and sliders for weight adjustment.*
4. [x] **Track: Expanded Hook API & Headless Orchestration**
3. [x] **Track: Expanded Hook API & Headless Orchestration**
*Link: [./tracks/hook_api_expansion_20260308/](./tracks/hook_api_expansion_20260308/)*
*Goal: Maximize internal state exposure and provide comprehensive control endpoints (worker spawn/kill, pipeline pause/resume, DAG mutation) via the Hook API. Implement WebSocket-based real-time event streaming.*
5. [ ] **Track: Codebase Audit and Cleanup**
4. [ ] **Track: Codebase Audit and Cleanup**
*Link: [./tracks/codebase_audit_20260308/](./tracks/codebase_audit_20260308/)*
6. [ ] **Track: Expanded Test Coverage and Stress Testing**
5. [ ] **Track: Expanded Test Coverage and Stress Testing**
*Link: [./tracks/test_coverage_expansion_20260309/](./tracks/test_coverage_expansion_20260309/)*
7. [ ] **Track: Beads Mode Integration**
6. [ ] **Track: Beads Mode Integration**
*Link: [./tracks/beads_mode_20260309/](./tracks/beads_mode_20260309/)*
*Goal: Integrate Beads (git-backed graph issue tracker) as an alternative backend for MMA implementation tracks and tickets.*
7. [ ] **Track: Optimization pass for Data-Oriented Python heuristics**
*Link: [./tracks/data_oriented_optimization_20260312/](./tracks/data_oriented_optimization_20260312/)*
8. [ ] **Track: Rich Thinking Trace Handling**
*Link: [./tracks/thinking_trace_handling_20260313/](./tracks/thinking_trace_handling_20260313/)*
---
### GUI Overhauls & Visualizations
@@ -58,7 +60,7 @@ This file tracks all major tracks for the project. Each track has its own detail
5. [x] **Track: NERV UI Theme Integration** (Archived 2026-03-09)
6. [ ] **Track: Custom Shader and Window Frame Support**
6. [x] **Track: Custom Shader and Window Frame Support**
*Link: [./tracks/custom_shaders_20260309/](./tracks/custom_shaders_20260309/)*
7. [x] **Track: UI/UX Improvements - Presets and AI Settings**
@@ -77,6 +79,13 @@ This file tracks all major tracks for the project. Each track has its own detail
*Link: [./tracks/undo_redo_history_20260311/](./tracks/undo_redo_history_20260311/)*
*Goal: Robust, non-provider based undo/redo for text inputs, UI controls, discussion mutations, and context management. Includes hotkey support and a history list view.*
11. [ ] **Track: Advanced Text Viewer with Syntax Highlighting**
*Link: [./tracks/text_viewer_rich_rendering_20260313/](./tracks/text_viewer_rich_rendering_20260313/)*
12. [ ] ~~**Track: Frosted Glass Background Effect**~~ THIS IS A LOST CAUSE DON'T BOTHER.
*Link: [./tracks/frosted_glass_20260313/](./tracks/frosted_glass_20260313/)*
---
### Additional Language Support
@@ -103,18 +112,6 @@ This file tracks all major tracks for the project. Each track has its own detail
---
### Path Configuration
1. [x] **Track: Project-Specific Conductor Directory**
*Link: [./tracks/project_conductor_dir_20260308/](./tracks/project_conductor_dir_20260308/)*
*Goal: Make conductor directory per-project. Each project TOML can specify custom conductor dir for isolated track/state management.*
2. [x] **Track: GUI Path Configuration in Context Hub**
*Link: [./tracks/gui_path_config_20260308/](./tracks/gui_path_config_20260308/)*
*Goal: Add path configuration UI to Context Hub. Allow users to view and edit configurable paths directly from the GUI.*
---
### Manual UX Controls
1. [x] **Track: Saved System Prompt Presets**
@@ -168,6 +165,9 @@ This file tracks all major tracks for the project. Each track has its own detail
### Completed / Archived
- [x] **Track: External MCP Server Support** (Archived 2026-03-12)
- [x] **Track: Project-Specific Conductor Directory** (Archived 2026-03-12)
- [x] **Track: GUI Path Configuration in Context Hub** (Archived 2026-03-12)
- [x] **Track: True Parallel Worker Execution (The DAG Realization)**
- [x] **Track: Deep AST-Driven Context Pruning (RAG for Code)**
- [x] **Track: Visual DAG & Interactive Ticket Editing**
@@ -1,35 +1,35 @@
# Implementation Plan: Custom Shader and Window Frame Support
## Phase 1: Investigation & Architecture Prototyping
- [ ] Task: Investigate `imgui-bundle` and Dear PyGui capabilities for injecting raw custom shaders (OpenGL/D3D11) vs extending ImDrawList batching.
- [ ] Task: Investigate Python ecosystem capabilities for overloading OS window frames (e.g., `pywin32` for DWM vs ImGui borderless mode).
- [ ] Task: Draft architectural design document (`docs/guide_shaders_and_window.md`) detailing the chosen shader injection method and window frame overloading strategy.
- [ ] Task: Conductor - User Manual Verification 'Phase 1: Investigation & Architecture Prototyping' (Protocol in workflow.md)
## Phase 1: Investigation & Architecture Prototyping [checkpoint: 815ee55]
- [x] Task: Investigate imgui-bundle and Dear PyGui capabilities for injecting raw custom shaders (OpenGL/D3D11) vs extending ImDrawList batching. [5f4da36]
- [x] Task: Investigate Python ecosystem capabilities for overloading OS window frames (e.g., `pywin32` for DWM vs ImGui borderless mode). [5f4da36]
- [x] Task: Draft architectural design document (`docs/guide_shaders_and_window.md`) detailing the chosen shader injection method and window frame overloading strategy. [5f4da36]
- [x] Task: Conductor - User Manual Verification 'Phase 1: Investigation & Architecture Prototyping' (Protocol in workflow.md) [815ee55]
## Phase 2: Custom OS Window Frame Implementation
- [ ] Task: Write Tests: Verify the application window launches with the custom frame/borderless mode active.
- [ ] Task: Implement: Integrate custom window framing logic into the main GUI loop (`src/gui_2.py` / Dear PyGui setup).
- [ ] Task: Write Tests: Verify standard window controls (minimize, maximize, close, drag) function correctly with the new frame.
- [ ] Task: Implement: Add custom title bar and window controls matching the application's theme.
- [ ] Task: Conductor - User Manual Verification 'Phase 2: Custom OS Window Frame Implementation' (Protocol in workflow.md)
## Phase 2: Custom OS Window Frame Implementation [checkpoint: b9ca69f]
- [x] Task: Write Tests: Verify the application window launches with the custom frame/borderless mode active. [02fca1f]
- [x] Task: Implement: Integrate custom window framing logic into the main GUI loop (`src/gui_2.py` / Dear PyGui setup). [59d7368]
- [x] Task: Write Tests: Verify standard window controls (minimize, maximize, close, drag) function correctly with the new frame. [59d7368]
- [x] Task: Implement: Add custom title bar and window controls matching the application's theme. [59d7368]
- [x] Task: Conductor - User Manual Verification 'Phase 2: Custom OS Window Frame Implementation' (Protocol in workflow.md) [b9ca69f]
## Phase 3: Core Shader Pipeline Integration
- [ ] Task: Write Tests: Verify the shader manager class initializes without errors and can load a basic shader program.
- [ ] Task: Implement: Create `src/shader_manager.py` (or extend `src/shaders.py`) to handle loading, compiling, and binding true GPU shaders or advanced Faux-Shaders.
- [ ] Task: Write Tests: Verify shader uniform data can be updated from Python dictionaries/TOML configurations.
- [ ] Task: Implement: Add support for uniform passing (time, resolution, mouse pos) to the shader pipeline.
- [ ] Task: Conductor - User Manual Verification 'Phase 3: Core Shader Pipeline Integration' (Protocol in workflow.md)
## Phase 3: Core Shader Pipeline Integration [checkpoint: 5ebce89]
- [x] Task: Write Tests: Verify the shader manager class initializes without errors and can load a basic shader program. [ac4f63b]
- [x] Task: Implement: Create `src/shader_manager.py` (or extend `src/shaders.py`) to handle loading, compiling, and binding true GPU shaders or advanced Faux-Shaders. [ac4f63b]
- [x] Task: Write Tests: Verify shader uniform data can be updated from Python dictionaries/TOML configurations. [0938396]
- [x] Task: Implement: Add support for uniform passing (time, resolution, mouse pos) to the shader pipeline. [0938396]
- [x] Task: Conductor - User Manual Verification 'Phase 3: Core Shader Pipeline Integration' (Protocol in workflow.md) [5ebce89]
## Phase 4: Specific Shader Implementations (CRT, Post-Process, Backgrounds)
- [ ] Task: Write Tests: Verify background shader logic can render behind the main ImGui layer.
- [ ] Task: Implement: Add "Dynamic Background" shader implementation (e.g., animated noise/gradients).
- [ ] Task: Write Tests: Verify post-process shader logic can capture the ImGui output and apply an effect over it.
- [ ] Task: Implement: Add "CRT / Retro" (NERV theme) and general "Post-Processing" (bloom/blur) shaders.
- [ ] Task: Conductor - User Manual Verification 'Phase 4: Specific Shader Implementations' (Protocol in workflow.md)
## Phase 4: Specific Shader Implementations (CRT, Post-Process, Backgrounds) [checkpoint: 50f98de]
- [x] Task: Write Tests: Verify background shader logic can render behind the main ImGui layer. [836168a]
- [x] Task: Implement: Add "Dynamic Background" shader implementation (e.g., animated noise/gradients). [836168a]
- [x] Task: Write Tests: Verify post-process shader logic can capture the ImGui output and apply an effect over it. [905ac00]
- [x] Task: Implement: Add "CRT / Retro" (NERV theme) and general "Post-Processing" (bloom/blur) shaders. [905ac00]
- [x] Task: Conductor - User Manual Verification 'Phase 4: Specific Shader Implementations' (Protocol in workflow.md) [50f98de]
## Phase 5: Configuration and Live Editor UI
- [ ] Task: Write Tests: Verify shader and window frame settings can be parsed from `config.toml`.
- [ ] Task: Implement: Update `src/theme.py` / `src/project_manager.py` to parse and apply shader/window configurations from TOML.
- [ ] Task: Write Tests: Verify the Live UI Editor panel renders and modifying its values updates the shader uniforms.
- [ ] Task: Implement: Create a "Live UI Editor" Dear PyGui/ImGui panel to tweak shader uniforms in real-time.
- [ ] Task: Conductor - User Manual Verification 'Phase 5: Configuration and Live Editor UI' (Protocol in workflow.md)
## Phase 5: Configuration and Live Editor UI [checkpoint: da47819]
- [x] Task: Write Tests: Verify shader and window frame settings can be parsed from `config.toml`. [d69434e]
- [x] Task: Implement: Update `src/theme.py` / `src/project_manager.py` to parse and apply shader/window configurations from TOML. [d69434e]
- [x] Task: Write Tests: Verify the Live UI Editor panel renders and modifying its values updates the shader uniforms. [229fbe2]
- [x] Task: Implement: Create a "Live UI Editor" Dear PyGui/ImGui panel to tweak shader uniforms in real-time. [229fbe2]
- [x] Task: Conductor - User Manual Verification 'Phase 5: Configuration and Live Editor UI' (Protocol in workflow.md) [da47819]
@@ -0,0 +1,5 @@
# Track data_oriented_optimization_20260312 Context
- [Specification](./spec.md)
- [Implementation Plan](./plan.md)
- [Metadata](./metadata.json)
@@ -0,0 +1,8 @@
{
"track_id": "data_oriented_optimization_20260312",
"type": "chore",
"status": "new",
"created_at": "2026-03-12T00:00:00Z",
"updated_at": "2026-03-12T00:00:00Z",
"description": "Optimization pass. I want to update the product guidlines to take into account with data-oriented appraoch the more performant way to semantically define procedrual code in python so executes almost entirely heavy operations optimally. I know there is a philosophy of 'the less python does the better' which is problably why the imgui lib is so performant because all python really does is define the ui's DAG via an imgui interface procedurally along with what state the dag may modify within its constraints of interactions the user may do. This problably can be reflected in the way the rest of the codebase is done. I want to go over the ./src and ./simulation to make sure this insight and related herustics are properly enfroced. Worst case I want to identify what code I should consider lower down to C maybe and making python bindings to if there is a significant bottleneck identified via profiling and testing that cannot be resolved otherwise."
}
@@ -0,0 +1,27 @@
# Implementation Plan: Data-Oriented Python Optimization Pass
## Phase 1: Guidelines and Instrumentation
- [ ] Task: Update `conductor/product-guidelines.md` with Data-Oriented Python heuristics and the "less Python does the better" philosophy.
- [ ] Task: Review existing profiling instrumentation in `src/performance_monitor.py` or diagnostic hooks.
- [ ] Task: Expand profiling instrumentation to capture more detailed execution times for non-GUI data structures/processes if necessary.
- [ ] Task: Conductor - User Manual Verification 'Phase 1: Guidelines and Instrumentation' (Protocol in workflow.md)
## Phase 2: Audit and Profiling (`src/` and `simulation/`)
- [ ] Task: Run profiling scenarios (especially utilizing simulations) to generate baseline metrics.
- [ ] Task: Audit `src/` (e.g., `dag_engine.py`, `multi_agent_conductor.py`, `aggregate.py`) against the new guidelines, cross-referencing with profiling data to identify bottlenecks.
- [ ] Task: Audit `simulation/` files against the new guidelines to ensure the test harness is performant and non-blocking.
- [ ] Task: Compile a list of identified bottleneck targets to refactor.
- [ ] Task: Conductor - User Manual Verification 'Phase 2: Audit and Profiling (`src/` and `simulation/`)' (Protocol in workflow.md)
## Phase 3: Targeted Optimization and Refactoring
- [ ] Task: Write/update tests for the first identified bottleneck to establish a performance or structural baseline (Red Phase).
- [ ] Task: Refactor the first identified bottleneck to align with data-oriented guidelines (Green Phase).
- [ ] Task: Write/update tests for remaining identified bottlenecks.
- [ ] Task: Refactor remaining identified bottlenecks.
- [ ] Task: Conductor - User Manual Verification 'Phase 3: Targeted Optimization and Refactoring' (Protocol in workflow.md)
## Phase 4: Final Evaluation and Documentation
- [ ] Task: Re-run all profiling scenarios to compare against the baseline metrics.
- [ ] Task: Analyze remaining bottlenecks that did not reach performance thresholds and document them as candidates for C/C++ bindings (Last Resort).
- [ ] Task: Generate a final summary report of the optimizations applied and the C extension evaluation.
- [ ] Task: Conductor - User Manual Verification 'Phase 4: Final Evaluation and Documentation' (Protocol in workflow.md)
@@ -0,0 +1,35 @@
# Specification: Data-Oriented Python Optimization Pass
## Overview
Perform an optimization pass and audit across the codebase (`./src` and `./simulation`), aligning the implementation with the Data-Oriented Design philosophy and the "less Python does the better" heuristic. Update the `product-guidelines.md` to formally document this approach for procedural Python code.
## Functional Requirements
1. **Update Product Guidelines:**
- Formalize the heuristic that Python should act primarily as a procedural semantic definer (similar to how ImGui defines a UI DAG), delegating heavy lifting.
- Enforce data-oriented guidelines for Python code structure, focusing on minimizing Python JIT overhead.
2. **Codebase Audit (`./src` and `./simulation`):**
- Review global `src/` files and simulation logic against the new guidelines.
- Identify bottlenecks that violate these heuristics (e.g., heavy procedural state manipulation in Python).
3. **Profiling & Instrumentation Expansion:**
- Expand existing profiling instrumentation (e.g., `performance_monitor.py` or diagnostic hooks) if currently insufficient for identifying real structural bottlenecks.
4. **Optimization Execution:**
- Refactor identified bottlenecks to align with the new data-oriented Python heuristics.
- Re-evaluate performance post-refactor.
5. **C Extension Evaluation (Last Resort):**
- If Python optimizations fail to meet performance thresholds, specifically identify and document routines that must be lowered to C/C++ with Python bindings. Only proceed with bindings if absolutely necessary.
## Non-Functional Requirements
- Maintain existing test coverage and strict type-hinting requirements.
- Ensure 1-space indentation and ultra-compact style rules are not violated during refactoring.
- Ensure the main GUI rendering thread is never blocked.
## Acceptance Criteria
- `product-guidelines.md` is updated with data-oriented procedural Python guidelines.
- `src/` and `simulation/` undergo a documented profiling audit.
- Identified bottlenecks are refactored to reduce Python overhead.
- No regressions in automated simulation or unit tests.
- A final report is provided detailing optimizations made and any candidates for future C extension porting.
## Out of Scope
- Actually implementing C/C++ bindings in this track (this track only identifies/evaluates them as a last resort; if needed, they get a separate track).
- Major UI visual theme changes.
@@ -0,0 +1,28 @@
# Debrief: Failed Frosted Glass Implementation (Attempt 1)
## 1. Post-Mortem Summary
The initial implementation of the Frosted Glass effect was a catastrophic failure resulting in application crashes (`RecursionError`, `AttributeError`, `RuntimeError`) and visual non-functionality (black backgrounds or invisible blurs).
## 2. Root Causes
### A. Architectural Blindness (ImGui Timing)
I attempted to use `glCopyTexImage2D` to capture the "backbuffer" during the `_gui_func` execution. In an immediate-mode GUI (ImGui), the backbuffer is cleared at the start of the frame and draw commands are only recorded during `_gui_func`. The actual GPU rendering happens **after** `_gui_func` finishes. Consequently, I was capturing and blurring an empty black screen every frame.
### B. Sub-Agent Fragmentation (Class Scope Breaks)
By delegating massive file refactors to the `generalist` sub-agent, I lost control over the strict 1-space indentation required by this project. The sub-agent introduced unindented blocks that silently closed the `App` class scope, causing all subsequent methods to become global functions. This lead to the avalanche of `AttributeError: 'App' object has no attribute '_render_operations_hub_contents'` and similar errors.
### C. Style Stack Imbalance
The implementation of `_begin_window` and `_end_window` wrappers failed to account for mid-render state changes. Toggling the "Frosted Glass" checkbox mid-frame resulted in mismatched `PushStyleColor` and `PopStyleColor` calls, triggering internal ImGui assertions and hard crashes.
### D. High-DPI Math Errors
The UV coordinate math failed to correctly account for `display_framebuffer_scale`. On high-resolution screens, the blur sampling was offset by thousands of pixels, rendering the effect physically invisible or distorted.
TODO:
LOOK AT THIS SHIT:
https://www.unknowncheats.me/forum/general-programming-and-reversing/617284-blurring-imgui-basically-window-using-acrylic-blur.html
https://github.com/Speykious/opengl-playground/blob/main/src/scenes/blurring.rs
https://www.intel.com/content/www/us/en/developer/articles/technical/an-investigation-of-fast-real-time-gpu-based-image-blur-algorithms.html
https://github.com/cofenberg/unrimp/blob/45aa431286ce597c018675c1a9730d98e6ccfc64/Renderer/RendererRuntime/src/DebugGui/DebugGuiManager.cpp
https://github.com/cofenberg/unrimp/blob/45aa431286ce597c018675c1a9730d98e6ccfc64/Renderer/RendererRuntime/src/DebugGui/Detail/Shader/DebugGui_GLSL_410.h
https://github.com/itsRythem/ImGui-Blur
@@ -0,0 +1,6 @@
# Track frosted_glass_20260313 Context (REPAIR)
- [Debrief](./debrief.md)
- [Specification](./spec.md)
- [Implementation Plan](./plan.md)
- [Metadata](./metadata.json)
@@ -0,0 +1,8 @@
{
"track_id": "frosted_glass_20260313",
"type": "feature",
"status": "new",
"created_at": "2026-03-13T14:39:00Z",
"updated_at": "2026-03-13T18:55:00Z",
"description": "REPAIR: Implement stable frosted glass using native Windows DWM APIs."
}
@@ -0,0 +1,19 @@
# Implementation Plan: Frosted Glass Background Effect (REPAIR - TRUE GPU)
## Phase 1: Robust Shader & FBO Foundation
- [x] Task: Implement: Create `ShaderManager` methods for downsampled FBO setup (scene, temp, blur). [d9148ac]
- [x] Task: Implement: Develop the "Deep Sea" background shader and integrate it as the FBO source. [d85dc3a]
- [x] Task: Implement: Develop the 2-pass Gaussian blur shaders with a wide tap distribution. [c8b7fca]
- [x] Task: Conductor - User Manual Verification 'Phase 1: Robust Foundation' (Protocol in workflow.md)
## Phase 2: High-Performance Blur Pipeline
- [x] Task: Implement: Create the `prepare_global_blur` method that renders the background and blurs it at 1/4 resolution. [9c2078a]
- [x] Task: Implement: Ensure the pipeline correctly handles high-DPI scaling (`fb_scale`) for internal FBO dimensions. [9c2078a]
- [x] Task: Conductor - User Manual Verification 'Phase 2: High-Performance Pipeline' (Protocol in workflow.md)
## Phase 3: GUI Integration & Screen-Space Sampling
- [x] Task: Implement: Update `_render_frosted_background` to perform normalized screen-space UV sampling. [926318f]
- [x] Task: Fix crash when display_size is invalid at startup. [db00fba]
## Phase 3: GUI Integration & Screen-Space Sampling
- [x] Task: Implement: Update `_render_frosted_background` to perform normalized screen-space UV sampling. [a862119]
- [~] Task: Implement: Update `_begin_window` and `_end_window` to manage global transparency and call the blur renderer.
@@ -0,0 +1,30 @@
# Specification: Frosted Glass Background Effect (REPAIR - TRUE GPU)
## Overview
Implement a high-fidelity "frosted glass" (acrylic) background effect using a dedicated OpenGL pipeline. This implementation follows professional rendering patterns (downsampling, multi-pass blurring, and screen-space sampling) to ensure a smooth, milky look that remains performant on high-DPI displays.
## Functional Requirements
- **Dedicated Background Pipeline:**
- Render the animated "Deep Sea" background shader to an off-screen `SceneFBO` once per frame.
- **Multi-Scale Downsampled Blur:**
- Downsample the `SceneFBO` texture to 1/4 or 1/8 resolution.
- Perform 2-pass Gaussian blurring on the downsampled texture to achieve a creamy "milky" aesthetic.
- **ImGui Panel Integration:**
- Each ImGui panel must sample its background from the blurred texture using screen-space UV coordinates.
- Automatically force window transparency (`alpha 0.0`) when the effect is active.
- **Real-Time Shader Tuning:**
- Control blur radius, tint intensity, and opacity via the Live Shader Editor.
- **Stability:**
- Balanced style-stack management to prevent ImGui assertion crashes.
- Strict 1-space indentation and class scope protection.
## Technical Implementation
- **FBO Management:** Persistent FBOs for scene, temp, and blur textures.
- **UV Math:** `(window_pos / screen_res)` mapping to handle high-DPI scaling and vertical flipping.
- **DrawList Callbacks:** (If necessary) use callbacks to ensure the background is ready before panels draw.
## Acceptance Criteria
- [ ] Toggling the effect does not crash the app.
- [ ] Windows show a deep, high-quality blur of the background shader.
- [ ] Blur follows windows perfectly during drag/resize.
- [ ] The "Milky" look is highly visible even at low radii.
@@ -0,0 +1,5 @@
# Track text_viewer_rich_rendering_20260313 Context
- [Specification](./spec.md)
- [Implementation Plan](./plan.md)
- [Metadata](./metadata.json)
@@ -0,0 +1,8 @@
{
"track_id": "text_viewer_rich_rendering_20260313",
"type": "feature",
"status": "new",
"created_at": "2026-03-13T14:22:00Z",
"updated_at": "2026-03-13T14:22:00Z",
"description": "Make the text viewer support syntax highlighting and markdown for different text types. Whatever feeds the text viewer new context must specify the type to use otherwise fallback to just regular text visualization without highlighting or markdown rendering."
}
@@ -0,0 +1,29 @@
# Implementation Plan: Advanced Text Viewer with Syntax Highlighting
## Phase 1: State & Interface Update
- [ ] Task: Audit `src/gui_2.py` to ensure all `text_viewer_*` state variables are explicitly initialized in `App.__init__`.
- [ ] Task: Implement: Update `App.__init__` to initialize `self.show_text_viewer`, `self.text_viewer_title`, `self.text_viewer_content`, and new `self.text_viewer_type` (defaulting to "text").
- [ ] Task: Implement: Update `self.text_viewer_wrap` (defaulting to True) to allow independent word wrap.
- [ ] Task: Implement: Update `_render_text_viewer(self, label: str, content: str, text_type: str = "text")` signature and caller usage.
- [ ] Task: Conductor - User Manual Verification 'Phase 1: State & Interface Update' (Protocol in workflow.md)
## Phase 2: Core Rendering Logic (Code & MD)
- [ ] Task: Write Tests: Create a simulation test in `tests/test_gui_text_viewer.py` to verify the viewer opens and switches rendering paths based on `text_type`.
- [ ] Task: Implement: In `src/gui_2.py`, refactor the text viewer window loop to:
- Use `MarkdownRenderer.render` if `text_type == "markdown"`.
- Use a cached `ImGuiColorTextEdit.TextEditor` if `text_type` matches a code language.
- Fallback to `imgui.input_text_multiline` for plain text.
- [ ] Task: Implement: Ensure the `TextEditor` instance is properly cached using a unique key for the text viewer to maintain state.
- [ ] Task: Conductor - User Manual Verification 'Phase 2: Core Rendering Logic' (Protocol in workflow.md)
## Phase 3: UI Features (Copy, Line Numbers, Wrap)
- [ ] Task: Write Tests: Update `tests/test_gui_text_viewer.py` to verify the copy-to-clipboard functionality and word wrap toggle.
- [ ] Task: Implement: Add a "Copy" button to the text viewer title bar or a small toolbar at the top of the window.
- [ ] Task: Implement: Add a "Word Wrap" checkbox inside the text viewer window.
- [ ] Task: Implement: Configure the `TextEditor` instance to show line numbers and be read-only.
- [ ] Task: Conductor - User Manual Verification 'Phase 3: UI Features' (Protocol in workflow.md)
## Phase 4: Integration & Rollout
- [ ] Task: Implement: Update all existing calls to `_render_text_viewer` in `src/gui_2.py` (e.g., in `_render_files_panel`, `_render_tool_calls_panel`) to pass the correct `text_type` based on file extension or content.
- [ ] Task: Implement: Add "Markdown Preview" support for system prompt presets using the new text viewer logic.
- [ ] Task: Conductor - User Manual Verification 'Phase 4: Integration & Rollout' (Protocol in workflow.md)
@@ -0,0 +1,30 @@
# Specification: Advanced Text Viewer with Syntax Highlighting
## Overview
Enhance the existing "Text Viewer" popup panel in the Manual Slop GUI to support rich rendering, including syntax highlighting for various code types and Markdown rendering. The viewer will transition from a basic text/multiline input to a specialized component leveraging the project's hybrid rendering pattern.
## Functional Requirements
- **Rich Rendering Support:**
- **Code:** Integration with `ImGuiColorTextEdit` for syntax highlighting (Python, PowerShell, JSON, TOML, etc.).
- **Markdown:** Integration with `imgui_markdown` for rendering formatted text and documents.
- **Fallback:** Plain text rendering for unknown or unspecified types.
- **Explicit Type Specification:**
- The component/function triggering the viewer (e.g., `_render_text_viewer`) must provide an explicit `text_type` parameter (e.g., "python", "markdown", "text").
- **Enhanced UI Features:**
- **Line Numbers:** Display line numbers in the gutter when viewing code.
- **Copy Button:** A dedicated button to copy the entire content to the clipboard.
- **Independent Word Wrap:** A toggle within the viewer window to enable/disable word wrapping specifically for that instance, overriding the global GUI setting if necessary.
- **Persistent Sizing:** The viewer should maintain its size/position via ImGui's standard `.ini` persistence.
## Technical Implementation
- Update `App` state in `src/gui_2.py` to store `text_viewer_type`.
- Modify `_render_text_viewer` signature to accept `text_type`.
- Update the rendering loop in `_gui_func` to switch between `MarkdownRenderer` logic and `TextEditor` logic based on `text_viewer_type`.
- Ensure proper caching of `TextEditor` instances to maintain scroll position and selection state while the viewer is open.
## Acceptance Criteria
- [ ] Clicking a preview button for a Python file opens the viewer with syntax highlighting and line numbers.
- [ ] Clicking a preview for a `.md` file renders it as formatted Markdown.
- [ ] The "Copy" button correctly copies text to the OS clipboard.
- [ ] The word wrap toggle works immediately without affecting other panels.
- [ ] Unsupported types gracefully fall back to standard plain text.
@@ -0,0 +1,5 @@
# Track thinking_trace_handling_20260313 Context
- [Specification](./spec.md)
- [Implementation Plan](./plan.md)
- [Metadata](./metadata.json)
@@ -0,0 +1,8 @@
{
"track_id": "thinking_trace_handling_20260313",
"type": "feature",
"status": "new",
"created_at": "2026-03-13T13:28:00Z",
"updated_at": "2026-03-13T13:28:00Z",
"description": "Properly section and handle 'agent thinking' responses from the ai. Right now we just have <thinking> indicators not sure if thats a bodge or if there is a richer way we could be handling this..."
}
@@ -0,0 +1,26 @@
# Implementation Plan: Rich Thinking Trace Handling
## Phase 1: Core Parsing & Model Update
- [ ] Task: Audit `src/models.py` and `src/project_manager.py` to identify current message serialization schemas.
- [ ] Task: Write Tests: Verify that raw AI responses with `<thinking>`, `<thought>`, and `Thinking:` markers are correctly parsed into segmented data structures (Thinking vs. Response).
- [ ] Task: Implement: Add `ThinkingSegment` model and update `ChatMessage` schema in `src/models.py` to support optional thinking traces.
- [ ] Task: Implement: Update parsing logic in `src/ai_client.py` or a dedicated utility to extract segments from raw provider responses.
- [ ] Task: Conductor - User Manual Verification 'Phase 1: Core Parsing & Model Update' (Protocol in workflow.md)
## Phase 2: Persistence & History Integration
- [ ] Task: Write Tests: Verify that `ProjectManager` correctly serializes and deserializes messages with thinking segments to/from TOML history files.
- [ ] Task: Implement: Update `src/project_manager.py` to handle the new `ChatMessage` schema during session save/load.
- [ ] Task: Implement: Ensure `src/aggregate.py` or relevant context builders include thinking traces in the "Discussion History" sent back to the AI.
- [ ] Task: Conductor - User Manual Verification 'Phase 2: Persistence & History Integration' (Protocol in workflow.md)
## Phase 3: GUI Rendering - Comms & Discussion
- [ ] Task: Write Tests: Verify the GUI rendering logic correctly handles messages with and without thinking segments.
- [ ] Task: Implement: Create a reusable `_render_thinking_trace` helper in `src/gui_2.py` using a collapsible header (e.g., `imgui.collapsing_header`).
- [ ] Task: Implement: Integrate the thinking trace renderer into the **Comms History** panel in `src/gui_2.py`.
- [ ] Task: Implement: Integrate the thinking trace renderer into the **Discussion Hub** message loop in `src/gui_2.py`.
- [ ] Task: Conductor - User Manual Verification 'Phase 3: GUI Rendering - Comms & Discussion' (Protocol in workflow.md)
## Phase 4: Final Polish & Theming
- [ ] Task: Implement: Apply specialized styling (e.g., tinted background or italicized text) to expanded thinking traces to distinguish them from direct responses.
- [ ] Task: Implement: Ensure thinking trace headers show a "Calculating..." or "Monologue" indicator while an agent is active.
- [ ] Task: Conductor - User Manual Verification 'Phase 4: Final Polish & Theming' (Protocol in workflow.md)
@@ -0,0 +1,31 @@
# Specification: Rich Thinking Trace Handling
## Overview
Implement a formal system for parsing, storing, and rendering "agent thinking" monologues (chains of thought) within the Manual Slop GUI. Currently, thinking traces are treated as raw text or simple markers. This track will introduce a structured UI pattern to separate internal monologue from direct user responses while preserving both for future context.
## Functional Requirements
- **Multi-Format Parsing:** Support extraction of thinking traces from `<thinking>...</thinking>`, `<thought>...</thought>`, and blocks prefixed with `Thinking:`.
- **Integrated UI Rendering:**
- In the **Comms History** and **Discussion Hub**, thinking traces must be rendered in a distinct, collapsible section.
- The section should be **Collapsed by Default** to minimize visual noise.
- Thinking traces must be visually separated from the "visible" response (e.g., using a tinted background, border, or specialized header).
- **Persistent State Management:**
- Both the thinking monologue and the final response must be saved to the permanent discussion history (`manual_slop_history.toml` or `project_history.toml`).
- History entries must be properly tagged/schematized to distinguish between thinking and output.
- **Context Recurrence:**
- Thinking traces must be included in subsequent AI turns (Full Recurrence) to maintain the model's internal state and logical progression.
## Non-Functional Requirements
- **Performance:** Parsing and rendering of thinking blocks must not introduce visible latency in the GUI thread.
- **Accessibility:** All thinking blocks must remain selectable and copyable via the standard high-fidelity selectable UI pattern.
## Acceptance Criteria
- [ ] AI responses containing `<thinking>` or similar tags are automatically parsed into separate segments.
- [ ] A "Thinking..." header appears in the Discussion Hub for messages with monologues.
- [ ] Clicking the header expands the full thinking trace.
- [ ] Saving/Loading a project preserves the distinction between thinking and response.
- [ ] Subsequent AI calls receive the thinking trace as part of the conversation history.
## Out of Scope
- Implementing "Hidden Thinking" (where the user cannot see it but the AI can).
- Real-time "Streaming" of thinking into the UI (unless already supported by the active provider).
+13 -10
View File
@@ -23,22 +23,23 @@ active = "C:/projects/gencpp/gencpp_sloppy.toml"
separate_message_panel = false
separate_response_panel = false
separate_tool_calls_panel = false
bg_shader_enabled = true
bg_shader_enabled = false
crt_filter_enabled = false
separate_task_dag = false
separate_usage_analytics = false
separate_usage_analytics = true
separate_tier1 = false
separate_tier2 = false
separate_tier3 = false
separate_tier4 = false
separate_external_tools = true
[gui.show_windows]
"Context Hub" = true
"Files & Media" = true
"AI Settings" = true
"MMA Dashboard" = true
"Task DAG" = true
"Usage Analytics" = false
"Task DAG" = false
"Usage Analytics" = true
"Tier 1" = false
"Tier 2" = false
"Tier 3" = false
@@ -50,19 +51,21 @@ separate_tier4 = false
"Discussion Hub" = true
"Operations Hub" = true
Message = false
Response = false
Response = true
"Tool Calls" = false
Theme = true
"Log Management" = true
Diagnostics = false
"External Tools" = false
"Shader Editor" = true
[theme]
palette = "Nord Dark"
font_path = "C:/projects/manual_slop/assets/fonts/Inter-Regular.ttf"
font_size = 14.0
scale = 1.2000000476837158
transparency = 1.0
child_transparency = 1.0
font_path = "C:/projects/manual_slop/assets/fonts/MapleMono-Regular.ttf"
font_size = 18.0
scale = 1.0
transparency = 0.4399999976158142
child_transparency = 0.5099999904632568
[mma]
max_workers = 4
+33
View File
@@ -0,0 +1,33 @@
# Custom Shaders and Window Frame Architecture
## 1. Shader Injection Strategy
### Evaluation
* **Dear PyGui (Legacy):** Does not natively support raw GLSL/HLSL shader injection into the UI layer. It relies heavily on fixed-function vertex/fragment shaders compiled into the C++ core. Faux-shaders via DrawList are the only viable path without modifying the DPG source.
* **imgui-bundle (Current):** `imgui-bundle` utilizes `hello_imgui` as its application runner, which provides robust lifecycle callbacks (e.g., `callbacks.custom_background`, `callbacks.post_init`). Because `hello_imgui` exposes the underlying OpenGL context, we can use `PyOpenGL` alongside it to execute raw GLSL shaders.
### Chosen Approach: Hybrid Faux-Shader & PyOpenGL FBO
Given the Python environment, we will adopt a hybrid approach:
1. **Faux-Shaders (ImDrawList Batching):** Continue using `imgui.ImDrawList` primitives for simple effects like soft shadows, glows, and basic gradients (as seen in `src/shaders.py`). This is highly performant for UI elements and requires no external dependencies.
2. **True GPU Shaders (PyOpenGL + FBO):** For complex post-processing (CRT curvature, bloom, dynamic noise backgrounds), we will integrate `PyOpenGL`.
* We will compile GLSL shaders during `post_init`.
* We will render the effect into a Framebuffer Object (FBO).
* We will display the resulting texture ID using `imgui.image()` or inject it into the `custom_background` callback.
*Note: This approach introduces `PyOpenGL` as a dependency, which is standard for advanced Python graphics.*
## 2. Custom Window Frame Strategy
### Evaluation
* **Native DWM Overloading (PyWin32):** It is possible to use `pywin32` to subclass the application window, intercept `WM_NCHITTEST`, and return `HTCAPTION` for a custom ImGui-drawn title bar region. This preserves Windows snap layouts and native drop shadows. However, it is strictly Windows-only and can conflict with GLFW/SDL2 event loops used by `hello_imgui`.
* **Borderless Window Mode (ImGui/GLFW):** `hello_imgui` allows configuring the main window as borderless/undecorated (`runner_params.app_window_params.borderless = True`). We must then manually draw the title bar, minimize/maximize/close buttons, and handle window dragging by updating the OS window position based on ImGui mouse drag deltas.
### Chosen Approach: Pure ImGui Borderless Implementation
To ensure cross-platform compatibility and avoid brittle Win32 hook collisions with `hello_imgui`, we will use the **Borderless Window Mode** approach.
1. **Initialization:** Configure `hello_imgui.RunnerParams` to disable OS window decorations.
2. **Title Bar Rendering:** Dedicate the top ~30 pixels of the ImGui workspace to a custom title bar that matches the current theme (e.g., NERV or standard).
3. **Window Controls:** Implement custom ImGui buttons for `_`, `[]`, and `X`, which will call native window management functions exposed by `hello_imgui` or `glfw`.
4. **Drag Handling:** Detect `imgui.is_mouse_dragging()` on the title bar region and dynamically adjust the application window position.
## 3. Integration with Event Metrics
Both the shader uniforms (time, resolution) and window control events will be hooked into the existing `dag_engine` and `events` systems to ensure minimal performance overhead and centralized configuration via `config.toml`.
+22
View File
@@ -0,0 +1,22 @@
;;; !!! This configuration is handled by HelloImGui and stores several Ini Files, separated by markers like this:
;;;<<<INI_NAME>>>;;;
;;;<<<ImGui_655921752_Default>>>;;;
[Window][Debug##Default]
Pos=60,60
Size=400,400
Collapsed=0
[Docking][Data]
;;;<<<Layout_655921752_Default>>>;;;
;;;<<<HelloImGui_Misc>>>;;;
[Layout]
Name=Default
[StatusBar]
Show=false
ShowFps=true
[Theme]
Name=DarculaDarker
;;;<<<SplitIds>>>;;;
{"gImGuiSplitIDs":{}}
+22
View File
@@ -0,0 +1,22 @@
;;; !!! This configuration is handled by HelloImGui and stores several Ini Files, separated by markers like this:
;;;<<<INI_NAME>>>;;;
;;;<<<ImGui_655921752_Default>>>;;;
[Window][Debug##Default]
Pos=60,60
Size=400,400
Collapsed=0
[Docking][Data]
;;;<<<Layout_655921752_Default>>>;;;
;;;<<<HelloImGui_Misc>>>;;;
[Layout]
Name=Default
[StatusBar]
Show=false
ShowFps=true
[Theme]
Name=DarculaDarker
;;;<<<SplitIds>>>;;;
{"gImGuiSplitIDs":{}}
+102 -73
View File
@@ -44,18 +44,18 @@ Collapsed=0
DockId=0x00000001,0
[Window][Message]
Pos=642,1879
Size=1002,242
Pos=661,1426
Size=716,455
Collapsed=0
[Window][Response]
Pos=1700,1898
Size=1111,224
Pos=2437,925
Size=1111,773
Collapsed=0
[Window][Tool Calls]
Pos=855,1482
Size=1014,655
Pos=520,1144
Size=663,232
Collapsed=0
DockId=0x00000006,0
@@ -74,8 +74,8 @@ Collapsed=0
DockId=0xAFC85805,2
[Window][Theme]
Pos=0,1212
Size=853,925
Pos=0,543
Size=387,737
Collapsed=0
DockId=0x00000002,2
@@ -85,14 +85,14 @@ Size=900,700
Collapsed=0
[Window][Diagnostics]
Pos=2641,34
Size=1199,2103
Pos=1649,24
Size=580,1284
Collapsed=0
DockId=0x00000010,2
[Window][Context Hub]
Pos=0,1212
Size=853,925
Pos=0,543
Size=387,737
Collapsed=0
DockId=0x00000002,1
@@ -103,26 +103,26 @@ Collapsed=0
DockId=0x0000000D,0
[Window][Discussion Hub]
Pos=1871,22
Size=949,2115
Pos=1169,26
Size=950,1254
Collapsed=0
DockId=0x00000013,0
[Window][Operations Hub]
Pos=855,22
Size=1014,2115
Pos=389,26
Size=778,1254
Collapsed=0
DockId=0x00000005,0
[Window][Files & Media]
Pos=0,1212
Size=853,925
Pos=0,543
Size=387,737
Collapsed=0
DockId=0x00000002,0
[Window][AI Settings]
Pos=0,22
Size=853,1188
Pos=0,26
Size=387,515
Collapsed=0
DockId=0x00000001,0
@@ -132,14 +132,14 @@ Size=416,325
Collapsed=0
[Window][MMA Dashboard]
Pos=2822,22
Size=1018,2115
Pos=2121,26
Size=653,1254
Collapsed=0
DockId=0x00000010,0
[Window][Log Management]
Pos=2822,22
Size=1018,2115
Pos=2121,26
Size=653,1254
Collapsed=0
DockId=0x00000010,1
@@ -152,25 +152,22 @@ Collapsed=0
Pos=2905,1238
Size=935,899
Collapsed=0
DockId=0x00000004,0
[Window][Tier 2: Tech Lead]
Pos=2905,1238
Size=935,899
Collapsed=0
DockId=0x00000004,0
[Window][Tier 4: QA]
Pos=2905,1238
Size=935,899
Collapsed=0
DockId=0x00000004,0
[Window][Tier 3: Workers]
Pos=2641,1719
Size=916,418
Pos=2822,1717
Size=1018,420
Collapsed=0
DockId=0x0000000C,0
DockId=0x00000011,0
[Window][Approve PowerShell Command]
Pos=649,435
@@ -178,7 +175,7 @@ Size=381,329
Collapsed=0
[Window][Last Script Output]
Pos=1005,343
Pos=2810,265
Size=800,562
Collapsed=0
@@ -288,8 +285,8 @@ Size=900,700
Collapsed=0
[Window][Text Viewer - Tool Call #1 Details]
Pos=2318,1220
Size=900,700
Pos=165,1081
Size=727,725
Collapsed=0
[Window][Text Viewer - Tool Call #10 Details]
@@ -333,10 +330,9 @@ Size=967,499
Collapsed=0
[Window][Usage Analytics]
Pos=2822,1716
Size=1018,421
Pos=1627,680
Size=480,343
Collapsed=0
DockId=0x0000000F,0
[Window][Tool Preset Manager]
Pos=1301,302
@@ -353,6 +349,41 @@ Pos=856,546
Size=1000,800
Collapsed=0
[Window][External Tools]
Pos=1968,516
Size=616,409
Collapsed=0
[Window][Text Viewer - Tool Call #2 Details]
Pos=60,60
Size=900,700
Collapsed=0
[Window][Text Viewer - Tool Call #3 Details]
Pos=60,60
Size=900,700
Collapsed=0
[Window][Text Viewer - Entry #4]
Pos=1127,922
Size=900,700
Collapsed=0
[Window][Text Viewer - Entry #10]
Pos=755,715
Size=1593,1240
Collapsed=0
[Window][Text Viewer - Entry #5]
Pos=60,60
Size=900,700
Collapsed=0
[Window][Shader Editor]
Pos=998,497
Size=493,369
Collapsed=0
[Table][0xFB6E3870,4]
RefScale=13
Column 0 Width=80
@@ -384,11 +415,11 @@ Column 3 Width=20
Column 4 Weight=1.0000
[Table][0x2A6000B6,4]
RefScale=14
Column 0 Width=42
Column 1 Width=61
RefScale=16
Column 0 Width=48
Column 1 Width=68
Column 2 Weight=1.0000
Column 3 Width=105
Column 3 Width=120
[Table][0x8BCC69C7,6]
RefScale=13
@@ -400,18 +431,18 @@ Column 4 Weight=1.0000
Column 5 Width=50
[Table][0x3751446B,4]
RefScale=14
Column 0 Width=42
Column 1 Width=63
RefScale=16
Column 0 Width=48
Column 1 Width=72
Column 2 Weight=1.0000
Column 3 Width=105
Column 3 Width=120
[Table][0x2C515046,4]
RefScale=14
Column 0 Width=42
RefScale=16
Column 0 Width=48
Column 1 Weight=1.0000
Column 2 Width=105
Column 3 Width=42
Column 2 Width=118
Column 3 Width=48
[Table][0xD99F45C5,4]
Column 0 Sort=0v
@@ -432,14 +463,14 @@ Column 1 Width=100
Column 2 Weight=1.0000
[Table][0xA02D8C87,3]
RefScale=24
Column 0 Width=270
Column 1 Width=180
RefScale=16
Column 0 Width=180
Column 1 Width=120
Column 2 Weight=1.0000
[Table][0xD0277E63,2]
RefScale=14
Column 0 Width=116
RefScale=16
Column 0 Width=132
Column 1 Weight=1.0000
[Table][0x3AAF84D5,2]
@@ -448,41 +479,39 @@ Column 0 Width=150
Column 1 Weight=1.0000
[Table][0x8D8494AB,2]
RefScale=14
Column 0 Width=116
RefScale=16
Column 0 Width=132
Column 1 Weight=1.0000
[Table][0x2C261E6E,2]
RefScale=14
Column 0 Width=87
RefScale=16
Column 0 Width=99
Column 1 Weight=1.0000
[Table][0x9CB1E6FD,2]
RefScale=14
Column 0 Width=164
RefScale=16
Column 0 Width=187
Column 1 Weight=1.0000
[Docking][Data]
DockNode ID=0x00000008 Pos=3125,170 Size=593,1157 Split=Y
DockNode ID=0x00000009 Parent=0x00000008 SizeRef=1029,147 Selected=0x0469CA7A
DockNode ID=0x0000000A Parent=0x00000008 SizeRef=1029,145 Selected=0xDF822E02
DockSpace ID=0xAFC85805 Window=0x079D3A04 Pos=0,22 Size=3840,2115 Split=X
DockNode ID=0x00000003 Parent=0xAFC85805 SizeRef=2820,1183 Split=X
DockSpace ID=0xAFC85805 Window=0x079D3A04 Pos=0,26 Size=2774,1254 Split=X
DockNode ID=0x00000003 Parent=0xAFC85805 SizeRef=1980,1183 Split=X
DockNode ID=0x0000000B Parent=0x00000003 SizeRef=404,1186 Split=X Selected=0xF4139CA2
DockNode ID=0x00000007 Parent=0x0000000B SizeRef=853,858 Split=Y Selected=0x8CA2375C
DockNode ID=0x00000001 Parent=0x00000007 SizeRef=824,1188 CentralNode=1 Selected=0x7BD57D6A
DockNode ID=0x00000002 Parent=0x00000007 SizeRef=824,925 Selected=0xF4139CA2
DockNode ID=0x0000000E Parent=0x0000000B SizeRef=1965,858 Split=X Selected=0x418C7449
DockNode ID=0x00000012 Parent=0x0000000E SizeRef=1014,402 Split=Y Selected=0x418C7449
DockNode ID=0x00000005 Parent=0x00000012 SizeRef=876,1455 Selected=0x418C7449
DockNode ID=0x00000006 Parent=0x00000012 SizeRef=876,654 Selected=0x1D56B311
DockNode ID=0x00000013 Parent=0x0000000E SizeRef=949,402 Selected=0x6F2B5B04
DockNode ID=0x00000007 Parent=0x0000000B SizeRef=680,858 Split=Y Selected=0x8CA2375C
DockNode ID=0x00000001 Parent=0x00000007 SizeRef=824,525 CentralNode=1 Selected=0x7BD57D6A
DockNode ID=0x00000002 Parent=0x00000007 SizeRef=824,737 Selected=0x8CA2375C
DockNode ID=0x0000000E Parent=0x0000000B SizeRef=1730,858 Split=X Selected=0x418C7449
DockNode ID=0x00000012 Parent=0x0000000E SizeRef=778,402 Split=Y Selected=0x418C7449
DockNode ID=0x00000005 Parent=0x00000012 SizeRef=876,1749 Selected=0x418C7449
DockNode ID=0x00000006 Parent=0x00000012 SizeRef=876,362 Selected=0x1D56B311
DockNode ID=0x00000013 Parent=0x0000000E SizeRef=950,402 Selected=0x6F2B5B04
DockNode ID=0x0000000D Parent=0x00000003 SizeRef=435,1186 Selected=0x363E93D6
DockNode ID=0x00000004 Parent=0xAFC85805 SizeRef=1018,1183 Split=Y Selected=0x3AEC3498
DockNode ID=0x00000004 Parent=0xAFC85805 SizeRef=653,1183 Split=Y Selected=0x3AEC3498
DockNode ID=0x00000010 Parent=0x00000004 SizeRef=1199,1689 Selected=0x2C0206CE
DockNode ID=0x00000011 Parent=0x00000004 SizeRef=1199,420 Split=X Selected=0xDEB547B6
DockNode ID=0x0000000C Parent=0x00000011 SizeRef=916,380 Selected=0x655BC6E9
DockNode ID=0x0000000F Parent=0x00000011 SizeRef=281,380 Selected=0xDEB547B6
DockNode ID=0x00000011 Parent=0x00000004 SizeRef=1199,420 Selected=0xDEB547B6
;;;<<<Layout_655921752_Default>>>;;;
;;;<<<HelloImGui_Misc>>>;;;
+634
View File
@@ -2462,3 +2462,637 @@ PROMPT:
role: tool
Here are the results: {"content": "done"}
------------------
--- MOCK INVOKED ---
ARGS: ['tests/mock_gemini_cli.py']
PROMPT:
PATH: Epic Initialization — please produce tracks
------------------
--- MOCK INVOKED ---
ARGS: ['tests/mock_gemini_cli.py']
PROMPT:
Please generate the implementation tickets for this track.
------------------
--- MOCK INVOKED ---
ARGS: ['tests/mock_gemini_cli.py']
PROMPT:
Please read test.txt
You are assigned to Ticket T1.
Task Description: do something
------------------
--- MOCK INVOKED ---
ARGS: ['tests/mock_gemini_cli.py']
PROMPT:
role: tool
Here are the results: {"content": "done"}
------------------
--- MOCK INVOKED ---
ARGS: ['C:\\projects\\manual_slop\\tests\\mock_gemini_cli.py', '-m', 'gemini-2.5-flash-lite', '--prompt', '', '--output-format', 'stream-json']
PROMPT:
You are a helpful coding assistant with access to a PowerShell tool (run_powershell) and MCP tools (file access: read_file, list_directory, search_files, get_file_summary, web access: web_search, fetch_url). When calling file/directory tools, always use the 'path' parameter for the target path. When asked to create or edit files, prefer targeted edits over full rewrites. Always explain what you are doing before invoking the tool.
When writing or rewriting large files (especially those containing quotes, backticks, or special characters), avoid python -c with inline strings. Instead: (1) write a .py helper script to disk using a PS here-string (@'...'@ for literal content), (2) run it with `python <script>`, (3) delete the helper. For small targeted edits, use PowerShell's (Get-Content) / .Replace() / Set-Content or Add-Content directly.
When making function calls using tools that accept array or object parameters ensure those are structured using JSON. For example:
When you need to verify a change, rely on the exit code and stdout/stderr from the tool — the user's context files are automatically refreshed after every tool call, so you do NOT need to re-read files that are already provided in the <context> block.
[USER SYSTEM PROMPT]
You are the Tier 1 Orchestrator (Product Manager) for the Manual Slop project.
Your role is high-level strategic planning, architecture enforcement, and cross-module delegation.
You operate strictly on metadata, summaries, and executive-level directives.
NEVER request or attempt to read raw implementation code unless specifically provided in a Macro-Diff.
Maintain a "Godot ECS Flat List format" (JSON array of objects) for structural outputs.
PATH: Epic Initialization (Project Planning)
GOAL: Break down a massive feature request into discrete Implementation Tracks.
CONSTRAINTS:
- IGNORE all source code, AST skeletons, and previous micro-task histories.
- FOCUS ONLY on the Repository Map and Project Meta-State.
OUTPUT REQUIREMENT:
Return a JSON array of 'Tracks'. Each track object must follow the Godot ECS Flat List format:
[
{
"id": "track_unique_id",
"type": "Track",
"module": "target_module_name",
"persona": "required_tech_lead_persona",
"severity": "Low|Medium|High",
"goal": "Descriptive goal",
"acceptance_criteria": ["criteria_1", "criteria_2"]
},
...
]
<context>
</context>
### USER REQUEST:
Add timestamps
### REPOSITORY MAP:
### TRACK HISTORY:
Track: api_hooks_verification_20260223
Status: new
Overview: This track focuses on integrating the existing, previously implemented API hooks (from track `test_hooks_20260223`) into the Conductor workflow. The primary goal is to automate the verification steps within the "Phase Completion Verification and Checkpointing Protocol", reducing the need for manual user intervention and enabling a more streamlined, automated development process.
---
Track: api_metrics_20260223
Status: new
Overview: This track aims to optimize token efficiency and transparency by reviewing and improving how vendor APIs (Gemini and Anthropic) handle conservative context pruning. The primary focus is on extracting, plotting, and exposing deep metrics to the GUI so developers can intuit how close they are to API limits (e.g., token caps, cache counts, history bleed).
---
Track: api_vendor_alignment_20260223
Status: new
Overview: This track involves a comprehensive audit of the "Manual Slop" codebase to ensure that the integration with Google Gemini (`google-genai`) and Anthropic Claude (`anthropic`) SDKs aligns perfectly with their latest official documentation and best practices. The goal is to identify discrepancies, performance bottlenecks, or deprecated patterns and implement the necessary fixes.
---
Track: architecture_boundary_hardening_20260302
Status: new
Overview: The `manual_slop` project sandbox provides AI meta-tooling (`mma_exec.py`, `tool_call.py`) to orchestrate its own development. When AI agents added advanced AST tools (like `set_file_slice`) to `mcp_client.py` for meta-tooling, they failed to fully integrate them into the application's GUI, config, or HITL (Human-In-The-Loop) safety models. Additionally, meta-tooling scripts are bleeding tokens and rely on non-portable hardcoded machine paths, while the internal application's state machine can deadlock.
---
Track: cache_analytics_20260306
Status: planned
Overview: Gemini cache hit/miss visualization, memory usage, TTL status display. Uses existing `ai_client.get_gemini_cache_stats()` which is implemented but has no GUI representation.
---
Track: codebase_migration_20260302
Status: new
Overview: This track focuses on restructuring the codebase to alleviate clutter by moving the main implementation files from the project root into a dedicated `src/` directory. Additionally, files that are completely unused by the current implementation will be automatically identified and removed. A new clean entry point (`sloppy.py`) will be created in the root directory.
---
Track: comprehensive_gui_ux_20260228
Status: completed
Overview: This track enhances the existing MMA orchestration GUI from its current functional-but-minimal state to a production-quality control surface. The existing implementation already has a working Track Browser, DAG tree visualizer, epic planning flow, approval dialogs, and token usage table. This track focuses on the **gaps**: dedicated tier stream panels, DAG editing, track-scoped discussions, conductor lifecycle GUI forms, cost tracking, and visual polish.
---
Track: conductor_workflow_improvements_20260302
Status: new
Overview: Recent Tier 2 track implementations have resulted in feature bleed, redundant code, unread state variables, and degradation of TDD discipline (e.g., zero-assertion tests).
This track updates the Conductor documentation (`workflow.md`) and the Gemini skills for Tiers 2 and 3 to hard-enforce TDD, prevent hallucinated "mock" implementations, and enforce strict codebase auditing before writing code.
---
Track: consolidate_cruft_and_log_taxonomy_20260228
Status: unknown
Overview: This track focuses on cleaning up the project root by consolidating temporary and test-related files into a dedicated directory and establishing a structured taxonomy for session logs. This will improve project organization and make manual file exploration easier before a dedicated GUI log viewer is implemented.
---
Track: context_management_20260223
Status: new
Overview: This track implements UI improvements and structural changes to Manual Slop to provide explicit visualization of context memory usage and token consumption, fulfilling the "Expert systems level utility" and "Full control" product goals.
---
Track: context_token_viz_20260301
Status: new
Overview: product.md lists "Context & Memory Management" as primary use case #2: "Better visualization and management of token usage and context memory, allowing developers to optimize prompt limits manually." The backend already computes everything needed via `ai_client.get_history_bleed_stats()` (ai_client.py:1657-1796, 140 lines). This track builds the UI to expose it.
---
Track: cost_token_analytics_20260306
Status: planned
Overview: # Implementation Plan: Cost & Token Analytics Panel (cost_token_analytics_20260306)
> **Reference:** [Spec](./spec.md) | [Architecture Guide](../../../docs/guide_architecture.md)
## Phase 1: Foundat...
---
Track: deepseek_support_20260225
Status: new
Overview: Implement a new AI provider module to support the DeepSeek API within the Manual Slop application. This integration will leverage a dedicated SDK to provide access to high-performance models (DeepSeek-V3 and DeepSeek-R1) with support for streaming, tool calling, and detailed reasoning traces.
---
Track: deep_ast_context_pruning_20260306
Status: planned
Overview: Use tree_sitter to parse target file AST and inject condensed skeletons into worker prompts. Currently workers receive full file context; this track reduces token burn by injecting only relevant function/method signatures.
---
Track: documentation_refresh_20260224
Status: new
Overview: This track implements a high-density, expert-level documentation suite for the Manual Slop project. The documentation style is strictly modeled after the **pedagogical and narrative standards** of `gencpp` and `VEFontCache-Odin`. It moves beyond simple "User Guides" to provide a **"USA Graphics Company"** architectural reference: high information density, tactical technical transparency, and a narrative intent that guides a developer from high-level philosophy to low-level implementation.
---
Track: enhanced_context_control_20260307
Status: planned
Overview: Give developers granular control over how files are included in the AI context and provide visibility into the active Gemini cache state. This involves moving away from a simple list of files to a structured format with per-file flags (`auto_aggregate`, `force_full`), revamping the UI to display this state, and updating the context builders and API clients to respect and expose these details.
---
Track: event_driven_metrics_20260223
Status: new
Overview: Refactor the API metrics update mechanism to be event-driven. Currently, the UI likely polls or recalculates metrics on every frame. This track will implement a signal/event system where `ai_client.py` broadcasts updates only when significant API activities (requests, responses, tool calls, or stream chunks) occur.
---
Track: feature_bleed_cleanup_20260302
Status: new
Overview: Multiple tracks added code to `gui_2.py` without removing the old versions, leaving
dead duplicate methods, conflicting menu bar designs, and redundant state initializations.
This track removes confirmed dead code, resolves the two-menubar conflict, and cleans
up the token budget layout regression — restoring a consistent, non-contradictory design state.
---
Track: gemini_cli_headless_20260224
Status: new
Overview: This track integrates the `gemini` CLI as a headless backend provider for Manual Slop. This allows users to leverage their Gemini subscription and the CLI's advanced features (e.g., specialized sub-agents like `codebase_investigator`, structured JSON streaming, and robust session management) directly within the Manual Slop GUI.
---
Track: gemini_cli_parity_20260225
Status: new
Overview: Achieve full functional and behavioral parity between the Gemini CLI integration (`gemini_cli_adapter.py`, `cli_tool_bridge.py`) and the direct Gemini API implementation (`ai_client.py`). This ensures that users leveraging the Gemini CLI as a headless backend provider experience the same level of capability, reliability, and observability as direct API users.
---
Track: gui2_feature_parity_20260223
Status: new
Overview: # Specification: GUIv2 Feature Parity
## 1. Overview
This track aims to bring `gui_2.py` (the `imgui-bundle` based UI) to feature parity with the existing `gui.py` (the `dearpygui` based UI). This i...
---
Track: gui2_parity_20260224
Status: new
Overview: The project is transitioning from `gui.py` (Dear PyGui-based) to `gui_2.py` (ImGui Bundle-based) to leverage advanced multi-viewport and docking features not natively supported by Dear PyGui. This track focuses on achieving full visual, functional, and performance parity between the two implementations, ultimately enabling the decommissioning of the original `gui.py`.
---
Track: gui_decoupling_controller_20260302
Status: new
Overview: `gui_2.py` currently operates as a Monolithic God Object (3,500+ lines). It violates the Data-Oriented Design heuristic by owning complex business logic, orchestrator hooks, and markdown file building. This track extracts the core state machine and lifecycle into a headless `app_controller.py`, turning the GUI into a pure immediate-mode view.
---
Track: gui_layout_refinement_20260223
Status: new
Overview: This track focuses on a holistic review and reorganization of the Manual Slop GUI. The goal is to ensure that AI tunings, diagnostic features, context management, and discussion history are logically placed to support an expert-level "Multi-Viewport" workflow. We will strengthen the "Arcade Aesthetics" and "Tactile Density" values while ensuring the layout remains intuitive for power users.
---
Track: gui_performance_20260223
Status: new
Overview: This track focuses on identifying and resolving severe frametime performance issues in the Manual Slop GUI. Current observations indicate massive frametime bloat even on idle startup, with performance significantly regressing (target 60 FPS / <16.6ms) since commit `8aa70e287fbf93e669276f9757965d5a56e89b10`.
---
Track: gui_performance_profiling_20260307
Status: unknown
Overview: Implement fine-grained performance profiling within the main ImGui rendering loop (`gui_2.py`) to ensure adherence to data-oriented and immediate mode heuristics. This track will provide visual diagnostics for high-overhead UI components, allowing developers to monitor and optimize render frame times.
---
Track: gui_sim_extension_20260224
Status: new
Overview: This track aims to expand the test simulation suite by introducing comprehensive, in-breadth tests that cover all facets of the GUI interaction. The original small test simulation will be preserved as a useful baseline. The new extended tests will be structured as multiple focused, modular scripts rather than a single long-running journey, ensuring maintainability and targeted coverage.
---
Track: history_segregation_20260224
Status: new
Overview: Currently, `manual_slop.toml` stores both project configuration and the entire discussion history. This leads to redundancy and potential context bloat if the AI agent reads the raw TOML file via its tools. This track will move the discussion history to a dedicated sibling TOML file (`history.toml`) and strictly blacklist it from the AI agent's file tools to ensure it only interacts with the curated context provided in the prompt.
---
Track: kill_abort_workers_20260306
Status: planned
Overview: Add ability to kill/abort a running Tier 3 worker mid-execution. Currently workers run to completion; add cancel button with forced termination option.
---
Track: live_gui_testing_20260223
Status: new
Overview: Update the testing suite to ensure all tests (especially GUI-related and integration tests) communicate with a live running instance of `gui.py` started with the `--enable-test-hooks` argument. This ensures that tests can verify the actual application state and metrics via the built-in API hooks.
---
Track: live_ux_test_20260223
Status: new
Overview: This track implements a robust, "human-like" interaction test suite for Manual Slop. The suite will simulate a real user's workflow—from project creation to complex AI discussions and history management—using the application's API hooks. It aims to verify the "Integrated Workspace" functionality, tool execution, and history persistence without requiring manual human input, while remaining slow enough for visual audit.
---
Track: logging_refactor_20260226
Status: new
Overview: Currently, `gui_2.py` and the test suites generate a large number of log files in a flat `logs/` directory. These logs accumulate quickly, especially during incremental development and testing. This track aims to organize logs into session-based sub-directories and implement a heuristic-based pruning system to keep the log directory clean while preserving valuable sessions.
---
Track: manual_block_control_20260306
Status: planned
Overview: Allow user to manually block or unblock tickets with custom reasons. Currently blocked tickets rely solely on dependency resolution; add manual override capability.
---
Track: manual_skeleton_injection_20260306
Status: planned
Overview: Add UI controls to manually inject file skeletons into discussions. Allow user to preview skeleton content before sending to AI, with option to toggle between skeleton and full file.
---
Track: manual_slop_headless_20260225
Status: new
Overview: Transform Manual Slop into a decoupled, container-friendly backend service. This track enables the core AI orchestration and tool execution logic to run without a GUI, exposing its capabilities via a secured REST API optimized for an Unraid Docker environment.
---
Track: minimax_provider_20260306
Status: unknown
Overview: Add MiniMax as a new AI provider to Manual Slop. MiniMax provides high-performance text generation models (M2.5, M2.1, M2) with massive context windows (200k+ tokens) and competitive pricing.
---
Track: mma_agent_focus_ux_20260302
Status: new
Overview: All MMA observability panels (comms history, tool calls, discussion) display
global/session-scoped data. When 4 tiers are running concurrently, their traffic
is indistinguishable. This track adds a `source_tier` field to every comms and
tool log entry at the point of emission, then adds a "Focus Agent" selector that
filters the Operations Hub panels to show only one tier's traffic at a time.
**Depends on:** `feature_bleed_cleanup_20260302` (Phase 1 removes the dead comms
panel duplicate; this track extends the live panel at gui_2.py:~3400).
---
Track: MMA Core Engine Implementation
Status: planning
Overview: # Specification: MMA Core Engine Implementation
## 1. Overview
This track consolidates the implementation of the 4-Tier Hierarchical Multi-Model Architecture into the `manual_slop` codebase. The arch...
---
Track: MMA Dashboard Visualization Overhaul
Status: planned
Overview: Make the invisible backend operations visible and interactive. The current GUI is too barebones to effectively manage a multi-agent system. This track overhauls the MMA Dashboard to provide real-time insights into tracks, task dependencies, and agent streams.
---
Track: MMA Data Architecture & DAG Engine
Status: planned
Overview: Restructure how `manual_slop` stores and executes work. The current implementation relies on global state and linear execution, which does not support the complexity of multi-agent, task-based workflows. This track establishes a robust, data-oriented foundation using track-scoped state and a native Python Directed Acyclic Graph (DAG) engine.
---
Track: mma_formalization_20260225
Status: new
Overview: This track aims to formalize and automate the 4-Tier Hierarchical Multi-Model Architecture (MMA) within the Conductor framework. It introduces specialized skills for each tier and a new specialized CLI tool (`mma-exec`) to handle role-specific context gathering and "Context Amnesia" protocols.
---
Track: mma_implementation_20260224
Status: new
Overview: # Specification: 4-Tier Architecture Implementation & Conductor Self-Improvement
## 1. Overview
This track encompasses two major phases. Phase 1 focuses on designing a comprehensive, step-by-step imp...
---
Track: mma_multiworker_viz_20260306
Status: planned
Overview: Split-view GUI for parallel worker streams per tier. Visualize multiple concurrent workers with individual status, output tabs, and resource usage. Enable kill/restart per worker.
---
Track: MMA Orchestrator Integration
Status: in-progress
Overview: Implement the full hierarchical orchestration loop, connecting Tier 1 (PM) strategic planning with Tier 2 (Tech Lead) tactical ticket generation. This track will enable the GUI to autonomously break down high-level user 'Epics' into actionable tracks and tickets, and manage their execution through the multi-agent system.
---
Track: mma_pipeline_fix_20260301
Status: new
Overview: The MMA pipeline has a verified code path from `run_worker_lifecycle` → `_queue_put("response", ...)` → `_process_event_queue` → `_pending_gui_tasks("handle_ai_response")` → `mma_streams[stream_id] = text`. However, the robust_live_simulation track's session compression (2026-02-28) documented that Tier 3 worker output never appears in `mma_streams` during actual GUI operation. The simulation only ever sees `'Tier 1'` in `mma_streams` keys.
This track diagnoses and fixes the pipeline break, then verifies end-to-end that worker output flows from `ai_client.send()` through to the GUI's `mma_streams` dict.
---
Track: mma_utilization_refinement_20260226
Status: new
Overview: Refine the Multi-Model Architecture (MMA) implementation within the Conductor framework to ensure clear role segregation, proper tool permissions, and improved observability for sub-agents.
---
Track: mma_verification_20260225
Status: new
Overview: This track aims to review and verify the implementation of the 4-Tier Hierarchical Multi-Model Architecture (MMA) within the Conductor framework. It will confirm that Conductor operates as a Tier 2 Tech Lead/Orchestrator and can successfully delegate tasks to Tier 3 (Workers) and Tier 4 (QA/Utility) sub-agents. A key part of this track is investigating whether this hierarchy should be enforced via a single centralized skill or through separate role-based sub-agent definitions.
---
Track: mma_verification_mock
Status: new
Overview: This is a mock track designed to verify the full Tier 2 -> Tier 3 -> Tier 4 delegation flow within the Conductor framework.
---
Track: native_orchestrator_20260306
Status: planned
Overview: Absorb `mma_exec.py` functionality into core application. Manual Slop natively reads/writes plan.md, manages metadata.json, and orchestrates MMA tiers in pure Python without external CLI subprocess calls.
---
Track: nerv_ui_theme_20260309
Status: unknown
Overview: This track aims to implement a new "NERV" visual theme for the manual_slop application, inspired by the aesthetic of technical/military consoles (e.g., Evangelion's NERV UI). The theme will be added as a selectable option within the application, allowing users to switch between the existing theme and the new NERV style without altering the core user experience or layout.
---
Track: on_demand_def_lookup_20260306
Status: planned
Overview: Add ability for agent to request specific class/function definitions during discussion. Parse @symbol syntax to trigger lookup and display inline in the discussion.
---
Track: OpenCode Configuration Overhaul
Status: completed
Overview: Fix critical gaps in OpenCode agent configuration that cause MMA workflow failures. Remove step limits that prematurely terminate complex tracks, disable automatic context compaction that loses critical session state, raise temperature for better problem-solving, and expand thin command wrappers into full protocol documentation.
---
Track: per_ticket_model_20260306
Status: planned
Overview: Allow user to manually select which model to use for a specific ticket, overriding the default tier model. Useful for forcing smarter model on hard tickets.
---
Track: pipeline_pause_resume_20260306
Status: planned
Overview: Add global pause/resume for entire DAG execution pipeline. Allow user to freeze all worker activity and resume later without losing state.
---
Track: python_style_refactor_20260227
Status: unknown
Overview: # Specification: AI-Optimized Python Style Refactor
## 1. Overview
Refactor the Python codebase to a "Single-Space, Ultra-Compact" style specifically designed to minimize token consumption for AI age...
---
Track: Robust Live Simulation Verification
Status: planned
Overview: Establish a robust, visual simulation framework to prevent regressions in the complex GUI and asynchronous orchestration layers. This track replaces manual human verification with an automated script that clicks through the GUI and verifies the rendered state.
---
Track: session_insights_20260306
Status: planned
Overview: Token usage over time, cost projections, session summary with efficiency scores. Visualize session_logger data.
---
Track: simulation_hardening_20260301
Status: new
Overview: The `robust_live_simulation_verification` track is marked complete but its session compression documents three unresolved issues: (1) brittle mock that triggers the wrong approval popup, (2) popup state desynchronization after "Accept" clicks, (3) Tier 3 output never appearing in `mma_streams` (fixed by `mma_pipeline_fix` track). This track stabilizes the simulation framework so it reliably passes end-to-end.
---
Track: strict_execution_queue_completed_20260306
Status: completed
Overview: No overview available.
---
Track: strict_static_analysis_and_typing_20260302
Status: new
Overview: The codebase currently suffers from massive type-safety debt (512+ `mypy` errors across 64 files) and lingering `ruff` violations. This track will harden the foundation by resolving all violations, enforcing strict typing (especially in `gui_2.py` and `api_hook_client.py`), and integrating pre-commit checks. This is a prerequisite for safe AI-driven refactoring.
---
Track: tech_debt_and_test_cleanup_20260302
Status: new
Overview: Due to rapid iterative development and feature bleed across multiple Tier 2-led tracks, significant tech debt has accumulated in both the testing suite and `gui_2.py`.
This track will clean up test fixtures, enforce test assertion integrity, and remove dead codebase remnants.
---
Track: test_architecture_integrity_audit_20260304
Status: unknown
Overview: Comprehensive audit of testing infrastructure and simulation framework to identify false positive risks, coverage gaps, and simulation fidelity issues. This analysis was triggered by a request to review how tests and simulations are setup, whether tests can report passing grades when they fail, and if simulations are rigorous enough or are just rough emulators.
---
Track: test_curation_20260225
Status: new
Overview: The current test suite for **Manual Slop** and the **Conductor** framework has grown incrementally and lacks a formal organization. This track aims to curate, categorize, and organize existing tests, specifically blacklisting Conductor-specific (MMA) tests from manual_slop's test runs. We will use a central manifest for test management and perform an exhaustive review of all tests to eliminate redundancy.
---
Track: test_hooks_20260223
Status: new
Overview: This track introduces a comprehensive suite of API hooks designed specifically for the Gemini CLI and the Conductor framework. These hooks will allow automated agents to manipulate and test the internal state of the application without requiring manual GUI interaction, enabling automated test-driven development and track progression validation.
---
Track: Test Integrity Audit & Intent Documentation
Status: in_progress
Overview: Audit and fix tests that have been "simplified" or "dumbed down" by AI agents, restoring their original verification intent through explicit documentation comments. This track addresses the growing problem of AI agents "completing" tasks by weakening test assertions rather than implementing proper functionality.
---
Track: test_regression_verification_20260307
Status: unknown
Overview: Verify that all existing tests pass with 0 regressions after recent track implementations (Kill/Abort, Block/Unblock, Pause/Resume, Per-Ticket Model Override).
---
Track: test_stabilization_20260302
Status: new
Overview: The goal of this track is to stabilize and unify the project's test suite. This involves resolving pervasive `asyncio` lifecycle errors, consolidating redundant testing paradigms (specifically manual GUI subprocesses), ensuring artifact isolation in `./tests/artifacts/`, implementing functional assertions for currently mocked-out tests, and updating documentation to reflect the finalized verification framework.
---
Track: ticket_queue_mgmt_20260306
Status: planned
Overview: Allow user to manually reorder, prioritize, or requeue tickets in the DAG. Add drag-drop reordering, priority tags, and bulk selection for execute/skip/block operations.
---
Track: tier4_auto_patching_20260306
Status: planned
Overview: Elevate Tier 4 from log summarizer to auto-patcher. When verification tests fail, Tier 4 generates a unified diff patch. GUI displays side-by-side diff; user clicks Apply Patch to resume pipeline.
---
Track: Tiered Context Scoping & HITL Approval
Status: planned
Overview: Provide the user with absolute visual control over what the AI sees at every level of the hierarchy. Currently, the system builds a single massive context blob. This track introduces context subsetting based on the target tier and implements a Human-in-the-Loop (HITL) approval gate before any Tier 3/4 worker is spawned.
---
Track: tool_usage_analytics_20260306
Status: planned
Overview: Analytics panel showing most-used tools, average execution time, and failure rates. Uses existing tool execution data from ai_client.
---
Track: track_progress_viz_20260306
Status: planned
Overview: Progress bars and percentage completion for active tracks and tickets. Better visualization of DAG execution state.
---
Track: true_parallel_worker_execution_20260306
Status: planned
Overview: Add worker pool management and configurable concurrency limits to the DAG engine. Currently workers execute in parallel per tick but with no limits or tracking; this track adds max_workers configuration, worker tracking, and proper pool management.
---
Track: ui_performance_20260223
Status: new
Overview: This track aims to resolve subpar UI performance (currently perceived below 60 FPS) by implementing a robust performance monitoring system. This system will collect high-resolution telemetry (Frame Time, Input Lag, Thread Usage) and expose it to both the user (via a Diagnostics Panel) and the AI (via API hooks). This ensures that performance degradation is caught early during development and testing.
---
Track: visual_dag_ticket_editing_20260306
Status: planned
Overview: Replace linear ticket list with interactive node graph using ImGui Bundle node editor. Users can visually drag dependency lines, split nodes, or delete tasks before execution.
---
Track: agent_personas_20260309
Status: new
Overview: Transition the application from fragmented prompt and model settings to a **Unified Persona** model. A Persona consolidates Provider, Model (or a preferred set of models), Parameters (Temp, Top-P, etc.), Prompts (Global, Project, and MMA-specific components), and links to Tool Presets into a single, versionable entity.
---
Track: beads_mode_20260309
Status: new
Overview: Introduce "Beads Mode" as a first-class, project-specific alternative to the current markdown-based implementation tracking (Native Mode). By integrating with [Beads](https://github.com/steveyegge/beads), Manual Slop will gain a distributed, git-backed graph issue tracker that allows Implementation Tracks and Tickets to be versioned alongside the codebase using Dolt.
---
Track: caching_optimization_20260308
Status: new
Overview: This track aims to verify and optimize the caching strategies across all supported AI providers (Gemini, Anthropic, DeepSeek, MiniMax, and OpenAI). The goal is to minimize token consumption and latency by ensuring that static and recurring context (system prompts, tool definitions, project documents, and conversation history) are effectively cached using each provider's specific mechanisms.
---
Track: codebase_audit_20260308
Status: new
Overview: The objective of this track is to audit the `./src` and `./simulation` directories to improve human readability and maintainability. The codebase has matured, and it is necessary to identify and address redundant code paths and state tracking, add missing docstrings to critical paths, and organize declarations/definitions within files.
---
Track: conductor_path_configurable_20260306
Status: unknown
Overview: Eliminate all hardcoded paths in the application. Make directory paths configurable via `config.toml` or environment variables, allowing the running app to use different directories from development setup. This is **Phase 0 - Critical Infrastructure** that must be completed before other Phase 3 tracks.
---
Track: csharp_language_support_tools_20260310
Status: new
Overview: Expand the Conductor's AI context-gathering and surgical editing capabilities by introducing full Tree-Sitter parsing support for C#. This brings C# to feature-parity with existing Python MCP tools, enabling deep AST-driven structural mapping, documentation extraction, and precise code modification, specifically targeting Unreal Engine build scripts, and Unity/Godot scripting.
---
Track: custom_shaders_20260309
Status: new
Overview: Implement proper custom shader support for post-process rendering and backgrounds within the Manual Slop GUI (using Dear PyGui/imgui-bundle). Additionally, investigate and implement a method to overload or replace the default OS window frame to ensure it matches the application's theme.
---
Track: discussion_takes_branching_20260311
Status: new
Overview: # Specification: Discussion Takes & Timeline Branching
## 1. Overview
This track introduces non-linear discussion timelines, allowing users to create multiple "takes" (branches) from a shared point i...
---
Track: external_editor_integration_20260308
Status: new
Overview: This feature adds the ability to open files modified by AI agents in external text editors (such as VSCode or 10xNotepad) directly from the tool approval popup. This allows users to leverage their preferred editor's native diffing and editing capabilities before confirming an agent's changes.
---
Track: external_mcp_support_20260308
Status: new
Overview: This feature adds support for integrating external Model Context Protocol (MCP) servers into Manual Slop. This allows agents to utilize tools from a wide ecosystem of MCP servers (like those for databases, APIs, or specialized utilities) alongside the application's native tools.
---
Track: gdscript_godot_script_language_support_tools_20260310
Status: new
Overview: Expand the Conductor's AI context-gathering and surgical editing capabilities by introducing full Tree-Sitter parsing support for GDScript (Godot's native scripting language). This will bring GDScript to feature-parity with the existing Python MCP tools, enabling deep AST-driven structural mapping, documentation extraction, and precise code modification.
---
Track: Bootstrap gencpp Python Bindings Project
Status: pending
Overview: Create a new standalone Python project to build CFFI bindings for gencpp (C/C++ staged metaprogramming library). This will eventually provide richer C++ AST understanding than tree-sitter (full type information, operators, specifiers) but is a longer-term effort. This track bootstraps the project structure and initial bindings.
---
Track: GUI Path Configuration in Context Hub
Status: pending
Overview: Add path configuration UI to the Context Hub in the GUI. Allow users to view and edit configurable paths (conductor, logs, scripts) directly from the application without manually editing config.toml or environment variables.
---
Track: hook_api_expansion_20260308
Status: new
Overview: This track aims to transform the Manual Slop Hook API into a comprehensive control plane for headless use. It focuses on exposing all relevant internal states (worker traces, AST metadata, financial metrics, concurrency telemetry) and providing granular control over the application's lifecycle, MMA pipeline, and context management. Additionally, it introduces a WebSocket-based streaming interface for real-time event delivery.
---
Track: log_session_overhaul_20260308
Status: new
Overview: This track focuses on centralizing log management, improving the reliability and scope of session restoration, and optimizing log storage by offloading large data blobs (scripts and tool outputs) to external files. It also aims to "clean" the discussion history by moving transient system warnings to a dedicated diagnostic log.
---
Track: manual_ux_validation_20260302
Status: new
Overview: This track is an unusual, highly interactive human-in-the-loop review session. The user will act as the primary QA and Designer, manually using the GUI and observing it during slow-interval simulation runs. The goal is to aggressively iterate on the "feel" of the application: analyzing blinking animations, structural decisions (Tabs vs. Panels vs. Collapsing Headers), knob/control placements, and the efficacy of popups (including adding auto-close timers).
---
Track: markdown_highlighting_20260308
Status: new
Overview: This track introduces rich text rendering to the Manual Slop GUI by adding support for GitHub-Flavored Markdown (GFM) in message and response views. It also adds syntax highlighting for code blocks and text content when the language context can be cheaply resolved (e.g., via known metadata or file extensions).
---
Track: openai_integration_20260308
Status: new
Overview: This track introduces support for OpenAI as a first-class model provider. It involves implementing a dedicated client in `src/ai_client.py`, updating configuration models, enhancing the GUI for provider selection, and integrating OpenAI into the tiered MMA architecture.
---
Track: presets_ai_settings_ux_20260311
Status: new
Overview: # Specification: UI/UX Improvements - Presets and AI Settings
## 1. Overview
This track aims to improve the usability and visual layout of the Preset windows (Personas, Prompts, Tools) and the AI Set...
---
Track: Project-Specific Conductor Directory
Status: pending
Overview: Make the conductor directory per-project instead of global. Each project TOML can specify its own `conductor_dir` path, allowing separate track/state management per project. This enables using Manual Slop with multiple independent projects without track/ticket cross-pollution.
---
Track: rag_support_20260308
Status: new
Overview: This track introduces Retrieval-Augmented Generation (RAG) capabilities to Manual Slop. It allows agents to search and retrieve relevant information from large local codebases, project documentation, or external knowledge bases, overcoming context window limitations and reducing hallucination.
---
Track: saved_presets_20260308
Status: new
Overview: This feature introduces the ability to save, manage, and switch between system prompt presets for both global (application-wide) and project-specific contexts. Presets will include not only the system prompt text but also model-specific parameters like temperature and top_p, effectively allowing for "AI Profiles."
---
Track: saved_tool_presets_20260308
Status: new
Overview: This feature adds the ability to create, save, and manage "Tool Presets" for agent roles. These presets define which tools are available to an agent and their respective "auto" vs "ask" approval levels. Tools will be organized into dynamic, TOML-defined categories (e.g., Python, General) and integrated into the global and project-specific AI settings.
---
Track: selectable_ui_text_20260308
Status: new
Overview: This track aims to address UI inconveniences by making critical text across the GUI selectable and copyable. This includes discussion history, communication logs, tool outputs, and key metrics. The goal is to provide a standard "Copy to Clipboard" capability via OS-native selection and shortcuts (Ctrl+C).
---
Track: session_context_snapshots_20260311
Status: new
Overview: # Specification: Session Context Snapshots & Visibility
## 1. Overview
This track focuses on transitioning from global context management to explicit session-scoped context. It introduces transparent...
---
Track: test_coverage_expansion_20260309
Status: new
Overview: Add more unit, simulation, and integration tests to increase coverage and stress test the application. The primary focus will be on critical and complex paths rather than aggressive total coverage percentage.
---
Track: test_harness_hardening_20260310
Status: new
Overview: This track focuses on stabilizing the local development and testing environment by hardening the Hook API and its associated `live_gui` test harness. The goal is to eliminate port conflicts, ensure graceful teardowns, and standardize state serialization, laying the groundwork for a future WebSockets implementation.
---
Track: tool_bias_tuning_20260308
Status: new
Overview: This track introduces a mechanism to influence AI agent tool selection by implementing a weighting and scoring system at the orchestration layer. Since model APIs do not natively support tool priority, this feature uses semantic nudging (tags in tool descriptions) and explicit system instructions to "bias" the agent toward preferred tools and parameters.
---
Track: tree_sitter_lua_mcp_tools_20260310
Status: new
Overview: Expand the Conductor's AI context-gathering and surgical editing capabilities by introducing full Tree-Sitter parsing support for the Lua programming language. This will bring Lua to feature-parity with the existing Python MCP tools, enabling deep AST-driven structural mapping, documentation extraction, and precise code modification.
---
Track: Tree-Sitter C/C++ MCP Tools
Status: pending
Overview: Add tree-sitter-based C and C++ parsing support to the MCP client, providing skeleton and outline tools for C/C++ codebases. Tools will be prefixed `ts_c_` and `ts_cpp_` to distinguish from existing Python tools and leave namespace open for future gencpp integration.
---
Track: ui_theme_overhaul_20260308
Status: new
Overview: This track aims to modernize the application's appearance by implementing a professional, high-fidelity UI theme using `imgui-bundle`'s native styling and theming capabilities. It focuses on improving typography, visual shapes, and introducing advanced features like custom shaders, multi-viewport support, and user-managed layout presets.
---
Track: undo_redo_history_20260311
Status: new
Overview: # Specification: Undo/Redo History Support
## 1. Overview
This track implements a robust, non-provider based Undo/Redo system within the Manual Slop GUI. It allows users to revert and redo common UI ...
---
Track: ux_sim_test_20260308
Status: unknown
Overview: No overview available.
---
Track: ux_sim_test_20260310
Status: unknown
Overview: No overview available.
---
Track: workspace_profiles_20260310
Status: new
Overview: Expand the existing GUI window management to support named "Workspace Profiles." This will allow users to save, manage, and instantly switch between complex multi-window, multi-viewport docking arrangements.
---
Track: zhipu_integration_20260308
Status: new
Overview: This track introduces support for Zhipu AI (z.ai) as a first-class model provider. It involves implementing a dedicated client in `src/ai_client.py` for the GLM series of models, updating configuration models, enhancing the GUI for provider selection, and integrating the provider into the tiered MMA architecture.
---
Please generate the implementation tracks for this request.
------------------
--- MOCK INVOKED ---
ARGS: ['tests/mock_gemini_cli.py']
PROMPT:
PATH: Epic Initialization — please produce tracks
------------------
--- MOCK INVOKED ---
ARGS: ['tests/mock_gemini_cli.py']
PROMPT:
Please generate the implementation tickets for this track.
------------------
--- MOCK INVOKED ---
ARGS: ['tests/mock_gemini_cli.py']
PROMPT:
Please read test.txt
You are assigned to Ticket T1.
Task Description: do something
------------------
--- MOCK INVOKED ---
ARGS: ['tests/mock_gemini_cli.py']
PROMPT:
role: tool
Here are the results: {"content": "done"}
------------------
--- MOCK INVOKED ---
ARGS: ['tests/mock_gemini_cli.py']
PROMPT:
PATH: Epic Initialization — please produce tracks
------------------
--- MOCK INVOKED ---
ARGS: ['tests/mock_gemini_cli.py']
PROMPT:
Please generate the implementation tickets for this track.
------------------
--- MOCK INVOKED ---
ARGS: ['tests/mock_gemini_cli.py']
PROMPT:
Please read test.txt
You are assigned to Ticket T1.
Task Description: do something
------------------
--- MOCK INVOKED ---
ARGS: ['tests/mock_gemini_cli.py']
PROMPT:
role: tool
Here are the results: {"content": "done"}
------------------
--- MOCK INVOKED ---
ARGS: ['tests/mock_gemini_cli.py']
PROMPT:
PATH: Epic Initialization — please produce tracks
------------------
--- MOCK INVOKED ---
ARGS: ['tests/mock_gemini_cli.py']
PROMPT:
Please generate the implementation tickets for this track.
------------------
--- MOCK INVOKED ---
ARGS: ['tests/mock_gemini_cli.py']
PROMPT:
Please read test.txt
You are assigned to Ticket T1.
Task Description: do something
------------------
--- MOCK INVOKED ---
ARGS: ['tests/mock_gemini_cli.py']
PROMPT:
role: tool
Here are the results: {"content": "done"}
------------------
+1 -1
View File
@@ -9,5 +9,5 @@ active = "main"
[discussions.main]
git_commit = ""
last_updated = "2026-03-12T18:41:55"
last_updated = "2026-03-12T20:34:43"
history = []
+1
View File
@@ -17,6 +17,7 @@ dependencies = [
"tree-sitter-python>=0.25.0",
"mcp>=1.0.0",
"pytest-timeout>=2.4.0",
"pyopengl>=3.1.10",
]
[dependency-groups]
+12
View File
@@ -0,0 +1,12 @@
from imgui_bundle import hello_imgui, imgui
def on_gui():
imgui.text("Hello world")
params = hello_imgui.RunnerParams()
params.app_window_params.borderless = True
params.app_window_params.borderless_movable = True
params.app_window_params.borderless_resizable = True
params.app_window_params.borderless_closable = True
hello_imgui.run(params)
+112 -2
View File
@@ -286,7 +286,9 @@ class AppController:
self._gemini_cache_text: str = ""
self._last_stable_md: str = ''
self._token_stats: Dict[str, Any] = {}
self._token_stats_dirty: bool = False
self._comms_log_dirty: bool = True
self._tool_log_dirty: bool = True
self._token_stats_dirty: bool = True
self.ui_disc_truncate_pairs: int = 2
self.ui_auto_scroll_comms: bool = True
self.ui_auto_scroll_tool_calls: bool = True
@@ -294,10 +296,14 @@ class AppController:
self._track_discussion_active: bool = False
self._tier_stream_last_len: Dict[str, int] = {}
self.is_viewing_prior_session: bool = False
self._current_session_usage = None
self._current_mma_tier_usage = None
self.prior_session_entries: List[Dict[str, Any]] = []
self.prior_tool_calls: List[Dict[str, Any]] = []
self.prior_disc_entries: List[Dict[str, Any]] = []
self.prior_mma_dashboard_state: Dict[str, Any] = {}
self.prior_mma_dashboard_state = {}
self._current_token_history = None
self._current_session_start_time = None
self.test_hooks_enabled: bool = ("--enable-test-hooks" in sys.argv) or (os.environ.get("SLOP_TEST_HOOKS") == "1")
self.ui_manual_approve: bool = False
# Injection state
@@ -531,6 +537,11 @@ class AppController:
"payload": status
})
def _trigger_gui_refresh(self):
with self._pending_gui_tasks_lock:
self._pending_gui_tasks.append({'action': 'set_comms_dirty'})
self._pending_gui_tasks.append({'action': 'set_tool_log_dirty'})
def _process_pending_gui_tasks(self) -> None:
# Periodic telemetry broadcast
now = time.time()
@@ -557,6 +568,10 @@ class AppController:
# ...
if action == "refresh_api_metrics":
self._refresh_api_metrics(task.get("payload", {}), md_content=self.last_md or None)
elif action == 'set_comms_dirty':
self._comms_log_dirty = True
elif action == 'set_tool_log_dirty':
self._tool_log_dirty = True
elif action == "set_ai_status":
self.ai_status = task.get("payload", "")
sys.stderr.write(f"[DEBUG] Updated ai_status via task to: {self.ai_status}\n")
@@ -851,6 +866,7 @@ class AppController:
self.ui_separate_tier2 = False
self.ui_separate_tier3 = False
self.ui_separate_tier4 = False
self.ui_separate_external_tools = False
self.config = models.load_config()
path_info = paths.get_full_path_info()
self.ui_logs_dir = str(path_info['logs_dir']['path'])
@@ -985,6 +1001,12 @@ class AppController:
if not path:
return
if not self.is_viewing_prior_session:
self._current_session_usage = copy.deepcopy(self.session_usage)
self._current_mma_tier_usage = copy.deepcopy(self.mma_tier_usage)
self._current_token_history = copy.deepcopy(self._token_history)
self._current_session_start_time = self._session_start_time
log_path = Path(path)
if log_path.is_dir():
log_file = log_path / "comms.log"
@@ -1019,6 +1041,15 @@ class AppController:
entries = []
disc_entries = []
paired_tools = {}
final_tool_calls = []
new_token_history = []
new_usage = {'input_tokens': 0, 'output_tokens': 0, 'cache_read_input_tokens': 0, 'cache_creation_input_tokens': 0, 'total_tokens': 0, 'last_latency': 0.0, 'percentage': 0.0}
new_mma_usage = copy.deepcopy(self.mma_tier_usage)
for t in new_mma_usage:
new_mma_usage[t]['input'] = 0
new_mma_usage[t]['output'] = 0
try:
with open(log_file, "r", encoding="utf-8") as f:
for line in f:
@@ -1030,6 +1061,47 @@ class AppController:
kind = entry.get("kind", entry.get("type", ""))
payload = entry.get("payload", {})
ts = entry.get("ts", "")
if kind == 'tool_call':
tid = payload.get('id') or payload.get('call_id')
script = payload.get('script') or json.dumps(payload.get('args', {}), indent=1)
script = _resolve_log_ref(script, session_dir)
entry_obj = {
'source_tier': entry.get('source_tier', 'main'),
'script': script,
'result': '', # Waiting for result
'ts': ts
}
if tid:
paired_tools[tid] = entry_obj
final_tool_calls.append(entry_obj)
elif kind == 'tool_result':
tid = payload.get('id') or payload.get('call_id')
output = payload.get('output', payload.get('content', ''))
output = _resolve_log_ref(output, session_dir)
if tid and tid in paired_tools:
paired_tools[tid]['result'] = output
else:
# Fallback: if no ID, try matching last entry in final_tool_calls that has no result
for old_call in reversed(final_tool_calls):
if not old_call['result']:
old_call['result'] = output
break
if kind == 'response' and 'usage' in payload:
u = payload['usage']
for k in ['input_tokens', 'output_tokens', 'cache_read_input_tokens', 'cache_creation_input_tokens', 'total_tokens']:
if k in new_usage: new_usage[k] += u.get(k, 0) or 0
tier = entry.get('source_tier', 'main')
if tier in new_mma_usage:
new_mma_usage[tier]['input'] += u.get('input_tokens', 0) or 0
new_mma_usage[tier]['output'] += u.get('output_tokens', 0) or 0
new_token_history.append({
'time': ts,
'input': u.get('input_tokens', 0) or 0,
'output': u.get('output_tokens', 0) or 0,
'model': entry.get('model', 'unknown')
})
if kind == "history_add":
content = payload.get("content", payload.get("text", payload.get("message", "")))
@@ -1087,11 +1159,47 @@ class AppController:
self._set_status(f"log load error: {e}")
return
self.session_usage = new_usage
self.mma_tier_usage = new_mma_usage
self._token_history = new_token_history
if new_token_history:
try:
import datetime
first_ts = new_token_history[0]['time']
dt = datetime.datetime.strptime(first_ts, '%Y-%m-%dT%H:%M:%S')
self._session_start_time = dt.timestamp()
except:
self._session_start_time = time.time()
self.prior_session_entries = entries
self.prior_disc_entries = disc_entries
self.prior_tool_calls = final_tool_calls
self.is_viewing_prior_session = True
self._trigger_gui_refresh()
self._set_status(f"viewing prior session: {session_dir.name} ({len(entries)} entries)")
def cb_exit_prior_session(self):
self.is_viewing_prior_session = False
if self._current_session_usage:
self.session_usage = self._current_session_usage
self._current_session_usage = None
if self._current_mma_tier_usage:
self.mma_tier_usage = self._current_mma_tier_usage
self._current_mma_tier_usage = None
if self._current_token_history is not None:
self._token_history = self._current_token_history
self._current_token_history = None
if self._current_session_start_time is not None:
self._session_start_time = self._current_session_start_time
self._current_session_start_time = None
self.prior_session_entries.clear()
self.prior_disc_entries.clear()
self.prior_tool_calls.clear()
self._trigger_gui_refresh()
self._set_status('idle')
def cb_prune_logs(self) -> None:
"""Manually triggers the log pruning process with aggressive thresholds."""
self._set_status("Manual prune started (Age > 0d, Size < 100KB)...")
@@ -1292,6 +1400,7 @@ class AppController:
def _handle_request_event(self, event: events.UserRequestEvent) -> None:
"""Processes a UserRequestEvent by calling the AI client."""
self._set_status('sending...')
ai_client.set_current_tier(None) # Ensure main discussion is untagged
# Clear response area for new turn
self.ai_response = ""
@@ -2346,6 +2455,7 @@ class AppController:
"separate_message_panel": getattr(self, "ui_separate_message_panel", False),
"separate_response_panel": getattr(self, "ui_separate_response_panel", False),
"separate_tool_calls_panel": getattr(self, "ui_separate_tool_calls_panel", False),
"separate_external_tools": getattr(self, "ui_separate_external_tools", False),
"separate_task_dag": self.ui_separate_task_dag,
"separate_usage_analytics": self.ui_separate_usage_analytics,
"separate_tier1": self.ui_separate_tier1,
+1 -1
View File
@@ -12,7 +12,7 @@ class BackgroundShader:
self.ctx: Optional[nvg.Context] = None
def render(self, width: float, height: float):
if not self.enabled:
if not self.enabled or width <= 0 or height <= 0:
return
# In imgui-bundle, hello_imgui handles the background.
+198 -28
View File
@@ -29,9 +29,17 @@ from src import mcp_client
from src import markdown_helper
from src import bg_shader
import re
import subprocess
if sys.platform == "win32":
import win32gui
import win32con
else:
win32gui = None
win32con = None
from pydantic import BaseModel
from imgui_bundle import imgui, hello_imgui, immapp, imgui_node_editor as ed
from src.shader_manager import BlurPipeline
PROVIDERS: list[str] = ["gemini", "anthropic", "gemini_cli", "deepseek", "minimax"]
COMMS_CLAMP_CHARS: int = 300
@@ -178,31 +186,60 @@ class App:
self.ui_separate_tier2 = gui_cfg.get("separate_tier2", False)
self.ui_separate_tier3 = gui_cfg.get("separate_tier3", False)
self.ui_separate_tier4 = gui_cfg.get("separate_tier4", False)
self.ui_separate_external_tools = gui_cfg.get('separate_external_tools', False)
self.show_windows.setdefault("Usage Analytics", False)
self.show_windows.setdefault("Tier 1: Strategy", False)
self.show_windows.setdefault("Tier 2: Tech Lead", False)
self.show_windows.setdefault("Tier 3: Workers", False)
self.show_windows.setdefault("Tier 4: QA", False)
self.show_windows.setdefault('External Tools', False)
self.show_windows.setdefault('Shader Editor', False)
self.ui_multi_viewport = gui_cfg.get("multi_viewport", False)
self.layout_presets = self.config.get("layout_presets", {})
self._new_preset_name = ""
self._show_save_preset_modal = False
self._comms_log_cache: list[dict[str, Any]] = []
self._comms_log_dirty: bool = True
self._tool_log_cache: list[dict[str, Any]] = []
self._tool_log_dirty: bool = True
self._last_ui_focus_agent: Optional[str] = None
self._log_registry: Optional[log_registry.LogRegistry] = None
self.perf_profiling_enabled = False
self.perf_show_graphs: dict[str, bool] = {}
self._token_stats: dict[str, Any] = {}
self._token_stats_dirty: bool = True
self.perf_history: dict[str, list] = {"frame_time": [0.0] * 100, "fps": [0.0] * 100}
self._nerv_crt = theme_fx.CRTFilter()
self.ui_crt_filter = True
self._nerv_alert = theme_fx.AlertPulsing()
self._nerv_flicker = theme_fx.StatusFlicker()
self.ui_tool_filter_category = "All"
self.ui_discussion_split_h = 300.0
self.shader_uniforms = {'crt': 1.0, 'scanline': 0.5, 'bloom': 0.8}
self.ui_frosted_glass_enabled = False
self._blur_pipeline: BlurPipeline | None = None
self.ui_frosted_glass_enabled = False
self._blur_pipeline = None
def _pre_render_blur(self):
if not self.ui_frosted_glass_enabled:
return
if not self._blur_pipeline:
return
ws = imgui.get_io().display_size
fb_scale = imgui.get_io().display_framebuffer_scale.x
import time
t = time.time()
self._blur_pipeline.prepare_global_blur(int(ws.x), int(ws.y), t, fb_scale)
def _render_custom_background(self):
return # DISABLED - imgui-bundle can't sample OpenGL textures
def _draw_blurred_rect(self, dl, p_min, p_max, tex_id, uv_min, uv_max):
import OpenGL.GL as gl
gl.glEnable(gl.GL_BLEND)
gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)
imgui.push_texture_id(tex_id)
dl.add_image_quad(p_min, p_max, uv_min, uv_max, imgui.get_color_u32((1, 1, 1, 1)))
imgui.pop_texture_id()
gl.glDisable(gl.GL_BLEND)
def _handle_approve_tool(self, user_data=None) -> None:
"""UI-level wrapper for approving a pending tool execution ask."""
@@ -363,8 +400,81 @@ class App:
except Exception as e:
self.ai_status = f"error: {e}"
imgui.end_menu()
# Draw right-aligned window controls directly in the menu bar (Win32 only)
if sys.platform == "win32":
try:
import ctypes
ctypes.pythonapi.PyCapsule_GetPointer.restype = ctypes.c_void_p
ctypes.pythonapi.PyCapsule_GetPointer.argtypes = [ctypes.py_object, ctypes.c_char_p]
hwnd_capsule = imgui.get_main_viewport().platform_handle_raw
hwnd = ctypes.pythonapi.PyCapsule_GetPointer(hwnd_capsule, b"nb_handle")
except Exception:
hwnd = 0
if hwnd:
btn_w = 40
display_w = imgui.get_io().display_size.x
right_x = display_w - (btn_w * 3)
# Drag area check using an explicit invisible button spanning the empty space
curr_x = imgui.get_cursor_pos_x()
drag_w = right_x - curr_x
if drag_w > 0:
# Use a small positive height to satisfy IM_ASSERT(size_arg.y != 0.0f)
# The menu bar naturally constrains the hit box height anyway.
imgui.invisible_button("##drag_area", (drag_w, 20.0))
if imgui.is_item_active() and imgui.is_mouse_dragging(0):
# CRITICAL: We must reset ImGui's mouse_down state BEFORE passing control to Windows.
# Otherwise, the Windows modal drag loop swallows the WM_LBUTTONUP event,
# and ImGui thinks the mouse is permanently held down, causing "sticky" dragging.
imgui.get_io().mouse_down[0] = False
win32gui.ReleaseCapture()
win32gui.SendMessage(hwnd, win32con.WM_NCLBUTTONDOWN, win32con.HTCAPTION, 0)
imgui.push_style_color(imgui.Col_.button, vec4(0, 0, 0, 0))
try:
is_max = win32gui.GetWindowPlacement(hwnd)[1] == win32con.SW_SHOWMAXIMIZED
except Exception:
is_max = False
imgui.set_cursor_pos_x(right_x)
if imgui.button("_", (btn_w, 0)):
win32gui.ShowWindow(hwnd, win32con.SW_MINIMIZE)
imgui.set_cursor_pos_x(right_x + btn_w)
if imgui.button("[=]" if is_max else "[]", (btn_w, 0)):
win32gui.ShowWindow(hwnd, win32con.SW_RESTORE if is_max else win32con.SW_MAXIMIZE)
imgui.set_cursor_pos_x(right_x + btn_w * 2)
imgui.push_style_color(imgui.Col_.button_hovered, vec4(200, 50, 50, 255))
if imgui.button("X", (btn_w, 0)):
win32gui.PostMessage(hwnd, win32con.WM_CLOSE, 0, 0)
imgui.pop_style_color()
imgui.pop_style_color()
def _render_custom_title_bar(self) -> None:
# Obsolete, removed since it renders behind the full screen dock space.
# Controls are now embedded in _show_menus.
pass
def _render_shader_live_editor(self) -> None:
if self.show_windows.get('Shader Editor', False):
exp, opened = imgui.begin('Shader Editor', self.show_windows['Shader Editor'])
self.show_windows['Shader Editor'] = bool(opened)
if exp:
_, self.ui_frosted_glass_enabled = imgui.checkbox('Frosted Glass', self.ui_frosted_glass_enabled)
imgui.separator()
changed_crt, self.shader_uniforms['crt'] = imgui.slider_float('CRT Curvature', self.shader_uniforms['crt'], 0.0, 2.0)
changed_scan, self.shader_uniforms['scanline'] = imgui.slider_float('Scanline Intensity', self.shader_uniforms['scanline'], 0.0, 1.0)
changed_bloom, self.shader_uniforms['bloom'] = imgui.slider_float('Bloom Threshold', self.shader_uniforms['bloom'], 0.0, 1.0)
imgui.end()
def _gui_func(self) -> None:
self._render_custom_title_bar()
self._render_shader_live_editor()
pushed_prior_tint = False
# Render background shader
bg = bg_shader.get_bg()
@@ -439,11 +549,14 @@ class App:
self._comms_log_dirty = False
if self._tool_log_dirty:
log_raw = list(self._tool_log)
if self.ui_focus_agent:
self._tool_log_cache = [e for e in log_raw if e.get("source_tier", "").startswith(self.ui_focus_agent)]
if self.is_viewing_prior_session:
self._tool_log_cache = self.prior_tool_calls
else:
self._tool_log_cache = log_raw
log_raw = list(self._tool_log)
if self.ui_focus_agent:
self._tool_log_cache = [e for e in log_raw if e.get("source_tier", "").startswith(self.ui_focus_agent)]
else:
self._tool_log_cache = log_raw
self._tool_log_dirty = False
if self.show_windows.get("Context Hub", False):
@@ -532,11 +645,15 @@ class App:
self.show_windows["Discussion Hub"] = bool(opened)
if exp:
# Top part for the history
imgui.begin_child("HistoryChild", size=(0, -200))
imgui.begin_child("HistoryChild", size=(0, -self.ui_discussion_split_h))
if self.perf_profiling_enabled: self.perf_monitor.start_component("_render_discussion_panel")
self._render_discussion_panel()
if self.perf_profiling_enabled: self.perf_monitor.end_component("_render_discussion_panel")
imgui.end_child()
# Splitter
imgui.button("###discussion_splitter", imgui.ImVec2(-1, 4))
if imgui.is_item_active():
self.ui_discussion_split_h = max(150.0, min(imgui.get_window_height() - 150.0, self.ui_discussion_split_h - imgui.get_io().mouse_delta.y))
# Bottom part with tabs for message and response
# Detach controls
imgui.push_style_var(imgui.StyleVar_.item_spacing, imgui.ImVec2(10, 4))
@@ -597,6 +714,9 @@ class App:
imgui.same_line()
ch2, self.ui_separate_usage_analytics = imgui.checkbox("Pop Out Usage Analytics", self.ui_separate_usage_analytics)
if ch2: self.show_windows["Usage Analytics"] = self.ui_separate_usage_analytics
imgui.same_line()
ch3, self.ui_separate_external_tools = imgui.checkbox('Pop Out External Tools', self.ui_separate_external_tools)
if ch3: self.show_windows['External Tools'] = self.ui_separate_external_tools
imgui.pop_style_var()
show_tc_tab = not self.ui_separate_tool_calls_panel
@@ -614,9 +734,10 @@ class App:
if imgui.begin_tab_item("Usage Analytics")[0]:
self._render_usage_analytics_panel()
imgui.end_tab_item()
if imgui.begin_tab_item("External Tools")[0]:
self._render_external_tools_panel()
imgui.end_tab_item()
if not self.ui_separate_external_tools:
if imgui.begin_tab_item("External Tools")[0]:
self._render_external_tools_panel()
imgui.end_tab_item()
imgui.end_tab_bar()
imgui.end()
@@ -641,6 +762,13 @@ class App:
self._render_tool_calls_panel()
imgui.end()
if self.ui_separate_external_tools and self.show_windows.get('External Tools', False):
exp, opened = imgui.begin('External Tools', self.show_windows['External Tools'])
self.show_windows['External Tools'] = bool(opened)
if exp:
self._render_external_tools_panel()
imgui.end()
if self.show_windows.get("Log Management", False):
if self.perf_profiling_enabled: self.perf_monitor.start_component("_render_log_management")
self._render_log_management()
@@ -1956,7 +2084,7 @@ def hello():
def _render_discussion_panel(self) -> None:
if self.perf_profiling_enabled: self.perf_monitor.start_component("_render_discussion_panel")
# THINKING indicator
is_thinking = self.ai_status in ["sending..."]
is_thinking = self.ai_status in ['sending...', 'streaming...', 'running powershell...']
if is_thinking:
val = math.sin(time.time() * 10 * math.pi)
alpha = 1.0 if val > 0 else 0.0
@@ -1971,9 +2099,7 @@ def hello():
imgui.text_colored(vec4(255, 200, 100), "VIEWING PRIOR SESSION")
imgui.same_line()
if imgui.button("Exit Prior Session"):
self.is_viewing_prior_session = False
self.prior_session_entries.clear()
self.prior_disc_entries.clear()
self.controller.cb_exit_prior_session()
self._comms_log_dirty = True
imgui.separator()
imgui.begin_child("prior_scroll", imgui.ImVec2(0, 0), False)
@@ -2576,17 +2702,23 @@ def hello():
ch, self.ui_ai_input = imgui.input_text_multiline("##ai_in", self.ui_ai_input, imgui.ImVec2(-1, -40))
# Keyboard shortcuts
io = imgui.get_io()
ctrl_enter = io.key_ctrl and imgui.is_key_pressed(imgui.Key.enter)
ctrl_l = io.key_ctrl and imgui.is_key_pressed(imgui.Key.l)
if ctrl_l:
self.ui_ai_input = ""
imgui.separator()
is_busy = self.ai_status in ['sending...', 'streaming...']
send_busy = False
with self._send_thread_lock:
if self.send_thread and self.send_thread.is_alive():
send_busy = True
if (imgui.button("Gen + Send") or ctrl_enter) and not send_busy:
if is_busy: send_busy = True
imgui.begin_disabled(send_busy)
ctrl_enter = io.key_ctrl and imgui.is_key_pressed(imgui.Key.enter)
label = "Gen + Send (Busy)" if send_busy else "Gen + Send"
if (imgui.button(label) or ctrl_enter) and not send_busy:
self._handle_generate_send()
imgui.end_disabled()
imgui.same_line()
if imgui.button("MD Only"):
self._handle_md_only()
@@ -2702,10 +2834,8 @@ def hello():
if self.is_viewing_prior_session:
imgui.same_line()
if imgui.button("Exit Prior Session"):
self.is_viewing_prior_session = False
self.prior_session_entries.clear()
self.controller.cb_exit_prior_session()
self._comms_log_dirty = True
self.ai_status = "idle"
imgui.separator()
imgui.text_colored(C_OUT, "OUT")
@@ -3894,6 +4024,36 @@ def hello():
def _post_init(self) -> None:
theme.apply_current()
def _init_blur_pipeline(self):
if self._blur_pipeline is None:
self._blur_pipeline = BlurPipeline()
ws = imgui.get_io().display_size
fb_scale = imgui.get_io().display_framebuffer_scale.x
if ws.x <= 0 or ws.y <= 0:
return False
if fb_scale <= 0:
fb_scale = 1.0
self._blur_pipeline.setup_fbos(int(ws.x), int(ws.y), fb_scale)
self._blur_pipeline.compile_deepsea_shader()
self._blur_pipeline.compile_blur_shaders()
return True
def _pre_new_frame(self) -> None:
if not self.ui_frosted_glass_enabled:
return
ws = imgui.get_io().display_size
fb_scale = imgui.get_io().display_framebuffer_scale.x
if ws.x <= 0 or ws.y <= 0:
return
if fb_scale <= 0:
fb_scale = 1.0
if self._blur_pipeline is None:
if not self._init_blur_pipeline():
return
import time
t = time.time()
self._blur_pipeline.prepare_global_blur(int(ws.x), int(ws.y), t, fb_scale)
def run(self) -> None:
"""Initializes the ImGui runner and starts the main application loop."""
if "--headless" in sys.argv:
@@ -3908,6 +4068,13 @@ def hello():
theme.load_from_config(self.config)
self.runner_params = hello_imgui.RunnerParams()
self.runner_params.app_window_params.window_title = "manual slop"
if sys.platform == "win32":
self.runner_params.app_window_params.borderless = True
self.runner_params.app_window_params.borderless_closable = False
self.runner_params.app_window_params.borderless_movable = False
self.runner_params.app_window_params.borderless_resizable = True
self.runner_params.app_window_params.window_geometry.size = (1680, 1200)
self.runner_params.imgui_window_params.enable_viewports = getattr(self, "ui_multi_viewport", False)
self.runner_params.imgui_window_params.remember_theme = True
@@ -3918,15 +4085,16 @@ def hello():
user_scale = theme.get_current_scale()
self.runner_params.dpi_aware_params.dpi_window_size_factor = user_scale
# Detect Monitor Refresh Rate for capping
# Detect Monitor Refresh Rate for capping (Win32 only)
fps_cap = 60.0
try:
# Use PowerShell to get max refresh rate across all controllers
cmd = "powershell -NoProfile -Command \"Get-CimInstance -ClassName Win32_VideoController | Select-Object -ExpandProperty CurrentRefreshRate\""
out = subprocess.check_output(cmd, shell=True).decode().splitlines()
rates = [float(r.strip()) for r in out if r.strip().isdigit()]
if rates: fps_cap = max(rates)
except Exception: pass
if sys.platform == "win32":
try:
# Use PowerShell to get max refresh rate across all controllers
cmd = "powershell -NoProfile -Command \"Get-CimInstance -ClassName Win32_VideoController | Select-Object -ExpandProperty CurrentRefreshRate\""
out = subprocess.check_output(cmd, shell=True).decode().splitlines()
rates = [float(r.strip()) for r in out if r.strip().isdigit()]
if rates: fps_cap = max(rates)
except Exception: pass
# Enable idling with monitor refresh rate to effectively cap FPS
self.runner_params.fps_idling.enable_idling = True
@@ -3941,6 +4109,8 @@ def hello():
self.runner_params.callbacks.load_additional_fonts = self._load_fonts
self.runner_params.callbacks.setup_imgui_style = theme.apply_current
self.runner_params.callbacks.post_init = self._post_init
self.runner_params.callbacks.pre_new_frame = self._pre_new_frame
self.runner_params.callbacks.custom_background = self._render_custom_background
self._fetch_models(self.current_provider)
md_options = markdown_helper.get_renderer().options
immapp.run(self.runner_params, add_ons_params=immapp.AddOnsParams(with_markdown_options=md_options))
+8
View File
@@ -48,6 +48,13 @@ from src.paths import get_config_path
CONFIG_PATH = get_config_path()
def _clean_nones(data: Any) -> Any:
if isinstance(data, dict):
return {k: _clean_nones(v) for k, v in data.items() if v is not None}
elif isinstance(data, list):
return [_clean_nones(v) for v in data if v is not None]
return data
def load_config() -> dict[str, Any]:
with open(CONFIG_PATH, "rb") as f:
return tomllib.load(f)
@@ -55,6 +62,7 @@ def load_config() -> dict[str, Any]:
def save_config(config: dict[str, Any]) -> None:
import tomli_w
import sys
config = _clean_nones(config)
sys.stderr.write(f"[DEBUG] Saving config. Theme: {config.get('theme')}\n")
sys.stderr.flush()
with open(CONFIG_PATH, "wb") as f:
+474
View File
@@ -0,0 +1,474 @@
import OpenGL.GL as gl
class ShaderManager:
def __init__(self):
self.program = None
self.bg_program = None
self.pp_program = None
def compile_shader(self, vertex_src: str, fragment_src: str) -> int:
program = gl.glCreateProgram()
def _compile(src, shader_type):
shader = gl.glCreateShader(shader_type)
gl.glShaderSource(shader, src)
gl.glCompileShader(shader)
if not gl.glGetShaderiv(shader, gl.GL_COMPILE_STATUS):
info_log = gl.glGetShaderInfoLog(shader)
if hasattr(info_log, "decode"):
info_log = info_log.decode()
raise RuntimeError(f"Shader compilation failed: {info_log}")
return shader
vert_shader = _compile(vertex_src, gl.GL_VERTEX_SHADER)
frag_shader = _compile(fragment_src, gl.GL_FRAGMENT_SHADER)
gl.glAttachShader(program, vert_shader)
gl.glAttachShader(program, frag_shader)
gl.glLinkProgram(program)
if not gl.glGetProgramiv(program, gl.GL_LINK_STATUS):
info_log = gl.glGetProgramInfoLog(program)
if hasattr(info_log, "decode"):
info_log = info_log.decode()
raise RuntimeError(f"Program linking failed: {info_log}")
gl.glDeleteShader(vert_shader)
gl.glDeleteShader(frag_shader)
self.program = program
return program
def update_uniforms(self, uniforms: dict):
if self.program is None:
return
for name, value in uniforms.items():
loc = gl.glGetUniformLocation(self.program, name)
if loc == -1:
continue
if isinstance(value, float):
gl.glUniform1f(loc, value)
elif isinstance(value, int):
gl.glUniform1i(loc, value)
elif isinstance(value, (list, tuple)):
if len(value) == 2:
gl.glUniform2f(loc, value[0], value[1])
elif len(value) == 3:
gl.glUniform3f(loc, value[0], value[1], value[2])
elif len(value) == 4:
gl.glUniform4f(loc, value[0], value[1], value[2], value[3])
def setup_background_shader(self):
vertex_src = """
#version 330 core
const vec2 positions[4] = vec2[](
vec2(-1.0, -1.0),
vec2( 1.0, -1.0),
vec2(-1.0, 1.0),
vec2( 1.0, 1.0)
);
void main() {
gl_Position = vec4(positions[gl_VertexID], 0.0, 1.0);
}
"""
fragment_src = """
#version 330 core
uniform float u_time;
uniform vec2 u_resolution;
out vec4 FragColor;
void main() {
vec2 uv = gl_FragCoord.xy / u_resolution.xy;
vec3 col = 0.5 + 0.5 * cos(u_time + uv.xyx + vec3(0, 2, 4));
FragColor = vec4(col, 1.0);
}
"""
self.bg_program = self.compile_shader(vertex_src, fragment_src)
def render_background(self, width, height, time):
if not self.bg_program:
return
gl.glUseProgram(self.bg_program)
u_time_loc = gl.glGetUniformLocation(self.bg_program, "u_time")
if u_time_loc != -1:
gl.glUniform1f(u_time_loc, float(time))
u_res_loc = gl.glGetUniformLocation(self.bg_program, "u_resolution")
if u_res_loc != -1:
gl.glUniform2f(u_res_loc, float(width), float(height))
gl.glDrawArrays(gl.GL_TRIANGLE_STRIP, 0, 4)
gl.glUseProgram(0)
def setup_post_process_shader(self):
vertex_src = """
#version 330 core
const vec2 positions[4] = vec2[](
vec2(-1.0, -1.0),
vec2( 1.0, -1.0),
vec2(-1.0, 1.0),
vec2( 1.0, 1.0)
);
const vec2 uvs[4] = vec2[](
vec2(0.0, 0.0),
vec2(1.0, 0.0),
vec2(0.0, 1.0),
vec2(1.0, 1.0)
);
out vec2 v_uv;
void main() {
gl_Position = vec4(positions[gl_VertexID], 0.0, 1.0);
v_uv = uvs[gl_VertexID];
}
"""
fragment_src = """
#version 330 core
in vec2 v_uv;
uniform sampler2D u_texture;
uniform float u_time;
out vec4 FragColor;
void main() {
vec4 color = texture(u_texture, v_uv);
float scanline = sin(v_uv.y * 800.0 + u_time * 2.0) * 0.04;
color.rgb -= scanline;
FragColor = color;
}
"""
self.pp_program = self.compile_shader(vertex_src, fragment_src)
def render_post_process(self, texture_id, width, height, time):
if not self.pp_program:
return
gl.glUseProgram(self.pp_program)
gl.glActiveTexture(gl.GL_TEXTURE0)
gl.glBindTexture(gl.GL_TEXTURE_2D, texture_id)
u_tex_loc = gl.glGetUniformLocation(self.pp_program, "u_texture")
if u_tex_loc != -1:
gl.glUniform1i(u_tex_loc, 0)
u_time_loc = gl.glGetUniformLocation(self.pp_program, "u_time")
if u_time_loc != -1:
gl.glUniform1f(u_time_loc, float(time))
gl.glDrawArrays(gl.GL_TRIANGLE_STRIP, 0, 4)
gl.glBindTexture(gl.GL_TEXTURE_2D, 0)
class BlurPipeline:
def __init__(self):
self.scene_fbo: int | None = None
self.scene_tex: int | None = None
self.blur_fbo_a: int | None = None
self.blur_tex_a: int | None = None
self.blur_fbo_b: int | None = None
self.blur_tex_b: int | None = None
self.h_blur_program: int | None = None
self.v_blur_program: int | None = None
self.deepsea_program: int | None = None
self._quad_vao: int | None = None
self._fb_width: int = 0
self._fb_height: int = 0
self._fb_scale: int = 1
def _compile_shader(self, vertex_src: str, fragment_src: str) -> int:
program = gl.glCreateProgram()
def _compile(src, shader_type):
shader = gl.glCreateShader(shader_type)
gl.glShaderSource(shader, src)
gl.glCompileShader(shader)
if not gl.glGetShaderiv(shader, gl.GL_COMPILE_STATUS):
info_log = gl.glGetShaderInfoLog(shader)
if hasattr(info_log, "decode"):
info_log = info_log.decode()
raise RuntimeError(f"Shader compilation failed: {info_log}")
return shader
vert_shader = _compile(vertex_src, gl.GL_VERTEX_SHADER)
frag_shader = _compile(fragment_src, gl.GL_FRAGMENT_SHADER)
gl.glAttachShader(program, vert_shader)
gl.glAttachShader(program, frag_shader)
gl.glLinkProgram(program)
if not gl.glGetProgramiv(program, gl.GL_LINK_STATUS):
info_log = gl.glGetProgramInfoLog(program)
if hasattr(info_log, "decode"):
info_log = info_log.decode()
raise RuntimeError(f"Program linking failed: {info_log}")
gl.glDeleteShader(vert_shader)
gl.glDeleteShader(frag_shader)
return program
def _create_fbo(self, width: int, height: int) -> tuple[int, int]:
if width <= 0 or height <= 0:
raise ValueError(f"Invalid FBO dimensions: {width}x{height}")
tex = gl.glGenTextures(1)
gl.glBindTexture(gl.GL_TEXTURE_2D, tex)
gl.glTexImage2D(gl.GL_TEXTURE_2D, 0, gl.GL_RGBA8, width, height, 0, gl.GL_RGBA, gl.GL_UNSIGNED_BYTE, None)
gl.glTexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MIN_FILTER, gl.GL_LINEAR)
gl.glTexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MAG_FILTER, gl.GL_LINEAR)
gl.glTexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_WRAP_S, gl.GL_CLAMP_TO_EDGE)
gl.glTexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_WRAP_T, gl.GL_CLAMP_TO_EDGE)
fbo = gl.glGenFramebuffers(1)
gl.glBindFramebuffer(gl.GL_FRAMEBUFFER, fbo)
gl.glFramebufferTexture2D(gl.GL_FRAMEBUFFER, gl.GL_COLOR_ATTACHMENT0, gl.GL_TEXTURE_2D, tex, 0)
gl.glBindFramebuffer(gl.GL_FRAMEBUFFER, 0)
gl.glBindTexture(gl.GL_TEXTURE_2D, 0)
return fbo, tex
def _create_quad_vao(self) -> int:
import ctypes
vao = gl.glGenVertexArrays(1)
gl.glBindVertexArray(vao)
vertices = (ctypes.c_float * 16)(
-1.0, -1.0, 0.0, 0.0,
1.0, -1.0, 1.0, 0.0,
-1.0, 1.0, 0.0, 1.0,
1.0, 1.0, 1.0, 1.0
)
vbo = gl.glGenBuffers(1)
gl.glBindBuffer(gl.GL_ARRAY_BUFFER, vbo)
gl.glBufferData(gl.GL_ARRAY_BUFFER, ctypes.sizeof(vertices), vertices, gl.GL_STATIC_DRAW)
gl.glEnableVertexAttribArray(0)
gl.glVertexAttribPointer(0, 2, gl.GL_FLOAT, gl.GL_FALSE, 16, None)
gl.glEnableVertexAttribArray(1)
gl.glVertexAttribPointer(1, 2, gl.GL_FLOAT, gl.GL_FALSE, 16, ctypes.c_void_p(8))
gl.glBindVertexArray(0)
return vao
def setup_fbos(self, width: int, height: int, fb_scale: float = 1.0):
scale = max(1, int(fb_scale))
blur_w = max(1, (width * scale) // 4)
blur_h = max(1, (height * scale) // 4)
self._fb_width = blur_w
self._fb_height = blur_h
self._fb_scale = scale
scene_w = width * scale
scene_h = height * scale
self.scene_fbo, self.scene_tex = self._create_fbo(scene_w, scene_h)
self.blur_fbo_a, self.blur_tex_a = self._create_fbo(blur_w, blur_h)
self.blur_fbo_b, self.blur_tex_b = self._create_fbo(blur_w, blur_h)
def compile_blur_shaders(self):
vert_src = """
#version 330 core
layout(location = 0) in vec2 a_position;
layout(location = 1) in vec2 a_texcoord;
out vec2 v_uv;
void main() {
gl_Position = vec4(a_position, 0.0, 1.0);
v_uv = a_texcoord;
}
"""
h_frag_src = """
#version 330 core
in vec2 v_uv;
uniform sampler2D u_texture;
uniform vec2 u_texel_size;
out vec4 FragColor;
void main() {
vec2 offset = vec2(u_texel_size.x, 0.0);
vec4 sum = vec4(0.0);
sum += texture(u_texture, v_uv - offset * 6.0) * 0.0152;
sum += texture(u_texture, v_uv - offset * 5.0) * 0.0300;
sum += texture(u_texture, v_uv - offset * 4.0) * 0.0525;
sum += texture(u_texture, v_uv - offset * 3.0) * 0.0812;
sum += texture(u_texture, v_uv - offset * 2.0) * 0.1110;
sum += texture(u_texture, v_uv - offset * 1.0) * 0.1342;
sum += texture(u_texture, v_uv) * 0.1432;
sum += texture(u_texture, v_uv + offset * 1.0) * 0.1342;
sum += texture(u_texture, v_uv + offset * 2.0) * 0.1110;
sum += texture(u_texture, v_uv + offset * 3.0) * 0.0812;
sum += texture(u_texture, v_uv + offset * 4.0) * 0.0525;
sum += texture(u_texture, v_uv + offset * 5.0) * 0.0300;
sum += texture(u_texture, v_uv + offset * 6.0) * 0.0152;
FragColor = sum;
}
"""
v_frag_src = """
#version 330 core
in vec2 v_uv;
uniform sampler2D u_texture;
uniform vec2 u_texel_size;
out vec4 FragColor;
void main() {
vec2 offset = vec2(0.0, u_texel_size.y);
vec4 sum = vec4(0.0);
sum += texture(u_texture, v_uv - offset * 6.0) * 0.0152;
sum += texture(u_texture, v_uv - offset * 5.0) * 0.0300;
sum += texture(u_texture, v_uv - offset * 4.0) * 0.0525;
sum += texture(u_texture, v_uv - offset * 3.0) * 0.0812;
sum += texture(u_texture, v_uv - offset * 2.0) * 0.1110;
sum += texture(u_texture, v_uv - offset * 1.0) * 0.1342;
sum += texture(u_texture, v_uv) * 0.1432;
sum += texture(u_texture, v_uv + offset * 1.0) * 0.1342;
sum += texture(u_texture, v_uv + offset * 2.0) * 0.1110;
sum += texture(u_texture, v_uv + offset * 3.0) * 0.0812;
sum += texture(u_texture, v_uv + offset * 4.0) * 0.0525;
sum += texture(u_texture, v_uv + offset * 5.0) * 0.0300;
sum += texture(u_texture, v_uv + offset * 6.0) * 0.0152;
FragColor = sum;
}
"""
self.h_blur_program = self._compile_shader(vert_src, h_frag_src)
self.v_blur_program = self._compile_shader(vert_src, v_frag_src)
def compile_deepsea_shader(self):
vert_src = """
#version 330 core
layout(location = 0) in vec2 a_position;
layout(location = 1) in vec2 a_texcoord;
out vec2 v_uv;
void main() {
gl_Position = vec4(a_position, 0.0, 1.0);
v_uv = a_texcoord;
}
"""
frag_src = """
#version 330 core
in vec2 v_uv;
uniform float u_time;
uniform vec2 u_resolution;
out vec4 FragColor;
float hash(vec2 p) {
return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);
}
float noise(vec2 p) {
vec2 i = floor(p);
vec2 f = fract(p);
f = f * f * (3.0 - 2.0 * f);
float a = hash(i);
float b = hash(i + vec2(1.0, 0.0));
float c = hash(i + vec2(0.0, 1.0));
float d = hash(i + vec2(1.0, 1.0));
return mix(mix(a, b, f.x), mix(c, d, f.x), f.y);
}
float fbm(vec2 p) {
float v = 0.0;
float a = 0.5;
for (int i = 0; i < 4; i++) {
v += a * noise(p);
p *= 2.0;
a *= 0.5;
}
return v;
}
void main() {
vec2 uv = v_uv;
float t = u_time * 0.3;
vec3 col = vec3(0.01, 0.05, 0.12);
for (int i = 0; i < 3; i++) {
float phase = t * (0.1 + float(i) * 0.05);
vec2 blob_uv = uv + vec2(sin(phase), cos(phase * 0.8)) * 0.3;
float blob = fbm(blob_uv * 3.0 + t * 0.2);
col = mix(col, vec3(0.02, 0.20, 0.40), blob * 0.4);
}
float line_alpha = 0.0;
for (int i = 0; i < 12; i++) {
float fi = float(i);
float offset = mod(t * 15.0 + fi * (u_resolution.x / 12.0), u_resolution.x);
float line_x = offset / u_resolution.x;
float dist = abs(uv.x - line_x);
float alpha = smoothstep(0.02, 0.0, dist) * (0.1 + 0.05 * sin(t + fi));
line_alpha += alpha;
}
col += vec3(0.04, 0.35, 0.55) * line_alpha;
float vignette = 1.0 - length(uv - 0.5) * 0.8;
col *= vignette;
FragColor = vec4(col, 1.0);
}
"""
self.deepsea_program = self._compile_shader(vert_src, frag_src)
self._quad_vao = self._create_quad_vao()
def render_deepsea_to_fbo(self, width: int, height: int, time: float):
if not self.deepsea_program or not self.scene_fbo or not self._quad_vao:
return
scene_w = width * self._fb_scale
scene_h = height * self._fb_scale
gl.glBindFramebuffer(gl.GL_FRAMEBUFFER, self.scene_fbo)
gl.glViewport(0, 0, scene_w, scene_h)
gl.glClearColor(0.01, 0.05, 0.12, 1.0)
gl.glClear(gl.GL_COLOR_BUFFER_BIT)
gl.glUseProgram(self.deepsea_program)
u_time_loc = gl.glGetUniformLocation(self.deepsea_program, "u_time")
if u_time_loc != -1:
gl.glUniform1f(u_time_loc, time)
u_res_loc = gl.glGetUniformLocation(self.deepsea_program, "u_resolution")
if u_res_loc != -1:
gl.glUniform2f(u_res_loc, float(scene_w), float(scene_h))
gl.glBindVertexArray(self._quad_vao)
gl.glDrawArrays(gl.GL_TRIANGLE_STRIP, 0, 4)
gl.glBindVertexArray(0)
gl.glUseProgram(0)
gl.glBindFramebuffer(gl.GL_FRAMEBUFFER, 0)
def _render_quad(self, program: int, src_tex: int, texel_size: tuple[float, float]):
gl.glUseProgram(program)
gl.glActiveTexture(gl.GL_TEXTURE0)
gl.glBindTexture(gl.GL_TEXTURE_2D, src_tex)
u_tex = gl.glGetUniformLocation(program, "u_texture")
if u_tex != -1:
gl.glUniform1i(u_tex, 0)
u_ts = gl.glGetUniformLocation(program, "u_texel_size")
if u_ts != -1:
gl.glUniform2f(u_ts, texel_size[0], texel_size[1])
gl.glBindVertexArray(self._quad_vao)
gl.glDrawArrays(gl.GL_TRIANGLE_STRIP, 0, 4)
gl.glBindVertexArray(0)
gl.glBindTexture(gl.GL_TEXTURE_2D, 0)
gl.glUseProgram(0)
def prepare_blur(self, width: int, height: int, time: float):
if not self.h_blur_program or not self.v_blur_program:
return
if not self.blur_fbo_a or not self.blur_fbo_b:
return
blur_w = max(1, self._fb_width)
blur_h = max(1, self._fb_height)
texel_x = 1.0 / float(blur_w)
texel_y = 1.0 / float(blur_h)
gl.glViewport(0, 0, blur_w, blur_h)
gl.glBindFramebuffer(gl.GL_FRAMEBUFFER, self.blur_fbo_a)
gl.glClearColor(0.0, 0.0, 0.0, 0.0)
gl.glClear(gl.GL_COLOR_BUFFER_BIT)
self._render_quad(self.h_blur_program, self.scene_tex, (texel_x, texel_y))
gl.glBindFramebuffer(gl.GL_FRAMEBUFFER, self.blur_fbo_b)
gl.glClear(gl.GL_COLOR_BUFFER_BIT)
self._render_quad(self.v_blur_program, self.blur_tex_a, (texel_x, texel_y))
gl.glBindFramebuffer(gl.GL_FRAMEBUFFER, 0)
restore_w = width * self._fb_scale
restore_h = height * self._fb_scale
gl.glViewport(0, 0, restore_w, restore_h)
def prepare_global_blur(self, width: int, height: int, time: float, fb_scale: float = 1.0):
if not self.scene_fbo:
if self._fb_scale != int(fb_scale):
self.setup_fbos(width, height, fb_scale)
self.render_deepsea_to_fbo(width, height, time)
self.prepare_blur(width, height, time)
def get_blur_texture(self) -> int | None:
return self.blur_tex_b
def cleanup(self):
fbos = [f for f in [self.scene_fbo, self.blur_fbo_a, self.blur_fbo_b] if f is not None]
texs = [t for t in [self.scene_tex, self.blur_tex_a, self.blur_tex_b] if t is not None]
progs = [p for p in [self.h_blur_program, self.v_blur_program, self.deepsea_program] if p is not None]
if fbos:
gl.glDeleteFramebuffers(len(fbos), fbos)
if texs:
gl.glDeleteTextures(len(texs), texs)
if progs:
for p in progs:
gl.glDeleteProgram(p)
if self._quad_vao:
gl.glDeleteVertexArrays(1, [self._quad_vao])
self.scene_fbo = None
self.scene_tex = None
self.blur_fbo_a = None
self.blur_tex_a = None
self.blur_fbo_b = None
self.blur_tex_b = None
self.h_blur_program = None
self.v_blur_program = None
self.deepsea_program = None
self._quad_vao = None
+19
View File
@@ -268,6 +268,12 @@ _current_palette: str = "DPG Default"
_current_font_path: str = ""
_current_font_size: float = 14.0
_current_scale: float = 1.0
_shader_config: dict[str, Any] = {
"crt": False,
"bloom": False,
"bg": "none",
"custom_window_frame": False,
}
# ------------------------------------------------------------------ public API
@@ -286,6 +292,14 @@ def get_current_font_size() -> float:
def get_current_scale() -> float:
return _current_scale
def get_shader_config(key: str) -> Any:
"""Get a specific shader configuration value."""
return _shader_config.get(key)
def get_window_frame_config() -> bool:
"""Get the window frame configuration."""
return _shader_config.get("custom_window_frame", False)
def get_palette_colours(name: str) -> dict[str, Any]:
"""Return a copy of the colour dict for the named palette."""
return dict(_PALETTES.get(name, {}))
@@ -388,4 +402,9 @@ def load_from_config(config: dict[str, Any]) -> None:
if font_path:
apply_font(font_path, font_size)
set_scale(scale)
global _shader_config
_shader_config["crt"] = t.get("shader_crt", False)
_shader_config["bloom"] = t.get("shader_bloom", False)
_shader_config["bg"] = t.get("shader_bg", "none")
_shader_config["custom_window_frame"] = t.get("custom_window_frame", False)
+5 -1
View File
@@ -200,7 +200,7 @@ def live_gui() -> Generator[tuple[subprocess.Popen, str], None, None]:
temp_workspace.mkdir(parents=True, exist_ok=True)
# Create minimal project files to avoid cluttering root
(temp_workspace / "manual_slop.toml").write_text("[project]\nname = 'TestProject'\n", encoding="utf-8")
(temp_workspace / "manual_slop.toml").write_text("[project]\nname = 'TestProject'\n\n[conductor]\ndir = 'conductor'\n", encoding="utf-8")
(temp_workspace / "conductor" / "tracks").mkdir(parents=True, exist_ok=True)
# Create a local config.toml in temp_workspace
@@ -209,6 +209,10 @@ def live_gui() -> Generator[tuple[subprocess.Popen, str], None, None]:
'projects': {
'paths': [str((temp_workspace / 'manual_slop.toml').absolute())],
'active': str((temp_workspace / 'manual_slop.toml').absolute())
},
'paths': {
'logs_dir': str((temp_workspace / "logs").absolute()),
'scripts_dir': str((temp_workspace / "scripts" / "generated").absolute())
}
}
import tomli_w
+33
View File
@@ -0,0 +1,33 @@
import pytest
from unittest.mock import patch, MagicMock
def test_dynamic_background_rendering():
# Mock OpenGL before importing
with patch("src.shader_manager.gl") as mock_gl:
from src.shader_manager import ShaderManager
# Setup mock return values
mock_gl.glCreateProgram.return_value = 1
mock_gl.glCreateShader.return_value = 2
mock_gl.glGetShaderiv.return_value = 1 # GL_TRUE
mock_gl.glGetProgramiv.return_value = 1 # GL_TRUE
mock_gl.glGetUniformLocation.return_value = 10
manager = ShaderManager()
manager.setup_background_shader()
# Verify background program was created
assert manager.bg_program == 1
assert mock_gl.glCreateProgram.called
# Render background
manager.render_background(800, 600, 1.0)
# Verify OpenGL calls
mock_gl.glUseProgram.assert_any_call(1)
mock_gl.glDrawArrays.assert_called_with(mock_gl.GL_TRIANGLE_STRIP, 0, 4)
mock_gl.glUseProgram.assert_any_call(0)
# Verify uniforms were updated
mock_gl.glUniform1f.assert_called()
mock_gl.glUniform2f.assert_called()
+26
View File
@@ -0,0 +1,26 @@
import pytest
from unittest.mock import patch, MagicMock
from src.gui_2 import App
def test_frosted_glass_disabled():
with patch("src.gui_2.imgui") as mock_imgui:
with patch("src.gui_2.gl") as mock_gl:
app = App()
app.ui_frosted_glass_enabled = False
app._render_frosted_background((0, 0), (100, 100))
assert app._blur_pipeline is None
mock_gl.glEnable.assert_not_called()
mock_gl.glBlendFunc.assert_not_called()
mock_gl.glBindTexture.assert_not_called()
mock_gl.glBegin.assert_not_called()
mock_gl.glEnd.assert_not_called()
mock_gl.glDisable.assert_not_called()
mock_imgui.get_io().display_size.assert_not_called()
mock_imgui.get_io().display_framebuffer_scale.assert_not_called()
mock_imgui.get_window_draw_list.assert_not_called()
mock_imgui.get_window_pos.assert_not_called()
mock_imgui.get_window_size.assert_not_called()
mock_imgui.get_color_u32.assert_not_called()
mock_imgui.push_texture_id.assert_not_called()
mock_imgui.pop_texture_id.assert_not_called()
+79
View File
@@ -26,5 +26,84 @@ def test_gui2_old_windows_removed_from_show_windows(app_instance: App) -> None:
"Provider", "System Prompts",
"Comms History"
]
for old_win in old_windows:
from src.gui_2 import App
def test_gui2_hubs_exist_in_show_windows(app_instance: App) -> None:
expected_hubs = [
"Context Hub",
"AI Settings",
"Discussion Hub",
"Operations Hub",
"Files & Media",
"Theme",
]
for hub in expected_hubs:
assert hub in app_instance.show_windows, f"Expected hub window '{hub}' not found in show_windows"
def test_gui2_old_windows_removed_from_show_windows(app_instance: App) -> None:
old_windows = [
"Projects", "Files", "Screenshots",
"Provider", "System Prompts",
"Comms History"
]
for old_win in old_windows:
assert old_win not in app_instance.show_windows, f"Old window '{old_win}' should have been removed from show_windows"
def test_frosted_glass_disabled():
with patch("src.gui_2.imgui"):
app = App()
app.ui_frosted_glass_enabled = False
app._render_frosted_background((0, 0), (100, 100))
assert not app._blur_pipeline is None or not app._blur_pipeline.prepare_global_blur.called
imgui.get_io().display_size.assert_not_called()
imgui.get_io().display_framebuffer_scale.assert_not_called()
imgui.get_window_draw_list.assert_not_called()
imgui.get_window_pos.assert_not_called()
imgui.get_window_size.assert_not_called()
imgui.get_color_u32.assert_not_called()
imgui.push_texture_id.assert_not_called()
imgui.pop_texture_id.assert_not_called()
dl.add_image_quad.assert_not_called()
imgui.pop_texture_id.assert_not_called()
gl.glEnable.assert_not_called()
gl.glBlendFunc.assert_not_called()
gl.glBindTexture.assert_not_called()
gl.glBegin.assert_not_called()
gl.glEnd.assert_not_called()
gl.glDisable.assert_not_called()
gl.glUnbindTexture.assert_not_called()
gl.glDeleteTexture.assert_not_called()
gl.glDisable.assert_not_called()
def test_frosted_glass_enabled():
with patch("src.gui_2.imgui"):
with patch("src.gui_2.BlurPipeline") as mock_blur:
app = App()
app.ui_frosted_glass_enabled = True
app._blur_pipeline = mock_blur
mock_blur.return_value = BlurPipeline()
mock_blur.prepare_global_blur.return_value = None
mock_blur.get_blur_texture.return_value = 123
imgui.get_io().display_size = MagicMock(x=800.0, y=600.0)
imgui.get_io().display_framebuffer_scale = MagicMock(x=1.0, y=1.0)
imgui.get_window_draw_list.return_value = MagicMock()
imgui.get_window_pos.return_value = (100, 200)
imgui.get_window_size.return_value = (300, 400)
imgui.get_color_u32.return_value = 0xFFFFFFFF
dl = MagicMock()
imgui.get_window_draw_list.return_value = dl
app._render_frosted_background((100, 200), (300, 400))
mock_blur.get_blur_texture.assert_called_once()
assert dl.add_callback_texture_id.called
assert dl.add_callback_quadsDrawElements.called
imgui.push_texture_id.assert_called()
imgui.pop_texture_id.assert_called()
gl.glEnable.assert_called()
gl.glBlendFunc.assert_called()
gl.glBindTexture.assert_called()
gl.glBegin.assert_called()
gl.glEnd.assert_called()
gl.glDisable.assert_called()
gl.glUnbindTexture.assert_called()
gl.glDeleteTexture.assert_not_called()
+15
View File
@@ -0,0 +1,15 @@
import pytest
from unittest.mock import patch
from src.gui_2 import App
@patch("src.gui_2.immapp.run")
@patch("src.gui_2.session_logger.close_session")
@patch("src.gui_2.imgui.save_ini_settings_to_disk")
@patch("sys.argv", ["gui_2.py"])
def test_app_window_is_borderless(mock_save_ini, mock_close, mock_run):
app = App()
app.run()
assert app.runner_params is not None
# This assertion will fail initially because we haven't implemented it yet
assert getattr(app.runner_params.app_window_params, 'borderless', False) is True, "Window should be borderless"
+43
View File
@@ -0,0 +1,43 @@
import pytest
from unittest.mock import patch, MagicMock
from imgui_bundle import imgui
def test_gui_window_controls_minimize_maximize_close():
# We will test the logic of the title bar controls that we are about to implement.
from src.gui_2 import App
app = App()
with patch("src.gui_2.win32gui") as mock_win32gui, \
patch("src.gui_2.win32con") as mock_win32con, \
patch("src.gui_2.imgui") as mock_imgui, \
patch("ctypes.pythonapi.PyCapsule_GetPointer") as mock_get_pointer:
# Setup mock for HWND
mock_viewport = MagicMock()
mock_viewport.platform_handle_raw = "mock_capsule"
mock_imgui.get_main_viewport.return_value = mock_viewport
mock_get_pointer.return_value = 12345
mock_imgui.get_window_width.return_value = 800.0
mock_imgui.get_cursor_pos_x.return_value = 100.0
mock_imgui.get_io().display_size.x = 800.0
mock_style = MagicMock()
mock_style.item_spacing.x = 4.0
mock_imgui.get_style.return_value = mock_style
# Setup mock for buttons to simulate clicks
# Let's say _render_custom_title_bar uses imgui.button
# We will test the close button logic
# Since it's UI code, we just simulate the conditions
mock_imgui.button.return_value = True # Simulate all buttons being clicked
# Avoid hitting actual menu logic that requires real runner_params
mock_imgui.begin_menu.return_value = False
app.runner_params = MagicMock()
# Call the method (now in _show_menus)
app._show_menus()
# Verify that win32gui calls are made for minimize, maximize, close
# Since all buttons returned True, all actions should be triggered in this dummy test
assert mock_win32gui.ShowWindow.called
assert mock_win32gui.PostMessage.called
+53
View File
@@ -0,0 +1,53 @@
import unittest
from unittest.mock import MagicMock, patch
import sys
# Mock OpenGL.GL before importing ShaderManager
gl_mock = MagicMock()
# Setup some constants
gl_mock.GL_VERTEX_SHADER = 0x8B31
gl_mock.GL_FRAGMENT_SHADER = 0x8B30
gl_mock.GL_COMPILE_STATUS = 0x8B81
gl_mock.GL_LINK_STATUS = 0x8B82
gl_mock.GL_TEXTURE0 = 0x84C0
gl_mock.GL_TEXTURE_2D = 0x0DE1
gl_mock.GL_TRIANGLE_STRIP = 0x0005
opengl_mock = MagicMock()
sys.modules['OpenGL'] = opengl_mock
sys.modules['OpenGL.GL'] = gl_mock
opengl_mock.GL = gl_mock
from src.shader_manager import ShaderManager
class TestPostProcess(unittest.TestCase):
def setUp(self):
gl_mock.reset_mock()
# Mock return values for shader compilation
gl_mock.glCreateProgram.return_value = 1
gl_mock.glCreateShader.return_value = 2
gl_mock.glGetShaderiv.return_value = 1 # GL_TRUE
gl_mock.glGetProgramiv.return_value = 1 # GL_TRUE
gl_mock.glGetUniformLocation.return_value = 10
def test_setup_post_process_shader(self):
sm = ShaderManager()
sm.setup_post_process_shader()
self.assertEqual(sm.pp_program, 1)
gl_mock.glCreateProgram.assert_called()
gl_mock.glLinkProgram.assert_called_with(1)
def test_render_post_process(self):
sm = ShaderManager()
sm.pp_program = 1
sm.render_post_process(texture_id=5, width=800, height=600, time=1.0)
gl_mock.glUseProgram.assert_any_call(1)
gl_mock.glActiveTexture.assert_called_with(gl_mock.GL_TEXTURE0)
gl_mock.glBindTexture.assert_any_call(gl_mock.GL_TEXTURE_2D, 5)
gl_mock.glUniform1f.assert_called()
gl_mock.glDrawArrays.assert_called_with(gl_mock.GL_TRIANGLE_STRIP, 0, 4)
gl_mock.glUseProgram.assert_any_call(0)
if __name__ == '__main__':
unittest.main()
+23
View File
@@ -0,0 +1,23 @@
import pytest
from unittest.mock import patch
from src import theme
def test_shader_config_parsing():
config = {
"theme": {
"shader_crt": True,
"shader_bloom": False,
"shader_bg": "noise",
"custom_window_frame": True
}
}
with patch("src.theme.apply"), \
patch("src.theme.apply_font"), \
patch("src.theme.set_scale"):
theme.load_from_config(config)
assert theme.get_shader_config("crt") is True
assert theme.get_shader_config("bloom") is False
assert theme.get_shader_config("bg") == "noise"
assert theme.get_window_frame_config() is True
+14
View File
@@ -0,0 +1,14 @@
import pytest
from unittest.mock import patch, MagicMock
def test_shader_live_editor_renders():
from src.gui_2 import App
app = App()
app.show_windows["Shader Editor"] = True
with patch("src.gui_2.imgui") as mock_imgui:
mock_imgui.begin.return_value = (True, True)
mock_imgui.slider_float.return_value = (False, 1.0)
app._render_shader_live_editor()
assert mock_imgui.begin.called
assert mock_imgui.end.called
+217
View File
@@ -0,0 +1,217 @@
import pytest
from unittest.mock import patch, MagicMock
def test_blur_pipeline_import():
with patch("src.shader_manager.gl") as mock_gl:
from src.shader_manager import BlurPipeline
pipeline = BlurPipeline()
assert pipeline is not None
assert pipeline.scene_fbo is None
assert pipeline.blur_fbo_a is None
assert pipeline.blur_fbo_b is None
assert pipeline.scene_tex is None
assert pipeline.blur_tex_a is None
assert pipeline.blur_tex_b is None
assert pipeline.h_blur_program is None
assert pipeline.v_blur_program is None
def test_blur_pipeline_setup_fbos():
with patch("src.shader_manager.gl") as mock_gl:
tex_counter = iter([10, 20, 30])
fbo_counter = iter([1, 2, 3])
mock_gl.glGenTextures.side_effect = lambda n: next(tex_counter)
mock_gl.glGenFramebuffers.side_effect = lambda n: next(fbo_counter)
from src.shader_manager import BlurPipeline
pipeline = BlurPipeline()
pipeline.setup_fbos(800, 600)
assert mock_gl.glGenFramebuffers.called
assert mock_gl.glGenTextures.called
assert pipeline.scene_fbo is not None
assert pipeline.blur_fbo_a is not None
assert pipeline.blur_fbo_b is not None
def test_blur_pipeline_compile_shaders():
with patch("src.shader_manager.gl") as mock_gl:
mock_gl.glCreateProgram.return_value = 100
mock_gl.glCreateShader.return_value = 200
mock_gl.glGetShaderiv.return_value = mock_gl.GL_TRUE
mock_gl.glGetProgramiv.return_value = mock_gl.GL_TRUE
from src.shader_manager import BlurPipeline
pipeline = BlurPipeline()
pipeline.compile_blur_shaders()
assert mock_gl.glCreateProgram.called
assert pipeline.h_blur_program is not None
assert pipeline.v_blur_program is not None
def test_blur_pipeline_wide_tap_distribution():
with patch("src.shader_manager.gl") as mock_gl:
mock_gl.glCreateProgram.return_value = 100
mock_gl.glCreateShader.return_value = 200
mock_gl.glGetShaderiv.return_value = mock_gl.GL_TRUE
mock_gl.glGetProgramiv.return_value = mock_gl.GL_TRUE
from src.shader_manager import BlurPipeline
pipeline = BlurPipeline()
pipeline.compile_blur_shaders()
assert mock_gl.glShaderSource.called
shader_sources = [call.args[1] for call in mock_gl.glShaderSource.call_args_list]
frag_sources = [s for s in shader_sources if 'texture(' in s and 'offset' in s]
assert len(frag_sources) >= 2
for src in frag_sources:
texture_calls = src.count('texture(u_texture')
assert texture_calls >= 11, f"Expected at least 11 texture samples for wide tap distribution, got {texture_calls}"
def test_blur_pipeline_render_deepsea_to_fbo():
with patch("src.shader_manager.gl") as mock_gl:
tex_counter = iter([10, 20, 30])
fbo_counter = iter([1, 2, 3])
mock_gl.glGenTextures.side_effect = lambda n: next(tex_counter)
mock_gl.glGenFramebuffers.side_effect = lambda n: next(fbo_counter)
mock_gl.glCreateProgram.return_value = 300
mock_gl.glCreateShader.return_value = 400
mock_gl.glGetShaderiv.return_value = mock_gl.GL_TRUE
mock_gl.glGetProgramiv.return_value = mock_gl.GL_TRUE
from src.shader_manager import BlurPipeline
pipeline = BlurPipeline()
pipeline.setup_fbos(800, 600)
pipeline.compile_deepsea_shader()
pipeline.render_deepsea_to_fbo(800, 600, 0.0)
assert mock_gl.glBindFramebuffer.called
assert mock_gl.glUseProgram.called
assert mock_gl.glDrawArrays.called
def test_blur_pipeline_deepsea_shader_compilation():
with patch("src.shader_manager.gl") as mock_gl:
mock_gl.glCreateProgram.return_value = 500
mock_gl.glCreateShader.return_value = 600
mock_gl.glGetShaderiv.return_value = mock_gl.GL_TRUE
mock_gl.glGetProgramiv.return_value = mock_gl.GL_TRUE
from src.shader_manager import BlurPipeline
pipeline = BlurPipeline()
pipeline.compile_deepsea_shader()
assert mock_gl.glCreateProgram.called
assert pipeline.deepsea_program is not None
def test_blur_pipeline_prepare_blur():
with patch("src.shader_manager.gl") as mock_gl:
mock_gl.glGenFramebuffers.return_value = None
mock_gl.glGenTextures.return_value = None
from src.shader_manager import BlurPipeline
pipeline = BlurPipeline()
pipeline.scene_fbo = 1
pipeline.scene_tex = 10
pipeline.blur_fbo_a = 2
pipeline.blur_tex_a = 20
pipeline.blur_fbo_b = 3
pipeline.blur_tex_b = 30
pipeline.h_blur_program = 100
pipeline.v_blur_program = 101
pipeline.prepare_blur(800, 600, 0.0)
assert mock_gl.glBindFramebuffer.called
assert mock_gl.glUseProgram.called
def test_blur_pipeline_prepare_global_blur():
with patch("src.shader_manager.gl") as mock_gl:
tex_counter = iter([10, 20, 30])
fbo_counter = iter([1, 2, 3])
mock_gl.glGenTextures.side_effect = lambda n: next(tex_counter)
mock_gl.glGenFramebuffers.side_effect = lambda n: next(fbo_counter)
mock_gl.glCreateProgram.return_value = 100
mock_gl.glCreateShader.return_value = 200
mock_gl.glGetShaderiv.return_value = mock_gl.GL_TRUE
mock_gl.glGetProgramiv.return_value = mock_gl.GL_TRUE
from src.shader_manager import BlurPipeline
pipeline = BlurPipeline()
pipeline.setup_fbos(800, 600)
pipeline.compile_deepsea_shader()
pipeline.compile_blur_shaders()
pipeline.prepare_global_blur(800, 600, 0.0)
assert mock_gl.glBindFramebuffer.called
assert mock_gl.glUseProgram.called
assert mock_gl.glViewport.called
blur_tex = pipeline.get_blur_texture()
assert blur_tex is not None
assert blur_tex == 30
def test_blur_pipeline_high_dpi_scaling():
with patch("src.shader_manager.gl") as mock_gl:
tex_counter = iter([10, 20, 30])
fbo_counter = iter([1, 2, 3])
mock_gl.glGenTextures.side_effect = lambda n: next(tex_counter)
mock_gl.glGenFramebuffers.side_effect = lambda n: next(fbo_counter)
mock_gl.glCreateProgram.return_value = 100
mock_gl.glCreateShader.return_value = 200
mock_gl.glGetShaderiv.return_value = mock_gl.GL_TRUE
mock_gl.glGetProgramiv.return_value = mock_gl.GL_TRUE
from src.shader_manager import BlurPipeline
pipeline = BlurPipeline()
fb_scale = 2.0
pipeline.setup_fbos(800, 600, fb_scale)
assert pipeline._fb_width == (800 * int(fb_scale)) // 4
assert pipeline._fb_height == (600 * int(fb_scale)) // 4
assert pipeline._fb_scale == int(fb_scale)
def test_blur_pipeline_cleanup():
with patch("src.shader_manager.gl") as mock_gl:
from src.shader_manager import BlurPipeline
pipeline = BlurPipeline()
pipeline.scene_fbo = 1
pipeline.blur_fbo_a = 2
pipeline.blur_fbo_b = 3
pipeline.scene_tex = 10
pipeline.blur_tex_a = 20
pipeline.blur_tex_b = 30
pipeline.h_blur_program = 100
pipeline.v_blur_program = 101
pipeline.cleanup()
assert mock_gl.glDeleteFramebuffers.called
assert mock_gl.glDeleteTextures.called
assert mock_gl.glDeleteProgram.called
def test_shader_manager_initialization_and_compilation():
# Import inside test to allow patching OpenGL before import if needed
# In this case, we patch the OpenGL.GL functions used by ShaderManager
with patch("src.shader_manager.gl") as mock_gl:
mock_gl.glCreateProgram.return_value = 1
mock_gl.glCreateShader.return_value = 2
mock_gl.glGetShaderiv.return_value = mock_gl.GL_TRUE
mock_gl.glGetProgramiv.return_value = mock_gl.GL_TRUE
from src.shader_manager import ShaderManager
manager = ShaderManager()
# Basic vertex and fragment shader source
vert_src = "void main() {}"
frag_src = "void main() {}"
program_id = manager.compile_shader(vert_src, frag_src)
assert program_id == 1
assert mock_gl.glCreateProgram.called
assert mock_gl.glCreateShader.called
def test_shader_manager_uniform_update():
# Mock OpenGL.GL functions
with patch("src.shader_manager.gl") as mock_gl:
from src.shader_manager import ShaderManager
manager = ShaderManager()
# Set a mock program ID
manager.program = 1
# Mock glGetUniformLocation to return some valid locations
# u_time -> 10, u_resolution -> 20
def mock_get_loc(prog, name):
if name == "u_time": return 10
if name == "u_resolution": return 20
return -1
mock_gl.glGetUniformLocation.side_effect = mock_get_loc
# Call the method
manager.update_uniforms({"u_time": 1.5, "u_resolution": (800, 600)})
# Assert calls
mock_gl.glGetUniformLocation.assert_any_call(1, "u_time")
mock_gl.glGetUniformLocation.assert_any_call(1, "u_resolution")
mock_gl.glUniform1f.assert_called_once_with(10, 1.5)
mock_gl.glUniform2f.assert_called_once_with(20, 800, 600)