Switch the extract and summarise stages on the page, over config.yaml

A stored `stage:extract` / `stage:summarise` in the state table overrides
extract.enabled / summarise.enabled; with none, the file applies. One
function, stages.stage_on, decides, and both tasks' finders ask it.
GET/PUT /api/stages and `app stages` show and set it with who would answer;
Runs has a "What the model reads" block, and a search agent's card says when
a stage is off and links to the switch.

Co-Authored-By: Claude Sonnet <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Sonnet committed 2026-09-29 15:54:53 +02:00
1 parent a629eda8de
commit 471ace703c
15 files changed
+593 -23

No files matched your search

+26 -1
View File
@@ -247,7 +247,7 @@ def fetch_text(uid: str, store: StoreDep) -> Role:
@router.post("/roles/{uid}/summarise", status_code=202)
def summarise_role(uid: str, store: StoreDep, config: ConfigDep, queue: QueueDep) -> Job:
"""Queue a summary of one role, whatever its rank and whether or not the
pull summarises (`summarise.enabled`). The job's batch is this uid alone.
pull summarises (`jobs.stages`). The job's batch is this uid alone.
Pressed twice, the second press gets the first one's job."""
role = _known_role(store, uid)
if role.summary:
@@ -265,6 +265,31 @@ def summarise_role(uid: str, store: StoreDep, config: ConfigDep, queue: QueueDep
return job
# ------------------------------------------------------------------ stages
class StageBody(BaseModel):
on: bool
@router.get("/stages")
def list_stages(store: StoreDep, config: ConfigDep) -> list[jobs.stages.Stage]:
"""The two model stages of a pull: whether each is on, whether the
stored switch or config.yaml says so, its model, and who would answer."""
return jobs.stages.describe(config, store)
@router.put("/stages/{name}")
def set_stage(name: str, body: StageBody, store: StoreDep,
config: ConfigDep) -> jobs.stages.Stage:
"""Store the switch for one stage. Nothing starts: the next pull runs the
stage, or Run the pull now does so at once."""
try:
jobs.stages.set_stage(store, name, body.on)
except KeyError:
raise HTTPException(404, f"no such stage: {name}") from None
return jobs.stages.describe_one(config, store, name)
# --------------------------------------------------------------- companies
class CompanyOut(BaseModel):