@@ -29,6 +29,8 @@ import { withStatics } from "@/util/schema"
2929
3030import * as ProviderTransform from "./transform"
3131import { ModelID , ProviderID } from "./schema"
32+ import { Bus } from "@/bus"
33+ import { TuiEvent } from "@/cli/cmd/tui/event"
3234
3335const log = Log . create ( { service : "provider" } )
3436
@@ -316,10 +318,24 @@ function custom(dep: CustomDep): Record<string, CustomLoader> {
316318 return await rawProvider ( )
317319 } catch ( e ) {
318320 if ( e instanceof Error && e . name === "CredentialsProviderError" ) {
321+ void Bus . publish ( TuiEvent . ToastShow , {
322+ variant : "warning" ,
323+ message : "AWS SSO session expired — re-authenticating..." ,
324+ } )
319325 await new Promise < void > ( ( resolve , reject ) => {
320326 const args = [ "sso" , "login" , ...( profile ? [ "--profile" , profile ] : [ ] ) ]
321327 const child = spawn ( "aws" , args , { stdio : "pipe" } )
322- child . on ( "exit" , ( code ) => ( code === 0 ? resolve ( ) : reject ( e ) ) )
328+ child . on ( "exit" , ( code ) => {
329+ if ( code === 0 ) {
330+ void Bus . publish ( TuiEvent . ToastShow , {
331+ variant : "success" ,
332+ message : "AWS SSO re-authentication successful" ,
333+ } )
334+ resolve ( )
335+ } else {
336+ reject ( e )
337+ }
338+ } )
323339 child . on ( "error" , ( ) => reject ( e ) )
324340 } )
325341 return await rawProvider ( )
0 commit comments