feat: add tool scoping and orchestration markers to agent tool registry

Introduce `mark_orchestration_tools`, `set_tool_scope`, and `reset_tool_scope` in `agents/agent.py` to allow runtime filtering of tool payloads by scope and orchestration flag. Refactor `get_tool_payloads` to respect the active scope and exclude orchestration-only tools. Update `agents/core/__init__.py` with `worker_tool_names` helper that returns read/reasoning tools plus conditional write/verify tools per mode, replacing the old `payloads_for` exclusion logic. Modify `agents/maestro.py` to call `mark_orchestration_tools` and wire per-agent result recording via `on_result` callback in `run_fleet`. Extend `agents/orchestrator.py` `run_fleet` signature to accept an optional `on_result` callable and invoke it after each agent run. Revise `agents/style.py` em-dash rule to distinguish prose from data occurrences, and add repository layout guidance to `agents/base.py` MAINT_HEADER.
This commit is contained in:
2026-06-12 04:30:08 +00:00
parent 31841fece4
commit 5e6b1c09df
38 changed files with 679 additions and 86 deletions
+27 -4
View File
@@ -113,11 +113,33 @@ async def report_finding(
return json.dumps({"status": "success", "recorded": True, "total_findings": len(_FINDINGS)})
WORKER_READ_TOOLS = (
"read_file",
"read_lines",
"list_dir",
"glob_files",
"grep",
"find_symbol",
"retrieve",
)
WORKER_REASONING_TOOLS = (
"plan",
"reflect",
"delegate",
"report_finding",
"get_current_isodate",
)
def worker_tool_names(mode: str) -> tuple[str, ...]:
names = WORKER_READ_TOOLS + WORKER_REASONING_TOOLS
if mode != "check":
names = names + WRITE_TOOLS + ("verify",)
return names
def payloads_for(mode: str) -> list[dict[str, Any]]:
exclude = WEB_TOOLS + SWARM_TOOLS + ("run_command",)
if mode == "check":
exclude = exclude + WRITE_TOOLS + ("verify",)
return get_tool_payloads(exclude=exclude)
return payloads_named(worker_tool_names(mode))
def payloads_named(names: tuple[str, ...]) -> list[dict[str, Any]]:
@@ -240,6 +262,7 @@ __all__ = [
"findings",
"payloads_for",
"payloads_named",
"worker_tool_names",
"summarize",
"write_reports",
"report_codename",