Skip to content

Drive#583

Merged
Gagancreates merged 20 commits into
devfrom
drive
Jun 22, 2026
Merged

Drive#583
Gagancreates merged 20 commits into
devfrom
drive

Conversation

@arkml

@arkml arkml commented May 28, 2026

Copy link
Copy Markdown
Contributor

What

Connect a Google Doc (or an uploaded .docx) in Drive to a local .docx in Knowledge, edit it with the in-app docx editor (#589), and sync both ways.

Flow

  • Add Google Doc (Knowledge toolbar / folder context menu) → picker lists native Google Docs and uploaded .docx files across My Drive + shared drives.
  • Pick one → imports as a .docx into the folder (native Docs are exported to .docx; uploaded .docx files are downloaded as-is) and opens in the docx editor.
  • The editor shows a Sync up / Sync down / Open bar. Sync up writes the local .docx back into the same Drive file (in place, id/URL preserved); sync down re-pulls it.
  • Conflict guard: if the Drive file changed since the last sync, sync-up asks before overwriting.

Storage

  • Local file is a real .docx (full fidelity: tables, images, formatting).
  • The Doc↔file link lives in a hidden registry knowledge/.assets/google-docs/links.json (a .docx can't carry frontmatter).

Auth / scopes

  • Requires the full Drive scope https://www.googleapis.com/auth/drive (sync-up writes, which drive.readonly can't do).
  • The picker offers a BYOK connect (own Google client) so users can grant the scope locally. Managed (signed-in) mode needs the backend to add the Drive scope to its Google consent — see the note below; no app change needed once it does.

Notes / follow-ups

  • Full drive is a restricted Google scope → the managed app would need OAuth verification, or a switch to Google Picker + drive.file to avoid it.
  • Leftover inert markdown-link toolbar wiring in App.tsx/editor-toolbar.tsx can be cleaned up.

arkml and others added 18 commits May 28, 2026 10:21
BYOK never requested access_type=offline/prompt=consent so no refresh token was issued and tokens died after ~1h; also stop handing back expired tokens and extend the connect timeout to 10m.
Runs the Picker in the user's real browser (it 403s inside Electron), sets appId so the drive.file grant attaches to the picked file, and downloads + opens the selected doc.
#620)

* feat(google-docs): managed OAuth-redirect Picker (no API key, no BYOK)

Adds the managed (rowboat-mode) Google Docs picker via Google's trigger_onepick
flow. The Rowboat backend runs a standalone drive.file OAuth with the company
client, renders the Picker inside the browser consent screen, and deep-links the
selection back; the desktop downloads the picked doc with the fresh drive.file
token the backend returns. No Picker API key, appId, or BYOK credentials on the
desktop.

- core: importGoogleDocWithToken downloads a picked doc with an explicit token;
  fetch/metadata helpers take an optional Drive client and share writeDocxAndLink.
  claimPickedFilesViaBackend claims the parked file ids + token from the api.
- main: google-picker-managed.ts opens the backend start URL and resolves on the
  rowboat://oauth/google/picker/done deep link; deeplink.ts routes that completion.
- ipc: google-docs:pickViaManaged.
- renderer: the picker dialog gates on Rowboat sign-in (the picker grants
  drive.file per-file, so no pre-existing connection or scope is required).

Backend contract: rowboatlabs/rowboatx-backend#7
(GET /oauth/google/picker/{start,callback}, POST /v1/google-oauth/claim-picked).

* chore(google-docs): remove the dead API-key/system-browser Picker

The managed picker replaced the only consumer (the picker dialog), so the
experimental API-key Picker is now unused. Removes:
- main: google-docs:openPicker handler (system-browser loopback Picker)
- shared: google-docs:openPicker + google-docs:getAccessToken IPC schemas
- core: getGoogleAccessToken (token plumbing for the client-side Picker)
- renderer: lib/google-picker.ts (Picker JS SDK loader)

Kept GoogleClientIdModal / google-credentials-store — still used by the
general BYOK Google connect in onboarding, connectors, and settings.
Resolve conflicts:
- apps/main/src/ipc.ts: import union (dev's gmail contacts/getAccountName +
  drive's google_docs/managed-picker imports).
- apps/renderer/src/App.tsx: import union (dev's CodingRunBlock/KnowledgeViewMode
  + drive's GoogleDocPickerDialog).
- apps/renderer/src/components/knowledge-view.tsx: keep the "Add Google Doc"
  button in the header next to the voice-note action; Search/Graph/New note are
  now dev's QuickActions / view-mode toggles.
@Gagancreates Gagancreates merged commit be81ffb into dev Jun 22, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants