From 80c5b5e1fe0e3c1b1c92a3714c2d7c270e669925 Mon Sep 17 00:00:00 2001 From: luijait Date: Sat, 14 Jun 2025 22:48:27 +0200 Subject: [PATCH] Fix virtualization CAI_STREAM=True errors with tool outputs --- src/cai/tools/common.py | 3 ++- src/cai/util.py | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/cai/tools/common.py b/src/cai/tools/common.py index 7bbb00df..e1aac760 100644 --- a/src/cai/tools/common.py +++ b/src/cai/tools/common.py @@ -744,7 +744,8 @@ async def _run_local_async(command, stdout=False, timeout=100, stream=False, cal # The SDK will handle ALL display when CAI_STREAM=false streaming_enabled = os.getenv("CAI_STREAM", "false").lower() == "true" - # Only display if we're in streaming mode AND parallel mode + # Only display panels if we're in streaming mode or parallel mode + # In streaming mode, the Live panels are handled by the streaming system if streaming_enabled and is_parallel: # Display the completed tool output from cai.util import cli_print_tool_output diff --git a/src/cai/util.py b/src/cai/util.py index be905abe..28276842 100644 --- a/src/cai/util.py +++ b/src/cai/util.py @@ -2825,9 +2825,10 @@ def cli_print_tool_output( # Check if we're in a container environment is_container = bool(os.getenv("CAI_ACTIVE_CONTAINER", "")) - # In parallel mode OR container mode, use static panels - if is_parallel or is_container: - # In parallel mode or container mode, use static panels to avoid Live context conflicts + # In parallel mode, use static panels + # For container mode, use Live panels to allow real-time updates + if is_parallel: + # In parallel mode, use static panels to avoid Live context conflicts # Check if we already printed this panel (shouldn't happen but be safe) if call_id not in _LIVE_STREAMING_PANELS: # For container mode with streaming, if this is the initial call but we already