36 Commits

Author SHA1 Message Date
Ed_
b4396697dd finished a track 2026-03-17 23:26:01 -04:00
Ed_
31b38f0c77 chore(conductor): Mark track 'Advanced Text Viewer with Syntax Highlighting' as complete 2026-03-17 23:16:25 -04:00
Ed_
2826ad53d8 feat(gui): Update all text viewer usages to specify types and support markdown preview for presets 2026-03-17 23:15:39 -04:00
Ed_
a91b8dcc99 feat(gui): Refactor text viewer to use rich rendering and toolbar 2026-03-17 23:10:33 -04:00
Ed_
74c9d4b992 conductor(plan): Mark phase 'Phase 1: State & Interface Update' as complete 2026-03-17 22:51:49 -04:00
Ed_
e28af48ae9 feat(gui): Initialize text viewer state variables and update interface 2026-03-17 22:48:35 -04:00
Ed_
5470f2106f fix(gui): fix missing thinking_segments parameter persistence across sessions 2026-03-15 16:11:09 -04:00
Ed_
0f62eaff6d fix(gui): hide empty text edit input in discussion history when entry is standalone monologue 2026-03-15 16:03:54 -04:00
Ed_
5285bc68f9 fix(gui): fix missing token stats and improve standalone monologue rendering 2026-03-15 15:57:08 -04:00
Ed_
226ffdbd2a latest changes 2026-03-14 12:26:16 -04:00
Ed_
6594a50e4e fix(gui): skip empty content rendering in Discussion Hub; add token usage to comms history 2026-03-14 09:49:26 -04:00
Ed_
1a305ee614 fix(gui): push AI monologue/text chunks to discussion history immediately per round instead of accumulating 2026-03-14 09:35:41 -04:00
Ed_
81ded98198 fix(gui): do not auto-add tool calls/results to discussion history if ui_auto_add_history is false 2026-03-14 09:26:54 -04:00
Ed_
b85b7d9700 fix(gui): fix incompatible collapsing_header argument when rendering thinking trace 2026-03-14 09:21:44 -04:00
Ed_
3d0c40de45 fix(gui): parse thinking traces out of response text before rendering in history and comms panels 2026-03-14 09:19:47 -04:00
Ed_
47c5100ec5 fix(gui): render thinking trace in both read and edit modes consistently 2026-03-14 09:09:43 -04:00
Ed_
bc00fe1197 fix(gui): Move thinking trace rendering BEFORE response - now hidden by default 2026-03-13 23:15:20 -04:00
Ed_
9515dee44d feat(gui): Extract and display thinking traces from AI responses 2026-03-13 23:09:29 -04:00
Ed_
13199a0008 fix(gui): Properly add thinking trace without breaking _render_selectable_label 2026-03-13 23:05:27 -04:00
Ed_
45c9e15a3c fix: Mark thinking trace track as complete in tracks.md 2026-03-13 22:36:13 -04:00
Ed_
d18eabdf4d fix(gui): Add push_id to _render_selectable_label; finalize track 2026-03-13 22:35:47 -04:00
Ed_
9fb8b5757f fix(gui): Add push_id to _render_selectable_label for proper ID stack 2026-03-13 22:34:31 -04:00
Ed_
e30cbb5047 fix: Revert to stable gui_2.py version 2026-03-13 22:33:09 -04:00
Ed_
017a52a90a fix(gui): Restore _render_selectable_label with proper push_id 2026-03-13 22:17:43 -04:00
Ed_
71269ceb97 feat(thinking): Phase 4 complete - tinted bg, Monologue header, gold text 2026-03-13 22:09:09 -04:00
Ed_
0b33cbe023 fix: Mark track as complete in tracks.md 2026-03-13 22:08:25 -04:00
Ed_
1164aefffa feat(thinking): Complete track - all phases done 2026-03-13 22:07:56 -04:00
Ed_
1ad146b38e feat(gui): Add _render_thinking_trace helper and integrate into Discussion Hub 2026-03-13 22:07:13 -04:00
Ed_
084f9429af fix: Update test to match current implementation state 2026-03-13 22:03:19 -04:00
Ed_
95e6413017 feat(thinking): Phases 1-2 complete - parser, model, tests 2026-03-13 22:02:34 -04:00
Ed_
fc7b491f78 test: Add thinking persistence tests; Phase 2 complete 2026-03-13 21:56:35 -04:00
Ed_
44a1d76dc7 feat(thinking): Phase 1 complete - parser, model, tests 2026-03-13 21:55:29 -04:00
Ed_
ea7b3ae3ae test: Add thinking trace parsing tests 2026-03-13 21:53:17 -04:00
Ed_
c5a406eff8 feat(track): Start thinking trace handling track 2026-03-13 21:49:40 -04:00
Ed_
c15f38fb09 marking already done frame done 2026-03-13 21:48:45 -04:00
Ed_
645f71d674 FUCK FROSTED GLASS 2026-03-13 21:47:57 -04:00
30 changed files with 837 additions and 931 deletions

View File

@@ -0,0 +1,26 @@
# Implementation Plan: Frosted Glass Background Effect
## Phase 1: Shader Development & Integration
- [ ] Task: Audit `src/shader_manager.py` to identify existing background/post-process integration points.
- [ ] Task: Write Tests: Verify `ShaderManager` can compile and bind a multi-pass blur shader.
- [ ] Task: Implement: Add `FrostedGlassShader` (GLSL) to `src/shader_manager.py`.
- [ ] Task: Implement: Integrate the blur shader into the `ShaderManager` lifecycle.
- [ ] Task: Conductor - User Manual Verification 'Phase 1: Shader Development & Integration' (Protocol in workflow.md)
## Phase 2: Framebuffer Capture Pipeline
- [ ] Task: Write Tests: Verify the FBO capture mechanism correctly samples the back buffer and stores it in a texture.
- [ ] Task: Implement: Update `src/shader_manager.py` or `src/gui_2.py` to handle "pre-rendering" of the background into a texture for blurring.
- [ ] Task: Implement: Ensure the blurred texture is updated every frame or on window move events.
- [ ] Task: Conductor - User Manual Verification 'Phase 2: Framebuffer Capture Pipeline' (Protocol in workflow.md)
## Phase 3: GUI Integration & Rendering
- [ ] Task: Write Tests: Verify that a mocked ImGui window successfully calls the frosted glass rendering logic.
- [ ] Task: Implement: Create a `_render_frosted_background(self, pos, size)` helper in `src/gui_2.py`.
- [ ] Task: Implement: Update panel rendering loops (e.g. `_gui_func`) to inject the frosted background before calling `imgui.begin()` for major panels.
- [ ] Task: Conductor - User Manual Verification 'Phase 3: GUI Integration & Rendering' (Protocol in workflow.md)
## Phase 4: UI Controls & Configuration
- [ ] Task: Write Tests: Verify that modifying blur uniforms via the Live Editor updates the shader state.
- [ ] Task: Implement: Add "Frosted Glass" sliders (Blur, Tint, Opacity) to the **Shader Editor** in `src/gui_2.py`.
- [ ] Task: Implement: Update `src/theme.py` to parse and store frosted glass settings from `config.toml`.
- [ ] Task: Conductor - User Manual Verification 'Phase 4: UI Controls & Configuration' (Protocol in workflow.md)

View File

@@ -66,7 +66,7 @@ For deep implementation details when planning or implementing tracks, consult `d
- **Clean Project Root:** Enforces a "Cruft-Free Root" policy by organizing core implementation into a `src/` directory and redirecting all temporary test data, configurations, and AI-generated artifacts to `tests/artifacts/`.
- **Performance Diagnostics:** Comprehensive, conditional per-component profiling across the entire application. Features a dedicated **Diagnostics Panel** providing real-time telemetry for FPS, Frame Time, CPU usage, and **Detailed Component Timings** for all GUI panels and background threads, including automated threshold-based latency alerts.
- **Automated UX Verification:** A robust IPC mechanism via API hooks and a modular simulation suite allows for human-like simulation walkthroughs and automated regression testing of the full GUI lifecycle across multiple specialized scenarios.
- **Professional UI Theme & Typography:** Implements a high-fidelity visual system featuring **Inter** and **Maple Mono** fonts for optimal readability. Employs a cohesive \"Subtle Rounding\" aesthetic across all standard widgets, supported by custom **soft shadow shaders** for modals and popups, and a high-fidelity **frosted glass (acrylic) background effect** for panels to provide depth and professional polish. Includes a selectable **NERV UI theme** featuring a \"Black Void\" palette, zero-rounding geometry, and CRT-style visual effects (scanlines, status flickering).
- **Professional UI Theme & Typography:** Implements a high-fidelity visual system featuring **Inter** and **Maple Mono** fonts for optimal readability. Employs a cohesive "Subtle Rounding" aesthetic across all standard widgets, supported by custom **soft shadow shaders** for modals and popups to provide depth and professional polish. Includes a selectable **NERV UI theme** featuring a "Black Void" palette, zero-rounding geometry, and CRT-style visual effects (scanlines, status flickering).
- **Rich Text & Syntax Highlighting:** Provides advanced rendering for messages, logs, and tool outputs using a hybrid Markdown system. Supports GitHub-Flavored Markdown (GFM) via `imgui_markdown` and integrates `ImGuiColorTextEdit` for high-performance syntax highlighting of code blocks (Python, JSON, C++, etc.). Includes automated language detection and clickable URL support.
- **Multi-Viewport & Layout Management:** Full support for ImGui Multi-Viewport, allowing users to detach panels into standalone OS windows for complex multi-monitor workflows. Includes a comprehensive **Layout Presets system**, enabling developers to save, name, and instantly restore custom window arrangements, including their Multi-Viewport state.
- **Headless Backend Service & Hook API:** Optional headless mode allowing the core AI and tool execution logic to run as a decoupled service. Features a comprehensive Hook API and WebSocket event streaming for remote orchestration, deep state inspection, and manual worker lifecycle management.

View File

@@ -70,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.
- **Hybrid Shader Pipeline:** Utilizes an optimized `ImDrawList`-based batching technique to simulate UI effects such as soft shadows 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), dynamic backgrounds, and high-fidelity **frosted glass (acrylic) blurring** of the GUI panels via multi-pass Gaussian/Kawase filtering.
- **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.

View File

@@ -35,8 +35,8 @@ This file tracks all major tracks for the project. Each track has its own detail
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/)*
8. [x] **Track: Rich Thinking Trace Handling** - *Parse and display AI thinking/reasoning traces*
*Link: [./tracks/thinking_trace_handling_20260313/](./tracks/thinking_trace_handling_20260313/)*
---
@@ -60,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. [x] **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**
@@ -79,12 +79,9 @@ 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**
11. [x] **Track: Advanced Text Viewer with Syntax Highlighting**
*Link: [./tracks/text_viewer_rich_rendering_20260313/](./tracks/text_viewer_rich_rendering_20260313/)*
12. [x] **Track: Frosted Glass Background Effect**
*Link: [./tracks/frosted_glass_20260313/](./tracks/frosted_glass_20260313/)*
---
### Additional Language Support
@@ -164,6 +161,10 @@ This file tracks all major tracks for the project. Each track has its own detail
### Completed / Archived
-. [ ] ~~**Track: Frosted Glass Background Effect**~~ ***NOT WORTH THE PAIN***
*Link: [./tracks/frosted_glass_20260313/](./tracks/frosted_glass_20260313/)*
- [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)

View File

@@ -1,26 +0,0 @@
# Implementation Plan: Frosted Glass Background Effect
## Phase 1: Shader Development & Integration [checkpoint: 55f3bd8]
- [x] Task: Audit `src/shader_manager.py` to identify existing background/post-process integration points. [1328bc1]
- [x] Task: Write Tests: Verify `ShaderManager` can compile and bind a multi-pass blur shader. [1328bc1]
- [x] Task: Implement: Add `FrostedGlassShader` (GLSL) to `src/shader_manager.py`. [1328bc1]
- [x] Task: Implement: Integrate the blur shader into the `ShaderManager` lifecycle. [1328bc1]
- [x] Task: Conductor - User Manual Verification 'Phase 1: Shader Development & Integration' (Protocol in workflow.md) [55f3bd8]
## Phase 2: Framebuffer Capture Pipeline [checkpoint: e9b7875]
- [x] Task: Write Tests: Verify the FBO capture mechanism correctly samples the back buffer and stores it in a texture. [f297e7a]
- [x] Task: Implement: Update `src/shader_manager.py` or `src/gui_2.py` to handle "pre-rendering" of the background into a texture for blurring. [f297e7a]
- [x] Task: Implement: Ensure the blurred texture is updated every frame or on window move events. [f297e7a]
- [x] Task: Conductor - User Manual Verification 'Phase 2: Framebuffer Capture Pipeline' (Protocol in workflow.md) [e9b7875]
## Phase 3: GUI Integration & Rendering [checkpoint: cecbe22]
- [x] Task: Write Tests: Verify that a mocked ImGui window successfully calls the frosted glass rendering logic. [cecbe22]
- [x] Task: Implement: Create a `_render_frosted_background(self, pos, size)` helper in `src/gui_2.py`. [cecbe22]
- [x] Task: Implement: Update panel rendering loops (e.g. `_gui_func`) to inject the frosted background before calling `imgui.begin()` for major panels. [cecbe22]
- [x] Task: Conductor - User Manual Verification 'Phase 3: GUI Integration & Rendering' (Protocol in workflow.md) [cecbe22]
## Phase 4: UI Controls & Configuration [checkpoint: cecbe22]
- [x] Task: Write Tests: Verify that modifying blur uniforms via the Live Editor updates the shader state. [cecbe22]
- [x] Task: Implement: Add "Frosted Glass" sliders (Blur, Tint, Opacity) to the **Shader Editor** in `src/gui_2.py`. [cecbe22]
- [x] Task: Implement: Update `src/theme.py` to parse and store frosted glass settings from `config.toml`. [cecbe22]
- [x] Task: Conductor - User Manual Verification 'Phase 4: UI Controls & Configuration' (Protocol in workflow.md) [cecbe22]

View File

@@ -1,29 +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)
- [x] Task: Audit `src/gui_2.py` to ensure all `text_viewer_*` state variables are explicitly initialized in `App.__init__`. e28af48
- [x] 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"). e28af48
- [x] Task: Implement: Update `self.text_viewer_wrap` (defaulting to True) to allow independent word wrap. e28af48
- [x] Task: Implement: Update `_render_text_viewer(self, label: str, content: str, text_type: str = "text")` signature and caller usage. e28af48
- [x] Task: Conductor - User Manual Verification 'Phase 1: State & Interface Update' (Protocol in workflow.md) e28af48
## 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)
- [x] 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`. a91b8dc
- [x] Task: Implement: In `src/gui_2.py`, refactor the text viewer window loop to: a91b8dc
- Use `MarkdownRenderer.render` if `text_type == "markdown"`. a91b8dc
- Use a cached `ImGuiColorTextEdit.TextEditor` if `text_type` matches a code language. a91b8dc
- Fallback to `imgui.input_text_multiline` for plain text. a91b8dc
- [x] Task: Implement: Ensure the `TextEditor` instance is properly cached using a unique key for the text viewer to maintain state. a91b8dc
- [x] Task: Conductor - User Manual Verification 'Phase 2: Core Rendering Logic' (Protocol in workflow.md) a91b8dc
## 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)
- [x] Task: Write Tests: Update `tests/test_gui_text_viewer.py` to verify the copy-to-clipboard functionality and word wrap toggle. a91b8dc
- [x] Task: Implement: Add a "Copy" button to the text viewer title bar or a small toolbar at the top of the window. a91b8dc
- [x] Task: Implement: Add a "Word Wrap" checkbox inside the text viewer window. a91b8dc
- [x] Task: Implement: Configure the `TextEditor` instance to show line numbers and be read-only. a91b8dc
- [x] Task: Conductor - User Manual Verification 'Phase 3: UI Features' (Protocol in workflow.md) a91b8dc
## 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)
- [x] 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. 2826ad5
- [x] Task: Implement: Add "Markdown Preview" support for system prompt presets using the new text viewer logic. 2826ad5
- [x] Task: Conductor - User Manual Verification 'Phase 4: Integration & Rollout' (Protocol in workflow.md) 2826ad5

