@@ -26,11 +26,11 @@ import {
2626 browserStatus ,
2727 browserStop ,
2828 callGatewayTool ,
29+ getRuntimeConfig ,
2930 getBrowserProfileCapabilities ,
3031 imageResultFromFile ,
3132 jsonResult ,
3233 listNodes ,
33- loadConfig ,
3434 normalizeOptionalString ,
3535 persistBrowserProxyFiles ,
3636 readStringParam ,
@@ -61,8 +61,8 @@ const browserToolDeps = {
6161 browserStart,
6262 browserStatus,
6363 browserStop,
64+ getRuntimeConfig,
6465 imageResultFromFile,
65- loadConfig,
6666 listNodes,
6767 callGatewayTool,
6868 touchSessionBrowserTab,
@@ -88,7 +88,7 @@ export const __testing = {
8888 browserStatus : typeof browserStatus ;
8989 browserStop : typeof browserStop ;
9090 imageResultFromFile : typeof imageResultFromFile ;
91- loadConfig : typeof loadConfig ;
91+ getRuntimeConfig : typeof getRuntimeConfig ;
9292 listNodes : typeof listNodes ;
9393 callGatewayTool : typeof callGatewayTool ;
9494 touchSessionBrowserTab : typeof touchSessionBrowserTab ;
@@ -113,7 +113,7 @@ export const __testing = {
113113 browserToolDeps . browserStatus = overrides ?. browserStatus ?? browserStatus ;
114114 browserToolDeps . browserStop = overrides ?. browserStop ?? browserStop ;
115115 browserToolDeps . imageResultFromFile = overrides ?. imageResultFromFile ?? imageResultFromFile ;
116- browserToolDeps . loadConfig = overrides ?. loadConfig ?? loadConfig ;
116+ browserToolDeps . getRuntimeConfig = overrides ?. getRuntimeConfig ?? getRuntimeConfig ;
117117 browserToolDeps . listNodes = overrides ?. listNodes ?? listNodes ;
118118 browserToolDeps . callGatewayTool = overrides ?. callGatewayTool ?? callGatewayTool ;
119119 browserToolDeps . touchSessionBrowserTab =
@@ -220,7 +220,7 @@ async function resolveBrowserNodeTarget(params: {
220220 target ?: "sandbox" | "host" | "node" ;
221221 sandboxBridgeUrl ?: string ;
222222} ) : Promise < BrowserNodeTarget | null > {
223- const cfg = browserToolDeps . loadConfig ( ) ;
223+ const cfg = browserToolDeps . getRuntimeConfig ( ) ;
224224 const policy = cfg . gateway ?. nodes ?. browser ;
225225 const mode = policy ?. mode ?? "auto" ;
226226 if ( mode === "off" ) {
@@ -340,7 +340,7 @@ function resolveBrowserBaseUrl(params: {
340340 sandboxBridgeUrl ?: string ;
341341 allowHostControl ?: boolean ;
342342} ) : string | undefined {
343- const cfg = loadConfig ( ) ;
343+ const cfg = getRuntimeConfig ( ) ;
344344 const resolved = resolveBrowserConfig ( cfg . browser , cfg ) ;
345345 const normalizedSandbox = params . sandboxBridgeUrl ?. trim ( ) ?? "" ;
346346 const target = params . target ?? ( normalizedSandbox ? "sandbox" : "host" ) ;
@@ -369,7 +369,7 @@ function shouldPreferHostForProfile(profileName: string | undefined) {
369369 if ( ! profileName ) {
370370 return false ;
371371 }
372- const cfg = browserToolDeps . loadConfig ( ) ;
372+ const cfg = browserToolDeps . getRuntimeConfig ( ) ;
373373 const resolved = resolveBrowserConfig ( cfg . browser , cfg ) ;
374374 const profile = resolveProfile ( resolved , profileName ) ;
375375 if ( ! profile ) {
@@ -395,7 +395,7 @@ function usesExistingSessionManageFlow(params: { action: string; profileName?: s
395395 if ( ! EXISTING_SESSION_MANAGE_ACTIONS . has ( params . action ) ) {
396396 return false ;
397397 }
398- const cfg = browserToolDeps . loadConfig ( ) ;
398+ const cfg = browserToolDeps . getRuntimeConfig ( ) ;
399399 const resolved = resolveBrowserConfig ( cfg . browser , cfg ) ;
400400 const profile = resolveProfile ( resolved , params . profileName ?? resolved . defaultProfile ) ;
401401 if ( profile && getBrowserProfileCapabilities ( profile ) . usesChromeMcp ) {
@@ -448,7 +448,9 @@ export function createBrowserTool(opts?: {
448448 const requestedNode = readStringParam ( params , "node" ) ;
449449 const requestedTimeoutMs = readToolTimeoutMs ( params ) ;
450450 let target = readStringParam ( params , "target" ) as "sandbox" | "host" | "node" | undefined ;
451- const configuredNode = browserToolDeps . loadConfig ( ) . gateway ?. nodes ?. browser ?. node ?. trim ( ) ;
451+ const configuredNode = browserToolDeps
452+ . getRuntimeConfig ( )
453+ . gateway ?. nodes ?. browser ?. node ?. trim ( ) ;
452454
453455 if ( requestedNode && target && target !== "node" ) {
454456 throw new Error ( 'node is only supported with target="node".' ) ;
0 commit comments