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.18.0"
".": "0.19.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: 65
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-015c11efc34c81d4d82a937c017f5eb789ea3ca21a05b70e2ed31c069b839293.yml
openapi_spec_hash: 3dcab2044da305f376cecf4eca38caee
config_hash: 0fbdda3a736cc2748ca33371871e61b3
configured_endpoints: 66
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-86854c41729a6b26f71e26c906f665f69939f23e2d7adcc43380aee64cf6d056.yml
openapi_spec_hash: 270a40c8af29e83cbda77d3700fd456a
config_hash: 9421eb86b7f3f4b274f123279da3858e
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## 0.19.0 (2025-11-12)

Full Changelog: [v0.18.0...v0.19.0](https://github.com/onkernel/kernel-go-sdk/compare/v0.18.0...v0.19.0)

### Features

* feat hide cursor v2 ([83ccf6e](https://github.com/onkernel/kernel-go-sdk/commit/83ccf6eeaf25d7257cf6992af5b856b1c82fa8c6))
* Remove price gating on computer endpoints ([131fda4](https://github.com/onkernel/kernel-go-sdk/commit/131fda473e619b41bf8df8a0c461e5594142b474))


### Chores

* bump gjson version ([666f492](https://github.com/onkernel/kernel-go-sdk/commit/666f4924d4ec1b8ebe5e083a8df701c19ee414be))
* **internal:** grammar fix (it's -> its) ([be376e8](https://github.com/onkernel/kernel-go-sdk/commit/be376e843484cf6aee031b8ace289f166cd181e1))

## 0.18.0 (2025-10-30)

Full Changelog: [v0.17.0...v0.18.0](https://github.com/onkernel/kernel-go-sdk/compare/v0.17.0...v0.18.0)
Expand Down
4 changes: 2 additions & 2 deletions 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/onkernel/kernel-go-sdk@v0.18.0'
go get -u 'github.com/onkernel/kernel-go-sdk@v0.19.0'
```

<!-- x-release-please-end -->
Expand Down Expand Up @@ -130,7 +130,7 @@ custom := param.Override[kernel.FooParams](12)

### Request unions

Unions are represented as a struct with fields prefixed by "Of" for each of it's variants,
Unions are represented as a struct with fields prefixed by "Of" for each of its variants,
only one field can be non-zero. The non-zero field will be serialized.

Sub-properties of the union can be accessed via methods on the union struct.
Expand Down
5 changes: 5 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ Methods:

## Computer

Response Types:

- <a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#BrowserComputerSetCursorVisibilityResponse">BrowserComputerSetCursorVisibilityResponse</a>

Methods:

- <code title="post /browsers/{id}/computer/screenshot">client.Browsers.Computer.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#BrowserComputerService.CaptureScreenshot">CaptureScreenshot</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>, body <a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#BrowserComputerCaptureScreenshotParams">BrowserComputerCaptureScreenshotParams</a>) (http.Response, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
Expand All @@ -162,6 +166,7 @@ Methods:
- <code title="post /browsers/{id}/computer/move_mouse">client.Browsers.Computer.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#BrowserComputerService.MoveMouse">MoveMouse</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>, body <a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#BrowserComputerMoveMouseParams">BrowserComputerMoveMouseParams</a>) <a href="https://pkg.go.dev/builtin#error">error</a></code>
- <code title="post /browsers/{id}/computer/press_key">client.Browsers.Computer.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#BrowserComputerService.PressKey">PressKey</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>, body <a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#BrowserComputerPressKeyParams">BrowserComputerPressKeyParams</a>) <a href="https://pkg.go.dev/builtin#error">error</a></code>
- <code title="post /browsers/{id}/computer/scroll">client.Browsers.Computer.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#BrowserComputerService.Scroll">Scroll</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>, body <a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#BrowserComputerScrollParams">BrowserComputerScrollParams</a>) <a href="https://pkg.go.dev/builtin#error">error</a></code>
- <code title="post /browsers/{id}/computer/cursor">client.Browsers.Computer.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#BrowserComputerService.SetCursorVisibility">SetCursorVisibility</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>, body <a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#BrowserComputerSetCursorVisibilityParams">BrowserComputerSetCursorVisibilityParams</a>) (<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#BrowserComputerSetCursorVisibilityResponse">BrowserComputerSetCursorVisibilityResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="post /browsers/{id}/computer/type">client.Browsers.Computer.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#BrowserComputerService.TypeText">TypeText</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>, body <a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#BrowserComputerTypeTextParams">BrowserComputerTypeTextParams</a>) <a href="https://pkg.go.dev/builtin#error">error</a></code>

## Playwright
Expand Down
4 changes: 2 additions & 2 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ func (r *AppListResponse) UnmarshalJSON(data []byte) error {
type AppListParams struct {
// Filter results by application name.
AppName param.Opt[string] `query:"app_name,omitzero" json:"-"`
// Limit the number of app to return.
// Limit the number of apps to return.
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Offset the number of app to return.
// Offset the number of apps to return.
Offset param.Opt[int64] `query:"offset,omitzero" json:"-"`
// Filter results by version label.
Version param.Opt[string] `query:"version,omitzero" json:"-"`
Expand Down
45 changes: 45 additions & 0 deletions browsercomputer.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/onkernel/kernel-go-sdk/internal/requestconfig"
"github.com/onkernel/kernel-go-sdk/option"
"github.com/onkernel/kernel-go-sdk/packages/param"
"github.com/onkernel/kernel-go-sdk/packages/respjson"
)

// BrowserComputerService contains methods and other services that help with
Expand Down Expand Up @@ -112,6 +113,18 @@ func (r *BrowserComputerService) Scroll(ctx context.Context, id string, body Bro
return
}

// Set cursor visibility
func (r *BrowserComputerService) SetCursorVisibility(ctx context.Context, id string, body BrowserComputerSetCursorVisibilityParams, opts ...option.RequestOption) (res *BrowserComputerSetCursorVisibilityResponse, err error) {
opts = slices.Concat(r.Options, opts)
if id == "" {
err = errors.New("missing required id parameter")
return
}
path := fmt.Sprintf("browsers/%s/computer/cursor", id)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}

// Type text on the browser instance
func (r *BrowserComputerService) TypeText(ctx context.Context, id string, body BrowserComputerTypeTextParams, opts ...option.RequestOption) (err error) {
opts = slices.Concat(r.Options, opts)
Expand All @@ -125,6 +138,24 @@ func (r *BrowserComputerService) TypeText(ctx context.Context, id string, body B
return
}

// Generic OK response.
type BrowserComputerSetCursorVisibilityResponse struct {
// Indicates success.
Ok bool `json:"ok,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Ok respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}

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

type BrowserComputerCaptureScreenshotParams struct {
Region BrowserComputerCaptureScreenshotParamsRegion `json:"region,omitzero"`
paramObj
Expand Down Expand Up @@ -306,6 +337,20 @@ func (r *BrowserComputerScrollParams) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}

type BrowserComputerSetCursorVisibilityParams struct {
// Whether the cursor should be hidden or visible
Hidden bool `json:"hidden,required"`
paramObj
}

func (r BrowserComputerSetCursorVisibilityParams) MarshalJSON() (data []byte, err error) {
type shadow BrowserComputerSetCursorVisibilityParams
return param.MarshalObject(r, (*shadow)(&r))
}
func (r *BrowserComputerSetCursorVisibilityParams) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}

type BrowserComputerTypeTextParams struct {
// Text to type on the browser instance
Text string `json:"text,required"`
Expand Down
29 changes: 29 additions & 0 deletions browsercomputer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,35 @@ func TestBrowserComputerScrollWithOptionalParams(t *testing.T) {
}
}

func TestBrowserComputerSetCursorVisibility(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.Browsers.Computer.SetCursorVisibility(
context.TODO(),
"id",
kernel.BrowserComputerSetCursorVisibilityParams{
Hidden: true,
},
)
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())
}
}

func TestBrowserComputerTypeTextWithOptionalParams(t *testing.T) {
t.Skip("Prism tests are disabled")
baseURL := "http://localhost:4010"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/onkernel/kernel-go-sdk
go 1.22

require (
github.com/tidwall/gjson v1.14.4
github.com/tidwall/gjson v1.18.0
github.com/tidwall/sjson v1.2.5
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/gjson v1.14.4 h1:uo0p8EbA09J7RQaflQ1aBRffTR7xedD2bcIVSYxLnkM=
github.com/tidwall/gjson v1.14.4/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
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.18.0" // x-release-please-version
const PackageVersion = "0.19.0" // x-release-please-version
2 changes: 1 addition & 1 deletion packages/respjson/respjson.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package respjson
// Use [Field.Valid] to check if an optional value was null or omitted.
//
// A Field will always occur in the following structure, where it
// mirrors the original field in it's parent struct:
// mirrors the original field in its parent struct:
//
// type ExampleObject struct {
// Foo bool `json:"foo"`
Expand Down