@@ -67,7 +67,6 @@ import * as ServerBrowserPage from "./ServerBrowserPage.ts";
6767import * as ServerBrowserToolchain from "./ServerBrowserToolchain.ts" ;
6868import { ServerBrowserContexts } from "./ServerBrowserContexts.ts" ;
6969import { BrowserControlInterrupted , SessionControl } from "./SessionControl.ts" ;
70- import { isServerBrowserEnabled } from "./serverBrowserEnabled.ts" ;
7170
7271const SERVER_HOST_CLIENT_ID = "server-browser" ;
7372const RENDER_SCALE = 2 ;
@@ -186,7 +185,6 @@ export interface ServerBrowserViewer {
186185export class ServerBrowser extends Context . Service <
187186 ServerBrowser ,
188187 {
189- readonly enabled : boolean ;
190188 readonly attachViewer : ( input : {
191189 readonly threadId : string ;
192190 readonly tabId : string ;
@@ -407,7 +405,6 @@ const CLIPBOARD_SCRIPT = `(() => {
407405
408406const make = Effect . gen ( function * ( ) {
409407 const config = yield * ServerConfig . ServerConfig ;
410- const enabled = isServerBrowserEnabled ( config . mode ) ;
411408 const manager = yield * PreviewManager . PreviewManager ;
412409 const broker = yield * PreviewAutomationBroker . PreviewAutomationBroker ;
413410 const environment = yield * ServerEnvironment . ServerEnvironment ;
@@ -1935,51 +1932,49 @@ const make = Effect.gen(function* () {
19351932 } satisfies ServerBrowserViewer ;
19361933 } ) ;
19371934
1938- if ( enabled ) {
1939- yield * manager . events . pipe ( Stream . runForEach ( mirrorManagerEvent ) , Effect . forkScoped ) ;
1940- yield * Effect . sync ( closeIdleAgentTabs ) . pipe (
1941- Effect . repeat ( Schedule . spaced ( IDLE_SWEEP_INTERVAL ) ) ,
1942- Effect . forkScoped ,
1943- ) ;
1944- const environmentId = yield * environment . getEnvironmentId ;
1945- const hostSession = broker
1946- . connect (
1947- {
1948- clientId : SERVER_HOST_CLIENT_ID ,
1949- environmentId,
1950- supportedOperations : [ ...PREVIEW_AUTOMATION_SERVER_OPERATIONS ] ,
1951- } ,
1952- { preferred : true } ,
1953- )
1954- . pipe (
1955- Effect . flatMap ( ( events ) =>
1956- events . pipe (
1957- Stream . runForEach ( ( event ) => {
1958- if ( event . type === "connected" ) {
1959- hostConnectionId = event . connectionId ;
1960- return Effect . sync ( reportLiveTabs ) ;
1961- }
1962- return handleRequest ( event . connectionId , event . request ) . pipe (
1963- Effect . forkScoped ,
1964- Effect . asVoid ,
1965- ) ;
1966- } ) ,
1967- ) ,
1935+ yield * manager . events . pipe ( Stream . runForEach ( mirrorManagerEvent ) , Effect . forkScoped ) ;
1936+ yield * Effect . sync ( closeIdleAgentTabs ) . pipe (
1937+ Effect . repeat ( Schedule . spaced ( IDLE_SWEEP_INTERVAL ) ) ,
1938+ Effect . forkScoped ,
1939+ ) ;
1940+ const environmentId = yield * environment . getEnvironmentId ;
1941+ const hostSession = broker
1942+ . connect (
1943+ {
1944+ clientId : SERVER_HOST_CLIENT_ID ,
1945+ environmentId,
1946+ supportedOperations : [ ...PREVIEW_AUTOMATION_SERVER_OPERATIONS ] ,
1947+ } ,
1948+ { preferred : true } ,
1949+ )
1950+ . pipe (
1951+ Effect . flatMap ( ( events ) =>
1952+ events . pipe (
1953+ Stream . runForEach ( ( event ) => {
1954+ if ( event . type === "connected" ) {
1955+ hostConnectionId = event . connectionId ;
1956+ return Effect . sync ( reportLiveTabs ) ;
1957+ }
1958+ return handleRequest ( event . connectionId , event . request ) . pipe (
1959+ Effect . forkScoped ,
1960+ Effect . asVoid ,
1961+ ) ;
1962+ } ) ,
19681963 ) ,
1969- ) ;
1970- // The broker disconnects timed-out hosts, including slow first installs. Reconnect.
1971- yield * hostSession . pipe (
1972- Effect . exit ,
1973- Effect . andThen ( Effect . sleep ( HOST_RECONNECT_DELAY ) ) ,
1974- Effect . forever ,
1975- Effect . forkScoped ,
1976- ) ;
1977- yield * Effect . addFinalizer ( ( ) =>
1978- Effect . promise ( async ( ) => {
1979- await contexts . close ( ) ;
1980- } ) ,
1964+ ) ,
19811965 ) ;
1982- }
1966+ // The broker disconnects timed-out hosts, including slow first installs. Reconnect.
1967+ yield * hostSession . pipe (
1968+ Effect . exit ,
1969+ Effect . andThen ( Effect . sleep ( HOST_RECONNECT_DELAY ) ) ,
1970+ Effect . forever ,
1971+ Effect . forkScoped ,
1972+ ) ;
1973+ yield * Effect . addFinalizer ( ( ) =>
1974+ Effect . promise ( async ( ) => {
1975+ await contexts . close ( ) ;
1976+ } ) ,
1977+ ) ;
19831978
19841979 const clearProfile = ( profileId : string ) =>
19851980 Effect . tryPromise ( {
@@ -1988,7 +1983,6 @@ const make = Effect.gen(function* () {
19881983 } ) ;
19891984
19901985 return ServerBrowser . of ( {
1991- enabled,
19921986 attachViewer,
19931987 clearProfile,
19941988 openDownload,
0 commit comments