From 161ddee1386984b7b8939540897c6daad812a1da Mon Sep 17 00:00:00 2001 From: dullfig Date: Sun, 11 Jan 2026 14:42:25 -0800 Subject: [PATCH] Add debug output to trace console routing --- handlers/hello.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/handlers/hello.py b/handlers/hello.py index 9265627..7aab6cd 100644 --- a/handlers/hello.py +++ b/handlers/hello.py @@ -125,18 +125,19 @@ async def handle_response_print(payload: ShoutedResponse, metadata: HandlerMetad Print the final response to the console. Routes output to the TUI console if available, otherwise prints to stdout. - With TUI, stdout is patched so prints appear in the output area. """ console = None try: from run_organism import get_console console = get_console() - except ImportError: - pass + except ImportError as e: + print(f"[DEBUG] ImportError: {e}") - if console is not None and hasattr(console, 'on_response'): - # Use TUI's output buffer directly (preferred) - console.on_response("shouter", payload) + if console is not None: + if hasattr(console, 'on_response'): + console.on_response("shouter", payload) + else: + print(f"[DEBUG] console has no on_response: {type(console)}") else: - # Print to stdout (TUI patches this, simple mode shows directly) + print(f"[DEBUG] console is None, printing to stdout") print(f"\033[36m[response] {payload.message}\033[0m")