View File

@@ -1,26 +1,23 @@
# 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)
## Status: COMPLETE (2026-03-14)
## 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)
## Summary
Implemented thinking trace parsing, model, persistence, and GUI rendering for AI responses containing `<thinking>`, `<thought>`, and `Thinking:` markers.
## 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)
## Files Created/Modified:
- `src/thinking_parser.py` - Parser for thinking traces
- `src/models.py` - ThinkingSegment model
- `src/gui_2.py` - _render_thinking_trace helper + integration
- `tests/test_thinking_trace.py` - 7 parsing tests
- `tests/test_thinking_persistence.py` - 4 persistence tests
- `tests/test_thinking_gui.py` - 4 GUI tests
## 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)
## Implementation Details:
- **Parser**: Extracts thinking segments from `<thinking>`, `<thought>`, `Thinking:` markers
- **Model**: `ThinkingSegment` dataclass with content and marker fields
- **GUI**: `_render_thinking_trace` with collapsible "Monologue" header
- **Styling**: Tinted background (dark brown), gold/amber text
- **Indicator**: Existing "THINKING..." in Discussion Hub
## Total Tests: 15 passing

View File

@@ -23,23 +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 = false
bg_shader_enabled = true
crt_filter_enabled = false
separate_task_dag = false
separate_usage_analytics = true
separate_usage_analytics = false
separate_tier1 = false
separate_tier2 = false
separate_tier3 = false
separate_tier4 = false
separate_external_tools = true
separate_external_tools = false
[gui.show_windows]
"Context Hub" = true
"Files & Media" = true
"AI Settings" = true
"MMA Dashboard" = true
"MMA Dashboard" = false
"Task DAG" = false
"Usage Analytics" = true
"Usage Analytics" = false
"Tier 1" = false
"Tier 2" = false
"Tier 3" = false
@@ -51,25 +51,21 @@ separate_external_tools = true
"Discussion Hub" = true
"Operations Hub" = true
Message = false
Response = true
"Tool Calls" = true
Response = false
"Tool Calls" = false
Theme = true
"Log Management" = true
"Log Management" = false
Diagnostics = false
"External Tools" = false
"Shader Editor" = true
"Shader Editor" = false
[theme]
palette = "Nord Dark"
font_path = "C:/projects/manual_slop/assets/fonts/MapleMono-Regular.ttf"
font_size = 16.0
font_size = 18.0
scale = 1.0
transparency = 0.699999988079071
child_transparency = 0.6899999976158142
frosted_blur_radius = 29.68400001525879
frosted_tint_intensity = 0.5659999847412109
frosted_opacity = 0.5389999747276306
frosted_glass_enabled = true
transparency = 1.0
child_transparency = 1.0
[mma]
max_workers = 4

View File

@@ -12,7 +12,7 @@ ViewportPos=43,95
ViewportId=0x78C57832
Size=897,649
Collapsed=0
DockId=0x00000005,0
DockId=0x00000001,0
[Window][Files]
ViewportPos=3125,170
@@ -33,7 +33,7 @@ DockId=0x0000000A,0
Pos=0,17
Size=1680,730
Collapsed=0
DockId=0x00000005,0
DockId=0x00000001,0
[Window][Provider]
ViewportPos=43,95
@@ -41,22 +41,23 @@ ViewportId=0x78C57832
Pos=0,651
Size=897,468
Collapsed=0
DockId=0x00000005,0
DockId=0x00000001,0
[Window][Message]
Pos=661,1321
Pos=661,1426
Size=716,455
Collapsed=0
[Window][Response]
Pos=2437,925
Size=1111,773
Pos=2258,1377
Size=1102,575
Collapsed=0
[Window][Tool Calls]
Pos=1039,464
Size=587,510
Pos=520,1144
Size=663,232
Collapsed=0
DockId=0x00000006,0
[Window][Comms History]
ViewportPos=43,95
@@ -73,10 +74,10 @@ Collapsed=0
DockId=0xAFC85805,2
[Window][Theme]
Pos=2671,24
Size=1169,2136
Pos=0,1423
Size=579,737
Collapsed=0
DockId=0x00000002,1
DockId=0x00000002,2
[Window][Text Viewer - Entry #7]
Pos=379,324
@@ -87,13 +88,13 @@ Collapsed=0
Pos=1649,24
Size=580,1284
Collapsed=0
DockId=0x00000004,2
DockId=0x00000010,2
[Window][Context Hub]
Pos=0,1719
Size=999,441
Pos=0,1423
Size=579,737
Collapsed=0
DockId=0x00000006,0
DockId=0x00000002,1
[Window][AI Settings Hub]
Pos=406,17
@@ -102,45 +103,45 @@ Collapsed=0
DockId=0x0000000D,0
[Window][Discussion Hub]
Pos=1762,24
Size=907,2136
Pos=2230,26
Size=1610,2134
Collapsed=0
DockId=0x00000011,0
DockId=0x00000013,0
[Window][Operations Hub]
Pos=1001,24
Size=759,2136
Collapsed=0
DockId=0x00000010,0
[Window][Files & Media]
Pos=0,1719
Size=999,441
Collapsed=0
DockId=0x00000006,1
[Window][AI Settings]
Pos=0,24
Size=999,1693
Pos=581,26
Size=1647,2134
Collapsed=0
DockId=0x00000005,0
[Window][Files & Media]
Pos=0,1423
Size=579,737
Collapsed=0
DockId=0x00000002,0
[Window][AI Settings]
Pos=0,26
Size=579,1395
Collapsed=0
DockId=0x00000001,0
[Window][Approve Tool Execution]
Pos=3,524
Size=416,325
Collapsed=0
[Window][MMA Dashboard]
Pos=2671,24
Size=1169,2136
Pos=3360,26
Size=480,2134
Collapsed=0
DockId=0x00000002,0
DockId=0x00000010,0
[Window][Log Management]
Pos=1931,24
Size=629,1416
Pos=3360,26
Size=480,2134
Collapsed=0
DockId=0x00000002,1
DockId=0x00000010,0
[Window][Track Proposal]
Pos=709,326
@@ -166,7 +167,7 @@ Collapsed=0
Pos=2822,1717
Size=1018,420
Collapsed=0
DockId=0x00000004,0
DockId=0x0000000C,0
[Window][Approve PowerShell Command]
Pos=649,435
@@ -174,7 +175,7 @@ Size=381,329
Collapsed=0
[Window][Last Script Output]
Pos=2810,265
Pos=927,1365
Size=800,562
Collapsed=0
@@ -209,7 +210,7 @@ Size=3840,32
Collapsed=0
[Window][Text Viewer - message]
Pos=562,588
Pos=568,1226
Size=900,700
Collapsed=0
@@ -219,7 +220,7 @@ Size=900,700
Collapsed=0
[Window][Text Viewer - text]
Pos=555,644
Pos=1297,550
Size=900,700
Collapsed=0
@@ -239,7 +240,7 @@ Size=900,700
Collapsed=0
[Window][Text Viewer - tool_calls]
Pos=589,490
Pos=60,60
Size=900,700
Collapsed=0
@@ -329,9 +330,10 @@ Size=967,499
Collapsed=0
[Window][Usage Analytics]
Pos=1702,689
Size=566,438
Pos=1739,1107
Size=586,269
Collapsed=0
DockId=0x0000000F,0
[Window][Tool Preset Manager]
Pos=1301,302
@@ -364,7 +366,7 @@ Size=900,700
Collapsed=0
[Window][Text Viewer - Entry #4]
Pos=828,397
Pos=1247,1182
Size=900,700
Collapsed=0
@@ -379,13 +381,8 @@ Size=900,700
Collapsed=0
[Window][Shader Editor]
Pos=753,637
Size=493,487
Collapsed=0
[Window][Text Viewer - list_directory]
Pos=60,60
Size=900,700
Pos=457,710
Size=493,252
Collapsed=0
[Table][0xFB6E3870,4]
@@ -445,7 +442,7 @@ Column 3 Width=120
RefScale=16
Column 0 Width=48
Column 1 Weight=1.0000
Column 2 Width=117
Column 2 Width=118
Column 3 Width=48
[Table][0xD99F45C5,4]
@@ -501,19 +498,23 @@ Column 1 Weight=1.0000
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,24 Size=3840,2136 Split=X
DockNode ID=0x00000003 Parent=0xAFC85805 SizeRef=1617,1183 Split=X
DockSpace ID=0xAFC85805 Window=0x079D3A04 Pos=0,26 Size=3840,2134 Split=X
DockNode ID=0x00000003 Parent=0xAFC85805 SizeRef=3358,1183 Split=X
DockNode ID=0x0000000B Parent=0x00000003 SizeRef=404,1186 Split=X Selected=0xF4139CA2
DockNode ID=0x00000007 Parent=0x0000000B SizeRef=999,858 Split=Y Selected=0x7BD57D6A
DockNode ID=0x00000005 Parent=0x00000007 SizeRef=639,904 CentralNode=1 Selected=0x7BD57D6A
DockNode ID=0x00000006 Parent=0x00000007 SizeRef=639,441 Selected=0x1DCB2623
DockNode ID=0x0000000E Parent=0x0000000B SizeRef=2839,858 Split=X Selected=0x418C7449
DockNode ID=0x00000001 Parent=0x0000000E SizeRef=1668,1288 Split=X Selected=0x6F2B5B04
DockNode ID=0x00000010 Parent=0x00000001 SizeRef=759,1416 Selected=0x418C7449
DockNode ID=0x00000011 Parent=0x00000001 SizeRef=907,1416 Selected=0x6F2B5B04
DockNode ID=0x00000002 Parent=0x0000000E SizeRef=1169,1288 Selected=0x8CA2375C
DockNode ID=0x00000007 Parent=0x0000000B SizeRef=579,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=3259,858 Split=X Selected=0x418C7449
DockNode ID=0x00000012 Parent=0x0000000E SizeRef=1647,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=1610,402 Selected=0x6F2B5B04
DockNode ID=0x0000000D Parent=0x00000003 SizeRef=435,1186 Selected=0x363E93D6
DockNode ID=0x00000004 Parent=0xAFC85805 SizeRef=511,1183 Selected=0x3AEC3498
DockNode ID=0x00000004 Parent=0xAFC85805 SizeRef=480,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
;;;<<<Layout_655921752_Default>>>;;;
;;;<<<HelloImGui_Misc>>>;;;

View File

@@ -225,6 +225,9 @@ class HookHandler(BaseHTTPRequestHandler):
for key, attr in gettable.items():
val = _get_app_attr(app, attr, None)
result[key] = _serialize_for_api(val)
result['show_text_viewer'] = _get_app_attr(app, 'show_text_viewer', False)
result['text_viewer_title'] = _get_app_attr(app, 'text_viewer_title', '')
result['text_viewer_type'] = _get_app_attr(app, 'text_viewer_type', 'markdown')
finally: event.set()
lock = _get_app_attr(app, "_pending_gui_tasks_lock")
tasks = _get_app_attr(app, "_pending_gui_tasks")

View File

@@ -25,6 +25,7 @@ from src import project_manager
from src import performance_monitor
from src import models
from src import presets
from src import thinking_parser
from src.file_cache import ASTParser
from src import ai_client
from src import shell_runner
@@ -251,6 +252,7 @@ class AppController:
self.show_text_viewer: bool = False
self.text_viewer_title: str = ''
self.text_viewer_content: str = ''
self.text_viewer_type: str = 'text'
self._pending_comms: List[Dict[str, Any]] = []
self._pending_tool_calls: List[Dict[str, Any]] = []
self._pending_history_adds: List[Dict[str, Any]] = []
@@ -374,7 +376,10 @@ class AppController:
'ui_separate_tier1': 'ui_separate_tier1',
'ui_separate_tier2': 'ui_separate_tier2',
'ui_separate_tier3': 'ui_separate_tier3',
'ui_separate_tier4': 'ui_separate_tier4'
'ui_separate_tier4': 'ui_separate_tier4',
'show_text_viewer': 'show_text_viewer',
'text_viewer_title': 'text_viewer_title',
'text_viewer_type': 'text_viewer_type'
}
self._gettable_fields = dict(self._settable_fields)
self._gettable_fields.update({
@@ -421,7 +426,10 @@ class AppController:
'ui_separate_tier1': 'ui_separate_tier1',
'ui_separate_tier2': 'ui_separate_tier2',
'ui_separate_tier3': 'ui_separate_tier3',
'ui_separate_tier4': 'ui_separate_tier4'
'ui_separate_tier4': 'ui_separate_tier4',
'show_text_viewer': 'show_text_viewer',
'text_viewer_title': 'text_viewer_title',
'text_viewer_type': 'text_viewer_type'
})
self.perf_monitor = performance_monitor.get_monitor()
self._perf_profiling_enabled = False
@@ -610,16 +618,6 @@ class AppController:
self._token_stats_dirty = True
if not is_streaming:
self._autofocus_response_tab = True
# ONLY add to history when turn is complete
if self.ui_auto_add_history and not stream_id and not is_streaming:
role = payload.get("role", "AI")
with self._pending_history_adds_lock:
self._pending_history_adds.append({
"role": role,
"content": self.ai_response,
"collapsed": True,
"ts": project_manager.now_ts()
})
elif action in ("mma_stream", "mma_stream_append"):
# Some events might have these at top level, some in a 'payload' dict
stream_id = task.get("stream_id") or task.get("payload", {}).get("stream_id")
@@ -1467,9 +1465,22 @@ class AppController:
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 u:
self.session_usage[k] += u.get(k, 0) or 0
inp = u.get("input_tokens", u.get("prompt_tokens", 0))
out = u.get("output_tokens", u.get("completion_tokens", 0))
cache_read = u.get("cache_read_input_tokens", 0)
cache_create = u.get("cache_creation_input_tokens", 0)
total = u.get("total_tokens", 0)
# Store normalized usage back in payload for history rendering
u["input_tokens"] = inp
u["output_tokens"] = out
u["cache_read_input_tokens"] = cache_read
self.session_usage["input_tokens"] += inp
self.session_usage["output_tokens"] += out
self.session_usage["cache_read_input_tokens"] += cache_read
self.session_usage["cache_creation_input_tokens"] += cache_create
self.session_usage["total_tokens"] += total
input_t = u.get("input_tokens", 0)
output_t = u.get("output_tokens", 0)
model = payload.get("model", "unknown")
@@ -1490,22 +1501,42 @@ class AppController:
"ts": entry.get("ts", project_manager.now_ts())
})
if kind in ("tool_result", "tool_call"):
role = "Tool" if kind == "tool_result" else "Vendor API"
content = ""
if kind == "tool_result":
content = payload.get("output", "")
else:
content = payload.get("script") or payload.get("args") or payload.get("message", "")
if isinstance(content, dict):
content = json.dumps(content, indent=1)
with self._pending_history_adds_lock:
self._pending_history_adds.append({
if kind == "response":
if self.ui_auto_add_history:
role = payload.get("role", "AI")
text_content = payload.get("text", "")
if text_content.strip():
segments, parsed_response = thinking_parser.parse_thinking_trace(text_content)
entry_obj = {
"role": role,
"content": f"[{kind.upper().replace('_', ' ')}]\n{content}",
"content": parsed_response.strip() if parsed_response else "",
"collapsed": True,
"ts": entry.get("ts", project_manager.now_ts())
})
}
if segments:
entry_obj["thinking_segments"] = [{"content": s.content, "marker": s.marker} for s in segments]
if entry_obj["content"] or segments:
with self._pending_history_adds_lock:
self._pending_history_adds.append(entry_obj)
if kind in ("tool_result", "tool_call"):
if self.ui_auto_add_history:
role = "Tool" if kind == "tool_result" else "Vendor API"
content = ""
if kind == "tool_result":
content = payload.get("output", "")
else:
content = payload.get("script") or payload.get("args") or payload.get("message", "")
if isinstance(content, dict):
content = json.dumps(content, indent=1)
with self._pending_history_adds_lock:
self._pending_history_adds.append({
"role": role,
"content": f"[{kind.upper().replace('_', ' ')}]\n{content}",
"collapsed": True,
"ts": entry.get("ts", project_manager.now_ts())
})
if kind == "history_add":
payload = entry.get("payload", {})
with self._pending_history_adds_lock:

