27 Commits
Author SHA1 Message Date
jackos1998andClaude Opus 5.5 70a42f6a21 nix: Add the commit to the version
CI / Check (pull_request) Successful in 5m45s
CI / Check (push) Successful in 5m42s
Builds from the flake show the commit they are from in the version,
like `0.3.0+2d59b59`, or `0.3.0+2d59b59-dirty` with uncommitted
changes. It shows in the web app, in `--version`, which `slop` and
`slop-broker` now take, and in the error for an old protocol.

The commit is part of the build, so every commit rebuilds the package.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 18:29:17 +00:00
jackos1998andClaude Opus 5.5 76eb39fb7e demo: Add a binary cache for slop build
The box VM holds the cache's store in a `cache` account, set up by
`services.slop-broker-cache`, and the demo's broker pushes to it, so
`slop build` can be tried by hand. The broker's key is only known at
boot, so the module exposes its forced command for keys it can't list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 13:27:48 +00:00
jackos1998andClaude Opus 5.5 3f024cd115 demo: Move the host side out of devenv.nix
The demo's host side is a devenv module of its own,
`nix/demo/host.nix`, which `devenv.nix` imports, so `devenv.nix` is
only the development environment. The VMs' settings are grouped with
comments, and the longer scripts are broken into steps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 13:27:48 +00:00
jackos1998andClaude Opus 5.5 50ec4833c1 test: Push a build to a binary cache
`box` also holds a binary cache's store through
`services.slop-broker-cache`, and the agent builds the profile into it
with `slop build`, which no test covered. The test checks the printed
path, the closure in the cache's store and its GC root. The audit
check now reads more than the default 50 records, which the extra
requests outgrew.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 13:27:48 +00:00
jackos1998andClaude Opus 5.5 c33a28c8b8 test: Deploy a built profile to a second box
The test repository gets two commits of a profile the builder can
build from a static busybox, without nixpkgs, whose `activate-rs`
leaves a mark, and a second VM, `box`, as a node with a store of its
own. The test deploys to `box` and the broker's own box at once, whose
profiles are the same derivation, then the second commit to `box`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 13:27:48 +00:00
jackos1998andClaude Opus 5.5 d157ff278a test: Tidy the VM test
The test script gets helpers for running `slop` as the agent and
`slop-approve` as the reviewer, and headings for what each part
checks. The settings of `machine` are grouped with comments, its
`deploy` account in a module of its own, for the deploy nodes that
come next.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 13:18:46 +00:00
jackos1998andClaude Opus 5.5 5b7db9eaf9 broker: Copy from the builder's store
CI / Check (pull_request) Successful in 5m10s
CI / Check (push) Successful in 5m15s
The broker read what the builder built from its own store, which only
works while they share a box. Read it from the builder's store
instead, which also works when they do.

- Deploys and `slop build` copy `--from ssh-ng://` the builder's user,
  and closure sizes are read there.
- The builder key's forced command serves `nix-daemon --stdio` for it.
- The store URL carries the builder's port and the broker's key: one
  `NIX_SSHOPTS` serves both ends of a copy, and Nix puts the URL's
  `-p` after it. So the builder's SSH options can only set a port.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 18:04:36 +00:00
jackos1998andClaude Opus 5.5 4b2c32636e broker: Containers as targets
CI / Check (pull_request) Successful in 5m17s
CI / Check (push) Canceled after 0s
`slop status`, `logs`, `failed` and `ssh` take `node.container-<name>`,
the name `slop deploy` already takes, so agents can check a container
without asking for `slop ssh` on its host.

- The builder evaluates each node's profile names; its
  `container-<name>` profiles are the containers requests can name.
- Commands run on the node as root through its `sudo`:
  `systemctl --machine`, `journalctl --machine` and, for `ssh`,
  `systemd-run --machine --pipe --wait` with `/bin/sh -l`.
- A container's scope is its node as `target` plus `container`, so
  node rules apply to it while leases stay per target. Rules can
  match `container`.
- Remote commands are now quoted so `fish` reads them as POSIX shells
  do: it treats `\\` and `\'` as escapes inside single quotes.

`PROTOCOL_VERSION` 3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 17:28:57 +00:00
jackos1998 e59d5d377e release: Derive the Nix version from Cargo
CI / Check (pull_request) Successful in 4m43s
CI / Check (push) Successful in 5m43s
2026-11-26 21:48:34 +00:00
jackos1998andClaude Opus 5.5 ebf22a932d deploy: Finish activations whose connection drops
CI / Check (pull_request) Successful in 5m1s
CI / Check (push) Successful in 4m55s
Activation runs in a transient unit, but its output still went
straight back over the connection, and `activate-rs` panics when a
write fails. Deploying `palace` and `slop-cannon` together stopped
the broker, which dropped the connection to `slop-cannon` and left
its switch half done. The output now goes through a `cat` that gives
way to one discarding it once the connection is gone.

