refactor(agents): move filesystem_selection to app/agents/shared (slice 3a)

Promote the filesystem mode contracts (FilesystemMode, FilesystemSelection,
ClientPlatform, LocalFilesystemMount) out of `new_chat` into the cross-agent
`app/agents/shared` kernel.

Pure leaf consumed across the whole multi-agent filesystem middleware/tool tree,
the chat flows/monolith, routes and tests. git mv (content unchanged) + flipped
all ~48 importers. A re-export shim remains at new_chat/filesystem_selection.py
only for the not-yet-retired single-agent (chat_deepagent).

Also updated the stream parity test's annotation normalizer to strip the new
app.agents.shared.filesystem_selection. prefix (the dataclasses' __module__
changed with the move), keeping monolith<->flows signature parity intact.

Behavior-preserving: only import paths change. 1326 tests green.
This commit is contained in:
CREDO23 2026-06-04 12:28:20 +02:00
parent a975754e7d
commit 1b536b8aee
51 changed files with 110 additions and 86 deletions

View file

@ -2,7 +2,7 @@
from __future__ import annotations
from app.agents.new_chat.filesystem_selection import FilesystemMode
from app.agents.shared.filesystem_selection import FilesystemMode
from app.agents.new_chat.middleware import AnonymousDocumentMiddleware

View file

@ -2,7 +2,7 @@
from __future__ import annotations
from app.agents.new_chat.filesystem_selection import FilesystemMode
from app.agents.shared.filesystem_selection import FilesystemMode
from app.agents.new_chat.middleware import KnowledgeBasePersistenceMiddleware

View file

@ -4,7 +4,7 @@ from __future__ import annotations
from langchain_core.language_models import BaseChatModel
from app.agents.new_chat.filesystem_selection import FilesystemMode
from app.agents.shared.filesystem_selection import FilesystemMode
from app.agents.new_chat.middleware import KnowledgePriorityMiddleware
from app.services.llm_service import get_planner_llm

View file

@ -4,7 +4,7 @@ from __future__ import annotations
from langchain_core.language_models import BaseChatModel
from app.agents.new_chat.filesystem_selection import FilesystemMode
from app.agents.shared.filesystem_selection import FilesystemMode
from app.agents.new_chat.middleware import KnowledgeTreeMiddleware

View file

