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
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.29.0"
".": "0.30.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 97
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-46c8320dcd9f8fc596f469ef0dd1aafaca591ab36cf2a6f8a7297dc9136bdc71.yml
openapi_spec_hash: 1be1e6589cd94c581b241720e01a65bc
config_hash: b470456b217bb9502f5212311d395a6f
configured_endpoints: 98
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-ccbe854895eb34a9562e33979f5f43cd6ad1f529d5924ee56e56f0c94dcf0454.yml
openapi_spec_hash: 2fa4ecbe742fc46fdde481188c1d885e
config_hash: dd218aae3f852dff79e77febc2077b8e
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.30.0 (2026-02-03)

Full Changelog: [v0.29.0...v0.30.0](https://github.com/kernel/kernel-go-sdk/compare/v0.29.0...v0.30.0)

### Features

* Neil/kernel 872 templates v3 ([9a6a1bf](https://github.com/kernel/kernel-go-sdk/commit/9a6a1bf18929ef26c9fe7259dbd59682532d4bdc))

## 0.29.0 (2026-01-29)

Full Changelog: [v0.28.0...v0.29.0](https://github.com/kernel/kernel-go-sdk/compare/v0.28.0...v0.29.0)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Or to pin the version:
<!-- x-release-please-start-version -->

```sh
go get -u 'github.com/kernel/kernel-go-sdk@v0.29.0'
go get -u 'github.com/kernel/kernel-go-sdk@v0.30.0'
```

<!-- x-release-please-end -->
Expand Down
2 changes: 2 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Response Types:
- <a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk#InvocationUpdateResponse">InvocationUpdateResponse</a>
- <a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk#InvocationListResponse">InvocationListResponse</a>
- <a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk#InvocationFollowResponseUnion">InvocationFollowResponseUnion</a>
- <a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk#InvocationListBrowsersResponse">InvocationListBrowsersResponse</a>

Methods:

Expand All @@ -62,6 +63,7 @@ Methods:
- <code title="get /invocations">client.Invocations.<a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk#InvocationService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, query <a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk#InvocationListParams">InvocationListParams</a>) (\*<a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk/packages/pagination">pagination</a>.<a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk/packages/pagination#OffsetPagination">OffsetPagination</a>[<a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk#InvocationListResponse">InvocationListResponse</a>], <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="delete /invocations/{id}/browsers">client.Invocations.<a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk#InvocationService.DeleteBrowsers">DeleteBrowsers</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>) <a href="https://pkg.go.dev/builtin#error">error</a></code>
- <code title="get /invocations/{id}/events">client.Invocations.<a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk#InvocationService.Follow">Follow</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, query <a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk#InvocationFollowParams">InvocationFollowParams</a>) (\*<a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk#InvocationFollowResponseUnion">InvocationFollowResponseUnion</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /invocations/{id}/browsers">client.Invocations.<a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk#InvocationService.ListBrowsers">ListBrowsers</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>) (\*<a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk#InvocationListBrowsersResponse">InvocationListBrowsersResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

# Browsers

Expand Down
2 changes: 1 addition & 1 deletion internal/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

package internal

const PackageVersion = "0.29.0" // x-release-please-version
const PackageVersion = "0.30.0" // x-release-please-version
91 changes: 91 additions & 0 deletions invocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,18 @@ func (r *InvocationService) FollowStreaming(ctx context.Context, id string, quer
return ssestream.NewStream[InvocationFollowResponseUnion](ssestream.NewDecoder(raw), err)
}

// Returns all active browser sessions created within the specified invocation.
func (r *InvocationService) ListBrowsers(ctx context.Context, id string, opts ...option.RequestOption) (res *InvocationListBrowsersResponse, err error) {
opts = slices.Concat(r.Options, opts)
if id == "" {
err = errors.New("missing required id parameter")
return
}
path := fmt.Sprintf("invocations/%s/browsers", id)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}

// An event representing the current state of an invocation.
type InvocationStateEvent struct {
// Event type identifier (always "invocation_state").
Expand Down Expand Up @@ -507,6 +519,85 @@ func (r *InvocationFollowResponseUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}

type InvocationListBrowsersResponse struct {
Browsers []InvocationListBrowsersResponseBrowser `json:"browsers,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Browsers respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}

// Returns the unmodified JSON received from the API
func (r InvocationListBrowsersResponse) RawJSON() string { return r.JSON.raw }
func (r *InvocationListBrowsersResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}

type InvocationListBrowsersResponseBrowser struct {
// Websocket URL for Chrome DevTools Protocol connections to the browser session
CdpWsURL string `json:"cdp_ws_url,required"`
// When the browser session was created.
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
// Whether the browser session is running in headless mode.
Headless bool `json:"headless,required"`
// Unique identifier for the browser session
SessionID string `json:"session_id,required"`
// Whether the browser session is running in stealth mode.
Stealth bool `json:"stealth,required"`
// The number of seconds of inactivity before the browser session is terminated.
TimeoutSeconds int64 `json:"timeout_seconds,required"`
// Remote URL for live viewing the browser session. Only available for non-headless
// browsers.
BrowserLiveViewURL string `json:"browser_live_view_url"`
// When the browser session was soft-deleted. Only present for deleted sessions.
DeletedAt time.Time `json:"deleted_at" format:"date-time"`
// Whether the browser session is running in kiosk mode.
KioskMode bool `json:"kiosk_mode"`
// DEPRECATED: Use timeout_seconds (up to 72 hours) and Profiles instead.
//
// Deprecated: deprecated
Persistence BrowserPersistence `json:"persistence"`
// Browser profile metadata.
Profile Profile `json:"profile"`
// ID of the proxy associated with this browser session, if any.
ProxyID string `json:"proxy_id"`
// Initial browser window size in pixels with optional refresh rate. If omitted,
// image defaults apply (1920x1080@25). Only specific viewport configurations are
// supported. The server will reject unsupported combinations. Supported
// resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25, 1440x900@25,
// 1280x800@60, 1024x768@60, 1200x800@60 If refresh_rate is not provided, it will
// be automatically determined from the width and height if they match a supported
// configuration exactly. Note: Higher resolutions may affect the responsiveness of
// live view browser
Viewport shared.BrowserViewport `json:"viewport"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CdpWsURL respjson.Field
CreatedAt respjson.Field
Headless respjson.Field
SessionID respjson.Field
Stealth respjson.Field
TimeoutSeconds respjson.Field
BrowserLiveViewURL respjson.Field
DeletedAt respjson.Field
KioskMode respjson.Field
Persistence respjson.Field
Profile respjson.Field
ProxyID respjson.Field
Viewport respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}

// Returns the unmodified JSON received from the API
func (r InvocationListBrowsersResponseBrowser) RawJSON() string { return r.JSON.raw }
func (r *InvocationListBrowsersResponseBrowser) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}

type InvocationNewParams struct {
// Name of the action to invoke
ActionName string `json:"action_name,required"`
Expand Down
23 changes: 23 additions & 0 deletions invocation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,26 @@ func TestInvocationDeleteBrowsers(t *testing.T) {
t.Fatalf("err should be nil: %s", err.Error())
}
}

func TestInvocationListBrowsers(t *testing.T) {
t.Skip("Prism tests are disabled")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
}
if !testutil.CheckTestServer(t, baseURL) {
return
}
client := kernel.NewClient(
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
)
_, err := client.Invocations.ListBrowsers(context.TODO(), "id")
if err != nil {
var apierr *kernel.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
t.Fatalf("err should be nil: %s", err.Error())
}
}