Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/wpewebkit-watch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: WPE WebKit watch

# WPE WebKit is pinned (nix/wpewebkit/package.nix) and bumped on purpose. Every week, compare
# the pin with the newest stable release on wpewebkit.org and open one issue when it is behind,
# so security releases are not missed. The bump itself is a normal PR, built by the omarchnix
# "wpewebkit nightly" workflow (dispatch it with the PR branch) before it is merged.

on:
schedule:
- cron: "23 6 * * 1" # Mondays 06:23 UTC
workflow_dispatch:

permissions:
contents: read
issues: write

jobs:
watch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Compare the pin with the newest stable release
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
pinned="$(sed -n 's/^ version = "\([0-9.]*\)";$/\1/p' nix/wpewebkit/package.nix)"
test -n "$pinned"
# Stable series have an even minor version (2.54.x); odd ones are development snapshots.
latest="$(curl -fsS https://wpewebkit.org/releases/ \
| grep -oE 'wpewebkit-[0-9]+\.[0-9]*[02468]\.[0-9]+\.tar\.xz' \
| sed -e 's/^wpewebkit-//' -e 's/\.tar\.xz$//' | sort -uV | tail -1)"
test -n "$latest"
echo "pinned $pinned, newest stable $latest" | tee -a "$GITHUB_STEP_SUMMARY"
newest="$(printf '%s\n%s\n' "$pinned" "$latest" | sort -V | tail -1)"
if [ "$newest" = "$pinned" ]; then
echo "Pin is current." >> "$GITHUB_STEP_SUMMARY"
exit 0
fi
title="WPE WebKit $latest is available (pinned $pinned)"
if [ -n "$(gh issue list --state open --search "in:title \"WPE WebKit $latest is available\"" --json number --jq '.[].number')" ]; then
echo "Issue already open." >> "$GITHUB_STEP_SUMMARY"
exit 0
fi
body="$(printf '%s\n' \
"WPE WebKit **$latest** is out; Orb pins **$pinned** in \`nix/wpewebkit/package.nix\`." \
"" \
"- Release notes and security advisories: https://wpewebkit.org/release/ and https://wpewebkit.org/security/" \
"- To bump: update \`version\` and \`hash\` (from \`https://wpewebkit.org/releases/wpewebkit-$latest.tar.xz.sums\`)," \
" then dispatch the omarchnix **wpewebkit nightly** workflow with the bump branch as \`orb_ref\`," \
" and merge once it has built on dgx-spark and pushed to the OVH cache.")"
gh issue create --title "$title" --body "$body"
69 changes: 69 additions & 0 deletions docs/ui/leanui-wpe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# LeanUI web view on WPE WebKit

Goal: run the Orb web UI inside a LeanUI window with no GTK at all, replacing the GTK3 +
WebKitGTK shell (`linux_shell/`) once it reaches parity.

## Decisions (2026-11-30)

- **WPE WebKit, built by us.** nixpkgs only ships the GTK port of WebKit, and Ubuntu 24.04
ships no WPE WebKit. `nix/wpewebkit/package.nix` builds the same WebKit source tree as
`-DPORT=WPE` with the WPEPlatform API (headless + Wayland platforms; DRM off) and without the
legacy libwpe/WPEBackend-fdo API.
- **Pinned, never rebuilt by accident.** It is built from its own `nixpkgs-wpe` flake input
(a fixed revision in `flake.nix`), so `nix flake update` or a consumer's
`inputs.nixpkgs.follows` does not change its derivation. Version bumps are deliberate PRs.
- **Built at night on dgx-spark.** The `wpewebkit nightly` workflow in `Th0rgal/omarchnix`
checks every night whether the pinned aarch64-linux build is in the OVH Nix cache
(`omarchnix-nix-cache-gra`) and builds and pushes it on dgx-spark when it is not. Dispatch it
with a bump branch as `orb_ref` to build the bump before merging it. The m2air and every other
aarch64 machine substitute it; none compiles WebKit. The x86_64-linux build (CI and VM tests)
is produced once per pinned version on a lean.ci VM and pushed to the same cache.
- **Security bumps.** `.github/workflows/wpewebkit-watch.yml` compares the pin with the newest
stable release (even minor version) every Monday and opens an issue when it is behind.
- **Out of process.** WebKit and GLib live in a separate `orb-webview-host` process linked
against the pinned closure. The LeanUI process loads neither, so its glibc and nixpkgs stay
independent of WebKit's, and a WebKit crash only restarts the view.

## Architecture

```
orb-desktop-native (LeanUI, Lean 4) orb-webview-host (C, WPE WebKit 2.x)
LeanUI.WebView widget <── Unix socket ──> WPEPlatform headless display + WPEView
Vulkan: import DMA-BUF WebKitWebView (UI process side)
as a sampled image └─ WebProcess / NetworkProcess (bubblewrap)
```

Socket protocol (versioned, little-endian messages):

| Direction | Message |
| --- | --- |
| LeanUI → host | `create(w, h, scale)`, `resize`, `load_uri`, `load_html`, `eval_js`, `post_message`, `pointer`, `axis`, `key`, `ime`, `focus`, `frame_done(id)` |
| host → LeanUI | `frame(id, w, h, fourcc, modifier, planes)` with the DMA-BUF fds in `SCM_RIGHTS` (SHM fd as fallback), `message(json)`, `eval_result`, `cursor`, `title`, `load_state`, `crashed` |

- Frames are WPEPlatform buffers (`WPEBufferDMABuf`, or `WPEBufferSHM` without a GPU). The host
holds a buffer until LeanUI acknowledges it with `frame_done`, which is the backpressure.
- LeanUI imports the DMA-BUF into Vulkan (`VK_EXT_external_memory_dma_buf`,
`VK_EXT_image_drm_format_modifier`) and samples it in the same instanced pass as the rest of
the chrome, so clips, rounded corners, overlays (the `Cmd+Shift+F` palette) and backdrop blur
apply to web content. Today the `.image` prim is a placeholder rectangle; it becomes this.
- Input comes from LeanUI's Wayland seat: the web view is an ordinary widget with a hit region
and keyboard focus; keys are xkb keysyms with modifiers, text input (IME) goes through
text-input-v3 as for other LeanUI editors.
- JS bridge: the host registers the same `window.webkit.messageHandlers` names as the GTK shell,
so `orb/src` runs unchanged in both shells.
- The web UI is served from `ORB_UI_ROOT` through a custom URI scheme with the same origin as the
GTK shell's `tauri://localhost`, which keeps `localStorage`.

