chain multi-step requests across known skills
Add the run-ledger chained-run path and make a compound request run its known skills in order instead of authoring one monolithic skill. - scheduler/skill: `assess:outcome` gains a `continue` verdict; a continued step is re-dispatched with a bounded run ledger (max_reentries + a monotonic-progress guard), and the ledger is rendered into the routing and assessment state. - navigation leaf guard (`confirm_skill_fit`) becomes same/part/different and is ledger-aware, so the first step of a compound request runs instead of being rejected into `create_skill` (a real run picked calculator.calculate at 0.99 and was rejected into create_skill). - results flow forward through `request.run_ledger` (`last_result` helper); `simplex.send_message` sends the prior step's result rather than asking the LLM bridge to recompute it. Documented in CODEGEN.md. - `assess:outcome` stays the sole continuation authority: the guard only decides whether a skill contributes, never forces a continuation (a forced continue on `part` overrode a correct `done` on the final step and authored a spurious category). - verbosity levels, structured SchedulerReply fields, and a send_message hermetic test for the chained-result path.
This commit is contained in:
1 parent
9ba14fdab0
commit
ab0defca1e
20 files changed
+1046
-324
No files matched your search
+17
-6
@@ -485,16 +485,26 @@ def _print_approvals(scheduler: Scheduler) -> None:
|
||||
print(f"[approval] {item['id']} new {item['kind']} {target}: {item['description']}")
|
||||
|
||||
|
||||
def _print_reply(reply, show_run_id: bool = False) -> None:
|
||||
"""Print a scheduler reply, optionally keeping its run id visible."""
|
||||
def _print_reply(reply, show_run_id: bool = False, verbosity: str = "result") -> None:
|
||||
"""Print a scheduler reply, honoring the configured verbosity.
|
||||
|
||||
"result" shows only the final answer of a request (an intermediate chain
|
||||
step is hidden); "query" also shows intermediate steps; "decision"
|
||||
additionally prints each SemIf decision phase for the run.
|
||||
"""
|
||||
if getattr(reply, "intermediate", False) and verbosity == "result":
|
||||
return
|
||||
label = f"[{reply.run_id}] " if (show_run_id and reply.run_id) else ""
|
||||
print(f"[{reply.status}] {label}{reply.text}")
|
||||
for line in getattr(reply, "decision_lines", ()) or ():
|
||||
print(f" {line}")
|
||||
|
||||
|
||||
def _drain_queue(scheduler: Scheduler) -> None:
|
||||
"""Run queued work, printing each outcome with its run id."""
|
||||
verbosity = getattr(scheduler, "verbosity", "result")
|
||||
for reply in scheduler.run_queue():
|
||||
_print_reply(reply, show_run_id=True)
|
||||
_print_reply(reply, show_run_id=True, verbosity=verbosity)
|
||||
|
||||
|
||||
def _fatal_exit(scheduler: Scheduler) -> int | None:
|
||||
@@ -646,13 +656,13 @@ def repl(scheduler: Scheduler, config: dict) -> int:
|
||||
scheduler.busy(line[5:].strip())
|
||||
print("current process set (busy).")
|
||||
continue
|
||||
_print_reply(scheduler.submit(line))
|
||||
_print_reply(scheduler.submit(line), verbosity=scheduler.verbosity)
|
||||
if _fatal_exit(scheduler) is not None:
|
||||
return 1
|
||||
while scheduler.pending is not None:
|
||||
hint = "" if scheduler.pending.pre_act else " [leave empty to skip]"
|
||||
answer = input(f"{scheduler.pending.question}{hint} ")
|
||||
_print_reply(scheduler.answer(answer))
|
||||
_print_reply(scheduler.answer(answer), verbosity=scheduler.verbosity)
|
||||
if _fatal_exit(scheduler) is not None:
|
||||
return 1
|
||||
_drain_queue(scheduler)
|
||||
@@ -669,7 +679,8 @@ def scripted(scheduler: Scheduler, path: str) -> int:
|
||||
rows = [json.loads(line) for line in Path(path).read_text().splitlines() if line.strip()]
|
||||
for row in rows:
|
||||
_print_reply(
|
||||
scheduler.submit(str(row["text"]), source=row.get("source", "scripted"))
|
||||
scheduler.submit(str(row["text"]), source=row.get("source", "scripted")),
|
||||
verbosity=scheduler.verbosity,
|
||||
)
|
||||
if _fatal_exit(scheduler) is not None:
|
||||
return 1
|
||||
|
||||
Reference in new issue
Block a user