Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion packages/ai-credentials/src/CredentialProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,40 @@ export type AuthenticationChallenge =
attemptId: string;
authorizationUrl: string;
expiresIn: number;
}
| {
/**
* An external process (e.g. a spawned CLI such as `gcloud`) owns the
* browser flow. `url` is omitted when the process opens the browser
* itself and no URL is known up front.
*/
kind: "external-browser";
attemptId: string;
url?: string;
instructions: string;
expiresIn: number;
};

export type AuthenticationStartResult =
| { status: "started"; challenge: AuthenticationChallenge }
| { status: "already-in-progress" };
| { status: "already-in-progress" }
| {
/**
* The refresh completed synchronously (e.g. a silent token refresh
* that needed no browser interaction). No attempt was created;
* callers should refetch auth status and models.
*/
status: "completed";
}
| {
/**
* No attempt was created — the provider cannot be authenticated in
* this environment (e.g. required CLI missing, no SSO profile
* configured). Callers should fall back to a configuration UI.
*/
status: "unavailable";
reason: string;
};

/** Strict semantic inputs accepted by the store-backed credential controller. */
export type CredentialSourceInput =
Expand Down
8 changes: 8 additions & 0 deletions packages/ai-provider-bridge/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,14 @@ export const NOTIFICATION_ACTIONS = {
* Handler should open the Posit AI setup page
*/
POSIT_AI_COMPLETE_SETUP: "posit-ai-complete-setup",

/**
* Reconnect a provider whose credentials expired - triggered instead of
* REFRESH_MODELS on hosts with a graphical configuration overlay.
* Handler should open the configuration overlay and start an in-app
* credential refresh for the notification's providerId.
*/
RECONNECT_PROVIDER: "reconnect-provider",
} as const;

/**
Expand Down