@@ -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
@@ -297,10 +299,24 @@ function custom(dep: CustomDep): Record<string, CustomLoader> {
297299 return await rawProvider ( )
298300 } catch ( e ) {
299301 if ( e instanceof Error && e . name === "CredentialsProviderError" ) {
302+ void Bus . publish ( TuiEvent . ToastShow , {
303+ variant : "warning" ,
304+ message : "AWS SSO session expired — re-authenticating..." ,
305+ } )
300306 await new Promise < void > ( ( resolve , reject ) => {
301307 const args = [ "sso" , "login" , ...( profile ? [ "--profile" , profile ] : [ ] ) ]
302308 const child = spawn ( "aws" , args , { stdio : "pipe" } )
303- child . on ( "exit" , ( code ) => ( code === 0 ? resolve ( ) : reject ( e ) ) )
309+ child . on ( "exit" , ( code ) => {
310+ if ( code === 0 ) {
311+ void Bus . publish ( TuiEvent . ToastShow , {
312+ variant : "success" ,
313+ message : "AWS SSO re-authentication successful" ,
314+ } )
315+ resolve ( )
316+ } else {
317+ reject ( e )
318+ }
319+ } )
304320 child . on ( "error" , ( ) => reject ( e ) )
305321 } )
306322 return await rawProvider ( )
0 commit comments