View File

@@ -21,7 +21,6 @@ from src import theme_2 as theme
from src import theme_nerv_fx as theme_fx
from src import api_hooks
import numpy as np
import OpenGL.GL as gl
from src import log_registry
from src import log_pruner
from src import models
@@ -29,7 +28,8 @@ from src import app_controller
from src import mcp_client
from src import markdown_helper
from src import bg_shader
from src.shader_manager import ShaderManager
from src import thinking_parser
from src import thinking_parser
import re
import subprocess
if sys.platform == "win32":
@@ -40,7 +40,7 @@ else:
win32con = None
from pydantic import BaseModel
from imgui_bundle import imgui, hello_imgui, immapp, imgui_node_editor as ed
from imgui_bundle import imgui, hello_imgui, immapp, imgui_node_editor as ed, imgui_color_text_edit as ced
PROVIDERS: list[str] = ["gemini", "anthropic", "gemini_cli", "deepseek", "minimax"]
COMMS_CLAMP_CHARS: int = 300
@@ -107,9 +107,16 @@ class App:
self.controller.init_state()
self.show_windows.setdefault("Diagnostics", False)
self.controller.start_services(self)
self.controller._predefined_callbacks['_render_text_viewer'] = self._render_text_viewer
self.show_preset_manager_window = False
self.show_tool_preset_manager_window = False
self.show_persona_editor_window = False
self.show_text_viewer = False
self.text_viewer_title = ''
self.text_viewer_content = ''
self.text_viewer_type = 'text'
self.text_viewer_wrap = True
self._text_viewer_editor: Optional[ced.TextEditor] = None
self.ui_active_tool_preset = ""
self.ui_active_bias_profile = ""
self.ui_active_persona = ""
@@ -213,17 +220,7 @@ class App:
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,
'frosted_blur_radius': theme.get_frosted_blur_radius(),
'frosted_tint_intensity': theme.get_frosted_tint_intensity(),
'frosted_opacity': theme.get_frosted_opacity()
}
self.shader_manager = ShaderManager()
self.start_time = time.time()
self.shader_uniforms = {'crt': 1.0, 'scanline': 0.5, 'bloom': 0.8}
def _handle_approve_tool(self, user_data=None) -> None:
"""UI-level wrapper for approving a pending tool execution ask."""
@@ -291,8 +288,9 @@ class App:
f.write(data)
# ---------------------------------------------------------------- helpers
def _render_text_viewer(self, label: str, content: str) -> None:
if imgui.button("[+]##" + str(id(content))):
def _render_text_viewer(self, label: str, content: str, text_type: str = 'text', force_open: bool = False) -> None:
self.text_viewer_type = text_type
if imgui.button("[+]##" + str(id(content))) or force_open:
self.show_text_viewer = True
self.text_viewer_title = label
self.text_viewer_content = content
@@ -302,6 +300,7 @@ class App:
imgui.same_line()
if imgui.button("[+]##" + label + id_suffix):
self.show_text_viewer = True
self.text_viewer_type = 'markdown' if label in ('message', 'text', 'content', 'system') else 'json' if label in ('tool_calls', 'data') else 'powershell' if label == 'script' else 'text'
self.text_viewer_title = label
self.text_viewer_content = content
@@ -316,21 +315,57 @@ class App:
if is_nerv: imgui.push_style_color(imgui.Col_.text, vec4(80, 255, 80))
if len(content) > COMMS_CLAMP_CHARS:
imgui.begin_child(f"heavy_text_child_{label}_{id_suffix}", imgui.ImVec2(0, 80), True)
if is_md:
imgui.begin_child(f"heavy_text_child_{label}_{id_suffix}", imgui.ImVec2(0, 180), True, imgui.WindowFlags_.always_vertical_scrollbar)
markdown_helper.render(content, context_id=ctx_id)
imgui.end_child()
else:
markdown_helper.render_code(content, context_id=ctx_id)
imgui.end_child()
imgui.input_text_multiline(f"##heavy_text_input_{label}_{id_suffix}", content, imgui.ImVec2(-1, 180), imgui.InputTextFlags_.read_only)
else:
if is_md:
markdown_helper.render(content, context_id=ctx_id)
else:
markdown_helper.render_code(content, context_id=ctx_id)
if self.ui_word_wrap:
imgui.push_text_wrap_pos(imgui.get_content_region_avail().x)
imgui.text(content)
imgui.pop_text_wrap_pos()
else:
imgui.text(content)
if is_nerv: imgui.pop_style_color()
# ---------------------------------------------------------------- gui
def _render_thinking_trace(self, segments: list[dict], entry_index: int, is_standalone: bool = False) -> None:
if not segments:
return
imgui.push_style_color(imgui.Col_.child_bg, vec4(40, 35, 25, 180))
imgui.push_style_color(imgui.Col_.text, vec4(200, 200, 150))
imgui.indent()
show_content = True
if not is_standalone:
header_label = f"Monologue ({len(segments)} traces)###thinking_header_{entry_index}"
show_content = imgui.collapsing_header(header_label)
if show_content:
h = 150 if is_standalone else 100
imgui.begin_child(f"thinking_content_{entry_index}", imgui.ImVec2(0, h), True)
for idx, seg in enumerate(segments):
content = seg.get("content", "")
marker = seg.get("marker", "thinking")
imgui.push_id(f"think_{entry_index}_{idx}")
imgui.text_colored(vec4(180, 150, 80), f"[{marker}]")
if self.ui_word_wrap:
imgui.push_text_wrap_pos(imgui.get_content_region_avail().x)
imgui.text_colored(vec4(200, 200, 150), content)
imgui.pop_text_wrap_pos()
else:
imgui.text_colored(vec4(200, 200, 150), content)
imgui.pop_id()
imgui.separator()
imgui.end_child()
imgui.unindent()
imgui.pop_style_color(2)
def _render_selectable_label(self, label: str, value: str, width: float = 0.0, multiline: bool = False, height: float = 0.0, color: Optional[imgui.ImVec4] = None) -> None:
imgui.push_id(label + str(hash(value)))
@@ -353,111 +388,6 @@ class App:
imgui.pop_style_var(2)
imgui.pop_id()
def _render_frosted_background(self, pos: imgui.ImVec2, size: imgui.ImVec2) -> None:
if not theme.get_frosted_glass_enabled(): return
if size.x <= 0 or size.y <= 0: return
try:
ws = immapp.get_window_size()
display_size = imgui.ImVec2(float(ws[0]), float(ws[1]))
except Exception:
display_size = imgui.get_io().display_size
if display_size.x <= 0 or display_size.y <= 0: return
uv_min = imgui.ImVec2(pos.x / display_size.x, 1.0 - pos.y / display_size.y)
uv_max = imgui.ImVec2((pos.x + size.x) / display_size.x, 1.0 - (pos.y + size.y) / display_size.y)
if self.shader_manager.blur_tex:
imgui.get_window_draw_list().add_image(
imgui.ImTextureRef(self.shader_manager.blur_tex),
pos,
imgui.ImVec2(pos.x + size.x, pos.y + size.y),
uv_min,
uv_max
)
else:
# Fallback: semi-transparent rectangle to help debug visibility
imgui.get_window_draw_list().add_rect_filled(
pos,
imgui.ImVec2(pos.x + size.x, pos.y + size.y),
imgui.get_color_u32(vec4(30, 30, 40, 0.7))
)
# Increase contrast with a 0.2 alpha tint overlay
imgui.get_window_draw_list().add_rect_filled(
pos,
imgui.ImVec2(pos.x + size.x, pos.y + size.y),
imgui.get_color_u32(vec4(0, 0, 0, 0.2))
)
def _begin_window(self, name: str, p_open: Any = None, flags: int = 0) -> tuple[bool, Any]:
frosted = theme.get_frosted_glass_enabled()
if frosted:
imgui.push_style_color(imgui.Col_.window_bg, vec4(0, 0, 0, 0))
expanded, opened = imgui.begin(name, p_open, flags)
if expanded and frosted:
self._render_frosted_background(imgui.get_window_pos(), imgui.get_window_size())
return expanded, opened
def _end_window(self) -> None:
imgui.end()
if theme.get_frosted_glass_enabled():
imgui.pop_style_color()
def _render_operations_hub(self) -> None:
exp, opened = self._begin_window("Operations Hub", self.show_windows["Operations Hub"])
self.show_windows["Operations Hub"] = bool(opened)
if exp:
imgui.text("Focus Agent:")
imgui.same_line()
focus_label = self.ui_focus_agent or "All"
if imgui.begin_combo("##focus_agent", focus_label, imgui.ComboFlags_.width_fit_preview):
if imgui.selectable("All", self.ui_focus_agent is None)[0]:
self.ui_focus_agent = None
for tier in ["Tier 2", "Tier 3", "Tier 4"]:
if imgui.selectable(tier, self.ui_focus_agent == tier)[0]:
self.ui_focus_agent = tier
imgui.end_combo()
imgui.same_line()
if self.ui_focus_agent:
if imgui.button("x##clear_focus"):
self.ui_focus_agent = None
imgui.push_style_var(imgui.StyleVar_.item_spacing, imgui.ImVec2(10, 4))
ch1, self.ui_separate_tool_calls_panel = imgui.checkbox("Pop Out Tool Calls", self.ui_separate_tool_calls_panel)
if ch1: self.show_windows["Tool Calls"] = self.ui_separate_tool_calls_panel
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
show_usage_tab = not self.ui_separate_usage_analytics
if imgui.begin_tab_bar("ops_tabs"):
if imgui.begin_tab_item("Comms History")[0]:
self._render_comms_history_panel()
imgui.end_tab_item()
if show_tc_tab:
if imgui.begin_tab_item("Tool Calls")[0]:
self._render_tool_calls_panel()
imgui.end_tab_item()
if show_usage_tab:
if imgui.begin_tab_item("Usage Analytics")[0]:
self._render_usage_analytics_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()
self._end_window()
def _show_menus(self) -> None:
if imgui.begin_menu("manual slop"):
if imgui.menu_item("Quit", "Ctrl+Q", False)[0]:
@@ -557,55 +487,24 @@ class App:
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.separator()
imgui.text("Frosted Glass")
changed_fbr, self.shader_uniforms['frosted_blur_radius'] = imgui.slider_float('Blur Radius', self.shader_uniforms['frosted_blur_radius'], 0.0, 64.0)
if changed_fbr: theme.set_frosted_blur_radius(self.shader_uniforms['frosted_blur_radius'])
changed_fti, self.shader_uniforms['frosted_tint_intensity'] = imgui.slider_float('Tint Intensity', self.shader_uniforms['frosted_tint_intensity'], 0.0, 1.0)
if changed_fti: theme.set_frosted_tint_intensity(self.shader_uniforms['frosted_tint_intensity'])
changed_fo, self.shader_uniforms['frosted_opacity'] = imgui.slider_float('Frosted Opacity', self.shader_uniforms['frosted_opacity'], 0.0, 1.0)
if changed_fo: theme.set_frosted_opacity(self.shader_uniforms['frosted_opacity'])
imgui.end()
def _gui_func(self) -> None:
self._render_custom_title_bar()
self._render_shader_live_editor()
pushed_prior_tint = False
pushed_frosted_style = False
# Render background shader
bg = bg_shader.get_bg()
frosted_enabled = theme.get_frosted_glass_enabled()
if bg.enabled and not frosted_enabled:
if bg.enabled:
ws = imgui.get_io().display_size
bg.render(ws.x, ws.y)
if frosted_enabled:
ws = imgui.get_io().display_size
self.shader_manager.prepare_global_blur(
int(ws.x), int(ws.y),
self.shader_uniforms['frosted_blur_radius'],
self.shader_uniforms['frosted_tint_intensity'],
self.shader_uniforms['frosted_opacity'],
time.time()
)
# Draw background texture
dl = imgui.get_background_draw_list()
dl.add_image(imgui.ImTextureRef(self.shader_manager.scene_tex), (0, 0), (ws.x, ws.y))
imgui.push_style_color(imgui.Col_.window_bg, vec4(0, 0, 0, 0))
pushed_frosted_style = True
if theme.is_nerv_active():
ws = imgui.get_io().display_size
self._nerv_alert.update(self.ai_status)
self._nerv_alert.render(ws.x, ws.y)
self._nerv_crt.enabled = self.ui_crt_filter
self._nerv_crt.render(ws.x, ws.y)
if self.perf_profiling_enabled: self.perf_monitor.start_component("_gui_func")
if self.is_viewing_prior_session:
imgui.push_style_color(imgui.Col_.window_bg, vec4(50, 40, 20))
@@ -678,7 +577,7 @@ class App:
self._tool_log_dirty = False
if self.show_windows.get("Context Hub", False):
exp, opened = self._begin_window("Context Hub", self.show_windows["Context Hub"])
exp, opened = imgui.begin("Context Hub", self.show_windows["Context Hub"])
self.show_windows["Context Hub"] = bool(opened)
if exp:
if imgui.begin_tab_bar('context_hub_tabs'):
@@ -689,18 +588,18 @@ class App:
self._render_paths_panel()
imgui.end_tab_item()
imgui.end_tab_bar()
self._end_window()
imgui.end()
if self.show_windows.get("Files & Media", False):
exp, opened = self._begin_window("Files & Media", self.show_windows["Files & Media"])
exp, opened = imgui.begin("Files & Media", self.show_windows["Files & Media"])
self.show_windows["Files & Media"] = bool(opened)
if exp:
if imgui.collapsing_header("Files"):
self._render_files_panel()
if imgui.collapsing_header("Screenshots"):
self._render_screenshots_panel()
self._end_window()
imgui.end()
if self.show_windows.get("AI Settings", False):
exp, opened = self._begin_window("AI Settings", self.show_windows["AI Settings"])
exp, opened = imgui.begin("AI Settings", self.show_windows["AI Settings"])
self.show_windows["AI Settings"] = bool(opened)
if exp:
self._render_persona_selector_panel()
@@ -710,56 +609,56 @@ class App:
self._render_system_prompts_panel()
self._render_agent_tools_panel()
self._end_window()
imgui.end()
if self.ui_separate_usage_analytics and self.show_windows.get("Usage Analytics", False):
exp, opened = self._begin_window("Usage Analytics", self.show_windows["Usage Analytics"])
exp, opened = imgui.begin("Usage Analytics", self.show_windows["Usage Analytics"])
self.show_windows["Usage Analytics"] = bool(opened)
if exp:
self._render_usage_analytics_panel()
self._end_window()
imgui.end()
if self.show_windows.get("MMA Dashboard", False):
exp, opened = self._begin_window("MMA Dashboard", self.show_windows["MMA Dashboard"])
exp, opened = imgui.begin("MMA Dashboard", self.show_windows["MMA Dashboard"])
self.show_windows["MMA Dashboard"] = bool(opened)
if exp:
if self.perf_profiling_enabled: self.perf_monitor.start_component("_render_mma_dashboard")
self._render_mma_dashboard()
if self.perf_profiling_enabled: self.perf_monitor.end_component("_render_mma_dashboard")
self._end_window()
imgui.end()
if self.ui_separate_task_dag and self.show_windows.get("Task DAG", False):
exp, opened = self._begin_window("Task DAG", self.show_windows["Task DAG"])
exp, opened = imgui.begin("Task DAG", self.show_windows["Task DAG"])
self.show_windows["Task DAG"] = bool(opened)
if exp:
self._render_task_dag_panel()
self._end_window()
imgui.end()
if self.ui_separate_tier1 and self.show_windows.get("Tier 1: Strategy", False):
exp, opened = self._begin_window("Tier 1: Strategy", self.show_windows["Tier 1: Strategy"])
exp, opened = imgui.begin("Tier 1: Strategy", self.show_windows["Tier 1: Strategy"])
self.show_windows["Tier 1: Strategy"] = bool(opened)
if exp:
self._render_tier_stream_panel("Tier 1", "Tier 1")
self._end_window()
imgui.end()
if self.ui_separate_tier2 and self.show_windows.get("Tier 2: Tech Lead", False):
exp, opened = self._begin_window("Tier 2: Tech Lead", self.show_windows["Tier 2: Tech Lead"])
exp, opened = imgui.begin("Tier 2: Tech Lead", self.show_windows["Tier 2: Tech Lead"])
self.show_windows["Tier 2: Tech Lead"] = bool(opened)
if exp:
self._render_tier_stream_panel("Tier 2", "Tier 2 (Tech Lead)")
self._end_window()
imgui.end()
if self.ui_separate_tier3 and self.show_windows.get("Tier 3: Workers", False):
exp, opened = self._begin_window("Tier 3: Workers", self.show_windows["Tier 3: Workers"])
exp, opened = imgui.begin("Tier 3: Workers", self.show_windows["Tier 3: Workers"])
self.show_windows["Tier 3: Workers"] = bool(opened)
if exp:
self._render_tier_stream_panel("Tier 3", None)
self._end_window()
imgui.end()
if self.ui_separate_tier4 and self.show_windows.get("Tier 4: QA", False):
exp, opened = self._begin_window("Tier 4: QA", self.show_windows["Tier 4: QA"])
exp, opened = imgui.begin("Tier 4: QA", self.show_windows["Tier 4: QA"])
self.show_windows["Tier 4: QA"] = bool(opened)
if exp:
self._render_tier_stream_panel("Tier 4", "Tier 4 (QA)")
self._end_window()
imgui.end()
if self.show_windows.get("Theme", False):
self._render_theme_panel()
if self.show_windows.get("Discussion Hub", False):
exp, opened = self._begin_window("Discussion Hub", self.show_windows["Discussion Hub"])
exp, opened = imgui.begin("Discussion Hub", self.show_windows["Discussion Hub"])
self.show_windows["Discussion Hub"] = bool(opened)
if exp:
# Top part for the history
@@ -806,37 +705,86 @@ class App:
else:
imgui.text_disabled("Message & Response panels are detached.")
self._end_window()
imgui.end()
if self.show_windows.get("Operations Hub", False):
self._render_operations_hub()
exp, opened = imgui.begin("Operations Hub", self.show_windows["Operations Hub"])
self.show_windows["Operations Hub"] = bool(opened)
if exp:
imgui.text("Focus Agent:")
imgui.same_line()
focus_label = self.ui_focus_agent or "All"
if imgui.begin_combo("##focus_agent", focus_label, imgui.ComboFlags_.width_fit_preview):
if imgui.selectable("All", self.ui_focus_agent is None)[0]:
self.ui_focus_agent = None
for tier in ["Tier 2", "Tier 3", "Tier 4"]:
if imgui.selectable(tier, self.ui_focus_agent == tier)[0]:
self.ui_focus_agent = tier
imgui.end_combo()
imgui.same_line()
if self.ui_focus_agent:
if imgui.button("x##clear_focus"):
self.ui_focus_agent = None
if exp:
imgui.push_style_var(imgui.StyleVar_.item_spacing, imgui.ImVec2(10, 4))
ch1, self.ui_separate_tool_calls_panel = imgui.checkbox("Pop Out Tool Calls", self.ui_separate_tool_calls_panel)
if ch1: self.show_windows["Tool Calls"] = self.ui_separate_tool_calls_panel
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
show_usage_tab = not self.ui_separate_usage_analytics
if imgui.begin_tab_bar("ops_tabs"):
if imgui.begin_tab_item("Comms History")[0]:
self._render_comms_history_panel()
imgui.end_tab_item()
if show_tc_tab:
if imgui.begin_tab_item("Tool Calls")[0]:
self._render_tool_calls_panel()
imgui.end_tab_item()
if show_usage_tab:
if imgui.begin_tab_item("Usage Analytics")[0]:
self._render_usage_analytics_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()
if self.ui_separate_message_panel and self.show_windows.get("Message", False):
exp, opened = self._begin_window("Message", self.show_windows["Message"])
exp, opened = imgui.begin("Message", self.show_windows["Message"])
self.show_windows["Message"] = bool(opened)
if exp:
self._render_message_panel()
self._end_window()
imgui.end()
if self.ui_separate_response_panel and self.show_windows.get("Response", False):
exp, opened = self._begin_window("Response", self.show_windows["Response"])
exp, opened = imgui.begin("Response", self.show_windows["Response"])
self.show_windows["Response"] = bool(opened)
if exp:
self._render_response_panel()
self._end_window()
imgui.end()
if self.ui_separate_tool_calls_panel and self.show_windows.get("Tool Calls", False):
exp, opened = self._begin_window("Tool Calls", self.show_windows["Tool Calls"])
exp, opened = imgui.begin("Tool Calls", self.show_windows["Tool Calls"])
self.show_windows["Tool Calls"] = bool(opened)
if exp:
self._render_tool_calls_panel()
self._end_window()
imgui.end()
if self.ui_separate_external_tools and self.show_windows.get('External Tools', False):
exp, opened = self._begin_window('External Tools', self.show_windows['External Tools'])
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()
self._end_window()
imgui.end()
if self.show_windows.get("Log Management", False):
if self.perf_profiling_enabled: self.perf_monitor.start_component("_render_log_management")
@@ -1027,7 +975,6 @@ class App:
expanded, opened = imgui.begin("Last Script Output", self.show_script_output)
self.show_script_output = bool(opened)
if expanded:
self._render_frosted_background(imgui.get_window_pos(), imgui.get_window_size())
imgui.text("Script:")
imgui.same_line()
self._render_text_viewer("Last Script", self.ui_last_script_text)
@@ -1059,15 +1006,42 @@ class App:
expanded, opened = imgui.begin(f"Text Viewer - {self.text_viewer_title}", self.show_text_viewer)
self.show_text_viewer = bool(opened)
if expanded:
self._render_frosted_background(imgui.get_window_pos(), imgui.get_window_size())
if self.ui_word_wrap:
imgui.begin_child("tv_wrap", imgui.ImVec2(-1, -1), False)
imgui.push_text_wrap_pos(imgui.get_content_region_avail().x)
imgui.text(self.text_viewer_content)
imgui.pop_text_wrap_pos()
# Toolbar
if imgui.button("Copy"):
imgui.set_clipboard_text(self.text_viewer_content)
imgui.same_line()
_, self.text_viewer_wrap = imgui.checkbox("Word Wrap", self.text_viewer_wrap)
imgui.separator()
renderer = markdown_helper.get_renderer()
tv_type = getattr(self, "text_viewer_type", "text")
if tv_type == 'markdown':
imgui.begin_child("tv_md_scroll", imgui.ImVec2(-1, -1), True)
markdown_helper.render(self.text_viewer_content, context_id='text_viewer')
imgui.end_child()
elif tv_type in renderer._lang_map:
if self._text_viewer_editor is None:
self._text_viewer_editor = ced.TextEditor()
self._text_viewer_editor.set_read_only_enabled(True)
self._text_viewer_editor.set_show_line_numbers_enabled(True)
# Sync text and language
lang_id = renderer._lang_map[tv_type]
if self._text_viewer_editor.get_text().strip() != self.text_viewer_content.strip():
self._text_viewer_editor.set_text(self.text_viewer_content)
self._text_viewer_editor.set_language_definition(lang_id)
self._text_viewer_editor.render('##tv_editor', a_size=imgui.ImVec2(-1, -1))
else:
imgui.input_text_multiline("##tv_c", self.text_viewer_content, imgui.ImVec2(-1, -1), imgui.InputTextFlags_.read_only)
if self.text_viewer_wrap:
imgui.begin_child("tv_wrap", imgui.ImVec2(-1, -1), False)
imgui.push_text_wrap_pos(imgui.get_content_region_avail().x)
imgui.text(self.text_viewer_content)
imgui.pop_text_wrap_pos()
imgui.end_child()
else:
imgui.input_text_multiline("##tv_c", self.text_viewer_content, imgui.ImVec2(-1, -1), imgui.InputTextFlags_.read_only)
imgui.end()
# Inject File Modal
if getattr(self, "show_inject_modal", False):
@@ -1119,8 +1093,6 @@ class App:
if pushed_prior_tint:
imgui.pop_style_color()
if pushed_frosted_style:
imgui.pop_style_color()
if self.perf_profiling_enabled: self.perf_monitor.end_component("_gui_func")
@@ -1203,16 +1175,14 @@ class App:
imgui.separator()
imgui.text("Prompt Content:")
imgui.same_line()
if imgui.button("MD Preview" if not self._prompt_md_preview else "Edit Mode"):
self._prompt_md_preview = not self._prompt_md_preview
if imgui.button("Pop out MD Preview"):
self.text_viewer_title = f"Preset: {self._editing_preset_name}"
self.text_viewer_content = self._editing_preset_system_prompt
self.text_viewer_type = "markdown"
self.show_text_viewer = True
rem_y = imgui.get_content_region_avail().y
if self._prompt_md_preview:
if imgui.begin_child("prompt_preview", imgui.ImVec2(-1, rem_y), True):
markdown_helper.render(self._editing_preset_system_prompt, context_id="prompt_preset_preview")
imgui.end_child()
else:
_, self._editing_preset_system_prompt = imgui.input_text_multiline("##pcont", self._editing_preset_system_prompt, imgui.ImVec2(-1, rem_y))
_, self._editing_preset_system_prompt = imgui.input_text_multiline("##pcont", self._editing_preset_system_prompt, imgui.ImVec2(-1, rem_y))
imgui.end_child()
# Footer Buttons
@@ -2007,6 +1977,7 @@ class App:
imgui.text(f"History: {key}")
hist_data = self.perf_monitor.get_history(key)
if hist_data:
import numpy as np
imgui.plot_lines(f"##plot_{key}", np.array(hist_data, dtype=np.float32), graph_size=imgui.ImVec2(-1, 60))
else:
imgui.text_disabled(f"(no history data for {key})")
@@ -2154,7 +2125,6 @@ def hello():
if self.perf_profiling_enabled: self.perf_monitor.end_component("_render_screenshots_panel")
def _render_discussion_panel(self) -> None:
self._render_frosted_background(imgui.get_window_pos(), imgui.get_window_size())
if self.perf_profiling_enabled: self.perf_monitor.start_component("_render_discussion_panel")
# THINKING indicator
is_thinking = self.ai_status in ['sending...', 'streaming...', 'running powershell...']
@@ -2354,52 +2324,62 @@ def hello():
imgui.same_line()
preview = entry["content"].replace("\\n", " ")[:60]
if len(entry["content"]) > 60: preview += "..."
if not preview.strip() and entry.get("thinking_segments"):
preview = entry["thinking_segments"][0]["content"].replace("\\n", " ")[:60]
if len(entry["thinking_segments"][0]["content"]) > 60: preview += "..."
imgui.text_colored(vec4(160, 160, 150), preview)
if not collapsed:
thinking_segments = entry.get("thinking_segments", [])
has_content = bool(entry.get("content", "").strip())
is_standalone = bool(thinking_segments) and not has_content
if thinking_segments:
self._render_thinking_trace(thinking_segments, i, is_standalone=is_standalone)
if read_mode:
content = entry["content"]
pattern = re.compile(r"\[Definition: (.*?) from (.*?) \(line (\d+)\)\](\s+```[\s\S]*?```)?")
matches = list(pattern.finditer(content))
is_nerv = theme.is_nerv_active()
if not matches:
if is_nerv: imgui.push_style_color(imgui.Col_.text, vec4(80, 255, 80))
markdown_helper.render(content, context_id=f'disc_{i}')
if is_nerv: imgui.pop_style_color()
else:
imgui.begin_child(f"read_content_{i}", imgui.ImVec2(0, 150), True)
if self.ui_word_wrap: imgui.push_text_wrap_pos(imgui.get_content_region_avail().x)
last_idx = 0
for m_idx, match in enumerate(matches):
before = content[last_idx:match.start()]
if before:
if is_nerv: imgui.push_style_color(imgui.Col_.text, vec4(80, 255, 80))
markdown_helper.render(before, context_id=f'disc_{i}_b_{m_idx}')
if is_nerv: imgui.pop_style_color()
header_text = match.group(0).split("\n")[0].strip()
path = match.group(2)
code_block = match.group(4)
if imgui.collapsing_header(header_text):
if imgui.button(f"[Source]##{i}_{match.start()}"):
res = mcp_client.read_file(path)
if res:
self.text_viewer_title = path
self.text_viewer_content = res
self.show_text_viewer = True
if code_block:
# Render code block with highlighting
if is_nerv: imgui.push_style_color(imgui.Col_.text, vec4(80, 255, 80))
markdown_helper.render(code_block, context_id=f'disc_{i}_c_{m_idx}')
if is_nerv: imgui.pop_style_color()
last_idx = match.end()
after = content[last_idx:]
if after:
if content.strip():
pattern = re.compile(r"\[Definition: (.*?) from (.*?) \(line (\d+)\)\](\s+```[\s\S]*?```)?")
matches = list(pattern.finditer(content))
is_nerv = theme.is_nerv_active()
if not matches:
if is_nerv: imgui.push_style_color(imgui.Col_.text, vec4(80, 255, 80))
markdown_helper.render(after, context_id=f'disc_{i}_a')
markdown_helper.render(content, context_id=f'disc_{i}')
if is_nerv: imgui.pop_style_color()
if self.ui_word_wrap: imgui.pop_text_wrap_pos()
imgui.end_child()
else:
imgui.begin_child(f"read_content_{i}", imgui.ImVec2(0, 150), True)
if self.ui_word_wrap: imgui.push_text_wrap_pos(imgui.get_content_region_avail().x)
last_idx = 0
for m_idx, match in enumerate(matches):
before = content[last_idx:match.start()]
if before:
if is_nerv: imgui.push_style_color(imgui.Col_.text, vec4(80, 255, 80))
markdown_helper.render(before, context_id=f'disc_{i}_b_{m_idx}')
if is_nerv: imgui.pop_style_color()
header_text = match.group(0).split("\n")[0].strip()
path = match.group(2)
code_block = match.group(4)
if imgui.collapsing_header(header_text):
if imgui.button(f"[Source]##{i}_{match.start()}"):
res = mcp_client.read_file(path)
if res:
self.text_viewer_title = path
self.text_viewer_content = res
self.text_viewer_type = Path(path).suffix.lstrip('.') if Path(path).suffix else 'text'
self.show_text_viewer = True
if code_block:
if is_nerv: imgui.push_style_color(imgui.Col_.text, vec4(80, 255, 80))
markdown_helper.render(code_block, context_id=f'disc_{i}_c_{m_idx}')
if is_nerv: imgui.pop_style_color()
last_idx = match.end()
after = content[last_idx:]
if after:
if is_nerv: imgui.push_style_color(imgui.Col_.text, vec4(80, 255, 80))
markdown_helper.render(after, context_id=f'disc_{i}_a')
if is_nerv: imgui.pop_style_color()
if self.ui_word_wrap: imgui.pop_text_wrap_pos()
imgui.end_child()
else:
ch, entry["content"] = imgui.input_text_multiline("##content", entry["content"], imgui.ImVec2(-1, 150))
if not is_standalone:
ch, entry["content"] = imgui.input_text_multiline("##content", entry["content"], imgui.ImVec2(-1, 150))
imgui.separator()
imgui.pop_id()
if self._scroll_disc_to_bottom:
@@ -2833,14 +2813,24 @@ def hello():
imgui.begin_child("response_scroll_area", imgui.ImVec2(0, -40), True)
is_nerv = theme.is_nerv_active()
if is_nerv: imgui.push_style_color(imgui.Col_.text, vec4(80, 255, 80))
markdown_helper.render(self.ai_response, context_id="response")
segments, parsed_response = thinking_parser.parse_thinking_trace(self.ai_response)
if segments:
self._render_thinking_trace([{"content": s.content, "marker": s.marker} for s in segments], 9999)
markdown_helper.render(parsed_response, context_id="response")
if is_nerv: imgui.pop_style_color()
imgui.end_child()
imgui.separator()
if imgui.button("-> History"):
if self.ai_response:
self.disc_entries.append({"role": "AI", "content": self.ai_response, "collapsed": True, "ts": project_manager.now_ts()})
segments, response = thinking_parser.parse_thinking_trace(self.ai_response)
entry = {"role": "AI", "content": response, "collapsed": True, "ts": project_manager.now_ts()}
if segments:
entry["thinking_segments"] = [{"content": s.content, "marker": s.marker} for s in segments]
self.disc_entries.append(entry)
if is_blinking:
imgui.pop_style_color(2)
if self.perf_profiling_enabled: self.perf_monitor.end_component("_render_response_panel")
@@ -2956,6 +2946,12 @@ def hello():
imgui.text_colored(C_LBL, f"#{i_display}")
imgui.same_line()
imgui.text_colored(vec4(160, 160, 160), ts)
latency = entry.get("latency") or entry.get("metadata", {}).get("latency")
if latency:
imgui.same_line()
imgui.text_colored(C_SUB, f" ({latency:.2f}s)")
ticket_id = entry.get("mma_ticket_id")
if ticket_id:
imgui.same_line()
@@ -2974,14 +2970,34 @@ def hello():
# Optimized content rendering using _render_heavy_text logic
idx_str = str(i)
if kind == "request":
usage = payload.get("usage", {})
if usage:
inp = usage.get("input_tokens", 0)
imgui.text_colored(C_LBL, f" tokens in:{inp}")
self._render_heavy_text("message", payload.get("message", ""), idx_str)
if payload.get("system"):
self._render_heavy_text("system", payload.get("system", ""), idx_str)
elif kind == "response":
r = payload.get("round", 0)
sr = payload.get("stop_reason", "STOP")
imgui.text_colored(C_LBL, f"round: {r} stop_reason: {sr}")
self._render_heavy_text("text", payload.get("text", ""), idx_str)
usage = payload.get("usage", {})
usage_str = ""
if usage:
inp = usage.get("input_tokens", 0)
out = usage.get("output_tokens", 0)
cache = usage.get("cache_read_input_tokens", 0)
usage_str = f" in:{inp} out:{out}"
if cache:
usage_str += f" cache:{cache}"
imgui.text_colored(C_LBL, f"round: {r} stop_reason: {sr}{usage_str}")
text_content = payload.get("text", "")
segments, parsed_response = thinking_parser.parse_thinking_trace(text_content)
if segments:
self._render_thinking_trace([{"content": s.content, "marker": s.marker} for s in segments], i, is_standalone=not bool(parsed_response.strip()))
if parsed_response:
self._render_heavy_text("text", parsed_response, idx_str)
tcs = payload.get("tool_calls", [])
if tcs:
self._render_heavy_text("tool_calls", json.dumps(tcs, indent=1), idx_str)
@@ -3041,7 +3057,7 @@ def hello():
script = entry.get("script", "")
res = entry.get("result", "")
# Use a clear, formatted combined view for the detail window
combined = f"COMMAND:\n{script}\n\n{'='*40}\nOUTPUT:\n{res}"
combined = f"**COMMAND:**\n```powershell\n{script}\n```\n\n---\n**OUTPUT:**\n```text\n{res}\n```"
script_preview = script.replace("\n", " ")[:150]
if len(script) > 150: script_preview += "..."
@@ -3049,6 +3065,7 @@ def hello():
if imgui.is_item_clicked():
self.text_viewer_title = f"Tool Call #{i+1} Details"
self.text_viewer_content = combined
self.text_viewer_type = 'markdown'
self.show_text_viewer = True
imgui.table_next_column()
@@ -3058,6 +3075,7 @@ def hello():
if imgui.is_item_clicked():
self.text_viewer_title = f"Tool Call #{i+1} Details"
self.text_viewer_content = combined
self.text_viewer_type = 'markdown'
self.show_text_viewer = True
imgui.end_table()
@@ -3978,7 +3996,6 @@ def hello():
exp, opened = imgui.begin("Theme", self.show_windows["Theme"])
self.show_windows["Theme"] = bool(opened)
if exp:
self._render_frosted_background(imgui.get_window_pos(), imgui.get_window_size())
imgui.text("Palette")
cp = theme.get_current_palette()
if imgui.begin_combo("##pal", cp):
@@ -4052,10 +4069,6 @@ def hello():
gui_cfg["crt_filter_enabled"] = self.ui_crt_filter
self._flush_to_config()
models.save_config(self.config)
ch_fg, fg_val = imgui.checkbox("Frosted Glass Effect", theme.get_frosted_glass_enabled())
if ch_fg:
theme.set_frosted_glass_enabled(fg_val)
self._flush_to_config()
models.save_config(self.config)
imgui.end()
@@ -4101,8 +4114,6 @@ def hello():
def _post_init(self) -> None:
theme.apply_current()
self.shader_manager.setup_background_shader()
self.shader_manager.setup_frosted_glass_shader()
def run(self) -> None:
"""Initializes the ImGui runner and starts the main application loop."""

