99 "fmt"
1010 "net/http"
1111 "net/url"
12+ "time"
1213
1314 "github.com/onkernel/kernel-go-sdk/internal/apijson"
1415 "github.com/onkernel/kernel-go-sdk/internal/apiquery"
@@ -138,8 +139,16 @@ func (r *BrowserPersistenceParam) UnmarshalJSON(data []byte) error {
138139type BrowserNewResponse struct {
139140 // Websocket URL for Chrome DevTools Protocol connections to the browser session
140141 CdpWsURL string `json:"cdp_ws_url,required"`
142+ // When the browser session was created.
143+ CreatedAt time.Time `json:"created_at,required" format:"date-time"`
144+ // Whether the browser session is running in headless mode.
145+ Headless bool `json:"headless,required"`
141146 // Unique identifier for the browser session
142147 SessionID string `json:"session_id,required"`
148+ // Whether the browser session is running in stealth mode.
149+ Stealth bool `json:"stealth,required"`
150+ // The number of seconds of inactivity before the browser session is terminated.
151+ TimeoutSeconds int64 `json:"timeout_seconds,required"`
143152 // Remote URL for live viewing the browser session. Only available for non-headless
144153 // browsers.
145154 BrowserLiveViewURL string `json:"browser_live_view_url"`
@@ -148,7 +157,11 @@ type BrowserNewResponse struct {
148157 // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
149158 JSON struct {
150159 CdpWsURL respjson.Field
160+ CreatedAt respjson.Field
161+ Headless respjson.Field
151162 SessionID respjson.Field
163+ Stealth respjson.Field
164+ TimeoutSeconds respjson.Field
152165 BrowserLiveViewURL respjson.Field
153166 Persistence respjson.Field
154167 ExtraFields map [string ]respjson.Field
@@ -165,8 +178,16 @@ func (r *BrowserNewResponse) UnmarshalJSON(data []byte) error {
165178type BrowserGetResponse struct {
166179 // Websocket URL for Chrome DevTools Protocol connections to the browser session
167180 CdpWsURL string `json:"cdp_ws_url,required"`
181+ // When the browser session was created.
182+ CreatedAt time.Time `json:"created_at,required" format:"date-time"`
183+ // Whether the browser session is running in headless mode.
184+ Headless bool `json:"headless,required"`
168185 // Unique identifier for the browser session
169186 SessionID string `json:"session_id,required"`
187+ // Whether the browser session is running in stealth mode.
188+ Stealth bool `json:"stealth,required"`
189+ // The number of seconds of inactivity before the browser session is terminated.
190+ TimeoutSeconds int64 `json:"timeout_seconds,required"`
170191 // Remote URL for live viewing the browser session. Only available for non-headless
171192 // browsers.
172193 BrowserLiveViewURL string `json:"browser_live_view_url"`
@@ -175,7 +196,11 @@ type BrowserGetResponse struct {
175196 // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
176197 JSON struct {
177198 CdpWsURL respjson.Field
199+ CreatedAt respjson.Field
200+ Headless respjson.Field
178201 SessionID respjson.Field
202+ Stealth respjson.Field
203+ TimeoutSeconds respjson.Field
179204 BrowserLiveViewURL respjson.Field
180205 Persistence respjson.Field
181206 ExtraFields map [string ]respjson.Field
@@ -192,8 +217,16 @@ func (r *BrowserGetResponse) UnmarshalJSON(data []byte) error {
192217type BrowserListResponse struct {
193218 // Websocket URL for Chrome DevTools Protocol connections to the browser session
194219 CdpWsURL string `json:"cdp_ws_url,required"`
220+ // When the browser session was created.
221+ CreatedAt time.Time `json:"created_at,required" format:"date-time"`
222+ // Whether the browser session is running in headless mode.
223+ Headless bool `json:"headless,required"`
195224 // Unique identifier for the browser session
196225 SessionID string `json:"session_id,required"`
226+ // Whether the browser session is running in stealth mode.
227+ Stealth bool `json:"stealth,required"`
228+ // The number of seconds of inactivity before the browser session is terminated.
229+ TimeoutSeconds int64 `json:"timeout_seconds,required"`
197230 // Remote URL for live viewing the browser session. Only available for non-headless
198231 // browsers.
199232 BrowserLiveViewURL string `json:"browser_live_view_url"`
@@ -202,7 +235,11 @@ type BrowserListResponse struct {
202235 // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
203236 JSON struct {
204237 CdpWsURL respjson.Field
238+ CreatedAt respjson.Field
239+ Headless respjson.Field
205240 SessionID respjson.Field
241+ Stealth respjson.Field
242+ TimeoutSeconds respjson.Field
206243 BrowserLiveViewURL respjson.Field
207244 Persistence respjson.Field
208245 ExtraFields map [string ]respjson.Field
@@ -225,6 +262,10 @@ type BrowserNewParams struct {
225262 // If true, launches the browser in stealth mode to reduce detection by anti-bot
226263 // mechanisms.
227264 Stealth param.Opt [bool ] `json:"stealth,omitzero"`
265+ // The number of seconds of inactivity before the browser session is terminated.
266+ // Only applicable to non-persistent browsers. Activity includes CDP connections
267+ // and live view connections. Defaults to 60 seconds.
268+ TimeoutSeconds param.Opt [int64 ] `json:"timeout_seconds,omitzero"`
228269 // Optional persistence configuration for the browser session.
229270 Persistence BrowserPersistenceParam `json:"persistence,omitzero"`
230271 paramObj
0 commit comments