···3535 # account, and a teammate's message from the browser executes in this
3636 # TUI.
3737 #
3838- # First use per machine opens a browser for the pocket-id login; the
3939- # session JWT is cached in ~/.omnigent/auth_tokens.json afterwards.
4040- # Arguments go through to omp, e.g. `covibe --continue`; `covibe --resume`
4141- # (no value) opens omnigent's session picker.
3838+ # Auth is the pocket-id login, but *only a browser* has to see pocket-id —
3939+ # the machine running the agent only needs to reach the server. omnigent's
4040+ # cli-ticket flow (POST /auth/cli-login, then poll /auth/cli-poll for five
4141+ # minutes) prints a URL that any device with your passkey can complete, so
4242+ # this works over ssh on a box with no display: run `covibe login`, open
4343+ # the printed link on a laptop or phone, done. The session JWT is then
4444+ # cached in ~/.omnigent/auth_tokens.json for the server's configured TTL.
4545+ # Other arguments go through to omp, e.g. `covibe --continue`;
4646+ # `covibe --resume` (no value) opens omnigent's session picker.
4247 packages.covibe =
4348 (pkgs.writeShellApplication {
4449 name = "covibe";
···5257 text = ''
5358 server=${server}
5459 tokens="$HOME/.omnigent/auth_tokens.json"
6060+6161+ # `webbrowser.open` walks a candidate list that includes terminal
6262+ # browsers; on a headless box one of those can seize the tty we are
6363+ # about to hand to omp's TUI. With no display, make the "open" a
6464+ # no-op — the URL is printed either way.
6565+ if [ -z "''${DISPLAY:-}" ] && [ -z "''${WAYLAND_DISPLAY:-}" ]; then
6666+ export BROWSER=''${BROWSER:-echo}
6767+ fi
6868+6969+ login() {
7070+ echo "covibe: authenticating against $server" >&2
7171+ echo "covibe: open the link below on any device that has your pocket-id passkey" >&2
7272+ omnigent login "$server"
7373+ }
7474+7575+ case "''${1:-}" in
7676+ login)
7777+ login
7878+ exit 0
7979+ ;;
8080+ host)
8181+ # Register this machine so sessions can also be STARTED from the
8282+ # browser (New Chat → this host → the `omp` agent). That path runs
8383+ # `omp acp` from the runner's PATH, which only has omp when the
8484+ # daemon was spawned with it — as it is here. Runs in the
8585+ # foreground; ^C stops hosting.
8686+ shift
8787+ exec omnigent host "$server" "$@"
8888+ ;;
8989+ esac
9090+5591 # The cached session is a JWT with a server-side TTL
5692 # (OMNIGENT_OIDC_SESSION_TTL_HOURS), so "a token exists" is not the
5793 # same as "we are logged in": a stale entry makes omnigent fail with
···6197 if ! jq -e --arg s "$server" \
6298 '((.[$s].expires_at // 0) > (now + 60)) and ((.[$s].token // "") != "")' \
6399 "$tokens" >/dev/null 2>&1; then
6464- echo "covibe: no valid session for $server, logging in" >&2
6565- omnigent login "$server"
100100+ login
66101 fi
67102 exec omnigent pi --server "$server" "$@"
68103 '';
···11bin "covibe"
22about "Run omp's TUI as a shared session on the omni.lassul.us omnigent dashboard (transcript, diff view and read-only/read-write sharing live on the server)"
3344+cmd "login" help="Authenticate this machine against omni.lassul.us; prints a link to open on any device with your pocket-id passkey"
55+cmd "host" help="Keep this machine registered as a host so sessions can also be started from the browser"
66+47flag "-c --continue" help="Continue the previous omp session in this directory"
58flag "-r --resume" help="Resume an omnigent session (no value opens the picker)"
69arg "[omp-args...]" help="Arguments passed through to omp"