View File

@@ -111,6 +111,7 @@ DEFAULT_TOOL_CATEGORIES: Dict[str, List[str]] = {
def parse_history_entries(history_strings: list[str], roles: list[str]) -> list[dict[str, Any]]:
import re
from src import thinking_parser
entries = []
for raw in history_strings:
ts = ""
@@ -128,11 +129,30 @@ def parse_history_entries(history_strings: list[str], roles: list[str]) -> list[
content = rest[match.end():].strip()
else:
content = rest
entries.append({"role": role, "content": content, "collapsed": True, "ts": ts})
entry_obj = {"role": role, "content": content, "collapsed": True, "ts": ts}
if role == "AI" and ("<thinking>" in content or "<thought>" in content or "Thinking:" in content):
segments, parsed_content = thinking_parser.parse_thinking_trace(content)
if segments:
entry_obj["content"] = parsed_content
entry_obj["thinking_segments"] = [{"content": s.content, "marker": s.marker} for s in segments]
entries.append(entry_obj)
return entries
@dataclass
@dataclass
class ThinkingSegment:
content: str
marker: str # 'thinking', 'thought', or 'Thinking:'
def to_dict(self) -> Dict[str, Any]:
return {"content": self.content, "marker": self.marker}
@classmethod
def from_dict(cls, data: Dict[str, Any]) -> "ThinkingSegment":
return cls(content=data["content"], marker=data["marker"])
@dataclass
class Ticket:
id: str
@@ -239,8 +259,6 @@ class Track:
)
@dataclass
@dataclass
@dataclass
class WorkerContext:
ticket_id: str

View File

@@ -33,6 +33,14 @@ def entry_to_str(entry: dict[str, Any]) -> str:
ts = entry.get("ts", "")
role = entry.get("role", "User")
content = entry.get("content", "")
segments = entry.get("thinking_segments")
if segments:
for s in segments:
marker = s.get("marker", "thinking")
s_content = s.get("content", "")
content = f"<{marker}>\n{s_content}\n</{marker}>\n{content}"
if ts:
return f"@{ts}\n{role}:\n{content}"
return f"{role}:\n{content}"

View File

@@ -5,113 +5,6 @@ class ShaderManager:
self.program = None
self.bg_program = None
self.pp_program = None
self.blur_h_program = None
self.blur_v_program = None
self.blur_fbo = None
self.scene_fbo = None
self.temp_fbo = None
self.scene_tex = None
self.blur_tex = None
self.temp_tex = None
self.fbo_width = 0
self.fbo_height = 0
self._vao = None
def _ensure_vao(self):
if self._vao is None:
try:
import sys
if sys.platform == "win32":
self._vao = gl.glGenVertexArrays(1)
else:
# Some non-win32 environments might not support VAOs or need different handling
self._vao = gl.glGenVertexArrays(1)
except Exception:
pass
if self._vao is not None:
gl.glBindVertexArray(self._vao)
def setup_capture_fbo(self, width, height):
if self.blur_fbo is not None:
gl.glDeleteFramebuffers(1, [self.blur_fbo])
if self.scene_fbo is not None:
gl.glDeleteFramebuffers(1, [self.scene_fbo])
if self.temp_fbo is not None:
gl.glDeleteFramebuffers(1, [self.temp_fbo])
if self.scene_tex is not None:
gl.glDeleteTextures(1, [self.scene_tex])
if self.blur_tex is not None:
gl.glDeleteTextures(1, [self.blur_tex])
if self.temp_tex is not None:
gl.glDeleteTextures(1, [self.temp_tex])
self.scene_tex = gl.glGenTextures(1)
gl.glBindTexture(gl.GL_TEXTURE_2D, self.scene_tex)
gl.glTexImage2D(gl.GL_TEXTURE_2D, 0, gl.GL_RGBA, 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)
self.scene_fbo = gl.glGenFramebuffers(1)
gl.glBindFramebuffer(gl.GL_FRAMEBUFFER, self.scene_fbo)
gl.glFramebufferTexture2D(gl.GL_FRAMEBUFFER, gl.GL_COLOR_ATTACHMENT0, gl.GL_TEXTURE_2D, self.scene_tex, 0)
if gl.glCheckFramebufferStatus(gl.GL_FRAMEBUFFER) != gl.GL_FRAMEBUFFER_COMPLETE:
raise RuntimeError("Scene Framebuffer not complete")
self.temp_tex = gl.glGenTextures(1)
gl.glBindTexture(gl.GL_TEXTURE_2D, self.temp_tex)
gl.glTexImage2D(gl.GL_TEXTURE_2D, 0, gl.GL_RGBA, 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)
self.temp_fbo = gl.glGenFramebuffers(1)
gl.glBindFramebuffer(gl.GL_FRAMEBUFFER, self.temp_fbo)
gl.glFramebufferTexture2D(gl.GL_FRAMEBUFFER, gl.GL_COLOR_ATTACHMENT0, gl.GL_TEXTURE_2D, self.temp_tex, 0)
if gl.glCheckFramebufferStatus(gl.GL_FRAMEBUFFER) != gl.GL_FRAMEBUFFER_COMPLETE:
raise RuntimeError("Temp Framebuffer not complete")
self.blur_tex = gl.glGenTextures(1)
gl.glBindTexture(gl.GL_TEXTURE_2D, self.blur_tex)
gl.glTexImage2D(gl.GL_TEXTURE_2D, 0, gl.GL_RGBA, 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)
self.blur_fbo = gl.glGenFramebuffers(1)
gl.glBindFramebuffer(gl.GL_FRAMEBUFFER, self.blur_fbo)
gl.glFramebufferTexture2D(gl.GL_FRAMEBUFFER, gl.GL_COLOR_ATTACHMENT0, gl.GL_TEXTURE_2D, self.blur_tex, 0)
if gl.glCheckFramebufferStatus(gl.GL_FRAMEBUFFER) != gl.GL_FRAMEBUFFER_COMPLETE:
raise RuntimeError("Blur Framebuffer not complete")
gl.glBindFramebuffer(gl.GL_FRAMEBUFFER, 0)
self.fbo_width = width
self.fbo_height = height
def render_background_to_fbo(self, width, height, time):
if self.scene_fbo is None or self.fbo_width != width or self.fbo_height != height:
self.setup_capture_fbo(width, height)
gl.glBindFramebuffer(gl.GL_FRAMEBUFFER, self.scene_fbo)
gl.glViewport(0, 0, width, height)
self.render_background(width, height, time)
gl.glBindFramebuffer(gl.GL_FRAMEBUFFER, 0)
def prepare_global_blur(self, width, height, radius, tint, opacity, time):
self.render_background_to_fbo(width, height, time)
self.render_blur(self.scene_tex, width, height, radius, tint, opacity)
gl.glBindFramebuffer(gl.GL_FRAMEBUFFER, 0)
def capture_begin(self, width, height):
if self.blur_fbo is None or self.fbo_width != width or self.fbo_height != height:
self.setup_capture_fbo(width, height)
gl.glBindFramebuffer(gl.GL_FRAMEBUFFER, self.blur_fbo)
gl.glViewport(0, 0, width, height)
def capture_end(self):
gl.glBindFramebuffer(gl.GL_FRAMEBUFFER, 0)
def compile_shader(self, vertex_src: str, fragment_src: str) -> int:
program = gl.glCreateProgram()
@@ -186,44 +79,9 @@ void main() {
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.5453123);
}
float noise(vec2 p) {
vec2 i = floor(p);
vec2 f = fract(p);
vec2 u = f * f * (3.0 - 2.0 * f);
return mix(mix(hash(i + vec2(0.0, 0.0)), hash(i + vec2(1.0, 0.0)), u.x),
mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0, 1.0)), u.x), u.y);
}
void main() {
vec2 uv = gl_FragCoord.xy / u_resolution.xy;
vec2 p = uv * 2.0 - 1.0;
p.x *= u_resolution.x / u_resolution.y;
// Deep sea background gradient (dark blue)
vec3 col = mix(vec3(0.01, 0.03, 0.08), vec3(0.0, 0.08, 0.15), uv.y);
// Moving blobs / caustics
float n = 0.0;
float t = u_time * 0.15;
n += noise(p * 1.2 + vec2(t * 0.8, t * 0.5)) * 0.4;
n += noise(p * 2.5 - vec2(t * 0.4, t * 0.9)) * 0.2;
col += vec3(0.05, 0.12, 0.22) * n;
// Bright highlights (caustics approximation)
float c = 0.0;
for(int i=0; i<3; i++) {
vec2 p2 = p * (float(i) + 1.0) * 0.4;
p2 += vec2(sin(t + p2.y * 1.5), cos(t + p2.x * 1.5));
c += abs(0.015 / (length(p2) - 0.4));
}
col += vec3(0.1, 0.25, 0.45) * c * 0.12;
vec3 col = 0.5 + 0.5 * cos(u_time + uv.xyx + vec3(0, 2, 4));
FragColor = vec4(col, 1.0);
}
"""
@@ -239,7 +97,6 @@ void main() {
u_res_loc = gl.glGetUniformLocation(self.bg_program, "u_resolution")
if u_res_loc != -1:
gl.glUniform2f(u_res_loc, float(width), float(height))
self._ensure_vao()
gl.glDrawArrays(gl.GL_TRIANGLE_STRIP, 0, 4)
gl.glUseProgram(0)
@@ -291,114 +148,6 @@ void main() {
u_time_loc = gl.glGetUniformLocation(self.pp_program, "u_time")
if u_time_loc != -1:
gl.glUniform1f(u_time_loc, float(time))
self._ensure_vao()
gl.glDrawArrays(gl.GL_TRIANGLE_STRIP, 0, 4)
gl.glBindTexture(gl.GL_TEXTURE_2D, 0)
gl.glUseProgram(0)
def setup_frosted_glass_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_h = """
#version 330 core
in vec2 v_uv;
uniform sampler2D u_texture;
uniform float u_blur_radius;
uniform vec2 u_direction;
out vec4 FragColor;
void main() {
float weight[5] = float[](0.227027, 0.1945946, 0.1216216, 0.054054, 0.016216);
vec2 res = vec2(textureSize(u_texture, 0));
vec2 tex_offset = (u_blur_radius / res) * u_direction * 2.5; // Multiplied by 2.5 for milky effect
vec4 result = texture(u_texture, v_uv) * weight[0];
for(int i = 1; i < 5; ++i) {
result += texture(u_texture, v_uv + tex_offset * float(i)) * weight[i];
result += texture(u_texture, v_uv - tex_offset * float(i)) * weight[i];
}
FragColor = result;
}
"""
fragment_src_v = """
#version 330 core
in vec2 v_uv;
uniform sampler2D u_texture;
uniform float u_blur_radius;
uniform vec2 u_direction;
uniform float u_tint_intensity;
uniform float u_opacity;
out vec4 FragColor;
void main() {
float weight[5] = float[](0.227027, 0.1945946, 0.1216216, 0.054054, 0.016216);
vec2 res = vec2(textureSize(u_texture, 0));
vec2 tex_offset = (u_blur_radius / res) * u_direction * 2.5; // Multiplied by 2.5 for milky effect
vec4 result = texture(u_texture, v_uv) * weight[0];
for(int i = 1; i < 5; ++i) {
result += texture(u_texture, v_uv + tex_offset * float(i)) * weight[i];
result += texture(u_texture, v_uv - tex_offset * float(i)) * weight[i];
}
vec3 tint_color = vec3(0.05, 0.07, 0.12); // Slightly deeper tint
vec3 tinted = mix(result.rgb, tint_color, u_tint_intensity);
FragColor = vec4(tinted, result.a * u_opacity);
}
"""
self.blur_h_program = self.compile_shader(vertex_src, fragment_src_h)
self.blur_v_program = self.compile_shader(vertex_src, fragment_src_v)
def render_blur(self, texture_id, width, height, radius, tint, opacity):
if not self.blur_h_program or not self.blur_v_program:
return
self._ensure_vao()
# Pass 1: Horizontal blur to temp_fbo
gl.glBindFramebuffer(gl.GL_FRAMEBUFFER, self.temp_fbo)
gl.glViewport(0, 0, width, height)
gl.glClear(gl.GL_COLOR_BUFFER_BIT)
gl.glUseProgram(self.blur_h_program)
gl.glActiveTexture(gl.GL_TEXTURE0)
gl.glBindTexture(gl.GL_TEXTURE_2D, texture_id)
gl.glUniform1i(gl.glGetUniformLocation(self.blur_h_program, "u_texture"), 0)
gl.glUniform1f(gl.glGetUniformLocation(self.blur_h_program, "u_blur_radius"), float(radius))
gl.glUniform2f(gl.glGetUniformLocation(self.blur_h_program, "u_direction"), 1.0, 0.0)
gl.glDrawArrays(gl.GL_TRIANGLE_STRIP, 0, 4)
# Pass 2: Vertical blur to blur_fbo
gl.glBindFramebuffer(gl.GL_FRAMEBUFFER, self.blur_fbo)
gl.glViewport(0, 0, width, height)
gl.glClear(gl.GL_COLOR_BUFFER_BIT)
gl.glUseProgram(self.blur_v_program)
gl.glActiveTexture(gl.GL_TEXTURE0)
gl.glBindTexture(gl.GL_TEXTURE_2D, self.temp_tex)
gl.glUniform1i(gl.glGetUniformLocation(self.blur_v_program, "u_texture"), 0)
gl.glUniform1f(gl.glGetUniformLocation(self.blur_v_program, "u_blur_radius"), float(radius))
gl.glUniform2f(gl.glGetUniformLocation(self.blur_v_program, "u_direction"), 0.0, 1.0)
gl.glUniform1f(gl.glGetUniformLocation(self.blur_v_program, "u_tint_intensity"), float(tint))
gl.glUniform1f(gl.glGetUniformLocation(self.blur_v_program, "u_opacity"), float(opacity))
gl.glDrawArrays(gl.GL_TRIANGLE_STRIP, 0, 4)
gl.glBindTexture(gl.GL_TEXTURE_2D, 0)
gl.glUseProgram(0)

View File

@@ -235,10 +235,6 @@ _current_font_size: float = 16.0
_current_scale: float = 1.0
_transparency: float = 1.0
_child_transparency: float = 1.0
_frosted_glass_enabled: bool = False
_frosted_blur_radius: float = 8.0
_frosted_tint_intensity: float = 0.1
_frosted_opacity: float = 1.0
# ------------------------------------------------------------------ public API
@@ -273,34 +269,6 @@ def set_child_transparency(val: float) -> None:
_child_transparency = val
apply(_current_palette)
def get_frosted_glass_enabled() -> bool:
return _frosted_glass_enabled
def set_frosted_glass_enabled(val: bool) -> None:
global _frosted_glass_enabled
_frosted_glass_enabled = val
def get_frosted_blur_radius() -> float:
return _frosted_blur_radius
def set_frosted_blur_radius(val: float) -> None:
global _frosted_blur_radius
_frosted_blur_radius = val
def get_frosted_tint_intensity() -> float:
return _frosted_tint_intensity
def set_frosted_tint_intensity(val: float) -> None:
global _frosted_tint_intensity
_frosted_tint_intensity = val
def get_frosted_opacity() -> float:
return _frosted_opacity
def set_frosted_opacity(val: float) -> None:
global _frosted_opacity
_frosted_opacity = val
def apply(palette_name: str) -> None:
"""
Apply a named palette by setting all ImGui style colors and applying global professional styling.
@@ -382,17 +350,13 @@ def save_to_config(config: dict) -> None:
config["theme"]["scale"] = _current_scale
config["theme"]["transparency"] = _transparency
config["theme"]["child_transparency"] = _child_transparency
config["theme"]["frosted_glass_enabled"] = _frosted_glass_enabled
config["theme"]["frosted_blur_radius"] = _frosted_blur_radius
config["theme"]["frosted_tint_intensity"] = _frosted_tint_intensity
config["theme"]["frosted_opacity"] = _frosted_opacity
sys.stderr.write(f"[DEBUG theme_2] save_to_config: palette={_current_palette}, transparency={_transparency}\n")
sys.stderr.flush()
def load_from_config(config: dict) -> None:
"""Read [theme] from config. Font is handled separately at startup."""
import sys
global _current_font_path, _current_font_size, _current_scale, _current_palette, _transparency, _child_transparency, _frosted_glass_enabled, _frosted_blur_radius, _frosted_tint_intensity, _frosted_opacity
global _current_font_path, _current_font_size, _current_scale, _current_palette, _transparency, _child_transparency
t = config.get("theme", {})
sys.stderr.write(f"[DEBUG theme_2] load_from_config raw: {t}\n")
sys.stderr.flush()
@@ -405,10 +369,6 @@ def load_from_config(config: dict) -> None:
_current_scale = float(t.get("scale", 1.0))
_transparency = float(t.get("transparency", 1.0))
_child_transparency = float(t.get("child_transparency", 1.0))
_frosted_glass_enabled = bool(t.get("frosted_glass_enabled", False))
_frosted_blur_radius = float(t.get("frosted_blur_radius", 8.0))
_frosted_tint_intensity = float(t.get("frosted_tint_intensity", 0.1))
_frosted_opacity = float(t.get("frosted_opacity", 1.0))
sys.stderr.write(f"[DEBUG theme_2] load_from_config effective: palette={_current_palette}, transparency={_transparency}\n")
sys.stderr.flush()

