@madarco/agentbox 0.18.0 → 0.20.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 (71) hide show
  1. package/CHANGELOG.md +118 -0
  2. package/README.md +4 -3
  3. package/dist/_cloud-attach-THTN4CFZ.js +18 -0
  4. package/dist/{chunk-U7IZS2ZP.js → chunk-3VFY3N4A.js} +1388 -234
  5. package/dist/chunk-3VFY3N4A.js.map +1 -0
  6. package/dist/{chunk-XWBFWUY2.js → chunk-52LKNUY7.js} +6 -3
  7. package/dist/chunk-52LKNUY7.js.map +1 -0
  8. package/dist/{chunk-6QFPYU4Z.js → chunk-7K2A3NLE.js} +8 -5
  9. package/dist/chunk-7K2A3NLE.js.map +1 -0
  10. package/dist/{chunk-5BO6SGMI.js → chunk-7RWFYLF3.js} +194 -34
  11. package/dist/chunk-7RWFYLF3.js.map +1 -0
  12. package/dist/{chunk-IA6YHH52.js → chunk-MODNW54N.js} +6 -3
  13. package/dist/{chunk-IA6YHH52.js.map → chunk-MODNW54N.js.map} +1 -1
  14. package/dist/{chunk-46NXCJ6Z.js → chunk-NXX3KQZ6.js} +2 -2
  15. package/dist/{chunk-3JXSW6PN.js → chunk-P6UT5XGE.js} +2 -2
  16. package/dist/{chunk-OG4KMYOJ.js → chunk-ZX6DTA4X.js} +276 -56
  17. package/dist/chunk-ZX6DTA4X.js.map +1 -0
  18. package/dist/{dist-CFSKUAS5.js → dist-3PLT2EK2.js} +17 -3
  19. package/dist/{dist-T7ESSBCZ.js → dist-3WFNXXPE.js} +20 -6
  20. package/dist/dist-3WFNXXPE.js.map +1 -0
  21. package/dist/{dist-3UYQZOAO.js → dist-7ELDXBAG.js} +19 -6
  22. package/dist/dist-7ELDXBAG.js.map +1 -0
  23. package/dist/{dist-4BHW7DCO.js → dist-C3YRC3PP.js} +10 -5
  24. package/dist/dist-C3YRC3PP.js.map +1 -0
  25. package/dist/{dist-7BS2JS27.js → dist-CZ6CRADC.js} +18 -7
  26. package/dist/dist-CZ6CRADC.js.map +1 -0
  27. package/dist/index.js +1218 -560
  28. package/dist/index.js.map +1 -1
  29. package/dist/{prepared-state-MQHD3M5F-OVABNV66.js → prepared-state-MQHD3M5F-5ZMCNY43.js} +2 -2
  30. package/package.json +4 -4
  31. package/runtime/docker/apps/cli/share/agentbox-setup/SKILL.md +1 -1
  32. package/runtime/docker/packages/ctl/dist/bin.cjs +255 -169
  33. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-dockerd-start +13 -0
  34. package/runtime/docker/packages/sandbox-docker/scripts/claude-managed-settings.json +4 -4
  35. package/runtime/e2b/agentbox-dockerd-start +145 -0
  36. package/runtime/e2b/agentbox-setup-skill.md +1 -1
  37. package/runtime/e2b/attach-helper.cjs +23 -2
  38. package/runtime/e2b/claude-managed-settings.json +4 -4
  39. package/runtime/e2b/ctl.cjs +255 -169
  40. package/runtime/e2b/scripts/build-template.sh +22 -5
  41. package/runtime/hetzner/agentbox-dockerd-start +13 -0
  42. package/runtime/hetzner/agentbox-setup-skill.md +1 -1
  43. package/runtime/hetzner/claude-managed-settings.json +4 -4
  44. package/runtime/hetzner/ctl.cjs +255 -169
  45. package/runtime/relay/bin.cjs +267 -63
  46. package/runtime/vercel/agentbox-dockerd-start +145 -0
  47. package/runtime/vercel/agentbox-setup-skill.md +1 -1
  48. package/runtime/vercel/claude-managed-settings.json +4 -4
  49. package/runtime/vercel/ctl.cjs +255 -169
  50. package/runtime/vercel/custom-system-CLAUDE.md +5 -4
  51. package/runtime/vercel/scripts/provision.sh +20 -5
  52. package/share/agentbox-setup/SKILL.md +1 -1
  53. package/share/host-skills/agentbox/SKILL.md +4 -4
  54. package/share/host-skills/agentbox-info/SKILL.md +6 -6
  55. package/share/host-skills/codex/agentbox.md +12 -4
  56. package/share/host-skills/opencode/agentbox.md +2 -2
  57. package/dist/_cloud-attach-3UC3IL62.js +0 -16
  58. package/dist/chunk-5BO6SGMI.js.map +0 -1
  59. package/dist/chunk-6QFPYU4Z.js.map +0 -1
  60. package/dist/chunk-OG4KMYOJ.js.map +0 -1
  61. package/dist/chunk-U7IZS2ZP.js.map +0 -1
  62. package/dist/chunk-XWBFWUY2.js.map +0 -1
  63. package/dist/dist-3UYQZOAO.js.map +0 -1
  64. package/dist/dist-4BHW7DCO.js.map +0 -1
  65. package/dist/dist-7BS2JS27.js.map +0 -1
  66. package/dist/dist-T7ESSBCZ.js.map +0 -1
  67. /package/dist/{_cloud-attach-3UC3IL62.js.map → _cloud-attach-THTN4CFZ.js.map} +0 -0
  68. /package/dist/{chunk-46NXCJ6Z.js.map → chunk-NXX3KQZ6.js.map} +0 -0
  69. /package/dist/{chunk-3JXSW6PN.js.map → chunk-P6UT5XGE.js.map} +0 -0
  70. /package/dist/{dist-CFSKUAS5.js.map → dist-3PLT2EK2.js.map} +0 -0
  71. /package/dist/{prepared-state-MQHD3M5F-OVABNV66.js.map → prepared-state-MQHD3M5F-5ZMCNY43.js.map} +0 -0
