GXWI Architecture
Single-page view · as markdown
GXWI Process Boundaries
Peios / Developing for Peios / GXWI Architecture
GXWI separates privileged machine operations from network parsing.
gxwid owns the listener, certificate state, authentication connections,
and session jobs. gxwi-server handles browser traffic with a restricted
token and descriptors supplied by the daemon.
Browser to desktop #
The network worker accepts TLS and HTTP requests. It communicates with the daemon over private channels for authentication and overlay state. The daemon starts session jobs with the access token returned by authd.
A compositor receives a session socket and serves HTTP/2 over it. The network worker forwards requests for the authenticated browser session to that connection. The compositor then routes desktop and application requests inside the session.
The externally served protocol and internal transport differ. Browser connections use HTTP/1.1 over TLS. The worker-to-session connection uses HTTP/2 over a local socket.
Session credentials #
The network worker owns its session cookies. It strips GXWI authentication cookies before forwarding requests to a session and prevents application responses from replacing them. A compositor or application does not need the browser's session cookie to serve its connection.
The worker also keeps application-origin routing separate from ordinary session paths. Application-provided labels do not establish another application's authority.
Failure boundaries #
The daemon restarts a failed network worker with a bounded retry delay. Keeping the listener and desktop jobs outside that worker allows them to outlive its failure. This does not make in-flight browser requests transactional or preserve the worker's in-memory cookie table.
Session startup waits for the compositor to accept its connection within 10 seconds. A program that cannot become ready fails startup rather than leaving authentication waiting indefinitely.
Restricted and development execution #
Normal execution relies on Peios access tokens, registry access control, authd, peinit jobs, and local token transfer. A host-only unrestricted run omits those security mechanisms. It can exercise HTTP and browser code, but it cannot qualify native authentication or sandbox behavior.
The Session Environment
Peios / Developing for Peios / GXWI Architecture
GXWI starts a compositor with environment values chosen for the authenticated principal. Those values describe the session, not the browser device that happens to display it.
Identity and runtime #
The session receives these values:
| Value | Purpose |
|---|---|
HOME | Home directory from the account profile |
SHELL | Account shell |
PATH | Program search path for the session |
GXWI_RUNTIME_DIR | Session runtime directory |
GXWI_DISPLAY_NAME | Display label from the first logon profile |
The compositor exposes GXWI_DISPLAY to applications it starts. An
application should connect to that display rather than guessing a socket
path. The session runtime directory and socket are not public network
addresses.
Locale #
GXWI reads machine locale settings and the authenticated user's locale
preferences before starting the session. It clears inherited locale
overrides and falls back to C.UTF-8 where needed.
Rejoining an existing session does not restart its processes or replace their environment. Changes to locale, home, display label, or shell apply when another session is created, according to the relevant service policy.
Separate overlay runtime #
A machine overlay receives its own runtime and job. It is not the overlay account's ordinary desktop session. Its lifecycle follows the configured overlay rather than a browser visitor's sign-in.
Fenesh Implementation Boundaries
Peios / Developing for Peios / GXWI Architecture
Fenesh is a Rust application built on the gxwi crate. It renders shell
surfaces and companion windows, while the desktop service and compositor
provide session transport, authorization, and window management.
Source layout #
The implementation separates shell state from companion applications:
| Source | Responsibility |
|---|---|
src/main.rs | Connect the shell, register surfaces, and wire shared state |
src/dock.rs and src/launcher.rs | Application selection, window actions, and pins |
src/settings.rs, src/looks.rs, and src/pinned.rs | Read settings, resolve defaults, and maintain shell state |
src/watch.rs | Follow registry notifications and refresh settings |
src/wallpaper.rs | Validate image paths and bound reads shared by the shell and Settings |
src/topbar.rs, src/person.rs, and src/power.rs | Clock, display identity, and session or power controls |
src/welcome.rs | First-session welcome attempt and marker |
src/bin/fenesh-welcome.rs | Get started application |
src/bin/fenesh-settings/ | Settings controls, validation, and registry writes |
The source repository contains these files
and the manual pages under docs/man. docs/fenesh.regman owns the Fenesh
registry reference. Build and contributor instructions live in
docs/building.md, outside the published Learn tree.
Authority and untrusted input #
Fenesh runs with the desktop account's identity. Its shell role comes from Fenestra's configuration, not from a user-interface claim. Launcher and dock events resolve application IDs against the catalog before asking the desktop to start a program. Display names provide presentation only; they are not an authorization decision.
The shared wallpaper loader opens paths without waiting on named pipes and accepts only regular files, including symlinks to regular files. It checks the opened object before reading, then bounds the read to 16 MiB plus one byte for detecting overflow. It rejects oversized content, including growth after the metadata check. File extensions select the content type; this is not image decoding or sanitization.
Gallery image URLs encode each filename as one path segment before HTML
attribute escaping. Spaces, non-ASCII text, and characters such as #,
?, and % remain part of the filename instead of changing the URL.
Desktop Settings tests registry access through the registry API. It does not infer write access from group names. Writes for a single key use a transaction. Advanced changes across GXWI and Fenestra keys use separate transactions, so a later failure can leave an earlier key changed.
The power menu asks the session service to end the session and asks peinit to restart or power off the machine. Those services retain the authority to accept or refuse the request. The shell shows a refusal rather than presenting the action as completed.
Updates and defaults #
Personal settings take precedence over machine defaults where the setting supports them. Registry watchers follow the nearest existing ancestor so a missing settings key can be created later. A failed watch stops that watcher and reports the failure; it does not silently poll as a fallback. Desktop Settings separately polls every four seconds to refresh controls.
Wallpaper refresh compares the selected path, file size, and modification time after a registry notification. It does not monitor the image file. Clock and pin updates share state across shell surfaces. Focus and overlay visibility belong to each connected display, so one display's focus does not need to match another's.
The first-session marker records that the automatic welcome launch was attempted. It does not prove that the user saw or completed the window.
Fenestra Implementation Boundaries
Peios / Developing for Peios / GXWI Architecture
Fenestra separates session state from browser layout. The Rust process owns application connections and surfaces. Each desktop page receives that state and applies its window manager locally.
Source layout #
The implementation assigns these responsibilities:
| Source | Responsibility |
|---|---|
src/main.rs | Inherited listener, session startup, and compositor routes |
src/apps.rs and src/apps/shell_child.rs | Application transport, shell supervision, and peer checks |
src/surface.rs | Surface ownership, workspace assignments, and changes |
src/desktop.rs | Browser snapshots, requests, and session termination |
src/forward.rs | Forward application HTTP and WebSocket traffic |
src/live.rs | Serve the shared live-page runtime and icons |
src/settings.rs | Read and validate the shell selection |
page/fenestra.js and page/wm/tiling.js | Browser composition and local window layout |
page/sdk.js and page/keys.js | Live application interaction and raw-page keyboard forwarding |
src/bin/ | Companion taskbar and launcher |
The source repository contains the
implementation and its tests. Contributor instructions belong in
docs/building.md; installed references belong in docs/man and
docs/fenestra.regman.
Session and application boundaries #
GXWI passes a listening descriptor to Fenestra and controls access to it. Fenestra restamps the listener to the session identity. The compositor assumes that incoming session traffic has passed GXWI's authentication and routing boundary; it is not a standalone public web server.
Application connections use a Unix sequenced-packet socket in the session runtime directory. Fenestra compares the connecting account's security identifier with its own and obtains the process identity from the kernel. Shell authority is assigned only to a tracked configured child connection. Requesting a panel, background, or dialog role does not itself confer shell authority. Reaping a shell child and revoking its tracked process ID share the same admission lock, so a recycled ID cannot retain that authority.
The application supplies an HTTP/2 connection for its content. Fenestra
associates it with that application connection and a generated origin
label. GXWI's origin routing keeps pages separated. Fenestra strips
cookies from forwarded requests and Set-Cookie from application responses.
Application-origin requests cannot fall through to compositor routes.
These rules rely on the kernel, GXWI, and browser protections as well as Fenestra. Host unit tests do not establish that those boundaries work in an installed Peios session.
Live and raw pages #
A live surface uses Fenestra's page runtime to display content from the application process and return user actions. Its content security policy permits the runtime script through a response-specific nonce. The application's own scripts are not part of that live-page execution model.
A raw surface serves the application's page and scripts. Its state can be local to one browser page. The shared keyboard-forwarding helper allows that page to participate in desktop shortcuts. Fenestra treats messages from a frame according to the surface and its shell authority.
Resource bounds and failure handling #
An application connection can create at most 64 simultaneous surfaces. Application messages are limited to 64 KiB, and titles are retained up to 128 characters. A truncated application message closes the connection and removes its surfaces.
Surface resource paths start with a single /, exclude the reserved
/.fx/ prefix, and fit a total limit of 1024 UTF-8 bytes. Fenestra rejects
ASCII control characters anywhere in the supplied path. In the pathname
before the first ? or #, it also rejects literal backslashes and
segments that browsers interpret as . or ... This includes
case-insensitive %2e dots and combinations of literal and encoded dots.
Unicode names, ordinary spaces, query strings, and fragments are retained. Dots or backslashes in a query or fragment do not count as pathname traversal. The check does not recursively decode percent escapes or reject dots within longer names. A rejected resource path prevents the surface from being created and is reported without closing the app connection.
Workspace selection, renumbering, moves, and initial surface placement share one session-state lock. Concurrent browser pages cannot split those updates across inconsistent workspace states.
The desktop has up to 16 workspaces. Its change channel retains 256 messages; a lagging browser reconnects for a snapshot. A shell is sent a complete surface list on each change, so a later successful update repairs a missed list. A failed send is reported rather than treated as delivery.
Closing a surface requests cooperation from the application. Fenestra does not claim that a close request has saved work or forced a process to exit. Disconnecting the application removes its surfaces and releases their compositor state.
Animation lifetime #
The arrival animation releases its resize listener when it finishes. A canceled departure animation stops its frame loop, cancels pending timers, aborts its availability request, and releases its resize listener. Each attempt has a generation marker, so callbacks from an earlier attempt cannot update a later attempt's state or redirect its page.
A shell announcement can arrive while the compositor page is checking an address after its socket closes. The page rechecks departure ownership when that probe completes, so the active departure receives the closure instead of starting a competing reconnect path.