Skip to content

Commit 23fba24

Browse files
kernel-internal[bot]claudechruffins
authored
CLI: Update SDK to dab5c0714192e701d845953f1ed95b938e49130f and add new commands/flags (#231)
This PR updates the Go SDK to dab5c0714192e701d845953f1ed95b938e49130f and adds CLI commands/flags for new SDK methods. ## SDK Update - Updated kernel-go-sdk to dab5c0714192e701d845953f1ed95b938e49130f (`v0.105.1-0.20260916183112-dab5c0714192`) ## Coverage Analysis This PR was generated by performing a full enumeration of SDK methods and CLI commands. The SDK delta from the previously covered commit (`04402bd`) touches only `configregistry.go`: a new `NoRecommendationCode` enum value `"target_not_evaluable"`. This is a **response** enum, not a request param, and all six `client.ConfigRegistry.*` endpoints are marked `x-cli-skip: true` in `openapi.yaml`, so it needs no CLI surface. A full re-enumeration was still performed on top of that: - **Methods:** all 165 entries in `api.md` were mapped against the CLI command tree. The 6 ConfigRegistry methods are `x-cli-skip`; the remaining 159 all have CLI commands. - **Params:** all 118 `*Params` structs were swept field-by-field against the CLI's flag set. No uncovered fields remain. Every apparent miss resolves to one of: - a **flag alias** — `--timeout` for `TimeoutSeconds`, `--kiosk` for `KioskMode`, `--fill-rate` for `FillRatePerMinute`, `--tag` for `Tags`, `--extension` for `Extensions`, `--profile-id`/`--profile-name` for `Profile`, `--proxy-id`/`--proxy-name`/`--proxy-mode` for `Proxy`, `--private-host` for `Network`, `--vault` for `Vaults`, `--bypass-host` for `BypassHosts`, `--host`/`--port`/`--username`/`--password` for `Config`, `--dest`/`--src` for `DestPath`/`SrcPath`, `--max-duration` for `MaxDurationInSeconds`, `--seq` for `LastEventID`, `--categories` for `Category`, `--user-id` for `SearchUserID`, `--header` for `Headers`, `--hold-key` for `HoldKeys`; - a **positional arg** — `kernel invoke <app> <action>` for `AppName`/`ActionName`, `browsers playwright execute` for `Code`, `browsers extensions upload` for `Extensions`, `browsers curl -d`/`-H` for `Body`/`Headers`; - a **union subcommand** — `vaults cards`/`credentials`/`wallets` for the `OfCard`/`OfCredential`/`OfWallet` variants, `vaults items invoke` for the `OfAuthorize`/`OfCollect`/`OfPrepareCheckout`/`OfFill` operations; - a **flattened request struct** — `CreateProjectRequest`, `ManagedAuthCreateRequest`, `UpdateOrgLimitsRequest` etc., whose inner fields are already exposed as flags. No new commands or flags were required for this bump. ## Commands and Flags Added Earlier on This Branch This is an evergreen branch; the following landed in earlier commits and are still part of the PR. ### New Commands - `kernel browsers repl <id> [code]` for `client.Browsers.Repl()` — executes JavaScript in the browser VM's persistent Node.js REPL. Code may be passed as an argument or piped via stdin. Ordered REPL output is rendered in place: `write`/`stdout` text goes to stdout, `stderr` text to stderr, and emitted images are saved or summarized. Errors, stacks, output truncation, and REPL termination are reported. ### New Flags - `--reset` for `BrowserReplRequestParam.Reset` - `--timeout-sec` for `BrowserReplRequestParam.TimeoutSec` - `--image-dir` (CLI-side) to save images emitted by `repl.emitImage(...)` - `-o json` / `--json` for the raw `BrowserReplResult` ## Testing - `go build ./...`, `go vet ./...` and `go test ./...` all clean against the new SDK. - Smoke tested against the live API: `kernel browsers list`, `kernel proxies list`, `kernel profiles list` — all returned correctly formatted output. - Earlier commits' `browsers repl` testing (REPL persistence, `--reset`, `--timeout-sec`, `--image-dir`, stdout/stderr routing, `-o json`, error paths) remains covered by `cmd/browsers_test.go`. Triggered by: kernel/kernel-go-sdk@dab5c07 Reviewer: @kernel-internal[bot] 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes managed-auth submit binding and telemetry wire shapes across several commands, and adds unrestricted in-browser REPL execution—high operational impact if misused, though behavior is explicit and tested. > > **Overview** > Expands the CLI to match the updated SDK: **persistent browser REPL** (`kernel browsers repl`), **managed-auth canonical submit** with `--interaction-id` (auto-resolved from the connection when omitted), richer field display (`input_mode`, `reason`), and **`--telemetry-cdp-exclude`** plus the **`platform`** telemetry category across browsers, pools, and auth connections. > > **Browsers & pools:** `browsers update` gains **`--start-url`** (best-effort navigation); session **get** shows attached **vaults** and **usage status** on deleted sessions. **WebMCP invoke** treats `awaiting_submission` as success with guidance instead of failing. > > **Ops & limits:** Failed **`kernel invoke`** prints API **`status_reason`** before raw output. **Org limits/entitlements** surface **vault** caps and usage. **OTLP destinations** list/detail include **delivery health** (consecutive failures vs retained last error). > > **Docs:** README and vault invoke help cover multi-PSP **`prepare_checkout`**, **`collect`**, and REPL usage; proxy create docs clarify **ISP country** support. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit ea2c052. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: kernel-internal[bot] <260533166+kernel-internal[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> Co-authored-by: kernel-internal[bot] <kernel-internal[bot]@users.noreply.github.com> Co-authored-by: chruffins <23645059+chruffins@users.noreply.github.com>
1 parent 2242ce5 commit 23fba24

24 files changed

Lines changed: 1617 additions & 275 deletions

‎README.md‎

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ cannot switch projects.
335335
| `kernel vaults cards update <vault> <key> --provider link\|agentcard --spec '<json>'` | Update a card spec; pending issuance preserves omitted optional fields, and the API enforces state/provider constraints |
336336
| `kernel vaults items list <vault>` | List item keys, types, providers, status, and required actions |
337337
| `kernel vaults items get <vault> <key>` | Inspect state/actions/returned aliases and copyable operation commands; `--wait 0..60`, `--expand payment_methods`, `--open` |
338-
| `kernel vaults items invoke <vault> <key> <operation>` | GET the item, then POST an advertised operation; `authorize --open` opens a returned HTTPS action; `fill --params '<json>'` fills checkout fields |
338+
| `kernel vaults items invoke <vault> <key> <operation>` | GET the item, then POST an advertised operation; `authorize --open` opens a returned HTTPS action; `prepare_checkout --params '<json>'` prepares an unused AgentCard card for Square Pay; `fill --params '<json>'` fills checkout or login fields; `collect --open` opens a credential item's hosted form |
339339
| `kernel vaults items events <vault> <key>` | Read ordered audit events; `--after <event-id>`, `--wait 0..60` |
340340
| `kernel vaults items delete <vault> <key>` | Invalidate an item; `--yes` skips confirmation |
341341

@@ -549,13 +549,20 @@ kernel vaults items get user-123 order-1 --wait 60 -o json
549549

550550
`--spec-file <path|->` accepts the same JSON. `browser_id` is the active session with
551551
this vault attached. `merchant_origin` is the canonical HTTPS origin of the top-level
552-
merchant document, not the Square iframe; HTTP localhost is allowed for tests.
553-
`environment` is `production` or `sandbox` and refers to Square, not the credential mode.
552+
merchant document, not a processor iframe; HTTP localhost is allowed for tests.
553+
554+
Optional `psp` selects the tokenization processor: `square`, `braintree`, `worldpay`,
555+
`bambora`, or `mercado_pago`. Omit it for Square; non-Square processors require
556+
multi-processor preparation enablement. `environment` is `production`, `sandbox`, or
557+
`shared`: use `production` or `sandbox` for Square, Braintree and Worldpay, and `shared`
558+
for Bambora and Mercado Pago. Shared endpoints do not establish test mode; merchant
559+
credentials and configuration determine processor test mode, independently of the
560+
AgentCard credential mode.
554561

555562
Keep the approval page open. Poll until the item's status is `ready_to_submit`, then
556563
submit native Pay before `state.preparation.expires_at`. Readiness lasts at most 30
557564
seconds, and polling does not extend it. The CLI displays the preparation ID, status,
558-
browser, origin, environment, approval URL, and submission deadline.
565+
browser, origin, environment, processor, approval URL, and submission deadline.
559566

560567
Each preparation is single-use, including after failure or expiry. A preparation
561568
marked `consumed` has been claimed; it does not prove the payment settled or succeeded.
@@ -868,6 +875,18 @@ Destinations are the OTLP/HTTP endpoints sessions export to, managed per project
868875
- `--timeout <seconds>` - Maximum execution time in seconds (defaults server-side)
869876
- If `[code]` is omitted, code is read from stdin
870877

878+
### Browser REPL
879+
880+
- `kernel browsers repl <id> [code]` - Execute JavaScript in the browser's persistent REPL
881+
- `--reset` - Terminate the current REPL and start a fresh one before evaluating code
882+
- `--timeout-sec <seconds>` - Maximum execution time in seconds (default 60)
883+
- `--image-dir <path>` - Directory to save images emitted by `repl.emitImage(...)`
884+
- `--json`, `--output json`, `-o json` - Output the raw response
885+
- If `[code]` is omitted, code is read from stdin (`--reset` may be used with no code)
886+
- Top-level bindings persist across calls until the REPL is reset or terminated. Start with `repl.help()` to list the available methods
887+
- Expression values are ignored; emit output with `repl.write(...)`, console methods, or `repl.emitImage(...)`
888+
- A timeout, crash, or protocol failure terminates the REPL and changes its REPL ID, discarding top-level bindings. This is unrestricted code execution inside the browser VM and is not sandboxed
889+
871890
### Browser WebMCP
872891

873892
- `kernel browsers webmcp list <id-or-name>` - Discover native page tools across all browser tabs and embedded frames
@@ -1007,6 +1026,7 @@ Managed auth connections (`kernel auth connections`). The commands below are new
10071026
- `kernel auth connections submit <id>` - New flags:
10081027
- `--field-value <id=value>` - Canonical field-id=value pair from the connection's `fields` list (repeatable); preferred over the legacy `--field`
10091028
- `--choice-id <id>` - Canonical choice ID from the connection's `choices` list
1029+
- `--interaction-id <id>` - Canonical interaction the submitted values answer. Only valid with `--field-value` or `--choice-id`; omit it and the CLI reads the connection's current interaction ID for you. Pass it to pin the submission, so the API rejects it if the flow has already moved on.
10101030

10111031
`kernel auth connections get` and `follow` list those IDs alongside the metadata the API captured for them, so you can tell the options apart before submitting. Fields show their type, ref, and any hint (which names the masked destination a one-time code was sent to); choices show their type, semantic MFA method (`sms`, `totp`, `push`, …), and masked destination.
10121032

@@ -1303,6 +1323,29 @@ return { opsPerSec, ops, durationMs };
13031323
TS
13041324
```
13051325

1326+
### Persistent REPL
1327+
1328+
```bash
1329+
# List the methods the REPL exposes
1330+
kernel browsers repl my-browser 'repl.help()'
1331+
1332+
# Define state once, then reuse it in a later call
1333+
kernel browsers repl my-browser 'globalThis.visits = 0; await page.goto("https://example.com")'
1334+
kernel browsers repl my-browser 'visits++; repl.write(`visits: ${visits}`)'
1335+
1336+
# Or pipe code from stdin
1337+
cat <<'JS' | kernel browsers repl my-browser
1338+
const { chromium } = await import("patchright");
1339+
repl.write(await page.title());
1340+
JS
1341+
1342+
# Start a fresh REPL, discarding top-level bindings
1343+
kernel browsers repl my-browser --reset
1344+
1345+
# Raise the execution timeout and save emitted images
1346+
kernel browsers repl my-browser --timeout-sec 120 --image-dir ./repl-images 'await repl.emitImage(await page.screenshot())'
1347+
```
1348+
13061349
### Extension management
13071350

13081351
```bash

0 commit comments

Comments
 (0)