Extract the wayBetter framework core from wayBetter for X

Site-agnostic parts of the X app, behind a small site adapter:

- crates/waybetter-host: webview-label security policy and tab rect
  clamp, account profiles with native-owned accounts (AccountRules),
  plugin store with bundled-plugin upgrades (PluginHost), signed
  data-only hotfix channel, update scheduling and crash handshake, tab
  payloads/link routing/tab-chrome validation, and (feature "tauri")
  webview helpers and the Windows system menu.
- packages/runtime: DOM hub, request hub, plugin API core, OKLab theme
  color model, split-view rail hiding, link routing and account
  reporting, each configured by a SiteAdapter.
- packages/shell: address bar, pane, link-drop, profile, palette and
  update-chip models, and window controls with the Tauri API injected.

Tests moved/adapted from the app: 45 Rust (headless), 40 TypeScript.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
CRTkafa 2026-09-28 03:01:33 +07:00
commit 41267a22fd
48 changed files with 9768 additions and 0 deletions

View file

@ -0,0 +1,28 @@
//! wayBetter native host.
//!
//! A wayBetter app is one native window with a trusted local **shell** webview (tab strip, address
//! bars, split panes, settings) and one native child webview per browser tab, positioned over the
//! pane rectangles the shell reports. One site (x.com, web.whatsapp.com, kick.com, ...) is the
//! app's *site*: its tabs get the app's page runtime and may call a small set of site-only commands.
//!
//! This crate holds the site-agnostic parts, all headless-testable:
//! - [`site`]: the site adapter ([`site::SiteSpec`], [`site::AccountRules`]).
//! - [`policy`]: webview labels, origin checks and the tab rectangle clamp (security boundary).
//! - [`profiles`]: account profiles, one WebView data directory each, with the account seen inside.
//! - [`plugins`]: owner-installed `*.plugin.js` files, custom CSS and bundled-plugin upgrades.
//! - [`hotfix`]: the signed, data-only hotfix channel.
//! - [`update`]: silent-update scheduling and the crash handshake.
//! - [`tabs`]: tab layout/state payloads, link routing and tab-chrome validation.
//!
//! With the `tauri` feature, [`host`] adds the Tauri glue that does not depend on app state.
pub mod hotfix;
pub mod plugins;
pub mod policy;
pub mod profiles;
pub mod site;
pub mod tabs;
pub mod update;
#[cfg(feature = "tauri")]
pub mod host;