Skip to content

Commit ce4fd29

Browse files
feat: browser_pools: add start_url config (KERNEL-1217 PR 2)
1 parent 0052fe0 commit ce4fd29

6 files changed

Lines changed: 77 additions & 2 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 112
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel/kernel-b51c72a040c8dfea9c0693de6631feabfffe42922d5feb60b4ac0ee5c83bb8f4.yml
3-
openapi_spec_hash: 8b671cfe4debe8d9ad7c39ba5b0eaf6d
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel/kernel-7d2d29d7598105d50e5118e0bc5ac654361a92cb95555705dbd1d236848e1456.yml
3+
openapi_spec_hash: 10002eae793e08f81932239bbc72b503
44
config_hash: 08d55086449943a8fec212b870061a3f

src/resources/browser-pools.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,15 @@ export namespace BrowserPool {
237237
*/
238238
proxy_id?: string;
239239

240+
/**
241+
* Optional URL to navigate to when a new browser is warmed into the pool.
242+
* Best-effort: failures to navigate do not fail pool fill. Only applied to
243+
* newly-warmed browsers — browsers reused via release/acquire keep whatever URL
244+
* the previous lease left them on. Accepts any URL Chromium can resolve, including
245+
* chrome:// pages.
246+
*/
247+
start_url?: string;
248+
240249
/**
241250
* If true, launches the browser in stealth mode to reduce detection by anti-bot
242251
* mechanisms.
@@ -353,6 +362,12 @@ export interface BrowserPoolAcquireResponse {
353362
*/
354363
proxy_id?: string;
355364

365+
/**
366+
* URL the session was asked to navigate to on creation, if any. Recorded for
367+
* debugging — navigation is best-effort and may have failed.
368+
*/
369+
start_url?: string;
370+
356371
/**
357372
* Session usage metrics.
358373
*/
@@ -430,6 +445,15 @@ export interface BrowserPoolCreateParams {
430445
*/
431446
proxy_id?: string;
432447

448+
/**
449+
* Optional URL to navigate to when a new browser is warmed into the pool.
450+
* Best-effort: failures to navigate do not fail pool fill. Only applied to
451+
* newly-warmed browsers — browsers reused via release/acquire keep whatever URL
452+
* the previous lease left them on. Accepts any URL Chromium can resolve, including
453+
* chrome:// pages.
454+
*/
455+
start_url?: string;
456+
433457
/**
434458
* If true, launches the browser in stealth mode to reduce detection by anti-bot
435459
* mechanisms.
@@ -520,6 +544,15 @@ export interface BrowserPoolUpdateParams {
520544
*/
521545
proxy_id?: string;
522546

547+
/**
548+
* Optional URL to navigate to when a new browser is warmed into the pool.
549+
* Best-effort: failures to navigate do not fail pool fill. Only applied to
550+
* newly-warmed browsers — browsers reused via release/acquire keep whatever URL
551+
* the previous lease left them on. Accepts any URL Chromium can resolve, including
552+
* chrome:// pages.
553+
*/
554+
start_url?: string;
555+
523556
/**
524557
* If true, launches the browser in stealth mode to reduce detection by anti-bot
525558
* mechanisms.

src/resources/browsers/browsers.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,12 @@ export interface BrowserCreateResponse {
392392
*/
393393
proxy_id?: string;
394394

395+
/**
396+
* URL the session was asked to navigate to on creation, if any. Recorded for
397+
* debugging — navigation is best-effort and may have failed.
398+
*/
399+
start_url?: string;
400+
395401
/**
396402
* Session usage metrics.
397403
*/
@@ -498,6 +504,12 @@ export interface BrowserRetrieveResponse {
498504
*/
499505
proxy_id?: string;
500506

507+
/**
508+
* URL the session was asked to navigate to on creation, if any. Recorded for
509+
* debugging — navigation is best-effort and may have failed.
510+
*/
511+
start_url?: string;
512+
501513
/**
502514
* Session usage metrics.
503515
*/
@@ -604,6 +616,12 @@ export interface BrowserUpdateResponse {
604616
*/
605617
proxy_id?: string;
606618

619+
/**
620+
* URL the session was asked to navigate to on creation, if any. Recorded for
621+
* debugging — navigation is best-effort and may have failed.
622+
*/
623+
start_url?: string;
624+
607625
/**
608626
* Session usage metrics.
609627
*/
@@ -710,6 +728,12 @@ export interface BrowserListResponse {
710728
*/
711729
proxy_id?: string;
712730

731+
/**
732+
* URL the session was asked to navigate to on creation, if any. Recorded for
733+
* debugging — navigation is best-effort and may have failed.
734+
*/
735+
start_url?: string;
736+
713737
/**
714738
* Session usage metrics.
715739
*/
@@ -805,6 +829,15 @@ export interface BrowserCreateParams {
805829
*/
806830
proxy_id?: string;
807831

832+
/**
833+
* Optional URL to navigate to immediately after the browser is created.
834+
* Best-effort: failures to navigate do not fail browser creation. Any pre-existing
835+
* tabs are reduced to a single tab which is then navigated. Accepts any URL
836+
* Chromium can resolve, including chrome:// pages. Ignored when reusing an
837+
* existing persistent session.
838+
*/
839+
start_url?: string;
840+
808841
/**
809842
* If true, launches the browser in stealth mode to reduce detection by anti-bot
810843
* mechanisms.

src/resources/invocations.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,12 @@ export namespace InvocationListBrowsersResponse {
501501
*/
502502
proxy_id?: string;
503503

504+
/**
505+
* URL the session was asked to navigate to on creation, if any. Recorded for
506+
* debugging — navigation is best-effort and may have failed.
507+
*/
508+
start_url?: string;
509+
504510
/**
505511
* Session usage metrics.
506512
*/

tests/api-resources/browser-pools.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ describe('resource browserPools', () => {
3636
save_changes: true,
3737
},
3838
proxy_id: 'proxy_id',
39+
start_url: 'https://example.com',
3940
stealth: true,
4041
timeout_seconds: 60,
4142
viewport: {
@@ -87,6 +88,7 @@ describe('resource browserPools', () => {
8788
save_changes: true,
8889
},
8990
proxy_id: 'proxy_id',
91+
start_url: 'https://example.com',
9092
stealth: true,
9193
timeout_seconds: 60,
9294
viewport: {

tests/api-resources/browsers/browsers.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ describe('resource browsers', () => {
3838
save_changes: true,
3939
},
4040
proxy_id: 'proxy_id',
41+
start_url: 'https://example.com',
4142
stealth: true,
4243
timeout_seconds: 10,
4344
viewport: {

0 commit comments

Comments
 (0)