Repository navigation
feat(source): compile a OneDrive path into the local wiki - #279
Open
kalyan-fireweave wants to merge 3 commits into
Open
kalyan-fireweave wants to merge 3 commits into
kalyan-fireweave wants to merge 3 commits into
Conversation
Bindings stay in config and credentials stay in env files, so a remote object can recompile through the existing add path without a new storage backend. Co-authored-by: Cursor <cursoragent@cursor.com>
Sign-in stays on loopback and writes the refresh token only into the knowledge base env file, so a binding can be saved without putting a secret in the wiki. Co-authored-by: Cursor <cursoragent@cursor.com>
Sign-in reuses the loopback listener and sends a localhost redirect, so a personal or work account can be saved without opening a browser from the Workbench. Co-authored-by: Cursor <cursoragent@cursor.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #276.
This branch includes the unmerged S3 work from #277 (commit
6f8d0be) and the unmerged Drive work from #278 (commit2ebeb18). Merge those first. The OneDrive-only commit is70065fb. This is separate from #61, which asks to store the wiki itself on S3-compatible storage.A maintainer needs to add the
connector:onedrivelabel so the Workbench vote search for unshipped providers can find this issue. This account cannot create labels on VectifyAI/OpenKB.Summary
Problem
The Workbench shows OneDrive as a GitHub vote card. There is no way to bring a path from the user's own OneDrive into the local wiki through the existing compile path.
Fix
openkb source add onedrive --name NAME --path PATH. The path is from the drive root, with no leading slash (Documents/Papers). SharePoint sites are out of scope.Files.Readplusoffline_access. Credentials areOPENKB_ONEDRIVE_CLIENT_ID,OPENKB_ONEDRIVE_CLIENT_SECRET, andOPENKB_ONEDRIVE_REFRESH_TOKEN. The refresh token is written by sign-in into<kb>/.envonly. Secrets are not written toconfig.yaml, the wiki, orconnector-state.json.http://localhostand ignore the port for that host, while the path must match, and the portal text box cannot addhttp://127.0.0.1. OpenKB therefore sendshttp://localhost:7567/callbackand the README says to registerhttp://localhost/callbackon the Mobile and desktop applications platform. The socket stays on127.0.0.1.--non-interactivenever opens a browser.add_single_file. The registry key isonedrive://{path from the drive root}. Graph content downloads follow the redirect and drop the bearer token when the host changes. Transient failures retry 3 times.msal==1.39.0is the optionalonedriveextra. Tests inject a fake Graph client and do not import it. CI'suv sync --locked --extra dev --extra apidoes not install it.non_interactive=True. A Workbench save without a refresh token returns 400 and does not open a browser.Evidence
openkb source add onedriveonce. Saving without a refresh token shows "Sign-in is required" and writes no binding. With a binding present, the card listspapers,onedrive://Documents/Papers/, "Not synced since this change", Sync, Remove, and Add another. Sync without a token records that sign-in error on the card. Remove clears the binding. S3 and Drive forms stay on the same page.Verification
Results here: ruff check passed, ruff format check passed, mypy reported no issues in 70 files, pytest 1293 passed.
The web build passed (
i18n:check,tsc -b,vite build).Test plan
uv run ruff check .uv run ruff format --check .uv run mypy openkbuv run pytestcd frontend && npm ci && npm run buildhttp://localhost/callbackon a Mobile and desktop applications client, setOPENKB_ONEDRIVE_CLIENT_IDandOPENKB_ONEDRIVE_CLIENT_SECRETin<kb>/.env, runopenkb source add onedrive --path Documents/Papers, thenopenkb source syncopenkb source add onedrive --non-interactivewith no refresh token fails before writing the bindingopenkb source removeleaves compiled pages in the wikiconnector:onedrivelabelMerge Danger
Door: two-way
The command, the router, and the card can be reverted. A binding already saved under
connectors:withprovider: onedriveis ignored by a build that does not read it. Pages already compiled stay in the wiki, which is the same result asopenkb source remove. The refresh token in<kb>/.envis left in place on revert.Blast Radius: ingest
Local
openkb addis unchanged.msalis an extra, so the core install and CI's lockeddev+apisync do not install it. OneDrive reusesoauth.pyfrom #278 and does not import the Drive backend. S3 and Drive sync behavior is unchanged.Made with Cursor