diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 768a5b8e..af43dc96 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.123.0" + ".": "0.124.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 8734dbdb..6259fd8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## [0.124.0](https://github.com/kernel/kernel-node-sdk/compare/v0.123.0...v0.124.0) (2026-10-13) + + +### Features + +* Accept intent creation without a fixed status ([7cf9f3d](https://github.com/kernel/kernel-node-sdk/commit/7cf9f3def47e2f39f0c7c21d6067882cc0b86201)) +* Complete Visa vault verification and transaction reporting ([41d139b](https://github.com/kernel/kernel-node-sdk/commit/41d139b651d5231e6e32a0d43f6343a2c5bd34ac)) + + +### Bug Fixes + +* seal browser pool acquire SDK results ([05baf34](https://github.com/kernel/kernel-node-sdk/commit/05baf34b4a49ee7817c3f0f782fb6874fd6ab937)) + ## [0.123.0](https://github.com/kernel/kernel-node-sdk/compare/v0.122.0...v0.123.0) (2026-10-09) diff --git a/api.md b/api.md index dc9f57e2..0f9b9939 100644 --- a/api.md +++ b/api.md @@ -514,6 +514,7 @@ Types: - CardVaultItemSpec - CardVaultItemState - CollectVaultItemOperationRequest +- ConfirmTransactionVaultItemOperationRequest - CredentialAccountVaultItem - CredentialAccountVaultItemRequest - CredentialCollectionAction @@ -553,6 +554,7 @@ Types: - OnePasswordRecoverVaultItemOperationRequest - OnePasswordRequestAccessVaultItemOperationRequest - PrepareCheckoutVaultItemOperationRequest +- RestartVerificationVaultItemOperationRequest - VaultCardAliases - VaultCardFillField - VaultCheckoutContext diff --git a/package.json b/package.json index 12f3695d..30855bd6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@onkernel/sdk", - "version": "0.123.0", + "version": "0.124.0", "description": "The official TypeScript library for the Kernel API", "author": "Kernel <>", "types": "dist/index.d.ts", diff --git a/src/resources/browser-pools.ts b/src/resources/browser-pools.ts index 170665a3..5b4c1bac 100644 --- a/src/resources/browser-pools.ts +++ b/src/resources/browser-pools.ts @@ -119,7 +119,7 @@ export class BrowserPools extends APIResource { idOrName: string, body: BrowserPoolAcquireParams, options?: RequestOptions, - ): APIPromise { + ): APIPromise { return this._client.post(path`/browser_pools/${idOrName}/acquire`, { body, ...options }); } diff --git a/src/resources/browsers/playwright/playwright.ts b/src/resources/browsers/playwright/playwright.ts index 025a5bf2..79197a9a 100644 --- a/src/resources/browsers/playwright/playwright.ts +++ b/src/resources/browsers/playwright/playwright.ts @@ -53,10 +53,6 @@ export class Playwright extends APIResource { * executors are not removed automatically while the browser runs; when it shuts * down, they are removed and their tabs closed. * - * A named call to a browser whose image predates executors fails with 400 instead - * of running on the active tab; calls without 'executor' keep working on every - * image. - * * @example * ```ts * const response = await client.browsers.playwright.execute( diff --git a/src/resources/vaults/index.ts b/src/resources/vaults/index.ts index 8c888192..d5a6e930 100644 --- a/src/resources/vaults/index.ts +++ b/src/resources/vaults/index.ts @@ -9,6 +9,7 @@ export { type CardVaultItemSpec, type CardVaultItemState, type CollectVaultItemOperationRequest, + type ConfirmTransactionVaultItemOperationRequest, type CredentialAccountVaultItem, type CredentialAccountVaultItemRequest, type CredentialCollectionAction, @@ -48,6 +49,7 @@ export { type OnePasswordRecoverVaultItemOperationRequest, type OnePasswordRequestAccessVaultItemOperationRequest, type PrepareCheckoutVaultItemOperationRequest, + type RestartVerificationVaultItemOperationRequest, type VaultCardAliases, type VaultCardFillField, type VaultCheckoutContext, diff --git a/src/resources/vaults/items.ts b/src/resources/vaults/items.ts index c70f7665..3509ed99 100644 --- a/src/resources/vaults/items.ts +++ b/src/resources/vaults/items.ts @@ -600,6 +600,44 @@ export interface CollectVaultItemOperationRequest { type: 'collect'; } +/** + * Report a real merchant transaction outcome for an issued Kernel Visa credential. + * Never infer success from filling checkout or receiving a credential. Supply the + * observed status, transaction type, actual amount, currency and timestamp. + * Unknown outcomes require manual reconciliation, not retry. Each purchase accepts + * one report. + */ +export interface ConfirmTransactionVaultItemOperationRequest { + /** + * Actual transaction amount in minor units, no greater than the approved limit. + */ + amount: number; + + /** + * Must match the approved purchase currency. + */ + currency: string; + + /** + * Time the merchant outcome was observed. + */ + occurred_at: string; + + status: 'APPROVED' | 'DECLINED' | 'PENDING' | 'ERROR' | 'CANCELLED'; + + transaction_type: + | 'PURCHASE' + | 'AUTHORIZATION' + | 'CAPTURE' + | 'REFUND' + | 'REVERSAL' + | 'VERIFICATION' + | 'CHARGEBACK' + | 'FRAUD'; + + type: 'confirm_transaction'; +} + export interface CredentialAccountVaultItem { id: string; @@ -652,6 +690,8 @@ export namespace CredentialAccountVaultItem { type: | 'authorize' + | 'restart_verification' + | 'confirm_transaction' | 'collect' | 'prepare_checkout' | 'fill' @@ -960,6 +1000,8 @@ export namespace CredentialVaultItem { type: | 'authorize' + | 'restart_verification' + | 'confirm_transaction' | 'collect' | 'prepare_checkout' | 'fill' @@ -1177,12 +1219,16 @@ export interface KernelCardState { /** * pending_authorization on a Visa purchase waits for the cardholder to approve it * through the spend_approval action; an unused link expires after 30 minutes. - * recovery_required means approving the purchase or issuing the one-time code has - * an unresolved outcome. Kernel never approves again or issues another code for - * the item automatically, and the item cannot be deleted or replaced until the - * original attempt is reconciled with support. When status_reason says the - * provider refused retrieval before acceptance, no code was issued and a later - * read retries. declined means the card network refused to issue a code. + * recovery_required means verification, approving the purchase or issuing the + * one-time code has an unresolved outcome. A server-classified initial attestation + * failure before intent dispatch may advertise restart_verification to prepare a + * fresh local verification link; this does not approve spending or replay any + * provider request. Unclassified legacy recovery and uncertain intent creation + * cannot restart. Kernel never approves again or issues another code for the item + * automatically, and the item cannot be deleted or replaced until the original + * attempt is reconciled with support. When status_reason says the provider refused + * retrieval before acceptance, no code was issued and a later read retries. + * declined means the card network refused to issue a code. */ status: | 'requested' @@ -1257,6 +1303,17 @@ export interface KernelCardVaultItemSpec { */ wallet: string; + /** + * Actual merchant category when known. Omit rather than invent a category. + */ + merchant_category?: string; + + /** + * Actual merchant MCC when known. Omit rather than invent a code. 0000 is not + * accepted. + */ + merchant_category_code?: string; + /** * The merchant's ISO 3166-1 alpha-2 country code. Required for Visa cards, whose * one-time code is issued for the merchant's country. @@ -1847,6 +1904,21 @@ export interface PrepareCheckoutVaultItemOperationRequest { type: 'prepare_checkout'; } +/** + * Explicitly prepare a fresh local verification session for the same Kernel Visa + * purchase and connected wallet, only when restart_verification is advertised. + * Kernel must have durable proof of an initial attestation failure before intent + * dispatch. Replaces the spend_approval capability and discards session-bound + * verification data without calling the provider or granting spend consent. The + * cardholder must use the new link, verify again and explicitly approve the + * purchase. Unknown intent creation, legacy unclassified recovery, enrollment + * completion, issuance and confirmation cannot restart. Do not automatically retry + * this operation. + */ +export interface RestartVerificationVaultItemOperationRequest { + type: 'restart_verification'; +} + export interface VaultCardAliases { cvc: string; @@ -2059,6 +2131,8 @@ export namespace VaultItem { type: | 'authorize' + | 'restart_verification' + | 'confirm_transaction' | 'collect' | 'prepare_checkout' | 'fill' @@ -2132,6 +2206,8 @@ export namespace VaultItem { type: | 'authorize' + | 'restart_verification' + | 'confirm_transaction' | 'collect' | 'prepare_checkout' | 'fill' @@ -2281,6 +2357,8 @@ export namespace VaultItemOperationResponse { type: | 'authorize' + | 'restart_verification' + | 'confirm_transaction' | 'collect' | 'prepare_checkout' | 'fill' @@ -2354,6 +2432,8 @@ export namespace VaultItemOperationResponse { type: | 'authorize' + | 'restart_verification' + | 'confirm_transaction' | 'collect' | 'prepare_checkout' | 'fill' @@ -2739,6 +2819,8 @@ export interface ItemEventsParams { export type ItemPerformOperationParams = | ItemPerformOperationParams.AuthorizeVaultItemOperationRequest + | ItemPerformOperationParams.RestartVerificationVaultItemOperationRequest + | ItemPerformOperationParams.ConfirmTransactionVaultItemOperationRequest | ItemPerformOperationParams.CollectVaultItemOperationRequest | ItemPerformOperationParams.PrepareCheckoutVaultItemOperationRequest | ItemPerformOperationParams.FillVaultItemOperationRequest @@ -2762,6 +2844,64 @@ export declare namespace ItemPerformOperationParams { type: 'authorize'; } + export interface RestartVerificationVaultItemOperationRequest { + /** + * Path param + */ + id_or_name: string; + + /** + * Body param + */ + type: 'restart_verification'; + } + + export interface ConfirmTransactionVaultItemOperationRequest { + /** + * Path param + */ + id_or_name: string; + + /** + * Body param: Actual transaction amount in minor units, no greater than the + * approved limit. + */ + amount: number; + + /** + * Body param: Must match the approved purchase currency. + */ + currency: string; + + /** + * Body param: Time the merchant outcome was observed. + */ + occurred_at: string; + + /** + * Body param + */ + status: 'APPROVED' | 'DECLINED' | 'PENDING' | 'ERROR' | 'CANCELLED'; + + /** + * Body param + */ + transaction_type: + | 'PURCHASE' + | 'AUTHORIZATION' + | 'CAPTURE' + | 'REFUND' + | 'REVERSAL' + | 'VERIFICATION' + | 'CHARGEBACK' + | 'FRAUD'; + + /** + * Body param + */ + type: 'confirm_transaction'; + } + export interface CollectVaultItemOperationRequest { /** * Path param @@ -3233,6 +3373,7 @@ export declare namespace Items { type CardVaultItemSpec as CardVaultItemSpec, type CardVaultItemState as CardVaultItemState, type CollectVaultItemOperationRequest as CollectVaultItemOperationRequest, + type ConfirmTransactionVaultItemOperationRequest as ConfirmTransactionVaultItemOperationRequest, type CredentialAccountVaultItem as CredentialAccountVaultItem, type CredentialAccountVaultItemRequest as CredentialAccountVaultItemRequest, type CredentialCollectionAction as CredentialCollectionAction, @@ -3272,6 +3413,7 @@ export declare namespace Items { type OnePasswordRecoverVaultItemOperationRequest as OnePasswordRecoverVaultItemOperationRequest, type OnePasswordRequestAccessVaultItemOperationRequest as OnePasswordRequestAccessVaultItemOperationRequest, type PrepareCheckoutVaultItemOperationRequest as PrepareCheckoutVaultItemOperationRequest, + type RestartVerificationVaultItemOperationRequest as RestartVerificationVaultItemOperationRequest, type VaultCardAliases as VaultCardAliases, type VaultCardFillField as VaultCardFillField, type VaultCheckoutContext as VaultCheckoutContext, diff --git a/src/resources/vaults/vaults.ts b/src/resources/vaults/vaults.ts index befee853..d3ca0ca2 100644 --- a/src/resources/vaults/vaults.ts +++ b/src/resources/vaults/vaults.ts @@ -10,6 +10,7 @@ import { CardVaultItemSpec, CardVaultItemState, CollectVaultItemOperationRequest, + ConfirmTransactionVaultItemOperationRequest, CredentialAccountVaultItem, CredentialAccountVaultItemRequest, CredentialCollectionAction, @@ -58,6 +59,7 @@ import { OnePasswordRecoverVaultItemOperationRequest, OnePasswordRequestAccessVaultItemOperationRequest, PrepareCheckoutVaultItemOperationRequest, + RestartVerificationVaultItemOperationRequest, VaultCardAliases, VaultCardFillField, VaultCheckoutContext, @@ -270,6 +272,7 @@ export declare namespace Vaults { type CardVaultItemSpec as CardVaultItemSpec, type CardVaultItemState as CardVaultItemState, type CollectVaultItemOperationRequest as CollectVaultItemOperationRequest, + type ConfirmTransactionVaultItemOperationRequest as ConfirmTransactionVaultItemOperationRequest, type CredentialAccountVaultItem as CredentialAccountVaultItem, type CredentialAccountVaultItemRequest as CredentialAccountVaultItemRequest, type CredentialCollectionAction as CredentialCollectionAction, @@ -309,6 +312,7 @@ export declare namespace Vaults { type OnePasswordRecoverVaultItemOperationRequest as OnePasswordRecoverVaultItemOperationRequest, type OnePasswordRequestAccessVaultItemOperationRequest as OnePasswordRequestAccessVaultItemOperationRequest, type PrepareCheckoutVaultItemOperationRequest as PrepareCheckoutVaultItemOperationRequest, + type RestartVerificationVaultItemOperationRequest as RestartVerificationVaultItemOperationRequest, type VaultCardAliases as VaultCardAliases, type VaultCardFillField as VaultCardFillField, type VaultCheckoutContext as VaultCheckoutContext, diff --git a/src/version.ts b/src/version.ts index 197f7f0d..f8a5815b 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.123.0'; // x-release-please-version +export const VERSION = '0.124.0'; // x-release-please-version diff --git a/tests/api-resources/browser-pools-acquire.test.ts b/tests/api-resources/browser-pools-acquire.test.ts new file mode 100644 index 00000000..f06fe42e --- /dev/null +++ b/tests/api-resources/browser-pools-acquire.test.ts @@ -0,0 +1,33 @@ +import Kernel, { NotFoundError } from '@onkernel/sdk'; + +describe('browser pool acquire responses', () => { + test('returns the browser on a 200', async () => { + const client = new Kernel({ + apiKey: 'test', + fetch: async () => Response.json({ session_id: 'session-1' }), + }); + + const result = await client.browserPools.acquire('pool', {}); + + expect(result?.session_id).toBe('session-1'); + }); + + test('returns null on a 204 without retrying', async () => { + const fetch = jest.fn(async () => new Response(null, { status: 204 })); + const client = new Kernel({ apiKey: 'test', fetch }); + + const result = await client.browserPools.acquire('pool', {}); + + expect(result).toBeNull(); + expect(fetch).toHaveBeenCalledTimes(1); + }); + + test('preserves the typed 404 error', async () => { + const client = new Kernel({ + apiKey: 'test', + fetch: async () => Response.json({ code: 'not_found' }, { status: 404 }), + }); + + await expect(client.browserPools.acquire('missing', {})).rejects.toBeInstanceOf(NotFoundError); + }); +});