`LeanUI.WebView` (from #2288) keeps its Lean API; its current C backend is a placeholder (it
paints a colour derived from the URL and never creates a WebKit view) and is replaced by the
socket client in P1.

## Phases

| Phase | Scope | Done when |
| --- | --- | --- |
| P0 | `nix/wpewebkit` (2.54.3) + `nixpkgs-wpe` pin, omarchnix nightly + OVH cache, weekly watch | the aarch64 build is in the OVH cache and MiniBrowser renders a page |
| P1 | `orb-webview-host`, socket protocol, SHM frames; replace the placeholder backend | CI under headless Weston + lavapipe: load a page, click, type, IME, JS round trip, pixels |
| P2 | DMA-BUF import in Vulkan; real `.image` prim | frame timings; pixel delta against the SHM path |
| P3 | `--leanui-wpe`: native sidebar + web pane, URI scheme, `orb-locald` bootstrap | screenshot parity with the GTK shell; tested on the m2air |
| P4 | remove the GTK3/WebKitGTK shell after parity | — |
19 changes: 18 additions & 1 deletion flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,15 @@
description = "Orb Core: self-hosted orchestrator for AI coding agents";

inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
# WPE WebKit is built from its own, pinned nixpkgs so `nix flake update` (or a consumer's
# `inputs.nixpkgs.follows`) never rebuilds it. Bump this revision on purpose, together with
# nix/wpewebkit/package.nix, and let the omarchnix nightly build it before merging.
inputs.nixpkgs-wpe.url = "github:NixOS/nixpkgs/0bb2eedc20e4739f29e8045034f2828ad7054f8f";

