@madarco/agentbox 0.6.0 → 0.8.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.
Files changed (75) hide show
  1. package/dist/_cloud-attach-T727ZPRV.js +13 -0
  2. package/dist/chunk-67N47KUS.js +1640 -0
  3. package/dist/chunk-67N47KUS.js.map +1 -0
  4. package/dist/chunk-6OZDFNBF.js +8114 -0
  5. package/dist/chunk-6OZDFNBF.js.map +1 -0
  6. package/dist/chunk-BGK32PZE.js +455 -0
  7. package/dist/chunk-BGK32PZE.js.map +1 -0
  8. package/dist/chunk-FODMEHD3.js +1200 -0
  9. package/dist/chunk-FODMEHD3.js.map +1 -0
  10. package/dist/chunk-G3H2L3O2.js +288 -0
  11. package/dist/chunk-G3H2L3O2.js.map +1 -0
  12. package/dist/chunk-I24B6AXR.js +600 -0
  13. package/dist/chunk-I24B6AXR.js.map +1 -0
  14. package/dist/chunk-LEV3KICD.js +738 -0
  15. package/dist/chunk-LEV3KICD.js.map +1 -0
  16. package/dist/cloud-poller-SUNA6ZQC-2RG5WPRN.js +10 -0
  17. package/dist/dist-L4LCG5SJ.js +293 -0
  18. package/dist/dist-L4LCG5SJ.js.map +1 -0
  19. package/dist/dist-LOZBWMBF.js +447 -0
  20. package/dist/dist-ZODPD2I6.js +1407 -0
  21. package/dist/dist-ZODPD2I6.js.map +1 -0
  22. package/dist/index.js +7281 -2134
  23. package/dist/index.js.map +1 -1
  24. package/dist/prepared-state-CL4CWXQA-ME4HSKDE.js +18 -0
  25. package/package.json +8 -3
  26. package/runtime/daytona/custom-system-CLAUDE.md +39 -0
  27. package/runtime/docker/Dockerfile.box +120 -14
  28. package/runtime/docker/apps/cli/share/agentbox-setup/SKILL.md +15 -8
  29. package/runtime/docker/packages/ctl/dist/bin.cjs +11310 -816
  30. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-codex-hooks.json +68 -0
  31. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-open +9 -9
  32. package/runtime/docker/packages/sandbox-docker/scripts/claude-managed-settings.json +62 -1
  33. package/runtime/docker/packages/sandbox-docker/scripts/custom-system-CLAUDE.md +15 -4
  34. package/runtime/docker/packages/sandbox-docker/scripts/gh-shim +263 -0
  35. package/runtime/docker/packages/sandbox-docker/scripts/git-shim +131 -0
  36. package/runtime/docker/packages/sandbox-docker/scripts/opencode-agentbox-plugin.js +76 -0
  37. package/runtime/hetzner/agentbox-checkpoint-cleanup +52 -0
  38. package/runtime/hetzner/agentbox-codex-hooks.json +68 -0
  39. package/runtime/hetzner/agentbox-dockerd-start +132 -0
  40. package/runtime/hetzner/agentbox-open +28 -0
  41. package/runtime/hetzner/agentbox-setup-skill.md +196 -0
  42. package/runtime/hetzner/agentbox-vnc-start +77 -0
  43. package/runtime/hetzner/claude-managed-settings.json +115 -0
  44. package/runtime/hetzner/ctl.cjs +23397 -0
  45. package/runtime/hetzner/custom-system-CLAUDE.md +39 -0
  46. package/runtime/hetzner/gh-shim +263 -0
  47. package/runtime/hetzner/git-shim +131 -0
  48. package/runtime/hetzner/opencode-agentbox-plugin.js +76 -0
  49. package/runtime/hetzner/scripts/install-box.sh +374 -0
  50. package/runtime/relay/bin.cjs +10017 -817
  51. package/share/agentbox-setup/SKILL.md +15 -8
  52. package/share/host-skills/agentbox/SKILL.md +29 -0
  53. package/share/host-skills/agentbox-info/SKILL.md +211 -0
  54. package/share/host-skills/codex/agentbox.md +35 -0
  55. package/share/host-skills/opencode/agentbox.md +26 -0
  56. package/dist/chunk-BBZMA2K6.js +0 -238
  57. package/dist/chunk-BBZMA2K6.js.map +0 -1
  58. package/dist/chunk-HHMWQNLF.js +0 -1709
  59. package/dist/chunk-HHMWQNLF.js.map +0 -1
  60. package/dist/chunk-HPZMD5DE.js +0 -106
  61. package/dist/chunk-HPZMD5DE.js.map +0 -1
  62. package/dist/chunk-HTTKML3C.js +0 -2655
  63. package/dist/chunk-HTTKML3C.js.map +0 -1
  64. package/dist/chunk-KJNZP6I3.js +0 -586
  65. package/dist/chunk-KJNZP6I3.js.map +0 -1
  66. package/dist/chunk-M7I247BK.js +0 -525
  67. package/dist/chunk-M7I247BK.js.map +0 -1
  68. package/dist/create-6PWXI6HO-OWAMHBAK.js +0 -15
  69. package/dist/lifecycle-EMXR46DI-DUVBXNTV.js +0 -38
  70. package/dist/state-KD7M46ZP-KHFTHFUS.js +0 -26
  71. package/dist/stats-SZXOJE3D-N7OODCHW.js +0 -19
  72. /package/dist/{create-6PWXI6HO-OWAMHBAK.js.map → _cloud-attach-T727ZPRV.js.map} +0 -0
  73. /package/dist/{lifecycle-EMXR46DI-DUVBXNTV.js.map → cloud-poller-SUNA6ZQC-2RG5WPRN.js.map} +0 -0
  74. /package/dist/{state-KD7M46ZP-KHFTHFUS.js.map → dist-LOZBWMBF.js.map} +0 -0
  75. /package/dist/{stats-SZXOJE3D-N7OODCHW.js.map → prepared-state-CL4CWXQA-ME4HSKDE.js.map} +0 -0
@@ -0,0 +1,374 @@
1
+ #!/usr/bin/env bash
2
+ # AgentBox Hetzner base-image installer.
3
+ #
4
+ # Idempotent shell-script mirror of `packages/sandbox-docker/Dockerfile.box`,
5
+ # run once on a freshly-booted Ubuntu 24.04 VPS during
6
+ # `agentbox prepare --provider hetzner`. After this script completes we
7
+ # `create_image` the VPS — that snapshot is what every per-box create boots
8
+ # from.
9
+ #
10
+ # Required inputs (already in place when this script runs):
11
+ # /tmp/agentbox-ctl -- prebuilt @agentbox/ctl bundle (cjs)
12
+ # /tmp/agentbox-vnc-start -- VNC startup helper
13
+ # /tmp/agentbox-dockerd-start -- DinD startup helper
14
+ # /tmp/agentbox-checkpoint-cleanup -- pre-snapshot cleanup helper
15
+ # /tmp/agentbox-open -- in-box xdg-open shim
16
+ # /tmp/agentbox-gh-shim -- in-box `gh` shim (routes to host gh via relay)
17
+ # /tmp/agentbox-git-shim -- in-box `git` shim (routes push/pull/fetch/clone via relay)
18
+ # /tmp/agentbox-custom-CLAUDE.md -- /etc/claude-code/CLAUDE.md content
19
+ # /tmp/agentbox-managed-settings.json -- /etc/claude-code/managed-settings.json
20
+ # /tmp/agentbox-codex-hooks.json -- /usr/local/share/agentbox/codex-hooks.json
21
+ # /tmp/agentbox-setup-skill.md -- /usr/local/share/agentbox/setup-guide.md
22
+ #
23
+ # Output: noisy progress to stdout (the host streams it into
24
+ # ~/.agentbox/logs/prepare.log via the ssh exec). Each major step prints
25
+ # `>>> BEGIN <step>` and `<<< END <step>` so a tail-watcher can spot a hang.
26
+
27
+ set -euo pipefail
28
+
29
+ step() { printf '\n>>> BEGIN %s\n' "$1"; }
30
+ done_() { printf '<<< END %s\n' "$1"; }
31
+
32
+ if [ "$(id -u)" -ne 0 ]; then
33
+ echo "install-box.sh: must run as root (got uid $(id -u))" >&2
34
+ exit 64
35
+ fi
36
+
37
+ export DEBIAN_FRONTEND=noninteractive
38
+
39
+ step "wait for cloud-init"
40
+ # sshd is up via cloud-init's `users:` module before all of cloud-init's
41
+ # modules finish. Without this wait, our own `apt-get update` can race
42
+ # against cloud-init's apt operations (unattended-upgrades, etc.) and fail
43
+ # with "Could not get lock /var/lib/dpkg/lock-frontend".
44
+ cloud-init status --wait || true
45
+ done_ "wait for cloud-init"
46
+
47
+ step "apt update + base packages"
48
+ apt-get update
49
+ apt-get install -y --no-install-recommends \
50
+ curl ca-certificates gnupg
51
+ done_ "apt update + base packages"
52
+
53
+ step "Node 24 via NodeSource"
54
+ if ! command -v node >/dev/null 2>&1 || ! node --version | grep -qE '^v24\.'; then
55
+ curl -fsSL https://deb.nodesource.com/setup_24.x | bash -
56
+ fi
57
+ done_ "Node 24 via NodeSource"
58
+
59
+ step "core runtime + tooling"
60
+ apt-get install -y --no-install-recommends \
61
+ fuse3 \
62
+ fuse-overlayfs \
63
+ rsync \
64
+ nodejs \
65
+ python3 \
66
+ python3-pip \
67
+ python3-venv \
68
+ build-essential \
69
+ git \
70
+ tmux \
71
+ vim \
72
+ libcap2-bin \
73
+ sudo \
74
+ locales \
75
+ bash-completion
76
+ # devcontainers/base bakes en_US.UTF-8; on plain Ubuntu we have to generate it
77
+ # ourselves so /etc/profile.d/agentbox.sh's LANG export doesn't surface a
78
+ # locale warning.
79
+ locale-gen en_US.UTF-8 >/dev/null 2>&1 || true
80
+ update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 >/dev/null 2>&1 || true
81
+ done_ "core runtime + tooling"
82
+
83
+ step "vscode user (UID 1000) + sudoers"
84
+ # The devcontainers base image creates `vscode` for us; on plain Ubuntu we
85
+ # do it ourselves. UID 1000 matches the docker provider so any path that
86
+ # bakes in /home/vscode (agentbox-ctl, /etc/profile.d/agentbox.sh, the
87
+ # credential symlinks, the in-box configs) Just Works regardless of provider.
88
+ if ! id vscode >/dev/null 2>&1; then
89
+ # Hetzner's stock images already create a sequenced UID 1000 user named
90
+ # `debian` / `ubuntu` depending on the distro stage. If something owns UID
91
+ # 1000 already, rename that account to `vscode` instead of failing — keeps
92
+ # any cloud-init-deposited files (authorized_keys) discoverable under the
93
+ # new home.
94
+ if existing="$(getent passwd 1000 | cut -d: -f1)"; then
95
+ if [ -n "$existing" ] && [ "$existing" != "vscode" ]; then
96
+ usermod -l vscode "$existing"
97
+ usermod -d /home/vscode -m vscode || true
98
+ groupmod -n vscode "$existing" 2>/dev/null || true
99
+ fi
100
+ fi
101
+ if ! id vscode >/dev/null 2>&1; then
102
+ useradd -m -u 1000 -s /bin/bash vscode
103
+ fi
104
+ fi
105
+ install -d -m 0755 -o vscode -g vscode /home/vscode
106
+ echo 'vscode ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/90-agentbox-vscode
107
+ chmod 0440 /etc/sudoers.d/90-agentbox-vscode
108
+ done_ "vscode user (UID 1000) + sudoers"
109
+
110
+ step "agentbox base dirs + /workspace ownership"
111
+ mkdir -p /workspace /run/agentbox /var/log/agentbox /etc/agentbox /etc/claude-code \
112
+ /usr/local/share/agentbox
113
+ chmod 755 /workspace
114
+ chown vscode:vscode /workspace /run/agentbox /var/log/agentbox
115
+ done_ "agentbox base dirs + /workspace ownership"
116
+
117
+ step "node setcap (port <1024 bind without root)"
118
+ NODE_BIN="$(readlink -f "$(command -v node)")"
119
+ setcap cap_net_bind_service=+ep "$NODE_BIN"
120
+ done_ "node setcap (port <1024 bind without root)"
121
+
122
+ step "corepack (pnpm + yarn shims)"
123
+ npm install -g corepack@latest
124
+ corepack enable pnpm yarn
125
+ done_ "corepack (pnpm + yarn shims)"
126
+
127
+ step "corepack cache dir (vscode-owned, prevents first-use ENOENT)"
128
+ sudo -u vscode -H mkdir -p /home/vscode/.cache/node/corepack
129
+ done_ "corepack cache dir (vscode-owned, prevents first-use ENOENT)"
130
+
131
+ step "git system-wide safe.directory"
132
+ git config --system --add safe.directory '*'
133
+ done_ "git system-wide safe.directory"
134
+
135
+ step "docker + iptables for in-VPS DinD"
136
+ apt-get install -y --no-install-recommends \
137
+ docker.io \
138
+ iptables
139
+ mkdir -p /etc/docker
140
+ printf '%s\n' '{ "iptables": true }' > /etc/docker/daemon.json
141
+ usermod -aG docker vscode
142
+ # In-VPS dockerd is launched by the cloud-provider scaffolding via
143
+ # `agentbox-dockerd-start` (the same script the docker provider uses), so the
144
+ # systemd `docker.service` shouldn't auto-start — we want the agentbox
145
+ # helper's storage-driver-probe + flag composition, not Ubuntu's defaults.
146
+ systemctl disable --now docker.service 2>/dev/null || true
147
+ systemctl disable --now docker.socket 2>/dev/null || true
148
+ done_ "docker + iptables for in-VPS DinD"
149
+
150
+ step "agentbox-ctl install"
151
+ install -m 0755 /tmp/agentbox-ctl /usr/local/bin/agentbox-ctl
152
+ done_ "agentbox-ctl install"
153
+
154
+ # === EARLY BAKE: helper scripts, baked configs, profile/sshd shims ===
155
+ # Originally these steps lived after Chromium download (which takes ~5min).
156
+ # We moved them up because — for reasons that didn't fully resolve in
157
+ # diagnostic runs — bash's set -x trace, the pipe-tee log capture, and any
158
+ # subsequent file system writes from this script silently stop emitting
159
+ # output after the long-running `playwright install chromium` exec, leaving
160
+ # the snapshot missing every file these steps would install. Running them
161
+ # *before* Chromium sidesteps the issue and keeps the snapshot complete.
162
+ # Tracked as Phase-7 follow-up in docs/hertzner_backlog.md.
163
+
164
+ step "baked helper scripts (vnc / dockerd / cleanup / xdg-open / gh + git shims)"
165
+ install -m 0755 /tmp/agentbox-vnc-start /usr/local/bin/agentbox-vnc-start
166
+ install -m 0755 /tmp/agentbox-dockerd-start /usr/local/bin/agentbox-dockerd-start
167
+ install -m 0755 /tmp/agentbox-checkpoint-cleanup /usr/local/bin/agentbox-checkpoint-cleanup
168
+ install -m 0755 /tmp/agentbox-open /usr/local/bin/agentbox-open
169
+ ln -sf /usr/local/bin/agentbox-open /usr/local/bin/xdg-open
170
+ # gh + git shims — same files baked by Dockerfile.box for the docker provider.
171
+ # The shim wins on PATH (default /usr/local/bin precedes /usr/bin) so any agent
172
+ # call to `gh ...` / `git push|pull|fetch|clone` routes through the relay; the
173
+ # git shim execs /usr/bin/git for everything else, no overhead.
174
+ install -m 0755 /tmp/agentbox-gh-shim /usr/local/bin/gh
175
+ install -m 0755 /tmp/agentbox-git-shim /usr/local/bin/git
176
+ done_ "baked helper scripts (vnc / dockerd / cleanup / xdg-open / gh + git shims)"
177
+
178
+ step "baked config files (claude / codex / setup guide / tmux.conf)"
179
+ install -m 0644 /tmp/agentbox-custom-CLAUDE.md /etc/claude-code/CLAUDE.md
180
+ install -m 0644 /tmp/agentbox-managed-settings.json /etc/claude-code/managed-settings.json
181
+ install -m 0644 /tmp/agentbox-codex-hooks.json /usr/local/share/agentbox/codex-hooks.json
182
+ install -m 0644 /tmp/agentbox-setup-skill.md /usr/local/share/agentbox/setup-guide.md
183
+
184
+ # tmux.conf — verbatim from Dockerfile.box.
185
+ cat > /etc/tmux.conf <<'TMUX'
186
+ set -g default-terminal "tmux-256color"
187
+ set -as terminal-overrides ",*:Tc"
188
+ set -as terminal-overrides ",*:RGB"
189
+ set -as terminal-features ",*:hyperlinks"
190
+ set -as terminal-features ",*:RGB"
191
+ set -g allow-passthrough on
192
+ set -g set-clipboard on
193
+ set -g extended-keys on
194
+ set -as terminal-features ",*:extkeys"
195
+ set -g mouse on
196
+ bind -T copy-mode WheelUpPane send -N2 -X scroll-up
197
+ bind -T copy-mode WheelDownPane send -N2 -X scroll-down
198
+ bind -T copy-mode-vi WheelUpPane send -N2 -X scroll-up
199
+ bind -T copy-mode-vi WheelDownPane send -N2 -X scroll-down
200
+ set -g history-limit 50000
201
+ set -g escape-time 0
202
+ TMUX
203
+ done_ "baked config files (claude / codex / setup guide / tmux.conf)"
204
+
205
+ step "credential pivot symlinks (vscode home)"
206
+ sudo -u vscode -H mkdir -p \
207
+ /home/vscode/.claude \
208
+ /home/vscode/.claude/skills/agentbox-setup \
209
+ /home/vscode/.codex \
210
+ /home/vscode/.local/share/opencode \
211
+ /home/vscode/.agentbox-creds/claude \
212
+ /home/vscode/.agentbox-creds/codex \
213
+ /home/vscode/.agentbox-creds/opencode
214
+ sudo -u vscode -H ln -sf /home/vscode/.agentbox-creds/claude/.credentials.json \
215
+ /home/vscode/.claude/.credentials.json
216
+ sudo -u vscode -H ln -sf /home/vscode/.agentbox-creds/codex/auth.json \
217
+ /home/vscode/.codex/auth.json
218
+ sudo -u vscode -H ln -sf /home/vscode/.agentbox-creds/opencode/auth.json \
219
+ /home/vscode/.local/share/opencode/auth.json
220
+ sudo -u vscode -H ln -sf /home/vscode/.claude/_claude.json /home/vscode/.claude.json
221
+
222
+ # `/agentbox-setup` skill — the in-box-only first-run wizard the setup
223
+ # prompt references. Docker's seedSetupSkillIntoVolume() (sandbox-docker/
224
+ # src/claude.ts) does this at create time via a helper container with the
225
+ # claude-config volume mounted. Hetzner doesn't have a shared volume — we
226
+ # bake it directly into the snapshot here so every box has it. The same
227
+ # content is also reachable as a static file at /usr/local/share/agentbox/
228
+ # setup-guide.md (referenced as fallback in the wizard initial prompt).
229
+ # `tar -xzf` of the host's ~/.claude in prepareHetzner extracts WITHOUT
230
+ # removing pre-existing files in the dest, so this skill survives the
231
+ # subsequent static-config bake.
232
+ sudo -u vscode -H cp /usr/local/share/agentbox/setup-guide.md \
233
+ /home/vscode/.claude/skills/agentbox-setup/SKILL.md
234
+ done_ "credential pivot symlinks (vscode home)"
235
+
236
+ step "login-shell shim (/etc/profile.d/agentbox.sh)"
237
+ cat > /etc/profile.d/agentbox.sh <<'PROFILE'
238
+ # Auto-loaded by login shells; box.env is written at create time.
239
+ if [ -r /etc/agentbox/box.env ]; then
240
+ set -a
241
+ . /etc/agentbox/box.env
242
+ set +a
243
+ fi
244
+ case ":$PATH:" in
245
+ *:/home/vscode/.local/bin:*) : ;;
246
+ *) PATH=/home/vscode/.local/bin:$PATH ;;
247
+ esac
248
+ export PATH
249
+ export COLORTERM=${COLORTERM:-truecolor}
250
+ export DISABLE_AUTOUPDATER=${DISABLE_AUTOUPDATER:-1}
251
+ export LANG=${LANG:-en_US.UTF-8}
252
+ export LC_ALL=${LC_ALL:-en_US.UTF-8}
253
+ export DISPLAY=${DISPLAY:-:1}
254
+ export AGENT_BROWSER_EXECUTABLE_PATH=${AGENT_BROWSER_EXECUTABLE_PATH:-/usr/local/bin/chromium}
255
+ export BROWSER=${BROWSER:-/usr/local/bin/agentbox-open}
256
+ PROFILE
257
+ chmod 0644 /etc/profile.d/agentbox.sh
258
+ done_ "login-shell shim (/etc/profile.d/agentbox.sh)"
259
+
260
+ step "sshd hardening drop-in"
261
+ cat > /etc/ssh/sshd_config.d/agentbox.conf <<'SSHD'
262
+ # Written by AgentBox install-box.sh — see plan §"safety model".
263
+ PasswordAuthentication no
264
+ PermitRootLogin no
265
+ PubkeyAuthentication yes
266
+ AllowUsers vscode
267
+ AllowTcpForwarding yes
268
+ GatewayPorts no
269
+ PermitTunnel no
270
+ X11Forwarding no
271
+ ChallengeResponseAuthentication no
272
+ KbdInteractiveAuthentication no
273
+ SSHD
274
+ # Don't reload sshd here — we still need root SSH for the rest of the
275
+ # install. The drop-in takes effect on next sshd restart (the snapshot will
276
+ # include it; the next boot reads it).
277
+ done_ "sshd hardening drop-in"
278
+
279
+ step "allow unprivileged user namespaces (sysctl drop-in)"
280
+ # Ubuntu 23.10+ / 24.04 enables an AppArmor knob that blocks unprivileged
281
+ # user namespaces, which Chromium's sandbox needs. Without this, every
282
+ # in-box `chromium` / `agent-browser` invocation dies with
283
+ # "FATAL: zygote_host_impl_linux.cc: No usable sandbox!". Docker boxes
284
+ # don't hit it because the host kernel running their containers is older
285
+ # (or they get the relaxed sysctl from the docker host). On a bare Ubuntu
286
+ # 24.04 Hetzner VPS we have to flip it ourselves.
287
+ #
288
+ # We flip both the modern knob (`apparmor_restrict_unprivileged_userns`)
289
+ # and the legacy `unprivileged_userns_clone` — the legacy one is already
290
+ # 1 on 24.04 but writing it costs nothing and keeps the drop-in valid if
291
+ # a future kernel hardens the default back to 0.
292
+ cat > /etc/sysctl.d/99-agentbox-userns.conf <<'SYSCTL'
293
+ # Written by AgentBox install-box.sh — Chromium needs unprivileged user
294
+ # namespaces for its sandbox; the VPS itself is the isolation boundary.
295
+ kernel.apparmor_restrict_unprivileged_userns = 0
296
+ kernel.unprivileged_userns_clone = 1
297
+ SYSCTL
298
+ chmod 0644 /etc/sysctl.d/99-agentbox-userns.conf
299
+ # Apply now too so the rest of this install (in particular `playwright
300
+ # install chromium`'s post-install probe) works without needing a reboot
301
+ # of the prepare VPS. The drop-in then re-applies on every boot of the
302
+ # baked snapshot.
303
+ sysctl -p /etc/sysctl.d/99-agentbox-userns.conf >/dev/null
304
+ done_ "allow unprivileged user namespaces (sysctl drop-in)"
305
+
306
+ # === END EARLY BAKE ===
307
+
308
+ step "VNC stack (TigerVNC + noVNC + websockify + autocutsel)"
309
+ apt-get install -y --no-install-recommends \
310
+ tigervnc-standalone-server tigervnc-common tigervnc-tools \
311
+ novnc websockify \
312
+ autocutsel xclip
313
+ mkdir -p /home/vscode/.vnc
314
+ chown -R vscode:vscode /home/vscode/.vnc
315
+ done_ "VNC stack (TigerVNC + noVNC + websockify + autocutsel)"
316
+
317
+ step "Chrome runtime libs"
318
+ apt-get install -y --no-install-recommends \
319
+ libnss3 libnspr4 libatk1.0-0t64 libatk-bridge2.0-0t64 libcups2t64 \
320
+ libxkbcommon0 libxcomposite1 libxdamage1 libxfixes3 libxrandr2 \
321
+ libgbm1 libdrm2 libpango-1.0-0 libcairo2 libasound2t64 \
322
+ fonts-liberation xdg-utils
323
+ done_ "Chrome runtime libs"
324
+
325
+ step "agent-browser + playwright + portless (global npm)"
326
+ npm install -g agent-browser playwright portless
327
+ done_ "agent-browser + playwright + portless (global npm)"
328
+
329
+ step "Codex CLI prereqs (bubblewrap) + agent installs"
330
+ apt-get install -y --no-install-recommends bubblewrap
331
+ npm install -g @openai/codex opencode-ai
332
+ done_ "Codex CLI prereqs (bubblewrap) + agent installs"
333
+
334
+ step "Claude Code (native installer, run as vscode)"
335
+ # Anthropic's native installer drops `claude` at /home/vscode/.local/bin/.
336
+ # Run as vscode so the binary lands in the right home and is owned by the
337
+ # user that'll execute it. DISABLE_AUTOUPDATER is set globally via
338
+ # /etc/profile.d/agentbox.sh below.
339
+ sudo -u vscode -H bash -lc 'curl -fsSL https://claude.ai/install.sh | bash -s stable'
340
+ done_ "Claude Code (native installer, run as vscode)"
341
+
342
+ step "Chromium download via Playwright (as vscode)"
343
+ # Run the download as vscode so the cache lands under
344
+ # /home/vscode/.cache/ms-playwright. Resolve a stable symlink at
345
+ # /usr/local/bin/chromium so AGENT_BROWSER_EXECUTABLE_PATH stays predictable
346
+ # across Chromium revision bumps.
347
+ sudo -u vscode -H bash -lc 'playwright install chromium'
348
+ CHROME_BIN="$(sudo -u vscode -H bash -lc 'ls /home/vscode/.cache/ms-playwright/chromium-*/chrome-linux*/chrome 2>/dev/null | sort | tail -1')"
349
+ if [ -z "$CHROME_BIN" ] || [ ! -x "$CHROME_BIN" ]; then
350
+ echo "install-box.sh: could not resolve Playwright Chromium binary" >&2
351
+ exit 70
352
+ fi
353
+ ln -sf "$CHROME_BIN" /usr/local/bin/chromium
354
+ done_ "Chromium download via Playwright (as vscode)"
355
+
356
+ step "apt cleanup"
357
+ apt-get clean
358
+ rm -rf /var/lib/apt/lists/*
359
+ done_ "apt cleanup"
360
+
361
+ step "trim /tmp/agentbox-*"
362
+ # Keep the install script itself out of the trim list — it's referenced by
363
+ # the install log saved into the snapshot so a Phase-7-style diagnostic can
364
+ # re-read which lines actually executed against which source.
365
+ rm -f /tmp/agentbox-ctl /tmp/agentbox-vnc-start /tmp/agentbox-dockerd-start \
366
+ /tmp/agentbox-checkpoint-cleanup /tmp/agentbox-open \
367
+ /tmp/agentbox-gh-shim /tmp/agentbox-git-shim \
368
+ /tmp/agentbox-custom-CLAUDE.md /tmp/agentbox-managed-settings.json \
369
+ /tmp/agentbox-codex-hooks.json /tmp/agentbox-setup-skill.md
370
+ # Move install-box.sh into the persistent location for diagnostics.
371
+ mv /tmp/agentbox-install.sh /var/log/agentbox/install-box.sh 2>/dev/null || true
372
+ done_ "trim /tmp/agentbox-*"
373
+
374
+ printf '\n*** install-box.sh: complete — VPS ready for create_image snapshot.\n'