diff --git a/README.md b/README.md index 46e65df..e433406 100644 --- a/README.md +++ b/README.md @@ -229,7 +229,7 @@ the request, the tree, the elicitation answers, the runtime **bridge catalog** | `interrupt:choice` | `scheduler.py:279` | request text + `[current process: ]` | `interrupt` / `defer` | | `priority:score` | `scheduler.py:296` | request text (+ `[current process: …]` when busy) | critical / high / medium / low | | `navigate:category` | `skills.py:682` | request text | every category name (+ `create_category`) | -| `navigate:leaf` | `skills.py:736` | request text + `[current process: ]` | every skill name + description (+ `create_skill`) | +| `navigate:leaf` | `skills.py:736` | request text + current category | every skill name + description (+ `create_skill`) | | `navigate:response` | `skills.py:634` | request text + category | canned reply names + descriptions (catchall last) | | `navigate:intent` | `skills.py:811` | `Requested action: ` + `Action of the existing skill: ` | `same` / `different` | | `assess:outcome` | `skill.py:257` | skill label + goal + action log | `success` / `failure` | diff --git a/semif_agent/scheduler.py b/semif_agent/scheduler.py index 13054bf..73fffb2 100644 --- a/semif_agent/scheduler.py +++ b/semif_agent/scheduler.py @@ -49,7 +49,6 @@ from .skills import ( SkillStore, build_skills, build_tree, - compose_state, confirm_skill_fit, generate_category, generate_skill, @@ -273,7 +272,7 @@ class Scheduler: def _interrupt_choice(self, request: Request, current: Process) -> bool: decision = DecisionRequest( - state=compose_state(request, current=current.skill), + state=f"{request.text} [current process: {current.skill}]", question="Should this be allowed to interrupt the current process?", options=[ Option(CHOICE_INTERRUPT, "Yes, interrupt the current process."), @@ -290,7 +289,7 @@ class Scheduler: def _priority_score(self, request: Request, current: str | None = None) -> tuple[float, str]: decision = DecisionRequest( - state=compose_state(request, current=current), + state=f"{request.text} [current process: {current}]", question="How urgent is this request?", options=[Option(option_id, description) for option_id, description in URGENCY_OPTIONS], ) diff --git a/semif_agent/skills.py b/semif_agent/skills.py index 28cb49b..e689d83 100644 --- a/semif_agent/skills.py +++ b/semif_agent/skills.py @@ -471,10 +471,10 @@ def unresolved_variables( return [name for name in (skill.contract or {}) if name not in merged] -def compose_state(request: Request, current: str | None = None) -> str: +def compose_state(request: Request, additional_context: str | None = None) -> str: parts = [request.text] - if current: - parts.append(f"[current process: {current}]") + if additional_context: + parts.append(f"({additional_context})") return " ".join(parts) @@ -654,7 +654,10 @@ def _navigate_canned( if len(ordered) == 1: return ordered[0] leaf = DecisionRequest( - state=compose_state(request, current=category), + state=compose_state( + request, + additional_context=f"all choices are within the {category} category", + ), question=( "Which canned response best fits this input? " f"Choose {ordered[-1].name} if none of the others does." @@ -759,7 +762,10 @@ def navigate( "skill_needed", request.id, category=category, - state=compose_state(request, current=category), + state=compose_state( + request, + additional_context=f"all choices are within the {category} category", + ), question="(this category has no skills yet)", options=[], selected="create_skill", @@ -771,7 +777,10 @@ def navigate( # guard, which owns the reuse-vs-create decision. return skills[0] leaf = DecisionRequest( - state=compose_state(request, current=category), + state=compose_state( + request, + additional_context=f"all choices are within the {category} category", + ), question=f"Which {category} skill performs the action this request asks for?", options=[Option(s.name, s.description) for s in skills], )