refactor(agents): move tools package to app/agents/shared (slice 6)

Relocate the entire new_chat/tools/ package (62 files incl. registry, hitl, MCP
cluster, and all connector subpackages: gmail/slack/discord/teams/drive/etc.)
to the shared kernel. The package turned out to be a clean cohesive cluster:
its only references to non-tools new_chat modules were comments, and its
middleware deps were already flipped to shared in slice 5c.

Flip 33 live importers (multi-agent, flows, routes, services, anonymous_agent,
tests). Re-export shims remain for the frozen single-agent stack: a package
__init__ mirroring the public surface (new_chat.__init__ imports it) plus
invalid_tool + registry submodule shims (chat_deepagent imports those).

Resolves slice 5c's two transient back-edges: shared/middleware/action_log
(TYPE_CHECKING ToolDefinition) and tool_call_repair (local INVALID_TOOL_NAME)
now point at app.agents.shared.tools.
This commit is contained in:
CREDO23 2026-06-04 13:11:56 +02:00
parent a7fde2a48e
commit aab95b9130
98 changed files with 1232 additions and 1152 deletions

View file

@ -27,8 +27,8 @@ from app.agents.shared.filesystem_backends import build_backend_resolver
from app.agents.shared.filesystem_selection import FilesystemMode, FilesystemSelection
from app.agents.shared.llm_config import AgentConfig
from app.agents.shared.prompt_caching import apply_litellm_prompt_caching
from app.agents.new_chat.tools.invalid_tool import INVALID_TOOL_NAME, invalid_tool
from app.agents.new_chat.tools.registry import build_tools_async
from app.agents.shared.tools.invalid_tool import INVALID_TOOL_NAME, invalid_tool
from app.agents.shared.tools.registry import build_tools_async
from app.db import ChatVisibility
from app.services.connector_service import ConnectorService
from app.services.user_tool_allowlist import (

View file

@ -6,7 +6,7 @@ import logging
from app.agents.shared.feature_flags import AgentFeatureFlags
from app.agents.shared.middleware import ActionLogMiddleware
from app.agents.new_chat.tools.registry import BUILTIN_TOOLS
from app.agents.shared.tools.registry import BUILTIN_TOOLS
from ..shared.flags import enabled

View file

@ -1,13 +1,13 @@
from app.agents.new_chat.tools.google_calendar.create_event import (
from app.agents.shared.tools.google_calendar.create_event import (
create_create_calendar_event_tool,
)
from app.agents.new_chat.tools.google_calendar.delete_event import (
from app.agents.shared.tools.google_calendar.delete_event import (
create_delete_calendar_event_tool,
)
from app.agents.new_chat.tools.google_calendar.search_events import (
from app.agents.shared.tools.google_calendar.search_events import (
create_search_calendar_events_tool,
)
from app.agents.new_chat.tools.google_calendar.update_event import (
from app.agents.shared.tools.google_calendar.update_event import (
create_update_calendar_event_tool,
)

View file

@ -5,7 +5,7 @@ from langchain_core.tools import tool
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.future import select
from app.agents.new_chat.tools.gmail.search_emails import _build_credentials
from app.agents.shared.tools.gmail.search_emails import _build_credentials
from app.db import SearchSourceConnector, SearchSourceConnectorType
logger = logging.getLogger(__name__)

View file

@ -1,10 +1,10 @@
from app.agents.new_chat.tools.discord.list_channels import (
from app.agents.shared.tools.discord.list_channels import (
create_list_discord_channels_tool,
)
from app.agents.new_chat.tools.discord.read_messages import (
from app.agents.shared.tools.discord.read_messages import (
create_read_discord_messages_tool,
)
from app.agents.new_chat.tools.discord.send_message import (
from app.agents.shared.tools.discord.send_message import (
create_send_discord_message_tool,
)

View file

@ -1,7 +1,7 @@
from app.agents.new_chat.tools.dropbox.create_file import (
from app.agents.shared.tools.dropbox.create_file import (
create_create_dropbox_file_tool,
)
from app.agents.new_chat.tools.dropbox.trash_file import (
from app.agents.shared.tools.dropbox.trash_file import (
create_delete_dropbox_file_tool,
)

View file

@ -1,19 +1,19 @@
from app.agents.new_chat.tools.gmail.create_draft import (
from app.agents.shared.tools.gmail.create_draft import (
create_create_gmail_draft_tool,
)
from app.agents.new_chat.tools.gmail.read_email import (
from app.agents.shared.tools.gmail.read_email import (
create_read_gmail_email_tool,
)
from app.agents.new_chat.tools.gmail.search_emails import (
from app.agents.shared.tools.gmail.search_emails import (
create_search_gmail_tool,
)
from app.agents.new_chat.tools.gmail.send_email import (
from app.agents.shared.tools.gmail.send_email import (
create_send_gmail_email_tool,
)
from app.agents.new_chat.tools.gmail.trash_email import (
from app.agents.shared.tools.gmail.trash_email import (
create_trash_gmail_email_tool,
)
from app.agents.new_chat.tools.gmail.update_draft import (
from app.agents.shared.tools.gmail.update_draft import (
create_update_gmail_draft_tool,
)

View file

@ -61,7 +61,7 @@ def create_read_gmail_email_tool(
"message": "Composio connected account ID not found for this Gmail connector.",
}
from app.agents.new_chat.tools.gmail.search_emails import (
from app.agents.shared.tools.gmail.search_emails import (
_format_gmail_summary,
)
from app.services.composio_service import ComposioService
@ -97,7 +97,7 @@ def create_read_gmail_email_tool(
"content": content,
}
from app.agents.new_chat.tools.gmail.search_emails import (
from app.agents.shared.tools.gmail.search_emails import (
_build_credentials,
)

View file

@ -69,7 +69,7 @@ def create_search_gmail_tool(
"message": "Composio connected account ID not found for this Gmail connector.",
}
from app.agents.new_chat.tools.gmail.search_emails import (
from app.agents.shared.tools.gmail.search_emails import (
_format_gmail_summary,
)
from app.services.composio_service import ComposioService
@ -98,7 +98,7 @@ def create_search_gmail_tool(
}
return {"status": "success", "emails": emails, "total": len(emails)}
from app.agents.new_chat.tools.gmail.search_emails import (
from app.agents.shared.tools.gmail.search_emails import (
_build_credentials,
)

View file

@ -1,7 +1,7 @@
from app.agents.new_chat.tools.google_drive.create_file import (
from app.agents.shared.tools.google_drive.create_file import (
create_create_google_drive_file_tool,
)
from app.agents.new_chat.tools.google_drive.trash_file import (
from app.agents.shared.tools.google_drive.trash_file import (
create_delete_google_drive_file_tool,
)

View file

@ -1,10 +1,10 @@
from app.agents.new_chat.tools.luma.create_event import (
from app.agents.shared.tools.luma.create_event import (
create_create_luma_event_tool,
)
from app.agents.new_chat.tools.luma.list_events import (
from app.agents.shared.tools.luma.list_events import (
create_list_luma_events_tool,
)
from app.agents.new_chat.tools.luma.read_event import (
from app.agents.shared.tools.luma.read_event import (
create_read_luma_event_tool,
)

View file

@ -1,7 +1,7 @@
from app.agents.new_chat.tools.onedrive.create_file import (
from app.agents.shared.tools.onedrive.create_file import (
create_create_onedrive_file_tool,
)
from app.agents.new_chat.tools.onedrive.trash_file import (
from app.agents.shared.tools.onedrive.trash_file import (
create_delete_onedrive_file_tool,
)

View file

@ -1,10 +1,10 @@
from app.agents.new_chat.tools.teams.list_channels import (
from app.agents.shared.tools.teams.list_channels import (
create_list_teams_channels_tool,
)
from app.agents.new_chat.tools.teams.read_messages import (
from app.agents.shared.tools.teams.read_messages import (
create_read_teams_messages_tool,
)
from app.agents.new_chat.tools.teams.send_message import (
from app.agents.shared.tools.teams.send_message import (
create_send_teams_message_tool,
)

View file

@ -21,7 +21,7 @@ from sqlalchemy.ext.asyncio import AsyncSession
from app.agents.multi_agent_chat.constants import (
CONNECTOR_TYPE_TO_CONNECTOR_AGENT_MAPS,
)
from app.agents.new_chat.tools.mcp_tool import load_mcp_tools
from app.agents.shared.tools.mcp_tool import load_mcp_tools
from app.db import SearchSourceConnector
logger = logging.getLogger(__name__)