Annotate the return type of every function in loop_claude
This commit is contained in:
@@ -4,7 +4,7 @@ from loop_claude.claude_code.session import Session, delete_session, transcript_
|
||||
from loop_claude.claude_code.transcript import read, render
|
||||
from loop_claude.cycle.archive import archive
|
||||
from loop_claude.cycle.interrupt import interrupt
|
||||
from loop_claude.cycle.judge import judge
|
||||
from loop_claude.cycle.judge import Verdict, judge
|
||||
from loop_claude.cycle.retry import retried
|
||||
from loop_claude.cycle.worker import run_worker, worker_args
|
||||
from loop_claude.outcome import Failure, Stop
|
||||
@@ -23,7 +23,7 @@ class Cycle:
|
||||
task: str
|
||||
|
||||
|
||||
def run_cycle(cycle):
|
||||
def run_cycle(cycle) -> Stop | None:
|
||||
if stop := retried("worker", lambda: run_worker(cycle.root, worker_args(cycle.task, cycle.session, cycle.models.worker, bool(transcript_file(cycle.session))))):
|
||||
return stop
|
||||
path = transcript_file(cycle.session)
|
||||
@@ -36,9 +36,10 @@ def run_cycle(cycle):
|
||||
if failure := archive(cycle.project, path, f"Task: {cycle.task}\n\nVerdict: finished", cycle.paths):
|
||||
return Stop(1, failure.reason)
|
||||
delete_session(cycle.session)
|
||||
return None
|
||||
|
||||
|
||||
def judge_through_interrupts(cycle, path):
|
||||
def judge_through_interrupts(cycle, path) -> Verdict | Stop:
|
||||
# The interrupt appends to this transcript, so each pass judges and archives it anew.
|
||||
while True:
|
||||
entries = read(path)
|
||||
|
||||
Reference in New Issue
Block a user