Add headless Agentbox environment spike

Co-authored-by: codegirl007 <codegirl-007@users.noreply.github.com>
This commit is contained in:
Cursor Agent
2026-08-17 16:36:55 +00:00
co-authored by codegirl007
parent 98f56833a0
commit 96dade334d
9 changed files with 841 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
#!/bin/sh
set -eu
export HOME=/tmp/home
export XDG_RUNTIME_DIR=/tmp/runtime
mkdir -p "$HOME" "$XDG_RUNTIME_DIR"
chmod 0700 "$XDG_RUNTIME_DIR"
cleanup() {
rm -f /tmp/agentbox-ready
kill "${OPENBOX_PID:-}" "${XVFB_PID:-}" 2>/dev/null || true
wait "${OPENBOX_PID:-}" "${XVFB_PID:-}" 2>/dev/null || true
}
terminate() {
trap - EXIT INT TERM
cleanup
exit 0
}
trap cleanup EXIT
trap terminate INT TERM
Xvfb "$DISPLAY" -screen 0 640x480x24 -nolisten tcp -noreset &
XVFB_PID=$!
attempt=0
until xdpyinfo -display "$DISPLAY" >/dev/null 2>&1; do
attempt=$((attempt + 1))
if [ "$attempt" -ge 100 ]; then
echo "Xvfb did not become ready" >&2
exit 1
fi
sleep 0.05
done
openbox --sm-disable >/tmp/openbox.log 2>&1 &
OPENBOX_PID=$!
touch /tmp/agentbox-ready
while :; do
sleep 3600 &
wait $!
done