@madarco/agentbox 0.20.1 → 0.21.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 (62) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/dist/{_cloud-attach-MH7NKIZY.js → _cloud-attach-U3QJO7IF.js} +4 -4
  3. package/dist/{chunk-52LKNUY7.js → chunk-6JJIKCMY.js} +2 -2
  4. package/dist/{chunk-P6UT5XGE.js → chunk-DBMLOY3T.js} +11 -3
  5. package/dist/{chunk-P6UT5XGE.js.map → chunk-DBMLOY3T.js.map} +1 -1
  6. package/dist/{chunk-NXX3KQZ6.js → chunk-IXQTUXWV.js} +2 -2
  7. package/dist/{chunk-MODNW54N.js → chunk-KTEDFUKM.js} +2 -2
  8. package/dist/{chunk-4ATVA3RM.js → chunk-PX7G4PSI.js} +78 -23
  9. package/dist/chunk-PX7G4PSI.js.map +1 -0
  10. package/dist/{chunk-3465NDRZ.js → chunk-QKL7PCXQ.js} +127 -11
  11. package/dist/chunk-QKL7PCXQ.js.map +1 -0
  12. package/dist/{chunk-7K2A3NLE.js → chunk-X2DWS4KS.js} +14 -6
  13. package/dist/chunk-X2DWS4KS.js.map +1 -0
  14. package/dist/{chunk-5N7GA2X7.js → chunk-YZVFGFYQ.js} +263 -881
  15. package/dist/chunk-YZVFGFYQ.js.map +1 -0
  16. package/dist/{dist-G5PDFWKH.js → dist-FMA5Y25B.js} +5 -5
  17. package/dist/{dist-T3JIYHCA.js → dist-NWKOEWUJ.js} +120 -26
  18. package/dist/dist-NWKOEWUJ.js.map +1 -0
  19. package/dist/{dist-AJWL4WLW.js → dist-SAS4PIHA.js} +13 -3
  20. package/dist/{dist-CTTTHG6U.js → dist-U76JL6HI.js} +5 -5
  21. package/dist/{dist-LUEH7MER.js → dist-UVQJ2BZJ.js} +5 -5
  22. package/dist/index.js +1236 -561
  23. package/dist/index.js.map +1 -1
  24. package/dist/{prepared-state-MQHD3M5F-5ZMCNY43.js → prepared-state-MQHD3M5F-YYVVMTNJ.js} +2 -2
  25. package/package.json +6 -5
  26. package/runtime/daytona/custom-system-CLAUDE.md +13 -3
  27. package/runtime/docker/Dockerfile.box +44 -10
  28. package/runtime/docker/apps/cli/share/agentbox-setup/SKILL.md +6 -5
  29. package/runtime/docker/packages/ctl/dist/bin.cjs +324 -109
  30. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-portless-trust +82 -0
  31. package/runtime/docker/packages/sandbox-docker/scripts/custom-system-CLAUDE.md +12 -3
  32. package/runtime/e2b/agentbox-setup-skill.md +6 -5
  33. package/runtime/e2b/ctl.cjs +324 -109
  34. package/runtime/e2b/custom-system-CLAUDE.md +12 -3
  35. package/runtime/e2b/scripts/build-template.sh +44 -2
  36. package/runtime/hetzner/agentbox-portless-trust +82 -0
  37. package/runtime/hetzner/agentbox-setup-skill.md +6 -5
  38. package/runtime/hetzner/ctl.cjs +324 -109
  39. package/runtime/hetzner/custom-system-CLAUDE.md +12 -3
  40. package/runtime/hetzner/scripts/install-box.sh +51 -7
  41. package/runtime/relay/bin.cjs +187 -43
  42. package/runtime/vercel/agentbox-setup-skill.md +6 -5
  43. package/runtime/vercel/ctl.cjs +324 -109
  44. package/runtime/vercel/custom-system-CLAUDE.md +12 -3
  45. package/runtime/vercel/scripts/provision.sh +44 -2
  46. package/share/agentbox-setup/SKILL.md +6 -5
  47. package/share/host-skills/agentbox/SKILL.md +14 -0
  48. package/share/host-skills/agentbox-info/SKILL.md +30 -1
  49. package/dist/chunk-3465NDRZ.js.map +0 -1
  50. package/dist/chunk-4ATVA3RM.js.map +0 -1
  51. package/dist/chunk-5N7GA2X7.js.map +0 -1
  52. package/dist/chunk-7K2A3NLE.js.map +0 -1
  53. package/dist/dist-T3JIYHCA.js.map +0 -1
  54. /package/dist/{_cloud-attach-MH7NKIZY.js.map → _cloud-attach-U3QJO7IF.js.map} +0 -0
  55. /package/dist/{chunk-52LKNUY7.js.map → chunk-6JJIKCMY.js.map} +0 -0
  56. /package/dist/{chunk-NXX3KQZ6.js.map → chunk-IXQTUXWV.js.map} +0 -0
  57. /package/dist/{chunk-MODNW54N.js.map → chunk-KTEDFUKM.js.map} +0 -0
  58. /package/dist/{dist-G5PDFWKH.js.map → dist-FMA5Y25B.js.map} +0 -0
  59. /package/dist/{dist-AJWL4WLW.js.map → dist-SAS4PIHA.js.map} +0 -0
  60. /package/dist/{dist-CTTTHG6U.js.map → dist-U76JL6HI.js.map} +0 -0
  61. /package/dist/{dist-LUEH7MER.js.map → dist-UVQJ2BZJ.js.map} +0 -0
  62. /package/dist/{prepared-state-MQHD3M5F-5ZMCNY43.js.map → prepared-state-MQHD3M5F-YYVVMTNJ.js.map} +0 -0
