refactor(agents): consolidate chat runtime infra under chat/runtime

Move the lower-level runtime/infra modules out of multi_agent_chat/shared/
(they were never used by subagents, so they failed the shared-by-all-siblings
rule) and unify them with the already-relocated checkpointer:

  agents/runtime/                      -> agents/chat/runtime/
  mac/shared/errors.py                 -> chat/runtime/errors.py
  mac/shared/llm_config.py             -> chat/runtime/llm_config.py
  mac/shared/prompt_caching.py         -> chat/runtime/prompt_caching.py
  mac/shared/mention_resolver.py       -> chat/runtime/mention_resolver.py
  mac/shared/path_resolver.py          -> chat/runtime/path_resolver.py

These sit below the agent packages: the boundary + agent factory + shared
middleware depend on them, and they import no agent code (acyclic).
This commit is contained in:
CREDO23 2026-06-05 13:19:24 +02:00
parent 7d866a2279
commit f2a61bc0ef
52 changed files with 97 additions and 87 deletions

View file

@ -4,7 +4,6 @@ from __future__ import annotations
import pytest
from app.agents.chat.multi_agent_chat.shared.errors import BusyError
from app.agents.chat.multi_agent_chat.shared.middleware.busy_mutex import (
BusyMutexMiddleware,
end_turn,
@ -14,6 +13,7 @@ from app.agents.chat.multi_agent_chat.shared.middleware.busy_mutex import (
request_cancel,
reset_cancel,
)
from app.agents.chat.runtime.errors import BusyError
pytestmark = pytest.mark.unit

View file

@ -15,14 +15,14 @@ from unittest.mock import AsyncMock, MagicMock
import pytest
from app.agents.chat.multi_agent_chat.shared import mention_resolver
from app.agents.chat.multi_agent_chat.shared.mention_resolver import (
from app.agents.chat.runtime import mention_resolver
from app.agents.chat.runtime.mention_resolver import (
ResolvedMention,
ResolvedMentionSet,
resolve_mentions,
substitute_in_text,
)
from app.agents.chat.multi_agent_chat.shared.path_resolver import (
from app.agents.chat.runtime.path_resolver import (
DOCUMENTS_ROOT,
PathIndex,
)

View file

@ -7,7 +7,7 @@ from unittest.mock import AsyncMock, MagicMock
import pytest
from app.agents.chat.multi_agent_chat.shared.path_resolver import (
from app.agents.chat.runtime.path_resolver import (
DOCUMENTS_ROOT,
PathIndex,
doc_to_virtual_path,

View file

@ -1,5 +1,5 @@
r"""Tests for ``apply_litellm_prompt_caching`` in
:mod:`app.agents.chat.multi_agent_chat.shared.prompt_caching`.
:mod:`app.agents.chat.runtime.prompt_caching`.
The helper replaces the legacy ``AnthropicPromptCachingMiddleware`` (which
never activated for our LiteLLM stack) with LiteLLM-native multi-provider
@ -34,8 +34,8 @@ from typing import Any
import pytest
from app.agents.chat.multi_agent_chat.shared.llm_config import AgentConfig
from app.agents.chat.multi_agent_chat.shared.prompt_caching import (
from app.agents.chat.runtime.llm_config import AgentConfig
from app.agents.chat.runtime.prompt_caching import (
apply_litellm_prompt_caching,
)