Name the loop's states with one transition function, and inject its side effects

This commit is contained in:
2026-10-01 23:12:37 +02:00
parent d0ce3b2690
commit f385b563f0
16 changed files with 469 additions and 126 deletions
+2 -4
View File
@@ -1,5 +1,3 @@
import sys
from loop_claude.outcome import Stop
@@ -7,7 +5,7 @@ def stop(to, but) -> Stop:
return Stop(2, f"the human is needed to {to}, but {but}")
def off_terminal(to) -> Stop | None:
if sys.stdin.isatty() and sys.stdout.isatty():
def off_terminal(to, on_terminal: bool) -> Stop | None:
if on_terminal:
return None
return stop(to, "stdin or stdout is not a terminal; rerun loop-claude on a terminal")