You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 4aff0a9
Browse filesBrowse the repository at this point in the historyBrowse files
## Summary
Adds CLI support for the vault `webmcp_invoke` operation, which invokes
a live WebMCP tool with values from a credential item or ready Link card
substituted into null input slots.
- Bumps `github.com/kernel/kernel-go-sdk` from v0.116.0 to v0.117.0,
which adds `WebmcpInvokeVaultItemOperationRequestParam` and the
`webmcp_invoke` result.
- New flag-based command:
```sh
kernel vaults items webmcp invoke <vault> <key> \
--browser-id <session-id> --tool-ref <tool-ref> --page-url
<source.page_url> \
--input '{"email":null,"password":null}' \
--bind email=/email --bind password=/password [--timeout-sec 1..120] [-o
json]
```
`--input-file <path|->` replaces `--input`. Card expiration uses `--bind
expiration:MM/YY=/pointer`.
- `kernel vaults items invoke <vault> <key> webmcp_invoke
--params/--spec-file` accepts the same request as JSON (`browser_id`,
`tool_ref`, `page_url`, `input`, `bindings[{field,input_path,format?}]`,
`timeout_sec`). Both forms go through the same `Invoke` path: the item
is fetched first, and the operation must appear in
`available_operations`. Before this change, an advertised
`webmcp_invoke` fell through to the parameterless-operation branch.
- Local validation runs before any request and never echoes payloads. It
mirrors the API's binding rules: 1-32 bindings; unique fields and paths;
each `input_path` is an RFC 6901 pointer to an existing `null` (no root,
no `-` append, canonical in-range indices, valid `~0`/`~1` escapes). It
also checks: input is a JSON object of at most 64 KiB; `tool_ref` is
non-empty and at most 128 bytes; `page_url` is absolute with no
fragment; `timeout_sec` is 1-120. Top-level input members are sent as
raw JSON so numbers are not re-encoded. The SDK encodes `json.Number` as
a string, which would change them.
- Output: `-o json` prints `type`, `status`, `invocation_id`, `output`
(raw JSON preserved) and `error_text` as returned. Human output labels
`output`/`error_text` as untrusted page data that may contain supplied
values. Both are JSON-encoded so page-supplied terminal control
characters are escaped.
- Outcomes follow existing fill/1pw_fill conventions:
- `completed` and `awaiting_submission` exit 0. `awaiting_submission`
directs the user to submit the populated form instead of re-invoking,
matching `browsers webmcp invoke`.
- `canceled`, `error` and `unknown` exit nonzero with no extra
diagnostic; the JSON result stays on stdout.
- Requests use `WithMaxRetries(0)`.
- 400/403/404/409 errors keep the recognized code plus guidance, and
state that the tool was not invoked.
- 5xx errors, transport loss, and malformed results report that the tool
may have run, and say not to retry.
- Help text (`vaults`, `items`, `items invoke`, `items webmcp invoke`)
and README updated. Existing fill semantics are unchanged.
## Tests
`make test` (go vet + go test ./...) passes. New
`cmd/vaults_webmcp_test.go` covers:
- synthetic Resy login (`email`/`password` null slots) through both the
flag command and `items invoke ... webmcp_invoke --spec-file`, asserting
the exact request body and the JSON result, including a large integer
preserved in output
- card expiration format, nested/array/escaped pointers, and
large-number preservation in input
- 35 validation cases that make no HTTP request and don't leak payloads
- each result status in JSON and human modes, including exit codes and
escaping of control characters in `error_text`
- 400/403/409/500/502 and malformed responses, each sent exactly once
(no retry), with correct invoked-vs-uncertain guidance
- an unadvertised operation and item lookup failure, neither of which
POSTs
Not run against the live API.
---------
Co-authored-by: rgarcia <72655+rgarcia@users.noreply.github.com>
Copy file name to clipboardExpand all lines: README.md
+46Lines changed: 46 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -348,6 +348,11 @@ bearer credential: share it only with that user. Readiness means required values
348
348
populated, not that login succeeded. `fill` requires an already-open page and never
349
349
navigates or submits it. Optional `page_url` selects the exact page; cards require it.
350
350
Do not automatically retry failed/unknown fills or fall back to aliases.
351
+
Once ready, use `fill` for ordinary web forms. When the item advertises `webmcp_invoke`, use
352
+
`items webmcp invoke` instead to bind credential fields to existing `null` inputs of a live
353
+
WebMCP tool; the tool may submit or have other side effects, so never retry an uncertain
354
+
outcome (see [Invoke WebMCP tools with vault fields](#invoke-webmcp-tools-with-vault-fields)).
355
+
1Password credentials use their own advertised `1pw_*` operations instead.
351
356
352
357
Create specs list `fields` as an ordered array. Each entry carries a stable `name`
353
358
(letters, digits, and underscores, starting with a letter) that keys values, updates,
@@ -399,6 +404,7 @@ cannot switch projects.
399
404
|`kernel vaults items list <vault>`| List item keys, types, providers, status, and required actions |
400
405
|`kernel vaults items get <vault> <key>`| Inspect state/actions/returned AgentCard aliases and copyable operation commands; `--wait 0..60`, `--expand payment_methods`, `--open`|
401
406
|`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 |
407
+
|`kernel vaults items webmcp invoke <vault> <key>`| Invoke a live WebMCP tool with item fields bound to null input slots; `--browser-id`, `--tool-ref`, `--page-url`, `--input`/`--input-file`, repeatable `--bind <field>=<json-pointer>`, `--timeout-sec 1..120`. Same as `items invoke <vault> <key> webmcp_invoke --params '<json>'`|
constwebMCPAwaitingSubmissionHint="Inspect the form and obtain any required confirmation, then submit it with 'kernel browsers playwright execute' or 'kernel browsers computer' rather than invoking the tool again."
// A populated form is a result, not a failure. Re-invoking would refill the
96
98
// same fields, so point the caller at submitting the form they already have.
97
-
pterm.Warning.Printfln("WebMCP invocation %s: awaiting_submission — populated a form without submitting it. Inspect the form and obtain any required confirmation, then submit it with 'kernel browsers playwright execute' or 'kernel browsers computer' rather than invoking the tool again.", res.InvocationID)
99
+
pterm.Warning.Printfln("WebMCP invocation %s: awaiting_submission — populated a form without submitting it. %s", res.InvocationID, webMCPAwaitingSubmissionHint)
1. Create a vault per end user and create a browser with --vault <id-or-name>.
64
64
2. Navigate to a sensitive form and define its fields in natural top-to-bottom order with credentials create --spec-file; that array order controls the user-facing collection form.
65
65
3. Present the returned collection URL to the user. Poll items get --wait 60 for ready.
66
-
4. Use items invoke <vault> <key> fill --spec-file with browser_id and field selectors.
66
+
4. Once ready, for ordinary web forms use items invoke <vault> <key> fill --spec-file with
67
+
browser_id and field selectors (writes fields without submitting). When the item
items:=&cobra.Command{Use: "items", Short: "Inspect readiness and collection URLs, or invoke collect/fill", Long: "Use get --wait 60 to observe readiness and get -o json for schema/version/presence.\nUse invoke collect to obtain a collection URL, or invoke fill --spec-file to fill a browser.\n1Password credentials use the advertised 1pw_* operations instead of collect/fill.\nCreate and edit credentials with vaults credentials; payment items use wallets/cards."}
135
+
items:=&cobra.Command{Use: "items", Short: "Inspect readiness and collection URLs, or invoke collect/fill/webmcp_invoke", Long: "Use get --wait 60 to observe readiness and get -o json for schema/version/presence.\nUse invoke collect to obtain a collection URL, or invoke fill --spec-file to fill a browser.\nUse webmcp invoke to call a live WebMCP tool with item fields bound to null input slots.\n1Password credentials use the advertised 1pw_* operations instead of collect/fill/webmcp_invoke.\nCreate and edit credentials with vaults credentials; payment items use wallets/cards."}
132
136
itemList:=&cobra.Command{Use: "list <vault>", Short: "List items by vault ID or name", Args: cobra.ExactArgs(1), PreRunE: vaultPreRun,
assert.Contains(t, paths, "Once ready, items invoke fill writes them into ordinary web form fields in a vault-bound browser without submitting")
58
+
assert.Contains(t, paths, "When the item advertises webmcp_invoke, items webmcp invoke instead binds credential fields to existing null inputs of a live WebMCP tool; the tool may submit or have other side effects")
59
+
assert.Contains(t, paths, "1pw_fill fills and submits through the 1Password extension")
assert.Contains(t, text, "Ordinary web forms: items invoke fill writes field values without submitting")
65
+
assert.Contains(t, text, "Live WebMCP tool: when webmcp_invoke is advertised, run browsers webmcp list, then items webmcp invoke")
66
+
assert.Contains(t, text, "Never automatically retry fill or webmcp_invoke")
67
+
assert.Contains(t, text, "approves each access request in the 1Password app")
68
+
69
+
vaults:=flat(newVaultsCommand().Long)
70
+
assert.Contains(t, vaults, "for ordinary web forms use items invoke <vault> <key> fill --spec-file")
71
+
assert.Contains(t, vaults, "When the item advertises webmcp_invoke, items webmcp invoke instead binds credential fields to existing null inputs of a live WebMCP tool (the tool may submit or have side effects)")
0 commit comments