The terminal tool saves the shell's exported variables to hermes-snap-*.sh after every
command so the next command starts with the same environment. Every credential the profile's
.env defines, and every token an agent exported in the shell (a Hermes Cloud service
credential, for one), landed in that file in plaintext and came back after every delete.
Secret exports now leave the file and travel in memory: the dump hands each one to the host
over an inherited pipe, and the next command receives it back as process env. The shell sees
the same variables as before (export in one call, read it in the next), and the file on disk
holds none of the values. A secret is any name the profile's .env or secret sources define,
any credential-shaped name (token/key/secret/password/cookie/webhook/creds/client id, any
case), or a URL-shaped name whose value carries user:pass@. Readonly exports are cleared with
export -n, which unset refuses.
Faster than before: matching runs inside bash with one compgen -X (no per-variable fork, the
cost that made #148406 ~25x slower), the PATH every command composes no longer re-resolves the
tool store per package (~11 ms -> ~1 ms), and the wait loop's first poll tick is 1 ms instead of
5 ms. Median `true` on the local backend: 31 ms on main, 15 ms here.
Local backend on POSIX; Windows (no pass_fds) and remote backends keep their snapshot as it
was, since dropping values there would drop the user's exports from later commands.
Salvages #148406 (fail-closed scrub, readonly handling) and the thread's design on #62336:
scope-driven names from the profile's .env, the missed cookie/webhook/creds shapes, and the
fork-free matching.
Fixes#62336
Co-authored-by: Paul Hill <paulipopshill@gmail.com>
Co-authored-by: Keaton Chia <88001418+kwchia@users.noreply.github.com>
Co-authored-by: Kevin Rajan <7121943+kvnloo@users.noreply.github.com>
Co-authored-by: Yags <166958865+whyyagswhy@users.noreply.github.com>