Workspace environments
Local and WSL workspaces, the authorization registry, and how cwd flows between tabs.
A workspace environment is the execution context for new tabs - Local on macOS / Linux / Windows, or any installed WSL distro on Windows.
Local
The default on every platform. Tabs spawn against the host shell ($SHELL on Unix, pwsh.exe / powershell.exe / cmd.exe on Windows, in that priority).
WSL on Windows
WSL is a first-class workspace environment, not a wrapped subprocess. The Rust backend talks to wsl.exe to enumerate distros (wsl_list_distros), detect the default (wsl_default_distro), and resolve the user's home inside the distro (wsl_home).
Pick a WSL distro from the workspace switcher in the header. New tabs in that workspace spawn inside the chosen distro, with the distro's shell and the distro's filesystem view.
You can mix in one window: a Local terminal tab in pwsh next to a WSL-Ubuntu tab in bash, with the AI agent reading both contexts.
The last selected WSL distro persists in lastWslDistro in settings.
The authorization registry
workspace::workspace_authorize is the gate every privileged Rust command runs through:
- PTY spawn
- Filesystem reads / writes
- Git commands
- AI tool calls
When you open a new workspace directory, Terax prompts once to authorize it. The grant persists across sessions in the registry. An AI agent cannot read or write a sibling directory you have not explicitly opened.
workspace_current_dir returns the currently active workspace cwd to any module that needs it.
How cwd flows
- The user types
cd somewherein a terminal. - Shell integration emits
OSC 7 file://<host>/somewhereon the next prompt. - The PTY reader on the Rust side forwards it.
- The frontend's OSC handler updates
tab.cwdfor that tab. - The status bar breadcrumb re-renders.
- The explorer root updates if this is the active tab.
- New tabs created from here inherit
cwdviauseWorkspaceCwd.
Canonical path form on the frontend is forward-slash. Windows drive letters are normalized at the boundary (/C:/... -> C:/...).