@@ -167,8 +167,7 @@ function stripAnsiCodes(str: string): string {
167167function buildWsUrl (
168168 ttydUrl : string ,
169169 accessToken : string ,
170- sessionId ?: string ,
171- authorization ?: string
170+ sessionId ?: string
172171) : string {
173172 const url = new URL ( ttydUrl )
174173 const wsProtocol = url . protocol === 'https:' ? 'wss:' : 'ws:'
@@ -180,10 +179,7 @@ function buildWsUrl(
180179 if ( sessionId ) {
181180 params . append ( 'arg' , sessionId )
182181 }
183- if ( authorization ) {
184- params . append ( 'authorization' , authorization )
185- }
186-
182+ // authorization is sent securely in the WebSocket init message — not added to URL
187183 return `${ wsProtocol } //${ url . host } ${ wsPath } ?${ params . toString ( ) } `
188184}
189185
@@ -256,7 +252,7 @@ export async function executeTtydCommand(options: TtydExecOptions): Promise<Ttyd
256252 const endMarkerPattern = new RegExp ( `${ END_MARKER_PREFIX } ${ markerId } :(\\d+)___` )
257253
258254 // Build WebSocket URL
259- const wsUrl = buildWsUrl ( ttydUrl , accessToken , sessionId , authorization )
255+ const wsUrl = buildWsUrl ( ttydUrl , accessToken , sessionId )
260256
261257 // Text encoder/decoder
262258 const textEncoder = new TextEncoder ( )
@@ -566,7 +562,7 @@ export async function execCommand(
566562 command : string ,
567563 timeoutMs ?: number ,
568564 authorization ?: string
569- ) : Promise < string > {
565+ ) : Promise < { output : string ; exitCode : number } > {
570566 const result = await executeTtydCommand ( {
571567 ttydUrl,
572568 accessToken,
@@ -579,7 +575,7 @@ export async function execCommand(
579575 throw new TtydExecError ( 'Command timed out' , TtydExecErrorCode . TIMEOUT )
580576 }
581577
582- return result . output
578+ return { output : result . output , exitCode : result . exitCode }
583579}
584580
585581/**
0 commit comments