Give the judge's contract one home in cycle/verdicts.py
This commit is contained in:
@@ -6,7 +6,7 @@ from loop_claude.cycle.archive import archive
|
||||
from loop_claude.claude_code.session import delete_session, Session, session_open, transcript_file
|
||||
from loop_claude.effects import Effects
|
||||
from file_io.failure import Failure
|
||||
from loop_claude.cycle.verdicts import Finished, QuotedAnswer, Unfinished
|
||||
from loop_claude.cycle.verdicts import Finished, Interrupt, QuotedAnswer, Unfinished
|
||||
from loop_claude.cycle.interrupt import interrupt
|
||||
from loop_claude.cycle.judge import judge
|
||||
from loop_claude.project.model_choice import Models
|
||||
@@ -57,8 +57,8 @@ def step(cycle: Cycle, state: Active) -> Event | Stop:
|
||||
return work(cycle, answered)
|
||||
case Judging(transcript_path, _):
|
||||
return rule(cycle, transcript_path)
|
||||
case Interrupting(transcript_path, question, _):
|
||||
return ask(cycle, transcript_path, question)
|
||||
case Interrupting(transcript_path, ruling, quoted_answers):
|
||||
return ask(cycle, transcript_path, ruling, quoted_answers)
|
||||
case Closing(transcript_path, verdict):
|
||||
return close(cycle, transcript_path, verdict)
|
||||
case _:
|
||||
@@ -83,7 +83,8 @@ def rule(cycle: Cycle, transcript_path: str) -> Ruled | Stop:
|
||||
return verdict if isinstance(verdict, Stop) else Ruled(verdict)
|
||||
|
||||
|
||||
def ask(cycle: Cycle, transcript_path: str, question: str) -> HumanAnswered | Stop:
|
||||
def ask(cycle: Cycle, transcript_path: str, ruling: Interrupt | QuotedAnswer, quoted_answers: int) -> HumanAnswered | Stop:
|
||||
question = ruling.question if isinstance(ruling, Interrupt) else f"{ruling.question}\n\n{QUOTE_SOURCES} says:\n{ruling.answer}\n\nThose files have answered {quoted_answers} questions this cycle, the most allowed, so this one comes to you."
|
||||
# Archived now, so the transcript the question was asked on is kept with it; the human's answer then grows the transcript.
|
||||
if failure := archive(cycle.project_key, transcript_path, cycle.task, f"Verdict: interrupt\n\n{question}", cycle.paths):
|
||||
return Stop(1, failure.reason)
|
||||
|
||||
Reference in New Issue
Block a user