feat: Add collaboration server and testing scripts

- Introduced a new script to launch yaze-server, including checks for server directory, Node.js installation, and npm dependencies.
- Added a test script for APU/SPC700 boot sequence debugging to filter and display critical APU events during execution.
- Created a GUI automation tools test script to verify tool registration, dispatcher handling, and environment checks for GUI-related functionalities.
This commit is contained in:
scawful
2025-10-08 00:30:30 -04:00
parent 68523dbee4
commit fc1550a8dc
3 changed files with 181 additions and 0 deletions

55
scripts/start_collab_server.sh Executable file
View File

@@ -0,0 +1,55 @@
#!/usr/bin/env bash
# YAZE Collaboration Server Launcher
# Starts the WebSocket collaboration server for networked YAZE sessions
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
SERVER_DIR="$PROJECT_ROOT/../yaze-server"
# Colors for output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
echo -e "${GREEN}🚀 YAZE Collaboration Server Launcher${NC}"
echo ""
# Check if server directory exists
if [ ! -d "$SERVER_DIR" ]; then
echo -e "${RED}Error: Collaboration server not found at $SERVER_DIR${NC}"
echo "Please ensure yaze-server is cloned alongside the yaze repository."
exit 1
fi
cd "$SERVER_DIR"
# Check if Node.js is installed
if ! command -v node &> /dev/null; then
echo -e "${RED}Error: Node.js is not installed${NC}"
echo "Please install Node.js from https://nodejs.org/"
exit 1
fi
# Check if npm packages are installed
if [ ! -d "node_modules" ]; then
echo -e "${YELLOW}Installing server dependencies...${NC}"
npm install
fi
# Get port from argument or use default
PORT="${1:-8765}"
echo -e "${GREEN}Starting collaboration server on port $PORT...${NC}"
echo ""
echo "Server will be accessible at:"
echo " • ws://localhost:$PORT (local)"
echo " • ws://$(hostname):$PORT (network)"
echo ""
echo -e "${YELLOW}Press Ctrl+C to stop the server${NC}"
echo ""
# Start the server
PORT="$PORT" node server.js

25
scripts/test_apu_boot.sh Executable file
View File

@@ -0,0 +1,25 @@
#!/bin/bash
# Test script for APU/SPC700 boot sequence debugging
# Runs yaze with specific filters to show only critical APU events
cd /Users/scawful/Code/yaze
echo "========================================="
echo "Testing ALTTP APU Boot Sequence"
echo "========================================="
echo ""
# Run yaze and filter for key events
./build/bin/yaze.app/Contents/MacOS/yaze 2>&1 | \
grep -E "(Frame [0-9]+: CPU|SPC wrote port.*F4|MOVSY writing|CPU read.*2140.*=.*(AA|BB|CC|01|02)|CPU wrote.*214[012]|TRANSFER LOOP.*FFDF)" | \
head -100
echo ""
echo "========================================="
echo "Test complete - check output above for:"
echo "1. Initial handshake ($AA/$BB)"
echo "2. Command echo ($CC)"
echo "3. Counter acknowledgments ($00, $01, $02...)"
echo "4. CPU progress beyond $88xx range"
echo "========================================="

101
scripts/test_gui_tools.sh Executable file
View File

