diff --git a/api_hook_client.py b/api_hook_client.py index 88c8bd4..d0251f2 100644 --- a/api_hook_client.py +++ b/api_hook_client.py @@ -1,4 +1,4 @@ -from __future__ import annotations +from __future__ import annotations import requests import json import time @@ -60,7 +60,7 @@ class ApiHookClient: """Checks the health of the hook server.""" url = f"{self.base_url}/status" try: - response = requests.get(url, timeout=0.2) + response = requests.get(url, timeout=5.0) response.raise_for_status() return response.json() except Exception: @@ -242,3 +242,4 @@ class ApiHookClient: data={'type': 'tool_approval', 'tool': tool_name, 'args': args}, timeout=60.0) return res.get('response') + diff --git a/api_hooks.py b/api_hooks.py index d5fd907..7ed9f4e 100644 --- a/api_hooks.py +++ b/api_hooks.py @@ -1,4 +1,4 @@ -from __future__ import annotations +from __future__ import annotations import json import threading import uuid @@ -9,14 +9,12 @@ import session_logger class HookServerInstance(ThreadingHTTPServer): """Custom HTTPServer that carries a reference to the main App instance.""" - -def __init__(self, server_address: tuple[str, int], RequestHandlerClass: type, app: Any) -> None: - super().__init__(server_address, RequestHandlerClass) - self.app = app + def __init__(self, server_address: tuple[str, int], RequestHandlerClass: type, app: Any) -> None: + super().__init__(server_address, RequestHandlerClass) + self.app = app class HookHandler(BaseHTTPRequestHandler): """Handles incoming HTTP requests for the API hooks.""" - def do_GET(self) -> None: app = self.server.app session_logger.log_api_hook("GET", self.path, "") @@ -84,7 +82,7 @@ class HookHandler(BaseHTTPRequestHandler): "action": "custom_callback", "callback": get_val }) - if event.wait(timeout=2): + if event.wait(timeout=60): self.send_response(200) self.send_header('Content-Type', 'application/json') self.end_headers() @@ -110,7 +108,7 @@ class HookHandler(BaseHTTPRequestHandler): "action": "custom_callback", "callback": get_val }) - if event.wait(timeout=2): + if event.wait(timeout=60): self.send_response(200) self.send_header('Content-Type', 'application/json') self.end_headers() @@ -137,7 +135,7 @@ class HookHandler(BaseHTTPRequestHandler): "action": "custom_callback", "callback": get_mma }) - if event.wait(timeout=2): + if event.wait(timeout=60): self.send_response(200) self.send_header('Content-Type', 'application/json') self.end_headers() @@ -164,7 +162,7 @@ class HookHandler(BaseHTTPRequestHandler): "action": "custom_callback", "callback": check_all }) - if event.wait(timeout=2): + if event.wait(timeout=60): self.send_response(200) self.send_header('Content-Type', 'application/json') self.end_headers() @@ -318,3 +316,5 @@ class HookServer: if self.thread: self.thread.join() logging.info("Hook server stopped") + + diff --git a/config.toml b/config.toml index 3c18711..11b6d73 100644 --- a/config.toml +++ b/config.toml @@ -22,7 +22,7 @@ paths = [ "C:\\projects\\manual_slop\\tests\\temp_livetoolssim.toml", "C:\\projects\\manual_slop\\tests\\temp_liveexecutionsim.toml", ] -active = "C:\\projects\\manual_slop\\tests\\temp_liveexecutionsim.toml" +active = "C:\\projects\\manual_slop\\tests\\temp_project.toml" [gui.show_windows] "Context Hub" = true diff --git a/hello.ps1 b/hello.ps1 new file mode 100644 index 0000000..e8c9f08 --- /dev/null +++ b/hello.ps1 @@ -0,0 +1 @@ +Write-Host "Simulation Test" diff --git a/manualslop_layout.ini b/manualslop_layout.ini index 7904be5..9fe7a37 100644 --- a/manualslop_layout.ini +++ b/manualslop_layout.ini @@ -79,7 +79,7 @@ DockId=0x0000000F,2 [Window][Theme] Pos=0,17 -Size=393,824 +Size=632,824 Collapsed=0 DockId=0x00000005,1 @@ -89,14 +89,14 @@ Size=900,700 Collapsed=0 [Window][Diagnostics] -Pos=395,17 -Size=734,545 +Pos=634,17 +Size=911,643 Collapsed=0 DockId=0x00000010,0 [Window][Context Hub] Pos=0,17 -Size=393,824 +Size=632,824 Collapsed=0 DockId=0x00000005,0 @@ -107,26 +107,26 @@ Collapsed=0 DockId=0x0000000D,0 [Window][Discussion Hub] -Pos=1131,17 -Size=549,1183 +Pos=1547,17 +Size=879,1395 Collapsed=0 DockId=0x00000004,0 [Window][Operations Hub] -Pos=395,17 -Size=734,545 +Pos=634,17 +Size=911,643 Collapsed=0 DockId=0x00000010,1 [Window][Files & Media] Pos=0,843 -Size=393,357 +Size=632,569 Collapsed=0 DockId=0x00000006,1 [Window][AI Settings] Pos=0,843 -Size=393,357 +Size=632,569 Collapsed=0 DockId=0x00000006,0 @@ -136,14 +136,14 @@ Size=416,325 Collapsed=0 [Window][MMA Dashboard] -Pos=395,564 -Size=734,636 +Pos=634,662 +Size=911,750 Collapsed=0 DockId=0x00000011,0 [Window][Log Management] -Pos=1131,17 -Size=549,1183 +Pos=1547,17 +Size=879,1395 Collapsed=0 DockId=0x00000004,1 @@ -163,24 +163,30 @@ Column 4 Weight=0.6084 Column 5 Weight=0.4425 Column 6 Weight=1.0079 +[Table][0x5D780033,4] +Column 0 Weight=1.0000 +Column 1 Weight=1.0000 +Column 2 Weight=1.0000 +Column 3 Weight=1.0000 + [Docking][Data] DockNode ID=0x00000008 Pos=3125,170 Size=593,1157 Split=Y DockNode ID=0x00000009 Parent=0x00000008 SizeRef=1029,147 Selected=0x0469CA7A DockNode ID=0x0000000A Parent=0x00000008 SizeRef=1029,145 Selected=0xDF822E02 -DockSpace ID=0xAFC85805 Window=0x079D3A04 Pos=0,17 Size=1680,1183 Split=Y +DockSpace ID=0xAFC85805 Window=0x079D3A04 Pos=0,17 Size=2426,1395 Split=Y DockNode ID=0x0000000C Parent=0xAFC85805 SizeRef=1362,1041 Split=X Selected=0x5D11106F - DockNode ID=0x00000003 Parent=0x0000000C SizeRef=1129,1183 Split=X + DockNode ID=0x00000003 Parent=0x0000000C SizeRef=1545,1183 Split=X DockNode ID=0x0000000B Parent=0x00000003 SizeRef=404,1186 Split=Y Selected=0xF4139CA2 DockNode ID=0x00000002 Parent=0x0000000B SizeRef=1029,1119 Split=X Selected=0xF4139CA2 - DockNode ID=0x00000007 Parent=0x00000002 SizeRef=393,858 Split=Y Selected=0x8CA2375C + DockNode ID=0x00000007 Parent=0x00000002 SizeRef=632,858 Split=Y Selected=0x8CA2375C DockNode ID=0x00000005 Parent=0x00000007 SizeRef=295,824 Selected=0xF4139CA2 DockNode ID=0x00000006 Parent=0x00000007 SizeRef=295,724 CentralNode=1 Selected=0x7BD57D6A - DockNode ID=0x0000000E Parent=0x00000002 SizeRef=734,858 Split=Y Selected=0x418C7449 - DockNode ID=0x00000010 Parent=0x0000000E SizeRef=868,545 Selected=0xB4CBF21A + DockNode ID=0x0000000E Parent=0x00000002 SizeRef=911,858 Split=Y Selected=0x418C7449 + DockNode ID=0x00000010 Parent=0x0000000E SizeRef=868,545 Selected=0x418C7449 DockNode ID=0x00000011 Parent=0x0000000E SizeRef=868,636 Selected=0x3AEC3498 DockNode ID=0x00000001 Parent=0x0000000B SizeRef=1029,775 Selected=0x8B4EBFA6 DockNode ID=0x0000000D Parent=0x00000003 SizeRef=435,1186 Selected=0x363E93D6 - DockNode ID=0x00000004 Parent=0x0000000C SizeRef=549,1183 Selected=0x6F2B5B04 + DockNode ID=0x00000004 Parent=0x0000000C SizeRef=879,1183 Selected=0x6F2B5B04 DockNode ID=0x0000000F Parent=0xAFC85805 SizeRef=1362,451 Selected=0xDD6419BC ;;;<<>>;;; diff --git a/project_history.toml b/project_history.toml index 84c0a21..0472942 100644 --- a/project_history.toml +++ b/project_history.toml @@ -8,5 +8,5 @@ active = "main" [discussions.main] git_commit = "" -last_updated = "2026-02-28T19:35:01" +last_updated = "2026-02-28T20:41:51" history = [] diff --git a/scripts/mma_exec.py b/scripts/mma_exec.py index fade63a..b5a45e4 100644 --- a/scripts/mma_exec.py +++ b/scripts/mma_exec.py @@ -124,7 +124,7 @@ def get_dependencies(filepath: str) -> list[str]: print(f"Error getting dependencies for {filepath}: {e}") return [] -def execute_agent(role: str, prompt: str, docs: list[str]) -> str: +def execute_agent(role: str, prompt: str, docs: list[str], debug: bool = False) -> str: model = get_model_for_role(role) # Advanced Context: Dependency skeletons for Tier 3 injected_context = "" @@ -197,7 +197,20 @@ def execute_agent(role: str, prompt: str, docs: list[str]) -> str: try: env = os.environ.copy() env["GEMINI_CLI_HOOK_CONTEXT"] = "mma_headless" + if debug: + print(f"--- MMA DEBUG ---") + print(f"Executing Command: {cmd}") + print(f"Relevant Environment Variables:") + for key, value in env.items(): + if key.startswith("GEMINI_CLI_"): + print(f" {key}={value}") process = subprocess.run(cmd, input=command_text, capture_output=True, text=True, encoding='utf-8', env=env) + if debug: + print(f"Subprocess Result:") + print(f" Return Code: {process.returncode}") + print(f" Stdout: {process.stdout[:1000]}...") + print(f" Stderr: {process.stderr}") + print(f"--- END DEBUG ---") result = process.stdout if not process.stdout and process.stderr: result = f"Error: {process.stderr}" @@ -231,6 +244,11 @@ def create_parser() -> argparse.ArgumentParser: type=str, help="TOML file defining the task" ) + parser.add_argument( + "--debug", + action="store_true", + help="Enable debug logging" + ) parser.add_argument( "prompt", type=str, @@ -244,6 +262,7 @@ def main() -> None: args = parser.parse_args() role = args.role prompt = args.prompt + debug = args.debug docs = [] if args.task_file and os.path.exists(args.task_file): with open(args.task_file, "rb") as f: @@ -251,6 +270,8 @@ def main() -> None: role = task_data.get("role", role) prompt = task_data.get("prompt", prompt) docs = task_data.get("docs", []) + # Only override debug if it's explicitly set in the task file (optional) + debug = task_data.get("debug", debug) if not role or not prompt: parser.print_help() return @@ -262,8 +283,8 @@ def main() -> None: for ref in file_refs: if os.path.exists(ref) and ref not in docs: docs.append(ref) - print(f"Executing role: {role} with docs: {docs}") - result = execute_agent(role, prompt, docs) + print(f"Executing role: {role} with docs: {docs} (debug={debug})") + result = execute_agent(role, prompt, docs, debug=debug) print(result) if __name__ == "__main__": diff --git a/tests/mock_alias_tool.py b/tests/mock_alias_tool.py index 29262fa..ce94548 100644 --- a/tests/mock_alias_tool.py +++ b/tests/mock_alias_tool.py @@ -1,20 +1,21 @@ import sys, json, os, subprocess prompt = sys.stdin.read() if '"role": "tool"' in prompt: - print(json.dumps({"type": "message", "role": "assistant", "content": "Tool worked!"}), flush=True) - print(json.dumps({"type": "result", "stats": {"total_tokens": 20}}), flush=True) + print(json.dumps({"type": "message", "role": "assistant", "content": "Tool worked!"}), flush=True) + print(json.dumps({"type": "result", "stats": {"total_tokens": 20}}), flush=True) else: -# We must call the bridge to trigger the GUI approval! - tool_call = {"name": "list_directory", "input": {"dir_path": "."}} - bridge_cmd = [sys.executable, "C:/projects/manual_slop/scripts/cli_tool_bridge.py"] - proc = subprocess.Popen(bridge_cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True) - stdout, _ = proc.communicate(input=json.dumps(tool_call)) - # Even if bridge says allow, we emit the tool_use to the adapter - print(json.dumps({"type": "message", "role": "assistant", "content": "I will list the directory."}), flush=True) - print(json.dumps({ - "type": "tool_use", - "name": "list_directory", - "id": "alias_call", - "args": {"dir_path": "."} - }), flush=True) - print(json.dumps({"type": "result", "stats": {"total_tokens": 10}}), flush=True) + # We must call the bridge to trigger the GUI approval! + tool_call = {"name": "list_directory", "input": {"dir_path": "."}} + bridge_cmd = [sys.executable, "C:/projects/manual_slop/scripts/cli_tool_bridge.py"] + proc = subprocess.Popen(bridge_cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True) + stdout, _ = proc.communicate(input=json.dumps(tool_call)) + + # Even if bridge says allow, we emit the tool_use to the adapter + print(json.dumps({"type": "message", "role": "assistant", "content": "I will list the directory."}), flush=True) + print(json.dumps({ + "type": "tool_use", + "name": "list_directory", + "id": "alias_call", + "args": {"dir_path": "."} + }), flush=True) + print(json.dumps({"type": "result", "stats": {"total_tokens": 10}}), flush=True) diff --git a/tests/temp_liveaisettingssim_history.toml b/tests/temp_liveaisettingssim_history.toml index afca435..a7a60e1 100644 --- a/tests/temp_liveaisettingssim_history.toml +++ b/tests/temp_liveaisettingssim_history.toml @@ -10,5 +10,5 @@ auto_add = true [discussions.main] git_commit = "" -last_updated = "2026-02-28T07:35:03" +last_updated = "2026-02-28T20:39:12" history = [] diff --git a/tests/temp_livecontextsim_history.toml b/tests/temp_livecontextsim_history.toml index f27891a..481bbf3 100644 --- a/tests/temp_livecontextsim_history.toml +++ b/tests/temp_livecontextsim_history.toml @@ -6,10 +6,10 @@ roles = [ "Reasoning", ] history = [] -active = "TestDisc_1772282083" +active = "TestDisc_1772329132" auto_add = true -[discussions.TestDisc_1772282083] +[discussions.TestDisc_1772329132] git_commit = "" -last_updated = "2026-02-28T07:34:56" +last_updated = "2026-02-28T20:39:05" history = [] diff --git a/tests/temp_liveexecutionsim_history.toml b/tests/temp_liveexecutionsim_history.toml index 8e7bfbe..a35f9ee 100644 --- a/tests/temp_liveexecutionsim_history.toml +++ b/tests/temp_liveexecutionsim_history.toml @@ -10,5 +10,5 @@ auto_add = true [discussions.main] git_commit = "" -last_updated = "2026-02-28T19:35:01" +last_updated = "2026-02-28T20:41:54" history = [] diff --git a/tests/temp_livetoolssim_history.toml b/tests/temp_livetoolssim_history.toml index f5a0009..4fd9b59 100644 --- a/tests/temp_livetoolssim_history.toml +++ b/tests/temp_livetoolssim_history.toml @@ -10,5 +10,5 @@ auto_add = true [discussions.main] git_commit = "" -last_updated = "2026-02-28T07:35:20" +last_updated = "2026-02-28T20:39:30" history = [] diff --git a/tests/temp_project.toml b/tests/temp_project.toml index 904e0f8..7df3ceb 100644 --- a/tests/temp_project.toml +++ b/tests/temp_project.toml @@ -15,6 +15,8 @@ output_dir = "./md_gen" base_dir = "." paths = [] +[files.tier_assignments] + [screenshots] base_dir = "." paths = [] diff --git a/tests/temp_project_history.toml b/tests/temp_project_history.toml index 4711448..e52f136 100644 --- a/tests/temp_project_history.toml +++ b/tests/temp_project_history.toml @@ -5,18 +5,10 @@ roles = [ "System", "Reasoning", ] -active = "AutoDisc" +active = "main" auto_add = true [discussions.main] git_commit = "" -last_updated = "2026-02-27T18:58:03" -history = [ - "@2026-02-27T18:57:55\nUser:\nHello! This is an automated test. Just say 'Acknowledged'.", - "@2026-02-27T18:58:02\nAI:\nAcknowledged", -] - -[discussions.AutoDisc] -git_commit = "" -last_updated = "2026-02-28T07:34:41" +last_updated = "2026-02-28T20:41:57" history = [] diff --git a/tests/test_gemini_cli_edge_cases.py b/tests/test_gemini_cli_edge_cases.py index 46d4d05..712ab1d 100644 --- a/tests/test_gemini_cli_edge_cases.py +++ b/tests/test_gemini_cli_edge_cases.py @@ -1,4 +1,4 @@ -import pytest +import pytest import time import os import sys @@ -86,7 +86,7 @@ else: client.set_value("ai_input", "Test parameter aliases") client.click("btn_gen_send") # Handle approval - timeout = 15 + timeout = 60 start_time = time.time() approved = False while time.time() - start_time < timeout: @@ -124,7 +124,7 @@ def test_gemini_cli_loop_termination(live_gui: Any) -> None: client.set_value("ai_input", "Perform multi-round tool test") client.click("btn_gen_send") # Handle approvals (mock does one tool call) - timeout = 20 + timeout = 60 start_time = time.time() approved = False while time.time() - start_time < timeout: @@ -148,3 +148,4 @@ def test_gemini_cli_loop_termination(live_gui: Any) -> None: if found_final: break time.sleep(1) assert found_final, "Final message after multi-round tool loop not found" + diff --git a/tests/test_gemini_cli_integration.py b/tests/test_gemini_cli_integration.py index 9c829ce..4b971d3 100644 --- a/tests/test_gemini_cli_integration.py +++ b/tests/test_gemini_cli_integration.py @@ -1,4 +1,4 @@ -from typing import Any +from typing import Any import pytest import time import os @@ -36,7 +36,7 @@ def test_gemini_cli_full_integration(live_gui: Any) -> None: client.click("btn_gen_send") # 3. Monitor for approval events print("[TEST] Waiting for approval events...") - timeout = 45 + timeout = 90 start_time = time.time() approved_count = 0 while time.time() - start_time < timeout: @@ -89,7 +89,7 @@ def test_gemini_cli_rejection_and_history(live_gui: Any) -> None: client.set_value("ai_input", "Deny me") client.click("btn_gen_send") # 3. Wait for event and reject - timeout = 20 + timeout = 60 start_time = time.time() denied = False while time.time() - start_time < timeout: @@ -120,3 +120,4 @@ def test_gemini_cli_rejection_and_history(live_gui: Any) -> None: if rejection_found: break time.sleep(1.0) assert rejection_found, "Rejection message not found in history" + diff --git a/tests/test_vlogger_availability.py b/tests/test_vlogger_availability.py new file mode 100644 index 0000000..0fa0633 --- /dev/null +++ b/tests/test_vlogger_availability.py @@ -0,0 +1,5 @@ +import pytest + +def test_vlogger_available(vlogger): + vlogger.log_state("Test", "Before", "After") + vlogger.finalize("Test Title", "PASS", "Test Result")