From 7d2798511671e285d41943c51c3ac8ebc6a7d6d6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 30 May 2025 03:02:32 +0000 Subject: [PATCH 01/12] fix: fix error --- packages/param/encoder.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/param/encoder.go b/packages/param/encoder.go index ba1821c..be41d9f 100644 --- a/packages/param/encoder.go +++ b/packages/param/encoder.go @@ -35,7 +35,7 @@ func MarshalObject[T ParamStruct](f T, underlying any) ([]byte, error) { // MarshalWithExtras is used to marshal a struct with additional properties. // // Stability for the API of MarshalWithExtras is not guaranteed. -func MarshalWithExtras[T ParamStruct](f T, underlying any, extras map[string]any) ([]byte, error) { +func MarshalWithExtras[T ParamStruct, R any](f T, underlying any, extras map[string]R) ([]byte, error) { if f.null() { return []byte("null"), nil } else if len(extras) > 0 { @@ -44,7 +44,8 @@ func MarshalWithExtras[T ParamStruct](f T, underlying any, extras map[string]any return nil, err } for k, v := range extras { - if v == Omit { + var a any = v + if a == Omit { // Errors when handling ForceOmitted are ignored. if b, e := sjson.DeleteBytes(bytes, k); e == nil { bytes = b From 3cd5f0a92385235b53af09beaf7890c0359e8585 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 30 May 2025 12:29:59 +0000 Subject: [PATCH 02/12] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index be606c6..449c1d2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 11 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-64ccdff4ca5d73d79d89e817fe83ccfd3d529696df3e6818c3c75e586ae00801.yml openapi_spec_hash: 21c7b8757fc0cc9415cda1bc06251de6 -config_hash: b3fcacd707da56b21d31ce0baf4fb87d +config_hash: f03f4ba5576f016fbd430540e2e78804 From b373259d03befeed4d8bb93188f13b0b014eba4e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 30 May 2025 13:51:43 +0000 Subject: [PATCH 03/12] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 449c1d2..928da34 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 11 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-64ccdff4ca5d73d79d89e817fe83ccfd3d529696df3e6818c3c75e586ae00801.yml openapi_spec_hash: 21c7b8757fc0cc9415cda1bc06251de6 -config_hash: f03f4ba5576f016fbd430540e2e78804 +config_hash: 4bc202cdd2df5cd211fa97e999498052 From 23cf4e026bee0fdb4a8b0935f9477c6ee914b9a7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 30 May 2025 13:52:12 +0000 Subject: [PATCH 04/12] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 928da34..cd34424 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 11 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-64ccdff4ca5d73d79d89e817fe83ccfd3d529696df3e6818c3c75e586ae00801.yml openapi_spec_hash: 21c7b8757fc0cc9415cda1bc06251de6 -config_hash: 4bc202cdd2df5cd211fa97e999498052 +config_hash: c6bab7ac8da570a5abbcfb19db119b6b From d60d3337306d90c8c51a54c6abeece2731dd4834 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 30 May 2025 14:38:50 +0000 Subject: [PATCH 05/12] feat(api): update via SDK Studio --- .stats.yml | 4 ++-- app.go | 3 +-- appdeployment.go | 2 +- appinvocation.go | 6 +++--- browser.go | 10 +++++----- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.stats.yml b/.stats.yml index cd34424..dbb369a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 11 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-64ccdff4ca5d73d79d89e817fe83ccfd3d529696df3e6818c3c75e586ae00801.yml -openapi_spec_hash: 21c7b8757fc0cc9415cda1bc06251de6 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-1f7397b87108a992979b665f45bf0aee5b10387e8124f4768c4c7852ba0b23d7.yml +openapi_spec_hash: e5460337788e7eab0d8f05ef2f55086e config_hash: c6bab7ac8da570a5abbcfb19db119b6b diff --git a/app.go b/app.go index c3d26dc..6e6f185 100644 --- a/app.go +++ b/app.go @@ -38,8 +38,7 @@ func NewAppService(opts ...option.RequestOption) (r AppService) { return } -// List application versions for the authenticated user. Optionally filter by app -// name and/or version label. +// List applications. Optionally filter by app name and/or version label. func (r *AppService) List(ctx context.Context, query AppListParams, opts ...option.RequestOption) (res *[]AppListResponse, err error) { opts = append(r.Options[:], opts...) path := "apps" diff --git a/appdeployment.go b/appdeployment.go index c565687..373e942 100644 --- a/appdeployment.go +++ b/appdeployment.go @@ -42,7 +42,7 @@ func NewAppDeploymentService(opts ...option.RequestOption) (r AppDeploymentServi return } -// Deploy a new application +// Deploy a new application and associated actions to Kernel. func (r *AppDeploymentService) New(ctx context.Context, body AppDeploymentNewParams, opts ...option.RequestOption) (res *AppDeploymentNewResponse, err error) { opts = append(r.Options[:], opts...) path := "deploy" diff --git a/appinvocation.go b/appinvocation.go index 48e4c44..18663be 100644 --- a/appinvocation.go +++ b/appinvocation.go @@ -35,7 +35,7 @@ func NewAppInvocationService(opts ...option.RequestOption) (r AppInvocationServi return } -// Invoke an application +// Invoke an action. func (r *AppInvocationService) New(ctx context.Context, body AppInvocationNewParams, opts ...option.RequestOption) (res *AppInvocationNewResponse, err error) { opts = append(r.Options[:], opts...) path := "invocations" @@ -43,7 +43,7 @@ func (r *AppInvocationService) New(ctx context.Context, body AppInvocationNewPar return } -// Get an app invocation by id +// Get details about an invocation's status and output. func (r *AppInvocationService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *AppInvocationGetResponse, err error) { opts = append(r.Options[:], opts...) if id == "" { @@ -55,7 +55,7 @@ func (r *AppInvocationService) Get(ctx context.Context, id string, opts ...optio return } -// Update invocation status or output +// Update an invocation's status or output. func (r *AppInvocationService) Update(ctx context.Context, id string, body AppInvocationUpdateParams, opts ...option.RequestOption) (res *AppInvocationUpdateResponse, err error) { opts = append(r.Options[:], opts...) if id == "" { diff --git a/browser.go b/browser.go index c0254da..e29f5f7 100644 --- a/browser.go +++ b/browser.go @@ -36,7 +36,7 @@ func NewBrowserService(opts ...option.RequestOption) (r BrowserService) { return } -// Create Browser Session +// Create a new browser session from within an action. func (r *BrowserService) New(ctx context.Context, body BrowserNewParams, opts ...option.RequestOption) (res *BrowserNewResponse, err error) { opts = append(r.Options[:], opts...) path := "browsers" @@ -44,7 +44,7 @@ func (r *BrowserService) New(ctx context.Context, body BrowserNewParams, opts .. return } -// Get Browser Session by ID +// Get information about a browser session. func (r *BrowserService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *BrowserGetResponse, err error) { opts = append(r.Options[:], opts...) if id == "" { @@ -56,7 +56,7 @@ func (r *BrowserService) Get(ctx context.Context, id string, opts ...option.Requ return } -// List active browser sessions for the authenticated user +// List active browser sessions func (r *BrowserService) List(ctx context.Context, opts ...option.RequestOption) (res *[]BrowserListResponse, err error) { opts = append(r.Options[:], opts...) path := "browsers" @@ -64,7 +64,7 @@ func (r *BrowserService) List(ctx context.Context, opts ...option.RequestOption) return } -// Delete a persistent browser session by persistent_id query parameter. +// Delete a persistent browser session by its persistent_id. func (r *BrowserService) Delete(ctx context.Context, body BrowserDeleteParams, opts ...option.RequestOption) (err error) { opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...) @@ -73,7 +73,7 @@ func (r *BrowserService) Delete(ctx context.Context, body BrowserDeleteParams, o return } -// Delete Browser Session by ID +// Delete a browser session by ID func (r *BrowserService) DeleteByID(ctx context.Context, id string, opts ...option.RequestOption) (err error) { opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...) From fd066423a7debf83f456885811a15ae943a3701f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 30 May 2025 14:43:24 +0000 Subject: [PATCH 06/12] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index dbb369a..03ed944 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 11 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-1f7397b87108a992979b665f45bf0aee5b10387e8124f4768c4c7852ba0b23d7.yml -openapi_spec_hash: e5460337788e7eab0d8f05ef2f55086e +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-7af0ef1d19efb9231c098855b72668646401afd5e00400953aca0728f7ceadb7.yml +openapi_spec_hash: fb160fe8ee0cda0a1ce9766c8195ee68 config_hash: c6bab7ac8da570a5abbcfb19db119b6b From 67b994e8d36cd0be6679dbd11c140ab052910149 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 30 May 2025 17:24:03 +0000 Subject: [PATCH 07/12] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 03ed944..a9ddb6d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 11 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-7af0ef1d19efb9231c098855b72668646401afd5e00400953aca0728f7ceadb7.yml -openapi_spec_hash: fb160fe8ee0cda0a1ce9766c8195ee68 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-b91d95f8e40f28d0e455d749b86c4d864ac15a264dcc2c5b317f626ff605ce2c.yml +openapi_spec_hash: befc3a683593ad7d832cfa9f0db941aa config_hash: c6bab7ac8da570a5abbcfb19db119b6b From 91b50217a8a08dd06ba64e05d025386d91d586c8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 31 May 2025 04:27:23 +0000 Subject: [PATCH 08/12] chore: make go mod tidy continue on error --- scripts/bootstrap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/bootstrap b/scripts/bootstrap index 99810d3..d6ac165 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -13,4 +13,4 @@ fi echo "==> Installing Go dependencies…" -go mod tidy +go mod tidy -e From f0b66f87541f4bc109f479906c3554bffb38c26f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 3 Jun 2025 19:42:41 +0000 Subject: [PATCH 09/12] feat(api): update via SDK Studio --- .stats.yml | 4 ++-- browser.go | 3 +++ browser_test.go | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index a9ddb6d..d654666 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 11 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-b91d95f8e40f28d0e455d749b86c4d864ac15a264dcc2c5b317f626ff605ce2c.yml -openapi_spec_hash: befc3a683593ad7d832cfa9f0db941aa +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-4502c65bef0843a6ae96d23bba075433af6bab49b55b544b1522f63e7881c00c.yml +openapi_spec_hash: 3e67b77bbc8cd6155b8f66f3271f2643 config_hash: c6bab7ac8da570a5abbcfb19db119b6b diff --git a/browser.go b/browser.go index e29f5f7..4057c05 100644 --- a/browser.go +++ b/browser.go @@ -211,6 +211,9 @@ func (r *BrowserListResponse) UnmarshalJSON(data []byte) error { type BrowserNewParams struct { // action invocation ID InvocationID string `json:"invocation_id,required"` + // If true, launches the browser in stealth mode to reduce detection by anti-bot + // mechanisms. + Stealth param.Opt[bool] `json:"stealth,omitzero"` // Optional persistence configuration for the browser session. Persistence BrowserPersistenceParam `json:"persistence,omitzero"` paramObj diff --git a/browser_test.go b/browser_test.go index 8646234..91c6038 100644 --- a/browser_test.go +++ b/browser_test.go @@ -31,6 +31,7 @@ func TestBrowserNewWithOptionalParams(t *testing.T) { Persistence: kernel.BrowserPersistenceParam{ ID: "my-awesome-browser-for-user-1234", }, + Stealth: kernel.Bool(true), }) if err != nil { var apierr *kernel.Error From 51d877d1ae7584b237fdb9238e97949b832c3cc8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 4 Jun 2025 03:14:39 +0000 Subject: [PATCH 10/12] feat(client): allow overriding unions --- packages/param/encoder.go | 5 ++++- packages/param/encoder_test.go | 41 +++++++++++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/packages/param/encoder.go b/packages/param/encoder.go index be41d9f..4ecb57b 100644 --- a/packages/param/encoder.go +++ b/packages/param/encoder.go @@ -68,7 +68,7 @@ func MarshalWithExtras[T ParamStruct, R any](f T, underlying any, extras map[str // MarshalUnion uses a shimmed 'encoding/json' from Go 1.24, to support the 'omitzero' tag // // Stability for the API of MarshalUnion is not guaranteed. -func MarshalUnion[T any](variants ...any) ([]byte, error) { +func MarshalUnion[T ParamStruct](metadata T, variants ...any) ([]byte, error) { nPresent := 0 presentIdx := -1 for i, variant := range variants { @@ -78,6 +78,9 @@ func MarshalUnion[T any](variants ...any) ([]byte, error) { } } if nPresent == 0 || presentIdx == -1 { + if ovr, ok := metadata.Overrides(); ok { + return shimjson.Marshal(ovr) + } return []byte(`null`), nil } else if nPresent > 1 { return nil, &json.MarshalerError{ diff --git a/packages/param/encoder_test.go b/packages/param/encoder_test.go index ec87450..c94cfc6 100644 --- a/packages/param/encoder_test.go +++ b/packages/param/encoder_test.go @@ -218,10 +218,11 @@ func TestExtraFieldsForceOmitted(t *testing.T) { type UnionWithDates struct { OfDate param.Opt[time.Time] OfTime param.Opt[time.Time] + param.APIUnion } func (r UnionWithDates) MarshalJSON() (data []byte, err error) { - return param.MarshalUnion[UnionWithDates](param.EncodedAsDate(r.OfDate), r.OfTime) + return param.MarshalUnion(r, param.EncodedAsDate(r.OfDate), r.OfTime) } func TestUnionDateMarshal(t *testing.T) { @@ -324,3 +325,41 @@ func TestOptionalInterfaceAssignability(t *testing.T) { notOpt.implOpt() // silence the warning } + +type PrimitiveUnion struct { + OfString param.Opt[string] + OfInt param.Opt[int] + param.APIUnion +} + +func (p PrimitiveUnion) MarshalJSON() (data []byte, err error) { + return param.MarshalUnion(p, p.OfString, p.OfInt) +} + +func TestOverriddenUnion(t *testing.T) { + tests := map[string]struct { + value PrimitiveUnion + expected string + }{ + "string": { + param.Override[PrimitiveUnion](json.RawMessage(`"hello"`)), + `"hello"`, + }, + "int": { + param.Override[PrimitiveUnion](json.RawMessage(`42`)), + `42`, + }, + } + + for name, test := range tests { + t.Run(name, func(t *testing.T) { + b, err := json.Marshal(test.value) + if err != nil { + t.Fatalf("didn't expect error %v, expected %s", err, test.expected) + } + if string(b) != test.expected { + t.Fatalf("expected %s, received %s", test.expected, string(b)) + } + }) + } +} From de14358a78248e642c03bd669f9c361bf6b3c8ba Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 4 Jun 2025 04:33:25 +0000 Subject: [PATCH 11/12] fix(client): cast to raw message when converting to params --- browser.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/browser.go b/browser.go index 4057c05..bbcc1f5 100644 --- a/browser.go +++ b/browser.go @@ -4,6 +4,7 @@ package kernel import ( "context" + "encoding/json" "errors" "fmt" "net/http" @@ -110,7 +111,7 @@ func (r *BrowserPersistence) UnmarshalJSON(data []byte) error { // be used at the last possible moment before sending a request. Test for this with // BrowserPersistenceParam.Overrides() func (r BrowserPersistence) ToParam() BrowserPersistenceParam { - return param.Override[BrowserPersistenceParam](r.RawJSON()) + return param.Override[BrowserPersistenceParam](json.RawMessage(r.RawJSON())) } // Optional persistence configuration for the browser session. From 7fdbf85e048b5b1556182034cc77ee3340c9fc81 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 4 Jun 2025 04:33:49 +0000 Subject: [PATCH 12/12] release: 0.5.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 21 +++++++++++++++++++++ README.md | 2 +- internal/version.go | 2 +- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index da59f99..2aca35a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.4.0" + ".": "0.5.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index fd5ee11..ce46874 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # Changelog +## 0.5.0 (2025-06-04) + +Full Changelog: [v0.4.0...v0.5.0](https://github.com/onkernel/kernel-go-sdk/compare/v0.4.0...v0.5.0) + +### Features + +* **api:** update via SDK Studio ([f0b66f8](https://github.com/onkernel/kernel-go-sdk/commit/f0b66f87541f4bc109f479906c3554bffb38c26f)) +* **api:** update via SDK Studio ([d60d333](https://github.com/onkernel/kernel-go-sdk/commit/d60d3337306d90c8c51a54c6abeece2731dd4834)) +* **client:** allow overriding unions ([51d877d](https://github.com/onkernel/kernel-go-sdk/commit/51d877d1ae7584b237fdb9238e97949b832c3cc8)) + + +### Bug Fixes + +* **client:** cast to raw message when converting to params ([de14358](https://github.com/onkernel/kernel-go-sdk/commit/de14358a78248e642c03bd669f9c361bf6b3c8ba)) +* fix error ([7d27985](https://github.com/onkernel/kernel-go-sdk/commit/7d2798511671e285d41943c51c3ac8ebc6a7d6d6)) + + +### Chores + +* make go mod tidy continue on error ([91b5021](https://github.com/onkernel/kernel-go-sdk/commit/91b50217a8a08dd06ba64e05d025386d91d586c8)) + ## 0.4.0 (2025-05-28) Full Changelog: [v0.3.0...v0.4.0](https://github.com/onkernel/kernel-go-sdk/compare/v0.3.0...v0.4.0) diff --git a/README.md b/README.md index 2221887..0e2dd3d 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Or to pin the version: ```sh -go get -u 'github.com/onkernel/kernel-go-sdk@v0.4.0' +go get -u 'github.com/onkernel/kernel-go-sdk@v0.5.0' ``` diff --git a/internal/version.go b/internal/version.go index 5c62cac..67c4d40 100644 --- a/internal/version.go +++ b/internal/version.go @@ -2,4 +2,4 @@ package internal -const PackageVersion = "0.4.0" // x-release-please-version +const PackageVersion = "0.5.0" // x-release-please-version