@acryldev/sign-in
v0.2.5
Published
ACRYL sign-in: sign in to a model provider with an account (Claude, ChatGPT/OpenAI Codex and the rest of the catalog's flows; DeepSeek through DeepSeek's own account dialog) from Settings > Models on Web and Desktop, over the harness authorization flows;
Readme
@acryldev/sign-in
Sign in to a model provider with an account, from Settings > Models on Web and Desktop. A card at the foot of the page offers Claude (Anthropic, Claude Pro or Max), ChatGPT (OpenAI Codex), DeepSeek (DeepSeek account) and, in a list, every other provider whose harness flow offers an account sign-in (GitHub Copilot, ...). API keys stay on the page's own provider editor ("Add model provider").
Client (
src/client/): the card, registered in the Models page'ssettings.models.footerseat. It opens the provider's sign-in page (the system browser on Desktop, a new tab on Web; a pop-up opened without a click is blocked by browsers, so "Open sign-in page" stays on the card), shows the question a flow asks (paste a code or a redirect URL, choose browser or device login), and reads a failure in the provider's words.Failed chat turns (
src/client/TurnFailureView.tsx,src/client/turn-failure.ts): the chat'sturn-errorrow (conversation.chat.node, shadowing DeepSeek's at priority -1). It reads the provider's sentence out of the JSON body the harness recorded (400 {"type":"error","error":{...,"message":"..."}}becomes "Claude: ..."), makes web addresses links that open outside the app, adds a hint for a refusal whose fix is known (Anthropic billing third-party apps to extra usage), and keeps the raw text behind Details. A request whose provider has no credential (MISSING_CREDENTIAL) is reworded on the Host, in thellm/streamwaterfall: add an API key, or sign in with the provider's account when it offers one.Host (
src/index.ts,src/controller.ts): the providers are the harness's own authorization flows (ctx.authorization, registered bydsh-llm-pi-ai); nothing here knows a protocol. The terminal's/logindrives the same flows.@acryldev/control'sSignInAttemptsholds the one running conversation;createRouteActivationmakes the provider usable once it succeeds (a new route is named for the provider, Claude foranthropic; anapiKeyEnvnaming a key that is not stored is removed, since the harness would try it before the sign-in and fail), andcreateDefaultModelAdoptionmakes it the default for new sessions when the current default cannot answer (its provider has no credential or is not live; a default that works is never replaced). The starting model per provider isSTARTING_MODELSin@acryldev/control, else the route's first model.DeepSeek account (
src/deepseek-account.ts): DeepSeek's own account dialog registers only inside DeepSeek's Desktop window, so the Host drives the harness'sdeepseekAccountservice directly and shows its attempt like a flow. The browser returns to the Host's own/oauth/callbackon the origin these routes are served on; a successful sign-in makes thedeepseek-accountmodel route the default when the current default cannot answer. DeepSeek's account flow onctx.authorizationis never started as a flow.Terminal (
src/account-callback.ts, entry@acryldev/sign-in/account-callback, rowacryl-sign-in-account-callback): the terminal has no web server for DeepSeek's browser callback, and DSH's would also wake the API gateway. This row serves/oauth/callbackon its own loopback port (listening from the first sign-in, closed with the row), aswebServerin the Loader realmacryl-account-callbackthat only thedeepseek-accountrow shares, and providesacrylAccountSignIn(AccountSignInPortin@acryldev/control), which/loginuses for "DeepSeek". Composed by theaccount-callbackcapability.Routes (
src/route.ts): one app on the framework's router, mounted under/api/acryl-sign-inwithctx.routerHttp.mount, under the shared private-route rules of@acryldev/loopback-http/router: only the app's own page on loopback, 405 withAllowfor another method, a JSON body (415) of at most 16 KiB (413) for a change, a refusal the harness explains 409 with its reason. No response carries a secret, and a typed answer is handed to the flow and dropped:| Route | Method | Meaning | | --- | --- | --- | |
/api/acryl-sign-in/providers| GET | providers, their methods, whether each is signed in, and whether any is | |/api/acryl-sign-in/attempt| GET | the current conversation, ornull| |/api/acryl-sign-in/begin| POST{ key, method?, locale? }| start a sign-in (a running one is withdrawn);localesets the language of DeepSeek's page | |/api/acryl-sign-in/answer| POST{ attemptId, promptId, value }| answer the question the flow asks | |/api/acryl-sign-in/cancel| POST{ attemptId }| withdraw the conversation |
Composed for Web and Desktop through the sign-in capability in @acryldev/harness-runtime's coding-capabilities.ts, which needs
the router (needsRouter): a Blueprint with the capability must carry the framework-kit row, and Desktop composes the router
rows itself.
