File size: 8,303 Bytes
2e7de11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# t35 "follow the written brief": GIMP illustration -> Friction spin.
# Build context: this environment directory. See ../README.md.
#
# DELIBERATE DIVERGENCE FROM t15 AND t24 (Sid, 2026-09-17)
#   * t15 PURGED gimp because its Script-Fu console is a scripting surface.
#     t35 KEEPS GIMP and keeps Script-Fu reachable: the task explicitly allows
#     "expressions and scripts within gimp".
#   * t24 compiles friction-gui-only.so to block Friction's expression editor.
#     t35 ships no such guard — the only banned surface here is a terminal.
#   * Python-Fu is NOT installed (and Debian bookworm no longer ships it).
#     Python-Fu hands the agent os.system(), which is a terminal by another
#     name and would defeat the no-terminal rule. Script-Fu's TinyScheme has
#     no process-spawning primitive, so it is safe to leave open.
FROM --platform=linux/amd64 vedit-task:base AS prepared

# --- Friction (verbatim from t24: bundled Qt5/Skia/ffmpeg; the pulse deb set
# stops the modal audio error; portable.txt removed; ldd assertion) ----------
COPY friction.tar.xz /tmp/
COPY debs/ /tmp/debs/
RUN dpkg -i /tmp/debs/*.deb \
 && mkdir -p /opt/friction \
 && tar -xJf /tmp/friction.tar.xz -C /opt/friction --strip-components=1 \
 && rm -rf /tmp/friction.tar.xz /tmp/debs \
 && test -x /opt/friction/bin/friction \
 && rm -f /opt/friction/bin/portable.txt \
 && missing="$(ldd /opt/friction/bin/friction | grep 'not found' || true)" \
 && { [ -z "$missing" ] || { echo "friction: unresolved libs:"; echo "$missing"; exit 1; }; }
COPY friction-launcher.sh /usr/local/bin/friction
RUN chmod 755 /usr/local/bin/friction

# --- GIMP + the reference viewer. librsvg2-bin renders the reference SVG to a
# PNG at BUILD time so the agent never needs a rasteriser (and never needs to
# open the SVG in GIMP to see it). ristretto is a view-only image viewer.
# Evaluation deps (numpy/scipy/pil) are baked, never installed by tests. ------
RUN apt-get update && apt-get install -y --no-install-recommends \
      gimp gimp-data ristretto librsvg2-bin \
      python3-numpy python3-scipy python3-pil \
 && rm -rf /var/lib/apt/lists/* \
 && command -v gimp \
 && ls /usr/lib/gimp/2.0/plug-ins/script-fu \
 && ! ls /usr/lib/gimp/2.0/python 2>/dev/null

# --- Agent-visible material: the written brief, the reference SVG, and a
# build-time PNG preview of that SVG. Only these; no other media. -----------
RUN rm -f /root/media/*.mp4 /root/media/*.mp3 2>/dev/null || true
COPY media/ /root/media/
RUN rsvg-convert -w 1000 -h 1000 -a -b white \
      /root/media/reference/Penrose_triangle.svg \
      -o /root/media/reference/reference-preview.png \
 && chmod 444 /root/media/reference/Penrose_triangle.svg \
 && test -s /root/media/penrose-spec.md \
 && test -s /root/media/reference/reference-preview.png \
 && mkdir -p /root/edit /root/Desktop

# --- Launchers. GIMP autostarts (step 1 of the task); Friction comes up via
# start-editor's APP=friction autostart; the reference preview has its own
# view-only launcher so "look at the reference" never means "open it in GIMP".
COPY friction-autostart.desktop /opt/autostart/friction-autostart.desktop
COPY friction.desktop /root/Desktop/friction.desktop
COPY gimp.desktop /root/Desktop/gimp.desktop
COPY reference-image.desktop /root/Desktop/reference-image.desktop
RUN chmod 755 /root/Desktop/*.desktop \
 && mkdir -p /usr/share/applications /root/.config/autostart \
 && cp /root/Desktop/friction.desktop /usr/share/applications/friction.desktop \
 && cp /root/Desktop/gimp.desktop /usr/share/applications/gimp.desktop \
 && cp /root/Desktop/reference-image.desktop /usr/share/applications/reference-image.desktop \
 && cp /root/Desktop/gimp.desktop /root/.config/autostart/gimp.desktop \
 && test -x /usr/bin/xfdesktop

# --- GIMP first run: no splash, no tip-of-the-day, single-window mode so the
# screenshot-driven agent sees one window. The documents history file is
# created empty and stays writable: the verifier reads it to detect whether the
# reference SVG was opened inside GIMP.
RUN mkdir -p /root/.config/GIMP/2.10 \
 && printf '(show-tips no)\n(show-tool-tips yes)\n(single-window-mode yes)\n(check-size medium-checks)\n(default-threshold 15)\n' \
      > /root/.config/GIMP/2.10/gimprc \
 && printf '# GIMP documents (version 0.4)\n' > /root/.config/GIMP/2.10/documents \
 && printf '# GIMP sessionrc\n' > /root/.config/GIMP/2.10/sessionrc \
 && chmod 644 /root/.config/GIMP/2.10/documents

# --- NO TERMINAL (standing rule 1, verbatim mechanism from t24): every
# terminal entry point becomes a logging stub (a logged attempt zeroes the
# reward), terminal .desktop entries and the Ctrl+Alt+T shortcut are removed,
# and XFCE kiosk mode blocks new panel launchers. python3 stays for the
# verifier; nothing on the desktop can launch it. ---------------------------
COPY no-terminal.sh /usr/local/bin/no-terminal
COPY kiosk/kioskrc /etc/xdg/xfce4/kiosk/kioskrc
RUN chmod 755 /usr/local/bin/no-terminal \
 && for t in xterm uxterm lxterm koi8rxterm x-terminal-emulator xfce4-terminal xfce4-appfinder xfrun4; do \
      rm -f "/usr/bin/$t" "/etc/alternatives/$t"; ln -s /usr/local/bin/no-terminal "/usr/bin/$t"; done \
 && rm -f /usr/share/applications/debian-xterm.desktop /usr/share/applications/debian-uxterm.desktop \
          /usr/share/applications/xfce4-terminal-emulator.desktop /usr/share/applications/python3*.desktop \
          /usr/share/applications/display-im6*.desktop /usr/share/applications/org.kde.kdenlive.desktop \
          /usr/share/applications/xfce4-file-manager.desktop /usr/share/applications/xfce4-mail-reader.desktop \
          /usr/share/applications/xfce4-web-browser.desktop /usr/share/applications/xfce4-settings-editor.desktop \
          /usr/share/xfce4/helpers/*.desktop \
          /root/Desktop/terminal.desktop /root/Desktop/kdenlive.desktop \
 && sed -i '/exo-open --launch TerminalEmulator/d' /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml \
 && sed -i 's/^TerminalEmulator=.*/TerminalEmulator=/; s/^FileManager=.*/FileManager=/' /etc/xdg/xfce4/helpers.rc \
 && test -x /usr/local/bin/friction && command -v gimp \
 && [ "$(readlink -f /usr/bin/xterm)" = /usr/local/bin/no-terminal ] \
 && ! ls /usr/share/applications | grep -qiE 'xterm|terminal|python|display-im6'