@ -7,7 +7,7 @@ import logging
from deepagents.middleware.skills import SkillsMiddleware
from app.agents.shared.feature_flags import AgentFeatureFlags
from app.agents.new_chat.filesystem_selection import FilesystemMode
from app.agents.shared.filesystem_selection import FilesystemMode
from app.agents.new_chat.middleware import (
build_skills_backend_factory,
default_skills_sources,

View file

@ -4,7 +4,7 @@ from __future__ import annotations
from typing import Any
from app.agents.new_chat.filesystem_selection import FilesystemMode
from app.agents.shared.filesystem_selection import FilesystemMode
from .middleware import SurfSenseFilesystemMiddleware

View file

@ -7,7 +7,7 @@ from typing import Any
from deepagents import FilesystemMiddleware
from langchain_core.tools import BaseTool
from app.agents.new_chat.filesystem_selection import FilesystemMode
from app.agents.shared.filesystem_selection import FilesystemMode
from app.agents.new_chat.filesystem_state import SurfSenseFilesystemState
from app.agents.new_chat.sandbox import is_sandbox_enabled

View file

@ -2,7 +2,7 @@
from __future__ import annotations
from app.agents.new_chat.filesystem_selection import FilesystemMode
from app.agents.shared.filesystem_selection import FilesystemMode
from app.agents.new_chat.path_resolver import DOCUMENTS_ROOT

View file

@ -7,7 +7,7 @@ from typing import TYPE_CHECKING
from langchain.tools import ToolRuntime
from app.agents.new_chat.filesystem_selection import FilesystemMode
from app.agents.shared.filesystem_selection import FilesystemMode
from app.agents.new_chat.filesystem_state import SurfSenseFilesystemState
from app.agents.new_chat.middleware.multi_root_local_folder_backend import (
MultiRootLocalFolderBackend,

View file

@ -2,7 +2,7 @@
from __future__ import annotations
from app.agents.new_chat.filesystem_selection import FilesystemMode
from app.agents.shared.filesystem_selection import FilesystemMode
from .cloud import BODY as CLOUD_BODY
from .common import HEADER, SANDBOX_ADDENDUM

View file

@ -2,7 +2,7 @@
from __future__ import annotations
from app.agents.new_chat.filesystem_selection import FilesystemMode
from app.agents.shared.filesystem_selection import FilesystemMode
_DESCRIPTION = """Changes the current working directory (cwd).

View file

@ -2,7 +2,7 @@
from __future__ import annotations
from app.agents.new_chat.filesystem_selection import FilesystemMode
from app.agents.shared.filesystem_selection import FilesystemMode
_CLOUD_DESCRIPTION = """Performs exact string replacements in files.

View file

@ -2,7 +2,7 @@
from __future__ import annotations
from app.agents.new_chat.filesystem_selection import FilesystemMode
from app.agents.shared.filesystem_selection import FilesystemMode
_DESCRIPTION = """Executes Python code in an isolated sandbox environment.

View file

@ -2,7 +2,7 @@
from __future__ import annotations
from app.agents.new_chat.filesystem_selection import FilesystemMode
from app.agents.shared.filesystem_selection import FilesystemMode
_DESCRIPTION = """Find files matching a glob pattern.

View file

@ -2,7 +2,7 @@
from __future__ import annotations
from app.agents.new_chat.filesystem_selection import FilesystemMode
from app.agents.shared.filesystem_selection import FilesystemMode
_CLOUD_DESCRIPTION = """Search for a literal text pattern across files.

View file

@ -2,7 +2,7 @@
from __future__ import annotations
from app.agents.new_chat.filesystem_selection import FilesystemMode
from app.agents.shared.filesystem_selection import FilesystemMode
_CLOUD_DESCRIPTION = """Lists files/folders recursively in a single bounded call.

View file

@ -2,7 +2,7 @@
from __future__ import annotations
from app.agents.new_chat.filesystem_selection import FilesystemMode
from app.agents.shared.filesystem_selection import FilesystemMode
_CLOUD_DESCRIPTION = """Lists files and directories at the given path.

View file

@ -2,7 +2,7 @@
from __future__ import annotations
from app.agents.new_chat.filesystem_selection import FilesystemMode
from app.agents.shared.filesystem_selection import FilesystemMode
_CLOUD_DESCRIPTION = """Creates a directory under `/documents/`.

View file

@ -2,7 +2,7 @@
from __future__ import annotations
from app.agents.new_chat.filesystem_selection import FilesystemMode
from app.agents.shared.filesystem_selection import FilesystemMode
_CLOUD_DESCRIPTION = """Moves or renames a file or folder.

View file

@ -2,7 +2,7 @@
from __future__ import annotations
from app.agents.new_chat.filesystem_selection import FilesystemMode
from app.agents.shared.filesystem_selection import FilesystemMode
_DESCRIPTION = """Prints the current working directory."""

View file

@ -2,7 +2,7 @@
from __future__ import annotations
from app.agents.new_chat.filesystem_selection import FilesystemMode
from app.agents.shared.filesystem_selection import FilesystemMode
_DESCRIPTION = """Reads a file from the filesystem.

View file

@ -2,7 +2,7 @@
from __future__ import annotations
from app.agents.new_chat.filesystem_selection import FilesystemMode
from app.agents.shared.filesystem_selection import FilesystemMode
_CLOUD_DESCRIPTION = """Deletes a single file under `/documents/`.

View file

@ -2,7 +2,7 @@
from __future__ import annotations
from app.agents.new_chat.filesystem_selection import FilesystemMode
from app.agents.shared.filesystem_selection import FilesystemMode
_CLOUD_DESCRIPTION = """Deletes an empty directory under `/documents/`.

View file

@ -2,7 +2,7 @@
from __future__ import annotations
from app.agents.new_chat.filesystem_selection import FilesystemMode
from app.agents.shared.filesystem_selection import FilesystemMode
_CLOUD_DESCRIPTION = """Writes a new text file to the workspace.

View file

@ -32,7 +32,7 @@ from app.agents.multi_agent_chat.subagents.builtins.knowledge_base.ask_knowledge
build_ask_knowledge_base_tool,
)
from app.agents.shared.feature_flags import AgentFeatureFlags
from app.agents.new_chat.filesystem_selection import FilesystemMode
from app.agents.shared.filesystem_selection import FilesystemMode
from app.db import ChatVisibility
from .main_agent.action_log import build_action_log_mw