fix(fase2): mypy-clean src — typed workflow factory + third-party stub config

This commit is contained in:
Kjell Tore Guttormsen 2026-06-24 14:01:27 +02:00
commit 4e87e473e4
2 changed files with 13 additions and 2 deletions

View file

@ -45,3 +45,11 @@ src = ["src", "tests", "spikes"]
pythonpath = ["src", "."] pythonpath = ["src", "."]
testpaths = ["tests"] testpaths = ["tests"]
asyncio_mode = "auto" asyncio_mode = "auto"
[tool.mypy]
python_version = "3.10"
# Third-party libs without bundled type stubs (py.typed) — analysed as untyped, not errors.
[[tool.mypy.overrides]]
module = ["pulp.*", "agent_framework_foundry.*"]
ignore_missing_imports = true

View file

@ -18,6 +18,7 @@ resume is fragile; the durable verdict is captured out-of-band in Step 12).
from __future__ import annotations from __future__ import annotations
from collections.abc import Callable, Sequence from collections.abc import Callable, Sequence
from typing import Any
from agent_framework import Agent, BaseChatClient, Message from agent_framework import Agent, BaseChatClient, Message
from agent_framework.orchestrations import GroupChatBuilder from agent_framework.orchestrations import GroupChatBuilder
@ -54,13 +55,15 @@ def fresh_workflow(
*, *,
max_rounds: int = 3, max_rounds: int = 3,
enable_layer1_hitl: bool = False, enable_layer1_hitl: bool = False,
) -> object: ) -> Any:
"""Build a FRESH maker-checker GroupChat with FRESH clients per call (B7). Bounded by """Build a FRESH maker-checker GroupChat with FRESH clients per call (B7). Bounded by
``with_max_rounds`` (B4) plus a higher turn-count termination safety net. ``client_factory`` ``with_max_rounds`` (B4) plus a higher turn-count termination safety net. ``client_factory``
is called once per role, so each run owns its own clients no state survives between runs. is called once per role, so each run owns its own clients no state survives between runs.
""" """
agents = maker_checker_agents(client_factory) agents = maker_checker_agents(client_factory)
names = [a.name for a in agents] # Agents are built from _MAKER_CHECKER_ROLES in order with name=role, so the role tuple
# IS the (typed, non-None) name list the selector cycles over.
names: list[str] = list(_MAKER_CHECKER_ROLES)
counter = {"n": 0} counter = {"n": 0}
def select(_state: object) -> str: def select(_state: object) -> str: