clawdie-ai/scripts/glass.sh
Clawdie AI 1cf4152bd3 chore: templatize agent name/subnet; fix heartbeat PGPASSWORD + timeouts
- Replace hardcoded "klavdija" tmux session names with $AGENT_NAME in
  glass.sh and run-klavdija.sh
- Replace hardcoded 192.168.100.x fallbacks with 10.0.1.x throughout
  scripts/memory/ and heartbeat.sh defaults
- Fix heartbeat PGPASSWORD: use inline `VAR=val cmd` form so psql
  actually receives the password in the subshell
- Fix heartbeat curl hangs: add --max-time to all curl calls
- Add run-klavdija.sh and src/transcription.ts (previously untracked)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---
Build: pass | Tests: pass — Tests  431 passed (431)
2026-03-28 21:56:40 +00:00

55 lines
2.4 KiB
Bash
Executable file

#!/bin/sh
# scripts/glass.sh — Launch the Clawdie glass-pane tmux session.
#
# Layout:
# ┌──────────────────────┬──────────────┐
# │ gateway / pi │ shell │
# ├──────────────────────┴──────────────┤
# │ btop │
# └─────────────────────────────────────┘
#
# Usage:
# scripts/glass.sh # create or attach
# scripts/glass.sh kill # destroy session
PROJECT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
# Load AGENT_NAME from .env if not already set
if [ -z "${AGENT_NAME:-}" ] && [ -f "$PROJECT_DIR/.env" ]; then
AGENT_NAME="$(grep '^AGENT_NAME=' "$PROJECT_DIR/.env" | cut -d= -f2 | tr -d '"'\'')')"
fi
SESSION="${AGENT_NAME:-clawdie}"
PI_BIN="${PI_TUI_BIN:-/home/clawdie/.npm-global/bin/pi}"
if [ "${1:-}" = "kill" ]; then
tmux kill-session -t "$SESSION" 2>/dev/null && echo "Session '$SESSION' killed." || echo "No session to kill."
exit 0
fi
# Attach if already running
if tmux has-session -t "$SESSION" 2>/dev/null; then
exec tmux attach-session -t "$SESSION"
fi
# ── Create session ─────────────────────────────────────────────────────────────
tmux new-session -d -s "$SESSION" -n glass -x 220 -y 50
# ── Window 0: glass — gateway/pi (left) | shell (right) ───────────────────────
tmux split-window -t "$SESSION:glass.0" -h -p 35
tmux select-pane -t "$SESSION:glass.0" -T "gateway / pi"
tmux send-keys -t "$SESSION:glass.0" "cd '$PROJECT_DIR' && '$PI_BIN'" Enter
tmux select-pane -t "$SESSION:glass.1" -T "shell"
tmux send-keys -t "$SESSION:glass.1" "cd '$PROJECT_DIR'" Enter
# ── Window 1: btop — full terminal height ─────────────────────────────────────
tmux new-window -t "$SESSION" -n btop
tmux select-pane -t "$SESSION:btop.0" -T "btop"
tmux send-keys -t "$SESSION:btop.0" "btop" Enter
# Focus window 0, gateway/pi pane on attach
tmux select-window -t "$SESSION:glass"
tmux select-pane -t "$SESSION:glass.0"
exec tmux attach-session -t "$SESSION"