@@ -8,8 +8,10 @@
8
8
  # Differences from the vercel installer (packages/sandbox-vercel/scripts/
9
9
  # provision.sh), which this mirrors:
10
10
  # - apt-get / dpkg, not dnf (E2B base = Debian 12 bookworm).
11
- # - NO docker / dockerd / iptables — E2B microVMs can't run nested
12
- # containers (same shape as vercel).
11
+ # - docker.io + iptables ARE installed (in-box DinD): unlike the original
12
+ # assumption, E2B microVMs DO support nested containers (full root +
13
+ # cap_sys_admin + working namespaces, verified 2026-06-23). dockerd is
14
+ # launched at create/resume by agentbox-dockerd-start, not systemd.
13
15
  # - The `vscode` user is created with a free uid (E2B's `code` group holds
14
16
  # 1000 on the base template, so useradd picks the next free uid; there are
15
17
  # no bind mounts so the exact uid is irrelevant — only ownership of
@@ -17,6 +19,7 @@
17
19
  #
18
20
  # Required inputs (uploaded via Template.copy before this runs):
19
21
  # /tmp/agentbox-ctl -- prebuilt @agentbox/ctl bundle (cjs)
22
+ # /tmp/agentbox-dockerd-start -- in-box dockerd launch helper (DinD)
20
23
  # /tmp/agentbox-vnc-start -- VNC startup helper
21
24
  # /tmp/agentbox-checkpoint-cleanup -- pre-snapshot cleanup helper
22
25
  # /tmp/agentbox-open -- in-box xdg-open shim
@@ -89,6 +92,19 @@ chmod 0440 /etc/sudoers.d/90-agentbox-vscode
89
92
  visudo -cf /etc/sudoers >/dev/null
90
93
  done_ "vscode user + sudoers"
91
94
 
95
+ step "docker engine (in-box DinD)"
96
+ # E2B microVMs support nested containers (full root + cap_sys_admin), so bake
97
+ # the docker engine like the vercel/hetzner/docker providers. dockerd is NOT
98
+ # started by systemd here — agentbox-dockerd-start launches it at create/resume
99
+ # (it picks the storage driver at runtime; overlay2 works on E2B). docker.io
100
+ # pulls containerd + runc + the cli; iptables is needed for bridge networking.
101
+ # Must run AFTER the vscode user exists (usermod -aG docker vscode below).
102
+ apt-get install -y -q --no-install-recommends docker.io iptables
103
+ groupadd -f docker
104
+ usermod -aG docker vscode
105
+ systemctl disable --now docker.service docker.socket 2>/dev/null || true
106
+ done_ "docker engine (in-box DinD)"
107
+
92
108
  step "agentbox base dirs + /workspace ownership"
93
109
  mkdir -p /workspace /run/agentbox /var/log/agentbox /var/lib/agentbox /etc/agentbox /etc/claude-code \
94
110
  /usr/local/share/agentbox
