Name human_needed.py for the exit-2 stops it holds
This commit was merged in pull request #126.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from loop_claude import human
|
from loop_claude import human_needed
|
||||||
from loop_claude.claude_code.transcript import human_turns, read
|
from loop_claude.claude_code.transcript import human_turns, read
|
||||||
from loop_claude.claude_code.trust import trust
|
from loop_claude.claude_code.trust import trust
|
||||||
from loop_claude.outcome import Failure, Stop
|
from loop_claude.outcome import Failure, Stop
|
||||||
@@ -12,7 +12,7 @@ TO = "answer the question above"
|
|||||||
|
|
||||||
def interrupt(root, session_id, model, path, question, paths):
|
def interrupt(root, session_id, model, path, question, paths):
|
||||||
print(f"\n{question}", file=sys.stderr)
|
print(f"\n{question}", file=sys.stderr)
|
||||||
if stop := human.off_terminal(TO):
|
if stop := human_needed.off_terminal(TO):
|
||||||
return stop
|
return stop
|
||||||
trust(paths.claude_json, checkouts(root))
|
trust(paths.claude_json, checkouts(root))
|
||||||
entries = read(path)
|
entries = read(path)
|
||||||
@@ -27,5 +27,5 @@ def interrupt(root, session_id, model, path, question, paths):
|
|||||||
if isinstance(entries, Failure):
|
if isinstance(entries, Failure):
|
||||||
return Stop(1, f"could not tell whether you typed anything: {entries.reason}")
|
return Stop(1, f"could not tell whether you typed anything: {entries.reason}")
|
||||||
if human_turns(entries) <= before:
|
if human_turns(entries) <= before:
|
||||||
return human.needed(TO, "the interrupt ended with nothing typed")
|
return human_needed.stop(TO, "the interrupt ended with nothing typed")
|
||||||
return None
|
return None
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ import sys
|
|||||||
from loop_claude.outcome import Stop
|
from loop_claude.outcome import Stop
|
||||||
|
|
||||||
|
|
||||||
def needed(to, but):
|
def stop(to, but):
|
||||||
return Stop(2, f"the human is needed to {to}, but {but}")
|
return Stop(2, f"the human is needed to {to}, but {but}")
|
||||||
|
|
||||||
|
|
||||||
def off_terminal(to):
|
def off_terminal(to):
|
||||||
if sys.stdin.isatty() and sys.stdout.isatty():
|
if sys.stdin.isatty() and sys.stdout.isatty():
|
||||||
return None
|
return None
|
||||||
return needed(to, "stdin or stdout is not a terminal; rerun loop-claude on a terminal")
|
return stop(to, "stdin or stdout is not a terminal; rerun loop-claude on a terminal")
|
||||||
@@ -2,7 +2,7 @@ import dataclasses
|
|||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from loop_claude import human
|
from loop_claude import human_needed
|
||||||
from loop_claude.claude_code.formats import catalog
|
from loop_claude.claude_code.formats import catalog
|
||||||
from loop_claude.file_writes import replace_json
|
from loop_claude.file_writes import replace_json
|
||||||
from loop_claude.outcome import Stop
|
from loop_claude.outcome import Stop
|
||||||
@@ -58,7 +58,7 @@ def read_models(saved):
|
|||||||
|
|
||||||
|
|
||||||
def ask_model(name, saved, folder):
|
def ask_model(name, saved, folder):
|
||||||
if stop := human.off_terminal(f"pick {name}'s model, or merge {{\"{name}\": \"<model>\"}} into {saved}"):
|
if stop := human_needed.off_terminal(f"pick {name}'s model, or merge {{\"{name}\": \"<model>\"}} into {saved}"):
|
||||||
return stop
|
return stop
|
||||||
offered = catalog(folder)
|
offered = catalog(folder)
|
||||||
print(f"\nThe model to run {name} on, saved in {saved}:", file=sys.stderr)
|
print(f"\nThe model to run {name} on, saved in {saved}:", file=sys.stderr)
|
||||||
@@ -71,7 +71,7 @@ def ask_model(name, saved, folder):
|
|||||||
answer = input(f"{'A number, or any' if offered else 'A'} name claude --model takes: ").strip()
|
answer = input(f"{'A number, or any' if offered else 'A'} name claude --model takes: ").strip()
|
||||||
except EOFError:
|
except EOFError:
|
||||||
print(file=sys.stderr)
|
print(file=sys.stderr)
|
||||||
return human.needed(f"pick {name}'s model", "the input ended")
|
return human_needed.stop(f"pick {name}'s model", "the input ended")
|
||||||
if not answer:
|
if not answer:
|
||||||
continue
|
continue
|
||||||
if not (offered and answer.isdecimal()):
|
if not (offered and answer.isdecimal()):
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ The rebuild lifts every dimension, one chunk per item, until the last item opens
|
|||||||
|
|
||||||
The places the panel on `rebuild` at 7f9de5c named (`docs/decisions.md`), capping dimension first:
|
The places the panel on `rebuild` at 7f9de5c named (`docs/decisions.md`), capping dimension first:
|
||||||
|
|
||||||
- **Name `human.py` for the exit-2 stops it holds.** One seat looked there for the prompts, which live in `models.py` and `interrupt.py`.
|
|
||||||
- **Score `rebuild` with the four-seat panel at 7.0 or above on every dimension and the overall, none below the last run, and open its PR into main for the human.** ⚠️ Leave that PR ready and unmerged: only the human merges it, after approving the whole rebuild. A dimension under the floor gets its places filed above this item.
|
- **Score `rebuild` with the four-seat panel at 7.0 or above on every dimension and the overall, none below the last run, and open its PR into main for the human.** ⚠️ Leave that PR ready and unmerged: only the human merges it, after approving the whole rebuild. A dimension under the floor gets its places filed above this item.
|
||||||
|
|
||||||
## 0.2.0
|
## 0.2.0
|
||||||
|
|||||||
Reference in New Issue
Block a user