@@ -27,6 +27,7 @@ import {
2727 DEFAULT_BROWSER_VIEWPORT ,
2828 DEFAULT_PREVIEW_APPEARANCE ,
2929 DEFAULT_PREVIEW_ZOOM_FACTOR ,
30+ DEFAULT_SERVER_SETTINGS ,
3031 FILL_PREVIEW_VIEWPORT ,
3132 PREVIEW_VIEWPORT_MAX_AREA ,
3233 PREVIEW_VIEWPORT_MAX_DIMENSION ,
@@ -117,7 +118,6 @@ import {
117118 SettingsSection ,
118119} from "./settingsLayout" ;
119120import { searchableSetting } from "./settingsSearch" ;
120- import { ProjectDefaultsSettings } from "./ProjectDefaultsSettings" ;
121121import { useSettingsScope } from "./SettingsScopeContext" ;
122122import { BrowserImportWizard , type WizardTarget } from "./BrowserImportWizard" ;
123123import type { ImportOutcome } from "./browserImportWizard.logic" ;
@@ -890,6 +890,50 @@ function DeviceIntegrationControls({
890890 ) ;
891891}
892892
893+ /**
894+ * Server-authoritative, so it follows the header's environment and project
895+ * selection and stays editable on clients without the desktop-only preview.
896+ */
897+ function AgentBrowserAccessSetting ( ) {
898+ const { scope } = useSettingsScope ( ) ;
899+ const settings = useScopedSettings ( ) ;
900+ const updateSettings = useUpdateScopedSettings ( ) ;
901+ const isProjectScope = scope . kind === "project" || scope . kind === "checkout" ;
902+
903+ return (
904+ < SettingsRow
905+ serverScoped
906+ settingKeys = { [ "enableAgentBrowserAccess" ] }
907+ { ...searchableSetting ( "agent-browser-access" ) }
908+ description = {
909+ isProjectScope
910+ ? "Allow agents in this project to use the shared browser. Applies when the agent session next starts."
911+ : "Allow agents to use the shared browser. Projects can override it."
912+ }
913+ resetAction = {
914+ settings . enableAgentBrowserAccess !== DEFAULT_SERVER_SETTINGS . enableAgentBrowserAccess ? (
915+ < SettingResetButton
916+ label = "default browser access"
917+ onClick = { ( ) =>
918+ updateSettings ( {
919+ enableAgentBrowserAccess : DEFAULT_SERVER_SETTINGS . enableAgentBrowserAccess ,
920+ } )
921+ }
922+ />
923+ ) : null
924+ }
925+ control = {
926+ < ScopedSwitch
927+ settingKeys = { [ "enableAgentBrowserAccess" ] }
928+ aria-label = "Agent browser access"
929+ checked = { settings . enableAgentBrowserAccess }
930+ onCheckedChange = { ( enabled ) => updateSettings ( { enableAgentBrowserAccess : enabled } ) }
931+ />
932+ }
933+ />
934+ ) ;
935+ }
936+
893937function BrowserAutoShowFloatingPreviewSetting ( { disabled } : { readonly disabled : boolean } ) {
894938 const autoShow = useClientSettings ( ( settings ) => settings . browserAutoShowFloatingPreview ) ;
895939 const updateSettings = useUpdatePrimarySettings ( ) ;
@@ -1534,10 +1578,10 @@ export function IntegrationsSettingsPanel() {
15341578
15351579 return (
15361580 < SettingsPageContainer >
1537- { /* Server-authoritative agent access is scoped by the header selection;
1538- the preview defaults below are device-local and ignore it. */ }
1539- < ProjectDefaultsSettings category = "integrations" />
15401581 < SettingsSection id = "browser" title = "Browser" >
1582+ { /* Scoped by the header selection; the preview defaults below are
1583+ device-local and ignore it. */ }
1584+ < AgentBrowserAccessSetting />
15411585 { previewDefaultsDisabled ? (
15421586 < SettingsUnavailableGroup message = "Only available in the desktop app." >
15431587 { previewDefaults }
0 commit comments