53
src/thinking_parser.py Normal file
View File

@@ -0,0 +1,53 @@
import re
from typing import List, Tuple
from src.models import ThinkingSegment
def parse_thinking_trace(text: str) -> Tuple[List[ThinkingSegment], str]:
"""
Parses thinking segments from text and returns (segments, response_content).
Support extraction of thinking traces from <thinking>...</thinking>, <thought>...</thought>,
and blocks prefixed with Thinking:.
"""
segments = []
# 1. Extract <thinking> and <thought> tags
current_text = text
# Combined pattern for tags
tag_pattern = re.compile(r'<(thinking|thought)>(.*?)</\1>', re.DOTALL | re.IGNORECASE)
def extract_tags(txt: str) -> Tuple[List[ThinkingSegment], str]:
found_segments = []
def replace_func(match):
marker = match.group(1).lower()
content = match.group(2).strip()
found_segments.append(ThinkingSegment(content=content, marker=marker))
return ""
remaining = tag_pattern.sub(replace_func, txt)
return found_segments, remaining
tag_segments, remaining = extract_tags(current_text)
segments.extend(tag_segments)
# 2. Extract Thinking: prefix
# This usually appears at the start of a block and ends with a double newline or a response marker.
thinking_colon_pattern = re.compile(r'(?:^|\n)Thinking:\s*(.*?)(?:\n\n|\nResponse:|\nAnswer:|$)', re.DOTALL | re.IGNORECASE)
def extract_colon_blocks(txt: str) -> Tuple[List[ThinkingSegment], str]:
found_segments = []
def replace_func(match):
content = match.group(1).strip()
if content:
found_segments.append(ThinkingSegment(content=content, marker="Thinking:"))
return "\n\n"
res = thinking_colon_pattern.sub(replace_func, txt)
return found_segments, res
colon_segments, final_remaining = extract_colon_blocks(remaining)
segments.extend(colon_segments)
return segments, final_remaining.strip()