@@ -27,7 +27,11 @@ wrapper already builds `git push <remote> <branch>` host-side from the
27
27
  registered worktree; the `-- <args>` slot is for extra flags only (e.g.
28
28
  `--force-with-lease`, `--tags`). Re-passing the remote or branch makes git treat
29
29
  them as refspecs and fails with `refs/remotes/origin/HEAD cannot be resolved to
30
- branch`.
30
+ branch`. To make the branch available on the host **without** publishing it to
31
+ the remote, add `--host-only` (e.g. `agentbox-ctl git push --host-only`); it
32
+ lands the branch in the host's local repo only. Add `--as <branch>` to choose
33
+ the host branch name (default: this box's branch), and `--force` to allow a
34
+ non-fast-forward overwrite.
31
35
 
32
36
  For GitHub PR work, use `agentbox-ctl git pr <op> [args...]` — same model, relay
33
37
  shells to host `gh`. Ops: `create`, `view`, `list`, `comment`, `review`,
@@ -36,11 +40,16 @@ silently; everything else asks the user to confirm in the host wrapper (deny →
36
40
  exit 10).
37
41
 
38
42
  For ad-hoc file transfers between this box and the host, use
39
- `agentbox-ctl cp toHost <boxPath> <hostPath>` and
40
- `agentbox-ctl cp fromHost <hostPath> <boxPath>` or `agentbox-ctl download claude` /
43
+ `agentbox-ctl cp toHost <boxPath...> <hostPath>` and
44
+ `agentbox-ctl cp fromHost <hostPath...> <boxPath>` (both accept multiple paths; wildcards expand in your shell) or `agentbox-ctl download claude` /
41
45
  `download env` / `download config`. They RPC to the host and ask the user for
42
46
  confirmation on the wrapper that runs `agentbox claude`; deny returns exit 10
43
47
  (`denied by user`). Don't put any timeout on the command, it will run forever
44
48
  and the user will be notified through multiple channels.
45
49
 
50
+ If an agentbox.yaml file is present, services and docker containers will be started automatically.
51
+ Check the status with `agentbox-ctl status`, `agentbox-ctl logs <service>`, and `agentbox-ctl restart <service>`.
52
+
53
+ To view any web services, open the browser to https://<AGENTBOX_BOX_HOST>. The AGENTBOX_BOX_HOST env var is available in the box and the same url will work from the host as well via a local proxy or because is a cloud provided url.
54
+
46
55
  Box identity: /etc/agentbox/box.env and the AGENTBOX_* env vars.
@@ -40,6 +40,24 @@ set -euo pipefail
40
40
  step() { printf '\n>>> BEGIN %s\n' "$1"; }
41
41
  done_() { printf '<<< END %s\n' "$1"; }
42
42
 
43
+ # Retry a command with exponential backoff. Usage: retry_backoff <max> cmd...
44
+ # Waits 60s before attempt 2, 240s before attempt 3 (~5 min total budget). Used
45
+ # for the Claude native installer, whose CDN (claude.ai / downloads.claude.ai,
46
+ # behind Cloudflare) intermittently 403s cloud-datacenter egress IPs under load.
47
+ retry_backoff() {
48
+ local max=$1; shift
49
+ local attempt=1
50
+ local -a waits=(60 240)
51
+ while true; do
52
+ if "$@"; then return 0; fi
53
+ if [ "$attempt" -ge "$max" ]; then return 1; fi
54
+ local w=${waits[$((attempt-1))]:-240}
55
+ echo "retry_backoff: attempt ${attempt}/${max} failed — backing off ${w}s" >&2
56
+ sleep "$w"
57
+ attempt=$((attempt+1))
58
+ done
59
+ }
60
+
43
61
  if [ "$(id -u)" -ne 0 ]; then
44
62
  echo "build-template.sh: must run as root (got uid $(id -u))" >&2
45
63
  exit 64
@@ -226,6 +244,18 @@ export DISABLE_AUTOUPDATER=${DISABLE_AUTOUPDATER:-1}
226
244
  export DISPLAY=${DISPLAY:-:1}
227
245
  export AGENT_BROWSER_EXECUTABLE_PATH=${AGENT_BROWSER_EXECUTABLE_PATH:-/usr/local/bin/chromium}
228
246
  export BROWSER=${BROWSER:-/usr/local/bin/agentbox-open}
247
+ # Land interactive login shells in the workspace, so remote-host integrations
248
+ # (Codex app, VS Code Remote-SSH, plain `ssh <box>`) open in the project instead
249
+ # of $HOME. Interactive-only so scp/sftp and `ssh box <cmd>` are untouched; only
250
+ # when still at $HOME so a caller-chosen dir (e.g. agentbox's tmux `-c /workspace`)
251
+ # is never overridden.
252
+ case $- in
253
+ *i*)
254
+ if [ "$PWD" = "$HOME" ] && [ -d /workspace ]; then
255
+ cd /workspace
256
+ fi
257
+ ;;
258
+ esac
229
259
  PROFILE
230
260
  chmod 0644 /etc/profile.d/agentbox.sh
231
261
  done_ "login-shell shim (/etc/profile.d/agentbox.sh)"
@@ -258,8 +288,20 @@ npm install -g @openai/codex opencode-ai agent-browser 2>&1 | tail -3 || \
258
288
  done_ "agent CLIs (codex + opencode + agent-browser, global npm)"
259
289
 
260
290
  step "Claude Code (native installer, run as vscode)"
261
- # Anthropic's canonical installer drops `claude` at /home/vscode/.local/bin/.
262
- sudo -u vscode -H bash -lc 'curl -fsSL https://claude.ai/install.sh | bash -s stable'
291
+ # Anthropic's native installer drops `claude` at /home/vscode/.local/bin/claude
292
+ # with installMethod=native (matching the host-seeded .claude.json, so the
293
+ # startup integrity check stays quiet) and ships native-only features the npm
294
+ # package lacks. Its CDN (claude.ai / downloads.claude.ai) sits behind
295
+ # Cloudflare, which intermittently 403s cloud-datacenter egress IPs under load —
296
+ # so retry with backoff rather than falling back to npm. A bare `curl | bash`
297
+ # would hide a 403 (curl -f exits non-zero but the pipe's status is bash's 0),
298
+ # so keep pipefail and fold the PATH check in so a "succeeded but absent" result
299
+ # also retries. A failed build is better than a claude-less template.
300
+ if ! retry_backoff 3 sudo -u vscode -H bash -lc \
301
+ 'set -o pipefail; curl -fsSL https://claude.ai/install.sh | bash -s stable && command -v claude >/dev/null'; then
302
+ echo "build-template.sh: Claude native installer failed after 3 attempts (Cloudflare 403?) — aborting build" >&2
303
+ exit 71
304
+ fi
263
305
  done_ "Claude Code (native installer, run as vscode)"
264
306
 
265
307
  step "Chrome runtime libs (apt)"
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env bash
2
+ # Trust a Portless self-signed CA *inside the box* so every in-box HTTPS client
3
+ # accepts the symmetric `https://<box>.localhost` URL.
4
+ #
5
+ # Why this exists: when the host Portless proxy runs in TLS mode, AgentBox
6
+ # serves the same `https://<box>.localhost` URL inside the box (Hetzner: an
7
+ # in-VPS mirror proxy with its own CA at /root/.portless/ca.pem; Docker: the
8
+ # host CA bind-mounted at /home/vscode/.portless/ca.pem). `portless proxy start`
9
+ # at best trusts the CA in the Linux *system* store — it does NOT populate the
10
+ # per-user NSS database that Chromium / Playwright-Chromium read on Linux, so
11
+ # the VNC browser window and Playwright fail with a cert error. We close that
12
+ # gap here by trusting the CA in BOTH the system store and the box user's NSS db.
13
+ #
14
+ # Usage: agentbox-portless-trust <ca-pem-path> [box-user]
15
+ # box-user defaults to `vscode` (the account that runs the agents / browser).
16
+ # Idempotent and best-effort: prints the installed system CA path on stdout
17
+ # (for NODE_EXTRA_CA_CERTS) and never exits non-zero — a trust failure must not
18
+ # break box create/resume.
19
+
20
+ set -uo pipefail
21
+
22
+ CA_SRC="${1:-}"
23
+ BOX_USER="${2:-vscode}"
24
+ SYS_CA_DST="/usr/local/share/ca-certificates/agentbox-portless-ca.crt"
25
+ NSS_NICK="agentbox-portless-ca"
26
+
27
+ warn() { echo "agentbox-portless-trust: $*" >&2; }
28
+
29
+ if [ -z "$CA_SRC" ] || [ ! -r "$CA_SRC" ]; then
30
+ warn "CA file '$CA_SRC' missing or unreadable — nothing to trust"
31
+ exit 0
32
+ fi
33
+
34
+ # --- System store (curl / wget / system OpenSSL / Node via the bundle) --------
35
+ # Copy to a world-readable path first; the source may be root-only
36
+ # (/root/.portless/ca.pem) and NODE_EXTRA_CA_CERTS / NSS need to read it as the
37
+ # box user.
38
+ if install -m 0644 "$CA_SRC" "$SYS_CA_DST" 2>/dev/null; then
39
+ if command -v update-ca-certificates >/dev/null 2>&1; then
40
+ update-ca-certificates >/dev/null 2>&1 || warn "update-ca-certificates failed (system store may be stale)"
41
+ fi
42
+ else
43
+ warn "could not stage CA to $SYS_CA_DST"
44
+ fi
45
+
46
+ # --- Box user's NSS DB (Chromium / Playwright-Chromium on Linux) --------------
47
+ # Chromium reads sql:\$HOME/.pki/nssdb for the user it runs as. certutil ships in
48
+ # libnss3-tools (baked into the box images).
49
+ if command -v certutil >/dev/null 2>&1; then
50
+ BOX_HOME="$(getent passwd "$BOX_USER" 2>/dev/null | cut -d: -f6)"
51
+ if [ -n "$BOX_HOME" ]; then
52
+ NSSDB="$BOX_HOME/.pki/nssdb"
53
+ # Run the NSS mutations as the box user so the db stays user-owned, even
54
+ # when this script runs as root (the common case: `exec --user root`).
55
+ if [ "$(id -un)" = "$BOX_USER" ]; then
56
+ run_as_user() { bash -c "$1"; }
57
+ else
58
+ run_as_user() { sudo -u "$BOX_USER" -H bash -c "$1"; }
59
+ fi
60
+ run_as_user "mkdir -p '$NSSDB'" 2>/dev/null || warn "could not create $NSSDB"
61
+ # Initialize an empty (password-less) db if none exists yet.
62
+ if [ ! -f "$NSSDB/cert9.db" ]; then
63
+ run_as_user "certutil -d sql:'$NSSDB' -N --empty-password" 2>/dev/null \
64
+ || warn "certutil -N failed"
65
+ fi
66
+ # Delete-then-add keeps re-runs (resume) idempotent.
67
+ run_as_user "certutil -d sql:'$NSSDB' -D -n '$NSS_NICK'" 2>/dev/null || true
68
+ if run_as_user "certutil -d sql:'$NSSDB' -A -t 'C,,' -n '$NSS_NICK' -i '$SYS_CA_DST'" 2>/dev/null; then
69
+ :
70
+ else
71
+ warn "certutil -A failed — in-box Chromium may not trust the CA"
72
+ fi
73
+ else
74
+ warn "user '$BOX_USER' not found — skipping NSS trust"
75
+ fi
76
+ else
77
+ warn "certutil not found (libnss3-tools missing) — skipping NSS trust"
78
+ fi
79
+
80
+ # Emit the system CA path for the caller to wire into NODE_EXTRA_CA_CERTS.
81
+ echo "$SYS_CA_DST"
82
+ exit 0
@@ -222,8 +222,9 @@ write back to the host):
222
222
  `obj`, `packages`, `dist`, `.next`, `target`) are dropped by default; `exclude:`
