feat(knowledge): sources, add a document and connect a Drive folder from the client

Open
#128 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
15/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active

Research direction

Start with plans/261202-0003-client-bootstrap/design-feature-matrix.md and plans/261202-0806-keep-all-design-features/plan.md, then trace the knowledge client entry points and the real relay routes as their upstream dependencies land. The issue requires coordinated client, web BFF, desktop host, OAuth, authorization, sync, and staging work across several dependent items. Done means the real wired flows meet the listed acceptance criteria and checks on both hosts; fixture-backed screens do not count.

Written by the indexing model from the issue text.

Description

enhancement

Design: board 13, rows K10 (source table), K11 (source filters), K13 (add document), K14 (connect Drive) and K15 (answers and snippets only for readers)

Adding a document uses an existing Gateway write (personal documents are self-service; shared documents need an owner or admin). Connecting Drive is a new upstream knowledge source.

Acceptance criteria

  • Add document.
    • A file goes through the private attachment flow (scanned and clean) and is then written to the vault for an agent the person may use.
    • Personal scope is self-service. Shared scope is offered only to owners and admins.
  • Connect Drive. A hosted OAuth handoff in the browser returns to the same screen, which then shows sync status, last update and errors. Disconnect is available.
  • The ACL principle (K15) still holds: answers and snippets go only to readers.
  • Tests cover an infected file, missing shared authority, an interrupted handoff, a sync failure and disconnect.
  • Text create (upstream, tracked privately) ships on its own; file upload (upstream, tracked privately) follows once attachments (upstream, tracked privately) exist.
  • Google OAuth (owner decision, 2026-12-02: "Cả hai"). The hosted service uses Dewee's Google app, starting with Calendar and the least sensitive scopes; Drive and Sheets on that app wait for Google's verification, and until then a hosted workspace may bring its own OAuth client. Self-hosted deployments and workspaces may bring their own client, stored server-side in the vault and set up only by an owner or admin through the console's trusted credential flow. The client never holds Google credentials. The connectors are enabled for real within this scope: staging first, then production with the owner's go.
  • Sources (K10, K11, K15). Under the existing client id knowledge, the source table and filters read the knowledge projection from an upstream item (tracked privately) under the caller's authority. A source the person cannot read never shows a title or snippet; search results follow an upstream item (tracked privately).
  • Same-user confirm. A new Google connection is pending_confirmation (upstream, tracked privately) until the same signed-in user confirms it. The client shows "Connect ?" with the expiry, sends the confirm through the relay, and never treats the connection as active before the server says so. Tests cover expiry, a confirm from a different user, and a confirm after sign-out or a workspace switch, each of which leaves the connection inactive and says why.
  • Wired, not fixtures. This issue closes only on a slice wired to the real route it depends on, behind its dark capability id (or its local switch for a client-only feature), and verified on staging once the route exists. A fixture-backed screen satisfies none of the boxes above.

Capability

Client ids knowledge-write (knowledge.write; upload child knowledge.upload) and knowledge-drive (connectors.google_drive).

Denied, pending and recovery states

Denied: no authority, so the reason names who can. Pending: scanning, or waiting for connector approval. Recovery: resume after an interrupted handoff; retry a sync.

Parity

Surface Evidence
Gateway API/RPC an upstream item (tracked privately) (document write relay over the existing vault_write); an upstream item (tracked privately) (Drive source)
CLI dewee vault upload (existing); Drive commands in an upstream item (tracked privately)
MCP vault_write (existing); an upstream item (tracked privately)
CCP / RGD / ACP CCP vault and sources
Dewee client Knowledge screen dialogs
Conversation 'Save this as a document' and 'Connect my Drive' with a handoff
Docs Knowledge help
Traces Writes and sync traced upstream

Dependencies

An upstream item (tracked privately) (text create, not blocked by attachments), an upstream item (tracked privately) (file upload, after an upstream item (tracked privately)), an upstream item (tracked privately) (Drive), an upstream item (tracked privately) (same-user confirm), an upstream item (tracked privately), #111, #135. An upstream item (tracked privately) is delivered by its own G7 epic (#10). Admin lane.

Rules for this issue

  • The owner kept this feature on 2026-12-02 (DECISIONS.md D23, recorded by the keep-all docs PR #132). Design rows and states are in plans/261202-0003-client-bootstrap/design-feature-matrix.md. The plan is plans/261202-0806-keep-all-design-features/plan.md.
  • Done means wired. This issue closes only with a slice wired to the real route it depends on: the relay route through the web BFF and the desktop host command, or, for a client-only feature, the real native or browser path. The slice runs behind its dark capability id and is verified on staging once the route exists. Fixtures are for tests only. A fixture-backed screen never closes this issue and is never listed in plans/EVIDENCE.md. Until the route merges, the feature renders its gated or dark state.
  • One relay integrator. Only the relay-integrator lane adds ClientMethod entries to CLIENT_METHODS in packages/core/src/protocol.ts, one route at a time in merge order, together with the BFF allowlist entry and the desktop host command. A feature lane does not edit protocol.ts or capabilities.ts. The desktop host's shared files (lib.rs, capabilities/default.json, Cargo.toml, Cargo.lock, build.rs, apps/desktop/src/desktop-session.ts) have one owner at a time, in the order the plan names; a lane puts its commands in its own module and adds only a registration line.
  • Ships dark. The client id below resolves from the server's capability read through the capability map (#135). A feature without both renders its gated or dark state, never sample data presented as real. Where the route belongs to a domain that still awaits server-side relay parity, its relay child flag stays off until that domain's upstream parity work lands (tracked privately).
  • Both hosts. Web/PWA and desktop, en/vi, light/dark, 390/768/1024/1440, keyboard-only.
  • Checks. Typecheck, Biome and focused tests. Tests cover flag off, denied, pending, revocation and recovery.
  • Review. An independent review runs before the PR leaves draft. No auto-merge.
Dominant language
No language data
Stars
1
Forks
2
Avg merge
1h 51m
Merged PRs (30d)
103

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nextlevelbuilder/dewee-desktop-app

All issues in nextlevelbuilder/dewee-desktop-app

Similar issues

More Security issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.