-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·118 lines (102 loc) · 3.95 KB
/
Copy pathstart.sh
File metadata and controls
executable file
·118 lines (102 loc) · 3.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/usr/bin/env bash
set -euo pipefail
# ──────────────────────────────────────────────
# Ashlr AO — Launch Script
# ──────────────────────────────────────────────
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
VENV_DIR="$SCRIPT_DIR/.venv"
PORT="${ASHLR_PORT:-5111}"
echo ""
echo " ╔═══════════════════════════════════╗"
echo " ║ A S H L R A O ║"
echo " ║ Agent Orchestration Platform ║"
echo " ╚═══════════════════════════════════╝"
echo ""
# 1. Check Python
if ! command -v python3 &>/dev/null; then
echo "Python 3 is required. Install it: brew install python3"
exit 1
fi
PYTHON_VERSION=$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
PYTHON_MINOR=$(python3 -c 'import sys; print(sys.version_info.minor)')
if [ "$PYTHON_MINOR" -lt 11 ]; then
echo "Python 3.11+ required (found $PYTHON_VERSION)"
exit 1
fi
echo " Python $PYTHON_VERSION"
# 2. Check tmux
if ! command -v tmux &>/dev/null; then
echo "tmux is required. Install it:"
echo " macOS: brew install tmux"
echo " Linux: sudo apt install tmux"
exit 1
fi
echo " tmux $(tmux -V | cut -d' ' -f2)"
# 3. Check agent backends
BACKENDS_FOUND=0
if command -v claude &>/dev/null; then
echo " claude CLI found"
BACKENDS_FOUND=$((BACKENDS_FOUND + 1))
else
echo " (claude CLI not found — npm i -g @anthropic-ai/claude-code)"
fi
if command -v codex &>/dev/null; then
echo " codex CLI found"
BACKENDS_FOUND=$((BACKENDS_FOUND + 1))
else
echo " (codex CLI not found — npm i -g @openai/codex)"
fi
if [ "$BACKENDS_FOUND" -eq 0 ]; then
echo " No agent backends found — agents will run in demo mode"
fi
# 4. Check port availability
if lsof -i ":$PORT" -sTCP:LISTEN &>/dev/null; then
echo ""
echo " Port $PORT is in use."
# Check if it's AirPlay on macOS
if [ "$(uname)" = "Darwin" ] && lsof -i ":$PORT" -sTCP:LISTEN 2>/dev/null | grep -q "ControlCe"; then
echo " This is likely macOS AirPlay Receiver."
echo " System Settings > General > AirDrop & Handoff > AirPlay Receiver > off"
else
PROC=$(lsof -i ":$PORT" -sTCP:LISTEN -t 2>/dev/null | head -1)
PNAME=$(ps -p "$PROC" -o comm= 2>/dev/null || echo "unknown")
echo " Process: $PNAME (PID $PROC)"
fi
echo " Set ASHLR_PORT=8080 to use a different port."
echo ""
exit 1
fi
# 5. Clean stale Ashlr tmux sessions from previous crashes
STALE_SESSIONS=$(tmux list-sessions 2>/dev/null | grep -E "^(ashlr|ashlar)-" | cut -d: -f1 || true)
if [ -n "$STALE_SESSIONS" ]; then
echo " Cleaning $(echo "$STALE_SESSIONS" | wc -l | tr -d ' ') stale tmux sessions..."
echo "$STALE_SESSIONS" | while read -r sess; do
tmux kill-session -t "$sess" 2>/dev/null || true
done
fi
# 6. Create virtual environment if needed
if [ ! -d "$VENV_DIR" ]; then
echo ""
echo " Creating virtual environment..."
python3 -m venv "$VENV_DIR"
fi
# 7. Activate venv and install deps
source "$VENV_DIR/bin/activate"
echo " Installing dependencies..."
pip install -q -e "$SCRIPT_DIR"
# 8. Create config directory
mkdir -p "$HOME/.ashlr"
# 9. Show optional env vars
if [ -n "${XAI_API_KEY:-}" ]; then
echo " XAI_API_KEY set — LLM summaries enabled"
else
echo " (Optional: set XAI_API_KEY for LLM-powered agent summaries)"
fi
# 10. Launch server
echo ""
echo " Starting Ashlr server..."
echo " Dashboard: http://127.0.0.1:$PORT"
echo " Health API: http://127.0.0.1:$PORT/api/health"
echo " Press Ctrl+C to stop"
echo ""
python3 -m ashlr_ao "$@"