Galaxy Shell / docs
Docs / Histórico

River: experimental integration

openspec/changes/archive/2026-10-26-river-development/design.md · Editar no GitHub ↗

Esta página ainda não tem tradução em português. O conteúdo abaixo está em inglês.

Este documento registra decisões, planejamento ou evidências de uma etapa do projeto. Não implica que todos os itens estejam implementados ou validados na versão atual.

Nesta página

River: experimental integration

Doc status: history. River was removed from the product on 2026-10-27; see docs/smithay-development.md and docs/project-loading.md. Checked 2026-11-10.

Later direction of 2026-10-27: River was removed from the future architecture by decision of the project owner. Its removal from the code and the installation is still pending. This document stays as history and as a reference for the existing backend. The session coordination rules remain valid for Smithay. See current decisions.

The project owner authorized real integration with River on 2026-10-26 and later asked to restart the interface with only one central chat. The host keeps a single protected send field, visually integrated. Recovery lives in the Electron menu and in /recovery.

Architecture

native/river/main.c derives from tinyrwm C, with grid and IPC. It binds river-window-management-v1 version 4 and river-xkb-bindings-v1 version 1. It does not use riverctl or river-classic. The core starts this WM only with AGENT_NATIVE_RIVER=1. The Electron conversation takes part in the grid as a normal Wayland window, together with the external applications.

The process publishes the IDs of this run, titles, app IDs, focus, and positions and sizes confirmed by the clients. Focus, closing and size proposals run during manage. Presentation finishes during render. The IPC uses private stdin/stdout pipes, with no generic shell. The bridge accepts only live IDs, tile/monocle layouts and launches of fixed applications. The generated HTML still has no token, Node, network or access to the WM.

The conversation agent receives desktop_state, open_application, window_action and arrange_windows through the authenticated MCP. It can open Chrome/terminal, place them to the right of the conversation, query windows, focus, expand and arrange them in a grid. Launches wait for a real window and applied geometry before they report success. There is no generic shell, no mouse/keyboard control and no automation of application content. The generated HTML does not receive these tools.

Running

Dependencies: modern River with external WM protocol version 4+, Node 22+, OpenCode, a C compiler, pkg-config, wayland-scanner and headers of wayland-client/xkbcommon. On Ubuntu, the client dependencies are build-essential pkg-config libwayland-dev libxkbcommon-dev. River has its own dependencies and is not in the default Ubuntu 24.04 repository.

native/river/build.sh
cd web-shell
npm ci
cd ..
scripts/river-session.sh --nested

Nested mode requires an existing Wayland session and uses the Wayland backend and pixman by default. It opens a River desktop inside the current session, without assuming GNOME windows.

  • Super+Space: open the Foot terminal.
  • Alt+Tab or Super+Tab: switch focus. The external desktop can intercept shortcuts in nested mode.
  • Super+Q: request closing of the focused window.
  • Super+drag with the left/right button: move/resize and enter manual layout.
  • Super+Escape: exit River. Save the work of the applications first.

The initial state is a grid on the first active output. Other outputs have no distribution policy in this delivery. The bridge has tile/monocle commands, with no visible controls strip in the chat, by choice of the project owner.

Local configuration: AGENT_NATIVE_RIVER_BIN, AGENT_NATIVE_TERMINAL_BIN, AGENT_NATIVE_DATA_DIR. No executable comes from messages or generated documents. Browser launch is limited to Google Chrome, with an isolated profile and native Wayland. Foot must be in the PATH or at the configured path.

AGENT_NATIVE_RESET_UI=1 recreates only the interface from the seed at the next start, archives the previous snapshot and preserves the conversations. Do not use it during an active response.

An independent session can start from a TTY, outside the graphical desktop:

scripts/river-session.sh --session

This mode requires a compatible seat/logind, DRM and GPU. No file was installed in the login manager and the GNOME configuration was not changed.

Evidence and limits

On Ubuntu 24.04, River 0.5.0 and Foot 1.28.0 were provisioned in a local runtime without sudo. River started with pixman, opened Electron on Wayland and registered the conversation and two real terminals. The protocol/API proof confirmed a grid of three windows, a focus change, monocle expansion, the return to the grid and the closing of one terminal. Outside River, the helper refuses GNOME because the protocols are missing.

