mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-06 20:15:17 +02:00
Promote the filesystem mode contracts (FilesystemMode, FilesystemSelection, ClientPlatform, LocalFilesystemMount) out of `new_chat` into the cross-agent `app/agents/shared` kernel. Pure leaf consumed across the whole multi-agent filesystem middleware/tool tree, the chat flows/monolith, routes and tests. git mv (content unchanged) + flipped all ~48 importers. A re-export shim remains at new_chat/filesystem_selection.py only for the not-yet-retired single-agent (chat_deepagent). Also updated the stream parity test's annotation normalizer to strip the new app.agents.shared.filesystem_selection. prefix (the dataclasses' __module__ changed with the move), keeping monolith<->flows signature parity intact. Behavior-preserving: only import paths change. 1326 tests green.
41 lines
1,013 B
Python
41 lines
1,013 B
Python
"""Filesystem mode contracts and selection helpers for chat sessions."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass
|
|
from enum import StrEnum
|
|
|
|
|
|
class FilesystemMode(StrEnum):
|
|
"""Supported filesystem backends for agent tool execution."""
|
|
|
|
CLOUD = "cloud"
|
|
DESKTOP_LOCAL_FOLDER = "desktop_local_folder"
|
|
|
|
|
|
class ClientPlatform(StrEnum):
|
|
"""Client runtime reported by the caller."""
|
|
|
|
WEB = "web"
|
|
DESKTOP = "desktop"
|
|
|
|
|
|
@dataclass(slots=True)
|
|
class LocalFilesystemMount:
|
|
"""Canonical mount mapping provided by desktop runtime."""
|
|
|
|
mount_id: str
|
|
root_path: str
|
|
|
|
|
|
@dataclass(slots=True)
|
|
class FilesystemSelection:
|
|
"""Resolved filesystem selection for a single chat request."""
|
|
|
|
mode: FilesystemMode = FilesystemMode.CLOUD
|
|
client_platform: ClientPlatform = ClientPlatform.WEB
|
|
local_mounts: tuple[LocalFilesystemMount, ...] = ()
|
|
|
|
@property
|
|
def is_local_mode(self) -> bool:
|
|
return self.mode == FilesystemMode.DESKTOP_LOCAL_FOLDER
|