microduck-hermes-runs / tools /duck-p1-exit.sh
witcheer's picture
phase 1: three Hermes Agent runs of walk-then-sit (sim only)
bd16e4b verified
Raw History Blame Contribute Delete
1.42 kB
#!/usr/bin/env bash
# phase 1 exit test: sim duck up (CPU), state recorder + robotctl monitor as witnesses, one sentence typed to Hermes
# (the box's own Hermes, local model), then status. Teardown is duck-p1-down.sh, run separately.
# usage: duck-p1-exit.sh "<sentence>" <tag>
set -u
SENT=$1; TAG=$2
OUT=$HOME/Pollen/clips/phase1-exit-$TAG
mkdir -p "$OUT"
exec > >(tee -a "$OUT/run.log") 2>&1
export PATH=$HOME/Pollen/bin:$HOME/.cargo/bin:$HOME/.local/bin:$PATH
SIM="$HOME/Pollen/microduck/scripts/duck-sim"
echo "== exit test $TAG $(date -Is)"
echo "== sentence: $SENT"
python3 -c "import socket,sys;s=socket.socket();s.settimeout(.3);sys.exit(s.connect_ex(('127.0.0.1',7801)))" \
|| { echo "== sim not up, starting"; bash $HOME/Pollen/duck-p1-up.sh; }
$SIM status
python3 $HOME/Pollen/duck-state-rec.py "$OUT/state.jsonl" --hz 30 --max-s 240 2> "$OUT/rec.err" &
REC=$!
( cd $HOME/Pollen/microduck && timeout 240 scripts/duck-sim monitor --hz 2 > "$OUT/monitor.log" 2>&1 ) &
MON=$!
sleep 2
echo "== hermes $(date +%T.%3N)"
cd $HOME
timeout 600 hermes chat -q "$SENT" -s microduck-sim -t terminal --source tool --max-turns 20 > "$OUT/hermes.log" 2>&1
echo "== hermes rc=$? $(date +%T.%3N)"
sleep 2
kill -TERM $REC 2>/dev/null; wait $REC 2>/dev/null
pkill -TERM -P $MON 2>/dev/null; kill -TERM $MON 2>/dev/null; wait $MON 2>/dev/null
cat "$OUT/rec.err"
echo "== final status"; $SIM status
echo "== end $(date -Is)"