authoring UX: sequential elicitation questions + optional creation approval
Elicitation now asks one question at a time: only one PendingQuestion is live, and the next is posted only after the current is answered (an empty answer is accepted) or skipped. Each question gets a fresh codegen.elicitation.answer_timeout (default 30s) that resets on every answer submit; a timeout stops the sequence. questions_timeout is now traced only on a real timeout. Front ends need no change — they read pending_questions(). Add opt-in creation_approval: the single-slot llm draft worker blocks after authoring a proposal and before anything is registered; approve/deny via the REPL, dashboard (/api/approvals + UI), or a gateway chat reply (yes/no). One prompt per creation request (a category approval covers its chained skill); denial or timeout aborts creation. Off by default. Tests updated for both; full stdlib suite passes (337).
This commit is contained in:
1 parent
25ade160df
commit
215c22afb8
10 files changed
+684
-67
No files matched your search
+43
-1
@@ -291,6 +291,42 @@ def _print_repairs(scheduler: Scheduler) -> None:
|
||||
)
|
||||
|
||||
|
||||
def _answer_approvals(scheduler: Scheduler) -> None:
|
||||
"""Ask any pending creation approvals at the REPL.
|
||||
|
||||
Only prompts when `creation_approval` is on (the scheduler posts nothing
|
||||
otherwise). An empty answer denies.
|
||||
"""
|
||||
while True:
|
||||
pending = scheduler.pending_approvals()
|
||||
if not pending:
|
||||
return
|
||||
item = pending[0]
|
||||
target = (
|
||||
item["category"]
|
||||
if item["kind"] == "category"
|
||||
else f"{item['category']}.{item['skill']}"
|
||||
)
|
||||
answer = input(
|
||||
f"[approval] create new {item['kind']} {target}: {item['description']}\n"
|
||||
"approve? (y/N): "
|
||||
).strip().lower()
|
||||
status, detail = scheduler.answer_approval(
|
||||
item["id"], answer in ("y", "yes")
|
||||
)
|
||||
print(f"[{status}] {detail}")
|
||||
|
||||
|
||||
def _print_approvals(scheduler: Scheduler) -> None:
|
||||
for item in scheduler.pending_approvals():
|
||||
target = (
|
||||
item["category"]
|
||||
if item["kind"] == "category"
|
||||
else f"{item['category']}.{item['skill']}"
|
||||
)
|
||||
print(f"[approval] {item['id']} new {item['kind']} {target}: {item['description']}")
|
||||
|
||||
|
||||
def _fatal_exit(scheduler: Scheduler) -> int | None:
|
||||
"""If the scheduler hit a fatal engine failure, print it and return non-zero.
|
||||
|
||||
@@ -309,10 +345,11 @@ def repl(scheduler: Scheduler, config: dict) -> int:
|
||||
print(
|
||||
"type a request, or one of: busy <text> | idle | status | skills | dream | "
|
||||
"relabel <id> <outcome> | restart <category> <skill> | "
|
||||
"repairs | repair <offer-id> [action] | quit"
|
||||
"repairs | repair <offer-id> [action] | approvals | quit"
|
||||
)
|
||||
while True:
|
||||
_answer_questions(scheduler)
|
||||
_answer_approvals(scheduler)
|
||||
try:
|
||||
line = input("> ").strip()
|
||||
except (EOFError, KeyboardInterrupt):
|
||||
@@ -335,6 +372,9 @@ def repl(scheduler: Scheduler, config: dict) -> int:
|
||||
if lower == "repairs":
|
||||
_print_repairs(scheduler)
|
||||
continue
|
||||
if lower == "approvals":
|
||||
_print_approvals(scheduler)
|
||||
continue
|
||||
if lower.startswith(("repair ", "/repair ")):
|
||||
parts = line.lstrip("/").split()
|
||||
if len(parts) not in (2, 3):
|
||||
@@ -345,6 +385,7 @@ def repl(scheduler: Scheduler, config: dict) -> int:
|
||||
)
|
||||
print(f"[{status}] {detail}")
|
||||
_answer_questions(scheduler)
|
||||
_answer_approvals(scheduler)
|
||||
for result_status, result_detail in scheduler.run_queue():
|
||||
print(f"[{result_status}] {result_detail}")
|
||||
continue
|
||||
@@ -387,6 +428,7 @@ def repl(scheduler: Scheduler, config: dict) -> int:
|
||||
if _fatal_exit(scheduler) is not None:
|
||||
return 1
|
||||
_answer_questions(scheduler)
|
||||
_answer_approvals(scheduler)
|
||||
_print_repairs(scheduler)
|
||||
return _fatal_exit(scheduler) or 0
|
||||
|
||||
|
||||
Reference in new issue
Block a user