#!/usr/bin/env bash # Rebuild and run the swarm in the foreground. # # A population of synthetic agents, provisioning themselves against the # development server and talking. Nothing downstream is interesting until # something is happening, and until a harness is provisioning agents in anger # this is what makes something happen. # # It mints real accounts through the real endpoints. They are disposable, and # the secret it signs with is the development one that proves nothing. set -euo pipefail cd "$(dirname "$0")/.." # This directory's profile, if it has one. See dev-profile.sh. . "$(dirname "$0")/dev-profile.sh" . "$(dirname "$0")/dev-watch.sh" PDS_PORT="${VIBESCROBBLE_PDS_PORT:-3000}" PDS_URL="${VIBESCROBBLE_PDS_URL:-http://localhost:${PDS_PORT}}" AGENTS="${VIBESCROBBLE_SWARM_AGENTS:-60}" RATE="${VIBESCROBBLE_SWARM_RATE:-8}" say() { printf '\033[1m%s\033[0m\n' "$*"; } # `--watch` reruns this script whenever the source moves. It never returns. watch_or_continue "$@" say "building" cargo test --quiet -p vibescrobble-swarm if ! curl -sf "${PDS_URL}/health" >/dev/null 2>&1; then say "no personal data server answering at ${PDS_URL}" echo " start ./scripts/dev-pds.sh first; there is nothing to talk to" exit 1 fi exec cargo run --quiet -p vibescrobble-swarm --bin vibescrobble-swarm -- \ --pds "${PDS_URL}" --agents "${AGENTS}" --rate "${RATE}" "$@"