Skip to main content

Module tower_peers

Module tower_peers 

Source
Expand description

Other AgentMux computers on the LAN in Tower (SPEC_TOWER_TASK_MANAGER_PANE_2026_10_08.md §8.3): this computer pairs as a viewer device of the other one, the way a phone does, and reads its processes from the viewer listener.

  • Pairing: the other computer’s pairing link (agentmux://pair?…, its “Pair a device” panel) carries its address, viewer port, certificate fingerprint and a one-time code. pair redeems the code for a viewer token over TLS pinned to that fingerprint (viewer::client).
  • What is kept: the peer’s address, port and fingerprint in tower-peers.json in the data directory; the token in the secret store (the OS keychain), never in the file.
  • Reading: GET /agentmux/viewer/procs with the token. The other computer answers only if its user turned sharing on, and its user can revoke this device from their paired-device list.
  • A moved peer: the fingerprint, not the address, is what is trusted, so when the stored address doesn’t answer, the address LAN discovery now has for that hostname is tried, and kept if it answers.

Structs§

Link
What a pairing link says.
PairReply 🔒
Peer
One paired computer, as kept on disk (no secret here).
Peers
The kept peers, from dir (the data directory).
SecretStore 🔒

Constants§

FILE 🔒
PEER_PREFIX
TowerSampleReq::connection for a paired computer: peer:<id>.
TIMEOUT 🔒

Traits§

Tokens
Where peers’ tokens are kept: the secret store (the OS keychain) in the app; in memory in tests, which must not touch the user’s keychain.

Functions§

pair
Pair with the computer the link names, as device_name (this computer).
parse_link
Parse an agentmux://pair?v=1&host=…&port=…&fp=…&code=…&hostname=… link.
probe_viewer_ports 🔒
The viewer ports host‘s AgentMux instances advertise now, from the LAN discovery probe a phone sends (UDP 47891): the answering instance’s, then its siblings’ (other channels on that host). Empty when nothing answers.
sample
A paired computer’s snapshot. moved: the addresses LAN discovery has for its hostname, tried in turn when the kept one doesn’t answer.
unreachable 🔒
url_at 🔒
viewer_ports_of 🔒
The viewer ports in a discovery reply: its own, then its siblings’.