@@ -90,41 +90,51 @@ export async function persistSmusProjectCreds(spaceArn: string, node: SagemakerU
9090 * @param session - SSM session ID.
9191 * @param wsUrl - SSM WebSocket URL.
9292 * @param token - Bearer token for the session.
93+ * @param appType - Application type (e.g., 'jupyterlab', 'codeeditor').
94+ * @param isSMUS - If true, skip refreshUrl construction (SMUS connections cannot refresh).
9395 */
9496export async function persistSSMConnection (
9597 spaceArn : string ,
9698 domain : string ,
9799 session ?: string ,
98100 wsUrl ?: string ,
99101 token ?: string ,
100- appType ?: string
102+ appType ?: string ,
103+ isSMUS ?: boolean
101104) : Promise < void > {
102- const { region } = parseArn ( spaceArn )
103- const endpoint = DevSettings . instance . get ( 'endpoints' , { } ) [ 'sagemaker' ] ?? ''
105+ let refreshUrl : string | undefined
104106
105- let appSubDomain = 'jupyterlab'
106- if ( appType && appType . toLowerCase ( ) === 'codeeditor' ) {
107- appSubDomain = 'code-editor'
108- }
107+ if ( ! isSMUS ) {
108+ // Construct refreshUrl for SageMaker AI connections
109+ const { region } = parseArn ( spaceArn )
110+ const endpoint = DevSettings . instance . get ( 'endpoints' , { } ) [ 'sagemaker' ] ?? ''
109111
110- let envSubdomain : string
112+ let appSubDomain = 'jupyterlab'
113+ if ( appType && appType . toLowerCase ( ) === 'codeeditor' ) {
114+ appSubDomain = 'code-editor'
115+ }
111116
112- if ( endpoint . includes ( 'beta' ) ) {
113- envSubdomain = 'devo'
114- } else if ( endpoint . includes ( 'gamma' ) ) {
115- envSubdomain = 'loadtest'
116- } else {
117- envSubdomain = 'studio'
118- }
117+ let envSubdomain : string
119118
120- // Use the standard AWS domain for 'studio' (prod).
121- // For non-prod environments, use the obfuscated domain 'asfiovnxocqpcry.com'.
122- const baseDomain =
123- envSubdomain === 'studio'
124- ? `studio.${ region } .sagemaker.aws`
125- : `${ envSubdomain } .studio.${ region } .asfiovnxocqpcry.com`
119+ if ( endpoint . includes ( 'beta' ) ) {
120+ envSubdomain = 'devo'
121+ } else if ( endpoint . includes ( 'gamma' ) ) {
122+ envSubdomain = 'loadtest'
123+ } else {
124+ envSubdomain = 'studio'
125+ }
126+
127+ // Use the standard AWS domain for 'studio' (prod).
128+ // For non-prod environments, use the obfuscated domain 'asfiovnxocqpcry.com'.
129+ const baseDomain =
130+ envSubdomain === 'studio'
131+ ? `studio.${ region } .sagemaker.aws`
132+ : `${ envSubdomain } .studio.${ region } .asfiovnxocqpcry.com`
133+
134+ refreshUrl = `https://studio-${ domain } .${ baseDomain } /${ appSubDomain } `
135+ }
136+ // For SMUS connections, refreshUrl remains undefined
126137
127- const refreshUrl = `https://studio-${ domain } .${ baseDomain } /${ appSubDomain } `
128138 await setSpaceCredentials ( spaceArn , refreshUrl , {
129139 sessionId : session ?? '-' ,
130140 url : wsUrl ?? '-' ,
@@ -179,12 +189,12 @@ export async function setSmusSpaceSsoProfile(spaceArn: string, projectId: string
179189 * Stores SSM connection information for a given space, typically from a deep link session.
180190 * This initializes the request as 'fresh' and includes a refresh URL if provided.
181191 * @param spaceArn - The arn of the SageMaker space.
182- * @param refreshUrl - URL to use for refreshing session tokens.
192+ * @param refreshUrl - URL to use for refreshing session tokens (undefined for SMUS connections) .
183193 * @param credentials - The session information used to initiate the connection.
184194 */
185195export async function setSpaceCredentials (
186196 spaceArn : string ,
187- refreshUrl : string ,
197+ refreshUrl : string | undefined ,
188198 credentials : SsmConnectionInfo
189199) : Promise < void > {
190200 const data = await loadMappings ( )
0 commit comments