@@ -120,7 +136,8 @@ step "agentbox-ctl install"
120
136
  install -m 0755 /tmp/agentbox-ctl /usr/local/bin/agentbox-ctl
121
137
  done_ "agentbox-ctl install"
122
138
 
123
- step "baked helper scripts (vnc / cleanup / xdg-open)"
139
+ step "baked helper scripts (dockerd / vnc / cleanup / xdg-open)"
140
+ install -m 0755 /tmp/agentbox-dockerd-start /usr/local/bin/agentbox-dockerd-start
124
141
  install -m 0755 /tmp/agentbox-vnc-start /usr/local/bin/agentbox-vnc-start
125
142
  install -m 0755 /tmp/agentbox-checkpoint-cleanup /usr/local/bin/agentbox-checkpoint-cleanup
126
143
  install -m 0755 /tmp/agentbox-open /usr/local/bin/agentbox-open
@@ -129,7 +146,7 @@ ln -sf /usr/local/bin/agentbox-open /usr/local/bin/xdg-open
129
146
  # Installing them here would put the relay-routing `git` on PATH ahead of
130
147
  # /usr/bin/git and route this script's own remaining git/clone commands through
131
148
  # a relay that doesn't exist during the bake.
132
- done_ "baked helper scripts (vnc / cleanup / xdg-open)"
149
+ done_ "baked helper scripts (dockerd / vnc / cleanup / xdg-open)"
133
150
 
134
151
  step "baked config files (claude / codex / setup guide / tmux.conf)"
135
152
  install -m 0644 /tmp/agentbox-custom-CLAUDE.md /etc/claude-code/CLAUDE.md
@@ -289,7 +306,7 @@ install -m 0755 /tmp/agentbox-linear-shim /usr/local/bin/linear
289
306
  done_ "relay shims (gh + git + ntn + linear)"
290
307
 
291
308
  step "trim /tmp/agentbox-*"
292
- rm -f /tmp/agentbox-ctl /tmp/agentbox-vnc-start \
309
+ rm -f /tmp/agentbox-ctl /tmp/agentbox-dockerd-start /tmp/agentbox-vnc-start \
293
310
  /tmp/agentbox-checkpoint-cleanup /tmp/agentbox-open \
294
311
  /tmp/agentbox-gh-shim /tmp/agentbox-git-shim /tmp/agentbox-ntn-shim \
295
312
  /tmp/agentbox-linear-shim \
@@ -9,6 +9,11 @@
9
9
  set -euo pipefail
10
10
 
11
11
  if pgrep -x dockerd >/dev/null; then
12
+ # dockerd already up — but a prior run may have died after the daemon became
13
+ # ready yet before it widened the socket, leaving it 0660 and unreachable by
14
+ # the unprivileged box user. Re-assert the chmod (see the note on the
15
+ # fresh-start path below) before the idempotent early exit.
16
+ chmod 666 /var/run/docker.sock 2>/dev/null || true
12
17
  exit 0
13
18
  fi
14
19
 
@@ -129,4 +134,12 @@ for _ in $(seq 1 300); do
129
134
  sleep 0.1
130
135
  done
131
136
 
137
+ # Open the socket to the unprivileged box user. dockerd creates it root:docker
138
+ # 0660; the in-box agent and the ctl supervisor's `image:` services run as the
139
+ # box user, whose already-running session may not carry the docker group, so
140
+ # widen to 0666. Single-tenant box, so this is safe; correctly timed here (run
141
+ # as root, right after the socket is ready) so the cloud launcher's poll — which
142
+ # runs `docker info` as the box user — can succeed.
143
+ chmod 666 /var/run/docker.sock 2>/dev/null || true
144
+
132
145
  disown -a
@@ -276,7 +276,7 @@ On Vercel: this actually STOPS the sandbox, so warn the user about it. Also the
276
276
 
277
277
  - For Nextjs/Vite/Tasnstack projects, makes sure to forward also websocket for hot reload.
278
278
 
279
- - Service like flask, nextjs, BETTER_AUTH_URL, NEXT_PUBLIC_APP_URL should use the `<boxname>.localhost` url for the local development so that on the host it will use the same url as the box. Render this automatically instead of hand-writing `sed` — see section 6c.
279
+ - Service like flask, nextjs, BETTER_AUTH_URL, NEXT_PUBLIC_APP_URL should use the env-init `{{AGENTBOX_BOX_HOST}}` in agentbox.yaml so it will be automatically replaced.
280
280
 
