mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-08 20:25:19 +02:00
refactor(agents): evict mac-only tools/middleware from shared kernel
These were never shared with anonymous_chat (nor podcaster/video_presentation)
-- only multi_agent_chat (subagents/main agent) and the boundary use them:
shared/tools/mcp/ -> multi_agent_chat/shared/tools/mcp/
shared/tools/hitl.py -> multi_agent_chat/shared/tools/hitl.py
shared/tools/catalog.py -> multi_agent_chat/shared/tools/catalog.py
shared/middleware/dedup_tool_calls.py
-> multi_agent_chat/shared/middleware/dedup_tool_calls.py
app/agents/shared/ now holds only the genuine anon<->mac kernel:
context, middleware/{compaction,retry_after}, tools/web_search.
This commit is contained in:
parent
b7ea829371
commit
d59bb2b5aa
21 changed files with 50 additions and 40 deletions
|
|
@ -665,7 +665,7 @@ def _refresh_mcp_cache(connector_id: int, space_id: int) -> None:
|
|||
isolated from the OAuth response flow.
|
||||
"""
|
||||
try:
|
||||
from app.agents.shared.tools.mcp.cache import (
|
||||
from app.agents.multi_agent_chat.shared.tools.mcp.cache import (
|
||||
refresh_mcp_tools_cache_for_connector,
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -1668,7 +1668,7 @@ async def list_agent_tools(
|
|||
|
||||
Hidden (WIP) tools are excluded from the response.
|
||||
"""
|
||||
from app.agents.shared.tools.catalog import TOOL_CATALOG
|
||||
from app.agents.multi_agent_chat.shared.tools.catalog import TOOL_CATALOG
|
||||
|
||||
return [
|
||||
AgentToolInfo(
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ from app.db import (
|
|||
async_session_maker,
|
||||
get_async_session,
|
||||
)
|
||||
from app.notifications.service import NotificationService
|
||||
from app.observability import metrics as ot_metrics, otel as ot
|
||||
from app.schemas import (
|
||||
GoogleDriveIndexRequest,
|
||||
|
|
@ -55,7 +56,6 @@ from app.schemas import (
|
|||
SearchSourceConnectorUpdate,
|
||||
)
|
||||
from app.services.composio_service import ComposioService, get_composio_service
|
||||
from app.notifications.service import NotificationService
|
||||
from app.users import current_active_user
|
||||
|
||||
# NOTE: connector indexer functions are imported lazily inside each
|
||||
|
|
@ -675,7 +675,9 @@ async def delete_search_source_connector(
|
|||
await session.commit()
|
||||
|
||||
if is_mcp:
|
||||
from app.agents.shared.tools.mcp.tool import invalidate_mcp_tools_cache
|
||||
from app.agents.multi_agent_chat.shared.tools.mcp.tool import (
|
||||
invalidate_mcp_tools_cache,
|
||||
)
|
||||
|
||||
invalidate_mcp_tools_cache(search_space_id)
|
||||
|
||||
|
|
@ -2687,7 +2689,7 @@ async def create_mcp_connector(
|
|||
f"for user {user.id} in search space {search_space_id}"
|
||||
)
|
||||
|
||||
from app.agents.shared.tools.mcp.cache import (
|
||||
from app.agents.multi_agent_chat.shared.tools.mcp.cache import (
|
||||
refresh_mcp_tools_cache_for_connector,
|
||||
)
|
||||
|
||||
|
|
@ -2867,7 +2869,7 @@ async def update_mcp_connector(
|
|||
|
||||
logger.info(f"Updated MCP connector {connector_id}")
|
||||
|
||||
from app.agents.shared.tools.mcp.cache import (
|
||||
from app.agents.multi_agent_chat.shared.tools.mcp.cache import (
|
||||
refresh_mcp_tools_cache_for_connector,
|
||||
)
|
||||
|
||||
|
|
@ -2927,7 +2929,9 @@ async def delete_mcp_connector(
|
|||
await session.delete(connector)
|
||||
await session.commit()
|
||||
|
||||
from app.agents.shared.tools.mcp.tool import invalidate_mcp_tools_cache
|
||||
from app.agents.multi_agent_chat.shared.tools.mcp.tool import (
|
||||
invalidate_mcp_tools_cache,
|
||||
)
|
||||
|
||||
invalidate_mcp_tools_cache(search_space_id)
|
||||
|
||||
|
|
@ -2966,7 +2970,7 @@ async def test_mcp_server_connection(
|
|||
Connection status and list of available tools
|
||||
"""
|
||||
try:
|
||||
from app.agents.shared.tools.mcp.client import (
|
||||
from app.agents.multi_agent_chat.shared.tools.mcp.client import (
|
||||
test_mcp_connection,
|
||||
test_mcp_http_connection,
|
||||
)
|
||||
|
|
@ -3157,7 +3161,9 @@ async def trust_mcp_tool(
|
|||
connectors (``LINEAR_CONNECTOR``, ``JIRA_CONNECTOR``, ...) — the
|
||||
storage primitive is the same JSON list under ``config.trusted_tools``.
|
||||
"""
|
||||
from app.agents.shared.tools.mcp.tool import invalidate_mcp_tools_cache
|
||||
from app.agents.multi_agent_chat.shared.tools.mcp.tool import (
|
||||
invalidate_mcp_tools_cache,
|
||||
)
|
||||
from app.services.user_tool_allowlist import add_user_trust
|
||||
|
||||
try:
|
||||
|
|
@ -3197,7 +3203,9 @@ async def untrust_mcp_tool(
|
|||
|
||||
The tool will require HITL approval again on subsequent calls.
|
||||
"""
|
||||
from app.agents.shared.tools.mcp.tool import invalidate_mcp_tools_cache
|
||||
from app.agents.multi_agent_chat.shared.tools.mcp.tool import (
|
||||
invalidate_mcp_tools_cache,
|
||||
)
|
||||
from app.services.user_tool_allowlist import remove_user_trust
|
||||
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue