feat(knowledge): connectors, user exclusions, expanded tools & airtable integration#3230
feat(knowledge): connectors, user exclusions, expanded tools & airtable integration#3230waleedlatif1 merged 17 commits intofeat/mothership-copilotfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR introduces a significant knowledge-base expansion: a connector sync framework (Confluence, GitHub, Google Drive, Jira, Linear, Notion, Airtable) with SHA-256 change detection, a user-exclusion system that persists across syncs, six new knowledge tools ( Key findings:
Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant API as Next.js API
participant SyncEngine as Sync Engine
participant Connector as Connector (Notion/GDrive/…)
participant DB as Database
participant Storage as Storage Service
participant Processor as Document Processor
User->>API: POST /connectors (credentialId, sourceConfig)
API->>Connector: validateConfig(accessToken, sourceConfig)
Connector-->>API: { valid: true }
API->>DB: INSERT knowledgeConnector + tag definitions (tx)
API->>SyncEngine: dispatchSync(connectorId)
SyncEngine->>DB: SELECT connector + KB owner userId
SyncEngine->>SyncEngine: refreshAccessToken
SyncEngine->>DB: UPDATE connector status=syncing (lock)
SyncEngine->>DB: INSERT sync log (started)
loop Paginated fetch
SyncEngine->>Connector: listDocuments(accessToken, sourceConfig, cursor)
Connector-->>SyncEngine: ExternalDocumentList
end
SyncEngine->>DB: SELECT existing docs (connectorId, deletedAt IS NULL)
SyncEngine->>DB: SELECT excluded docs (userExcluded=true, deletedAt IS NULL)
loop For each external doc
alt New doc
SyncEngine->>Storage: uploadFile(content as .txt)
SyncEngine->>DB: INSERT document (pending)
SyncEngine->>Processor: processDocumentAsync (fire & forget)
else Content hash changed
SyncEngine->>Storage: uploadFile(new content)
SyncEngine->>DB: UPDATE document (pending)
SyncEngine->>Processor: processDocumentAsync (fire & forget)
else Unchanged / excluded
SyncEngine->>SyncEngine: skip
end
end
alt Full sync mode
SyncEngine->>DB: soft-delete stale docs not seen in source
end
SyncEngine->>DB: UPDATE sync log (completed)
SyncEngine->>DB: UPDATE connector (status=active, nextSyncAt)
User->>API: PATCH /connectors/:id/documents {operation: exclude, documentIds}
API->>DB: UPDATE document SET userExcluded=true WHERE deletedAt IS NULL
User->>API: PATCH /connectors/:id/documents {operation: restore, documentIds}
API->>DB: UPDATE document SET userExcluded=false, deletedAt=null, enabled=true
Last reviewed commit: eec872d |
826c8b4 to
3eaf5ba
Compare
|
@greptile |
|
@cursor review |
|
bugbot review |
|
@cursor review |
|
bugbot review |
|
@greptile review |
...orkspace/[workspaceId]/knowledge/[id]/components/add-connector-modal/add-connector-modal.tsx
Show resolved
Hide resolved
.../workspace/[workspaceId]/knowledge/[id]/components/connectors-section/connectors-section.tsx
Outdated
Show resolved
Hide resolved
apps/sim/app/api/knowledge/[id]/connectors/[connectorId]/documents/route.ts
Show resolved
Hide resolved
apps/sim/app/api/knowledge/[id]/connectors/[connectorId]/documents/route.ts
Outdated
Show resolved
Hide resolved
apps/sim/app/api/knowledge/[id]/connectors/[connectorId]/documents/route.ts
Show resolved
Hide resolved
… avoid redundant schema fetches
|
@cursor review |
|
@greptile |
|
@greptile |
apps/sim/app/api/knowledge/[id]/connectors/[connectorId]/documents/route.ts
Show resolved
Hide resolved
|
@cursor review |
|
@greptile |
...orkspace/[workspaceId]/knowledge/[id]/components/add-connector-modal/add-connector-modal.tsx
Show resolved
Hide resolved
…leedlatif1/resolve-kb-conflicts # Conflicts: # apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/credential-selector/components/oauth-required-modal.tsx # apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/credential-selector/credential-selector.tsx # apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/components/tools/credential-selector.tsx # apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/integrations/integrations.tsx # apps/sim/blocks/blocks/airtable.ts # apps/sim/blocks/blocks/knowledge.ts # apps/sim/tools/airtable/list_bases.ts # apps/sim/tools/registry.ts # packages/db/migrations/meta/0155_snapshot.json # packages/db/migrations/meta/_journal.json # packages/db/schema.ts
Generated migration 0162 for knowledge_connector and knowledge_connector_sync_log tables after resolving merge conflicts with feat/mothership-copilot. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ge tools - Extract shared computeContentHash to connectors/utils.ts (dedup across 7 connectors) - Include error'd connectors in cron auto-retry query - Add syncContext caching for Confluence (cloudId, spaceId) - Batch Confluence label fetches with concurrency limit of 10 - Enforce maxPages in Confluence v2 path - Clean up stale storage files on document update - Retry stuck documents (pending/failed) after sync completes - Soft-delete documents and reclaim tag slots on connector deletion - Add incremental sync support to ConnectorConfig interface - Fix offset:0 falsy check in list_documents tool Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…optimize API calls - Extract shared htmlToPlainText to connectors/utils.ts (dedup Confluence + Google Drive) - Add syncContext caching for Jira cloudId, Notion/Linear/Google Drive cumulative limits - Fix cumulative maxPages/maxIssues/maxFiles enforcement across pagination pages - Bump Notion page_size from 20 to 100 (5x fewer API round-trips) - Batch Notion child page fetching with concurrency=5 (was serial N+1) - Bump Confluence v2 limit from 50 to 250 (v2 API supports it) - Pass syncContext through Confluence CQL path for cumulative tracking - Upgrade GitHub tree truncation warning to error level - Fix sync-engine test mock to include inArray export Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…te broken tests - Add parseTagDate and joinTagArray helpers to connectors/utils.ts - Update all 7 connectors to use shared tag mapping helpers (removes 12+ duplication instances) - Fix Notion listFromParentPage cumulative maxPages check (was using local count) - Rewrite 3 broken connector route test files to use vi.hoisted() + static vi.mock() pattern instead of deprecated vi.doMock/vi.resetModules (all 86 tests now pass) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@greptile |
|
@cursor review |
…se feedback Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PR SummaryHigh Risk Overview Updates the knowledge base UI to connect/manage sources ( Expands Knowledge and Airtable capabilities: Knowledge block/docs now cover full document/chunk/tag CRUD (including list/delete/update tools) and the documents API gains Written by Cursor Bugbot for commit bd07ab5. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
apps/sim/app/api/knowledge/[id]/connectors/[connectorId]/documents/route.ts
Show resolved
Hide resolved
…, fix offset=0 - Escape %, _, \ in tag filter LIKE patterns to prevent incorrect matches - Add isNull(deletedAt) guard to restore operation to prevent un-deleting soft-deleted docs - Change offset check from falsy to != null so offset=0 is not dropped Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
userExcludedfor connector docs via SQL CASElist_documents,list_chunks,delete_document,delete_chunk,update_chunk,list_tagslist_basesandget_base_schematoolshooks/queries/kb/andhooks/queries/oauth/userExcludedcolumn, document fieldsType of Change
Testing
Tested manually
Checklist