fix(browser): preserve chat focus during agent browsing
This commit is contained in:
@@ -119,7 +119,9 @@ export class PiAgentBrowserTool {
|
||||
});
|
||||
const runKey = `${context.conversationId}:${context.runId}`;
|
||||
this.diagnosticRuns.set(runKey, { projectPath: context.projectPath, owner });
|
||||
if (this.requestPresentation) {
|
||||
// Only a new viewport needs foreground presentation. Reusing an initialized
|
||||
// page must respect the user's selected tab, including while navigating.
|
||||
if (this.requestPresentation && !snapshot.bounds) {
|
||||
try {
|
||||
this.requestPresentation(snapshot);
|
||||
snapshot = await this.browser.waitForPresentation({
|
||||
@@ -139,6 +141,8 @@ export class PiAgentBrowserTool {
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
} else {
|
||||
this.publishState?.(snapshot);
|
||||
}
|
||||
return result(action, publicSnapshot(snapshot));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user