68 lines
3.1 KiB
Python
68 lines
3.1 KiB
Python
"""The verdicts cycle.judge.verdict_from builds from the judge's reply; cycle.run.rule then stamps every verdict but Finished with the items the chunk takes. They sit outside cycle/, since routing reads them and cycle imports routing."""
|
|
import dataclasses
|
|
|
|
|
|
@dataclasses.dataclass(frozen=True)
|
|
class TakenIn:
|
|
"""The todo.md items the worker names on its latest `Chunk items:` line, as cycle.chunk_items reads them. The item the chunk was routed on counts only where the worker names it."""
|
|
# Their IDs; loop-inbox lists them.
|
|
items: tuple[int, ...] = ()
|
|
# The highest L among them, 0 for none: an escalation steps up from the rung that L picks, and an unfinished verdict also raises the worker to it.
|
|
highest_likelihood: int = 0
|
|
# The highest E + I among them, 0 for none: after an unfinished verdict, it routes the next cycle's judge and reviewers.
|
|
highest_escape_and_impact: int = 0
|
|
|
|
|
|
@dataclasses.dataclass(frozen=True)
|
|
class Interrupt:
|
|
evidence: str
|
|
question: str
|
|
# The judge's quote showing that the worker's cited escalation trigger fired; empty for none.
|
|
escalation: str = ""
|
|
taken_in: TakenIn = TakenIn()
|
|
release_ready: bool = False
|
|
# How many transcript entries the judge read, which escalation_mark.stamped stamps. An escalation the verdict carries moves the route's mark there. None means it was never stamped, and then its escalation doesn't step the worker.
|
|
entries_read: int | None = None
|
|
# What the judge run that gave this verdict cost in dollars, as its reply records; 0 where it records none. The cycle archives it beside the verdict.
|
|
judge_cost: float = 0.0
|
|
# The [human] line from earlier in the chunk that answered the same question, and the words of it that leave the question open; empty for none. cycle.judge.re_ask_checked turns the Interrupt into an Unfinished where the question doesn't quote them.
|
|
answered_before: str = ""
|
|
left_open: str = ""
|
|
|
|
|
|
@dataclasses.dataclass(frozen=True)
|
|
class QuotedAnswer:
|
|
"""The worker asked a question that README.md or the records answer. The answer field quotes the passage."""
|
|
evidence: str
|
|
question: str
|
|
answer: str
|
|
# As on Interrupt.
|
|
escalation: str = ""
|
|
taken_in: TakenIn = TakenIn()
|
|
entries_read: int | None = None
|
|
# As on Interrupt. What the judge run that gave this verdict cost in dollars, as its reply records; 0 where it records none. The cycle archives it beside the verdict.
|
|
judge_cost: float = 0.0
|
|
|
|
|
|
@dataclasses.dataclass(frozen=True)
|
|
class Finished:
|
|
evidence: str
|
|
# As on Interrupt. What the judge run that gave this verdict cost in dollars, as its reply records; 0 where it records none. The cycle archives it beside the verdict.
|
|
judge_cost: float = 0.0
|
|
|
|
|
|
@dataclasses.dataclass(frozen=True)
|
|
class Unfinished:
|
|
evidence: str
|
|
# As on Interrupt.
|
|
escalation: str = ""
|
|
taken_in: TakenIn = TakenIn()
|
|
entries_read: int | None = None
|
|
# As on Interrupt. What the judge run that gave this verdict cost in dollars, as its reply records; 0 where it records none. The cycle archives it beside the verdict.
|
|
judge_cost: float = 0.0
|
|
|
|
|
|
Verdict = Interrupt | QuotedAnswer | Finished | Unfinished
|
|
# The verdicts that may carry an escalation.
|
|
Escalating = Interrupt | QuotedAnswer | Unfinished
|