Skip to content

Commit 440c557

Browse files
author
Cursor Agent
committed
CLI: Update SDK to v0.30.0 and add new flags
- Update kernel-go-sdk from v0.29.0 to v0.30.0 - Add --status flag for browser list (active, deleted, all) - Add --async-timeout flag for invoke command SDK bump triggered by: kernel/kernel-go-sdk@6ca29d2
1 parent a6ea28d commit 440c557

4 files changed

Lines changed: 29 additions & 7 deletions

File tree

cmd/browsers.go

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ type BrowsersCmd struct {
223223
type BrowsersListInput struct {
224224
Output string
225225
IncludeDeleted bool
226+
Status string
226227
Limit int
227228
Offset int
228229
}
@@ -233,7 +234,19 @@ func (b BrowsersCmd) List(ctx context.Context, in BrowsersListInput) error {
233234
}
234235

235236
params := kernel.BrowserListParams{}
236-
if in.IncludeDeleted {
237+
// Use new Status parameter if provided, otherwise fall back to deprecated IncludeDeleted
238+
if in.Status != "" {
239+
switch in.Status {
240+
case "active":
241+
params.Status = kernel.BrowserListParamsStatusActive
242+
case "deleted":
243+
params.Status = kernel.BrowserListParamsStatusDeleted
244+
case "all":
245+
params.Status = kernel.BrowserListParamsStatusAll
246+
default:
247+
return fmt.Errorf("invalid --status value: %s (must be 'active', 'deleted', or 'all')", in.Status)
248+
}
249+
} else if in.IncludeDeleted {
237250
params.IncludeDeleted = kernel.Opt(true)
238251
}
239252
if in.Limit > 0 {
@@ -264,7 +277,8 @@ func (b BrowsersCmd) List(ctx context.Context, in BrowsersListInput) error {
264277

265278
// Prepare table data
266279
headers := []string{"Browser ID", "Created At", "Persistent ID", "Profile", "CDP WS URL", "Live View URL"}
267-
if in.IncludeDeleted {
280+
showDeletedAt := in.IncludeDeleted || in.Status == "deleted" || in.Status == "all"
281+
if showDeletedAt {
268282
headers = append(headers, "Deleted At")
269283
}
270284
tableData := pterm.TableData{headers}
@@ -291,7 +305,7 @@ func (b BrowsersCmd) List(ctx context.Context, in BrowsersListInput) error {
291305
truncateURL(browser.BrowserLiveViewURL, 50),
292306
}
293307

294-
if in.IncludeDeleted {
308+
if showDeletedAt {
295309
deletedAt := "-"
296310
if !browser.DeletedAt.IsZero() {
297311
deletedAt = util.FormatLocal(browser.DeletedAt)
@@ -2054,7 +2068,8 @@ Note: Profiles can only be loaded into sessions that don't already have a profil
20542068
func init() {
20552069
// list flags
20562070
browsersListCmd.Flags().StringP("output", "o", "", "Output format: json for raw API response")
2057-
browsersListCmd.Flags().Bool("include-deleted", false, "Include soft-deleted browser sessions in the results")
2071+
browsersListCmd.Flags().Bool("include-deleted", false, "DEPRECATED: Use --status instead. Include soft-deleted browser sessions in the results")
2072+
browsersListCmd.Flags().String("status", "", "Filter by status: 'active' (default), 'deleted', or 'all'")
20582073
browsersListCmd.Flags().Int("limit", 0, "Maximum number of results to return (default 20, max 100)")
20592074
browsersListCmd.Flags().Int("offset", 0, "Number of results to skip (for pagination)")
20602075

@@ -2323,11 +2338,13 @@ func runBrowsersList(cmd *cobra.Command, args []string) error {
23232338
b := BrowsersCmd{browsers: &svc}
23242339
out, _ := cmd.Flags().GetString("output")
23252340
includeDeleted, _ := cmd.Flags().GetBool("include-deleted")
2341+
status, _ := cmd.Flags().GetString("status")
23262342
limit, _ := cmd.Flags().GetInt("limit")
23272343
offset, _ := cmd.Flags().GetInt("offset")
23282344
return b.List(cmd.Context(), BrowsersListInput{
23292345
Output: out,
23302346
IncludeDeleted: includeDeleted,
2347+
Status: status,
23312348
Limit: limit,
23322349
Offset: offset,
23332350
})

cmd/invoke.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ func init() {
4040
invokeCmd.Flags().StringP("payload", "p", "", "JSON payload for the invocation (optional)")
4141
invokeCmd.Flags().StringP("payload-file", "f", "", "Path to a JSON file containing the payload (use '-' for stdin)")
4242
invokeCmd.Flags().BoolP("sync", "s", false, "Invoke synchronously (default false). A synchronous invocation will open a long-lived HTTP POST to the Kernel API to wait for the invocation to complete. This will time out after 60 seconds, so only use this option if you expect your invocation to complete in less than 60 seconds. The default is to invoke asynchronously, in which case the CLI will open an SSE connection to the Kernel API after submitting the invocation and wait for the invocation to complete.")
43+
invokeCmd.Flags().Int64("async-timeout", 0, "Timeout in seconds for async invocations (min 10, max 3600). Only applies when async mode is used.")
4344
invokeCmd.Flags().StringP("output", "o", "", "Output format: json for JSONL streaming output")
4445
invokeCmd.MarkFlagsMutuallyExclusive("payload", "payload-file")
4546

@@ -70,12 +71,16 @@ func runInvoke(cmd *cobra.Command, args []string) error {
7071
return fmt.Errorf("version cannot be an empty string")
7172
}
7273
isSync, _ := cmd.Flags().GetBool("sync")
74+
asyncTimeout, _ := cmd.Flags().GetInt64("async-timeout")
7375
params := kernel.InvocationNewParams{
7476
AppName: appName,
7577
ActionName: actionName,
7678
Version: version,
7779
Async: kernel.Opt(!isSync),
7880
}
81+
if asyncTimeout > 0 {
82+
params.AsyncTimeoutSeconds = kernel.Opt(asyncTimeout)
83+
}
7984

8085
payloadStr, hasPayload, err := getPayload(cmd)
8186
if err != nil {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ require (
99
github.com/charmbracelet/lipgloss/v2 v2.0.0-beta.1
1010
github.com/golang-jwt/jwt/v5 v5.2.2
1111
github.com/joho/godotenv v1.5.1
12-
github.com/kernel/kernel-go-sdk v0.29.0
12+
github.com/kernel/kernel-go-sdk v0.30.0
1313
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c
1414
github.com/pquerna/otp v1.5.0
1515
github.com/pterm/pterm v0.12.80

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2
6666
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
6767
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
6868
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
69-
github.com/kernel/kernel-go-sdk v0.29.0 h1:YExAB/fvwTV05pwYCf+BhvSWXRYgETAJH4pH7T8IdzE=
70-
github.com/kernel/kernel-go-sdk v0.29.0/go.mod h1:EeZzSuHZVeHKxKCPUzxou2bovNGhXaz0RXrSqKNf1AQ=
69+
github.com/kernel/kernel-go-sdk v0.30.0 h1:FN9G84mbqqTETSBRHRTuG4rBoUVu3xRhDIaWG3AyYNI=
70+
github.com/kernel/kernel-go-sdk v0.30.0/go.mod h1:EeZzSuHZVeHKxKCPUzxou2bovNGhXaz0RXrSqKNf1AQ=
7171
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
7272
github.com/klauspost/cpuid/v2 v2.0.10/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c=
7373
github.com/klauspost/cpuid/v2 v2.0.12/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c=

0 commit comments

Comments
 (0)