Skip to main content

Module wsl

Module wsl 

Source
Expand description

WSL terminals (P1 of SPEC_REMOTE_TERMINALS_AND_DURABLE_SESSIONS_2026_10_02.md).

A WSL pane is wsl.exe -d <distro> in a ConPTY: no network, no helper, no durability (the distro’s shell lives as long as its VM, spec §3.3 and §5.5).

Structs§

WslLaunch
What wsl.exe needs to start a pane’s process in a distro.

Constants§

AGENT_IDENTITY_ENV
The agent identity a process started for an agent carries, set by the server from the agent’s definition (spawn_env::identity), not by its caller. Listed in WSLENV when present, so a command run in a distro for an agent names it as one run on Windows does. GH_CONFIG_DIR crosses too, path-translated, as wslenv_with adds it.
FORWARDED_ENV
Environment variables a WSL shell should see from the Windows side. WSL does not pass the Windows environment through; WSLENV lists what crosses. Never the local URL or auth key: those name this machine’s srv, which a shell in the distro has no business calling without the user knowing.

Functions§

launch
The wsl.exe arguments for a pane: an interactive login shell, or the pane’s command run by the distro’s sh. cwd is a path inside the distro; empty means the user’s home.
list
The installed distributions, or none (not Windows, no WSL, or no distro).
list_cached
list, kept for [LIST_CACHE_TTL]: for the places in the Files pane and the editor tree show each time they open, so a slow wsl.exe costs at most one wait per half minute. A connection check uses list, so a distro installed a moment ago is found there.
wslenv
WSLENV with FORWARDED_ENV added to whatever the user already set, without duplicates.
wslenv_with
WSLENV for a process in a distro: the terminal variables, the names its caller set (an agent Shell call’s env, or a pane’s configured cmd:env), and GH_CONFIG_DIR translated to a distro path (/p), so an agent’s plain-gh guard holds inside the distro too and gh there cannot act as the user. Never an AGENTMUX_* variable beyond the terminal ones and the agent id and slug: the auth key, the local URL and the jekt key stay on Windows.