diff --git a/src/storied/cli.py b/src/storied/cli.py index 3d00387..d305d72 100644 --- a/src/storied/cli.py +++ b/src/storied/cli.py @@ -499,6 +499,9 @@ def cmd_play(args: argparse.Namespace) -> int: console.file.write("\n\n") console.print(f"[dim]{chunk}[/dim]") prev_type = "tool" + elif chunk == "": + # Flush signal from engine (deferred tool starting) + renderer.flush() else: if prev_type == "tool": console.print() diff --git a/src/storied/engine.py b/src/storied/engine.py index bfa5476..69a8516 100644 --- a/src/storied/engine.py +++ b/src/storied/engine.py @@ -439,6 +439,10 @@ class DMEngine: self.character_created = True if short in ("roll", "run_code") and not self.debug: + # Signal the CLI to flush the renderer before we + # wait for tool input (the notification comes at + # ToolStop once we know the reason/description). + yield "" deferred_notification = True elif self.debug: yield f"[→ {short}(...)]"