Skip to content

The Preferences page is always there, and asks the server when it opens - #9

Merged
jeany55 merged 1 commit into
mainfrom
prefs-page-always
Nov 17, 2026
Merged

jeany55 merged 1 commit into
mainfrom
prefs-page-always

Conversation

@jeany55

@jeany55 jeany55 commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Fixes the cause of scm-js/scm-js#285: in a fresh browser, Edit ▸ Preferences ▸ Plugins had no scmjs.dev page, which is the first place the guide sends you to add an Anthropic key. It only appeared after the Account dialog had been opened.

Why. The page was registered only once the plugin knew the server offers the AI or accepts a key. The plugin doesn't touch the network until the person does something, so a new visitor's stored flags stayed false and the page never registered. The Account dialog asked the server, and then the page appeared and stayed.

Change.

  • plugin.ts: the options page is registered at activation, always.
  • ai/options.ts: when the page opens and the server hasn't been asked yet, it asks (account.connect(), as the Account dialog does) and shows "Asking scmjs.dev what it offers…" meanwhile. It then shows the key field, the AI options, "The server offers no AI features at the moment", or the error with Try again.
  • Two new strings in ko.ts.

Checked. npm run typecheck and npm test (263 pass). In the editor with this source vendored, using a fresh headless Chromium profile:

  • No request reaches the server before the page is opened.
  • The page is listed under Plugins.
  • Opening it sends one /v1/info request.
  • With a mocked /v1/info: access.byok: true shows the key field. Neither AI nor keys shows the "offers no AI" line. An unreachable server shows the error and Try again.

After merge, it needs a version bump and tag, then a pin in the editor.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VEdp4XLSS6SLyCTiqCw5FB

A person new to the editor found no scmjs.dev page under Edit ▸ Preferences ▸
Plugins, which is where the guide sends them to add their Anthropic key
(scm-js/scm-js#285). The page was registered only once the plugin knew the server
offers the AI or takes a key, and the plugin asks nothing of the network until the
person does something, so in a fresh browser it never learned either and the page
never appeared. Opening the Account dialog asked the server, and then it did.

The page is now registered at activation. When it opens and the server has not been
asked yet, it asks, saying so while it waits; it then shows the key field, the AI
options, a line that the server offers no AI, or the error with Try again. Nothing
reaches the network before the page is opened.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VEdp4XLSS6SLyCTiqCw5FB
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