Get in the mix — no viewer required
The viewer is one consumer of the server’s API. You are about to be another. Everything the viewer shows arrives through HTTP calls and a websocket feed, and both are open to you from the terminal.
Sign in. Every authenticated call carries a token.
nix run .#loginasks the server for one and writes it to.token:nix run .#login -- <username> <password>Before you run it: What’s your expected error code when using wrong credtentials? Try and compare.
Ask who you are, and where.
nix run .#apisends.tokenwith the request and stores the fresh token each response carries — the server rotates them, and this is how every client stays signed in, the viewer included.nix run .#api -- /api/auth/me | jq '{_id, username}'Take the
_idand ask for your rooms:nix run .#api -- "/api/user/rooms?id=<_id>" | jq .The
_idis the server’s name for you; the room name is where your colony runs. Everything you own on this server is filed under one or the other — the feed you subscribe to in step 3 is keyed by the room name, and the memory you read in step 4 is keyed by your identity. These two calls are how any client gets those keys, the viewer included.Watch the room over the websocket.
room-feed.shdoes the whole dance — sign in, find your room, subscribe to its feed — and prints one JSON snapshot with your spawn’s position and the room’s sources:nix run .#room-feed -- <user> <pass>From the coordinates alone: which source is closer to your spawn? Hold that answer — “Picking a source” comes back to it.
Then read the script; it is short. Find the three moves the viewer also makes when the page loads: auth, subscribe, first snapshot.
Read your creep’s diary. The harness logs each creep’s actions to
Memory.trace, and the memory API serves it:nix run .#api -- '/api/user/memory?path=trace'How many harvest entries land between one transfer and the next? That number is the creep’s trip, measured from its own record.
Use your agent to go further: every endpoint the viewer calls is in viewer/src/protocol.ts.