BIN
temp_gui.py Normal file

Binary file not shown.

View File

@@ -1,42 +0,0 @@
import pytest
from unittest.mock import patch, MagicMock
import OpenGL.GL as gl
def test_shader_manager_fbo_initialization():
with patch("src.shader_manager.gl") as mock_gl:
mock_gl.glGenFramebuffers.side_effect = [1, 2]
mock_gl.glGenTextures.side_effect = [3, 4]
mock_gl.glCheckFramebufferStatus.return_value = mock_gl.GL_FRAMEBUFFER_COMPLETE
from src.shader_manager import ShaderManager
manager = ShaderManager()
manager.setup_capture_fbo(800, 600)
assert manager.scene_fbo == 1
assert manager.blur_fbo == 2
assert manager.scene_tex == 3
assert manager.blur_tex == 4
assert mock_gl.glGenFramebuffers.call_count == 2
assert mock_gl.glGenTextures.call_count == 2
assert mock_gl.glCheckFramebufferStatus.call_count == 2
def test_shader_manager_capture_lifecycle():
with patch("src.shader_manager.gl") as mock_gl:
mock_gl.glCheckFramebufferStatus.return_value = mock_gl.GL_FRAMEBUFFER_COMPLETE
mock_gl.glGenFramebuffers.side_effect = [1, 2]
mock_gl.glGenTextures.side_effect = [3, 4]
from src.shader_manager import ShaderManager
manager = ShaderManager()
# Ensure setup is called on first capture
manager.capture_begin(1024, 768)
assert manager.fbo_width == 1024
assert manager.fbo_height == 768
# Should bind the blur FBO
mock_gl.glBindFramebuffer.assert_any_call(mock_gl.GL_FRAMEBUFFER, manager.blur_fbo)
mock_gl.glBindFramebuffer.reset_mock()
manager.capture_end()
# Verify unbind (glBindFramebuffer(..., 0))
mock_gl.glBindFramebuffer.assert_called_with(mock_gl.GL_FRAMEBUFFER, 0)

