A 5e storytelling engine with an LLM DM
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Flush renderer word buffer when deferred tools start

The last word before a run_code or roll tool call was hanging in the
renderer's word buffer for the entire duration of the tool execution.
Deferred notifications wait for ToolStop to extract the description/reason,
but nothing was yielded at ToolStart, so the CLI never flushed the renderer.

Now the engine yields an empty string at ToolStart for deferred tools, and
the CLI flushes the renderer when it sees it.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+7
+3
src/storied/cli.py
··· 499 499 console.file.write("\n\n") 500 500 console.print(f"[dim]{chunk}[/dim]") 501 501 prev_type = "tool" 502 + elif chunk == "": 503 + # Flush signal from engine (deferred tool starting) 504 + renderer.flush() 502 505 else: 503 506 if prev_type == "tool": 504 507 console.print()
+4
src/storied/engine.py
··· 439 439 self.character_created = True 440 440 441 441 if short in ("roll", "run_code") and not self.debug: 442 + # Signal the CLI to flush the renderer before we 443 + # wait for tool input (the notification comes at 444 + # ToolStop once we know the reason/description). 445 + yield "" 442 446 deferred_notification = True 443 447 elif self.debug: 444 448 yield f"[→ {short}(...)]"