Skip to content

Commit d12d68d

Browse files
authored
Merge pull request #1041 from AnishSarkar22/feat/dropbox-connector
feat: Dropbox connector with sensitive actions using HITL
2 parents 25b068f + 8d591ce commit d12d68d

66 files changed

Lines changed: 4561 additions & 139 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docker/.env.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,11 @@ STT_SERVICE=local/base
209209
# TEAMS_REDIRECT_URI=http://localhost:8000/api/v1/auth/teams/connector/callback
210210
# ONEDRIVE_REDIRECT_URI=http://localhost:8000/api/v1/auth/onedrive/connector/callback
211211

212+
# -- Dropbox --
213+
# DROPBOX_APP_KEY=
214+
# DROPBOX_APP_SECRET=
215+
# DROPBOX_REDIRECT_URI=http://localhost:8000/api/v1/auth/dropbox/connector/callback
216+
212217
# -- Composio --
213218
# COMPOSIO_API_KEY=
214219
# COMPOSIO_ENABLED=TRUE

surfsense_backend/.env.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ MICROSOFT_CLIENT_SECRET=your_microsoft_client_secret_here
101101
TEAMS_REDIRECT_URI=http://localhost:8000/api/v1/auth/teams/connector/callback
102102
ONEDRIVE_REDIRECT_URI=http://localhost:8000/api/v1/auth/onedrive/connector/callback
103103

104+
# Dropbox Connector
105+
DROPBOX_APP_KEY=your_dropbox_app_key_here
106+
DROPBOX_APP_SECRET=your_dropbox_app_secret_here
107+
DROPBOX_REDIRECT_URI=http://localhost:8000/api/v1/auth/dropbox/connector/callback
108+
104109
# Composio Connector
105110
# NOTE: Disable "Mask Connected Account Secrets" in Composio dashboard (Settings → Project Settings) for Google indexing to work.
106111
COMPOSIO_API_KEY=your_api_key_here
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
"""Add Dropbox connector enums
2+
3+
Revision ID: 112
4+
Revises: 111
5+
Create Date: 2026-03-30 00:00:00.000000
6+
7+
"""
8+
9+
from collections.abc import Sequence
10+
11+
from alembic import op
12+
13+
revision: str = "112"
14+
down_revision: str | None = "111"
15+
branch_labels: str | Sequence[str] | None = None
16+
depends_on: str | Sequence[str] | None = None
17+
18+
19+
def upgrade() -> None:
20+
op.execute(
21+
"""
22+
DO $$
23+
BEGIN
24+
IF NOT EXISTS (
25+
SELECT 1 FROM pg_type t
26+
JOIN pg_enum e ON t.oid = e.enumtypid
27+
WHERE t.typname = 'searchsourceconnectortype' AND e.enumlabel = 'DROPBOX_CONNECTOR'
28+
) THEN
29+
ALTER TYPE searchsourceconnectortype ADD VALUE 'DROPBOX_CONNECTOR';
30+
END IF;
31+
END
32+
$$;
33+
"""
34+
)
35+
36+
op.execute(
37+
"""
38+
DO $$
39+
BEGIN
40+
IF NOT EXISTS (
41+
SELECT 1 FROM pg_type t
42+
JOIN pg_enum e ON t.oid = e.enumtypid
43+
WHERE t.typname = 'documenttype' AND e.enumlabel = 'DROPBOX_FILE'
44+
) THEN
45+
ALTER TYPE documenttype ADD VALUE 'DROPBOX_FILE';
46+
END IF;
47+
END
48+
$$;
49+
"""
50+
)
51+
52+
53+
def downgrade() -> None:
54+
pass

surfsense_backend/app/agents/new_chat/chat_deepagent.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
"BOOKSTACK_CONNECTOR": "BOOKSTACK_CONNECTOR",
8585
"CIRCLEBACK_CONNECTOR": "CIRCLEBACK", # Connector type differs from document type
8686
"OBSIDIAN_CONNECTOR": "OBSIDIAN_CONNECTOR",
87+
"DROPBOX_CONNECTOR": "DROPBOX_FILE", # Connector type differs from document type
8788
"ONEDRIVE_CONNECTOR": "ONEDRIVE_FILE", # Connector type differs from document type
8889
# Composio connectors (unified to native document types).
8990
# Reverse of NATIVE_TO_LEGACY_DOCTYPE in app.db.
@@ -317,6 +318,12 @@ async def create_surfsense_deep_agent(
317318
]
318319
modified_disabled_tools.extend(google_drive_tools)
319320

321+
has_dropbox_connector = (
322+
available_connectors is not None and "DROPBOX_FILE" in available_connectors
323+
)
324+
if not has_dropbox_connector:
325+
modified_disabled_tools.extend(["create_dropbox_file", "delete_dropbox_file"])
326+
320327
has_onedrive_connector = (
321328
available_connectors is not None and "ONEDRIVE_FILE" in available_connectors
322329
)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from app.agents.new_chat.tools.dropbox.create_file import (
2+
create_create_dropbox_file_tool,
3+
)
4+
from app.agents.new_chat.tools.dropbox.trash_file import (
5+
create_delete_dropbox_file_tool,
6+
)
7+
8+
__all__ = [
9+
"create_create_dropbox_file_tool",
10+
"create_delete_dropbox_file_tool",
11+
]

0 commit comments

Comments
 (0)