mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-06 20:15:17 +02:00
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:
parent
c0c4f57f5d
commit
82c5dc5b02
126 changed files with 238 additions and 196 deletions
|
|
@ -204,7 +204,7 @@ async def validate_llm_config(
|
|||
if litellm_params:
|
||||
litellm_kwargs.update(litellm_params)
|
||||
|
||||
from app.agents.shared.llm_config import SanitizedChatLiteLLM
|
||||
from app.agents.multi_agent_chat.shared.llm_config import SanitizedChatLiteLLM
|
||||
|
||||
llm = SanitizedChatLiteLLM(**litellm_kwargs)
|
||||
|
||||
|
|
@ -379,7 +379,9 @@ async def get_search_space_llm_instance(
|
|||
if disable_streaming:
|
||||
litellm_kwargs["disable_streaming"] = True
|
||||
|
||||
from app.agents.shared.llm_config import SanitizedChatLiteLLM
|
||||
from app.agents.multi_agent_chat.shared.llm_config import (
|
||||
SanitizedChatLiteLLM,
|
||||
)
|
||||
|
||||
return SanitizedChatLiteLLM(**litellm_kwargs)
|
||||
|
||||
|
|
@ -458,7 +460,7 @@ async def get_search_space_llm_instance(
|
|||
if disable_streaming:
|
||||
litellm_kwargs["disable_streaming"] = True
|
||||
|
||||
from app.agents.shared.llm_config import SanitizedChatLiteLLM
|
||||
from app.agents.multi_agent_chat.shared.llm_config import SanitizedChatLiteLLM
|
||||
|
||||
return SanitizedChatLiteLLM(**litellm_kwargs)
|
||||
|
||||
|
|
@ -580,7 +582,9 @@ async def get_vision_llm(
|
|||
if global_cfg.get("litellm_params"):
|
||||
litellm_kwargs.update(global_cfg["litellm_params"])
|
||||
|
||||
from app.agents.shared.llm_config import SanitizedChatLiteLLM
|
||||
from app.agents.multi_agent_chat.shared.llm_config import (
|
||||
SanitizedChatLiteLLM,
|
||||
)
|
||||
|
||||
inner_llm = SanitizedChatLiteLLM(**litellm_kwargs)
|
||||
|
||||
|
|
@ -634,7 +638,7 @@ async def get_vision_llm(
|
|||
if vision_cfg.litellm_params:
|
||||
litellm_kwargs.update(vision_cfg.litellm_params)
|
||||
|
||||
from app.agents.shared.llm_config import SanitizedChatLiteLLM
|
||||
from app.agents.multi_agent_chat.shared.llm_config import SanitizedChatLiteLLM
|
||||
|
||||
return SanitizedChatLiteLLM(**litellm_kwargs)
|
||||
|
||||
|
|
@ -679,7 +683,9 @@ def get_planner_llm() -> ChatLiteLLM | None:
|
|||
Callers MUST fall back to their chat LLM when this returns ``None`` so
|
||||
deployments without a planner config keep working unchanged.
|
||||
"""
|
||||
from app.agents.shared.llm_config import create_chat_litellm_from_config
|
||||
from app.agents.multi_agent_chat.shared.llm_config import (
|
||||
create_chat_litellm_from_config,
|
||||
)
|
||||
|
||||
planner_cfg = next(
|
||||
(cfg for cfg in config.GLOBAL_LLM_CONFIGS if cfg.get("is_planner") is True),
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ logger = logging.getLogger(__name__)
|
|||
#
|
||||
# Owned here because ``app.services.provider_capabilities`` is the
|
||||
# only edge that's safe to call from ``app.config``'s YAML loader at
|
||||
# class-body init time. ``app.agents.shared.llm_config`` re-exports
|
||||
# class-body init time. ``app.agents.multi_agent_chat.shared.llm_config`` re-exports
|
||||
# this constant under the historical ``PROVIDER_MAP`` name; placing the
|
||||
# map there directly would re-introduce the
|
||||
# ``app.config -> ... -> deliverables/tools/generate_image ->
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ from typing import Any, Literal
|
|||
from sqlalchemy import delete, select
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from app.agents.shared.path_resolver import (
|
||||
from app.agents.multi_agent_chat.shared.path_resolver import (
|
||||
DOCUMENTS_ROOT,
|
||||
safe_filename,
|
||||
safe_folder_segment,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue