Skip to content

Replace the Electron desktop shell with a native UI (Rust + Rune), keeping the orchestrator #1685

Open

Description

@phantomic12

What problem are you trying to solve?

The desktop app is Electron: Chromium + Node. That costs a full browser runtime for what is a
client of a local HTTP server — the window process is mostly idle between turns, yet it carries a
browser's memory and startup cost, and the renderer is only reachable from inside an Electron
window. I rebuilt the shell outside Electron to see how much of that is avoidable, and to check
whether the UI layer can be verified without launching a GUI.

The result is a working native shell: the same tokens, geometry and panes drawn by Rune's GPU and
text stack, no Chromium, no Node. It boots the own installed orchestrator unchanged — same
spawn, same stdin bootstrap line, same lifetime handshake, same /healthz budgets — and shows the
orchestrator's state in the sidebar. Panes are asserted headlessly from a test harness
(--snap renders a PNG, --tree dumps rects), which the Electron shell cannot do.

Where it stops, precisely: it draws the interface and supervises the process, but it reads
exactly one payload, /api/auth/status. Threads, chat streaming and ads still come from
fixtures, because the request shapes of those endpoints live in the shell code that is not in this
repository — a shipped install exposes the compiled bundle, not the client that drives it.

What would you like to happen?

Either of these, and I am happy with whichever you prefer:

  1. Take the contract as documentation. docs/desktop-shell-contract.md (PR ready) records
    what a desktop shell must do to drive the orchestrator: the boot-phase whitelist, the two
    readiness budgets, the stdin bootstrap line, the HMAC lifetime socket, the
    x-freebuff-launch-id gate on /api/*. That is useful to anyone writing a client, and it
    needs no Rust and no new toolchain.
  2. Consider the native shell as an experiment. With the contract above as the map, the
    remaining work is one recorded API session per feature (threads, streaming, ads) — a loopback
    proxy in front of a running app records the pair, and the shapes become implementable. I would
    open that as a separate PR once the shapes are known, under whatever path you name, with Rune
    pinned in your build instead of vendored.

If the direction is wrong for the product, say so and I will stop at the documentation.

Area: Desktop app

Contribution: I would be willing to open a PR for this


I can attach a screenshot of the native window beside the Electron one, the --tree dump the
tests assert against, and a short recording (spawn → phases → ready → footer "Orchestrator
ready"; then killing the shell and the orchestrator stopping within 2 s) on request, or put the
prototype in a repo if you want to read the code — I did not want to publish one before asking
whether the direction makes sense.

Activity

  1. phantomic12 commented on Nov 18, 2026

    @phantomic12
    Author

    Prototype is up, so the claims in the issue can be checked rather than taken on trust:

    https://github.com/phantomic12/freebuff-rune

    It is a port, not a redesign: the panes, spacing tokens, palette and geometry come from the shipped
    stylesheet, and the title bar is the same 44-point band. What is new is everything under it —
    Rune draws the whole shell with wgpu instead of Chromium, and there is no Node, no Electron and no
    webview anywhere in the process tree.

    dark theme

    The sidebar footer is the only part that talks to the real backend. It spawns the installed app's
    own Bun orchestrator, sends the launch id over stdin, answers the HMAC lifetime challenge and pings
    it every 3 s; the line below reads Orchestrator · signed out after a real boot, which is what
    /api/auth/status answers on this machine:

    live footer

    Killing the shell stops the orchestrator within ~1 s, and starting a second shell against the same
    Desktop profile is refused with the same exit code 75 the Electron shell gets:

    new chat settings

    Being a Rune app, it also renders headless, so every one of those images is a command rather than a
    screenshot tool — and the same run can dump the layout tree the tests assert against:

    ./scripts/shot.sh        # the PNG set above, at 2x
    ./scripts/run.sh         # the window

    What it does not do yet, so nothing here is overclaimed: threads, streaming replies and the ad
    creative are fixtures. The shipped local route table only exposes appearance, auth, hosted workspace and diagnostics, so the thread/chat/event request shapes are not recoverable from the
    install — the honest fix is to record one real exchange per feature and write the client against
    that. The contract in #1686 is what makes that a documented step instead of a guess.

    Happy to keep this as documentation if the direction is not wanted; the shell itself lives outside
    this repo and needs no decision from you.

  2. added
    area:desktop
    bot:triaged
    type:feature
    on Nov 18, 2026
  3. phantomic12 commented on Nov 19, 2026

    @phantomic12
    Author

    An update on the "how would a native shell get at the data" half of this, because it is answerable
    without changing anything: the orchestrator's local API is now recorded rather than guessed at.

    The method is a Bun preload — BUN_OPTIONS="--preload …" when launching the app, so the recorder
    loads inside the server the shell already spawns. No install is patched, no port is proxied, and
    credentials are redacted on the way out. (Remote debugging is not an option here, by design:
    app/electron/debug-switches.cjs refuses to start a packaged build when
    --remote-debugging-port/-pipe/-address appears in argv, which is the right call and worth
    saying out loud.)

    One signed-in boot, 83 exchanges, nothing driven by hand. What it shows:

    • The desktop API is one endpoint per resource with an operation field, not REST:
      local-conversations (authorize, projects, threads, workspace, save-workspace),
      plus status, runtime, browser, git, tasks, elevations, native-agents, appearance,
      profile-notice, sites-context. Every body carries accountId; every reply is the whole slice
      the caller renders from, not a mutation result.
    • A thread record is {id, title, draft, activeAt, running, archived, canContinue, harness, mode},
      where harness is codebuff | claude-code | codex. That is what the sidebar draws.
    • /api/hosted-workspace/status was polled 23 times in that boot and returns
      {accountId, deviceId, enabled, projectSetupCompleted, connections[], localProjects[]}.
    • 409 {"error": "Reconnect this local folder to use its tools"} is a state, not a failure — the
      renderer draws that string when the workspace connection is not up.

    So the data a native shell needs is reachable over loopback with the launch id, and its shapes are
    knowable. Written up with values dropped in
    docs/port-notes.md §8 of https://github.com/phantomic12/freebuff-rune.

    Two gaps, stated rather than papered over: the chat message stream and the transcript shape need a
    turn actually run (the recorder logs text/event-stream bodies as metadata only, because reading
    them consumes the live channel), and the ad creative is client-side. Neither is a blocker for the
    question this issue asks — whether a native shell is the direction — which is still yours to answer
    and not something either artifact presumes.

  4. phantomic12 commented on Nov 21, 2026

    @phantomic12
    Author

    One more finding, and it changes the shape of the answer to this issue — so it belongs here rather
    than buried in a link.

    The desktop window is a remote web app. hosted-workspace.cjs calls
    POST /api/hosted-workspace/bootstrap {launchId}, gets back {url, accountId, sessionToken}, and
    loads bootstrap.url (freebuff.com, or its staging hosts) in a session partition keyed by the
    account. The bundled resources/orchestrator/ui/ is the splash and sign-in page — six endpoints —
    not the app. The loopback orchestrator is a capability bridge for that page: browser panes, git,
    files, terminal, elevations, local history, each call made from the main process behind an
    ipcMain.handle that whitelists the operation's arguments (hosted-local-conversations.cjs throws
    on an unknown operation or an extra field).

    The consequence is the part worth your time: a native shell cannot stop at re-implementing the
    loopback contract. The thing a person is looking at is a web app on your origin, so porting the UI
    means being a client of the cloud API — a product-shaped decision about where the interface lives,
    not a rendering exercise. Loopback is the smaller, better-specified half.

    What the smaller half contains, recorded rather than guessed: a transcript is a pull.
    local-conversations takes authorize | projects | threads | workspace | save-workspace | search | read | migrate | attachment; read answers with a history block (firstSeq, lastSeq,
    hasOlder, hasNewer, loadedBytes) so a client pages by sequence number, and each message is a
    list of parts: text, reasoning, tool (carrying toolName and the raw tool input), and
    ad. Twelve ad parts came back in one thread — {title, adText, cta, url, favicon, clickUrl, impUrl, placementId} — so ads are content in the transcript, not a mode, which is also why there is
    no toggle for a port to mirror.

    The live token stream of a running turn is the one thing that stays unrecorded, and now we know
    why: it never crosses loopback. text/event-stream does not appear once in ~190 recorded exchanges,
    and that is the correct result, not a tooling shortfall.

    Written up with values dropped (no titles, no content) in
    docs/port-notes.md §9 of https://github.com/phantomic12/freebuff-rune. Nothing here changes the
    ask: whether a native UI is the direction is still yours to decide, and this is evidence for that
    decision rather than an argument for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:desktopbot:triagedtype:feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions