Best-effort writer for terminal escape/control sequences.
Centralizes the "fire and forget" pattern the CLI uses for cosmetic terminal
control (OSC 9;4 taskbar progress today; eventually OSC 52 clipboard and the
iTerm2 cursor guide). Writes prefer /dev/tty so output reaches the terminal
even when stdout/stderr are redirected, fall back to sys.__stderr__, and
never raise — cosmetic control output must not crash the app.
Set DEEPAGENTS_CLI_NO_TERMINAL_ESCAPE=1 to disable all output (useful for
unsupported terminals or noisy logs).
Return whether env var name is set to a recognizably truthy value.
Unlike bool(os.environ.get(name)), this does not treat "0" or
"false" as enabled. Use this for on/off flags where the user would
reasonably expect VAR=0 to mean "disabled".
Best-effort write of a terminal control sequence.
Prefers /dev/tty so the sequence reaches the terminal even when stdout
or stderr are redirected. Falls back to sys.__stderr__ only if it is a
TTY.
Returns False (no-op) when output is disabled or no TTY is reachable.
Write an OSC <command>;<payload> sequence.
Set the terminal's OSC 9;4 progress indicator.
Fires unconditionally — terminals that don't recognize OSC 9;4 silently
ignore the sequence. Set DEEPAGENTS_CLI_NO_TERMINAL_ESCAPE=1 to opt out
entirely.
Clear the terminal's progress indicator.
Emits OSC 9;4;0;0.
Set the terminal's dynamic default background color with OSC 11.
This is cosmetic and intentionally best-effort. Terminals that don't
support OSC 11 ignore it; OSC 111 is emitted from atexit to restore
the default background when this call succeeds.
Reset the terminal's dynamic default background color with OSC 111.