Machines
A machine is a computer or server that Hania Code can work on. Your own computer adds itself when you use the hania terminal client. A server that should be available all the time is paired by hand and runs a small background runner. Both are listed under Machines in the console sidebar, under Build.
The connection always goes outward from the machine to Hania, so a machine needs no inbound ports and no public address. A laptop behind a home router works the same as a cloud server.
Computers
Install the terminal client and sign in with an API key. The next time hania starts, it registers the computer with your workspace and it shows up on the Machines page. There is no key to copy and nothing to pair.
A computer is only connected while hania or hania runner is running on it, so seeing it as Offline the rest of the time is normal. Coding conversations started on it can be continued in the console while either one is running there.
To keep coding from the console after you close hania, run hania runner on the computer. It needs no key - it uses the computer's own sign-in. On macOS or Linux, to keep it running after you close the terminal too:
nohup hania runner > ~/.hania/runner.log 2>&1 &
On Windows, the runner stops when you close its window, so keep that window open.
If the computer isn't signed in, hania runner stops straight away and tells you to run hania login.
Servers
Pair a server when you want it reachable without anyone sitting at it.
- Install
haniaon the server, if it isn't there yet:
On a Windows server, in PowerShell:curl -fsSL https://app.hania.ai/install.sh | bashirm https://app.hania.ai/install.ps1 | iex - On the Machines page, use Pair a server and give it a name. Names are unique within your workspace.
- Pairing shows a one-time machine key. Start the background runner with it:
On Windows, in PowerShell:HANIA_CODE_TOKEN=<key> hania runner
On Windows the runner stops when you close its window, so keep that window open. The runner also accepts the key as$env:HANIA_CODE_TOKEN = '<key>'; hania runner--token <key>, but the environment variable is better, because a command-line flag is visible to anyone who can list the server's processes.
hania is not found right after installing, ~/.hania/bin isn't on your PATH yet. The installer doesn't change your shell files, but it prints the two commands that add it. Run those, or use the full path ~/.hania/bin/hania. On Windows, open a new PowerShell window: the installer added hania to your PATH for new windows. See Install.
The machine key starts with hania_mk_. It is only for the runner. It is not the hania_sk_ API key the terminal client signs in with, and the terminal client doesn't take it.
Using a server. Today a server can only be chosen through the API: send a coding turn with the server's machine id and a folder on it, and the conversation keeps working there. See Send a coding turn. The console can continue that conversation, and every turn from there works on the same server and folder, but it can't pick a server for a new one yet.
Running plain hania on a server, instead of hania runner, registers it again as a computer. That is a separate machine from the paired one.
Connection status
A machine that is connected shows as Connected on the Machines page, along with its hostname, operating system and architecture, runner version, and when it was last seen. Those details appear after the first connection. A machine that isn't connected shows as Offline.
The version is the date of the build the runner is using. An older runner shows 0.1.0 until it updates. Runners update themselves after a new build is released: they install it and restart the next time they are idle. On Windows a runner installed with the PowerShell command installs the new build too, but uses it only the next time you start the runner. A hania.exe you downloaded yourself never updates; run the install command once to switch to one that does.
For a computer, being offline just means nobody is running hania or hania runner on it. A server is meant to stay connected, so the console's alerts flag a paired server that goes offline. Coding on a server fails until its runner is started again.
Expiry
A machine that hasn't been used for 30 days expires and shows as Expired. The Machines page shows the date each machine will expire if it stays unused. An expired machine can't connect, and it doesn't count toward your plan's machine limit. A machine that stays connected never expires.
- A computer comes back on its own, as the same machine, the next time
haniaorhania runnerstarts on it. - A server comes back when you rotate its key on the Machines page and restart
hania runnerwith the new key. That gives it another 30 days, and it keeps its machine id.
When a runner's key is refused, the runner says so in its log: "machine key not accepted (signed out, revoked, rotated, or unused for 30 days): for a server, rotate its key in the console (Machines → Rotate) and restart hania runner with the new key".
Rotate a key
Use Rotate key on a machine to replace its key. The old key stops working immediately, and the new one is shown once, the same as at pairing. A server shows as Offline until its runner is restarted with the new key. Rotate when a key may have leaked, or when you lost one and need a fresh copy; there is no need to remove and pair the server again. Rotating an expired machine also brings it back, as long as your plan has room for it.
Rotating a computer's key does no harm. A hania runner on that computer picks up the new key by itself. An open hania window keeps using the old key until you restart it, then registers again and gets the same machine back.
Remove a machine
Removal is two steps, so a revoked machine stays visible until you clear it out:
- Revoke - the key stops working immediately and any live connection is dropped. The row stays in the list, marked Revoked.
- Remove - on an already revoked machine, this deletes the row and frees the name for pairing again.
Plan limits
Every active machine counts toward your plan's machine limit, whether it's a computer that registered itself or a server you paired. Expired and revoked machines don't count. Free includes no machines, so on Free your computer can't register and a server can't be paired; the paid plans have no machine limit today. You can still chat with hania on Free, but the agent can't work on your files or run commands. See Plans & usage.
The limit is checked when a new machine is added, when an expired, revoked, or signed-out computer comes back through hania or hania runner, and when you rotate the key of an expired machine. It isn't checked when a computer you're already using simply starts hania again.