Expand description
agentmux-srv open: open a browser at a headless srv that serves its own UI.
SPEC_HEADLESS_SERVER_PACKAGE_AND_LOCAL_WEB_UI §3.
It reads the key file (owner-only) and finds the server’s port beside it, asks the server to prove
it holds that key and is bound to the address open is talking to (it never sends the key: see
crate::server::local_proof), asks srv for a one-time code, opens the browser at
/auth/enter#<code> (or prints the line with --print), then stays in the person’s terminal:
it shows the check phrase of the session that code made and asks [y/N]. Only the session of
the code it minted can be confirmed, and there is no flag that answers for the person.
Exit codes: 0 opened, 1 not opened (declined, expired, or nothing entered), 2 bad use, 3 could not do it (no terminal, srv not reachable, key refused).
Structs§
- Http
Server 🔒 - srv over HTTP, on a channel srv has proved it holds the key on.
- Stdio 🔒
- Target 🔒
Enums§
- Entry 🔒
- What srv says about the code
openminted.
Constants§
- POLL 🔒
- STEP_
LIMIT 🔒 - How long
openwaits for a browser to enter the code, and for the person to answer.
Traits§
- Server 🔒
- srv, as
opentalks to it (a trait so the flow is tested without a network). - Terminal 🔒
- The person’s terminal.
Functions§
- exit_
if_ 🔒requested - Runs
openorlogoutand exits when that is what srv was started as; returns for any other start. - is_yes 🔒
yoryesis yes; anything else, including a bare Enter, is no.- linux_
has_ 🔒screen - Does a Linux session have a screen a browser could open on? A
BROWSERof the person’s own counts too. - logout 🔒
- End every browser session of the server (
logout): 0 done, 3 could not. - prepare 🔒
- run 🔒
- say_
short_ 🔒form - A narrow terminal wraps the long line above and a copy of it breaks: the same page by a short address and the code on its own line, pasted into the page.
- sessions 🔒
- How many browsers are open (
sessions): prints the number, then a line for each recent confirm (confirm <unix ms> <session> <how>). 0 done, 3 could not. - shutdown 🔒
- Ask the server to shut down (
shutdown): 0 it said it is stopping, 3 could not. - sign_
in_ 🔒url - The line the browser is opened at. The code is in the fragment, which is never sent.