feat(system): S89: ai_mail view latest + ANSI TTY detection + auto-watchdog hook (DPLAN-0119)

Co-Authored-By: @devpulse <devpulse@aipass>
This commit is contained in:
AIOSAI
2026-04-11 15:41:24 -07:00
co-authored by @devpulse
parent 36a0f4a894
commit 55cf149a95
3 changed files with 44 additions and 14 deletions
+6 -2
View File
@@ -35,10 +35,14 @@ from aipass.cli.apps.handlers.json import json_handler
# NOTE: Cannot import prax here — circular import (prax depends on cli)
# Silent catches in this file are bypassed via .seedgo/bypass.json
# Detect if output is a TTY (interactive terminal) vs piped/redirected
# When piped, disable force_terminal to let Rich auto-detect and strip ANSI codes
_IS_TTY = sys.stdout.isatty()
# Initialize Rich console (lowercase follows service instance pattern)
CONSOLE = Console(force_terminal=True) # Internal constant — force_terminal ensures ANSI colors even when piped
CONSOLE = Console(force_terminal=_IS_TTY) # TTY=colors, piped=plain
console = CONSOLE # Primary export (lowercase service instance pattern)
err_console = Console(stderr=True, force_terminal=True) # Stderr console for error/warning output
err_console = Console(stderr=True, force_terminal=sys.stderr.isatty()) # Stderr auto-detect
# Trigger loaded lazily to avoid circular import
_TRIGGER = None