mirror of
https://github.com/stablyai/orca.git
synced 2026-11-15 18:37:24 +00:00
perf(browser): skip picker blocking for actions without user activation
This commit is contained in:
@@ -76,8 +76,8 @@ export abstract class AgentBrowserBridgeQueue extends AgentBrowserBridgeActionEf
|
||||
})
|
||||
}
|
||||
|
||||
/** Navigation delivers no user activation, so it opens no file picker to block. */
|
||||
protected enqueueNavigation<T>(
|
||||
/** Navigation, pointer moves, wheel and scrolling deliver no user activation, so they open no file picker to block. */
|
||||
protected enqueueInertAction<T>(
|
||||
worktreeId: string | undefined,
|
||||
browserPageId: string | undefined,
|
||||
execute: (sessionName: string, target: ResolvedBrowserCommandTarget) => Promise<T>,
|
||||
|
||||
@@ -8,7 +8,7 @@ export type EnqueueTargetedCommandOptions = {
|
||||
ensureSession?: boolean
|
||||
/** Page actions report what they caused when an agent runs them. */
|
||||
reportEffects?: boolean
|
||||
// Upload catches the picker itself; navigation delivers no user activation, so it opens none.
|
||||
// Upload catches the picker itself; actions without user activation cannot open one.
|
||||
skipFileChooserBlock?: boolean
|
||||
// Text mutations must not fall back to a global tab from another worktree.
|
||||
requireScopedTarget?: boolean
|
||||
|
||||
@@ -88,7 +88,7 @@ export abstract class AgentBrowserBridgeCoreCommands extends AgentBrowserBridgeQ
|
||||
browserPageId?: string,
|
||||
options: { reportEffects?: boolean } = {}
|
||||
): Promise<BrowserGotoResult> {
|
||||
return this.enqueueNavigation(
|
||||
return this.enqueueInertAction(
|
||||
worktreeId,
|
||||
browserPageId,
|
||||
async (_sessionName, target) => {
|
||||
|
||||
@@ -42,7 +42,7 @@ export abstract class AgentBrowserBridgeInputCommands extends AgentBrowserBridge
|
||||
worktreeId?: string,
|
||||
browserPageId?: string
|
||||
): Promise<BrowserScrollResult> {
|
||||
return this.enqueuePageAction(worktreeId, browserPageId, async (sessionName) => {
|
||||
return this.enqueueInertAction(worktreeId, browserPageId, async (sessionName) => {
|
||||
const args = ['scroll', direction]
|
||||
if (amount != null) {
|
||||
args.push(String(amount))
|
||||
@@ -56,7 +56,7 @@ export abstract class AgentBrowserBridgeInputCommands extends AgentBrowserBridge
|
||||
worktreeId?: string,
|
||||
browserPageId?: string
|
||||
): Promise<unknown> {
|
||||
return this.enqueuePageAction(
|
||||
return this.enqueueInertAction(
|
||||
worktreeId,
|
||||
browserPageId,
|
||||
async (sessionName) => {
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ export abstract class AgentBrowserBridgeInteractionCommands extends AgentBrowser
|
||||
worktreeId?: string,
|
||||
browserPageId?: string
|
||||
): Promise<BrowserHoverResult> {
|
||||
return this.enqueuePageAction(
|
||||
return this.enqueueInertAction(
|
||||
worktreeId,
|
||||
browserPageId,
|
||||
async (sessionName) => {
|
||||
|
||||
@@ -214,20 +214,20 @@ export abstract class AgentBrowserBridgeUtilityCommands extends AgentBrowserBrid
|
||||
}
|
||||
|
||||
async back(worktreeId?: string, browserPageId?: string): Promise<BrowserBackResult> {
|
||||
return this.enqueueNavigation(worktreeId, browserPageId, async (sessionName) => {
|
||||
return this.enqueueInertAction(worktreeId, browserPageId, async (sessionName) => {
|
||||
return (await this.execAgentBrowser(sessionName, ['back'])) as BrowserBackResult
|
||||
})
|
||||
}
|
||||
|
||||
async forward(worktreeId?: string, browserPageId?: string): Promise<BrowserBackResult> {
|
||||
return this.enqueueNavigation(worktreeId, browserPageId, async (sessionName) => {
|
||||
return this.enqueueInertAction(worktreeId, browserPageId, async (sessionName) => {
|
||||
return (await this.execAgentBrowser(sessionName, ['forward'])) as BrowserBackResult
|
||||
})
|
||||
}
|
||||
|
||||
async reload(worktreeId?: string, browserPageId?: string): Promise<BrowserReloadResult> {
|
||||
// Reload directly because a process swap can destroy the helper session mid-command.
|
||||
return this.enqueueNavigation(worktreeId, browserPageId, async (_sessionName, target) => {
|
||||
return this.enqueueInertAction(worktreeId, browserPageId, async (_sessionName, target) => {
|
||||
const wc = this.getWebContents(target.webContentsId)
|
||||
if (!wc) {
|
||||
throw new BrowserError('browser_no_tab', 'Tab is no longer available')
|
||||
|
||||
@@ -111,7 +111,7 @@ export abstract class AgentBrowserBridgePointerCommands extends AgentBrowserBrid
|
||||
worktreeId?: string,
|
||||
browserPageId?: string
|
||||
): Promise<unknown> {
|
||||
return this.enqueuePageAction(
|
||||
return this.enqueueInertAction(
|
||||
worktreeId,
|
||||
browserPageId,
|
||||
async (sessionName, target) =>
|
||||
@@ -191,7 +191,7 @@ export abstract class AgentBrowserBridgePointerCommands extends AgentBrowserBrid
|
||||
worktreeId?: string,
|
||||
browserPageId?: string
|
||||
): Promise<unknown> {
|
||||
return this.enqueuePageAction(
|
||||
return this.enqueueInertAction(
|
||||
worktreeId,
|
||||
browserPageId,
|
||||
async (sessionName, target) =>
|
||||
|
||||
Reference in New Issue
Block a user