Artifact bdf4cd5e6e7a6538540fe41e162050ec8303c2f90c9d5f8ecc1ee506ba164de4:
- File
src/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: 1868) [annotate] [blame] [check-ins using] [more...]
/* pic remote (remote.c): remote control over a relay, docs/design/remote-protocol.md. A phone is * one more sender and one more observer of the journal: pic remote dials out to the relay, speaks * a Noise session to each paired phone, turns each command into a journal row before anything acts * on it (an inbox row, or a keyed admission), and rebuilds events from committed rows as pic * attach does. It holds no lease and listens on no socket. Pairing (pic remote pair, and /rc * through it) makes the keys and the mailbox on first use and adds a device row after a yes at * the terminal; the rows are sealed in ~/.pic/pic.sqlite under the credential store's key. */ #ifndef PIC_REMOTE_H #define PIC_REMOTE_H typedef struct { const char *self; /* this pic, for the children a prompt starts */ /* Draws a QR code of TEXT on stdout (the composition root owns the drawing). */ void (*show_qr)(const char *text); } pic_remote_options; /* pic remote [pair [--pipe] | devices | unpair ID | reset]: the process's exit status. */ int pic_remote_main(const pic_remote_options *o, int argc, char **argv); /* 1 when a pic remote is running for this user (its lock is held), else 0. No passphrase. */ int pic_remote_running(void); /* The phone page's address for the conversation SESSION of the journal JOURNAL in WORKSPACE (a * real path): RELAY/#s=JOURNAL/SESSION, as pic remote lists it, with &c=PHONE when one phone is * paired (the page's id for this computer); RELAY/ alone, or #c=PHONE, when SESSION is NULL or "". * The number of paired phones, or -1 when it does not fit in CAP. No passphrase. */ int pic_remote_link(const char *workspace, const char *journal, const char *session, char *out, size_t cap); /* The relay a pairing names when the setting remote.relay is unset. */ #define PIC_REMOTE_RELAY "https://remote.zeitforge.app" #endif