agent-browser 0.17.1 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -5
- package/bin/agent-browser-darwin-arm64 +0 -0
- package/bin/agent-browser-darwin-x64 +0 -0
- package/bin/agent-browser-linux-arm64 +0 -0
- package/bin/agent-browser-linux-x64 +0 -0
- package/bin/agent-browser-win32-x64.exe +0 -0
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +63 -1
- package/dist/actions.js.map +1 -1
- package/dist/browser.d.ts +12 -3
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +93 -38
- package/dist/browser.js.map +1 -1
- package/dist/daemon.d.ts +5 -0
- package/dist/daemon.d.ts.map +1 -1
- package/dist/daemon.js +62 -1
- package/dist/daemon.js.map +1 -1
- package/dist/inspect-server.d.ts +26 -0
- package/dist/inspect-server.d.ts.map +1 -0
- package/dist/inspect-server.js +218 -0
- package/dist/inspect-server.js.map +1 -0
- package/dist/protocol.d.ts +3 -1
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +4 -2
- package/dist/protocol.js.map +1 -1
- package/dist/types.d.ts +7 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/skills/agent-browser/SKILL.md +88 -0
- package/skills/agent-browser/references/authentication.md +101 -0
- package/skills/agent-browser/references/commands.md +2 -0
- package/skills/vercel-sandbox/SKILL.md +280 -0
package/dist/browser.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { devices, type Browser, type BrowserContext, type Page, type Frame, type Locator, type CDPSession } from 'playwright-core';
|
|
2
2
|
import type { LaunchCommand } from './types.js';
|
|
3
|
+
import type { InspectServer } from './inspect-server.js';
|
|
3
4
|
import { type RefMap, type EnhancedSnapshot } from './snapshot.js';
|
|
4
5
|
/**
|
|
5
6
|
* Returns the default Playwright timeout in milliseconds for standard operations.
|
|
6
7
|
* Can be overridden via the AGENT_BROWSER_DEFAULT_TIMEOUT environment variable.
|
|
7
8
|
* Default is 25s, which is below the CLI's 30s IPC read timeout to ensure
|
|
8
9
|
* Playwright errors are returned before the CLI gives up with EAGAIN.
|
|
9
|
-
*
|
|
10
|
+
* Recording contexts use a shorter fixed timeout (10s) and are not affected.
|
|
10
11
|
*/
|
|
11
12
|
export declare function getDefaultTimeout(): number;
|
|
12
13
|
export interface ScreencastFrame {
|
|
@@ -51,6 +52,7 @@ interface PageError {
|
|
|
51
52
|
export declare class BrowserManager {
|
|
52
53
|
private browser;
|
|
53
54
|
private cdpEndpoint;
|
|
55
|
+
private resolvedWsUrl;
|
|
54
56
|
private isPersistentContext;
|
|
55
57
|
private browserbaseSessionId;
|
|
56
58
|
private browserbaseApiKey;
|
|
@@ -74,6 +76,9 @@ export declare class BrowserManager {
|
|
|
74
76
|
private colorScheme;
|
|
75
77
|
private downloadPath;
|
|
76
78
|
private allowedDomains;
|
|
79
|
+
private inspectServer;
|
|
80
|
+
stopInspectServer(): void;
|
|
81
|
+
setInspectServer(server: InspectServer): void;
|
|
77
82
|
/**
|
|
78
83
|
* Set the persistent color scheme preference.
|
|
79
84
|
* Applied automatically to all new pages and contexts.
|
|
@@ -104,6 +109,7 @@ export declare class BrowserManager {
|
|
|
104
109
|
* Check if browser is launched
|
|
105
110
|
*/
|
|
106
111
|
isLaunched(): boolean;
|
|
112
|
+
getCdpUrl(): string | null;
|
|
107
113
|
/**
|
|
108
114
|
* Get enhanced snapshot with refs and cache the ref map
|
|
109
115
|
*/
|
|
@@ -361,7 +367,7 @@ export declare class BrowserManager {
|
|
|
361
367
|
private closeKernelSession;
|
|
362
368
|
/**
|
|
363
369
|
* Connect to Browserbase remote browser via CDP.
|
|
364
|
-
* Requires BROWSERBASE_API_KEY
|
|
370
|
+
* Requires BROWSERBASE_API_KEY environment variable.
|
|
365
371
|
*/
|
|
366
372
|
private connectToBrowserbase;
|
|
367
373
|
/**
|
|
@@ -371,7 +377,10 @@ export declare class BrowserManager {
|
|
|
371
377
|
private findOrCreateKernelProfile;
|
|
372
378
|
/**
|
|
373
379
|
* Connect to Kernel remote browser via CDP.
|
|
374
|
-
*
|
|
380
|
+
* Uses KERNEL_API_KEY environment variable for authentication when set.
|
|
381
|
+
* When running inside environments with external credential injection
|
|
382
|
+
* (e.g. Vercel Sandbox credentials brokering), the API key can be omitted
|
|
383
|
+
* and auth headers will be injected at the network layer.
|
|
375
384
|
*/
|
|
376
385
|
private connectToKernel;
|
|
377
386
|
/**
|
package/dist/browser.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,OAAO,EACP,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,IAAI,EACT,KAAK,KAAK,EAIV,KAAK,OAAO,EACZ,KAAK,UAAU,EAEhB,MAAM,iBAAiB,CAAC;AAKzB,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,gBAAgB,EAAiC,MAAM,eAAe,CAAC;AAUlG;;;;;;GAMG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAS1C;AAGD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE;QACR,SAAS,EAAE,MAAM,CAAC;QAClB,eAAe,EAAE,MAAM,CAAC;QACxB,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,MAAM,CAAC;QACrB,aAAa,EAAE,MAAM,CAAC;QACtB,aAAa,EAAE,MAAM,CAAC;QACtB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,SAAS,EAAE,MAAM,CAAC;CACnB;AAGD,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,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QACb,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC,IAAI,CAAC;IAYjB;;OAEG;IACG,gBAAgB,CAAC,MAAM,EAAE;QAC7B,IAAI,EAAE,YAAY,GAAG,UAAU,GAAG,WAAW,GAAG,aAAa,CAAC;QAC9D,WAAW,EAAE,KAAK,CAAC;YAAE,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAC;YAAC,EAAE,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC,IAAI,CAAC;IAcjB;;OAEG;IACH,WAAW,IAAI,OAAO;IAItB;;;;;;;OAOG;IACG,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAuGrE;;;OAGG;IACG,aAAa,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAuEhF;;;;;;;OAOG;IACG,gBAAgB,CACpB,UAAU,EAAE,MAAM,EAClB,GAAG,CAAC,EAAE,MAAM,GACX,OAAO,CAAC;QAAE,YAAY,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAiBvD;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAiG7B"}
|
package/dist/browser.js
CHANGED
|
@@ -12,7 +12,7 @@ import { getEncryptionKey, isEncryptedPayload, decryptData, ENCRYPTION_KEY_ENV,
|
|
|
12
12
|
* Can be overridden via the AGENT_BROWSER_DEFAULT_TIMEOUT environment variable.
|
|
13
13
|
* Default is 25s, which is below the CLI's 30s IPC read timeout to ensure
|
|
14
14
|
* Playwright errors are returned before the CLI gives up with EAGAIN.
|
|
15
|
-
*
|
|
15
|
+
* Recording contexts use a shorter fixed timeout (10s) and are not affected.
|
|
16
16
|
*/
|
|
17
17
|
export function getDefaultTimeout() {
|
|
18
18
|
const envValue = process.env.AGENT_BROWSER_DEFAULT_TIMEOUT;
|
|
@@ -30,6 +30,7 @@ export function getDefaultTimeout() {
|
|
|
30
30
|
export class BrowserManager {
|
|
31
31
|
browser = null;
|
|
32
32
|
cdpEndpoint = null; // stores port number or full URL
|
|
33
|
+
resolvedWsUrl = null;
|
|
33
34
|
isPersistentContext = false;
|
|
34
35
|
browserbaseSessionId = null;
|
|
35
36
|
browserbaseApiKey = null;
|
|
@@ -53,6 +54,17 @@ export class BrowserManager {
|
|
|
53
54
|
colorScheme = null;
|
|
54
55
|
downloadPath = null;
|
|
55
56
|
allowedDomains = [];
|
|
57
|
+
inspectServer = null;
|
|
58
|
+
stopInspectServer() {
|
|
59
|
+
if (this.inspectServer) {
|
|
60
|
+
this.inspectServer.stop();
|
|
61
|
+
this.inspectServer = null;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
setInspectServer(server) {
|
|
65
|
+
this.stopInspectServer();
|
|
66
|
+
this.inspectServer = server;
|
|
67
|
+
}
|
|
56
68
|
/**
|
|
57
69
|
* Set the persistent color scheme preference.
|
|
58
70
|
* Applied automatically to all new pages and contexts.
|
|
@@ -94,6 +106,19 @@ export class BrowserManager {
|
|
|
94
106
|
isLaunched() {
|
|
95
107
|
return this.browser !== null || this.isPersistentContext;
|
|
96
108
|
}
|
|
109
|
+
getCdpUrl() {
|
|
110
|
+
if (this.resolvedWsUrl)
|
|
111
|
+
return this.resolvedWsUrl;
|
|
112
|
+
if (this.cdpEndpoint?.startsWith('ws://') || this.cdpEndpoint?.startsWith('wss://')) {
|
|
113
|
+
return this.cdpEndpoint;
|
|
114
|
+
}
|
|
115
|
+
try {
|
|
116
|
+
return this.browser?.wsEndpoint?.() ?? null;
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
97
122
|
/**
|
|
98
123
|
* Get enhanced snapshot with refs and cache the ref map
|
|
99
124
|
*/
|
|
@@ -719,12 +744,17 @@ export class BrowserManager {
|
|
|
719
744
|
* Close a Browserbase session via API
|
|
720
745
|
*/
|
|
721
746
|
async closeBrowserbaseSession(sessionId, apiKey) {
|
|
722
|
-
await fetch(`https://api.browserbase.com/v1/sessions/${sessionId}`, {
|
|
723
|
-
method: '
|
|
747
|
+
const response = await fetch(`https://api.browserbase.com/v1/sessions/${sessionId}`, {
|
|
748
|
+
method: 'POST',
|
|
724
749
|
headers: {
|
|
750
|
+
'Content-Type': 'application/json',
|
|
725
751
|
'X-BB-API-Key': apiKey,
|
|
726
752
|
},
|
|
753
|
+
body: JSON.stringify({ status: 'REQUEST_RELEASE' }),
|
|
727
754
|
});
|
|
755
|
+
if (!response.ok) {
|
|
756
|
+
throw new Error(`Failed to close Browserbase session: ${response.statusText}`);
|
|
757
|
+
}
|
|
728
758
|
}
|
|
729
759
|
/**
|
|
730
760
|
* Close a Browser Use session via API
|
|
@@ -746,11 +776,13 @@ export class BrowserManager {
|
|
|
746
776
|
* Close a Kernel session via API
|
|
747
777
|
*/
|
|
748
778
|
async closeKernelSession(sessionId, apiKey) {
|
|
779
|
+
const headers = {};
|
|
780
|
+
if (apiKey) {
|
|
781
|
+
headers['Authorization'] = `Bearer ${apiKey}`;
|
|
782
|
+
}
|
|
749
783
|
const response = await fetch(`https://api.onkernel.com/browsers/${sessionId}`, {
|
|
750
784
|
method: 'DELETE',
|
|
751
|
-
headers
|
|
752
|
-
Authorization: `Bearer ${apiKey}`,
|
|
753
|
-
},
|
|
785
|
+
headers,
|
|
754
786
|
});
|
|
755
787
|
if (!response.ok) {
|
|
756
788
|
throw new Error(`Failed to close Kernel session: ${response.statusText}`);
|
|
@@ -758,23 +790,18 @@ export class BrowserManager {
|
|
|
758
790
|
}
|
|
759
791
|
/**
|
|
760
792
|
* Connect to Browserbase remote browser via CDP.
|
|
761
|
-
* Requires BROWSERBASE_API_KEY
|
|
793
|
+
* Requires BROWSERBASE_API_KEY environment variable.
|
|
762
794
|
*/
|
|
763
795
|
async connectToBrowserbase() {
|
|
764
796
|
const browserbaseApiKey = process.env.BROWSERBASE_API_KEY;
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
throw new Error('BROWSERBASE_API_KEY and BROWSERBASE_PROJECT_ID are required when using browserbase as a provider');
|
|
797
|
+
if (!browserbaseApiKey) {
|
|
798
|
+
throw new Error('BROWSERBASE_API_KEY is required when using browserbase as a provider');
|
|
768
799
|
}
|
|
769
800
|
const response = await fetch('https://api.browserbase.com/v1/sessions', {
|
|
770
801
|
method: 'POST',
|
|
771
802
|
headers: {
|
|
772
|
-
'Content-Type': 'application/json',
|
|
773
803
|
'X-BB-API-Key': browserbaseApiKey,
|
|
774
804
|
},
|
|
775
|
-
body: JSON.stringify({
|
|
776
|
-
projectId: browserbaseProjectId,
|
|
777
|
-
}),
|
|
778
805
|
});
|
|
779
806
|
if (!response.ok) {
|
|
780
807
|
throw new Error(`Failed to create Browserbase session: ${response.statusText}`);
|
|
@@ -794,7 +821,7 @@ export class BrowserManager {
|
|
|
794
821
|
this.browserbaseSessionId = session.id;
|
|
795
822
|
this.browserbaseApiKey = browserbaseApiKey;
|
|
796
823
|
this.browser = browser;
|
|
797
|
-
context.setDefaultTimeout(
|
|
824
|
+
context.setDefaultTimeout(getDefaultTimeout());
|
|
798
825
|
this.contexts.push(context);
|
|
799
826
|
this.setupContextTracking(context);
|
|
800
827
|
await this.ensureDomainFilter(context);
|
|
@@ -815,12 +842,14 @@ export class BrowserManager {
|
|
|
815
842
|
* Returns the profile object if successful.
|
|
816
843
|
*/
|
|
817
844
|
async findOrCreateKernelProfile(profileName, apiKey) {
|
|
845
|
+
const headers = {};
|
|
846
|
+
if (apiKey) {
|
|
847
|
+
headers['Authorization'] = `Bearer ${apiKey}`;
|
|
848
|
+
}
|
|
818
849
|
// First, try to get the existing profile
|
|
819
850
|
const getResponse = await fetch(`https://api.onkernel.com/profiles/${encodeURIComponent(profileName)}`, {
|
|
820
851
|
method: 'GET',
|
|
821
|
-
headers
|
|
822
|
-
Authorization: `Bearer ${apiKey}`,
|
|
823
|
-
},
|
|
852
|
+
headers,
|
|
824
853
|
});
|
|
825
854
|
if (getResponse.ok) {
|
|
826
855
|
// Profile exists, return it
|
|
@@ -834,7 +863,7 @@ export class BrowserManager {
|
|
|
834
863
|
method: 'POST',
|
|
835
864
|
headers: {
|
|
836
865
|
'Content-Type': 'application/json',
|
|
837
|
-
|
|
866
|
+
...headers,
|
|
838
867
|
},
|
|
839
868
|
body: JSON.stringify({ name: profileName }),
|
|
840
869
|
});
|
|
@@ -845,13 +874,13 @@ export class BrowserManager {
|
|
|
845
874
|
}
|
|
846
875
|
/**
|
|
847
876
|
* Connect to Kernel remote browser via CDP.
|
|
848
|
-
*
|
|
877
|
+
* Uses KERNEL_API_KEY environment variable for authentication when set.
|
|
878
|
+
* When running inside environments with external credential injection
|
|
879
|
+
* (e.g. Vercel Sandbox credentials brokering), the API key can be omitted
|
|
880
|
+
* and auth headers will be injected at the network layer.
|
|
849
881
|
*/
|
|
850
882
|
async connectToKernel() {
|
|
851
883
|
const kernelApiKey = process.env.KERNEL_API_KEY;
|
|
852
|
-
if (!kernelApiKey) {
|
|
853
|
-
throw new Error('KERNEL_API_KEY is required when using kernel as a provider');
|
|
854
|
-
}
|
|
855
884
|
// Find or create profile if KERNEL_PROFILE_NAME is set
|
|
856
885
|
const profileName = process.env.KERNEL_PROFILE_NAME;
|
|
857
886
|
let profileConfig;
|
|
@@ -864,12 +893,15 @@ export class BrowserManager {
|
|
|
864
893
|
},
|
|
865
894
|
};
|
|
866
895
|
}
|
|
896
|
+
const headers = {
|
|
897
|
+
'Content-Type': 'application/json',
|
|
898
|
+
};
|
|
899
|
+
if (kernelApiKey) {
|
|
900
|
+
headers['Authorization'] = `Bearer ${kernelApiKey}`;
|
|
901
|
+
}
|
|
867
902
|
const response = await fetch('https://api.onkernel.com/browsers', {
|
|
868
903
|
method: 'POST',
|
|
869
|
-
headers
|
|
870
|
-
'Content-Type': 'application/json',
|
|
871
|
-
Authorization: `Bearer ${kernelApiKey}`,
|
|
872
|
-
},
|
|
904
|
+
headers,
|
|
873
905
|
body: JSON.stringify({
|
|
874
906
|
// Kernel browsers are headful by default with stealth mode available
|
|
875
907
|
// The user can configure these via environment variables if needed
|
|
@@ -911,7 +943,7 @@ export class BrowserManager {
|
|
|
911
943
|
page = pages[0] ?? (await context.newPage());
|
|
912
944
|
}
|
|
913
945
|
this.kernelSessionId = session.session_id;
|
|
914
|
-
this.kernelApiKey = kernelApiKey;
|
|
946
|
+
this.kernelApiKey = kernelApiKey ?? null;
|
|
915
947
|
this.browser = browser;
|
|
916
948
|
context.setDefaultTimeout(getDefaultTimeout());
|
|
917
949
|
this.contexts.push(context);
|
|
@@ -1174,6 +1206,7 @@ export class BrowserManager {
|
|
|
1174
1206
|
...(this.downloadPath && { downloadsPath: this.downloadPath }),
|
|
1175
1207
|
});
|
|
1176
1208
|
this.cdpEndpoint = null;
|
|
1209
|
+
this.resolvedWsUrl = null;
|
|
1177
1210
|
// Check for auto-load state file (supports encrypted files)
|
|
1178
1211
|
let storageState = options.storageState ? options.storageState : undefined;
|
|
1179
1212
|
if (!storageState && options.autoStateFilePath) {
|
|
@@ -1265,17 +1298,17 @@ export class BrowserManager {
|
|
|
1265
1298
|
}
|
|
1266
1299
|
else if (/^\d+$/.test(cdpEndpoint)) {
|
|
1267
1300
|
// Numeric string - treat as port number (handles JSON serialization quirks)
|
|
1268
|
-
cdpUrl = `http://
|
|
1301
|
+
cdpUrl = `http://127.0.0.1:${cdpEndpoint}`;
|
|
1269
1302
|
}
|
|
1270
1303
|
else {
|
|
1271
1304
|
// Unknown format - still try as port for backward compatibility
|
|
1272
|
-
cdpUrl = `http://
|
|
1305
|
+
cdpUrl = `http://127.0.0.1:${cdpEndpoint}`;
|
|
1273
1306
|
}
|
|
1274
1307
|
const browser = await chromium
|
|
1275
1308
|
.connectOverCDP(cdpUrl, { timeout: options?.timeout })
|
|
1276
1309
|
.catch(() => {
|
|
1277
1310
|
throw new Error(`Failed to connect via CDP to ${cdpUrl}. ` +
|
|
1278
|
-
(cdpUrl.includes('
|
|
1311
|
+
(cdpUrl.includes('127.0.0.1')
|
|
1279
1312
|
? `Make sure the app is running with --remote-debugging-port=${cdpEndpoint}`
|
|
1280
1313
|
: 'Make sure the remote browser is accessible and the URL is correct.'));
|
|
1281
1314
|
});
|
|
@@ -1293,8 +1326,26 @@ export class BrowserManager {
|
|
|
1293
1326
|
// All validation passed - commit state
|
|
1294
1327
|
this.browser = browser;
|
|
1295
1328
|
this.cdpEndpoint = cdpEndpoint;
|
|
1329
|
+
let resolvedWs = null;
|
|
1330
|
+
try {
|
|
1331
|
+
resolvedWs = browser.wsEndpoint?.() ?? null;
|
|
1332
|
+
}
|
|
1333
|
+
catch (err) {
|
|
1334
|
+
console.error('[inspect] wsEndpoint() failed:', err);
|
|
1335
|
+
}
|
|
1336
|
+
if (!resolvedWs && (cdpUrl.startsWith('http://') || cdpUrl.startsWith('https://'))) {
|
|
1337
|
+
try {
|
|
1338
|
+
const resp = await fetch(`${cdpUrl}/json/version`);
|
|
1339
|
+
const info = await resp.json();
|
|
1340
|
+
resolvedWs = info.webSocketDebuggerUrl ?? null;
|
|
1341
|
+
}
|
|
1342
|
+
catch (err) {
|
|
1343
|
+
console.error('[inspect] /json/version fetch failed:', err);
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
this.resolvedWsUrl = resolvedWs;
|
|
1296
1347
|
for (const context of contexts) {
|
|
1297
|
-
context.setDefaultTimeout(
|
|
1348
|
+
context.setDefaultTimeout(getDefaultTimeout());
|
|
1298
1349
|
this.contexts.push(context);
|
|
1299
1350
|
this.setupContextTracking(context);
|
|
1300
1351
|
await this.ensureDomainFilter(context);
|
|
@@ -1510,7 +1561,7 @@ export class BrowserManager {
|
|
|
1510
1561
|
* Create a new tab in the current context
|
|
1511
1562
|
*/
|
|
1512
1563
|
async newTab() {
|
|
1513
|
-
if (!this.
|
|
1564
|
+
if (!this.isLaunched() || this.contexts.length === 0) {
|
|
1514
1565
|
throw new Error('Browser not launched');
|
|
1515
1566
|
}
|
|
1516
1567
|
// Invalidate CDP session since we're switching to a new page
|
|
@@ -1530,7 +1581,9 @@ export class BrowserManager {
|
|
|
1530
1581
|
*/
|
|
1531
1582
|
async newWindow(viewport) {
|
|
1532
1583
|
if (!this.browser) {
|
|
1533
|
-
throw new Error(
|
|
1584
|
+
throw new Error(this.isPersistentContext
|
|
1585
|
+
? 'newWindow is not supported in extension (persistent context) mode'
|
|
1586
|
+
: 'Browser not launched');
|
|
1534
1587
|
}
|
|
1535
1588
|
const context = await this.browser.newContext({
|
|
1536
1589
|
viewport: viewport === undefined ? { width: 1280, height: 720 } : viewport,
|
|
@@ -1931,8 +1984,8 @@ export class BrowserManager {
|
|
|
1931
1984
|
this.recordingTempDir = path.join(os.tmpdir(), `agent-browser-recording-${session}-${Date.now()}`);
|
|
1932
1985
|
mkdirSync(this.recordingTempDir, { recursive: true });
|
|
1933
1986
|
this.recordingOutputPath = outputPath;
|
|
1934
|
-
//
|
|
1935
|
-
const viewport = { width: 1280, height: 720 };
|
|
1987
|
+
// Reuse the active page viewport when available so recording matches the current layout.
|
|
1988
|
+
const viewport = currentPage?.viewportSize() ?? { width: 1280, height: 720 };
|
|
1936
1989
|
this.recordingContext = await this.browser.newContext({
|
|
1937
1990
|
viewport,
|
|
1938
1991
|
recordVideo: {
|
|
@@ -2045,6 +2098,7 @@ export class BrowserManager {
|
|
|
2045
2098
|
* Close the browser and clean up
|
|
2046
2099
|
*/
|
|
2047
2100
|
async close() {
|
|
2101
|
+
this.stopInspectServer();
|
|
2048
2102
|
// Stop recording if active (saves video)
|
|
2049
2103
|
if (this.recordingContext) {
|
|
2050
2104
|
await this.stopRecording();
|
|
@@ -2089,8 +2143,8 @@ export class BrowserManager {
|
|
|
2089
2143
|
});
|
|
2090
2144
|
this.browser = null;
|
|
2091
2145
|
}
|
|
2092
|
-
else if (this.kernelSessionId
|
|
2093
|
-
await this.closeKernelSession(this.kernelSessionId, this.kernelApiKey).catch((error) => {
|
|
2146
|
+
else if (this.kernelSessionId) {
|
|
2147
|
+
await this.closeKernelSession(this.kernelSessionId, this.kernelApiKey ?? undefined).catch((error) => {
|
|
2094
2148
|
console.error('Failed to close Kernel session:', error);
|
|
2095
2149
|
});
|
|
2096
2150
|
this.browser = null;
|
|
@@ -2118,6 +2172,7 @@ export class BrowserManager {
|
|
|
2118
2172
|
this.pages = [];
|
|
2119
2173
|
this.contexts = [];
|
|
2120
2174
|
this.cdpEndpoint = null;
|
|
2175
|
+
this.resolvedWsUrl = null;
|
|
2121
2176
|
this.browserbaseSessionId = null;
|
|
2122
2177
|
this.browserbaseApiKey = null;
|
|
2123
2178
|
this.browserUseSessionId = null;
|