File: //tmp/heartbeat_check.sh
set -euo pipefail
BASE_URL="https://altaira.panomity.com/mc"
AUTH_TOKEN="ztbHKAe1UYI66HCFvSAyo4wrAAD6frNCyAZ67aKVeSE"
BOARD_ID="2857b7e4-abd0-41ae-8185-4bc3c37cfee1"
AGENT_NAME="altaira"
AGENT_ID="e4c57543-6899-4be1-b449-f6cf886c39f8"
cd /home/altaira.panomity.com/workspace-mc-e4c57543-6899-4be1-b449-f6cf886c39f8
mkdir -p api
curl -fsS "$BASE_URL/openapi.json" -o api/openapi.json
jq -r '
.paths | to_entries[] as $p
| $p.value | to_entries[]
| select((.value.tags // []) | index("agent-worker"))
| "\(.key|ascii_upcase)\t\($p.key)\t\(.value.operationId // "-")\t\(.value["x-llm-intent"] // "-")\t\(.value["x-when-to-use"] // [] | join(" | "))\t\(.value["x-routing-policy"] // [] | join(" | "))"
' api/openapi.json | sort > api/agent-worker-operations.tsv
health=$(curl -fsS "$BASE_URL/healthz")
boards=$(curl -fsS -H "Authorization: Bearer $AUTH_TOKEN" "$BASE_URL/api/v1/agent/boards")
tasks=$(curl -fsS -H "Authorization: Bearer $AUTH_TOKEN" "$BASE_URL/api/v1/agent/boards/$BOARD_ID/tasks")
inbox=$(curl -fsS -H "Authorization: Bearer $AUTH_TOKEN" "$BASE_URL/api/v1/agent/boards/$BOARD_ID/tasks?status=inbox")
inprog=$(curl -fsS -H "Authorization: Bearer $AUTH_TOKEN" "$BASE_URL/api/v1/agent/boards/$BOARD_ID/tasks?status=in_progress")
review=$(curl -fsS -H "Authorization: Bearer $AUTH_TOKEN" "$BASE_URL/api/v1/agent/boards/$BOARD_ID/tasks?status=review")
board_mem=$(curl -fsS -H "Authorization: Bearer $AUTH_TOKEN" "$BASE_URL/api/v1/agent/boards/$BOARD_ID/memory?is_chat=false&limit=5")
group_snapshot=$(curl -fsS -H "Authorization: Bearer $AUTH_TOKEN" "$BASE_URL/api/v1/boards/$BOARD_ID/group-snapshot?include_self=true")
group_mem=$(curl -fsS -H "Authorization: Bearer $AUTH_TOKEN" "$BASE_URL/api/v1/boards/$BOARD_ID/group-memory?limit=8")
heartbeat=$(curl -fsS -X POST -H "Authorization: Bearer $AUTH_TOKEN" -H 'Content-Type: application/json' "$BASE_URL/api/v1/agent/heartbeat" -d "{\"agent_id\":\"$AGENT_ID\",\"agent_name\":\"$AGENT_NAME\"}")
python3 - <<'PY'
import json, pathlib
from datetime import datetime, timezone
base = pathlib.Path('/home/altaira.panomity.com/workspace-mc-e4c57543-6899-4be1-b449-f6cf886c39f8')
files = {
'health': base / 'health.json',
'boards': base / 'boards.json',
'tasks': base / 'tasks.json',
'inbox': base / 'inbox.json',
'inprog': base / 'inprog.json',
'review': base / 'review.json',
'board_mem': base / 'board_mem.json',
'group_snapshot': base / 'group_snapshot.json',
'group_mem': base / 'group_mem.json',
'heartbeat': base / 'heartbeat.json',
}
PY
printf '%s' "$health" > health.json
printf '%s' "$boards" > boards.json
printf '%s' "$tasks" > tasks.json
printf '%s' "$inbox" > inbox.json
printf '%s' "$inprog" > inprog.json
printf '%s' "$review" > review.json
printf '%s' "$board_mem" > board_mem.json
printf '%s' "$group_snapshot" > group_snapshot.json
printf '%s' "$group_mem" > group_mem.json
printf '%s' "$heartbeat" > heartbeat.json
jq -n \
--arg now "$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \
--slurpfile health health.json \
--slurpfile boards boards.json \
--slurpfile tasks tasks.json \
--slurpfile inbox inbox.json \
--slurpfile inprog inprog.json \
--slurpfile review review.json \
--slurpfile board_mem board_mem.json \
--slurpfile group_snapshot group_snapshot.json \
--slurpfile group_mem group_mem.json \
--slurpfile heartbeat heartbeat.json \
'{
now: $now,
health: $health[0],
boards: $boards[0],
tasks: $tasks[0],
inbox: $inbox[0],
in_progress: $inprog[0],
review: $review[0],
board_memory: $board_mem[0],
group_snapshot: $group_snapshot[0],
group_memory: $group_mem[0],
heartbeat: $heartbeat[0]
}'