#!/bin/bash AGY_BIN="${HOME}/.local/bin/agy" [[ -x "$AGY_BIN" ]] || AGY_BIN=$(command -v agy) # The CLI exits at startup if this port is taken, so probe for a free one on # every launch (the daemon manager restarts this wrapper, re-picking a port). PORT=4400 while (( PORT < 4500 )) && (exec 3<>"/dev/tcp/127.0.0.1/${PORT}") 2>/dev/null; do PORT=$((PORT + 1)) done exec "$AGY_BIN" --remote-control --hub-port "$PORT" "$@"