The reports desk: a slip for surprises, replies in the hall

A Report button in a room's masthead files what happened and what was
expected, with a screenshot if there is one, pinned to the room and the
turn and rung through Sentry. Reports and the keeper's replies live in
feedback.jsonl beside the ledgers; the hall shows each seat's reports
with the thread under them and a line to answer. pull-reports.sh mirrors
the desk locally, report-reply.sh answers, and a skill works the desk.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141G6xqLeNRYEtviLWSB5Up
This commit is contained in:
Eric Wagoner
2026-09-23 10:12:51 -04:00
co-authored by Claude Fable 5.1
parent c49703ee4f
commit 8eca078043
11 changed files with 738 additions and 5 deletions
+3
View File
@@ -27,6 +27,9 @@ uptime and upgrades independent of anything else.
(always works, zero DNS). Caddy serves both from the first line of
/etc/caddy/Caddyfile.
- Everyday deploy: `deploy/deploy.sh 159.203.98.71`
- Players' reports: `deploy/pull-reports.sh` mirrors /var/lib/waving-hands/feedback.jsonl
and the screenshots to ~/Desktop/waving-hands-reports with a digest;
`deploy/report-reply.sh 159.203.98.71 <id> <status> "text"` answers one.
## New droplet from scratch
+41
View File
@@ -0,0 +1,41 @@
#!/bin/bash
# Mirror the player reports, the keeper's replies and the players' screenshots
# to a local folder, and write a digest beside them for reading.
# deploy/pull-reports.sh [host] [folder] (default ~/Desktop/waving-hands-reports)
set -euo pipefail
HOST="${1:-159.203.98.71}"
OUT="${2:-$HOME/Desktop/waving-hands-reports}"
mkdir -p "$OUT/images"
scp -q "root@$HOST:/var/lib/waving-hands/feedback.jsonl" "$OUT/feedback.jsonl" 2>/dev/null || : > "$OUT/feedback.jsonl"
rsync -aq "root@$HOST:/var/lib/waving-hands/feedback-images/" "$OUT/images/" 2>/dev/null || true
python3 - "$OUT" <<'PY'
import json, sys, os
out = sys.argv[1]
reports, order = {}, []
for raw in open(os.path.join(out, "feedback.jsonl"), encoding="utf8"):
raw = raw.strip()
if not raw: continue
line = json.loads(raw)
if "reportId" in line:
r = reports.get(line["reportId"])
if not r: continue
if "image" in line: r["image"] = line["image"]
else: r["replies"].append(line) # the keeper's replies and the player's answers alike, in order
continue
reports[line["id"]] = dict(line, replies=[]); order.append(line["id"])
lines = ["# Waving Hands reports", "", f"{len(order)} reports; newest first. Pictures are in `images/`.", ""]
for rid in reversed(order):
r = reports[rid]
lines.append(f"## {r.get('at','')[:16].replace('T',' ')} — {r.get('player','?')} in {r.get('roomId','?')} (turn {r.get('turn','?')}, seq {r.get('seq','?')}) — id {rid}")
lines.append("")
lines.append(f"**What happened:** {r.get('happened','').strip()}")
if r.get("expected","").strip(): lines.append(f"**What they expected:** {r['expected'].strip()}")
if r.get("image"): lines.append(f"**Picture:** ![{r['image']}](images/{r['image']})")
for rep in r["replies"]:
who = f"{r.get('player','the player')} answers" if rep.get("from") == "player" else f"**{rep.get('status','')}**"
lines.append(f"> {who} ({rep.get('at','')[:16].replace('T',' ')}): {rep.get('text','').strip()}")
if not r["replies"] or r["replies"][-1].get("from") == "player": lines.append("> _awaiting the keeper_")
lines.append("")
open(os.path.join(out, "reports.md"), "w", encoding="utf8").write("\n".join(lines))
print(f"{len(order)} reports, {sum(1 for r in reports.values() if r.get('image'))} with pictures -> {out}/reports.md")
PY
+15
View File
@@ -0,0 +1,15 @@
#!/bin/bash
# Answer a player's report; the reply appears under it in their hall.
# deploy/report-reply.sh <host> <reportId> <resolved|by-design|open> <text...>
set -euo pipefail
HOST="${1:?usage: report-reply.sh <host> <reportId> <status> <text...>}"
REPORT_ID="${2:?usage: report-reply.sh <host> <reportId> <status> <text...>}"
STATUS="${3:?usage: report-reply.sh <host> <reportId> <status> <text...>}"
shift 3
TEXT="$*"
case "$STATUS" in resolved|by-design|open) ;; *) echo "status must be resolved, by-design, or open" >&2; exit 1;; esac
case "$REPORT_ID" in *[!0-9a-f]*|"") echo "a report id is eight hex characters" >&2; exit 1;; esac
LINE=$(REPORT_ID="$REPORT_ID" STATUS="$STATUS" TEXT="$TEXT" python3 -c '
import json, os, datetime
print(json.dumps({"reportId": os.environ["REPORT_ID"], "at": datetime.datetime.now(datetime.timezone.utc).isoformat().replace("+00:00", "Z"), "status": os.environ["STATUS"], "text": os.environ["TEXT"]}))')
printf '%s\n' "$LINE" | ssh "root@$HOST" 'cat >> /var/lib/waving-hands/feedback.jsonl && chown waving-hands:waving-hands /var/lib/waving-hands/feedback.jsonl && tail -1 /var/lib/waving-hands/feedback.jsonl'