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§

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.
LIST_CACHE_TTL 🔒
How long list_cached keeps an answer.

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 Hangar 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: the auth key, the local URL and the jekt key stay on Windows.