Skip to content

feat(desktop): add a phone-friendly LAN WebUI companion - #2623

Merged
vastsa merged 17 commits into
mainfrom
feat/lan-webui-model-picker
Nov 27, 2026
Merged

vastsa merged 17 commits into
mainfrom
feat/lan-webui-model-picker

Conversation

@vastsa

@vastsa vastsa commented Nov 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add an opt-in LAN companion for pairing, browsing local and temporary conversations, and continuing Desktop work on a phone.
  • Align the mobile UI with Desktop, including recent conversations, search, transcript rendering, and a per-session model picker for saved chat models.
  • Seed the revision round-trip smoke fixture through the real Host API; its assertions are unchanged.

Task-candidate validation

  • Candidate: cbccfaacd; base: 8d686c28a; isolated macOS Electron/Host fixtures.
  • LAN browser/HTTP paths and Composer model tests: 43 passed.
  • Host smoke, Electron boot/session-list probe, and Composer selection E2E passed.
  • Guarded model-write regression, Rust formatting, architecture and PR-base checks passed.
  • Optional live-provider tests were skipped; no paid provider was used.

Users want to keep working with the desktop's existing projects and
sessions from a phone or another browser on the same Wi-Fi. This adds
an off-by-default LAN listener in Electron Main with one-time-code
pairing, per-device project/temporary scopes and chat/organize grants,
and a phone-first page for browsing, creating, chatting and organizing.

The edge only calls existing Desktop handlers and Agent Host turn
admission under a non-owner principal, so tool approvals stay on the
desktop. Organization edits reuse the sidebar backup as the single
durable record and stay pending until the renderer acknowledges them,
so a stale sidebar snapshot cannot undo them. Transport is plain HTTP
by product decision; Host/Origin checks and CSRF tokens guard requests.
… projects apart

replaceChildren() stringifies null, so every list and chat view rendered a
stray "null" line from optional slots. Filter empty slots before rendering,
and assert no placeholder text in the phone user-path test.

Legacy folder-named projects frequently share a label (several "apps"),
which made the phone list and the Desktop pairing checklist ambiguous.
Repeated labels now carry their parent folder name, never the full path.
Move pairing and grant choices into focused dialogs so connection
status and device access are easier to scan. Keep device identity
when grants change, but reauthorize requests and live streams under
the new scope.
Make device confirmation the only project access decision so pairing
works without a project checklist and new local projects stay visible.
Keep Temporary, Chat and Organize as separate grants and refuse
stale per-project approvals instead of widening them.
Treat the locally generated one-time code as the WebUI access decision.
Remove pending approvals and per-device grants while keeping device
revocation and the existing local workspace and Agent boundaries.
Normalize pasted codes and reject duplicate submits without consuming
extra pairing attempts. Distinguish an older service or a blocked
session cookie from a bad code. Provide a local QR and copy action
without sending pairing data to an external service.
Limit the full-page overlay styles to an open action sheet. The
author flex rule otherwise overrides hidden and intercepts taps.
Exercise the browser hit target before activating controls so
the workflow catches an overlay that obscures the page.
… system

The phone companion used its own blue-accent, bordered look, so it read as
a different product from the desktop it controls. It now mirrors the
Desktop tokens: neutral monochrome palette, divider-free tonal tiles,
stroke and shadow only on floating layers, Lucide icons, and the shared
radius, type and motion ramps. Light or dark follows the phone setting.

Phone ergonomics improve alongside: a thumb-reach New conversation
capsule, a floating composer pill with icon send/stop, rename inside the
action sheet instead of a native prompt, and per-list scroll restore on
Back. Live refreshes now keep the focused field, caret and text, which
also fixes search input losing focus while typing.

Screen readers hear run-state changes instead of every list refresh. The
browser user-path test covers in-sheet rename and focus-stable search.
The phone made people walk Projects -> Sessions to get back to work they
had just left, showed answers as raw Markdown, and offered several equal
actions at every step. Home now leads with Recent conversations across
projects (running work always listed), one search covers projects and
conversation titles, and archived items sit behind a single Archived
entry instead of a sticky filter. New conversation from Home asks only
where it should live; disconnecting asks for confirmation.

Conversations render a safe Markdown subset (DOM only, no HTML, no
remote images, http(s) links only), fold consecutive tool calls into one
step summary, and offer Copy on code blocks and on the last answer of
each exchange. A sent message appears at once and yields to the Host
record; a failed send returns the text to the draft. The composer shows
Stop alone while a reply runs until text is typed, a working cue fills
the gap before streamed text, and Jump to latest appears when needed.

GET /v1/sessions without projectId lists every visible scope, and each
session carries an optional projectLabel, so cross-project rows and deep
links name their project. Browser and HTTP user-path tests cover the new
flow, the recent list and the Markdown renderer's edge cases.
Keep the chosen binding and unexpired browser pairings across routine
Desktop restarts, without persisting reusable cookie values or treating
explicit disablement as a restart.
Phone users can choose a saved chat model before sending without leaving their
conversation or losing a draft. Reuse the Desktop catalog filters and the
Host-owned session binding rather than sending provider configuration to a
browser or adding a separate per-message model override.

Keep selection limited to eligible idle sessions and reject a stale selection
at the Host so a second client cannot overwrite a newer model or mode.
Preserve the existing LAN WebUI commits while bringing the request branch onto
the current remote base. The request branch remains isolated from local main.
Keep the complete LAN WebUI change set clean when reviewed against main.
The Host now checks its revision index before archiving an active branch.
Revision metadata on a prompt alone no longer satisfies that precondition.
Exercise the real truncate and restore path before checking live references
and branch round-trips, without weakening the existing assertions.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Deploying pi-desktop with  Cloudflare Pages  Cloudflare Pages

Latest commit: eb3d2cf
Status: ✅  Deploy successful!
Preview URL: https://4f451bb1.pi-desktop.pages.dev
Branch Preview URL: https://feat-lan-webui-model-picker.pi-desktop.pages.dev

View logs

The plain JavaScript job does not install an Electron executable. Move the
unchanged browser suite to the existing Electron and Xvfb job rather than
skipping its checks or requiring a display for the unit-test job.
@vastsa

vastsa commented Nov 27, 2026

Copy link
Copy Markdown
Owner Author

Updated candidate: eb3d2cfd787bf41fd01f3c2fa3c92ba175eb449c (base 8d686c28a7e059c3e44fc5eb7db4abb1793ce348). The unchanged LAN browser suite now runs with Electron and Xvfb in CI. Local LAN browser E2E (5), LAN/Composer unit and HTTP tests (38), Host protocol smoke, Composer selection and Electron boot all passed on this candidate.

Worker message delivery can span more than two event-loop iterations on a
loaded CI runner. Use an explicit overlap gate so the test observes concurrent
reads rather than assuming the timing of their delivery.
@vastsa
vastsa merged commit bd57246 into main Nov 27, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant