Skip to main content

Architecture

MonoSurf separates browser ownership, page automation, reusable site contracts, and safety checks so each result says which layer produced it. Verified against monosurf 0.11.3, OpenCLIs build 2026-07-19-222928.

System Map

The normal page-control path is Rust-native and connects directly through CDP. Standalone monosurf and kernel-cli websurf are frontends over the same facade and core, so they share help, docs, the profile TUI, the profile registry, plugins, grants, and browser state. Kernel CLI links this stack in-process; it does not spawn the standalone CLI. The engine can use Chromium installed by Chrome, Playwright, Puppeteer, or a headless-shell distribution without turning those packages into the control layer.

Four Architecture Planes

Session Ownership

Ownership determines what happens at the end of a command: This boundary prevents an attach command from accidentally terminating an Electron app or browser it did not launch. For managed profiles, MonoSurf 0.11.3 proves listener ownership from the process command line’s exact --user-data-dir argument. New profiles skip active unregistered ports and keep the exact chosen port through launch proof and cleanup. A foreign listener blocks start and profile-backed connection; stop signals only a listener proven to belong to that profile. Temporarily unknown OS metadata is retried for a bounded interval, then fails closed. Explicit browse --cdp-url <endpoint> is the separate, intentional foreign- attach path and never transfers lifecycle ownership to MonoSurf.

Identity and Profile State

Bookkeeping and login state are intentionally different. doctor --fix can remove stale process records or temporary debris without deleting a managed profile. profile rm and doctor --prune are the explicit destructive boundaries.

Login Snapshot Boundary

MonoSurf can hold session evidence in two encrypted owners: This design keeps server-rotated tokens current while retaining a protected bootstrap path. It does not claim that a grant erases browser state; grants authorize site-command access to the protected capability. Bridge import is cookie-only. The batch hydration runs before navigation, validates every cookie scope, supplies an explicit HTTP(S) origin, preserves domain/path/HttpOnly/Secure/SameSite/expiry, and fails the command on any CDP error. It never clones localStorage, IndexedDB, service workers, passwords, a Chrome profile, or the Chrome process. Full Agent Browser state uses the separate same-profile managed-login path.

Direct Browse Data Flow

Network listeners start before navigation so the main document and early subresources are not missed. Collection emits items incrementally, while single-shot outputs use an atomic replace.

Site Plugin Data Flow

Plugin commands remain data-defined, but they execute inside a logged-in page. Local checksums block unsigned or changed local code until it is reviewed and re-signed. Official pulls add server signature verification before replacement.

Trust Gates

Operational Evidence

MonoSurf exposes health and regression checks as part of the architecture:

Companion Boundary

The shared web engine ends at the CDP-visible page. Kernel CLI owns browser chrome, native dialogs, permission prompts, accessibility, input, windows, and other desktop applications. Embedding the engine gives one binary two clearly owned surfaces; it does not make AX/OCR and CDP one blended driver. The standalone 0.11.3 artifact and Kernel CLI 0.26.8 both expose the same facade/engine contract, collision-safe ownership, cookie hydration, and postcondition surfaces. Their executables are not byte-identical; independently published artifacts share behavior and state without collapsing release identity. Cookie bridge installation additionally depends on the shared ~/.niia/bin/monolex-native-host staged by Monolex desktop; neither standalone CLI archive bundles it. See OpenCLIs Vault, MonoPass, and the Monolex CLI Agent Browser surface for the adjacent ownership boundaries.

Release Proof Layers

Keep these facts separate when validating a MonoSurf release:
  1. Source and embedded docs describe intended behavior.
  2. OpenCLIs CDN latest.json names version 0.11.3 and build 2026-07-19-222928; immutable meta.json owns platform hashes.
  3. The OpenCLIs API owns description, docs links, AI use, and wrapper guidance.
  4. The installed path proves which artifact runs.
  5. monosurf version proves the binary version.
  6. doctor, self-tests, and a real browse command prove the current runtime.

How It Works

Follow session selection, login-state resolution, page work, and cleanup.

Usage and Command Reference

Run the supported command families and option groups.

Auth Gate

Understand grants, live sessions, snapshots, and revocation.

Kernel CLI Reference

Continue the workflow outside the browser page.