Artifact 1037c8f278d0e5ad92a7e8553cb55f752127ca2b370310e871345580f5d11754:
- File
src/tui/remote.h
— part of check-in
[da4167d308]
at
2026-11-23 14:34:25
on branch rc-screen
— /rc: one step to the phone, like Claude Code's /remote-control
With a phone paired, /rc turns remote control on and shows a short panel: whether it is on and connected, this conversation's link for the phone page (/#s=JOURNAL/SESSION, &c=PHONE when one phone is paired) and a QR code of it, and the paired phones; c copies the link, s turns it off or on, p pairs another. With no phone paired, /rc goes straight to pairing; Esc there returns to the conversation. remote.invite is named only when pairing fails without it.
ssh leaves the main screen: /rc ssh and pic rc --ssh show the ssh command and its checks as text, with no QR code. pic rc prints the phone's link and its QR code, pic rc --link the link alone.
The footer says "remote on" while pic remote is connected (checked every 10 s), as Claude Code shows "/rc active".
Fixes: pic remote marks its stream connected on the relay's 200 (http.c's new on_head callback) rather than on the first body byte, so /rc no longer says "connecting" for up to 15 s; after pairing /rc no longer tells you to run pic remote when it already runs.
Tests: test/tui/rc.sh (fake relay and phone: unpaired pairing screen, invite, paired link and QR, connected at once with a quiet relay, footer marker, s, pic rc, pic rc --ssh, /rc ssh); http's on_head; tui.sh, grapevine.sh and remote.sh updated for the new screens. (user: dmestas, size: 2021) [annotate] [blame] [check-ins using] [more...]
/* /rc ssh and pic rc --ssh (remote.c): how to reach this conversation from * a phone over ssh: the ssh command and checks with their fixes; and the QR * code /rc and pic rc draw of the phone page's address. */ #ifndef PIC_TUI_REMOTE_H #define PIC_TUI_REMOTE_H typedef struct { char user[64]; char host[256]; /* the Tailscale name when Tailscale is up, else the local host name */ char ip[64]; /* this machine's first Tailscale address, or "" */ char url[384]; /* ssh://user@ip when there is one (a phone off Tailscale DNS), else ssh://user@host */ char then[4096]; /* what to run once logged in (cd ... && pic attach -i -c) */ char command[8192]; /* ssh user@host -t '...': the whole thing, for any ssh client */ int tailscale; /* 1: reachable through Tailscale */ int ssh_on; /* 1: something listens on port 22 */ } tui_remote; /* Fills R for the conversation SESSION (NULL or "": the latest, -c) of * WORKSPACE, run there with the pic at SELF. Looks the host up (tailscale * status, scutil, gethostname) and tries port 22. Dev builds take the * lookups from PIC_TEST_RC ("TAILSCALE_NAME|LOCAL_NAME|SSH[|TAILSCALE_IP]": * - for no Tailscale, SSH 1 or 0). */ void tui_remote_info(tui_remote *r, const char *self, const char *workspace, const char *session); /* TEXT as a QR code, two rows of modules per line in half blocks, with a * quiet zone of 4. LIGHT_BLOCKS: light modules are the blocks, to be drawn * light on dark (the caller colours it); 0: dark modules are the blocks, * for a light background. NULL on failure; malloc'd, lines ending in '\n'; * *rows its line count. */ char *tui_remote_qr(const char *text, int light_blocks, int *rows); /* The ssh page: the address, what to run, the command, the checks; lines * ending in '\n'. */ char *tui_remote_page(const tui_remote *r); /* A line of a page that is a QR code row starts with this, for the caller * to colour white on black. */ #define TUI_REMOTE_QR '\x02' #endif