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

@ -20,6 +20,7 @@ from types import SimpleNamespace
import pytest
from app.agents.multi_agent_chat.shared.filesystem_selection import FilesystemMode
from app.agents.multi_agent_chat.shared.middleware.filesystem.backends.multi_root_local_folder import (
MultiRootLocalFolderBackend,
)
@ -35,7 +36,6 @@ from app.agents.multi_agent_chat.shared.middleware.filesystem.middleware.path_re
normalize_local_mount_path,
resolve_relative,
)
from app.agents.shared.filesystem_selection import FilesystemMode
pytestmark = pytest.mark.unit

View file

@ -19,6 +19,10 @@ from unittest.mock import AsyncMock
import pytest
from app.agents.multi_agent_chat.shared.filesystem_selection import (
FilesystemMode,
FilesystemSelection,
)
from app.agents.multi_agent_chat.shared.middleware.filesystem import (
build_filesystem_mw,
)
@ -29,7 +33,6 @@ from app.agents.multi_agent_chat.shared.middleware.filesystem.backends.resolver
build_backend_resolver,
)
from app.agents.multi_agent_chat.shared.state.reducers import _CLEAR
from app.agents.shared.filesystem_selection import FilesystemMode, FilesystemSelection
pytestmark = pytest.mark.unit

View file

@ -18,10 +18,10 @@ from __future__ import annotations
import pytest
from app.agents.multi_agent_chat.shared.filesystem_selection import FilesystemMode
from app.agents.multi_agent_chat.shared.middleware.filesystem.system_prompt import (
build_system_prompt,
)
from app.agents.shared.filesystem_selection import FilesystemMode
pytestmark = pytest.mark.unit

View file

@ -2,18 +2,18 @@ from pathlib import Path
import pytest
from app.agents.multi_agent_chat.shared.filesystem_selection import (
ClientPlatform,
FilesystemMode,
FilesystemSelection,
LocalFilesystemMount,
)
from app.agents.multi_agent_chat.shared.middleware.filesystem.backends.multi_root_local_folder import (
MultiRootLocalFolderBackend,
)
from app.agents.multi_agent_chat.shared.middleware.filesystem.backends.resolver import (
build_backend_resolver,
)
from app.agents.shared.filesystem_selection import (
ClientPlatform,
FilesystemMode,
FilesystemSelection,
LocalFilesystemMount,
)
pytestmark = pytest.mark.unit

View file

@ -15,7 +15,7 @@ from unittest.mock import AsyncMock
import numpy as np
import pytest
from app.agents.shared.middleware import kb_persistence
from app.agents.multi_agent_chat.shared.middleware import kb_persistence
from app.db import Document

View file

@ -21,7 +21,7 @@ from unittest.mock import AsyncMock, MagicMock
import pytest
from app.agents.shared.middleware import kb_persistence
from app.agents.multi_agent_chat.shared.middleware import kb_persistence
pytestmark = pytest.mark.unit

View file

@ -12,7 +12,7 @@ from __future__ import annotations
from app.agents.multi_agent_chat.main_agent.middleware.knowledge_tree.middleware import (
KnowledgeTreeMiddleware,
)
from app.agents.shared.path_resolver import DOCUMENTS_ROOT
from app.agents.multi_agent_chat.shared.path_resolver import DOCUMENTS_ROOT
def _compute(folder_paths: list[str], doc_paths: list[str]) -> set[str]:
@ -88,7 +88,7 @@ class TestFormatTreeRendering:
folder_paths: list[str],
doc_specs: list[dict],
) -> str:
from app.agents.shared.path_resolver import PathIndex
from app.agents.multi_agent_chat.shared.path_resolver import PathIndex
index = PathIndex(
folder_paths={i + 1: p for i, p in enumerate(folder_paths)},