223
223
  is additive. Each carry entry is capped at `box.cpMaxBytes` (default 100 MiB
224
224
  after excludes) — the same limit `agentbox cp` enforces.
225
- - **`agentbox-ctl cp fromHost <hostPath> <boxPath>`** (ad-hoc, from inside the box)
226
- — for a one-off copy. Prompts the user on the host to approve.
225
+ - **`agentbox-ctl cp fromHost <hostPath...> <boxPath>`** (ad-hoc, from inside the box)
226
+ — for a one-off copy. Takes several sources in one call (last path is the dest,
227
+ which must be a directory). Prompts the user on the host to approve.
227
228
 
228
229
  **The per-copy size limit (important for large/legacy folders).** A single copy is
229
230
  blocked above `box.cpMaxBytes` (default **100 MB**) *after* default excludes, so it
@@ -236,9 +237,9 @@ the biggest remaining folders/subfolders. To get under the limit, EITHER:
236
237
  - pass `--yes` to copy the whole thing anyway (only when you really need it all).
237
238
 
238
239
  Example: a 2.4 GB legacy folder is mostly `packages/` (NuGet) + `.git`; those are
239
- excluded by default, and what's left can be split:
240
- `agentbox-ctl cp fromHost ../legacy/src /workspace/legacy/src` then
241
- `... cp fromHost ../legacy/Database /workspace/legacy/Database`.
240
+ excluded by default, and what's left can be copied in one call by listing the
241
+ sub-folders into a destination directory:
242
+ `agentbox-ctl cp fromHost ../legacy/src ../legacy/Database /workspace/legacy/`.
242
243
 
243
244
  ## 7. Validate before handing off
244
245