Retire the section-headers decision, reject an interrupt without a question, and name file_writes by what it does
This commit is contained in:
@@ -6,7 +6,7 @@ from loop_claude.checkout import project_name
|
||||
from loop_claude.interrupt import interrupt
|
||||
from loop_claude.judge import judge
|
||||
from loop_claude.outcome import Continue, Failure, Retry, Stop
|
||||
from loop_claude.private_file import make_private
|
||||
from loop_claude.file_writes import make_private
|
||||
from loop_claude.session import delete_session, session_for, transcript_file
|
||||
from loop_claude.transcript import read, render
|
||||
from loop_claude.worker import run_worker, worker_args
|
||||
|
||||
@@ -27,5 +27,5 @@ def interrupt(root, session_id, model, path, question, paths):
|
||||
if isinstance(entries, Failure):
|
||||
return Stop(1, f"could not tell whether you typed anything: {entries.reason}")
|
||||
if human_turns(entries) <= before:
|
||||
return human.needed(TO, "the interrupt ended without you typing anything")
|
||||
return human.needed(TO, "the interrupt ended with nothing typed")
|
||||
return None
|
||||
|
||||
@@ -85,9 +85,10 @@ def judge_prompt(task, premises, transcript):
|
||||
|
||||
|
||||
def complete(verdict):
|
||||
return isinstance(verdict, dict) and all(
|
||||
typed = isinstance(verdict, dict) and all(
|
||||
isinstance(verdict.get(name), bool if JUDGE_SCHEMA["properties"][name]["type"] == "boolean" else str) for name in JUDGE_SCHEMA["required"]
|
||||
)
|
||||
return typed and not (verdict["interrupt"] and not verdict["question"].strip())
|
||||
|
||||
|
||||
def grounded(verdict, transcript):
|
||||
|
||||
@@ -14,9 +14,10 @@ Exit 1: no task, not inside a checkout, no premises, a models file it cannot rea
|
||||
leaves no transcript or one it cannot read, claude cannot start for an interrupt, a reload with
|
||||
unreadable state, or the worker or the judge fails three times running. A worker fails when claude
|
||||
cannot start, exits non-zero, is killed, or ends without a result event; a judge when claude cannot
|
||||
start or exits non-zero, or its verdict misses a field or quotes nothing in the transcript.
|
||||
start or exits non-zero, or its verdict misses or mistypes a field, interrupts without a question,
|
||||
or quotes nothing in the transcript.
|
||||
Exit 2: the human is needed, to pick the model or answer an interrupt, and stdin or stdout is not a
|
||||
terminal, the input ends, or the interrupt ended without them typing anything. Rerunning resumes any
|
||||
terminal, the input ends, or the interrupt ended with nothing typed. Rerunning resumes any
|
||||
open session.
|
||||
|
||||
Each project has one session, "A <path> loop-claude", <path> being the checkout relative to ~/code,
|
||||
|
||||
@@ -5,7 +5,7 @@ import sys
|
||||
from loop_claude import human
|
||||
from loop_claude.checkout import project_name
|
||||
from loop_claude.outcome import Stop
|
||||
from loop_claude.private_file import replace_json
|
||||
from loop_claude.file_writes import replace_json
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import json
|
||||
import sys
|
||||
|
||||
from loop_claude.private_file import replace_json
|
||||
from loop_claude.file_writes import replace_json
|
||||
|
||||
|
||||
def trust(config, roots):
|
||||
@@ -15,7 +15,7 @@ def trust(config, roots):
|
||||
if not isinstance(projects, dict):
|
||||
print(f"could not read {config}: not an object whose \"projects\" is an object", file=sys.stderr)
|
||||
return
|
||||
if wrong := next((path for path, record in projects.items() if not isinstance(record, dict)), None):
|
||||
if (wrong := next((path for path, record in projects.items() if not isinstance(record, dict)), None)) is not None:
|
||||
print(f"could not read {config}: projects[{json.dumps(wrong)}] is not an object", file=sys.stderr)
|
||||
return
|
||||
untrusted = [path for path in roots if not projects.get(path, {}).get("hasTrustDialogAccepted")]
|
||||
|
||||
Reference in New Issue
Block a user