mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-08 20:25:19 +02:00
refactor(agents): move kb_persistence middleware into main_agent (owner)
The KB-persistence impl lived in shared/middleware/ but no subagent uses it -- consumers are the main_agent builder and the boundary event loop. Colocate with its owner using the folder-per-middleware shape; __init__ re-exports the public surface. Tests that reached module internals now alias the .middleware submodule. main_agent/middleware/kb_persistence.py -> kb_persistence/builder.py shared/middleware/kb_persistence.py -> kb_persistence/middleware.py
This commit is contained in:
parent
a7a642fedc
commit
0081b627e9
6 changed files with 19 additions and 5 deletions
|
|
@ -0,0 +1,13 @@
|
||||||
|
"""End-of-turn KB persistence middleware (main-agent only)."""
|
||||||
|
|
||||||
|
from .builder import build_kb_persistence_mw
|
||||||
|
from .middleware import (
|
||||||
|
KnowledgeBasePersistenceMiddleware,
|
||||||
|
commit_staged_filesystem_state,
|
||||||
|
)
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"KnowledgeBasePersistenceMiddleware",
|
||||||
|
"build_kb_persistence_mw",
|
||||||
|
"commit_staged_filesystem_state",
|
||||||
|
]
|
||||||
|
|
@ -3,7 +3,8 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from app.agents.chat.multi_agent_chat.shared.filesystem_selection import FilesystemMode
|
from app.agents.chat.multi_agent_chat.shared.filesystem_selection import FilesystemMode
|
||||||
from app.agents.chat.multi_agent_chat.shared.middleware.kb_persistence import (
|
|
||||||
|
from .middleware import (
|
||||||
KnowledgeBasePersistenceMiddleware,
|
KnowledgeBasePersistenceMiddleware,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -11,10 +11,10 @@ from __future__ import annotations
|
||||||
from collections.abc import AsyncGenerator
|
from collections.abc import AsyncGenerator
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from app.agents.chat.multi_agent_chat.shared.filesystem_selection import FilesystemMode
|
from app.agents.chat.multi_agent_chat.main_agent.middleware.kb_persistence import (
|
||||||
from app.agents.chat.multi_agent_chat.shared.middleware.kb_persistence import (
|
|
||||||
commit_staged_filesystem_state,
|
commit_staged_filesystem_state,
|
||||||
)
|
)
|
||||||
|
from app.agents.chat.multi_agent_chat.shared.filesystem_selection import FilesystemMode
|
||||||
from app.services.new_streaming_service import VercelStreamingService
|
from app.services.new_streaming_service import VercelStreamingService
|
||||||
from app.tasks.chat.streaming.contract.file_contract import (
|
from app.tasks.chat.streaming.contract.file_contract import (
|
||||||
contract_enforcement_active,
|
contract_enforcement_active,
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ from unittest.mock import AsyncMock
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from app.agents.chat.multi_agent_chat.shared.middleware import kb_persistence
|
from app.agents.chat.multi_agent_chat.main_agent.middleware.kb_persistence import middleware as kb_persistence
|
||||||
from app.db import Document
|
from app.db import Document
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ from unittest.mock import AsyncMock, MagicMock
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from app.agents.chat.multi_agent_chat.shared.middleware import kb_persistence
|
from app.agents.chat.multi_agent_chat.main_agent.middleware.kb_persistence import middleware as kb_persistence
|
||||||
|
|
||||||
pytestmark = pytest.mark.unit
|
pytestmark = pytest.mark.unit
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue