authoravatarclover caruso<git@paperclover.net>2026-10-23 15:02:06-07:00
committeravatarclover caruso<git@paperclover.net>2026-10-24 19:01:23-07:00
log1df9a8f395115e6c9d25e0df369674e7b542f4d9
treec996f5113ea0b1b02764ee17dcd93e2d92014d0c
parenteeb6ec5089743d764d55bf4ba8769701afa235a3
signature Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU

Give Knife agents browsers, KVM, and restart-safe deploys

Chromium, Xvfb, fonts, Clang/LLD and desktop build libraries come with the image. Podman's seccomp filter blocks the chroot Chromium-based sandboxes use, so Chromium, Electron and T3's browser run unsandboxed inside the container. /dev/kvm is passed through for emulators. Restarting the container stops every running agent, so deploys leave it running and changes wait for a manual restart. Assisted-by: claude-opus-5.5

3 files changed, 36 insertions(+), 13 deletions(-)

nixos/knife-linux.Containerfile+12-7
......@@ -1,15 +1,20 @@
11FROM registry.fedoraproject.org/fedora:44@sha256:0d2a354dfdf7ba75083fe371eb6239842fe13f38c52d339dae1ebcf13c7c4062
22
3# Development tools, plus the libraries and fonts T3's headless Chrome needs.
3# Development tools, plus Chromium, Xvfb and fonts for headless browser and Electron checks.
44RUN dnf -y install --setopt=install_weak_deps=False \
5 bzip2 cargo cmake diffutils fd-find file findutils gcc gcc-c++ git hostname iproute jq less \
6 lsof make neovim openssh-clients openssl-devel patch procps-ng python3 ripgrep rsync rust tar \
7 time tree unzip which xz zip zlib-ng-compat-devel zsh \
8 alsa-lib at-spi2-atk at-spi2-core atk dbus-libs expat fontconfig glib2 libX11 libXcomposite \
9 libXdamage libXext libXfixes libXrandr libxcb libxkbcommon liberation-mono-fonts \
10 liberation-sans-fonts liberation-serif-fonts mesa-libgbm nss \
5 bzip2 cargo clang cmake diffutils fd-find file findutils gcc gcc-c++ git glibc-gconv-extra \
6 hostname ImageMagick iproute jq less libsecret-devel libxcrypt-compat lld lsof make neovim \
7 openssh-clients openssl-devel patch procps-ng python3 ripgrep rsync rust tar time tree unzip \
8 which xz zip zlib-ng-compat-devel zsh \
9 chromium fontconfig google-noto-sans-fonts google-noto-sans-mono-fonts google-noto-serif-fonts \
10 liberation-mono-fonts liberation-sans-fonts liberation-serif-fonts mesa-dri-drivers \
11 xorg-x11-server-Xvfb \
1112 && dnf clean all
1213
14# The container is the sandbox: its seccomp filter blocks the chroot Chromium-based sandboxes need.
15RUN printf '\nCHROMIUM_FLAGS+=" --no-sandbox"\n' >> /etc/chromium/chromium.conf
16ENV ELECTRON_DISABLE_SANDBOX=1 T3CODE_SERVER_BROWSER_SANDBOX=0
17
1318RUN curl -fsSLo /tmp/node.tar.xz https://nodejs.org/dist/v26.12.1/node-v26.12.1-linux-x64.tar.xz \
1419 && echo "6170b2d474e1c626f43cff3adc118df9fe3b573258a4fc3d850c8dbc6b079bbd /tmp/node.tar.xz" | sha256sum -c \
1520 && mkdir -p /opt/node/26.12.1 \
nixos/knife-linux.nix+3
......@@ -25,6 +25,8 @@ in
2525 wants = [ "network-online.target" ];
2626 after = [ "network-online.target" "mac-studio-sandbox.service" ];
2727 requires = [ "mac-studio-sandbox.service" ];
28 # Restarting stops every running agent, so changes wait for a manual restart.
29 restartIfChanged = false;
2830 serviceConfig = {
2931 Type = "notify";
3032 NotifyAccess = "all";
......@@ -40,6 +42,7 @@ in
4042 "--volume=${root}/home:/home/clo"
4143 "--volume=${sandbox}:/Volumes/Code"
4244 "--volume=/opt/studio-project-store/current/bin/jj-real:/usr/local/bin/jj:ro"
45 "--device=/dev/kvm"
4346 "localhost/knife-linux"
4447 ];
4548 ExecStop = "${run} stop --ignore --time=90 knife-linux";
tools/knife-linux.md+21-6
......@@ -4,10 +4,18 @@
44agents directly beside ZFS. [knife-linux.nix](../nixos/knife-linux.nix) builds it
55from [knife-linux.Containerfile](../nixos/knife-linux.Containerfile) on each start
66and runs it as the `knife-linux` system service: uid 3000 (`clo`), no
7capabilities, 12 CPUs, a 32 GiB memory limit, and Podman's NAT network. Knife
8listens on container loopback port 3773; devices reach it through the mesh as
9`snowglobe` (device `4b85ee48…`). User namespaces work inside, so Chrome's
10sandbox and agent sandboxes run unprivileged.
7capabilities, 12 CPUs, a 32 GiB memory limit, `/dev/kvm`, and Podman's NAT network.
8Knife listens on container loopback port 3773; devices reach it through the mesh
9as `snowglobe` (device `4b85ee48…`). User namespaces work inside, but Podman's
10seccomp filter blocks the `chroot` Chromium-based sandboxes need, so Chromium,
11Electron, and T3's browser run with their own sandbox off inside the container.
12
13Deploys never restart the container: restarting stops Knife and every running
14agent. Image and unit changes apply at the next manual
15`systemctl restart knife-linux`; packages installed live with
16`knife-linux-podman exec --user root --privileged knife-linux dnf install …`
17last only until then, so add them to the Containerfile too. Devices cannot be
18added to the running container.
1119
1220| Container path | Host source |
1321| --- | --- |
......@@ -42,6 +50,13 @@ recovery archives are kept privately on the owner's Mac at
4250at `Knife Recovery/20261023`. Each copy was restored into an isolated container
4351with networking disabled, checking the application, databases, and identity keys.
4452
53`~/computer.py` is a copy of [computer.py](computer.py), a standard-library client
54for scripting VMs through the Computer MCP; its connection lives in
55`~/.config/computer-mcp`. [computer-client-test.py](computer-client-test.py)
56runs it against a local dashboard with a stub host. Git pushes to Shale use a
57personal access token from Clover's Shale settings, kept by git's credential
58store in `~/.git-credentials`.
59
4560## Runtime and updates
4661
4762The active runtime is `~/.local/share/knife-server/current`, pointing to
......@@ -70,8 +85,8 @@ After the server build, stage `libknife_mesh_node.so` as
7085`apps/server/dist/knife-mesh/linux-x64/knife_mesh.node` and the resource monitor as
7186`apps/server/dist/resource-monitor/linux-x64/t3-resource-monitor`. Stage the font
7287assets in `apps/server/dist/client/fonts` and link `node` in the runtime root to
73`/opt/node/26.12.1/bin/node`. Switch `current` and `systemctl restart knife-linux`
74only when idle. Automatic fork updates are not configured for this source build.
88`/opt/node/26.12.1/bin/node`. Switch `current` and restart only when agents are
89idle. Automatic fork updates are not configured for this source build.
7590
7691## Agent homes
7792