Repository navigation
Support Kernel wallet payment methods and payment_request items - #261
hiroTamada wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
rgarcia
left a comment
There was a problem hiding this comment.
Approving. This fixes a real gap I hit on the current MCP: with a KERNEL wallet that advertises add_payment_method, there was no way through MCP to (a) get the card_enrollment url, because paymentMethodFields and vaultOperationResultFields dropped it, or (b) create a KERNEL card, because the strict kernelCardSpecSchema rejected payment_method_id, which the API requires when the wallet has no default card. The flow had to finish through the CLI. This PR closes both.
The SDK blocker is gone. main is on @onkernel/sdk 0.141.0, so the 0.133.0 pin isn't needed. I merged current main into this branch locally (no conflicts): tsc --noEmit is clean and bun test gives 1168 pass, 0 fail. CI is only red because it last ran against 0.132.0.
To get it across the line:
- Merge or rebase
mainand push so CI reruns against 0.141.0. - Drop the "Blocked on 0.133.0" warning and the before-merge
bun addstep from the description.
Non-blocking notes:
paymentMethodFields.actionlistsexpires_at, butVaultPaymentMethod.Actionin 0.141.0 is onlyname,urlandcapture_token. Expiry is on the method itself, which you already project. It's harmless (it projects nothing); see the inline comment.destructiveHint: truenow coverscreateandpayment_methodstoo, because annotations are per tool. That's the right conservative call; mentioning it in case clients start prompting on reads.- 0.141.0 also adds
state.source(payment_method|single_use_card) on KERNEL cards. It may be worth projecting in a follow-up so agents can tell whypayment_method_idandfunding_statusare absent. Keepingsingle_use_cardout of the MCP input schema is correct, since card data should never pass through tool inputs. - I opened #270 to document that fill selectors must match exactly one element. Shopify's card iframes include hidden decoy inputs with the same
name, which returnsambiguous_selector. It touches a different string invault-items.ts, so the two PRs shouldn't conflict. - FYI, outside this repo: after a KERNEL card was filled and paid on a real Shopify checkout, the item still advertised only
fill, notconfirm_transaction. The MCP passes throughavailable_operations, so if that's unexpected it's on the API side.
| ...fields("id provider type is_default status status_reason expires_at"), | ||
| display: fields("label brand last4"), | ||
| capabilities: { single_use_card: fields("eligible reasons") }, | ||
| action: fields("name url expires_at"), |
There was a problem hiding this comment.
nit: VaultPaymentMethod.Action in 0.141.0 has no expires_at (only name, url, capture_token). Expiry is on the payment method, which line 39 already projects. fields("name url") would match the SDK type.
Warning
Blocked on the
@onkernel/sdk0.133.0 release. This code is written against the 0.133.0 types, but 0.133.0 is not published yet;package.jsonandbun.lockstill pin 0.132.0. A git pin to the release PR head does not install cleanly with bun (the SDK'spreparebuild is skipped, so the package has nodist/), so the dependency is left unchanged. Until the bump, CI's Type check fails on the new SDK types (payment_requestitems, theadd_payment_method/remove_payment_methodoperation params); tests pass on both versions. Before merge:bun add @onkernel/sdk@0.133.0, commitpackage.json+bun.lock, and re-run CI.Summary
The Kernel API now supports multiple cards per Kernel wallet and
payment_requestpurchase items, gated per organization. This updates the vault tools to match, keeping the original single-card Kernel wallet contract working for organizations without the flags.Wallets (
manage_vault_wallets)add_payment_methodandremove_payment_method(withpayment_method_id) actions. Each one fetches the wallet first and submits only if it is a Kernel wallet that advertises the operation, matching howauthorizeworks inmanage_vault_cards. The result returns the projected payment method or removal status, apayment_methodsobservation hint, and guidance.add_payment_methodreturns thecard_enrollmenturl, but the embeddedcapture_tokenis still never returned.insufficient_scope, 409purchase_unresolved/provider_revocation_pendingand 429Retry-Afterpass through.vaults:write.destructiveHintis nowtrue, because removal deletes a stored card.Cards (
manage_vault_cards)item_type(cardby default, orpayment_request) for create/update. Link and Kernel can createpayment_requestitems; AgentCard is refused locally. Updates to a payment request sendtype: payment_request; card updates still omittype.payment_method_id. If omitted, the API selects the default cardcardand never another card. A Kernelpayment_requestrequires it.authorizealso acceptspayment_requestitems.Responses and
manage_vault_itemsstatus,status_reason,expires_atandaction(name,url,expires_at, withoutcapture_token). Item state projectspayment_method_idandfunding_status. Event data projectsitem_type,providerandpayment_method_id_present.payment_methodandpayment_method_id, so invokingadd_payment_method/remove_payment_methodthroughmanage_vault_itemsrenders and gets guidance.payment_requestitems are treated like cards in guidance, invocation hints, recovery_required handling, Link authorize error mapping and theconfirm_transactionamount/currency check.remove_payment_methodhint listsrequired_inputs: ["payment_method_id"].reconnect_requiredwallets refuse payment and deletion until upgraded, per the current API description. Kernel purchase guidance explainsfunding_status.docs/vault-payments.md.Entitlements, tool names, registration, analytics and deprecated-params handling do not enumerate vault operations or item types, so they are unchanged.
Tests
Run locally with
@onkernel/sdk0.133.0 built from the release PR head and swapped intonode_modules, without committing it:bunx tsc --noEmit --incremental false: passes on 0.133.0. On the pinned 0.132.0 it fails only where the new SDK types are used.bun test: 1161 pass, 0 fail on both 0.133.0 and 0.132.0.bun run check:managed-auth-app: passes.bunx prettier --checkon changed files: passes. Repo-widebun run format:checkfails only onAGENTS.md, which this PR does not touch.git diff --check: clean.bun run lintwas not run; it is broken under Next.js 16 perAGENTS.md.Not run: no live MCP calls against the Kernel API with the flags on.