Repository navigation
Standalone login-gated Mindmap with GitHub Pages deploy - #1
Merged
Merged
Conversation
Track A is implemented and tested, so several things this spec left to inference are now facts worth stating: - The resource value is the origin of VITE_BACKEND_URL, no path and no trailing slash, sent on both the authorize request and the token POST body. Track A has tests rejecting a missing resource and a trailing-slash variant, and Better Auth issues an unverifiable opaque token when it is absent. - 401 and 403 need opposite handling. A non-allowlisted user signs in successfully, receives a real 12-hour token, and is then refused at the proxy. Treating that as a prompt to log in again loops forever, because signing in cannot fix it. Added a required test for the loop. - Logout clears local state only. Calling sign-out would end the shared Writing Tools browser session that the add-in also uses. - Every backend request sends credentials: omit. Mindmap must never rely on or transmit Writing Tools cookies.
- Production refuses a non-HTTPS VITE_BACKEND_URL at module load, in both platform-session.ts and the duplicated resolver in api.ts. The bearer token and every AI request go to that URL. (verify:pages already rejects it in the deploy workflow; this makes the bundle itself fail closed too.) - Token expiry is the earliest of the JWT exp, the advertised expires_in, and the stored expiry, both at exchange time and when read back. - Login transactions expire after 10 minutes (and are rejected if dated in the future), so an abandoned state/verifier can't complete a login later. - Any of code, state, error or error_description marks the URL as a callback, so partial or forged callback material is scrubbed and rejected. Tests cover each; all four fail without the change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
Turns Mindmap into a standalone, login-gated web app at
https://mindmap.thoughtful-ai.com, served from GitHub Pages. It no longer gets launched from the Writing Tools add-in and has no document access: users paste text in and copy results out. The only thing it gets from Writing Tools is AI calls billed to the signed-in user, through an OAuth login.Companion backend change: AIToolsLab/writing-tools#654.
What changes
npm run devruns with no login (the backend's capped demo key pays).statelive in session storagestateis checked exactly on return, and the redirect URI and resource are re-checkedresource(the backend origin) is sent on both the authorize request and the token requestcode/state/errorare scrubbed from the URL before the exchange and on every failure pathexp,expires_in, or the stored expirycredentials: "omit"and only to the configured backendX-Writing-Tools-Error: platform-authheader separates these from upstream model errors./handoff/exchange, rooms,launchRequired).VITE_BACKEND_URLand aVITE_OAUTH_CLIENT_ID.Contract with writing-tools#654
https://app.thoughtful-ai.com/apihttps://app.thoughtful-ai.com(origin only)writing-tools-mindmaphttps://mindmap.thoughtful-ai.com/openai:chatDeployment
.github/workflows/deploy-pages.yml: pull requests build and verify but cannot publish. Deploy runs only on a manualworkflow_dispatchfrommain, withpages: write/id-token: writescoped to the deploy job.npm run verify:pageschecks the artifact before upload:dist/isn't empty.env*files shipTests
npx tsc -bclean; Vitest 376/376.Open question
Map export inserts card text as-is, so a card beginning with
#or-changes the outline's structure if the output is rendered as Markdown. It's left unescaped on purpose: exports are mostly pasted into Word/Docs, where escape backslashes would show up in the user's own text. Easy to change if we'd rather escape.🤖 Generated with Claude Code