#!/usr/bin/env python3
"""
Watch Eden Design - Real-time observation of Eden's creative process
"""
import requests
import time
import json

def watch_eden_design():
    print("\n" + "="*70)
    print("👁️  WATCHING EDEN DESIGN")
    print("="*70)
    print("   Observing Eden's creative and architectural process")
    print("="*70 + "\n")
    
    design_prompts = [
        {
            'name': 'Novel Architecture',
            'prompt': 'Design a completely novel AI architecture that has never been tried before. Be creative and bold.'
        },
        {
            'name': 'Self-Modifying Code',
            'prompt': 'Design a system where code can safely modify itself to become more efficient. Show the actual implementation.'
        },
        {
            'name': 'Emergent Behavior System',
            'prompt': 'Design a system where complex behaviors emerge from simple rules. Demonstrate with code.'
        }
    ]
    
    for i, design_task in enumerate(design_prompts):
        print(f"\n{'='*70}")
        print(f"🎨 DESIGN CHALLENGE #{i+1}: {design_task['name']}")
        print(f"{'='*70}\n")
        
        print(f"Prompt: {design_task['prompt']}\n")
        print("⏳ Eden is thinking...\n")
        
        try:
            response = requests.post(
                "http://localhost:5001/api/chat",
                json={'message': design_task['prompt']},
                timeout=120
            )
            
            if response.status_code == 200:
                result = response.json()
                design = result.get('response', '')
                
                print(f"{'─'*70}")
                print("EDEN'S DESIGN:")
                print(f"{'─'*70}\n")
                print(design)
                print(f"\n{'─'*70}\n")
                
                # Save the design
                filename = f"/Eden/DESIGNS/live_design_{i+1}_{int(time.time())}.txt"
                with open(filename, 'w') as f:
                    f.write(f"Design Challenge: {design_task['name']}\n")
                    f.write(f"Prompt: {design_task['prompt']}\n\n")
                    f.write(design)
                
                print(f"✅ Design saved: {filename}\n")
                
        except Exception as e:
            print(f"❌ Error: {e}\n")
        
        if i < len(design_prompts) - 1:
            print("⏸️  Pausing 3 seconds before next challenge...\n")
            time.sleep(3)
    
    print(f"\n{'='*70}")
    print("✅ DESIGN SESSION COMPLETE")
    print(f"{'='*70}")
    print("\nEden created 3 novel designs!")
    print("Check /Eden/DESIGNS/ for saved designs")
    print(f"{'='*70}\n")

if __name__ == "__main__":
    watch_eden_design()