View File

@@ -1,19 +0,0 @@
import pytest
from unittest.mock import patch, MagicMock
def test_shader_manager_frosted_glass_compilation():
# Mock OpenGL before importing 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()
# This should fail initially because the method doesn't exist
manager.setup_frosted_glass_shader()
assert manager.blur_program is not None
assert mock_gl.glCreateProgram.called

View File

@@ -1,89 +0,0 @@
import pytest
import time
from unittest.mock import patch, MagicMock
def test_gui_frosted_background_call():
# Mock ShaderManager and OpenGL functions
with patch("src.gui_2.ShaderManager") as mock_sm_class, \
patch("src.gui_2.gl") as mock_gl, \
patch("src.gui_2.imgui") as mock_imgui, \
patch("src.gui_2.theme") as mock_theme:
mock_sm = mock_sm_class.return_value
mock_sm.blur_tex = 2
mock_theme.get_frosted_glass_enabled.return_value = True
mock_imgui.get_io().display_size = MagicMock(x=1920, y=1080)
from src.gui_2 import App
with patch.object(App, '__init__', return_value=None):
app = App()
app.shader_manager = mock_sm
# Simulate frame
app._render_frosted_background(pos=MagicMock(x=10, y=10), size=MagicMock(x=100, y=100))
# Now it should only call add_image
assert mock_imgui.get_window_draw_list().add_image.called
# It no longer calls these
assert not mock_sm.setup_capture_fbo.called
assert not mock_sm.render_blur.called
assert not mock_sm.capture_begin.called
assert not mock_sm.capture_end.called
def test_gui_global_blur_call():
with patch("src.gui_2.ShaderManager") as mock_sm_class, \
patch("src.gui_2.imgui") as mock_imgui, \
patch("src.gui_2.theme") as mock_theme, \
patch("src.gui_2.bg_shader") as mock_bg:
mock_sm = mock_sm_class.return_value
mock_theme.get_frosted_glass_enabled.return_value = True
mock_theme.is_nerv_active.return_value = False
mock_imgui.get_io().display_size = MagicMock(x=1920, y=1080)
mock_bg.get_bg.return_value = MagicMock(enabled=False)
from src.gui_2 import App
with patch.object(App, '__init__', return_value=None):
app = App()
app.shader_manager = mock_sm
app.shader_uniforms = {
'frosted_blur_radius': 10.0,
'frosted_tint_intensity': 0.5,
'frosted_opacity': 0.8
}
app.ai_status = "idle"
app.ui_crt_filter = False
app.controller = MagicMock()
app.perf_profiling_enabled = False
app.is_viewing_prior_session = False
app.config = {}
app.project = {}
app.show_windows = {}
app.ui_auto_scroll_comms = False
app._comms_log_dirty = False
app._tool_log_dirty = False
app._pending_comms_lock = MagicMock()
app._pending_comms = []
app.ui_focus_agent = None
app._last_ui_focus_agent = None
app.perf_monitor = MagicMock()
app._process_pending_gui_tasks = MagicMock()
app._process_pending_history_adds = MagicMock()
app._render_track_proposal_modal = MagicMock()
app._render_patch_modal = MagicMock()
app._render_save_preset_modal = MagicMock()
app._render_preset_manager_window = MagicMock()
app._render_tool_preset_manager_window = MagicMock()
app._render_persona_editor_window = MagicMock()
app._last_autosave = time.time()
app._autosave_interval = 60
app._render_custom_title_bar = MagicMock()
app._render_shader_live_editor = MagicMock()
try:
app._gui_func()
except Exception:
pass
assert mock_sm.prepare_global_blur.called