281
281
  - The `install` task above uses `run_once: true`, so it is a no-op on warm boots. Do **not** wrap it in a manual marker check too. To force a one-off rebuild, run `agentbox-ctl run-task install --force` (which bypasses the run_once marker), or edit the command (a changed command invalidates the hash and re-runs).
282
282
 
@@ -1,5 +1,5 @@
1
1
  {
2
- "$comment": "AgentBox enterprise-managed Claude Code settings, baked into the box image at /etc/claude-code/managed-settings.json. Highest precedence and NOT synced from the host ~/.claude, so claude-hooks-filter.ts never touches it; per Claude Code, hook arrays MERGE across settings sources, so the user's own hooks still run. These hooks report Claude's activity to the box supervisor (agentbox-ctl claude-state -> ctl socket -> relay -> ~/.agentbox/boxes/<id>/status.json) so `agentbox status/list/inspect` can show it even when the box is paused. Each command is exit-0 fast and shell-backgrounded so a hook can never block or fail a Claude turn. The ExitPlanMode / AskUserQuestion entries run SYNCHRONOUSLY (no &) because they consume the hook's stdin payload; the catchall PreToolUse 'working' hook races with them, but the supervisor's sticky-state semantics swallow that race (a 'working' set while in end-plan/question is ignored unless --clear-pending is set, which only the matching PostToolUse hook passes). skipDangerousModePermissionPrompt pre-accepts the bypass-permissions disclaimer at policy precedence — AgentBox boxes are isolated, and `agentbox claude` defaults to --dangerously-skip-permissions, so the one-time accept gate would just trap every fresh box.",
2
+ "$comment": "AgentBox enterprise-managed Claude Code settings, baked into the box image at /etc/claude-code/managed-settings.json. Highest precedence and NOT synced from the host ~/.claude, so claude-hooks-filter.ts never touches it; per Claude Code, hook arrays MERGE across settings sources, so the user's own hooks still run. These hooks report Claude's activity to the box supervisor (agentbox-ctl claude-state -> ctl socket -> relay -> ~/.agentbox/boxes/<id>/status.json) so `agentbox status/list/inspect` can show it even when the box is paused. Each command is exit-0 fast and shell-backgrounded so a hook can never block or fail a Claude turn. The ExitPlanMode / AskUserQuestion entries run SYNCHRONOUSLY (no &) because they consume the hook's stdin payload; the catchall PreToolUse 'working' hook races with them, but the supervisor's sticky-state semantics swallow that race (a 'working' set while in end-plan/question is ignored unless --clear-pending is set, which only the matching PostToolUse hook passes). The SessionStart / Stop entries also run SYNCHRONOUSLY (no &) with --capture-session: they read the hook's stdin session_id and record it to the box's per-box session pointer (~/.local/state/agentbox/claude-session) so a box restart can resume the exact conversation (claude --resume <id>); they fire often enough to track /new and /branch, which mint fresh session ids. (A backgrounded `&` hook would detach stdin, so capture hooks must be synchronous.) skipDangerousModePermissionPrompt pre-accepts the bypass-permissions disclaimer at policy precedence — AgentBox boxes are isolated, and `agentbox claude` defaults to --dangerously-skip-permissions, so the one-time accept gate would just trap every fresh box.",
3
3
  "skipDangerousModePermissionPrompt": true,
4
4
  "hooks": {
5
5
  "UserPromptSubmit": [
@@ -45,7 +45,7 @@
45
45
  "Stop": [
46
46
  {
47
47
  "hooks": [
48
- { "type": "command", "command": "agentbox-ctl claude-state idle >/dev/null 2>&1 &", "timeout": 3 }
48
+ { "type": "command", "command": "agentbox-ctl claude-state idle --capture-session >/dev/null 2>&1", "timeout": 3 }
49
49
  ]
50
50
  }
51
51
  ],
@@ -101,14 +101,14 @@
101
101
  "SessionStart": [
102
102
  {
103
103
  "hooks": [
104
- { "type": "command", "command": "agentbox-ctl claude-state idle >/dev/null 2>&1 &", "timeout": 3 }
104
+ { "type": "command", "command": "agentbox-ctl claude-state idle --capture-session >/dev/null 2>&1", "timeout": 3 }
105
105
  ]
106
106
  }
107
107
  ],
108
108
  "SessionEnd": [
109
109
  {
110
110
  "hooks": [
111
- { "type": "command", "command": "agentbox-ctl claude-state idle >/dev/null 2>&1 &", "timeout": 3 }
111
+ { "type": "command", "command": "agentbox-ctl claude-state idle --clear-session >/dev/null 2>&1 &", "timeout": 3 }
112
112
  ]
113
113
  }
114
114
  ]