Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions multimodal/gui-agent/operator-aio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@
"url": "https://github.com/bytedance/UI-TARS-desktop/issues"
},
"keywords": [
"AI",
"Core",
"SDK",
"Operator",
"UI-TARS",
"Operator",
"AIO"
],
"main": "./dist/index.js",
Expand All @@ -36,12 +33,11 @@
"registry": "https://registry.npmjs.org"
},
"dependencies": {
"@gui-agent/shared": "workspace:*",
"@agent-infra/browser": "0.1.1",
"@agent-infra/logger": "0.0.2-beta.2",
"@agent-infra/sandbox": "0.0.6",
"@agent-infra/media-utils": "0.1.5",
"@ui-tars/sdk": "1.2.3",
"@ui-tars/shared": "1.2.3"
"@agent-infra/media-utils": "0.1.5"
},
"devDependencies": {
"@rslib/core": "0.10.0",
Expand Down
10 changes: 9 additions & 1 deletion multimodal/gui-agent/operator-aio/src/AIOBrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ export class AIOBrowser {
*/
private logger: Logger;

private launchOptions?: LaunchOptions;

/**
* Creates an instance of AIOBrowser
* @param {AIOBrowserOptions} options - Configuration options
Expand All @@ -64,6 +66,7 @@ export class AIOBrowser {
try {
await this.browser.launch(options);
this.logger.success('Browser launched successfully');
this.launchOptions = options;
} catch (error) {
this.logger.error('Failed to launch browser:', error);
throw error;
Expand Down Expand Up @@ -148,6 +151,7 @@ export class AIOBrowser {
async getActivePage(): Promise<Page> {
this.logger.info('Getting active page');
const pages = await this.browser.getBrowser().pages();
this.logger.info(`getActivePage pages length: ${pages.length}`);
try {
// First try to find a visible page without waiting
for (const page of pages) {
Expand Down Expand Up @@ -192,10 +196,14 @@ export class AIOBrowser {
continue;
}
}
this.logger.success('Active original page retrieved successfully');
this.logger.success('Active original page retrieved failed, fallback to active page');
return this.browser.getActivePage();
} catch (error) {
this.logger.error('Failed to get active page:', error);
if ((error as Error).message.includes('Protocol error: Connection closed')) {
this.logger.error('Connection closed, reconnecting...');
this.browser.launch(this.launchOptions);
}
throw error;
}
}
Expand Down
Loading
Loading