outputs = {
self,
nixpkgs,
nixpkgs-wpe,
}: let
# nixpkgs 26.11 dropped x86_64-darwin.
systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin"];
Expand Down Expand Up @@ -45,6 +50,8 @@
} // pkgs.lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
# `turbo-lean` must come from the let above: a `rec` set does not reach
# across `//`, which left this attribute undefined (U4).
# WPE WebKit (pinned) for LeanUI's out-of-process web view; see nix/wpewebkit/package.nix.
wpewebkit = nixpkgs-wpe.legacyPackages.${pkgs.stdenv.hostPlatform.system}.callPackage ./nix/wpewebkit/package.nix {};
orb-desktop = pkgs.callPackage ./nix/desktop.nix {
inherit turbo-lean orb-desktop-bins;
revision = self.rev or (self.dirtyRev or "local checkout");
Expand Down
17 changes: 17 additions & 0 deletions nix/wpewebkit/fix-bubblewrap-paths.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
diff --git a/Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp b/Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp
index 0a201fe176..fa3690c12a 100644
--- a/Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp
+++ b/Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp
@@ -819,6 +819,12 @@ GRefPtr<GSubprocess> bubblewrapSpawn(GSubprocessLauncher* launcher, const Proces
sandboxArgs.append("--unshare-ipc");
}

+ // Nix Directories
+ sandboxArgs.appendVector(Vector<CString>({ "--ro-bind", "@storeDir@", "@storeDir@" }));
+ sandboxArgs.appendVector(Vector<CString>({ "--ro-bind-try", "/run/current-system", "/run/current-system" }));
+ sandboxArgs.appendVector(Vector<CString>({ "--ro-bind-try", "@driverLink@/lib", "@driverLink@/lib" }));
+ sandboxArgs.appendVector(Vector<CString>({ "--ro-bind-try", "@driverLink@/share", "@driverLink@/share" }));
+
#if ENABLE(DEVELOPER_MODE)
const char* execDirectory = g_getenv("WEBKIT_EXEC_PATH");
if (execDirectory) {
195 changes: 195 additions & 0 deletions nix/wpewebkit/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
# WPE WebKit for LeanUI's out-of-process web view (`orb-webview-host`, docs/ui/leanui-wpe.md).
#
# nixpkgs ships only the GTK port. This is the same WebKit source tree built as `-DPORT=WPE`,
# with the WPEPlatform API (headless + Wayland; DRM off) and without the legacy libwpe/fdo API,
# introspection, documentation or WebDriver. It mirrors nixpkgs' `webkitgtk_6_0` derivation.
#
# Pinned on purpose: flake.nix builds it from its own `nixpkgs-wpe` input, so bumping Orb's
# nixpkgs never rebuilds WebKit. A bump of `version` (and, when needed, `nixpkgs-wpe`) is a
# deliberate change: the nightly job in Th0rgal/omarchnix builds it on dgx-spark and pushes it
# to the OVH Nix cache before the bump is merged.
{
lib,
clangStdenv,
fetchurl,
replaceVars,
addDriverRunpath,
bison,
cmake,
gettext,
gperf,
ninja,
perl,
pkg-config,
python3,
ruby,
glib,
unifdef,
wayland-scanner,
at-spi2-core,
bubblewrap,
enchant,
expat,
flite,
fontconfig,
freetype,
gst_all_1,
harfbuzzFull,
hyphen,
icu,
lcms2,
libGL,
libavif,
libbacktrace,
libdrm,
libepoxy,
libgbm,
libgcrypt,
libgpg-error,
libintl,
libjpeg,
libjxl,
libpng,
libpthread-stubs,
libseccomp,
libsoup_3,
libsysprof-capture,
libtasn1,
libwebp,
libxkbcommon,
libxml2,
libxslt,
pcre2,
sqlite,
systemdLibs,
wayland,
wayland-protocols,
woff2,
xdg-dbus-proxy,
zlib,
}:

clangStdenv.mkDerivation (finalAttrs: {
pname = "wpewebkit";
version = "2.54.3";

outputs = [ "out" "dev" ];

# Can't be linked within a 4GB address space (nixpkgs#153528).
separateDebugInfo = true;

src = fetchurl {
url = "https://wpewebkit.org/releases/wpewebkit-${finalAttrs.version}.tar.xz";
# sha256 787afd32ae23eac061621465390f44a462e874a9ebaba0b65521d7237fa8a5e4, as published in
# https://wpewebkit.org/releases/wpewebkit-2.54.3.tar.xz.sums
hash = "sha256-eHr9Mq4j6sBhYhRlOQ9EpGLodKnrq6C2VSHXI3+opeQ=";
};

patches = [
# From nixpkgs' webkitgtk: let the bubblewrap sandbox see /nix/store and the GL driver link.
(replaceVars ./fix-bubblewrap-paths.patch {
inherit (builtins) storeDir;
inherit (addDriverRunpath) driverLink;
})
];

nativeBuildInputs = [
bison
cmake
gettext
gperf
ninja
perl
perl.pkgs.FileCopyRecursive # used by copy-user-interface-resources.pl
pkg-config
python3
ruby
glib # gdbus-codegen, glib-mkenums
unifdef
wayland-scanner
];

buildInputs = [
at-spi2-core # atk + atk-bridge (USE_ATK)
enchant
expat
flite
fontconfig # Skia (gtk4 brings it in for webkitgtk)
freetype
gst_all_1.gst-plugins-bad
gst_all_1.gst-plugins-base
harfbuzzFull
hyphen
icu
lcms2
libGL
libavif
libbacktrace
libdrm
libepoxy
libgbm
libgcrypt
libgpg-error
libintl
libjpeg
libjxl
libpng
libpthread-stubs
libseccomp
libsysprof-capture
libtasn1
libwebp
libxkbcommon
libxml2
libxslt
pcre2 # required by glib-2.0.pc
sqlite
systemdLibs
wayland
wayland-protocols
woff2
zlib
];

propagatedBuildInputs = [
glib
libsoup_3
];

cmakeFlags = [
"-DPORT=WPE"
"-DENABLE_WPE_PLATFORM=ON"
"-DENABLE_WPE_PLATFORM_HEADLESS=ON"
"-DENABLE_WPE_PLATFORM_WAYLAND=ON"
"-DENABLE_WPE_PLATFORM_DRM=OFF"
"-DENABLE_WPE_LEGACY_API=OFF"
"-DENABLE_WPE_QT_API=OFF"
"-DENABLE_INTROSPECTION=OFF"
"-DENABLE_DOCUMENTATION=OFF"
"-DENABLE_WEBDRIVER=OFF"
# Kept: MiniBrowser is the smoke test that the build renders a page.
"-DENABLE_MINIBROWSER=ON"
"-DBWRAP_EXECUTABLE=${lib.getExe bubblewrap}"
"-DDBUS_PROXY_EXECUTABLE=${lib.getExe xdg-dbus-proxy}"
];

postPatch = ''
patchShebangs .
'';

requiredSystemFeatures = [ "big-parallel" ];

meta = {
description = "Web content rendering engine, WPE port (WPEPlatform API), pinned for Orb's LeanUI web view";
homepage = "https://wpewebkit.org/";
license = lib.licenses.bsd2;
platforms = lib.platforms.linux;
pkgConfigModules = [
"wpe-webkit-2.0"
"wpe-web-process-extension-2.0"
"wpe-platform-2.0"
"wpe-platform-headless-2.0"
"wpe-platform-wayland-2.0"
];
};
})
Loading