@@ -133,6 +133,18 @@ func (r *InvocationService) FollowStreaming(ctx context.Context, id string, quer
133133 return ssestream .NewStream [InvocationFollowResponseUnion ](ssestream .NewDecoder (raw ), err )
134134}
135135
136+ // Returns all active browser sessions created within the specified invocation.
137+ func (r * InvocationService ) ListBrowsers (ctx context.Context , id string , opts ... option.RequestOption ) (res * InvocationListBrowsersResponse , err error ) {
138+ opts = slices .Concat (r .Options , opts )
139+ if id == "" {
140+ err = errors .New ("missing required id parameter" )
141+ return
142+ }
143+ path := fmt .Sprintf ("invocations/%s/browsers" , id )
144+ err = requestconfig .ExecuteNewRequest (ctx , http .MethodGet , path , nil , & res , opts ... )
145+ return
146+ }
147+
136148// An event representing the current state of an invocation.
137149type InvocationStateEvent struct {
138150 // Event type identifier (always "invocation_state").
@@ -507,6 +519,85 @@ func (r *InvocationFollowResponseUnion) UnmarshalJSON(data []byte) error {
507519 return apijson .UnmarshalRoot (data , r )
508520}
509521
522+ type InvocationListBrowsersResponse struct {
523+ Browsers []InvocationListBrowsersResponseBrowser `json:"browsers,required"`
524+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
525+ JSON struct {
526+ Browsers respjson.Field
527+ ExtraFields map [string ]respjson.Field
528+ raw string
529+ } `json:"-"`
530+ }
531+
532+ // Returns the unmodified JSON received from the API
533+ func (r InvocationListBrowsersResponse ) RawJSON () string { return r .JSON .raw }
534+ func (r * InvocationListBrowsersResponse ) UnmarshalJSON (data []byte ) error {
535+ return apijson .UnmarshalRoot (data , r )
536+ }
537+
538+ type InvocationListBrowsersResponseBrowser struct {
539+ // Websocket URL for Chrome DevTools Protocol connections to the browser session
540+ CdpWsURL string `json:"cdp_ws_url,required"`
541+ // When the browser session was created.
542+ CreatedAt time.Time `json:"created_at,required" format:"date-time"`
543+ // Whether the browser session is running in headless mode.
544+ Headless bool `json:"headless,required"`
545+ // Unique identifier for the browser session
546+ SessionID string `json:"session_id,required"`
547+ // Whether the browser session is running in stealth mode.
548+ Stealth bool `json:"stealth,required"`
549+ // The number of seconds of inactivity before the browser session is terminated.
550+ TimeoutSeconds int64 `json:"timeout_seconds,required"`
551+ // Remote URL for live viewing the browser session. Only available for non-headless
552+ // browsers.
553+ BrowserLiveViewURL string `json:"browser_live_view_url"`
554+ // When the browser session was soft-deleted. Only present for deleted sessions.
555+ DeletedAt time.Time `json:"deleted_at" format:"date-time"`
556+ // Whether the browser session is running in kiosk mode.
557+ KioskMode bool `json:"kiosk_mode"`
558+ // DEPRECATED: Use timeout_seconds (up to 72 hours) and Profiles instead.
559+ //
560+ // Deprecated: deprecated
561+ Persistence BrowserPersistence `json:"persistence"`
562+ // Browser profile metadata.
563+ Profile Profile `json:"profile"`
564+ // ID of the proxy associated with this browser session, if any.
565+ ProxyID string `json:"proxy_id"`
566+ // Initial browser window size in pixels with optional refresh rate. If omitted,
567+ // image defaults apply (1920x1080@25). Only specific viewport configurations are
568+ // supported. The server will reject unsupported combinations. Supported
569+ // resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25, 1440x900@25,
570+ // 1280x800@60, 1024x768@60, 1200x800@60 If refresh_rate is not provided, it will
571+ // be automatically determined from the width and height if they match a supported
572+ // configuration exactly. Note: Higher resolutions may affect the responsiveness of
573+ // live view browser
574+ Viewport shared.BrowserViewport `json:"viewport"`
575+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
576+ JSON struct {
577+ CdpWsURL respjson.Field
578+ CreatedAt respjson.Field
579+ Headless respjson.Field
580+ SessionID respjson.Field
581+ Stealth respjson.Field
582+ TimeoutSeconds respjson.Field
583+ BrowserLiveViewURL respjson.Field
584+ DeletedAt respjson.Field
585+ KioskMode respjson.Field
586+ Persistence respjson.Field
587+ Profile respjson.Field
588+ ProxyID respjson.Field
589+ Viewport respjson.Field
590+ ExtraFields map [string ]respjson.Field
591+ raw string
592+ } `json:"-"`
593+ }
594+
595+ // Returns the unmodified JSON received from the API
596+ func (r InvocationListBrowsersResponseBrowser ) RawJSON () string { return r .JSON .raw }
597+ func (r * InvocationListBrowsersResponseBrowser ) UnmarshalJSON (data []byte ) error {
598+ return apijson .UnmarshalRoot (data , r )
599+ }
600+
510601type InvocationNewParams struct {
511602 // Name of the action to invoke
512603 ActionName string `json:"action_name,required"`
0 commit comments