Skip to content

Agent sharepoint knowledge connector#18478

Merged
adrinr merged 105 commits intomasterfrom
agent-sharepoint-knowledge-connector
Apr 13, 2026
Merged

Agent sharepoint knowledge connector#18478
adrinr merged 105 commits intomasterfrom
agent-sharepoint-knowledge-connector

Conversation

@adrinr
Copy link
Copy Markdown
Member

@adrinr adrinr commented Apr 7, 2026

Description

Adds a SharePoint knowledge connector for agents.

TODO in a different PR:

  • Discuss designs
  • Dev/prod
  • Handle imports/exports
  • Better feedback if !env.MICROSOFT_CLIENT_ID or !env.MICROSOFT_CLIENT_SECRET
  • Delete schedules tasks on workspace delete/reimport

Summary by cubic

Adds a SharePoint knowledge connector for agents using Microsoft OAuth and Microsoft Graph, plus a settings page to view SharePoint connections and where they’re used; the connector is gated behind the AI_RAG_SHAREPOINT feature flag.

  • New Features

    • Microsoft OAuth2 for SharePoint with scopes offline_access https://graph.microsoft.com/Sites.Read.All (override via RAG_SHAREPOINT_DEFAULT_SCOPE); pre-auth supports returnPath, validates provider, binds OAuth state to appId, requires continueSetupId, uses a 10‑minute setup cache TTL, and allow-lists Graph nextLink URLs to prevent SSRF.
    • Persisted SharePoint OAuth connections via AgentKnowledgeSourceConnection; shown under Settings > Connections > Knowledge with de‑duplicated entries, used-by agents, and site lists.
    • New agent knowledgeSources model and APIs: list SharePoint site options with last-run stats, select sites (returns site info), trigger per-site sync, and disconnect (removes files from disconnected sites). Endpoints moved under aiAgents.
    • Scheduled sync via knowledgeSourceSyncQueue (configurable interval); jobs rehydrated on startup and reconciled on deploy with summary logging; visible in BullBoard.
    • Sync tracking via AgentKnowledgeSourceSyncState (last run, counts, run status, including unsupported). UI hides 0/0 before first run and formats missing timestamps as —. Knowledge base files include externalSourceId.
    • Builder UI: “Add knowledge” modal; SharePoint site picker after OAuth; per-site sync/disconnect; files status modal; better row click/loading with row-level __clickable. ActionButton supports custom icons and loading.
    • File handling: 100MB upload limit, accepts only supported types in UI and backend, counts unsupported, deletes temp files on unsupported uploads; upload logic moved into the store.
    • Validates SharePoint site IDs to allow only canonical Graph IDs.
  • Migration

    • Enable AI_RAG_SHAREPOINT (defaults off).
    • Set MICROSOFT_CLIENT_ID, MICROSOFT_CLIENT_SECRET, and optional MICROSOFT_TENANT_ID.
    • Ensure the Microsoft app grants Sites.Read.All and offline_access.
    • Optional: set RAG_SHAREPOINT_DEFAULT_SCOPE and SHAREPOINT_SYNC_INTERVAL_MS (defaults to 1 day).
    • Restart the server to initialize knowledgeSourceSyncQueue.

Written for commit e2eb46a. Summary will update on new commits.

Copy link
Copy Markdown
Contributor

@deanhannigan deanhannigan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Really solid work @adrinr. A few minor comments, but nothing to prevent merging. 🚀

Comment thread packages/bbui/src/ActionButton/ActionButton.svelte
Comment thread packages/bbui/src/Table/Table.svelte
Comment thread packages/server/src/api/controllers/ai/sharepointAuth.ts Outdated
@adrinr adrinr enabled auto-merge April 9, 2026 14:41
@adrinr adrinr disabled auto-merge April 9, 2026 14:47
@adrinr adrinr enabled auto-merge April 9, 2026 15:37
@adrinr adrinr merged commit b4d982a into master Apr 13, 2026
35 checks passed
@adrinr adrinr deleted the agent-sharepoint-knowledge-connector branch April 13, 2026 10:33
@github-actions github-actions bot locked and limited conversation to collaborators Apr 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants