From 5728674a9249baf3a515f24d5ab6533ea975f83b Mon Sep 17 00:00:00 2001 From: Sayan Samanta Date: Wed, 21 Jan 2026 17:02:42 -0800 Subject: [PATCH 1/4] vibe code --- cmd/browsers.go | 98 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 75 insertions(+), 23 deletions(-) diff --git a/cmd/browsers.go b/cmd/browsers.go index 3f3291a..3342ab3 100644 --- a/cmd/browsers.go +++ b/cmd/browsers.go @@ -196,10 +196,14 @@ type BrowsersGetInput struct { } type BrowsersUpdateInput struct { - Identifier string - ProxyID string - ClearProxy bool - Output string + Identifier string + ProxyID string + ClearProxy bool + ProfileID string + ProfileName string + ProfileSaveChanges BoolFlag + Viewport string + Output string } // BrowsersCmd is a cobra-independent command handler for browsers operations. @@ -532,9 +536,9 @@ func (b BrowsersCmd) Update(ctx context.Context, in BrowsersUpdateInput) error { return fmt.Errorf("unsupported --output value: use 'json'") } - // Validate that at least one update option is provided - if in.ProxyID == "" && !in.ClearProxy { - return fmt.Errorf("must specify --proxy-id or --clear-proxy") + // Validate profile selection: at most one of profile-id or profile-name must be provided + if in.ProfileID != "" && in.ProfileName != "" { + return fmt.Errorf("must specify at most one of --profile-id or --profile-name") } // Cannot specify both --proxy-id and --clear-proxy @@ -542,22 +546,55 @@ func (b BrowsersCmd) Update(ctx context.Context, in BrowsersUpdateInput) error { return fmt.Errorf("cannot specify both --proxy-id and --clear-proxy") } + hasProxyChange := in.ProxyID != "" || in.ClearProxy + hasProfileChange := in.ProfileID != "" || in.ProfileName != "" + hasViewportChange := in.Viewport != "" + + // Validate that at least one update option is provided + if !hasProxyChange && !hasProfileChange && !hasViewportChange { + return fmt.Errorf("must specify at least one of: --proxy-id, --clear-proxy, --profile-id, --profile-name, or --viewport") + } + params := kernel.BrowserUpdateParams{} + + // Handle proxy changes if in.ClearProxy { - // Set to empty string to remove proxy params.ProxyID = kernel.Opt("") } else if in.ProxyID != "" { params.ProxyID = kernel.Opt(in.ProxyID) } - if in.Output != "json" { - if in.ClearProxy { - pterm.Info.Printf("Removing proxy from browser %s...\n", in.Identifier) - } else { - pterm.Info.Printf("Updating browser %s with proxy %s...\n", in.Identifier, in.ProxyID) + // Handle profile changes + if hasProfileChange { + params.Profile = shared.BrowserProfileParam{ + SaveChanges: kernel.Opt(in.ProfileSaveChanges.Value), + } + if in.ProfileID != "" { + params.Profile.ID = kernel.Opt(in.ProfileID) + } else if in.ProfileName != "" { + params.Profile.Name = kernel.Opt(in.ProfileName) } } + // Handle viewport changes + if hasViewportChange { + width, height, refreshRate, err := parseViewport(in.Viewport) + if err != nil { + return fmt.Errorf("invalid viewport format: %v", err) + } + params.Viewport = shared.BrowserViewportParam{ + Width: width, + Height: height, + } + if refreshRate > 0 { + params.Viewport.RefreshRate = kernel.Opt(refreshRate) + } + } + + if in.Output != "json" { + pterm.Info.Printf("Updating browser %s...\n", in.Identifier) + } + browser, err := b.browsers.Update(ctx, in.Identifier, params) if err != nil { return util.CleanedUpSdkError{Err: err} @@ -567,11 +604,7 @@ func (b BrowsersCmd) Update(ctx context.Context, in BrowsersUpdateInput) error { return util.PrintPrettyJSON(browser) } - if in.ClearProxy { - pterm.Success.Printf("Removed proxy from browser %s\n", browser.SessionID) - } else { - pterm.Success.Printf("Updated browser %s with proxy %s\n", browser.SessionID, browser.ProxyID) - } + pterm.Success.Printf("Updated browser %s\n", browser.SessionID) return nil } @@ -1990,7 +2023,14 @@ var browsersGetCmd = &cobra.Command{ var browsersUpdateCmd = &cobra.Command{ Use: "update ", Short: "Update a browser session", - Long: "Update a running browser session. Currently supports changing or removing the proxy.", + Long: `Update a running browser session. + +Supported operations: + - Change or remove proxy (--proxy-id or --clear-proxy) + - Load a profile into a session that doesn't have one (--profile-id or --profile-name) + - Change viewport dimensions (--viewport) + +Note: Profiles can only be loaded into sessions that don't already have a profile.`, Args: func(cmd *cobra.Command, args []string) error { if len(args) == 0 { return fmt.Errorf("missing required argument: browser ID\n\nUsage: kernel browsers update [flags]") @@ -2020,6 +2060,10 @@ func init() { browsersUpdateCmd.Flags().StringP("output", "o", "", "Output format: json for raw API response") browsersUpdateCmd.Flags().String("proxy-id", "", "ID of the proxy to use for the browser session") browsersUpdateCmd.Flags().Bool("clear-proxy", false, "Remove the proxy from the browser session") + browsersUpdateCmd.Flags().String("profile-id", "", "Profile ID to load into the browser session (mutually exclusive with --profile-name)") + browsersUpdateCmd.Flags().String("profile-name", "", "Profile name to load into the browser session (mutually exclusive with --profile-id)") + browsersUpdateCmd.Flags().Bool("save-changes", false, "If set, save changes back to the profile when the session ends") + browsersUpdateCmd.Flags().String("viewport", "", "Browser viewport size (e.g., 1920x1080@25). Supported: 2560x1440@10, 1920x1080@25, 1920x1200@25, 1440x900@25, 1024x768@60, 1200x800@60") browsersCmd.AddCommand(browsersListCmd) browsersCmd.AddCommand(browsersCreateCmd) @@ -2457,14 +2501,22 @@ func runBrowsersUpdate(cmd *cobra.Command, args []string) error { out, _ := cmd.Flags().GetString("output") proxyID, _ := cmd.Flags().GetString("proxy-id") clearProxy, _ := cmd.Flags().GetBool("clear-proxy") + profileID, _ := cmd.Flags().GetString("profile-id") + profileName, _ := cmd.Flags().GetString("profile-name") + saveChanges, _ := cmd.Flags().GetBool("save-changes") + viewport, _ := cmd.Flags().GetString("viewport") svc := client.Browsers b := BrowsersCmd{browsers: &svc} return b.Update(cmd.Context(), BrowsersUpdateInput{ - Identifier: args[0], - ProxyID: proxyID, - ClearProxy: clearProxy, - Output: out, + Identifier: args[0], + ProxyID: proxyID, + ClearProxy: clearProxy, + ProfileID: profileID, + ProfileName: profileName, + ProfileSaveChanges: BoolFlag{Set: cmd.Flags().Changed("save-changes"), Value: saveChanges}, + Viewport: viewport, + Output: out, }) } From 64c1ae3f1f9c2a920a459bb2c330e4d793e8bcff Mon Sep 17 00:00:00 2001 From: Sayan Samanta Date: Wed, 21 Jan 2026 17:02:54 -0800 Subject: [PATCH 2/4] update org --- scripts/go-mod-replace-kernel.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/go-mod-replace-kernel.sh b/scripts/go-mod-replace-kernel.sh index c671cdd..2b319f3 100755 --- a/scripts/go-mod-replace-kernel.sh +++ b/scripts/go-mod-replace-kernel.sh @@ -62,8 +62,8 @@ fi # Remove any existing replace directive for the SDK (ignore error if it doesn't exist) # Then add the new replace directive pointing at the desired commit -go mod edit -dropreplace=github.com/onkernel/kernel-go-sdk 2>/dev/null || true -go mod edit -replace=github.com/onkernel/kernel-go-sdk=github.com/stainless-sdks/kernel-go@"$gomod_version" +go mod edit -dropreplace=github.com/kernel/kernel-go-sdk 2>/dev/null || true +go mod edit -replace=github.com/kernel/kernel-go-sdk=github.com/stainless-sdks/kernel-go@"$gomod_version" go mod tidy echo "go.mod updated to use github.com/stainless-sdks/kernel-go @ $gomod_version" From f8e506a8748efb4963ba2fd0b4c057f36d32026d Mon Sep 17 00:00:00 2001 From: Sayan Samanta Date: Thu, 22 Jan 2026 13:32:01 -0800 Subject: [PATCH 3/4] good bot --- cmd/browsers.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/browsers.go b/cmd/browsers.go index 3342ab3..84cdec5 100644 --- a/cmd/browsers.go +++ b/cmd/browsers.go @@ -550,6 +550,11 @@ func (b BrowsersCmd) Update(ctx context.Context, in BrowsersUpdateInput) error { hasProfileChange := in.ProfileID != "" || in.ProfileName != "" hasViewportChange := in.Viewport != "" + // Validate --save-changes is only used with a profile + if in.ProfileSaveChanges.Set && !hasProfileChange { + return fmt.Errorf("--save-changes requires --profile-id or --profile-name") + } + // Validate that at least one update option is provided if !hasProxyChange && !hasProfileChange && !hasViewportChange { return fmt.Errorf("must specify at least one of: --proxy-id, --clear-proxy, --profile-id, --profile-name, or --viewport") From f9eb2bce0f5ac1d251b0abe650f203411f673785 Mon Sep 17 00:00:00 2001 From: Sayan Samanta Date: Thu, 22 Jan 2026 13:58:15 -0800 Subject: [PATCH 4/4] good bot --- cmd/browsers.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/browsers.go b/cmd/browsers.go index 84cdec5..7555d91 100644 --- a/cmd/browsers.go +++ b/cmd/browsers.go @@ -571,14 +571,15 @@ func (b BrowsersCmd) Update(ctx context.Context, in BrowsersUpdateInput) error { // Handle profile changes if hasProfileChange { - params.Profile = shared.BrowserProfileParam{ - SaveChanges: kernel.Opt(in.ProfileSaveChanges.Value), - } + params.Profile = shared.BrowserProfileParam{} if in.ProfileID != "" { params.Profile.ID = kernel.Opt(in.ProfileID) } else if in.ProfileName != "" { params.Profile.Name = kernel.Opt(in.ProfileName) } + if in.ProfileSaveChanges.Set { + params.Profile.SaveChanges = kernel.Opt(in.ProfileSaveChanges.Value) + } } // Handle viewport changes