diff --git a/.slop_cache/summary_cache.json b/.slop_cache/summary_cache.json index af283ed..8018466 100644 --- a/.slop_cache/summary_cache.json +++ b/.slop_cache/summary_cache.json @@ -14,5 +14,61 @@ "C:\\projects\\manual_slop\\tests\\test_saved_presets_sim.py": { "hash": "4b059b49282ecaede5171f4e0ad0ca789d00f9794b4c8e7bea1b95b7cd66c3b4", "summary": "This Python file contains tests for the preset management functionality of the `manual_slop` application, specifically focusing on how global and project-specific presets are loaded, applied, and managed through a GUI interface.\n\n* **Environment Setup:** Initializes a temporary workspace with necessary configuration files for testing.\n* **Preset Switching:** Tests the ability to apply global and project presets, verifying that project-specific presets can override global ones and that selecting \"None\" correctly clears the active preset.\n* **Preset Manager Modal:** Simulates interactions with a modal to create and delete presets, verifying that changes are correctly persisted to the respective TOML files.\n\n**Outline:**\n**Python** \u2014 167 lines\nimports: json, os, pathlib, pytest, shutil, src, time, tomli_w, tomllib\nfunctions: test_env_setup, test_preset_switching, test_preset_manager_modal" + }, + "C:\\projects\\manual_slop\\conductor\\product.md": { + "hash": "7f8036b634e92710f64641bd82f8d4804fd630af0fc0e02eafd42ca0b57bc0c4", + "summary": "\"Manual Slop\" is an expert-level developer utility designed for small projects, offering granular manual control over vendor API metrics, agent capabilities, and context memory. Its key features include a 4-tier hierarchical multi-model architecture, strict memory siloing with AST-based interface extraction, explicit execution control, and parallel multi-agent/tool execution, all managed through a comprehensive observability dashboard.\n\n**Outline:**\n**Markdown** \u2014 113 lines\nheadings:\n Product Guide: Manual Slop\n Vision\n Architecture Reference\n Primary Use Cases\n Key Features" + }, + "C:\\projects\\manual_slop\\conductor\\tracks\\data_oriented_optimization_20260312\\plan.md": { + "hash": "5fa509d92864e7c084b1709ab11f0be93ec761a38d3dd58ab0727fdeb5d64f86", + "summary": "This document outlines a four-phase plan to optimize Python code for data-oriented performance. The plan involves establishing guidelines, profiling existing code, refactoring identified bottlenecks, and finally evaluating the results and documenting further optimization opportunities.\n\n**Outline:**\n**Markdown** \u2014 27 lines\nheadings:\n Implementation Plan: Data-Oriented Python Optimization Pass\n Phase 1: Guidelines and Instrumentation\n Phase 2: Audit and Profiling (`src/` and `simulation/`)\n Phase 3: Targeted Optimization and Refactoring\n Phase 4: Final Evaluation and Documentation" + }, + "C:\\projects\\manual_slop\\src\\performance_monitor.py": { + "hash": "831716b8010ca0ce571d52db1fe1030a57e6027c276cca819d41d571ed634299", + "summary": "This module implements a thread-safe `PerformanceMonitor` singleton for real-time tracking of application performance metrics, including FPS, frame times, and CPU usage, with efficient O(1) moving averages.\n\n* **Core Functionality:** Tracks FPS, frame duration, and CPU utilization.\n* **Component Timing:** Allows timing of specific code sections using `start_component`/`end_component`.\n* **Moving Averages:** Utilizes `deque` and running sums for efficient O(1) calculation of rolling averages.\n* **CPU Monitoring:** Employs a background thread to periodically poll CPU percentage.\n* **Singleton Pattern:** Accessible globally via the `get_monitor()` function.\n\n**Outline:**\n**Python** \u2014 235 lines\nimports: __future__, collections, psutil, threading, time, typing\nclass PerformanceMonitor: __init__, _monitor_cpu, _add_to_history, _get_avg, start_frame, end_frame, start_component, end_component, get_metrics, get_history, stop\nfunctions: get_monitor" + }, + "C:\\projects\\manual_slop\\tests\\test_performance_monitor.py": { + "hash": "19d4b8a0e105e6549da69400b23fb31cc0dd11a3694fa273c78863034e58e8d3", + "summary": "This file contains unit tests for the `PerformanceMonitor` class, verifying its ability to track frame and component-specific execution times.\n\n* Tests basic frame timing.\n* Tests timing of individual components within a frame.\n\n**Outline:**\n**Python** \u2014 28 lines\nimports: os, performance_monitor, sys, time\nfunctions: test_perf_monitor_basic_timing, test_perf_monitor_component_timing" + }, + "C:\\projects\\manual_slop\\src\\events.py": { + "hash": "ae440a6eb72b5cd76253c70a012aace900890b9dafe5027e341c69a5423fdefa", + "summary": "**Python** \u2014 161 lines\nimports: queue, typing\nclass EventEmitter: __init__, on, emit, clear\nclass AsyncEventQueue: __init__, put, get, empty, task_done, join\nclass UserRequestEvent: __init__, to_dict" + }, + "C:\\Users\\Ed\\AppData\\Local\\Temp\\pytest-of-Ed\\pytest-843\\test_auto_aggregate_skip0\\file1.txt": { + "hash": "d0b425e00e15a0d36b9b361f02bab63563aed6cb4665083905386c55d5b679fa", + "summary": "This document, `file1.txt`, contains a single line of text: \"content1\". Its purpose appears to be to hold this specific piece of content.\n\n**Outline:**\n**TXT** \u2014 1 lines\npreview:\n```\ncontent1\n```" + }, + "C:\\Users\\Ed\\AppData\\Local\\Temp\\pytest-of-Ed\\pytest-843\\test_force_full0\\other.txt": { + "hash": "04d61c0832f9cbc2a210334352425d2519890a0a5945da96ccc5bd9ff101c4d3", + "summary": "This document is a simple text file containing ten lines of content, with the first eight lines previewed. Its purpose appears to be for basic data storage or as a placeholder.\n\n**Outline:**\n**TXT** \u2014 10 lines\npreview:\n```\nline1\nline2\nline3\nline4\nline5\nline6\nline7\nline8\n```" + }, + "C:\\Users\\Ed\\AppData\\Local\\Temp\\pytest-of-Ed\\pytest-844\\test_auto_aggregate_skip0\\file1.txt": { + "hash": "d0b425e00e15a0d36b9b361f02bab63563aed6cb4665083905386c55d5b679fa", + "summary": "This document contains a single line of text, \"content1\". Its purpose is to present this specific content.\n\n**Outline:**\n**TXT** \u2014 1 lines\npreview:\n```\ncontent1\n```" + }, + "C:\\Users\\Ed\\AppData\\Local\\Temp\\pytest-of-Ed\\pytest-844\\test_force_full0\\other.txt": { + "hash": "04d61c0832f9cbc2a210334352425d2519890a0a5945da96ccc5bd9ff101c4d3", + "summary": "This document is a plain text file containing ten lines of content, with the first eight lines previewed. Its purpose appears to be simply to store and present this sequential text.\n\n**Outline:**\n**TXT** \u2014 10 lines\npreview:\n```\nline1\nline2\nline3\nline4\nline5\nline6\nline7\nline8\n```" + }, + "other.py": { + "hash": "0f8d9a2c864001b5c6492122310ba2a1346db67609fe815c070cab8a548ce27f", + "summary": "This file appears to contain invalid Python syntax, preventing its analysis.\n\n* **Primary Responsibility:** Undetermined due to syntax errors.\n* **Key Components:** None identifiable.\n\n**Outline:**\n**Python** \u2014 1 lines\n_Parse error: invalid syntax (other.py, line 1)_" + }, + "tier3_file.txt": { + "hash": "1e55d54976d9d709d6f0a029a6761c4c9bee2250c9ce68c4804349f27ab210cb", + "summary": "This document, titled \"Full Tier 3 Content,\" appears to be a placeholder or a basic structure containing ten lines of text. Its primary purpose is likely to serve as a template or a minimal content example.\n\n**Outline:**\n**TXT** \u2014 10 lines\npreview:\n```\nFull Tier 3 Content\nLine 2\nLine 3\nLine 4\nLine 5\nLine 6\nLine 7\nLine 8\n```" + }, + "other.txt": { + "hash": "cb3b5cb91da29dfdd685b44a33c6629e66505a691b2459e20dd556a705ec7cb8", + "summary": "This document, titled \"Other Content,\" contains ten lines of text. It appears to be a simple placeholder or a list of generic content lines.\n\n**Outline:**\n**TXT** \u2014 10 lines\npreview:\n```\nOther Content\nLine 2\nLine 3\nLine 4\nLine 5\nLine 6\nLine 7\nLine 8\n```" + }, + "tier1_file.txt": { + "hash": "3ce2c835f9705e6eb4ccf87d7a4ed9d9f2b91659712beb0618d7009215a84792", + "summary": "This document, titled \"Full Tier 1 Content,\" appears to be a placeholder or introductory text, with its primary content being \"Line 2.\"\n\n**Outline:**\n**TXT** \u2014 2 lines\npreview:\n```\nFull Tier 1 Content\nLine 2\n```" + }, + "C:\\projects\\manual_slop\\src\\multi_agent_conductor.py": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "summary": "This Python module orchestrates the execution of multiple agents, managing their interactions and coordinating their tasks to achieve a common goal.\n\n* Manages agent lifecycle and communication.\n* Facilitates task delegation and result aggregation.\n* Implements a central control loop for agent coordination.\n\n**Outline:**\n**Python** \u2014 0 lines" } } \ No newline at end of file diff --git a/scripts/audit_entropy.py b/scripts/audit_entropy.py new file mode 100644 index 0000000..031f333 --- /dev/null +++ b/scripts/audit_entropy.py @@ -0,0 +1,69 @@ +import os +import re +import ast +from collections import Counter + +def audit_file(path): + with open(path, 'r', encoding='utf-8') as f: + lines = f.readlines() + content = "".join(lines) + + findings = [] + + # 1. Detect multiple identical import lines + imports = [line.strip() for line in lines if line.strip().startswith('import ')] + import_counts = Counter(imports) + for imp, count in import_counts.items(): + if count > 1: + findings.append(f"Duplicate import: '{imp}' ({count} times)") + + # 2. Detect multiple 'from X import Y' lines for the same module X and symbol Y + from_imports = [line.strip() for line in lines if line.strip().startswith('from ')] + from_counts = Counter(from_imports) + for imp, count in from_counts.items(): + if count > 1: + findings.append(f"Duplicate from-import: '{imp}' ({count} times)") + + # 3. Detect mixed indentation (look for 4-space blocks) + four_spaces = " " + for i, line in enumerate(lines): + if line.startswith(four_spaces): + findings.append(f"Mixed indentation: 4-space block found at line {i+1}") + break # Only report once per file + + # 4. List all functions and classes that appear more than once + try: + tree = ast.parse(content) + defs = [] + for node in ast.walk(tree): + if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef, ast.ClassDef)): + defs.append(node.name) + + def_counts = Counter(defs) + for name, count in def_counts.items(): + if count > 1: + findings.append(f"Duplicate definition: '{name}' ({count} times)") + except Exception as e: + findings.append(f"AST Parse Error: {e}") + + return findings + +def main(): + src_dir = 'src' + if not os.path.exists(src_dir): + print(f"Directory {src_dir} not found.") + return + + for root, dirs, files in os.walk(src_dir): + for file in files: + if file.endswith('.py'): + path = os.path.join(root, file) + findings = audit_file(path) + if findings: + print(f"--- {path} ---") + for f in findings: + print(f" {f}") + print() + +if __name__ == "__main__": + main() diff --git a/src/gui_2.py b/src/gui_2.py index 3ef35ff..2596f44 100644 --- a/src/gui_2.py +++ b/src/gui_2.py @@ -4093,44 +4093,44 @@ def hello(): elif self.active_tickets: track_stats = project_manager.calculate_track_progress(self.active_tickets) - total_cost = 0.0 - for usage in self.mma_tier_usage.values(): - model = usage.get('model', 'unknown') - in_t = usage.get('input', 0) - out_t = usage.get('output', 0) - total_cost += cost_tracker.estimate_cost(model, in_t, out_t) + total_cost = 0.0 + for usage in self.mma_tier_usage.values(): + model = usage.get('model', 'unknown') + in_t = usage.get('input', 0) + out_t = usage.get('output', 0) + total_cost += cost_tracker.estimate_cost(model, in_t, out_t) - imgui.text("Track:") + imgui.text("Track:") + imgui.same_line() + imgui.text_colored(C_VAL, track_name) + imgui.same_line() + imgui.text(" | Status:") + imgui.same_line() + if self.mma_status == "paused": + c = imgui.ImVec4(1, 0.5, 0, 1) + if is_nerv: c = vec4(255, 152, 48) + imgui.text_colored(c, "PIPELINE PAUSED") imgui.same_line() - imgui.text_colored(C_VAL, track_name) - imgui.same_line() - imgui.text(" | Status:") - imgui.same_line() - if self.mma_status == "paused": - c = imgui.ImVec4(1, 0.5, 0, 1) - if is_nerv: c = vec4(255, 152, 48) - imgui.text_colored(c, "PIPELINE PAUSED") - imgui.same_line() - status_col = imgui.ImVec4(1, 1, 1, 1) - if self.mma_status == "idle": status_col = imgui.ImVec4(0.7, 0.7, 0.7, 1) - elif self.mma_status == "running": status_col = imgui.ImVec4(1, 1, 0, 1) - elif self.mma_status == "done": status_col = imgui.ImVec4(0, 1, 0, 1) - elif self.mma_status == "error": status_col = imgui.ImVec4(1, 0, 0, 1) - elif self.mma_status == "paused": status_col = imgui.ImVec4(1, 0.5, 0, 1) - - if is_nerv: - if self.mma_status == "running": status_col = vec4(80, 255, 80) # DATA_GREEN - elif self.mma_status == "error": status_col = vec4(255, 72, 64) # ALERT_RED - - imgui.text_colored(status_col, self.mma_status.upper()) - imgui.same_line() - imgui.text(" | Cost:") - imgui.same_line() - imgui.text_colored(imgui.ImVec4(0, 1, 0, 1), f"${total_cost:,.4f}") + status_col = imgui.ImVec4(1, 1, 1, 1) + if self.mma_status == "idle": status_col = imgui.ImVec4(0.7, 0.7, 0.7, 1) + elif self.mma_status == "running": status_col = imgui.ImVec4(1, 1, 0, 1) + elif self.mma_status == "done": status_col = imgui.ImVec4(0, 1, 0, 1) + elif self.mma_status == "error": status_col = imgui.ImVec4(1, 0, 0, 1) + elif self.mma_status == "paused": status_col = imgui.ImVec4(1, 0.5, 0, 1) + + if is_nerv: + if self.mma_status == "running": status_col = vec4(80, 255, 80) # DATA_GREEN + elif self.mma_status == "error": status_col = vec4(255, 72, 64) # ALERT_RED + + imgui.text_colored(status_col, self.mma_status.upper()) + imgui.same_line() + imgui.text(" | Cost:") + imgui.same_line() + imgui.text_colored(imgui.ImVec4(0, 1, 0, 1), f"${total_cost:,.4f}") - # Progress Bar - perc = track_stats["percentage"] / 100.0 - p_color = imgui.ImVec2(0.0, 1.0) # WAIT WRONG TYPE + # Progress Bar + perc = track_stats["percentage"] / 100.0 + p_color = imgui.ImVec2(0.0, 1.0) # WAIT WRONG TYPE p_color = imgui.ImVec4(0.0, 1.0, 0.0, 1.0) if track_stats["percentage"] < 33: