@madarco/agentbox 0.23.4 → 0.24.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 (193) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/LICENSE +21 -0
  3. package/README.md +3 -2
  4. package/dist/{_cloud-attach-BQRWX3J2.js → _cloud-attach-T6GPR6LJ.js} +5 -5
  5. package/dist/{chunk-GGRZ3GZO.js → chunk-5KHEH47T.js} +91 -79
  6. package/dist/chunk-5KHEH47T.js.map +1 -0
  7. package/dist/{chunk-I6ZRWTPR.js → chunk-6U2S6QWD.js} +219 -18
  8. package/dist/chunk-6U2S6QWD.js.map +1 -0
  9. package/dist/{chunk-LK2JT2OO.js → chunk-DEDTPG2D.js} +880 -146
  10. package/dist/chunk-DEDTPG2D.js.map +1 -0
  11. package/dist/chunk-G3H2L3O2.js +0 -0
  12. package/dist/{chunk-LA4JMS27.js → chunk-I654PBHA.js} +290 -330
  13. package/dist/chunk-I654PBHA.js.map +1 -0
  14. package/dist/{chunk-W3FQPFP7.js → chunk-K2EDQGZP.js} +18 -4
  15. package/dist/chunk-K2EDQGZP.js.map +1 -0
  16. package/dist/{chunk-LSQXT5WZ.js → chunk-LC4E2EIZ.js} +3 -3
  17. package/dist/{chunk-LSQXT5WZ.js.map → chunk-LC4E2EIZ.js.map} +1 -1
  18. package/dist/{chunk-SFA57TGX.js → chunk-NACA6AM7.js} +183 -49
  19. package/dist/chunk-NACA6AM7.js.map +1 -0
  20. package/dist/{chunk-QEQFZLYR.js → chunk-RYQLFKCP.js} +20 -10
  21. package/dist/chunk-RYQLFKCP.js.map +1 -0
  22. package/dist/{chunk-QT3SHMLY.js → chunk-UIRBYL4G.js} +43 -12
  23. package/dist/chunk-UIRBYL4G.js.map +1 -0
  24. package/dist/chunk-WJFZJZIM.js +0 -0
  25. package/dist/chunk-WLHJZPFJ.js +845 -0
  26. package/dist/chunk-WLHJZPFJ.js.map +1 -0
  27. package/dist/cloud-poller-SUNA6ZQC-7M5LJHHE.js +0 -0
  28. package/dist/dist-3KIJ2KQ2.js +1437 -0
  29. package/dist/dist-3KIJ2KQ2.js.map +1 -0
  30. package/dist/{dist-V235KVEX.js → dist-7OUOHQPA.js} +196 -151
  31. package/dist/dist-7OUOHQPA.js.map +1 -0
  32. package/dist/{dist-Z2NEVV55.js → dist-B7TNWGVG.js} +8 -4
  33. package/dist/{dist-CUKBKS3N.js → dist-KYV3LEHG.js} +10 -6
  34. package/dist/{dist-FXQFTT75.js → dist-PHYCFYKH.js} +37 -17
  35. package/dist/dist-PHYCFYKH.js.map +1 -0
  36. package/dist/{dist-2BTJQUJS.js → dist-T5MXBZGP.js} +2 -2
  37. package/dist/{dist-QO4CTLAX.js → dist-Z7KEPQC7.js} +6 -6
  38. package/dist/index.js +2560 -1108
  39. package/dist/index.js.map +1 -1
  40. package/dist/{prepared-state-BUO75YLZ-CDTISC2C.js → prepared-state-BUO75YLZ-RQRFFBJW.js} +2 -2
  41. package/package.json +28 -28
  42. package/runtime/_shared/agentbox-checkpoint-cleanup +0 -0
  43. package/runtime/_shared/agentbox-codex-hooks.json +1 -1
  44. package/runtime/_shared/agentbox-dockerd-start +0 -0
  45. package/runtime/_shared/agentbox-open +0 -0
  46. package/runtime/_shared/agentbox-portless-trust +0 -0
  47. package/runtime/_shared/agentbox-vnc-start +0 -0
  48. package/runtime/_shared/ctl.cjs +468 -97
  49. package/runtime/_shared/gh-shim +0 -0
  50. package/runtime/_shared/git-shim +53 -3
  51. package/runtime/_shared/linear-shim +0 -0
  52. package/runtime/_shared/ntn-shim +0 -0
  53. package/runtime/daytona/custom-system-CLAUDE.md +1 -1
  54. package/runtime/digitalocean/agentbox-checkpoint-cleanup +55 -0
  55. package/runtime/digitalocean/agentbox-codex-hooks.json +68 -0
  56. package/runtime/digitalocean/agentbox-dockerd-start +145 -0
  57. package/runtime/digitalocean/agentbox-open +28 -0
  58. package/runtime/digitalocean/agentbox-portless-trust +82 -0
  59. package/runtime/digitalocean/agentbox-setup-skill.md +317 -0
  60. package/runtime/digitalocean/agentbox-vnc-start +102 -0
  61. package/runtime/digitalocean/claude-managed-settings.json +116 -0
  62. package/runtime/digitalocean/ctl.cjs +27852 -0
  63. package/runtime/digitalocean/custom-system-CLAUDE.md +39 -0
  64. package/runtime/digitalocean/gh-shim +344 -0
  65. package/runtime/digitalocean/git-shim +181 -0
  66. package/runtime/digitalocean/linear-shim +181 -0
  67. package/runtime/digitalocean/ntn-shim +95 -0
  68. package/runtime/digitalocean/opencode-agentbox-plugin.js +76 -0
  69. package/runtime/digitalocean/scripts/install-box.sh +462 -0
  70. package/runtime/docker/Dockerfile.box +5 -0
  71. package/runtime/docker/packages/ctl/dist/bin.cjs +468 -97
  72. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-checkpoint-cleanup +0 -0
  73. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-codex-hooks.json +1 -1
  74. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-dockerd-start +0 -0
  75. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-open +0 -0
  76. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-portless-trust +0 -0
  77. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-sshd-start +0 -0
  78. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-vnc-start +0 -0
  79. package/runtime/docker/packages/sandbox-docker/scripts/chromium-resolver +0 -0
  80. package/runtime/docker/packages/sandbox-docker/scripts/custom-system-CLAUDE.md +2 -1
  81. package/runtime/docker/packages/sandbox-docker/scripts/gh-shim +0 -0
  82. package/runtime/docker/packages/sandbox-docker/scripts/git-shim +53 -3
  83. package/runtime/docker/packages/sandbox-docker/scripts/linear-shim +0 -0
  84. package/runtime/docker/packages/sandbox-docker/scripts/ntn-shim +0 -0
  85. package/runtime/e2b/agentbox-checkpoint-cleanup +0 -0
  86. package/runtime/e2b/agentbox-codex-hooks.json +1 -1
  87. package/runtime/e2b/agentbox-dockerd-start +0 -0
  88. package/runtime/e2b/agentbox-open +0 -0
  89. package/runtime/e2b/agentbox-vnc-start +0 -0
  90. package/runtime/e2b/ctl.cjs +468 -97
  91. package/runtime/e2b/custom-system-CLAUDE.md +6 -3
  92. package/runtime/e2b/gh-shim +0 -0
  93. package/runtime/e2b/git-shim +53 -3
  94. package/runtime/e2b/linear-shim +0 -0
  95. package/runtime/e2b/ntn-shim +0 -0
  96. package/runtime/e2b/scripts/build-template.sh +16 -0
  97. package/runtime/hetzner/agentbox-checkpoint-cleanup +0 -0
  98. package/runtime/hetzner/agentbox-codex-hooks.json +1 -1
  99. package/runtime/hetzner/agentbox-dockerd-start +0 -0
  100. package/runtime/hetzner/agentbox-open +0 -0
  101. package/runtime/hetzner/agentbox-portless-trust +0 -0
  102. package/runtime/hetzner/agentbox-vnc-start +0 -0
  103. package/runtime/hetzner/ctl.cjs +468 -97
  104. package/runtime/hetzner/custom-system-CLAUDE.md +1 -1
  105. package/runtime/hetzner/gh-shim +0 -0
  106. package/runtime/hetzner/git-shim +53 -3
  107. package/runtime/hetzner/linear-shim +0 -0
  108. package/runtime/hetzner/ntn-shim +0 -0
  109. package/runtime/hetzner/scripts/install-box.sh +5 -0
  110. package/runtime/hub/apps/hub/.next/BUILD_ID +1 -1
  111. package/runtime/hub/apps/hub/.next/build-manifest.json +3 -3
  112. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page_client-reference-manifest.js +1 -1
  113. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
  114. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page_client-reference-manifest.js +1 -1
  115. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page_client-reference-manifest.js +1 -1
  116. package/runtime/hub/apps/hub/.next/server/app/_global-error.html +1 -1
  117. package/runtime/hub/apps/hub/.next/server/app/_global-error.rsc +1 -1
  118. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  119. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  120. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  121. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  122. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  123. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0d1lmiq._.js +12 -12
  124. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0keu6we._.js +1 -1
  125. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1bqbkd5._.js +1 -1
  126. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1qa4a0v._.js +1 -1
  127. package/runtime/hub/apps/hub/.next/server/chunks/_06f2faq._.js +1 -1
  128. package/runtime/hub/apps/hub/.next/server/chunks/_0760z6y._.js +8 -8
  129. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_09gdzmo._.js +1 -1
  130. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0ro6vh6._.js +1 -1
  131. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0tgpglr._.js +1 -1
  132. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_1laion6._.js +1 -1
  133. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_0b_hsjl._.js +1 -1
  134. package/runtime/hub/apps/hub/.next/server/middleware-build-manifest.js +3 -3
  135. package/runtime/hub/apps/hub/.next/server/pages/500.html +1 -1
  136. package/runtime/hub/apps/hub/.next/static/chunks/1c5w3kqosumog.js +1 -0
  137. package/runtime/hub/apps/hub/.next/static/chunks/1o3ot_9-8jgzc.js +1 -0
  138. package/runtime/hub/apps/hub/.next/static/chunks/380qcmusmigzz.js +1 -0
  139. package/runtime/hub/apps/hub/.next/static/chunks/3uq9hf-roasav.js +1 -0
  140. package/runtime/hub/apps/hub/{auth-675P3LQS.js → auth-Q447765C.js} +2 -2
  141. package/runtime/hub/apps/hub/{auth-config-AOBEKRZQ.js → auth-config-SIL635ZD.js} +2 -2
  142. package/runtime/hub/apps/hub/{chunk-H22XP3NY.js → chunk-3VE7AYVK.js} +600 -145
  143. package/runtime/hub/apps/hub/{chunk-EXQCBM5Q.js → chunk-64WEKO34.js} +42 -11
  144. package/runtime/hub/apps/hub/{chunk-56YQBVN2.js → chunk-DZPQB2JZ.js} +1 -1
  145. package/runtime/hub/apps/hub/{chunk-2Z74R6ZT.js → chunk-FGBXEXUV.js} +351 -292
  146. package/runtime/hub/apps/hub/{chunk-AR7CEZ2G.js → chunk-YVELHPNY.js} +218 -17
  147. package/runtime/hub/apps/hub/{dist-LZNRLUYY.js → dist-33ZNVTC6.js} +183 -49
  148. package/runtime/hub/apps/hub/{dist-Q6G66Z57.js → dist-4SXAJBOC.js} +195 -150
  149. package/runtime/hub/apps/hub/{dist-SD4G36EP.js → dist-EPJFN2J3.js} +116 -86
  150. package/runtime/hub/apps/hub/{dist-STQK5XM6.js → dist-GF5EBRNG.js} +1 -1
  151. package/runtime/hub/apps/hub/{dist-LNHEG5P4.js → dist-UJVIROA4.js} +19 -5
  152. package/runtime/hub/apps/hub/dist-XULFTIMT.js +2212 -0
  153. package/runtime/hub/apps/hub/{dist-VV6Z2CQX.js → dist-YM5J25H6.js} +7 -3
  154. package/runtime/hub/apps/hub/{hub-token-2BZFBBW3.js → hub-token-UITZEWVP.js} +2 -2
  155. package/runtime/hub/apps/hub/package.json +1 -0
  156. package/runtime/hub/apps/hub/{prepared-state-BUO75YLZ-CAXQS5Y3.js → prepared-state-BUO75YLZ-O4GZMDRF.js} +1 -1
  157. package/runtime/hub/apps/hub/server.js +38 -19
  158. package/runtime/relay/bin.cjs +275 -59
  159. package/runtime/vercel/agentbox-checkpoint-cleanup +0 -0
  160. package/runtime/vercel/agentbox-codex-hooks.json +1 -1
  161. package/runtime/vercel/agentbox-dockerd-start +0 -0
  162. package/runtime/vercel/agentbox-open +0 -0
  163. package/runtime/vercel/agentbox-vnc-start +0 -0
  164. package/runtime/vercel/ctl.cjs +468 -97
  165. package/runtime/vercel/custom-system-CLAUDE.md +3 -2
  166. package/runtime/vercel/gh-shim +0 -0
  167. package/runtime/vercel/git-shim +53 -3
  168. package/runtime/vercel/linear-shim +0 -0
  169. package/runtime/vercel/ntn-shim +0 -0
  170. package/runtime/vercel/scripts/provision.sh +16 -0
  171. package/dist/chunk-GGRZ3GZO.js.map +0 -1
  172. package/dist/chunk-I6ZRWTPR.js.map +0 -1
  173. package/dist/chunk-LA4JMS27.js.map +0 -1
  174. package/dist/chunk-LK2JT2OO.js.map +0 -1
  175. package/dist/chunk-QEQFZLYR.js.map +0 -1
  176. package/dist/chunk-QT3SHMLY.js.map +0 -1
  177. package/dist/chunk-SFA57TGX.js.map +0 -1
  178. package/dist/chunk-W3FQPFP7.js.map +0 -1
  179. package/dist/dist-FXQFTT75.js.map +0 -1
  180. package/dist/dist-V235KVEX.js.map +0 -1
  181. package/runtime/hub/apps/hub/.next/static/chunks/0joh_xsiowfc4.js +0 -1
  182. package/runtime/hub/apps/hub/.next/static/chunks/20hq7-0depjid.js +0 -1
  183. package/runtime/hub/apps/hub/.next/static/chunks/3p86ecqhr_7yy.js +0 -1
  184. package/runtime/hub/apps/hub/.next/static/chunks/3qof5hg87qf5n.js +0 -1
  185. /package/dist/{_cloud-attach-BQRWX3J2.js.map → _cloud-attach-T6GPR6LJ.js.map} +0 -0
  186. /package/dist/{dist-2BTJQUJS.js.map → dist-B7TNWGVG.js.map} +0 -0
  187. /package/dist/{dist-CUKBKS3N.js.map → dist-KYV3LEHG.js.map} +0 -0
  188. /package/dist/{dist-QO4CTLAX.js.map → dist-T5MXBZGP.js.map} +0 -0
  189. /package/dist/{dist-Z2NEVV55.js.map → dist-Z7KEPQC7.js.map} +0 -0
  190. /package/dist/{prepared-state-BUO75YLZ-CDTISC2C.js.map → prepared-state-BUO75YLZ-RQRFFBJW.js.map} +0 -0
  191. /package/runtime/hub/apps/hub/.next/static/{eVq-z4zld_8DGQudbYogV → XtIjHGqvY4mQsOY2-m1Jy}/_buildManifest.js +0 -0
  192. /package/runtime/hub/apps/hub/.next/static/{eVq-z4zld_8DGQudbYogV → XtIjHGqvY4mQsOY2-m1Jy}/_clientMiddlewareManifest.js +0 -0
  193. /package/runtime/hub/apps/hub/.next/static/{eVq-z4zld_8DGQudbYogV → XtIjHGqvY4mQsOY2-m1Jy}/_ssgManifest.js +0 -0
