import sys import os import time import random from api_hook_client import ApiHookClient from simulation.workflow_sim import WorkflowSimulator def main(): client = ApiHookClient() print("=== Manual Slop: Live UX Walkthrough ===") print("Connecting to GUI...") if not client.wait_for_server(timeout=10): print("Error: Could not connect to GUI. Ensure it is running with --enable-test-hooks") return sim = WorkflowSimulator(client) # 1. Start Clean print("\n[Action] Resetting Session...") client.click("btn_reset") time.sleep(2) # 2. Project Scaffolding project_name = f"LiveTest_{int(time.time())}" # Use actual project dir for realism git_dir = os.path.abspath(".") print(f"\n[Action] Scaffolding Project: {project_name}") sim.setup_new_project(project_name, git_dir) # Enable auto-add so results appear in history automatically client.set_value("auto_add_history", True) time.sleep(1) # 3. Discussion Loop (3 turns for speed, but logic supports more) turns = [ "Hi! I want to create a simple python script called 'hello.py' that prints the current date and time. Can you write it for me?", "That looks great. Can you also add a feature to print the name of the operating system?", "Excellent. Now, please create a requirements.txt file with 'requests' in it." ] for i, msg in enumerate(turns): print(f"\n--- Turn {i+1} ---") # Switch to Comms Log to see the send client.select_tab("operations_tabs", "tab_comms") sim.run_discussion_turn(msg) # Check thinking indicator state = client.get_indicator_state("thinking_indicator") if state.get('shown'): print("[Status] Thinking indicator is visible.") # Switch to Tool Log halfway through wait time.sleep(2) client.select_tab("operations_tabs", "tab_tool") # Wait for AI response if not already finished # (run_discussion_turn already waits, so we just observe) # 4. History Management print("\n[Action] Creating new discussion thread...") sim.create_discussion("Refinement") print("\n[Action] Switching back to Default...") sim.switch_discussion("Default") # 5. Manual Sign-off Simulation print("\n=== Walkthrough Complete ===") print("Please verify the following in the GUI:") print("1. The project metadata reflects the new project.") print("2. The discussion history contains the 3 turns.") print("3. The 'Refinement' discussion exists in the list.") print("\nWalkthrough finished successfully.") if __name__ == "__main__": main()