File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -180,6 +180,7 @@ import {
180180 sanitizeResponseHeadersForLog ,
181181} from "./lib/runtime/metrics.js" ;
182182import { runOAuthBrowserFlow } from "./lib/runtime/oauth-browser-flow.js" ;
183+ import { showRuntimeToast } from "./lib/runtime/toast.js" ;
183184import { SessionAffinityStore } from "./lib/session-affinity.js" ;
184185import { registerCleanup } from "./lib/shutdown.js" ;
185186import {
@@ -309,20 +310,7 @@ export const OpenAIOAuthPlugin: Plugin = async ({ client }: PluginInput) => {
309310 message : string ,
310311 variant : "info" | "success" | "warning" | "error" = "success" ,
311312 options ?: { title ?: string ; duration ?: number } ,
312- ) : Promise < void > => {
313- try {
314- await client . tui . showToast ( {
315- body : {
316- message,
317- variant,
318- ...( options ?. title && { title : options . title } ) ,
319- ...( options ?. duration && { duration : options . duration } ) ,
320- } ,
321- } ) ;
322- } catch {
323- // Ignore when TUI is not available.
324- }
325- } ;
313+ ) : Promise < void > => showRuntimeToast ( client , message , variant , options ) ;
326314
327315 const hydrateEmails = async (
328316 storage : AccountStorageV3 | null ,
Original file line number Diff line number Diff line change 1+ export async function showRuntimeToast (
2+ client : {
3+ tui ?: {
4+ showToast ?: ( payload : {
5+ body : {
6+ message : string ;
7+ variant : "info" | "success" | "warning" | "error" ;
8+ title ?: string ;
9+ duration ?: number ;
10+ } ;
11+ } ) => Promise < void > ;
12+ } ;
13+ } ,
14+ message : string ,
15+ variant : "info" | "success" | "warning" | "error" = "success" ,
16+ options ?: { title ?: string ; duration ?: number } ,
17+ ) : Promise < void > {
18+ try {
19+ await client . tui ?. showToast ?.( {
20+ body : {
21+ message,
22+ variant,
23+ ...( options ?. title && { title : options . title } ) ,
24+ ...( options ?. duration && { duration : options . duration } ) ,
25+ } ,
26+ } ) ;
27+ } catch {
28+ // Ignore when TUI is not available.
29+ }
30+ }
You can’t perform that action at this time.
0 commit comments