mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-06 14:22:47 +02:00
Remove obsolete main-agent connector permission helpers.
This commit is contained in:
parent
fbcff79a58
commit
2bce2a2f55
4 changed files with 0 additions and 91 deletions
|
|
@ -1,13 +0,0 @@
|
|||
"""Connector-gated tool deny rules and small permission helpers for the main-agent graph."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from .connector_deny_rules import synthesize_connector_deny_rules
|
||||
from .connector_gated_tool_names import iter_connector_gated_tools
|
||||
from .rule import Rule
|
||||
|
||||
__all__ = [
|
||||
"Rule",
|
||||
"iter_connector_gated_tools",
|
||||
"synthesize_connector_deny_rules",
|
||||
]
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
"""Synthesized PermissionMiddleware deny rules for tools gated by connector."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from .connector_gated_tool_names import iter_connector_gated_tools
|
||||
from .rule import Rule
|
||||
|
||||
|
||||
def synthesize_connector_deny_rules(
|
||||
*,
|
||||
available_connectors: list[str] | None,
|
||||
enabled_tool_names: set[str],
|
||||
) -> list[Rule]:
|
||||
available = set(available_connectors or [])
|
||||
deny: list[Rule] = []
|
||||
for name, required in iter_connector_gated_tools():
|
||||
if name not in enabled_tool_names:
|
||||
continue
|
||||
if required not in available:
|
||||
deny.append(Rule(permission=name, pattern="*", action="deny"))
|
||||
return deny
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
"""Tool name → required searchable connector type (keep in sync with new_chat ``BUILTIN_TOOLS``)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
# Synced from ``app.agents.new_chat.tools.registry`` ToolDefinition.required_connector entries.
|
||||
_CONNECTOR_GATED: tuple[tuple[str, str], ...] = (
|
||||
("create_notion_page", "NOTION_CONNECTOR"),
|
||||
("update_notion_page", "NOTION_CONNECTOR"),
|
||||
("delete_notion_page", "NOTION_CONNECTOR"),
|
||||
("create_google_drive_file", "GOOGLE_DRIVE_FILE"),
|
||||
("delete_google_drive_file", "GOOGLE_DRIVE_FILE"),
|
||||
("create_dropbox_file", "DROPBOX_FILE"),
|
||||
("delete_dropbox_file", "DROPBOX_FILE"),
|
||||
("create_onedrive_file", "ONEDRIVE_FILE"),
|
||||
("delete_onedrive_file", "ONEDRIVE_FILE"),
|
||||
("search_calendar_events", "GOOGLE_CALENDAR_CONNECTOR"),
|
||||
("create_calendar_event", "GOOGLE_CALENDAR_CONNECTOR"),
|
||||
("update_calendar_event", "GOOGLE_CALENDAR_CONNECTOR"),
|
||||
("delete_calendar_event", "GOOGLE_CALENDAR_CONNECTOR"),
|
||||
("search_gmail", "GOOGLE_GMAIL_CONNECTOR"),
|
||||
("read_gmail_email", "GOOGLE_GMAIL_CONNECTOR"),
|
||||
("create_gmail_draft", "GOOGLE_GMAIL_CONNECTOR"),
|
||||
("send_gmail_email", "GOOGLE_GMAIL_CONNECTOR"),
|
||||
("trash_gmail_email", "GOOGLE_GMAIL_CONNECTOR"),
|
||||
("update_gmail_draft", "GOOGLE_GMAIL_CONNECTOR"),
|
||||
("create_confluence_page", "CONFLUENCE_CONNECTOR"),
|
||||
("update_confluence_page", "CONFLUENCE_CONNECTOR"),
|
||||
("delete_confluence_page", "CONFLUENCE_CONNECTOR"),
|
||||
("list_discord_channels", "DISCORD_CONNECTOR"),
|
||||
("read_discord_messages", "DISCORD_CONNECTOR"),
|
||||
("send_discord_message", "DISCORD_CONNECTOR"),
|
||||
("list_teams_channels", "TEAMS_CONNECTOR"),
|
||||
("read_teams_messages", "TEAMS_CONNECTOR"),
|
||||
("send_teams_message", "TEAMS_CONNECTOR"),
|
||||
("list_luma_events", "LUMA_CONNECTOR"),
|
||||
("read_luma_event", "LUMA_CONNECTOR"),
|
||||
("create_luma_event", "LUMA_CONNECTOR"),
|
||||
)
|
||||
|
||||
|
||||
def iter_connector_gated_tools() -> tuple[tuple[str, str], ...]:
|
||||
return _CONNECTOR_GATED
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
"""Minimal permission rule type (mirrors OpenCode semantics used by PermissionMiddleware)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import Literal
|
||||
|
||||
RuleAction = Literal["allow", "deny", "ask"]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Rule:
|
||||
permission: str
|
||||
pattern: str
|
||||
action: RuleAction
|
||||
Loading…
Add table
Add a link
Reference in a new issue