Switching also no longer restarts the broker, so it can deploy its
own box and report the result; a new version or configuration takes
effect at the next restart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 09:47:32 +00:00
jackos1998andClaude Opus 5.5 2df7cd3dee ssh: Show approvers the stdin a command runs with
CI / Check (pull_request) Successful in 5m14s
CI / Check (push) Successful in 5m15s
`slop ssh` forwarded stdin only after approval, so a script piped to
`bash -s` reached the box without an approver or the audit log ever
seeing it. `slop` now reads all of stdin (unless it's a terminal)
and sends it with the request. Approvers see it in full, the audit
log keeps it, and the command gets exactly those bytes. Stdin that
isn't UTF-8, or a command and stdin too long to show whole, is
refused.

The command is shown as the line the remote shell runs (the words
joined with spaces, as `ssh` sends them) rather than shell-quoted,
which suggested quoting the remote shell never sees; multi-line
commands are shown as text.

`Operation::Ssh` gains `stdin`, so the protocol version goes to 2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 00:51:12 +00:00
jackos1998andClaude Opus 5.5 21c2d4715e policy: Type operation names and the fields rules match
CI / Check (push) Successful in 4m58s
Policies were keyed by any string, and rules could match any field, so
a mistyped operation was silently denied and a mistyped field never
matched. `OpName` names the operations and the scope fields their rules
can match; the broker refuses anything else when loading its config,
and the module's typed `ops` and `match` options refuse it first, at
evaluation. The design doc shows a policy's per-operation settings and
each operation's fields.

`Parsed::new` fills in the defaults, so each operation sets only what
it uses; what's found before approval moves to `Parsed::prepared`, and
whether an operation is built in follows from its name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 23:38:08 +00:00
jackos1998andClaude Opus 5.5 e622fe7708 deploy: Move the comparison script into its own file
A file of its own reads as a script, says what its output looks like
and is checked by a new `shellcheck` lint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 23:38:08 +00:00
jackos1998andClaude Opus 5.5 d25224c491 demo: Log the agent in on the serial console only
The agents' VM also logged `agent` in on `tty1`, which nobody sees,
and both login shells cloned the repository into `~/repo` at once.
One could remove the directory while the other was still copying Git's
hook templates into it, which failed with "cannot copy ... No such
file or directory".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 23:38:08 +00:00
jackos1998andClaude Opus 5.5 6933750dc5 ssh: Find deploy targets on the main branch
SSH targets are the deploy-rs nodes on the main branch, so adding a box
takes a commit there rather than a new broker config, and a target
can't drift from its node. The builder evaluates the branch's `deploy`
output (hostname, SSH user and options, `sudo`), cached per commit, and
the broker looks it up again when stale or when a request names a node
it doesn't know. Only the protected branch's Nix is evaluated, as for
secrets. SSH therefore needs `deploy`.

The VM test gets a real builder and a repository with the nodes, and
the demo's targets move into its repository's flake.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 23:38:08 +00:00
jackos1998andClaude Opus 5.5 2af7c55a17 ha: Remove Home Assistant notifications
CI / Check (push) Successful in 4m56s
The web app's Web Push notifications replace them: they are encrypted
end to end, and the page holds every pending request, so a dismissed
notification loses nothing. Drops `src/ha.rs`, the
`services.slop-broker.homeAssistant` options and `tokio-tungstenite`.
A config that still has `home_assistant` is refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 08:39:53 +00:00
jackos1998andClaude Opus 5.5 9d54664f5c demo: Deploy to the box VM
The demo repository's flake gets a deploy-rs node, `box`, with a small
custom profile whose activation writes its version, using nixpkgs'
deploy-rs so builds are quick, and its nixpkgs locked to this
repository's. The box VM lets `box` use `sudo` and copy unsigned
paths, and the broker's policy covers the builder and deploys, so a
pushed branch can be deployed and its package changes approved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 02:01:35 +00:00
jackos1998andClaude Opus 5.5 ddee51d092 demo: Add a repository, a builder and secrets
`devenv up` seeds a bare repository with an agenix rules file and two
secrets, encrypted to the demo person and the broker; a pre-receive
hook protects `master`, and `demo-merge` moves it. The agents' VM
clones it over a QEMU guestfwd to `git daemon`, and the broker reaches
`slop-broker builder` through an `ssh` wrapper, so secret requests
work as in a real deployment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 01:42:48 +00:00
jackos1998andClaude Opus 5.5 005e3d32df ops: Add age secrets
`slop secret keys|set|generate|rekey|read` work with an agenix secret
in the requester's checkout: it sends the ciphertext, and the broker
decrypts it with its own age identity and returns new ciphertext.
Field edits work on env and JSON secrets.

The path and recipients are the requester's, so before approval the
builder reads the protected main branch: it looks the ciphertext's
blob up there, so approvers see which file it really is, and
evaluates that branch's rules file to compare the recipients.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 00:56:17 +00:00
jackos1998andClaude Opus 5.5 538a288182 ci: Add a Gitea Actions workflow
CI / Check (push) Successful in 4m44s
Every push runs `nix flake check`: the package with its tests, new
`clippy` (warnings as errors) and `fmt` checks, and the VM test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 00:39:37 +00:00
jackos1998andClaude Opus 5.5 313c028ad9 nix: Add a demo
A setup for trying the broker by hand, laid out like a deployment.
`devenv up` runs the broker from the checkout with its web app, Pocket
ID for approvers to sign in with, and a box VM for the SSH targets; a
setup task creates the approver, their group and the broker's OIDC
client through Pocket ID's API. `demo` boots the agents' VM on the
terminal, which reaches the broker only over vsock.

Approvers use `slop-approve` in the devenv shell, or the web app after
signing in with a link from `demo-sign-in`, so passkey approvals can
be tried without deploying anything.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 00:39:36 +00:00
jackos1998andClaude Opus 5.5 076f4959d9 web: Add approvals web app
A web app lists pending requests with full detail, leases and the
audit log grouped by request, and sends Web Push notifications that can
answer requests. Approvers sign in through an OpenID Connect provider;
policy can require a fresh passkey (`confirm = "passkey"`) to approve,
which only the web app can then give.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 00:39:36 +00:00
jackos1998andClaude Opus 5.5 eeaf22a7b5 ops: Add builds
`slop build <attr>…` builds flake attributes of a pushed commit on the
builder and, once approved, copies them to a binary cache's store and
roots them there. `services.slop-broker-cache` gives the cache store
owner's key a forced command that only allows the store protocol and
GC roots, and expires the roots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 00:39:35 +00:00
jackos1998andClaude Opus 5.5 6305228e7e ops: Add deploys
`slop deploy <node>…` builds a pushed commit and, once approved,
activates it on every target at once. A builder, reached over SSH as
a user that only holds a read-only Git key, fetches the commit from
the Git server and evaluates and builds the deploy-rs profiles, so
agent-written Nix never runs in the broker. Before asking, the broker
copies the closures to the nodes and compares them there with a fixed
read-only script: package changes from `nix store diff-closures`, and
changed units and `/etc` files from the two `etc` trees.

Once approved, `activate-rs` runs on each node in a transient unit,
so it finishes even if the connection drops or the broker restarts.
Policy rules see one scope per target, and the strictest answer
applies. `services.slop-broker-builder` sets up the builder on any box.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 00:39:35 +00:00
jackos1998andClaude Opus 5.5 73deb0efb8 remote: Add SSH transport
Requesters and approvers on other boxes log in to the broker's box as
`slop`. Each key has a forced `slop-broker remote <role> <name>`, which
joins the session to the broker through a socket only `slop` can open,
so the broker trusts the name like it trusts a vsock CID. A key does
one job: the module refuses a key used for both roles.

`slop` and `slop-approve` take `ssh:<destination>` addresses, from
`SLOP_BROKER` and `SLOP_APPROVE` or else `~/.config/slop/config.toml`,
and an approver connection now carries many requests. The
`programs.slop` home-manager module installs both clients, a `Host`
entry per key and that config file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 00:39:35 +00:00
jackos1998andClaude Opus 5.5 d71bbb04db ops: Add box queries
`slop status`, `slop logs` and `slop failed` run fixed read-only
commands that the broker builds and quotes from validated values, so a
policy can let them run without asking.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 00:39:35 +00:00
jackos1998andClaude Opus 5.5 67b11b0c61 broker: Add approval broker for coding agents
`slop-broker` runs privileged operations for coding agents under named
policies (auto, ask or deny per operation), which requesters can share,
with approvals from `slop-approve` or Home Assistant notifications and
optional leases. The broker and the `slop` client talk over vsock, so
a VM needs no network path to it. Messages are typed enums shared by
both, CBOR-encoded and framed with `LengthDelimitedCodec`; decoding
validates every value, and requests carry a protocol version.

The first operation is `slop ssh`. The `services.slop-broker` NixOS
module runs the broker as a hardened service from generated TOML, and
a VM test exercises it over vsock loopback. devenv provides the
development environment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 00:39:36 +00:00