Support vault webmcp_invoke in manage_vault_items - #232
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
masnwilliams
left a comment
There was a problem hiding this comment.
non-blocking. the safety-critical parts look right: strict input validation (rejecting stray value-carrying keys is a good call), no retries on unknown outcomes, guidance gated on advertisement, and good test coverage. comments below are mostly small cleanups worth doing here, plus one structural follow-up.
worth fixing in this PR (each is small):
- two different symbols named
webmcpInvokeGuidance(aMapinvault-items.ts, a string invault-responses.ts) - the status model is encoded twice (guidance map +
isErrorinequality); fold into one table webmcpInvokeResponserebuildsparsed.datafield by field; it can return it directly- name the
+ 10preflight allowance
fine as follow-ups:
- the
invokecase now has two parallel execute paths. this predates the PR (1pw_update_access_token,1pw_fillwere already special-cased), butwebmcp_invokemakes it three. a per-operation plan ({ body, requestOptions, respond }) feeding one retrieve → advertised check → perform pipeline collapses it; i prototyped it locally andtsc+ all 859 tests pass unchanged, withvault-items.tsgoing 341 → 218 lines. probably better as its own PR since it rewrites the generic path too. - response shaping for this op could live in
vault-responses.tswith the other formatters. - the top-level-key error redaction duplicates what
vaultToolInputalready does; a shared helper would keep the "never echo values" rule in one place. - webmcp outcome semantics are now restated across several tool descriptions plus get/invoke guidance; there's already small drift vs the
webmcptool (see inline). not asking to trim descriptions here, just flagging it.
masnwilliams
left a comment
There was a problem hiding this comment.
approving at 170c60e. the follow-up commit makes every change i asked for in this PR: one outcome table checked against the SDK status type, parsed.data returned directly, a named WEBMCP_PREFLIGHT_SEC, the guidance names no longer clash, and the description test is trimmed. it also adds the shared topLevelIssueKeys helper, which i'd listed as a follow-up. tsc is clean and all 859 tests pass locally.
two follow-ups remain: the single per-operation path through invoke, and the outcome-semantics drift vs the webmcp tool (outcome_unknown vs unknown, 60s vs 15s default). both are fine as separate PRs.
summary
Adds the vault
webmcp_invokeoperation tomanage_vault_itemsinvoke. It uses the same path asfill: the item is fetched again, and the operation is sent only if the item advertises it.@onkernel/sdk0.114.0 → 0.117.0, which adds thewebmcp_invokerequest and result types.inputsstrictly before any request:browser_id,tool_ref(≤128),page_url,input(object),bindings(1–32 of{field, input_path, format?}), andtimeout_sec(1–120, default 15). The default is sent explicitly. Validation errors name only the top-level keys that failed, never values.timeout_sec + 10(the API's preflight allowance) plus the standard long-operation headroom, withmaxRetries: 0and the MCP abort signal passed through. Unknown outcomes and transport failures are never retried.result: {type, status, invocation_id?, output?, error_text?}withoutputpassed through unchanged (includingnull), plus guidance for each status.error,canceled,unknown, and unrecognized statuses setisError. The guidance saysoutput/error_textare untrusted page data and may contain the supplied values. An unrecognized response shape returns an error and nothing from the response body.get/invokeresponses add WebMCP guidance only whenwebmcp_invokeis advertised. Themanage_vault_itemsandwebmcptool descriptions, the README, anddocs/vault-payments.mdnow describe the flow: list tools → invoke withnullslots and RFC 6901 bindings.Unlike
fill, the invoked tool may submit or cause side effects. The descriptions require explicit user approval, and the invocation hint keepsrequires_user_approval: true.Vault values are not logged. The inputs carry only
nullslots. MCP analytics already drops arguments and results. Tool output goes back to the caller as the API returns it, by design.tests
bun test: 858 pass, 0 fail. Newsrc/lib/mcp/tools/vault-webmcp.test.tscovers:/emailand/password, checking the exact request body with defaulttimeout_sec: 15nulloutput andawaiting_submissionerror,canceled,unknown, and future statuses, each sent once with no retrybunx tsc --noEmitclean. Prettier is clean on changed files.format:checkalready fails on main because ofAGENTS.md.