V2 terminal env
Merged
KI
8mo ago+1981+1981+0123456789012345678901234567890123456789-126-126-012345678901234567890123456789
Description
Related Issues
Type of Change
- Bug fix
- New feature
- Documentation
- Refactor
- Other (please describe):
Testing
Screenshots (if applicable)
Additional Notes
Summary by cubic
Builds the v2 terminal env end to end. Adds theme‑aware color hints and a macOS TLS cert fallback, and locks PTYs to a preserved, shell‑derived base env for reliable CLI behavior.
-
New Features
- Host‑service terminal env module with clean shell snapshot resolver/cache, runtime env stripping, UTF‑8 locale, shell launch config, and v2 PTY env builder; exported as
@superset/host-service/terminal-env. - PTYs are built from the preserved snapshot (never live
process.env), injectTERM_PROGRAM=Superset/version, UTF‑8LANG,PWD, v2 metadata (SUPERSET_TERMINAL_ID,SUPERSET_WORKSPACE_ID/_PATH,SUPERSET_ROOT_PATH,SUPERSET_ENV,SUPERSET_AGENT_HOOK_PORT/_VERSION), and preserve user tooling likeSSH_AUTH_SOCK; non‑Windows falls back to/bin/sh. - Shell launch config: zsh via
ZDOTDIRwrapper, bash rcfile or-l, fish--init-command; unsupported shells launch natively. - Renderer passes the active theme type when opening a terminal; PTYs set
COLORFGBG(dark by default, light when requested). On macOS, PTYs setSSL_CERT_FILE=/etc/ssl/cert.pemwhen available to avoid Keychain TLS issues.
- Host‑service terminal env module with clean shell snapshot resolver/cache, runtime env stripping, UTF‑8 locale, shell launch config, and v2 PTY env builder; exported as
-
Tests
- New host‑service tests cover base env preservation, denylisted env stripping (
ELECTRON_*,npm_*,VITE_*,HOST_*), UTF‑8 locale, shell args/bootstrap, fallback behavior, v2 metadata, theme hinting, macOS cert fallback, and fail‑closed when the snapshot is missing. - Desktop tests verify concurrent start dedupe and that host‑service spawns use the shell‑snapshot env plus explicit keys (
SUPERSET_HOME_DIR, hook port/version,DESKTOP_VITE_PORT, auth/cloud) without leaking dev/Electron/runtime secrets.
- New host‑service tests cover base env preservation, denylisted env stripping (
Summary by CodeRabbit
- Documentation
- Added a v2 terminal environment specification describing shell integration, PTY env contract, allowed metadata, and locale/TERM defaults.
- New Features
- Terminals now use a preserved shell-derived base snapshot plus explicit terminal/agent metadata rather than inheriting live runtime env.
- Bug Fixes
- PTYs launch deterministically with configured shells, fail closed on unresolved shell env, and no longer leak runtime secrets or legacy vars.
- Tests
- New tests cover shell resolution, UTF‑8 locale selection, env filtering, bootstrap args, and the v2 PTY contract.