@madarco/agentbox 0.5.0 → 0.7.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.
- package/dist/_cloud-attach-DMVH6GWO.js +12 -0
- package/dist/chunk-7KOEFGN2.js +1162 -0
- package/dist/chunk-7KOEFGN2.js.map +1 -0
- package/dist/chunk-I24B6AXR.js +600 -0
- package/dist/chunk-I24B6AXR.js.map +1 -0
- package/dist/chunk-NAVL4R34.js +7546 -0
- package/dist/chunk-NAVL4R34.js.map +1 -0
- package/dist/chunk-NW5NYTQM.js +1366 -0
- package/dist/chunk-NW5NYTQM.js.map +1 -0
- package/dist/chunk-UK72UQ5U.js +237 -0
- package/dist/chunk-UK72UQ5U.js.map +1 -0
- package/dist/chunk-V5KZGB5V.js +722 -0
- package/dist/chunk-V5KZGB5V.js.map +1 -0
- package/dist/cloud-poller-ZIWSADJB-JXFRJUEM.js +10 -0
- package/dist/dist-ETCFRVPA.js +423 -0
- package/dist/dist-QZGJIBT5.js +1339 -0
- package/dist/dist-QZGJIBT5.js.map +1 -0
- package/dist/dist-R67WMLCF.js +183 -0
- package/dist/dist-R67WMLCF.js.map +1 -0
- package/dist/index.js +4088 -1451
- package/dist/index.js.map +1 -1
- package/package.json +9 -4
- package/runtime/docker/Dockerfile.box +115 -19
- package/runtime/docker/apps/cli/share/agentbox-setup/SKILL.md +34 -19
- package/runtime/docker/packages/ctl/dist/bin.cjs +10246 -758
- package/runtime/docker/packages/sandbox-docker/scripts/agentbox-checkpoint-cleanup +13 -3
- package/runtime/docker/packages/sandbox-docker/scripts/agentbox-codex-hooks.json +37 -0
- package/runtime/docker/packages/sandbox-docker/scripts/agentbox-dockerd-start +87 -7
- package/runtime/docker/packages/sandbox-docker/scripts/agentbox-open +28 -0
- package/runtime/docker/packages/sandbox-docker/scripts/custom-system-CLAUDE.md +4 -9
- package/runtime/hetzner/agentbox-checkpoint-cleanup +52 -0
- package/runtime/hetzner/agentbox-codex-hooks.json +37 -0
- package/runtime/hetzner/agentbox-dockerd-start +132 -0
- package/runtime/hetzner/agentbox-open +28 -0
- package/runtime/hetzner/agentbox-setup-skill.md +196 -0
- package/runtime/hetzner/agentbox-vnc-start +77 -0
- package/runtime/hetzner/claude-managed-settings.json +54 -0
- package/runtime/hetzner/ctl.cjs +22350 -0
- package/runtime/hetzner/custom-system-CLAUDE.md +27 -0
- package/runtime/hetzner/scripts/install-box.sh +365 -0
- package/runtime/relay/bin.cjs +9182 -754
- package/share/agentbox-setup/SKILL.md +34 -19
- package/dist/chunk-6VTAPD4H.js +0 -507
- package/dist/chunk-6VTAPD4H.js.map +0 -1
- package/dist/chunk-7J5AJLWG.js +0 -238
- package/dist/chunk-7J5AJLWG.js.map +0 -1
- package/dist/chunk-FJNIFTWK.js +0 -523
- package/dist/chunk-FJNIFTWK.js.map +0 -1
- package/dist/chunk-HPZMD5DE.js +0 -106
- package/dist/chunk-HPZMD5DE.js.map +0 -1
- package/dist/chunk-PXUBE5KS.js +0 -2346
- package/dist/chunk-PXUBE5KS.js.map +0 -1
- package/dist/chunk-RFC5F5HR.js +0 -1709
- package/dist/chunk-RFC5F5HR.js.map +0 -1
- package/dist/create-AHZ3GVEZ-TGEDL7UX.js +0 -15
- package/dist/lifecycle-LFOL6YFM-TCHDX3J5.js +0 -38
- package/dist/state-KD7M46ZP-KHFTHFUS.js +0 -26
- package/dist/stats-Z4BVJODD-HEC4TMUZ.js +0 -19
- package/dist/stats-Z4BVJODD-HEC4TMUZ.js.map +0 -1
- /package/dist/{create-AHZ3GVEZ-TGEDL7UX.js.map → _cloud-attach-DMVH6GWO.js.map} +0 -0
- /package/dist/{lifecycle-LFOL6YFM-TCHDX3J5.js.map → cloud-poller-ZIWSADJB-JXFRJUEM.js.map} +0 -0
- /package/dist/{state-KD7M46ZP-KHFTHFUS.js.map → dist-ETCFRVPA.js.map} +0 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agentbox-setup
|
|
3
|
+
description: Generate an agentbox.yaml for the current AgentBox workspace. Invoke when the user opens a sandbox without an agentbox.yaml or asks to (re)configure one.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /agentbox-setup
|
|
7
|
+
|
|
8
|
+
## Box layout (what you're configuring against)
|
|
9
|
+
|
|
10
|
+
Your user i `vscode` and you can use `sudo` to run commands as root.
|
|
11
|
+
|
|
12
|
+
`/workspace` is where the user code lives, a per-box git worktree on a fresh `agentbox/<box-name>` branch (or a tar-piped copy of the host workspace for non-git projects).
|
|
13
|
+
Run `agentbox checkpoint --set-default` (similar to `docker commit`) to save any changes make to the system and workspace so that new boxes will start from a warm state. Everything is wiped on `agentbox destroy`.
|
|
14
|
+
|
|
15
|
+
Some special folders:
|
|
16
|
+
|
|
17
|
+
- **Host main repo's `.git/`** — If the box bind-mounted RW at its identical absolute host path. In-box commits land on the host's branch refs (visible to `git log` on the host immediately); the box itself carries no SSH/git creds, so `git push` goes through the host relay (`agentbox-ctl git push`). The host's **working tree is never written to** — only refs/objects under `.git/`.
|
|
18
|
+
- **`~/.claude`** — and similar home folders for coding agents are seeded from the host's `~/.claude` on each create so auth, skills, and plugins persist without leaking the host's home dir.
|
|
19
|
+
- **`agentbox.yaml`** — read by `agentbox-ctl` from `/workspace`. Tasks and services declared here are what the supervisor will run.
|
|
20
|
+
|
|
21
|
+
Exposed ports and services:
|
|
22
|
+
- **portless** - every port with `expose:` setting in agentbox.yaml, will be exposed not only as a local port but also as a special domain name `https://<name>.localhost` (so on https) using `portless` cli and proxy. This will be also mapped to the host where also `portless` proxy is running so users can access the same service on the same looking url.
|
|
23
|
+
- **vnc** - the webVNC server exposed on 6080 will be proxies to the host on a random port.
|
|
24
|
+
- **vscode** - the vscode server is proxied to the host on a random port.
|
|
25
|
+
|
|
26
|
+
## Goal
|
|
27
|
+
|
|
28
|
+
Produce a `/workspace/agentbox.yaml` that captures this project's services, tasks, and box defaults so the in-box supervisor (`agentbox-ctl`) can boot the workspace deterministically.
|
|
29
|
+
|
|
30
|
+
`agentbox.yaml` is **declarative**. The supervisor reads it on box start, but you don't have to restart the box: after you write the file, `agentbox-ctl reload` (run from inside the box) makes the already-running supervisor re-read it and immediately run the declared tasks and autostart the services. See step 8.
|
|
31
|
+
|
|
32
|
+
## 1. Discover the project
|
|
33
|
+
|
|
34
|
+
Look at `/workspace`:
|
|
35
|
+
|
|
36
|
+
- Top-level manifests: `package.json`, `pyproject.toml` / `requirements.txt`, `Cargo.toml`, `go.mod`, `Gemfile`, `composer.json`, `mix.exs`, etc. — these tell you the runtime.
|
|
37
|
+
- `docker-compose.yaml` / `docker-compose.yml` — often lists the real services the project expects.
|
|
38
|
+
- `package.json` → `scripts`: look for `dev`, `start`, `build`, `test`, `migrate`, `seed`.
|
|
39
|
+
- `Makefile` / `justfile` / `Taskfile.yaml` — alternative task runners.
|
|
40
|
+
- Listening ports: grep for `listen(`, `PORT=`, framework defaults (3000 for Next.js / Nuxt, 5173 for Vite, 8000 for Django, 8080 for Spring, etc.).
|
|
41
|
+
- Database / cache deps to spin up locally (Postgres, Redis, …) — declare them as services if the project doesn't expect them to be external.
|
|
42
|
+
|
|
43
|
+
## 2. Pick services and tasks
|
|
44
|
+
|
|
45
|
+
- **Services** = long-running. Web servers, watchers, queue workers, databases. `restart: on-failure` by default.
|
|
46
|
+
- **Tasks** = one-shot. `pnpm install`, DB migrations, codegen, fixture loaders, install apt packages. Wire dependent services with `needs:` so they wait for the task to finish successfully.
|
|
47
|
+
- Names: must match `[A-Za-z0-9_-]+`. Task names and service names share a namespace — no collisions.
|
|
48
|
+
- No cycles in `needs:`.
|
|
49
|
+
- **Always generate a dependency-install task** and make it the root of the `needs:` graph (every service that needs deps gets `needs: [install, …]`). Future boxes start from a snapshot of the final filesystem so they won't need this, but updates or moving to a cloud provider might need to rebuild the container from scratch. The filesystem can be then later captured by `agentbox-ctl checkpoint --set-default`. The task must be **idempotent and self-healing**: `agentbox-ctl` re-runs pending tasks on every box stop/start (the daemon dies with the container and is relaunched), so a plain `rm -rf node_modules && install` would wipe + reinstall on every start. Guard the rebuild with a marker file *inside* `node_modules` (the `.agentbox-installed` convention AgentBox uses internally): rebuild only when the marker is absent (fresh box), and be a fast no-op once it exists. Detect the package manager from the lockfile — never hardcode `pnpm`. See the worked example below.
|
|
50
|
+
- **Add a comment to the beginning** of the file to explain what you did and what issues you encountered, so that future run might use this information in case the project evolves and you need to update the agentbox.yaml file.
|
|
51
|
+
-
|
|
52
|
+
|
|
53
|
+
## 3. Wire readiness probes (services only)
|
|
54
|
+
|
|
55
|
+
`ready_when:` lets the supervisor decide when a service is "ready" (vs. just "running"). Exactly one of these must be present:
|
|
56
|
+
|
|
57
|
+
- `port: 3000` — TCP connect (default host `127.0.0.1`; override with `host:`).
|
|
58
|
+
- `log_match: "Listening on"` — regex matched against stdout/stderr. First match flips the service to ready.
|
|
59
|
+
- `http: "http://127.0.0.1:3000/health"` — GET probe. Optional `expect_status: 200` (default: any 2xx).
|
|
60
|
+
|
|
61
|
+
Tunables: `interval_ms` (default 500), `initial_delay_ms` (default 0), `timeout_ms` (default 60000), `on_timeout: kill | mark_unhealthy` (default `kill` — re-enters the restart policy).
|
|
62
|
+
|
|
63
|
+
### Mark the web service with `expose:`
|
|
64
|
+
|
|
65
|
+
The box's primary web app (the dev server / Next.js / API the user opens in a browser) should declare:
|
|
66
|
+
|
|
67
|
+
```yaml
|
|
68
|
+
expose:
|
|
69
|
+
port: 3000 # the port this service listens on inside the box
|
|
70
|
+
as: 80 # must be 80 — the container port AgentBox publishes
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
At most **one** service may set `expose:`. AgentBox forwards container `:80` to `127.0.0.1:<port>` and publishes it on the host with `portless` proxy to a <boxname>.localhost url, so `agentbox list`/`status` show it as the box's main URL on every engine (no OrbStack dependency). Set this on the same service whose `ready_when:` you just wrote (a DB or worker should **not** get `expose:`).
|
|
74
|
+
|
|
75
|
+
## 4. Restart + backoff
|
|
76
|
+
|
|
77
|
+
Per service:
|
|
78
|
+
|
|
79
|
+
- `restart: always | on-failure | never` (default `on-failure`).
|
|
80
|
+
- `backoff:` — `initial_ms` (default 500), `max_ms` (default 30000; must be `>= initial_ms`), `factor` (default 2).
|
|
81
|
+
|
|
82
|
+
## 5. (Optional) `defaults:` block
|
|
83
|
+
|
|
84
|
+
Sets per-project defaults for `agentbox create`/`claude`/`code`/`shell` — same shape as `~/.agentbox/config.yaml`. CLI flags still override. Common keys:
|
|
85
|
+
|
|
86
|
+
- `box.hostSnapshot` (bool) — APFS-clone the *host* workspace into a per-box scratch dir before seeding `/workspace` (stabilizes the tar-pipe source).
|
|
87
|
+
- `box.defaultCheckpoint` (string) — checkpoint new boxes start from (normally you set this via `agentbox-ctl checkpoint --set-default` at the end of setup — see section 9, not by hand).
|
|
88
|
+
- `box.withPlaywright` (bool) — install `@playwright/cli` globally inside the box.
|
|
89
|
+
- `box.vnc` (bool) — run Xvnc + noVNC on container port 6080.
|
|
90
|
+
- `box.isolateClaudeConfig` (bool) — per-box `~/.claude` volume instead of the shared one.
|
|
91
|
+
- `code.ide` — `vscode | cursor | auto`.
|
|
92
|
+
- `code.autoTerminals` (bool) — auto-generate `.vscode/tasks.json` with per-service tails.
|
|
93
|
+
- `browser.default` — `agent-browser | playwright | both`.
|
|
94
|
+
|
|
95
|
+
Full key list (run on the host): `agentbox config list --keys`.
|
|
96
|
+
|
|
97
|
+
## 6. Worked example
|
|
98
|
+
|
|
99
|
+
```yaml
|
|
100
|
+
# yaml-language-server: $schema=https://agentbox.dev/schema/agentbox.schema.json
|
|
101
|
+
# This agentbox.yaml setup this Next.js project, and includes:
|
|
102
|
+
# - a postgres database because it's used in the project
|
|
103
|
+
# - an inngest server for queues
|
|
104
|
+
# - a fix to move .turbo/cache folder to the workspace to avoid a permission error during setup
|
|
105
|
+
# - ...
|
|
106
|
+
defaults:
|
|
107
|
+
box:
|
|
108
|
+
withPlaywright: true
|
|
109
|
+
code:
|
|
110
|
+
ide: cursor
|
|
111
|
+
|
|
112
|
+
tasks:
|
|
113
|
+
# Idempotent install. /workspace is the container's writable filesystem, so
|
|
114
|
+
# node_modules persists across pause/stop/start and is captured by
|
|
115
|
+
# `agentbox checkpoint`. The host's node_modules is macOS-native and is
|
|
116
|
+
# never copied in, so force a clean Linux build the first time — but skip
|
|
117
|
+
# on every subsequent box start (agentbox-ctl re-runs pending tasks after
|
|
118
|
+
# stop/start). Adjust the lockfile detection to the project's package
|
|
119
|
+
# manager.
|
|
120
|
+
install:
|
|
121
|
+
command: |
|
|
122
|
+
set -e
|
|
123
|
+
MARKER=node_modules/.agentbox-installed
|
|
124
|
+
[ -f "$MARKER" ] && { echo "deps installed (marker present) — skip"; exit 0; }
|
|
125
|
+
apt-get update && apt-get install -y postgresql-client
|
|
126
|
+
rm -rf node_modules
|
|
127
|
+
if [ -f pnpm-lock.yaml ]; then
|
|
128
|
+
corepack enable >/dev/null 2>&1 || true
|
|
129
|
+
pnpm install --frozen-lockfile || pnpm install
|
|
130
|
+
fi
|
|
131
|
+
touch "$MARKER"
|
|
132
|
+
|
|
133
|
+
migrate:
|
|
134
|
+
command: pnpm db:migrate
|
|
135
|
+
needs: [install]
|
|
136
|
+
|
|
137
|
+
services:
|
|
138
|
+
postgres:
|
|
139
|
+
command: postgres -D /var/lib/postgresql/data
|
|
140
|
+
ready_when:
|
|
141
|
+
port: 5432
|
|
142
|
+
restart: always
|
|
143
|
+
|
|
144
|
+
dev:
|
|
145
|
+
command: pnpm dev
|
|
146
|
+
needs: [install, migrate, postgres]
|
|
147
|
+
ready_when:
|
|
148
|
+
port: 3000
|
|
149
|
+
timeout_ms: 120000
|
|
150
|
+
expose:
|
|
151
|
+
port: 3000
|
|
152
|
+
as: 80
|
|
153
|
+
restart: on-failure
|
|
154
|
+
backoff:
|
|
155
|
+
initial_ms: 500
|
|
156
|
+
max_ms: 5000
|
|
157
|
+
factor: 2
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## 7. Validate before handing off
|
|
161
|
+
|
|
162
|
+
- check with `agentbox-ctl reload` and then `agentbox-ctl status` that everything is running as expected.
|
|
163
|
+
- Every name in `needs:` must reference an existing task or service.
|
|
164
|
+
- A service with `restart: never` and an autostart dependency will block the dependent forever after one failed run — usually a mistake.
|
|
165
|
+
- `command:` is either a shell string (run via `bash -c`) or an argv array. Use the argv form if you need to avoid shell quoting.
|
|
166
|
+
|
|
167
|
+
## 8. Checkpoint the warm state (do this at the very end)
|
|
168
|
+
|
|
169
|
+
Checkpoint (snapshot) this box writable layer: once the box is warmed up (deps installed, services ready), checkpoint it with `agentbox-ctl checkpoint --name setup --replace --set-default` so future boxes start ready.
|
|
170
|
+
Run this command exactly once. The `--name setup --replace` makes it idempotent — if it ever needs to run again it overwrites the existing `setup` checkpoint instead of stacking duplicates.
|
|
171
|
+
This doesn't need to be confirmed by the user.
|
|
172
|
+
It will pause the container for several seconds so warn the user about it and write Done when it's done.
|
|
173
|
+
|
|
174
|
+
## 9. Hand-off
|
|
175
|
+
|
|
176
|
+
Tell the user (verbatim):
|
|
177
|
+
|
|
178
|
+
```
|
|
179
|
+
█████╗ ██████╗ ███████╗███╗ ██╗████████╗██████╗ ██████╗ ██╗ ██╗
|
|
180
|
+
██╔══██╗██╔════╝ ██╔════╝████╗ ██║╚══██╔══╝██╔══██╗██╔═══██╗╚██╗██╔╝
|
|
181
|
+
███████║██║ ███╗█████╗ ██╔██╗ ██║ ██║ ██████╔╝██║ ██║ ╚███╔╝
|
|
182
|
+
██╔══██║██║ ██║██╔══╝ ██║╚██╗██║ ██║ ██╔══██╗██║ ██║ ██╔██╗
|
|
183
|
+
██║ ██║╚██████╔╝███████╗██║ ╚████║ ██║ ██████╔╝╚██████╔╝██╔╝ ██╗
|
|
184
|
+
╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═══╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
your box is ready, you can start more sessions with `agentbox claude`
|
|
188
|
+
you can access the web app at https://<boxname>.localhost
|
|
189
|
+
|
|
190
|
+
## 10. Known issues
|
|
191
|
+
|
|
192
|
+
- For Nextjs/Vite/Tasnstack projects, makes sure to forward also websocket for hot reload.
|
|
193
|
+
|
|
194
|
+
- 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.
|
|
195
|
+
|
|
196
|
+
- The `install` task is intentionally a no-op once `node_modules/.agentbox-installed` exists. Do **not** remove the marker guard to "force a fresh install" — that reinstalls on every box start. To force a one-off rebuild, delete `node_modules` (or just the marker) then run `agentbox-ctl reload`.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Start the per-box VNC stack: Xvnc on :1 (loopback inside container) +
|
|
3
|
+
# websockify on 0.0.0.0:6080 serving noVNC's HTML5 client and proxying RFB.
|
|
4
|
+
# Launched by the host via `docker exec -d --user vscode` after the container
|
|
5
|
+
# is up. Idempotent — re-running while the daemons are alive is a no-op, so
|
|
6
|
+
# `agentbox start` can blindly call us again.
|
|
7
|
+
|
|
8
|
+
set -euo pipefail
|
|
9
|
+
|
|
10
|
+
PASS="${AGENTBOX_VNC_PASSWORD:-}"
|
|
11
|
+
if [[ -z "$PASS" ]]; then
|
|
12
|
+
echo "agentbox-vnc-start: AGENTBOX_VNC_PASSWORD is not set" >&2
|
|
13
|
+
exit 64
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
if pgrep -u "$(id -u)" -x Xvnc >/dev/null \
|
|
17
|
+
&& pgrep -u "$(id -u)" -f "websockify.*6080" >/dev/null; then
|
|
18
|
+
exit 0
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
mkdir -p "$HOME/.vnc"
|
|
22
|
+
# vncpasswd's -f mode reads plaintext on stdin, writes the DES blob to stdout.
|
|
23
|
+
# VncAuth truncates >8 chars at compare time, which is fine — the host writes
|
|
24
|
+
# an 8-char password. Write to a temp file + rename so a failure (e.g.,
|
|
25
|
+
# vncpasswd missing) doesn't leave an empty file that Xvnc would then reject.
|
|
26
|
+
TMP_PASSWD="$(mktemp "$HOME/.vnc/passwd.XXXXXX")"
|
|
27
|
+
printf '%s\n' "$PASS" | vncpasswd -f > "$TMP_PASSWD"
|
|
28
|
+
chmod 600 "$TMP_PASSWD"
|
|
29
|
+
mv "$TMP_PASSWD" "$HOME/.vnc/passwd"
|
|
30
|
+
|
|
31
|
+
mkdir -p /var/log/agentbox 2>/dev/null || true
|
|
32
|
+
|
|
33
|
+
# Xvnc on display :1, loopback-only (websockify is the only public ingress).
|
|
34
|
+
# 1280x800x24 is a sensible laptop-browser viewport.
|
|
35
|
+
# The clipboard params are on-by-default in TigerVNC 1.13 but pinned here so a
|
|
36
|
+
# base-image bump can't silently break host->box paste, and to document intent:
|
|
37
|
+
# accept cut-text from noVNC, set both the X CLIPBOARD and PRIMARY selections.
|
|
38
|
+
Xvnc :1 \
|
|
39
|
+
-localhost \
|
|
40
|
+
-SecurityTypes VncAuth \
|
|
41
|
+
-PasswordFile "$HOME/.vnc/passwd" \
|
|
42
|
+
-geometry 1280x800 \
|
|
43
|
+
-depth 24 \
|
|
44
|
+
-AlwaysShared \
|
|
45
|
+
-AcceptCutText=1 \
|
|
46
|
+
-SendCutText=1 \
|
|
47
|
+
-SetPrimary=1 \
|
|
48
|
+
-SendPrimary=1 \
|
|
49
|
+
>/var/log/agentbox/xvnc.log 2>&1 &
|
|
50
|
+
|
|
51
|
+
# Wait for Xvnc's RFB socket (5901). bash's /dev/tcp pseudo-device makes the
|
|
52
|
+
# probe a one-liner without needing netcat in the image.
|
|
53
|
+
for _ in $(seq 1 50); do
|
|
54
|
+
if (echo > /dev/tcp/127.0.0.1/5901) 2>/dev/null; then break; fi
|
|
55
|
+
sleep 0.1
|
|
56
|
+
done
|
|
57
|
+
|
|
58
|
+
# With no window manager, nothing owns the X selections, so Xvnc's RFB cut-text
|
|
59
|
+
# isn't reliably handed to Chromium on Ctrl+V. autocutsel (one daemon per
|
|
60
|
+
# selection) keeps CLIPBOARD and PRIMARY populated and synced. Best-effort: a
|
|
61
|
+
# clipboard failure must never abort VNC, and the pgrep guard keeps a stray
|
|
62
|
+
# re-entry from spawning duplicates (Xvnc is up now, so DISPLAY=:1 resolves).
|
|
63
|
+
if ! pgrep -u "$(id -u)" -x autocutsel >/dev/null; then
|
|
64
|
+
DISPLAY=:1 autocutsel -selection CLIPBOARD -fork >/dev/null 2>&1 || true
|
|
65
|
+
DISPLAY=:1 autocutsel -selection PRIMARY -fork >/dev/null 2>&1 || true
|
|
66
|
+
fi
|
|
67
|
+
|
|
68
|
+
# websockify serves noVNC at /vnc.html (--web) and tunnels WS frames to Xvnc's
|
|
69
|
+
# RFB. Bind 0.0.0.0:6080 so both Docker `-p` mappings and OrbStack's
|
|
70
|
+
# <name>.orb.local routing reach it.
|
|
71
|
+
websockify \
|
|
72
|
+
--web=/usr/share/novnc \
|
|
73
|
+
0.0.0.0:6080 \
|
|
74
|
+
127.0.0.1:5901 \
|
|
75
|
+
>/var/log/agentbox/websockify.log 2>&1 &
|
|
76
|
+
|
|
77
|
+
disown -a
|
|
@@ -0,0 +1,54 @@
|
|
|
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.",
|
|
3
|
+
"hooks": {
|
|
4
|
+
"UserPromptSubmit": [
|
|
5
|
+
{
|
|
6
|
+
"hooks": [
|
|
7
|
+
{ "type": "command", "command": "agentbox-ctl claude-state working >/dev/null 2>&1 &", "timeout": 3 }
|
|
8
|
+
]
|
|
9
|
+
}
|
|
10
|
+
],
|
|
11
|
+
"PreToolUse": [
|
|
12
|
+
{
|
|
13
|
+
"hooks": [
|
|
14
|
+
{ "type": "command", "command": "agentbox-ctl claude-state working >/dev/null 2>&1 &", "timeout": 3 }
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"Stop": [
|
|
19
|
+
{
|
|
20
|
+
"hooks": [
|
|
21
|
+
{ "type": "command", "command": "agentbox-ctl claude-state idle >/dev/null 2>&1 &", "timeout": 3 }
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"Notification": [
|
|
26
|
+
{
|
|
27
|
+
"matcher": "permission_prompt",
|
|
28
|
+
"hooks": [
|
|
29
|
+
{ "type": "command", "command": "agentbox-ctl claude-state waiting >/dev/null 2>&1 &", "timeout": 3 }
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"matcher": "idle_prompt",
|
|
34
|
+
"hooks": [
|
|
35
|
+
{ "type": "command", "command": "agentbox-ctl claude-state idle >/dev/null 2>&1 &", "timeout": 3 }
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"SessionStart": [
|
|
40
|
+
{
|
|
41
|
+
"hooks": [
|
|
42
|
+
{ "type": "command", "command": "agentbox-ctl claude-state idle >/dev/null 2>&1 &", "timeout": 3 }
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"SessionEnd": [
|
|
47
|
+
{
|
|
48
|
+
"hooks": [
|
|
49
|
+
{ "type": "command", "command": "agentbox-ctl claude-state idle >/dev/null 2>&1 &", "timeout": 3 }
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
}
|