Files
Sylpheed/docker/decoder/bin/screenshot
MechaCat02 c58196b795 containers: each agent clones the monorepo into its own volume
The last structural fix for the collision class that has bitten three times. Both
containers now clone the repository into their OWN named volume instead of
bind-mounting a human's working tree, so an agent's local git config cannot
capture a human's commits, a credential helper cannot leak a container-only path
onto the host, and a `git add -A` cannot sweep another party's in-flight files.

Cloned once at startup and never auto-pulled: pulling under a running agent
moves files out from under whatever it is mid-edit, which is the same bug again.

Accepted knowingly: Claude Code keys per-project memory off the working
directory, so moving off the host path starts that memory empty. The corpus in
docs/ is the memory that matters and it travels with the clone.

Other changes:
* docker/agent -> docker/decoder; the launcher is sylph-decoder. Roles, not
  "the agent", now that there is more than one.
* /reborn is gone -- one repository now, so the port reads HANDOFF from its own
  checkout rather than through a live read-only mount of someone else's tree.
* Canary mounts separately at /canary; it stays a fork tracking upstream.
* A shared `sylpheed-exchange` volume at /exchange, with tools/ on PATH so
  `share` is available in both.
* The decoder's credential file gets the .host-copy treatment the port already
  had -- `credential.helper=store` rewrites by rename-over-target, which is
  EBUSY on a bind mount and reports a fatal that is not one.
* Budget split deliberately: decoder 5 cpu / 6 GB, port 3 / 4, leaving room for
  the planned Referee. "Half the host" was right when there was one agent.

Prompts move to docs/agents/ and are rewritten around the protocol: the oracle
is the running game, dynamic RE stays with the decoder, each iteration must
attempt to refute one claim of the other, and neither may verify its way out of
its own role.
2026-08-29 11:48:30 +02:00

52 lines
1.9 KiB
Bash
Executable File

#!/usr/bin/env bash
# Raw full-root PNG grab of the headless display.
#
# This is deliberately the *uncropped* root window, because
# `tools/re-capture/bin/screenshot` is a wrapper that calls this one as its raw
# grabber and then crops to the game surface — xenia's window is a GTK window
# whose menu bar pushes the 1280x720 game image down ~25 px, and every pixel
# oracle in the toolkit was measured against the bare game image. That wrapper
# directory is first on PATH, so scripts calling `screenshot` get the cropped
# game surface and this stays the honest raw grab underneath it.
#
# screenshot [out.png] default: $HOME/shots/shot-NNNN.png
set -u
OUT="${1:-}"
if [ -z "$OUT" ]; then
dir="${HOME:-/tmp}/shots"; mkdir -p "$dir"
n_file="$dir/.counter"
n=$(( $(cat "$n_file" 2>/dev/null || echo 0) + 1 )); echo "$n" > "$n_file"
OUT="$dir/shot-$(printf '%04d' "$n").png"
fi
mkdir -p "$(dirname "$OUT")"
if ! xdpyinfo >/dev/null 2>&1; then
echo "screenshot: no display on ${DISPLAY:-<unset>}" >&2
exit 1
fi
# ImageMagick first. `import` talks X11 directly and captures a window that is
# mid-redraw without tearing the way a video grabber can.
if command -v import >/dev/null 2>&1 && import -silent -window root "$OUT" 2>/dev/null; then
echo "$OUT"; exit 0
fi
# Fallback: ffmpeg's x11grab. Needs an explicit size, so read it off the server
# rather than assuming the geometry.
if command -v ffmpeg >/dev/null 2>&1; then
size=$(xdpyinfo | awk '/dimensions:/{print $2; exit}')
if ffmpeg -loglevel error -y -f x11grab -draw_mouse 0 \
-video_size "$size" -i "$DISPLAY" -frames:v 1 "$OUT" 2>/dev/null; then
echo "$OUT"; exit 0
fi
fi
# Last resort: xwd, which is always present with x11-utils.
if command -v xwd >/dev/null 2>&1 && command -v convert >/dev/null 2>&1; then
xwd -root -silent | convert xwd:- "$OUT" && { echo "$OUT"; exit 0; }
fi
echo "screenshot: no working capture backend" >&2
exit 1