Skip to main content

Module isolation

Module isolation 

Source
Expand description

P14 — display filtering and the honest isolation matrix.

Three different things live here, and they are deliberately not the same thing:

  1. --display <id> restricts capture and coordinate conversion to one monitor from DisplayInfo. That is real, works on all three platforms through [crate::backend::capture], and is the only part that changes what the agent can see.
  2. --display virtual on Linux prints the Xvfb recipe and, with --exec, runs a prepared command with DISPLAY set. It never starts a server on its own.
  3. macOS CGVirtualDisplay is probed behind the virtual-display feature and reported as experimental. It is system-visible, it is not a sandbox, and this build never creates one.

Nothing here starts a hypervisor, a compositor, or an X server. See docs/ISOLATION.md for what an operator can set up instead.

Structs§

DisplayTarget
One monitor the rest of the action is confined to.
VirtualDisplayProbe
What the private macOS symbol probe found.

Enums§

DisplaySelector
What --display selected.

Constants§

VIRTUAL_SELECTOR
--display virtual: a separate X server, prepared by the operator.
XVFB_DISPLAY
Display the Xvfb recipe prepares, as DISPLAY=:99.
XVFB_GEOMETRY
Screen geometry the recipe asks Xvfb for.

Functions§

display_target
Build the target for one monitor. A zero-sized monitor is not a target.
ensure_point_inside
Reject a point that the chosen monitor does not cover.
ensure_region_inside
Reject a region that is not fully covered by the chosen monitor.
exec_arguments
Split --exec arguments, dropping a leading -- separator.
exec_prepared
Replace this process with command, running inside the prepared environment. Never returns on success.
find
Find one monitor by id.
infeasible
Everything that is not built, with the reason. Keys and wording mirror docs/ISOLATION.md; the snapshot test in this module is what keeps them from drifting apart.
matrix
The JSON body of computer-use isolation.
parse_selector
Parse --display. virtual is matched exactly, case-insensitively.
platform
target_os as the short name this crate uses everywhere else.
point_inside
True when the virtual-desktop point is inside the monitor.
prepared_env
Environment overrides applied by --display virtual --exec.
probe
Run the macOS symbol probe. Cheap enough for isolation on every call.
region_inside
True when region fits entirely inside the monitor.
resolve
Resolve a numeric --display against the live display list.
virtual_display_compiled
True when this binary was built with --features virtual-display.
virtual_supported
True when this platform has a supported --display virtual recipe.
window_inside
True when the window rectangle is fully covered by the chosen monitor.
xvfb_command
The Xvfb command line the recipe documents and docs/ISOLATION.md repeats.
xvfb_recipe
The recipe as JSON: the exact commands and what this binary does with them.