@onkernel/sdk 0.100.0 → 0.102.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/client.d.mts +3 -0
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +3 -0
  5. package/client.d.ts.map +1 -1
  6. package/client.js +3 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +3 -0
  9. package/client.mjs.map +1 -1
  10. package/lib/browser-routing.d.mts.map +1 -1
  11. package/lib/browser-routing.d.ts.map +1 -1
  12. package/lib/browser-routing.js +23 -6
  13. package/lib/browser-routing.js.map +1 -1
  14. package/lib/browser-routing.mjs +23 -6
  15. package/lib/browser-routing.mjs.map +1 -1
  16. package/package.json +1 -1
  17. package/resources/auth/connections.d.mts +6 -0
  18. package/resources/auth/connections.d.mts.map +1 -1
  19. package/resources/auth/connections.d.ts +6 -0
  20. package/resources/auth/connections.d.ts.map +1 -1
  21. package/resources/browsers/computer.d.mts +6 -2
  22. package/resources/browsers/computer.d.mts.map +1 -1
  23. package/resources/browsers/computer.d.ts +6 -2
  24. package/resources/browsers/computer.d.ts.map +1 -1
  25. package/resources/browsers/telemetry.d.mts +4 -3
  26. package/resources/browsers/telemetry.d.mts.map +1 -1
  27. package/resources/browsers/telemetry.d.ts +4 -3
  28. package/resources/browsers/telemetry.d.ts.map +1 -1
  29. package/resources/config-registry/config-registry.d.mts +58 -8
  30. package/resources/config-registry/config-registry.d.mts.map +1 -1
  31. package/resources/config-registry/config-registry.d.ts +58 -8
  32. package/resources/config-registry/config-registry.d.ts.map +1 -1
  33. package/resources/config-registry/config-registry.js.map +1 -1
  34. package/resources/config-registry/config-registry.mjs.map +1 -1
  35. package/resources/index.d.mts +1 -0
  36. package/resources/index.d.mts.map +1 -1
  37. package/resources/index.d.ts +1 -0
  38. package/resources/index.d.ts.map +1 -1
  39. package/resources/index.js +3 -1
  40. package/resources/index.js.map +1 -1
  41. package/resources/index.mjs +1 -0
  42. package/resources/index.mjs.map +1 -1
  43. package/resources/invocations.d.mts +44 -15
  44. package/resources/invocations.d.mts.map +1 -1
  45. package/resources/invocations.d.ts +44 -15
  46. package/resources/invocations.d.ts.map +1 -1
  47. package/resources/organization/entitlements.d.mts +20 -0
  48. package/resources/organization/entitlements.d.mts.map +1 -1
  49. package/resources/organization/entitlements.d.ts +20 -0
  50. package/resources/organization/entitlements.d.ts.map +1 -1
  51. package/resources/organization/limits.d.mts +10 -1
  52. package/resources/organization/limits.d.mts.map +1 -1
  53. package/resources/organization/limits.d.ts +10 -1
  54. package/resources/organization/limits.d.ts.map +1 -1
  55. package/resources/organization/limits.js +1 -1
  56. package/resources/organization/limits.mjs +1 -1
  57. package/resources/proxies.d.mts +36 -18
  58. package/resources/proxies.d.mts.map +1 -1
  59. package/resources/proxies.d.ts +36 -18
  60. package/resources/proxies.d.ts.map +1 -1
  61. package/resources/vault-provider-configs.d.mts +179 -0
  62. package/resources/vault-provider-configs.d.mts.map +1 -0
  63. package/resources/vault-provider-configs.d.ts +179 -0
  64. package/resources/vault-provider-configs.d.ts.map +1 -0
  65. package/resources/vault-provider-configs.js +99 -0
  66. package/resources/vault-provider-configs.js.map +1 -0
  67. package/resources/vault-provider-configs.mjs +95 -0
  68. package/resources/vault-provider-configs.mjs.map +1 -0
  69. package/resources/vaults/index.d.mts +1 -1
  70. package/resources/vaults/index.d.mts.map +1 -1
  71. package/resources/vaults/index.d.ts +1 -1
  72. package/resources/vaults/index.d.ts.map +1 -1
  73. package/resources/vaults/index.js.map +1 -1
  74. package/resources/vaults/index.mjs.map +1 -1
  75. package/resources/vaults/items.d.mts +662 -36
  76. package/resources/vaults/items.d.mts.map +1 -1
  77. package/resources/vaults/items.d.ts +662 -36
  78. package/resources/vaults/items.d.ts.map +1 -1
  79. package/resources/vaults/items.js +99 -6
  80. package/resources/vaults/items.js.map +1 -1
  81. package/resources/vaults/items.mjs +99 -6
  82. package/resources/vaults/items.mjs.map +1 -1
  83. package/resources/vaults/vaults.d.mts +33 -4
  84. package/resources/vaults/vaults.d.mts.map +1 -1
  85. package/resources/vaults/vaults.d.ts +33 -4
  86. package/resources/vaults/vaults.d.ts.map +1 -1
  87. package/resources/vaults/vaults.js +31 -2
  88. package/resources/vaults/vaults.js.map +1 -1
  89. package/resources/vaults/vaults.mjs +31 -2
  90. package/resources/vaults/vaults.mjs.map +1 -1
  91. package/src/client.ts +19 -0
  92. package/src/lib/browser-routing.ts +27 -6
  93. package/src/resources/auth/connections.ts +7 -0
  94. package/src/resources/browsers/computer.ts +6 -2
  95. package/src/resources/browsers/telemetry.ts +5 -2
  96. package/src/resources/config-registry/config-registry.ts +71 -8
  97. package/src/resources/index.ts +8 -0
  98. package/src/resources/invocations.ts +44 -15
  99. package/src/resources/organization/entitlements.ts +23 -0
  100. package/src/resources/organization/limits.ts +12 -1
  101. package/src/resources/proxies.ts +36 -18
  102. package/src/resources/vault-provider-configs.ts +250 -0
  103. package/src/resources/vaults/index.ts +9 -0
  104. package/src/resources/vaults/items.ts +818 -35
  105. package/src/resources/vaults/vaults.ts +49 -2
  106. package/src/version.ts +1 -1
  107. package/version.d.mts +1 -1
  108. package/version.d.ts +1 -1
  109. package/version.js +1 -1
  110. package/version.mjs +1 -1
