Download tasks/t37-rct-micropark/environment/notepad-keeper.sh from refreshdotdev/Refresh-GUI-dataset: direct link, hf CLI and curl.
- Browser
- Download file 2.56 kB
-
https://huggingface.co/datasets/refreshdotdev/Refresh-GUI-dataset/resolve/main/tasks/t37-rct-micropark/environment/notepad-keeper.sh
- Command line
-
hf download hf://datasets/refreshdotdev/Refresh-GUI-dataset/tasks/t37-rct-micropark/environment/notepad-keeper.sh
-
curl -L -o notepad-keeper.sh https://huggingface.co/datasets/refreshdotdev/Refresh-GUI-dataset/resolve/main/tasks/t37-rct-micropark/environment/notepad-keeper.sh
2.56 kB
| # Keeps one notepad window on the desktop for the agent's own notes. | |
| # | |
| # It runs as the unprivileged `notes` user, not as the game user: a text editor | |
| # can save anywhere its process may write, and the engine loads every .js in the | |
| # game profile's plugin directory at start-up, so a notepad owned by rct2 would | |
| # be a scripting surface. This one can write /notes and nothing else. | |
| # | |
| # The notes file lives outside the game profile, so the supervisor's between-try | |
| # park reset never touches it and the agent's learnings survive into the next | |
| # try. Closing the window is not a way to lose the notepad either: it is | |
| # relaunched, with the file's contents intact on disk. | |
| set -uo pipefail | |
| NOTES_DIR=/notes | |
| NOTES_FILE="$NOTES_DIR/micropark-notes.txt" | |
| # The seed lives in the image, not in a heredoc here, so the grader can be told | |
| # its exact size and tell the agent's own writing from what it was handed. | |
| NOTES_SEED=/usr/local/lib/t37/notes-seed.txt | |
| mkdir -p "$NOTES_DIR" | |
| chown notes:rct2 "$NOTES_DIR" | |
| chmod 2775 "$NOTES_DIR" | |
| if [[ ! -f "$NOTES_FILE" ]]; then | |
| cp "$NOTES_SEED" "$NOTES_FILE" | |
| fi | |
| chown notes:rct2 "$NOTES_FILE" | |
| chmod 664 "$NOTES_FILE" | |
| # The editor needs the display, which the game user brings up a moment later. | |
| for _ in $(seq 1 600); do | |
| [[ -S /tmp/.X11-unix/X1 ]] && break | |
| sleep 1 | |
| done | |
| while true; do | |
| # keyfile settings instead of dconf: there is no session bus in this container, | |
| # so the editor's own preferences (word wrap, line numbers) can only be | |
| # preseeded through the keyfile backend. --line=-1 opens at the end of the | |
| # notes, which is where the next entry goes. | |
| runuser -u notes -- env HOME=/home/notes DISPLAY=:1 TMPDIR=/tmp \ | |
| GSETTINGS_BACKEND=keyfile \ | |
| mousepad --disable-server --line=-1 "$NOTES_FILE" >>/tmp/notepad.log 2>&1 & | |
| editor=$! | |
| # A default-sized window shows a third of the file; the agent reads these | |
| # notes through a screenshot, so give it the whole screen. | |
| for _ in $(seq 1 20); do | |
| sleep 0.5 | |
| if DISPLAY=:1 wmctrl -r Mousepad -b add,maximized_vert,maximized_horz 2>/dev/null; then | |
| break | |
| fi | |
| done | |
| # The park is what the agent should be looking at; the notepad is reached | |
| # deliberately with Super+N. Retried because the engine's window can map after | |
| # the editor's, both at start-up and after a between-try reset. | |
| for _ in $(seq 1 60); do | |
| if DISPLAY=:1 wmctrl -a OpenRCT2 2>/dev/null; then break; fi | |
| sleep 1 | |
| done | |
| wait "$editor" || true | |
| # Either the agent closed it or it died; give it the window back. | |
| sleep 2 | |
| done | |