#!/bin/bash # Launch The-Tired-AGI Frontend # Interactive architecture visualization set -e SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" AGI_HOME="$(dirname "$SCRIPT_DIR")" FRONTEND_DIR="$AGI_HOME/frontend" GOSSIP_BIN="$AGI_HOME/gossip/gossipd" echo "╔════════════════════════════════════════════════════════╗" echo "║ 🧠 The-Tired-AGI Frontend Launcher ║" echo "╚════════════════════════════════════════════════════════╝" echo "" # Check if gossip service is running if ! curl -s -m 2 http://localhost:8008/stats > /dev/null 2>&1; then echo "⚠️ Gossip service not detected on port 8008" echo "Starting gossip service..." if [ ! -f "$GOSSIP_BIN" ]; then echo "❌ Gossip binary not found at $GOSSIP_BIN" echo "Building gossip service..." cd "$AGI_HOME/gossip" go build -o gossipd main.go echo "✅ Gossip service built" fi # Start gossip service in background cd "$AGI_HOME/gossip" nohup ./gossipd > "$AGI_HOME/logs/gossip.log" 2>&1 & GOSSIP_PID=$! echo "✅ Gossip service started (PID: $GOSSIP_PID)" # Wait for it to be ready sleep 2 else echo "✅ Gossip service already running" fi # Check if frontend server is built if [ ! -f "$FRONTEND_DIR/frontend_server" ]; then echo "Building frontend server..." cd "$FRONTEND_DIR" go build -o frontend_server server.go echo "✅ Frontend server built" fi # Launch frontend cd "$FRONTEND_DIR" echo "" echo "╔════════════════════════════════════════════════════════╗" echo "║ 🌐 Starting Frontend Server ║" echo "╚════════════════════════════════════════════════════════╝" echo "" echo " 📍 Frontend: http://localhost:3000" echo " 📍 API: http://localhost:8008" echo "" echo "Press Ctrl+C to stop" echo "" ./frontend_server