feat(box): the box's NixOS system as a module, and lib.mkBox from a few names
check / check (push) Canceled after 0s

The box within reach of the couch: a Raspberry Pi 3B with the AIY Voice
HAT, from the first household's configuration, made generic.

- box/body: the button service, in Python: press and talk, turns by
  voice, a press interrupts; the look signal
- box/*.js: the ir and look capabilities, behind gates, for the brain;
  the ask client, the box's side of a conversation
- box/module.nix: the services, each confined to the devices and
  addresses it needs; the private network as an option (a tailnet by
  default); the Pico found by its USB IDs, as /dev/pdtv26-ir
- box/voicehat.nix: the Voice HAT's device tree overlay and ALSA setup
- lib.mkBox: a box's whole system from its name, the home server's,
  the Wi-Fi network's, and who looks after it
- checks: box-js, box-py (doctests and pyflakes), and box-system (an
  example box's system evaluates)

Generated-by: Claude Opus 5.5
This commit is contained in:
dckc committed 2026-12-02 16:18:17 -06:00
1 parent 2e7156dc36
commit 521998b666
35 files changed
+2165 -3

No files matched your search

+26 -1
View File
@@ -21,6 +21,29 @@ Agent: Here's the game. It started ten minutes ago.
The game isn't on 4, 5, or 9. It's on a sports network in the hundreds, behind two **Power** buttons, the **Input** button, and the cable box's remote. Our elders have done their share; let the agent do this.
## How it works
The agent has two parts: the box within reach of the couch, with an IR emitter on a cord where the TV can see it, and a home server that runs speech and the brain; the diagram draws those two apart, since they can be.
```
near the couch speech server brain host
┌───────────────┐ hear ──▶ ┌──────────────┐
│ the box │ speak ──▶ │ whisper.cpp │
│ Pi 3B │ │ piper │
│ AIY Voice HAT │ ask ──────────────────────────────▶ ┌──────────────┐
│ button + LED │ │ brain, in │
│ │ ◀──── ir (learn, send) ───────────── │ bwrap, with │
│ │ ◀──── look (one frame) ───────────── │ an MCP chan. │
└───────────────┘ └──────────────┘
└─ USB cord ─▶ Pico IR ──▶ TV, cable box
```
1. A press of the box's [button](box/body/box.py) starts a conversation, and a chime says it's your turn.
2. The box records the clip and, with its [`speech` capability](#capabilities-and-confinement), has the speech server transcribe it (whisper.cpp).
3. The box sends the text to the brain with its `ask` capability.
4. To act, the brain uses its capabilities on the box: [`ir`](box/ir.js) (send a learned code through the Pico) or [`look`](box/look.js) (one still frame from a camera aimed at the TV; the box flashes its LED and taps a sound on every look, so there's no unannounced looking).
5. With the same `speech` capability, the box has the speech server voice the brain's reply (piper), and plays the WAV.
## Capabilities and confinement
An agent in the living room should be able to do what it's for, and no more. A capability is a reference that both names a service and grants the right to use it. Each part holds capabilities for exactly the services it uses. The brain can press IR buttons and take one camera frame, but it can't reach a shell on the box or anyone's files.
@@ -31,7 +54,9 @@ The parts talk over [Cap'n Web](https://github.com/cloudflare/capnweb); [CONTRIB
The agent is built from parts you can buy and solder:
- **The IR emitter:** a Raspberry Pi Pico H with an IR transceiver ([wiring](ir-pico/wiring.md)), on a USB cord, aimed at the equipment.
- **The box:** a Raspberry Pi 3B with a Google AIY Voice Kit v1 (speaker, two mics, the button), running [NixOS](box/module.nix).
- **The IR emitter:** a Raspberry Pi Pico H with an IR transceiver ([wiring](ir-pico/wiring.md)), on a USB cord from the box, aimed at the equipment.
- **The camera:** an RTSP camera on the LAN, aimed at the TV.
## License