@madarco/agentbox 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +89 -0
- package/README.md +161 -0
- package/dist/{_cloud-attach-T727ZPRV.js → _cloud-attach-O6NYTLES.js} +4 -4
- package/dist/{chunk-67N47KUS.js → chunk-2GPORKYF.js} +349 -182
- package/dist/chunk-2GPORKYF.js.map +1 -0
- package/dist/{chunk-6OZDFNBF.js → chunk-7UIAO7PC.js} +401 -82
- package/dist/chunk-7UIAO7PC.js.map +1 -0
- package/dist/{chunk-BGK32PZE.js → chunk-KL36BRN4.js} +2 -2
- package/dist/chunk-KL36BRN4.js.map +1 -0
- package/dist/chunk-MTVI44DW.js +662 -0
- package/dist/chunk-MTVI44DW.js.map +1 -0
- package/dist/{chunk-FODMEHD3.js → chunk-R4O5WPHW.js} +705 -77
- package/dist/chunk-R4O5WPHW.js.map +1 -0
- package/dist/{dist-ZODPD2I6.js → dist-5FQGYRW5.js} +20 -10
- package/dist/dist-5FQGYRW5.js.map +1 -0
- package/dist/{dist-LOZBWMBF.js → dist-BQNX7RQE.js} +19 -3
- package/dist/dist-PZW3GWWU.js +874 -0
- package/dist/dist-PZW3GWWU.js.map +1 -0
- package/dist/{dist-L4LCG5SJ.js → dist-TMHSUVTP.js} +4 -4
- package/dist/index.js +2385 -842
- package/dist/index.js.map +1 -1
- package/dist/{prepared-state-CL4CWXQA-ME4HSKDE.js → prepared-state-CL4CWXQA-H5THETIM.js} +2 -2
- package/package.json +11 -7
- package/runtime/docker/apps/cli/share/agentbox-setup/SKILL.md +9 -8
- package/runtime/docker/packages/ctl/dist/bin.cjs +129 -31
- package/runtime/docker/packages/sandbox-docker/scripts/agentbox-vnc-start +15 -1
- package/runtime/hetzner/agentbox-setup-skill.md +9 -8
- package/runtime/hetzner/agentbox-vnc-start +15 -1
- package/runtime/hetzner/ctl.cjs +129 -31
- package/runtime/relay/bin.cjs +260 -39
- package/runtime/vercel/agentbox-checkpoint-cleanup +52 -0
- package/runtime/vercel/agentbox-codex-hooks.json +68 -0
- package/runtime/vercel/agentbox-open +28 -0
- package/runtime/vercel/agentbox-setup-skill.md +197 -0
- package/runtime/vercel/agentbox-vnc-start +91 -0
- package/runtime/vercel/claude-managed-settings.json +115 -0
- package/runtime/vercel/ctl.cjs +23495 -0
- package/runtime/vercel/custom-system-CLAUDE.md +47 -0
- package/runtime/vercel/gh-shim +263 -0
- package/runtime/vercel/git-shim +131 -0
- package/runtime/vercel/scripts/provision.sh +314 -0
- package/share/agentbox-setup/SKILL.md +9 -8
- package/dist/chunk-67N47KUS.js.map +0 -1
- package/dist/chunk-6OZDFNBF.js.map +0 -1
- package/dist/chunk-BGK32PZE.js.map +0 -1
- package/dist/chunk-FODMEHD3.js.map +0 -1
- package/dist/dist-ZODPD2I6.js.map +0 -1
- /package/dist/{_cloud-attach-T727ZPRV.js.map → _cloud-attach-O6NYTLES.js.map} +0 -0
- /package/dist/{dist-LOZBWMBF.js.map → dist-BQNX7RQE.js.map} +0 -0
- /package/dist/{dist-L4LCG5SJ.js.map → dist-TMHSUVTP.js.map} +0 -0
- /package/dist/{prepared-state-CL4CWXQA-ME4HSKDE.js.map → prepared-state-CL4CWXQA-H5THETIM.js.map} +0 -0
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# AgentBox Vercel base-snapshot installer.
|
|
3
|
+
#
|
|
4
|
+
# Idempotent installer run once on a fresh Vercel Sandbox (Amazon Linux 2023,
|
|
5
|
+
# node24 runtime) during `agentbox prepare --provider vercel`. After it
|
|
6
|
+
# completes we `sandbox.snapshot()` the microVM — that snapshot is what every
|
|
7
|
+
# per-box create boots from.
|
|
8
|
+
#
|
|
9
|
+
# Differences from the hetzner installer (packages/sandbox-hetzner/scripts/
|
|
10
|
+
# install-box.sh), which this mirrors:
|
|
11
|
+
# - dnf, not apt (Amazon Linux 2023).
|
|
12
|
+
# - NO docker / dockerd / iptables — Vercel Sandbox blocks the namespace
|
|
13
|
+
# syscalls a container runtime needs, so DinD is impossible here.
|
|
14
|
+
# - The `vscode` user is created without forcing uid 1000 (the Vercel default
|
|
15
|
+
# user may already hold it; there are no bind mounts so the exact uid is
|
|
16
|
+
# irrelevant — only ownership of /workspace + /home/vscode matters).
|
|
17
|
+
#
|
|
18
|
+
# Required inputs (uploaded to /tmp before this runs):
|
|
19
|
+
# /tmp/agentbox-ctl -- prebuilt @agentbox/ctl bundle (cjs)
|
|
20
|
+
# /tmp/agentbox-vnc-start -- VNC startup helper
|
|
21
|
+
# /tmp/agentbox-checkpoint-cleanup -- pre-snapshot cleanup helper
|
|
22
|
+
# /tmp/agentbox-open -- in-box xdg-open shim
|
|
23
|
+
# /tmp/agentbox-gh-shim -- in-box `gh` shim (routes to host gh)
|
|
24
|
+
# /tmp/agentbox-git-shim -- in-box `git` shim (routes via relay)
|
|
25
|
+
# /tmp/agentbox-custom-CLAUDE.md -- /etc/claude-code/CLAUDE.md content
|
|
26
|
+
# /tmp/agentbox-managed-settings.json -- /etc/claude-code/managed-settings.json
|
|
27
|
+
# /tmp/agentbox-codex-hooks.json -- /usr/local/share/agentbox/codex-hooks.json
|
|
28
|
+
# /tmp/agentbox-setup-skill.md -- /usr/local/share/agentbox/setup-guide.md
|
|
29
|
+
#
|
|
30
|
+
# Output: noisy progress to stdout (streamed into ~/.agentbox/logs/prepare.log).
|
|
31
|
+
# Each major step prints `>>> BEGIN <step>` / `<<< END <step>`.
|
|
32
|
+
|
|
33
|
+
set -euo pipefail
|
|
34
|
+
|
|
35
|
+
step() { printf '\n>>> BEGIN %s\n' "$1"; }
|
|
36
|
+
done_() { printf '<<< END %s\n' "$1"; }
|
|
37
|
+
|
|
38
|
+
if [ "$(id -u)" -ne 0 ]; then
|
|
39
|
+
echo "provision.sh: must run as root (got uid $(id -u))" >&2
|
|
40
|
+
exit 64
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
step "dnf base packages"
|
|
44
|
+
# NOTE: do NOT request `curl` — AL2023 ships `curl-minimal` which provides the
|
|
45
|
+
# `curl` binary, and asking for full `curl` conflicts with it and aborts the
|
|
46
|
+
# whole (atomic) dnf transaction. `--allowerasing` lets dnf resolve any other
|
|
47
|
+
# such conflict by swapping rather than failing. No `| tail || true` here: that
|
|
48
|
+
# masks dnf's real exit code and lets the script march on with nothing
|
|
49
|
+
# installed (the bug that broke the first bake).
|
|
50
|
+
dnf install -y -q --allowerasing \
|
|
51
|
+
ca-certificates \
|
|
52
|
+
git \
|
|
53
|
+
tar \
|
|
54
|
+
gzip \
|
|
55
|
+
which \
|
|
56
|
+
shadow-utils \
|
|
57
|
+
sudo \
|
|
58
|
+
python3 \
|
|
59
|
+
python3-pip \
|
|
60
|
+
tmux \
|
|
61
|
+
vim \
|
|
62
|
+
libcap \
|
|
63
|
+
rsync
|
|
64
|
+
done_ "dnf base packages"
|
|
65
|
+
|
|
66
|
+
step "node 24 sanity"
|
|
67
|
+
# Vercel's node24 runtime already ships node; just confirm it's on PATH.
|
|
68
|
+
if ! command -v node >/dev/null 2>&1; then
|
|
69
|
+
echo "provision.sh: node not found on the node24 runtime — unexpected" >&2
|
|
70
|
+
exit 65
|
|
71
|
+
fi
|
|
72
|
+
node --version
|
|
73
|
+
done_ "node 24 sanity"
|
|
74
|
+
|
|
75
|
+
step "vscode user + sudoers"
|
|
76
|
+
# No forced uid: the Vercel default user (`vercel-sandbox`) may already hold
|
|
77
|
+
# 1000, and there are no bind mounts so uid-parity with the docker provider
|
|
78
|
+
# doesn't matter. Ownership + passwordless sudo is what counts.
|
|
79
|
+
if ! id vscode >/dev/null 2>&1; then
|
|
80
|
+
useradd -m -s /bin/bash vscode
|
|
81
|
+
fi
|
|
82
|
+
install -d -m 0755 -o vscode -g vscode /home/vscode
|
|
83
|
+
echo 'vscode ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/90-agentbox-vscode
|
|
84
|
+
chmod 0440 /etc/sudoers.d/90-agentbox-vscode
|
|
85
|
+
# Vercel's AL2023 base ships /etc/sudoers WITHOUT an includedir for
|
|
86
|
+
# /etc/sudoers.d (and with non-0440 perms), so the drop-in above is silently
|
|
87
|
+
# ignored and `sudo -n` as vscode fails with "a password is required" — which
|
|
88
|
+
# breaks the workspace seed, ctl-launch, and carry (all run as vscode and lean
|
|
89
|
+
# on passwordless sudo). Wire the include in and normalise perms so the rule
|
|
90
|
+
# actually loads, then fail loud if the result doesn't parse.
|
|
91
|
+
if ! grep -qE '^[[:space:]]*[@#]includedir[[:space:]]+/etc/sudoers\.d' /etc/sudoers; then
|
|
92
|
+
printf '\n@includedir /etc/sudoers.d\n' >> /etc/sudoers
|
|
93
|
+
fi
|
|
94
|
+
chmod 0440 /etc/sudoers
|
|
95
|
+
visudo -cf /etc/sudoers >/dev/null
|
|
96
|
+
done_ "vscode user + sudoers"
|
|
97
|
+
|
|
98
|
+
step "agentbox base dirs + /workspace ownership"
|
|
99
|
+
mkdir -p /workspace /run/agentbox /var/log/agentbox /etc/agentbox /etc/claude-code \
|
|
100
|
+
/usr/local/share/agentbox
|
|
101
|
+
chmod 755 /workspace
|
|
102
|
+
chown vscode:vscode /workspace /run/agentbox /var/log/agentbox
|
|
103
|
+
done_ "agentbox base dirs + /workspace ownership"
|
|
104
|
+
|
|
105
|
+
step "node setcap (bind <1024 without root)"
|
|
106
|
+
# The cloud WebProxy binds port 80; grant node the capability so it needn't run
|
|
107
|
+
# as root. Best-effort — if setcap is unavailable the WebProxy can still be
|
|
108
|
+
# launched via sudo.
|
|
109
|
+
NODE_BIN="$(readlink -f "$(command -v node)")"
|
|
110
|
+
setcap cap_net_bind_service=+ep "$NODE_BIN" || echo "provision.sh: setcap failed (continuing)"
|
|
111
|
+
done_ "node setcap (bind <1024 without root)"
|
|
112
|
+
|
|
113
|
+
step "corepack (pnpm + yarn shims)"
|
|
114
|
+
npm install -g corepack@latest 2>&1 | tail -2 || true
|
|
115
|
+
corepack enable pnpm yarn 2>/dev/null || true
|
|
116
|
+
sudo -u vscode -H mkdir -p /home/vscode/.cache/node/corepack
|
|
117
|
+
done_ "corepack (pnpm + yarn shims)"
|
|
118
|
+
|
|
119
|
+
step "git system-wide safe.directory"
|
|
120
|
+
# The Vercel node24 runtime's git is built with prefix /opt/git, so its system
|
|
121
|
+
# config is /opt/git/etc/gitconfig and the parent dir may not exist — without
|
|
122
|
+
# it `git config --system` fails with "could not lock config file" (exit 255).
|
|
123
|
+
# Create the dir, then set it system-wide AND for the vscode user so workspace
|
|
124
|
+
# git ops never trip "dubious ownership". All best-effort — a git-config quirk
|
|
125
|
+
# must never abort the bake.
|
|
126
|
+
mkdir -p /opt/git/etc 2>/dev/null || true
|
|
127
|
+
git config --system --add safe.directory '*' 2>/dev/null || true
|
|
128
|
+
sudo -u vscode -H git config --global --add safe.directory '*' 2>/dev/null || true
|
|
129
|
+
done_ "git system-wide safe.directory"
|
|
130
|
+
|
|
131
|
+
step "agentbox-ctl install"
|
|
132
|
+
install -m 0755 /tmp/agentbox-ctl /usr/local/bin/agentbox-ctl
|
|
133
|
+
done_ "agentbox-ctl install"
|
|
134
|
+
|
|
135
|
+
step "baked helper scripts (vnc / cleanup / xdg-open)"
|
|
136
|
+
install -m 0755 /tmp/agentbox-vnc-start /usr/local/bin/agentbox-vnc-start
|
|
137
|
+
install -m 0755 /tmp/agentbox-checkpoint-cleanup /usr/local/bin/agentbox-checkpoint-cleanup
|
|
138
|
+
install -m 0755 /tmp/agentbox-open /usr/local/bin/agentbox-open
|
|
139
|
+
ln -sf /usr/local/bin/agentbox-open /usr/local/bin/xdg-open
|
|
140
|
+
# NOTE: the gh + git shims are installed LAST (see "relay shims" near the end).
|
|
141
|
+
# Installing them here would put the relay-routing `git` on PATH ahead of
|
|
142
|
+
# /usr/bin/git and route provision.sh's own noVNC `git clone` through a relay
|
|
143
|
+
# that doesn't exist during the bake.
|
|
144
|
+
done_ "baked helper scripts (vnc / cleanup / xdg-open)"
|
|
145
|
+
|
|
146
|
+
step "baked config files (claude / codex / setup guide / tmux.conf)"
|
|
147
|
+
install -m 0644 /tmp/agentbox-custom-CLAUDE.md /etc/claude-code/CLAUDE.md
|
|
148
|
+
install -m 0644 /tmp/agentbox-managed-settings.json /etc/claude-code/managed-settings.json
|
|
149
|
+
install -m 0644 /tmp/agentbox-codex-hooks.json /usr/local/share/agentbox/codex-hooks.json
|
|
150
|
+
install -m 0644 /tmp/agentbox-setup-skill.md /usr/local/share/agentbox/setup-guide.md
|
|
151
|
+
|
|
152
|
+
cat > /etc/tmux.conf <<'TMUX'
|
|
153
|
+
set -g default-terminal "tmux-256color"
|
|
154
|
+
set -as terminal-overrides ",*:Tc"
|
|
155
|
+
set -as terminal-overrides ",*:RGB"
|
|
156
|
+
set -as terminal-features ",*:hyperlinks"
|
|
157
|
+
set -as terminal-features ",*:RGB"
|
|
158
|
+
set -g allow-passthrough on
|
|
159
|
+
set -g set-clipboard on
|
|
160
|
+
set -g extended-keys on
|
|
161
|
+
set -as terminal-features ",*:extkeys"
|
|
162
|
+
set -g mouse on
|
|
163
|
+
bind -T copy-mode WheelUpPane send -N2 -X scroll-up
|
|
164
|
+
bind -T copy-mode WheelDownPane send -N2 -X scroll-down
|
|
165
|
+
bind -T copy-mode-vi WheelUpPane send -N2 -X scroll-up
|
|
166
|
+
bind -T copy-mode-vi WheelDownPane send -N2 -X scroll-down
|
|
167
|
+
set -g history-limit 50000
|
|
168
|
+
set -g escape-time 0
|
|
169
|
+
TMUX
|
|
170
|
+
done_ "baked config files (claude / codex / setup guide / tmux.conf)"
|
|
171
|
+
|
|
172
|
+
step "credential pivot symlinks (vscode home)"
|
|
173
|
+
sudo -u vscode -H mkdir -p \
|
|
174
|
+
/home/vscode/.claude \
|
|
175
|
+
/home/vscode/.claude/skills/agentbox-setup \
|
|
176
|
+
/home/vscode/.codex \
|
|
177
|
+
/home/vscode/.local/share/opencode \
|
|
178
|
+
/home/vscode/.agentbox-creds/claude \
|
|
179
|
+
/home/vscode/.agentbox-creds/codex \
|
|
180
|
+
/home/vscode/.agentbox-creds/opencode
|
|
181
|
+
sudo -u vscode -H ln -sf /home/vscode/.agentbox-creds/claude/.credentials.json \
|
|
182
|
+
/home/vscode/.claude/.credentials.json
|
|
183
|
+
sudo -u vscode -H ln -sf /home/vscode/.agentbox-creds/codex/auth.json \
|
|
184
|
+
/home/vscode/.codex/auth.json
|
|
185
|
+
sudo -u vscode -H ln -sf /home/vscode/.agentbox-creds/opencode/auth.json \
|
|
186
|
+
/home/vscode/.local/share/opencode/auth.json
|
|
187
|
+
sudo -u vscode -H ln -sf /home/vscode/.claude/_claude.json /home/vscode/.claude.json
|
|
188
|
+
sudo -u vscode -H cp /usr/local/share/agentbox/setup-guide.md \
|
|
189
|
+
/home/vscode/.claude/skills/agentbox-setup/SKILL.md
|
|
190
|
+
done_ "credential pivot symlinks (vscode home)"
|
|
191
|
+
|
|
192
|
+
step "login-shell shim (/etc/profile.d/agentbox.sh)"
|
|
193
|
+
cat > /etc/profile.d/agentbox.sh <<'PROFILE'
|
|
194
|
+
# Auto-loaded by login shells; box.env is written at create time.
|
|
195
|
+
if [ -r /etc/agentbox/box.env ]; then
|
|
196
|
+
set -a
|
|
197
|
+
. /etc/agentbox/box.env
|
|
198
|
+
set +a
|
|
199
|
+
fi
|
|
200
|
+
case ":$PATH:" in
|
|
201
|
+
*:/home/vscode/.local/bin:*) : ;;
|
|
202
|
+
*) PATH=/home/vscode/.local/bin:$PATH ;;
|
|
203
|
+
esac
|
|
204
|
+
# Force /usr/local/bin to win PATH. Vercel's AL2023 base prepends /opt/git/bin
|
|
205
|
+
# AHEAD of /usr/local/bin, so the relay-routing shims at /usr/local/bin/{git,gh}
|
|
206
|
+
# are otherwise shadowed by the real binaries and agent-typed `git push` /
|
|
207
|
+
# `gh ...` bypass the host relay (backlog #19). A plain `case` prepend doesn't
|
|
208
|
+
# help — /usr/local/bin is already on PATH, just not first — so strip any
|
|
209
|
+
# existing occurrence and re-prepend.
|
|
210
|
+
PATH=/usr/local/bin:$(printf '%s' "$PATH" | sed -e 's#:/usr/local/bin:#:#g' -e 's#^/usr/local/bin:##' -e 's#:/usr/local/bin$##' -e 's#^/usr/local/bin$##')
|
|
211
|
+
export PATH
|
|
212
|
+
export COLORTERM=${COLORTERM:-truecolor}
|
|
213
|
+
export DISABLE_AUTOUPDATER=${DISABLE_AUTOUPDATER:-1}
|
|
214
|
+
export DISPLAY=${DISPLAY:-:1}
|
|
215
|
+
export AGENT_BROWSER_EXECUTABLE_PATH=${AGENT_BROWSER_EXECUTABLE_PATH:-/usr/local/bin/chromium}
|
|
216
|
+
export BROWSER=${BROWSER:-/usr/local/bin/agentbox-open}
|
|
217
|
+
PROFILE
|
|
218
|
+
chmod 0644 /etc/profile.d/agentbox.sh
|
|
219
|
+
done_ "login-shell shim (/etc/profile.d/agentbox.sh)"
|
|
220
|
+
|
|
221
|
+
step "VNC stack (TigerVNC + websockify + noVNC)"
|
|
222
|
+
# Best-effort: VNC is a convenience (agentbox screen). A package that isn't in
|
|
223
|
+
# the AL2023 repos shouldn't fail the whole bake — the VNC daemon launch is
|
|
224
|
+
# already best-effort on the create path.
|
|
225
|
+
dnf install -y -q --allowerasing tigervnc-server xterm 2>&1 | tail -3 || \
|
|
226
|
+
echo "provision.sh: tigervnc-server install failed (VNC may be unavailable)"
|
|
227
|
+
pip3 install --quiet websockify 2>&1 | tail -2 || \
|
|
228
|
+
echo "provision.sh: websockify install failed (VNC may be unavailable)"
|
|
229
|
+
# noVNC static assets — clone shallow into a stable path the vnc-start script
|
|
230
|
+
# can serve.
|
|
231
|
+
if [ ! -d /usr/local/share/novnc ]; then
|
|
232
|
+
git clone --depth 1 https://github.com/novnc/noVNC /usr/local/share/novnc 2>&1 | tail -2 || \
|
|
233
|
+
echo "provision.sh: noVNC clone failed (VNC may be unavailable)"
|
|
234
|
+
fi
|
|
235
|
+
sudo -u vscode -H mkdir -p /home/vscode/.vnc
|
|
236
|
+
done_ "VNC stack (TigerVNC + websockify + noVNC)"
|
|
237
|
+
|
|
238
|
+
step "agent CLIs (codex + opencode + agent-browser, global npm)"
|
|
239
|
+
npm install -g @openai/codex opencode-ai agent-browser 2>&1 | tail -3 || \
|
|
240
|
+
echo "provision.sh: one or more agent npm installs failed (continuing)"
|
|
241
|
+
done_ "agent CLIs (codex + opencode + agent-browser, global npm)"
|
|
242
|
+
|
|
243
|
+
step "Claude Code (native installer, run as vscode)"
|
|
244
|
+
# Anthropic's canonical installer drops `claude` at /home/vscode/.local/bin/.
|
|
245
|
+
sudo -u vscode -H bash -lc 'curl -fsSL https://claude.ai/install.sh | bash -s stable'
|
|
246
|
+
done_ "Claude Code (native installer, run as vscode)"
|
|
247
|
+
|
|
248
|
+
step "Chrome runtime libs (dnf)"
|
|
249
|
+
# agent-browser launches Chromium at AGENT_BROWSER_EXECUTABLE_PATH
|
|
250
|
+
# (/usr/local/bin/chromium, set in the login-shell shim above). Docker + hetzner
|
|
251
|
+
# bake that binary in; do the same here. These are the AL2023 (dnf) equivalents
|
|
252
|
+
# of the Ubuntu `t64` Chrome deps the other two providers apt-install — the
|
|
253
|
+
# Ubuntu package names don't exist on Amazon Linux 2023. Fail loud: a missing lib
|
|
254
|
+
# means a silently broken browser, not a convenience we can skip.
|
|
255
|
+
dnf install -y -q --allowerasing \
|
|
256
|
+
nss nspr atk at-spi2-atk at-spi2-core cups-libs \
|
|
257
|
+
libdrm libxkbcommon libXcomposite libXdamage libXfixes libXrandr \
|
|
258
|
+
libXext libX11 libxcb mesa-libgbm pango cairo alsa-lib \
|
|
259
|
+
liberation-fonts
|
|
260
|
+
done_ "Chrome runtime libs (dnf)"
|
|
261
|
+
|
|
262
|
+
step "playwright + Chromium download (as vscode)"
|
|
263
|
+
# Run the download as vscode so the cache lands under
|
|
264
|
+
# /home/vscode/.cache/ms-playwright. Resolve a stable symlink at
|
|
265
|
+
# /usr/local/bin/chromium so AGENT_BROWSER_EXECUTABLE_PATH stays predictable
|
|
266
|
+
# across Chromium revision bumps (mirrors hetzner install-box.sh).
|
|
267
|
+
npm install -g playwright 2>&1 | tail -3
|
|
268
|
+
sudo -u vscode -H bash -lc 'playwright install chromium'
|
|
269
|
+
CHROME_BIN="$(sudo -u vscode -H bash -lc 'ls /home/vscode/.cache/ms-playwright/chromium-*/chrome-linux*/chrome 2>/dev/null | sort | tail -1')"
|
|
270
|
+
if [ -z "$CHROME_BIN" ] || [ ! -x "$CHROME_BIN" ]; then
|
|
271
|
+
echo "provision.sh: could not resolve Playwright Chromium binary" >&2
|
|
272
|
+
exit 70
|
|
273
|
+
fi
|
|
274
|
+
# Fail loud if a shared lib is missing — this is where an incomplete AL2023 dep
|
|
275
|
+
# set surfaces at bake time instead of at first agent-browser launch. Capture
|
|
276
|
+
# ldd's output first (|| true): under `set -euo pipefail` a non-zero ldd exit
|
|
277
|
+
# would otherwise dominate the `ldd | grep` pipeline and make the missing-libs
|
|
278
|
+
# check a silent no-op even when 'not found' lines are present.
|
|
279
|
+
LDD_OUT="$(ldd "$CHROME_BIN" 2>&1 || true)"
|
|
280
|
+
if printf '%s\n' "$LDD_OUT" | grep -q 'not found'; then
|
|
281
|
+
echo "provision.sh: Chromium has unresolved shared libs:" >&2
|
|
282
|
+
printf '%s\n' "$LDD_OUT" | grep 'not found' >&2
|
|
283
|
+
exit 71
|
|
284
|
+
fi
|
|
285
|
+
ln -sf "$CHROME_BIN" /usr/local/bin/chromium
|
|
286
|
+
done_ "playwright + Chromium download (as vscode)"
|
|
287
|
+
|
|
288
|
+
step "dnf cleanup"
|
|
289
|
+
dnf clean all 2>/dev/null || true
|
|
290
|
+
done_ "dnf cleanup"
|
|
291
|
+
|
|
292
|
+
# Relay-routing shims, installed LAST — after every git/gh use in this script
|
|
293
|
+
# (the noVNC `git clone` and any npm/installer step). At RUNTIME agent calls to
|
|
294
|
+
# `gh ...` / `git push|pull|fetch|clone` must route through the host relay; the
|
|
295
|
+
# login-shell shim above forces /usr/local/bin ahead of Vercel's /opt/git/bin so
|
|
296
|
+
# these win (a plain install location is NOT enough on AL2023 — see #19). During
|
|
297
|
+
# the bake there is no relay, so they must not shadow the real binaries until
|
|
298
|
+
# provisioning is done. Installed from /tmp just before the trim step removes the
|
|
299
|
+
# sources.
|
|
300
|
+
step "relay shims (gh + git)"
|
|
301
|
+
install -m 0755 /tmp/agentbox-gh-shim /usr/local/bin/gh
|
|
302
|
+
install -m 0755 /tmp/agentbox-git-shim /usr/local/bin/git
|
|
303
|
+
done_ "relay shims (gh + git)"
|
|
304
|
+
|
|
305
|
+
step "trim /tmp/agentbox-*"
|
|
306
|
+
rm -f /tmp/agentbox-ctl /tmp/agentbox-vnc-start \
|
|
307
|
+
/tmp/agentbox-checkpoint-cleanup /tmp/agentbox-open \
|
|
308
|
+
/tmp/agentbox-gh-shim /tmp/agentbox-git-shim \
|
|
309
|
+
/tmp/agentbox-custom-CLAUDE.md /tmp/agentbox-managed-settings.json \
|
|
310
|
+
/tmp/agentbox-codex-hooks.json /tmp/agentbox-setup-skill.md
|
|
311
|
+
mv /tmp/agentbox-provision.sh /var/log/agentbox/provision.sh 2>/dev/null || true
|
|
312
|
+
done_ "trim /tmp/agentbox-*"
|
|
313
|
+
|
|
314
|
+
printf '\n*** provision.sh: complete — microVM ready for snapshot.\n'
|
|
@@ -164,14 +164,7 @@ services:
|
|
|
164
164
|
- A service with `restart: never` and an autostart dependency will block the dependent forever after one failed run — usually a mistake.
|
|
165
165
|
- `command:` is either a shell string (run via `bash -c`) or an argv array. Use the argv form if you need to avoid shell quoting.
|
|
166
166
|
|
|
167
|
-
## 8.
|
|
168
|
-
|
|
169
|
-
Checkpoint (snapshot) this box writable layer: once the box is warmed up (deps installed, services ready), checkpoint it with `agentbox-ctl checkpoint --name setup --replace --set-default` so future boxes start ready.
|
|
170
|
-
Run this command exactly once. The `--name setup --replace` makes it idempotent — if it ever needs to run again it overwrites the existing `setup` checkpoint instead of stacking duplicates.
|
|
171
|
-
This doesn't need to be confirmed by the user.
|
|
172
|
-
It will pause the container for several seconds so warn the user about it and write Done when it's done.
|
|
173
|
-
|
|
174
|
-
## 9. Hand-off
|
|
167
|
+
## 8. Hand-off
|
|
175
168
|
|
|
176
169
|
Tell the user (verbatim):
|
|
177
170
|
|
|
@@ -187,6 +180,14 @@ Tell the user (verbatim):
|
|
|
187
180
|
your box is ready, you can start more sessions with `agentbox claude`
|
|
188
181
|
you can access the web app at https://<boxname>.localhost
|
|
189
182
|
|
|
183
|
+
|
|
184
|
+
## 9. Checkpoint the warm state - DON't SKIP THIS STEP
|
|
185
|
+
|
|
186
|
+
Checkpoint (snapshot) this box writable layer: once the box is warmed up (deps installed, services ready), checkpoint it with `agentbox-ctl checkpoint --name setup --replace --set-default` so future boxes start ready.
|
|
187
|
+
Run this command exactly once. The `--name setup --replace` makes it idempotent — if it ever needs to run again it overwrites the existing `setup` checkpoint instead of stacking duplicates.
|
|
188
|
+
On all providers except Vercel, this doesn't need to be confirmed by the user. It will pause the container for several seconds so warn the user about it and write Done when it's done.
|
|
189
|
+
On Vercel: this actually STOPS the sandbox, so warn the user about it. Also the system will ask confirmation.
|
|
190
|
+
|
|
190
191
|
## 10. Known issues
|
|
191
192
|
|
|
192
193
|
- For Nextjs/Vite/Tasnstack projects, makes sure to forward also websocket for hot reload.
|