# Remove inherited applications and development executables. GIMP stays.
#
# Chromium also stays, against this suite's usual habit: computer-1's runtime
# hard-codes /usr/bin/chromium, boots its own XFCE session on :1, and times out
# agent setup if that binary is missing (README, "Daytona + computer-1: the
# environment contract"; t35's first local run died exactly this way). It gets
# no desktop launcher — harden-desktop.py's allow-list is gimp/friction/
# reference-image — and the sandbox has no network, so it is a window the
# harness needs, not a tool the agent is offered. It is not a shell.
RUN apt-get purge -y kdenlive kdenlive-data xterm \
 && rm -rf /opt/natron /usr/local/bin/Natron /usr/local/bin/make-media /usr/lib/gcc \
 && rm -f /usr/bin/gcc* /usr/bin/g++* /usr/bin/x86_64-linux-gnu-gcc* /usr/bin/x86_64-linux-gnu-g++* \
          /usr/bin/cc /usr/bin/c++ /usr/bin/c89-gcc /usr/bin/c99-gcc \
 && rm -f /usr/bin/exo-desktop-item-edit /usr/bin/exo-open /usr/bin/xfce4-keyboard-settings \
          /usr/bin/xfce4-mime-settings /usr/bin/xfce4-settings-manager /usr/bin/xfce4-settings-editor \
 && rm -rf /var/lib/apt/lists/*
COPY harden-desktop.py /tmp/harden-desktop.py
RUN python3 /tmp/harden-desktop.py && rm /tmp/harden-desktop.py \
 && for t in xterm uxterm lxterm koi8rxterm x-terminal-emulator xfce4-terminal xfce4-appfinder xfrun4; do \
      rm -f "/usr/bin/$t"; ln -s /usr/local/bin/no-terminal "/usr/bin/$t"; done \
 && test -x /usr/bin/chromium && test ! -e /usr/bin/kdenlive && test ! -e /opt/natron \
 && test ! -e /usr/share/applications/chromium.desktop \
 && test -x /usr/bin/xfce4-session && test -x /usr/bin/startxfce4 && test -x /usr/bin/xrdb \
 && test -f /root/.config/autostart/gimp.desktop \
 && python3 -c "import scipy, numpy, PIL, pytest"

FROM scratch
COPY --from=prepared / /
ENV DEBIAN_FRONTEND=noninteractive APP=friction SDL_AUDIODRIVER=dummy \
    QSG_RHI_BACKEND=opengl LIBGL_ALWAYS_SOFTWARE=1
WORKDIR /root
CMD ["/usr/local/bin/start-editor"]