SurfSense/surfsense_backend/app/agents/multi_agent_chat/shared
CREDO23 8ae190a11d refactor(agents): move MAC middleware impls out of shared kernel
knowledge_search, memory_injection and scoped_model_fallback no longer
belong in the cross-agent kernel (app/agents/shared/middleware): they are
consumed only inside multi_agent_chat. Relocate each impl next to the
builder that uses it:

- knowledge_search.py -> multi_agent_chat/shared/middleware/ (genuinely
  shared: its _render_priority_message feeds kb_context_projection, used by
  both the main agent and the KB subagent)
- memory_injection.py -> multi_agent_chat/shared/middleware/ (beside its
  memory.py builder)
- scoped_model_fallback.py -> multi_agent_chat/shared/middleware/resilience/
  (beside fallback.py/bundle.py)

Impls moved verbatim (git rename). Builders/consumers now import the local
sibling; main_agent knowledge_priority imports the new shared path; shared
middleware barrel trimmed.

Tests: repoint imports; convert the knowledge_search monkeypatch targets
from brittle dotted-string form to object-based patching (monkeypatch.setattr
on the imported module), which is robust to import ordering. No behavior
change.
2026-06-05 12:04:31 +02:00
..
middleware refactor(agents): move MAC middleware impls out of shared kernel 2026-06-05 12:04:31 +02:00
receipts refactor(agents): group tool-outcome receipts into multi_agent_chat/shared/receipts/ 2026-06-05 10:56:37 +02:00
state refactor(agents): group tool-outcome receipts into multi_agent_chat/shared/receipts/ 2026-06-05 10:56:37 +02:00
__init__.py refactor(agents): colocate middleware into vertical slices 2026-06-04 18:13:47 +02:00
date_filters.py refactor(agents): colocate KB-search tool with its sole consumer; fix report ImportError 2026-06-05 10:28:56 +02:00
permissions.py refactor(agents): relocate remaining MAC-only kernel (permissions, deliverable_wait) 2026-06-05 10:58:49 +02:00