@@ -0,0 +1,462 @@
1
+ #!/usr/bin/env bash
2
+ # AgentBox DigitalOcean 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 Droplet during
6
+ # `agentbox prepare --provider digitalocean`. After this script completes we
7
+ # snapshot the Droplet — 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-ntn-shim -- in-box `ntn`/`notion` shim (routes Notion CLI to host ntn via relay)
19
+ # /tmp/agentbox-linear-shim -- in-box `linear` shim (routes @schpet/linear-cli to host linear via relay; rejects `auth token`)
20
+ # /tmp/agentbox-custom-CLAUDE.md -- /etc/claude-code/CLAUDE.md content
21
+ # /tmp/agentbox-managed-settings.json -- /etc/claude-code/managed-settings.json
22
+ # /tmp/agentbox-codex-hooks.json -- /usr/local/share/agentbox/codex-hooks.json
23
+ # /tmp/agentbox-setup-skill.md -- /usr/local/share/agentbox/setup-guide.md
24
+ #
25
+ # Output: noisy progress to stdout (the host streams it into
26
+ # ~/.agentbox/logs/prepare.log via the ssh exec). Each major step prints
27
+ # `>>> BEGIN <step>` and `<<< END <step>` so a tail-watcher can spot a hang.
28
+
29
+ set -euo pipefail
30
+
31
+ step() { printf '\n>>> BEGIN %s\n' "$1"; }
32
+ done_() { printf '<<< END %s\n' "$1"; }
33
+
34
+ # Retry a command with exponential backoff. Usage: retry_backoff <max> cmd...
35
+ # Waits 60s before attempt 2, 240s before attempt 3 (~5 min total budget). Used
36
+ # for the Claude native installer, whose CDN (claude.ai / downloads.claude.ai,
37
+ # behind Cloudflare) intermittently 403s cloud-datacenter egress IPs under load.
38
+ retry_backoff() {
39
+ local max=$1; shift
40
+ local attempt=1
41
+ local -a waits=(60 240)
42
+ while true; do
43
+ if "$@"; then return 0; fi
44
+ if [ "$attempt" -ge "$max" ]; then return 1; fi
45
+ local w=${waits[$((attempt-1))]:-240}
46
+ echo "retry_backoff: attempt ${attempt}/${max} failed — backing off ${w}s" >&2
47
+ sleep "$w"
48
+ attempt=$((attempt+1))
49
+ done
50
+ }
51
+
52
+ if [ "$(id -u)" -ne 0 ]; then
53
+ echo "install-box.sh: must run as root (got uid $(id -u))" >&2
54
+ exit 64
55
+ fi
56
+
57
+ export DEBIAN_FRONTEND=noninteractive
58
+
59
+ step "wait for cloud-init"
60
+ # sshd is up via cloud-init's `users:` module before all of cloud-init's
61
+ # modules finish. Without this wait, our own `apt-get update` can race
62
+ # against cloud-init's apt operations (unattended-upgrades, etc.) and fail
63
+ # with "Could not get lock /var/lib/dpkg/lock-frontend".
64
+ cloud-init status --wait || true
65
+ done_ "wait for cloud-init"
66
+
67
+ step "apt update + base packages"
68
+ apt-get update
69
+ apt-get install -y --no-install-recommends \
70
+ curl ca-certificates gnupg
71
+ done_ "apt update + base packages"
72
+
73
+ step "Node 24 via NodeSource"
74
+ if ! command -v node >/dev/null 2>&1 || ! node --version | grep -qE '^v24\.'; then
75
+ curl -fsSL https://deb.nodesource.com/setup_24.x | bash -
76
+ fi
77
+ done_ "Node 24 via NodeSource"
78
+
79
+ step "core runtime + tooling"
80
+ apt-get install -y --no-install-recommends \
81
+ fuse3 \
82
+ fuse-overlayfs \
83
+ rsync \
84
+ nodejs \
85
+ python3 \
86
+ python3-pip \
87
+ python3-venv \
88
+ build-essential \
89
+ git \
90
+ git-lfs \
91
+ tmux \
92
+ vim \
93
+ libcap2-bin \
94
+ sudo \
95
+ locales \
96
+ bash-completion
97
+ # devcontainers/base bakes en_US.UTF-8; on plain Ubuntu we have to generate it
98
+ # ourselves so /etc/profile.d/agentbox.sh's LANG export doesn't surface a
99
+ # locale warning.
100
+ locale-gen en_US.UTF-8 >/dev/null 2>&1 || true
101
+ update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 >/dev/null 2>&1 || true
102
+ done_ "core runtime + tooling"
103
+
104
+ step "vscode user (UID 1000) + sudoers"
105
+ # The devcontainers base image creates `vscode` for us; on plain Ubuntu we
106
+ # do it ourselves. UID 1000 matches the docker provider so any path that
107
+ # bakes in /home/vscode (agentbox-ctl, /etc/profile.d/agentbox.sh, the
108
+ # credential symlinks, the in-box configs) Just Works regardless of provider.
109
+ if ! id vscode >/dev/null 2>&1; then
110
+ # DigitalOcean's stock Ubuntu image already creates a UID 1000 user named
111
+ # `ubuntu`. If something owns UID 1000 already, rename that account to
112
+ # `vscode` instead of failing — keeps
113
+ # any cloud-init-deposited files (authorized_keys) discoverable under the
114
+ # new home.
115
+ if existing="$(getent passwd 1000 | cut -d: -f1)"; then
116
+ if [ -n "$existing" ] && [ "$existing" != "vscode" ]; then
117
+ usermod -l vscode "$existing"
118
+ usermod -d /home/vscode -m vscode || true
119
+ groupmod -n vscode "$existing" 2>/dev/null || true
120
+ fi
121
+ fi
122
+ if ! id vscode >/dev/null 2>&1; then
123
+ useradd -m -u 1000 -s /bin/bash vscode
124
+ fi
125
+ fi
126
+ install -d -m 0755 -o vscode -g vscode /home/vscode
127
+ echo 'vscode ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/90-agentbox-vscode
128
+ chmod 0440 /etc/sudoers.d/90-agentbox-vscode
129
+ done_ "vscode user (UID 1000) + sudoers"
130
+
131
+ step "sshd hardening drop-in"
132
+ # Key-only, vscode-only sshd. Load-bearing for `--inbound open` (SSH port
133
+ # exposed to 0.0.0.0/0): password auth off + AllowUsers vscode means the only
134
+ # way in is the per-box key. Safe for `locked`/`whitelist` too. Baked into the
135
+ # snapshot; takes effect on next boot — we don't reload sshd here (the rest of
136
+ # the install still needs root SSH).
137
+ cat > /etc/ssh/sshd_config.d/agentbox.conf <<'SSHD'
138
+ # Written by AgentBox install-box.sh — see plan §"safety model".
139
+ PasswordAuthentication no
140
+ PermitRootLogin no
141
+ PubkeyAuthentication yes
142
+ AllowUsers vscode
143
+ AllowTcpForwarding yes
144
+ GatewayPorts no
145
+ PermitTunnel no
146
+ X11Forwarding no
147
+ ChallengeResponseAuthentication no
148
+ KbdInteractiveAuthentication no
149
+ SSHD
150
+ done_ "sshd hardening drop-in"
151
+
152
+ step "agentbox base dirs + /workspace ownership"
153
+ mkdir -p /workspace /run/agentbox /var/log/agentbox /var/lib/agentbox /etc/agentbox /etc/claude-code \
154
+ /usr/local/share/agentbox
155
+ chmod 755 /workspace
156
+ chown vscode:vscode /workspace /run/agentbox /var/log/agentbox /var/lib/agentbox
157
+ done_ "agentbox base dirs + /workspace ownership"
158
+
159
+ step "node setcap (port <1024 bind without root)"
160
+ NODE_BIN="$(readlink -f "$(command -v node)")"
161
+ setcap cap_net_bind_service=+ep "$NODE_BIN"
162
+ done_ "node setcap (port <1024 bind without root)"
163
+
164
+ step "corepack (pnpm + yarn shims)"
165
+ npm install -g corepack@latest
166
+ corepack enable pnpm yarn
167
+ done_ "corepack (pnpm + yarn shims)"
168
+
169
+ step "corepack cache dir (vscode-owned, prevents first-use ENOENT)"
170
+ sudo -u vscode -H mkdir -p /home/vscode/.cache/node/corepack
171
+ done_ "corepack cache dir (vscode-owned, prevents first-use ENOENT)"
172
+
173
+ step "git system-wide safe.directory"
174
+ git config --system --add safe.directory '*'
175
+ done_ "git system-wide safe.directory"
176
+
177
+ step "git-lfs system filter"
178
+ # Register filter.lfs.* in /etc/gitconfig so an in-box checkout of an LFS repo
179
+ # smudges instead of writing pointer files. Unlike docker, cloud boxes have no
180
+ # bind-mounted ~/.gitconfig, so --system is the only place the filter lives.
181
+ # --skip-repo keeps install from touching a checkout at bake time.
182
+ git lfs install --system --skip-repo
183
+ done_ "git-lfs system filter"
184
+
185
+ step "docker + iptables for in-VPS DinD"
186
+ apt-get install -y --no-install-recommends \
187
+ docker.io \
188
+ iptables
189
+ mkdir -p /etc/docker
190
+ printf '%s\n' '{ "iptables": true }' > /etc/docker/daemon.json
191
+ usermod -aG docker vscode
192
+ # In-VPS dockerd is launched by the cloud-provider scaffolding via
193
+ # `agentbox-dockerd-start` (the same script the docker provider uses), so the
194
+ # systemd `docker.service` shouldn't auto-start — we want the agentbox
195
+ # helper's storage-driver-probe + flag composition, not Ubuntu's defaults.
196
+ systemctl disable --now docker.service 2>/dev/null || true
197
+ systemctl disable --now docker.socket 2>/dev/null || true
198
+ done_ "docker + iptables for in-VPS DinD"
199
+
200
+ step "agentbox-ctl install"
201
+ install -m 0755 /tmp/agentbox-ctl /usr/local/bin/agentbox-ctl
202
+ done_ "agentbox-ctl install"
203
+
204
+ # === EARLY BAKE: helper scripts, baked configs, profile/sshd shims ===
205
+ # Originally these steps lived after Chromium download (which takes ~5min).
206
+ # We moved them up because — for reasons that didn't fully resolve in
207
+ # diagnostic runs — bash's set -x trace, the pipe-tee log capture, and any
208
+ # subsequent file system writes from this script silently stop emitting
209
+ # output after the long-running `playwright install chromium` exec, leaving
210
+ # the snapshot missing every file these steps would install. Running them
211
+ # *before* Chromium sidesteps the issue and keeps the snapshot complete.
212
+ # Tracked as Phase-7 follow-up in docs/hertzner_backlog.md.
213
+
214
+ step "baked helper scripts (vnc / dockerd / portless-trust / cleanup / xdg-open / gh + git + ntn + linear shims)"
215
+ install -m 0755 /tmp/agentbox-vnc-start /usr/local/bin/agentbox-vnc-start
216
+ install -m 0755 /tmp/agentbox-dockerd-start /usr/local/bin/agentbox-dockerd-start
217
+ install -m 0755 /tmp/agentbox-portless-trust /usr/local/bin/agentbox-portless-trust
218
+ install -m 0755 /tmp/agentbox-checkpoint-cleanup /usr/local/bin/agentbox-checkpoint-cleanup
219
+ install -m 0755 /tmp/agentbox-open /usr/local/bin/agentbox-open
220
+ ln -sf /usr/local/bin/agentbox-open /usr/local/bin/xdg-open
221
+ # gh + git + ntn + linear shims — same files baked by Dockerfile.box for the
222
+ # docker provider. The shim wins on PATH (default /usr/local/bin precedes
223
+ # /usr/bin) so any agent call to `gh ...` / `git push|pull|fetch|clone` /
224
+ # `ntn ...` / `notion ...` / `linear ...` routes through the relay; the git
225
+ # shim execs /usr/bin/git for everything else, no overhead. `notion` is a
226
+ # symlink to `ntn` — same shim, per-service surface naming from
227
+ # docs/integrations_backlog.md. The linear shim explicitly rejects
228
+ # `linear auth token` (which would print the raw API key).
229
+ install -m 0755 /tmp/agentbox-gh-shim /usr/local/bin/gh
230
+ install -m 0755 /tmp/agentbox-git-shim /usr/local/bin/git
231
+ install -m 0755 /tmp/agentbox-ntn-shim /usr/local/bin/ntn
232
+ ln -sf /usr/local/bin/ntn /usr/local/bin/notion
233
+ install -m 0755 /tmp/agentbox-linear-shim /usr/local/bin/linear
234
+ done_ "baked helper scripts (vnc / dockerd / portless-trust / cleanup / xdg-open / gh + git + ntn + linear shims)"
235
+
236
+ step "baked config files (claude / codex / setup guide / tmux.conf)"
237
+ install -m 0644 /tmp/agentbox-custom-CLAUDE.md /etc/claude-code/CLAUDE.md
238
+ install -m 0644 /tmp/agentbox-managed-settings.json /etc/claude-code/managed-settings.json
239
+ install -m 0644 /tmp/agentbox-codex-hooks.json /usr/local/share/agentbox/codex-hooks.json
240
+ install -m 0644 /tmp/agentbox-setup-skill.md /usr/local/share/agentbox/setup-guide.md
241
+
242
+ # tmux.conf — verbatim from Dockerfile.box.
243
+ cat > /etc/tmux.conf <<'TMUX'
244
+ set -g default-terminal "tmux-256color"
245
+ set -as terminal-overrides ",*:Tc"
246
+ set -as terminal-overrides ",*:RGB"
247
+ set -as terminal-features ",*:hyperlinks"
248
+ set -as terminal-features ",*:RGB"
249
+ set -g allow-passthrough on
250
+ set -g set-clipboard on
251
+ set -g extended-keys on
252
+ set -as terminal-features ",*:extkeys"
253
+ set -g mouse on
254
+ bind -T copy-mode WheelUpPane send -N2 -X scroll-up
255
+ bind -T copy-mode WheelDownPane send -N2 -X scroll-down
256
+ bind -T copy-mode-vi WheelUpPane send -N2 -X scroll-up
257
+ bind -T copy-mode-vi WheelDownPane send -N2 -X scroll-down
258
+ set -g history-limit 50000
259
+ set -g escape-time 0
260
+ TMUX
261
+ done_ "baked config files (claude / codex / setup guide / tmux.conf)"
262
+
263
+ step "credential pivot symlinks (vscode home)"
264
+ sudo -u vscode -H mkdir -p \
265
+ /home/vscode/.claude \
266
+ /home/vscode/.claude/skills/agentbox-setup \
267
+ /home/vscode/.codex \
268
+ /home/vscode/.local/share/opencode \
269
+ /home/vscode/.agentbox-creds/claude \
270
+ /home/vscode/.agentbox-creds/codex \
271
+ /home/vscode/.agentbox-creds/opencode
272
+ sudo -u vscode -H ln -sf /home/vscode/.agentbox-creds/claude/.credentials.json \
273
+ /home/vscode/.claude/.credentials.json
274
+ sudo -u vscode -H ln -sf /home/vscode/.agentbox-creds/codex/auth.json \
275
+ /home/vscode/.codex/auth.json
276
+ sudo -u vscode -H ln -sf /home/vscode/.agentbox-creds/opencode/auth.json \
277
+ /home/vscode/.local/share/opencode/auth.json
278
+ sudo -u vscode -H ln -sf /home/vscode/.claude/_claude.json /home/vscode/.claude.json
279
+
280
+ # `/agentbox-setup` skill — the in-box-only first-run wizard the setup
281
+ # prompt references. Docker's seedSetupSkillIntoVolume() (sandbox-docker/
282
+ # src/claude.ts) does this at create time via a helper container with the
283
+ # claude-config volume mounted. DigitalOcean doesn't have a shared volume — we
284
+ # bake it directly into the snapshot here so every box has it. The same
285
+ # content is also reachable as a static file at /usr/local/share/agentbox/
286
+ # setup-guide.md (referenced as fallback in the wizard initial prompt).
287
+ # `tar -xzf` of the host's ~/.claude in prepareDigitalOcean extracts WITHOUT
288
+ # removing pre-existing files in the dest, so this skill survives the
289
+ # subsequent static-config bake.
290
+ sudo -u vscode -H cp /usr/local/share/agentbox/setup-guide.md \
291
+ /home/vscode/.claude/skills/agentbox-setup/SKILL.md
292
+ done_ "credential pivot symlinks (vscode home)"
293
+
294
+ step "login-shell shim (/etc/profile.d/agentbox.sh)"
295
+ cat > /etc/profile.d/agentbox.sh <<'PROFILE'
296
+ # Auto-loaded by login shells; box.env is written at create time.
297
+ if [ -r /etc/agentbox/box.env ]; then
298
+ set -a
299
+ . /etc/agentbox/box.env
300
+ set +a
301
+ fi
302
+ case ":$PATH:" in
303
+ *:/home/vscode/.local/bin:*) : ;;
304
+ *) PATH=/home/vscode/.local/bin:$PATH ;;
305
+ esac
306
+ export PATH
307
+ export COLORTERM=${COLORTERM:-truecolor}
308
+ export DISABLE_AUTOUPDATER=${DISABLE_AUTOUPDATER:-1}
309
+ export LANG=${LANG:-en_US.UTF-8}
310
+ export LC_ALL=${LC_ALL:-en_US.UTF-8}
311
+ export DISPLAY=${DISPLAY:-:1}
312
+ export AGENT_BROWSER_EXECUTABLE_PATH=${AGENT_BROWSER_EXECUTABLE_PATH:-/usr/local/bin/chromium}
313
+ export BROWSER=${BROWSER:-/usr/local/bin/agentbox-open}
314
+ PROFILE
315
+ chmod 0644 /etc/profile.d/agentbox.sh
316
+ done_ "login-shell shim (/etc/profile.d/agentbox.sh)"
317
+
318
+ step "sshd hardening drop-in"
319
+ cat > /etc/ssh/sshd_config.d/agentbox.conf <<'SSHD'
320
+ # Written by AgentBox install-box.sh — see plan §"safety model".
321
+ PasswordAuthentication no
322
+ PermitRootLogin no
323
+ PubkeyAuthentication yes
324
+ AllowUsers vscode
325
+ AllowTcpForwarding yes
326
+ GatewayPorts no
327
+ PermitTunnel no
328
+ X11Forwarding no
329
+ ChallengeResponseAuthentication no
330
+ KbdInteractiveAuthentication no
331
+ SSHD
332
+ # Don't reload sshd here — we still need root SSH for the rest of the
333
+ # install. The drop-in takes effect on next sshd restart (the snapshot will
334
+ # include it; the next boot reads it).
335
+ done_ "sshd hardening drop-in"
336
+
337
+ step "allow unprivileged user namespaces (sysctl drop-in)"
338
+ # Ubuntu 23.10+ / 24.04 enables an AppArmor knob that blocks unprivileged
339
+ # user namespaces, which Chromium's sandbox needs. Without this, every
340
+ # in-box `chromium` / `agent-browser` invocation dies with
341
+ # "FATAL: zygote_host_impl_linux.cc: No usable sandbox!". Docker boxes
342
+ # don't hit it because the host kernel running their containers is older
343
+ # (or they get the relaxed sysctl from the docker host). On a bare Ubuntu
344
+ # 24.04 DigitalOcean Droplet we have to flip it ourselves.
345
+ #
346
+ # We flip both the modern knob (`apparmor_restrict_unprivileged_userns`)
347
+ # and the legacy `unprivileged_userns_clone` — the legacy one is already
348
+ # 1 on 24.04 but writing it costs nothing and keeps the drop-in valid if
349
+ # a future kernel hardens the default back to 0.
350
+ cat > /etc/sysctl.d/99-agentbox-userns.conf <<'SYSCTL'
351
+ # Written by AgentBox install-box.sh — Chromium needs unprivileged user
352
+ # namespaces for its sandbox; the VPS itself is the isolation boundary.
353
+ kernel.apparmor_restrict_unprivileged_userns = 0
354
+ kernel.unprivileged_userns_clone = 1
355
+ SYSCTL
356
+ chmod 0644 /etc/sysctl.d/99-agentbox-userns.conf
357
+ # Apply now too so the rest of this install (in particular `playwright
358
+ # install chromium`'s post-install probe) works without needing a reboot
359
+ # of the prepare VPS. The drop-in then re-applies on every boot of the
360
+ # baked snapshot.
361
+ sysctl -p /etc/sysctl.d/99-agentbox-userns.conf >/dev/null
362
+ done_ "allow unprivileged user namespaces (sysctl drop-in)"
363
+
364
+ # === END EARLY BAKE ===
365
+
366
+ step "VNC stack (TigerVNC + noVNC + websockify + autocutsel)"
367
+ apt-get install -y --no-install-recommends \
368
+ tigervnc-standalone-server tigervnc-common tigervnc-tools \
369
+ novnc websockify \
370
+ autocutsel xclip
371
+ mkdir -p /home/vscode/.vnc
372
+ chown -R vscode:vscode /home/vscode/.vnc
373
+ done_ "VNC stack (TigerVNC + noVNC + websockify + autocutsel)"
374
+
375
+ step "Chrome runtime libs"
376
+ apt-get install -y --no-install-recommends \
377
+ libnss3 libnss3-tools libnspr4 libatk1.0-0t64 libatk-bridge2.0-0t64 libcups2t64 \
378
+ libxkbcommon0 libxcomposite1 libxdamage1 libxfixes3 libxrandr2 \
379
+ libgbm1 libdrm2 libpango-1.0-0 libcairo2 libasound2t64 \
380
+ fonts-liberation xdg-utils
381
+ done_ "Chrome runtime libs"
382
+
383
+ step "agent-browser + playwright + portless (global npm)"
384
+ npm install -g agent-browser playwright portless
385
+ done_ "agent-browser + playwright + portless (global npm)"
386
+
387
+ step "Codex CLI prereqs (bubblewrap) + agent installs"
388
+ apt-get install -y --no-install-recommends bubblewrap
389
+ npm install -g @openai/codex opencode-ai
390
+ done_ "Codex CLI prereqs (bubblewrap) + agent installs"
391
+
392
+ # AGENTBOX_CLAUDE_INSTALL selects how Claude Code is installed (default
393
+ # `native`). `npm` is an opt-in fallback for hosts whose egress IP the native
394
+ # installer's CDN 403s — see `box.claudeInstall`.
395
+ if [ "${AGENTBOX_CLAUDE_INSTALL:-native}" = "npm" ]; then
396
+ step "Claude Code (npm: @anthropic-ai/claude-code)"
397
+ # npm-global drops `claude` at Node's prefix bin, not the
398
+ # /home/vscode/.local/bin/claude the rest of AgentBox hardcodes (the attach
399
+ # command, the login-shell PATH shim, the host-side installMethod=native
400
+ # coercion). Symlink it into that path so the box stays indistinguishable from
401
+ # a native install downstream.
402
+ npm install -g @anthropic-ai/claude-code
403
+ install -d -o vscode -g vscode /home/vscode/.local/bin
404
+ ln -sf "$(command -v claude)" /home/vscode/.local/bin/claude
405
+ chown -h vscode:vscode /home/vscode/.local/bin/claude
406
+ command -v claude >/dev/null || { echo "install-box.sh: npm claude install produced no claude on PATH" >&2; exit 71; }
407
+ done_ "Claude Code (npm: @anthropic-ai/claude-code)"
408
+ else
409
+ step "Claude Code (native installer, run as vscode)"
410
+ # Anthropic's native installer drops `claude` at /home/vscode/.local/bin/.
411
+ # Run as vscode so the binary lands in the right home and is owned by the
412
+ # user that'll execute it. DISABLE_AUTOUPDATER is set globally via
413
+ # /etc/profile.d/agentbox.sh below.
414
+ #
415
+ # Its CDN (claude.ai / downloads.claude.ai) sits behind Cloudflare, which
416
+ # intermittently 403s cloud-datacenter egress IPs under load. Retry with
417
+ # backoff rather than falling back to npm. A bare `curl | bash` would hide a
418
+ # 403 (curl -f exits non-zero but the pipe's status is bash's 0), so keep
419
+ # pipefail and fold the PATH check in so a "succeeded but absent" result also
420
+ # retries. A failed prepare is better than a claude-less snapshot.
421
+ if ! retry_backoff 3 sudo -u vscode -H bash -lc \
422
+ 'set -o pipefail; curl -fsSL https://claude.ai/install.sh | bash -s stable && command -v claude >/dev/null'; then
423
+ echo "install-box.sh: Claude native installer failed after 3 attempts (Cloudflare 403?) — aborting bake" >&2
424
+ exit 71
425
+ fi
426
+ done_ "Claude Code (native installer, run as vscode)"
427
+ fi
428
+
429
+ step "Chromium download via Playwright (as vscode)"
430
+ # Run the download as vscode so the cache lands under
431
+ # /home/vscode/.cache/ms-playwright. Resolve a stable symlink at
432
+ # /usr/local/bin/chromium so AGENT_BROWSER_EXECUTABLE_PATH stays predictable
433
+ # across Chromium revision bumps.
434
+ sudo -u vscode -H bash -lc 'playwright install chromium'
435
+ CHROME_BIN="$(sudo -u vscode -H bash -lc 'ls /home/vscode/.cache/ms-playwright/chromium-*/chrome-linux*/chrome 2>/dev/null | sort | tail -1')"
436
+ if [ -z "$CHROME_BIN" ] || [ ! -x "$CHROME_BIN" ]; then
437
+ echo "install-box.sh: could not resolve Playwright Chromium binary" >&2
438
+ exit 70
439
+ fi
440
+ ln -sf "$CHROME_BIN" /usr/local/bin/chromium
441
+ done_ "Chromium download via Playwright (as vscode)"
442
+
443
+ step "apt cleanup"
444
+ apt-get clean
445
+ rm -rf /var/lib/apt/lists/*
446
+ done_ "apt cleanup"
447
+
448
+ step "trim /tmp/agentbox-*"
449
+ # Keep the install script itself out of the trim list — it's referenced by
450
+ # the install log saved into the snapshot so a Phase-7-style diagnostic can
451
+ # re-read which lines actually executed against which source.
452
+ rm -f /tmp/agentbox-ctl /tmp/agentbox-vnc-start /tmp/agentbox-dockerd-start \
453
+ /tmp/agentbox-checkpoint-cleanup /tmp/agentbox-open \
454
+ /tmp/agentbox-gh-shim /tmp/agentbox-git-shim /tmp/agentbox-ntn-shim \
455
+ /tmp/agentbox-linear-shim \
456
+ /tmp/agentbox-custom-CLAUDE.md /tmp/agentbox-managed-settings.json \
457
+ /tmp/agentbox-codex-hooks.json /tmp/agentbox-setup-skill.md
458
+ # Move install-box.sh into the persistent location for diagnostics.
459
+ mv /tmp/agentbox-install.sh /var/log/agentbox/install-box.sh 2>/dev/null || true
460
+ done_ "trim /tmp/agentbox-*"
461
+
462
+ printf '\n*** install-box.sh: complete — VPS ready for create_image snapshot.\n'
@@ -140,9 +140,14 @@ RUN git lfs install --system --skip-repo
140
140
  # at /var/run/docker.sock at runtime. The matching launch script is COPY'd in
141
141
  # below; the daemon is started by the host via `docker exec -d --user root`
142
142
  # (see launchDockerdDaemon), mirroring the VNC/ctl daemon pattern.
143
+ # docker-compose-v2 + docker-buildx are the CLI plugins docker.io doesn't
144
+ # pull in: without them `docker compose` is not a command (the docs advertise
145
+ # Compose stacks) and `docker build` runs on the deprecated legacy builder.
143
146
  RUN apt-get update \
144
147
  && apt-get install -y --no-install-recommends \
145
148
  docker.io \
149
+ docker-compose-v2 \
150
+ docker-buildx \
146
151
  iptables \
147
152
  && rm -rf /var/lib/apt/lists/* \
148
153
  && mkdir -p /etc/docker \