@@ -0,0 +1,101 @@
#!/bin/bash
# Quick test script for GUI automation tools
echo "=== Testing GUI Automation Tools ==="
echo ""
# Set up environment
export AI_PROVIDER=mock
export MOCK_RESPONSE="Testing GUI tools"
cd /Users/scawful/Code/yaze
echo "1. Testing gui-discover tool..."
echo "Query: What buttons are available?"
# This would normally trigger the AI to call gui-discover
# For now, we'll just verify the tool exists in the dispatcher
echo ""
echo "2. Testing gui-click tool..."
echo "Query: Click the Draw button"
echo ""
echo "3. Testing gui-place-tile tool..."
echo "Query: Place a tree at position 10, 15"
echo ""
echo "4. Testing gui-screenshot tool..."
echo "Query: Show me a screenshot"
echo ""
echo "=== Tool Registration Check ==="
echo "Checking if tools are registered in prompt_catalogue.yaml..."
grep -c "gui-place-tile" assets/agent/prompt_catalogue.yaml && echo "✓ gui-place-tile found"
grep -c "gui-click" assets/agent/prompt_catalogue.yaml && echo "✓ gui-click found"
grep -c "gui-discover" assets/agent/prompt_catalogue.yaml && echo "✓ gui-discover found"
grep -c "gui-screenshot" assets/agent/prompt_catalogue.yaml && echo "✓ gui-screenshot found"
echo ""
echo "=== Tool Dispatcher Check ==="
echo "Checking if tools are handled in tool_dispatcher.cc..."
grep -c "gui-place-tile" src/cli/service/agent/tool_dispatcher.cc && echo "✓ gui-place-tile dispatcher entry found"
grep -c "gui-click" src/cli/service/agent/tool_dispatcher.cc && echo "✓ gui-click dispatcher entry found"
grep -c "gui-discover" src/cli/service/agent/tool_dispatcher.cc && echo "✓ gui-discover dispatcher entry found"
grep -c "gui-screenshot" src/cli/service/agent/tool_dispatcher.cc && echo "✓ gui-screenshot dispatcher entry found"
echo ""
echo "=== Handler Implementation Check ==="
echo "Checking if handlers are implemented..."
grep -c "HandleGuiPlaceTileCommand" src/cli/handlers/agent/gui_tool_commands.cc && echo "✓ HandleGuiPlaceTileCommand implemented"
grep -c "HandleGuiClickCommand" src/cli/handlers/agent/gui_tool_commands.cc && echo "✓ HandleGuiClickCommand implemented"
grep -c "HandleGuiDiscoverToolCommand" src/cli/handlers/agent/gui_tool_commands.cc && echo "✓ HandleGuiDiscoverToolCommand implemented"
grep -c "HandleGuiScreenshotCommand" src/cli/handlers/agent/gui_tool_commands.cc && echo "✓ HandleGuiScreenshotCommand implemented"
echo ""
echo "=== System Prompt Check ==="
if [ -f "assets/agent/gui_automation_instructions.txt" ]; then
echo "✓ GUI automation instructions found"
echo " Lines: $(wc -l < assets/agent/gui_automation_instructions.txt)"
else
echo "✗ GUI automation instructions not found"
fi
echo ""
echo "=== Build Check ==="
if [ -f "build/bin/z3ed" ]; then
echo "✓ z3ed binary exists"
ls -lh build/bin/z3ed | awk '{print " Size:", $5}'
else
echo "✗ z3ed binary not found"
fi
echo ""
echo "=== Environment Check ==="
echo "Ollama availability:"
if command -v ollama &> /dev/null; then
echo " ✓ ollama command found"
ollama list 2>/dev/null | head -5 || echo " (ollama not running)"
else
echo " ✗ ollama not installed"
echo " Install with: brew install ollama"
fi
echo ""
echo "Gemini API key:"
if [ -n "$GEMINI_API_KEY" ]; then
echo " ✓ GEMINI_API_KEY is set"
else
echo " ⚠ GEMINI_API_KEY not set (optional)"
fi
echo ""
echo "=== Ready to Test! ==="
echo ""
echo "To start testing:"
echo "1. Terminal 1: ./build/bin/yaze assets/zelda3.sfc --enable-test-harness"
echo "2. Terminal 2: export AI_PROVIDER=ollama && ./build/bin/z3ed agent chat --rom assets/zelda3.sfc"
echo "3. Try: 'What buttons are available in the Overworld editor?'"
echo ""
echo "Or use Gemini:"
echo "2. Terminal 2: export AI_PROVIDER=gemini && export GEMINI_API_KEY='...' && ./build/bin/z3ed agent chat --rom assets/zelda3.sfc"
echo ""