Files
beads/scripts/agent-mail-status.sh
Steve Yegge bbe73d54bc Add Agent Mail multi-workspace deployment guide and scripts
- docs/AGENT_MAIL_DEPLOYMENT.md: 10-step deployment plan for 13 workspaces
- docs/AGENT_MAIL_MULTI_WORKSPACE_SETUP.md: Architecture and configuration guide
- scripts/setup-agent-mail-workspace.sh: Auto-configure .envrc per workspace
- scripts/start-agent-mail-server.sh: Start Agent Mail server
- scripts/stop-agent-mail-server.sh: Stop Agent Mail server
- scripts/agent-mail-status.sh: Monitor server and all channels

Supports 3-channel setup: beads.dev, vc.dev, wyvern.dev
Ready for 0.23.0 deployment with Agent Mail integration

Amp-Thread-ID: https://ampcode.com/threads/T-bc960efb-3ddc-4635-8c8e-a42a6e9e67d9
Co-authored-by: Amp <amp@ampcode.com>
2025-11-08 04:16:44 -08:00

71 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
# View Agent Mail server status and active projects
# Usage: ./agent-mail-status.sh
PORT="${AGENT_MAIL_PORT:-8765}"
URL="http://127.0.0.1:$PORT"
PID_FILE="${AGENT_MAIL_PID:-$HOME/agent-mail.pid}"
echo "=== Agent Mail Status ==="
echo ""
# Check PID file
if [[ -f "$PID_FILE" ]]; then
PID=$(cat "$PID_FILE")
if ps -p "$PID" > /dev/null 2>&1; then
echo "Server Process: ✅ Running (PID: $PID)"
else
echo "Server Process: ⚠️ Stale PID file (process $PID not found)"
fi
else
echo "Server Process: ⚠️ No PID file found"
fi
# Check health endpoint
echo ""
echo "Server Health:"
if HEALTH=$(curl -sf "$URL/health" 2>/dev/null); then
echo "$(echo $HEALTH | jq -r '.status // "OK"')"
echo " URL: $URL"
else
echo " ❌ UNREACHABLE at $URL"
echo ""
echo "Start server with:"
echo " ./scripts/start-agent-mail-server.sh"
exit 1
fi
# List projects
echo ""
echo "Active Projects:"
if PROJECTS=$(curl -sf "$URL/api/projects" 2>/dev/null); then
if [[ $(echo "$PROJECTS" | jq -r '. | length') -eq 0 ]]; then
echo " (none yet)"
else
echo "$PROJECTS" | jq -r '.[] | " • \(.slug)\n Path: \(.human_key)"'
fi
else
echo " (failed to fetch)"
fi
# List reservations
echo ""
echo "Active File Reservations:"
if RESERVATIONS=$(curl -sf "$URL/api/file_reservations" 2>/dev/null); then
if [[ $(echo "$RESERVATIONS" | jq -r '. | length') -eq 0 ]]; then
echo " (none)"
else
echo "$RESERVATIONS" | jq -r '.[] | " • \(.agent_name) → \(.resource_id)\n Project: \(.project_id)\n Expires: \(.expires_at)"'
fi
else
echo " (failed to fetch)"
fi
echo ""
echo "Web UI: $URL/mail"
echo ""
echo "Commands:"
echo " Start: ./scripts/start-agent-mail-server.sh"
echo " Stop: ./scripts/stop-agent-mail-server.sh"
echo " Logs: tail -f $HOME/agent-mail.log"