Skip to content

The plug app, with 得到大脑 as its first plugin - #1

Merged
bencode merged 2 commits into
mainfrom
feat/getnote
Oct 28, 2026
Merged

bencode merged 2 commits into
mainfrom
feat/getnote

Conversation

@bencode

@bencode bencode commented Oct 28, 2026

Copy link
Copy Markdown
Owner

What

The app at reader-plug.upivot.io that Gamma Reader's plugins (bencode/gamma-reader#279) talk to.

  • The page (Chinese) lists each plugin with its state in this browser: not connected, connected until a date, authorization expired, membership needed, or unconfirmed just now. It connects or disconnects it.
  • GET /manifest lists the plugins this browser has connected, with their tools. POST /:plugin/tools/:tool runs one. Both are open by CORS to READER_ORIGIN alone, with credentials.
  • 得到大脑 connects by device code: the user confirms on 得到大脑's page while this page polls. Their key is kept in an AES-256-GCM sealed HttpOnly cookie, and there is no user database.
  • Tools: getnote_search, getnote_list_knowledge_bases, getnote_list_notes, getnote_read_note, getnote_save_note. Notes are only added, never edited or deleted. A saved note is tagged Gamma Reader, with an idempotency key so a retry saves it once.
  • 得到大脑's failures become messages for the model and the page. A failure can come with HTTP 200. The codes handled are an expired authorization, membership, rate limits and a missing note, with the request id on anything else.

Layout

Package Role
web-packages/server Hono: page API, manifest, tool calls; serves the page's build in production
ui-packages/web React page
packages/shared Only the page API's types; the reader protocol's types stay in the server

A further plugin is a folder in each package, registered in its plugins/index.ts.

Checks

pnpm check passes: server 7 tests, page 2. They cover:

  • sealing;
  • CORS and Origin checks;
  • the manifest per browser;
  • argument validation;
  • 得到大脑 error mapping;
  • the device-code flow end to end against a fake 得到大脑;
  • the page's states and its connect and disconnect flow.

pnpm build and a production start serve the page, API and manifest.

Not yet run against the real 得到大脑 with the reader: that is the local end-to-end step next.

A page lists the plugins and connects or disconnects each one in this browser; the reader asks
/manifest which are connected and calls their tools here. 得到大脑 connects by device code, keeps
the user's key in a sealed HttpOnly cookie, and offers search, knowledge bases, note lists,
reading a note, and saving a new one.
…nd no stray space in the intro

Vite answered the reader's preflight itself, without allowing credentials, so the browser refused
every tool call through the dev server.
@bencode
bencode merged commit bc24a4a into main Oct 28, 2026
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.

1 participant