Conversation
- Updated DocumentNode to use a div instead of a button for better accessibility and added keyboard interaction for selection. - Introduced Checkbox component in FolderNode for selecting folders, with state management for selection (all, some, none). - Implemented folder selection state logic in FolderTreeView to manage document selection across nested folders. - Added handleToggleFolderSelect function in DocumentsSidebar to manage selection of documents based on folder selection.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Review by RecurseML
🔍 Review performed on 947def5..2cc2d33
✨ No bugs found, your code is sparkling clean
✅ Files analyzed, no issues (49)
• surfsense_backend/.env.example
• surfsense_backend/app/agents/new_chat/__init__.py
• surfsense_backend/app/agents/new_chat/chat_deepagent.py
• surfsense_backend/app/agents/new_chat/middleware/__init__.py
• surfsense_backend/app/agents/new_chat/middleware/knowledge_search.py
• surfsense_backend/app/agents/new_chat/system_prompt.py
• surfsense_backend/app/agents/new_chat/tools/__init__.py
• surfsense_backend/app/agents/new_chat/tools/google_calendar/update_event.py
• surfsense_backend/app/agents/new_chat/tools/knowledge_base.py
• surfsense_backend/app/agents/new_chat/tools/registry.py
• surfsense_backend/app/agents/new_chat/tools/report.py
• surfsense_backend/app/connectors/google_drive/change_tracker.py
• surfsense_backend/app/connectors/google_drive/client.py
• surfsense_backend/app/connectors/google_drive/content_extractor.py
• surfsense_backend/app/indexing_pipeline/document_hashing.py
• surfsense_backend/app/indexing_pipeline/indexing_pipeline_service.py
• surfsense_backend/app/retriever/chunks_hybrid_search.py
• surfsense_backend/app/retriever/documents_hybrid_search.py
• surfsense_backend/app/routes/editor_routes.py
• surfsense_backend/app/routes/search_source_connectors_routes.py
• surfsense_backend/app/tasks/chat/stream_new_chat.py
• surfsense_backend/app/tasks/connector_indexers/confluence_indexer.py
• surfsense_backend/app/tasks/connector_indexers/google_calendar_indexer.py
• surfsense_backend/app/tasks/connector_indexers/google_drive_indexer.py
• surfsense_backend/app/tasks/connector_indexers/google_gmail_indexer.py
• surfsense_backend/app/tasks/connector_indexers/jira_indexer.py
• surfsense_backend/app/tasks/connector_indexers/linear_indexer.py
• surfsense_backend/app/tasks/connector_indexers/notion_indexer.py
• surfsense_backend/pyproject.toml
• surfsense_backend/tests/integration/indexing_pipeline/test_calendar_pipeline.py
• surfsense_backend/tests/integration/indexing_pipeline/test_drive_pipeline.py
• surfsense_backend/tests/integration/indexing_pipeline/test_gmail_pipeline.py
• surfsense_backend/tests/integration/indexing_pipeline/test_index_batch.py
• surfsense_backend/tests/integration/retriever/conftest.py
• surfsense_backend/tests/integration/retriever/test_optimized_chunk_retriever.py
• surfsense_backend/tests/integration/retriever/test_optimized_doc_retriever.py
• surfsense_backend/tests/unit/connector_indexers/test_confluence_parallel.py
• surfsense_backend/tests/unit/connector_indexers/test_google_drive_parallel.py
• surfsense_backend/tests/unit/connector_indexers/test_jira_parallel.py
• surfsense_backend/tests/unit/connector_indexers/test_linear_parallel.py
• surfsense_backend/tests/unit/connector_indexers/test_notion_parallel.py
• surfsense_backend/tests/unit/indexing_pipeline/test_create_placeholder_documents.py
• surfsense_backend/tests/unit/indexing_pipeline/test_index_batch.py
• surfsense_backend/tests/unit/indexing_pipeline/test_index_batch_parallel.py
• surfsense_backend/tests/unit/indexing_pipeline/test_prepare_placeholder_dedup.py
• surfsense_backend/tests/unit/middleware/test_knowledge_search.py
• surfsense_web/app/dashboard/[search_space_id]/new-chat/[[...chat_id]]/page.tsx
• surfsense_web/app/dashboard/[search_space_id]/new-chat/loading.tsx
• surfsense_web/atoms/documents/ui.atoms.ts
⏭️ Files skipped (16)
| Locations |
|---|
surfsense_backend/tests/integration/retriever/__init__.py |
surfsense_backend/uv.lock |
surfsense_web/components/assistant-ui/connector-popup.tsx |
surfsense_web/components/assistant-ui/markdown-text.tsx |
surfsense_web/components/assistant-ui/thread.tsx |
surfsense_web/components/documents/CreateFolderDialog.tsx |
surfsense_web/components/documents/DocumentNode.tsx |
surfsense_web/components/documents/FolderNode.tsx |
surfsense_web/components/documents/FolderTreeView.tsx |
surfsense_web/components/layout/ui/sidebar/DocumentsSidebar.tsx |
surfsense_web/components/onboarding-tour.tsx |
surfsense_web/components/report-panel/report-panel.tsx |
surfsense_web/components/shared/ExportMenuItems.tsx |
surfsense_web/components/tool-ui/google-calendar/update-event.tsx |
surfsense_web/contracts/enums/toolIcons.tsx |
surfsense_web/hooks/use-zero-document-type-counts.ts |
Description
Motivation and Context
FIX #
Screenshots
API Changes
Change Type
Testing Performed
Checklist
High-level PR Summary
This PR introduces a new file-based agent architecture for SurfSense chat, replacing the previous tool-based knowledge search with a pre-seeded filesystem middleware approach. The agent now automatically loads relevant documents into a virtual
/documents/filesystem at the start of each conversation turn using hybrid search, then uses file operations (ls,read_file,grep,glob) instead of callingsearch_knowledge_basedirectly. Major changes include: removing the Daytona sandbox backend andexecutetool; implementingKnowledgeBaseSearchMiddlewarethat pre-populates a filesystem with search results formatted as XML with citation-friendly chunk indexes; addingSurfSenseFilesystemMiddlewarewith asave_documenttool that persists new documents to the database; upgrading todeepagents>=0.4.12and manually constructing the middleware stack (switching fromcreate_deep_agenttocreate_agentfor full control); overhauling system prompts to instruct the LLM to read files efficiently using line offsets and chunk indexes; optimizing hybrid search retrievers with SQL-level per-document chunk limits and column pruning; implementing placeholder document creation for instant UI feedback during connector indexing; adding frontend support for bulk folder selection/deletion and real-time document creation events; and removing thesearch_knowledge_basetool entirely from the agent's toolset.⏱️ Estimated Review Time: 1-3 hours
💡 Review Order Suggestion
surfsense_backend/pyproject.tomlsurfsense_backend/app/agents/new_chat/middleware/__init__.pysurfsense_backend/app/agents/new_chat/middleware/filesystem.pysurfsense_backend/app/agents/new_chat/middleware/knowledge_search.pysurfsense_backend/app/agents/new_chat/chat_deepagent.pysurfsense_backend/app/agents/new_chat/system_prompt.pysurfsense_backend/app/agents/new_chat/__init__.pysurfsense_backend/app/agents/new_chat/tools/__init__.pysurfsense_backend/app/agents/new_chat/tools/knowledge_base.pysurfsense_backend/app/agents/new_chat/tools/registry.pysurfsense_backend/app/tasks/chat/stream_new_chat.pysurfsense_backend/app/indexing_pipeline/indexing_pipeline_service.pysurfsense_backend/app/retriever/chunks_hybrid_search.pysurfsense_backend/app/retriever/documents_hybrid_search.pysurfsense_backend/.env.examplesurfsense_backend/app/routes/editor_routes.pysurfsense_backend/app/routes/search_source_connectors_routes.pysurfsense_backend/app/tasks/connector_indexers/google_drive_indexer.pysurfsense_backend/app/tasks/connector_indexers/confluence_indexer.pysurfsense_backend/app/tasks/connector_indexers/google_gmail_indexer.pysurfsense_backend/app/tasks/connector_indexers/google_calendar_indexer.pysurfsense_backend/app/tasks/connector_indexers/jira_indexer.pysurfsense_backend/app/tasks/connector_indexers/linear_indexer.pysurfsense_backend/app/tasks/connector_indexers/notion_indexer.pysurfsense_web/atoms/documents/ui.atoms.tssurfsense_web/components/assistant-ui/thread.tsxsurfsense_web/components/layout/ui/sidebar/DocumentsSidebar.tsxsurfsense_web/components/documents/FolderTreeView.tsxsurfsense_web/components/documents/FolderNode.tsxsurfsense_web/components/documents/DocumentNode.tsxsurfsense_web/app/dashboard/[search_space_id]/new-chat/[[...chat_id]]/page.tsxsurfsense_backend/tests/unit/middleware/test_knowledge_search.pysurfsense_backend/tests/unit/indexing_pipeline/test_create_placeholder_documents.pysurfsense_backend/tests/unit/indexing_pipeline/test_prepare_placeholder_dedup.pysurfsense_backend/tests/integration/retriever/test_optimized_chunk_retriever.pysurfsense_backend/tests/integration/retriever/test_optimized_doc_retriever.py