browser open only on manual action by user

This commit is contained in:
Arjun 2026-04-15 12:32:14 +05:30
parent 5ee4f8a848
commit cb68c93357
3 changed files with 1 additions and 36 deletions

View file

@ -1,18 +1,8 @@
import { BrowserWindow } from 'electron';
import type { IBrowserControlService } from '@x/core/dist/application/browser-control/service.js';
import type { BrowserControlAction, BrowserControlInput, BrowserControlResult } from '@x/shared/dist/browser-control.js';
import { browserViewManager } from './view.js';
import { normalizeNavigationTarget } from './navigation.js';
function emitPaneState(open: boolean): void {
const windows = BrowserWindow.getAllWindows();
for (const win of windows) {
if (!win.isDestroyed() && win.webContents) {
win.webContents.send('browser:didRequestPaneState', { open });
}
}
}
function buildSuccessResult(
action: BrowserControlAction,
message: string,
@ -37,24 +27,18 @@ function buildErrorResult(action: BrowserControlAction, error: string): BrowserC
}
export class ElectronBrowserControlService implements IBrowserControlService {
private ensurePaneOpen(): void {
emitPaneState(true);
browserViewManager.setVisible(true);
}
async execute(
input: BrowserControlInput,
ctx?: { signal?: AbortSignal },
): Promise<BrowserControlResult> {
const signal = ctx?.signal;
this.ensurePaneOpen();
try {
switch (input.action) {
case 'open': {
await browserViewManager.ensureActiveTabReady(signal);
const page = await browserViewManager.readPageSummary(signal, { waitForReady: false }) ?? undefined;
return buildSuccessResult('open', 'Opened the browser pane.', page);
return buildSuccessResult('open', 'Opened a browser session.', page);
}
case 'get-state':

View file

@ -789,19 +789,6 @@ function App() {
return cleanup
}, [refreshVoiceAvailability])
useEffect(() => {
const cleanup = window.ipc.on('browser:didRequestPaneState', (event) => {
if (event.open) {
setIsBrowserOpen(true)
setIsChatSidebarOpen(true)
setIsRightPaneMaximized(false)
return
}
setIsBrowserOpen(false)
})
return cleanup
}, [])
const handleStartRecording = useCallback(() => {
setIsRecording(true)
isRecordingRef.current = true

View file

@ -708,12 +708,6 @@ const ipcSchemas = {
req: BrowserStateSchema,
res: z.null(),
},
'browser:didRequestPaneState': {
req: z.object({
open: z.boolean(),
}),
res: z.null(),
},
// Billing channels
'billing:getInfo': {
req: z.null(),