UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

31 lines • 1.9 kB
/** * Relay a provider OAuth login (`modelRuntime.login`) onto the extension UI of * a slash command such as `/gpt-account add`, mirroring what the `/login` * dialog and `modes/rpc/login-prompts.ts` do for their surfaces. * * Three decisions are not visible from the code alone. The login owns its own * `AbortController` rather than borrowing `ctx.signal`: that signal belongs to * the active run, so binding a login to it made Esc/steer/timeout on the * response kill a browser login the user never acted on (#1542). The login is * cancelled only by dismissing one of its own dialogs or by re-issuing the * command for the same provider. Every dialog is also bound to the per-prompt * `AuthPrompt.signal`, so a manual-code dialog is released without cancelling * the login when the provider's local callback server wins the race * (`loginChatGptSubscription`). `auth_url` opens the browser only in the TUI, because * an RPC client renders the notice on its own machine. */ import type { AuthInteraction } from "@earendil-works/pi-ai"; import type { ExtensionCommandContext } from "../types.ts"; export declare const LOGIN_CANCELLED_MESSAGE = "Login cancelled"; export interface ExtensionLoginInteractionOptions { /** Provider name rendered in notices, e.g. "ChatGPT Subscription OAuth". */ readonly providerLabel: string; /** Provider id; a later login for the same id cancels this one. */ readonly providerId?: string | undefined; /** Browser launcher for `auth_url` events in the TUI; tests inject a recorder. */ readonly openBrowser?: ((url: string) => void) | undefined; } type LoginCommandContext = Pick<ExtensionCommandContext, "mode" | "ui">; export declare function createExtensionLoginInteraction(ctx: LoginCommandContext, options: ExtensionLoginInteractionOptions): AuthInteraction; export {}; //# sourceMappingURL=oauth-login-interaction.d.ts.map