@@ -6,7 +6,7 @@ import { ptyWrite } from './plugin/pty/tools/write.ts'
66import { ptyRead } from './plugin/pty/tools/read.ts'
77import { ptyList } from './plugin/pty/tools/list.ts'
88import { ptyKill } from './plugin/pty/tools/kill.ts'
9- import { getServerUrl , startWebServer } from './web/server/server.ts'
9+ import { PTYServer } from './web/server/server.ts'
1010
1111interface SessionDeletedEvent {
1212 type : 'session.deleted'
@@ -21,11 +21,12 @@ const ptyServerUrlCommand = 'pty-server-url'
2121export const PTYPlugin = async ( { client, directory } : PluginContext ) : Promise < PluginResult > => {
2222 initPermissions ( client , directory )
2323 initManager ( client )
24+ const ptyServer = await PTYServer . createServer ( )
2425
2526 return {
2627 'command.execute.before' : async ( input ) => {
2728 if ( input . command === ptyServerUrlCommand ) {
28- const serverUrl = getServerUrl ( )
29+ const serverUrl = ptyServer . server . url . toString ( )
2930 client . session . prompt ( {
3031 path : { id : input . sessionID } ,
3132 body : {
@@ -54,7 +55,7 @@ export const PTYPlugin = async ({ client, directory }: PluginContext): Promise<P
5455 if ( ! input . command ) {
5556 input . command = { }
5657 }
57- const serverUrl = await startWebServer ( )
58+ const serverUrl = ptyServer . server . url . toString ( )
5859 input . command [ ptyServerUrlCommand ] = {
5960 template : `${ serverUrl } ` ,
6061 description : 'print link to PTY web server' ,
0 commit comments