@@ -14,6 +14,13 @@ export class Items extends APIResource {
14
14
  * description before using it. Expanded data is fetched from the provider and is
15
15
  * not persisted in the vault item. Requesting an unavailable expansion returns 409
16
16
  * instead of a partial item.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * const vaultItem = await client.vaults.items.retrieve('x', {
21
+ * id_or_name: 'id_or_name',
22
+ * });
23
+ * ```
17
24
  */
18
25
  retrieve(key: string, params: ItemRetrieveParams, options?: RequestOptions): APIPromise<VaultItem> {
19
26
  const { id_or_name, ...query } = params;
@@ -21,7 +28,31 @@ export class Items extends APIResource {
21
28
  }
22
29
 
23
30
  /**
24
- * Update a card specification before or between authorizations
31
+ * Requested cards accept a replacement specification. Pending issuance requests
32
+ * may update provider-supported fields on their existing request, subject to
33
+ * atomic provider approval checks; omitted optional fields remain unchanged and
34
+ * explicit empty lists clear them. Wallet/provider binding and unsupported fields
35
+ * cannot change after authorization starts. An uncertain update enters
36
+ * recovery_required and must not be retried. Checkout cards may be edited between
37
+ * authorizations.
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * const vaultItem = await client.vaults.items.update('x', {
42
+ * id_or_name: 'id_or_name',
43
+ * spec: {
44
+ * provider: 'link',
45
+ * wallet: 'link-wallet',
46
+ * payment_method_id: 'pm_example',
47
+ * amount: 3000,
48
+ * currency: 'usd',
49
+ * merchant_name: 'Example Store',
50
+ * merchant_url: 'https://store.example.com',
51
+ * context:
52
+ * 'The order total changed to USD 30.00 including shipping and taxes for one notebook. Update this unapproved request rather than creating a second payment.',
53
+ * },
54
+ * });
55
+ * ```
25
56
  */
26
57
  update(key: string, params: ItemUpdateParams, options?: RequestOptions): APIPromise<VaultItem> {
27
58
  const { id_or_name, ...body } = params;
@@ -30,13 +61,31 @@ export class Items extends APIResource {
30
61
 
31
62
  /**
32
63
  * List vault items without secret values
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * const vaultItems = await client.vaults.items.list(
68
+ * 'id_or_name',
69
+ * );
70
+ * ```
33
71
  */
34
72
  list(idOrName: string, options?: RequestOptions): APIPromise<ItemListResponse> {
35
73
  return this._client.get(path`/vaults/${idOrName}/items`, options);
36
74
  }
37
75
 
38
76
  /**
39
- * Delete a vault item and invalidate its secret value
77
+ * Unresolved payment operations normally block deletion, including operations on
78
+ * child cards of a wallet. An AgentCard card in recovery_required whose checkout
79
+ * create response returned no authorization ID may be explicitly abandoned by
80
+ * deleting that card directly; deleting its wallet or vault remains blocked.
81
+ * Deleting or recreating an item is not proof that a payment did not occur.
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * await client.vaults.items.delete('x', {
86
+ * id_or_name: 'id_or_name',
87
+ * });
88
+ * ```
40
89
  */
41
90
  delete(key: string, params: ItemDeleteParams, options?: RequestOptions): APIPromise<void> {
42
91
  const { id_or_name } = params;
@@ -48,6 +97,14 @@ export class Items extends APIResource {
48
97
 
49
98
  /**
50
99
  * List immutable audit events for a vault item
100
+ *
101
+ * @example
102
+ * ```ts
103
+ * const vaultItemEvents = await client.vaults.items.events(
104
+ * 'key',
105
+ * { id_or_name: 'id_or_name' },
106
+ * );
107
+ * ```
51
108
  */
52
109
  events(key: string, params: ItemEventsParams, options?: RequestOptions): APIPromise<ItemEventsResponse> {
53
110
  const { id_or_name, ...query } = params;
@@ -56,22 +113,58 @@ export class Items extends APIResource {
56
113
 
57
114
  /**
58
115
  * Retrieve the item first and invoke only an operation listed in
59
- * `available_operations`, following its natural-language description. Operations
60
- * may call an external provider and can return the item's updated state. If the
61
- * provider rate limits spend-request creation, returns HTTP 429 with code
116
+ * `available_operations`, following its natural-language description. Availability
117
+ * is rechecked at execution time; unavailable operations return 409. Authorization
118
+ * and preparation may call an external provider and return updated state. Link
119
+ * cards advertise authorize without checkout context. Eligible unused AgentCard
120
+ * cards advertise prepare_checkout, which requires checkout context and obtains
121
+ * device approval before native Square Pay. Keep the returned approval page open,
122
+ * poll until ready_to_submit, then submit before preparation.expires_at. Unused
123
+ * preparations expire automatically and cannot be reused. If spend-request
124
+ * creation is rate limited, returns HTTP 429 with code
62
125
  * `spend_request_rate_limited`; stop and back off before retrying.
126
+ *
127
+ * Fill returns a value-free execution result. Validation failures before writing
128
+ * return 400 (invalid request or targets), 403 (access or destination denied), 404
129
+ * (resource not found), or 409 (item or browser not ready). Once writing starts,
130
+ * known partial failures and indeterminate field outcomes return 200 with status
131
+ * `failed` or `unknown`, not an automatic-retry signal. A transport error may
132
+ * leave the outcome unknown; do not automatically retry.
133
+ *
134
+ * @example
135
+ * ```ts
136
+ * const vaultItemOperationResponse =
137
+ * await client.vaults.items.performOperation('key', {
138
+ * id_or_name: 'id_or_name',
139
+ * type: 'authorize',
140
+ * });
141
+ * ```
63
142
  */
64
143
  performOperation(
65
144
  key: string,
66
145
  params: ItemPerformOperationParams,
67
146
  options?: RequestOptions,
68
- ): APIPromise<VaultItem> {
147
+ ): APIPromise<VaultItemOperationResponse> {
69
148
  const { id_or_name, ...body } = params;
70
149
  return this._client.post(path`/vaults/${id_or_name}/items/${key}/operations`, { body, ...options });
71
150
  }
72
151
 
73
152
  /**
74
- * Create or retrieve an identical vault item by immutable key
153
+ * Create an item under a key unique within its vault, or retrieve the existing
154
+ * item when its specification matches. An identical card PUT returns the existing
155
+ * card in any lifecycle state without polling the provider, reauthorizing,
156
+ * replacing aliases, or resetting recovery. Conflicting specifications return 409.
157
+ * Provider-specific authorization requirements and retry behavior are described in
158
+ * the item's request schema.
159
+ *
160
+ * @example
161
+ * ```ts
162
+ * const vaultItem = await client.vaults.items.upsert('x', {
163
+ * id_or_name: 'id_or_name',
164
+ * spec: { provider: 'link' },
165
+ * type: 'card',
166
+ * });
167
+ * ```
75
168
  */
76
169
  upsert(key: string, params: ItemUpsertParams, options?: RequestOptions): APIPromise<VaultItem> {
77
170
  const { id_or_name, ...body } = params;
@@ -143,6 +236,50 @@ export interface AgentcardCheckoutAuthorization {
143
236
  replay_status?: number;
144
237
  }
145
238
 
239
+ /**
240
+ * One-use Square checkout preparation. Keep the approval page open through token
241
+ * handoff. The amount is display-only and does not constrain the merchant's
242
+ * eventual charge.
243
+ */
244
+ export interface AgentcardCheckoutPreparation {
245
+ browser_id: string;
246
+
247
+ created_at: string;
248
+
249
+ environment: 'production' | 'sandbox';
250
+
251
+ merchant_origin: string;
252
+
253
+ /**
254
+ * Preparation consumed means egress claimed the preparation and it cannot be
255
+ * reused. It does not mean the attempt settled. Use the enclosing item's status as
256
+ * the lifecycle indicator; item consumed means the attempt settled, not that an
257
+ * order or charge succeeded.
258
+ */
259
+ status: 'creating' | 'awaiting_approval' | 'ready' | 'consumed' | 'cancelled' | 'expired' | 'unknown';
260
+
261
+ id?: string;
262
+
263
+ approval_url?: string;
264
+
265
+ /**
266
+ * When ready, the absolute deadline to submit the first native request; no later
267
+ * than provider readiness expiry or 30 seconds after Kernel first observes
268
+ * readiness. Polling never extends this deadline.
269
+ */
270
+ expires_at?: string;
271
+ }
272
+
273
+ /**
274
+ * Authorize a Link card using its existing purchase specification. Use only after
275
+ * explicit user approval and when the item advertises authorize. Do not
276
+ * automatically retry provider failures or indeterminate outcomes. Checkout
277
+ * context is not accepted.
278
+ */
279
+ export interface AuthorizeVaultItemOperationRequest {
280
+ type: 'authorize';
281
+ }
282
+
146
283
  /**
147
284
  * Live payment card. Test-mode card creation is not supported.
148
285
  */
@@ -279,7 +416,21 @@ export namespace CardVaultItemState {
279
416
  export interface LinkCardState {
280
417
  provider: 'link';
281
418
 
282
- status: 'requested' | 'pending_authorization' | 'ready' | 'consumed' | 'expired' | 'declined';
419
+ /**
420
+ * recovery_required means an original provider operation has an unresolved
421
+ * outcome. Do not retry, delete, or replace it. Known references may be observed
422
+ * safely, but unknown creation without an ID and uncertain card-material retrieval
423
+ * require manual reconciliation with the provider or support. There is no reset or
424
+ * caller-asserted reconciliation operation.
425
+ */
426
+ status:
427
+ | 'requested'
428
+ | 'pending_authorization'
429
+ | 'ready'
430
+ | 'consumed'
431
+ | 'expired'
432
+ | 'declined'
433
+ | 'recovery_required';
283
434
 
284
435
  aliases?: ItemsAPI.VaultCardAliases;
285
436
 
@@ -303,7 +454,28 @@ export namespace CardVaultItemState {
303
454
  export interface AgentCardCardState {
304
455
  provider: 'agentcard';
305
456
 
306
- status: 'requested' | 'ready' | 'pending_approval' | 'degraded';
457
+ /**
458
+ * ready_to_submit is device readiness for at most 30 seconds. consumed means the
459
+ * prepared attempt has settled, not that an order succeeded. stopped cannot be
460
+ * reused. outcome_unknown requires merchant reconciliation and blocks new
461
+ * requests. recovery_required means the original checkout outcome is unresolved.
462
+ * Automatic reuse is blocked. Known authorization IDs must be reconciled through
463
+ * provider observations or support. When no authorization ID was returned, an
464
+ * explicitly confirmed item deletion may abandon the unresolved attempt so the
465
+ * caller can create a replacement; deletion does not prove that the original
466
+ * attempt failed. It does not mean declined or expired.
467
+ */
468
+ status:
469
+ | 'requested'
470
+ | 'ready'
471
+ | 'preparing'
472
+ | 'ready_to_submit'
473
+ | 'pending_approval'
474
+ | 'consumed'
475
+ | 'stopped'
476
+ | 'outcome_unknown'
477
+ | 'degraded'
478
+ | 'recovery_required';
307
479
 
308
480
  aliases?: ItemsAPI.VaultCardAliases;
309
481
 
@@ -315,6 +487,13 @@ export namespace CardVaultItemState {
315
487
 
316
488
  masks?: AgentCardCardState.Masks;
317
489
 
490
+ /**
491
+ * One-use Square checkout preparation. Keep the approval page open through token
492
+ * handoff. The amount is display-only and does not constrain the merchant's
493
+ * eventual charge.
494
+ */
495
+ preparation?: ItemsAPI.AgentcardCheckoutPreparation;
496
+
318
497
  status_reason?: string;
319
498
  }
320
499
 
@@ -329,6 +508,98 @@ export namespace CardVaultItemState {
329
508
  }
330
509
  }
331
510
 
511
+ /**
512
+ * Fill selected fields from one ready, unexpired card into a browser linked to its
513
+ * vault. Only supported for card items created from Link wallets. Only invoke when
514
+ * the item advertises `fill`. Browser and vault must belong to the same project.
515
+ * Kernel checks access and allowed destinations before filling; providing a page
516
+ * URL does not authorize a destination.
517
+ *
518
+ * Find exactly one open page matching `page_url`. For each selector, search the
519
+ * main frame and all descendant frames for editable inputs or selects matched
520
+ * directly or contained within matching elements. Each selector must resolve to
521
+ * one unique editable element across all frames; zero or multiple candidates fail.
522
+ * Count each element once, even if multiple matching containers contain it.
523
+ * Validate all bindings before filling. Select elements match an option by its
524
+ * value, not its label. If the page navigates or a target disappears during
525
+ * filling, stop rather than selecting a different page or element.
526
+ *
527
+ * Fill in request order and stop on the first failure. This operation is not
528
+ * atomic: previously filled fields are not rolled back. Never submit the form or
529
+ * click buttons, though input/change events may trigger site behavior. Fill is the
530
+ * preferred browser-checkout path. Aliases remain an alternative for explicitly
531
+ * chosen egress-substitution integrations. Do not automatically retry or fall back
532
+ * to aliases after a failed or indeterminate operation.
533
+ *
534
+ * Secret values are never returned or included in operation logs, traces, audit
535
+ * events, or error details. This does not prevent an agent with unrestricted
536
+ * browser access from reading values from the page or other browser observation
537
+ * surfaces.
538
+ */
539
+ export interface FillVaultItemOperationRequest {
540
+ /**
541
+ * Browser session ID, not a reusable browser name.
542
+ */
543
+ browser_id: string;
544
+
545
+ /**
546
+ * Field bindings for this step. No two bindings may resolve to the same element.
547
+ */
548
+ fields: Array<VaultCardFillField>;
549
+
550
+ /**
551
+ * Exact current top-level page URL, including path, query, and fragment. Must
552
+ * match exactly one open page in the browser; zero or multiple matches fail. No
553
+ * prefix or glob matching. Must use HTTPS without embedded credentials.
554
+ */
555
+ page_url: string;
556
+
557
+ type: 'fill';
558
+
559
+ /**
560
+ * Total operation deadline in milliseconds, not a per-field timeout.
561
+ */
562
+ timeout_ms?: number;
563
+ }
564
+
565
+ export interface FillVaultItemOperationResult {
566
+ /**
567
+ * Exactly one result per request binding, in request order. After the first failed
568
+ * or unknown field, all remaining fields are not_attempted.
569
+ */
570
+ fields: Array<VaultFillFieldResult>;
571
+
572
+ /**
573
+ * Completed only when all fields were filled. Failed when execution stopped with
574
+ * known outcomes. Unknown when any field's outcome cannot be determined. None of
575
+ * these statuses confirms payment or merchant acceptance.
576
+ */
577
+ status: 'completed' | 'failed' | 'unknown';
578
+
579
+ type: 'fill';
580
+ }
581
+
582
+ /**
583
+ * Prepare an unused AgentCard card for Square checkout. Deliver the returned
584
+ * approval URL and keep the approval page open. Poll the item until
585
+ * ready_to_submit, then submit native Pay before preparation.expires_at. Readiness
586
+ * lasts at most 30 seconds. Unused preparations expire automatically. Preparations
587
+ * are single-use even after failure or expiry; do not automatically retry and
588
+ * reconcile uncertain outcomes with the merchant.
589
+ */
590
+ export interface PrepareCheckoutVaultItemOperationRequest {
591
+ /**
592
+ * Required when preparing an unused AgentCard card for Square. Consent is bound to
593
+ * this browser and declared merchant origin, not a tab. Wait for the item's
594
+ * ready_to_submit status before native Pay and submit within its readiness
595
+ * deadline. Unused preparations expire automatically; every preparation is
596
+ * single-use, including after failure or expiry.
597
+ */
598
+ checkout: VaultCheckoutContext;
599
+
600
+ type: 'prepare_checkout';
601
+ }
602
+
332
603
  export interface VaultCardAliases {
333
604
  cvc: string;
334
605
 
@@ -339,6 +610,112 @@ export interface VaultCardAliases {
339
610
  number: string;
340
611
  }
341
612
 
613
+ /**
614
+ * Combined expiration derived from the stored month and year; not a separate
615
+ * stored secret.
616
+ */
617
+ export type VaultCardFillField =
618
+ | VaultCardFillField.VaultCardStoredFillField
619
+ | VaultCardFillField.VaultCardExpirationFillField;
620
+
621
+ export namespace VaultCardFillField {
622
+ export interface VaultCardStoredFillField {
623
+ /**
624
+ * Field in the decrypted card, not an alias. Number and CVC preserve leading
625
+ * zeros; month uses two digits and year uses four digits. Billing fields use the
626
+ * provider's stored billing address (name, line1, line2, city, state, postal_code,
627
+ * country) without reformatting. Request only needed billing fields. An absent or
628
+ * empty requested billing field returns 400 field_unavailable before any browser
629
+ * writes; it does not make other card fields unavailable.
630
+ */
631
+ field:
632
+ | 'number'
633
+ | 'exp_month'
634
+ | 'exp_year'
635
+ | 'cvc'
636
+ | 'billing_name'
637
+ | 'billing_line1'
638
+ | 'billing_line2'
639
+ | 'billing_city'
640
+ | 'billing_state'
641
+ | 'billing_postal_code'
642
+ | 'billing_country';
643
+
644
+ /**
645
+ * CSS selector for an editable input or select, or a containing element. Must
646
+ * resolve to one unique editable element across all page frames.
647
+ */
648
+ selector: string;
649
+ }
650
+
651
+ /**
652
+ * Combined expiration derived from the stored month and year; not a separate
653
+ * stored secret.
654
+ */
655
+ export interface VaultCardExpirationFillField {
656
+ field: 'expiration';
657
+
658
+ format: 'MM/YY' | 'MM/YYYY';
659
+
660
+ /**
661
+ * CSS selector for an editable input or select, or a containing element. Must
662
+ * resolve to one unique editable element across all page frames.
663
+ */
664
+ selector: string;
665
+ }
666
+ }
667
+
668
+ /**
669
+ * Required when preparing an unused AgentCard card for Square. Consent is bound to
670
+ * this browser and declared merchant origin, not a tab. Wait for the item's
671
+ * ready_to_submit status before native Pay and submit within its readiness
672
+ * deadline. Unused preparations expire automatically; every preparation is
673
+ * single-use, including after failure or expiry.
674
+ */
675
+ export interface VaultCheckoutContext {
676
+ /**
677
+ * Active browser session with this vault bound to it.
678
+ */
679
+ browser_id: string;
680
+
681
+ /**
682
+ * Square environment, independent of the AgentCard credential mode.
683
+ */
684
+ environment: 'production' | 'sandbox';
685
+
686
+ /**
687
+ * Canonical HTTPS origin of the top-level merchant document, not the Square
688
+ * iframe. HTTP localhost is accepted for tests.
689
+ */
690
+ merchant_origin: string;
691
+ }
692
+
693
+ export interface VaultFillFieldResult {
694
+ /**
695
+ * Zero-based index into the request fields array.
696
+ */
697
+ index: number;
698
+
699
+ /**
700
+ * Filled means the fill action completed, not that the website retained or
701
+ * accepted the value.
702
+ */
703
+ status: 'filled' | 'failed' | 'not_attempted' | 'unknown';
704
+
705
+ /**
706
+ * Present only for failed or unknown fields. Never includes secret values, DOM
707
+ * content, or raw browser errors.
708
+ */
709
+ error_code?:
710
+ | 'target_changed'
711
+ | 'element_not_found'
712
+ | 'ambiguous_selector'
713
+ | 'element_not_editable'
714
+ | 'option_not_found'
715
+ | 'timeout'
716
+ | 'execution_failed';
717
+ }
718
+
342
719
  export type VaultItem = VaultItem.WalletVaultItem | VaultItem.CardVaultItem;
343
720
 
344
721
  export namespace VaultItem {
@@ -357,9 +734,12 @@ export namespace VaultItem {
357
734
  key: string;
358
735
 
359
736
  /**
360
- * AgentCard wallet. Mode (sandbox vs live) is fixed by the deployment's AgentCard
361
- * credential; there is no per-item test flag. user_id may only reference a user
362
- * already enrolled by a wallet in this organization.
737
+ * AgentCard wallet. Omit provider_config to use Kernel-managed credentials, or
738
+ * select a customer-owned configuration. Mode (sandbox vs live) is determined by
739
+ * the selected credential; there is no per-item test flag. Without user_id,
740
+ * creation returns a hosted enrollment action and Kernel polls until the user
741
+ * connects. user_id may only reference a user already enrolled by a wallet in this
742
+ * organization under the same configuration.
363
743
  */
364
744
  spec: ItemsAPI.WalletVaultItemSpec;
365
745
 
@@ -397,7 +777,7 @@ export namespace VaultItem {
397
777
  export interface AvailableOperation {
398
778
  description: string;
399
779
 
400
- type: 'authorize';
780
+ type: 'authorize' | 'prepare_checkout' | 'fill';
401
781
  }
402
782
 
403
783
  /**
@@ -456,7 +836,7 @@ export namespace VaultItem {
456
836
  export interface AvailableOperation {
457
837
  description: string;
458
838
 
459
- type: 'authorize';
839
+ type: 'authorize' | 'prepare_checkout' | 'fill';
460
840
  }
461
841
  }
462
842
  }
@@ -521,6 +901,139 @@ export interface VaultItemEvent {
521
901
  data?: { [key: string]: unknown };
522
902
  }
523
903
 
904
+ /**
905
+ * Authorization and preparation return the existing item shape. Fill returns a
906
+ * value-free execution result; it does not persist transient field outcomes on the
907
+ * item.
908
+ */
909
+ export type VaultItemOperationResponse =
910
+ | VaultItemOperationResponse.WalletVaultItem
911
+ | VaultItemOperationResponse.CardVaultItem
912
+ | FillVaultItemOperationResult;
913
+
914
+ export namespace VaultItemOperationResponse {
915
+ export interface WalletVaultItem {
916
+ id: string;
917
+
918
+ available_expansions: Array<WalletVaultItem.AvailableExpansion>;
919
+
920
+ available_operations: Array<WalletVaultItem.AvailableOperation>;
921
+
922
+ created_at: string;
923
+
924
+ /**
925
+ * Immutable item key assigned when the item is created.
926
+ */
927
+ key: string;
928
+
929
+ /**
930
+ * AgentCard wallet. Omit provider_config to use Kernel-managed credentials, or
931
+ * select a customer-owned configuration. Mode (sandbox vs live) is determined by
932
+ * the selected credential; there is no per-item test flag. Without user_id,
933
+ * creation returns a hosted enrollment action and Kernel polls until the user
934
+ * connects. user_id may only reference a user already enrolled by a wallet in this
935
+ * organization under the same configuration.
936
+ */
937
+ spec: ItemsAPI.WalletVaultItemSpec;
938
+
939
+ state: ItemsAPI.WalletVaultItemState;
940
+
941
+ type: 'wallet';
942
+
943
+ updated_at: string;
944
+
945
+ action?: ItemsAPI.VaultItemAction;
946
+
947
+ /**
948
+ * Live, non-persisted data requested through the item GET expand parameter.
949
+ */
950
+ expanded?: WalletVaultItem.Expanded;
951
+
952
+ expires_at?: string;
953
+ }
954
+
955
+ export namespace WalletVaultItem {
956
+ /**
957
+ * Live data that can currently be requested by passing its type to the item GET
958
+ * expand parameter.
959
+ */
960
+ export interface AvailableExpansion {
961
+ description: string;
962
+
963
+ type: 'payment_methods';
964
+ }
965
+
966
+ /**
967
+ * An operation that is currently valid for this item. Read the description before
968
+ * invoking it through the item operations endpoint.
969
+ */
970
+ export interface AvailableOperation {
971
+ description: string;
972
+
973
+ type: 'authorize' | 'prepare_checkout' | 'fill';
974
+ }
975
+
976
+ /**
977
+ * Live, non-persisted data requested through the item GET expand parameter.
978
+ */
979
+ export interface Expanded {
980
+ payment_methods?: Array<ItemsAPI.VaultPaymentMethod>;
981
+ }
982
+ }
983
+
984
+ export interface CardVaultItem {
985
+ id: string;
986
+
987
+ available_expansions: Array<CardVaultItem.AvailableExpansion>;
988
+
989
+ available_operations: Array<CardVaultItem.AvailableOperation>;
990
+
991
+ created_at: string;
992
+
993
+ /**
994
+ * Immutable item key assigned when the item is created.
995
+ */
996
+ key: string;
997
+
998
+ /**
999
+ * Live payment card. Test-mode card creation is not supported.
1000
+ */
1001
+ spec: ItemsAPI.CardVaultItemSpec;
1002
+
1003
+ state: ItemsAPI.CardVaultItemState;
1004
+
1005
+ type: 'card';
1006
+
1007
+ updated_at: string;
1008
+
1009
+ action?: ItemsAPI.VaultItemAction;
1010
+
1011
+ expires_at?: string;
1012
+ }
1013
+
1014
+ export namespace CardVaultItem {
1015
+ /**
1016
+ * Live data that can currently be requested by passing its type to the item GET
1017
+ * expand parameter.
1018
+ */
1019
+ export interface AvailableExpansion {
1020
+ description: string;
1021
+
1022
+ type: 'payment_methods';
1023
+ }
1024
+
1025
+ /**
1026
+ * An operation that is currently valid for this item. Read the description before
1027
+ * invoking it through the item operations endpoint.
1028
+ */
1029
+ export interface AvailableOperation {
1030
+ description: string;
1031
+
1032
+ type: 'authorize' | 'prepare_checkout' | 'fill';
1033
+ }
1034
+ }
1035
+ }
1036
+
524
1037
  export interface VaultPaymentMethod {
525
1038
  id: string;
526
1039
 
@@ -572,9 +1085,12 @@ export namespace VaultPaymentMethod {
572
1085
  }
573
1086
 
574
1087
  /**
575
- * AgentCard wallet. Mode (sandbox vs live) is fixed by the deployment's AgentCard
576
- * credential; there is no per-item test flag. user_id may only reference a user
577
- * already enrolled by a wallet in this organization.
1088
+ * AgentCard wallet. Omit provider_config to use Kernel-managed credentials, or
1089
+ * select a customer-owned configuration. Mode (sandbox vs live) is determined by
1090
+ * the selected credential; there is no per-item test flag. Without user_id,
1091
+ * creation returns a hosted enrollment action and Kernel polls until the user
1092
+ * connects. user_id may only reference a user already enrolled by a wallet in this
1093
+ * organization under the same configuration.
578
1094
  */
579
1095
  export type WalletVaultItemSpec =
580
1096
  | WalletVaultItemSpec.LinkWalletVaultItemSpec
@@ -589,28 +1105,73 @@ export namespace WalletVaultItemSpec {
589
1105
 
590
1106
  export namespace LinkWalletVaultItemSpec {
591
1107
  export interface Authorization {
592
- client: Authorization.Client;
1108
+ client: Authorization.KernelManagedOAuthClient | Authorization.CustomerManagedOAuthClient;
593
1109
 
594
1110
  method: 'oauth';
595
1111
  }
596
1112
 
597
1113
  export namespace Authorization {
598
- export interface Client {
1114
+ export interface KernelManagedOAuthClient {
599
1115
  type: 'kernel_managed';
600
1116
  }
1117
+
1118
+ export interface CustomerManagedOAuthClient {
1119
+ /**
1120
+ * Select a provider config by ID or name. Responses return the ID. Renaming a
1121
+ * config does not change existing wallet bindings; a wallet cannot switch to a
1122
+ * different config after creation.
1123
+ */
1124
+ provider_config: CustomerManagedOAuthClient.ProviderConfig;
1125
+
1126
+ type: 'customer_managed';
1127
+ }
1128
+
1129
+ export namespace CustomerManagedOAuthClient {
1130
+ /**
1131
+ * Select a provider config by ID or name. Responses return the ID. Renaming a
1132
+ * config does not change existing wallet bindings; a wallet cannot switch to a
1133
+ * different config after creation.
1134
+ */
1135
+ export interface ProviderConfig {
1136
+ id?: string;
1137
+
1138
+ name?: string;
1139
+ }
1140
+ }
601
1141
  }
602
1142
  }
603
1143
 
604
1144
  /**
605
- * AgentCard wallet. Mode (sandbox vs live) is fixed by the deployment's AgentCard
606
- * credential; there is no per-item test flag. user_id may only reference a user
607
- * already enrolled by a wallet in this organization.
1145
+ * AgentCard wallet. Omit provider_config to use Kernel-managed credentials, or
1146
+ * select a customer-owned configuration. Mode (sandbox vs live) is determined by
1147
+ * the selected credential; there is no per-item test flag. Without user_id,
1148
+ * creation returns a hosted enrollment action and Kernel polls until the user
1149
+ * connects. user_id may only reference a user already enrolled by a wallet in this
1150
+ * organization under the same configuration.
608
1151
  */
609
1152
  export interface AgentCardWalletVaultItemSpec {
610
1153
  provider: 'agentcard';
611
1154
 
1155
+ /**
1156
+ * Select an AgentCard configuration. The wallet's configuration cannot be changed
1157
+ * after creation.
1158
+ */
1159
+ provider_config?: AgentCardWalletVaultItemSpec.ProviderConfig;
1160
+
612
1161
  user_id?: string;
613
1162
  }
1163
+
1164
+ export namespace AgentCardWalletVaultItemSpec {
1165
+ /**
1166
+ * Select an AgentCard configuration. The wallet's configuration cannot be changed
1167
+ * after creation.
1168
+ */
1169
+ export interface ProviderConfig {
1170
+ id?: string;
1171
+
1172
+ name?: string;
1173
+ }
1174
+ }
614
1175
  }
615
1176
 
616
1177
  export type WalletVaultItemState =
@@ -696,16 +1257,80 @@ export interface ItemEventsParams {
696
1257
  wait?: number;
697
1258
  }
698
1259
 
699
- export interface ItemPerformOperationParams {
700
- /**
701
- * Path param
702
- */
703
- id_or_name: string;
1260
+ export type ItemPerformOperationParams =
1261
+ | ItemPerformOperationParams.AuthorizeVaultItemOperationRequest
1262
+ | ItemPerformOperationParams.PrepareCheckoutVaultItemOperationRequest
1263
+ | ItemPerformOperationParams.FillVaultItemOperationRequest;
704
1264
 
705
- /**
706
- * Body param
707
- */
708
- type: 'authorize';
1265
+ export declare namespace ItemPerformOperationParams {
1266
+ export interface AuthorizeVaultItemOperationRequest {
1267
+ /**
1268
+ * Path param
1269
+ */
1270
+ id_or_name: string;
1271
+
1272
+ /**
1273
+ * Body param
1274
+ */
1275
+ type: 'authorize';
1276
+ }
1277
+
1278
+ export interface PrepareCheckoutVaultItemOperationRequest {
1279
+ /**
1280
+ * Path param
1281
+ */
1282
+ id_or_name: string;
1283
+
1284
+ /**
1285
+ * Body param: Required when preparing an unused AgentCard card for Square. Consent
1286
+ * is bound to this browser and declared merchant origin, not a tab. Wait for the
1287
+ * item's ready_to_submit status before native Pay and submit within its readiness
1288
+ * deadline. Unused preparations expire automatically; every preparation is
1289
+ * single-use, including after failure or expiry.
1290
+ */
1291
+ checkout: VaultCheckoutContext;
1292
+
1293
+ /**
1294
+ * Body param
1295
+ */
1296
+ type: 'prepare_checkout';
1297
+ }
1298
+
1299
+ export interface FillVaultItemOperationRequest {
1300
+ /**
1301
+ * Path param
1302
+ */
1303
+ id_or_name: string;
1304
+
1305
+ /**
1306
+ * Body param: Browser session ID, not a reusable browser name.
1307
+ */
1308
+ browser_id: string;
1309
+
1310
+ /**
1311
+ * Body param: Field bindings for this step. No two bindings may resolve to the
1312
+ * same element.
1313
+ */
1314
+ fields: Array<VaultCardFillField>;
1315
+
1316
+ /**
1317
+ * Body param: Exact current top-level page URL, including path, query, and
1318
+ * fragment. Must match exactly one open page in the browser; zero or multiple
1319
+ * matches fail. No prefix or glob matching. Must use HTTPS without embedded
1320
+ * credentials.
1321
+ */
1322
+ page_url: string;
1323
+
1324
+ /**
1325
+ * Body param
1326
+ */
1327
+ type: 'fill';
1328
+
1329
+ /**
1330
+ * Body param: Total operation deadline in milliseconds, not a per-field timeout.
1331
+ */
1332
+ timeout_ms?: number;
1333
+ }
709
1334
  }
710
1335
 
711
1336
  export type ItemUpsertParams =
@@ -720,11 +1345,16 @@ export declare namespace ItemUpsertParams {
720
1345
  id_or_name: string;
721
1346
 
722
1347
  /**
723
- * Body param: AgentCard wallet. Mode (sandbox vs live) is fixed by the
724
- * deployment's AgentCard credential; there is no per-item test flag. user_id may
725
- * only reference a user already enrolled by a wallet in this organization.
1348
+ * Body param: AgentCard wallet. Omit provider_config to use Kernel-managed
1349
+ * credentials, or select a customer-owned configuration. Mode (sandbox vs live) is
1350
+ * determined by the selected credential; there is no per-item test flag. Without
1351
+ * user_id, creation returns a hosted enrollment action and Kernel polls until the
1352
+ * user connects. user_id may only reference a user already enrolled by a wallet in
1353
+ * this organization under the same configuration.
726
1354
  */
727
- spec: WalletVaultItemSpec;
1355
+ spec:
1356
+ | WalletVaultItemRequest.LinkWalletVaultItemRequestSpec
1357
+ | WalletVaultItemRequest.AgentCardWalletVaultItemSpec;
728
1358
 
729
1359
  /**
730
1360
  * Body param
@@ -732,6 +1362,150 @@ export declare namespace ItemUpsertParams {
732
1362
  type: 'wallet';
733
1363
  }
734
1364
 
1365
+ export namespace WalletVaultItemRequest {
1366
+ export interface LinkWalletVaultItemRequestSpec {
1367
+ /**
1368
+ * Kernel starts and completes the user's Link authorization flow.
1369
+ */
1370
+ authorization:
1371
+ | LinkWalletVaultItemRequestSpec.KernelManagedLinkAuthorizationInput
1372
+ | LinkWalletVaultItemRequestSpec.ImportedLinkAuthorizationInput;
1373
+
1374
+ provider: 'link';
1375
+ }
1376
+
1377
+ export namespace LinkWalletVaultItemRequestSpec {
1378
+ /**
1379
+ * Kernel starts and completes the user's Link authorization flow.
1380
+ */
1381
+ export interface KernelManagedLinkAuthorizationInput {
1382
+ client: KernelManagedLinkAuthorizationInput.Client;
1383
+
1384
+ method: 'oauth';
1385
+ }
1386
+
1387
+ export namespace KernelManagedLinkAuthorizationInput {
1388
+ export interface Client {
1389
+ type: 'kernel_managed';
1390
+ }
1391
+ }
1392
+
1393
+ /**
1394
+ * The customer's backend completes Link OAuth and supplies the resulting tokens.
1395
+ * For a new wallet, Kernel verifies the access token can access Link payment
1396
+ * methods without consuming or rotating the refresh token. Valid access creates a
1397
+ * wallet with state.status=connected. An expired, invalid, revoked, or
1398
+ * insufficiently scoped access token returns 400 and no wallet is created. Refresh
1399
+ * expired tokens in your backend before importing them. A failed import does not
1400
+ * modify existing wallets. After successful import, Kernel owns subsequent
1401
+ * refresh-token rotation; the customer must stop refreshing this grant. Import
1402
+ * does not verify the refresh token: if it or the configured client credentials
1403
+ * are rejected during a later refresh, the imported wallet becomes degraded. An
1404
+ * unknown refresh outcome also leaves it degraded; Kernel does not retry a refresh
1405
+ * token that may already have been consumed. There is no in-place reauthorization
1406
+ * operation for an imported wallet. If this imported wallet's credentials become
1407
+ * unusable, obtain a fresh Link OAuth grant in your backend and create a wallet
1408
+ * under a NEW wallet key. Use the new wallet for NEW cards and payments, not to
1409
+ * retry an old payment whose outcome is uncertain. This does not replace the old
1410
+ * grant, rebind existing cards, or resolve their payment outcomes. Retain the old
1411
+ * wallet and its cards while reconciling any uncertain payments with the provider
1412
+ * or support. Do not repeat an uncertain payment on the new wallet, and do not
1413
+ * treat deletion as evidence that it did not execute. Deletion of the old wallet
1414
+ * can remain blocked by unresolved child cards. Repeating a create for the same
1415
+ * item key and non-secret spec returns the existing wallet without replacing
1416
+ * tokens, even if they have rotated or the wallet needs reconnection. ID and name
1417
+ * references resolving to the same config are equivalent. A different config or
1418
+ * non-secret spec returns 409. This create operation does not replace an existing
1419
+ * grant.
1420
+ */
1421
+ export interface ImportedLinkAuthorizationInput {
1422
+ client: ImportedLinkAuthorizationInput.Client;
1423
+
1424
+ method: 'oauth';
1425
+
1426
+ /**
1427
+ * Send the token pair from your backend. Both tokens must be from the same Link
1428
+ * grant under the referenced client. Supply a currently valid access token. Kernel
1429
+ * refreshes when needed after import and uses the expiry returned by Link for
1430
+ * subsequent tokens. Tokens are never returned in wallet responses, events, or
1431
+ * logs.
1432
+ */
1433
+ tokens: ImportedLinkAuthorizationInput.Tokens;
1434
+ }
1435
+
1436
+ export namespace ImportedLinkAuthorizationInput {
1437
+ export interface Client {
1438
+ /**
1439
+ * Select a provider config by ID or name. Responses return the ID. Renaming a
1440
+ * config does not change existing wallet bindings; a wallet cannot switch to a
1441
+ * different config after creation.
1442
+ */
1443
+ provider_config: Client.ProviderConfig;
1444
+
1445
+ type: 'customer_managed';
1446
+ }
1447
+
1448
+ export namespace Client {
1449
+ /**
1450
+ * Select a provider config by ID or name. Responses return the ID. Renaming a
1451
+ * config does not change existing wallet bindings; a wallet cannot switch to a
1452
+ * different config after creation.
1453
+ */
1454
+ export interface ProviderConfig {
1455
+ id?: string;
1456
+
1457
+ name?: string;
1458
+ }
1459
+ }
1460
+
1461
+ /**
1462
+ * Send the token pair from your backend. Both tokens must be from the same Link
1463
+ * grant under the referenced client. Supply a currently valid access token. Kernel
1464
+ * refreshes when needed after import and uses the expiry returned by Link for
1465
+ * subsequent tokens. Tokens are never returned in wallet responses, events, or
1466
+ * logs.
1467
+ */
1468
+ export interface Tokens {
1469
+ access_token: string;
1470
+
1471
+ refresh_token: string;
1472
+ }
1473
+ }
1474
+ }
1475
+
1476
+ /**
1477
+ * AgentCard wallet. Omit provider_config to use Kernel-managed credentials, or
1478
+ * select a customer-owned configuration. Mode (sandbox vs live) is determined by
1479
+ * the selected credential; there is no per-item test flag. Without user_id,
1480
+ * creation returns a hosted enrollment action and Kernel polls until the user
1481
+ * connects. user_id may only reference a user already enrolled by a wallet in this
1482
+ * organization under the same configuration.
1483
+ */
1484
+ export interface AgentCardWalletVaultItemSpec {
1485
+ provider: 'agentcard';
1486
+
1487
+ /**
1488
+ * Select an AgentCard configuration. The wallet's configuration cannot be changed
1489
+ * after creation.
1490
+ */
1491
+ provider_config?: AgentCardWalletVaultItemSpec.ProviderConfig;
1492
+
1493
+ user_id?: string;
1494
+ }
1495
+
1496
+ export namespace AgentCardWalletVaultItemSpec {
1497
+ /**
1498
+ * Select an AgentCard configuration. The wallet's configuration cannot be changed
1499
+ * after creation.
1500
+ */
1501
+ export interface ProviderConfig {
1502
+ id?: string;
1503
+
1504
+ name?: string;
1505
+ }
1506
+ }
1507
+ }
1508
+
735
1509
  export interface CardVaultItemRequest {
736
1510
  /**
737
1511
  * Path param
@@ -753,12 +1527,21 @@ export declare namespace ItemUpsertParams {
753
1527
  export declare namespace Items {
754
1528
  export {
755
1529
  type AgentcardCheckoutAuthorization as AgentcardCheckoutAuthorization,
1530
+ type AgentcardCheckoutPreparation as AgentcardCheckoutPreparation,
1531
+ type AuthorizeVaultItemOperationRequest as AuthorizeVaultItemOperationRequest,
756
1532
  type CardVaultItemSpec as CardVaultItemSpec,
757
1533
  type CardVaultItemState as CardVaultItemState,
1534
+ type FillVaultItemOperationRequest as FillVaultItemOperationRequest,
1535
+ type FillVaultItemOperationResult as FillVaultItemOperationResult,
1536
+ type PrepareCheckoutVaultItemOperationRequest as PrepareCheckoutVaultItemOperationRequest,
758
1537
  type VaultCardAliases as VaultCardAliases,
1538
+ type VaultCardFillField as VaultCardFillField,
1539
+ type VaultCheckoutContext as VaultCheckoutContext,
1540
+ type VaultFillFieldResult as VaultFillFieldResult,
759
1541
  type VaultItem as VaultItem,
760
1542
  type VaultItemAction as VaultItemAction,
761
1543
  type VaultItemEvent as VaultItemEvent,
1544
+ type VaultItemOperationResponse as VaultItemOperationResponse,
762
1545
  type VaultPaymentMethod as VaultPaymentMethod,
763
1546
  type WalletVaultItemSpec as WalletVaultItemSpec,
764
1547
  type WalletVaultItemState as WalletVaultItemState,