Answer the first round: resume the worker with the records' answer to its question, read docs/decisions.md alone, scope --help's promise
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
import dataclasses
|
||||
|
||||
from loop_claude.cycle.verdicts import Finished, Interrupt, Unfinished, Verdict
|
||||
from loop_claude.cycle.verdicts import Finished, Interrupt, Recorded, Unfinished, Verdict
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class Working:
|
||||
"""The worker runs."""
|
||||
"""The worker runs, resumed with the records' answer when there is one."""
|
||||
answer: str | None = None
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class Judging:
|
||||
transcript_path: str
|
||||
answered_from_records: bool = False
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
@@ -59,11 +61,16 @@ Event = WorkerRan | Ruled | Answered | Archived
|
||||
|
||||
def transition(state: State, event: Event) -> State:
|
||||
match state, event:
|
||||
case Working(), WorkerRan(transcript_path):
|
||||
return Judging(transcript_path)
|
||||
case Judging(transcript_path), Ruled(Interrupt(question=question)):
|
||||
case Working(answer), WorkerRan(transcript_path):
|
||||
return Judging(transcript_path, answer is not None)
|
||||
case Judging(_, False), Ruled(Recorded(answer=answer)):
|
||||
return Working(answer)
|
||||
# The worker asked again after the records' answer, so the answer did not settle it.
|
||||
case Judging(transcript_path, True), Ruled(Recorded(question=question)):
|
||||
return Interrupting(transcript_path, question)
|
||||
case Judging(transcript_path), Ruled(Finished() | Unfinished() as verdict):
|
||||
case Judging(transcript_path, _), Ruled(Interrupt(question=question)):
|
||||
return Interrupting(transcript_path, question)
|
||||
case Judging(transcript_path, _), Ruled(Finished() | Unfinished() as verdict):
|
||||
return Closing(transcript_path, verdict)
|
||||
# The human works in the interrupt's claude session, so the judge rules again on the transcript it leaves.
|
||||
case Interrupting(transcript_path), Answered():
|
||||
|
||||
Reference in New Issue
Block a user