Summary #
The App connects to the Daemon over a WebSocket on 127.0.0.1, sends the Daemon's token, gets a snapshot, then events.
protocol/
├── index.ts # snapshot, events, address file, token header
└── scripted.ts # control channel of the scripted Daemon (App tests)
daemon/
├── src/
│ ├── main.ts # node src/main.ts: address file, SQLite file, start
│ ├── daemon.ts # startDaemon: harness host + server
│ ├── harness-host.ts # the only module that imports Pi Durable 1.6.0
│ ├── server.ts # WebSocket server, token check, snapshot then events
│ └── github.ts # GitHub gateway (gh), not used yet
└── test/
├── harness.ts # Daemon test harness: real Daemon, throwaway SQLite, scripted pi-ai model, fake GitHub
├── scripted-daemon.ts + app-tests.ts # runs nsh test in app/ against a scripted Daemon
└── *.test.ts
justfile # just dev: Daemon + App; just test; just check
app/
├── Shell.tsx # top bar: Home, Inbox, Missions, Repos, Settings; back, forward; keys
├── pages.tsx # each place with its loading, empty and error states
└── daemon.ts # the App's link to the Daemon
Also: the App's id is now com.babariviere.pilot, and app/nsh.json declares its capabilities.
Development never touches the Owner's data. PILOT_PROFILE=dev gives the App and the Daemon their own folder (com.babariviere.pilot.dev) and port (47111). Every just recipe sets it.
New guardrails:
.tangled/workflows/ci.ymlruns on every pull request tomain.daemonruns the lint, type check and Daemon tests.apprunsjust checkand the App tests headless on Linux.just lint(scripts/lint.sh, part ofjust check) finds window widths outsideui/look.ts, hand-styled page titles, andnsh/basecontrols in screens.just live-checkruns the real App in a macOS window against a real development Daemon.
Agent docs: the nsh and nsh-design-guides skills from longbridge/nsh (.agents/skills/, pinned in skills-lock.json), and docs/nsh.md for the NSH traps they do not cover. AGENTS.md points to both.
Evidence #
- Before: the App showed one title and the gallery. There was no Daemon.
After:
npm --prefix daemon test: 5 passed.only the harness host module imports Pi Durable the Daemon refuses a connection without its token (HTTP 401) on connect the App gets a snapshot, then events every App connected gets each event, and an App that connects later starts with a snapshot the Daemon runs on its SQLite file and starts again on it after a restartnpm --prefix daemon run test:app: 24 passed. 8 are new shell tests: empty states, events, the Daemon's error on every page, Try again, the retry on its own, a stuck Daemon that never sends a snapshot, a wrong token, and the Inbox count. - A real App window (
nsh test --target macos) connected to a real Daemon and showed "Nothing waits for you". just live-checkpassed. CI pipeline3n334za6uvb22passed both workflows (24 App tests on Linux).
Merge Danger #
Door: two-way
The protocol and the address file are new. Nothing depends on them yet.
Blast Radius: tests
A plain cd app && nsh test now fails the shell tests, because no scripted Daemon runs. Use npm --prefix daemon run test:app. The gallery's pictures now need cd app && nsh test App.test.tsx --target web.