@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
@@ -29,7 +29,11 @@ wrapper already builds `git push <remote> <branch>` host-side from the
29
29
  registered worktree; the `-- <args>` slot is for extra flags only (e.g.
30
30
  `--force-with-lease`, `--tags`). Re-passing the remote or branch makes git treat
31
31
  them as refspecs and fails with `refs/remotes/origin/HEAD cannot be resolved to
32
- branch`.
32
+ branch`. To make the branch available on the host **without** publishing it to
33
+ the remote, add `--host-only` (e.g. `agentbox-ctl git push --host-only`); it
34
+ lands the branch in the host's local repo only. Add `--as <branch>` to choose
35
+ the host branch name (default: this box's branch), and `--force` to allow a
36
+ non-fast-forward overwrite.
33
37
 
34
38
  For GitHub PR work, use `agentbox-ctl git pr <op> [args...]` — same model, relay
35
39
  shells to host `gh`. Ops: `create`, `view`, `list`, `comment`, `review`,
@@ -38,11 +42,16 @@ silently; everything else asks the user to confirm in the host wrapper (deny →
38
42
  exit 10).
39
43
 
40
44
  For ad-hoc file transfers between this box and the host, use
41
- `agentbox-ctl cp toHost <boxPath> <hostPath>` and
42
- `agentbox-ctl cp fromHost <hostPath> <boxPath>` or `agentbox-ctl download claude` /
45
+ `agentbox-ctl cp toHost <boxPath...> <hostPath>` and
46
+ `agentbox-ctl cp fromHost <hostPath...> <boxPath>` (both accept multiple paths; wildcards expand in your shell) or `agentbox-ctl download claude` /
43
47
  `download env` / `download config`. They RPC to the host and ask the user for
44
48
  confirmation on the wrapper that runs `agentbox claude`; deny returns exit 10
45
49
  (`denied by user`). Don't put any timeout on the command, it will run forever
46
50
  and the user will be notified through multiple channels.
47
51
 
52
+ If an agentbox.yaml file is present, services and docker containers will be started automatically.
53
+ Check the status with `agentbox-ctl status`.
54
+
55
+ 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 because it is a cloud provided url.
56
+
48
57
  Box identity: /etc/agentbox/box.env and the AGENTBOX_* env vars.
@@ -39,6 +39,24 @@ set -euo pipefail
39
39
  step() { printf '\n>>> BEGIN %s\n' "$1"; }
40
40
  done_() { printf '<<< END %s\n' "$1"; }
41
41
 
42
+ # Retry a command with exponential backoff. Usage: retry_backoff <max> cmd...
43
+ # Waits 60s before attempt 2, 240s before attempt 3 (~5 min total budget). Used
44
+ # for the Claude native installer, whose CDN (claude.ai / downloads.claude.ai,
45
+ # behind Cloudflare) intermittently 403s cloud-datacenter egress IPs under load.
46
+ retry_backoff() {
47
+ local max=$1; shift
48
+ local attempt=1
49
+ local -a waits=(60 240)
50
+ while true; do
51
+ if "$@"; then return 0; fi
52
+ if [ "$attempt" -ge "$max" ]; then return 1; fi
53
+ local w=${waits[$((attempt-1))]:-240}
54
+ echo "retry_backoff: attempt ${attempt}/${max} failed — backing off ${w}s" >&2
55
+ sleep "$w"
56
+ attempt=$((attempt+1))
57
+ done
58
+ }
59
+
42
60
  if [ "$(id -u)" -ne 0 ]; then
43
61
  echo "provision.sh: must run as root (got uid $(id -u))" >&2
44
62
  exit 64
@@ -251,6 +269,18 @@ export DISABLE_AUTOUPDATER=${DISABLE_AUTOUPDATER:-1}
251
269
  export DISPLAY=${DISPLAY:-:1}
252
270
  export AGENT_BROWSER_EXECUTABLE_PATH=${AGENT_BROWSER_EXECUTABLE_PATH:-/usr/local/bin/chromium}
253
271
  export BROWSER=${BROWSER:-/usr/local/bin/agentbox-open}
272
+ # Land interactive login shells in the workspace, so remote-host integrations
273
+ # (Codex app, VS Code Remote-SSH, plain `ssh <box>`) open in the project instead
274
+ # of $HOME. Interactive-only so scp/sftp and `ssh box <cmd>` are untouched; only
275
+ # when still at $HOME so a caller-chosen dir (e.g. agentbox's tmux `-c /workspace`)
276
+ # is never overridden.
277
+ case $- in
278
+ *i*)
279
+ if [ "$PWD" = "$HOME" ] && [ -d /workspace ]; then
280
+ cd /workspace
281
+ fi
282
+ ;;
283
+ esac
254
284
  PROFILE
255
285
  chmod 0644 /etc/profile.d/agentbox.sh
256
286
  done_ "login-shell shim (/etc/profile.d/agentbox.sh)"
@@ -298,8 +328,20 @@ npm install -g @openai/codex opencode-ai agent-browser 2>&1 | tail -3 || \
298
328
  done_ "agent CLIs (codex + opencode + agent-browser, global npm)"
299
329
 
300
330
  step "Claude Code (native installer, run as vscode)"
301
- # Anthropic's canonical installer drops `claude` at /home/vscode/.local/bin/.
302
- sudo -u vscode -H bash -lc 'curl -fsSL https://claude.ai/install.sh | bash -s stable'
331
+ # Anthropic's native installer drops `claude` at /home/vscode/.local/bin/claude
332
+ # with installMethod=native (matching the host-seeded .claude.json, so the
333
+ # startup integrity check stays quiet) and ships native-only features the npm
334
+ # package lacks. Its CDN (claude.ai / downloads.claude.ai) sits behind
335
+ # Cloudflare, which intermittently 403s cloud-datacenter egress IPs under load —
336
+ # so retry with backoff rather than falling back to npm. A bare `curl | bash`
337
+ # would hide a 403 (curl -f exits non-zero but the pipe's status is bash's 0),
338
+ # so keep pipefail and fold the PATH check in so a "succeeded but absent" result
339
+ # also retries. A failed provision is better than a claude-less snapshot.
340
+ if ! retry_backoff 3 sudo -u vscode -H bash -lc \
341
+ 'set -o pipefail; curl -fsSL https://claude.ai/install.sh | bash -s stable && command -v claude >/dev/null'; then
342
+ echo "provision.sh: Claude native installer failed after 3 attempts (Cloudflare 403?) — aborting provision" >&2
343
+ exit 71
344
+ fi
303
345
  done_ "Claude Code (native installer, run as vscode)"
304
346
 
305
347
  step "Chrome runtime libs (dnf)"
@@ -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
 
@@ -34,7 +34,21 @@ Fork the current Claude Code session into a fresh AgentBox box.
34
34
 
35
35
  4. **Report.** In one line, give the user the new box name (parse it from the command output) and confirm their host session is unaffected. If you passed `--plan`, mention the box opens in plan mode ready to resume. Do not summarize the conversation — the fork already carries it.
36
36
 
37
+ For Hetzner cloud boxes only, when in Codex App or Claude Desktop, use can add a ssh connection to the box. To do this first add an alias to their ssh config, then instruct them how to add the connection:
38
+
39
+ ```
40
+ agentbox shell <box> --ssh-config # writes ~/.ssh/config + prints details
41
+ ```
42
+
43
+ to add a ssh alias that the user can use to connect to the box
44
+
45
+ When in Codex App return a clickable link in the response for an easy way:
46
+ ```
47
+ [Add <ssh-alias> to Codex SSH](codex://settings/connections/ssh/add?name=<ssh-alias>)
48
+ ```
49
+
37
50
  ## Troubleshooting
38
51
 
39
52
  - If agentbox command fails, tell the user to install AgentBox by writing `! npm -g install @madarco/agentbox` in the chat.
40
53
  - If `AGENTBOX_RELAY_URL` is set in the environment, you are running *inside* a box. This command is host-only in v1; tell the user box→box fork is not supported yet.
54
+ - If you need to know more about Agentbox, check the /agentbox-info skill that containes the full documentation.
@@ -227,10 +227,39 @@ If a PR op appears to hang, tell the user to check the dashboard footer for the
227
227
  | `agentbox code [n\|name]` | Open VS Code / Cursor pointed at the box. |
228
228
  | `agentbox prepare --provider <name>` | One-time base image / snapshot build for `daytona`, `hetzner`, `vercel`, or `e2b` (e2b builds the base from a Dockerfile via `Template.build()`). With no `--provider`, prints status across all providers. |
229
229
  | `agentbox prune --provider <name>` | Clean up orphan boxes / images / snapshots for a provider (docker + daytona supported; hetzner pending). |
230
- | `agentbox cp <src> <dst>` | Copy a file/dir host↔box (`box:/path` prefix picks direction). Heavy dirs (`.git`, `node_modules`, build output) are dropped by default; add `--exclude=<glob\|name>` or `--no-default-excludes`. Uploads over `box.cpMaxBytes` (100 MB, post-exclude) are **blocked** with a size breakdown — trim with `--exclude`, copy heavy folders one at a time, or pass `--yes`. |
230
+ | `agentbox cp <paths...>` | Copy file(s)/dir(s) host↔box (`box:/path` prefix picks direction). List several sources before the destination, which must then be a directory — e.g. `agentbox cp src/ README.md ./logs/*.txt box:/workspace/` (wildcards expand in your shell). Heavy dirs (`.git`, `node_modules`, build output) are dropped by default; add `--exclude=<glob\|name>` or `--no-default-excludes`. Uploads over `box.cpMaxBytes` (100 MB, post-exclude, per source) are **blocked** with a size breakdown — trim with `--exclude`, copy heavy folders one at a time, or pass `--yes`. |
231
231
 
232
232
  Per-project numeric index (`1`, `2`, …) and friendly name (`review`, `smoke`) both work wherever `<box>` is accepted. Index `1` is the first box created in the current workspace.
233
233
 
234
+ ## Connecting an external app (Codex / Claude desktop) over SSH
235
+
236
+ When the user wants to attach the **Codex app** or **Claude desktop** to a box over SSH, run:
237
+
238
+ ```
239
+ agentbox shell <box> --ssh-config # writes ~/.ssh/config + prints details
240
+ agentbox shell <box> --ssh-config --json # same, machine-readable
241
+ ```
242
+
243
+ This writes a `Host <box-name>` alias into `~/.ssh/config` (pointing at the box's IP and its
244
+ per-box identity file) and prints the alias, host, user, identity path, and a ready `ssh
245
+ <box-name>` command. `--json` emits `{ alias, host, user, identityFile, sshCommand,
246
+ codexAddUrl }`.
247
+
248
+ **Hetzner cloud boxes only.** Only a box with a persistent per-box SSH key qualifies — an
249
+ external app connects later, so Daytona's 60-minute token would already be expired, and
250
+ Docker / Vercel / E2B boxes have no SSH. The command exits with a clear message (and writes
251
+ nothing) for unsupported providers.
252
+
253
+ After running it, surface both apps to the user. For **Codex**, render the deep link verbatim
254
+ (`<ssh-alias>` is the box name):
255
+
256
+ ```
257
+ [Add <ssh-alias> to Codex SSH](codex://settings/connections/ssh/add?name=<ssh-alias>)
258
+ ```
259
+
260
+ For **Claude desktop**, there's no deep link — tell the user to add an SSH connection to host
261
+ `<ssh-alias>` (it's already in `~/.ssh/config`).
262
+
234
263
  ## Operating principles
235
264
 
236
265
  1. **Never assume the host needs SSH keys forwarded into a box** — git is handled by the relay, by design.