Follow-ups to freqyfreqy's OSC 7577 support (previous commit), from review:
- One ProgramResumeReporter (hermes_cli/program_resume.py) replaces the two
copies of the report/clear bookkeeping in the classic CLI and gateway chat.
It orders its writes under a lock, the classic CLI choosing its session
under the same lock: the SIGCONT re-report runs on its own thread and must
not land after the user's clear or a session switch.
- The reported command reaches the same home: `-p NAME` when the profile
resolves to this HERMES_HOME (a real profile named "custom" included),
nothing for a home outside the profiles root or under a custom root
(Docker's /opt/data, where `-p default` means ~/.hermes in a fresh
environment), and nothing while attached to a named gateway
(HERMES_TUI_GATEWAY_URL: a fresh launch would open this machine's store).
A --safe-mode or --ignore-user-config launch repeats its flag (gateway chat
takes it from its args: such a launch sets no env opt-in) and is reported
only with a saved session, since a bare restart would need its explicit
model again.
- `--resume ID` is reported only once the session store holds the row; a
fresh session reports the bare command until then.
- The record is cleared only when the user ends Hermes (/quit, Ctrl+D; in
gateway chat Ctrl+D on an empty line is now a /quit binding). A signal,
terminal loss, an exception, a bare EOF and the /update relaunch keep it.
Both clients report again after SIGCONT.
- The token leaves os.environ in load_hermes_dotenv, every entry point's first
env step (before any secret-source command runs), so no child process
inherits it; it is handed back only to the TUI launcher (with a resume
prefix) and the /update relaunch. This replaces per-call-site env stripping.
- Gateway chat honours display.program_resume through its constructor and
reuses one session store for the saved-row check.