Files
APAW/agent-evolution/docker-run.sh
¨NW¨ 15a7b4b7a4 feat: add Agent Evolution Dashboard
- Create agent-evolution/ directory with standalone dashboard
- Add interactive HTML dashboard with agent/model matrix
- Add heatmap view for agent-model compatibility scores
- Add recommendations tab with optimization suggestions
- Add Gitea integration preparation (history timeline)
- Add Docker configuration for deployment
- Add build scripts for standalone HTML generation
- Add sync scripts for agent data synchronization
- Add milestone and issues documentation
- Add skills and rules for evolution sync
- Update AGENTS.md with dashboard documentation
- Update package.json with evolution scripts

Features:
- 28 agents with model assignments and fit scores
- 8 models with benchmarks (SWE-bench, RULER, Terminal)
- 11 recommendations for model optimization
- History timeline with agent changes
- Interactive modal windows for model details
- Filter and search functionality
- Russian language interface
- Works offline (file://) with embedded data

Docker:
- Dockerfile for standalone deployment
- docker-compose.evolution.yml
- docker-run.sh/docker-run.bat scripts

NPM scripts:
- sync:evolution - sync and build dashboard
- evolution:open - open in browser
- evolution:dashboard - start dev server

Status: PAUSED - foundation complete, Gitea integration pending
2026-04-05 19:58:59 +01:00

203 lines
5.4 KiB
Bash

#!/bin/bash
# Agent Evolution Dashboard - Docker Management Script
set -e
IMAGE_NAME="apaw-evolution"
CONTAINER_NAME="apaw-evolution-dashboard"
PORT=3001
DATA_DIR="./agent-evolution/data"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
log_info() { echo -e "${GREEN}[INFO]${NC} $1"; }
log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
# Build Docker image
build() {
log_info "Building Docker image..."
docker build \
-t "$IMAGE_NAME:latest" \
-f agent-evolution/Dockerfile \
--target production \
.
log_info "Build complete: $IMAGE_NAME:latest"
}
# Run container
run() {
# Check if container already running
if docker ps -q --filter "name=$CONTAINER_NAME" | grep -q .; then
log_warn "Container $CONTAINER_NAME is already running"
log_info "Use '$0 restart' to restart it"
exit 0
fi
# Remove stopped container if exists
if docker ps -aq --filter "name=$CONTAINER_NAME" | grep -q .; then
log_info "Removing stopped container..."
docker rm "$CONTAINER_NAME" >/dev/null || true
fi
log_info "Starting container..."
docker run -d \
--name "$CONTAINER_NAME" \
-p "$PORT:3001" \
-v "$(pwd)/$DATA_DIR:/app/data:ro" \
-v "$(pwd)/.kilo/agents:/app/kilo/agents:ro" \
-v "$(pwd)/.kilo/capability-index.yaml:/app/kilo/capability-index.yaml:ro" \
-v "$(pwd)/.kilo/kilo.jsonc:/app/kilo/kilo.jsonc:ro" \
--restart unless-stopped \
--health-cmd "wget --no-verbose --tries=1 --spider http://localhost:3001/ || exit 1" \
--health-interval "30s" \
--health-timeout "10s" \
--health-retries "3" \
"$IMAGE_NAME:latest"
log_info "Container started: $CONTAINER_NAME"
log_info "Dashboard available at: http://localhost:$PORT"
}
# Stop container
stop() {
log_info "Stopping container..."
docker stop "$CONTAINER_NAME" >/dev/null 2>&1 || true
docker rm "$CONTAINER_NAME" >/dev/null 2>&1 || true
log_info "Container stopped"
}
# Restart container
restart() {
stop
build
run
}
# View logs
logs() {
docker logs -f "$CONTAINER_NAME"
}
# Open dashboard in browser
open() {
URL="http://localhost:$PORT"
log_info "Opening dashboard: $URL"
if command -v xdg-open &> /dev/null; then
xdg-open "$URL"
elif command -v open &> /dev/null; then
open "$URL"
elif command -v start &> /dev/null; then
start "$URL"
else
log_warn "Could not open browser. Navigate to: $URL"
fi
}
# Sync evolution data
sync() {
log_info "Syncing evolution data..."
if command -v bun &> /dev/null; then
bun run agent-evolution/scripts/sync-agent-history.ts
elif command -v node &> /dev/null; then
npx tsx agent-evolution/scripts/sync-agent-history.ts
else
log_error "Node.js or Bun required for sync"
exit 1
fi
log_info "Sync complete"
}
# Status check
status() {
if docker ps -q --filter "name=$CONTAINER_NAME" | grep -q .; then
log_info "Container status: ${GREEN}RUNNING${NC}"
log_info "URL: http://localhost:$PORT"
# Health check
HEALTH=$(docker inspect --format='{{.State.Health.Status}}' "$CONTAINER_NAME" 2>/dev/null || echo "unknown")
log_info "Health: $HEALTH"
# Uptime
STARTED=$(docker inspect --format='{{.State.StartedAt}}' "$CONTAINER_NAME" 2>/dev/null)
if [ -n "$STARTED" ] && [ "$STARTED" != "" ]; then
log_info "Started: $STARTED"
fi
else
if docker ps -aq --filter "name=$CONTAINER_NAME" | grep -q .; then
log_info "Container status: ${YELLOW}STOPPED${NC}"
else
log_info "Container status: ${RED}NOT CREATED${NC}"
fi
fi
}
# Clean up
clean() {
log_info "Cleaning up..."
stop
docker rmi "$IMAGE_NAME:latest" >/dev/null 2>&1 || true
log_info "Cleanup complete"
}
# Development mode with hot reload
dev() {
log_info "Starting development mode..."
docker build \
-t "$IMAGE_NAME:dev" \
-f agent-evolution/Dockerfile \
--target development \
.
docker run --rm \
--name "${CONTAINER_NAME}-dev" \
-p "$PORT:3001" \
-v "$(pwd)/$DATA_DIR:/app/data" \
-v "$(pwd)/agent-evolution/index.html:/app/index.html" \
"$IMAGE_NAME:dev"
}
# Show help
show_help() {
echo "Agent Evolution Dashboard - Docker Management"
echo ""
echo "Usage: $0 <command>"
echo ""
echo "Commands:"
echo " build Build Docker image"
echo " run Run container"
echo " stop Stop container"
echo " restart Restart container (build + run)"
echo " logs View container logs"
echo " open Open dashboard in browser"
echo " sync Sync evolution data"
echo " status Show container status"
echo " clean Remove container and image"
echo " dev Run in development mode (with hot reload)"
echo " help Show this help message"
}
# Main
case "${1:-help}" in
build) build ;;
run) run ;;
stop) stop ;;
restart) restart ;;
logs) logs ;;
open) open ;;
sync) sync ;;
status) status ;;
clean) clean ;;
dev) dev ;;
help) show_help ;;
*)
log_error "Unknown command: $1"
show_help
exit 1
;;
esac