13 Commits
Author SHA1 Message Date
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 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
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 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 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 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 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 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