The user confirmed that the window opened. Automated visual inspection and tests of TTY, DRM/GPU, multiple monitors, screen lock and physical shortcuts were not completed. River logged some client timeouts during the changes. Fluidity and performance are not approved. It is not yet a complete desktop with integrated portals, power, audio and notifications.

The Node tests check the existing protections and the rejection of arbitrary actions and stale IDs in the bridge. The C code compiles with warnings treated as errors. OpenCode acted as a subagent, with review and integration by the supervisor.

Sources and licenses

Application window frames

External windows receive a bar drawn by the WM on river_decoration_v1 surfaces, with wl_shm buffers and Cairo/Pango. Galaxy Shell and its recovery are explicitly left without a frame, and the Electron host is frameless when it runs on River. Do not apply the bar to the shell as if it were another application.

Close asks the client to close; it does not kill the process. Minimize hides the window and keeps the application running. A bottom strip lets you restore each minimized window; Super+Shift+M restores the last one. Maximize fills the usable area, and the button toggles back to the previous layout. In manual layout, the previous size and position are preserved.

Configurações > Moldura dos aplicativos (Settings > Application window frames) offers colors, a height between 24 and 56 pixels, symbols/circles and buttons on the left/right. Preferences persist in state.json and are sent to the WM by typed IPC. The MCP set_window_style allows the same customization through the conversation without running code in the frame. Clients that only support CSD can keep their own controls; use_ssd cannot remove decorations that the client does not allow to be turned off.

Additional client dependencies: cairo, pangocairo and wayland-cursor (Ubuntu: libcairo2-dev libpango1.0-dev, plus libwayland-dev). Run native/river/test.sh to compile with warnings as errors and to check clickable areas, button mapping, theme limits, the shell exemption and Cairo/Pango drawing.

In the real River session, frames were confirmed for Chrome and Foot, and the absence of a frame on the shell. The protocol/API proof exercised maximize/restore, minimize/restore without restarting the application, the minimized strip, a theme change at runtime, persistence and the closing of a synthetic terminal. The buttons use the same native dispatch as these operations. Physical clicks and automated visual inspection were not run because the desktop surface is not available to automation in this session.

Session with diagnostics

After scripts/agent-native-session-dbg is installed in /usr/local/bin, run agent-native-session-dbg on the TTY. It calls agent-native-session with WLR_RENDERER=pixman and appends stdout/stderr to /tmp/ans-tty4.log, with the start date. AGENT_NATIVE_DEBUG_LOG lets you choose another file. The exit status of the main command is preserved. The capture was checked with a synthetic command. Starting the real DRM session still depends on a test on the active TTY.

Electron without sandbox in the River session

At the explicit request of the project owner, river-shell.sh starts Electron with --no-sandbox. The host reflects this option in webPreferences.sandbox. This works around the failure of the SUID helper chrome-sandbox on Ubuntu, but it disables the Chromium process sandbox in the River session. Node integration stays disabled, and context isolation and the navigation/network restrictions stay active. Desktop execution outside this launcher keeps the sandbox by default. The earlier descriptions of a mandatory sandbox do not apply to this River execution.

The host starts the core before app.whenReady, to connect the external WM before Electron waits for the Wayland screen initialization. The window is created only after app.whenReady and the local URL are available. In the TTY4 attempt, the core answered ready=true and OpenCode connected after the change. The session was inactive in logind during the inspection, so the visual presentation on the monitor is still pending.

Local wallpaper

The WM reads wallpaper.png from the AGENT_NATIVE_DATA_DIR directory when it initializes the background layer. It creates one River surface per output, below the windows, with no input region. The image fills the screen with the aspect ratio preserved and a center crop. Geometry changes redraw the buffer, with no continuous redrawing of the background. It is not an application window and not a change to the chat HTML. The personal image and its PNG conversion stay out of Git.

The implementation compiled with warnings treated as errors; the Cairo test uses a synthetic image to check the fill and the center crop. The 32 Node tests passed. The image was prepared in the local profile and the TTY4 host was restarted, but the inspection took place with TTY2 active: visual confirmation on the monitor is still pending. There is not yet an MCP tool to select the wallpaper through the product conversation.

Installed applications, files and transparency

The project owner widened the scope: the agent must act on behalf of the user to start applications and open files. list_applications enumerates .desktop shortcuts of the user, the system, Flatpak and Snap. The core resolves the returned IDs again before it starts /usr/bin/gio launch with the installed file. The agent does not supply executables or arguments. browser and terminal stay as specific shortcuts. A new window must match the app ID declared by the shortcut before its position is confirmed. Applications that reuse an instance in GNOME or depend on X11 may not create a window on River; the timeout reports this limitation.

