fixed multile issues
Some checks failed
validation / verify (push) Failing after 8s

This commit is contained in:
2026-10-07 17:33:36 +01:00
parent 4c4d44ef87
commit 5bb22d984e
76 changed files with 5799 additions and 179 deletions

View File

@@ -2,19 +2,24 @@
A role gets the local tools its role file names, the tools of the remote MCP servers
the provider bundle assigns it, and, for the design advisor, the pillar consultation.
When the Deliverable has a working copy, the local tools are built on it.
Cloud-read gating is applied later, per Execution, by `specialist_tools`.
"""
from __future__ import annotations
from collections.abc import Mapping, MutableMapping, Sequence
from collections.abc import Callable, Mapping, MutableMapping, Sequence
from typing import Any
from app.adk.roles import PILLAR_ADVISOR
from app.adk.runtime import AgentRuntime, RoleSpec, RunLimiter, ToolFactory, ToolSpec
from app.tools.mcp import McpCatalog
from app.tools.pillars import pillar_consultation_tool
from app.workflows.deliverables import DeliverableKind
from app.tools.workspace import working_files
from app.workflows.deliverables import DEPENDENCY_GRAPH, DeliverableKind
# The local tools, built on a working copy of files when the Deliverable has one.
LocalToolBuilder = Callable[[MutableMapping[str, str] | None], Sequence[ToolSpec]]
def make_tool_factory(
@@ -22,11 +27,14 @@ def make_tool_factory(
roles: Mapping[str, RoleSpec],
pillar_skills: Mapping[str, str],
*,
local_tools: Sequence[ToolSpec] = (),
local_tools: Sequence[ToolSpec] | LocalToolBuilder = (),
catalog: McpCatalog | None = None,
limiter: RunLimiter | None = None,
) -> ToolFactory:
local_by_name = {tool.name: tool for tool in local_tools}
def build_local(
working_copy: MutableMapping[str, str] | None,
) -> Sequence[ToolSpec]:
return local_tools(working_copy) if callable(local_tools) else local_tools
def mcp_tools(role: RoleSpec) -> list[ToolSpec]:
return catalog.tools_for(role.mcp_servers) if catalog else []
@@ -42,6 +50,16 @@ def make_tool_factory(
def tools_for(
role: RoleSpec, deliverable: str | None, working: MutableMapping[str, Any]
) -> Sequence[ToolSpec]:
has_working_copy = any(
kind.value == deliverable and spec.working_copy is not None
for kind, spec in DEPENDENCY_GRAPH.items()
)
local_by_name = {
tool.name: tool
for tool in build_local(
working_files(working) if has_working_copy else None
)
}
tools = [local_by_name[name] for name in role.tools if name in local_by_name]
tools += mcp_tools(role)
if (