View File

@@ -0,0 +1,28 @@
import pytest
import time
from src.api_hook_client import ApiHookClient
def test_text_viewer_state_update(live_gui) -> None:
"""
Verifies that we can set text viewer state and it is reflected in GUI state.
"""
client = ApiHookClient()
label = "Test Viewer Label"
content = "This is test content for the viewer."
text_type = "markdown"
# Add a task to push a custom callback that mutates the app state
def set_viewer_state(app):
app.show_text_viewer = True
app.text_viewer_title = label
app.text_viewer_content = content
app.text_viewer_type = text_type
client.push_event("custom_callback", {"callback": set_viewer_state})
time.sleep(0.5)
state = client.get_gui_state()
assert state is not None
assert state.get('show_text_viewer') == True
assert state.get('text_viewer_title') == label
assert state.get('text_viewer_type') == text_type

View File

@@ -3,48 +3,33 @@ from unittest.mock import MagicMock
from src import theme_2 as theme
def test_theme_apply_sets_rounding_and_padding(monkeypatch):
# Mock imgui
mock_style = MagicMock()
mock_imgui = MagicMock()
mock_imgui.get_style.return_value = mock_style
mock_imgui.ImVec2.side_effect = lambda x, y: (x, y)
monkeypatch.setattr(theme, "imgui", mock_imgui)
# Mock imgui
mock_style = MagicMock()
mock_imgui = MagicMock()
mock_imgui.get_style.return_value = mock_style
mock_imgui.ImVec2.side_effect = lambda x, y: (x, y)
monkeypatch.setattr(theme, "imgui", mock_imgui)
# Call apply with the default palette
theme.apply("ImGui Dark")
# Call apply with the default palette
theme.apply("ImGui Dark")
# Verify subtle rounding styles
assert mock_style.window_rounding == 6.0
assert mock_style.child_rounding == 4.0
assert mock_style.frame_rounding == 4.0
assert mock_style.popup_rounding == 4.0
assert mock_style.scrollbar_rounding == 12.0
assert mock_style.grab_rounding == 4.0
assert mock_style.tab_rounding == 4.0
# Verify subtle rounding styles
assert mock_style.window_rounding == 6.0
assert mock_style.child_rounding == 4.0
assert mock_style.frame_rounding == 4.0
assert mock_style.popup_rounding == 4.0
assert mock_style.scrollbar_rounding == 12.0
assert mock_style.grab_rounding == 4.0
assert mock_style.tab_rounding == 4.0
# Verify borders
assert mock_style.window_border_size == 1.0
assert mock_style.frame_border_size == 1.0
assert mock_style.popup_border_size == 1.0
# Verify borders
assert mock_style.window_border_size == 1.0
assert mock_style.frame_border_size == 1.0
assert mock_style.popup_border_size == 1.0
# Verify padding/spacing
assert mock_style.window_padding == (8.0, 8.0)
assert mock_style.frame_padding == (8.0, 4.0)
assert mock_style.item_spacing == (8.0, 4.0)
assert mock_style.item_inner_spacing == (4.0, 4.0)
assert mock_style.scrollbar_size == 14.0
def test_frosted_glass_enabled_toggle():
theme.set_frosted_glass_enabled(True)
assert theme.get_frosted_glass_enabled() is True
theme.set_frosted_glass_enabled(False)
assert theme.get_frosted_glass_enabled() is False
def test_theme_config_frosted_glass():
config = {"theme": {"frosted_glass_enabled": True}}
theme.load_from_config(config)
assert theme.get_frosted_glass_enabled() is True
new_config = {}
theme.save_to_config(new_config)
assert new_config["theme"]["frosted_glass_enabled"] is True
# Verify padding/spacing
assert mock_style.window_padding == (8.0, 8.0)
assert mock_style.frame_padding == (8.0, 4.0)
assert mock_style.item_spacing == (8.0, 4.0)
assert mock_style.item_inner_spacing == (4.0, 4.0)
assert mock_style.scrollbar_size == 14.0

View File

@@ -0,0 +1,53 @@
import pytest
def test_render_thinking_trace_helper_exists():
from src.gui_2 import App
assert hasattr(App, "_render_thinking_trace"), (
"_render_thinking_trace helper should exist in App class"
)
def test_discussion_entry_with_thinking_segments():
entry = {
"role": "AI",
"content": "Here's my response",
"thinking_segments": [
{"content": "Let me analyze this step by step...", "marker": "thinking"},
{"content": "I should consider edge cases...", "marker": "thought"},
],
"ts": "2026-03-13T10:00:00",
"collapsed": False,
}
assert "thinking_segments" in entry
assert len(entry["thinking_segments"]) == 2
def test_discussion_entry_without_thinking():
entry = {
"role": "User",
"content": "Hello",
"ts": "2026-03-13T10:00:00",
"collapsed": False,
}
assert "thinking_segments" not in entry
def test_thinking_segment_model_compatibility():
from src.models import ThinkingSegment
segment = ThinkingSegment(content="test", marker="thinking")
assert segment.content == "test"
assert segment.marker == "thinking"
d = segment.to_dict()
assert d["content"] == "test"
assert d["marker"] == "thinking"
if __name__ == "__main__":
test_render_thinking_trace_helper_exists()
test_discussion_entry_with_thinking_segments()
test_discussion_entry_without_thinking()
test_thinking_segment_model_compatibility()
print("All GUI thinking trace tests passed!")

View File

@@ -0,0 +1,94 @@
import pytest
import tempfile
import os
from pathlib import Path
from src import project_manager
from src.models import ThinkingSegment
def test_save_and_load_history_with_thinking_segments():
with tempfile.TemporaryDirectory() as tmpdir:
project_path = Path(tmpdir) / "test_project"
project_path.mkdir()
project_file = project_path / "test_project.toml"
project_file.write_text("[project]\nname = 'test'\n")
history_data = {
"entries": [
{
"role": "AI",
"content": "Here's the response",
"thinking_segments": [
{"content": "Let me think about this...", "marker": "thinking"}
],
"ts": "2026-03-13T10:00:00",
"collapsed": False,
},
{
"role": "User",
"content": "Hello",
"ts": "2026-03-13T09:00:00",
"collapsed": False,
},
]
}
project_manager.save_project(
{"project": {"name": "test"}}, project_file, disc_data=history_data
)
loaded = project_manager.load_history(project_file)
assert "entries" in loaded
assert len(loaded["entries"]) == 2
ai_entry = loaded["entries"][0]
assert ai_entry["role"] == "AI"
assert ai_entry["content"] == "Here's the response"
assert "thinking_segments" in ai_entry
assert len(ai_entry["thinking_segments"]) == 1
assert (
ai_entry["thinking_segments"][0]["content"] == "Let me think about this..."
)
user_entry = loaded["entries"][1]
assert user_entry["role"] == "User"
assert "thinking_segments" not in user_entry
def test_entry_to_str_with_thinking():
entry = {
"role": "AI",
"content": "Response text",
"thinking_segments": [{"content": "Thinking...", "marker": "thinking"}],
"ts": "2026-03-13T10:00:00",
}
result = project_manager.entry_to_str(entry)
assert "@2026-03-13T10:00:00" in result
assert "AI:" in result
assert "Response text" in result
def test_str_to_entry_with_thinking():
raw = "@2026-03-13T10:00:00\nAI:\nResponse text"
roles = ["User", "AI", "Vendor API", "System", "Reasoning"]
result = project_manager.str_to_entry(raw, roles)
assert result["role"] == "AI"
assert result["content"] == "Response text"
assert "ts" in result
def test_clean_nones_removes_thinking():
entry = {"role": "AI", "content": "Test", "thinking_segments": None, "ts": None}
cleaned = project_manager.clean_nones(entry)
assert "thinking_segments" not in cleaned
assert "ts" not in cleaned
if __name__ == "__main__":
test_save_and_load_history_with_thinking_segments()
test_entry_to_str_with_thinking()
test_str_to_entry_with_thinking()
test_clean_nones_removes_thinking()
print("All project_manager thinking tests passed!")

View File

@@ -0,0 +1,68 @@
from src.thinking_parser import parse_thinking_trace
def test_parse_xml_thinking_tag():
raw = "<thinking>\nLet me analyze this problem step by step.\n</thinking>\nHere is the answer."
segments, response = parse_thinking_trace(raw)
assert len(segments) == 1
assert segments[0].content == "Let me analyze this problem step by step."
assert segments[0].marker == "thinking"
assert response == "Here is the answer."
def test_parse_xml_thought_tag():
raw = "<thought>This is my reasoning process</thought>\nFinal response here."
segments, response = parse_thinking_trace(raw)
assert len(segments) == 1
assert segments[0].content == "This is my reasoning process"
assert segments[0].marker == "thought"
assert response == "Final response here."
def test_parse_text_thinking_prefix():
raw = "Thinking:\nThis is a text-based thinking trace.\n\nNow for the actual response."
segments, response = parse_thinking_trace(raw)
assert len(segments) == 1
assert segments[0].content == "This is a text-based thinking trace."
assert segments[0].marker == "Thinking:"
assert response == "Now for the actual response."
def test_parse_no_thinking():
raw = "This is a normal response without any thinking markers."
segments, response = parse_thinking_trace(raw)
assert len(segments) == 0
assert response == raw
def test_parse_empty_response():
segments, response = parse_thinking_trace("")
assert len(segments) == 0
assert response == ""
def test_parse_multiple_markers():
raw = "<thinking>First thinking</thinking>\n<thought>Second thought</thought>\nResponse"
segments, response = parse_thinking_trace(raw)
assert len(segments) == 2
assert segments[0].content == "First thinking"
assert segments[1].content == "Second thought"
def test_parse_thinking_with_empty_response():
raw = "<thinking>Just thinking, no response</thinking>"
segments, response = parse_thinking_trace(raw)
assert len(segments) == 1
assert segments[0].content == "Just thinking, no response"
assert response == ""
if __name__ == "__main__":
test_parse_xml_thinking_tag()
test_parse_xml_thought_tag()
test_parse_text_thinking_prefix()
test_parse_no_thinking()
test_parse_empty_response()
test_parse_multiple_markers()
test_parse_thinking_with_empty_response()
print("All thinking trace tests passed!")