list_directory lists up to 500 names per folder, without reading content. open_path resolves an existing local path and asks for it to be opened via gio open. dispatched=true means only that the request was accepted; windowConfirmed=false prevents you from treating this as visual confirmation. These tools belong to the authenticated agent, never to the HTML documents. This does not yet implement arbitrary operations, file editing or automation of application content.

On River, the Electron window and the root backgrounds of the host and of the editable iframe become transparent. The rule is also applied to the revisions that are already persisted, without deleting customizations or the conversation. Messages and send keep dark panels for contrast; recovery stays opaque. Outside River the dark background stays. The browser inspection confirmed the controls. Transparency composed over the wallpaper depends on visual verification of the Electron session.

Verification: formatting, syntax analysis and 34 Node tests passed. Synthetic tests check the precedence of hidden shortcuts, reading of the correct section, unknown IDs and local paths. The real catalog found 44 options on this machine. This is not proof that every application supports Wayland, and it is not a test of every file association.

Execution without a required catalog

The project owner explicitly authorized any executable. open_application accepts a name in the PATH or an absolute path, arguments as a list and an optional cwd. list_applications is only discovery; no prefix or prior query is required. Executables start with spawn, with no implicit shell parser. The shell itself is an allowed executable when requested with its arguments. Processes have the privileges of the user and get no additional isolation from this tool. It returns PID, status, exit code and up to 8 KiB of recent output from each stream during the initial check. Programs without a window and singleton applications can start without a new window; windowConfirmed tells these cases apart. Running processes have no later output query in this version. No capability to control mouse/keyboard was added.

Installation without paths from the development machine

agent-native-session resolves its own link and finds the matching release. The launchers contain no user paths and not the old Projetos/.runtime folder. scripts/install.sh installs to ~/.local by default, or to an absolute --prefix, using a temporary release and a link swap after npm ci, the Electron installation and the native compilation succeed. Node and OpenCode are copied as executables to runtime/; no credential or profile data is copied. Direct use of the sources requires Node/OpenCode in the PATH or the explicit variables.

The bin/ commands point by relative links to lib/agent-native-os/current/scripts/, and current points to a relative release. The prefix can be moved as a whole, on the same platform and with a compatible ABI. River must exist at the destination; the graphical libraries and drivers are not assumed to be packaged. The installer refuses to overwrite an existing regular command. Updates preserve earlier releases and the whole profile outside the installation.

The catalog uses XDG_DATA_HOME/XDG_DATA_DIRS and local Flatpak/Snap exports. The browser is discovered through the XDG settings, with no fixed /usr/bin/google-chrome. A compatible Chromium keeps a separate River profile; other browsers are dispatched through the default desktop shortcut. gio is resolved in the PATH. The debug log moves to the XDG state directory, with no reference to TTY4.

Proof: a real installation in a prefix with spaces, the move of that prefix, and a start with a minimal PATH and a synthetic compositor passed. The 36 Node tests include resolving links after the move and use of the packaged runtime. WM compilation and Electron installation were run. This does not prove compatibility with another distribution, GPU or architecture.

Resumption and real test on TTY4

On 2026-10-26, the previous TTY4 session was ended and recreated by the independent installation in /usr/local. A transient systemd unit agent-native-tty4-test.service, with login PAM and TTYPath=/dev/tty4, started agent-native-session-dbg. No boot service was installed and the login manager was not replaced. logind confirmed TTY4 active with a new session. The log is at ${XDG_STATE_HOME:-$HOME/.local/state}/agent-native-os/session-debug.log.

Through the protected conversation UI, using the same core as the real session, two synthetic requests were sent to the model selected via OAuth:

  • Open a terminal on the right: the tool created an agent-native-terminal window and confirmed geometry and pair layout.
  • Start /usr/local/bin/foot directly, with no alias and no catalog query: a distinct foot window was created, confirmed and placed to the right of the conversation.

The WM state confirmed the real windows and their positions. The conversation finished with a reported cost of 0. The test terminals stayed open in the session for inspection; the previous history was preserved. The attempt to open the installed application as ChatGPT/Codex did not confirm a new window on River, so it does not count as a successful opening. Singleton applications that are already in another compositor remain a limitation to investigate.

