refactor(agents): move mac-only modules out of the cross-agent shared kernel

app/agents/shared/ is a sibling of anonymous_chat/podcaster/multi_agent_chat/
video_presentation, so it should only hold code shared across 2+ of those
agents. In practice podcaster and video_presentation import nothing from it,
and anonymous_chat needs only context + compaction + retry_after + web_search.
Everything else was multi_agent_chat-only (the boundary just passes through).

Move the multi_agent_chat-only cluster into multi_agent_chat/shared/ (files
moved verbatim via git rename; ~116 import sites rewritten):

  errors, feature_flags, filesystem_selection, path_resolver, prompt_caching,
  sandbox, llm_config, mention_resolver
  middleware/busy_mutex, middleware/kb_persistence

busy_mutex/llm_config/mention_resolver are boundary-only but import the moved
modules, so they were folded in to avoid a backwards shared -> multi_agent_chat
dependency. main_agent builders now import the impls directly; the shared
middleware barrel keeps only the genuinely-shared compaction + retry_after.

Also delete the dead leftover shared/plugins and shared/skills dirs (live
copies already live under main_agent/).

Remaining in app/agents/shared/: context, system_prompt(+prompts), checkpointer,
middleware/{compaction,retry_after,dedup_tool_calls}, tools/. checkpointer and
system_prompt are boundary-only infra pending a dedicated home decision.
This commit is contained in:
CREDO23 2026-06-05 12:30:15 +02:00
parent c0c4f57f5d
commit 82c5dc5b02
126 changed files with 238 additions and 196 deletions

View file

@ -227,7 +227,7 @@ global_llm_configs:
def test_agent_config_from_yaml_explicit_overrides_resolver():
from app.agents.shared.llm_config import AgentConfig
from app.agents.multi_agent_chat.shared.llm_config import AgentConfig
cfg_text_only = AgentConfig.from_yaml_config(
{
@ -256,7 +256,7 @@ def test_agent_config_from_yaml_explicit_overrides_resolver():
def test_agent_config_from_yaml_unannotated_uses_resolver():
"""Without an explicit YAML key, AgentConfig defers to the catalog
resolver for ``gpt-4o`` LiteLLM's map says supports_vision=True."""
from app.agents.shared.llm_config import AgentConfig
from app.agents.multi_agent_chat.shared.llm_config import AgentConfig
cfg = AgentConfig.from_yaml_config(
{
@ -275,7 +275,7 @@ def test_agent_config_auto_mode_supports_image_input():
so users can keep their selection on Auto with a vision-capable
deployment somewhere in the pool. The router's own `allowed_fails`
handles non-vision deployments via fallback."""
from app.agents.shared.llm_config import AgentConfig
from app.agents.multi_agent_chat.shared.llm_config import AgentConfig
auto = AgentConfig.from_auto_mode()
assert auto.supports_image_input is True

View file

@ -61,7 +61,7 @@ async def test_get_vision_llm_global_openrouter_sets_api_base():
return_value=cfg,
),
patch(
"app.agents.shared.llm_config.SanitizedChatLiteLLM",
"app.agents.multi_agent_chat.shared.llm_config.SanitizedChatLiteLLM",
new=FakeSanitized,
),
):