The WM logged the loading of the local wallpaper and drawing at 1366x768 on output eDP-1. In the browser UI connected to the same core, computed styles confirmed transparent backgrounds on the host and on the editable iframe. This proves dispatch, geometry, background drawing and content transparency. It does not replace a visual capture of the native composition on the monitor, which was unavailable to automation in this session. Frame timeouts, text-input warnings and DRM errors still appear during VT switching; performance and the transition between VTs are not approved. No personal image, capture, log, credential or conversation snapshot was added to Git.

Shared session coordination

<a id="tty4-coordination"></a>

TTY4 is the historical reference of this section; discover the current target, per AGENTS.md. Later proofs record GDM/TTY2 and experimental Smithay. This rule does not authorize switching the session or starting a parallel desktop.

The existing session in use is the shared target. Worktrees isolate code; they do not imply creating another desktop. Before you publish to the runtime, identify the session with loginctl, the compositor and its descendants with ps, the effective supervisors/units and the release that runs. The unit agent-native-tty4-test.service is a historical hint, possibly absent. The core announces its URL in the log. Querying /api/state with the token obtained from the protected page, without printing or saving that token, lets you confirm ready, busy and the WM. Do not save conversation snapshots as evidence.

The current coordination uses ${XDG_STATE_HOME:-$HOME/.local/state}/agent-native-os/coordination.log, shared by all worktrees and outside Git. It does not need a coordinator chat. Before any operational change, read the log and acquire with flock -n the exclusive sibling lock coordination.lock, and keep it until you finish the operation and record its result. If the lock is busy, continue only independent code work. After you get it, reread the log and check the real services/processes. Append records of start, completion or blocking with time/timezone, responsible party, commit/release, target and result; protect each append with flock on the log file. Do not record credentials or conversations; do not read the log as authorization. The complete rules are in AGENTS.md. Before the switch, confirm busy=false and record only the IDs needed to check continuity. Use the same AGENT_NATIVE_DATA_DIR and the same Wayland socket as the identified session. A release installed in another prefix does not change running processes. When only the shell changed, replace host/core inside the existing compositor and preserve the external applications. A WM update needs its own planning.

The /usr/local installation is owned by root. Without effective access to update it, use a user release for the host in the same River session and record that difference. Do not present this switch as an update of the /usr/local link or of the boot unit. The current unit is transient, not a boot service. Do not start a nested session to work around the lack of access to the prefix.

Keep separate the evidence of a browser connected to the shared core, of an Electron host connected to the compositor of the identified session, and of physical inspection of the composition. Browser automation does not prove audio capture, shortcuts or presentation on the monitor. When isolated tests finish, shut down the QA processes you are responsible for.

Operational correction on 2026-10-26

The main branch received coordination rules in AGENTS.md. The clock, voice and memory chats were told to use TTY4 and to centralize updates. The responsible chat ended the nested River voice test session.

The original TTY4 compositor stayed running, as did the two existing Foot processes. With no sudo available to change /usr/local, only Electron/core were replaced by the release release-NJeFK3m6 already installed in ~/.local, with the same river-shell profile and socket wayland-2. The new host is supervised by the transient user unit agent-native-tty4-shell.service (systemctl --user). The compositor stays in the system unit agent-native-tty4-test.service. This did not update the /usr/local launcher and did not create a boot service. In a full manual restart of the compositor, you must select the current release to avoid going back to the old host.

Proof in the browser connected to the TTY4 core: existing history, clock and the Voz (Voice) button present, without creating a new conversation. Proof of the Electron host and the system: WM connected, Electron window registered, two terminals preserved and the compositor with the same PID and start time. The core confirmed ready=true, busy=false and the selected OpenCode model with OAuth. No new turn was needed. Composition on the monitor and microphone capture were not checked. npm ci, format:check, check and the 42 Node tests passed before the rules were published.

Clock independent of the conversation

The clock is now a river_shell_surface_v1 surface per output, anchored in the top right corner and placed above the windows in each render sequence. It does not belong to Electron, does not receive focus and has an empty input region: clicks still reach the window below. It shows the local time as HH:MM, with an icon and an 88x36 px panel. It redraws only when the minute or the theme changes. The Wayland loop wakes at the next minute change, even without IPC messages or window interaction.

The grid and monocle mode reserve 48 px at the top so they do not cover frames and controls. In manual layout, the chosen positions are preserved and the clock stays above them. The state of the outputs includes clock.visible and the geometry of the surface for diagnostics; this confirms buffer publication, not physical inspection on the monitor. The HTML clock is hidden on River and stays fixed in browser mode.

Compilation with warnings treated as errors and the Cairo/Pango tests passed, including transparent corners, text/icon and the timer limit. Activation and proof on TTY4 depend on the release of the operational lock that was busy during this review. Do not start another compositor to validate this change.

Activation of the UI revision on TTY4

After the migration released the lock, main 4693d13 was installed in the local release release-sGxZ6sw1. The transient user unit agent-native-tty4-shell-ui.service started supervising host/core, with KillMode=process, the same river-shell profile and socket wayland-1. Only the previous host was stopped. The River compositor PID 314875 and the Chrome PID 338879 kept their PIDs and start times. The installation in /usr/local was not changed.

Before/after comparison: 5 conversations and 43 messages, active conversation, full history content, customized UI bundle, model and frame preferences were identical by hash. Core ready=true, busy=false, no pending change, WM connected. No new message to the provider was needed. The seed did not overwrite the existing customized interface.

On TTY4, temporarily active, the WM published the clock on the 1366x768 output at x=1266, y=12, size 88x36. When the real Chrome was maximized, the surface stayed published at the same position. The previous restore and focus were reapplied without closing the application. TTY2, originally active, was reactivated after the check. This proves the protocol sequence and buffer publication; physical composition on the monitor was not captured.

In the browser connected to the real core, six SVG icons, accessible settings, reserved space between history and send, and the absence of a duplicate HTML clock were checked. Electron, core and helper were confirmed on the new release. Formatting and syntax checks passed. The first run, concurrent with the installation, had two timeouts in the recovery tests; the sequential repetition passed all 58 tests, without changing code. The native build passed with warnings treated as errors.

Proven native capture

The direct TTY4 capture through Wayland was completed with grim on 2026-10-26, without restarting the compositor. See the reusable flow for session/socket discovery, a temporary client without sudo, coordination, private capture and inspection. The capture limitations recorded in the earlier proofs describe those runs; they do not mean that capturing the desktop is impossible now.

Global strip aligned with the clock

The sessions strip is now a separate protected window, Agent Native Desktop, loaded at /desktop-sessions by the existing Electron, with an isolated renderer and no editable project or generated components. The WM keeps it out of tiling, without a frame, above the applications and out of the Alt+Tab cycle. The agent tools cannot close, minimize or expand it. The list of archived sessions is shown in the protected chat, which receives focus when needed.

On the first active output, the strip sits at x=12, y=10, with a width equal to the output width minus 124 and a height of 40. Its vertical center and that of the buttons match the clock at y=12, height 36. The chat does not draw another strip in River mode; the development browser keeps local navigation. This strip stays global when you switch the conversation workspaces.

The local release release-Nkau4foz was validated on TTY4, logind session 56, socket wayland-1 and profile river-shell. The user unit agent-native-tty4-shell-dashboard.service uses KillMode=process. The restored compositor PID 357531 kept its PID and start time; only host/core/helper were replaced. Host PID 369620, core 369640 and helper 369690 were confirmed on the release. Core at http://127.0.0.1:42389 with ready=true, busy=false and confirmed OAuth. The empty panel shows real samples and the subscription quota. A direct capture with grim confirmed the alignment and the composition. TTY4 stayed active. /usr/local was not updated and the private captures stayed out of Git.

Windows per conversation

Each conversation uses its persisted ID as a workspace in the WM. New windows belong to the active conversation; dialogs inherit the association of the parent window. Switching tabs hides the windows of the previous conversation and shows again those of the selected one, without closing, minimizing or suspending the processes. Chat, sessions strip and clock stay global.

The core persists stable identifiers of the River protocol in workspace-windows.json in the profile, written atomically. When the WM reconnects, it associates the local IDs with the conversations again. The selection is published only after the workspace is confirmed and no visible window of another conversation remains. Window tools reject actions on applications of an inactive conversation.

Organization mode, window pair, maximization and focus are remembered per workspace while the WM runs; exact geometry is not persisted across restarts. References to closed windows are removed from the saved layouts. New windows receive the association immediately, without blocking the first size configuration.

Validation: native tests of association, selection and layouts, Node tests of persistence and WM confirmation; on TTY4, existing Chrome and a QA terminal in different conversations, switching with maximization and restoration, native capture and continuity of the processes without restarting the compositor.